diff --git a/src/boot/qformMixin.js b/src/boot/qformMixin.js index a809140b0..0bf1f9795 100644 --- a/src/boot/qformMixin.js +++ b/src/boot/qformMixin.js @@ -27,7 +27,6 @@ export default { this.$el.addEventListener('keyup', function (evt) { if (evt.key === 'Enter') { const input = evt.target; - console.log('input', input); if (input.type == 'textarea' && evt.shiftKey) { evt.preventDefault(); let { selectionStart, selectionEnd } = input; diff --git a/src/components/CrudModel.vue b/src/components/CrudModel.vue index fe15d2db1..c26a9c4a5 100644 --- a/src/components/CrudModel.vue +++ b/src/components/CrudModel.vue @@ -67,6 +67,10 @@ const $props = defineProps({ default: '', description: 'It is used for redirect on click "save and continue"', }, + hasSubtoolbar: { + type: Boolean, + default: true, + }, }); const isLoading = ref(false); @@ -75,6 +79,7 @@ const originalData = ref(); const vnPaginateRef = ref(); const formData = ref(); const saveButtonRef = ref(null); +const watchChanges = ref(); const formUrl = computed(() => $props.url); const emit = defineEmits(['onFetch', 'update:selected', 'saveChanges']); @@ -89,6 +94,7 @@ defineExpose({ saveChanges, getChanges, formData, + vnPaginateRef, }); async function fetch(data) { @@ -97,19 +103,26 @@ async function fetch(data) { data.map((d) => (d.$index = $index++)); } - originalData.value = data && JSON.parse(JSON.stringify(data)); - formData.value = data && JSON.parse(JSON.stringify(data)); - watch(formData, () => (hasChanges.value = true), { deep: true }); + resetData(data); emit('onFetch', data); return data; } +function resetData(data) { + if (!data) return; + originalData.value = JSON.parse(JSON.stringify(data)); + formData.value = JSON.parse(JSON.stringify(data)); + + if (watchChanges.value) watchChanges.value(); //destoy watcher + watchChanges.value = watch(formData, () => (hasChanges.value = true), { deep: true }); +} + async function reset() { await fetch(originalData.value); hasChanges.value = false; } -// eslint-disable-next-line vue/no-dupe-keys + function filter(value, update, filterOptions) { update( () => { @@ -271,8 +284,9 @@ function isEmpty(obj) { if (obj.length > 0) return false; } -async function reload() { - vnPaginateRef.value.fetch(); +async function reload(params) { + const data = await vnPaginateRef.value.fetch(params); + fetch(data); } watch(formUrl, async () => { @@ -284,10 +298,11 @@ watch(formUrl, async () => { - - + + +defineProps({ + columns: { + type: Array, + required: true, + }, + row: { + type: Object, + default: null, + }, +}); + +function stopEventPropagation(event) { + event.preventDefault(); + event.stopPropagation(); +} + + + diff --git a/src/components/VnTable/VnColumn.vue b/src/components/VnTable/VnColumn.vue new file mode 100644 index 000000000..6cd62d83e --- /dev/null +++ b/src/components/VnTable/VnColumn.vue @@ -0,0 +1,161 @@ + + diff --git a/src/components/VnTable/VnFilter.vue b/src/components/VnTable/VnFilter.vue new file mode 100644 index 000000000..3d489cf73 --- /dev/null +++ b/src/components/VnTable/VnFilter.vue @@ -0,0 +1,146 @@ + + diff --git a/src/components/VnTable/VnTable.vue b/src/components/VnTable/VnTable.vue new file mode 100644 index 000000000..493f1480e --- /dev/null +++ b/src/components/VnTable/VnTable.vue @@ -0,0 +1,628 @@ + + + +en: + status: Status +es: + status: Estados + + + diff --git a/src/components/common/VnCard.vue b/src/components/common/VnCard.vue index b04478070..8517525df 100644 --- a/src/components/common/VnCard.vue +++ b/src/components/common/VnCard.vue @@ -1,6 +1,6 @@