@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,339 @@
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 select_table_exports = {};
30
+ __export(select_table_exports, {
31
+ SelectTable: () => SelectTable,
32
+ default: () => select_table_default
33
+ });
34
+ module.exports = __toCommonJS(select_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_hooks = require("./hooks");
41
+ var import_style = __toESM(require("./style"));
42
+ var import_utils = require("./utils");
43
+ const { Search } = import_antd.Input;
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 useSources = /* @__PURE__ */ __name(() => {
49
+ const arrayField = (0, import_schema.useField)();
50
+ const schema = (0, import_schema.useFieldSchema)();
51
+ const parseSources = /* @__PURE__ */ __name((schema2) => {
52
+ var _a, _b, _c;
53
+ if (isColumnComponent(schema2)) {
54
+ if (!((_a = schema2["x-component-props"]) == null ? void 0 : _a["dataIndex"]) && !schema2["name"]) return [];
55
+ const name = ((_b = schema2["x-component-props"]) == null ? void 0 : _b["dataIndex"]) || schema2["name"];
56
+ const field = arrayField.query(arrayField.address.concat(name)).take();
57
+ const columnProps = ((_c = field == null ? void 0 : field.component) == null ? void 0 : _c[1]) || schema2["x-component-props"] || {};
58
+ const display = (field == null ? void 0 : field.display) || schema2["x-display"];
59
+ return [
60
+ {
61
+ name,
62
+ display,
63
+ field,
64
+ schema: schema2,
65
+ columnProps: {
66
+ title: (field == null ? void 0 : field.title) || columnProps.title,
67
+ ...columnProps
68
+ }
69
+ }
70
+ ];
71
+ } else if (schema2.properties) {
72
+ return schema2.reduceProperties((buf, schema3) => {
73
+ return buf.concat(parseSources(schema3));
74
+ }, []);
75
+ }
76
+ return [];
77
+ }, "parseSources");
78
+ const parseArrayItems = /* @__PURE__ */ __name((schema2) => {
79
+ if (!schema2) return [];
80
+ const sources = [];
81
+ const items = (0, import_schema.isArr)(schema2) ? schema2 : [schema2];
82
+ return items.reduce((columns, schema3) => {
83
+ const item = parseSources(schema3);
84
+ if (item) {
85
+ return columns.concat(item);
86
+ }
87
+ return columns;
88
+ }, sources);
89
+ }, "parseArrayItems");
90
+ const validSchema = (schema == null ? void 0 : schema.type) === "array" && (schema == null ? void 0 : schema.items) ? schema.items : schema;
91
+ return parseArrayItems(validSchema);
92
+ }, "useSources");
93
+ const useColumns = /* @__PURE__ */ __name((sources) => {
94
+ return sources.reduce((buf, { name, columnProps, schema, display }, key) => {
95
+ if (display !== "visible") return buf;
96
+ if (!isColumnComponent(schema)) return buf;
97
+ return buf.concat({
98
+ ...columnProps,
99
+ key,
100
+ dataIndex: name
101
+ });
102
+ }, []);
103
+ }, "useColumns");
104
+ const addPrimaryKey = /* @__PURE__ */ __name((dataSource, rowKey, primaryKey) => dataSource.map((item) => {
105
+ const children = (0, import_schema.isArr)(item.children) ? addPrimaryKey(item.children, rowKey, primaryKey) : {};
106
+ return {
107
+ ...item,
108
+ ...children,
109
+ [primaryKey]: rowKey(item)
110
+ };
111
+ }), "addPrimaryKey");
112
+ const InternalSelectTable = (0, import_schema.observer)((props) => {
113
+ var _a, _b;
114
+ const {
115
+ mode,
116
+ dataSource: propsDataSource,
117
+ optionAsValue,
118
+ valueType,
119
+ showSearch,
120
+ filterOption,
121
+ filterSort,
122
+ onSearch,
123
+ searchProps,
124
+ className,
125
+ value,
126
+ onChange,
127
+ rowSelection,
128
+ primaryKey: rowKey,
129
+ ...otherTableProps
130
+ } = props;
131
+ const prefixCls = (0, import_builtins.usePrefixCls)("formily-select-table", props);
132
+ const [wrapSSR, hashId] = (0, import_style.default)(prefixCls);
133
+ const [searchValue, setSearchValue] = (0, import_react.useState)();
134
+ const field = (0, import_schema.useField)();
135
+ const loading = (0, import_schema.isBool)(props.loading) ? props.loading : field.loading;
136
+ const disabled = field.disabled;
137
+ const readOnly = field.readOnly;
138
+ const readPretty = field.readPretty;
139
+ const { searchSize, tableSize } = (0, import_hooks.useSize)((_a = field.decoratorProps) == null ? void 0 : _a.size, searchProps == null ? void 0 : searchProps.size, props == null ? void 0 : props.size);
140
+ const primaryKey = (0, import_schema.isFn)(rowKey) ? "__formily_key__" : rowKey;
141
+ const sources = useSources();
142
+ const columns = useColumns(sources);
143
+ let dataSource = (0, import_schema.isArr)(propsDataSource) ? propsDataSource : field.dataSource;
144
+ dataSource = (0, import_schema.isFn)(rowKey) ? addPrimaryKey(dataSource, rowKey, primaryKey) : dataSource;
145
+ const filteredDataSource = (0, import_hooks.useFilterOptions)(dataSource, searchValue, filterOption, rowSelection == null ? void 0 : rowSelection.checkStrictly);
146
+ const orderedFilteredDataSource = (0, import_react.useMemo)(() => {
147
+ if (!filterSort) {
148
+ return filteredDataSource;
149
+ }
150
+ return [...filteredDataSource].sort((a, b) => filterSort(a, b));
151
+ }, [filteredDataSource, filterSort]);
152
+ const flatDataSource = (0, import_hooks.useFlatOptions)(dataSource);
153
+ const flatFilteredDataSource = (0, import_hooks.useFlatOptions)(filteredDataSource);
154
+ const getWholeDataSource = /* @__PURE__ */ __name(() => {
155
+ if (optionAsValue && mode === "multiple" && (value == null ? void 0 : value.length)) {
156
+ const map = /* @__PURE__ */ new Map();
157
+ const arr = [...flatDataSource, ...value];
158
+ arr.forEach((item) => {
159
+ if (!primaryKey) return;
160
+ if (!map.has(item[primaryKey])) {
161
+ map.set(item[primaryKey], item);
162
+ }
163
+ });
164
+ return [...map.values()];
165
+ }
166
+ return flatDataSource;
167
+ }, "getWholeDataSource");
168
+ const selected = (0, import_utils.getUISelected)(
169
+ value,
170
+ flatDataSource,
171
+ primaryKey,
172
+ valueType,
173
+ optionAsValue,
174
+ mode,
175
+ rowSelection == null ? void 0 : rowSelection.checkStrictly,
176
+ rowKey
177
+ );
178
+ const readPrettyDataSource = (0, import_hooks.useFilterOptions)(
179
+ orderedFilteredDataSource,
180
+ selected,
181
+ (value2, item) => primaryKey && value2.includes(item[primaryKey])
182
+ );
183
+ const onInnerSearch = /* @__PURE__ */ __name((searchText) => {
184
+ const formatted = (searchText || "").trim();
185
+ setSearchValue(searchText);
186
+ onSearch == null ? void 0 : onSearch(formatted);
187
+ }, "onInnerSearch");
188
+ const onInnerChange = /* @__PURE__ */ __name((selectedRowKeys) => {
189
+ if (readOnly) {
190
+ return;
191
+ }
192
+ const wholeRecords = getWholeDataSource().filter(
193
+ (item) => primaryKey && selectedRowKeys.includes(item == null ? void 0 : item[primaryKey])
194
+ );
195
+ const { outputValue, outputOptions } = (0, import_utils.getOutputData)(
196
+ selectedRowKeys,
197
+ wholeRecords,
198
+ dataSource,
199
+ primaryKey,
200
+ valueType,
201
+ optionAsValue,
202
+ mode,
203
+ rowSelection == null ? void 0 : rowSelection.checkStrictly
204
+ );
205
+ onChange == null ? void 0 : onChange(outputValue, outputOptions);
206
+ }, "onInnerChange");
207
+ const onRowClick = /* @__PURE__ */ __name((record) => {
208
+ if (readPretty || disabled || readOnly || (record == null ? void 0 : record.disabled)) {
209
+ return;
210
+ }
211
+ const selectedRowKey = primaryKey ? record == null ? void 0 : record[primaryKey] : null;
212
+ const isSelected = selectedRowKey ? selected == null ? void 0 : selected.includes(selectedRowKey) : false;
213
+ let selectedRowKeys = [];
214
+ if (mode === "single" && selectedRowKey) {
215
+ selectedRowKeys = [selectedRowKey];
216
+ } else {
217
+ if (isSelected) {
218
+ selectedRowKeys = selected.filter((item) => item !== selectedRowKey);
219
+ } else {
220
+ selectedRowKeys = [...selected, selectedRowKey];
221
+ }
222
+ }
223
+ if ((rowSelection == null ? void 0 : rowSelection.checkStrictly) !== false) {
224
+ onInnerChange(selectedRowKeys);
225
+ } else {
226
+ onSlacklyChange(selectedRowKeys);
227
+ }
228
+ }, "onRowClick");
229
+ const onSlacklyChange = /* @__PURE__ */ __name((currentSelected) => {
230
+ const { selectedRowKeys } = (0, import_hooks.useCheckSlackly)(
231
+ currentSelected,
232
+ selected,
233
+ flatDataSource,
234
+ flatFilteredDataSource,
235
+ primaryKey,
236
+ rowSelection == null ? void 0 : rowSelection.checkStrictly
237
+ );
238
+ onInnerChange(selectedRowKeys);
239
+ }, "onSlacklyChange");
240
+ const titleAddon = (0, import_hooks.useTitleAddon)(
241
+ selected,
242
+ flatDataSource,
243
+ flatFilteredDataSource,
244
+ primaryKey,
245
+ mode,
246
+ disabled,
247
+ readOnly,
248
+ rowSelection == null ? void 0 : rowSelection.checkStrictly,
249
+ onInnerChange
250
+ );
251
+ const modeAsType = (_b = { multiple: "checkbox", single: "radio" }) == null ? void 0 : _b[mode || ""];
252
+ return wrapSSR(
253
+ /* @__PURE__ */ import_react.default.createElement("div", { className: (0, import_classnames.default)(prefixCls, hashId) }, showSearch ? /* @__PURE__ */ import_react.default.createElement(
254
+ Search,
255
+ {
256
+ ...searchProps,
257
+ className: (0, import_classnames.default)(`${prefixCls}-search`, searchProps == null ? void 0 : searchProps.className),
258
+ style: { width: "100%", ...searchProps == null ? void 0 : searchProps.style },
259
+ onSearch: onInnerSearch,
260
+ onChange: (e) => onInnerSearch(e.target.value),
261
+ disabled,
262
+ readOnly,
263
+ size: searchSize,
264
+ loading
265
+ }
266
+ ) : null, /* @__PURE__ */ import_react.default.createElement(
267
+ import_antd.Table,
268
+ {
269
+ ...otherTableProps,
270
+ className: (0, import_classnames.default)(`${prefixCls}-table`, className),
271
+ dataSource: readPretty ? readPrettyDataSource : orderedFilteredDataSource,
272
+ rowSelection: readPretty ? void 0 : {
273
+ ...rowSelection,
274
+ ...titleAddon,
275
+ getCheckboxProps: /* @__PURE__ */ __name((record) => {
276
+ var _a2;
277
+ return {
278
+ ...(_a2 = rowSelection == null ? void 0 : rowSelection.getCheckboxProps) == null ? void 0 : _a2.call(rowSelection, record),
279
+ disabled: disabled || (record == null ? void 0 : record.disabled)
280
+ };
281
+ }, "getCheckboxProps"),
282
+ // antd
283
+ ...(rowSelection == null ? void 0 : rowSelection.checkStrictly) !== false ? {} : {
284
+ renderCell: /* @__PURE__ */ __name((checked, record, index, originNode) => {
285
+ return import_react.default.cloneElement(originNode, {
286
+ indeterminate: (0, import_hooks.getIndeterminate)(record, flatDataSource, selected, primaryKey)
287
+ });
288
+ }, "renderCell")
289
+ },
290
+ selectedRowKeys: selected,
291
+ onChange: (rowSelection == null ? void 0 : rowSelection.checkStrictly) !== false ? onInnerChange : onSlacklyChange,
292
+ type: modeAsType,
293
+ preserveSelectedRowKeys: true,
294
+ checkStrictly: true
295
+ },
296
+ columns: props.columns || columns,
297
+ rowKey: primaryKey,
298
+ loading,
299
+ size: tableSize,
300
+ onRow: (record) => {
301
+ var _a2;
302
+ const onRowResult = (_a2 = otherTableProps.onRow) == null ? void 0 : _a2.call(otherTableProps, record);
303
+ return {
304
+ ...onRowResult,
305
+ onClick: /* @__PURE__ */ __name((e) => {
306
+ var _a3;
307
+ (_a3 = onRowResult == null ? void 0 : onRowResult.onClick) == null ? void 0 : _a3.call(onRowResult, e);
308
+ onRowClick(record);
309
+ }, "onClick")
310
+ };
311
+ }
312
+ },
313
+ ""
314
+ ), sources.map((column, key) => {
315
+ if (!isColumnComponent(column.schema)) return;
316
+ return import_react.default.createElement(import_schema.RecursionField, {
317
+ name: column.name,
318
+ schema: column.schema,
319
+ onlyRenderSelf: true,
320
+ key
321
+ });
322
+ }))
323
+ );
324
+ });
325
+ const TableColumn = /* @__PURE__ */ __name(() => /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null), "TableColumn");
326
+ const SelectTable = Object.assign(InternalSelectTable, {
327
+ Column: TableColumn
328
+ });
329
+ SelectTable.defaultProps = {
330
+ showSearch: false,
331
+ valueType: "all",
332
+ primaryKey: "key",
333
+ mode: "multiple"
334
+ };
335
+ var select_table_default = SelectTable;
336
+ // Annotate the CommonJS export names for ESM import in node:
337
+ 0 && (module.exports = {
338
+ SelectTable
339
+ });
@@ -0,0 +1,2 @@
1
+ declare const _default: (prefixCls: string) => import("..").UseComponentStyleResult;
2
+ export default _default;
@@ -0,0 +1,33 @@
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)("select-table", (token) => {
25
+ const { componentCls } = token;
26
+ return {
27
+ [componentCls]: {
28
+ [`${componentCls}-search`]: {
29
+ marginBottom: 8
30
+ }
31
+ }
32
+ };
33
+ });
@@ -0,0 +1,78 @@
1
+ /**
2
+ * 获取树列表某个键值的集合
3
+ * @param tree 树列表
4
+ * @param primaryKey 键名称
5
+ * @returns 键值数组集合
6
+ */
7
+ declare const getTreeKeys: (tree: any[], primaryKey?: string) => any;
8
+ /**
9
+ * 判断树列表中是否有任一 key 被选中
10
+ * @param tree 树列表
11
+ * @param selected 已选中的 keys
12
+ * @param primaryKey 键名
13
+ * @returns
14
+ */
15
+ declare const hasSelectedKey: (tree: any[], selected: any[], primaryKey: string) => boolean;
16
+ /**
17
+ * 判断列表项是否全部被选中
18
+ * @param list 一阶列表
19
+ * @param selected 当前选中的字段值集合
20
+ * @param primaryKey 键名称
21
+ * @returns 是否全部被选中
22
+ */
23
+ declare const isAllSelected: (list: any[], selected: any[], primaryKey?: string) => boolean;
24
+ /**
25
+ * 完善TableUI Keys(添加选中所有子元素的父元素,或移除未选中所有子元素的父元素)
26
+ * @param flatDataSource 完整数据平铺列表
27
+ * @param selected 当前选中的字段值集合
28
+ * @param primaryKey 键名称
29
+ * @returns 完整的字段值集合
30
+ */
31
+ declare const completedKeys: (flatDataSource: any[], selected: any[], primaryKey?: string) => any[];
32
+ /**
33
+ * 删除树列表的某个 key/value 键值对
34
+ * @param tree
35
+ * @param key
36
+ * @returns
37
+ */
38
+ declare const deleteTreeItem: (tree: any[], key: string) => any[];
39
+ /**
40
+ * 根据 valueType 获取最终输出值
41
+ * @param keys 当前选中的 key 集合(all完整类型)
42
+ * @param records 当前选中的 option 集合
43
+ * @param dataSource 数据源集合
44
+ * @param primaryKey 键名
45
+ * @param originalValueType 值输出类型
46
+ * @param originalOptionAsValue
47
+ * @param mode
48
+ * @param checkStrictly
49
+ * @returns 最终输出的 keys 和 options
50
+ */
51
+ declare const getOutputData: (keys: any[], options: any[], dataSource: any[] | undefined, primaryKey: string, originalValueType: string, originalOptionAsValue: boolean, mode: string, checkStrictly: boolean | undefined) => {
52
+ outputValue: any[];
53
+ outputOptions: any[];
54
+ };
55
+ /**
56
+ * 根据 valueType 获取 TableUI 显示值
57
+ * @param keys 回填的数据(输出的)keys 集合
58
+ * @param flatDataSource 平铺的数据源集合
59
+ * @param primaryKey 键名称
60
+ * @param originalValueType 值输出类型
61
+ * @param originalOptionAsValue
62
+ * @param mode
63
+ * @param checkStrictly
64
+ * @param rowKey
65
+ * @returns [] TableUI keys 集合
66
+ */
67
+ declare const getUISelected: (value: any, flatDataSource: any[] | undefined, primaryKey: string | undefined, originalValueType: string | undefined, originalOptionAsValue: boolean | undefined, mode: string | undefined, checkStrictly: boolean | undefined, rowKey: string | ((record: any) => string) | undefined) => string[];
68
+ /**
69
+ * 获取兼容筛选模式下是否全部选中子元素
70
+ * @param selected 已选中项
71
+ * @param dataSource 当前数据结构
72
+ * @param usableKeys 当前数据结构的可执行项
73
+ * @param checkStrictly
74
+ * @param primaryKey
75
+ * @returns 是否全部选中
76
+ */
77
+ declare const getCompatibleAllSelected: (selected: any[], dataSource: any[] | undefined, usableKeys: string | any[], checkStrictly: boolean | undefined, primaryKey: string) => boolean;
78
+ export { hasSelectedKey, getTreeKeys, deleteTreeItem, isAllSelected, getUISelected, getOutputData, completedKeys, getCompatibleAllSelected, };
@@ -0,0 +1,166 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var utils_exports = {};
20
+ __export(utils_exports, {
21
+ completedKeys: () => completedKeys,
22
+ deleteTreeItem: () => deleteTreeItem,
23
+ getCompatibleAllSelected: () => getCompatibleAllSelected,
24
+ getOutputData: () => getOutputData,
25
+ getTreeKeys: () => getTreeKeys,
26
+ getUISelected: () => getUISelected,
27
+ hasSelectedKey: () => hasSelectedKey,
28
+ isAllSelected: () => isAllSelected
29
+ });
30
+ module.exports = __toCommonJS(utils_exports);
31
+ var import_schema = require("@tachybase/schema");
32
+ var import_useFlatOptions = require("./hooks/useFlatOptions");
33
+ const getTreeKeys = /* @__PURE__ */ __name((tree, primaryKey = "") => (0, import_schema.isArr)(tree) ? tree.reduce((prev, current) => {
34
+ if (current == null ? void 0 : current.disabled) {
35
+ return prev;
36
+ }
37
+ return [...prev, current[primaryKey], ...getTreeKeys(current == null ? void 0 : current.children, primaryKey)];
38
+ }, []) : [], "getTreeKeys");
39
+ const hasSelectedKey = /* @__PURE__ */ __name((tree, selected, primaryKey) => {
40
+ const keys = getTreeKeys(tree, primaryKey);
41
+ const mergedKeys = [...keys, ...selected];
42
+ const validKeys = [...new Set(mergedKeys)];
43
+ return validKeys.length !== mergedKeys.length;
44
+ }, "hasSelectedKey");
45
+ const isAllSelected = /* @__PURE__ */ __name((list, selected, primaryKey = "") => {
46
+ const validList = list.filter((item) => !(item == null ? void 0 : item.disabled));
47
+ const selectedList = validList.filter((item) => selected == null ? void 0 : selected.includes(item[primaryKey]));
48
+ return selectedList.length === validList.length;
49
+ }, "isAllSelected");
50
+ const completedKeys = /* @__PURE__ */ __name((flatDataSource = [], selected, primaryKey = "") => {
51
+ let allSelectedKeys = [...selected];
52
+ flatDataSource.forEach((item) => {
53
+ var _a;
54
+ if ((_a = item.children) == null ? void 0 : _a.length) {
55
+ allSelectedKeys = completedKeys(item.children, allSelectedKeys, primaryKey);
56
+ if (isAllSelected(item.children, allSelectedKeys, primaryKey)) {
57
+ if (!(item == null ? void 0 : item.disabled)) {
58
+ allSelectedKeys = [.../* @__PURE__ */ new Set([...allSelectedKeys, item[primaryKey]])];
59
+ }
60
+ } else {
61
+ allSelectedKeys = allSelectedKeys.filter((key) => key !== item[primaryKey]);
62
+ }
63
+ }
64
+ });
65
+ return allSelectedKeys;
66
+ }, "completedKeys");
67
+ const getSelectedPath = /* @__PURE__ */ __name((tree = [], selected, primaryKey) => {
68
+ const pathData = [];
69
+ tree.forEach((item) => {
70
+ const validChildren = getSelectedPath(item.children, selected, primaryKey);
71
+ if (validChildren.length || (selected == null ? void 0 : selected.includes(item[primaryKey]))) {
72
+ pathData.push({
73
+ ...item,
74
+ ...validChildren.length ? { children: validChildren } : {}
75
+ });
76
+ }
77
+ });
78
+ return pathData;
79
+ }, "getSelectedPath");
80
+ const deleteTreeItem = /* @__PURE__ */ __name((tree, key) => tree.map((item) => {
81
+ var _a;
82
+ const validItem = { ...item };
83
+ delete validItem[key];
84
+ if ((_a = validItem.children) == null ? void 0 : _a.length) {
85
+ validItem.children = deleteTreeItem(validItem.children, key);
86
+ }
87
+ return validItem;
88
+ }), "deleteTreeItem");
89
+ const getOutputData = /* @__PURE__ */ __name((keys, options, dataSource, primaryKey = "", originalValueType = "", originalOptionAsValue = false, mode = "", checkStrictly) => {
90
+ const valueType = checkStrictly !== false ? "all" : originalValueType;
91
+ const optionAsValue = valueType === "path" ? false : originalOptionAsValue;
92
+ let outputValue = [];
93
+ let outputOptions = [];
94
+ if (valueType === "parent") {
95
+ let childrenKeys = [];
96
+ options.forEach((option) => {
97
+ childrenKeys = [...childrenKeys, ...getTreeKeys(option.children, primaryKey)];
98
+ });
99
+ outputValue = keys.filter((key) => !childrenKeys.includes(key));
100
+ outputOptions = options.filter((options2) => outputValue.includes(options2[primaryKey]));
101
+ } else if (valueType === "child") {
102
+ outputValue = [...keys];
103
+ outputOptions = [...options];
104
+ outputOptions.forEach((option) => {
105
+ if (hasSelectedKey(option.children, keys, primaryKey)) {
106
+ outputValue = outputValue.filter((key) => key !== option[primaryKey]);
107
+ outputOptions = outputOptions.filter((options2) => options2[primaryKey] !== option[primaryKey]);
108
+ }
109
+ });
110
+ } else if (valueType === "path") {
111
+ outputValue = getSelectedPath(dataSource, keys, primaryKey);
112
+ outputOptions = [...options];
113
+ } else {
114
+ outputValue = [...keys];
115
+ outputOptions = [...options];
116
+ }
117
+ outputOptions = deleteTreeItem(outputOptions, "__formily_key__");
118
+ outputValue = optionAsValue && valueType !== "path" ? outputOptions : outputValue;
119
+ if (mode === "single") {
120
+ outputValue = outputValue[0];
121
+ outputOptions = outputOptions[0];
122
+ }
123
+ return { outputValue, outputOptions };
124
+ }, "getOutputData");
125
+ const getUISelected = /* @__PURE__ */ __name((value, flatDataSource, primaryKey, originalValueType, originalOptionAsValue, mode, checkStrictly, rowKey) => {
126
+ const valueType = checkStrictly !== false ? "all" : originalValueType;
127
+ const optionAsValue = valueType === "path" ? false : originalOptionAsValue;
128
+ let keys = mode === "single" ? [value] : (0, import_schema.isArr)(value) ? value : [];
129
+ keys = optionAsValue && valueType !== "path" ? keys.map((record) => (0, import_schema.isFn)(rowKey) ? rowKey(record) : record == null ? void 0 : record[primaryKey || ""]) : keys;
130
+ let newKeys = [];
131
+ if (valueType === "parent") {
132
+ const options = flatDataSource == null ? void 0 : flatDataSource.filter((item) => keys.includes(item[primaryKey || ""]));
133
+ let childrenKeys = [];
134
+ options == null ? void 0 : options.forEach((option) => {
135
+ childrenKeys = [...childrenKeys, ...getTreeKeys(option.children, primaryKey)];
136
+ });
137
+ newKeys = [.../* @__PURE__ */ new Set([...keys, ...childrenKeys])];
138
+ } else if (valueType === "child") {
139
+ newKeys = completedKeys(flatDataSource, keys, primaryKey);
140
+ } else if (valueType === "path") {
141
+ const pathKeys = (0, import_useFlatOptions.getFlatOptions)(keys).map((item) => item[primaryKey || ""]);
142
+ newKeys = completedKeys(flatDataSource, pathKeys, primaryKey);
143
+ } else {
144
+ newKeys = [...keys];
145
+ }
146
+ return newKeys;
147
+ }, "getUISelected");
148
+ const getCompatibleAllSelected = /* @__PURE__ */ __name((selected, dataSource, usableKeys, checkStrictly, primaryKey) => {
149
+ if (!usableKeys.length) {
150
+ return false;
151
+ }
152
+ const currentSelected = selected.filter((item) => usableKeys.includes(item));
153
+ const validSelected = checkStrictly !== false ? currentSelected : completedKeys(dataSource, currentSelected, primaryKey);
154
+ return validSelected.length === usableKeys.length;
155
+ }, "getCompatibleAllSelected");
156
+ // Annotate the CommonJS export names for ESM import in node:
157
+ 0 && (module.exports = {
158
+ completedKeys,
159
+ deleteTreeItem,
160
+ getCompatibleAllSelected,
161
+ getOutputData,
162
+ getTreeKeys,
163
+ getUISelected,
164
+ hasSelectedKey,
165
+ isAllSelected
166
+ });
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ import { SpaceProps } from 'antd';
3
+ export declare const Space: React.FC<React.PropsWithChildren<SpaceProps>>;
4
+ export default Space;
@@ -0,0 +1,49 @@
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 space_exports = {};
30
+ __export(space_exports, {
31
+ Space: () => Space,
32
+ default: () => space_default
33
+ });
34
+ module.exports = __toCommonJS(space_exports);
35
+ var import_react = __toESM(require("react"));
36
+ var import_antd = require("antd");
37
+ var import_form_layout = require("../form-layout");
38
+ const Space = /* @__PURE__ */ __name((props) => {
39
+ const layout = (0, import_form_layout.useFormLayout)();
40
+ return import_react.default.createElement(import_antd.Space, {
41
+ size: props.size ?? (layout == null ? void 0 : layout.spaceGap),
42
+ ...props
43
+ });
44
+ }, "Space");
45
+ var space_default = Space;
46
+ // Annotate the CommonJS export names for ESM import in node:
47
+ 0 && (module.exports = {
48
+ Space
49
+ });