@cloudtower/eagle 0.33.24 → 0.33.25

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.
@@ -48,7 +48,7 @@ const AddRowButton = (props) => {
48
48
  const {
49
49
  config: { maximum, className, CustomizedButton, buttonProps, text },
50
50
  columns,
51
- updateData,
51
+ addData,
52
52
  data
53
53
  } = props;
54
54
  const { t } = useParrotTranslation();
@@ -63,7 +63,7 @@ const AddRowButton = (props) => {
63
63
  const newData = [...data2];
64
64
  const newRow = utils.genEmptyRow(columns);
65
65
  newData.push(newRow);
66
- updateData(newData);
66
+ addData(newData);
67
67
  onClick == null ? void 0 : onClick(e);
68
68
  };
69
69
  const disabled = React.useMemo(
@@ -52,6 +52,7 @@ const TableForm = React__default.default.forwardRef(
52
52
  onHeaderChange,
53
53
  onHeaderBlur,
54
54
  onBodyChange,
55
+ onBodyAdd,
55
56
  onBodyBlur,
56
57
  row,
57
58
  errors,
@@ -72,6 +73,16 @@ const TableForm = React__default.default.forwardRef(
72
73
  },
73
74
  [onBodyChange]
74
75
  );
76
+ const addData = React.useCallback(
77
+ (value) => {
78
+ setLatestData(value);
79
+ setData(value);
80
+ onBodyChange == null ? void 0 : onBodyChange(value);
81
+ const rowIndex = value.length - 1;
82
+ onBodyAdd == null ? void 0 : onBodyAdd(value, rowIndex);
83
+ },
84
+ [onBodyChange, onBodyAdd]
85
+ );
75
86
  const handleBatchChange = React.useCallback(
76
87
  (newData, columnKey, shouldUpdateData) => {
77
88
  setLatestData(newData);
@@ -84,19 +95,19 @@ const TableForm = React__default.default.forwardRef(
84
95
  [onHeaderChange, onBodyChange]
85
96
  );
86
97
  const handleBatchBlur = React.useCallback(
87
- (key, error) => {
98
+ (columnKey, error) => {
88
99
  if (error) {
89
100
  const newData = latestData.map((cell) => {
90
101
  return __spreadProps(__spreadValues({}, cell), {
91
- [key]: ""
102
+ [columnKey]: ""
92
103
  });
93
104
  });
94
105
  setLatestData(newData);
95
- onHeaderBlur == null ? void 0 : onHeaderBlur(newData);
106
+ onHeaderBlur == null ? void 0 : onHeaderBlur(newData, columnKey);
96
107
  } else {
97
108
  setData(latestData);
98
- onBodyChange == null ? void 0 : onBodyChange(latestData, void 0, key);
99
- onHeaderBlur == null ? void 0 : onHeaderBlur(latestData);
109
+ onBodyChange == null ? void 0 : onBodyChange(latestData, void 0, columnKey);
110
+ onHeaderBlur == null ? void 0 : onHeaderBlur(latestData, columnKey);
100
111
  }
101
112
  },
102
113
  [latestData, onHeaderBlur, onBodyChange]
@@ -107,6 +118,10 @@ const TableForm = React__default.default.forwardRef(
107
118
  setData: (data2) => {
108
119
  updateData(data2);
109
120
  },
121
+ setDataWithoutTriggerChange: (data2) => {
122
+ setLatestData(data2);
123
+ setData(data2);
124
+ },
110
125
  validateWholeFields() {
111
126
  formValidMapRef.current = {};
112
127
  setValidateAll(true);
@@ -185,7 +200,7 @@ const TableForm = React__default.default.forwardRef(
185
200
  AddRowButton,
186
201
  {
187
202
  config: rowAddConfig,
188
- updateData,
203
+ addData,
189
204
  columns,
190
205
  data
191
206
  }