@mixd-id/web-scaffold 0.1.230406001
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/LICENSE +21 -0
- package/README.md +3 -0
- package/package.json +71 -0
- package/public/images/mixd-logo2.png +0 -0
- package/src/App.vue +17 -0
- package/src/components/Ahref.vue +34 -0
- package/src/components/Alert.vue +160 -0
- package/src/components/Button.vue +253 -0
- package/src/components/ButtonGroup.vue +101 -0
- package/src/components/Carousel.vue +293 -0
- package/src/components/ChatTyping.vue +69 -0
- package/src/components/Checkbox.vue +152 -0
- package/src/components/ContextMenu.vue +261 -0
- package/src/components/CopyToClipboard.vue +59 -0
- package/src/components/Countdown.vue +213 -0
- package/src/components/Datepicker.vue +312 -0
- package/src/components/Dropdown.vue +198 -0
- package/src/components/DynamicTemplate.vue +44 -0
- package/src/components/ErrorText.vue +36 -0
- package/src/components/Feed.vue +118 -0
- package/src/components/Gmaps.vue +227 -0
- package/src/components/Grid.vue +29 -0
- package/src/components/GridColumn.vue +31 -0
- package/src/components/HTMLEditor.vue +396 -0
- package/src/components/Image.vue +207 -0
- package/src/components/Image360.vue +140 -0
- package/src/components/ImageFullScreen.vue +101 -0
- package/src/components/ImagePreview.vue +71 -0
- package/src/components/ImportModal.vue +247 -0
- package/src/components/ListItem.vue +147 -0
- package/src/components/ListPage1.vue +1331 -0
- package/src/components/ListPage1Filter.vue +170 -0
- package/src/components/Modal.vue +253 -0
- package/src/components/OTPField.vue +126 -0
- package/src/components/Radio.vue +134 -0
- package/src/components/SearchButton.vue +57 -0
- package/src/components/Slider.vue +285 -0
- package/src/components/SplitPane.vue +129 -0
- package/src/components/Switch.vue +89 -0
- package/src/components/TabView.vue +106 -0
- package/src/components/TableView.vue +201 -0
- package/src/components/TableViewHead.vue +159 -0
- package/src/components/Tabs.vue +74 -0
- package/src/components/TextEditor.vue +85 -0
- package/src/components/Textarea.vue +184 -0
- package/src/components/Textbox.vue +200 -0
- package/src/components/Timepicker.vue +108 -0
- package/src/components/Toast.vue +93 -0
- package/src/components/VirtualScroll.vue +215 -0
- package/src/components/VirtualTable.vue +497 -0
- package/src/entry-client.js +27 -0
- package/src/entry-server.js +73 -0
- package/src/index.css +3 -0
- package/src/index.js +255 -0
- package/src/main.js +38 -0
- package/src/router.js +57 -0
- package/src/themes/default/index.js +200 -0
- package/src/utils/helpers.js +185 -0
- package/src/utils/helpers.mjs +197 -0
- package/src/utils/importer.js +156 -0
- package/src/utils/listpage1.js +1371 -0
- package/src/utils/selection.js +64 -0
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div :class="$style.comp" @click="$emit('search')">
|
|
3
|
+
<div class="flex flex-row gap-1">
|
|
4
|
+
<div :class="$style.key">
|
|
5
|
+
<div :class="$style.metaKey"></div>
|
|
6
|
+
<div :class="$style.lKey"></div>
|
|
7
|
+
</div>
|
|
8
|
+
</div>
|
|
9
|
+
<div class="text-text-300 min-w-[120px]">
|
|
10
|
+
Search...
|
|
11
|
+
</div>
|
|
12
|
+
</div>
|
|
13
|
+
</template>
|
|
14
|
+
|
|
15
|
+
<script>
|
|
16
|
+
|
|
17
|
+
export default{
|
|
18
|
+
|
|
19
|
+
emits: [ 'search' ],
|
|
20
|
+
|
|
21
|
+
mounted() {
|
|
22
|
+
window.addEventListener('keydown', this.onKeyDown)
|
|
23
|
+
},
|
|
24
|
+
|
|
25
|
+
methods: {
|
|
26
|
+
|
|
27
|
+
onKeyDown(e){
|
|
28
|
+
if((e.metaKey || e.ctrlKey) && e.keyCode === 75){
|
|
29
|
+
this.$emit('search')
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
</script>
|
|
38
|
+
|
|
39
|
+
<style module>
|
|
40
|
+
|
|
41
|
+
.comp{
|
|
42
|
+
@apply h-[var(--h-cp)];
|
|
43
|
+
@apply border-text-200 bg-base-50 border-[1px] rounded-lg flex flex-row items-center gap-1 cursor-pointer;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.key{
|
|
47
|
+
@apply border-[1px] border-text-200 rounded-md px-1 bg-base-300;
|
|
48
|
+
@apply flex flex-row gap-1 px-2 m-1;
|
|
49
|
+
}
|
|
50
|
+
.metaKey:before{
|
|
51
|
+
content: "⌘"
|
|
52
|
+
}
|
|
53
|
+
.lKey:before{
|
|
54
|
+
content: "K"
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
</style>
|
|
@@ -0,0 +1,285 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div :class="$style.slider">
|
|
3
|
+
|
|
4
|
+
<div ref="bar"></div>
|
|
5
|
+
|
|
6
|
+
<div ref="highlight" :style="{ left:hgLeft + 'px', right:hgRight + 'px' }"></div>
|
|
7
|
+
|
|
8
|
+
<div id="sliderLeft" v-if="mode === 'double'" ref="left" @mousedown.prevent.capture="onMouseDown" @touchstart.passive.capture="onMouseDown"
|
|
9
|
+
:style="{ left:l1Left + 'px' }"></div>
|
|
10
|
+
|
|
11
|
+
<div id="sliderRight" ref="right" @mousedown.prevent.capture="onMouseDown" @touchstart.passive.capture="onMouseDown"
|
|
12
|
+
:style="{ left:l2Left + 'px' }"></div>
|
|
13
|
+
|
|
14
|
+
</div>
|
|
15
|
+
</template>
|
|
16
|
+
|
|
17
|
+
<script>
|
|
18
|
+
|
|
19
|
+
export default{
|
|
20
|
+
|
|
21
|
+
props:{
|
|
22
|
+
|
|
23
|
+
modelValue:{
|
|
24
|
+
type: [ String, Number ],
|
|
25
|
+
default: ''
|
|
26
|
+
},
|
|
27
|
+
|
|
28
|
+
min:{
|
|
29
|
+
type: [ String, Number ],
|
|
30
|
+
default: '0'
|
|
31
|
+
},
|
|
32
|
+
|
|
33
|
+
max:{
|
|
34
|
+
type: [ String, Number ],
|
|
35
|
+
default: '100'
|
|
36
|
+
},
|
|
37
|
+
|
|
38
|
+
mode:{
|
|
39
|
+
type: String,
|
|
40
|
+
default: 'single' // single, double
|
|
41
|
+
},
|
|
42
|
+
|
|
43
|
+
step:{
|
|
44
|
+
type: [ String, Number ],
|
|
45
|
+
default: '10'
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
},
|
|
49
|
+
|
|
50
|
+
computed:{
|
|
51
|
+
|
|
52
|
+
l1Val(){
|
|
53
|
+
if(this.isMounted){
|
|
54
|
+
const [ from, to ] = this.modelValue.toString().split('-')
|
|
55
|
+
return parseInt(from)
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
|
|
59
|
+
l2Val(){
|
|
60
|
+
if(this.isMounted){
|
|
61
|
+
const [ from, to ] = this.modelValue.toString().split('-')
|
|
62
|
+
return this.mode === 'double' ? (!isNaN(parseInt(to)) ? parseInt(to) : parseInt(from)) : parseInt(from)
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
|
|
66
|
+
l1Left(){
|
|
67
|
+
if(this.isMounted){
|
|
68
|
+
const min = parseInt(this.min)
|
|
69
|
+
const max = this.l2Val
|
|
70
|
+
const l1Val = this.l1Val > max ? max : (this.l1Val < min ? min : this.l1Val)
|
|
71
|
+
return (Math.round((l1Val - parseInt(this.min)) / parseInt(this.step))) * this.stepDistance
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
|
|
75
|
+
l2Left(){
|
|
76
|
+
if(this.isMounted){
|
|
77
|
+
const min = this.l1Val ? this.l1Val : parseInt(this.min)
|
|
78
|
+
const max = parseInt(this.max)
|
|
79
|
+
const l2Val = this.l2Val > max ? max : (this.l2Val < min ? min : this.l2Val)
|
|
80
|
+
|
|
81
|
+
return (Math.round((l2Val - parseInt(this.min)) / parseInt(this.step))) * this.stepDistance
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
|
|
85
|
+
hgLeft(){
|
|
86
|
+
if(this.isMounted){
|
|
87
|
+
if (this.mode === 'double') {
|
|
88
|
+
const min = parseInt(this.min)
|
|
89
|
+
const max = this.l2Val
|
|
90
|
+
const l1Val = this.l1Val > max ? max : (this.l1Val < min ? min : this.l1Val)
|
|
91
|
+
return (Math.round((l1Val - parseInt(this.min)) / parseInt(this.step))) * this.stepDistance
|
|
92
|
+
}
|
|
93
|
+
else {
|
|
94
|
+
return 0
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
},
|
|
98
|
+
|
|
99
|
+
hgRight(){
|
|
100
|
+
if(this.isMounted){
|
|
101
|
+
if(this.mode === 'double'){
|
|
102
|
+
return this.rootWidth - (Math.round(this.l2Left + (this.$refs.right.clientWidth / 2)))
|
|
103
|
+
}
|
|
104
|
+
else{
|
|
105
|
+
return this.rootWidth - (Math.round(this.l2Left + (this.$refs.right.clientWidth / 2)))
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
},
|
|
109
|
+
|
|
110
|
+
trackWidth(){
|
|
111
|
+
if(this.isMounted)
|
|
112
|
+
return this.rootWidth - this.$refs.right.clientWidth
|
|
113
|
+
},
|
|
114
|
+
|
|
115
|
+
stepDistance(){
|
|
116
|
+
if(this.isMounted){
|
|
117
|
+
const min = parseInt(this.min)
|
|
118
|
+
const max = parseInt(this.max)
|
|
119
|
+
const step = parseInt(this.step)
|
|
120
|
+
const totalStep = (max - min) / step
|
|
121
|
+
return this.trackWidth / totalStep
|
|
122
|
+
}
|
|
123
|
+
return 0
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
},
|
|
127
|
+
|
|
128
|
+
data(){
|
|
129
|
+
return {
|
|
130
|
+
isMounted: 0,
|
|
131
|
+
rootWidth: 0,
|
|
132
|
+
startValue: null, // Mouse down start value
|
|
133
|
+
}
|
|
134
|
+
},
|
|
135
|
+
|
|
136
|
+
emits: [ "update:modelValue", "change" ],
|
|
137
|
+
|
|
138
|
+
mounted(){
|
|
139
|
+
this.rootWidth = this.$el.clientWidth
|
|
140
|
+
this.isMounted = 1
|
|
141
|
+
},
|
|
142
|
+
|
|
143
|
+
methods:{
|
|
144
|
+
|
|
145
|
+
valueFromDistance(distance, startValue){
|
|
146
|
+
const stepCount = Math.round(Math.abs(distance) / this.stepDistance)
|
|
147
|
+
return startValue + (stepCount * this.step) * (distance > 0 ? 1 : -1)
|
|
148
|
+
},
|
|
149
|
+
|
|
150
|
+
onMouseMove(e){
|
|
151
|
+
|
|
152
|
+
e.preventDefault()
|
|
153
|
+
e.stopPropagation()
|
|
154
|
+
|
|
155
|
+
const currentX = typeof e.touches !== 'undefined' ? e.touches[0].clientX : e.clientX
|
|
156
|
+
const distance = currentX - this.startX
|
|
157
|
+
|
|
158
|
+
//console.log('distance', distance, this.stepDistance)
|
|
159
|
+
|
|
160
|
+
if(Math.abs(distance) > this.stepDistance * .5){
|
|
161
|
+
|
|
162
|
+
if(this.mode === 'double'){
|
|
163
|
+
let [ from, to ] = this.modelValue.toString().split('-')
|
|
164
|
+
if(this.current === 'left'){
|
|
165
|
+
let value = this.valueFromDistance(distance, this.startValue)
|
|
166
|
+
if(value >= parseInt(this.min) && value <= parseInt(to)){
|
|
167
|
+
from = value
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
else{
|
|
171
|
+
let value = this.valueFromDistance(distance, this.startValue)
|
|
172
|
+
if(value >= parseInt(from) && value <= parseInt(this.max)){
|
|
173
|
+
to = value
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
if(from + '-' + to !== this.modelValue){
|
|
178
|
+
this.$emit('update:modelValue', from + '-' + to)
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
else{
|
|
182
|
+
let value = this.valueFromDistance(distance, this.startValue)
|
|
183
|
+
if(value !== this.modelValue && value >= parseInt(this.min) && value <= parseInt(this.max)){
|
|
184
|
+
this.$emit('update:modelValue', value)
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
}
|
|
189
|
+
else{
|
|
190
|
+
|
|
191
|
+
/*const btnHalfWidth = this.$refs.right.clientWidth / 2
|
|
192
|
+
|
|
193
|
+
if(this.current === 'left'){
|
|
194
|
+
let left = this.l1Left + distance
|
|
195
|
+
|
|
196
|
+
const minLeft = 0
|
|
197
|
+
const maxLeft = this.l2Left > 0 ? this.l2Left : (this.rootWidth - btnHalfWidth)
|
|
198
|
+
if(left < minLeft) left = minLeft
|
|
199
|
+
if(left > maxLeft) left = maxLeft
|
|
200
|
+
|
|
201
|
+
this.$refs[this.current].style.left = left + "px"
|
|
202
|
+
this.$refs.highlight.style.left = (left + btnHalfWidth) + "px"
|
|
203
|
+
}
|
|
204
|
+
else{
|
|
205
|
+
let left = this.l2Left + distance
|
|
206
|
+
|
|
207
|
+
const maxLeft = this.rootWidth - (btnHalfWidth * 2)
|
|
208
|
+
const minLeft = this.l1Left > 0 ? this.l1Left : 0
|
|
209
|
+
if(left < minLeft) left = minLeft
|
|
210
|
+
if(left > maxLeft) left = maxLeft
|
|
211
|
+
|
|
212
|
+
this.$refs[this.current].style.left = left + "px"
|
|
213
|
+
this.$refs.highlight.style.right = ((this.rootWidth - left - btnHalfWidth)) + "px"
|
|
214
|
+
}*/
|
|
215
|
+
}
|
|
216
|
+
},
|
|
217
|
+
|
|
218
|
+
onMouseUp(){
|
|
219
|
+
window.removeEventListener('mousemove', this.onMouseMove)
|
|
220
|
+
window.removeEventListener('mouseup', this.onMouseUp)
|
|
221
|
+
window.removeEventListener('touchmove', this.onMouseMove)
|
|
222
|
+
window.removeEventListener('touchend', this.onMouseUp)
|
|
223
|
+
|
|
224
|
+
this.$refs[this.current].style.left = ((this.current === 'left' ? this.l1Left : this.l2Left)) + "px"
|
|
225
|
+
|
|
226
|
+
this.$refs.highlight.style.left = (this.hgLeft) + "px"
|
|
227
|
+
this.$refs.highlight.style.right = (this.hgRight) + "px"
|
|
228
|
+
|
|
229
|
+
if(this.modelValue !== this.startValue){
|
|
230
|
+
this.$emit('change')
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
this.startValue = null
|
|
234
|
+
},
|
|
235
|
+
|
|
236
|
+
onMouseDown(e){
|
|
237
|
+
|
|
238
|
+
this.current = e.target === this.$refs.right ? 'right' : 'left'
|
|
239
|
+
this.startX = typeof e.touches !== 'undefined' ? e.touches[0].clientX : e.clientX
|
|
240
|
+
this.startLeft = parseInt(this.$refs[this.current].style.left)
|
|
241
|
+
this.startValue = this.modelValue
|
|
242
|
+
|
|
243
|
+
window.addEventListener('mousemove', this.onMouseMove)
|
|
244
|
+
window.addEventListener('mouseup', this.onMouseUp)
|
|
245
|
+
window.addEventListener('touchmove', this.onMouseMove)
|
|
246
|
+
window.addEventListener('touchend', this.onMouseUp, { passive:true })
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
</script>
|
|
253
|
+
|
|
254
|
+
<style module>
|
|
255
|
+
|
|
256
|
+
.slider{
|
|
257
|
+
@apply h-[var(--h-cp)];
|
|
258
|
+
@apply relative;
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
.slider>div:nth-child(1){
|
|
262
|
+
@apply absolute bg-base-300 rounded-lg;
|
|
263
|
+
height: .5rem;
|
|
264
|
+
top: 50%;
|
|
265
|
+
left: .75rem;
|
|
266
|
+
right: .75rem;
|
|
267
|
+
transform: translate3d(0, -50%, 0);
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
.slider>div:nth-child(2){
|
|
271
|
+
@apply absolute bg-primary rounded-lg;
|
|
272
|
+
height: .5rem;
|
|
273
|
+
top: 50%;
|
|
274
|
+
transform: translate3d(0, -50%, 0);
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
.slider>div:nth-child(3),
|
|
278
|
+
.slider>div:nth-child(4){
|
|
279
|
+
@apply absolute w-[2.1rem] h-[2.1rem] rounded-full bg-white shadow-sm border-[1px] border-text-200;
|
|
280
|
+
top: 50%;
|
|
281
|
+
transform: translate3d(0, -50%, 0);
|
|
282
|
+
touch-action: none;
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
</style>
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div :class="computedClass">
|
|
3
|
+
<div ref="leftPane" :style="leftStyle" :class="leftClass">
|
|
4
|
+
<slot name="left"></slot>
|
|
5
|
+
</div>
|
|
6
|
+
<div v-if="resizable" ref="resizer" @mousedown="onMouseDown"></div>
|
|
7
|
+
<div :class="rightClass">
|
|
8
|
+
<slot name="right"></slot>
|
|
9
|
+
</div>
|
|
10
|
+
</div>
|
|
11
|
+
</template>
|
|
12
|
+
|
|
13
|
+
<script>
|
|
14
|
+
|
|
15
|
+
export default{
|
|
16
|
+
|
|
17
|
+
props:{
|
|
18
|
+
|
|
19
|
+
mode: {
|
|
20
|
+
type: [ String, Number ],
|
|
21
|
+
default: 1
|
|
22
|
+
},
|
|
23
|
+
|
|
24
|
+
leftClass: String,
|
|
25
|
+
rightClass: String,
|
|
26
|
+
|
|
27
|
+
state: Number,
|
|
28
|
+
|
|
29
|
+
modelValue: {
|
|
30
|
+
type: [ String, Number ],
|
|
31
|
+
default: 300
|
|
32
|
+
},
|
|
33
|
+
|
|
34
|
+
resizable: {
|
|
35
|
+
type: Boolean,
|
|
36
|
+
default: true
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
|
|
40
|
+
computed:{
|
|
41
|
+
|
|
42
|
+
computedClass(){
|
|
43
|
+
return [
|
|
44
|
+
this.$style.splitPane,
|
|
45
|
+
this.$style['mode-' + this.mode],
|
|
46
|
+
this.$style['state-' + this.state]
|
|
47
|
+
]
|
|
48
|
+
.join(' ')
|
|
49
|
+
},
|
|
50
|
+
|
|
51
|
+
leftStyle(){
|
|
52
|
+
return {
|
|
53
|
+
width: parseInt(this.modelValue) + 'px'
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
},
|
|
58
|
+
|
|
59
|
+
data(){
|
|
60
|
+
return {
|
|
61
|
+
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
|
|
65
|
+
methods:{
|
|
66
|
+
|
|
67
|
+
onMouseDown(e){
|
|
68
|
+
|
|
69
|
+
let x1 = e.touches ? e.touches[0].clientX : e.clientX
|
|
70
|
+
const onMouseMove = (e) => {
|
|
71
|
+
const x2 = e.touches ? e.touches[0].clientX : e.clientX
|
|
72
|
+
const d = x2 - x1
|
|
73
|
+
x1 = x2
|
|
74
|
+
this.$emit('update:modelValue', this.modelValue + d)
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
const onMouseUp = (e) => {
|
|
78
|
+
window.removeEventListener('mousemove', onMouseMove)
|
|
79
|
+
window.removeEventListener('mouseup', onMouseUp)
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
window.addEventListener('mousemove', onMouseMove)
|
|
83
|
+
window.addEventListener('mouseup', onMouseUp)
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
</script>
|
|
91
|
+
|
|
92
|
+
<style module>
|
|
93
|
+
|
|
94
|
+
.splitPane{
|
|
95
|
+
@apply flex-1 flex flex-row;
|
|
96
|
+
}
|
|
97
|
+
.splitPane>*:first-child{
|
|
98
|
+
@apply overflow-y-auto flex-col;
|
|
99
|
+
}
|
|
100
|
+
.splitPane>*:last-child{
|
|
101
|
+
@apply flex-1 hidden overflow-y-auto;
|
|
102
|
+
@apply md:flex;
|
|
103
|
+
}
|
|
104
|
+
.splitPane>*:nth-child(2){
|
|
105
|
+
@apply w-[5px] cursor-e-resize hidden md:block
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
.state-2>*:first-child{
|
|
109
|
+
@apply hidden md:flex
|
|
110
|
+
}
|
|
111
|
+
.state-2>*:last-child{
|
|
112
|
+
@apply flex-1 flex
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
.mode-2.state-1>*:first-child{
|
|
116
|
+
@apply flex-1
|
|
117
|
+
}
|
|
118
|
+
.mode-2.state-1>*:last-child{
|
|
119
|
+
@apply hidden
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
@media screen and (max-width: 786px){
|
|
123
|
+
|
|
124
|
+
.splitPane>*:first-child{
|
|
125
|
+
@apply !w-full
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
</style>
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div :class="$style.switch">
|
|
3
|
+
<input type="checkbox" :id="id" @change="changed"
|
|
4
|
+
:checked="checked"/>
|
|
5
|
+
<label :for="id"><span></span></label>
|
|
6
|
+
</div>
|
|
7
|
+
</template>
|
|
8
|
+
|
|
9
|
+
<script>
|
|
10
|
+
|
|
11
|
+
import { parseBoolean, uid } from "../utils/helpers.mjs"
|
|
12
|
+
|
|
13
|
+
export default{
|
|
14
|
+
|
|
15
|
+
props:{
|
|
16
|
+
modelValue: [ String, Number, Boolean ],
|
|
17
|
+
trueValue: undefined,
|
|
18
|
+
falseValue: undefined
|
|
19
|
+
},
|
|
20
|
+
|
|
21
|
+
computed: {
|
|
22
|
+
|
|
23
|
+
checked(){
|
|
24
|
+
return (this.trueValue && this.trueValue === this.modelValue) ||
|
|
25
|
+
parseBoolean(this.modelValue)
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
},
|
|
29
|
+
|
|
30
|
+
emits: ['update:modelValue', 'change'],
|
|
31
|
+
|
|
32
|
+
data(){
|
|
33
|
+
return {
|
|
34
|
+
id: uid('switch_')
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
|
|
38
|
+
methods: {
|
|
39
|
+
|
|
40
|
+
changed(e){
|
|
41
|
+
const value = e.target.checked ?
|
|
42
|
+
(this.trueValue ?? 1) :
|
|
43
|
+
(this.falseValue ?? 0)
|
|
44
|
+
|
|
45
|
+
this.$emit('update:modelValue', value)
|
|
46
|
+
this.$emit('change', value)
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
}
|
|
51
|
+
</script>
|
|
52
|
+
|
|
53
|
+
<style module>
|
|
54
|
+
|
|
55
|
+
.switch{
|
|
56
|
+
@apply h-[var(--h-cp)];
|
|
57
|
+
@apply text-left flex items-center;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.switch>*{
|
|
61
|
+
vertical-align: middle;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.switch input{
|
|
65
|
+
@apply hidden;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.switch label{
|
|
69
|
+
@apply w-[3rem] inline-block rounded-2xl bg-base-50 h-[2rem];
|
|
70
|
+
@apply border-[1px] border-text-200 hover:border-text-300;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.switch label>span{
|
|
74
|
+
@apply mt-[.2rem] mx-1 w-[1.4rem] h-[1.4rem] inline-block align-middle rounded-full bg-text-200;
|
|
75
|
+
transition: margin 200ms ease;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.switch>input:checked + label{
|
|
79
|
+
@apply bg-primary;
|
|
80
|
+
}
|
|
81
|
+
.switch>input:checked + label>span{
|
|
82
|
+
@apply ml-[1.3rem] border-base bg-white
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.switch>input:checked + label + *,
|
|
86
|
+
.switch>input:not(:checked) + label + * + *{
|
|
87
|
+
@apply hidden;
|
|
88
|
+
}
|
|
89
|
+
</style>
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div :class="$style.tabView">
|
|
3
|
+
<div :class="computedHeadClass">
|
|
4
|
+
<div v-for="(name, idx) in slotNames" :class="idx === selectedIndex ? $style['tabViewHeaderActive'] : ''"
|
|
5
|
+
@click="selectedIndex = idx">
|
|
6
|
+
<slot v-if="$slots['title__' + name]" :name="'title__' + name"></slot>
|
|
7
|
+
<span v-else :class="headItemClass">{{ titles[idx] ?? 'Untitled' }}</span>
|
|
8
|
+
</div>
|
|
9
|
+
</div>
|
|
10
|
+
<div :class="bodyClass">
|
|
11
|
+
<div v-for="(name, idx) in slotNames" v-show="idx === selectedIndex">
|
|
12
|
+
<slot v-if="name.substring(0, 7) !== 'title__'" :name="name"></slot>
|
|
13
|
+
</div>
|
|
14
|
+
</div>
|
|
15
|
+
</div>
|
|
16
|
+
</template>
|
|
17
|
+
|
|
18
|
+
<script>
|
|
19
|
+
export default{
|
|
20
|
+
|
|
21
|
+
props:{
|
|
22
|
+
|
|
23
|
+
title:{
|
|
24
|
+
type: String
|
|
25
|
+
},
|
|
26
|
+
|
|
27
|
+
headClass:{
|
|
28
|
+
type: String,
|
|
29
|
+
default: "bg-white"
|
|
30
|
+
},
|
|
31
|
+
|
|
32
|
+
headItemClass:{
|
|
33
|
+
type: String,
|
|
34
|
+
default: ""
|
|
35
|
+
},
|
|
36
|
+
|
|
37
|
+
bodyClass:{
|
|
38
|
+
type: String,
|
|
39
|
+
default: "bg-white"
|
|
40
|
+
},
|
|
41
|
+
|
|
42
|
+
defaultIndex:{
|
|
43
|
+
type: String,
|
|
44
|
+
default: "0"
|
|
45
|
+
},
|
|
46
|
+
|
|
47
|
+
modelValue:{
|
|
48
|
+
type: Number,
|
|
49
|
+
default: 0
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
},
|
|
53
|
+
|
|
54
|
+
mounted(){
|
|
55
|
+
console.log(this.$slots)
|
|
56
|
+
},
|
|
57
|
+
|
|
58
|
+
data(){
|
|
59
|
+
|
|
60
|
+
const selectedIndex = parseInt(this.defaultIndex)
|
|
61
|
+
return {
|
|
62
|
+
selectedIndex
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
|
|
66
|
+
computed:{
|
|
67
|
+
|
|
68
|
+
computedHeadClass(){
|
|
69
|
+
return [
|
|
70
|
+
this.$style['tabViewHeader'],
|
|
71
|
+
this.headClass
|
|
72
|
+
]
|
|
73
|
+
.join(' ')
|
|
74
|
+
.trim()
|
|
75
|
+
},
|
|
76
|
+
|
|
77
|
+
slotNames(){
|
|
78
|
+
return Object.keys(this.$slots).filter((key) => key.substring(0, 7) !== 'title__')
|
|
79
|
+
},
|
|
80
|
+
|
|
81
|
+
titles(){
|
|
82
|
+
return this.title.split(',')
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
}
|
|
88
|
+
</script>
|
|
89
|
+
|
|
90
|
+
<style module>
|
|
91
|
+
|
|
92
|
+
.tabView{
|
|
93
|
+
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
.tabViewHeader{
|
|
97
|
+
@apply overflow-x-auto whitespace-nowrap;
|
|
98
|
+
}
|
|
99
|
+
.tabViewHeader>*{
|
|
100
|
+
@apply inline-block p-2 px-4 border-b-[1px] border-transparent bg-white cursor-pointer align-middle
|
|
101
|
+
}
|
|
102
|
+
.tabViewHeaderActive{
|
|
103
|
+
@apply border-red-500;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
</style>
|