@wipco/sdui 0.47.0 → 0.49.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.
@@ -1,4 +1,4 @@
1
- import { TagMultiSelect } from './chunk-NMUN2RSW.js';
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.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import * as React from 'react';
2
2
  import React__default, { CSSProperties, ReactNode, ComponentType } from 'react';
3
- import { S as SduiPage, a as SduiAction, b as SduiPropValue, c as SduiRule } from './types-C6cOUNPz.js';
4
- export { d as SduiArgRef, e as SduiCalcRef, f as SduiChild, g as SduiIndexRef, h as SduiItemRef, i as SduiNode, j as SduiPageQuery, k as SduiScalar, l as SduiStateRef } from './types-C6cOUNPz.js';
3
+ import { S as SduiPage, a as SduiAction, b as SduiPropValue, c as SduiRule } from './types-D14eqLpf.js';
4
+ export { d as SduiArgRef, e as SduiCalcRef, f as SduiChild, g as SduiIndexRef, h as SduiItemRef, i as SduiNode, j as SduiPageQuery, k as SduiScalar, l as SduiStateRef } from './types-D14eqLpf.js';
5
5
  import { S as SduiBoxProps, a as SduiContainerLayoutProps, b as SduiColumnsScale, c as SduiGapScale, d as SduiWeightScale, e as SduiTextAlignScale } from './layout-C3nRXMwb.js';
6
6
  export { C as CHILD_LAYOUT_PROPS, L as LAYOUT_CSS, f as SduiAlignScale, g as SduiChildLayoutProps, h as SduiSizeScale, i as SduiSpanScale, j as childLayoutFrom, k as columnsClass, l as containerLayoutStyle, m as joinClass, n as mergeStyle, t as typographyStyle } from './layout-C3nRXMwb.js';
7
7
  import { D as DatePickerProps, a as DateRangePickerProps, T as TimePickerProps } from './DatePicker-BK_jsV7i.js';
package/dist/index.js CHANGED
@@ -1660,7 +1660,14 @@ function isEmptyValue(v) {
1660
1660
  function fieldOf(row, field) {
1661
1661
  if (!field) return row;
1662
1662
  if (!isPlainObject(row)) return void 0;
1663
- return Object.hasOwn(row, field) ? row[field] : void 0;
1663
+ if (Object.hasOwn(row, field)) return row[field];
1664
+ if (!field.includes(".")) return void 0;
1665
+ let current = row;
1666
+ for (const segment of field.split(".")) {
1667
+ if (!isPlainObject(current) || !Object.hasOwn(current, segment)) return void 0;
1668
+ current = current[segment];
1669
+ }
1670
+ return current;
1664
1671
  }
1665
1672
  var FIELD_OPS = /* @__PURE__ */ new Set([
1666
1673
  "eq",
@@ -1782,8 +1789,24 @@ var CALC_OPS = /* @__PURE__ */ new Set([
1782
1789
  "length",
1783
1790
  "join",
1784
1791
  "split",
1785
- "sortBy"
1792
+ "sortBy",
1793
+ "map"
1786
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 out = {};
1805
+ for (const [key, value] of Object.entries(template)) out[key] = substituteFields(value, row);
1806
+ return out;
1807
+ }
1808
+ return template;
1809
+ }
1787
1810
  function evaluateCalc(calc, resolved, resolve) {
1788
1811
  const op = typeof calc.op === "string" ? calc.op : "";
1789
1812
  const field = typeof calc.field === "string" ? calc.field : void 0;
@@ -1960,6 +1983,11 @@ function evaluateCalc(calc, resolved, resolve) {
1960
1983
  const at = index < 0 ? parts.length + index : index;
1961
1984
  return parts[at] ?? null;
1962
1985
  }
1986
+ case "map": {
1987
+ const template = calc.select;
1988
+ if (template === void 0) return listOrEmpty();
1989
+ return listOrEmpty().map((row) => resolve(substituteFields(template, row)));
1990
+ }
1963
1991
  case "sortBy": {
1964
1992
  const desc = Boolean(calc.desc);
1965
1993
  return [...listOrEmpty()].sort((a, b) => {
package/dist/meta.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { b as SduiPropValue, i as SduiNode } from './types-C6cOUNPz.js';
1
+ import { b as SduiPropValue, i as SduiNode } from './types-D14eqLpf.js';
2
2
 
3
3
  /**
4
4
  * 시각 빌더용 컴포넌트 메타데이터 스키마.
@@ -188,9 +188,15 @@ type SduiAction = {
188
188
  *
189
189
  * ```json
190
190
  * { "action": "setState", "key": "gdRules", "fromEvent": true,
191
- * "path": [{ "$index": true }, "limits", { "$item": true }, "count"] }
191
+ * "path": [{ "$arg": "ri" }, "limits", { "$item": true }, "count"] }
192
192
  * ```
193
193
  *
194
+ * ⚠ 중첩 반복에서 **바깥 번호는 `$index` 가 아니다.** `$index` 는 가장 안쪽 행
195
+ * 프레임을 읽으므로, 규칙 루프 안 등급 루프에서 `$index` 는 등급 번호다. 바깥
196
+ * 번호는 그 자리에 Fragment 를 놓고 `args: { ri: {"$index": true} }` 로 날라
197
+ * `{"$arg":"ri"}` 로 읽는다 — `$arg` 는 item 프레임을 건너뛰고 원본 값을 호출부
198
+ * 스코프로 다시 풀기 때문이다(`test/fragment.test.ts` 가 고정한다).
199
+ *
194
200
  * 이것이 없으면 **동적 키**(등급 이름처럼 사용자가 런타임에 타이핑하는 키)와
195
201
  * **중첩 쓰기**(`arrayUpdate`는 최상위 배열의 평탄 필드 하나만 바꾼다)를 스펙으로
196
202
  * 말할 수 없었다. 규칙과 거절 조건은 `state-path.ts` 머리말에 있다.
@@ -1,5 +1,5 @@
1
- export { ApprovalOverridesEditor } from '../chunk-5XCEDVZL.js';
2
- import '../chunk-NMUN2RSW.js';
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
- options: Array<TagMultiSelectOption | Record<string, unknown>>;
21
+ /** 값과 라벨이 같은 목록은 문자열·숫자 배열을 그대로 줘도 된다. */
22
+ options: Array<TagMultiSelectOption | Record<string, unknown> | string | number>;
22
23
  /** 옵션에서 값을 읽을 키. 기본 'value'. */
23
24
  valueKey?: string;
24
25
  /** 옵션에서 표시 라벨을 읽을 키. 기본 'label'. */
@@ -1,4 +1,4 @@
1
- export { TagMultiSelect, pickSeedValues } from '../chunk-NMUN2RSW.js';
1
+ export { TagMultiSelect, pickSeedValues } from '../chunk-JBKNIALK.js';
2
2
  import '../chunk-DKPNFEVU.js';
3
3
  import '../chunk-TUOG7EEI.js';
4
4
  import '../chunk-YQOMSWW5.js';
@@ -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-5XCEDVZL.js';
68
- export { ApprovalOverridesEditor } from '../chunk-5XCEDVZL.js';
69
- import { TagMultiSelect } from '../chunk-NMUN2RSW.js';
70
- export { TagMultiSelect, pickSeedValues } from '../chunk-NMUN2RSW.js';
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';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wipco/sdui",
3
- "version": "0.47.0",
3
+ "version": "0.49.0",
4
4
  "description": "WIPCO 서버 주도 UI(SDUI) 렌더러 — JSON 페이지 스펙을 React 컴포넌트로 렌더링",
5
5
  "keywords": [
6
6
  "sdui",