@faasjs/ant-design 0.0.2-beta.393 → 0.0.2-beta.396

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/README.md CHANGED
@@ -41,7 +41,7 @@ Form are based on [Ant Design's Form.Item component](https://ant.design/componen
41
41
 
42
42
  - [Form](modules/Form.md)
43
43
 
44
- ### Type aliases
44
+ ### Type Aliases
45
45
 
46
46
  - [BaseItemProps](#baseitemprops)
47
47
  - [BaseOption](#baseoption)
@@ -76,7 +76,6 @@ Form are based on [Ant Design's Form.Item component](https://ant.design/componen
76
76
 
77
77
  - [ConfigContext](#configcontext)
78
78
  - [DatePicker](#datepicker)
79
- - [TimePicker](#timepicker)
80
79
 
81
80
  ### Functions
82
81
 
@@ -88,13 +87,14 @@ Form are based on [Ant Design's Form.Item component](https://ant.design/componen
88
87
  - [FormItem](#formitem)
89
88
  - [Routes](#routes)
90
89
  - [Table](#table)
90
+ - [TimePicker](#timepicker)
91
91
  - [Title](#title)
92
92
  - [transferOptions](#transferoptions)
93
93
  - [useConfigContext](#useconfigcontext)
94
94
  - [useDrawer](#usedrawer)
95
95
  - [useModal](#usemodal)
96
96
 
97
- ## Type aliases
97
+ ## Type Aliases
98
98
 
99
99
  ### BaseItemProps
100
100
 
@@ -143,7 +143,7 @@ ___
143
143
 
144
144
  ### DescriptionItemProps
145
145
 
146
- Ƭ **DescriptionItemProps**<`T`\>: { `children?`: `JSX.Element` ; `render?`: (`value`: `T`, `values`: `any`) => `string` \| `number` \| `boolean` \| `Element` } & [`FaasItemProps`](#faasitemprops)
146
+ Ƭ **DescriptionItemProps**<`T`\>: { `children?`: `JSX.Element` ; `render?`: (`value`: `T`, `values`: `any`) => `JSX.Element` \| `string` \| `number` \| `boolean` \| ``null`` } & [`FaasItemProps`](#faasitemprops)
147
147
 
148
148
  #### Type parameters
149
149
 
@@ -187,7 +187,7 @@ ___
187
187
  | Name | Type |
188
188
  | :------ | :------ |
189
189
  | `children?` | `JSX.Element` \| ``null`` |
190
- | `render?` | (`value`: `any`, `values`: `any`) => `string` \| `number` \| `boolean` \| `Element` |
190
+ | `render?` | (`value`: `any`, `values`: `any`) => `JSX.Element` \| `string` \| `number` \| `boolean` \| ``null`` |
191
191
 
192
192
  ___
193
193
 
@@ -230,7 +230,7 @@ ___
230
230
  | Name | Type |
231
231
  | :------ | :------ |
232
232
  | `children?` | `JSX.Element` \| ``null`` |
233
- | `render?` | (`value`: `any`, `values`: `any`, `index`: `number`) => `string` \| `number` \| `boolean` \| `Element` |
233
+ | `render?` | (`value`: `any`, `values`: `any`, `index`: `number`) => `JSX.Element` \| `string` \| `number` \| `boolean` \| ``null`` |
234
234
 
235
235
  ___
236
236
 
@@ -296,7 +296,7 @@ ___
296
296
 
297
297
  ### FormItemProps
298
298
 
299
- Ƭ **FormItemProps**<`T`\>: { `children?`: `JSX.Element` \| ``null`` ; `extendTypes?`: { `[type: string]`: [`ExtendFormTypeProps`](#extendformtypeprops); } ; `label?`: `string` \| ``false`` ; `rules?`: `RuleObject`[] ; `render?`: () => `Element` } & `FormItemInputProps` & [`FaasItemProps`](#faasitemprops) & `Omit`<`AntdFormItemProps`<`T`\>, ``"children"``\>
299
+ Ƭ **FormItemProps**<`T`\>: { `children?`: `JSX.Element` \| ``null`` ; `extendTypes?`: { `[type: string]`: [`ExtendFormTypeProps`](#extendformtypeprops); } ; `label?`: `string` \| ``false`` ; `render?`: () => `JSX.Element` \| ``null`` ; `rules?`: `RuleObject`[] } & `FormItemInputProps` & [`FaasItemProps`](#faasitemprops) & `Omit`<`AntdFormItemProps`<`T`\>, ``"children"``\>
300
300
 
301
301
  #### Type parameters
302
302
 
@@ -308,7 +308,7 @@ ___
308
308
 
309
309
  ### FormProps
310
310
 
311
- Ƭ **FormProps**<`Values`, `ExtendItemProps`\>: { `beforeItems?`: `JSX.Element` \| `JSX.Element`[] ; `children?`: `ReactNode` ; `extendTypes?`: { `[type: string]`: [`ExtendFormTypeProps`](#extendformtypeprops); } ; `footer?`: `JSX.Element` \| `JSX.Element`[] ; `items?`: ([`FormItemProps`](#formitemprops) \| `ExtendItemProps`)[] ; `submit?`: ``false`` \| { `text?`: `string` ; `to?`: { `action`: `string` ; `params?`: `Record`<`string`, `any`\> } } ; `onFinish?`: (`values`: `Values`, `submit?`: (`values`: `any`) => `Promise`<`any`\>) => `Promise`<`any`\> } & `Omit`<`AntdFormProps`<`Values`\>, ``"onFinish"`` \| ``"children"``\>
311
+ Ƭ **FormProps**<`Values`, `ExtendItemProps`\>: { `beforeItems?`: `JSX.Element` \| `JSX.Element`[] ; `children?`: `ReactNode` ; `extendTypes?`: { `[type: string]`: [`ExtendFormTypeProps`](#extendformtypeprops); } ; `footer?`: `JSX.Element` \| `JSX.Element`[] ; `items?`: ([`FormItemProps`](#formitemprops) \| `ExtendItemProps`)[] ; `onFinish?`: (`values`: `Values`, `submit?`: (`values`: `any`) => `Promise`<`any`\>) => `Promise`<`any`\> ; `submit?`: ``false`` \| { `text?`: `string` ; `to?`: { `action`: `string` ; `params?`: `Record`<`string`, `any`\> } } } & `Omit`<`AntdFormProps`<`Values`\>, ``"onFinish"`` \| ``"children"``\>
312
312
 
313
313
  #### Type parameters
314
314
 
@@ -353,7 +353,7 @@ ___
353
353
 
354
354
  ### TableProps
355
355
 
356
- Ƭ **TableProps**<`T`, `ExtendTypes`\>: { `extendTypes?`: { `[key: string]`: [`ExtendTableTypeProps`](#extendtabletypeprops); } ; `faasData?`: `FaasDataWrapperProps`<`T`\> ; `items`: ([`TableItemProps`](#tableitemprops) \| `ExtendTypes` & [`ExtendTableItemProps`](#extendtableitemprops))[] ; `onChange?`: (`pagination`: `TablePaginationConfig`, `filters`: `Record`<`string`, `FilterValue`\>, `sorter`: `SorterResult`<`T`\> \| `SorterResult`<`T`\>[], `extra`: `TableCurrentDataSource`<`T`\>) => { `extra`: `TableCurrentDataSource`<`T`\> ; `filters`: `Record`<`string`, `FilterValue` \| ``null``\> ; `pagination`: `TablePaginationConfig` ; `sorter`: `SorterResult`<`T`\> \| `SorterResult`<`T`\>[] } } & `AntdTableProps`<`T`\>
356
+ Ƭ **TableProps**<`T`, `ExtendTypes`\>: { `extendTypes?`: { `[key: string]`: [`ExtendTableTypeProps`](#extendtabletypeprops); } ; `faasData?`: `FaasDataWrapperProps`<`T`\> ; `items`: ([`TableItemProps`](#tableitemprops) \| `ExtendTypes` & [`ExtendTableItemProps`](#extendtableitemprops))[] ; `onChange?`: (`pagination`: `TablePaginationConfig`, `filters`: `Record`<`string`, `FilterValue` \| ``null``\>, `sorter`: `SorterResult`<`T`\> \| `SorterResult`<`T`\>[], `extra`: `TableCurrentDataSource`<`T`\>) => { `extra`: `TableCurrentDataSource`<`T`\> ; `filters`: `Record`<`string`, `FilterValue` \| ``null``\> ; `pagination`: `TablePaginationConfig` ; `sorter`: `SorterResult`<`T`\> \| `SorterResult`<`T`\>[] } } & `AntdTableProps`<`T`\>
357
357
 
358
358
  #### Type parameters
359
359
 
@@ -436,12 +436,6 @@ ___
436
436
 
437
437
  • `Const` **DatePicker**: `PickerComponentClass`<`Omit`<`PickerBaseProps`<`Dayjs`\>, ``"locale"`` \| ``"generateConfig"`` \| ``"hideHeader"`` \| ``"components"``\> & {} & {} & `Omit`<`PickerDateProps`<`Dayjs`\>, ``"locale"`` \| ``"generateConfig"`` \| ``"hideHeader"`` \| ``"components"``\> & {} & {} & `Omit`<`PickerTimeProps`<`Dayjs`\>, ``"locale"`` \| ``"generateConfig"`` \| ``"hideHeader"`` \| ``"components"``\> & {} & {}, `unknown`\> & {}
438
438
 
439
- ___
440
-
441
- ### TimePicker
442
-
443
- • `Const` **TimePicker**: `ForwardRefExoticComponent`<[`TimePickerProps`](#timepickerprops) & `RefAttributes`<`any`\>\>
444
-
445
439
  ## Functions
446
440
 
447
441
  ### Blank
@@ -452,9 +446,9 @@ If value is undefined or null, return text, otherwise return value.
452
446
 
453
447
  #### Parameters
454
448
 
455
- | Name | Type |
456
- | :------ | :------ |
457
- | `options?` | [`BlankProps`](#blankprops) |
449
+ | Name | Type | Description |
450
+ | :------ | :------ | :------ |
451
+ | `options?` | [`BlankProps`](#blankprops) | {object} |
458
452
 
459
453
  #### Returns
460
454
 
@@ -490,11 +484,11 @@ Config for @faasjs/ant-design components.
490
484
 
491
485
  #### Parameters
492
486
 
493
- | Name | Type |
494
- | :------ | :------ |
495
- | `props` | `Object` |
496
- | `props.children` | `ReactNode` |
497
- | `props.config` | `Partial`<[`FaasState`](#faasstate)\> |
487
+ | Name | Type | Description |
488
+ | :------ | :------ | :------ |
489
+ | `props` | `Object` | {object} |
490
+ | `props.children` | `ReactNode` | - |
491
+ | `props.config` | `Partial`<[`FaasState`](#faasstate)\> | {Partial<FaasState>} |
498
492
 
499
493
  #### Returns
500
494
 
@@ -629,6 +623,24 @@ ___
629
623
 
630
624
  ___
631
625
 
626
+ ### TimePicker
627
+
628
+ ▸ **TimePicker**(`props`): `ReactElement`<`any`, `string` \| `JSXElementConstructor`<`any`\>\>
629
+
630
+ **NOTE**: Exotic components are not callable.
631
+
632
+ #### Parameters
633
+
634
+ | Name | Type |
635
+ | :------ | :------ |
636
+ | `props` | [`TimePickerProps`](#timepickerprops) & `RefAttributes`<`any`\> |
637
+
638
+ #### Returns
639
+
640
+ `ReactElement`<`any`, `string` \| `JSXElementConstructor`<`any`\>\>
641
+
642
+ ___
643
+
632
644
  ### Title
633
645
 
634
646
  ▸ **Title**(`props`): `JSX.Element`
package/dist/index.js CHANGED
@@ -1,26 +1,10 @@
1
+ "use strict";
1
2
  var __create = Object.create;
2
3
  var __defProp = Object.defineProperty;
3
- var __defProps = Object.defineProperties;
4
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
6
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
7
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
8
6
  var __getProtoOf = Object.getPrototypeOf;
9
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
10
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
11
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
12
- var __spreadValues = (a, b) => {
13
- for (var prop in b || (b = {}))
14
- if (__hasOwnProp.call(b, prop))
15
- __defNormalProp(a, prop, b[prop]);
16
- if (__getOwnPropSymbols)
17
- for (var prop of __getOwnPropSymbols(b)) {
18
- if (__propIsEnum.call(b, prop))
19
- __defNormalProp(a, prop, b[prop]);
20
- }
21
- return a;
22
- };
23
- var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
24
8
  var __export = (target, all) => {
25
9
  for (var name in all)
26
10
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -105,7 +89,10 @@ function ConfigProvider({
105
89
  children
106
90
  }) {
107
91
  return /* @__PURE__ */ import_react.default.createElement(ConfigContext.Provider, {
108
- value: __spreadValues(__spreadValues({}, baseConfig), config)
92
+ value: {
93
+ ...baseConfig,
94
+ ...config
95
+ }
109
96
  }, children);
110
97
  }
111
98
  function useConfigContext() {
@@ -154,7 +141,7 @@ function DescriptionItemContent(props) {
154
141
  const [computedProps, setComputedProps] = (0, import_react3.useState)();
155
142
  (0, import_react3.useEffect)(() => {
156
143
  var _a, _b;
157
- const propsCopy = __spreadValues({}, props);
144
+ const propsCopy = { ...props };
158
145
  if (!propsCopy.item.title)
159
146
  propsCopy.item.title = (0, import_lodash3.upperFirst)(propsCopy.item.id);
160
147
  if (!propsCopy.item.type)
@@ -224,7 +211,9 @@ function DescriptionItemContent(props) {
224
211
  }
225
212
  function Description(props) {
226
213
  if (!props.faasData)
227
- return /* @__PURE__ */ import_react.default.createElement(import_antd2.Descriptions, __spreadValues({}, props), props.items.map((item) => /* @__PURE__ */ import_react.default.createElement(import_antd2.Descriptions.Item, {
214
+ return /* @__PURE__ */ import_react.default.createElement(import_antd2.Descriptions, {
215
+ ...props
216
+ }, props.items.map((item) => /* @__PURE__ */ import_react.default.createElement(import_antd2.Descriptions.Item, {
228
217
  key: item.id,
229
218
  label: item.title || (0, import_lodash3.upperFirst)(item.id)
230
219
  }, /* @__PURE__ */ import_react.default.createElement(DescriptionItemContent, {
@@ -233,11 +222,13 @@ function Description(props) {
233
222
  values: props.dataSource,
234
223
  extendTypes: props.extendTypes
235
224
  }))));
236
- return /* @__PURE__ */ import_react.default.createElement(import_react4.FaasDataWrapper, __spreadValues({
225
+ return /* @__PURE__ */ import_react.default.createElement(import_react4.FaasDataWrapper, {
237
226
  fallback: props.faasData.fallback || /* @__PURE__ */ import_react.default.createElement(import_antd2.Skeleton, {
238
227
  active: true
239
228
  }),
240
- render: ({ data }) => /* @__PURE__ */ import_react.default.createElement(import_antd2.Descriptions, __spreadValues({}, props), props.items.map((item) => /* @__PURE__ */ import_react.default.createElement(import_antd2.Descriptions.Item, {
229
+ render: ({ data }) => /* @__PURE__ */ import_react.default.createElement(import_antd2.Descriptions, {
230
+ ...props
231
+ }, props.items.map((item) => /* @__PURE__ */ import_react.default.createElement(import_antd2.Descriptions.Item, {
241
232
  key: item.id,
242
233
  label: item.title || (0, import_lodash3.upperFirst)(item.id)
243
234
  }, /* @__PURE__ */ import_react.default.createElement(DescriptionItemContent, {
@@ -245,25 +236,33 @@ function Description(props) {
245
236
  value: data[item.id],
246
237
  values: data,
247
238
  extendTypes: props.extendTypes
248
- }))))
249
- }, props.faasData));
239
+ })))),
240
+ ...props.faasData
241
+ });
250
242
  }
251
243
 
252
244
  // src/Drawer.tsx
253
245
  var import_antd3 = require("antd");
254
246
  var import_react5 = require("react");
255
247
  function useDrawer(init) {
256
- const [props, setProps] = (0, import_react5.useState)(__spreadValues({
248
+ const [props, setProps] = (0, import_react5.useState)({
257
249
  visible: false,
258
- onClose: () => setProps((prev) => __spreadProps(__spreadValues({}, prev), {
250
+ onClose: () => setProps((prev) => ({
251
+ ...prev,
259
252
  visible: false
260
- }))
261
- }, init));
253
+ })),
254
+ ...init
255
+ });
262
256
  return {
263
- drawer: /* @__PURE__ */ import_react.default.createElement(import_antd3.Drawer, __spreadValues({}, props)),
257
+ drawer: /* @__PURE__ */ import_react.default.createElement(import_antd3.Drawer, {
258
+ ...props
259
+ }),
264
260
  drawerProps: props,
265
261
  setDrawerProps(changes) {
266
- setProps((prev) => __spreadValues(__spreadValues({}, prev), changes));
262
+ setProps((prev) => ({
263
+ ...prev,
264
+ ...changes
265
+ }));
267
266
  }
268
267
  };
269
268
  }
@@ -282,11 +281,12 @@ var import_lodash4 = require("lodash");
282
281
  // src/TimePicker.tsx
283
282
  var import_react6 = require("react");
284
283
  var TimePicker = (0, import_react6.forwardRef)((props, ref) => {
285
- return /* @__PURE__ */ import_react.default.createElement(DatePicker, __spreadProps(__spreadValues({}, props), {
284
+ return /* @__PURE__ */ import_react.default.createElement(DatePicker, {
285
+ ...props,
286
286
  picker: "time",
287
287
  mode: void 0,
288
288
  ref
289
- }));
289
+ });
290
290
  });
291
291
  TimePicker.displayName = "TimePicker";
292
292
 
@@ -342,24 +342,39 @@ function FormItem(props) {
342
342
  const [computedProps, setComputedProps] = (0, import_react7.useState)();
343
343
  const config = useConfigContext();
344
344
  (0, import_react7.useEffect)(() => {
345
- setComputedProps(processProps(__spreadValues({}, props), config));
345
+ setComputedProps(processProps({ ...props }, config));
346
346
  }, [props]);
347
347
  if (!computedProps)
348
348
  return null;
349
349
  if (computedProps.extendTypes && computedProps.extendTypes[computedProps.type])
350
- return /* @__PURE__ */ import_react.default.createElement(import_antd4.Form.Item, __spreadValues({}, computedProps), computedProps.extendTypes[computedProps.type].children);
350
+ return /* @__PURE__ */ import_react.default.createElement(import_antd4.Form.Item, {
351
+ ...computedProps
352
+ }, computedProps.extendTypes[computedProps.type].children);
351
353
  if (computedProps.children)
352
- return /* @__PURE__ */ import_react.default.createElement(import_antd4.Form.Item, __spreadValues({}, computedProps), computedProps.children);
354
+ return /* @__PURE__ */ import_react.default.createElement(import_antd4.Form.Item, {
355
+ ...computedProps
356
+ }, computedProps.children);
353
357
  if (computedProps.render)
354
- return /* @__PURE__ */ import_react.default.createElement(import_antd4.Form.Item, __spreadValues({}, computedProps), computedProps.render());
358
+ return /* @__PURE__ */ import_react.default.createElement(import_antd4.Form.Item, {
359
+ ...computedProps
360
+ }, computedProps.render());
355
361
  switch (computedProps.type) {
356
362
  case "string":
357
- return /* @__PURE__ */ import_react.default.createElement(import_antd4.Form.Item, __spreadValues({}, computedProps), computedProps.options ? /* @__PURE__ */ import_react.default.createElement(import_antd4.Select, __spreadValues({}, computedProps.input)) : /* @__PURE__ */ import_react.default.createElement(import_antd4.Input, __spreadValues({}, computedProps.input)));
363
+ return /* @__PURE__ */ import_react.default.createElement(import_antd4.Form.Item, {
364
+ ...computedProps
365
+ }, computedProps.options ? /* @__PURE__ */ import_react.default.createElement(import_antd4.Select, {
366
+ ...computedProps.input
367
+ }) : /* @__PURE__ */ import_react.default.createElement(import_antd4.Input, {
368
+ ...computedProps.input
369
+ }));
358
370
  case "string[]":
359
371
  if (computedProps.options)
360
- return /* @__PURE__ */ import_react.default.createElement(import_antd4.Form.Item, __spreadValues({}, computedProps), /* @__PURE__ */ import_react.default.createElement(import_antd4.Select, __spreadValues({
361
- mode: "multiple"
362
- }, computedProps.input)));
372
+ return /* @__PURE__ */ import_react.default.createElement(import_antd4.Form.Item, {
373
+ ...computedProps
374
+ }, /* @__PURE__ */ import_react.default.createElement(import_antd4.Select, {
375
+ mode: "multiple",
376
+ ...computedProps.input
377
+ }));
363
378
  return /* @__PURE__ */ import_react.default.createElement(import_antd4.Form.List, {
364
379
  name: computedProps.name,
365
380
  rules: computedProps.rules
@@ -378,9 +393,12 @@ function FormItem(props) {
378
393
  style: { flexFlow: "row nowrap" }
379
394
  }, /* @__PURE__ */ import_react.default.createElement(import_antd4.Col, {
380
395
  span: 23
381
- }, /* @__PURE__ */ import_react.default.createElement(import_antd4.Form.Item, __spreadProps(__spreadValues({}, field), {
396
+ }, /* @__PURE__ */ import_react.default.createElement(import_antd4.Form.Item, {
397
+ ...field,
382
398
  noStyle: true
383
- }), /* @__PURE__ */ import_react.default.createElement(import_antd4.Input, __spreadValues({}, computedProps.input)))), /* @__PURE__ */ import_react.default.createElement(import_antd4.Col, {
399
+ }, /* @__PURE__ */ import_react.default.createElement(import_antd4.Input, {
400
+ ...computedProps.input
401
+ }))), /* @__PURE__ */ import_react.default.createElement(import_antd4.Col, {
384
402
  span: 1
385
403
  }, !((_a3 = computedProps.input) == null ? void 0 : _a3.disabled) && (!computedProps.rules.find((r) => r.required) || field.key > 0) && /* @__PURE__ */ import_react.default.createElement(import_antd4.Button, {
386
404
  danger: true,
@@ -399,14 +417,22 @@ function FormItem(props) {
399
417
  })));
400
418
  });
401
419
  case "number":
402
- return /* @__PURE__ */ import_react.default.createElement(import_antd4.Form.Item, __spreadValues({}, computedProps), computedProps.options ? /* @__PURE__ */ import_react.default.createElement(import_antd4.Select, __spreadValues({}, computedProps.input)) : /* @__PURE__ */ import_react.default.createElement(import_antd4.InputNumber, __spreadValues({
403
- style: { width: "100%" }
404
- }, computedProps.input)));
420
+ return /* @__PURE__ */ import_react.default.createElement(import_antd4.Form.Item, {
421
+ ...computedProps
422
+ }, computedProps.options ? /* @__PURE__ */ import_react.default.createElement(import_antd4.Select, {
423
+ ...computedProps.input
424
+ }) : /* @__PURE__ */ import_react.default.createElement(import_antd4.InputNumber, {
425
+ style: { width: "100%" },
426
+ ...computedProps.input
427
+ }));
405
428
  case "number[]":
406
429
  if (computedProps.options)
407
- return /* @__PURE__ */ import_react.default.createElement(import_antd4.Form.Item, __spreadValues({}, computedProps), /* @__PURE__ */ import_react.default.createElement(import_antd4.Select, __spreadValues({
408
- mode: "multiple"
409
- }, computedProps.input)));
430
+ return /* @__PURE__ */ import_react.default.createElement(import_antd4.Form.Item, {
431
+ ...computedProps
432
+ }, /* @__PURE__ */ import_react.default.createElement(import_antd4.Select, {
433
+ mode: "multiple",
434
+ ...computedProps.input
435
+ }));
410
436
  return /* @__PURE__ */ import_react.default.createElement(import_antd4.Form.List, {
411
437
  name: computedProps.name,
412
438
  rules: computedProps.rules
@@ -425,11 +451,13 @@ function FormItem(props) {
425
451
  style: { flexFlow: "row nowrap" }
426
452
  }, /* @__PURE__ */ import_react.default.createElement(import_antd4.Col, {
427
453
  span: 23
428
- }, /* @__PURE__ */ import_react.default.createElement(import_antd4.Form.Item, __spreadProps(__spreadValues({}, field), {
454
+ }, /* @__PURE__ */ import_react.default.createElement(import_antd4.Form.Item, {
455
+ ...field,
429
456
  noStyle: true
430
- }), /* @__PURE__ */ import_react.default.createElement(import_antd4.InputNumber, __spreadValues({
431
- style: { width: "100%" }
432
- }, computedProps.input)))), /* @__PURE__ */ import_react.default.createElement(import_antd4.Col, {
457
+ }, /* @__PURE__ */ import_react.default.createElement(import_antd4.InputNumber, {
458
+ style: { width: "100%" },
459
+ ...computedProps.input
460
+ }))), /* @__PURE__ */ import_react.default.createElement(import_antd4.Col, {
433
461
  span: 1
434
462
  }, !((_a3 = computedProps.input) == null ? void 0 : _a3.disabled) && (!computedProps.rules.find((r) => r.required) || field.key > 0) && /* @__PURE__ */ import_react.default.createElement(import_antd4.Button, {
435
463
  danger: true,
@@ -448,19 +476,32 @@ function FormItem(props) {
448
476
  })));
449
477
  });
450
478
  case "boolean":
451
- return /* @__PURE__ */ import_react.default.createElement(import_antd4.Form.Item, __spreadValues({}, computedProps), /* @__PURE__ */ import_react.default.createElement(import_antd4.Switch, __spreadValues({}, computedProps.input)));
479
+ return /* @__PURE__ */ import_react.default.createElement(import_antd4.Form.Item, {
480
+ ...computedProps
481
+ }, /* @__PURE__ */ import_react.default.createElement(import_antd4.Switch, {
482
+ ...computedProps.input
483
+ }));
452
484
  case "date":
453
- return /* @__PURE__ */ import_react.default.createElement(import_antd4.Form.Item, __spreadValues({}, computedProps), /* @__PURE__ */ import_react.default.createElement(DatePicker, __spreadValues({}, computedProps.input)));
485
+ return /* @__PURE__ */ import_react.default.createElement(import_antd4.Form.Item, {
486
+ ...computedProps
487
+ }, /* @__PURE__ */ import_react.default.createElement(DatePicker, {
488
+ ...computedProps.input
489
+ }));
454
490
  case "time":
455
- return /* @__PURE__ */ import_react.default.createElement(import_antd4.Form.Item, __spreadValues({}, computedProps), /* @__PURE__ */ import_react.default.createElement(TimePicker, __spreadValues({}, computedProps.input)));
491
+ return /* @__PURE__ */ import_react.default.createElement(import_antd4.Form.Item, {
492
+ ...computedProps
493
+ }, /* @__PURE__ */ import_react.default.createElement(TimePicker, {
494
+ ...computedProps.input
495
+ }));
456
496
  case "object":
457
497
  return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, computedProps.label && /* @__PURE__ */ import_react.default.createElement("div", {
458
498
  className: "ant-form-item-label"
459
499
  }, /* @__PURE__ */ import_react.default.createElement("label", {
460
500
  className: ((_a = computedProps.rules) == null ? void 0 : _a.find((r) => r.required)) && "ant-form-item-required"
461
- }, computedProps.label)), computedProps.object.map((o) => /* @__PURE__ */ import_react.default.createElement(FormItem, __spreadValues({
462
- key: o.id
463
- }, o))));
501
+ }, computedProps.label)), computedProps.object.map((o) => /* @__PURE__ */ import_react.default.createElement(FormItem, {
502
+ key: o.id,
503
+ ...o
504
+ })));
464
505
  case "object[]":
465
506
  return /* @__PURE__ */ import_react.default.createElement(import_antd4.Form.List, {
466
507
  name: computedProps.name,
@@ -479,9 +520,10 @@ function FormItem(props) {
479
520
  }, computedProps.object.map((o) => /* @__PURE__ */ import_react.default.createElement(import_antd4.Col, {
480
521
  key: o.id,
481
522
  span: o.col || 6
482
- }, /* @__PURE__ */ import_react.default.createElement(FormItem, __spreadProps(__spreadValues({}, o), {
523
+ }, /* @__PURE__ */ import_react.default.createElement(FormItem, {
524
+ ...o,
483
525
  name: [field.name, o.id]
484
- }))))))), /* @__PURE__ */ import_react.default.createElement(import_antd4.Form.Item, null, !computedProps.disabled && (!computedProps.maxCount || computedProps.maxCount > fields.length) && /* @__PURE__ */ import_react.default.createElement(import_antd4.Button, {
526
+ })))))), /* @__PURE__ */ import_react.default.createElement(import_antd4.Form.Item, null, !computedProps.disabled && (!computedProps.maxCount || computedProps.maxCount > fields.length) && /* @__PURE__ */ import_react.default.createElement(import_antd4.Button, {
485
527
  type: "dashed",
486
528
  block: true,
487
529
  onClick: () => add(),
@@ -502,14 +544,17 @@ function Form(props) {
502
544
  const config = useConfigContext();
503
545
  (0, import_react9.useEffect)(() => {
504
546
  var _a2;
505
- const propsCopy = __spreadValues({}, props);
547
+ const propsCopy = { ...props };
506
548
  if (propsCopy.onFinish) {
507
549
  propsCopy.onFinish = async (values) => {
508
550
  var _a3;
509
551
  setLoading(true);
510
552
  try {
511
553
  if (propsCopy.submit && ((_a3 = propsCopy.submit.to) == null ? void 0 : _a3.action)) {
512
- await props.onFinish(values, async (values2) => (0, import_react8.faas)(propsCopy.submit.to.action, propsCopy.submit.to.params ? __spreadValues(__spreadValues({}, values2), propsCopy.submit.to.params) : values2));
554
+ await props.onFinish(values, async (values2) => (0, import_react8.faas)(propsCopy.submit.to.action, propsCopy.submit.to.params ? {
555
+ ...values2,
556
+ ...propsCopy.submit.to.params
557
+ } : values2));
513
558
  } else
514
559
  await props.onFinish(values);
515
560
  } catch (error) {
@@ -519,18 +564,23 @@ function Form(props) {
519
564
  };
520
565
  } else if (propsCopy.submit && ((_a2 = propsCopy.submit.to) == null ? void 0 : _a2.action)) {
521
566
  propsCopy.onFinish = async (values) => {
522
- return await (0, import_react8.faas)(propsCopy.submit.to.action, propsCopy.submit.to.params ? __spreadValues(__spreadValues({}, values), propsCopy.submit.to.params) : values);
567
+ return await (0, import_react8.faas)(propsCopy.submit.to.action, propsCopy.submit.to.params ? {
568
+ ...values,
569
+ ...propsCopy.submit.to.params
570
+ } : values);
523
571
  };
524
572
  }
525
573
  setComputedProps(propsCopy);
526
574
  }, []);
527
575
  if (!computedProps)
528
576
  return null;
529
- return /* @__PURE__ */ import_react.default.createElement(import_antd5.Form, __spreadValues({}, computedProps), computedProps.beforeItems, (_a = computedProps.items) == null ? void 0 : _a.map((item) => /* @__PURE__ */ import_react.default.createElement(FormItem, __spreadProps(__spreadValues({
530
- key: item.id
531
- }, item), {
577
+ return /* @__PURE__ */ import_react.default.createElement(import_antd5.Form, {
578
+ ...computedProps
579
+ }, computedProps.beforeItems, (_a = computedProps.items) == null ? void 0 : _a.map((item) => /* @__PURE__ */ import_react.default.createElement(FormItem, {
580
+ key: item.id,
581
+ ...item,
532
582
  extendTypes: computedProps.extendTypes
533
- }))), computedProps.children, computedProps.submit !== false && /* @__PURE__ */ import_react.default.createElement(import_antd5.Button, {
583
+ })), computedProps.children, computedProps.submit !== false && /* @__PURE__ */ import_react.default.createElement(import_antd5.Button, {
534
584
  htmlType: "submit",
535
585
  type: "primary",
536
586
  loading
@@ -543,17 +593,24 @@ Form.Item = FormItem;
543
593
  var import_antd6 = require("antd");
544
594
  var import_react10 = require("react");
545
595
  function useModal(init) {
546
- const [props, setProps] = (0, import_react10.useState)(__spreadValues({
596
+ const [props, setProps] = (0, import_react10.useState)({
547
597
  visible: false,
548
- onCancel: () => setProps((prev) => __spreadProps(__spreadValues({}, prev), {
598
+ onCancel: () => setProps((prev) => ({
599
+ ...prev,
549
600
  visible: false
550
- }))
551
- }, init));
601
+ })),
602
+ ...init
603
+ });
552
604
  return {
553
- modal: /* @__PURE__ */ import_react.default.createElement(import_antd6.Modal, __spreadValues({}, props)),
605
+ modal: /* @__PURE__ */ import_react.default.createElement(import_antd6.Modal, {
606
+ ...props
607
+ }),
554
608
  modalProps: props,
555
609
  setModalProps(changes) {
556
- setProps((prev) => __spreadValues(__spreadValues({}, prev), changes));
610
+ setProps((prev) => ({
611
+ ...prev,
612
+ ...changes
613
+ }));
557
614
  }
558
615
  };
559
616
  }
@@ -570,9 +627,9 @@ function NotFound() {
570
627
  });
571
628
  }
572
629
  function Routes(props) {
573
- return /* @__PURE__ */ import_react.default.createElement(import_react_router_dom.Routes, null, props.routes.map((r) => /* @__PURE__ */ import_react.default.createElement(import_react_router_dom.Route, __spreadProps(__spreadValues({
574
- key: r.path
575
- }, r), {
630
+ return /* @__PURE__ */ import_react.default.createElement(import_react_router_dom.Routes, null, props.routes.map((r) => /* @__PURE__ */ import_react.default.createElement(import_react_router_dom.Route, {
631
+ key: r.path,
632
+ ...r,
576
633
  element: r.element || /* @__PURE__ */ import_react.default.createElement(import_react11.Suspense, {
577
634
  fallback: props.fallback || /* @__PURE__ */ import_react.default.createElement("div", {
578
635
  style: { padding: "24px" }
@@ -580,7 +637,7 @@ function Routes(props) {
580
637
  active: true
581
638
  }))
582
639
  }, /* @__PURE__ */ import_react.default.createElement(r.page, null))
583
- }))), /* @__PURE__ */ import_react.default.createElement(import_react_router_dom.Route, {
640
+ })), /* @__PURE__ */ import_react.default.createElement(import_react_router_dom.Route, {
584
641
  key: "*",
585
642
  path: "*",
586
643
  element: props.notFound || /* @__PURE__ */ import_react.default.createElement(NotFound, null)
@@ -756,12 +813,13 @@ function Table(props) {
756
813
  if (!columns)
757
814
  return null;
758
815
  if (!props.faasData)
759
- return /* @__PURE__ */ import_react.default.createElement(import_antd8.Table, __spreadProps(__spreadValues({}, props), {
816
+ return /* @__PURE__ */ import_react.default.createElement(import_antd8.Table, {
817
+ ...props,
760
818
  rowKey: props.rowKey || "id",
761
819
  columns,
762
820
  dataSource: props.dataSource
763
- }));
764
- return /* @__PURE__ */ import_react.default.createElement(import_react13.FaasDataWrapper, __spreadValues({
821
+ });
822
+ return /* @__PURE__ */ import_react.default.createElement(import_react13.FaasDataWrapper, {
765
823
  fallback: props.faasData.fallback || /* @__PURE__ */ import_react.default.createElement(import_antd8.Skeleton, {
766
824
  active: true
767
825
  }),
@@ -771,41 +829,50 @@ function Table(props) {
771
829
  reload
772
830
  }) => {
773
831
  if (!data)
774
- return /* @__PURE__ */ import_react.default.createElement(import_antd8.Table, __spreadProps(__spreadValues({}, props), {
832
+ return /* @__PURE__ */ import_react.default.createElement(import_antd8.Table, {
833
+ ...props,
775
834
  rowKey: props.rowKey || "id",
776
835
  columns,
777
836
  dataSource: []
778
- }));
837
+ });
779
838
  if (Array.isArray(data))
780
- return /* @__PURE__ */ import_react.default.createElement(import_antd8.Table, __spreadProps(__spreadValues({}, props), {
839
+ return /* @__PURE__ */ import_react.default.createElement(import_antd8.Table, {
840
+ ...props,
781
841
  rowKey: props.rowKey || "id",
782
842
  columns,
783
843
  dataSource: data
784
- }));
785
- return /* @__PURE__ */ import_react.default.createElement(import_antd8.Table, __spreadProps(__spreadValues({}, props), {
844
+ });
845
+ return /* @__PURE__ */ import_react.default.createElement(import_antd8.Table, {
846
+ ...props,
786
847
  rowKey: props.rowKey || "id",
787
848
  columns,
788
849
  dataSource: data.rows,
789
- pagination: __spreadValues(__spreadValues({}, props.pagination), data.pagination),
850
+ pagination: {
851
+ ...props.pagination,
852
+ ...data.pagination
853
+ },
790
854
  onChange: (pagination, filters, sorter, extra) => {
791
855
  if (props.onChange) {
792
856
  const processed = props.onChange(pagination, filters, sorter, extra);
793
- reload(__spreadProps(__spreadValues({}, params), {
857
+ reload({
858
+ ...params,
794
859
  pagination: processed.pagination,
795
860
  filters: processed.filters,
796
861
  sorter: processed.sorter
797
- }));
862
+ });
798
863
  return;
799
864
  }
800
- reload(__spreadProps(__spreadValues({}, params), {
865
+ reload({
866
+ ...params,
801
867
  pagination,
802
868
  filters,
803
869
  sorter
804
- }));
870
+ });
805
871
  }
806
- }));
807
- }
808
- }, props.faasData));
872
+ });
873
+ },
874
+ ...props.faasData
875
+ });
809
876
  }
810
877
 
811
878
  // src/Title.tsx
package/dist/index.mjs CHANGED
@@ -1,22 +1,4 @@
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));
1
+ "use strict";
20
2
 
21
3
  // react-shim.js
22
4
  import React from "react";
@@ -63,7 +45,10 @@ function ConfigProvider({
63
45
  children
64
46
  }) {
65
47
  return /* @__PURE__ */ React.createElement(ConfigContext.Provider, {
66
- value: __spreadValues(__spreadValues({}, baseConfig), config)
48
+ value: {
49
+ ...baseConfig,
50
+ ...config
51
+ }
67
52
  }, children);
68
53
  }
69
54
  function useConfigContext() {
@@ -119,7 +104,7 @@ function DescriptionItemContent(props) {
119
104
  const [computedProps, setComputedProps] = useState();
120
105
  useEffect(() => {
121
106
  var _a, _b;
122
- const propsCopy = __spreadValues({}, props);
107
+ const propsCopy = { ...props };
123
108
  if (!propsCopy.item.title)
124
109
  propsCopy.item.title = upperFirst2(propsCopy.item.id);
125
110
  if (!propsCopy.item.type)
@@ -189,7 +174,9 @@ function DescriptionItemContent(props) {
189
174
  }
190
175
  function Description(props) {
191
176
  if (!props.faasData)
192
- return /* @__PURE__ */ React.createElement(Descriptions, __spreadValues({}, props), props.items.map((item) => /* @__PURE__ */ React.createElement(Descriptions.Item, {
177
+ return /* @__PURE__ */ React.createElement(Descriptions, {
178
+ ...props
179
+ }, props.items.map((item) => /* @__PURE__ */ React.createElement(Descriptions.Item, {
193
180
  key: item.id,
194
181
  label: item.title || upperFirst2(item.id)
195
182
  }, /* @__PURE__ */ React.createElement(DescriptionItemContent, {
@@ -198,11 +185,13 @@ function Description(props) {
198
185
  values: props.dataSource,
199
186
  extendTypes: props.extendTypes
200
187
  }))));
201
- return /* @__PURE__ */ React.createElement(FaasDataWrapper, __spreadValues({
188
+ return /* @__PURE__ */ React.createElement(FaasDataWrapper, {
202
189
  fallback: props.faasData.fallback || /* @__PURE__ */ React.createElement(Skeleton, {
203
190
  active: true
204
191
  }),
205
- render: ({ data }) => /* @__PURE__ */ React.createElement(Descriptions, __spreadValues({}, props), props.items.map((item) => /* @__PURE__ */ React.createElement(Descriptions.Item, {
192
+ render: ({ data }) => /* @__PURE__ */ React.createElement(Descriptions, {
193
+ ...props
194
+ }, props.items.map((item) => /* @__PURE__ */ React.createElement(Descriptions.Item, {
206
195
  key: item.id,
207
196
  label: item.title || upperFirst2(item.id)
208
197
  }, /* @__PURE__ */ React.createElement(DescriptionItemContent, {
@@ -210,25 +199,33 @@ function Description(props) {
210
199
  value: data[item.id],
211
200
  values: data,
212
201
  extendTypes: props.extendTypes
213
- }))))
214
- }, props.faasData));
202
+ })))),
203
+ ...props.faasData
204
+ });
215
205
  }
216
206
 
217
207
  // src/Drawer.tsx
218
208
  import { Drawer } from "antd";
219
209
  import { useState as useState2 } from "react";
220
210
  function useDrawer(init) {
221
- const [props, setProps] = useState2(__spreadValues({
211
+ const [props, setProps] = useState2({
222
212
  visible: false,
223
- onClose: () => setProps((prev) => __spreadProps(__spreadValues({}, prev), {
213
+ onClose: () => setProps((prev) => ({
214
+ ...prev,
224
215
  visible: false
225
- }))
226
- }, init));
216
+ })),
217
+ ...init
218
+ });
227
219
  return {
228
- drawer: /* @__PURE__ */ React.createElement(Drawer, __spreadValues({}, props)),
220
+ drawer: /* @__PURE__ */ React.createElement(Drawer, {
221
+ ...props
222
+ }),
229
223
  drawerProps: props,
230
224
  setDrawerProps(changes) {
231
- setProps((prev) => __spreadValues(__spreadValues({}, prev), changes));
225
+ setProps((prev) => ({
226
+ ...prev,
227
+ ...changes
228
+ }));
232
229
  }
233
230
  };
234
231
  }
@@ -262,11 +259,12 @@ import { upperFirst as upperFirst3 } from "lodash";
262
259
  // src/TimePicker.tsx
263
260
  import { forwardRef } from "react";
264
261
  var TimePicker = forwardRef((props, ref) => {
265
- return /* @__PURE__ */ React.createElement(DatePicker, __spreadProps(__spreadValues({}, props), {
262
+ return /* @__PURE__ */ React.createElement(DatePicker, {
263
+ ...props,
266
264
  picker: "time",
267
265
  mode: void 0,
268
266
  ref
269
- }));
267
+ });
270
268
  });
271
269
  TimePicker.displayName = "TimePicker";
272
270
 
@@ -322,24 +320,39 @@ function FormItem(props) {
322
320
  const [computedProps, setComputedProps] = useState3();
323
321
  const config = useConfigContext();
324
322
  useEffect2(() => {
325
- setComputedProps(processProps(__spreadValues({}, props), config));
323
+ setComputedProps(processProps({ ...props }, config));
326
324
  }, [props]);
327
325
  if (!computedProps)
328
326
  return null;
329
327
  if (computedProps.extendTypes && computedProps.extendTypes[computedProps.type])
330
- return /* @__PURE__ */ React.createElement(AntdForm.Item, __spreadValues({}, computedProps), computedProps.extendTypes[computedProps.type].children);
328
+ return /* @__PURE__ */ React.createElement(AntdForm.Item, {
329
+ ...computedProps
330
+ }, computedProps.extendTypes[computedProps.type].children);
331
331
  if (computedProps.children)
332
- return /* @__PURE__ */ React.createElement(AntdForm.Item, __spreadValues({}, computedProps), computedProps.children);
332
+ return /* @__PURE__ */ React.createElement(AntdForm.Item, {
333
+ ...computedProps
334
+ }, computedProps.children);
333
335
  if (computedProps.render)
334
- return /* @__PURE__ */ React.createElement(AntdForm.Item, __spreadValues({}, computedProps), computedProps.render());
336
+ return /* @__PURE__ */ React.createElement(AntdForm.Item, {
337
+ ...computedProps
338
+ }, computedProps.render());
335
339
  switch (computedProps.type) {
336
340
  case "string":
337
- return /* @__PURE__ */ React.createElement(AntdForm.Item, __spreadValues({}, computedProps), computedProps.options ? /* @__PURE__ */ React.createElement(Select, __spreadValues({}, computedProps.input)) : /* @__PURE__ */ React.createElement(Input, __spreadValues({}, computedProps.input)));
341
+ return /* @__PURE__ */ React.createElement(AntdForm.Item, {
342
+ ...computedProps
343
+ }, computedProps.options ? /* @__PURE__ */ React.createElement(Select, {
344
+ ...computedProps.input
345
+ }) : /* @__PURE__ */ React.createElement(Input, {
346
+ ...computedProps.input
347
+ }));
338
348
  case "string[]":
339
349
  if (computedProps.options)
340
- return /* @__PURE__ */ React.createElement(AntdForm.Item, __spreadValues({}, computedProps), /* @__PURE__ */ React.createElement(Select, __spreadValues({
341
- mode: "multiple"
342
- }, computedProps.input)));
350
+ return /* @__PURE__ */ React.createElement(AntdForm.Item, {
351
+ ...computedProps
352
+ }, /* @__PURE__ */ React.createElement(Select, {
353
+ mode: "multiple",
354
+ ...computedProps.input
355
+ }));
343
356
  return /* @__PURE__ */ React.createElement(AntdForm.List, {
344
357
  name: computedProps.name,
345
358
  rules: computedProps.rules
@@ -358,9 +371,12 @@ function FormItem(props) {
358
371
  style: { flexFlow: "row nowrap" }
359
372
  }, /* @__PURE__ */ React.createElement(Col, {
360
373
  span: 23
361
- }, /* @__PURE__ */ React.createElement(AntdForm.Item, __spreadProps(__spreadValues({}, field), {
374
+ }, /* @__PURE__ */ React.createElement(AntdForm.Item, {
375
+ ...field,
362
376
  noStyle: true
363
- }), /* @__PURE__ */ React.createElement(Input, __spreadValues({}, computedProps.input)))), /* @__PURE__ */ React.createElement(Col, {
377
+ }, /* @__PURE__ */ React.createElement(Input, {
378
+ ...computedProps.input
379
+ }))), /* @__PURE__ */ React.createElement(Col, {
364
380
  span: 1
365
381
  }, !((_a3 = computedProps.input) == null ? void 0 : _a3.disabled) && (!computedProps.rules.find((r) => r.required) || field.key > 0) && /* @__PURE__ */ React.createElement(Button, {
366
382
  danger: true,
@@ -379,14 +395,22 @@ function FormItem(props) {
379
395
  })));
380
396
  });
381
397
  case "number":
382
- return /* @__PURE__ */ React.createElement(AntdForm.Item, __spreadValues({}, computedProps), computedProps.options ? /* @__PURE__ */ React.createElement(Select, __spreadValues({}, computedProps.input)) : /* @__PURE__ */ React.createElement(InputNumber, __spreadValues({
383
- style: { width: "100%" }
384
- }, computedProps.input)));
398
+ return /* @__PURE__ */ React.createElement(AntdForm.Item, {
399
+ ...computedProps
400
+ }, computedProps.options ? /* @__PURE__ */ React.createElement(Select, {
401
+ ...computedProps.input
402
+ }) : /* @__PURE__ */ React.createElement(InputNumber, {
403
+ style: { width: "100%" },
404
+ ...computedProps.input
405
+ }));
385
406
  case "number[]":
386
407
  if (computedProps.options)
387
- return /* @__PURE__ */ React.createElement(AntdForm.Item, __spreadValues({}, computedProps), /* @__PURE__ */ React.createElement(Select, __spreadValues({
388
- mode: "multiple"
389
- }, computedProps.input)));
408
+ return /* @__PURE__ */ React.createElement(AntdForm.Item, {
409
+ ...computedProps
410
+ }, /* @__PURE__ */ React.createElement(Select, {
411
+ mode: "multiple",
412
+ ...computedProps.input
413
+ }));
390
414
  return /* @__PURE__ */ React.createElement(AntdForm.List, {
391
415
  name: computedProps.name,
392
416
  rules: computedProps.rules
@@ -405,11 +429,13 @@ function FormItem(props) {
405
429
  style: { flexFlow: "row nowrap" }
406
430
  }, /* @__PURE__ */ React.createElement(Col, {
407
431
  span: 23
408
- }, /* @__PURE__ */ React.createElement(AntdForm.Item, __spreadProps(__spreadValues({}, field), {
432
+ }, /* @__PURE__ */ React.createElement(AntdForm.Item, {
433
+ ...field,
409
434
  noStyle: true
410
- }), /* @__PURE__ */ React.createElement(InputNumber, __spreadValues({
411
- style: { width: "100%" }
412
- }, computedProps.input)))), /* @__PURE__ */ React.createElement(Col, {
435
+ }, /* @__PURE__ */ React.createElement(InputNumber, {
436
+ style: { width: "100%" },
437
+ ...computedProps.input
438
+ }))), /* @__PURE__ */ React.createElement(Col, {
413
439
  span: 1
414
440
  }, !((_a3 = computedProps.input) == null ? void 0 : _a3.disabled) && (!computedProps.rules.find((r) => r.required) || field.key > 0) && /* @__PURE__ */ React.createElement(Button, {
415
441
  danger: true,
@@ -428,19 +454,32 @@ function FormItem(props) {
428
454
  })));
429
455
  });
430
456
  case "boolean":
431
- return /* @__PURE__ */ React.createElement(AntdForm.Item, __spreadValues({}, computedProps), /* @__PURE__ */ React.createElement(Switch, __spreadValues({}, computedProps.input)));
457
+ return /* @__PURE__ */ React.createElement(AntdForm.Item, {
458
+ ...computedProps
459
+ }, /* @__PURE__ */ React.createElement(Switch, {
460
+ ...computedProps.input
461
+ }));
432
462
  case "date":
433
- return /* @__PURE__ */ React.createElement(AntdForm.Item, __spreadValues({}, computedProps), /* @__PURE__ */ React.createElement(DatePicker, __spreadValues({}, computedProps.input)));
463
+ return /* @__PURE__ */ React.createElement(AntdForm.Item, {
464
+ ...computedProps
465
+ }, /* @__PURE__ */ React.createElement(DatePicker, {
466
+ ...computedProps.input
467
+ }));
434
468
  case "time":
435
- return /* @__PURE__ */ React.createElement(AntdForm.Item, __spreadValues({}, computedProps), /* @__PURE__ */ React.createElement(TimePicker, __spreadValues({}, computedProps.input)));
469
+ return /* @__PURE__ */ React.createElement(AntdForm.Item, {
470
+ ...computedProps
471
+ }, /* @__PURE__ */ React.createElement(TimePicker, {
472
+ ...computedProps.input
473
+ }));
436
474
  case "object":
437
475
  return /* @__PURE__ */ React.createElement(React.Fragment, null, computedProps.label && /* @__PURE__ */ React.createElement("div", {
438
476
  className: "ant-form-item-label"
439
477
  }, /* @__PURE__ */ React.createElement("label", {
440
478
  className: ((_a = computedProps.rules) == null ? void 0 : _a.find((r) => r.required)) && "ant-form-item-required"
441
- }, computedProps.label)), computedProps.object.map((o) => /* @__PURE__ */ React.createElement(FormItem, __spreadValues({
442
- key: o.id
443
- }, o))));
479
+ }, computedProps.label)), computedProps.object.map((o) => /* @__PURE__ */ React.createElement(FormItem, {
480
+ key: o.id,
481
+ ...o
482
+ })));
444
483
  case "object[]":
445
484
  return /* @__PURE__ */ React.createElement(AntdForm.List, {
446
485
  name: computedProps.name,
@@ -459,9 +498,10 @@ function FormItem(props) {
459
498
  }, computedProps.object.map((o) => /* @__PURE__ */ React.createElement(Col, {
460
499
  key: o.id,
461
500
  span: o.col || 6
462
- }, /* @__PURE__ */ React.createElement(FormItem, __spreadProps(__spreadValues({}, o), {
501
+ }, /* @__PURE__ */ React.createElement(FormItem, {
502
+ ...o,
463
503
  name: [field.name, o.id]
464
- }))))))), /* @__PURE__ */ React.createElement(AntdForm.Item, null, !computedProps.disabled && (!computedProps.maxCount || computedProps.maxCount > fields.length) && /* @__PURE__ */ React.createElement(Button, {
504
+ })))))), /* @__PURE__ */ React.createElement(AntdForm.Item, null, !computedProps.disabled && (!computedProps.maxCount || computedProps.maxCount > fields.length) && /* @__PURE__ */ React.createElement(Button, {
465
505
  type: "dashed",
466
506
  block: true,
467
507
  onClick: () => add(),
@@ -482,14 +522,17 @@ function Form(props) {
482
522
  const config = useConfigContext();
483
523
  useEffect3(() => {
484
524
  var _a2;
485
- const propsCopy = __spreadValues({}, props);
525
+ const propsCopy = { ...props };
486
526
  if (propsCopy.onFinish) {
487
527
  propsCopy.onFinish = async (values) => {
488
528
  var _a3;
489
529
  setLoading(true);
490
530
  try {
491
531
  if (propsCopy.submit && ((_a3 = propsCopy.submit.to) == null ? void 0 : _a3.action)) {
492
- await props.onFinish(values, async (values2) => faas(propsCopy.submit.to.action, propsCopy.submit.to.params ? __spreadValues(__spreadValues({}, values2), propsCopy.submit.to.params) : values2));
532
+ await props.onFinish(values, async (values2) => faas(propsCopy.submit.to.action, propsCopy.submit.to.params ? {
533
+ ...values2,
534
+ ...propsCopy.submit.to.params
535
+ } : values2));
493
536
  } else
494
537
  await props.onFinish(values);
495
538
  } catch (error) {
@@ -499,18 +542,23 @@ function Form(props) {
499
542
  };
500
543
  } else if (propsCopy.submit && ((_a2 = propsCopy.submit.to) == null ? void 0 : _a2.action)) {
501
544
  propsCopy.onFinish = async (values) => {
502
- return await faas(propsCopy.submit.to.action, propsCopy.submit.to.params ? __spreadValues(__spreadValues({}, values), propsCopy.submit.to.params) : values);
545
+ return await faas(propsCopy.submit.to.action, propsCopy.submit.to.params ? {
546
+ ...values,
547
+ ...propsCopy.submit.to.params
548
+ } : values);
503
549
  };
504
550
  }
505
551
  setComputedProps(propsCopy);
506
552
  }, []);
507
553
  if (!computedProps)
508
554
  return null;
509
- return /* @__PURE__ */ React.createElement(AntdForm2, __spreadValues({}, computedProps), computedProps.beforeItems, (_a = computedProps.items) == null ? void 0 : _a.map((item) => /* @__PURE__ */ React.createElement(FormItem, __spreadProps(__spreadValues({
510
- key: item.id
511
- }, item), {
555
+ return /* @__PURE__ */ React.createElement(AntdForm2, {
556
+ ...computedProps
557
+ }, computedProps.beforeItems, (_a = computedProps.items) == null ? void 0 : _a.map((item) => /* @__PURE__ */ React.createElement(FormItem, {
558
+ key: item.id,
559
+ ...item,
512
560
  extendTypes: computedProps.extendTypes
513
- }))), computedProps.children, computedProps.submit !== false && /* @__PURE__ */ React.createElement(Button2, {
561
+ })), computedProps.children, computedProps.submit !== false && /* @__PURE__ */ React.createElement(Button2, {
514
562
  htmlType: "submit",
515
563
  type: "primary",
516
564
  loading
@@ -523,17 +571,24 @@ Form.Item = FormItem;
523
571
  import { Modal } from "antd";
524
572
  import { useState as useState5 } from "react";
525
573
  function useModal(init) {
526
- const [props, setProps] = useState5(__spreadValues({
574
+ const [props, setProps] = useState5({
527
575
  visible: false,
528
- onCancel: () => setProps((prev) => __spreadProps(__spreadValues({}, prev), {
576
+ onCancel: () => setProps((prev) => ({
577
+ ...prev,
529
578
  visible: false
530
- }))
531
- }, init));
579
+ })),
580
+ ...init
581
+ });
532
582
  return {
533
- modal: /* @__PURE__ */ React.createElement(Modal, __spreadValues({}, props)),
583
+ modal: /* @__PURE__ */ React.createElement(Modal, {
584
+ ...props
585
+ }),
534
586
  modalProps: props,
535
587
  setModalProps(changes) {
536
- setProps((prev) => __spreadValues(__spreadValues({}, prev), changes));
588
+ setProps((prev) => ({
589
+ ...prev,
590
+ ...changes
591
+ }));
537
592
  }
538
593
  };
539
594
  }
@@ -555,9 +610,9 @@ function NotFound() {
555
610
  });
556
611
  }
557
612
  function Routes(props) {
558
- return /* @__PURE__ */ React.createElement(OriginRoutes, null, props.routes.map((r) => /* @__PURE__ */ React.createElement(Route, __spreadProps(__spreadValues({
559
- key: r.path
560
- }, r), {
613
+ return /* @__PURE__ */ React.createElement(OriginRoutes, null, props.routes.map((r) => /* @__PURE__ */ React.createElement(Route, {
614
+ key: r.path,
615
+ ...r,
561
616
  element: r.element || /* @__PURE__ */ React.createElement(Suspense, {
562
617
  fallback: props.fallback || /* @__PURE__ */ React.createElement("div", {
563
618
  style: { padding: "24px" }
@@ -565,7 +620,7 @@ function Routes(props) {
565
620
  active: true
566
621
  }))
567
622
  }, /* @__PURE__ */ React.createElement(r.page, null))
568
- }))), /* @__PURE__ */ React.createElement(Route, {
623
+ })), /* @__PURE__ */ React.createElement(Route, {
569
624
  key: "*",
570
625
  path: "*",
571
626
  element: props.notFound || /* @__PURE__ */ React.createElement(NotFound, null)
@@ -749,12 +804,13 @@ function Table(props) {
749
804
  if (!columns)
750
805
  return null;
751
806
  if (!props.faasData)
752
- return /* @__PURE__ */ React.createElement(AntdTable, __spreadProps(__spreadValues({}, props), {
807
+ return /* @__PURE__ */ React.createElement(AntdTable, {
808
+ ...props,
753
809
  rowKey: props.rowKey || "id",
754
810
  columns,
755
811
  dataSource: props.dataSource
756
- }));
757
- return /* @__PURE__ */ React.createElement(FaasDataWrapper2, __spreadValues({
812
+ });
813
+ return /* @__PURE__ */ React.createElement(FaasDataWrapper2, {
758
814
  fallback: props.faasData.fallback || /* @__PURE__ */ React.createElement(Skeleton3, {
759
815
  active: true
760
816
  }),
@@ -764,41 +820,50 @@ function Table(props) {
764
820
  reload
765
821
  }) => {
766
822
  if (!data)
767
- return /* @__PURE__ */ React.createElement(AntdTable, __spreadProps(__spreadValues({}, props), {
823
+ return /* @__PURE__ */ React.createElement(AntdTable, {
824
+ ...props,
768
825
  rowKey: props.rowKey || "id",
769
826
  columns,
770
827
  dataSource: []
771
- }));
828
+ });
772
829
  if (Array.isArray(data))
773
- return /* @__PURE__ */ React.createElement(AntdTable, __spreadProps(__spreadValues({}, props), {
830
+ return /* @__PURE__ */ React.createElement(AntdTable, {
831
+ ...props,
774
832
  rowKey: props.rowKey || "id",
775
833
  columns,
776
834
  dataSource: data
777
- }));
778
- return /* @__PURE__ */ React.createElement(AntdTable, __spreadProps(__spreadValues({}, props), {
835
+ });
836
+ return /* @__PURE__ */ React.createElement(AntdTable, {
837
+ ...props,
779
838
  rowKey: props.rowKey || "id",
780
839
  columns,
781
840
  dataSource: data.rows,
782
- pagination: __spreadValues(__spreadValues({}, props.pagination), data.pagination),
841
+ pagination: {
842
+ ...props.pagination,
843
+ ...data.pagination
844
+ },
783
845
  onChange: (pagination, filters, sorter, extra) => {
784
846
  if (props.onChange) {
785
847
  const processed = props.onChange(pagination, filters, sorter, extra);
786
- reload(__spreadProps(__spreadValues({}, params), {
848
+ reload({
849
+ ...params,
787
850
  pagination: processed.pagination,
788
851
  filters: processed.filters,
789
852
  sorter: processed.sorter
790
- }));
853
+ });
791
854
  return;
792
855
  }
793
- reload(__spreadProps(__spreadValues({}, params), {
856
+ reload({
857
+ ...params,
794
858
  pagination,
795
859
  filters,
796
860
  sorter
797
- }));
861
+ });
798
862
  }
799
- }));
800
- }
801
- }, props.faasData));
863
+ });
864
+ },
865
+ ...props.faasData
866
+ });
802
867
  }
803
868
 
804
869
  // src/Title.tsx
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@faasjs/ant-design",
3
- "version": "0.0.2-beta.393",
3
+ "version": "0.0.2-beta.396",
4
4
  "license": "MIT",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -28,7 +28,7 @@
28
28
  "lodash": "*",
29
29
  "react": "*",
30
30
  "react-dom": "*",
31
- "@faasjs/react": "^0.0.2-beta.393",
31
+ "@faasjs/react": "^0.0.2-beta.396",
32
32
  "react-router-dom": "*",
33
33
  "dayjs": "*"
34
34
  },