@faasjs/ant-design 0.0.3-beta.20 → 0.0.3-beta.21
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 +90 -47
- package/dist/index.mjs +93 -48
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1000,7 +1000,10 @@ function Table(props) {
|
|
|
1000
1000
|
item.filters = item.options.map((o) => ({
|
|
1001
1001
|
text: o.label,
|
|
1002
1002
|
value: o.value
|
|
1003
|
-
}))
|
|
1003
|
+
})).concat({
|
|
1004
|
+
text: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Blank, {}),
|
|
1005
|
+
value: null
|
|
1006
|
+
});
|
|
1004
1007
|
}
|
|
1005
1008
|
if (item.children)
|
|
1006
1009
|
item.render = (value, values) => (0, import_react11.cloneElement)(
|
|
@@ -1293,55 +1296,95 @@ function Table(props) {
|
|
|
1293
1296
|
fallback: props.faasData.fallback || /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd9.Skeleton, {
|
|
1294
1297
|
active: true
|
|
1295
1298
|
}),
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
})
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
if (props.onChange) {
|
|
1326
|
-
const processed = props.onChange(pagination, filters, sorter, extra);
|
|
1327
|
-
reload({
|
|
1328
|
-
...params,
|
|
1329
|
-
pagination: processed.pagination,
|
|
1330
|
-
filters: processed.filters,
|
|
1331
|
-
sorter: processed.sorter
|
|
1332
|
-
});
|
|
1333
|
-
return;
|
|
1334
|
-
}
|
|
1335
|
-
reload({
|
|
1336
|
-
...params,
|
|
1337
|
-
pagination,
|
|
1338
|
-
filters,
|
|
1339
|
-
sorter
|
|
1299
|
+
...props.faasData,
|
|
1300
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FaasDataTable, {
|
|
1301
|
+
props,
|
|
1302
|
+
columns
|
|
1303
|
+
})
|
|
1304
|
+
});
|
|
1305
|
+
}
|
|
1306
|
+
function FaasDataTable({
|
|
1307
|
+
props,
|
|
1308
|
+
columns,
|
|
1309
|
+
data,
|
|
1310
|
+
params,
|
|
1311
|
+
reload
|
|
1312
|
+
}) {
|
|
1313
|
+
const [currentColumns, setCurrentColumns] = (0, import_react11.useState)(columns);
|
|
1314
|
+
(0, import_react11.useEffect)(() => {
|
|
1315
|
+
if (!data || Array.isArray(data))
|
|
1316
|
+
return;
|
|
1317
|
+
setCurrentColumns((prev) => {
|
|
1318
|
+
const newColumns = [...prev];
|
|
1319
|
+
for (const column of newColumns) {
|
|
1320
|
+
if (data["options"][column.id]) {
|
|
1321
|
+
column.options = data["options"][column.id];
|
|
1322
|
+
column.filters = data["options"][column.id].map((v) => ({
|
|
1323
|
+
text: v.label,
|
|
1324
|
+
value: v.value
|
|
1325
|
+
})).concat({
|
|
1326
|
+
text: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Blank, {}),
|
|
1327
|
+
value: null
|
|
1340
1328
|
});
|
|
1329
|
+
column.render = (value) => processValue(column, value);
|
|
1330
|
+
if (column.filterDropdown)
|
|
1331
|
+
delete column.filterDropdown;
|
|
1332
|
+
continue;
|
|
1341
1333
|
}
|
|
1342
|
-
|
|
1334
|
+
if (column.optionsType === "auto" && !column.options && !column.filters) {
|
|
1335
|
+
column.filters = (0, import_lodash_es6.uniqBy)(props.dataSource, column.id).map((v) => ({
|
|
1336
|
+
text: v[column.id],
|
|
1337
|
+
value: v[column.id]
|
|
1338
|
+
})).concat({
|
|
1339
|
+
text: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Blank, {}),
|
|
1340
|
+
value: null
|
|
1341
|
+
});
|
|
1342
|
+
}
|
|
1343
|
+
}
|
|
1344
|
+
return newColumns;
|
|
1345
|
+
});
|
|
1346
|
+
}, [columns, data]);
|
|
1347
|
+
if (!data)
|
|
1348
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd9.Table, {
|
|
1349
|
+
...props,
|
|
1350
|
+
rowKey: props.rowKey || "id",
|
|
1351
|
+
columns: currentColumns,
|
|
1352
|
+
dataSource: []
|
|
1353
|
+
});
|
|
1354
|
+
if (Array.isArray(data))
|
|
1355
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd9.Table, {
|
|
1356
|
+
...props,
|
|
1357
|
+
rowKey: props.rowKey || "id",
|
|
1358
|
+
columns: currentColumns,
|
|
1359
|
+
dataSource: data
|
|
1360
|
+
});
|
|
1361
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd9.Table, {
|
|
1362
|
+
...props,
|
|
1363
|
+
rowKey: props.rowKey || "id",
|
|
1364
|
+
columns: currentColumns,
|
|
1365
|
+
dataSource: data.rows,
|
|
1366
|
+
pagination: {
|
|
1367
|
+
...props.pagination,
|
|
1368
|
+
...data.pagination
|
|
1343
1369
|
},
|
|
1344
|
-
|
|
1370
|
+
onChange: (pagination, filters, sorter, extra) => {
|
|
1371
|
+
if (props.onChange) {
|
|
1372
|
+
const processed = props.onChange(pagination, filters, sorter, extra);
|
|
1373
|
+
reload({
|
|
1374
|
+
...params,
|
|
1375
|
+
pagination: processed.pagination,
|
|
1376
|
+
filters: processed.filters,
|
|
1377
|
+
sorter: processed.sorter
|
|
1378
|
+
});
|
|
1379
|
+
return;
|
|
1380
|
+
}
|
|
1381
|
+
reload({
|
|
1382
|
+
...params,
|
|
1383
|
+
pagination,
|
|
1384
|
+
filters,
|
|
1385
|
+
sorter
|
|
1386
|
+
});
|
|
1387
|
+
}
|
|
1345
1388
|
});
|
|
1346
1389
|
}
|
|
1347
1390
|
|
package/dist/index.mjs
CHANGED
|
@@ -959,7 +959,9 @@ import {
|
|
|
959
959
|
uniqBy,
|
|
960
960
|
upperFirst as upperFirst4
|
|
961
961
|
} from "lodash-es";
|
|
962
|
-
import {
|
|
962
|
+
import {
|
|
963
|
+
FaasDataWrapper as FaasDataWrapper2
|
|
964
|
+
} from "@faasjs/react";
|
|
963
965
|
import { jsx as jsx10, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
964
966
|
function processValue(item, value) {
|
|
965
967
|
var _a;
|
|
@@ -1004,7 +1006,10 @@ function Table(props) {
|
|
|
1004
1006
|
item.filters = item.options.map((o) => ({
|
|
1005
1007
|
text: o.label,
|
|
1006
1008
|
value: o.value
|
|
1007
|
-
}))
|
|
1009
|
+
})).concat({
|
|
1010
|
+
text: /* @__PURE__ */ jsx10(Blank, {}),
|
|
1011
|
+
value: null
|
|
1012
|
+
});
|
|
1008
1013
|
}
|
|
1009
1014
|
if (item.children)
|
|
1010
1015
|
item.render = (value, values) => cloneElement2(
|
|
@@ -1297,55 +1302,95 @@ function Table(props) {
|
|
|
1297
1302
|
fallback: props.faasData.fallback || /* @__PURE__ */ jsx10(Skeleton3, {
|
|
1298
1303
|
active: true
|
|
1299
1304
|
}),
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
})
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
if (props.onChange) {
|
|
1330
|
-
const processed = props.onChange(pagination, filters, sorter, extra);
|
|
1331
|
-
reload({
|
|
1332
|
-
...params,
|
|
1333
|
-
pagination: processed.pagination,
|
|
1334
|
-
filters: processed.filters,
|
|
1335
|
-
sorter: processed.sorter
|
|
1336
|
-
});
|
|
1337
|
-
return;
|
|
1338
|
-
}
|
|
1339
|
-
reload({
|
|
1340
|
-
...params,
|
|
1341
|
-
pagination,
|
|
1342
|
-
filters,
|
|
1343
|
-
sorter
|
|
1305
|
+
...props.faasData,
|
|
1306
|
+
children: /* @__PURE__ */ jsx10(FaasDataTable, {
|
|
1307
|
+
props,
|
|
1308
|
+
columns
|
|
1309
|
+
})
|
|
1310
|
+
});
|
|
1311
|
+
}
|
|
1312
|
+
function FaasDataTable({
|
|
1313
|
+
props,
|
|
1314
|
+
columns,
|
|
1315
|
+
data,
|
|
1316
|
+
params,
|
|
1317
|
+
reload
|
|
1318
|
+
}) {
|
|
1319
|
+
const [currentColumns, setCurrentColumns] = useState7(columns);
|
|
1320
|
+
useEffect5(() => {
|
|
1321
|
+
if (!data || Array.isArray(data))
|
|
1322
|
+
return;
|
|
1323
|
+
setCurrentColumns((prev) => {
|
|
1324
|
+
const newColumns = [...prev];
|
|
1325
|
+
for (const column of newColumns) {
|
|
1326
|
+
if (data["options"][column.id]) {
|
|
1327
|
+
column.options = data["options"][column.id];
|
|
1328
|
+
column.filters = data["options"][column.id].map((v) => ({
|
|
1329
|
+
text: v.label,
|
|
1330
|
+
value: v.value
|
|
1331
|
+
})).concat({
|
|
1332
|
+
text: /* @__PURE__ */ jsx10(Blank, {}),
|
|
1333
|
+
value: null
|
|
1344
1334
|
});
|
|
1335
|
+
column.render = (value) => processValue(column, value);
|
|
1336
|
+
if (column.filterDropdown)
|
|
1337
|
+
delete column.filterDropdown;
|
|
1338
|
+
continue;
|
|
1345
1339
|
}
|
|
1346
|
-
|
|
1340
|
+
if (column.optionsType === "auto" && !column.options && !column.filters) {
|
|
1341
|
+
column.filters = uniqBy(props.dataSource, column.id).map((v) => ({
|
|
1342
|
+
text: v[column.id],
|
|
1343
|
+
value: v[column.id]
|
|
1344
|
+
})).concat({
|
|
1345
|
+
text: /* @__PURE__ */ jsx10(Blank, {}),
|
|
1346
|
+
value: null
|
|
1347
|
+
});
|
|
1348
|
+
}
|
|
1349
|
+
}
|
|
1350
|
+
return newColumns;
|
|
1351
|
+
});
|
|
1352
|
+
}, [columns, data]);
|
|
1353
|
+
if (!data)
|
|
1354
|
+
return /* @__PURE__ */ jsx10(AntdTable, {
|
|
1355
|
+
...props,
|
|
1356
|
+
rowKey: props.rowKey || "id",
|
|
1357
|
+
columns: currentColumns,
|
|
1358
|
+
dataSource: []
|
|
1359
|
+
});
|
|
1360
|
+
if (Array.isArray(data))
|
|
1361
|
+
return /* @__PURE__ */ jsx10(AntdTable, {
|
|
1362
|
+
...props,
|
|
1363
|
+
rowKey: props.rowKey || "id",
|
|
1364
|
+
columns: currentColumns,
|
|
1365
|
+
dataSource: data
|
|
1366
|
+
});
|
|
1367
|
+
return /* @__PURE__ */ jsx10(AntdTable, {
|
|
1368
|
+
...props,
|
|
1369
|
+
rowKey: props.rowKey || "id",
|
|
1370
|
+
columns: currentColumns,
|
|
1371
|
+
dataSource: data.rows,
|
|
1372
|
+
pagination: {
|
|
1373
|
+
...props.pagination,
|
|
1374
|
+
...data.pagination
|
|
1347
1375
|
},
|
|
1348
|
-
|
|
1376
|
+
onChange: (pagination, filters, sorter, extra) => {
|
|
1377
|
+
if (props.onChange) {
|
|
1378
|
+
const processed = props.onChange(pagination, filters, sorter, extra);
|
|
1379
|
+
reload({
|
|
1380
|
+
...params,
|
|
1381
|
+
pagination: processed.pagination,
|
|
1382
|
+
filters: processed.filters,
|
|
1383
|
+
sorter: processed.sorter
|
|
1384
|
+
});
|
|
1385
|
+
return;
|
|
1386
|
+
}
|
|
1387
|
+
reload({
|
|
1388
|
+
...params,
|
|
1389
|
+
pagination,
|
|
1390
|
+
filters,
|
|
1391
|
+
sorter
|
|
1392
|
+
});
|
|
1393
|
+
}
|
|
1349
1394
|
});
|
|
1350
1395
|
}
|
|
1351
1396
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@faasjs/ant-design",
|
|
3
|
-
"version": "0.0.3-beta.
|
|
3
|
+
"version": "0.0.3-beta.21",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"lodash-es": "*",
|
|
29
29
|
"react": "*",
|
|
30
30
|
"react-dom": "*",
|
|
31
|
-
"@faasjs/react": "^0.0.3-beta.
|
|
31
|
+
"@faasjs/react": "^0.0.3-beta.21",
|
|
32
32
|
"react-router-dom": "*",
|
|
33
33
|
"dayjs": "*"
|
|
34
34
|
},
|