5b5ab7e5
함상기
20240409
|
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
|
<script setup>
import { onMounted, ref } from 'vue';
class CustomTextEditor {
constructor(props) {
const el = document.createElement('input');
const { maxLength } = props.columnInfo.editor.options;
el.type = 'text';
el.maxLength = maxLength;
el.value = String(props.value);
this.el = el;
}
getElement() {
return this.el;
}
getValue() {
return this.el.value;
}
mounted() {
this.el.select();
}
}
const data = ref([
{
id: '10012',
city: 'Seoul',
country: 'South Korea',
},
{
id: '10013',
city: 'Tokyo',
country: 'Japan',
},
{
id: '10014',
city: 'London',
country: 'England',
},
{
id: '10015',
city: 'Ljubljana',
country: 'Slovenia',
},
{
id: '10016',
city: 'Reykjavik',
country: 'Iceland',
},
]);
const columns = ref([
{
header: 'ID',
name: 'id',
editor: {
type: CustomTextEditor,
options: {
maxLength: 10,
},
},
},
{
header: 'CITY',
name: 'city',
editor: 'text',
},
{
header: 'COUNTRY',
name: 'country',
formatter: 'listItemText',
editor: {
type: 'select',
options: {
listItems: [
{ text: 'South Korea', value: 'South Korea' },
{ text: 'England', value: 'England' },
{ text: 'Japan', value: 'Japan' },
{ text: 'Slovenia', value: 'Slovenia' },
],
},
},
},
]);
const GridTable = ref();
onMounted(() => {
const grid = GridTable.value;
const optPreset = {
selection: {
background: '#4daaf9',
border: '#004082',
},
scrollbar: {
background: '#f5f5f5',
thumb: '#d9d9d9',
active: '#c1c1c1',
},
row: {
even: {
background: '#f3ffe3',
},
hover: {
background: '#ccc',
},
},
cell: {
normal: {
background: '#fbfbfb',
border: '#e0e0e0',
showVerticalBorder: true,
},
header: {
background: '#eee',
border: '#ccc',
showVerticalBorder: true,
},
rowHeader: {
border: '#ccc',
showVerticalBorder: true,
},
editable: {
background: '#fbfbfb',
},
selectedHeader: {
background: '#d8d8d8',
},
focused: {
border: '#418ed4',
},
disabled: {
text: '#b0b0b0',
},
},
};
grid?.applyTheme('striped', optPreset);
grid?.setLanguage('ko');
// const instance = grid?.gridInstance;
// instance?.setWidth(500);
//data Load
// const loginInfo = {};
// const response = getData();
});
</script>
<template>
<div class="card">
<Accordion :activeIndex="0">
<AccordionTab header="Header I" class="w-full">
<tui-grid ref="GridTable" :data="data" :columns="columns"> </tui-grid>
</AccordionTab>
<AccordionTab header="Header II">
<p class="m-0">
Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim
ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Consectetur, adipisci velit, sed quia non numquam eius modi.
</p>
</AccordionTab>
<AccordionTab header="Header III">
<p class="m-0">
At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui
officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus.
</p>
</AccordionTab>
</Accordion>
</div>
</template>
|