v-sistec-features 1.8.2 → 1.9.1
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
|
@@ -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
|
-
|
|
299
|
+
}}</span>
|
|
300
300
|
<span v-if="col.format === 'simple'"> {{ new Date(getSubItem(col.field,
|
|
301
301
|
item)).toLocaleDateString()
|
|
302
|
-
|
|
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
|
|
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';
|
|
@@ -404,6 +407,7 @@ const props = withDefaults(defineProps<VDataTableProps>(), {
|
|
|
404
407
|
limit_per_page: 5,
|
|
405
408
|
page_starts_at: 0,
|
|
406
409
|
deactivate_selected_info: false,
|
|
410
|
+
immediate: true,
|
|
407
411
|
});
|
|
408
412
|
|
|
409
413
|
|
|
@@ -411,7 +415,8 @@ const props = withDefaults(defineProps<VDataTableProps>(), {
|
|
|
411
415
|
// 2. ESTADO REATIVO PRINCIPAL
|
|
412
416
|
// =======================================================
|
|
413
417
|
|
|
414
|
-
|
|
418
|
+
// variavel para saber quando o datatable já fez alguma busca
|
|
419
|
+
const first_fetch = ref<boolean>(false);
|
|
415
420
|
const orderings_state = ref<Record<string, 'none' | 'increasing' | 'decreasing'>>({});
|
|
416
421
|
const columns = ref<ColumnConfiguration[]>([]);
|
|
417
422
|
const items = ref<T[]>([]) as Ref<T[]>;
|
|
@@ -633,6 +638,8 @@ provide(dataTableApiKey, { addColumn });
|
|
|
633
638
|
|
|
634
639
|
// Função que gerencia o delay e a chamada da API
|
|
635
640
|
function fetchDataWithDelay(): void {
|
|
641
|
+
// agora já fez pelo menos a primeira busca então marca como true
|
|
642
|
+
if (!first_fetch.value) first_fetch.value = true;
|
|
636
643
|
// Limpa timer anterior, se houver
|
|
637
644
|
if (delayTimer.value) clearTimeout(delayTimer.value);
|
|
638
645
|
|
|
@@ -764,7 +771,7 @@ watch(
|
|
|
764
771
|
reSearch();
|
|
765
772
|
}
|
|
766
773
|
},
|
|
767
|
-
{ deep: true, immediate:
|
|
774
|
+
{ deep: true, immediate: props.immediate }
|
|
768
775
|
)
|
|
769
776
|
|
|
770
777
|
</script>
|