x-ui-design 0.5.84 → 0.5.85
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/index.esm.js +15 -7
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +15 -7
- package/dist/index.js.map +1 -1
- package/lib/components/Form/Item/Item.tsx +6 -7
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -974,6 +974,17 @@ function flattenChildren(children) {
|
|
|
974
974
|
var css_248z$l = ".xUi-form-item{display:flex;position:relative}.xUi-form-item.noStyle{display:inline-flex;margin-bottom:0}.xUi-form-item-label{align-items:center;color:var(--xui-text-color);display:flex;font-size:var(--xui-font-size-md);font-weight:500;line-height:20px;margin-bottom:4px}.xUi-form-item-error{color:var(--xui-error-color);display:block;font-size:var(--xui-font-size-xs);line-height:16px;margin-bottom:8px;margin-top:4px;min-height:16px;position:relative;right:0;text-align:end;user-select:none}.xUi-form-item-required{color:var(--xui-error-color);display:inline-block;font-size:var(--xui-font-size-md);line-height:1;margin-left:4px;margin-right:4px}.xUi-form-item.horizontal{align-items:center;flex-direction:row;gap:4px}.xUi-form-item.vertical{align-self:flex-start;flex-direction:column}.xUi-form-item .xUi-input-container{width:-webkit-fill-available}";
|
|
975
975
|
styleInject(css_248z$l);
|
|
976
976
|
|
|
977
|
+
const debounce = (func, delay) => {
|
|
978
|
+
let timeoutId = null;
|
|
979
|
+
return (...args) => {
|
|
980
|
+
if (timeoutId) {
|
|
981
|
+
clearTimeout(timeoutId);
|
|
982
|
+
}
|
|
983
|
+
timeoutId = setTimeout(() => {
|
|
984
|
+
func(...args);
|
|
985
|
+
}, delay);
|
|
986
|
+
};
|
|
987
|
+
};
|
|
977
988
|
const FormItem$1 = ({
|
|
978
989
|
prefixCls = prefixClsFormItem,
|
|
979
990
|
name,
|
|
@@ -1122,11 +1133,9 @@ const FormItemChildComponent = ({
|
|
|
1122
1133
|
const {
|
|
1123
1134
|
getFieldsValue
|
|
1124
1135
|
} = formContext || {};
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
// }, 20)
|
|
1129
|
-
// ).current;
|
|
1136
|
+
const debouncedSetFieldValue = useRef(debounce((name, value) => {
|
|
1137
|
+
setFieldValue(name, value, undefined, undefined, true);
|
|
1138
|
+
}, 150)).current;
|
|
1130
1139
|
const handleChange = (e, option) => {
|
|
1131
1140
|
let rawValue = e?.target ? e.target.value : e;
|
|
1132
1141
|
if (normalize) {
|
|
@@ -1143,8 +1152,7 @@ const FormItemChildComponent = ({
|
|
|
1143
1152
|
return;
|
|
1144
1153
|
}
|
|
1145
1154
|
}
|
|
1146
|
-
|
|
1147
|
-
setFieldValue(name, rawValue, undefined, undefined, true);
|
|
1155
|
+
debouncedSetFieldValue(name, rawValue);
|
|
1148
1156
|
onChange?.(e, option);
|
|
1149
1157
|
};
|
|
1150
1158
|
const injectPropsIntoFinalLeaf = child => {
|