diff --git a/src/components/VnTable/VnColumn.vue b/src/components/VnTable/VnColumn.vue index 9f6c6d53d..55b2f5fee 100644 --- a/src/components/VnTable/VnColumn.vue +++ b/src/components/VnTable/VnColumn.vue @@ -7,9 +7,11 @@ import { dashIfEmpty } from 'src/filters'; import VnSelect from 'components/common/VnSelect.vue'; import VnSelectCache from 'components/common/VnSelectCache.vue'; import VnInput from 'components/common/VnInput.vue'; +import VnInputNumber from 'components/common/VnInputNumber.vue'; import VnInputDate from 'components/common/VnInputDate.vue'; import VnInputTime from 'components/common/VnInputTime.vue'; import VnComponent from 'components/common/VnComponent.vue'; +import VnUserLink from 'components/ui/VnUserLink.vue'; const model = defineModel(undefined, { required: true }); const $props = defineProps({ @@ -66,7 +68,7 @@ const defaultComponents = { }, }, number: { - component: markRaw(VnInput), + component: markRaw(VnInputNumber), attrs: { disable: !$props.isEditable, class: 'fit', @@ -98,14 +100,14 @@ const defaultComponents = { }, checkbox: { component: markRaw(QCheckbox), - attrs: (prop) => { + attrs: ({ model }) => { const defaultAttrs = { disable: !$props.isEditable, - 'model-value': Boolean(prop), + 'model-value': Boolean(model), class: 'no-padding fit', }; - if (typeof prop == 'number') { + if (typeof model == 'number') { defaultAttrs['true-value'] = 1; defaultAttrs['false-value'] = 0; } @@ -126,6 +128,9 @@ const defaultComponents = { icon: { component: markRaw(QIcon), }, + userLink: { + component: markRaw(VnUserLink), + }, }; const value = computed(() => { @@ -163,14 +168,14 @@ const components = computed(() => $props.components ?? defaultComponents); v-if="col.before" :prop="col.before" :components="components" - :value="model" + :value="{ row, model }" v-model="model" /> {{ value }} @@ -178,7 +183,7 @@ const components = computed(() => $props.components ?? defaultComponents); v-if="col.after" :prop="col.after" :components="components" - :value="model" + :value="{ row, model }" v-model="model" /> diff --git a/src/components/VnTable/VnFilter.vue b/src/components/VnTable/VnFilter.vue index cb93e8229..c6d4d8ef2 100644 --- a/src/components/VnTable/VnFilter.vue +++ b/src/components/VnTable/VnFilter.vue @@ -10,6 +10,8 @@ import VnInputDate from 'components/common/VnInputDate.vue'; import VnInputTime from 'components/common/VnInputTime.vue'; import VnTableColumn from 'components/VnTable/VnColumn.vue'; +defineExpose({ addFilter }); + const $props = defineProps({ column: { type: Object, @@ -32,7 +34,7 @@ const model = defineModel(undefined, { required: true }); const arrayData = useArrayData($props.dataKey, { searchUrl: $props.searchUrl }); const columnFilter = computed(() => $props.column?.columnFilter); -const updateEvent = { 'update:modelValue': addFilter }; +const updateEvent = { 'update:modelValue': addFilter, remove: () => addFilter(null) }; const enterEvent = { 'keyup.enter': () => addFilter(model.value), remove: () => addFilter(null), diff --git a/src/components/VnTable/VnTable.vue b/src/components/VnTable/VnTable.vue index c01b946ed..444ca15bd 100644 --- a/src/components/VnTable/VnTable.vue +++ b/src/components/VnTable/VnTable.vue @@ -323,6 +323,7 @@ defineExpose({ v-bind="$attrs" :limit="20" ref="CrudModelRef" + @on-fetch="(...args) => emit('onFetch', ...args)" :search-url="searchUrl" :disable-infinite-scroll="isTableMode" @save-changes="reload" @@ -360,7 +361,7 @@ defineExpose({ -