2022-09-06 12:03:37 +00:00
|
|
|
<template>
|
2024-03-20 07:02:27 +00:00
|
|
|
<SelectButton :class="cx('root')" :modelValue="modelValue" :options="options" :allowEmpty="false" :unstyled="unstyled" @update:modelValue="changeLayout">
|
|
|
|
<template #option="{ option }">
|
|
|
|
<slot v-if="option === 'list'" name="listicon">
|
2023-05-09 22:39:10 +00:00
|
|
|
<BarsIcon v-bind="ptm('listIcon')" />
|
2023-04-07 06:47:10 +00:00
|
|
|
</slot>
|
2024-03-20 07:02:27 +00:00
|
|
|
<slot v-else-if="option === 'grid'" name="gridicon">
|
2023-05-09 22:39:10 +00:00
|
|
|
<ThLargeIcon v-bind="ptm('gridIcon')" />
|
2023-04-07 06:47:10 +00:00
|
|
|
</slot>
|
2024-03-20 07:02:27 +00:00
|
|
|
</template>
|
|
|
|
</SelectButton>
|
2022-09-06 12:03:37 +00:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2023-04-18 12:53:43 +00:00
|
|
|
import BarsIcon from 'primevue/icons/bars';
|
|
|
|
import ThLargeIcon from 'primevue/icons/thlarge';
|
2024-03-20 07:02:27 +00:00
|
|
|
import SelectButton from 'primevue/selectbutton';
|
2023-06-06 13:04:43 +00:00
|
|
|
import BaseDataViewLayoutOptions from './BaseDataViewLayoutOptions.vue';
|
2023-04-07 06:47:10 +00:00
|
|
|
|
2022-09-14 11:26:01 +00:00
|
|
|
export default {
|
|
|
|
name: 'DataViewLayoutOptions',
|
2023-06-02 16:04:55 +00:00
|
|
|
extends: BaseDataViewLayoutOptions,
|
2024-02-12 13:02:20 +00:00
|
|
|
inheritAttrs: false,
|
2022-09-14 11:26:01 +00:00
|
|
|
emits: ['update:modelValue'],
|
2022-12-08 11:04:25 +00:00
|
|
|
data() {
|
|
|
|
return {
|
2024-03-20 07:02:27 +00:00
|
|
|
options: ['list', 'grid']
|
2022-12-08 11:04:25 +00:00
|
|
|
};
|
|
|
|
},
|
2022-09-14 11:26:01 +00:00
|
|
|
methods: {
|
|
|
|
changeLayout(layout) {
|
|
|
|
this.$emit('update:modelValue', layout);
|
|
|
|
}
|
|
|
|
},
|
|
|
|
computed: {
|
2022-12-08 11:04:25 +00:00
|
|
|
listViewAriaLabel() {
|
|
|
|
return this.$primevue.config.locale.aria ? this.$primevue.config.locale.aria.listView : undefined;
|
|
|
|
},
|
|
|
|
gridViewAriaLabel() {
|
|
|
|
return this.$primevue.config.locale.aria ? this.$primevue.config.locale.aria.gridView : undefined;
|
2022-09-14 11:26:01 +00:00
|
|
|
}
|
2023-04-07 06:47:10 +00:00
|
|
|
},
|
|
|
|
components: {
|
2024-03-20 07:02:27 +00:00
|
|
|
SelectButton,
|
|
|
|
BarsIcon,
|
|
|
|
ThLargeIcon
|
2022-09-14 11:26:01 +00:00
|
|
|
}
|
|
|
|
};
|
2022-09-06 12:03:37 +00:00
|
|
|
</script>
|