yuyeon 0.2.3-rc.9 → 0.3.0-rc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/style.css +1 -1
- package/dist/yuyeon.js +2718 -2585
- package/dist/yuyeon.umd.cjs +3 -3
- package/lib/components/button/YButton.mjs +1 -0
- package/lib/components/button/YButton.mjs.map +1 -1
- package/lib/components/button/YButton.scss +9 -0
- package/lib/components/date-picker/YDatePicker.mjs +6 -2
- package/lib/components/date-picker/YDatePicker.mjs.map +1 -1
- package/lib/components/dialog/YDialog.mjs +2 -1
- package/lib/components/dialog/YDialog.mjs.map +1 -1
- package/lib/components/dropdown/YDropdown.mjs +9 -3
- package/lib/components/dropdown/YDropdown.mjs.map +1 -1
- package/lib/components/field-input/YFieldInput.mjs +5 -2
- package/lib/components/field-input/YFieldInput.mjs.map +1 -1
- package/lib/components/index.mjs +1 -0
- package/lib/components/index.mjs.map +1 -1
- package/lib/components/input/YInput.mjs +4 -1
- package/lib/components/input/YInput.mjs.map +1 -1
- package/lib/components/layer/YLayer.mjs.map +1 -1
- package/lib/components/progress-bar/YProgressBar.mjs +1 -1
- package/lib/components/progress-bar/YProgressBar.mjs.map +1 -1
- package/lib/components/progress-ring/YProgressRing.mjs +128 -0
- package/lib/components/progress-ring/YProgressRing.mjs.map +1 -0
- package/lib/components/progress-ring/YProgressRing.scss +38 -0
- package/lib/components/progress-ring/index.mjs +2 -0
- package/lib/components/progress-ring/index.mjs.map +1 -0
- package/lib/components/select/YSelect.mjs +97 -106
- package/lib/components/select/YSelect.mjs.map +1 -1
- package/lib/components/switch/YSwitch.mjs.map +1 -1
- package/lib/components/switch/YSwitch.scss +211 -211
- package/lib/components/table/YDataTableBody.mjs.map +1 -1
- package/lib/components/table/YDataTableCell.mjs +8 -4
- package/lib/components/table/YDataTableCell.mjs.map +1 -1
- package/lib/components/table/YDataTableHead.mjs +23 -11
- package/lib/components/table/YDataTableHead.mjs.map +1 -1
- package/lib/components/table/YDataTableRow.mjs +14 -8
- package/lib/components/table/YDataTableRow.mjs.map +1 -1
- package/lib/components/table/YDataTableServer.mjs.map +1 -1
- package/lib/components/table/composibles/header.mjs +14 -4
- package/lib/components/table/composibles/header.mjs.map +1 -1
- package/lib/components/table/types/header.mjs.map +1 -1
- package/lib/components/table/types/index.mjs.map +1 -1
- package/lib/components/tooltip/YTooltip.mjs +2 -2
- package/lib/components/tooltip/YTooltip.mjs.map +1 -1
- package/lib/composables/layer-group.mjs +0 -6
- package/lib/composables/layer-group.mjs.map +1 -1
- package/lib/composables/progress.mjs +2 -1
- package/lib/composables/progress.mjs.map +1 -1
- package/lib/directives/plate-wave/index.mjs +2 -2
- package/lib/directives/plate-wave/index.mjs.map +1 -1
- package/lib/i18n/built-in.mjs.map +1 -1
- package/lib/index.mjs.map +1 -1
- package/lib/util/component/component.mjs.map +1 -1
- package/package.json +120 -120
- package/types/components/checkbox/YInputCheckbox.d.ts +2 -2
- package/types/components/dialog/YDialog.d.ts +8 -7
- package/types/components/dropdown/YDropdown.d.ts +11 -11
- package/types/components/field-input/YFieldInput.d.ts +1 -1
- package/types/components/icons/YIconCheckbox.d.ts +1 -1
- package/types/components/icons/YIconPageControl.d.ts +1 -1
- package/types/components/icons/YIconSort.d.ts +1 -1
- package/types/components/icons/index.d.ts +5 -5
- package/types/components/index.d.ts +1 -0
- package/types/components/layer/YLayer.d.ts +5 -5
- package/types/components/menu/YMenu.d.ts +4 -4
- package/types/components/progress-bar/YProgressBar.d.ts +1 -1
- package/types/components/progress-ring/YProgressRing.d.ts +34 -0
- package/types/components/progress-ring/index.d.ts +1 -0
- package/types/components/snackbar/YSnackbar.d.ts +3 -3
- package/types/components/table/YDataTable.d.ts +7 -7
- package/types/components/table/YDataTableCell.d.ts +5 -1
- package/types/components/table/YDataTableServer.d.ts +7 -7
- package/types/components/table/composibles/header.d.ts +14 -10
- package/types/components/table/types/header.d.ts +2 -1
- package/types/components/table/types/index.d.ts +1 -0
- package/types/components/text-highlighter/YTextHighlighter.d.ts +1 -1
- package/types/composables/coordinate/index.d.ts +4 -4
- package/types/shims.d.ts +56 -55
- package/types/util/anchor.d.ts +1 -1
- package/types/util/component/component.d.ts +3 -2
|
@@ -1,211 +1,211 @@
|
|
|
1
|
-
@use '../../styles/variables';
|
|
2
|
-
|
|
3
|
-
.y-switch {
|
|
4
|
-
--y-switch__color: var(--y-theme-primary);
|
|
5
|
-
--y-switch__color-rgb: var(--y-theme-primary-rgb);
|
|
6
|
-
font-size: 1rem;
|
|
7
|
-
|
|
8
|
-
&__slot {
|
|
9
|
-
display: flex;
|
|
10
|
-
cursor: pointer;
|
|
11
|
-
align-items: center;
|
|
12
|
-
color: inherit;
|
|
13
|
-
min-height: inherit;
|
|
14
|
-
position: relative;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
&__input {
|
|
18
|
-
width: 3em;
|
|
19
|
-
height: 1.5em;
|
|
20
|
-
position: relative;
|
|
21
|
-
display: inline-flex;
|
|
22
|
-
user-select: none;
|
|
23
|
-
color: inherit;
|
|
24
|
-
flex: 0 0 auto;
|
|
25
|
-
|
|
26
|
-
input[role='switch'] {
|
|
27
|
-
position: absolute;
|
|
28
|
-
opacity: 0;
|
|
29
|
-
width: 100%;
|
|
30
|
-
height: 100%;
|
|
31
|
-
cursor: pointer;
|
|
32
|
-
user-select: none;
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
&:not(&--loading) &__input:active &__thumb {
|
|
37
|
-
transform: scaleX(0.94);
|
|
38
|
-
transform-origin: left;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
&.y-switch--active:not(&--loading) &__input:active &__thumb {
|
|
42
|
-
transform-origin: right;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
&__track {
|
|
46
|
-
width: 100%;
|
|
47
|
-
height: 100%;
|
|
48
|
-
border-radius: 2em;
|
|
49
|
-
background-color: var(--y-theme-surface-variant);
|
|
50
|
-
position: absolute;
|
|
51
|
-
left: 0;
|
|
52
|
-
top: 0;
|
|
53
|
-
transition: 300ms;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
&__thumb {
|
|
57
|
-
width: 1.1em;
|
|
58
|
-
height: 1.1em;
|
|
59
|
-
align-self: center;
|
|
60
|
-
left: 0.185em;
|
|
61
|
-
border-radius: 50%;
|
|
62
|
-
display: flex;
|
|
63
|
-
justify-content: center;
|
|
64
|
-
align-items: center;
|
|
65
|
-
background-color: var(--y-theme-surface);
|
|
66
|
-
pointer-events: none;
|
|
67
|
-
position: relative;
|
|
68
|
-
transition: 180ms cubic-bezier(0.78, 0.04, 0.9, 0.18);
|
|
69
|
-
will-change: left, transform;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
&__spinner {
|
|
73
|
-
position: relative;
|
|
74
|
-
width: 100%;
|
|
75
|
-
height: 100%;
|
|
76
|
-
border-radius: 50%;
|
|
77
|
-
animation: rotate 2s linear infinite;
|
|
78
|
-
contain: paint;
|
|
79
|
-
|
|
80
|
-
@keyframes spinner-blur {
|
|
81
|
-
0% {
|
|
82
|
-
filter: blur(4px);
|
|
83
|
-
}
|
|
84
|
-
50% {
|
|
85
|
-
filter: blur(1px);
|
|
86
|
-
}
|
|
87
|
-
100% {
|
|
88
|
-
filter: blur(4px);
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
&:before {
|
|
93
|
-
content: '';
|
|
94
|
-
position: absolute;
|
|
95
|
-
top: 2px;
|
|
96
|
-
left: 2px;
|
|
97
|
-
right: 2px;
|
|
98
|
-
bottom: 2px;
|
|
99
|
-
border-radius: 50%;
|
|
100
|
-
border-width: 2px 2px 0 0;
|
|
101
|
-
border-style: solid;
|
|
102
|
-
border-color: var(--y-switch__color) transparent;
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
&:after {
|
|
106
|
-
content: '';
|
|
107
|
-
position: absolute;
|
|
108
|
-
left: 0;
|
|
109
|
-
top: 0;
|
|
110
|
-
right: 0;
|
|
111
|
-
bottom: 0;
|
|
112
|
-
background: linear-gradient(
|
|
113
|
-
0deg,
|
|
114
|
-
transparent 60%,
|
|
115
|
-
rgba(var(--y-switch__color), 0.4)
|
|
116
|
-
);
|
|
117
|
-
filter: blur(4px);
|
|
118
|
-
animation: spinner-blur 3s infinite;
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
&--active {
|
|
123
|
-
.y-switch__track {
|
|
124
|
-
background-color: var(--y-switch__color);
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
.y-switch__thumb {
|
|
128
|
-
left: calc(100% - 1.1em - 0.24em);
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
&--active:not(&--loading):active &__thumb {
|
|
133
|
-
left: 1.8em;
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
&--focused {
|
|
137
|
-
.y-switch__thumb:before {
|
|
138
|
-
content: '';
|
|
139
|
-
position: absolute;
|
|
140
|
-
top: 2px;
|
|
141
|
-
bottom: 2px;
|
|
142
|
-
left: 2px;
|
|
143
|
-
right: 2px;
|
|
144
|
-
border-radius: 50%;
|
|
145
|
-
background-color: rgba(var(--y-switch__color-rgb), 0.4);
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
&--stick-out {
|
|
150
|
-
.y-switch__thumb {
|
|
151
|
-
box-shadow:
|
|
152
|
-
2px 2px 5px -2px rgba(var(--y-theme-shadow-rgb, 0, 0, 0), 0.54),
|
|
153
|
-
1px 1px 4px rgba(var(--y-theme-shadow-rgb, 0, 0, 0), 0.12),
|
|
154
|
-
0 0 0 1px rgba(var(--y-theme-shadow-rgb, 0, 0, 0), 0.08);
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
.y-switch__track {
|
|
158
|
-
width: 80%;
|
|
159
|
-
height: 74%;
|
|
160
|
-
top: 50%;
|
|
161
|
-
left: 50%;
|
|
162
|
-
transform: translate(-50%, -50%);
|
|
163
|
-
box-shadow: inset 0 0 4px -1px rgba(var(--y-theme-shadow-rgb, 0, 0, 0), 0.34);
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
&--disabled {
|
|
168
|
-
opacity: 0.8;
|
|
169
|
-
filter: brightness(0.88);
|
|
170
|
-
|
|
171
|
-
.y-switch__thumb {
|
|
172
|
-
opacity: 0.4;
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
&--disabled &__slot,
|
|
176
|
-
&--disabled &__input input {
|
|
177
|
-
cursor: default;
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
&__state {
|
|
181
|
-
position: relative;
|
|
182
|
-
width: 100%;
|
|
183
|
-
height: 100%;
|
|
184
|
-
contain: content;
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
&__state-label {
|
|
188
|
-
font-size: 12px;
|
|
189
|
-
color: var(--y-theme-on-primary);
|
|
190
|
-
position: absolute;
|
|
191
|
-
height: 100%;
|
|
192
|
-
display: flex;
|
|
193
|
-
align-items: center;
|
|
194
|
-
transition: transform 180ms cubic-bezier(0.16, 0.85, 0.36, 0.96);
|
|
195
|
-
|
|
196
|
-
&--on {
|
|
197
|
-
left: -40px;
|
|
198
|
-
}
|
|
199
|
-
&--off {
|
|
200
|
-
right: 10px;
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
&--active &__state-label {
|
|
205
|
-
transform: translateX(50px);
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
&--stick-out &__state-label--off {
|
|
209
|
-
right: 7px;
|
|
210
|
-
}
|
|
211
|
-
}
|
|
1
|
+
@use '../../styles/variables';
|
|
2
|
+
|
|
3
|
+
.y-switch {
|
|
4
|
+
--y-switch__color: var(--y-theme-primary);
|
|
5
|
+
--y-switch__color-rgb: var(--y-theme-primary-rgb);
|
|
6
|
+
font-size: 1rem;
|
|
7
|
+
|
|
8
|
+
&__slot {
|
|
9
|
+
display: flex;
|
|
10
|
+
cursor: pointer;
|
|
11
|
+
align-items: center;
|
|
12
|
+
color: inherit;
|
|
13
|
+
min-height: inherit;
|
|
14
|
+
position: relative;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
&__input {
|
|
18
|
+
width: 3em;
|
|
19
|
+
height: 1.5em;
|
|
20
|
+
position: relative;
|
|
21
|
+
display: inline-flex;
|
|
22
|
+
user-select: none;
|
|
23
|
+
color: inherit;
|
|
24
|
+
flex: 0 0 auto;
|
|
25
|
+
|
|
26
|
+
input[role='switch'] {
|
|
27
|
+
position: absolute;
|
|
28
|
+
opacity: 0;
|
|
29
|
+
width: 100%;
|
|
30
|
+
height: 100%;
|
|
31
|
+
cursor: pointer;
|
|
32
|
+
user-select: none;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
&:not(&--loading) &__input:active &__thumb {
|
|
37
|
+
transform: scaleX(0.94);
|
|
38
|
+
transform-origin: left;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
&.y-switch--active:not(&--loading) &__input:active &__thumb {
|
|
42
|
+
transform-origin: right;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
&__track {
|
|
46
|
+
width: 100%;
|
|
47
|
+
height: 100%;
|
|
48
|
+
border-radius: 2em;
|
|
49
|
+
background-color: var(--y-theme-surface-variant);
|
|
50
|
+
position: absolute;
|
|
51
|
+
left: 0;
|
|
52
|
+
top: 0;
|
|
53
|
+
transition: 300ms;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
&__thumb {
|
|
57
|
+
width: 1.1em;
|
|
58
|
+
height: 1.1em;
|
|
59
|
+
align-self: center;
|
|
60
|
+
left: 0.185em;
|
|
61
|
+
border-radius: 50%;
|
|
62
|
+
display: flex;
|
|
63
|
+
justify-content: center;
|
|
64
|
+
align-items: center;
|
|
65
|
+
background-color: var(--y-theme-surface);
|
|
66
|
+
pointer-events: none;
|
|
67
|
+
position: relative;
|
|
68
|
+
transition: 180ms cubic-bezier(0.78, 0.04, 0.9, 0.18);
|
|
69
|
+
will-change: left, transform;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
&__spinner {
|
|
73
|
+
position: relative;
|
|
74
|
+
width: 100%;
|
|
75
|
+
height: 100%;
|
|
76
|
+
border-radius: 50%;
|
|
77
|
+
animation: rotate 2s linear infinite;
|
|
78
|
+
contain: paint;
|
|
79
|
+
|
|
80
|
+
@keyframes spinner-blur {
|
|
81
|
+
0% {
|
|
82
|
+
filter: blur(4px);
|
|
83
|
+
}
|
|
84
|
+
50% {
|
|
85
|
+
filter: blur(1px);
|
|
86
|
+
}
|
|
87
|
+
100% {
|
|
88
|
+
filter: blur(4px);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
&:before {
|
|
93
|
+
content: '';
|
|
94
|
+
position: absolute;
|
|
95
|
+
top: 2px;
|
|
96
|
+
left: 2px;
|
|
97
|
+
right: 2px;
|
|
98
|
+
bottom: 2px;
|
|
99
|
+
border-radius: 50%;
|
|
100
|
+
border-width: 2px 2px 0 0;
|
|
101
|
+
border-style: solid;
|
|
102
|
+
border-color: var(--y-switch__color) transparent;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
&:after {
|
|
106
|
+
content: '';
|
|
107
|
+
position: absolute;
|
|
108
|
+
left: 0;
|
|
109
|
+
top: 0;
|
|
110
|
+
right: 0;
|
|
111
|
+
bottom: 0;
|
|
112
|
+
background: linear-gradient(
|
|
113
|
+
0deg,
|
|
114
|
+
transparent 60%,
|
|
115
|
+
rgba(var(--y-switch__color), 0.4)
|
|
116
|
+
);
|
|
117
|
+
filter: blur(4px);
|
|
118
|
+
animation: spinner-blur 3s infinite;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
&--active {
|
|
123
|
+
.y-switch__track {
|
|
124
|
+
background-color: var(--y-switch__color);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
.y-switch__thumb {
|
|
128
|
+
left: calc(100% - 1.1em - 0.24em);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
&--active:not(&--loading):active &__thumb {
|
|
133
|
+
left: 1.8em;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
&--focused {
|
|
137
|
+
.y-switch__thumb:before {
|
|
138
|
+
content: '';
|
|
139
|
+
position: absolute;
|
|
140
|
+
top: 2px;
|
|
141
|
+
bottom: 2px;
|
|
142
|
+
left: 2px;
|
|
143
|
+
right: 2px;
|
|
144
|
+
border-radius: 50%;
|
|
145
|
+
background-color: rgba(var(--y-switch__color-rgb), 0.4);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
&--stick-out {
|
|
150
|
+
.y-switch__thumb {
|
|
151
|
+
box-shadow:
|
|
152
|
+
2px 2px 5px -2px rgba(var(--y-theme-shadow-rgb, 0, 0, 0), 0.54),
|
|
153
|
+
1px 1px 4px rgba(var(--y-theme-shadow-rgb, 0, 0, 0), 0.12),
|
|
154
|
+
0 0 0 1px rgba(var(--y-theme-shadow-rgb, 0, 0, 0), 0.08);
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
.y-switch__track {
|
|
158
|
+
width: 80%;
|
|
159
|
+
height: 74%;
|
|
160
|
+
top: 50%;
|
|
161
|
+
left: 50%;
|
|
162
|
+
transform: translate(-50%, -50%);
|
|
163
|
+
box-shadow: inset 0 0 4px -1px rgba(var(--y-theme-shadow-rgb, 0, 0, 0), 0.34);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
&--disabled {
|
|
168
|
+
opacity: 0.8;
|
|
169
|
+
filter: brightness(0.88);
|
|
170
|
+
|
|
171
|
+
.y-switch__thumb {
|
|
172
|
+
opacity: 0.4;
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
&--disabled &__slot,
|
|
176
|
+
&--disabled &__input input {
|
|
177
|
+
cursor: default;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
&__state {
|
|
181
|
+
position: relative;
|
|
182
|
+
width: 100%;
|
|
183
|
+
height: 100%;
|
|
184
|
+
contain: content;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
&__state-label {
|
|
188
|
+
font-size: 12px;
|
|
189
|
+
color: var(--y-theme-on-primary);
|
|
190
|
+
position: absolute;
|
|
191
|
+
height: 100%;
|
|
192
|
+
display: flex;
|
|
193
|
+
align-items: center;
|
|
194
|
+
transition: transform 180ms cubic-bezier(0.16, 0.85, 0.36, 0.96);
|
|
195
|
+
|
|
196
|
+
&--on {
|
|
197
|
+
left: -40px;
|
|
198
|
+
}
|
|
199
|
+
&--off {
|
|
200
|
+
right: 10px;
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
&--active &__state-label {
|
|
205
|
+
transform: translateX(50px);
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
&--stick-out &__state-label--off {
|
|
209
|
+
right: 7px;
|
|
210
|
+
}
|
|
211
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"YDataTableBody.mjs","names":["mergeProps","useRender","defineComponent","propsFactory","YDataTableRow","useHeader","useSelection","pressYDataTableBodyProps","items","type","Array","default","loading","Boolean","String","loadingText","hideNoData","noDataText","rowProps","Function","Object","rowHeight","Number","YDataTableBody","name","props","emits","setup","_ref","slots","emit","columns","isSelected","toggleSelect","_createVNode","value","length","_Fragment","body","map","item","index","stateProps","raw","internalItem","onClick","event","el","onDblclick","onContextmenu","onMousedown","onKeydown","slotProps","key","_mergeProps"],"sources":["../../../src/components/table/YDataTableBody.tsx"],"sourcesContent":["import { type PropType, mergeProps } from 'vue';\n\nimport { useRender } from '@/composables/component';\nimport { defineComponent, propsFactory } from '@/util/component';\n\nimport { YDataTableRow } from './YDataTableRow';\nimport { useHeader } from './composibles/header';\nimport { useSelection } from './composibles/selection';\nimport { DataTableItem, RowProps } from './types';\n\nexport const pressYDataTableBodyProps = propsFactory(\n {\n items: {\n type: Array as PropType<readonly DataTableItem[]>,\n default: () => [],\n },\n loading: [Boolean, String],\n loadingText: String,\n hideNoData: Boolean,\n noDataText: {\n type: String,\n default: '',\n },\n rowProps: [Function, Object] as PropType<RowProps<any>>,\n rowHeight: Number,\n 'onClick:row': Function as PropType<(e: Event, value: any) => void>,\n 'onDblclick:row': Function as PropType<(e: Event, value: any) => void>,\n 'onContextmenu:row': Function as PropType<(e: Event, value: any) => void>,\n 'onMousedown:row': Function as PropType<(e: Event, value: any) => void>,\n 'onKeydown:row': Function as PropType<(e: Event, value: any) => void>,\n },\n 'YDataTableBody',\n);\n\nexport const YDataTableBody = defineComponent({\n name: 'YDataTableBody',\n props: {\n ...pressYDataTableBodyProps(),\n },\n emits: ['click:row', 'dblclick:row', 'contextmenu:row', 'mousedown:row'],\n setup(props, { slots, emit }) {\n const { columns } = useHeader();\n const { isSelected, toggleSelect } = useSelection();\n\n useRender(() => {\n if (props.loading) {\n return (\n <tr>\n <td colspan={columns.value.length} class={'y-data-table__loading'}>\n {slots.loading ? slots.loading() : <div>{props.loadingText}</div>}\n </td>\n </tr>\n );\n }\n if (!props.loading && props.items.length < 1 && !props.hideNoData) {\n return (\n <tr key=\"no-data\" class=\"y-data-table__no-data\">\n <td colspan={columns.value.length}>\n {slots['no-data']?.() ?? props.noDataText}\n </td>\n </tr>\n );\n }\n return (\n <>\n {slots.body\n ? slots.body?.(props)\n : props.items.map((item, index) => {\n const stateProps = {\n index,\n item: item.raw,\n internalItem: item,\n columns: columns.value,\n isSelected,\n toggleSelect,\n };\n\n function onClick(event: Event, el: null | Element) {\n props['onClick:row']?.(event, { ...stateProps, el });\n }\n\n function onDblclick(event: Event, el: null | Element) {\n props['onDblclick:row']?.(event, { ...stateProps, el });\n }\n\n function onContextmenu(event: Event, el: null | Element) {\n props['onContextmenu:row']?.(event, {\n ...stateProps,\n el,\n });\n }\n\n function onMousedown(event: Event, el: null | Element) {\n props['onMousedown:row']?.(event, { ...stateProps, el });\n }\n\n function onKeydown(event: Event, el: null | Element) {\n props['onKeydown:row']?.(event, { ...stateProps, el });\n }\n\n const slotProps = {\n ...stateProps,\n props: mergeProps(\n {\n key: `item__${item.key ?? item.index}`,\n item,\n index,\n },\n typeof props.rowProps === 'function'\n ? props.rowProps({\n item: stateProps.item,\n index: stateProps.index,\n internalItem: stateProps.internalItem,\n })\n : props.rowProps,\n ),\n onClick,\n onContextmenu,\n onDblclick,\n onMousedown,\n onKeydown,\n };\n\n return (\n <>\n {slots.item ? (\n slots.item(slotProps)\n ) : (\n <YDataTableRow\n v-slots={slots}\n {...slotProps.props}\n onClick={props['onClick:row'] && onClick}\n onContextmenu={\n props['onContextmenu:row'] && onContextmenu\n }\n onDblclick={props['onDblclick:row'] && onDblclick}\n onMousedown={props['onMousedown:row'] && onMousedown}\n onKeydown={props['onKeydown:row'] && onKeydown}\n ></YDataTableRow>\n )}\n </>\n );\n })}\n </>\n );\n });\n\n // end\n return {};\n },\n});\n\nexport type YDataTableBody = InstanceType<typeof YDataTableBody>;\n"],"mappings":";AAAA,SAAwBA,UAAU,QAAQ,KAAK;AAAC,SAEvCC,SAAS;AAAA,SACTC,eAAe,EAAEC,YAAY;AAAA,SAE7BC,aAAa;AAAA,SACbC,SAAS;AAAA,SACTC,YAAY;AAGrB,OAAO,MAAMC,wBAAwB,GAAGJ,YAAY,CAClD;EACEK,KAAK,EAAE;IACLC,IAAI,EAAEC,KAA2C;IACjDC,OAAO,EAAEA,CAAA,KAAM;EACjB,CAAC;EACDC,OAAO,EAAE,CAACC,OAAO,EAAEC,MAAM,CAAC;EAC1BC,WAAW,EAAED,MAAM;EACnBE,UAAU,EAAEH,OAAO;EACnBI,UAAU,EAAE;IACVR,IAAI,EAAEK,MAAM;IACZH,OAAO,EAAE;EACX,CAAC;EACDO,QAAQ,EAAE,CAACC,QAAQ,EAAEC,MAAM,CAA4B;EACvDC,SAAS,EAAEC,MAAM;EACjB,aAAa,EAAEH,QAAoD;EACnE,gBAAgB,EAAEA,Q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D,OAAOhB,KAAK,CAACP,QAAQ,KAAK,UAAU,GAChCO,KAAK,CAACP,QAAQ,CAAC;YACbsB,IAAI,EAAEE,UAAU,CAACF,IAAI;YACrBC,KAAK,EAAEC,UAAU,CAACD,KAAK;YACvBG,YAAY,EAAEF,UAAU,CAACE;UAC3B,CAAC,CAAC,GACFnB,KAAK,CAACP,QACZ,CAAC;UACD2B,OAAO;UACPI,aAAa;UACbD,UAAU;UACVE,WAAW;UACXC;QACF,CAAC;QAED,OAAAjB,YAAA,CAAAG,SAAA,SAEKR,KAAK,CAACW,IAAI,GACTX,KAAK,CAACW,IAAI,CAACY,SAAS,CAAC,GAAAlB,YAAA,CAAA9B,aAAA,EAAAkD,WAAA,CAIfF,SAAS,CAAC3B,KAAK;UAAA,WACVA,KAAK,CAAC,aAAa,CAAC,IAAIoB,OAAO;UAAA,iBAEtCpB,KAAK,CAAC,mBAAmB,CAAC,IAAIwB,aAAa;UAAA,cAEjCxB,KAAK,CAAC,gBAAgB,CAAC,IAAIuB,UAAU;UAAA,eACpCvB,KAAK,CAAC,iBAAiB,CAAC,IAAIyB,WAAW;UAAA,aACzCzB,KAAK,CAAC,eAAe,CAAC,IAAI0B;QAAS,IARrCtB,KAAK,CAUjB;MAGP,CAAC,CAAC;IAGZ,CAAC,CAAC;;IAEF;IACA,OAAO,CAAC,CAAC;EACX;AACF,CAAC,CAAC"}
|
|
1
|
+
{"version":3,"file":"YDataTableBody.mjs","names":["mergeProps","useRender","defineComponent","propsFactory","YDataTableRow","useHeader","useSelection","pressYDataTableBodyProps","items","type","Array","default","loading","Boolean","String","loadingText","hideNoData","noDataText","rowProps","Function","Object","rowHeight","Number","YDataTableBody","name","props","emits","setup","_ref","slots","emit","columns","isSelected","toggleSelect","_createVNode","value","length","_Fragment","body","map","item","index","stateProps","raw","internalItem","onClick","event","el","onDblclick","onContextmenu","onMousedown","onKeydown","slotProps","key","_mergeProps"],"sources":["../../../src/components/table/YDataTableBody.tsx"],"sourcesContent":["import { type PropType, mergeProps } from 'vue';\r\n\r\nimport { useRender } from '@/composables/component';\r\nimport { defineComponent, propsFactory } from '@/util/component';\r\n\r\nimport { YDataTableRow } from './YDataTableRow';\r\nimport { useHeader } from './composibles/header';\r\nimport { useSelection } from './composibles/selection';\r\nimport { DataTableItem, RowProps } from './types';\r\n\r\nexport const pressYDataTableBodyProps = propsFactory(\r\n {\r\n items: {\r\n type: Array as PropType<readonly DataTableItem[]>,\r\n default: () => [],\r\n },\r\n loading: [Boolean, String],\r\n loadingText: String,\r\n hideNoData: Boolean,\r\n noDataText: {\r\n type: String,\r\n default: '',\r\n },\r\n rowProps: [Function, Object] as PropType<RowProps<any>>,\r\n rowHeight: Number,\r\n 'onClick:row': Function as PropType<(e: Event, value: any) => void>,\r\n 'onDblclick:row': Function as PropType<(e: Event, value: any) => void>,\r\n 'onContextmenu:row': Function as PropType<(e: Event, value: any) => void>,\r\n 'onMousedown:row': Function as PropType<(e: Event, value: any) => void>,\r\n 'onKeydown:row': Function as PropType<(e: Event, value: any) => void>,\r\n },\r\n 'YDataTableBody',\r\n);\r\n\r\nexport const YDataTableBody = defineComponent({\r\n name: 'YDataTableBody',\r\n props: {\r\n ...pressYDataTableBodyProps(),\r\n },\r\n emits: ['click:row', 'dblclick:row', 'contextmenu:row', 'mousedown:row'],\r\n setup(props, { slots, emit }) {\r\n const { columns } = useHeader();\r\n const { isSelected, toggleSelect } = useSelection();\r\n\r\n useRender(() => {\r\n if (props.loading) {\r\n return (\r\n <tr>\r\n <td colspan={columns.value.length} class={'y-data-table__loading'}>\r\n {slots.loading ? slots.loading() : <div>{props.loadingText}</div>}\r\n </td>\r\n </tr>\r\n );\r\n }\r\n if (!props.loading && props.items.length < 1 && !props.hideNoData) {\r\n return (\r\n <tr key=\"no-data\" class=\"y-data-table__no-data\">\r\n <td colspan={columns.value.length}>\r\n {slots['no-data']?.() ?? props.noDataText}\r\n </td>\r\n </tr>\r\n );\r\n }\r\n return (\r\n <>\r\n {slots.body\r\n ? slots.body?.(props)\r\n : props.items.map((item, index) => {\r\n const stateProps = {\r\n index,\r\n item: item.raw,\r\n internalItem: item,\r\n columns: columns.value,\r\n isSelected,\r\n toggleSelect,\r\n };\r\n\r\n function onClick(event: Event, el: null | Element) {\r\n props['onClick:row']?.(event, { ...stateProps, el });\r\n }\r\n\r\n function onDblclick(event: Event, el: null | Element) {\r\n props['onDblclick:row']?.(event, { ...stateProps, el });\r\n }\r\n\r\n function onContextmenu(event: Event, el: null | Element) {\r\n props['onContextmenu:row']?.(event, {\r\n ...stateProps,\r\n el,\r\n });\r\n }\r\n\r\n function onMousedown(event: Event, el: null | Element) {\r\n props['onMousedown:row']?.(event, { ...stateProps, el });\r\n }\r\n\r\n function onKeydown(event: Event, el: null | Element) {\r\n props['onKeydown:row']?.(event, { ...stateProps, el });\r\n }\r\n\r\n const slotProps = {\r\n ...stateProps,\r\n props: mergeProps(\r\n {\r\n key: `item__${item.key ?? item.index}`,\r\n item,\r\n index,\r\n },\r\n typeof props.rowProps === 'function'\r\n ? props.rowProps({\r\n item: stateProps.item,\r\n index: stateProps.index,\r\n internalItem: stateProps.internalItem,\r\n })\r\n : props.rowProps,\r\n ),\r\n onClick,\r\n onContextmenu,\r\n onDblclick,\r\n onMousedown,\r\n onKeydown,\r\n };\r\n\r\n return (\r\n <>\r\n {slots.item ? (\r\n slots.item(slotProps)\r\n ) : (\r\n <YDataTableRow\r\n v-slots={slots}\r\n {...slotProps.props}\r\n onClick={props['onClick:row'] && onClick}\r\n onContextmenu={\r\n props['onContextmenu:row'] && onContextmenu\r\n }\r\n onDblclick={props['onDblclick:row'] && onDblclick}\r\n onMousedown={props['onMousedown:row'] && onMousedown}\r\n onKeydown={props['onKeydown:row'] && onKeydown}\r\n ></YDataTableRow>\r\n )}\r\n </>\r\n );\r\n })}\r\n </>\r\n );\r\n });\r\n\r\n // end\r\n return {};\r\n },\r\n});\r\n\r\nexport type YDataTableBody = InstanceType<typeof YDataTableBody>;\r\n"],"mappings":";AAAA,SA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,CAAC,iBAAiB,CAAC,IAAIyB,WAAW;UAAA,aACzCzB,KAAK,CAAC,eAAe,CAAC,IAAI0B;QAAS,IARrCtB,KAAK,CAUjB;MAGP,CAAC,CAAC;IAGZ,CAAC,CAAC;;IAEF;IACA,OAAO,CAAC,CAAC;EACX;AACF,CAAC,CAAC"}
|
|
@@ -17,6 +17,9 @@ export const YDataTableCell = defineComponent({
|
|
|
17
17
|
fixedOffset: {
|
|
18
18
|
type: Number
|
|
19
19
|
},
|
|
20
|
+
rightOffset: {
|
|
21
|
+
type: Number
|
|
22
|
+
},
|
|
20
23
|
width: {
|
|
21
24
|
type: [Number, String]
|
|
22
25
|
},
|
|
@@ -41,10 +44,10 @@ export const YDataTableCell = defineComponent({
|
|
|
41
44
|
const offsetStyle = computed(() => {
|
|
42
45
|
const ret = {};
|
|
43
46
|
if (props.fixed && props.fixedOffset !== undefined) {
|
|
44
|
-
if (props.fixed
|
|
45
|
-
ret['left'] = toStyleSizeValue(props.fixedOffset);
|
|
46
|
-
} else if (props.fixed === 'last') {
|
|
47
|
+
if (props.fixed.startsWith('lead')) {
|
|
47
48
|
ret['left'] = toStyleSizeValue(props.fixedOffset);
|
|
49
|
+
} else if (props.fixed.startsWith('trail')) {
|
|
50
|
+
ret['right'] = toStyleSizeValue(props.rightOffset);
|
|
48
51
|
}
|
|
49
52
|
}
|
|
50
53
|
return ret;
|
|
@@ -54,7 +57,8 @@ export const YDataTableCell = defineComponent({
|
|
|
54
57
|
return _createVNode(ElTag, _mergeProps({
|
|
55
58
|
"class": [`y-data-table__${ElTag}`, 'y-data-table-cell', {
|
|
56
59
|
'y-data-table-cell--fixed': props.fixed,
|
|
57
|
-
|
|
60
|
+
'y-data-table-cell--fixed-last': props.fixed?.endsWith('last'),
|
|
61
|
+
[`y-data-table-cell--fixed-${props.fixed?.replace('-last', '')}`]: props.fixed,
|
|
58
62
|
[`y-data-table-cell--align-${props.align}`]: props.align
|
|
59
63
|
}],
|
|
60
64
|
"style": {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"YDataTableCell.mjs","names":["computed","useRender","defineComponent","toStyleSizeValue","YDataTableCell","name","functional","props","type","String","default","fixed","fixedOffset","Number","width","maxWidth","height","align","emits","setup","_ref","slots","emit","attrs","offsetStyle","ret","undefined","ElTag","_createVNode","_mergeProps","value","e"],"sources":["../../../src/components/table/YDataTableCell.tsx"],"sourcesContent":["import { type CSSProperties, type PropType, computed } from 'vue';\r\n\r\nimport { useRender } from '@/composables/component';\r\nimport { defineComponent } from '@/util/component';\r\nimport { toStyleSizeValue } from '@/util/ui';\r\n\r\nexport const YDataTableCell = defineComponent({\r\n name: 'YDataTableCell',\r\n functional: true,\r\n props: {\r\n type: {\r\n type: String as PropType<'head' | 'data'>,\r\n default: 'data',\r\n },\r\n fixed: {\r\n type: String as PropType<
|
|
1
|
+
{"version":3,"file":"YDataTableCell.mjs","names":["computed","useRender","defineComponent","toStyleSizeValue","YDataTableCell","name","functional","props","type","String","default","fixed","fixedOffset","Number","rightOffset","width","maxWidth","height","align","emits","setup","_ref","slots","emit","attrs","offsetStyle","ret","undefined","startsWith","ElTag","_createVNode","_mergeProps","endsWith","replace","value","e"],"sources":["../../../src/components/table/YDataTableCell.tsx"],"sourcesContent":["import { type CSSProperties, type PropType, computed } from 'vue';\r\n\r\nimport type { FixedPropType } from '@/components/table/types';\r\nimport { useRender } from '@/composables/component';\r\nimport { defineComponent } from '@/util/component';\r\nimport { toStyleSizeValue } from '@/util/ui';\r\n\r\nexport const YDataTableCell = defineComponent({\r\n name: 'YDataTableCell',\r\n functional: true,\r\n props: {\r\n type: {\r\n type: String as PropType<'head' | 'data'>,\r\n default: 'data',\r\n },\r\n fixed: {\r\n type: String as PropType<FixedPropType>,\r\n },\r\n fixedOffset: {\r\n type: Number as PropType<number>,\r\n },\r\n rightOffset: {\r\n type: Number as PropType<number>,\r\n },\r\n width: {\r\n type: [Number, String] as PropType<string | number>,\r\n },\r\n maxWidth: {\r\n type: [Number, String] as PropType<string | number>,\r\n },\r\n height: {\r\n type: [Number, String] as PropType<string | number>,\r\n },\r\n align: {\r\n type: String as PropType<'start' | 'center' | 'end'>,\r\n default: 'start',\r\n },\r\n },\r\n emits: ['click'],\r\n setup(props, { slots, emit, attrs }) {\r\n const offsetStyle = computed(() => {\r\n const ret: CSSProperties = {};\r\n if (props.fixed && props.fixedOffset !== undefined) {\r\n if (props.fixed.startsWith('lead')) {\r\n ret['left'] = toStyleSizeValue(props.fixedOffset);\r\n } else if (props.fixed.startsWith('trail')) {\r\n ret['right'] = toStyleSizeValue(props.rightOffset);\r\n }\r\n }\r\n return ret;\r\n });\r\n\r\n useRender(() => {\r\n const ElTag = props.type === 'head' ? 'th' : 'td';\r\n return (\r\n <ElTag\r\n class={[\r\n `y-data-table__${ElTag}`,\r\n 'y-data-table-cell',\r\n {\r\n 'y-data-table-cell--fixed': props.fixed,\r\n 'y-data-table-cell--fixed-last': props.fixed?.endsWith('last'),\r\n [`y-data-table-cell--fixed-${props.fixed?.replace('-last', '')}`]:\r\n props.fixed,\r\n [`y-data-table-cell--align-${props.align}`]: props.align,\r\n },\r\n ]}\r\n style={{\r\n width: toStyleSizeValue(props.width),\r\n height: toStyleSizeValue(props.height),\r\n maxWidth: toStyleSizeValue(props.maxWidth),\r\n ...offsetStyle.value,\r\n }}\r\n {...attrs}\r\n onClick={(e) => emit('click', e)}\r\n >\r\n {slots.default?.()}\r\n </ElTag>\r\n );\r\n });\r\n },\r\n});\r\n\r\nexport type YDataTableCell = InstanceType<typeof YDataTableCell>;\r\n"],"mappings":";AAAA,SAA4CA,QAAQ,QAAQ,KAAK;AAAC,SAGzDC,SAAS;AAAA,SACTC,eAAe;AAAA,SACfC,gBAAgB;AAEzB,OAAO,MAAMC,cAAc,GAAGF,eAAe,CAAC;EAC5CG,IAAI,EAAE,gBAAgB;EACtBC,UAAU,EAAE,IAAI;EAChBC,KAAK,EAAE;IACLC,IAAI,EAAE;MACJA,IAAI,EAAEC,MAAmC;MACzC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AM,GAAG,IAAI,GAAG,IAAI;MACjD,OAAAsB,YAAA,CAAAD,KAAA,EAAAE,WAAA;QAAA,SAEW,CACJ,iBAAgBF,KAAM,EAAC,EACxB,mBAAmB,EACnB;UACE,0BAA0B,EAAEtB,KAAK,CAACI,KAAK;UACvC,+BAA+B,EAAEJ,KAAK,CAACI,KAAK,EAAEqB,QAAQ,CAAC,MAAM,CAAC;UAC9D,CAAE,4BAA2BzB,KAAK,CAACI,KAAK,EAAEsB,OAAO,CAAC,OAAO,EAAE,EAAE,CAAE,EAAC,GAC9D1B,KAAK,CAACI,KAAK;UACb,CAAE,4BAA2BJ,KAAK,CAACW,KAAM,EAAC,GAAGX,KAAK,CAACW;QACrD,CAAC,CACF;QAAA,SACM;UACLH,KAAK,EAAEZ,gBAAgB,CAACI,KAAK,CAACQ,KAAK,CAAC;UACpCE,MAAM,EAAEd,gBAAgB,CAACI,KAAK,CAACU,MAAM,CAAC;UACtCD,QAAQ,EAAEb,gBAAgB,CAACI,KAAK,CAACS,QAAQ,CAAC;UAC1C,GAAGS,WAAW,CAACS;QACjB;MAAC,GACGV,KAAK;QAAA,WACCW,CAAC,IAAKZ,IAAI,CAAC,OAAO,EAAEY,CAAC;MAAC;QAAAzB,OAAA,EAAAA,CAAA,MAE/BY,KAAK,CAACZ,OAAO,GAAG,CAAC;MAAA;IAGxB,CAAC,CAAC;EACJ;AACF,CAAC,CAAC"}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { Fragment as _Fragment,
|
|
1
|
+
import { Fragment as _Fragment, mergeProps as _mergeProps, createVNode as _createVNode } from "vue";
|
|
2
2
|
import { useRender } from "../../composables/component.mjs";
|
|
3
3
|
import { wrapInArray } from "../../util/index.mjs";
|
|
4
4
|
import { defineComponent, propsFactory } from "../../util/component/index.mjs";
|
|
5
5
|
import { toStyleSizeValue } from "../../util/ui.mjs";
|
|
6
|
+
import { YButton } from "../button/YButton.mjs";
|
|
6
7
|
import { YIconCheckbox } from "../icons/YIconCheckbox.mjs";
|
|
7
8
|
import { YIconSort } from "../icons/YIconSort.mjs";
|
|
8
9
|
import { YDataTableCell } from "./YDataTableCell.mjs";
|
|
@@ -52,11 +53,18 @@ export const YDataTableHead = defineComponent({
|
|
|
52
53
|
} = useHeader();
|
|
53
54
|
const getFixedStyles = (column, y) => {
|
|
54
55
|
if (!props.sticky && !column.fixed) return undefined;
|
|
56
|
+
let fixedOffset = {};
|
|
57
|
+
if (column.fixed === true || column.fixed === 'left') {
|
|
58
|
+
fixedOffset.left = toStyleSizeValue(column.fixedOffset);
|
|
59
|
+
}
|
|
60
|
+
if (column.fixed === 'right') {
|
|
61
|
+
fixedOffset.right = toStyleSizeValue(column.rightOffset);
|
|
62
|
+
}
|
|
55
63
|
return {
|
|
56
64
|
position: 'sticky',
|
|
57
65
|
zIndex: column.fixed ? 4 : props.sticky ? 3 : undefined,
|
|
58
|
-
|
|
59
|
-
|
|
66
|
+
top: props.sticky ? `calc(var(--v-table-header-height) * ${y})` : undefined,
|
|
67
|
+
...fixedOffset
|
|
60
68
|
};
|
|
61
69
|
};
|
|
62
70
|
function onClick(e) {
|
|
@@ -83,7 +91,7 @@ export const YDataTableHead = defineComponent({
|
|
|
83
91
|
return _createVNode(YDataTableCell, _mergeProps({
|
|
84
92
|
"type": "head",
|
|
85
93
|
"align": column.align,
|
|
86
|
-
"fixed": column.fixed ? column.lastFixed ? 'last' : '
|
|
94
|
+
"fixed": column.fixed ? (column.fixed === 'right' ? 'trail' : 'lead') + (column.lastFixed ? '-last' : '') : undefined,
|
|
87
95
|
"class": ['y-data-table-header', {
|
|
88
96
|
'y-data-table-header--sortable': column.sortable,
|
|
89
97
|
'y-data-table-header--sorted': isSorted(column),
|
|
@@ -118,16 +126,20 @@ export const YDataTableHead = defineComponent({
|
|
|
118
126
|
return slots[headerSlotName]?.(headerSlotProps);
|
|
119
127
|
}
|
|
120
128
|
if (column.key === 'data-table-select') {
|
|
121
|
-
return slots['header.data-table-select']?.(headerSlotProps) ?? (showSelectAll && _createVNode(
|
|
122
|
-
"
|
|
123
|
-
"
|
|
124
|
-
"
|
|
125
|
-
}, {
|
|
126
|
-
onClick: e => {
|
|
129
|
+
return slots['header.data-table-select']?.(headerSlotProps) ?? (showSelectAll && _createVNode(YButton, {
|
|
130
|
+
"variation": 'text,small',
|
|
131
|
+
"disabled": selectables.value.length < 1,
|
|
132
|
+
"onClick": e => {
|
|
127
133
|
e.stopPropagation();
|
|
128
134
|
selectAll(!allSelected.value);
|
|
129
135
|
}
|
|
130
|
-
}
|
|
136
|
+
}, {
|
|
137
|
+
default: () => [_createVNode(YIconCheckbox, {
|
|
138
|
+
"checked": allSelected.value,
|
|
139
|
+
"indeterminate": !allSelected.value && someSelected.value,
|
|
140
|
+
"disabled": selectables.value.length < 1
|
|
141
|
+
}, null)]
|
|
142
|
+
}));
|
|
131
143
|
}
|
|
132
144
|
return _createVNode("div", {
|
|
133
145
|
"class": "y-data-table-header__content"
|