ab-ui-library 1.8.0 → 1.10.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/components/SVGIcons/IconBuildingHome.d.ts +4 -0
- package/components/SVGIcons/IconBuildingHome.js +30 -0
- package/components/SVGIcons/IconBuildingHomeFilled.d.ts +4 -0
- package/components/SVGIcons/IconBuildingHomeFilled.js +30 -0
- package/components/SVGIcons/index.d.ts +2 -0
- package/components/SVGIcons/index.js +2 -0
- package/components/Select/MultiSelect/MultiSelect.js +1 -0
- package/components/Select/MultiSelect/MultiSelectTree/MultiSelectTree.d.ts +3 -0
- package/components/Select/MultiSelect/MultiSelectTree/MultiSelectTree.js +252 -0
- package/components/Select/MultiSelect/OptionsWrapper.d.ts +1 -0
- package/components/Select/MultiSelect/OptionsWrapper.js +6 -2
- package/components/Select/index.js +1 -0
- package/components/Select/types.d.ts +5 -0
- package/index.js +3 -0
- package/package.json +1 -1
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { _ as _defineProperty } from '../../defineProperty-dd1f6104.js';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import classNames from 'classnames';
|
|
4
|
+
import '../../typeof-02239c5f.js';
|
|
5
|
+
|
|
6
|
+
var IconBuildingHome = function IconBuildingHome(_ref) {
|
|
7
|
+
var size = _ref.size,
|
|
8
|
+
type = _ref.type,
|
|
9
|
+
_ref$className = _ref.className,
|
|
10
|
+
className = _ref$className === void 0 ? '' : _ref$className,
|
|
11
|
+
onClick = _ref.onClick,
|
|
12
|
+
refHandler = _ref.refHandler,
|
|
13
|
+
id = _ref.id,
|
|
14
|
+
dataId = _ref.dataId;
|
|
15
|
+
return /*#__PURE__*/React.createElement("svg", {
|
|
16
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
17
|
+
className: classNames('svg-icon', _defineProperty(_defineProperty(_defineProperty({}, "svg-icon__size-".concat(size), size), "svg-icon__type-".concat(type), type), className, className)),
|
|
18
|
+
viewBox: "0 0 24 24",
|
|
19
|
+
fill: "none",
|
|
20
|
+
onClick: onClick,
|
|
21
|
+
ref: refHandler,
|
|
22
|
+
id: id,
|
|
23
|
+
"data-id": dataId ? "".concat(dataId, "-svg-icon") : ''
|
|
24
|
+
}, /*#__PURE__*/React.createElement("path", {
|
|
25
|
+
d: "M3.75 3.5C3.61193 3.5 3.5 3.61193 3.5 3.75V16.25C3.5 16.3881 3.61193 16.5 3.75 16.5H9V18H3.75C2.7835 18 2 17.2165 2 16.25V3.75C2 2.7835 2.7835 2 3.75 2H9.25C10.2165 2 11 2.7835 11 3.75V6.75C11 6.88807 11.1119 7 11.25 7H12.25C13.2165 7 14 7.7835 14 8.75V8.82178L12.5 10.2218V8.75C12.5 8.61193 12.3881 8.5 12.25 8.5H11.25C10.2835 8.5 9.5 7.7165 9.5 6.75V3.75C9.5 3.61193 9.38807 3.5 9.25 3.5H3.75ZM6 5.75C6 6.16421 5.66421 6.5 5.25 6.5C4.83579 6.5 4.5 6.16421 4.5 5.75C4.5 5.33579 4.83579 5 5.25 5C5.66421 5 6 5.33579 6 5.75ZM5.25 9.5C5.66421 9.5 6 9.16421 6 8.75C6 8.33579 5.66421 8 5.25 8C4.83579 8 4.5 8.33579 4.5 8.75C4.5 9.16421 4.83579 9.5 5.25 9.5ZM6 11.75C6 12.1642 5.66421 12.5 5.25 12.5C4.83579 12.5 4.5 12.1642 4.5 11.75C4.5 11.3358 4.83579 11 5.25 11C5.66421 11 6 11.3358 6 11.75ZM7.75 6.5C8.16421 6.5 8.5 6.16421 8.5 5.75C8.5 5.33579 8.16421 5 7.75 5C7.33579 5 7 5.33579 7 5.75C7 6.16421 7.33579 6.5 7.75 6.5ZM8.5 8.75C8.5 9.16421 8.16421 9.5 7.75 9.5C7.33579 9.5 7 9.16421 7 8.75C7 8.33579 7.33579 8 7.75 8C8.16421 8 8.5 8.33579 8.5 8.75ZM7.75 12.5C8.16421 12.5 8.5 12.1642 8.5 11.75C8.5 11.3358 8.16421 11 7.75 11C7.33579 11 7 11.3358 7 11.75C7 12.1642 7.33579 12.5 7.75 12.5ZM17.1941 9.43855C16.5217 8.81101 15.4783 8.81101 14.8059 9.43855L10.5559 13.4052C10.2013 13.7362 10 14.1995 10 14.6846V20.5C10 21.3284 10.6716 22 11.5 22H13.5C14.3284 22 15 21.3284 15 20.5V18.0004H17V20.5C17 21.3284 17.6716 22 18.5 22H20.5C21.3284 22 22 21.3284 22 20.5V14.6846C22 14.1995 21.7987 13.7362 21.4441 13.4052L17.1941 9.43855ZM15.8294 10.5351C15.9255 10.4455 16.0745 10.4455 16.1706 10.5351L20.4206 14.5018C20.4712 14.5491 20.5 14.6153 20.5 14.6846V20.5H18.5V18.0004C18.5 17.172 17.8284 16.5004 17 16.5004H15C14.1716 16.5004 13.5 17.172 13.5 18.0004V20.5H11.5V14.6846C11.5 14.6153 11.5288 14.5491 11.5794 14.5018L15.8294 10.5351Z",
|
|
26
|
+
fill: "#222222"
|
|
27
|
+
}));
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export { IconBuildingHome, IconBuildingHome as default };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { _ as _defineProperty } from '../../defineProperty-dd1f6104.js';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import classNames from 'classnames';
|
|
4
|
+
import '../../typeof-02239c5f.js';
|
|
5
|
+
|
|
6
|
+
var IconBuildingHomeFilled = function IconBuildingHomeFilled(_ref) {
|
|
7
|
+
var size = _ref.size,
|
|
8
|
+
type = _ref.type,
|
|
9
|
+
_ref$className = _ref.className,
|
|
10
|
+
className = _ref$className === void 0 ? '' : _ref$className,
|
|
11
|
+
onClick = _ref.onClick,
|
|
12
|
+
refHandler = _ref.refHandler,
|
|
13
|
+
id = _ref.id,
|
|
14
|
+
dataId = _ref.dataId;
|
|
15
|
+
return /*#__PURE__*/React.createElement("svg", {
|
|
16
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
17
|
+
className: classNames('svg-icon', _defineProperty(_defineProperty(_defineProperty({}, "svg-icon__size-".concat(size), size), "svg-icon__type-".concat(type), type), className, className)),
|
|
18
|
+
viewBox: "0 0 24 24",
|
|
19
|
+
fill: "none",
|
|
20
|
+
onClick: onClick,
|
|
21
|
+
ref: refHandler,
|
|
22
|
+
id: id,
|
|
23
|
+
"data-id": dataId ? "".concat(dataId, "-svg-icon") : ''
|
|
24
|
+
}, /*#__PURE__*/React.createElement("path", {
|
|
25
|
+
d: "M3.5 2C2.67157 2 2 2.67157 2 3.5V16.5C2 17.3284 2.67157 18 3.5 18H9V14.6835C9 13.9212 9.31638 13.1932 9.87362 12.6731L14 8.82178V8.5C14 7.67157 13.3284 7 12.5 7H11V3.5C11 2.67157 10.3284 2 9.5 2H3.5ZM6 5.75C6 6.16421 5.66421 6.5 5.25 6.5C4.83579 6.5 4.5 6.16421 4.5 5.75C4.5 5.33579 4.83579 5 5.25 5C5.66421 5 6 5.33579 6 5.75ZM5.25 9.5C4.83579 9.5 4.5 9.16421 4.5 8.75C4.5 8.33579 4.83579 8 5.25 8C5.66421 8 6 8.33579 6 8.75C6 9.16421 5.66421 9.5 5.25 9.5ZM6 11.75C6 12.1642 5.66421 12.5 5.25 12.5C4.83579 12.5 4.5 12.1642 4.5 11.75C4.5 11.3358 4.83579 11 5.25 11C5.66421 11 6 11.3358 6 11.75ZM7.75 6.5C7.33579 6.5 7 6.16421 7 5.75C7 5.33579 7.33579 5 7.75 5C8.16421 5 8.5 5.33579 8.5 5.75C8.5 6.16421 8.16421 6.5 7.75 6.5ZM8.5 8.75C8.5 9.16421 8.16421 9.5 7.75 9.5C7.33579 9.5 7 9.16421 7 8.75C7 8.33579 7.33579 8 7.75 8C8.16421 8 8.5 8.33579 8.5 8.75ZM7.75 12.5C7.33579 12.5 7 12.1642 7 11.75C7 11.3358 7.33579 11 7.75 11C8.16421 11 8.5 11.3358 8.5 11.75C8.5 12.1642 8.16421 12.5 7.75 12.5ZM17.1941 9.43855C16.5217 8.81101 15.4783 8.81101 14.8059 9.43855L10.5559 13.4052C10.2013 13.7362 10 14.1995 10 14.6846V20.5C10 21.3284 10.6716 22 11.5 22H13.5C14.3284 22 15 21.3284 15 20.5V18.0004H17V20.5C17 21.3284 17.6716 22 18.5 22H20.5C21.3284 22 22 21.3284 22 20.5V14.6846C22 14.1995 21.7987 13.7362 21.4441 13.4052L17.1941 9.43855ZM15.8294 10.5351C15.9255 10.4455 16.0745 10.4455 16.1706 10.5351L20.4206 14.5018C20.4712 14.5491 20.5 14.6153 20.5 14.6846V20.5H18.5V18.0004C18.5 17.172 17.8284 16.5004 17 16.5004H15C14.1716 16.5004 13.5 17.172 13.5 18.0004V20.5H11.5V14.6846C11.5 14.6153 11.5288 14.5491 11.5794 14.5018L15.8294 10.5351ZM9.25 2H3.75H9.25Z",
|
|
26
|
+
fill: "#222222"
|
|
27
|
+
}));
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export { IconBuildingHomeFilled, IconBuildingHomeFilled as default };
|
|
@@ -70,6 +70,8 @@ export * from './IconBuilding';
|
|
|
70
70
|
export * from './IconBuildingBank';
|
|
71
71
|
export * from './IconBuildingBankFilled';
|
|
72
72
|
export * from './IconBuildingFilled';
|
|
73
|
+
export * from './IconBuildingHome';
|
|
74
|
+
export * from './IconBuildingHomeFilled';
|
|
73
75
|
export * from './IconBuildingShop';
|
|
74
76
|
export * from './IconBuildingShopFilled';
|
|
75
77
|
export * from './IconBulletListAdd';
|
|
@@ -70,6 +70,8 @@ export { IconBuilding } from './IconBuilding.js';
|
|
|
70
70
|
export { IconBuildingBank } from './IconBuildingBank.js';
|
|
71
71
|
export { IconBuildingBankFilled } from './IconBuildingBankFilled.js';
|
|
72
72
|
export { IconBuildingFilled } from './IconBuildingFilled.js';
|
|
73
|
+
export { IconBuildingHome } from './IconBuildingHome.js';
|
|
74
|
+
export { IconBuildingHomeFilled } from './IconBuildingHomeFilled.js';
|
|
73
75
|
export { IconBuildingShop } from './IconBuildingShop.js';
|
|
74
76
|
export { IconBuildingShopFilled } from './IconBuildingShopFilled.js';
|
|
75
77
|
export { IconBulletListAdd } from './IconBulletListAdd.js';
|
|
@@ -70,6 +70,7 @@ import '../../SVGIcons/IconAttach.js';
|
|
|
70
70
|
import '../../SVGIcons/IconCheckmark.js';
|
|
71
71
|
import '../../SVGIcons/IconCaretDownFilled.js';
|
|
72
72
|
import '../../SVGIcons/IconCaretUpFilled.js';
|
|
73
|
+
import './MultiSelectTree/MultiSelectTree.js';
|
|
73
74
|
import './MultiBase/MultiBase.js';
|
|
74
75
|
import '../../Collapse/CollapseItem/CollapseItem.js';
|
|
75
76
|
import '../../../helperComponents/AnimatePresenceWrapper/AnimatePresenceWrapper.js';
|
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
import { _ as _extends } from '../../../../extends-bf54b05e.js';
|
|
2
|
+
import { _ as _defineProperty } from '../../../../defineProperty-dd1f6104.js';
|
|
3
|
+
import { _ as _toConsumableArray } from '../../../../toConsumableArray-5ef8a63e.js';
|
|
4
|
+
import { _ as _slicedToArray } from '../../../../slicedToArray-356787eb.js';
|
|
5
|
+
import React, { useState, useMemo } from 'react';
|
|
6
|
+
import { Text } from '../../../Text/Text.js';
|
|
7
|
+
import { Empty } from '../../../Empty/Empty.js';
|
|
8
|
+
import { OptionItem } from '../../../../helperComponents/OptionItem/OptionItem.js';
|
|
9
|
+
import 'react-syntax-highlighter';
|
|
10
|
+
import 'classnames';
|
|
11
|
+
import { Checkbox } from '../../../Checkbox/Checkbox.js';
|
|
12
|
+
import 'react-dom';
|
|
13
|
+
import 'dayjs';
|
|
14
|
+
import '../../../../hooks/useScreenSize.js';
|
|
15
|
+
import 'react-hook-form';
|
|
16
|
+
import 'framer-motion';
|
|
17
|
+
import '../../../Collapse/CollapseGroup/CollapseGroup.js';
|
|
18
|
+
import { ContentTop } from '../../SharedComponents/ContentTop.js';
|
|
19
|
+
import '../../../Input/Input.js';
|
|
20
|
+
import '../../../Input/InputPassword.js';
|
|
21
|
+
import { IconCaretDownFilled } from '../../../SVGIcons/IconCaretDownFilled.js';
|
|
22
|
+
import { IconCaretUpFilled } from '../../../SVGIcons/IconCaretUpFilled.js';
|
|
23
|
+
import '../../../../typeof-02239c5f.js';
|
|
24
|
+
import '../../../../utils/helpers.js';
|
|
25
|
+
import '../../../Image/Image.js';
|
|
26
|
+
import '../../../Button/Button.js';
|
|
27
|
+
import '../../../../objectWithoutProperties-1a9e6a07.js';
|
|
28
|
+
import '../../../../helperComponents/Loader/Loader.js';
|
|
29
|
+
import '../../../Button/consts.js';
|
|
30
|
+
import '../../../Popover/Popover.js';
|
|
31
|
+
import '../../../../hooks/useGetTooltipStyles.js';
|
|
32
|
+
import '../../../../hooks/useGetElemSizes.js';
|
|
33
|
+
import '../../../../hooks/useGetElemPositions.js';
|
|
34
|
+
import '../../../../hooks/useGetTooltipPosition.js';
|
|
35
|
+
import '../../../Tooltip/types.js';
|
|
36
|
+
import '../../../../hooks/useHideOnScroll.js';
|
|
37
|
+
import '../../../../consts/index.js';
|
|
38
|
+
import '../../../../hooks/useOnOutsideClick.js';
|
|
39
|
+
import '../../../Link/Link.js';
|
|
40
|
+
import '../../../SVGIcons/IconInfo.js';
|
|
41
|
+
import '../../../../helperComponents/IconDynamicComponent/IconDynamicComponent.js';
|
|
42
|
+
import '../../../../helperComponents/IconDynamicComponent/constants.js';
|
|
43
|
+
import '../../../Avatar/Avatar.js';
|
|
44
|
+
import '../../../FileUpload/FileUpload.js';
|
|
45
|
+
import '../../../FileUpload/types.js';
|
|
46
|
+
import '../../../../helperComponents/Label/Label.js';
|
|
47
|
+
import '../../../FileUpload/UploadItems.js';
|
|
48
|
+
import '../../../../hooks/useFormProps.js';
|
|
49
|
+
import '../../../../context/types.js';
|
|
50
|
+
import '../../../../helperComponents/ErrorMessage/ErrorMessage.js';
|
|
51
|
+
import '../../../SVGIcons/IconDelete.js';
|
|
52
|
+
import '../../../SVGIcons/IconEditFilled.js';
|
|
53
|
+
import '../../../SVGIcons/IconEdit.js';
|
|
54
|
+
import '../../../SVGIcons/IconAttach.js';
|
|
55
|
+
import '../../../Tooltip/Tooltip.js';
|
|
56
|
+
import '../../../SVGIcons/IconCheckmark.js';
|
|
57
|
+
import '../../../Collapse/CollapseItem/CollapseItem.js';
|
|
58
|
+
import '../../../../helperComponents/AnimatePresenceWrapper/AnimatePresenceWrapper.js';
|
|
59
|
+
import '../../../SVGIcons/IconChevronDown.js';
|
|
60
|
+
import '../../SharedComponents/Actions.js';
|
|
61
|
+
import '../../../Menu/Menu.js';
|
|
62
|
+
import '../../../SVGIcons/IconMore.js';
|
|
63
|
+
import '../../../SVGIcons/IconDismissFilled.js';
|
|
64
|
+
import '../../../SVGIcons/IconSearchFilled.js';
|
|
65
|
+
import '../../../SVGIcons/IconSelectAllOff.js';
|
|
66
|
+
import 'react-input-mask';
|
|
67
|
+
import 'react-number-format';
|
|
68
|
+
import '../../../SVGIcons/IconCheckmarkCircleFilled.js';
|
|
69
|
+
import '../../../SVGIcons/IconDismissCircle.js';
|
|
70
|
+
import '../../../SVGIcons/IconDismissCircleFilled.js';
|
|
71
|
+
import '../../../SVGIcons/IconEyeOff.js';
|
|
72
|
+
import '../../../SVGIcons/IconEyeOn.js';
|
|
73
|
+
import '../../../Divider/Divider.js';
|
|
74
|
+
|
|
75
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
76
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
77
|
+
var MultiSelectTree = function MultiSelectTree(props) {
|
|
78
|
+
var avatar = props.avatar,
|
|
79
|
+
options = props.options,
|
|
80
|
+
helperText = props.helperText,
|
|
81
|
+
translations = props.translations,
|
|
82
|
+
selectedValues = props.selectedValues,
|
|
83
|
+
onItemSelect = props.onItemSelect,
|
|
84
|
+
onItemDeselect = props.onItemDeselect,
|
|
85
|
+
setSelectedValues = props.setSelectedValues,
|
|
86
|
+
isSearchAvailable = props.isSearchAvailable,
|
|
87
|
+
labelLeftIconProps = props.labelLeftIconProps,
|
|
88
|
+
scrollableContentStyle = props.scrollableContentStyle,
|
|
89
|
+
optionRightIconComponent = props.optionRightIconComponent,
|
|
90
|
+
labelRightIconComponent = props.labelRightIconComponent,
|
|
91
|
+
maxSelectCount = props.maxSelectCount,
|
|
92
|
+
menuOptions = props.menuOptions,
|
|
93
|
+
dataIdPrefix = props.dataIdPrefix;
|
|
94
|
+
var emptyListMainMessage = translations.emptyListMainMessage,
|
|
95
|
+
emptyListSecondaryMessage = translations.emptyListSecondaryMessage;
|
|
96
|
+
var _useState = useState(''),
|
|
97
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
98
|
+
searchValue = _useState2[0],
|
|
99
|
+
setSearchValue = _useState2[1];
|
|
100
|
+
var _useState3 = useState({
|
|
101
|
+
0: true
|
|
102
|
+
}),
|
|
103
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
104
|
+
openGroups = _useState4[0],
|
|
105
|
+
setOpenGroups = _useState4[1];
|
|
106
|
+
var _useState5 = useState(false),
|
|
107
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
108
|
+
isAllSelected = _useState6[0],
|
|
109
|
+
setAllSelected = _useState6[1];
|
|
110
|
+
var filteredData = useMemo(function () {
|
|
111
|
+
if (!searchValue) {
|
|
112
|
+
return options;
|
|
113
|
+
}
|
|
114
|
+
return options.reduce(function (acc, group) {
|
|
115
|
+
var data = group.data,
|
|
116
|
+
title = group.title;
|
|
117
|
+
var groupData = data.filter(function (dataItem) {
|
|
118
|
+
return typeof dataItem.label === 'string' && dataItem.label.toLocaleLowerCase().includes(searchValue.toLocaleLowerCase());
|
|
119
|
+
});
|
|
120
|
+
if (groupData.length) {
|
|
121
|
+
return [].concat(_toConsumableArray(acc), [{
|
|
122
|
+
title: title,
|
|
123
|
+
data: groupData
|
|
124
|
+
}]);
|
|
125
|
+
}
|
|
126
|
+
return acc;
|
|
127
|
+
}, []);
|
|
128
|
+
}, [searchValue, options]);
|
|
129
|
+
var onDeselect = function onDeselect(item) {
|
|
130
|
+
setAllSelected(false);
|
|
131
|
+
onItemDeselect(item);
|
|
132
|
+
};
|
|
133
|
+
var onGroupClick = function onGroupClick(index) {
|
|
134
|
+
setOpenGroups(function (prev) {
|
|
135
|
+
return _objectSpread(_objectSpread({}, prev), {}, _defineProperty({}, index, !prev[index]));
|
|
136
|
+
});
|
|
137
|
+
};
|
|
138
|
+
var optionProps = useMemo(function () {
|
|
139
|
+
return {
|
|
140
|
+
isCheckbox: true,
|
|
141
|
+
avatar: avatar,
|
|
142
|
+
labelLeftIconProps: labelLeftIconProps,
|
|
143
|
+
optionRightIconComponent: optionRightIconComponent,
|
|
144
|
+
labelRightIconComponent: labelRightIconComponent,
|
|
145
|
+
className: 'group-item__option'
|
|
146
|
+
};
|
|
147
|
+
}, [avatar, labelLeftIconProps, optionRightIconComponent, labelRightIconComponent]);
|
|
148
|
+
var hasTopContent = isSearchAvailable || helperText;
|
|
149
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, hasTopContent ? /*#__PURE__*/React.createElement(ContentTop, {
|
|
150
|
+
dataIdPrefix: dataIdPrefix,
|
|
151
|
+
menuOptions: menuOptions,
|
|
152
|
+
isSearchAvailable: isSearchAvailable,
|
|
153
|
+
hasLimitation: !!maxSelectCount,
|
|
154
|
+
isAnySelected: selectedValues.length !== 0,
|
|
155
|
+
helperText: helperText,
|
|
156
|
+
isSelectAllDisabled: isAllSelected || filteredData.length === 0,
|
|
157
|
+
setSearchValue: setSearchValue,
|
|
158
|
+
searchValue: searchValue,
|
|
159
|
+
translations: translations
|
|
160
|
+
}) : null, /*#__PURE__*/React.createElement("div", {
|
|
161
|
+
className: 'select__options__scroll scrollbar scrollbar--vertical',
|
|
162
|
+
style: scrollableContentStyle
|
|
163
|
+
}, /*#__PURE__*/React.createElement("div", null, filteredData.map(function (_ref, index) {
|
|
164
|
+
var _data$;
|
|
165
|
+
var title = _ref.title,
|
|
166
|
+
data = _ref.data;
|
|
167
|
+
var isActive = !!openGroups[index];
|
|
168
|
+
var groupHasSelected = data.some(function (item) {
|
|
169
|
+
return selectedValues.find(function (s) {
|
|
170
|
+
return s.value === item.value;
|
|
171
|
+
});
|
|
172
|
+
});
|
|
173
|
+
var handleGroupCheckboxChange = function handleGroupCheckboxChange(checked) {
|
|
174
|
+
var groupValues = data.filter(function (item) {
|
|
175
|
+
return !item.disabled;
|
|
176
|
+
}).map(function (item) {
|
|
177
|
+
return {
|
|
178
|
+
value: item.value,
|
|
179
|
+
label: item.label,
|
|
180
|
+
parentId: item.parentId
|
|
181
|
+
};
|
|
182
|
+
});
|
|
183
|
+
if (checked) {
|
|
184
|
+
var newSelected = _toConsumableArray(selectedValues);
|
|
185
|
+
groupValues.forEach(function (item) {
|
|
186
|
+
if (!newSelected.find(function (s) {
|
|
187
|
+
return s.value === item.value;
|
|
188
|
+
})) {
|
|
189
|
+
newSelected.push(item);
|
|
190
|
+
}
|
|
191
|
+
});
|
|
192
|
+
setSelectedValues(newSelected);
|
|
193
|
+
} else {
|
|
194
|
+
var _newSelected = selectedValues.filter(function (s) {
|
|
195
|
+
return !data.find(function (item) {
|
|
196
|
+
return item.value === s.value;
|
|
197
|
+
});
|
|
198
|
+
});
|
|
199
|
+
setSelectedValues(_newSelected);
|
|
200
|
+
}
|
|
201
|
+
};
|
|
202
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
203
|
+
className: "select__group group-item",
|
|
204
|
+
key: "".concat((_data$ = data[0]) === null || _data$ === void 0 ? void 0 : _data$.value, "_").concat(index)
|
|
205
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
206
|
+
onClick: function onClick() {
|
|
207
|
+
return onGroupClick(index);
|
|
208
|
+
},
|
|
209
|
+
className: "group-item__top"
|
|
210
|
+
}, /*#__PURE__*/React.createElement(Checkbox, {
|
|
211
|
+
className: "mr-8",
|
|
212
|
+
onClick: function onClick(checked) {
|
|
213
|
+
handleGroupCheckboxChange(checked);
|
|
214
|
+
},
|
|
215
|
+
selectedValue: groupHasSelected
|
|
216
|
+
}), /*#__PURE__*/React.createElement(Text, {
|
|
217
|
+
size: "xxsmall",
|
|
218
|
+
type: "tertiary",
|
|
219
|
+
className: "group-item__title pr-4"
|
|
220
|
+
}, title), isActive ? /*#__PURE__*/React.createElement(IconCaretUpFilled, {
|
|
221
|
+
size: "xxsmall",
|
|
222
|
+
className: "group-item__icon"
|
|
223
|
+
}) : /*#__PURE__*/React.createElement(IconCaretDownFilled, {
|
|
224
|
+
size: "xxsmall",
|
|
225
|
+
className: "group-item__icon"
|
|
226
|
+
})), isActive && data.map(function (item) {
|
|
227
|
+
var isSelected = selectedValues.findIndex(function (s) {
|
|
228
|
+
return s.value === item.value;
|
|
229
|
+
}) !== -1;
|
|
230
|
+
return /*#__PURE__*/React.createElement(OptionItem, _extends({
|
|
231
|
+
data: item,
|
|
232
|
+
dataId: item.dataId,
|
|
233
|
+
key: item.value,
|
|
234
|
+
isSelected: isSelected,
|
|
235
|
+
disabled: item.disabled || !isSelected && selectedValues.length === maxSelectCount
|
|
236
|
+
// onClick={isSelected ? onDeselect : onItemSelect}
|
|
237
|
+
,
|
|
238
|
+
onClick: isSelected ? function () {
|
|
239
|
+
return onDeselect(item);
|
|
240
|
+
} : function () {
|
|
241
|
+
return onItemSelect(item);
|
|
242
|
+
}
|
|
243
|
+
}, optionProps));
|
|
244
|
+
}));
|
|
245
|
+
}))), filteredData.length === 0 ? /*#__PURE__*/React.createElement(Empty, {
|
|
246
|
+
size: "small",
|
|
247
|
+
mainMessage: emptyListMainMessage,
|
|
248
|
+
paragraphMessage: emptyListSecondaryMessage
|
|
249
|
+
}) : null);
|
|
250
|
+
};
|
|
251
|
+
|
|
252
|
+
export { MultiSelectTree };
|
|
@@ -19,6 +19,7 @@ import { Loading } from '../SharedComponents/Loading.js';
|
|
|
19
19
|
import '../../Input/Input.js';
|
|
20
20
|
import '../../Input/InputPassword.js';
|
|
21
21
|
import { MultiSelectGrouped } from './MultiSelectGrouped/MultiSelectGrouped.js';
|
|
22
|
+
import { MultiSelectTree } from './MultiSelectTree/MultiSelectTree.js';
|
|
22
23
|
import { MultiBase } from './MultiBase/MultiBase.js';
|
|
23
24
|
import { MultiSelectWithTabs } from './MultiSelectWithTabs/MultiSelectWithTabs.js';
|
|
24
25
|
import { TRANSLATIONS_DEFAULT_VALUES, SELECTED_VISIBLE_MIN_COUNT } from '../constants.js';
|
|
@@ -83,13 +84,14 @@ import '../../Badge/Badge.js';
|
|
|
83
84
|
import '../../Badge/consts.js';
|
|
84
85
|
import '../../Tab/consts.js';
|
|
85
86
|
|
|
86
|
-
var _excluded = ["isLoading", "withTabs", "isGrouped", "isOpen", "translations", "containerRef", "options", "selectedValues", "setSelectedValues", "setIsOpen", "dropdownRef"];
|
|
87
|
+
var _excluded = ["isLoading", "withTabs", "isGrouped", "isMultiSelectTree", "isOpen", "translations", "containerRef", "options", "selectedValues", "setSelectedValues", "setIsOpen", "dropdownRef"];
|
|
87
88
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
88
89
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
89
90
|
var OptionsWrapper = function OptionsWrapper(props) {
|
|
90
91
|
var isLoading = props.isLoading,
|
|
91
92
|
withTabs = props.withTabs,
|
|
92
93
|
isGrouped = props.isGrouped,
|
|
94
|
+
isMultiSelectTree = props.isMultiSelectTree,
|
|
93
95
|
isOpen = props.isOpen,
|
|
94
96
|
translations = props.translations,
|
|
95
97
|
containerRef = props.containerRef,
|
|
@@ -103,7 +105,7 @@ var OptionsWrapper = function OptionsWrapper(props) {
|
|
|
103
105
|
width = _useGetElemSizes.width;
|
|
104
106
|
var localizations = _objectSpread(_objectSpread({}, TRANSLATIONS_DEFAULT_VALUES), translations);
|
|
105
107
|
var inputRef = useRef(null);
|
|
106
|
-
var SelectComp = withTabs ? MultiSelectWithTabs : isGrouped ? MultiSelectGrouped : MultiBase;
|
|
108
|
+
var SelectComp = isMultiSelectTree ? MultiSelectTree : withTabs ? MultiSelectWithTabs : isGrouped ? MultiSelectGrouped : MultiBase;
|
|
107
109
|
var checkIsValueOverflowed = useCallback(function (value) {
|
|
108
110
|
var elemWidth = getStringWidth(value, 14);
|
|
109
111
|
return elemWidth > width - 80; // padding and width of (+number)
|
|
@@ -169,6 +171,8 @@ var OptionsWrapper = function OptionsWrapper(props) {
|
|
|
169
171
|
scrollableContentStyle: _objectSpread({}, !hasBottomSpace && !hasTopSpace ? {
|
|
170
172
|
maxHeight: bottomSpace - 65 - 56
|
|
171
173
|
} : {}) // 65 - height of the top content, 56 - height of the footer
|
|
174
|
+
,
|
|
175
|
+
isMultiSelectTree: isMultiSelectTree
|
|
172
176
|
}, rest));
|
|
173
177
|
};
|
|
174
178
|
|
|
@@ -82,6 +82,7 @@ import './MultiSelect/MultiSelectGrouped/MultiSelectGrouped.js';
|
|
|
82
82
|
import '../Empty/Empty.js';
|
|
83
83
|
import '../Image/Image.js';
|
|
84
84
|
import './constants.js';
|
|
85
|
+
import './MultiSelect/MultiSelectTree/MultiSelectTree.js';
|
|
85
86
|
import './MultiSelect/MultiBase/MultiBase.js';
|
|
86
87
|
import './MultiSelect/MultiSelectWithTabs/MultiSelectWithTabs.js';
|
|
87
88
|
import '../Tab/Tab.js';
|
|
@@ -60,6 +60,7 @@ interface TMultiSelectCompProps extends IFormCompProps, TSelectBaseProps {
|
|
|
60
60
|
onItemSelect: (item: TSelectedValue) => void;
|
|
61
61
|
onItemDeselect: (item: TSelectedValue) => void;
|
|
62
62
|
menuOptions?: TMenuItem[];
|
|
63
|
+
isMultiSelectTree?: boolean;
|
|
63
64
|
}
|
|
64
65
|
export interface TMultySingleTabPropTypes extends TMultiSelectCompProps {
|
|
65
66
|
options: TSelectOptions;
|
|
@@ -67,6 +68,9 @@ export interface TMultySingleTabPropTypes extends TMultiSelectCompProps {
|
|
|
67
68
|
export interface TMultiSelectGroupedProps extends TMultiSelectCompProps {
|
|
68
69
|
options: TSelectGroupOptions;
|
|
69
70
|
}
|
|
71
|
+
export interface TMultiSelectTreeProps extends TMultiSelectCompProps {
|
|
72
|
+
options: TSelectTreeOptions;
|
|
73
|
+
}
|
|
70
74
|
export type TCheckboxInfo = {
|
|
71
75
|
label: string;
|
|
72
76
|
isChecked: boolean;
|
|
@@ -79,6 +83,7 @@ export interface TMultiSelectPropTypes extends IFormCompProps, TSelectBaseProps
|
|
|
79
83
|
isSearchAvailable?: boolean;
|
|
80
84
|
withTabs?: boolean;
|
|
81
85
|
isGrouped?: boolean;
|
|
86
|
+
isMultiSelectTree?: boolean;
|
|
82
87
|
checkboxInfo?: TCheckboxInfo;
|
|
83
88
|
selectedItems?: TSelectedValue[];
|
|
84
89
|
translations: TSelectTranslations;
|
package/index.js
CHANGED
|
@@ -136,6 +136,8 @@ export { IconBuilding } from './components/SVGIcons/IconBuilding.js';
|
|
|
136
136
|
export { IconBuildingBank } from './components/SVGIcons/IconBuildingBank.js';
|
|
137
137
|
export { IconBuildingBankFilled } from './components/SVGIcons/IconBuildingBankFilled.js';
|
|
138
138
|
export { IconBuildingFilled } from './components/SVGIcons/IconBuildingFilled.js';
|
|
139
|
+
export { IconBuildingHome } from './components/SVGIcons/IconBuildingHome.js';
|
|
140
|
+
export { IconBuildingHomeFilled } from './components/SVGIcons/IconBuildingHomeFilled.js';
|
|
139
141
|
export { IconBuildingShop } from './components/SVGIcons/IconBuildingShop.js';
|
|
140
142
|
export { IconBuildingShopFilled } from './components/SVGIcons/IconBuildingShopFilled.js';
|
|
141
143
|
export { IconBulletListAdd } from './components/SVGIcons/IconBulletListAdd.js';
|
|
@@ -500,6 +502,7 @@ import './components/ProgressStep/consts.js';
|
|
|
500
502
|
import './components/Select/MultiSelect/OptionsWrapper.js';
|
|
501
503
|
import './components/Select/MultiSelect/MultiSelectGrouped/MultiSelectGrouped.js';
|
|
502
504
|
import './components/Select/constants.js';
|
|
505
|
+
import './components/Select/MultiSelect/MultiSelectTree/MultiSelectTree.js';
|
|
503
506
|
import './components/Select/MultiSelect/MultiBase/MultiBase.js';
|
|
504
507
|
import './components/Select/MultiSelect/MultiSelectWithTabs/MultiSelectWithTabs.js';
|
|
505
508
|
import './components/Tab/TabItem.js';
|