@faasjs/ant-design 0.0.2-beta.394 → 0.0.2-beta.397
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 +44 -32
- package/dist/index.d.ts +4 -7
- package/dist/index.js +486 -270
- package/dist/index.mjs +481 -272
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,26 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
var __create = Object.create;
|
|
2
3
|
var __defProp = Object.defineProperty;
|
|
3
|
-
var __defProps = Object.defineProperties;
|
|
4
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
6
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
8
6
|
var __getProtoOf = Object.getPrototypeOf;
|
|
9
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
10
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
11
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
12
|
-
var __spreadValues = (a, b) => {
|
|
13
|
-
for (var prop in b || (b = {}))
|
|
14
|
-
if (__hasOwnProp.call(b, prop))
|
|
15
|
-
__defNormalProp(a, prop, b[prop]);
|
|
16
|
-
if (__getOwnPropSymbols)
|
|
17
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
18
|
-
if (__propIsEnum.call(b, prop))
|
|
19
|
-
__defNormalProp(a, prop, b[prop]);
|
|
20
|
-
}
|
|
21
|
-
return a;
|
|
22
|
-
};
|
|
23
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
24
8
|
var __export = (target, all) => {
|
|
25
9
|
for (var name in all)
|
|
26
10
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -33,7 +17,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
33
17
|
}
|
|
34
18
|
return to;
|
|
35
19
|
};
|
|
36
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
|
+
mod
|
|
23
|
+
));
|
|
37
24
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
38
25
|
|
|
39
26
|
// src/index.ts
|
|
@@ -69,6 +56,7 @@ var import_lodash = require("lodash");
|
|
|
69
56
|
|
|
70
57
|
// src/Config.tsx
|
|
71
58
|
var import_react2 = require("react");
|
|
59
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
72
60
|
var isZH = /^zh/i.test(navigator.language);
|
|
73
61
|
var common = isZH ? {
|
|
74
62
|
lang: "zh",
|
|
@@ -104,20 +92,26 @@ function ConfigProvider({
|
|
|
104
92
|
config,
|
|
105
93
|
children
|
|
106
94
|
}) {
|
|
107
|
-
return /* @__PURE__ */
|
|
108
|
-
value:
|
|
109
|
-
|
|
95
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ConfigContext.Provider, {
|
|
96
|
+
value: {
|
|
97
|
+
...baseConfig,
|
|
98
|
+
...config
|
|
99
|
+
},
|
|
100
|
+
children
|
|
101
|
+
});
|
|
110
102
|
}
|
|
111
103
|
function useConfigContext() {
|
|
112
104
|
return (0, import_react2.useContext)(ConfigContext);
|
|
113
105
|
}
|
|
114
106
|
|
|
115
107
|
// src/Blank.tsx
|
|
108
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
116
109
|
function Blank(options) {
|
|
117
110
|
const config = useConfigContext();
|
|
118
|
-
return !options || (0, import_lodash.isNil)(options.value) || Array.isArray(options.value) && !options.value.length || options.value === "" ? /* @__PURE__ */
|
|
119
|
-
disabled: true
|
|
120
|
-
|
|
111
|
+
return !options || (0, import_lodash.isNil)(options.value) || Array.isArray(options.value) && !options.value.length || options.value === "" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd.Typography.Text, {
|
|
112
|
+
disabled: true,
|
|
113
|
+
children: (options == null ? void 0 : options.text) || config.Blank.text
|
|
114
|
+
}) : options.value;
|
|
121
115
|
}
|
|
122
116
|
|
|
123
117
|
// src/Calendar.tsx
|
|
@@ -150,11 +144,12 @@ var import_lodash3 = require("lodash");
|
|
|
150
144
|
var import_react3 = require("react");
|
|
151
145
|
var import_dayjs3 = __toESM(require("dayjs"));
|
|
152
146
|
var import_react4 = require("@faasjs/react");
|
|
147
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
153
148
|
function DescriptionItemContent(props) {
|
|
154
149
|
const [computedProps, setComputedProps] = (0, import_react3.useState)();
|
|
155
150
|
(0, import_react3.useEffect)(() => {
|
|
156
151
|
var _a, _b;
|
|
157
|
-
const propsCopy =
|
|
152
|
+
const propsCopy = { ...props };
|
|
158
153
|
if (!propsCopy.item.title)
|
|
159
154
|
propsCopy.item.title = (0, import_lodash3.upperFirst)(propsCopy.item.id);
|
|
160
155
|
if (!propsCopy.item.type)
|
|
@@ -181,89 +176,119 @@ function DescriptionItemContent(props) {
|
|
|
181
176
|
return null;
|
|
182
177
|
if (computedProps.extendTypes && computedProps.extendTypes[computedProps.item.type])
|
|
183
178
|
if (computedProps.extendTypes[computedProps.item.type].children)
|
|
184
|
-
return (0, import_react3.cloneElement)(
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
179
|
+
return (0, import_react3.cloneElement)(
|
|
180
|
+
computedProps.extendTypes[computedProps.item.type].children,
|
|
181
|
+
{
|
|
182
|
+
value: computedProps.value,
|
|
183
|
+
values: computedProps.values
|
|
184
|
+
}
|
|
185
|
+
);
|
|
188
186
|
else if (computedProps.extendTypes[computedProps.item.type].render)
|
|
189
|
-
return /* @__PURE__ */
|
|
187
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, {
|
|
188
|
+
children: computedProps.extendTypes[computedProps.item.type].render(computedProps.value, computedProps.values)
|
|
189
|
+
});
|
|
190
190
|
else
|
|
191
191
|
throw Error(computedProps.item.type + " requires children or render");
|
|
192
192
|
if (computedProps.item.children)
|
|
193
193
|
return (0, import_react3.cloneElement)(computedProps.item.children, { value: computedProps.value });
|
|
194
194
|
if (computedProps.item.render)
|
|
195
|
-
return /* @__PURE__ */
|
|
195
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, {
|
|
196
|
+
children: computedProps.item.render(computedProps.value, computedProps.values)
|
|
197
|
+
});
|
|
196
198
|
if (typeof computedProps.value === "undefined" || computedProps.value === null)
|
|
197
199
|
return null;
|
|
198
200
|
switch (computedProps.item.type) {
|
|
199
201
|
case "string[]":
|
|
200
|
-
return /* @__PURE__ */
|
|
202
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, {
|
|
203
|
+
children: computedProps.value.join(", ")
|
|
204
|
+
});
|
|
201
205
|
case "number":
|
|
202
206
|
return computedProps.value || null;
|
|
203
207
|
case "number[]":
|
|
204
|
-
return /* @__PURE__ */
|
|
208
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, {
|
|
209
|
+
children: computedProps.value.join(", ")
|
|
210
|
+
});
|
|
205
211
|
case "boolean":
|
|
206
|
-
return computedProps.value ? /* @__PURE__ */
|
|
212
|
+
return computedProps.value ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons.CheckOutlined, {
|
|
207
213
|
style: {
|
|
208
214
|
marginTop: "4px",
|
|
209
215
|
color: "#52c41a"
|
|
210
216
|
}
|
|
211
|
-
}) : /* @__PURE__ */
|
|
217
|
+
}) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons.CloseOutlined, {
|
|
212
218
|
style: {
|
|
213
219
|
marginTop: "4px",
|
|
214
220
|
color: "#ff4d4f"
|
|
215
221
|
}
|
|
216
222
|
});
|
|
217
223
|
case "time":
|
|
218
|
-
return /* @__PURE__ */
|
|
224
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, {
|
|
225
|
+
children: typeof computedProps.value === "number" && computedProps.value.toString().length === 10 ? import_dayjs3.default.unix(computedProps.value).format("YYYY-MM-DD HH:mm:ss") : (0, import_dayjs3.default)(computedProps.value).format("YYYY-MM-DD HH:mm:ss")
|
|
226
|
+
});
|
|
219
227
|
case "date":
|
|
220
|
-
return /* @__PURE__ */
|
|
228
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, {
|
|
229
|
+
children: typeof computedProps.value === "number" && computedProps.value.toString().length === 10 ? import_dayjs3.default.unix(computedProps.value).format("YYYY-MM-DD") : (0, import_dayjs3.default)(computedProps.value).format("YYYY-MM-DD")
|
|
230
|
+
});
|
|
221
231
|
default:
|
|
222
232
|
return computedProps.value || null;
|
|
223
233
|
}
|
|
224
234
|
}
|
|
225
235
|
function Description(props) {
|
|
226
236
|
if (!props.faasData)
|
|
227
|
-
return /* @__PURE__ */
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
237
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd2.Descriptions, {
|
|
238
|
+
...props,
|
|
239
|
+
children: props.items.map((item) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd2.Descriptions.Item, {
|
|
240
|
+
label: item.title || (0, import_lodash3.upperFirst)(item.id),
|
|
241
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DescriptionItemContent, {
|
|
242
|
+
item,
|
|
243
|
+
value: props.dataSource[item.id],
|
|
244
|
+
values: props.dataSource,
|
|
245
|
+
extendTypes: props.extendTypes
|
|
246
|
+
})
|
|
247
|
+
}, item.id))
|
|
248
|
+
});
|
|
249
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react4.FaasDataWrapper, {
|
|
250
|
+
fallback: props.faasData.fallback || /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd2.Skeleton, {
|
|
238
251
|
active: true
|
|
239
252
|
}),
|
|
240
|
-
render: ({ data }) => /* @__PURE__ */
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
253
|
+
render: ({ data }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd2.Descriptions, {
|
|
254
|
+
...props,
|
|
255
|
+
children: props.items.map((item) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd2.Descriptions.Item, {
|
|
256
|
+
label: item.title || (0, import_lodash3.upperFirst)(item.id),
|
|
257
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DescriptionItemContent, {
|
|
258
|
+
item,
|
|
259
|
+
value: data[item.id],
|
|
260
|
+
values: data,
|
|
261
|
+
extendTypes: props.extendTypes
|
|
262
|
+
})
|
|
263
|
+
}, item.id))
|
|
264
|
+
}),
|
|
265
|
+
...props.faasData
|
|
266
|
+
});
|
|
250
267
|
}
|
|
251
268
|
|
|
252
269
|
// src/Drawer.tsx
|
|
253
270
|
var import_antd3 = require("antd");
|
|
254
271
|
var import_react5 = require("react");
|
|
272
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
255
273
|
function useDrawer(init) {
|
|
256
|
-
const [props, setProps] = (0, import_react5.useState)(
|
|
274
|
+
const [props, setProps] = (0, import_react5.useState)({
|
|
257
275
|
visible: false,
|
|
258
|
-
onClose: () => setProps((prev) =>
|
|
276
|
+
onClose: () => setProps((prev) => ({
|
|
277
|
+
...prev,
|
|
259
278
|
visible: false
|
|
260
|
-
}))
|
|
261
|
-
|
|
279
|
+
})),
|
|
280
|
+
...init
|
|
281
|
+
});
|
|
262
282
|
return {
|
|
263
|
-
drawer: /* @__PURE__ */
|
|
283
|
+
drawer: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd3.Drawer, {
|
|
284
|
+
...props
|
|
285
|
+
}),
|
|
264
286
|
drawerProps: props,
|
|
265
287
|
setDrawerProps(changes) {
|
|
266
|
-
setProps((prev) =>
|
|
288
|
+
setProps((prev) => ({
|
|
289
|
+
...prev,
|
|
290
|
+
...changes
|
|
291
|
+
}));
|
|
267
292
|
}
|
|
268
293
|
};
|
|
269
294
|
}
|
|
@@ -281,16 +306,19 @@ var import_lodash4 = require("lodash");
|
|
|
281
306
|
|
|
282
307
|
// src/TimePicker.tsx
|
|
283
308
|
var import_react6 = require("react");
|
|
309
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
284
310
|
var TimePicker = (0, import_react6.forwardRef)((props, ref) => {
|
|
285
|
-
return /* @__PURE__ */
|
|
311
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DatePicker, {
|
|
312
|
+
...props,
|
|
286
313
|
picker: "time",
|
|
287
314
|
mode: void 0,
|
|
288
315
|
ref
|
|
289
|
-
})
|
|
316
|
+
});
|
|
290
317
|
});
|
|
291
318
|
TimePicker.displayName = "TimePicker";
|
|
292
319
|
|
|
293
320
|
// src/FormItem.tsx
|
|
321
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
294
322
|
function processProps(propsCopy, config) {
|
|
295
323
|
if (!propsCopy.title)
|
|
296
324
|
propsCopy.title = (0, import_lodash4.upperFirst)(propsCopy.id);
|
|
@@ -342,159 +370,289 @@ function FormItem(props) {
|
|
|
342
370
|
const [computedProps, setComputedProps] = (0, import_react7.useState)();
|
|
343
371
|
const config = useConfigContext();
|
|
344
372
|
(0, import_react7.useEffect)(() => {
|
|
345
|
-
setComputedProps(processProps(
|
|
373
|
+
setComputedProps(processProps({ ...props }, config));
|
|
346
374
|
}, [props]);
|
|
347
375
|
if (!computedProps)
|
|
348
376
|
return null;
|
|
349
377
|
if (computedProps.extendTypes && computedProps.extendTypes[computedProps.type])
|
|
350
|
-
return /* @__PURE__ */
|
|
378
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Form.Item, {
|
|
379
|
+
...computedProps,
|
|
380
|
+
children: computedProps.extendTypes[computedProps.type].children
|
|
381
|
+
});
|
|
351
382
|
if (computedProps.children)
|
|
352
|
-
return /* @__PURE__ */
|
|
383
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Form.Item, {
|
|
384
|
+
...computedProps,
|
|
385
|
+
children: computedProps.children
|
|
386
|
+
});
|
|
353
387
|
if (computedProps.render)
|
|
354
|
-
return /* @__PURE__ */
|
|
388
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Form.Item, {
|
|
389
|
+
...computedProps,
|
|
390
|
+
children: computedProps.render()
|
|
391
|
+
});
|
|
355
392
|
switch (computedProps.type) {
|
|
356
393
|
case "string":
|
|
357
|
-
return /* @__PURE__ */
|
|
394
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Form.Item, {
|
|
395
|
+
...computedProps,
|
|
396
|
+
children: computedProps.options ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Select, {
|
|
397
|
+
...computedProps.input
|
|
398
|
+
}) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Input, {
|
|
399
|
+
...computedProps.input
|
|
400
|
+
})
|
|
401
|
+
});
|
|
358
402
|
case "string[]":
|
|
359
403
|
if (computedProps.options)
|
|
360
|
-
return /* @__PURE__ */
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
404
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Form.Item, {
|
|
405
|
+
...computedProps,
|
|
406
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Select, {
|
|
407
|
+
mode: "multiple",
|
|
408
|
+
...computedProps.input
|
|
409
|
+
})
|
|
410
|
+
});
|
|
411
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Form.List, {
|
|
364
412
|
name: computedProps.name,
|
|
365
|
-
rules: computedProps.rules
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
413
|
+
rules: computedProps.rules,
|
|
414
|
+
children: (fields, { add, remove }, { errors }) => {
|
|
415
|
+
var _a2;
|
|
416
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, {
|
|
417
|
+
children: [
|
|
418
|
+
computedProps.label && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
419
|
+
className: "ant-form-item-label",
|
|
420
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("label", {
|
|
421
|
+
className: computedProps.rules.find((r) => r.required) && "ant-form-item-required",
|
|
422
|
+
children: computedProps.label
|
|
423
|
+
})
|
|
424
|
+
}),
|
|
425
|
+
fields.map((field) => {
|
|
426
|
+
var _a3;
|
|
427
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Form.Item, {
|
|
428
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_antd4.Row, {
|
|
429
|
+
gutter: 24,
|
|
430
|
+
style: { flexFlow: "row nowrap" },
|
|
431
|
+
children: [
|
|
432
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Col, {
|
|
433
|
+
span: 23,
|
|
434
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Form.Item, {
|
|
435
|
+
...field,
|
|
436
|
+
noStyle: true,
|
|
437
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Input, {
|
|
438
|
+
...computedProps.input
|
|
439
|
+
})
|
|
440
|
+
})
|
|
441
|
+
}),
|
|
442
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Col, {
|
|
443
|
+
span: 1,
|
|
444
|
+
children: !((_a3 = computedProps.input) == null ? void 0 : _a3.disabled) && (!computedProps.rules.find((r) => r.required) || field.key > 0) && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Button, {
|
|
445
|
+
danger: true,
|
|
446
|
+
type: "link",
|
|
447
|
+
style: { float: "right" },
|
|
448
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons2.MinusCircleOutlined, {}),
|
|
449
|
+
onClick: () => remove(field.name)
|
|
450
|
+
})
|
|
451
|
+
})
|
|
452
|
+
]
|
|
453
|
+
})
|
|
454
|
+
}, field.key);
|
|
455
|
+
}),
|
|
456
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_antd4.Form.Item, {
|
|
457
|
+
children: [
|
|
458
|
+
!((_a2 = computedProps.input) == null ? void 0 : _a2.disabled) && (!computedProps.maxCount || computedProps.maxCount > fields.length) && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Button, {
|
|
459
|
+
type: "dashed",
|
|
460
|
+
block: true,
|
|
461
|
+
onClick: () => add(),
|
|
462
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons2.PlusOutlined, {})
|
|
463
|
+
}),
|
|
464
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Form.ErrorList, {
|
|
465
|
+
errors
|
|
466
|
+
})
|
|
467
|
+
]
|
|
468
|
+
})
|
|
469
|
+
]
|
|
470
|
+
});
|
|
471
|
+
}
|
|
400
472
|
});
|
|
401
473
|
case "number":
|
|
402
|
-
return /* @__PURE__ */
|
|
403
|
-
|
|
404
|
-
|
|
474
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Form.Item, {
|
|
475
|
+
...computedProps,
|
|
476
|
+
children: computedProps.options ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Select, {
|
|
477
|
+
...computedProps.input
|
|
478
|
+
}) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.InputNumber, {
|
|
479
|
+
style: { width: "100%" },
|
|
480
|
+
...computedProps.input
|
|
481
|
+
})
|
|
482
|
+
});
|
|
405
483
|
case "number[]":
|
|
406
484
|
if (computedProps.options)
|
|
407
|
-
return /* @__PURE__ */
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
485
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Form.Item, {
|
|
486
|
+
...computedProps,
|
|
487
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Select, {
|
|
488
|
+
mode: "multiple",
|
|
489
|
+
...computedProps.input
|
|
490
|
+
})
|
|
491
|
+
});
|
|
492
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Form.List, {
|
|
411
493
|
name: computedProps.name,
|
|
412
|
-
rules: computedProps.rules
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
494
|
+
rules: computedProps.rules,
|
|
495
|
+
children: (fields, { add, remove }, { errors }) => {
|
|
496
|
+
var _a2, _b;
|
|
497
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, {
|
|
498
|
+
children: [
|
|
499
|
+
computedProps.label && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
500
|
+
className: "ant-form-item-label",
|
|
501
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("label", {
|
|
502
|
+
className: ((_a2 = computedProps.rules) == null ? void 0 : _a2.find((r) => r.required)) && "ant-form-item-required",
|
|
503
|
+
children: computedProps.label
|
|
504
|
+
})
|
|
505
|
+
}),
|
|
506
|
+
fields.map((field) => {
|
|
507
|
+
var _a3;
|
|
508
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Form.Item, {
|
|
509
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_antd4.Row, {
|
|
510
|
+
gutter: 24,
|
|
511
|
+
style: { flexFlow: "row nowrap" },
|
|
512
|
+
children: [
|
|
513
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Col, {
|
|
514
|
+
span: 23,
|
|
515
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Form.Item, {
|
|
516
|
+
...field,
|
|
517
|
+
noStyle: true,
|
|
518
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.InputNumber, {
|
|
519
|
+
style: { width: "100%" },
|
|
520
|
+
...computedProps.input
|
|
521
|
+
})
|
|
522
|
+
})
|
|
523
|
+
}),
|
|
524
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Col, {
|
|
525
|
+
span: 1,
|
|
526
|
+
children: !((_a3 = computedProps.input) == null ? void 0 : _a3.disabled) && (!computedProps.rules.find((r) => r.required) || field.key > 0) && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Button, {
|
|
527
|
+
danger: true,
|
|
528
|
+
type: "link",
|
|
529
|
+
style: { float: "right" },
|
|
530
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons2.MinusCircleOutlined, {}),
|
|
531
|
+
onClick: () => remove(field.name)
|
|
532
|
+
})
|
|
533
|
+
})
|
|
534
|
+
]
|
|
535
|
+
})
|
|
536
|
+
}, field.key);
|
|
537
|
+
}),
|
|
538
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_antd4.Form.Item, {
|
|
539
|
+
children: [
|
|
540
|
+
!((_b = computedProps.input) == null ? void 0 : _b.disabled) && (!computedProps.maxCount || computedProps.maxCount > fields.length) && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Button, {
|
|
541
|
+
type: "dashed",
|
|
542
|
+
block: true,
|
|
543
|
+
onClick: () => add(),
|
|
544
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons2.PlusOutlined, {})
|
|
545
|
+
}),
|
|
546
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Form.ErrorList, {
|
|
547
|
+
errors
|
|
548
|
+
})
|
|
549
|
+
]
|
|
550
|
+
})
|
|
551
|
+
]
|
|
552
|
+
});
|
|
553
|
+
}
|
|
449
554
|
});
|
|
450
555
|
case "boolean":
|
|
451
|
-
return /* @__PURE__ */
|
|
556
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Form.Item, {
|
|
557
|
+
...computedProps,
|
|
558
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Switch, {
|
|
559
|
+
...computedProps.input
|
|
560
|
+
})
|
|
561
|
+
});
|
|
452
562
|
case "date":
|
|
453
|
-
return /* @__PURE__ */
|
|
563
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Form.Item, {
|
|
564
|
+
...computedProps,
|
|
565
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DatePicker, {
|
|
566
|
+
...computedProps.input
|
|
567
|
+
})
|
|
568
|
+
});
|
|
454
569
|
case "time":
|
|
455
|
-
return /* @__PURE__ */
|
|
570
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Form.Item, {
|
|
571
|
+
...computedProps,
|
|
572
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TimePicker, {
|
|
573
|
+
...computedProps.input
|
|
574
|
+
})
|
|
575
|
+
});
|
|
456
576
|
case "object":
|
|
457
|
-
return /* @__PURE__ */
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
577
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, {
|
|
578
|
+
children: [
|
|
579
|
+
computedProps.label && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
580
|
+
className: "ant-form-item-label",
|
|
581
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("label", {
|
|
582
|
+
className: ((_a = computedProps.rules) == null ? void 0 : _a.find((r) => r.required)) && "ant-form-item-required",
|
|
583
|
+
children: computedProps.label
|
|
584
|
+
})
|
|
585
|
+
}),
|
|
586
|
+
computedProps.object.map((o) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FormItem, {
|
|
587
|
+
...o
|
|
588
|
+
}, o.id))
|
|
589
|
+
]
|
|
590
|
+
});
|
|
464
591
|
case "object[]":
|
|
465
|
-
return /* @__PURE__ */
|
|
592
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Form.List, {
|
|
466
593
|
name: computedProps.name,
|
|
467
|
-
rules: computedProps.rules
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
594
|
+
rules: computedProps.rules,
|
|
595
|
+
children: (fields, { add, remove }, { errors }) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, {
|
|
596
|
+
children: [
|
|
597
|
+
fields.map((field) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_antd4.Form.Item, {
|
|
598
|
+
style: { marginBottom: 0 },
|
|
599
|
+
children: [
|
|
600
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
601
|
+
className: "ant-form-item-label",
|
|
602
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", {
|
|
603
|
+
children: [
|
|
604
|
+
computedProps.label,
|
|
605
|
+
" ",
|
|
606
|
+
field.name + 1,
|
|
607
|
+
!computedProps.disabled && (!computedProps.rules.find((r) => r.required) || field.key > 0) && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Button, {
|
|
608
|
+
danger: true,
|
|
609
|
+
type: "link",
|
|
610
|
+
onClick: () => remove(field.name),
|
|
611
|
+
children: config.common.delete
|
|
612
|
+
})
|
|
613
|
+
]
|
|
614
|
+
})
|
|
615
|
+
}),
|
|
616
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Row, {
|
|
617
|
+
gutter: 24,
|
|
618
|
+
children: computedProps.object.map((o) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Col, {
|
|
619
|
+
span: o.col || 6,
|
|
620
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FormItem, {
|
|
621
|
+
...o,
|
|
622
|
+
name: [field.name, o.id]
|
|
623
|
+
})
|
|
624
|
+
}, o.id))
|
|
625
|
+
})
|
|
626
|
+
]
|
|
627
|
+
}, field.key)),
|
|
628
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_antd4.Form.Item, {
|
|
629
|
+
children: [
|
|
630
|
+
!computedProps.disabled && (!computedProps.maxCount || computedProps.maxCount > fields.length) && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_antd4.Button, {
|
|
631
|
+
type: "dashed",
|
|
632
|
+
block: true,
|
|
633
|
+
onClick: () => add(),
|
|
634
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons2.PlusOutlined, {}),
|
|
635
|
+
children: [
|
|
636
|
+
config.common.add,
|
|
637
|
+
" ",
|
|
638
|
+
computedProps.label
|
|
639
|
+
]
|
|
640
|
+
}),
|
|
641
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Form.ErrorList, {
|
|
642
|
+
errors
|
|
643
|
+
})
|
|
644
|
+
]
|
|
645
|
+
})
|
|
646
|
+
]
|
|
647
|
+
})
|
|
648
|
+
});
|
|
492
649
|
default:
|
|
493
650
|
return null;
|
|
494
651
|
}
|
|
495
652
|
}
|
|
496
653
|
|
|
497
654
|
// src/Form.tsx
|
|
655
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
498
656
|
function Form(props) {
|
|
499
657
|
var _a, _b;
|
|
500
658
|
const [loading, setLoading] = (0, import_react9.useState)(false);
|
|
@@ -502,14 +660,17 @@ function Form(props) {
|
|
|
502
660
|
const config = useConfigContext();
|
|
503
661
|
(0, import_react9.useEffect)(() => {
|
|
504
662
|
var _a2;
|
|
505
|
-
const propsCopy =
|
|
663
|
+
const propsCopy = { ...props };
|
|
506
664
|
if (propsCopy.onFinish) {
|
|
507
665
|
propsCopy.onFinish = async (values) => {
|
|
508
666
|
var _a3;
|
|
509
667
|
setLoading(true);
|
|
510
668
|
try {
|
|
511
669
|
if (propsCopy.submit && ((_a3 = propsCopy.submit.to) == null ? void 0 : _a3.action)) {
|
|
512
|
-
await props.onFinish(values, async (values2) => (0, import_react8.faas)(propsCopy.submit.to.action, propsCopy.submit.to.params ?
|
|
670
|
+
await props.onFinish(values, async (values2) => (0, import_react8.faas)(propsCopy.submit.to.action, propsCopy.submit.to.params ? {
|
|
671
|
+
...values2,
|
|
672
|
+
...propsCopy.submit.to.params
|
|
673
|
+
} : values2));
|
|
513
674
|
} else
|
|
514
675
|
await props.onFinish(values);
|
|
515
676
|
} catch (error) {
|
|
@@ -519,22 +680,34 @@ function Form(props) {
|
|
|
519
680
|
};
|
|
520
681
|
} else if (propsCopy.submit && ((_a2 = propsCopy.submit.to) == null ? void 0 : _a2.action)) {
|
|
521
682
|
propsCopy.onFinish = async (values) => {
|
|
522
|
-
return await (0, import_react8.faas)(propsCopy.submit.to.action, propsCopy.submit.to.params ?
|
|
683
|
+
return await (0, import_react8.faas)(propsCopy.submit.to.action, propsCopy.submit.to.params ? {
|
|
684
|
+
...values,
|
|
685
|
+
...propsCopy.submit.to.params
|
|
686
|
+
} : values);
|
|
523
687
|
};
|
|
524
688
|
}
|
|
525
689
|
setComputedProps(propsCopy);
|
|
526
690
|
}, []);
|
|
527
691
|
if (!computedProps)
|
|
528
692
|
return null;
|
|
529
|
-
return /* @__PURE__ */
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
693
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_antd5.Form, {
|
|
694
|
+
...computedProps,
|
|
695
|
+
children: [
|
|
696
|
+
computedProps.beforeItems,
|
|
697
|
+
(_a = computedProps.items) == null ? void 0 : _a.map((item) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FormItem, {
|
|
698
|
+
...item,
|
|
699
|
+
extendTypes: computedProps.extendTypes
|
|
700
|
+
}, item.id)),
|
|
701
|
+
computedProps.children,
|
|
702
|
+
computedProps.submit !== false && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Button, {
|
|
703
|
+
htmlType: "submit",
|
|
704
|
+
type: "primary",
|
|
705
|
+
loading,
|
|
706
|
+
children: ((_b = computedProps.submit) == null ? void 0 : _b.text) || config.Form.submit.text
|
|
707
|
+
}),
|
|
708
|
+
computedProps.footer
|
|
709
|
+
]
|
|
710
|
+
});
|
|
538
711
|
}
|
|
539
712
|
Form.useForm = import_antd5.Form.useForm;
|
|
540
713
|
Form.Item = FormItem;
|
|
@@ -542,18 +715,26 @@ Form.Item = FormItem;
|
|
|
542
715
|
// src/Modal.tsx
|
|
543
716
|
var import_antd6 = require("antd");
|
|
544
717
|
var import_react10 = require("react");
|
|
718
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
545
719
|
function useModal(init) {
|
|
546
|
-
const [props, setProps] = (0, import_react10.useState)(
|
|
720
|
+
const [props, setProps] = (0, import_react10.useState)({
|
|
547
721
|
visible: false,
|
|
548
|
-
onCancel: () => setProps((prev) =>
|
|
722
|
+
onCancel: () => setProps((prev) => ({
|
|
723
|
+
...prev,
|
|
549
724
|
visible: false
|
|
550
|
-
}))
|
|
551
|
-
|
|
725
|
+
})),
|
|
726
|
+
...init
|
|
727
|
+
});
|
|
552
728
|
return {
|
|
553
|
-
modal: /* @__PURE__ */
|
|
729
|
+
modal: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd6.Modal, {
|
|
730
|
+
...props
|
|
731
|
+
}),
|
|
554
732
|
modalProps: props,
|
|
555
733
|
setModalProps(changes) {
|
|
556
|
-
setProps((prev) =>
|
|
734
|
+
setProps((prev) => ({
|
|
735
|
+
...prev,
|
|
736
|
+
...changes
|
|
737
|
+
}));
|
|
557
738
|
}
|
|
558
739
|
};
|
|
559
740
|
}
|
|
@@ -562,29 +743,35 @@ function useModal(init) {
|
|
|
562
743
|
var import_antd7 = require("antd");
|
|
563
744
|
var import_react11 = require("react");
|
|
564
745
|
var import_react_router_dom = require("react-router-dom");
|
|
746
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
565
747
|
function NotFound() {
|
|
566
748
|
const config = useConfigContext();
|
|
567
|
-
return /* @__PURE__ */
|
|
749
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd7.Result, {
|
|
568
750
|
status: "404",
|
|
569
751
|
title: config.common.pageNotFound
|
|
570
752
|
});
|
|
571
753
|
}
|
|
572
754
|
function Routes(props) {
|
|
573
|
-
return /* @__PURE__ */
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
755
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_react_router_dom.Routes, {
|
|
756
|
+
children: [
|
|
757
|
+
props.routes.map((r) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_router_dom.Route, {
|
|
758
|
+
...r,
|
|
759
|
+
element: r.element || /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react11.Suspense, {
|
|
760
|
+
fallback: props.fallback || /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
761
|
+
style: { padding: "24px" },
|
|
762
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd7.Skeleton, {
|
|
763
|
+
active: true
|
|
764
|
+
})
|
|
765
|
+
}),
|
|
766
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(r.page, {})
|
|
767
|
+
})
|
|
768
|
+
}, r.path)),
|
|
769
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_router_dom.Route, {
|
|
770
|
+
path: "*",
|
|
771
|
+
element: props.notFound || /* @__PURE__ */ (0, import_jsx_runtime.jsx)(NotFound, {})
|
|
772
|
+
}, "*")
|
|
773
|
+
]
|
|
774
|
+
});
|
|
588
775
|
}
|
|
589
776
|
|
|
590
777
|
// src/Table.tsx
|
|
@@ -594,6 +781,7 @@ var import_dayjs4 = __toESM(require("dayjs"));
|
|
|
594
781
|
var import_icons3 = require("@ant-design/icons");
|
|
595
782
|
var import_lodash5 = require("lodash");
|
|
596
783
|
var import_react13 = require("@faasjs/react");
|
|
784
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
597
785
|
function processValue(item, value) {
|
|
598
786
|
var _a;
|
|
599
787
|
if (typeof value !== "undefined" && value !== null) {
|
|
@@ -650,10 +838,13 @@ function Table(props) {
|
|
|
650
838
|
delete item.children;
|
|
651
839
|
if (props.extendTypes && props.extendTypes[item.type]) {
|
|
652
840
|
if (props.extendTypes[item.type].children) {
|
|
653
|
-
item.render = (value, values) => (0, import_react12.cloneElement)(
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
841
|
+
item.render = (value, values) => (0, import_react12.cloneElement)(
|
|
842
|
+
props.extendTypes[item.type].children,
|
|
843
|
+
{
|
|
844
|
+
value,
|
|
845
|
+
values
|
|
846
|
+
}
|
|
847
|
+
);
|
|
657
848
|
} else if (props.extendTypes[item.type].render)
|
|
658
849
|
item.render = props.extendTypes[item.type].render;
|
|
659
850
|
else
|
|
@@ -679,12 +870,12 @@ function Table(props) {
|
|
|
679
870
|
item.onFilter = (value, row) => row[item.id].includes(value);
|
|
680
871
|
break;
|
|
681
872
|
case "boolean":
|
|
682
|
-
item.render = (value) => typeof value === "undefined" ? /* @__PURE__ */
|
|
873
|
+
item.render = (value) => typeof value === "undefined" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Blank, {}) : value ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons3.CheckOutlined, {
|
|
683
874
|
style: {
|
|
684
875
|
marginTop: "4px",
|
|
685
876
|
color: "#52c41a"
|
|
686
877
|
}
|
|
687
|
-
}) : /* @__PURE__ */
|
|
878
|
+
}) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons3.CloseOutlined, {
|
|
688
879
|
style: {
|
|
689
880
|
marginTop: "4px",
|
|
690
881
|
color: "#ff4d4f"
|
|
@@ -695,31 +886,42 @@ function Table(props) {
|
|
|
695
886
|
setSelectedKeys,
|
|
696
887
|
selectedKeys,
|
|
697
888
|
confirm
|
|
698
|
-
}) => /* @__PURE__ */
|
|
889
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_antd8.Radio.Group, {
|
|
699
890
|
style: { padding: 8 },
|
|
700
891
|
buttonStyle: "solid",
|
|
701
892
|
value: selectedKeys[0],
|
|
702
893
|
onChange: (e) => {
|
|
703
894
|
setSelectedKeys(e.target.value ? [e.target.value] : []);
|
|
704
895
|
confirm();
|
|
705
|
-
}
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
896
|
+
},
|
|
897
|
+
children: [
|
|
898
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd8.Radio.Button, {
|
|
899
|
+
children: config.common.all
|
|
900
|
+
}),
|
|
901
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd8.Radio.Button, {
|
|
902
|
+
value: "true",
|
|
903
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons3.CheckOutlined, {
|
|
904
|
+
style: {
|
|
905
|
+
color: "#52c41a",
|
|
906
|
+
verticalAlign: "middle"
|
|
907
|
+
}
|
|
908
|
+
})
|
|
909
|
+
}),
|
|
910
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd8.Radio.Button, {
|
|
911
|
+
value: "false",
|
|
912
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons3.CloseOutlined, {
|
|
913
|
+
style: {
|
|
914
|
+
verticalAlign: "middle",
|
|
915
|
+
color: "#ff4d4f"
|
|
916
|
+
}
|
|
917
|
+
})
|
|
918
|
+
}),
|
|
919
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd8.Radio.Button, {
|
|
920
|
+
value: "empty",
|
|
921
|
+
children: config.common.blank
|
|
922
|
+
})
|
|
923
|
+
]
|
|
924
|
+
});
|
|
723
925
|
if (!item.onFilter)
|
|
724
926
|
item.onFilter = (value, row) => {
|
|
725
927
|
switch (value) {
|
|
@@ -756,13 +958,14 @@ function Table(props) {
|
|
|
756
958
|
if (!columns)
|
|
757
959
|
return null;
|
|
758
960
|
if (!props.faasData)
|
|
759
|
-
return /* @__PURE__ */
|
|
961
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd8.Table, {
|
|
962
|
+
...props,
|
|
760
963
|
rowKey: props.rowKey || "id",
|
|
761
964
|
columns,
|
|
762
965
|
dataSource: props.dataSource
|
|
763
|
-
})
|
|
764
|
-
return /* @__PURE__ */
|
|
765
|
-
fallback: props.faasData.fallback || /* @__PURE__ */
|
|
966
|
+
});
|
|
967
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react13.FaasDataWrapper, {
|
|
968
|
+
fallback: props.faasData.fallback || /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd8.Skeleton, {
|
|
766
969
|
active: true
|
|
767
970
|
}),
|
|
768
971
|
render: ({
|
|
@@ -771,45 +974,55 @@ function Table(props) {
|
|
|
771
974
|
reload
|
|
772
975
|
}) => {
|
|
773
976
|
if (!data)
|
|
774
|
-
return /* @__PURE__ */
|
|
977
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd8.Table, {
|
|
978
|
+
...props,
|
|
775
979
|
rowKey: props.rowKey || "id",
|
|
776
980
|
columns,
|
|
777
981
|
dataSource: []
|
|
778
|
-
})
|
|
982
|
+
});
|
|
779
983
|
if (Array.isArray(data))
|
|
780
|
-
return /* @__PURE__ */
|
|
984
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd8.Table, {
|
|
985
|
+
...props,
|
|
781
986
|
rowKey: props.rowKey || "id",
|
|
782
987
|
columns,
|
|
783
988
|
dataSource: data
|
|
784
|
-
})
|
|
785
|
-
return /* @__PURE__ */
|
|
989
|
+
});
|
|
990
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd8.Table, {
|
|
991
|
+
...props,
|
|
786
992
|
rowKey: props.rowKey || "id",
|
|
787
993
|
columns,
|
|
788
994
|
dataSource: data.rows,
|
|
789
|
-
pagination:
|
|
995
|
+
pagination: {
|
|
996
|
+
...props.pagination,
|
|
997
|
+
...data.pagination
|
|
998
|
+
},
|
|
790
999
|
onChange: (pagination, filters, sorter, extra) => {
|
|
791
1000
|
if (props.onChange) {
|
|
792
1001
|
const processed = props.onChange(pagination, filters, sorter, extra);
|
|
793
|
-
reload(
|
|
1002
|
+
reload({
|
|
1003
|
+
...params,
|
|
794
1004
|
pagination: processed.pagination,
|
|
795
1005
|
filters: processed.filters,
|
|
796
1006
|
sorter: processed.sorter
|
|
797
|
-
})
|
|
1007
|
+
});
|
|
798
1008
|
return;
|
|
799
1009
|
}
|
|
800
|
-
reload(
|
|
1010
|
+
reload({
|
|
1011
|
+
...params,
|
|
801
1012
|
pagination,
|
|
802
1013
|
filters,
|
|
803
1014
|
sorter
|
|
804
|
-
})
|
|
1015
|
+
});
|
|
805
1016
|
}
|
|
806
|
-
})
|
|
807
|
-
}
|
|
808
|
-
|
|
1017
|
+
});
|
|
1018
|
+
},
|
|
1019
|
+
...props.faasData
|
|
1020
|
+
});
|
|
809
1021
|
}
|
|
810
1022
|
|
|
811
1023
|
// src/Title.tsx
|
|
812
1024
|
var import_react14 = require("react");
|
|
1025
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
813
1026
|
function Title(props) {
|
|
814
1027
|
const config = useConfigContext();
|
|
815
1028
|
(0, import_react14.useEffect)(() => {
|
|
@@ -818,11 +1031,14 @@ function Title(props) {
|
|
|
818
1031
|
}, []);
|
|
819
1032
|
if (props.h1) {
|
|
820
1033
|
if (typeof props.h1 === "boolean")
|
|
821
|
-
return /* @__PURE__ */
|
|
822
|
-
|
|
1034
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("h1", {
|
|
1035
|
+
children: Array.isArray(props.title) ? props.title[0] : props.title
|
|
1036
|
+
});
|
|
1037
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("h1", {
|
|
823
1038
|
className: props.h1.className,
|
|
824
|
-
style: props.h1.style
|
|
825
|
-
|
|
1039
|
+
style: props.h1.style,
|
|
1040
|
+
children: Array.isArray(props.title) ? props.title[0] : props.title
|
|
1041
|
+
});
|
|
826
1042
|
}
|
|
827
1043
|
if (props.children)
|
|
828
1044
|
return (0, import_react14.cloneElement)(props.children, { title: props.title });
|