@cloudtower/eagle 0.33.24 → 0.33.26

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.
@@ -42,7 +42,7 @@ const AddRowButton = (props) => {
42
42
  const {
43
43
  config: { maximum, className, CustomizedButton, buttonProps, text },
44
44
  columns,
45
- updateData,
45
+ addData,
46
46
  data
47
47
  } = props;
48
48
  const { t } = useParrotTranslation();
@@ -57,7 +57,7 @@ const AddRowButton = (props) => {
57
57
  const newData = [...data2];
58
58
  const newRow = genEmptyRow(columns);
59
59
  newData.push(newRow);
60
- updateData(newData);
60
+ addData(newData);
61
61
  onClick == null ? void 0 : onClick(e);
62
62
  };
63
63
  const disabled = useMemo(
@@ -44,6 +44,7 @@ const TableForm = React__default.forwardRef(
44
44
  onHeaderChange,
45
45
  onHeaderBlur,
46
46
  onBodyChange,
47
+ onBodyAdd,
47
48
  onBodyBlur,
48
49
  row,
49
50
  errors,
@@ -64,6 +65,16 @@ const TableForm = React__default.forwardRef(
64
65
  },
65
66
  [onBodyChange]
66
67
  );
68
+ const addData = useCallback(
69
+ (value) => {
70
+ setLatestData(value);
71
+ setData(value);
72
+ onBodyChange == null ? void 0 : onBodyChange(value);
73
+ const rowIndex = value.length - 1;
74
+ onBodyAdd == null ? void 0 : onBodyAdd(value, rowIndex);
75
+ },
76
+ [onBodyChange, onBodyAdd]
77
+ );
67
78
  const handleBatchChange = useCallback(
68
79
  (newData, columnKey, shouldUpdateData) => {
69
80
  setLatestData(newData);
@@ -76,19 +87,19 @@ const TableForm = React__default.forwardRef(
76
87
  [onHeaderChange, onBodyChange]
77
88
  );
78
89
  const handleBatchBlur = useCallback(
79
- (key, error) => {
90
+ (columnKey, error) => {
80
91
  if (error) {
81
92
  const newData = latestData.map((cell) => {
82
93
  return __spreadProps(__spreadValues({}, cell), {
83
- [key]: ""
94
+ [columnKey]: ""
84
95
  });
85
96
  });
86
97
  setLatestData(newData);
87
- onHeaderBlur == null ? void 0 : onHeaderBlur(newData);
98
+ onHeaderBlur == null ? void 0 : onHeaderBlur(newData, columnKey);
88
99
  } else {
89
100
  setData(latestData);
90
- onBodyChange == null ? void 0 : onBodyChange(latestData, void 0, key);
91
- onHeaderBlur == null ? void 0 : onHeaderBlur(latestData);
101
+ onBodyChange == null ? void 0 : onBodyChange(latestData, void 0, columnKey);
102
+ onHeaderBlur == null ? void 0 : onHeaderBlur(latestData, columnKey);
92
103
  }
93
104
  },
94
105
  [latestData, onHeaderBlur, onBodyChange]
@@ -99,6 +110,10 @@ const TableForm = React__default.forwardRef(
99
110
  setData: (data2) => {
100
111
  updateData(data2);
101
112
  },
113
+ setDataWithoutTriggerChange: (data2) => {
114
+ setLatestData(data2);
115
+ setData(data2);
116
+ },
102
117
  validateWholeFields() {
103
118
  formValidMapRef.current = {};
104
119
  setValidateAll(true);
@@ -177,7 +192,7 @@ const TableForm = React__default.forwardRef(
177
192
  AddRowButton,
178
193
  {
179
194
  config: rowAddConfig,
180
- updateData,
195
+ addData,
181
196
  columns,
182
197
  data
183
198
  }