@wipco/sdui 0.35.0 → 0.37.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-Bx3oingj.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-Bx3oingj.js';
|
|
5
5
|
import { S as SduiBoxProps, a as SduiContainerLayoutProps, b as SduiColumnsScale, c as SduiGapScale, d as SduiWeightScale, e as SduiTextAlignScale } from './layout-B1QrIBm6.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-B1QrIBm6.js';
|
|
7
7
|
import { D as DatePickerProps, a as DateRangePickerProps, T as TimePickerProps } from './DatePicker-D2EtpvkQ.js';
|
package/dist/index.js
CHANGED
|
@@ -1675,7 +1675,8 @@ var FIELD_OPS = /* @__PURE__ */ new Set([
|
|
|
1675
1675
|
"startsWith",
|
|
1676
1676
|
"endsWith",
|
|
1677
1677
|
"isNull",
|
|
1678
|
-
"isEmpty"
|
|
1678
|
+
"isEmpty",
|
|
1679
|
+
"intersects"
|
|
1679
1680
|
]);
|
|
1680
1681
|
function isFieldOpObject(v) {
|
|
1681
1682
|
return isPlainObject(v) && Object.keys(v).some((key) => FIELD_OPS.has(key));
|
|
@@ -1709,6 +1710,13 @@ function matchesFieldOps(actual, ops, resolve) {
|
|
|
1709
1710
|
return String(actual ?? "").endsWith(String(expected ?? ""));
|
|
1710
1711
|
case "isNull":
|
|
1711
1712
|
return isBlank(actual) === Boolean(expected);
|
|
1713
|
+
case "intersects": {
|
|
1714
|
+
const mine = Array.isArray(actual) ? actual : [];
|
|
1715
|
+
const theirs = Array.isArray(expected) ? expected : [];
|
|
1716
|
+
if (mine.length === 0 || theirs.length === 0) return false;
|
|
1717
|
+
const set = new Set(theirs.map((item) => String(item ?? "")));
|
|
1718
|
+
return mine.some((item) => set.has(String(item ?? "")));
|
|
1719
|
+
}
|
|
1712
1720
|
case "isEmpty":
|
|
1713
1721
|
return isEmptyValue(actual) === Boolean(expected);
|
|
1714
1722
|
default:
|
|
@@ -1767,6 +1775,8 @@ var CALC_OPS = /* @__PURE__ */ new Set([
|
|
|
1767
1775
|
"includes",
|
|
1768
1776
|
"distinct",
|
|
1769
1777
|
"except",
|
|
1778
|
+
"groupBy",
|
|
1779
|
+
"groupCount",
|
|
1770
1780
|
"entries",
|
|
1771
1781
|
"fromEntries",
|
|
1772
1782
|
"length",
|
|
@@ -1896,6 +1906,20 @@ function evaluateCalc(calc, resolved, resolve) {
|
|
|
1896
1906
|
(row) => !remove.has(String(fieldOf(row, field) ?? ""))
|
|
1897
1907
|
);
|
|
1898
1908
|
}
|
|
1909
|
+
case "groupBy":
|
|
1910
|
+
case "groupCount": {
|
|
1911
|
+
const groups = /* @__PURE__ */ new Map();
|
|
1912
|
+
for (const row of listOrEmpty()) {
|
|
1913
|
+
const key = String(fieldOf(row, field) ?? "");
|
|
1914
|
+
const bucket = groups.get(key);
|
|
1915
|
+
if (bucket) bucket.push(row);
|
|
1916
|
+
else groups.set(key, [row]);
|
|
1917
|
+
}
|
|
1918
|
+
const out = [...groups.entries()].map(
|
|
1919
|
+
([key, items]) => op === "groupCount" ? { key, count: items.length } : { key, items }
|
|
1920
|
+
);
|
|
1921
|
+
return out;
|
|
1922
|
+
}
|
|
1899
1923
|
case "entries": {
|
|
1900
1924
|
if (!isPlainObject(first)) return [];
|
|
1901
1925
|
return Object.entries(first).map(([key, value]) => ({
|
package/dist/meta.d.ts
CHANGED
|
@@ -87,6 +87,8 @@ interface SduiCalcRef {
|
|
|
87
87
|
* - `includes` 목록(또는 문자열)이 args[1]을 담고 있는지
|
|
88
88
|
* - `distinct` `field`(없으면 값 자체) 기준 중복 제거
|
|
89
89
|
* - `except` args[0]에서 args[1]에 있는 것을 뺀다(`field`로 맞춘다)
|
|
90
|
+
* - `groupBy`/`groupCount` `field` 기준으로 묶어 `{key,items}`·`{key,count}` 배열로.
|
|
91
|
+
* 키가 처음 나타난 순서를 지킨다. 정렬은 `sortBy` 를 이어서 한다
|
|
90
92
|
* - `entries` 객체를 `{key, value}` 배열로 편다 — ForEach가 돌 수 있는 모양
|
|
91
93
|
* - `fromEntries` 그 짝. `{key,value}` 배열을 객체로 되돌린다(걸러낸 폼 페이로드 조립)
|
|
92
94
|
* - `length` 배열·문자열의 길이
|
|
@@ -94,7 +96,7 @@ interface SduiCalcRef {
|
|
|
94
96
|
* - `split` `sep`(기본 ',')으로 가른다. `take`를 주면 그 조각 하나(음수는 뒤에서)
|
|
95
97
|
* - `sortBy` `field` 기준 정렬(`desc: true`면 내림차순). 원본은 건드리지 않는다
|
|
96
98
|
*/
|
|
97
|
-
| 'get' | 'pluck' | 'filter' | 'some' | 'every' | 'includes' | 'distinct' | 'except' | 'entries' | 'fromEntries' | 'length' | 'join' | 'split' | 'sortBy';
|
|
99
|
+
| 'get' | 'pluck' | 'filter' | 'some' | 'every' | 'includes' | 'distinct' | 'except' | 'groupBy' | 'groupCount' | 'entries' | 'fromEntries' | 'length' | 'join' | 'split' | 'sortBy';
|
|
98
100
|
args: SduiPropValue[];
|
|
99
101
|
/** sum/count·목록 연산에서 객체 배열의 필드를 지정 */
|
|
100
102
|
field?: string;
|
|
@@ -106,7 +108,9 @@ interface SduiCalcRef {
|
|
|
106
108
|
* "OR": [ { "status": "open" }, { "owner": { "isNull": true } } ] }
|
|
107
109
|
*
|
|
108
110
|
* 필드 연산: eq · ne · gt · gte · lt · lte · in · notIn · contains ·
|
|
109
|
-
* startsWith · endsWith · isNull · isEmpty. 값이 연산 객체가 아니면
|
|
111
|
+
* startsWith · endsWith · isNull · isEmpty · intersects. 값이 연산 객체가 아니면
|
|
112
|
+
* `eq`로 읽는다. `in`은 "행의 값이 목록에 있는가", `intersects`는 "행의 **배열**이
|
|
113
|
+
* 목록과 겹치는가" — 방향이 반대다(구성원·태그 목록을 거르는 자리).
|
|
110
114
|
* (`isNull`은 null·undefined·''를, `isEmpty`는 거기에 빈 배열·빈 객체까지 본다.)
|
|
111
115
|
* 같은 객체의 키들은 AND이고, `AND`/`OR`는 술어 배열, `NOT`은 술어 하나다.
|
|
112
116
|
* 술어 안의 값에도 참조를 쓸 수 있는데, 이때 `$item`은 거르고 있는 행이 아니라
|