@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.js
CHANGED
|
@@ -1,10 +1,27 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __create = Object.create;
|
|
3
3
|
var __defProp = Object.defineProperty;
|
|
4
|
+
var __defProps = Object.defineProperties;
|
|
4
5
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
5
7
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
8
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
6
9
|
var __getProtoOf = Object.getPrototypeOf;
|
|
7
10
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
11
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
12
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
13
|
+
var __spreadValues = (a, b) => {
|
|
14
|
+
for (var prop in b || (b = {}))
|
|
15
|
+
if (__hasOwnProp.call(b, prop))
|
|
16
|
+
__defNormalProp(a, prop, b[prop]);
|
|
17
|
+
if (__getOwnPropSymbols)
|
|
18
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
19
|
+
if (__propIsEnum.call(b, prop))
|
|
20
|
+
__defNormalProp(a, prop, b[prop]);
|
|
21
|
+
}
|
|
22
|
+
return a;
|
|
23
|
+
};
|
|
24
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
8
25
|
var __export = (target, all) => {
|
|
9
26
|
for (var name in all)
|
|
10
27
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -32,7 +49,7 @@ __export(src_exports, {
|
|
|
32
49
|
Description: () => Description,
|
|
33
50
|
Drawer: () => import_antd4.Drawer,
|
|
34
51
|
ErrorBoundary: () => ErrorBoundary,
|
|
35
|
-
FaasDataWrapper: () =>
|
|
52
|
+
FaasDataWrapper: () => FaasDataWrapper2,
|
|
36
53
|
Form: () => Form,
|
|
37
54
|
FormItem: () => FormItem,
|
|
38
55
|
Link: () => Link,
|
|
@@ -106,7 +123,6 @@ function ConfigProvider({
|
|
|
106
123
|
}) {
|
|
107
124
|
const [values, setValues] = (0, import_react2.useState)(baseConfig);
|
|
108
125
|
(0, import_react2.useEffect)(() => {
|
|
109
|
-
console.log(config);
|
|
110
126
|
if (config.lang === "zh") {
|
|
111
127
|
setValues((0, import_lodash_es.defaultsDeep)(config, {
|
|
112
128
|
lang: "zh",
|
|
@@ -117,23 +133,17 @@ function ConfigProvider({
|
|
|
117
133
|
} else
|
|
118
134
|
setValues((0, import_lodash_es.defaultsDeep)(config, values));
|
|
119
135
|
}, []);
|
|
120
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ConfigContext.Provider, {
|
|
121
|
-
value: values,
|
|
122
|
-
children
|
|
123
|
-
});
|
|
136
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ConfigContext.Provider, { value: values, children });
|
|
124
137
|
}
|
|
125
138
|
function useConfigContext() {
|
|
126
139
|
return (0, import_react2.useContext)(ConfigContext);
|
|
127
140
|
}
|
|
128
141
|
|
|
129
142
|
// src/Blank.tsx
|
|
130
|
-
var
|
|
143
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
131
144
|
function Blank(options) {
|
|
132
145
|
const { Blank: Blank2 } = useConfigContext();
|
|
133
|
-
return !options || (0, import_lodash_es2.isNil)(options.value) || Array.isArray(options.value) && !options.value.length || options.value === "" ? /* @__PURE__ */ (0,
|
|
134
|
-
disabled: true,
|
|
135
|
-
children: (options == null ? void 0 : options.text) || Blank2.text
|
|
136
|
-
}) : options.value;
|
|
146
|
+
return !options || (0, import_lodash_es2.isNil)(options.value) || Array.isArray(options.value) && !options.value.length || options.value === "" ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_antd.Typography.Text, { disabled: true, children: (options == null ? void 0 : options.text) || Blank2.text }) : options.value;
|
|
137
147
|
}
|
|
138
148
|
|
|
139
149
|
// src/data.ts
|
|
@@ -167,52 +177,63 @@ function transferValue(type, value) {
|
|
|
167
177
|
var import_icons = require("@ant-design/icons");
|
|
168
178
|
var import_antd3 = require("antd");
|
|
169
179
|
var import_lodash_es4 = require("lodash-es");
|
|
170
|
-
var
|
|
180
|
+
var import_react5 = require("react");
|
|
171
181
|
|
|
172
|
-
// src/
|
|
173
|
-
var import_react3 = require("
|
|
182
|
+
// ../react/src/index.tsx
|
|
183
|
+
var import_react3 = require("react");
|
|
184
|
+
var clients = {};
|
|
185
|
+
function getClient(domain) {
|
|
186
|
+
const client = clients[domain || Object.keys(clients)[0]];
|
|
187
|
+
if (!client)
|
|
188
|
+
throw Error("FaasReactClient is not initialized");
|
|
189
|
+
return client;
|
|
190
|
+
}
|
|
191
|
+
async function faas(action, params) {
|
|
192
|
+
return getClient().faas(action, params);
|
|
193
|
+
}
|
|
194
|
+
function FaasDataWrapper(props) {
|
|
195
|
+
const [client, setClient] = (0, import_react3.useState)();
|
|
196
|
+
(0, import_react3.useEffect)(() => {
|
|
197
|
+
if (client)
|
|
198
|
+
return;
|
|
199
|
+
setClient(getClient());
|
|
200
|
+
}, []);
|
|
201
|
+
if (!client)
|
|
202
|
+
return props.fallback || null;
|
|
203
|
+
return (0, import_react3.createElement)(client.FaasDataWrapper, props);
|
|
204
|
+
}
|
|
174
205
|
|
|
175
206
|
// src/Loading.tsx
|
|
176
207
|
var import_antd2 = require("antd");
|
|
177
|
-
var
|
|
208
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
178
209
|
function Loading(props) {
|
|
179
210
|
if (props.loading === false)
|
|
180
|
-
return /* @__PURE__ */ (0,
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
...props.style || {},
|
|
186
|
-
...!props.size || props.size === "large" ? {
|
|
187
|
-
margin: "20vh auto",
|
|
188
|
-
textAlign: "center"
|
|
189
|
-
} : {}
|
|
190
|
-
},
|
|
191
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd2.Spin, {
|
|
192
|
-
size: props.size || "large"
|
|
193
|
-
})
|
|
194
|
-
});
|
|
211
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_jsx_runtime3.Fragment, { children: props.children });
|
|
212
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { style: __spreadValues(__spreadValues({}, props.style || {}), !props.size || props.size === "large" ? {
|
|
213
|
+
margin: "20vh auto",
|
|
214
|
+
textAlign: "center"
|
|
215
|
+
} : {}), children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_antd2.Spin, { size: props.size || "large" }) });
|
|
195
216
|
}
|
|
196
217
|
|
|
197
218
|
// src/FaasDataWrapper.tsx
|
|
198
|
-
var
|
|
199
|
-
function
|
|
200
|
-
return /* @__PURE__ */ (0,
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
219
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
220
|
+
function FaasDataWrapper2(props) {
|
|
221
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
222
|
+
FaasDataWrapper,
|
|
223
|
+
__spreadValues({
|
|
224
|
+
fallback: props.loading || /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Loading, __spreadValues({}, props.loadingProps))
|
|
225
|
+
}, props)
|
|
226
|
+
);
|
|
206
227
|
}
|
|
207
228
|
|
|
208
229
|
// src/Description.tsx
|
|
209
|
-
var
|
|
230
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
210
231
|
function DescriptionItemContent(props) {
|
|
211
232
|
var _a;
|
|
212
|
-
const [computedProps, setComputedProps] = (0,
|
|
213
|
-
(0,
|
|
233
|
+
const [computedProps, setComputedProps] = (0, import_react5.useState)();
|
|
234
|
+
(0, import_react5.useEffect)(() => {
|
|
214
235
|
var _a2, _b;
|
|
215
|
-
const propsCopy = {
|
|
236
|
+
const propsCopy = __spreadValues({}, props);
|
|
216
237
|
if (!propsCopy.item.title)
|
|
217
238
|
propsCopy.item.title = (0, import_lodash_es4.upperFirst)(propsCopy.item.id);
|
|
218
239
|
if (!propsCopy.item.type)
|
|
@@ -240,7 +261,7 @@ function DescriptionItemContent(props) {
|
|
|
240
261
|
return null;
|
|
241
262
|
if (computedProps.extendTypes && computedProps.extendTypes[computedProps.item.type])
|
|
242
263
|
if (computedProps.extendTypes[computedProps.item.type].children)
|
|
243
|
-
return (0,
|
|
264
|
+
return (0, import_react5.cloneElement)(
|
|
244
265
|
computedProps.extendTypes[computedProps.item.type].children,
|
|
245
266
|
{
|
|
246
267
|
scene: "description",
|
|
@@ -249,15 +270,13 @@ function DescriptionItemContent(props) {
|
|
|
249
270
|
}
|
|
250
271
|
);
|
|
251
272
|
else if (computedProps.extendTypes[computedProps.item.type].render)
|
|
252
|
-
return /* @__PURE__ */ (0,
|
|
253
|
-
children: computedProps.extendTypes[computedProps.item.type].render(computedProps.value, computedProps.values, 0, "description")
|
|
254
|
-
});
|
|
273
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_jsx_runtime5.Fragment, { children: computedProps.extendTypes[computedProps.item.type].render(computedProps.value, computedProps.values, 0, "description") });
|
|
255
274
|
else
|
|
256
275
|
throw Error(computedProps.item.type + " requires children or render");
|
|
257
276
|
if (computedProps.item.descriptionChildren === null)
|
|
258
277
|
return null;
|
|
259
278
|
if (computedProps.item.descriptionChildren)
|
|
260
|
-
return (0,
|
|
279
|
+
return (0, import_react5.cloneElement)(computedProps.item.descriptionChildren, {
|
|
261
280
|
scene: "description",
|
|
262
281
|
value: computedProps.value,
|
|
263
282
|
values: computedProps.values
|
|
@@ -265,7 +284,7 @@ function DescriptionItemContent(props) {
|
|
|
265
284
|
if (computedProps.item.children === null)
|
|
266
285
|
return null;
|
|
267
286
|
if (computedProps.item.children)
|
|
268
|
-
return (0,
|
|
287
|
+
return (0, import_react5.cloneElement)(computedProps.item.children, {
|
|
269
288
|
scene: "description",
|
|
270
289
|
value: computedProps.value,
|
|
271
290
|
values: computedProps.values
|
|
@@ -275,132 +294,137 @@ function DescriptionItemContent(props) {
|
|
|
275
294
|
if (computedProps.item.render)
|
|
276
295
|
return computedProps.item.render(computedProps.value, computedProps.values, 0, "description");
|
|
277
296
|
if (computedProps.value === null || Array.isArray(computedProps.value) && !computedProps.value.length)
|
|
278
|
-
return /* @__PURE__ */ (0,
|
|
297
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Blank, {});
|
|
279
298
|
switch (computedProps.item.type) {
|
|
280
299
|
case "string[]":
|
|
281
|
-
return /* @__PURE__ */ (0,
|
|
282
|
-
children: computedProps.value.join(", ")
|
|
283
|
-
});
|
|
300
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_jsx_runtime5.Fragment, { children: computedProps.value.join(", ") });
|
|
284
301
|
case "number":
|
|
285
302
|
return computedProps.value || null;
|
|
286
303
|
case "number[]":
|
|
287
|
-
return /* @__PURE__ */ (0,
|
|
288
|
-
children: computedProps.value.join(", ")
|
|
289
|
-
});
|
|
304
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_jsx_runtime5.Fragment, { children: computedProps.value.join(", ") });
|
|
290
305
|
case "boolean":
|
|
291
|
-
return computedProps.value ? /* @__PURE__ */ (0,
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
marginTop: "4px",
|
|
299
|
-
color: "#ff4d4f"
|
|
300
|
-
}
|
|
301
|
-
});
|
|
306
|
+
return computedProps.value ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_icons.CheckOutlined, { style: {
|
|
307
|
+
marginTop: "4px",
|
|
308
|
+
color: "#52c41a"
|
|
309
|
+
} }) : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_icons.CloseOutlined, { style: {
|
|
310
|
+
marginTop: "4px",
|
|
311
|
+
color: "#ff4d4f"
|
|
312
|
+
} });
|
|
302
313
|
case "time":
|
|
303
|
-
return /* @__PURE__ */ (0,
|
|
304
|
-
children: computedProps.value.format("YYYY-MM-DD HH:mm:ss")
|
|
305
|
-
});
|
|
314
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_jsx_runtime5.Fragment, { children: computedProps.value.format("YYYY-MM-DD HH:mm:ss") });
|
|
306
315
|
case "date":
|
|
307
|
-
return /* @__PURE__ */ (0,
|
|
308
|
-
children: computedProps.value.format("YYYY-MM-DD")
|
|
309
|
-
});
|
|
316
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_jsx_runtime5.Fragment, { children: computedProps.value.format("YYYY-MM-DD") });
|
|
310
317
|
case "object":
|
|
311
318
|
if (!computedProps.value)
|
|
312
|
-
return /* @__PURE__ */ (0,
|
|
313
|
-
return /* @__PURE__ */ (0,
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
319
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Blank, {});
|
|
320
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
321
|
+
Description,
|
|
322
|
+
{
|
|
323
|
+
items: computedProps.item.object,
|
|
324
|
+
dataSource: computedProps.value,
|
|
325
|
+
column: 1
|
|
326
|
+
}
|
|
327
|
+
);
|
|
318
328
|
case "object[]":
|
|
319
329
|
if (!((_a = computedProps.value) == null ? void 0 : _a.length))
|
|
320
|
-
return /* @__PURE__ */ (0,
|
|
321
|
-
return /* @__PURE__ */ (0,
|
|
322
|
-
|
|
323
|
-
|
|
330
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Blank, {});
|
|
331
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_antd3.Space, { direction: "vertical", children: computedProps.value.map((value, index) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
332
|
+
Description,
|
|
333
|
+
{
|
|
324
334
|
items: computedProps.item.object,
|
|
325
335
|
dataSource: value,
|
|
326
336
|
column: 1
|
|
327
|
-
},
|
|
328
|
-
|
|
337
|
+
},
|
|
338
|
+
index
|
|
339
|
+
)) });
|
|
329
340
|
default:
|
|
330
341
|
return computedProps.value || null;
|
|
331
342
|
}
|
|
332
343
|
}
|
|
333
344
|
function Description(props) {
|
|
334
345
|
if (!props.faasData)
|
|
335
|
-
return /* @__PURE__ */ (0,
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
return !item.if || item.if(props.dataSource) ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd3.Descriptions.Item, {
|
|
340
|
-
label: item.title || (0, import_lodash_es4.upperFirst)(item.id),
|
|
341
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DescriptionItemContent, {
|
|
342
|
-
item,
|
|
343
|
-
value: props.dataSource[item.id],
|
|
344
|
-
values: props.dataSource,
|
|
345
|
-
extendTypes: props.extendTypes
|
|
346
|
-
})
|
|
347
|
-
}, item.id) : null;
|
|
348
|
-
}).filter(Boolean)
|
|
349
|
-
});
|
|
350
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FaasDataWrapper, {
|
|
351
|
-
render: ({ data }) => {
|
|
352
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd3.Descriptions, {
|
|
353
|
-
...props,
|
|
354
|
-
title: (0, import_lodash_es4.isFunction)(props.renderTitle) ? props.renderTitle(data) : props.title,
|
|
346
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
347
|
+
import_antd3.Descriptions,
|
|
348
|
+
__spreadProps(__spreadValues({}, props), {
|
|
349
|
+
title: (0, import_lodash_es4.isFunction)(props.renderTitle) ? props.renderTitle(props.dataSource) : props.title,
|
|
355
350
|
children: props.items.map((item) => {
|
|
356
|
-
return !item.if || item.if(
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
item,
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
351
|
+
return !item.if || item.if(props.dataSource) ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
352
|
+
import_antd3.Descriptions.Item,
|
|
353
|
+
{
|
|
354
|
+
label: item.title || (0, import_lodash_es4.upperFirst)(item.id),
|
|
355
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
356
|
+
DescriptionItemContent,
|
|
357
|
+
{
|
|
358
|
+
item,
|
|
359
|
+
value: props.dataSource[item.id],
|
|
360
|
+
values: props.dataSource,
|
|
361
|
+
extendTypes: props.extendTypes
|
|
362
|
+
}
|
|
363
|
+
)
|
|
364
|
+
},
|
|
365
|
+
item.id
|
|
366
|
+
) : null;
|
|
365
367
|
}).filter(Boolean)
|
|
366
|
-
})
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
368
|
+
})
|
|
369
|
+
);
|
|
370
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
371
|
+
FaasDataWrapper2,
|
|
372
|
+
__spreadValues({
|
|
373
|
+
render: ({ data }) => {
|
|
374
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
375
|
+
import_antd3.Descriptions,
|
|
376
|
+
__spreadProps(__spreadValues({}, props), {
|
|
377
|
+
title: (0, import_lodash_es4.isFunction)(props.renderTitle) ? props.renderTitle(data) : props.title,
|
|
378
|
+
children: props.items.map((item) => {
|
|
379
|
+
return !item.if || item.if(data) ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
380
|
+
import_antd3.Descriptions.Item,
|
|
381
|
+
{
|
|
382
|
+
label: item.title || (0, import_lodash_es4.upperFirst)(item.id),
|
|
383
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
384
|
+
DescriptionItemContent,
|
|
385
|
+
{
|
|
386
|
+
item,
|
|
387
|
+
value: data[item.id],
|
|
388
|
+
values: data,
|
|
389
|
+
extendTypes: props.extendTypes
|
|
390
|
+
}
|
|
391
|
+
)
|
|
392
|
+
},
|
|
393
|
+
item.id
|
|
394
|
+
) : null;
|
|
395
|
+
}).filter(Boolean)
|
|
396
|
+
})
|
|
397
|
+
);
|
|
398
|
+
}
|
|
399
|
+
}, props.faasData)
|
|
400
|
+
);
|
|
370
401
|
}
|
|
371
402
|
|
|
372
403
|
// src/Drawer.tsx
|
|
373
404
|
var import_antd4 = require("antd");
|
|
374
|
-
var
|
|
375
|
-
var
|
|
405
|
+
var import_react6 = require("react");
|
|
406
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
376
407
|
function useDrawer(init) {
|
|
377
|
-
const [props, setProps] = (0,
|
|
408
|
+
const [props, setProps] = (0, import_react6.useState)(__spreadValues({
|
|
378
409
|
open: false,
|
|
379
|
-
onClose: () => setProps((prev) => ({
|
|
380
|
-
...prev,
|
|
410
|
+
onClose: () => setProps((prev) => __spreadProps(__spreadValues({}, prev), {
|
|
381
411
|
open: false
|
|
382
|
-
}))
|
|
383
|
-
|
|
384
|
-
});
|
|
412
|
+
}))
|
|
413
|
+
}, init));
|
|
385
414
|
return {
|
|
386
|
-
drawer: /* @__PURE__ */ (0,
|
|
387
|
-
...props
|
|
388
|
-
}),
|
|
415
|
+
drawer: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_antd4.Drawer, __spreadValues({}, props)),
|
|
389
416
|
drawerProps: props,
|
|
390
417
|
setDrawerProps(changes) {
|
|
391
|
-
setProps((prev) => ({
|
|
392
|
-
...prev,
|
|
393
|
-
...changes
|
|
394
|
-
}));
|
|
418
|
+
setProps((prev) => __spreadValues(__spreadValues({}, prev), changes));
|
|
395
419
|
}
|
|
396
420
|
};
|
|
397
421
|
}
|
|
398
422
|
|
|
399
423
|
// src/ErrorBoundary.tsx
|
|
400
|
-
var
|
|
424
|
+
var import_react7 = require("react");
|
|
401
425
|
var import_antd5 = require("antd");
|
|
402
|
-
var
|
|
403
|
-
var ErrorBoundary = class extends
|
|
426
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
427
|
+
var ErrorBoundary = class extends import_react7.Component {
|
|
404
428
|
constructor(props) {
|
|
405
429
|
super(props);
|
|
406
430
|
this.state = {
|
|
@@ -427,33 +451,32 @@ var ErrorBoundary = class extends import_react6.Component {
|
|
|
427
451
|
if (error) {
|
|
428
452
|
if (this.props.onError)
|
|
429
453
|
return this.props.onError(error, info);
|
|
430
|
-
return /* @__PURE__ */ (0,
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
454
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
455
|
+
import_antd5.Alert,
|
|
456
|
+
{
|
|
457
|
+
type: "error",
|
|
458
|
+
message: errorMessage,
|
|
459
|
+
description: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("pre", { style: {
|
|
435
460
|
fontSize: "0.9em",
|
|
436
461
|
overflowX: "auto"
|
|
437
|
-
},
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
});
|
|
462
|
+
}, children: errorDescription })
|
|
463
|
+
}
|
|
464
|
+
);
|
|
441
465
|
}
|
|
442
466
|
return children;
|
|
443
467
|
}
|
|
444
468
|
};
|
|
445
469
|
|
|
446
470
|
// src/Form.tsx
|
|
447
|
-
var import_react8 = require("@faasjs/react");
|
|
448
471
|
var import_antd7 = require("antd");
|
|
449
|
-
var
|
|
472
|
+
var import_react10 = require("react");
|
|
450
473
|
|
|
451
474
|
// src/FormItem.tsx
|
|
452
475
|
var import_antd6 = require("antd");
|
|
453
476
|
var import_icons2 = require("@ant-design/icons");
|
|
454
|
-
var
|
|
477
|
+
var import_react8 = require("react");
|
|
455
478
|
var import_lodash_es5 = require("lodash-es");
|
|
456
|
-
var
|
|
479
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
457
480
|
function processProps(propsCopy, config) {
|
|
458
481
|
if (!propsCopy.title)
|
|
459
482
|
propsCopy.title = (0, import_lodash_es5.upperFirst)(propsCopy.id);
|
|
@@ -502,12 +525,12 @@ function processProps(propsCopy, config) {
|
|
|
502
525
|
}
|
|
503
526
|
function FormItem(props) {
|
|
504
527
|
var _a;
|
|
505
|
-
const [computedProps, setComputedProps] = (0,
|
|
506
|
-
const [extendTypes, setExtendTypes] = (0,
|
|
528
|
+
const [computedProps, setComputedProps] = (0, import_react8.useState)();
|
|
529
|
+
const [extendTypes, setExtendTypes] = (0, import_react8.useState)();
|
|
507
530
|
const { common: common2 } = useConfigContext();
|
|
508
|
-
const [hidden, setHidden] = (0,
|
|
509
|
-
(0,
|
|
510
|
-
const propsCopy = {
|
|
531
|
+
const [hidden, setHidden] = (0, import_react8.useState)(props.hidden || false);
|
|
532
|
+
(0, import_react8.useEffect)(() => {
|
|
533
|
+
const propsCopy = __spreadValues({}, props);
|
|
511
534
|
if (propsCopy.extendTypes) {
|
|
512
535
|
setExtendTypes(propsCopy.extendTypes);
|
|
513
536
|
delete propsCopy.extendTypes;
|
|
@@ -530,300 +553,245 @@ function FormItem(props) {
|
|
|
530
553
|
if (!computedProps)
|
|
531
554
|
return null;
|
|
532
555
|
if (hidden)
|
|
533
|
-
return /* @__PURE__ */ (0,
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
hidden: true
|
|
556
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
557
|
+
import_antd6.Form.Item,
|
|
558
|
+
__spreadProps(__spreadValues({}, computedProps), {
|
|
559
|
+
noStyle: true,
|
|
560
|
+
rules: [],
|
|
561
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_antd6.Input, { hidden: true })
|
|
539
562
|
})
|
|
540
|
-
|
|
563
|
+
);
|
|
541
564
|
if (extendTypes && extendTypes[computedProps.type])
|
|
542
|
-
return /* @__PURE__ */ (0,
|
|
543
|
-
...computedProps,
|
|
544
|
-
children: extendTypes[computedProps.type].children
|
|
545
|
-
});
|
|
565
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_antd6.Form.Item, __spreadProps(__spreadValues({}, computedProps), { children: extendTypes[computedProps.type].children }));
|
|
546
566
|
if (computedProps.formChildren === null)
|
|
547
567
|
return null;
|
|
548
568
|
if (computedProps.formChildren)
|
|
549
|
-
return /* @__PURE__ */ (0,
|
|
550
|
-
...computedProps,
|
|
551
|
-
children: (0, import_react7.cloneElement)(computedProps.formChildren, { scene: "form" })
|
|
552
|
-
});
|
|
569
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_antd6.Form.Item, __spreadProps(__spreadValues({}, computedProps), { children: (0, import_react8.cloneElement)(computedProps.formChildren, { scene: "form" }) }));
|
|
553
570
|
if (computedProps.children === null)
|
|
554
571
|
return null;
|
|
555
572
|
if (computedProps.children)
|
|
556
|
-
return /* @__PURE__ */ (0,
|
|
557
|
-
...computedProps,
|
|
558
|
-
children: (0, import_react7.cloneElement)(computedProps.children, { scene: "form" })
|
|
559
|
-
});
|
|
573
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_antd6.Form.Item, __spreadProps(__spreadValues({}, computedProps), { children: (0, import_react8.cloneElement)(computedProps.children, { scene: "form" }) }));
|
|
560
574
|
if (computedProps.formRender)
|
|
561
|
-
return /* @__PURE__ */ (0,
|
|
562
|
-
...computedProps,
|
|
563
|
-
children: computedProps.formRender(null, null, 0, "form")
|
|
564
|
-
});
|
|
575
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_antd6.Form.Item, __spreadProps(__spreadValues({}, computedProps), { children: computedProps.formRender(null, null, 0, "form") }));
|
|
565
576
|
if (computedProps.render)
|
|
566
|
-
return /* @__PURE__ */ (0,
|
|
567
|
-
...computedProps,
|
|
568
|
-
children: computedProps.render(null, null, 0, "form")
|
|
569
|
-
});
|
|
577
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_antd6.Form.Item, __spreadProps(__spreadValues({}, computedProps), { children: computedProps.render(null, null, 0, "form") }));
|
|
570
578
|
switch (computedProps.type) {
|
|
571
579
|
case "string":
|
|
572
|
-
return /* @__PURE__ */ (0,
|
|
573
|
-
...computedProps,
|
|
574
|
-
children: computedProps.options ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd6.Select, {
|
|
575
|
-
...computedProps.input
|
|
576
|
-
}) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd6.Input, {
|
|
577
|
-
...computedProps.input
|
|
578
|
-
})
|
|
579
|
-
});
|
|
580
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_antd6.Form.Item, __spreadProps(__spreadValues({}, computedProps), { children: computedProps.options ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_antd6.Select, __spreadValues({}, computedProps.input)) : /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_antd6.Input, __spreadValues({}, computedProps.input)) }));
|
|
580
581
|
case "string[]":
|
|
581
582
|
if (computedProps.options)
|
|
582
|
-
return /* @__PURE__ */ (0,
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
mode: "multiple"
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
children: [
|
|
596
|
-
computedProps.label && /* @__PURE__ */ (0,
|
|
597
|
-
className: "ant-form-item-label",
|
|
598
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("label", {
|
|
599
|
-
className: computedProps.rules.find((r) => r.required) && "ant-form-item-required",
|
|
600
|
-
children: computedProps.label
|
|
601
|
-
})
|
|
602
|
-
}),
|
|
583
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_antd6.Form.Item, __spreadProps(__spreadValues({}, computedProps), { children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
584
|
+
import_antd6.Select,
|
|
585
|
+
__spreadValues({
|
|
586
|
+
mode: "multiple"
|
|
587
|
+
}, computedProps.input)
|
|
588
|
+
) }));
|
|
589
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
590
|
+
import_antd6.Form.List,
|
|
591
|
+
{
|
|
592
|
+
name: computedProps.name,
|
|
593
|
+
rules: computedProps.rules,
|
|
594
|
+
children: (fields, { add, remove }, { errors }) => {
|
|
595
|
+
var _a2;
|
|
596
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_jsx_runtime8.Fragment, { children: [
|
|
597
|
+
computedProps.label && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "ant-form-item-label", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("label", { className: computedProps.rules.find((r) => r.required) && "ant-form-item-required", children: computedProps.label }) }),
|
|
603
598
|
fields.map((field) => {
|
|
604
599
|
var _a3;
|
|
605
|
-
return /* @__PURE__ */ (0,
|
|
606
|
-
|
|
600
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_antd6.Form.Item, { children: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
601
|
+
import_antd6.Row,
|
|
602
|
+
{
|
|
607
603
|
gutter: 24,
|
|
608
604
|
style: { flexFlow: "row nowrap" },
|
|
609
605
|
children: [
|
|
610
|
-
/* @__PURE__ */ (0,
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
...field,
|
|
606
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_antd6.Col, { span: 23, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
607
|
+
import_antd6.Form.Item,
|
|
608
|
+
__spreadProps(__spreadValues({}, field), {
|
|
614
609
|
noStyle: true,
|
|
615
|
-
children: /* @__PURE__ */ (0,
|
|
616
|
-
...computedProps.input
|
|
617
|
-
})
|
|
610
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_antd6.Input, __spreadValues({}, computedProps.input))
|
|
618
611
|
})
|
|
619
|
-
}),
|
|
620
|
-
/* @__PURE__ */ (0,
|
|
621
|
-
|
|
622
|
-
|
|
612
|
+
) }),
|
|
613
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_antd6.Col, { span: 1, children: !((_a3 = computedProps.input) == null ? void 0 : _a3.disabled) && (!computedProps.rules.find((r) => r.required) || field.key > 0) && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
614
|
+
import_antd6.Button,
|
|
615
|
+
{
|
|
623
616
|
danger: true,
|
|
624
617
|
type: "link",
|
|
625
618
|
style: { float: "right" },
|
|
626
|
-
icon: /* @__PURE__ */ (0,
|
|
619
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_icons2.MinusCircleOutlined, {}),
|
|
627
620
|
onClick: () => remove(field.name)
|
|
628
|
-
}
|
|
629
|
-
})
|
|
621
|
+
}
|
|
622
|
+
) })
|
|
630
623
|
]
|
|
631
|
-
}
|
|
632
|
-
}, field.key);
|
|
624
|
+
}
|
|
625
|
+
) }, field.key);
|
|
633
626
|
}),
|
|
634
|
-
/* @__PURE__ */ (0,
|
|
635
|
-
|
|
636
|
-
|
|
627
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_antd6.Form.Item, { children: [
|
|
628
|
+
!((_a2 = computedProps.input) == null ? void 0 : _a2.disabled) && (!computedProps.maxCount || computedProps.maxCount > fields.length) && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
629
|
+
import_antd6.Button,
|
|
630
|
+
{
|
|
637
631
|
type: "dashed",
|
|
638
632
|
block: true,
|
|
639
633
|
onClick: () => add(),
|
|
640
|
-
icon: /* @__PURE__ */ (0,
|
|
641
|
-
}
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
]
|
|
648
|
-
});
|
|
634
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_icons2.PlusOutlined, {})
|
|
635
|
+
}
|
|
636
|
+
),
|
|
637
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_antd6.Form.ErrorList, { errors })
|
|
638
|
+
] })
|
|
639
|
+
] });
|
|
640
|
+
}
|
|
649
641
|
}
|
|
650
|
-
|
|
642
|
+
);
|
|
651
643
|
case "number":
|
|
652
|
-
return /* @__PURE__ */ (0,
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
}
|
|
657
|
-
|
|
658
|
-
...computedProps.input
|
|
659
|
-
})
|
|
660
|
-
});
|
|
644
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_antd6.Form.Item, __spreadProps(__spreadValues({}, computedProps), { children: computedProps.options ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_antd6.Select, __spreadValues({}, computedProps.input)) : /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
645
|
+
import_antd6.InputNumber,
|
|
646
|
+
__spreadValues({
|
|
647
|
+
style: { width: "100%" }
|
|
648
|
+
}, computedProps.input)
|
|
649
|
+
) }));
|
|
661
650
|
case "number[]":
|
|
662
651
|
if (computedProps.options)
|
|
663
|
-
return /* @__PURE__ */ (0,
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
mode: "multiple"
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
children: [
|
|
677
|
-
computedProps.label && /* @__PURE__ */ (0,
|
|
678
|
-
className: "ant-form-item-label",
|
|
679
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("label", {
|
|
680
|
-
className: ((_a2 = computedProps.rules) == null ? void 0 : _a2.find((r) => r.required)) && "ant-form-item-required",
|
|
681
|
-
children: computedProps.label
|
|
682
|
-
})
|
|
683
|
-
}),
|
|
652
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_antd6.Form.Item, __spreadProps(__spreadValues({}, computedProps), { children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
653
|
+
import_antd6.Select,
|
|
654
|
+
__spreadValues({
|
|
655
|
+
mode: "multiple"
|
|
656
|
+
}, computedProps.input)
|
|
657
|
+
) }));
|
|
658
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
659
|
+
import_antd6.Form.List,
|
|
660
|
+
{
|
|
661
|
+
name: computedProps.name,
|
|
662
|
+
rules: computedProps.rules,
|
|
663
|
+
children: (fields, { add, remove }, { errors }) => {
|
|
664
|
+
var _a2, _b;
|
|
665
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_jsx_runtime8.Fragment, { children: [
|
|
666
|
+
computedProps.label && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "ant-form-item-label", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("label", { className: ((_a2 = computedProps.rules) == null ? void 0 : _a2.find((r) => r.required)) && "ant-form-item-required", children: computedProps.label }) }),
|
|
684
667
|
fields.map((field) => {
|
|
685
668
|
var _a3;
|
|
686
|
-
return /* @__PURE__ */ (0,
|
|
687
|
-
|
|
669
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_antd6.Form.Item, { children: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
670
|
+
import_antd6.Row,
|
|
671
|
+
{
|
|
688
672
|
gutter: 24,
|
|
689
673
|
style: { flexFlow: "row nowrap" },
|
|
690
674
|
children: [
|
|
691
|
-
/* @__PURE__ */ (0,
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
...field,
|
|
675
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_antd6.Col, { span: 23, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
676
|
+
import_antd6.Form.Item,
|
|
677
|
+
__spreadProps(__spreadValues({}, field), {
|
|
695
678
|
noStyle: true,
|
|
696
|
-
children: /* @__PURE__ */ (0,
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
679
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
680
|
+
import_antd6.InputNumber,
|
|
681
|
+
__spreadValues({
|
|
682
|
+
style: { width: "100%" }
|
|
683
|
+
}, computedProps.input)
|
|
684
|
+
)
|
|
700
685
|
})
|
|
701
|
-
}),
|
|
702
|
-
/* @__PURE__ */ (0,
|
|
703
|
-
|
|
704
|
-
|
|
686
|
+
) }),
|
|
687
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_antd6.Col, { span: 1, children: !((_a3 = computedProps.input) == null ? void 0 : _a3.disabled) && (!computedProps.rules.find((r) => r.required) || field.key > 0) && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
688
|
+
import_antd6.Button,
|
|
689
|
+
{
|
|
705
690
|
danger: true,
|
|
706
691
|
type: "link",
|
|
707
692
|
style: { float: "right" },
|
|
708
|
-
icon: /* @__PURE__ */ (0,
|
|
693
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_icons2.MinusCircleOutlined, {}),
|
|
709
694
|
onClick: () => remove(field.name)
|
|
710
|
-
}
|
|
711
|
-
})
|
|
695
|
+
}
|
|
696
|
+
) })
|
|
712
697
|
]
|
|
713
|
-
}
|
|
714
|
-
}, field.key);
|
|
698
|
+
}
|
|
699
|
+
) }, field.key);
|
|
715
700
|
}),
|
|
716
|
-
/* @__PURE__ */ (0,
|
|
717
|
-
|
|
718
|
-
|
|
701
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_antd6.Form.Item, { children: [
|
|
702
|
+
!((_b = computedProps.input) == null ? void 0 : _b.disabled) && (!computedProps.maxCount || computedProps.maxCount > fields.length) && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
703
|
+
import_antd6.Button,
|
|
704
|
+
{
|
|
719
705
|
type: "dashed",
|
|
720
706
|
block: true,
|
|
721
707
|
onClick: () => add(),
|
|
722
|
-
icon: /* @__PURE__ */ (0,
|
|
723
|
-
}
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
]
|
|
730
|
-
});
|
|
708
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_icons2.PlusOutlined, {})
|
|
709
|
+
}
|
|
710
|
+
),
|
|
711
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_antd6.Form.ErrorList, { errors })
|
|
712
|
+
] })
|
|
713
|
+
] });
|
|
714
|
+
}
|
|
731
715
|
}
|
|
732
|
-
|
|
716
|
+
);
|
|
733
717
|
case "boolean":
|
|
734
|
-
return /* @__PURE__ */ (0,
|
|
735
|
-
...computedProps,
|
|
736
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd6.Switch, {
|
|
737
|
-
...computedProps.input
|
|
738
|
-
})
|
|
739
|
-
});
|
|
718
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_antd6.Form.Item, __spreadProps(__spreadValues({}, computedProps), { children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_antd6.Switch, __spreadValues({}, computedProps.input)) }));
|
|
740
719
|
case "date":
|
|
741
|
-
return /* @__PURE__ */ (0,
|
|
742
|
-
...computedProps,
|
|
743
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd6.DatePicker, {
|
|
744
|
-
...computedProps.input
|
|
745
|
-
})
|
|
746
|
-
});
|
|
720
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_antd6.Form.Item, __spreadProps(__spreadValues({}, computedProps), { children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_antd6.DatePicker, __spreadValues({}, computedProps.input)) }));
|
|
747
721
|
case "time":
|
|
748
|
-
return /* @__PURE__ */ (0,
|
|
749
|
-
...computedProps,
|
|
750
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd6.TimePicker, {
|
|
751
|
-
...computedProps.input
|
|
752
|
-
})
|
|
753
|
-
});
|
|
722
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_antd6.Form.Item, __spreadProps(__spreadValues({}, computedProps), { children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_antd6.TimePicker, __spreadValues({}, computedProps.input)) }));
|
|
754
723
|
case "object":
|
|
755
|
-
return /* @__PURE__ */ (0,
|
|
756
|
-
children:
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
}),
|
|
764
|
-
computedProps.object.map((o) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FormItem, {
|
|
765
|
-
...o
|
|
766
|
-
}, o.id))
|
|
767
|
-
]
|
|
768
|
-
});
|
|
724
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_jsx_runtime8.Fragment, { children: [
|
|
725
|
+
computedProps.label && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "ant-form-item-label", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("label", { className: ((_a = computedProps.rules) == null ? void 0 : _a.find((r) => r.required)) && "ant-form-item-required", children: computedProps.label }) }),
|
|
726
|
+
computedProps.object.map((o) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
727
|
+
FormItem,
|
|
728
|
+
__spreadValues({}, o),
|
|
729
|
+
o.id
|
|
730
|
+
))
|
|
731
|
+
] });
|
|
769
732
|
case "object[]":
|
|
770
|
-
return /* @__PURE__ */ (0,
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
733
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
734
|
+
import_antd6.Form.List,
|
|
735
|
+
{
|
|
736
|
+
name: computedProps.name,
|
|
737
|
+
rules: computedProps.rules,
|
|
738
|
+
children: (fields, { add, remove }, { errors }) => /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_jsx_runtime8.Fragment, { children: [
|
|
739
|
+
fields.map((field) => /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
740
|
+
import_antd6.Form.Item,
|
|
741
|
+
{
|
|
742
|
+
style: { marginBottom: 0 },
|
|
743
|
+
children: [
|
|
744
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "ant-form-item-label", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("label", { children: [
|
|
745
|
+
computedProps.label,
|
|
746
|
+
" ",
|
|
747
|
+
field.name + 1,
|
|
748
|
+
!computedProps.disabled && (!computedProps.rules.find((r) => r.required) || field.key > 0) && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
749
|
+
import_antd6.Button,
|
|
750
|
+
{
|
|
786
751
|
danger: true,
|
|
787
752
|
type: "link",
|
|
788
753
|
onClick: () => remove(field.name),
|
|
789
754
|
children: common2.delete
|
|
790
|
-
}
|
|
791
|
-
|
|
792
|
-
})
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
755
|
+
}
|
|
756
|
+
)
|
|
757
|
+
] }) }),
|
|
758
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_antd6.Row, { gutter: 24, children: computedProps.object.map((o) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
759
|
+
import_antd6.Col,
|
|
760
|
+
{
|
|
761
|
+
span: o.col || 24,
|
|
762
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
763
|
+
FormItem,
|
|
764
|
+
__spreadProps(__spreadValues({}, o), {
|
|
765
|
+
name: [field.name, o.id]
|
|
766
|
+
})
|
|
767
|
+
)
|
|
768
|
+
},
|
|
769
|
+
o.id
|
|
770
|
+
)) })
|
|
771
|
+
]
|
|
772
|
+
},
|
|
773
|
+
field.key
|
|
774
|
+
)),
|
|
775
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_antd6.Form.Item, { children: [
|
|
776
|
+
!computedProps.disabled && (!computedProps.maxCount || computedProps.maxCount > fields.length) && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
777
|
+
import_antd6.Button,
|
|
778
|
+
{
|
|
809
779
|
type: "dashed",
|
|
810
780
|
block: true,
|
|
811
781
|
onClick: () => add(),
|
|
812
|
-
icon: /* @__PURE__ */ (0,
|
|
782
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_icons2.PlusOutlined, {}),
|
|
813
783
|
children: [
|
|
814
784
|
common2.add,
|
|
815
785
|
" ",
|
|
816
786
|
computedProps.label
|
|
817
787
|
]
|
|
818
|
-
}
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
})
|
|
826
|
-
});
|
|
788
|
+
}
|
|
789
|
+
),
|
|
790
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_antd6.Form.ErrorList, { errors })
|
|
791
|
+
] })
|
|
792
|
+
] })
|
|
793
|
+
}
|
|
794
|
+
);
|
|
827
795
|
default:
|
|
828
796
|
return null;
|
|
829
797
|
}
|
|
@@ -831,21 +799,20 @@ function FormItem(props) {
|
|
|
831
799
|
FormItem.useStatus = import_antd6.Form.Item.useStatus;
|
|
832
800
|
|
|
833
801
|
// src/Form.tsx
|
|
834
|
-
var
|
|
802
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
835
803
|
function Form(props) {
|
|
836
804
|
var _a, _b;
|
|
837
|
-
const [loading, setLoading] = (0,
|
|
838
|
-
const [computedProps, setComputedProps] = (0,
|
|
805
|
+
const [loading, setLoading] = (0, import_react10.useState)(false);
|
|
806
|
+
const [computedProps, setComputedProps] = (0, import_react10.useState)();
|
|
839
807
|
const config = useConfigContext();
|
|
840
|
-
const [extendTypes, setExtendTypes] = (0,
|
|
808
|
+
const [extendTypes, setExtendTypes] = (0, import_react10.useState)();
|
|
841
809
|
const [form] = import_antd7.Form.useForm(props.form);
|
|
842
|
-
const [initialValues, setInitialValues] = (0,
|
|
843
|
-
(0,
|
|
810
|
+
const [initialValues, setInitialValues] = (0, import_react10.useState)(props.initialValues);
|
|
811
|
+
(0, import_react10.useEffect)(() => {
|
|
844
812
|
var _a2, _b2, _c;
|
|
845
|
-
const propsCopy = {
|
|
846
|
-
...props,
|
|
813
|
+
const propsCopy = __spreadProps(__spreadValues({}, props), {
|
|
847
814
|
form
|
|
848
|
-
};
|
|
815
|
+
});
|
|
849
816
|
if (propsCopy.initialValues && ((_a2 = propsCopy.items) == null ? void 0 : _a2.length)) {
|
|
850
817
|
for (const key in propsCopy.initialValues) {
|
|
851
818
|
propsCopy.initialValues[key] = transferValue(
|
|
@@ -869,10 +836,7 @@ function Form(props) {
|
|
|
869
836
|
setLoading(true);
|
|
870
837
|
try {
|
|
871
838
|
if (propsCopy.submit && ((_a3 = propsCopy.submit.to) == null ? void 0 : _a3.action)) {
|
|
872
|
-
await props.onFinish(values, async (values2) =>
|
|
873
|
-
...values2,
|
|
874
|
-
...propsCopy.submit.to.params
|
|
875
|
-
} : values2));
|
|
839
|
+
await props.onFinish(values, async (values2) => faas(propsCopy.submit.to.action, propsCopy.submit.to.params ? __spreadValues(__spreadValues({}, values2), propsCopy.submit.to.params) : values2));
|
|
876
840
|
} else
|
|
877
841
|
await props.onFinish(values);
|
|
878
842
|
} catch (error) {
|
|
@@ -883,10 +847,7 @@ function Form(props) {
|
|
|
883
847
|
} else if (propsCopy.submit && ((_c = propsCopy.submit.to) == null ? void 0 : _c.action)) {
|
|
884
848
|
propsCopy.onFinish = async (values) => {
|
|
885
849
|
setLoading(true);
|
|
886
|
-
return
|
|
887
|
-
...values,
|
|
888
|
-
...propsCopy.submit.to.params
|
|
889
|
-
} : values).then((result) => {
|
|
850
|
+
return faas(propsCopy.submit.to.action, propsCopy.submit.to.params ? __spreadValues(__spreadValues({}, values), propsCopy.submit.to.params) : values).then((result) => {
|
|
890
851
|
if (propsCopy.submit.to.then)
|
|
891
852
|
propsCopy.submit.to.then(result);
|
|
892
853
|
return result;
|
|
@@ -907,7 +868,7 @@ function Form(props) {
|
|
|
907
868
|
}
|
|
908
869
|
setComputedProps(propsCopy);
|
|
909
870
|
}, [props]);
|
|
910
|
-
const onValuesChange = (0,
|
|
871
|
+
const onValuesChange = (0, import_react10.useCallback)((changedValues, allValues) => {
|
|
911
872
|
console.debug("Form:onValuesChange", changedValues, allValues);
|
|
912
873
|
if (props.onValuesChange) {
|
|
913
874
|
props.onValuesChange(changedValues, allValues);
|
|
@@ -920,7 +881,7 @@ function Form(props) {
|
|
|
920
881
|
item.onValueChange(changedValues[key], allValues, form);
|
|
921
882
|
}
|
|
922
883
|
}, [computedProps]);
|
|
923
|
-
(0,
|
|
884
|
+
(0, import_react10.useEffect)(() => {
|
|
924
885
|
if (!initialValues)
|
|
925
886
|
return;
|
|
926
887
|
console.debug("Form:initialValues", initialValues);
|
|
@@ -929,25 +890,33 @@ function Form(props) {
|
|
|
929
890
|
}, [computedProps]);
|
|
930
891
|
if (!computedProps)
|
|
931
892
|
return null;
|
|
932
|
-
return /* @__PURE__ */ (0,
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
893
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
894
|
+
import_antd7.Form,
|
|
895
|
+
__spreadProps(__spreadValues({}, computedProps), {
|
|
896
|
+
onValuesChange,
|
|
897
|
+
children: [
|
|
898
|
+
computedProps.beforeItems,
|
|
899
|
+
(_a = computedProps.items) == null ? void 0 : _a.map((item) => (0, import_react10.isValidElement)(item) ? item : /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
900
|
+
FormItem,
|
|
901
|
+
__spreadProps(__spreadValues({}, item), {
|
|
902
|
+
extendTypes
|
|
903
|
+
}),
|
|
904
|
+
item.id
|
|
905
|
+
)),
|
|
906
|
+
computedProps.children,
|
|
907
|
+
computedProps.submit !== false && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
908
|
+
import_antd7.Button,
|
|
909
|
+
{
|
|
910
|
+
htmlType: "submit",
|
|
911
|
+
type: "primary",
|
|
912
|
+
loading,
|
|
913
|
+
children: ((_b = computedProps.submit) == null ? void 0 : _b.text) || config.Form.submit.text
|
|
914
|
+
}
|
|
915
|
+
),
|
|
916
|
+
computedProps.footer
|
|
917
|
+
]
|
|
918
|
+
})
|
|
919
|
+
);
|
|
951
920
|
}
|
|
952
921
|
Form.useForm = import_antd7.Form.useForm;
|
|
953
922
|
Form.useFormInstance = import_antd7.Form.useFormInstance;
|
|
@@ -960,15 +929,13 @@ Form.Provider = import_antd7.Form.Provider;
|
|
|
960
929
|
// src/Link.tsx
|
|
961
930
|
var import_react_router_dom = require("react-router-dom");
|
|
962
931
|
var import_antd8 = require("antd");
|
|
963
|
-
var
|
|
932
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
964
933
|
function Link(props) {
|
|
965
934
|
var _a, _b, _c, _d;
|
|
966
935
|
const { Link: Link2 } = useConfigContext();
|
|
967
|
-
let style = {
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
...props.style
|
|
971
|
-
};
|
|
936
|
+
let style = __spreadValues(__spreadProps(__spreadValues({}, Link2.style || {}), {
|
|
937
|
+
cursor: "pointer"
|
|
938
|
+
}), props.style);
|
|
972
939
|
if (props.block)
|
|
973
940
|
style = Object.assign({
|
|
974
941
|
display: "block",
|
|
@@ -976,114 +943,118 @@ function Link(props) {
|
|
|
976
943
|
}, style);
|
|
977
944
|
if (props.href.startsWith("http")) {
|
|
978
945
|
if (props.button)
|
|
979
|
-
return /* @__PURE__ */ (0,
|
|
980
|
-
|
|
946
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
947
|
+
import_antd8.Button,
|
|
948
|
+
__spreadProps(__spreadValues({}, props.button), {
|
|
949
|
+
target: props.target || (Link2 == null ? void 0 : Link2.target) || "_blank",
|
|
950
|
+
style,
|
|
951
|
+
href: props.href,
|
|
952
|
+
children: (_a = props.text) != null ? _a : props.children
|
|
953
|
+
})
|
|
954
|
+
);
|
|
955
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
956
|
+
"a",
|
|
957
|
+
{
|
|
958
|
+
href: props.href,
|
|
981
959
|
target: props.target || (Link2 == null ? void 0 : Link2.target) || "_blank",
|
|
982
960
|
style,
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("a", {
|
|
987
|
-
href: props.href,
|
|
988
|
-
target: props.target || (Link2 == null ? void 0 : Link2.target) || "_blank",
|
|
989
|
-
style,
|
|
990
|
-
children: (_b = props.text) != null ? _b : props.children
|
|
991
|
-
});
|
|
961
|
+
children: (_b = props.text) != null ? _b : props.children
|
|
962
|
+
}
|
|
963
|
+
);
|
|
992
964
|
}
|
|
993
965
|
if (props.button)
|
|
994
|
-
return /* @__PURE__ */ (0,
|
|
966
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
967
|
+
import_react_router_dom.Link,
|
|
968
|
+
{
|
|
969
|
+
to: props.href,
|
|
970
|
+
target: props.target || (Link2 == null ? void 0 : Link2.target),
|
|
971
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
972
|
+
import_antd8.Button,
|
|
973
|
+
__spreadProps(__spreadValues({}, props.button), {
|
|
974
|
+
style,
|
|
975
|
+
children: (_c = props.text) != null ? _c : props.children
|
|
976
|
+
})
|
|
977
|
+
)
|
|
978
|
+
}
|
|
979
|
+
);
|
|
980
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
981
|
+
import_react_router_dom.Link,
|
|
982
|
+
{
|
|
995
983
|
to: props.href,
|
|
996
984
|
target: props.target || (Link2 == null ? void 0 : Link2.target),
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
})
|
|
1002
|
-
});
|
|
1003
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_router_dom.Link, {
|
|
1004
|
-
to: props.href,
|
|
1005
|
-
target: props.target || (Link2 == null ? void 0 : Link2.target),
|
|
1006
|
-
style,
|
|
1007
|
-
children: (_d = props.text) != null ? _d : props.children
|
|
1008
|
-
});
|
|
985
|
+
style,
|
|
986
|
+
children: (_d = props.text) != null ? _d : props.children
|
|
987
|
+
}
|
|
988
|
+
);
|
|
1009
989
|
}
|
|
1010
990
|
|
|
1011
991
|
// src/Modal.tsx
|
|
1012
992
|
var import_antd9 = require("antd");
|
|
1013
|
-
var
|
|
1014
|
-
var
|
|
993
|
+
var import_react11 = require("react");
|
|
994
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
1015
995
|
function useModal(init) {
|
|
1016
|
-
const [props, setProps] = (0,
|
|
996
|
+
const [props, setProps] = (0, import_react11.useState)(__spreadValues({
|
|
1017
997
|
open: false,
|
|
1018
|
-
onCancel: () => setProps((prev) => ({
|
|
1019
|
-
...prev,
|
|
998
|
+
onCancel: () => setProps((prev) => __spreadProps(__spreadValues({}, prev), {
|
|
1020
999
|
open: false
|
|
1021
|
-
}))
|
|
1022
|
-
|
|
1023
|
-
});
|
|
1000
|
+
}))
|
|
1001
|
+
}, init));
|
|
1024
1002
|
return {
|
|
1025
|
-
modal: /* @__PURE__ */ (0,
|
|
1026
|
-
...props
|
|
1027
|
-
}),
|
|
1003
|
+
modal: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_antd9.Modal, __spreadValues({}, props)),
|
|
1028
1004
|
modalProps: props,
|
|
1029
1005
|
setModalProps(changes) {
|
|
1030
|
-
setProps((prev) => ({
|
|
1031
|
-
...prev,
|
|
1032
|
-
...changes
|
|
1033
|
-
}));
|
|
1006
|
+
setProps((prev) => __spreadValues(__spreadValues({}, prev), changes));
|
|
1034
1007
|
}
|
|
1035
1008
|
};
|
|
1036
1009
|
}
|
|
1037
1010
|
|
|
1038
1011
|
// src/Routers.tsx
|
|
1039
1012
|
var import_antd10 = require("antd");
|
|
1040
|
-
var
|
|
1013
|
+
var import_react12 = require("react");
|
|
1041
1014
|
var import_react_router_dom2 = require("react-router-dom");
|
|
1042
|
-
var
|
|
1015
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
1043
1016
|
function PageNotFound() {
|
|
1044
1017
|
const config = useConfigContext();
|
|
1045
|
-
return /* @__PURE__ */ (0,
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1018
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1019
|
+
import_antd10.Result,
|
|
1020
|
+
{
|
|
1021
|
+
status: "404",
|
|
1022
|
+
title: config.common.pageNotFound
|
|
1023
|
+
}
|
|
1024
|
+
);
|
|
1049
1025
|
}
|
|
1050
1026
|
function Routes(props) {
|
|
1051
|
-
return /* @__PURE__ */ (0,
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
element: props.notFound || /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PageNotFound, {})
|
|
1069
|
-
}, "*")
|
|
1070
|
-
]
|
|
1071
|
-
})
|
|
1072
|
-
});
|
|
1027
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_react_router_dom2.Routes, { children: [
|
|
1028
|
+
props.routes.map((r) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1029
|
+
import_react_router_dom2.Route,
|
|
1030
|
+
__spreadProps(__spreadValues({}, r), {
|
|
1031
|
+
element: r.element || /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_react12.Suspense, { fallback: props.fallback || /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { style: { padding: "24px" }, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_antd10.Skeleton, { active: true }) }), children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(r.page, {}) })
|
|
1032
|
+
}),
|
|
1033
|
+
r.path
|
|
1034
|
+
)),
|
|
1035
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1036
|
+
import_react_router_dom2.Route,
|
|
1037
|
+
{
|
|
1038
|
+
path: "*",
|
|
1039
|
+
element: props.notFound || /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(PageNotFound, {})
|
|
1040
|
+
},
|
|
1041
|
+
"*"
|
|
1042
|
+
)
|
|
1043
|
+
] });
|
|
1073
1044
|
}
|
|
1074
1045
|
|
|
1075
1046
|
// src/Table.tsx
|
|
1076
|
-
var
|
|
1047
|
+
var import_react13 = require("react");
|
|
1077
1048
|
var import_antd11 = require("antd");
|
|
1078
1049
|
var import_dayjs2 = __toESM(require("dayjs"));
|
|
1079
1050
|
var import_icons3 = require("@ant-design/icons");
|
|
1080
1051
|
var import_lodash_es6 = require("lodash-es");
|
|
1081
|
-
var
|
|
1052
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
1082
1053
|
function processValue(item, value) {
|
|
1083
1054
|
var _a;
|
|
1084
1055
|
const transferred = transferValue(item.type, value);
|
|
1085
1056
|
if (transferred === null || Array.isArray(transferred) && transferred.length === 0)
|
|
1086
|
-
return /* @__PURE__ */ (0,
|
|
1057
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Blank, {});
|
|
1087
1058
|
if (item.options) {
|
|
1088
1059
|
if (item.type.endsWith("[]"))
|
|
1089
1060
|
return transferred.map((v) => {
|
|
@@ -1104,9 +1075,9 @@ function processValue(item, value) {
|
|
|
1104
1075
|
return value;
|
|
1105
1076
|
}
|
|
1106
1077
|
function Table(props) {
|
|
1107
|
-
const [columns, setColumns] = (0,
|
|
1078
|
+
const [columns, setColumns] = (0, import_react13.useState)();
|
|
1108
1079
|
const { common: common2 } = useConfigContext();
|
|
1109
|
-
(0,
|
|
1080
|
+
(0, import_react13.useEffect)(() => {
|
|
1110
1081
|
var _a;
|
|
1111
1082
|
for (const item of props.items) {
|
|
1112
1083
|
if (!item.key)
|
|
@@ -1123,14 +1094,14 @@ function Table(props) {
|
|
|
1123
1094
|
text: o.label,
|
|
1124
1095
|
value: o.value
|
|
1125
1096
|
})).concat({
|
|
1126
|
-
text: /* @__PURE__ */ (0,
|
|
1097
|
+
text: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Blank, {}),
|
|
1127
1098
|
value: null
|
|
1128
1099
|
});
|
|
1129
1100
|
}
|
|
1130
1101
|
if (item.tableChildren === null)
|
|
1131
1102
|
item.render = () => null;
|
|
1132
1103
|
else if (item.tableChildren)
|
|
1133
|
-
item.render = (value, values) => (0,
|
|
1104
|
+
item.render = (value, values) => (0, import_react13.cloneElement)(
|
|
1134
1105
|
item.tableChildren,
|
|
1135
1106
|
{
|
|
1136
1107
|
scene: "table",
|
|
@@ -1141,7 +1112,7 @@ function Table(props) {
|
|
|
1141
1112
|
else if (item.children === null)
|
|
1142
1113
|
item.render = () => null;
|
|
1143
1114
|
else if (item.children)
|
|
1144
|
-
item.render = (value, values) => (0,
|
|
1115
|
+
item.render = (value, values) => (0, import_react13.cloneElement)(
|
|
1145
1116
|
item.children,
|
|
1146
1117
|
{
|
|
1147
1118
|
scene: "table",
|
|
@@ -1151,7 +1122,7 @@ function Table(props) {
|
|
|
1151
1122
|
);
|
|
1152
1123
|
if (props.extendTypes && props.extendTypes[item.type]) {
|
|
1153
1124
|
if (props.extendTypes[item.type].children)
|
|
1154
|
-
item.render = (value, values) => (0,
|
|
1125
|
+
item.render = (value, values) => (0, import_react13.cloneElement)(
|
|
1155
1126
|
props.extendTypes[item.type].children,
|
|
1156
1127
|
{
|
|
1157
1128
|
scene: "table",
|
|
@@ -1182,19 +1153,22 @@ function Table(props) {
|
|
|
1182
1153
|
setSelectedKeys,
|
|
1183
1154
|
confirm,
|
|
1184
1155
|
clearFilters
|
|
1185
|
-
}) => /* @__PURE__ */ (0,
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1156
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1157
|
+
import_antd11.Input.Search,
|
|
1158
|
+
{
|
|
1159
|
+
placeholder: `${common2.search} ${item.title}`,
|
|
1160
|
+
allowClear: true,
|
|
1161
|
+
onSearch: (v) => {
|
|
1162
|
+
if (v) {
|
|
1163
|
+
setSelectedKeys([v]);
|
|
1164
|
+
} else {
|
|
1165
|
+
setSelectedKeys([]);
|
|
1166
|
+
clearFilters();
|
|
1167
|
+
}
|
|
1168
|
+
confirm();
|
|
1194
1169
|
}
|
|
1195
|
-
confirm();
|
|
1196
1170
|
}
|
|
1197
|
-
|
|
1171
|
+
);
|
|
1198
1172
|
break;
|
|
1199
1173
|
case "string[]":
|
|
1200
1174
|
if (!item.render)
|
|
@@ -1212,19 +1186,22 @@ function Table(props) {
|
|
|
1212
1186
|
setSelectedKeys,
|
|
1213
1187
|
confirm,
|
|
1214
1188
|
clearFilters
|
|
1215
|
-
}) => /* @__PURE__ */ (0,
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1189
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1190
|
+
import_antd11.Input.Search,
|
|
1191
|
+
{
|
|
1192
|
+
placeholder: `${common2.search} ${item.title}`,
|
|
1193
|
+
allowClear: true,
|
|
1194
|
+
onSearch: (v) => {
|
|
1195
|
+
if (v) {
|
|
1196
|
+
setSelectedKeys([v]);
|
|
1197
|
+
} else {
|
|
1198
|
+
setSelectedKeys([]);
|
|
1199
|
+
clearFilters();
|
|
1200
|
+
}
|
|
1201
|
+
confirm();
|
|
1224
1202
|
}
|
|
1225
|
-
confirm();
|
|
1226
1203
|
}
|
|
1227
|
-
|
|
1204
|
+
);
|
|
1228
1205
|
break;
|
|
1229
1206
|
case "number":
|
|
1230
1207
|
if (!item.render)
|
|
@@ -1242,19 +1219,22 @@ function Table(props) {
|
|
|
1242
1219
|
setSelectedKeys,
|
|
1243
1220
|
confirm,
|
|
1244
1221
|
clearFilters
|
|
1245
|
-
}) => /* @__PURE__ */ (0,
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1222
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1223
|
+
import_antd11.Input.Search,
|
|
1224
|
+
{
|
|
1225
|
+
placeholder: `${common2.search} ${item.title}`,
|
|
1226
|
+
allowClear: true,
|
|
1227
|
+
onSearch: (v) => {
|
|
1228
|
+
if (v) {
|
|
1229
|
+
setSelectedKeys([Number(v)]);
|
|
1230
|
+
} else {
|
|
1231
|
+
setSelectedKeys([]);
|
|
1232
|
+
clearFilters();
|
|
1233
|
+
}
|
|
1234
|
+
confirm();
|
|
1254
1235
|
}
|
|
1255
|
-
confirm();
|
|
1256
1236
|
}
|
|
1257
|
-
|
|
1237
|
+
);
|
|
1258
1238
|
break;
|
|
1259
1239
|
case "number[]":
|
|
1260
1240
|
if (!item.render)
|
|
@@ -1272,74 +1252,61 @@ function Table(props) {
|
|
|
1272
1252
|
setSelectedKeys,
|
|
1273
1253
|
confirm,
|
|
1274
1254
|
clearFilters
|
|
1275
|
-
}) => /* @__PURE__ */ (0,
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1255
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1256
|
+
import_antd11.Input.Search,
|
|
1257
|
+
{
|
|
1258
|
+
placeholder: `${common2.search} ${item.title}`,
|
|
1259
|
+
allowClear: true,
|
|
1260
|
+
onSearch: (v) => {
|
|
1261
|
+
if (v) {
|
|
1262
|
+
setSelectedKeys([Number(v)]);
|
|
1263
|
+
} else {
|
|
1264
|
+
setSelectedKeys([]);
|
|
1265
|
+
clearFilters();
|
|
1266
|
+
}
|
|
1267
|
+
confirm();
|
|
1284
1268
|
}
|
|
1285
|
-
confirm();
|
|
1286
1269
|
}
|
|
1287
|
-
|
|
1270
|
+
);
|
|
1288
1271
|
break;
|
|
1289
1272
|
case "boolean":
|
|
1290
1273
|
if (!item.render)
|
|
1291
|
-
item.render = (value) => typeof value === "undefined" ? /* @__PURE__ */ (0,
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
marginTop: "4px",
|
|
1299
|
-
color: "#ff4d4f"
|
|
1300
|
-
}
|
|
1301
|
-
});
|
|
1274
|
+
item.render = (value) => typeof value === "undefined" ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Blank, {}) : value ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_icons3.CheckOutlined, { style: {
|
|
1275
|
+
marginTop: "4px",
|
|
1276
|
+
color: "#52c41a"
|
|
1277
|
+
} }) : /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_icons3.CloseOutlined, { style: {
|
|
1278
|
+
marginTop: "4px",
|
|
1279
|
+
color: "#ff4d4f"
|
|
1280
|
+
} });
|
|
1302
1281
|
if (item.filterDropdown !== false)
|
|
1303
1282
|
item.filterDropdown = ({
|
|
1304
1283
|
setSelectedKeys,
|
|
1305
1284
|
selectedKeys,
|
|
1306
1285
|
confirm
|
|
1307
|
-
}) => /* @__PURE__ */ (0,
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
})
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
style: {
|
|
1332
|
-
verticalAlign: "middle",
|
|
1333
|
-
color: "#ff4d4f"
|
|
1334
|
-
}
|
|
1335
|
-
})
|
|
1336
|
-
}),
|
|
1337
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd11.Radio.Button, {
|
|
1338
|
-
value: "empty",
|
|
1339
|
-
children: common2.blank
|
|
1340
|
-
})
|
|
1341
|
-
]
|
|
1342
|
-
});
|
|
1286
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
1287
|
+
import_antd11.Radio.Group,
|
|
1288
|
+
{
|
|
1289
|
+
style: { padding: 8 },
|
|
1290
|
+
buttonStyle: "solid",
|
|
1291
|
+
value: selectedKeys[0],
|
|
1292
|
+
onChange: (e) => {
|
|
1293
|
+
setSelectedKeys(e.target.value ? [e.target.value] : []);
|
|
1294
|
+
confirm();
|
|
1295
|
+
},
|
|
1296
|
+
children: [
|
|
1297
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_antd11.Radio.Button, { children: common2.all }),
|
|
1298
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_antd11.Radio.Button, { value: "true", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_icons3.CheckOutlined, { style: {
|
|
1299
|
+
color: "#52c41a",
|
|
1300
|
+
verticalAlign: "middle"
|
|
1301
|
+
} }) }),
|
|
1302
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_antd11.Radio.Button, { value: "false", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_icons3.CloseOutlined, { style: {
|
|
1303
|
+
verticalAlign: "middle",
|
|
1304
|
+
color: "#ff4d4f"
|
|
1305
|
+
} }) }),
|
|
1306
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_antd11.Radio.Button, { value: "empty", children: common2.blank })
|
|
1307
|
+
]
|
|
1308
|
+
}
|
|
1309
|
+
);
|
|
1343
1310
|
if (!item.onFilter)
|
|
1344
1311
|
item.onFilter = (value, row) => {
|
|
1345
1312
|
switch (value) {
|
|
@@ -1372,21 +1339,26 @@ function Table(props) {
|
|
|
1372
1339
|
break;
|
|
1373
1340
|
case "object":
|
|
1374
1341
|
if (!item.render)
|
|
1375
|
-
item.render = (value) => /* @__PURE__ */ (0,
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1342
|
+
item.render = (value) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1343
|
+
Description,
|
|
1344
|
+
{
|
|
1345
|
+
items: item.object,
|
|
1346
|
+
dataSource: value || {},
|
|
1347
|
+
column: 1
|
|
1348
|
+
}
|
|
1349
|
+
);
|
|
1380
1350
|
break;
|
|
1381
1351
|
case "object[]":
|
|
1382
1352
|
if (!item.render)
|
|
1383
|
-
item.render = (value) => /* @__PURE__ */ (0,
|
|
1384
|
-
|
|
1353
|
+
item.render = (value) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_jsx_runtime13.Fragment, { children: value.map((v, i) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1354
|
+
Description,
|
|
1355
|
+
{
|
|
1385
1356
|
items: item.object,
|
|
1386
1357
|
dataSource: v || [],
|
|
1387
1358
|
column: 1
|
|
1388
|
-
},
|
|
1389
|
-
|
|
1359
|
+
},
|
|
1360
|
+
i
|
|
1361
|
+
)) });
|
|
1390
1362
|
break;
|
|
1391
1363
|
default:
|
|
1392
1364
|
if (!item.render)
|
|
@@ -1402,7 +1374,7 @@ function Table(props) {
|
|
|
1402
1374
|
}
|
|
1403
1375
|
setColumns(props.items);
|
|
1404
1376
|
}, [props.items]);
|
|
1405
|
-
(0,
|
|
1377
|
+
(0, import_react13.useEffect)(() => {
|
|
1406
1378
|
if (!props.dataSource || !columns)
|
|
1407
1379
|
return;
|
|
1408
1380
|
for (const column of columns) {
|
|
@@ -1416,7 +1388,7 @@ function Table(props) {
|
|
|
1416
1388
|
const newColumns = [...prev];
|
|
1417
1389
|
const index = newColumns.findIndex((item) => item.id === column.id);
|
|
1418
1390
|
newColumns[index].filters = filters.concat({
|
|
1419
|
-
text: /* @__PURE__ */ (0,
|
|
1391
|
+
text: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Blank, {}),
|
|
1420
1392
|
value: null
|
|
1421
1393
|
});
|
|
1422
1394
|
return newColumns;
|
|
@@ -1427,19 +1399,26 @@ function Table(props) {
|
|
|
1427
1399
|
if (!columns)
|
|
1428
1400
|
return null;
|
|
1429
1401
|
if (!props.faasData)
|
|
1430
|
-
return /* @__PURE__ */ (0,
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1402
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1403
|
+
import_antd11.Table,
|
|
1404
|
+
__spreadProps(__spreadValues({}, props), {
|
|
1405
|
+
rowKey: props.rowKey || "id",
|
|
1406
|
+
columns,
|
|
1407
|
+
dataSource: props.dataSource
|
|
1408
|
+
})
|
|
1409
|
+
);
|
|
1410
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1411
|
+
FaasDataWrapper2,
|
|
1412
|
+
__spreadProps(__spreadValues({}, props.faasData), {
|
|
1413
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1414
|
+
FaasDataTable,
|
|
1415
|
+
{
|
|
1416
|
+
props,
|
|
1417
|
+
columns
|
|
1418
|
+
}
|
|
1419
|
+
)
|
|
1441
1420
|
})
|
|
1442
|
-
|
|
1421
|
+
);
|
|
1443
1422
|
}
|
|
1444
1423
|
function FaasDataTable({
|
|
1445
1424
|
props,
|
|
@@ -1448,8 +1427,8 @@ function FaasDataTable({
|
|
|
1448
1427
|
params,
|
|
1449
1428
|
reload
|
|
1450
1429
|
}) {
|
|
1451
|
-
const [currentColumns, setCurrentColumns] = (0,
|
|
1452
|
-
(0,
|
|
1430
|
+
const [currentColumns, setCurrentColumns] = (0, import_react13.useState)(columns);
|
|
1431
|
+
(0, import_react13.useEffect)(() => {
|
|
1453
1432
|
if (!data || Array.isArray(data))
|
|
1454
1433
|
return;
|
|
1455
1434
|
setCurrentColumns((prev) => {
|
|
@@ -1461,7 +1440,7 @@ function FaasDataTable({
|
|
|
1461
1440
|
text: v.label,
|
|
1462
1441
|
value: v.value
|
|
1463
1442
|
})).concat({
|
|
1464
|
-
text: /* @__PURE__ */ (0,
|
|
1443
|
+
text: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Blank, {}),
|
|
1465
1444
|
value: null
|
|
1466
1445
|
});
|
|
1467
1446
|
column.render = (value) => processValue(column, value);
|
|
@@ -1476,7 +1455,7 @@ function FaasDataTable({
|
|
|
1476
1455
|
}));
|
|
1477
1456
|
if (filters.length)
|
|
1478
1457
|
column.filters = filters.concat({
|
|
1479
|
-
text: /* @__PURE__ */ (0,
|
|
1458
|
+
text: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Blank, {}),
|
|
1480
1459
|
value: null
|
|
1481
1460
|
});
|
|
1482
1461
|
}
|
|
@@ -1485,75 +1464,75 @@ function FaasDataTable({
|
|
|
1485
1464
|
});
|
|
1486
1465
|
}, [columns, data]);
|
|
1487
1466
|
if (!data)
|
|
1488
|
-
return /* @__PURE__ */ (0,
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1467
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1468
|
+
import_antd11.Table,
|
|
1469
|
+
__spreadProps(__spreadValues({}, props), {
|
|
1470
|
+
rowKey: props.rowKey || "id",
|
|
1471
|
+
columns: currentColumns,
|
|
1472
|
+
dataSource: []
|
|
1473
|
+
})
|
|
1474
|
+
);
|
|
1494
1475
|
if (Array.isArray(data))
|
|
1495
|
-
return /* @__PURE__ */ (0,
|
|
1496
|
-
|
|
1476
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1477
|
+
import_antd11.Table,
|
|
1478
|
+
__spreadProps(__spreadValues({}, props), {
|
|
1479
|
+
rowKey: props.rowKey || "id",
|
|
1480
|
+
columns: currentColumns,
|
|
1481
|
+
dataSource: data
|
|
1482
|
+
})
|
|
1483
|
+
);
|
|
1484
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1485
|
+
import_antd11.Table,
|
|
1486
|
+
__spreadProps(__spreadValues({}, props), {
|
|
1497
1487
|
rowKey: props.rowKey || "id",
|
|
1498
1488
|
columns: currentColumns,
|
|
1499
|
-
dataSource: data
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
filters: processed.filters,
|
|
1517
|
-
sorter: processed.sorter
|
|
1518
|
-
});
|
|
1519
|
-
return;
|
|
1489
|
+
dataSource: data.rows,
|
|
1490
|
+
pagination: __spreadValues(__spreadValues({}, props.pagination), data.pagination),
|
|
1491
|
+
onChange: (pagination, filters, sorter, extra) => {
|
|
1492
|
+
if (props.onChange) {
|
|
1493
|
+
const processed = props.onChange(pagination, filters, sorter, extra);
|
|
1494
|
+
reload(__spreadProps(__spreadValues({}, params), {
|
|
1495
|
+
pagination: processed.pagination,
|
|
1496
|
+
filters: processed.filters,
|
|
1497
|
+
sorter: processed.sorter
|
|
1498
|
+
}));
|
|
1499
|
+
return;
|
|
1500
|
+
}
|
|
1501
|
+
reload(__spreadProps(__spreadValues({}, params), {
|
|
1502
|
+
pagination,
|
|
1503
|
+
filters,
|
|
1504
|
+
sorter
|
|
1505
|
+
}));
|
|
1520
1506
|
}
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
pagination,
|
|
1524
|
-
filters,
|
|
1525
|
-
sorter
|
|
1526
|
-
});
|
|
1527
|
-
}
|
|
1528
|
-
});
|
|
1507
|
+
})
|
|
1508
|
+
);
|
|
1529
1509
|
}
|
|
1530
1510
|
|
|
1531
1511
|
// src/Title.tsx
|
|
1532
|
-
var
|
|
1533
|
-
var
|
|
1512
|
+
var import_react14 = require("react");
|
|
1513
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
1534
1514
|
function Title(props) {
|
|
1535
1515
|
const { Title: Title2 } = useConfigContext();
|
|
1536
|
-
(0,
|
|
1516
|
+
(0, import_react14.useEffect)(() => {
|
|
1537
1517
|
const title = Array.isArray(props.title) ? props.title : [props.title];
|
|
1538
1518
|
document.title = title.concat(props.suffix || Title2.suffix).filter((t) => !!t).join(props.separator || Title2.separator);
|
|
1539
1519
|
}, [props]);
|
|
1540
1520
|
if (props.h1) {
|
|
1541
1521
|
if (typeof props.h1 === "boolean")
|
|
1542
|
-
return /* @__PURE__ */ (0,
|
|
1522
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("h1", { children: Array.isArray(props.title) ? props.title[0] : props.title });
|
|
1523
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1524
|
+
"h1",
|
|
1525
|
+
{
|
|
1526
|
+
className: props.h1.className,
|
|
1527
|
+
style: props.h1.style,
|
|
1543
1528
|
children: Array.isArray(props.title) ? props.title[0] : props.title
|
|
1544
|
-
}
|
|
1545
|
-
|
|
1546
|
-
className: props.h1.className,
|
|
1547
|
-
style: props.h1.style,
|
|
1548
|
-
children: Array.isArray(props.title) ? props.title[0] : props.title
|
|
1549
|
-
});
|
|
1529
|
+
}
|
|
1530
|
+
);
|
|
1550
1531
|
}
|
|
1551
1532
|
if (props.plain)
|
|
1552
|
-
return /* @__PURE__ */ (0,
|
|
1553
|
-
children: Array.isArray(props.title) ? props.title[0] : props.title
|
|
1554
|
-
});
|
|
1533
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_jsx_runtime14.Fragment, { children: Array.isArray(props.title) ? props.title[0] : props.title });
|
|
1555
1534
|
if (props.children)
|
|
1556
|
-
return (0,
|
|
1535
|
+
return (0, import_react14.cloneElement)(props.children, { title: props.title });
|
|
1557
1536
|
return null;
|
|
1558
1537
|
}
|
|
1559
1538
|
// Annotate the CommonJS export names for ESM import in node:
|