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

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