@wipco/sdui 0.46.0 → 0.48.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/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-
|
|
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-
|
|
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
|
-
|
|
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",
|
|
@@ -2423,10 +2430,20 @@ function revertUnsettledStamps(fetched, runnable, epochs, settled) {
|
|
|
2423
2430
|
function isArgsFrame(frame) {
|
|
2424
2431
|
return "callSiteScope" in frame;
|
|
2425
2432
|
}
|
|
2433
|
+
function isEventFrame(frame) {
|
|
2434
|
+
return "event" in frame;
|
|
2435
|
+
}
|
|
2436
|
+
function nearestEventFrame(scope) {
|
|
2437
|
+
for (let i = scope.length - 1; i >= 0; i -= 1) {
|
|
2438
|
+
const frame = scope[i];
|
|
2439
|
+
if (isEventFrame(frame)) return frame;
|
|
2440
|
+
}
|
|
2441
|
+
return void 0;
|
|
2442
|
+
}
|
|
2426
2443
|
function nearestItemFrame(scope) {
|
|
2427
2444
|
for (let i = scope.length - 1; i >= 0; i--) {
|
|
2428
2445
|
const frame = scope[i];
|
|
2429
|
-
if (!isArgsFrame(frame)) return frame;
|
|
2446
|
+
if (!isArgsFrame(frame) && !isEventFrame(frame)) return frame;
|
|
2430
2447
|
}
|
|
2431
2448
|
return void 0;
|
|
2432
2449
|
}
|
|
@@ -2449,6 +2466,17 @@ function isItemRef(v) {
|
|
|
2449
2466
|
function isIndexRef(v) {
|
|
2450
2467
|
return isPlainObject5(v) && "$index" in v;
|
|
2451
2468
|
}
|
|
2469
|
+
function isEventRef(v) {
|
|
2470
|
+
return isPlainObject5(v) && "$event" in v;
|
|
2471
|
+
}
|
|
2472
|
+
function readEventPath(source, path) {
|
|
2473
|
+
let current = source;
|
|
2474
|
+
for (const segment of path.split(".")) {
|
|
2475
|
+
if (!isPlainObject5(current) || !Object.hasOwn(current, segment)) return null;
|
|
2476
|
+
current = current[segment];
|
|
2477
|
+
}
|
|
2478
|
+
return current ?? null;
|
|
2479
|
+
}
|
|
2452
2480
|
function isCalcRef(v) {
|
|
2453
2481
|
return isPlainObject5(v) && isPlainObject5(v.$calc);
|
|
2454
2482
|
}
|
|
@@ -2645,11 +2673,7 @@ function SduiNodeRenderer({
|
|
|
2645
2673
|
}
|
|
2646
2674
|
if (name.startsWith("on") && (isAction(raw) || isArgRef(raw) || isActionEntryList(raw))) {
|
|
2647
2675
|
props[name] = (arg) => expandActionEntries(raw, scope).forEach(
|
|
2648
|
-
(entry) => dispatch(
|
|
2649
|
-
resolveValue(entry.action, entry.scope),
|
|
2650
|
-
arg,
|
|
2651
|
-
entry.scope
|
|
2652
|
-
)
|
|
2676
|
+
(entry) => dispatch(entry.action, arg, entry.scope)
|
|
2653
2677
|
);
|
|
2654
2678
|
} else if (name === "rowClick" && (isAction(raw) || isActionList(raw))) {
|
|
2655
2679
|
props[name] = raw;
|
|
@@ -2917,6 +2941,11 @@ function SduiRenderer({
|
|
|
2917
2941
|
if (isIndexRef(value)) {
|
|
2918
2942
|
return nearestItemFrame(scope)?.index ?? null;
|
|
2919
2943
|
}
|
|
2944
|
+
if (isEventRef(value)) {
|
|
2945
|
+
const frame = nearestEventFrame(scope);
|
|
2946
|
+
if (!frame) return null;
|
|
2947
|
+
return value.$event === true ? frame.event : readEventPath(frame.event, String(value.$event));
|
|
2948
|
+
}
|
|
2920
2949
|
if (isArgRef(value)) {
|
|
2921
2950
|
const frame = nearestArgsFrame(scope);
|
|
2922
2951
|
if (frame?.args && Object.hasOwn(frame.args, value.$arg)) {
|
|
@@ -3032,9 +3061,10 @@ function SduiRenderer({
|
|
|
3032
3061
|
}
|
|
3033
3062
|
return;
|
|
3034
3063
|
}
|
|
3064
|
+
const eventScope = arg === void 0 ? scope : [...scope, { event: eventValue(arg) }];
|
|
3035
3065
|
const action = resolveValue(
|
|
3036
3066
|
rawAction,
|
|
3037
|
-
|
|
3067
|
+
eventScope
|
|
3038
3068
|
);
|
|
3039
3069
|
switch (action.action) {
|
|
3040
3070
|
case "navigate":
|
package/dist/meta.d.ts
CHANGED
|
@@ -188,9 +188,15 @@ type SduiAction = {
|
|
|
188
188
|
*
|
|
189
189
|
* ```json
|
|
190
190
|
* { "action": "setState", "key": "gdRules", "fromEvent": true,
|
|
191
|
-
* "path": [{ "$
|
|
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` 머리말에 있다.
|