diff --git a/src/qComponents/QCascader/src/QCascaderRow/QCascaderRow.vue b/src/qComponents/QCascader/src/QCascaderRow/QCascaderRow.vue index bf95a3c9..19e9e65e 100644 --- a/src/qComponents/QCascader/src/QCascaderRow/QCascaderRow.vue +++ b/src/qComponents/QCascader/src/QCascaderRow/QCascaderRow.vue @@ -9,7 +9,7 @@ @keyup.enter="handleEnterKeyUp" >
qCascader.multiple.value ?? false ); + const isCheckStrictly = computed( + () => qCascader.checkStrictly.value ?? false + ); + const childStatuses = computed(() => { if (!qCascader.multiple.value || qCascader.checkStrictly.value) return []; return getChildStatuses(props.row, qCascader.modelValue.value); @@ -140,7 +144,7 @@ export default defineComponent({ const handleClick = (): void => { if (props.row.disabled) return; - if (!isMultiple.value && !props.row.children) { + if (!isMultiple.value && !props.row.children && !isCheckStrictly.value) { ctx.emit('check', props.row, isChecked.value); } @@ -167,6 +171,7 @@ export default defineComponent({ return { rootClasses, isMultiple, + isCheckStrictly, isChecked, isIndeterminate, isIconShown, diff --git a/src/qComponents/QCascader/src/QCascaderRow/types.ts b/src/qComponents/QCascader/src/QCascaderRow/types.ts index c93666c0..5c26706b 100644 --- a/src/qComponents/QCascader/src/QCascaderRow/types.ts +++ b/src/qComponents/QCascader/src/QCascaderRow/types.ts @@ -16,6 +16,7 @@ export interface QCascaderRowProps { export interface QCascaderRowInstance { rootClasses: ComputedRef>; isMultiple: ComputedRef; + isCheckStrictly: ComputedRef; isChecked: ComputedRef; isIndeterminate: ComputedRef; isIconShown: ComputedRef; diff --git a/src/qComponents/QCascader/src/QCascaderTags/QCascaderTags.vue b/src/qComponents/QCascader/src/QCascaderTags/QCascaderTags.vue index 0a113eb2..79773d52 100644 --- a/src/qComponents/QCascader/src/QCascaderTags/QCascaderTags.vue +++ b/src/qComponents/QCascader/src/QCascaderTags/QCascaderTags.vue @@ -59,11 +59,17 @@ export default defineComponent({ if (!Array.isArray(modelValue)) return []; - return modelValue.map(value => ({ - value, - label: - findFullPath(qCascader.options.value, value)?.join(separator) ?? '' - })); + return modelValue.map(value => { + const fullPath = findFullPath(qCascader.options.value, value); + const label = qCascader.allLevelsShown.value + ? fullPath?.join(separator) + : fullPath?.[fullPath?.length - 1]; + + return { + value, + label: label ?? '' + }; + }); }); const handleTagClose = (value: string | number): void => {