diginet-core-ui 1.3.71 → 1.3.72
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.
|
@@ -104,7 +104,8 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
104
104
|
dropdownItemStyle,
|
|
105
105
|
searchExpr,
|
|
106
106
|
searchMode,
|
|
107
|
-
maximumSelectionLength
|
|
107
|
+
maximumSelectionLength,
|
|
108
|
+
multilineSelectedItem
|
|
108
109
|
}, reference) => {
|
|
109
110
|
if (multiple && selectBox === undefined) selectBox = true;
|
|
110
111
|
if (typeof searchExpr === 'string') searchExpr = [searchExpr];
|
|
@@ -144,7 +145,7 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
144
145
|
|
|
145
146
|
const _IconCSS = IconCSS(viewType, loading, showClear);
|
|
146
147
|
|
|
147
|
-
const _DropdownFormCSS = DropdownFormCSS(viewType, multiple, disabled, _DropdownInputCSS.name);
|
|
148
|
+
const _DropdownFormCSS = DropdownFormCSS(viewType, multiple, disabled, placeholder, _DropdownInputCSS.name);
|
|
148
149
|
|
|
149
150
|
const _DropdownListCSS = DropdownListCSS(loading);
|
|
150
151
|
|
|
@@ -189,8 +190,8 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
189
190
|
if ((typeof renderSelectedItem === 'function' || iconExpr && iconExpr !== 'none') && !multiple) {
|
|
190
191
|
var _inputRef$current$chi;
|
|
191
192
|
|
|
192
|
-
inputRef.current.innerHTML = inputRef.current.textContent.trim();
|
|
193
|
-
|
|
193
|
+
inputRef.current.innerHTML = inputRef.current.textContent.trim(); // if (!allowSearch) inputRef.current.contentEditable = true;
|
|
194
|
+
|
|
194
195
|
const caret = (_inputRef$current$chi = inputRef.current.childNodes) !== null && _inputRef$current$chi !== void 0 && _inputRef$current$chi.length ? 1 : 0;
|
|
195
196
|
const range = document.createRange();
|
|
196
197
|
range.setStart(inputRef.current, caret);
|
|
@@ -900,6 +901,10 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
900
901
|
|
|
901
902
|
if (closeAfterSelect === true || closeAfterSelect === undefined && !multiple) {
|
|
902
903
|
closeDropdown();
|
|
904
|
+
} else {
|
|
905
|
+
setTimeout(() => {
|
|
906
|
+
updatePositionDropdown();
|
|
907
|
+
}, 0);
|
|
903
908
|
}
|
|
904
909
|
}; // const onChangeValueWithCheckbox = e => {
|
|
905
910
|
// const firstChild = e.currentTarget.firstChild;
|
|
@@ -1098,7 +1103,7 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
1098
1103
|
const icon = getIconFromData(data);
|
|
1099
1104
|
const valueWithIcon = jsx(Fragment, null, icon && icon, jsx(Typography, {
|
|
1100
1105
|
type: 'p1',
|
|
1101
|
-
lineClamp: 1,
|
|
1106
|
+
lineClamp: multilineSelectedItem ? undefined : 1,
|
|
1102
1107
|
hoverTooltip: !_isMobile
|
|
1103
1108
|
}, text));
|
|
1104
1109
|
const el = document.createElement('div');
|
|
@@ -1220,11 +1225,12 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
1220
1225
|
inputRef.current.addEventListener('click', onClickInput);
|
|
1221
1226
|
inputRef.current.addEventListener('input', onChangeInput);
|
|
1222
1227
|
!!onLoadMore && dropdownListRef.current && dropdownListRef.current.addEventListener('scroll', onLoadMoreHandler);
|
|
1223
|
-
} else {
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
}
|
|
1228
|
+
} // else {
|
|
1229
|
+
// if (multiple || allowSearch) {
|
|
1230
|
+
// inputRef.current.contentEditable = false;
|
|
1231
|
+
// }
|
|
1232
|
+
// }
|
|
1233
|
+
|
|
1228
1234
|
|
|
1229
1235
|
if (disabled || readOnly || children) {
|
|
1230
1236
|
inputRef.current.addEventListener('keydown', onPreventKeyDownHandler);
|
|
@@ -1238,11 +1244,12 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
1238
1244
|
if (!readOnly && !disabled) {
|
|
1239
1245
|
inputRef.current.removeEventListener('click', onClickInput);
|
|
1240
1246
|
inputRef.current.removeEventListener('input', onChangeInput);
|
|
1241
|
-
} else {
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
}
|
|
1247
|
+
} // else {
|
|
1248
|
+
// if (multiple && !allowSearch) {
|
|
1249
|
+
// inputRef.current.contentEditable = true;
|
|
1250
|
+
// }
|
|
1251
|
+
// }
|
|
1252
|
+
|
|
1246
1253
|
|
|
1247
1254
|
if (disabled || readOnly || children) {
|
|
1248
1255
|
inputRef.current.removeEventListener('keydown', onPreventKeyDownHandler);
|
|
@@ -1379,7 +1386,7 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
1379
1386
|
|
|
1380
1387
|
return item;
|
|
1381
1388
|
})) : typeof renderSelectedItem === 'function' || iconExpr && iconExpr !== 'none' ? jsx("div", { ...inputProps,
|
|
1382
|
-
contentEditable
|
|
1389
|
+
// contentEditable={!disabled && !allowSearch}
|
|
1383
1390
|
style: inputStyle,
|
|
1384
1391
|
ref: inputRef,
|
|
1385
1392
|
css: _DropdownInputCSS,
|
|
@@ -1390,22 +1397,13 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
1390
1397
|
return false;
|
|
1391
1398
|
}
|
|
1392
1399
|
}
|
|
1393
|
-
}) : jsx(Fragment, null, jsx(
|
|
1394
|
-
style: openState || !textValue ? inputStyle : { ...inputStyle,
|
|
1395
|
-
visibility: 'hidden'
|
|
1396
|
-
},
|
|
1400
|
+
}) : jsx(Fragment, null, jsx(Typography, {
|
|
1397
1401
|
ref: inputRef,
|
|
1398
1402
|
css: _DropdownInputCSS,
|
|
1399
|
-
type: "text",
|
|
1400
|
-
placeholder: placeholder,
|
|
1401
|
-
disabled: disabled || allowSearch
|
|
1402
|
-
}), !openState && textValue && jsx(Typography, {
|
|
1403
1403
|
hoverTooltip: true,
|
|
1404
|
-
lineClamp: 1,
|
|
1404
|
+
lineClamp: multilineSelectedItem ? undefined : 1,
|
|
1405
1405
|
type: 'p1',
|
|
1406
|
-
css: _DropdownInputCSS,
|
|
1407
1406
|
style: {
|
|
1408
|
-
position: 'absolute',
|
|
1409
1407
|
lineHeight: '24px'
|
|
1410
1408
|
},
|
|
1411
1409
|
onClick: onClickInput
|
|
@@ -1433,7 +1431,7 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
1433
1431
|
},
|
|
1434
1432
|
disabled: disabled || readOnly
|
|
1435
1433
|
})));
|
|
1436
|
-
}, [viewType, inputProps, inputStyle, multiple, clearAble, onChange, disabled, readOnly, loading, renderSelectedItem, placeholder, dataSource, valueObjectDefault, valueExpr, displayExpr, openState, showClear, textValue, valueMulti]);
|
|
1434
|
+
}, [viewType, inputProps, inputStyle, multiple, clearAble, onChange, disabled, readOnly, loading, renderSelectedItem, placeholder, dataSource, valueObjectDefault, valueExpr, displayExpr, multilineSelectedItem, openState, showClear, textValue, valueMulti]);
|
|
1437
1435
|
const ErrorView = useMemo(() => error && jsx(HelperText, {
|
|
1438
1436
|
disabled: disabled,
|
|
1439
1437
|
style: {
|
|
@@ -1445,7 +1443,7 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
1445
1443
|
}, error), [error, disabled, errorStyle]);
|
|
1446
1444
|
const DropdownView = useMemo(() => {
|
|
1447
1445
|
return openState ? /*#__PURE__*/createPortal(showDropdown(), document.body) : null;
|
|
1448
|
-
}, [openState, valueMulti, dataSource, loading, multiple, selectBox, maximumSelectionLength]);
|
|
1446
|
+
}, [openState, valueMulti, dataSource, loading, multiple, selectBox, maximumSelectionLength, multilineSelectedItem]);
|
|
1449
1447
|
/* End component */
|
|
1450
1448
|
|
|
1451
1449
|
return jsx(Fragment, null, jsx("div", {
|
|
@@ -1528,7 +1526,7 @@ const IconCSS = (viewType, loading, showClear) => css`
|
|
|
1528
1526
|
}
|
|
1529
1527
|
`;
|
|
1530
1528
|
|
|
1531
|
-
const DropdownFormCSS = (viewType, multiple, disabled, DropdownInputCSSName) => viewType !== 'outlined' ? css`
|
|
1529
|
+
const DropdownFormCSS = (viewType, multiple, disabled, placeholder, DropdownInputCSSName) => viewType !== 'outlined' ? css`
|
|
1532
1530
|
${flexRow};
|
|
1533
1531
|
${alignCenter};
|
|
1534
1532
|
${positionRelative};
|
|
@@ -1561,6 +1559,10 @@ const DropdownFormCSS = (viewType, multiple, disabled, DropdownInputCSSName) =>
|
|
|
1561
1559
|
transform: rotateX(180deg);
|
|
1562
1560
|
}
|
|
1563
1561
|
}
|
|
1562
|
+
span:empty:before {
|
|
1563
|
+
content: '${placeholder}';
|
|
1564
|
+
color: ${sub};
|
|
1565
|
+
}
|
|
1564
1566
|
&::placeholder {
|
|
1565
1567
|
color: ${sub};
|
|
1566
1568
|
}
|
|
@@ -1793,7 +1795,8 @@ Dropdown.defaultProps = {
|
|
|
1793
1795
|
formStyle: {},
|
|
1794
1796
|
dataSource: [],
|
|
1795
1797
|
onInput: null,
|
|
1796
|
-
searchMode: 'contains'
|
|
1798
|
+
searchMode: 'contains',
|
|
1799
|
+
multilineSelectedItem: false
|
|
1797
1800
|
};
|
|
1798
1801
|
Dropdown.propTypes = {
|
|
1799
1802
|
/**The variant to use. */
|
|
@@ -1970,6 +1973,9 @@ Dropdown.propTypes = {
|
|
|
1970
1973
|
/** Set restrictions regarding the maximum number of options that can be selected. (Use with prop `multiple`) */
|
|
1971
1974
|
maximumSelectionLength: PropTypes.number,
|
|
1972
1975
|
|
|
1976
|
+
/** If `true`, show multi-line selected item(s). */
|
|
1977
|
+
multilineSelectedItem: PropTypes.bool,
|
|
1978
|
+
|
|
1973
1979
|
/**
|
|
1974
1980
|
* ref methods
|
|
1975
1981
|
*
|
|
@@ -430,10 +430,10 @@ TextInput.propTypes = {
|
|
|
430
430
|
/** Type of the input element. It should be [a valid HTML5 input type](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#Form_%3Cinput%3E_types). */
|
|
431
431
|
type: PropTypes.oneOf(['inform', 'edit', 'quickEdit', 'text', 'number', 'password']),
|
|
432
432
|
|
|
433
|
-
/** Validation value, argument can:<br/>
|
|
434
|
-
* * string: the validation rule. Example required.<br/>
|
|
435
|
-
* * object: the validation rule insist name, property, message. Example {name: 'min', compareValue: 9, message: 'Error'} or {max: 99}<br/>
|
|
436
|
-
* * array: the validation rule list, insist object/string
|
|
433
|
+
/** Validation value, argument can:<br/>
|
|
434
|
+
* * string: the validation rule. Example required.<br/>
|
|
435
|
+
* * object: the validation rule insist name, property, message. Example {name: 'min', compareValue: 9, message: 'Error'} or {max: 99}<br/>
|
|
436
|
+
* * array: the validation rule list, insist object/string
|
|
437
437
|
*/
|
|
438
438
|
validates: PropTypes.oneOfType([PropTypes.string, PropTypes.object, PropTypes.array, PropTypes.func]),
|
|
439
439
|
|
package/package.json
CHANGED