@faasjs/ant-design 8.0.0-beta.11 → 8.0.0-beta.13

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.
Files changed (3) hide show
  1. package/dist/index.cjs +75 -176
  2. package/dist/index.mjs +75 -176
  3. package/package.json +3 -3
package/dist/index.cjs CHANGED
@@ -716,6 +716,59 @@ function FormItem(props) {
716
716
  id: computedProps.id.toString(),
717
717
  children: cloneUnionFaasItemElement(extendType.children, { scene: "form" })
718
718
  });
719
+ const renderFormItemList = (inputElement) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Form.List, {
720
+ name: computedProps.name,
721
+ rules: computedProps.rules,
722
+ children: (fields, { add, remove }, { errors }) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
723
+ computedProps.label && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
724
+ className: "ant-form-item-label",
725
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("label", {
726
+ className: (computedProps.rules || []).find((r) => r.required) && "ant-form-item-required",
727
+ children: computedProps.label
728
+ })
729
+ }),
730
+ fields.map((field) => {
731
+ const { key, ...fieldProps } = field;
732
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Form.Item, {
733
+ id: key.toString(),
734
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(antd.Row, {
735
+ gutter: 24,
736
+ style: { flexFlow: "row nowrap" },
737
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Col, {
738
+ span: 23,
739
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Form.Item, {
740
+ ...fieldProps,
741
+ noStyle: true,
742
+ children: inputElement
743
+ })
744
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Col, {
745
+ span: 1,
746
+ children: !computedProps.input?.disabled && (!(computedProps.rules || []).find((r) => r.required) || key > 0) && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Button, {
747
+ danger: true,
748
+ type: "link",
749
+ style: { float: "right" },
750
+ icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_ant_design_icons.MinusCircleOutlined, {}),
751
+ onClick: () => remove(field.name)
752
+ })
753
+ })]
754
+ })
755
+ }, key);
756
+ }),
757
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(antd.Form.Item, { children: [
758
+ !computedProps.input?.disabled && (!computedProps.maxCount || computedProps.maxCount > fields.length) && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Button, {
759
+ type: "dashed",
760
+ block: true,
761
+ onClick: () => add(),
762
+ icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_ant_design_icons.PlusOutlined, {})
763
+ }),
764
+ computedProps.extra && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
765
+ className: "ant-form-item-extra",
766
+ children: computedProps.extra
767
+ }),
768
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Form.ErrorList, { errors })
769
+ ] })
770
+ ] })
771
+ });
719
772
  switch (itemType) {
720
773
  case "string":
721
774
  if (isOptionsProps(computedProps)) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Form.Item, {
@@ -737,59 +790,7 @@ function FormItem(props) {
737
790
  ...computedProps.input
738
791
  })
739
792
  });
740
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Form.List, {
741
- name: computedProps.name,
742
- rules: computedProps.rules,
743
- children: (fields, { add, remove }, { errors }) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
744
- computedProps.label && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
745
- className: "ant-form-item-label",
746
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("label", {
747
- className: (computedProps.rules || []).find((r) => r.required) && "ant-form-item-required",
748
- children: computedProps.label
749
- })
750
- }),
751
- fields.map((field) => {
752
- const { key, ...fieldProps } = field;
753
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Form.Item, {
754
- id: key.toString(),
755
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(antd.Row, {
756
- gutter: 24,
757
- style: { flexFlow: "row nowrap" },
758
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Col, {
759
- span: 23,
760
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Form.Item, {
761
- ...fieldProps,
762
- noStyle: true,
763
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Input, { ...computedProps.input })
764
- })
765
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Col, {
766
- span: 1,
767
- children: !computedProps.input?.disabled && (!(computedProps.rules || []).find((r) => r.required) || key > 0) && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Button, {
768
- danger: true,
769
- type: "link",
770
- style: { float: "right" },
771
- icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_ant_design_icons.MinusCircleOutlined, {}),
772
- onClick: () => remove(field.name)
773
- })
774
- })]
775
- })
776
- }, key);
777
- }),
778
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(antd.Form.Item, { children: [
779
- !computedProps.input?.disabled && (!computedProps.maxCount || computedProps.maxCount > fields.length) && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Button, {
780
- type: "dashed",
781
- block: true,
782
- onClick: () => add(),
783
- icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_ant_design_icons.PlusOutlined, {})
784
- }),
785
- computedProps.extra && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
786
- className: "ant-form-item-extra",
787
- children: computedProps.extra
788
- }),
789
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Form.ErrorList, { errors })
790
- ] })
791
- ] })
792
- });
793
+ return renderFormItemList(/* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Input, { ...computedProps.input }));
793
794
  case "number":
794
795
  if (isOptionsProps(computedProps)) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Form.Item, {
795
796
  ...computedProps,
@@ -813,62 +814,10 @@ function FormItem(props) {
813
814
  ...computedProps.input
814
815
  })
815
816
  });
816
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Form.List, {
817
- name: computedProps.name,
818
- rules: computedProps.rules,
819
- children: (fields, { add, remove }, { errors }) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
820
- computedProps.label && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
821
- className: "ant-form-item-label",
822
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("label", {
823
- className: computedProps.rules?.find((r) => r.required) && "ant-form-item-required",
824
- children: computedProps.label
825
- })
826
- }),
827
- fields.map((field) => {
828
- const { key, ...fieldProps } = field;
829
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Form.Item, {
830
- id: key.toString(),
831
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(antd.Row, {
832
- gutter: 24,
833
- style: { flexFlow: "row nowrap" },
834
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Col, {
835
- span: 23,
836
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Form.Item, {
837
- ...fieldProps,
838
- noStyle: true,
839
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.InputNumber, {
840
- style: { width: "100%" },
841
- ...computedProps.input
842
- })
843
- })
844
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Col, {
845
- span: 1,
846
- children: !computedProps.input?.disabled && (!(computedProps.rules || []).find((r) => r.required) || key > 0) && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Button, {
847
- danger: true,
848
- type: "link",
849
- style: { float: "right" },
850
- icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_ant_design_icons.MinusCircleOutlined, {}),
851
- onClick: () => remove(field.name)
852
- })
853
- })]
854
- })
855
- }, key);
856
- }),
857
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(antd.Form.Item, { children: [
858
- !computedProps.input?.disabled && (!computedProps.maxCount || computedProps.maxCount > fields.length) && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Button, {
859
- type: "dashed",
860
- block: true,
861
- onClick: () => add(),
862
- icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_ant_design_icons.PlusOutlined, {})
863
- }),
864
- computedProps.extra && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
865
- className: "ant-form-item-extra",
866
- children: computedProps.extra
867
- }),
868
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Form.ErrorList, { errors })
869
- ] })
870
- ] })
871
- });
817
+ return renderFormItemList(/* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.InputNumber, {
818
+ style: { width: "100%" },
819
+ ...computedProps.input
820
+ }));
872
821
  case "boolean": return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Form.Item, {
873
822
  ...computedProps,
874
823
  id: computedProps.id.toString(),
@@ -1242,6 +1191,18 @@ function Table(props) {
1242
1191
  };
1243
1192
  (0, react.useEffect)(() => {
1244
1193
  const items = (0, lodash_es.cloneDeep)(props.items).filter((item) => !(item.tableChildren === null || item.children === null || item.tableRender === null || item.render === null));
1194
+ const createTextSearchFilterDropdown = (item, transformValue) => ({ setSelectedKeys, confirm, clearFilters }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Input.Search, {
1195
+ placeholder: `${theme.common.search} ${item.title}`,
1196
+ allowClear: true,
1197
+ onSearch: (v) => {
1198
+ if (v) setSelectedKeys(transformValue ? [transformValue(v)] : [v]);
1199
+ else {
1200
+ setSelectedKeys([]);
1201
+ clearFilters?.();
1202
+ }
1203
+ confirm();
1204
+ }
1205
+ });
1245
1206
  for (const item of items) {
1246
1207
  if (!item.key) item.key = item.id;
1247
1208
  if (!item.dataIndex) item.dataIndex = item.id;
@@ -1302,18 +1263,7 @@ function Table(props) {
1302
1263
  if ((0, lodash_es.isNil)(row[item.id])) return false;
1303
1264
  return row[item.id].trim().toLowerCase().includes(value.trim().toLowerCase());
1304
1265
  };
1305
- if (typeof item.filterDropdown === "undefined" && !item.filters && item.optionsType !== "auto") item.filterDropdown = ({ setSelectedKeys, confirm, clearFilters }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Input.Search, {
1306
- placeholder: `${theme.common.search} ${item.title}`,
1307
- allowClear: true,
1308
- onSearch: (v) => {
1309
- if (v) setSelectedKeys([v]);
1310
- else {
1311
- setSelectedKeys([]);
1312
- clearFilters?.();
1313
- }
1314
- confirm();
1315
- }
1316
- });
1266
+ if (typeof item.filterDropdown === "undefined" && !item.filters && item.optionsType !== "auto") item.filterDropdown = createTextSearchFilterDropdown(item);
1317
1267
  }
1318
1268
  break;
1319
1269
  case "string[]":
@@ -1324,18 +1274,7 @@ function Table(props) {
1324
1274
  if (!row[item.id] || !row[item.id].length || !value) return false;
1325
1275
  return row[item.id].some((v) => v.trim().toLowerCase().includes(value.trim().toLowerCase()));
1326
1276
  };
1327
- if (typeof item.filterDropdown === "undefined" && !item.filters && item.optionsType !== "auto") item.filterDropdown = ({ setSelectedKeys, confirm, clearFilters }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Input.Search, {
1328
- placeholder: `${theme.common.search} ${item.title}`,
1329
- allowClear: true,
1330
- onSearch: (v) => {
1331
- if (v) setSelectedKeys([v]);
1332
- else {
1333
- setSelectedKeys([]);
1334
- clearFilters?.();
1335
- }
1336
- confirm();
1337
- }
1338
- });
1277
+ if (typeof item.filterDropdown === "undefined" && !item.filters && item.optionsType !== "auto") item.filterDropdown = createTextSearchFilterDropdown(item);
1339
1278
  }
1340
1279
  break;
1341
1280
  case "number":
@@ -1347,18 +1286,7 @@ function Table(props) {
1347
1286
  if ((0, lodash_es.isNil)(row[item.id])) return false;
1348
1287
  return value == row[item.id];
1349
1288
  };
1350
- if (typeof item.filterDropdown === "undefined" && !item.filters) item.filterDropdown = ({ setSelectedKeys, confirm, clearFilters }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Input.Search, {
1351
- placeholder: `${theme.common.search} ${item.title}`,
1352
- allowClear: true,
1353
- onSearch: (v) => {
1354
- if (v) setSelectedKeys([Number(v)]);
1355
- else {
1356
- setSelectedKeys([]);
1357
- clearFilters?.();
1358
- }
1359
- confirm();
1360
- }
1361
- });
1289
+ if (typeof item.filterDropdown === "undefined" && !item.filters) item.filterDropdown = createTextSearchFilterDropdown(item, Number);
1362
1290
  }
1363
1291
  break;
1364
1292
  case "number[]":
@@ -1369,18 +1297,7 @@ function Table(props) {
1369
1297
  if (!row[item.id] || !row[item.id].length) return false;
1370
1298
  return row[item.id].includes(Number(value));
1371
1299
  };
1372
- if (typeof item.filterDropdown === "undefined" && !item.filters) item.filterDropdown = ({ setSelectedKeys, confirm, clearFilters }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Input.Search, {
1373
- placeholder: `${theme.common.search} ${item.title}`,
1374
- allowClear: true,
1375
- onSearch: (v) => {
1376
- if (v) setSelectedKeys([Number(v)]);
1377
- else {
1378
- setSelectedKeys([]);
1379
- clearFilters?.();
1380
- }
1381
- confirm();
1382
- }
1383
- });
1300
+ if (typeof item.filterDropdown === "undefined" && !item.filters) item.filterDropdown = createTextSearchFilterDropdown(item, Number);
1384
1301
  }
1385
1302
  break;
1386
1303
  case "boolean":
@@ -1436,26 +1353,8 @@ function Table(props) {
1436
1353
  }
1437
1354
  break;
1438
1355
  case "date":
1439
- if (!item.render) item.render = (value) => processValue(item, value);
1440
- if (typeof item.sorter === "undefined") item.sorter = (a, b, order) => {
1441
- if ((0, lodash_es.isNil)(a[item.id])) return order === "ascend" ? 1 : -1;
1442
- if ((0, lodash_es.isNil)(b[item.id])) return order === "ascend" ? -1 : 1;
1443
- return new Date(a[item.id]).getTime() < new Date(b[item.id]).getTime() ? -1 : 1;
1444
- };
1445
- if (item.filterDropdown !== false) {
1446
- if (typeof item.filterDropdown === "undefined") item.filterDropdown = ({ setSelectedKeys, confirm }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.DatePicker.RangePicker, { onChange: (dates) => {
1447
- setSelectedKeys(dates?.[0] && dates[1] ? [[dates[0].startOf("day").toISOString(), dates[1].endOf("day").toISOString()]] : []);
1448
- confirm();
1449
- } });
1450
- if (!item.onFilter && !props.faasData) item.onFilter = (value, row) => {
1451
- if ((0, lodash_es.isNil)(value[0])) return true;
1452
- if ((0, lodash_es.isNil)(row[item.id])) return false;
1453
- return (0, dayjs.default)(row[item.id]) >= (0, dayjs.default)(value[0]) && (0, dayjs.default)(row[item.id]) <= (0, dayjs.default)(value[1]);
1454
- };
1455
- }
1456
- break;
1457
1356
  case "time":
1458
- item.width = item.width ?? 200;
1357
+ if (itemType === "time") item.width = item.width ?? 200;
1459
1358
  if (!item.render) item.render = (value) => processValue(item, value);
1460
1359
  if (typeof item.sorter === "undefined") item.sorter = (a, b, order) => {
1461
1360
  if ((0, lodash_es.isNil)(a[item.id])) return order === "ascend" ? 1 : -1;
package/dist/index.mjs CHANGED
@@ -687,6 +687,59 @@ function FormItem(props) {
687
687
  id: computedProps.id.toString(),
688
688
  children: cloneUnionFaasItemElement(extendType.children, { scene: "form" })
689
689
  });
690
+ const renderFormItemList = (inputElement) => /* @__PURE__ */ jsx(Form$1.List, {
691
+ name: computedProps.name,
692
+ rules: computedProps.rules,
693
+ children: (fields, { add, remove }, { errors }) => /* @__PURE__ */ jsxs(Fragment, { children: [
694
+ computedProps.label && /* @__PURE__ */ jsx("div", {
695
+ className: "ant-form-item-label",
696
+ children: /* @__PURE__ */ jsx("label", {
697
+ className: (computedProps.rules || []).find((r) => r.required) && "ant-form-item-required",
698
+ children: computedProps.label
699
+ })
700
+ }),
701
+ fields.map((field) => {
702
+ const { key, ...fieldProps } = field;
703
+ return /* @__PURE__ */ jsx(Form$1.Item, {
704
+ id: key.toString(),
705
+ children: /* @__PURE__ */ jsxs(Row, {
706
+ gutter: 24,
707
+ style: { flexFlow: "row nowrap" },
708
+ children: [/* @__PURE__ */ jsx(Col, {
709
+ span: 23,
710
+ children: /* @__PURE__ */ jsx(Form$1.Item, {
711
+ ...fieldProps,
712
+ noStyle: true,
713
+ children: inputElement
714
+ })
715
+ }), /* @__PURE__ */ jsx(Col, {
716
+ span: 1,
717
+ children: !computedProps.input?.disabled && (!(computedProps.rules || []).find((r) => r.required) || key > 0) && /* @__PURE__ */ jsx(Button, {
718
+ danger: true,
719
+ type: "link",
720
+ style: { float: "right" },
721
+ icon: /* @__PURE__ */ jsx(MinusCircleOutlined, {}),
722
+ onClick: () => remove(field.name)
723
+ })
724
+ })]
725
+ })
726
+ }, key);
727
+ }),
728
+ /* @__PURE__ */ jsxs(Form$1.Item, { children: [
729
+ !computedProps.input?.disabled && (!computedProps.maxCount || computedProps.maxCount > fields.length) && /* @__PURE__ */ jsx(Button, {
730
+ type: "dashed",
731
+ block: true,
732
+ onClick: () => add(),
733
+ icon: /* @__PURE__ */ jsx(PlusOutlined, {})
734
+ }),
735
+ computedProps.extra && /* @__PURE__ */ jsx("div", {
736
+ className: "ant-form-item-extra",
737
+ children: computedProps.extra
738
+ }),
739
+ /* @__PURE__ */ jsx(Form$1.ErrorList, { errors })
740
+ ] })
741
+ ] })
742
+ });
690
743
  switch (itemType) {
691
744
  case "string":
692
745
  if (isOptionsProps(computedProps)) return /* @__PURE__ */ jsx(Form$1.Item, {
@@ -708,59 +761,7 @@ function FormItem(props) {
708
761
  ...computedProps.input
709
762
  })
710
763
  });
711
- return /* @__PURE__ */ jsx(Form$1.List, {
712
- name: computedProps.name,
713
- rules: computedProps.rules,
714
- children: (fields, { add, remove }, { errors }) => /* @__PURE__ */ jsxs(Fragment, { children: [
715
- computedProps.label && /* @__PURE__ */ jsx("div", {
716
- className: "ant-form-item-label",
717
- children: /* @__PURE__ */ jsx("label", {
718
- className: (computedProps.rules || []).find((r) => r.required) && "ant-form-item-required",
719
- children: computedProps.label
720
- })
721
- }),
722
- fields.map((field) => {
723
- const { key, ...fieldProps } = field;
724
- return /* @__PURE__ */ jsx(Form$1.Item, {
725
- id: key.toString(),
726
- children: /* @__PURE__ */ jsxs(Row, {
727
- gutter: 24,
728
- style: { flexFlow: "row nowrap" },
729
- children: [/* @__PURE__ */ jsx(Col, {
730
- span: 23,
731
- children: /* @__PURE__ */ jsx(Form$1.Item, {
732
- ...fieldProps,
733
- noStyle: true,
734
- children: /* @__PURE__ */ jsx(Input, { ...computedProps.input })
735
- })
736
- }), /* @__PURE__ */ jsx(Col, {
737
- span: 1,
738
- children: !computedProps.input?.disabled && (!(computedProps.rules || []).find((r) => r.required) || key > 0) && /* @__PURE__ */ jsx(Button, {
739
- danger: true,
740
- type: "link",
741
- style: { float: "right" },
742
- icon: /* @__PURE__ */ jsx(MinusCircleOutlined, {}),
743
- onClick: () => remove(field.name)
744
- })
745
- })]
746
- })
747
- }, key);
748
- }),
749
- /* @__PURE__ */ jsxs(Form$1.Item, { children: [
750
- !computedProps.input?.disabled && (!computedProps.maxCount || computedProps.maxCount > fields.length) && /* @__PURE__ */ jsx(Button, {
751
- type: "dashed",
752
- block: true,
753
- onClick: () => add(),
754
- icon: /* @__PURE__ */ jsx(PlusOutlined, {})
755
- }),
756
- computedProps.extra && /* @__PURE__ */ jsx("div", {
757
- className: "ant-form-item-extra",
758
- children: computedProps.extra
759
- }),
760
- /* @__PURE__ */ jsx(Form$1.ErrorList, { errors })
761
- ] })
762
- ] })
763
- });
764
+ return renderFormItemList(/* @__PURE__ */ jsx(Input, { ...computedProps.input }));
764
765
  case "number":
765
766
  if (isOptionsProps(computedProps)) return /* @__PURE__ */ jsx(Form$1.Item, {
766
767
  ...computedProps,
@@ -784,62 +785,10 @@ function FormItem(props) {
784
785
  ...computedProps.input
785
786
  })
786
787
  });
787
- return /* @__PURE__ */ jsx(Form$1.List, {
788
- name: computedProps.name,
789
- rules: computedProps.rules,
790
- children: (fields, { add, remove }, { errors }) => /* @__PURE__ */ jsxs(Fragment, { children: [
791
- computedProps.label && /* @__PURE__ */ jsx("div", {
792
- className: "ant-form-item-label",
793
- children: /* @__PURE__ */ jsx("label", {
794
- className: computedProps.rules?.find((r) => r.required) && "ant-form-item-required",
795
- children: computedProps.label
796
- })
797
- }),
798
- fields.map((field) => {
799
- const { key, ...fieldProps } = field;
800
- return /* @__PURE__ */ jsx(Form$1.Item, {
801
- id: key.toString(),
802
- children: /* @__PURE__ */ jsxs(Row, {
803
- gutter: 24,
804
- style: { flexFlow: "row nowrap" },
805
- children: [/* @__PURE__ */ jsx(Col, {
806
- span: 23,
807
- children: /* @__PURE__ */ jsx(Form$1.Item, {
808
- ...fieldProps,
809
- noStyle: true,
810
- children: /* @__PURE__ */ jsx(InputNumber, {
811
- style: { width: "100%" },
812
- ...computedProps.input
813
- })
814
- })
815
- }), /* @__PURE__ */ jsx(Col, {
816
- span: 1,
817
- children: !computedProps.input?.disabled && (!(computedProps.rules || []).find((r) => r.required) || key > 0) && /* @__PURE__ */ jsx(Button, {
818
- danger: true,
819
- type: "link",
820
- style: { float: "right" },
821
- icon: /* @__PURE__ */ jsx(MinusCircleOutlined, {}),
822
- onClick: () => remove(field.name)
823
- })
824
- })]
825
- })
826
- }, key);
827
- }),
828
- /* @__PURE__ */ jsxs(Form$1.Item, { children: [
829
- !computedProps.input?.disabled && (!computedProps.maxCount || computedProps.maxCount > fields.length) && /* @__PURE__ */ jsx(Button, {
830
- type: "dashed",
831
- block: true,
832
- onClick: () => add(),
833
- icon: /* @__PURE__ */ jsx(PlusOutlined, {})
834
- }),
835
- computedProps.extra && /* @__PURE__ */ jsx("div", {
836
- className: "ant-form-item-extra",
837
- children: computedProps.extra
838
- }),
839
- /* @__PURE__ */ jsx(Form$1.ErrorList, { errors })
840
- ] })
841
- ] })
842
- });
788
+ return renderFormItemList(/* @__PURE__ */ jsx(InputNumber, {
789
+ style: { width: "100%" },
790
+ ...computedProps.input
791
+ }));
843
792
  case "boolean": return /* @__PURE__ */ jsx(Form$1.Item, {
844
793
  ...computedProps,
845
794
  id: computedProps.id.toString(),
@@ -1213,6 +1162,18 @@ function Table(props) {
1213
1162
  };
1214
1163
  useEffect(() => {
1215
1164
  const items = cloneDeep(props.items).filter((item) => !(item.tableChildren === null || item.children === null || item.tableRender === null || item.render === null));
1165
+ const createTextSearchFilterDropdown = (item, transformValue) => ({ setSelectedKeys, confirm, clearFilters }) => /* @__PURE__ */ jsx(Input.Search, {
1166
+ placeholder: `${theme.common.search} ${item.title}`,
1167
+ allowClear: true,
1168
+ onSearch: (v) => {
1169
+ if (v) setSelectedKeys(transformValue ? [transformValue(v)] : [v]);
1170
+ else {
1171
+ setSelectedKeys([]);
1172
+ clearFilters?.();
1173
+ }
1174
+ confirm();
1175
+ }
1176
+ });
1216
1177
  for (const item of items) {
1217
1178
  if (!item.key) item.key = item.id;
1218
1179
  if (!item.dataIndex) item.dataIndex = item.id;
@@ -1273,18 +1234,7 @@ function Table(props) {
1273
1234
  if (isNil(row[item.id])) return false;
1274
1235
  return row[item.id].trim().toLowerCase().includes(value.trim().toLowerCase());
1275
1236
  };
1276
- if (typeof item.filterDropdown === "undefined" && !item.filters && item.optionsType !== "auto") item.filterDropdown = ({ setSelectedKeys, confirm, clearFilters }) => /* @__PURE__ */ jsx(Input.Search, {
1277
- placeholder: `${theme.common.search} ${item.title}`,
1278
- allowClear: true,
1279
- onSearch: (v) => {
1280
- if (v) setSelectedKeys([v]);
1281
- else {
1282
- setSelectedKeys([]);
1283
- clearFilters?.();
1284
- }
1285
- confirm();
1286
- }
1287
- });
1237
+ if (typeof item.filterDropdown === "undefined" && !item.filters && item.optionsType !== "auto") item.filterDropdown = createTextSearchFilterDropdown(item);
1288
1238
  }
1289
1239
  break;
1290
1240
  case "string[]":
@@ -1295,18 +1245,7 @@ function Table(props) {
1295
1245
  if (!row[item.id] || !row[item.id].length || !value) return false;
1296
1246
  return row[item.id].some((v) => v.trim().toLowerCase().includes(value.trim().toLowerCase()));
1297
1247
  };
1298
- if (typeof item.filterDropdown === "undefined" && !item.filters && item.optionsType !== "auto") item.filterDropdown = ({ setSelectedKeys, confirm, clearFilters }) => /* @__PURE__ */ jsx(Input.Search, {
1299
- placeholder: `${theme.common.search} ${item.title}`,
1300
- allowClear: true,
1301
- onSearch: (v) => {
1302
- if (v) setSelectedKeys([v]);
1303
- else {
1304
- setSelectedKeys([]);
1305
- clearFilters?.();
1306
- }
1307
- confirm();
1308
- }
1309
- });
1248
+ if (typeof item.filterDropdown === "undefined" && !item.filters && item.optionsType !== "auto") item.filterDropdown = createTextSearchFilterDropdown(item);
1310
1249
  }
1311
1250
  break;
1312
1251
  case "number":
@@ -1318,18 +1257,7 @@ function Table(props) {
1318
1257
  if (isNil(row[item.id])) return false;
1319
1258
  return value == row[item.id];
1320
1259
  };
1321
- if (typeof item.filterDropdown === "undefined" && !item.filters) item.filterDropdown = ({ setSelectedKeys, confirm, clearFilters }) => /* @__PURE__ */ jsx(Input.Search, {
1322
- placeholder: `${theme.common.search} ${item.title}`,
1323
- allowClear: true,
1324
- onSearch: (v) => {
1325
- if (v) setSelectedKeys([Number(v)]);
1326
- else {
1327
- setSelectedKeys([]);
1328
- clearFilters?.();
1329
- }
1330
- confirm();
1331
- }
1332
- });
1260
+ if (typeof item.filterDropdown === "undefined" && !item.filters) item.filterDropdown = createTextSearchFilterDropdown(item, Number);
1333
1261
  }
1334
1262
  break;
1335
1263
  case "number[]":
@@ -1340,18 +1268,7 @@ function Table(props) {
1340
1268
  if (!row[item.id] || !row[item.id].length) return false;
1341
1269
  return row[item.id].includes(Number(value));
1342
1270
  };
1343
- if (typeof item.filterDropdown === "undefined" && !item.filters) item.filterDropdown = ({ setSelectedKeys, confirm, clearFilters }) => /* @__PURE__ */ jsx(Input.Search, {
1344
- placeholder: `${theme.common.search} ${item.title}`,
1345
- allowClear: true,
1346
- onSearch: (v) => {
1347
- if (v) setSelectedKeys([Number(v)]);
1348
- else {
1349
- setSelectedKeys([]);
1350
- clearFilters?.();
1351
- }
1352
- confirm();
1353
- }
1354
- });
1271
+ if (typeof item.filterDropdown === "undefined" && !item.filters) item.filterDropdown = createTextSearchFilterDropdown(item, Number);
1355
1272
  }
1356
1273
  break;
1357
1274
  case "boolean":
@@ -1407,26 +1324,8 @@ function Table(props) {
1407
1324
  }
1408
1325
  break;
1409
1326
  case "date":
1410
- if (!item.render) item.render = (value) => processValue(item, value);
1411
- if (typeof item.sorter === "undefined") item.sorter = (a, b, order) => {
1412
- if (isNil(a[item.id])) return order === "ascend" ? 1 : -1;
1413
- if (isNil(b[item.id])) return order === "ascend" ? -1 : 1;
1414
- return new Date(a[item.id]).getTime() < new Date(b[item.id]).getTime() ? -1 : 1;
1415
- };
1416
- if (item.filterDropdown !== false) {
1417
- if (typeof item.filterDropdown === "undefined") item.filterDropdown = ({ setSelectedKeys, confirm }) => /* @__PURE__ */ jsx(DatePicker.RangePicker, { onChange: (dates) => {
1418
- setSelectedKeys(dates?.[0] && dates[1] ? [[dates[0].startOf("day").toISOString(), dates[1].endOf("day").toISOString()]] : []);
1419
- confirm();
1420
- } });
1421
- if (!item.onFilter && !props.faasData) item.onFilter = (value, row) => {
1422
- if (isNil(value[0])) return true;
1423
- if (isNil(row[item.id])) return false;
1424
- return dayjs(row[item.id]) >= dayjs(value[0]) && dayjs(row[item.id]) <= dayjs(value[1]);
1425
- };
1426
- }
1427
- break;
1428
1327
  case "time":
1429
- item.width = item.width ?? 200;
1328
+ if (itemType === "time") item.width = item.width ?? 200;
1430
1329
  if (!item.render) item.render = (value) => processValue(item, value);
1431
1330
  if (typeof item.sorter === "undefined") item.sorter = (a, b, order) => {
1432
1331
  if (isNil(a[item.id])) return order === "ascend" ? 1 : -1;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@faasjs/ant-design",
3
- "version": "8.0.0-beta.11",
3
+ "version": "8.0.0-beta.13",
4
4
  "homepage": "https://faasjs.com/doc/ant-design",
5
5
  "bugs": {
6
6
  "url": "https://github.com/faasjs/faasjs/issues"
@@ -31,7 +31,7 @@
31
31
  },
32
32
  "devDependencies": {
33
33
  "@ant-design/icons": "*",
34
- "@faasjs/react": ">=8.0.0-beta.11",
34
+ "@faasjs/react": ">=8.0.0-beta.13",
35
35
  "@types/lodash-es": "*",
36
36
  "@types/react": "^19.0.0",
37
37
  "@types/react-dom": "^19.0.0",
@@ -43,7 +43,7 @@
43
43
  },
44
44
  "peerDependencies": {
45
45
  "@ant-design/icons": "*",
46
- "@faasjs/react": ">=8.0.0-beta.11",
46
+ "@faasjs/react": ">=8.0.0-beta.13",
47
47
  "antd": "^6.0.0",
48
48
  "lodash-es": "*",
49
49
  "react": "^19.0.0",