@ecoding/components.antd 0.5.13 → 0.5.14

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.
@@ -8,6 +8,7 @@ interface IC {
8
8
  name?: string;
9
9
  rules?: any;
10
10
  width?: number;
11
+ valuePropName?: string;
11
12
  noStyleHidden?: boolean;
12
13
  hideRemove?: boolean | ((field: FormListFieldData, index: number) => boolean);
13
14
  render?: (field: FormListFieldData, index: number, { add, remove }: {
@@ -5,7 +5,7 @@ import { DndContext, closestCenter, PointerSensor, useSensor, useSensors } from
5
5
  import { SortableContext, verticalListSortingStrategy, useSortable } from '@dnd-kit/sortable';
6
6
  import { CSS } from '@dnd-kit/utilities';
7
7
  const SortableItem = (props) => {
8
- const { columns, i18n, field, index, add, remove, afterRemove, enableSort, disabled } = props;
8
+ const { columns, i18n, field, index, add, remove, afterRemove, enableSort, disabled, operation } = props;
9
9
  const { attributes, listeners, setNodeRef, transform, transition, isDragging } = useSortable({
10
10
  id: props.id
11
11
  });
@@ -46,6 +46,9 @@ const SortableItem = (props) => {
46
46
  index + 1)),
47
47
  columns.map((column, i) => {
48
48
  if (column.type == "operation") {
49
+ if (operation === null || operation === void 0 ? void 0 : operation.hide) {
50
+ return null;
51
+ }
49
52
  return (React.createElement("td", { style: Object.assign({}, tdStyle, { right: 0, zIndex: 10, position: "sticky", backgroundColor: "#fff" }) },
50
53
  React.createElement(Space, null,
51
54
  column.render && column.render(field, index, { add, remove }),
@@ -60,13 +63,13 @@ const SortableItem = (props) => {
60
63
  else {
61
64
  if (column.noStyleHidden) {
62
65
  return (React.createElement("td", { style: { display: "none" } },
63
- React.createElement(Form.Item, { noStyle: true, hidden: true, name: [field.name, column.name] }, column.render(field, index, { add, remove }))));
66
+ React.createElement(Form.Item, { noStyle: true, hidden: true, name: [field.name, column.name], valuePropName: column.valuePropName ? column.valuePropName : undefined }, column.render(field, index, { add, remove }))));
64
67
  }
65
68
  return (React.createElement("td", { style: tdStyle },
66
- React.createElement(Form.Item, { style: { marginBottom: 0 }, name: [field.name, column.name], rules: column.rules || [] }, column.render(field, index, { add, remove }))));
69
+ React.createElement(Form.Item, { style: { marginBottom: 0 }, name: [field.name, column.name], rules: column.rules || [], valuePropName: column.valuePropName ? column.valuePropName : undefined }, column.render(field, index, { add, remove }))));
67
70
  }
68
71
  }),
69
- needDefaultOperation ? (React.createElement("td", { style: Object.assign({}, tdStyle, { right: 0, zIndex: 10, position: "sticky", backgroundColor: "#fff" }) },
72
+ needDefaultOperation && (operation === null || operation === void 0 ? void 0 : operation.hide) != true ? (React.createElement("td", { style: Object.assign({}, tdStyle, { right: 0, zIndex: 10, position: "sticky", backgroundColor: "#fff" }) },
70
73
  React.createElement(Typography.Text, { style: disabled ? { cursor: 'no-drop', 'color': '#ccc' } : { cursor: 'pointer' }, type: disabled ? undefined : "danger", onClick: () => {
71
74
  if (disabled) {
72
75
  return;
@@ -94,12 +97,9 @@ const C = ({ columns, rules, tStyle, name, hideHeader, hideBottom, operation, i1
94
97
  }
95
98
  w += column.width || 200;
96
99
  });
97
- if (operation) {
100
+ if (operation && operation.hide != true) {
98
101
  w += operation.width || 150;
99
102
  }
100
- else {
101
- w += 150;
102
- }
103
103
  return w;
104
104
  }, []);
105
105
  return (React.createElement(Form.List, { name: name, rules: rules || [] }, (fields, { add, remove, move }, { errors }) => {
@@ -143,7 +143,7 @@ const C = ({ columns, rules, tStyle, name, hideHeader, hideBottom, operation, i1
143
143
  }
144
144
  } },
145
145
  React.createElement(SortableContext, { items: fields.map(field => field.key), strategy: verticalListSortingStrategy }, fields.map((field, index) => {
146
- return (React.createElement(SortableItem, { columns: columns, index: index, key: field.key, disabled: disabled, id: field.key, i18n: i18n, field: field, add: add, remove: remove, afterRemove: afterRemove, enableSort: enableSort }));
146
+ return (React.createElement(SortableItem, { columns: columns, index: index, key: field.key, operation: operation, disabled: disabled, id: field.key, i18n: i18n, field: field, add: add, remove: remove, afterRemove: afterRemove, enableSort: enableSort }));
147
147
  })))))),
148
148
  hideBottom || disabled ? null : (React.createElement("div", null,
149
149
  React.createElement(Button, { icon: React.createElement(PlusCircleOutlined, null), type: "dashed", onClick: () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ecoding/components.antd",
3
- "version": "0.5.13",
3
+ "version": "0.5.14",
4
4
  "author": "cxc",
5
5
  "homepage": "",
6
6
  "license": "MIT",
@@ -47,5 +47,5 @@
47
47
  "antd": "^6.0.0",
48
48
  "axios": "^1.1.2"
49
49
  },
50
- "gitHead": "a73723a7c6aa1749992046e5a13ae83523fc07a9"
50
+ "gitHead": "63dbd74fd806139370f6f812cc712756866283ff"
51
51
  }