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