From b9657d53d130a2ed8034c1b71ab0cf8b7a0b4994 Mon Sep 17 00:00:00 2001 From: Denis Bykhov Date: Sun, 19 Apr 2026 02:29:55 +0500 Subject: [PATCH] Add min and max transformation functions (#10782) Signed-off-by: Denis Bykhov --- models/process/src/functions.ts | 30 ++++++++++++++++ models/server-process/src/index.ts | 8 +++++ plugins/process-assets/lang/cs.json | 4 ++- plugins/process-assets/lang/de.json | 4 ++- plugins/process-assets/lang/en.json | 2 ++ plugins/process-assets/lang/es.json | 2 ++ plugins/process-assets/lang/fr.json | 2 ++ plugins/process-assets/lang/it.json | 2 ++ plugins/process-assets/lang/ja.json | 2 ++ plugins/process-assets/lang/pt-br.json | 2 ++ plugins/process-assets/lang/pt.json | 2 ++ plugins/process-assets/lang/ru.json | 2 ++ plugins/process-assets/lang/tr.json | 2 ++ plugins/process-assets/lang/zh.json | 2 ++ .../AttrContextPresenter.svelte | 11 ++++-- .../ContextValuePresenter.svelte | 2 +- .../contextEditors/ResultInput.svelte | 19 +++++++++-- .../components/settings/ResultEditor.svelte | 13 ++++++- .../NumberPresenter.svelte | 4 ++- plugins/process-resources/src/plugin.ts | 2 ++ plugins/process-resources/src/utils.ts | 7 ++-- plugins/process/src/index.ts | 2 ++ server-plugins/process-resources/src/index.ts | 6 +++- .../process-resources/src/transform.ts | 34 +++++++++++++++++++ server-plugins/process/src/index.ts | 2 ++ 25 files changed, 155 insertions(+), 13 deletions(-) diff --git a/models/process/src/functions.ts b/models/process/src/functions.ts index 5beae3ee06..4196eba261 100644 --- a/models/process/src/functions.ts +++ b/models/process/src/functions.ts @@ -354,6 +354,36 @@ export function defineFunctions (builder: Builder): void { process.function.Floor ) + builder.createDoc( + process.class.ProcessFunction, + core.space.Model, + { + of: core.class.TypeNumber, + category: 'attribute', + label: process.string.Min, + presenter: process.transformPresenter.NumberPresenter, + type: 'transform', + allowMany: true, + editor: process.transformEditor.NumberEditor + }, + process.function.Min + ) + + builder.createDoc( + process.class.ProcessFunction, + core.space.Model, + { + of: core.class.TypeNumber, + category: 'attribute', + label: process.string.Max, + presenter: process.transformPresenter.NumberPresenter, + type: 'transform', + allowMany: true, + editor: process.transformEditor.NumberEditor + }, + process.function.Max + ) + builder.createDoc( process.class.ProcessFunction, core.space.Model, diff --git a/models/server-process/src/index.ts b/models/server-process/src/index.ts index 8f53293117..66be5d3b08 100644 --- a/models/server-process/src/index.ts +++ b/models/server-process/src/index.ts @@ -303,6 +303,14 @@ export function createModel (builder: Builder): void { func: serverProcess.transform.Floor }) + builder.mixin(process.function.Min, process.class.ProcessFunction, serverProcess.mixin.FuncImpl, { + func: serverProcess.transform.Min + }) + + builder.mixin(process.function.Max, process.class.ProcessFunction, serverProcess.mixin.FuncImpl, { + func: serverProcess.transform.Max + }) + builder.mixin(process.function.Offset, process.class.ProcessFunction, serverProcess.mixin.FuncImpl, { func: serverProcess.transform.Offset }) diff --git a/plugins/process-assets/lang/cs.json b/plugins/process-assets/lang/cs.json index 5c292d2dfd..193665fa64 100644 --- a/plugins/process-assets/lang/cs.json +++ b/plugins/process-assets/lang/cs.json @@ -164,7 +164,9 @@ "MonthFromDate": "Měsíc z data", "DayFromDate": "Den z data", "DateDifference": "Rozdíl dat", - "EmptyValue": "Prázdná hodnota" + "EmptyValue": "Prázdná hodnota", + "Min": "Min", + "Max": "Max" }, "error": { "MethodNotFound": "Metoda nenalezena: {methodId}", diff --git a/plugins/process-assets/lang/de.json b/plugins/process-assets/lang/de.json index 05a1a39f03..9548786291 100644 --- a/plugins/process-assets/lang/de.json +++ b/plugins/process-assets/lang/de.json @@ -164,7 +164,9 @@ "MonthFromDate": "Monat aus Datum", "DayFromDate": "Tag aus Datum", "DateDifference": "Datumsdifferenz", - "EmptyValue": "Leerer Wert" + "EmptyValue": "Leerer Wert", + "Min": "Min", + "Max": "Max" }, "error": { "MethodNotFound": "Methode nicht gefunden: {methodId}", diff --git a/plugins/process-assets/lang/en.json b/plugins/process-assets/lang/en.json index 8c1829fddb..3d33ecf83a 100644 --- a/plugins/process-assets/lang/en.json +++ b/plugins/process-assets/lang/en.json @@ -90,6 +90,8 @@ "Absolute": "Absolute", "Ceil": "Ceil", "Floor": "Floor", + "Min": "Min", + "Max": "Max", "LogAction": "Event", "Started": "Started", "Each": "Each", diff --git a/plugins/process-assets/lang/es.json b/plugins/process-assets/lang/es.json index 7d6d098e49..417e0dd152 100644 --- a/plugins/process-assets/lang/es.json +++ b/plugins/process-assets/lang/es.json @@ -93,6 +93,8 @@ "Round": "Redondear", "Floor": "Redondear hacia abajo", "Ceil": "Redondear hacia arriba", + "Min": "Min", + "Max": "Max", "Absolute": "Valor absoluto", "LogAction": "Evento", "Started": "Iniciado", diff --git a/plugins/process-assets/lang/fr.json b/plugins/process-assets/lang/fr.json index c87bec0baa..8e8f17a1c7 100644 --- a/plugins/process-assets/lang/fr.json +++ b/plugins/process-assets/lang/fr.json @@ -93,6 +93,8 @@ "Round": "Arrondir", "Floor": "Arrondir vers le bas", "Ceil": "Arrondir vers le haut", + "Min": "Min", + "Max": "Max", "Absolute": "Valeur absolue", "LogAction": "Événement", "Started": "Démarré", diff --git a/plugins/process-assets/lang/it.json b/plugins/process-assets/lang/it.json index 496731ee37..fbae9302f4 100644 --- a/plugins/process-assets/lang/it.json +++ b/plugins/process-assets/lang/it.json @@ -93,6 +93,8 @@ "Round": "Arrotondare", "Floor": "Arrotondare per difetto", "Ceil": "Arrotondare per eccesso", + "Min": "Min", + "Max": "Max", "Absolute": "Valore assoluto", "LogAction": "Evento", "Started": "Avviato", diff --git a/plugins/process-assets/lang/ja.json b/plugins/process-assets/lang/ja.json index 80e895f8cc..d75c26daa2 100644 --- a/plugins/process-assets/lang/ja.json +++ b/plugins/process-assets/lang/ja.json @@ -92,6 +92,8 @@ "Round": "四捨五入", "Floor": "切り捨て", "Ceil": "切り上げ", + "Min": "最小値", + "Max": "最大値", "Absolute": "絶対値", "LogAction": "イベント", "Started": "開始", diff --git a/plugins/process-assets/lang/pt-br.json b/plugins/process-assets/lang/pt-br.json index c9b7d44cad..cbefb83131 100644 --- a/plugins/process-assets/lang/pt-br.json +++ b/plugins/process-assets/lang/pt-br.json @@ -93,6 +93,8 @@ "Round": "Arredondar", "Floor": "Arredondar para baixo", "Ceil": "Arredondar para cima", + "Min": "Min", + "Max": "Max", "Absolute": "Valor absoluto", "LogAction": "Evento", "Started": "Iniciado", diff --git a/plugins/process-assets/lang/pt.json b/plugins/process-assets/lang/pt.json index d0fbc58cfa..44a37297be 100644 --- a/plugins/process-assets/lang/pt.json +++ b/plugins/process-assets/lang/pt.json @@ -93,6 +93,8 @@ "Round": "Arredondar", "Floor": "Arredondar para baixo", "Ceil": "Arredondar para cima", + "Min": "Min", + "Max": "Max", "Absolute": "Valor absoluto", "LogAction": "Evento", "Started": "Iniciado", diff --git a/plugins/process-assets/lang/ru.json b/plugins/process-assets/lang/ru.json index 055a25df36..03e5454a2c 100644 --- a/plugins/process-assets/lang/ru.json +++ b/plugins/process-assets/lang/ru.json @@ -92,6 +92,8 @@ "Sqrt": "Квадратный корень", "Round": "Округлить", "Floor": "Округлить вниз", + "Min": "Минимум", + "Max": "Максимум", "Ceil": "Округлить вверх", "Absolute": "Абсолютное значение", "LogAction": "Событие", diff --git a/plugins/process-assets/lang/tr.json b/plugins/process-assets/lang/tr.json index 7d85fdd7b3..4e8003c0c3 100644 --- a/plugins/process-assets/lang/tr.json +++ b/plugins/process-assets/lang/tr.json @@ -90,6 +90,8 @@ "Absolute": "Mutlak", "Ceil": "Yukarı yuvarla", "Floor": "Aşağı yuvarla", + "Min": "Min", + "Max": "Max", "LogAction": "Olay", "Started": "Başlatıldı", "Each": "Her biri", diff --git a/plugins/process-assets/lang/zh.json b/plugins/process-assets/lang/zh.json index 736fed7612..6429a89315 100644 --- a/plugins/process-assets/lang/zh.json +++ b/plugins/process-assets/lang/zh.json @@ -93,6 +93,8 @@ "Round": "四舍五入", "Floor": "向下取整", "Ceil": "向上取整", + "Min": "最小值", + "Max": "最大值", "Absolute": "绝对值", "LogAction": "事件", "Started": "已启动", diff --git a/plugins/process-resources/src/components/attributeEditors/AttrContextPresenter.svelte b/plugins/process-resources/src/components/attributeEditors/AttrContextPresenter.svelte index bff445edb3..b219664821 100644 --- a/plugins/process-resources/src/components/attributeEditors/AttrContextPresenter.svelte +++ b/plugins/process-resources/src/components/attributeEditors/AttrContextPresenter.svelte @@ -14,12 +14,19 @@ --> {#if attr} diff --git a/plugins/process-resources/src/components/attributeEditors/ContextValuePresenter.svelte b/plugins/process-resources/src/components/attributeEditors/ContextValuePresenter.svelte index 54d7610cc8..76c7122f3e 100644 --- a/plugins/process-resources/src/components/attributeEditors/ContextValuePresenter.svelte +++ b/plugins/process-resources/src/components/attributeEditors/ContextValuePresenter.svelte @@ -32,7 +32,7 @@
{#if contextValue.type === 'attribute'} - + {:else if contextValue.type === 'relation'} {:else if contextValue.type === 'nested'} diff --git a/plugins/process-resources/src/components/contextEditors/ResultInput.svelte b/plugins/process-resources/src/components/contextEditors/ResultInput.svelte index 774a5a49c8..83e281e7d6 100644 --- a/plugins/process-resources/src/components/contextEditors/ResultInput.svelte +++ b/plugins/process-resources/src/components/contextEditors/ResultInput.svelte @@ -13,6 +13,7 @@ // limitations under the License. -->