@saooti/octopus-sdk 40.2.19 → 41.0.0
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/index.ts +2 -1
- package/package.json +4 -3
- package/src/App.vue +71 -95
- package/src/components/composable/player/usePlayerLive.ts +13 -4
- package/src/components/composable/player/usePlayerLogic.ts +6 -6
- package/src/components/composable/player/usePlayerVast.ts +7 -7
- package/src/components/composable/podcasts/usePodcastView.ts +3 -3
- package/src/components/composable/route/useAdvancedParamInit.ts +1 -1
- package/src/components/composable/route/useRouteUpdateParams.ts +4 -4
- package/src/components/composable/route/useSimplePageParam.ts +15 -8
- package/src/components/composable/useInit.ts +2 -2
- package/src/components/composable/useMetaTitleWatch.ts +2 -2
- package/src/components/display/accessibility/AccessibilityModal.vue +56 -68
- package/src/components/display/categories/CategoryChooser.vue +144 -145
- package/src/components/display/categories/CategoryFilter.vue +172 -198
- package/src/components/display/categories/CategoryList.vue +122 -147
- package/src/components/display/comments/CommentInput.vue +100 -122
- package/src/components/display/comments/CommentList.vue +169 -191
- package/src/components/display/comments/CommentName.vue +35 -45
- package/src/components/display/comments/CommentParentInfo.vue +28 -34
- package/src/components/display/comments/CommentPlayer.vue +38 -50
- package/src/components/display/comments/CommentSection.vue +85 -103
- package/src/components/display/comments/item/CommentBasicView.vue +48 -61
- package/src/components/display/comments/item/CommentItem.vue +104 -115
- package/src/components/display/comments/item/CommentMoreActions.vue +174 -189
- package/src/components/display/comments/item/CommentMoreActionsAdmin.vue +1 -3
- package/src/components/display/comments/like/LikeButton.vue +36 -41
- package/src/components/display/comments/like/LikeSection.vue +128 -136
- package/src/components/display/comments/modal/CheckIdentityModal.vue +35 -40
- package/src/components/display/comments/modal/EditCommentModal.vue +72 -78
- package/src/components/display/comments/modal/RecaptchaModal.vue +58 -63
- package/src/components/display/comments/modal/ReportAbuseModal.vue +59 -66
- package/src/components/display/edit/EditBox.vue +9 -8
- package/src/components/display/edit/EditBoxRadio.vue +1 -5
- package/src/components/display/emission/EmissionInlineList.vue +82 -97
- package/src/components/display/emission/EmissionItem.vue +57 -69
- package/src/components/display/emission/EmissionList.vue +189 -218
- package/src/components/display/emission/EmissionPlayerItem.vue +47 -64
- package/src/components/display/emission/EmissionPresentationItem.vue +44 -54
- package/src/components/display/emission/EmissionPresentationList.vue +51 -61
- package/src/components/display/filter/AdvancedSearch.vue +151 -176
- package/src/components/display/filter/CategorySearchFilter.vue +43 -46
- package/src/components/display/filter/DateFilter.vue +76 -91
- package/src/components/display/filter/MonetizableFilter.vue +27 -30
- package/src/components/display/filter/ProductorSearch.vue +87 -90
- package/src/components/display/filter/RubriqueChoice.vue +58 -63
- package/src/components/display/filter/RubriqueFilter.vue +154 -169
- package/src/components/display/filter/SearchOrder.vue +35 -35
- package/src/components/display/list/ListPaginate.vue +72 -93
- package/src/components/display/list/PaginateParams.vue +36 -40
- package/src/components/display/list/PaginateSection.vue +113 -124
- package/src/components/display/list/SwiperList.vue +97 -109
- package/src/components/display/live/CountDown.vue +15 -9
- package/src/components/display/live/CountdownOctopus.vue +16 -10
- package/src/components/display/live/LiveHorizontalList.vue +95 -103
- package/src/components/display/live/LiveItem.vue +64 -73
- package/src/components/display/live/LiveList.vue +125 -137
- package/src/components/display/live/RadioCurrently.vue +66 -73
- package/src/components/display/live/RadioImage.vue +39 -50
- package/src/components/display/live/RadioItem.vue +9 -14
- package/src/components/display/live/RadioList.vue +39 -53
- package/src/components/display/live/RadioPlanning.vue +210 -222
- package/src/components/display/organisation/OrganisationChooser.vue +116 -122
- package/src/components/display/organisation/OrganisationChooserLight.vue +44 -52
- package/src/components/display/participant/ParticipantInlineList.vue +42 -58
- package/src/components/display/participant/ParticipantItem.vue +66 -74
- package/src/components/display/participant/ParticipantList.vue +116 -141
- package/src/components/display/playlist/PlaylistItem.vue +33 -46
- package/src/components/display/playlist/PlaylistList.vue +115 -144
- package/src/components/display/playlist/PodcastList.vue +90 -103
- package/src/components/display/playlist/PodcastPlaylistInlineList.vue +58 -70
- package/src/components/display/podcastmaker/PodcastmakerHeader.vue +21 -22
- package/src/components/display/podcasts/AnimatorsItem.vue +15 -16
- package/src/components/display/podcasts/DownloadPodcastButton.vue +21 -29
- package/src/components/display/podcasts/ParticipantDescription.vue +22 -24
- package/src/components/display/podcasts/PodcastFilterList.vue +62 -56
- package/src/components/display/podcasts/PodcastImage.vue +96 -99
- package/src/components/display/podcasts/PodcastInlineList.vue +30 -28
- package/src/components/display/podcasts/PodcastInlineListTemplate.vue +107 -114
- package/src/components/display/podcasts/PodcastIsPlaying.vue +4 -12
- package/src/components/display/podcasts/PodcastItem.vue +48 -63
- package/src/components/display/podcasts/PodcastItemInfo.vue +19 -35
- package/src/components/display/podcasts/PodcastList.vue +182 -206
- package/src/components/display/podcasts/PodcastModuleBox.vue +100 -137
- package/src/components/display/podcasts/PodcastPlannedSpinner.vue +4 -6
- package/src/components/display/podcasts/PodcastPlayBar.vue +50 -61
- package/src/components/display/podcasts/PodcastPlayBasicButton.vue +38 -41
- package/src/components/display/podcasts/PodcastPlayButton.vue +164 -175
- package/src/components/display/podcasts/PodcastRawTranscript.vue +69 -80
- package/src/components/display/podcasts/PodcastRubriqueList.vue +35 -38
- package/src/components/display/podcasts/PodcastSwiperList.vue +100 -110
- package/src/components/display/podcasts/TagList.vue +48 -50
- package/src/components/display/podcasts/VideoModuleBox.vue +13 -24
- package/src/components/display/rubriques/RubriqueChooser.vue +135 -140
- package/src/components/display/rubriques/RubriqueList.vue +140 -160
- package/src/components/display/sharing/ChooseEpisodesNumber.vue +34 -33
- package/src/components/display/sharing/FormatSwitch.vue +16 -11
- package/src/components/display/sharing/PlayerAnonymousModal.vue +24 -27
- package/src/components/display/sharing/PlayerCommonParameters.vue +20 -13
- package/src/components/display/sharing/PlayerParameters.vue +69 -71
- package/src/components/display/sharing/QrCode.vue +55 -67
- package/src/components/display/sharing/ShareAnonymous.vue +160 -178
- package/src/components/display/sharing/ShareDistribution.vue +103 -117
- package/src/components/display/sharing/ShareNewsletter.vue +154 -161
- package/src/components/display/sharing/SharePlayer.vue +273 -295
- package/src/components/display/sharing/SharePlayerColors.vue +25 -16
- package/src/components/display/sharing/SharePlayerRadio.vue +61 -69
- package/src/components/display/sharing/SharePlayerTypes.vue +176 -176
- package/src/components/display/sharing/ShareSocialsButtons.vue +63 -75
- package/src/components/display/sharing/SubscribeButtons.vue +184 -207
- package/src/components/display/studio/RecordingItemButton.vue +1 -4
- package/src/components/form/ClassicCheckbox.vue +26 -30
- package/src/components/form/ClassicContentEditable.vue +37 -33
- package/src/components/form/ClassicCopyButton.vue +40 -44
- package/src/components/form/ClassicDatePicker.vue +114 -114
- package/src/components/form/ClassicEmojiPicker.vue +20 -28
- package/src/components/form/ClassicInputText.vue +116 -120
- package/src/components/form/ClassicLoading.vue +7 -12
- package/src/components/form/ClassicMultiselect.vue +115 -117
- package/src/components/form/ClassicRadio.vue +21 -16
- package/src/components/form/ClassicRadioLabel.vue +23 -22
- package/src/components/form/ClassicSearch.vue +24 -19
- package/src/components/form/ClassicSelect.vue +47 -38
- package/src/components/form/ClassicWysiwyg.vue +116 -123
- package/src/components/icons/AmazonMusicIcon.vue +7 -10
- package/src/components/icons/ApplePodcastIcon.vue +7 -11
- package/src/components/icons/BlueSkyIcon.vue +8 -11
- package/src/components/icons/DeezerIcon.vue +8 -11
- package/src/components/icons/EditFtpIcon.vue +8 -11
- package/src/components/icons/IHeartIcon.vue +8 -11
- package/src/components/icons/PlayVideoIcon.vue +7 -10
- package/src/components/icons/PlayerFmIcon.vue +7 -10
- package/src/components/icons/PocketCastIcon.vue +8 -11
- package/src/components/icons/PodcastAddictIcon.vue +7 -10
- package/src/components/icons/RadiolineIcon.vue +8 -11
- package/src/components/icons/TuninIcon.vue +8 -11
- package/src/components/icons/XIcon.vue +7 -10
- package/src/components/misc/AcpmImage.vue +6 -7
- package/src/components/misc/ClassicAccordion.vue +26 -31
- package/src/components/misc/ClassicLazy.vue +86 -90
- package/src/components/misc/ClassicNav.vue +16 -20
- package/src/components/misc/ClassicPopover.vue +271 -282
- package/src/components/misc/ClassicSpinner.vue +5 -27
- package/src/components/misc/ErrorMessage.vue +11 -12
- package/src/components/misc/FooterGarSection.vue +33 -41
- package/src/components/misc/FooterSection.vue +94 -131
- package/src/components/misc/HomeDropdown.vue +83 -105
- package/src/components/misc/MobileMenu.vue +101 -111
- package/src/components/misc/ProgressBar.vue +53 -62
- package/src/components/misc/TopBar.vue +98 -120
- package/src/components/misc/TopBarMainContent.vue +114 -133
- package/src/components/misc/modal/ClassicModal.vue +40 -33
- package/src/components/misc/modal/ClassicModalInBody.vue +34 -28
- package/src/components/misc/modal/ClipboardModal.vue +27 -30
- package/src/components/misc/modal/ContractPreviewModal.vue +64 -62
- package/src/components/misc/modal/MessageModal.vue +50 -47
- package/src/components/misc/modal/NewsletterModal.vue +30 -31
- package/src/components/misc/modal/QrCodeModal.vue +21 -21
- package/src/components/misc/modal/ShareModalPlayer.vue +43 -52
- package/src/components/misc/player/PlayerCompact.vue +6 -4
- package/src/components/misc/player/PlayerComponent.vue +8 -9
- package/src/components/misc/player/PlayerLarge.vue +9 -8
- package/src/components/misc/player/ads/AdsProgressBar.vue +8 -11
- package/src/components/misc/player/ads/AdsSkipButton.vue +24 -30
- package/src/components/misc/player/chaptering/ChapteringModal.vue +44 -54
- package/src/components/misc/player/chaptering/PlayerChaptering.vue +50 -62
- package/src/components/misc/player/elements/PlayerImage.vue +51 -57
- package/src/components/misc/player/elements/PlayerPlayButton.vue +81 -92
- package/src/components/misc/player/elements/PlayerSpeedButton.vue +23 -27
- package/src/components/misc/player/elements/PlayerTitle.vue +85 -111
- package/src/components/misc/player/progressbar/PlayerProgressBar.vue +18 -29
- package/src/components/misc/player/progressbar/PodcastProgressBar.vue +45 -56
- package/src/components/misc/player/radio/RadioHistory.vue +80 -99
- package/src/components/misc/player/radio/RadioProgressBar.vue +43 -54
- package/src/components/misc/player/video/PlayerVideo.vue +27 -40
- package/src/components/misc/player/video/PlayerVideoDigiteka.vue +32 -37
- package/src/components/misc/player/video/PlayerVideoHls.vue +199 -198
- package/src/components/misc/player/video/PlayerYoutubeEmbed.vue +10 -12
- package/src/components/pages/CategoryPage.vue +28 -33
- package/src/components/pages/EmissionPage.vue +113 -132
- package/src/components/pages/EmissionsPage.vue +2 -0
- package/src/components/pages/Error403Page.vue +21 -20
- package/src/components/pages/HomePage.vue +91 -100
- package/src/components/pages/LivesPage.vue +35 -37
- package/src/components/pages/MapPage.vue +209 -241
- package/src/components/pages/PageLogout.vue +8 -11
- package/src/components/pages/PageNotFound.vue +9 -5
- package/src/components/pages/ParticipantPage.vue +96 -110
- package/src/components/pages/ParticipantsPage.vue +3 -0
- package/src/components/pages/PlaylistPage.vue +112 -117
- package/src/components/pages/PlaylistsPage.vue +9 -2
- package/src/components/pages/PodcastPage.vue +224 -238
- package/src/components/pages/PodcastsPage.vue +9 -2
- package/src/components/pages/RadioPage.vue +56 -70
- package/src/components/pages/RubriquePage.vue +7 -3
- package/src/components/pages/SearchPage.vue +31 -36
- package/src/components/pages/TagPage.vue +11 -9
- package/src/components/pages/VideoPage.vue +14 -11
- package/src/helper/displayHelper.ts +1 -1
- package/src/helper/loadScript.ts +4 -4
- package/src/i18n.ts +2 -2
- package/src/main.ts +1 -1
- package/src/router/router.ts +17 -4
- package/src/stores/AuthStore.ts +12 -12
- package/src/stores/FilterStore.ts +1 -1
- package/src/stores/VastStore.ts +2 -2
- package/src/stores/class/general/player.ts +1 -0
- package/public/css/fonts/icomoon.eot +0 -0
- package/public/css/fonts/icomoon.svg +0 -113
- package/public/css/fonts/icomoon.ttf +0 -0
- package/public/css/fonts/icomoon.woff +0 -0
- package/public/css/fonts/icomoon.woff2 +0 -0
- package/public/css/fonts/style.css +0 -352
- package/sonarqube-scanner.js +0 -10
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<ClassicModalInBody
|
|
3
3
|
id-modal="accessibility-modal"
|
|
4
|
-
:title-modal="
|
|
4
|
+
:title-modal="t('Transcript Accessibility')"
|
|
5
5
|
@close="closePopup"
|
|
6
6
|
>
|
|
7
7
|
<template #body>
|
|
8
8
|
<div class="d-flex gap-3 flex-wrap mb-3">
|
|
9
9
|
<div class="d-flex flex-nowrap align-items-center flex-grow-1">
|
|
10
|
-
<div class="form-label me-3">{{
|
|
10
|
+
<div class="form-label me-3">{{ t('Choose background color') }}</div>
|
|
11
11
|
<VSwatches
|
|
12
12
|
v-model:model-value="background"
|
|
13
13
|
class="c-hand"
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
/>
|
|
20
20
|
</div>
|
|
21
21
|
<div class="d-flex flex-nowrap align-items-center flex-grow-1">
|
|
22
|
-
<div class="form-label me-3">{{
|
|
22
|
+
<div class="form-label me-3">{{ t('Choose text color') }}</div>
|
|
23
23
|
<VSwatches
|
|
24
24
|
v-model:model-value="color"
|
|
25
25
|
class="c-hand"
|
|
@@ -33,98 +33,86 @@
|
|
|
33
33
|
</div>
|
|
34
34
|
|
|
35
35
|
<div class="d-flex align-items-center flex-nowrap mb-3">
|
|
36
|
-
<label class="form-label me-3" for="accessibility-font-size">{{
|
|
36
|
+
<label class="form-label me-3" for="accessibility-font-size">{{ t('Font size') }}</label>
|
|
37
37
|
<button class="btn me-3" :disabled="isMinSize" @click="decreaseFontSize"><FormatFontSizeDecreaseIcon :size="44"/></button>
|
|
38
38
|
<button class="btn" :disabled="isMaxSize" @click="increaseFontSize"><FormatFontSizeIncreaseIcon :size="44"/></button>
|
|
39
39
|
</div>
|
|
40
40
|
|
|
41
|
-
<div class="form-label mt-3">{{
|
|
41
|
+
<div class="form-label mt-3">{{ t('Preview') }}</div>
|
|
42
42
|
<div class="border p-2 mb-3" :style="stylePreview">Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</div>
|
|
43
43
|
</template>
|
|
44
44
|
<template #footer>
|
|
45
45
|
<button class="btn m-1" @click="closePopup">
|
|
46
|
-
{{
|
|
46
|
+
{{ t("No") }}
|
|
47
47
|
</button>
|
|
48
48
|
<button
|
|
49
49
|
class="btn btn-primary m-1"
|
|
50
50
|
@click="saveData"
|
|
51
51
|
>
|
|
52
|
-
{{
|
|
52
|
+
{{ t("Save") }}
|
|
53
53
|
</button>
|
|
54
54
|
</template>
|
|
55
55
|
</ClassicModalInBody>
|
|
56
56
|
</template>
|
|
57
57
|
|
|
58
|
-
<script lang="ts">
|
|
58
|
+
<script setup lang="ts">
|
|
59
59
|
import { VSwatches } from "vue3-swatches";
|
|
60
60
|
import "vue3-swatches/dist/style.css";
|
|
61
61
|
import FormatFontSizeIncreaseIcon from "vue-material-design-icons/FormatFontSizeIncrease.vue";
|
|
62
62
|
import FormatFontSizeDecreaseIcon from "vue-material-design-icons/FormatFontSizeDecrease.vue";
|
|
63
|
-
import { defineAsyncComponent,
|
|
63
|
+
import { computed, defineAsyncComponent, onBeforeMount, ref } from "vue";
|
|
64
|
+
import { useI18n } from "vue-i18n";
|
|
64
65
|
const ClassicModalInBody = defineAsyncComponent(
|
|
65
66
|
() => import("../../misc/modal/ClassicModalInBody.vue"),
|
|
66
67
|
);
|
|
67
|
-
export default defineComponent({
|
|
68
|
-
name: "AccessibilityModal",
|
|
69
68
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
FormatFontSizeIncreaseIcon,
|
|
73
|
-
FormatFontSizeDecreaseIcon,
|
|
74
|
-
VSwatches
|
|
75
|
-
},
|
|
69
|
+
//Emits
|
|
70
|
+
const emit = defineEmits(["close", "save"]);
|
|
76
71
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
fontSize: this.fontSize,
|
|
122
|
-
background: this.background,
|
|
123
|
-
color: this.color,
|
|
124
|
-
});
|
|
125
|
-
}
|
|
126
|
-
},
|
|
127
|
-
});
|
|
72
|
+
//Data
|
|
73
|
+
const fontSize = ref(16);
|
|
74
|
+
const background = ref("white");
|
|
75
|
+
const color = ref("black");
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
//Composables
|
|
79
|
+
const { t } = useI18n();
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
//Computed
|
|
83
|
+
const isMaxSize = computed(() => fontSize.value>=30);
|
|
84
|
+
const isMinSize = computed(() => fontSize.value<=16);
|
|
85
|
+
const stylePreview = computed(() => 'font-size:'+fontSize.value+'px; background:'+background.value+'; color:'+color.value);
|
|
86
|
+
|
|
87
|
+
onBeforeMount(()=>initAccessibility())
|
|
88
|
+
|
|
89
|
+
//Methods
|
|
90
|
+
function initAccessibility(){
|
|
91
|
+
const actualFontSize = getComputedStyle(document.documentElement).getPropertyValue('--octopus-accessibility-font-size');
|
|
92
|
+
fontSize.value = isNaN(parseInt(actualFontSize.slice(0, -2), 10)) ? 16 :parseInt(actualFontSize.slice(0, -2), 10);
|
|
93
|
+
background.value = getComputedStyle(document.documentElement).getPropertyValue('--octopus-accessibility-background');
|
|
94
|
+
color.value = getComputedStyle(document.documentElement).getPropertyValue('--octopus-accessibility-color');
|
|
95
|
+
}
|
|
96
|
+
function closePopup() {
|
|
97
|
+
emit("close");
|
|
98
|
+
}
|
|
99
|
+
function decreaseFontSize(){
|
|
100
|
+
if(!isMinSize.value){
|
|
101
|
+
fontSize.value -=2;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
function increaseFontSize(){
|
|
105
|
+
if(!isMaxSize.value){
|
|
106
|
+
fontSize.value +=2;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
function saveData(){
|
|
110
|
+
emit('save', {
|
|
111
|
+
fontSize: fontSize.value,
|
|
112
|
+
background: background.value,
|
|
113
|
+
color: color.value,
|
|
114
|
+
});
|
|
115
|
+
}
|
|
128
116
|
</script>
|
|
129
117
|
<style lang="scss">
|
|
130
118
|
.octopus-app #accessibility-modal .octopus-modal-body{
|
|
@@ -5,14 +5,15 @@
|
|
|
5
5
|
:option-chosen="model"
|
|
6
6
|
option-label="name"
|
|
7
7
|
:display-label="displayLabel"
|
|
8
|
-
:label="label ??
|
|
8
|
+
:label="label ?? t('By category')"
|
|
9
9
|
:text-danger="textDanger"
|
|
10
|
-
:placeholder="
|
|
10
|
+
:placeholder="t('Type string to filter by categories')"
|
|
11
11
|
:max-element="maxElement"
|
|
12
12
|
:in-modal="inModal"
|
|
13
13
|
:multiple="multiple"
|
|
14
14
|
:min-search-length="1"
|
|
15
15
|
:width="width"
|
|
16
|
+
:height="height"
|
|
16
17
|
:is-disabled="isDisabled"
|
|
17
18
|
:no-deselect="noDeselect"
|
|
18
19
|
:display-required="displayRequired"
|
|
@@ -21,158 +22,156 @@
|
|
|
21
22
|
/>
|
|
22
23
|
</template>
|
|
23
24
|
|
|
24
|
-
<script lang="ts">
|
|
25
|
+
<script setup lang="ts">
|
|
25
26
|
import { useGeneralStore } from "../../../stores/GeneralStore";
|
|
26
|
-
import { mapState } from "pinia";
|
|
27
27
|
import ClassicMultiselect from "../../form/ClassicMultiselect.vue";
|
|
28
28
|
import { Category } from "@/stores/class/general/category";
|
|
29
|
-
import {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
},
|
|
43
|
-
displayAllCategories: { default: false, type: Boolean },
|
|
44
|
-
categorySelected: { default: undefined, type: Number },
|
|
45
|
-
categorySelectedArray: {
|
|
46
|
-
default: undefined,
|
|
47
|
-
type: Array as () => Array<number>,
|
|
48
|
-
},
|
|
49
|
-
inModal: { default: false, type: Boolean },
|
|
50
|
-
noDeselect: { default: true, type: Boolean },
|
|
51
|
-
label:{default: undefined, type: String },
|
|
52
|
-
displayLabel: { default: false, type: Boolean },
|
|
53
|
-
textDanger :{ default: undefined, type: String },
|
|
54
|
-
displayRequired: { default: false, type: Boolean },
|
|
29
|
+
import { computed, onMounted, Ref, ref, useTemplateRef, watch } from "vue";
|
|
30
|
+
import { useI18n } from "vue-i18n";
|
|
31
|
+
|
|
32
|
+
//Props
|
|
33
|
+
const props = defineProps({
|
|
34
|
+
defaultanswer: { default: "", type: String },
|
|
35
|
+
width: { default: "100%", type: String },
|
|
36
|
+
height: { default: undefined, type: String },
|
|
37
|
+
multiple: { default: false, type: Boolean },
|
|
38
|
+
isDisabled: { default: false, type: Boolean },
|
|
39
|
+
initCategories: {
|
|
40
|
+
default: undefined,
|
|
41
|
+
type: Array as () => Array<Category>,
|
|
55
42
|
},
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
data() {
|
|
62
|
-
return {
|
|
63
|
-
maxElement: 50 as number,
|
|
64
|
-
category: undefined as Category | undefined,
|
|
65
|
-
categoryForArray: [] as Array<Category> | undefined,
|
|
66
|
-
};
|
|
43
|
+
displayAllCategories: { default: false, type: Boolean },
|
|
44
|
+
categorySelected: { default: undefined, type: Number },
|
|
45
|
+
categorySelectedArray: {
|
|
46
|
+
default: undefined,
|
|
47
|
+
type: Array as () => Array<number>,
|
|
67
48
|
},
|
|
49
|
+
inModal: { default: false, type: Boolean },
|
|
50
|
+
noDeselect: { default: true, type: Boolean },
|
|
51
|
+
label:{default: undefined, type: String },
|
|
52
|
+
displayLabel: { default: false, type: Boolean },
|
|
53
|
+
textDanger :{ default: undefined, type: String },
|
|
54
|
+
displayRequired: { default: false, type: Boolean },
|
|
55
|
+
})
|
|
68
56
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
return this.storedCategories;
|
|
76
|
-
},
|
|
77
|
-
categoriesOrdered(): Array<Category> {
|
|
78
|
-
let allCategoriesOrdered = this.categoriesChosen.toSorted(
|
|
79
|
-
(a: Category, b: Category) => (a.name > b.name ? 1 : -1),
|
|
80
|
-
);
|
|
81
|
-
if (!this.displayAllCategories) {
|
|
82
|
-
allCategoriesOrdered = allCategoriesOrdered.filter((c: Category) => {
|
|
83
|
-
return c.podcastCount;
|
|
84
|
-
});
|
|
85
|
-
}
|
|
86
|
-
if (this.getDefaultCategory) {
|
|
87
|
-
allCategoriesOrdered.unshift(this.getDefaultCategory);
|
|
88
|
-
}
|
|
89
|
-
return allCategoriesOrdered;
|
|
90
|
-
},
|
|
91
|
-
getDefaultCategory(): Category | undefined {
|
|
92
|
-
if ("" === this.defaultanswer) {
|
|
93
|
-
return undefined;
|
|
94
|
-
}
|
|
95
|
-
return { id: 0, name: this.defaultanswer };
|
|
96
|
-
},
|
|
97
|
-
idClassicMultiselect(): string {
|
|
98
|
-
if (this.multiple) return "categoryChooser" + this.multiple;
|
|
99
|
-
return "categoryChooser";
|
|
100
|
-
},
|
|
57
|
+
//Emits
|
|
58
|
+
const emit = defineEmits([
|
|
59
|
+
"update:categorySelected",
|
|
60
|
+
"update:categorySelectedArray",
|
|
61
|
+
"selected"
|
|
62
|
+
]);
|
|
101
63
|
|
|
102
|
-
model: {
|
|
103
|
-
get(): Category | Array<Category> | undefined {
|
|
104
|
-
return this.multiple ? this.categoryForArray : this.category;
|
|
105
|
-
},
|
|
106
|
-
set(value: Category | Array<Category> | undefined): void {
|
|
107
|
-
if (!this.multiple) {
|
|
108
|
-
this.category = value as Category | undefined;
|
|
109
|
-
return;
|
|
110
|
-
}
|
|
111
|
-
this.categoryForArray = value as Array<Category> | undefined;
|
|
112
|
-
},
|
|
113
|
-
},
|
|
114
|
-
},
|
|
115
|
-
watch: {
|
|
116
|
-
categorySelected: {
|
|
117
|
-
immediate: true,
|
|
118
|
-
handler() {
|
|
119
|
-
if (this.categorySelected) {
|
|
120
|
-
this.initCategorySelected();
|
|
121
|
-
} else {
|
|
122
|
-
this.category = this.getDefaultCategory;
|
|
123
|
-
}
|
|
124
|
-
},
|
|
125
|
-
},
|
|
126
|
-
},
|
|
127
64
|
|
|
128
|
-
|
|
129
|
-
|
|
65
|
+
//Data
|
|
66
|
+
const maxElement = ref(50);
|
|
67
|
+
const category: Ref<Category | undefined> = ref(undefined);
|
|
68
|
+
const categoryForArray: Ref<Array<Category> | undefined> = ref([]);
|
|
69
|
+
const selectCategoryRef=useTemplateRef('selectCategory');
|
|
70
|
+
|
|
71
|
+
//Composables
|
|
72
|
+
const { t } = useI18n();
|
|
73
|
+
const generalStore = useGeneralStore();
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
//Computed
|
|
77
|
+
const categoriesChosen = computed(() => {
|
|
78
|
+
if (props.initCategories) {
|
|
79
|
+
return props.initCategories;
|
|
80
|
+
}
|
|
81
|
+
return generalStore.storedCategories;
|
|
82
|
+
});
|
|
83
|
+
const categoriesOrdered = computed(() => {
|
|
84
|
+
let allCategoriesOrdered = categoriesChosen.value.toSorted(
|
|
85
|
+
(a: Category, b: Category) => (a.name > b.name ? 1 : -1),
|
|
86
|
+
);
|
|
87
|
+
if (!props.displayAllCategories) {
|
|
88
|
+
allCategoriesOrdered = allCategoriesOrdered.filter((c: Category) => {
|
|
89
|
+
return c.podcastCount;
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
if (getDefaultCategory.value) {
|
|
93
|
+
allCategoriesOrdered.unshift(getDefaultCategory.value);
|
|
94
|
+
}
|
|
95
|
+
return allCategoriesOrdered;
|
|
96
|
+
});
|
|
97
|
+
const getDefaultCategory = computed(() => {
|
|
98
|
+
if ("" === props.defaultanswer) {
|
|
99
|
+
return undefined;
|
|
100
|
+
}
|
|
101
|
+
return { id: 0, name: props.defaultanswer };
|
|
102
|
+
});
|
|
103
|
+
const idClassicMultiselect = computed(() => {
|
|
104
|
+
if (props.multiple) return "categoryChooser" + props.multiple;
|
|
105
|
+
return "categoryChooser";
|
|
106
|
+
});
|
|
107
|
+
const model = computed({
|
|
108
|
+
get(): Category | Array<Category> | undefined {
|
|
109
|
+
return props.multiple ? categoryForArray.value :category.value;
|
|
130
110
|
},
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
});
|
|
138
|
-
}
|
|
139
|
-
(
|
|
140
|
-
this.$refs.selectCategory as InstanceType<typeof ClassicMultiselect>
|
|
141
|
-
).afterSearch(categories, categories.length);
|
|
142
|
-
},
|
|
143
|
-
onCategorySelected(category: Category | Array<Category>): void {
|
|
144
|
-
if (undefined !== this.categorySelected) {
|
|
145
|
-
this.$emit("update:categorySelected", (category as Category).id);
|
|
146
|
-
} else if (undefined !== this.categorySelectedArray) {
|
|
147
|
-
const idsArray: Array<number> = [];
|
|
148
|
-
(category as Array<Category>).forEach((el: Category) => {
|
|
149
|
-
idsArray.push(el.id);
|
|
150
|
-
});
|
|
151
|
-
this.$emit("update:categorySelectedArray", idsArray);
|
|
152
|
-
} else {
|
|
153
|
-
this.$emit("selected", category);
|
|
154
|
-
}
|
|
155
|
-
},
|
|
156
|
-
initCategorySelected(): void {
|
|
157
|
-
this.category =
|
|
158
|
-
this.categoriesChosen.find((el: Category) => {
|
|
159
|
-
return el.id === this.categorySelected;
|
|
160
|
-
}) ?? this.getDefaultCategory;
|
|
161
|
-
},
|
|
162
|
-
initCategoryArray(): void {
|
|
163
|
-
if (!this.categoryForArray || !this.categorySelectedArray) {
|
|
164
|
-
return;
|
|
165
|
-
}
|
|
166
|
-
this.categoryForArray.length = 0;
|
|
167
|
-
this.categorySelectedArray.forEach((element: number) => {
|
|
168
|
-
const item = this.categoriesChosen.find((el: Category) => {
|
|
169
|
-
return el.id === element;
|
|
170
|
-
});
|
|
171
|
-
if (this.categoryForArray && item) {
|
|
172
|
-
this.categoryForArray.push(item);
|
|
173
|
-
}
|
|
174
|
-
});
|
|
175
|
-
},
|
|
111
|
+
set(value: Category | Array<Category> | undefined): void {
|
|
112
|
+
if (!props.multiple) {
|
|
113
|
+
category.value = value as Category | undefined;
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
116
|
+
categoryForArray.value = value as Array<Category> | undefined;
|
|
176
117
|
},
|
|
177
118
|
});
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
//Watch
|
|
122
|
+
watch(()=>props.categorySelected, async () => {
|
|
123
|
+
if (props.categorySelected) {
|
|
124
|
+
initCategorySelected();
|
|
125
|
+
} else {
|
|
126
|
+
category.value = getDefaultCategory.value;
|
|
127
|
+
}
|
|
128
|
+
}, {immediate: true});
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
onMounted(()=>initCategoryArray())
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
//Methods
|
|
135
|
+
async function onSearchCategory(query?: string): Promise<void> {
|
|
136
|
+
let categories = categoriesOrdered.value;
|
|
137
|
+
if (query) {
|
|
138
|
+
categories = categories.filter((item: Category) => {
|
|
139
|
+
return item.name.toUpperCase().includes(query.toUpperCase());
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
(selectCategoryRef?.value as InstanceType<typeof ClassicMultiselect>).afterSearch(categories, categories.length);
|
|
143
|
+
}
|
|
144
|
+
function onCategorySelected(category: Category | Array<Category>): void {
|
|
145
|
+
if (undefined !== props.categorySelected) {
|
|
146
|
+
emit("update:categorySelected", (category as Category).id);
|
|
147
|
+
} else if (undefined !== props.categorySelectedArray) {
|
|
148
|
+
const idsArray: Array<number> = [];
|
|
149
|
+
(category as Array<Category>).forEach((el: Category) => {
|
|
150
|
+
idsArray.push(el.id);
|
|
151
|
+
});
|
|
152
|
+
emit("update:categorySelectedArray", idsArray);
|
|
153
|
+
} else {
|
|
154
|
+
emit("selected", category);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
function initCategorySelected(): void {
|
|
158
|
+
category.value =
|
|
159
|
+
categoriesChosen.value.find((el: Category) => {
|
|
160
|
+
return el.id === props.categorySelected;
|
|
161
|
+
}) ?? getDefaultCategory.value;
|
|
162
|
+
}
|
|
163
|
+
function initCategoryArray(): void {
|
|
164
|
+
if (!categoryForArray.value || !props.categorySelectedArray) {
|
|
165
|
+
return;
|
|
166
|
+
}
|
|
167
|
+
categoryForArray.value.length = 0;
|
|
168
|
+
props.categorySelectedArray.forEach((element: number) => {
|
|
169
|
+
const item = categoriesChosen.value.find((el: Category) => {
|
|
170
|
+
return el.id === element;
|
|
171
|
+
});
|
|
172
|
+
if (categoryForArray.value && item) {
|
|
173
|
+
categoryForArray.value.push(item);
|
|
174
|
+
}
|
|
175
|
+
});
|
|
176
|
+
}
|
|
178
177
|
</script>
|