@hh.ru/magritte-ui-tree-selector 1.7.3 → 2.1.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/Item.d.ts +6 -6
- package/Item.js +1 -1
- package/Item.js.map +1 -1
- package/ItemContent-CvQf33fs.js +36 -0
- package/ItemContent-CvQf33fs.js.map +1 -0
- package/ItemContent.d.ts +5 -5
- package/ItemContent.js +1 -1
- package/ItemsList.d.ts +6 -6
- package/ItemsList.js +1 -1
- package/ItemsList.js.map +1 -1
- package/MobileItem.d.ts +4 -4
- package/MobileItem.js.map +1 -1
- package/MobileItemsList.d.ts +8 -6
- package/MobileItemsList.js +3 -5
- package/MobileItemsList.js.map +1 -1
- package/MobileParentItem.d.ts +5 -5
- package/MobileParentItem.js.map +1 -1
- package/TreeSelector.d.ts +1 -1
- package/TreeSelector.js +1 -1
- package/TreeSelector.js.map +1 -1
- package/TreeSelectorDummy.d.ts +2 -2
- package/TreeSelectorDummy.js +26 -11
- package/TreeSelectorDummy.js.map +1 -1
- package/TreeSelectorItemBase.d.ts +1 -1
- package/TreeSelectorItemBase.js +1 -1
- package/TreeSelectorItemBase.js.map +1 -1
- package/collection/treeCollection.d.ts +17 -17
- package/collection/treeCollection.js.map +1 -1
- package/collection/treeCollectionHelper.d.ts +5 -5
- package/collection/treeCollectionHelper.js.map +1 -1
- package/collection/types.d.ts +10 -10
- package/index.css +24 -24
- package/index.d.ts +6 -0
- package/index.js +6 -6
- package/package.json +2 -2
- package/strategy/createTreeCollectionToggler.d.ts +1 -1
- package/strategy/createTreeCollectionToggler.js.map +1 -1
- package/strategy/immutableSelectionStrategy.d.ts +2 -2
- package/strategy/immutableSelectionStrategy.js.map +1 -1
- package/strategy/selectionStrategy.d.ts +2 -2
- package/strategy/selectionStrategy.js.map +1 -1
- package/types.d.ts +52 -18
- package/useAnimationTimeout.js +1 -1
- package/useDisabled.d.ts +3 -3
- package/useDisabled.js.map +1 -1
- package/useExpanded.d.ts +9 -3
- package/useExpanded.js +27 -11
- package/useExpanded.js.map +1 -1
- package/useIndeterminate.d.ts +4 -4
- package/useIndeterminate.js.map +1 -1
- package/useRenderInput.d.ts +2 -1
- package/useRenderInput.js +10 -4
- package/useRenderInput.js.map +1 -1
- package/useSelected.d.ts +4 -4
- package/useSelected.js.map +1 -1
- package/ItemContent-BmLHNw1m.js +0 -36
- package/ItemContent-BmLHNw1m.js.map +0 -1
package/Item.d.ts
CHANGED
|
@@ -2,10 +2,10 @@ import { PropsWithChildren, ReactElement } from 'react';
|
|
|
2
2
|
import TreeCollection from '@hh.ru/magritte-ui-tree-selector/collection/treeCollection';
|
|
3
3
|
import { AdditionalDefault, IdCollectionPredicate, TreeModel } from '@hh.ru/magritte-ui-tree-selector/collection/types';
|
|
4
4
|
import { RenderItem } from '@hh.ru/magritte-ui-tree-selector/types';
|
|
5
|
-
interface ItemProps<
|
|
6
|
-
collection: TreeCollection<
|
|
7
|
-
parentId?: TreeModel<
|
|
8
|
-
item: TreeModel<
|
|
5
|
+
interface ItemProps<Additional extends AdditionalDefault> extends PropsWithChildren {
|
|
6
|
+
collection: TreeCollection<Additional>;
|
|
7
|
+
parentId?: TreeModel<Additional>['id'];
|
|
8
|
+
item: TreeModel<Additional>;
|
|
9
9
|
leavesOnly?: boolean;
|
|
10
10
|
checkSelectable?: IdCollectionPredicate;
|
|
11
11
|
isExpanded: boolean;
|
|
@@ -16,8 +16,8 @@ interface ItemProps<A extends AdditionalDefault> extends PropsWithChildren {
|
|
|
16
16
|
isSearch: boolean;
|
|
17
17
|
onExpansion: (id: string) => void;
|
|
18
18
|
onChange: (id: string, isSelected: boolean) => void;
|
|
19
|
-
renderItemForDesktop?: RenderItem<
|
|
19
|
+
renderItemForDesktop?: RenderItem<Additional>;
|
|
20
20
|
animationTimeout: number;
|
|
21
21
|
}
|
|
22
|
-
export declare const Item: <
|
|
22
|
+
export declare const Item: <Additional extends AdditionalDefault>(props: ItemProps<Additional>) => ReactElement;
|
|
23
23
|
export {};
|
package/Item.js
CHANGED
|
@@ -3,7 +3,7 @@ import { jsxs, jsx } from 'react/jsx-runtime';
|
|
|
3
3
|
import { memo, useMemo, useRef, Children } from 'react';
|
|
4
4
|
import { TransitionGroup, CSSTransition } from 'react-transition-group';
|
|
5
5
|
import classnames from 'classnames';
|
|
6
|
-
import { s as styles, I as ItemContent } from './ItemContent-
|
|
6
|
+
import { s as styles, I as ItemContent } from './ItemContent-CvQf33fs.js';
|
|
7
7
|
import '@hh.ru/magritte-common-keyboard';
|
|
8
8
|
import '@hh.ru/magritte-ui-icon/icon';
|
|
9
9
|
import './Action.js';
|
package/Item.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Item.js","sources":["../src/Item.tsx"],"sourcesContent":["import { PropsWithChildren, ReactElement, useMemo, useRef, Children, memo } from 'react';\nimport { TransitionGroup, CSSTransition } from 'react-transition-group';\nimport classnames from 'classnames';\n\nimport { ItemContent } from '@hh.ru/magritte-ui-tree-selector/ItemContent';\nimport TreeCollection from '@hh.ru/magritte-ui-tree-selector/collection/treeCollection';\nimport { AdditionalDefault, IdCollectionPredicate, TreeModel } from '@hh.ru/magritte-ui-tree-selector/collection/types';\nimport { RenderItem } from '@hh.ru/magritte-ui-tree-selector/types';\n\nimport styles from './tree-selector-item.less';\n\ninterface ItemProps<A extends AdditionalDefault> extends PropsWithChildren {\n collection: TreeCollection<A>;\n parentId?: TreeModel<A>['id'];\n item: TreeModel<A>;\n leavesOnly?: boolean;\n checkSelectable?: IdCollectionPredicate;\n isExpanded: boolean;\n isSelected: boolean;\n isDisabled: boolean;\n singleChoice?: boolean;\n isIndeterminate: boolean;\n isSearch: boolean;\n onExpansion: (id: string) => void;\n onChange: (id: string, isSelected: boolean) => void;\n renderItemForDesktop?: RenderItem<A>;\n animationTimeout: number;\n}\n\nconst ItemComponent = <A extends AdditionalDefault>({\n collection,\n item,\n parentId,\n isExpanded,\n isSelected,\n isIndeterminate,\n isDisabled,\n leavesOnly,\n singleChoice,\n isSearch,\n checkSelectable,\n onExpansion,\n onChange,\n renderItemForDesktop,\n animationTimeout,\n children,\n}: ItemProps<A>): ReactElement => {\n const modelsOnLevel = useMemo(\n () => (parentId ? collection.getChildren(parentId) : collection.getTopLevel()),\n [parentId, collection]\n );\n\n const hasLetterOnLevel = useMemo(() => {\n return !isSearch && modelsOnLevel.some((model) => model.additional?.char);\n }, [modelsOnLevel, isSearch]);\n\n // максимальное кол-во контролов на уровне, максимум может быть 2 - шеврон + чекбокс/радио\n const maxControlsOnLevel = useMemo(() => {\n return modelsOnLevel.reduce((currentMax, model) => {\n const hasChildren = collection.hasChildren(model.id);\n const hasAction = !(leavesOnly && hasChildren) && checkSelectable?.(model.id, collection);\n const actionCount = +hasChildren + +!!hasAction;\n return Math.max(currentMax, actionCount);\n }, 0);\n }, [modelsOnLevel, checkSelectable, leavesOnly, collection]);\n\n const hasChildren = collection.hasChildren(item.id);\n const hasAction = !(leavesOnly && hasChildren) && checkSelectable?.(item.id, collection);\n const hasLetter = item.additional?.char && !isSearch;\n const realControlsCount = +hasChildren + +!!hasAction;\n\n // точка заменяет недостающий контрол, если их суммарное кол-во на уровне больше суммарного значения на текущем уровне\n const hasDot = realControlsCount < maxControlsOnLevel && (hasAction || hasChildren);\n const hasParentAction = parentId ? !leavesOnly && checkSelectable?.(parentId, collection) : false;\n\n const allBoxesCount = +hasLetterOnLevel + maxControlsOnLevel;\n\n const hasShift =\n allBoxesCount > 1 &&\n ((hasParentAction && (hasLetterOnLevel || hasChildren || hasDot)) || (!hasParentAction && hasLetterOnLevel));\n\n const childrenContentRef = useRef<HTMLDivElement>(null);\n const handleEnter = () => {\n if (childrenContentRef.current) {\n childrenContentRef.current.style.height = '0';\n }\n };\n const handleEntering = () => {\n if (childrenContentRef.current) {\n childrenContentRef.current.style.height = `${childrenContentRef.current.scrollHeight}px`;\n }\n };\n\n const handleEntered = () => {\n if (childrenContentRef.current) {\n childrenContentRef.current.style.height = `auto`;\n }\n };\n const handleExit = () => {\n if (childrenContentRef.current) {\n childrenContentRef.current.style.height = `${childrenContentRef.current.scrollHeight}px`;\n }\n };\n const handleExiting = () => {\n if (childrenContentRef.current) {\n childrenContentRef.current.style.height = '0';\n }\n };\n\n return (\n <div\n className={classnames(styles.item, {\n [styles.withTwoBoxes]: allBoxesCount === 2,\n [styles.withThreeBoxes]: allBoxesCount === 3,\n [styles.withShift]: hasShift && parentId,\n [styles.withIndent]: allBoxesCount === 0,\n })}\n data-qa={`tree-selector-item-${item.id}`}\n >\n <ItemContent\n item={item}\n parentId={parentId}\n hasChildren={hasChildren}\n hasAction={!!hasAction}\n letter={hasLetter ? item.additional?.char : undefined}\n isExpanded={isExpanded}\n onExpansion={onExpansion}\n isSelected={isSelected}\n onChange={onChange}\n singleChoice={singleChoice}\n isIndeterminate={isIndeterminate}\n isDisabled={isDisabled}\n hasLetterOnLevel={hasLetterOnLevel}\n hasDot={hasDot}\n maxControlsOnLevel={maxControlsOnLevel}\n isSearch={isSearch}\n renderItemForDesktop={renderItemForDesktop}\n />\n\n <TransitionGroup component={null}>\n {Children.toArray(children).map((child, index) => (\n <CSSTransition\n key={index}\n nodeRef={childrenContentRef}\n timeout={animationTimeout}\n onEnter={handleEnter}\n onEntering={handleEntering}\n onEntered={handleEntered}\n onExit={handleExit}\n onExiting={handleExiting}\n classNames={{\n enter: styles.itemAnimationEnter,\n enterActive: styles.itemAnimationEnterActive,\n exit: styles.itemAnimationExit,\n exitActive: styles.itemAnimationExitActive,\n }}\n >\n <div ref={childrenContentRef} className={styles.children}>\n {child}\n </div>\n </CSSTransition>\n ))}\n </TransitionGroup>\n </div>\n );\n};\n\nexport const Item = memo(ItemComponent) as <A extends AdditionalDefault>(props: ItemProps<A>) => ReactElement;\n"],"names":["_jsxs","_jsx"],"mappings":";;;;;;;;;;;;;AA6BA,MAAM,aAAa,GAAG,CAA8B,EAChD,UAAU,EACV,IAAI,EACJ,QAAQ,EACR,UAAU,EACV,UAAU,EACV,eA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UAAU,EACtB,gBAAgB,EAAE,gBAAgB,EAClC,MAAM,EAAE,MAAM,EACd,kBAAkB,EAAE,kBAAkB,EACtC,QAAQ,EAAE,QAAQ,EAClB,oBAAoB,EAAE,oBAAoB,EAC5C,CAAA,EAEFA,GAAC,CAAA,eAAe,EAAC,EAAA,SAAS,EAAE,IAAI,YAC3B,QAAQ,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,KAAK,MACzCA,GAAA,CAAC,aAAa,EAEV,EAAA,OAAO,EAAE,kBAAkB,EAC3B,OAAO,EAAE,gBAAgB,EACzB,OAAO,EAAE,WAAW,EACpB,UAAU,EAAE,cAAc,EAC1B,SAAS,EAAE,aAAa,EACxB,MAAM,EAAE,UAAU,EAClB,SAAS,EAAE,aAAa,EACxB,UAAU,EAAE;wBACR,KAAK,EAAE,MAAM,CAAC,kBAAkB;wBAChC,WAAW,EAAE,MAAM,CAAC,wBAAwB;wBAC5C,IAAI,EAAE,MAAM,CAAC,iBAAiB;wBAC9B,UAAU,EAAE,MAAM,CAAC,uBAAuB;qBAC7C,EAED,QAAA,EAAAA,GAAA,CAAA,KAAA,EAAA,EAAK,GAAG,EAAE,kBAAkB,EAAE,SAAS,EAAE,MAAM,CAAC,QAAQ,YACnD,KAAK,EAAA,CACJ,IAjBD,KAAK,CAkBE,CACnB,CAAC,EAAA,CACY,CAChB,EAAA,CAAA,EACR;AACN,CAAC,CAAC;MAEW,IAAI,GAAG,IAAI,CAAC,aAAa;;;;"}
|
|
1
|
+
{"version":3,"file":"Item.js","sources":["../src/Item.tsx"],"sourcesContent":["import { PropsWithChildren, ReactElement, useMemo, useRef, Children, memo } from 'react';\nimport { TransitionGroup, CSSTransition } from 'react-transition-group';\nimport classnames from 'classnames';\n\nimport { ItemContent } from '@hh.ru/magritte-ui-tree-selector/ItemContent';\nimport TreeCollection from '@hh.ru/magritte-ui-tree-selector/collection/treeCollection';\nimport { AdditionalDefault, IdCollectionPredicate, TreeModel } from '@hh.ru/magritte-ui-tree-selector/collection/types';\nimport { RenderItem } from '@hh.ru/magritte-ui-tree-selector/types';\n\nimport styles from './tree-selector-item.less';\n\ninterface ItemProps<Additional extends AdditionalDefault> extends PropsWithChildren {\n collection: TreeCollection<Additional>;\n parentId?: TreeModel<Additional>['id'];\n item: TreeModel<Additional>;\n leavesOnly?: boolean;\n checkSelectable?: IdCollectionPredicate;\n isExpanded: boolean;\n isSelected: boolean;\n isDisabled: boolean;\n singleChoice?: boolean;\n isIndeterminate: boolean;\n isSearch: boolean;\n onExpansion: (id: string) => void;\n onChange: (id: string, isSelected: boolean) => void;\n renderItemForDesktop?: RenderItem<Additional>;\n animationTimeout: number;\n}\n\nconst ItemComponent = <Additional extends AdditionalDefault>({\n collection,\n item,\n parentId,\n isExpanded,\n isSelected,\n isIndeterminate,\n isDisabled,\n leavesOnly,\n singleChoice,\n isSearch,\n checkSelectable,\n onExpansion,\n onChange,\n renderItemForDesktop,\n animationTimeout,\n children,\n}: ItemProps<Additional>): ReactElement => {\n const modelsOnLevel = useMemo(\n () => (parentId ? collection.getChildren(parentId) : collection.getTopLevel()),\n [parentId, collection]\n );\n\n const hasLetterOnLevel = useMemo(() => {\n return !isSearch && modelsOnLevel.some((model) => model.additional?.char);\n }, [modelsOnLevel, isSearch]);\n\n // максимальное кол-во контролов на уровне, максимум может быть 2 - шеврон + чекбокс/радио\n const maxControlsOnLevel = useMemo(() => {\n return modelsOnLevel.reduce((currentMax, model) => {\n const hasChildren = collection.hasChildren(model.id);\n const hasAction = !(leavesOnly && hasChildren) && checkSelectable?.(model.id, collection);\n const actionCount = +hasChildren + +!!hasAction;\n return Math.max(currentMax, actionCount);\n }, 0);\n }, [modelsOnLevel, checkSelectable, leavesOnly, collection]);\n\n const hasChildren = collection.hasChildren(item.id);\n const hasAction = !(leavesOnly && hasChildren) && checkSelectable?.(item.id, collection);\n const hasLetter = item.additional?.char && !isSearch;\n const realControlsCount = +hasChildren + +!!hasAction;\n\n // точка заменяет недостающий контрол, если их суммарное кол-во на уровне больше суммарного значения на текущем уровне\n const hasDot = realControlsCount < maxControlsOnLevel && (hasAction || hasChildren);\n const hasParentAction = parentId ? !leavesOnly && checkSelectable?.(parentId, collection) : false;\n\n const allBoxesCount = +hasLetterOnLevel + maxControlsOnLevel;\n\n const hasShift =\n allBoxesCount > 1 &&\n ((hasParentAction && (hasLetterOnLevel || hasChildren || hasDot)) || (!hasParentAction && hasLetterOnLevel));\n\n const childrenContentRef = useRef<HTMLDivElement>(null);\n const handleEnter = () => {\n if (childrenContentRef.current) {\n childrenContentRef.current.style.height = '0';\n }\n };\n const handleEntering = () => {\n if (childrenContentRef.current) {\n childrenContentRef.current.style.height = `${childrenContentRef.current.scrollHeight}px`;\n }\n };\n\n const handleEntered = () => {\n if (childrenContentRef.current) {\n childrenContentRef.current.style.height = `auto`;\n }\n };\n const handleExit = () => {\n if (childrenContentRef.current) {\n childrenContentRef.current.style.height = `${childrenContentRef.current.scrollHeight}px`;\n }\n };\n const handleExiting = () => {\n if (childrenContentRef.current) {\n childrenContentRef.current.style.height = '0';\n }\n };\n\n return (\n <div\n className={classnames(styles.item, {\n [styles.withTwoBoxes]: allBoxesCount === 2,\n [styles.withThreeBoxes]: allBoxesCount === 3,\n [styles.withShift]: hasShift && parentId,\n [styles.withIndent]: allBoxesCount === 0,\n })}\n data-qa={`tree-selector-item-${item.id}`}\n >\n <ItemContent\n item={item}\n parentId={parentId}\n hasChildren={hasChildren}\n hasAction={!!hasAction}\n letter={hasLetter ? item.additional?.char : undefined}\n isExpanded={isExpanded}\n onExpansion={onExpansion}\n isSelected={isSelected}\n onChange={onChange}\n singleChoice={singleChoice}\n isIndeterminate={isIndeterminate}\n isDisabled={isDisabled}\n hasLetterOnLevel={hasLetterOnLevel}\n hasDot={hasDot}\n maxControlsOnLevel={maxControlsOnLevel}\n isSearch={isSearch}\n renderItemForDesktop={renderItemForDesktop}\n />\n\n <TransitionGroup component={null}>\n {Children.toArray(children).map((child, index) => (\n <CSSTransition\n key={index}\n nodeRef={childrenContentRef}\n timeout={animationTimeout}\n onEnter={handleEnter}\n onEntering={handleEntering}\n onEntered={handleEntered}\n onExit={handleExit}\n onExiting={handleExiting}\n classNames={{\n enter: styles.itemAnimationEnter,\n enterActive: styles.itemAnimationEnterActive,\n exit: styles.itemAnimationExit,\n exitActive: styles.itemAnimationExitActive,\n }}\n >\n <div ref={childrenContentRef} className={styles.children}>\n {child}\n </div>\n </CSSTransition>\n ))}\n </TransitionGroup>\n </div>\n );\n};\n\nexport const Item = memo(ItemComponent) as <Additional extends AdditionalDefault>(\n props: ItemProps<Additional>\n) => ReactElement;\n"],"names":["_jsxs","_jsx"],"mappings":";;;;;;;;;;;;;AA6BA,MAAM,aAAa,GAAG,CAAuC,EACzD,UAAU,EACV,IAAI,EACJ,QAAQ,EACR,UAAU,EACV,UAAU,EACV,eAAe,EACf,UAAU,EACV,UAAU,EACV,YAAY,EACZ,QAAQ,EACR,eAAe,EACf,WAAW,EACX,QAAQ,EACR,oBAAoB,EACpB,gBAAgB,EAChB,QAAQ,GACY,KAAkB;AACtC,IAAA,MAAM,aAAa,GAAG,OAAO,CACzB,OAAO,QAAQ,GAAG,UAAU,CAAC,WAAW,CAAC,QAAQ,CAAC,GAAG,UAAU,CAAC,WAAW,EAAE,CAAC,EAC9E,CAAC,QAAQ,EAAE,UAAU,CAAC,CACzB,CAAC;AAEF,IAAA,MAAM,gBAAgB,GAAG,OAAO,CAAC,MAAK;AAClC,QAAA,OAAO,CAAC,QAAQ,IAAI,aAAa,CAAC,IAAI,CAAC,CAAC,KAAK,KAAK,KAAK,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;AAC9E,KAAC,EAAE,CAAC,aAAa,EAAE,QAAQ,CAAC,CAAC,CAAC;;AAG9B,IAAA,MAAM,kBAAkB,GAAG,OAAO,CAAC,MAAK;QACpC,OAAO,aAAa,CAAC,MAAM,CAAC,CAAC,UAAU,EAAE,KAAK,KAAI;YAC9C,MAAM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7C,EAED,QAAA,EAAAA,GAAA,CAAA,KAAA,EAAA,EAAK,GAAG,EAAE,kBAAkB,EAAE,SAAS,EAAE,MAAM,CAAC,QAAQ,YACnD,KAAK,EAAA,CACJ,IAjBD,KAAK,CAkBE,CACnB,CAAC,EAAA,CACY,CAChB,EAAA,CAAA,EACR;AACN,CAAC,CAAC;MAEW,IAAI,GAAG,IAAI,CAAC,aAAa;;;;"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import './index.css';
|
|
2
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
3
|
+
import { memo, useCallback } from 'react';
|
|
4
|
+
import classnames from 'classnames';
|
|
5
|
+
import { keyboardMatch, keyboardKeys } from '@hh.ru/magritte-common-keyboard';
|
|
6
|
+
import { DotFilledSize24, ChevronDownOutlinedSize24 } from '@hh.ru/magritte-ui-icon/icon';
|
|
7
|
+
import { Action } from './Action.js';
|
|
8
|
+
import { TreeSelectorItemBase } from './TreeSelectorItemBase.js';
|
|
9
|
+
import { Text } from '@hh.ru/magritte-ui-typography';
|
|
10
|
+
|
|
11
|
+
var styles = {"item-animation-timeout":"magritte-item-animation-timeout___pbOyZ_2-1-0","itemAnimationTimeout":"magritte-item-animation-timeout___pbOyZ_2-1-0","wrapper":"magritte-wrapper___GHKV6_2-1-0","letter":"magritte-letter___yZOCU_2-1-0","icon":"magritte-icon___kO3Fj_2-1-0","space":"magritte-space___xTO79_2-1-0","iconActive":"magritte-iconActive___4yrG5_2-1-0","iconUp":"magritte-iconUp___mpXV6_2-1-0","content":"magritte-content___ZRc6R_2-1-0","with-shift":"magritte-with-shift___ZErxZ_2-1-0","withShift":"magritte-with-shift___ZErxZ_2-1-0","with-indent":"magritte-with-indent___MH9Vy_2-1-0","withIndent":"magritte-with-indent___MH9Vy_2-1-0","item":"magritte-item___2LtOL_2-1-0","children":"magritte-children___kq-eq_2-1-0","with-two-boxes":"magritte-with-two-boxes___LWOy2_2-1-0","withTwoBoxes":"magritte-with-two-boxes___LWOy2_2-1-0","with-three-boxes":"magritte-with-three-boxes___cyVao_2-1-0","withThreeBoxes":"magritte-with-three-boxes___cyVao_2-1-0","item-animation-enter":"magritte-item-animation-enter___14KlM_2-1-0","itemAnimationEnter":"magritte-item-animation-enter___14KlM_2-1-0","item-animation-enter-active":"magritte-item-animation-enter-active___oEWbW_2-1-0","itemAnimationEnterActive":"magritte-item-animation-enter-active___oEWbW_2-1-0","item-animation-exit":"magritte-item-animation-exit___a-Low_2-1-0","itemAnimationExit":"magritte-item-animation-exit___a-Low_2-1-0","item-animation-exit-active":"magritte-item-animation-exit-active___MhBnn_2-1-0","itemAnimationExitActive":"magritte-item-animation-exit-active___MhBnn_2-1-0"};
|
|
12
|
+
|
|
13
|
+
const ItemContentComponent = ({ item, parentId, hasAction, hasChildren, letter, isExpanded, isDisabled, onExpansion, hasLetterOnLevel, isSelected, onChange, isIndeterminate, singleChoice, hasDot, maxControlsOnLevel, isSearch, renderItemForDesktop = TreeSelectorItemBase, }) => {
|
|
14
|
+
const handleExpandableClick = useCallback(() => onExpansion && onExpansion(item.id), [item.id, onExpansion]);
|
|
15
|
+
const currentActionCount = +hasDot + +hasAction + +hasChildren;
|
|
16
|
+
const neededSpacesCount = maxControlsOnLevel - currentActionCount;
|
|
17
|
+
const handleExpandableKeyDown = useCallback((event) => {
|
|
18
|
+
if (keyboardMatch(event.nativeEvent, keyboardKeys.ArrowLeft)) {
|
|
19
|
+
isExpanded && onExpansion(item.id);
|
|
20
|
+
event.preventDefault();
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
if (keyboardMatch(event.nativeEvent, keyboardKeys.ArrowRight)) {
|
|
24
|
+
!isExpanded && onExpansion(item.id);
|
|
25
|
+
event.preventDefault();
|
|
26
|
+
}
|
|
27
|
+
}, [isExpanded, onExpansion, item.id]);
|
|
28
|
+
const input = hasAction ? (jsx(Action, { selected: isSelected, onChange: onChange, id: item.id, onKeyDown: handleExpandableKeyDown, indeterminate: isIndeterminate, singleChoice: singleChoice, name: `tree-selector-item-${parentId || 'top'}-${item.id}` })) : undefined;
|
|
29
|
+
return (jsxs("div", { className: styles.wrapper, onClick: hasChildren && !hasAction ? handleExpandableClick : undefined, children: [(letter || hasLetterOnLevel) && (jsx("div", { className: styles.letter, children: letter && (jsx(Text, { typography: "subtitle-1-semibold", style: "secondary", Element: "span", children: letter })) })), hasDot && (jsx("div", { className: styles.icon, children: jsx(DotFilledSize24, { initial: "tertiary" }) })), [...Array(neededSpacesCount).keys()].map((_, i) => (jsx("div", { className: styles.space }, i))), hasChildren && (jsx("div", { className: classnames(styles.icon, styles.iconActive, {
|
|
30
|
+
[styles.iconUp]: isExpanded,
|
|
31
|
+
}), "data-qa": `tree-selector-chevron-${item.id}`, onClick: hasAction ? handleExpandableClick : undefined, children: jsx(ChevronDownOutlinedSize24, { initial: "tertiary" }) })), renderItemForDesktop({ disabled: isDisabled, input, item, isSearch, isParent: hasChildren })] }));
|
|
32
|
+
};
|
|
33
|
+
const ItemContent = memo(ItemContentComponent);
|
|
34
|
+
|
|
35
|
+
export { ItemContent as I, styles as s };
|
|
36
|
+
//# sourceMappingURL=ItemContent-CvQf33fs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ItemContent-CvQf33fs.js","sources":["../src/ItemContent.tsx"],"sourcesContent":["import { ReactElement, useCallback, memo, KeyboardEventHandler } from 'react';\nimport classnames from 'classnames';\n\nimport { keyboardKeys, keyboardMatch } from '@hh.ru/magritte-common-keyboard';\nimport { ChevronDownOutlinedSize24, DotFilledSize24 } from '@hh.ru/magritte-ui-icon/icon';\nimport { Action } from '@hh.ru/magritte-ui-tree-selector/Action';\nimport { TreeSelectorItemBase } from '@hh.ru/magritte-ui-tree-selector/TreeSelectorItemBase';\nimport { AdditionalDefault, TreeModel } from '@hh.ru/magritte-ui-tree-selector/collection/types';\nimport { RenderItem } from '@hh.ru/magritte-ui-tree-selector/types';\nimport { Text } from '@hh.ru/magritte-ui-typography';\n\nimport styles from './tree-selector-item.less';\n\ninterface ItemContent<Additional extends AdditionalDefault> {\n item: TreeModel<Additional>;\n parentId?: TreeModel<Additional>['id'];\n hasChildren: boolean;\n hasAction: boolean;\n letter?: string;\n onExpansion: (id: string) => void;\n isExpanded: boolean;\n isSelected: boolean;\n isDisabled: boolean;\n onChange: (id: string, isSelected: boolean) => void;\n isIndeterminate: boolean;\n singleChoice?: boolean;\n hasLetterOnLevel: boolean;\n hasDot: boolean;\n maxControlsOnLevel: number;\n renderItemForDesktop?: RenderItem<Additional>;\n isSearch: boolean;\n}\n\nconst ItemContentComponent = <Additional extends AdditionalDefault>({\n item,\n parentId,\n hasAction,\n hasChildren,\n letter,\n isExpanded,\n isDisabled,\n onExpansion,\n hasLetterOnLevel,\n isSelected,\n onChange,\n isIndeterminate,\n singleChoice,\n hasDot,\n maxControlsOnLevel,\n isSearch,\n renderItemForDesktop = TreeSelectorItemBase,\n}: ItemContent<Additional>): ReactElement => {\n const handleExpandableClick = useCallback(() => onExpansion && onExpansion(item.id), [item.id, onExpansion]);\n const currentActionCount = +hasDot + +hasAction + +hasChildren;\n const neededSpacesCount = maxControlsOnLevel - currentActionCount;\n\n const handleExpandableKeyDown = useCallback<KeyboardEventHandler>(\n (event) => {\n if (keyboardMatch(event.nativeEvent, keyboardKeys.ArrowLeft)) {\n isExpanded && onExpansion(item.id);\n event.preventDefault();\n return;\n }\n if (keyboardMatch(event.nativeEvent, keyboardKeys.ArrowRight)) {\n !isExpanded && onExpansion(item.id);\n event.preventDefault();\n }\n },\n [isExpanded, onExpansion, item.id]\n );\n\n const input = hasAction ? (\n <Action\n selected={isSelected}\n onChange={onChange}\n id={item.id}\n onKeyDown={handleExpandableKeyDown}\n indeterminate={isIndeterminate}\n singleChoice={singleChoice}\n name={`tree-selector-item-${parentId || 'top'}-${item.id}`}\n />\n ) : undefined;\n\n return (\n <div className={styles.wrapper} onClick={hasChildren && !hasAction ? handleExpandableClick : undefined}>\n {(letter || hasLetterOnLevel) && (\n <div className={styles.letter}>\n {letter && (\n <Text typography=\"subtitle-1-semibold\" style=\"secondary\" Element=\"span\">\n {letter}\n </Text>\n )}\n </div>\n )}\n {hasDot && (\n <div className={styles.icon}>\n <DotFilledSize24 initial=\"tertiary\" />\n </div>\n )}\n\n {[...Array(neededSpacesCount).keys()].map((_, i) => (\n <div key={i} className={styles.space} />\n ))}\n\n {hasChildren && (\n <div\n className={classnames(styles.icon, styles.iconActive, {\n [styles.iconUp]: isExpanded,\n })}\n data-qa={`tree-selector-chevron-${item.id}`}\n onClick={hasAction ? handleExpandableClick : undefined}\n >\n <ChevronDownOutlinedSize24 initial=\"tertiary\" />\n </div>\n )}\n {renderItemForDesktop({ disabled: isDisabled, input, item, isSearch, isParent: hasChildren })}\n </div>\n );\n};\n\nexport const ItemContent = memo(ItemContentComponent) as <Additional extends AdditionalDefault>(\n props: ItemContent<Additional>\n) => ReactElement;\n"],"names":["_jsx","_jsxs"],"mappings":";;;;;;;;;;;AAiCA,MAAM,oBAAoB,GAAG,CAAuC,EAChE,IAAI,EACJ,QAAQ,EACR,SAAS,EACT,WAAW,EACX,MAAM,EACN,UAAU,EACV,UAAU,EACV,WAAW,EACX,gBAAgB,EAChB,UAAU,EACV,QAAQ,EACR,eAAe,EACf,YAAY,EACZ,MAAM,EACN,kBAAkB,EAClB,QAAQ,EACR,oBAAoB,GAAG,oBAAoB,GACrB,KAAkB;IACxC,MAAM,qBAAqB,GAAG,WAAW,CAAC,MAAM,WAAW,IAAI,WAAW,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,EAAE,WAAW,CAAC,CAAC,CAAC;IAC7G,MAAM,kBAAkB,GAAG,CAAC,MAAM,GAAG,CAAC,SAAS,GAAG,CAAC,WAAW,CAAC;AAC/D,IAAA,MAAM,iBAAiB,GAAG,kBAAkB,GAAG,kBAAkB,CAAC;AAElE,IAAA,MAAM,uBAAuB,GAAG,WAAW,CACvC,CAAC,KAAK,KAAI;QACN,IAAI,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E,MAAM,EAAA,CACJ,CACV,EAAA,CACC,CACT,EACA,MAAM,KACHA,GAAK,CAAA,KAAA,EAAA,EAAA,SAAS,EAAE,MAAM,CAAC,IAAI,EACvB,QAAA,EAAAA,GAAA,CAAC,eAAe,EAAA,EAAC,OAAO,EAAC,UAAU,EAAA,CAAG,EACpC,CAAA,CACT,EAEA,CAAC,GAAG,KAAK,CAAC,iBAAiB,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,MAC3CA,GAAA,CAAA,KAAA,EAAA,EAAa,SAAS,EAAE,MAAM,CAAC,KAAK,EAAA,EAA1B,CAAC,CAA6B,CAC3C,CAAC,EAED,WAAW,KACRA,GAAA,CAAA,KAAA,EAAA,EACI,SAAS,EAAE,UAAU,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,UAAU,EAAE;AAClD,oBAAA,CAAC,MAAM,CAAC,MAAM,GAAG,UAAU;iBAC9B,CAAC,EAAA,SAAA,EACO,yBAAyB,IAAI,CAAC,EAAE,CAAE,CAAA,EAC3C,OAAO,EAAE,SAAS,GAAG,qBAAqB,GAAG,SAAS,EAEtD,QAAA,EAAAA,GAAA,CAAC,yBAAyB,EAAA,EAAC,OAAO,EAAC,UAAU,EAAG,CAAA,EAAA,CAC9C,CACT,EACA,oBAAoB,CAAC,EAAE,QAAQ,EAAE,UAAU,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,WAAW,EAAE,CAAC,CAC3F,EAAA,CAAA,EACR;AACN,CAAC,CAAC;MAEW,WAAW,GAAG,IAAI,CAAC,oBAAoB;;;;"}
|
package/ItemContent.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { ReactElement } from 'react';
|
|
2
2
|
import { AdditionalDefault, TreeModel } from '@hh.ru/magritte-ui-tree-selector/collection/types';
|
|
3
3
|
import { RenderItem } from '@hh.ru/magritte-ui-tree-selector/types';
|
|
4
|
-
interface ItemContent<
|
|
5
|
-
item: TreeModel<
|
|
6
|
-
parentId?: TreeModel<
|
|
4
|
+
interface ItemContent<Additional extends AdditionalDefault> {
|
|
5
|
+
item: TreeModel<Additional>;
|
|
6
|
+
parentId?: TreeModel<Additional>['id'];
|
|
7
7
|
hasChildren: boolean;
|
|
8
8
|
hasAction: boolean;
|
|
9
9
|
letter?: string;
|
|
@@ -17,8 +17,8 @@ interface ItemContent<A extends AdditionalDefault> {
|
|
|
17
17
|
hasLetterOnLevel: boolean;
|
|
18
18
|
hasDot: boolean;
|
|
19
19
|
maxControlsOnLevel: number;
|
|
20
|
-
renderItemForDesktop?: RenderItem<
|
|
20
|
+
renderItemForDesktop?: RenderItem<Additional>;
|
|
21
21
|
isSearch: boolean;
|
|
22
22
|
}
|
|
23
|
-
export declare const ItemContent: <
|
|
23
|
+
export declare const ItemContent: <Additional extends AdditionalDefault>(props: ItemContent<Additional>) => ReactElement;
|
|
24
24
|
export {};
|
package/ItemContent.js
CHANGED
|
@@ -7,7 +7,7 @@ import '@hh.ru/magritte-ui-icon/icon';
|
|
|
7
7
|
import './Action.js';
|
|
8
8
|
import './TreeSelectorItemBase.js';
|
|
9
9
|
import '@hh.ru/magritte-ui-typography';
|
|
10
|
-
export { I as ItemContent } from './ItemContent-
|
|
10
|
+
export { I as ItemContent } from './ItemContent-CvQf33fs.js';
|
|
11
11
|
import '@hh.ru/magritte-ui-checkbox-radio';
|
|
12
12
|
import '@hh.ru/magritte-ui-cell';
|
|
13
13
|
//# sourceMappingURL=ItemContent.js.map
|
package/ItemsList.d.ts
CHANGED
|
@@ -2,12 +2,12 @@ import { ReactElement } from 'react';
|
|
|
2
2
|
import TreeCollection from '@hh.ru/magritte-ui-tree-selector/collection/treeCollection';
|
|
3
3
|
import { AdditionalDefault, IdCollectionPredicate, TreeModel } from '@hh.ru/magritte-ui-tree-selector/collection/types';
|
|
4
4
|
import { RenderItem } from '@hh.ru/magritte-ui-tree-selector/types';
|
|
5
|
-
interface ItemsListProps<
|
|
6
|
-
items: TreeModel<
|
|
7
|
-
collection: TreeCollection<
|
|
5
|
+
interface ItemsListProps<Additional extends AdditionalDefault> {
|
|
6
|
+
items: TreeModel<Additional>[];
|
|
7
|
+
collection: TreeCollection<Additional>;
|
|
8
8
|
leavesOnly?: boolean;
|
|
9
9
|
checkSelectable?: IdCollectionPredicate;
|
|
10
|
-
parentId?: TreeModel<
|
|
10
|
+
parentId?: TreeModel<Additional>['id'];
|
|
11
11
|
onExpansion: (id: string) => void;
|
|
12
12
|
expanded: string[];
|
|
13
13
|
selected: string[];
|
|
@@ -16,8 +16,8 @@ interface ItemsListProps<A extends AdditionalDefault> {
|
|
|
16
16
|
indeterminate: string[];
|
|
17
17
|
singleChoice?: boolean;
|
|
18
18
|
isSearch: boolean;
|
|
19
|
-
renderItemForDesktop?: RenderItem<
|
|
19
|
+
renderItemForDesktop?: RenderItem<Additional>;
|
|
20
20
|
animationTimeout: number;
|
|
21
21
|
}
|
|
22
|
-
export declare const ItemsList: <
|
|
22
|
+
export declare const ItemsList: <Additional extends AdditionalDefault>(props: ItemsListProps<Additional>) => ReactElement;
|
|
23
23
|
export {};
|
package/ItemsList.js
CHANGED
|
@@ -4,7 +4,7 @@ import { Item } from './Item.js';
|
|
|
4
4
|
import 'react';
|
|
5
5
|
import 'react-transition-group';
|
|
6
6
|
import 'classnames';
|
|
7
|
-
import './ItemContent-
|
|
7
|
+
import './ItemContent-CvQf33fs.js';
|
|
8
8
|
import '@hh.ru/magritte-common-keyboard';
|
|
9
9
|
import '@hh.ru/magritte-ui-icon/icon';
|
|
10
10
|
import './Action.js';
|
package/ItemsList.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ItemsList.js","sources":["../src/ItemsList.tsx"],"sourcesContent":["import { ReactElement } from 'react';\n\nimport { Item } from '@hh.ru/magritte-ui-tree-selector/Item';\nimport TreeCollection from '@hh.ru/magritte-ui-tree-selector/collection/treeCollection';\nimport { AdditionalDefault, IdCollectionPredicate, TreeModel } from '@hh.ru/magritte-ui-tree-selector/collection/types';\nimport { RenderItem } from '@hh.ru/magritte-ui-tree-selector/types';\n\ninterface ItemsListProps<
|
|
1
|
+
{"version":3,"file":"ItemsList.js","sources":["../src/ItemsList.tsx"],"sourcesContent":["import { ReactElement } from 'react';\n\nimport { Item } from '@hh.ru/magritte-ui-tree-selector/Item';\nimport TreeCollection from '@hh.ru/magritte-ui-tree-selector/collection/treeCollection';\nimport { AdditionalDefault, IdCollectionPredicate, TreeModel } from '@hh.ru/magritte-ui-tree-selector/collection/types';\nimport { RenderItem } from '@hh.ru/magritte-ui-tree-selector/types';\n\ninterface ItemsListProps<Additional extends AdditionalDefault> {\n items: TreeModel<Additional>[];\n collection: TreeCollection<Additional>;\n leavesOnly?: boolean;\n checkSelectable?: IdCollectionPredicate;\n parentId?: TreeModel<Additional>['id'];\n onExpansion: (id: string) => void;\n expanded: string[];\n selected: string[];\n disabled: string[];\n onChange: (id: string, isSelected: boolean) => void;\n indeterminate: string[];\n singleChoice?: boolean;\n isSearch: boolean;\n renderItemForDesktop?: RenderItem<Additional>;\n animationTimeout: number;\n}\n\nexport const ItemsList = <Additional extends AdditionalDefault>(props: ItemsListProps<Additional>): ReactElement => {\n const {\n items,\n collection,\n leavesOnly,\n checkSelectable,\n selected,\n parentId,\n expanded,\n disabled,\n onExpansion,\n indeterminate,\n onChange,\n isSearch,\n singleChoice,\n renderItemForDesktop,\n animationTimeout,\n } = props;\n return (\n <>\n {items.map((item) => {\n const isExpanded = expanded.includes(item.id);\n const hasChildren = collection.hasChildren(item.id);\n\n return (\n <Item\n key={item.id}\n collection={collection}\n checkSelectable={checkSelectable}\n isSelected={selected.includes(item.id)}\n isExpanded={isExpanded}\n isIndeterminate={indeterminate.includes(item.id)}\n isDisabled={disabled.includes(item.id)}\n parentId={parentId}\n item={item}\n leavesOnly={leavesOnly}\n singleChoice={singleChoice}\n onExpansion={onExpansion}\n onChange={onChange}\n isSearch={isSearch}\n renderItemForDesktop={renderItemForDesktop}\n animationTimeout={animationTimeout}\n >\n {hasChildren && isExpanded && (\n <ItemsList {...props} items={collection.getChildren(item.id)} parentId={item.id} />\n )}\n </Item>\n );\n })}\n </>\n );\n};\n"],"names":["_jsx"],"mappings":";;;;;;;;;;;;;;AAyBa,MAAA,SAAS,GAAG,CAAuC,KAAiC,KAAkB;AAC/G,IAAA,MAAM,EACF,KAAK,EACL,UAAU,EACV,UAAU,EACV,eAAe,EACf,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,WAAW,EACX,aAAa,EACb,QAAQ,EACR,QAAQ,EACR,YAAY,EACZ,oBAAoB,EACpB,gBAAgB,GACnB,GAAG,KAAK,CAAC;IACV,QACIA,0BACK,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,KAAI;YAChB,MAAM,UAAU,GAAG,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;YAC9C,MAAM,WAAW,GAAG,UAAU,CAAC,WAAW,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;YAEpD,QACIA,GAAC,CAAA,IAAI,EAED,EAAA,UAAU,EAAE,UAAU,EACtB,eAAe,EAAE,eAAe,EAChC,UAAU,EAAE,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,EACtC,UAAU,EAAE,UAAU,EACtB,eAAe,EAAE,aAAa,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,EAChD,UAAU,EAAE,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,EACtC,QAAQ,EAAE,QAAQ,EAClB,IAAI,EAAE,IAAI,EACV,UAAU,EAAE,UAAU,EACtB,YAAY,EAAE,YAAY,EAC1B,WAAW,EAAE,WAAW,EACxB,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,QAAQ,EAClB,oBAAoB,EAAE,oBAAoB,EAC1C,gBAAgB,EAAE,gBAAgB,EAEjC,QAAA,EAAA,WAAW,IAAI,UAAU,KACtBA,IAAC,SAAS,EAAA,EAAA,GAAK,KAAK,EAAE,KAAK,EAAE,UAAU,CAAC,WAAW,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,QAAQ,EAAE,IAAI,CAAC,EAAE,EAAI,CAAA,CACtF,EAnBI,EAAA,IAAI,CAAC,EAAE,CAoBT,EACT;SACL,CAAC,EACH,CAAA,EACL;AACN;;;;"}
|
package/MobileItem.d.ts
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { ReactElement } from 'react';
|
|
2
2
|
import { AdditionalDefault, TreeModel } from '@hh.ru/magritte-ui-tree-selector/collection/types';
|
|
3
3
|
import { RenderItem } from '@hh.ru/magritte-ui-tree-selector/types';
|
|
4
|
-
interface MobileItemProps<
|
|
5
|
-
item: TreeModel<
|
|
4
|
+
interface MobileItemProps<Additional extends AdditionalDefault> {
|
|
5
|
+
item: TreeModel<Additional>;
|
|
6
6
|
singleChoice?: boolean;
|
|
7
7
|
isSelectable?: boolean;
|
|
8
8
|
isSelected: boolean;
|
|
9
9
|
isDisabled: boolean;
|
|
10
10
|
onChange: (id: string, isSelected: boolean) => void;
|
|
11
|
-
renderItem?: RenderItem<
|
|
11
|
+
renderItem?: RenderItem<Additional>;
|
|
12
12
|
isSearch: boolean;
|
|
13
13
|
}
|
|
14
|
-
export declare const MobileItem: <
|
|
14
|
+
export declare const MobileItem: <Additional extends AdditionalDefault>({ item, isSelected, singleChoice, isSelectable, isDisabled, onChange, isSearch, renderItem, }: MobileItemProps<Additional>) => ReactElement;
|
|
15
15
|
export {};
|
package/MobileItem.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MobileItem.js","sources":["../src/MobileItem.tsx"],"sourcesContent":["import { ReactElement } from 'react';\n\nimport { CheckableCardElement } from '@hh.ru/magritte-ui-checkable-card/CheckableCardElement';\nimport { Action } from '@hh.ru/magritte-ui-tree-selector/Action';\nimport { TreeSelectorItemBase } from '@hh.ru/magritte-ui-tree-selector/TreeSelectorItemBase';\nimport { AdditionalDefault, TreeModel } from '@hh.ru/magritte-ui-tree-selector/collection/types';\nimport { RenderItem } from '@hh.ru/magritte-ui-tree-selector/types';\n\ninterface MobileItemProps<
|
|
1
|
+
{"version":3,"file":"MobileItem.js","sources":["../src/MobileItem.tsx"],"sourcesContent":["import { ReactElement } from 'react';\n\nimport { CheckableCardElement } from '@hh.ru/magritte-ui-checkable-card/CheckableCardElement';\nimport { Action } from '@hh.ru/magritte-ui-tree-selector/Action';\nimport { TreeSelectorItemBase } from '@hh.ru/magritte-ui-tree-selector/TreeSelectorItemBase';\nimport { AdditionalDefault, TreeModel } from '@hh.ru/magritte-ui-tree-selector/collection/types';\nimport { RenderItem } from '@hh.ru/magritte-ui-tree-selector/types';\n\ninterface MobileItemProps<Additional extends AdditionalDefault> {\n item: TreeModel<Additional>;\n singleChoice?: boolean;\n isSelectable?: boolean;\n isSelected: boolean;\n isDisabled: boolean;\n onChange: (id: string, isSelected: boolean) => void;\n renderItem?: RenderItem<Additional>;\n isSearch: boolean;\n}\n\nexport const MobileItem = <Additional extends AdditionalDefault>({\n item,\n isSelected,\n singleChoice,\n isSelectable,\n isDisabled,\n onChange,\n isSearch,\n renderItem = TreeSelectorItemBase,\n}: MobileItemProps<Additional>): ReactElement => {\n const input = isSelectable ? (\n <Action selected={isSelected} onChange={onChange} id={item.id} singleChoice={singleChoice} />\n ) : undefined;\n return (\n <CheckableCardElement\n padding={16}\n borderRadius={12}\n Element=\"label\"\n checked={isSelected}\n data-qa={`tree-selector-item-${item.id}`}\n >\n {renderItem({ input, item, isSearch, isXS: true, disabled: isDisabled })}\n </CheckableCardElement>\n );\n};\n"],"names":["_jsx"],"mappings":";;;;;;;;AAmBa,MAAA,UAAU,GAAG,CAAuC,EAC7D,IAAI,EACJ,UAAU,EACV,YAAY,EACZ,YAAY,EACZ,UAAU,EACV,QAAQ,EACR,QAAQ,EACR,UAAU,GAAG,oBAAoB,GACP,KAAkB;AAC5C,IAAA,MAAM,KAAK,GAAG,YAAY,IACtBA,GAAC,CAAA,MAAM,EAAC,EAAA,QAAQ,EAAE,UAAU,EAAE,QAAQ,EAAE,QAAQ,EAAE,EAAE,EAAE,IAAI,CAAC,EAAE,EAAE,YAAY,EAAE,YAAY,GAAI,IAC7F,SAAS,CAAC;IACd,QACIA,IAAC,oBAAoB,EAAA,EACjB,OAAO,EAAE,EAAE,EACX,YAAY,EAAE,EAAE,EAChB,OAAO,EAAC,OAAO,EACf,OAAO,EAAE,UAAU,EACV,SAAA,EAAA,CAAA,mBAAA,EAAsB,IAAI,CAAC,EAAE,CAAE,CAAA,EAAA,QAAA,EAEvC,UAAU,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,UAAU,EAAE,CAAC,EACrD,CAAA,EACzB;AACN;;;;"}
|
package/MobileItemsList.d.ts
CHANGED
|
@@ -1,24 +1,26 @@
|
|
|
1
1
|
import { ReactElement, ForwardedRef, ReactNode } from 'react';
|
|
2
2
|
import { AdditionalDefault, TreeModel } from '@hh.ru/magritte-ui-tree-selector/collection/types';
|
|
3
3
|
import { ListControls, TreeSelectorDummyProps } from '@hh.ru/magritte-ui-tree-selector/types';
|
|
4
|
-
type MobileItemsListProps<
|
|
4
|
+
type MobileItemsListProps<Additional extends AdditionalDefault> = {
|
|
5
5
|
selected: string[];
|
|
6
6
|
disabled: string[];
|
|
7
|
-
|
|
7
|
+
getMobileSearchItemOrder: (model: TreeModel<Additional>) => number;
|
|
8
8
|
setInputValue: (newValue: string) => void;
|
|
9
9
|
handleChangeInput: (newValue: string) => void;
|
|
10
10
|
contentFilterQuery: string;
|
|
11
11
|
trlSelectParent: ReactNode;
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
isSearch: boolean;
|
|
13
|
+
} & Pick<TreeSelectorDummyProps<Additional>, 'collection' | 'leavesOnly' | 'singleChoice' | 'checkSelectable' | 'onChange' | 'renderItem' | 'renderMobileDelimiter' | 'onMobileNavigationChange'>;
|
|
14
|
+
export declare const MobileItemsList: <Additional extends AdditionalDefault>(props: {
|
|
14
15
|
selected: string[];
|
|
15
16
|
disabled: string[];
|
|
16
|
-
|
|
17
|
+
getMobileSearchItemOrder: (model: TreeModel<Additional>) => number;
|
|
17
18
|
setInputValue: (newValue: string) => void;
|
|
18
19
|
handleChangeInput: (newValue: string) => void;
|
|
19
20
|
contentFilterQuery: string;
|
|
20
21
|
trlSelectParent: ReactNode;
|
|
21
|
-
|
|
22
|
+
isSearch: boolean;
|
|
23
|
+
} & Pick<TreeSelectorDummyProps<Additional>, "singleChoice" | "onChange" | "collection" | "leavesOnly" | "checkSelectable" | "renderItem" | "renderMobileDelimiter" | "onMobileNavigationChange"> & {
|
|
22
24
|
ref?: ForwardedRef<ListControls> | undefined;
|
|
23
25
|
}) => ReactElement;
|
|
24
26
|
export {};
|
package/MobileItemsList.js
CHANGED
|
@@ -13,24 +13,23 @@ import '@hh.ru/magritte-ui-typography';
|
|
|
13
13
|
import './TreeSelectorItemBase.js';
|
|
14
14
|
|
|
15
15
|
const MobileItemsListComponent = (props, ref) => {
|
|
16
|
-
const { collection, selected, disabled, leavesOnly, singleChoice, onChange, checkSelectable,
|
|
16
|
+
const { collection, selected, disabled, leavesOnly, singleChoice, onChange, checkSelectable, getMobileSearchItemOrder, setInputValue, handleChangeInput, isSearch, renderMobileDelimiter, renderItem, contentFilterQuery, trlSelectParent, onMobileNavigationChange, } = props;
|
|
17
17
|
const prevParentIds = useRef([]);
|
|
18
18
|
const prevQueries = useRef([]);
|
|
19
19
|
const currentQuery = useRef(contentFilterQuery);
|
|
20
20
|
const [currentParentId, setCurrentParentId] = useState();
|
|
21
|
-
const isSearch = !!contentFilterQuery;
|
|
22
21
|
const items = useMemo(() => (currentParentId ? collection.getChildren(currentParentId) : collection.getTopLevel()), [currentParentId, collection]);
|
|
23
22
|
const { itemsByOrder, sortedOrders } = useMemo(() => {
|
|
24
23
|
const orders = new Set();
|
|
25
24
|
const itemsByOrder = items.reduce((acc, item) => {
|
|
26
|
-
const modelOrder = isSearch && !currentParentId ?
|
|
25
|
+
const modelOrder = isSearch && !currentParentId ? getMobileSearchItemOrder(item) : 0;
|
|
27
26
|
orders.add(modelOrder);
|
|
28
27
|
acc[modelOrder] = acc[modelOrder] || [];
|
|
29
28
|
acc[modelOrder].push(item);
|
|
30
29
|
return acc;
|
|
31
30
|
}, {});
|
|
32
31
|
return { itemsByOrder, sortedOrders: [...orders].sort((a, b) => a - b) };
|
|
33
|
-
}, [items, isSearch, currentParentId,
|
|
32
|
+
}, [items, isSearch, currentParentId, getMobileSearchItemOrder]);
|
|
34
33
|
const isSelectable = currentParentId && !leavesOnly && checkSelectable?.(currentParentId, collection);
|
|
35
34
|
useEffect(() => {
|
|
36
35
|
setCurrentParentId(undefined);
|
|
@@ -60,7 +59,6 @@ const MobileItemsListComponent = (props, ref) => {
|
|
|
60
59
|
order,
|
|
61
60
|
isSearch,
|
|
62
61
|
index,
|
|
63
|
-
isFirstInOrder: index === 0,
|
|
64
62
|
isTopLevel: !currentParentId,
|
|
65
63
|
});
|
|
66
64
|
return (jsxs(Fragment$1, { children: [hasLetter && jsx(MobileDelimiter, { children: item.additional?.char }), delimiterContent && jsx(MobileDelimiter, { children: delimiterContent }), hasChildren ? (jsx(MobileParentItem, { collection: collection, item: item, selected: selected, onClick: () => {
|
package/MobileItemsList.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MobileItemsList.js","sources":["../src/MobileItemsList.tsx"],"sourcesContent":["import {\n ReactElement,\n Fragment,\n useMemo,\n useState,\n useImperativeHandle,\n forwardRef,\n ForwardedRef,\n useRef,\n useEffect,\n ReactNode,\n} from 'react';\n\nimport { Cell, CellText } from '@hh.ru/magritte-ui-cell';\nimport { CheckableCardElement } from '@hh.ru/magritte-ui-checkable-card/CheckableCardElement';\nimport { Action } from '@hh.ru/magritte-ui-tree-selector/Action';\nimport { MobileDelimiter } from '@hh.ru/magritte-ui-tree-selector/MobileDelimiter';\nimport { MobileItem } from '@hh.ru/magritte-ui-tree-selector/MobileItem';\nimport { MobileParentItem } from '@hh.ru/magritte-ui-tree-selector/MobileParentItem';\nimport { AdditionalDefault, TreeModel } from '@hh.ru/magritte-ui-tree-selector/collection/types';\nimport { ListControls, TreeSelectorDummyProps } from '@hh.ru/magritte-ui-tree-selector/types';\n\ntype MobileItemsListProps<A extends AdditionalDefault> = {\n selected: string[];\n disabled: string[];\n getSearchItemOrder: (model: TreeModel<A>) => number;\n setInputValue: (newValue: string) => void;\n handleChangeInput: (newValue: string) => void;\n contentFilterQuery: string;\n trlSelectParent: ReactNode;\n} & Pick<\n TreeSelectorDummyProps<A>,\n | 'collection'\n | 'leavesOnly'\n | 'singleChoice'\n | 'checkSelectable'\n | 'onChange'\n | 'renderItem'\n | 'renderMobileDelimiter'\n | 'onMobileNavigationChange'\n>;\n\nconst MobileItemsListComponent = <A extends AdditionalDefault>(\n props: MobileItemsListProps<A>,\n ref: ForwardedRef<ListControls>\n): ReactElement => {\n const {\n collection,\n selected,\n disabled,\n leavesOnly,\n singleChoice,\n onChange,\n checkSelectable,\n getSearchItemOrder,\n setInputValue,\n handleChangeInput,\n renderMobileDelimiter,\n renderItem,\n contentFilterQuery,\n trlSelectParent,\n onMobileNavigationChange,\n } = props;\n const prevParentIds = useRef<(string | undefined)[]>([]);\n const prevQueries = useRef<string[]>([]);\n const currentQuery = useRef(contentFilterQuery);\n const [currentParentId, setCurrentParentId] = useState<string | undefined>();\n const isSearch = !!contentFilterQuery;\n const items = useMemo(\n () => (currentParentId ? collection.getChildren(currentParentId) : collection.getTopLevel()),\n [currentParentId, collection]\n );\n const { itemsByOrder, sortedOrders } = useMemo(() => {\n const orders = new Set<number>();\n const itemsByOrder = items.reduce<Record<number, TreeModel<A>[]>>((acc, item) => {\n const modelOrder = isSearch && !currentParentId ? getSearchItemOrder(item) : 0;\n orders.add(modelOrder);\n acc[modelOrder] = acc[modelOrder] || [];\n acc[modelOrder].push(item);\n return acc;\n }, {});\n return { itemsByOrder, sortedOrders: [...orders].sort((a, b) => a - b) };\n }, [items, isSearch, currentParentId, getSearchItemOrder]);\n\n const isSelectable = currentParentId && !leavesOnly && checkSelectable?.(currentParentId, collection);\n\n useEffect(() => {\n setCurrentParentId(undefined);\n prevParentIds.current = [];\n prevQueries.current = [];\n currentQuery.current = contentFilterQuery;\n }, [contentFilterQuery]);\n\n useImperativeHandle(\n ref,\n () => ({\n back: () => {\n const prevParentId = prevParentIds.current.pop();\n setCurrentParentId(prevParentId);\n onMobileNavigationChange?.(prevParentId);\n if (prevQueries.current.length) {\n setInputValue(prevQueries.current.pop() as string);\n } else {\n handleChangeInput('');\n }\n },\n }),\n [handleChangeInput, onMobileNavigationChange, setInputValue]\n );\n return (\n <>\n {isSelectable && (\n <CheckableCardElement\n padding={16}\n borderRadius={12}\n Element=\"label\"\n checked={selected.includes(currentParentId)}\n data-qa={`tree-selector-select-all-${currentParentId}`}\n >\n <Cell\n Element={'div'}\n disabled={disabled.includes(currentParentId)}\n right={\n <Action\n selected={selected.includes(currentParentId)}\n onChange={onChange}\n id={currentParentId}\n singleChoice={singleChoice}\n />\n }\n >\n <CellText>{trlSelectParent}</CellText>\n </Cell>\n </CheckableCardElement>\n )}\n {sortedOrders.map((order) => {\n return itemsByOrder[order].map((item, index) => {\n const hasChildren = collection.hasChildren(item.id);\n const hasLetter = item.additional?.char && !isSearch;\n const delimiterContent = renderMobileDelimiter?.({\n item,\n order,\n isSearch,\n index,\n isFirstInOrder: index === 0,\n isTopLevel: !currentParentId,\n });\n return (\n <Fragment key={item.id}>\n {hasLetter && <MobileDelimiter>{item.additional?.char}</MobileDelimiter>}\n {delimiterContent && <MobileDelimiter>{delimiterContent}</MobileDelimiter>}\n {hasChildren ? (\n <MobileParentItem\n collection={collection}\n item={item}\n selected={selected}\n onClick={() => {\n prevParentIds.current.push(currentParentId);\n prevQueries.current.push(currentQuery.current);\n setCurrentParentId(item.id);\n setInputValue('');\n currentQuery.current = '';\n onMobileNavigationChange?.(item.id);\n }}\n isSearch={isSearch}\n renderItem={renderItem}\n />\n ) : (\n <MobileItem\n key={item.id}\n item={item}\n singleChoice={singleChoice}\n isSelectable={checkSelectable?.(item.id, collection)}\n isSelected={selected.includes(item.id)}\n isDisabled={disabled.includes(item.id)}\n onChange={onChange}\n isSearch={isSearch}\n renderItem={renderItem}\n />\n )}\n </Fragment>\n );\n });\n })}\n </>\n );\n};\n\nexport const MobileItemsList = forwardRef(MobileItemsListComponent) as <A extends AdditionalDefault>(\n props: MobileItemsListProps<A> & { ref?: ForwardedRef<ListControls> }\n) => ReactElement;\n"],"names":["_jsxs","_jsx","Fragment"],"mappings":";;;;;;;;;;;;;AA0CA,MAAM,wBAAwB,GAAG,CAC7B,KAA8B,EAC9B,GAA+B,KACjB;AACd,IAAA,MAAM,EACF,UAAU,EACV,QAAQ,EACR,QAAQ,EACR,UAAU,EACV,YAAY,EACZ,QAAQ,EACR,eAAe,EACf,kBAAkB,EAClB,aAAa,EACb,iBAAiB,EACjB,qBAAqB,EACrB,UAAU,EACV,kBAAkB,EAClB,eAAe,EACf,wBAAwB,GAC3B,GAAG,KAAK,CAAC;AACV,IAAA,MAAM,aAAa,GAAG,MAAM,CAAyB,EAAE,CAAC,CAAC;AACzD,IAAA,MAAM,WAAW,GAAG,MAAM,CAAW,EAAE,CAAC,CAAC;AACzC,IAAA,MAAM,YAAY,GAAG,MAAM,CAAC,kBAAkB,CAAC,CAAC;IAChD,MAAM,CAAC,eAAe,EAAE,kBAAkB,CAAC,GAAG,QAAQ,EAAsB,CAAC;AAC7E,IAAA,MAAM,QAAQ,GAAG,CAAC,CAAC,kBAAkB,CAAC;AACtC,IAAA,MAAM,KAAK,GAAG,OAAO,CACjB,OAAO,eAAe,GAAG,UAAU,CAAC,WAAW,CAAC,eAAe,CAAC,GAAG,UAAU,CAAC,WAAW,EAAE,CAAC,EAC5F,CAAC,eAAe,EAA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e,GAAG,IAAI,CAAC,EAAE,EAAE,UAAU,CAAC,EACpD,UAAU,EAAE,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,EACtC,UAAU,EAAE,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,EACtC,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,QAAQ,EAClB,UAAU,EAAE,UAAU,IARjB,IAAI,CAAC,EAAE,CASd,CACL,CA/BU,EAAA,EAAA,IAAI,CAAC,EAAE,CAgCX,EACb;AACN,iBAAC,CAAC,CAAC;aACN,CAAC,CACH,EAAA,CAAA,EACL;AACN,CAAC,CAAC;MAEW,eAAe,GAAG,UAAU,CAAC,wBAAwB;;;;"}
|
|
1
|
+
{"version":3,"file":"MobileItemsList.js","sources":["../src/MobileItemsList.tsx"],"sourcesContent":["import {\n ReactElement,\n Fragment,\n useMemo,\n useState,\n useImperativeHandle,\n forwardRef,\n ForwardedRef,\n useRef,\n useEffect,\n ReactNode,\n} from 'react';\n\nimport { Cell, CellText } from '@hh.ru/magritte-ui-cell';\nimport { CheckableCardElement } from '@hh.ru/magritte-ui-checkable-card/CheckableCardElement';\nimport { Action } from '@hh.ru/magritte-ui-tree-selector/Action';\nimport { MobileDelimiter } from '@hh.ru/magritte-ui-tree-selector/MobileDelimiter';\nimport { MobileItem } from '@hh.ru/magritte-ui-tree-selector/MobileItem';\nimport { MobileParentItem } from '@hh.ru/magritte-ui-tree-selector/MobileParentItem';\nimport { AdditionalDefault, TreeModel } from '@hh.ru/magritte-ui-tree-selector/collection/types';\nimport { ListControls, TreeSelectorDummyProps } from '@hh.ru/magritte-ui-tree-selector/types';\n\ntype MobileItemsListProps<Additional extends AdditionalDefault> = {\n selected: string[];\n disabled: string[];\n getMobileSearchItemOrder: (model: TreeModel<Additional>) => number;\n setInputValue: (newValue: string) => void;\n handleChangeInput: (newValue: string) => void;\n contentFilterQuery: string;\n trlSelectParent: ReactNode;\n isSearch: boolean;\n} & Pick<\n TreeSelectorDummyProps<Additional>,\n | 'collection'\n | 'leavesOnly'\n | 'singleChoice'\n | 'checkSelectable'\n | 'onChange'\n | 'renderItem'\n | 'renderMobileDelimiter'\n | 'onMobileNavigationChange'\n>;\n\nconst MobileItemsListComponent = <Additional extends AdditionalDefault>(\n props: MobileItemsListProps<Additional>,\n ref: ForwardedRef<ListControls>\n): ReactElement => {\n const {\n collection,\n selected,\n disabled,\n leavesOnly,\n singleChoice,\n onChange,\n checkSelectable,\n getMobileSearchItemOrder,\n setInputValue,\n handleChangeInput,\n isSearch,\n renderMobileDelimiter,\n renderItem,\n contentFilterQuery,\n trlSelectParent,\n onMobileNavigationChange,\n } = props;\n const prevParentIds = useRef<(string | undefined)[]>([]);\n const prevQueries = useRef<string[]>([]);\n const currentQuery = useRef(contentFilterQuery);\n const [currentParentId, setCurrentParentId] = useState<string | undefined>();\n const items = useMemo(\n () => (currentParentId ? collection.getChildren(currentParentId) : collection.getTopLevel()),\n [currentParentId, collection]\n );\n const { itemsByOrder, sortedOrders } = useMemo(() => {\n const orders = new Set<number>();\n const itemsByOrder = items.reduce<Record<number, TreeModel<Additional>[]>>((acc, item) => {\n const modelOrder = isSearch && !currentParentId ? getMobileSearchItemOrder(item) : 0;\n orders.add(modelOrder);\n acc[modelOrder] = acc[modelOrder] || [];\n acc[modelOrder].push(item);\n return acc;\n }, {});\n return { itemsByOrder, sortedOrders: [...orders].sort((a, b) => a - b) };\n }, [items, isSearch, currentParentId, getMobileSearchItemOrder]);\n\n const isSelectable = currentParentId && !leavesOnly && checkSelectable?.(currentParentId, collection);\n\n useEffect(() => {\n setCurrentParentId(undefined);\n prevParentIds.current = [];\n prevQueries.current = [];\n currentQuery.current = contentFilterQuery;\n }, [contentFilterQuery]);\n\n useImperativeHandle(\n ref,\n () => ({\n back: () => {\n const prevParentId = prevParentIds.current.pop();\n setCurrentParentId(prevParentId);\n onMobileNavigationChange?.(prevParentId);\n if (prevQueries.current.length) {\n setInputValue(prevQueries.current.pop() as string);\n } else {\n handleChangeInput('');\n }\n },\n }),\n [handleChangeInput, onMobileNavigationChange, setInputValue]\n );\n return (\n <>\n {isSelectable && (\n <CheckableCardElement\n padding={16}\n borderRadius={12}\n Element=\"label\"\n checked={selected.includes(currentParentId)}\n data-qa={`tree-selector-select-all-${currentParentId}`}\n >\n <Cell\n Element={'div'}\n disabled={disabled.includes(currentParentId)}\n right={\n <Action\n selected={selected.includes(currentParentId)}\n onChange={onChange}\n id={currentParentId}\n singleChoice={singleChoice}\n />\n }\n >\n <CellText>{trlSelectParent}</CellText>\n </Cell>\n </CheckableCardElement>\n )}\n {sortedOrders.map((order) => {\n return itemsByOrder[order].map((item, index) => {\n const hasChildren = collection.hasChildren(item.id);\n const hasLetter = item.additional?.char && !isSearch;\n const delimiterContent = renderMobileDelimiter?.({\n item,\n order,\n isSearch,\n index,\n isTopLevel: !currentParentId,\n });\n return (\n <Fragment key={item.id}>\n {hasLetter && <MobileDelimiter>{item.additional?.char}</MobileDelimiter>}\n {delimiterContent && <MobileDelimiter>{delimiterContent}</MobileDelimiter>}\n {hasChildren ? (\n <MobileParentItem\n collection={collection}\n item={item}\n selected={selected}\n onClick={() => {\n prevParentIds.current.push(currentParentId);\n prevQueries.current.push(currentQuery.current);\n setCurrentParentId(item.id);\n setInputValue('');\n currentQuery.current = '';\n onMobileNavigationChange?.(item.id);\n }}\n isSearch={isSearch}\n renderItem={renderItem}\n />\n ) : (\n <MobileItem\n key={item.id}\n item={item}\n singleChoice={singleChoice}\n isSelectable={checkSelectable?.(item.id, collection)}\n isSelected={selected.includes(item.id)}\n isDisabled={disabled.includes(item.id)}\n onChange={onChange}\n isSearch={isSearch}\n renderItem={renderItem}\n />\n )}\n </Fragment>\n );\n });\n })}\n </>\n );\n};\n\nexport const MobileItemsList = forwardRef(MobileItemsListComponent) as <Additional extends AdditionalDefault>(\n props: MobileItemsListProps<Additional> & { ref?: ForwardedRef<ListControls> }\n) => ReactElement;\n"],"names":["_jsxs","_jsx","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2
2
|
import TreeCollection from '@hh.ru/magritte-ui-tree-selector/collection/treeCollection';
|
|
3
3
|
import { AdditionalDefault, TreeModel } from '@hh.ru/magritte-ui-tree-selector/collection/types';
|
|
4
4
|
import { RenderItem } from '@hh.ru/magritte-ui-tree-selector/types';
|
|
5
|
-
interface MobileParentItemProps<
|
|
6
|
-
collection: TreeCollection<
|
|
7
|
-
item: TreeModel<
|
|
5
|
+
interface MobileParentItemProps<Additional extends AdditionalDefault> {
|
|
6
|
+
collection: TreeCollection<Additional>;
|
|
7
|
+
item: TreeModel<Additional>;
|
|
8
8
|
selected: string[];
|
|
9
9
|
onClick: () => void;
|
|
10
|
-
renderItem?: RenderItem<
|
|
10
|
+
renderItem?: RenderItem<Additional>;
|
|
11
11
|
isSearch: boolean;
|
|
12
12
|
}
|
|
13
|
-
export declare const MobileParentItem: <
|
|
13
|
+
export declare const MobileParentItem: <Additional extends AdditionalDefault>({ collection, item, selected, onClick, isSearch, renderItem, }: MobileParentItemProps<Additional>) => ReactElement;
|
|
14
14
|
export {};
|
package/MobileParentItem.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MobileParentItem.js","sources":["../src/MobileParentItem.tsx"],"sourcesContent":["import { ReactElement, useMemo } from 'react';\n\nimport { Card } from '@hh.ru/magritte-ui-card';\nimport { LabelRight } from '@hh.ru/magritte-ui-cell';\nimport { TreeSelectorItemBase } from '@hh.ru/magritte-ui-tree-selector/TreeSelectorItemBase';\nimport TreeCollection from '@hh.ru/magritte-ui-tree-selector/collection/treeCollection';\nimport { AdditionalDefault, TreeModel } from '@hh.ru/magritte-ui-tree-selector/collection/types';\nimport { RenderItem } from '@hh.ru/magritte-ui-tree-selector/types';\n\ninterface MobileParentItemProps<
|
|
1
|
+
{"version":3,"file":"MobileParentItem.js","sources":["../src/MobileParentItem.tsx"],"sourcesContent":["import { ReactElement, useMemo } from 'react';\n\nimport { Card } from '@hh.ru/magritte-ui-card';\nimport { LabelRight } from '@hh.ru/magritte-ui-cell';\nimport { TreeSelectorItemBase } from '@hh.ru/magritte-ui-tree-selector/TreeSelectorItemBase';\nimport TreeCollection from '@hh.ru/magritte-ui-tree-selector/collection/treeCollection';\nimport { AdditionalDefault, TreeModel } from '@hh.ru/magritte-ui-tree-selector/collection/types';\nimport { RenderItem } from '@hh.ru/magritte-ui-tree-selector/types';\n\ninterface MobileParentItemProps<Additional extends AdditionalDefault> {\n collection: TreeCollection<Additional>;\n item: TreeModel<Additional>;\n selected: string[];\n onClick: () => void;\n renderItem?: RenderItem<Additional>;\n isSearch: boolean;\n}\n\nexport const MobileParentItem = <Additional extends AdditionalDefault>({\n collection,\n item,\n selected,\n onClick,\n isSearch,\n renderItem = TreeSelectorItemBase,\n}: MobileParentItemProps<Additional>): ReactElement => {\n const childrenSelectedCount = useMemo(() => {\n let count = 0;\n collection.walkChildren(item.id, (model) => {\n if (selected.includes(model.id)) {\n count += 1;\n }\n });\n\n return count;\n }, [collection, selected, item.id]);\n\n const labelRight = <LabelRight badge={childrenSelectedCount ? childrenSelectedCount.toString() : undefined} />;\n\n return (\n <Card\n padding={16}\n borderRadius={12}\n showBorder\n actionCard\n onClick={onClick}\n data-qa={`tree-selector-item-${item.id}`}\n >\n {renderItem({ item, labelRight, childrenSelectedCount, isSearch, isXS: true, isParent: true })}\n </Card>\n );\n};\n"],"names":["_jsx"],"mappings":";;;;;;MAkBa,gBAAgB,GAAG,CAAuC,EACnE,UAAU,EACV,IAAI,EACJ,QAAQ,EACR,OAAO,EACP,QAAQ,EACR,UAAU,GAAG,oBAAoB,GACD,KAAkB;AAClD,IAAA,MAAM,qBAAqB,GAAG,OAAO,CAAC,MAAK;QACvC,IAAI,KAAK,GAAG,CAAC,CAAC;QACd,UAAU,CAAC,YAAY,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC,KAAK,KAAI;YACvC,IAAI,QAAQ,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC,EAAE;gBAC7B,KAAK,IAAI,CAAC,CAAC;AACd,aAAA;AACL,SAAC,CAAC,CAAC;AAEH,QAAA,OAAO,KAAK,CAAC;KAChB,EAAE,CAAC,UAAU,EAAE,QAAQ,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC;IAEpC,MAAM,UAAU,GAAGA,GAAC,CAAA,UAAU,IAAC,KAAK,EAAE,qBAAqB,GAAG,qBAAqB,CAAC,QAAQ,EAAE,GAAG,SAAS,GAAI,CAAC;IAE/G,QACIA,IAAC,IAAI,EAAA,EACD,OAAO,EAAE,EAAE,EACX,YAAY,EAAE,EAAE,EAChB,UAAU,EAAA,IAAA,EACV,UAAU,EACV,IAAA,EAAA,OAAO,EAAE,OAAO,EAAA,SAAA,EACP,CAAsB,mBAAA,EAAA,IAAI,CAAC,EAAE,EAAE,EAEvC,QAAA,EAAA,UAAU,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,qBAAqB,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,EAC3F,CAAA,EACT;AACN;;;;"}
|
package/TreeSelector.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ForwardedRef, ReactElement } from 'react';
|
|
2
2
|
import { AdditionalDefault } from '@hh.ru/magritte-ui-tree-selector/collection/types';
|
|
3
3
|
import { TreeSelectorProps, ListControls } from '@hh.ru/magritte-ui-tree-selector/types';
|
|
4
|
-
export declare const TreeSelector: <
|
|
4
|
+
export declare const TreeSelector: <Additional extends AdditionalDefault>(props: import("@hh.ru/magritte-ui-tree-selector/types").BaseTreeSelectorProps<Additional> & {
|
|
5
5
|
onChange: (allSelected: string[], id: string, isSelected: boolean) => void;
|
|
6
6
|
collapseToParentId?: boolean | undefined;
|
|
7
7
|
maxSelected?: number | undefined;
|
package/TreeSelector.js
CHANGED
|
@@ -12,7 +12,7 @@ import './ItemsList.js';
|
|
|
12
12
|
import './Item.js';
|
|
13
13
|
import 'react-transition-group';
|
|
14
14
|
import 'classnames';
|
|
15
|
-
import './ItemContent-
|
|
15
|
+
import './ItemContent-CvQf33fs.js';
|
|
16
16
|
import '@hh.ru/magritte-common-keyboard';
|
|
17
17
|
import '@hh.ru/magritte-ui-icon/icon';
|
|
18
18
|
import './Action.js';
|
package/TreeSelector.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TreeSelector.js","sources":["../src/TreeSelector.tsx"],"sourcesContent":["import { ForwardedRef, forwardRef, ReactElement, useMemo } from 'react';\n\nimport { TreeSelectorDummy } from '@hh.ru/magritte-ui-tree-selector/TreeSelectorDummy';\nimport { AdditionalDefault } from '@hh.ru/magritte-ui-tree-selector/collection/types';\nimport ImmutableSelectionStrategy from '@hh.ru/magritte-ui-tree-selector/strategy/immutableSelectionStrategy';\nimport { TreeSelectorProps, ListControls } from '@hh.ru/magritte-ui-tree-selector/types';\nimport { useDisabled } from '@hh.ru/magritte-ui-tree-selector/useDisabled';\nimport { useSelected } from '@hh.ru/magritte-ui-tree-selector/useSelected';\n\nconst TreeSelectorComponent = <
|
|
1
|
+
{"version":3,"file":"TreeSelector.js","sources":["../src/TreeSelector.tsx"],"sourcesContent":["import { ForwardedRef, forwardRef, ReactElement, useMemo } from 'react';\n\nimport { TreeSelectorDummy } from '@hh.ru/magritte-ui-tree-selector/TreeSelectorDummy';\nimport { AdditionalDefault } from '@hh.ru/magritte-ui-tree-selector/collection/types';\nimport ImmutableSelectionStrategy from '@hh.ru/magritte-ui-tree-selector/strategy/immutableSelectionStrategy';\nimport { TreeSelectorProps, ListControls } from '@hh.ru/magritte-ui-tree-selector/types';\nimport { useDisabled } from '@hh.ru/magritte-ui-tree-selector/useDisabled';\nimport { useSelected } from '@hh.ru/magritte-ui-tree-selector/useSelected';\n\nconst TreeSelectorComponent = <Additional extends AdditionalDefault>(\n props: TreeSelectorProps<Additional>,\n ref: ForwardedRef<ListControls>\n): ReactElement => {\n const {\n value,\n collection,\n singleChoice,\n leavesOnly,\n collapseToParentId,\n checkSelectable,\n onChange,\n disabled,\n maxSelected,\n ...rest\n } = props;\n const strategy = useMemo(\n () =>\n new ImmutableSelectionStrategy(collection, {\n singleChoice,\n leavesOnly,\n checkSelectable,\n }),\n [collection, singleChoice, leavesOnly, checkSelectable]\n );\n\n if (maxSelected && !collapseToParentId && !leavesOnly) {\n throw new Error(\n `Magritte component TreeSelector: maxSelected can be used only with collapseToParentId or leavesOnly`\n );\n }\n\n const { selected, setSelected } = useSelected({\n value,\n strategy,\n collection,\n onChange,\n maxSelected,\n collapseToParentId,\n });\n\n const currentDisabled = useDisabled({ selected, disabled, collection, maxSelected });\n\n return (\n <TreeSelectorDummy\n {...rest}\n value={selected}\n disabled={currentDisabled}\n collection={collection}\n singleChoice={singleChoice}\n leavesOnly={leavesOnly}\n checkSelectable={checkSelectable}\n onChange={setSelected}\n ref={ref}\n />\n );\n};\n\nexport const TreeSelector = forwardRef(TreeSelectorComponent) as <Additional extends AdditionalDefault>(\n props: TreeSelectorProps<Additional> & { ref?: ForwardedRef<ListControls> }\n) => ReactElement;\n"],"names":["_jsx"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AASA,MAAM,qBAAqB,GAAG,CAC1B,KAAoC,EACpC,GAA+B,KACjB;IACd,MAAM,EACF,KAAK,EACL,UAAU,EACV,YAAY,EACZ,UAAU,EACV,kBAAkB,EAClB,eAAe,EACf,QAAQ,EACR,QAAQ,EACR,WAAW,EACX,GAAG,IAAI,EACV,GAAG,KAAK,CAAC;IACV,MAAM,QAAQ,GAAG,OAAO,CACpB,MACI,IAAI,0BAA0B,CAAC,UAAU,EAAE;QACvC,YAAY;QACZ,UAAU;QACV,eAAe;KAClB,CAAC,EACN,CAAC,UAAU,EAAE,YAAY,EAAE,UAAU,EAAE,eAAe,CAAC,CAC1D,CAAC;AAEF,IAAA,IAAI,WAAW,IAAI,CAAC,kBAAkB,IAAI,CAAC,UAAU,EAAE;AACnD,QAAA,MAAM,IAAI,KAAK,CACX,CAAA,mGAAA,CAAqG,CACxG,CAAC;AACL,KAAA;AAED,IAAA,MAAM,EAAE,QAAQ,EAAE,WAAW,EAAE,GAAG,WAAW,CAAC;QAC1C,KAAK;QACL,QAAQ;QACR,UAAU;QACV,QAAQ;QACR,WAAW;QACX,kBAAkB;AACrB,KAAA,CAAC,CAAC;AAEH,IAAA,MAAM,eAAe,GAAG,WAAW,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,UAAU,EAAE,WAAW,EAAE,CAAC,CAAC;AAErF,IAAA,QACIA,GAAC,CAAA,iBAAiB,EACV,EAAA,GAAA,IAAI,EACR,KAAK,EAAE,QAAQ,EACf,QAAQ,EAAE,eAAe,EACzB,UAAU,EAAE,UAAU,EACtB,YAAY,EAAE,YAAY,EAC1B,UAAU,EAAE,UAAU,EACtB,eAAe,EAAE,eAAe,EAChC,QAAQ,EAAE,WAAW,EACrB,GAAG,EAAE,GAAG,EAAA,CACV,EACJ;AACN,CAAC,CAAC;MAEW,YAAY,GAAG,UAAU,CAAC,qBAAqB;;;;"}
|
package/TreeSelectorDummy.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ReactElement, ForwardedRef } from 'react';
|
|
2
2
|
import { AdditionalDefault } from '@hh.ru/magritte-ui-tree-selector/collection/types';
|
|
3
3
|
import { ListControls, TreeSelectorDummyProps } from '@hh.ru/magritte-ui-tree-selector/types';
|
|
4
|
-
export declare const TreeSelectorDummyComponent: <
|
|
5
|
-
export declare const TreeSelectorDummy: <
|
|
4
|
+
export declare const TreeSelectorDummyComponent: <Additional extends AdditionalDefault>({ collection: initialCollection, checkSelectable, initialExpanded, value: selected, leavesOnly, singleChoice, disabled, treeFilter, suggestedNotFound, constantlySuggested, renderItemForDesktop, renderItem, renderMobileDelimiter, onExpand, onChange, onChangeFilterQuery, contentNotFound, onMobileNavigationChange, getMobileSearchItemOrder, expandTreeOnSelected, trls, children, }: TreeSelectorDummyProps<Additional>, ref: ForwardedRef<ListControls>) => ReactElement;
|
|
5
|
+
export declare const TreeSelectorDummy: <Additional extends AdditionalDefault>(props: import("@hh.ru/magritte-ui-tree-selector/types").BaseTreeSelectorProps<Additional> & import("@hh.ru/magritte-ui-tree-selector/types").DummyProps & {
|
|
6
6
|
ref?: ForwardedRef<ListControls> | undefined;
|
|
7
7
|
}) => ReactElement;
|