@wipco/sdui 0.45.0 → 0.47.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-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';
|
|
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
|
@@ -1953,7 +1953,8 @@ function evaluateCalc(calc, resolved, resolve) {
|
|
|
1953
1953
|
}
|
|
1954
1954
|
case "split": {
|
|
1955
1955
|
const sep = typeof calc.sep === "string" ? calc.sep : ",";
|
|
1956
|
-
|
|
1956
|
+
let parts = String(first ?? "").split(sep);
|
|
1957
|
+
if (calc.trim === true) parts = parts.map((part) => part.trim());
|
|
1957
1958
|
if (calc.take === void 0) return parts;
|
|
1958
1959
|
const index = toNumber2(calc.take);
|
|
1959
1960
|
const at = index < 0 ? parts.length + index : index;
|
|
@@ -2422,10 +2423,20 @@ function revertUnsettledStamps(fetched, runnable, epochs, settled) {
|
|
|
2422
2423
|
function isArgsFrame(frame) {
|
|
2423
2424
|
return "callSiteScope" in frame;
|
|
2424
2425
|
}
|
|
2426
|
+
function isEventFrame(frame) {
|
|
2427
|
+
return "event" in frame;
|
|
2428
|
+
}
|
|
2429
|
+
function nearestEventFrame(scope) {
|
|
2430
|
+
for (let i = scope.length - 1; i >= 0; i -= 1) {
|
|
2431
|
+
const frame = scope[i];
|
|
2432
|
+
if (isEventFrame(frame)) return frame;
|
|
2433
|
+
}
|
|
2434
|
+
return void 0;
|
|
2435
|
+
}
|
|
2425
2436
|
function nearestItemFrame(scope) {
|
|
2426
2437
|
for (let i = scope.length - 1; i >= 0; i--) {
|
|
2427
2438
|
const frame = scope[i];
|
|
2428
|
-
if (!isArgsFrame(frame)) return frame;
|
|
2439
|
+
if (!isArgsFrame(frame) && !isEventFrame(frame)) return frame;
|
|
2429
2440
|
}
|
|
2430
2441
|
return void 0;
|
|
2431
2442
|
}
|
|
@@ -2448,6 +2459,17 @@ function isItemRef(v) {
|
|
|
2448
2459
|
function isIndexRef(v) {
|
|
2449
2460
|
return isPlainObject5(v) && "$index" in v;
|
|
2450
2461
|
}
|
|
2462
|
+
function isEventRef(v) {
|
|
2463
|
+
return isPlainObject5(v) && "$event" in v;
|
|
2464
|
+
}
|
|
2465
|
+
function readEventPath(source, path) {
|
|
2466
|
+
let current = source;
|
|
2467
|
+
for (const segment of path.split(".")) {
|
|
2468
|
+
if (!isPlainObject5(current) || !Object.hasOwn(current, segment)) return null;
|
|
2469
|
+
current = current[segment];
|
|
2470
|
+
}
|
|
2471
|
+
return current ?? null;
|
|
2472
|
+
}
|
|
2451
2473
|
function isCalcRef(v) {
|
|
2452
2474
|
return isPlainObject5(v) && isPlainObject5(v.$calc);
|
|
2453
2475
|
}
|
|
@@ -2644,11 +2666,7 @@ function SduiNodeRenderer({
|
|
|
2644
2666
|
}
|
|
2645
2667
|
if (name.startsWith("on") && (isAction(raw) || isArgRef(raw) || isActionEntryList(raw))) {
|
|
2646
2668
|
props[name] = (arg) => expandActionEntries(raw, scope).forEach(
|
|
2647
|
-
(entry) => dispatch(
|
|
2648
|
-
resolveValue(entry.action, entry.scope),
|
|
2649
|
-
arg,
|
|
2650
|
-
entry.scope
|
|
2651
|
-
)
|
|
2669
|
+
(entry) => dispatch(entry.action, arg, entry.scope)
|
|
2652
2670
|
);
|
|
2653
2671
|
} else if (name === "rowClick" && (isAction(raw) || isActionList(raw))) {
|
|
2654
2672
|
props[name] = raw;
|
|
@@ -2916,6 +2934,11 @@ function SduiRenderer({
|
|
|
2916
2934
|
if (isIndexRef(value)) {
|
|
2917
2935
|
return nearestItemFrame(scope)?.index ?? null;
|
|
2918
2936
|
}
|
|
2937
|
+
if (isEventRef(value)) {
|
|
2938
|
+
const frame = nearestEventFrame(scope);
|
|
2939
|
+
if (!frame) return null;
|
|
2940
|
+
return value.$event === true ? frame.event : readEventPath(frame.event, String(value.$event));
|
|
2941
|
+
}
|
|
2919
2942
|
if (isArgRef(value)) {
|
|
2920
2943
|
const frame = nearestArgsFrame(scope);
|
|
2921
2944
|
if (frame?.args && Object.hasOwn(frame.args, value.$arg)) {
|
|
@@ -3031,9 +3054,10 @@ function SduiRenderer({
|
|
|
3031
3054
|
}
|
|
3032
3055
|
return;
|
|
3033
3056
|
}
|
|
3057
|
+
const eventScope = arg === void 0 ? scope : [...scope, { event: eventValue(arg) }];
|
|
3034
3058
|
const action = resolveValue(
|
|
3035
3059
|
rawAction,
|
|
3036
|
-
|
|
3060
|
+
eventScope
|
|
3037
3061
|
);
|
|
3038
3062
|
switch (action.action) {
|
|
3039
3063
|
case "navigate":
|
package/dist/meta.d.ts
CHANGED
|
@@ -129,6 +129,11 @@ interface SduiCalcRef {
|
|
|
129
129
|
sep?: string;
|
|
130
130
|
/** `split`에서 꺼낼 조각의 인덱스. 음수는 뒤에서부터 센다 */
|
|
131
131
|
take?: number;
|
|
132
|
+
/**
|
|
133
|
+
* `split`의 조각에서 앞뒤 공백을 턴다. 사람이 치는 쉼표 목록("S, A, B")이
|
|
134
|
+
* 이 연산의 주된 입력인데, 그 조각이 **키로 쓰이면** 공백 하나가 사고가 된다.
|
|
135
|
+
*/
|
|
136
|
+
trim?: boolean;
|
|
132
137
|
/** `sortBy`를 내림차순으로 */
|
|
133
138
|
desc?: boolean;
|
|
134
139
|
};
|