-
Notifications
You must be signed in to change notification settings - Fork 2
fix(LoaderComponents): Add loader and new logic for components loader #373
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: next
Are you sure you want to change the base?
Changes from all commits
192f967
4d21ae7
9c0ba90
647292f
8cb5770
1f7c43e
ccbcedd
54c21cc
7d92c7e
8f5b5b8
1229663
82f6ee7
97b623e
f7ee5c6
f1bd489
c675fca
aa7e4de
b4a4670
9c6bb4f
7fb7e27
8f62f6a
896f8a2
6d4e63f
ccef0ac
843f9ca
5c31078
402846b
38575e0
fc03543
22cd805
e8d771e
fe7a726
dcf2350
96dbd10
a982f96
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,142 @@ | ||||||
| <script setup> | ||||||
| import StickyHeader from "@ogw_front/components/Viewer/ObjectTree/Base/StickyHeader.vue"; | ||||||
| import TreeRow from "@ogw_front/components/Viewer/ObjectTree/Base/TreeRow.vue"; | ||||||
| import { useTreeScroll } from "@ogw_front/composables/use_tree_scroll"; | ||||||
| import { useVirtualTree } from "@ogw_front/composables/use_virtual_tree"; | ||||||
|
|
||||||
| const { | ||||||
| items, | ||||||
| opened = [], | ||||||
| selected = [], | ||||||
| scrollTop = 0, | ||||||
| options = {}, | ||||||
| } = defineProps({ | ||||||
|
SpliiT marked this conversation as resolved.
|
||||||
| items: { type: Array, required: true }, | ||||||
| opened: { type: Array }, | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Même commentaire pour les autres |
||||||
| selected: { type: Array }, | ||||||
| scrollTop: { type: Number }, | ||||||
| options: { type: Object }, | ||||||
| }); | ||||||
|
|
||||||
| const emit = defineEmits(["update:opened", "update:selected", "click:item", "update:scrollTop"]); | ||||||
|
|
||||||
| const { | ||||||
| actualItemProps, | ||||||
| actualSelection, | ||||||
| displayItems, | ||||||
| toggleOpen, | ||||||
| toggleSelect, | ||||||
| isSelected, | ||||||
| getIndeterminate, | ||||||
| } = useVirtualTree( | ||||||
| computed(() => ({ | ||||||
| items, | ||||||
| opened, | ||||||
| selected, | ||||||
| ...options, | ||||||
| })), | ||||||
| emit, | ||||||
| ); | ||||||
|
|
||||||
| const { virtualScrollRef, stickyHeader, handleScroll } = useTreeScroll( | ||||||
| computed(() => ({ scrollTop })), | ||||||
| emit, | ||||||
| displayItems, | ||||||
| actualItemProps, | ||||||
| ); | ||||||
|
|
||||||
| function handleItemClick(item) { | ||||||
| if (item.isLeaf) { | ||||||
| toggleSelect(item.raw); | ||||||
| emit("click:item", item.raw); | ||||||
| } else { | ||||||
| toggleOpen(item.raw); | ||||||
| } | ||||||
| } | ||||||
| </script> | ||||||
|
|
||||||
| <template> | ||||||
| <div class="common-tree-view-wrapper"> | ||||||
| <StickyHeader | ||||||
| v-if="stickyHeader" | ||||||
| :item="stickyHeader" | ||||||
| :item-props="actualItemProps" | ||||||
| :selection="actualSelection" | ||||||
| :is-selected="isSelected" | ||||||
| :get-indeterminate="getIndeterminate" | ||||||
| @toggle-open="toggleOpen" | ||||||
| @toggle-select="toggleSelect" | ||||||
| > | ||||||
| <template #title="slotProps"> | ||||||
| <slot name="title" v-bind="slotProps" /> | ||||||
| </template> | ||||||
| </StickyHeader> | ||||||
|
|
||||||
| <v-virtual-scroll | ||||||
| ref="virtualScrollRef" | ||||||
| :items="displayItems" | ||||||
| :item-height="actualItemProps.height" | ||||||
| class="common-tree-view" | ||||||
| @scroll="handleScroll" | ||||||
| > | ||||||
| <template #default="{ item }"> | ||||||
| <v-list-item | ||||||
| :class="['tree-row-wrapper', { 'leaf-row': item.isLeaf }]" | ||||||
| class="pa-0" | ||||||
| @click="handleItemClick(item)" | ||||||
| > | ||||||
| <TreeRow | ||||||
| :item="item" | ||||||
| :item-props="actualItemProps" | ||||||
| :selection="actualSelection" | ||||||
| :is-selected="isSelected" | ||||||
| :get-indeterminate="getIndeterminate" | ||||||
| @toggle-open="toggleOpen" | ||||||
| @toggle-select="toggleSelect" | ||||||
| > | ||||||
| <template #title="slotProps"> | ||||||
| <slot name="title" v-bind="slotProps" /> | ||||||
| </template> | ||||||
| <template #append="slotProps"> | ||||||
| <slot name="append" v-bind="slotProps" /> | ||||||
| </template> | ||||||
| </TreeRow> | ||||||
| </v-list-item> | ||||||
| </template> | ||||||
| </v-virtual-scroll> | ||||||
| </div> | ||||||
| </template> | ||||||
|
|
||||||
| <style scoped> | ||||||
| .common-tree-view-wrapper { | ||||||
| height: 100%; | ||||||
| position: relative; | ||||||
| display: flex; | ||||||
| flex-direction: column; | ||||||
| min-height: 0; | ||||||
| } | ||||||
|
|
||||||
| .common-tree-view { | ||||||
| flex-grow: 1; | ||||||
| min-height: 0; | ||||||
| overflow-y: auto !important; | ||||||
| } | ||||||
|
|
||||||
| .tree-row-wrapper { | ||||||
| min-height: 44px !important; | ||||||
| cursor: pointer; | ||||||
| } | ||||||
|
|
||||||
| :deep(.v-list-item__content) { | ||||||
| padding: 0 !important; | ||||||
| display: block !important; | ||||||
| } | ||||||
|
|
||||||
| :deep(.v-list-item__overlay) { | ||||||
| display: none !important; | ||||||
| } | ||||||
|
|
||||||
| .v-list-item:hover { | ||||||
| background-color: rgba(0, 0, 0, 0.04); | ||||||
| } | ||||||
| </style> | ||||||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -1,37 +1,62 @@ | ||||||
| <script setup> | ||||||
| const { item, showTooltip } = defineProps({ | ||||||
| const { item, isLeaf = undefined } = defineProps({ | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| item: { type: Object, required: true }, | ||||||
| showTooltip: { type: Boolean, default: false }, | ||||||
| isLeaf: { type: Boolean }, | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| }); | ||||||
|
|
||||||
| const emit = defineEmits(["contextmenu"]); | ||||||
| const emit = defineEmits(["contextmenu", "mouseenter", "mouseleave"]); | ||||||
|
|
||||||
| const actualItem = computed(() => item.raw || item); | ||||||
|
|
||||||
| const tooltipDisabled = computed(() => { | ||||||
| if (isLeaf !== undefined) { | ||||||
| return !isLeaf; | ||||||
| } | ||||||
| return actualItem.value.children && actualItem.value.children.length > 0; | ||||||
| }); | ||||||
| </script> | ||||||
|
|
||||||
| <template> | ||||||
| <span | ||||||
| class="tree-item-label" | ||||||
| :class="{ 'inactive-item': actualItem.is_active === false }" | ||||||
| @contextmenu.prevent.stop="emit('contextmenu', $event)" | ||||||
| > | ||||||
| {{ actualItem.title }} | ||||||
| <v-tooltip v-if="showTooltip && actualItem.category" activator="parent" location="right"> | ||||||
| <div class="d-flex flex-column pa-1"> | ||||||
| <span class="text-caption"><strong>ID:</strong> {{ actualItem.id }}</span> | ||||||
| <span v-if="actualItem.title" class="text-caption" | ||||||
| ><strong>Name:</strong> {{ actualItem.title }}</span | ||||||
| <div class="tree-item-label-container w-100"> | ||||||
| <v-tooltip :disabled="tooltipDisabled" location="right" open-delay="400"> | ||||||
| <template #activator="{ props: tooltipProps }"> | ||||||
| <span | ||||||
| v-bind="tooltipProps" | ||||||
| class="tree-item-label" | ||||||
| :class="{ 'inactive-item': actualItem.is_active === false }" | ||||||
| @contextmenu.prevent.stop="emit('contextmenu', $event)" | ||||||
| @mouseenter="emit('mouseenter')" | ||||||
| @mouseleave="emit('mouseleave')" | ||||||
| > | ||||||
| <span class="text-caption font-italic border-t-sm d-flex align-center"> | ||||||
| <strong class="mr-1">Status:</strong> | ||||||
| {{ actualItem.is_active ? "Active" : "Inactive" }} | ||||||
| {{ actualItem.title }} | ||||||
| </span> | ||||||
| </template> | ||||||
|
|
||||||
| <div class="d-flex flex-column ga-1"> | ||||||
| <span class="text-caption"> | ||||||
| <strong class="text-white">ID:</strong> {{ actualItem.id }} | ||||||
| </span> | ||||||
| <span v-if="actualItem.title" class="text-caption"> | ||||||
| <strong class="text-white">Name:</strong> {{ actualItem.title }} | ||||||
| </span> | ||||||
| <span class="text-caption"> | ||||||
| <strong class="text-white">Status:</strong> | ||||||
| <i class="ml-1">{{ actualItem.is_active ? "Active" : "Inactive" }}</i> | ||||||
| </span> | ||||||
| </div> | ||||||
| </v-tooltip> | ||||||
| </span> | ||||||
| </div> | ||||||
| </template> | ||||||
|
|
||||||
| <style scoped> | ||||||
| .tree-item-label-container { | ||||||
| display: flex; | ||||||
| align-items: center; | ||||||
| min-width: 0; | ||||||
| height: 100%; | ||||||
| width: 100%; | ||||||
| } | ||||||
|
|
||||||
| .tree-item-label { | ||||||
| white-space: nowrap; | ||||||
| overflow: hidden; | ||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| <script setup> | ||
| import TreeRow from "@ogw_front/components/Viewer/ObjectTree/Base/TreeRow.vue"; | ||
|
|
||
| const { item, itemProps, selection, isSelected, getIndeterminate } = defineProps({ | ||
| item: { type: Object, required: true }, | ||
| itemProps: { type: Object, required: true }, | ||
| selection: { type: Object, required: true }, | ||
| isSelected: { type: Function, required: true }, | ||
| getIndeterminate: { type: Function, required: true }, | ||
| }); | ||
|
|
||
| defineEmits(["toggle-open", "toggle-select"]); | ||
| </script> | ||
|
|
||
| <template> | ||
| <div class="sticky-tree-header tree-row" @click="$emit('toggle-open', item.raw)"> | ||
| <TreeRow | ||
| :item="item" | ||
| :item-props="itemProps" | ||
| :selection="selection" | ||
| :is-selected="isSelected" | ||
| :get-indeterminate="getIndeterminate" | ||
| @toggle-open="$emit('toggle-open', $event)" | ||
| @toggle-select="$emit('toggle-select', $event)" | ||
| > | ||
| <template #title="slotProps"> | ||
| <slot name="title" v-bind="slotProps" /> | ||
| </template> | ||
| </TreeRow> | ||
| </div> | ||
| </template> | ||
|
|
||
| <style scoped> | ||
| .sticky-tree-header { | ||
| flex-shrink: 0; | ||
| background-color: transparent; | ||
| border-bottom: 2px solid rgba(0, 0, 0, 0.05); | ||
| box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05); | ||
| cursor: pointer; | ||
| z-index: 20; | ||
| } | ||
|
|
||
| .sticky-tree-header:hover { | ||
| background-color: rgba(0, 0, 0, 0.04); | ||
| } | ||
| </style> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,75 @@ | ||
| <script setup> | ||
| const { item, itemProps, selection, isSelected, getIndeterminate } = defineProps({ | ||
| item: { type: Object, required: true }, | ||
| itemProps: { type: Object, required: true }, | ||
| selection: { type: Object, required: true }, | ||
| isSelected: { type: Function, required: true }, | ||
| getIndeterminate: { type: Function, required: true }, | ||
| }); | ||
|
|
||
| defineEmits(["toggle-open", "toggle-select"]); | ||
|
|
||
| const INDENT_STEP = 16; | ||
| </script> | ||
|
|
||
| <template> | ||
| <div class="tree-row-content d-flex align-center px-4 ps-3 w-100"> | ||
| <div | ||
| v-if="item.depth > 0" | ||
| class="flex-shrink-0" | ||
| :style="{ width: `${item.depth * INDENT_STEP}px` }" | ||
| /> | ||
|
|
||
| <div class="d-flex align-center flex-shrink-0"> | ||
| <v-icon | ||
| v-if="!item.isLeaf" | ||
| :icon="item.isOpen ? 'mdi-menu-down' : 'mdi-menu-right'" | ||
| class="me-1" | ||
| color="black" | ||
| @click.stop="$emit('toggle-open', item.raw)" | ||
| /> | ||
| <div v-else class="icon-placeholder" /> | ||
|
|
||
| <v-checkbox-btn | ||
| v-if="selection.selectable" | ||
| :model-value="isSelected(item.raw)" | ||
| :indeterminate="getIndeterminate(item.raw)" | ||
| density="compact" | ||
| hide-details | ||
| color="black" | ||
| @click.stop="$emit('toggle-select', item.raw)" | ||
| @mousedown.stop | ||
| /> | ||
| </div> | ||
|
|
||
| <div class="tree-title flex-grow-1 overflow-hidden d-flex align-center ms-1 pt-1"> | ||
| <slot name="title" :item="item.raw" :is-leaf="item.isLeaf"> | ||
| <v-list-item-title :class="{ 'font-weight-bold': !item.isLeaf }" class="text-black"> | ||
| {{ item.raw[itemProps.title] || item.id }} | ||
| </v-list-item-title> | ||
| </slot> | ||
| </div> | ||
|
|
||
| <div class="ms-auto d-flex align-center"> | ||
| <slot name="append" :item="item.raw" /> | ||
| </div> | ||
| </div> | ||
| </template> | ||
|
|
||
| <style scoped> | ||
| .tree-row-content { | ||
| min-height: 44px; | ||
| } | ||
|
|
||
| .icon-placeholder { | ||
| width: 24px; | ||
| } | ||
|
|
||
| .tree-title { | ||
| min-height: 24px; | ||
| } | ||
|
|
||
| :deep(.v-checkbox-btn .v-selection-control__input .v-icon) { | ||
| color: #000 !important; | ||
| } | ||
| </style> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.