design-system-next 2.9.7 → 2.9.9
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/design-system-next.js +5739 -5570
- package/dist/design-system-next.js.gz +0 -0
- package/dist/package.json.d.ts +1 -1
- package/package.json +1 -1
- package/src/App.vue +1 -80
- package/src/components/filter/filter.ts +8 -0
- package/src/components/filter/filter.vue +13 -5
- package/src/components/filter/use-filter.ts +8 -2
- package/src/components/select/select-ladderized/use-select-ladderized.ts +164 -164
- package/src/components/sidenav/sidenav.ts +47 -7
- package/src/components/sidenav/sidenav.vue +6 -6
- package/src/components/sidenav/use-sidenav.ts +97 -3
- package/src/vite-env.d.ts +6 -0
|
Binary file
|
package/dist/package.json.d.ts
CHANGED
package/package.json
CHANGED
package/src/App.vue
CHANGED
|
@@ -1,82 +1,3 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
3
|
-
id="sample-select"
|
|
4
|
-
v-model="selectModel"
|
|
5
|
-
label="Multi-Select Label"
|
|
6
|
-
placeholder="Select an option"
|
|
7
|
-
:options="options"
|
|
8
|
-
/>
|
|
9
|
-
<br />
|
|
10
|
-
{{ selectModel }}
|
|
11
|
-
<br />
|
|
12
|
-
<br />
|
|
13
|
-
{{ options }}
|
|
14
|
-
|
|
15
|
-
<br />
|
|
16
|
-
<br />
|
|
17
|
-
|
|
18
|
-
<br />
|
|
19
|
-
<br />
|
|
20
|
-
|
|
21
|
-
<br />
|
|
22
|
-
<br />
|
|
23
|
-
|
|
24
|
-
<br />
|
|
25
|
-
<br />
|
|
26
|
-
|
|
27
|
-
<button @click="addMoreOptions">Add more option</button>
|
|
2
|
+
<div>Test Component Here</div>
|
|
28
3
|
</template>
|
|
29
|
-
|
|
30
|
-
<script setup>
|
|
31
|
-
import { ref } from 'vue';
|
|
32
|
-
|
|
33
|
-
import SprSelectMultiple from './components/select/select-multiple/select-multiple.vue';
|
|
34
|
-
|
|
35
|
-
const selectModel = ref('');
|
|
36
|
-
|
|
37
|
-
const options = ref([
|
|
38
|
-
{ text: 'Apple', value: 'apple' },
|
|
39
|
-
{ text: 'Banana', value: 'banana' },
|
|
40
|
-
{ text: 'Cherry', value: 'cherry' },
|
|
41
|
-
{ text: 'Date', value: 'date' },
|
|
42
|
-
{ text: 'Elderberry', value: 'elderberry' },
|
|
43
|
-
{ text: 'Fig', value: 'fig' },
|
|
44
|
-
{ text: 'Grape', value: 'grape' },
|
|
45
|
-
{ text: 'Nectarine', value: 'nectarine' },
|
|
46
|
-
{ text: 'Orange', value: 'orange' },
|
|
47
|
-
{ text: 'Papaya', value: 'papaya' },
|
|
48
|
-
{ text: '89 Quince', value: '50' },
|
|
49
|
-
]);
|
|
50
|
-
|
|
51
|
-
let pagination = ref({
|
|
52
|
-
currentPage: 1,
|
|
53
|
-
totalPages: 0,
|
|
54
|
-
});
|
|
55
|
-
|
|
56
|
-
const addMoreOptions = async () => {
|
|
57
|
-
try {
|
|
58
|
-
const response = await fetch(`https://api.thedogapi.com/v1/breeds?page=${pagination.value.currentPage}&limit=10`);
|
|
59
|
-
|
|
60
|
-
if (!response.ok) {
|
|
61
|
-
throw new Error('Network response was not ok');
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
const optionsResponse = await response.json();
|
|
65
|
-
|
|
66
|
-
if (optionsResponse.length) {
|
|
67
|
-
options.value = [
|
|
68
|
-
...(options.value || []),
|
|
69
|
-
...optionsResponse.map((optionItem) => ({
|
|
70
|
-
text: optionItem.name,
|
|
71
|
-
value: optionItem.id,
|
|
72
|
-
})),
|
|
73
|
-
];
|
|
74
|
-
}
|
|
75
|
-
// Do not clear options if no new options are fetched
|
|
76
|
-
|
|
77
|
-
pagination.value.currentPage += 1;
|
|
78
|
-
} catch (error) {
|
|
79
|
-
console.error('There was a problem with the fetch operation:', error);
|
|
80
|
-
}
|
|
81
|
-
};
|
|
82
|
-
</script>
|
|
@@ -6,16 +6,17 @@
|
|
|
6
6
|
placement="bottom"
|
|
7
7
|
:triggers="[]"
|
|
8
8
|
:popper-hide-triggers="[]"
|
|
9
|
-
:container="`#${
|
|
9
|
+
:container="`#${generateStableId}`"
|
|
10
10
|
:auto-hide="false"
|
|
11
11
|
:delay="0"
|
|
12
|
+
:popper-class="'filter-menu-popper'"
|
|
12
13
|
:style="{
|
|
13
14
|
width: props.width,
|
|
14
15
|
position: 'relative',
|
|
15
16
|
}"
|
|
16
17
|
>
|
|
17
|
-
<
|
|
18
|
-
:id="
|
|
18
|
+
<div
|
|
19
|
+
:id="generateStableId"
|
|
19
20
|
:style="{
|
|
20
21
|
width: props.width,
|
|
21
22
|
position: 'relative',
|
|
@@ -30,13 +31,16 @@
|
|
|
30
31
|
:placeholder="placeholder"
|
|
31
32
|
:label="label"
|
|
32
33
|
:disabled="disabled"
|
|
34
|
+
:helper-text="props.helperText"
|
|
35
|
+
:display-helper="!!props.helperText"
|
|
36
|
+
:error="props.error"
|
|
33
37
|
>
|
|
34
38
|
<template #icon>
|
|
35
39
|
<Icon icon="ph:magnifying-glass" />
|
|
36
40
|
</template>
|
|
37
41
|
</spr-input>
|
|
38
42
|
</slot>
|
|
39
|
-
</
|
|
43
|
+
</div>
|
|
40
44
|
|
|
41
45
|
<template #popper>
|
|
42
46
|
<div :class="filterClass.MenuOptionClasses">
|
|
@@ -58,6 +62,8 @@
|
|
|
58
62
|
placement="right-start"
|
|
59
63
|
:triggers="['click']"
|
|
60
64
|
:auto-hide="false"
|
|
65
|
+
:delay="0"
|
|
66
|
+
popover-base="filter-menu-base"
|
|
61
67
|
>
|
|
62
68
|
<spr-button id="add-filter-button" has-icon variant="secondary" size="small">
|
|
63
69
|
<Icon icon="ph:faders-horizontal" />
|
|
@@ -80,6 +86,8 @@
|
|
|
80
86
|
placement="right"
|
|
81
87
|
:triggers="['click']"
|
|
82
88
|
:auto-hide="false"
|
|
89
|
+
:delay="0"
|
|
90
|
+
popover-base="filter-menu-field"
|
|
83
91
|
>
|
|
84
92
|
<spr-chips
|
|
85
93
|
:active="mappedFilterMenuList[menu.field].isFilterVisible"
|
|
@@ -268,7 +276,7 @@ const {
|
|
|
268
276
|
filterMenuSearchvalue,
|
|
269
277
|
mappedFilterMenuList,
|
|
270
278
|
filterClass,
|
|
271
|
-
|
|
279
|
+
generateStableId,
|
|
272
280
|
filterOptionRef,
|
|
273
281
|
filterMenuOptionList,
|
|
274
282
|
|
|
@@ -20,7 +20,6 @@ export const useFilter = (props: FilterPropTypes, emit: SetupContext<FilterEmitT
|
|
|
20
20
|
const isAdvanceFilterVisible = ref<boolean>(false);
|
|
21
21
|
const mappedMenuData = ref<Record<string, FilterPropsInterface['optionDetails']>>({});
|
|
22
22
|
const mappedFilterMenuList = ref<Record<string, FilterPropsInterface['filterDetails']>>({});
|
|
23
|
-
const uniqueId = ref<string>(`filter-${dayjs().valueOf()}-${Math.floor(Math.random() * 1000)}`);
|
|
24
23
|
const filterMenuList = ref<FilterPropsInterface['filterDetails'][]>(
|
|
25
24
|
filterMenu.value as FilterPropsInterface['filterDetails'][],
|
|
26
25
|
);
|
|
@@ -73,6 +72,13 @@ export const useFilter = (props: FilterPropTypes, emit: SetupContext<FilterEmitT
|
|
|
73
72
|
return getFiltereredMenuOption.value.filter((item) => item.isSelected);
|
|
74
73
|
});
|
|
75
74
|
|
|
75
|
+
const generateStableId = computed(() => {
|
|
76
|
+
if (props.id) {
|
|
77
|
+
return `filter-popover-${props.id}`;
|
|
78
|
+
}
|
|
79
|
+
return `filter-popover-${dayjs().valueOf().toString().slice(-8)}`;
|
|
80
|
+
});
|
|
81
|
+
|
|
76
82
|
const getMappedFilterData = (column: string) => {
|
|
77
83
|
emit('getFilterData', column);
|
|
78
84
|
selectedColumn.value = column;
|
|
@@ -253,7 +259,7 @@ export const useFilter = (props: FilterPropTypes, emit: SetupContext<FilterEmitT
|
|
|
253
259
|
filterMenuSearchvalue,
|
|
254
260
|
mappedFilterMenuList,
|
|
255
261
|
filterClass,
|
|
256
|
-
|
|
262
|
+
generateStableId,
|
|
257
263
|
filterOptionRef,
|
|
258
264
|
filterMenuOptionList,
|
|
259
265
|
|
|
@@ -1,164 +1,164 @@
|
|
|
1
|
-
import { ref, toRefs, computed, watch } from 'vue';
|
|
2
|
-
import { useVModel, useDebounceFn, onClickOutside } from '@vueuse/core';
|
|
3
|
-
|
|
4
|
-
import type { SelectLadderizedPropTypes } from './select-ladderized';
|
|
5
|
-
|
|
6
|
-
import type { MenuListType } from '@/components/list/list';
|
|
7
|
-
|
|
8
|
-
export const useSelectLadderized = (
|
|
9
|
-
props: SelectLadderizedPropTypes,
|
|
10
|
-
emit: (event: string, ...args: unknown[]) => void,
|
|
11
|
-
) => {
|
|
12
|
-
const { options, disabled } = toRefs(props);
|
|
13
|
-
|
|
14
|
-
const ladderizedClasses = computed(() => ({
|
|
15
|
-
baseClasses: 'spr-flex spr-flex-col spr-gap-size-spacing-4xs',
|
|
16
|
-
labelClasses: 'spr-body-sm-regular spr-text-color-strong spr-block',
|
|
17
|
-
}));
|
|
18
|
-
|
|
19
|
-
// Popper Variables
|
|
20
|
-
const ladderizedSelectPopperState = ref(false);
|
|
21
|
-
const ladderizedSelectRef = ref(null);
|
|
22
|
-
const isLadderizedSelectPopperDisabled = computed(() => disabled.value);
|
|
23
|
-
|
|
24
|
-
// Ladderized Select Model
|
|
25
|
-
const ladderizedSelectModel = useVModel(props, 'modelValue', emit);
|
|
26
|
-
const ladderizedSelectOptions = computed(() => options.value);
|
|
27
|
-
|
|
28
|
-
// Input Variables
|
|
29
|
-
const inputText = ref<string>('');
|
|
30
|
-
const isSearching = ref(false);
|
|
31
|
-
const wasCleared = ref(false);
|
|
32
|
-
|
|
33
|
-
const isLeafNode = (item: MenuListType): boolean => {
|
|
34
|
-
return !item.sublevel || item.sublevel.length === 0;
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
// Helper to find the path to a selected value in the menu tree
|
|
38
|
-
const findPathToValue = (items: MenuListType[], value: string | number, path: string[] = []): string[] | null => {
|
|
39
|
-
for (const item of items) {
|
|
40
|
-
const newPath = [...path, item.text];
|
|
41
|
-
|
|
42
|
-
if (item.value === value) {
|
|
43
|
-
return newPath;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
if (item.sublevel) {
|
|
47
|
-
const result = findPathToValue(item.sublevel, value, newPath);
|
|
48
|
-
|
|
49
|
-
if (result) return result;
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
return null;
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
const handleSelectedLadderizedItem = (selectedItems: string[], selectedItem?: MenuListType) => {
|
|
57
|
-
wasCleared.value = false;
|
|
58
|
-
ladderizedSelectModel.value = selectedItems;
|
|
59
|
-
|
|
60
|
-
let itemToCheck = selectedItem;
|
|
61
|
-
|
|
62
|
-
// Fallback: if selectedItem is not provided, try to find it from the value
|
|
63
|
-
if (!itemToCheck && selectedItems.length > 0) {
|
|
64
|
-
const findItemByValue = (items: MenuListType[], value: string | number): MenuListType | undefined => {
|
|
65
|
-
for (const item of items) {
|
|
66
|
-
if (item.value === value) return item;
|
|
67
|
-
|
|
68
|
-
if (item.sublevel) {
|
|
69
|
-
const found = findItemByValue(item.sublevel, value);
|
|
70
|
-
|
|
71
|
-
if (found) return found;
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
return undefined;
|
|
76
|
-
};
|
|
77
|
-
|
|
78
|
-
itemToCheck = findItemByValue(ladderizedSelectOptions.value, selectedItems[selectedItems.length - 1]);
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
if (itemToCheck) {
|
|
82
|
-
const path = findPathToValue(ladderizedSelectOptions.value, itemToCheck.value);
|
|
83
|
-
|
|
84
|
-
inputText.value = path ? path.join(' > ') : itemToCheck.text || '';
|
|
85
|
-
|
|
86
|
-
if (isLeafNode(itemToCheck)) {
|
|
87
|
-
ladderizedSelectPopperState.value = false;
|
|
88
|
-
}
|
|
89
|
-
} else if (selectedItems.length === 0 && !wasCleared.value) {
|
|
90
|
-
inputText.value = '';
|
|
91
|
-
}
|
|
92
|
-
};
|
|
93
|
-
|
|
94
|
-
const handleSearch = () => {
|
|
95
|
-
isSearching.value = true;
|
|
96
|
-
|
|
97
|
-
debouncedEmitSearch();
|
|
98
|
-
};
|
|
99
|
-
|
|
100
|
-
const debouncedEmitSearch = useDebounceFn(() => {
|
|
101
|
-
// Optionally emit search event here if needed
|
|
102
|
-
}, 300);
|
|
103
|
-
|
|
104
|
-
const handleClear = () => {
|
|
105
|
-
wasCleared.value = true;
|
|
106
|
-
|
|
107
|
-
inputText.value = '';
|
|
108
|
-
|
|
109
|
-
emit('update:modelValue', []);
|
|
110
|
-
};
|
|
111
|
-
|
|
112
|
-
const handleOptionsToggle = () => {
|
|
113
|
-
ladderizedSelectPopperState.value = true;
|
|
114
|
-
|
|
115
|
-
isSearching.value = false;
|
|
116
|
-
};
|
|
117
|
-
|
|
118
|
-
// Watch for changes in modelValue to update inputText
|
|
119
|
-
watch(
|
|
120
|
-
() => ladderizedSelectModel.value,
|
|
121
|
-
(newVal) => {
|
|
122
|
-
if (wasCleared.value) {
|
|
123
|
-
inputText.value = '';
|
|
124
|
-
wasCleared.value = false;
|
|
125
|
-
return;
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
if (Array.isArray(newVal) && newVal.length > 0) {
|
|
129
|
-
// Treat the array as a single path for ladderized select
|
|
130
|
-
let currentLevel = ladderizedSelectOptions.value;
|
|
131
|
-
|
|
132
|
-
const pathTexts: string[] = [];
|
|
133
|
-
|
|
134
|
-
for (const value of newVal) {
|
|
135
|
-
const found = currentLevel.find((item) => item.value === value);
|
|
136
|
-
if (!found) break;
|
|
137
|
-
pathTexts.push(found.text);
|
|
138
|
-
currentLevel = found.sublevel || [];
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
inputText.value = pathTexts.join(' > ');
|
|
142
|
-
}
|
|
143
|
-
},
|
|
144
|
-
{ immediate: true },
|
|
145
|
-
);
|
|
146
|
-
|
|
147
|
-
onClickOutside(ladderizedSelectRef, () => {
|
|
148
|
-
ladderizedSelectPopperState.value = false;
|
|
149
|
-
});
|
|
150
|
-
|
|
151
|
-
return {
|
|
152
|
-
ladderizedClasses,
|
|
153
|
-
ladderizedSelectPopperState,
|
|
154
|
-
ladderizedSelectRef,
|
|
155
|
-
ladderizedSelectOptions,
|
|
156
|
-
isLadderizedSelectPopperDisabled,
|
|
157
|
-
ladderizedSelectModel,
|
|
158
|
-
inputText,
|
|
159
|
-
handleSelectedLadderizedItem,
|
|
160
|
-
handleSearch,
|
|
161
|
-
handleClear,
|
|
162
|
-
handleOptionsToggle,
|
|
163
|
-
};
|
|
164
|
-
};
|
|
1
|
+
import { ref, toRefs, computed, watch } from 'vue';
|
|
2
|
+
import { useVModel, useDebounceFn, onClickOutside } from '@vueuse/core';
|
|
3
|
+
|
|
4
|
+
import type { SelectLadderizedPropTypes } from './select-ladderized';
|
|
5
|
+
|
|
6
|
+
import type { MenuListType } from '@/components/list/list';
|
|
7
|
+
|
|
8
|
+
export const useSelectLadderized = (
|
|
9
|
+
props: SelectLadderizedPropTypes,
|
|
10
|
+
emit: (event: string, ...args: unknown[]) => void,
|
|
11
|
+
) => {
|
|
12
|
+
const { options, disabled } = toRefs(props);
|
|
13
|
+
|
|
14
|
+
const ladderizedClasses = computed(() => ({
|
|
15
|
+
baseClasses: 'spr-flex spr-flex-col spr-gap-size-spacing-4xs',
|
|
16
|
+
labelClasses: 'spr-body-sm-regular spr-text-color-strong spr-block',
|
|
17
|
+
}));
|
|
18
|
+
|
|
19
|
+
// Popper Variables
|
|
20
|
+
const ladderizedSelectPopperState = ref(false);
|
|
21
|
+
const ladderizedSelectRef = ref(null);
|
|
22
|
+
const isLadderizedSelectPopperDisabled = computed(() => disabled.value);
|
|
23
|
+
|
|
24
|
+
// Ladderized Select Model
|
|
25
|
+
const ladderizedSelectModel = useVModel(props, 'modelValue', emit);
|
|
26
|
+
const ladderizedSelectOptions = computed(() => options.value);
|
|
27
|
+
|
|
28
|
+
// Input Variables
|
|
29
|
+
const inputText = ref<string>('');
|
|
30
|
+
const isSearching = ref(false);
|
|
31
|
+
const wasCleared = ref(false);
|
|
32
|
+
|
|
33
|
+
const isLeafNode = (item: MenuListType): boolean => {
|
|
34
|
+
return !item.sublevel || item.sublevel.length === 0;
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
// Helper to find the path to a selected value in the menu tree
|
|
38
|
+
const findPathToValue = (items: MenuListType[], value: string | number, path: string[] = []): string[] | null => {
|
|
39
|
+
for (const item of items) {
|
|
40
|
+
const newPath = [...path, item.text];
|
|
41
|
+
|
|
42
|
+
if (item.value === value) {
|
|
43
|
+
return newPath;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
if (item.sublevel) {
|
|
47
|
+
const result = findPathToValue(item.sublevel, value, newPath);
|
|
48
|
+
|
|
49
|
+
if (result) return result;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
return null;
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
const handleSelectedLadderizedItem = (selectedItems: string[], selectedItem?: MenuListType) => {
|
|
57
|
+
wasCleared.value = false;
|
|
58
|
+
ladderizedSelectModel.value = selectedItems;
|
|
59
|
+
|
|
60
|
+
let itemToCheck = selectedItem;
|
|
61
|
+
|
|
62
|
+
// Fallback: if selectedItem is not provided, try to find it from the value
|
|
63
|
+
if (!itemToCheck && selectedItems.length > 0) {
|
|
64
|
+
const findItemByValue = (items: MenuListType[], value: string | number): MenuListType | undefined => {
|
|
65
|
+
for (const item of items) {
|
|
66
|
+
if (item.value === value) return item;
|
|
67
|
+
|
|
68
|
+
if (item.sublevel) {
|
|
69
|
+
const found = findItemByValue(item.sublevel, value);
|
|
70
|
+
|
|
71
|
+
if (found) return found;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
return undefined;
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
itemToCheck = findItemByValue(ladderizedSelectOptions.value, selectedItems[selectedItems.length - 1]);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
if (itemToCheck) {
|
|
82
|
+
const path = findPathToValue(ladderizedSelectOptions.value, itemToCheck.value);
|
|
83
|
+
|
|
84
|
+
inputText.value = path ? path.join(' > ') : itemToCheck.text || '';
|
|
85
|
+
|
|
86
|
+
if (isLeafNode(itemToCheck)) {
|
|
87
|
+
ladderizedSelectPopperState.value = false;
|
|
88
|
+
}
|
|
89
|
+
} else if (selectedItems.length === 0 && !wasCleared.value) {
|
|
90
|
+
inputText.value = '';
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
const handleSearch = () => {
|
|
95
|
+
isSearching.value = true;
|
|
96
|
+
|
|
97
|
+
debouncedEmitSearch();
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
const debouncedEmitSearch = useDebounceFn(() => {
|
|
101
|
+
// Optionally emit search event here if needed
|
|
102
|
+
}, 300);
|
|
103
|
+
|
|
104
|
+
const handleClear = () => {
|
|
105
|
+
wasCleared.value = true;
|
|
106
|
+
|
|
107
|
+
inputText.value = '';
|
|
108
|
+
|
|
109
|
+
emit('update:modelValue', []);
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
const handleOptionsToggle = () => {
|
|
113
|
+
ladderizedSelectPopperState.value = true;
|
|
114
|
+
|
|
115
|
+
isSearching.value = false;
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
// Watch for changes in modelValue to update inputText
|
|
119
|
+
watch(
|
|
120
|
+
() => ladderizedSelectModel.value,
|
|
121
|
+
(newVal) => {
|
|
122
|
+
if (wasCleared.value) {
|
|
123
|
+
inputText.value = '';
|
|
124
|
+
wasCleared.value = false;
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
if (Array.isArray(newVal) && newVal.length > 0) {
|
|
129
|
+
// Treat the array as a single path for ladderized select
|
|
130
|
+
let currentLevel = ladderizedSelectOptions.value;
|
|
131
|
+
|
|
132
|
+
const pathTexts: string[] = [];
|
|
133
|
+
|
|
134
|
+
for (const value of newVal) {
|
|
135
|
+
const found = currentLevel.find((item) => item.value === value);
|
|
136
|
+
if (!found) break;
|
|
137
|
+
pathTexts.push(found.text);
|
|
138
|
+
currentLevel = found.sublevel || [];
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
inputText.value = pathTexts.join(' > ');
|
|
142
|
+
}
|
|
143
|
+
},
|
|
144
|
+
{ immediate: true },
|
|
145
|
+
);
|
|
146
|
+
|
|
147
|
+
onClickOutside(ladderizedSelectRef, () => {
|
|
148
|
+
ladderizedSelectPopperState.value = false;
|
|
149
|
+
});
|
|
150
|
+
|
|
151
|
+
return {
|
|
152
|
+
ladderizedClasses,
|
|
153
|
+
ladderizedSelectPopperState,
|
|
154
|
+
ladderizedSelectRef,
|
|
155
|
+
ladderizedSelectOptions,
|
|
156
|
+
isLadderizedSelectPopperDisabled,
|
|
157
|
+
ladderizedSelectModel,
|
|
158
|
+
inputText,
|
|
159
|
+
handleSelectedLadderizedItem,
|
|
160
|
+
handleSearch,
|
|
161
|
+
handleClear,
|
|
162
|
+
handleOptionsToggle,
|
|
163
|
+
};
|
|
164
|
+
};
|
|
@@ -5,6 +5,7 @@ type QuickAction = {
|
|
|
5
5
|
items: QuickActionItem[];
|
|
6
6
|
};
|
|
7
7
|
|
|
8
|
+
|
|
8
9
|
type QuickActionItem = {
|
|
9
10
|
title: string;
|
|
10
11
|
description: string;
|
|
@@ -14,23 +15,29 @@ type QuickActionItem = {
|
|
|
14
15
|
hidden: boolean;
|
|
15
16
|
};
|
|
16
17
|
|
|
17
|
-
type NavLinks = {
|
|
18
|
+
export type NavLinks = {
|
|
18
19
|
top: { parentLinks: ParentLinkItem[] }[];
|
|
19
20
|
bottom: { parentLinks: ParentLinkItem[] }[];
|
|
20
21
|
};
|
|
21
22
|
|
|
22
|
-
type
|
|
23
|
+
export type NavAPILinks = {
|
|
24
|
+
top: { parentLinks: NavItem[] }[];
|
|
25
|
+
bottom: { parentLinks: NavItem[] }[];
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export type ParentLinkItem = {
|
|
23
29
|
title: string;
|
|
24
30
|
icon: string;
|
|
25
|
-
link
|
|
26
|
-
redirect
|
|
31
|
+
link?: string;
|
|
32
|
+
redirect?: Redirect;
|
|
27
33
|
menuLinks: MenuLink[];
|
|
28
|
-
|
|
34
|
+
submenuLinks?: SubmenuLink[];
|
|
35
|
+
hidden?: boolean;
|
|
29
36
|
};
|
|
30
37
|
|
|
31
38
|
type MenuLink = {
|
|
32
39
|
menuHeading: string;
|
|
33
|
-
items: MenuLinkItem[];
|
|
40
|
+
items: MenuLinkItem[] | ParentLinkItem[];
|
|
34
41
|
};
|
|
35
42
|
|
|
36
43
|
type MenuLinkItem = {
|
|
@@ -42,7 +49,7 @@ type MenuLinkItem = {
|
|
|
42
49
|
|
|
43
50
|
type SubmenuLink = {
|
|
44
51
|
subMenuHeading: string;
|
|
45
|
-
items: SubmenuLinkItem[];
|
|
52
|
+
items: SubmenuLinkItem[] | ParentLinkItem[];
|
|
46
53
|
};
|
|
47
54
|
|
|
48
55
|
type SubmenuLinkItem = {
|
|
@@ -70,6 +77,34 @@ type UserMenuItem = {
|
|
|
70
77
|
hidden: boolean;
|
|
71
78
|
redirect: Redirect;
|
|
72
79
|
};
|
|
80
|
+
export interface NavItem {
|
|
81
|
+
groupId: string;
|
|
82
|
+
label: string;
|
|
83
|
+
icon?: string | null;
|
|
84
|
+
url?: string | null;
|
|
85
|
+
isNewTab?: boolean;
|
|
86
|
+
children?: NavItem[] | null;
|
|
87
|
+
groupName?: string | null;
|
|
88
|
+
hidden?: boolean;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
export interface MappedNavItem {
|
|
92
|
+
title: string;
|
|
93
|
+
icon?: string;
|
|
94
|
+
redirect?: {
|
|
95
|
+
openInNewTab: boolean;
|
|
96
|
+
isAbsoluteURL: boolean;
|
|
97
|
+
link: string;
|
|
98
|
+
};
|
|
99
|
+
menuLinks?: {
|
|
100
|
+
menuHeading: string;
|
|
101
|
+
items: MappedNavItem[];
|
|
102
|
+
}[];
|
|
103
|
+
submenuLinks?: {
|
|
104
|
+
subMenuHeading: string;
|
|
105
|
+
items: MappedNavItem[];
|
|
106
|
+
}[];
|
|
107
|
+
}
|
|
73
108
|
|
|
74
109
|
export const sidenavPropTypes = {
|
|
75
110
|
quickActions: {
|
|
@@ -120,6 +155,11 @@ export const sidenavPropTypes = {
|
|
|
120
155
|
validator: (value: unknown) => typeof value === 'boolean',
|
|
121
156
|
default: false,
|
|
122
157
|
},
|
|
158
|
+
isNavApi: {
|
|
159
|
+
type: Boolean,
|
|
160
|
+
validator: (value: unknown) => typeof value === 'boolean',
|
|
161
|
+
default: false,
|
|
162
|
+
}
|
|
123
163
|
};
|
|
124
164
|
|
|
125
165
|
export const sidenavEmitTypes = {
|