@tachybase/components 0.23.17 → 0.23.20
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/lib/__builtins__/portal.js +12 -18
- package/lib/__builtins__/sort.js +6 -15
- package/lib/array-base/index.js +31 -26
- package/lib/array-cards/index.js +48 -38
- package/lib/array-collapse/index.js +69 -60
- package/lib/array-items/index.js +29 -26
- package/lib/array-table/index.js +74 -65
- package/lib/array-tabs/index.js +7 -16
- package/lib/cascader/index.js +2 -12
- package/lib/code-mirror/index.js +4 -3
- package/lib/editable/index.js +20 -8
- package/lib/form/index.js +4 -3
- package/lib/form-button-group/index.d.ts +2 -2
- package/lib/form-button-group/index.js +24 -23
- package/lib/form-collapse/index.js +8 -7
- package/lib/form-dialog/index.js +8 -7
- package/lib/form-drawer/index.js +5 -4
- package/lib/form-grid/index.js +8 -7
- package/lib/form-item/hooks/useFormItemLayout.d.ts +1 -1
- package/lib/form-item/hooks/useFormItemLayout.js +2 -12
- package/lib/form-item/index.js +82 -61
- package/lib/form-layout/index.d.ts +1 -1
- package/lib/form-layout/index.js +4 -3
- package/lib/form-step/index.js +12 -8
- package/lib/form-tab/index.js +10 -9
- package/lib/input/index.js +2 -12
- package/lib/lightbox/react-image-lightbox.d.ts +2 -2
- package/lib/lightbox/react-image-lightbox.js +135 -125
- package/lib/password/PasswordStrength.js +3 -12
- package/lib/password/index.js +32 -37
- package/lib/preview-text/index.js +32 -19
- package/lib/reset/index.js +5 -15
- package/lib/select/index.js +2 -12
- package/lib/select-table/hooks/useTitleAddon.d.ts +1 -2
- package/lib/select-table/hooks/useTitleAddon.js +4 -14
- package/lib/select-table/index.js +71 -66
- package/lib/submit/index.js +5 -15
- package/lib/tree-select/index.js +2 -12
- package/lib/upload/index.js +10 -3
- package/package.json +2 -2
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
var __create = Object.create;
|
|
2
1
|
var __defProp = Object.defineProperty;
|
|
3
2
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
3
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
6
4
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
5
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
8
6
|
var __export = (target, all) => {
|
|
@@ -17,14 +15,6 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
15
|
}
|
|
18
16
|
return to;
|
|
19
17
|
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
19
|
var portal_exports = {};
|
|
30
20
|
__export(portal_exports, {
|
|
@@ -32,7 +22,8 @@ __export(portal_exports, {
|
|
|
32
22
|
createPortalRoot: () => createPortalRoot
|
|
33
23
|
});
|
|
34
24
|
module.exports = __toCommonJS(portal_exports);
|
|
35
|
-
var
|
|
25
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
26
|
+
var import_react = require("react");
|
|
36
27
|
var import_schema = require("@tachybase/schema");
|
|
37
28
|
var import_react_dom = require("react-dom");
|
|
38
29
|
var import_render = require("./render");
|
|
@@ -42,12 +33,15 @@ const createPortalProvider = /* @__PURE__ */ __name((id) => {
|
|
|
42
33
|
if (props.id && !PortalMap.has(props.id)) {
|
|
43
34
|
PortalMap.set(props.id, null);
|
|
44
35
|
}
|
|
45
|
-
return /* @__PURE__ */
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
36
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_react.Fragment, { children: [
|
|
37
|
+
props.children,
|
|
38
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_schema.Observer, { children: () => {
|
|
39
|
+
if (!props.id) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, {});
|
|
40
|
+
const portal = PortalMap.get(props.id);
|
|
41
|
+
if (portal) return (0, import_react_dom.createPortal)(portal, document.body);
|
|
42
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, {});
|
|
43
|
+
} })
|
|
44
|
+
] });
|
|
51
45
|
}, "Portal");
|
|
52
46
|
Portal.defaultProps = {
|
|
53
47
|
id
|
|
@@ -59,7 +53,7 @@ function createPortalRoot(host, id) {
|
|
|
59
53
|
if (PortalMap.has(id)) {
|
|
60
54
|
PortalMap.set(id, renderer == null ? void 0 : renderer());
|
|
61
55
|
} else if (host) {
|
|
62
|
-
(0, import_render.render)(/* @__PURE__ */
|
|
56
|
+
(0, import_render.render)(/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react.Fragment, { children: renderer == null ? void 0 : renderer() }), host);
|
|
63
57
|
}
|
|
64
58
|
}
|
|
65
59
|
__name(render, "render");
|
package/lib/__builtins__/sort.js
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
var __create = Object.create;
|
|
2
1
|
var __defProp = Object.defineProperty;
|
|
3
2
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
3
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
6
4
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
5
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
8
6
|
var __export = (target, all) => {
|
|
@@ -17,14 +15,6 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
15
|
}
|
|
18
16
|
return to;
|
|
19
17
|
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
19
|
var sort_exports = {};
|
|
30
20
|
__export(sort_exports, {
|
|
@@ -35,7 +25,8 @@ __export(sort_exports, {
|
|
|
35
25
|
useSortableItem: () => useSortableItem
|
|
36
26
|
});
|
|
37
27
|
module.exports = __toCommonJS(sort_exports);
|
|
38
|
-
var
|
|
28
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
29
|
+
var import_react = require("react");
|
|
39
30
|
var import_core = require("@dnd-kit/core");
|
|
40
31
|
var import_sortable = require("@dnd-kit/sortable");
|
|
41
32
|
function SortableContainer(Component) {
|
|
@@ -50,7 +41,7 @@ function SortableContainer(Component) {
|
|
|
50
41
|
newIndex
|
|
51
42
|
});
|
|
52
43
|
}, "_onSortEnd");
|
|
53
|
-
return /* @__PURE__ */
|
|
44
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_core.DndContext, { accessibility, onDragStart: onSortStart, onDragEnd: _onSortEnd, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_sortable.SortableContext, { items: list.map((_, index) => index + start + 1), strategy: import_sortable.verticalListSortingStrategy, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Component, { ...props, children: props.children }) }) });
|
|
54
45
|
};
|
|
55
46
|
}
|
|
56
47
|
__name(SortableContainer, "SortableContainer");
|
|
@@ -101,18 +92,18 @@ function SortableElement(Component) {
|
|
|
101
92
|
};
|
|
102
93
|
return computedStyle;
|
|
103
94
|
}, [isDragging, transform, transition, props.style]);
|
|
104
|
-
return /* @__PURE__ */
|
|
95
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SortableItemContext.Provider, { value: sortable, children: Component({
|
|
105
96
|
...props,
|
|
106
97
|
style,
|
|
107
98
|
ref: setNodeRef
|
|
108
|
-
}));
|
|
99
|
+
}) });
|
|
109
100
|
};
|
|
110
101
|
}
|
|
111
102
|
__name(SortableElement, "SortableElement");
|
|
112
103
|
function SortableHandle(Component) {
|
|
113
104
|
return (props) => {
|
|
114
105
|
const { attributes, listeners } = useSortableItem();
|
|
115
|
-
return /* @__PURE__ */
|
|
106
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Component, { ...props, ...attributes, ...listeners });
|
|
116
107
|
};
|
|
117
108
|
}
|
|
118
109
|
__name(SortableHandle, "SortableHandle");
|
package/lib/array-base/index.js
CHANGED
|
@@ -32,7 +32,8 @@ __export(array_base_exports, {
|
|
|
32
32
|
default: () => array_base_default
|
|
33
33
|
});
|
|
34
34
|
module.exports = __toCommonJS(array_base_exports);
|
|
35
|
-
var
|
|
35
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
36
|
+
var import_react = require("react");
|
|
36
37
|
var import_schema = require("@tachybase/schema");
|
|
37
38
|
var import_icons = require("@ant-design/icons");
|
|
38
39
|
var import_antd = require("antd");
|
|
@@ -71,16 +72,16 @@ const getDefaultValue = /* @__PURE__ */ __name((defaultValue, schema) => {
|
|
|
71
72
|
const InternalArrayBase = /* @__PURE__ */ __name((props) => {
|
|
72
73
|
const field = (0, import_schema.useField)();
|
|
73
74
|
const schema = (0, import_schema.useFieldSchema)();
|
|
74
|
-
return /* @__PURE__ */
|
|
75
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_schema.RecordsScope, { getRecords: () => field.value, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ArrayBaseContext.Provider, { value: { field, schema, props }, children: props.children }) });
|
|
75
76
|
}, "InternalArrayBase");
|
|
76
77
|
const Item = /* @__PURE__ */ __name(({ children, ...props }) => {
|
|
77
|
-
return /* @__PURE__ */
|
|
78
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ItemContext.Provider, { value: props, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_schema.RecordScope, { getIndex: () => props.index, getRecord: () => takeRecord(props.record, props.index), children }) });
|
|
78
79
|
}, "Item");
|
|
79
80
|
const InternalSortHandle = (0, import_builtins.SortableHandle)((props) => {
|
|
80
81
|
const prefixCls = (0, import_builtins.usePrefixCls)("formily-array-base");
|
|
81
82
|
const [wrapSSR, hashId] = (0, import_style.default)(prefixCls);
|
|
82
83
|
return wrapSSR(
|
|
83
|
-
/* @__PURE__ */
|
|
84
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
84
85
|
import_icons.MenuOutlined,
|
|
85
86
|
{
|
|
86
87
|
...props,
|
|
@@ -95,14 +96,18 @@ const SortHandle = /* @__PURE__ */ __name((props) => {
|
|
|
95
96
|
const array = useArray();
|
|
96
97
|
if (!array) return null;
|
|
97
98
|
if (((_a = array.field) == null ? void 0 : _a.pattern) !== "editable") return null;
|
|
98
|
-
return /* @__PURE__ */
|
|
99
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(InternalSortHandle, { ...props });
|
|
99
100
|
}, "SortHandle");
|
|
100
101
|
const Index = /* @__PURE__ */ __name((props) => {
|
|
101
102
|
const index = useIndex();
|
|
102
103
|
const prefixCls = (0, import_builtins.usePrefixCls)("formily-array-base");
|
|
103
104
|
const [wrapSSR, hashId] = (0, import_style.default)(prefixCls);
|
|
104
105
|
return wrapSSR(
|
|
105
|
-
/* @__PURE__ */
|
|
106
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { ...props, className: (0, import_classnames.default)(`${prefixCls}-index`, hashId), children: [
|
|
107
|
+
"#",
|
|
108
|
+
(index || 0) + 1,
|
|
109
|
+
"."
|
|
110
|
+
] })
|
|
106
111
|
);
|
|
107
112
|
}, "Index");
|
|
108
113
|
const Addition = /* @__PURE__ */ __name((props) => {
|
|
@@ -114,7 +119,7 @@ const Addition = /* @__PURE__ */ __name((props) => {
|
|
|
114
119
|
if (!array) return null;
|
|
115
120
|
if (((_a = array.field) == null ? void 0 : _a.pattern) !== "editable" && ((_b = array.field) == null ? void 0 : _b.pattern) !== "disabled") return null;
|
|
116
121
|
return wrapSSR(
|
|
117
|
-
/* @__PURE__ */
|
|
122
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
118
123
|
import_antd.Button,
|
|
119
124
|
{
|
|
120
125
|
type: "dashed",
|
|
@@ -137,9 +142,9 @@ const Addition = /* @__PURE__ */ __name((props) => {
|
|
|
137
142
|
props.onClick(e);
|
|
138
143
|
}
|
|
139
144
|
},
|
|
140
|
-
icon: (0, import_schema.isUndef)(props.icon) ? /* @__PURE__ */
|
|
141
|
-
|
|
142
|
-
|
|
145
|
+
icon: (0, import_schema.isUndef)(props.icon) ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons.PlusOutlined, {}) : props.icon,
|
|
146
|
+
children: props.title || self.title
|
|
147
|
+
}
|
|
143
148
|
)
|
|
144
149
|
);
|
|
145
150
|
}, "Addition");
|
|
@@ -153,7 +158,7 @@ const Copy = (0, import_react.forwardRef)((props, ref) => {
|
|
|
153
158
|
if (!array) return null;
|
|
154
159
|
if (((_a = array.field) == null ? void 0 : _a.pattern) !== "editable") return null;
|
|
155
160
|
return wrapSSR(
|
|
156
|
-
/* @__PURE__ */
|
|
161
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
157
162
|
import_antd.Button,
|
|
158
163
|
{
|
|
159
164
|
...props,
|
|
@@ -180,9 +185,9 @@ const Copy = (0, import_react.forwardRef)((props, ref) => {
|
|
|
180
185
|
(_d = (_c = array.field) == null ? void 0 : _c.insert) == null ? void 0 : _d.call(_c, distIndex, value);
|
|
181
186
|
(_f = (_e = array.props) == null ? void 0 : _e.onCopy) == null ? void 0 : _f.call(_e, distIndex);
|
|
182
187
|
},
|
|
183
|
-
icon: (0, import_schema.isUndef)(props.icon) ? /* @__PURE__ */
|
|
184
|
-
|
|
185
|
-
|
|
188
|
+
icon: (0, import_schema.isUndef)(props.icon) ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons.CopyOutlined, {}) : props.icon,
|
|
189
|
+
children: props.title || self.title
|
|
190
|
+
}
|
|
186
191
|
)
|
|
187
192
|
);
|
|
188
193
|
});
|
|
@@ -196,7 +201,7 @@ const Remove = (0, import_react.forwardRef)((props, ref) => {
|
|
|
196
201
|
if (!array) return null;
|
|
197
202
|
if (((_a = array.field) == null ? void 0 : _a.pattern) !== "editable") return null;
|
|
198
203
|
return wrapSSR(
|
|
199
|
-
/* @__PURE__ */
|
|
204
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
200
205
|
import_antd.Button,
|
|
201
206
|
{
|
|
202
207
|
type: "text",
|
|
@@ -225,9 +230,9 @@ const Remove = (0, import_react.forwardRef)((props, ref) => {
|
|
|
225
230
|
(_b = (_a2 = array.field) == null ? void 0 : _a2.remove) == null ? void 0 : _b.call(_a2, index);
|
|
226
231
|
(_d = (_c = array.props) == null ? void 0 : _c.onRemove) == null ? void 0 : _d.call(_c, index);
|
|
227
232
|
},
|
|
228
|
-
icon: (0, import_schema.isUndef)(props.icon) ? /* @__PURE__ */
|
|
229
|
-
|
|
230
|
-
|
|
233
|
+
icon: (0, import_schema.isUndef)(props.icon) ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons.DeleteOutlined, {}) : props.icon,
|
|
234
|
+
children: props.title || self.title
|
|
235
|
+
}
|
|
231
236
|
)
|
|
232
237
|
);
|
|
233
238
|
});
|
|
@@ -239,7 +244,7 @@ const MoveDown = (0, import_react.forwardRef)((props, ref) => {
|
|
|
239
244
|
const prefixCls = (0, import_builtins.usePrefixCls)("formily-array-base");
|
|
240
245
|
if (!array) return null;
|
|
241
246
|
if (((_a = array.field) == null ? void 0 : _a.pattern) !== "editable") return null;
|
|
242
|
-
return /* @__PURE__ */
|
|
247
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
243
248
|
import_antd.Button,
|
|
244
249
|
{
|
|
245
250
|
...props,
|
|
@@ -267,9 +272,9 @@ const MoveDown = (0, import_react.forwardRef)((props, ref) => {
|
|
|
267
272
|
(_b = (_a2 = array.field) == null ? void 0 : _a2.moveDown) == null ? void 0 : _b.call(_a2, index);
|
|
268
273
|
(_d = (_c = array.props) == null ? void 0 : _c.onMoveDown) == null ? void 0 : _d.call(_c, index);
|
|
269
274
|
},
|
|
270
|
-
icon: (0, import_schema.isUndef)(props.icon) ? /* @__PURE__ */
|
|
271
|
-
|
|
272
|
-
|
|
275
|
+
icon: (0, import_schema.isUndef)(props.icon) ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons.DownOutlined, {}) : props.icon,
|
|
276
|
+
children: props.title || self.title
|
|
277
|
+
}
|
|
273
278
|
);
|
|
274
279
|
});
|
|
275
280
|
const MoveUp = (0, import_react.forwardRef)((props, ref) => {
|
|
@@ -280,7 +285,7 @@ const MoveUp = (0, import_react.forwardRef)((props, ref) => {
|
|
|
280
285
|
const prefixCls = (0, import_builtins.usePrefixCls)("formily-array-base");
|
|
281
286
|
if (!array) return null;
|
|
282
287
|
if (((_a = array.field) == null ? void 0 : _a.pattern) !== "editable") return null;
|
|
283
|
-
return /* @__PURE__ */
|
|
288
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
284
289
|
import_antd.Button,
|
|
285
290
|
{
|
|
286
291
|
type: "text",
|
|
@@ -304,9 +309,9 @@ const MoveUp = (0, import_react.forwardRef)((props, ref) => {
|
|
|
304
309
|
(_a2 = array == null ? void 0 : array.field) == null ? void 0 : _a2.moveUp(index);
|
|
305
310
|
(_c = (_b = array == null ? void 0 : array.props) == null ? void 0 : _b.onMoveUp) == null ? void 0 : _c.call(_b, index);
|
|
306
311
|
},
|
|
307
|
-
icon: (0, import_schema.isUndef)(props.icon) ? /* @__PURE__ */
|
|
308
|
-
|
|
309
|
-
|
|
312
|
+
icon: (0, import_schema.isUndef)(props.icon) ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons.UpOutlined, {}) : props.icon,
|
|
313
|
+
children: props.title || self.title
|
|
314
|
+
}
|
|
310
315
|
);
|
|
311
316
|
});
|
|
312
317
|
function mixin(target) {
|
package/lib/array-cards/index.js
CHANGED
|
@@ -33,7 +33,7 @@ __export(array_cards_exports, {
|
|
|
33
33
|
default: () => array_cards_default
|
|
34
34
|
});
|
|
35
35
|
module.exports = __toCommonJS(array_cards_exports);
|
|
36
|
-
var
|
|
36
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
37
37
|
var import_schema = require("@tachybase/schema");
|
|
38
38
|
var import_antd = require("antd");
|
|
39
39
|
var import_classnames = __toESM(require("classnames"));
|
|
@@ -77,31 +77,37 @@ const InternalArrayCards = (0, import_schema.observer)((props) => {
|
|
|
77
77
|
const renderItems = /* @__PURE__ */ __name(() => {
|
|
78
78
|
return dataSource == null ? void 0 : dataSource.map((item, index) => {
|
|
79
79
|
const items = Array.isArray(schema.items) ? schema.items[index] || schema.items[0] : schema.items;
|
|
80
|
-
const title = /* @__PURE__ */
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
80
|
+
const title = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { children: [
|
|
81
|
+
items ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
82
|
+
import_schema.RecursionField,
|
|
83
|
+
{
|
|
84
|
+
schema: items,
|
|
85
|
+
name: index,
|
|
86
|
+
filterProperties: (schema2) => {
|
|
87
|
+
if (!isIndexComponent(schema2)) return false;
|
|
88
|
+
return true;
|
|
89
|
+
},
|
|
90
|
+
onlyRenderProperties: true
|
|
91
|
+
}
|
|
92
|
+
) : null,
|
|
93
|
+
props.title || field.title
|
|
94
|
+
] });
|
|
95
|
+
const extra = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { children: [
|
|
96
|
+
items ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
97
|
+
import_schema.RecursionField,
|
|
98
|
+
{
|
|
99
|
+
schema: items,
|
|
100
|
+
name: index,
|
|
101
|
+
filterProperties: (schema2) => {
|
|
102
|
+
if (!isOperationComponent(schema2)) return false;
|
|
103
|
+
return true;
|
|
104
|
+
},
|
|
105
|
+
onlyRenderProperties: true
|
|
106
|
+
}
|
|
107
|
+
) : null,
|
|
108
|
+
props.extra
|
|
109
|
+
] });
|
|
110
|
+
const content = items ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
105
111
|
import_schema.RecursionField,
|
|
106
112
|
{
|
|
107
113
|
schema: items,
|
|
@@ -113,10 +119,10 @@ const InternalArrayCards = (0, import_schema.observer)((props) => {
|
|
|
113
119
|
}
|
|
114
120
|
}
|
|
115
121
|
) : null;
|
|
116
|
-
return /* @__PURE__ */
|
|
122
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_array_base.ArrayBase.Item, { index, record: () => {
|
|
117
123
|
var _a;
|
|
118
124
|
return (_a = field.value) == null ? void 0 : _a[index];
|
|
119
|
-
}
|
|
125
|
+
}, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
120
126
|
import_antd.Card,
|
|
121
127
|
{
|
|
122
128
|
...props,
|
|
@@ -124,36 +130,40 @@ const InternalArrayCards = (0, import_schema.observer)((props) => {
|
|
|
124
130
|
},
|
|
125
131
|
className: (0, import_classnames.default)(`${prefixCls}-item`, hashId, props.className),
|
|
126
132
|
title,
|
|
127
|
-
extra
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
));
|
|
133
|
+
extra,
|
|
134
|
+
children: content
|
|
135
|
+
}
|
|
136
|
+
) }, index);
|
|
131
137
|
});
|
|
132
138
|
}, "renderItems");
|
|
133
139
|
const renderAddition = /* @__PURE__ */ __name(() => {
|
|
134
140
|
return schema.reduceProperties((addition, schema2, key) => {
|
|
135
141
|
if (isAdditionComponent(schema2)) {
|
|
136
|
-
return /* @__PURE__ */
|
|
142
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_schema.RecursionField, { schema: schema2, name: key });
|
|
137
143
|
}
|
|
138
144
|
return addition;
|
|
139
145
|
}, null);
|
|
140
146
|
}, "renderAddition");
|
|
141
147
|
const renderEmpty = /* @__PURE__ */ __name(() => {
|
|
142
148
|
if (dataSource == null ? void 0 : dataSource.length) return;
|
|
143
|
-
return /* @__PURE__ */
|
|
149
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
144
150
|
import_antd.Card,
|
|
145
151
|
{
|
|
146
152
|
...props,
|
|
147
153
|
onChange: () => {
|
|
148
154
|
},
|
|
149
155
|
className: (0, import_classnames.default)(`${prefixCls}-item`, hashId, props.className),
|
|
150
|
-
title: props.title || field.title
|
|
151
|
-
|
|
152
|
-
|
|
156
|
+
title: props.title || field.title,
|
|
157
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd.Empty, {})
|
|
158
|
+
}
|
|
153
159
|
);
|
|
154
160
|
}, "renderEmpty");
|
|
155
161
|
return wrapSSR(
|
|
156
|
-
/* @__PURE__ */
|
|
162
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_array_base.ArrayBase, { children: [
|
|
163
|
+
renderEmpty(),
|
|
164
|
+
renderItems(),
|
|
165
|
+
renderAddition()
|
|
166
|
+
] })
|
|
157
167
|
);
|
|
158
168
|
});
|
|
159
169
|
const ArrayCards = import_array_base.ArrayBase.mixin(InternalArrayCards);
|
|
@@ -32,7 +32,8 @@ __export(array_collapse_exports, {
|
|
|
32
32
|
default: () => array_collapse_default
|
|
33
33
|
});
|
|
34
34
|
module.exports = __toCommonJS(array_collapse_exports);
|
|
35
|
-
var
|
|
35
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
36
|
+
var import_react = require("react");
|
|
36
37
|
var import_schema = require("@tachybase/schema");
|
|
37
38
|
var import_antd = require("antd");
|
|
38
39
|
var import_classnames = __toESM(require("classnames"));
|
|
@@ -93,96 +94,104 @@ const InternalArrayCollapse = (0, import_schema.observer)((props) => {
|
|
|
93
94
|
const renderAddition = /* @__PURE__ */ __name(() => {
|
|
94
95
|
return schema.reduceProperties((addition, schema2, key) => {
|
|
95
96
|
if (isAdditionComponent(schema2)) {
|
|
96
|
-
return /* @__PURE__ */
|
|
97
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_schema.RecursionField, { schema: schema2, name: key });
|
|
97
98
|
}
|
|
98
99
|
return addition;
|
|
99
100
|
}, null);
|
|
100
101
|
}, "renderAddition");
|
|
101
102
|
const renderEmpty = /* @__PURE__ */ __name(() => {
|
|
102
103
|
if (dataSource.length) return;
|
|
103
|
-
return /* @__PURE__ */
|
|
104
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd.Card, { className: (0, import_classnames.default)(`${prefixCls}-item`, hashId, props.className), children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd.Empty, {}) });
|
|
104
105
|
}, "renderEmpty");
|
|
105
106
|
const renderItems = /* @__PURE__ */ __name(() => {
|
|
106
|
-
return /* @__PURE__ */
|
|
107
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
107
108
|
import_antd.Collapse,
|
|
108
109
|
{
|
|
109
110
|
...props,
|
|
110
111
|
activeKey: activeKeys,
|
|
111
112
|
onChange: (keys) => setActiveKeys((0, import_schema.toArr)(keys).map(Number)),
|
|
112
|
-
className: (0, import_classnames.default)(`${prefixCls}-item`, hashId, props.className)
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
113
|
+
className: (0, import_classnames.default)(`${prefixCls}-item`, hashId, props.className),
|
|
114
|
+
children: dataSource.map((item, index) => {
|
|
115
|
+
const items = Array.isArray(schema.items) ? schema.items[index] || schema.items[0] : schema.items;
|
|
116
|
+
if (!items) return null;
|
|
117
|
+
const panelProps = field.query(`${field.address}.${index}`).get("componentProps");
|
|
118
|
+
const props2 = items["x-component-props"];
|
|
119
|
+
const header = /* @__PURE__ */ __name(() => {
|
|
120
|
+
const header2 = `${(panelProps == null ? void 0 : panelProps.header) || props2.header || field.title}`;
|
|
121
|
+
const path = field.address.concat(index);
|
|
122
|
+
const errors = field.form.queryFeedbacks({
|
|
123
|
+
type: "error",
|
|
124
|
+
address: `${path}.**`
|
|
125
|
+
});
|
|
126
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_array_base.default.Item, { index, record: () => {
|
|
127
|
+
var _a;
|
|
128
|
+
return (_a = field.value) == null ? void 0 : _a[index];
|
|
129
|
+
}, children: [
|
|
130
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
131
|
+
import_schema.RecursionField,
|
|
132
|
+
{
|
|
133
|
+
schema: items,
|
|
134
|
+
name: index,
|
|
135
|
+
filterProperties: (schema2) => {
|
|
136
|
+
if (!isIndexComponent(schema2)) return false;
|
|
137
|
+
return true;
|
|
138
|
+
},
|
|
139
|
+
onlyRenderProperties: true
|
|
140
|
+
}
|
|
141
|
+
),
|
|
142
|
+
errors.length ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd.Badge, { size: "small", className: "errors-badge", count: errors.length, children: header2 }) : header2
|
|
143
|
+
] });
|
|
144
|
+
}, "header");
|
|
145
|
+
const extra = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_array_base.default.Item, { index, record: item, children: [
|
|
146
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
147
|
+
import_schema.RecursionField,
|
|
148
|
+
{
|
|
149
|
+
schema: items,
|
|
150
|
+
name: index,
|
|
151
|
+
filterProperties: (schema2) => {
|
|
152
|
+
if (!isOperationComponent(schema2)) return false;
|
|
153
|
+
return true;
|
|
154
|
+
},
|
|
155
|
+
onlyRenderProperties: true
|
|
156
|
+
}
|
|
157
|
+
),
|
|
158
|
+
panelProps == null ? void 0 : panelProps.extra
|
|
159
|
+
] });
|
|
160
|
+
const content = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
130
161
|
import_schema.RecursionField,
|
|
131
162
|
{
|
|
132
163
|
schema: items,
|
|
133
164
|
name: index,
|
|
134
165
|
filterProperties: (schema2) => {
|
|
135
|
-
if (
|
|
166
|
+
if (isIndexComponent(schema2)) return false;
|
|
167
|
+
if (isOperationComponent(schema2)) return false;
|
|
136
168
|
return true;
|
|
137
|
-
}
|
|
138
|
-
onlyRenderProperties: true
|
|
169
|
+
}
|
|
139
170
|
}
|
|
140
|
-
)
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
{
|
|
145
|
-
schema: items,
|
|
146
|
-
name: index,
|
|
147
|
-
filterProperties: (schema2) => {
|
|
148
|
-
if (!isOperationComponent(schema2)) return false;
|
|
149
|
-
return true;
|
|
150
|
-
},
|
|
151
|
-
onlyRenderProperties: true
|
|
152
|
-
}
|
|
153
|
-
), panelProps == null ? void 0 : panelProps.extra);
|
|
154
|
-
const content = /* @__PURE__ */ import_react.default.createElement(
|
|
155
|
-
import_schema.RecursionField,
|
|
156
|
-
{
|
|
157
|
-
schema: items,
|
|
158
|
-
name: index,
|
|
159
|
-
filterProperties: (schema2) => {
|
|
160
|
-
if (isIndexComponent(schema2)) return false;
|
|
161
|
-
if (isOperationComponent(schema2)) return false;
|
|
162
|
-
return true;
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
);
|
|
166
|
-
return /* @__PURE__ */ import_react.default.createElement(import_antd.Collapse.Panel, { key: index, ...props2, ...panelProps, forceRender: true, header: header(), extra }, /* @__PURE__ */ import_react.default.createElement(import_array_base.default.Item, { index, key: index, record: item }, content));
|
|
167
|
-
})
|
|
171
|
+
);
|
|
172
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd.Collapse.Panel, { ...props2, ...panelProps, forceRender: true, header: header(), extra, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_array_base.default.Item, { index, record: item, children: content }, index) }, index);
|
|
173
|
+
})
|
|
174
|
+
}
|
|
168
175
|
);
|
|
169
176
|
}, "renderItems");
|
|
170
177
|
return wrapSSR(
|
|
171
|
-
/* @__PURE__ */
|
|
178
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
172
179
|
import_array_base.default,
|
|
173
180
|
{
|
|
174
181
|
onAdd: (index) => {
|
|
175
182
|
setActiveKeys(insertActiveKeys(activeKeys, index));
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
183
|
+
},
|
|
184
|
+
children: [
|
|
185
|
+
renderEmpty(),
|
|
186
|
+
renderItems(),
|
|
187
|
+
renderAddition()
|
|
188
|
+
]
|
|
189
|
+
}
|
|
181
190
|
)
|
|
182
191
|
);
|
|
183
192
|
});
|
|
184
193
|
const CollapsePanel = /* @__PURE__ */ __name(({ children }) => {
|
|
185
|
-
return /* @__PURE__ */
|
|
194
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react.Fragment, { children });
|
|
186
195
|
}, "CollapsePanel");
|
|
187
196
|
CollapsePanel.displayName = "CollapsePanel";
|
|
188
197
|
const ArrayCollapse = Object.assign(import_array_base.default.mixin(InternalArrayCollapse), {
|