@faasjs/ant-design 0.0.3-beta.36 → 0.0.3-beta.38
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +646 -664
- package/dist/index.mjs +630 -640
- package/package.json +3 -3
package/dist/index.mjs
CHANGED
|
@@ -1,3 +1,23 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defProps = Object.defineProperties;
|
|
3
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
+
var __spreadValues = (a, b) => {
|
|
9
|
+
for (var prop in b || (b = {}))
|
|
10
|
+
if (__hasOwnProp.call(b, prop))
|
|
11
|
+
__defNormalProp(a, prop, b[prop]);
|
|
12
|
+
if (__getOwnPropSymbols)
|
|
13
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
+
if (__propIsEnum.call(b, prop))
|
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
|
16
|
+
}
|
|
17
|
+
return a;
|
|
18
|
+
};
|
|
19
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
+
|
|
1
21
|
// react-shim.js
|
|
2
22
|
import React from "react";
|
|
3
23
|
|
|
@@ -69,10 +89,7 @@ function ConfigProvider({
|
|
|
69
89
|
} else
|
|
70
90
|
setValues(defaultsDeep(config, values));
|
|
71
91
|
}, []);
|
|
72
|
-
return /* @__PURE__ */ jsx(ConfigContext.Provider, {
|
|
73
|
-
value: values,
|
|
74
|
-
children
|
|
75
|
-
});
|
|
92
|
+
return /* @__PURE__ */ jsx(ConfigContext.Provider, { value: values, children });
|
|
76
93
|
}
|
|
77
94
|
function useConfigContext() {
|
|
78
95
|
return useContext(ConfigContext);
|
|
@@ -82,10 +99,7 @@ function useConfigContext() {
|
|
|
82
99
|
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
83
100
|
function Blank(options) {
|
|
84
101
|
const { Blank: Blank2 } = useConfigContext();
|
|
85
|
-
return !options || isNil(options.value) || Array.isArray(options.value) && !options.value.length || options.value === "" ? /* @__PURE__ */ jsx2(Typography.Text, {
|
|
86
|
-
disabled: true,
|
|
87
|
-
children: (options == null ? void 0 : options.text) || Blank2.text
|
|
88
|
-
}) : options.value;
|
|
102
|
+
return !options || isNil(options.value) || Array.isArray(options.value) && !options.value.length || options.value === "" ? /* @__PURE__ */ jsx2(Typography.Text, { disabled: true, children: (options == null ? void 0 : options.text) || Blank2.text }) : options.value;
|
|
89
103
|
}
|
|
90
104
|
|
|
91
105
|
// src/data.ts
|
|
@@ -123,55 +137,71 @@ import {
|
|
|
123
137
|
} from "antd";
|
|
124
138
|
import { isFunction, upperFirst as upperFirst2 } from "lodash-es";
|
|
125
139
|
import {
|
|
126
|
-
cloneElement,
|
|
127
|
-
useEffect as
|
|
128
|
-
useState as
|
|
140
|
+
cloneElement as cloneElement2,
|
|
141
|
+
useEffect as useEffect3,
|
|
142
|
+
useState as useState3
|
|
129
143
|
} from "react";
|
|
130
144
|
|
|
131
|
-
// src/
|
|
132
|
-
import {
|
|
145
|
+
// ../react/src/index.tsx
|
|
146
|
+
import {
|
|
147
|
+
useState as useState2,
|
|
148
|
+
useEffect as useEffect2,
|
|
149
|
+
createElement,
|
|
150
|
+
cloneElement
|
|
151
|
+
} from "react";
|
|
152
|
+
var clients = {};
|
|
153
|
+
function getClient(domain) {
|
|
154
|
+
const client = clients[domain || Object.keys(clients)[0]];
|
|
155
|
+
if (!client)
|
|
156
|
+
throw Error("FaasReactClient is not initialized");
|
|
157
|
+
return client;
|
|
158
|
+
}
|
|
159
|
+
async function faas(action, params) {
|
|
160
|
+
return getClient().faas(action, params);
|
|
161
|
+
}
|
|
162
|
+
function FaasDataWrapper(props) {
|
|
163
|
+
const [client, setClient] = useState2();
|
|
164
|
+
useEffect2(() => {
|
|
165
|
+
if (client)
|
|
166
|
+
return;
|
|
167
|
+
setClient(getClient());
|
|
168
|
+
}, []);
|
|
169
|
+
if (!client)
|
|
170
|
+
return props.fallback || null;
|
|
171
|
+
return createElement(client.FaasDataWrapper, props);
|
|
172
|
+
}
|
|
133
173
|
|
|
134
174
|
// src/Loading.tsx
|
|
135
175
|
import { Spin } from "antd";
|
|
136
176
|
import { Fragment, jsx as jsx3 } from "react/jsx-runtime";
|
|
137
177
|
function Loading(props) {
|
|
138
178
|
if (props.loading === false)
|
|
139
|
-
return /* @__PURE__ */ jsx3(Fragment, {
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
...props.style || {},
|
|
145
|
-
...!props.size || props.size === "large" ? {
|
|
146
|
-
margin: "20vh auto",
|
|
147
|
-
textAlign: "center"
|
|
148
|
-
} : {}
|
|
149
|
-
},
|
|
150
|
-
children: /* @__PURE__ */ jsx3(Spin, {
|
|
151
|
-
size: props.size || "large"
|
|
152
|
-
})
|
|
153
|
-
});
|
|
179
|
+
return /* @__PURE__ */ jsx3(Fragment, { children: props.children });
|
|
180
|
+
return /* @__PURE__ */ jsx3("div", { style: __spreadValues(__spreadValues({}, props.style || {}), !props.size || props.size === "large" ? {
|
|
181
|
+
margin: "20vh auto",
|
|
182
|
+
textAlign: "center"
|
|
183
|
+
} : {}), children: /* @__PURE__ */ jsx3(Spin, { size: props.size || "large" }) });
|
|
154
184
|
}
|
|
155
185
|
|
|
156
186
|
// src/FaasDataWrapper.tsx
|
|
157
187
|
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
158
|
-
function
|
|
159
|
-
return /* @__PURE__ */ jsx4(
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
188
|
+
function FaasDataWrapper2(props) {
|
|
189
|
+
return /* @__PURE__ */ jsx4(
|
|
190
|
+
FaasDataWrapper,
|
|
191
|
+
__spreadValues({
|
|
192
|
+
fallback: props.loading || /* @__PURE__ */ jsx4(Loading, __spreadValues({}, props.loadingProps))
|
|
193
|
+
}, props)
|
|
194
|
+
);
|
|
165
195
|
}
|
|
166
196
|
|
|
167
197
|
// src/Description.tsx
|
|
168
198
|
import { Fragment as Fragment2, jsx as jsx5 } from "react/jsx-runtime";
|
|
169
199
|
function DescriptionItemContent(props) {
|
|
170
200
|
var _a;
|
|
171
|
-
const [computedProps, setComputedProps] =
|
|
172
|
-
|
|
201
|
+
const [computedProps, setComputedProps] = useState3();
|
|
202
|
+
useEffect3(() => {
|
|
173
203
|
var _a2, _b;
|
|
174
|
-
const propsCopy = {
|
|
204
|
+
const propsCopy = __spreadValues({}, props);
|
|
175
205
|
if (!propsCopy.item.title)
|
|
176
206
|
propsCopy.item.title = upperFirst2(propsCopy.item.id);
|
|
177
207
|
if (!propsCopy.item.type)
|
|
@@ -199,7 +229,7 @@ function DescriptionItemContent(props) {
|
|
|
199
229
|
return null;
|
|
200
230
|
if (computedProps.extendTypes && computedProps.extendTypes[computedProps.item.type])
|
|
201
231
|
if (computedProps.extendTypes[computedProps.item.type].children)
|
|
202
|
-
return
|
|
232
|
+
return cloneElement2(
|
|
203
233
|
computedProps.extendTypes[computedProps.item.type].children,
|
|
204
234
|
{
|
|
205
235
|
scene: "description",
|
|
@@ -208,15 +238,13 @@ function DescriptionItemContent(props) {
|
|
|
208
238
|
}
|
|
209
239
|
);
|
|
210
240
|
else if (computedProps.extendTypes[computedProps.item.type].render)
|
|
211
|
-
return /* @__PURE__ */ jsx5(Fragment2, {
|
|
212
|
-
children: computedProps.extendTypes[computedProps.item.type].render(computedProps.value, computedProps.values, 0, "description")
|
|
213
|
-
});
|
|
241
|
+
return /* @__PURE__ */ jsx5(Fragment2, { children: computedProps.extendTypes[computedProps.item.type].render(computedProps.value, computedProps.values, 0, "description") });
|
|
214
242
|
else
|
|
215
243
|
throw Error(computedProps.item.type + " requires children or render");
|
|
216
244
|
if (computedProps.item.descriptionChildren === null)
|
|
217
245
|
return null;
|
|
218
246
|
if (computedProps.item.descriptionChildren)
|
|
219
|
-
return
|
|
247
|
+
return cloneElement2(computedProps.item.descriptionChildren, {
|
|
220
248
|
scene: "description",
|
|
221
249
|
value: computedProps.value,
|
|
222
250
|
values: computedProps.values
|
|
@@ -224,7 +252,7 @@ function DescriptionItemContent(props) {
|
|
|
224
252
|
if (computedProps.item.children === null)
|
|
225
253
|
return null;
|
|
226
254
|
if (computedProps.item.children)
|
|
227
|
-
return
|
|
255
|
+
return cloneElement2(computedProps.item.children, {
|
|
228
256
|
scene: "description",
|
|
229
257
|
value: computedProps.value,
|
|
230
258
|
values: computedProps.values
|
|
@@ -237,120 +265,125 @@ function DescriptionItemContent(props) {
|
|
|
237
265
|
return /* @__PURE__ */ jsx5(Blank, {});
|
|
238
266
|
switch (computedProps.item.type) {
|
|
239
267
|
case "string[]":
|
|
240
|
-
return /* @__PURE__ */ jsx5(Fragment2, {
|
|
241
|
-
children: computedProps.value.join(", ")
|
|
242
|
-
});
|
|
268
|
+
return /* @__PURE__ */ jsx5(Fragment2, { children: computedProps.value.join(", ") });
|
|
243
269
|
case "number":
|
|
244
270
|
return computedProps.value || null;
|
|
245
271
|
case "number[]":
|
|
246
|
-
return /* @__PURE__ */ jsx5(Fragment2, {
|
|
247
|
-
children: computedProps.value.join(", ")
|
|
248
|
-
});
|
|
272
|
+
return /* @__PURE__ */ jsx5(Fragment2, { children: computedProps.value.join(", ") });
|
|
249
273
|
case "boolean":
|
|
250
|
-
return computedProps.value ? /* @__PURE__ */ jsx5(CheckOutlined, {
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
marginTop: "4px",
|
|
258
|
-
color: "#ff4d4f"
|
|
259
|
-
}
|
|
260
|
-
});
|
|
274
|
+
return computedProps.value ? /* @__PURE__ */ jsx5(CheckOutlined, { style: {
|
|
275
|
+
marginTop: "4px",
|
|
276
|
+
color: "#52c41a"
|
|
277
|
+
} }) : /* @__PURE__ */ jsx5(CloseOutlined, { style: {
|
|
278
|
+
marginTop: "4px",
|
|
279
|
+
color: "#ff4d4f"
|
|
280
|
+
} });
|
|
261
281
|
case "time":
|
|
262
|
-
return /* @__PURE__ */ jsx5(Fragment2, {
|
|
263
|
-
children: computedProps.value.format("YYYY-MM-DD HH:mm:ss")
|
|
264
|
-
});
|
|
282
|
+
return /* @__PURE__ */ jsx5(Fragment2, { children: computedProps.value.format("YYYY-MM-DD HH:mm:ss") });
|
|
265
283
|
case "date":
|
|
266
|
-
return /* @__PURE__ */ jsx5(Fragment2, {
|
|
267
|
-
children: computedProps.value.format("YYYY-MM-DD")
|
|
268
|
-
});
|
|
284
|
+
return /* @__PURE__ */ jsx5(Fragment2, { children: computedProps.value.format("YYYY-MM-DD") });
|
|
269
285
|
case "object":
|
|
270
286
|
if (!computedProps.value)
|
|
271
287
|
return /* @__PURE__ */ jsx5(Blank, {});
|
|
272
|
-
return /* @__PURE__ */ jsx5(
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
288
|
+
return /* @__PURE__ */ jsx5(
|
|
289
|
+
Description,
|
|
290
|
+
{
|
|
291
|
+
items: computedProps.item.object,
|
|
292
|
+
dataSource: computedProps.value,
|
|
293
|
+
column: 1
|
|
294
|
+
}
|
|
295
|
+
);
|
|
277
296
|
case "object[]":
|
|
278
297
|
if (!((_a = computedProps.value) == null ? void 0 : _a.length))
|
|
279
298
|
return /* @__PURE__ */ jsx5(Blank, {});
|
|
280
|
-
return /* @__PURE__ */ jsx5(Space, {
|
|
281
|
-
|
|
282
|
-
|
|
299
|
+
return /* @__PURE__ */ jsx5(Space, { direction: "vertical", children: computedProps.value.map((value, index) => /* @__PURE__ */ jsx5(
|
|
300
|
+
Description,
|
|
301
|
+
{
|
|
283
302
|
items: computedProps.item.object,
|
|
284
303
|
dataSource: value,
|
|
285
304
|
column: 1
|
|
286
|
-
},
|
|
287
|
-
|
|
305
|
+
},
|
|
306
|
+
index
|
|
307
|
+
)) });
|
|
288
308
|
default:
|
|
289
309
|
return computedProps.value || null;
|
|
290
310
|
}
|
|
291
311
|
}
|
|
292
312
|
function Description(props) {
|
|
293
313
|
if (!props.faasData)
|
|
294
|
-
return /* @__PURE__ */ jsx5(
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
return !item.if || item.if(props.dataSource) ? /* @__PURE__ */ jsx5(Descriptions.Item, {
|
|
299
|
-
label: item.title || upperFirst2(item.id),
|
|
300
|
-
children: /* @__PURE__ */ jsx5(DescriptionItemContent, {
|
|
301
|
-
item,
|
|
302
|
-
value: props.dataSource[item.id],
|
|
303
|
-
values: props.dataSource,
|
|
304
|
-
extendTypes: props.extendTypes
|
|
305
|
-
})
|
|
306
|
-
}, item.id) : null;
|
|
307
|
-
}).filter(Boolean)
|
|
308
|
-
});
|
|
309
|
-
return /* @__PURE__ */ jsx5(FaasDataWrapper, {
|
|
310
|
-
render: ({ data }) => {
|
|
311
|
-
return /* @__PURE__ */ jsx5(Descriptions, {
|
|
312
|
-
...props,
|
|
313
|
-
title: isFunction(props.renderTitle) ? props.renderTitle(data) : props.title,
|
|
314
|
+
return /* @__PURE__ */ jsx5(
|
|
315
|
+
Descriptions,
|
|
316
|
+
__spreadProps(__spreadValues({}, props), {
|
|
317
|
+
title: isFunction(props.renderTitle) ? props.renderTitle(props.dataSource) : props.title,
|
|
314
318
|
children: props.items.map((item) => {
|
|
315
|
-
return !item.if || item.if(
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
item,
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
319
|
+
return !item.if || item.if(props.dataSource) ? /* @__PURE__ */ jsx5(
|
|
320
|
+
Descriptions.Item,
|
|
321
|
+
{
|
|
322
|
+
label: item.title || upperFirst2(item.id),
|
|
323
|
+
children: /* @__PURE__ */ jsx5(
|
|
324
|
+
DescriptionItemContent,
|
|
325
|
+
{
|
|
326
|
+
item,
|
|
327
|
+
value: props.dataSource[item.id],
|
|
328
|
+
values: props.dataSource,
|
|
329
|
+
extendTypes: props.extendTypes
|
|
330
|
+
}
|
|
331
|
+
)
|
|
332
|
+
},
|
|
333
|
+
item.id
|
|
334
|
+
) : null;
|
|
324
335
|
}).filter(Boolean)
|
|
325
|
-
})
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
336
|
+
})
|
|
337
|
+
);
|
|
338
|
+
return /* @__PURE__ */ jsx5(
|
|
339
|
+
FaasDataWrapper2,
|
|
340
|
+
__spreadValues({
|
|
341
|
+
render: ({ data }) => {
|
|
342
|
+
return /* @__PURE__ */ jsx5(
|
|
343
|
+
Descriptions,
|
|
344
|
+
__spreadProps(__spreadValues({}, props), {
|
|
345
|
+
title: isFunction(props.renderTitle) ? props.renderTitle(data) : props.title,
|
|
346
|
+
children: props.items.map((item) => {
|
|
347
|
+
return !item.if || item.if(data) ? /* @__PURE__ */ jsx5(
|
|
348
|
+
Descriptions.Item,
|
|
349
|
+
{
|
|
350
|
+
label: item.title || upperFirst2(item.id),
|
|
351
|
+
children: /* @__PURE__ */ jsx5(
|
|
352
|
+
DescriptionItemContent,
|
|
353
|
+
{
|
|
354
|
+
item,
|
|
355
|
+
value: data[item.id],
|
|
356
|
+
values: data,
|
|
357
|
+
extendTypes: props.extendTypes
|
|
358
|
+
}
|
|
359
|
+
)
|
|
360
|
+
},
|
|
361
|
+
item.id
|
|
362
|
+
) : null;
|
|
363
|
+
}).filter(Boolean)
|
|
364
|
+
})
|
|
365
|
+
);
|
|
366
|
+
}
|
|
367
|
+
}, props.faasData)
|
|
368
|
+
);
|
|
329
369
|
}
|
|
330
370
|
|
|
331
371
|
// src/Drawer.tsx
|
|
332
372
|
import { Drawer } from "antd";
|
|
333
|
-
import { useState as
|
|
373
|
+
import { useState as useState4 } from "react";
|
|
334
374
|
import { jsx as jsx6 } from "react/jsx-runtime";
|
|
335
375
|
function useDrawer(init) {
|
|
336
|
-
const [props, setProps] =
|
|
376
|
+
const [props, setProps] = useState4(__spreadValues({
|
|
337
377
|
open: false,
|
|
338
|
-
onClose: () => setProps((prev) => ({
|
|
339
|
-
...prev,
|
|
378
|
+
onClose: () => setProps((prev) => __spreadProps(__spreadValues({}, prev), {
|
|
340
379
|
open: false
|
|
341
|
-
}))
|
|
342
|
-
|
|
343
|
-
});
|
|
380
|
+
}))
|
|
381
|
+
}, init));
|
|
344
382
|
return {
|
|
345
|
-
drawer: /* @__PURE__ */ jsx6(Drawer, {
|
|
346
|
-
...props
|
|
347
|
-
}),
|
|
383
|
+
drawer: /* @__PURE__ */ jsx6(Drawer, __spreadValues({}, props)),
|
|
348
384
|
drawerProps: props,
|
|
349
385
|
setDrawerProps(changes) {
|
|
350
|
-
setProps((prev) => ({
|
|
351
|
-
...prev,
|
|
352
|
-
...changes
|
|
353
|
-
}));
|
|
386
|
+
setProps((prev) => __spreadValues(__spreadValues({}, prev), changes));
|
|
354
387
|
}
|
|
355
388
|
};
|
|
356
389
|
}
|
|
@@ -386,31 +419,30 @@ var ErrorBoundary = class extends Component {
|
|
|
386
419
|
if (error) {
|
|
387
420
|
if (this.props.onError)
|
|
388
421
|
return this.props.onError(error, info);
|
|
389
|
-
return /* @__PURE__ */ jsx7(
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
422
|
+
return /* @__PURE__ */ jsx7(
|
|
423
|
+
Alert,
|
|
424
|
+
{
|
|
425
|
+
type: "error",
|
|
426
|
+
message: errorMessage,
|
|
427
|
+
description: /* @__PURE__ */ jsx7("pre", { style: {
|
|
394
428
|
fontSize: "0.9em",
|
|
395
429
|
overflowX: "auto"
|
|
396
|
-
},
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
});
|
|
430
|
+
}, children: errorDescription })
|
|
431
|
+
}
|
|
432
|
+
);
|
|
400
433
|
}
|
|
401
434
|
return children;
|
|
402
435
|
}
|
|
403
436
|
};
|
|
404
437
|
|
|
405
438
|
// src/Form.tsx
|
|
406
|
-
import { faas } from "@faasjs/react";
|
|
407
439
|
import {
|
|
408
440
|
Button as Button2,
|
|
409
441
|
Form as AntdForm2
|
|
410
442
|
} from "antd";
|
|
411
443
|
import {
|
|
412
|
-
useEffect as
|
|
413
|
-
useState as
|
|
444
|
+
useEffect as useEffect5,
|
|
445
|
+
useState as useState6,
|
|
414
446
|
useCallback,
|
|
415
447
|
isValidElement
|
|
416
448
|
} from "react";
|
|
@@ -430,9 +462,9 @@ import {
|
|
|
430
462
|
} from "antd";
|
|
431
463
|
import { MinusCircleOutlined, PlusOutlined } from "@ant-design/icons";
|
|
432
464
|
import {
|
|
433
|
-
cloneElement as
|
|
434
|
-
useEffect as
|
|
435
|
-
useState as
|
|
465
|
+
cloneElement as cloneElement3,
|
|
466
|
+
useEffect as useEffect4,
|
|
467
|
+
useState as useState5
|
|
436
468
|
} from "react";
|
|
437
469
|
import { upperFirst as upperFirst3 } from "lodash-es";
|
|
438
470
|
import { Fragment as Fragment3, jsx as jsx8, jsxs } from "react/jsx-runtime";
|
|
@@ -484,12 +516,12 @@ function processProps(propsCopy, config) {
|
|
|
484
516
|
}
|
|
485
517
|
function FormItem(props) {
|
|
486
518
|
var _a;
|
|
487
|
-
const [computedProps, setComputedProps] =
|
|
488
|
-
const [extendTypes, setExtendTypes] =
|
|
519
|
+
const [computedProps, setComputedProps] = useState5();
|
|
520
|
+
const [extendTypes, setExtendTypes] = useState5();
|
|
489
521
|
const { common: common2 } = useConfigContext();
|
|
490
|
-
const [hidden, setHidden] =
|
|
491
|
-
|
|
492
|
-
const propsCopy = {
|
|
522
|
+
const [hidden, setHidden] = useState5(props.hidden || false);
|
|
523
|
+
useEffect4(() => {
|
|
524
|
+
const propsCopy = __spreadValues({}, props);
|
|
493
525
|
if (propsCopy.extendTypes) {
|
|
494
526
|
setExtendTypes(propsCopy.extendTypes);
|
|
495
527
|
delete propsCopy.extendTypes;
|
|
@@ -512,282 +544,229 @@ function FormItem(props) {
|
|
|
512
544
|
if (!computedProps)
|
|
513
545
|
return null;
|
|
514
546
|
if (hidden)
|
|
515
|
-
return /* @__PURE__ */ jsx8(
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
hidden: true
|
|
547
|
+
return /* @__PURE__ */ jsx8(
|
|
548
|
+
AntdForm.Item,
|
|
549
|
+
__spreadProps(__spreadValues({}, computedProps), {
|
|
550
|
+
noStyle: true,
|
|
551
|
+
rules: [],
|
|
552
|
+
children: /* @__PURE__ */ jsx8(Input, { hidden: true })
|
|
521
553
|
})
|
|
522
|
-
|
|
554
|
+
);
|
|
523
555
|
if (extendTypes && extendTypes[computedProps.type])
|
|
524
|
-
return /* @__PURE__ */ jsx8(AntdForm.Item, {
|
|
525
|
-
...computedProps,
|
|
526
|
-
children: extendTypes[computedProps.type].children
|
|
527
|
-
});
|
|
556
|
+
return /* @__PURE__ */ jsx8(AntdForm.Item, __spreadProps(__spreadValues({}, computedProps), { children: extendTypes[computedProps.type].children }));
|
|
528
557
|
if (computedProps.formChildren === null)
|
|
529
558
|
return null;
|
|
530
559
|
if (computedProps.formChildren)
|
|
531
|
-
return /* @__PURE__ */ jsx8(AntdForm.Item, {
|
|
532
|
-
...computedProps,
|
|
533
|
-
children: cloneElement2(computedProps.formChildren, { scene: "form" })
|
|
534
|
-
});
|
|
560
|
+
return /* @__PURE__ */ jsx8(AntdForm.Item, __spreadProps(__spreadValues({}, computedProps), { children: cloneElement3(computedProps.formChildren, { scene: "form" }) }));
|
|
535
561
|
if (computedProps.children === null)
|
|
536
562
|
return null;
|
|
537
563
|
if (computedProps.children)
|
|
538
|
-
return /* @__PURE__ */ jsx8(AntdForm.Item, {
|
|
539
|
-
...computedProps,
|
|
540
|
-
children: cloneElement2(computedProps.children, { scene: "form" })
|
|
541
|
-
});
|
|
564
|
+
return /* @__PURE__ */ jsx8(AntdForm.Item, __spreadProps(__spreadValues({}, computedProps), { children: cloneElement3(computedProps.children, { scene: "form" }) }));
|
|
542
565
|
if (computedProps.formRender)
|
|
543
|
-
return /* @__PURE__ */ jsx8(AntdForm.Item, {
|
|
544
|
-
...computedProps,
|
|
545
|
-
children: computedProps.formRender(null, null, 0, "form")
|
|
546
|
-
});
|
|
566
|
+
return /* @__PURE__ */ jsx8(AntdForm.Item, __spreadProps(__spreadValues({}, computedProps), { children: computedProps.formRender(null, null, 0, "form") }));
|
|
547
567
|
if (computedProps.render)
|
|
548
|
-
return /* @__PURE__ */ jsx8(AntdForm.Item, {
|
|
549
|
-
...computedProps,
|
|
550
|
-
children: computedProps.render(null, null, 0, "form")
|
|
551
|
-
});
|
|
568
|
+
return /* @__PURE__ */ jsx8(AntdForm.Item, __spreadProps(__spreadValues({}, computedProps), { children: computedProps.render(null, null, 0, "form") }));
|
|
552
569
|
switch (computedProps.type) {
|
|
553
570
|
case "string":
|
|
554
|
-
return /* @__PURE__ */ jsx8(AntdForm.Item, {
|
|
555
|
-
...computedProps,
|
|
556
|
-
children: computedProps.options ? /* @__PURE__ */ jsx8(Select, {
|
|
557
|
-
...computedProps.input
|
|
558
|
-
}) : /* @__PURE__ */ jsx8(Input, {
|
|
559
|
-
...computedProps.input
|
|
560
|
-
})
|
|
561
|
-
});
|
|
571
|
+
return /* @__PURE__ */ jsx8(AntdForm.Item, __spreadProps(__spreadValues({}, computedProps), { children: computedProps.options ? /* @__PURE__ */ jsx8(Select, __spreadValues({}, computedProps.input)) : /* @__PURE__ */ jsx8(Input, __spreadValues({}, computedProps.input)) }));
|
|
562
572
|
case "string[]":
|
|
563
573
|
if (computedProps.options)
|
|
564
|
-
return /* @__PURE__ */ jsx8(AntdForm.Item, {
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
mode: "multiple"
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
children: [
|
|
578
|
-
computedProps.label && /* @__PURE__ */ jsx8("div", {
|
|
579
|
-
className: "ant-form-item-label",
|
|
580
|
-
children: /* @__PURE__ */ jsx8("label", {
|
|
581
|
-
className: computedProps.rules.find((r) => r.required) && "ant-form-item-required",
|
|
582
|
-
children: computedProps.label
|
|
583
|
-
})
|
|
584
|
-
}),
|
|
574
|
+
return /* @__PURE__ */ jsx8(AntdForm.Item, __spreadProps(__spreadValues({}, computedProps), { children: /* @__PURE__ */ jsx8(
|
|
575
|
+
Select,
|
|
576
|
+
__spreadValues({
|
|
577
|
+
mode: "multiple"
|
|
578
|
+
}, computedProps.input)
|
|
579
|
+
) }));
|
|
580
|
+
return /* @__PURE__ */ jsx8(
|
|
581
|
+
AntdForm.List,
|
|
582
|
+
{
|
|
583
|
+
name: computedProps.name,
|
|
584
|
+
rules: computedProps.rules,
|
|
585
|
+
children: (fields, { add, remove }, { errors }) => {
|
|
586
|
+
var _a2;
|
|
587
|
+
return /* @__PURE__ */ jsxs(Fragment3, { children: [
|
|
588
|
+
computedProps.label && /* @__PURE__ */ jsx8("div", { className: "ant-form-item-label", children: /* @__PURE__ */ jsx8("label", { className: computedProps.rules.find((r) => r.required) && "ant-form-item-required", children: computedProps.label }) }),
|
|
585
589
|
fields.map((field) => {
|
|
586
590
|
var _a3;
|
|
587
|
-
return /* @__PURE__ */ jsx8(AntdForm.Item, {
|
|
588
|
-
|
|
591
|
+
return /* @__PURE__ */ jsx8(AntdForm.Item, { children: /* @__PURE__ */ jsxs(
|
|
592
|
+
Row,
|
|
593
|
+
{
|
|
589
594
|
gutter: 24,
|
|
590
595
|
style: { flexFlow: "row nowrap" },
|
|
591
596
|
children: [
|
|
592
|
-
/* @__PURE__ */ jsx8(Col, {
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
...field,
|
|
597
|
+
/* @__PURE__ */ jsx8(Col, { span: 23, children: /* @__PURE__ */ jsx8(
|
|
598
|
+
AntdForm.Item,
|
|
599
|
+
__spreadProps(__spreadValues({}, field), {
|
|
596
600
|
noStyle: true,
|
|
597
|
-
children: /* @__PURE__ */ jsx8(Input, {
|
|
598
|
-
...computedProps.input
|
|
599
|
-
})
|
|
601
|
+
children: /* @__PURE__ */ jsx8(Input, __spreadValues({}, computedProps.input))
|
|
600
602
|
})
|
|
601
|
-
}),
|
|
602
|
-
/* @__PURE__ */ jsx8(Col, {
|
|
603
|
-
|
|
604
|
-
|
|
603
|
+
) }),
|
|
604
|
+
/* @__PURE__ */ jsx8(Col, { span: 1, children: !((_a3 = computedProps.input) == null ? void 0 : _a3.disabled) && (!computedProps.rules.find((r) => r.required) || field.key > 0) && /* @__PURE__ */ jsx8(
|
|
605
|
+
Button,
|
|
606
|
+
{
|
|
605
607
|
danger: true,
|
|
606
608
|
type: "link",
|
|
607
609
|
style: { float: "right" },
|
|
608
610
|
icon: /* @__PURE__ */ jsx8(MinusCircleOutlined, {}),
|
|
609
611
|
onClick: () => remove(field.name)
|
|
610
|
-
}
|
|
611
|
-
})
|
|
612
|
+
}
|
|
613
|
+
) })
|
|
612
614
|
]
|
|
613
|
-
}
|
|
614
|
-
}, field.key);
|
|
615
|
+
}
|
|
616
|
+
) }, field.key);
|
|
615
617
|
}),
|
|
616
|
-
/* @__PURE__ */ jsxs(AntdForm.Item, {
|
|
617
|
-
|
|
618
|
-
|
|
618
|
+
/* @__PURE__ */ jsxs(AntdForm.Item, { children: [
|
|
619
|
+
!((_a2 = computedProps.input) == null ? void 0 : _a2.disabled) && (!computedProps.maxCount || computedProps.maxCount > fields.length) && /* @__PURE__ */ jsx8(
|
|
620
|
+
Button,
|
|
621
|
+
{
|
|
619
622
|
type: "dashed",
|
|
620
623
|
block: true,
|
|
621
624
|
onClick: () => add(),
|
|
622
625
|
icon: /* @__PURE__ */ jsx8(PlusOutlined, {})
|
|
623
|
-
}
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
]
|
|
630
|
-
});
|
|
626
|
+
}
|
|
627
|
+
),
|
|
628
|
+
/* @__PURE__ */ jsx8(AntdForm.ErrorList, { errors })
|
|
629
|
+
] })
|
|
630
|
+
] });
|
|
631
|
+
}
|
|
631
632
|
}
|
|
632
|
-
|
|
633
|
+
);
|
|
633
634
|
case "number":
|
|
634
|
-
return /* @__PURE__ */ jsx8(AntdForm.Item, {
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
}
|
|
639
|
-
|
|
640
|
-
...computedProps.input
|
|
641
|
-
})
|
|
642
|
-
});
|
|
635
|
+
return /* @__PURE__ */ jsx8(AntdForm.Item, __spreadProps(__spreadValues({}, computedProps), { children: computedProps.options ? /* @__PURE__ */ jsx8(Select, __spreadValues({}, computedProps.input)) : /* @__PURE__ */ jsx8(
|
|
636
|
+
InputNumber,
|
|
637
|
+
__spreadValues({
|
|
638
|
+
style: { width: "100%" }
|
|
639
|
+
}, computedProps.input)
|
|
640
|
+
) }));
|
|
643
641
|
case "number[]":
|
|
644
642
|
if (computedProps.options)
|
|
645
|
-
return /* @__PURE__ */ jsx8(AntdForm.Item, {
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
mode: "multiple"
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
children: [
|
|
659
|
-
computedProps.label && /* @__PURE__ */ jsx8("div", {
|
|
660
|
-
className: "ant-form-item-label",
|
|
661
|
-
children: /* @__PURE__ */ jsx8("label", {
|
|
662
|
-
className: ((_a2 = computedProps.rules) == null ? void 0 : _a2.find((r) => r.required)) && "ant-form-item-required",
|
|
663
|
-
children: computedProps.label
|
|
664
|
-
})
|
|
665
|
-
}),
|
|
643
|
+
return /* @__PURE__ */ jsx8(AntdForm.Item, __spreadProps(__spreadValues({}, computedProps), { children: /* @__PURE__ */ jsx8(
|
|
644
|
+
Select,
|
|
645
|
+
__spreadValues({
|
|
646
|
+
mode: "multiple"
|
|
647
|
+
}, computedProps.input)
|
|
648
|
+
) }));
|
|
649
|
+
return /* @__PURE__ */ jsx8(
|
|
650
|
+
AntdForm.List,
|
|
651
|
+
{
|
|
652
|
+
name: computedProps.name,
|
|
653
|
+
rules: computedProps.rules,
|
|
654
|
+
children: (fields, { add, remove }, { errors }) => {
|
|
655
|
+
var _a2, _b;
|
|
656
|
+
return /* @__PURE__ */ jsxs(Fragment3, { children: [
|
|
657
|
+
computedProps.label && /* @__PURE__ */ jsx8("div", { className: "ant-form-item-label", children: /* @__PURE__ */ jsx8("label", { className: ((_a2 = computedProps.rules) == null ? void 0 : _a2.find((r) => r.required)) && "ant-form-item-required", children: computedProps.label }) }),
|
|
666
658
|
fields.map((field) => {
|
|
667
659
|
var _a3;
|
|
668
|
-
return /* @__PURE__ */ jsx8(AntdForm.Item, {
|
|
669
|
-
|
|
660
|
+
return /* @__PURE__ */ jsx8(AntdForm.Item, { children: /* @__PURE__ */ jsxs(
|
|
661
|
+
Row,
|
|
662
|
+
{
|
|
670
663
|
gutter: 24,
|
|
671
664
|
style: { flexFlow: "row nowrap" },
|
|
672
665
|
children: [
|
|
673
|
-
/* @__PURE__ */ jsx8(Col, {
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
...field,
|
|
666
|
+
/* @__PURE__ */ jsx8(Col, { span: 23, children: /* @__PURE__ */ jsx8(
|
|
667
|
+
AntdForm.Item,
|
|
668
|
+
__spreadProps(__spreadValues({}, field), {
|
|
677
669
|
noStyle: true,
|
|
678
|
-
children: /* @__PURE__ */ jsx8(
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
670
|
+
children: /* @__PURE__ */ jsx8(
|
|
671
|
+
InputNumber,
|
|
672
|
+
__spreadValues({
|
|
673
|
+
style: { width: "100%" }
|
|
674
|
+
}, computedProps.input)
|
|
675
|
+
)
|
|
682
676
|
})
|
|
683
|
-
}),
|
|
684
|
-
/* @__PURE__ */ jsx8(Col, {
|
|
685
|
-
|
|
686
|
-
|
|
677
|
+
) }),
|
|
678
|
+
/* @__PURE__ */ jsx8(Col, { span: 1, children: !((_a3 = computedProps.input) == null ? void 0 : _a3.disabled) && (!computedProps.rules.find((r) => r.required) || field.key > 0) && /* @__PURE__ */ jsx8(
|
|
679
|
+
Button,
|
|
680
|
+
{
|
|
687
681
|
danger: true,
|
|
688
682
|
type: "link",
|
|
689
683
|
style: { float: "right" },
|
|
690
684
|
icon: /* @__PURE__ */ jsx8(MinusCircleOutlined, {}),
|
|
691
685
|
onClick: () => remove(field.name)
|
|
692
|
-
}
|
|
693
|
-
})
|
|
686
|
+
}
|
|
687
|
+
) })
|
|
694
688
|
]
|
|
695
|
-
}
|
|
696
|
-
}, field.key);
|
|
689
|
+
}
|
|
690
|
+
) }, field.key);
|
|
697
691
|
}),
|
|
698
|
-
/* @__PURE__ */ jsxs(AntdForm.Item, {
|
|
699
|
-
|
|
700
|
-
|
|
692
|
+
/* @__PURE__ */ jsxs(AntdForm.Item, { children: [
|
|
693
|
+
!((_b = computedProps.input) == null ? void 0 : _b.disabled) && (!computedProps.maxCount || computedProps.maxCount > fields.length) && /* @__PURE__ */ jsx8(
|
|
694
|
+
Button,
|
|
695
|
+
{
|
|
701
696
|
type: "dashed",
|
|
702
697
|
block: true,
|
|
703
698
|
onClick: () => add(),
|
|
704
699
|
icon: /* @__PURE__ */ jsx8(PlusOutlined, {})
|
|
705
|
-
}
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
]
|
|
712
|
-
});
|
|
700
|
+
}
|
|
701
|
+
),
|
|
702
|
+
/* @__PURE__ */ jsx8(AntdForm.ErrorList, { errors })
|
|
703
|
+
] })
|
|
704
|
+
] });
|
|
705
|
+
}
|
|
713
706
|
}
|
|
714
|
-
|
|
707
|
+
);
|
|
715
708
|
case "boolean":
|
|
716
|
-
return /* @__PURE__ */ jsx8(AntdForm.Item, {
|
|
717
|
-
...computedProps,
|
|
718
|
-
children: /* @__PURE__ */ jsx8(Switch, {
|
|
719
|
-
...computedProps.input
|
|
720
|
-
})
|
|
721
|
-
});
|
|
709
|
+
return /* @__PURE__ */ jsx8(AntdForm.Item, __spreadProps(__spreadValues({}, computedProps), { children: /* @__PURE__ */ jsx8(Switch, __spreadValues({}, computedProps.input)) }));
|
|
722
710
|
case "date":
|
|
723
|
-
return /* @__PURE__ */ jsx8(AntdForm.Item, {
|
|
724
|
-
...computedProps,
|
|
725
|
-
children: /* @__PURE__ */ jsx8(DatePicker, {
|
|
726
|
-
...computedProps.input
|
|
727
|
-
})
|
|
728
|
-
});
|
|
711
|
+
return /* @__PURE__ */ jsx8(AntdForm.Item, __spreadProps(__spreadValues({}, computedProps), { children: /* @__PURE__ */ jsx8(DatePicker, __spreadValues({}, computedProps.input)) }));
|
|
729
712
|
case "time":
|
|
730
|
-
return /* @__PURE__ */ jsx8(AntdForm.Item, {
|
|
731
|
-
...computedProps,
|
|
732
|
-
children: /* @__PURE__ */ jsx8(TimePicker, {
|
|
733
|
-
...computedProps.input
|
|
734
|
-
})
|
|
735
|
-
});
|
|
713
|
+
return /* @__PURE__ */ jsx8(AntdForm.Item, __spreadProps(__spreadValues({}, computedProps), { children: /* @__PURE__ */ jsx8(TimePicker, __spreadValues({}, computedProps.input)) }));
|
|
736
714
|
case "object":
|
|
737
|
-
return /* @__PURE__ */ jsxs(Fragment3, {
|
|
738
|
-
children:
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
}),
|
|
746
|
-
computedProps.object.map((o) => /* @__PURE__ */ jsx8(FormItem, {
|
|
747
|
-
...o
|
|
748
|
-
}, o.id))
|
|
749
|
-
]
|
|
750
|
-
});
|
|
715
|
+
return /* @__PURE__ */ jsxs(Fragment3, { children: [
|
|
716
|
+
computedProps.label && /* @__PURE__ */ jsx8("div", { className: "ant-form-item-label", children: /* @__PURE__ */ jsx8("label", { className: ((_a = computedProps.rules) == null ? void 0 : _a.find((r) => r.required)) && "ant-form-item-required", children: computedProps.label }) }),
|
|
717
|
+
computedProps.object.map((o) => /* @__PURE__ */ jsx8(
|
|
718
|
+
FormItem,
|
|
719
|
+
__spreadValues({}, o),
|
|
720
|
+
o.id
|
|
721
|
+
))
|
|
722
|
+
] });
|
|
751
723
|
case "object[]":
|
|
752
|
-
return /* @__PURE__ */ jsx8(
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
724
|
+
return /* @__PURE__ */ jsx8(
|
|
725
|
+
AntdForm.List,
|
|
726
|
+
{
|
|
727
|
+
name: computedProps.name,
|
|
728
|
+
rules: computedProps.rules,
|
|
729
|
+
children: (fields, { add, remove }, { errors }) => /* @__PURE__ */ jsxs(Fragment3, { children: [
|
|
730
|
+
fields.map((field) => /* @__PURE__ */ jsxs(
|
|
731
|
+
AntdForm.Item,
|
|
732
|
+
{
|
|
733
|
+
style: { marginBottom: 0 },
|
|
734
|
+
children: [
|
|
735
|
+
/* @__PURE__ */ jsx8("div", { className: "ant-form-item-label", children: /* @__PURE__ */ jsxs("label", { children: [
|
|
736
|
+
computedProps.label,
|
|
737
|
+
" ",
|
|
738
|
+
field.name + 1,
|
|
739
|
+
!computedProps.disabled && (!computedProps.rules.find((r) => r.required) || field.key > 0) && /* @__PURE__ */ jsx8(
|
|
740
|
+
Button,
|
|
741
|
+
{
|
|
768
742
|
danger: true,
|
|
769
743
|
type: "link",
|
|
770
744
|
onClick: () => remove(field.name),
|
|
771
745
|
children: common2.delete
|
|
772
|
-
}
|
|
773
|
-
|
|
774
|
-
})
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
746
|
+
}
|
|
747
|
+
)
|
|
748
|
+
] }) }),
|
|
749
|
+
/* @__PURE__ */ jsx8(Row, { gutter: 24, children: computedProps.object.map((o) => /* @__PURE__ */ jsx8(
|
|
750
|
+
Col,
|
|
751
|
+
{
|
|
752
|
+
span: o.col || 24,
|
|
753
|
+
children: /* @__PURE__ */ jsx8(
|
|
754
|
+
FormItem,
|
|
755
|
+
__spreadProps(__spreadValues({}, o), {
|
|
756
|
+
name: [field.name, o.id]
|
|
757
|
+
})
|
|
758
|
+
)
|
|
759
|
+
},
|
|
760
|
+
o.id
|
|
761
|
+
)) })
|
|
762
|
+
]
|
|
763
|
+
},
|
|
764
|
+
field.key
|
|
765
|
+
)),
|
|
766
|
+
/* @__PURE__ */ jsxs(AntdForm.Item, { children: [
|
|
767
|
+
!computedProps.disabled && (!computedProps.maxCount || computedProps.maxCount > fields.length) && /* @__PURE__ */ jsxs(
|
|
768
|
+
Button,
|
|
769
|
+
{
|
|
791
770
|
type: "dashed",
|
|
792
771
|
block: true,
|
|
793
772
|
onClick: () => add(),
|
|
@@ -797,15 +776,13 @@ function FormItem(props) {
|
|
|
797
776
|
" ",
|
|
798
777
|
computedProps.label
|
|
799
778
|
]
|
|
800
|
-
}
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
})
|
|
808
|
-
});
|
|
779
|
+
}
|
|
780
|
+
),
|
|
781
|
+
/* @__PURE__ */ jsx8(AntdForm.ErrorList, { errors })
|
|
782
|
+
] })
|
|
783
|
+
] })
|
|
784
|
+
}
|
|
785
|
+
);
|
|
809
786
|
default:
|
|
810
787
|
return null;
|
|
811
788
|
}
|
|
@@ -816,18 +793,17 @@ FormItem.useStatus = AntdForm.Item.useStatus;
|
|
|
816
793
|
import { jsx as jsx9, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
817
794
|
function Form(props) {
|
|
818
795
|
var _a, _b;
|
|
819
|
-
const [loading, setLoading] =
|
|
820
|
-
const [computedProps, setComputedProps] =
|
|
796
|
+
const [loading, setLoading] = useState6(false);
|
|
797
|
+
const [computedProps, setComputedProps] = useState6();
|
|
821
798
|
const config = useConfigContext();
|
|
822
|
-
const [extendTypes, setExtendTypes] =
|
|
799
|
+
const [extendTypes, setExtendTypes] = useState6();
|
|
823
800
|
const [form] = AntdForm2.useForm(props.form);
|
|
824
|
-
const [initialValues, setInitialValues] =
|
|
825
|
-
|
|
801
|
+
const [initialValues, setInitialValues] = useState6(props.initialValues);
|
|
802
|
+
useEffect5(() => {
|
|
826
803
|
var _a2, _b2, _c;
|
|
827
|
-
const propsCopy = {
|
|
828
|
-
...props,
|
|
804
|
+
const propsCopy = __spreadProps(__spreadValues({}, props), {
|
|
829
805
|
form
|
|
830
|
-
};
|
|
806
|
+
});
|
|
831
807
|
if (propsCopy.initialValues && ((_a2 = propsCopy.items) == null ? void 0 : _a2.length)) {
|
|
832
808
|
for (const key in propsCopy.initialValues) {
|
|
833
809
|
propsCopy.initialValues[key] = transferValue(
|
|
@@ -851,10 +827,7 @@ function Form(props) {
|
|
|
851
827
|
setLoading(true);
|
|
852
828
|
try {
|
|
853
829
|
if (propsCopy.submit && ((_a3 = propsCopy.submit.to) == null ? void 0 : _a3.action)) {
|
|
854
|
-
await props.onFinish(values, async (values2) => faas(propsCopy.submit.to.action, propsCopy.submit.to.params ? {
|
|
855
|
-
...values2,
|
|
856
|
-
...propsCopy.submit.to.params
|
|
857
|
-
} : values2));
|
|
830
|
+
await props.onFinish(values, async (values2) => faas(propsCopy.submit.to.action, propsCopy.submit.to.params ? __spreadValues(__spreadValues({}, values2), propsCopy.submit.to.params) : values2));
|
|
858
831
|
} else
|
|
859
832
|
await props.onFinish(values);
|
|
860
833
|
} catch (error) {
|
|
@@ -865,10 +838,7 @@ function Form(props) {
|
|
|
865
838
|
} else if (propsCopy.submit && ((_c = propsCopy.submit.to) == null ? void 0 : _c.action)) {
|
|
866
839
|
propsCopy.onFinish = async (values) => {
|
|
867
840
|
setLoading(true);
|
|
868
|
-
return faas(propsCopy.submit.to.action, propsCopy.submit.to.params ? {
|
|
869
|
-
...values,
|
|
870
|
-
...propsCopy.submit.to.params
|
|
871
|
-
} : values).then((result) => {
|
|
841
|
+
return faas(propsCopy.submit.to.action, propsCopy.submit.to.params ? __spreadValues(__spreadValues({}, values), propsCopy.submit.to.params) : values).then((result) => {
|
|
872
842
|
if (propsCopy.submit.to.then)
|
|
873
843
|
propsCopy.submit.to.then(result);
|
|
874
844
|
return result;
|
|
@@ -902,7 +872,7 @@ function Form(props) {
|
|
|
902
872
|
item.onValueChange(changedValues[key], allValues, form);
|
|
903
873
|
}
|
|
904
874
|
}, [computedProps]);
|
|
905
|
-
|
|
875
|
+
useEffect5(() => {
|
|
906
876
|
if (!initialValues)
|
|
907
877
|
return;
|
|
908
878
|
console.debug("Form:initialValues", initialValues);
|
|
@@ -911,25 +881,33 @@ function Form(props) {
|
|
|
911
881
|
}, [computedProps]);
|
|
912
882
|
if (!computedProps)
|
|
913
883
|
return null;
|
|
914
|
-
return /* @__PURE__ */ jsxs2(
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
884
|
+
return /* @__PURE__ */ jsxs2(
|
|
885
|
+
AntdForm2,
|
|
886
|
+
__spreadProps(__spreadValues({}, computedProps), {
|
|
887
|
+
onValuesChange,
|
|
888
|
+
children: [
|
|
889
|
+
computedProps.beforeItems,
|
|
890
|
+
(_a = computedProps.items) == null ? void 0 : _a.map((item) => isValidElement(item) ? item : /* @__PURE__ */ jsx9(
|
|
891
|
+
FormItem,
|
|
892
|
+
__spreadProps(__spreadValues({}, item), {
|
|
893
|
+
extendTypes
|
|
894
|
+
}),
|
|
895
|
+
item.id
|
|
896
|
+
)),
|
|
897
|
+
computedProps.children,
|
|
898
|
+
computedProps.submit !== false && /* @__PURE__ */ jsx9(
|
|
899
|
+
Button2,
|
|
900
|
+
{
|
|
901
|
+
htmlType: "submit",
|
|
902
|
+
type: "primary",
|
|
903
|
+
loading,
|
|
904
|
+
children: ((_b = computedProps.submit) == null ? void 0 : _b.text) || config.Form.submit.text
|
|
905
|
+
}
|
|
906
|
+
),
|
|
907
|
+
computedProps.footer
|
|
908
|
+
]
|
|
909
|
+
})
|
|
910
|
+
);
|
|
933
911
|
}
|
|
934
912
|
Form.useForm = AntdForm2.useForm;
|
|
935
913
|
Form.useFormInstance = AntdForm2.useFormInstance;
|
|
@@ -946,11 +924,9 @@ import { jsx as jsx10 } from "react/jsx-runtime";
|
|
|
946
924
|
function Link(props) {
|
|
947
925
|
var _a, _b, _c, _d;
|
|
948
926
|
const { Link: Link2 } = useConfigContext();
|
|
949
|
-
let style = {
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
...props.style
|
|
953
|
-
};
|
|
927
|
+
let style = __spreadValues(__spreadProps(__spreadValues({}, Link2.style || {}), {
|
|
928
|
+
cursor: "pointer"
|
|
929
|
+
}), props.style);
|
|
954
930
|
if (props.block)
|
|
955
931
|
style = Object.assign({
|
|
956
932
|
display: "block",
|
|
@@ -958,61 +934,67 @@ function Link(props) {
|
|
|
958
934
|
}, style);
|
|
959
935
|
if (props.href.startsWith("http")) {
|
|
960
936
|
if (props.button)
|
|
961
|
-
return /* @__PURE__ */ jsx10(
|
|
962
|
-
|
|
937
|
+
return /* @__PURE__ */ jsx10(
|
|
938
|
+
Button3,
|
|
939
|
+
__spreadProps(__spreadValues({}, props.button), {
|
|
940
|
+
target: props.target || (Link2 == null ? void 0 : Link2.target) || "_blank",
|
|
941
|
+
style,
|
|
942
|
+
href: props.href,
|
|
943
|
+
children: (_a = props.text) != null ? _a : props.children
|
|
944
|
+
})
|
|
945
|
+
);
|
|
946
|
+
return /* @__PURE__ */ jsx10(
|
|
947
|
+
"a",
|
|
948
|
+
{
|
|
949
|
+
href: props.href,
|
|
963
950
|
target: props.target || (Link2 == null ? void 0 : Link2.target) || "_blank",
|
|
964
951
|
style,
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
return /* @__PURE__ */ jsx10("a", {
|
|
969
|
-
href: props.href,
|
|
970
|
-
target: props.target || (Link2 == null ? void 0 : Link2.target) || "_blank",
|
|
971
|
-
style,
|
|
972
|
-
children: (_b = props.text) != null ? _b : props.children
|
|
973
|
-
});
|
|
952
|
+
children: (_b = props.text) != null ? _b : props.children
|
|
953
|
+
}
|
|
954
|
+
);
|
|
974
955
|
}
|
|
975
956
|
if (props.button)
|
|
976
|
-
return /* @__PURE__ */ jsx10(
|
|
957
|
+
return /* @__PURE__ */ jsx10(
|
|
958
|
+
RouterLink,
|
|
959
|
+
{
|
|
960
|
+
to: props.href,
|
|
961
|
+
target: props.target || (Link2 == null ? void 0 : Link2.target),
|
|
962
|
+
children: /* @__PURE__ */ jsx10(
|
|
963
|
+
Button3,
|
|
964
|
+
__spreadProps(__spreadValues({}, props.button), {
|
|
965
|
+
style,
|
|
966
|
+
children: (_c = props.text) != null ? _c : props.children
|
|
967
|
+
})
|
|
968
|
+
)
|
|
969
|
+
}
|
|
970
|
+
);
|
|
971
|
+
return /* @__PURE__ */ jsx10(
|
|
972
|
+
RouterLink,
|
|
973
|
+
{
|
|
977
974
|
to: props.href,
|
|
978
975
|
target: props.target || (Link2 == null ? void 0 : Link2.target),
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
})
|
|
984
|
-
});
|
|
985
|
-
return /* @__PURE__ */ jsx10(RouterLink, {
|
|
986
|
-
to: props.href,
|
|
987
|
-
target: props.target || (Link2 == null ? void 0 : Link2.target),
|
|
988
|
-
style,
|
|
989
|
-
children: (_d = props.text) != null ? _d : props.children
|
|
990
|
-
});
|
|
976
|
+
style,
|
|
977
|
+
children: (_d = props.text) != null ? _d : props.children
|
|
978
|
+
}
|
|
979
|
+
);
|
|
991
980
|
}
|
|
992
981
|
|
|
993
982
|
// src/Modal.tsx
|
|
994
983
|
import { Modal } from "antd";
|
|
995
|
-
import { useState as
|
|
984
|
+
import { useState as useState7 } from "react";
|
|
996
985
|
import { jsx as jsx11 } from "react/jsx-runtime";
|
|
997
986
|
function useModal(init) {
|
|
998
|
-
const [props, setProps] =
|
|
987
|
+
const [props, setProps] = useState7(__spreadValues({
|
|
999
988
|
open: false,
|
|
1000
|
-
onCancel: () => setProps((prev) => ({
|
|
1001
|
-
...prev,
|
|
989
|
+
onCancel: () => setProps((prev) => __spreadProps(__spreadValues({}, prev), {
|
|
1002
990
|
open: false
|
|
1003
|
-
}))
|
|
1004
|
-
|
|
1005
|
-
});
|
|
991
|
+
}))
|
|
992
|
+
}, init));
|
|
1006
993
|
return {
|
|
1007
|
-
modal: /* @__PURE__ */ jsx11(Modal, {
|
|
1008
|
-
...props
|
|
1009
|
-
}),
|
|
994
|
+
modal: /* @__PURE__ */ jsx11(Modal, __spreadValues({}, props)),
|
|
1010
995
|
modalProps: props,
|
|
1011
996
|
setModalProps(changes) {
|
|
1012
|
-
setProps((prev) => ({
|
|
1013
|
-
...prev,
|
|
1014
|
-
...changes
|
|
1015
|
-
}));
|
|
997
|
+
setProps((prev) => __spreadValues(__spreadValues({}, prev), changes));
|
|
1016
998
|
}
|
|
1017
999
|
};
|
|
1018
1000
|
}
|
|
@@ -1029,39 +1011,39 @@ import {
|
|
|
1029
1011
|
import { jsx as jsx12, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
1030
1012
|
function PageNotFound() {
|
|
1031
1013
|
const config = useConfigContext();
|
|
1032
|
-
return /* @__PURE__ */ jsx12(
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1014
|
+
return /* @__PURE__ */ jsx12(
|
|
1015
|
+
Result,
|
|
1016
|
+
{
|
|
1017
|
+
status: "404",
|
|
1018
|
+
title: config.common.pageNotFound
|
|
1019
|
+
}
|
|
1020
|
+
);
|
|
1036
1021
|
}
|
|
1037
1022
|
function Routes(props) {
|
|
1038
|
-
return /* @__PURE__ */ jsxs3(OriginRoutes, {
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
element: r.element || /* @__PURE__ */ jsx12(Suspense, {
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
children: /* @__PURE__ */ jsx12(r.page, {})
|
|
1050
|
-
})
|
|
1051
|
-
}, r.path)),
|
|
1052
|
-
/* @__PURE__ */ jsx12(Route, {
|
|
1023
|
+
return /* @__PURE__ */ jsxs3(OriginRoutes, { children: [
|
|
1024
|
+
props.routes.map((r) => /* @__PURE__ */ jsx12(
|
|
1025
|
+
Route,
|
|
1026
|
+
__spreadProps(__spreadValues({}, r), {
|
|
1027
|
+
element: r.element || /* @__PURE__ */ jsx12(Suspense, { fallback: props.fallback || /* @__PURE__ */ jsx12("div", { style: { padding: "24px" }, children: /* @__PURE__ */ jsx12(Skeleton, { active: true }) }), children: /* @__PURE__ */ jsx12(r.page, {}) })
|
|
1028
|
+
}),
|
|
1029
|
+
r.path
|
|
1030
|
+
)),
|
|
1031
|
+
/* @__PURE__ */ jsx12(
|
|
1032
|
+
Route,
|
|
1033
|
+
{
|
|
1053
1034
|
path: "*",
|
|
1054
1035
|
element: props.notFound || /* @__PURE__ */ jsx12(PageNotFound, {})
|
|
1055
|
-
},
|
|
1056
|
-
|
|
1057
|
-
|
|
1036
|
+
},
|
|
1037
|
+
"*"
|
|
1038
|
+
)
|
|
1039
|
+
] });
|
|
1058
1040
|
}
|
|
1059
1041
|
|
|
1060
1042
|
// src/Table.tsx
|
|
1061
1043
|
import {
|
|
1062
|
-
useState as
|
|
1063
|
-
useEffect as
|
|
1064
|
-
cloneElement as
|
|
1044
|
+
useState as useState8,
|
|
1045
|
+
useEffect as useEffect6,
|
|
1046
|
+
cloneElement as cloneElement4
|
|
1065
1047
|
} from "react";
|
|
1066
1048
|
import {
|
|
1067
1049
|
Table as AntdTable,
|
|
@@ -1101,9 +1083,9 @@ function processValue(item, value) {
|
|
|
1101
1083
|
return value;
|
|
1102
1084
|
}
|
|
1103
1085
|
function Table(props) {
|
|
1104
|
-
const [columns, setColumns] =
|
|
1086
|
+
const [columns, setColumns] = useState8();
|
|
1105
1087
|
const { common: common2 } = useConfigContext();
|
|
1106
|
-
|
|
1088
|
+
useEffect6(() => {
|
|
1107
1089
|
var _a;
|
|
1108
1090
|
for (const item of props.items) {
|
|
1109
1091
|
if (!item.key)
|
|
@@ -1127,7 +1109,7 @@ function Table(props) {
|
|
|
1127
1109
|
if (item.tableChildren === null)
|
|
1128
1110
|
item.render = () => null;
|
|
1129
1111
|
else if (item.tableChildren)
|
|
1130
|
-
item.render = (value, values) =>
|
|
1112
|
+
item.render = (value, values) => cloneElement4(
|
|
1131
1113
|
item.tableChildren,
|
|
1132
1114
|
{
|
|
1133
1115
|
scene: "table",
|
|
@@ -1138,7 +1120,7 @@ function Table(props) {
|
|
|
1138
1120
|
else if (item.children === null)
|
|
1139
1121
|
item.render = () => null;
|
|
1140
1122
|
else if (item.children)
|
|
1141
|
-
item.render = (value, values) =>
|
|
1123
|
+
item.render = (value, values) => cloneElement4(
|
|
1142
1124
|
item.children,
|
|
1143
1125
|
{
|
|
1144
1126
|
scene: "table",
|
|
@@ -1148,7 +1130,7 @@ function Table(props) {
|
|
|
1148
1130
|
);
|
|
1149
1131
|
if (props.extendTypes && props.extendTypes[item.type]) {
|
|
1150
1132
|
if (props.extendTypes[item.type].children)
|
|
1151
|
-
item.render = (value, values) =>
|
|
1133
|
+
item.render = (value, values) => cloneElement4(
|
|
1152
1134
|
props.extendTypes[item.type].children,
|
|
1153
1135
|
{
|
|
1154
1136
|
scene: "table",
|
|
@@ -1179,19 +1161,22 @@ function Table(props) {
|
|
|
1179
1161
|
setSelectedKeys,
|
|
1180
1162
|
confirm,
|
|
1181
1163
|
clearFilters
|
|
1182
|
-
}) => /* @__PURE__ */ jsx13(
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1164
|
+
}) => /* @__PURE__ */ jsx13(
|
|
1165
|
+
Input2.Search,
|
|
1166
|
+
{
|
|
1167
|
+
placeholder: `${common2.search} ${item.title}`,
|
|
1168
|
+
allowClear: true,
|
|
1169
|
+
onSearch: (v) => {
|
|
1170
|
+
if (v) {
|
|
1171
|
+
setSelectedKeys([v]);
|
|
1172
|
+
} else {
|
|
1173
|
+
setSelectedKeys([]);
|
|
1174
|
+
clearFilters();
|
|
1175
|
+
}
|
|
1176
|
+
confirm();
|
|
1191
1177
|
}
|
|
1192
|
-
confirm();
|
|
1193
1178
|
}
|
|
1194
|
-
|
|
1179
|
+
);
|
|
1195
1180
|
break;
|
|
1196
1181
|
case "string[]":
|
|
1197
1182
|
if (!item.render)
|
|
@@ -1209,19 +1194,22 @@ function Table(props) {
|
|
|
1209
1194
|
setSelectedKeys,
|
|
1210
1195
|
confirm,
|
|
1211
1196
|
clearFilters
|
|
1212
|
-
}) => /* @__PURE__ */ jsx13(
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1197
|
+
}) => /* @__PURE__ */ jsx13(
|
|
1198
|
+
Input2.Search,
|
|
1199
|
+
{
|
|
1200
|
+
placeholder: `${common2.search} ${item.title}`,
|
|
1201
|
+
allowClear: true,
|
|
1202
|
+
onSearch: (v) => {
|
|
1203
|
+
if (v) {
|
|
1204
|
+
setSelectedKeys([v]);
|
|
1205
|
+
} else {
|
|
1206
|
+
setSelectedKeys([]);
|
|
1207
|
+
clearFilters();
|
|
1208
|
+
}
|
|
1209
|
+
confirm();
|
|
1221
1210
|
}
|
|
1222
|
-
confirm();
|
|
1223
1211
|
}
|
|
1224
|
-
|
|
1212
|
+
);
|
|
1225
1213
|
break;
|
|
1226
1214
|
case "number":
|
|
1227
1215
|
if (!item.render)
|
|
@@ -1239,19 +1227,22 @@ function Table(props) {
|
|
|
1239
1227
|
setSelectedKeys,
|
|
1240
1228
|
confirm,
|
|
1241
1229
|
clearFilters
|
|
1242
|
-
}) => /* @__PURE__ */ jsx13(
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1230
|
+
}) => /* @__PURE__ */ jsx13(
|
|
1231
|
+
Input2.Search,
|
|
1232
|
+
{
|
|
1233
|
+
placeholder: `${common2.search} ${item.title}`,
|
|
1234
|
+
allowClear: true,
|
|
1235
|
+
onSearch: (v) => {
|
|
1236
|
+
if (v) {
|
|
1237
|
+
setSelectedKeys([Number(v)]);
|
|
1238
|
+
} else {
|
|
1239
|
+
setSelectedKeys([]);
|
|
1240
|
+
clearFilters();
|
|
1241
|
+
}
|
|
1242
|
+
confirm();
|
|
1251
1243
|
}
|
|
1252
|
-
confirm();
|
|
1253
1244
|
}
|
|
1254
|
-
|
|
1245
|
+
);
|
|
1255
1246
|
break;
|
|
1256
1247
|
case "number[]":
|
|
1257
1248
|
if (!item.render)
|
|
@@ -1269,74 +1260,61 @@ function Table(props) {
|
|
|
1269
1260
|
setSelectedKeys,
|
|
1270
1261
|
confirm,
|
|
1271
1262
|
clearFilters
|
|
1272
|
-
}) => /* @__PURE__ */ jsx13(
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1263
|
+
}) => /* @__PURE__ */ jsx13(
|
|
1264
|
+
Input2.Search,
|
|
1265
|
+
{
|
|
1266
|
+
placeholder: `${common2.search} ${item.title}`,
|
|
1267
|
+
allowClear: true,
|
|
1268
|
+
onSearch: (v) => {
|
|
1269
|
+
if (v) {
|
|
1270
|
+
setSelectedKeys([Number(v)]);
|
|
1271
|
+
} else {
|
|
1272
|
+
setSelectedKeys([]);
|
|
1273
|
+
clearFilters();
|
|
1274
|
+
}
|
|
1275
|
+
confirm();
|
|
1281
1276
|
}
|
|
1282
|
-
confirm();
|
|
1283
1277
|
}
|
|
1284
|
-
|
|
1278
|
+
);
|
|
1285
1279
|
break;
|
|
1286
1280
|
case "boolean":
|
|
1287
1281
|
if (!item.render)
|
|
1288
|
-
item.render = (value) => typeof value === "undefined" ? /* @__PURE__ */ jsx13(Blank, {}) : value ? /* @__PURE__ */ jsx13(CheckOutlined2, {
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
marginTop: "4px",
|
|
1296
|
-
color: "#ff4d4f"
|
|
1297
|
-
}
|
|
1298
|
-
});
|
|
1282
|
+
item.render = (value) => typeof value === "undefined" ? /* @__PURE__ */ jsx13(Blank, {}) : value ? /* @__PURE__ */ jsx13(CheckOutlined2, { style: {
|
|
1283
|
+
marginTop: "4px",
|
|
1284
|
+
color: "#52c41a"
|
|
1285
|
+
} }) : /* @__PURE__ */ jsx13(CloseOutlined2, { style: {
|
|
1286
|
+
marginTop: "4px",
|
|
1287
|
+
color: "#ff4d4f"
|
|
1288
|
+
} });
|
|
1299
1289
|
if (item.filterDropdown !== false)
|
|
1300
1290
|
item.filterDropdown = ({
|
|
1301
1291
|
setSelectedKeys,
|
|
1302
1292
|
selectedKeys,
|
|
1303
1293
|
confirm
|
|
1304
|
-
}) => /* @__PURE__ */ jsxs4(
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
})
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
style: {
|
|
1329
|
-
verticalAlign: "middle",
|
|
1330
|
-
color: "#ff4d4f"
|
|
1331
|
-
}
|
|
1332
|
-
})
|
|
1333
|
-
}),
|
|
1334
|
-
/* @__PURE__ */ jsx13(Radio.Button, {
|
|
1335
|
-
value: "empty",
|
|
1336
|
-
children: common2.blank
|
|
1337
|
-
})
|
|
1338
|
-
]
|
|
1339
|
-
});
|
|
1294
|
+
}) => /* @__PURE__ */ jsxs4(
|
|
1295
|
+
Radio.Group,
|
|
1296
|
+
{
|
|
1297
|
+
style: { padding: 8 },
|
|
1298
|
+
buttonStyle: "solid",
|
|
1299
|
+
value: selectedKeys[0],
|
|
1300
|
+
onChange: (e) => {
|
|
1301
|
+
setSelectedKeys(e.target.value ? [e.target.value] : []);
|
|
1302
|
+
confirm();
|
|
1303
|
+
},
|
|
1304
|
+
children: [
|
|
1305
|
+
/* @__PURE__ */ jsx13(Radio.Button, { children: common2.all }),
|
|
1306
|
+
/* @__PURE__ */ jsx13(Radio.Button, { value: "true", children: /* @__PURE__ */ jsx13(CheckOutlined2, { style: {
|
|
1307
|
+
color: "#52c41a",
|
|
1308
|
+
verticalAlign: "middle"
|
|
1309
|
+
} }) }),
|
|
1310
|
+
/* @__PURE__ */ jsx13(Radio.Button, { value: "false", children: /* @__PURE__ */ jsx13(CloseOutlined2, { style: {
|
|
1311
|
+
verticalAlign: "middle",
|
|
1312
|
+
color: "#ff4d4f"
|
|
1313
|
+
} }) }),
|
|
1314
|
+
/* @__PURE__ */ jsx13(Radio.Button, { value: "empty", children: common2.blank })
|
|
1315
|
+
]
|
|
1316
|
+
}
|
|
1317
|
+
);
|
|
1340
1318
|
if (!item.onFilter)
|
|
1341
1319
|
item.onFilter = (value, row) => {
|
|
1342
1320
|
switch (value) {
|
|
@@ -1369,21 +1347,26 @@ function Table(props) {
|
|
|
1369
1347
|
break;
|
|
1370
1348
|
case "object":
|
|
1371
1349
|
if (!item.render)
|
|
1372
|
-
item.render = (value) => /* @__PURE__ */ jsx13(
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1350
|
+
item.render = (value) => /* @__PURE__ */ jsx13(
|
|
1351
|
+
Description,
|
|
1352
|
+
{
|
|
1353
|
+
items: item.object,
|
|
1354
|
+
dataSource: value || {},
|
|
1355
|
+
column: 1
|
|
1356
|
+
}
|
|
1357
|
+
);
|
|
1377
1358
|
break;
|
|
1378
1359
|
case "object[]":
|
|
1379
1360
|
if (!item.render)
|
|
1380
|
-
item.render = (value) => /* @__PURE__ */ jsx13(Fragment4, {
|
|
1381
|
-
|
|
1361
|
+
item.render = (value) => /* @__PURE__ */ jsx13(Fragment4, { children: value.map((v, i) => /* @__PURE__ */ jsx13(
|
|
1362
|
+
Description,
|
|
1363
|
+
{
|
|
1382
1364
|
items: item.object,
|
|
1383
1365
|
dataSource: v || [],
|
|
1384
1366
|
column: 1
|
|
1385
|
-
},
|
|
1386
|
-
|
|
1367
|
+
},
|
|
1368
|
+
i
|
|
1369
|
+
)) });
|
|
1387
1370
|
break;
|
|
1388
1371
|
default:
|
|
1389
1372
|
if (!item.render)
|
|
@@ -1399,7 +1382,7 @@ function Table(props) {
|
|
|
1399
1382
|
}
|
|
1400
1383
|
setColumns(props.items);
|
|
1401
1384
|
}, [props.items]);
|
|
1402
|
-
|
|
1385
|
+
useEffect6(() => {
|
|
1403
1386
|
if (!props.dataSource || !columns)
|
|
1404
1387
|
return;
|
|
1405
1388
|
for (const column of columns) {
|
|
@@ -1424,19 +1407,26 @@ function Table(props) {
|
|
|
1424
1407
|
if (!columns)
|
|
1425
1408
|
return null;
|
|
1426
1409
|
if (!props.faasData)
|
|
1427
|
-
return /* @__PURE__ */ jsx13(
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1410
|
+
return /* @__PURE__ */ jsx13(
|
|
1411
|
+
AntdTable,
|
|
1412
|
+
__spreadProps(__spreadValues({}, props), {
|
|
1413
|
+
rowKey: props.rowKey || "id",
|
|
1414
|
+
columns,
|
|
1415
|
+
dataSource: props.dataSource
|
|
1416
|
+
})
|
|
1417
|
+
);
|
|
1418
|
+
return /* @__PURE__ */ jsx13(
|
|
1419
|
+
FaasDataWrapper2,
|
|
1420
|
+
__spreadProps(__spreadValues({}, props.faasData), {
|
|
1421
|
+
children: /* @__PURE__ */ jsx13(
|
|
1422
|
+
FaasDataTable,
|
|
1423
|
+
{
|
|
1424
|
+
props,
|
|
1425
|
+
columns
|
|
1426
|
+
}
|
|
1427
|
+
)
|
|
1438
1428
|
})
|
|
1439
|
-
|
|
1429
|
+
);
|
|
1440
1430
|
}
|
|
1441
1431
|
function FaasDataTable({
|
|
1442
1432
|
props,
|
|
@@ -1445,8 +1435,8 @@ function FaasDataTable({
|
|
|
1445
1435
|
params,
|
|
1446
1436
|
reload
|
|
1447
1437
|
}) {
|
|
1448
|
-
const [currentColumns, setCurrentColumns] =
|
|
1449
|
-
|
|
1438
|
+
const [currentColumns, setCurrentColumns] = useState8(columns);
|
|
1439
|
+
useEffect6(() => {
|
|
1450
1440
|
if (!data || Array.isArray(data))
|
|
1451
1441
|
return;
|
|
1452
1442
|
setCurrentColumns((prev) => {
|
|
@@ -1482,75 +1472,75 @@ function FaasDataTable({
|
|
|
1482
1472
|
});
|
|
1483
1473
|
}, [columns, data]);
|
|
1484
1474
|
if (!data)
|
|
1485
|
-
return /* @__PURE__ */ jsx13(
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1475
|
+
return /* @__PURE__ */ jsx13(
|
|
1476
|
+
AntdTable,
|
|
1477
|
+
__spreadProps(__spreadValues({}, props), {
|
|
1478
|
+
rowKey: props.rowKey || "id",
|
|
1479
|
+
columns: currentColumns,
|
|
1480
|
+
dataSource: []
|
|
1481
|
+
})
|
|
1482
|
+
);
|
|
1491
1483
|
if (Array.isArray(data))
|
|
1492
|
-
return /* @__PURE__ */ jsx13(
|
|
1493
|
-
|
|
1484
|
+
return /* @__PURE__ */ jsx13(
|
|
1485
|
+
AntdTable,
|
|
1486
|
+
__spreadProps(__spreadValues({}, props), {
|
|
1487
|
+
rowKey: props.rowKey || "id",
|
|
1488
|
+
columns: currentColumns,
|
|
1489
|
+
dataSource: data
|
|
1490
|
+
})
|
|
1491
|
+
);
|
|
1492
|
+
return /* @__PURE__ */ jsx13(
|
|
1493
|
+
AntdTable,
|
|
1494
|
+
__spreadProps(__spreadValues({}, props), {
|
|
1494
1495
|
rowKey: props.rowKey || "id",
|
|
1495
1496
|
columns: currentColumns,
|
|
1496
|
-
dataSource: data
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
filters: processed.filters,
|
|
1514
|
-
sorter: processed.sorter
|
|
1515
|
-
});
|
|
1516
|
-
return;
|
|
1497
|
+
dataSource: data.rows,
|
|
1498
|
+
pagination: __spreadValues(__spreadValues({}, props.pagination), data.pagination),
|
|
1499
|
+
onChange: (pagination, filters, sorter, extra) => {
|
|
1500
|
+
if (props.onChange) {
|
|
1501
|
+
const processed = props.onChange(pagination, filters, sorter, extra);
|
|
1502
|
+
reload(__spreadProps(__spreadValues({}, params), {
|
|
1503
|
+
pagination: processed.pagination,
|
|
1504
|
+
filters: processed.filters,
|
|
1505
|
+
sorter: processed.sorter
|
|
1506
|
+
}));
|
|
1507
|
+
return;
|
|
1508
|
+
}
|
|
1509
|
+
reload(__spreadProps(__spreadValues({}, params), {
|
|
1510
|
+
pagination,
|
|
1511
|
+
filters,
|
|
1512
|
+
sorter
|
|
1513
|
+
}));
|
|
1517
1514
|
}
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
pagination,
|
|
1521
|
-
filters,
|
|
1522
|
-
sorter
|
|
1523
|
-
});
|
|
1524
|
-
}
|
|
1525
|
-
});
|
|
1515
|
+
})
|
|
1516
|
+
);
|
|
1526
1517
|
}
|
|
1527
1518
|
|
|
1528
1519
|
// src/Title.tsx
|
|
1529
|
-
import { useEffect as
|
|
1520
|
+
import { useEffect as useEffect7, cloneElement as cloneElement5 } from "react";
|
|
1530
1521
|
import { Fragment as Fragment5, jsx as jsx14 } from "react/jsx-runtime";
|
|
1531
1522
|
function Title(props) {
|
|
1532
1523
|
const { Title: Title2 } = useConfigContext();
|
|
1533
|
-
|
|
1524
|
+
useEffect7(() => {
|
|
1534
1525
|
const title = Array.isArray(props.title) ? props.title : [props.title];
|
|
1535
1526
|
document.title = title.concat(props.suffix || Title2.suffix).filter((t) => !!t).join(props.separator || Title2.separator);
|
|
1536
1527
|
}, [props]);
|
|
1537
1528
|
if (props.h1) {
|
|
1538
1529
|
if (typeof props.h1 === "boolean")
|
|
1539
|
-
return /* @__PURE__ */ jsx14("h1", {
|
|
1530
|
+
return /* @__PURE__ */ jsx14("h1", { children: Array.isArray(props.title) ? props.title[0] : props.title });
|
|
1531
|
+
return /* @__PURE__ */ jsx14(
|
|
1532
|
+
"h1",
|
|
1533
|
+
{
|
|
1534
|
+
className: props.h1.className,
|
|
1535
|
+
style: props.h1.style,
|
|
1540
1536
|
children: Array.isArray(props.title) ? props.title[0] : props.title
|
|
1541
|
-
}
|
|
1542
|
-
|
|
1543
|
-
className: props.h1.className,
|
|
1544
|
-
style: props.h1.style,
|
|
1545
|
-
children: Array.isArray(props.title) ? props.title[0] : props.title
|
|
1546
|
-
});
|
|
1537
|
+
}
|
|
1538
|
+
);
|
|
1547
1539
|
}
|
|
1548
1540
|
if (props.plain)
|
|
1549
|
-
return /* @__PURE__ */ jsx14(Fragment5, {
|
|
1550
|
-
children: Array.isArray(props.title) ? props.title[0] : props.title
|
|
1551
|
-
});
|
|
1541
|
+
return /* @__PURE__ */ jsx14(Fragment5, { children: Array.isArray(props.title) ? props.title[0] : props.title });
|
|
1552
1542
|
if (props.children)
|
|
1553
|
-
return
|
|
1543
|
+
return cloneElement5(props.children, { title: props.title });
|
|
1554
1544
|
return null;
|
|
1555
1545
|
}
|
|
1556
1546
|
export {
|
|
@@ -1560,7 +1550,7 @@ export {
|
|
|
1560
1550
|
Description,
|
|
1561
1551
|
Drawer,
|
|
1562
1552
|
ErrorBoundary,
|
|
1563
|
-
FaasDataWrapper,
|
|
1553
|
+
FaasDataWrapper2 as FaasDataWrapper,
|
|
1564
1554
|
Form,
|
|
1565
1555
|
FormItem,
|
|
1566
1556
|
Link,
|