igniteui-webcomponents 2.2.0 → 3.2.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/CHANGELOG.md +40 -5
- package/README.md +6 -1
- package/components/avatar/avatar.js +2 -2
- package/components/avatar/avatar.js.map +1 -1
- package/components/badge/badge.js +3 -3
- package/components/badge/badge.js.map +1 -1
- package/components/button/button-base.d.ts +5 -0
- package/components/button/button-base.js +5 -1
- package/components/button/button-base.js.map +1 -1
- package/components/button/button.js +6 -6
- package/components/button/button.js.map +1 -1
- package/components/button/icon-button.d.ts +1 -1
- package/components/button/icon-button.js +19 -16
- package/components/button/icon-button.js.map +1 -1
- package/components/button/themes/button/light/button.base.css.js +1 -1
- package/components/button/themes/button/light/button.base.css.js.map +1 -1
- package/components/button/themes/button/light/button.indigo.css.js +1 -1
- package/components/button/themes/button/light/button.indigo.css.js.map +1 -1
- package/components/button/themes/button/light/button.material.css.js +1 -1
- package/components/button/themes/button/light/button.material.css.js.map +1 -1
- package/components/button/themes/icon-button/light/icon-button.base.css.js +1 -1
- package/components/button/themes/icon-button/light/icon-button.base.css.js.map +1 -1
- package/components/button/themes/icon-button/light/icon-button.bootstrap.css.js +1 -1
- package/components/button/themes/icon-button/light/icon-button.bootstrap.css.js.map +1 -1
- package/components/button/themes/icon-button/light/icon-button.fluent.css.js +1 -1
- package/components/button/themes/icon-button/light/icon-button.fluent.css.js.map +1 -1
- package/components/button/themes/icon-button/light/icon-button.indigo.css.js +1 -1
- package/components/button/themes/icon-button/light/icon-button.indigo.css.js.map +1 -1
- package/components/button/themes/icon-button/light/icon-button.material.css.js +1 -1
- package/components/button/themes/icon-button/light/icon-button.material.css.js.map +1 -1
- package/components/calendar/calendar.d.ts +8 -8
- package/components/calendar/calendar.js +16 -16
- package/components/calendar/calendar.js.map +1 -1
- package/components/calendar/common/calendar-base.d.ts +1 -1
- package/components/calendar/common/calendar-base.js +21 -15
- package/components/calendar/common/calendar-base.js.map +1 -1
- package/components/calendar/common/utils.d.ts +1 -1
- package/components/calendar/common/utils.js.map +1 -1
- package/components/calendar/days-view/days-view.d.ts +5 -5
- package/components/calendar/days-view/days-view.js +13 -11
- package/components/calendar/days-view/days-view.js.map +1 -1
- package/components/calendar/months-view/months-view.d.ts +3 -3
- package/components/calendar/months-view/months-view.js +12 -10
- package/components/calendar/months-view/months-view.js.map +1 -1
- package/components/calendar/years-view/years-view.d.ts +3 -3
- package/components/calendar/years-view/years-view.js +11 -9
- package/components/calendar/years-view/years-view.js.map +1 -1
- package/components/card/card.actions.js +3 -3
- package/components/card/card.actions.js.map +1 -1
- package/components/card/card.content.js +3 -3
- package/components/card/card.content.js.map +1 -1
- package/components/card/card.header.js +4 -4
- package/components/card/card.header.js.map +1 -1
- package/components/card/card.js +4 -4
- package/components/card/card.js.map +1 -1
- package/components/card/card.media.js +1 -1
- package/components/card/card.media.js.map +1 -1
- package/components/checkbox/checkbox-base.js +2 -1
- package/components/checkbox/checkbox-base.js.map +1 -1
- package/components/checkbox/checkbox.js +6 -7
- package/components/checkbox/checkbox.js.map +1 -1
- package/components/checkbox/switch.js +6 -7
- package/components/checkbox/switch.js.map +1 -1
- package/components/checkbox/themes/light/switch.base.css.js +1 -1
- package/components/checkbox/themes/light/switch.base.css.js.map +1 -1
- package/components/chip/chip.d.ts +1 -0
- package/components/chip/chip.js +20 -9
- package/components/chip/chip.js.map +1 -1
- package/components/chip/themes/chip.base.css.js +1 -1
- package/components/chip/themes/chip.base.css.js.map +1 -1
- package/components/chip/themes/chip.bootstrap.css.js +1 -1
- package/components/chip/themes/chip.bootstrap.css.js.map +1 -1
- package/components/chip/themes/chip.fluent.css.js +1 -1
- package/components/chip/themes/chip.fluent.css.js.map +1 -1
- package/components/chip/themes/chip.indigo.css.js +1 -1
- package/components/chip/themes/chip.indigo.css.js.map +1 -1
- package/components/chip/themes/chip.material.css.js +1 -1
- package/components/chip/themes/chip.material.css.js.map +1 -1
- package/components/common/definitions/defineAllComponents.js +53 -45
- package/components/common/definitions/defineAllComponents.js.map +1 -1
- package/components/dropdown/dropdown-group.d.ts +4 -4
- package/components/dropdown/dropdown-group.js +11 -11
- package/components/dropdown/dropdown-group.js.map +1 -1
- package/components/dropdown/dropdown-header.d.ts +3 -3
- package/components/dropdown/dropdown-header.js +9 -9
- package/components/dropdown/dropdown-header.js.map +1 -1
- package/components/dropdown/dropdown-item.d.ts +2 -2
- package/components/dropdown/dropdown-item.js +18 -18
- package/components/dropdown/dropdown-item.js.map +1 -1
- package/components/dropdown/dropdown.d.ts +16 -16
- package/components/dropdown/dropdown.js +51 -56
- package/components/dropdown/dropdown.js.map +1 -1
- package/components/expansion-panel/expansion-panel.d.ts +72 -0
- package/components/expansion-panel/expansion-panel.js +167 -0
- package/components/expansion-panel/expansion-panel.js.map +1 -0
- package/components/expansion-panel/themes/light/expansion-panel.base.css.d.ts +1 -0
- package/components/expansion-panel/themes/light/expansion-panel.base.css.js +3 -0
- package/components/expansion-panel/themes/light/expansion-panel.base.css.js.map +1 -0
- package/components/expansion-panel/themes/light/expansion-panel.bootstrap.css.d.ts +1 -0
- package/components/expansion-panel/themes/light/expansion-panel.bootstrap.css.js +3 -0
- package/components/expansion-panel/themes/light/expansion-panel.bootstrap.css.js.map +1 -0
- package/components/expansion-panel/themes/light/expansion-panel.fluent.css.d.ts +1 -0
- package/components/expansion-panel/themes/light/expansion-panel.fluent.css.js +3 -0
- package/components/expansion-panel/themes/light/expansion-panel.fluent.css.js.map +1 -0
- package/components/expansion-panel/themes/light/expansion-panel.indigo.css.d.ts +1 -0
- package/components/expansion-panel/themes/light/expansion-panel.indigo.css.js +3 -0
- package/components/expansion-panel/themes/light/expansion-panel.indigo.css.js.map +1 -0
- package/components/form/form.d.ts +2 -2
- package/components/form/form.js +13 -4
- package/components/form/form.js.map +1 -1
- package/components/icon/icon.d.ts +1 -1
- package/components/icon/icon.js +3 -2
- package/components/icon/icon.js.map +1 -1
- package/components/icon/icon.registry.js +5 -0
- package/components/icon/icon.registry.js.map +1 -1
- package/components/input/input-base.d.ts +2 -1
- package/components/input/input-base.js +11 -6
- package/components/input/input-base.js.map +1 -1
- package/components/input/input.d.ts +1 -1
- package/components/input/input.js +6 -5
- package/components/input/input.js.map +1 -1
- package/components/input/themes/light/input.base.css.js +1 -1
- package/components/input/themes/light/input.base.css.js.map +1 -1
- package/components/input/themes/light/input.material.css.js +1 -1
- package/components/input/themes/light/input.material.css.js.map +1 -1
- package/components/list/list-header.js +3 -3
- package/components/list/list-header.js.map +1 -1
- package/components/list/list-item.js +5 -5
- package/components/list/list-item.js.map +1 -1
- package/components/list/list.d.ts +1 -1
- package/components/list/list.js +4 -4
- package/components/list/list.js.map +1 -1
- package/components/list/themes/light/list.base.css.js +1 -1
- package/components/list/themes/light/list.base.css.js.map +1 -1
- package/components/mask-input/mask-input.d.ts +102 -0
- package/components/mask-input/mask-input.js +260 -0
- package/components/mask-input/mask-input.js.map +1 -0
- package/components/mask-input/mask-parser.d.ts +30 -0
- package/components/mask-input/mask-parser.js +167 -0
- package/components/mask-input/mask-parser.js.map +1 -0
- package/components/nav-drawer/nav-drawer-header-item.js +3 -3
- package/components/nav-drawer/nav-drawer-header-item.js.map +1 -1
- package/components/nav-drawer/nav-drawer-item.d.ts +1 -0
- package/components/nav-drawer/nav-drawer-item.js +9 -6
- package/components/nav-drawer/nav-drawer-item.js.map +1 -1
- package/components/nav-drawer/nav-drawer.d.ts +1 -1
- package/components/nav-drawer/nav-drawer.js +14 -11
- package/components/nav-drawer/nav-drawer.js.map +1 -1
- package/components/nav-drawer/styles/indigo/nav-drawer-item.indigo.css.js +1 -1
- package/components/nav-drawer/styles/indigo/nav-drawer-item.indigo.css.js.map +1 -1
- package/components/nav-drawer/styles/nav-drawer-item.base.css.js +1 -1
- package/components/nav-drawer/styles/nav-drawer-item.base.css.js.map +1 -1
- package/components/nav-drawer/styles/nav-drawer.base.css.js +1 -1
- package/components/nav-drawer/styles/nav-drawer.base.css.js.map +1 -1
- package/components/navbar/navbar.js +6 -5
- package/components/navbar/navbar.js.map +1 -1
- package/components/navbar/themes/light/navbar.base.css.js +1 -1
- package/components/navbar/themes/light/navbar.base.css.js.map +1 -1
- package/components/navbar/themes/light/navbar.bootstrap.css.js +1 -1
- package/components/navbar/themes/light/navbar.bootstrap.css.js.map +1 -1
- package/components/navbar/themes/light/navbar.fluent.css.d.ts +1 -0
- package/components/navbar/themes/light/navbar.fluent.css.js +3 -0
- package/components/navbar/themes/light/navbar.fluent.css.js.map +1 -0
- package/components/progress/base.js +2 -2
- package/components/progress/base.js.map +1 -1
- package/components/progress/circular-progress.d.ts +2 -2
- package/components/progress/circular-progress.js +6 -6
- package/components/progress/circular-progress.js.map +1 -1
- package/components/progress/linear-progress.d.ts +1 -1
- package/components/progress/linear-progress.js +7 -7
- package/components/progress/linear-progress.js.map +1 -1
- package/components/radio/radio.js +9 -9
- package/components/radio/radio.js.map +1 -1
- package/components/radio-group/radio-group.js +1 -1
- package/components/radio-group/radio-group.js.map +1 -1
- package/components/rating/rating.base.css.js +1 -1
- package/components/rating/rating.base.css.js.map +1 -1
- package/components/rating/rating.d.ts +2 -2
- package/components/rating/rating.fluent.css.js +1 -1
- package/components/rating/rating.fluent.css.js.map +1 -1
- package/components/rating/rating.js +10 -10
- package/components/rating/rating.js.map +1 -1
- package/components/ripple/ripple.js +1 -1
- package/components/ripple/ripple.js.map +1 -1
- package/components/slider/range-slider.d.ts +3 -3
- package/components/slider/range-slider.js +2 -2
- package/components/slider/range-slider.js.map +1 -1
- package/components/slider/slider-base.js +8 -7
- package/components/slider/slider-base.js.map +1 -1
- package/components/slider/slider.d.ts +3 -3
- package/components/slider/slider.js +2 -2
- package/components/slider/slider.js.map +1 -1
- package/components/snackbar/snackbar.d.ts +2 -0
- package/components/snackbar/snackbar.js +8 -5
- package/components/snackbar/snackbar.js.map +1 -1
- package/components/toast/toast.js +5 -5
- package/components/toast/toast.js.map +1 -1
- package/components/toggle/toggle.controller.d.ts +3 -3
- package/components/toggle/toggle.controller.js +1 -1
- package/components/toggle/toggle.controller.js.map +1 -1
- package/components/toggle/toggle.directive.d.ts +1 -1
- package/components/toggle/toggle.directive.js +5 -4
- package/components/toggle/toggle.directive.js.map +1 -1
- package/components/toggle/{utilities.d.ts → types.d.ts} +0 -0
- package/components/toggle/types.js +2 -0
- package/components/toggle/types.js.map +1 -0
- package/components/tree/themes/dark/tree-item.bootstrap.css.d.ts +1 -0
- package/components/tree/themes/dark/tree-item.bootstrap.css.js +3 -0
- package/components/tree/themes/dark/tree-item.bootstrap.css.js.map +1 -0
- package/components/tree/themes/dark/tree-item.fluent.css.d.ts +1 -0
- package/components/tree/themes/dark/tree-item.fluent.css.js +3 -0
- package/components/tree/themes/dark/tree-item.fluent.css.js.map +1 -0
- package/components/tree/themes/dark/tree-item.indigo.css.d.ts +1 -0
- package/components/tree/themes/dark/tree-item.indigo.css.js +3 -0
- package/components/tree/themes/dark/tree-item.indigo.css.js.map +1 -0
- package/components/tree/themes/light/tree-item.base.css.d.ts +1 -0
- package/components/tree/themes/light/tree-item.base.css.js +3 -0
- package/components/tree/themes/light/tree-item.base.css.js.map +1 -0
- package/components/tree/themes/light/tree-item.bootstrap.css.d.ts +1 -0
- package/components/tree/themes/light/tree-item.bootstrap.css.js +3 -0
- package/components/tree/themes/light/tree-item.bootstrap.css.js.map +1 -0
- package/components/tree/themes/light/tree-item.fluent.css.d.ts +1 -0
- package/components/tree/themes/light/tree-item.fluent.css.js +3 -0
- package/components/tree/themes/light/tree-item.fluent.css.js.map +1 -0
- package/components/tree/themes/light/tree-item.indigo.css.d.ts +1 -0
- package/components/tree/themes/light/tree-item.indigo.css.js +3 -0
- package/components/tree/themes/light/tree-item.indigo.css.js.map +1 -0
- package/components/tree/themes/light/tree.base.css.d.ts +1 -0
- package/components/tree/themes/light/tree.base.css.js +3 -0
- package/components/tree/themes/light/tree.base.css.js.map +1 -0
- package/components/tree/tree-item.d.ts +116 -0
- package/components/tree/tree-item.js +447 -0
- package/components/tree/tree-item.js.map +1 -0
- package/components/tree/tree.common.d.ts +17 -0
- package/components/tree/tree.common.js +2 -0
- package/components/tree/tree.common.js.map +1 -0
- package/components/tree/tree.d.ts +71 -0
- package/components/tree/tree.js +139 -0
- package/components/tree/tree.js.map +1 -0
- package/components/tree/tree.navigation.d.ts +41 -0
- package/components/tree/tree.navigation.js +260 -0
- package/components/tree/tree.navigation.js.map +1 -0
- package/components/tree/tree.selection.d.ts +55 -0
- package/components/tree/tree.selection.js +265 -0
- package/components/tree/tree.selection.js.map +1 -0
- package/custom-elements.json +635 -5
- package/index.d.ts +57 -52
- package/index.js +55 -51
- package/index.js.map +1 -1
- package/package.json +2 -2
- package/themes/dark/bootstrap.css +1 -1
- package/themes/dark/fluent.css +1 -1
- package/themes/dark/indigo.css +1 -1
- package/themes/light/bootstrap.css +1 -1
- package/themes/light/fluent.css +1 -1
- package/theming/config.d.ts +1 -1
- package/theming/config.js +2 -2
- package/theming/config.js.map +1 -1
- package/theming/index.d.ts +3 -3
- package/theming/index.js +3 -3
- package/theming/index.js.map +1 -1
- package/theming/{theming-controlller.d.ts → theming-controller.d.ts} +1 -1
- package/theming/{theming-controlller.js → theming-controller.js} +3 -3
- package/theming/theming-controller.js.map +1 -0
- package/theming/theming-decorator.js +1 -1
- package/theming/theming-decorator.js.map +1 -1
- package/theming/theming-event.d.ts +1 -1
- package/theming/theming-event.js.map +1 -1
- package/vscode-html-custom-data.json +317 -46
- package/components/toggle/utilities.js +0 -2
- package/components/toggle/utilities.js.map +0 -1
- package/theming/theming-controlller.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tree-item.js","sourceRoot":"","sources":["../../../src/components/tree/tree-item.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EACL,QAAQ,EACR,KAAK,EACL,qBAAqB,EACrB,KAAK,GACN,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC;AACvC,OAAO,E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AE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;qDACpB;AAOvB;IADC,QAAQ,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;mDACA;AAI9B;IAFC,KAAK,CAAC,UAAU,EAAE,EAAE,oBAAoB,EAAE,IAAI,EAAE,CAAC;IACjD,KAAK,CAAC,aAAa,EAAE,EAAE,oBAAoB,EAAE,IAAI,EAAE,CAAC;sDAOpD;AAGD;IADC,KAAK,CAAC,UAAU,CAAC;0DAiBjB;AAGD;IADC,KAAK,CAAC,QAAQ,EAAE,EAAE,oBAAoB,EAAE,IAAI,EAAE,CAAC;wDAkB/C;AAGD;IADC,KAAK,CAAC,UAAU,CAAC;0DAGjB;AAGD;IADC,KAAK,CAAC,UAAU,EAAE,EAAE,oBAAoB,EAAE,IAAI,EAAE,CAAC;0DAQjD;AApIkB,oBAAoB;IADxC,MAAM,CAAC,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC;GACjB,oBAAoB,CAqdxC;eArdoB,oBAAoB","sourcesContent":["import {\n property,\n query,\n queryAssignedElements,\n state,\n} from 'lit/decorators.js';\nimport { html, LitElement } from 'lit';\nimport { partNameMap } from '../common/util.js';\nimport { styles } from './themes/light/tree-item.base.css.js';\nimport { styles as bootstrap } from './themes/light/tree-item.bootstrap.css.js';\nimport { styles as fluent } from './themes/light/tree-item.fluent.css.js';\nimport { styles as indigo } from './themes/light/tree-item.indigo.css.js';\nimport type IgcTreeComponent from './tree.js';\nimport { watch } from '../common/decorators/watch.js';\nimport { IgcTreeSelectionService } from './tree.selection.js';\nimport { IgcTreeNavigationService } from './tree.navigation.js';\nimport { themes } from '../../theming/theming-decorator.js';\n\nconst sizeMultiplier: Record<'small' | 'medium' | 'large', number> = {\n small: 1 / 2,\n medium: 2 / 3,\n large: 1,\n};\n\n/**\n * The tree-item component represents a child item of the tree component or another tree item.\n *\n * @element igc-tree-item\n *\n * @slot - Renders nested tree-item component.\n * @slot label - Renders the tree item container.\n * @slot indicator - Renders the expand indicator container.\n * @slot loading - Renders the tree item loading indicator container.\n * @slot indentation - Renders the container (by default the space) before the tree item.\n *\n * @csspart wrapper - The wrapper for the tree item.\n * @csspart selected - Indicates selected state. Applies to `wrapper`.\n * @csspart focused - Indicates focused state. Applies to `wrapper`.\n * @csspart active - Indicates an active state. Applies to `wrapper`.\n * @csspart indicator - The expand indicator of the tree item.\n * @csspart label - The tree item content.\n * @csspart text - The tree item displayed text.\n * @csspart select - The checkbox of the tree item when selection is enabled.\n */\n@themes({ bootstrap, fluent, indigo })\nexport default class IgcTreeItemComponent extends LitElement {\n /** @private */\n public static readonly tagName = 'igc-tree-item';\n /** @private */\n public static override styles = styles;\n\n private tabbableEl?: HTMLElement[];\n private focusedProgrammatically = false;\n\n /** A reference to the tree the item is a part of. */\n public tree?: IgcTreeComponent;\n /** The parent item of the current tree item (if any) */\n public parent: IgcTreeItemComponent | null = null;\n\n /** @private */\n public init = false;\n\n @queryAssignedElements({ slot: 'label', flatten: true })\n private contentList!: Array<HTMLElement>;\n\n /** @private */\n @query('#wrapper')\n public wrapper!: HTMLElement;\n\n @state()\n private isFocused = false;\n\n /** @private */\n @state()\n public hasChildren = false;\n\n /** The depth of the item, relative to the root. */\n @state()\n public level = 0;\n\n /** @private */\n @state()\n public indeterminate = false;\n\n /** The tree item label. */\n @property()\n public label = '';\n\n /** The tree item expansion state. */\n @property({ reflect: true, type: Boolean })\n public expanded = false;\n\n /** Marks the item as the tree's active item. */\n @property({ reflect: true, type: Boolean })\n public active = false;\n\n /** Get/Set whether the tree item is disabled. Disabled items are ignored for user interactions. */\n @property({ reflect: true, type: Boolean })\n public disabled = false;\n\n /** The tree item selection state. */\n @property({ reflect: true, type: Boolean })\n public selected = false;\n\n /** To be used for load-on-demand scenarios in order to specify whether the item is loading data. */\n @property({ reflect: true, type: Boolean })\n public loading = false;\n\n /**\n * The value entry that the tree item is visualizing. Required for searching through items.\n * @type any\n */\n @property({ attribute: true })\n public value: any = undefined;\n\n @watch('expanded', { waitUntilFirstUpdate: true })\n @watch('hasChildren', { waitUntilFirstUpdate: true })\n protected bothChange(): void {\n if (this.hasChildren) {\n this.setAttribute('aria-expanded', this.expanded.toString());\n } else {\n this.removeAttribute('aria-expanded');\n }\n }\n\n @watch('expanded')\n protected expandedChange(oldValue: boolean): void {\n // always update the visible cache\n this.navService?.update_visible_cache(this, this.expanded);\n if (!oldValue) {\n return;\n }\n // await for load on demand children\n Promise.resolve().then(() => {\n if (this.navService?.focusedItem !== this && !this.isFocused) {\n this.navService?.focusedItem?.wrapper?.scrollIntoView({\n behavior: 'smooth',\n block: 'nearest',\n inline: 'nearest',\n });\n }\n });\n }\n\n @watch('active', { waitUntilFirstUpdate: true })\n protected activeChange(): void {\n if ((this.active && this.navService?.activeItem === this) || !this.active) {\n return;\n }\n if (this.navService) {\n this.navService.setActiveItem(this, false);\n }\n // Expand and scroll to the newly active item\n this.tree?.expandToItem(this);\n // Await for expanding\n Promise.resolve().then(() => {\n this.wrapper?.scrollIntoView({\n behavior: 'smooth',\n block: 'nearest',\n inline: 'nearest',\n });\n });\n }\n\n @watch('disabled')\n protected disabledChange(): void {\n this.navService?.update_disabled_cache(this);\n }\n\n @watch('selected', { waitUntilFirstUpdate: true })\n protected selectedChange(): void {\n if (this.selected && !this.selectionService?.isItemSelected(this)) {\n this.selectionService?.selectItemsWithNoEvent([this]);\n }\n if (!this.selected && this.selectionService?.isItemSelected(this)) {\n this.selectionService?.deselectItemsWithNoEvent([this]);\n }\n }\n\n public override connectedCallback(): void {\n super.connectedCallback();\n this.tree = this.closest('igc-tree') as IgcTreeComponent;\n this.parent =\n this.parentElement?.tagName.toLowerCase() === 'igc-tree-item'\n ? (this.parentElement as IgcTreeItemComponent)\n : null;\n this.level = this.parent ? this.parent.level + 1 : 0;\n this.setAttribute('role', 'treeitem');\n this.addEventListener('blur', this.onBlur);\n this.addEventListener('focus', this.onFocus);\n this.addEventListener('pointerdown', this.pointerDown);\n this.activeChange();\n // if the item is not added/moved runtime\n if (this.init) {\n this.selectedChange();\n } else {\n // retriger the item selection state in order to update the collections within the selectionService\n // and to handle correctly the itemParents recursively to the top-most ancestor\n this.selectionService?.retriggerItemState(this);\n }\n this.init = false;\n }\n\n public override disconnectedCallback(): void {\n super.disconnectedCallback();\n this.selectionService?.ensureStateOnItemDelete(this);\n this.navService?.delete_item(this);\n }\n\n private get selectionService(): IgcTreeSelectionService | undefined {\n return this.tree?.selectionService;\n }\n\n private get navService(): IgcTreeNavigationService | undefined {\n return this.tree?.navService;\n }\n\n private get parts() {\n return {\n selected: this.selected,\n focused: this.isFocused,\n active: this.active,\n };\n }\n\n private get directChildren(): Array<IgcTreeItemComponent> {\n return Array.from(this.children).filter(\n (x) => x.tagName.toLowerCase() === 'igc-tree-item'\n ) as IgcTreeItemComponent[];\n }\n\n private get allChildren(): Array<IgcTreeItemComponent> {\n return Array.from(this.querySelectorAll(`igc-tree-item`));\n }\n\n /** The full path to the tree item, starting from the top-most ancestor. */\n public get path(): IgcTreeItemComponent[] {\n return this.parent?.path ? [...this.parent.path, this] : [this];\n }\n\n private pointerDown(event: MouseEvent): void {\n event.stopPropagation();\n if (this.disabled) {\n return;\n }\n this.tabIndex = 0;\n this.navService?.setFocusedAndActiveItem(this, true, false);\n }\n\n private expandIndicatorClick(): void {\n if (this.disabled) {\n return;\n }\n if (this.expanded) {\n this.collapseWithEvent();\n } else {\n this.expandWithEvent();\n }\n }\n\n private selectorClick(event: MouseEvent): void {\n event.preventDefault();\n if (event.shiftKey) {\n this.selectionService?.selectMultipleItems(this);\n return;\n }\n if (this.selected) {\n this.selectionService?.deselectItem(this);\n } else {\n this.selectionService?.selectItem(this);\n }\n }\n\n private onFocus(): void {\n if (this.disabled) {\n return;\n }\n if (this.navService?.focusedItem !== this) {\n this.navService?.focusItem(this, false);\n this.wrapper?.scrollIntoView({\n behavior: 'smooth',\n block: 'nearest',\n inline: 'nearest',\n });\n }\n if (this.tabbableEl && this.tabbableEl.length) {\n // set tabIndex = 0 to all tabbable elements\n // focus the first one\n this.tabbableEl.forEach((element: HTMLElement) => {\n element.tabIndex = 0;\n });\n this.focusedProgrammatically = true;\n this.tabbableEl[0].focus();\n return;\n }\n this.isFocused = true;\n }\n\n private onBlur(): void {\n this.isFocused = false;\n }\n\n private onFocusIn(ev: Event): void {\n ev?.stopPropagation();\n if (!this.disabled) {\n // clicking directly over tabbable element when the item is not focused\n if (!this.focusedProgrammatically) {\n this.tabbableEl?.forEach((element: HTMLElement) => {\n element.tabIndex = 0;\n });\n }\n this.removeAttribute('tabIndex');\n this.isFocused = true;\n this.focusedProgrammatically = false;\n }\n }\n\n private onFocusOut(ev: Event): void {\n ev?.stopPropagation();\n this.isFocused = false;\n this.tabbableEl?.forEach((element: HTMLElement) => {\n element.tabIndex = -1;\n });\n\n if (this.navService?.focusedItem === this) {\n // called twice when clicking on already focused item with link (pointerDown handler)\n this.setAttribute('tabindex', '0');\n }\n }\n\n private labelChange(): void {\n const firstElement = this.contentList[0];\n const tabbableSelector =\n 'a[href], button, input, textarea, select, details, [tabindex]:not([tabindex=\"-1\"])';\n\n this.tabbableEl = [\n ...firstElement.querySelectorAll<HTMLElement>(tabbableSelector),\n ];\n if (firstElement.matches(tabbableSelector)) {\n this.tabbableEl.splice(0, 0, firstElement);\n }\n\n if (this.tabbableEl && this.tabbableEl.length) {\n this.setAttribute('role', 'none');\n this.tabbableEl[0].setAttribute('role', 'treeitem');\n\n this.tabbableEl.forEach((element: HTMLElement) => {\n element.tabIndex = -1;\n });\n } else {\n this.setAttribute('role', 'treeitem');\n }\n }\n\n private handleChange(): void {\n this.hasChildren = !!this.directChildren.length;\n // there is no need to update nested children beacuse they're state is already up to date\n this.navService?.update_visible_cache(this, this.expanded, false);\n }\n\n /**\n * Returns a collection of child items.\n * If the parameter value is true returns all tree item's direct children,\n * otherwise - only the direct children.\n */\n public getChildren(\n options: { flatten: boolean } = { flatten: false }\n ): IgcTreeItemComponent[] {\n if (options.flatten) {\n return this.allChildren;\n } else {\n return this.directChildren;\n }\n }\n\n /**\n * @private\n * Expands the tree item.\n */\n public expandWithEvent(): void {\n if (this.expanded) {\n return;\n }\n const args = {\n detail: this,\n cancelable: true,\n };\n\n const allowed = this.tree?.emitEvent('igcItemExpanding', args);\n\n if (!allowed) {\n return;\n }\n\n if (this.tree?.singleBranchExpand) {\n const pathSet = new Set(this.path.splice(0, this.path.length - 1));\n this.tree.items.forEach((item: IgcTreeItemComponent) => {\n if (!pathSet.has(item)) {\n item.collapseWithEvent();\n }\n });\n }\n\n this.expanded = true;\n this.tree?.emitEvent('igcItemExpanded', { detail: this });\n }\n\n /**\n * @private\n * Collapses the tree item.\n */\n public collapseWithEvent(): void {\n if (!this.expanded) {\n return;\n }\n const args = {\n detail: this,\n cancelable: true,\n };\n\n const allowed = this.tree?.emitEvent('igcItemCollapsing', args);\n\n if (!allowed) {\n return;\n }\n this.expanded = false;\n this.tree?.emitEvent('igcItemCollapsed', { detail: this });\n }\n\n /** Toggles tree item expansion state. */\n public toggle(): void {\n this.expanded = !this.expanded;\n }\n\n /** Expands the tree item. */\n public expand(): void {\n this.expanded = true;\n }\n\n /** Collapses the tree item. */\n public collapse(): void {\n this.expanded = false;\n }\n\n protected override render() {\n const size = this.level * (this.tree ? sizeMultiplier[this.tree!.size] : 1);\n\n return html`\n <div\n id=\"wrapper\"\n part=\"wrapper ${this.tree?.size} ${partNameMap(this.parts)}\"\n >\n <div\n style=\"width: calc(${size} * var(--igc-tree-indentation-size))\"\n part=\"indentation\"\n aria-hidden=\"true\"\n >\n <slot name=\"indentation\"></slot>\n </div>\n <div part=\"indicator\" aria-hidden=\"true\">\n ${this.loading\n ? html`\n <slot name=\"loading\">\n <igc-circular-progress indeterminate></igc-circular-progress>\n </slot>\n `\n : html`\n <slot name=\"indicator\" @click=${this.expandIndicatorClick}>\n ${this.hasChildren\n ? html`\n <igc-icon\n name=${this.expanded\n ? 'keyboard_arrow_down'\n : this.tree?.dir === 'rtl'\n ? 'navigate_before'\n : 'keyboard_arrow_right'}\n collection=\"internal\"\n >\n </igc-icon>\n `\n : ''}\n </slot>\n `}\n </div>\n ${this.tree?.selection !== 'none'\n ? html`\n <div part=\"select\" aria-hidden=\"true\">\n <igc-checkbox\n @click=${this.selectorClick}\n .checked=${this.selected}\n .indeterminate=${this.indeterminate}\n .disabled=${this.disabled}\n tabindex=\"-1\"\n >\n </igc-checkbox>\n </div>\n `\n : ''}\n <div part=\"label\">\n <slot\n name=\"label\"\n @slotchange=${this.labelChange}\n @focusin=${this.onFocusIn}\n @focusout=${this.onFocusOut}\n >\n <span part=\"text\">${this.label}</span>\n </slot>\n </div>\n </div>\n <div role=\"group\">\n <slot @slotchange=${this.handleChange} ?hidden=${!this.expanded}></slot>\n </div>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'igc-tree-item': IgcTreeItemComponent;\n }\n}\n"]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type IgcTreeItemComponent from './tree-item.js';
|
|
2
|
+
export interface IgcTreeEventMap {
|
|
3
|
+
igcSelection: CustomEvent<{
|
|
4
|
+
newSelection: IgcTreeItemComponent[];
|
|
5
|
+
}>;
|
|
6
|
+
igcItemExpanding: CustomEvent<IgcTreeItemComponent>;
|
|
7
|
+
igcItemExpanded: CustomEvent<IgcTreeItemComponent>;
|
|
8
|
+
igcItemCollapsing: CustomEvent<IgcTreeItemComponent>;
|
|
9
|
+
igcItemCollapsed: CustomEvent<IgcTreeItemComponent>;
|
|
10
|
+
igcActiveItem: CustomEvent<IgcTreeItemComponent>;
|
|
11
|
+
}
|
|
12
|
+
export interface IgcSelectionEventArgs {
|
|
13
|
+
detail: {
|
|
14
|
+
readonly newSelection: IgcTreeItemComponent[];
|
|
15
|
+
};
|
|
16
|
+
cancelable: boolean;
|
|
17
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tree.common.js","sourceRoot":"","sources":["../../../src/components/tree/tree.common.ts"],"names":[],"mappings":"","sourcesContent":["import type IgcTreeItemComponent from './tree-item.js';\n\nexport interface IgcTreeEventMap {\n igcSelection: CustomEvent<{ newSelection: IgcTreeItemComponent[] }>;\n igcItemExpanding: CustomEvent<IgcTreeItemComponent>;\n igcItemExpanded: CustomEvent<IgcTreeItemComponent>;\n igcItemCollapsing: CustomEvent<IgcTreeItemComponent>;\n igcItemCollapsed: CustomEvent<IgcTreeItemComponent>;\n igcActiveItem: CustomEvent<IgcTreeItemComponent>;\n}\nexport interface IgcSelectionEventArgs {\n detail: { readonly newSelection: IgcTreeItemComponent[] };\n cancelable: boolean;\n}\n"]}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { LitElement } from 'lit';
|
|
2
|
+
import { Constructor } from '../common/mixins/constructor.js';
|
|
3
|
+
import IgcTreeItemComponent from './tree-item.js';
|
|
4
|
+
import { IgcTreeEventMap } from './tree.common.js';
|
|
5
|
+
import { IgcTreeNavigationService } from './tree.navigation.js';
|
|
6
|
+
import { IgcTreeSelectionService } from './tree.selection.js';
|
|
7
|
+
declare type Direction = 'ltr' | 'rtl' | 'auto';
|
|
8
|
+
declare const IgcTreeComponent_base: Constructor<import("../common/mixins/sizable.js").SizableInterface> & Constructor<import("../common/mixins/event-emitter.js").EventEmitterInterface<IgcTreeEventMap>> & Constructor<LitElement>;
|
|
9
|
+
/**
|
|
10
|
+
* The tree allows users to represent hierarchical data in a tree-view structure,
|
|
11
|
+
* maintaining parent-child relationships, as well as to define static tree-view structure without a corresponding data model.
|
|
12
|
+
*
|
|
13
|
+
* @element igc-tree
|
|
14
|
+
*
|
|
15
|
+
* @slot - Renders the tree items inside default slot.
|
|
16
|
+
*
|
|
17
|
+
* @fires igcSelection - Emitted when item selection is changing, before the selection completes.
|
|
18
|
+
* @fires igcItemCollapsed - Emitted when tree item is collapsed.
|
|
19
|
+
* @fires igcItemCollapsing - Emitted when tree item is about to collapse.
|
|
20
|
+
* @fires igcItemExpanded - Emitted when tree item is expanded.
|
|
21
|
+
* @fires igcItemExpanding - Emitted when tree item is about to expand.
|
|
22
|
+
* @fires igcItemActivated - Emitted when the tree's `active` item changes.
|
|
23
|
+
*/
|
|
24
|
+
export default class IgcTreeComponent extends IgcTreeComponent_base {
|
|
25
|
+
/** @private */
|
|
26
|
+
static readonly tagName = "igc-tree";
|
|
27
|
+
/** @private */
|
|
28
|
+
static styles: import("lit").CSSResult;
|
|
29
|
+
/** @private */
|
|
30
|
+
selectionService: IgcTreeSelectionService;
|
|
31
|
+
/** @private */
|
|
32
|
+
navService: IgcTreeNavigationService;
|
|
33
|
+
/** Whether a single or multiple of a parent's child items can be expanded. */
|
|
34
|
+
singleBranchExpand: boolean;
|
|
35
|
+
/** The selection state of the tree. */
|
|
36
|
+
selection: 'none' | 'multiple' | 'cascade';
|
|
37
|
+
/** The direction attribute of the control. */
|
|
38
|
+
dir: Direction;
|
|
39
|
+
protected onDirChange(): void;
|
|
40
|
+
protected onSizeChange(): void;
|
|
41
|
+
protected selectionModeChange(): void;
|
|
42
|
+
protected singleBranchExpandChange(): void;
|
|
43
|
+
constructor();
|
|
44
|
+
connectedCallback(): void;
|
|
45
|
+
/** Returns all of the tree's items. */
|
|
46
|
+
get items(): Array<IgcTreeItemComponent>;
|
|
47
|
+
private handleKeydown;
|
|
48
|
+
/** @private */
|
|
49
|
+
expandToItem(item: IgcTreeItemComponent): void;
|
|
50
|
+
/** Select all items if the items collection is empty. Otherwise, select the items in the items collection. */
|
|
51
|
+
select(items?: IgcTreeItemComponent[]): void;
|
|
52
|
+
/** Deselect all items if the items collection is empty. Otherwise, deselect the items in the items collection. */
|
|
53
|
+
deselect(items?: IgcTreeItemComponent[]): void;
|
|
54
|
+
/**
|
|
55
|
+
* Expands all of the passed items.
|
|
56
|
+
* If no items are passed, expands ALL items.
|
|
57
|
+
*/
|
|
58
|
+
expand(items?: IgcTreeItemComponent[]): void;
|
|
59
|
+
/**
|
|
60
|
+
* Collapses all of the passed items.
|
|
61
|
+
* If no items are passed, collapses ALL items.
|
|
62
|
+
*/
|
|
63
|
+
collapse(items?: IgcTreeItemComponent[]): void;
|
|
64
|
+
protected render(): import("lit-html").TemplateResult<1>;
|
|
65
|
+
}
|
|
66
|
+
declare global {
|
|
67
|
+
interface HTMLElementTagNameMap {
|
|
68
|
+
'igc-tree': IgcTreeComponent;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
export {};
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import { html, LitElement } from 'lit';
|
|
8
|
+
import { property } from 'lit/decorators.js';
|
|
9
|
+
import { watch } from '../common/decorators/watch.js';
|
|
10
|
+
import { styles } from './themes/light/tree.base.css.js';
|
|
11
|
+
import { EventEmitterMixin } from '../common/mixins/event-emitter.js';
|
|
12
|
+
import { SizableMixin } from '../common/mixins/sizable.js';
|
|
13
|
+
import { IgcTreeNavigationService } from './tree.navigation.js';
|
|
14
|
+
import { IgcTreeSelectionService } from './tree.selection.js';
|
|
15
|
+
export default class IgcTreeComponent extends SizableMixin(EventEmitterMixin(LitElement)) {
|
|
16
|
+
constructor() {
|
|
17
|
+
super();
|
|
18
|
+
this.singleBranchExpand = false;
|
|
19
|
+
this.selection = 'none';
|
|
20
|
+
this.dir = 'auto';
|
|
21
|
+
this.selectionService = new IgcTreeSelectionService(this);
|
|
22
|
+
this.navService = new IgcTreeNavigationService(this, this.selectionService);
|
|
23
|
+
}
|
|
24
|
+
onDirChange() {
|
|
25
|
+
var _a;
|
|
26
|
+
(_a = this.items) === null || _a === void 0 ? void 0 : _a.forEach((item) => {
|
|
27
|
+
item.requestUpdate();
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
onSizeChange() {
|
|
31
|
+
var _a, _b, _c;
|
|
32
|
+
(_a = this.items) === null || _a === void 0 ? void 0 : _a.forEach((item) => {
|
|
33
|
+
item.requestUpdate();
|
|
34
|
+
});
|
|
35
|
+
(_c = (_b = this.navService.activeItem) === null || _b === void 0 ? void 0 : _b.wrapper) === null || _c === void 0 ? void 0 : _c.scrollIntoView({
|
|
36
|
+
behavior: 'smooth',
|
|
37
|
+
block: 'nearest',
|
|
38
|
+
inline: 'nearest',
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
selectionModeChange() {
|
|
42
|
+
var _a;
|
|
43
|
+
this.selectionService.clearItemsSelection();
|
|
44
|
+
(_a = this.items) === null || _a === void 0 ? void 0 : _a.forEach((item) => {
|
|
45
|
+
item.requestUpdate();
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
singleBranchExpandChange() {
|
|
49
|
+
if (this.singleBranchExpand) {
|
|
50
|
+
if (this.navService.activeItem) {
|
|
51
|
+
const path = this.navService.activeItem.path;
|
|
52
|
+
const remainExpanded = new Set(path.splice(0, path.length - 1));
|
|
53
|
+
this.items.forEach((item) => {
|
|
54
|
+
if (!remainExpanded.has(item)) {
|
|
55
|
+
item.collapseWithEvent();
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
else {
|
|
60
|
+
this.items.forEach((item) => item.collapseWithEvent());
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
connectedCallback() {
|
|
65
|
+
super.connectedCallback();
|
|
66
|
+
this.setAttribute('role', 'tree');
|
|
67
|
+
this.addEventListener('keydown', this.handleKeydown);
|
|
68
|
+
this.items.forEach((i) => {
|
|
69
|
+
i.init = true;
|
|
70
|
+
});
|
|
71
|
+
const firstNotDisabledItem = this.items.find((i) => !i.disabled);
|
|
72
|
+
if (firstNotDisabledItem) {
|
|
73
|
+
firstNotDisabledItem.tabIndex = 0;
|
|
74
|
+
this.navService.focusItem(firstNotDisabledItem);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
get items() {
|
|
78
|
+
return Array.from(this.querySelectorAll(`igc-tree-item`));
|
|
79
|
+
}
|
|
80
|
+
handleKeydown(event) {
|
|
81
|
+
this.navService.handleKeydown(event);
|
|
82
|
+
}
|
|
83
|
+
expandToItem(item) {
|
|
84
|
+
if (item && item.parent) {
|
|
85
|
+
item.path.forEach((i) => {
|
|
86
|
+
if (i !== item && !i.expanded) {
|
|
87
|
+
i.expanded = true;
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
select(items) {
|
|
93
|
+
if (!items) {
|
|
94
|
+
items =
|
|
95
|
+
this.selection === 'cascade'
|
|
96
|
+
? this.items.filter((item) => item.level === 0)
|
|
97
|
+
: this.items;
|
|
98
|
+
}
|
|
99
|
+
this.selectionService.selectItemsWithNoEvent(items);
|
|
100
|
+
}
|
|
101
|
+
deselect(items) {
|
|
102
|
+
this.selectionService.deselectItemsWithNoEvent(items);
|
|
103
|
+
}
|
|
104
|
+
expand(items) {
|
|
105
|
+
items = items || this.items;
|
|
106
|
+
items.forEach((item) => (item.expanded = true));
|
|
107
|
+
}
|
|
108
|
+
collapse(items) {
|
|
109
|
+
items = items || this.items;
|
|
110
|
+
items.forEach((item) => (item.expanded = false));
|
|
111
|
+
}
|
|
112
|
+
render() {
|
|
113
|
+
return html `<slot></slot>`;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
IgcTreeComponent.tagName = 'igc-tree';
|
|
117
|
+
IgcTreeComponent.styles = styles;
|
|
118
|
+
__decorate([
|
|
119
|
+
property({ attribute: 'single-branch-expand', reflect: true, type: Boolean })
|
|
120
|
+
], IgcTreeComponent.prototype, "singleBranchExpand", void 0);
|
|
121
|
+
__decorate([
|
|
122
|
+
property({ reflect: true })
|
|
123
|
+
], IgcTreeComponent.prototype, "selection", void 0);
|
|
124
|
+
__decorate([
|
|
125
|
+
property({ reflect: true })
|
|
126
|
+
], IgcTreeComponent.prototype, "dir", void 0);
|
|
127
|
+
__decorate([
|
|
128
|
+
watch('dir')
|
|
129
|
+
], IgcTreeComponent.prototype, "onDirChange", null);
|
|
130
|
+
__decorate([
|
|
131
|
+
watch('size', { waitUntilFirstUpdate: true })
|
|
132
|
+
], IgcTreeComponent.prototype, "onSizeChange", null);
|
|
133
|
+
__decorate([
|
|
134
|
+
watch('selection', { waitUntilFirstUpdate: true })
|
|
135
|
+
], IgcTreeComponent.prototype, "selectionModeChange", null);
|
|
136
|
+
__decorate([
|
|
137
|
+
watch('singleBranchExpand')
|
|
138
|
+
], IgcTreeComponent.prototype, "singleBranchExpandChange", null);
|
|
139
|
+
//# sourceMappingURL=tree.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tree.js","sourceRoot":"","sources":["../../../src/components/tree/tree.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC;AACvC,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,KAAK,EAAE,MAAM,+BAA+B,CAAC;AACtD,OAAO,EAAE,MAAM,EAAE,MAAM,iCAAiC,CAAC;AAEzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AACtE,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAG3D,OAAO,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AAChE,OAAO,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AAmB9D,MAAM,CAAC,OAAO,OAAO,gBAAiB,SAAQ,YAAY,CACxD,iBAAiB,CAA2C,UAAU,CAAC,CACxE;IAoEC;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CAAA,eAAe,CAAC;IAC7B,CAAC;;AAjJsB,wBAAO,GAAG,UAAU,CAAC;AAE9B,uBAAM,GAAG,MAAM,CAAC;AAS9B;IADC,QAAQ,CAAC,EAAE,SAAS,EAAE,sBAAsB,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;4DAC5C;AAIlC;IADC,QAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;mDAC+B;AAI3D;IADC,QAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;6CACY;AAGxC;IADC,KAAK,CAAC,KAAK,CAAC;mDAKZ;AAGD;IADC,KAAK,CAAC,MAAM,EAAE,EAAE,oBAAoB,EAAE,IAAI,EAAE,CAAC;oDAU7C;AAGD;IADC,KAAK,CAAC,WAAW,EAAE,EAAE,oBAAoB,EAAE,IAAI,EAAE,CAAC;2DAMlD;AAGD;IADC,KAAK,CAAC,oBAAoB,CAAC;gEAgB3B","sourcesContent":["import { html, LitElement } from 'lit';\nimport { property } from 'lit/decorators.js';\nimport { watch } from '../common/decorators/watch.js';\nimport { styles } from './themes/light/tree.base.css.js';\nimport { Constructor } from '../common/mixins/constructor.js';\nimport { EventEmitterMixin } from '../common/mixins/event-emitter.js';\nimport { SizableMixin } from '../common/mixins/sizable.js';\nimport IgcTreeItemComponent from './tree-item.js';\nimport { IgcTreeEventMap } from './tree.common.js';\nimport { IgcTreeNavigationService } from './tree.navigation.js';\nimport { IgcTreeSelectionService } from './tree.selection.js';\n\ntype Direction = 'ltr' | 'rtl' | 'auto';\n\n/**\n * The tree allows users to represent hierarchical data in a tree-view structure,\n * maintaining parent-child relationships, as well as to define static tree-view structure without a corresponding data model.\n *\n * @element igc-tree\n *\n * @slot - Renders the tree items inside default slot.\n *\n * @fires igcSelection - Emitted when item selection is changing, before the selection completes.\n * @fires igcItemCollapsed - Emitted when tree item is collapsed.\n * @fires igcItemCollapsing - Emitted when tree item is about to collapse.\n * @fires igcItemExpanded - Emitted when tree item is expanded.\n * @fires igcItemExpanding - Emitted when tree item is about to expand.\n * @fires igcItemActivated - Emitted when the tree's `active` item changes.\n */\nexport default class IgcTreeComponent extends SizableMixin(\n EventEmitterMixin<IgcTreeEventMap, Constructor<LitElement>>(LitElement)\n) {\n /** @private */\n public static readonly tagName = 'igc-tree';\n /** @private */\n public static styles = styles;\n\n /** @private */\n public selectionService!: IgcTreeSelectionService;\n /** @private */\n public navService!: IgcTreeNavigationService;\n\n /** Whether a single or multiple of a parent's child items can be expanded. */\n @property({ attribute: 'single-branch-expand', reflect: true, type: Boolean })\n public singleBranchExpand = false;\n\n /** The selection state of the tree. */\n @property({ reflect: true })\n public selection: 'none' | 'multiple' | 'cascade' = 'none';\n\n /** The direction attribute of the control. */\n @property({ reflect: true })\n public override dir: Direction = 'auto';\n\n @watch('dir')\n protected onDirChange(): void {\n this.items?.forEach((item: IgcTreeItemComponent) => {\n item.requestUpdate();\n });\n }\n\n @watch('size', { waitUntilFirstUpdate: true })\n protected onSizeChange(): void {\n this.items?.forEach((item: IgcTreeItemComponent) => {\n item.requestUpdate();\n });\n this.navService.activeItem?.wrapper?.scrollIntoView({\n behavior: 'smooth',\n block: 'nearest',\n inline: 'nearest',\n });\n }\n\n @watch('selection', { waitUntilFirstUpdate: true })\n protected selectionModeChange(): void {\n this.selectionService.clearItemsSelection();\n this.items?.forEach((item: IgcTreeItemComponent) => {\n item.requestUpdate();\n });\n }\n\n @watch('singleBranchExpand')\n protected singleBranchExpandChange(): void {\n if (this.singleBranchExpand) {\n // if activeItem -> do not collapse its branch\n if (this.navService.activeItem) {\n const path = this.navService.activeItem.path;\n const remainExpanded = new Set(path.splice(0, path.length - 1));\n this.items.forEach((item) => {\n if (!remainExpanded.has(item)) {\n item.collapseWithEvent();\n }\n });\n } else {\n this.items.forEach((item) => item.collapseWithEvent());\n }\n }\n }\n\n constructor() {\n super();\n this.selectionService = new IgcTreeSelectionService(this);\n this.navService = new IgcTreeNavigationService(this, this.selectionService);\n }\n\n public override connectedCallback(): void {\n super.connectedCallback();\n this.setAttribute('role', 'tree');\n this.addEventListener('keydown', this.handleKeydown);\n // set init to true for all items which are rendered along with the tree\n this.items.forEach((i: IgcTreeItemComponent) => {\n i.init = true;\n });\n const firstNotDisabledItem = this.items.find(\n (i: IgcTreeItemComponent) => !i.disabled\n );\n if (firstNotDisabledItem) {\n firstNotDisabledItem.tabIndex = 0;\n this.navService.focusItem(firstNotDisabledItem);\n }\n }\n\n /** Returns all of the tree's items. */\n public get items(): Array<IgcTreeItemComponent> {\n return Array.from(this.querySelectorAll(`igc-tree-item`));\n }\n\n private handleKeydown(event: KeyboardEvent) {\n this.navService.handleKeydown(event);\n }\n\n /** @private */\n public expandToItem(item: IgcTreeItemComponent): void {\n if (item && item.parent) {\n item.path.forEach((i) => {\n if (i !== item && !i.expanded) {\n i.expanded = true;\n }\n });\n }\n }\n\n /** Select all items if the items collection is empty. Otherwise, select the items in the items collection. */\n public select(items?: IgcTreeItemComponent[]): void {\n if (!items) {\n items =\n this.selection === 'cascade'\n ? this.items.filter((item: IgcTreeItemComponent) => item.level === 0)\n : this.items;\n }\n this.selectionService.selectItemsWithNoEvent(items);\n }\n\n /** Deselect all items if the items collection is empty. Otherwise, deselect the items in the items collection. */\n public deselect(items?: IgcTreeItemComponent[]): void {\n this.selectionService.deselectItemsWithNoEvent(items);\n }\n\n /**\n * Expands all of the passed items.\n * If no items are passed, expands ALL items.\n */\n public expand(items?: IgcTreeItemComponent[]): void {\n items = items || this.items;\n items.forEach((item) => (item.expanded = true));\n }\n\n /**\n * Collapses all of the passed items.\n * If no items are passed, collapses ALL items.\n */\n public collapse(items?: IgcTreeItemComponent[]): void {\n items = items || this.items;\n items.forEach((item) => (item.expanded = false));\n }\n\n protected override render() {\n return html`<slot></slot>`;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'igc-tree': IgcTreeComponent;\n }\n}\n"]}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import IgcTreeComponent from './tree.js';
|
|
2
|
+
import IgcTreeItemComponent from './tree-item.js';
|
|
3
|
+
import { IgcTreeSelectionService } from './tree.selection.js';
|
|
4
|
+
export declare const NAVIGATION_KEYS: Set<string>;
|
|
5
|
+
export declare class IgcTreeNavigationService {
|
|
6
|
+
private tree;
|
|
7
|
+
private selectionService;
|
|
8
|
+
private _focusedItem;
|
|
9
|
+
private _lastFocusedItem;
|
|
10
|
+
private _activeItem;
|
|
11
|
+
private _visibleChildren;
|
|
12
|
+
private _invisibleChildren;
|
|
13
|
+
private _disabledChildren;
|
|
14
|
+
constructor(tree: IgcTreeComponent, selectionService: IgcTreeSelectionService);
|
|
15
|
+
updateVisChild(): void;
|
|
16
|
+
get focusedItem(): IgcTreeItemComponent | null;
|
|
17
|
+
focusItem(value: IgcTreeItemComponent | null, shouldFocus?: boolean): void;
|
|
18
|
+
get activeItem(): IgcTreeItemComponent | null;
|
|
19
|
+
setActiveItem(value: IgcTreeItemComponent | null, shouldEmit?: boolean): void;
|
|
20
|
+
get visibleChildren(): IgcTreeItemComponent[];
|
|
21
|
+
update_disabled_cache(item: IgcTreeItemComponent): void;
|
|
22
|
+
delete_item(item: IgcTreeItemComponent): void;
|
|
23
|
+
update_visible_cache(item: IgcTreeItemComponent, expanded: boolean, shouldUpdateNestedChildren?: boolean, shouldUpdate?: boolean): void;
|
|
24
|
+
/**
|
|
25
|
+
* Sets the item as focused (and active)
|
|
26
|
+
*
|
|
27
|
+
* @param item target item
|
|
28
|
+
* @param isActive if true, sets the item as active
|
|
29
|
+
*/
|
|
30
|
+
setFocusedAndActiveItem(item: IgcTreeItemComponent, isActive?: boolean, shouldFocus?: boolean): void;
|
|
31
|
+
/** Handler for keydown events. Used in tree.component.ts */
|
|
32
|
+
handleKeydown(event: KeyboardEvent): void;
|
|
33
|
+
private handleNavigation;
|
|
34
|
+
private handleArrowLeft;
|
|
35
|
+
private handleArrowRight;
|
|
36
|
+
private handleUpDownArrow;
|
|
37
|
+
private handleAsterisk;
|
|
38
|
+
private handleSpace;
|
|
39
|
+
/** Gets the next visible item in the given direction - 1 -> next, -1 -> previous */
|
|
40
|
+
private getVisibleItem;
|
|
41
|
+
}
|
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
export const NAVIGATION_KEYS = new Set([
|
|
2
|
+
'down',
|
|
3
|
+
'up',
|
|
4
|
+
'left',
|
|
5
|
+
'right',
|
|
6
|
+
'arrowdown',
|
|
7
|
+
'arrowup',
|
|
8
|
+
'arrowleft',
|
|
9
|
+
'arrowright',
|
|
10
|
+
'home',
|
|
11
|
+
'end',
|
|
12
|
+
'space',
|
|
13
|
+
'spacebar',
|
|
14
|
+
' ',
|
|
15
|
+
]);
|
|
16
|
+
export class IgcTreeNavigationService {
|
|
17
|
+
constructor(tree, selectionService) {
|
|
18
|
+
this._focusedItem = null;
|
|
19
|
+
this._lastFocusedItem = null;
|
|
20
|
+
this._activeItem = null;
|
|
21
|
+
this._visibleChildren = [];
|
|
22
|
+
this._invisibleChildren = new Set();
|
|
23
|
+
this._disabledChildren = new Set();
|
|
24
|
+
this.tree = tree;
|
|
25
|
+
this.selectionService = selectionService;
|
|
26
|
+
}
|
|
27
|
+
updateVisChild() {
|
|
28
|
+
var _a;
|
|
29
|
+
this._visibleChildren = ((_a = this.tree) === null || _a === void 0 ? void 0 : _a.items)
|
|
30
|
+
? this.tree.items.filter((i) => !(this._invisibleChildren.has(i) || this._disabledChildren.has(i)))
|
|
31
|
+
: [];
|
|
32
|
+
}
|
|
33
|
+
get focusedItem() {
|
|
34
|
+
return this._focusedItem;
|
|
35
|
+
}
|
|
36
|
+
focusItem(value, shouldFocus = true) {
|
|
37
|
+
var _a;
|
|
38
|
+
if (this._focusedItem === value) {
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
this._lastFocusedItem = this._focusedItem;
|
|
42
|
+
if (this._lastFocusedItem) {
|
|
43
|
+
this._lastFocusedItem.removeAttribute('tabindex');
|
|
44
|
+
}
|
|
45
|
+
this._focusedItem = value;
|
|
46
|
+
if (this._focusedItem !== null && shouldFocus) {
|
|
47
|
+
this._focusedItem.tabIndex = 0;
|
|
48
|
+
this._focusedItem.focus({
|
|
49
|
+
preventScroll: true,
|
|
50
|
+
});
|
|
51
|
+
(_a = this._focusedItem.wrapper) === null || _a === void 0 ? void 0 : _a.scrollIntoView({
|
|
52
|
+
behavior: 'smooth',
|
|
53
|
+
block: 'nearest',
|
|
54
|
+
inline: 'nearest',
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
get activeItem() {
|
|
59
|
+
return this._activeItem;
|
|
60
|
+
}
|
|
61
|
+
setActiveItem(value, shouldEmit = true) {
|
|
62
|
+
if (this._activeItem === value) {
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
if (this._activeItem && value) {
|
|
66
|
+
this._activeItem.active = false;
|
|
67
|
+
}
|
|
68
|
+
this._activeItem = value;
|
|
69
|
+
if (this._activeItem) {
|
|
70
|
+
this._activeItem.active = true;
|
|
71
|
+
}
|
|
72
|
+
if (shouldEmit && this._activeItem) {
|
|
73
|
+
this.tree.emitEvent('igcActiveItem', { detail: this._activeItem });
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
get visibleChildren() {
|
|
77
|
+
return this._visibleChildren;
|
|
78
|
+
}
|
|
79
|
+
update_disabled_cache(item) {
|
|
80
|
+
if (item.disabled) {
|
|
81
|
+
this._disabledChildren.add(item);
|
|
82
|
+
}
|
|
83
|
+
else {
|
|
84
|
+
this._disabledChildren.delete(item);
|
|
85
|
+
}
|
|
86
|
+
this.updateVisChild();
|
|
87
|
+
}
|
|
88
|
+
delete_item(item) {
|
|
89
|
+
if (this.activeItem === item) {
|
|
90
|
+
this.setActiveItem(null);
|
|
91
|
+
}
|
|
92
|
+
if (this.focusedItem === item) {
|
|
93
|
+
this.focusItem(null, false);
|
|
94
|
+
const firstNotDisableItem = this.tree.items.find((i) => !i.disabled);
|
|
95
|
+
if (firstNotDisableItem) {
|
|
96
|
+
firstNotDisableItem.tabIndex = 0;
|
|
97
|
+
this.focusItem(firstNotDisableItem, false);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
update_visible_cache(item, expanded, shouldUpdateNestedChildren = true, shouldUpdate = true) {
|
|
102
|
+
var _a, _b;
|
|
103
|
+
if (expanded && !this._invisibleChildren.has(item)) {
|
|
104
|
+
(_a = item.getChildren()) === null || _a === void 0 ? void 0 : _a.forEach((child) => {
|
|
105
|
+
this._invisibleChildren.delete(child);
|
|
106
|
+
if (shouldUpdateNestedChildren) {
|
|
107
|
+
this.update_visible_cache(child, child.expanded, true, false);
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
else {
|
|
112
|
+
(_b = item
|
|
113
|
+
.getChildren({ flatten: true })) === null || _b === void 0 ? void 0 : _b.forEach((c) => this._invisibleChildren.add(c));
|
|
114
|
+
}
|
|
115
|
+
if (shouldUpdate) {
|
|
116
|
+
this.updateVisChild();
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
setFocusedAndActiveItem(item, isActive = true, shouldFocus = true) {
|
|
120
|
+
if (isActive) {
|
|
121
|
+
this.setActiveItem(item);
|
|
122
|
+
}
|
|
123
|
+
this.focusItem(item, shouldFocus);
|
|
124
|
+
}
|
|
125
|
+
handleKeydown(event) {
|
|
126
|
+
const key = event.key.toLowerCase();
|
|
127
|
+
if (!this.focusedItem) {
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
130
|
+
if (!(NAVIGATION_KEYS.has(key) || key === '*')) {
|
|
131
|
+
if (key === 'enter') {
|
|
132
|
+
this.setActiveItem(this.focusedItem);
|
|
133
|
+
}
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
136
|
+
event.preventDefault();
|
|
137
|
+
this.handleNavigation(event);
|
|
138
|
+
}
|
|
139
|
+
handleNavigation(event) {
|
|
140
|
+
switch (event.key.toLowerCase()) {
|
|
141
|
+
case 'home':
|
|
142
|
+
this.setFocusedAndActiveItem(this.visibleChildren[0]);
|
|
143
|
+
break;
|
|
144
|
+
case 'end':
|
|
145
|
+
this.setFocusedAndActiveItem(this.visibleChildren[this.visibleChildren.length - 1]);
|
|
146
|
+
break;
|
|
147
|
+
case 'arrowleft':
|
|
148
|
+
case 'left':
|
|
149
|
+
if (this.tree.dir === 'rtl') {
|
|
150
|
+
this.handleArrowRight();
|
|
151
|
+
}
|
|
152
|
+
else {
|
|
153
|
+
this.handleArrowLeft();
|
|
154
|
+
}
|
|
155
|
+
break;
|
|
156
|
+
case 'arrowright':
|
|
157
|
+
case 'right':
|
|
158
|
+
if (this.tree.dir === 'rtl') {
|
|
159
|
+
this.handleArrowLeft();
|
|
160
|
+
}
|
|
161
|
+
else {
|
|
162
|
+
this.handleArrowRight();
|
|
163
|
+
}
|
|
164
|
+
break;
|
|
165
|
+
case 'arrowup':
|
|
166
|
+
case 'up':
|
|
167
|
+
this.handleUpDownArrow(true, event);
|
|
168
|
+
break;
|
|
169
|
+
case 'arrowdown':
|
|
170
|
+
case 'down':
|
|
171
|
+
this.handleUpDownArrow(false, event);
|
|
172
|
+
break;
|
|
173
|
+
case '*':
|
|
174
|
+
this.handleAsterisk();
|
|
175
|
+
break;
|
|
176
|
+
case ' ':
|
|
177
|
+
case 'spacebar':
|
|
178
|
+
case 'space':
|
|
179
|
+
this.handleSpace(event.shiftKey);
|
|
180
|
+
break;
|
|
181
|
+
default:
|
|
182
|
+
return;
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
handleArrowLeft() {
|
|
186
|
+
var _a, _b, _c;
|
|
187
|
+
if (((_a = this.focusedItem) === null || _a === void 0 ? void 0 : _a.expanded) && ((_b = this.focusedItem.getChildren()) === null || _b === void 0 ? void 0 : _b.length)) {
|
|
188
|
+
this.setActiveItem(this.focusedItem);
|
|
189
|
+
this.focusedItem.collapseWithEvent();
|
|
190
|
+
}
|
|
191
|
+
else {
|
|
192
|
+
const parentItem = (_c = this.focusedItem) === null || _c === void 0 ? void 0 : _c.parent;
|
|
193
|
+
if (parentItem && !parentItem.disabled) {
|
|
194
|
+
this.setFocusedAndActiveItem(parentItem);
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
handleArrowRight() {
|
|
199
|
+
var _a, _b;
|
|
200
|
+
if (((_a = this.focusedItem.getChildren()) === null || _a === void 0 ? void 0 : _a.length) > 0) {
|
|
201
|
+
if (!((_b = this.focusedItem) === null || _b === void 0 ? void 0 : _b.expanded)) {
|
|
202
|
+
this.setActiveItem(this.focusedItem);
|
|
203
|
+
this.focusedItem.expandWithEvent();
|
|
204
|
+
}
|
|
205
|
+
else {
|
|
206
|
+
const firstChild = this.focusedItem
|
|
207
|
+
.getChildren()
|
|
208
|
+
.find((item) => !item.disabled);
|
|
209
|
+
if (firstChild) {
|
|
210
|
+
this.setFocusedAndActiveItem(firstChild);
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
handleUpDownArrow(isUp, event) {
|
|
216
|
+
const next = this.getVisibleItem(this.focusedItem, isUp ? -1 : 1);
|
|
217
|
+
if (next === this.focusedItem) {
|
|
218
|
+
return;
|
|
219
|
+
}
|
|
220
|
+
if (event.ctrlKey) {
|
|
221
|
+
this.setFocusedAndActiveItem(next, false);
|
|
222
|
+
}
|
|
223
|
+
else {
|
|
224
|
+
this.setFocusedAndActiveItem(next);
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
handleAsterisk() {
|
|
228
|
+
var _a, _b, _c;
|
|
229
|
+
const items = ((_a = this.focusedItem) === null || _a === void 0 ? void 0 : _a.parent)
|
|
230
|
+
? (_b = this.focusedItem.parent) === null || _b === void 0 ? void 0 : _b.getChildren()
|
|
231
|
+
: (_c = this.tree.items) === null || _c === void 0 ? void 0 : _c.filter((item) => item.level === 0);
|
|
232
|
+
items === null || items === void 0 ? void 0 : items.forEach((item) => {
|
|
233
|
+
if (!item.disabled && !item.expanded && item.hasChildren) {
|
|
234
|
+
item.expandWithEvent();
|
|
235
|
+
}
|
|
236
|
+
});
|
|
237
|
+
}
|
|
238
|
+
handleSpace(shiftKey = false) {
|
|
239
|
+
if (this.tree.selection === 'none') {
|
|
240
|
+
this.setActiveItem(this.focusedItem);
|
|
241
|
+
return;
|
|
242
|
+
}
|
|
243
|
+
this.setActiveItem(this.focusedItem);
|
|
244
|
+
if (shiftKey) {
|
|
245
|
+
this.selectionService.selectMultipleItems(this.focusedItem);
|
|
246
|
+
return;
|
|
247
|
+
}
|
|
248
|
+
if (this.focusedItem.selected) {
|
|
249
|
+
this.selectionService.deselectItem(this.focusedItem);
|
|
250
|
+
}
|
|
251
|
+
else {
|
|
252
|
+
this.selectionService.selectItem(this.focusedItem);
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
getVisibleItem(item, dir = 1) {
|
|
256
|
+
const itemIndex = this.visibleChildren.indexOf(item);
|
|
257
|
+
return this.visibleChildren[itemIndex + dir] || item;
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
//# sourceMappingURL=tree.navigation.js.map
|