diff --git a/.vscode/settings.json b/.vscode/settings.json index 5026b7d3b..8f601aa77 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -14,5 +14,5 @@ "[vue]": { "editor.defaultFormatter": "esbenp.prettier-vscode" }, - "cSpell.words": ["axios"] + "cSpell.words": ["axios", "composables"] } diff --git a/src/components/FormModelPopup.vue b/src/components/FormModelPopup.vue index 0f2b6cbf0..981b17fb9 100644 --- a/src/components/FormModelPopup.vue +++ b/src/components/FormModelPopup.vue @@ -35,6 +35,7 @@ const closeForm = async () => { defineExpose({ isLoading, + onDataSaved, }); diff --git a/src/components/VnTable/VnColumn.vue b/src/components/VnTable/VnColumn.vue index aeccdb2d6..c2afabc53 100644 --- a/src/components/VnTable/VnColumn.vue +++ b/src/components/VnTable/VnColumn.vue @@ -7,6 +7,7 @@ import { dashIfEmpty } from 'src/filters'; import VnSelect from 'components/common/VnSelect.vue'; import VnInput from 'components/common/VnInput.vue'; import VnInputDate from 'components/common/VnInputDate.vue'; +import VnInputTime from 'components/common/VnInputTime.vue'; import VnComponent from 'components/common/VnComponent.vue'; const model = defineModel(undefined, { required: true }); @@ -74,6 +75,15 @@ const defaultComponents = { label: $props.showLabel && $props.column.label, }, }, + time: { + component: markRaw(VnInputTime), + attrs: { + disable: !$props.isEditable, + }, + forceAttrs: { + label: $props.showLabel && $props.column.label, + }, + }, checkbox: { component: markRaw(QCheckbox), attrs: (prop) => { diff --git a/src/components/VnTable/VnTable.vue b/src/components/VnTable/VnTable.vue index 31486091b..231ab8a4d 100644 --- a/src/components/VnTable/VnTable.vue +++ b/src/components/VnTable/VnTable.vue @@ -3,17 +3,17 @@ import { ref, onMounted, computed, watch } from 'vue'; import { useI18n } from 'vue-i18n'; import { useRoute, useRouter } from 'vue-router'; import { useQuasar } from 'quasar'; - import { useStateStore } from 'stores/useStateStore'; -import FormModelPopup from 'components/FormModelPopup.vue'; -import CrudModel from 'src/components/CrudModel.vue'; -import VnFilterPanel from 'components/ui/VnFilterPanel.vue'; -import VnLv from 'components/ui/VnLv.vue'; +import CrudModel from 'src/components/CrudModel.vue'; +import FormModelPopup from 'components/FormModelPopup.vue'; + +import VnFilterPanel from 'components/ui/VnFilterPanel.vue'; import VnTableColumn from 'components/VnTable/VnColumn.vue'; import VnTableFilter from 'components/VnTable/VnFilter.vue'; import VnTableChip from 'components/VnTable/VnChip.vue'; import TableVisibleColumns from 'src/components/VnTable/VnVisibleColumn.vue'; +import VnLv from 'components/ui/VnLv.vue'; const $props = defineProps({ columns: { @@ -33,7 +33,7 @@ const $props = defineProps({ default: true, }, rowClick: { - type: Function, + type: [Function, Boolean], default: null, }, redirect: { @@ -80,6 +80,10 @@ const $props = defineProps({ type: Object, default: () => ({}), }, + tableHeight: { + type: String, + default: '90vh', + }, }); const { t } = useI18n(); const stateStore = useStateStore(); @@ -128,12 +132,6 @@ watch( (val) => setUserParams(val) ); -const rowClickFunction = computed(() => { - if ($props.rowClick) return $props.rowClick; - if ($props.redirect) return ({ id }) => redirectFn(id); - return () => {}; -}); - const isTableMode = computed(() => mode.value == TABLE_MODE); function setUserParams(watchedParams) { @@ -180,6 +178,12 @@ function splitColumns(columns) { } } +const rowClickFunction = computed(() => { + if ($props.rowClick != undefined) return $props.rowClick; + if ($props.redirect) return ({ id }) => redirectFn(id); + return () => {}; +}); + function redirectFn(id) { router.push({ path: `/${$props.redirect}/${id}` }); } @@ -224,7 +228,6 @@ defineExpose({ :data-key="$attrs['data-key']" :search-button="true" v-model="params" - :disable-submit-event="true" :search-url="searchUrl" :redirect="!!redirect" > @@ -275,14 +278,14 @@ defineExpose({ table-header-class="bg-header" card-container-class="grid-three" flat - :style="isTableMode && 'max-height: 90vh'" + :style="isTableMode && `max-height: ${tableHeight}`" virtual-scroll @virtual-scroll=" (event) => event.index > rows.length - 2 && CrudModelRef.vnPaginateRef.paginate() " - @row-click="(_, row) => rowClickFunction(row)" + @row-click="(_, row) => rowClickFunction && rowClickFunction(row)" @update:selected="emit('update:selected', $event)" >