@cloudtower/eagle 0.31.17 → 0.31.18
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/cjs/core/TableForm/TableFormBodyCell.js +6 -3
- package/dist/cjs/core/TableForm/TableFormBodyRows.js +7 -2
- package/dist/cjs/core/TableForm/index.js +12 -1
- package/dist/cjs/stats1.html +1 -1
- package/dist/components.css +3850 -3850
- package/dist/esm/core/TableForm/TableFormBodyCell.js +6 -3
- package/dist/esm/core/TableForm/TableFormBodyRows.js +7 -2
- package/dist/esm/core/TableForm/index.js +13 -2
- package/dist/esm/stats1.html +1 -1
- package/dist/src/core/Select/select.type.d.ts +1 -2
- package/dist/src/core/TableForm/types.d.ts +3 -0
- package/dist/style.css +3784 -3784
- package/package.json +4 -4
|
@@ -37,20 +37,22 @@ const TableFormBodyCell = (props) => {
|
|
|
37
37
|
onChange,
|
|
38
38
|
onBlur,
|
|
39
39
|
validateAll,
|
|
40
|
-
error
|
|
40
|
+
error,
|
|
41
|
+
onValidate
|
|
41
42
|
} = props;
|
|
42
43
|
const [validateResult, setValidateResult] = useState();
|
|
43
44
|
const [isTouched, setIsTouched] = useState(false);
|
|
44
45
|
const width = typeof column.width === "number" ? column.width + "px" : column.width;
|
|
45
46
|
const isCellErrorStyle = Boolean((validateResult == null ? void 0 : validateResult.isError) || isRowError);
|
|
46
47
|
useEffect(() => {
|
|
47
|
-
if (isTouched)
|
|
48
|
+
if (isTouched) {
|
|
48
49
|
setValidateResult(
|
|
49
50
|
error ? {
|
|
50
51
|
msg: error,
|
|
51
52
|
isError: true
|
|
52
53
|
} : void 0
|
|
53
54
|
);
|
|
55
|
+
}
|
|
54
56
|
}, [error, isTouched]);
|
|
55
57
|
const triggerValidate = useCallback(
|
|
56
58
|
(currentValue) => {
|
|
@@ -69,10 +71,11 @@ const TableFormBodyCell = (props) => {
|
|
|
69
71
|
});
|
|
70
72
|
const isError = result ? typeof result === "string" : false;
|
|
71
73
|
setValidateResult({ msg: result || "", isError });
|
|
74
|
+
onValidate == null ? void 0 : onValidate(`${column.key}${rowIndex}`, !isError);
|
|
72
75
|
return;
|
|
73
76
|
}
|
|
74
77
|
},
|
|
75
|
-
[data, rowIndex, column, getRowValidateResult]
|
|
78
|
+
[data, rowIndex, column, getRowValidateResult, onValidate]
|
|
76
79
|
);
|
|
77
80
|
useEffect(() => {
|
|
78
81
|
if (validateAll) {
|
|
@@ -78,7 +78,8 @@ const TableFormRow = (props) => {
|
|
|
78
78
|
updateData,
|
|
79
79
|
onBodyBlur,
|
|
80
80
|
renderRowDescription,
|
|
81
|
-
validateAll
|
|
81
|
+
validateAll,
|
|
82
|
+
onValidate
|
|
82
83
|
} = props;
|
|
83
84
|
const rowData = data[rowIndex];
|
|
84
85
|
const errorFromProps = errors[rowIndex];
|
|
@@ -89,6 +90,9 @@ const TableFormRow = (props) => {
|
|
|
89
90
|
useEffect(() => {
|
|
90
91
|
setRowError(rowLevelError);
|
|
91
92
|
}, [rowLevelError]);
|
|
93
|
+
useEffect(() => {
|
|
94
|
+
onValidate == null ? void 0 : onValidate(`table_row_${rowIndex}`, !rowError);
|
|
95
|
+
}, [onValidate, rowError, rowIndex]);
|
|
92
96
|
const rowDeletable = typeof (row == null ? void 0 : row.deletable) === "boolean" ? row.deletable : (_a = typeof (row == null ? void 0 : row.deletable) === "function" || (deleteConfig == null ? void 0 : deleteConfig.deletable)) != null ? _a : false;
|
|
93
97
|
const getRowValidateResult = useCallback(
|
|
94
98
|
(rowData2) => {
|
|
@@ -118,7 +122,8 @@ const TableFormRow = (props) => {
|
|
|
118
122
|
isRowError: !!rowError,
|
|
119
123
|
getRowValidateResult,
|
|
120
124
|
validateAll,
|
|
121
|
-
error: cellError
|
|
125
|
+
error: cellError,
|
|
126
|
+
onValidate
|
|
122
127
|
}
|
|
123
128
|
);
|
|
124
129
|
});
|
|
@@ -3,7 +3,7 @@ import { TableFormWrapper, DraggableHandleWrapper } from './style.js';
|
|
|
3
3
|
import TableFormBodyRows from './TableFormBodyRows.js';
|
|
4
4
|
import { BatchInputListHeaderCell } from './TableFormHeaderCell.js';
|
|
5
5
|
import { List } from 'antd';
|
|
6
|
-
import React__default, { useState, useCallback, useImperativeHandle, useMemo } from 'react';
|
|
6
|
+
import React__default, { useState, useRef, useCallback, useImperativeHandle, useMemo } from 'react';
|
|
7
7
|
|
|
8
8
|
var __defProp = Object.defineProperty;
|
|
9
9
|
var __defProps = Object.defineProperties;
|
|
@@ -55,6 +55,7 @@ const TableForm = React__default.forwardRef(
|
|
|
55
55
|
const [validateAll, setValidateAll] = useState(false);
|
|
56
56
|
const rowSplitType = (row == null ? void 0 : row.splitType) || props.rowSplitType || "border";
|
|
57
57
|
const draggable = (_b = (_a = row == null ? void 0 : row.draggable) != null ? _a : props.draggable) != null ? _b : false;
|
|
58
|
+
const formValidMapRef = useRef({});
|
|
58
59
|
const updateData = useCallback(
|
|
59
60
|
(value, rowIndex, columnKey) => {
|
|
60
61
|
setLatestData(value);
|
|
@@ -99,11 +100,20 @@ const TableForm = React__default.forwardRef(
|
|
|
99
100
|
updateData(data2);
|
|
100
101
|
},
|
|
101
102
|
validateWholeFields() {
|
|
103
|
+
formValidMapRef.current = {};
|
|
102
104
|
setValidateAll(true);
|
|
105
|
+
},
|
|
106
|
+
isValid() {
|
|
107
|
+
return Object.values(formValidMapRef.current).every(
|
|
108
|
+
(v) => v === true
|
|
109
|
+
);
|
|
103
110
|
}
|
|
104
111
|
}),
|
|
105
112
|
[updateData]
|
|
106
113
|
);
|
|
114
|
+
const onValidate = (id, isValid) => {
|
|
115
|
+
formValidMapRef.current[id] = isValid;
|
|
116
|
+
};
|
|
107
117
|
const headerCells = columns.map((col) => {
|
|
108
118
|
return /* @__PURE__ */ React__default.createElement(
|
|
109
119
|
BatchInputListHeaderCell,
|
|
@@ -159,7 +169,8 @@ const TableForm = React__default.forwardRef(
|
|
|
159
169
|
renderRowDescription,
|
|
160
170
|
rowValidator,
|
|
161
171
|
validateAll,
|
|
162
|
-
errors
|
|
172
|
+
errors,
|
|
173
|
+
onValidate
|
|
163
174
|
}
|
|
164
175
|
))
|
|
165
176
|
), (rowAddConfig == null ? void 0 : rowAddConfig.addible) ? /* @__PURE__ */ React__default.createElement(
|