uiw 4.11.3 → 4.11.4
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/uiw.css +42 -0
- package/dist/uiw.js +98 -72
- package/dist/uiw.min.css +1 -1
- package/dist/uiw.min.js +1 -1
- package/package.json +56 -56
package/dist/uiw.css
CHANGED
|
@@ -3788,6 +3788,8 @@ a.w-list-item:hover:not(.w-disabled) {
|
|
|
3788
3788
|
|
|
3789
3789
|
.w-search-select-input-contents input {
|
|
3790
3790
|
box-shadow: none;
|
|
3791
|
+
padding: 0px;
|
|
3792
|
+
height: 20px;
|
|
3791
3793
|
}
|
|
3792
3794
|
.w-search-select-input-contents .w-input-inner:hover {
|
|
3793
3795
|
box-shadow: none !important;
|
|
@@ -3795,6 +3797,46 @@ a.w-list-item:hover:not(.w-disabled) {
|
|
|
3795
3797
|
.w-search-select-input-contents .w-input-inner:focus {
|
|
3796
3798
|
box-shadow: none !important;
|
|
3797
3799
|
}
|
|
3800
|
+
.w-search-select-inner {
|
|
3801
|
+
display: flex;
|
|
3802
|
+
justify-content: space-between;
|
|
3803
|
+
outline: none;
|
|
3804
|
+
border: none;
|
|
3805
|
+
align-items: center;
|
|
3806
|
+
border-radius: 3px;
|
|
3807
|
+
box-shadow: 0 0 0 0 rgba(19, 124, 189, 0), 0 0 0 0 rgba(19, 124, 189, 0), inset 0 0 0 1px rgba(16, 22, 26, 0.15), inset 0 1px 1px rgba(16, 22, 26, 0.2);
|
|
3808
|
+
box-sizing: border-box;
|
|
3809
|
+
background: #fff;
|
|
3810
|
+
min-height: 30px;
|
|
3811
|
+
margin: 0 !important;
|
|
3812
|
+
padding: 3px 10px 3px 10px;
|
|
3813
|
+
vertical-align: middle;
|
|
3814
|
+
line-height: 30px;
|
|
3815
|
+
color: #393e48;
|
|
3816
|
+
font-weight: 400;
|
|
3817
|
+
font-size: inherit;
|
|
3818
|
+
transition: box-shadow 0.3s cubic-bezier(0.4, 1, 0.75, 0.9);
|
|
3819
|
+
-webkit-appearance: none;
|
|
3820
|
+
-moz-appearance: none;
|
|
3821
|
+
appearance: none;
|
|
3822
|
+
}
|
|
3823
|
+
.w-search-select-inner:focus {
|
|
3824
|
+
box-shadow: 0 0 0 1px #393e48, 0 0 0 3px rgba(57, 62, 72, 0.17), inset 0 1px 1px rgba(16, 22, 26, 0.2);
|
|
3825
|
+
}
|
|
3826
|
+
.w-search-select-inner:hover {
|
|
3827
|
+
box-shadow: 0 0 0 1px #6e6e6e, 0 0 0 3px rgba(57, 62, 72, 0), inset 0 1px 1px rgba(16, 22, 26, 0.2);
|
|
3828
|
+
}
|
|
3829
|
+
.w-search-select-inner:focus.w-search-select-inner:hover {
|
|
3830
|
+
box-shadow: 0 0 0 1px #6e6e6e, 0 0 0 3px rgba(57, 62, 72, 0.17), inset 0 1px 1px rgba(16, 22, 26, 0.2);
|
|
3831
|
+
}
|
|
3832
|
+
.w-search-select-inner:disabled {
|
|
3833
|
+
box-shadow: none;
|
|
3834
|
+
background: #dddddd;
|
|
3835
|
+
opacity: 0.75;
|
|
3836
|
+
color: #a5a5a5;
|
|
3837
|
+
cursor: not-allowed;
|
|
3838
|
+
resize: none;
|
|
3839
|
+
}
|
|
3798
3840
|
|
|
3799
3841
|
.w-split {
|
|
3800
3842
|
height: 100%;
|
package/dist/uiw.js
CHANGED
|
@@ -9391,7 +9391,7 @@ var react_tag_esm_excluded = ["prefixCls", "className", "style", "title", "child
|
|
|
9391
9391
|
|
|
9392
9392
|
|
|
9393
9393
|
|
|
9394
|
-
var react_search_select_esm_excluded = ["allowClear", "disabled", "size", "maxTagCount", "option", "loading", "prefixCls", "className", "mode", "style", "isOpen", "value", "defaultValue", "showSearch", "placeholder", "onSearch", "onChange", "onSelect"];
|
|
9394
|
+
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"];
|
|
9395
9395
|
|
|
9396
9396
|
|
|
9397
9397
|
|
|
@@ -9416,6 +9416,8 @@ function SearchSelect(props) {
|
|
|
9416
9416
|
option = _props$option === void 0 ? [] : _props$option,
|
|
9417
9417
|
_props$loading = props.loading,
|
|
9418
9418
|
loading = _props$loading === void 0 ? false : _props$loading,
|
|
9419
|
+
_props$labelInValue = props.labelInValue,
|
|
9420
|
+
labelInValue = _props$labelInValue === void 0 ? false : _props$labelInValue,
|
|
9419
9421
|
_props$prefixCls = props.prefixCls,
|
|
9420
9422
|
prefixCls = _props$prefixCls === void 0 ? 'w-search-select' : _props$prefixCls,
|
|
9421
9423
|
className = props.className,
|
|
@@ -9475,24 +9477,34 @@ function SearchSelect(props) {
|
|
|
9475
9477
|
}
|
|
9476
9478
|
}, [JSON.stringify(value)]);
|
|
9477
9479
|
|
|
9480
|
+
var getSelectOption = function getSelectOption(option, value) {
|
|
9481
|
+
var findResult = option.find(function (item) {
|
|
9482
|
+
return item.value === value;
|
|
9483
|
+
});
|
|
9484
|
+
return findResult;
|
|
9485
|
+
};
|
|
9486
|
+
|
|
9478
9487
|
function selectedValueChange(changeValue) {
|
|
9479
9488
|
var opts = [];
|
|
9480
9489
|
|
|
9481
|
-
if (
|
|
9482
|
-
|
|
9483
|
-
|
|
9484
|
-
|
|
9490
|
+
if (labelInValue) {
|
|
9491
|
+
if (Array.isArray(changeValue)) {
|
|
9492
|
+
opts = changeValue;
|
|
9493
|
+
} else {
|
|
9494
|
+
opts.push(changeValue);
|
|
9495
|
+
}
|
|
9496
|
+
} else {
|
|
9497
|
+
if (Array.isArray(changeValue)) {
|
|
9498
|
+
opts = changeValue.map(function (v) {
|
|
9499
|
+
return getSelectOption(option, v);
|
|
9485
9500
|
});
|
|
9486
|
-
|
|
9487
|
-
|
|
9488
|
-
} else if (!isMultiple) {
|
|
9489
|
-
var findResult = option.find(function (item) {
|
|
9490
|
-
return item.value === changeValue;
|
|
9491
|
-
});
|
|
9501
|
+
} else {
|
|
9502
|
+
var findResult = getSelectOption(option, changeValue);
|
|
9492
9503
|
|
|
9493
|
-
|
|
9494
|
-
|
|
9495
|
-
|
|
9504
|
+
if (findResult) {
|
|
9505
|
+
setSelectedLabel(findResult.label);
|
|
9506
|
+
opts.push(findResult);
|
|
9507
|
+
}
|
|
9496
9508
|
}
|
|
9497
9509
|
}
|
|
9498
9510
|
|
|
@@ -9513,10 +9525,10 @@ function SearchSelect(props) {
|
|
|
9513
9525
|
var values = [item];
|
|
9514
9526
|
setSelectedLabel(item.label);
|
|
9515
9527
|
var resultValue = item.value;
|
|
9516
|
-
value === undefined && setSelectedValue(values); // 如果存在props.value,内部不维护value状态
|
|
9517
|
-
|
|
9518
9528
|
onSelect && onSelect(resultValue);
|
|
9519
|
-
handleSelectChange(resultValue); // 支持form组件
|
|
9529
|
+
handleSelectChange(resultValue, values); // 支持form组件
|
|
9530
|
+
|
|
9531
|
+
value === undefined && setSelectedValue(values); // 如果存在props.value,内部不维护value状态
|
|
9520
9532
|
}
|
|
9521
9533
|
|
|
9522
9534
|
function handleItemsClick(item) {
|
|
@@ -9534,9 +9546,10 @@ function SearchSelect(props) {
|
|
|
9534
9546
|
var resultValue = values.map(function (item) {
|
|
9535
9547
|
return item.value;
|
|
9536
9548
|
});
|
|
9537
|
-
value === undefined && setSelectedValue(values);
|
|
9538
9549
|
onSelect && onSelect(resultValue);
|
|
9539
|
-
handleSelectChange(resultValue); // 支持form组件
|
|
9550
|
+
handleSelectChange(resultValue, values); // 支持form组件
|
|
9551
|
+
|
|
9552
|
+
value === undefined && setSelectedValue(values);
|
|
9540
9553
|
} // 渲染icon
|
|
9541
9554
|
|
|
9542
9555
|
|
|
@@ -9567,15 +9580,16 @@ function SearchSelect(props) {
|
|
|
9567
9580
|
setSelectedValue([]);
|
|
9568
9581
|
setSelectedLabel('');
|
|
9569
9582
|
setSelectIconType('');
|
|
9570
|
-
handleSelectChange('');
|
|
9583
|
+
handleSelectChange('', []);
|
|
9571
9584
|
}
|
|
9572
9585
|
|
|
9573
|
-
function handleSelectChange(value) {
|
|
9574
|
-
|
|
9586
|
+
function handleSelectChange(value, options) {
|
|
9587
|
+
if (!onChange) return;
|
|
9588
|
+
onChange(labelInValue ? options : value);
|
|
9575
9589
|
}
|
|
9576
9590
|
|
|
9577
9591
|
function inputKeyDown(e) {
|
|
9578
|
-
if (selectedValue.length > 0 &&
|
|
9592
|
+
if (isMultiple && selectedValue.length > 0 && !selectedLabel && e.keyCode === 8) {
|
|
9579
9593
|
var values = removeSelectItem(selectedValue.length - 1);
|
|
9580
9594
|
setSelectedValue(values);
|
|
9581
9595
|
}
|
|
@@ -9599,7 +9613,7 @@ function SearchSelect(props) {
|
|
|
9599
9613
|
style: {
|
|
9600
9614
|
minHeight: 25,
|
|
9601
9615
|
maxHeight: 280,
|
|
9602
|
-
minWidth:
|
|
9616
|
+
minWidth: 200,
|
|
9603
9617
|
overflowY: 'scroll',
|
|
9604
9618
|
width: divRef.current ? divRef.current.offsetWidth : 'auto'
|
|
9605
9619
|
},
|
|
@@ -9609,15 +9623,13 @@ function SearchSelect(props) {
|
|
|
9609
9623
|
fontSize: 12
|
|
9610
9624
|
},
|
|
9611
9625
|
children: loading ? '正在加载数据...' : '没有数据'
|
|
9612
|
-
}) : option.map(function (
|
|
9613
|
-
var active = !!selectedValue.
|
|
9614
|
-
return finds.value === item.value;
|
|
9615
|
-
});
|
|
9626
|
+
}) : option.map(function (opt, idx) {
|
|
9627
|
+
var active = !!getSelectOption(selectedValue, opt.value);
|
|
9616
9628
|
return /*#__PURE__*/(0,jsx_runtime.jsx)(react_menu_esm.Item, {
|
|
9617
9629
|
active: active,
|
|
9618
|
-
text:
|
|
9630
|
+
text: opt.label,
|
|
9619
9631
|
onClick: function onClick() {
|
|
9620
|
-
return isMultiple ? handleItemsClick(
|
|
9632
|
+
return isMultiple ? handleItemsClick(opt) : handleItemClick(opt);
|
|
9621
9633
|
}
|
|
9622
9634
|
}, idx);
|
|
9623
9635
|
})
|
|
@@ -9634,54 +9646,68 @@ function SearchSelect(props) {
|
|
|
9634
9646
|
width: '100%',
|
|
9635
9647
|
maxWidth: 'none'
|
|
9636
9648
|
}, style),
|
|
9637
|
-
children: /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
9638
|
-
|
|
9639
|
-
|
|
9640
|
-
|
|
9641
|
-
|
|
9642
|
-
|
|
9643
|
-
|
|
9644
|
-
|
|
9645
|
-
|
|
9649
|
+
children: isMultiple ? /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
9650
|
+
className: prefixCls + "-inner",
|
|
9651
|
+
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
9652
|
+
style: {
|
|
9653
|
+
display: 'flex',
|
|
9654
|
+
flexFlow: 'wrap'
|
|
9655
|
+
},
|
|
9656
|
+
children: [isMultiple && selectedValue.slice(0, maxTagCount).map(function (item, index) {
|
|
9657
|
+
return /*#__PURE__*/(0,jsx_runtime.jsx)(react_tag_esm, {
|
|
9658
|
+
style: {
|
|
9659
|
+
height: 20,
|
|
9660
|
+
margin: 1,
|
|
9661
|
+
display: 'flex',
|
|
9662
|
+
alignItems: 'center'
|
|
9663
|
+
},
|
|
9664
|
+
className: prefixCls + "-tag",
|
|
9665
|
+
closable: true,
|
|
9666
|
+
onClose: function onClose() {
|
|
9667
|
+
return setSelectedValue(removeSelectItem(index));
|
|
9668
|
+
},
|
|
9669
|
+
color: "#ccc",
|
|
9670
|
+
children: item.label
|
|
9671
|
+
}, index);
|
|
9672
|
+
}), !!omitTagCount && /*#__PURE__*/(0,jsx_runtime.jsxs)(react_tag_esm, {
|
|
9646
9673
|
style: {
|
|
9647
|
-
|
|
9674
|
+
height: 20,
|
|
9675
|
+
margin: 1,
|
|
9648
9676
|
display: 'flex',
|
|
9649
9677
|
alignItems: 'center'
|
|
9650
9678
|
},
|
|
9651
|
-
|
|
9652
|
-
|
|
9653
|
-
|
|
9679
|
+
disabled: true,
|
|
9680
|
+
children: ["+", omitTagCount, " \u2026", ' ']
|
|
9681
|
+
}), /*#__PURE__*/(0,jsx_runtime.jsx)(react_input_esm, {
|
|
9682
|
+
style: {
|
|
9683
|
+
flex: 1
|
|
9654
9684
|
},
|
|
9655
|
-
|
|
9656
|
-
|
|
9657
|
-
|
|
9658
|
-
|
|
9659
|
-
|
|
9660
|
-
|
|
9661
|
-
|
|
9662
|
-
|
|
9663
|
-
}
|
|
9664
|
-
|
|
9665
|
-
|
|
9666
|
-
|
|
9667
|
-
|
|
9668
|
-
flex: 1,
|
|
9669
|
-
boxShadow: 'none'
|
|
9670
|
-
},
|
|
9671
|
-
className: isMultiple ? prefixCls + "-input-contents" : undefined,
|
|
9672
|
-
readOnly: !showSearch,
|
|
9673
|
-
size: size,
|
|
9674
|
-
disabled: disabled,
|
|
9675
|
-
onKeyDown: inputKeyDown,
|
|
9676
|
-
onChange: handleInputChange,
|
|
9677
|
-
value: selectedLabel,
|
|
9678
|
-
placeholder: placeholder,
|
|
9679
|
-
addonAfter: (selectIconType === 'close' || selectIconType === 'loading' && loading) && /*#__PURE__*/(0,jsx_runtime.jsx)(Icon, {
|
|
9680
|
-
type: selectIconType,
|
|
9681
|
-
spin: loading && selectIconType === 'loading',
|
|
9682
|
-
onClick: resetSelectedValue
|
|
9683
|
-
})
|
|
9685
|
+
className: prefixCls + "-input-contents",
|
|
9686
|
+
readOnly: !showSearch,
|
|
9687
|
+
size: size,
|
|
9688
|
+
disabled: disabled,
|
|
9689
|
+
onKeyDown: inputKeyDown,
|
|
9690
|
+
onChange: handleInputChange,
|
|
9691
|
+
value: selectedLabel,
|
|
9692
|
+
placeholder: selectedValue.length ? '' : placeholder
|
|
9693
|
+
})]
|
|
9694
|
+
}), (selectIconType === 'close' || selectIconType === 'loading' && loading) && /*#__PURE__*/(0,jsx_runtime.jsx)(Icon, {
|
|
9695
|
+
type: selectIconType,
|
|
9696
|
+
spin: loading && selectIconType === 'loading',
|
|
9697
|
+
onClick: resetSelectedValue
|
|
9684
9698
|
})]
|
|
9699
|
+
}) : /*#__PURE__*/(0,jsx_runtime.jsx)(react_input_esm, {
|
|
9700
|
+
readOnly: !showSearch,
|
|
9701
|
+
size: size,
|
|
9702
|
+
disabled: disabled,
|
|
9703
|
+
onChange: handleInputChange,
|
|
9704
|
+
value: selectedLabel,
|
|
9705
|
+
placeholder: placeholder,
|
|
9706
|
+
addonAfter: (selectIconType === 'close' || selectIconType === 'loading' && loading) && /*#__PURE__*/(0,jsx_runtime.jsx)(Icon, {
|
|
9707
|
+
type: selectIconType,
|
|
9708
|
+
spin: loading && selectIconType === 'loading',
|
|
9709
|
+
onClick: resetSelectedValue
|
|
9710
|
+
})
|
|
9685
9711
|
})
|
|
9686
9712
|
})
|
|
9687
9713
|
}));
|