uiw 4.11.1 → 4.11.5
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/README.md +2 -1
- package/dist/uiw.css +98 -46
- package/dist/uiw.js +320 -140
- package/dist/uiw.min.css +1 -1
- package/dist/uiw.min.js +1 -1
- package/package.json +56 -56
package/dist/uiw.js
CHANGED
|
@@ -6822,7 +6822,7 @@ function Row_Row(props) {
|
|
|
6822
6822
|
|
|
6823
6823
|
|
|
6824
6824
|
|
|
6825
|
-
var FormItem_excluded = ["prefixCls", "className", "style", "label", "labelFor", "labelClassName", "labelStyle", "help", "inline", "initialValue", "validator", "hasError"];
|
|
6825
|
+
var FormItem_excluded = ["prefixCls", "className", "required", "style", "label", "labelFor", "labelClassName", "labelStyle", "help", "inline", "initialValue", "validator", "hasError"];
|
|
6826
6826
|
|
|
6827
6827
|
|
|
6828
6828
|
|
|
@@ -6846,6 +6846,7 @@ var FormItem = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
6846
6846
|
var _this$props = this.props,
|
|
6847
6847
|
prefixCls = _this$props.prefixCls,
|
|
6848
6848
|
className = _this$props.className,
|
|
6849
|
+
required = _this$props.required,
|
|
6849
6850
|
style = _this$props.style,
|
|
6850
6851
|
label = _this$props.label,
|
|
6851
6852
|
labelFor = _this$props.labelFor,
|
|
@@ -6865,14 +6866,19 @@ var FormItem = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
6865
6866
|
style: style
|
|
6866
6867
|
}, otherProps, {
|
|
6867
6868
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)(Row_Row, {
|
|
6868
|
-
children: [/*#__PURE__*/(0,jsx_runtime.
|
|
6869
|
+
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)(Col, {
|
|
6869
6870
|
fixed: true,
|
|
6870
6871
|
className: labelCls,
|
|
6871
|
-
children: /*#__PURE__*/(0,jsx_runtime.jsx)("label", {
|
|
6872
|
+
children: [required && /*#__PURE__*/(0,jsx_runtime.jsx)("label", {
|
|
6873
|
+
style: {
|
|
6874
|
+
color: 'red'
|
|
6875
|
+
},
|
|
6876
|
+
children: "*"
|
|
6877
|
+
}), /*#__PURE__*/(0,jsx_runtime.jsx)("label", {
|
|
6872
6878
|
style: labelStyle,
|
|
6873
6879
|
htmlFor: labelFor,
|
|
6874
6880
|
children: label
|
|
6875
|
-
})
|
|
6881
|
+
})]
|
|
6876
6882
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(Col, {
|
|
6877
6883
|
className: "w-form-row",
|
|
6878
6884
|
children: this.props.children
|
|
@@ -6890,11 +6896,18 @@ var FormItem = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
6890
6896
|
className: cls,
|
|
6891
6897
|
style: style
|
|
6892
6898
|
}, otherProps, {
|
|
6893
|
-
children: [label && /*#__PURE__*/(0,jsx_runtime.
|
|
6894
|
-
|
|
6895
|
-
|
|
6896
|
-
|
|
6897
|
-
|
|
6899
|
+
children: [label && /*#__PURE__*/(0,jsx_runtime.jsxs)((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Fragment, {
|
|
6900
|
+
children: [required && /*#__PURE__*/(0,jsx_runtime.jsx)("label", {
|
|
6901
|
+
style: {
|
|
6902
|
+
color: 'red'
|
|
6903
|
+
},
|
|
6904
|
+
children: "*"
|
|
6905
|
+
}), /*#__PURE__*/(0,jsx_runtime.jsx)("label", {
|
|
6906
|
+
className: labelCls,
|
|
6907
|
+
style: labelStyle,
|
|
6908
|
+
htmlFor: labelFor,
|
|
6909
|
+
children: label
|
|
6910
|
+
})]
|
|
6898
6911
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(Col, {
|
|
6899
6912
|
className: "w-form-row",
|
|
6900
6913
|
children: this.props.children
|
|
@@ -6921,6 +6934,7 @@ FormItem.defaultProps = {
|
|
|
6921
6934
|
|
|
6922
6935
|
|
|
6923
6936
|
|
|
6937
|
+
|
|
6924
6938
|
var Form_excluded = ["prefixCls", "className", "fields", "children", "resetOnSubmit", "onSubmitError", "onChange", "onSubmit", "afterSubmit"],
|
|
6925
6939
|
Form_excluded2 = ["children", "validator", "name", "help", "label", "labelFor", "labelClassName", "labelStyle", "inline", "initialValue"];
|
|
6926
6940
|
|
|
@@ -6946,7 +6960,7 @@ function newFormState(fields, cb) {
|
|
|
6946
6960
|
initialValue = _cb.initialValue,
|
|
6947
6961
|
_currentValue = _cb.currentValue;
|
|
6948
6962
|
|
|
6949
|
-
state.initial[name] = initialValue;
|
|
6963
|
+
state.initial[name] = Array.isArray(initialValue) ? _toConsumableArray(initialValue) : initialValue;
|
|
6950
6964
|
state.current[name] = _currentValue;
|
|
6951
6965
|
}
|
|
6952
6966
|
|
|
@@ -6986,15 +7000,10 @@ function Form(_ref, ref //| React.RefObject<FormRefType>,
|
|
|
6986
7000
|
});
|
|
6987
7001
|
}, []);
|
|
6988
7002
|
|
|
6989
|
-
var _useState = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(
|
|
7003
|
+
var _useState = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(initData),
|
|
6990
7004
|
_useState2 = _slicedToArray(_useState, 2),
|
|
6991
7005
|
data = _useState2[0],
|
|
6992
|
-
|
|
6993
|
-
|
|
6994
|
-
var setData = function setData(values) {
|
|
6995
|
-
// 解决value为数组时不进行深拷贝,initvalue无法重置问题
|
|
6996
|
-
setDatas(JSON.parse(JSON.stringify(values)));
|
|
6997
|
-
};
|
|
7006
|
+
setData = _useState2[1];
|
|
6998
7007
|
|
|
6999
7008
|
(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useImperativeHandle)(ref, function () {
|
|
7000
7009
|
return {
|
|
@@ -7002,7 +7011,11 @@ function Form(_ref, ref //| React.RefObject<FormRefType>,
|
|
|
7002
7011
|
resetForm: handleReset,
|
|
7003
7012
|
getFieldValues: function getFieldValues() {
|
|
7004
7013
|
return data.current;
|
|
7005
|
-
}
|
|
7014
|
+
},
|
|
7015
|
+
getError: function getError() {
|
|
7016
|
+
return data.errors;
|
|
7017
|
+
},
|
|
7018
|
+
setFields: setFields
|
|
7006
7019
|
};
|
|
7007
7020
|
}, [data]);
|
|
7008
7021
|
var formUnits = {};
|
|
@@ -7032,6 +7045,11 @@ function Form(_ref, ref //| React.RefObject<FormRefType>,
|
|
|
7032
7045
|
})));
|
|
7033
7046
|
}
|
|
7034
7047
|
|
|
7048
|
+
function setFields(fields) {
|
|
7049
|
+
data.current = fields;
|
|
7050
|
+
setData(data);
|
|
7051
|
+
}
|
|
7052
|
+
|
|
7035
7053
|
function handleChange(name, validator, element, cb) {
|
|
7036
7054
|
return function (env, list) {
|
|
7037
7055
|
var value = env && env.target && 'value' in env.target ? env.target.value : env; // 控件 Checkbox.Group 多选值的处理
|
|
@@ -7094,13 +7112,11 @@ function Form(_ref, ref //| React.RefObject<FormRefType>,
|
|
|
7094
7112
|
setData(_extends({}, data, nextState, {
|
|
7095
7113
|
errors: {}
|
|
7096
7114
|
}));
|
|
7097
|
-
|
|
7098
|
-
|
|
7099
|
-
|
|
7100
|
-
|
|
7101
|
-
|
|
7102
|
-
});
|
|
7103
|
-
};
|
|
7115
|
+
afterSubmit && afterSubmit({
|
|
7116
|
+
state: data,
|
|
7117
|
+
response: response,
|
|
7118
|
+
reset: handleReset
|
|
7119
|
+
});
|
|
7104
7120
|
};
|
|
7105
7121
|
|
|
7106
7122
|
try {
|
|
@@ -7142,17 +7158,30 @@ function Form(_ref, ref //| React.RefObject<FormRefType>,
|
|
|
7142
7158
|
|
|
7143
7159
|
function handleReset() {
|
|
7144
7160
|
var initial = data.initial;
|
|
7161
|
+
|
|
7162
|
+
var initials = _extends({}, initial);
|
|
7163
|
+
|
|
7164
|
+
Object.entries(initials).map(function (_ref3) {
|
|
7165
|
+
var _ref5 = _slicedToArray(_ref3, 2),
|
|
7166
|
+
key = _ref5[0],
|
|
7167
|
+
value = _ref5[1];
|
|
7168
|
+
|
|
7169
|
+
if (Array.isArray(value)) {
|
|
7170
|
+
initials[key] = _toConsumableArray(value);
|
|
7171
|
+
}
|
|
7172
|
+
});
|
|
7145
7173
|
setData(_extends({}, data, {
|
|
7146
|
-
|
|
7174
|
+
initial: initial,
|
|
7175
|
+
current: initials,
|
|
7147
7176
|
errors: {}
|
|
7148
7177
|
}));
|
|
7149
7178
|
}
|
|
7150
7179
|
|
|
7151
|
-
function controlField(
|
|
7152
|
-
var children =
|
|
7153
|
-
validator =
|
|
7154
|
-
name =
|
|
7155
|
-
other = _objectWithoutPropertiesLoose(
|
|
7180
|
+
function controlField(_ref4) {
|
|
7181
|
+
var children = _ref4.children,
|
|
7182
|
+
validator = _ref4.validator,
|
|
7183
|
+
name = _ref4.name,
|
|
7184
|
+
other = _objectWithoutPropertiesLoose(_ref4, Form_excluded2);
|
|
7156
7185
|
|
|
7157
7186
|
var element = typeof children !== 'function' ? children : children({
|
|
7158
7187
|
onChange: handleChange(name, validator),
|
|
@@ -9286,11 +9315,95 @@ function Rate(props) {
|
|
|
9286
9315
|
})
|
|
9287
9316
|
}));
|
|
9288
9317
|
}
|
|
9318
|
+
;// CONCATENATED MODULE: ../react-tag/esm/style/index.css
|
|
9319
|
+
// extracted by mini-css-extract-plugin
|
|
9320
|
+
/* harmony default export */ var react_tag_esm_style = ({});
|
|
9321
|
+
;// CONCATENATED MODULE: ../react-tag/esm/index.js
|
|
9322
|
+
|
|
9323
|
+
|
|
9324
|
+
var react_tag_esm_excluded = ["prefixCls", "className", "style", "title", "children", "visible", "color", "disabled", "bordered", "closable", "light", "onClose"];
|
|
9325
|
+
|
|
9326
|
+
|
|
9327
|
+
|
|
9328
|
+
|
|
9329
|
+
/* harmony default export */ var react_tag_esm = (function (props) {
|
|
9330
|
+
if (props === void 0) {
|
|
9331
|
+
props = {};
|
|
9332
|
+
}
|
|
9333
|
+
|
|
9334
|
+
var _props = props,
|
|
9335
|
+
_props$prefixCls = _props.prefixCls,
|
|
9336
|
+
prefixCls = _props$prefixCls === void 0 ? 'w-tag' : _props$prefixCls,
|
|
9337
|
+
className = _props.className,
|
|
9338
|
+
style = _props.style,
|
|
9339
|
+
_props$title = _props.title,
|
|
9340
|
+
title = _props$title === void 0 ? '' : _props$title,
|
|
9341
|
+
children = _props.children,
|
|
9342
|
+
_props$visible = _props.visible,
|
|
9343
|
+
visible = _props$visible === void 0 ? true : _props$visible,
|
|
9344
|
+
_props$color = _props.color,
|
|
9345
|
+
color = _props$color === void 0 ? '#6E6E6E' : _props$color,
|
|
9346
|
+
_props$disabled = _props.disabled,
|
|
9347
|
+
disabled = _props$disabled === void 0 ? false : _props$disabled,
|
|
9348
|
+
_props$bordered = _props.bordered,
|
|
9349
|
+
bordered = _props$bordered === void 0 ? true : _props$bordered,
|
|
9350
|
+
closable = _props.closable,
|
|
9351
|
+
_props$light = _props.light,
|
|
9352
|
+
light = _props$light === void 0 ? false : _props$light,
|
|
9353
|
+
onClose = _props.onClose,
|
|
9354
|
+
other = _objectWithoutPropertiesLoose(props, react_tag_esm_excluded);
|
|
9355
|
+
|
|
9356
|
+
var cls = [prefixCls, className, light ? prefixCls + "-light" : null, disabled ? 'disabled' : null].filter(Boolean).join(' ').trim();
|
|
9357
|
+
|
|
9358
|
+
var styl = _extends({}, style);
|
|
9359
|
+
|
|
9360
|
+
if (!light) {
|
|
9361
|
+
styl.color = '#fff';
|
|
9362
|
+
styl.backgroundColor = color;
|
|
9363
|
+
} else {
|
|
9364
|
+
styl.color = color;
|
|
9365
|
+
styl.borderColor = color;
|
|
9366
|
+
|
|
9367
|
+
if (bordered && light) {
|
|
9368
|
+
styl.boxShadow = "inset 0 0 0 1px " + color;
|
|
9369
|
+
}
|
|
9370
|
+
}
|
|
9371
|
+
|
|
9372
|
+
if (!visible) {
|
|
9373
|
+
return null;
|
|
9374
|
+
}
|
|
9375
|
+
|
|
9376
|
+
var closeBtn = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo)(function () {
|
|
9377
|
+
return closable ? /*#__PURE__*/(0,jsx_runtime.jsx)("svg", {
|
|
9378
|
+
onClick: onClose,
|
|
9379
|
+
className: prefixCls + "-close",
|
|
9380
|
+
width: "15",
|
|
9381
|
+
height: "15",
|
|
9382
|
+
viewBox: "0 0 16 16",
|
|
9383
|
+
children: /*#__PURE__*/(0,jsx_runtime.jsx)("path", {
|
|
9384
|
+
d: "M9.41 8l2.29-2.29c.19-.18.3-.43.3-.71a1.003 1.003 0 0 0-1.71-.71L8 6.59l-2.29-2.3a1.003 1.003 0 0 0-1.42 1.42L6.59 8 4.3 10.29c-.19.18-.3.43-.3.71a1.003 1.003 0 0 0 1.71.71L8 9.41l2.29 2.29c.18.19.43.3.71.3a1.003 1.003 0 0 0 .71-1.71L9.41 8z"
|
|
9385
|
+
})
|
|
9386
|
+
}) : null;
|
|
9387
|
+
}, [closable]);
|
|
9388
|
+
return /*#__PURE__*/(0,jsx_runtime.jsxs)("span", _extends({
|
|
9389
|
+
className: cls,
|
|
9390
|
+
style: styl
|
|
9391
|
+
}, other, {
|
|
9392
|
+
children: [title || children, closeBtn]
|
|
9393
|
+
}));
|
|
9394
|
+
});
|
|
9395
|
+
;// CONCATENATED MODULE: ../react-search-select/esm/style/index.css
|
|
9396
|
+
// extracted by mini-css-extract-plugin
|
|
9397
|
+
/* harmony default export */ var react_search_select_esm_style = ({});
|
|
9289
9398
|
;// CONCATENATED MODULE: ../react-search-select/esm/index.js
|
|
9290
9399
|
|
|
9291
9400
|
|
|
9292
9401
|
|
|
9293
|
-
|
|
9402
|
+
|
|
9403
|
+
var react_search_select_esm_excluded = ["allowClear", "disabled", "size", "maxTagCount", "option", "loading", "labelInValue", "prefixCls", "className", "mode", "style", "isOpen", "value", "defaultValue", "showSearch", "placeholder", "onSearch", "onChange", "onSelect"];
|
|
9404
|
+
|
|
9405
|
+
|
|
9406
|
+
|
|
9294
9407
|
|
|
9295
9408
|
|
|
9296
9409
|
|
|
@@ -9307,10 +9420,18 @@ function SearchSelect(props) {
|
|
|
9307
9420
|
disabled = _props$disabled === void 0 ? false : _props$disabled,
|
|
9308
9421
|
_props$size = props.size,
|
|
9309
9422
|
size = _props$size === void 0 ? 'default' : _props$size,
|
|
9423
|
+
maxTagCount = props.maxTagCount,
|
|
9310
9424
|
_props$option = props.option,
|
|
9311
9425
|
option = _props$option === void 0 ? [] : _props$option,
|
|
9312
9426
|
_props$loading = props.loading,
|
|
9313
9427
|
loading = _props$loading === void 0 ? false : _props$loading,
|
|
9428
|
+
_props$labelInValue = props.labelInValue,
|
|
9429
|
+
labelInValue = _props$labelInValue === void 0 ? false : _props$labelInValue,
|
|
9430
|
+
_props$prefixCls = props.prefixCls,
|
|
9431
|
+
prefixCls = _props$prefixCls === void 0 ? 'w-search-select' : _props$prefixCls,
|
|
9432
|
+
className = props.className,
|
|
9433
|
+
_props$mode = props.mode,
|
|
9434
|
+
mode = _props$mode === void 0 ? 'single' : _props$mode,
|
|
9314
9435
|
style = props.style,
|
|
9315
9436
|
value = props.value,
|
|
9316
9437
|
defaultValue = props.defaultValue,
|
|
@@ -9321,12 +9442,17 @@ function SearchSelect(props) {
|
|
|
9321
9442
|
onSelect = props.onSelect,
|
|
9322
9443
|
others = _objectWithoutPropertiesLoose(props, react_search_select_esm_excluded);
|
|
9323
9444
|
|
|
9445
|
+
var cls = [prefixCls, className].filter(Boolean).join(' ').trim();
|
|
9446
|
+
var isMultiple = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo)(function () {
|
|
9447
|
+
return mode === 'multiple';
|
|
9448
|
+
}, [mode]);
|
|
9449
|
+
|
|
9324
9450
|
var _useState = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(false),
|
|
9325
9451
|
_useState2 = _slicedToArray(_useState, 2),
|
|
9326
9452
|
innerIsOpen = _useState2[0],
|
|
9327
9453
|
setInnerIsOpen = _useState2[1];
|
|
9328
9454
|
|
|
9329
|
-
var _useState3 = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(
|
|
9455
|
+
var _useState3 = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)([]),
|
|
9330
9456
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
9331
9457
|
selectedValue = _useState4[0],
|
|
9332
9458
|
setSelectedValue = _useState4[1];
|
|
@@ -9341,29 +9467,89 @@ function SearchSelect(props) {
|
|
|
9341
9467
|
selectIconType = _useState8[0],
|
|
9342
9468
|
setSelectIconType = _useState8[1];
|
|
9343
9469
|
|
|
9470
|
+
var omitTagCount = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo)(function () {
|
|
9471
|
+
return maxTagCount && selectedValue.length > maxTagCount ? selectedValue.length - maxTagCount : 0;
|
|
9472
|
+
}, [selectedValue.length]);
|
|
9344
9473
|
var divRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(null);
|
|
9474
|
+
var valueRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)();
|
|
9475
|
+
valueRef.current = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo)(function () {
|
|
9476
|
+
return selectedValue;
|
|
9477
|
+
}, [selectedValue]);
|
|
9345
9478
|
(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function () {
|
|
9346
|
-
if (defaultValue) {
|
|
9347
|
-
|
|
9348
|
-
return defaultValue === menuItem.value;
|
|
9349
|
-
});
|
|
9350
|
-
setSelectedValue(defaultValue);
|
|
9351
|
-
setSelectedLabel(defaultMenuItem ? defaultMenuItem.label : '');
|
|
9479
|
+
if (value === undefined && defaultValue !== undefined) {
|
|
9480
|
+
selectedValueChange(defaultValue);
|
|
9352
9481
|
}
|
|
9353
9482
|
}, []);
|
|
9354
9483
|
(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function () {
|
|
9355
|
-
if (value !==
|
|
9356
|
-
|
|
9484
|
+
if (value !== undefined) {
|
|
9485
|
+
selectedValueChange(value);
|
|
9357
9486
|
}
|
|
9358
|
-
}, [value]);
|
|
9487
|
+
}, [JSON.stringify(value)]);
|
|
9488
|
+
|
|
9489
|
+
var getSelectOption = function getSelectOption(option, value) {
|
|
9490
|
+
var findResult = option.find(function (item) {
|
|
9491
|
+
return item.value === value;
|
|
9492
|
+
});
|
|
9493
|
+
return findResult;
|
|
9494
|
+
};
|
|
9495
|
+
|
|
9496
|
+
function selectedValueChange(changeValue) {
|
|
9497
|
+
var opts = [];
|
|
9498
|
+
|
|
9499
|
+
if (labelInValue) {
|
|
9500
|
+
if (Array.isArray(changeValue)) {
|
|
9501
|
+
opts = changeValue;
|
|
9502
|
+
} else {
|
|
9503
|
+
opts.push(changeValue);
|
|
9504
|
+
}
|
|
9505
|
+
} else {
|
|
9506
|
+
if (Array.isArray(changeValue)) {
|
|
9507
|
+
opts = changeValue.map(function (v) {
|
|
9508
|
+
return getSelectOption(option, v);
|
|
9509
|
+
});
|
|
9510
|
+
} else {
|
|
9511
|
+
var findResult = getSelectOption(option, changeValue);
|
|
9512
|
+
|
|
9513
|
+
if (findResult) {
|
|
9514
|
+
setSelectedLabel(findResult.label);
|
|
9515
|
+
opts.push(findResult);
|
|
9516
|
+
}
|
|
9517
|
+
}
|
|
9518
|
+
}
|
|
9519
|
+
|
|
9520
|
+
setSelectedValue(opts);
|
|
9521
|
+
}
|
|
9522
|
+
|
|
9523
|
+
function removeSelectItem(index) {
|
|
9524
|
+
var selectedValue = valueRef.current;
|
|
9525
|
+
selectedValue.splice(index, 1);
|
|
9526
|
+
|
|
9527
|
+
var values = _toConsumableArray(selectedValue);
|
|
9528
|
+
|
|
9529
|
+
return values;
|
|
9530
|
+
}
|
|
9359
9531
|
|
|
9360
9532
|
function handleItemClick(item) {
|
|
9361
9533
|
setInnerIsOpen(false);
|
|
9362
|
-
|
|
9534
|
+
var values = [item];
|
|
9363
9535
|
setSelectedLabel(item.label);
|
|
9364
|
-
|
|
9536
|
+
var resultValue = item.value;
|
|
9537
|
+
handleChange(resultValue, values);
|
|
9538
|
+
}
|
|
9539
|
+
|
|
9540
|
+
function handleItemsClick(index, item) {
|
|
9541
|
+
var values = index !== -1 ? removeSelectItem(index) : [].concat(_toConsumableArray(selectedValue), [item]);
|
|
9542
|
+
var resultValue = values.map(function (item) {
|
|
9543
|
+
return item.value;
|
|
9544
|
+
});
|
|
9545
|
+
handleChange(resultValue, values);
|
|
9546
|
+
}
|
|
9365
9547
|
|
|
9366
|
-
|
|
9548
|
+
function handleChange(resultValue, values) {
|
|
9549
|
+
onSelect && onSelect(resultValue);
|
|
9550
|
+
handleSelectChange(resultValue, values); // 支持form组件
|
|
9551
|
+
|
|
9552
|
+
value === undefined && setSelectedValue(values); // 如果受控于父组件则不需要内部维护状态
|
|
9367
9553
|
} // 渲染icon
|
|
9368
9554
|
|
|
9369
9555
|
|
|
@@ -9385,24 +9571,31 @@ function SearchSelect(props) {
|
|
|
9385
9571
|
setInnerIsOpen(!!value);
|
|
9386
9572
|
setSelectedLabel(value);
|
|
9387
9573
|
setSelectIconType(showSearch && value ? 'loading' : '');
|
|
9388
|
-
showSearch && onSearch && onSearch(value);
|
|
9389
|
-
handleSelectChange(value);
|
|
9574
|
+
showSearch && onSearch && onSearch(value); // handleSelectChange(value);
|
|
9390
9575
|
} // 清除选中的值
|
|
9391
9576
|
|
|
9392
9577
|
|
|
9393
9578
|
function resetSelectedValue() {
|
|
9394
9579
|
setInnerIsOpen(false);
|
|
9395
|
-
setSelectedValue(
|
|
9580
|
+
setSelectedValue([]);
|
|
9396
9581
|
setSelectedLabel('');
|
|
9397
9582
|
setSelectIconType('');
|
|
9398
|
-
handleSelectChange('');
|
|
9583
|
+
handleSelectChange('', []);
|
|
9584
|
+
}
|
|
9585
|
+
|
|
9586
|
+
function handleSelectChange(value, options) {
|
|
9587
|
+
if (!onChange) return;
|
|
9588
|
+
onChange(labelInValue ? options : value);
|
|
9399
9589
|
}
|
|
9400
9590
|
|
|
9401
|
-
function
|
|
9402
|
-
|
|
9591
|
+
function inputKeyDown(e) {
|
|
9592
|
+
if (isMultiple && selectedValue.length > 0 && !selectedLabel && e.keyCode === 8) {
|
|
9593
|
+
handleItemsClick(selectedValue.length - 1);
|
|
9594
|
+
}
|
|
9403
9595
|
}
|
|
9404
9596
|
|
|
9405
9597
|
return /*#__PURE__*/(0,jsx_runtime.jsx)(Dropdown, _extends({
|
|
9598
|
+
className: cls,
|
|
9406
9599
|
trigger: "focus",
|
|
9407
9600
|
style: {
|
|
9408
9601
|
marginTop: 5
|
|
@@ -9410,7 +9603,8 @@ function SearchSelect(props) {
|
|
|
9410
9603
|
disabled: option && option.length > 0 ? false : true
|
|
9411
9604
|
}, others, {
|
|
9412
9605
|
onVisibleChange: function onVisibleChange(open) {
|
|
9413
|
-
|
|
9606
|
+
if (!open && isMultiple) setSelectedLabel('');
|
|
9607
|
+
setInnerIsOpen(open);
|
|
9414
9608
|
},
|
|
9415
9609
|
isOpen: innerIsOpen,
|
|
9416
9610
|
menu: /*#__PURE__*/(0,jsx_runtime.jsx)(react_menu_esm, {
|
|
@@ -9418,6 +9612,7 @@ function SearchSelect(props) {
|
|
|
9418
9612
|
style: {
|
|
9419
9613
|
minHeight: 25,
|
|
9420
9614
|
maxHeight: 280,
|
|
9615
|
+
minWidth: 200,
|
|
9421
9616
|
overflowY: 'scroll',
|
|
9422
9617
|
width: divRef.current ? divRef.current.offsetWidth : 'auto'
|
|
9423
9618
|
},
|
|
@@ -9427,15 +9622,17 @@ function SearchSelect(props) {
|
|
|
9427
9622
|
fontSize: 12
|
|
9428
9623
|
},
|
|
9429
9624
|
children: loading ? '正在加载数据...' : '没有数据'
|
|
9430
|
-
}) : option.map(function (item
|
|
9431
|
-
var
|
|
9625
|
+
}) : option.map(function (item) {
|
|
9626
|
+
var index = selectedValue.findIndex(function (finds) {
|
|
9627
|
+
return finds.value === item.value;
|
|
9628
|
+
});
|
|
9432
9629
|
return /*#__PURE__*/(0,jsx_runtime.jsx)(react_menu_esm.Item, {
|
|
9433
|
-
active:
|
|
9630
|
+
active: index !== -1,
|
|
9434
9631
|
text: item.label,
|
|
9435
9632
|
onClick: function onClick() {
|
|
9436
|
-
return handleItemClick(item);
|
|
9633
|
+
return isMultiple ? handleItemsClick(index, item) : handleItemClick(item);
|
|
9437
9634
|
}
|
|
9438
|
-
},
|
|
9635
|
+
}, index);
|
|
9439
9636
|
})
|
|
9440
9637
|
}),
|
|
9441
9638
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
@@ -9446,8 +9643,61 @@ function SearchSelect(props) {
|
|
|
9446
9643
|
onMouseLeave: function onMouseLeave() {
|
|
9447
9644
|
return renderSelectIcon('leave');
|
|
9448
9645
|
},
|
|
9449
|
-
style:
|
|
9450
|
-
|
|
9646
|
+
style: _extends({
|
|
9647
|
+
width: '100%',
|
|
9648
|
+
maxWidth: 'none'
|
|
9649
|
+
}, style),
|
|
9650
|
+
children: isMultiple ? /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
9651
|
+
className: prefixCls + "-inner",
|
|
9652
|
+
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
9653
|
+
style: {
|
|
9654
|
+
display: 'flex',
|
|
9655
|
+
flexFlow: 'wrap'
|
|
9656
|
+
},
|
|
9657
|
+
children: [isMultiple && selectedValue.slice(0, maxTagCount).map(function (item, index) {
|
|
9658
|
+
return /*#__PURE__*/(0,jsx_runtime.jsx)(react_tag_esm, {
|
|
9659
|
+
style: {
|
|
9660
|
+
height: 20,
|
|
9661
|
+
margin: 1,
|
|
9662
|
+
display: 'flex',
|
|
9663
|
+
alignItems: 'center'
|
|
9664
|
+
},
|
|
9665
|
+
className: prefixCls + "-tag",
|
|
9666
|
+
closable: true,
|
|
9667
|
+
onClose: function onClose() {
|
|
9668
|
+
return handleItemsClick(index, item);
|
|
9669
|
+
},
|
|
9670
|
+
color: "#ccc",
|
|
9671
|
+
children: item.label
|
|
9672
|
+
}, index);
|
|
9673
|
+
}), !!omitTagCount && /*#__PURE__*/(0,jsx_runtime.jsxs)(react_tag_esm, {
|
|
9674
|
+
style: {
|
|
9675
|
+
height: 20,
|
|
9676
|
+
margin: 1,
|
|
9677
|
+
display: 'flex',
|
|
9678
|
+
alignItems: 'center'
|
|
9679
|
+
},
|
|
9680
|
+
disabled: true,
|
|
9681
|
+
children: ["+", omitTagCount, " \u2026", ' ']
|
|
9682
|
+
}), /*#__PURE__*/(0,jsx_runtime.jsx)(react_input_esm, {
|
|
9683
|
+
style: {
|
|
9684
|
+
flex: 1
|
|
9685
|
+
},
|
|
9686
|
+
className: prefixCls + "-input-contents",
|
|
9687
|
+
readOnly: !showSearch,
|
|
9688
|
+
size: size,
|
|
9689
|
+
disabled: disabled,
|
|
9690
|
+
onKeyDown: inputKeyDown,
|
|
9691
|
+
onChange: handleInputChange,
|
|
9692
|
+
value: selectedLabel,
|
|
9693
|
+
placeholder: selectedValue.length ? '' : placeholder
|
|
9694
|
+
})]
|
|
9695
|
+
}), (selectIconType === 'close' || selectIconType === 'loading' && loading) && /*#__PURE__*/(0,jsx_runtime.jsx)(Icon, {
|
|
9696
|
+
type: selectIconType,
|
|
9697
|
+
spin: loading && selectIconType === 'loading',
|
|
9698
|
+
onClick: resetSelectedValue
|
|
9699
|
+
})]
|
|
9700
|
+
}) : /*#__PURE__*/(0,jsx_runtime.jsx)(react_input_esm, {
|
|
9451
9701
|
readOnly: !showSearch,
|
|
9452
9702
|
size: size,
|
|
9453
9703
|
disabled: disabled,
|
|
@@ -10702,83 +10952,6 @@ function Tabs(props) {
|
|
|
10702
10952
|
})]
|
|
10703
10953
|
}));
|
|
10704
10954
|
}
|
|
10705
|
-
;// CONCATENATED MODULE: ../react-tag/esm/style/index.css
|
|
10706
|
-
// extracted by mini-css-extract-plugin
|
|
10707
|
-
/* harmony default export */ var react_tag_esm_style = ({});
|
|
10708
|
-
;// CONCATENATED MODULE: ../react-tag/esm/index.js
|
|
10709
|
-
|
|
10710
|
-
|
|
10711
|
-
var react_tag_esm_excluded = ["prefixCls", "className", "style", "title", "children", "visible", "color", "disabled", "bordered", "closable", "light", "onClose"];
|
|
10712
|
-
|
|
10713
|
-
|
|
10714
|
-
|
|
10715
|
-
|
|
10716
|
-
/* harmony default export */ var react_tag_esm = (function (props) {
|
|
10717
|
-
if (props === void 0) {
|
|
10718
|
-
props = {};
|
|
10719
|
-
}
|
|
10720
|
-
|
|
10721
|
-
var _props = props,
|
|
10722
|
-
_props$prefixCls = _props.prefixCls,
|
|
10723
|
-
prefixCls = _props$prefixCls === void 0 ? 'w-tag' : _props$prefixCls,
|
|
10724
|
-
className = _props.className,
|
|
10725
|
-
style = _props.style,
|
|
10726
|
-
_props$title = _props.title,
|
|
10727
|
-
title = _props$title === void 0 ? '' : _props$title,
|
|
10728
|
-
children = _props.children,
|
|
10729
|
-
_props$visible = _props.visible,
|
|
10730
|
-
visible = _props$visible === void 0 ? true : _props$visible,
|
|
10731
|
-
_props$color = _props.color,
|
|
10732
|
-
color = _props$color === void 0 ? '#6E6E6E' : _props$color,
|
|
10733
|
-
_props$disabled = _props.disabled,
|
|
10734
|
-
disabled = _props$disabled === void 0 ? false : _props$disabled,
|
|
10735
|
-
_props$bordered = _props.bordered,
|
|
10736
|
-
bordered = _props$bordered === void 0 ? true : _props$bordered,
|
|
10737
|
-
closable = _props.closable,
|
|
10738
|
-
_props$light = _props.light,
|
|
10739
|
-
light = _props$light === void 0 ? false : _props$light,
|
|
10740
|
-
onClose = _props.onClose,
|
|
10741
|
-
other = _objectWithoutPropertiesLoose(props, react_tag_esm_excluded);
|
|
10742
|
-
|
|
10743
|
-
var cls = [prefixCls, className, light ? prefixCls + "-light" : null, disabled ? 'disabled' : null].filter(Boolean).join(' ').trim();
|
|
10744
|
-
|
|
10745
|
-
var styl = _extends({}, style);
|
|
10746
|
-
|
|
10747
|
-
if (!light) {
|
|
10748
|
-
styl.color = '#fff';
|
|
10749
|
-
styl.backgroundColor = color;
|
|
10750
|
-
} else {
|
|
10751
|
-
styl.color = color;
|
|
10752
|
-
styl.borderColor = color;
|
|
10753
|
-
|
|
10754
|
-
if (bordered && light) {
|
|
10755
|
-
styl.boxShadow = "inset 0 0 0 1px " + color;
|
|
10756
|
-
}
|
|
10757
|
-
}
|
|
10758
|
-
|
|
10759
|
-
if (!visible) {
|
|
10760
|
-
return null;
|
|
10761
|
-
}
|
|
10762
|
-
|
|
10763
|
-
var closeBtn = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo)(function () {
|
|
10764
|
-
return closable ? /*#__PURE__*/(0,jsx_runtime.jsx)("svg", {
|
|
10765
|
-
onClick: onClose,
|
|
10766
|
-
className: prefixCls + "-close",
|
|
10767
|
-
width: "15",
|
|
10768
|
-
height: "15",
|
|
10769
|
-
viewBox: "0 0 16 16",
|
|
10770
|
-
children: /*#__PURE__*/(0,jsx_runtime.jsx)("path", {
|
|
10771
|
-
d: "M9.41 8l2.29-2.29c.19-.18.3-.43.3-.71a1.003 1.003 0 0 0-1.71-.71L8 6.59l-2.29-2.3a1.003 1.003 0 0 0-1.42 1.42L6.59 8 4.3 10.29c-.19.18-.3.43-.3.71a1.003 1.003 0 0 0 1.71.71L8 9.41l2.29 2.29c.18.19.43.3.71.3a1.003 1.003 0 0 0 .71-1.71L9.41 8z"
|
|
10772
|
-
})
|
|
10773
|
-
}) : null;
|
|
10774
|
-
}, [closable]);
|
|
10775
|
-
return /*#__PURE__*/(0,jsx_runtime.jsxs)("span", _extends({
|
|
10776
|
-
className: cls,
|
|
10777
|
-
style: styl
|
|
10778
|
-
}, other, {
|
|
10779
|
-
children: [title || children, closeBtn]
|
|
10780
|
-
}));
|
|
10781
|
-
});
|
|
10782
10955
|
;// CONCATENATED MODULE: ../react-textarea/esm/style/index.css
|
|
10783
10956
|
// extracted by mini-css-extract-plugin
|
|
10784
10957
|
/* harmony default export */ var react_textarea_esm_style = ({});
|
|
@@ -11023,7 +11196,7 @@ var isContained = function isContained(a, b) {
|
|
|
11023
11196
|
return true;
|
|
11024
11197
|
};
|
|
11025
11198
|
|
|
11026
|
-
var getChildKeys = function getChildKeys(childs, result) {
|
|
11199
|
+
var getChildKeys = function getChildKeys(childs, result, depth) {
|
|
11027
11200
|
if (childs === void 0) {
|
|
11028
11201
|
childs = [];
|
|
11029
11202
|
}
|
|
@@ -11034,9 +11207,10 @@ var getChildKeys = function getChildKeys(childs, result) {
|
|
|
11034
11207
|
|
|
11035
11208
|
childs.forEach(function (item) {
|
|
11036
11209
|
result.push(item.key);
|
|
11210
|
+
if (typeof depth === 'number' && !(depth - 1)) return;
|
|
11037
11211
|
|
|
11038
11212
|
if (item.children && item.children.length > 0) {
|
|
11039
|
-
result = result.concat(getChildKeys(item.children));
|
|
11213
|
+
result = result.concat(getChildKeys(item.children, undefined, depth ? depth - 1 : undefined));
|
|
11040
11214
|
}
|
|
11041
11215
|
});
|
|
11042
11216
|
return result;
|
|
@@ -11124,6 +11298,8 @@ function Tree(props) {
|
|
|
11124
11298
|
_props$onSelected = props.onSelected,
|
|
11125
11299
|
onSelected = _props$onSelected === void 0 ? noop : _props$onSelected,
|
|
11126
11300
|
className = props.className,
|
|
11301
|
+
_props$autoExpandPare = props.autoExpandParent,
|
|
11302
|
+
autoExpandParent = _props$autoExpandPare === void 0 ? true : _props$autoExpandPare,
|
|
11127
11303
|
renderTitle = props.renderTitle,
|
|
11128
11304
|
elementProps = _objectWithoutPropertiesLoose(props, react_tree_esm_excluded);
|
|
11129
11305
|
|
|
@@ -11140,11 +11316,15 @@ function Tree(props) {
|
|
|
11140
11316
|
|
|
11141
11317
|
|
|
11142
11318
|
(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function () {
|
|
11143
|
-
var arrOpenKeys =
|
|
11319
|
+
var arrOpenKeys = [];
|
|
11144
11320
|
|
|
11145
11321
|
if (defaultExpandAll) {
|
|
11146
|
-
|
|
11322
|
+
arrOpenKeys = getChildKeys(data);
|
|
11323
|
+
} else if (autoExpandParent) {
|
|
11324
|
+
arrOpenKeys = getChildKeys(data, undefined, 1);
|
|
11147
11325
|
}
|
|
11326
|
+
|
|
11327
|
+
setCurOpenKeys(arrOpenKeys);
|
|
11148
11328
|
}, []);
|
|
11149
11329
|
var cls = [className, prefixCls, showLine ? prefixCls + "-line" : null].filter(Boolean).join(' ').trim();
|
|
11150
11330
|
|