@faasjs/ant-design 0.0.3-beta.64 → 0.0.3-beta.65

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,27 +1,10 @@
1
1
  "use strict";
2
2
  var __create = Object.create;
3
3
  var __defProp = Object.defineProperty;
4
- var __defProps = Object.defineProperties;
5
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
- var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
7
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
8
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
9
6
  var __getProtoOf = Object.getPrototypeOf;
10
7
  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));
25
8
  var __export = (target, all) => {
26
9
  for (var name in all)
27
10
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -35,10 +18,6 @@ var __copyProps = (to, from, except, desc) => {
35
18
  return to;
36
19
  };
37
20
  var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
38
- // If the importer is in node compatibility mode or this is not an ESM
39
- // file that has been converted to a CommonJS file using a Babel-
40
- // compatible transform (i.e. "__esModule" has not been set), then set
41
- // "default" to the CommonJS "module.exports" for node compatibility.
42
21
  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
43
22
  mod
44
23
  ));
@@ -54,7 +33,7 @@ __export(src_exports, {
54
33
  Description: () => Description,
55
34
  Drawer: () => import_antd2.Drawer,
56
35
  ErrorBoundary: () => ErrorBoundary,
57
- FaasDataWrapper: () => FaasDataWrapper2,
36
+ FaasDataWrapper: () => FaasDataWrapper,
58
37
  Form: () => Form,
59
38
  FormItem: () => FormItem,
60
39
  Link: () => Link,
@@ -64,7 +43,7 @@ __export(src_exports, {
64
43
  Routes: () => Routes,
65
44
  Table: () => Table,
66
45
  Title: () => Title,
67
- lazy: () => import_react14.lazy,
46
+ lazy: () => import_react13.lazy,
68
47
  transferOptions: () => transferOptions,
69
48
  transferValue: () => transferValue,
70
49
  useApp: () => useApp,
@@ -87,17 +66,24 @@ var import_antd = require("antd");
87
66
  var import_react2 = require("react");
88
67
  var import_jsx_runtime = require("react/jsx-runtime");
89
68
  function useModal(init) {
90
- const [props, setProps] = (0, import_react2.useState)(__spreadValues({
69
+ const [props, setProps] = (0, import_react2.useState)({
91
70
  open: false,
92
- onCancel: () => setProps((prev) => __spreadProps(__spreadValues({}, prev), {
71
+ onCancel: () => setProps((prev) => ({
72
+ ...prev,
93
73
  open: false
94
- }))
95
- }, init));
74
+ })),
75
+ ...init
76
+ });
96
77
  return {
97
- modal: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd.Modal, __spreadValues({}, props)),
78
+ modal: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd.Modal, {
79
+ ...props
80
+ }),
98
81
  modalProps: props,
99
82
  setModalProps(changes) {
100
- setProps((prev) => __spreadValues(__spreadValues({}, prev), changes));
83
+ setProps((prev) => ({
84
+ ...prev,
85
+ ...changes
86
+ }));
101
87
  }
102
88
  };
103
89
  }
@@ -105,26 +91,33 @@ function useModal(init) {
105
91
  // src/Drawer.tsx
106
92
  var import_antd2 = require("antd");
107
93
  var import_react3 = require("react");
108
- var import_jsx_runtime2 = require("react/jsx-runtime");
94
+ var import_jsx_runtime = require("react/jsx-runtime");
109
95
  function useDrawer(init) {
110
- const [props, setProps] = (0, import_react3.useState)(__spreadValues({
96
+ const [props, setProps] = (0, import_react3.useState)({
111
97
  open: false,
112
- onClose: () => setProps((prev) => __spreadProps(__spreadValues({}, prev), {
98
+ onClose: () => setProps((prev) => ({
99
+ ...prev,
113
100
  open: false
114
- }))
115
- }, init));
101
+ })),
102
+ ...init
103
+ });
116
104
  return {
117
- drawer: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_antd2.Drawer, __spreadValues({}, props)),
105
+ drawer: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd2.Drawer, {
106
+ ...props
107
+ }),
118
108
  drawerProps: props,
119
109
  setDrawerProps(changes) {
120
- setProps((prev) => __spreadValues(__spreadValues({}, prev), changes));
110
+ setProps((prev) => ({
111
+ ...prev,
112
+ ...changes
113
+ }));
121
114
  }
122
115
  };
123
116
  }
124
117
 
125
118
  // src/App.tsx
126
119
  var import_react_router_dom = require("react-router-dom");
127
- var import_jsx_runtime3 = require("react/jsx-runtime");
120
+ var import_jsx_runtime = require("react/jsx-runtime");
128
121
  var AppContext = (0, import_react4.createContext)({
129
122
  message: {},
130
123
  notification: {},
@@ -139,7 +132,9 @@ function RoutesApp(props) {
139
132
  setDrawerProps({ open: false });
140
133
  setModalProps({ open: false });
141
134
  }, [location]);
142
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_jsx_runtime3.Fragment, { children: props.children });
135
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, {
136
+ children: props.children
137
+ });
143
138
  }
144
139
  function App(props) {
145
140
  const [messageApi, messageContextHolder] = import_antd3.message.useMessage();
@@ -160,21 +155,30 @@ function App(props) {
160
155
  setDrawerProps
161
156
  ]
162
157
  );
163
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
164
- import_cssinjs.StyleProvider,
165
- __spreadProps(__spreadValues({}, Object.assign(props.styleProviderProps || {}, {
158
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_cssinjs.StyleProvider, {
159
+ ...Object.assign(props.styleProviderProps || {}, {
166
160
  hashPriority: "high",
167
161
  transformers: [import_cssinjs.legacyLogicalPropertiesTransformer]
168
- })), {
169
- children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_antd3.ConfigProvider, __spreadProps(__spreadValues({}, props.configProviderProps), { children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(AppContext.Provider, { value: memoizedContextValue, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_react_router_dom.BrowserRouter, __spreadProps(__spreadValues({}, props.browserRouterProps), { children: [
170
- messageContextHolder,
171
- notificationContextHolder,
172
- modal,
173
- drawer,
174
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(RoutesApp, { children: props.children })
175
- ] })) }) }))
162
+ }),
163
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd3.ConfigProvider, {
164
+ ...props.configProviderProps,
165
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AppContext.Provider, {
166
+ value: memoizedContextValue,
167
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_react_router_dom.BrowserRouter, {
168
+ ...props.browserRouterProps,
169
+ children: [
170
+ messageContextHolder,
171
+ notificationContextHolder,
172
+ modal,
173
+ drawer,
174
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(RoutesApp, {
175
+ children: props.children
176
+ })
177
+ ]
178
+ })
179
+ })
176
180
  })
177
- );
181
+ });
178
182
  }
179
183
  function useApp() {
180
184
  return (0, import_react4.useContext)(AppContext);
@@ -188,7 +192,7 @@ var import_lodash_es2 = require("lodash-es");
188
192
  // src/Config.tsx
189
193
  var import_react5 = require("react");
190
194
  var import_lodash_es = require("lodash-es");
191
- var import_jsx_runtime4 = require("react/jsx-runtime");
195
+ var import_jsx_runtime = require("react/jsx-runtime");
192
196
  var isZH = /^zh/i.test(navigator.language);
193
197
  var zh = {
194
198
  lang: "zh",
@@ -244,17 +248,23 @@ function ConfigProvider2({
244
248
  } else
245
249
  setValues((0, import_lodash_es.defaultsDeep)(config, values));
246
250
  }, []);
247
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(ConfigContext.Provider, { value: values, children });
251
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ConfigContext.Provider, {
252
+ value: values,
253
+ children
254
+ });
248
255
  }
249
256
  function useConfigContext() {
250
257
  return (0, import_react5.useContext)(ConfigContext);
251
258
  }
252
259
 
253
260
  // src/Blank.tsx
254
- var import_jsx_runtime5 = require("react/jsx-runtime");
261
+ var import_jsx_runtime = require("react/jsx-runtime");
255
262
  function Blank(options) {
256
263
  const { Blank: Blank2 } = useConfigContext();
257
- return !options || (0, import_lodash_es2.isNil)(options.value) || Array.isArray(options.value) && !options.value.length || options.value === "" ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_antd4.Typography.Text, { disabled: true, children: (options == null ? void 0 : options.text) || Blank2.text }) : options.value;
264
+ 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_antd4.Typography.Text, {
265
+ disabled: true,
266
+ children: (options == null ? void 0 : options.text) || Blank2.text
267
+ }) : options.value;
258
268
  }
259
269
 
260
270
  // src/data.ts
@@ -288,63 +298,52 @@ function transferValue(type, value) {
288
298
  var import_icons = require("@ant-design/icons");
289
299
  var import_antd6 = require("antd");
290
300
  var import_lodash_es4 = require("lodash-es");
291
- var import_react8 = require("react");
301
+ var import_react7 = require("react");
292
302
 
293
- // ../react/src/index.tsx
294
- var import_react6 = require("react");
295
- var clients = {};
296
- function getClient(domain) {
297
- const client = clients[domain || Object.keys(clients)[0]];
298
- if (!client)
299
- throw Error("FaasReactClient is not initialized");
300
- return client;
301
- }
302
- async function faas(action, params) {
303
- return getClient().faas(action, params);
304
- }
305
- function FaasDataWrapper(props) {
306
- const [client, setClient] = (0, import_react6.useState)();
307
- (0, import_react6.useEffect)(() => {
308
- if (client)
309
- return;
310
- setClient(getClient());
311
- }, []);
312
- if (!client)
313
- return props.fallback || null;
314
- return (0, import_react6.createElement)(client.FaasDataWrapper, props);
315
- }
303
+ // src/FaasDataWrapper.tsx
304
+ var import_react6 = require("@faasjs/react");
316
305
 
317
306
  // src/Loading.tsx
318
307
  var import_antd5 = require("antd");
319
- var import_jsx_runtime6 = require("react/jsx-runtime");
308
+ var import_jsx_runtime = require("react/jsx-runtime");
320
309
  function Loading(props) {
321
310
  if (props.loading === false)
322
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_jsx_runtime6.Fragment, { children: props.children });
323
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { style: __spreadValues(__spreadValues({}, props.style || {}), !props.size || props.size === "large" ? {
324
- margin: "20vh auto",
325
- textAlign: "center"
326
- } : {}), children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_antd5.Spin, { size: props.size || "large" }) });
311
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, {
312
+ children: props.children
313
+ });
314
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
315
+ style: {
316
+ ...props.style || {},
317
+ ...!props.size || props.size === "large" ? {
318
+ margin: "20vh auto",
319
+ textAlign: "center"
320
+ } : {}
321
+ },
322
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Spin, {
323
+ size: props.size || "large"
324
+ })
325
+ });
327
326
  }
328
327
 
329
328
  // src/FaasDataWrapper.tsx
330
- var import_jsx_runtime7 = require("react/jsx-runtime");
331
- function FaasDataWrapper2(props) {
332
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
333
- FaasDataWrapper,
334
- __spreadValues({
335
- fallback: props.loading || /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Loading, __spreadValues({}, props.loadingProps))
336
- }, props)
337
- );
329
+ var import_jsx_runtime = require("react/jsx-runtime");
330
+ function FaasDataWrapper(props) {
331
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react6.FaasDataWrapper, {
332
+ fallback: props.loading || /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Loading, {
333
+ ...props.loadingProps
334
+ }),
335
+ ...props
336
+ });
338
337
  }
339
338
 
340
339
  // src/Description.tsx
341
- var import_jsx_runtime8 = require("react/jsx-runtime");
340
+ var import_jsx_runtime = require("react/jsx-runtime");
342
341
  function DescriptionItemContent(props) {
343
342
  var _a;
344
- const [computedProps, setComputedProps] = (0, import_react8.useState)();
345
- (0, import_react8.useEffect)(() => {
343
+ const [computedProps, setComputedProps] = (0, import_react7.useState)();
344
+ (0, import_react7.useEffect)(() => {
346
345
  var _a2, _b;
347
- const propsCopy = __spreadValues({}, props);
346
+ const propsCopy = { ...props };
348
347
  if (!propsCopy.item.title)
349
348
  propsCopy.item.title = (0, import_lodash_es4.upperFirst)(propsCopy.item.id);
350
349
  if (!propsCopy.item.type)
@@ -372,7 +371,7 @@ function DescriptionItemContent(props) {
372
371
  return null;
373
372
  if (computedProps.extendTypes && computedProps.extendTypes[computedProps.item.type])
374
373
  if (computedProps.extendTypes[computedProps.item.type].children)
375
- return (0, import_react8.cloneElement)(
374
+ return (0, import_react7.cloneElement)(
376
375
  computedProps.extendTypes[computedProps.item.type].children,
377
376
  {
378
377
  scene: "description",
@@ -381,13 +380,15 @@ function DescriptionItemContent(props) {
381
380
  }
382
381
  );
383
382
  else if (computedProps.extendTypes[computedProps.item.type].render)
384
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_jsx_runtime8.Fragment, { children: computedProps.extendTypes[computedProps.item.type].render(computedProps.value, computedProps.values, 0, "description") });
383
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, {
384
+ children: computedProps.extendTypes[computedProps.item.type].render(computedProps.value, computedProps.values, 0, "description")
385
+ });
385
386
  else
386
387
  throw Error(computedProps.item.type + " requires children or render");
387
388
  if (computedProps.item.descriptionChildren === null)
388
389
  return null;
389
390
  if (computedProps.item.descriptionChildren)
390
- return (0, import_react8.cloneElement)(computedProps.item.descriptionChildren, {
391
+ return (0, import_react7.cloneElement)(computedProps.item.descriptionChildren, {
391
392
  scene: "description",
392
393
  value: computedProps.value,
393
394
  values: computedProps.values
@@ -395,7 +396,7 @@ function DescriptionItemContent(props) {
395
396
  if (computedProps.item.children === null)
396
397
  return null;
397
398
  if (computedProps.item.children)
398
- return (0, import_react8.cloneElement)(computedProps.item.children, {
399
+ return (0, import_react7.cloneElement)(computedProps.item.children, {
399
400
  scene: "description",
400
401
  value: computedProps.value,
401
402
  values: computedProps.values
@@ -405,117 +406,105 @@ function DescriptionItemContent(props) {
405
406
  if (computedProps.item.render)
406
407
  return computedProps.item.render(computedProps.value, computedProps.values, 0, "description");
407
408
  if (computedProps.value === null || Array.isArray(computedProps.value) && !computedProps.value.length)
408
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Blank, {});
409
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Blank, {});
409
410
  switch (computedProps.item.type) {
410
411
  case "string[]":
411
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_jsx_runtime8.Fragment, { children: computedProps.value.join(", ") });
412
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, {
413
+ children: computedProps.value.join(", ")
414
+ });
412
415
  case "number":
413
416
  return computedProps.value || null;
414
417
  case "number[]":
415
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_jsx_runtime8.Fragment, { children: computedProps.value.join(", ") });
418
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, {
419
+ children: computedProps.value.join(", ")
420
+ });
416
421
  case "boolean":
417
- return computedProps.value ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_icons.CheckOutlined, { style: {
418
- marginTop: "4px",
419
- color: "#52c41a"
420
- } }) : /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_icons.CloseOutlined, { style: {
421
- marginTop: "4px",
422
- color: "#ff4d4f"
423
- } });
422
+ return computedProps.value ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons.CheckOutlined, {
423
+ style: {
424
+ marginTop: "4px",
425
+ color: "#52c41a"
426
+ }
427
+ }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons.CloseOutlined, {
428
+ style: {
429
+ marginTop: "4px",
430
+ color: "#ff4d4f"
431
+ }
432
+ });
424
433
  case "time":
425
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_jsx_runtime8.Fragment, { children: computedProps.value.format("YYYY-MM-DD HH:mm:ss") });
434
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, {
435
+ children: computedProps.value.format("YYYY-MM-DD HH:mm:ss")
436
+ });
426
437
  case "date":
427
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_jsx_runtime8.Fragment, { children: computedProps.value.format("YYYY-MM-DD") });
438
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, {
439
+ children: computedProps.value.format("YYYY-MM-DD")
440
+ });
428
441
  case "object":
429
442
  if (!computedProps.value)
430
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Blank, {});
431
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
432
- Description,
433
- {
434
- items: computedProps.item.object,
435
- dataSource: computedProps.value,
436
- column: 1
437
- }
438
- );
443
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Blank, {});
444
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Description, {
445
+ items: computedProps.item.object,
446
+ dataSource: computedProps.value,
447
+ column: 1
448
+ });
439
449
  case "object[]":
440
450
  if (!((_a = computedProps.value) == null ? void 0 : _a.length))
441
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Blank, {});
442
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_antd6.Space, { direction: "vertical", children: computedProps.value.map((value, index) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
443
- Description,
444
- {
451
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Blank, {});
452
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd6.Space, {
453
+ direction: "vertical",
454
+ children: computedProps.value.map((value, index) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Description, {
445
455
  items: computedProps.item.object,
446
456
  dataSource: value,
447
457
  column: 1
448
- },
449
- index
450
- )) });
458
+ }, index))
459
+ });
451
460
  default:
452
461
  return computedProps.value || null;
453
462
  }
454
463
  }
455
464
  function Description(props) {
456
465
  if (props.dataSource)
457
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
458
- import_antd6.Descriptions,
459
- __spreadProps(__spreadValues({}, props), {
460
- title: (0, import_lodash_es4.isFunction)(props.renderTitle) ? props.renderTitle(props.dataSource) : props.title,
466
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd6.Descriptions, {
467
+ ...props,
468
+ title: (0, import_lodash_es4.isFunction)(props.renderTitle) ? props.renderTitle(props.dataSource) : props.title,
469
+ children: props.items.map((item) => {
470
+ return !item.if || item.if(props.dataSource) ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd6.Descriptions.Item, {
471
+ label: item.title || (0, import_lodash_es4.upperFirst)(item.id),
472
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DescriptionItemContent, {
473
+ item,
474
+ value: props.dataSource[item.id],
475
+ values: props.dataSource,
476
+ extendTypes: props.extendTypes
477
+ })
478
+ }, item.id) : null;
479
+ }).filter(Boolean)
480
+ });
481
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FaasDataWrapper, {
482
+ render: ({ data }) => {
483
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd6.Descriptions, {
484
+ ...props,
485
+ title: (0, import_lodash_es4.isFunction)(props.renderTitle) ? props.renderTitle(data) : props.title,
461
486
  children: props.items.map((item) => {
462
- return !item.if || item.if(props.dataSource) ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
463
- import_antd6.Descriptions.Item,
464
- {
465
- label: item.title || (0, import_lodash_es4.upperFirst)(item.id),
466
- children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
467
- DescriptionItemContent,
468
- {
469
- item,
470
- value: props.dataSource[item.id],
471
- values: props.dataSource,
472
- extendTypes: props.extendTypes
473
- }
474
- )
475
- },
476
- item.id
477
- ) : null;
487
+ return !item.if || item.if(data) ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd6.Descriptions.Item, {
488
+ label: item.title || (0, import_lodash_es4.upperFirst)(item.id),
489
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DescriptionItemContent, {
490
+ item,
491
+ value: data[item.id],
492
+ values: data,
493
+ extendTypes: props.extendTypes
494
+ })
495
+ }, item.id) : null;
478
496
  }).filter(Boolean)
479
- })
480
- );
481
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
482
- FaasDataWrapper2,
483
- __spreadValues({
484
- render: ({ data }) => {
485
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
486
- import_antd6.Descriptions,
487
- __spreadProps(__spreadValues({}, props), {
488
- title: (0, import_lodash_es4.isFunction)(props.renderTitle) ? props.renderTitle(data) : props.title,
489
- children: props.items.map((item) => {
490
- return !item.if || item.if(data) ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
491
- import_antd6.Descriptions.Item,
492
- {
493
- label: item.title || (0, import_lodash_es4.upperFirst)(item.id),
494
- children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
495
- DescriptionItemContent,
496
- {
497
- item,
498
- value: data[item.id],
499
- values: data,
500
- extendTypes: props.extendTypes
501
- }
502
- )
503
- },
504
- item.id
505
- ) : null;
506
- }).filter(Boolean)
507
- })
508
- );
509
- }
510
- }, props.faasData)
511
- );
497
+ });
498
+ },
499
+ ...props.faasData
500
+ });
512
501
  }
513
502
 
514
503
  // src/ErrorBoundary.tsx
515
- var import_react9 = require("react");
504
+ var import_react8 = require("react");
516
505
  var import_antd7 = require("antd");
517
- var import_jsx_runtime9 = require("react/jsx-runtime");
518
- var ErrorBoundary = class extends import_react9.Component {
506
+ var import_jsx_runtime = require("react/jsx-runtime");
507
+ var ErrorBoundary = class extends import_react8.Component {
519
508
  constructor(props) {
520
509
  super(props);
521
510
  this.state = {
@@ -542,32 +531,33 @@ var ErrorBoundary = class extends import_react9.Component {
542
531
  if (error) {
543
532
  if (this.props.onError)
544
533
  return this.props.onError(error, info);
545
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
546
- import_antd7.Alert,
547
- {
548
- type: "error",
549
- message: errorMessage,
550
- description: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("pre", { style: {
534
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd7.Alert, {
535
+ type: "error",
536
+ message: errorMessage,
537
+ description: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("pre", {
538
+ style: {
551
539
  fontSize: "0.9em",
552
540
  overflowX: "auto"
553
- }, children: errorDescription })
554
- }
555
- );
541
+ },
542
+ children: errorDescription
543
+ })
544
+ });
556
545
  }
557
546
  return children;
558
547
  }
559
548
  };
560
549
 
561
550
  // src/Form.tsx
551
+ var import_react10 = require("@faasjs/react");
562
552
  var import_antd9 = require("antd");
563
- var import_react12 = require("react");
553
+ var import_react11 = require("react");
564
554
 
565
555
  // src/FormItem.tsx
566
556
  var import_antd8 = require("antd");
567
557
  var import_icons2 = require("@ant-design/icons");
568
- var import_react10 = require("react");
558
+ var import_react9 = require("react");
569
559
  var import_lodash_es5 = require("lodash-es");
570
- var import_jsx_runtime10 = require("react/jsx-runtime");
560
+ var import_jsx_runtime = require("react/jsx-runtime");
571
561
  function processProps(propsCopy, config) {
572
562
  if (!propsCopy.title)
573
563
  propsCopy.title = (0, import_lodash_es5.upperFirst)(propsCopy.id);
@@ -616,12 +606,12 @@ function processProps(propsCopy, config) {
616
606
  }
617
607
  function FormItem(props) {
618
608
  var _a;
619
- const [computedProps, setComputedProps] = (0, import_react10.useState)();
620
- const [extendTypes, setExtendTypes] = (0, import_react10.useState)();
609
+ const [computedProps, setComputedProps] = (0, import_react9.useState)();
610
+ const [extendTypes, setExtendTypes] = (0, import_react9.useState)();
621
611
  const { common: common2 } = useConfigContext();
622
- const [hidden, setHidden] = (0, import_react10.useState)(props.hidden || false);
623
- (0, import_react10.useEffect)(() => {
624
- const propsCopy = __spreadValues({}, props);
612
+ const [hidden, setHidden] = (0, import_react9.useState)(props.hidden || false);
613
+ (0, import_react9.useEffect)(() => {
614
+ const propsCopy = { ...props };
625
615
  if (propsCopy.extendTypes) {
626
616
  setExtendTypes(propsCopy.extendTypes);
627
617
  delete propsCopy.extendTypes;
@@ -644,248 +634,312 @@ function FormItem(props) {
644
634
  if (!computedProps)
645
635
  return null;
646
636
  if (hidden)
647
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
648
- import_antd8.Form.Item,
649
- __spreadProps(__spreadValues({}, computedProps), {
650
- noStyle: true,
651
- rules: [],
652
- children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_antd8.Input, { hidden: true })
637
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd8.Form.Item, {
638
+ ...computedProps,
639
+ noStyle: true,
640
+ rules: [],
641
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd8.Input, {
642
+ hidden: true
653
643
  })
654
- );
644
+ });
655
645
  if (extendTypes && extendTypes[computedProps.type])
656
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_antd8.Form.Item, __spreadProps(__spreadValues({}, computedProps), { children: extendTypes[computedProps.type].children }));
646
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd8.Form.Item, {
647
+ ...computedProps,
648
+ children: extendTypes[computedProps.type].children
649
+ });
657
650
  if (computedProps.formChildren === null)
658
651
  return null;
659
652
  if (computedProps.formChildren)
660
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_antd8.Form.Item, __spreadProps(__spreadValues({}, computedProps), { children: (0, import_react10.cloneElement)(computedProps.formChildren, { scene: "form" }) }));
653
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd8.Form.Item, {
654
+ ...computedProps,
655
+ children: (0, import_react9.cloneElement)(computedProps.formChildren, { scene: "form" })
656
+ });
661
657
  if (computedProps.children === null)
662
658
  return null;
663
659
  if (computedProps.children)
664
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_antd8.Form.Item, __spreadProps(__spreadValues({}, computedProps), { children: (0, import_react10.cloneElement)(computedProps.children, { scene: "form" }) }));
660
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd8.Form.Item, {
661
+ ...computedProps,
662
+ children: (0, import_react9.cloneElement)(computedProps.children, { scene: "form" })
663
+ });
665
664
  if (computedProps.formRender)
666
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_antd8.Form.Item, __spreadProps(__spreadValues({}, computedProps), { children: computedProps.formRender(null, null, 0, "form") }));
665
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd8.Form.Item, {
666
+ ...computedProps,
667
+ children: computedProps.formRender(null, null, 0, "form")
668
+ });
667
669
  if (computedProps.render)
668
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_antd8.Form.Item, __spreadProps(__spreadValues({}, computedProps), { children: computedProps.render(null, null, 0, "form") }));
670
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd8.Form.Item, {
671
+ ...computedProps,
672
+ children: computedProps.render(null, null, 0, "form")
673
+ });
669
674
  switch (computedProps.type) {
670
675
  case "string":
671
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_antd8.Form.Item, __spreadProps(__spreadValues({}, computedProps), { children: computedProps.options ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_antd8.Select, __spreadValues({}, computedProps.input)) : /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_antd8.Input, __spreadValues({}, computedProps.input)) }));
676
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd8.Form.Item, {
677
+ ...computedProps,
678
+ children: computedProps.options ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd8.Select, {
679
+ ...computedProps.input
680
+ }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd8.Input, {
681
+ ...computedProps.input
682
+ })
683
+ });
672
684
  case "string[]":
673
685
  if (computedProps.options)
674
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_antd8.Form.Item, __spreadProps(__spreadValues({}, computedProps), { children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
675
- import_antd8.Select,
676
- __spreadValues({
677
- mode: "multiple"
678
- }, computedProps.input)
679
- ) }));
680
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
681
- import_antd8.Form.List,
682
- {
683
- name: computedProps.name,
684
- rules: computedProps.rules,
685
- children: (fields, { add, remove }, { errors }) => {
686
- var _a2;
687
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
688
- computedProps.label && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "ant-form-item-label", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: computedProps.rules.find((r) => r.required) && "ant-form-item-required", children: computedProps.label }) }),
686
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd8.Form.Item, {
687
+ ...computedProps,
688
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd8.Select, {
689
+ mode: "multiple",
690
+ ...computedProps.input
691
+ })
692
+ });
693
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd8.Form.List, {
694
+ name: computedProps.name,
695
+ rules: computedProps.rules,
696
+ children: (fields, { add, remove }, { errors }) => {
697
+ var _a2;
698
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, {
699
+ children: [
700
+ computedProps.label && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
701
+ className: "ant-form-item-label",
702
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("label", {
703
+ className: computedProps.rules.find((r) => r.required) && "ant-form-item-required",
704
+ children: computedProps.label
705
+ })
706
+ }),
689
707
  fields.map((field) => {
690
708
  var _a3;
691
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_antd8.Form.Item, { children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
692
- import_antd8.Row,
693
- {
709
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd8.Form.Item, {
710
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_antd8.Row, {
694
711
  gutter: 24,
695
712
  style: { flexFlow: "row nowrap" },
696
713
  children: [
697
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_antd8.Col, { span: 23, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
698
- import_antd8.Form.Item,
699
- __spreadProps(__spreadValues({}, field), {
714
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd8.Col, {
715
+ span: 23,
716
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd8.Form.Item, {
717
+ ...field,
700
718
  noStyle: true,
701
- children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_antd8.Input, __spreadValues({}, computedProps.input))
719
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd8.Input, {
720
+ ...computedProps.input
721
+ })
702
722
  })
703
- ) }),
704
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_antd8.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_runtime10.jsx)(
705
- import_antd8.Button,
706
- {
723
+ }),
724
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd8.Col, {
725
+ span: 1,
726
+ 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_antd8.Button, {
707
727
  danger: true,
708
728
  type: "link",
709
729
  style: { float: "right" },
710
- icon: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_icons2.MinusCircleOutlined, {}),
730
+ icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons2.MinusCircleOutlined, {}),
711
731
  onClick: () => remove(field.name)
712
- }
713
- ) })
732
+ })
733
+ })
714
734
  ]
715
- }
716
- ) }, field.key);
735
+ })
736
+ }, field.key);
717
737
  }),
718
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_antd8.Form.Item, { children: [
719
- !((_a2 = computedProps.input) == null ? void 0 : _a2.disabled) && (!computedProps.maxCount || computedProps.maxCount > fields.length) && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
720
- import_antd8.Button,
721
- {
738
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_antd8.Form.Item, {
739
+ children: [
740
+ !((_a2 = computedProps.input) == null ? void 0 : _a2.disabled) && (!computedProps.maxCount || computedProps.maxCount > fields.length) && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd8.Button, {
722
741
  type: "dashed",
723
742
  block: true,
724
743
  onClick: () => add(),
725
- icon: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_icons2.PlusOutlined, {})
726
- }
727
- ),
728
- computedProps.extra && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "ant-form-item-extra", children: computedProps.extra }),
729
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_antd8.Form.ErrorList, { errors })
730
- ] })
731
- ] });
732
- }
744
+ icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons2.PlusOutlined, {})
745
+ }),
746
+ computedProps.extra && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
747
+ className: "ant-form-item-extra",
748
+ children: computedProps.extra
749
+ }),
750
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd8.Form.ErrorList, {
751
+ errors
752
+ })
753
+ ]
754
+ })
755
+ ]
756
+ });
733
757
  }
734
- );
758
+ });
735
759
  case "number":
736
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_antd8.Form.Item, __spreadProps(__spreadValues({}, computedProps), { children: computedProps.options ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_antd8.Select, __spreadValues({}, computedProps.input)) : /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
737
- import_antd8.InputNumber,
738
- __spreadValues({
739
- style: { width: "100%" }
740
- }, computedProps.input)
741
- ) }));
760
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd8.Form.Item, {
761
+ ...computedProps,
762
+ children: computedProps.options ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd8.Select, {
763
+ ...computedProps.input
764
+ }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd8.InputNumber, {
765
+ style: { width: "100%" },
766
+ ...computedProps.input
767
+ })
768
+ });
742
769
  case "number[]":
743
770
  if (computedProps.options)
744
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_antd8.Form.Item, __spreadProps(__spreadValues({}, computedProps), { children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
745
- import_antd8.Select,
746
- __spreadValues({
747
- mode: "multiple"
748
- }, computedProps.input)
749
- ) }));
750
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
751
- import_antd8.Form.List,
752
- {
753
- name: computedProps.name,
754
- rules: computedProps.rules,
755
- children: (fields, { add, remove }, { errors }) => {
756
- var _a2, _b;
757
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
758
- computedProps.label && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "ant-form-item-label", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: ((_a2 = computedProps.rules) == null ? void 0 : _a2.find((r) => r.required)) && "ant-form-item-required", children: computedProps.label }) }),
771
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd8.Form.Item, {
772
+ ...computedProps,
773
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd8.Select, {
774
+ mode: "multiple",
775
+ ...computedProps.input
776
+ })
777
+ });
778
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd8.Form.List, {
779
+ name: computedProps.name,
780
+ rules: computedProps.rules,
781
+ children: (fields, { add, remove }, { errors }) => {
782
+ var _a2, _b;
783
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, {
784
+ children: [
785
+ computedProps.label && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
786
+ className: "ant-form-item-label",
787
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("label", {
788
+ className: ((_a2 = computedProps.rules) == null ? void 0 : _a2.find((r) => r.required)) && "ant-form-item-required",
789
+ children: computedProps.label
790
+ })
791
+ }),
759
792
  fields.map((field) => {
760
793
  var _a3;
761
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_antd8.Form.Item, { children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
762
- import_antd8.Row,
763
- {
794
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd8.Form.Item, {
795
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_antd8.Row, {
764
796
  gutter: 24,
765
797
  style: { flexFlow: "row nowrap" },
766
798
  children: [
767
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_antd8.Col, { span: 23, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
768
- import_antd8.Form.Item,
769
- __spreadProps(__spreadValues({}, field), {
799
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd8.Col, {
800
+ span: 23,
801
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd8.Form.Item, {
802
+ ...field,
770
803
  noStyle: true,
771
- children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
772
- import_antd8.InputNumber,
773
- __spreadValues({
774
- style: { width: "100%" }
775
- }, computedProps.input)
776
- )
804
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd8.InputNumber, {
805
+ style: { width: "100%" },
806
+ ...computedProps.input
807
+ })
777
808
  })
778
- ) }),
779
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_antd8.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_runtime10.jsx)(
780
- import_antd8.Button,
781
- {
809
+ }),
810
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd8.Col, {
811
+ span: 1,
812
+ 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_antd8.Button, {
782
813
  danger: true,
783
814
  type: "link",
784
815
  style: { float: "right" },
785
- icon: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_icons2.MinusCircleOutlined, {}),
816
+ icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons2.MinusCircleOutlined, {}),
786
817
  onClick: () => remove(field.name)
787
- }
788
- ) })
818
+ })
819
+ })
789
820
  ]
790
- }
791
- ) }, field.key);
821
+ })
822
+ }, field.key);
792
823
  }),
793
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_antd8.Form.Item, { children: [
794
- !((_b = computedProps.input) == null ? void 0 : _b.disabled) && (!computedProps.maxCount || computedProps.maxCount > fields.length) && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
795
- import_antd8.Button,
796
- {
824
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_antd8.Form.Item, {
825
+ children: [
826
+ !((_b = computedProps.input) == null ? void 0 : _b.disabled) && (!computedProps.maxCount || computedProps.maxCount > fields.length) && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd8.Button, {
797
827
  type: "dashed",
798
828
  block: true,
799
829
  onClick: () => add(),
800
- icon: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_icons2.PlusOutlined, {})
801
- }
802
- ),
803
- computedProps.extra && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "ant-form-item-extra", children: computedProps.extra }),
804
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_antd8.Form.ErrorList, { errors })
805
- ] })
806
- ] });
807
- }
830
+ icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons2.PlusOutlined, {})
831
+ }),
832
+ computedProps.extra && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
833
+ className: "ant-form-item-extra",
834
+ children: computedProps.extra
835
+ }),
836
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd8.Form.ErrorList, {
837
+ errors
838
+ })
839
+ ]
840
+ })
841
+ ]
842
+ });
808
843
  }
809
- );
844
+ });
810
845
  case "boolean":
811
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_antd8.Form.Item, __spreadProps(__spreadValues({}, computedProps), { children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_antd8.Switch, __spreadValues({}, computedProps.input)) }));
846
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd8.Form.Item, {
847
+ ...computedProps,
848
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd8.Switch, {
849
+ ...computedProps.input
850
+ })
851
+ });
812
852
  case "date":
813
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_antd8.Form.Item, __spreadProps(__spreadValues({}, computedProps), { children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_antd8.DatePicker, __spreadValues({}, computedProps.input)) }));
853
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd8.Form.Item, {
854
+ ...computedProps,
855
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd8.DatePicker, {
856
+ ...computedProps.input
857
+ })
858
+ });
814
859
  case "time":
815
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_antd8.Form.Item, __spreadProps(__spreadValues({}, computedProps), { children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_antd8.TimePicker, __spreadValues({}, computedProps.input)) }));
860
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd8.Form.Item, {
861
+ ...computedProps,
862
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd8.TimePicker, {
863
+ ...computedProps.input
864
+ })
865
+ });
816
866
  case "object":
817
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
818
- computedProps.label && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "ant-form-item-label", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: ((_a = computedProps.rules) == null ? void 0 : _a.find((r) => r.required)) && "ant-form-item-required", children: computedProps.label }) }),
819
- computedProps.object.map((o) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
820
- FormItem,
821
- __spreadValues({}, o),
822
- o.id
823
- ))
824
- ] });
867
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, {
868
+ children: [
869
+ computedProps.label && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
870
+ className: "ant-form-item-label",
871
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("label", {
872
+ className: ((_a = computedProps.rules) == null ? void 0 : _a.find((r) => r.required)) && "ant-form-item-required",
873
+ children: computedProps.label
874
+ })
875
+ }),
876
+ computedProps.object.map((o) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FormItem, {
877
+ ...o
878
+ }, o.id))
879
+ ]
880
+ });
825
881
  case "object[]":
826
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
827
- import_antd8.Form.List,
828
- {
829
- name: computedProps.name,
830
- rules: computedProps.rules,
831
- children: (fields, { add, remove }, { errors }) => /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
832
- fields.map((field) => /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
833
- import_antd8.Form.Item,
834
- {
835
- style: { marginBottom: 0 },
836
- children: [
837
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "ant-form-item-label", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("label", { children: [
838
- computedProps.label,
839
- " ",
840
- field.name + 1,
841
- !computedProps.disabled && (!computedProps.rules.find((r) => r.required) || field.key > 0) && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
842
- import_antd8.Button,
843
- {
882
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd8.Form.List, {
883
+ name: computedProps.name,
884
+ rules: computedProps.rules,
885
+ children: (fields, { add, remove }, { errors }) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, {
886
+ children: [
887
+ fields.map((field) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_antd8.Form.Item, {
888
+ style: { marginBottom: 0 },
889
+ children: [
890
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
891
+ className: "ant-form-item-label",
892
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", {
893
+ children: [
894
+ computedProps.label,
895
+ " ",
896
+ field.name + 1,
897
+ !computedProps.disabled && (!computedProps.rules.find((r) => r.required) || field.key > 0) && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd8.Button, {
844
898
  danger: true,
845
899
  type: "link",
846
900
  onClick: () => remove(field.name),
847
901
  children: common2.delete
848
- }
849
- )
850
- ] }) }),
851
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_antd8.Row, { gutter: 24, children: computedProps.object.map((o) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
852
- import_antd8.Col,
853
- {
854
- span: o.col || 24,
855
- children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
856
- FormItem,
857
- __spreadProps(__spreadValues({}, o), {
858
- name: [field.name, o.id]
859
- })
860
- )
861
- },
862
- o.id
863
- )) })
864
- ]
865
- },
866
- field.key
867
- )),
868
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_antd8.Form.Item, { children: [
869
- !computedProps.disabled && (!computedProps.maxCount || computedProps.maxCount > fields.length) && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
870
- import_antd8.Button,
871
- {
902
+ })
903
+ ]
904
+ })
905
+ }),
906
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd8.Row, {
907
+ gutter: 24,
908
+ children: computedProps.object.map((o) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd8.Col, {
909
+ span: o.col || 24,
910
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FormItem, {
911
+ ...o,
912
+ name: [field.name, o.id]
913
+ })
914
+ }, o.id))
915
+ })
916
+ ]
917
+ }, field.key)),
918
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_antd8.Form.Item, {
919
+ children: [
920
+ !computedProps.disabled && (!computedProps.maxCount || computedProps.maxCount > fields.length) && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_antd8.Button, {
872
921
  type: "dashed",
873
922
  block: true,
874
923
  onClick: () => add(),
875
- icon: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_icons2.PlusOutlined, {}),
924
+ icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons2.PlusOutlined, {}),
876
925
  children: [
877
926
  common2.add,
878
927
  " ",
879
928
  computedProps.label
880
929
  ]
881
- }
882
- ),
883
- computedProps.extra && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "ant-form-item-extra", children: computedProps.extra }),
884
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_antd8.Form.ErrorList, { errors })
885
- ] })
886
- ] })
887
- }
888
- );
930
+ }),
931
+ computedProps.extra && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
932
+ className: "ant-form-item-extra",
933
+ children: computedProps.extra
934
+ }),
935
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd8.Form.ErrorList, {
936
+ errors
937
+ })
938
+ ]
939
+ })
940
+ ]
941
+ })
942
+ });
889
943
  default:
890
944
  return null;
891
945
  }
@@ -893,20 +947,21 @@ function FormItem(props) {
893
947
  FormItem.useStatus = import_antd8.Form.Item.useStatus;
894
948
 
895
949
  // src/Form.tsx
896
- var import_jsx_runtime11 = require("react/jsx-runtime");
950
+ var import_jsx_runtime = require("react/jsx-runtime");
897
951
  function Form(props) {
898
952
  var _a, _b;
899
- const [loading, setLoading] = (0, import_react12.useState)(false);
900
- const [computedProps, setComputedProps] = (0, import_react12.useState)();
953
+ const [loading, setLoading] = (0, import_react11.useState)(false);
954
+ const [computedProps, setComputedProps] = (0, import_react11.useState)();
901
955
  const config = useConfigContext();
902
- const [extendTypes, setExtendTypes] = (0, import_react12.useState)();
956
+ const [extendTypes, setExtendTypes] = (0, import_react11.useState)();
903
957
  const [form] = import_antd9.Form.useForm(props.form);
904
- const [initialValues, setInitialValues] = (0, import_react12.useState)(props.initialValues);
905
- (0, import_react12.useEffect)(() => {
958
+ const [initialValues, setInitialValues] = (0, import_react11.useState)(props.initialValues);
959
+ (0, import_react11.useEffect)(() => {
906
960
  var _a2, _b2, _c;
907
- const propsCopy = __spreadProps(__spreadValues({}, props), {
961
+ const propsCopy = {
962
+ ...props,
908
963
  form
909
- });
964
+ };
910
965
  if (propsCopy.initialValues && ((_a2 = propsCopy.items) == null ? void 0 : _a2.length)) {
911
966
  for (const key in propsCopy.initialValues) {
912
967
  propsCopy.initialValues[key] = transferValue(
@@ -930,7 +985,10 @@ function Form(props) {
930
985
  setLoading(true);
931
986
  try {
932
987
  if (propsCopy.submit && ((_a3 = propsCopy.submit.to) == null ? void 0 : _a3.action)) {
933
- await props.onFinish(values, async (values2) => faas(propsCopy.submit.to.action, propsCopy.submit.to.params ? __spreadValues(__spreadValues({}, values2), propsCopy.submit.to.params) : values2));
988
+ await props.onFinish(values, async (values2) => (0, import_react10.faas)(propsCopy.submit.to.action, propsCopy.submit.to.params ? {
989
+ ...values2,
990
+ ...propsCopy.submit.to.params
991
+ } : values2));
934
992
  } else
935
993
  await props.onFinish(values);
936
994
  } catch (error) {
@@ -941,7 +999,10 @@ function Form(props) {
941
999
  } else if (propsCopy.submit && ((_c = propsCopy.submit.to) == null ? void 0 : _c.action)) {
942
1000
  propsCopy.onFinish = async (values) => {
943
1001
  setLoading(true);
944
- return faas(propsCopy.submit.to.action, propsCopy.submit.to.params ? __spreadValues(__spreadValues({}, values), propsCopy.submit.to.params) : values).then((result) => {
1002
+ return (0, import_react10.faas)(propsCopy.submit.to.action, propsCopy.submit.to.params ? {
1003
+ ...values,
1004
+ ...propsCopy.submit.to.params
1005
+ } : values).then((result) => {
945
1006
  if (propsCopy.submit.to.then)
946
1007
  propsCopy.submit.to.then(result);
947
1008
  return result;
@@ -962,7 +1023,7 @@ function Form(props) {
962
1023
  }
963
1024
  setComputedProps(propsCopy);
964
1025
  }, [props]);
965
- const onValuesChange = (0, import_react12.useCallback)((changedValues, allValues) => {
1026
+ const onValuesChange = (0, import_react11.useCallback)((changedValues, allValues) => {
966
1027
  console.debug("Form:onValuesChange", changedValues, allValues);
967
1028
  if (props.onValuesChange) {
968
1029
  props.onValuesChange(changedValues, allValues);
@@ -975,7 +1036,7 @@ function Form(props) {
975
1036
  item.onValueChange(changedValues[key], allValues, form);
976
1037
  }
977
1038
  }, [computedProps]);
978
- (0, import_react12.useEffect)(() => {
1039
+ (0, import_react11.useEffect)(() => {
979
1040
  if (!initialValues)
980
1041
  return;
981
1042
  console.debug("Form:initialValues", initialValues);
@@ -984,33 +1045,25 @@ function Form(props) {
984
1045
  }, [computedProps]);
985
1046
  if (!computedProps)
986
1047
  return null;
987
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
988
- import_antd9.Form,
989
- __spreadProps(__spreadValues({}, computedProps), {
990
- onValuesChange,
991
- children: [
992
- computedProps.beforeItems,
993
- (_a = computedProps.items) == null ? void 0 : _a.map((item) => (0, import_react12.isValidElement)(item) ? item : /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
994
- FormItem,
995
- __spreadProps(__spreadValues({}, item), {
996
- extendTypes
997
- }),
998
- item.id
999
- )),
1000
- computedProps.children,
1001
- computedProps.submit !== false && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1002
- import_antd9.Button,
1003
- {
1004
- htmlType: "submit",
1005
- type: "primary",
1006
- loading,
1007
- children: ((_b = computedProps.submit) == null ? void 0 : _b.text) || config.Form.submit.text
1008
- }
1009
- ),
1010
- computedProps.footer
1011
- ]
1012
- })
1013
- );
1048
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_antd9.Form, {
1049
+ ...computedProps,
1050
+ onValuesChange,
1051
+ children: [
1052
+ computedProps.beforeItems,
1053
+ (_a = computedProps.items) == null ? void 0 : _a.map((item) => (0, import_react11.isValidElement)(item) ? item : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FormItem, {
1054
+ ...item,
1055
+ extendTypes
1056
+ }, item.id)),
1057
+ computedProps.children,
1058
+ computedProps.submit !== false && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd9.Button, {
1059
+ htmlType: "submit",
1060
+ type: "primary",
1061
+ loading,
1062
+ children: ((_b = computedProps.submit) == null ? void 0 : _b.text) || config.Form.submit.text
1063
+ }),
1064
+ computedProps.footer
1065
+ ]
1066
+ });
1014
1067
  }
1015
1068
  Form.useForm = import_antd9.Form.useForm;
1016
1069
  Form.useFormInstance = import_antd9.Form.useFormInstance;
@@ -1023,13 +1076,15 @@ Form.Provider = import_antd9.Form.Provider;
1023
1076
  // src/Link.tsx
1024
1077
  var import_react_router_dom2 = require("react-router-dom");
1025
1078
  var import_antd10 = require("antd");
1026
- var import_jsx_runtime12 = require("react/jsx-runtime");
1079
+ var import_jsx_runtime = require("react/jsx-runtime");
1027
1080
  function Link(props) {
1028
1081
  var _a, _b, _c, _d;
1029
1082
  const { Link: Link2 } = useConfigContext();
1030
- let style = __spreadValues(__spreadProps(__spreadValues({}, Link2.style || {}), {
1031
- cursor: "pointer"
1032
- }), props.style);
1083
+ let style = {
1084
+ ...Link2.style || {},
1085
+ cursor: "pointer",
1086
+ ...props.style
1087
+ };
1033
1088
  if (props.block)
1034
1089
  style = Object.assign({
1035
1090
  display: "block",
@@ -1037,99 +1092,86 @@ function Link(props) {
1037
1092
  }, style);
1038
1093
  if (props.href.startsWith("http")) {
1039
1094
  if (props.button)
1040
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1041
- import_antd10.Button,
1042
- __spreadProps(__spreadValues({}, props.button), {
1043
- target: props.target || (Link2 == null ? void 0 : Link2.target) || "_blank",
1044
- style,
1045
- href: props.href,
1046
- children: (_a = props.text) != null ? _a : props.children
1047
- })
1048
- );
1049
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1050
- "a",
1051
- {
1052
- href: props.href,
1095
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd10.Button, {
1096
+ ...props.button,
1053
1097
  target: props.target || (Link2 == null ? void 0 : Link2.target) || "_blank",
1054
1098
  style,
1055
- children: (_b = props.text) != null ? _b : props.children
1056
- }
1057
- );
1099
+ href: props.href,
1100
+ children: (_a = props.text) != null ? _a : props.children
1101
+ });
1102
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("a", {
1103
+ href: props.href,
1104
+ target: props.target || (Link2 == null ? void 0 : Link2.target) || "_blank",
1105
+ style,
1106
+ children: (_b = props.text) != null ? _b : props.children
1107
+ });
1058
1108
  }
1059
1109
  if (props.button)
1060
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1061
- import_react_router_dom2.Link,
1062
- {
1063
- to: props.href,
1064
- target: props.target || (Link2 == null ? void 0 : Link2.target),
1065
- children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1066
- import_antd10.Button,
1067
- __spreadProps(__spreadValues({}, props.button), {
1068
- style,
1069
- children: (_c = props.text) != null ? _c : props.children
1070
- })
1071
- )
1072
- }
1073
- );
1074
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1075
- import_react_router_dom2.Link,
1076
- {
1110
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_router_dom2.Link, {
1077
1111
  to: props.href,
1078
1112
  target: props.target || (Link2 == null ? void 0 : Link2.target),
1079
- style,
1080
- children: (_d = props.text) != null ? _d : props.children
1081
- }
1082
- );
1113
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd10.Button, {
1114
+ ...props.button,
1115
+ style,
1116
+ children: (_c = props.text) != null ? _c : props.children
1117
+ })
1118
+ });
1119
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_router_dom2.Link, {
1120
+ to: props.href,
1121
+ target: props.target || (Link2 == null ? void 0 : Link2.target),
1122
+ style,
1123
+ children: (_d = props.text) != null ? _d : props.children
1124
+ });
1083
1125
  }
1084
1126
 
1085
1127
  // src/Routers.tsx
1086
1128
  var import_antd11 = require("antd");
1087
- var import_react13 = require("react");
1129
+ var import_react12 = require("react");
1088
1130
  var import_react_router_dom3 = require("react-router-dom");
1089
- var import_react14 = require("react");
1090
- var import_jsx_runtime13 = require("react/jsx-runtime");
1131
+ var import_react13 = require("react");
1132
+ var import_jsx_runtime = require("react/jsx-runtime");
1091
1133
  function PageNotFound() {
1092
1134
  const config = useConfigContext();
1093
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1094
- import_antd11.Result,
1095
- {
1096
- status: "404",
1097
- title: config.common.pageNotFound
1098
- }
1099
- );
1135
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd11.Result, {
1136
+ status: "404",
1137
+ title: config.common.pageNotFound
1138
+ });
1100
1139
  }
1101
1140
  function Routes(props) {
1102
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_react_router_dom3.Routes, { children: [
1103
- props.routes.map((r) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1104
- import_react_router_dom3.Route,
1105
- __spreadProps(__spreadValues({}, r), {
1106
- element: r.element || /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_react13.Suspense, { fallback: props.fallback || /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { style: { padding: "24px" }, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_antd11.Skeleton, { active: true }) }), children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(r.page, {}) })
1107
- }),
1108
- r.path
1109
- )),
1110
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1111
- import_react_router_dom3.Route,
1112
- {
1141
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_react_router_dom3.Routes, {
1142
+ children: [
1143
+ props.routes.map((r) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_router_dom3.Route, {
1144
+ ...r,
1145
+ element: r.element || /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react12.Suspense, {
1146
+ fallback: props.fallback || /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
1147
+ style: { padding: "24px" },
1148
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd11.Skeleton, {
1149
+ active: true
1150
+ })
1151
+ }),
1152
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(r.page, {})
1153
+ })
1154
+ }, r.path)),
1155
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_router_dom3.Route, {
1113
1156
  path: "*",
1114
- element: props.notFound || /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(PageNotFound, {})
1115
- },
1116
- "*"
1117
- )
1118
- ] });
1157
+ element: props.notFound || /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PageNotFound, {})
1158
+ }, "*")
1159
+ ]
1160
+ });
1119
1161
  }
1120
1162
 
1121
1163
  // src/Table.tsx
1122
- var import_react15 = require("react");
1164
+ var import_react14 = require("react");
1123
1165
  var import_antd12 = require("antd");
1124
1166
  var import_dayjs2 = __toESM(require("dayjs"));
1125
1167
  var import_icons3 = require("@ant-design/icons");
1126
1168
  var import_lodash_es6 = require("lodash-es");
1127
- var import_jsx_runtime14 = require("react/jsx-runtime");
1169
+ var import_jsx_runtime = require("react/jsx-runtime");
1128
1170
  function processValue(item, value) {
1129
1171
  var _a;
1130
1172
  const transferred = transferValue(item.type, value);
1131
1173
  if (transferred === null || Array.isArray(transferred) && transferred.length === 0)
1132
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Blank, {});
1174
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Blank, {});
1133
1175
  if (item.options) {
1134
1176
  if (item.type.endsWith("[]"))
1135
1177
  return transferred.map((v) => {
@@ -1150,9 +1192,9 @@ function processValue(item, value) {
1150
1192
  return value;
1151
1193
  }
1152
1194
  function Table(props) {
1153
- const [columns, setColumns] = (0, import_react15.useState)();
1195
+ const [columns, setColumns] = (0, import_react14.useState)();
1154
1196
  const { common: common2 } = useConfigContext();
1155
- (0, import_react15.useEffect)(() => {
1197
+ (0, import_react14.useEffect)(() => {
1156
1198
  var _a;
1157
1199
  for (const item of props.items) {
1158
1200
  if (!item.key)
@@ -1169,14 +1211,14 @@ function Table(props) {
1169
1211
  text: o.label,
1170
1212
  value: o.value
1171
1213
  })).concat({
1172
- text: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Blank, {}),
1214
+ text: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Blank, {}),
1173
1215
  value: null
1174
1216
  });
1175
1217
  }
1176
1218
  if (item.tableChildren === null)
1177
1219
  item.render = () => null;
1178
1220
  else if (item.tableChildren)
1179
- item.render = (value, values) => (0, import_react15.cloneElement)(
1221
+ item.render = (value, values) => (0, import_react14.cloneElement)(
1180
1222
  item.tableChildren,
1181
1223
  {
1182
1224
  scene: "table",
@@ -1187,7 +1229,7 @@ function Table(props) {
1187
1229
  else if (item.children === null)
1188
1230
  item.render = () => null;
1189
1231
  else if (item.children)
1190
- item.render = (value, values) => (0, import_react15.cloneElement)(
1232
+ item.render = (value, values) => (0, import_react14.cloneElement)(
1191
1233
  item.children,
1192
1234
  {
1193
1235
  scene: "table",
@@ -1197,7 +1239,7 @@ function Table(props) {
1197
1239
  );
1198
1240
  if (props.extendTypes && props.extendTypes[item.type]) {
1199
1241
  if (props.extendTypes[item.type].children)
1200
- item.render = (value, values) => (0, import_react15.cloneElement)(
1242
+ item.render = (value, values) => (0, import_react14.cloneElement)(
1201
1243
  props.extendTypes[item.type].children,
1202
1244
  {
1203
1245
  scene: "table",
@@ -1230,22 +1272,19 @@ function Table(props) {
1230
1272
  setSelectedKeys,
1231
1273
  confirm,
1232
1274
  clearFilters
1233
- }) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1234
- import_antd12.Input.Search,
1235
- {
1236
- placeholder: `${common2.search} ${item.title}`,
1237
- allowClear: true,
1238
- onSearch: (v) => {
1239
- if (v) {
1240
- setSelectedKeys([v]);
1241
- } else {
1242
- setSelectedKeys([]);
1243
- clearFilters();
1244
- }
1245
- confirm();
1275
+ }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd12.Input.Search, {
1276
+ placeholder: `${common2.search} ${item.title}`,
1277
+ allowClear: true,
1278
+ onSearch: (v) => {
1279
+ if (v) {
1280
+ setSelectedKeys([v]);
1281
+ } else {
1282
+ setSelectedKeys([]);
1283
+ clearFilters();
1246
1284
  }
1285
+ confirm();
1247
1286
  }
1248
- );
1287
+ });
1249
1288
  break;
1250
1289
  case "string[]":
1251
1290
  if (!item.render)
@@ -1265,22 +1304,19 @@ function Table(props) {
1265
1304
  setSelectedKeys,
1266
1305
  confirm,
1267
1306
  clearFilters
1268
- }) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1269
- import_antd12.Input.Search,
1270
- {
1271
- placeholder: `${common2.search} ${item.title}`,
1272
- allowClear: true,
1273
- onSearch: (v) => {
1274
- if (v) {
1275
- setSelectedKeys([v]);
1276
- } else {
1277
- setSelectedKeys([]);
1278
- clearFilters();
1279
- }
1280
- confirm();
1307
+ }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd12.Input.Search, {
1308
+ placeholder: `${common2.search} ${item.title}`,
1309
+ allowClear: true,
1310
+ onSearch: (v) => {
1311
+ if (v) {
1312
+ setSelectedKeys([v]);
1313
+ } else {
1314
+ setSelectedKeys([]);
1315
+ clearFilters();
1281
1316
  }
1317
+ confirm();
1282
1318
  }
1283
- );
1319
+ });
1284
1320
  break;
1285
1321
  case "number":
1286
1322
  if (!item.render)
@@ -1302,22 +1338,19 @@ function Table(props) {
1302
1338
  setSelectedKeys,
1303
1339
  confirm,
1304
1340
  clearFilters
1305
- }) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1306
- import_antd12.Input.Search,
1307
- {
1308
- placeholder: `${common2.search} ${item.title}`,
1309
- allowClear: true,
1310
- onSearch: (v) => {
1311
- if (v) {
1312
- setSelectedKeys([Number(v)]);
1313
- } else {
1314
- setSelectedKeys([]);
1315
- clearFilters();
1316
- }
1317
- confirm();
1341
+ }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd12.Input.Search, {
1342
+ placeholder: `${common2.search} ${item.title}`,
1343
+ allowClear: true,
1344
+ onSearch: (v) => {
1345
+ if (v) {
1346
+ setSelectedKeys([Number(v)]);
1347
+ } else {
1348
+ setSelectedKeys([]);
1349
+ clearFilters();
1318
1350
  }
1351
+ confirm();
1319
1352
  }
1320
- );
1353
+ });
1321
1354
  break;
1322
1355
  case "number[]":
1323
1356
  if (!item.render)
@@ -1337,66 +1370,79 @@ function Table(props) {
1337
1370
  setSelectedKeys,
1338
1371
  confirm,
1339
1372
  clearFilters
1340
- }) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1341
- import_antd12.Input.Search,
1342
- {
1343
- placeholder: `${common2.search} ${item.title}`,
1344
- allowClear: true,
1345
- onSearch: (v) => {
1346
- if (v) {
1347
- setSelectedKeys([Number(v)]);
1348
- } else {
1349
- setSelectedKeys([]);
1350
- clearFilters();
1351
- }
1352
- confirm();
1373
+ }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd12.Input.Search, {
1374
+ placeholder: `${common2.search} ${item.title}`,
1375
+ allowClear: true,
1376
+ onSearch: (v) => {
1377
+ if (v) {
1378
+ setSelectedKeys([Number(v)]);
1379
+ } else {
1380
+ setSelectedKeys([]);
1381
+ clearFilters();
1353
1382
  }
1383
+ confirm();
1354
1384
  }
1355
- );
1385
+ });
1356
1386
  break;
1357
1387
  case "boolean":
1358
1388
  if (!item.render)
1359
- item.render = (value) => (0, import_lodash_es6.isNil)(value) ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Blank, {}) : value ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_icons3.CheckOutlined, { style: {
1360
- marginTop: "4px",
1361
- color: "#52c41a"
1362
- } }) : /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_icons3.CloseOutlined, { style: {
1363
- marginTop: "4px",
1364
- color: "#ff4d4f"
1365
- } });
1389
+ item.render = (value) => (0, import_lodash_es6.isNil)(value) ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Blank, {}) : value ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons3.CheckOutlined, {
1390
+ style: {
1391
+ marginTop: "4px",
1392
+ color: "#52c41a"
1393
+ }
1394
+ }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons3.CloseOutlined, {
1395
+ style: {
1396
+ marginTop: "4px",
1397
+ color: "#ff4d4f"
1398
+ }
1399
+ });
1366
1400
  if (item.filterDropdown !== false)
1367
1401
  item.filterDropdown = ({
1368
1402
  setSelectedKeys,
1369
1403
  selectedKeys,
1370
1404
  confirm
1371
- }) => /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
1372
- import_antd12.Radio.Group,
1373
- {
1374
- style: { padding: 8 },
1375
- buttonStyle: "solid",
1376
- value: JSON.stringify(selectedKeys[0]),
1377
- onChange: (e) => {
1378
- const Values = {
1379
- true: true,
1380
- false: false,
1381
- null: null
1382
- };
1383
- setSelectedKeys(e.target.value ? [Values[e.target.value]] : []);
1384
- confirm();
1385
- },
1386
- children: [
1387
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_antd12.Radio.Button, { children: common2.all }),
1388
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_antd12.Radio.Button, { value: "true", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_icons3.CheckOutlined, { style: {
1389
- color: "#52c41a",
1390
- verticalAlign: "middle"
1391
- } }) }),
1392
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_antd12.Radio.Button, { value: "false", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_icons3.CloseOutlined, { style: {
1393
- verticalAlign: "middle",
1394
- color: "#ff4d4f"
1395
- } }) }),
1396
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_antd12.Radio.Button, { value: "null", children: common2.blank })
1397
- ]
1398
- }
1399
- );
1405
+ }) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_antd12.Radio.Group, {
1406
+ style: { padding: 8 },
1407
+ buttonStyle: "solid",
1408
+ value: JSON.stringify(selectedKeys[0]),
1409
+ onChange: (e) => {
1410
+ const Values = {
1411
+ true: true,
1412
+ false: false,
1413
+ null: null
1414
+ };
1415
+ setSelectedKeys(e.target.value ? [Values[e.target.value]] : []);
1416
+ confirm();
1417
+ },
1418
+ children: [
1419
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd12.Radio.Button, {
1420
+ children: common2.all
1421
+ }),
1422
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd12.Radio.Button, {
1423
+ value: "true",
1424
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons3.CheckOutlined, {
1425
+ style: {
1426
+ color: "#52c41a",
1427
+ verticalAlign: "middle"
1428
+ }
1429
+ })
1430
+ }),
1431
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd12.Radio.Button, {
1432
+ value: "false",
1433
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons3.CloseOutlined, {
1434
+ style: {
1435
+ verticalAlign: "middle",
1436
+ color: "#ff4d4f"
1437
+ }
1438
+ })
1439
+ }),
1440
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd12.Radio.Button, {
1441
+ value: "null",
1442
+ children: common2.blank
1443
+ })
1444
+ ]
1445
+ });
1400
1446
  if (!item.onFilter)
1401
1447
  item.onFilter = (value, row) => {
1402
1448
  switch (value) {
@@ -1424,15 +1470,12 @@ function Table(props) {
1424
1470
  item.filterDropdown = ({
1425
1471
  setSelectedKeys,
1426
1472
  confirm
1427
- }) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1428
- import_antd12.DatePicker.RangePicker,
1429
- {
1430
- onChange: (dates) => {
1431
- setSelectedKeys(dates && dates[0] && dates[1] ? [[dates[0].startOf("day").toISOString(), dates[1].endOf("day").toISOString()]] : []);
1432
- confirm();
1433
- }
1473
+ }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd12.DatePicker.RangePicker, {
1474
+ onChange: (dates) => {
1475
+ setSelectedKeys(dates && dates[0] && dates[1] ? [[dates[0].startOf("day").toISOString(), dates[1].endOf("day").toISOString()]] : []);
1476
+ confirm();
1434
1477
  }
1435
- );
1478
+ });
1436
1479
  if (!item.onFilter)
1437
1480
  item.onFilter = (value, row) => {
1438
1481
  if ((0, import_lodash_es6.isNil)(value[0]))
@@ -1457,15 +1500,12 @@ function Table(props) {
1457
1500
  item.filterDropdown = ({
1458
1501
  setSelectedKeys,
1459
1502
  confirm
1460
- }) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1461
- import_antd12.DatePicker.RangePicker,
1462
- {
1463
- onChange: (dates) => {
1464
- setSelectedKeys(dates && dates[0] && dates[1] ? [[dates[0].startOf("day").toISOString(), dates[1].endOf("day").toISOString()]] : []);
1465
- confirm();
1466
- }
1503
+ }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd12.DatePicker.RangePicker, {
1504
+ onChange: (dates) => {
1505
+ setSelectedKeys(dates && dates[0] && dates[1] ? [[dates[0].startOf("day").toISOString(), dates[1].endOf("day").toISOString()]] : []);
1506
+ confirm();
1467
1507
  }
1468
- );
1508
+ });
1469
1509
  if (!item.onFilter)
1470
1510
  item.onFilter = (value, row) => {
1471
1511
  if ((0, import_lodash_es6.isNil)(value[0]))
@@ -1477,26 +1517,21 @@ function Table(props) {
1477
1517
  break;
1478
1518
  case "object":
1479
1519
  if (!item.render)
1480
- item.render = (value) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1481
- Description,
1482
- {
1483
- items: item.object,
1484
- dataSource: value || {},
1485
- column: 1
1486
- }
1487
- );
1520
+ item.render = (value) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Description, {
1521
+ items: item.object,
1522
+ dataSource: value || {},
1523
+ column: 1
1524
+ });
1488
1525
  break;
1489
1526
  case "object[]":
1490
1527
  if (!item.render)
1491
- item.render = (value) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_jsx_runtime14.Fragment, { children: value.map((v, i) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1492
- Description,
1493
- {
1528
+ item.render = (value) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, {
1529
+ children: value.map((v, i) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Description, {
1494
1530
  items: item.object,
1495
1531
  dataSource: v || [],
1496
1532
  column: 1
1497
- },
1498
- i
1499
- )) });
1533
+ }, i))
1534
+ });
1500
1535
  break;
1501
1536
  default:
1502
1537
  if (!item.render)
@@ -1512,7 +1547,7 @@ function Table(props) {
1512
1547
  }
1513
1548
  setColumns(props.items);
1514
1549
  }, [props.items]);
1515
- (0, import_react15.useEffect)(() => {
1550
+ (0, import_react14.useEffect)(() => {
1516
1551
  if (!props.dataSource || !columns)
1517
1552
  return;
1518
1553
  for (const column of columns) {
@@ -1527,7 +1562,7 @@ function Table(props) {
1527
1562
  const index = newColumns.findIndex((item) => item.id === column.id);
1528
1563
  if (filters.length < 11)
1529
1564
  newColumns[index].filters = filters.concat({
1530
- text: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Blank, {}),
1565
+ text: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Blank, {}),
1531
1566
  value: null
1532
1567
  });
1533
1568
  else
@@ -1535,41 +1570,35 @@ function Table(props) {
1535
1570
  setSelectedKeys,
1536
1571
  selectedKeys,
1537
1572
  confirm
1538
- }) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1539
- "div",
1540
- {
1541
- style: {
1542
- padding: 8,
1543
- width: "200px"
1573
+ }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
1574
+ style: {
1575
+ padding: 8,
1576
+ width: "200px"
1577
+ },
1578
+ onKeyDown: (e) => e.stopPropagation(),
1579
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd12.Select, {
1580
+ options: filters.map((f) => ({
1581
+ label: f.text,
1582
+ value: f.value
1583
+ })),
1584
+ allowClear: true,
1585
+ showSearch: true,
1586
+ style: { width: "100%" },
1587
+ placeholder: `${common2.search} ${newColumns[index].title}`,
1588
+ value: selectedKeys,
1589
+ onChange: (v) => {
1590
+ setSelectedKeys((v == null ? void 0 : v.length) ? v : []);
1591
+ confirm();
1544
1592
  },
1545
- onKeyDown: (e) => e.stopPropagation(),
1546
- children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1547
- import_antd12.Select,
1548
- {
1549
- options: filters.map((f) => ({
1550
- label: f.text,
1551
- value: f.value
1552
- })),
1553
- allowClear: true,
1554
- showSearch: true,
1555
- style: { width: "100%" },
1556
- placeholder: `${common2.search} ${newColumns[index].title}`,
1557
- value: selectedKeys,
1558
- onChange: (v) => {
1559
- setSelectedKeys((v == null ? void 0 : v.length) ? v : []);
1560
- confirm();
1561
- },
1562
- mode: "multiple",
1563
- filterOption: (input, option) => {
1564
- if (!input || !option || !option.label)
1565
- return true;
1566
- input = input.trim();
1567
- return option.value === input || option.label.toString().toLowerCase().includes(input.toLowerCase());
1568
- }
1569
- }
1570
- )
1571
- }
1572
- );
1593
+ mode: "multiple",
1594
+ filterOption: (input, option) => {
1595
+ if (!input || !option || !option.label)
1596
+ return true;
1597
+ input = input.trim();
1598
+ return option.value === input || option.label.toString().toLowerCase().includes(input.toLowerCase());
1599
+ }
1600
+ })
1601
+ });
1573
1602
  return newColumns;
1574
1603
  });
1575
1604
  }
@@ -1578,26 +1607,19 @@ function Table(props) {
1578
1607
  if (!columns)
1579
1608
  return null;
1580
1609
  if (props.dataSource)
1581
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1582
- import_antd12.Table,
1583
- __spreadProps(__spreadValues({}, props), {
1584
- rowKey: props.rowKey || "id",
1585
- columns,
1586
- dataSource: props.dataSource
1587
- })
1588
- );
1589
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1590
- FaasDataWrapper2,
1591
- __spreadProps(__spreadValues({}, props.faasData), {
1592
- children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1593
- FaasDataTable,
1594
- {
1595
- props,
1596
- columns
1597
- }
1598
- )
1610
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd12.Table, {
1611
+ ...props,
1612
+ rowKey: props.rowKey || "id",
1613
+ columns,
1614
+ dataSource: props.dataSource
1615
+ });
1616
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FaasDataWrapper, {
1617
+ ...props.faasData,
1618
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FaasDataTable, {
1619
+ props,
1620
+ columns
1599
1621
  })
1600
- );
1622
+ });
1601
1623
  }
1602
1624
  function FaasDataTable({
1603
1625
  props,
@@ -1606,8 +1628,8 @@ function FaasDataTable({
1606
1628
  params,
1607
1629
  reload
1608
1630
  }) {
1609
- const [currentColumns, setCurrentColumns] = (0, import_react15.useState)(columns);
1610
- (0, import_react15.useEffect)(() => {
1631
+ const [currentColumns, setCurrentColumns] = (0, import_react14.useState)(columns);
1632
+ (0, import_react14.useEffect)(() => {
1611
1633
  if (!data || Array.isArray(data))
1612
1634
  return;
1613
1635
  setCurrentColumns((prev) => {
@@ -1619,7 +1641,7 @@ function FaasDataTable({
1619
1641
  text: v.label,
1620
1642
  value: v.value
1621
1643
  })).concat({
1622
- text: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Blank, {}),
1644
+ text: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Blank, {}),
1623
1645
  value: null
1624
1646
  });
1625
1647
  column.render = (value) => processValue(column, value);
@@ -1634,7 +1656,7 @@ function FaasDataTable({
1634
1656
  }));
1635
1657
  if (filters.length)
1636
1658
  column.filters = filters.concat({
1637
- text: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Blank, {}),
1659
+ text: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Blank, {}),
1638
1660
  value: null
1639
1661
  });
1640
1662
  }
@@ -1643,75 +1665,75 @@ function FaasDataTable({
1643
1665
  });
1644
1666
  }, [columns, data]);
1645
1667
  if (!data)
1646
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1647
- import_antd12.Table,
1648
- __spreadProps(__spreadValues({}, props), {
1649
- rowKey: props.rowKey || "id",
1650
- columns: currentColumns,
1651
- dataSource: []
1652
- })
1653
- );
1668
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd12.Table, {
1669
+ ...props,
1670
+ rowKey: props.rowKey || "id",
1671
+ columns: currentColumns,
1672
+ dataSource: []
1673
+ });
1654
1674
  if (Array.isArray(data))
1655
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1656
- import_antd12.Table,
1657
- __spreadProps(__spreadValues({}, props), {
1658
- rowKey: props.rowKey || "id",
1659
- columns: currentColumns,
1660
- dataSource: data
1661
- })
1662
- );
1663
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1664
- import_antd12.Table,
1665
- __spreadProps(__spreadValues({}, props), {
1675
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd12.Table, {
1676
+ ...props,
1666
1677
  rowKey: props.rowKey || "id",
1667
1678
  columns: currentColumns,
1668
- dataSource: data.rows,
1669
- pagination: __spreadValues(__spreadValues({}, props.pagination), data.pagination),
1670
- onChange: (pagination, filters, sorter, extra) => {
1671
- if (props.onChange) {
1672
- const processed = props.onChange(pagination, filters, sorter, extra);
1673
- reload(__spreadProps(__spreadValues({}, params), {
1674
- pagination: processed.pagination,
1675
- filters: processed.filters,
1676
- sorter: processed.sorter
1677
- }));
1678
- return;
1679
- }
1680
- reload(__spreadProps(__spreadValues({}, params), {
1681
- pagination,
1682
- filters,
1683
- sorter
1684
- }));
1679
+ dataSource: data
1680
+ });
1681
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd12.Table, {
1682
+ ...props,
1683
+ rowKey: props.rowKey || "id",
1684
+ columns: currentColumns,
1685
+ dataSource: data.rows,
1686
+ pagination: {
1687
+ ...props.pagination,
1688
+ ...data.pagination
1689
+ },
1690
+ onChange: (pagination, filters, sorter, extra) => {
1691
+ if (props.onChange) {
1692
+ const processed = props.onChange(pagination, filters, sorter, extra);
1693
+ reload({
1694
+ ...params,
1695
+ pagination: processed.pagination,
1696
+ filters: processed.filters,
1697
+ sorter: processed.sorter
1698
+ });
1699
+ return;
1685
1700
  }
1686
- })
1687
- );
1701
+ reload({
1702
+ ...params,
1703
+ pagination,
1704
+ filters,
1705
+ sorter
1706
+ });
1707
+ }
1708
+ });
1688
1709
  }
1689
1710
 
1690
1711
  // src/Title.tsx
1691
- var import_react16 = require("react");
1692
- var import_jsx_runtime15 = require("react/jsx-runtime");
1712
+ var import_react15 = require("react");
1713
+ var import_jsx_runtime = require("react/jsx-runtime");
1693
1714
  function Title(props) {
1694
1715
  const { Title: Title2 } = useConfigContext();
1695
- (0, import_react16.useEffect)(() => {
1716
+ (0, import_react15.useEffect)(() => {
1696
1717
  const title = Array.isArray(props.title) ? props.title : [props.title];
1697
1718
  document.title = title.concat(props.suffix || Title2.suffix).filter((t) => !!t).join(props.separator || Title2.separator);
1698
1719
  }, [props]);
1699
1720
  if (props.h1) {
1700
1721
  if (typeof props.h1 === "boolean")
1701
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("h1", { children: Array.isArray(props.title) ? props.title[0] : props.title });
1702
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
1703
- "h1",
1704
- {
1705
- className: props.h1.className,
1706
- style: props.h1.style,
1722
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("h1", {
1707
1723
  children: Array.isArray(props.title) ? props.title[0] : props.title
1708
- }
1709
- );
1724
+ });
1725
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("h1", {
1726
+ className: props.h1.className,
1727
+ style: props.h1.style,
1728
+ children: Array.isArray(props.title) ? props.title[0] : props.title
1729
+ });
1710
1730
  }
1711
1731
  if (props.plain)
1712
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_jsx_runtime15.Fragment, { children: Array.isArray(props.title) ? props.title[0] : props.title });
1732
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, {
1733
+ children: Array.isArray(props.title) ? props.title[0] : props.title
1734
+ });
1713
1735
  if (props.children)
1714
- return (0, import_react16.cloneElement)(props.children, { title: props.title });
1736
+ return (0, import_react15.cloneElement)(props.children, { title: props.title });
1715
1737
  return null;
1716
1738
  }
1717
1739
  // Annotate the CommonJS export names for ESM import in node: