mirror of
https://github.com/hcengineering/platform.git
synced 2026-08-17 18:05:42 +02:00
Add AllMatchValue function and related updates across multiple files (#10990)
Signed-off-by: Denis Bykhov <bykhov.denis@gmail.com>
This commit is contained in:
@@ -185,6 +185,19 @@ export function defineFunctions (builder: Builder): void {
|
||||
process.function.All
|
||||
)
|
||||
|
||||
builder.createDoc(
|
||||
process.class.ProcessFunction,
|
||||
core.space.Model,
|
||||
{
|
||||
of: core.class.ArrOf,
|
||||
category: 'array',
|
||||
label: process.string.AllMatchValue,
|
||||
type: 'reduce',
|
||||
editor: process.transformEditor.FilterEditor
|
||||
},
|
||||
process.function.AllMatchValue
|
||||
)
|
||||
|
||||
builder.createDoc(
|
||||
process.class.ProcessFunction,
|
||||
core.space.Model,
|
||||
|
||||
@@ -388,6 +388,10 @@ export function createModel (builder: Builder): void {
|
||||
func: serverProcess.transform.FirstMatchValue
|
||||
})
|
||||
|
||||
builder.mixin(process.function.AllMatchValue, process.class.ProcessFunction, serverProcess.mixin.FuncImpl, {
|
||||
func: serverProcess.transform.AllMatchValue
|
||||
})
|
||||
|
||||
builder.mixin(process.function.Filter, process.class.ProcessFunction, serverProcess.mixin.FuncImpl, {
|
||||
func: serverProcess.transform.Filter
|
||||
})
|
||||
|
||||
@@ -117,6 +117,7 @@
|
||||
"ExecutionInitiator": "Iniciátor provedení",
|
||||
"ExecutionStarted": "Provedení spuštěno",
|
||||
"Filter": "Filtr",
|
||||
"AllMatchValue": "Všechny odpovídající hodnoty",
|
||||
"FirstMatchValue": "První odpovídající hodnota",
|
||||
"ConfigLabel": "Konfigurace procesů",
|
||||
"ConfigDescription": "Definujte procesy pro automatizaci pracovních postupů a obchodních procesů.",
|
||||
|
||||
@@ -117,6 +117,7 @@
|
||||
"ExecutionInitiator": "Ausführungsinitiator",
|
||||
"ExecutionStarted": "Ausführung gestartet",
|
||||
"Filter": "Filter",
|
||||
"AllMatchValue": "Alle passenden Werte",
|
||||
"FirstMatchValue": "Erster passender Wert",
|
||||
"ConfigLabel": "Prozesskonfiguration",
|
||||
"ConfigDescription": "Definieren Sie Prozesse, um Workflows und Geschäftsprozesse zu automatisieren.",
|
||||
|
||||
@@ -124,6 +124,7 @@
|
||||
"ExecutionInitiator": "Execution initiator",
|
||||
"ExecutionStarted": "Execution started",
|
||||
"Filter": "Filter",
|
||||
"AllMatchValue": "All matching values",
|
||||
"FirstMatchValue": "First match value",
|
||||
"ConfigLabel": "Process configuration",
|
||||
"ConfigDescription": "Define processes to automate workflows and business processes.",
|
||||
|
||||
@@ -124,6 +124,7 @@
|
||||
"ExecutionInitiator": "Iniciador de Ejecución",
|
||||
"ExecutionStarted": "Ejecución Iniciada",
|
||||
"Filter": "Filtro",
|
||||
"AllMatchValue": "Todos los valores coincidentes",
|
||||
"FirstMatchValue": "Primer valor coincidente",
|
||||
"ConfigLabel": "Configuración de procesos",
|
||||
"ConfigDescription": "Defina procesos para automatizar flujos de trabajo y procesos comerciales.",
|
||||
|
||||
@@ -124,6 +124,7 @@
|
||||
"ExecutionInitiator": "Initiateur d'exécution",
|
||||
"ExecutionStarted": "Exécution démarrée",
|
||||
"Filter": "Filtrer",
|
||||
"AllMatchValue": "Toutes les valeurs correspondantes",
|
||||
"FirstMatchValue": "Première valeur correspondante",
|
||||
"ConfigLabel": "Configuration des processus",
|
||||
"ConfigDescription": "Définissez des processus pour automatiser les flux de travail et les processus métier.",
|
||||
|
||||
@@ -124,6 +124,7 @@
|
||||
"ExecutionInitiator": "Iniziatore dell'esecuzione",
|
||||
"ExecutionStarted": "Esecuzione avviata",
|
||||
"Filter": "Filtro",
|
||||
"AllMatchValue": "Tutti i valori corrispondenti",
|
||||
"FirstMatchValue": "Primo valore corrispondente",
|
||||
"ConfigLabel": "Configurazione del processo",
|
||||
"ConfigDescription": "Definire i processi per automatizzare i flussi di lavoro e i processi aziendali.",
|
||||
|
||||
@@ -123,6 +123,7 @@
|
||||
"ExecutionInitiator": "実行の発起人",
|
||||
"ExecutionStarted": "実行が開始されました",
|
||||
"Filter": "フィルター",
|
||||
"AllMatchValue": "一致するすべての値",
|
||||
"FirstMatchValue": "最初の一致する値",
|
||||
"ConfigLabel": "プロセス構成",
|
||||
"ConfigDescription": "ワークフローやビジネスプロセスを自動化するためのプロセスを定義します。",
|
||||
|
||||
@@ -124,6 +124,7 @@
|
||||
"ExecutionInitiator": "실행 시작자",
|
||||
"ExecutionStarted": "실행 시작됨",
|
||||
"Filter": "필터",
|
||||
"AllMatchValue": "모든 일치 값",
|
||||
"FirstMatchValue": "첫 일치 값",
|
||||
"ConfigLabel": "프로세스 구성",
|
||||
"ConfigDescription": "워크플로와 비즈니스 프로세스를 자동화할 프로세스를 정의합니다.",
|
||||
|
||||
@@ -124,6 +124,7 @@
|
||||
"ExecutionInitiator": "Inicjator wykonania",
|
||||
"ExecutionStarted": "Wykonanie rozpoczęte",
|
||||
"Filter": "Filtr",
|
||||
"AllMatchValue": "Wszystkie pasujące wartości",
|
||||
"FirstMatchValue": "Pierwsza pasująca wartość",
|
||||
"ConfigLabel": "Konfiguracja procesu",
|
||||
"ConfigDescription": "Definiuj procesy do automatyzacji organizacji zadań i procesów biznesowych.",
|
||||
|
||||
@@ -124,6 +124,7 @@
|
||||
"ExecutionInitiator": "Iniciador de Execução",
|
||||
"ExecutionStarted": "Execução Iniciada",
|
||||
"Filter": "Filtrar",
|
||||
"AllMatchValue": "Todos os valores correspondentes",
|
||||
"FirstMatchValue": "Primeiro Valor Correspondente",
|
||||
"ConfigLabel": "Configuração de processos",
|
||||
"ConfigDescription": "Defina processos para automatizar fluxos de trabalho e processos de negócios.",
|
||||
|
||||
@@ -124,6 +124,7 @@
|
||||
"ExecutionInitiator": "Iniciador de Execução",
|
||||
"ExecutionStarted": "Execução Iniciada",
|
||||
"Filter": "Filtrar",
|
||||
"AllMatchValue": "Todos os valores correspondentes",
|
||||
"FirstMatchValue": "Primeiro Valor Correspondente",
|
||||
"ConfigLabel": "Configuração de processos",
|
||||
"ConfigDescription": "Defina processos para automatizar fluxos de trabalho e processos de negócios.",
|
||||
|
||||
@@ -124,6 +124,7 @@
|
||||
"ExecutionInitiator": "Инициатор выполнения",
|
||||
"ExecutionStarted": "Выполнение начато",
|
||||
"Filter": "Фильтр",
|
||||
"AllMatchValue": "Все подходящие значения",
|
||||
"FirstMatchValue": "Первое подходящее значение",
|
||||
"ConfigLabel": "Конфигурация процессов",
|
||||
"ConfigDescription": "Определяйте процессы для автоматизации рабочих процессов и бизнес-процессов.",
|
||||
|
||||
@@ -121,6 +121,7 @@
|
||||
"ProcessFinished": "\"{process}\" süreci \"{state}\" durumunda tamamlandı",
|
||||
"NewProcessToDo": "Yeni süreç Eylem öğesi",
|
||||
"Filter": "Filtre",
|
||||
"AllMatchValue": "Tüm eşleşen değerler",
|
||||
"FirstMatchValue": "İlk eşleşen değer",
|
||||
"ConfigLabel": "Süreç yapılandırması",
|
||||
"ConfigDescription": "İş akışlarını ve iş süreçlerini otomatikleştirmek için süreçler tanımlayın.",
|
||||
|
||||
@@ -124,6 +124,7 @@
|
||||
"ExecutionInitiator": "执行发起者",
|
||||
"ExecutionStarted": "执行已启动",
|
||||
"Filter": "过滤",
|
||||
"AllMatchValue": "所有匹配值",
|
||||
"FirstMatchValue": "第一个匹配值",
|
||||
"ConfigLabel": "流程配置",
|
||||
"ConfigDescription": "定义流程以自动化工作流和业务流程。",
|
||||
|
||||
@@ -157,6 +157,7 @@ export default mergeIds(processId, process, {
|
||||
Split: '' as IntlString,
|
||||
Cut: '' as IntlString,
|
||||
Filter: '' as IntlString,
|
||||
AllMatchValue: '' as IntlString,
|
||||
FirstMatchValue: '' as IntlString,
|
||||
FirstValue: '' as IntlString,
|
||||
LastValue: '' as IntlString,
|
||||
|
||||
@@ -353,6 +353,7 @@ export default plugin(processId, {
|
||||
OnEvent: '' as Asset
|
||||
},
|
||||
function: {
|
||||
AllMatchValue: '' as Ref<ProcessFunction>,
|
||||
FirstMatchValue: '' as Ref<ProcessFunction>,
|
||||
Filter: '' as Ref<ProcessFunction>,
|
||||
FirstValue: '' as Ref<ProcessFunction>,
|
||||
|
||||
@@ -85,6 +85,7 @@ import { FieldChangedRollback, ToDoCancellRollback, ToDoCloseRollback } from './
|
||||
import {
|
||||
Absolute,
|
||||
Add,
|
||||
AllMatchValue,
|
||||
All,
|
||||
Append,
|
||||
Ceil,
|
||||
@@ -819,6 +820,7 @@ export default async () => ({
|
||||
EmptyValue,
|
||||
ExecutionInitiator,
|
||||
ExecutionStarted,
|
||||
AllMatchValue,
|
||||
FirstMatchValue,
|
||||
Filter,
|
||||
StringFromNumber,
|
||||
|
||||
@@ -63,6 +63,26 @@ export async function FirstMatchValue (
|
||||
}
|
||||
}
|
||||
|
||||
export async function AllMatchValue (
|
||||
value: any[],
|
||||
props: Record<string, any>,
|
||||
control: ProcessControl
|
||||
): Promise<any[] | undefined> {
|
||||
if (value == null) {
|
||||
return
|
||||
}
|
||||
if (!Array.isArray(value)) return value
|
||||
const { _class, ...otherProps } = props
|
||||
if (_class == null) return
|
||||
if (value.length === 0) return
|
||||
if (typeof value[0] === 'string') {
|
||||
const docs = await control.client.findAll(_class, { _id: { $in: value } })
|
||||
return matchQuery(docs, otherProps, core.class.Doc, control.client.getHierarchy(), true).map((p) => p._id)
|
||||
} else if (typeof value[0] === 'object') {
|
||||
return matchQuery(value, otherProps, core.class.Doc, control.client.getHierarchy(), true)
|
||||
}
|
||||
}
|
||||
|
||||
// #endregion
|
||||
|
||||
// #region Array
|
||||
|
||||
@@ -115,6 +115,7 @@ export default plugin(serverProcessId, {
|
||||
EmptyValue: '' as Resource<TransformFunc>,
|
||||
EmptyArray: '' as Resource<TransformFunc>,
|
||||
Filter: '' as Resource<TransformFunc>,
|
||||
AllMatchValue: '' as Resource<TransformFunc>,
|
||||
FirstMatchValue: '' as Resource<TransformFunc>,
|
||||
ExecutionInitiator: '' as Resource<TransformFunc>,
|
||||
ExecutionStarted: '' as Resource<TransformFunc>,
|
||||
|
||||
Reference in New Issue
Block a user