@faasjs/ant-design 0.0.4-beta.1 → 0.0.4-beta.11

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
@@ -127,7 +127,7 @@ Form are based on [Ant Design's Form.Item component](https://ant.design/componen
127
127
 
128
128
  ### BaseOption
129
129
 
130
- Ƭ **BaseOption**: `string` \| `number` \| { `label`: `string` ; `value?`: `any` }
130
+ Ƭ **BaseOption**: `string` \| `number` \| \{ `label`: `string` ; `value?`: `any` }
131
131
 
132
132
  ___
133
133
 
@@ -145,7 +145,7 @@ ___
145
145
 
146
146
  ### ExtendFormTypeProps
147
147
 
148
- Ƭ **ExtendFormTypeProps**<`T`\>: `Object`
148
+ Ƭ **ExtendFormTypeProps**\<`T`\>: `Object`
149
149
 
150
150
  #### Type parameters
151
151
 
@@ -157,13 +157,13 @@ ___
157
157
 
158
158
  | Name | Type |
159
159
  | :------ | :------ |
160
- | `children?` | [`UnionFaasItemElement`](#unionfaasitemelement)<`T`\> |
160
+ | `children?` | [`UnionFaasItemElement`](#unionfaasitemelement)\<`T`\> |
161
161
 
162
162
  ___
163
163
 
164
164
  ### ExtendTableItemProps
165
165
 
166
- Ƭ **ExtendTableItemProps**<`T`\>: [`BaseItemProps`](interfaces/BaseItemProps.md) & `Omit`<`AntdTableColumnProps`<`T`\>, ``"children"``\>
166
+ Ƭ **ExtendTableItemProps**\<`T`\>: [`BaseItemProps`](interfaces/BaseItemProps.md) & `Omit`\<`AntdTableColumnProps`\<`T`\>, ``"children"``\>
167
167
 
168
168
  #### Type parameters
169
169
 
@@ -175,7 +175,7 @@ ___
175
175
 
176
176
  ### ExtendTableTypeProps
177
177
 
178
- Ƭ **ExtendTableTypeProps**<`T`\>: `Object`
178
+ Ƭ **ExtendTableTypeProps**\<`T`\>: `Object`
179
179
 
180
180
  #### Type parameters
181
181
 
@@ -188,7 +188,7 @@ ___
188
188
  | Name | Type |
189
189
  | :------ | :------ |
190
190
  | `children?` | `JSX.Element` |
191
- | `render?` | [`UnionFaasItemRender`](#unionfaasitemrender)<`T`\> |
191
+ | `render?` | [`UnionFaasItemRender`](#unionfaasitemrender)\<`T`\> |
192
192
 
193
193
  ___
194
194
 
@@ -204,7 +204,7 @@ ___
204
204
 
205
205
  ### FaasDataInjection
206
206
 
207
- Ƭ **FaasDataInjection**<`T`\>: `Partial`<`OriginFaasDataInjection`<`T`\>\>
207
+ Ƭ **FaasDataInjection**\<`T`\>: `Partial`\<`OriginFaasDataInjection`\<`T`\>\>
208
208
 
209
209
  #### Type parameters
210
210
 
@@ -251,11 +251,11 @@ ___
251
251
  | Name | Type | Description |
252
252
  | :------ | :------ | :------ |
253
253
  | `text?` | `string` | Default: Submit |
254
- | `to?` | { `action`: `string` ; `catch?`: (`error`: `any`) => `void` ; `finally?`: () => `void` ; `params?`: `Record`<`string`, `any`\> ; `then?`: (`result`: `any`) => `void` } | Submit to FaasJS server. If use onFinish, you should call submit manually. ```ts { submit: { to: { action: 'action_name' } }, onFinish: (values, submit) => { // do something before submit // submit await submit({ ...values, extraProps: 'some extra props' }) // do something after submit } } ``` |
254
+ | `to?` | \{ `action`: `string` ; `catch?`: (`error`: `any`) => `void` ; `finally?`: () => `void` ; `params?`: `Record`\<`string`, `any`\> ; `then?`: (`result`: `any`) => `void` } | Submit to FaasJS server. If use onFinish, you should call submit manually. ```ts { submit: { to: { action: 'action_name' } }, onFinish: (values, submit) => { // do something before submit // submit await submit({ ...values, extraProps: 'some extra props' }) // do something after submit } } ``` |
255
255
  | `to.action` | `string` | - |
256
256
  | `to.catch?` | (`error`: `any`) => `void` | - |
257
257
  | `to.finally?` | () => `void` | - |
258
- | `to.params?` | `Record`<`string`, `any`\> | params will overwrite form values before submit |
258
+ | `to.params?` | `Record`\<`string`, `any`\> | params will overwrite form values before submit |
259
259
  | `to.then?` | (`result`: `any`) => `void` | - |
260
260
 
261
261
  ___
@@ -277,7 +277,7 @@ ___
277
277
 
278
278
  ### TableProps
279
279
 
280
- Ƭ **TableProps**<`T`, `ExtendTypes`\>: { `extendTypes?`: { `[key: string]`: [`ExtendTableTypeProps`](#extendtabletypeprops); } ; `faasData?`: [`FaasDataWrapperProps`](interfaces/FaasDataWrapperProps.md)<`T`\> ; `items`: ([`TableItemProps`](interfaces/TableItemProps.md) \| `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`\>
280
+ Ƭ **TableProps**\<`T`, `ExtendTypes`\>: \{ `extendTypes?`: \{ `[key: string]`: [`ExtendTableTypeProps`](#extendtabletypeprops); } ; `faasData?`: [`FaasDataWrapperProps`](interfaces/FaasDataWrapperProps.md)\<`T`\> ; `items`: ([`TableItemProps`](interfaces/TableItemProps.md) \| `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`\>
281
281
 
282
282
  #### Type parameters
283
283
 
@@ -290,7 +290,7 @@ ___
290
290
 
291
291
  ### UnionFaasItemElement
292
292
 
293
- Ƭ **UnionFaasItemElement**<`Value`, `Values`\>: `ReactElement`<[`UnionFaasItemInjection`](#unionfaasiteminjection)<`Value`, `Values`\>\> \| ``null``
293
+ Ƭ **UnionFaasItemElement**\<`Value`, `Values`\>: `ReactElement`\<[`UnionFaasItemInjection`](#unionfaasiteminjection)\<`Value`, `Values`\>\> \| ``null``
294
294
 
295
295
  #### Type parameters
296
296
 
@@ -303,7 +303,7 @@ ___
303
303
 
304
304
  ### UnionFaasItemInjection
305
305
 
306
- Ƭ **UnionFaasItemInjection**<`Value`, `Values`\>: `Object`
306
+ Ƭ **UnionFaasItemInjection**\<`Value`, `Values`\>: `Object`
307
307
 
308
308
  #### Type parameters
309
309
 
@@ -325,7 +325,7 @@ ___
325
325
 
326
326
  ### UnionFaasItemRender
327
327
 
328
- Ƭ **UnionFaasItemRender**<`Value`, `Values`\>: (`value`: `Value`, `values`: `Values`, `index`: `number`, `scene`: [`UnionScene`](#unionscene)) => `React.ReactNode`
328
+ Ƭ **UnionFaasItemRender**\<`Value`, `Values`\>: (`value`: `Value`, `values`: `Values`, `index`: `number`, `scene`: [`UnionScene`](#unionscene)) => `React.ReactNode`
329
329
 
330
330
  #### Type parameters
331
331
 
@@ -361,7 +361,7 @@ ___
361
361
 
362
362
  ### setDrawerProps
363
363
 
364
- Ƭ **setDrawerProps**: (`changes`: `Partial`<[`DrawerProps`](interfaces/DrawerProps.md)\>) => `void`
364
+ Ƭ **setDrawerProps**: (`changes`: `Partial`\<[`DrawerProps`](interfaces/DrawerProps.md)\>) => `void`
365
365
 
366
366
  #### Type declaration
367
367
 
@@ -371,7 +371,7 @@ ___
371
371
 
372
372
  | Name | Type |
373
373
  | :------ | :------ |
374
- | `changes` | `Partial`<[`DrawerProps`](interfaces/DrawerProps.md)\> |
374
+ | `changes` | `Partial`\<[`DrawerProps`](interfaces/DrawerProps.md)\> |
375
375
 
376
376
  ##### Returns
377
377
 
@@ -381,7 +381,7 @@ ___
381
381
 
382
382
  ### setModalProps
383
383
 
384
- Ƭ **setModalProps**: (`changes`: `Partial`<[`ModalProps`](interfaces/ModalProps.md)\>) => `void`
384
+ Ƭ **setModalProps**: (`changes`: `Partial`\<[`ModalProps`](interfaces/ModalProps.md)\>) => `void`
385
385
 
386
386
  #### Type declaration
387
387
 
@@ -391,7 +391,7 @@ ___
391
391
 
392
392
  | Name | Type |
393
393
  | :------ | :------ |
394
- | `changes` | `Partial`<[`ModalProps`](interfaces/ModalProps.md)\> |
394
+ | `changes` | `Partial`\<[`ModalProps`](interfaces/ModalProps.md)\> |
395
395
 
396
396
  ##### Returns
397
397
 
@@ -401,7 +401,7 @@ ___
401
401
 
402
402
  ### ConfigContext
403
403
 
404
- • `Const` **ConfigContext**: `Context`<[`ConfigProviderProps`](interfaces/ConfigProviderProps.md)\>
404
+ • `Const` **ConfigContext**: `Context`\<[`ConfigProviderProps`](interfaces/ConfigProviderProps.md)\>
405
405
 
406
406
  ## Functions
407
407
 
@@ -477,7 +477,7 @@ ___
477
477
 
478
478
  ### Description
479
479
 
480
- ▸ **Description**<`T`\>(`props`): `Element`
480
+ ▸ **Description**\<`T`\>(`props`): `Element`
481
481
 
482
482
  Description component.
483
483
 
@@ -491,7 +491,7 @@ Description component.
491
491
 
492
492
  | Name | Type |
493
493
  | :------ | :------ |
494
- | `props` | [`DescriptionProps`](interfaces/DescriptionProps.md)<`T`, `any`\> |
494
+ | `props` | [`DescriptionProps`](interfaces/DescriptionProps.md)\<`T`, `any`\> |
495
495
 
496
496
  #### Returns
497
497
 
@@ -517,7 +517,7 @@ ___
517
517
 
518
518
  ### FaasDataWrapper
519
519
 
520
- ▸ **FaasDataWrapper**<`T`\>(`props`): `JSX.Element`
520
+ ▸ **FaasDataWrapper**\<`T`\>(`props`): `JSX.Element`
521
521
 
522
522
  FaasDataWrapper component with Loading
523
523
 
@@ -543,7 +543,7 @@ function MyPage () {
543
543
 
544
544
  | Name | Type |
545
545
  | :------ | :------ |
546
- | `props` | [`FaasDataWrapperProps`](interfaces/FaasDataWrapperProps.md)<`T`\> |
546
+ | `props` | [`FaasDataWrapperProps`](interfaces/FaasDataWrapperProps.md)\<`T`\> |
547
547
 
548
548
  #### Returns
549
549
 
@@ -553,7 +553,7 @@ ___
553
553
 
554
554
  ### Form
555
555
 
556
- ▸ **Form**<`Values`\>(`props`): `Element`
556
+ ▸ **Form**\<`Values`\>(`props`): `Element`
557
557
 
558
558
  Form component with Ant Design & FaasJS
559
559
 
@@ -567,7 +567,7 @@ Form component with Ant Design & FaasJS
567
567
 
568
568
  | Name | Type |
569
569
  | :------ | :------ |
570
- | `props` | [`FormProps`](interfaces/FormProps.md)<`Values`, `any`\> |
570
+ | `props` | [`FormProps`](interfaces/FormProps.md)\<`Values`, `any`\> |
571
571
 
572
572
  #### Returns
573
573
 
@@ -581,7 +581,7 @@ ___
581
581
 
582
582
  ### FormItem
583
583
 
584
- ▸ **FormItem**<`T`\>(`props`): `Element`
584
+ ▸ **FormItem**\<`T`\>(`props`): `Element`
585
585
 
586
586
  FormItem, can be used without Form.
587
587
 
@@ -605,7 +605,7 @@ FormItem, can be used without Form.
605
605
 
606
606
  | Name | Type |
607
607
  | :------ | :------ |
608
- | `props` | [`FormItemProps`](interfaces/FormItemProps.md)<`T`\> |
608
+ | `props` | [`FormItemProps`](interfaces/FormItemProps.md)\<`T`\> |
609
609
 
610
610
  #### Returns
611
611
 
@@ -711,7 +711,7 @@ ___
711
711
 
712
712
  ### Table
713
713
 
714
- ▸ **Table**<`T`, `ExtendTypes`\>(`props`): `Element`
714
+ ▸ **Table**\<`T`, `ExtendTypes`\>(`props`): `Element`
715
715
 
716
716
  Table component with Ant Design & FaasJS
717
717
 
@@ -719,14 +719,14 @@ Table component with Ant Design & FaasJS
719
719
 
720
720
  | Name | Type |
721
721
  | :------ | :------ |
722
- | `T` | extends `Record`<`string`, `any`\> |
722
+ | `T` | extends `Record`\<`string`, `any`\> |
723
723
  | `ExtendTypes` | `any` |
724
724
 
725
725
  #### Parameters
726
726
 
727
727
  | Name | Type |
728
728
  | :------ | :------ |
729
- | `props` | [`TableProps`](#tableprops)<`T`, `ExtendTypes`\> |
729
+ | `props` | [`TableProps`](#tableprops)\<`T`, `ExtendTypes`\> |
730
730
 
731
731
  #### Returns
732
732
 
@@ -794,7 +794,7 @@ ___
794
794
 
795
795
  ### faas
796
796
 
797
- ▸ **faas**<`PathOrData`\>(`action`, `params`): `Promise`<`Response`<`FaasData`<`PathOrData`\>\>\>
797
+ ▸ **faas**\<`PathOrData`\>(`action`, `params`): `Promise`\<`Response`\<`FaasData`\<`PathOrData`\>\>\>
798
798
 
799
799
  Request faas server
800
800
 
@@ -802,18 +802,18 @@ Request faas server
802
802
 
803
803
  | Name | Type |
804
804
  | :------ | :------ |
805
- | `PathOrData` | extends `Record`<`string`, `any`\> |
805
+ | `PathOrData` | extends `Record`\<`string`, `any`\> |
806
806
 
807
807
  #### Parameters
808
808
 
809
809
  | Name | Type | Description |
810
810
  | :------ | :------ | :------ |
811
811
  | `action` | `string` \| `PathOrData` | {string} action name |
812
- | `params` | `FaasParams`<`PathOrData`\> | {object} action params |
812
+ | `params` | `FaasParams`\<`PathOrData`\> | {object} action params |
813
813
 
814
814
  #### Returns
815
815
 
816
- `Promise`<`Response`<`FaasData`<`PathOrData`\>\>\>
816
+ `Promise`\<`Response`\<`FaasData`\<`PathOrData`\>\>\>
817
817
 
818
818
  ```ts
819
819
  faas<{ title: string }>('post/get', { id: 1 }).then(res => {
@@ -825,9 +825,9 @@ ___
825
825
 
826
826
  ### transferOptions
827
827
 
828
- ▸ **transferOptions**(`options`): { `label`: `string` ; `value?`: `string` \| `number` }[]
828
+ ▸ **transferOptions**(`options`): \{ `label`: `string` ; `value?`: `string` \| `number` }[]
829
829
 
830
- convert options to { label, value }[]
830
+ convert string[] or number[] to { label, value }[]
831
831
 
832
832
  #### Parameters
833
833
 
@@ -837,7 +837,7 @@ convert options to { label, value }[]
837
837
 
838
838
  #### Returns
839
839
 
840
- { `label`: `string` ; `value?`: `string` \| `number` }[]
840
+ \{ `label`: `string` ; `value?`: `string` \| `number` }[]
841
841
 
842
842
  ___
843
843
 
@@ -898,13 +898,13 @@ Hook style drawer.
898
898
  | :------ | :------ |
899
899
  | `drawer` | `Element` |
900
900
  | `drawerProps` | [`DrawerProps`](interfaces/DrawerProps.md) |
901
- | `setDrawerProps` | (`changes`: `Partial`<[`DrawerProps`](interfaces/DrawerProps.md)\>) => `void` |
901
+ | `setDrawerProps` | (`changes`: `Partial`\<[`DrawerProps`](interfaces/DrawerProps.md)\>) => `void` |
902
902
 
903
903
  ___
904
904
 
905
905
  ### useFaas
906
906
 
907
- ▸ **useFaas**<`PathOrData`\>(`action`, `defaultParams`, `options?`): `FaasDataInjection`<`FaasData`<`PathOrData`\>\>
907
+ ▸ **useFaas**\<`PathOrData`\>(`action`, `defaultParams`, `options?`): `FaasDataInjection`\<`FaasData`\<`PathOrData`\>\>
908
908
 
909
909
  Request faas server with React hook
910
910
 
@@ -912,19 +912,19 @@ Request faas server with React hook
912
912
 
913
913
  | Name | Type |
914
914
  | :------ | :------ |
915
- | `PathOrData` | extends `Record`<`string`, `any`\> |
915
+ | `PathOrData` | extends `Record`\<`string`, `any`\> |
916
916
 
917
917
  #### Parameters
918
918
 
919
919
  | Name | Type | Description |
920
920
  | :------ | :------ | :------ |
921
921
  | `action` | `string` \| `PathOrData` | {string} action name |
922
- | `defaultParams` | `FaasParams`<`PathOrData`\> | {object} initial action params |
923
- | `options?` | `useFaasOptions`<`PathOrData`\> | - |
922
+ | `defaultParams` | `FaasParams`\<`PathOrData`\> | {object} initial action params |
923
+ | `options?` | `useFaasOptions`\<`PathOrData`\> | - |
924
924
 
925
925
  #### Returns
926
926
 
927
- `FaasDataInjection`<`FaasData`<`PathOrData`\>\>
927
+ `FaasDataInjection`\<`FaasData`\<`PathOrData`\>\>
928
928
 
929
929
  ```ts
930
930
  function Post ({ id }) {
@@ -955,4 +955,4 @@ Hook style modal.
955
955
  | :------ | :------ |
956
956
  | `modal` | `Element` |
957
957
  | `modalProps` | [`ModalProps`](interfaces/ModalProps.md) |
958
- | `setModalProps` | (`changes`: `Partial`<[`ModalProps`](interfaces/ModalProps.md)\>) => `void` |
958
+ | `setModalProps` | (`changes`: `Partial`\<[`ModalProps`](interfaces/ModalProps.md)\>) => `void` |
package/dist/index.d.mts CHANGED
@@ -350,7 +350,7 @@ interface FaasItemProps extends BaseItemProps {
350
350
  type?: FaasItemType;
351
351
  }
352
352
  /**
353
- * convert options to { label, value }[]
353
+ * convert string[] or number[] to { label, value }[]
354
354
  */
355
355
  declare function transferOptions(options: BaseOption[]): {
356
356
  label: string;
package/dist/index.d.ts CHANGED
@@ -350,7 +350,7 @@ interface FaasItemProps extends BaseItemProps {
350
350
  type?: FaasItemType;
351
351
  }
352
352
  /**
353
- * convert options to { label, value }[]
353
+ * convert string[] or number[] to { label, value }[]
354
354
  */
355
355
  declare function transferOptions(options: BaseOption[]): {
356
356
  label: string;
package/dist/index.js CHANGED
@@ -1467,8 +1467,8 @@ function FaasDataTable({
1467
1467
  const newColumns = [...prev];
1468
1468
  for (const column of newColumns) {
1469
1469
  if ((_a = data.options) == null ? void 0 : _a[column.id]) {
1470
- column.options = data.options[column.id];
1471
- column.filters = data.options[column.id].map((v) => ({
1470
+ column.options = transferOptions(data.options[column.id]);
1471
+ column.filters = column.options.map((v) => ({
1472
1472
  text: v.label,
1473
1473
  value: v.value
1474
1474
  })).concat({
package/dist/index.mjs CHANGED
@@ -1464,8 +1464,8 @@ function FaasDataTable({
1464
1464
  const newColumns = [...prev];
1465
1465
  for (const column of newColumns) {
1466
1466
  if ((_a = data.options) == null ? void 0 : _a[column.id]) {
1467
- column.options = data.options[column.id];
1468
- column.filters = data.options[column.id].map((v) => ({
1467
+ column.options = transferOptions(data.options[column.id]);
1468
+ column.filters = column.options.map((v) => ({
1469
1469
  text: v.label,
1470
1470
  value: v.value
1471
1471
  })).concat({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@faasjs/ant-design",
3
- "version": "0.0.4-beta.1",
3
+ "version": "0.0.4-beta.11",
4
4
  "license": "MIT",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -21,11 +21,12 @@
21
21
  "files": [
22
22
  "dist"
23
23
  ],
24
- "peerDependencies": {
25
- "@faasjs/react": "0.0.3-beta.109",
24
+ "dependencies": {
26
25
  "@ant-design/icons": "*",
27
- "lodash-es": "*",
28
- "dayjs": "*",
26
+ "lodash-es": "*"
27
+ },
28
+ "peerDependencies": {
29
+ "@faasjs/react": "0.0.4-beta.11",
29
30
  "antd": "*",
30
31
  "react": "*",
31
32
  "react-dom": "*",
@@ -36,10 +37,7 @@
36
37
  "@testing-library/jest-dom": "*",
37
38
  "@testing-library/react": "*",
38
39
  "@testing-library/user-event": "*",
39
- "@faasjs/react": "0.0.4-beta.1",
40
- "@ant-design/icons": "*",
41
- "lodash-es": "*",
42
- "dayjs": "*",
40
+ "@faasjs/react": "0.0.4-beta.11",
43
41
  "antd": "*",
44
42
  "react": "*",
45
43
  "react-dom": "*",