@faasjs/ant-design 0.0.3-beta.14 → 0.0.3-beta.16
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/README.md +45 -243
- package/dist/index.d.ts +55 -96
- package/dist/index.js +138 -145
- package/dist/index.mjs +50 -58
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -12,7 +12,6 @@ import {
|
|
|
12
12
|
useEffect,
|
|
13
13
|
useState
|
|
14
14
|
} from "react";
|
|
15
|
-
import { ConfigProvider as AntdConfigProvider } from "antd";
|
|
16
15
|
import { defaultsDeep } from "lodash-es";
|
|
17
16
|
import { jsx } from "react/jsx-runtime";
|
|
18
17
|
var isZH = /^zh/i.test(navigator.language);
|
|
@@ -72,10 +71,7 @@ function ConfigProvider({
|
|
|
72
71
|
}, []);
|
|
73
72
|
return /* @__PURE__ */ jsx(ConfigContext.Provider, {
|
|
74
73
|
value: values,
|
|
75
|
-
children
|
|
76
|
-
...config.antd,
|
|
77
|
-
children
|
|
78
|
-
})
|
|
74
|
+
children
|
|
79
75
|
});
|
|
80
76
|
}
|
|
81
77
|
function useConfigContext() {
|
|
@@ -181,7 +177,10 @@ function DescriptionItemContent(props) {
|
|
|
181
177
|
else
|
|
182
178
|
throw Error(computedProps.item.type + " requires children or render");
|
|
183
179
|
if (computedProps.item.children)
|
|
184
|
-
return cloneElement(computedProps.item.children, {
|
|
180
|
+
return cloneElement(computedProps.item.children, {
|
|
181
|
+
value: computedProps.value,
|
|
182
|
+
values: computedProps.values
|
|
183
|
+
});
|
|
185
184
|
if (computedProps.item.render)
|
|
186
185
|
return /* @__PURE__ */ jsx3(Fragment, {
|
|
187
186
|
children: computedProps.item.render(computedProps.value, computedProps.values)
|
|
@@ -951,8 +950,7 @@ import {
|
|
|
951
950
|
Table as AntdTable,
|
|
952
951
|
Radio,
|
|
953
952
|
Skeleton as Skeleton3,
|
|
954
|
-
Input as Input2
|
|
955
|
-
ConfigProvider as ConfigProvider2
|
|
953
|
+
Input as Input2
|
|
956
954
|
} from "antd";
|
|
957
955
|
import dayjs2 from "dayjs";
|
|
958
956
|
import { CheckOutlined as CheckOutlined2, CloseOutlined as CloseOutlined2 } from "@ant-design/icons";
|
|
@@ -989,7 +987,7 @@ function processValue(item, value) {
|
|
|
989
987
|
}
|
|
990
988
|
function Table(props) {
|
|
991
989
|
const [columns, setColumns] = useState7();
|
|
992
|
-
const { common: common2
|
|
990
|
+
const { common: common2 } = useConfigContext();
|
|
993
991
|
useEffect5(() => {
|
|
994
992
|
var _a;
|
|
995
993
|
for (const item of props.items) {
|
|
@@ -1009,7 +1007,13 @@ function Table(props) {
|
|
|
1009
1007
|
}));
|
|
1010
1008
|
}
|
|
1011
1009
|
if (item.children)
|
|
1012
|
-
|
|
1010
|
+
item.render = (value, values) => cloneElement2(
|
|
1011
|
+
item.children,
|
|
1012
|
+
{
|
|
1013
|
+
value,
|
|
1014
|
+
values
|
|
1015
|
+
}
|
|
1016
|
+
);
|
|
1013
1017
|
if (props.extendTypes && props.extendTypes[item.type]) {
|
|
1014
1018
|
if (props.extendTypes[item.type].children)
|
|
1015
1019
|
item.render = (value, values) => cloneElement2(
|
|
@@ -1283,14 +1287,11 @@ function Table(props) {
|
|
|
1283
1287
|
if (!columns)
|
|
1284
1288
|
return null;
|
|
1285
1289
|
if (!props.faasData)
|
|
1286
|
-
return /* @__PURE__ */ jsx10(
|
|
1287
|
-
...
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
columns,
|
|
1292
|
-
dataSource: props.dataSource
|
|
1293
|
-
})
|
|
1290
|
+
return /* @__PURE__ */ jsx10(AntdTable, {
|
|
1291
|
+
...props,
|
|
1292
|
+
rowKey: props.rowKey || "id",
|
|
1293
|
+
columns,
|
|
1294
|
+
dataSource: props.dataSource
|
|
1294
1295
|
});
|
|
1295
1296
|
return /* @__PURE__ */ jsx10(FaasDataWrapper2, {
|
|
1296
1297
|
fallback: props.faasData.fallback || /* @__PURE__ */ jsx10(Skeleton3, {
|
|
@@ -1302,55 +1303,46 @@ function Table(props) {
|
|
|
1302
1303
|
reload
|
|
1303
1304
|
}) => {
|
|
1304
1305
|
if (!data)
|
|
1305
|
-
return /* @__PURE__ */ jsx10(
|
|
1306
|
-
...
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
columns,
|
|
1311
|
-
dataSource: []
|
|
1312
|
-
})
|
|
1306
|
+
return /* @__PURE__ */ jsx10(AntdTable, {
|
|
1307
|
+
...props,
|
|
1308
|
+
rowKey: props.rowKey || "id",
|
|
1309
|
+
columns,
|
|
1310
|
+
dataSource: []
|
|
1313
1311
|
});
|
|
1314
1312
|
if (Array.isArray(data))
|
|
1315
|
-
return /* @__PURE__ */ jsx10(
|
|
1316
|
-
...antd,
|
|
1317
|
-
children: /* @__PURE__ */ jsx10(AntdTable, {
|
|
1318
|
-
...props,
|
|
1319
|
-
rowKey: props.rowKey || "id",
|
|
1320
|
-
columns,
|
|
1321
|
-
dataSource: data
|
|
1322
|
-
})
|
|
1323
|
-
});
|
|
1324
|
-
return /* @__PURE__ */ jsx10(ConfigProvider2, {
|
|
1325
|
-
...antd,
|
|
1326
|
-
children: /* @__PURE__ */ jsx10(AntdTable, {
|
|
1313
|
+
return /* @__PURE__ */ jsx10(AntdTable, {
|
|
1327
1314
|
...props,
|
|
1328
1315
|
rowKey: props.rowKey || "id",
|
|
1329
1316
|
columns,
|
|
1330
|
-
dataSource: data
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
return;
|
|
1345
|
-
}
|
|
1317
|
+
dataSource: data
|
|
1318
|
+
});
|
|
1319
|
+
return /* @__PURE__ */ jsx10(AntdTable, {
|
|
1320
|
+
...props,
|
|
1321
|
+
rowKey: props.rowKey || "id",
|
|
1322
|
+
columns,
|
|
1323
|
+
dataSource: data.rows,
|
|
1324
|
+
pagination: {
|
|
1325
|
+
...props.pagination,
|
|
1326
|
+
...data.pagination
|
|
1327
|
+
},
|
|
1328
|
+
onChange: (pagination, filters, sorter, extra) => {
|
|
1329
|
+
if (props.onChange) {
|
|
1330
|
+
const processed = props.onChange(pagination, filters, sorter, extra);
|
|
1346
1331
|
reload({
|
|
1347
1332
|
...params,
|
|
1348
|
-
pagination,
|
|
1349
|
-
filters,
|
|
1350
|
-
sorter
|
|
1333
|
+
pagination: processed.pagination,
|
|
1334
|
+
filters: processed.filters,
|
|
1335
|
+
sorter: processed.sorter
|
|
1351
1336
|
});
|
|
1337
|
+
return;
|
|
1352
1338
|
}
|
|
1353
|
-
|
|
1339
|
+
reload({
|
|
1340
|
+
...params,
|
|
1341
|
+
pagination,
|
|
1342
|
+
filters,
|
|
1343
|
+
sorter
|
|
1344
|
+
});
|
|
1345
|
+
}
|
|
1354
1346
|
});
|
|
1355
1347
|
},
|
|
1356
1348
|
...props.faasData
|
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.16",
|
|
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.16",
|
|
32
32
|
"react-router-dom": "*",
|
|
33
33
|
"dayjs": "*"
|
|
34
34
|
},
|