@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.
Files changed (214) hide show
  1. package/index.ts +2 -1
  2. package/package.json +4 -3
  3. package/src/App.vue +71 -95
  4. package/src/components/composable/player/usePlayerLive.ts +13 -4
  5. package/src/components/composable/player/usePlayerLogic.ts +6 -6
  6. package/src/components/composable/player/usePlayerVast.ts +7 -7
  7. package/src/components/composable/podcasts/usePodcastView.ts +3 -3
  8. package/src/components/composable/route/useAdvancedParamInit.ts +1 -1
  9. package/src/components/composable/route/useRouteUpdateParams.ts +4 -4
  10. package/src/components/composable/route/useSimplePageParam.ts +15 -8
  11. package/src/components/composable/useInit.ts +2 -2
  12. package/src/components/composable/useMetaTitleWatch.ts +2 -2
  13. package/src/components/display/accessibility/AccessibilityModal.vue +56 -68
  14. package/src/components/display/categories/CategoryChooser.vue +144 -145
  15. package/src/components/display/categories/CategoryFilter.vue +172 -198
  16. package/src/components/display/categories/CategoryList.vue +122 -147
  17. package/src/components/display/comments/CommentInput.vue +100 -122
  18. package/src/components/display/comments/CommentList.vue +169 -191
  19. package/src/components/display/comments/CommentName.vue +35 -45
  20. package/src/components/display/comments/CommentParentInfo.vue +28 -34
  21. package/src/components/display/comments/CommentPlayer.vue +38 -50
  22. package/src/components/display/comments/CommentSection.vue +85 -103
  23. package/src/components/display/comments/item/CommentBasicView.vue +48 -61
  24. package/src/components/display/comments/item/CommentItem.vue +104 -115
  25. package/src/components/display/comments/item/CommentMoreActions.vue +174 -189
  26. package/src/components/display/comments/item/CommentMoreActionsAdmin.vue +1 -3
  27. package/src/components/display/comments/like/LikeButton.vue +36 -41
  28. package/src/components/display/comments/like/LikeSection.vue +128 -136
  29. package/src/components/display/comments/modal/CheckIdentityModal.vue +35 -40
  30. package/src/components/display/comments/modal/EditCommentModal.vue +72 -78
  31. package/src/components/display/comments/modal/RecaptchaModal.vue +58 -63
  32. package/src/components/display/comments/modal/ReportAbuseModal.vue +59 -66
  33. package/src/components/display/edit/EditBox.vue +9 -8
  34. package/src/components/display/edit/EditBoxRadio.vue +1 -5
  35. package/src/components/display/emission/EmissionInlineList.vue +82 -97
  36. package/src/components/display/emission/EmissionItem.vue +57 -69
  37. package/src/components/display/emission/EmissionList.vue +189 -218
  38. package/src/components/display/emission/EmissionPlayerItem.vue +47 -64
  39. package/src/components/display/emission/EmissionPresentationItem.vue +44 -54
  40. package/src/components/display/emission/EmissionPresentationList.vue +51 -61
  41. package/src/components/display/filter/AdvancedSearch.vue +151 -176
  42. package/src/components/display/filter/CategorySearchFilter.vue +43 -46
  43. package/src/components/display/filter/DateFilter.vue +76 -91
  44. package/src/components/display/filter/MonetizableFilter.vue +27 -30
  45. package/src/components/display/filter/ProductorSearch.vue +87 -90
  46. package/src/components/display/filter/RubriqueChoice.vue +58 -63
  47. package/src/components/display/filter/RubriqueFilter.vue +154 -169
  48. package/src/components/display/filter/SearchOrder.vue +35 -35
  49. package/src/components/display/list/ListPaginate.vue +72 -93
  50. package/src/components/display/list/PaginateParams.vue +36 -40
  51. package/src/components/display/list/PaginateSection.vue +113 -124
  52. package/src/components/display/list/SwiperList.vue +97 -109
  53. package/src/components/display/live/CountDown.vue +15 -9
  54. package/src/components/display/live/CountdownOctopus.vue +16 -10
  55. package/src/components/display/live/LiveHorizontalList.vue +95 -103
  56. package/src/components/display/live/LiveItem.vue +64 -73
  57. package/src/components/display/live/LiveList.vue +125 -137
  58. package/src/components/display/live/RadioCurrently.vue +66 -73
  59. package/src/components/display/live/RadioImage.vue +39 -50
  60. package/src/components/display/live/RadioItem.vue +9 -14
  61. package/src/components/display/live/RadioList.vue +39 -53
  62. package/src/components/display/live/RadioPlanning.vue +210 -222
  63. package/src/components/display/organisation/OrganisationChooser.vue +116 -122
  64. package/src/components/display/organisation/OrganisationChooserLight.vue +44 -52
  65. package/src/components/display/participant/ParticipantInlineList.vue +42 -58
  66. package/src/components/display/participant/ParticipantItem.vue +66 -74
  67. package/src/components/display/participant/ParticipantList.vue +116 -141
  68. package/src/components/display/playlist/PlaylistItem.vue +33 -46
  69. package/src/components/display/playlist/PlaylistList.vue +115 -144
  70. package/src/components/display/playlist/PodcastList.vue +90 -103
  71. package/src/components/display/playlist/PodcastPlaylistInlineList.vue +58 -70
  72. package/src/components/display/podcastmaker/PodcastmakerHeader.vue +21 -22
  73. package/src/components/display/podcasts/AnimatorsItem.vue +15 -16
  74. package/src/components/display/podcasts/DownloadPodcastButton.vue +21 -29
  75. package/src/components/display/podcasts/ParticipantDescription.vue +22 -24
  76. package/src/components/display/podcasts/PodcastFilterList.vue +62 -56
  77. package/src/components/display/podcasts/PodcastImage.vue +96 -99
  78. package/src/components/display/podcasts/PodcastInlineList.vue +30 -28
  79. package/src/components/display/podcasts/PodcastInlineListTemplate.vue +107 -114
  80. package/src/components/display/podcasts/PodcastIsPlaying.vue +4 -12
  81. package/src/components/display/podcasts/PodcastItem.vue +48 -63
  82. package/src/components/display/podcasts/PodcastItemInfo.vue +19 -35
  83. package/src/components/display/podcasts/PodcastList.vue +182 -206
  84. package/src/components/display/podcasts/PodcastModuleBox.vue +100 -137
  85. package/src/components/display/podcasts/PodcastPlannedSpinner.vue +4 -6
  86. package/src/components/display/podcasts/PodcastPlayBar.vue +50 -61
  87. package/src/components/display/podcasts/PodcastPlayBasicButton.vue +38 -41
  88. package/src/components/display/podcasts/PodcastPlayButton.vue +164 -175
  89. package/src/components/display/podcasts/PodcastRawTranscript.vue +69 -80
  90. package/src/components/display/podcasts/PodcastRubriqueList.vue +35 -38
  91. package/src/components/display/podcasts/PodcastSwiperList.vue +100 -110
  92. package/src/components/display/podcasts/TagList.vue +48 -50
  93. package/src/components/display/podcasts/VideoModuleBox.vue +13 -24
  94. package/src/components/display/rubriques/RubriqueChooser.vue +135 -140
  95. package/src/components/display/rubriques/RubriqueList.vue +140 -160
  96. package/src/components/display/sharing/ChooseEpisodesNumber.vue +34 -33
  97. package/src/components/display/sharing/FormatSwitch.vue +16 -11
  98. package/src/components/display/sharing/PlayerAnonymousModal.vue +24 -27
  99. package/src/components/display/sharing/PlayerCommonParameters.vue +20 -13
  100. package/src/components/display/sharing/PlayerParameters.vue +69 -71
  101. package/src/components/display/sharing/QrCode.vue +55 -67
  102. package/src/components/display/sharing/ShareAnonymous.vue +160 -178
  103. package/src/components/display/sharing/ShareDistribution.vue +103 -117
  104. package/src/components/display/sharing/ShareNewsletter.vue +154 -161
  105. package/src/components/display/sharing/SharePlayer.vue +273 -295
  106. package/src/components/display/sharing/SharePlayerColors.vue +25 -16
  107. package/src/components/display/sharing/SharePlayerRadio.vue +61 -69
  108. package/src/components/display/sharing/SharePlayerTypes.vue +176 -176
  109. package/src/components/display/sharing/ShareSocialsButtons.vue +63 -75
  110. package/src/components/display/sharing/SubscribeButtons.vue +184 -207
  111. package/src/components/display/studio/RecordingItemButton.vue +1 -4
  112. package/src/components/form/ClassicCheckbox.vue +26 -30
  113. package/src/components/form/ClassicContentEditable.vue +37 -33
  114. package/src/components/form/ClassicCopyButton.vue +40 -44
  115. package/src/components/form/ClassicDatePicker.vue +114 -114
  116. package/src/components/form/ClassicEmojiPicker.vue +20 -28
  117. package/src/components/form/ClassicInputText.vue +116 -120
  118. package/src/components/form/ClassicLoading.vue +7 -12
  119. package/src/components/form/ClassicMultiselect.vue +115 -117
  120. package/src/components/form/ClassicRadio.vue +21 -16
  121. package/src/components/form/ClassicRadioLabel.vue +23 -22
  122. package/src/components/form/ClassicSearch.vue +24 -19
  123. package/src/components/form/ClassicSelect.vue +47 -38
  124. package/src/components/form/ClassicWysiwyg.vue +116 -123
  125. package/src/components/icons/AmazonMusicIcon.vue +7 -10
  126. package/src/components/icons/ApplePodcastIcon.vue +7 -11
  127. package/src/components/icons/BlueSkyIcon.vue +8 -11
  128. package/src/components/icons/DeezerIcon.vue +8 -11
  129. package/src/components/icons/EditFtpIcon.vue +8 -11
  130. package/src/components/icons/IHeartIcon.vue +8 -11
  131. package/src/components/icons/PlayVideoIcon.vue +7 -10
  132. package/src/components/icons/PlayerFmIcon.vue +7 -10
  133. package/src/components/icons/PocketCastIcon.vue +8 -11
  134. package/src/components/icons/PodcastAddictIcon.vue +7 -10
  135. package/src/components/icons/RadiolineIcon.vue +8 -11
  136. package/src/components/icons/TuninIcon.vue +8 -11
  137. package/src/components/icons/XIcon.vue +7 -10
  138. package/src/components/misc/AcpmImage.vue +6 -7
  139. package/src/components/misc/ClassicAccordion.vue +26 -31
  140. package/src/components/misc/ClassicLazy.vue +86 -90
  141. package/src/components/misc/ClassicNav.vue +16 -20
  142. package/src/components/misc/ClassicPopover.vue +271 -282
  143. package/src/components/misc/ClassicSpinner.vue +5 -27
  144. package/src/components/misc/ErrorMessage.vue +11 -12
  145. package/src/components/misc/FooterGarSection.vue +33 -41
  146. package/src/components/misc/FooterSection.vue +94 -131
  147. package/src/components/misc/HomeDropdown.vue +83 -105
  148. package/src/components/misc/MobileMenu.vue +101 -111
  149. package/src/components/misc/ProgressBar.vue +53 -62
  150. package/src/components/misc/TopBar.vue +98 -120
  151. package/src/components/misc/TopBarMainContent.vue +114 -133
  152. package/src/components/misc/modal/ClassicModal.vue +40 -33
  153. package/src/components/misc/modal/ClassicModalInBody.vue +34 -28
  154. package/src/components/misc/modal/ClipboardModal.vue +27 -30
  155. package/src/components/misc/modal/ContractPreviewModal.vue +64 -62
  156. package/src/components/misc/modal/MessageModal.vue +50 -47
  157. package/src/components/misc/modal/NewsletterModal.vue +30 -31
  158. package/src/components/misc/modal/QrCodeModal.vue +21 -21
  159. package/src/components/misc/modal/ShareModalPlayer.vue +43 -52
  160. package/src/components/misc/player/PlayerCompact.vue +6 -4
  161. package/src/components/misc/player/PlayerComponent.vue +8 -9
  162. package/src/components/misc/player/PlayerLarge.vue +9 -8
  163. package/src/components/misc/player/ads/AdsProgressBar.vue +8 -11
  164. package/src/components/misc/player/ads/AdsSkipButton.vue +24 -30
  165. package/src/components/misc/player/chaptering/ChapteringModal.vue +44 -54
  166. package/src/components/misc/player/chaptering/PlayerChaptering.vue +50 -62
  167. package/src/components/misc/player/elements/PlayerImage.vue +51 -57
  168. package/src/components/misc/player/elements/PlayerPlayButton.vue +81 -92
  169. package/src/components/misc/player/elements/PlayerSpeedButton.vue +23 -27
  170. package/src/components/misc/player/elements/PlayerTitle.vue +85 -111
  171. package/src/components/misc/player/progressbar/PlayerProgressBar.vue +18 -29
  172. package/src/components/misc/player/progressbar/PodcastProgressBar.vue +45 -56
  173. package/src/components/misc/player/radio/RadioHistory.vue +80 -99
  174. package/src/components/misc/player/radio/RadioProgressBar.vue +43 -54
  175. package/src/components/misc/player/video/PlayerVideo.vue +27 -40
  176. package/src/components/misc/player/video/PlayerVideoDigiteka.vue +32 -37
  177. package/src/components/misc/player/video/PlayerVideoHls.vue +199 -198
  178. package/src/components/misc/player/video/PlayerYoutubeEmbed.vue +10 -12
  179. package/src/components/pages/CategoryPage.vue +28 -33
  180. package/src/components/pages/EmissionPage.vue +113 -132
  181. package/src/components/pages/EmissionsPage.vue +2 -0
  182. package/src/components/pages/Error403Page.vue +21 -20
  183. package/src/components/pages/HomePage.vue +91 -100
  184. package/src/components/pages/LivesPage.vue +35 -37
  185. package/src/components/pages/MapPage.vue +209 -241
  186. package/src/components/pages/PageLogout.vue +8 -11
  187. package/src/components/pages/PageNotFound.vue +9 -5
  188. package/src/components/pages/ParticipantPage.vue +96 -110
  189. package/src/components/pages/ParticipantsPage.vue +3 -0
  190. package/src/components/pages/PlaylistPage.vue +112 -117
  191. package/src/components/pages/PlaylistsPage.vue +9 -2
  192. package/src/components/pages/PodcastPage.vue +224 -238
  193. package/src/components/pages/PodcastsPage.vue +9 -2
  194. package/src/components/pages/RadioPage.vue +56 -70
  195. package/src/components/pages/RubriquePage.vue +7 -3
  196. package/src/components/pages/SearchPage.vue +31 -36
  197. package/src/components/pages/TagPage.vue +11 -9
  198. package/src/components/pages/VideoPage.vue +14 -11
  199. package/src/helper/displayHelper.ts +1 -1
  200. package/src/helper/loadScript.ts +4 -4
  201. package/src/i18n.ts +2 -2
  202. package/src/main.ts +1 -1
  203. package/src/router/router.ts +17 -4
  204. package/src/stores/AuthStore.ts +12 -12
  205. package/src/stores/FilterStore.ts +1 -1
  206. package/src/stores/VastStore.ts +2 -2
  207. package/src/stores/class/general/player.ts +1 -0
  208. package/public/css/fonts/icomoon.eot +0 -0
  209. package/public/css/fonts/icomoon.svg +0 -113
  210. package/public/css/fonts/icomoon.ttf +0 -0
  211. package/public/css/fonts/icomoon.woff +0 -0
  212. package/public/css/fonts/icomoon.woff2 +0 -0
  213. package/public/css/fonts/style.css +0 -352
  214. package/sonarqube-scanner.js +0 -10
@@ -23,7 +23,7 @@
23
23
  <PaginateSection
24
24
  v-if="!isPhone && !justSizeChosen && totalCount > 0"
25
25
  :id="id"
26
- :style="playerResponsive ? 'bottom:' + playerHeight : ''"
26
+ :style="playerResponsive ? 'bottom:' + playerStore.playerHeight : ''"
27
27
  :first="first"
28
28
  :rows-per-page="rowsPerPage"
29
29
  :total-count="totalCount"
@@ -34,18 +34,18 @@
34
34
  v-show="first + rowsPerPage < totalCount && (isPhone || justSizeChosen)"
35
35
  :disabled="loading"
36
36
  class="btn btn-primary align-self-center w-fit-content m-4"
37
- :title="$t('See more')"
37
+ :title="t('See more')"
38
38
  @click="fetchMore"
39
39
  >
40
40
  <template v-if="buttonPlus">
41
- {{ $t("See more") }}
41
+ {{ t("See more") }}
42
42
  </template>
43
43
  <PlusIcon :size="16" :class="buttonPlus ? 'ms-1' : ''" />
44
44
  </button>
45
45
  </div>
46
46
  </template>
47
47
 
48
- <script lang="ts">
48
+ <script setup lang="ts">
49
49
  import PlusIcon from "vue-material-design-icons/Plus.vue";
50
50
  import domHelper from "../../../helper/domHelper";
51
51
  import ClassicLoading from "../../form/ClassicLoading.vue";
@@ -54,97 +54,76 @@ import PaginateParams from "./PaginateParams.vue";
54
54
  import PaginateSection from "./PaginateSection.vue";
55
55
  import {useResizePhone} from "../../composable/useResizePhone";
56
56
  import { useRouteUpdateParams } from "../../composable/route/useRouteUpdateParams";
57
- import { defineComponent } from "vue";
57
+ import { computed, watch } from "vue";
58
58
  import { usePlayerStore } from "../../../stores/PlayerStore";
59
- import { mapState } from "pinia";
60
- export default defineComponent({
61
- name: "ListPaginate",
62
- components: {
63
- PaginateSection,
64
- PaginateParams,
65
- ClassicLoading,
66
- PlusIcon,
67
- },
68
- props: {
69
- first: { default: 0, type: Number },
70
- rowsPerPage: { default: 30, type: Number },
71
- totalCount: { default: 0, type: Number },
72
- textCount: { default: undefined, type: String },
73
- id: { default: "", type: String },
74
- loadingText: { default: undefined, type: String },
75
- errorText: { default: undefined, type: String },
76
- loading: { default: false, type: Boolean },
77
- isMobile: { default: false, type: Boolean },
78
- justSizeChosen: { default: false, type: Boolean },
79
- playerResponsive: { default: false, type: Boolean },
80
- },
59
+ import { useI18n } from "vue-i18n";
81
60
 
82
- emits: ["update:first", "update:rowsPerPage", "update:isMobile"],
83
61
 
84
- setup(){
85
- const { isPhone, windowWidth } = useResizePhone();
86
- const { updateRouteParam, updatePaginateSize } = useRouteUpdateParams();
87
- return { isPhone, windowWidth, updateRouteParam, updatePaginateSize }
88
- },
89
- data() {
90
- return {
91
- internSizeChange: false as boolean,
92
- };
93
- },
94
- computed: {
95
- ...mapState(usePlayerStore, ["playerHeight"]),
96
- buttonPlus(): boolean {
97
- return state.generalParameters.buttonPlus as boolean;
98
- },
99
- rangeSize() {
100
- if (this.windowWidth > 1600) {
101
- return 3;
102
- }
103
- return this.windowWidth > 1530 ? 2 : 1;
104
- },
105
- },
106
- watch: {
107
- isPhone: {
108
- immediate: true,
109
- handler() {
110
- this.$emit("update:isMobile", this.isPhone);
111
- },
112
- },
113
- first() {
114
- if (this.internSizeChange) {
115
- this.internSizeChange = false;
116
- return;
117
- }
118
- this.updateRouteParam({pr:(Math.floor(this.first / this.rowsPerPage) + 1).toString()});
119
- },
120
- },
121
- methods: {
122
- fetchMore() {
123
- this.$emit("update:first", this.first + this.rowsPerPage);
124
- },
125
- changeFirst(firstValue: number) {
126
- this.scrollToTop();
127
- this.$emit("update:first", firstValue);
128
- },
129
- changeSize(sizeValue: number) {
130
- this.scrollToTop();
131
- if (0 !== this.first) {
132
- this.internSizeChange = true;
133
- }
134
- this.$emit("update:rowsPerPage", sizeValue);
135
- this.updatePaginateSize(sizeValue);
136
- },
137
- scrollToTop() {
138
- const element = document.getElementById(this.id);
139
- if (!element || element.getBoundingClientRect().top > 0) {
140
- return;
141
- }
142
- const y =
143
- element.getBoundingClientRect().top +
144
- window.scrollY -
145
- domHelper.convertRemToPixels(3.5);
146
- window.scrollTo({ top: y, behavior: "smooth" });
147
- },
148
- },
62
+ //Props
63
+ const props = defineProps({
64
+ first: { default: 0, type: Number },
65
+ rowsPerPage: { default: 30, type: Number },
66
+ totalCount: { default: 0, type: Number },
67
+ textCount: { default: undefined, type: String },
68
+ id: { default: "", type: String },
69
+ loadingText: { default: undefined, type: String },
70
+ errorText: { default: undefined, type: String },
71
+ loading: { default: false, type: Boolean },
72
+ isMobile: { default: false, type: Boolean },
73
+ justSizeChosen: { default: false, type: Boolean },
74
+ playerResponsive: { default: false, type: Boolean },
75
+ forceUpdateParameters: { default: false, type: Boolean },
76
+ })
77
+
78
+ //Emits
79
+ const emit = defineEmits(["update:first", "update:rowsPerPage", "update:isMobile"]);
80
+
81
+
82
+ //Composables
83
+ const { t } = useI18n();
84
+ const { isPhone, windowWidth } = useResizePhone();
85
+ const { updateRouteParam, updatePaginateSize } = useRouteUpdateParams();
86
+ const playerStore = usePlayerStore();
87
+
88
+
89
+ //Computed
90
+ const buttonPlus = computed(() => state.generalParameters.buttonPlus);
91
+ const rangeSize = computed(() => {
92
+ if (windowWidth.value > 1600) {
93
+ return 3;
94
+ }
95
+ return windowWidth.value > 1530 ? 2 : 1;
149
96
  });
97
+
98
+
99
+ //Watch
100
+ watch(isPhone, () => {emit("update:isMobile", isPhone.value);}, {immediate: true});
101
+ watch(()=>props.first, () => {
102
+ updateRouteParam({pr:(Math.floor(props.first / props.rowsPerPage) + 1).toString()}, props.forceUpdateParameters);
103
+ });
104
+
105
+ //Methods
106
+ function fetchMore() {
107
+ emit("update:first", props.first + props.rowsPerPage);
108
+ }
109
+ function changeFirst(firstValue: number) {
110
+ scrollToTop();
111
+ emit("update:first", firstValue);
112
+ }
113
+ function changeSize(sizeValue: number) {
114
+ scrollToTop();
115
+ emit("update:rowsPerPage", sizeValue);
116
+ updatePaginateSize(sizeValue, props.forceUpdateParameters);
117
+ }
118
+ function scrollToTop() {
119
+ const element = document.getElementById(props.id);
120
+ if (!element || element.getBoundingClientRect().top > 0) {
121
+ return;
122
+ }
123
+ const y =
124
+ element.getBoundingClientRect().top +
125
+ window.scrollY -
126
+ domHelper.convertRemToPixels(3.5);
127
+ window.scrollTo({ top: y, behavior: "smooth" });
128
+ }
150
129
  </script>
@@ -3,58 +3,54 @@
3
3
  <ClassicSelect
4
4
  :text-init="rowsPerPage"
5
5
  :id-select="'rows-per-page-select'+id"
6
- :label="$t('Items per page :')"
6
+ :label="t('Items per page :')"
7
7
  :display-label="true"
8
8
  class-label="flex-shrink-0 me-1"
9
9
  class="d-flex align-items-center mb-0"
10
10
  :options="optionRowsPerPage"
11
- @update:text-init="$emit('update:rowsPerPage', parseInt($event, 10))"
11
+ @update:text-init="emit('update:rowsPerPage', parseInt($event, 10))"
12
12
  />
13
13
  </div>
14
14
  </template>
15
- <script lang="ts">
15
+ <script setup lang="ts">
16
+ import { useI18n } from "vue-i18n";
16
17
  import ClassicSelect from "../../form/ClassicSelect.vue";
17
- import { defineComponent } from "vue";
18
- export default defineComponent({
19
- name: "PaginateParams",
20
- components:{
21
- ClassicSelect
22
- },
18
+ import { onBeforeMount, ref } from "vue";
23
19
 
24
- props: {
25
- rowsPerPage: { default: 0, type: Number },
26
- id: { default: "", type: String },
27
- },
20
+ //Props
21
+ const props = defineProps({
22
+ rowsPerPage: { default: 0, type: Number },
23
+ id: { default: "", type: String },
24
+ })
28
25
 
29
- emits: ["update:rowsPerPage"],
26
+ //Emits
27
+ const emit = defineEmits(["update:rowsPerPage"]);
30
28
 
31
- data() {
32
- return {
33
- optionsRowsPerPage: [10, 20, 30, 40, 50, 60] as Array<number>,
34
- optionRowsPerPage: [
35
- {title:"10", value: 10},
36
- {title:"20", value: 20},
37
- {title:"30", value: 30},
38
- {title:"40", value: 40},
39
- {title:"50", value: 50},
40
- {title:"60", value: 60},
41
- ],
42
- };
43
- },
44
- created() {
45
- this.initRowsPerPage();
46
- },
29
+ //Data
30
+ const optionsRowsPerPage = ref([10, 20, 30, 40, 50, 60]);
31
+ const optionRowsPerPage = ref([
32
+ {title:"10", value: 10},
33
+ {title:"20", value: 20},
34
+ {title:"30", value: 30},
35
+ {title:"40", value: 40},
36
+ {title:"50", value: 50},
37
+ {title:"60", value: 60},
38
+ ]);
47
39
 
48
- methods: {
49
- initRowsPerPage() {
50
- if (this.optionsRowsPerPage.includes(this.rowsPerPage)) {
51
- return;
52
- }
53
- this.optionsRowsPerPage.push(this.rowsPerPage);
54
- this.optionsRowsPerPage.sort((a, b) => a - b);
55
- },
56
- },
57
- });
40
+ //Composables
41
+ const { t } = useI18n();
42
+
43
+
44
+ onBeforeMount(()=>initRowsPerPage())
45
+
46
+ //Methods
47
+ function initRowsPerPage() {
48
+ if (optionsRowsPerPage.value.includes(props.rowsPerPage)) {
49
+ return;
50
+ }
51
+ optionsRowsPerPage.value.push(props.rowsPerPage);
52
+ optionsRowsPerPage.value.sort((a, b) => a - b);
53
+ }
58
54
  </script>
59
55
  <style lang="scss">
60
56
  .octopus-app .paginate {
@@ -1,7 +1,7 @@
1
1
  <template>
2
2
  <div class="paginate-fixed">
3
3
  <div class="mx-2">
4
- {{ $t("Showing items number", { page: page + 1, totalPage: totalPage }) }}
4
+ {{ t("Showing items number", { page: page + 1, totalPage: totalPage }) }}
5
5
  </div>
6
6
  <div class="d-flex flex-nowrap">
7
7
  <button
@@ -54,137 +54,126 @@
54
54
  </div>
55
55
  </div>
56
56
  </template>
57
- <script lang="ts">
58
- import { defineComponent } from "vue";
59
- export default defineComponent({
60
- name: "PaginateSection",
57
+ <script setup lang="ts">
58
+ import { computed } from "vue";
59
+ import { useI18n } from "vue-i18n";
61
60
 
62
- props: {
63
- totalCount: { default: 0, type: Number },
64
- first: { default: 0, type: Number },
65
- rowsPerPage: { default: 0, type: Number },
66
- rangeSize: { default: 1, type: Number },
67
- },
61
+ //Props
62
+ const props = defineProps({
63
+ totalCount: { default: 0, type: Number },
64
+ first: { default: 0, type: Number },
65
+ rowsPerPage: { default: 0, type: Number },
66
+ rangeSize: { default: 1, type: Number },
67
+ })
68
68
 
69
- emits: ["update:first"],
70
69
 
71
- computed: {
72
- buttonsLeft() {
73
- return [
74
- {
75
- title: this.$t("Go to first page"),
76
- disabled: 0 === this.first,
77
- action: () => {
78
- this.changeFirst(0);
79
- },
80
- path: "M11.854 3.646a.5.5 0 0 1 0 .708L8.207 8l3.647 3.646a.5.5 0 0 1-.708.708l-4-4a.5.5 0 0 1 0-.708l4-4a.5.5 0 0 1 .708 0zM4.5 1a.5.5 0 0 0-.5.5v13a.5.5 0 0 0 1 0v-13a.5.5 0 0 0-.5-.5z",
81
- },
82
- {
83
- title: this.$t("Go to previous page"),
84
- disabled: 0 === this.first,
85
- action: () => {
86
- this.changeFirst(this.first - this.rowsPerPage);
87
- },
88
- path: "M11.354 1.646a.5.5 0 0 1 0 .708L5.707 8l5.647 5.646a.5.5 0 0 1-.708.708l-6-6a.5.5 0 0 1 0-.708l6-6a.5.5 0 0 1 .708 0z",
89
- },
90
- ];
91
- },
92
- buttonsRight() {
93
- return [
94
- {
95
- title: this.$t("Go to next page"),
96
- disabled: this.lastFirst === this.first,
97
- action: () => {
98
- this.changeFirst(this.first + this.rowsPerPage);
99
- },
100
- path: "M4.646 1.646a.5.5 0 0 1 .708 0l6 6a.5.5 0 0 1 0 .708l-6 6a.5.5 0 0 1-.708-.708L10.293 8 4.646 2.354a.5.5 0 0 1 0-.708z",
101
- },
102
- {
103
- title: this.$t("Go to last page"),
104
- disabled: this.lastFirst === this.first,
105
- action: () => {
106
- this.changeFirst(this.lastFirst);
107
- },
108
- path: "M4.146 3.646a.5.5 0 0 0 0 .708L7.793 8l-3.647 3.646a.5.5 0 0 0 .708.708l4-4a.5.5 0 0 0 0-.708l-4-4a.5.5 0 0 0-.708 0zM11.5 1a.5.5 0 0 1 .5.5v13a.5.5 0 0 1-1 0v-13a.5.5 0 0 1 .5-.5z",
109
- },
110
- ];
111
- },
112
- page() {
113
- return Math.floor(this.first / this.rowsPerPage);
114
- },
115
- totalPage() {
116
- return Math.ceil(this.totalCount / this.rowsPerPage);
117
- },
118
- pagination(): (number | null)[] {
119
- if (-1 === this.rangeSize) {
120
- return [];
121
- }
122
- const minPaginationElems = 5 + this.rangeSize * 2;
123
- let rangeStart =
124
- this.totalPage <= minPaginationElems
125
- ? 1
126
- : this.page + 1 - this.rangeSize;
127
- let rangeEnd =
128
- this.totalPage <= minPaginationElems
129
- ? this.totalPage
130
- : this.page + 1 + this.rangeSize;
131
- rangeEnd = rangeEnd > this.totalPage ? this.totalPage : rangeEnd;
132
- rangeStart = rangeStart < 1 ? 1 : rangeStart;
133
- if (this.totalPage > minPaginationElems) {
134
- return this.getPaginationArrayWithEllipsis(
135
- rangeStart,
136
- rangeEnd,
137
- minPaginationElems,
138
- );
139
- }
140
- const res = [];
141
- for (let i = rangeStart; i <= rangeEnd; i++) {
142
- res.push(i);
143
- }
144
- return res;
70
+ //Emits
71
+ const emit = defineEmits(["update:first"]);
72
+
73
+ //Composables
74
+ const { t } = useI18n();
75
+
76
+ //Computed
77
+ const buttonsLeft = computed(() => {
78
+ return [
79
+ {
80
+ title: t("Go to first page"),
81
+ disabled: 0 === props.first,
82
+ action: () => {changeFirst(0);},
83
+ path: "M11.854 3.646a.5.5 0 0 1 0 .708L8.207 8l3.647 3.646a.5.5 0 0 1-.708.708l-4-4a.5.5 0 0 1 0-.708l4-4a.5.5 0 0 1 .708 0zM4.5 1a.5.5 0 0 0-.5.5v13a.5.5 0 0 0 1 0v-13a.5.5 0 0 0-.5-.5z",
145
84
  },
146
- lastFirst(): number {
147
- return (this.totalPage - 1) * this.rowsPerPage;
85
+ {
86
+ title: t("Go to previous page"),
87
+ disabled: 0 === props.first,
88
+ action: () => {changeFirst(props.first - props.rowsPerPage);},
89
+ path: "M11.354 1.646a.5.5 0 0 1 0 .708L5.707 8l5.647 5.646a.5.5 0 0 1-.708.708l-6-6a.5.5 0 0 1 0-.708l6-6a.5.5 0 0 1 .708 0z",
148
90
  },
149
- },
150
-
151
- methods: {
152
- getPaginationArrayWithEllipsis(
153
- rangeStart: number,
154
- rangeEnd: number,
155
- minPaginationElems: number,
156
- ) {
157
- const res = [];
158
- const isStartBoundaryReached = rangeStart - 1 < 3;
159
- const isEndBoundaryReached = this.totalPage - rangeEnd < 3;
160
- if (isStartBoundaryReached) {
161
- rangeEnd = minPaginationElems - 2;
162
- for (let i = 1; i < rangeStart; i++) {
163
- res.push(i);
164
- }
165
- } else {
166
- res.push(1);
167
- res.push(null);
168
- }
169
- if (isEndBoundaryReached) {
170
- rangeStart = this.totalPage - (minPaginationElems - 3);
171
- for (let i = rangeStart; i <= this.totalPage; i++) {
172
- res.push(i);
173
- }
174
- } else {
175
- for (let i = rangeStart; i <= rangeEnd; i++) {
176
- res.push(i);
177
- }
178
- res.push(null);
179
- res.push(this.totalPage);
180
- }
181
- return res;
91
+ ];
92
+ });
93
+ const buttonsRight = computed(() => {
94
+ return [
95
+ {
96
+ title: t("Go to next page"),
97
+ disabled: lastFirst.value === props.first,
98
+ action: () => {changeFirst(props.first + props.rowsPerPage);},
99
+ path: "M4.646 1.646a.5.5 0 0 1 .708 0l6 6a.5.5 0 0 1 0 .708l-6 6a.5.5 0 0 1-.708-.708L10.293 8 4.646 2.354a.5.5 0 0 1 0-.708z",
182
100
  },
183
- changeFirst(newFirst: number) {
184
- this.$emit("update:first", newFirst);
101
+ {
102
+ title: t("Go to last page"),
103
+ disabled: lastFirst.value === props.first,
104
+ action: () => {changeFirst(lastFirst.value);},
105
+ path: "M4.146 3.646a.5.5 0 0 0 0 .708L7.793 8l-3.647 3.646a.5.5 0 0 0 .708.708l4-4a.5.5 0 0 0 0-.708l-4-4a.5.5 0 0 0-.708 0zM11.5 1a.5.5 0 0 1 .5.5v13a.5.5 0 0 1-1 0v-13a.5.5 0 0 1 .5-.5z",
185
106
  },
186
- },
107
+ ];
187
108
  });
109
+ const page = computed(() =>Math.floor(props.first / props.rowsPerPage));
110
+ const totalPage = computed(() =>Math.ceil(props.totalCount / props.rowsPerPage));
111
+ const pagination = computed(() => {
112
+ if (-1 === props.rangeSize) {
113
+ return [];
114
+ }
115
+ const minPaginationElems = 5 + props.rangeSize * 2;
116
+ let rangeStart =
117
+ totalPage.value <= minPaginationElems
118
+ ? 1
119
+ : page.value + 1 - props.rangeSize;
120
+ let rangeEnd =
121
+ totalPage.value <= minPaginationElems
122
+ ? totalPage.value
123
+ : page.value + 1 + props.rangeSize;
124
+ rangeEnd = rangeEnd > totalPage.value ? totalPage.value : rangeEnd;
125
+ rangeStart = rangeStart < 1 ? 1 : rangeStart;
126
+ if (totalPage.value > minPaginationElems) {
127
+ return getPaginationArrayWithEllipsis(
128
+ rangeStart,
129
+ rangeEnd,
130
+ minPaginationElems,
131
+ );
132
+ }
133
+ const res = [];
134
+ for (let i = rangeStart; i <= rangeEnd; i++) {
135
+ res.push(i);
136
+ }
137
+ return res;
138
+ });
139
+ const lastFirst = computed(() =>(totalPage.value - 1) * props.rowsPerPage);
140
+
141
+
142
+ //Methods
143
+ function getPaginationArrayWithEllipsis(
144
+ rangeStart: number,
145
+ rangeEnd: number,
146
+ minPaginationElems: number,
147
+ ) {
148
+ const res = [];
149
+ const isStartBoundaryReached = rangeStart - 1 < 3;
150
+ const isEndBoundaryReached = totalPage.value - rangeEnd < 3;
151
+ if (isStartBoundaryReached) {
152
+ rangeEnd = minPaginationElems - 2;
153
+ for (let i = 1; i < rangeStart; i++) {
154
+ res.push(i);
155
+ }
156
+ } else {
157
+ res.push(1);
158
+ res.push(null);
159
+ }
160
+ if (isEndBoundaryReached) {
161
+ rangeStart = totalPage.value - (minPaginationElems - 3);
162
+ for (let i = rangeStart; i <= totalPage.value; i++) {
163
+ res.push(i);
164
+ }
165
+ } else {
166
+ for (let i = rangeStart; i <= rangeEnd; i++) {
167
+ res.push(i);
168
+ }
169
+ res.push(null);
170
+ res.push(totalPage.value);
171
+ }
172
+ return res;
173
+ }
174
+ function changeFirst(newFirst: number) {
175
+ emit("update:first", newFirst);
176
+ }
188
177
  </script>
189
178
  <style lang="scss">
190
179