@wipco/sdui 0.48.0 → 0.50.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-5XCEDVZL.js → chunk-IV5YTVHR.js} +1 -1
- package/dist/{chunk-NMUN2RSW.js → chunk-JBKNIALK.js} +3 -0
- package/dist/index.js +30 -1
- package/dist/widgets/ApprovalOverridesEditor.js +2 -2
- package/dist/widgets/TagMultiSelect.d.ts +2 -1
- package/dist/widgets/TagMultiSelect.js +1 -1
- package/dist/widgets/index.js +4 -4
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { TagMultiSelect } from './chunk-
|
|
1
|
+
import { TagMultiSelect } from './chunk-JBKNIALK.js';
|
|
2
2
|
import { ApprovalLineEditor, stepTypeIcon, stepLabel } from './chunk-STX2AX6Y.js';
|
|
3
3
|
import { useSduiAdapter, hostFetchOf, defaultAdapter } from './chunk-DKPNFEVU.js';
|
|
4
4
|
import { Card, Icon, Input, IconButton, Field, Button, Badge } from './chunk-TUOG7EEI.js';
|
|
@@ -23,6 +23,9 @@ function pickSeedValues(payload, valueKey) {
|
|
|
23
23
|
function foldOptions(options, valueKey, labelKey) {
|
|
24
24
|
if (!Array.isArray(options)) return [];
|
|
25
25
|
return options.flatMap((raw) => {
|
|
26
|
+
if (typeof raw === "string" || typeof raw === "number") {
|
|
27
|
+
return [{ value: String(raw), label: String(raw) }];
|
|
28
|
+
}
|
|
26
29
|
if (raw === null || typeof raw !== "object") return [];
|
|
27
30
|
const row = raw;
|
|
28
31
|
const value = (valueKey ? row[valueKey] : void 0) ?? row.value;
|
package/dist/index.js
CHANGED
|
@@ -1789,8 +1789,32 @@ var CALC_OPS = /* @__PURE__ */ new Set([
|
|
|
1789
1789
|
"length",
|
|
1790
1790
|
"join",
|
|
1791
1791
|
"split",
|
|
1792
|
-
"sortBy"
|
|
1792
|
+
"sortBy",
|
|
1793
|
+
"map"
|
|
1793
1794
|
]);
|
|
1795
|
+
function isFieldRef(value) {
|
|
1796
|
+
return isPlainObject(value) && "$field" in value;
|
|
1797
|
+
}
|
|
1798
|
+
function substituteFields(template, row) {
|
|
1799
|
+
if (isFieldRef(template)) {
|
|
1800
|
+
return template.$field === true ? row : fieldOf(row, String(template.$field)) ?? null;
|
|
1801
|
+
}
|
|
1802
|
+
if (Array.isArray(template)) return template.map((item) => substituteFields(item, row));
|
|
1803
|
+
if (isPlainObject(template)) {
|
|
1804
|
+
const nested = isPlainObject(template.$calc) ? template.$calc : null;
|
|
1805
|
+
if (nested && nested.op === "map") {
|
|
1806
|
+
const inner = {};
|
|
1807
|
+
for (const [key, value] of Object.entries(nested)) {
|
|
1808
|
+
inner[key] = key === "select" ? value : substituteFields(value, row);
|
|
1809
|
+
}
|
|
1810
|
+
return { ...template, $calc: inner };
|
|
1811
|
+
}
|
|
1812
|
+
const out = {};
|
|
1813
|
+
for (const [key, value] of Object.entries(template)) out[key] = substituteFields(value, row);
|
|
1814
|
+
return out;
|
|
1815
|
+
}
|
|
1816
|
+
return template;
|
|
1817
|
+
}
|
|
1794
1818
|
function evaluateCalc(calc, resolved, resolve) {
|
|
1795
1819
|
const op = typeof calc.op === "string" ? calc.op : "";
|
|
1796
1820
|
const field = typeof calc.field === "string" ? calc.field : void 0;
|
|
@@ -1967,6 +1991,11 @@ function evaluateCalc(calc, resolved, resolve) {
|
|
|
1967
1991
|
const at = index < 0 ? parts.length + index : index;
|
|
1968
1992
|
return parts[at] ?? null;
|
|
1969
1993
|
}
|
|
1994
|
+
case "map": {
|
|
1995
|
+
const template = calc.select;
|
|
1996
|
+
if (template === void 0) return listOrEmpty();
|
|
1997
|
+
return listOrEmpty().map((row) => resolve(substituteFields(template, row)));
|
|
1998
|
+
}
|
|
1970
1999
|
case "sortBy": {
|
|
1971
2000
|
const desc = Boolean(calc.desc);
|
|
1972
2001
|
return [...listOrEmpty()].sort((a, b) => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { ApprovalOverridesEditor } from '../chunk-
|
|
2
|
-
import '../chunk-
|
|
1
|
+
export { ApprovalOverridesEditor } from '../chunk-IV5YTVHR.js';
|
|
2
|
+
import '../chunk-JBKNIALK.js';
|
|
3
3
|
import '../chunk-STX2AX6Y.js';
|
|
4
4
|
import '../chunk-VDBUXYEB.js';
|
|
5
5
|
import '../chunk-I5Z2RVDF.js';
|
|
@@ -18,7 +18,8 @@ interface TagMultiSelectProps {
|
|
|
18
18
|
* 기본은 `{value, label}`이고, 도메인 행(`{id, name, …}`)을 그대로 넘길 거면
|
|
19
19
|
* `valueKey`/`labelKey`로 읽을 키를 알려 준다 — Select 0.7.0과 같은 계약.
|
|
20
20
|
*/
|
|
21
|
-
|
|
21
|
+
/** 값과 라벨이 같은 목록은 문자열·숫자 배열을 그대로 줘도 된다. */
|
|
22
|
+
options: Array<TagMultiSelectOption | Record<string, unknown> | string | number>;
|
|
22
23
|
/** 옵션에서 값을 읽을 키. 기본 'value'. */
|
|
23
24
|
valueKey?: string;
|
|
24
25
|
/** 옵션에서 표시 라벨을 읽을 키. 기본 'label'. */
|
package/dist/widgets/index.js
CHANGED
|
@@ -64,10 +64,10 @@ import '../chunk-UMANGYRD.js';
|
|
|
64
64
|
import '../chunk-QTHYLNJW.js';
|
|
65
65
|
import '../chunk-AVRNQOB5.js';
|
|
66
66
|
import '../chunk-EKVA7T7P.js';
|
|
67
|
-
import { ApprovalOverridesEditor } from '../chunk-
|
|
68
|
-
export { ApprovalOverridesEditor } from '../chunk-
|
|
69
|
-
import { TagMultiSelect } from '../chunk-
|
|
70
|
-
export { TagMultiSelect, pickSeedValues } from '../chunk-
|
|
67
|
+
import { ApprovalOverridesEditor } from '../chunk-IV5YTVHR.js';
|
|
68
|
+
export { ApprovalOverridesEditor } from '../chunk-IV5YTVHR.js';
|
|
69
|
+
import { TagMultiSelect } from '../chunk-JBKNIALK.js';
|
|
70
|
+
export { TagMultiSelect, pickSeedValues } from '../chunk-JBKNIALK.js';
|
|
71
71
|
import { ApprovalLineEditor } from '../chunk-STX2AX6Y.js';
|
|
72
72
|
export { ApprovalLineEditor } from '../chunk-STX2AX6Y.js';
|
|
73
73
|
import '../chunk-VDBUXYEB.js';
|