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