Tracking de l'application VApp (IHM du jeu)

This commit is contained in:
2025-05-11 18:04:12 +02:00
commit 89e9db9b62
17763 changed files with 3718499 additions and 0 deletions

View File

@ -0,0 +1,350 @@
// @ts-nocheck
/* eslint-disable */
// Styles
import "./VTreeview.css";
// Types
// Components
import VTreeviewNode, { VTreeviewNodeProps } from "./VTreeviewNode.mjs"; // Mixins
import Themeable from "../../mixins/themeable.mjs";
import { provide as RegistrableProvide } from "../../mixins/registrable.mjs"; // Utils
import { arrayDiff, deepEqual, getObjectValueByPath } from "../../util/helpers.mjs";
import mixins from "../../util/mixins.mjs";
import { consoleWarn } from "../../util/console.mjs";
import { filterTreeItems, filterTreeItem } from "./util/filterTreeItems.mjs";
export default mixins(RegistrableProvide('treeview'), Themeable
/* @vue/component */).extend({
name: 'v-treeview',
provide() {
return {
treeview: this
};
},
props: {
active: {
type: Array,
default: () => []
},
dense: Boolean,
disabled: Boolean,
filter: Function,
hoverable: Boolean,
items: {
type: Array,
default: () => []
},
multipleActive: Boolean,
open: {
type: Array,
default: () => []
},
openAll: Boolean,
returnObject: {
type: Boolean,
default: false // TODO: Should be true in next major
},
search: String,
value: {
type: Array,
default: () => []
},
...VTreeviewNodeProps
},
data: () => ({
level: -1,
activeCache: new Set(),
nodes: {},
openCache: new Set(),
selectedCache: new Set()
}),
computed: {
excludedItems() {
const excluded = new Set();
if (!this.search) return excluded;
for (let i = 0; i < this.items.length; i++) {
filterTreeItems(this.filter || filterTreeItem, this.items[i], this.search, this.itemKey, this.itemText, this.itemChildren, excluded);
}
return excluded;
}
},
watch: {
items: {
handler() {
const oldKeys = Object.keys(this.nodes).map(k => getObjectValueByPath(this.nodes[k].item, this.itemKey));
const newKeys = this.getKeys(this.items);
const diff = arrayDiff(newKeys, oldKeys);
// We only want to do stuff if items have changed
if (!diff.length && newKeys.length < oldKeys.length) return;
// If nodes are removed we need to clear them from this.nodes
diff.forEach(k => delete this.nodes[k]);
const oldSelectedCache = [...this.selectedCache];
this.selectedCache = new Set();
this.activeCache = new Set();
this.openCache = new Set();
this.buildTree(this.items);
// Only emit selected if selection has changed
// as a result of items changing. This fixes a
// potential double emit when selecting a node
// with dynamic children
if (!deepEqual(oldSelectedCache, [...this.selectedCache])) this.emitSelected();
},
deep: true
},
active(value) {
this.handleNodeCacheWatcher(value, this.activeCache, this.updateActive, this.emitActive);
},
value(value) {
this.handleNodeCacheWatcher(value, this.selectedCache, this.updateSelected, this.emitSelected);
},
open(value) {
this.handleNodeCacheWatcher(value, this.openCache, this.updateOpen, this.emitOpen);
}
},
created() {
const getValue = key => this.returnObject ? getObjectValueByPath(key, this.itemKey) : key;
this.buildTree(this.items);
for (const value of this.value.map(getValue)) {
this.updateSelected(value, true, true);
}
for (const active of this.active.map(getValue)) {
this.updateActive(active, true);
}
},
mounted() {
// Save the developer from themselves
if (this.$slots.prepend || this.$slots.append) {
consoleWarn('The prepend and append slots require a slot-scope attribute', this);
}
if (this.openAll) {
this.updateAll(true);
} else {
this.open.forEach(key => this.updateOpen(this.returnObject ? getObjectValueByPath(key, this.itemKey) : key, true));
this.emitOpen();
}
},
methods: {
/** @public */
updateAll(value) {
Object.keys(this.nodes).forEach(key => this.updateOpen(getObjectValueByPath(this.nodes[key].item, this.itemKey), value));
this.emitOpen();
},
getKeys(items) {
let keys = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
for (let i = 0; i < items.length; i++) {
const key = getObjectValueByPath(items[i], this.itemKey);
keys.push(key);
const children = getObjectValueByPath(items[i], this.itemChildren);
if (children) {
keys.push(...this.getKeys(children));
}
}
return keys;
},
buildTree(items) {
let parent = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
for (let i = 0; i < items.length; i++) {
const item = items[i];
const key = getObjectValueByPath(item, this.itemKey);
const children = getObjectValueByPath(item, this.itemChildren) ?? [];
const oldNode = this.nodes.hasOwnProperty(key) ? this.nodes[key] : {
isSelected: false,
isIndeterminate: false,
isActive: false,
isOpen: false,
vnode: null
};
const node = {
vnode: oldNode.vnode,
parent,
children: children.map(c => getObjectValueByPath(c, this.itemKey)),
item
};
this.buildTree(children, key);
// This fixed bug with dynamic children resetting selected parent state
if (this.selectionType !== 'independent' && parent !== null && !this.nodes.hasOwnProperty(key) && this.nodes.hasOwnProperty(parent)) {
node.isSelected = this.nodes[parent].isSelected;
} else {
node.isSelected = oldNode.isSelected;
node.isIndeterminate = oldNode.isIndeterminate;
}
node.isActive = oldNode.isActive;
node.isOpen = oldNode.isOpen;
this.nodes[key] = node;
if (children.length && this.selectionType !== 'independent') {
const {
isSelected,
isIndeterminate
} = this.calculateState(key, this.nodes);
node.isSelected = isSelected;
node.isIndeterminate = isIndeterminate;
}
// Don't forget to rebuild cache
if (this.nodes[key].isSelected && (this.selectionType === 'independent' || node.children.length === 0)) this.selectedCache.add(key);
if (this.nodes[key].isActive) this.activeCache.add(key);
if (this.nodes[key].isOpen) this.openCache.add(key);
this.updateVnodeState(key);
}
},
calculateState(node, state) {
const children = state[node].children;
const counts = children.reduce((counts, child) => {
counts[0] += +Boolean(state[child].isSelected);
counts[1] += +Boolean(state[child].isIndeterminate);
return counts;
}, [0, 0]);
const isSelected = !!children.length && counts[0] === children.length;
const isIndeterminate = !isSelected && (counts[0] > 0 || counts[1] > 0);
return {
isSelected,
isIndeterminate
};
},
emitOpen() {
this.emitNodeCache('update:open', this.openCache);
},
emitSelected() {
this.emitNodeCache('input', this.selectedCache);
},
emitActive() {
this.emitNodeCache('update:active', this.activeCache);
},
emitNodeCache(event, cache) {
this.$emit(event, this.returnObject ? [...cache].map(key => this.nodes[key].item) : [...cache]);
},
handleNodeCacheWatcher(value, cache, updateFn, emitFn) {
value = this.returnObject ? value.map(v => getObjectValueByPath(v, this.itemKey)) : value;
const old = [...cache];
if (deepEqual(old, value)) return;
old.forEach(key => updateFn(key, false));
value.forEach(key => updateFn(key, true));
emitFn();
},
getDescendants(key) {
let descendants = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
const children = this.nodes[key].children;
descendants.push(...children);
for (let i = 0; i < children.length; i++) {
descendants = this.getDescendants(children[i], descendants);
}
return descendants;
},
getParents(key) {
let parent = this.nodes[key].parent;
const parents = [];
while (parent !== null) {
parents.push(parent);
parent = this.nodes[parent].parent;
}
return parents;
},
register(node) {
const key = getObjectValueByPath(node.item, this.itemKey);
this.nodes[key].vnode = node;
this.updateVnodeState(key);
},
unregister(node) {
const key = getObjectValueByPath(node.item, this.itemKey);
if (this.nodes[key]) this.nodes[key].vnode = null;
},
isParent(key) {
return this.nodes[key].children && this.nodes[key].children.length;
},
updateActive(key, isActive) {
if (!this.nodes.hasOwnProperty(key)) return;
if (!this.multipleActive) {
this.activeCache.forEach(active => {
this.nodes[active].isActive = false;
this.updateVnodeState(active);
this.activeCache.delete(active);
});
}
const node = this.nodes[key];
if (!node) return;
if (isActive) this.activeCache.add(key);else this.activeCache.delete(key);
node.isActive = isActive;
this.updateVnodeState(key);
},
updateSelected(key, isSelected) {
let isForced = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
if (!this.nodes.hasOwnProperty(key)) return;
const changed = new Map();
if (this.selectionType !== 'independent') {
for (const descendant of this.getDescendants(key)) {
if (!getObjectValueByPath(this.nodes[descendant].item, this.itemDisabled) || isForced) {
this.nodes[descendant].isSelected = isSelected;
this.nodes[descendant].isIndeterminate = false;
changed.set(descendant, isSelected);
}
}
const calculated = this.calculateState(key, this.nodes);
this.nodes[key].isSelected = isSelected;
this.nodes[key].isIndeterminate = calculated.isIndeterminate;
changed.set(key, isSelected);
for (const parent of this.getParents(key)) {
const calculated = this.calculateState(parent, this.nodes);
this.nodes[parent].isSelected = calculated.isSelected;
this.nodes[parent].isIndeterminate = calculated.isIndeterminate;
changed.set(parent, calculated.isSelected);
}
} else {
this.nodes[key].isSelected = isSelected;
this.nodes[key].isIndeterminate = false;
changed.set(key, isSelected);
}
for (const [key, value] of changed.entries()) {
this.updateVnodeState(key);
if (this.selectionType === 'leaf' && this.isParent(key)) continue;
value === true ? this.selectedCache.add(key) : this.selectedCache.delete(key);
}
},
updateOpen(key, isOpen) {
if (!this.nodes.hasOwnProperty(key)) return;
const node = this.nodes[key];
const children = getObjectValueByPath(node.item, this.itemChildren);
if (children && !children.length && node.vnode && !node.vnode.hasLoaded) {
node.vnode.checkChildren().then(() => this.updateOpen(key, isOpen));
} else if (children && children.length) {
node.isOpen = isOpen;
node.isOpen ? this.openCache.add(key) : this.openCache.delete(key);
this.updateVnodeState(key);
}
},
updateVnodeState(key) {
const node = this.nodes[key];
if (node && node.vnode) {
node.vnode.isSelected = node.isSelected;
node.vnode.isIndeterminate = node.isIndeterminate;
node.vnode.isActive = node.isActive;
node.vnode.isOpen = node.isOpen;
}
},
isExcluded(key) {
return !!this.search && this.excludedItems.has(key);
}
},
render(h) {
const children = this.items.length ? this.items.filter(item => {
return !this.isExcluded(getObjectValueByPath(item, this.itemKey));
}).map(item => {
const genChild = VTreeviewNode.options.methods.genChild.bind(this);
return genChild(item, this.disabled || getObjectValueByPath(item, this.itemDisabled));
})
/* istanbul ignore next */ : this.$slots.default; // TODO: remove type annotation with TS 3.2
return h('div', {
staticClass: 'v-treeview',
class: {
'v-treeview--hoverable': this.hoverable,
'v-treeview--dense': this.dense,
...this.themeClasses
}
}, children);
}
});
//# sourceMappingURL=VTreeview.mjs.map

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,128 @@
@import './_variables.scss'
@import './_mixins.sass'
// Theme
+theme(v-treeview) using ($material)
color: map-deep-get($material, 'text', 'primary')
&--hoverable .v-treeview-node__root,
.v-treeview-node--click > .v-treeview-node__root
+states($material)
.v-treeview-node__root.v-treeview-node--active
+active-states($material)
.v-treeview-node--disabled
> .v-treeview-node__root > .v-treeview-node__content
color: map-deep-get($material, 'text', 'disabled') !important
.v-treeview-node
&.v-treeview-node--shaped
+treeview-shaped($treeview-node-height, $treeview-node-shaped-margin)
&.v-treeview-node--rounded
+treeview-rounded($treeview-node-height, $treeview-node-shaped-margin)
&--click
> .v-treeview-node__root,
> .v-treeview-node__root > .v-treeview-node__content > *
cursor: pointer
user-select: none
&.v-treeview-node--active .v-treeview-node__content .v-icon
color: inherit
.v-treeview-node__root
display: flex
align-items: center
min-height: $treeview-node-height
padding-left: $treeview-node-padding
padding-right: $treeview-node-padding
position: relative
&::before
background-color: currentColor
bottom: 0
content: ''
left: 0
opacity: 0
pointer-events: none
position: absolute
right: 0
top: 0
transition: $primary-transition
// Fix for IE11 where min-height does not work with
// align-items: center in flex containers
// https://github.com/philipwalton/flexbugs/issues/231
&::after
content: ''
font-size: 0
min-height: inherit
.v-treeview-node__children
transition: all $treeview-transition
.v-treeview--dense
.v-treeview-node__root
min-height: $treeview-node-height-dense
&.v-treeview-node--shaped
+treeview-shaped($treeview-node-height-dense, $treeview-node-shaped-margin)
&.v-treeview-node--rounded
+treeview-rounded($treeview-node-height-dense, $treeview-node-shaped-margin)
.v-treeview-node__checkbox
width: $treeview-node-level-width
user-select: none
margin-inline-start: $treeview-node-margin
.v-treeview-node__toggle
width: $treeview-node-level-width
user-select: none
&--loading
animation: progress-circular-rotate 1s linear infinite
+ltr()
transform: rotate(-90deg)
&--open
transform: none
+rtl()
transform: rotate(90deg)
&--open
transform: none
.v-treeview-node__prepend
min-width: $treeview-node-level-width
margin-inline-end: $treeview-node-margin
.v-treeview-node__append
min-width: $treeview-node-level-width
margin-inline-start: $treeview-node-margin
.v-treeview-node__level
width: $treeview-node-level-width
.v-treeview-node__label
flex: 1
font-size: $treeview-label-font-size
overflow: hidden
text-overflow: ellipsis
white-space: nowrap
.v-treeview-node__content
align-items: center
display: flex
flex-basis: 0%
flex-grow: 1
flex-shrink: 0
min-width: 0
margin-inline-start: $treeview-node-margin
// TODO: this is temporary fix for d-flex * shenanigans
.v-btn
flex-grow: 0 !important
flex-shrink: 1 !important

View File

@ -0,0 +1,321 @@
// @ts-nocheck
/* eslint-disable */
// Components
import { VExpandTransition } from "../transitions/index.mjs";
import { VIcon } from "../VIcon/index.mjs";
// Mixins
import { inject as RegistrableInject } from "../../mixins/registrable.mjs";
import Colorable from "../../mixins/colorable.mjs"; // Utils
import mixins from "../../util/mixins.mjs";
import { getObjectValueByPath, createRange } from "../../util/helpers.mjs"; // Types
const baseMixins = mixins(Colorable, RegistrableInject('treeview'));
export const VTreeviewNodeProps = {
activatable: Boolean,
activeClass: {
type: String,
default: 'v-treeview-node--active'
},
color: {
type: String,
default: 'primary'
},
disablePerNode: Boolean,
expandIcon: {
type: String,
default: '$subgroup'
},
indeterminateIcon: {
type: String,
default: '$checkboxIndeterminate'
},
itemChildren: {
type: String,
default: 'children'
},
itemDisabled: {
type: String,
default: 'disabled'
},
itemKey: {
type: String,
default: 'id'
},
itemText: {
type: String,
default: 'name'
},
loadChildren: Function,
loadingIcon: {
type: String,
default: '$loading'
},
offIcon: {
type: String,
default: '$checkboxOff'
},
onIcon: {
type: String,
default: '$checkboxOn'
},
openOnClick: Boolean,
rounded: Boolean,
selectable: Boolean,
selectedColor: {
type: String,
default: 'accent'
},
shaped: Boolean,
transition: Boolean,
selectionType: {
type: String,
default: 'leaf',
validator: v => ['leaf', 'independent'].includes(v)
}
};
/* @vue/component */
const VTreeviewNode = baseMixins.extend().extend({
name: 'v-treeview-node',
inject: {
treeview: {
default: null
}
},
props: {
level: Number,
item: {
type: Object,
default: () => null
},
parentIsDisabled: Boolean,
...VTreeviewNodeProps
},
data: () => ({
hasLoaded: false,
isActive: false,
// Node is selected (row)
isIndeterminate: false,
// Node has at least one selected child
isLoading: false,
isOpen: false,
// Node is open/expanded
isSelected: false // Node is selected (checkbox)
}),
computed: {
disabled() {
return getObjectValueByPath(this.item, this.itemDisabled) || !this.disablePerNode && this.parentIsDisabled && this.selectionType === 'leaf';
},
key() {
return getObjectValueByPath(this.item, this.itemKey);
},
children() {
const children = getObjectValueByPath(this.item, this.itemChildren);
return children && children.filter(child => !this.treeview.isExcluded(getObjectValueByPath(child, this.itemKey)));
},
text() {
return getObjectValueByPath(this.item, this.itemText);
},
scopedProps() {
return {
item: this.item,
leaf: !this.children,
selected: this.isSelected,
indeterminate: this.isIndeterminate,
active: this.isActive,
open: this.isOpen
};
},
computedIcon() {
if (this.isIndeterminate) return this.indeterminateIcon;else if (this.isSelected) return this.onIcon;else return this.offIcon;
},
hasChildren() {
return !!this.children && (!!this.children.length || !!this.loadChildren);
}
},
created() {
this.treeview.register(this);
},
beforeDestroy() {
this.treeview.unregister(this);
},
methods: {
checkChildren() {
return new Promise(resolve => {
// TODO: Potential issue with always trying
// to load children if response is empty?
if (!this.children || this.children.length || !this.loadChildren || this.hasLoaded) return resolve();
this.isLoading = true;
resolve(this.loadChildren(this.item));
}).then(() => {
this.isLoading = false;
this.hasLoaded = true;
});
},
open() {
this.isOpen = !this.isOpen;
this.treeview.updateOpen(this.key, this.isOpen);
this.treeview.emitOpen();
},
genLabel() {
const children = [];
if (this.$scopedSlots.label) children.push(this.$scopedSlots.label(this.scopedProps));else children.push(this.text);
return this.$createElement('div', {
slot: 'label',
staticClass: 'v-treeview-node__label'
}, children);
},
genPrependSlot() {
if (!this.$scopedSlots.prepend) return null;
return this.$createElement('div', {
staticClass: 'v-treeview-node__prepend'
}, this.$scopedSlots.prepend(this.scopedProps));
},
genAppendSlot() {
if (!this.$scopedSlots.append) return null;
return this.$createElement('div', {
staticClass: 'v-treeview-node__append'
}, this.$scopedSlots.append(this.scopedProps));
},
genContent() {
const children = [this.genPrependSlot(), this.genLabel(), this.genAppendSlot()];
return this.$createElement('div', {
staticClass: 'v-treeview-node__content'
}, children);
},
genToggle() {
return this.$createElement(VIcon, {
staticClass: 'v-treeview-node__toggle',
class: {
'v-treeview-node__toggle--open': this.isOpen,
'v-treeview-node__toggle--loading': this.isLoading
},
slot: 'prepend',
on: {
click: e => {
e.stopPropagation();
if (this.isLoading) return;
this.checkChildren().then(() => this.open());
}
}
}, [this.isLoading ? this.loadingIcon : this.expandIcon]);
},
genCheckbox() {
return this.$createElement(VIcon, {
staticClass: 'v-treeview-node__checkbox',
props: {
color: this.isSelected || this.isIndeterminate ? this.selectedColor : undefined,
disabled: this.disabled
},
on: {
click: e => {
e.stopPropagation();
if (this.isLoading) return;
this.checkChildren().then(() => {
// We nextTick here so that items watch in VTreeview has a chance to run first
this.$nextTick(() => {
this.isSelected = !this.isSelected;
this.isIndeterminate = false;
this.treeview.updateSelected(this.key, this.isSelected);
this.treeview.emitSelected();
});
});
}
}
}, [this.computedIcon]);
},
genLevel(level) {
return createRange(level).map(() => this.$createElement('div', {
staticClass: 'v-treeview-node__level'
}));
},
genNode() {
const children = [this.genContent()];
if (this.selectable) children.unshift(this.genCheckbox());
if (this.hasChildren) {
children.unshift(this.genToggle());
} else {
children.unshift(...this.genLevel(1));
}
children.unshift(...this.genLevel(this.level));
return this.$createElement('div', this.setTextColor(this.isActive && this.color, {
staticClass: 'v-treeview-node__root',
class: {
[this.activeClass]: this.isActive
},
on: {
click: () => {
if (this.openOnClick && this.hasChildren) {
this.checkChildren().then(this.open);
} else if (this.activatable && !this.disabled) {
this.isActive = !this.isActive;
this.treeview.updateActive(this.key, this.isActive);
this.treeview.emitActive();
}
}
}
}), children);
},
genChild(item, parentIsDisabled) {
return this.$createElement(VTreeviewNode, {
key: getObjectValueByPath(item, this.itemKey),
props: {
activatable: this.activatable,
activeClass: this.activeClass,
item,
selectable: this.selectable,
selectedColor: this.selectedColor,
color: this.color,
disablePerNode: this.disablePerNode,
expandIcon: this.expandIcon,
indeterminateIcon: this.indeterminateIcon,
offIcon: this.offIcon,
onIcon: this.onIcon,
loadingIcon: this.loadingIcon,
itemKey: this.itemKey,
itemText: this.itemText,
itemDisabled: this.itemDisabled,
itemChildren: this.itemChildren,
loadChildren: this.loadChildren,
transition: this.transition,
openOnClick: this.openOnClick,
rounded: this.rounded,
shaped: this.shaped,
level: this.level + 1,
selectionType: this.selectionType,
parentIsDisabled
},
scopedSlots: this.$scopedSlots
});
},
genChildrenWrapper() {
if (!this.isOpen || !this.children) return null;
const children = [this.children.map(c => this.genChild(c, this.disabled))];
return this.$createElement('div', {
staticClass: 'v-treeview-node__children'
}, children);
},
genTransition() {
return this.$createElement(VExpandTransition, [this.genChildrenWrapper()]);
}
},
render(h) {
const children = [this.genNode()];
if (this.transition) children.push(this.genTransition());else children.push(this.genChildrenWrapper());
return h('div', {
staticClass: 'v-treeview-node',
class: {
'v-treeview-node--leaf': !this.hasChildren,
'v-treeview-node--click': this.openOnClick,
'v-treeview-node--disabled': this.disabled,
'v-treeview-node--rounded': this.rounded,
'v-treeview-node--shaped': this.shaped,
'v-treeview-node--selected': this.isSelected
},
attrs: {
'aria-expanded': String(this.isOpen)
}
}, children);
}
});
export default VTreeviewNode;
//# sourceMappingURL=VTreeviewNode.mjs.map

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,18 @@
@mixin treeview-shaped($size, $margin)
.v-treeview-node__root,
.v-treeview-node__root:before
border-bottom-right-radius: #{$size * .5} !important
border-top-right-radius: #{$size * .5} !important
.v-treeview-node__root
margin-top: $margin
margin-bottom: $margin
@mixin treeview-rounded($size, $margin)
.v-treeview-node__root,
.v-treeview-node__root:before
border-radius: #{$size * .5} !important
.v-treeview-node__root
margin-top: $margin
margin-bottom: $margin

View File

@ -0,0 +1,10 @@
@import '../../styles/styles.sass';
$treeview-transition: .2s map-get($transition, 'linear-out-slow-in') !default;
$treeview-label-font-size: inherit !default;
$treeview-node-height: 48px !default;
$treeview-node-height-dense: 40px !default;
$treeview-node-shaped-margin: 8px !default;
$treeview-node-padding: 8px !default;
$treeview-node-margin: 6px !default;
$treeview-node-level-width: 24px !default;

View File

@ -0,0 +1,10 @@
import VTreeview from "./VTreeview.mjs";
import VTreeviewNode from "./VTreeviewNode.mjs";
export { VTreeview, VTreeviewNode };
export default {
$_vuetify_subcomponents: {
VTreeview,
VTreeviewNode
}
};
//# sourceMappingURL=index.mjs.map

View File

@ -0,0 +1 @@
{"version":3,"file":"index.mjs","names":["VTreeview","VTreeviewNode","$_vuetify_subcomponents"],"sources":["../../../src/components/VTreeview/index.ts"],"sourcesContent":["import VTreeview from './VTreeview'\nimport VTreeviewNode from './VTreeviewNode'\n\nexport { VTreeview, VTreeviewNode }\n\nexport default {\n $_vuetify_subcomponents: {\n VTreeview,\n VTreeviewNode,\n },\n}\n"],"mappings":"OAAOA,SAAS;AAAA,OACTC,aAAa;AAEpB,SAASD,SAAS,EAAEC,aAAa;AAEjC,eAAe;EACbC,uBAAuB,EAAE;IACvBF,SAAS;IACTC;EACF;AACF,CAAC"}

View File

@ -0,0 +1,25 @@
// @ts-nocheck
/* eslint-disable */
import { getObjectValueByPath } from "../../../util/helpers.mjs";
export function filterTreeItem(item, search, textKey) {
const text = getObjectValueByPath(item, textKey);
return text.toLocaleLowerCase().indexOf(search.toLocaleLowerCase()) > -1;
}
export function filterTreeItems(filter, item, search, idKey, textKey, childrenKey, excluded) {
if (filter(item, search, textKey)) {
return true;
}
const children = getObjectValueByPath(item, childrenKey);
if (children) {
let match = false;
for (let i = 0; i < children.length; i++) {
if (filterTreeItems(filter, children[i], search, idKey, textKey, childrenKey, excluded)) {
match = true;
}
}
if (match) return true;
}
excluded.add(getObjectValueByPath(item, idKey));
return false;
}
//# sourceMappingURL=filterTreeItems.mjs.map

View File

@ -0,0 +1 @@
{"version":3,"file":"filterTreeItems.mjs","names":["getObjectValueByPath","filterTreeItem","item","search","textKey","text","toLocaleLowerCase","indexOf","filterTreeItems","filter","idKey","childrenKey","excluded","children","match","i","length","add"],"sources":["../../../../src/components/VTreeview/util/filterTreeItems.ts"],"sourcesContent":["// @ts-nocheck\n/* eslint-disable */\n\nimport { getObjectValueByPath } from '../../../util/helpers'\nimport { TreeviewItemFunction } from 'vuetify/types'\n\nexport function filterTreeItem (item: object, search: string, textKey: string): boolean {\n const text = getObjectValueByPath(item, textKey)\n\n return text.toLocaleLowerCase().indexOf(search.toLocaleLowerCase()) > -1\n}\n\nexport function filterTreeItems (\n filter: TreeviewItemFunction,\n item: any,\n search: string,\n idKey: string,\n textKey: string,\n childrenKey: string,\n excluded: Set<string | number>\n): boolean {\n if (filter(item, search, textKey)) {\n return true\n }\n\n const children = getObjectValueByPath(item, childrenKey)\n\n if (children) {\n let match = false\n for (let i = 0; i < children.length; i++) {\n if (filterTreeItems(filter, children[i], search, idKey, textKey, childrenKey, excluded)) {\n match = true\n }\n }\n\n if (match) return true\n }\n\n excluded.add(getObjectValueByPath(item, idKey))\n\n return false\n}\n"],"mappings":"AAAA;AACA;AAAA,SAESA,oBAAoB;AAG7B,OAAO,SAASC,cAAcA,CAAEC,IAAY,EAAEC,MAAc,EAAEC,OAAe,EAAW;EACtF,MAAMC,IAAI,GAAGL,oBAAoB,CAACE,IAAI,EAAEE,OAAO,CAAC;EAEhD,OAAOC,IAAI,CAACC,iBAAiB,CAAC,CAAC,CAACC,OAAO,CAACJ,MAAM,CAACG,iBAAiB,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;AAC1E;AAEA,OAAO,SAASE,eAAeA,CAC7BC,MAA4B,EAC5BP,IAAS,EACTC,MAAc,EACdO,KAAa,EACbN,OAAe,EACfO,WAAmB,EACnBC,QAA8B,EACrB;EACT,IAAIH,MAAM,CAACP,IAAI,EAAEC,MAAM,EAAEC,OAAO,CAAC,EAAE;IACjC,OAAO,IAAI;EACb;EAEA,MAAMS,QAAQ,GAAGb,oBAAoB,CAACE,IAAI,EAAES,WAAW,CAAC;EAExD,IAAIE,QAAQ,EAAE;IACZ,IAAIC,KAAK,GAAG,KAAK;IACjB,KAAK,IAAIC,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGF,QAAQ,CAACG,MAAM,EAAED,CAAC,EAAE,EAAE;MACxC,IAAIP,eAAe,CAACC,MAAM,EAAEI,QAAQ,CAACE,CAAC,CAAC,EAAEZ,MAAM,EAAEO,KAAK,EAAEN,OAAO,EAAEO,WAAW,EAAEC,QAAQ,CAAC,EAAE;QACvFE,KAAK,GAAG,IAAI;MACd;IACF;IAEA,IAAIA,KAAK,EAAE,OAAO,IAAI;EACxB;EAEAF,QAAQ,CAACK,GAAG,CAACjB,oBAAoB,CAACE,IAAI,EAAEQ,KAAK,CAAC,CAAC;EAE/C,OAAO,KAAK;AACd"}