@faasjs/ant-design 0.0.2-beta.415 → 0.0.2-beta.417
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 +4 -0
- package/dist/index.js +306 -233
- package/dist/index.mjs +205 -130
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -24,7 +24,9 @@ var zh = {
|
|
|
24
24
|
pageNotFound: "\u9875\u9762\u672A\u627E\u5230",
|
|
25
25
|
add: "\u6DFB\u52A0",
|
|
26
26
|
delete: "\u5220\u9664",
|
|
27
|
-
required: "\u5FC5\u586B"
|
|
27
|
+
required: "\u5FC5\u586B",
|
|
28
|
+
search: "\u641C\u7D22",
|
|
29
|
+
reset: "\u91CD\u7F6E"
|
|
28
30
|
};
|
|
29
31
|
var en = {
|
|
30
32
|
lang: "en",
|
|
@@ -34,7 +36,9 @@ var en = {
|
|
|
34
36
|
pageNotFound: "Page Not Found",
|
|
35
37
|
add: "Add",
|
|
36
38
|
delete: "Delete",
|
|
37
|
-
required: "is required"
|
|
39
|
+
required: "is required",
|
|
40
|
+
search: "Search",
|
|
41
|
+
reset: "Reset"
|
|
38
42
|
};
|
|
39
43
|
var common = isZH ? zh : en;
|
|
40
44
|
var baseConfig = {
|
|
@@ -125,7 +129,7 @@ import {
|
|
|
125
129
|
} from "react";
|
|
126
130
|
import dayjs from "dayjs";
|
|
127
131
|
import { FaasDataWrapper } from "@faasjs/react";
|
|
128
|
-
import { Fragment, jsx as jsx3 } from "react/jsx-runtime";
|
|
132
|
+
import { Fragment, jsx as jsx3, jsxs } from "react/jsx-runtime";
|
|
129
133
|
function DescriptionItemContent(props) {
|
|
130
134
|
const [computedProps, setComputedProps] = useState2();
|
|
131
135
|
useEffect2(() => {
|
|
@@ -177,7 +181,7 @@ function DescriptionItemContent(props) {
|
|
|
177
181
|
children: computedProps.item.render(computedProps.value, computedProps.values)
|
|
178
182
|
});
|
|
179
183
|
if (typeof computedProps.value === "undefined" || computedProps.value === null)
|
|
180
|
-
return
|
|
184
|
+
return /* @__PURE__ */ jsx3(Blank, {});
|
|
181
185
|
switch (computedProps.item.type) {
|
|
182
186
|
case "string[]":
|
|
183
187
|
return /* @__PURE__ */ jsx3(Fragment, {
|
|
@@ -215,33 +219,39 @@ function DescriptionItemContent(props) {
|
|
|
215
219
|
}
|
|
216
220
|
function Description(props) {
|
|
217
221
|
if (!props.faasData)
|
|
218
|
-
return /* @__PURE__ */
|
|
222
|
+
return /* @__PURE__ */ jsxs(Descriptions, {
|
|
219
223
|
...props,
|
|
220
|
-
children:
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
224
|
+
children: [
|
|
225
|
+
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)),
|
|
234
|
+
props.footer && props.footer(props.dataSource)
|
|
235
|
+
]
|
|
229
236
|
});
|
|
230
237
|
return /* @__PURE__ */ jsx3(FaasDataWrapper, {
|
|
231
238
|
fallback: props.faasData.fallback || /* @__PURE__ */ jsx3(Skeleton, {
|
|
232
239
|
active: true
|
|
233
240
|
}),
|
|
234
|
-
render: ({ data }) => /* @__PURE__ */
|
|
241
|
+
render: ({ data }) => /* @__PURE__ */ jsxs(Descriptions, {
|
|
235
242
|
...props,
|
|
236
|
-
children:
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
243
|
+
children: [
|
|
244
|
+
props.items.map((item) => /* @__PURE__ */ jsx3(Descriptions.Item, {
|
|
245
|
+
label: item.title || upperFirst2(item.id),
|
|
246
|
+
children: /* @__PURE__ */ jsx3(DescriptionItemContent, {
|
|
247
|
+
item,
|
|
248
|
+
value: data[item.id],
|
|
249
|
+
values: data,
|
|
250
|
+
extendTypes: props.extendTypes
|
|
251
|
+
})
|
|
252
|
+
}, item.id)),
|
|
253
|
+
props.footer && props.footer(data)
|
|
254
|
+
]
|
|
245
255
|
}),
|
|
246
256
|
...props.faasData
|
|
247
257
|
});
|
|
@@ -315,7 +325,7 @@ TimePicker.displayName = "TimePicker";
|
|
|
315
325
|
|
|
316
326
|
// src/FormItem.tsx
|
|
317
327
|
import dayjs2, { isDayjs } from "dayjs";
|
|
318
|
-
import { Fragment as Fragment2, jsx as jsx6, jsxs } from "react/jsx-runtime";
|
|
328
|
+
import { Fragment as Fragment2, jsx as jsx6, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
319
329
|
function processProps(propsCopy, config) {
|
|
320
330
|
if (!propsCopy.title)
|
|
321
331
|
propsCopy.title = upperFirst3(propsCopy.id);
|
|
@@ -436,7 +446,7 @@ function FormItem(props) {
|
|
|
436
446
|
rules: computedProps.rules,
|
|
437
447
|
children: (fields, { add, remove }, { errors }) => {
|
|
438
448
|
var _a2;
|
|
439
|
-
return /* @__PURE__ */
|
|
449
|
+
return /* @__PURE__ */ jsxs2(Fragment2, {
|
|
440
450
|
children: [
|
|
441
451
|
computedProps.label && /* @__PURE__ */ jsx6("div", {
|
|
442
452
|
className: "ant-form-item-label",
|
|
@@ -448,7 +458,7 @@ function FormItem(props) {
|
|
|
448
458
|
fields.map((field) => {
|
|
449
459
|
var _a3;
|
|
450
460
|
return /* @__PURE__ */ jsx6(AntdForm.Item, {
|
|
451
|
-
children: /* @__PURE__ */
|
|
461
|
+
children: /* @__PURE__ */ jsxs2(Row, {
|
|
452
462
|
gutter: 24,
|
|
453
463
|
style: { flexFlow: "row nowrap" },
|
|
454
464
|
children: [
|
|
@@ -476,7 +486,7 @@ function FormItem(props) {
|
|
|
476
486
|
})
|
|
477
487
|
}, field.key);
|
|
478
488
|
}),
|
|
479
|
-
/* @__PURE__ */
|
|
489
|
+
/* @__PURE__ */ jsxs2(AntdForm.Item, {
|
|
480
490
|
children: [
|
|
481
491
|
!((_a2 = computedProps.input) == null ? void 0 : _a2.disabled) && (!computedProps.maxCount || computedProps.maxCount > fields.length) && /* @__PURE__ */ jsx6(Button, {
|
|
482
492
|
type: "dashed",
|
|
@@ -517,7 +527,7 @@ function FormItem(props) {
|
|
|
517
527
|
rules: computedProps.rules,
|
|
518
528
|
children: (fields, { add, remove }, { errors }) => {
|
|
519
529
|
var _a2, _b;
|
|
520
|
-
return /* @__PURE__ */
|
|
530
|
+
return /* @__PURE__ */ jsxs2(Fragment2, {
|
|
521
531
|
children: [
|
|
522
532
|
computedProps.label && /* @__PURE__ */ jsx6("div", {
|
|
523
533
|
className: "ant-form-item-label",
|
|
@@ -529,7 +539,7 @@ function FormItem(props) {
|
|
|
529
539
|
fields.map((field) => {
|
|
530
540
|
var _a3;
|
|
531
541
|
return /* @__PURE__ */ jsx6(AntdForm.Item, {
|
|
532
|
-
children: /* @__PURE__ */
|
|
542
|
+
children: /* @__PURE__ */ jsxs2(Row, {
|
|
533
543
|
gutter: 24,
|
|
534
544
|
style: { flexFlow: "row nowrap" },
|
|
535
545
|
children: [
|
|
@@ -558,7 +568,7 @@ function FormItem(props) {
|
|
|
558
568
|
})
|
|
559
569
|
}, field.key);
|
|
560
570
|
}),
|
|
561
|
-
/* @__PURE__ */
|
|
571
|
+
/* @__PURE__ */ jsxs2(AntdForm.Item, {
|
|
562
572
|
children: [
|
|
563
573
|
!((_b = computedProps.input) == null ? void 0 : _b.disabled) && (!computedProps.maxCount || computedProps.maxCount > fields.length) && /* @__PURE__ */ jsx6(Button, {
|
|
564
574
|
type: "dashed",
|
|
@@ -597,7 +607,7 @@ function FormItem(props) {
|
|
|
597
607
|
})
|
|
598
608
|
});
|
|
599
609
|
case "object":
|
|
600
|
-
return /* @__PURE__ */
|
|
610
|
+
return /* @__PURE__ */ jsxs2(Fragment2, {
|
|
601
611
|
children: [
|
|
602
612
|
computedProps.label && /* @__PURE__ */ jsx6("div", {
|
|
603
613
|
className: "ant-form-item-label",
|
|
@@ -615,14 +625,14 @@ function FormItem(props) {
|
|
|
615
625
|
return /* @__PURE__ */ jsx6(AntdForm.List, {
|
|
616
626
|
name: computedProps.name,
|
|
617
627
|
rules: computedProps.rules,
|
|
618
|
-
children: (fields, { add, remove }, { errors }) => /* @__PURE__ */
|
|
628
|
+
children: (fields, { add, remove }, { errors }) => /* @__PURE__ */ jsxs2(Fragment2, {
|
|
619
629
|
children: [
|
|
620
|
-
fields.map((field) => /* @__PURE__ */
|
|
630
|
+
fields.map((field) => /* @__PURE__ */ jsxs2(AntdForm.Item, {
|
|
621
631
|
style: { marginBottom: 0 },
|
|
622
632
|
children: [
|
|
623
633
|
/* @__PURE__ */ jsx6("div", {
|
|
624
634
|
className: "ant-form-item-label",
|
|
625
|
-
children: /* @__PURE__ */
|
|
635
|
+
children: /* @__PURE__ */ jsxs2("label", {
|
|
626
636
|
children: [
|
|
627
637
|
computedProps.label,
|
|
628
638
|
" ",
|
|
@@ -648,9 +658,9 @@ function FormItem(props) {
|
|
|
648
658
|
})
|
|
649
659
|
]
|
|
650
660
|
}, field.key)),
|
|
651
|
-
/* @__PURE__ */
|
|
661
|
+
/* @__PURE__ */ jsxs2(AntdForm.Item, {
|
|
652
662
|
children: [
|
|
653
|
-
!computedProps.disabled && (!computedProps.maxCount || computedProps.maxCount > fields.length) && /* @__PURE__ */
|
|
663
|
+
!computedProps.disabled && (!computedProps.maxCount || computedProps.maxCount > fields.length) && /* @__PURE__ */ jsxs2(Button, {
|
|
654
664
|
type: "dashed",
|
|
655
665
|
block: true,
|
|
656
666
|
onClick: () => add(),
|
|
@@ -675,7 +685,7 @@ function FormItem(props) {
|
|
|
675
685
|
}
|
|
676
686
|
|
|
677
687
|
// src/Form.tsx
|
|
678
|
-
import { jsx as jsx7, jsxs as
|
|
688
|
+
import { jsx as jsx7, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
679
689
|
function Form(props) {
|
|
680
690
|
var _a, _b;
|
|
681
691
|
const [loading, setLoading] = useState5(false);
|
|
@@ -719,7 +729,7 @@ function Form(props) {
|
|
|
719
729
|
}, []);
|
|
720
730
|
if (!computedProps)
|
|
721
731
|
return null;
|
|
722
|
-
return /* @__PURE__ */
|
|
732
|
+
return /* @__PURE__ */ jsxs3(AntdForm2, {
|
|
723
733
|
...computedProps,
|
|
724
734
|
children: [
|
|
725
735
|
computedProps.beforeItems,
|
|
@@ -839,7 +849,7 @@ import {
|
|
|
839
849
|
Routes as OriginRoutes,
|
|
840
850
|
Route
|
|
841
851
|
} from "react-router-dom";
|
|
842
|
-
import { jsx as jsx10, jsxs as
|
|
852
|
+
import { jsx as jsx10, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
843
853
|
function PageNotFound() {
|
|
844
854
|
const config = useConfigContext();
|
|
845
855
|
return /* @__PURE__ */ jsx10(Result, {
|
|
@@ -848,7 +858,7 @@ function PageNotFound() {
|
|
|
848
858
|
});
|
|
849
859
|
}
|
|
850
860
|
function Routes(props) {
|
|
851
|
-
return /* @__PURE__ */
|
|
861
|
+
return /* @__PURE__ */ jsxs4(OriginRoutes, {
|
|
852
862
|
children: [
|
|
853
863
|
props.routes.map((r) => /* @__PURE__ */ jsx10(Route, {
|
|
854
864
|
...r,
|
|
@@ -879,48 +889,45 @@ import {
|
|
|
879
889
|
import {
|
|
880
890
|
Table as AntdTable,
|
|
881
891
|
Radio,
|
|
882
|
-
Skeleton as Skeleton3
|
|
892
|
+
Skeleton as Skeleton3,
|
|
893
|
+
Input as Input2
|
|
883
894
|
} from "antd";
|
|
884
895
|
import dayjs3 from "dayjs";
|
|
896
|
+
import { CheckOutlined as CheckOutlined2, CloseOutlined as CloseOutlined2 } from "@ant-design/icons";
|
|
885
897
|
import {
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
898
|
+
isNil as isNil2,
|
|
899
|
+
uniqBy,
|
|
900
|
+
upperFirst as upperFirst4
|
|
901
|
+
} from "lodash";
|
|
890
902
|
import { FaasDataWrapper as FaasDataWrapper2 } from "@faasjs/react";
|
|
891
|
-
import { jsx as jsx11, jsxs as
|
|
903
|
+
import { jsx as jsx11, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
892
904
|
function processValue(item, value) {
|
|
893
905
|
var _a;
|
|
894
|
-
if (typeof value
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
if (["date", "time"].includes(item.type)) {
|
|
914
|
-
if (typeof value === "number" && value.toString().length === 10)
|
|
915
|
-
value = value * 1e3;
|
|
916
|
-
value = dayjs3(value).format(dayjsFormat);
|
|
917
|
-
}
|
|
906
|
+
if (typeof value === "undefined" && value === null)
|
|
907
|
+
return /* @__PURE__ */ jsx11(Blank, {});
|
|
908
|
+
if (item.options) {
|
|
909
|
+
if (item.type.endsWith("[]"))
|
|
910
|
+
return value.map((v) => {
|
|
911
|
+
var _a2;
|
|
912
|
+
return ((_a2 = item.options.find((option) => option.value === v)) == null ? void 0 : _a2.label) || v;
|
|
913
|
+
});
|
|
914
|
+
else if ([
|
|
915
|
+
"string",
|
|
916
|
+
"number",
|
|
917
|
+
"boolean"
|
|
918
|
+
].includes(item.type))
|
|
919
|
+
return ((_a = item.options.find((option) => option.value === value)) == null ? void 0 : _a.label) || value;
|
|
920
|
+
}
|
|
921
|
+
if (["date", "time"].includes(item.type)) {
|
|
922
|
+
if (typeof value === "number" && value.toString().length === 10)
|
|
923
|
+
value = value * 1e3;
|
|
924
|
+
return dayjs3(value).format(item.type === "date" ? "YYYY-MM-DD" : "YYYY-MM-DD HH:mm:ss");
|
|
918
925
|
}
|
|
919
926
|
return value;
|
|
920
927
|
}
|
|
921
928
|
function Table(props) {
|
|
922
929
|
const [columns, setColumns] = useState7();
|
|
923
|
-
const
|
|
930
|
+
const { common: common2 } = useConfigContext();
|
|
924
931
|
useEffect5(() => {
|
|
925
932
|
var _a;
|
|
926
933
|
for (const item of props.items) {
|
|
@@ -939,8 +946,6 @@ function Table(props) {
|
|
|
939
946
|
value: o.value
|
|
940
947
|
}));
|
|
941
948
|
}
|
|
942
|
-
if (item.render)
|
|
943
|
-
continue;
|
|
944
949
|
if (item.children)
|
|
945
950
|
delete item.children;
|
|
946
951
|
if (props.extendTypes && props.extendTypes[item.type]) {
|
|
@@ -960,81 +965,131 @@ function Table(props) {
|
|
|
960
965
|
}
|
|
961
966
|
switch (item.type) {
|
|
962
967
|
case "string":
|
|
963
|
-
item.render
|
|
968
|
+
if (!item.render)
|
|
969
|
+
item.render = (value) => processValue(item, value);
|
|
964
970
|
if (!item.onFilter) {
|
|
965
971
|
item.onFilter = (value, row) => row[item.id].includes(value);
|
|
966
|
-
if (item.filterDropdown !== false)
|
|
967
|
-
item.filterDropdown = ({
|
|
968
|
-
setSelectedKeys,
|
|
969
|
-
selectedKeys,
|
|
970
|
-
confirm,
|
|
971
|
-
clearFilters
|
|
972
|
-
}) => /* @__PURE__ */ jsxs4("div", {
|
|
973
|
-
style: { padding: 8 },
|
|
974
|
-
children: [
|
|
975
|
-
/* @__PURE__ */ jsx11("input", {
|
|
976
|
-
value: selectedKeys[0],
|
|
977
|
-
onChange: (e) => setSelectedKeys(e.target.value ? [e.target.value] : []),
|
|
978
|
-
style: {
|
|
979
|
-
width: 188,
|
|
980
|
-
marginBottom: 8,
|
|
981
|
-
display: "block"
|
|
982
|
-
}
|
|
983
|
-
}),
|
|
984
|
-
/* @__PURE__ */ jsx11("button", {
|
|
985
|
-
type: "button",
|
|
986
|
-
onClick: () => confirm(),
|
|
987
|
-
style: {
|
|
988
|
-
width: 90,
|
|
989
|
-
marginRight: 8
|
|
990
|
-
},
|
|
991
|
-
children: "Search"
|
|
992
|
-
}),
|
|
993
|
-
/* @__PURE__ */ jsx11("button", {
|
|
994
|
-
type: "button",
|
|
995
|
-
onClick: () => clearFilters(),
|
|
996
|
-
style: { width: 90 },
|
|
997
|
-
children: "Reset"
|
|
998
|
-
})
|
|
999
|
-
]
|
|
1000
|
-
});
|
|
1001
972
|
}
|
|
973
|
+
if (!item.filters && item.filterDropdown !== false && item.optionsType !== "auto")
|
|
974
|
+
item.filterDropdown = ({
|
|
975
|
+
setSelectedKeys,
|
|
976
|
+
selectedKeys,
|
|
977
|
+
confirm,
|
|
978
|
+
clearFilters
|
|
979
|
+
}) => /* @__PURE__ */ jsx11(Input2.Search, {
|
|
980
|
+
placeholder: `${common2.search} ${item.title}`,
|
|
981
|
+
value: selectedKeys[0],
|
|
982
|
+
allowClear: true,
|
|
983
|
+
onSearch: (v) => {
|
|
984
|
+
if (v) {
|
|
985
|
+
setSelectedKeys([v]);
|
|
986
|
+
} else {
|
|
987
|
+
setSelectedKeys([]);
|
|
988
|
+
clearFilters();
|
|
989
|
+
}
|
|
990
|
+
confirm();
|
|
991
|
+
}
|
|
992
|
+
});
|
|
1002
993
|
break;
|
|
1003
994
|
case "string[]":
|
|
1004
|
-
|
|
995
|
+
if (!item.render)
|
|
996
|
+
item.render = (value) => processValue(item, value).join(", ");
|
|
1005
997
|
if (!item.onFilter)
|
|
1006
998
|
item.onFilter = (value, row) => row[item.id].includes(value);
|
|
999
|
+
if (!item.filters && item.filterDropdown !== false)
|
|
1000
|
+
item.filterDropdown = ({
|
|
1001
|
+
setSelectedKeys,
|
|
1002
|
+
selectedKeys,
|
|
1003
|
+
confirm,
|
|
1004
|
+
clearFilters
|
|
1005
|
+
}) => /* @__PURE__ */ jsx11(Input2.Search, {
|
|
1006
|
+
placeholder: `${common2.search} ${item.title}`,
|
|
1007
|
+
value: selectedKeys[0],
|
|
1008
|
+
allowClear: true,
|
|
1009
|
+
onSearch: (v) => {
|
|
1010
|
+
if (v) {
|
|
1011
|
+
setSelectedKeys([v]);
|
|
1012
|
+
} else {
|
|
1013
|
+
setSelectedKeys([]);
|
|
1014
|
+
clearFilters();
|
|
1015
|
+
}
|
|
1016
|
+
confirm();
|
|
1017
|
+
}
|
|
1018
|
+
});
|
|
1007
1019
|
break;
|
|
1008
1020
|
case "number":
|
|
1009
|
-
item.render
|
|
1021
|
+
if (!item.render)
|
|
1022
|
+
item.render = (value) => processValue(item, value);
|
|
1010
1023
|
if (!item.sorter)
|
|
1011
1024
|
item.sorter = (a, b) => a[item.id] - b[item.id];
|
|
1012
1025
|
if (!item.onFilter)
|
|
1013
1026
|
item.onFilter = (value, row) => value === row[item.id];
|
|
1027
|
+
if (!item.filters && item.filterDropdown !== false)
|
|
1028
|
+
item.filterDropdown = ({
|
|
1029
|
+
setSelectedKeys,
|
|
1030
|
+
selectedKeys,
|
|
1031
|
+
confirm,
|
|
1032
|
+
clearFilters
|
|
1033
|
+
}) => /* @__PURE__ */ jsx11(Input2.Search, {
|
|
1034
|
+
placeholder: `${common2.search} ${item.title}`,
|
|
1035
|
+
value: selectedKeys[0],
|
|
1036
|
+
allowClear: true,
|
|
1037
|
+
onSearch: (v) => {
|
|
1038
|
+
if (v) {
|
|
1039
|
+
setSelectedKeys([v]);
|
|
1040
|
+
} else {
|
|
1041
|
+
setSelectedKeys([]);
|
|
1042
|
+
clearFilters();
|
|
1043
|
+
}
|
|
1044
|
+
confirm();
|
|
1045
|
+
}
|
|
1046
|
+
});
|
|
1014
1047
|
break;
|
|
1015
1048
|
case "number[]":
|
|
1016
|
-
|
|
1049
|
+
if (!item.render)
|
|
1050
|
+
item.render = (value) => processValue(item, value).join(", ");
|
|
1017
1051
|
if (!item.onFilter)
|
|
1018
1052
|
item.onFilter = (value, row) => row[item.id].includes(value);
|
|
1053
|
+
if (!item.filters && item.filterDropdown !== false)
|
|
1054
|
+
item.filterDropdown = ({
|
|
1055
|
+
setSelectedKeys,
|
|
1056
|
+
selectedKeys,
|
|
1057
|
+
confirm,
|
|
1058
|
+
clearFilters
|
|
1059
|
+
}) => /* @__PURE__ */ jsx11(Input2.Search, {
|
|
1060
|
+
placeholder: `${common2.search} ${item.title}`,
|
|
1061
|
+
value: selectedKeys[0],
|
|
1062
|
+
allowClear: true,
|
|
1063
|
+
onSearch: (v) => {
|
|
1064
|
+
if (v) {
|
|
1065
|
+
setSelectedKeys([v]);
|
|
1066
|
+
} else {
|
|
1067
|
+
setSelectedKeys([]);
|
|
1068
|
+
clearFilters();
|
|
1069
|
+
}
|
|
1070
|
+
confirm();
|
|
1071
|
+
}
|
|
1072
|
+
});
|
|
1019
1073
|
break;
|
|
1020
1074
|
case "boolean":
|
|
1021
|
-
item.render
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1075
|
+
if (!item.render)
|
|
1076
|
+
item.render = (value) => typeof value === "undefined" ? /* @__PURE__ */ jsx11(Blank, {}) : value ? /* @__PURE__ */ jsx11(CheckOutlined2, {
|
|
1077
|
+
style: {
|
|
1078
|
+
marginTop: "4px",
|
|
1079
|
+
color: "#52c41a"
|
|
1080
|
+
}
|
|
1081
|
+
}) : /* @__PURE__ */ jsx11(CloseOutlined2, {
|
|
1082
|
+
style: {
|
|
1083
|
+
marginTop: "4px",
|
|
1084
|
+
color: "#ff4d4f"
|
|
1085
|
+
}
|
|
1086
|
+
});
|
|
1032
1087
|
if (item.filterDropdown !== false)
|
|
1033
1088
|
item.filterDropdown = ({
|
|
1034
1089
|
setSelectedKeys,
|
|
1035
1090
|
selectedKeys,
|
|
1036
1091
|
confirm
|
|
1037
|
-
}) => /* @__PURE__ */
|
|
1092
|
+
}) => /* @__PURE__ */ jsxs5(Radio.Group, {
|
|
1038
1093
|
style: { padding: 8 },
|
|
1039
1094
|
buttonStyle: "solid",
|
|
1040
1095
|
value: selectedKeys[0],
|
|
@@ -1044,7 +1099,7 @@ function Table(props) {
|
|
|
1044
1099
|
},
|
|
1045
1100
|
children: [
|
|
1046
1101
|
/* @__PURE__ */ jsx11(Radio.Button, {
|
|
1047
|
-
children:
|
|
1102
|
+
children: common2.all
|
|
1048
1103
|
}),
|
|
1049
1104
|
/* @__PURE__ */ jsx11(Radio.Button, {
|
|
1050
1105
|
value: "true",
|
|
@@ -1066,7 +1121,7 @@ function Table(props) {
|
|
|
1066
1121
|
}),
|
|
1067
1122
|
/* @__PURE__ */ jsx11(Radio.Button, {
|
|
1068
1123
|
value: "empty",
|
|
1069
|
-
children:
|
|
1124
|
+
children: common2.blank
|
|
1070
1125
|
})
|
|
1071
1126
|
]
|
|
1072
1127
|
});
|
|
@@ -1085,21 +1140,24 @@ function Table(props) {
|
|
|
1085
1140
|
};
|
|
1086
1141
|
break;
|
|
1087
1142
|
case "date":
|
|
1088
|
-
item.render
|
|
1143
|
+
if (!item.render)
|
|
1144
|
+
item.render = (value) => processValue(item, value);
|
|
1089
1145
|
if (!item.onFilter)
|
|
1090
1146
|
item.onFilter = (value, row) => dayjs3(row[item.id]).isSame(dayjs3(value));
|
|
1091
1147
|
if (!item.sorter)
|
|
1092
1148
|
item.sorter = (a, b) => dayjs3(a[item.id]).isBefore(b[item.id]) ? -1 : 1;
|
|
1093
1149
|
break;
|
|
1094
1150
|
case "time":
|
|
1095
|
-
item.render
|
|
1151
|
+
if (!item.render)
|
|
1152
|
+
item.render = (value) => processValue(item, value);
|
|
1096
1153
|
if (!item.onFilter)
|
|
1097
1154
|
item.onFilter = (value, row) => dayjs3(row[item.id]).isSame(dayjs3(value));
|
|
1098
1155
|
if (!item.sorter)
|
|
1099
1156
|
item.sorter = (a, b) => dayjs3(a[item.id]).isBefore(b[item.id]) ? -1 : 1;
|
|
1100
1157
|
break;
|
|
1101
1158
|
default:
|
|
1102
|
-
item.render
|
|
1159
|
+
if (!item.render)
|
|
1160
|
+
item.render = (value) => processValue(item, value);
|
|
1103
1161
|
if (!item.onFilter)
|
|
1104
1162
|
item.onFilter = (value, row) => value === row[item.id];
|
|
1105
1163
|
break;
|
|
@@ -1107,6 +1165,23 @@ function Table(props) {
|
|
|
1107
1165
|
}
|
|
1108
1166
|
setColumns(props.items);
|
|
1109
1167
|
}, [props.items]);
|
|
1168
|
+
useEffect5(() => {
|
|
1169
|
+
if (!props.dataSource || !columns)
|
|
1170
|
+
return;
|
|
1171
|
+
for (const column of columns) {
|
|
1172
|
+
if (column.optionsType === "auto" && !column.options && !column.filters) {
|
|
1173
|
+
setColumns((prev) => {
|
|
1174
|
+
const newColumns = [...prev];
|
|
1175
|
+
const index = newColumns.findIndex((item) => item.id === column.id);
|
|
1176
|
+
newColumns[index].filters = uniqBy(props.dataSource, column.id).map((v) => ({
|
|
1177
|
+
text: v[column.id],
|
|
1178
|
+
value: v[column.id]
|
|
1179
|
+
}));
|
|
1180
|
+
return newColumns;
|
|
1181
|
+
});
|
|
1182
|
+
}
|
|
1183
|
+
}
|
|
1184
|
+
}, [props.dataSource, columns]);
|
|
1110
1185
|
if (!columns)
|
|
1111
1186
|
return null;
|
|
1112
1187
|
if (!props.faasData)
|
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.417",
|
|
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.417",
|
|
32
32
|
"react-router-dom": "*",
|
|
33
33
|
"dayjs": "*"
|
|
34
34
|
},
|