@faasjs/ant-design 0.0.4-beta.13 → 0.0.4-beta.15
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 +4 -3
- package/dist/index.d.ts +4 -3
- package/dist/index.js +113 -110
- package/dist/index.mjs +115 -112
- package/package.json +3 -3
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FaasDataInjection as FaasDataInjection$1, FaasDataWrapperProps as FaasDataWrapperProps$1
|
|
1
|
+
import { ErrorBoundaryProps, FaasDataInjection as FaasDataInjection$1, FaasDataWrapperProps as FaasDataWrapperProps$1 } from '@faasjs/react';
|
|
2
2
|
export { ErrorBoundaryProps, faas, useFaas } from '@faasjs/react';
|
|
3
3
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
4
4
|
import { ConfigProviderProps as ConfigProviderProps$1 } from 'antd/es/config-provider';
|
|
@@ -73,11 +73,14 @@ declare function useDrawer(init?: DrawerProps): {
|
|
|
73
73
|
setDrawerProps(changes: Partial<DrawerProps>): void;
|
|
74
74
|
};
|
|
75
75
|
|
|
76
|
+
declare function ErrorBoundary(props: ErrorBoundaryProps): react_jsx_runtime.JSX.Element;
|
|
77
|
+
|
|
76
78
|
interface AppProps {
|
|
77
79
|
children: React.ReactNode;
|
|
78
80
|
styleProviderProps?: StyleProviderProps;
|
|
79
81
|
configProviderProps?: ConfigProviderProps$1;
|
|
80
82
|
browserRouterProps?: BrowserRouterProps;
|
|
83
|
+
errorBoundaryProps?: Omit<ErrorBoundaryProps, 'children'>;
|
|
81
84
|
}
|
|
82
85
|
interface useAppProps {
|
|
83
86
|
message: MessageInstance;
|
|
@@ -377,8 +380,6 @@ interface UnionFaasItemProps<Value = any, Values = any> extends FormItemProps, D
|
|
|
377
380
|
object?: UnionFaasItemProps<Value, Values>[];
|
|
378
381
|
}
|
|
379
382
|
|
|
380
|
-
declare function ErrorBoundary(props: ErrorBoundaryProps): react_jsx_runtime.JSX.Element;
|
|
381
|
-
|
|
382
383
|
type FormSubmitProps = {
|
|
383
384
|
/** Default: Submit */
|
|
384
385
|
text?: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FaasDataInjection as FaasDataInjection$1, FaasDataWrapperProps as FaasDataWrapperProps$1
|
|
1
|
+
import { ErrorBoundaryProps, FaasDataInjection as FaasDataInjection$1, FaasDataWrapperProps as FaasDataWrapperProps$1 } from '@faasjs/react';
|
|
2
2
|
export { ErrorBoundaryProps, faas, useFaas } from '@faasjs/react';
|
|
3
3
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
4
4
|
import { ConfigProviderProps as ConfigProviderProps$1 } from 'antd/es/config-provider';
|
|
@@ -73,11 +73,14 @@ declare function useDrawer(init?: DrawerProps): {
|
|
|
73
73
|
setDrawerProps(changes: Partial<DrawerProps>): void;
|
|
74
74
|
};
|
|
75
75
|
|
|
76
|
+
declare function ErrorBoundary(props: ErrorBoundaryProps): react_jsx_runtime.JSX.Element;
|
|
77
|
+
|
|
76
78
|
interface AppProps {
|
|
77
79
|
children: React.ReactNode;
|
|
78
80
|
styleProviderProps?: StyleProviderProps;
|
|
79
81
|
configProviderProps?: ConfigProviderProps$1;
|
|
80
82
|
browserRouterProps?: BrowserRouterProps;
|
|
83
|
+
errorBoundaryProps?: Omit<ErrorBoundaryProps, 'children'>;
|
|
81
84
|
}
|
|
82
85
|
interface useAppProps {
|
|
83
86
|
message: MessageInstance;
|
|
@@ -377,8 +380,6 @@ interface UnionFaasItemProps<Value = any, Values = any> extends FormItemProps, D
|
|
|
377
380
|
object?: UnionFaasItemProps<Value, Values>[];
|
|
378
381
|
}
|
|
379
382
|
|
|
380
|
-
declare function ErrorBoundary(props: ErrorBoundaryProps): react_jsx_runtime.JSX.Element;
|
|
381
|
-
|
|
382
383
|
type FormSubmitProps = {
|
|
383
384
|
/** Default: Submit */
|
|
384
385
|
text?: string;
|
package/dist/index.js
CHANGED
|
@@ -55,6 +55,28 @@ function useDrawer(init) {
|
|
|
55
55
|
}
|
|
56
56
|
};
|
|
57
57
|
}
|
|
58
|
+
function ErrorChildren(props) {
|
|
59
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
60
|
+
antd.Alert,
|
|
61
|
+
{
|
|
62
|
+
type: "error",
|
|
63
|
+
message: props.errorMessage,
|
|
64
|
+
description: /* @__PURE__ */ jsxRuntime.jsx(
|
|
65
|
+
"pre",
|
|
66
|
+
{
|
|
67
|
+
style: {
|
|
68
|
+
fontSize: "0.9em",
|
|
69
|
+
overflowX: "auto"
|
|
70
|
+
},
|
|
71
|
+
children: props.errorDescription
|
|
72
|
+
}
|
|
73
|
+
)
|
|
74
|
+
}
|
|
75
|
+
);
|
|
76
|
+
}
|
|
77
|
+
function ErrorBoundary(props) {
|
|
78
|
+
return /* @__PURE__ */ jsxRuntime.jsx(react.ErrorBoundary, { errorChildren: /* @__PURE__ */ jsxRuntime.jsx(ErrorChildren, {}), ...props });
|
|
79
|
+
}
|
|
58
80
|
var AppContext = react$1.createContext({
|
|
59
81
|
message: {},
|
|
60
82
|
notification: {},
|
|
@@ -92,13 +114,13 @@ function App(props) {
|
|
|
92
114
|
hashPriority: "high",
|
|
93
115
|
transformers: [cssinjs.legacyLogicalPropertiesTransformer]
|
|
94
116
|
}),
|
|
95
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(antd.ConfigProvider, { ...props.configProviderProps, children: /* @__PURE__ */ jsxRuntime.jsx(AppContext.Provider, { value: memoizedContextValue, children: /* @__PURE__ */ jsxRuntime.jsxs(reactRouterDom.BrowserRouter, { ...props.browserRouterProps, children: [
|
|
117
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(antd.ConfigProvider, { ...props.configProviderProps, children: /* @__PURE__ */ jsxRuntime.jsx(AppContext.Provider, { value: memoizedContextValue, children: /* @__PURE__ */ jsxRuntime.jsx(ErrorBoundary, { ...props.errorBoundaryProps, children: /* @__PURE__ */ jsxRuntime.jsxs(reactRouterDom.BrowserRouter, { ...props.browserRouterProps, children: [
|
|
96
118
|
messageContextHolder,
|
|
97
119
|
notificationContextHolder,
|
|
98
120
|
modal,
|
|
99
121
|
drawer,
|
|
100
122
|
/* @__PURE__ */ jsxRuntime.jsx(RoutesApp, { children: props.children })
|
|
101
|
-
] }) }) })
|
|
123
|
+
] }) }) }) })
|
|
102
124
|
}
|
|
103
125
|
);
|
|
104
126
|
}
|
|
@@ -396,28 +418,6 @@ function Description(props) {
|
|
|
396
418
|
}
|
|
397
419
|
);
|
|
398
420
|
}
|
|
399
|
-
function ErrorChildren(props) {
|
|
400
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
401
|
-
antd.Alert,
|
|
402
|
-
{
|
|
403
|
-
type: "error",
|
|
404
|
-
message: props.errorMessage,
|
|
405
|
-
description: /* @__PURE__ */ jsxRuntime.jsx(
|
|
406
|
-
"pre",
|
|
407
|
-
{
|
|
408
|
-
style: {
|
|
409
|
-
fontSize: "0.9em",
|
|
410
|
-
overflowX: "auto"
|
|
411
|
-
},
|
|
412
|
-
children: props.errorDescription
|
|
413
|
-
}
|
|
414
|
-
)
|
|
415
|
-
}
|
|
416
|
-
);
|
|
417
|
-
}
|
|
418
|
-
function ErrorBoundary(props) {
|
|
419
|
-
return /* @__PURE__ */ jsxRuntime.jsx(react.ErrorBoundary, { errorChildren: /* @__PURE__ */ jsxRuntime.jsx(ErrorChildren, {}), ...props });
|
|
420
|
-
}
|
|
421
421
|
function processProps(propsCopy, config) {
|
|
422
422
|
if (!propsCopy.title)
|
|
423
423
|
propsCopy.title = lodashEs.upperFirst(propsCopy.id);
|
|
@@ -989,7 +989,7 @@ function Table(props) {
|
|
|
989
989
|
const [columns, setColumns] = react$1.useState();
|
|
990
990
|
const { common: common2 } = useConfigContext();
|
|
991
991
|
const generateFilterDropdown = (item) => {
|
|
992
|
-
if (
|
|
992
|
+
if (item.filterDropdown && item.filterDropdown !== true)
|
|
993
993
|
return;
|
|
994
994
|
if (item.options.length < 11) {
|
|
995
995
|
if (!item.filters)
|
|
@@ -1088,7 +1088,7 @@ function Table(props) {
|
|
|
1088
1088
|
case "string":
|
|
1089
1089
|
if (!item.render)
|
|
1090
1090
|
item.render = (value) => processValue(item, value);
|
|
1091
|
-
if (
|
|
1091
|
+
if (item.filterDropdown !== false) {
|
|
1092
1092
|
if (!item.onFilter)
|
|
1093
1093
|
item.onFilter = (value, row) => {
|
|
1094
1094
|
if (!value || lodashEs.isNil(value))
|
|
@@ -1097,7 +1097,7 @@ function Table(props) {
|
|
|
1097
1097
|
return false;
|
|
1098
1098
|
return row[item.id].trim().toLowerCase().includes(value.trim().toLowerCase());
|
|
1099
1099
|
};
|
|
1100
|
-
if (!item.filters && item.optionsType !== "auto")
|
|
1100
|
+
if (typeof item.filterDropdown === "undefined" && !item.filters && item.optionsType !== "auto")
|
|
1101
1101
|
item.filterDropdown = ({
|
|
1102
1102
|
setSelectedKeys,
|
|
1103
1103
|
confirm,
|
|
@@ -1123,7 +1123,7 @@ function Table(props) {
|
|
|
1123
1123
|
case "string[]":
|
|
1124
1124
|
if (!item.render)
|
|
1125
1125
|
item.render = (value) => processValue(item, value);
|
|
1126
|
-
if (
|
|
1126
|
+
if (item.filterDropdown !== false) {
|
|
1127
1127
|
if (!item.onFilter)
|
|
1128
1128
|
item.onFilter = (value, row) => {
|
|
1129
1129
|
if (value === null && (!row[item.id] || !row[item.id].length))
|
|
@@ -1134,7 +1134,7 @@ function Table(props) {
|
|
|
1134
1134
|
(v) => v.trim().toLowerCase().includes(value.trim().toLowerCase())
|
|
1135
1135
|
);
|
|
1136
1136
|
};
|
|
1137
|
-
if (!item.filters && item.optionsType !== "auto")
|
|
1137
|
+
if (typeof item.filterDropdown === "undefined" && !item.filters && item.optionsType !== "auto")
|
|
1138
1138
|
item.filterDropdown = ({
|
|
1139
1139
|
setSelectedKeys,
|
|
1140
1140
|
confirm,
|
|
@@ -1162,7 +1162,7 @@ function Table(props) {
|
|
|
1162
1162
|
item.render = (value) => processValue(item, value);
|
|
1163
1163
|
if (typeof item.sorter === "undefined")
|
|
1164
1164
|
item.sorter = (a, b) => a[item.id] - b[item.id];
|
|
1165
|
-
if (
|
|
1165
|
+
if (item.filterDropdown !== false) {
|
|
1166
1166
|
if (!item.onFilter)
|
|
1167
1167
|
item.onFilter = (value, row) => {
|
|
1168
1168
|
if (value === null)
|
|
@@ -1171,7 +1171,7 @@ function Table(props) {
|
|
|
1171
1171
|
return false;
|
|
1172
1172
|
return value == row[item.id];
|
|
1173
1173
|
};
|
|
1174
|
-
if (!item.filters)
|
|
1174
|
+
if (typeof item.filterDropdown === "undefined" && !item.filters)
|
|
1175
1175
|
item.filterDropdown = ({
|
|
1176
1176
|
setSelectedKeys,
|
|
1177
1177
|
confirm,
|
|
@@ -1197,7 +1197,7 @@ function Table(props) {
|
|
|
1197
1197
|
case "number[]":
|
|
1198
1198
|
if (!item.render)
|
|
1199
1199
|
item.render = (value) => processValue(item, value).join(", ");
|
|
1200
|
-
if (
|
|
1200
|
+
if (item.filterDropdown !== false) {
|
|
1201
1201
|
if (!item.onFilter)
|
|
1202
1202
|
item.onFilter = (value, row) => {
|
|
1203
1203
|
if (value === null && (!row[item.id] || !row[item.id].length))
|
|
@@ -1206,7 +1206,7 @@ function Table(props) {
|
|
|
1206
1206
|
return false;
|
|
1207
1207
|
return row[item.id].includes(Number(value));
|
|
1208
1208
|
};
|
|
1209
|
-
if (!item.filters)
|
|
1209
|
+
if (typeof item.filterDropdown === "undefined" && !item.filters)
|
|
1210
1210
|
item.filterDropdown = ({
|
|
1211
1211
|
setSelectedKeys,
|
|
1212
1212
|
confirm,
|
|
@@ -1248,52 +1248,53 @@ function Table(props) {
|
|
|
1248
1248
|
}
|
|
1249
1249
|
}
|
|
1250
1250
|
);
|
|
1251
|
-
if (
|
|
1252
|
-
item.filterDropdown
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1251
|
+
if (item.filterDropdown !== false) {
|
|
1252
|
+
if (typeof item.filterDropdown === "undefined")
|
|
1253
|
+
item.filterDropdown = ({
|
|
1254
|
+
setSelectedKeys,
|
|
1255
|
+
selectedKeys,
|
|
1256
|
+
confirm
|
|
1257
|
+
}) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1258
|
+
antd.Radio.Group,
|
|
1259
|
+
{
|
|
1260
|
+
style: { padding: 8 },
|
|
1261
|
+
buttonStyle: "solid",
|
|
1262
|
+
value: JSON.stringify(selectedKeys[0]),
|
|
1263
|
+
onChange: (e) => {
|
|
1264
|
+
const Values = {
|
|
1265
|
+
true: true,
|
|
1266
|
+
false: false,
|
|
1267
|
+
null: null
|
|
1268
|
+
};
|
|
1269
|
+
setSelectedKeys(
|
|
1270
|
+
e.target.value ? [Values[e.target.value]] : []
|
|
1271
|
+
);
|
|
1272
|
+
confirm();
|
|
1273
|
+
},
|
|
1274
|
+
children: [
|
|
1275
|
+
/* @__PURE__ */ jsxRuntime.jsx(antd.Radio.Button, { children: common2.all }),
|
|
1276
|
+
/* @__PURE__ */ jsxRuntime.jsx(antd.Radio.Button, { value: "true", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1277
|
+
icons.CheckOutlined,
|
|
1278
|
+
{
|
|
1279
|
+
style: {
|
|
1280
|
+
color: "#52c41a",
|
|
1281
|
+
verticalAlign: "middle"
|
|
1282
|
+
}
|
|
1281
1283
|
}
|
|
1282
|
-
}
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1284
|
+
) }),
|
|
1285
|
+
/* @__PURE__ */ jsxRuntime.jsx(antd.Radio.Button, { value: "false", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1286
|
+
icons.CloseOutlined,
|
|
1287
|
+
{
|
|
1288
|
+
style: {
|
|
1289
|
+
verticalAlign: "middle",
|
|
1290
|
+
color: "#ff4d4f"
|
|
1291
|
+
}
|
|
1290
1292
|
}
|
|
1291
|
-
}
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
);
|
|
1293
|
+
) }),
|
|
1294
|
+
/* @__PURE__ */ jsxRuntime.jsx(antd.Radio.Button, { value: "null", children: common2.blank })
|
|
1295
|
+
]
|
|
1296
|
+
}
|
|
1297
|
+
);
|
|
1297
1298
|
if (!item.onFilter)
|
|
1298
1299
|
item.onFilter = (value, row) => {
|
|
1299
1300
|
switch (value) {
|
|
@@ -1318,23 +1319,24 @@ function Table(props) {
|
|
|
1318
1319
|
return order === "ascend" ? -1 : 1;
|
|
1319
1320
|
return new Date(a[item.id]).getTime() < new Date(b[item.id]).getTime() ? -1 : 1;
|
|
1320
1321
|
};
|
|
1321
|
-
if (
|
|
1322
|
-
item.filterDropdown
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
(
|
|
1328
|
-
[
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1322
|
+
if (item.filterDropdown !== false) {
|
|
1323
|
+
if (typeof item.filterDropdown === "undefined")
|
|
1324
|
+
item.filterDropdown = ({ setSelectedKeys, confirm }) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1325
|
+
antd.DatePicker.RangePicker,
|
|
1326
|
+
{
|
|
1327
|
+
onChange: (dates) => {
|
|
1328
|
+
setSelectedKeys(
|
|
1329
|
+
(dates == null ? void 0 : dates[0]) && dates[1] ? [
|
|
1330
|
+
[
|
|
1331
|
+
dates[0].startOf("day").toISOString(),
|
|
1332
|
+
dates[1].endOf("day").toISOString()
|
|
1333
|
+
]
|
|
1334
|
+
] : []
|
|
1335
|
+
);
|
|
1336
|
+
confirm();
|
|
1337
|
+
}
|
|
1335
1338
|
}
|
|
1336
|
-
|
|
1337
|
-
);
|
|
1339
|
+
);
|
|
1338
1340
|
if (!item.onFilter)
|
|
1339
1341
|
item.onFilter = (value, row) => {
|
|
1340
1342
|
if (lodashEs.isNil(value[0]))
|
|
@@ -1356,23 +1358,24 @@ function Table(props) {
|
|
|
1356
1358
|
return order === "ascend" ? -1 : 1;
|
|
1357
1359
|
return new Date(a[item.id]).getTime() < new Date(b[item.id]).getTime() ? -1 : 1;
|
|
1358
1360
|
};
|
|
1359
|
-
if (
|
|
1360
|
-
item.filterDropdown
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
(
|
|
1366
|
-
[
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1361
|
+
if (item.filterDropdown !== false) {
|
|
1362
|
+
if (typeof item.filterDropdown === "undefined")
|
|
1363
|
+
item.filterDropdown = ({ setSelectedKeys, confirm }) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1364
|
+
antd.DatePicker.RangePicker,
|
|
1365
|
+
{
|
|
1366
|
+
onChange: (dates) => {
|
|
1367
|
+
setSelectedKeys(
|
|
1368
|
+
(dates == null ? void 0 : dates[0]) && dates[1] ? [
|
|
1369
|
+
[
|
|
1370
|
+
dates[0].startOf("day").toISOString(),
|
|
1371
|
+
dates[1].endOf("day").toISOString()
|
|
1372
|
+
]
|
|
1373
|
+
] : []
|
|
1374
|
+
);
|
|
1375
|
+
confirm();
|
|
1376
|
+
}
|
|
1373
1377
|
}
|
|
1374
|
-
|
|
1375
|
-
);
|
|
1378
|
+
);
|
|
1376
1379
|
if (!item.onFilter)
|
|
1377
1380
|
item.onFilter = (value, row) => {
|
|
1378
1381
|
if (lodashEs.isNil(value[0]))
|
|
@@ -1409,7 +1412,7 @@ function Table(props) {
|
|
|
1409
1412
|
default:
|
|
1410
1413
|
if (!item.render)
|
|
1411
1414
|
item.render = (value) => processValue(item, value);
|
|
1412
|
-
if (
|
|
1415
|
+
if (item.filterDropdown !== false && !item.onFilter)
|
|
1413
1416
|
item.onFilter = (value, row) => {
|
|
1414
1417
|
if (value === null && lodashEs.isNil(row[item.id]))
|
|
1415
1418
|
return true;
|
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ErrorBoundary as ErrorBoundary$1, FaasDataWrapper as FaasDataWrapper$1, faas } from '@faasjs/react';
|
|
2
2
|
export { faas, useFaas } from '@faasjs/react';
|
|
3
|
-
import { Form as Form$1, Modal, Drawer, message, notification, ConfigProvider, Typography, Spin, Descriptions, Input, Button, Row, Col, TimePicker, DatePicker, Switch, Select, InputNumber, Radio, Result, Skeleton, Table as Table$1, Tabs as Tabs$1,
|
|
3
|
+
import { Form as Form$1, Modal, Drawer, message, notification, ConfigProvider, Typography, Spin, Descriptions, Input, Button, Row, Col, TimePicker, DatePicker, Switch, Select, InputNumber, Radio, Result, Skeleton, Table as Table$1, Tabs as Tabs$1, Alert, Space } from 'antd';
|
|
4
4
|
export { Drawer, Modal } from 'antd';
|
|
5
5
|
import { StyleProvider, legacyLogicalPropertiesTransformer } from '@ant-design/cssinjs';
|
|
6
6
|
import { createContext, useState, useMemo, useContext, useEffect, cloneElement, useCallback, isValidElement, Suspense } from 'react';
|
|
@@ -52,6 +52,28 @@ function useDrawer(init) {
|
|
|
52
52
|
}
|
|
53
53
|
};
|
|
54
54
|
}
|
|
55
|
+
function ErrorChildren(props) {
|
|
56
|
+
return /* @__PURE__ */ jsx(
|
|
57
|
+
Alert,
|
|
58
|
+
{
|
|
59
|
+
type: "error",
|
|
60
|
+
message: props.errorMessage,
|
|
61
|
+
description: /* @__PURE__ */ jsx(
|
|
62
|
+
"pre",
|
|
63
|
+
{
|
|
64
|
+
style: {
|
|
65
|
+
fontSize: "0.9em",
|
|
66
|
+
overflowX: "auto"
|
|
67
|
+
},
|
|
68
|
+
children: props.errorDescription
|
|
69
|
+
}
|
|
70
|
+
)
|
|
71
|
+
}
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
function ErrorBoundary(props) {
|
|
75
|
+
return /* @__PURE__ */ jsx(ErrorBoundary$1, { errorChildren: /* @__PURE__ */ jsx(ErrorChildren, {}), ...props });
|
|
76
|
+
}
|
|
55
77
|
var AppContext = createContext({
|
|
56
78
|
message: {},
|
|
57
79
|
notification: {},
|
|
@@ -89,13 +111,13 @@ function App(props) {
|
|
|
89
111
|
hashPriority: "high",
|
|
90
112
|
transformers: [legacyLogicalPropertiesTransformer]
|
|
91
113
|
}),
|
|
92
|
-
children: /* @__PURE__ */ jsx(ConfigProvider, { ...props.configProviderProps, children: /* @__PURE__ */ jsx(AppContext.Provider, { value: memoizedContextValue, children: /* @__PURE__ */ jsxs(BrowserRouter, { ...props.browserRouterProps, children: [
|
|
114
|
+
children: /* @__PURE__ */ jsx(ConfigProvider, { ...props.configProviderProps, children: /* @__PURE__ */ jsx(AppContext.Provider, { value: memoizedContextValue, children: /* @__PURE__ */ jsx(ErrorBoundary, { ...props.errorBoundaryProps, children: /* @__PURE__ */ jsxs(BrowserRouter, { ...props.browserRouterProps, children: [
|
|
93
115
|
messageContextHolder,
|
|
94
116
|
notificationContextHolder,
|
|
95
117
|
modal,
|
|
96
118
|
drawer,
|
|
97
119
|
/* @__PURE__ */ jsx(RoutesApp, { children: props.children })
|
|
98
|
-
] }) }) })
|
|
120
|
+
] }) }) }) })
|
|
99
121
|
}
|
|
100
122
|
);
|
|
101
123
|
}
|
|
@@ -393,28 +415,6 @@ function Description(props) {
|
|
|
393
415
|
}
|
|
394
416
|
);
|
|
395
417
|
}
|
|
396
|
-
function ErrorChildren(props) {
|
|
397
|
-
return /* @__PURE__ */ jsx(
|
|
398
|
-
Alert,
|
|
399
|
-
{
|
|
400
|
-
type: "error",
|
|
401
|
-
message: props.errorMessage,
|
|
402
|
-
description: /* @__PURE__ */ jsx(
|
|
403
|
-
"pre",
|
|
404
|
-
{
|
|
405
|
-
style: {
|
|
406
|
-
fontSize: "0.9em",
|
|
407
|
-
overflowX: "auto"
|
|
408
|
-
},
|
|
409
|
-
children: props.errorDescription
|
|
410
|
-
}
|
|
411
|
-
)
|
|
412
|
-
}
|
|
413
|
-
);
|
|
414
|
-
}
|
|
415
|
-
function ErrorBoundary(props) {
|
|
416
|
-
return /* @__PURE__ */ jsx(ErrorBoundary$1, { errorChildren: /* @__PURE__ */ jsx(ErrorChildren, {}), ...props });
|
|
417
|
-
}
|
|
418
418
|
function processProps(propsCopy, config) {
|
|
419
419
|
if (!propsCopy.title)
|
|
420
420
|
propsCopy.title = upperFirst(propsCopy.id);
|
|
@@ -986,7 +986,7 @@ function Table(props) {
|
|
|
986
986
|
const [columns, setColumns] = useState();
|
|
987
987
|
const { common: common2 } = useConfigContext();
|
|
988
988
|
const generateFilterDropdown = (item) => {
|
|
989
|
-
if (
|
|
989
|
+
if (item.filterDropdown && item.filterDropdown !== true)
|
|
990
990
|
return;
|
|
991
991
|
if (item.options.length < 11) {
|
|
992
992
|
if (!item.filters)
|
|
@@ -1085,7 +1085,7 @@ function Table(props) {
|
|
|
1085
1085
|
case "string":
|
|
1086
1086
|
if (!item.render)
|
|
1087
1087
|
item.render = (value) => processValue(item, value);
|
|
1088
|
-
if (
|
|
1088
|
+
if (item.filterDropdown !== false) {
|
|
1089
1089
|
if (!item.onFilter)
|
|
1090
1090
|
item.onFilter = (value, row) => {
|
|
1091
1091
|
if (!value || isNil(value))
|
|
@@ -1094,7 +1094,7 @@ function Table(props) {
|
|
|
1094
1094
|
return false;
|
|
1095
1095
|
return row[item.id].trim().toLowerCase().includes(value.trim().toLowerCase());
|
|
1096
1096
|
};
|
|
1097
|
-
if (!item.filters && item.optionsType !== "auto")
|
|
1097
|
+
if (typeof item.filterDropdown === "undefined" && !item.filters && item.optionsType !== "auto")
|
|
1098
1098
|
item.filterDropdown = ({
|
|
1099
1099
|
setSelectedKeys,
|
|
1100
1100
|
confirm,
|
|
@@ -1120,7 +1120,7 @@ function Table(props) {
|
|
|
1120
1120
|
case "string[]":
|
|
1121
1121
|
if (!item.render)
|
|
1122
1122
|
item.render = (value) => processValue(item, value);
|
|
1123
|
-
if (
|
|
1123
|
+
if (item.filterDropdown !== false) {
|
|
1124
1124
|
if (!item.onFilter)
|
|
1125
1125
|
item.onFilter = (value, row) => {
|
|
1126
1126
|
if (value === null && (!row[item.id] || !row[item.id].length))
|
|
@@ -1131,7 +1131,7 @@ function Table(props) {
|
|
|
1131
1131
|
(v) => v.trim().toLowerCase().includes(value.trim().toLowerCase())
|
|
1132
1132
|
);
|
|
1133
1133
|
};
|
|
1134
|
-
if (!item.filters && item.optionsType !== "auto")
|
|
1134
|
+
if (typeof item.filterDropdown === "undefined" && !item.filters && item.optionsType !== "auto")
|
|
1135
1135
|
item.filterDropdown = ({
|
|
1136
1136
|
setSelectedKeys,
|
|
1137
1137
|
confirm,
|
|
@@ -1159,7 +1159,7 @@ function Table(props) {
|
|
|
1159
1159
|
item.render = (value) => processValue(item, value);
|
|
1160
1160
|
if (typeof item.sorter === "undefined")
|
|
1161
1161
|
item.sorter = (a, b) => a[item.id] - b[item.id];
|
|
1162
|
-
if (
|
|
1162
|
+
if (item.filterDropdown !== false) {
|
|
1163
1163
|
if (!item.onFilter)
|
|
1164
1164
|
item.onFilter = (value, row) => {
|
|
1165
1165
|
if (value === null)
|
|
@@ -1168,7 +1168,7 @@ function Table(props) {
|
|
|
1168
1168
|
return false;
|
|
1169
1169
|
return value == row[item.id];
|
|
1170
1170
|
};
|
|
1171
|
-
if (!item.filters)
|
|
1171
|
+
if (typeof item.filterDropdown === "undefined" && !item.filters)
|
|
1172
1172
|
item.filterDropdown = ({
|
|
1173
1173
|
setSelectedKeys,
|
|
1174
1174
|
confirm,
|
|
@@ -1194,7 +1194,7 @@ function Table(props) {
|
|
|
1194
1194
|
case "number[]":
|
|
1195
1195
|
if (!item.render)
|
|
1196
1196
|
item.render = (value) => processValue(item, value).join(", ");
|
|
1197
|
-
if (
|
|
1197
|
+
if (item.filterDropdown !== false) {
|
|
1198
1198
|
if (!item.onFilter)
|
|
1199
1199
|
item.onFilter = (value, row) => {
|
|
1200
1200
|
if (value === null && (!row[item.id] || !row[item.id].length))
|
|
@@ -1203,7 +1203,7 @@ function Table(props) {
|
|
|
1203
1203
|
return false;
|
|
1204
1204
|
return row[item.id].includes(Number(value));
|
|
1205
1205
|
};
|
|
1206
|
-
if (!item.filters)
|
|
1206
|
+
if (typeof item.filterDropdown === "undefined" && !item.filters)
|
|
1207
1207
|
item.filterDropdown = ({
|
|
1208
1208
|
setSelectedKeys,
|
|
1209
1209
|
confirm,
|
|
@@ -1245,52 +1245,53 @@ function Table(props) {
|
|
|
1245
1245
|
}
|
|
1246
1246
|
}
|
|
1247
1247
|
);
|
|
1248
|
-
if (
|
|
1249
|
-
item.filterDropdown
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1248
|
+
if (item.filterDropdown !== false) {
|
|
1249
|
+
if (typeof item.filterDropdown === "undefined")
|
|
1250
|
+
item.filterDropdown = ({
|
|
1251
|
+
setSelectedKeys,
|
|
1252
|
+
selectedKeys,
|
|
1253
|
+
confirm
|
|
1254
|
+
}) => /* @__PURE__ */ jsxs(
|
|
1255
|
+
Radio.Group,
|
|
1256
|
+
{
|
|
1257
|
+
style: { padding: 8 },
|
|
1258
|
+
buttonStyle: "solid",
|
|
1259
|
+
value: JSON.stringify(selectedKeys[0]),
|
|
1260
|
+
onChange: (e) => {
|
|
1261
|
+
const Values = {
|
|
1262
|
+
true: true,
|
|
1263
|
+
false: false,
|
|
1264
|
+
null: null
|
|
1265
|
+
};
|
|
1266
|
+
setSelectedKeys(
|
|
1267
|
+
e.target.value ? [Values[e.target.value]] : []
|
|
1268
|
+
);
|
|
1269
|
+
confirm();
|
|
1270
|
+
},
|
|
1271
|
+
children: [
|
|
1272
|
+
/* @__PURE__ */ jsx(Radio.Button, { children: common2.all }),
|
|
1273
|
+
/* @__PURE__ */ jsx(Radio.Button, { value: "true", children: /* @__PURE__ */ jsx(
|
|
1274
|
+
CheckOutlined,
|
|
1275
|
+
{
|
|
1276
|
+
style: {
|
|
1277
|
+
color: "#52c41a",
|
|
1278
|
+
verticalAlign: "middle"
|
|
1279
|
+
}
|
|
1278
1280
|
}
|
|
1279
|
-
}
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1281
|
+
) }),
|
|
1282
|
+
/* @__PURE__ */ jsx(Radio.Button, { value: "false", children: /* @__PURE__ */ jsx(
|
|
1283
|
+
CloseOutlined,
|
|
1284
|
+
{
|
|
1285
|
+
style: {
|
|
1286
|
+
verticalAlign: "middle",
|
|
1287
|
+
color: "#ff4d4f"
|
|
1288
|
+
}
|
|
1287
1289
|
}
|
|
1288
|
-
}
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
);
|
|
1290
|
+
) }),
|
|
1291
|
+
/* @__PURE__ */ jsx(Radio.Button, { value: "null", children: common2.blank })
|
|
1292
|
+
]
|
|
1293
|
+
}
|
|
1294
|
+
);
|
|
1294
1295
|
if (!item.onFilter)
|
|
1295
1296
|
item.onFilter = (value, row) => {
|
|
1296
1297
|
switch (value) {
|
|
@@ -1315,23 +1316,24 @@ function Table(props) {
|
|
|
1315
1316
|
return order === "ascend" ? -1 : 1;
|
|
1316
1317
|
return new Date(a[item.id]).getTime() < new Date(b[item.id]).getTime() ? -1 : 1;
|
|
1317
1318
|
};
|
|
1318
|
-
if (
|
|
1319
|
-
item.filterDropdown
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
(
|
|
1325
|
-
[
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1319
|
+
if (item.filterDropdown !== false) {
|
|
1320
|
+
if (typeof item.filterDropdown === "undefined")
|
|
1321
|
+
item.filterDropdown = ({ setSelectedKeys, confirm }) => /* @__PURE__ */ jsx(
|
|
1322
|
+
DatePicker.RangePicker,
|
|
1323
|
+
{
|
|
1324
|
+
onChange: (dates) => {
|
|
1325
|
+
setSelectedKeys(
|
|
1326
|
+
(dates == null ? void 0 : dates[0]) && dates[1] ? [
|
|
1327
|
+
[
|
|
1328
|
+
dates[0].startOf("day").toISOString(),
|
|
1329
|
+
dates[1].endOf("day").toISOString()
|
|
1330
|
+
]
|
|
1331
|
+
] : []
|
|
1332
|
+
);
|
|
1333
|
+
confirm();
|
|
1334
|
+
}
|
|
1332
1335
|
}
|
|
1333
|
-
|
|
1334
|
-
);
|
|
1336
|
+
);
|
|
1335
1337
|
if (!item.onFilter)
|
|
1336
1338
|
item.onFilter = (value, row) => {
|
|
1337
1339
|
if (isNil(value[0]))
|
|
@@ -1353,23 +1355,24 @@ function Table(props) {
|
|
|
1353
1355
|
return order === "ascend" ? -1 : 1;
|
|
1354
1356
|
return new Date(a[item.id]).getTime() < new Date(b[item.id]).getTime() ? -1 : 1;
|
|
1355
1357
|
};
|
|
1356
|
-
if (
|
|
1357
|
-
item.filterDropdown
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
(
|
|
1363
|
-
[
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1358
|
+
if (item.filterDropdown !== false) {
|
|
1359
|
+
if (typeof item.filterDropdown === "undefined")
|
|
1360
|
+
item.filterDropdown = ({ setSelectedKeys, confirm }) => /* @__PURE__ */ jsx(
|
|
1361
|
+
DatePicker.RangePicker,
|
|
1362
|
+
{
|
|
1363
|
+
onChange: (dates) => {
|
|
1364
|
+
setSelectedKeys(
|
|
1365
|
+
(dates == null ? void 0 : dates[0]) && dates[1] ? [
|
|
1366
|
+
[
|
|
1367
|
+
dates[0].startOf("day").toISOString(),
|
|
1368
|
+
dates[1].endOf("day").toISOString()
|
|
1369
|
+
]
|
|
1370
|
+
] : []
|
|
1371
|
+
);
|
|
1372
|
+
confirm();
|
|
1373
|
+
}
|
|
1370
1374
|
}
|
|
1371
|
-
|
|
1372
|
-
);
|
|
1375
|
+
);
|
|
1373
1376
|
if (!item.onFilter)
|
|
1374
1377
|
item.onFilter = (value, row) => {
|
|
1375
1378
|
if (isNil(value[0]))
|
|
@@ -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 (
|
|
1412
|
+
if (item.filterDropdown !== false && !item.onFilter)
|
|
1410
1413
|
item.onFilter = (value, row) => {
|
|
1411
1414
|
if (value === null && isNil(row[item.id]))
|
|
1412
1415
|
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.15",
|
|
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.15",
|
|
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.15",
|
|
41
41
|
"antd": "*",
|
|
42
42
|
"react": "*",
|
|
43
43
|
"react-dom": "*",
|