@faasjs/ant-design 0.0.3-beta.81 → 0.0.3-beta.83

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
@@ -68,7 +68,9 @@ Form are based on [Ant Design's Form.Item component](https://ant.design/componen
68
68
  - [LinkProps](interfaces/LinkProps.md)
69
69
  - [ModalProps](interfaces/ModalProps.md)
70
70
  - [RoutesProps](interfaces/RoutesProps.md)
71
+ - [TabProps](interfaces/TabProps.md)
71
72
  - [TableItemProps](interfaces/TableItemProps.md)
73
+ - [TabsProps](interfaces/TabsProps.md)
72
74
  - [TitleProps](interfaces/TitleProps.md)
73
75
  - [UnionFaasItemProps](interfaces/UnionFaasItemProps.md)
74
76
  - [useAppProps](interfaces/useAppProps.md)
@@ -113,19 +115,22 @@ Form are based on [Ant Design's Form.Item component](https://ant.design/componen
113
115
  - [PageNotFound](#pagenotfound)
114
116
  - [Routes](#routes)
115
117
  - [Table](#table)
118
+ - [Tabs](#tabs)
116
119
  - [Title](#title)
120
+ - [faas](#faas)
117
121
  - [transferOptions](#transferoptions)
118
122
  - [transferValue](#transfervalue)
119
123
  - [useApp](#useapp)
120
124
  - [useConfigContext](#useconfigcontext)
121
125
  - [useDrawer](#usedrawer)
126
+ - [useFaas](#usefaas)
122
127
  - [useModal](#usemodal)
123
128
 
124
129
  ## Type Aliases
125
130
 
126
131
  ### BaseOption
127
132
 
128
- Ƭ **BaseOption**: `string` \| `number` \| { `label`: `string` ; `value?`: `string` \| `number` }
133
+ Ƭ **BaseOption**: `string` \| `number` \| { `label`: `string` ; `value?`: `any` }
129
134
 
130
135
  ___
131
136
 
@@ -323,7 +328,7 @@ ___
323
328
 
324
329
  ### UnionFaasItemRender
325
330
 
326
- Ƭ **UnionFaasItemRender**<`Value`, `Values`\>: (`value`: `Value`, `values`: `Values`, `index`: `number`, `scene`: [`UnionScene`](#unionscene)) => `JSX.Element` \| ``null``
331
+ Ƭ **UnionFaasItemRender**<`Value`, `Values`\>: (`value`: `Value`, `values`: `Values`, `index`: `number`, `scene`: [`UnionScene`](#unionscene)) => `React.ReactNode`
327
332
 
328
333
  #### Type parameters
329
334
 
@@ -334,7 +339,7 @@ ___
334
339
 
335
340
  #### Type declaration
336
341
 
337
- ▸ (`value`, `values`, `index`, `scene`): `JSX.Element` \| ``null``
342
+ ▸ (`value`, `values`, `index`, `scene`): `React.ReactNode`
338
343
 
339
344
  ##### Parameters
340
345
 
@@ -347,7 +352,7 @@ ___
347
352
 
348
353
  ##### Returns
349
354
 
350
- `JSX.Element` \| ``null``
355
+ `React.ReactNode`
351
356
 
352
357
  ___
353
358
 
@@ -720,6 +725,28 @@ https://ant.design/components/table/
720
725
 
721
726
  ___
722
727
 
728
+ ### Tabs
729
+
730
+ ▸ **Tabs**(`props`): `Element`
731
+
732
+ Tabs component with Ant Design & FaasJS
733
+
734
+ **`Ref`**
735
+
736
+ https://ant.design/components/tabs/
737
+
738
+ #### Parameters
739
+
740
+ | Name | Type |
741
+ | :------ | :------ |
742
+ | `props` | [`TabsProps`](interfaces/TabsProps.md) |
743
+
744
+ #### Returns
745
+
746
+ `Element`
747
+
748
+ ___
749
+
723
750
  ### Title
724
751
 
725
752
  ▸ **Title**(`props`): `JSX.Element`
@@ -752,6 +779,37 @@ Return null by default.
752
779
 
753
780
  ___
754
781
 
782
+ ### faas
783
+
784
+ ▸ **faas**<`PathOrData`\>(`action`, `params`): `Promise`<`Response`<`FaasData`<`PathOrData`\>\>\>
785
+
786
+ Request faas server
787
+
788
+ #### Type parameters
789
+
790
+ | Name | Type |
791
+ | :------ | :------ |
792
+ | `PathOrData` | extends `Record`<`string`, `any`\> |
793
+
794
+ #### Parameters
795
+
796
+ | Name | Type | Description |
797
+ | :------ | :------ | :------ |
798
+ | `action` | `string` \| `PathOrData` | {string} action name |
799
+ | `params` | `FaasParams`<`PathOrData`\> | {object} action params |
800
+
801
+ #### Returns
802
+
803
+ `Promise`<`Response`<`FaasData`<`PathOrData`\>\>\>
804
+
805
+ ```ts
806
+ faas<{ title: string }>('post/get', { id: 1 }).then(res => {
807
+ console.log(res.data.title)
808
+ })
809
+ ```
810
+
811
+ ___
812
+
755
813
  ### transferOptions
756
814
 
757
815
  ▸ **transferOptions**(`options`): { `label`: `string` ; `value?`: `string` \| `number` }[]
@@ -831,6 +889,42 @@ Hook style drawer.
831
889
 
832
890
  ___
833
891
 
892
+ ### useFaas
893
+
894
+ ▸ **useFaas**<`PathOrData`\>(`action`, `defaultParams`, `options?`): `FaasDataInjection`<`FaasData`<`PathOrData`\>\>
895
+
896
+ Request faas server with React hook
897
+
898
+ #### Type parameters
899
+
900
+ | Name | Type |
901
+ | :------ | :------ |
902
+ | `PathOrData` | extends `Record`<`string`, `any`\> |
903
+
904
+ #### Parameters
905
+
906
+ | Name | Type | Description |
907
+ | :------ | :------ | :------ |
908
+ | `action` | `string` \| `PathOrData` | {string} action name |
909
+ | `defaultParams` | `FaasParams`<`PathOrData`\> | {object} initial action params |
910
+ | `options?` | `Object` | - |
911
+ | `options.data?` | `FaasData`<`PathOrData`\> | - |
912
+ | `options.setData?` | `Dispatch`<`SetStateAction`<`FaasData`<`PathOrData`\>\>\> | - |
913
+ | `options.skip?` | `boolean` | - |
914
+
915
+ #### Returns
916
+
917
+ `FaasDataInjection`<`FaasData`<`PathOrData`\>\>
918
+
919
+ ```ts
920
+ function Post ({ id }) {
921
+ const { data } = useFaas<{ title: string }>('post/get', { id })
922
+ return <h1>{data.title}</h1>
923
+ }
924
+ ```
925
+
926
+ ___
927
+
834
928
  ### useModal
835
929
 
836
930
  ▸ **useModal**(`init?`): `Object`
package/dist/index.js CHANGED
@@ -676,11 +676,18 @@ function FormItem(props) {
676
676
  });
677
677
  switch (computedProps.type) {
678
678
  case "string":
679
+ if (computedProps.options)
680
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd8.Form.Item, {
681
+ ...computedProps,
682
+ children: computedProps.options.length > 10 ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd8.Select, {
683
+ ...computedProps.input
684
+ }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd8.Radio.Group, {
685
+ ...computedProps.input
686
+ })
687
+ });
679
688
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd8.Form.Item, {
680
689
  ...computedProps,
681
- children: computedProps.options ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd8.Select, {
682
- ...computedProps.input
683
- }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd8.Input, {
690
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd8.Input, {
684
691
  ...computedProps.input
685
692
  })
686
693
  });
@@ -760,11 +767,18 @@ function FormItem(props) {
760
767
  }
761
768
  });
762
769
  case "number":
770
+ if (computedProps.options)
771
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd8.Form.Item, {
772
+ ...computedProps,
773
+ children: computedProps.options.length > 10 ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd8.Select, {
774
+ ...computedProps.input
775
+ }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd8.Radio.Group, {
776
+ ...computedProps.input
777
+ })
778
+ });
763
779
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd8.Form.Item, {
764
780
  ...computedProps,
765
- children: computedProps.options ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd8.Select, {
766
- ...computedProps.input
767
- }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd8.InputNumber, {
781
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd8.InputNumber, {
768
782
  style: { width: "100%" },
769
783
  ...computedProps.input
770
784
  })
package/dist/index.mjs CHANGED
@@ -539,7 +539,8 @@ import {
539
539
  Switch,
540
540
  Select,
541
541
  DatePicker,
542
- TimePicker
542
+ TimePicker,
543
+ Radio
543
544
  } from "antd";
544
545
  import { MinusCircleOutlined, PlusOutlined } from "@ant-design/icons";
545
546
  import {
@@ -664,11 +665,18 @@ function FormItem(props) {
664
665
  });
665
666
  switch (computedProps.type) {
666
667
  case "string":
668
+ if (computedProps.options)
669
+ return /* @__PURE__ */ jsx10(AntdForm.Item, {
670
+ ...computedProps,
671
+ children: computedProps.options.length > 10 ? /* @__PURE__ */ jsx10(Select, {
672
+ ...computedProps.input
673
+ }) : /* @__PURE__ */ jsx10(Radio.Group, {
674
+ ...computedProps.input
675
+ })
676
+ });
667
677
  return /* @__PURE__ */ jsx10(AntdForm.Item, {
668
678
  ...computedProps,
669
- children: computedProps.options ? /* @__PURE__ */ jsx10(Select, {
670
- ...computedProps.input
671
- }) : /* @__PURE__ */ jsx10(Input, {
679
+ children: /* @__PURE__ */ jsx10(Input, {
672
680
  ...computedProps.input
673
681
  })
674
682
  });
@@ -748,11 +756,18 @@ function FormItem(props) {
748
756
  }
749
757
  });
750
758
  case "number":
759
+ if (computedProps.options)
760
+ return /* @__PURE__ */ jsx10(AntdForm.Item, {
761
+ ...computedProps,
762
+ children: computedProps.options.length > 10 ? /* @__PURE__ */ jsx10(Select, {
763
+ ...computedProps.input
764
+ }) : /* @__PURE__ */ jsx10(Radio.Group, {
765
+ ...computedProps.input
766
+ })
767
+ });
751
768
  return /* @__PURE__ */ jsx10(AntdForm.Item, {
752
769
  ...computedProps,
753
- children: computedProps.options ? /* @__PURE__ */ jsx10(Select, {
754
- ...computedProps.input
755
- }) : /* @__PURE__ */ jsx10(InputNumber, {
770
+ children: /* @__PURE__ */ jsx10(InputNumber, {
756
771
  style: { width: "100%" },
757
772
  ...computedProps.input
758
773
  })
@@ -1164,7 +1179,7 @@ import {
1164
1179
  } from "react";
1165
1180
  import {
1166
1181
  Table as AntdTable,
1167
- Radio,
1182
+ Radio as Radio2,
1168
1183
  Input as Input2,
1169
1184
  Select as Select2,
1170
1185
  DatePicker as DatePicker2
@@ -1456,7 +1471,7 @@ function Table(props) {
1456
1471
  setSelectedKeys,
1457
1472
  selectedKeys,
1458
1473
  confirm
1459
- }) => /* @__PURE__ */ jsxs5(Radio.Group, {
1474
+ }) => /* @__PURE__ */ jsxs5(Radio2.Group, {
1460
1475
  style: { padding: 8 },
1461
1476
  buttonStyle: "solid",
1462
1477
  value: JSON.stringify(selectedKeys[0]),
@@ -1470,10 +1485,10 @@ function Table(props) {
1470
1485
  confirm();
1471
1486
  },
1472
1487
  children: [
1473
- /* @__PURE__ */ jsx14(Radio.Button, {
1488
+ /* @__PURE__ */ jsx14(Radio2.Button, {
1474
1489
  children: common2.all
1475
1490
  }),
1476
- /* @__PURE__ */ jsx14(Radio.Button, {
1491
+ /* @__PURE__ */ jsx14(Radio2.Button, {
1477
1492
  value: "true",
1478
1493
  children: /* @__PURE__ */ jsx14(CheckOutlined2, {
1479
1494
  style: {
@@ -1482,7 +1497,7 @@ function Table(props) {
1482
1497
  }
1483
1498
  })
1484
1499
  }),
1485
- /* @__PURE__ */ jsx14(Radio.Button, {
1500
+ /* @__PURE__ */ jsx14(Radio2.Button, {
1486
1501
  value: "false",
1487
1502
  children: /* @__PURE__ */ jsx14(CloseOutlined2, {
1488
1503
  style: {
@@ -1491,7 +1506,7 @@ function Table(props) {
1491
1506
  }
1492
1507
  })
1493
1508
  }),
1494
- /* @__PURE__ */ jsx14(Radio.Button, {
1509
+ /* @__PURE__ */ jsx14(Radio2.Button, {
1495
1510
  value: "null",
1496
1511
  children: common2.blank
1497
1512
  })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@faasjs/ant-design",
3
- "version": "0.0.3-beta.81",
3
+ "version": "0.0.3-beta.83",
4
4
  "license": "MIT",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",