@salutejs/plasma-new-hope 0.339.0-canary.2291.18715632452.0 → 0.339.0-canary.2292.18775879461.0
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/cjs/components/Calendar/hooks/useKeyNavigation.js +1 -1
- package/cjs/components/Calendar/hooks/useKeyNavigation.js.map +1 -1
- package/cjs/components/Pagination/Pagination.css +19 -0
- package/cjs/components/Pagination/ui/PaginationSelectPerPage/PaginationSelectPerPage.css +19 -0
- package/cjs/components/Select/Select.css +19 -0
- package/cjs/components/Select/Select.js +44 -9
- package/cjs/components/Select/Select.js.map +1 -1
- package/cjs/components/Select/Select.tokens.js +2 -0
- package/cjs/components/Select/Select.tokens.js.map +1 -1
- package/cjs/components/Select/hooks/useKeyboardNavigation.js +185 -1
- package/cjs/components/Select/hooks/useKeyboardNavigation.js.map +1 -1
- package/cjs/components/Select/hooks/usePathMaps.js +7 -3
- package/cjs/components/Select/hooks/usePathMaps.js.map +1 -1
- package/cjs/components/Select/reducers/treePathReducer.js +87 -0
- package/cjs/components/Select/reducers/treePathReducer.js.map +1 -0
- package/cjs/components/Select/ui/TreeList/TreeList.css +57 -0
- package/cjs/components/Select/ui/TreeList/TreeList.js +96 -0
- package/cjs/components/Select/ui/TreeList/TreeList.js.map +1 -0
- package/cjs/components/Select/ui/TreeList/TreeList.styles.js +30 -0
- package/cjs/components/Select/ui/TreeList/TreeList.styles.js.map +1 -0
- package/cjs/components/Select/ui/TreeList/TreeList.styles_1t38mek.css +2 -0
- package/cjs/components/Select/ui/TreeList/ui/Item/Item.css +54 -0
- package/cjs/components/Select/ui/TreeList/ui/Item/Item.js +130 -0
- package/cjs/components/Select/ui/TreeList/ui/Item/Item.js.map +1 -0
- package/cjs/components/Select/ui/TreeList/ui/Item/Item.styles.js +214 -0
- package/cjs/components/Select/ui/TreeList/ui/Item/Item.styles.js.map +1 -0
- package/cjs/components/Select/ui/TreeList/ui/Item/Item.styles_i0dby2.css +15 -0
- package/cjs/components/Table/Table.css +19 -0
- package/cjs/components/Table/ui/Cell/Cell.css +19 -0
- package/cjs/components/Table/ui/EditableCell/EditableCell.css +19 -0
- package/cjs/components/Table/ui/HeadCell/HeadCell.css +19 -0
- package/cjs/components/Table/ui/HeadCell/ui/Filter/Filter.css +19 -0
- package/cjs/components/TextArea/TextArea.js +3 -2
- package/cjs/components/TextArea/TextArea.js.map +1 -1
- package/cjs/components/TextField/TextField.js +3 -2
- package/cjs/components/TextField/TextField.js.map +1 -1
- package/cjs/components/Tree/utils/traverseTree.js +2 -23
- package/cjs/components/Tree/utils/traverseTree.js.map +1 -1
- package/cjs/index.css +19 -0
- package/cjs/index.js +2 -0
- package/cjs/index.js.map +1 -1
- package/cjs/utils/deepCopy.js +30 -0
- package/cjs/utils/deepCopy.js.map +1 -0
- package/cjs/utils/index.js.map +1 -1
- package/emotion/cjs/components/Calendar/hooks/useKeyNavigation.js +0 -1
- package/emotion/cjs/components/Select/Select.js +33 -6
- package/emotion/cjs/components/Select/Select.tokens.js +2 -0
- package/emotion/cjs/components/Select/hooks/useKeyboardNavigation.js +166 -0
- package/emotion/cjs/components/Select/hooks/usePathMaps.js +35 -3
- package/emotion/cjs/components/Select/reducers/index.js +1 -0
- package/emotion/cjs/components/Select/reducers/treePathReducer.js +98 -0
- package/emotion/cjs/components/Select/ui/TreeList/TreeList.js +126 -0
- package/emotion/cjs/components/Select/ui/TreeList/TreeList.styles.js +36 -0
- package/emotion/cjs/components/Select/ui/TreeList/TreeList.types.js +4 -0
- package/emotion/cjs/components/Select/ui/TreeList/ui/Item/Item.js +150 -0
- package/emotion/cjs/components/Select/ui/TreeList/ui/Item/Item.styles.js +186 -0
- package/emotion/cjs/components/Select/ui/TreeList/ui/Item/Item.types.js +4 -0
- package/emotion/cjs/components/Select/ui/index.js +1 -0
- package/emotion/cjs/components/TextArea/TextArea.js +3 -3
- package/emotion/cjs/components/TextField/TextField.js +3 -3
- package/emotion/cjs/components/Tree/utils/traverseTree.js +2 -60
- package/emotion/cjs/examples/components/Combobox/Combobox.js +15 -0
- package/emotion/cjs/examples/components/Select/Select.config.js +24 -24
- package/emotion/cjs/utils/deepCopy.js +82 -0
- package/emotion/cjs/utils/index.js +4 -0
- package/emotion/es/components/Calendar/hooks/useKeyNavigation.js +0 -1
- package/emotion/es/components/Select/Select.js +35 -8
- package/emotion/es/components/Select/Select.tokens.js +2 -0
- package/emotion/es/components/Select/hooks/useKeyboardNavigation.js +166 -0
- package/emotion/es/components/Select/hooks/usePathMaps.js +36 -4
- package/emotion/es/components/Select/reducers/index.js +1 -0
- package/emotion/es/components/Select/reducers/treePathReducer.js +81 -0
- package/emotion/es/components/Select/ui/TreeList/TreeList.js +75 -0
- package/emotion/es/components/Select/ui/TreeList/TreeList.styles.js +13 -0
- package/emotion/es/components/Select/ui/TreeList/TreeList.types.js +1 -0
- package/emotion/es/components/Select/ui/TreeList/ui/Item/Item.js +99 -0
- package/emotion/es/components/Select/ui/TreeList/ui/Item/Item.styles.js +122 -0
- package/emotion/es/components/Select/ui/TreeList/ui/Item/Item.types.js +1 -0
- package/emotion/es/components/Select/ui/index.js +1 -0
- package/emotion/es/components/TextArea/TextArea.js +3 -3
- package/emotion/es/components/TextField/TextField.js +3 -3
- package/emotion/es/components/Tree/utils/traverseTree.js +1 -59
- package/emotion/es/examples/components/Combobox/Combobox.js +0 -7
- package/emotion/es/examples/components/Select/Select.config.js +24 -24
- package/emotion/es/utils/deepCopy.js +72 -0
- package/emotion/es/utils/index.js +1 -0
- package/es/components/Calendar/hooks/useKeyNavigation.js +1 -1
- package/es/components/Calendar/hooks/useKeyNavigation.js.map +1 -1
- package/es/components/Pagination/Pagination.css +19 -0
- package/es/components/Pagination/ui/PaginationSelectPerPage/PaginationSelectPerPage.css +19 -0
- package/es/components/Select/Select.css +19 -0
- package/es/components/Select/Select.js +44 -9
- package/es/components/Select/Select.js.map +1 -1
- package/es/components/Select/Select.tokens.js +2 -0
- package/es/components/Select/Select.tokens.js.map +1 -1
- package/es/components/Select/hooks/useKeyboardNavigation.js +185 -1
- package/es/components/Select/hooks/useKeyboardNavigation.js.map +1 -1
- package/es/components/Select/hooks/usePathMaps.js +7 -3
- package/es/components/Select/hooks/usePathMaps.js.map +1 -1
- package/es/components/Select/reducers/treePathReducer.js +82 -0
- package/es/components/Select/reducers/treePathReducer.js.map +1 -0
- package/es/components/Select/ui/TreeList/TreeList.css +57 -0
- package/es/components/Select/ui/TreeList/TreeList.js +88 -0
- package/es/components/Select/ui/TreeList/TreeList.js.map +1 -0
- package/es/components/Select/ui/TreeList/TreeList.styles.js +25 -0
- package/es/components/Select/ui/TreeList/TreeList.styles.js.map +1 -0
- package/es/components/Select/ui/TreeList/TreeList.styles_1t38mek.css +2 -0
- package/es/components/Select/ui/TreeList/ui/Item/Item.css +54 -0
- package/es/components/Select/ui/TreeList/ui/Item/Item.js +122 -0
- package/es/components/Select/ui/TreeList/ui/Item/Item.js.map +1 -0
- package/es/components/Select/ui/TreeList/ui/Item/Item.styles.js +196 -0
- package/es/components/Select/ui/TreeList/ui/Item/Item.styles.js.map +1 -0
- package/es/components/Select/ui/TreeList/ui/Item/Item.styles_i0dby2.css +15 -0
- package/es/components/Table/Table.css +19 -0
- package/es/components/Table/ui/Cell/Cell.css +19 -0
- package/es/components/Table/ui/EditableCell/EditableCell.css +19 -0
- package/es/components/Table/ui/HeadCell/HeadCell.css +19 -0
- package/es/components/Table/ui/HeadCell/ui/Filter/Filter.css +19 -0
- package/es/components/TextArea/TextArea.js +3 -2
- package/es/components/TextArea/TextArea.js.map +1 -1
- package/es/components/TextField/TextField.js +3 -2
- package/es/components/TextField/TextField.js.map +1 -1
- package/es/components/Tree/utils/traverseTree.js +2 -23
- package/es/components/Tree/utils/traverseTree.js.map +1 -1
- package/es/index.css +19 -0
- package/es/index.js +1 -0
- package/es/index.js.map +1 -1
- package/es/utils/deepCopy.js +26 -0
- package/es/utils/deepCopy.js.map +1 -0
- package/es/utils/index.js.map +1 -1
- package/package.json +4 -4
- package/styled-components/cjs/components/Calendar/hooks/useKeyNavigation.js +0 -1
- package/styled-components/cjs/components/Select/Select.js +33 -6
- package/styled-components/cjs/components/Select/Select.tokens.js +2 -0
- package/styled-components/cjs/components/Select/hooks/useKeyboardNavigation.js +166 -0
- package/styled-components/cjs/components/Select/hooks/usePathMaps.js +35 -3
- package/styled-components/cjs/components/Select/reducers/index.js +1 -0
- package/styled-components/cjs/components/Select/reducers/treePathReducer.js +98 -0
- package/styled-components/cjs/components/Select/ui/TreeList/TreeList.js +126 -0
- package/styled-components/cjs/components/Select/ui/TreeList/TreeList.styles.js +50 -0
- package/styled-components/cjs/components/Select/ui/TreeList/TreeList.types.js +4 -0
- package/styled-components/cjs/components/Select/ui/TreeList/ui/Item/Item.js +150 -0
- package/styled-components/cjs/components/Select/ui/TreeList/ui/Item/Item.styles.js +300 -0
- package/styled-components/cjs/components/Select/ui/TreeList/ui/Item/Item.types.js +4 -0
- package/styled-components/cjs/components/Select/ui/index.js +1 -0
- package/styled-components/cjs/components/TextArea/TextArea.js +2 -2
- package/styled-components/cjs/components/TextField/TextField.js +2 -2
- package/styled-components/cjs/components/Tree/utils/traverseTree.js +2 -60
- package/styled-components/cjs/examples/components/Combobox/Combobox.js +15 -0
- package/styled-components/cjs/examples/components/Select/Select.config.js +12 -4
- package/styled-components/cjs/utils/deepCopy.js +82 -0
- package/styled-components/cjs/utils/index.js +4 -0
- package/styled-components/es/components/Calendar/hooks/useKeyNavigation.js +0 -1
- package/styled-components/es/components/Select/Select.js +35 -8
- package/styled-components/es/components/Select/Select.tokens.js +2 -0
- package/styled-components/es/components/Select/hooks/useKeyboardNavigation.js +166 -0
- package/styled-components/es/components/Select/hooks/usePathMaps.js +36 -4
- package/styled-components/es/components/Select/reducers/index.js +1 -0
- package/styled-components/es/components/Select/reducers/treePathReducer.js +81 -0
- package/styled-components/es/components/Select/ui/TreeList/TreeList.js +75 -0
- package/styled-components/es/components/Select/ui/TreeList/TreeList.styles.js +27 -0
- package/styled-components/es/components/Select/ui/TreeList/TreeList.types.js +1 -0
- package/styled-components/es/components/Select/ui/TreeList/ui/Item/Item.js +99 -0
- package/styled-components/es/components/Select/ui/TreeList/ui/Item/Item.styles.js +236 -0
- package/styled-components/es/components/Select/ui/TreeList/ui/Item/Item.types.js +1 -0
- package/styled-components/es/components/Select/ui/index.js +1 -0
- package/styled-components/es/components/TextArea/TextArea.js +2 -2
- package/styled-components/es/components/TextField/TextField.js +2 -2
- package/styled-components/es/components/Tree/utils/traverseTree.js +1 -59
- package/styled-components/es/examples/components/Combobox/Combobox.js +0 -7
- package/styled-components/es/examples/components/Select/Select.config.js +12 -4
- package/styled-components/es/utils/deepCopy.js +72 -0
- package/styled-components/es/utils/index.js +1 -0
- package/types/components/Autocomplete/ui/TextField/TextField.styles.d.ts.map +1 -1
- package/types/components/Combobox/ComboboxNew/ui/Target/Target.styles.d.ts.map +1 -1
- package/types/components/DatePicker/SingleDate/SingleDate.styles.d.ts.map +1 -1
- package/types/components/Pagination/ui/PaginationSelectPerPage/PaginationSelectPerPage.styles.d.ts +12 -0
- package/types/components/Pagination/ui/PaginationSelectPerPage/PaginationSelectPerPage.styles.d.ts.map +1 -1
- package/types/components/Range/Range.styles.d.ts.map +1 -1
- package/types/components/Select/Select.d.ts.map +1 -1
- package/types/components/Select/Select.tokens.d.ts +2 -0
- package/types/components/Select/Select.tokens.d.ts.map +1 -1
- package/types/components/Select/Select.types.d.ts +26 -2
- package/types/components/Select/Select.types.d.ts.map +1 -1
- package/types/components/Select/hooks/useKeyboardNavigation.d.ts +6 -2
- package/types/components/Select/hooks/useKeyboardNavigation.d.ts.map +1 -1
- package/types/components/Select/hooks/usePathMaps.d.ts +2 -1
- package/types/components/Select/hooks/usePathMaps.d.ts.map +1 -1
- package/types/components/Select/reducers/index.d.ts +1 -0
- package/types/components/Select/reducers/index.d.ts.map +1 -1
- package/types/components/Select/reducers/treePathReducer.d.ts +14 -0
- package/types/components/Select/reducers/treePathReducer.d.ts.map +1 -0
- package/types/components/Select/ui/Target/ui/Textfield/Textfield.styles.d.ts.map +1 -1
- package/types/components/Select/ui/TreeList/TreeList.d.ts +4 -0
- package/types/components/Select/ui/TreeList/TreeList.d.ts.map +1 -0
- package/types/components/Select/ui/TreeList/TreeList.styles.d.ts +6 -0
- package/types/components/Select/ui/TreeList/TreeList.styles.d.ts.map +1 -0
- package/types/components/Select/ui/TreeList/TreeList.types.d.ts +11 -0
- package/types/components/Select/ui/TreeList/TreeList.types.d.ts.map +1 -0
- package/types/components/Select/ui/TreeList/ui/Item/Item.d.ts +4 -0
- package/types/components/Select/ui/TreeList/ui/Item/Item.d.ts.map +1 -0
- package/types/components/Select/ui/TreeList/ui/Item/Item.styles.d.ts +64 -0
- package/types/components/Select/ui/TreeList/ui/Item/Item.styles.d.ts.map +1 -0
- package/types/components/Select/ui/TreeList/ui/Item/Item.types.d.ts +14 -0
- package/types/components/Select/ui/TreeList/ui/Item/Item.types.d.ts.map +1 -0
- package/types/components/Select/ui/index.d.ts +1 -0
- package/types/components/Select/ui/index.d.ts.map +1 -1
- package/types/components/Slider/components/Double/Double.styles.d.ts.map +1 -1
- package/types/components/Table/ui/HeadCell/ui/Filter/Filter.styles.d.ts +12 -0
- package/types/components/Table/ui/HeadCell/ui/Filter/Filter.styles.d.ts.map +1 -1
- package/types/components/TextArea/TextArea.d.ts.map +1 -1
- package/types/components/TextArea/TextArea.types.d.ts +4 -0
- package/types/components/TextArea/TextArea.types.d.ts.map +1 -1
- package/types/components/TextField/TextField.d.ts.map +1 -1
- package/types/components/TextField/TextField.types.d.ts +4 -0
- package/types/components/TextField/TextField.types.d.ts.map +1 -1
- package/types/components/TimePicker/TimePicker.styles.d.ts.map +1 -1
- package/types/components/Tree/utils/traverseTree.d.ts.map +1 -1
- package/types/examples/components/Autocomplete/Autocomplete.d.ts.map +1 -1
- package/types/examples/components/Mask/Mask.d.ts.map +1 -1
- package/types/examples/components/NumberFormat/NumberFormat.d.ts.map +1 -1
- package/types/examples/components/Select/Select.config.d.ts.map +1 -1
- package/types/examples/components/Select/Select.d.ts +12 -0
- package/types/examples/components/Select/Select.d.ts.map +1 -1
- package/types/examples/components/TextArea/TextArea.d.ts +8 -0
- package/types/examples/components/TextArea/TextArea.d.ts.map +1 -1
- package/types/examples/components/TextField/TextField.d.ts.map +1 -1
- package/types/utils/deepCopy.d.ts +2 -0
- package/types/utils/deepCopy.d.ts.map +1 -0
- package/types/utils/index.d.ts +1 -0
- package/types/utils/index.d.ts.map +1 -1
|
@@ -178,7 +178,7 @@ var selectRoot = function(Root) {
|
|
|
178
178
|
return /*#__PURE__*/ (0, _react.forwardRef)(function(props, ref) {
|
|
179
179
|
var _getItemByFocused;
|
|
180
180
|
var // eslint-disable-block @typescript-eslint/ban-ts-comment
|
|
181
|
-
id = props.id, outerValue = props.value, outerOnChange = props.onChange, _props_target = props.target, target = _props_target === void 0 ? 'textfield-like' : _props_target, items = props.items, _props_placement = props.placement, placement = _props_placement === void 0 ? 'bottom' : _props_placement, label = props.label, labelPlacement = props.labelPlacement, placeholder = props.placeholder, helperText = props.helperText, _props_disabled = props.disabled, disabled = _props_disabled === void 0 ? false : _props_disabled, _props_readOnly = props.readOnly, readOnly = _props_readOnly === void 0 ? false : _props_readOnly, outerView = props.view, size = props.size, listOverflow = props.listOverflow, listHeight = props.listHeight, listMaxHeight = props.listMaxHeight, listWidth = props.listWidth, contentLeft = props.contentLeft, onScrollBottom = props.onScrollBottom, onScroll = props.onScroll, chipView = props.chipView, _props_variant = props.variant, variant = _props_variant === void 0 ? 'normal' : _props_variant, portal = props.portal, renderValue = props.renderValue, renderItem = props.renderItem, status = props.status, onItemSelect = props.onItemSelect, separator = props.separator, outerCloseAfterSelect = props.closeAfterSelect, isTargetAmount = props.isTargetAmount, beforeList = props.beforeList, afterList = props.afterList, zIndex = props.zIndex, name = props.name, defaultValue = props.defaultValue, _props_virtual = props.virtual, virtual = _props_virtual === void 0 ? false : _props_virtual, onToggle = props.onToggle, chipType = props.chipType, multiselect = props.multiselect, _props_mode = props.mode, mode = _props_mode === void 0 ? 'default' : _props_mode, chipClickArea = props.chipClickArea, // @ts-ignore
|
|
181
|
+
id = props.id, outerValue = props.value, outerOnChange = props.onChange, _props_target = props.target, target = _props_target === void 0 ? 'textfield-like' : _props_target, items = props.items, _props_treeView = props.treeView, treeView = _props_treeView === void 0 ? false : _props_treeView, _props_arrowPlacement = props.arrowPlacement, arrowPlacement = _props_arrowPlacement === void 0 ? 'left' : _props_arrowPlacement, _props_placement = props.placement, placement = _props_placement === void 0 ? 'bottom' : _props_placement, label = props.label, labelPlacement = props.labelPlacement, placeholder = props.placeholder, helperText = props.helperText, _props_disabled = props.disabled, disabled = _props_disabled === void 0 ? false : _props_disabled, _props_readOnly = props.readOnly, readOnly = _props_readOnly === void 0 ? false : _props_readOnly, outerView = props.view, size = props.size, listOverflow = props.listOverflow, listHeight = props.listHeight, listMaxHeight = props.listMaxHeight, listWidth = props.listWidth, contentLeft = props.contentLeft, onScrollBottom = props.onScrollBottom, onScroll = props.onScroll, chipView = props.chipView, _props_variant = props.variant, variant = _props_variant === void 0 ? 'normal' : _props_variant, portal = props.portal, renderValue = props.renderValue, renderItem = props.renderItem, status = props.status, onItemSelect = props.onItemSelect, separator = props.separator, outerCloseAfterSelect = props.closeAfterSelect, isTargetAmount = props.isTargetAmount, beforeList = props.beforeList, afterList = props.afterList, zIndex = props.zIndex, name = props.name, defaultValue = props.defaultValue, _props_virtual = props.virtual, virtual = _props_virtual === void 0 ? false : _props_virtual, onToggle = props.onToggle, chipType = props.chipType, multiselect = props.multiselect, _props_mode = props.mode, mode = _props_mode === void 0 ? 'default' : _props_mode, chipClickArea = props.chipClickArea, // @ts-ignore
|
|
182
182
|
_offset = props._offset, // Извлекаем пропсы для required и hint, чтобы они не попадали в DOM.
|
|
183
183
|
// @ts-ignore
|
|
184
184
|
required = props.required, // @ts-ignore
|
|
@@ -199,6 +199,8 @@ var selectRoot = function(Root) {
|
|
|
199
199
|
"onChange",
|
|
200
200
|
"target",
|
|
201
201
|
"items",
|
|
202
|
+
"treeView",
|
|
203
|
+
"arrowPlacement",
|
|
202
204
|
"placement",
|
|
203
205
|
"label",
|
|
204
206
|
"labelPlacement",
|
|
@@ -257,13 +259,14 @@ var selectRoot = function(Root) {
|
|
|
257
259
|
items
|
|
258
260
|
]);
|
|
259
261
|
// Создаем структуры для быстрой работы с деревом
|
|
260
|
-
var _usePathMaps1 = _sliced_to_array((0, _usePathMaps.usePathMaps)(transformedItems),
|
|
262
|
+
var _usePathMaps1 = _sliced_to_array((0, _usePathMaps.usePathMaps)(transformedItems), 5), pathMap = _usePathMaps1[0], focusedToValueMap = _usePathMaps1[1], valueToCheckedMap = _usePathMaps1[2], valueToItemMap = _usePathMaps1[3], valueToPathMap = _usePathMaps1[4];
|
|
261
263
|
var _useState = _sliced_to_array((0, _react.useState)(props.multiselect ? [] : ''), 2), internalValue = _useState[0], setInternalValue = _useState[1];
|
|
262
264
|
var value = outerValue !== null && outerValue !== undefined ? outerValue : internalValue;
|
|
263
265
|
var floatingPopoverRef = (0, _react.useRef)(null);
|
|
264
266
|
// Состояния дерева элементов
|
|
265
267
|
var _useReducer = _sliced_to_array((0, _react.useReducer)(_reducers.pathReducer, []), 2), path = _useReducer[0], dispatchPath = _useReducer[1];
|
|
266
|
-
var _useReducer1 = _sliced_to_array((0, _react.useReducer)(_reducers.
|
|
268
|
+
var _useReducer1 = _sliced_to_array((0, _react.useReducer)(_reducers.treePathReducer, {}), 2), treePath = _useReducer1[0], dispatchTreePath = _useReducer1[1];
|
|
269
|
+
var _useReducer2 = _sliced_to_array((0, _react.useReducer)(_reducers.focusedPathReducer, []), 2), focusedPath = _useReducer2[0], dispatchFocusedPath = _useReducer2[1];
|
|
267
270
|
var _useState1 = _sliced_to_array((0, _react.useState)(valueToCheckedMap), 2), checked = _useState1[0], setChecked = _useState1[1];
|
|
268
271
|
var isCurrentListOpen = Boolean(path[0]);
|
|
269
272
|
var activeDescendantItemValue = ((_getItemByFocused = (0, _useKeyboardNavigation.getItemByFocused)(focusedPath, focusedToValueMap)) === null || _getItemByFocused === void 0 ? void 0 : _getItemByFocused.value.toString()) || '';
|
|
@@ -332,6 +335,9 @@ var selectRoot = function(Root) {
|
|
|
332
335
|
dispatchPath({
|
|
333
336
|
type: 'reset'
|
|
334
337
|
});
|
|
338
|
+
dispatchTreePath({
|
|
339
|
+
type: 'reset'
|
|
340
|
+
});
|
|
335
341
|
// Скроллим чипы к левому краю при закрытии компонента
|
|
336
342
|
var el = rootRef === null || rootRef === void 0 ? void 0 : (_rootRef_current = rootRef.current) === null || _rootRef_current === void 0 ? void 0 : _rootRef_current.querySelector('.input-scrollable-wrapper');
|
|
337
343
|
if (multiselect && value.length > 0 && el) {
|
|
@@ -394,6 +400,9 @@ var selectRoot = function(Root) {
|
|
|
394
400
|
dispatchFocusedPath({
|
|
395
401
|
type: 'reset'
|
|
396
402
|
});
|
|
403
|
+
dispatchTreePath({
|
|
404
|
+
type: 'reset'
|
|
405
|
+
});
|
|
397
406
|
}
|
|
398
407
|
if (onChange) {
|
|
399
408
|
onChange(newValues, item);
|
|
@@ -418,6 +427,9 @@ var selectRoot = function(Root) {
|
|
|
418
427
|
dispatchFocusedPath({
|
|
419
428
|
type: 'reset'
|
|
420
429
|
});
|
|
430
|
+
dispatchTreePath({
|
|
431
|
+
type: 'reset'
|
|
432
|
+
});
|
|
421
433
|
}
|
|
422
434
|
// Закрываем список, если элемент уже выбран.
|
|
423
435
|
if (mode === 'radio' && isCurrentChecked) {
|
|
@@ -455,7 +467,11 @@ var selectRoot = function(Root) {
|
|
|
455
467
|
pathMap: pathMap,
|
|
456
468
|
focusedToValueMap: focusedToValueMap,
|
|
457
469
|
handleListToggle: handleListToggle,
|
|
458
|
-
handlePressDown: handlePressDown
|
|
470
|
+
handlePressDown: handlePressDown,
|
|
471
|
+
treePath: treePath,
|
|
472
|
+
dispatchTreePath: dispatchTreePath,
|
|
473
|
+
treeView: treeView,
|
|
474
|
+
valueToPathMap: valueToPathMap
|
|
459
475
|
}).onKeyDown;
|
|
460
476
|
// В данном эффекте мы следим за изменениями value снаружи и вносим коррективы в дерево чекбоксов.
|
|
461
477
|
// Пример: когда юзер очистил value извне, тогда нужно пройтись по элементам и выключить все чекбоксы.
|
|
@@ -530,7 +546,11 @@ var selectRoot = function(Root) {
|
|
|
530
546
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
531
547
|
// @ts-ignore
|
|
532
548
|
// eslint-disable-next-line no-underscore-dangle
|
|
533
|
-
_checkboxAppearance: rest._checkboxAppearance
|
|
549
|
+
_checkboxAppearance: rest._checkboxAppearance,
|
|
550
|
+
treePath: treePath,
|
|
551
|
+
dispatchTreePath: dispatchTreePath,
|
|
552
|
+
arrowPlacement: arrowPlacement,
|
|
553
|
+
valueToPathMap: valueToPathMap
|
|
534
554
|
}
|
|
535
555
|
}, /*#__PURE__*/ _react.default.createElement(_FloatingPopover.FloatingPopover, {
|
|
536
556
|
ref: floatingPopoverRef,
|
|
@@ -579,7 +599,14 @@ var selectRoot = function(Root) {
|
|
|
579
599
|
chipView: chipView,
|
|
580
600
|
disabled: disabled,
|
|
581
601
|
readOnly: readOnly
|
|
582
|
-
}, rest), /*#__PURE__*/ _react.default.createElement(
|
|
602
|
+
}, rest), treeView ? /*#__PURE__*/ _react.default.createElement(_ui.TreeList, {
|
|
603
|
+
items: items,
|
|
604
|
+
listMaxHeight: listMaxHeight,
|
|
605
|
+
onScroll: virtual ? undefined : handleScroll,
|
|
606
|
+
virtual: virtual,
|
|
607
|
+
beforeList: beforeList,
|
|
608
|
+
afterList: afterList
|
|
609
|
+
}) : /*#__PURE__*/ _react.default.createElement(_Selectstyles.ListWrapper, {
|
|
583
610
|
ref: listWrapperRef,
|
|
584
611
|
listWidth: listWidth
|
|
585
612
|
}, /*#__PURE__*/ _react.default.createElement(_Selectstyles.Ul, {
|
|
@@ -54,6 +54,8 @@ var tokens = {
|
|
|
54
54
|
itemDisabledOpacity: '--plasma-select-item-disabled-opacity',
|
|
55
55
|
itemDisabledColor: '--plasma-select-item-disabled-color',
|
|
56
56
|
itemIconColor: '--plasma-select-item-icon-color',
|
|
57
|
+
itemGap: '--plasma-select-item-gap',
|
|
58
|
+
itemTreeOffsetWidth: '--plasma-select-item-tree-offset-width',
|
|
57
59
|
cellPadding: '--plasma-select-cell-padding',
|
|
58
60
|
cellPaddingLeftContent: '--plasma-select-cell-padding-left-content',
|
|
59
61
|
cellPaddingContent: '--plasma-select-cell-padding-content',
|
|
@@ -19,6 +19,7 @@ _export(exports, {
|
|
|
19
19
|
return useKeyNavigation;
|
|
20
20
|
}
|
|
21
21
|
});
|
|
22
|
+
var _treePathReducer = require("../reducers/treePathReducer");
|
|
22
23
|
var JUMP_SIZE = 10;
|
|
23
24
|
var keys = {
|
|
24
25
|
Enter: 'Enter',
|
|
@@ -42,6 +43,39 @@ var getItemByFocused = function(focusedPath, focusedToValueMap) {
|
|
|
42
43
|
return focusedToValueMap.get(focusedPathAsString);
|
|
43
44
|
};
|
|
44
45
|
var useKeyNavigation = function(param) {
|
|
46
|
+
var focusedPath = param.focusedPath, dispatchFocusedPath = param.dispatchFocusedPath, path = param.path, dispatchPath = param.dispatchPath, pathMap = param.pathMap, focusedToValueMap = param.focusedToValueMap, handleListToggle = param.handleListToggle, handlePressDown = param.handlePressDown, treePath = param.treePath, dispatchTreePath = param.dispatchTreePath, treeView = param.treeView, valueToPathMap = param.valueToPathMap;
|
|
47
|
+
if (treeView) {
|
|
48
|
+
return keyboardNavigationTree({
|
|
49
|
+
focusedPath: focusedPath,
|
|
50
|
+
dispatchFocusedPath: dispatchFocusedPath,
|
|
51
|
+
path: path,
|
|
52
|
+
dispatchPath: dispatchPath,
|
|
53
|
+
pathMap: pathMap,
|
|
54
|
+
focusedToValueMap: focusedToValueMap,
|
|
55
|
+
handleListToggle: handleListToggle,
|
|
56
|
+
handlePressDown: handlePressDown,
|
|
57
|
+
treePath: treePath,
|
|
58
|
+
dispatchTreePath: dispatchTreePath,
|
|
59
|
+
treeView: treeView,
|
|
60
|
+
valueToPathMap: valueToPathMap
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
return keyboardNavigationDefault({
|
|
64
|
+
focusedPath: focusedPath,
|
|
65
|
+
dispatchFocusedPath: dispatchFocusedPath,
|
|
66
|
+
path: path,
|
|
67
|
+
dispatchPath: dispatchPath,
|
|
68
|
+
pathMap: pathMap,
|
|
69
|
+
focusedToValueMap: focusedToValueMap,
|
|
70
|
+
handleListToggle: handleListToggle,
|
|
71
|
+
handlePressDown: handlePressDown,
|
|
72
|
+
treePath: treePath,
|
|
73
|
+
dispatchTreePath: dispatchTreePath,
|
|
74
|
+
treeView: treeView,
|
|
75
|
+
valueToPathMap: valueToPathMap
|
|
76
|
+
});
|
|
77
|
+
};
|
|
78
|
+
var keyboardNavigationDefault = function(param) {
|
|
45
79
|
var focusedPath = param.focusedPath, dispatchFocusedPath = param.dispatchFocusedPath, path = param.path, dispatchPath = param.dispatchPath, pathMap = param.pathMap, focusedToValueMap = param.focusedToValueMap, handleListToggle = param.handleListToggle, handlePressDown = param.handlePressDown;
|
|
46
80
|
var currentIndex = (focusedPath === null || focusedPath === void 0 ? void 0 : focusedPath[focusedPath.length - 1]) || 0;
|
|
47
81
|
var currentLength = pathMap.get(path === null || path === void 0 ? void 0 : path[focusedPath.length - 1]) || 0;
|
|
@@ -306,3 +340,135 @@ var useKeyNavigation = function(param) {
|
|
|
306
340
|
onKeyDown: onKeyDown
|
|
307
341
|
};
|
|
308
342
|
};
|
|
343
|
+
var keyboardNavigationTree = function(param) {
|
|
344
|
+
var focusedPath = param.focusedPath, dispatchFocusedPath = param.dispatchFocusedPath, path = param.path, dispatchPath = param.dispatchPath, pathMap = param.pathMap, focusedToValueMap = param.focusedToValueMap, handleListToggle = param.handleListToggle, handlePressDown = param.handlePressDown, treePath = param.treePath, dispatchTreePath = param.dispatchTreePath, valueToPathMap = param.valueToPathMap;
|
|
345
|
+
var _currentItem_parent_items, _currentItem_parent;
|
|
346
|
+
var currentIndex = (focusedPath === null || focusedPath === void 0 ? void 0 : focusedPath[focusedPath.length - 1]) || 0;
|
|
347
|
+
var currentItem = getItemByFocused(focusedPath, focusedToValueMap);
|
|
348
|
+
var currentLength = (currentItem === null || currentItem === void 0 ? void 0 : (_currentItem_parent = currentItem.parent) === null || _currentItem_parent === void 0 ? void 0 : (_currentItem_parent_items = _currentItem_parent.items) === null || _currentItem_parent_items === void 0 ? void 0 : _currentItem_parent_items.length) || pathMap.get('root') || 0;
|
|
349
|
+
var onKeyDown = function(event) {
|
|
350
|
+
switch(event.code){
|
|
351
|
+
case keys.ArrowUp:
|
|
352
|
+
{
|
|
353
|
+
if (focusedPath.length) {
|
|
354
|
+
if (currentIndex > 0) {
|
|
355
|
+
dispatchFocusedPath({
|
|
356
|
+
type: 'change_last_focus',
|
|
357
|
+
value: currentIndex - 1
|
|
358
|
+
});
|
|
359
|
+
}
|
|
360
|
+
} else {
|
|
361
|
+
dispatchPath({
|
|
362
|
+
type: 'opened_first_level'
|
|
363
|
+
});
|
|
364
|
+
dispatchFocusedPath({
|
|
365
|
+
type: 'set_initial_focus'
|
|
366
|
+
});
|
|
367
|
+
handleListToggle(true);
|
|
368
|
+
}
|
|
369
|
+
break;
|
|
370
|
+
}
|
|
371
|
+
case keys.ArrowDown:
|
|
372
|
+
{
|
|
373
|
+
if (focusedPath.length) {
|
|
374
|
+
if (currentIndex + 1 < currentLength) {
|
|
375
|
+
dispatchFocusedPath({
|
|
376
|
+
type: 'change_last_focus',
|
|
377
|
+
value: currentIndex + 1
|
|
378
|
+
});
|
|
379
|
+
}
|
|
380
|
+
} else {
|
|
381
|
+
dispatchPath({
|
|
382
|
+
type: 'opened_first_level'
|
|
383
|
+
});
|
|
384
|
+
dispatchFocusedPath({
|
|
385
|
+
type: 'set_initial_focus'
|
|
386
|
+
});
|
|
387
|
+
handleListToggle(true);
|
|
388
|
+
}
|
|
389
|
+
break;
|
|
390
|
+
}
|
|
391
|
+
case keys.ArrowLeft:
|
|
392
|
+
{
|
|
393
|
+
if (path[0]) {
|
|
394
|
+
if (focusedPath.length) {
|
|
395
|
+
var isCurrentLevelOpened = (0, _treePathReducer.keyExists)(treePath, valueToPathMap.get((currentItem === null || currentItem === void 0 ? void 0 : currentItem.value.toString()) || '') || []);
|
|
396
|
+
if (isCurrentLevelOpened) {
|
|
397
|
+
dispatchTreePath({
|
|
398
|
+
type: 'toggled_level',
|
|
399
|
+
value: valueToPathMap.get((currentItem === null || currentItem === void 0 ? void 0 : currentItem.value.toString()) || '') || []
|
|
400
|
+
});
|
|
401
|
+
} else if (focusedPath.length === 1) {
|
|
402
|
+
handleListToggle(false);
|
|
403
|
+
} else {
|
|
404
|
+
dispatchFocusedPath({
|
|
405
|
+
type: 'return_prev_focus'
|
|
406
|
+
});
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
break;
|
|
411
|
+
}
|
|
412
|
+
case keys.ArrowRight:
|
|
413
|
+
{
|
|
414
|
+
if (path[0]) {
|
|
415
|
+
if (!focusedPath.length) {
|
|
416
|
+
break;
|
|
417
|
+
}
|
|
418
|
+
if ((currentItem === null || currentItem === void 0 ? void 0 : currentItem.disabled) || (currentItem === null || currentItem === void 0 ? void 0 : currentItem.isDisabled)) {
|
|
419
|
+
break;
|
|
420
|
+
}
|
|
421
|
+
if (currentItem === null || currentItem === void 0 ? void 0 : currentItem.items) {
|
|
422
|
+
var isCurrentLevelOpened1 = (0, _treePathReducer.keyExists)(treePath, valueToPathMap.get(currentItem.value.toString()) || []);
|
|
423
|
+
if (isCurrentLevelOpened1) {
|
|
424
|
+
dispatchFocusedPath({
|
|
425
|
+
type: 'add_focus',
|
|
426
|
+
value: 0
|
|
427
|
+
});
|
|
428
|
+
} else {
|
|
429
|
+
dispatchTreePath({
|
|
430
|
+
type: 'toggled_level',
|
|
431
|
+
value: valueToPathMap.get(currentItem.value.toString()) || []
|
|
432
|
+
});
|
|
433
|
+
}
|
|
434
|
+
}
|
|
435
|
+
}
|
|
436
|
+
break;
|
|
437
|
+
}
|
|
438
|
+
case keys.Space:
|
|
439
|
+
case keys.Enter:
|
|
440
|
+
{
|
|
441
|
+
event.preventDefault();
|
|
442
|
+
if (!path[0]) {
|
|
443
|
+
dispatchPath({
|
|
444
|
+
type: 'opened_first_level'
|
|
445
|
+
});
|
|
446
|
+
dispatchFocusedPath({
|
|
447
|
+
type: 'set_initial_focus'
|
|
448
|
+
});
|
|
449
|
+
break;
|
|
450
|
+
}
|
|
451
|
+
if (!currentItem || (currentItem === null || currentItem === void 0 ? void 0 : currentItem.disabled) || (currentItem === null || currentItem === void 0 ? void 0 : currentItem.isDisabled)) {
|
|
452
|
+
break;
|
|
453
|
+
}
|
|
454
|
+
handlePressDown(currentItem);
|
|
455
|
+
break;
|
|
456
|
+
}
|
|
457
|
+
case keys.Tab:
|
|
458
|
+
case keys.Escape:
|
|
459
|
+
{
|
|
460
|
+
if (path[0]) {
|
|
461
|
+
handleListToggle(false);
|
|
462
|
+
}
|
|
463
|
+
break;
|
|
464
|
+
}
|
|
465
|
+
default:
|
|
466
|
+
{
|
|
467
|
+
break;
|
|
468
|
+
}
|
|
469
|
+
}
|
|
470
|
+
};
|
|
471
|
+
return {
|
|
472
|
+
onKeyDown: onKeyDown
|
|
473
|
+
};
|
|
474
|
+
};
|
|
@@ -9,24 +9,55 @@ Object.defineProperty(exports, "usePathMaps", {
|
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
11
|
var _utils = require("../../../utils");
|
|
12
|
+
function _array_like_to_array(arr, len) {
|
|
13
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
14
|
+
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
15
|
+
return arr2;
|
|
16
|
+
}
|
|
17
|
+
function _array_without_holes(arr) {
|
|
18
|
+
if (Array.isArray(arr)) return _array_like_to_array(arr);
|
|
19
|
+
}
|
|
20
|
+
function _iterable_to_array(iter) {
|
|
21
|
+
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
22
|
+
}
|
|
23
|
+
function _non_iterable_spread() {
|
|
24
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
25
|
+
}
|
|
26
|
+
function _to_consumable_array(arr) {
|
|
27
|
+
return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread();
|
|
28
|
+
}
|
|
29
|
+
function _unsupported_iterable_to_array(o, minLen) {
|
|
30
|
+
if (!o) return;
|
|
31
|
+
if (typeof o === "string") return _array_like_to_array(o, minLen);
|
|
32
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
33
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
34
|
+
if (n === "Map" || n === "Set") return Array.from(n);
|
|
35
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
36
|
+
}
|
|
12
37
|
var usePathMaps = function(items) {
|
|
13
38
|
var pathMap = new Map();
|
|
14
39
|
var focusedToValueMap = new Map();
|
|
15
40
|
var valueToCheckedMap = new Map();
|
|
16
41
|
var valueToItemMap = new Map();
|
|
42
|
+
var valueToPathMap = new Map();
|
|
17
43
|
pathMap.set('root', (items === null || items === void 0 ? void 0 : items.length) || 0);
|
|
18
44
|
var rec = function(items) {
|
|
19
|
-
var prevIndex = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : '';
|
|
45
|
+
var prevIndex = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : '', path = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : [];
|
|
20
46
|
items === null || items === void 0 ? void 0 : items.forEach(function(item, index) {
|
|
21
47
|
var value = item.value, innerItems = item.items;
|
|
22
48
|
var currIndex = "".concat(prevIndex, "/").concat(index).replace(/^(\/)/, '');
|
|
23
49
|
focusedToValueMap.set(currIndex, item);
|
|
24
50
|
valueToCheckedMap.set(value, false);
|
|
51
|
+
valueToPathMap.set(value.toString(), _to_consumable_array(path).concat([
|
|
52
|
+
value.toString()
|
|
53
|
+
]));
|
|
25
54
|
if ((0, _utils.isEmpty)(innerItems) || !innerItems) {
|
|
26
55
|
valueToItemMap.set(value, item);
|
|
27
56
|
} else {
|
|
28
57
|
pathMap.set(value, innerItems.length);
|
|
29
|
-
rec(innerItems, currIndex)
|
|
58
|
+
rec(innerItems, currIndex, _to_consumable_array(path).concat([
|
|
59
|
+
value.toString()
|
|
60
|
+
]));
|
|
30
61
|
}
|
|
31
62
|
});
|
|
32
63
|
};
|
|
@@ -35,6 +66,7 @@ var usePathMaps = function(items) {
|
|
|
35
66
|
pathMap,
|
|
36
67
|
focusedToValueMap,
|
|
37
68
|
valueToCheckedMap,
|
|
38
|
-
valueToItemMap
|
|
69
|
+
valueToItemMap,
|
|
70
|
+
valueToPathMap
|
|
39
71
|
];
|
|
40
72
|
};
|
|
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
});
|
|
5
5
|
_export_star(require("./pathReducer"), exports);
|
|
6
6
|
_export_star(require("./focusedPathReducer"), exports);
|
|
7
|
+
_export_star(require("./treePathReducer"), exports);
|
|
7
8
|
function _export_star(from, to) {
|
|
8
9
|
Object.keys(from).forEach(function(k) {
|
|
9
10
|
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
function _export(target, all) {
|
|
6
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: Object.getOwnPropertyDescriptor(all, name).get
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
_export(exports, {
|
|
12
|
+
get keyExists () {
|
|
13
|
+
return keyExists;
|
|
14
|
+
},
|
|
15
|
+
get treePathReducer () {
|
|
16
|
+
return treePathReducer;
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
var _utils = require("../../../utils");
|
|
20
|
+
function _type_of(obj) {
|
|
21
|
+
"@swc/helpers - typeof";
|
|
22
|
+
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
23
|
+
}
|
|
24
|
+
var keyExists = function(obj, path) {
|
|
25
|
+
if ((typeof obj === "undefined" ? "undefined" : _type_of(obj)) !== 'object' || obj === null || !Array.isArray(path)) {
|
|
26
|
+
return false;
|
|
27
|
+
}
|
|
28
|
+
var current = obj;
|
|
29
|
+
for(var i = 0; i < path.length; i++){
|
|
30
|
+
var key = path[i];
|
|
31
|
+
if (current === null || (typeof current === "undefined" ? "undefined" : _type_of(current)) !== 'object' || !(key in current)) {
|
|
32
|
+
return false;
|
|
33
|
+
}
|
|
34
|
+
current = current[key];
|
|
35
|
+
}
|
|
36
|
+
return true;
|
|
37
|
+
};
|
|
38
|
+
function createObjectAtPath(obj, path) {
|
|
39
|
+
if ((typeof obj === "undefined" ? "undefined" : _type_of(obj)) !== 'object' || obj === null) {
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
var current = obj;
|
|
43
|
+
for(var i = 0; i < path.length; i++){
|
|
44
|
+
var key = path[i];
|
|
45
|
+
if (i === path.length - 1) {
|
|
46
|
+
current[key] = {};
|
|
47
|
+
break;
|
|
48
|
+
}
|
|
49
|
+
if (current[key] === undefined || current[key] === null) {
|
|
50
|
+
current[key] = {};
|
|
51
|
+
}
|
|
52
|
+
current = current[key];
|
|
53
|
+
}
|
|
54
|
+
return obj;
|
|
55
|
+
}
|
|
56
|
+
function removeObjectAtPath(obj, path) {
|
|
57
|
+
if (path.length === 0) {
|
|
58
|
+
return obj;
|
|
59
|
+
}
|
|
60
|
+
var current = obj;
|
|
61
|
+
for(var i = 0; i < path.length; i++){
|
|
62
|
+
var key = path[i];
|
|
63
|
+
if (current === null || (typeof current === "undefined" ? "undefined" : _type_of(current)) !== 'object' || !(key in current)) {
|
|
64
|
+
return obj;
|
|
65
|
+
}
|
|
66
|
+
if (i === path.length - 1) {
|
|
67
|
+
delete current[key];
|
|
68
|
+
break;
|
|
69
|
+
}
|
|
70
|
+
current = current[key];
|
|
71
|
+
}
|
|
72
|
+
return obj;
|
|
73
|
+
}
|
|
74
|
+
function treePathReducer(state, action) {
|
|
75
|
+
switch(action.type){
|
|
76
|
+
case 'reset':
|
|
77
|
+
{
|
|
78
|
+
return {};
|
|
79
|
+
}
|
|
80
|
+
case 'toggled_level':
|
|
81
|
+
{
|
|
82
|
+
var stateCopy = (0, _utils.deepCopy)(state);
|
|
83
|
+
var isTargetLevelOpened = keyExists(stateCopy, action.value);
|
|
84
|
+
if (isTargetLevelOpened) {
|
|
85
|
+
// нужно закрыть текущий уровень
|
|
86
|
+
removeObjectAtPath(stateCopy, action.value);
|
|
87
|
+
} else {
|
|
88
|
+
// нужно открыть требуемый уровень
|
|
89
|
+
createObjectAtPath(stateCopy, action.value);
|
|
90
|
+
}
|
|
91
|
+
return stateCopy;
|
|
92
|
+
}
|
|
93
|
+
default:
|
|
94
|
+
{
|
|
95
|
+
return state;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "TreeList", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return TreeList;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
var _react = /*#__PURE__*/ _interop_require_wildcard(require("react"));
|
|
12
|
+
var _reactvirtual = require("@tanstack/react-virtual");
|
|
13
|
+
var _utils = require("../../../../utils");
|
|
14
|
+
var _Item = require("./ui/Item/Item");
|
|
15
|
+
var _TreeListstyles = require("./TreeList.styles");
|
|
16
|
+
function _getRequireWildcardCache(nodeInterop) {
|
|
17
|
+
if (typeof WeakMap !== "function") return null;
|
|
18
|
+
var cacheBabelInterop = new WeakMap();
|
|
19
|
+
var cacheNodeInterop = new WeakMap();
|
|
20
|
+
return (_getRequireWildcardCache = function(nodeInterop) {
|
|
21
|
+
return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
|
|
22
|
+
})(nodeInterop);
|
|
23
|
+
}
|
|
24
|
+
function _interop_require_wildcard(obj, nodeInterop) {
|
|
25
|
+
if (!nodeInterop && obj && obj.__esModule) {
|
|
26
|
+
return obj;
|
|
27
|
+
}
|
|
28
|
+
if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
|
|
29
|
+
return {
|
|
30
|
+
default: obj
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
var cache = _getRequireWildcardCache(nodeInterop);
|
|
34
|
+
if (cache && cache.has(obj)) {
|
|
35
|
+
return cache.get(obj);
|
|
36
|
+
}
|
|
37
|
+
var newObj = {
|
|
38
|
+
__proto__: null
|
|
39
|
+
};
|
|
40
|
+
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
41
|
+
for(var key in obj){
|
|
42
|
+
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
43
|
+
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
|
|
44
|
+
if (desc && (desc.get || desc.set)) {
|
|
45
|
+
Object.defineProperty(newObj, key, desc);
|
|
46
|
+
} else {
|
|
47
|
+
newObj[key] = obj[key];
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
newObj.default = obj;
|
|
52
|
+
if (cache) {
|
|
53
|
+
cache.set(obj, newObj);
|
|
54
|
+
}
|
|
55
|
+
return newObj;
|
|
56
|
+
}
|
|
57
|
+
var TreeList = function(param) {
|
|
58
|
+
var items = param.items, listMaxHeight = param.listMaxHeight, onScroll = param.onScroll, virtual = param.virtual, beforeList = param.beforeList, afterList = param.afterList;
|
|
59
|
+
if (virtual) {
|
|
60
|
+
return /*#__PURE__*/ _react.default.createElement(VirtualTreeList, {
|
|
61
|
+
items: items,
|
|
62
|
+
listMaxHeight: listMaxHeight,
|
|
63
|
+
onScroll: onScroll,
|
|
64
|
+
beforeList: beforeList,
|
|
65
|
+
afterList: afterList
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
return /*#__PURE__*/ _react.default.createElement(_TreeListstyles.ListWrapper, null, /*#__PURE__*/ _react.default.createElement(_TreeListstyles.ScrollContainer, {
|
|
69
|
+
listMaxHeight: listMaxHeight,
|
|
70
|
+
onScroll: onScroll
|
|
71
|
+
}, beforeList, items === null || items === void 0 ? void 0 : items.map(function(item, index) {
|
|
72
|
+
return /*#__PURE__*/ _react.default.createElement(_Item.Item, {
|
|
73
|
+
key: index,
|
|
74
|
+
index: index,
|
|
75
|
+
item: item
|
|
76
|
+
});
|
|
77
|
+
}), afterList));
|
|
78
|
+
};
|
|
79
|
+
var VirtualTreeList = function(param) {
|
|
80
|
+
var _param_items = param.items, items = _param_items === void 0 ? [] : _param_items, listMaxHeight = param.listMaxHeight, onScroll = param.onScroll, beforeList = param.beforeList, afterList = param.afterList;
|
|
81
|
+
var _virtualItems_;
|
|
82
|
+
var parentRef = (0, _react.useRef)(null);
|
|
83
|
+
var virtualizer = (0, _reactvirtual.useVirtualizer)({
|
|
84
|
+
count: items.length,
|
|
85
|
+
getScrollElement: function() {
|
|
86
|
+
return parentRef.current;
|
|
87
|
+
},
|
|
88
|
+
estimateSize: function() {
|
|
89
|
+
return 48;
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
var virtualItems = virtualizer.getVirtualItems();
|
|
93
|
+
var _virtualItems__start;
|
|
94
|
+
return /*#__PURE__*/ _react.default.createElement(_TreeListstyles.ListWrapper, null, beforeList, /*#__PURE__*/ _react.default.createElement("div", {
|
|
95
|
+
ref: parentRef,
|
|
96
|
+
style: {
|
|
97
|
+
height: 'auto',
|
|
98
|
+
maxHeight: (0, _utils.getHeightAsNumber)(listMaxHeight),
|
|
99
|
+
overflowY: 'auto'
|
|
100
|
+
},
|
|
101
|
+
onScroll: onScroll
|
|
102
|
+
}, /*#__PURE__*/ _react.default.createElement("div", {
|
|
103
|
+
style: {
|
|
104
|
+
height: virtualizer.getTotalSize(),
|
|
105
|
+
width: '100%',
|
|
106
|
+
position: 'relative'
|
|
107
|
+
}
|
|
108
|
+
}, /*#__PURE__*/ _react.default.createElement("div", {
|
|
109
|
+
style: {
|
|
110
|
+
position: 'absolute',
|
|
111
|
+
top: 0,
|
|
112
|
+
left: 0,
|
|
113
|
+
width: '100%',
|
|
114
|
+
transform: "translateY(".concat((_virtualItems__start = (_virtualItems_ = virtualItems[0]) === null || _virtualItems_ === void 0 ? void 0 : _virtualItems_.start) !== null && _virtualItems__start !== void 0 ? _virtualItems__start : 0, "px)")
|
|
115
|
+
}
|
|
116
|
+
}, virtualItems.map(function(virtualRow) {
|
|
117
|
+
return /*#__PURE__*/ _react.default.createElement("div", {
|
|
118
|
+
key: virtualRow.key,
|
|
119
|
+
"data-index": virtualRow.index,
|
|
120
|
+
ref: virtualizer.measureElement
|
|
121
|
+
}, /*#__PURE__*/ _react.default.createElement(_Item.Item, {
|
|
122
|
+
item: items[virtualRow.index],
|
|
123
|
+
index: virtualRow.index
|
|
124
|
+
}));
|
|
125
|
+
})))), afterList);
|
|
126
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
function _export(target, all) {
|
|
6
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: Object.getOwnPropertyDescriptor(all, name).get
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
_export(exports, {
|
|
12
|
+
get ListWrapper () {
|
|
13
|
+
return ListWrapper;
|
|
14
|
+
},
|
|
15
|
+
get ScrollContainer () {
|
|
16
|
+
return ScrollContainer;
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
var _styled = /*#__PURE__*/ _interop_require_default(require("@emotion/styled"));
|
|
20
|
+
var _Selecttokens = require("../../Select.tokens");
|
|
21
|
+
function _interop_require_default(obj) {
|
|
22
|
+
return obj && obj.__esModule ? obj : {
|
|
23
|
+
default: obj
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
var ListWrapper = (0, /*#__PURE__*/ _styled.default)("div", {
|
|
27
|
+
target: "evbtu0r0",
|
|
28
|
+
label: "ListWrapper"
|
|
29
|
+
})("width:100%;padding:calc(var(", _Selecttokens.tokens.padding, ") + var(", _Selecttokens.tokens.dropdownBorderWidth, ",0rem));border-radius:var(", _Selecttokens.tokens.borderRadius, ");box-sizing:border-box;background:var(", _Selecttokens.constants.background, ");box-shadow:", _Selecttokens.constants.boxShadow, ",inset 0 0 0 var(", _Selecttokens.tokens.dropdownBorderWidth, ",0rem) var(", _Selecttokens.tokens.dropdownBorderColor, ",transparent);", "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic3JjLWVtb3Rpb24vY29tcG9uZW50cy9TZWxlY3QvdWkvVHJlZUxpc3QvVHJlZUxpc3Quc3R5bGVzLnRzIiwic291cmNlcyI6WyJzcmMtZW1vdGlvbi9jb21wb25lbnRzL1NlbGVjdC91aS9UcmVlTGlzdC9UcmVlTGlzdC5zdHlsZXMudHMiXSwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHN0eWxlZCBmcm9tICdAZW1vdGlvbi9zdHlsZWQnO1xuaW1wb3J0IHsgU2VsZWN0UHJvcHMgfSBmcm9tICdzcmMvY29tcG9uZW50cy9TZWxlY3QnO1xuXG5pbXBvcnQgeyBjb25zdGFudHMsIHRva2VucyB9IGZyb20gJy4uLy4uL1NlbGVjdC50b2tlbnMnO1xuXG5leHBvcnQgY29uc3QgTGlzdFdyYXBwZXIgPSBzdHlsZWQuZGl2YFxuICAgIHdpZHRoOiAxMDAlO1xuICAgIHBhZGRpbmc6IGNhbGModmFyKCR7dG9rZW5zLnBhZGRpbmd9KSArIHZhcigke3Rva2Vucy5kcm9wZG93bkJvcmRlcldpZHRofSwgMHJlbSkpO1xuICAgIGJvcmRlci1yYWRpdXM6IHZhcigke3Rva2Vucy5ib3JkZXJSYWRpdXN9KTtcbiAgICBib3gtc2l6aW5nOiBib3JkZXItYm94O1xuICAgIGJhY2tncm91bmQ6IHZhcigke2NvbnN0YW50cy5iYWNrZ3JvdW5kfSk7XG4gICAgYm94LXNoYWRvdzogJHtjb25zdGFudHMuYm94U2hhZG93fSxcbiAgICAgICAgaW5zZXQgMCAwIDAgdmFyKCR7dG9rZW5zLmRyb3Bkb3duQm9yZGVyV2lkdGh9LCAwcmVtKSB2YXIoJHt0b2tlbnMuZHJvcGRvd25Cb3JkZXJDb2xvcn0sIHRyYW5zcGFyZW50KTtcbmA7XG5cbmV4cG9ydCBjb25zdCBTY3JvbGxDb250YWluZXIgPSBzdHlsZWQuZGl2PHtcbiAgICBsaXN0TWF4SGVpZ2h0PzogU2VsZWN0UHJvcHNbJ2xpc3RNYXhIZWlnaHQnXTtcbn0+YFxuICAgIG1heC1oZWlnaHQ6ICR7KHsgbGlzdE1heEhlaWdodCB9KSA9PiBsaXN0TWF4SGVpZ2h0IHx8ICdhdXRvJ307XG4gICAgb3ZlcmZsb3cteDogaGlkZGVuO1xuICAgIG92ZXJmbG93LXk6IGF1dG87XG4gICAgYm9yZGVyLXJhZGl1czogY2FsYyh2YXIoJHt0b2tlbnMuYm9yZGVyUmFkaXVzfSkgLSAwLjEyNXJlbSAtIHZhcigke3Rva2Vucy5kcm9wZG93bkJvcmRlcldpZHRofSwgMHJlbSkpO1xuYDtcbiJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFLMkIifQ== */");
|
|
30
|
+
var ScrollContainer = (0, /*#__PURE__*/ _styled.default)("div", {
|
|
31
|
+
target: "evbtu0r1",
|
|
32
|
+
label: "ScrollContainer"
|
|
33
|
+
})("max-height:", function(param) {
|
|
34
|
+
var listMaxHeight = param.listMaxHeight;
|
|
35
|
+
return listMaxHeight || 'auto';
|
|
36
|
+
}, ";overflow-x:hidden;overflow-y:auto;border-radius:calc(var(", _Selecttokens.tokens.borderRadius, ") - 0.125rem - var(", _Selecttokens.tokens.dropdownBorderWidth, ",0rem));", "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic3JjLWVtb3Rpb24vY29tcG9uZW50cy9TZWxlY3QvdWkvVHJlZUxpc3QvVHJlZUxpc3Quc3R5bGVzLnRzIiwic291cmNlcyI6WyJzcmMtZW1vdGlvbi9jb21wb25lbnRzL1NlbGVjdC91aS9UcmVlTGlzdC9UcmVlTGlzdC5zdHlsZXMudHMiXSwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHN0eWxlZCBmcm9tICdAZW1vdGlvbi9zdHlsZWQnO1xuaW1wb3J0IHsgU2VsZWN0UHJvcHMgfSBmcm9tICdzcmMvY29tcG9uZW50cy9TZWxlY3QnO1xuXG5pbXBvcnQgeyBjb25zdGFudHMsIHRva2VucyB9IGZyb20gJy4uLy4uL1NlbGVjdC50b2tlbnMnO1xuXG5leHBvcnQgY29uc3QgTGlzdFdyYXBwZXIgPSBzdHlsZWQuZGl2YFxuICAgIHdpZHRoOiAxMDAlO1xuICAgIHBhZGRpbmc6IGNhbGModmFyKCR7dG9rZW5zLnBhZGRpbmd9KSArIHZhcigke3Rva2Vucy5kcm9wZG93bkJvcmRlcldpZHRofSwgMHJlbSkpO1xuICAgIGJvcmRlci1yYWRpdXM6IHZhcigke3Rva2Vucy5ib3JkZXJSYWRpdXN9KTtcbiAgICBib3gtc2l6aW5nOiBib3JkZXItYm94O1xuICAgIGJhY2tncm91bmQ6IHZhcigke2NvbnN0YW50cy5iYWNrZ3JvdW5kfSk7XG4gICAgYm94LXNoYWRvdzogJHtjb25zdGFudHMuYm94U2hhZG93fSxcbiAgICAgICAgaW5zZXQgMCAwIDAgdmFyKCR7dG9rZW5zLmRyb3Bkb3duQm9yZGVyV2lkdGh9LCAwcmVtKSB2YXIoJHt0b2tlbnMuZHJvcGRvd25Cb3JkZXJDb2xvcn0sIHRyYW5zcGFyZW50KTtcbmA7XG5cbmV4cG9ydCBjb25zdCBTY3JvbGxDb250YWluZXIgPSBzdHlsZWQuZGl2PHtcbiAgICBsaXN0TWF4SGVpZ2h0PzogU2VsZWN0UHJvcHNbJ2xpc3RNYXhIZWlnaHQnXTtcbn0+YFxuICAgIG1heC1oZWlnaHQ6ICR7KHsgbGlzdE1heEhlaWdodCB9KSA9PiBsaXN0TWF4SGVpZ2h0IHx8ICdhdXRvJ307XG4gICAgb3ZlcmZsb3cteDogaGlkZGVuO1xuICAgIG92ZXJmbG93LXk6IGF1dG87XG4gICAgYm9yZGVyLXJhZGl1czogY2FsYyh2YXIoJHt0b2tlbnMuYm9yZGVyUmFkaXVzfSkgLSAwLjEyNXJlbSAtIHZhcigke3Rva2Vucy5kcm9wZG93bkJvcmRlcldpZHRofSwgMHJlbSkpO1xuYDtcbiJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFlK0IifQ== */");
|