sprintify-ui 0.0.191 → 0.0.192

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.
@@ -80,7 +80,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
80
80
  search?: string | undefined;
81
81
  filter?: Record<string, any> | undefined;
82
82
  }>;
83
- }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("click" | "delete" | "checkAll" | "update:checked-rows" | "check" | "update:query" | "will-scroll-top")[], "click" | "delete" | "checkAll" | "update:checked-rows" | "check" | "update:query" | "will-scroll-top", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
83
+ }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("click" | "delete" | "checkAll" | "update:checked-rows" | "check" | "update:query" | "will-scroll-top" | "fetch")[], "click" | "delete" | "checkAll" | "update:checked-rows" | "check" | "update:query" | "will-scroll-top" | "fetch", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
84
84
  /**
85
85
  * Base URL from which to make requests
86
86
  */
@@ -155,6 +155,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
155
155
  onCheck?: ((...args: any[]) => any) | undefined;
156
156
  "onUpdate:query"?: ((...args: any[]) => any) | undefined;
157
157
  "onWill-scroll-top"?: ((...args: any[]) => any) | undefined;
158
+ onFetch?: ((...args: any[]) => any) | undefined;
158
159
  }, {
159
160
  actions: MenuItemInterface[];
160
161
  urlQuery: Record<string, any>;
@@ -163,7 +163,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
163
163
  fetch: () => void;
164
164
  fetchWithoutLoading: () => void;
165
165
  query: import("vue").ComputedRef<DataTableQuery | null>;
166
- }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("delete" | "update:checked-rows" | "cell-click")[], "delete" | "update:checked-rows" | "cell-click", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
166
+ }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("delete" | "update:checked-rows" | "fetch" | "cell-click")[], "delete" | "update:checked-rows" | "fetch" | "cell-click", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
167
167
  /**
168
168
  * Base URL from which to make requests
169
169
  */
@@ -324,6 +324,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
324
324
  }>> & {
325
325
  onDelete?: ((...args: any[]) => any) | undefined;
326
326
  "onUpdate:checked-rows"?: ((...args: any[]) => any) | undefined;
327
+ onFetch?: ((...args: any[]) => any) | undefined;
327
328
  "onCell-click"?: ((...args: any[]) => any) | undefined;
328
329
  }, {
329
330
  actions: MenuItemInterface[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sprintify-ui",
3
- "version": "0.0.191",
3
+ "version": "0.0.192",
4
4
  "scripts": {
5
5
  "build": "rimraf dist && vue-tsc && vite build",
6
6
  "build-fast": "rimraf dist && vite build",
@@ -287,6 +287,7 @@ const emit = defineEmits([
287
287
  'check',
288
288
  'update:query',
289
289
  'will-scroll-top',
290
+ 'fetch',
290
291
  ]);
291
292
 
292
293
  const dataIteratorNode = ref<null | HTMLElement>(null);
@@ -593,6 +594,7 @@ function fetch(force = false, showLoading = true) {
593
594
  loading.value = false;
594
595
  error.value = false;
595
596
  firstLoad.value = true;
597
+ emit('fetch', data.value);
596
598
  })
597
599
  .catch(() => {
598
600
  data.value = null;
@@ -38,7 +38,9 @@ const templateComponents = {
38
38
  };
39
39
 
40
40
  const template = `
41
- <BaseDataTable v-bind="args" @cell-click="onCellClick">
41
+ <div>Last fetch: {{ lastFetch?.getTime() }} (should update on each fetch)</div>
42
+ <br/>
43
+ <BaseDataTable v-bind="args" @cell-click="onCellClick" @fetch="onFetch">
42
44
  <BaseTableColumn
43
45
  v-slot="{ row }"
44
46
  label="Titre"
@@ -181,7 +183,13 @@ const templateSetup = (args) => {
181
183
  alert('cell click!');
182
184
  }
183
185
 
184
- return { args, onCellClick, ownerIsVisible: true };
186
+ const lastFetch = ref(null);
187
+
188
+ function onFetch() {
189
+ lastFetch.value = new Date();
190
+ }
191
+
192
+ return { args, onCellClick, ownerIsVisible: true, onFetch, lastFetch };
185
193
  };
186
194
 
187
195
  const Template = (args) => ({
@@ -10,6 +10,7 @@
10
10
  :layout="layout"
11
11
  :sections="sectionsInternal"
12
12
  :scroll-top-on-fetch="maxHeight ? false : scrollTopOnFetch"
13
+ @fetch="onFetch"
13
14
  @will-scroll-top="onWillScrollTop"
14
15
  >
15
16
  <template
@@ -200,10 +201,13 @@
200
201
  <script lang="ts" setup>
201
202
  import { PropType } from 'vue';
202
203
  import {
204
+ Collection,
203
205
  CollectionItem,
204
206
  DataIteratorSection,
205
207
  DataTableQuery,
206
208
  MenuItemInterface,
209
+ PaginatedCollection,
210
+ ResourceCollection,
207
211
  RowAction,
208
212
  } from '@/types';
209
213
  import { useDialogsStore } from '@/stores/dialogs';
@@ -427,7 +431,12 @@ const props = defineProps({
427
431
  },
428
432
  });
429
433
 
430
- const emit = defineEmits(['cell-click', 'delete', 'update:checked-rows']);
434
+ const emit = defineEmits([
435
+ 'cell-click',
436
+ 'delete',
437
+ 'update:checked-rows',
438
+ 'fetch',
439
+ ]);
431
440
 
432
441
  const dataIterator = ref<null | InstanceType<typeof BaseDataIterator>>(null);
433
442
 
@@ -679,6 +688,18 @@ function onWillScrollTop() {
679
688
  }
680
689
  }
681
690
 
691
+ /*
692
+ |--------------------------------------------------------------------------
693
+ | On fetch
694
+ |--------------------------------------------------------------------------
695
+ */
696
+
697
+ function onFetch(
698
+ payload: null | ResourceCollection | PaginatedCollection | Collection
699
+ ) {
700
+ emit('fetch', payload);
701
+ }
702
+
682
703
  /*
683
704
  |--------------------------------------------------------------------------
684
705
  | Exposed functions