@ulu/frontend-vue 0.5.2 → 0.5.4
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/components/elements/UluCounterList.vue.d.ts +32 -0
- package/dist/components/elements/UluCounterList.vue.d.ts.map +1 -0
- package/dist/components/elements/UluCounterList.vue.js +77 -0
- package/dist/components/elements/UluDataTable.vue.d.ts +43 -0
- package/dist/components/elements/UluDataTable.vue.d.ts.map +1 -0
- package/dist/components/elements/UluDataTable.vue.js +114 -0
- package/dist/components/elements/UluDefinitionList.vue.d.ts +3 -2
- package/dist/components/elements/UluDefinitionList.vue.d.ts.map +1 -1
- package/dist/components/elements/UluDefinitionList.vue.js +34 -32
- package/dist/components/elements/UluDefinitionListItem.vue.d.ts +28 -0
- package/dist/components/elements/UluDefinitionListItem.vue.d.ts.map +1 -0
- package/dist/components/elements/UluDefinitionListItem.vue.js +46 -0
- package/dist/components/elements/UluList.vue.d.ts +5 -0
- package/dist/components/elements/UluList.vue.d.ts.map +1 -1
- package/dist/components/elements/UluList.vue.js +41 -22
- package/dist/components/elements/UluListItem.vue.d.ts +22 -0
- package/dist/components/elements/UluListItem.vue.d.ts.map +1 -0
- package/dist/components/elements/UluListItem.vue.js +28 -0
- package/dist/components/elements/UluTable.vue.d.ts +48 -0
- package/dist/components/elements/UluTable.vue.d.ts.map +1 -0
- package/dist/components/elements/UluTable.vue.js +211 -0
- package/dist/components/index.d.ts +5 -0
- package/dist/components/navigation/UluBreadcrumb.vue.js +23 -23
- package/dist/components/systems/table-sticky/UluTableSticky.vue.d.ts +104 -104
- package/dist/components/systems/table-sticky/UluTableSticky.vue.d.ts.map +1 -1
- package/dist/components/systems/table-sticky/UluTableSticky.vue.js +218 -256
- package/dist/components/systems/table-sticky/UluTableStickyRows.vue.d.ts +4 -4
- package/dist/components/systems/table-sticky/UluTableStickyTable.vue.d.ts +12 -12
- package/dist/components/utils/UluPlaceholderImage.vue.d.ts +2 -2
- package/dist/composables/index.d.ts +1 -0
- package/dist/composables/useTableData.d.ts +30 -0
- package/dist/composables/useTableData.d.ts.map +1 -0
- package/dist/composables/useTableData.js +68 -0
- package/dist/index.js +194 -182
- package/lib/components/collapsible/UluAccordionGroup.vue +44 -44
- package/lib/components/elements/UluCounterList.vue +77 -0
- package/lib/components/elements/UluDataTable.vue +115 -0
- package/lib/components/elements/UluDefinitionList.vue +32 -27
- package/lib/components/elements/UluDefinitionListItem.vue +43 -0
- package/lib/components/elements/UluList.vue +38 -18
- package/lib/components/elements/UluListItem.vue +24 -0
- package/lib/components/elements/UluTable.vue +217 -0
- package/lib/components/index.js +5 -0
- package/lib/components/navigation/UluBreadcrumb.vue +5 -5
- package/lib/components/systems/table-sticky/UluTableSticky.vue +26 -171
- package/lib/composables/index.js +1 -0
- package/lib/composables/useTableData.js +189 -0
- package/package.json +3 -3
|
@@ -31,53 +31,53 @@
|
|
|
31
31
|
</template>
|
|
32
32
|
|
|
33
33
|
<script setup>
|
|
34
|
-
import { ref, provide } from 'vue';
|
|
35
|
-
import UluAccordion from './UluAccordion.vue';
|
|
34
|
+
import { ref, provide } from 'vue';
|
|
35
|
+
import UluAccordion from './UluAccordion.vue';
|
|
36
36
|
|
|
37
|
-
const props = defineProps({
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
});
|
|
37
|
+
const props = defineProps({
|
|
38
|
+
/**
|
|
39
|
+
* Array of items to render as accordions.
|
|
40
|
+
* Each item can have: title, content, isOpen, classes
|
|
41
|
+
*/
|
|
42
|
+
items: {
|
|
43
|
+
type: Array,
|
|
44
|
+
default: () => []
|
|
45
|
+
},
|
|
46
|
+
/**
|
|
47
|
+
* If using summary text sets the inner element the text is wrapped in, usually a headline or strong
|
|
48
|
+
*/
|
|
49
|
+
triggerTextElement: {
|
|
50
|
+
type: String,
|
|
51
|
+
default: "strong"
|
|
52
|
+
},
|
|
53
|
+
/**
|
|
54
|
+
* Class modifiers (ie. 'transparent', 'secondary', etc)
|
|
55
|
+
*/
|
|
56
|
+
modifiers: [String, Array],
|
|
57
|
+
/**
|
|
58
|
+
* Enable or configure animations.
|
|
59
|
+
* - `false` (default) to disable all animations.
|
|
60
|
+
* - `true` to enable animations with default settings.
|
|
61
|
+
* - An object to provide custom options to auto-animate (e.g., { duration: 100, easing: 'linear' }).
|
|
62
|
+
*/
|
|
63
|
+
animate: {
|
|
64
|
+
type: [Boolean, Object],
|
|
65
|
+
default: true
|
|
66
|
+
},
|
|
67
|
+
});
|
|
68
68
|
|
|
69
|
-
const activeAccordionId = ref(null);
|
|
69
|
+
const activeAccordionId = ref(null);
|
|
70
70
|
|
|
71
|
-
function toggle(id, isOpen) {
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
71
|
+
function toggle(id, isOpen) {
|
|
72
|
+
if (isOpen) {
|
|
73
|
+
activeAccordionId.value = id;
|
|
74
|
+
} else if (activeAccordionId.value === id) {
|
|
75
|
+
activeAccordionId.value = null;
|
|
76
|
+
}
|
|
76
77
|
}
|
|
77
|
-
}
|
|
78
78
|
|
|
79
|
-
provide('uluAccordionGroup', {
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
});
|
|
79
|
+
provide('uluAccordionGroup', {
|
|
80
|
+
activeAccordionId,
|
|
81
|
+
toggle
|
|
82
|
+
});
|
|
83
83
|
</script>
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<UluList
|
|
3
|
+
class="counter-list"
|
|
4
|
+
:class="resolvedModifiers"
|
|
5
|
+
:items="items"
|
|
6
|
+
:element="element"
|
|
7
|
+
:itemElement="itemElement"
|
|
8
|
+
:classes="resolvedClasses"
|
|
9
|
+
>
|
|
10
|
+
<template v-if="$slots.default" #default="slotProps">
|
|
11
|
+
<slot v-bind="slotProps" />
|
|
12
|
+
</template>
|
|
13
|
+
</UluList>
|
|
14
|
+
</template>
|
|
15
|
+
|
|
16
|
+
<script setup>
|
|
17
|
+
import { computed } from "vue";
|
|
18
|
+
import { useModifiers } from "../../composables/useModifiers.js";
|
|
19
|
+
import UluList from "./UluList.vue";
|
|
20
|
+
|
|
21
|
+
const props = defineProps({
|
|
22
|
+
/**
|
|
23
|
+
* Array of list items, output as is or use slot to template the item
|
|
24
|
+
* - Note item can add classes by defining { classes: { item } }
|
|
25
|
+
*/
|
|
26
|
+
items: Array,
|
|
27
|
+
/**
|
|
28
|
+
* HTML element for the list
|
|
29
|
+
*/
|
|
30
|
+
element: {
|
|
31
|
+
type: String,
|
|
32
|
+
default: "ol"
|
|
33
|
+
},
|
|
34
|
+
/**
|
|
35
|
+
* HTML element for the list items (when using items array)
|
|
36
|
+
*/
|
|
37
|
+
itemElement: {
|
|
38
|
+
type: String,
|
|
39
|
+
default: "li"
|
|
40
|
+
},
|
|
41
|
+
/**
|
|
42
|
+
* Classes object (keys are { list, item } to be applied to list and item elements)
|
|
43
|
+
*/
|
|
44
|
+
classes: {
|
|
45
|
+
type: Object,
|
|
46
|
+
default: () => ({})
|
|
47
|
+
},
|
|
48
|
+
/**
|
|
49
|
+
* Use alphabetical counter
|
|
50
|
+
*/
|
|
51
|
+
alphabetical: Boolean,
|
|
52
|
+
/**
|
|
53
|
+
* Remove counter reset
|
|
54
|
+
*/
|
|
55
|
+
noReset: Boolean,
|
|
56
|
+
/**
|
|
57
|
+
* Modifiers (to add any modifier classes based on base class [ie. 'alphabetical'])
|
|
58
|
+
*/
|
|
59
|
+
modifiers: [String, Array]
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
const { resolvedModifiers } = useModifiers({
|
|
63
|
+
props,
|
|
64
|
+
baseClass: "counter-list",
|
|
65
|
+
internal: computed(() => ({
|
|
66
|
+
"alphabetical": props.alphabetical,
|
|
67
|
+
"no-reset": props.noReset
|
|
68
|
+
}))
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
const resolvedClasses = computed(() => {
|
|
72
|
+
return {
|
|
73
|
+
list: props.classes.list,
|
|
74
|
+
item: ["counter-list__item", props.classes.item]
|
|
75
|
+
};
|
|
76
|
+
});
|
|
77
|
+
</script>
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<UluTable
|
|
3
|
+
class="data-table"
|
|
4
|
+
v-bind="$attrs"
|
|
5
|
+
:columns="columns"
|
|
6
|
+
:rows="rows"
|
|
7
|
+
:footerRows="footerRows"
|
|
8
|
+
:caption="caption"
|
|
9
|
+
:idPrefix="idPrefix"
|
|
10
|
+
:getRowValue="getRowValue"
|
|
11
|
+
:getColumnTitle="getColumnTitle"
|
|
12
|
+
:classes="{
|
|
13
|
+
...classes,
|
|
14
|
+
table: [resolvedModifiers, classes?.table]
|
|
15
|
+
}"
|
|
16
|
+
>
|
|
17
|
+
<template v-for="(_, name) in $slots" v-slot:[name]="slotData">
|
|
18
|
+
<slot :name="name" v-bind="slotData" />
|
|
19
|
+
</template>
|
|
20
|
+
</UluTable>
|
|
21
|
+
</template>
|
|
22
|
+
|
|
23
|
+
<script setup>
|
|
24
|
+
import { computed } from "vue";
|
|
25
|
+
import { useModifiers } from "../../composables/useModifiers.js";
|
|
26
|
+
import UluTable from "./UluTable.vue";
|
|
27
|
+
import { isArrayOfObjects } from "../../utils/props.js";
|
|
28
|
+
|
|
29
|
+
const props = defineProps({
|
|
30
|
+
/**
|
|
31
|
+
* Array of column configurations to convert to list output
|
|
32
|
+
*
|
|
33
|
+
* @property {Object} column A column config
|
|
34
|
+
* @property {String|Boolean} column.title The title to output for the column if set to a falsey value nothing will print
|
|
35
|
+
* @property {Array} column.columns Array of child columns
|
|
36
|
+
* @property {String} column.key The key that should be usec to grab column's value from rows
|
|
37
|
+
* @property {Function} column.value A function that returns the column's value used instead of key passed (row, column)
|
|
38
|
+
* @property {String} column.slot Register custom slot name to use as a template for this column. Passing a slot with this name will link them. The slot are passed the ({row, column}). Note this will disable output of the column's value
|
|
39
|
+
* @property {String} column.slotHeader Register custom slot name to use in the header
|
|
40
|
+
* @property {String} column.classHeader Custom class(s) to be set to column <th>
|
|
41
|
+
* @property {String} column.class Custom class(s) to be set to column's value <td>
|
|
42
|
+
* @property {String} column.html Use v-html output for value
|
|
43
|
+
* @property {String} column.rowHeader When this column is printed in the <tbody> it should be a header for the row. Note supports multiple row headers from left to right only. No rowspan support for rowHeaders.
|
|
44
|
+
*/
|
|
45
|
+
columns: {
|
|
46
|
+
type: Array,
|
|
47
|
+
validator: isArrayOfObjects
|
|
48
|
+
},
|
|
49
|
+
/**
|
|
50
|
+
* Array of tables rows (tbody)
|
|
51
|
+
* - Each row is an object who's value will be matched to columns
|
|
52
|
+
*/
|
|
53
|
+
rows: {
|
|
54
|
+
type: Array,
|
|
55
|
+
validator: isArrayOfObjects
|
|
56
|
+
},
|
|
57
|
+
/**
|
|
58
|
+
* Array of rows for footer (tfoot)
|
|
59
|
+
*/
|
|
60
|
+
footerRows: {
|
|
61
|
+
type: Array,
|
|
62
|
+
validator: isArrayOfObjects
|
|
63
|
+
},
|
|
64
|
+
/**
|
|
65
|
+
* Hidden caption for accessibility (or visible depending on styles). Can also be passed via slot.
|
|
66
|
+
*/
|
|
67
|
+
caption: String,
|
|
68
|
+
/**
|
|
69
|
+
* Prefix used for id generation
|
|
70
|
+
*/
|
|
71
|
+
idPrefix: String,
|
|
72
|
+
/**
|
|
73
|
+
* Optional user overridden value getter (for rows)
|
|
74
|
+
* @param {Object} row The current row
|
|
75
|
+
* @param {Object} column The current column in the row
|
|
76
|
+
*/
|
|
77
|
+
getRowValue: Function,
|
|
78
|
+
/**
|
|
79
|
+
* Optional user overridden title getter (for headers)
|
|
80
|
+
* @param {Object} column The current column
|
|
81
|
+
*/
|
|
82
|
+
getColumnTitle: Function,
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Applies striped row styling
|
|
86
|
+
*/
|
|
87
|
+
striped: Boolean,
|
|
88
|
+
/**
|
|
89
|
+
* Enhances the first column's visual prominence
|
|
90
|
+
*/
|
|
91
|
+
largeFirst: Boolean,
|
|
92
|
+
/**
|
|
93
|
+
* Additional style modifiers
|
|
94
|
+
*/
|
|
95
|
+
modifiers: [String, Array],
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Allows user to pass classes object to add custom classes to parts of the component
|
|
99
|
+
*/
|
|
100
|
+
classes: {
|
|
101
|
+
type: Object,
|
|
102
|
+
default: () => ({})
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
const { resolvedModifiers } = useModifiers({
|
|
107
|
+
props,
|
|
108
|
+
baseClass: "data-table",
|
|
109
|
+
internal: computed(() => ({
|
|
110
|
+
'striped': props.striped,
|
|
111
|
+
'large-first': props.largeFirst
|
|
112
|
+
}))
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
</script>
|
|
@@ -1,41 +1,44 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<dl
|
|
3
|
-
v-if="items
|
|
3
|
+
v-if="items !== undefined ? items.length : $slots.default"
|
|
4
4
|
class="definition-list"
|
|
5
5
|
:class="[resolvedModifiers, classes.list]"
|
|
6
6
|
>
|
|
7
|
-
<
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
<dt :class="classes.term">
|
|
13
|
-
<slot name="term" :item="item" :index="index">
|
|
14
|
-
{{ item.term }}
|
|
15
|
-
</slot>
|
|
16
|
-
</dt>
|
|
17
|
-
|
|
18
|
-
<dd
|
|
19
|
-
v-for="(desc, descIndex) in getDescriptions(item)"
|
|
20
|
-
:key="descIndex"
|
|
21
|
-
:class="classes.description"
|
|
7
|
+
<template v-if="items !== undefined">
|
|
8
|
+
<div
|
|
9
|
+
v-for="(item, index) in items"
|
|
10
|
+
:key="index"
|
|
11
|
+
:class="classes.item"
|
|
22
12
|
>
|
|
23
|
-
<
|
|
24
|
-
name="
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
13
|
+
<dt :class="classes.term">
|
|
14
|
+
<slot name="term" :item="item" :index="index">
|
|
15
|
+
{{ item.term }}
|
|
16
|
+
</slot>
|
|
17
|
+
</dt>
|
|
18
|
+
|
|
19
|
+
<dd
|
|
20
|
+
v-for="(desc, descIndex) in getDescriptions(item)"
|
|
21
|
+
:key="descIndex"
|
|
22
|
+
:class="classes.description"
|
|
29
23
|
>
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
24
|
+
<slot
|
|
25
|
+
name="description"
|
|
26
|
+
:item="item"
|
|
27
|
+
:description="desc"
|
|
28
|
+
:index="index"
|
|
29
|
+
:descriptionIndex="descIndex"
|
|
30
|
+
>
|
|
31
|
+
{{ desc }}
|
|
32
|
+
</slot>
|
|
33
|
+
</dd>
|
|
34
|
+
</div>
|
|
35
|
+
</template>
|
|
36
|
+
<slot v-else />
|
|
34
37
|
</dl>
|
|
35
38
|
</template>
|
|
36
39
|
|
|
37
40
|
<script setup>
|
|
38
|
-
import { computed } from 'vue';
|
|
41
|
+
import { computed, provide } from 'vue';
|
|
39
42
|
import { useModifiers } from "../../composables/useModifiers.js";
|
|
40
43
|
|
|
41
44
|
const props = defineProps({
|
|
@@ -85,6 +88,8 @@
|
|
|
85
88
|
compact: Boolean,
|
|
86
89
|
});
|
|
87
90
|
|
|
91
|
+
provide("uluDefinitionListClasses", computed(() => props.classes));
|
|
92
|
+
|
|
88
93
|
const internalModifiers = computed(() => ({
|
|
89
94
|
"inline" : props.inline,
|
|
90
95
|
"inline-all" : props.inlineAll,
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div :class="[listClasses.item, classes?.item]">
|
|
3
|
+
<dt :class="[listClasses.term, classes?.term]">
|
|
4
|
+
<slot name="term">{{ term }}</slot>
|
|
5
|
+
</dt>
|
|
6
|
+
<dd
|
|
7
|
+
v-for="(desc, index) in descriptions"
|
|
8
|
+
:key="index"
|
|
9
|
+
:class="[listClasses.description, classes?.description]"
|
|
10
|
+
>
|
|
11
|
+
<slot name="description" :description="desc" :index="index">
|
|
12
|
+
{{ desc }}
|
|
13
|
+
</slot>
|
|
14
|
+
</dd>
|
|
15
|
+
</div>
|
|
16
|
+
</template>
|
|
17
|
+
|
|
18
|
+
<script setup>
|
|
19
|
+
import { computed, inject } from "vue";
|
|
20
|
+
|
|
21
|
+
const props = defineProps({
|
|
22
|
+
/**
|
|
23
|
+
* The term text (renders inside dt)
|
|
24
|
+
*/
|
|
25
|
+
term: String,
|
|
26
|
+
/**
|
|
27
|
+
* The description text or array of strings (renders inside dd)
|
|
28
|
+
*/
|
|
29
|
+
description: [String, Array],
|
|
30
|
+
/**
|
|
31
|
+
* Optional classes object to override/append to injected parent classes { item, term, description }
|
|
32
|
+
*/
|
|
33
|
+
classes: Object
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
const injectedClasses = inject("uluDefinitionListClasses", { value: {} });
|
|
37
|
+
const listClasses = computed(() => injectedClasses.value || {});
|
|
38
|
+
|
|
39
|
+
const descriptions = computed(() => {
|
|
40
|
+
if (!props.description) return [];
|
|
41
|
+
return Array.isArray(props.description) ? props.description : [props.description];
|
|
42
|
+
});
|
|
43
|
+
</script>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<component
|
|
3
|
-
v-if="items
|
|
4
|
-
:is="
|
|
3
|
+
v-if="items !== undefined ? items.length : $slots.default"
|
|
4
|
+
:is="resolvedElement"
|
|
5
5
|
:class="[
|
|
6
6
|
{
|
|
7
7
|
'list-ordered' : ordered,
|
|
@@ -17,23 +17,27 @@
|
|
|
17
17
|
:reversed="isOrdered ? reversed : null"
|
|
18
18
|
:start="start"
|
|
19
19
|
>
|
|
20
|
-
<
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
20
|
+
<template v-if="items !== undefined">
|
|
21
|
+
<component
|
|
22
|
+
:is="itemElement"
|
|
23
|
+
v-for="(item, index) in items"
|
|
24
|
+
:key="index"
|
|
25
|
+
:class="[
|
|
26
|
+
classes.item,
|
|
27
|
+
item?.classes?.item
|
|
28
|
+
]"
|
|
29
|
+
>
|
|
30
|
+
<slot :item="item" :index="index">
|
|
31
|
+
{{ item }}
|
|
32
|
+
</slot>
|
|
33
|
+
</component>
|
|
34
|
+
</template>
|
|
35
|
+
<slot v-else />
|
|
32
36
|
</component>
|
|
33
37
|
</template>
|
|
34
38
|
|
|
35
39
|
<script setup>
|
|
36
|
-
import { computed } from "vue";
|
|
40
|
+
import { computed, provide } from "vue";
|
|
37
41
|
|
|
38
42
|
const props = defineProps({
|
|
39
43
|
/**
|
|
@@ -42,7 +46,7 @@
|
|
|
42
46
|
*/
|
|
43
47
|
items: Array,
|
|
44
48
|
/**
|
|
45
|
-
* Classes object (keys are { list, item } to be applied to
|
|
49
|
+
* Classes object (keys are { list, item } to be applied to list and item elements)
|
|
46
50
|
* - Any valid class binding for each
|
|
47
51
|
*/
|
|
48
52
|
classes: {
|
|
@@ -82,8 +86,24 @@
|
|
|
82
86
|
* Define list style type (ie. disc, decimal, etc)
|
|
83
87
|
*/
|
|
84
88
|
listStyleType: String,
|
|
89
|
+
/**
|
|
90
|
+
* Element to render the list as (overrides ul/ol)
|
|
91
|
+
*/
|
|
92
|
+
element: String,
|
|
93
|
+
/**
|
|
94
|
+
* Element to render items as when using items array
|
|
95
|
+
*/
|
|
96
|
+
itemElement: {
|
|
97
|
+
type: String,
|
|
98
|
+
default: "li"
|
|
99
|
+
}
|
|
85
100
|
});
|
|
86
101
|
|
|
102
|
+
provide("uluListContext", computed(() => ({
|
|
103
|
+
classes: props.classes,
|
|
104
|
+
itemElement: props.itemElement
|
|
105
|
+
})));
|
|
106
|
+
|
|
87
107
|
const isOrdered = computed(() => props.ordered || props.forceOrdered);
|
|
88
|
-
const
|
|
89
|
-
</script>
|
|
108
|
+
const resolvedElement = computed(() => props.element || (isOrdered.value ? "ol" : "ul"));
|
|
109
|
+
</script>
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<component :is="resolvedElement" :class="[listClasses.item, classes]">
|
|
3
|
+
<slot></slot>
|
|
4
|
+
</component>
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<script setup>
|
|
8
|
+
import { computed, inject } from "vue";
|
|
9
|
+
|
|
10
|
+
const props = defineProps({
|
|
11
|
+
/**
|
|
12
|
+
* Optional class binding to append to the injected parent classes
|
|
13
|
+
*/
|
|
14
|
+
classes: [String, Array, Object],
|
|
15
|
+
/**
|
|
16
|
+
* The HTML element to render the item as
|
|
17
|
+
*/
|
|
18
|
+
element: String
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
const injectedContext = inject("uluListContext", { value: {} });
|
|
22
|
+
const listClasses = computed(() => injectedContext.value?.classes || {});
|
|
23
|
+
const resolvedElement = computed(() => props.element || injectedContext.value?.itemElement || "li");
|
|
24
|
+
</script>
|