@faasjs/ant-design 0.0.4-beta.11 → 0.0.4-beta.13
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.mts +5 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +155 -152
- package/dist/index.mjs +155 -152
- package/package.json +3 -3
package/dist/index.d.mts
CHANGED
|
@@ -316,6 +316,11 @@ type TableProps<T = any, ExtendTypes = any> = {
|
|
|
316
316
|
/**
|
|
317
317
|
* Table component with Ant Design & FaasJS
|
|
318
318
|
*
|
|
319
|
+
* - Support all Ant Design Table props.
|
|
320
|
+
* - Support FaasJS injection.
|
|
321
|
+
* - Auto generate filter dropdown (disable with `filterDropdown: false`).
|
|
322
|
+
* - Auto generate sorter (disable with `sorter: false`).
|
|
323
|
+
*
|
|
319
324
|
* @ref https://ant.design/components/table/
|
|
320
325
|
*/
|
|
321
326
|
declare function Table<T extends Record<string, any>, ExtendTypes = any>(props: TableProps<T, ExtendTypes>): react_jsx_runtime.JSX.Element;
|
package/dist/index.d.ts
CHANGED
|
@@ -316,6 +316,11 @@ type TableProps<T = any, ExtendTypes = any> = {
|
|
|
316
316
|
/**
|
|
317
317
|
* Table component with Ant Design & FaasJS
|
|
318
318
|
*
|
|
319
|
+
* - Support all Ant Design Table props.
|
|
320
|
+
* - Support FaasJS injection.
|
|
321
|
+
* - Auto generate filter dropdown (disable with `filterDropdown: false`).
|
|
322
|
+
* - Auto generate sorter (disable with `sorter: false`).
|
|
323
|
+
*
|
|
319
324
|
* @ref https://ant.design/components/table/
|
|
320
325
|
*/
|
|
321
326
|
declare function Table<T extends Record<string, any>, ExtendTypes = any>(props: TableProps<T, ExtendTypes>): react_jsx_runtime.JSX.Element;
|
package/dist/index.js
CHANGED
|
@@ -1088,146 +1088,146 @@ function Table(props) {
|
|
|
1088
1088
|
case "string":
|
|
1089
1089
|
if (!item.render)
|
|
1090
1090
|
item.render = (value) => processValue(item, value);
|
|
1091
|
-
if (
|
|
1092
|
-
item.onFilter
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1091
|
+
if (typeof item.filterDropdown === "undefined") {
|
|
1092
|
+
if (!item.onFilter)
|
|
1093
|
+
item.onFilter = (value, row) => {
|
|
1094
|
+
if (!value || lodashEs.isNil(value))
|
|
1095
|
+
return true;
|
|
1096
|
+
if (lodashEs.isNil(row[item.id]))
|
|
1097
|
+
return false;
|
|
1098
|
+
return row[item.id].trim().toLowerCase().includes(value.trim().toLowerCase());
|
|
1099
|
+
};
|
|
1100
|
+
if (!item.filters && item.optionsType !== "auto")
|
|
1101
|
+
item.filterDropdown = ({
|
|
1102
|
+
setSelectedKeys,
|
|
1103
|
+
confirm,
|
|
1104
|
+
clearFilters
|
|
1105
|
+
}) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1106
|
+
antd.Input.Search,
|
|
1107
|
+
{
|
|
1108
|
+
placeholder: `${common2.search} ${item.title}`,
|
|
1109
|
+
allowClear: true,
|
|
1110
|
+
onSearch: (v) => {
|
|
1111
|
+
if (v) {
|
|
1112
|
+
setSelectedKeys([v]);
|
|
1113
|
+
} else {
|
|
1114
|
+
setSelectedKeys([]);
|
|
1115
|
+
clearFilters();
|
|
1116
|
+
}
|
|
1117
|
+
confirm();
|
|
1117
1118
|
}
|
|
1118
|
-
confirm();
|
|
1119
1119
|
}
|
|
1120
|
-
|
|
1121
|
-
|
|
1120
|
+
);
|
|
1121
|
+
}
|
|
1122
1122
|
break;
|
|
1123
1123
|
case "string[]":
|
|
1124
1124
|
if (!item.render)
|
|
1125
1125
|
item.render = (value) => processValue(item, value);
|
|
1126
|
-
if (
|
|
1127
|
-
item.onFilter
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1126
|
+
if (typeof item.filterDropdown === "undefined") {
|
|
1127
|
+
if (!item.onFilter)
|
|
1128
|
+
item.onFilter = (value, row) => {
|
|
1129
|
+
if (value === null && (!row[item.id] || !row[item.id].length))
|
|
1130
|
+
return true;
|
|
1131
|
+
if (!row[item.id] || !row[item.id].length || !value)
|
|
1132
|
+
return false;
|
|
1133
|
+
return row[item.id].some(
|
|
1134
|
+
(v) => v.trim().toLowerCase().includes(value.trim().toLowerCase())
|
|
1135
|
+
);
|
|
1136
|
+
};
|
|
1137
|
+
if (!item.filters && item.optionsType !== "auto")
|
|
1138
|
+
item.filterDropdown = ({
|
|
1139
|
+
setSelectedKeys,
|
|
1140
|
+
confirm,
|
|
1141
|
+
clearFilters
|
|
1142
|
+
}) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1143
|
+
antd.Input.Search,
|
|
1144
|
+
{
|
|
1145
|
+
placeholder: `${common2.search} ${item.title}`,
|
|
1146
|
+
allowClear: true,
|
|
1147
|
+
onSearch: (v) => {
|
|
1148
|
+
if (v) {
|
|
1149
|
+
setSelectedKeys([v]);
|
|
1150
|
+
} else {
|
|
1151
|
+
setSelectedKeys([]);
|
|
1152
|
+
clearFilters();
|
|
1153
|
+
}
|
|
1154
|
+
confirm();
|
|
1154
1155
|
}
|
|
1155
|
-
confirm();
|
|
1156
1156
|
}
|
|
1157
|
-
|
|
1158
|
-
|
|
1157
|
+
);
|
|
1158
|
+
}
|
|
1159
1159
|
break;
|
|
1160
1160
|
case "number":
|
|
1161
1161
|
if (!item.render)
|
|
1162
1162
|
item.render = (value) => processValue(item, value);
|
|
1163
|
-
if (
|
|
1163
|
+
if (typeof item.sorter === "undefined")
|
|
1164
1164
|
item.sorter = (a, b) => a[item.id] - b[item.id];
|
|
1165
|
-
if (
|
|
1166
|
-
item.onFilter
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1165
|
+
if (typeof item.filterDropdown === "undefined") {
|
|
1166
|
+
if (!item.onFilter)
|
|
1167
|
+
item.onFilter = (value, row) => {
|
|
1168
|
+
if (value === null)
|
|
1169
|
+
return true;
|
|
1170
|
+
if (lodashEs.isNil(row[item.id]))
|
|
1171
|
+
return false;
|
|
1172
|
+
return value == row[item.id];
|
|
1173
|
+
};
|
|
1174
|
+
if (!item.filters)
|
|
1175
|
+
item.filterDropdown = ({
|
|
1176
|
+
setSelectedKeys,
|
|
1177
|
+
confirm,
|
|
1178
|
+
clearFilters
|
|
1179
|
+
}) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1180
|
+
antd.Input.Search,
|
|
1181
|
+
{
|
|
1182
|
+
placeholder: `${common2.search} ${item.title}`,
|
|
1183
|
+
allowClear: true,
|
|
1184
|
+
onSearch: (v) => {
|
|
1185
|
+
if (v) {
|
|
1186
|
+
setSelectedKeys([Number(v)]);
|
|
1187
|
+
} else {
|
|
1188
|
+
setSelectedKeys([]);
|
|
1189
|
+
clearFilters();
|
|
1190
|
+
}
|
|
1191
|
+
confirm();
|
|
1191
1192
|
}
|
|
1192
|
-
confirm();
|
|
1193
1193
|
}
|
|
1194
|
-
|
|
1195
|
-
|
|
1194
|
+
);
|
|
1195
|
+
}
|
|
1196
1196
|
break;
|
|
1197
1197
|
case "number[]":
|
|
1198
1198
|
if (!item.render)
|
|
1199
1199
|
item.render = (value) => processValue(item, value).join(", ");
|
|
1200
|
-
if (
|
|
1201
|
-
item.onFilter
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1200
|
+
if (typeof item.filterDropdown === "undefined") {
|
|
1201
|
+
if (!item.onFilter)
|
|
1202
|
+
item.onFilter = (value, row) => {
|
|
1203
|
+
if (value === null && (!row[item.id] || !row[item.id].length))
|
|
1204
|
+
return true;
|
|
1205
|
+
if (!row[item.id] || !row[item.id].length)
|
|
1206
|
+
return false;
|
|
1207
|
+
return row[item.id].includes(Number(value));
|
|
1208
|
+
};
|
|
1209
|
+
if (!item.filters)
|
|
1210
|
+
item.filterDropdown = ({
|
|
1211
|
+
setSelectedKeys,
|
|
1212
|
+
confirm,
|
|
1213
|
+
clearFilters
|
|
1214
|
+
}) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1215
|
+
antd.Input.Search,
|
|
1216
|
+
{
|
|
1217
|
+
placeholder: `${common2.search} ${item.title}`,
|
|
1218
|
+
allowClear: true,
|
|
1219
|
+
onSearch: (v) => {
|
|
1220
|
+
if (v) {
|
|
1221
|
+
setSelectedKeys([Number(v)]);
|
|
1222
|
+
} else {
|
|
1223
|
+
setSelectedKeys([]);
|
|
1224
|
+
clearFilters();
|
|
1225
|
+
}
|
|
1226
|
+
confirm();
|
|
1226
1227
|
}
|
|
1227
|
-
confirm();
|
|
1228
1228
|
}
|
|
1229
|
-
|
|
1230
|
-
|
|
1229
|
+
);
|
|
1230
|
+
}
|
|
1231
1231
|
break;
|
|
1232
1232
|
case "boolean":
|
|
1233
1233
|
if (!item.render)
|
|
@@ -1248,7 +1248,7 @@ function Table(props) {
|
|
|
1248
1248
|
}
|
|
1249
1249
|
}
|
|
1250
1250
|
);
|
|
1251
|
-
if (item.filterDropdown
|
|
1251
|
+
if (typeof item.filterDropdown === "undefined") {
|
|
1252
1252
|
item.filterDropdown = ({
|
|
1253
1253
|
setSelectedKeys,
|
|
1254
1254
|
selectedKeys,
|
|
@@ -1294,22 +1294,23 @@ function Table(props) {
|
|
|
1294
1294
|
]
|
|
1295
1295
|
}
|
|
1296
1296
|
);
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1297
|
+
if (!item.onFilter)
|
|
1298
|
+
item.onFilter = (value, row) => {
|
|
1299
|
+
switch (value) {
|
|
1300
|
+
case true:
|
|
1301
|
+
return !lodashEs.isNil(row[item.id]) && row[item.id] !== false;
|
|
1302
|
+
case false:
|
|
1303
|
+
return !lodashEs.isNil(row[item.id]) && !row[item.id];
|
|
1304
|
+
default:
|
|
1305
|
+
return lodashEs.isNil(row[item.id]);
|
|
1306
|
+
}
|
|
1307
|
+
};
|
|
1308
|
+
}
|
|
1308
1309
|
break;
|
|
1309
1310
|
case "date":
|
|
1310
1311
|
if (!item.render)
|
|
1311
1312
|
item.render = (value) => processValue(item, value);
|
|
1312
|
-
if (
|
|
1313
|
+
if (typeof item.sorter === "undefined")
|
|
1313
1314
|
item.sorter = (a, b, order) => {
|
|
1314
1315
|
if (lodashEs.isNil(a[item.id]))
|
|
1315
1316
|
return order === "ascend" ? 1 : -1;
|
|
@@ -1317,7 +1318,7 @@ function Table(props) {
|
|
|
1317
1318
|
return order === "ascend" ? -1 : 1;
|
|
1318
1319
|
return new Date(a[item.id]).getTime() < new Date(b[item.id]).getTime() ? -1 : 1;
|
|
1319
1320
|
};
|
|
1320
|
-
if (
|
|
1321
|
+
if (typeof item.filterDropdown === "undefined") {
|
|
1321
1322
|
item.filterDropdown = ({ setSelectedKeys, confirm }) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1322
1323
|
antd.DatePicker.RangePicker,
|
|
1323
1324
|
{
|
|
@@ -1334,19 +1335,20 @@ function Table(props) {
|
|
|
1334
1335
|
}
|
|
1335
1336
|
}
|
|
1336
1337
|
);
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1338
|
+
if (!item.onFilter)
|
|
1339
|
+
item.onFilter = (value, row) => {
|
|
1340
|
+
if (lodashEs.isNil(value[0]))
|
|
1341
|
+
return true;
|
|
1342
|
+
if (lodashEs.isNil(row[item.id]))
|
|
1343
|
+
return false;
|
|
1344
|
+
return dayjs2__default.default(row[item.id]) >= dayjs2__default.default(value[0]) && dayjs2__default.default(row[item.id]) <= dayjs2__default.default(value[1]);
|
|
1345
|
+
};
|
|
1346
|
+
}
|
|
1345
1347
|
break;
|
|
1346
1348
|
case "time":
|
|
1347
1349
|
if (!item.render)
|
|
1348
1350
|
item.render = (value) => processValue(item, value);
|
|
1349
|
-
if (
|
|
1351
|
+
if (typeof item.sorter === "undefined")
|
|
1350
1352
|
item.sorter = (a, b, order) => {
|
|
1351
1353
|
if (lodashEs.isNil(a[item.id]))
|
|
1352
1354
|
return order === "ascend" ? 1 : -1;
|
|
@@ -1354,7 +1356,7 @@ function Table(props) {
|
|
|
1354
1356
|
return order === "ascend" ? -1 : 1;
|
|
1355
1357
|
return new Date(a[item.id]).getTime() < new Date(b[item.id]).getTime() ? -1 : 1;
|
|
1356
1358
|
};
|
|
1357
|
-
if (
|
|
1359
|
+
if (typeof item.filterDropdown === "undefined") {
|
|
1358
1360
|
item.filterDropdown = ({ setSelectedKeys, confirm }) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1359
1361
|
antd.DatePicker.RangePicker,
|
|
1360
1362
|
{
|
|
@@ -1371,14 +1373,15 @@ function Table(props) {
|
|
|
1371
1373
|
}
|
|
1372
1374
|
}
|
|
1373
1375
|
);
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1376
|
+
if (!item.onFilter)
|
|
1377
|
+
item.onFilter = (value, row) => {
|
|
1378
|
+
if (lodashEs.isNil(value[0]))
|
|
1379
|
+
return true;
|
|
1380
|
+
if (lodashEs.isNil(row[item.id]))
|
|
1381
|
+
return false;
|
|
1382
|
+
return dayjs2__default.default(row[item.id]) >= dayjs2__default.default(value[0]) && dayjs2__default.default(row[item.id]) <= dayjs2__default.default(value[1]);
|
|
1383
|
+
};
|
|
1384
|
+
}
|
|
1382
1385
|
break;
|
|
1383
1386
|
case "object":
|
|
1384
1387
|
if (!item.render)
|
|
@@ -1406,7 +1409,7 @@ function Table(props) {
|
|
|
1406
1409
|
default:
|
|
1407
1410
|
if (!item.render)
|
|
1408
1411
|
item.render = (value) => processValue(item, value);
|
|
1409
|
-
if (!item.onFilter)
|
|
1412
|
+
if (typeof item.filterDropdown === "undefined" && !item.onFilter)
|
|
1410
1413
|
item.onFilter = (value, row) => {
|
|
1411
1414
|
if (value === null && lodashEs.isNil(row[item.id]))
|
|
1412
1415
|
return true;
|
package/dist/index.mjs
CHANGED
|
@@ -1085,146 +1085,146 @@ function Table(props) {
|
|
|
1085
1085
|
case "string":
|
|
1086
1086
|
if (!item.render)
|
|
1087
1087
|
item.render = (value) => processValue(item, value);
|
|
1088
|
-
if (
|
|
1089
|
-
item.onFilter
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1088
|
+
if (typeof item.filterDropdown === "undefined") {
|
|
1089
|
+
if (!item.onFilter)
|
|
1090
|
+
item.onFilter = (value, row) => {
|
|
1091
|
+
if (!value || isNil(value))
|
|
1092
|
+
return true;
|
|
1093
|
+
if (isNil(row[item.id]))
|
|
1094
|
+
return false;
|
|
1095
|
+
return row[item.id].trim().toLowerCase().includes(value.trim().toLowerCase());
|
|
1096
|
+
};
|
|
1097
|
+
if (!item.filters && item.optionsType !== "auto")
|
|
1098
|
+
item.filterDropdown = ({
|
|
1099
|
+
setSelectedKeys,
|
|
1100
|
+
confirm,
|
|
1101
|
+
clearFilters
|
|
1102
|
+
}) => /* @__PURE__ */ jsx(
|
|
1103
|
+
Input.Search,
|
|
1104
|
+
{
|
|
1105
|
+
placeholder: `${common2.search} ${item.title}`,
|
|
1106
|
+
allowClear: true,
|
|
1107
|
+
onSearch: (v) => {
|
|
1108
|
+
if (v) {
|
|
1109
|
+
setSelectedKeys([v]);
|
|
1110
|
+
} else {
|
|
1111
|
+
setSelectedKeys([]);
|
|
1112
|
+
clearFilters();
|
|
1113
|
+
}
|
|
1114
|
+
confirm();
|
|
1114
1115
|
}
|
|
1115
|
-
confirm();
|
|
1116
1116
|
}
|
|
1117
|
-
|
|
1118
|
-
|
|
1117
|
+
);
|
|
1118
|
+
}
|
|
1119
1119
|
break;
|
|
1120
1120
|
case "string[]":
|
|
1121
1121
|
if (!item.render)
|
|
1122
1122
|
item.render = (value) => processValue(item, value);
|
|
1123
|
-
if (
|
|
1124
|
-
item.onFilter
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1123
|
+
if (typeof item.filterDropdown === "undefined") {
|
|
1124
|
+
if (!item.onFilter)
|
|
1125
|
+
item.onFilter = (value, row) => {
|
|
1126
|
+
if (value === null && (!row[item.id] || !row[item.id].length))
|
|
1127
|
+
return true;
|
|
1128
|
+
if (!row[item.id] || !row[item.id].length || !value)
|
|
1129
|
+
return false;
|
|
1130
|
+
return row[item.id].some(
|
|
1131
|
+
(v) => v.trim().toLowerCase().includes(value.trim().toLowerCase())
|
|
1132
|
+
);
|
|
1133
|
+
};
|
|
1134
|
+
if (!item.filters && item.optionsType !== "auto")
|
|
1135
|
+
item.filterDropdown = ({
|
|
1136
|
+
setSelectedKeys,
|
|
1137
|
+
confirm,
|
|
1138
|
+
clearFilters
|
|
1139
|
+
}) => /* @__PURE__ */ jsx(
|
|
1140
|
+
Input.Search,
|
|
1141
|
+
{
|
|
1142
|
+
placeholder: `${common2.search} ${item.title}`,
|
|
1143
|
+
allowClear: true,
|
|
1144
|
+
onSearch: (v) => {
|
|
1145
|
+
if (v) {
|
|
1146
|
+
setSelectedKeys([v]);
|
|
1147
|
+
} else {
|
|
1148
|
+
setSelectedKeys([]);
|
|
1149
|
+
clearFilters();
|
|
1150
|
+
}
|
|
1151
|
+
confirm();
|
|
1151
1152
|
}
|
|
1152
|
-
confirm();
|
|
1153
1153
|
}
|
|
1154
|
-
|
|
1155
|
-
|
|
1154
|
+
);
|
|
1155
|
+
}
|
|
1156
1156
|
break;
|
|
1157
1157
|
case "number":
|
|
1158
1158
|
if (!item.render)
|
|
1159
1159
|
item.render = (value) => processValue(item, value);
|
|
1160
|
-
if (
|
|
1160
|
+
if (typeof item.sorter === "undefined")
|
|
1161
1161
|
item.sorter = (a, b) => a[item.id] - b[item.id];
|
|
1162
|
-
if (
|
|
1163
|
-
item.onFilter
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1162
|
+
if (typeof item.filterDropdown === "undefined") {
|
|
1163
|
+
if (!item.onFilter)
|
|
1164
|
+
item.onFilter = (value, row) => {
|
|
1165
|
+
if (value === null)
|
|
1166
|
+
return true;
|
|
1167
|
+
if (isNil(row[item.id]))
|
|
1168
|
+
return false;
|
|
1169
|
+
return value == row[item.id];
|
|
1170
|
+
};
|
|
1171
|
+
if (!item.filters)
|
|
1172
|
+
item.filterDropdown = ({
|
|
1173
|
+
setSelectedKeys,
|
|
1174
|
+
confirm,
|
|
1175
|
+
clearFilters
|
|
1176
|
+
}) => /* @__PURE__ */ jsx(
|
|
1177
|
+
Input.Search,
|
|
1178
|
+
{
|
|
1179
|
+
placeholder: `${common2.search} ${item.title}`,
|
|
1180
|
+
allowClear: true,
|
|
1181
|
+
onSearch: (v) => {
|
|
1182
|
+
if (v) {
|
|
1183
|
+
setSelectedKeys([Number(v)]);
|
|
1184
|
+
} else {
|
|
1185
|
+
setSelectedKeys([]);
|
|
1186
|
+
clearFilters();
|
|
1187
|
+
}
|
|
1188
|
+
confirm();
|
|
1188
1189
|
}
|
|
1189
|
-
confirm();
|
|
1190
1190
|
}
|
|
1191
|
-
|
|
1192
|
-
|
|
1191
|
+
);
|
|
1192
|
+
}
|
|
1193
1193
|
break;
|
|
1194
1194
|
case "number[]":
|
|
1195
1195
|
if (!item.render)
|
|
1196
1196
|
item.render = (value) => processValue(item, value).join(", ");
|
|
1197
|
-
if (
|
|
1198
|
-
item.onFilter
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1197
|
+
if (typeof item.filterDropdown === "undefined") {
|
|
1198
|
+
if (!item.onFilter)
|
|
1199
|
+
item.onFilter = (value, row) => {
|
|
1200
|
+
if (value === null && (!row[item.id] || !row[item.id].length))
|
|
1201
|
+
return true;
|
|
1202
|
+
if (!row[item.id] || !row[item.id].length)
|
|
1203
|
+
return false;
|
|
1204
|
+
return row[item.id].includes(Number(value));
|
|
1205
|
+
};
|
|
1206
|
+
if (!item.filters)
|
|
1207
|
+
item.filterDropdown = ({
|
|
1208
|
+
setSelectedKeys,
|
|
1209
|
+
confirm,
|
|
1210
|
+
clearFilters
|
|
1211
|
+
}) => /* @__PURE__ */ jsx(
|
|
1212
|
+
Input.Search,
|
|
1213
|
+
{
|
|
1214
|
+
placeholder: `${common2.search} ${item.title}`,
|
|
1215
|
+
allowClear: true,
|
|
1216
|
+
onSearch: (v) => {
|
|
1217
|
+
if (v) {
|
|
1218
|
+
setSelectedKeys([Number(v)]);
|
|
1219
|
+
} else {
|
|
1220
|
+
setSelectedKeys([]);
|
|
1221
|
+
clearFilters();
|
|
1222
|
+
}
|
|
1223
|
+
confirm();
|
|
1223
1224
|
}
|
|
1224
|
-
confirm();
|
|
1225
1225
|
}
|
|
1226
|
-
|
|
1227
|
-
|
|
1226
|
+
);
|
|
1227
|
+
}
|
|
1228
1228
|
break;
|
|
1229
1229
|
case "boolean":
|
|
1230
1230
|
if (!item.render)
|
|
@@ -1245,7 +1245,7 @@ function Table(props) {
|
|
|
1245
1245
|
}
|
|
1246
1246
|
}
|
|
1247
1247
|
);
|
|
1248
|
-
if (item.filterDropdown
|
|
1248
|
+
if (typeof item.filterDropdown === "undefined") {
|
|
1249
1249
|
item.filterDropdown = ({
|
|
1250
1250
|
setSelectedKeys,
|
|
1251
1251
|
selectedKeys,
|
|
@@ -1291,22 +1291,23 @@ function Table(props) {
|
|
|
1291
1291
|
]
|
|
1292
1292
|
}
|
|
1293
1293
|
);
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1294
|
+
if (!item.onFilter)
|
|
1295
|
+
item.onFilter = (value, row) => {
|
|
1296
|
+
switch (value) {
|
|
1297
|
+
case true:
|
|
1298
|
+
return !isNil(row[item.id]) && row[item.id] !== false;
|
|
1299
|
+
case false:
|
|
1300
|
+
return !isNil(row[item.id]) && !row[item.id];
|
|
1301
|
+
default:
|
|
1302
|
+
return isNil(row[item.id]);
|
|
1303
|
+
}
|
|
1304
|
+
};
|
|
1305
|
+
}
|
|
1305
1306
|
break;
|
|
1306
1307
|
case "date":
|
|
1307
1308
|
if (!item.render)
|
|
1308
1309
|
item.render = (value) => processValue(item, value);
|
|
1309
|
-
if (
|
|
1310
|
+
if (typeof item.sorter === "undefined")
|
|
1310
1311
|
item.sorter = (a, b, order) => {
|
|
1311
1312
|
if (isNil(a[item.id]))
|
|
1312
1313
|
return order === "ascend" ? 1 : -1;
|
|
@@ -1314,7 +1315,7 @@ function Table(props) {
|
|
|
1314
1315
|
return order === "ascend" ? -1 : 1;
|
|
1315
1316
|
return new Date(a[item.id]).getTime() < new Date(b[item.id]).getTime() ? -1 : 1;
|
|
1316
1317
|
};
|
|
1317
|
-
if (
|
|
1318
|
+
if (typeof item.filterDropdown === "undefined") {
|
|
1318
1319
|
item.filterDropdown = ({ setSelectedKeys, confirm }) => /* @__PURE__ */ jsx(
|
|
1319
1320
|
DatePicker.RangePicker,
|
|
1320
1321
|
{
|
|
@@ -1331,19 +1332,20 @@ function Table(props) {
|
|
|
1331
1332
|
}
|
|
1332
1333
|
}
|
|
1333
1334
|
);
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1335
|
+
if (!item.onFilter)
|
|
1336
|
+
item.onFilter = (value, row) => {
|
|
1337
|
+
if (isNil(value[0]))
|
|
1338
|
+
return true;
|
|
1339
|
+
if (isNil(row[item.id]))
|
|
1340
|
+
return false;
|
|
1341
|
+
return dayjs2(row[item.id]) >= dayjs2(value[0]) && dayjs2(row[item.id]) <= dayjs2(value[1]);
|
|
1342
|
+
};
|
|
1343
|
+
}
|
|
1342
1344
|
break;
|
|
1343
1345
|
case "time":
|
|
1344
1346
|
if (!item.render)
|
|
1345
1347
|
item.render = (value) => processValue(item, value);
|
|
1346
|
-
if (
|
|
1348
|
+
if (typeof item.sorter === "undefined")
|
|
1347
1349
|
item.sorter = (a, b, order) => {
|
|
1348
1350
|
if (isNil(a[item.id]))
|
|
1349
1351
|
return order === "ascend" ? 1 : -1;
|
|
@@ -1351,7 +1353,7 @@ function Table(props) {
|
|
|
1351
1353
|
return order === "ascend" ? -1 : 1;
|
|
1352
1354
|
return new Date(a[item.id]).getTime() < new Date(b[item.id]).getTime() ? -1 : 1;
|
|
1353
1355
|
};
|
|
1354
|
-
if (
|
|
1356
|
+
if (typeof item.filterDropdown === "undefined") {
|
|
1355
1357
|
item.filterDropdown = ({ setSelectedKeys, confirm }) => /* @__PURE__ */ jsx(
|
|
1356
1358
|
DatePicker.RangePicker,
|
|
1357
1359
|
{
|
|
@@ -1368,14 +1370,15 @@ function Table(props) {
|
|
|
1368
1370
|
}
|
|
1369
1371
|
}
|
|
1370
1372
|
);
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1373
|
+
if (!item.onFilter)
|
|
1374
|
+
item.onFilter = (value, row) => {
|
|
1375
|
+
if (isNil(value[0]))
|
|
1376
|
+
return true;
|
|
1377
|
+
if (isNil(row[item.id]))
|
|
1378
|
+
return false;
|
|
1379
|
+
return dayjs2(row[item.id]) >= dayjs2(value[0]) && dayjs2(row[item.id]) <= dayjs2(value[1]);
|
|
1380
|
+
};
|
|
1381
|
+
}
|
|
1379
1382
|
break;
|
|
1380
1383
|
case "object":
|
|
1381
1384
|
if (!item.render)
|
|
@@ -1403,7 +1406,7 @@ function Table(props) {
|
|
|
1403
1406
|
default:
|
|
1404
1407
|
if (!item.render)
|
|
1405
1408
|
item.render = (value) => processValue(item, value);
|
|
1406
|
-
if (!item.onFilter)
|
|
1409
|
+
if (typeof item.filterDropdown === "undefined" && !item.onFilter)
|
|
1407
1410
|
item.onFilter = (value, row) => {
|
|
1408
1411
|
if (value === null && isNil(row[item.id]))
|
|
1409
1412
|
return true;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@faasjs/ant-design",
|
|
3
|
-
"version": "0.0.4-beta.
|
|
3
|
+
"version": "0.0.4-beta.13",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"lodash-es": "*"
|
|
27
27
|
},
|
|
28
28
|
"peerDependencies": {
|
|
29
|
-
"@faasjs/react": "0.0.4-beta.
|
|
29
|
+
"@faasjs/react": "0.0.4-beta.13",
|
|
30
30
|
"antd": "*",
|
|
31
31
|
"react": "*",
|
|
32
32
|
"react-dom": "*",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"@testing-library/jest-dom": "*",
|
|
38
38
|
"@testing-library/react": "*",
|
|
39
39
|
"@testing-library/user-event": "*",
|
|
40
|
-
"@faasjs/react": "0.0.4-beta.
|
|
40
|
+
"@faasjs/react": "0.0.4-beta.13",
|
|
41
41
|
"antd": "*",
|
|
42
42
|
"react": "*",
|
|
43
43
|
"react-dom": "*",
|