@faasjs/ant-design 0.0.3-beta.38 → 0.0.3-beta.40

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