From 569df64d8df7cfdd69ab06c8c6b0b99c42cf0f6e Mon Sep 17 00:00:00 2001 From: alexm Date: Thu, 23 May 2024 09:05:57 +0200 Subject: [PATCH] feat(VnTable): refs #6825 move to folder. fix checkboxs --- .../VnTableChip.vue => VnTable/VnChip.vue} | 0 .../VnColumn.vue} | 7 +- .../VnFilter.vue} | 86 ++++++++++--------- .../{common => VnTable}/VnTable.vue | 42 ++++----- src/components/common/VnComponent.vue | 1 - src/components/common/VnSelect.vue | 4 - src/components/common/VnTableFilterMore.vue | 13 --- src/components/common/VnTableObj.json | 33 ------- src/components/ui/VnFilterPanel.vue | 10 ++- .../ExtendedList/CustomerExtendedList.vue | 17 ++-- 10 files changed, 83 insertions(+), 130 deletions(-) rename src/components/{common/VnTableChip.vue => VnTable/VnChip.vue} (100%) rename src/components/{common/VnTableColumn.vue => VnTable/VnColumn.vue} (95%) rename src/components/{common/VnTableFilter.vue => VnTable/VnFilter.vue} (71%) rename src/components/{common => VnTable}/VnTable.vue (94%) delete mode 100644 src/components/common/VnTableFilterMore.vue delete mode 100644 src/components/common/VnTableObj.json diff --git a/src/components/common/VnTableChip.vue b/src/components/VnTable/VnChip.vue similarity index 100% rename from src/components/common/VnTableChip.vue rename to src/components/VnTable/VnChip.vue diff --git a/src/components/common/VnTableColumn.vue b/src/components/VnTable/VnColumn.vue similarity index 95% rename from src/components/common/VnTableColumn.vue rename to src/components/VnTable/VnColumn.vue index c68aa895e..6e3323a62 100644 --- a/src/components/common/VnTableColumn.vue +++ b/src/components/VnTable/VnColumn.vue @@ -61,9 +61,10 @@ const defaultComponents = { attrs: (prop) => { return { disable: !$props.isEditable, - // 'true-value': 1, - // 'false-value': 0, - // 'model-value': Boolean(prop), + 'true-value': 1, + 'false-value': 0, + 'model-value': Boolean(prop), + class: 'no-padding', }; }, forceAttrs: { diff --git a/src/components/common/VnTableFilter.vue b/src/components/VnTable/VnFilter.vue similarity index 71% rename from src/components/common/VnTableFilter.vue rename to src/components/VnTable/VnFilter.vue index bfb62a0cf..f4e0c0343 100644 --- a/src/components/common/VnTableFilter.vue +++ b/src/components/VnTable/VnFilter.vue @@ -1,29 +1,3 @@ - + diff --git a/src/components/common/VnTable.vue b/src/components/VnTable/VnTable.vue similarity index 94% rename from src/components/common/VnTable.vue rename to src/components/VnTable/VnTable.vue index 877788061..b2e5ee22f 100644 --- a/src/components/common/VnTable.vue +++ b/src/components/VnTable/VnTable.vue @@ -2,6 +2,7 @@ import { ref, onMounted, computed, watch } from 'vue'; import { useI18n } from 'vue-i18n'; import { useRouter } from 'vue-router'; +import { useQuasar } from 'quasar'; import { useStateStore } from 'stores/useStateStore'; import FormModelPopup from 'components/FormModelPopup.vue'; @@ -9,9 +10,9 @@ import VnPaginate from 'components/ui/VnPaginate.vue'; import VnFilterPanel from 'components/ui/VnFilterPanel.vue'; import VnLv from 'components/ui/VnLv.vue'; -import VnTableColumn from 'components/common/VnTableColumn.vue'; -import VnTableFilter from 'components/common/VnTableFilter.vue'; -import VnTableChip from 'components/common/VnTableChip.vue'; +import VnTableColumn from 'components/VnTable/VnColumn.vue'; +import VnTableFilter from 'components/VnTable/VnFilter.vue'; +import VnTableChip from 'components/VnTable/VnChip.vue'; const $props = defineProps({ columns: { @@ -22,10 +23,6 @@ const $props = defineProps({ type: String, default: 'card', // 'table', 'card' }, - responsive: { - type: Boolean, - default: true, - }, columnSearch: { type: Boolean, default: true, @@ -50,6 +47,7 @@ const $props = defineProps({ const { t } = useI18n(); const stateStore = useStateStore(); const router = useRouter(); +const quasar = useQuasar(); const mode = ref('card'); const selected = ref([]); @@ -72,7 +70,7 @@ const tableModes = [ ]; onMounted(() => { - mode.value = $props.defaultMode; + mode.value = quasar.platform.is.mobile ? 'card' : $props.defaultMode; stateStore.rightDrawer = true; }); @@ -91,19 +89,10 @@ function splitColumns(columns) { }; for (const col of columns) { - if (!col) continue; - if (col.field == 'tableActions') { - splittedColumns.value.actions = col; - } - if (col.chip) { - splittedColumns.value.chips.push(col); - } - if (col.isTitle) { - splittedColumns.value.title = col; - } - if (col.create) { - splittedColumns.value.create.push(col); - } + if (col.field == 'tableActions') splittedColumns.value.actions = col; + if (col.chip) splittedColumns.value.chips.push(col); + if (col.isTitle) splittedColumns.value.title = col; + if (col.create) splittedColumns.value.create.push(col); if (col.cardVisible) splittedColumns.value.visible.push(col); splittedColumns.value.columns.push(col); } @@ -148,7 +137,13 @@ defineExpose({ });