v-sistec-features 1.9.0 → 1.9.2

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,7 +1,7 @@
1
1
  {
2
2
  "name": "v-sistec-features",
3
3
  "private": false,
4
- "version": "1.9.0",
4
+ "version": "1.9.2",
5
5
  "author": "Márlon Bento Azevedo (https://github.com/marlon-bento)",
6
6
  "repository": {
7
7
  "type": "git",
@@ -12,8 +12,8 @@
12
12
  </svg>
13
13
  </a>
14
14
  <div class="input-icon">
15
- <input type="text" class="form-control ms-1" id="inputSearchLaudos" v-model="modelSearch"
16
- @keyup.enter="$emit('search')" placeholder="Buscar...">
15
+ <input type="text" class="form-control ms-1" id="inputSearchVDataTable" v-model="modelSearch"
16
+ @keyup.enter="$emit('search')" :placeholder="placeholder_search">
17
17
 
18
18
  <span v-if="modelSearch" @click="cleanSearch()" class=" inputClose" title="Limpar pesquisa">
19
19
  <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none"
@@ -61,6 +61,7 @@ interface SearchProps {
61
61
  filter?: string;
62
62
  list_filter?: any[];
63
63
  item_use?: number[];
64
+ placeholder_search?: string;
64
65
  }
65
66
  const props = withDefaults(defineProps<SearchProps>(), {
66
67
  filter: "",
@@ -93,7 +94,7 @@ const props = withDefaults(defineProps<SearchProps>(), {
93
94
  // até o momento existem 2 items: 1 (search) e 2 (filter)
94
95
  item_use: () => [1, 2], // se não for passado, assume que é para todos os itens
95
96
  // até o momento existem 2 items: 1 (search) e 2 (filter)
96
-
97
+ placeholder_search: "Buscar...",
97
98
  click: null,
98
99
  });
99
100
 
@@ -21,7 +21,7 @@
21
21
  </slot>
22
22
 
23
23
  <Search v-model:search="pagination.search" v-model:filter="pagination.filter" :list_filter="props.list_filter"
24
- :item_use="item_use" @search="reSearch" />
24
+ :item_use="item_use" @search="reSearch" :placeholder_search="props.placeholder_search"/>
25
25
  </div>
26
26
  <slot name="item-selected-info" :selected_items="selected_items" :clearSelection="() => selected_items = []">
27
27
  <div v-if="(props.use_checkbox && selected_items.length > 0) && !props.deactivate_selected_info"
@@ -296,10 +296,10 @@
296
296
  <span @click="col.click ? col.click(item) : null" v-else-if="col.type === 'date'"
297
297
  :class="col.class_item + (col.click ? ' cursor-pointer' : '')">
298
298
  <span v-if="col.format === 'complete'">{{ new Date(getSubItem(col.field, item)).toLocaleString()
299
- }}</span>
299
+ }}</span>
300
300
  <span v-if="col.format === 'simple'"> {{ new Date(getSubItem(col.field,
301
301
  item)).toLocaleDateString()
302
- }} </span>
302
+ }} </span>
303
303
  </span>
304
304
  <div @click="col.click ? col.click(item) : null"
305
305
  :class="col.class_item + (col.click ? ' cursor-pointer' : '')" v-else-if="col.type === 'html'"
@@ -331,6 +331,9 @@
331
331
  </TransitionGroup>
332
332
  </tbody>
333
333
  </table>
334
+ </div>
335
+ <div v-else-if="first_fetch === false" >
336
+
334
337
  </div>
335
338
  <div v-else class="text-center p-4 text-secondary">
336
339
  <p class="m-0">Nenhum item encontrado.</p>
@@ -353,9 +356,9 @@
353
356
  </template>
354
357
 
355
358
  <script setup lang="ts" generic="T extends Record<string, any>">
356
- import type { VDataTableProps, ExposedFunctions, PaginationObject } from '../types/v-data-table.ts';
359
+ import type { VDataTableProps, ExposedFunctions, PaginationObject } from '../types/v-data-table.ts';
357
360
  import type { Ref } from 'vue';
358
- import { readonly, ref, provide, computed, watch, nextTick} from 'vue';
361
+ import { readonly, ref, provide, computed, watch, nextTick } from 'vue';
359
362
 
360
363
  import PaginationDatatable from '@/Pagination/Pagination.vue';
361
364
  import Search from './SearchDatatable.vue';
@@ -405,6 +408,7 @@ const props = withDefaults(defineProps<VDataTableProps>(), {
405
408
  page_starts_at: 0,
406
409
  deactivate_selected_info: false,
407
410
  immediate: true,
411
+ placeholder_search: "Buscar...",
408
412
  });
409
413
 
410
414
 
@@ -412,7 +416,8 @@ const props = withDefaults(defineProps<VDataTableProps>(), {
412
416
  // 2. ESTADO REATIVO PRINCIPAL
413
417
  // =======================================================
414
418
 
415
-
419
+ // variavel para saber quando o datatable já fez alguma busca
420
+ const first_fetch = ref<boolean>(false);
416
421
  const orderings_state = ref<Record<string, 'none' | 'increasing' | 'decreasing'>>({});
417
422
  const columns = ref<ColumnConfiguration[]>([]);
418
423
  const items = ref<T[]>([]) as Ref<T[]>;
@@ -634,6 +639,8 @@ provide(dataTableApiKey, { addColumn });
634
639
 
635
640
  // Função que gerencia o delay e a chamada da API
636
641
  function fetchDataWithDelay(): void {
642
+ // agora já fez pelo menos a primeira busca então marca como true
643
+ if (!first_fetch.value) first_fetch.value = true;
637
644
  // Limpa timer anterior, se houver
638
645
  if (delayTimer.value) clearTimeout(delayTimer.value);
639
646
 
@@ -60,6 +60,7 @@ export interface VDataTableProps {
60
60
  page_starts_at?: number;
61
61
  deactivate_selected_info?: boolean;
62
62
  immediate?: boolean;
63
+ placeholder_search?: string;
63
64
  }
64
65
 
65
66
  export interface ExposedFunctions<T extends Record<string, any>> {