@faasjs/ant-design 0.0.2-beta.449 → 0.0.2-beta.451
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.js +11 -32
- package/dist/index.mjs +11 -32
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -157,12 +157,12 @@ function transferOptions(options) {
|
|
|
157
157
|
});
|
|
158
158
|
}
|
|
159
159
|
function transferValue(type, value) {
|
|
160
|
-
if (typeof value === "undefined" || value === null || value === "" || value === "null" || value === "undefined"
|
|
160
|
+
if (typeof value === "undefined" || value === null || value === "" || value === "null" || value === "undefined")
|
|
161
161
|
return null;
|
|
162
162
|
if (!type)
|
|
163
163
|
type = "string";
|
|
164
164
|
if (type.endsWith("[]") && typeof value === "string")
|
|
165
|
-
value = value.split(",");
|
|
165
|
+
value = value.split(",").filter(Boolean);
|
|
166
166
|
if (["date", "time"].includes(type)) {
|
|
167
167
|
if (typeof value === "number" && value.toString().length === 10)
|
|
168
168
|
value = value * 1e3;
|
|
@@ -237,7 +237,7 @@ function DescriptionItemContent(props) {
|
|
|
237
237
|
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_jsx_runtime3.Fragment, {
|
|
238
238
|
children: computedProps.item.render(computedProps.value, computedProps.values)
|
|
239
239
|
});
|
|
240
|
-
if (computedProps.value === null)
|
|
240
|
+
if (computedProps.value === null || Array.isArray(computedProps.value) && !computedProps.value.length)
|
|
241
241
|
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Blank, {});
|
|
242
242
|
switch (computedProps.item.type) {
|
|
243
243
|
case "string[]":
|
|
@@ -383,7 +383,6 @@ var TimePicker = (0, import_react6.forwardRef)((props, ref) => {
|
|
|
383
383
|
TimePicker.displayName = "TimePicker";
|
|
384
384
|
|
|
385
385
|
// src/FormItem.tsx
|
|
386
|
-
var import_dayjs4 = __toESM(require("dayjs"));
|
|
387
386
|
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
388
387
|
function processProps(propsCopy, config) {
|
|
389
388
|
if (!propsCopy.title)
|
|
@@ -431,26 +430,6 @@ function processProps(propsCopy, config) {
|
|
|
431
430
|
}
|
|
432
431
|
return propsCopy;
|
|
433
432
|
}
|
|
434
|
-
function DateItem(options) {
|
|
435
|
-
const [value, setValue] = (0, import_react7.useState)();
|
|
436
|
-
(0, import_react7.useEffect)(() => {
|
|
437
|
-
setValue(options.value && !(0, import_dayjs4.isDayjs)(options.value) ? (0, import_dayjs4.default)(options.value) : null);
|
|
438
|
-
}, [options.value]);
|
|
439
|
-
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(DatePicker, {
|
|
440
|
-
...options,
|
|
441
|
-
value
|
|
442
|
-
});
|
|
443
|
-
}
|
|
444
|
-
function TimeItem(options) {
|
|
445
|
-
const [value, setValue] = (0, import_react7.useState)();
|
|
446
|
-
(0, import_react7.useEffect)(() => {
|
|
447
|
-
setValue(options.value && !(0, import_dayjs4.isDayjs)(options.value) ? (0, import_dayjs4.default)(options.value) : null);
|
|
448
|
-
}, [options.value]);
|
|
449
|
-
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(TimePicker, {
|
|
450
|
-
...options,
|
|
451
|
-
value
|
|
452
|
-
});
|
|
453
|
-
}
|
|
454
433
|
function FormItem(props) {
|
|
455
434
|
var _a;
|
|
456
435
|
const [computedProps, setComputedProps] = (0, import_react7.useState)();
|
|
@@ -654,14 +633,14 @@ function FormItem(props) {
|
|
|
654
633
|
case "date":
|
|
655
634
|
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_antd5.Form.Item, {
|
|
656
635
|
...computedProps,
|
|
657
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
636
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(DatePicker, {
|
|
658
637
|
...computedProps.input
|
|
659
638
|
})
|
|
660
639
|
});
|
|
661
640
|
case "time":
|
|
662
641
|
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_antd5.Form.Item, {
|
|
663
642
|
...computedProps,
|
|
664
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
643
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(TimePicker, {
|
|
665
644
|
...computedProps.input
|
|
666
645
|
})
|
|
667
646
|
});
|
|
@@ -983,7 +962,7 @@ function Routes(props) {
|
|
|
983
962
|
// src/Table.tsx
|
|
984
963
|
var import_react12 = require("react");
|
|
985
964
|
var import_antd10 = require("antd");
|
|
986
|
-
var
|
|
965
|
+
var import_dayjs4 = __toESM(require("dayjs"));
|
|
987
966
|
var import_icons3 = require("@ant-design/icons");
|
|
988
967
|
var import_lodash6 = require("lodash");
|
|
989
968
|
var import_react13 = require("@faasjs/react");
|
|
@@ -991,7 +970,7 @@ var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
|
991
970
|
function processValue(item, value) {
|
|
992
971
|
var _a;
|
|
993
972
|
const transferred = transferValue(item.type, value);
|
|
994
|
-
if (transferred === null)
|
|
973
|
+
if (transferred === null || Array.isArray(transferred) && transferred.length === 0)
|
|
995
974
|
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Blank, {});
|
|
996
975
|
if (item.options) {
|
|
997
976
|
if (item.type.endsWith("[]"))
|
|
@@ -1229,17 +1208,17 @@ function Table(props) {
|
|
|
1229
1208
|
if (!item.render)
|
|
1230
1209
|
item.render = (value) => processValue(item, value);
|
|
1231
1210
|
if (!item.onFilter)
|
|
1232
|
-
item.onFilter = (value, row) => (0,
|
|
1211
|
+
item.onFilter = (value, row) => (0, import_dayjs4.default)(row[item.id]).isSame((0, import_dayjs4.default)(value));
|
|
1233
1212
|
if (!item.sorter)
|
|
1234
|
-
item.sorter = (a, b) => (0,
|
|
1213
|
+
item.sorter = (a, b) => (0, import_dayjs4.default)(a[item.id]).isBefore(b[item.id]) ? -1 : 1;
|
|
1235
1214
|
break;
|
|
1236
1215
|
case "time":
|
|
1237
1216
|
if (!item.render)
|
|
1238
1217
|
item.render = (value) => processValue(item, value);
|
|
1239
1218
|
if (!item.onFilter)
|
|
1240
|
-
item.onFilter = (value, row) => (0,
|
|
1219
|
+
item.onFilter = (value, row) => (0, import_dayjs4.default)(row[item.id]).isSame((0, import_dayjs4.default)(value));
|
|
1241
1220
|
if (!item.sorter)
|
|
1242
|
-
item.sorter = (a, b) => (0,
|
|
1221
|
+
item.sorter = (a, b) => (0, import_dayjs4.default)(a[item.id]).isBefore(b[item.id]) ? -1 : 1;
|
|
1243
1222
|
break;
|
|
1244
1223
|
case "object":
|
|
1245
1224
|
if (!item.render)
|
package/dist/index.mjs
CHANGED
|
@@ -110,12 +110,12 @@ function transferOptions(options) {
|
|
|
110
110
|
});
|
|
111
111
|
}
|
|
112
112
|
function transferValue(type, value) {
|
|
113
|
-
if (typeof value === "undefined" || value === null || value === "" || value === "null" || value === "undefined"
|
|
113
|
+
if (typeof value === "undefined" || value === null || value === "" || value === "null" || value === "undefined")
|
|
114
114
|
return null;
|
|
115
115
|
if (!type)
|
|
116
116
|
type = "string";
|
|
117
117
|
if (type.endsWith("[]") && typeof value === "string")
|
|
118
|
-
value = value.split(",");
|
|
118
|
+
value = value.split(",").filter(Boolean);
|
|
119
119
|
if (["date", "time"].includes(type)) {
|
|
120
120
|
if (typeof value === "number" && value.toString().length === 10)
|
|
121
121
|
value = value * 1e3;
|
|
@@ -198,7 +198,7 @@ function DescriptionItemContent(props) {
|
|
|
198
198
|
return /* @__PURE__ */ jsx3(Fragment, {
|
|
199
199
|
children: computedProps.item.render(computedProps.value, computedProps.values)
|
|
200
200
|
});
|
|
201
|
-
if (computedProps.value === null)
|
|
201
|
+
if (computedProps.value === null || Array.isArray(computedProps.value) && !computedProps.value.length)
|
|
202
202
|
return /* @__PURE__ */ jsx3(Blank, {});
|
|
203
203
|
switch (computedProps.item.type) {
|
|
204
204
|
case "string[]":
|
|
@@ -363,7 +363,6 @@ var TimePicker = forwardRef((props, ref) => {
|
|
|
363
363
|
TimePicker.displayName = "TimePicker";
|
|
364
364
|
|
|
365
365
|
// src/FormItem.tsx
|
|
366
|
-
import dayjs2, { isDayjs } from "dayjs";
|
|
367
366
|
import { Fragment as Fragment2, jsx as jsx6, jsxs } from "react/jsx-runtime";
|
|
368
367
|
function processProps(propsCopy, config) {
|
|
369
368
|
if (!propsCopy.title)
|
|
@@ -411,26 +410,6 @@ function processProps(propsCopy, config) {
|
|
|
411
410
|
}
|
|
412
411
|
return propsCopy;
|
|
413
412
|
}
|
|
414
|
-
function DateItem(options) {
|
|
415
|
-
const [value, setValue] = useState4();
|
|
416
|
-
useEffect3(() => {
|
|
417
|
-
setValue(options.value && !isDayjs(options.value) ? dayjs2(options.value) : null);
|
|
418
|
-
}, [options.value]);
|
|
419
|
-
return /* @__PURE__ */ jsx6(DatePicker, {
|
|
420
|
-
...options,
|
|
421
|
-
value
|
|
422
|
-
});
|
|
423
|
-
}
|
|
424
|
-
function TimeItem(options) {
|
|
425
|
-
const [value, setValue] = useState4();
|
|
426
|
-
useEffect3(() => {
|
|
427
|
-
setValue(options.value && !isDayjs(options.value) ? dayjs2(options.value) : null);
|
|
428
|
-
}, [options.value]);
|
|
429
|
-
return /* @__PURE__ */ jsx6(TimePicker, {
|
|
430
|
-
...options,
|
|
431
|
-
value
|
|
432
|
-
});
|
|
433
|
-
}
|
|
434
413
|
function FormItem(props) {
|
|
435
414
|
var _a;
|
|
436
415
|
const [computedProps, setComputedProps] = useState4();
|
|
@@ -634,14 +613,14 @@ function FormItem(props) {
|
|
|
634
613
|
case "date":
|
|
635
614
|
return /* @__PURE__ */ jsx6(AntdForm.Item, {
|
|
636
615
|
...computedProps,
|
|
637
|
-
children: /* @__PURE__ */ jsx6(
|
|
616
|
+
children: /* @__PURE__ */ jsx6(DatePicker, {
|
|
638
617
|
...computedProps.input
|
|
639
618
|
})
|
|
640
619
|
});
|
|
641
620
|
case "time":
|
|
642
621
|
return /* @__PURE__ */ jsx6(AntdForm.Item, {
|
|
643
622
|
...computedProps,
|
|
644
|
-
children: /* @__PURE__ */ jsx6(
|
|
623
|
+
children: /* @__PURE__ */ jsx6(TimePicker, {
|
|
645
624
|
...computedProps.input
|
|
646
625
|
})
|
|
647
626
|
});
|
|
@@ -977,7 +956,7 @@ import {
|
|
|
977
956
|
Skeleton as Skeleton3,
|
|
978
957
|
Input as Input2
|
|
979
958
|
} from "antd";
|
|
980
|
-
import
|
|
959
|
+
import dayjs2 from "dayjs";
|
|
981
960
|
import { CheckOutlined as CheckOutlined2, CloseOutlined as CloseOutlined2 } from "@ant-design/icons";
|
|
982
961
|
import {
|
|
983
962
|
isNil as isNil2,
|
|
@@ -989,7 +968,7 @@ import { jsx as jsx11, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
|
989
968
|
function processValue(item, value) {
|
|
990
969
|
var _a;
|
|
991
970
|
const transferred = transferValue(item.type, value);
|
|
992
|
-
if (transferred === null)
|
|
971
|
+
if (transferred === null || Array.isArray(transferred) && transferred.length === 0)
|
|
993
972
|
return /* @__PURE__ */ jsx11(Blank, {});
|
|
994
973
|
if (item.options) {
|
|
995
974
|
if (item.type.endsWith("[]"))
|
|
@@ -1227,17 +1206,17 @@ function Table(props) {
|
|
|
1227
1206
|
if (!item.render)
|
|
1228
1207
|
item.render = (value) => processValue(item, value);
|
|
1229
1208
|
if (!item.onFilter)
|
|
1230
|
-
item.onFilter = (value, row) =>
|
|
1209
|
+
item.onFilter = (value, row) => dayjs2(row[item.id]).isSame(dayjs2(value));
|
|
1231
1210
|
if (!item.sorter)
|
|
1232
|
-
item.sorter = (a, b) =>
|
|
1211
|
+
item.sorter = (a, b) => dayjs2(a[item.id]).isBefore(b[item.id]) ? -1 : 1;
|
|
1233
1212
|
break;
|
|
1234
1213
|
case "time":
|
|
1235
1214
|
if (!item.render)
|
|
1236
1215
|
item.render = (value) => processValue(item, value);
|
|
1237
1216
|
if (!item.onFilter)
|
|
1238
|
-
item.onFilter = (value, row) =>
|
|
1217
|
+
item.onFilter = (value, row) => dayjs2(row[item.id]).isSame(dayjs2(value));
|
|
1239
1218
|
if (!item.sorter)
|
|
1240
|
-
item.sorter = (a, b) =>
|
|
1219
|
+
item.sorter = (a, b) => dayjs2(a[item.id]).isBefore(b[item.id]) ? -1 : 1;
|
|
1241
1220
|
break;
|
|
1242
1221
|
case "object":
|
|
1243
1222
|
if (!item.render)
|
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.451",
|
|
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.451",
|
|
32
32
|
"react-router-dom": "*",
|
|
33
33
|
"dayjs": "*"
|
|
34
34
|
},
|