@tachybase/components 0.23.8

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.
Files changed (174) hide show
  1. package/.turbo/turbo-build.log +9 -0
  2. package/LICENSE +201 -0
  3. package/lib/__builtins__/dayjs.d.ts +4 -0
  4. package/lib/__builtins__/dayjs.js +95 -0
  5. package/lib/__builtins__/hooks/index.d.ts +4 -0
  6. package/lib/__builtins__/hooks/index.js +27 -0
  7. package/lib/__builtins__/hooks/useClickAway.d.ts +5 -0
  8. package/lib/__builtins__/hooks/useClickAway.js +64 -0
  9. package/lib/__builtins__/hooks/useConfig.d.ts +1 -0
  10. package/lib/__builtins__/hooks/useConfig.js +31 -0
  11. package/lib/__builtins__/hooks/usePrefixCls.d.ts +3 -0
  12. package/lib/__builtins__/hooks/usePrefixCls.js +38 -0
  13. package/lib/__builtins__/hooks/useToken.d.ts +6 -0
  14. package/lib/__builtins__/hooks/useToken.js +28 -0
  15. package/lib/__builtins__/index.d.ts +7 -0
  16. package/lib/__builtins__/index.js +33 -0
  17. package/lib/__builtins__/loading.d.ts +1 -0
  18. package/lib/__builtins__/loading.js +40 -0
  19. package/lib/__builtins__/pickDataProps.d.ts +1 -0
  20. package/lib/__builtins__/pickDataProps.js +36 -0
  21. package/lib/__builtins__/portal.d.ts +10 -0
  22. package/lib/__builtins__/portal.js +89 -0
  23. package/lib/__builtins__/render.d.ts +9 -0
  24. package/lib/__builtins__/render.js +99 -0
  25. package/lib/__builtins__/sort.d.ts +73 -0
  26. package/lib/__builtins__/sort.js +126 -0
  27. package/lib/__builtins__/style.d.ts +23 -0
  28. package/lib/__builtins__/style.js +88 -0
  29. package/lib/array-base/index.d.ts +64 -0
  30. package/lib/array-base/index.js +345 -0
  31. package/lib/array-base/style.d.ts +2 -0
  32. package/lib/array-base/style.js +68 -0
  33. package/lib/array-cards/index.d.ts +5 -0
  34. package/lib/array-cards/index.js +166 -0
  35. package/lib/array-cards/style.d.ts +2 -0
  36. package/lib/array-cards/style.js +37 -0
  37. package/lib/array-collapse/index.d.ts +10 -0
  38. package/lib/array-collapse/index.js +199 -0
  39. package/lib/array-collapse/style.d.ts +2 -0
  40. package/lib/array-collapse/style.js +33 -0
  41. package/lib/array-items/index.d.ts +8 -0
  42. package/lib/array-items/index.js +122 -0
  43. package/lib/array-items/style.d.ts +2 -0
  44. package/lib/array-items/style.js +82 -0
  45. package/lib/array-table/index.d.ts +9 -0
  46. package/lib/array-table/index.js +376 -0
  47. package/lib/array-table/style.d.ts +2 -0
  48. package/lib/array-table/style.js +71 -0
  49. package/lib/array-tabs/index.d.ts +4 -0
  50. package/lib/array-tabs/index.js +102 -0
  51. package/lib/cascader/index.d.ts +12 -0
  52. package/lib/cascader/index.js +58 -0
  53. package/lib/checkbox/index.d.ts +5 -0
  54. package/lib/checkbox/index.js +51 -0
  55. package/lib/code-mirror/index.d.ts +3 -0
  56. package/lib/code-mirror/index.js +91 -0
  57. package/lib/date-picker/index.d.ts +2 -0
  58. package/lib/date-picker/index.js +70 -0
  59. package/lib/date-picker/style.d.ts +1 -0
  60. package/lib/date-picker/style.js +1 -0
  61. package/lib/editable/index.d.ts +8 -0
  62. package/lib/editable/index.js +181 -0
  63. package/lib/editable/style.d.ts +2 -0
  64. package/lib/editable/style.js +69 -0
  65. package/lib/form/index.d.ts +12 -0
  66. package/lib/form/index.js +71 -0
  67. package/lib/form-button-group/index.d.ts +27 -0
  68. package/lib/form-button-group/index.js +148 -0
  69. package/lib/form-button-group/style.d.ts +2 -0
  70. package/lib/form-button-group/style.js +41 -0
  71. package/lib/form-collapse/index.d.ts +28 -0
  72. package/lib/form-collapse/index.js +150 -0
  73. package/lib/form-dialog/index.d.ts +26 -0
  74. package/lib/form-dialog/index.js +194 -0
  75. package/lib/form-drawer/index.d.ts +25 -0
  76. package/lib/form-drawer/index.js +187 -0
  77. package/lib/form-grid/index.d.ts +34 -0
  78. package/lib/form-grid/index.js +108 -0
  79. package/lib/form-grid/style.d.ts +2 -0
  80. package/lib/form-grid/style.js +31 -0
  81. package/lib/form-item/hooks/index.d.ts +2 -0
  82. package/lib/form-item/hooks/index.js +23 -0
  83. package/lib/form-item/hooks/useFormItemLayout.d.ts +37 -0
  84. package/lib/form-item/hooks/useFormItemLayout.js +66 -0
  85. package/lib/form-item/hooks/useOverflow.d.ts +5 -0
  86. package/lib/form-item/hooks/useOverflow.js +55 -0
  87. package/lib/form-item/index.d.ts +11 -0
  88. package/lib/form-item/index.js +303 -0
  89. package/lib/form-item/style/animation.d.ts +2 -0
  90. package/lib/form-item/style/animation.js +57 -0
  91. package/lib/form-item/style/grid.d.ts +2 -0
  92. package/lib/form-item/style/grid.js +50 -0
  93. package/lib/form-item/style/index.d.ts +2 -0
  94. package/lib/form-item/style/index.js +387 -0
  95. package/lib/form-item/style/other.d.ts +2 -0
  96. package/lib/form-item/style/other.js +490 -0
  97. package/lib/form-item/types.d.ts +35 -0
  98. package/lib/form-item/types.js +15 -0
  99. package/lib/form-layout/index.d.ts +74 -0
  100. package/lib/form-layout/index.js +96 -0
  101. package/lib/form-layout/useResponsiveFormLayout.d.ts +17 -0
  102. package/lib/form-layout/useResponsiveFormLayout.js +89 -0
  103. package/lib/form-step/index.d.ts +27 -0
  104. package/lib/form-step/index.js +154 -0
  105. package/lib/form-tab/index.d.ts +19 -0
  106. package/lib/form-tab/index.js +150 -0
  107. package/lib/index.d.ts +38 -0
  108. package/lib/index.js +95 -0
  109. package/lib/input/index.d.ts +7 -0
  110. package/lib/input/index.js +57 -0
  111. package/lib/lightbox/constant.d.ts +21 -0
  112. package/lib/lightbox/constant.js +79 -0
  113. package/lib/lightbox/index.d.ts +2 -0
  114. package/lib/lightbox/index.js +37 -0
  115. package/lib/lightbox/interface.d.ts +43 -0
  116. package/lib/lightbox/interface.js +15 -0
  117. package/lib/lightbox/react-image-lightbox.d.ts +197 -0
  118. package/lib/lightbox/react-image-lightbox.js +1431 -0
  119. package/lib/lightbox/style.css +305 -0
  120. package/lib/lightbox/util.d.ts +7 -0
  121. package/lib/lightbox/util.js +71 -0
  122. package/lib/number-picker/index.d.ts +4 -0
  123. package/lib/number-picker/index.js +32 -0
  124. package/lib/password/PasswordStrength.d.ts +9 -0
  125. package/lib/password/PasswordStrength.js +188 -0
  126. package/lib/password/index.d.ts +7 -0
  127. package/lib/password/index.js +85 -0
  128. package/lib/preview-text/index.d.ts +12 -0
  129. package/lib/preview-text/index.js +263 -0
  130. package/lib/preview-text/style.d.ts +2 -0
  131. package/lib/preview-text/style.js +37 -0
  132. package/lib/radio/index.d.ts +8 -0
  133. package/lib/radio/index.js +51 -0
  134. package/lib/reset/index.d.ts +10 -0
  135. package/lib/reset/index.js +67 -0
  136. package/lib/select/index.d.ts +4 -0
  137. package/lib/select/index.js +59 -0
  138. package/lib/select-table/hooks/index.d.ts +5 -0
  139. package/lib/select-table/hooks/index.js +29 -0
  140. package/lib/select-table/hooks/useCheckSlackly.d.ts +16 -0
  141. package/lib/select-table/hooks/useCheckSlackly.js +57 -0
  142. package/lib/select-table/hooks/useFilterOptions.d.ts +3 -0
  143. package/lib/select-table/hooks/useFilterOptions.js +97 -0
  144. package/lib/select-table/hooks/useFlatOptions.d.ts +3 -0
  145. package/lib/select-table/hooks/useFlatOptions.js +46 -0
  146. package/lib/select-table/hooks/useSize.d.ts +9 -0
  147. package/lib/select-table/hooks/useSize.js +48 -0
  148. package/lib/select-table/hooks/useTitleAddon.d.ts +7 -0
  149. package/lib/select-table/hooks/useTitleAddon.js +90 -0
  150. package/lib/select-table/index.d.ts +27 -0
  151. package/lib/select-table/index.js +339 -0
  152. package/lib/select-table/style.d.ts +2 -0
  153. package/lib/select-table/style.js +33 -0
  154. package/lib/select-table/utils.d.ts +78 -0
  155. package/lib/select-table/utils.js +166 -0
  156. package/lib/space/index.d.ts +4 -0
  157. package/lib/space/index.js +49 -0
  158. package/lib/submit/index.d.ts +11 -0
  159. package/lib/submit/index.js +67 -0
  160. package/lib/switch/index.d.ts +2 -0
  161. package/lib/switch/index.js +44 -0
  162. package/lib/time-picker/index.d.ts +2 -0
  163. package/lib/time-picker/index.js +60 -0
  164. package/lib/time-picker/style.d.ts +1 -0
  165. package/lib/time-picker/style.js +1 -0
  166. package/lib/transfer/index.d.ts +2 -0
  167. package/lib/transfer/index.js +56 -0
  168. package/lib/tree-select/index.d.ts +2 -0
  169. package/lib/tree-select/index.js +58 -0
  170. package/lib/upload/index.d.ts +18 -0
  171. package/lib/upload/index.js +159 -0
  172. package/lib/upload/placeholder.d.ts +4 -0
  173. package/lib/upload/placeholder.js +88 -0
  174. package/package.json +31 -0
@@ -0,0 +1,376 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
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
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+ var array_table_exports = {};
30
+ __export(array_table_exports, {
31
+ ArrayTable: () => ArrayTable,
32
+ default: () => array_table_default
33
+ });
34
+ module.exports = __toCommonJS(array_table_exports);
35
+ var import_react = __toESM(require("react"));
36
+ var import_schema = require("@tachybase/schema");
37
+ var import_antd = require("antd");
38
+ var import_classnames = __toESM(require("classnames"));
39
+ var import_builtins = require("../__builtins__");
40
+ var import_array_base = require("../array-base");
41
+ var import_style = __toESM(require("./style"));
42
+ const SortableRow = (0, import_builtins.SortableElement)((props) => /* @__PURE__ */ import_react.default.createElement("tr", { ...props }));
43
+ const SortableBody = (0, import_builtins.SortableContainer)((props) => /* @__PURE__ */ import_react.default.createElement("tbody", { ...props }));
44
+ const isColumnComponent = /* @__PURE__ */ __name((schema) => {
45
+ var _a;
46
+ return ((_a = schema["x-component"]) == null ? void 0 : _a.indexOf("Column")) > -1;
47
+ }, "isColumnComponent");
48
+ const isOperationsComponent = /* @__PURE__ */ __name((schema) => {
49
+ var _a;
50
+ return ((_a = schema["x-component"]) == null ? void 0 : _a.indexOf("Operations")) > -1;
51
+ }, "isOperationsComponent");
52
+ const isAdditionComponent = /* @__PURE__ */ __name((schema) => {
53
+ var _a;
54
+ return ((_a = schema["x-component"]) == null ? void 0 : _a.indexOf("Addition")) > -1;
55
+ }, "isAdditionComponent");
56
+ const useArrayTableSources = /* @__PURE__ */ __name(() => {
57
+ const arrayField = (0, import_schema.useField)();
58
+ const schema = (0, import_schema.useFieldSchema)();
59
+ const parseSources = /* @__PURE__ */ __name((schema2) => {
60
+ var _a, _b, _c;
61
+ if (isColumnComponent(schema2) || isOperationsComponent(schema2) || isAdditionComponent(schema2)) {
62
+ if (!((_a = schema2["x-component-props"]) == null ? void 0 : _a["dataIndex"]) && !schema2["name"]) return [];
63
+ const name = ((_b = schema2["x-component-props"]) == null ? void 0 : _b["dataIndex"]) || schema2["name"];
64
+ const field = arrayField.query(arrayField.address.concat(name)).take();
65
+ const columnProps = ((_c = field == null ? void 0 : field.component) == null ? void 0 : _c[1]) || schema2["x-component-props"] || {};
66
+ const display = (field == null ? void 0 : field.display) || schema2["x-display"];
67
+ return [
68
+ {
69
+ name,
70
+ display,
71
+ field,
72
+ schema: schema2,
73
+ columnProps
74
+ }
75
+ ];
76
+ } else if (schema2.properties) {
77
+ return schema2.reduceProperties((buf, schema3) => {
78
+ return buf.concat(parseSources(schema3));
79
+ }, []);
80
+ }
81
+ return [];
82
+ }, "parseSources");
83
+ const parseArrayItems = /* @__PURE__ */ __name((schema2) => {
84
+ if (!schema2) return [];
85
+ const sources = [];
86
+ const items = (0, import_schema.isArr)(schema2) ? schema2 : [schema2];
87
+ return items.reduce((columns, schema3) => {
88
+ const item = parseSources(schema3);
89
+ if (item) {
90
+ return columns.concat(item);
91
+ }
92
+ return columns;
93
+ }, sources);
94
+ }, "parseArrayItems");
95
+ if (!schema) throw new Error("can not found schema object");
96
+ return parseArrayItems(schema.items);
97
+ }, "useArrayTableSources");
98
+ const useArrayTableColumns = /* @__PURE__ */ __name((dataSource, field, sources) => {
99
+ return sources.reduce((buf, { name, columnProps, schema, display }, key) => {
100
+ if (display !== "visible") return buf;
101
+ if (!isColumnComponent(schema)) return buf;
102
+ return buf.concat({
103
+ ...columnProps,
104
+ key,
105
+ dataIndex: name,
106
+ render: /* @__PURE__ */ __name((value, record) => {
107
+ const index = dataSource.indexOf(record);
108
+ const children = /* @__PURE__ */ import_react.default.createElement(import_array_base.ArrayBase.Item, { index, record: () => {
109
+ var _a;
110
+ return (_a = field == null ? void 0 : field.value) == null ? void 0 : _a[index];
111
+ } }, /* @__PURE__ */ import_react.default.createElement(import_schema.RecursionField, { schema, name: index, onlyRenderProperties: true }));
112
+ return children;
113
+ }, "render")
114
+ });
115
+ }, []);
116
+ }, "useArrayTableColumns");
117
+ const useAddition = /* @__PURE__ */ __name(() => {
118
+ const schema = (0, import_schema.useFieldSchema)();
119
+ return schema.reduceProperties((addition, schema2, key) => {
120
+ if (isAdditionComponent(schema2)) {
121
+ return /* @__PURE__ */ import_react.default.createElement(import_schema.RecursionField, { schema: schema2, name: key });
122
+ }
123
+ return addition;
124
+ }, null);
125
+ }, "useAddition");
126
+ const schedulerRequest = {
127
+ request: null
128
+ };
129
+ const StatusSelect = (0, import_schema.observer)(
130
+ (props) => {
131
+ var _a;
132
+ const field = (0, import_schema.useField)();
133
+ const prefixCls = (0, import_builtins.usePrefixCls)("formily-array-table");
134
+ const [wrapSSR, hashId] = (0, import_style.default)(prefixCls);
135
+ const errors = field.errors;
136
+ const parseIndex = /* @__PURE__ */ __name((address) => {
137
+ var _a2;
138
+ return Number((_a2 = address == null ? void 0 : address.slice(address.indexOf(field.address.toString())).match(/(\d+)/)) == null ? void 0 : _a2[1]);
139
+ }, "parseIndex");
140
+ const options = (_a = props.options) == null ? void 0 : _a.map(({ label, value }) => {
141
+ const val = Number(value);
142
+ const hasError = errors.some(({ address }) => {
143
+ var _a2;
144
+ const currentIndex = parseIndex(address);
145
+ const startIndex = props.pageSize ? (val - 1) * props.pageSize : 0;
146
+ const endIndex = props.pageSize ? val * props.pageSize : ((_a2 = props.options) == null ? void 0 : _a2.length) || 0;
147
+ return currentIndex >= startIndex && currentIndex <= endIndex;
148
+ });
149
+ return {
150
+ label: hasError ? /* @__PURE__ */ import_react.default.createElement(import_antd.Badge, { dot: true }, label) : label,
151
+ value
152
+ };
153
+ });
154
+ const width = String(options == null ? void 0 : options.length).length * 15;
155
+ return wrapSSR(
156
+ /* @__PURE__ */ import_react.default.createElement(
157
+ import_antd.Select,
158
+ {
159
+ value: props.value,
160
+ onChange: props.onChange,
161
+ options,
162
+ virtual: true,
163
+ style: {
164
+ width: width < 60 ? 60 : width
165
+ },
166
+ className: (0, import_classnames.default)(`${prefixCls}-status-select`, hashId, {
167
+ "has-error": errors == null ? void 0 : errors.length
168
+ })
169
+ }
170
+ )
171
+ );
172
+ },
173
+ {
174
+ scheduler: /* @__PURE__ */ __name((update) => {
175
+ clearTimeout(schedulerRequest.request);
176
+ schedulerRequest.request = setTimeout(() => {
177
+ update();
178
+ }, 100);
179
+ }, "scheduler")
180
+ }
181
+ );
182
+ const PaginationContext = (0, import_react.createContext)({});
183
+ const usePagination = /* @__PURE__ */ __name(() => {
184
+ return (0, import_react.useContext)(PaginationContext);
185
+ }, "usePagination");
186
+ const ArrayTablePagination = /* @__PURE__ */ __name((props) => {
187
+ var _a;
188
+ const [current, setCurrent] = (0, import_react.useState)(1);
189
+ const prefixCls = (0, import_builtins.usePrefixCls)("formily-array-table");
190
+ const [wrapSSR, hashId] = (0, import_style.default)(prefixCls);
191
+ const pageSize = props.pageSize || 10;
192
+ const size = props.size || "default";
193
+ const dataSource = props.dataSource || [];
194
+ const startIndex = (current - 1) * pageSize;
195
+ const endIndex = startIndex + pageSize - 1;
196
+ const total = (dataSource == null ? void 0 : dataSource.length) || 0;
197
+ const totalPage = Math.ceil(total / pageSize);
198
+ const pages = Array.from({ length: totalPage }).map((_, index) => {
199
+ const page = index + 1;
200
+ return {
201
+ label: page,
202
+ value: page
203
+ };
204
+ });
205
+ const handleChange = /* @__PURE__ */ __name((current2) => {
206
+ setCurrent(current2);
207
+ }, "handleChange");
208
+ (0, import_react.useEffect)(() => {
209
+ if (totalPage > 0 && totalPage < current) {
210
+ handleChange(totalPage);
211
+ }
212
+ }, [totalPage, current]);
213
+ const renderPagination = /* @__PURE__ */ __name(() => {
214
+ if (totalPage <= 1) return;
215
+ return /* @__PURE__ */ import_react.default.createElement("div", { className: (0, import_classnames.default)(`${prefixCls}-pagination`, hashId) }, /* @__PURE__ */ import_react.default.createElement(import_antd.Space, null, /* @__PURE__ */ import_react.default.createElement(
216
+ StatusSelect,
217
+ {
218
+ value: current,
219
+ pageSize,
220
+ onChange: handleChange,
221
+ options: pages,
222
+ notFoundContent: false
223
+ }
224
+ ), /* @__PURE__ */ import_react.default.createElement(
225
+ import_antd.Pagination,
226
+ {
227
+ ...props,
228
+ pageSize,
229
+ current,
230
+ total: dataSource.length,
231
+ size,
232
+ showSizeChanger: false,
233
+ onChange: handleChange
234
+ }
235
+ )));
236
+ }, "renderPagination");
237
+ return wrapSSR(
238
+ /* @__PURE__ */ import_react.default.createElement(import_react.Fragment, null, /* @__PURE__ */ import_react.default.createElement(PaginationContext.Provider, { value: { totalPage, pageSize, changePage: handleChange } }, (_a = props.children) == null ? void 0 : _a.call(props, dataSource == null ? void 0 : dataSource.slice(startIndex, endIndex + 1), renderPagination(), {
239
+ startIndex
240
+ })))
241
+ );
242
+ }, "ArrayTablePagination");
243
+ const RowComp = /* @__PURE__ */ __name((props) => {
244
+ const prefixCls = (0, import_builtins.usePrefixCls)("formily-array-table");
245
+ const index = props["data-row-key"] || 0;
246
+ return /* @__PURE__ */ import_react.default.createElement(
247
+ SortableRow,
248
+ {
249
+ lockAxis: "y",
250
+ ...props,
251
+ index,
252
+ className: (0, import_classnames.default)(props.className, `${prefixCls}-row-${index + 1}`)
253
+ }
254
+ );
255
+ }, "RowComp");
256
+ const InternalArrayTable = (0, import_schema.observer)((props) => {
257
+ const ref = (0, import_react.useRef)(null);
258
+ const field = (0, import_schema.useField)();
259
+ const prefixCls = (0, import_builtins.usePrefixCls)("formily-array-table");
260
+ const [wrapSSR, hashId] = (0, import_style.default)(prefixCls);
261
+ const dataSource = Array.isArray(field.value) ? field.value.slice() : [];
262
+ const sources = useArrayTableSources();
263
+ const columns = useArrayTableColumns(dataSource, field, sources);
264
+ const pagination = (0, import_schema.isBool)(props.pagination) ? {} : props.pagination;
265
+ const addition = useAddition();
266
+ const defaultRowKey = /* @__PURE__ */ __name((record) => {
267
+ return dataSource.indexOf(record);
268
+ }, "defaultRowKey");
269
+ const addTdStyles = /* @__PURE__ */ __name((id) => {
270
+ var _a, _b;
271
+ const node = (_a = ref.current) == null ? void 0 : _a.querySelector(`.${prefixCls}-row-${id}`);
272
+ const helper = (_b = ref.current) == null ? void 0 : _b.querySelector(`.${prefixCls}-sort-helper`);
273
+ if (helper) {
274
+ const tds = node == null ? void 0 : node.querySelectorAll("td");
275
+ if (tds) {
276
+ requestAnimationFrame(() => {
277
+ helper.querySelectorAll("td").forEach((td, index) => {
278
+ if (tds[index]) {
279
+ td.style.width = getComputedStyle(tds[index]).width;
280
+ }
281
+ });
282
+ });
283
+ }
284
+ }
285
+ }, "addTdStyles");
286
+ const genWrapperComp = (0, import_react.useCallback)(
287
+ (list, start) => (props2) => {
288
+ return /* @__PURE__ */ import_react.default.createElement(
289
+ SortableBody,
290
+ {
291
+ ...props2,
292
+ accessibility: {
293
+ container: ref.current || void 0
294
+ },
295
+ start,
296
+ list,
297
+ onSortStart: (event) => {
298
+ addTdStyles(event.active.id);
299
+ },
300
+ onSortEnd: (event) => {
301
+ const { oldIndex, newIndex } = event;
302
+ window.requestAnimationFrame(() => {
303
+ field.move(oldIndex, newIndex);
304
+ });
305
+ },
306
+ className: (0, import_classnames.default)(`${prefixCls}-sort-helper`, props2.className)
307
+ },
308
+ props2.children
309
+ );
310
+ },
311
+ [field]
312
+ );
313
+ return wrapSSR(
314
+ /* @__PURE__ */ import_react.default.createElement(ArrayTablePagination, { ...pagination, dataSource }, (dataSource2, pager, { startIndex }) => {
315
+ return /* @__PURE__ */ import_react.default.createElement("div", { ref, className: (0, import_classnames.default)(prefixCls, hashId) }, /* @__PURE__ */ import_react.default.createElement(import_array_base.ArrayBase, null, /* @__PURE__ */ import_react.default.createElement(
316
+ import_antd.Table,
317
+ {
318
+ size: "small",
319
+ bordered: true,
320
+ rowKey: defaultRowKey,
321
+ ...props,
322
+ onChange: () => {
323
+ },
324
+ pagination: false,
325
+ columns,
326
+ dataSource: dataSource2,
327
+ components: {
328
+ body: {
329
+ wrapper: genWrapperComp(dataSource2, startIndex),
330
+ row: RowComp
331
+ }
332
+ }
333
+ }
334
+ ), /* @__PURE__ */ import_react.default.createElement("div", { style: { marginTop: 5, marginBottom: 5 } }, pager), sources.map((column, key) => {
335
+ if (!isColumnComponent(column.schema)) return;
336
+ return import_react.default.createElement(import_schema.RecursionField, {
337
+ name: column.name,
338
+ schema: column.schema,
339
+ onlyRenderSelf: true,
340
+ key
341
+ });
342
+ }), addition));
343
+ })
344
+ );
345
+ });
346
+ const Column = /* @__PURE__ */ __name(() => {
347
+ return /* @__PURE__ */ import_react.default.createElement(import_react.Fragment, null);
348
+ }, "Column");
349
+ const Addition = /* @__PURE__ */ __name((props) => {
350
+ const array = import_array_base.ArrayBase.useArray();
351
+ const { totalPage = 0, pageSize = 10, changePage } = usePagination();
352
+ return /* @__PURE__ */ import_react.default.createElement(
353
+ import_array_base.ArrayBase.Addition,
354
+ {
355
+ ...props,
356
+ onClick: (e) => {
357
+ var _a, _b;
358
+ const total = ((_a = array == null ? void 0 : array.field) == null ? void 0 : _a.value.length) || 0;
359
+ if (total === totalPage * pageSize + 1 && (0, import_schema.isFn)(changePage)) {
360
+ changePage(totalPage + 1);
361
+ }
362
+ (_b = props.onClick) == null ? void 0 : _b.call(props, e);
363
+ }
364
+ }
365
+ );
366
+ }, "Addition");
367
+ const ArrayTable = Object.assign(import_array_base.ArrayBase.mixin(InternalArrayTable), {
368
+ Column,
369
+ Addition
370
+ });
371
+ ArrayTable.displayName = "ArrayTable";
372
+ var array_table_default = ArrayTable;
373
+ // Annotate the CommonJS export names for ESM import in node:
374
+ 0 && (module.exports = {
375
+ ArrayTable
376
+ });
@@ -0,0 +1,2 @@
1
+ declare const _default: (prefixCls: string) => import("..").UseComponentStyleResult;
2
+ export default _default;
@@ -0,0 +1,71 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+ var style_exports = {};
19
+ __export(style_exports, {
20
+ default: () => style_default
21
+ });
22
+ module.exports = __toCommonJS(style_exports);
23
+ var import_builtins = require("../__builtins__");
24
+ var style_default = (0, import_builtins.genStyleHook)("array-table", (token) => {
25
+ const { componentCls, antCls, colorErrorBorder, fontSizeSM, colorBgBase, colorBorder, colorBgContainer } = token;
26
+ const itemCls = `${antCls}-formily-item`;
27
+ return {
28
+ [componentCls]: {
29
+ [`${componentCls}-pagination`]: {
30
+ display: "flex",
31
+ justifyContent: "center",
32
+ [`${componentCls}-status-select.has-error`]: {
33
+ [`${antCls}-select-selector`]: {
34
+ borderColor: `${colorErrorBorder} !important`
35
+ }
36
+ }
37
+ },
38
+ [`${antCls}-table`]: {
39
+ td: {
40
+ visibility: "visible",
41
+ [`${itemCls}:not(${itemCls}-feedback-layout-popover)`]: {
42
+ marginBottom: "0 !important",
43
+ [`${itemCls}-help`]: {
44
+ position: "absolute",
45
+ fontSize: fontSizeSM,
46
+ top: "100%",
47
+ background: colorBgBase,
48
+ width: "100%",
49
+ marginTop: 3,
50
+ padding: 3,
51
+ zIndex: 1,
52
+ borderRadius: 3,
53
+ boxShadow: `0 0 10px ${colorBorder}`,
54
+ animation: "none",
55
+ transform: "translateY(0)",
56
+ opacity: 1
57
+ }
58
+ }
59
+ },
60
+ table: {
61
+ overflow: "hidden"
62
+ }
63
+ },
64
+ [`${componentCls}-sort-helper`]: {
65
+ background: colorBgContainer,
66
+ border: `1px solid ${colorBorder}`,
67
+ zIndex: 10
68
+ }
69
+ }
70
+ };
71
+ });
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ import { TabsProps } from 'antd';
3
+ export declare const ArrayTabs: React.FC<React.PropsWithChildren<TabsProps>>;
4
+ export default ArrayTabs;
@@ -0,0 +1,102 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
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
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+ var array_tabs_exports = {};
30
+ __export(array_tabs_exports, {
31
+ ArrayTabs: () => ArrayTabs,
32
+ default: () => array_tabs_default
33
+ });
34
+ module.exports = __toCommonJS(array_tabs_exports);
35
+ var import_react = __toESM(require("react"));
36
+ var import_schema = require("@tachybase/schema");
37
+ var import_antd = require("antd");
38
+ const FeedbackBadge = (0, import_schema.observer)((props) => {
39
+ const field = (0, import_schema.useField)();
40
+ const tab = `${field.title || "Untitled"} ${props.index + 1}`;
41
+ const errors = field.errors.filter((error) => {
42
+ var _a;
43
+ return (_a = error.address) == null ? void 0 : _a.includes(`${field.address}.${props.index}`);
44
+ });
45
+ if (errors.length) {
46
+ return /* @__PURE__ */ import_react.default.createElement(import_antd.Badge, { size: "small", className: "errors-badge", count: errors.length }, tab);
47
+ }
48
+ return /* @__PURE__ */ import_react.default.createElement(import_react.Fragment, null, tab);
49
+ });
50
+ const ArrayTabs = (0, import_schema.observer)((props) => {
51
+ const field = (0, import_schema.useField)();
52
+ const schema = (0, import_schema.useFieldSchema)();
53
+ const [activeKey, setActiveKey] = (0, import_react.useState)("tab-0");
54
+ const value = Array.isArray(field.value) ? field.value : [];
55
+ const dataSource = (value == null ? void 0 : value.length) ? value : [{}];
56
+ const onEdit = /* @__PURE__ */ __name((targetKey, type) => {
57
+ var _a, _b;
58
+ if (type === "add") {
59
+ const id = dataSource.length;
60
+ if ((_a = field == null ? void 0 : field.value) == null ? void 0 : _a.length) {
61
+ field.push(null);
62
+ } else {
63
+ field.push(null, null);
64
+ }
65
+ setActiveKey(`tab-${id}`);
66
+ } else if (type === "remove") {
67
+ const index = Number((_b = targetKey.match(/-(\d+)/)) == null ? void 0 : _b[1]);
68
+ if (index - 1 > -1) {
69
+ setActiveKey(`tab-${index - 1}`);
70
+ }
71
+ field.remove(index);
72
+ }
73
+ }, "onEdit");
74
+ return /* @__PURE__ */ import_react.default.createElement(
75
+ import_antd.Tabs,
76
+ {
77
+ ...props,
78
+ activeKey,
79
+ onChange: (key) => {
80
+ setActiveKey(key);
81
+ },
82
+ type: "editable-card",
83
+ onEdit,
84
+ items: dataSource == null ? void 0 : dataSource.map((item, index) => {
85
+ const items = Array.isArray(schema.items) ? schema.items[index] : schema.items;
86
+ const key = `tab-${index}`;
87
+ return {
88
+ key,
89
+ label: /* @__PURE__ */ import_react.default.createElement(FeedbackBadge, { index }),
90
+ forceRender: true,
91
+ closable: index !== 0,
92
+ children: items ? /* @__PURE__ */ import_react.default.createElement(import_schema.RecursionField, { schema: items, name: index }) : null
93
+ };
94
+ })
95
+ }
96
+ );
97
+ });
98
+ var array_tabs_default = ArrayTabs;
99
+ // Annotate the CommonJS export names for ESM import in node:
100
+ 0 && (module.exports = {
101
+ ArrayTabs
102
+ });
@@ -0,0 +1,12 @@
1
+ import React from 'react';
2
+ export type { BaseOptionType, DefaultOptionType, FieldNames } from 'rc-cascader';
3
+ export declare const Cascader: React.ForwardRefExoticComponent<(Omit<Partial<import("antd").CascaderProps<import("antd/es/cascader").DefaultOptionType, string, boolean> & {
4
+ multiple?: false;
5
+ } & {
6
+ children?: React.ReactNode | undefined;
7
+ } & React.RefAttributes<import("antd/es/cascader").CascaderRef>>, "ref"> | Omit<Partial<import("antd").CascaderProps<import("antd/es/cascader").DefaultOptionType, string, true> & {
8
+ multiple: true;
9
+ } & {
10
+ children?: React.ReactNode | undefined;
11
+ } & React.RefAttributes<import("antd/es/cascader").CascaderRef>>, "ref">) & React.RefAttributes<unknown>>;
12
+ export default Cascader;
@@ -0,0 +1,58 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
24
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
+ mod
26
+ ));
27
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
+ var cascader_exports = {};
29
+ __export(cascader_exports, {
30
+ Cascader: () => Cascader,
31
+ default: () => cascader_default
32
+ });
33
+ module.exports = __toCommonJS(cascader_exports);
34
+ var import_react = __toESM(require("react"));
35
+ var import_schema = require("@tachybase/schema");
36
+ var import_icons = require("@ant-design/icons");
37
+ var import_antd = require("antd");
38
+ var import_preview_text = require("../preview-text");
39
+ const Cascader = (0, import_schema.connect)(
40
+ import_antd.Cascader,
41
+ (0, import_schema.mapProps)(
42
+ {
43
+ dataSource: "options"
44
+ },
45
+ (props, field) => {
46
+ return {
47
+ ...props,
48
+ suffixIcon: (field == null ? void 0 : field["loading"]) || (field == null ? void 0 : field["validating"]) ? /* @__PURE__ */ import_react.default.createElement(import_icons.LoadingOutlined, null) : props.suffixIcon
49
+ };
50
+ }
51
+ ),
52
+ (0, import_schema.mapReadPretty)(import_preview_text.PreviewText.Cascader)
53
+ );
54
+ var cascader_default = Cascader;
55
+ // Annotate the CommonJS export names for ESM import in node:
56
+ 0 && (module.exports = {
57
+ Cascader
58
+ });
@@ -0,0 +1,5 @@
1
+ export declare const Checkbox: import("react").ForwardRefExoticComponent<Omit<Partial<import("antd").CheckboxProps & import("react").RefAttributes<import("antd").CheckboxRef>>, "ref"> & import("react").RefAttributes<unknown>> & {
2
+ __ANT_CHECKBOX: boolean;
3
+ Group: import("react").ForwardRefExoticComponent<Omit<Partial<import("antd/es/checkbox").CheckboxGroupProps<unknown> & import("react").RefAttributes<HTMLDivElement>>, "ref"> & import("react").RefAttributes<unknown>>;
4
+ };
5
+ export default Checkbox;