2022-09-06 12:03:37 +00:00
|
|
|
<template>
|
2024-01-14 22:25:39 +00:00
|
|
|
<RadioButton :modelValue="checked" :binary="true" :disabled="$attrs.disabled" :name="name" @change="onChange" :unstyled="unstyled" :pt="getColumnPT('rowRadiobutton')" />
|
2022-09-06 12:03:37 +00:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2023-05-08 14:08:06 +00:00
|
|
|
import BaseComponent from 'primevue/basecomponent';
|
2024-01-14 13:38:51 +00:00
|
|
|
import RadioButton from 'primevue/radiobutton';
|
2023-07-19 12:05:06 +00:00
|
|
|
import { mergeProps } from 'vue';
|
2022-12-08 11:04:25 +00:00
|
|
|
|
2022-09-06 12:03:37 +00:00
|
|
|
export default {
|
|
|
|
name: 'RowRadioButton',
|
2023-06-08 11:26:48 +00:00
|
|
|
hostName: 'DataTable',
|
2023-05-08 14:08:06 +00:00
|
|
|
extends: BaseComponent,
|
2022-09-06 12:03:37 +00:00
|
|
|
emits: ['change'],
|
|
|
|
props: {
|
2022-09-14 11:26:01 +00:00
|
|
|
value: null,
|
2022-12-08 11:04:25 +00:00
|
|
|
checked: null,
|
2023-05-09 14:57:31 +00:00
|
|
|
name: null,
|
2023-06-05 13:45:43 +00:00
|
|
|
column: null,
|
|
|
|
index: {
|
|
|
|
type: Number,
|
|
|
|
default: null
|
|
|
|
}
|
2022-09-06 12:03:37 +00:00
|
|
|
},
|
|
|
|
methods: {
|
2023-06-05 13:45:43 +00:00
|
|
|
getColumnPT(key) {
|
2023-07-19 12:05:06 +00:00
|
|
|
const columnMetaData = {
|
2023-05-09 14:57:31 +00:00
|
|
|
props: this.column.props,
|
|
|
|
parent: {
|
2023-12-05 11:06:32 +00:00
|
|
|
instance: this,
|
2023-05-09 14:57:31 +00:00
|
|
|
props: this.$props,
|
|
|
|
state: this.$data
|
|
|
|
},
|
2023-05-08 14:08:06 +00:00
|
|
|
context: {
|
2023-06-05 13:45:43 +00:00
|
|
|
index: this.index,
|
2023-05-08 14:08:06 +00:00
|
|
|
checked: this.checked,
|
|
|
|
disabled: this.$attrs.disabled
|
|
|
|
}
|
2023-07-19 12:05:06 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
return mergeProps(this.ptm(`column.${key}`, { column: columnMetaData }), this.ptm(`column.${key}`, columnMetaData), this.ptmo(this.getColumnProp(), key, columnMetaData));
|
2023-05-08 14:08:06 +00:00
|
|
|
},
|
2023-05-09 14:57:31 +00:00
|
|
|
getColumnProp() {
|
|
|
|
return this.column.props && this.column.props.pt ? this.column.props.pt : undefined; //@todo:
|
|
|
|
},
|
2024-01-14 13:38:51 +00:00
|
|
|
onChange(event) {
|
|
|
|
if (!this.$attrs.disabled) {
|
|
|
|
this.$emit('change', {
|
|
|
|
originalEvent: event,
|
|
|
|
data: this.value
|
|
|
|
});
|
2022-09-06 12:03:37 +00:00
|
|
|
}
|
|
|
|
}
|
2024-01-14 13:38:51 +00:00
|
|
|
},
|
|
|
|
components: {
|
|
|
|
RadioButton
|
2022-09-06 12:03:37 +00:00
|
|
|
}
|
2022-09-14 11:26:01 +00:00
|
|
|
};
|
2022-09-06 12:03:37 +00:00
|
|
|
</script>
|