@activecollab/components 2.0.207 → 2.0.208
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 +211 -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 +6 -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 +185 -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 +6 -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 +234 -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,11 @@
|
|
|
15076
15070
|
});
|
|
15077
15071
|
}, [options, checked]);
|
|
15078
15072
|
var handleHover = React.useCallback(function () {
|
|
15079
|
-
if (options.some(
|
|
15080
|
-
return checked.includes(option.id);
|
|
15081
|
-
})) return;
|
|
15073
|
+
// if (options.some((option) => checked.includes(option.id))) return;
|
|
15082
15074
|
if (setHover) {
|
|
15083
15075
|
setHover(type === "single" ? undefined : id);
|
|
15084
15076
|
}
|
|
15085
|
-
}, [setHover, type, id
|
|
15077
|
+
}, [setHover, type, id]);
|
|
15086
15078
|
var allOptionValues = React.useMemo(function () {
|
|
15087
15079
|
return options.map(function (option) {
|
|
15088
15080
|
return option.id;
|
|
@@ -15097,6 +15089,7 @@
|
|
|
15097
15089
|
}, [allOptionValues, checked, isAllOptionsChecked, mixedOptions, options]);
|
|
15098
15090
|
var handleClick = React.useCallback(function (e) {
|
|
15099
15091
|
e.stopPropagation();
|
|
15092
|
+
e.preventDefault();
|
|
15100
15093
|
if (onChange) {
|
|
15101
15094
|
if (isAllOptionsChecked) {
|
|
15102
15095
|
onChange(checked.filter(function (i) {
|
|
@@ -15113,7 +15106,8 @@
|
|
|
15113
15106
|
}, [allOptionValues, checked, isAllOptionsChecked, onChange]);
|
|
15114
15107
|
return /*#__PURE__*/React__default["default"].createElement(StyledOptionGroupLi, {
|
|
15115
15108
|
key: id,
|
|
15116
|
-
className: classNames__default["default"]("c-option-group", optionGroupClassName)
|
|
15109
|
+
className: classNames__default["default"]("c-option-group", optionGroupClassName),
|
|
15110
|
+
onClick: handleClick
|
|
15117
15111
|
}, /*#__PURE__*/React__default["default"].createElement(StyledOptionGroup, {
|
|
15118
15112
|
key: id
|
|
15119
15113
|
}, /*#__PURE__*/React__default["default"].createElement(StyledOptionGroupOption, {
|
|
@@ -15127,9 +15121,7 @@
|
|
|
15127
15121
|
mixed: isMixed,
|
|
15128
15122
|
onChange: handleClick,
|
|
15129
15123
|
type: "checkbox"
|
|
15130
|
-
})))
|
|
15131
|
-
return typeof renderOptions === "function" ? renderOptions(item, index) : item.name;
|
|
15132
|
-
}))));
|
|
15124
|
+
})))));
|
|
15133
15125
|
};
|
|
15134
15126
|
OptionGroup.displayName = "OptionGroup";
|
|
15135
15127
|
|
|
@@ -15165,9 +15157,11 @@
|
|
|
15165
15157
|
autoHeightMax = _ref$autoHeightMax === void 0 ? 340 : _ref$autoHeightMax,
|
|
15166
15158
|
clearInputOnSelect = _ref.clearInputOnSelect,
|
|
15167
15159
|
_ref$mixedOptions = _ref.mixedOptions,
|
|
15168
|
-
mixedOptions = _ref$mixedOptions === void 0 ? [] : _ref$mixedOptions
|
|
15160
|
+
mixedOptions = _ref$mixedOptions === void 0 ? [] : _ref$mixedOptions,
|
|
15161
|
+
filterCriteria = _ref.filterCriteria,
|
|
15162
|
+
disableVirtualization = _ref.disableVirtualization;
|
|
15163
|
+
var listContainerRef = React.useRef(null);
|
|
15169
15164
|
var itemRef = React.useRef(null);
|
|
15170
|
-
var listRef = React.useRef(null);
|
|
15171
15165
|
var selectedOptions = React.useMemo(function () {
|
|
15172
15166
|
if (Array.isArray(selected)) {
|
|
15173
15167
|
return selected;
|
|
@@ -15209,9 +15203,9 @@
|
|
|
15209
15203
|
} else {
|
|
15210
15204
|
return opts.sort(sortOptions);
|
|
15211
15205
|
}
|
|
15212
|
-
|
|
15213
|
-
|
|
15214
|
-
|
|
15206
|
+
},
|
|
15207
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
15208
|
+
[mixedOptions, selectedOptions]);
|
|
15215
15209
|
var sortList = React.useCallback(function (options) {
|
|
15216
15210
|
var _options$;
|
|
15217
15211
|
if (disabledInternalSort) {
|
|
@@ -15235,20 +15229,22 @@
|
|
|
15235
15229
|
return handleSort(_sortedOptions);
|
|
15236
15230
|
}
|
|
15237
15231
|
}, [sortDirection, disabledInternalSort, handleSort]);
|
|
15238
|
-
var
|
|
15239
|
-
|
|
15240
|
-
|
|
15241
|
-
|
|
15232
|
+
var _useState = React.useState(function () {
|
|
15233
|
+
return sortList(options);
|
|
15234
|
+
}),
|
|
15235
|
+
_useState2 = _slicedToArray(_useState, 1),
|
|
15236
|
+
sortedList = _useState2[0];
|
|
15237
|
+
var _useState3 = React.useState({
|
|
15242
15238
|
item: undefined,
|
|
15243
15239
|
by: undefined
|
|
15244
15240
|
}),
|
|
15245
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
15246
|
-
hover = _useState2[0],
|
|
15247
|
-
setHover = _useState2[1];
|
|
15248
|
-
var _useState3 = React.useState(""),
|
|
15249
15241
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
15250
|
-
|
|
15251
|
-
|
|
15242
|
+
hover = _useState4[0],
|
|
15243
|
+
setHover = _useState4[1];
|
|
15244
|
+
var _useState5 = React.useState(""),
|
|
15245
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
15246
|
+
filter = _useState6[0],
|
|
15247
|
+
setFilter = _useState6[1];
|
|
15252
15248
|
var handleEmpty = React.useCallback(function (e) {
|
|
15253
15249
|
if (e && e.button !== 0) {
|
|
15254
15250
|
return;
|
|
@@ -15276,24 +15272,20 @@
|
|
|
15276
15272
|
return option.name.toLowerCase() !== filter.trim().toLowerCase();
|
|
15277
15273
|
}));
|
|
15278
15274
|
}, [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
15275
|
var filterOptions = React.useCallback(function (options, filter) {
|
|
15289
15276
|
var trimmedFilter = filter.trim();
|
|
15290
15277
|
var isGrouped = options[0] && isOptionGroup(options[0]);
|
|
15278
|
+
var matchesFilter = function matchesFilter(option) {
|
|
15279
|
+
var nameMatch = option.name.toLowerCase().includes(trimmedFilter.toLowerCase());
|
|
15280
|
+
if (filterCriteria && trimmedFilter) {
|
|
15281
|
+
return nameMatch || filterCriteria(option, trimmedFilter);
|
|
15282
|
+
}
|
|
15283
|
+
return nameMatch;
|
|
15284
|
+
};
|
|
15291
15285
|
if (isGrouped) {
|
|
15292
15286
|
var hovered = false;
|
|
15293
15287
|
return options.reduce(function (acc, groupedOption) {
|
|
15294
|
-
var filteredOptions = groupedOption.options.filter(
|
|
15295
|
-
return v.name.toLowerCase().includes(trimmedFilter.toLowerCase());
|
|
15296
|
-
});
|
|
15288
|
+
var filteredOptions = groupedOption.options.filter(matchesFilter);
|
|
15297
15289
|
if (filteredOptions.length > 0) {
|
|
15298
15290
|
if (!hovered && filter) {
|
|
15299
15291
|
setHover({
|
|
@@ -15309,9 +15301,7 @@
|
|
|
15309
15301
|
return [...acc];
|
|
15310
15302
|
}, []);
|
|
15311
15303
|
} else {
|
|
15312
|
-
var filteredOptions = options.filter(
|
|
15313
|
-
return v.name.toLowerCase().includes(trimmedFilter.toLowerCase());
|
|
15314
|
-
});
|
|
15304
|
+
var filteredOptions = options.filter(matchesFilter);
|
|
15315
15305
|
if (filter && filteredOptions.length > 0) {
|
|
15316
15306
|
setHover({
|
|
15317
15307
|
item: filteredOptions[0].id,
|
|
@@ -15326,7 +15316,7 @@
|
|
|
15326
15316
|
}
|
|
15327
15317
|
return filteredOptions;
|
|
15328
15318
|
}
|
|
15329
|
-
}, [emptyValue]);
|
|
15319
|
+
}, [emptyValue, filterCriteria]);
|
|
15330
15320
|
var list = React.useMemo(function () {
|
|
15331
15321
|
return filterOptions(sortedList, filter);
|
|
15332
15322
|
}, [filter, filterOptions, sortedList]);
|
|
@@ -15342,6 +15332,67 @@
|
|
|
15342
15332
|
}, []);
|
|
15343
15333
|
return filterOptions(options, filter);
|
|
15344
15334
|
}, [filter, filterOptions, list]);
|
|
15335
|
+
var showNoResultCondition = React.useMemo(function () {
|
|
15336
|
+
return noResultText && !showAddNew && list.length < 1 && (defaultValue && filter || !defaultValue);
|
|
15337
|
+
}, [noResultText, showAddNew, list.length, defaultValue, filter]);
|
|
15338
|
+
var virtualItems = React.useMemo(function () {
|
|
15339
|
+
var items = [];
|
|
15340
|
+
if (showDefaultOption) {
|
|
15341
|
+
items.push({
|
|
15342
|
+
type: "default",
|
|
15343
|
+
id: "default"
|
|
15344
|
+
});
|
|
15345
|
+
}
|
|
15346
|
+
list.forEach(function (item, index) {
|
|
15347
|
+
if (isOptionGroup(item)) {
|
|
15348
|
+
items.push({
|
|
15349
|
+
type: "group",
|
|
15350
|
+
id: item.id,
|
|
15351
|
+
item
|
|
15352
|
+
});
|
|
15353
|
+
item.options.forEach(function (option) {
|
|
15354
|
+
items.push({
|
|
15355
|
+
type: "option",
|
|
15356
|
+
id: option.id,
|
|
15357
|
+
item: option,
|
|
15358
|
+
index
|
|
15359
|
+
});
|
|
15360
|
+
});
|
|
15361
|
+
} else {
|
|
15362
|
+
items.push({
|
|
15363
|
+
type: "option",
|
|
15364
|
+
id: item.id,
|
|
15365
|
+
item,
|
|
15366
|
+
index
|
|
15367
|
+
});
|
|
15368
|
+
}
|
|
15369
|
+
});
|
|
15370
|
+
if (showNoResultCondition) {
|
|
15371
|
+
items.push({
|
|
15372
|
+
type: "noResult",
|
|
15373
|
+
id: "noResult"
|
|
15374
|
+
});
|
|
15375
|
+
}
|
|
15376
|
+
if (showAddNew) {
|
|
15377
|
+
items.push({
|
|
15378
|
+
type: "addNew",
|
|
15379
|
+
id: "addNew"
|
|
15380
|
+
});
|
|
15381
|
+
}
|
|
15382
|
+
return items;
|
|
15383
|
+
}, [list, showDefaultOption, showNoResultCondition, showAddNew]);
|
|
15384
|
+
var shouldUseVirtualization = !disableVirtualization && virtualItems.length > 40;
|
|
15385
|
+
var rowVirtualizer = reactVirtual.useVirtualizer({
|
|
15386
|
+
count: virtualItems.length,
|
|
15387
|
+
getScrollElement: function getScrollElement() {
|
|
15388
|
+
return listContainerRef.current;
|
|
15389
|
+
},
|
|
15390
|
+
estimateSize: function estimateSize() {
|
|
15391
|
+
return 28;
|
|
15392
|
+
},
|
|
15393
|
+
overscan: 5,
|
|
15394
|
+
gap: 4
|
|
15395
|
+
});
|
|
15345
15396
|
var handleInputChange = React.useCallback(function (e) {
|
|
15346
15397
|
if (e.target && !(e.key === "ArrowDown") && !(e.key === "ArrowUp") && !(e.key === "Enter")) {
|
|
15347
15398
|
setFilter(e.target.value);
|
|
@@ -15420,7 +15471,7 @@
|
|
|
15420
15471
|
}
|
|
15421
15472
|
return /*#__PURE__*/React__default["default"].createElement(Option, {
|
|
15422
15473
|
name: item.name,
|
|
15423
|
-
ref: itemRef,
|
|
15474
|
+
ref: hover.item === item.id ? itemRef : null,
|
|
15424
15475
|
key: index,
|
|
15425
15476
|
tooltip: item.tooltip,
|
|
15426
15477
|
onMouseEnter: handleMouseEnter,
|
|
@@ -15446,23 +15497,18 @@
|
|
|
15446
15497
|
by: "mouse"
|
|
15447
15498
|
});
|
|
15448
15499
|
}, []);
|
|
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
15500
|
React.useEffect(function () {
|
|
15458
15501
|
if (hover.by === "keyboard" && hover.item !== undefined) {
|
|
15459
|
-
var
|
|
15460
|
-
|
|
15461
|
-
|
|
15462
|
-
|
|
15502
|
+
var index = virtualItems.findIndex(function (item) {
|
|
15503
|
+
return item.id === hover.item;
|
|
15504
|
+
});
|
|
15505
|
+
if (index !== -1) {
|
|
15506
|
+
rowVirtualizer.scrollToIndex(index, {
|
|
15507
|
+
align: "center"
|
|
15508
|
+
});
|
|
15463
15509
|
}
|
|
15464
15510
|
}
|
|
15465
|
-
}, [
|
|
15511
|
+
}, [hover, rowVirtualizer, virtualItems]);
|
|
15466
15512
|
var handleOnKeyDown = React.useCallback(function (e) {
|
|
15467
15513
|
if (e.key === "Enter") {
|
|
15468
15514
|
e.preventDefault();
|
|
@@ -15505,48 +15551,126 @@
|
|
|
15505
15551
|
return selectedOptions[0] === null || selectedOptions.length === flatOptions.length;
|
|
15506
15552
|
}
|
|
15507
15553
|
}, [flatOptions.length, preselectDefaultValue, selectedOptions]);
|
|
15508
|
-
var
|
|
15509
|
-
|
|
15510
|
-
|
|
15511
|
-
|
|
15512
|
-
|
|
15513
|
-
|
|
15554
|
+
var renderVirtualItem = React.useCallback(function (virtualItem, index) {
|
|
15555
|
+
switch (virtualItem.type) {
|
|
15556
|
+
case "default":
|
|
15557
|
+
return /*#__PURE__*/React__default["default"].createElement(Option, {
|
|
15558
|
+
name: String(defaultValue),
|
|
15559
|
+
ref: hover.item === null ? itemRef : null,
|
|
15560
|
+
hover: hover.item === null,
|
|
15561
|
+
onMouseEnter: handleMouseEnter,
|
|
15562
|
+
onClick: function onClick(e) {
|
|
15563
|
+
e.preventDefault();
|
|
15564
|
+
toggleSelected(null);
|
|
15565
|
+
},
|
|
15566
|
+
renderOption: renderOption({
|
|
15567
|
+
name: defaultValue,
|
|
15568
|
+
id: null
|
|
15569
|
+
}, {
|
|
15570
|
+
checked: isDefaultOptionSelected(),
|
|
15571
|
+
hover: hover.item === null,
|
|
15572
|
+
onChange: function onChange() {
|
|
15573
|
+
return null;
|
|
15574
|
+
}
|
|
15575
|
+
})
|
|
15576
|
+
});
|
|
15577
|
+
case "group":
|
|
15578
|
+
if (!virtualItem.item || !isOptionGroup(virtualItem.item)) return null;
|
|
15579
|
+
return /*#__PURE__*/React__default["default"].createElement(OptionGroup, {
|
|
15580
|
+
checked: selectedOptions,
|
|
15581
|
+
name: virtualItem.item.name,
|
|
15582
|
+
tooltip: virtualItem.item.tooltip,
|
|
15583
|
+
key: virtualItem.item.id,
|
|
15584
|
+
setHover: handleHoverCallback,
|
|
15585
|
+
id: virtualItem.item.id,
|
|
15586
|
+
hover: hover.item,
|
|
15587
|
+
options: virtualItem.item.options,
|
|
15588
|
+
renderOptions: handleRenderOption,
|
|
15589
|
+
type: type,
|
|
15590
|
+
onChange: handleChange,
|
|
15591
|
+
filter: filter,
|
|
15592
|
+
mixedOptions: mixedOptions
|
|
15593
|
+
});
|
|
15594
|
+
case "option":
|
|
15595
|
+
if (!virtualItem.item || isOptionGroup(virtualItem.item)) return null;
|
|
15596
|
+
return /*#__PURE__*/React__default["default"].createElement(Option, {
|
|
15597
|
+
name: virtualItem.item.name,
|
|
15598
|
+
ref: hover.item === virtualItem.id ? itemRef : null,
|
|
15599
|
+
key: index,
|
|
15600
|
+
tooltip: virtualItem.item.tooltip,
|
|
15601
|
+
onMouseEnter: function onMouseEnter() {
|
|
15602
|
+
return handleMouseEnter(virtualItem.id);
|
|
15603
|
+
},
|
|
15604
|
+
onClick: handleClick,
|
|
15605
|
+
id: virtualItem.id,
|
|
15606
|
+
hover: virtualItem.id === hover.item,
|
|
15607
|
+
className: optionClassName,
|
|
15608
|
+
renderOption: renderOption(_objectSpread2(_objectSpread2({}, virtualItem.item), {}, {
|
|
15609
|
+
name: highlightText(virtualItem.item.name, filter)
|
|
15610
|
+
}), {
|
|
15611
|
+
id: "option_".concat(virtualItem.id),
|
|
15612
|
+
checked: selectedOptions && selectedOptions.includes(virtualItem.id),
|
|
15613
|
+
hover: hover.item === virtualItem.id,
|
|
15614
|
+
onChange: function onChange() {
|
|
15615
|
+
return null;
|
|
15616
|
+
}
|
|
15617
|
+
})
|
|
15618
|
+
});
|
|
15619
|
+
case "noResult":
|
|
15620
|
+
return /*#__PURE__*/React__default["default"].createElement(_StyledStyledOption, null, noResultText);
|
|
15621
|
+
case "addNew":
|
|
15622
|
+
return /*#__PURE__*/React__default["default"].createElement(StyledAutocompleteNewItem, {
|
|
15623
|
+
ref: hover.item === "addNew" ? itemRef : null,
|
|
15624
|
+
key: "emptyValue",
|
|
15625
|
+
hover: hover.item === "addNew",
|
|
15626
|
+
onMouseDown: handleEmpty,
|
|
15627
|
+
onMouseEnter: onAddNewMouseEnter
|
|
15628
|
+
}, emptyValue);
|
|
15629
|
+
default:
|
|
15630
|
+
return null;
|
|
15631
|
+
}
|
|
15632
|
+
}, [defaultValue, hover.item, handleMouseEnter, renderOption, isDefaultOptionSelected, selectedOptions, handleHoverCallback, handleRenderOption, type, handleChange, filter, mixedOptions, handleClick, optionClassName, noResultText, handleEmpty, onAddNewMouseEnter, emptyValue, toggleSelected]);
|
|
15514
15633
|
return /*#__PURE__*/React__default["default"].createElement(StyledAutocompleteScrollShadow, {
|
|
15515
15634
|
className: AutocompleteClassName,
|
|
15516
15635
|
$isHidden: !defaultValue && !emptyValue && !noResultText && list.length < 1
|
|
15517
15636
|
}, function (_ref2) {
|
|
15518
|
-
var
|
|
15637
|
+
var _onScroll = _ref2.onScroll;
|
|
15519
15638
|
return /*#__PURE__*/React__default["default"].createElement(StyledAutocompleteBody, {
|
|
15520
15639
|
key: "body",
|
|
15521
15640
|
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);
|
|
15641
|
+
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
15642
|
+
ref: listContainerRef,
|
|
15643
|
+
style: {
|
|
15644
|
+
height: "".concat(Math.min(rowVirtualizer.getTotalSize() + 12, autoHeightMax), "px"),
|
|
15645
|
+
overflow: "auto"
|
|
15536
15646
|
},
|
|
15537
|
-
|
|
15538
|
-
|
|
15539
|
-
|
|
15540
|
-
|
|
15541
|
-
|
|
15542
|
-
|
|
15543
|
-
|
|
15544
|
-
|
|
15647
|
+
onScroll: function onScroll(e) {
|
|
15648
|
+
if (_onScroll) _onScroll(e);
|
|
15649
|
+
}
|
|
15650
|
+
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
15651
|
+
style: {
|
|
15652
|
+
height: "".concat(rowVirtualizer.getTotalSize(), "px"),
|
|
15653
|
+
width: "100%",
|
|
15654
|
+
position: "relative"
|
|
15655
|
+
}
|
|
15656
|
+
}, shouldUseVirtualization ? rowVirtualizer.getVirtualItems().map(function (virtualRow) {
|
|
15657
|
+
var item = virtualItems[virtualRow.index];
|
|
15658
|
+
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
15659
|
+
key: virtualRow.index,
|
|
15660
|
+
"data-index": virtualRow.index,
|
|
15661
|
+
style: {
|
|
15662
|
+
position: "absolute",
|
|
15663
|
+
top: 0,
|
|
15664
|
+
left: 0,
|
|
15665
|
+
width: "100%",
|
|
15666
|
+
transform: "translateY(".concat(virtualRow.start, "px)")
|
|
15545
15667
|
}
|
|
15546
|
-
})
|
|
15547
|
-
})
|
|
15548
|
-
return
|
|
15549
|
-
|
|
15668
|
+
}, renderVirtualItem(item, virtualRow.index));
|
|
15669
|
+
}) : virtualItems.map(function (item, index) {
|
|
15670
|
+
return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, {
|
|
15671
|
+
key: index
|
|
15672
|
+
}, renderVirtualItem(item, index));
|
|
15673
|
+
}))));
|
|
15550
15674
|
});
|
|
15551
15675
|
};
|
|
15552
15676
|
Autocomplete.displayName = "Autocomplete";
|
|
@@ -15555,7 +15679,7 @@
|
|
|
15555
15679
|
componentId: "sc-9x4q7e-0"
|
|
15556
15680
|
})(["cursor:auto"]);
|
|
15557
15681
|
|
|
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"];
|
|
15682
|
+
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
15683
|
var Select = function Select(_ref) {
|
|
15560
15684
|
var _ref$type = _ref.type,
|
|
15561
15685
|
type = _ref$type === void 0 ? "single" : _ref$type,
|
|
@@ -15593,6 +15717,7 @@
|
|
|
15593
15717
|
endAdornment = _ref.endAdornment,
|
|
15594
15718
|
_ref$focusInput = _ref.focusInput,
|
|
15595
15719
|
focusInput = _ref$focusInput === void 0 ? false : _ref$focusInput,
|
|
15720
|
+
disableVirtualization = _ref.disableVirtualization,
|
|
15596
15721
|
prop = _objectWithoutProperties(_ref, _excluded$M);
|
|
15597
15722
|
if (disableSearch && (startAdornment || endAdornment)) {
|
|
15598
15723
|
console.warn("Adornments are not visible when search bar is hidden");
|
|
@@ -15760,7 +15885,8 @@
|
|
|
15760
15885
|
handleDefaultOptionChange: handleDefaultOptionChangeCallback,
|
|
15761
15886
|
type: type,
|
|
15762
15887
|
preselectDefaultValue: preselectDefaultValue,
|
|
15763
|
-
keepSameOptionsOrder: keepSameOptionsOrder
|
|
15888
|
+
keepSameOptionsOrder: keepSameOptionsOrder,
|
|
15889
|
+
disableVirtualization: disableVirtualization
|
|
15764
15890
|
}))));
|
|
15765
15891
|
};
|
|
15766
15892
|
Select.displayName = "Select";
|
|
@@ -17027,7 +17153,7 @@
|
|
|
17027
17153
|
});
|
|
17028
17154
|
Chip.displayName = "Chip";
|
|
17029
17155
|
|
|
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"];
|
|
17156
|
+
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
17157
|
var sizeMap = {
|
|
17032
17158
|
small: 18,
|
|
17033
17159
|
regular: 24,
|
|
@@ -17075,6 +17201,7 @@
|
|
|
17075
17201
|
triggerMode = _ref.triggerMode,
|
|
17076
17202
|
noResultText = _ref.noResultText,
|
|
17077
17203
|
emptyValue = _ref.emptyValue,
|
|
17204
|
+
disableVirtualization = _ref.disableVirtualization,
|
|
17078
17205
|
prop = _objectWithoutProperties(_ref, _excluded$C);
|
|
17079
17206
|
var selectedName = React.useMemo(function () {
|
|
17080
17207
|
var value = "";
|
|
@@ -17458,7 +17585,8 @@
|
|
|
17458
17585
|
options: options,
|
|
17459
17586
|
type: type,
|
|
17460
17587
|
defaultValue: defaultValue,
|
|
17461
|
-
handleEmptyAction: emptyAction
|
|
17588
|
+
handleEmptyAction: emptyAction,
|
|
17589
|
+
disableVirtualization: disableVirtualization
|
|
17462
17590
|
})))))) : null);
|
|
17463
17591
|
};
|
|
17464
17592
|
ComboBox.displayName = "ComboBox";
|
|
@@ -17493,7 +17621,7 @@
|
|
|
17493
17621
|
componentId: "sc-uvsz9l-4"
|
|
17494
17622
|
})(["display:flex;justify-content:center;"]);
|
|
17495
17623
|
|
|
17496
|
-
var _excluded$B = ["mode", "selected", "min", "max", "onChange", "step", "size", "className", "placeholder", "triggerMode", "disabled", "invalid"];
|
|
17624
|
+
var _excluded$B = ["mode", "selected", "min", "max", "onChange", "step", "size", "className", "placeholder", "triggerMode", "disabled", "invalid", "disableVirtualization"];
|
|
17497
17625
|
nlp__default["default"].plugin(plg__default["default"]);
|
|
17498
17626
|
var StyledInputTimeWrapper = styled__default["default"].div.withConfig({
|
|
17499
17627
|
displayName: "InputTime__StyledInputTimeWrapper",
|
|
@@ -17521,6 +17649,7 @@
|
|
|
17521
17649
|
triggerMode = _ref.triggerMode,
|
|
17522
17650
|
disabled = _ref.disabled,
|
|
17523
17651
|
invalid = _ref.invalid,
|
|
17652
|
+
disableVirtualization = _ref.disableVirtualization,
|
|
17524
17653
|
rest = _objectWithoutProperties(_ref, _excluded$B);
|
|
17525
17654
|
var _useState = React.useState(false),
|
|
17526
17655
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -17612,7 +17741,8 @@
|
|
|
17612
17741
|
onOpen: handleOpen,
|
|
17613
17742
|
triggerMode: triggerMode,
|
|
17614
17743
|
disabled: disabled,
|
|
17615
|
-
invalid: invalid
|
|
17744
|
+
invalid: invalid,
|
|
17745
|
+
disableVirtualization: disableVirtualization
|
|
17616
17746
|
})));
|
|
17617
17747
|
};
|
|
17618
17748
|
|