1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
import {
GridUAColumnController,
GridRowController,
} from '@ibiz-template/controller';
import { IPSUIActionGroupDetail } from '@ibiz-template/model';
import { useNamespace } from '@ibiz-template/vue-util';
import { computed, defineComponent } from 'vue';
import '@ibiz-template/theme/style/components/widgets/grid/grid-ua-column.scss';
export const GridUAColumn = defineComponent({
name: 'GridUAColumn',
props: {
controller: {
type: GridUAColumnController,
required: true,
},
row: {
type: GridRowController,
required: true,
},
},
setup(props) {
const ns = useNamespace('grid-ua-column');
const onStopPropagation = (e: MouseEvent) => {
e.stopPropagation();
};
const onActionClick = async (
detail: IPSUIActionGroupDetail,
event: MouseEvent,
) => {
await props.controller.onActionClick(detail, props.row, event);
};
// 操作列对齐方式样式变量
const alignStyle = computed(() => {
let justContent = '';
switch (props.controller.model.align) {
case 'LEFT':
justContent = 'flex-start';
break;
case 'RIGHT':
justContent = 'flex-end';
break;
default:
justContent = 'center';
break;
}
return ns.cssVarBlock({ 'justify-content': justContent });
});
return { ns, alignStyle, onStopPropagation, onActionClick };
},
render() {
return (
<div
class={this.ns.b()}
style={this.alignStyle}
on-dblclick={this.onStopPropagation}
onClick={this.onStopPropagation}
>
{!this.controller.model.actionGroup ? null : (
<actionToolbar
action-group={this.controller.model.actionGroup}
actions-state={
this.row.uaColumnStates[this.controller.model.codeName]
}
on-action-click={this.onActionClick}
></actionToolbar>
)}
</div>
);
},
});
export default GridUAColumn;