@faasjs/ant-design 0.0.3-beta.35 → 0.0.3-beta.37

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,10 +1,27 @@
1
1
  "use strict";
2
2
  var __create = Object.create;
3
3
  var __defProp = Object.defineProperty;
4
+ var __defProps = Object.defineProperties;
4
5
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
5
7
  var __getOwnPropNames = Object.getOwnPropertyNames;
8
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
6
9
  var __getProtoOf = Object.getPrototypeOf;
7
10
  var __hasOwnProp = Object.prototype.hasOwnProperty;
11
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
12
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
13
+ var __spreadValues = (a, b) => {
14
+ for (var prop in b || (b = {}))
15
+ if (__hasOwnProp.call(b, prop))
16
+ __defNormalProp(a, prop, b[prop]);
17
+ if (__getOwnPropSymbols)
18
+ for (var prop of __getOwnPropSymbols(b)) {
19
+ if (__propIsEnum.call(b, prop))
20
+ __defNormalProp(a, prop, b[prop]);
21
+ }
22
+ return a;
23
+ };
24
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
8
25
  var __export = (target, all) => {
9
26
  for (var name in all)
10
27
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -32,7 +49,7 @@ __export(src_exports, {
32
49
  Description: () => Description,
33
50
  Drawer: () => import_antd4.Drawer,
34
51
  ErrorBoundary: () => ErrorBoundary,
35
- FaasDataWrapper: () => FaasDataWrapper,
52
+ FaasDataWrapper: () => FaasDataWrapper2,
36
53
  Form: () => Form,
37
54
  FormItem: () => FormItem,
38
55
  Link: () => Link,
@@ -106,7 +123,6 @@ function ConfigProvider({
106
123
  }) {
107
124
  const [values, setValues] = (0, import_react2.useState)(baseConfig);
108
125
  (0, import_react2.useEffect)(() => {
109
- console.log(config);
110
126
  if (config.lang === "zh") {
111
127
  setValues((0, import_lodash_es.defaultsDeep)(config, {
112
128
  lang: "zh",
@@ -117,23 +133,17 @@ function ConfigProvider({
117
133
  } else
118
134
  setValues((0, import_lodash_es.defaultsDeep)(config, values));
119
135
  }, []);
120
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ConfigContext.Provider, {
121
- value: values,
122
- children
123
- });
136
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ConfigContext.Provider, { value: values, children });
124
137
  }
125
138
  function useConfigContext() {
126
139
  return (0, import_react2.useContext)(ConfigContext);
127
140
  }
128
141
 
129
142
  // src/Blank.tsx
130
- var import_jsx_runtime = require("react/jsx-runtime");
143
+ var import_jsx_runtime2 = require("react/jsx-runtime");
131
144
  function Blank(options) {
132
145
  const { Blank: Blank2 } = useConfigContext();
133
- return !options || (0, import_lodash_es2.isNil)(options.value) || Array.isArray(options.value) && !options.value.length || options.value === "" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd.Typography.Text, {
134
- disabled: true,
135
- children: (options == null ? void 0 : options.text) || Blank2.text
136
- }) : options.value;
146
+ return !options || (0, import_lodash_es2.isNil)(options.value) || Array.isArray(options.value) && !options.value.length || options.value === "" ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_antd.Typography.Text, { disabled: true, children: (options == null ? void 0 : options.text) || Blank2.text }) : options.value;
137
147
  }
138
148
 
139
149
  // src/data.ts
@@ -167,52 +177,63 @@ function transferValue(type, value) {
167
177
  var import_icons = require("@ant-design/icons");
168
178
  var import_antd3 = require("antd");
169
179
  var import_lodash_es4 = require("lodash-es");
170
- var import_react4 = require("react");
180
+ var import_react5 = require("react");
171
181
 
172
- // src/FaasDataWrapper.tsx
173
- var import_react3 = require("@faasjs/react");
182
+ // ../react/src/index.tsx
183
+ var import_react3 = require("react");
184
+ var clients = {};
185
+ function getClient(domain) {
186
+ const client = clients[domain || Object.keys(clients)[0]];
187
+ if (!client)
188
+ throw Error("FaasReactClient is not initialized");
189
+ return client;
190
+ }
191
+ async function faas(action, params) {
192
+ return getClient().faas(action, params);
193
+ }
194
+ function FaasDataWrapper(props) {
195
+ const [client, setClient] = (0, import_react3.useState)();
196
+ (0, import_react3.useEffect)(() => {
197
+ if (client)
198
+ return;
199
+ setClient(getClient());
200
+ }, []);
201
+ if (!client)
202
+ return props.fallback || null;
203
+ return (0, import_react3.createElement)(client.FaasDataWrapper, props);
204
+ }
174
205
 
175
206
  // src/Loading.tsx
176
207
  var import_antd2 = require("antd");
177
- var import_jsx_runtime = require("react/jsx-runtime");
208
+ var import_jsx_runtime3 = require("react/jsx-runtime");
178
209
  function Loading(props) {
179
210
  if (props.loading === false)
180
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, {
181
- children: props.children
182
- });
183
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
184
- style: {
185
- ...props.style || {},
186
- ...!props.size || props.size === "large" ? {
187
- margin: "20vh auto",
188
- textAlign: "center"
189
- } : {}
190
- },
191
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd2.Spin, {
192
- size: props.size || "large"
193
- })
194
- });
211
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_jsx_runtime3.Fragment, { children: props.children });
212
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { style: __spreadValues(__spreadValues({}, props.style || {}), !props.size || props.size === "large" ? {
213
+ margin: "20vh auto",
214
+ textAlign: "center"
215
+ } : {}), children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_antd2.Spin, { size: props.size || "large" }) });
195
216
  }
196
217
 
197
218
  // src/FaasDataWrapper.tsx
198
- var import_jsx_runtime = require("react/jsx-runtime");
199
- function FaasDataWrapper(props) {
200
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react3.FaasDataWrapper, {
201
- fallback: props.loading || /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Loading, {
202
- ...props.loadingProps
203
- }),
204
- ...props
205
- });
219
+ var import_jsx_runtime4 = require("react/jsx-runtime");
220
+ function FaasDataWrapper2(props) {
221
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
222
+ FaasDataWrapper,
223
+ __spreadValues({
224
+ fallback: props.loading || /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Loading, __spreadValues({}, props.loadingProps))
225
+ }, props)
226
+ );
206
227
  }
207
228
 
208
229
  // src/Description.tsx
209
- var import_jsx_runtime = require("react/jsx-runtime");
230
+ var import_jsx_runtime5 = require("react/jsx-runtime");
210
231
  function DescriptionItemContent(props) {
211
232
  var _a;
212
- const [computedProps, setComputedProps] = (0, import_react4.useState)();
213
- (0, import_react4.useEffect)(() => {
233
+ const [computedProps, setComputedProps] = (0, import_react5.useState)();
234
+ (0, import_react5.useEffect)(() => {
214
235
  var _a2, _b;
215
- const propsCopy = { ...props };
236
+ const propsCopy = __spreadValues({}, props);
216
237
  if (!propsCopy.item.title)
217
238
  propsCopy.item.title = (0, import_lodash_es4.upperFirst)(propsCopy.item.id);
218
239
  if (!propsCopy.item.type)
@@ -240,7 +261,7 @@ function DescriptionItemContent(props) {
240
261
  return null;
241
262
  if (computedProps.extendTypes && computedProps.extendTypes[computedProps.item.type])
242
263
  if (computedProps.extendTypes[computedProps.item.type].children)
243
- return (0, import_react4.cloneElement)(
264
+ return (0, import_react5.cloneElement)(
244
265
  computedProps.extendTypes[computedProps.item.type].children,
245
266
  {
246
267
  scene: "description",
@@ -249,15 +270,13 @@ function DescriptionItemContent(props) {
249
270
  }
250
271
  );
251
272
  else if (computedProps.extendTypes[computedProps.item.type].render)
252
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, {
253
- children: computedProps.extendTypes[computedProps.item.type].render(computedProps.value, computedProps.values, 0, "description")
254
- });
273
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_jsx_runtime5.Fragment, { children: computedProps.extendTypes[computedProps.item.type].render(computedProps.value, computedProps.values, 0, "description") });
255
274
  else
256
275
  throw Error(computedProps.item.type + " requires children or render");
257
276
  if (computedProps.item.descriptionChildren === null)
258
277
  return null;
259
278
  if (computedProps.item.descriptionChildren)
260
- return (0, import_react4.cloneElement)(computedProps.item.descriptionChildren, {
279
+ return (0, import_react5.cloneElement)(computedProps.item.descriptionChildren, {
261
280
  scene: "description",
262
281
  value: computedProps.value,
263
282
  values: computedProps.values
@@ -265,7 +284,7 @@ function DescriptionItemContent(props) {
265
284
  if (computedProps.item.children === null)
266
285
  return null;
267
286
  if (computedProps.item.children)
268
- return (0, import_react4.cloneElement)(computedProps.item.children, {
287
+ return (0, import_react5.cloneElement)(computedProps.item.children, {
269
288
  scene: "description",
270
289
  value: computedProps.value,
271
290
  values: computedProps.values
@@ -275,132 +294,137 @@ function DescriptionItemContent(props) {
275
294
  if (computedProps.item.render)
276
295
  return computedProps.item.render(computedProps.value, computedProps.values, 0, "description");
277
296
  if (computedProps.value === null || Array.isArray(computedProps.value) && !computedProps.value.length)
278
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Blank, {});
297
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Blank, {});
279
298
  switch (computedProps.item.type) {
280
299
  case "string[]":
281
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, {
282
- children: computedProps.value.join(", ")
283
- });
300
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_jsx_runtime5.Fragment, { children: computedProps.value.join(", ") });
284
301
  case "number":
285
302
  return computedProps.value || null;
286
303
  case "number[]":
287
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, {
288
- children: computedProps.value.join(", ")
289
- });
304
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_jsx_runtime5.Fragment, { children: computedProps.value.join(", ") });
290
305
  case "boolean":
291
- return computedProps.value ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons.CheckOutlined, {
292
- style: {
293
- marginTop: "4px",
294
- color: "#52c41a"
295
- }
296
- }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons.CloseOutlined, {
297
- style: {
298
- marginTop: "4px",
299
- color: "#ff4d4f"
300
- }
301
- });
306
+ return computedProps.value ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_icons.CheckOutlined, { style: {
307
+ marginTop: "4px",
308
+ color: "#52c41a"
309
+ } }) : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_icons.CloseOutlined, { style: {
310
+ marginTop: "4px",
311
+ color: "#ff4d4f"
312
+ } });
302
313
  case "time":
303
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, {
304
- children: computedProps.value.format("YYYY-MM-DD HH:mm:ss")
305
- });
314
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_jsx_runtime5.Fragment, { children: computedProps.value.format("YYYY-MM-DD HH:mm:ss") });
306
315
  case "date":
307
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, {
308
- children: computedProps.value.format("YYYY-MM-DD")
309
- });
316
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_jsx_runtime5.Fragment, { children: computedProps.value.format("YYYY-MM-DD") });
310
317
  case "object":
311
318
  if (!computedProps.value)
312
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Blank, {});
313
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Description, {
314
- items: computedProps.item.object,
315
- dataSource: computedProps.value,
316
- column: 1
317
- });
319
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Blank, {});
320
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
321
+ Description,
322
+ {
323
+ items: computedProps.item.object,
324
+ dataSource: computedProps.value,
325
+ column: 1
326
+ }
327
+ );
318
328
  case "object[]":
319
329
  if (!((_a = computedProps.value) == null ? void 0 : _a.length))
320
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Blank, {});
321
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd3.Space, {
322
- direction: "vertical",
323
- children: computedProps.value.map((value, index) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Description, {
330
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Blank, {});
331
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_antd3.Space, { direction: "vertical", children: computedProps.value.map((value, index) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
332
+ Description,
333
+ {
324
334
  items: computedProps.item.object,
325
335
  dataSource: value,
326
336
  column: 1
327
- }, index))
328
- });
337
+ },
338
+ index
339
+ )) });
329
340
  default:
330
341
  return computedProps.value || null;
331
342
  }
332
343
  }
333
344
  function Description(props) {
334
345
  if (!props.faasData)
335
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd3.Descriptions, {
336
- ...props,
337
- title: (0, import_lodash_es4.isFunction)(props.renderTitle) ? props.renderTitle(props.dataSource) : props.title,
338
- children: props.items.map((item) => {
339
- return !item.if || item.if(props.dataSource) ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd3.Descriptions.Item, {
340
- label: item.title || (0, import_lodash_es4.upperFirst)(item.id),
341
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DescriptionItemContent, {
342
- item,
343
- value: props.dataSource[item.id],
344
- values: props.dataSource,
345
- extendTypes: props.extendTypes
346
- })
347
- }, item.id) : null;
348
- }).filter(Boolean)
349
- });
350
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FaasDataWrapper, {
351
- render: ({ data }) => {
352
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd3.Descriptions, {
353
- ...props,
354
- title: (0, import_lodash_es4.isFunction)(props.renderTitle) ? props.renderTitle(data) : props.title,
346
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
347
+ import_antd3.Descriptions,
348
+ __spreadProps(__spreadValues({}, props), {
349
+ title: (0, import_lodash_es4.isFunction)(props.renderTitle) ? props.renderTitle(props.dataSource) : props.title,
355
350
  children: props.items.map((item) => {
356
- return !item.if || item.if(data) ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd3.Descriptions.Item, {
357
- label: item.title || (0, import_lodash_es4.upperFirst)(item.id),
358
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DescriptionItemContent, {
359
- item,
360
- value: data[item.id],
361
- values: data,
362
- extendTypes: props.extendTypes
363
- })
364
- }, item.id) : null;
351
+ return !item.if || item.if(props.dataSource) ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
352
+ import_antd3.Descriptions.Item,
353
+ {
354
+ label: item.title || (0, import_lodash_es4.upperFirst)(item.id),
355
+ children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
356
+ DescriptionItemContent,
357
+ {
358
+ item,
359
+ value: props.dataSource[item.id],
360
+ values: props.dataSource,
361
+ extendTypes: props.extendTypes
362
+ }
363
+ )
364
+ },
365
+ item.id
366
+ ) : null;
365
367
  }).filter(Boolean)
366
- });
367
- },
368
- ...props.faasData
369
- });
368
+ })
369
+ );
370
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
371
+ FaasDataWrapper2,
372
+ __spreadValues({
373
+ render: ({ data }) => {
374
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
375
+ import_antd3.Descriptions,
376
+ __spreadProps(__spreadValues({}, props), {
377
+ title: (0, import_lodash_es4.isFunction)(props.renderTitle) ? props.renderTitle(data) : props.title,
378
+ children: props.items.map((item) => {
379
+ return !item.if || item.if(data) ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
380
+ import_antd3.Descriptions.Item,
381
+ {
382
+ label: item.title || (0, import_lodash_es4.upperFirst)(item.id),
383
+ children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
384
+ DescriptionItemContent,
385
+ {
386
+ item,
387
+ value: data[item.id],
388
+ values: data,
389
+ extendTypes: props.extendTypes
390
+ }
391
+ )
392
+ },
393
+ item.id
394
+ ) : null;
395
+ }).filter(Boolean)
396
+ })
397
+ );
398
+ }
399
+ }, props.faasData)
400
+ );
370
401
  }
371
402
 
372
403
  // src/Drawer.tsx
373
404
  var import_antd4 = require("antd");
374
- var import_react5 = require("react");
375
- var import_jsx_runtime = require("react/jsx-runtime");
405
+ var import_react6 = require("react");
406
+ var import_jsx_runtime6 = require("react/jsx-runtime");
376
407
  function useDrawer(init) {
377
- const [props, setProps] = (0, import_react5.useState)({
408
+ const [props, setProps] = (0, import_react6.useState)(__spreadValues({
378
409
  open: false,
379
- onClose: () => setProps((prev) => ({
380
- ...prev,
410
+ onClose: () => setProps((prev) => __spreadProps(__spreadValues({}, prev), {
381
411
  open: false
382
- })),
383
- ...init
384
- });
412
+ }))
413
+ }, init));
385
414
  return {
386
- drawer: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Drawer, {
387
- ...props
388
- }),
415
+ drawer: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_antd4.Drawer, __spreadValues({}, props)),
389
416
  drawerProps: props,
390
417
  setDrawerProps(changes) {
391
- setProps((prev) => ({
392
- ...prev,
393
- ...changes
394
- }));
418
+ setProps((prev) => __spreadValues(__spreadValues({}, prev), changes));
395
419
  }
396
420
  };
397
421
  }
398
422
 
399
423
  // src/ErrorBoundary.tsx
400
- var import_react6 = require("react");
424
+ var import_react7 = require("react");
401
425
  var import_antd5 = require("antd");
402
- var import_jsx_runtime = require("react/jsx-runtime");
403
- var ErrorBoundary = class extends import_react6.Component {
426
+ var import_jsx_runtime7 = require("react/jsx-runtime");
427
+ var ErrorBoundary = class extends import_react7.Component {
404
428
  constructor(props) {
405
429
  super(props);
406
430
  this.state = {
@@ -427,33 +451,32 @@ var ErrorBoundary = class extends import_react6.Component {
427
451
  if (error) {
428
452
  if (this.props.onError)
429
453
  return this.props.onError(error, info);
430
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Alert, {
431
- type: "error",
432
- message: errorMessage,
433
- description: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("pre", {
434
- style: {
454
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
455
+ import_antd5.Alert,
456
+ {
457
+ type: "error",
458
+ message: errorMessage,
459
+ description: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("pre", { style: {
435
460
  fontSize: "0.9em",
436
461
  overflowX: "auto"
437
- },
438
- children: errorDescription
439
- })
440
- });
462
+ }, children: errorDescription })
463
+ }
464
+ );
441
465
  }
442
466
  return children;
443
467
  }
444
468
  };
445
469
 
446
470
  // src/Form.tsx
447
- var import_react8 = require("@faasjs/react");
448
471
  var import_antd7 = require("antd");
449
- var import_react9 = require("react");
472
+ var import_react10 = require("react");
450
473
 
451
474
  // src/FormItem.tsx
452
475
  var import_antd6 = require("antd");
453
476
  var import_icons2 = require("@ant-design/icons");
454
- var import_react7 = require("react");
477
+ var import_react8 = require("react");
455
478
  var import_lodash_es5 = require("lodash-es");
456
- var import_jsx_runtime = require("react/jsx-runtime");
479
+ var import_jsx_runtime8 = require("react/jsx-runtime");
457
480
  function processProps(propsCopy, config) {
458
481
  if (!propsCopy.title)
459
482
  propsCopy.title = (0, import_lodash_es5.upperFirst)(propsCopy.id);
@@ -502,12 +525,12 @@ function processProps(propsCopy, config) {
502
525
  }
503
526
  function FormItem(props) {
504
527
  var _a;
505
- const [computedProps, setComputedProps] = (0, import_react7.useState)();
506
- const [extendTypes, setExtendTypes] = (0, import_react7.useState)();
528
+ const [computedProps, setComputedProps] = (0, import_react8.useState)();
529
+ const [extendTypes, setExtendTypes] = (0, import_react8.useState)();
507
530
  const { common: common2 } = useConfigContext();
508
- const [hidden, setHidden] = (0, import_react7.useState)(props.hidden || false);
509
- (0, import_react7.useEffect)(() => {
510
- const propsCopy = { ...props };
531
+ const [hidden, setHidden] = (0, import_react8.useState)(props.hidden || false);
532
+ (0, import_react8.useEffect)(() => {
533
+ const propsCopy = __spreadValues({}, props);
511
534
  if (propsCopy.extendTypes) {
512
535
  setExtendTypes(propsCopy.extendTypes);
513
536
  delete propsCopy.extendTypes;
@@ -530,300 +553,245 @@ function FormItem(props) {
530
553
  if (!computedProps)
531
554
  return null;
532
555
  if (hidden)
533
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd6.Form.Item, {
534
- ...computedProps,
535
- noStyle: true,
536
- rules: [],
537
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd6.Input, {
538
- hidden: true
556
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
557
+ import_antd6.Form.Item,
558
+ __spreadProps(__spreadValues({}, computedProps), {
559
+ noStyle: true,
560
+ rules: [],
561
+ children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_antd6.Input, { hidden: true })
539
562
  })
540
- });
563
+ );
541
564
  if (extendTypes && extendTypes[computedProps.type])
542
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd6.Form.Item, {
543
- ...computedProps,
544
- children: extendTypes[computedProps.type].children
545
- });
565
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_antd6.Form.Item, __spreadProps(__spreadValues({}, computedProps), { children: extendTypes[computedProps.type].children }));
546
566
  if (computedProps.formChildren === null)
547
567
  return null;
548
568
  if (computedProps.formChildren)
549
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd6.Form.Item, {
550
- ...computedProps,
551
- children: (0, import_react7.cloneElement)(computedProps.formChildren, { scene: "form" })
552
- });
569
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_antd6.Form.Item, __spreadProps(__spreadValues({}, computedProps), { children: (0, import_react8.cloneElement)(computedProps.formChildren, { scene: "form" }) }));
553
570
  if (computedProps.children === null)
554
571
  return null;
555
572
  if (computedProps.children)
556
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd6.Form.Item, {
557
- ...computedProps,
558
- children: (0, import_react7.cloneElement)(computedProps.children, { scene: "form" })
559
- });
573
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_antd6.Form.Item, __spreadProps(__spreadValues({}, computedProps), { children: (0, import_react8.cloneElement)(computedProps.children, { scene: "form" }) }));
560
574
  if (computedProps.formRender)
561
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd6.Form.Item, {
562
- ...computedProps,
563
- children: computedProps.formRender(null, null, 0, "form")
564
- });
575
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_antd6.Form.Item, __spreadProps(__spreadValues({}, computedProps), { children: computedProps.formRender(null, null, 0, "form") }));
565
576
  if (computedProps.render)
566
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd6.Form.Item, {
567
- ...computedProps,
568
- children: computedProps.render(null, null, 0, "form")
569
- });
577
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_antd6.Form.Item, __spreadProps(__spreadValues({}, computedProps), { children: computedProps.render(null, null, 0, "form") }));
570
578
  switch (computedProps.type) {
571
579
  case "string":
572
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd6.Form.Item, {
573
- ...computedProps,
574
- children: computedProps.options ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd6.Select, {
575
- ...computedProps.input
576
- }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd6.Input, {
577
- ...computedProps.input
578
- })
579
- });
580
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_antd6.Form.Item, __spreadProps(__spreadValues({}, computedProps), { children: computedProps.options ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_antd6.Select, __spreadValues({}, computedProps.input)) : /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_antd6.Input, __spreadValues({}, computedProps.input)) }));
580
581
  case "string[]":
581
582
  if (computedProps.options)
582
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd6.Form.Item, {
583
- ...computedProps,
584
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd6.Select, {
585
- mode: "multiple",
586
- ...computedProps.input
587
- })
588
- });
589
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd6.Form.List, {
590
- name: computedProps.name,
591
- rules: computedProps.rules,
592
- children: (fields, { add, remove }, { errors }) => {
593
- var _a2;
594
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, {
595
- children: [
596
- computedProps.label && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
597
- className: "ant-form-item-label",
598
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("label", {
599
- className: computedProps.rules.find((r) => r.required) && "ant-form-item-required",
600
- children: computedProps.label
601
- })
602
- }),
583
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_antd6.Form.Item, __spreadProps(__spreadValues({}, computedProps), { children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
584
+ import_antd6.Select,
585
+ __spreadValues({
586
+ mode: "multiple"
587
+ }, computedProps.input)
588
+ ) }));
589
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
590
+ import_antd6.Form.List,
591
+ {
592
+ name: computedProps.name,
593
+ rules: computedProps.rules,
594
+ children: (fields, { add, remove }, { errors }) => {
595
+ var _a2;
596
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_jsx_runtime8.Fragment, { children: [
597
+ computedProps.label && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "ant-form-item-label", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("label", { className: computedProps.rules.find((r) => r.required) && "ant-form-item-required", children: computedProps.label }) }),
603
598
  fields.map((field) => {
604
599
  var _a3;
605
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd6.Form.Item, {
606
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_antd6.Row, {
600
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_antd6.Form.Item, { children: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
601
+ import_antd6.Row,
602
+ {
607
603
  gutter: 24,
608
604
  style: { flexFlow: "row nowrap" },
609
605
  children: [
610
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd6.Col, {
611
- span: 23,
612
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd6.Form.Item, {
613
- ...field,
606
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_antd6.Col, { span: 23, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
607
+ import_antd6.Form.Item,
608
+ __spreadProps(__spreadValues({}, field), {
614
609
  noStyle: true,
615
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd6.Input, {
616
- ...computedProps.input
617
- })
610
+ children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_antd6.Input, __spreadValues({}, computedProps.input))
618
611
  })
619
- }),
620
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd6.Col, {
621
- span: 1,
622
- children: !((_a3 = computedProps.input) == null ? void 0 : _a3.disabled) && (!computedProps.rules.find((r) => r.required) || field.key > 0) && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd6.Button, {
612
+ ) }),
613
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_antd6.Col, { span: 1, children: !((_a3 = computedProps.input) == null ? void 0 : _a3.disabled) && (!computedProps.rules.find((r) => r.required) || field.key > 0) && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
614
+ import_antd6.Button,
615
+ {
623
616
  danger: true,
624
617
  type: "link",
625
618
  style: { float: "right" },
626
- icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons2.MinusCircleOutlined, {}),
619
+ icon: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_icons2.MinusCircleOutlined, {}),
627
620
  onClick: () => remove(field.name)
628
- })
629
- })
621
+ }
622
+ ) })
630
623
  ]
631
- })
632
- }, field.key);
624
+ }
625
+ ) }, field.key);
633
626
  }),
634
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_antd6.Form.Item, {
635
- children: [
636
- !((_a2 = computedProps.input) == null ? void 0 : _a2.disabled) && (!computedProps.maxCount || computedProps.maxCount > fields.length) && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd6.Button, {
627
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_antd6.Form.Item, { children: [
628
+ !((_a2 = computedProps.input) == null ? void 0 : _a2.disabled) && (!computedProps.maxCount || computedProps.maxCount > fields.length) && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
629
+ import_antd6.Button,
630
+ {
637
631
  type: "dashed",
638
632
  block: true,
639
633
  onClick: () => add(),
640
- icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons2.PlusOutlined, {})
641
- }),
642
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd6.Form.ErrorList, {
643
- errors
644
- })
645
- ]
646
- })
647
- ]
648
- });
634
+ icon: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_icons2.PlusOutlined, {})
635
+ }
636
+ ),
637
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_antd6.Form.ErrorList, { errors })
638
+ ] })
639
+ ] });
640
+ }
649
641
  }
650
- });
642
+ );
651
643
  case "number":
652
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd6.Form.Item, {
653
- ...computedProps,
654
- children: computedProps.options ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd6.Select, {
655
- ...computedProps.input
656
- }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd6.InputNumber, {
657
- style: { width: "100%" },
658
- ...computedProps.input
659
- })
660
- });
644
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_antd6.Form.Item, __spreadProps(__spreadValues({}, computedProps), { children: computedProps.options ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_antd6.Select, __spreadValues({}, computedProps.input)) : /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
645
+ import_antd6.InputNumber,
646
+ __spreadValues({
647
+ style: { width: "100%" }
648
+ }, computedProps.input)
649
+ ) }));
661
650
  case "number[]":
662
651
  if (computedProps.options)
663
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd6.Form.Item, {
664
- ...computedProps,
665
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd6.Select, {
666
- mode: "multiple",
667
- ...computedProps.input
668
- })
669
- });
670
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd6.Form.List, {
671
- name: computedProps.name,
672
- rules: computedProps.rules,
673
- children: (fields, { add, remove }, { errors }) => {
674
- var _a2, _b;
675
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, {
676
- children: [
677
- computedProps.label && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
678
- className: "ant-form-item-label",
679
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("label", {
680
- className: ((_a2 = computedProps.rules) == null ? void 0 : _a2.find((r) => r.required)) && "ant-form-item-required",
681
- children: computedProps.label
682
- })
683
- }),
652
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_antd6.Form.Item, __spreadProps(__spreadValues({}, computedProps), { children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
653
+ import_antd6.Select,
654
+ __spreadValues({
655
+ mode: "multiple"
656
+ }, computedProps.input)
657
+ ) }));
658
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
659
+ import_antd6.Form.List,
660
+ {
661
+ name: computedProps.name,
662
+ rules: computedProps.rules,
663
+ children: (fields, { add, remove }, { errors }) => {
664
+ var _a2, _b;
665
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_jsx_runtime8.Fragment, { children: [
666
+ computedProps.label && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "ant-form-item-label", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("label", { className: ((_a2 = computedProps.rules) == null ? void 0 : _a2.find((r) => r.required)) && "ant-form-item-required", children: computedProps.label }) }),
684
667
  fields.map((field) => {
685
668
  var _a3;
686
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd6.Form.Item, {
687
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_antd6.Row, {
669
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_antd6.Form.Item, { children: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
670
+ import_antd6.Row,
671
+ {
688
672
  gutter: 24,
689
673
  style: { flexFlow: "row nowrap" },
690
674
  children: [
691
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd6.Col, {
692
- span: 23,
693
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd6.Form.Item, {
694
- ...field,
675
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_antd6.Col, { span: 23, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
676
+ import_antd6.Form.Item,
677
+ __spreadProps(__spreadValues({}, field), {
695
678
  noStyle: true,
696
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd6.InputNumber, {
697
- style: { width: "100%" },
698
- ...computedProps.input
699
- })
679
+ children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
680
+ import_antd6.InputNumber,
681
+ __spreadValues({
682
+ style: { width: "100%" }
683
+ }, computedProps.input)
684
+ )
700
685
  })
701
- }),
702
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd6.Col, {
703
- span: 1,
704
- children: !((_a3 = computedProps.input) == null ? void 0 : _a3.disabled) && (!computedProps.rules.find((r) => r.required) || field.key > 0) && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd6.Button, {
686
+ ) }),
687
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_antd6.Col, { span: 1, children: !((_a3 = computedProps.input) == null ? void 0 : _a3.disabled) && (!computedProps.rules.find((r) => r.required) || field.key > 0) && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
688
+ import_antd6.Button,
689
+ {
705
690
  danger: true,
706
691
  type: "link",
707
692
  style: { float: "right" },
708
- icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons2.MinusCircleOutlined, {}),
693
+ icon: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_icons2.MinusCircleOutlined, {}),
709
694
  onClick: () => remove(field.name)
710
- })
711
- })
695
+ }
696
+ ) })
712
697
  ]
713
- })
714
- }, field.key);
698
+ }
699
+ ) }, field.key);
715
700
  }),
716
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_antd6.Form.Item, {
717
- children: [
718
- !((_b = computedProps.input) == null ? void 0 : _b.disabled) && (!computedProps.maxCount || computedProps.maxCount > fields.length) && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd6.Button, {
701
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_antd6.Form.Item, { children: [
702
+ !((_b = computedProps.input) == null ? void 0 : _b.disabled) && (!computedProps.maxCount || computedProps.maxCount > fields.length) && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
703
+ import_antd6.Button,
704
+ {
719
705
  type: "dashed",
720
706
  block: true,
721
707
  onClick: () => add(),
722
- icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons2.PlusOutlined, {})
723
- }),
724
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd6.Form.ErrorList, {
725
- errors
726
- })
727
- ]
728
- })
729
- ]
730
- });
708
+ icon: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_icons2.PlusOutlined, {})
709
+ }
710
+ ),
711
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_antd6.Form.ErrorList, { errors })
712
+ ] })
713
+ ] });
714
+ }
731
715
  }
732
- });
716
+ );
733
717
  case "boolean":
734
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd6.Form.Item, {
735
- ...computedProps,
736
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd6.Switch, {
737
- ...computedProps.input
738
- })
739
- });
718
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_antd6.Form.Item, __spreadProps(__spreadValues({}, computedProps), { children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_antd6.Switch, __spreadValues({}, computedProps.input)) }));
740
719
  case "date":
741
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd6.Form.Item, {
742
- ...computedProps,
743
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd6.DatePicker, {
744
- ...computedProps.input
745
- })
746
- });
720
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_antd6.Form.Item, __spreadProps(__spreadValues({}, computedProps), { children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_antd6.DatePicker, __spreadValues({}, computedProps.input)) }));
747
721
  case "time":
748
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd6.Form.Item, {
749
- ...computedProps,
750
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd6.TimePicker, {
751
- ...computedProps.input
752
- })
753
- });
722
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_antd6.Form.Item, __spreadProps(__spreadValues({}, computedProps), { children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_antd6.TimePicker, __spreadValues({}, computedProps.input)) }));
754
723
  case "object":
755
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, {
756
- children: [
757
- computedProps.label && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
758
- className: "ant-form-item-label",
759
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("label", {
760
- className: ((_a = computedProps.rules) == null ? void 0 : _a.find((r) => r.required)) && "ant-form-item-required",
761
- children: computedProps.label
762
- })
763
- }),
764
- computedProps.object.map((o) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FormItem, {
765
- ...o
766
- }, o.id))
767
- ]
768
- });
724
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_jsx_runtime8.Fragment, { children: [
725
+ computedProps.label && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "ant-form-item-label", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("label", { className: ((_a = computedProps.rules) == null ? void 0 : _a.find((r) => r.required)) && "ant-form-item-required", children: computedProps.label }) }),
726
+ computedProps.object.map((o) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
727
+ FormItem,
728
+ __spreadValues({}, o),
729
+ o.id
730
+ ))
731
+ ] });
769
732
  case "object[]":
770
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd6.Form.List, {
771
- name: computedProps.name,
772
- rules: computedProps.rules,
773
- children: (fields, { add, remove }, { errors }) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, {
774
- children: [
775
- fields.map((field) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_antd6.Form.Item, {
776
- style: { marginBottom: 0 },
777
- children: [
778
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
779
- className: "ant-form-item-label",
780
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", {
781
- children: [
782
- computedProps.label,
783
- " ",
784
- field.name + 1,
785
- !computedProps.disabled && (!computedProps.rules.find((r) => r.required) || field.key > 0) && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd6.Button, {
733
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
734
+ import_antd6.Form.List,
735
+ {
736
+ name: computedProps.name,
737
+ rules: computedProps.rules,
738
+ children: (fields, { add, remove }, { errors }) => /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_jsx_runtime8.Fragment, { children: [
739
+ fields.map((field) => /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
740
+ import_antd6.Form.Item,
741
+ {
742
+ style: { marginBottom: 0 },
743
+ children: [
744
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "ant-form-item-label", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("label", { children: [
745
+ computedProps.label,
746
+ " ",
747
+ field.name + 1,
748
+ !computedProps.disabled && (!computedProps.rules.find((r) => r.required) || field.key > 0) && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
749
+ import_antd6.Button,
750
+ {
786
751
  danger: true,
787
752
  type: "link",
788
753
  onClick: () => remove(field.name),
789
754
  children: common2.delete
790
- })
791
- ]
792
- })
793
- }),
794
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd6.Row, {
795
- gutter: 24,
796
- children: computedProps.object.map((o) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd6.Col, {
797
- span: o.col || 24,
798
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FormItem, {
799
- ...o,
800
- name: [field.name, o.id]
801
- })
802
- }, o.id))
803
- })
804
- ]
805
- }, field.key)),
806
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_antd6.Form.Item, {
807
- children: [
808
- !computedProps.disabled && (!computedProps.maxCount || computedProps.maxCount > fields.length) && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_antd6.Button, {
755
+ }
756
+ )
757
+ ] }) }),
758
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_antd6.Row, { gutter: 24, children: computedProps.object.map((o) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
759
+ import_antd6.Col,
760
+ {
761
+ span: o.col || 24,
762
+ children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
763
+ FormItem,
764
+ __spreadProps(__spreadValues({}, o), {
765
+ name: [field.name, o.id]
766
+ })
767
+ )
768
+ },
769
+ o.id
770
+ )) })
771
+ ]
772
+ },
773
+ field.key
774
+ )),
775
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_antd6.Form.Item, { children: [
776
+ !computedProps.disabled && (!computedProps.maxCount || computedProps.maxCount > fields.length) && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
777
+ import_antd6.Button,
778
+ {
809
779
  type: "dashed",
810
780
  block: true,
811
781
  onClick: () => add(),
812
- icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons2.PlusOutlined, {}),
782
+ icon: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_icons2.PlusOutlined, {}),
813
783
  children: [
814
784
  common2.add,
815
785
  " ",
816
786
  computedProps.label
817
787
  ]
818
- }),
819
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd6.Form.ErrorList, {
820
- errors
821
- })
822
- ]
823
- })
824
- ]
825
- })
826
- });
788
+ }
789
+ ),
790
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_antd6.Form.ErrorList, { errors })
791
+ ] })
792
+ ] })
793
+ }
794
+ );
827
795
  default:
828
796
  return null;
829
797
  }
@@ -831,21 +799,20 @@ function FormItem(props) {
831
799
  FormItem.useStatus = import_antd6.Form.Item.useStatus;
832
800
 
833
801
  // src/Form.tsx
834
- var import_jsx_runtime = require("react/jsx-runtime");
802
+ var import_jsx_runtime9 = require("react/jsx-runtime");
835
803
  function Form(props) {
836
804
  var _a, _b;
837
- const [loading, setLoading] = (0, import_react9.useState)(false);
838
- const [computedProps, setComputedProps] = (0, import_react9.useState)();
805
+ const [loading, setLoading] = (0, import_react10.useState)(false);
806
+ const [computedProps, setComputedProps] = (0, import_react10.useState)();
839
807
  const config = useConfigContext();
840
- const [extendTypes, setExtendTypes] = (0, import_react9.useState)();
808
+ const [extendTypes, setExtendTypes] = (0, import_react10.useState)();
841
809
  const [form] = import_antd7.Form.useForm(props.form);
842
- const [initialValues, setInitialValues] = (0, import_react9.useState)(props.initialValues);
843
- (0, import_react9.useEffect)(() => {
810
+ const [initialValues, setInitialValues] = (0, import_react10.useState)(props.initialValues);
811
+ (0, import_react10.useEffect)(() => {
844
812
  var _a2, _b2, _c;
845
- const propsCopy = {
846
- ...props,
813
+ const propsCopy = __spreadProps(__spreadValues({}, props), {
847
814
  form
848
- };
815
+ });
849
816
  if (propsCopy.initialValues && ((_a2 = propsCopy.items) == null ? void 0 : _a2.length)) {
850
817
  for (const key in propsCopy.initialValues) {
851
818
  propsCopy.initialValues[key] = transferValue(
@@ -869,10 +836,7 @@ function Form(props) {
869
836
  setLoading(true);
870
837
  try {
871
838
  if (propsCopy.submit && ((_a3 = propsCopy.submit.to) == null ? void 0 : _a3.action)) {
872
- await props.onFinish(values, async (values2) => (0, import_react8.faas)(propsCopy.submit.to.action, propsCopy.submit.to.params ? {
873
- ...values2,
874
- ...propsCopy.submit.to.params
875
- } : values2));
839
+ await props.onFinish(values, async (values2) => faas(propsCopy.submit.to.action, propsCopy.submit.to.params ? __spreadValues(__spreadValues({}, values2), propsCopy.submit.to.params) : values2));
876
840
  } else
877
841
  await props.onFinish(values);
878
842
  } catch (error) {
@@ -883,10 +847,7 @@ function Form(props) {
883
847
  } else if (propsCopy.submit && ((_c = propsCopy.submit.to) == null ? void 0 : _c.action)) {
884
848
  propsCopy.onFinish = async (values) => {
885
849
  setLoading(true);
886
- return (0, import_react8.faas)(propsCopy.submit.to.action, propsCopy.submit.to.params ? {
887
- ...values,
888
- ...propsCopy.submit.to.params
889
- } : values).then((result) => {
850
+ return faas(propsCopy.submit.to.action, propsCopy.submit.to.params ? __spreadValues(__spreadValues({}, values), propsCopy.submit.to.params) : values).then((result) => {
890
851
  if (propsCopy.submit.to.then)
891
852
  propsCopy.submit.to.then(result);
892
853
  return result;
@@ -907,7 +868,7 @@ function Form(props) {
907
868
  }
908
869
  setComputedProps(propsCopy);
909
870
  }, [props]);
910
- const onValuesChange = (0, import_react9.useCallback)((changedValues, allValues) => {
871
+ const onValuesChange = (0, import_react10.useCallback)((changedValues, allValues) => {
911
872
  console.debug("Form:onValuesChange", changedValues, allValues);
912
873
  if (props.onValuesChange) {
913
874
  props.onValuesChange(changedValues, allValues);
@@ -920,7 +881,7 @@ function Form(props) {
920
881
  item.onValueChange(changedValues[key], allValues, form);
921
882
  }
922
883
  }, [computedProps]);
923
- (0, import_react9.useEffect)(() => {
884
+ (0, import_react10.useEffect)(() => {
924
885
  if (!initialValues)
925
886
  return;
926
887
  console.debug("Form:initialValues", initialValues);
@@ -929,25 +890,33 @@ function Form(props) {
929
890
  }, [computedProps]);
930
891
  if (!computedProps)
931
892
  return null;
932
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_antd7.Form, {
933
- ...computedProps,
934
- onValuesChange,
935
- children: [
936
- computedProps.beforeItems,
937
- (_a = computedProps.items) == null ? void 0 : _a.map((item) => (0, import_react9.isValidElement)(item) ? item : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FormItem, {
938
- ...item,
939
- extendTypes
940
- }, item.id)),
941
- computedProps.children,
942
- computedProps.submit !== false && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd7.Button, {
943
- htmlType: "submit",
944
- type: "primary",
945
- loading,
946
- children: ((_b = computedProps.submit) == null ? void 0 : _b.text) || config.Form.submit.text
947
- }),
948
- computedProps.footer
949
- ]
950
- });
893
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
894
+ import_antd7.Form,
895
+ __spreadProps(__spreadValues({}, computedProps), {
896
+ onValuesChange,
897
+ children: [
898
+ computedProps.beforeItems,
899
+ (_a = computedProps.items) == null ? void 0 : _a.map((item) => (0, import_react10.isValidElement)(item) ? item : /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
900
+ FormItem,
901
+ __spreadProps(__spreadValues({}, item), {
902
+ extendTypes
903
+ }),
904
+ item.id
905
+ )),
906
+ computedProps.children,
907
+ computedProps.submit !== false && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
908
+ import_antd7.Button,
909
+ {
910
+ htmlType: "submit",
911
+ type: "primary",
912
+ loading,
913
+ children: ((_b = computedProps.submit) == null ? void 0 : _b.text) || config.Form.submit.text
914
+ }
915
+ ),
916
+ computedProps.footer
917
+ ]
918
+ })
919
+ );
951
920
  }
952
921
  Form.useForm = import_antd7.Form.useForm;
953
922
  Form.useFormInstance = import_antd7.Form.useFormInstance;
@@ -960,15 +929,13 @@ Form.Provider = import_antd7.Form.Provider;
960
929
  // src/Link.tsx
961
930
  var import_react_router_dom = require("react-router-dom");
962
931
  var import_antd8 = require("antd");
963
- var import_jsx_runtime = require("react/jsx-runtime");
932
+ var import_jsx_runtime10 = require("react/jsx-runtime");
964
933
  function Link(props) {
965
934
  var _a, _b, _c, _d;
966
935
  const { Link: Link2 } = useConfigContext();
967
- let style = {
968
- ...Link2.style || {},
969
- cursor: "pointer",
970
- ...props.style
971
- };
936
+ let style = __spreadValues(__spreadProps(__spreadValues({}, Link2.style || {}), {
937
+ cursor: "pointer"
938
+ }), props.style);
972
939
  if (props.block)
973
940
  style = Object.assign({
974
941
  display: "block",
@@ -976,114 +943,118 @@ function Link(props) {
976
943
  }, style);
977
944
  if (props.href.startsWith("http")) {
978
945
  if (props.button)
979
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd8.Button, {
980
- ...props.button,
946
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
947
+ import_antd8.Button,
948
+ __spreadProps(__spreadValues({}, props.button), {
949
+ target: props.target || (Link2 == null ? void 0 : Link2.target) || "_blank",
950
+ style,
951
+ href: props.href,
952
+ children: (_a = props.text) != null ? _a : props.children
953
+ })
954
+ );
955
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
956
+ "a",
957
+ {
958
+ href: props.href,
981
959
  target: props.target || (Link2 == null ? void 0 : Link2.target) || "_blank",
982
960
  style,
983
- href: props.href,
984
- children: (_a = props.text) != null ? _a : props.children
985
- });
986
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("a", {
987
- href: props.href,
988
- target: props.target || (Link2 == null ? void 0 : Link2.target) || "_blank",
989
- style,
990
- children: (_b = props.text) != null ? _b : props.children
991
- });
961
+ children: (_b = props.text) != null ? _b : props.children
962
+ }
963
+ );
992
964
  }
993
965
  if (props.button)
994
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_router_dom.Link, {
966
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
967
+ import_react_router_dom.Link,
968
+ {
969
+ to: props.href,
970
+ target: props.target || (Link2 == null ? void 0 : Link2.target),
971
+ children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
972
+ import_antd8.Button,
973
+ __spreadProps(__spreadValues({}, props.button), {
974
+ style,
975
+ children: (_c = props.text) != null ? _c : props.children
976
+ })
977
+ )
978
+ }
979
+ );
980
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
981
+ import_react_router_dom.Link,
982
+ {
995
983
  to: props.href,
996
984
  target: props.target || (Link2 == null ? void 0 : Link2.target),
997
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd8.Button, {
998
- ...props.button,
999
- style,
1000
- children: (_c = props.text) != null ? _c : props.children
1001
- })
1002
- });
1003
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_router_dom.Link, {
1004
- to: props.href,
1005
- target: props.target || (Link2 == null ? void 0 : Link2.target),
1006
- style,
1007
- children: (_d = props.text) != null ? _d : props.children
1008
- });
985
+ style,
986
+ children: (_d = props.text) != null ? _d : props.children
987
+ }
988
+ );
1009
989
  }
1010
990
 
1011
991
  // src/Modal.tsx
1012
992
  var import_antd9 = require("antd");
1013
- var import_react10 = require("react");
1014
- var import_jsx_runtime = require("react/jsx-runtime");
993
+ var import_react11 = require("react");
994
+ var import_jsx_runtime11 = require("react/jsx-runtime");
1015
995
  function useModal(init) {
1016
- const [props, setProps] = (0, import_react10.useState)({
996
+ const [props, setProps] = (0, import_react11.useState)(__spreadValues({
1017
997
  open: false,
1018
- onCancel: () => setProps((prev) => ({
1019
- ...prev,
998
+ onCancel: () => setProps((prev) => __spreadProps(__spreadValues({}, prev), {
1020
999
  open: false
1021
- })),
1022
- ...init
1023
- });
1000
+ }))
1001
+ }, init));
1024
1002
  return {
1025
- modal: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd9.Modal, {
1026
- ...props
1027
- }),
1003
+ modal: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_antd9.Modal, __spreadValues({}, props)),
1028
1004
  modalProps: props,
1029
1005
  setModalProps(changes) {
1030
- setProps((prev) => ({
1031
- ...prev,
1032
- ...changes
1033
- }));
1006
+ setProps((prev) => __spreadValues(__spreadValues({}, prev), changes));
1034
1007
  }
1035
1008
  };
1036
1009
  }
1037
1010
 
1038
1011
  // src/Routers.tsx
1039
1012
  var import_antd10 = require("antd");
1040
- var import_react11 = require("react");
1013
+ var import_react12 = require("react");
1041
1014
  var import_react_router_dom2 = require("react-router-dom");
1042
- var import_jsx_runtime = require("react/jsx-runtime");
1015
+ var import_jsx_runtime12 = require("react/jsx-runtime");
1043
1016
  function PageNotFound() {
1044
1017
  const config = useConfigContext();
1045
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd10.Result, {
1046
- status: "404",
1047
- title: config.common.pageNotFound
1048
- });
1018
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1019
+ import_antd10.Result,
1020
+ {
1021
+ status: "404",
1022
+ title: config.common.pageNotFound
1023
+ }
1024
+ );
1049
1025
  }
1050
1026
  function Routes(props) {
1051
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd10.Alert.ErrorBoundary, {
1052
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_react_router_dom2.Routes, {
1053
- children: [
1054
- props.routes.map((r) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_router_dom2.Route, {
1055
- ...r,
1056
- element: r.element || /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react11.Suspense, {
1057
- fallback: props.fallback || /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
1058
- style: { padding: "24px" },
1059
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd10.Skeleton, {
1060
- active: true
1061
- })
1062
- }),
1063
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(r.page, {})
1064
- })
1065
- }, r.path)),
1066
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_router_dom2.Route, {
1067
- path: "*",
1068
- element: props.notFound || /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PageNotFound, {})
1069
- }, "*")
1070
- ]
1071
- })
1072
- });
1027
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_react_router_dom2.Routes, { children: [
1028
+ props.routes.map((r) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1029
+ import_react_router_dom2.Route,
1030
+ __spreadProps(__spreadValues({}, r), {
1031
+ element: r.element || /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_react12.Suspense, { fallback: props.fallback || /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { style: { padding: "24px" }, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_antd10.Skeleton, { active: true }) }), children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(r.page, {}) })
1032
+ }),
1033
+ r.path
1034
+ )),
1035
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1036
+ import_react_router_dom2.Route,
1037
+ {
1038
+ path: "*",
1039
+ element: props.notFound || /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(PageNotFound, {})
1040
+ },
1041
+ "*"
1042
+ )
1043
+ ] });
1073
1044
  }
1074
1045
 
1075
1046
  // src/Table.tsx
1076
- var import_react12 = require("react");
1047
+ var import_react13 = require("react");
1077
1048
  var import_antd11 = require("antd");
1078
1049
  var import_dayjs2 = __toESM(require("dayjs"));
1079
1050
  var import_icons3 = require("@ant-design/icons");
1080
1051
  var import_lodash_es6 = require("lodash-es");
1081
- var import_jsx_runtime = require("react/jsx-runtime");
1052
+ var import_jsx_runtime13 = require("react/jsx-runtime");
1082
1053
  function processValue(item, value) {
1083
1054
  var _a;
1084
1055
  const transferred = transferValue(item.type, value);
1085
1056
  if (transferred === null || Array.isArray(transferred) && transferred.length === 0)
1086
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Blank, {});
1057
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Blank, {});
1087
1058
  if (item.options) {
1088
1059
  if (item.type.endsWith("[]"))
1089
1060
  return transferred.map((v) => {
@@ -1104,9 +1075,9 @@ function processValue(item, value) {
1104
1075
  return value;
1105
1076
  }
1106
1077
  function Table(props) {
1107
- const [columns, setColumns] = (0, import_react12.useState)();
1078
+ const [columns, setColumns] = (0, import_react13.useState)();
1108
1079
  const { common: common2 } = useConfigContext();
1109
- (0, import_react12.useEffect)(() => {
1080
+ (0, import_react13.useEffect)(() => {
1110
1081
  var _a;
1111
1082
  for (const item of props.items) {
1112
1083
  if (!item.key)
@@ -1123,14 +1094,14 @@ function Table(props) {
1123
1094
  text: o.label,
1124
1095
  value: o.value
1125
1096
  })).concat({
1126
- text: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Blank, {}),
1097
+ text: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Blank, {}),
1127
1098
  value: null
1128
1099
  });
1129
1100
  }
1130
1101
  if (item.tableChildren === null)
1131
1102
  item.render = () => null;
1132
1103
  else if (item.tableChildren)
1133
- item.render = (value, values) => (0, import_react12.cloneElement)(
1104
+ item.render = (value, values) => (0, import_react13.cloneElement)(
1134
1105
  item.tableChildren,
1135
1106
  {
1136
1107
  scene: "table",
@@ -1141,7 +1112,7 @@ function Table(props) {
1141
1112
  else if (item.children === null)
1142
1113
  item.render = () => null;
1143
1114
  else if (item.children)
1144
- item.render = (value, values) => (0, import_react12.cloneElement)(
1115
+ item.render = (value, values) => (0, import_react13.cloneElement)(
1145
1116
  item.children,
1146
1117
  {
1147
1118
  scene: "table",
@@ -1151,7 +1122,7 @@ function Table(props) {
1151
1122
  );
1152
1123
  if (props.extendTypes && props.extendTypes[item.type]) {
1153
1124
  if (props.extendTypes[item.type].children)
1154
- item.render = (value, values) => (0, import_react12.cloneElement)(
1125
+ item.render = (value, values) => (0, import_react13.cloneElement)(
1155
1126
  props.extendTypes[item.type].children,
1156
1127
  {
1157
1128
  scene: "table",
@@ -1182,19 +1153,22 @@ function Table(props) {
1182
1153
  setSelectedKeys,
1183
1154
  confirm,
1184
1155
  clearFilters
1185
- }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd11.Input.Search, {
1186
- placeholder: `${common2.search} ${item.title}`,
1187
- allowClear: true,
1188
- onSearch: (v) => {
1189
- if (v) {
1190
- setSelectedKeys([v]);
1191
- } else {
1192
- setSelectedKeys([]);
1193
- clearFilters();
1156
+ }) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1157
+ import_antd11.Input.Search,
1158
+ {
1159
+ placeholder: `${common2.search} ${item.title}`,
1160
+ allowClear: true,
1161
+ onSearch: (v) => {
1162
+ if (v) {
1163
+ setSelectedKeys([v]);
1164
+ } else {
1165
+ setSelectedKeys([]);
1166
+ clearFilters();
1167
+ }
1168
+ confirm();
1194
1169
  }
1195
- confirm();
1196
1170
  }
1197
- });
1171
+ );
1198
1172
  break;
1199
1173
  case "string[]":
1200
1174
  if (!item.render)
@@ -1212,19 +1186,22 @@ function Table(props) {
1212
1186
  setSelectedKeys,
1213
1187
  confirm,
1214
1188
  clearFilters
1215
- }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd11.Input.Search, {
1216
- placeholder: `${common2.search} ${item.title}`,
1217
- allowClear: true,
1218
- onSearch: (v) => {
1219
- if (v) {
1220
- setSelectedKeys([v]);
1221
- } else {
1222
- setSelectedKeys([]);
1223
- clearFilters();
1189
+ }) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1190
+ import_antd11.Input.Search,
1191
+ {
1192
+ placeholder: `${common2.search} ${item.title}`,
1193
+ allowClear: true,
1194
+ onSearch: (v) => {
1195
+ if (v) {
1196
+ setSelectedKeys([v]);
1197
+ } else {
1198
+ setSelectedKeys([]);
1199
+ clearFilters();
1200
+ }
1201
+ confirm();
1224
1202
  }
1225
- confirm();
1226
1203
  }
1227
- });
1204
+ );
1228
1205
  break;
1229
1206
  case "number":
1230
1207
  if (!item.render)
@@ -1242,19 +1219,22 @@ function Table(props) {
1242
1219
  setSelectedKeys,
1243
1220
  confirm,
1244
1221
  clearFilters
1245
- }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd11.Input.Search, {
1246
- placeholder: `${common2.search} ${item.title}`,
1247
- allowClear: true,
1248
- onSearch: (v) => {
1249
- if (v) {
1250
- setSelectedKeys([Number(v)]);
1251
- } else {
1252
- setSelectedKeys([]);
1253
- clearFilters();
1222
+ }) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1223
+ import_antd11.Input.Search,
1224
+ {
1225
+ placeholder: `${common2.search} ${item.title}`,
1226
+ allowClear: true,
1227
+ onSearch: (v) => {
1228
+ if (v) {
1229
+ setSelectedKeys([Number(v)]);
1230
+ } else {
1231
+ setSelectedKeys([]);
1232
+ clearFilters();
1233
+ }
1234
+ confirm();
1254
1235
  }
1255
- confirm();
1256
1236
  }
1257
- });
1237
+ );
1258
1238
  break;
1259
1239
  case "number[]":
1260
1240
  if (!item.render)
@@ -1272,74 +1252,61 @@ function Table(props) {
1272
1252
  setSelectedKeys,
1273
1253
  confirm,
1274
1254
  clearFilters
1275
- }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd11.Input.Search, {
1276
- placeholder: `${common2.search} ${item.title}`,
1277
- allowClear: true,
1278
- onSearch: (v) => {
1279
- if (v) {
1280
- setSelectedKeys([Number(v)]);
1281
- } else {
1282
- setSelectedKeys([]);
1283
- clearFilters();
1255
+ }) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1256
+ import_antd11.Input.Search,
1257
+ {
1258
+ placeholder: `${common2.search} ${item.title}`,
1259
+ allowClear: true,
1260
+ onSearch: (v) => {
1261
+ if (v) {
1262
+ setSelectedKeys([Number(v)]);
1263
+ } else {
1264
+ setSelectedKeys([]);
1265
+ clearFilters();
1266
+ }
1267
+ confirm();
1284
1268
  }
1285
- confirm();
1286
1269
  }
1287
- });
1270
+ );
1288
1271
  break;
1289
1272
  case "boolean":
1290
1273
  if (!item.render)
1291
- item.render = (value) => typeof value === "undefined" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Blank, {}) : value ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons3.CheckOutlined, {
1292
- style: {
1293
- marginTop: "4px",
1294
- color: "#52c41a"
1295
- }
1296
- }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons3.CloseOutlined, {
1297
- style: {
1298
- marginTop: "4px",
1299
- color: "#ff4d4f"
1300
- }
1301
- });
1274
+ item.render = (value) => typeof value === "undefined" ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Blank, {}) : value ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_icons3.CheckOutlined, { style: {
1275
+ marginTop: "4px",
1276
+ color: "#52c41a"
1277
+ } }) : /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_icons3.CloseOutlined, { style: {
1278
+ marginTop: "4px",
1279
+ color: "#ff4d4f"
1280
+ } });
1302
1281
  if (item.filterDropdown !== false)
1303
1282
  item.filterDropdown = ({
1304
1283
  setSelectedKeys,
1305
1284
  selectedKeys,
1306
1285
  confirm
1307
- }) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_antd11.Radio.Group, {
1308
- style: { padding: 8 },
1309
- buttonStyle: "solid",
1310
- value: selectedKeys[0],
1311
- onChange: (e) => {
1312
- setSelectedKeys(e.target.value ? [e.target.value] : []);
1313
- confirm();
1314
- },
1315
- children: [
1316
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd11.Radio.Button, {
1317
- children: common2.all
1318
- }),
1319
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd11.Radio.Button, {
1320
- value: "true",
1321
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons3.CheckOutlined, {
1322
- style: {
1323
- color: "#52c41a",
1324
- verticalAlign: "middle"
1325
- }
1326
- })
1327
- }),
1328
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd11.Radio.Button, {
1329
- value: "false",
1330
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons3.CloseOutlined, {
1331
- style: {
1332
- verticalAlign: "middle",
1333
- color: "#ff4d4f"
1334
- }
1335
- })
1336
- }),
1337
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd11.Radio.Button, {
1338
- value: "empty",
1339
- children: common2.blank
1340
- })
1341
- ]
1342
- });
1286
+ }) => /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
1287
+ import_antd11.Radio.Group,
1288
+ {
1289
+ style: { padding: 8 },
1290
+ buttonStyle: "solid",
1291
+ value: selectedKeys[0],
1292
+ onChange: (e) => {
1293
+ setSelectedKeys(e.target.value ? [e.target.value] : []);
1294
+ confirm();
1295
+ },
1296
+ children: [
1297
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_antd11.Radio.Button, { children: common2.all }),
1298
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_antd11.Radio.Button, { value: "true", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_icons3.CheckOutlined, { style: {
1299
+ color: "#52c41a",
1300
+ verticalAlign: "middle"
1301
+ } }) }),
1302
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_antd11.Radio.Button, { value: "false", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_icons3.CloseOutlined, { style: {
1303
+ verticalAlign: "middle",
1304
+ color: "#ff4d4f"
1305
+ } }) }),
1306
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_antd11.Radio.Button, { value: "empty", children: common2.blank })
1307
+ ]
1308
+ }
1309
+ );
1343
1310
  if (!item.onFilter)
1344
1311
  item.onFilter = (value, row) => {
1345
1312
  switch (value) {
@@ -1372,21 +1339,26 @@ function Table(props) {
1372
1339
  break;
1373
1340
  case "object":
1374
1341
  if (!item.render)
1375
- item.render = (value) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Description, {
1376
- items: item.object,
1377
- dataSource: value || {},
1378
- column: 1
1379
- });
1342
+ item.render = (value) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1343
+ Description,
1344
+ {
1345
+ items: item.object,
1346
+ dataSource: value || {},
1347
+ column: 1
1348
+ }
1349
+ );
1380
1350
  break;
1381
1351
  case "object[]":
1382
1352
  if (!item.render)
1383
- item.render = (value) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, {
1384
- children: value.map((v, i) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Description, {
1353
+ item.render = (value) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_jsx_runtime13.Fragment, { children: value.map((v, i) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1354
+ Description,
1355
+ {
1385
1356
  items: item.object,
1386
1357
  dataSource: v || [],
1387
1358
  column: 1
1388
- }, i))
1389
- });
1359
+ },
1360
+ i
1361
+ )) });
1390
1362
  break;
1391
1363
  default:
1392
1364
  if (!item.render)
@@ -1402,7 +1374,7 @@ function Table(props) {
1402
1374
  }
1403
1375
  setColumns(props.items);
1404
1376
  }, [props.items]);
1405
- (0, import_react12.useEffect)(() => {
1377
+ (0, import_react13.useEffect)(() => {
1406
1378
  if (!props.dataSource || !columns)
1407
1379
  return;
1408
1380
  for (const column of columns) {
@@ -1416,7 +1388,7 @@ function Table(props) {
1416
1388
  const newColumns = [...prev];
1417
1389
  const index = newColumns.findIndex((item) => item.id === column.id);
1418
1390
  newColumns[index].filters = filters.concat({
1419
- text: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Blank, {}),
1391
+ text: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Blank, {}),
1420
1392
  value: null
1421
1393
  });
1422
1394
  return newColumns;
@@ -1427,19 +1399,26 @@ function Table(props) {
1427
1399
  if (!columns)
1428
1400
  return null;
1429
1401
  if (!props.faasData)
1430
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd11.Table, {
1431
- ...props,
1432
- rowKey: props.rowKey || "id",
1433
- columns,
1434
- dataSource: props.dataSource
1435
- });
1436
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FaasDataWrapper, {
1437
- ...props.faasData,
1438
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FaasDataTable, {
1439
- props,
1440
- columns
1402
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1403
+ import_antd11.Table,
1404
+ __spreadProps(__spreadValues({}, props), {
1405
+ rowKey: props.rowKey || "id",
1406
+ columns,
1407
+ dataSource: props.dataSource
1408
+ })
1409
+ );
1410
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1411
+ FaasDataWrapper2,
1412
+ __spreadProps(__spreadValues({}, props.faasData), {
1413
+ children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1414
+ FaasDataTable,
1415
+ {
1416
+ props,
1417
+ columns
1418
+ }
1419
+ )
1441
1420
  })
1442
- });
1421
+ );
1443
1422
  }
1444
1423
  function FaasDataTable({
1445
1424
  props,
@@ -1448,8 +1427,8 @@ function FaasDataTable({
1448
1427
  params,
1449
1428
  reload
1450
1429
  }) {
1451
- const [currentColumns, setCurrentColumns] = (0, import_react12.useState)(columns);
1452
- (0, import_react12.useEffect)(() => {
1430
+ const [currentColumns, setCurrentColumns] = (0, import_react13.useState)(columns);
1431
+ (0, import_react13.useEffect)(() => {
1453
1432
  if (!data || Array.isArray(data))
1454
1433
  return;
1455
1434
  setCurrentColumns((prev) => {
@@ -1461,7 +1440,7 @@ function FaasDataTable({
1461
1440
  text: v.label,
1462
1441
  value: v.value
1463
1442
  })).concat({
1464
- text: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Blank, {}),
1443
+ text: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Blank, {}),
1465
1444
  value: null
1466
1445
  });
1467
1446
  column.render = (value) => processValue(column, value);
@@ -1476,7 +1455,7 @@ function FaasDataTable({
1476
1455
  }));
1477
1456
  if (filters.length)
1478
1457
  column.filters = filters.concat({
1479
- text: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Blank, {}),
1458
+ text: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Blank, {}),
1480
1459
  value: null
1481
1460
  });
1482
1461
  }
@@ -1485,75 +1464,75 @@ function FaasDataTable({
1485
1464
  });
1486
1465
  }, [columns, data]);
1487
1466
  if (!data)
1488
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd11.Table, {
1489
- ...props,
1490
- rowKey: props.rowKey || "id",
1491
- columns: currentColumns,
1492
- dataSource: []
1493
- });
1467
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1468
+ import_antd11.Table,
1469
+ __spreadProps(__spreadValues({}, props), {
1470
+ rowKey: props.rowKey || "id",
1471
+ columns: currentColumns,
1472
+ dataSource: []
1473
+ })
1474
+ );
1494
1475
  if (Array.isArray(data))
1495
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd11.Table, {
1496
- ...props,
1476
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1477
+ import_antd11.Table,
1478
+ __spreadProps(__spreadValues({}, props), {
1479
+ rowKey: props.rowKey || "id",
1480
+ columns: currentColumns,
1481
+ dataSource: data
1482
+ })
1483
+ );
1484
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1485
+ import_antd11.Table,
1486
+ __spreadProps(__spreadValues({}, props), {
1497
1487
  rowKey: props.rowKey || "id",
1498
1488
  columns: currentColumns,
1499
- dataSource: data
1500
- });
1501
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd11.Table, {
1502
- ...props,
1503
- rowKey: props.rowKey || "id",
1504
- columns: currentColumns,
1505
- dataSource: data.rows,
1506
- pagination: {
1507
- ...props.pagination,
1508
- ...data.pagination
1509
- },
1510
- onChange: (pagination, filters, sorter, extra) => {
1511
- if (props.onChange) {
1512
- const processed = props.onChange(pagination, filters, sorter, extra);
1513
- reload({
1514
- ...params,
1515
- pagination: processed.pagination,
1516
- filters: processed.filters,
1517
- sorter: processed.sorter
1518
- });
1519
- return;
1489
+ dataSource: data.rows,
1490
+ pagination: __spreadValues(__spreadValues({}, props.pagination), data.pagination),
1491
+ onChange: (pagination, filters, sorter, extra) => {
1492
+ if (props.onChange) {
1493
+ const processed = props.onChange(pagination, filters, sorter, extra);
1494
+ reload(__spreadProps(__spreadValues({}, params), {
1495
+ pagination: processed.pagination,
1496
+ filters: processed.filters,
1497
+ sorter: processed.sorter
1498
+ }));
1499
+ return;
1500
+ }
1501
+ reload(__spreadProps(__spreadValues({}, params), {
1502
+ pagination,
1503
+ filters,
1504
+ sorter
1505
+ }));
1520
1506
  }
1521
- reload({
1522
- ...params,
1523
- pagination,
1524
- filters,
1525
- sorter
1526
- });
1527
- }
1528
- });
1507
+ })
1508
+ );
1529
1509
  }
1530
1510
 
1531
1511
  // src/Title.tsx
1532
- var import_react13 = require("react");
1533
- var import_jsx_runtime = require("react/jsx-runtime");
1512
+ var import_react14 = require("react");
1513
+ var import_jsx_runtime14 = require("react/jsx-runtime");
1534
1514
  function Title(props) {
1535
1515
  const { Title: Title2 } = useConfigContext();
1536
- (0, import_react13.useEffect)(() => {
1516
+ (0, import_react14.useEffect)(() => {
1537
1517
  const title = Array.isArray(props.title) ? props.title : [props.title];
1538
1518
  document.title = title.concat(props.suffix || Title2.suffix).filter((t) => !!t).join(props.separator || Title2.separator);
1539
1519
  }, [props]);
1540
1520
  if (props.h1) {
1541
1521
  if (typeof props.h1 === "boolean")
1542
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("h1", {
1522
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("h1", { children: Array.isArray(props.title) ? props.title[0] : props.title });
1523
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1524
+ "h1",
1525
+ {
1526
+ className: props.h1.className,
1527
+ style: props.h1.style,
1543
1528
  children: Array.isArray(props.title) ? props.title[0] : props.title
1544
- });
1545
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("h1", {
1546
- className: props.h1.className,
1547
- style: props.h1.style,
1548
- children: Array.isArray(props.title) ? props.title[0] : props.title
1549
- });
1529
+ }
1530
+ );
1550
1531
  }
1551
1532
  if (props.plain)
1552
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, {
1553
- children: Array.isArray(props.title) ? props.title[0] : props.title
1554
- });
1533
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_jsx_runtime14.Fragment, { children: Array.isArray(props.title) ? props.title[0] : props.title });
1555
1534
  if (props.children)
1556
- return (0, import_react13.cloneElement)(props.children, { title: props.title });
1535
+ return (0, import_react14.cloneElement)(props.children, { title: props.title });
1557
1536
  return null;
1558
1537
  }
1559
1538
  // Annotate the CommonJS export names for ESM import in node: