@faasjs/ant-design 0.0.2-beta.396 → 0.0.2-beta.399
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 +16 -16
- package/dist/index.d.ts +4 -7
- package/dist/index.js +422 -273
- package/dist/index.mjs +418 -274
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
1
|
// react-shim.js
|
|
4
2
|
import React from "react";
|
|
5
3
|
|
|
@@ -9,6 +7,7 @@ import { isNil } from "lodash";
|
|
|
9
7
|
|
|
10
8
|
// src/Config.tsx
|
|
11
9
|
import { createContext, useContext } from "react";
|
|
10
|
+
import { jsx } from "react/jsx-runtime";
|
|
12
11
|
var isZH = /^zh/i.test(navigator.language);
|
|
13
12
|
var common = isZH ? {
|
|
14
13
|
lang: "zh",
|
|
@@ -44,23 +43,26 @@ function ConfigProvider({
|
|
|
44
43
|
config,
|
|
45
44
|
children
|
|
46
45
|
}) {
|
|
47
|
-
return /* @__PURE__ */
|
|
46
|
+
return /* @__PURE__ */ jsx(ConfigContext.Provider, {
|
|
48
47
|
value: {
|
|
49
48
|
...baseConfig,
|
|
50
49
|
...config
|
|
51
|
-
}
|
|
52
|
-
|
|
50
|
+
},
|
|
51
|
+
children
|
|
52
|
+
});
|
|
53
53
|
}
|
|
54
54
|
function useConfigContext() {
|
|
55
55
|
return useContext(ConfigContext);
|
|
56
56
|
}
|
|
57
57
|
|
|
58
58
|
// src/Blank.tsx
|
|
59
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
59
60
|
function Blank(options) {
|
|
60
61
|
const config = useConfigContext();
|
|
61
|
-
return !options || isNil(options.value) || Array.isArray(options.value) && !options.value.length || options.value === "" ? /* @__PURE__ */
|
|
62
|
-
disabled: true
|
|
63
|
-
|
|
62
|
+
return !options || isNil(options.value) || Array.isArray(options.value) && !options.value.length || options.value === "" ? /* @__PURE__ */ jsx2(Typography.Text, {
|
|
63
|
+
disabled: true,
|
|
64
|
+
children: (options == null ? void 0 : options.text) || config.Blank.text
|
|
65
|
+
}) : options.value;
|
|
64
66
|
}
|
|
65
67
|
|
|
66
68
|
// src/Calendar.tsx
|
|
@@ -100,6 +102,7 @@ import {
|
|
|
100
102
|
} from "react";
|
|
101
103
|
import dayjs from "dayjs";
|
|
102
104
|
import { FaasDataWrapper } from "@faasjs/react";
|
|
105
|
+
import { Fragment, jsx as jsx3 } from "react/jsx-runtime";
|
|
103
106
|
function DescriptionItemContent(props) {
|
|
104
107
|
const [computedProps, setComputedProps] = useState();
|
|
105
108
|
useEffect(() => {
|
|
@@ -131,75 +134,92 @@ function DescriptionItemContent(props) {
|
|
|
131
134
|
return null;
|
|
132
135
|
if (computedProps.extendTypes && computedProps.extendTypes[computedProps.item.type])
|
|
133
136
|
if (computedProps.extendTypes[computedProps.item.type].children)
|
|
134
|
-
return cloneElement(
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
137
|
+
return cloneElement(
|
|
138
|
+
computedProps.extendTypes[computedProps.item.type].children,
|
|
139
|
+
{
|
|
140
|
+
value: computedProps.value,
|
|
141
|
+
values: computedProps.values
|
|
142
|
+
}
|
|
143
|
+
);
|
|
138
144
|
else if (computedProps.extendTypes[computedProps.item.type].render)
|
|
139
|
-
return /* @__PURE__ */
|
|
145
|
+
return /* @__PURE__ */ jsx3(Fragment, {
|
|
146
|
+
children: computedProps.extendTypes[computedProps.item.type].render(computedProps.value, computedProps.values)
|
|
147
|
+
});
|
|
140
148
|
else
|
|
141
149
|
throw Error(computedProps.item.type + " requires children or render");
|
|
142
150
|
if (computedProps.item.children)
|
|
143
151
|
return cloneElement(computedProps.item.children, { value: computedProps.value });
|
|
144
152
|
if (computedProps.item.render)
|
|
145
|
-
return /* @__PURE__ */
|
|
153
|
+
return /* @__PURE__ */ jsx3(Fragment, {
|
|
154
|
+
children: computedProps.item.render(computedProps.value, computedProps.values)
|
|
155
|
+
});
|
|
146
156
|
if (typeof computedProps.value === "undefined" || computedProps.value === null)
|
|
147
157
|
return null;
|
|
148
158
|
switch (computedProps.item.type) {
|
|
149
159
|
case "string[]":
|
|
150
|
-
return /* @__PURE__ */
|
|
160
|
+
return /* @__PURE__ */ jsx3(Fragment, {
|
|
161
|
+
children: computedProps.value.join(", ")
|
|
162
|
+
});
|
|
151
163
|
case "number":
|
|
152
164
|
return computedProps.value || null;
|
|
153
165
|
case "number[]":
|
|
154
|
-
return /* @__PURE__ */
|
|
166
|
+
return /* @__PURE__ */ jsx3(Fragment, {
|
|
167
|
+
children: computedProps.value.join(", ")
|
|
168
|
+
});
|
|
155
169
|
case "boolean":
|
|
156
|
-
return computedProps.value ? /* @__PURE__ */
|
|
170
|
+
return computedProps.value ? /* @__PURE__ */ jsx3(CheckOutlined, {
|
|
157
171
|
style: {
|
|
158
172
|
marginTop: "4px",
|
|
159
173
|
color: "#52c41a"
|
|
160
174
|
}
|
|
161
|
-
}) : /* @__PURE__ */
|
|
175
|
+
}) : /* @__PURE__ */ jsx3(CloseOutlined, {
|
|
162
176
|
style: {
|
|
163
177
|
marginTop: "4px",
|
|
164
178
|
color: "#ff4d4f"
|
|
165
179
|
}
|
|
166
180
|
});
|
|
167
181
|
case "time":
|
|
168
|
-
return /* @__PURE__ */
|
|
182
|
+
return /* @__PURE__ */ jsx3(Fragment, {
|
|
183
|
+
children: typeof computedProps.value === "number" && computedProps.value.toString().length === 10 ? dayjs.unix(computedProps.value).format("YYYY-MM-DD HH:mm:ss") : dayjs(computedProps.value).format("YYYY-MM-DD HH:mm:ss")
|
|
184
|
+
});
|
|
169
185
|
case "date":
|
|
170
|
-
return /* @__PURE__ */
|
|
186
|
+
return /* @__PURE__ */ jsx3(Fragment, {
|
|
187
|
+
children: typeof computedProps.value === "number" && computedProps.value.toString().length === 10 ? dayjs.unix(computedProps.value).format("YYYY-MM-DD") : dayjs(computedProps.value).format("YYYY-MM-DD")
|
|
188
|
+
});
|
|
171
189
|
default:
|
|
172
190
|
return computedProps.value || null;
|
|
173
191
|
}
|
|
174
192
|
}
|
|
175
193
|
function Description(props) {
|
|
176
194
|
if (!props.faasData)
|
|
177
|
-
return /* @__PURE__ */
|
|
178
|
-
...props
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
195
|
+
return /* @__PURE__ */ jsx3(Descriptions, {
|
|
196
|
+
...props,
|
|
197
|
+
children: props.items.map((item) => /* @__PURE__ */ jsx3(Descriptions.Item, {
|
|
198
|
+
label: item.title || upperFirst2(item.id),
|
|
199
|
+
children: /* @__PURE__ */ jsx3(DescriptionItemContent, {
|
|
200
|
+
item,
|
|
201
|
+
value: props.dataSource[item.id],
|
|
202
|
+
values: props.dataSource,
|
|
203
|
+
extendTypes: props.extendTypes
|
|
204
|
+
})
|
|
205
|
+
}, item.id))
|
|
206
|
+
});
|
|
207
|
+
return /* @__PURE__ */ jsx3(FaasDataWrapper, {
|
|
208
|
+
fallback: props.faasData.fallback || /* @__PURE__ */ jsx3(Skeleton, {
|
|
190
209
|
active: true
|
|
191
210
|
}),
|
|
192
|
-
render: ({ data }) => /* @__PURE__ */
|
|
193
|
-
...props
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
211
|
+
render: ({ data }) => /* @__PURE__ */ jsx3(Descriptions, {
|
|
212
|
+
...props,
|
|
213
|
+
children: props.items.map((item) => /* @__PURE__ */ jsx3(Descriptions.Item, {
|
|
214
|
+
label: item.title || upperFirst2(item.id),
|
|
215
|
+
children: /* @__PURE__ */ jsx3(DescriptionItemContent, {
|
|
216
|
+
item,
|
|
217
|
+
value: data[item.id],
|
|
218
|
+
values: data,
|
|
219
|
+
extendTypes: props.extendTypes
|
|
220
|
+
})
|
|
221
|
+
}, item.id))
|
|
222
|
+
}),
|
|
203
223
|
...props.faasData
|
|
204
224
|
});
|
|
205
225
|
}
|
|
@@ -207,6 +227,7 @@ function Description(props) {
|
|
|
207
227
|
// src/Drawer.tsx
|
|
208
228
|
import { Drawer } from "antd";
|
|
209
229
|
import { useState as useState2 } from "react";
|
|
230
|
+
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
210
231
|
function useDrawer(init) {
|
|
211
232
|
const [props, setProps] = useState2({
|
|
212
233
|
visible: false,
|
|
@@ -217,7 +238,7 @@ function useDrawer(init) {
|
|
|
217
238
|
...init
|
|
218
239
|
});
|
|
219
240
|
return {
|
|
220
|
-
drawer: /* @__PURE__ */
|
|
241
|
+
drawer: /* @__PURE__ */ jsx4(Drawer, {
|
|
221
242
|
...props
|
|
222
243
|
}),
|
|
223
244
|
drawerProps: props,
|
|
@@ -258,8 +279,9 @@ import { upperFirst as upperFirst3 } from "lodash";
|
|
|
258
279
|
|
|
259
280
|
// src/TimePicker.tsx
|
|
260
281
|
import { forwardRef } from "react";
|
|
282
|
+
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
261
283
|
var TimePicker = forwardRef((props, ref) => {
|
|
262
|
-
return /* @__PURE__ */
|
|
284
|
+
return /* @__PURE__ */ jsx5(DatePicker, {
|
|
263
285
|
...props,
|
|
264
286
|
picker: "time",
|
|
265
287
|
mode: void 0,
|
|
@@ -269,6 +291,7 @@ var TimePicker = forwardRef((props, ref) => {
|
|
|
269
291
|
TimePicker.displayName = "TimePicker";
|
|
270
292
|
|
|
271
293
|
// src/FormItem.tsx
|
|
294
|
+
import { Fragment as Fragment2, jsx as jsx6, jsxs } from "react/jsx-runtime";
|
|
272
295
|
function processProps(propsCopy, config) {
|
|
273
296
|
if (!propsCopy.title)
|
|
274
297
|
propsCopy.title = upperFirst3(propsCopy.id);
|
|
@@ -325,196 +348,284 @@ function FormItem(props) {
|
|
|
325
348
|
if (!computedProps)
|
|
326
349
|
return null;
|
|
327
350
|
if (computedProps.extendTypes && computedProps.extendTypes[computedProps.type])
|
|
328
|
-
return /* @__PURE__ */
|
|
329
|
-
...computedProps
|
|
330
|
-
|
|
351
|
+
return /* @__PURE__ */ jsx6(AntdForm.Item, {
|
|
352
|
+
...computedProps,
|
|
353
|
+
children: computedProps.extendTypes[computedProps.type].children
|
|
354
|
+
});
|
|
331
355
|
if (computedProps.children)
|
|
332
|
-
return /* @__PURE__ */
|
|
333
|
-
...computedProps
|
|
334
|
-
|
|
356
|
+
return /* @__PURE__ */ jsx6(AntdForm.Item, {
|
|
357
|
+
...computedProps,
|
|
358
|
+
children: computedProps.children
|
|
359
|
+
});
|
|
335
360
|
if (computedProps.render)
|
|
336
|
-
return /* @__PURE__ */
|
|
337
|
-
...computedProps
|
|
338
|
-
|
|
361
|
+
return /* @__PURE__ */ jsx6(AntdForm.Item, {
|
|
362
|
+
...computedProps,
|
|
363
|
+
children: computedProps.render()
|
|
364
|
+
});
|
|
339
365
|
switch (computedProps.type) {
|
|
340
366
|
case "string":
|
|
341
|
-
return /* @__PURE__ */
|
|
342
|
-
...computedProps
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
367
|
+
return /* @__PURE__ */ jsx6(AntdForm.Item, {
|
|
368
|
+
...computedProps,
|
|
369
|
+
children: computedProps.options ? /* @__PURE__ */ jsx6(Select, {
|
|
370
|
+
...computedProps.input
|
|
371
|
+
}) : /* @__PURE__ */ jsx6(Input, {
|
|
372
|
+
...computedProps.input
|
|
373
|
+
})
|
|
374
|
+
});
|
|
348
375
|
case "string[]":
|
|
349
376
|
if (computedProps.options)
|
|
350
|
-
return /* @__PURE__ */
|
|
351
|
-
...computedProps
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
...computedProps.input
|
|
355
|
-
}));
|
|
356
|
-
return /* @__PURE__ */ React.createElement(AntdForm.List, {
|
|
357
|
-
name: computedProps.name,
|
|
358
|
-
rules: computedProps.rules
|
|
359
|
-
}, (fields, { add, remove }, { errors }) => {
|
|
360
|
-
var _a2;
|
|
361
|
-
return /* @__PURE__ */ React.createElement(React.Fragment, null, computedProps.label && /* @__PURE__ */ React.createElement("div", {
|
|
362
|
-
className: "ant-form-item-label"
|
|
363
|
-
}, /* @__PURE__ */ React.createElement("label", {
|
|
364
|
-
className: computedProps.rules.find((r) => r.required) && "ant-form-item-required"
|
|
365
|
-
}, computedProps.label)), fields.map((field) => {
|
|
366
|
-
var _a3;
|
|
367
|
-
return /* @__PURE__ */ React.createElement(AntdForm.Item, {
|
|
368
|
-
key: field.key
|
|
369
|
-
}, /* @__PURE__ */ React.createElement(Row, {
|
|
370
|
-
gutter: 24,
|
|
371
|
-
style: { flexFlow: "row nowrap" }
|
|
372
|
-
}, /* @__PURE__ */ React.createElement(Col, {
|
|
373
|
-
span: 23
|
|
374
|
-
}, /* @__PURE__ */ React.createElement(AntdForm.Item, {
|
|
375
|
-
...field,
|
|
376
|
-
noStyle: true
|
|
377
|
-
}, /* @__PURE__ */ React.createElement(Input, {
|
|
377
|
+
return /* @__PURE__ */ jsx6(AntdForm.Item, {
|
|
378
|
+
...computedProps,
|
|
379
|
+
children: /* @__PURE__ */ jsx6(Select, {
|
|
380
|
+
mode: "multiple",
|
|
378
381
|
...computedProps.input
|
|
379
|
-
})
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
382
|
+
})
|
|
383
|
+
});
|
|
384
|
+
return /* @__PURE__ */ jsx6(AntdForm.List, {
|
|
385
|
+
name: computedProps.name,
|
|
386
|
+
rules: computedProps.rules,
|
|
387
|
+
children: (fields, { add, remove }, { errors }) => {
|
|
388
|
+
var _a2;
|
|
389
|
+
return /* @__PURE__ */ jsxs(Fragment2, {
|
|
390
|
+
children: [
|
|
391
|
+
computedProps.label && /* @__PURE__ */ jsx6("div", {
|
|
392
|
+
className: "ant-form-item-label",
|
|
393
|
+
children: /* @__PURE__ */ jsx6("label", {
|
|
394
|
+
className: computedProps.rules.find((r) => r.required) && "ant-form-item-required",
|
|
395
|
+
children: computedProps.label
|
|
396
|
+
})
|
|
397
|
+
}),
|
|
398
|
+
fields.map((field) => {
|
|
399
|
+
var _a3;
|
|
400
|
+
return /* @__PURE__ */ jsx6(AntdForm.Item, {
|
|
401
|
+
children: /* @__PURE__ */ jsxs(Row, {
|
|
402
|
+
gutter: 24,
|
|
403
|
+
style: { flexFlow: "row nowrap" },
|
|
404
|
+
children: [
|
|
405
|
+
/* @__PURE__ */ jsx6(Col, {
|
|
406
|
+
span: 23,
|
|
407
|
+
children: /* @__PURE__ */ jsx6(AntdForm.Item, {
|
|
408
|
+
...field,
|
|
409
|
+
noStyle: true,
|
|
410
|
+
children: /* @__PURE__ */ jsx6(Input, {
|
|
411
|
+
...computedProps.input
|
|
412
|
+
})
|
|
413
|
+
})
|
|
414
|
+
}),
|
|
415
|
+
/* @__PURE__ */ jsx6(Col, {
|
|
416
|
+
span: 1,
|
|
417
|
+
children: !((_a3 = computedProps.input) == null ? void 0 : _a3.disabled) && (!computedProps.rules.find((r) => r.required) || field.key > 0) && /* @__PURE__ */ jsx6(Button, {
|
|
418
|
+
danger: true,
|
|
419
|
+
type: "link",
|
|
420
|
+
style: { float: "right" },
|
|
421
|
+
icon: /* @__PURE__ */ jsx6(MinusCircleOutlined, {}),
|
|
422
|
+
onClick: () => remove(field.name)
|
|
423
|
+
})
|
|
424
|
+
})
|
|
425
|
+
]
|
|
426
|
+
})
|
|
427
|
+
}, field.key);
|
|
428
|
+
}),
|
|
429
|
+
/* @__PURE__ */ jsxs(AntdForm.Item, {
|
|
430
|
+
children: [
|
|
431
|
+
!((_a2 = computedProps.input) == null ? void 0 : _a2.disabled) && (!computedProps.maxCount || computedProps.maxCount > fields.length) && /* @__PURE__ */ jsx6(Button, {
|
|
432
|
+
type: "dashed",
|
|
433
|
+
block: true,
|
|
434
|
+
onClick: () => add(),
|
|
435
|
+
icon: /* @__PURE__ */ jsx6(PlusOutlined, {})
|
|
436
|
+
}),
|
|
437
|
+
/* @__PURE__ */ jsx6(AntdForm.ErrorList, {
|
|
438
|
+
errors
|
|
439
|
+
})
|
|
440
|
+
]
|
|
441
|
+
})
|
|
442
|
+
]
|
|
443
|
+
});
|
|
444
|
+
}
|
|
396
445
|
});
|
|
397
446
|
case "number":
|
|
398
|
-
return /* @__PURE__ */
|
|
399
|
-
...computedProps
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
447
|
+
return /* @__PURE__ */ jsx6(AntdForm.Item, {
|
|
448
|
+
...computedProps,
|
|
449
|
+
children: computedProps.options ? /* @__PURE__ */ jsx6(Select, {
|
|
450
|
+
...computedProps.input
|
|
451
|
+
}) : /* @__PURE__ */ jsx6(InputNumber, {
|
|
452
|
+
style: { width: "100%" },
|
|
453
|
+
...computedProps.input
|
|
454
|
+
})
|
|
455
|
+
});
|
|
406
456
|
case "number[]":
|
|
407
457
|
if (computedProps.options)
|
|
408
|
-
return /* @__PURE__ */
|
|
409
|
-
...computedProps
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
...computedProps.input
|
|
413
|
-
}));
|
|
414
|
-
return /* @__PURE__ */ React.createElement(AntdForm.List, {
|
|
415
|
-
name: computedProps.name,
|
|
416
|
-
rules: computedProps.rules
|
|
417
|
-
}, (fields, { add, remove }, { errors }) => {
|
|
418
|
-
var _a2, _b;
|
|
419
|
-
return /* @__PURE__ */ React.createElement(React.Fragment, null, computedProps.label && /* @__PURE__ */ React.createElement("div", {
|
|
420
|
-
className: "ant-form-item-label"
|
|
421
|
-
}, /* @__PURE__ */ React.createElement("label", {
|
|
422
|
-
className: ((_a2 = computedProps.rules) == null ? void 0 : _a2.find((r) => r.required)) && "ant-form-item-required"
|
|
423
|
-
}, computedProps.label)), fields.map((field) => {
|
|
424
|
-
var _a3;
|
|
425
|
-
return /* @__PURE__ */ React.createElement(AntdForm.Item, {
|
|
426
|
-
key: field.key
|
|
427
|
-
}, /* @__PURE__ */ React.createElement(Row, {
|
|
428
|
-
gutter: 24,
|
|
429
|
-
style: { flexFlow: "row nowrap" }
|
|
430
|
-
}, /* @__PURE__ */ React.createElement(Col, {
|
|
431
|
-
span: 23
|
|
432
|
-
}, /* @__PURE__ */ React.createElement(AntdForm.Item, {
|
|
433
|
-
...field,
|
|
434
|
-
noStyle: true
|
|
435
|
-
}, /* @__PURE__ */ React.createElement(InputNumber, {
|
|
436
|
-
style: { width: "100%" },
|
|
458
|
+
return /* @__PURE__ */ jsx6(AntdForm.Item, {
|
|
459
|
+
...computedProps,
|
|
460
|
+
children: /* @__PURE__ */ jsx6(Select, {
|
|
461
|
+
mode: "multiple",
|
|
437
462
|
...computedProps.input
|
|
438
|
-
})
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
463
|
+
})
|
|
464
|
+
});
|
|
465
|
+
return /* @__PURE__ */ jsx6(AntdForm.List, {
|
|
466
|
+
name: computedProps.name,
|
|
467
|
+
rules: computedProps.rules,
|
|
468
|
+
children: (fields, { add, remove }, { errors }) => {
|
|
469
|
+
var _a2, _b;
|
|
470
|
+
return /* @__PURE__ */ jsxs(Fragment2, {
|
|
471
|
+
children: [
|
|
472
|
+
computedProps.label && /* @__PURE__ */ jsx6("div", {
|
|
473
|
+
className: "ant-form-item-label",
|
|
474
|
+
children: /* @__PURE__ */ jsx6("label", {
|
|
475
|
+
className: ((_a2 = computedProps.rules) == null ? void 0 : _a2.find((r) => r.required)) && "ant-form-item-required",
|
|
476
|
+
children: computedProps.label
|
|
477
|
+
})
|
|
478
|
+
}),
|
|
479
|
+
fields.map((field) => {
|
|
480
|
+
var _a3;
|
|
481
|
+
return /* @__PURE__ */ jsx6(AntdForm.Item, {
|
|
482
|
+
children: /* @__PURE__ */ jsxs(Row, {
|
|
483
|
+
gutter: 24,
|
|
484
|
+
style: { flexFlow: "row nowrap" },
|
|
485
|
+
children: [
|
|
486
|
+
/* @__PURE__ */ jsx6(Col, {
|
|
487
|
+
span: 23,
|
|
488
|
+
children: /* @__PURE__ */ jsx6(AntdForm.Item, {
|
|
489
|
+
...field,
|
|
490
|
+
noStyle: true,
|
|
491
|
+
children: /* @__PURE__ */ jsx6(InputNumber, {
|
|
492
|
+
style: { width: "100%" },
|
|
493
|
+
...computedProps.input
|
|
494
|
+
})
|
|
495
|
+
})
|
|
496
|
+
}),
|
|
497
|
+
/* @__PURE__ */ jsx6(Col, {
|
|
498
|
+
span: 1,
|
|
499
|
+
children: !((_a3 = computedProps.input) == null ? void 0 : _a3.disabled) && (!computedProps.rules.find((r) => r.required) || field.key > 0) && /* @__PURE__ */ jsx6(Button, {
|
|
500
|
+
danger: true,
|
|
501
|
+
type: "link",
|
|
502
|
+
style: { float: "right" },
|
|
503
|
+
icon: /* @__PURE__ */ jsx6(MinusCircleOutlined, {}),
|
|
504
|
+
onClick: () => remove(field.name)
|
|
505
|
+
})
|
|
506
|
+
})
|
|
507
|
+
]
|
|
508
|
+
})
|
|
509
|
+
}, field.key);
|
|
510
|
+
}),
|
|
511
|
+
/* @__PURE__ */ jsxs(AntdForm.Item, {
|
|
512
|
+
children: [
|
|
513
|
+
!((_b = computedProps.input) == null ? void 0 : _b.disabled) && (!computedProps.maxCount || computedProps.maxCount > fields.length) && /* @__PURE__ */ jsx6(Button, {
|
|
514
|
+
type: "dashed",
|
|
515
|
+
block: true,
|
|
516
|
+
onClick: () => add(),
|
|
517
|
+
icon: /* @__PURE__ */ jsx6(PlusOutlined, {})
|
|
518
|
+
}),
|
|
519
|
+
/* @__PURE__ */ jsx6(AntdForm.ErrorList, {
|
|
520
|
+
errors
|
|
521
|
+
})
|
|
522
|
+
]
|
|
523
|
+
})
|
|
524
|
+
]
|
|
525
|
+
});
|
|
526
|
+
}
|
|
455
527
|
});
|
|
456
528
|
case "boolean":
|
|
457
|
-
return /* @__PURE__ */
|
|
458
|
-
...computedProps
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
529
|
+
return /* @__PURE__ */ jsx6(AntdForm.Item, {
|
|
530
|
+
...computedProps,
|
|
531
|
+
children: /* @__PURE__ */ jsx6(Switch, {
|
|
532
|
+
...computedProps.input
|
|
533
|
+
})
|
|
534
|
+
});
|
|
462
535
|
case "date":
|
|
463
|
-
return /* @__PURE__ */
|
|
464
|
-
...computedProps
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
536
|
+
return /* @__PURE__ */ jsx6(AntdForm.Item, {
|
|
537
|
+
...computedProps,
|
|
538
|
+
children: /* @__PURE__ */ jsx6(DatePicker, {
|
|
539
|
+
...computedProps.input
|
|
540
|
+
})
|
|
541
|
+
});
|
|
468
542
|
case "time":
|
|
469
|
-
return /* @__PURE__ */
|
|
470
|
-
...computedProps
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
543
|
+
return /* @__PURE__ */ jsx6(AntdForm.Item, {
|
|
544
|
+
...computedProps,
|
|
545
|
+
children: /* @__PURE__ */ jsx6(TimePicker, {
|
|
546
|
+
...computedProps.input
|
|
547
|
+
})
|
|
548
|
+
});
|
|
474
549
|
case "object":
|
|
475
|
-
return /* @__PURE__ */
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
550
|
+
return /* @__PURE__ */ jsxs(Fragment2, {
|
|
551
|
+
children: [
|
|
552
|
+
computedProps.label && /* @__PURE__ */ jsx6("div", {
|
|
553
|
+
className: "ant-form-item-label",
|
|
554
|
+
children: /* @__PURE__ */ jsx6("label", {
|
|
555
|
+
className: ((_a = computedProps.rules) == null ? void 0 : _a.find((r) => r.required)) && "ant-form-item-required",
|
|
556
|
+
children: computedProps.label
|
|
557
|
+
})
|
|
558
|
+
}),
|
|
559
|
+
computedProps.object.map((o) => /* @__PURE__ */ jsx6(FormItem, {
|
|
560
|
+
...o
|
|
561
|
+
}, o.id))
|
|
562
|
+
]
|
|
563
|
+
});
|
|
483
564
|
case "object[]":
|
|
484
|
-
return /* @__PURE__ */
|
|
565
|
+
return /* @__PURE__ */ jsx6(AntdForm.List, {
|
|
485
566
|
name: computedProps.name,
|
|
486
|
-
rules: computedProps.rules
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
567
|
+
rules: computedProps.rules,
|
|
568
|
+
children: (fields, { add, remove }, { errors }) => /* @__PURE__ */ jsxs(Fragment2, {
|
|
569
|
+
children: [
|
|
570
|
+
fields.map((field) => /* @__PURE__ */ jsxs(AntdForm.Item, {
|
|
571
|
+
style: { marginBottom: 0 },
|
|
572
|
+
children: [
|
|
573
|
+
/* @__PURE__ */ jsx6("div", {
|
|
574
|
+
className: "ant-form-item-label",
|
|
575
|
+
children: /* @__PURE__ */ jsxs("label", {
|
|
576
|
+
children: [
|
|
577
|
+
computedProps.label,
|
|
578
|
+
" ",
|
|
579
|
+
field.name + 1,
|
|
580
|
+
!computedProps.disabled && (!computedProps.rules.find((r) => r.required) || field.key > 0) && /* @__PURE__ */ jsx6(Button, {
|
|
581
|
+
danger: true,
|
|
582
|
+
type: "link",
|
|
583
|
+
onClick: () => remove(field.name),
|
|
584
|
+
children: config.common.delete
|
|
585
|
+
})
|
|
586
|
+
]
|
|
587
|
+
})
|
|
588
|
+
}),
|
|
589
|
+
/* @__PURE__ */ jsx6(Row, {
|
|
590
|
+
gutter: 24,
|
|
591
|
+
children: computedProps.object.map((o) => /* @__PURE__ */ jsx6(Col, {
|
|
592
|
+
span: o.col || 6,
|
|
593
|
+
children: /* @__PURE__ */ jsx6(FormItem, {
|
|
594
|
+
...o,
|
|
595
|
+
name: [field.name, o.id]
|
|
596
|
+
})
|
|
597
|
+
}, o.id))
|
|
598
|
+
})
|
|
599
|
+
]
|
|
600
|
+
}, field.key)),
|
|
601
|
+
/* @__PURE__ */ jsxs(AntdForm.Item, {
|
|
602
|
+
children: [
|
|
603
|
+
!computedProps.disabled && (!computedProps.maxCount || computedProps.maxCount > fields.length) && /* @__PURE__ */ jsxs(Button, {
|
|
604
|
+
type: "dashed",
|
|
605
|
+
block: true,
|
|
606
|
+
onClick: () => add(),
|
|
607
|
+
icon: /* @__PURE__ */ jsx6(PlusOutlined, {}),
|
|
608
|
+
children: [
|
|
609
|
+
config.common.add,
|
|
610
|
+
" ",
|
|
611
|
+
computedProps.label
|
|
612
|
+
]
|
|
613
|
+
}),
|
|
614
|
+
/* @__PURE__ */ jsx6(AntdForm.ErrorList, {
|
|
615
|
+
errors
|
|
616
|
+
})
|
|
617
|
+
]
|
|
618
|
+
})
|
|
619
|
+
]
|
|
620
|
+
})
|
|
621
|
+
});
|
|
512
622
|
default:
|
|
513
623
|
return null;
|
|
514
624
|
}
|
|
515
625
|
}
|
|
516
626
|
|
|
517
627
|
// src/Form.tsx
|
|
628
|
+
import { jsx as jsx7, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
518
629
|
function Form(props) {
|
|
519
630
|
var _a, _b;
|
|
520
631
|
const [loading, setLoading] = useState4(false);
|
|
@@ -552,17 +663,24 @@ function Form(props) {
|
|
|
552
663
|
}, []);
|
|
553
664
|
if (!computedProps)
|
|
554
665
|
return null;
|
|
555
|
-
return /* @__PURE__ */
|
|
556
|
-
...computedProps
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
666
|
+
return /* @__PURE__ */ jsxs2(AntdForm2, {
|
|
667
|
+
...computedProps,
|
|
668
|
+
children: [
|
|
669
|
+
computedProps.beforeItems,
|
|
670
|
+
(_a = computedProps.items) == null ? void 0 : _a.map((item) => /* @__PURE__ */ jsx7(FormItem, {
|
|
671
|
+
...item,
|
|
672
|
+
extendTypes: computedProps.extendTypes
|
|
673
|
+
}, item.id)),
|
|
674
|
+
computedProps.children,
|
|
675
|
+
computedProps.submit !== false && /* @__PURE__ */ jsx7(Button2, {
|
|
676
|
+
htmlType: "submit",
|
|
677
|
+
type: "primary",
|
|
678
|
+
loading,
|
|
679
|
+
children: ((_b = computedProps.submit) == null ? void 0 : _b.text) || config.Form.submit.text
|
|
680
|
+
}),
|
|
681
|
+
computedProps.footer
|
|
682
|
+
]
|
|
683
|
+
});
|
|
566
684
|
}
|
|
567
685
|
Form.useForm = AntdForm2.useForm;
|
|
568
686
|
Form.Item = FormItem;
|
|
@@ -570,6 +688,7 @@ Form.Item = FormItem;
|
|
|
570
688
|
// src/Modal.tsx
|
|
571
689
|
import { Modal } from "antd";
|
|
572
690
|
import { useState as useState5 } from "react";
|
|
691
|
+
import { jsx as jsx8 } from "react/jsx-runtime";
|
|
573
692
|
function useModal(init) {
|
|
574
693
|
const [props, setProps] = useState5({
|
|
575
694
|
visible: false,
|
|
@@ -580,7 +699,7 @@ function useModal(init) {
|
|
|
580
699
|
...init
|
|
581
700
|
});
|
|
582
701
|
return {
|
|
583
|
-
modal: /* @__PURE__ */
|
|
702
|
+
modal: /* @__PURE__ */ jsx8(Modal, {
|
|
584
703
|
...props
|
|
585
704
|
}),
|
|
586
705
|
modalProps: props,
|
|
@@ -602,29 +721,35 @@ import {
|
|
|
602
721
|
Routes as OriginRoutes,
|
|
603
722
|
Route
|
|
604
723
|
} from "react-router-dom";
|
|
724
|
+
import { jsx as jsx9, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
605
725
|
function NotFound() {
|
|
606
726
|
const config = useConfigContext();
|
|
607
|
-
return /* @__PURE__ */
|
|
727
|
+
return /* @__PURE__ */ jsx9(Result, {
|
|
608
728
|
status: "404",
|
|
609
729
|
title: config.common.pageNotFound
|
|
610
730
|
});
|
|
611
731
|
}
|
|
612
732
|
function Routes(props) {
|
|
613
|
-
return /* @__PURE__ */
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
733
|
+
return /* @__PURE__ */ jsxs3(OriginRoutes, {
|
|
734
|
+
children: [
|
|
735
|
+
props.routes.map((r) => /* @__PURE__ */ jsx9(Route, {
|
|
736
|
+
...r,
|
|
737
|
+
element: r.element || /* @__PURE__ */ jsx9(Suspense, {
|
|
738
|
+
fallback: props.fallback || /* @__PURE__ */ jsx9("div", {
|
|
739
|
+
style: { padding: "24px" },
|
|
740
|
+
children: /* @__PURE__ */ jsx9(Skeleton2, {
|
|
741
|
+
active: true
|
|
742
|
+
})
|
|
743
|
+
}),
|
|
744
|
+
children: /* @__PURE__ */ jsx9(r.page, {})
|
|
745
|
+
})
|
|
746
|
+
}, r.path)),
|
|
747
|
+
/* @__PURE__ */ jsx9(Route, {
|
|
748
|
+
path: "*",
|
|
749
|
+
element: props.notFound || /* @__PURE__ */ jsx9(NotFound, {})
|
|
750
|
+
}, "*")
|
|
751
|
+
]
|
|
752
|
+
});
|
|
628
753
|
}
|
|
629
754
|
|
|
630
755
|
// src/Table.tsx
|
|
@@ -642,6 +767,7 @@ import dayjs2 from "dayjs";
|
|
|
642
767
|
import { CheckOutlined as CheckOutlined2, CloseOutlined as CloseOutlined2 } from "@ant-design/icons";
|
|
643
768
|
import { isNil as isNil2, upperFirst as upperFirst4 } from "lodash";
|
|
644
769
|
import { FaasDataWrapper as FaasDataWrapper2 } from "@faasjs/react";
|
|
770
|
+
import { jsx as jsx10, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
645
771
|
function processValue(item, value) {
|
|
646
772
|
var _a;
|
|
647
773
|
if (typeof value !== "undefined" && value !== null) {
|
|
@@ -698,10 +824,13 @@ function Table(props) {
|
|
|
698
824
|
delete item.children;
|
|
699
825
|
if (props.extendTypes && props.extendTypes[item.type]) {
|
|
700
826
|
if (props.extendTypes[item.type].children) {
|
|
701
|
-
item.render = (value, values) => cloneElement2(
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
827
|
+
item.render = (value, values) => cloneElement2(
|
|
828
|
+
props.extendTypes[item.type].children,
|
|
829
|
+
{
|
|
830
|
+
value,
|
|
831
|
+
values
|
|
832
|
+
}
|
|
833
|
+
);
|
|
705
834
|
} else if (props.extendTypes[item.type].render)
|
|
706
835
|
item.render = props.extendTypes[item.type].render;
|
|
707
836
|
else
|
|
@@ -727,12 +856,12 @@ function Table(props) {
|
|
|
727
856
|
item.onFilter = (value, row) => row[item.id].includes(value);
|
|
728
857
|
break;
|
|
729
858
|
case "boolean":
|
|
730
|
-
item.render = (value) => typeof value === "undefined" ? /* @__PURE__ */
|
|
859
|
+
item.render = (value) => typeof value === "undefined" ? /* @__PURE__ */ jsx10(Blank, {}) : value ? /* @__PURE__ */ jsx10(CheckOutlined2, {
|
|
731
860
|
style: {
|
|
732
861
|
marginTop: "4px",
|
|
733
862
|
color: "#52c41a"
|
|
734
863
|
}
|
|
735
|
-
}) : /* @__PURE__ */
|
|
864
|
+
}) : /* @__PURE__ */ jsx10(CloseOutlined2, {
|
|
736
865
|
style: {
|
|
737
866
|
marginTop: "4px",
|
|
738
867
|
color: "#ff4d4f"
|
|
@@ -743,31 +872,42 @@ function Table(props) {
|
|
|
743
872
|
setSelectedKeys,
|
|
744
873
|
selectedKeys,
|
|
745
874
|
confirm
|
|
746
|
-
}) => /* @__PURE__ */
|
|
875
|
+
}) => /* @__PURE__ */ jsxs4(Radio.Group, {
|
|
747
876
|
style: { padding: 8 },
|
|
748
877
|
buttonStyle: "solid",
|
|
749
878
|
value: selectedKeys[0],
|
|
750
879
|
onChange: (e) => {
|
|
751
880
|
setSelectedKeys(e.target.value ? [e.target.value] : []);
|
|
752
881
|
confirm();
|
|
753
|
-
}
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
882
|
+
},
|
|
883
|
+
children: [
|
|
884
|
+
/* @__PURE__ */ jsx10(Radio.Button, {
|
|
885
|
+
children: config.common.all
|
|
886
|
+
}),
|
|
887
|
+
/* @__PURE__ */ jsx10(Radio.Button, {
|
|
888
|
+
value: "true",
|
|
889
|
+
children: /* @__PURE__ */ jsx10(CheckOutlined2, {
|
|
890
|
+
style: {
|
|
891
|
+
color: "#52c41a",
|
|
892
|
+
verticalAlign: "middle"
|
|
893
|
+
}
|
|
894
|
+
})
|
|
895
|
+
}),
|
|
896
|
+
/* @__PURE__ */ jsx10(Radio.Button, {
|
|
897
|
+
value: "false",
|
|
898
|
+
children: /* @__PURE__ */ jsx10(CloseOutlined2, {
|
|
899
|
+
style: {
|
|
900
|
+
verticalAlign: "middle",
|
|
901
|
+
color: "#ff4d4f"
|
|
902
|
+
}
|
|
903
|
+
})
|
|
904
|
+
}),
|
|
905
|
+
/* @__PURE__ */ jsx10(Radio.Button, {
|
|
906
|
+
value: "empty",
|
|
907
|
+
children: config.common.blank
|
|
908
|
+
})
|
|
909
|
+
]
|
|
910
|
+
});
|
|
771
911
|
if (!item.onFilter)
|
|
772
912
|
item.onFilter = (value, row) => {
|
|
773
913
|
switch (value) {
|
|
@@ -804,14 +944,14 @@ function Table(props) {
|
|
|
804
944
|
if (!columns)
|
|
805
945
|
return null;
|
|
806
946
|
if (!props.faasData)
|
|
807
|
-
return /* @__PURE__ */
|
|
947
|
+
return /* @__PURE__ */ jsx10(AntdTable, {
|
|
808
948
|
...props,
|
|
809
949
|
rowKey: props.rowKey || "id",
|
|
810
950
|
columns,
|
|
811
951
|
dataSource: props.dataSource
|
|
812
952
|
});
|
|
813
|
-
return /* @__PURE__ */
|
|
814
|
-
fallback: props.faasData.fallback || /* @__PURE__ */
|
|
953
|
+
return /* @__PURE__ */ jsx10(FaasDataWrapper2, {
|
|
954
|
+
fallback: props.faasData.fallback || /* @__PURE__ */ jsx10(Skeleton3, {
|
|
815
955
|
active: true
|
|
816
956
|
}),
|
|
817
957
|
render: ({
|
|
@@ -820,20 +960,20 @@ function Table(props) {
|
|
|
820
960
|
reload
|
|
821
961
|
}) => {
|
|
822
962
|
if (!data)
|
|
823
|
-
return /* @__PURE__ */
|
|
963
|
+
return /* @__PURE__ */ jsx10(AntdTable, {
|
|
824
964
|
...props,
|
|
825
965
|
rowKey: props.rowKey || "id",
|
|
826
966
|
columns,
|
|
827
967
|
dataSource: []
|
|
828
968
|
});
|
|
829
969
|
if (Array.isArray(data))
|
|
830
|
-
return /* @__PURE__ */
|
|
970
|
+
return /* @__PURE__ */ jsx10(AntdTable, {
|
|
831
971
|
...props,
|
|
832
972
|
rowKey: props.rowKey || "id",
|
|
833
973
|
columns,
|
|
834
974
|
dataSource: data
|
|
835
975
|
});
|
|
836
|
-
return /* @__PURE__ */
|
|
976
|
+
return /* @__PURE__ */ jsx10(AntdTable, {
|
|
837
977
|
...props,
|
|
838
978
|
rowKey: props.rowKey || "id",
|
|
839
979
|
columns,
|
|
@@ -868,6 +1008,7 @@ function Table(props) {
|
|
|
868
1008
|
|
|
869
1009
|
// src/Title.tsx
|
|
870
1010
|
import { useEffect as useEffect5, cloneElement as cloneElement3 } from "react";
|
|
1011
|
+
import { jsx as jsx11 } from "react/jsx-runtime";
|
|
871
1012
|
function Title(props) {
|
|
872
1013
|
const config = useConfigContext();
|
|
873
1014
|
useEffect5(() => {
|
|
@@ -876,11 +1017,14 @@ function Title(props) {
|
|
|
876
1017
|
}, []);
|
|
877
1018
|
if (props.h1) {
|
|
878
1019
|
if (typeof props.h1 === "boolean")
|
|
879
|
-
return /* @__PURE__ */
|
|
880
|
-
|
|
1020
|
+
return /* @__PURE__ */ jsx11("h1", {
|
|
1021
|
+
children: Array.isArray(props.title) ? props.title[0] : props.title
|
|
1022
|
+
});
|
|
1023
|
+
return /* @__PURE__ */ jsx11("h1", {
|
|
881
1024
|
className: props.h1.className,
|
|
882
|
-
style: props.h1.style
|
|
883
|
-
|
|
1025
|
+
style: props.h1.style,
|
|
1026
|
+
children: Array.isArray(props.title) ? props.title[0] : props.title
|
|
1027
|
+
});
|
|
884
1028
|
}
|
|
885
1029
|
if (props.children)
|
|
886
1030
|
return cloneElement3(props.children, { title: props.title });
|