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