@faasjs/ant-design 0.0.2-beta.437 → 0.0.2-beta.438
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 +24 -8
- package/dist/index.d.ts +11 -0
- package/dist/index.js +8 -6
- package/dist/index.mjs +8 -6
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -18,7 +18,9 @@ In `@faasjs/ant-design`, we use `FaasItemProps` to provide data structures for c
|
|
|
18
18
|
type FaasItemType =
|
|
19
19
|
'string' | 'string[]' |
|
|
20
20
|
'number' | 'number[]' |
|
|
21
|
-
'boolean'
|
|
21
|
+
'boolean' |
|
|
22
|
+
'date' | 'time' |
|
|
23
|
+
'object' | 'object[]'
|
|
22
24
|
|
|
23
25
|
type FaasItemProps = {
|
|
24
26
|
type: FaasItemTypes
|
|
@@ -181,7 +183,7 @@ ___
|
|
|
181
183
|
|
|
182
184
|
### DescriptionItemProps
|
|
183
185
|
|
|
184
|
-
Ƭ **DescriptionItemProps**<`T`\>: { `children?`: `JSX.Element` ; `render?`: (`value`: `T`, `values`: `any`) => `
|
|
186
|
+
Ƭ **DescriptionItemProps**<`T`\>: { `children?`: `JSX.Element` ; `render?`: (`value`: `T`, `values`: `any`) => `ReactNode` \| `JSX.Element` } & [`FaasItemProps`](#faasitemprops) & { `object?`: [`DescriptionItemProps`](#descriptionitemprops)[] }
|
|
185
187
|
|
|
186
188
|
#### Type parameters
|
|
187
189
|
|
|
@@ -193,7 +195,7 @@ ___
|
|
|
193
195
|
|
|
194
196
|
### DescriptionProps
|
|
195
197
|
|
|
196
|
-
Ƭ **DescriptionProps**<`T`, `ExtendItemProps`\>: { `dataSource?`: `T` ; `extendTypes?`: { `[key: string]`: [`ExtendDescriptionTypeProps`](#extenddescriptiontypeprops); } ; `faasData?`: `FaasDataWrapperProps`<`T`\> ; `items`: ([`DescriptionItemProps`](#descriptionitemprops) \| `ExtendItemProps`)[] ; `renderTitle?`: (`values`: `T`) => `ReactNode` } & `DescriptionsProps`
|
|
198
|
+
Ƭ **DescriptionProps**<`T`, `ExtendItemProps`\>: { `dataSource?`: `T` ; `extendTypes?`: { `[key: string]`: [`ExtendDescriptionTypeProps`](#extenddescriptiontypeprops); } ; `faasData?`: `FaasDataWrapperProps`<`T`\> ; `items`: ([`DescriptionItemProps`](#descriptionitemprops) \| `ExtendItemProps`)[] ; `renderTitle?`: (`values`: `T`) => `ReactNode` \| `JSX.Element` } & `DescriptionsProps`
|
|
197
199
|
|
|
198
200
|
#### Type parameters
|
|
199
201
|
|
|
@@ -225,7 +227,7 @@ ___
|
|
|
225
227
|
| Name | Type |
|
|
226
228
|
| :------ | :------ |
|
|
227
229
|
| `children?` | `JSX.Element` \| ``null`` |
|
|
228
|
-
| `render?` | (`value`: `any`, `values`: `any`) => `
|
|
230
|
+
| `render?` | (`value`: `any`, `values`: `any`) => `ReactNode` \| `JSX.Element` |
|
|
229
231
|
|
|
230
232
|
___
|
|
231
233
|
|
|
@@ -243,7 +245,7 @@ ___
|
|
|
243
245
|
|
|
244
246
|
| Name | Type |
|
|
245
247
|
| :------ | :------ |
|
|
246
|
-
| `children?` | `
|
|
248
|
+
| `children?` | `ReactNode` |
|
|
247
249
|
|
|
248
250
|
___
|
|
249
251
|
|
|
@@ -298,6 +300,8 @@ ___
|
|
|
298
300
|
|
|
299
301
|
Ƭ **FaasItemTypeValue**: `Object`
|
|
300
302
|
|
|
303
|
+
FaasItemType's value type
|
|
304
|
+
|
|
301
305
|
#### Type declaration
|
|
302
306
|
|
|
303
307
|
| Name | Type |
|
|
@@ -316,7 +320,7 @@ ___
|
|
|
316
320
|
|
|
317
321
|
### FormItemProps
|
|
318
322
|
|
|
319
|
-
Ƭ **FormItemProps**<`T`\>: { `children?`: `
|
|
323
|
+
Ƭ **FormItemProps**<`T`\>: { `children?`: `ReactNode` ; `extendTypes?`: [`ExtendTypes`](#extendtypes) ; `label?`: `string` \| ``false`` ; `render?`: (`value?`: `any`) => `ReactNode` \| `JSX.Element` ; `rules?`: `RuleObject`[] } & `FormItemInputProps` & [`FaasItemProps`](#faasitemprops) & `Omit`<`AntdFormItemProps`<`T`\>, ``"children"``\>
|
|
320
324
|
|
|
321
325
|
#### Type parameters
|
|
322
326
|
|
|
@@ -479,7 +483,7 @@ ___
|
|
|
479
483
|
|
|
480
484
|
### Blank
|
|
481
485
|
|
|
482
|
-
▸ **Blank**(`options?`): `
|
|
486
|
+
▸ **Blank**(`options?`): `JSX.Element`
|
|
483
487
|
|
|
484
488
|
If value is undefined or null, return text, otherwise return value.
|
|
485
489
|
|
|
@@ -491,7 +495,7 @@ If value is undefined or null, return text, otherwise return value.
|
|
|
491
495
|
|
|
492
496
|
#### Returns
|
|
493
497
|
|
|
494
|
-
`
|
|
498
|
+
`JSX.Element`
|
|
495
499
|
|
|
496
500
|
```ts
|
|
497
501
|
<Blank value={undefined} text="Empty" />
|
|
@@ -571,6 +575,12 @@ ___
|
|
|
571
575
|
|
|
572
576
|
▸ **Form**<`Values`\>(`props`): `Element`
|
|
573
577
|
|
|
578
|
+
Form component with Ant Design & FaasJS
|
|
579
|
+
|
|
580
|
+
**`Ref`**
|
|
581
|
+
|
|
582
|
+
https://ant.design/components/form/
|
|
583
|
+
|
|
574
584
|
#### Type parameters
|
|
575
585
|
|
|
576
586
|
| Name | Type |
|
|
@@ -695,6 +705,12 @@ ___
|
|
|
695
705
|
|
|
696
706
|
▸ **Table**<`T`, `ExtendTypes`\>(`props`): `Element`
|
|
697
707
|
|
|
708
|
+
Table component with Ant Design & FaasJS
|
|
709
|
+
|
|
710
|
+
**`Ref`**
|
|
711
|
+
|
|
712
|
+
https://ant.design/components/table/
|
|
713
|
+
|
|
698
714
|
#### Type parameters
|
|
699
715
|
|
|
700
716
|
| Name | Type |
|
package/dist/index.d.ts
CHANGED
|
@@ -89,6 +89,7 @@ declare function ConfigProvider({ config, children }: {
|
|
|
89
89
|
declare function useConfigContext(): ConfigProviderProps;
|
|
90
90
|
|
|
91
91
|
declare type FaasItemType = 'string' | 'string[]' | 'number' | 'number[]' | 'boolean' | 'date' | 'time' | 'object' | 'object[]';
|
|
92
|
+
/** FaasItemType's value type */
|
|
92
93
|
declare type FaasItemTypeValue = {
|
|
93
94
|
string: string;
|
|
94
95
|
'string[]': string[];
|
|
@@ -307,6 +308,11 @@ declare type FormProps<Values = any, ExtendItemProps = any> = {
|
|
|
307
308
|
extendTypes?: ExtendTypes;
|
|
308
309
|
children?: ReactNode;
|
|
309
310
|
} & Omit<FormProps$1<Values>, 'onFinish' | 'children'>;
|
|
311
|
+
/**
|
|
312
|
+
* Form component with Ant Design & FaasJS
|
|
313
|
+
*
|
|
314
|
+
* @ref https://ant.design/components/form/
|
|
315
|
+
*/
|
|
310
316
|
declare function Form<Values = any>(props: FormProps<Values>): JSX.Element;
|
|
311
317
|
declare namespace Form {
|
|
312
318
|
var useForm: typeof antd_lib_form_Form.useForm;
|
|
@@ -408,6 +414,11 @@ declare type TableProps<T = any, ExtendTypes = any> = {
|
|
|
408
414
|
extra: TableCurrentDataSource<T>;
|
|
409
415
|
};
|
|
410
416
|
} & TableProps$1<T>;
|
|
417
|
+
/**
|
|
418
|
+
* Table component with Ant Design & FaasJS
|
|
419
|
+
*
|
|
420
|
+
* @ref https://ant.design/components/table/
|
|
421
|
+
*/
|
|
411
422
|
declare function Table<T = any, ExtendTypes = any>(props: TableProps<T, ExtendTypes>): JSX.Element;
|
|
412
423
|
|
|
413
424
|
declare type TimePickerProps = Omit<PickerTimeProps<Dayjs>, 'picker'>;
|
package/dist/index.js
CHANGED
|
@@ -925,21 +925,23 @@ function processValue(item, value) {
|
|
|
925
925
|
var _a;
|
|
926
926
|
if (typeof value === "undefined" || value === null || value === "" || Array.isArray(value) && !value.length)
|
|
927
927
|
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Blank, {});
|
|
928
|
+
if (item.type.endsWith("[]") && typeof value === "string")
|
|
929
|
+
value = value.split(",");
|
|
928
930
|
if (item.options) {
|
|
929
|
-
if (item.type.endsWith("[]"))
|
|
930
|
-
if (!Array.isArray(value) && typeof value === "string")
|
|
931
|
-
value = value.split(",");
|
|
931
|
+
if (item.type.endsWith("[]"))
|
|
932
932
|
return value.map((v) => {
|
|
933
933
|
var _a2;
|
|
934
934
|
return ((_a2 = item.options.find((option) => option.value === v)) == null ? void 0 : _a2.label) || v;
|
|
935
|
-
});
|
|
936
|
-
|
|
935
|
+
}).join(", ");
|
|
936
|
+
if ([
|
|
937
937
|
"string",
|
|
938
938
|
"number",
|
|
939
939
|
"boolean"
|
|
940
940
|
].includes(item.type))
|
|
941
941
|
return ((_a = item.options.find((option) => option.value === value)) == null ? void 0 : _a.label) || value;
|
|
942
942
|
}
|
|
943
|
+
if (item.type.endsWith("[]"))
|
|
944
|
+
return value.join(", ");
|
|
943
945
|
if (["date", "time"].includes(item.type)) {
|
|
944
946
|
if (typeof value === "number" && value.toString().length === 10)
|
|
945
947
|
value = value * 1e3;
|
|
@@ -1018,7 +1020,7 @@ function Table(props) {
|
|
|
1018
1020
|
break;
|
|
1019
1021
|
case "string[]":
|
|
1020
1022
|
if (!item.render)
|
|
1021
|
-
item.render = (value) => processValue(item, value)
|
|
1023
|
+
item.render = (value) => processValue(item, value);
|
|
1022
1024
|
if (!item.onFilter)
|
|
1023
1025
|
item.onFilter = (value, row) => {
|
|
1024
1026
|
if (!row[item.id] || !row[item.id].length)
|
package/dist/index.mjs
CHANGED
|
@@ -923,21 +923,23 @@ function processValue(item, value) {
|
|
|
923
923
|
var _a;
|
|
924
924
|
if (typeof value === "undefined" || value === null || value === "" || Array.isArray(value) && !value.length)
|
|
925
925
|
return /* @__PURE__ */ jsx11(Blank, {});
|
|
926
|
+
if (item.type.endsWith("[]") && typeof value === "string")
|
|
927
|
+
value = value.split(",");
|
|
926
928
|
if (item.options) {
|
|
927
|
-
if (item.type.endsWith("[]"))
|
|
928
|
-
if (!Array.isArray(value) && typeof value === "string")
|
|
929
|
-
value = value.split(",");
|
|
929
|
+
if (item.type.endsWith("[]"))
|
|
930
930
|
return value.map((v) => {
|
|
931
931
|
var _a2;
|
|
932
932
|
return ((_a2 = item.options.find((option) => option.value === v)) == null ? void 0 : _a2.label) || v;
|
|
933
|
-
});
|
|
934
|
-
|
|
933
|
+
}).join(", ");
|
|
934
|
+
if ([
|
|
935
935
|
"string",
|
|
936
936
|
"number",
|
|
937
937
|
"boolean"
|
|
938
938
|
].includes(item.type))
|
|
939
939
|
return ((_a = item.options.find((option) => option.value === value)) == null ? void 0 : _a.label) || value;
|
|
940
940
|
}
|
|
941
|
+
if (item.type.endsWith("[]"))
|
|
942
|
+
return value.join(", ");
|
|
941
943
|
if (["date", "time"].includes(item.type)) {
|
|
942
944
|
if (typeof value === "number" && value.toString().length === 10)
|
|
943
945
|
value = value * 1e3;
|
|
@@ -1016,7 +1018,7 @@ function Table(props) {
|
|
|
1016
1018
|
break;
|
|
1017
1019
|
case "string[]":
|
|
1018
1020
|
if (!item.render)
|
|
1019
|
-
item.render = (value) => processValue(item, value)
|
|
1021
|
+
item.render = (value) => processValue(item, value);
|
|
1020
1022
|
if (!item.onFilter)
|
|
1021
1023
|
item.onFilter = (value, row) => {
|
|
1022
1024
|
if (!row[item.id] || !row[item.id].length)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@faasjs/ant-design",
|
|
3
|
-
"version": "0.0.2-beta.
|
|
3
|
+
"version": "0.0.2-beta.438",
|
|
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.
|
|
31
|
+
"@faasjs/react": "^0.0.2-beta.438",
|
|
32
32
|
"react-router-dom": "*",
|
|
33
33
|
"dayjs": "*"
|
|
34
34
|
},
|