+
({ card: false, table: false }),
+ },
});
const { t } = useI18n();
const stateStore = useStateStore();
@@ -80,11 +88,13 @@ const tableModes = [
icon: 'view_column',
title: t('table view'),
value: TABLE_MODE,
+ disable: $props.disableOption?.table,
},
{
icon: 'grid_view',
title: t('grid view'),
value: DEFAULT_MODE,
+ disable: $props.disableOption?.card,
},
];
@@ -175,11 +185,14 @@ function columnName(col) {
}
function getColAlign(col) {
- return 'text-' + (col.align ?? 'left')
+ return 'text-' + (col.align ?? 'left');
}
+
+const emit = defineEmits(['onFetch', 'update:selected', 'saveChanges']);
defineExpose({
reload,
redirect: redirectFn,
+ selected,
});
@@ -225,11 +238,18 @@ defineExpose({
:search-url="searchUrl"
:disable-infinite-scroll="mode == TABLE_MODE"
@save-changes="reload"
- :has-subtoolbar="isEditable"
+ :has-sub-toolbar="$attrs['hasSubToolbar'] ?? isEditable"
>
+
+
+
rowClickFunction(row)"
+ @update:selected="emit('update:selected', $event)"
>
@@ -310,13 +331,15 @@ defineExpose({
class="no-margin q-px-xs"
:class="getColAlign(col)"
>
-
+
+
+
@@ -401,9 +424,9 @@ defineExpose({
>
@@ -412,14 +435,20 @@ defineExpose({
stopEventPropagation($event)
"
>
-
+ >
+
+
@@ -477,6 +506,7 @@ defineExpose({
default="input"
v-model="data[column.name]"
:show-label="true"
+ component-prop="columnCreate"
/>
diff --git a/src/components/common/VnComponent.vue b/src/components/common/VnComponent.vue
index 318b5ee5f..fccc0c573 100644
--- a/src/components/common/VnComponent.vue
+++ b/src/components/common/VnComponent.vue
@@ -12,7 +12,7 @@ const $props = defineProps({
default: () => {},
},
value: {
- type: [Object, Number, String],
+ type: [Object, Number, String, Boolean],
default: () => {},
},
});
diff --git a/src/components/common/VnInput.vue b/src/components/common/VnInput.vue
index 4cd964012..33b97e29d 100644
--- a/src/components/common/VnInput.vue
+++ b/src/components/common/VnInput.vue
@@ -93,7 +93,12 @@ const inputRules = [
name="close"
size="xs"
v-if="hover && value && !$attrs.disabled && $props.clearable"
- @click="value = null"
+ @click="
+ () => {
+ value = null;
+ emit('remove');
+ }
+ "
>
diff --git a/src/components/common/VnInputDate.vue b/src/components/common/VnInputDate.vue
index 77ab2692d..a88540ebf 100644
--- a/src/components/common/VnInputDate.vue
+++ b/src/components/common/VnInputDate.vue
@@ -1,84 +1,31 @@
-
-
-
-
-
+ v-if="
+ ($attrs.clearable == undefined || $attrs.clearable) &&
+ hover &&
+ model &&
+ !$attrs.disable
+ "
+ @click="
+ model = null;
+ isPopupOpen = false;
+ "
+ />
+
+
+ {
+ formattedDate = date;
+ isPopupOpen = false;
+ }
+ "
+ />
+
-
-
diff --git a/src/components/common/VnInputTime.vue b/src/components/common/VnInputTime.vue
index 5c84951cb..3d482933a 100644
--- a/src/components/common/VnInputTime.vue
+++ b/src/components/common/VnInputTime.vue
@@ -1,14 +1,11 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-es:
- Cancel: Cancelar
-
diff --git a/src/components/common/VnSelect.vue b/src/components/common/VnSelect.vue
index 52cb68438..3e5cd4216 100644
--- a/src/components/common/VnSelect.vue
+++ b/src/components/common/VnSelect.vue
@@ -61,6 +61,10 @@ const $props = defineProps({
type: Boolean,
default: false,
},
+ useLike: {
+ type: Boolean,
+ default: true,
+ },
});
const { t } = useI18n();
@@ -114,11 +118,14 @@ async function fetchFilter(val) {
if (!$props.url || !dataRef.value) return;
const { fields, sortBy, limit } = $props;
- let key = optionLabel.value;
+ let key = optionFilter.value ?? optionLabel.value;
- if (new RegExp(/\d/g).test(val)) key = optionFilter.value ?? optionValue.value;
+ if (new RegExp(/\d/g).test(val)) key = optionValue.value;
- const where = { ...{ [key]: { like: `%${val}%` } }, ...$props.where };
+ const defaultWhere = $props.useLike
+ ? { [key]: { like: `%${val}%` } }
+ : { [key]: val };
+ const where = { ...defaultWhere, ...$props.where };
const fetchOptions = { where, order: sortBy, limit };
if (fields) fetchOptions.fields = fields;
return dataRef.value.fetch(fetchOptions);
diff --git a/src/components/ui/VnFilterPanel.vue b/src/components/ui/VnFilterPanel.vue
index 9eff3d322..16217946b 100644
--- a/src/components/ui/VnFilterPanel.vue
+++ b/src/components/ui/VnFilterPanel.vue
@@ -10,7 +10,7 @@ const { t } = useI18n();
const $props = defineProps({
modelValue: {
type: Object,
- default: () => {}
+ default: () => {},
},
dataKey: {
type: String,
@@ -58,7 +58,14 @@ const $props = defineProps({
},
});
-const emit = defineEmits(['refresh', 'clear', 'search', 'init', 'remove']);
+const emit = defineEmits([
+ 'update:modelValue',
+ 'refresh',
+ 'clear',
+ 'search',
+ 'init',
+ 'remove',
+]);
const arrayData = useArrayData($props.dataKey, {
exprBuilder: $props.exprBuilder,
@@ -67,9 +74,9 @@ const arrayData = useArrayData($props.dataKey, {
});
const route = useRoute();
const store = arrayData.store;
-const userParams = ref({})
+const userParams = ref({});
onMounted(() => {
- userParams.value = $props.modelValue ?? {}
+ userParams.value = $props.modelValue ?? {};
emit('init', { params: userParams.value });
});
@@ -92,6 +99,11 @@ watch(
(val) => setUserParams(val)
);
+watch(
+ () => $props.modelValue,
+ (val) => (userParams.value = val ?? {})
+);
+
const isLoading = ref(false);
async function search(evt) {
if (evt && $props.disableSubmitEvent) return;
@@ -145,6 +157,7 @@ async function clearFilters() {
isLoading.value = false;
emit('clear');
+ emit('update:modelValue', userParams.value);
}
const tagsList = computed(() => {
@@ -168,6 +181,7 @@ async function remove(key) {
userParams.value[key] = undefined;
search();
emit('remove', key);
+ emit('update:modelValue', userParams.value);
}
function formatValue(value) {
diff --git a/src/components/ui/VnImg.vue b/src/components/ui/VnImg.vue
index 37c1edefc..8d747963b 100644
--- a/src/components/ui/VnImg.vue
+++ b/src/components/ui/VnImg.vue
@@ -1,5 +1,5 @@
-
+
{});