@activecollab/components 2.0.209 → 2.0.210
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/cjs/components/Autocomplete/Autocomplete.js +216 -79
- package/dist/cjs/components/Autocomplete/Autocomplete.js.map +1 -1
- package/dist/cjs/components/ComboBox/ComboBox.js +4 -2
- package/dist/cjs/components/ComboBox/ComboBox.js.map +1 -1
- package/dist/cjs/components/Input/InputTime.js +4 -2
- package/dist/cjs/components/Input/InputTime.js.map +1 -1
- package/dist/cjs/components/Select/OptionGroup/OptionGroup.js +5 -16
- package/dist/cjs/components/Select/OptionGroup/OptionGroup.js.map +1 -1
- package/dist/cjs/components/Select/OptionGroup/Styles.js +1 -1
- package/dist/cjs/components/Select/OptionGroup/Styles.js.map +1 -1
- package/dist/cjs/components/Select/Select.js +4 -2
- package/dist/cjs/components/Select/Select.js.map +1 -1
- package/dist/cjs/hooks/useHighlightText.js +1 -0
- package/dist/cjs/hooks/useHighlightText.js.map +1 -1
- package/dist/esm/components/Autocomplete/Autocomplete.d.ts +6 -3
- package/dist/esm/components/Autocomplete/Autocomplete.d.ts.map +1 -1
- package/dist/esm/components/Autocomplete/Autocomplete.js +189 -58
- package/dist/esm/components/Autocomplete/Autocomplete.js.map +1 -1
- package/dist/esm/components/ComboBox/ComboBox.d.ts.map +1 -1
- package/dist/esm/components/ComboBox/ComboBox.js +3 -1
- package/dist/esm/components/ComboBox/ComboBox.js.map +1 -1
- package/dist/esm/components/Input/InputTime.d.ts +1 -0
- package/dist/esm/components/Input/InputTime.d.ts.map +1 -1
- package/dist/esm/components/Input/InputTime.js +3 -1
- package/dist/esm/components/Input/InputTime.js.map +1 -1
- package/dist/esm/components/Select/OptionGroup/OptionGroup.d.ts.map +1 -1
- package/dist/esm/components/Select/OptionGroup/OptionGroup.js +5 -10
- package/dist/esm/components/Select/OptionGroup/OptionGroup.js.map +1 -1
- package/dist/esm/components/Select/OptionGroup/Styles.d.ts.map +1 -1
- package/dist/esm/components/Select/OptionGroup/Styles.js +1 -1
- package/dist/esm/components/Select/OptionGroup/Styles.js.map +1 -1
- package/dist/esm/components/Select/Select.d.ts +1 -0
- package/dist/esm/components/Select/Select.d.ts.map +1 -1
- package/dist/esm/components/Select/Select.js +3 -1
- package/dist/esm/components/Select/Select.js.map +1 -1
- package/dist/esm/hooks/useHighlightText.d.ts.map +1 -1
- package/dist/esm/hooks/useHighlightText.js +1 -0
- package/dist/esm/hooks/useHighlightText.js.map +1 -1
- package/dist/index.js +238 -104
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +1 -1
- package/dist/index.min.js.map +1 -1
- package/package.json +2 -1
package/dist/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react'), require('classnames'), require('styled-components'), require('resize-observer-polyfill'), require('react-focus-lock'), require('react-remove-scroll'), require('react-dom'), require('@popperjs/core'), require('react-transition-group'), require('moment'), require('date-fns'), require('react-day-picker'), require('moment-timezone'), require('react-
|
|
3
|
-
typeof define === 'function' && define.amd ? define(['exports', 'react', 'classnames', 'styled-components', 'resize-observer-polyfill', 'react-focus-lock', 'react-remove-scroll', 'react-dom', '@popperjs/core', 'react-transition-group', 'moment', 'date-fns', 'react-day-picker', 'moment-timezone', 'react-
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.components = {}, global.React, global.classNames, global.styled, global.ResizeObserver, global.FocusLock, global.reactRemoveScroll, global.ReactDOM, global.PopperJS, global.reactTransitionGroup, global.moment, global.DateFns, global.DayPicker, global["moment-timezone"], global.
|
|
5
|
-
})(this, (function (exports, React, classNames, styled, ResizeObserver, FocusLock, reactRemoveScroll, ReactDOM, core, reactTransitionGroup, moment, dateFns, reactDayPicker, moment$1,
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react'), require('classnames'), require('styled-components'), require('resize-observer-polyfill'), require('react-focus-lock'), require('react-remove-scroll'), require('react-dom'), require('@popperjs/core'), require('react-transition-group'), require('moment'), require('date-fns'), require('react-day-picker'), require('moment-timezone'), require('@tanstack/react-virtual'), require('country-explorer'), require('compromise'), require('compromise-dates')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define(['exports', 'react', 'classnames', 'styled-components', 'resize-observer-polyfill', 'react-focus-lock', 'react-remove-scroll', 'react-dom', '@popperjs/core', 'react-transition-group', 'moment', 'date-fns', 'react-day-picker', 'moment-timezone', '@tanstack/react-virtual', 'country-explorer', 'compromise', 'compromise-dates'], factory) :
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.components = {}, global.React, global.classNames, global.styled, global.ResizeObserver, global.FocusLock, global.reactRemoveScroll, global.ReactDOM, global.PopperJS, global.reactTransitionGroup, global.moment, global.DateFns, global.DayPicker, global["moment-timezone"], global.reactVirtual, global.countryExplorer, global.compromise, global.compromiseDates));
|
|
5
|
+
})(this, (function (exports, React, classNames, styled, ResizeObserver, FocusLock, reactRemoveScroll, ReactDOM, core, reactTransitionGroup, moment, dateFns, reactDayPicker, moment$1, reactVirtual, countryExplorer, nlp, plg) { 'use strict';
|
|
6
6
|
|
|
7
7
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
8
8
|
|
|
@@ -14970,6 +14970,7 @@
|
|
|
14970
14970
|
var matchCase = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
14971
14971
|
var textComparator = text;
|
|
14972
14972
|
var searchByComparator = searchBy;
|
|
14973
|
+
if (!text) return;
|
|
14973
14974
|
if (!matchCase) {
|
|
14974
14975
|
textComparator = text.toLowerCase();
|
|
14975
14976
|
searchByComparator = searchBy.toLowerCase();
|
|
@@ -15019,7 +15020,7 @@
|
|
|
15019
15020
|
var StyledOptionGroupLi = styled__default["default"].li.withConfig({
|
|
15020
15021
|
displayName: "Styles__StyledOptionGroupLi",
|
|
15021
15022
|
componentId: "sc-16v5afu-0"
|
|
15022
|
-
})(["flex-direction:column;"]);
|
|
15023
|
+
})(["flex-direction:column;cursor:pointer;"]);
|
|
15023
15024
|
var StyledOptionGroup = styled__default["default"].div.withConfig({
|
|
15024
15025
|
displayName: "Styles__StyledOptionGroup",
|
|
15025
15026
|
componentId: "sc-16v5afu-1"
|
|
@@ -15051,19 +15052,12 @@
|
|
|
15051
15052
|
options = _ref.options,
|
|
15052
15053
|
type = _ref.type,
|
|
15053
15054
|
hover = _ref.hover,
|
|
15054
|
-
filter = _ref.filter,
|
|
15055
15055
|
checked = _ref.checked,
|
|
15056
15056
|
onChange = _ref.onChange,
|
|
15057
15057
|
setHover = _ref.setHover,
|
|
15058
|
-
renderOptions = _ref.renderOptions,
|
|
15059
15058
|
optionGroupClassName = _ref.optionGroupClassName,
|
|
15060
15059
|
_ref$mixedOptions = _ref.mixedOptions,
|
|
15061
15060
|
mixedOptions = _ref$mixedOptions === void 0 ? [] : _ref$mixedOptions;
|
|
15062
|
-
var list = React.useMemo(function () {
|
|
15063
|
-
return filter ? options.filter(function (v) {
|
|
15064
|
-
return v.name.toLowerCase().includes(filter.trim().toLowerCase());
|
|
15065
|
-
}) : options;
|
|
15066
|
-
}, [filter, options]);
|
|
15067
15061
|
React.useEffect(function () {
|
|
15068
15062
|
if (hover === id && type !== "single") {
|
|
15069
15063
|
var _document$getElementB;
|
|
@@ -15076,13 +15070,10 @@
|
|
|
15076
15070
|
});
|
|
15077
15071
|
}, [options, checked]);
|
|
15078
15072
|
var handleHover = React.useCallback(function () {
|
|
15079
|
-
if (options.some(function (option) {
|
|
15080
|
-
return checked.includes(option.id);
|
|
15081
|
-
})) return;
|
|
15082
15073
|
if (setHover) {
|
|
15083
15074
|
setHover(type === "single" ? undefined : id);
|
|
15084
15075
|
}
|
|
15085
|
-
}, [setHover, type, id
|
|
15076
|
+
}, [setHover, type, id]);
|
|
15086
15077
|
var allOptionValues = React.useMemo(function () {
|
|
15087
15078
|
return options.map(function (option) {
|
|
15088
15079
|
return option.id;
|
|
@@ -15097,6 +15088,7 @@
|
|
|
15097
15088
|
}, [allOptionValues, checked, isAllOptionsChecked, mixedOptions, options]);
|
|
15098
15089
|
var handleClick = React.useCallback(function (e) {
|
|
15099
15090
|
e.stopPropagation();
|
|
15091
|
+
e.preventDefault();
|
|
15100
15092
|
if (onChange) {
|
|
15101
15093
|
if (isAllOptionsChecked) {
|
|
15102
15094
|
onChange(checked.filter(function (i) {
|
|
@@ -15113,7 +15105,8 @@
|
|
|
15113
15105
|
}, [allOptionValues, checked, isAllOptionsChecked, onChange]);
|
|
15114
15106
|
return /*#__PURE__*/React__default["default"].createElement(StyledOptionGroupLi, {
|
|
15115
15107
|
key: id,
|
|
15116
|
-
className: classNames__default["default"]("c-option-group", optionGroupClassName)
|
|
15108
|
+
className: classNames__default["default"]("c-option-group", optionGroupClassName),
|
|
15109
|
+
onClick: handleClick
|
|
15117
15110
|
}, /*#__PURE__*/React__default["default"].createElement(StyledOptionGroup, {
|
|
15118
15111
|
key: id
|
|
15119
15112
|
}, /*#__PURE__*/React__default["default"].createElement(StyledOptionGroupOption, {
|
|
@@ -15127,9 +15120,7 @@
|
|
|
15127
15120
|
mixed: isMixed,
|
|
15128
15121
|
onChange: handleClick,
|
|
15129
15122
|
type: "checkbox"
|
|
15130
|
-
})))
|
|
15131
|
-
return typeof renderOptions === "function" ? renderOptions(item, index) : item.name;
|
|
15132
|
-
}))));
|
|
15123
|
+
})))));
|
|
15133
15124
|
};
|
|
15134
15125
|
OptionGroup.displayName = "OptionGroup";
|
|
15135
15126
|
|
|
@@ -15165,9 +15156,11 @@
|
|
|
15165
15156
|
autoHeightMax = _ref$autoHeightMax === void 0 ? 340 : _ref$autoHeightMax,
|
|
15166
15157
|
clearInputOnSelect = _ref.clearInputOnSelect,
|
|
15167
15158
|
_ref$mixedOptions = _ref.mixedOptions,
|
|
15168
|
-
mixedOptions = _ref$mixedOptions === void 0 ? [] : _ref$mixedOptions
|
|
15159
|
+
mixedOptions = _ref$mixedOptions === void 0 ? [] : _ref$mixedOptions,
|
|
15160
|
+
filterCriteria = _ref.filterCriteria,
|
|
15161
|
+
disableVirtualization = _ref.disableVirtualization;
|
|
15162
|
+
var listContainerRef = React.useRef(null);
|
|
15169
15163
|
var itemRef = React.useRef(null);
|
|
15170
|
-
var listRef = React.useRef(null);
|
|
15171
15164
|
var selectedOptions = React.useMemo(function () {
|
|
15172
15165
|
if (Array.isArray(selected)) {
|
|
15173
15166
|
return selected;
|
|
@@ -15209,9 +15202,9 @@
|
|
|
15209
15202
|
} else {
|
|
15210
15203
|
return opts.sort(sortOptions);
|
|
15211
15204
|
}
|
|
15212
|
-
|
|
15213
|
-
|
|
15214
|
-
|
|
15205
|
+
},
|
|
15206
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
15207
|
+
[mixedOptions, selectedOptions]);
|
|
15215
15208
|
var sortList = React.useCallback(function (options) {
|
|
15216
15209
|
var _options$;
|
|
15217
15210
|
if (disabledInternalSort) {
|
|
@@ -15235,20 +15228,27 @@
|
|
|
15235
15228
|
return handleSort(_sortedOptions);
|
|
15236
15229
|
}
|
|
15237
15230
|
}, [sortDirection, disabledInternalSort, handleSort]);
|
|
15238
|
-
var
|
|
15239
|
-
|
|
15240
|
-
|
|
15241
|
-
|
|
15231
|
+
var _useState = React.useState(function () {
|
|
15232
|
+
return sortList(options);
|
|
15233
|
+
}),
|
|
15234
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
15235
|
+
sortedList = _useState2[0],
|
|
15236
|
+
setSortedList = _useState2[1];
|
|
15237
|
+
React.useEffect(function () {
|
|
15238
|
+
setSortedList(sortList(options));
|
|
15239
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
15240
|
+
}, [options]);
|
|
15241
|
+
var _useState3 = React.useState({
|
|
15242
15242
|
item: undefined,
|
|
15243
15243
|
by: undefined
|
|
15244
15244
|
}),
|
|
15245
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
15246
|
-
hover = _useState2[0],
|
|
15247
|
-
setHover = _useState2[1];
|
|
15248
|
-
var _useState3 = React.useState(""),
|
|
15249
15245
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
15250
|
-
|
|
15251
|
-
|
|
15246
|
+
hover = _useState4[0],
|
|
15247
|
+
setHover = _useState4[1];
|
|
15248
|
+
var _useState5 = React.useState(""),
|
|
15249
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
15250
|
+
filter = _useState6[0],
|
|
15251
|
+
setFilter = _useState6[1];
|
|
15252
15252
|
var handleEmpty = React.useCallback(function (e) {
|
|
15253
15253
|
if (e && e.button !== 0) {
|
|
15254
15254
|
return;
|
|
@@ -15276,24 +15276,20 @@
|
|
|
15276
15276
|
return option.name.toLowerCase() !== filter.trim().toLowerCase();
|
|
15277
15277
|
}));
|
|
15278
15278
|
}, [emptyValue, filter, options]);
|
|
15279
|
-
var renderAddNew = React.useMemo(function () {
|
|
15280
|
-
return /*#__PURE__*/React__default["default"].createElement(StyledAutocompleteNewItem, {
|
|
15281
|
-
ref: hover.item === "addNew" ? itemRef : null,
|
|
15282
|
-
key: "emptyValue",
|
|
15283
|
-
hover: hover.item === "addNew",
|
|
15284
|
-
onMouseDown: handleEmpty,
|
|
15285
|
-
onMouseEnter: onAddNewMouseEnter
|
|
15286
|
-
}, emptyValue);
|
|
15287
|
-
}, [emptyValue, handleEmpty, hover, onAddNewMouseEnter]);
|
|
15288
15279
|
var filterOptions = React.useCallback(function (options, filter) {
|
|
15289
15280
|
var trimmedFilter = filter.trim();
|
|
15290
15281
|
var isGrouped = options[0] && isOptionGroup(options[0]);
|
|
15282
|
+
var matchesFilter = function matchesFilter(option) {
|
|
15283
|
+
var nameMatch = option.name.toLowerCase().includes(trimmedFilter.toLowerCase());
|
|
15284
|
+
if (filterCriteria && trimmedFilter) {
|
|
15285
|
+
return nameMatch || filterCriteria(option, trimmedFilter);
|
|
15286
|
+
}
|
|
15287
|
+
return nameMatch;
|
|
15288
|
+
};
|
|
15291
15289
|
if (isGrouped) {
|
|
15292
15290
|
var hovered = false;
|
|
15293
15291
|
return options.reduce(function (acc, groupedOption) {
|
|
15294
|
-
var filteredOptions = groupedOption.options.filter(
|
|
15295
|
-
return v.name.toLowerCase().includes(trimmedFilter.toLowerCase());
|
|
15296
|
-
});
|
|
15292
|
+
var filteredOptions = groupedOption.options.filter(matchesFilter);
|
|
15297
15293
|
if (filteredOptions.length > 0) {
|
|
15298
15294
|
if (!hovered && filter) {
|
|
15299
15295
|
setHover({
|
|
@@ -15309,9 +15305,7 @@
|
|
|
15309
15305
|
return [...acc];
|
|
15310
15306
|
}, []);
|
|
15311
15307
|
} else {
|
|
15312
|
-
var filteredOptions = options.filter(
|
|
15313
|
-
return v.name.toLowerCase().includes(trimmedFilter.toLowerCase());
|
|
15314
|
-
});
|
|
15308
|
+
var filteredOptions = options.filter(matchesFilter);
|
|
15315
15309
|
if (filter && filteredOptions.length > 0) {
|
|
15316
15310
|
setHover({
|
|
15317
15311
|
item: filteredOptions[0].id,
|
|
@@ -15326,7 +15320,7 @@
|
|
|
15326
15320
|
}
|
|
15327
15321
|
return filteredOptions;
|
|
15328
15322
|
}
|
|
15329
|
-
}, [emptyValue]);
|
|
15323
|
+
}, [emptyValue, filterCriteria]);
|
|
15330
15324
|
var list = React.useMemo(function () {
|
|
15331
15325
|
return filterOptions(sortedList, filter);
|
|
15332
15326
|
}, [filter, filterOptions, sortedList]);
|
|
@@ -15342,6 +15336,67 @@
|
|
|
15342
15336
|
}, []);
|
|
15343
15337
|
return filterOptions(options, filter);
|
|
15344
15338
|
}, [filter, filterOptions, list]);
|
|
15339
|
+
var showNoResultCondition = React.useMemo(function () {
|
|
15340
|
+
return noResultText && !showAddNew && list.length < 1 && (defaultValue && filter || !defaultValue);
|
|
15341
|
+
}, [noResultText, showAddNew, list.length, defaultValue, filter]);
|
|
15342
|
+
var virtualItems = React.useMemo(function () {
|
|
15343
|
+
var items = [];
|
|
15344
|
+
if (showDefaultOption) {
|
|
15345
|
+
items.push({
|
|
15346
|
+
type: "default",
|
|
15347
|
+
id: "default"
|
|
15348
|
+
});
|
|
15349
|
+
}
|
|
15350
|
+
list.forEach(function (item, index) {
|
|
15351
|
+
if (isOptionGroup(item)) {
|
|
15352
|
+
items.push({
|
|
15353
|
+
type: "group",
|
|
15354
|
+
id: item.id,
|
|
15355
|
+
item
|
|
15356
|
+
});
|
|
15357
|
+
item.options.forEach(function (option) {
|
|
15358
|
+
items.push({
|
|
15359
|
+
type: "option",
|
|
15360
|
+
id: option.id,
|
|
15361
|
+
item: option,
|
|
15362
|
+
index
|
|
15363
|
+
});
|
|
15364
|
+
});
|
|
15365
|
+
} else {
|
|
15366
|
+
items.push({
|
|
15367
|
+
type: "option",
|
|
15368
|
+
id: item.id,
|
|
15369
|
+
item,
|
|
15370
|
+
index
|
|
15371
|
+
});
|
|
15372
|
+
}
|
|
15373
|
+
});
|
|
15374
|
+
if (showNoResultCondition) {
|
|
15375
|
+
items.push({
|
|
15376
|
+
type: "noResult",
|
|
15377
|
+
id: "noResult"
|
|
15378
|
+
});
|
|
15379
|
+
}
|
|
15380
|
+
if (showAddNew) {
|
|
15381
|
+
items.push({
|
|
15382
|
+
type: "addNew",
|
|
15383
|
+
id: "addNew"
|
|
15384
|
+
});
|
|
15385
|
+
}
|
|
15386
|
+
return items;
|
|
15387
|
+
}, [list, showDefaultOption, showNoResultCondition, showAddNew]);
|
|
15388
|
+
var shouldUseVirtualization = !disableVirtualization && virtualItems.length > 40;
|
|
15389
|
+
var rowVirtualizer = reactVirtual.useVirtualizer({
|
|
15390
|
+
count: virtualItems.length,
|
|
15391
|
+
getScrollElement: function getScrollElement() {
|
|
15392
|
+
return listContainerRef.current;
|
|
15393
|
+
},
|
|
15394
|
+
estimateSize: function estimateSize() {
|
|
15395
|
+
return 28;
|
|
15396
|
+
},
|
|
15397
|
+
overscan: 5,
|
|
15398
|
+
gap: 4
|
|
15399
|
+
});
|
|
15345
15400
|
var handleInputChange = React.useCallback(function (e) {
|
|
15346
15401
|
if (e.target && !(e.key === "ArrowDown") && !(e.key === "ArrowUp") && !(e.key === "Enter")) {
|
|
15347
15402
|
setFilter(e.target.value);
|
|
@@ -15420,7 +15475,7 @@
|
|
|
15420
15475
|
}
|
|
15421
15476
|
return /*#__PURE__*/React__default["default"].createElement(Option, {
|
|
15422
15477
|
name: item.name,
|
|
15423
|
-
ref: itemRef,
|
|
15478
|
+
ref: hover.item === item.id ? itemRef : null,
|
|
15424
15479
|
key: index,
|
|
15425
15480
|
tooltip: item.tooltip,
|
|
15426
15481
|
onMouseEnter: handleMouseEnter,
|
|
@@ -15446,23 +15501,18 @@
|
|
|
15446
15501
|
by: "mouse"
|
|
15447
15502
|
});
|
|
15448
15503
|
}, []);
|
|
15449
|
-
var handleScroll = React.useCallback(function (list, itemOffset) {
|
|
15450
|
-
if (list.getClientHeight() + list.getScrollTop() < itemOffset + 40) {
|
|
15451
|
-
return list.scrollTop(itemOffset - list.getClientHeight() + 30);
|
|
15452
|
-
}
|
|
15453
|
-
if (list.getScrollTop() > itemOffset) {
|
|
15454
|
-
return list.scrollTop(itemOffset);
|
|
15455
|
-
}
|
|
15456
|
-
}, []);
|
|
15457
15504
|
React.useEffect(function () {
|
|
15458
15505
|
if (hover.by === "keyboard" && hover.item !== undefined) {
|
|
15459
|
-
var
|
|
15460
|
-
|
|
15461
|
-
|
|
15462
|
-
|
|
15506
|
+
var index = virtualItems.findIndex(function (item) {
|
|
15507
|
+
return item.id === hover.item;
|
|
15508
|
+
});
|
|
15509
|
+
if (index !== -1) {
|
|
15510
|
+
rowVirtualizer.scrollToIndex(index, {
|
|
15511
|
+
align: "center"
|
|
15512
|
+
});
|
|
15463
15513
|
}
|
|
15464
15514
|
}
|
|
15465
|
-
}, [
|
|
15515
|
+
}, [hover, rowVirtualizer, virtualItems]);
|
|
15466
15516
|
var handleOnKeyDown = React.useCallback(function (e) {
|
|
15467
15517
|
if (e.key === "Enter") {
|
|
15468
15518
|
e.preventDefault();
|
|
@@ -15505,48 +15555,126 @@
|
|
|
15505
15555
|
return selectedOptions[0] === null || selectedOptions.length === flatOptions.length;
|
|
15506
15556
|
}
|
|
15507
15557
|
}, [flatOptions.length, preselectDefaultValue, selectedOptions]);
|
|
15508
|
-
var
|
|
15509
|
-
|
|
15510
|
-
|
|
15511
|
-
|
|
15512
|
-
|
|
15513
|
-
|
|
15558
|
+
var renderVirtualItem = React.useCallback(function (virtualItem, index) {
|
|
15559
|
+
switch (virtualItem.type) {
|
|
15560
|
+
case "default":
|
|
15561
|
+
return /*#__PURE__*/React__default["default"].createElement(Option, {
|
|
15562
|
+
name: String(defaultValue),
|
|
15563
|
+
ref: hover.item === null ? itemRef : null,
|
|
15564
|
+
hover: hover.item === null,
|
|
15565
|
+
onMouseEnter: handleMouseEnter,
|
|
15566
|
+
onClick: function onClick(e) {
|
|
15567
|
+
e.preventDefault();
|
|
15568
|
+
toggleSelected(null);
|
|
15569
|
+
},
|
|
15570
|
+
renderOption: renderOption({
|
|
15571
|
+
name: defaultValue,
|
|
15572
|
+
id: null
|
|
15573
|
+
}, {
|
|
15574
|
+
checked: isDefaultOptionSelected(),
|
|
15575
|
+
hover: hover.item === null,
|
|
15576
|
+
onChange: function onChange() {
|
|
15577
|
+
return null;
|
|
15578
|
+
}
|
|
15579
|
+
})
|
|
15580
|
+
});
|
|
15581
|
+
case "group":
|
|
15582
|
+
if (!virtualItem.item || !isOptionGroup(virtualItem.item)) return null;
|
|
15583
|
+
return /*#__PURE__*/React__default["default"].createElement(OptionGroup, {
|
|
15584
|
+
checked: selectedOptions,
|
|
15585
|
+
name: virtualItem.item.name,
|
|
15586
|
+
tooltip: virtualItem.item.tooltip,
|
|
15587
|
+
key: virtualItem.item.id,
|
|
15588
|
+
setHover: handleHoverCallback,
|
|
15589
|
+
id: virtualItem.item.id,
|
|
15590
|
+
hover: hover.item,
|
|
15591
|
+
options: virtualItem.item.options,
|
|
15592
|
+
renderOptions: handleRenderOption,
|
|
15593
|
+
type: type,
|
|
15594
|
+
onChange: handleChange,
|
|
15595
|
+
filter: filter,
|
|
15596
|
+
mixedOptions: mixedOptions
|
|
15597
|
+
});
|
|
15598
|
+
case "option":
|
|
15599
|
+
if (!virtualItem.item || isOptionGroup(virtualItem.item)) return null;
|
|
15600
|
+
return /*#__PURE__*/React__default["default"].createElement(Option, {
|
|
15601
|
+
name: virtualItem.item.name,
|
|
15602
|
+
ref: hover.item === virtualItem.id ? itemRef : null,
|
|
15603
|
+
key: index,
|
|
15604
|
+
tooltip: virtualItem.item.tooltip,
|
|
15605
|
+
onMouseEnter: function onMouseEnter() {
|
|
15606
|
+
return handleMouseEnter(virtualItem.id);
|
|
15607
|
+
},
|
|
15608
|
+
onClick: handleClick,
|
|
15609
|
+
id: virtualItem.id,
|
|
15610
|
+
hover: virtualItem.id === hover.item,
|
|
15611
|
+
className: optionClassName,
|
|
15612
|
+
renderOption: renderOption(_objectSpread2(_objectSpread2({}, virtualItem.item), {}, {
|
|
15613
|
+
name: highlightText(virtualItem.item.name, filter)
|
|
15614
|
+
}), {
|
|
15615
|
+
id: "option_".concat(virtualItem.id),
|
|
15616
|
+
checked: selectedOptions && selectedOptions.includes(virtualItem.id),
|
|
15617
|
+
hover: hover.item === virtualItem.id,
|
|
15618
|
+
onChange: function onChange() {
|
|
15619
|
+
return null;
|
|
15620
|
+
}
|
|
15621
|
+
})
|
|
15622
|
+
});
|
|
15623
|
+
case "noResult":
|
|
15624
|
+
return /*#__PURE__*/React__default["default"].createElement(_StyledStyledOption, null, noResultText);
|
|
15625
|
+
case "addNew":
|
|
15626
|
+
return /*#__PURE__*/React__default["default"].createElement(StyledAutocompleteNewItem, {
|
|
15627
|
+
ref: hover.item === "addNew" ? itemRef : null,
|
|
15628
|
+
key: "emptyValue",
|
|
15629
|
+
hover: hover.item === "addNew",
|
|
15630
|
+
onMouseDown: handleEmpty,
|
|
15631
|
+
onMouseEnter: onAddNewMouseEnter
|
|
15632
|
+
}, emptyValue);
|
|
15633
|
+
default:
|
|
15634
|
+
return null;
|
|
15635
|
+
}
|
|
15636
|
+
}, [defaultValue, hover.item, handleMouseEnter, renderOption, isDefaultOptionSelected, selectedOptions, handleHoverCallback, handleRenderOption, type, handleChange, filter, mixedOptions, handleClick, optionClassName, noResultText, handleEmpty, onAddNewMouseEnter, emptyValue, toggleSelected]);
|
|
15514
15637
|
return /*#__PURE__*/React__default["default"].createElement(StyledAutocompleteScrollShadow, {
|
|
15515
15638
|
className: AutocompleteClassName,
|
|
15516
15639
|
$isHidden: !defaultValue && !emptyValue && !noResultText && list.length < 1
|
|
15517
15640
|
}, function (_ref2) {
|
|
15518
|
-
var
|
|
15641
|
+
var _onScroll = _ref2.onScroll;
|
|
15519
15642
|
return /*#__PURE__*/React__default["default"].createElement(StyledAutocompleteBody, {
|
|
15520
15643
|
key: "body",
|
|
15521
15644
|
onMouseLeave: handleOnMouseLeave
|
|
15522
|
-
}, /*#__PURE__*/React__default["default"].createElement(
|
|
15523
|
-
ref:
|
|
15524
|
-
|
|
15525
|
-
|
|
15526
|
-
|
|
15527
|
-
onScroll: onScroll
|
|
15528
|
-
}, defaultValue && !filter && /*#__PURE__*/React__default["default"].createElement(Option, {
|
|
15529
|
-
name: defaultValue,
|
|
15530
|
-
ref: itemRef,
|
|
15531
|
-
hover: hover.item === null,
|
|
15532
|
-
onMouseEnter: handleMouseEnter,
|
|
15533
|
-
onClick: function onClick(e) {
|
|
15534
|
-
e.preventDefault();
|
|
15535
|
-
toggleSelected(null);
|
|
15645
|
+
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
15646
|
+
ref: listContainerRef,
|
|
15647
|
+
style: {
|
|
15648
|
+
height: "".concat(Math.min(rowVirtualizer.getTotalSize() + 12, autoHeightMax), "px"),
|
|
15649
|
+
overflow: "auto"
|
|
15536
15650
|
},
|
|
15537
|
-
|
|
15538
|
-
|
|
15539
|
-
|
|
15540
|
-
|
|
15541
|
-
|
|
15542
|
-
|
|
15543
|
-
|
|
15544
|
-
|
|
15651
|
+
onScroll: function onScroll(e) {
|
|
15652
|
+
if (_onScroll) _onScroll(e);
|
|
15653
|
+
}
|
|
15654
|
+
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
15655
|
+
style: {
|
|
15656
|
+
height: "".concat(rowVirtualizer.getTotalSize(), "px"),
|
|
15657
|
+
width: "100%",
|
|
15658
|
+
position: "relative"
|
|
15659
|
+
}
|
|
15660
|
+
}, shouldUseVirtualization ? rowVirtualizer.getVirtualItems().map(function (virtualRow) {
|
|
15661
|
+
var item = virtualItems[virtualRow.index];
|
|
15662
|
+
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
15663
|
+
key: virtualRow.index,
|
|
15664
|
+
"data-index": virtualRow.index,
|
|
15665
|
+
style: {
|
|
15666
|
+
position: "absolute",
|
|
15667
|
+
top: 0,
|
|
15668
|
+
left: 0,
|
|
15669
|
+
width: "100%",
|
|
15670
|
+
transform: "translateY(".concat(virtualRow.start, "px)")
|
|
15545
15671
|
}
|
|
15546
|
-
})
|
|
15547
|
-
})
|
|
15548
|
-
return
|
|
15549
|
-
|
|
15672
|
+
}, renderVirtualItem(item, virtualRow.index));
|
|
15673
|
+
}) : virtualItems.map(function (item, index) {
|
|
15674
|
+
return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, {
|
|
15675
|
+
key: index
|
|
15676
|
+
}, renderVirtualItem(item, index));
|
|
15677
|
+
}))));
|
|
15550
15678
|
});
|
|
15551
15679
|
};
|
|
15552
15680
|
Autocomplete.displayName = "Autocomplete";
|
|
@@ -15555,7 +15683,7 @@
|
|
|
15555
15683
|
componentId: "sc-9x4q7e-0"
|
|
15556
15684
|
})(["cursor:auto"]);
|
|
15557
15685
|
|
|
15558
|
-
var _excluded$M = ["type", "mode", "target", "options", "selected", "mixed", "position", "onChange", "placeholder", "emptyAction", "disableSearch", "forceCloseMenu", "selectClassName", "keepSameOptionsOrder", "onSelectOpen", "onSelectClose", "renderOption", "handleDefaultOptionChange", "preselectDefaultValue", "startAdornment", "endAdornment", "focusInput"];
|
|
15686
|
+
var _excluded$M = ["type", "mode", "target", "options", "selected", "mixed", "position", "onChange", "placeholder", "emptyAction", "disableSearch", "forceCloseMenu", "selectClassName", "keepSameOptionsOrder", "onSelectOpen", "onSelectClose", "renderOption", "handleDefaultOptionChange", "preselectDefaultValue", "startAdornment", "endAdornment", "focusInput", "disableVirtualization"];
|
|
15559
15687
|
var Select = function Select(_ref) {
|
|
15560
15688
|
var _ref$type = _ref.type,
|
|
15561
15689
|
type = _ref$type === void 0 ? "single" : _ref$type,
|
|
@@ -15593,6 +15721,7 @@
|
|
|
15593
15721
|
endAdornment = _ref.endAdornment,
|
|
15594
15722
|
_ref$focusInput = _ref.focusInput,
|
|
15595
15723
|
focusInput = _ref$focusInput === void 0 ? false : _ref$focusInput,
|
|
15724
|
+
disableVirtualization = _ref.disableVirtualization,
|
|
15596
15725
|
prop = _objectWithoutProperties(_ref, _excluded$M);
|
|
15597
15726
|
if (disableSearch && (startAdornment || endAdornment)) {
|
|
15598
15727
|
console.warn("Adornments are not visible when search bar is hidden");
|
|
@@ -15760,7 +15889,8 @@
|
|
|
15760
15889
|
handleDefaultOptionChange: handleDefaultOptionChangeCallback,
|
|
15761
15890
|
type: type,
|
|
15762
15891
|
preselectDefaultValue: preselectDefaultValue,
|
|
15763
|
-
keepSameOptionsOrder: keepSameOptionsOrder
|
|
15892
|
+
keepSameOptionsOrder: keepSameOptionsOrder,
|
|
15893
|
+
disableVirtualization: disableVirtualization
|
|
15764
15894
|
}))));
|
|
15765
15895
|
};
|
|
15766
15896
|
Select.displayName = "Select";
|
|
@@ -17027,7 +17157,7 @@
|
|
|
17027
17157
|
});
|
|
17028
17158
|
Chip.displayName = "Chip";
|
|
17029
17159
|
|
|
17030
|
-
var _excluded$C = ["options", "selected", "loading", "loadingText", "onChange", "onInputChange", "placeholder", "handleEmptyAction", "disabled", "size", "invalid", "type", "renderChip", "forceCloseMenu", "renderOption", "limitChips", "hiddenNumberText", "inPortal", "inputWrapperClassName", "scrollWrapper", "onClose", "onClear", "onDeselect", "defaultValue", "open", "onOpen", "triggerMode", "noResultText", "emptyValue"];
|
|
17160
|
+
var _excluded$C = ["options", "selected", "loading", "loadingText", "onChange", "onInputChange", "placeholder", "handleEmptyAction", "disabled", "size", "invalid", "type", "renderChip", "forceCloseMenu", "renderOption", "limitChips", "hiddenNumberText", "inPortal", "inputWrapperClassName", "scrollWrapper", "onClose", "onClear", "onDeselect", "defaultValue", "open", "onOpen", "triggerMode", "noResultText", "emptyValue", "disableVirtualization"];
|
|
17031
17161
|
var sizeMap = {
|
|
17032
17162
|
small: 18,
|
|
17033
17163
|
regular: 24,
|
|
@@ -17075,6 +17205,7 @@
|
|
|
17075
17205
|
triggerMode = _ref.triggerMode,
|
|
17076
17206
|
noResultText = _ref.noResultText,
|
|
17077
17207
|
emptyValue = _ref.emptyValue,
|
|
17208
|
+
disableVirtualization = _ref.disableVirtualization,
|
|
17078
17209
|
prop = _objectWithoutProperties(_ref, _excluded$C);
|
|
17079
17210
|
var selectedName = React.useMemo(function () {
|
|
17080
17211
|
var value = "";
|
|
@@ -17458,7 +17589,8 @@
|
|
|
17458
17589
|
options: options,
|
|
17459
17590
|
type: type,
|
|
17460
17591
|
defaultValue: defaultValue,
|
|
17461
|
-
handleEmptyAction: emptyAction
|
|
17592
|
+
handleEmptyAction: emptyAction,
|
|
17593
|
+
disableVirtualization: disableVirtualization
|
|
17462
17594
|
})))))) : null);
|
|
17463
17595
|
};
|
|
17464
17596
|
ComboBox.displayName = "ComboBox";
|
|
@@ -17493,7 +17625,7 @@
|
|
|
17493
17625
|
componentId: "sc-uvsz9l-4"
|
|
17494
17626
|
})(["display:flex;justify-content:center;"]);
|
|
17495
17627
|
|
|
17496
|
-
var _excluded$B = ["mode", "selected", "min", "max", "onChange", "step", "size", "className", "placeholder", "triggerMode", "disabled", "invalid"];
|
|
17628
|
+
var _excluded$B = ["mode", "selected", "min", "max", "onChange", "step", "size", "className", "placeholder", "triggerMode", "disabled", "invalid", "disableVirtualization"];
|
|
17497
17629
|
nlp__default["default"].plugin(plg__default["default"]);
|
|
17498
17630
|
var StyledInputTimeWrapper = styled__default["default"].div.withConfig({
|
|
17499
17631
|
displayName: "InputTime__StyledInputTimeWrapper",
|
|
@@ -17521,6 +17653,7 @@
|
|
|
17521
17653
|
triggerMode = _ref.triggerMode,
|
|
17522
17654
|
disabled = _ref.disabled,
|
|
17523
17655
|
invalid = _ref.invalid,
|
|
17656
|
+
disableVirtualization = _ref.disableVirtualization,
|
|
17524
17657
|
rest = _objectWithoutProperties(_ref, _excluded$B);
|
|
17525
17658
|
var _useState = React.useState(false),
|
|
17526
17659
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -17612,7 +17745,8 @@
|
|
|
17612
17745
|
onOpen: handleOpen,
|
|
17613
17746
|
triggerMode: triggerMode,
|
|
17614
17747
|
disabled: disabled,
|
|
17615
|
-
invalid: invalid
|
|
17748
|
+
invalid: invalid,
|
|
17749
|
+
disableVirtualization: disableVirtualization
|
|
17616
17750
|
})));
|
|
17617
17751
|
};
|
|
17618
17752
|
|