@saooti/octopus-sdk 41.0.9-SNAPSHOT → 41.0.11-SNAPSHOT

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@saooti/octopus-sdk",
3
- "version": "41.0.9-SNAPSHOT",
3
+ "version": "41.0.11-SNAPSHOT",
4
4
  "private": false,
5
5
  "description": "Javascript SDK for using octopus",
6
6
  "author": "Saooti",
@@ -9,7 +9,7 @@ import dayjs from "dayjs";
9
9
 
10
10
  export const useAdvancedParamInit = (props: any, isEmission: boolean)=>{
11
11
 
12
- const { searchPattern,organisationId, searchMinSize, paginateFirst, initSearchPattern, initOrga} = useSimplePageParam(props);
12
+ const { searchPattern,organisationId, searchMinSize, paginateFirst, initSearchPattern, initOrga} = useSimplePageParam(props, false, true);
13
13
  const { isEditRights, isPodcastmaker } = useOrgaComputed();
14
14
  const { stringifyRubriquesFilter } = useRubriquesFilterParam();
15
15
 
@@ -2,7 +2,7 @@ import { useFilterStore } from '../../../stores/FilterStore';
2
2
  import { useRouteUpdateParams } from './useRouteUpdateParams';
3
3
  import { computed, onMounted, Ref, ref, watch } from "vue";
4
4
 
5
- export const useSimplePageParam = (props: {readonly [key:string]: string|number}, force=false)=>{
5
+ export const useSimplePageParam = (props: {readonly [key:string]: string|number}, force=false, advancedSearch=false)=>{
6
6
 
7
7
  const { updateRouteParam } = useRouteUpdateParams();
8
8
 
@@ -12,7 +12,7 @@ export const useSimplePageParam = (props: {readonly [key:string]: string|number}
12
12
  const searchPattern = ref("");
13
13
  const organisationId: Ref<string|undefined> = ref(undefined);
14
14
 
15
- const searchMinSize = computed(() => searchPattern.value.length>3 ? searchPattern.value : "");
15
+ const searchMinSize = computed(() => getMinSize((props.routeQuery as string)));
16
16
  const paginateFirst = computed(() => {
17
17
  if(!props.pr){
18
18
  return 0;
@@ -21,9 +21,12 @@ export const useSimplePageParam = (props: {readonly [key:string]: string|number}
21
21
  });
22
22
 
23
23
  watch(searchPattern, () => {
24
- updateRouteParam({
25
- q: searchMinSize.value.length ? searchMinSize.value : undefined,
26
- }, force);
24
+ if(!advancedSearch){
25
+ const query = getMinSize(searchPattern.value);
26
+ updateRouteParam({
27
+ q: query.length ? query : undefined,
28
+ }, force);
29
+ }
27
30
  });
28
31
 
29
32
  onMounted(() => {
@@ -32,6 +35,9 @@ export const useSimplePageParam = (props: {readonly [key:string]: string|number}
32
35
  isInit.value = true;
33
36
  })
34
37
 
38
+ function getMinSize(param:string){
39
+ return param.length>3 ?param : ""
40
+ }
35
41
  function initSearchPattern(){
36
42
  searchPattern.value = (props.routeQuery as string) ?? "";
37
43
  }
@@ -152,8 +152,8 @@ watch(changePaginate, () => {
152
152
  dfirst.value = props.first;
153
153
  dsize.value = props.size;
154
154
  });
155
- watch(changed, () =>reloadList());
156
- watch(dsize, () =>reloadList());
155
+ watch(changed, () =>fetchContent(true));
156
+ watch(dsize, () =>fetchContent(true));
157
157
  watch(dfirst, () =>{
158
158
  if (
159
159
  !emissions.value[dfirst.value] ||
@@ -172,14 +172,10 @@ onMounted(()=>{
172
172
  })
173
173
 
174
174
  //Methods
175
- function reloadList() {
176
- dfirst.value = 0;
177
- fetchContent(true);
178
- }
179
175
  async function fetchContent(reset: boolean): Promise<void> {
180
176
  loading.value = true;
181
177
  const param: FetchParam = {
182
- first: dfirst.value,
178
+ first: reset? 0: dfirst.value,
183
179
  size: dsize.value,
184
180
  query: props.query,
185
181
  organisationId: organisation.value,
@@ -212,6 +208,7 @@ function afterFetching(
212
208
  data: { count: number; result: Array<Emission>; sort: string },
213
209
  ): void {
214
210
  if (reset) {
211
+ dfirst.value = 0;
215
212
  emissions.value.length = 0;
216
213
  }
217
214
  if (dfirst.value > emissions.value.length) {
@@ -184,9 +184,6 @@ watch(()=>props.searchPattern, (value: string) => {
184
184
  if(search.length <= 3){
185
185
  valSort = props.isEmission? "LAST_PODCAST_DESC" : "DATE";
186
186
  }
187
- if (valSort !== props.sort) {
188
- emit("update:sort", valSort);
189
- }
190
187
  updateRouteParamAdvanced({
191
188
  q: search.length ? search : undefined,
192
189
  s: valSort,
@@ -54,7 +54,7 @@ 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 { computed, ref, watch } from "vue";
57
+ import { computed, watch } from "vue";
58
58
  import { usePlayerStore } from "../../../stores/PlayerStore";
59
59
  import { useI18n } from "vue-i18n";
60
60
 
@@ -78,8 +78,6 @@ const props = defineProps({
78
78
  //Emits
79
79
  const emit = defineEmits(["update:first", "update:rowsPerPage", "update:isMobile"]);
80
80
 
81
- //Data
82
- const internSizeChange = ref(false);
83
81
 
84
82
  //Composables
85
83
  const { t } = useI18n();
@@ -101,10 +99,6 @@ const rangeSize = computed(() => {
101
99
  //Watch
102
100
  watch(isPhone, () => {emit("update:isMobile", isPhone.value);}, {immediate: true});
103
101
  watch(()=>props.first, () => {
104
- if (internSizeChange.value) {
105
- internSizeChange.value = false;
106
- return;
107
- }
108
102
  updateRouteParam({pr:(Math.floor(props.first / props.rowsPerPage) + 1).toString()}, props.forceUpdateParameters);
109
103
  });
110
104
 
@@ -118,9 +112,6 @@ function changeFirst(firstValue: number) {
118
112
  }
119
113
  function changeSize(sizeValue: number) {
120
114
  scrollToTop();
121
- if (0 !== props.first) {
122
- internSizeChange.value = true;
123
- }
124
115
  emit("update:rowsPerPage", sizeValue);
125
116
  updatePaginateSize(sizeValue, props.forceUpdateParameters);
126
117
  }
@@ -103,9 +103,9 @@ watch(changePaginate, () => {
103
103
  dfirst.value = props.first;
104
104
  dsize.value = props.size;
105
105
  });
106
- watch(()=>props.query, () => reloadList());
107
- watch(organisation, () => reloadList());
108
- watch(dsize, () => reloadList());
106
+ watch(()=>props.query, () => fetchContent(true));
107
+ watch(organisation, () => fetchContent(true));
108
+ watch(dsize, () => fetchContent(true));
109
109
  watch(dfirst, () => {
110
110
  if (
111
111
  !participants.value[dfirst.value] ||
@@ -119,10 +119,6 @@ onBeforeMount(()=>fetchContent(true))
119
119
 
120
120
 
121
121
  //Methods
122
- function reloadList() {
123
- dfirst.value = 0;
124
- fetchContent(true);
125
- }
126
122
  async function fetchContent(reset: boolean): Promise<void> {
127
123
  loading.value = true;
128
124
  try {
@@ -131,7 +127,7 @@ async function fetchContent(reset: boolean): Promise<void> {
131
127
  api: 0,
132
128
  path: "participant/search",
133
129
  parameters: {
134
- first: dfirst.value,
130
+ first: reset? 0: dfirst.value,
135
131
  size: dsize.value,
136
132
  query: props.query,
137
133
  organisationId: organisation.value,
@@ -141,6 +137,7 @@ async function fetchContent(reset: boolean): Promise<void> {
141
137
  },
142
138
  );
143
139
  if (reset) {
140
+ dfirst.value = 0;
144
141
  participants.value.length = 0;
145
142
  }
146
143
  displayCount.value = data.count;
@@ -98,8 +98,8 @@ watch(changePaginate, () => {
98
98
  dfirst.value = props.first;
99
99
  dsize.value = props.size;
100
100
  });
101
- watch(changed, () => reloadList());
102
- watch(dsize, () => reloadList());
101
+ watch(changed, () => fetchContent(true));
102
+ watch(dsize, () =>fetchContent(true));
103
103
  watch(dfirst, () => {
104
104
  if (
105
105
  !playlists.value[dfirst.value] ||
@@ -113,14 +113,10 @@ onMounted(()=>fetchContent(true))
113
113
 
114
114
 
115
115
  //Methods
116
- function reloadList() {
117
- dfirst.value = 0;
118
- fetchContent(true);
119
- }
120
116
  async function fetchContent(reset: boolean): Promise<void> {
121
117
  loading.value = true;
122
118
  const param = {
123
- first: dfirst.value,
119
+ first: reset ? 0 : dfirst.value,
124
120
  size: dsize.value,
125
121
  query: props.query,
126
122
  organisationId: organisation.value,
@@ -144,6 +140,7 @@ function afterFetching(
144
140
  data: { count: number; result: Array<Playlist>; sort: string },
145
141
  ): void {
146
142
  if (reset) {
143
+ dfirst.value = 0;
147
144
  playlists.value.length = 0;
148
145
  }
149
146
  if (dfirst.value > playlists.value.length) {
@@ -29,7 +29,7 @@
29
29
  : undefined
30
30
  "
31
31
  :player-responsive="true"
32
- :forceUpdateParameters="true"
32
+ :force-update-parameters="true"
33
33
  >
34
34
  <template #list>
35
35
  <div class="octopus-element-list">
@@ -26,11 +26,12 @@
26
26
  :participant-id="participantId"
27
27
  :emission-id="emissionId"
28
28
  :organisation-id="productorId"
29
+ :sort-criteria="sort"
29
30
  :reload="reloadList"
30
31
  :include-hidden="editRight"
31
32
  :show-count="showCount"
32
33
  :display-sort-text="false"
33
- :forceUpdateParameters="forceUpdateParameters"
34
+ :force-update-parameters="forceUpdateParameters"
34
35
  @fetch="fetch"
35
36
  />
36
37
  </section>
@@ -82,7 +83,8 @@ const titleFilter = computed(() => {
82
83
  ? t("All podcast button", { name: props.name })
83
84
  : t("All podcast emission button");
84
85
  });
85
- const query = computed(() => searchPattern.value.length >= 3 ? searchPattern.value : "");
86
+ const query = computed(() => searchPattern.value.length > 3 ? searchPattern.value : "");
87
+ const sort = computed(() => !query.value.length ? "DATE" : "SCORE");
86
88
 
87
89
  //Watch
88
90
  watch(()=>props.reload, () => {
@@ -19,7 +19,7 @@
19
19
  "
20
20
  :just-size-chosen="justSizeChosen"
21
21
  :player-responsive="true"
22
- :forceUpdateParameters="forceUpdateParameters"
22
+ :force-update-parameters="forceUpdateParameters"
23
23
  >
24
24
  <template #list>
25
25
  <div class="octopus-element-list">
@@ -150,9 +150,9 @@ watch(changePaginate, () => {
150
150
  dfirst.value = props.first;
151
151
  dsize.value = props.size;
152
152
  });
153
- watch(changed, () => reloadList());
154
- watch(()=>props.reload, () => reloadList());
155
- watch(dsize, () => reloadList());
153
+ watch(changed, () => fetchContent(true));
154
+ watch(()=>props.reload, () => fetchContent(true));
155
+ watch(dsize, () => fetchContent(true));
156
156
  watch(dfirst, () => {
157
157
  if (
158
158
  !podcasts.value[dfirst.value] ||
@@ -165,14 +165,10 @@ watch(dfirst, () => {
165
165
  onBeforeMount(()=>fetchContent(true))
166
166
 
167
167
  //Methods
168
- function reloadList() {
169
- dfirst.value = 0;
170
- fetchContent(true);
171
- }
172
168
  async function fetchContent(reset: boolean): Promise<void> {
173
169
  loading.value = true;
174
170
  const param: FetchParam = {
175
- first: dfirst.value,
171
+ first: reset ? 0 : dfirst.value,
176
172
  size: dsize.value,
177
173
  organisationId: organisation.value,
178
174
  emissionId: props.emissionId,
@@ -215,6 +211,7 @@ function afterFetching(
215
211
  data: { count: number; result: Array<Podcast>; sort: string },
216
212
  ): void {
217
213
  if (reset) {
214
+ dfirst.value = 0;
218
215
  podcasts.value.length = 0;
219
216
  }
220
217
  if (dfirst.value > podcasts.value.length) {
@@ -71,16 +71,16 @@
71
71
  />
72
72
  <PodcastFilterList
73
73
  v-if="isInit"
74
+ v-model:query="searchPattern"
74
75
  class="mx-2"
75
76
  :first="paginateFirst"
76
77
  :size="ps"
77
- v-model:query="searchPattern"
78
78
  :show-count="true"
79
79
  :emission-id="emissionId"
80
80
  :category-filter="false"
81
81
  :edit-right="editRight"
82
82
  :productor-id="[emission.orga.id]"
83
- :forceUpdateParameters="true"
83
+ :force-update-parameters="true"
84
84
  @fetch="podcastsFetched"
85
85
  />
86
86
  </section>
@@ -48,16 +48,16 @@
48
48
  <!-- productorId define to avoid overwrite #12817 -->
49
49
  <PodcastFilterList
50
50
  v-if="isInit"
51
+ v-model:query="searchPattern"
51
52
  :first="paginateFirst"
52
53
  :size="ps"
53
- v-model:query="searchPattern"
54
54
  :participant-id="participantId"
55
55
  :name="name"
56
56
  :category-filter="true"
57
57
  :productor-id="['']"
58
58
  :reload="reload"
59
59
  :show-count="true"
60
- :forceUpdateParameters="true"
60
+ :force-update-parameters="true"
61
61
  />
62
62
  </template>
63
63
  <ClassicLoading
@@ -43,9 +43,9 @@
43
43
  <section class="module-box">
44
44
  <PodcastList
45
45
  v-if="isInit"
46
+ v-model:query="searchPattern"
46
47
  :first="paginateFirst"
47
48
  :size="ps"
48
- v-model:query="searchPattern"
49
49
  :playlist="playlist"
50
50
  />
51
51
  </section>