cdp-material-sdk 0.0.10 → 0.1.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.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as e, a as t, b as n, c as i, D as o, E, I as T, d as _, L as O, e as N, f as R, N as r, g as A, O as C, h as l, R as S, S as u, i as D, j as d, k as m, l as I, m as P, n as p, o as Y, p as M, q as g, u as c, r as L, v as G, s as v } from "./validateManifest-
|
|
1
|
+
import { C as e, a as t, b as n, c as i, D as o, E, I as T, d as _, L as O, e as N, f as R, N as r, g as A, O as C, h as l, R as S, S as u, i as D, j as d, k as m, l as I, m as P, n as p, o as Y, p as M, q as g, u as c, r as L, v as G, s as v } from "./validateManifest-Cn6KPHou.js";
|
|
2
2
|
import { D as K, a as h, b as x, P as V, r as y, s as F, u as b, c as k, d as z } from "./useFieldRegistry-CwjlA-ja.js";
|
|
3
3
|
export {
|
|
4
4
|
e as CATEGORY_LABELS,
|
package/dist/portable.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as e, a as E, b as i, c as n, D as t, E as T, I as _, d as O, L as N, e as o, f as A, N as R, g as S, O as I, h as P, R as Y, S as d, i as l, j as C, k as M, l as m, m as r, n as L, o as g, p, q as G, u, r as D, v, s as K } from "./validateManifest-
|
|
1
|
+
import { C as e, a as E, b as i, c as n, D as t, E as T, I as _, d as O, L as N, e as o, f as A, N as R, g as S, O as I, h as P, R as Y, S as d, i as l, j as C, k as M, l as m, m as r, n as L, o as g, p, q as G, u, r as D, v, s as K } from "./validateManifest-Cn6KPHou.js";
|
|
2
2
|
export {
|
|
3
3
|
e as CATEGORY_LABELS,
|
|
4
4
|
E as COMPONENT_CATEGORY,
|
|
@@ -49,6 +49,14 @@ export declare const RemoteOptionConfigSchema: {
|
|
|
49
49
|
readonly type: "string";
|
|
50
50
|
readonly title: "字段名称";
|
|
51
51
|
};
|
|
52
|
+
readonly extraFieldNames: {
|
|
53
|
+
readonly type: "array";
|
|
54
|
+
readonly title: "额外字段";
|
|
55
|
+
readonly description: "额外随每个选项返回的字段名(如 code、status 等),用于自定义显示格式或后续业务取用。";
|
|
56
|
+
readonly items: {
|
|
57
|
+
readonly type: "string";
|
|
58
|
+
};
|
|
59
|
+
};
|
|
52
60
|
readonly condition: {
|
|
53
61
|
readonly type: "object";
|
|
54
62
|
readonly title: "查询条件";
|
|
@@ -33,6 +33,18 @@ export interface EngineEventProtocol {
|
|
|
33
33
|
pageSize?: number;
|
|
34
34
|
orderBy?: Array<Record<string, unknown>>;
|
|
35
35
|
advancedConditions?: Record<string, unknown>;
|
|
36
|
+
};
|
|
37
|
+
[ENGINE_EVENT_TYPE.OPTIONS_FETCH]: {
|
|
38
|
+
panelCode: string;
|
|
39
|
+
fieldName: string;
|
|
40
|
+
condition?: Record<string, any>;
|
|
41
|
+
keyword?: string;
|
|
42
|
+
extraFieldNames?: string[];
|
|
43
|
+
/**
|
|
44
|
+
* @deprecated 历史字段,等价于 `{ fieldName }`。早期此事件挂在 DATA_FETCH 下,
|
|
45
|
+
* 老的事件指令脚本可能从 payload.fieldInfo.fieldName 取值。
|
|
46
|
+
* 运行时会与 `fieldName` 一并发送以保证向后兼容,新代码请直接读取顶层 `fieldName`。
|
|
47
|
+
*/
|
|
36
48
|
fieldInfo?: {
|
|
37
49
|
fieldName: string;
|
|
38
50
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useState as m, useRef as A, useEffect as h, useCallback as u, useMemo as g } from "react";
|
|
2
|
-
const
|
|
2
|
+
const O = () => {
|
|
3
3
|
const [t, e] = m(0), [o, n] = m(void 0), c = A(0);
|
|
4
4
|
h(() => {
|
|
5
5
|
c.current = t;
|
|
@@ -18,7 +18,7 @@ const S = () => {
|
|
|
18
18
|
getLoading: a,
|
|
19
19
|
resetLoading: r
|
|
20
20
|
}), [a, t, o, r, s, p]);
|
|
21
|
-
},
|
|
21
|
+
}, x = () => {
|
|
22
22
|
const {
|
|
23
23
|
isLoading: t,
|
|
24
24
|
loadingText: e,
|
|
@@ -26,7 +26,7 @@ const S = () => {
|
|
|
26
26
|
stopLoading: n,
|
|
27
27
|
getLoading: c,
|
|
28
28
|
resetLoading: a
|
|
29
|
-
} =
|
|
29
|
+
} = O(), [s, p] = m(!1), r = g(() => t || s, [t, s]), l = A(!1);
|
|
30
30
|
return h(() => {
|
|
31
31
|
l.current = r;
|
|
32
32
|
}, [r]), g(() => ({
|
|
@@ -51,7 +51,7 @@ const S = () => {
|
|
|
51
51
|
n
|
|
52
52
|
]);
|
|
53
53
|
};
|
|
54
|
-
function
|
|
54
|
+
function S(t) {
|
|
55
55
|
if (!t)
|
|
56
56
|
return [];
|
|
57
57
|
const e = [];
|
|
@@ -74,7 +74,7 @@ function _(t) {
|
|
|
74
74
|
return e;
|
|
75
75
|
}
|
|
76
76
|
function v(t) {
|
|
77
|
-
const e =
|
|
77
|
+
const e = S(t?.events), o = _(t?.customEvents);
|
|
78
78
|
return {
|
|
79
79
|
standard: e,
|
|
80
80
|
custom: o,
|
|
@@ -89,7 +89,7 @@ const $ = {
|
|
|
89
89
|
value: { type: "string", title: "选项值" },
|
|
90
90
|
disabled: { type: "boolean", title: "是否禁用" }
|
|
91
91
|
}
|
|
92
|
-
},
|
|
92
|
+
}, V = {
|
|
93
93
|
type: "array",
|
|
94
94
|
title: "选项列表",
|
|
95
95
|
items: $
|
|
@@ -99,6 +99,12 @@ const $ = {
|
|
|
99
99
|
properties: {
|
|
100
100
|
panelCode: { type: "string", title: "面板代码" },
|
|
101
101
|
fieldName: { type: "string", title: "字段名称" },
|
|
102
|
+
extraFieldNames: {
|
|
103
|
+
type: "array",
|
|
104
|
+
title: "额外字段",
|
|
105
|
+
description: "额外随每个选项返回的字段名(如 code、status 等),用于自定义显示格式或后续业务取用。",
|
|
106
|
+
items: { type: "string" }
|
|
107
|
+
},
|
|
102
108
|
condition: {
|
|
103
109
|
type: "object",
|
|
104
110
|
title: "查询条件",
|
|
@@ -124,15 +130,16 @@ const $ = {
|
|
|
124
130
|
ITEM_DOUBLE_CLICK: "itemDoubleClick",
|
|
125
131
|
ITEM_RIGHT_CLICK: "itemRightClick",
|
|
126
132
|
ITEM_LONG_PRESS: "itemLongPress",
|
|
127
|
-
DATA_FETCH: "dataFetch"
|
|
128
|
-
|
|
133
|
+
DATA_FETCH: "dataFetch",
|
|
134
|
+
OPTIONS_FETCH: "optionsFetch"
|
|
135
|
+
}, I = Object.values(C), L = new Set(I), P = /^[^:\s]+:[^:\s]+$/;
|
|
129
136
|
function f(t) {
|
|
130
137
|
return L.has(t);
|
|
131
138
|
}
|
|
132
139
|
function E(t) {
|
|
133
|
-
return
|
|
140
|
+
return P.test(t) && !L.has(t);
|
|
134
141
|
}
|
|
135
|
-
const Q = "x-dynamic-enum", X = "x-slot",
|
|
142
|
+
const Q = "x-dynamic-enum", X = "x-slot", R = "$root", Z = "__state";
|
|
136
143
|
function D(t) {
|
|
137
144
|
if (!t)
|
|
138
145
|
return [];
|
|
@@ -201,7 +208,7 @@ const tt = {
|
|
|
201
208
|
[d.PAGE]: "页面",
|
|
202
209
|
[d.DEV]: "调试",
|
|
203
210
|
[d.HTML_TEMPLATE]: "HTML 模板"
|
|
204
|
-
}, b = "slotProps.root", Y = [T.DATA_FIELD, T.DATA_CONTAINER], j = [
|
|
211
|
+
}, b = "slotProps.root", Y = [T.DATA_FIELD, T.DATA_CONTAINER], j = [R, b], N = ["string", "number", "boolean", "array", "object", "integer", "null"];
|
|
205
212
|
function i(t, e, o, n, c) {
|
|
206
213
|
t.push({ type: e, field: o, message: n, severity: c });
|
|
207
214
|
}
|
|
@@ -242,7 +249,7 @@ function H(t, e, o) {
|
|
|
242
249
|
for (const [a, s] of Object.entries(c))
|
|
243
250
|
s && (s.title || i(e, n, `actions.${a}.title`, `动作 "${a}" 缺少 title`, "error"), s.returns || i(o, n, `actions.${a}.returns`, `动作 "${a}" 未声明 returns schema,建议补充`, "warning"), s.params && s.params.type !== "object" && i(e, n, `actions.${a}.params.type`, '动作参数 schema 的 type 必须为 "object"', "error"));
|
|
244
251
|
}
|
|
245
|
-
function
|
|
252
|
+
function F(t, e, o) {
|
|
246
253
|
const n = t.type, c = t.engine?.render?.injection?.rootPath;
|
|
247
254
|
c ? typeof c == "string" && !j.includes(c) && i(
|
|
248
255
|
o,
|
|
@@ -258,7 +265,7 @@ function U(t, e, o) {
|
|
|
258
265
|
"warning"
|
|
259
266
|
);
|
|
260
267
|
}
|
|
261
|
-
function
|
|
268
|
+
function U(t, e, o) {
|
|
262
269
|
const n = t.type, c = t.slots;
|
|
263
270
|
if (c)
|
|
264
271
|
for (const [a, s] of Object.entries(c))
|
|
@@ -270,7 +277,7 @@ function k(t, e, o) {
|
|
|
270
277
|
"warning"
|
|
271
278
|
), s.allowedChildren !== void 0 && !Array.isArray(s.allowedChildren) && i(e, n, `slots.${a}.allowedChildren`, `插槽 "${a}" 的 allowedChildren 必须是字符串数组`, "error"));
|
|
272
279
|
}
|
|
273
|
-
function
|
|
280
|
+
function k(t, e, o) {
|
|
274
281
|
const n = t.type, c = t.state;
|
|
275
282
|
if (c)
|
|
276
283
|
for (const [a, s] of Object.entries(c))
|
|
@@ -278,7 +285,7 @@ function F(t, e, o) {
|
|
|
278
285
|
}
|
|
279
286
|
function z(t) {
|
|
280
287
|
const e = [], o = [];
|
|
281
|
-
return t.type || i(e, t.type || "Unknown", "type", "type 字段是必填的", "error"), K(t, e, o) ? (G(t, e), H(t, e, o),
|
|
288
|
+
return t.type || i(e, t.type || "Unknown", "type", "type 字段是必填的", "error"), K(t, e, o) ? (G(t, e), H(t, e, o), k(t, e), U(t, e, o), F(t, e, o), {
|
|
282
289
|
valid: e.length === 0,
|
|
283
290
|
errors: e,
|
|
284
291
|
warnings: o
|
|
@@ -325,7 +332,7 @@ export {
|
|
|
325
332
|
ot as C,
|
|
326
333
|
Q as D,
|
|
327
334
|
C as E,
|
|
328
|
-
|
|
335
|
+
R as I,
|
|
329
336
|
nt as L,
|
|
330
337
|
q as N,
|
|
331
338
|
$ as O,
|
|
@@ -338,7 +345,7 @@ export {
|
|
|
338
345
|
tt as e,
|
|
339
346
|
et as f,
|
|
340
347
|
W as g,
|
|
341
|
-
|
|
348
|
+
V as h,
|
|
342
349
|
I as i,
|
|
343
350
|
st as j,
|
|
344
351
|
rt as k,
|
|
@@ -348,8 +355,8 @@ export {
|
|
|
348
355
|
w as o,
|
|
349
356
|
ct as p,
|
|
350
357
|
it as q,
|
|
351
|
-
|
|
358
|
+
x as r,
|
|
352
359
|
at as s,
|
|
353
|
-
|
|
360
|
+
O as u,
|
|
354
361
|
z as v
|
|
355
362
|
};
|