@faasjs/ant-design 0.0.2-beta.417 → 0.0.2-beta.419
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/dist/index.d.ts +1 -1
- package/dist/index.js +31 -25
- package/dist/index.mjs +52 -46
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -145,13 +145,13 @@ declare type DescriptionItemProps<T = any> = {
|
|
|
145
145
|
render?: (value: T, values: any) => JSX.Element | string | number | boolean | null;
|
|
146
146
|
} & FaasItemProps;
|
|
147
147
|
declare type DescriptionProps<T = any, ExtendItemProps = any> = {
|
|
148
|
+
renderTitle?: ((values: T) => ReactNode);
|
|
148
149
|
items: (DescriptionItemProps | ExtendItemProps)[];
|
|
149
150
|
extendTypes?: {
|
|
150
151
|
[key: string]: ExtendDescriptionTypeProps;
|
|
151
152
|
};
|
|
152
153
|
dataSource?: T;
|
|
153
154
|
faasData?: FaasDataWrapperProps<T>;
|
|
154
|
-
footer?: (values: T) => JSX.Element;
|
|
155
155
|
} & DescriptionsProps;
|
|
156
156
|
declare function Description<T = any>(props: DescriptionProps<T>): JSX.Element;
|
|
157
157
|
|
package/dist/index.js
CHANGED
|
@@ -258,29 +258,28 @@ function DescriptionItemContent(props) {
|
|
|
258
258
|
}
|
|
259
259
|
function Description(props) {
|
|
260
260
|
if (!props.faasData)
|
|
261
|
-
return /* @__PURE__ */ (0, import_jsx_runtime3.
|
|
261
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_antd3.Descriptions, {
|
|
262
262
|
...props,
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
props.footer && props.footer(props.dataSource)
|
|
274
|
-
]
|
|
263
|
+
title: (0, import_lodash4.isFunction)(props.renderTitle) ? props.renderTitle(props.dataSource) : props.title,
|
|
264
|
+
children: props.items.map((item) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_antd3.Descriptions.Item, {
|
|
265
|
+
label: item.title || (0, import_lodash4.upperFirst)(item.id),
|
|
266
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(DescriptionItemContent, {
|
|
267
|
+
item,
|
|
268
|
+
value: props.dataSource[item.id],
|
|
269
|
+
values: props.dataSource,
|
|
270
|
+
extendTypes: props.extendTypes
|
|
271
|
+
})
|
|
272
|
+
}, item.id))
|
|
275
273
|
});
|
|
276
274
|
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react4.FaasDataWrapper, {
|
|
277
275
|
fallback: props.faasData.fallback || /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_antd3.Skeleton, {
|
|
278
276
|
active: true
|
|
279
277
|
}),
|
|
280
|
-
render: ({ data }) =>
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
278
|
+
render: ({ data }) => {
|
|
279
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_antd3.Descriptions, {
|
|
280
|
+
...props,
|
|
281
|
+
title: (0, import_lodash4.isFunction)(props.renderTitle) ? props.renderTitle(data) : props.title,
|
|
282
|
+
children: props.items.map((item) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_antd3.Descriptions.Item, {
|
|
284
283
|
label: item.title || (0, import_lodash4.upperFirst)(item.id),
|
|
285
284
|
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(DescriptionItemContent, {
|
|
286
285
|
item,
|
|
@@ -288,10 +287,9 @@ function Description(props) {
|
|
|
288
287
|
values: data,
|
|
289
288
|
extendTypes: props.extendTypes
|
|
290
289
|
})
|
|
291
|
-
}, item.id))
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
}),
|
|
290
|
+
}, item.id))
|
|
291
|
+
});
|
|
292
|
+
},
|
|
295
293
|
...props.faasData
|
|
296
294
|
});
|
|
297
295
|
}
|
|
@@ -974,7 +972,11 @@ function Table(props) {
|
|
|
974
972
|
if (!item.render)
|
|
975
973
|
item.render = (value) => processValue(item, value);
|
|
976
974
|
if (!item.onFilter) {
|
|
977
|
-
item.onFilter = (value, row) =>
|
|
975
|
+
item.onFilter = (value, row) => {
|
|
976
|
+
if (!row[item.id])
|
|
977
|
+
return false;
|
|
978
|
+
return row[item.id].includes(value);
|
|
979
|
+
};
|
|
978
980
|
}
|
|
979
981
|
if (!item.filters && item.filterDropdown !== false && item.optionsType !== "auto")
|
|
980
982
|
item.filterDropdown = ({
|
|
@@ -1001,7 +1003,11 @@ function Table(props) {
|
|
|
1001
1003
|
if (!item.render)
|
|
1002
1004
|
item.render = (value) => processValue(item, value).join(", ");
|
|
1003
1005
|
if (!item.onFilter)
|
|
1004
|
-
item.onFilter = (value, row) =>
|
|
1006
|
+
item.onFilter = (value, row) => {
|
|
1007
|
+
if (!row[item.id] || !row[item.id].length)
|
|
1008
|
+
return false;
|
|
1009
|
+
return row[item.id].some((v) => v.includes(value));
|
|
1010
|
+
};
|
|
1005
1011
|
if (!item.filters && item.filterDropdown !== false)
|
|
1006
1012
|
item.filterDropdown = ({
|
|
1007
1013
|
setSelectedKeys,
|
|
@@ -1042,7 +1048,7 @@ function Table(props) {
|
|
|
1042
1048
|
allowClear: true,
|
|
1043
1049
|
onSearch: (v) => {
|
|
1044
1050
|
if (v) {
|
|
1045
|
-
setSelectedKeys([v]);
|
|
1051
|
+
setSelectedKeys([Number(v)]);
|
|
1046
1052
|
} else {
|
|
1047
1053
|
setSelectedKeys([]);
|
|
1048
1054
|
clearFilters();
|
|
@@ -1068,7 +1074,7 @@ function Table(props) {
|
|
|
1068
1074
|
allowClear: true,
|
|
1069
1075
|
onSearch: (v) => {
|
|
1070
1076
|
if (v) {
|
|
1071
|
-
setSelectedKeys([v]);
|
|
1077
|
+
setSelectedKeys([Number(v)]);
|
|
1072
1078
|
} else {
|
|
1073
1079
|
setSelectedKeys([]);
|
|
1074
1080
|
clearFilters();
|
package/dist/index.mjs
CHANGED
|
@@ -121,7 +121,7 @@ import {
|
|
|
121
121
|
Descriptions,
|
|
122
122
|
Skeleton
|
|
123
123
|
} from "antd";
|
|
124
|
-
import { upperFirst as upperFirst2 } from "lodash";
|
|
124
|
+
import { isFunction, upperFirst as upperFirst2 } from "lodash";
|
|
125
125
|
import {
|
|
126
126
|
cloneElement,
|
|
127
127
|
useEffect as useEffect2,
|
|
@@ -129,7 +129,7 @@ import {
|
|
|
129
129
|
} from "react";
|
|
130
130
|
import dayjs from "dayjs";
|
|
131
131
|
import { FaasDataWrapper } from "@faasjs/react";
|
|
132
|
-
import { Fragment, jsx as jsx3
|
|
132
|
+
import { Fragment, jsx as jsx3 } from "react/jsx-runtime";
|
|
133
133
|
function DescriptionItemContent(props) {
|
|
134
134
|
const [computedProps, setComputedProps] = useState2();
|
|
135
135
|
useEffect2(() => {
|
|
@@ -219,29 +219,28 @@ function DescriptionItemContent(props) {
|
|
|
219
219
|
}
|
|
220
220
|
function Description(props) {
|
|
221
221
|
if (!props.faasData)
|
|
222
|
-
return /* @__PURE__ */
|
|
222
|
+
return /* @__PURE__ */ jsx3(Descriptions, {
|
|
223
223
|
...props,
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
props.footer && props.footer(props.dataSource)
|
|
235
|
-
]
|
|
224
|
+
title: isFunction(props.renderTitle) ? props.renderTitle(props.dataSource) : props.title,
|
|
225
|
+
children: props.items.map((item) => /* @__PURE__ */ jsx3(Descriptions.Item, {
|
|
226
|
+
label: item.title || upperFirst2(item.id),
|
|
227
|
+
children: /* @__PURE__ */ jsx3(DescriptionItemContent, {
|
|
228
|
+
item,
|
|
229
|
+
value: props.dataSource[item.id],
|
|
230
|
+
values: props.dataSource,
|
|
231
|
+
extendTypes: props.extendTypes
|
|
232
|
+
})
|
|
233
|
+
}, item.id))
|
|
236
234
|
});
|
|
237
235
|
return /* @__PURE__ */ jsx3(FaasDataWrapper, {
|
|
238
236
|
fallback: props.faasData.fallback || /* @__PURE__ */ jsx3(Skeleton, {
|
|
239
237
|
active: true
|
|
240
238
|
}),
|
|
241
|
-
render: ({ data }) =>
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
props.
|
|
239
|
+
render: ({ data }) => {
|
|
240
|
+
return /* @__PURE__ */ jsx3(Descriptions, {
|
|
241
|
+
...props,
|
|
242
|
+
title: isFunction(props.renderTitle) ? props.renderTitle(data) : props.title,
|
|
243
|
+
children: props.items.map((item) => /* @__PURE__ */ jsx3(Descriptions.Item, {
|
|
245
244
|
label: item.title || upperFirst2(item.id),
|
|
246
245
|
children: /* @__PURE__ */ jsx3(DescriptionItemContent, {
|
|
247
246
|
item,
|
|
@@ -249,10 +248,9 @@ function Description(props) {
|
|
|
249
248
|
values: data,
|
|
250
249
|
extendTypes: props.extendTypes
|
|
251
250
|
})
|
|
252
|
-
}, item.id))
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
}),
|
|
251
|
+
}, item.id))
|
|
252
|
+
});
|
|
253
|
+
},
|
|
256
254
|
...props.faasData
|
|
257
255
|
});
|
|
258
256
|
}
|
|
@@ -325,7 +323,7 @@ TimePicker.displayName = "TimePicker";
|
|
|
325
323
|
|
|
326
324
|
// src/FormItem.tsx
|
|
327
325
|
import dayjs2, { isDayjs } from "dayjs";
|
|
328
|
-
import { Fragment as Fragment2, jsx as jsx6, jsxs
|
|
326
|
+
import { Fragment as Fragment2, jsx as jsx6, jsxs } from "react/jsx-runtime";
|
|
329
327
|
function processProps(propsCopy, config) {
|
|
330
328
|
if (!propsCopy.title)
|
|
331
329
|
propsCopy.title = upperFirst3(propsCopy.id);
|
|
@@ -446,7 +444,7 @@ function FormItem(props) {
|
|
|
446
444
|
rules: computedProps.rules,
|
|
447
445
|
children: (fields, { add, remove }, { errors }) => {
|
|
448
446
|
var _a2;
|
|
449
|
-
return /* @__PURE__ */
|
|
447
|
+
return /* @__PURE__ */ jsxs(Fragment2, {
|
|
450
448
|
children: [
|
|
451
449
|
computedProps.label && /* @__PURE__ */ jsx6("div", {
|
|
452
450
|
className: "ant-form-item-label",
|
|
@@ -458,7 +456,7 @@ function FormItem(props) {
|
|
|
458
456
|
fields.map((field) => {
|
|
459
457
|
var _a3;
|
|
460
458
|
return /* @__PURE__ */ jsx6(AntdForm.Item, {
|
|
461
|
-
children: /* @__PURE__ */
|
|
459
|
+
children: /* @__PURE__ */ jsxs(Row, {
|
|
462
460
|
gutter: 24,
|
|
463
461
|
style: { flexFlow: "row nowrap" },
|
|
464
462
|
children: [
|
|
@@ -486,7 +484,7 @@ function FormItem(props) {
|
|
|
486
484
|
})
|
|
487
485
|
}, field.key);
|
|
488
486
|
}),
|
|
489
|
-
/* @__PURE__ */
|
|
487
|
+
/* @__PURE__ */ jsxs(AntdForm.Item, {
|
|
490
488
|
children: [
|
|
491
489
|
!((_a2 = computedProps.input) == null ? void 0 : _a2.disabled) && (!computedProps.maxCount || computedProps.maxCount > fields.length) && /* @__PURE__ */ jsx6(Button, {
|
|
492
490
|
type: "dashed",
|
|
@@ -527,7 +525,7 @@ function FormItem(props) {
|
|
|
527
525
|
rules: computedProps.rules,
|
|
528
526
|
children: (fields, { add, remove }, { errors }) => {
|
|
529
527
|
var _a2, _b;
|
|
530
|
-
return /* @__PURE__ */
|
|
528
|
+
return /* @__PURE__ */ jsxs(Fragment2, {
|
|
531
529
|
children: [
|
|
532
530
|
computedProps.label && /* @__PURE__ */ jsx6("div", {
|
|
533
531
|
className: "ant-form-item-label",
|
|
@@ -539,7 +537,7 @@ function FormItem(props) {
|
|
|
539
537
|
fields.map((field) => {
|
|
540
538
|
var _a3;
|
|
541
539
|
return /* @__PURE__ */ jsx6(AntdForm.Item, {
|
|
542
|
-
children: /* @__PURE__ */
|
|
540
|
+
children: /* @__PURE__ */ jsxs(Row, {
|
|
543
541
|
gutter: 24,
|
|
544
542
|
style: { flexFlow: "row nowrap" },
|
|
545
543
|
children: [
|
|
@@ -568,7 +566,7 @@ function FormItem(props) {
|
|
|
568
566
|
})
|
|
569
567
|
}, field.key);
|
|
570
568
|
}),
|
|
571
|
-
/* @__PURE__ */
|
|
569
|
+
/* @__PURE__ */ jsxs(AntdForm.Item, {
|
|
572
570
|
children: [
|
|
573
571
|
!((_b = computedProps.input) == null ? void 0 : _b.disabled) && (!computedProps.maxCount || computedProps.maxCount > fields.length) && /* @__PURE__ */ jsx6(Button, {
|
|
574
572
|
type: "dashed",
|
|
@@ -607,7 +605,7 @@ function FormItem(props) {
|
|
|
607
605
|
})
|
|
608
606
|
});
|
|
609
607
|
case "object":
|
|
610
|
-
return /* @__PURE__ */
|
|
608
|
+
return /* @__PURE__ */ jsxs(Fragment2, {
|
|
611
609
|
children: [
|
|
612
610
|
computedProps.label && /* @__PURE__ */ jsx6("div", {
|
|
613
611
|
className: "ant-form-item-label",
|
|
@@ -625,14 +623,14 @@ function FormItem(props) {
|
|
|
625
623
|
return /* @__PURE__ */ jsx6(AntdForm.List, {
|
|
626
624
|
name: computedProps.name,
|
|
627
625
|
rules: computedProps.rules,
|
|
628
|
-
children: (fields, { add, remove }, { errors }) => /* @__PURE__ */
|
|
626
|
+
children: (fields, { add, remove }, { errors }) => /* @__PURE__ */ jsxs(Fragment2, {
|
|
629
627
|
children: [
|
|
630
|
-
fields.map((field) => /* @__PURE__ */
|
|
628
|
+
fields.map((field) => /* @__PURE__ */ jsxs(AntdForm.Item, {
|
|
631
629
|
style: { marginBottom: 0 },
|
|
632
630
|
children: [
|
|
633
631
|
/* @__PURE__ */ jsx6("div", {
|
|
634
632
|
className: "ant-form-item-label",
|
|
635
|
-
children: /* @__PURE__ */
|
|
633
|
+
children: /* @__PURE__ */ jsxs("label", {
|
|
636
634
|
children: [
|
|
637
635
|
computedProps.label,
|
|
638
636
|
" ",
|
|
@@ -658,9 +656,9 @@ function FormItem(props) {
|
|
|
658
656
|
})
|
|
659
657
|
]
|
|
660
658
|
}, field.key)),
|
|
661
|
-
/* @__PURE__ */
|
|
659
|
+
/* @__PURE__ */ jsxs(AntdForm.Item, {
|
|
662
660
|
children: [
|
|
663
|
-
!computedProps.disabled && (!computedProps.maxCount || computedProps.maxCount > fields.length) && /* @__PURE__ */
|
|
661
|
+
!computedProps.disabled && (!computedProps.maxCount || computedProps.maxCount > fields.length) && /* @__PURE__ */ jsxs(Button, {
|
|
664
662
|
type: "dashed",
|
|
665
663
|
block: true,
|
|
666
664
|
onClick: () => add(),
|
|
@@ -685,7 +683,7 @@ function FormItem(props) {
|
|
|
685
683
|
}
|
|
686
684
|
|
|
687
685
|
// src/Form.tsx
|
|
688
|
-
import { jsx as jsx7, jsxs as
|
|
686
|
+
import { jsx as jsx7, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
689
687
|
function Form(props) {
|
|
690
688
|
var _a, _b;
|
|
691
689
|
const [loading, setLoading] = useState5(false);
|
|
@@ -729,7 +727,7 @@ function Form(props) {
|
|
|
729
727
|
}, []);
|
|
730
728
|
if (!computedProps)
|
|
731
729
|
return null;
|
|
732
|
-
return /* @__PURE__ */
|
|
730
|
+
return /* @__PURE__ */ jsxs2(AntdForm2, {
|
|
733
731
|
...computedProps,
|
|
734
732
|
children: [
|
|
735
733
|
computedProps.beforeItems,
|
|
@@ -849,7 +847,7 @@ import {
|
|
|
849
847
|
Routes as OriginRoutes,
|
|
850
848
|
Route
|
|
851
849
|
} from "react-router-dom";
|
|
852
|
-
import { jsx as jsx10, jsxs as
|
|
850
|
+
import { jsx as jsx10, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
853
851
|
function PageNotFound() {
|
|
854
852
|
const config = useConfigContext();
|
|
855
853
|
return /* @__PURE__ */ jsx10(Result, {
|
|
@@ -858,7 +856,7 @@ function PageNotFound() {
|
|
|
858
856
|
});
|
|
859
857
|
}
|
|
860
858
|
function Routes(props) {
|
|
861
|
-
return /* @__PURE__ */
|
|
859
|
+
return /* @__PURE__ */ jsxs3(OriginRoutes, {
|
|
862
860
|
children: [
|
|
863
861
|
props.routes.map((r) => /* @__PURE__ */ jsx10(Route, {
|
|
864
862
|
...r,
|
|
@@ -900,7 +898,7 @@ import {
|
|
|
900
898
|
upperFirst as upperFirst4
|
|
901
899
|
} from "lodash";
|
|
902
900
|
import { FaasDataWrapper as FaasDataWrapper2 } from "@faasjs/react";
|
|
903
|
-
import { jsx as jsx11, jsxs as
|
|
901
|
+
import { jsx as jsx11, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
904
902
|
function processValue(item, value) {
|
|
905
903
|
var _a;
|
|
906
904
|
if (typeof value === "undefined" && value === null)
|
|
@@ -968,7 +966,11 @@ function Table(props) {
|
|
|
968
966
|
if (!item.render)
|
|
969
967
|
item.render = (value) => processValue(item, value);
|
|
970
968
|
if (!item.onFilter) {
|
|
971
|
-
item.onFilter = (value, row) =>
|
|
969
|
+
item.onFilter = (value, row) => {
|
|
970
|
+
if (!row[item.id])
|
|
971
|
+
return false;
|
|
972
|
+
return row[item.id].includes(value);
|
|
973
|
+
};
|
|
972
974
|
}
|
|
973
975
|
if (!item.filters && item.filterDropdown !== false && item.optionsType !== "auto")
|
|
974
976
|
item.filterDropdown = ({
|
|
@@ -995,7 +997,11 @@ function Table(props) {
|
|
|
995
997
|
if (!item.render)
|
|
996
998
|
item.render = (value) => processValue(item, value).join(", ");
|
|
997
999
|
if (!item.onFilter)
|
|
998
|
-
item.onFilter = (value, row) =>
|
|
1000
|
+
item.onFilter = (value, row) => {
|
|
1001
|
+
if (!row[item.id] || !row[item.id].length)
|
|
1002
|
+
return false;
|
|
1003
|
+
return row[item.id].some((v) => v.includes(value));
|
|
1004
|
+
};
|
|
999
1005
|
if (!item.filters && item.filterDropdown !== false)
|
|
1000
1006
|
item.filterDropdown = ({
|
|
1001
1007
|
setSelectedKeys,
|
|
@@ -1036,7 +1042,7 @@ function Table(props) {
|
|
|
1036
1042
|
allowClear: true,
|
|
1037
1043
|
onSearch: (v) => {
|
|
1038
1044
|
if (v) {
|
|
1039
|
-
setSelectedKeys([v]);
|
|
1045
|
+
setSelectedKeys([Number(v)]);
|
|
1040
1046
|
} else {
|
|
1041
1047
|
setSelectedKeys([]);
|
|
1042
1048
|
clearFilters();
|
|
@@ -1062,7 +1068,7 @@ function Table(props) {
|
|
|
1062
1068
|
allowClear: true,
|
|
1063
1069
|
onSearch: (v) => {
|
|
1064
1070
|
if (v) {
|
|
1065
|
-
setSelectedKeys([v]);
|
|
1071
|
+
setSelectedKeys([Number(v)]);
|
|
1066
1072
|
} else {
|
|
1067
1073
|
setSelectedKeys([]);
|
|
1068
1074
|
clearFilters();
|
|
@@ -1089,7 +1095,7 @@ function Table(props) {
|
|
|
1089
1095
|
setSelectedKeys,
|
|
1090
1096
|
selectedKeys,
|
|
1091
1097
|
confirm
|
|
1092
|
-
}) => /* @__PURE__ */
|
|
1098
|
+
}) => /* @__PURE__ */ jsxs4(Radio.Group, {
|
|
1093
1099
|
style: { padding: 8 },
|
|
1094
1100
|
buttonStyle: "solid",
|
|
1095
1101
|
value: selectedKeys[0],
|
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.419",
|
|
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.419",
|
|
32
32
|
"react-router-dom": "*",
|
|
33
33
|
"dayjs": "*"
|
|
34
34
|
},
|