@ulu/frontend-vue 0.1.0-beta.9 → 0.1.1-beta.1
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/{breakpoints-BbkGNxxt.js → breakpoints-DM-CBTtb.js} +1 -1
- package/dist/frontend-vue.css +1 -1
- package/dist/frontend-vue.js +79 -68
- package/dist/index-BNRZ3Apw.js +7541 -0
- package/lib/components/collapsible/UluAccordion.vue +71 -53
- package/lib/components/collapsible/UluAccordionGroup.vue +54 -0
- package/lib/components/collapsible/UluCollapsible.vue +144 -0
- package/lib/components/collapsible/UluDropdown.vue +29 -29
- package/lib/components/collapsible/UluOverflowPopover.vue +1 -1
- package/lib/components/elements/UluBadge.vue +51 -28
- package/lib/components/elements/UluBadgeStack.vue +8 -13
- package/lib/components/elements/UluButtonVerbose.vue +119 -0
- package/lib/components/elements/UluCard.vue +1 -1
- package/lib/components/elements/UluDefinitionList.vue +14 -17
- package/lib/components/elements/UluExternalLink.vue +21 -27
- package/lib/components/elements/UluIcon.vue +11 -1
- package/lib/components/elements/UluList.vue +53 -55
- package/lib/components/elements/UluSpokeSpinner.vue +12 -18
- package/lib/components/elements/UluTag.vue +35 -35
- package/lib/components/forms/UluFileDisplay.vue +49 -31
- package/lib/components/forms/UluFormFile.vue +37 -24
- package/lib/components/forms/UluFormMessage.vue +13 -10
- package/lib/components/forms/UluFormSelect.vue +28 -16
- package/lib/components/forms/UluFormText.vue +24 -15
- package/lib/components/forms/UluSearchForm.vue +11 -10
- package/lib/components/forms/UluSelectableMenu.vue +99 -0
- package/lib/components/index.js +4 -3
- package/lib/components/layout/UluTitleRail.vue +18 -0
- package/lib/components/layout/UluWhenBreakpoint.vue +9 -0
- package/lib/components/navigation/UluBreadcrumb.vue +9 -2
- package/lib/components/navigation/UluMenu.vue +8 -3
- package/lib/components/navigation/UluMenuStack.vue +3 -1
- package/lib/components/navigation/UluPager.vue +102 -0
- package/lib/components/systems/facets/ExampleFacetsWithPagination.vue +119 -0
- package/lib/components/systems/facets/UluFacetsFilterLists.vue +91 -0
- package/lib/components/systems/facets/UluFacetsFilterPopovers.vue +125 -0
- package/lib/components/systems/facets/UluFacetsFilterSelects.vue +71 -0
- package/lib/components/systems/facets/UluFacetsHeaderLayout.vue +24 -0
- package/lib/components/systems/facets/UluFacetsList.vue +62 -34
- package/lib/components/systems/facets/UluFacetsResults.vue +63 -0
- package/lib/components/systems/facets/UluFacetsSearch.vue +27 -50
- package/lib/components/systems/facets/UluFacetsSidebarLayout.vue +70 -0
- package/lib/components/systems/facets/UluFacetsSort.vue +45 -0
- package/lib/components/systems/facets/_facets.scss +2 -3
- package/lib/components/systems/facets/_mock-data.js +40 -0
- package/lib/components/systems/facets/useFacets.js +268 -0
- package/lib/components/systems/index.js +13 -2
- package/lib/components/systems/scroll-anchors/UluScrollAnchors.vue +2 -1
- package/lib/components/systems/skeleton/UluShowSkeleton.vue +9 -8
- package/lib/components/systems/skeleton/UluSkeletonContent.vue +39 -43
- package/lib/components/systems/skeleton/UluSkeletonMedia.vue +4 -6
- package/lib/components/systems/skeleton/UluSkeletonText.vue +27 -0
- package/lib/components/systems/slider/UluImageSlideShow.vue +1 -1
- package/lib/components/systems/slider/UluSlideShow.vue +8 -3
- package/lib/components/systems/table-sticky/UluTableSticky.vue +7 -7
- package/lib/components/systems/table-sticky/UluTableStickyTable.vue +3 -3
- package/lib/components/visualizations/UluAnimateNumber.vue +7 -1
- package/lib/components/visualizations/UluProgressBar.vue +99 -68
- package/lib/components/visualizations/UluProgressCircle.vue +146 -0
- package/lib/components/visualizations/progress-bar-examples.html +175 -0
- package/lib/composables/index.js +3 -1
- package/lib/composables/useDocumentTitle.js +61 -0
- package/lib/composables/usePagination.js +122 -0
- package/lib/index.js +1 -0
- package/lib/plugins/core/index.js +6 -1
- package/lib/plugins/popovers/UluPopover.vue +8 -3
- package/lib/plugins/toast/UluToast.vue +1 -1
- package/lib/plugins/toast/UluToastDisplay.vue +19 -2
- package/lib/utils/dom.js +12 -0
- package/lib/utils/index.js +2 -0
- package/lib/utils/{vue-router.js → router.js} +114 -30
- package/package.json +17 -11
- package/types/components/systems/facets/_mock-data.d.ts +18 -0
- package/types/components/systems/facets/_mock-data.d.ts.map +1 -0
- package/types/components/systems/facets/useFacets.d.ts +39 -0
- package/types/components/systems/facets/useFacets.d.ts.map +1 -0
- package/types/components/systems/index.d.ts +1 -1
- package/types/composables/index.d.ts +2 -0
- package/types/composables/useDocumentTitle.d.ts +22 -0
- package/types/composables/useDocumentTitle.d.ts.map +1 -0
- package/types/composables/usePageTitle.d.ts +19 -0
- package/types/composables/usePageTitle.d.ts.map +1 -0
- package/types/composables/usePagination.d.ts +25 -0
- package/types/composables/usePagination.d.ts.map +1 -0
- package/types/index.d.ts +1 -0
- package/types/plugins/core/index.d.ts.map +1 -1
- package/types/utils/dom.d.ts +1 -0
- package/types/utils/dom.d.ts.map +1 -1
- package/types/utils/index.d.ts +3 -0
- package/types/utils/index.d.ts.map +1 -0
- package/types/utils/router.d.ts +144 -0
- package/types/utils/router.d.ts.map +1 -0
- package/dist/index-D3Uc6T5M.js +0 -6469
- package/lib/components/collapsible/UluCollapsibleRegion.vue +0 -278
- package/lib/components/forms/UluCheckboxMenu.vue +0 -36
- package/lib/components/systems/facets/UluFacets.vue +0 -380
- package/lib/components/systems/skeleton/UluSkeletonTextInline.vue +0 -9
- package/lib/components/visualizations/UluProgressDonut.vue +0 -97
- package/lib/utils/placeholder.js +0 -6
|
@@ -13,19 +13,20 @@
|
|
|
13
13
|
class="search-form__submit button button--primary"
|
|
14
14
|
aria-label="Submit Search"
|
|
15
15
|
>
|
|
16
|
-
<
|
|
16
|
+
<UluIcon icon="type:search" />
|
|
17
17
|
</button>
|
|
18
18
|
</div>
|
|
19
19
|
</template>
|
|
20
20
|
|
|
21
|
-
<script>
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
21
|
+
<script setup>
|
|
22
|
+
import UluIcon from "../elements/UluIcon.vue";
|
|
23
|
+
defineProps({
|
|
24
|
+
/**
|
|
25
|
+
* The placeholder text for the search input.
|
|
26
|
+
*/
|
|
27
|
+
placeholder: {
|
|
28
|
+
type: String,
|
|
29
|
+
default: "Titles, keyword…"
|
|
29
30
|
}
|
|
30
|
-
};
|
|
31
|
+
});
|
|
31
32
|
</script>
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div
|
|
3
|
+
class="menu-stack form-theme"
|
|
4
|
+
:class="{ 'menu-stack--hide-inputs' : hideInputs }"
|
|
5
|
+
:role="groupRole"
|
|
6
|
+
:aria-labelledby="legendId"
|
|
7
|
+
>
|
|
8
|
+
<div v-if="legend" :id="legendId" class="hidden-visually">{{ legend }}</div>
|
|
9
|
+
<ul class="menu-stack__list">
|
|
10
|
+
<li class="menu-stack__item" v-for="option in options" :key="option.uid">
|
|
11
|
+
<div class="menu-stack__selectable">
|
|
12
|
+
<input
|
|
13
|
+
:type="type"
|
|
14
|
+
:id="getId(option)"
|
|
15
|
+
:name="name"
|
|
16
|
+
:value="option.uid"
|
|
17
|
+
:checked="isChecked(option)"
|
|
18
|
+
@change="handleChange(option, $event)"
|
|
19
|
+
>
|
|
20
|
+
<label :for="getId(option)">
|
|
21
|
+
<slot :option="option">
|
|
22
|
+
{{ option?.label || option?.title || option?.text }}
|
|
23
|
+
</slot>
|
|
24
|
+
</label>
|
|
25
|
+
</div>
|
|
26
|
+
</li>
|
|
27
|
+
</ul>
|
|
28
|
+
</div>
|
|
29
|
+
</template>
|
|
30
|
+
|
|
31
|
+
<script setup>
|
|
32
|
+
import { computed } from 'vue';
|
|
33
|
+
|
|
34
|
+
const props = defineProps({
|
|
35
|
+
/**
|
|
36
|
+
* The legend for the menu.
|
|
37
|
+
*/
|
|
38
|
+
legend: String,
|
|
39
|
+
/**
|
|
40
|
+
* An array of options for the menu.
|
|
41
|
+
*/
|
|
42
|
+
options: Array,
|
|
43
|
+
/**
|
|
44
|
+
* The type of input to use ('checkbox' or 'radio').
|
|
45
|
+
*/
|
|
46
|
+
type: {
|
|
47
|
+
type: String,
|
|
48
|
+
default: 'checkbox',
|
|
49
|
+
},
|
|
50
|
+
/**
|
|
51
|
+
* The value of the menu (for v-model).
|
|
52
|
+
*/
|
|
53
|
+
modelValue: [String, Array],
|
|
54
|
+
/**
|
|
55
|
+
* If true, the input elements will be visually hidden.
|
|
56
|
+
*/
|
|
57
|
+
hideInputs: Boolean
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
const emit = defineEmits(['update:modelValue']);
|
|
61
|
+
|
|
62
|
+
const name = computed(() => props.legend ? props.legend.toLowerCase().replace(/\s+/g, '-') : `menu-${ Math.random().toString(36).substring(7) }`);
|
|
63
|
+
const legendId = computed(() => name.value ? `${name.value}-legend` : null);
|
|
64
|
+
const groupRole = computed(() => props.type === 'radio' ? 'radiogroup' : 'group');
|
|
65
|
+
|
|
66
|
+
const getId = (option) => `${name.value}-${option.uid}`;
|
|
67
|
+
|
|
68
|
+
const isChecked = (option) => {
|
|
69
|
+
if (props.type === 'radio') {
|
|
70
|
+
return props.modelValue === option.uid;
|
|
71
|
+
}
|
|
72
|
+
if (Array.isArray(props.modelValue)) {
|
|
73
|
+
return props.modelValue.includes(option.uid);
|
|
74
|
+
}
|
|
75
|
+
if (props.type === 'checkbox') {
|
|
76
|
+
return option.checked || false;
|
|
77
|
+
}
|
|
78
|
+
return false;
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
const handleChange = (option, event) => {
|
|
82
|
+
if (props.type === 'radio') {
|
|
83
|
+
emit('update:modelValue', option.uid);
|
|
84
|
+
} else {
|
|
85
|
+
if (Array.isArray(props.modelValue)) {
|
|
86
|
+
const newValue = [...props.modelValue];
|
|
87
|
+
const index = newValue.indexOf(option.uid);
|
|
88
|
+
if (index > -1) {
|
|
89
|
+
newValue.splice(index, 1);
|
|
90
|
+
} else {
|
|
91
|
+
newValue.push(option.uid);
|
|
92
|
+
}
|
|
93
|
+
emit('update:modelValue', newValue);
|
|
94
|
+
} else {
|
|
95
|
+
option.checked = event.target.checked;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
</script>
|
package/lib/components/index.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* - Used in main plugin and bundle exports
|
|
5
5
|
*/
|
|
6
6
|
export { default as UluAccordion } from './collapsible/UluAccordion.vue';
|
|
7
|
-
export { default as
|
|
7
|
+
export { default as UluCollapsible } from './collapsible/UluCollapsible.vue';
|
|
8
8
|
export { default as UluDropdown } from './collapsible/UluDropdown.vue';
|
|
9
9
|
export { default as UluModal } from './collapsible/UluModal.vue';
|
|
10
10
|
export { default as UluOverflowPopover } from './collapsible/UluOverflowPopover.vue';
|
|
@@ -17,6 +17,7 @@ export { default as UluAlert } from './elements/UluAlert.vue';
|
|
|
17
17
|
export { default as UluBadge } from './elements/UluBadge.vue';
|
|
18
18
|
export { default as UluBadgeStack } from './elements/UluBadgeStack.vue';
|
|
19
19
|
export { default as UluButton } from './elements/UluButton.vue';
|
|
20
|
+
export { default as UluButtonVerbose } from './elements/UluButtonVerbose.vue';
|
|
20
21
|
export { default as UluCallout } from './elements/UluCallout.vue';
|
|
21
22
|
export { default as UluCard } from './elements/UluCard.vue';
|
|
22
23
|
export { default as UluDefinitionList } from './elements/UluDefinitionList.vue';
|
|
@@ -26,7 +27,7 @@ export { default as UluList } from './elements/UluList.vue';
|
|
|
26
27
|
export { default as UluMain } from './elements/UluMain.vue';
|
|
27
28
|
export { default as UluSpokeSpinner } from './elements/UluSpokeSpinner.vue';
|
|
28
29
|
export { default as UluTag } from './elements/UluTag.vue';
|
|
29
|
-
export { default as
|
|
30
|
+
export { default as UluSelectableMenu } from './forms/UluSelectableMenu.vue';
|
|
30
31
|
export { default as UluFileDisplay } from './forms/UluFileDisplay.vue';
|
|
31
32
|
export { default as UluFormFile } from './forms/UluFormFile.vue';
|
|
32
33
|
export { default as UluFormMessage } from './forms/UluFormMessage.vue';
|
|
@@ -49,5 +50,5 @@ export { default as UluPlaceholderText } from './utils/UluPlaceholderText.vue';
|
|
|
49
50
|
export { default as UluRouteAnnouncer } from './utils/UluRouteAnnouncer.vue';
|
|
50
51
|
export { default as UluAnimateNumber } from './visualizations/UluAnimateNumber.vue';
|
|
51
52
|
export { default as UluProgressBar } from './visualizations/UluProgressBar.vue';
|
|
52
|
-
export { default as
|
|
53
|
+
export { default as UluProgressCircle } from './visualizations/UluProgressCircle.vue';
|
|
53
54
|
export * from './systems/index.js';
|
|
@@ -37,11 +37,20 @@
|
|
|
37
37
|
UluIcon
|
|
38
38
|
},
|
|
39
39
|
props: {
|
|
40
|
+
/**
|
|
41
|
+
* Icon to display next to the title.
|
|
42
|
+
*/
|
|
40
43
|
icon: String,
|
|
44
|
+
/**
|
|
45
|
+
* The alignment of the icon with the title.
|
|
46
|
+
*/
|
|
41
47
|
iconAlign: {
|
|
42
48
|
type: String,
|
|
43
49
|
default: "baseline"
|
|
44
50
|
},
|
|
51
|
+
/**
|
|
52
|
+
* Classes for the different elements in the component.
|
|
53
|
+
*/
|
|
45
54
|
classes: {
|
|
46
55
|
type: Object,
|
|
47
56
|
default: () => ({
|
|
@@ -49,11 +58,20 @@
|
|
|
49
58
|
icon: "margin-right-small"
|
|
50
59
|
})
|
|
51
60
|
},
|
|
61
|
+
/**
|
|
62
|
+
* The title to display.
|
|
63
|
+
*/
|
|
52
64
|
title: String,
|
|
65
|
+
/**
|
|
66
|
+
* The HTML element to use for the title.
|
|
67
|
+
*/
|
|
53
68
|
titleElement: {
|
|
54
69
|
type: String,
|
|
55
70
|
default: "h2"
|
|
56
71
|
},
|
|
72
|
+
/**
|
|
73
|
+
* If true, a rule will be displayed under the title.
|
|
74
|
+
*/
|
|
57
75
|
rule: Boolean
|
|
58
76
|
}
|
|
59
77
|
}
|
|
@@ -7,8 +7,17 @@
|
|
|
7
7
|
import { useRequiredInject } from '../../composables/useRequiredInject.js';
|
|
8
8
|
|
|
9
9
|
const props = defineProps({
|
|
10
|
+
/**
|
|
11
|
+
* The maximum breakpoint to show the content at.
|
|
12
|
+
*/
|
|
10
13
|
max: String,
|
|
14
|
+
/**
|
|
15
|
+
* The minimum breakpoint to show the content at.
|
|
16
|
+
*/
|
|
11
17
|
min: String,
|
|
18
|
+
/**
|
|
19
|
+
* Only show the content at this breakpoint.
|
|
20
|
+
*/
|
|
12
21
|
only: String,
|
|
13
22
|
});
|
|
14
23
|
|
|
@@ -4,9 +4,10 @@
|
|
|
4
4
|
aria-label="Breadcrumb"
|
|
5
5
|
v-if="items.length"
|
|
6
6
|
>
|
|
7
|
-
<
|
|
7
|
+
<ol :class="classes.list">
|
|
8
8
|
<li v-for="(item, index) in items" :key="index" :class="classes.item">
|
|
9
9
|
<router-link
|
|
10
|
+
v-if="!item.current"
|
|
10
11
|
:to="item.to"
|
|
11
12
|
:class="classes.link"
|
|
12
13
|
:aria-current="item.current ? 'page' : null"
|
|
@@ -15,6 +16,11 @@
|
|
|
15
16
|
{{ item.title }}
|
|
16
17
|
</slot>
|
|
17
18
|
</router-link>
|
|
19
|
+
<span v-else :class="item.current">
|
|
20
|
+
<slot :item="item">
|
|
21
|
+
{{ item.title }}
|
|
22
|
+
</slot>
|
|
23
|
+
</span>
|
|
18
24
|
<template v-if="index < items.length - 1">
|
|
19
25
|
<slot name="separator">
|
|
20
26
|
<UluIcon
|
|
@@ -24,7 +30,7 @@
|
|
|
24
30
|
</slot>
|
|
25
31
|
</template>
|
|
26
32
|
</li>
|
|
27
|
-
</
|
|
33
|
+
</ol>
|
|
28
34
|
</nav>
|
|
29
35
|
</template>
|
|
30
36
|
|
|
@@ -63,6 +69,7 @@
|
|
|
63
69
|
list: "breadcrumb__list",
|
|
64
70
|
item: "breadcrumb__item",
|
|
65
71
|
link: "breadcrumb__link",
|
|
72
|
+
current: "breadcrumb__current",
|
|
66
73
|
separator: "breadcrumb__separator"
|
|
67
74
|
})
|
|
68
75
|
}
|
|
@@ -3,7 +3,12 @@
|
|
|
3
3
|
<li
|
|
4
4
|
v-for="(item, index) in items"
|
|
5
5
|
:key="index"
|
|
6
|
-
:class="[
|
|
6
|
+
:class="[
|
|
7
|
+
classes.item,
|
|
8
|
+
item?.classes?.item,
|
|
9
|
+
item.separatorBefore ? classes.itemSeparatorBefore : '',
|
|
10
|
+
item.separatorAfter ? classes.itemSeparatorAfter : ''
|
|
11
|
+
]"
|
|
7
12
|
>
|
|
8
13
|
<!--
|
|
9
14
|
Note: The ternary spread method below is conditionally adding certain
|
|
@@ -60,7 +65,7 @@
|
|
|
60
65
|
/**
|
|
61
66
|
* Fired anytime a item is clicked
|
|
62
67
|
*/
|
|
63
|
-
"
|
|
68
|
+
"item-click"
|
|
64
69
|
],
|
|
65
70
|
props: {
|
|
66
71
|
/**
|
|
@@ -98,7 +103,7 @@
|
|
|
98
103
|
if (item.click) {
|
|
99
104
|
item.click(event);
|
|
100
105
|
}
|
|
101
|
-
this.$emit("
|
|
106
|
+
this.$emit("item-click", { item, event });
|
|
102
107
|
}
|
|
103
108
|
}
|
|
104
109
|
};
|
|
@@ -13,7 +13,9 @@
|
|
|
13
13
|
item: 'menu-stack__item',
|
|
14
14
|
link: 'menu-stack__link',
|
|
15
15
|
linkText: 'menu-stack__link-text',
|
|
16
|
-
linkIcon: 'menu-stack__link-icon'
|
|
16
|
+
linkIcon: 'menu-stack__link-icon',
|
|
17
|
+
itemSeparatorBefore: 'menu-stack__item--separator-before',
|
|
18
|
+
itemSeparatorAfter: 'menu-stack__item--separator-after'
|
|
17
19
|
}"
|
|
18
20
|
:noChildren="noChildren"
|
|
19
21
|
/>
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<nav v-if="items" class="pager" role="navigation" :aria-labelledby="headingId">
|
|
3
|
+
<component :is="titleElement" :id="headingId" class="hidden-visually">Pagination</component>
|
|
4
|
+
<ul class="pager__items js-pager__items">
|
|
5
|
+
<!-- First page link -->
|
|
6
|
+
<li v-if="items.first" class="pager__item pager__item--first">
|
|
7
|
+
<router-link :to="items.first.href" title="Go to first page" v-bind="items.first.attributes">
|
|
8
|
+
<span class="hidden-visually">First page</span>
|
|
9
|
+
<UluIcon icon="fas fa-angle-double-left" aria-hidden="true" />
|
|
10
|
+
</router-link>
|
|
11
|
+
</li>
|
|
12
|
+
|
|
13
|
+
<!-- Previous page link -->
|
|
14
|
+
<li v-if="items.previous" class="pager__item pager__item--previous">
|
|
15
|
+
<router-link :to="items.previous.href" title="Go to previous page" rel="prev" v-bind="items.previous.attributes">
|
|
16
|
+
<span class="hidden-visually">Previous page</span>
|
|
17
|
+
<UluIcon icon="fas fa-angle-left" aria-hidden="true" />
|
|
18
|
+
</router-link>
|
|
19
|
+
</li>
|
|
20
|
+
|
|
21
|
+
<!-- Ellipsis for previous pages -->
|
|
22
|
+
<li v-if="ellipses.previous" class="pager__item pager__item--ellipsis" role="presentation">…</li>
|
|
23
|
+
|
|
24
|
+
<!-- Page number links -->
|
|
25
|
+
<li v-for="(item, key) in items.pages" :key="key" :class="['pager__item', { 'is-active': current == key }]">
|
|
26
|
+
<router-link :to="item.href" :title="getPageTitle(key)" v-bind="item.attributes">
|
|
27
|
+
<span class="hidden-visually">
|
|
28
|
+
{{ current == key ? 'Current page' : 'Page' }}
|
|
29
|
+
</span>
|
|
30
|
+
{{ key }}
|
|
31
|
+
</router-link>
|
|
32
|
+
</li>
|
|
33
|
+
|
|
34
|
+
<!-- Ellipsis for next pages -->
|
|
35
|
+
<li v-if="ellipses.next" class="pager__item pager__item--ellipsis" role="presentation">…</li>
|
|
36
|
+
|
|
37
|
+
<!-- Next page link -->
|
|
38
|
+
<li v-if="items.next" class="pager__item pager__item--next">
|
|
39
|
+
<router-link :to="items.next.href" title="Go to next page" rel="next" v-bind="items.next.attributes">
|
|
40
|
+
<span class="hidden-visually">Next page</span>
|
|
41
|
+
<UluIcon icon="fas fa-angle-right" aria-hidden="true" />
|
|
42
|
+
</router-link>
|
|
43
|
+
</li>
|
|
44
|
+
|
|
45
|
+
<!-- Last page link -->
|
|
46
|
+
<li v-if="items.last" class="pager__item pager__item--last">
|
|
47
|
+
<router-link :to="items.last.href" title="Go to last page" v-bind="items.last.attributes">
|
|
48
|
+
<span class="hidden-visually">Last page</span>
|
|
49
|
+
<UluIcon icon="fas fa-angle-double-right" aria-hidden="true" />
|
|
50
|
+
</router-link>
|
|
51
|
+
</li>
|
|
52
|
+
</ul>
|
|
53
|
+
</nav>
|
|
54
|
+
</template>
|
|
55
|
+
|
|
56
|
+
<script setup>
|
|
57
|
+
import UluIcon from '../elements/UluIcon.vue';
|
|
58
|
+
|
|
59
|
+
let pagerCounter = 0;
|
|
60
|
+
|
|
61
|
+
const props = defineProps({
|
|
62
|
+
/**
|
|
63
|
+
* The HTML element to use for the visually hidden title.
|
|
64
|
+
*/
|
|
65
|
+
titleElement: {
|
|
66
|
+
type: String,
|
|
67
|
+
default: 'h4'
|
|
68
|
+
},
|
|
69
|
+
/**
|
|
70
|
+
* List of pager items.
|
|
71
|
+
*/
|
|
72
|
+
items: {
|
|
73
|
+
type: Object,
|
|
74
|
+
default: () => ({})
|
|
75
|
+
},
|
|
76
|
+
/**
|
|
77
|
+
* The page number of the current page.
|
|
78
|
+
*/
|
|
79
|
+
current: {
|
|
80
|
+
type: Number,
|
|
81
|
+
default: 1
|
|
82
|
+
},
|
|
83
|
+
/**
|
|
84
|
+
* Ellipses configuration.
|
|
85
|
+
*/
|
|
86
|
+
ellipses: {
|
|
87
|
+
type: Object,
|
|
88
|
+
default: () => ({})
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
const headingId = `ulu-pager-${ pagerCounter++ }`;
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Generates the title for a page link.
|
|
96
|
+
* @param {string|number} key - The page number.
|
|
97
|
+
* @returns {string} The title for the page link.
|
|
98
|
+
*/
|
|
99
|
+
function getPageTitle(key) {
|
|
100
|
+
return props.current == key ? 'Current page' : `Go to page ${key}`;
|
|
101
|
+
}
|
|
102
|
+
</script>
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="BibliographyList">
|
|
3
|
+
<LayoutListPage title="Bibliography" icon="type:bibliography">
|
|
4
|
+
<template #intro>
|
|
5
|
+
<AppContent uid="bibliographyIntroduction" />
|
|
6
|
+
</template>
|
|
7
|
+
<template #default>
|
|
8
|
+
<UluFacetsSidebarLayout>
|
|
9
|
+
<template #sidebar>
|
|
10
|
+
<UluFacetsSearch v-model="searchValue" />
|
|
11
|
+
<UluFacetsSort v-model="selectedSort" :sort-types="sortTypes" />
|
|
12
|
+
<UluFacetsFilterLists :facets="facets" @facet-change="handleFacetChange" />
|
|
13
|
+
</template>
|
|
14
|
+
<template #main>
|
|
15
|
+
<UluFacetsResults :items="paginatedItems">
|
|
16
|
+
<template #item="{ item }">
|
|
17
|
+
<div class="source-item">
|
|
18
|
+
<h3>{{ item.title || "NO TITLE" }}</h3>
|
|
19
|
+
<div>
|
|
20
|
+
<PortableText v-if="item.citation" :value="item.citation" />
|
|
21
|
+
</div>
|
|
22
|
+
<small v-if="item.publicationDate">Published on: {{ item.publicationDate }}</small>
|
|
23
|
+
</div>
|
|
24
|
+
</template>
|
|
25
|
+
</UluFacetsResults>
|
|
26
|
+
<UluPager
|
|
27
|
+
v-if="totalPages > 1"
|
|
28
|
+
:items="pagerItems"
|
|
29
|
+
:current="currentPage"
|
|
30
|
+
:ellipses="pagerEllipses"
|
|
31
|
+
class="mt-4"
|
|
32
|
+
/>
|
|
33
|
+
</template>
|
|
34
|
+
</UluFacetsSidebarLayout>
|
|
35
|
+
</template>
|
|
36
|
+
</LayoutListPage>
|
|
37
|
+
</div>
|
|
38
|
+
</template>
|
|
39
|
+
|
|
40
|
+
<script setup>
|
|
41
|
+
import { ref } from "vue";
|
|
42
|
+
import { PortableText } from "@portabletext/vue";
|
|
43
|
+
import sources from "@/api/virtual/sources.js?virtual-module";
|
|
44
|
+
import {
|
|
45
|
+
useFacets,
|
|
46
|
+
usePagination,
|
|
47
|
+
UluFacetsSidebarLayout,
|
|
48
|
+
UluFacetsFilterLists,
|
|
49
|
+
UluFacetsSort,
|
|
50
|
+
UluFacetsSearch,
|
|
51
|
+
UluFacetsResults
|
|
52
|
+
} from "@ulu/frontend-vue";
|
|
53
|
+
|
|
54
|
+
const sorterDateLatest = (a, b) => new Date(b.publicationDate) - new Date(a.publicationDate);
|
|
55
|
+
|
|
56
|
+
const config = {
|
|
57
|
+
facetFields: [
|
|
58
|
+
{ name: "Chapters", uid: "chapters", open: false, getValue: item => item.chapters?.map(c => c.uuid) },
|
|
59
|
+
{ name: "Types", uid: "types", open: true },
|
|
60
|
+
{ name: "Topics", uid: "topics", open: true },
|
|
61
|
+
{ name: "Citation Type", uid: "citationType", open: true },
|
|
62
|
+
{ name: "Source Type", uid: "sourceType", open: true },
|
|
63
|
+
{ name: "Authors", uid: "authors", open: false },
|
|
64
|
+
{ name: "Source Name", uid: "sourceName", open: false }
|
|
65
|
+
],
|
|
66
|
+
extraSortTypes: {
|
|
67
|
+
newest: {
|
|
68
|
+
text: "Date (Newest)",
|
|
69
|
+
sort: items => [...items].sort(sorterDateLatest)
|
|
70
|
+
},
|
|
71
|
+
oldest: {
|
|
72
|
+
text: "Date (Oldest)",
|
|
73
|
+
sort: items => [...items].sort(sorterDateLatest).reverse()
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
initialSortType: "az",
|
|
77
|
+
// Remove quotes and stuff from beginning when sorting
|
|
78
|
+
getSortValue: item => item.title ? item.title.replace(/^[^A-Za-z0-9]+/, "") : "",
|
|
79
|
+
searchOptions: {
|
|
80
|
+
keys: ["title", "authors", "sourceName", "topics", "types", "citation"]
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
const itemsPerPage = 20;
|
|
85
|
+
|
|
86
|
+
const {
|
|
87
|
+
facets,
|
|
88
|
+
searchValue,
|
|
89
|
+
selectedSort,
|
|
90
|
+
sortTypes,
|
|
91
|
+
displayItems,
|
|
92
|
+
handleFacetChange,
|
|
93
|
+
} = useFacets(ref(sources), config);
|
|
94
|
+
|
|
95
|
+
const {
|
|
96
|
+
currentPage,
|
|
97
|
+
totalPages,
|
|
98
|
+
paginatedItems,
|
|
99
|
+
pagerItems,
|
|
100
|
+
pagerEllipses
|
|
101
|
+
} = usePagination(displayItems, itemsPerPage);
|
|
102
|
+
</script>
|
|
103
|
+
|
|
104
|
+
<style lang="scss">
|
|
105
|
+
// Add some basic styling for the item display
|
|
106
|
+
.source-item {
|
|
107
|
+
padding: 1rem;
|
|
108
|
+
border-bottom: 1px solid #eee;
|
|
109
|
+
|
|
110
|
+
h3 {
|
|
111
|
+
margin: 0 0 0.5rem;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
p {
|
|
115
|
+
margin: 0 0 0.5rem;
|
|
116
|
+
font-style: italic;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
</style>
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="UluFacetsFilters">
|
|
3
|
+
<UluCollapsible
|
|
4
|
+
class="ulu-facets__group"
|
|
5
|
+
v-for="group in facets"
|
|
6
|
+
:key="group.uid"
|
|
7
|
+
:classes="{
|
|
8
|
+
container: ['ulu-facets__group', classes.group],
|
|
9
|
+
trigger: ['ulu-facets__group-toggle', classes.groupToggle],
|
|
10
|
+
content: ['ulu-facets__group-content', classes.groupContent]
|
|
11
|
+
}"
|
|
12
|
+
:startOpen="group.open"
|
|
13
|
+
>
|
|
14
|
+
<template #trigger="{ isOpen }">
|
|
15
|
+
<slot name="groupToggle" :group="group" :isOpen="isOpen">
|
|
16
|
+
{{ group.name }}
|
|
17
|
+
</slot>
|
|
18
|
+
</template>
|
|
19
|
+
<template #default>
|
|
20
|
+
<UluFacetsList
|
|
21
|
+
:children="group.children.slice(0, maxVisible)"
|
|
22
|
+
:groupUid="group.uid"
|
|
23
|
+
:groupName="group.name"
|
|
24
|
+
:type="group.multiple ? 'checkbox' : 'radio'"
|
|
25
|
+
:model-value="selectedUids(group)"
|
|
26
|
+
@facet-change="emit('facet-change', $event)"
|
|
27
|
+
/>
|
|
28
|
+
<UluCollapsible
|
|
29
|
+
v-if="group.children.length > maxVisible"
|
|
30
|
+
class="ulu-facets__more-facets"
|
|
31
|
+
:class="classes.moreFacets"
|
|
32
|
+
:clickOutsideCloses="false"
|
|
33
|
+
:closeOnEscape="false"
|
|
34
|
+
:transitionHeight="true"
|
|
35
|
+
>
|
|
36
|
+
<template #trigger="{ isOpen }">
|
|
37
|
+
{{ isOpen ? "View Less" : "Show More" }}
|
|
38
|
+
</template>
|
|
39
|
+
<template #default>
|
|
40
|
+
<UluFacetsList
|
|
41
|
+
:children="group.children.slice(maxVisible)"
|
|
42
|
+
:groupUid="group.uid"
|
|
43
|
+
:groupName="group.name"
|
|
44
|
+
:type="group.multiple ? 'checkbox' : 'radio'"
|
|
45
|
+
:model-value="selectedUids(group)"
|
|
46
|
+
@facet-change="emit('facet-change', $event)"
|
|
47
|
+
/>
|
|
48
|
+
</template>
|
|
49
|
+
</UluCollapsible>
|
|
50
|
+
</template>
|
|
51
|
+
</UluCollapsible>
|
|
52
|
+
</div>
|
|
53
|
+
</template>
|
|
54
|
+
|
|
55
|
+
<script setup>
|
|
56
|
+
import UluFacetsList from "./UluFacetsList.vue";
|
|
57
|
+
import UluCollapsible from "../../collapsible/UluCollapsible.vue";
|
|
58
|
+
|
|
59
|
+
defineProps({
|
|
60
|
+
/**
|
|
61
|
+
* An object of classes to apply to the component.
|
|
62
|
+
*/
|
|
63
|
+
classes: {
|
|
64
|
+
type: Object,
|
|
65
|
+
default: () => ({})
|
|
66
|
+
},
|
|
67
|
+
/**
|
|
68
|
+
* The maximum number of facets to show before showing the "More" button.
|
|
69
|
+
*/
|
|
70
|
+
maxVisible: {
|
|
71
|
+
type: Number,
|
|
72
|
+
default: 5
|
|
73
|
+
},
|
|
74
|
+
/**
|
|
75
|
+
* An array of facet groups to display.
|
|
76
|
+
*/
|
|
77
|
+
facets: {
|
|
78
|
+
type: Array,
|
|
79
|
+
default: () => []
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
const emit = defineEmits(['facet-change']);
|
|
84
|
+
|
|
85
|
+
const selectedUids = (group) => {
|
|
86
|
+
if (group.multiple) {
|
|
87
|
+
return group.children.filter(c => c.selected).map(c => c.uid);
|
|
88
|
+
}
|
|
89
|
+
return group.children.find(c => c.selected)?.uid || '';
|
|
90
|
+
};
|
|
91
|
+
</script>
|