@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,345 @@
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_base_exports = {};
30
+ __export(array_base_exports, {
31
+ ArrayBase: () => ArrayBase,
32
+ default: () => array_base_default
33
+ });
34
+ module.exports = __toCommonJS(array_base_exports);
35
+ var import_react = __toESM(require("react"));
36
+ var import_schema = require("@tachybase/schema");
37
+ var import_icons = require("@ant-design/icons");
38
+ var import_antd = require("antd");
39
+ var import_classnames = __toESM(require("classnames"));
40
+ var import_builtins = require("../__builtins__");
41
+ var import_style = __toESM(require("./style"));
42
+ const ArrayBaseContext = (0, import_react.createContext)(null);
43
+ const ItemContext = (0, import_react.createContext)(null);
44
+ const takeRecord = /* @__PURE__ */ __name((val, index) => typeof val === "function" ? val(index) : val, "takeRecord");
45
+ const useArray = /* @__PURE__ */ __name(() => {
46
+ return (0, import_react.useContext)(ArrayBaseContext);
47
+ }, "useArray");
48
+ const useIndex = /* @__PURE__ */ __name((index) => {
49
+ const ctx = (0, import_react.useContext)(ItemContext);
50
+ return (ctx ? ctx.index : index) || 0;
51
+ }, "useIndex");
52
+ const useRecord = /* @__PURE__ */ __name((record) => {
53
+ const ctx = (0, import_react.useContext)(ItemContext);
54
+ return takeRecord(ctx ? ctx.record : record, ctx == null ? void 0 : ctx.index);
55
+ }, "useRecord");
56
+ const getSchemaDefaultValue = /* @__PURE__ */ __name((schema) => {
57
+ if ((schema == null ? void 0 : schema.type) === "array") return [];
58
+ if ((schema == null ? void 0 : schema.type) === "object") return {};
59
+ if ((schema == null ? void 0 : schema.type) === "void") {
60
+ for (const key in schema.properties) {
61
+ const value = getSchemaDefaultValue(schema.properties[key]);
62
+ if ((0, import_schema.isValid)(value)) return value;
63
+ }
64
+ }
65
+ }, "getSchemaDefaultValue");
66
+ const getDefaultValue = /* @__PURE__ */ __name((defaultValue, schema) => {
67
+ if ((0, import_schema.isValid)(defaultValue)) return (0, import_schema.clone)(defaultValue);
68
+ if (Array.isArray(schema == null ? void 0 : schema.items)) return getSchemaDefaultValue(schema == null ? void 0 : schema.items[0]);
69
+ return getSchemaDefaultValue(schema == null ? void 0 : schema.items);
70
+ }, "getDefaultValue");
71
+ const InternalArrayBase = /* @__PURE__ */ __name((props) => {
72
+ const field = (0, import_schema.useField)();
73
+ const schema = (0, import_schema.useFieldSchema)();
74
+ return /* @__PURE__ */ import_react.default.createElement(import_schema.RecordsScope, { getRecords: () => field.value }, /* @__PURE__ */ import_react.default.createElement(ArrayBaseContext.Provider, { value: { field, schema, props } }, props.children));
75
+ }, "InternalArrayBase");
76
+ const Item = /* @__PURE__ */ __name(({ children, ...props }) => {
77
+ return /* @__PURE__ */ import_react.default.createElement(ItemContext.Provider, { value: props }, /* @__PURE__ */ import_react.default.createElement(import_schema.RecordScope, { getIndex: () => props.index, getRecord: () => takeRecord(props.record, props.index) }, children));
78
+ }, "Item");
79
+ const InternalSortHandle = (0, import_builtins.SortableHandle)((props) => {
80
+ const prefixCls = (0, import_builtins.usePrefixCls)("formily-array-base");
81
+ const [wrapSSR, hashId] = (0, import_style.default)(prefixCls);
82
+ return wrapSSR(
83
+ /* @__PURE__ */ import_react.default.createElement(
84
+ import_icons.MenuOutlined,
85
+ {
86
+ ...props,
87
+ className: (0, import_classnames.default)(`${prefixCls}-sort-handle`, hashId, props.className),
88
+ style: { ...props.style }
89
+ }
90
+ )
91
+ );
92
+ });
93
+ const SortHandle = /* @__PURE__ */ __name((props) => {
94
+ var _a;
95
+ const array = useArray();
96
+ if (!array) return null;
97
+ if (((_a = array.field) == null ? void 0 : _a.pattern) !== "editable") return null;
98
+ return /* @__PURE__ */ import_react.default.createElement(InternalSortHandle, { ...props });
99
+ }, "SortHandle");
100
+ const Index = /* @__PURE__ */ __name((props) => {
101
+ const index = useIndex();
102
+ const prefixCls = (0, import_builtins.usePrefixCls)("formily-array-base");
103
+ const [wrapSSR, hashId] = (0, import_style.default)(prefixCls);
104
+ return wrapSSR(
105
+ /* @__PURE__ */ import_react.default.createElement("span", { ...props, className: (0, import_classnames.default)(`${prefixCls}-index`, hashId) }, "#", (index || 0) + 1, ".")
106
+ );
107
+ }, "Index");
108
+ const Addition = /* @__PURE__ */ __name((props) => {
109
+ var _a, _b;
110
+ const self = (0, import_schema.useField)();
111
+ const array = useArray();
112
+ const prefixCls = (0, import_builtins.usePrefixCls)("formily-array-base");
113
+ const [wrapSSR, hashId] = (0, import_style.default)(prefixCls);
114
+ if (!array) return null;
115
+ if (((_a = array.field) == null ? void 0 : _a.pattern) !== "editable" && ((_b = array.field) == null ? void 0 : _b.pattern) !== "disabled") return null;
116
+ return wrapSSR(
117
+ /* @__PURE__ */ import_react.default.createElement(
118
+ import_antd.Button,
119
+ {
120
+ type: "dashed",
121
+ block: true,
122
+ ...props,
123
+ disabled: self == null ? void 0 : self.disabled,
124
+ className: (0, import_classnames.default)(`${prefixCls}-addition`, hashId, props.className),
125
+ onClick: (e) => {
126
+ var _a2, _b2, _c, _d, _e, _f, _g, _h, _i, _j, _k;
127
+ if ((_a2 = array.props) == null ? void 0 : _a2.disabled) return;
128
+ const defaultValue = getDefaultValue(props.defaultValue, array.schema);
129
+ if (props.method === "unshift") {
130
+ (_c = (_b2 = array.field) == null ? void 0 : _b2.unshift) == null ? void 0 : _c.call(_b2, defaultValue);
131
+ (_e = (_d = array.props) == null ? void 0 : _d.onAdd) == null ? void 0 : _e.call(_d, 0);
132
+ } else {
133
+ (_g = (_f = array.field) == null ? void 0 : _f.push) == null ? void 0 : _g.call(_f, defaultValue);
134
+ (_k = (_h = array.props) == null ? void 0 : _h.onAdd) == null ? void 0 : _k.call(_h, ((_j = (_i = array == null ? void 0 : array.field) == null ? void 0 : _i.value) == null ? void 0 : _j.length) - 1);
135
+ }
136
+ if (props.onClick) {
137
+ props.onClick(e);
138
+ }
139
+ },
140
+ icon: (0, import_schema.isUndef)(props.icon) ? /* @__PURE__ */ import_react.default.createElement(import_icons.PlusOutlined, null) : props.icon
141
+ },
142
+ props.title || self.title
143
+ )
144
+ );
145
+ }, "Addition");
146
+ const Copy = (0, import_react.forwardRef)((props, ref) => {
147
+ var _a;
148
+ const self = (0, import_schema.useField)();
149
+ const array = useArray();
150
+ const index = useIndex(props.index) || 0;
151
+ const prefixCls = (0, import_builtins.usePrefixCls)("formily-array-base");
152
+ const [wrapSSR, hashId] = (0, import_style.default)(prefixCls);
153
+ if (!array) return null;
154
+ if (((_a = array.field) == null ? void 0 : _a.pattern) !== "editable") return null;
155
+ return wrapSSR(
156
+ /* @__PURE__ */ import_react.default.createElement(
157
+ import_antd.Button,
158
+ {
159
+ ...props,
160
+ type: "text",
161
+ style: {
162
+ width: "auto",
163
+ height: "auto",
164
+ ...props.style
165
+ },
166
+ disabled: self == null ? void 0 : self.disabled,
167
+ className: (0, import_classnames.default)(`${prefixCls}-copy`, hashId, (self == null ? void 0 : self.disabled) ? `${prefixCls}-copy-disabled` : "", props.className),
168
+ ref,
169
+ onClick: (e) => {
170
+ var _a2, _b, _c, _d, _e, _f;
171
+ if (self == null ? void 0 : self.disabled) return;
172
+ e.stopPropagation();
173
+ if ((_a2 = array.props) == null ? void 0 : _a2.disabled) return;
174
+ if (props.onClick) {
175
+ props.onClick(e);
176
+ if (e.defaultPrevented) return;
177
+ }
178
+ const value = (0, import_schema.clone)((_b = array == null ? void 0 : array.field) == null ? void 0 : _b.value[index]);
179
+ const distIndex = index + 1;
180
+ (_d = (_c = array.field) == null ? void 0 : _c.insert) == null ? void 0 : _d.call(_c, distIndex, value);
181
+ (_f = (_e = array.props) == null ? void 0 : _e.onCopy) == null ? void 0 : _f.call(_e, distIndex);
182
+ },
183
+ icon: (0, import_schema.isUndef)(props.icon) ? /* @__PURE__ */ import_react.default.createElement(import_icons.CopyOutlined, null) : props.icon
184
+ },
185
+ props.title || self.title
186
+ )
187
+ );
188
+ });
189
+ const Remove = (0, import_react.forwardRef)((props, ref) => {
190
+ var _a;
191
+ const index = useIndex(props.index);
192
+ const self = (0, import_schema.useField)();
193
+ const array = useArray();
194
+ const prefixCls = (0, import_builtins.usePrefixCls)("formily-array-base");
195
+ const [wrapSSR, hashId] = (0, import_style.default)(prefixCls);
196
+ if (!array) return null;
197
+ if (((_a = array.field) == null ? void 0 : _a.pattern) !== "editable") return null;
198
+ return wrapSSR(
199
+ /* @__PURE__ */ import_react.default.createElement(
200
+ import_antd.Button,
201
+ {
202
+ type: "text",
203
+ ...props,
204
+ style: {
205
+ width: "auto",
206
+ height: "auto",
207
+ ...props.style
208
+ },
209
+ disabled: self == null ? void 0 : self.disabled,
210
+ className: (0, import_classnames.default)(
211
+ `${prefixCls}-remove`,
212
+ hashId,
213
+ (self == null ? void 0 : self.disabled) ? `${prefixCls}-remove-disabled` : "",
214
+ props.className
215
+ ),
216
+ ref,
217
+ onClick: (e) => {
218
+ var _a2, _b, _c, _d;
219
+ if (self == null ? void 0 : self.disabled) return;
220
+ e.stopPropagation();
221
+ if (props.onClick) {
222
+ props.onClick(e);
223
+ if (e.defaultPrevented) return;
224
+ }
225
+ (_b = (_a2 = array.field) == null ? void 0 : _a2.remove) == null ? void 0 : _b.call(_a2, index);
226
+ (_d = (_c = array.props) == null ? void 0 : _c.onRemove) == null ? void 0 : _d.call(_c, index);
227
+ },
228
+ icon: (0, import_schema.isUndef)(props.icon) ? /* @__PURE__ */ import_react.default.createElement(import_icons.DeleteOutlined, null) : props.icon
229
+ },
230
+ props.title || self.title
231
+ )
232
+ );
233
+ });
234
+ const MoveDown = (0, import_react.forwardRef)((props, ref) => {
235
+ var _a;
236
+ const index = useIndex(props.index);
237
+ const self = (0, import_schema.useField)();
238
+ const array = useArray();
239
+ const prefixCls = (0, import_builtins.usePrefixCls)("formily-array-base");
240
+ if (!array) return null;
241
+ if (((_a = array.field) == null ? void 0 : _a.pattern) !== "editable") return null;
242
+ return /* @__PURE__ */ import_react.default.createElement(
243
+ import_antd.Button,
244
+ {
245
+ ...props,
246
+ type: "text",
247
+ style: {
248
+ width: "auto",
249
+ height: "auto",
250
+ ...props.style
251
+ },
252
+ disabled: self == null ? void 0 : self.disabled,
253
+ className: (0, import_classnames.default)(
254
+ `${prefixCls}-move-down`,
255
+ (self == null ? void 0 : self.disabled) ? `${prefixCls}-move-down-disabled` : "",
256
+ props.className
257
+ ),
258
+ ref,
259
+ onClick: (e) => {
260
+ var _a2, _b, _c, _d;
261
+ if (self == null ? void 0 : self.disabled) return;
262
+ e.stopPropagation();
263
+ if (props.onClick) {
264
+ props.onClick(e);
265
+ if (e.defaultPrevented) return;
266
+ }
267
+ (_b = (_a2 = array.field) == null ? void 0 : _a2.moveDown) == null ? void 0 : _b.call(_a2, index);
268
+ (_d = (_c = array.props) == null ? void 0 : _c.onMoveDown) == null ? void 0 : _d.call(_c, index);
269
+ },
270
+ icon: (0, import_schema.isUndef)(props.icon) ? /* @__PURE__ */ import_react.default.createElement(import_icons.DownOutlined, null) : props.icon
271
+ },
272
+ props.title || self.title
273
+ );
274
+ });
275
+ const MoveUp = (0, import_react.forwardRef)((props, ref) => {
276
+ var _a;
277
+ const index = useIndex(props.index);
278
+ const self = (0, import_schema.useField)();
279
+ const array = useArray();
280
+ const prefixCls = (0, import_builtins.usePrefixCls)("formily-array-base");
281
+ if (!array) return null;
282
+ if (((_a = array.field) == null ? void 0 : _a.pattern) !== "editable") return null;
283
+ return /* @__PURE__ */ import_react.default.createElement(
284
+ import_antd.Button,
285
+ {
286
+ type: "text",
287
+ ...props,
288
+ style: {
289
+ width: "auto",
290
+ height: "auto",
291
+ ...props.style
292
+ },
293
+ disabled: self == null ? void 0 : self.disabled,
294
+ className: (0, import_classnames.default)(`${prefixCls}-move-up`, (self == null ? void 0 : self.disabled) ? `${prefixCls}-move-up-disabled` : "", props.className),
295
+ ref,
296
+ onClick: (e) => {
297
+ var _a2, _b, _c;
298
+ if (self == null ? void 0 : self.disabled) return;
299
+ e.stopPropagation();
300
+ if (props.onClick) {
301
+ props.onClick(e);
302
+ if (e.defaultPrevented) return;
303
+ }
304
+ (_a2 = array == null ? void 0 : array.field) == null ? void 0 : _a2.moveUp(index);
305
+ (_c = (_b = array == null ? void 0 : array.props) == null ? void 0 : _b.onMoveUp) == null ? void 0 : _c.call(_b, index);
306
+ },
307
+ icon: (0, import_schema.isUndef)(props.icon) ? /* @__PURE__ */ import_react.default.createElement(import_icons.UpOutlined, null) : props.icon
308
+ },
309
+ props.title || self.title
310
+ );
311
+ });
312
+ function mixin(target) {
313
+ return Object.assign(target, {
314
+ Index,
315
+ SortHandle,
316
+ Addition,
317
+ Copy,
318
+ Remove,
319
+ MoveDown,
320
+ MoveUp,
321
+ useArray,
322
+ useIndex,
323
+ useRecord
324
+ });
325
+ }
326
+ __name(mixin, "mixin");
327
+ const ArrayBase = Object.assign(InternalArrayBase, {
328
+ Item,
329
+ Index,
330
+ SortHandle,
331
+ Addition,
332
+ Copy,
333
+ Remove,
334
+ MoveDown,
335
+ MoveUp,
336
+ useArray,
337
+ useIndex,
338
+ useRecord,
339
+ mixin
340
+ });
341
+ var array_base_default = ArrayBase;
342
+ // Annotate the CommonJS export names for ESM import in node:
343
+ 0 && (module.exports = {
344
+ ArrayBase
345
+ });
@@ -0,0 +1,2 @@
1
+ declare const _default: (prefixCls: string) => import("..").UseComponentStyleResult;
2
+ export default _default;
@@ -0,0 +1,68 @@
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-base", (token) => {
25
+ const { componentCls, colorText, fontSizeLG, colorPrimaryText, colorTextDisabled } = token;
26
+ return {
27
+ [componentCls]: {
28
+ "&-remove, &-copy": {
29
+ transition: "all 0.25s ease-in-out",
30
+ color: colorText,
31
+ fontSize: fontSizeLG,
32
+ ":hover": {
33
+ color: colorPrimaryText
34
+ },
35
+ "&-disabled": {
36
+ color: colorTextDisabled,
37
+ cursor: "not-allowed !important",
38
+ "&:hover": {
39
+ color: colorTextDisabled
40
+ }
41
+ }
42
+ },
43
+ "&-sort-handle": {
44
+ cursor: "move",
45
+ color: "#888 !important"
46
+ },
47
+ "&-addition": {
48
+ transition: "all 0.25s ease-in-out"
49
+ },
50
+ "&-move-down, &-move-up": {
51
+ transition: "all 0.25s ease-in-out",
52
+ color: colorText,
53
+ fontSize: fontSizeLG,
54
+ marginInlineStart: 6,
55
+ ":hover": {
56
+ color: colorPrimaryText
57
+ },
58
+ "&-disabled": {
59
+ color: colorTextDisabled,
60
+ cursor: "not-allowed !important",
61
+ "&:hover": {
62
+ color: colorTextDisabled
63
+ }
64
+ }
65
+ }
66
+ }
67
+ };
68
+ });
@@ -0,0 +1,5 @@
1
+ import { ReactFC } from '@tachybase/schema';
2
+ import { CardProps } from 'antd';
3
+ export declare const InternalArrayCards: ReactFC<CardProps>;
4
+ export declare const ArrayCards: ReactFC<CardProps> & import("..").ArrayBaseMixins;
5
+ export default ArrayCards;
@@ -0,0 +1,166 @@
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_cards_exports = {};
30
+ __export(array_cards_exports, {
31
+ ArrayCards: () => ArrayCards,
32
+ InternalArrayCards: () => InternalArrayCards,
33
+ default: () => array_cards_default
34
+ });
35
+ module.exports = __toCommonJS(array_cards_exports);
36
+ var import_react = __toESM(require("react"));
37
+ var import_schema = require("@tachybase/schema");
38
+ var import_antd = require("antd");
39
+ var import_classnames = __toESM(require("classnames"));
40
+ var import_builtins = require("../__builtins__");
41
+ var import_array_base = require("../array-base");
42
+ var import_style = __toESM(require("./style"));
43
+ const isAdditionComponent = /* @__PURE__ */ __name((schema) => {
44
+ var _a;
45
+ return ((_a = schema["x-component"]) == null ? void 0 : _a.indexOf("Addition")) > -1;
46
+ }, "isAdditionComponent");
47
+ const isIndexComponent = /* @__PURE__ */ __name((schema) => {
48
+ var _a, _b;
49
+ return ((_b = (_a = schema["x-component"]) == null ? void 0 : _a.indexOf) == null ? void 0 : _b.call(_a, "Index")) > -1;
50
+ }, "isIndexComponent");
51
+ const isRemoveComponent = /* @__PURE__ */ __name((schema) => {
52
+ var _a, _b;
53
+ return ((_b = (_a = schema["x-component"]) == null ? void 0 : _a.indexOf) == null ? void 0 : _b.call(_a, "Remove")) > -1;
54
+ }, "isRemoveComponent");
55
+ const isCopyComponent = /* @__PURE__ */ __name((schema) => {
56
+ var _a, _b;
57
+ return ((_b = (_a = schema["x-component"]) == null ? void 0 : _a.indexOf) == null ? void 0 : _b.call(_a, "Copy")) > -1;
58
+ }, "isCopyComponent");
59
+ const isMoveUpComponent = /* @__PURE__ */ __name((schema) => {
60
+ var _a, _b;
61
+ return ((_b = (_a = schema["x-component"]) == null ? void 0 : _a.indexOf) == null ? void 0 : _b.call(_a, "MoveUp")) > -1;
62
+ }, "isMoveUpComponent");
63
+ const isMoveDownComponent = /* @__PURE__ */ __name((schema) => {
64
+ var _a, _b;
65
+ return ((_b = (_a = schema["x-component"]) == null ? void 0 : _a.indexOf) == null ? void 0 : _b.call(_a, "MoveDown")) > -1;
66
+ }, "isMoveDownComponent");
67
+ const isOperationComponent = /* @__PURE__ */ __name((schema) => {
68
+ return isAdditionComponent(schema) || isRemoveComponent(schema) || isCopyComponent(schema) || isMoveDownComponent(schema) || isMoveUpComponent(schema);
69
+ }, "isOperationComponent");
70
+ const InternalArrayCards = (0, import_schema.observer)((props) => {
71
+ const field = (0, import_schema.useField)();
72
+ const schema = (0, import_schema.useFieldSchema)();
73
+ const dataSource = Array.isArray(field.value) ? field.value : [];
74
+ const prefixCls = (0, import_builtins.usePrefixCls)("formily-array-cards", props);
75
+ const [wrapSSR, hashId] = (0, import_style.default)(prefixCls);
76
+ if (!schema) throw new Error("can not found schema object");
77
+ const renderItems = /* @__PURE__ */ __name(() => {
78
+ return dataSource == null ? void 0 : dataSource.map((item, index) => {
79
+ const items = Array.isArray(schema.items) ? schema.items[index] || schema.items[0] : schema.items;
80
+ const title = /* @__PURE__ */ import_react.default.createElement("span", null, items ? /* @__PURE__ */ import_react.default.createElement(
81
+ import_schema.RecursionField,
82
+ {
83
+ schema: items,
84
+ name: index,
85
+ filterProperties: (schema2) => {
86
+ if (!isIndexComponent(schema2)) return false;
87
+ return true;
88
+ },
89
+ onlyRenderProperties: true
90
+ }
91
+ ) : null, props.title || field.title);
92
+ const extra = /* @__PURE__ */ import_react.default.createElement("span", null, items ? /* @__PURE__ */ import_react.default.createElement(
93
+ import_schema.RecursionField,
94
+ {
95
+ schema: items,
96
+ name: index,
97
+ filterProperties: (schema2) => {
98
+ if (!isOperationComponent(schema2)) return false;
99
+ return true;
100
+ },
101
+ onlyRenderProperties: true
102
+ }
103
+ ) : null, props.extra);
104
+ const content = items ? /* @__PURE__ */ import_react.default.createElement(
105
+ import_schema.RecursionField,
106
+ {
107
+ schema: items,
108
+ name: index,
109
+ filterProperties: (schema2) => {
110
+ if (isIndexComponent(schema2)) return false;
111
+ if (isOperationComponent(schema2)) return false;
112
+ return true;
113
+ }
114
+ }
115
+ ) : null;
116
+ return /* @__PURE__ */ import_react.default.createElement(import_array_base.ArrayBase.Item, { key: index, index, record: () => {
117
+ var _a;
118
+ return (_a = field.value) == null ? void 0 : _a[index];
119
+ } }, /* @__PURE__ */ import_react.default.createElement(
120
+ import_antd.Card,
121
+ {
122
+ ...props,
123
+ onChange: () => {
124
+ },
125
+ className: (0, import_classnames.default)(`${prefixCls}-item`, hashId, props.className),
126
+ title,
127
+ extra
128
+ },
129
+ content
130
+ ));
131
+ });
132
+ }, "renderItems");
133
+ const renderAddition = /* @__PURE__ */ __name(() => {
134
+ return schema.reduceProperties((addition, schema2, key) => {
135
+ if (isAdditionComponent(schema2)) {
136
+ return /* @__PURE__ */ import_react.default.createElement(import_schema.RecursionField, { schema: schema2, name: key });
137
+ }
138
+ return addition;
139
+ }, null);
140
+ }, "renderAddition");
141
+ const renderEmpty = /* @__PURE__ */ __name(() => {
142
+ if (dataSource == null ? void 0 : dataSource.length) return;
143
+ return /* @__PURE__ */ import_react.default.createElement(
144
+ import_antd.Card,
145
+ {
146
+ ...props,
147
+ onChange: () => {
148
+ },
149
+ className: (0, import_classnames.default)(`${prefixCls}-item`, hashId, props.className),
150
+ title: props.title || field.title
151
+ },
152
+ /* @__PURE__ */ import_react.default.createElement(import_antd.Empty, null)
153
+ );
154
+ }, "renderEmpty");
155
+ return wrapSSR(
156
+ /* @__PURE__ */ import_react.default.createElement(import_array_base.ArrayBase, null, renderEmpty(), renderItems(), renderAddition())
157
+ );
158
+ });
159
+ const ArrayCards = import_array_base.ArrayBase.mixin(InternalArrayCards);
160
+ ArrayCards.displayName = "ArrayCards";
161
+ var array_cards_default = ArrayCards;
162
+ // Annotate the CommonJS export names for ESM import in node:
163
+ 0 && (module.exports = {
164
+ ArrayCards,
165
+ InternalArrayCards
166
+ });
@@ -0,0 +1,2 @@
1
+ declare const _default: (prefixCls: string) => import("..").UseComponentStyleResult;
2
+ export default _default;
@@ -0,0 +1,37 @@
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-cards", (token) => {
25
+ const { componentCls, antCls } = token;
26
+ const arrayBase = `${antCls}-formily-array-base`;
27
+ return {
28
+ [componentCls]: {
29
+ "&-item": {
30
+ marginBottom: "10px !important"
31
+ },
32
+ [`${arrayBase}-copy`]: {
33
+ marginInlineStart: 6
34
+ }
35
+ }
36
+ };
37
+ });
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ import { ReactFC } from '@tachybase/schema';
3
+ import { CollapsePanelProps, CollapseProps } from 'antd';
4
+ export interface IArrayCollapseProps extends CollapseProps {
5
+ defaultOpenPanelCount?: number;
6
+ }
7
+ export declare const ArrayCollapse: ReactFC<IArrayCollapseProps> & import("..").ArrayBaseMixins & {
8
+ CollapsePanel: React.FC<React.PropsWithChildren<CollapsePanelProps>>;
9
+ };
10
+ export default ArrayCollapse;