@faasjs/ant-design 0.0.2-beta.437 → 0.0.2-beta.439

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
@@ -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`) => `JSX.Element` \| `string` \| `number` \| `boolean` \| ``null`` } & [`FaasItemProps`](#faasitemprops)
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`) => `JSX.Element` \| `string` \| `number` \| `boolean` \| ``null`` |
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?` | `JSX.Element` \| ``null`` |
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?`: `JSX.Element` \| ``null`` ; `extendTypes?`: [`ExtendTypes`](#extendtypes) ; `label?`: `string` \| ``false`` ; `render?`: () => `JSX.Element` \| ``null`` ; `rules?`: `RuleObject`[] } & `FormItemInputProps` & [`FaasItemProps`](#faasitemprops) & `Omit`<`AntdFormItemProps`<`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?`): `any`
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
- `any`
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[];
@@ -120,6 +121,7 @@ declare function transferOptions(options: BaseOption[]): {
120
121
  label: string;
121
122
  value?: string | number;
122
123
  }[];
124
+ declare function transferValue(type: FaasItemType, value: any): any;
123
125
 
124
126
  declare type DatePickerProps = PickerDateProps<Dayjs>;
125
127
  declare const DatePicker: antd_es_date_picker_generatePicker_interface.PickerComponentClass<antd_es_date_picker_generatePicker.PickerProps<Dayjs> & {
@@ -306,7 +308,13 @@ declare type FormProps<Values = any, ExtendItemProps = any> = {
306
308
  footer?: JSX.Element | JSX.Element[];
307
309
  extendTypes?: ExtendTypes;
308
310
  children?: ReactNode;
309
- } & Omit<FormProps$1<Values>, 'onFinish' | 'children'>;
311
+ initialValues?: Values;
312
+ } & Omit<FormProps$1<Values>, 'onFinish' | 'children' | 'initialValues'>;
313
+ /**
314
+ * Form component with Ant Design & FaasJS
315
+ *
316
+ * @ref https://ant.design/components/form/
317
+ */
310
318
  declare function Form<Values = any>(props: FormProps<Values>): JSX.Element;
311
319
  declare namespace Form {
312
320
  var useForm: typeof antd_lib_form_Form.useForm;
@@ -408,6 +416,11 @@ declare type TableProps<T = any, ExtendTypes = any> = {
408
416
  extra: TableCurrentDataSource<T>;
409
417
  };
410
418
  } & TableProps$1<T>;
419
+ /**
420
+ * Table component with Ant Design & FaasJS
421
+ *
422
+ * @ref https://ant.design/components/table/
423
+ */
411
424
  declare function Table<T = any, ExtendTypes = any>(props: TableProps<T, ExtendTypes>): JSX.Element;
412
425
 
413
426
  declare type TimePickerProps = Omit<PickerTimeProps<Dayjs>, 'picker'>;
@@ -449,4 +462,4 @@ declare type TitleProps = {
449
462
  */
450
463
  declare function Title(props: TitleProps): JSX.Element;
451
464
 
452
- export { BaseItemProps, BaseOption, Blank, BlankProps, Calendar, CalendarProps, ConfigContext, ConfigProvider, ConfigProviderProps, DatePicker, DatePickerProps, Description, DescriptionItemProps, DescriptionProps, DrawerProps, ExtendDescriptionItemProps, ExtendDescriptionTypeProps, ExtendFormItemProps, ExtendFormTypeProps, ExtendTableItemProps, ExtendTableTypeProps, ExtendTypes, FaasItemProps, FaasItemType, FaasItemTypeValue, Form, FormItem, FormItemProps, FormProps, Link, LinkProps, ModalProps, PageNotFound, Routes, RoutesProps, Table, TableItemProps, TableProps, TimePicker, TimePickerProps, Title, TitleProps, setDrawerProps, setModalProps, transferOptions, useConfigContext, useDrawer, useModal };
465
+ export { BaseItemProps, BaseOption, Blank, BlankProps, Calendar, CalendarProps, ConfigContext, ConfigProvider, ConfigProviderProps, DatePicker, DatePickerProps, Description, DescriptionItemProps, DescriptionProps, DrawerProps, ExtendDescriptionItemProps, ExtendDescriptionTypeProps, ExtendFormItemProps, ExtendFormTypeProps, ExtendTableItemProps, ExtendTableTypeProps, ExtendTypes, FaasItemProps, FaasItemType, FaasItemTypeValue, Form, FormItem, FormItemProps, FormProps, Link, LinkProps, ModalProps, PageNotFound, Routes, RoutesProps, Table, TableItemProps, TableProps, TimePicker, TimePickerProps, Title, TitleProps, setDrawerProps, setModalProps, transferOptions, transferValue, useConfigContext, useDrawer, useModal };
package/dist/index.js CHANGED
@@ -43,6 +43,7 @@ __export(src_exports, {
43
43
  TimePicker: () => TimePicker,
44
44
  Title: () => Title,
45
45
  transferOptions: () => transferOptions,
46
+ transferValue: () => transferValue,
46
47
  useConfigContext: () => useConfigContext,
47
48
  useDrawer: () => useDrawer,
48
49
  useModal: () => useModal
@@ -146,6 +147,7 @@ var Calendar = (0, import_generateCalendar.default)(import_dayjs.default);
146
147
 
147
148
  // src/data.ts
148
149
  var import_lodash3 = require("lodash");
150
+ var import_dayjs2 = __toESM(require("dayjs"));
149
151
  function transferOptions(options) {
150
152
  if (!options)
151
153
  return [];
@@ -154,19 +156,33 @@ function transferOptions(options) {
154
156
  value: item
155
157
  });
156
158
  }
159
+ function transferValue(type, value) {
160
+ if (typeof value === "undefined" || value === null || value === "" || Array.isArray(value) && !value.length)
161
+ return null;
162
+ if (!type)
163
+ type = "string";
164
+ if (type.endsWith("[]") && typeof value === "string")
165
+ value = value.split(",");
166
+ if (["date", "time"].includes(type)) {
167
+ if (typeof value === "number" && value.toString().length === 10)
168
+ value = value * 1e3;
169
+ if (!import_dayjs2.default.isDayjs(value))
170
+ value = (0, import_dayjs2.default)(value);
171
+ }
172
+ return value;
173
+ }
157
174
 
158
175
  // src/DatePicker.tsx
159
- var import_dayjs2 = __toESM(require("rc-picker/es/generate/dayjs.js"));
176
+ var import_dayjs3 = __toESM(require("rc-picker/es/generate/dayjs.js"));
160
177
  var import_generatePicker = __toESM(require("antd/es/date-picker/generatePicker/index.js"));
161
178
  var import_style2 = require("antd/es/date-picker/style/index.js");
162
- var DatePicker = (0, import_generatePicker.default)(import_dayjs2.default);
179
+ var DatePicker = (0, import_generatePicker.default)(import_dayjs3.default);
163
180
 
164
181
  // src/Description.tsx
165
182
  var import_icons = require("@ant-design/icons");
166
183
  var import_antd3 = require("antd");
167
184
  var import_lodash4 = require("lodash");
168
185
  var import_react3 = require("react");
169
- var import_dayjs3 = __toESM(require("dayjs"));
170
186
  var import_react4 = require("@faasjs/react");
171
187
  var import_jsx_runtime3 = require("react/jsx-runtime");
172
188
  function DescriptionItemContent(props) {
@@ -182,6 +198,7 @@ function DescriptionItemContent(props) {
182
198
  if ((_a2 = propsCopy.item.options) == null ? void 0 : _a2.length) {
183
199
  propsCopy.item.options = transferOptions(propsCopy.item.options);
184
200
  }
201
+ propsCopy.value = transferValue(propsCopy.item.type, propsCopy.value);
185
202
  if (propsCopy.item.options && typeof propsCopy.value !== "undefined" && propsCopy.value !== null) {
186
203
  if (propsCopy.item.type.endsWith("[]"))
187
204
  propsCopy.value = propsCopy.value.map((v) => {
@@ -220,7 +237,7 @@ function DescriptionItemContent(props) {
220
237
  return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_jsx_runtime3.Fragment, {
221
238
  children: computedProps.item.render(computedProps.value, computedProps.values)
222
239
  });
223
- if (typeof computedProps.value === "undefined" || computedProps.value === null)
240
+ if (computedProps.value === null)
224
241
  return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Blank, {});
225
242
  switch (computedProps.item.type) {
226
243
  case "string[]":
@@ -247,11 +264,11 @@ function DescriptionItemContent(props) {
247
264
  });
248
265
  case "time":
249
266
  return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_jsx_runtime3.Fragment, {
250
- children: typeof computedProps.value === "number" && computedProps.value.toString().length === 10 ? import_dayjs3.default.unix(computedProps.value).format("YYYY-MM-DD HH:mm:ss") : (0, import_dayjs3.default)(computedProps.value).format("YYYY-MM-DD HH:mm:ss")
267
+ children: computedProps.value.format("YYYY-MM-DD HH:mm:ss")
251
268
  });
252
269
  case "date":
253
270
  return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_jsx_runtime3.Fragment, {
254
- children: typeof computedProps.value === "number" && computedProps.value.toString().length === 10 ? import_dayjs3.default.unix(computedProps.value).format("YYYY-MM-DD") : (0, import_dayjs3.default)(computedProps.value).format("YYYY-MM-DD")
271
+ children: computedProps.value.format("YYYY-MM-DD")
255
272
  });
256
273
  case "object":
257
274
  return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Description, {
@@ -731,8 +748,14 @@ function Form(props) {
731
748
  const config = useConfigContext();
732
749
  const [extendTypes, setExtendTypes] = (0, import_react9.useState)();
733
750
  (0, import_react9.useEffect)(() => {
734
- var _a2;
751
+ var _a2, _b2;
735
752
  const propsCopy = { ...props };
753
+ if (propsCopy.initialValues)
754
+ for (const key in propsCopy.initialValues)
755
+ propsCopy.initialValues[key] = transferValue(
756
+ (_a2 = propsCopy.items.find((i) => i.id === key)) == null ? void 0 : _a2.type,
757
+ propsCopy.initialValues[key]
758
+ );
736
759
  if (propsCopy.onFinish) {
737
760
  propsCopy.onFinish = async (values) => {
738
761
  var _a3;
@@ -750,7 +773,7 @@ function Form(props) {
750
773
  }
751
774
  setLoading(false);
752
775
  };
753
- } else if (propsCopy.submit && ((_a2 = propsCopy.submit.to) == null ? void 0 : _a2.action)) {
776
+ } else if (propsCopy.submit && ((_b2 = propsCopy.submit.to) == null ? void 0 : _b2.action)) {
754
777
  propsCopy.onFinish = async (values) => {
755
778
  setLoading(true);
756
779
  return (0, import_react8.faas)(propsCopy.submit.to.action, propsCopy.submit.to.params ? {
@@ -923,28 +946,26 @@ var import_react13 = require("@faasjs/react");
923
946
  var import_jsx_runtime11 = require("react/jsx-runtime");
924
947
  function processValue(item, value) {
925
948
  var _a;
926
- if (typeof value === "undefined" || value === null || value === "" || Array.isArray(value) && !value.length)
949
+ const transferred = transferValue(item.type, value);
950
+ if (transferred === null)
927
951
  return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Blank, {});
928
952
  if (item.options) {
929
- if (item.type.endsWith("[]")) {
930
- if (!Array.isArray(value) && typeof value === "string")
931
- value = value.split(",");
932
- return value.map((v) => {
953
+ if (item.type.endsWith("[]"))
954
+ return transferred.map((v) => {
933
955
  var _a2;
934
956
  return ((_a2 = item.options.find((option) => option.value === v)) == null ? void 0 : _a2.label) || v;
935
- });
936
- } else if ([
957
+ }).join(", ");
958
+ if ([
937
959
  "string",
938
960
  "number",
939
961
  "boolean"
940
962
  ].includes(item.type))
941
- return ((_a = item.options.find((option) => option.value === value)) == null ? void 0 : _a.label) || value;
942
- }
943
- if (["date", "time"].includes(item.type)) {
944
- if (typeof value === "number" && value.toString().length === 10)
945
- value = value * 1e3;
946
- return (0, import_dayjs5.default)(value).format(item.type === "date" ? "YYYY-MM-DD" : "YYYY-MM-DD HH:mm:ss");
963
+ return ((_a = item.options.find((option) => option.value === transferred)) == null ? void 0 : _a.label) || transferred;
947
964
  }
965
+ if (item.type.endsWith("[]"))
966
+ return transferred.join(", ");
967
+ if (["date", "time"].includes(item.type))
968
+ return transferred.format(item.type === "date" ? "YYYY-MM-DD" : "YYYY-MM-DD HH:mm:ss");
948
969
  return value;
949
970
  }
950
971
  function Table(props) {
@@ -1018,7 +1039,7 @@ function Table(props) {
1018
1039
  break;
1019
1040
  case "string[]":
1020
1041
  if (!item.render)
1021
- item.render = (value) => processValue(item, value).join(", ");
1042
+ item.render = (value) => processValue(item, value);
1022
1043
  if (!item.onFilter)
1023
1044
  item.onFilter = (value, row) => {
1024
1045
  if (!row[item.id] || !row[item.id].length)
@@ -1329,6 +1350,7 @@ function Title(props) {
1329
1350
  TimePicker,
1330
1351
  Title,
1331
1352
  transferOptions,
1353
+ transferValue,
1332
1354
  useConfigContext,
1333
1355
  useDrawer,
1334
1356
  useModal
package/dist/index.mjs CHANGED
@@ -100,6 +100,7 @@ var Calendar = generateCalendar(dayjsGenerateConfig);
100
100
 
101
101
  // src/data.ts
102
102
  import { upperFirst } from "lodash";
103
+ import dayjs from "dayjs";
103
104
  function transferOptions(options) {
104
105
  if (!options)
105
106
  return [];
@@ -108,6 +109,21 @@ function transferOptions(options) {
108
109
  value: item
109
110
  });
110
111
  }
112
+ function transferValue(type, value) {
113
+ if (typeof value === "undefined" || value === null || value === "" || Array.isArray(value) && !value.length)
114
+ return null;
115
+ if (!type)
116
+ type = "string";
117
+ if (type.endsWith("[]") && typeof value === "string")
118
+ value = value.split(",");
119
+ if (["date", "time"].includes(type)) {
120
+ if (typeof value === "number" && value.toString().length === 10)
121
+ value = value * 1e3;
122
+ if (!dayjs.isDayjs(value))
123
+ value = dayjs(value);
124
+ }
125
+ return value;
126
+ }
111
127
 
112
128
  // src/DatePicker.tsx
113
129
  import dayjsGenerateConfig2 from "rc-picker/es/generate/dayjs.js";
@@ -128,7 +144,6 @@ import {
128
144
  useEffect as useEffect2,
129
145
  useState as useState2
130
146
  } from "react";
131
- import dayjs from "dayjs";
132
147
  import { FaasDataWrapper } from "@faasjs/react";
133
148
  import { Fragment, jsx as jsx3 } from "react/jsx-runtime";
134
149
  function DescriptionItemContent(props) {
@@ -144,6 +159,7 @@ function DescriptionItemContent(props) {
144
159
  if ((_a2 = propsCopy.item.options) == null ? void 0 : _a2.length) {
145
160
  propsCopy.item.options = transferOptions(propsCopy.item.options);
146
161
  }
162
+ propsCopy.value = transferValue(propsCopy.item.type, propsCopy.value);
147
163
  if (propsCopy.item.options && typeof propsCopy.value !== "undefined" && propsCopy.value !== null) {
148
164
  if (propsCopy.item.type.endsWith("[]"))
149
165
  propsCopy.value = propsCopy.value.map((v) => {
@@ -182,7 +198,7 @@ function DescriptionItemContent(props) {
182
198
  return /* @__PURE__ */ jsx3(Fragment, {
183
199
  children: computedProps.item.render(computedProps.value, computedProps.values)
184
200
  });
185
- if (typeof computedProps.value === "undefined" || computedProps.value === null)
201
+ if (computedProps.value === null)
186
202
  return /* @__PURE__ */ jsx3(Blank, {});
187
203
  switch (computedProps.item.type) {
188
204
  case "string[]":
@@ -209,11 +225,11 @@ function DescriptionItemContent(props) {
209
225
  });
210
226
  case "time":
211
227
  return /* @__PURE__ */ jsx3(Fragment, {
212
- children: typeof computedProps.value === "number" && computedProps.value.toString().length === 10 ? dayjs.unix(computedProps.value).format("YYYY-MM-DD HH:mm:ss") : dayjs(computedProps.value).format("YYYY-MM-DD HH:mm:ss")
228
+ children: computedProps.value.format("YYYY-MM-DD HH:mm:ss")
213
229
  });
214
230
  case "date":
215
231
  return /* @__PURE__ */ jsx3(Fragment, {
216
- children: typeof computedProps.value === "number" && computedProps.value.toString().length === 10 ? dayjs.unix(computedProps.value).format("YYYY-MM-DD") : dayjs(computedProps.value).format("YYYY-MM-DD")
232
+ children: computedProps.value.format("YYYY-MM-DD")
217
233
  });
218
234
  case "object":
219
235
  return /* @__PURE__ */ jsx3(Description, {
@@ -711,8 +727,14 @@ function Form(props) {
711
727
  const config = useConfigContext();
712
728
  const [extendTypes, setExtendTypes] = useState5();
713
729
  useEffect4(() => {
714
- var _a2;
730
+ var _a2, _b2;
715
731
  const propsCopy = { ...props };
732
+ if (propsCopy.initialValues)
733
+ for (const key in propsCopy.initialValues)
734
+ propsCopy.initialValues[key] = transferValue(
735
+ (_a2 = propsCopy.items.find((i) => i.id === key)) == null ? void 0 : _a2.type,
736
+ propsCopy.initialValues[key]
737
+ );
716
738
  if (propsCopy.onFinish) {
717
739
  propsCopy.onFinish = async (values) => {
718
740
  var _a3;
@@ -730,7 +752,7 @@ function Form(props) {
730
752
  }
731
753
  setLoading(false);
732
754
  };
733
- } else if (propsCopy.submit && ((_a2 = propsCopy.submit.to) == null ? void 0 : _a2.action)) {
755
+ } else if (propsCopy.submit && ((_b2 = propsCopy.submit.to) == null ? void 0 : _b2.action)) {
734
756
  propsCopy.onFinish = async (values) => {
735
757
  setLoading(true);
736
758
  return faas(propsCopy.submit.to.action, propsCopy.submit.to.params ? {
@@ -921,28 +943,26 @@ import { FaasDataWrapper as FaasDataWrapper2 } from "@faasjs/react";
921
943
  import { jsx as jsx11, jsxs as jsxs4 } from "react/jsx-runtime";
922
944
  function processValue(item, value) {
923
945
  var _a;
924
- if (typeof value === "undefined" || value === null || value === "" || Array.isArray(value) && !value.length)
946
+ const transferred = transferValue(item.type, value);
947
+ if (transferred === null)
925
948
  return /* @__PURE__ */ jsx11(Blank, {});
926
949
  if (item.options) {
927
- if (item.type.endsWith("[]")) {
928
- if (!Array.isArray(value) && typeof value === "string")
929
- value = value.split(",");
930
- return value.map((v) => {
950
+ if (item.type.endsWith("[]"))
951
+ return transferred.map((v) => {
931
952
  var _a2;
932
953
  return ((_a2 = item.options.find((option) => option.value === v)) == null ? void 0 : _a2.label) || v;
933
- });
934
- } else if ([
954
+ }).join(", ");
955
+ if ([
935
956
  "string",
936
957
  "number",
937
958
  "boolean"
938
959
  ].includes(item.type))
939
- return ((_a = item.options.find((option) => option.value === value)) == null ? void 0 : _a.label) || value;
940
- }
941
- if (["date", "time"].includes(item.type)) {
942
- if (typeof value === "number" && value.toString().length === 10)
943
- value = value * 1e3;
944
- return dayjs3(value).format(item.type === "date" ? "YYYY-MM-DD" : "YYYY-MM-DD HH:mm:ss");
960
+ return ((_a = item.options.find((option) => option.value === transferred)) == null ? void 0 : _a.label) || transferred;
945
961
  }
962
+ if (item.type.endsWith("[]"))
963
+ return transferred.join(", ");
964
+ if (["date", "time"].includes(item.type))
965
+ return transferred.format(item.type === "date" ? "YYYY-MM-DD" : "YYYY-MM-DD HH:mm:ss");
946
966
  return value;
947
967
  }
948
968
  function Table(props) {
@@ -1016,7 +1036,7 @@ function Table(props) {
1016
1036
  break;
1017
1037
  case "string[]":
1018
1038
  if (!item.render)
1019
- item.render = (value) => processValue(item, value).join(", ");
1039
+ item.render = (value) => processValue(item, value);
1020
1040
  if (!item.onFilter)
1021
1041
  item.onFilter = (value, row) => {
1022
1042
  if (!row[item.id] || !row[item.id].length)
@@ -1326,6 +1346,7 @@ export {
1326
1346
  TimePicker,
1327
1347
  Title,
1328
1348
  transferOptions,
1349
+ transferValue,
1329
1350
  useConfigContext,
1330
1351
  useDrawer,
1331
1352
  useModal
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@faasjs/ant-design",
3
- "version": "0.0.2-beta.437",
3
+ "version": "0.0.2-beta.439",
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.437",
31
+ "@faasjs/react": "^0.0.2-beta.439",
32
32
  "react-router-dom": "*",
33
33
  "dayjs": "*"
34
34
  },