@faasjs/ant-design 0.0.2-beta.415 → 0.0.2-beta.416

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 CHANGED
@@ -70,7 +70,9 @@ var zh = {
70
70
  pageNotFound: "\u9875\u9762\u672A\u627E\u5230",
71
71
  add: "\u6DFB\u52A0",
72
72
  delete: "\u5220\u9664",
73
- required: "\u5FC5\u586B"
73
+ required: "\u5FC5\u586B",
74
+ search: "\u641C\u7D22",
75
+ reset: "\u91CD\u7F6E"
74
76
  };
75
77
  var en = {
76
78
  lang: "en",
@@ -80,7 +82,9 @@ var en = {
80
82
  pageNotFound: "Page Not Found",
81
83
  add: "Add",
82
84
  delete: "Delete",
83
- required: "is required"
85
+ required: "is required",
86
+ search: "Search",
87
+ reset: "Reset"
84
88
  };
85
89
  var common = isZH ? zh : en;
86
90
  var baseConfig = {
@@ -125,10 +129,10 @@ function useConfigContext() {
125
129
  }
126
130
 
127
131
  // src/Blank.tsx
128
- var import_jsx_runtime = require("react/jsx-runtime");
132
+ var import_jsx_runtime2 = require("react/jsx-runtime");
129
133
  function Blank(options) {
130
134
  const { Blank: Blank2 } = useConfigContext();
131
- return !options || (0, import_lodash2.isNil)(options.value) || Array.isArray(options.value) && !options.value.length || options.value === "" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd2.Typography.Text, {
135
+ return !options || (0, import_lodash2.isNil)(options.value) || Array.isArray(options.value) && !options.value.length || options.value === "" ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_antd2.Typography.Text, {
132
136
  disabled: true,
133
137
  children: (options == null ? void 0 : options.text) || Blank2.text
134
138
  }) : options.value;
@@ -164,7 +168,7 @@ var import_lodash4 = require("lodash");
164
168
  var import_react3 = require("react");
165
169
  var import_dayjs3 = __toESM(require("dayjs"));
166
170
  var import_react4 = require("@faasjs/react");
167
- var import_jsx_runtime = require("react/jsx-runtime");
171
+ var import_jsx_runtime3 = require("react/jsx-runtime");
168
172
  function DescriptionItemContent(props) {
169
173
  const [computedProps, setComputedProps] = (0, import_react3.useState)();
170
174
  (0, import_react3.useEffect)(() => {
@@ -204,7 +208,7 @@ function DescriptionItemContent(props) {
204
208
  }
205
209
  );
206
210
  else if (computedProps.extendTypes[computedProps.item.type].render)
207
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, {
211
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_jsx_runtime3.Fragment, {
208
212
  children: computedProps.extendTypes[computedProps.item.type].render(computedProps.value, computedProps.values)
209
213
  });
210
214
  else
@@ -212,40 +216,40 @@ function DescriptionItemContent(props) {
212
216
  if (computedProps.item.children)
213
217
  return (0, import_react3.cloneElement)(computedProps.item.children, { value: computedProps.value });
214
218
  if (computedProps.item.render)
215
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, {
219
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_jsx_runtime3.Fragment, {
216
220
  children: computedProps.item.render(computedProps.value, computedProps.values)
217
221
  });
218
222
  if (typeof computedProps.value === "undefined" || computedProps.value === null)
219
223
  return null;
220
224
  switch (computedProps.item.type) {
221
225
  case "string[]":
222
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, {
226
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_jsx_runtime3.Fragment, {
223
227
  children: computedProps.value.join(", ")
224
228
  });
225
229
  case "number":
226
230
  return computedProps.value || null;
227
231
  case "number[]":
228
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, {
232
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_jsx_runtime3.Fragment, {
229
233
  children: computedProps.value.join(", ")
230
234
  });
231
235
  case "boolean":
232
- return computedProps.value ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons.CheckOutlined, {
236
+ return computedProps.value ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_icons.CheckOutlined, {
233
237
  style: {
234
238
  marginTop: "4px",
235
239
  color: "#52c41a"
236
240
  }
237
- }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons.CloseOutlined, {
241
+ }) : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_icons.CloseOutlined, {
238
242
  style: {
239
243
  marginTop: "4px",
240
244
  color: "#ff4d4f"
241
245
  }
242
246
  });
243
247
  case "time":
244
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, {
248
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_jsx_runtime3.Fragment, {
245
249
  children: typeof computedProps.value === "number" && computedProps.value.toString().length === 10 ? import_dayjs3.default.unix(computedProps.value).format("YYYY-MM-DD HH:mm:ss") : (0, import_dayjs3.default)(computedProps.value).format("YYYY-MM-DD HH:mm:ss")
246
250
  });
247
251
  case "date":
248
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, {
252
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_jsx_runtime3.Fragment, {
249
253
  children: typeof computedProps.value === "number" && computedProps.value.toString().length === 10 ? import_dayjs3.default.unix(computedProps.value).format("YYYY-MM-DD") : (0, import_dayjs3.default)(computedProps.value).format("YYYY-MM-DD")
250
254
  });
251
255
  default:
@@ -254,11 +258,11 @@ function DescriptionItemContent(props) {
254
258
  }
255
259
  function Description(props) {
256
260
  if (!props.faasData)
257
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd3.Descriptions, {
261
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_antd3.Descriptions, {
258
262
  ...props,
259
- children: props.items.map((item) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd3.Descriptions.Item, {
263
+ children: props.items.map((item) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_antd3.Descriptions.Item, {
260
264
  label: item.title || (0, import_lodash4.upperFirst)(item.id),
261
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DescriptionItemContent, {
265
+ children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(DescriptionItemContent, {
262
266
  item,
263
267
  value: props.dataSource[item.id],
264
268
  values: props.dataSource,
@@ -266,15 +270,15 @@ function Description(props) {
266
270
  })
267
271
  }, item.id))
268
272
  });
269
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react4.FaasDataWrapper, {
270
- fallback: props.faasData.fallback || /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd3.Skeleton, {
273
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react4.FaasDataWrapper, {
274
+ fallback: props.faasData.fallback || /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_antd3.Skeleton, {
271
275
  active: true
272
276
  }),
273
- render: ({ data }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd3.Descriptions, {
277
+ render: ({ data }) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_antd3.Descriptions, {
274
278
  ...props,
275
- children: props.items.map((item) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd3.Descriptions.Item, {
279
+ children: props.items.map((item) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_antd3.Descriptions.Item, {
276
280
  label: item.title || (0, import_lodash4.upperFirst)(item.id),
277
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DescriptionItemContent, {
281
+ children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(DescriptionItemContent, {
278
282
  item,
279
283
  value: data[item.id],
280
284
  values: data,
@@ -289,7 +293,7 @@ function Description(props) {
289
293
  // src/Drawer.tsx
290
294
  var import_antd4 = require("antd");
291
295
  var import_react5 = require("react");
292
- var import_jsx_runtime = require("react/jsx-runtime");
296
+ var import_jsx_runtime4 = require("react/jsx-runtime");
293
297
  function useDrawer(init) {
294
298
  const [props, setProps] = (0, import_react5.useState)({
295
299
  open: false,
@@ -300,7 +304,7 @@ function useDrawer(init) {
300
304
  ...init
301
305
  });
302
306
  return {
303
- drawer: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Drawer, {
307
+ drawer: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_antd4.Drawer, {
304
308
  ...props
305
309
  }),
306
310
  drawerProps: props,
@@ -326,9 +330,9 @@ var import_lodash5 = require("lodash");
326
330
 
327
331
  // src/TimePicker.tsx
328
332
  var import_react6 = require("react");
329
- var import_jsx_runtime = require("react/jsx-runtime");
333
+ var import_jsx_runtime5 = require("react/jsx-runtime");
330
334
  var TimePicker = (0, import_react6.forwardRef)((props, ref) => {
331
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DatePicker, {
335
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(DatePicker, {
332
336
  ...props,
333
337
  picker: "time",
334
338
  mode: void 0,
@@ -339,7 +343,7 @@ TimePicker.displayName = "TimePicker";
339
343
 
340
344
  // src/FormItem.tsx
341
345
  var import_dayjs4 = __toESM(require("dayjs"));
342
- var import_jsx_runtime = require("react/jsx-runtime");
346
+ var import_jsx_runtime6 = require("react/jsx-runtime");
343
347
  function processProps(propsCopy, config) {
344
348
  if (!propsCopy.title)
345
349
  propsCopy.title = (0, import_lodash5.upperFirst)(propsCopy.id);
@@ -391,7 +395,7 @@ function DateItem(options) {
391
395
  (0, import_react7.useEffect)(() => {
392
396
  setValue(options.value && !(0, import_dayjs4.isDayjs)(options.value) ? (0, import_dayjs4.default)(options.value) : null);
393
397
  }, [options.value]);
394
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DatePicker, {
398
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(DatePicker, {
395
399
  ...options,
396
400
  value
397
401
  });
@@ -401,7 +405,7 @@ function TimeItem(options) {
401
405
  (0, import_react7.useEffect)(() => {
402
406
  setValue(options.value && !(0, import_dayjs4.isDayjs)(options.value) ? (0, import_dayjs4.default)(options.value) : null);
403
407
  }, [options.value]);
404
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TimePicker, {
408
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(TimePicker, {
405
409
  ...options,
406
410
  value
407
411
  });
@@ -422,77 +426,77 @@ function FormItem(props) {
422
426
  if (!computedProps)
423
427
  return null;
424
428
  if (extendTypes && extendTypes[computedProps.type])
425
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Form.Item, {
429
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_antd5.Form.Item, {
426
430
  ...computedProps,
427
431
  children: extendTypes[computedProps.type].children
428
432
  });
429
433
  if (computedProps.children)
430
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Form.Item, {
434
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_antd5.Form.Item, {
431
435
  ...computedProps,
432
436
  children: computedProps.children
433
437
  });
434
438
  if (computedProps.render)
435
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Form.Item, {
439
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_antd5.Form.Item, {
436
440
  ...computedProps,
437
441
  children: computedProps.render()
438
442
  });
439
443
  switch (computedProps.type) {
440
444
  case "string":
441
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Form.Item, {
445
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_antd5.Form.Item, {
442
446
  ...computedProps,
443
- children: computedProps.options ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Select, {
447
+ children: computedProps.options ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_antd5.Select, {
444
448
  ...computedProps.input
445
- }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Input, {
449
+ }) : /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_antd5.Input, {
446
450
  ...computedProps.input
447
451
  })
448
452
  });
449
453
  case "string[]":
450
454
  if (computedProps.options)
451
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Form.Item, {
455
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_antd5.Form.Item, {
452
456
  ...computedProps,
453
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Select, {
457
+ children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_antd5.Select, {
454
458
  mode: "multiple",
455
459
  ...computedProps.input
456
460
  })
457
461
  });
458
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Form.List, {
462
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_antd5.Form.List, {
459
463
  name: computedProps.name,
460
464
  rules: computedProps.rules,
461
465
  children: (fields, { add, remove }, { errors }) => {
462
466
  var _a2;
463
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, {
467
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, {
464
468
  children: [
465
- computedProps.label && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
469
+ computedProps.label && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", {
466
470
  className: "ant-form-item-label",
467
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("label", {
471
+ children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("label", {
468
472
  className: computedProps.rules.find((r) => r.required) && "ant-form-item-required",
469
473
  children: computedProps.label
470
474
  })
471
475
  }),
472
476
  fields.map((field) => {
473
477
  var _a3;
474
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Form.Item, {
475
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_antd5.Row, {
478
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_antd5.Form.Item, {
479
+ children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_antd5.Row, {
476
480
  gutter: 24,
477
481
  style: { flexFlow: "row nowrap" },
478
482
  children: [
479
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Col, {
483
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_antd5.Col, {
480
484
  span: 23,
481
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Form.Item, {
485
+ children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_antd5.Form.Item, {
482
486
  ...field,
483
487
  noStyle: true,
484
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Input, {
488
+ children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_antd5.Input, {
485
489
  ...computedProps.input
486
490
  })
487
491
  })
488
492
  }),
489
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Col, {
493
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_antd5.Col, {
490
494
  span: 1,
491
- children: !((_a3 = computedProps.input) == null ? void 0 : _a3.disabled) && (!computedProps.rules.find((r) => r.required) || field.key > 0) && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Button, {
495
+ children: !((_a3 = computedProps.input) == null ? void 0 : _a3.disabled) && (!computedProps.rules.find((r) => r.required) || field.key > 0) && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_antd5.Button, {
492
496
  danger: true,
493
497
  type: "link",
494
498
  style: { float: "right" },
495
- icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons2.MinusCircleOutlined, {}),
499
+ icon: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_icons2.MinusCircleOutlined, {}),
496
500
  onClick: () => remove(field.name)
497
501
  })
498
502
  })
@@ -500,15 +504,15 @@ function FormItem(props) {
500
504
  })
501
505
  }, field.key);
502
506
  }),
503
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_antd5.Form.Item, {
507
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_antd5.Form.Item, {
504
508
  children: [
505
- !((_a2 = computedProps.input) == null ? void 0 : _a2.disabled) && (!computedProps.maxCount || computedProps.maxCount > fields.length) && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Button, {
509
+ !((_a2 = computedProps.input) == null ? void 0 : _a2.disabled) && (!computedProps.maxCount || computedProps.maxCount > fields.length) && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_antd5.Button, {
506
510
  type: "dashed",
507
511
  block: true,
508
512
  onClick: () => add(),
509
- icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons2.PlusOutlined, {})
513
+ icon: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_icons2.PlusOutlined, {})
510
514
  }),
511
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Form.ErrorList, {
515
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_antd5.Form.ErrorList, {
512
516
  errors
513
517
  })
514
518
  ]
@@ -518,63 +522,63 @@ function FormItem(props) {
518
522
  }
519
523
  });
520
524
  case "number":
521
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Form.Item, {
525
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_antd5.Form.Item, {
522
526
  ...computedProps,
523
- children: computedProps.options ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Select, {
527
+ children: computedProps.options ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_antd5.Select, {
524
528
  ...computedProps.input
525
- }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.InputNumber, {
529
+ }) : /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_antd5.InputNumber, {
526
530
  style: { width: "100%" },
527
531
  ...computedProps.input
528
532
  })
529
533
  });
530
534
  case "number[]":
531
535
  if (computedProps.options)
532
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Form.Item, {
536
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_antd5.Form.Item, {
533
537
  ...computedProps,
534
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Select, {
538
+ children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_antd5.Select, {
535
539
  mode: "multiple",
536
540
  ...computedProps.input
537
541
  })
538
542
  });
539
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Form.List, {
543
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_antd5.Form.List, {
540
544
  name: computedProps.name,
541
545
  rules: computedProps.rules,
542
546
  children: (fields, { add, remove }, { errors }) => {
543
547
  var _a2, _b;
544
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, {
548
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, {
545
549
  children: [
546
- computedProps.label && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
550
+ computedProps.label && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", {
547
551
  className: "ant-form-item-label",
548
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("label", {
552
+ children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("label", {
549
553
  className: ((_a2 = computedProps.rules) == null ? void 0 : _a2.find((r) => r.required)) && "ant-form-item-required",
550
554
  children: computedProps.label
551
555
  })
552
556
  }),
553
557
  fields.map((field) => {
554
558
  var _a3;
555
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Form.Item, {
556
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_antd5.Row, {
559
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_antd5.Form.Item, {
560
+ children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_antd5.Row, {
557
561
  gutter: 24,
558
562
  style: { flexFlow: "row nowrap" },
559
563
  children: [
560
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Col, {
564
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_antd5.Col, {
561
565
  span: 23,
562
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Form.Item, {
566
+ children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_antd5.Form.Item, {
563
567
  ...field,
564
568
  noStyle: true,
565
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.InputNumber, {
569
+ children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_antd5.InputNumber, {
566
570
  style: { width: "100%" },
567
571
  ...computedProps.input
568
572
  })
569
573
  })
570
574
  }),
571
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Col, {
575
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_antd5.Col, {
572
576
  span: 1,
573
- children: !((_a3 = computedProps.input) == null ? void 0 : _a3.disabled) && (!computedProps.rules.find((r) => r.required) || field.key > 0) && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Button, {
577
+ children: !((_a3 = computedProps.input) == null ? void 0 : _a3.disabled) && (!computedProps.rules.find((r) => r.required) || field.key > 0) && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_antd5.Button, {
574
578
  danger: true,
575
579
  type: "link",
576
580
  style: { float: "right" },
577
- icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons2.MinusCircleOutlined, {}),
581
+ icon: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_icons2.MinusCircleOutlined, {}),
578
582
  onClick: () => remove(field.name)
579
583
  })
580
584
  })
@@ -582,15 +586,15 @@ function FormItem(props) {
582
586
  })
583
587
  }, field.key);
584
588
  }),
585
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_antd5.Form.Item, {
589
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_antd5.Form.Item, {
586
590
  children: [
587
- !((_b = computedProps.input) == null ? void 0 : _b.disabled) && (!computedProps.maxCount || computedProps.maxCount > fields.length) && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Button, {
591
+ !((_b = computedProps.input) == null ? void 0 : _b.disabled) && (!computedProps.maxCount || computedProps.maxCount > fields.length) && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_antd5.Button, {
588
592
  type: "dashed",
589
593
  block: true,
590
594
  onClick: () => add(),
591
- icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons2.PlusOutlined, {})
595
+ icon: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_icons2.PlusOutlined, {})
592
596
  }),
593
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Form.ErrorList, {
597
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_antd5.Form.ErrorList, {
594
598
  errors
595
599
  })
596
600
  ]
@@ -600,58 +604,58 @@ function FormItem(props) {
600
604
  }
601
605
  });
602
606
  case "boolean":
603
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Form.Item, {
607
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_antd5.Form.Item, {
604
608
  ...computedProps,
605
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Switch, {
609
+ children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_antd5.Switch, {
606
610
  ...computedProps.input
607
611
  })
608
612
  });
609
613
  case "date":
610
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Form.Item, {
614
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_antd5.Form.Item, {
611
615
  ...computedProps,
612
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DateItem, {
616
+ children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(DateItem, {
613
617
  ...computedProps.input
614
618
  })
615
619
  });
616
620
  case "time":
617
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Form.Item, {
621
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_antd5.Form.Item, {
618
622
  ...computedProps,
619
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TimeItem, {
623
+ children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(TimeItem, {
620
624
  ...computedProps.input
621
625
  })
622
626
  });
623
627
  case "object":
624
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, {
628
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, {
625
629
  children: [
626
- computedProps.label && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
630
+ computedProps.label && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", {
627
631
  className: "ant-form-item-label",
628
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("label", {
632
+ children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("label", {
629
633
  className: ((_a = computedProps.rules) == null ? void 0 : _a.find((r) => r.required)) && "ant-form-item-required",
630
634
  children: computedProps.label
631
635
  })
632
636
  }),
633
- computedProps.object.map((o) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FormItem, {
637
+ computedProps.object.map((o) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(FormItem, {
634
638
  ...o
635
639
  }, o.id))
636
640
  ]
637
641
  });
638
642
  case "object[]":
639
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Form.List, {
643
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_antd5.Form.List, {
640
644
  name: computedProps.name,
641
645
  rules: computedProps.rules,
642
- children: (fields, { add, remove }, { errors }) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, {
646
+ children: (fields, { add, remove }, { errors }) => /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, {
643
647
  children: [
644
- fields.map((field) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_antd5.Form.Item, {
648
+ fields.map((field) => /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_antd5.Form.Item, {
645
649
  style: { marginBottom: 0 },
646
650
  children: [
647
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
651
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", {
648
652
  className: "ant-form-item-label",
649
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", {
653
+ children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("label", {
650
654
  children: [
651
655
  computedProps.label,
652
656
  " ",
653
657
  field.name + 1,
654
- !computedProps.disabled && (!computedProps.rules.find((r) => r.required) || field.key > 0) && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Button, {
658
+ !computedProps.disabled && (!computedProps.rules.find((r) => r.required) || field.key > 0) && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_antd5.Button, {
655
659
  danger: true,
656
660
  type: "link",
657
661
  onClick: () => remove(field.name),
@@ -660,11 +664,11 @@ function FormItem(props) {
660
664
  ]
661
665
  })
662
666
  }),
663
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Row, {
667
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_antd5.Row, {
664
668
  gutter: 24,
665
- children: computedProps.object.map((o) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Col, {
669
+ children: computedProps.object.map((o) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_antd5.Col, {
666
670
  span: o.col || 6,
667
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FormItem, {
671
+ children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(FormItem, {
668
672
  ...o,
669
673
  name: [field.name, o.id]
670
674
  })
@@ -672,20 +676,20 @@ function FormItem(props) {
672
676
  })
673
677
  ]
674
678
  }, field.key)),
675
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_antd5.Form.Item, {
679
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_antd5.Form.Item, {
676
680
  children: [
677
- !computedProps.disabled && (!computedProps.maxCount || computedProps.maxCount > fields.length) && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_antd5.Button, {
681
+ !computedProps.disabled && (!computedProps.maxCount || computedProps.maxCount > fields.length) && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_antd5.Button, {
678
682
  type: "dashed",
679
683
  block: true,
680
684
  onClick: () => add(),
681
- icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons2.PlusOutlined, {}),
685
+ icon: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_icons2.PlusOutlined, {}),
682
686
  children: [
683
687
  config.common.add,
684
688
  " ",
685
689
  computedProps.label
686
690
  ]
687
691
  }),
688
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Form.ErrorList, {
692
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_antd5.Form.ErrorList, {
689
693
  errors
690
694
  })
691
695
  ]
@@ -699,7 +703,7 @@ function FormItem(props) {
699
703
  }
700
704
 
701
705
  // src/Form.tsx
702
- var import_jsx_runtime = require("react/jsx-runtime");
706
+ var import_jsx_runtime7 = require("react/jsx-runtime");
703
707
  function Form(props) {
704
708
  var _a, _b;
705
709
  const [loading, setLoading] = (0, import_react9.useState)(false);
@@ -743,16 +747,16 @@ function Form(props) {
743
747
  }, []);
744
748
  if (!computedProps)
745
749
  return null;
746
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_antd6.Form, {
750
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_antd6.Form, {
747
751
  ...computedProps,
748
752
  children: [
749
753
  computedProps.beforeItems,
750
- (_a = computedProps.items) == null ? void 0 : _a.map((item) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FormItem, {
754
+ (_a = computedProps.items) == null ? void 0 : _a.map((item) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(FormItem, {
751
755
  ...item,
752
756
  extendTypes
753
757
  }, item.id)),
754
758
  computedProps.children,
755
- computedProps.submit !== false && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd6.Button, {
759
+ computedProps.submit !== false && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_antd6.Button, {
756
760
  htmlType: "submit",
757
761
  type: "primary",
758
762
  loading,
@@ -768,7 +772,7 @@ Form.Item = FormItem;
768
772
  // src/Link.tsx
769
773
  var import_react_router_dom = require("react-router-dom");
770
774
  var import_antd7 = require("antd");
771
- var import_jsx_runtime = require("react/jsx-runtime");
775
+ var import_jsx_runtime8 = require("react/jsx-runtime");
772
776
  function Link({
773
777
  href,
774
778
  target,
@@ -781,9 +785,9 @@ function Link({
781
785
  style = Object.assign({ cursor: "pointer" }, style);
782
786
  if (href.startsWith("http")) {
783
787
  if (button)
784
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd7.Button, {
788
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_antd7.Button, {
785
789
  ...button,
786
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("a", {
790
+ children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("a", {
787
791
  href,
788
792
  target: target || (Link2 == null ? void 0 : Link2.target) || "_blank",
789
793
  style: {
@@ -793,7 +797,7 @@ function Link({
793
797
  children: text || children
794
798
  })
795
799
  });
796
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("a", {
800
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("a", {
797
801
  href,
798
802
  target: target || (Link2 == null ? void 0 : Link2.target) || "_blank",
799
803
  style: {
@@ -804,9 +808,9 @@ function Link({
804
808
  });
805
809
  }
806
810
  if (button)
807
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd7.Button, {
811
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_antd7.Button, {
808
812
  ...button,
809
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_router_dom.Link, {
813
+ children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_react_router_dom.Link, {
810
814
  to: href,
811
815
  target: target || (Link2 == null ? void 0 : Link2.target),
812
816
  style: {
@@ -816,7 +820,7 @@ function Link({
816
820
  children: text || children
817
821
  })
818
822
  });
819
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_router_dom.Link, {
823
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_react_router_dom.Link, {
820
824
  to: href,
821
825
  target: target || (Link2 == null ? void 0 : Link2.target),
822
826
  style: {
@@ -830,7 +834,7 @@ function Link({
830
834
  // src/Modal.tsx
831
835
  var import_antd8 = require("antd");
832
836
  var import_react10 = require("react");
833
- var import_jsx_runtime = require("react/jsx-runtime");
837
+ var import_jsx_runtime9 = require("react/jsx-runtime");
834
838
  function useModal(init) {
835
839
  const [props, setProps] = (0, import_react10.useState)({
836
840
  open: false,
@@ -841,7 +845,7 @@ function useModal(init) {
841
845
  ...init
842
846
  });
843
847
  return {
844
- modal: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd8.Modal, {
848
+ modal: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_antd8.Modal, {
845
849
  ...props
846
850
  }),
847
851
  modalProps: props,
@@ -858,32 +862,32 @@ function useModal(init) {
858
862
  var import_antd9 = require("antd");
859
863
  var import_react11 = require("react");
860
864
  var import_react_router_dom2 = require("react-router-dom");
861
- var import_jsx_runtime = require("react/jsx-runtime");
865
+ var import_jsx_runtime10 = require("react/jsx-runtime");
862
866
  function PageNotFound() {
863
867
  const config = useConfigContext();
864
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd9.Result, {
868
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_antd9.Result, {
865
869
  status: "404",
866
870
  title: config.common.pageNotFound
867
871
  });
868
872
  }
869
873
  function Routes(props) {
870
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_react_router_dom2.Routes, {
874
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_react_router_dom2.Routes, {
871
875
  children: [
872
- props.routes.map((r) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_router_dom2.Route, {
876
+ props.routes.map((r) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_react_router_dom2.Route, {
873
877
  ...r,
874
- element: r.element || /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react11.Suspense, {
875
- fallback: props.fallback || /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
878
+ element: r.element || /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_react11.Suspense, {
879
+ fallback: props.fallback || /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", {
876
880
  style: { padding: "24px" },
877
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd9.Skeleton, {
881
+ children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_antd9.Skeleton, {
878
882
  active: true
879
883
  })
880
884
  }),
881
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(r.page, {})
885
+ children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(r.page, {})
882
886
  })
883
887
  }, r.path)),
884
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_router_dom2.Route, {
888
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_react_router_dom2.Route, {
885
889
  path: "*",
886
- element: props.notFound || /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PageNotFound, {})
890
+ element: props.notFound || /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(PageNotFound, {})
887
891
  }, "*")
888
892
  ]
889
893
  });
@@ -896,39 +900,34 @@ var import_dayjs5 = __toESM(require("dayjs"));
896
900
  var import_icons3 = require("@ant-design/icons");
897
901
  var import_lodash6 = require("lodash");
898
902
  var import_react13 = require("@faasjs/react");
899
- var import_jsx_runtime = require("react/jsx-runtime");
903
+ var import_jsx_runtime11 = require("react/jsx-runtime");
900
904
  function processValue(item, value) {
901
905
  var _a;
902
- if (typeof value !== "undefined" && value !== null) {
903
- if (item.options) {
904
- if (item.type.endsWith("[]"))
905
- return value.map((v) => {
906
- var _a2;
907
- return ((_a2 = item.options.find((option) => option.value === v)) == null ? void 0 : _a2.label) || v;
908
- });
909
- else if ([
910
- "string",
911
- "number",
912
- "boolean"
913
- ].includes(item.type))
914
- return ((_a = item.options.find((option) => option.value === value)) == null ? void 0 : _a.label) || value;
915
- }
916
- let dayjsFormat = "";
917
- if (item.type === "date")
918
- dayjsFormat = "YYYY-MM-DD";
919
- else if (item.type === "time")
920
- dayjsFormat = "YYYY-MM-DD HH:mm:ss";
921
- if (["date", "time"].includes(item.type)) {
922
- if (typeof value === "number" && value.toString().length === 10)
923
- value = value * 1e3;
924
- value = (0, import_dayjs5.default)(value).format(dayjsFormat);
925
- }
906
+ if (typeof value === "undefined" && value === null)
907
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_antd10.Empty, {});
908
+ if (item.options) {
909
+ if (item.type.endsWith("[]"))
910
+ return value.map((v) => {
911
+ var _a2;
912
+ return ((_a2 = item.options.find((option) => option.value === v)) == null ? void 0 : _a2.label) || v;
913
+ });
914
+ else if ([
915
+ "string",
916
+ "number",
917
+ "boolean"
918
+ ].includes(item.type))
919
+ return ((_a = item.options.find((option) => option.value === value)) == null ? void 0 : _a.label) || value;
920
+ }
921
+ if (["date", "time"].includes(item.type)) {
922
+ if (typeof value === "number" && value.toString().length === 10)
923
+ value = value * 1e3;
924
+ return (0, import_dayjs5.default)(value).format(item.type === "date" ? "YYYY-MM-DD" : "YYYY-MM-DD HH:mm:ss");
926
925
  }
927
926
  return value;
928
927
  }
929
928
  function Table(props) {
930
929
  const [columns, setColumns] = (0, import_react12.useState)();
931
- const config = useConfigContext();
930
+ const { common: common2 } = useConfigContext();
932
931
  (0, import_react12.useEffect)(() => {
933
932
  var _a;
934
933
  for (const item of props.items) {
@@ -947,8 +946,6 @@ function Table(props) {
947
946
  value: o.value
948
947
  }));
949
948
  }
950
- if (item.render)
951
- continue;
952
949
  if (item.children)
953
950
  delete item.children;
954
951
  if (props.extendTypes && props.extendTypes[item.type]) {
@@ -968,81 +965,191 @@ function Table(props) {
968
965
  }
969
966
  switch (item.type) {
970
967
  case "string":
971
- item.render = (value) => processValue(item, value);
968
+ if (!item.render)
969
+ item.render = (value) => processValue(item, value);
972
970
  if (!item.onFilter) {
973
971
  item.onFilter = (value, row) => row[item.id].includes(value);
974
- if (item.filterDropdown !== false)
975
- item.filterDropdown = ({
976
- setSelectedKeys,
977
- selectedKeys,
978
- confirm,
979
- clearFilters
980
- }) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
981
- style: { padding: 8 },
982
- children: [
983
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", {
984
- value: selectedKeys[0],
985
- onChange: (e) => setSelectedKeys(e.target.value ? [e.target.value] : []),
986
- style: {
987
- width: 188,
988
- marginBottom: 8,
989
- display: "block"
990
- }
991
- }),
992
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", {
993
- type: "button",
994
- onClick: () => confirm(),
995
- style: {
996
- width: 90,
997
- marginRight: 8
998
- },
999
- children: "Search"
1000
- }),
1001
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", {
1002
- type: "button",
1003
- onClick: () => clearFilters(),
1004
- style: { width: 90 },
1005
- children: "Reset"
1006
- })
1007
- ]
1008
- });
1009
972
  }
973
+ if (!item.filters && item.filterDropdown !== false && item.optionsType !== "auto")
974
+ item.filterDropdown = ({
975
+ setSelectedKeys,
976
+ selectedKeys,
977
+ confirm,
978
+ clearFilters
979
+ }) => /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", {
980
+ style: { padding: 8 },
981
+ children: [
982
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("input", {
983
+ value: selectedKeys[0],
984
+ onChange: (e) => setSelectedKeys(e.target.value ? [e.target.value] : []),
985
+ style: {
986
+ width: 188,
987
+ marginBottom: 8,
988
+ display: "block"
989
+ }
990
+ }),
991
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("button", {
992
+ type: "button",
993
+ onClick: () => confirm(),
994
+ style: {
995
+ width: 90,
996
+ marginRight: 8
997
+ },
998
+ children: common2.search
999
+ }),
1000
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("button", {
1001
+ type: "button",
1002
+ onClick: () => clearFilters(),
1003
+ style: { width: 90 },
1004
+ children: common2.reset
1005
+ })
1006
+ ]
1007
+ });
1010
1008
  break;
1011
1009
  case "string[]":
1012
- item.render = (value) => processValue(item, value).join(", ");
1010
+ if (!item.render)
1011
+ item.render = (value) => processValue(item, value).join(", ");
1013
1012
  if (!item.onFilter)
1014
1013
  item.onFilter = (value, row) => row[item.id].includes(value);
1014
+ if (!item.filters && item.filterDropdown !== false)
1015
+ item.filterDropdown = ({
1016
+ setSelectedKeys,
1017
+ selectedKeys,
1018
+ confirm,
1019
+ clearFilters
1020
+ }) => /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", {
1021
+ style: { padding: 8 },
1022
+ children: [
1023
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("input", {
1024
+ value: selectedKeys[0],
1025
+ onChange: (e) => setSelectedKeys(e.target.value ? [e.target.value] : []),
1026
+ style: {
1027
+ width: 188,
1028
+ marginBottom: 8,
1029
+ display: "block"
1030
+ }
1031
+ }),
1032
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("button", {
1033
+ type: "button",
1034
+ onClick: () => confirm(),
1035
+ style: {
1036
+ width: 90,
1037
+ marginRight: 8
1038
+ },
1039
+ children: common2.search
1040
+ }),
1041
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("button", {
1042
+ type: "button",
1043
+ onClick: () => clearFilters(),
1044
+ style: { width: 90 },
1045
+ children: common2.reset
1046
+ })
1047
+ ]
1048
+ });
1015
1049
  break;
1016
1050
  case "number":
1017
- item.render = (value) => processValue(item, value);
1051
+ if (!item.render)
1052
+ item.render = (value) => processValue(item, value);
1018
1053
  if (!item.sorter)
1019
1054
  item.sorter = (a, b) => a[item.id] - b[item.id];
1020
1055
  if (!item.onFilter)
1021
1056
  item.onFilter = (value, row) => value === row[item.id];
1057
+ if (!item.filters && item.filterDropdown !== false)
1058
+ item.filterDropdown = ({
1059
+ setSelectedKeys,
1060
+ selectedKeys,
1061
+ confirm,
1062
+ clearFilters
1063
+ }) => /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", {
1064
+ style: { padding: 8 },
1065
+ children: [
1066
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("input", {
1067
+ value: selectedKeys[0],
1068
+ onChange: (e) => setSelectedKeys(e.target.value ? [e.target.value] : []),
1069
+ style: {
1070
+ width: 188,
1071
+ marginBottom: 8,
1072
+ display: "block"
1073
+ }
1074
+ }),
1075
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("button", {
1076
+ type: "button",
1077
+ onClick: () => confirm(),
1078
+ style: {
1079
+ width: 90,
1080
+ marginRight: 8
1081
+ },
1082
+ children: common2.search
1083
+ }),
1084
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("button", {
1085
+ type: "button",
1086
+ onClick: () => clearFilters(),
1087
+ style: { width: 90 },
1088
+ children: common2.reset
1089
+ })
1090
+ ]
1091
+ });
1022
1092
  break;
1023
1093
  case "number[]":
1024
- item.render = (value) => processValue(item, value).join(", ");
1094
+ if (!item.render)
1095
+ item.render = (value) => processValue(item, value).join(", ");
1025
1096
  if (!item.onFilter)
1026
1097
  item.onFilter = (value, row) => row[item.id].includes(value);
1098
+ if (!item.filters && item.filterDropdown !== false)
1099
+ item.filterDropdown = ({
1100
+ setSelectedKeys,
1101
+ selectedKeys,
1102
+ confirm,
1103
+ clearFilters
1104
+ }) => /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", {
1105
+ style: { padding: 8 },
1106
+ children: [
1107
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("input", {
1108
+ value: selectedKeys[0],
1109
+ onChange: (e) => setSelectedKeys(e.target.value ? [e.target.value] : []),
1110
+ style: {
1111
+ width: 188,
1112
+ marginBottom: 8,
1113
+ display: "block"
1114
+ }
1115
+ }),
1116
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("button", {
1117
+ type: "button",
1118
+ onClick: () => confirm(),
1119
+ style: {
1120
+ width: 90,
1121
+ marginRight: 8
1122
+ },
1123
+ children: common2.search
1124
+ }),
1125
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("button", {
1126
+ type: "button",
1127
+ onClick: () => clearFilters(),
1128
+ style: { width: 90 },
1129
+ children: common2.reset
1130
+ })
1131
+ ]
1132
+ });
1027
1133
  break;
1028
1134
  case "boolean":
1029
- item.render = (value) => typeof value === "undefined" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Blank, {}) : value ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons3.CheckOutlined, {
1030
- style: {
1031
- marginTop: "4px",
1032
- color: "#52c41a"
1033
- }
1034
- }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons3.CloseOutlined, {
1035
- style: {
1036
- marginTop: "4px",
1037
- color: "#ff4d4f"
1038
- }
1039
- });
1135
+ if (!item.render)
1136
+ item.render = (value) => typeof value === "undefined" ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Blank, {}) : value ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_icons3.CheckOutlined, {
1137
+ style: {
1138
+ marginTop: "4px",
1139
+ color: "#52c41a"
1140
+ }
1141
+ }) : /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_icons3.CloseOutlined, {
1142
+ style: {
1143
+ marginTop: "4px",
1144
+ color: "#ff4d4f"
1145
+ }
1146
+ });
1040
1147
  if (item.filterDropdown !== false)
1041
1148
  item.filterDropdown = ({
1042
1149
  setSelectedKeys,
1043
1150
  selectedKeys,
1044
1151
  confirm
1045
- }) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_antd10.Radio.Group, {
1152
+ }) => /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_antd10.Radio.Group, {
1046
1153
  style: { padding: 8 },
1047
1154
  buttonStyle: "solid",
1048
1155
  value: selectedKeys[0],
@@ -1051,30 +1158,30 @@ function Table(props) {
1051
1158
  confirm();
1052
1159
  },
1053
1160
  children: [
1054
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd10.Radio.Button, {
1055
- children: config.common.all
1161
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_antd10.Radio.Button, {
1162
+ children: common2.all
1056
1163
  }),
1057
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd10.Radio.Button, {
1164
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_antd10.Radio.Button, {
1058
1165
  value: "true",
1059
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons3.CheckOutlined, {
1166
+ children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_icons3.CheckOutlined, {
1060
1167
  style: {
1061
1168
  color: "#52c41a",
1062
1169
  verticalAlign: "middle"
1063
1170
  }
1064
1171
  })
1065
1172
  }),
1066
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd10.Radio.Button, {
1173
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_antd10.Radio.Button, {
1067
1174
  value: "false",
1068
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons3.CloseOutlined, {
1175
+ children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_icons3.CloseOutlined, {
1069
1176
  style: {
1070
1177
  verticalAlign: "middle",
1071
1178
  color: "#ff4d4f"
1072
1179
  }
1073
1180
  })
1074
1181
  }),
1075
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd10.Radio.Button, {
1182
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_antd10.Radio.Button, {
1076
1183
  value: "empty",
1077
- children: config.common.blank
1184
+ children: common2.blank
1078
1185
  })
1079
1186
  ]
1080
1187
  });
@@ -1093,21 +1200,24 @@ function Table(props) {
1093
1200
  };
1094
1201
  break;
1095
1202
  case "date":
1096
- item.render = (value) => processValue(item, value);
1203
+ if (!item.render)
1204
+ item.render = (value) => processValue(item, value);
1097
1205
  if (!item.onFilter)
1098
1206
  item.onFilter = (value, row) => (0, import_dayjs5.default)(row[item.id]).isSame((0, import_dayjs5.default)(value));
1099
1207
  if (!item.sorter)
1100
1208
  item.sorter = (a, b) => (0, import_dayjs5.default)(a[item.id]).isBefore(b[item.id]) ? -1 : 1;
1101
1209
  break;
1102
1210
  case "time":
1103
- item.render = (value) => processValue(item, value);
1211
+ if (!item.render)
1212
+ item.render = (value) => processValue(item, value);
1104
1213
  if (!item.onFilter)
1105
1214
  item.onFilter = (value, row) => (0, import_dayjs5.default)(row[item.id]).isSame((0, import_dayjs5.default)(value));
1106
1215
  if (!item.sorter)
1107
1216
  item.sorter = (a, b) => (0, import_dayjs5.default)(a[item.id]).isBefore(b[item.id]) ? -1 : 1;
1108
1217
  break;
1109
1218
  default:
1110
- item.render = (value) => processValue(item, value);
1219
+ if (!item.render)
1220
+ item.render = (value) => processValue(item, value);
1111
1221
  if (!item.onFilter)
1112
1222
  item.onFilter = (value, row) => value === row[item.id];
1113
1223
  break;
@@ -1115,17 +1225,34 @@ function Table(props) {
1115
1225
  }
1116
1226
  setColumns(props.items);
1117
1227
  }, [props.items]);
1228
+ (0, import_react12.useEffect)(() => {
1229
+ if (!props.dataSource || !columns)
1230
+ return;
1231
+ for (const column of columns) {
1232
+ if (column.optionsType === "auto" && !column.options && !column.filters) {
1233
+ setColumns((prev) => {
1234
+ const newColumns = [...prev];
1235
+ const index = newColumns.findIndex((item) => item.id === column.id);
1236
+ newColumns[index].filters = (0, import_lodash6.uniqBy)(props.dataSource, column.id).map((v) => ({
1237
+ text: v[column.id],
1238
+ value: v[column.id]
1239
+ }));
1240
+ return newColumns;
1241
+ });
1242
+ }
1243
+ }
1244
+ }, [props.dataSource, columns]);
1118
1245
  if (!columns)
1119
1246
  return null;
1120
1247
  if (!props.faasData)
1121
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd10.Table, {
1248
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_antd10.Table, {
1122
1249
  ...props,
1123
1250
  rowKey: props.rowKey || "id",
1124
1251
  columns,
1125
1252
  dataSource: props.dataSource
1126
1253
  });
1127
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react13.FaasDataWrapper, {
1128
- fallback: props.faasData.fallback || /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd10.Skeleton, {
1254
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_react13.FaasDataWrapper, {
1255
+ fallback: props.faasData.fallback || /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_antd10.Skeleton, {
1129
1256
  active: true
1130
1257
  }),
1131
1258
  render: ({
@@ -1134,20 +1261,20 @@ function Table(props) {
1134
1261
  reload
1135
1262
  }) => {
1136
1263
  if (!data)
1137
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd10.Table, {
1264
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_antd10.Table, {
1138
1265
  ...props,
1139
1266
  rowKey: props.rowKey || "id",
1140
1267
  columns,
1141
1268
  dataSource: []
1142
1269
  });
1143
1270
  if (Array.isArray(data))
1144
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd10.Table, {
1271
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_antd10.Table, {
1145
1272
  ...props,
1146
1273
  rowKey: props.rowKey || "id",
1147
1274
  columns,
1148
1275
  dataSource: data
1149
1276
  });
1150
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd10.Table, {
1277
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_antd10.Table, {
1151
1278
  ...props,
1152
1279
  rowKey: props.rowKey || "id",
1153
1280
  columns,
@@ -1182,7 +1309,7 @@ function Table(props) {
1182
1309
 
1183
1310
  // src/Title.tsx
1184
1311
  var import_react14 = require("react");
1185
- var import_jsx_runtime = require("react/jsx-runtime");
1312
+ var import_jsx_runtime12 = require("react/jsx-runtime");
1186
1313
  function Title(props) {
1187
1314
  const config = useConfigContext();
1188
1315
  (0, import_react14.useEffect)(() => {
@@ -1191,10 +1318,10 @@ function Title(props) {
1191
1318
  }, []);
1192
1319
  if (props.h1) {
1193
1320
  if (typeof props.h1 === "boolean")
1194
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("h1", {
1321
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("h1", {
1195
1322
  children: Array.isArray(props.title) ? props.title[0] : props.title
1196
1323
  });
1197
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("h1", {
1324
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("h1", {
1198
1325
  className: props.h1.className,
1199
1326
  style: props.h1.style,
1200
1327
  children: Array.isArray(props.title) ? props.title[0] : props.title