@douyinfe/semi-ui 2.27.0 → 2.27.1
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/css/semi.css +3 -0
- package/dist/css/semi.min.css +1 -1
- package/dist/umd/semi-ui.js +58 -34
- package/dist/umd/semi-ui.js.map +1 -1
- package/dist/umd/semi-ui.min.js +1 -1
- package/dist/umd/semi-ui.min.js.map +1 -1
- package/lib/cjs/dropdown/dropdownItem.d.ts +4 -0
- package/lib/cjs/dropdown/dropdownItem.js +7 -3
- package/lib/cjs/form/hoc/withField.js +51 -31
- package/lib/es/dropdown/dropdownItem.d.ts +4 -0
- package/lib/es/dropdown/dropdownItem.js +7 -3
- package/lib/es/form/hoc/withField.js +51 -31
- package/package.json +8 -8
package/dist/umd/semi-ui.js
CHANGED
|
@@ -60844,15 +60844,18 @@ class dropdownItem_DropdownItem extends baseComponent_BaseComponent {
|
|
|
60844
60844
|
type,
|
|
60845
60845
|
active,
|
|
60846
60846
|
icon,
|
|
60847
|
-
onKeyDown
|
|
60847
|
+
onKeyDown,
|
|
60848
|
+
showTick,
|
|
60849
|
+
hover
|
|
60848
60850
|
} = this.props;
|
|
60849
60851
|
const {
|
|
60850
|
-
showTick
|
|
60852
|
+
showTick: contextShowTick
|
|
60851
60853
|
} = this.context;
|
|
60852
60854
|
const itemclass = classnames_default()(className, {
|
|
60853
60855
|
["".concat(dropdownItem_prefixCls, "-item")]: true,
|
|
60854
60856
|
["".concat(dropdownItem_prefixCls, "-item-disabled")]: disabled,
|
|
60855
|
-
["".concat(dropdownItem_prefixCls, "-item-
|
|
60857
|
+
["".concat(dropdownItem_prefixCls, "-item-hover")]: hover,
|
|
60858
|
+
["".concat(dropdownItem_prefixCls, "-item-withTick")]: contextShowTick !== null && contextShowTick !== void 0 ? contextShowTick : showTick,
|
|
60856
60859
|
["".concat(dropdownItem_prefixCls, "-item-").concat(type)]: type,
|
|
60857
60860
|
["".concat(dropdownItem_prefixCls, "-item-active")]: active
|
|
60858
60861
|
});
|
|
@@ -60931,6 +60934,7 @@ dropdownItem_DropdownItem.defaultProps = {
|
|
|
60931
60934
|
onMouseLeave: noop_default.a,
|
|
60932
60935
|
forwardRef: noop_default.a
|
|
60933
60936
|
};
|
|
60937
|
+
dropdownItem_DropdownItem.elementType = 'Dropdown.Item';
|
|
60934
60938
|
/* harmony default export */ var dropdown_dropdownItem = (dropdownItem_DropdownItem);
|
|
60935
60939
|
// CONCATENATED MODULE: ./dropdown/dropdownDivider.tsx
|
|
60936
60940
|
|
|
@@ -100051,7 +100055,8 @@ function withField(Component, opts) {
|
|
|
100051
100055
|
const [status, setStatus] = Object(external_root_React_commonjs2_react_commonjs_react_amd_react_["useState"])(validateStatus); // use props.validateStatus to init
|
|
100052
100056
|
|
|
100053
100057
|
const rulesRef = Object(external_root_React_commonjs2_react_commonjs_react_amd_react_["useRef"])(rules);
|
|
100054
|
-
const validateRef = Object(external_root_React_commonjs2_react_commonjs_react_amd_react_["useRef"])(validate);
|
|
100058
|
+
const validateRef = Object(external_root_React_commonjs2_react_commonjs_react_amd_react_["useRef"])(validate);
|
|
100059
|
+
const validatePromise = Object(external_root_React_commonjs2_react_commonjs_react_amd_react_["useRef"])(null); // notNotify is true means that the onChange of the Form does not need to be triggered
|
|
100055
100060
|
// notUpdate is true means that this operation does not need to trigger the forceUpdate
|
|
100056
100061
|
|
|
100057
100062
|
const updateTouched = (isTouched, callOpts) => {
|
|
@@ -100105,16 +100110,24 @@ function withField(Component, opts) {
|
|
|
100105
100110
|
const model = {
|
|
100106
100111
|
[field]: val
|
|
100107
100112
|
};
|
|
100108
|
-
|
|
100113
|
+
const rootPromise = new Promise((resolve, reject) => {
|
|
100109
100114
|
validator.validate(model, {
|
|
100110
100115
|
first: stopValidateWithError
|
|
100111
100116
|
}, // eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
100112
100117
|
(errors, fields) => {}).then(res => {
|
|
100113
|
-
|
|
100118
|
+
if (validatePromise.current !== rootPromise) {
|
|
100119
|
+
return;
|
|
100120
|
+
} // validation passed
|
|
100121
|
+
|
|
100122
|
+
|
|
100114
100123
|
setStatus('success');
|
|
100115
100124
|
updateError(undefined, callOpts);
|
|
100116
100125
|
resolve({});
|
|
100117
100126
|
}).catch(err => {
|
|
100127
|
+
if (validatePromise.current !== rootPromise) {
|
|
100128
|
+
return;
|
|
100129
|
+
}
|
|
100130
|
+
|
|
100118
100131
|
let {
|
|
100119
100132
|
errors,
|
|
100120
100133
|
fields
|
|
@@ -100143,44 +100156,55 @@ function withField(Component, opts) {
|
|
|
100143
100156
|
}
|
|
100144
100157
|
});
|
|
100145
100158
|
});
|
|
100159
|
+
validatePromise.current = rootPromise;
|
|
100160
|
+
return rootPromise;
|
|
100146
100161
|
}; // execute custom validate function
|
|
100147
100162
|
|
|
100148
100163
|
|
|
100149
|
-
const _validate = (val, values, callOpts) =>
|
|
100150
|
-
|
|
100164
|
+
const _validate = (val, values, callOpts) => {
|
|
100165
|
+
const rootPromise = new Promise(resolve => {
|
|
100166
|
+
let maybePromisedErrors; // let errorThrowSync;
|
|
100151
100167
|
|
|
100152
|
-
|
|
100153
|
-
|
|
100154
|
-
|
|
100155
|
-
|
|
100156
|
-
|
|
100157
|
-
|
|
100168
|
+
try {
|
|
100169
|
+
maybePromisedErrors = validateRef.current(val, values);
|
|
100170
|
+
} catch (err) {
|
|
100171
|
+
// error throw by syncValidate
|
|
100172
|
+
maybePromisedErrors = err;
|
|
100173
|
+
}
|
|
100158
100174
|
|
|
100159
|
-
|
|
100160
|
-
|
|
100161
|
-
|
|
100162
|
-
|
|
100163
|
-
|
|
100164
|
-
|
|
100165
|
-
|
|
100175
|
+
if (maybePromisedErrors === undefined) {
|
|
100176
|
+
resolve({});
|
|
100177
|
+
updateError(undefined, callOpts);
|
|
100178
|
+
} else if (isPromise(maybePromisedErrors)) {
|
|
100179
|
+
maybePromisedErrors.then(result => {
|
|
100180
|
+
// If the async validate is outdated (a newer validate occurs), the result should be discarded
|
|
100181
|
+
if (validatePromise.current !== rootPromise) {
|
|
100182
|
+
return;
|
|
100183
|
+
}
|
|
100184
|
+
|
|
100185
|
+
if (utils_isValid(result)) {
|
|
100186
|
+
// validate success,no need to do anything with result
|
|
100187
|
+
updateError(undefined, callOpts);
|
|
100188
|
+
resolve(null);
|
|
100189
|
+
} else {
|
|
100190
|
+
// validate failed
|
|
100191
|
+
updateError(result, callOpts);
|
|
100192
|
+
resolve(result);
|
|
100193
|
+
}
|
|
100194
|
+
});
|
|
100195
|
+
} else {
|
|
100196
|
+
if (utils_isValid(maybePromisedErrors)) {
|
|
100166
100197
|
updateError(undefined, callOpts);
|
|
100167
100198
|
resolve(null);
|
|
100168
100199
|
} else {
|
|
100169
|
-
|
|
100170
|
-
|
|
100171
|
-
resolve(result);
|
|
100200
|
+
updateError(maybePromisedErrors, callOpts);
|
|
100201
|
+
resolve(maybePromisedErrors);
|
|
100172
100202
|
}
|
|
100173
|
-
});
|
|
100174
|
-
} else {
|
|
100175
|
-
if (utils_isValid(maybePromisedErrors)) {
|
|
100176
|
-
updateError(undefined, callOpts);
|
|
100177
|
-
resolve(null);
|
|
100178
|
-
} else {
|
|
100179
|
-
updateError(maybePromisedErrors, callOpts);
|
|
100180
|
-
resolve(maybePromisedErrors);
|
|
100181
100203
|
}
|
|
100182
|
-
}
|
|
100183
|
-
|
|
100204
|
+
});
|
|
100205
|
+
validatePromise.current = rootPromise;
|
|
100206
|
+
return rootPromise;
|
|
100207
|
+
};
|
|
100184
100208
|
|
|
100185
100209
|
const fieldValidate = (val, callOpts) => {
|
|
100186
100210
|
let finalVal = val;
|