@onereach/ui-components 3.0.2-beta.2476.0 → 3.0.2-beta.2481.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/dist/bundled/v2/{OrCardCollection-a7706585.js → OrCardCollection-1b797c0b.js} +3 -3
- package/dist/bundled/v2/{OrConfirm-f14ac69d.js → OrConfirm-98d9a7b0.js} +1 -1
- package/dist/bundled/v2/{OrIconButton-d427d121.js → OrIconButton-50f3e359.js} +1 -1
- package/dist/bundled/v2/{OrInlineInput-916fd2b8.js → OrInlineInput-2395a4c6.js} +1 -1
- package/dist/bundled/v2/{OrInlineTextarea-f26824e4.js → OrInlineTextarea-5ea9f01a.js} +1 -1
- package/dist/bundled/v2/{OrInput-059a67b6.js → OrInput-900df60c.js} +1 -1
- package/dist/bundled/v2/{OrMenu-e1cf47b8.js → OrMenu-cbb0c2c8.js} +1 -1
- package/dist/bundled/v2/{OrModal-6cbeb15e.js → OrModal-e66519f4.js} +1 -1
- package/dist/bundled/v2/{OrNotification-8695c59e.js → OrNotification-8a219610.js} +1 -1
- package/dist/bundled/v2/{OrPagination-203a86f1.js → OrPagination-cf47d71c.js} +1 -1
- package/dist/bundled/v2/{OrPopover-06448d74.js → OrPopover-f3d58fff.js} +5 -1
- package/dist/bundled/v2/{OrSearch-a8d4cf95.js → OrSearch-9d11a3f1.js} +1 -1
- package/dist/bundled/v2/{OrSelect-0b9b27e9.js → OrSelect-0675a404.js} +4 -4
- package/dist/bundled/v2/{OrSidebar-0d6177e2.js → OrSidebar-0509e5f8.js} +1 -1
- package/dist/bundled/v2/{OrSidebarCollapseButton-730a948a.js → OrSidebarCollapseButton-3382ea38.js} +1 -1
- package/dist/bundled/v2/{OrTabs-85d7036a.js → OrTabs-10f7e668.js} +1 -1
- package/dist/bundled/v2/{OrTag-7879a9fa.js → OrTag-11c078db.js} +1 -1
- package/dist/bundled/v2/{OrTooltip-e34783de.js → OrTooltip-a2a90db8.js} +1 -1
- package/dist/bundled/v2/components/index.d.ts +0 -1
- package/dist/bundled/v2/components/index.js +19 -20
- package/dist/bundled/v2/components/or-card-collection-v3/index.js +7 -7
- package/dist/bundled/v2/components/or-confirm-v3/index.js +5 -5
- package/dist/bundled/v2/components/or-icon-button-v3/index.js +3 -3
- package/dist/bundled/v2/components/or-inline-input-v3/index.js +4 -4
- package/dist/bundled/v2/components/or-inline-textarea-v3/index.js +4 -4
- package/dist/bundled/v2/components/or-input-v3/index.js +4 -4
- package/dist/bundled/v2/components/or-menu-v3/index.js +2 -2
- package/dist/bundled/v2/components/or-modal-v3/index.js +4 -4
- package/dist/bundled/v2/components/or-notification-v3/index.js +4 -4
- package/dist/bundled/v2/components/or-pagination-v3/index.js +3 -3
- package/dist/bundled/v2/components/or-popover-v3/OrPopover.vue.d.ts +11 -0
- package/dist/bundled/v2/components/or-popover-v3/index.js +1 -1
- package/dist/bundled/v2/components/or-search-v3/index.js +5 -5
- package/dist/bundled/v2/components/or-select-v3/index.js +6 -6
- package/dist/bundled/v2/components/or-sidebar-v3/index.js +5 -5
- package/dist/bundled/v2/components/or-sidebar-v3/partials/index.js +4 -4
- package/dist/bundled/v2/components/or-sidebar-v3/partials/or-sidebar-collapse-button/index.js +4 -4
- package/dist/bundled/v2/components/or-tabs-v3/index.js +3 -3
- package/dist/bundled/v2/components/or-tag-v3/index.js +4 -4
- package/dist/bundled/v2/components/or-toast-v3/index.js +4 -4
- package/dist/bundled/v2/components/or-tooltip-v3/index.js +2 -2
- package/dist/bundled/v2/index.js +20 -21
- package/dist/bundled/v2/{types-79c4992b.js → types-8d0c1236.js} +1 -1
- package/dist/bundled/v3/{OrCardCollection.vue_vue_type_script_lang-dda3f349.js → OrCardCollection.vue_vue_type_script_lang-7dd04efe.js} +5 -5
- package/dist/bundled/v3/{OrConfirm.vue_vue_type_script_lang-f8a75cf0.js → OrConfirm.vue_vue_type_script_lang-9bfe8cdd.js} +2 -2
- package/dist/bundled/v3/{OrIconButton-b3e4997b.js → OrIconButton-55238a89.js} +1 -1
- package/dist/bundled/v3/{OrIconButton.vue_vue_type_script_lang-de03b47c.js → OrIconButton.vue_vue_type_script_lang-3aeb76ac.js} +1 -1
- package/dist/bundled/v3/{OrInlineInput.vue_vue_type_script_lang-3d76b4b8.js → OrInlineInput.vue_vue_type_script_lang-d1fd44af.js} +2 -2
- package/dist/bundled/v3/{OrInlineTextarea.vue_vue_type_script_lang-5b87295b.js → OrInlineTextarea.vue_vue_type_script_lang-a9e69aff.js} +2 -2
- package/dist/bundled/v3/{OrInput-0141dbad.js → OrInput-d23f9223.js} +1 -1
- package/dist/bundled/v3/{OrInput.vue_vue_type_script_lang-831761b8.js → OrInput.vue_vue_type_script_lang-fde0f78f.js} +2 -2
- package/dist/bundled/v3/{OrMenu-97b74f43.js → OrMenu-89afef68.js} +1 -1
- package/dist/bundled/v3/{OrMenu.vue_vue_type_script_lang-bff59dcb.js → OrMenu.vue_vue_type_script_lang-f6748a99.js} +2 -2
- package/dist/bundled/v3/{OrModal.vue_vue_type_script_lang-87032cf0.js → OrModal.vue_vue_type_script_lang-63930770.js} +2 -2
- package/dist/bundled/v3/{OrNotification.vue_vue_type_script_lang-10b7460c.js → OrNotification.vue_vue_type_script_lang-b96d5927.js} +2 -2
- package/dist/bundled/v3/{OrPagination.vue_vue_type_script_lang-8ec07f21.js → OrPagination.vue_vue_type_script_lang-7673a00e.js} +2 -2
- package/dist/bundled/v3/{OrPopover-f09c1ad2.js → OrPopover-40d53b57.js} +1 -1
- package/dist/bundled/v3/{OrPopover.vue_vue_type_script_lang-1caf28d1.js → OrPopover.vue_vue_type_script_lang-9bf2361c.js} +5 -1
- package/dist/bundled/v3/{OrSearch.vue_vue_type_script_lang-afb27ea5.js → OrSearch.vue_vue_type_script_lang-a298a8cc.js} +2 -2
- package/dist/bundled/v3/{OrSelect.vue_vue_type_script_lang-1574d816.js → OrSelect.vue_vue_type_script_lang-ee304265.js} +5 -5
- package/dist/bundled/v3/{OrSidebar.vue_vue_type_script_lang-bfaee185.js → OrSidebar.vue_vue_type_script_lang-123eab91.js} +1 -1
- package/dist/bundled/v3/{OrSidebarCollapseButton.vue_vue_type_script_lang-15f995a0.js → OrSidebarCollapseButton.vue_vue_type_script_lang-d6860d69.js} +2 -2
- package/dist/bundled/v3/{OrTabs.vue_vue_type_script_lang-4b181fc5.js → OrTabs.vue_vue_type_script_lang-ebd2a59d.js} +2 -2
- package/dist/bundled/v3/{OrTag.vue_vue_type_script_lang-429e76ad.js → OrTag.vue_vue_type_script_lang-0f6207e6.js} +2 -2
- package/dist/bundled/v3/{OrToastContainer-056470e4.js → OrToastContainer-a70f69eb.js} +1 -1
- package/dist/bundled/v3/{OrTooltip.vue_vue_type_script_lang-ce2158d0.js → OrTooltip.vue_vue_type_script_lang-27591090.js} +2 -2
- package/dist/bundled/v3/components/index.d.ts +0 -1
- package/dist/bundled/v3/components/index.js +23 -24
- package/dist/bundled/v3/components/or-card-collection-v3/index.js +11 -11
- package/dist/bundled/v3/components/or-confirm-v3/index.js +8 -8
- package/dist/bundled/v3/components/or-icon-button-v3/index.js +4 -4
- package/dist/bundled/v3/components/or-inline-input-v3/index.js +6 -6
- package/dist/bundled/v3/components/or-inline-textarea-v3/index.js +6 -6
- package/dist/bundled/v3/components/or-input-v3/index.js +6 -6
- package/dist/bundled/v3/components/or-menu-v3/index.js +3 -3
- package/dist/bundled/v3/components/or-modal-v3/index.js +6 -6
- package/dist/bundled/v3/components/or-notification-v3/index.js +6 -6
- package/dist/bundled/v3/components/or-pagination-v3/index.js +5 -5
- package/dist/bundled/v3/components/or-popover-v3/OrPopover.vue.d.ts +11 -0
- package/dist/bundled/v3/components/or-popover-v3/index.js +1 -1
- package/dist/bundled/v3/components/or-search-v3/index.js +8 -8
- package/dist/bundled/v3/components/or-select-v3/index.js +9 -9
- package/dist/bundled/v3/components/or-sidebar-v3/index.js +7 -7
- package/dist/bundled/v3/components/or-sidebar-v3/partials/index.js +6 -6
- package/dist/bundled/v3/components/or-sidebar-v3/partials/or-sidebar-collapse-button/index.js +6 -6
- package/dist/bundled/v3/components/or-tabs-v3/index.js +5 -5
- package/dist/bundled/v3/components/or-tag-v3/index.js +6 -6
- package/dist/bundled/v3/components/or-toast-v3/index.js +7 -7
- package/dist/bundled/v3/components/or-tooltip-v3/index.js +3 -3
- package/dist/bundled/v3/index.js +147 -173
- package/dist/bundled/v3/{types-f428a884.js → types-e9ab8869.js} +2 -2
- package/dist/esm/v2/{OrCardCollection-f4c27d14.js → OrCardCollection-fcc2bec5.js} +4 -4
- package/dist/esm/v2/{OrConfirm-216060ac.js → OrConfirm-7eee1481.js} +1 -1
- package/dist/esm/v2/{OrIconButton-5c4ef664.js → OrIconButton-ec2e21aa.js} +2 -2
- package/dist/esm/v2/{OrInlineInput-46e7f140.js → OrInlineInput-34f28593.js} +1 -1
- package/dist/esm/v2/{OrInlineTextarea-d016f618.js → OrInlineTextarea-07a2cdc1.js} +1 -1
- package/dist/esm/v2/{OrInput-9e6040e4.js → OrInput-a7903c0f.js} +1 -1
- package/dist/esm/v2/{OrMenu-fb119a7b.js → OrMenu-47b319a6.js} +1 -1
- package/dist/esm/v2/{OrModal-b759863f.js → OrModal-69791114.js} +1 -1
- package/dist/esm/v2/{OrNotification-f9e48250.js → OrNotification-5e98ac28.js} +1 -1
- package/dist/esm/v2/{OrPagination-dc27788c.js → OrPagination-4d330d4f.js} +2 -2
- package/dist/esm/v2/{OrPopover-aa9f4918.js → OrPopover-83c885d0.js} +5 -1
- package/dist/esm/v2/{OrSearch-da9725b4.js → OrSearch-5eba1989.js} +1 -1
- package/dist/esm/v2/{OrSelect-8307ad20.js → OrSelect-2d48ddee.js} +4 -4
- package/dist/esm/v2/{OrSidebar-5ca2144a.js → OrSidebar-6431f9f0.js} +1 -1
- package/dist/esm/v2/{OrSidebarCollapseButton-b8e678d4.js → OrSidebarCollapseButton-fbbac5f0.js} +1 -1
- package/dist/esm/v2/{OrTabs-32d46f77.js → OrTabs-f0e4db08.js} +2 -2
- package/dist/esm/v2/{OrTag-0153f01d.js → OrTag-335525e6.js} +1 -1
- package/dist/esm/v2/{OrTooltip-f5d1e4f0.js → OrTooltip-2c09dcaf.js} +1 -1
- package/dist/esm/v2/components/index.d.ts +0 -1
- package/dist/esm/v2/components/index.js +19 -20
- package/dist/esm/v2/components/or-card-collection-v3/index.js +7 -7
- package/dist/esm/v2/components/or-confirm-v3/index.js +5 -5
- package/dist/esm/v2/components/or-icon-button-v3/index.js +3 -3
- package/dist/esm/v2/components/or-inline-input-v3/index.js +4 -4
- package/dist/esm/v2/components/or-inline-textarea-v3/index.js +4 -4
- package/dist/esm/v2/components/or-input-v3/index.js +4 -4
- package/dist/esm/v2/components/or-menu-v3/index.js +2 -2
- package/dist/esm/v2/components/or-modal-v3/index.js +4 -4
- package/dist/esm/v2/components/or-notification-v3/index.js +4 -4
- package/dist/esm/v2/components/or-pagination-v3/index.js +3 -3
- package/dist/esm/v2/components/or-popover-v3/OrPopover.vue.d.ts +11 -0
- package/dist/esm/v2/components/or-popover-v3/index.js +1 -1
- package/dist/esm/v2/components/or-search-v3/index.js +5 -5
- package/dist/esm/v2/components/or-select-v3/index.js +6 -6
- package/dist/esm/v2/components/or-sidebar-v3/index.js +5 -5
- package/dist/esm/v2/components/or-sidebar-v3/partials/index.js +4 -4
- package/dist/esm/v2/components/or-sidebar-v3/partials/or-sidebar-collapse-button/index.js +4 -4
- package/dist/esm/v2/components/or-tabs-v3/index.js +3 -3
- package/dist/esm/v2/components/or-tag-v3/index.js +4 -4
- package/dist/esm/v2/components/or-toast-v3/index.js +4 -4
- package/dist/esm/v2/components/or-tooltip-v3/index.js +2 -2
- package/dist/esm/v2/index.js +19 -20
- package/dist/esm/v2/{types-1e607d9c.js → types-b1ac5808.js} +1 -1
- package/dist/esm/v3/{OrCardCollection-8bdbf9b7.js → OrCardCollection-fd019cf5.js} +4 -4
- package/dist/esm/v3/{OrConfirm-8067c5c4.js → OrConfirm-b74191d6.js} +1 -1
- package/dist/esm/v3/{OrIconButton-41ee266c.js → OrIconButton-e3f4d060.js} +2 -2
- package/dist/esm/v3/{OrInlineInput-0ebb39b5.js → OrInlineInput-c0e61e6b.js} +1 -1
- package/dist/esm/v3/{OrInlineTextarea-9fe81d0c.js → OrInlineTextarea-6d5e7ceb.js} +1 -1
- package/dist/esm/v3/{OrInput-18a1b41a.js → OrInput-f0748c95.js} +1 -1
- package/dist/esm/v3/{OrMenu-693b2bb8.js → OrMenu-053a9ab7.js} +1 -1
- package/dist/esm/v3/{OrModal-18b6a0d2.js → OrModal-7d4158d1.js} +1 -1
- package/dist/esm/v3/{OrNotification-b8a59ce3.js → OrNotification-9e00aa97.js} +1 -1
- package/dist/esm/v3/{OrPagination-9f8380a9.js → OrPagination-f2d104d9.js} +2 -2
- package/dist/esm/v3/{OrPopover-52250a03.js → OrPopover-3ac8f589.js} +5 -1
- package/dist/esm/v3/{OrSearch-b6a0f0e6.js → OrSearch-6673c583.js} +1 -1
- package/dist/esm/v3/{OrSelect-c3a50846.js → OrSelect-b9d45ab4.js} +5 -5
- package/dist/esm/v3/{OrSidebar-22253d76.js → OrSidebar-c4dfb35c.js} +1 -1
- package/dist/esm/v3/{OrSidebarCollapseButton-5154e452.js → OrSidebarCollapseButton-e4b2eedb.js} +1 -1
- package/dist/esm/v3/{OrTabs-6ee4b984.js → OrTabs-d9e2a07e.js} +2 -2
- package/dist/esm/v3/{OrTag-43ca7029.js → OrTag-1b49531d.js} +1 -1
- package/dist/esm/v3/{OrTooltip-02f07fa2.js → OrTooltip-d91128f4.js} +1 -1
- package/dist/esm/v3/components/index.d.ts +0 -1
- package/dist/esm/v3/components/index.js +19 -20
- package/dist/esm/v3/components/or-card-collection-v3/index.js +7 -7
- package/dist/esm/v3/components/or-confirm-v3/index.js +5 -5
- package/dist/esm/v3/components/or-icon-button-v3/index.js +3 -3
- package/dist/esm/v3/components/or-inline-input-v3/index.js +4 -4
- package/dist/esm/v3/components/or-inline-textarea-v3/index.js +4 -4
- package/dist/esm/v3/components/or-input-v3/index.js +4 -4
- package/dist/esm/v3/components/or-menu-v3/index.js +2 -2
- package/dist/esm/v3/components/or-modal-v3/index.js +4 -4
- package/dist/esm/v3/components/or-notification-v3/index.js +4 -4
- package/dist/esm/v3/components/or-pagination-v3/index.js +3 -3
- package/dist/esm/v3/components/or-popover-v3/OrPopover.vue.d.ts +11 -0
- package/dist/esm/v3/components/or-popover-v3/index.js +1 -1
- package/dist/esm/v3/components/or-search-v3/index.js +5 -5
- package/dist/esm/v3/components/or-select-v3/index.js +6 -6
- package/dist/esm/v3/components/or-sidebar-v3/index.js +5 -5
- package/dist/esm/v3/components/or-sidebar-v3/partials/index.js +4 -4
- package/dist/esm/v3/components/or-sidebar-v3/partials/or-sidebar-collapse-button/index.js +4 -4
- package/dist/esm/v3/components/or-tabs-v3/index.js +3 -3
- package/dist/esm/v3/components/or-tag-v3/index.js +4 -4
- package/dist/esm/v3/components/or-toast-v3/index.js +4 -4
- package/dist/esm/v3/components/or-tooltip-v3/index.js +2 -2
- package/dist/esm/v3/index.js +19 -20
- package/dist/esm/v3/{types-9ab3399d.js → types-af033805.js} +1 -1
- package/package.json +1 -1
- package/src/components/index.ts +0 -1
- package/src/components/or-popover-v3/OrPopover.vue +6 -0
- package/src/components/or-select-v3/OrSelect.vue +1 -1
- package/dist/bundled/v2/OrTree-b8e47647.js +0 -236
- package/dist/bundled/v2/components/or-tree-v3/OrTree.vue.d.ts +0 -47
- package/dist/bundled/v2/components/or-tree-v3/TreeNode.vue.d.ts +0 -82
- package/dist/bundled/v2/components/or-tree-v3/index.d.ts +0 -2
- package/dist/bundled/v2/components/or-tree-v3/index.js +0 -17
- package/dist/bundled/v2/components/or-tree-v3/styles.d.ts +0 -1
- package/dist/bundled/v2/components/or-tree-v3/types.d.ts +0 -10
- package/dist/bundled/v2/components/or-tree-v3/utils.d.ts +0 -5
- package/dist/bundled/v3/OrTree.vue_vue_type_script_lang-9a31b9b4.js +0 -146
- package/dist/bundled/v3/components/or-tree-v3/OrTree.vue.d.ts +0 -47
- package/dist/bundled/v3/components/or-tree-v3/TreeNode.vue.d.ts +0 -82
- package/dist/bundled/v3/components/or-tree-v3/index.d.ts +0 -2
- package/dist/bundled/v3/components/or-tree-v3/index.js +0 -16
- package/dist/bundled/v3/components/or-tree-v3/styles.d.ts +0 -1
- package/dist/bundled/v3/components/or-tree-v3/types.d.ts +0 -10
- package/dist/bundled/v3/components/or-tree-v3/utils.d.ts +0 -5
- package/dist/esm/v2/OrTree-32b2fede.js +0 -233
- package/dist/esm/v2/components/or-tree-v3/OrTree.vue.d.ts +0 -47
- package/dist/esm/v2/components/or-tree-v3/TreeNode.vue.d.ts +0 -82
- package/dist/esm/v2/components/or-tree-v3/index.d.ts +0 -2
- package/dist/esm/v2/components/or-tree-v3/index.js +0 -15
- package/dist/esm/v2/components/or-tree-v3/styles.d.ts +0 -1
- package/dist/esm/v2/components/or-tree-v3/types.d.ts +0 -10
- package/dist/esm/v2/components/or-tree-v3/utils.d.ts +0 -5
- package/dist/esm/v3/OrTree-bf625e80.js +0 -170
- package/dist/esm/v3/components/or-tree-v3/OrTree.vue.d.ts +0 -47
- package/dist/esm/v3/components/or-tree-v3/TreeNode.vue.d.ts +0 -82
- package/dist/esm/v3/components/or-tree-v3/index.d.ts +0 -2
- package/dist/esm/v3/components/or-tree-v3/index.js +0 -14
- package/dist/esm/v3/components/or-tree-v3/styles.d.ts +0 -1
- package/dist/esm/v3/components/or-tree-v3/types.d.ts +0 -10
- package/dist/esm/v3/components/or-tree-v3/utils.d.ts +0 -5
- package/src/components/or-tree-v3/OrTree.stories3.ts +0 -105
- package/src/components/or-tree-v3/OrTree.vue +0 -85
- package/src/components/or-tree-v3/TreeNode.vue +0 -72
- package/src/components/or-tree-v3/index.ts +0 -2
- package/src/components/or-tree-v3/styles.ts +0 -13
- package/src/components/or-tree-v3/types.ts +0 -12
- package/src/components/or-tree-v3/utils.ts +0 -31
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const TreeNodeRoot: string[];
|
|
@@ -1,170 +0,0 @@
|
|
|
1
|
-
import { defineComponent } from 'vue-demi';
|
|
2
|
-
import { s as script$2 } from './OrIconButton-41ee266c.js';
|
|
3
|
-
import { resolveComponent, openBlock, createElementBlock, normalizeClass, normalizeStyle, createBlock, createCommentVNode, renderSlot, normalizeProps, guardReactiveProps, createTextVNode, toDisplayString, Fragment, renderList, withCtx } from 'vue';
|
|
4
|
-
|
|
5
|
-
const getFlatTree = tree => {
|
|
6
|
-
const flatTree = [];
|
|
7
|
-
const nodeMetadataByKey = {};
|
|
8
|
-
const goDeeper = (treeNode, level, parentNodeKey) => {
|
|
9
|
-
flatTree.push(treeNode);
|
|
10
|
-
nodeMetadataByKey[treeNode.key] = {
|
|
11
|
-
level,
|
|
12
|
-
isExpanded: false,
|
|
13
|
-
parentNodeKey
|
|
14
|
-
};
|
|
15
|
-
if (treeNode.children) {
|
|
16
|
-
for (const child of treeNode.children) {
|
|
17
|
-
goDeeper(child, level + 1, treeNode.key);
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
};
|
|
21
|
-
for (const node of tree) {
|
|
22
|
-
goDeeper(node, 0, '');
|
|
23
|
-
}
|
|
24
|
-
return {
|
|
25
|
-
flatTree,
|
|
26
|
-
nodeMetadataByKey
|
|
27
|
-
};
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
const TreeNodeRoot = ['flex', 'items-center', 'gap-sm', 'pt-6', 'my-sm',
|
|
31
|
-
// Theme
|
|
32
|
-
'text-on-background', 'dark:text-on-background-dark', 'hover:bg-primary-opacity-0-08', 'dark:hover:bg-primary-opacity-0-08-dark'];
|
|
33
|
-
|
|
34
|
-
var script$1 = defineComponent({
|
|
35
|
-
components: {
|
|
36
|
-
OrIconButton: script$2
|
|
37
|
-
},
|
|
38
|
-
props: {
|
|
39
|
-
node: {
|
|
40
|
-
type: Object,
|
|
41
|
-
default: undefined
|
|
42
|
-
},
|
|
43
|
-
nodeKey: {
|
|
44
|
-
type: String,
|
|
45
|
-
default: ''
|
|
46
|
-
},
|
|
47
|
-
isExpanded: {
|
|
48
|
-
type: Boolean,
|
|
49
|
-
default: false
|
|
50
|
-
},
|
|
51
|
-
isLeaf: {
|
|
52
|
-
type: Boolean,
|
|
53
|
-
default: false
|
|
54
|
-
},
|
|
55
|
-
level: {
|
|
56
|
-
type: Number,
|
|
57
|
-
default: 0
|
|
58
|
-
}
|
|
59
|
-
},
|
|
60
|
-
emits: ['trigger-expand'],
|
|
61
|
-
setup() {
|
|
62
|
-
return {
|
|
63
|
-
rootClasses: TreeNodeRoot
|
|
64
|
-
};
|
|
65
|
-
},
|
|
66
|
-
computed: {
|
|
67
|
-
expandIcon() {
|
|
68
|
-
return this.isExpanded ? 'keyboard_arrow_down' : 'arrow_right';
|
|
69
|
-
},
|
|
70
|
-
styleCSS() {
|
|
71
|
-
return {
|
|
72
|
-
// 24px -- gap-sm + tooltip width
|
|
73
|
-
'padding-left': this.isLeaf && this.level === 0 ? '24px' : `${(this.isLeaf ? 24 : 0) + this.level * 10}px`
|
|
74
|
-
};
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
});
|
|
78
|
-
|
|
79
|
-
function render$1(_ctx, _cache, $props, $setup, $data, $options) {
|
|
80
|
-
const _component_or_icon_button = resolveComponent("or-icon-button");
|
|
81
|
-
return openBlock(), createElementBlock("div", {
|
|
82
|
-
class: normalizeClass(["tree-node", _ctx.rootClasses]),
|
|
83
|
-
style: normalizeStyle(_ctx.styleCSS)
|
|
84
|
-
}, [!_ctx.isLeaf ? (openBlock(), createBlock(_component_or_icon_button, {
|
|
85
|
-
key: 0,
|
|
86
|
-
icon: _ctx.expandIcon,
|
|
87
|
-
onClick: _cache[0] || (_cache[0] = $event => _ctx.$emit('trigger-expand', _ctx.nodeKey))
|
|
88
|
-
}, null, 8 /* PROPS */, ["icon"])) : createCommentVNode("v-if", true), renderSlot(_ctx.$slots, "default", normalizeProps(guardReactiveProps(_ctx.$props)), () => [createTextVNode(toDisplayString(_ctx.nodeKey), 1 /* TEXT */)])], 6 /* CLASS, STYLE */);
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
script$1.render = render$1;
|
|
92
|
-
script$1.__file = "src/components/or-tree-v3/TreeNode.vue";
|
|
93
|
-
|
|
94
|
-
var script = defineComponent({
|
|
95
|
-
components: {
|
|
96
|
-
TreeNode: script$1
|
|
97
|
-
},
|
|
98
|
-
props: {
|
|
99
|
-
initialData: {
|
|
100
|
-
type: Array,
|
|
101
|
-
default: () => []
|
|
102
|
-
},
|
|
103
|
-
identifierKey: {
|
|
104
|
-
type: String,
|
|
105
|
-
default: 'key'
|
|
106
|
-
}
|
|
107
|
-
},
|
|
108
|
-
data() {
|
|
109
|
-
return {
|
|
110
|
-
flatTree: [],
|
|
111
|
-
nodeMetadataByKey: {}
|
|
112
|
-
};
|
|
113
|
-
},
|
|
114
|
-
computed: {
|
|
115
|
-
visibleItems() {
|
|
116
|
-
return this.flatTree.filter(treeNode => {
|
|
117
|
-
return this.isNodeExpanded(treeNode.key);
|
|
118
|
-
});
|
|
119
|
-
}
|
|
120
|
-
},
|
|
121
|
-
mounted() {
|
|
122
|
-
const {
|
|
123
|
-
nodeMetadataByKey,
|
|
124
|
-
flatTree
|
|
125
|
-
} = getFlatTree(this.initialData);
|
|
126
|
-
this.flatTree = flatTree;
|
|
127
|
-
this.nodeMetadataByKey = nodeMetadataByKey;
|
|
128
|
-
},
|
|
129
|
-
methods: {
|
|
130
|
-
onTriggerExpand(key) {
|
|
131
|
-
this.nodeMetadataByKey[key].isExpanded = !this.nodeMetadataByKey[key].isExpanded;
|
|
132
|
-
},
|
|
133
|
-
isNodeExpanded(key) {
|
|
134
|
-
const {
|
|
135
|
-
parentNodeKey,
|
|
136
|
-
level
|
|
137
|
-
} = this.nodeMetadataByKey[key];
|
|
138
|
-
const parentMetadata = this.nodeMetadataByKey[parentNodeKey];
|
|
139
|
-
if (level === 0) return true;
|
|
140
|
-
if (!parentMetadata.isExpanded) return false;
|
|
141
|
-
return this.isNodeExpanded(parentNodeKey);
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
});
|
|
145
|
-
|
|
146
|
-
function render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
147
|
-
const _component_tree_node = resolveComponent("tree-node");
|
|
148
|
-
return openBlock(), createElementBlock("div", {
|
|
149
|
-
class: "or-tree",
|
|
150
|
-
onDrop: _cache[0] || (_cache[0] = (...args) => _ctx.onDrop && _ctx.onDrop(...args))
|
|
151
|
-
}, [(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.visibleItems, node => {
|
|
152
|
-
return openBlock(), createBlock(_component_tree_node, {
|
|
153
|
-
key: node[_ctx.identifierKey],
|
|
154
|
-
node: node,
|
|
155
|
-
"node-key": node[_ctx.identifierKey],
|
|
156
|
-
"is-expanded": _ctx.nodeMetadataByKey[node.key].isExpanded,
|
|
157
|
-
"is-leaf": !!node.isLeaf,
|
|
158
|
-
level: _ctx.nodeMetadataByKey[node.key].level,
|
|
159
|
-
onTriggerExpand: _ctx.onTriggerExpand
|
|
160
|
-
}, {
|
|
161
|
-
default: withCtx(props => [renderSlot(_ctx.$slots, "default", normalizeProps(guardReactiveProps(props)))]),
|
|
162
|
-
_: 2 /* DYNAMIC */
|
|
163
|
-
}, 1032 /* PROPS, DYNAMIC_SLOTS */, ["node", "node-key", "is-expanded", "is-leaf", "level", "onTriggerExpand"]);
|
|
164
|
-
}), 128 /* KEYED_FRAGMENT */))], 32 /* HYDRATE_EVENTS */);
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
script.render = render;
|
|
168
|
-
script.__file = "src/components/or-tree-v3/OrTree.vue";
|
|
169
|
-
|
|
170
|
-
export { script as s };
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { PropType } from 'vue-demi';
|
|
2
|
-
import { ITreeNode, ITreeNodeMetadata } from './types';
|
|
3
|
-
declare const _default: import("vue").ComponentOptions<import("vue").default, import("@vue/composition-api").ShallowUnwrapRef<import("@vue/composition-api").Data> & {
|
|
4
|
-
flatTree: ITreeNode[];
|
|
5
|
-
nodeMetadataByKey: Record<string, ITreeNodeMetadata>;
|
|
6
|
-
}, {
|
|
7
|
-
onTriggerExpand(key: string): void;
|
|
8
|
-
isNodeExpanded(key: string): boolean;
|
|
9
|
-
}, {
|
|
10
|
-
visibleItems(): ITreeNode[];
|
|
11
|
-
}, {
|
|
12
|
-
initialData: {
|
|
13
|
-
type: PropType<ITreeNode[]>;
|
|
14
|
-
default: () => never[];
|
|
15
|
-
};
|
|
16
|
-
identifierKey: {
|
|
17
|
-
type: StringConstructor;
|
|
18
|
-
default: string;
|
|
19
|
-
};
|
|
20
|
-
}, import("@vue/composition-api").ExtractPropTypes<{
|
|
21
|
-
initialData: {
|
|
22
|
-
type: PropType<ITreeNode[]>;
|
|
23
|
-
default: () => never[];
|
|
24
|
-
};
|
|
25
|
-
identifierKey: {
|
|
26
|
-
type: StringConstructor;
|
|
27
|
-
default: string;
|
|
28
|
-
};
|
|
29
|
-
}>> & Omit<import("vue").VueConstructor<import("vue").default>, never> & (new (...args: any[]) => import("@vue/composition-api").ComponentRenderProxy<{
|
|
30
|
-
initialData: ITreeNode[];
|
|
31
|
-
identifierKey: string;
|
|
32
|
-
} & {}, import("@vue/composition-api").ShallowUnwrapRef<import("@vue/composition-api").Data>, {
|
|
33
|
-
flatTree: ITreeNode[];
|
|
34
|
-
nodeMetadataByKey: Record<string, ITreeNodeMetadata>;
|
|
35
|
-
}, {
|
|
36
|
-
visibleItems(): ITreeNode[];
|
|
37
|
-
}, {
|
|
38
|
-
onTriggerExpand(key: string): void;
|
|
39
|
-
isNodeExpanded(key: string): boolean;
|
|
40
|
-
}, {}, {}, {}, {
|
|
41
|
-
initialData: ITreeNode[];
|
|
42
|
-
identifierKey: string;
|
|
43
|
-
} & {}, {
|
|
44
|
-
initialData: ITreeNode[];
|
|
45
|
-
identifierKey: string;
|
|
46
|
-
}, true>);
|
|
47
|
-
export default _default;
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
import { PropType } from 'vue-demi';
|
|
2
|
-
import { ITreeNode } from './types';
|
|
3
|
-
declare const _default: import("vue").ComponentOptions<import("vue").default, import("@vue/composition-api").ShallowUnwrapRef<{
|
|
4
|
-
rootClasses: string[];
|
|
5
|
-
}> & import("@vue/composition-api").Data, {}, {
|
|
6
|
-
expandIcon(): "keyboard_arrow_down" | "arrow_right";
|
|
7
|
-
styleCSS(): {
|
|
8
|
-
'padding-left': string;
|
|
9
|
-
};
|
|
10
|
-
}, {
|
|
11
|
-
node: {
|
|
12
|
-
type: PropType<ITreeNode>;
|
|
13
|
-
default: undefined;
|
|
14
|
-
};
|
|
15
|
-
nodeKey: {
|
|
16
|
-
type: StringConstructor;
|
|
17
|
-
default: string;
|
|
18
|
-
};
|
|
19
|
-
isExpanded: {
|
|
20
|
-
type: BooleanConstructor;
|
|
21
|
-
default: boolean;
|
|
22
|
-
};
|
|
23
|
-
isLeaf: {
|
|
24
|
-
type: BooleanConstructor;
|
|
25
|
-
default: boolean;
|
|
26
|
-
};
|
|
27
|
-
level: {
|
|
28
|
-
type: NumberConstructor;
|
|
29
|
-
default: number;
|
|
30
|
-
};
|
|
31
|
-
}, import("@vue/composition-api").ExtractPropTypes<{
|
|
32
|
-
node: {
|
|
33
|
-
type: PropType<ITreeNode>;
|
|
34
|
-
default: undefined;
|
|
35
|
-
};
|
|
36
|
-
nodeKey: {
|
|
37
|
-
type: StringConstructor;
|
|
38
|
-
default: string;
|
|
39
|
-
};
|
|
40
|
-
isExpanded: {
|
|
41
|
-
type: BooleanConstructor;
|
|
42
|
-
default: boolean;
|
|
43
|
-
};
|
|
44
|
-
isLeaf: {
|
|
45
|
-
type: BooleanConstructor;
|
|
46
|
-
default: boolean;
|
|
47
|
-
};
|
|
48
|
-
level: {
|
|
49
|
-
type: NumberConstructor;
|
|
50
|
-
default: number;
|
|
51
|
-
};
|
|
52
|
-
}>> & Omit<import("vue").VueConstructor<import("vue").default>, never> & (new (...args: any[]) => import("@vue/composition-api").ComponentRenderProxy<{
|
|
53
|
-
node: ITreeNode;
|
|
54
|
-
nodeKey: string;
|
|
55
|
-
isExpanded: boolean;
|
|
56
|
-
isLeaf: boolean;
|
|
57
|
-
level: number;
|
|
58
|
-
} & {} & {
|
|
59
|
-
[x: `on${Capitalize<string>}`]: ((...args: any[]) => any) | undefined;
|
|
60
|
-
}, import("@vue/composition-api").ShallowUnwrapRef<{
|
|
61
|
-
rootClasses: string[];
|
|
62
|
-
}>, import("@vue/composition-api").Data, {
|
|
63
|
-
expandIcon(): "keyboard_arrow_down" | "arrow_right";
|
|
64
|
-
styleCSS(): {
|
|
65
|
-
'padding-left': string;
|
|
66
|
-
};
|
|
67
|
-
}, {}, {}, {}, string[], {
|
|
68
|
-
node: ITreeNode;
|
|
69
|
-
nodeKey: string;
|
|
70
|
-
isExpanded: boolean;
|
|
71
|
-
isLeaf: boolean;
|
|
72
|
-
level: number;
|
|
73
|
-
} & {} & {
|
|
74
|
-
[x: `on${Capitalize<string>}`]: ((...args: any[]) => any) | undefined;
|
|
75
|
-
}, {
|
|
76
|
-
node: ITreeNode;
|
|
77
|
-
nodeKey: string;
|
|
78
|
-
isExpanded: boolean;
|
|
79
|
-
isLeaf: boolean;
|
|
80
|
-
level: number;
|
|
81
|
-
}, true>);
|
|
82
|
-
export default _default;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
export { s as OrTreeV3 } from '../../OrTree-bf625e80.js';
|
|
2
|
-
import 'vue-demi';
|
|
3
|
-
import '../../OrIconButton-41ee266c.js';
|
|
4
|
-
import '../../OrIcon-62793572.js';
|
|
5
|
-
import 'vue';
|
|
6
|
-
import '../../OrTooltip-02f07fa2.js';
|
|
7
|
-
import '@vueuse/core';
|
|
8
|
-
import '../../OrPopover-52250a03.js';
|
|
9
|
-
import '@floating-ui/dom';
|
|
10
|
-
import '../../useElevation-92fce12c.js';
|
|
11
|
-
import '../../useResponsive-a02e95b7.js';
|
|
12
|
-
import '../../OrBottomSheet-0f24ecae.js';
|
|
13
|
-
import '../../OrOverlay-7cf03aea.js';
|
|
14
|
-
import '../../OrTeleport.vue3-8099178c.js';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const TreeNodeRoot: string[];
|
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
import { action } from '@storybook/addon-actions';
|
|
2
|
-
import { StoryFn } from '@storybook/vue3';
|
|
3
|
-
import OrTree from './OrTree.vue';
|
|
4
|
-
|
|
5
|
-
const TREE_DATA = [
|
|
6
|
-
{
|
|
7
|
-
key: '0-0',
|
|
8
|
-
children: [
|
|
9
|
-
{
|
|
10
|
-
key: '0-0-0',
|
|
11
|
-
children: [
|
|
12
|
-
{
|
|
13
|
-
key: '0-0-0-0',
|
|
14
|
-
},
|
|
15
|
-
{
|
|
16
|
-
key: '0-0-0-1',
|
|
17
|
-
},
|
|
18
|
-
{
|
|
19
|
-
key: '0-0-0-2',
|
|
20
|
-
},
|
|
21
|
-
],
|
|
22
|
-
},
|
|
23
|
-
{
|
|
24
|
-
key: '0-0-1',
|
|
25
|
-
children: [
|
|
26
|
-
{
|
|
27
|
-
key: '0-0-1-0',
|
|
28
|
-
},
|
|
29
|
-
{
|
|
30
|
-
key: '0-0-1-1',
|
|
31
|
-
},
|
|
32
|
-
{
|
|
33
|
-
key: '0-0-1-2',
|
|
34
|
-
children: [
|
|
35
|
-
{
|
|
36
|
-
key: '0-0-1-2-0',
|
|
37
|
-
isLeaf: true,
|
|
38
|
-
},
|
|
39
|
-
],
|
|
40
|
-
},
|
|
41
|
-
],
|
|
42
|
-
},
|
|
43
|
-
{
|
|
44
|
-
key: '0-0-2',
|
|
45
|
-
},
|
|
46
|
-
],
|
|
47
|
-
},
|
|
48
|
-
{
|
|
49
|
-
key: '0-1',
|
|
50
|
-
children: [
|
|
51
|
-
{
|
|
52
|
-
key: '0-1-0-0',
|
|
53
|
-
},
|
|
54
|
-
{
|
|
55
|
-
key: '0-1-0-1',
|
|
56
|
-
},
|
|
57
|
-
{
|
|
58
|
-
key: '0-1-0-2',
|
|
59
|
-
},
|
|
60
|
-
],
|
|
61
|
-
},
|
|
62
|
-
{
|
|
63
|
-
key: '0-2',
|
|
64
|
-
isLeaf: true,
|
|
65
|
-
},
|
|
66
|
-
];
|
|
67
|
-
|
|
68
|
-
export default {
|
|
69
|
-
title: 'Components/Tree',
|
|
70
|
-
component: OrTree,
|
|
71
|
-
argTypes: {
|
|
72
|
-
},
|
|
73
|
-
};
|
|
74
|
-
|
|
75
|
-
const Template: StoryFn<typeof OrTree> = (args) => ({
|
|
76
|
-
components: {
|
|
77
|
-
OrTree,
|
|
78
|
-
},
|
|
79
|
-
|
|
80
|
-
data() {
|
|
81
|
-
return {
|
|
82
|
-
TREE_DATA,
|
|
83
|
-
};
|
|
84
|
-
},
|
|
85
|
-
|
|
86
|
-
setup() {
|
|
87
|
-
return {
|
|
88
|
-
args,
|
|
89
|
-
onUpdateState: action('update:state'),
|
|
90
|
-
};
|
|
91
|
-
},
|
|
92
|
-
|
|
93
|
-
template: `
|
|
94
|
-
<OrTree
|
|
95
|
-
v-bind="args"
|
|
96
|
-
/>
|
|
97
|
-
`,
|
|
98
|
-
});
|
|
99
|
-
|
|
100
|
-
export const Default = Template.bind({});
|
|
101
|
-
|
|
102
|
-
Default.args = {
|
|
103
|
-
// Props
|
|
104
|
-
initialData: TREE_DATA,
|
|
105
|
-
};
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div
|
|
3
|
-
class="or-tree"
|
|
4
|
-
@drop="onDrop"
|
|
5
|
-
>
|
|
6
|
-
<tree-node
|
|
7
|
-
v-for="node in visibleItems"
|
|
8
|
-
:key="node[identifierKey]"
|
|
9
|
-
:node="node"
|
|
10
|
-
:node-key="node[identifierKey]"
|
|
11
|
-
:is-expanded="nodeMetadataByKey[node.key].isExpanded"
|
|
12
|
-
:is-leaf="!!node.isLeaf"
|
|
13
|
-
:level="nodeMetadataByKey[node.key].level"
|
|
14
|
-
@trigger-expand="onTriggerExpand"
|
|
15
|
-
>
|
|
16
|
-
<template
|
|
17
|
-
v-slot:default="props"
|
|
18
|
-
>
|
|
19
|
-
<slot v-bind="props" />
|
|
20
|
-
</template>
|
|
21
|
-
</tree-node>
|
|
22
|
-
</div>
|
|
23
|
-
</template>
|
|
24
|
-
|
|
25
|
-
<script lang="ts">
|
|
26
|
-
import { defineComponent, PropType } from 'vue-demi';
|
|
27
|
-
import { ITreeNode, ITreeNodeMetadata } from './types';
|
|
28
|
-
import { getFlatTree } from './utils';
|
|
29
|
-
import TreeNode from './TreeNode.vue';
|
|
30
|
-
|
|
31
|
-
export default defineComponent({
|
|
32
|
-
components: {
|
|
33
|
-
TreeNode,
|
|
34
|
-
},
|
|
35
|
-
props: {
|
|
36
|
-
initialData: {
|
|
37
|
-
type: Array as PropType<ITreeNode[]>,
|
|
38
|
-
default: () => ([]),
|
|
39
|
-
},
|
|
40
|
-
identifierKey: {
|
|
41
|
-
type: String,
|
|
42
|
-
default: 'key',
|
|
43
|
-
},
|
|
44
|
-
},
|
|
45
|
-
|
|
46
|
-
data() {
|
|
47
|
-
return {
|
|
48
|
-
flatTree: [] as ITreeNode[],
|
|
49
|
-
nodeMetadataByKey: {} as Record<string, ITreeNodeMetadata>,
|
|
50
|
-
};
|
|
51
|
-
},
|
|
52
|
-
|
|
53
|
-
computed: {
|
|
54
|
-
visibleItems() {
|
|
55
|
-
return this.flatTree.filter(treeNode => {
|
|
56
|
-
return this.isNodeExpanded(treeNode.key);
|
|
57
|
-
});
|
|
58
|
-
},
|
|
59
|
-
},
|
|
60
|
-
|
|
61
|
-
mounted() {
|
|
62
|
-
const {
|
|
63
|
-
nodeMetadataByKey, flatTree,
|
|
64
|
-
} = getFlatTree(this.initialData);
|
|
65
|
-
this.flatTree = flatTree;
|
|
66
|
-
this.nodeMetadataByKey = nodeMetadataByKey;
|
|
67
|
-
},
|
|
68
|
-
|
|
69
|
-
methods: {
|
|
70
|
-
onTriggerExpand(key: string) {
|
|
71
|
-
this.nodeMetadataByKey[key].isExpanded = !this.nodeMetadataByKey[key].isExpanded;
|
|
72
|
-
},
|
|
73
|
-
|
|
74
|
-
isNodeExpanded(key: string): boolean {
|
|
75
|
-
const { parentNodeKey, level } = this.nodeMetadataByKey[key];
|
|
76
|
-
const parentMetadata = this.nodeMetadataByKey[parentNodeKey];
|
|
77
|
-
|
|
78
|
-
if (level === 0) return true;
|
|
79
|
-
if (!parentMetadata.isExpanded) return false;
|
|
80
|
-
|
|
81
|
-
return this.isNodeExpanded(parentNodeKey);
|
|
82
|
-
},
|
|
83
|
-
},
|
|
84
|
-
});
|
|
85
|
-
</script>
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div
|
|
3
|
-
class="tree-node"
|
|
4
|
-
:class="rootClasses"
|
|
5
|
-
:style="styleCSS"
|
|
6
|
-
>
|
|
7
|
-
<or-icon-button
|
|
8
|
-
v-if="!isLeaf"
|
|
9
|
-
:icon="expandIcon"
|
|
10
|
-
@click="$emit('trigger-expand', nodeKey)"
|
|
11
|
-
/>
|
|
12
|
-
|
|
13
|
-
<slot v-bind="$props">
|
|
14
|
-
{{ nodeKey }}
|
|
15
|
-
</slot>
|
|
16
|
-
</div>
|
|
17
|
-
</template>
|
|
18
|
-
|
|
19
|
-
<script lang="ts">
|
|
20
|
-
import { defineComponent, PropType } from 'vue-demi';
|
|
21
|
-
import { OrIconButtonV3 as OrIconButton } from '../or-icon-button-v3';
|
|
22
|
-
import { TreeNodeRoot } from './styles';
|
|
23
|
-
import { ITreeNode } from './types';
|
|
24
|
-
|
|
25
|
-
export default defineComponent({
|
|
26
|
-
components: {
|
|
27
|
-
OrIconButton,
|
|
28
|
-
},
|
|
29
|
-
props: {
|
|
30
|
-
node: {
|
|
31
|
-
type: Object as PropType<ITreeNode>,
|
|
32
|
-
default: undefined,
|
|
33
|
-
},
|
|
34
|
-
nodeKey: {
|
|
35
|
-
type: String,
|
|
36
|
-
default: '',
|
|
37
|
-
},
|
|
38
|
-
isExpanded: {
|
|
39
|
-
type: Boolean,
|
|
40
|
-
default: false,
|
|
41
|
-
},
|
|
42
|
-
isLeaf: {
|
|
43
|
-
type: Boolean,
|
|
44
|
-
default: false,
|
|
45
|
-
},
|
|
46
|
-
level: {
|
|
47
|
-
type: Number,
|
|
48
|
-
default: 0,
|
|
49
|
-
},
|
|
50
|
-
},
|
|
51
|
-
emits: ['trigger-expand'],
|
|
52
|
-
|
|
53
|
-
setup() {
|
|
54
|
-
return {
|
|
55
|
-
rootClasses: TreeNodeRoot,
|
|
56
|
-
};
|
|
57
|
-
},
|
|
58
|
-
|
|
59
|
-
computed: {
|
|
60
|
-
expandIcon() {
|
|
61
|
-
return this.isExpanded ? 'keyboard_arrow_down' : 'arrow_right';
|
|
62
|
-
},
|
|
63
|
-
|
|
64
|
-
styleCSS() {
|
|
65
|
-
return {
|
|
66
|
-
// 24px -- gap-sm + tooltip width
|
|
67
|
-
'padding-left': (this.isLeaf && this.level === 0) ? '24px' : `${(this.isLeaf ? 24 : 0) + (this.level * 10)}px`,
|
|
68
|
-
};
|
|
69
|
-
},
|
|
70
|
-
},
|
|
71
|
-
});
|
|
72
|
-
</script>
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export const TreeNodeRoot: string[] = [
|
|
2
|
-
'flex',
|
|
3
|
-
'items-center',
|
|
4
|
-
'gap-sm',
|
|
5
|
-
'pt-6',
|
|
6
|
-
'my-sm',
|
|
7
|
-
|
|
8
|
-
// Theme
|
|
9
|
-
'text-on-background',
|
|
10
|
-
'dark:text-on-background-dark',
|
|
11
|
-
'hover:bg-primary-opacity-0-08',
|
|
12
|
-
'dark:hover:bg-primary-opacity-0-08-dark',
|
|
13
|
-
];
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { ITreeNode, ITreeNodeMetadata } from './types';
|
|
2
|
-
|
|
3
|
-
export const getFlatTree = (tree: ITreeNode[]) => {
|
|
4
|
-
const flatTree: ITreeNode[] = [];
|
|
5
|
-
const nodeMetadataByKey: Record<string, ITreeNodeMetadata> = {};
|
|
6
|
-
|
|
7
|
-
const goDeeper = (treeNode: ITreeNode, level: number, parentNodeKey: string) => {
|
|
8
|
-
flatTree.push(treeNode);
|
|
9
|
-
nodeMetadataByKey[treeNode.key] = {
|
|
10
|
-
level,
|
|
11
|
-
isExpanded: false,
|
|
12
|
-
parentNodeKey,
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
if (treeNode.children) {
|
|
16
|
-
for (const child of treeNode.children) {
|
|
17
|
-
goDeeper(child, level + 1, treeNode.key);
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
}
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
for (const node of tree) {
|
|
24
|
-
goDeeper(node, 0, '');
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
return {
|
|
28
|
-
flatTree,
|
|
29
|
-
nodeMetadataByKey,
|
|
30
|
-
};
|
|
31
|
-
};
|