@@ -104,7 +104,11 @@ const props = defineProps({
104
104
},
105
105
noOffset: {
106
106
type: Boolean ,
107
- default: false
107
+ default: true
108
+ },
109
+ position: {
110
+ type: String ,
111
+ default: ' right'
108
112
}
109
113
});
110
114
@@ -231,11 +235,16 @@ const isInfo = ref({
231
235
</script >
232
236
233
237
<template >
234
- <div v-click-outside =" closeIfOpen" data-html2canvas-ignore class =" vue-ui-user-options" :style =" `z-index: ${zIndex}; height: 34px; position: ${isFullscreen ? 'fixed' : 'absolute'}; top: 0; right:${isFullscreen ? '12px': '0'}; padding: 4px; background:transparent;`" >
235
- <div tabindex =" 0" :title =" isOpen ? titles.close || '' : titles.open || ''" data-cy =" user-options-summary" :style =" `width:32px; position: absolute; top: 0; right: ${noOffset ? 0 : 4}px; padding: 0 0px; display: flex; align-items:center;justify-content:center;height: 36px; cursor:pointer; background:${backgroundColor}`" @click.stop =" toggle" @keypress.enter =" toggle" >
236
- <BaseIcon :name =" isOpen ? 'close' : 'menu'" stroke =" #CCCCCC" :stroke-width =" 2" />
238
+ <div
239
+ v-click-outside =" closeIfOpen"
240
+ data-html2canvas-ignore
241
+ class =" vue-ui-user-options"
242
+ :style =" `z-index: ${zIndex}; height: 34px; position: ${isFullscreen ? 'fixed' : 'absolute'}; top: 0; ${position === 'right' ? `right:${isFullscreen ? '12px': '0'}` : `left:${isFullscreen ? '12px' : '0'}`}; padding: 4px; background:transparent;`" >
243
+
244
+ <div tabindex =" 0" :title =" isOpen ? titles.close || '' : titles.open || ''" data-cy =" user-options-summary" :style =" `width:32px; position: absolute; top: 0;${position === 'right' ? `right: ${noOffset ? 0 : 4}px` : `left: ${noOffset ? 0 : 4}px`}; padding: 0 0px; display: flex; align-items:center;justify-content:center;height: 36px; cursor:pointer; background:transparent`" @click.stop =" toggle" @keypress.enter =" toggle" >
245
+ <BaseIcon :name =" isOpen ? 'close' : 'menu'" :stroke =" color" :stroke-width =" 2" />
237
246
</div >
238
- <div data-cy =" user-options-drawer" :data-open =" isOpen" :class =" {'vue-ui-user-options-drawer': true}" :style =" `background:${backgroundColor}; right: ${noOffset ? 0 : 4}px`" >
247
+ <div data-cy =" user-options-drawer" :data-open =" isOpen" :class =" {'vue-ui-user-options-drawer': true}" :style =" `background:${backgroundColor}; ${position === ' right' ? `right: ${noOffset ? 0 : 4}px` : `left: ${noOffset ? 0 : 4}px`} `" >
239
248
240
249
<button tabindex =" 0" v-if =" hasTooltip" data-cy =" user-options-tooltip" class =" vue-ui-user-options-button" @click =" toggleTooltip" @mouseenter =" isInfo.tooltip = true" @mouseout =" isInfo.tooltip = false" >
241
250
<template v-if =" $slots .optionTooltip " >
@@ -245,7 +254,7 @@ const isInfo = ref({
245
254
<BaseIcon v-if =" isItTooltip" name =" tooltip" :stroke =" color" style =" pointer-events : none ;" />
246
255
<BaseIcon v-else name =" tooltipDisabled" :stroke =" color" style =" pointer-events : none " />
247
256
</template >
248
- <div v-if =" isDesktop && titles.tooltip && !$slots.optionTooltip" :class =" {'button-info' : true , 'button-info-visible': isInfo.tooltip }" :style =" { background: backgroundColor, color: color }" >
257
+ <div dir = " auto " v-if =" isDesktop && titles.tooltip && !$slots.optionTooltip" :class =" {'button-info-left': position === 'left', 'button-info-right' : position === 'right' , 'button-info-left- visible': position === 'left' && isInfo.tooltip, 'button-info-right-visible': position === 'right' && isInfo.tooltip }" :style =" { background: backgroundColor, color: color }" >
249
258
{{ titles.tooltip }}
250
259
</div >
251
260
</button >
@@ -258,7 +267,7 @@ const isInfo = ref({
258
267
<BaseIcon v-if =" isPrinting" name =" spin" isSpin :stroke =" color" style =" pointer-events : none ;" />
259
268
<BaseIcon v-else name =" pdf" :stroke =" color" style =" pointer-events : none ;" />
260
269
</template >
261
- <div v-if =" isDesktop && titles.pdf && !$slots.optionPdf" :class =" {'button-info' : true , 'button-info-visible': isInfo.pdf }" :style =" { background: backgroundColor, color: color }" >
270
+ <div dir = " auto " v-if =" isDesktop && titles.pdf && !$slots.optionPdf" :class =" {'button-info-left': position === 'left', 'button-info-right' : position === 'right' , 'button-info-right- visible': position === 'right' && isInfo.pdf, 'button-info-left-visible': position === 'left' && isInfo.pdf }" :style =" { background: backgroundColor, color: color }" >
262
271
{{ titles.pdf }}
263
272
</div >
264
273
</button >
@@ -270,7 +279,7 @@ const isInfo = ref({
270
279
<template v-else >
271
280
<BaseIcon name =" excel" :stroke =" color" style =" pointer-events : none " />
272
281
</template >
273
- <div v-if =" isDesktop && titles.csv && !$slots.optionCsv" :class =" {'button-info' : true , 'button-info-visible': isInfo.csv }" :style =" { background: backgroundColor, color: color }" >
282
+ <div dir = " auto " v-if =" isDesktop && titles.csv && !$slots.optionCsv" :class =" {'button-info-left': position === 'left', 'button-info-right' : position === 'right' , 'button-info-right- visible': position === 'right' && isInfo.csv, 'button-info-left-visible': position === 'left' && isInfo.csv }" :style =" { background: backgroundColor, color: color }" >
274
283
{{ titles.csv }}
275
284
</div >
276
285
</button >
@@ -283,7 +292,7 @@ const isInfo = ref({
283
292
<BaseIcon v-if =" isImaging" name =" spin" isSpin :stroke =" color" style =" pointer-events : none ;" />
284
293
<BaseIcon v-else name =" image" :stroke =" color" style =" pointer-events : none ;" />
285
294
</template >
286
- <div v-if =" isDesktop && titles.img && !$slots.optionImg" :class =" {'button-info' : true , 'button-info-visible': isInfo.img }" :style =" { background: backgroundColor, color: color }" >
295
+ <div dir = " auto " v-if =" isDesktop && titles.img && !$slots.optionImg" :class =" {'button-info-left': position === 'left', 'button-info-right' : position === 'right' , 'button-info-right- visible': position === 'right' && isInfo.img, 'button-info-left-visible': position === 'left' && isInfo.img }" :style =" { background: backgroundColor, color: color }" >
287
296
{{ titles.img }}
288
297
</div >
289
298
</button >
@@ -295,7 +304,7 @@ const isInfo = ref({
295
304
<template v-else >
296
305
<BaseIcon :name =" isTableOpen ? 'tableClose' : 'tableOpen'" :stroke =" color" style =" pointer-events : none ;" />
297
306
</template >
298
- <div v-if =" isDesktop && titles.table && !$slots.optionTable" :class =" {'button-info' : true , 'button-info-visible': isInfo.table }" :style =" { background: backgroundColor, color: color }" >
307
+ <div dir = " auto " v-if =" isDesktop && titles.table && !$slots.optionTable" :class =" {'button-info-left': position === 'left', 'button-info-right' : position === 'right' , 'button-info-right- visible': position === 'right' && isInfo.table, 'button-info-left-visible': position === 'left' && isInfo.table }" :style =" { background: backgroundColor, color: color }" >
299
308
{{ titles.table }}
300
309
</div >
301
310
</button >
@@ -307,7 +316,7 @@ const isInfo = ref({
307
316
<template v-else >
308
317
<BaseIcon :name =" isLabel ? 'labelClose' : 'labelOpen'" :stroke =" color" style =" pointer-events : none ;" />
309
318
</template >
310
- <div v-if =" isDesktop && titles.labels && !$slots.optionLabels" :class =" {'button-info' : true , 'button-info-visible': isInfo.labels }" :style =" { background: backgroundColor, color: color }" >
319
+ <div dir = " auto " v-if =" isDesktop && titles.labels && !$slots.optionLabels" :class =" {'button-info-left': position === 'left', 'button-info-right' : position === 'right' , 'button-info-right- visible': position === 'right' && isInfo.labels, 'button-info-left-visible': position === 'left' && isInfo.labels }" :style =" { background: backgroundColor, color: color }" >
311
320
{{ titles.labels }}
312
321
</div >
313
322
</button >
@@ -319,7 +328,7 @@ const isInfo = ref({
319
328
<template v-else >
320
329
<BaseIcon name =" sort" :stroke =" color" style =" pointer-events : none ;" />
321
330
</template >
322
- <div v-if =" isDesktop && titles.sort && !$slots.optionSort" :class =" {'button-info' : true , 'button-info-visible': isInfo.sort }" :style =" { background: backgroundColor, color: color }" >
331
+ <div dir = " auto " v-if =" isDesktop && titles.sort && !$slots.optionSort" :class =" {'button-info-left': position === 'left', 'button-info-right' : position === 'right' , 'button-info-right- visible': position === 'right' && isInfo.sort, 'button-info-left-visible': position === 'left' && isInfo.sort }" :style =" { background: backgroundColor, color: color }" >
323
332
{{ titles.sort }}
324
333
</div >
325
334
</button >
@@ -332,7 +341,7 @@ const isInfo = ref({
332
341
<BaseIcon v-if =" isItStacked" name =" unstack" :stroke =" color" style =" pointer-events : none ;" />
333
342
<BaseIcon v-else name =" stack" :stroke =" color" style =" pointer-events : none ;" />
334
343
</template >
335
- <div v-if =" isDesktop && titles.stack && !$slots.optionStack" :class =" {'button-info' : true , 'button-info-visible': isInfo.stack }" :style =" { background: backgroundColor, color: color }" >
344
+ <div dir = " auto " v-if =" isDesktop && titles.stack && !$slots.optionStack" :class =" {'button-info-left': position === 'left', 'button-info-right' : position === 'right' , 'button-info-right- visible': position === 'right' && isInfo.stack, 'button-info-left-visible': position === 'left' && isInfo.stack }" :style =" { background: backgroundColor, color: color }" >
336
345
{{ titles.stack }}
337
346
</div >
338
347
</button >
@@ -345,7 +354,7 @@ const isInfo = ref({
345
354
<BaseIcon v-if =" isFullscreen" name =" exitFullscreen" :stroke =" color" style =" pointer-events : none ;" />
346
355
<BaseIcon v-if =" !isFullscreen" name =" fullscreen" :stroke =" color" style =" pointer-events : none ;" />
347
356
</template >
348
- <div v-if =" isDesktop && titles.fullscreen && !$slots.optionFullscreen" :class =" {'button-info' : true , 'button-info-visible': isInfo.fullscreen }" :style =" { background: backgroundColor, color: color }" >
357
+ <div dir = " auto " v-if =" isDesktop && titles.fullscreen && !$slots.optionFullscreen" :class =" {'button-info-left': position === 'left', 'button-info-right' : position === 'right' , 'button-info-right- visible': position === 'right' && isInfo.fullscreen, 'button-info-left-visible': position === 'left' && isInfo.fullscreen }" :style =" { background: backgroundColor, color: color }" >
349
358
{{ titles.fullscreen }}
350
359
</div >
351
360
</button >
@@ -358,7 +367,7 @@ const isInfo = ref({
358
367
<BaseIcon v-if =" isAnimated" name =" play" :stroke =" color" style =" pointer-events : none ;" />
359
368
<BaseIcon v-if =" !isAnimated" name =" pause" :stroke =" color" style =" pointer-events : none ;" />
360
369
</template >
361
- <div v-if =" isDesktop && titles.fullscreen && !$slots.optionAnimation" :class =" {'button-info' : true , 'button-info-visible': isInfo.animation }" :style =" { background: backgroundColor, color: color }" >
370
+ <div dir = " auto " v-if =" isDesktop && titles.fullscreen && !$slots.optionAnimation" :class =" {'button-info-left': position === 'left', 'button-info-right' : position === 'right' , 'button-info-right- visible': position === 'right' && isInfo.animation, 'button-info-left-visible': position === 'left' && isInfo.animation }" :style =" { background: backgroundColor, color: color }" >
362
371
{{ titles.animation }}
363
372
</div >
364
373
</button >
@@ -434,21 +443,46 @@ const isInfo = ref({
434
443
.vue-ui-user-options-button :focus-visible {
435
444
outline : 1px solid #CCCCCC ;
436
445
}
437
- .button-info {
446
+
447
+ .button-info-right ,
448
+ .button-info-left {
438
449
position : absolute ;
439
- right : 100% ;
440
450
top : 50% ;
441
- transform : translateY (-50% );
442
451
padding : 4px 12px ;
443
452
pointer-events : none ;
444
453
opacity : 0 ;
454
+ transform : translateY (-50% );
455
+ }
456
+
457
+ .button-info-right {
458
+ right : 100% ;
445
459
border-radius : 4px 0 0 4px ;
446
460
}
447
- .button-info-visible {
448
- animation : showInfo 0.2s ease-in forwards ;
461
+ .button-info-right-visible {
462
+ animation : showInfoRight 0.2s ease-in forwards ;
463
+ }
464
+
465
+ .button-info-left {
466
+ left : 100% ;
467
+ border-radius : 0px 4px 4px 0 ;
468
+ }
469
+
470
+ .button-info-left-visible {
471
+ animation : showInfoLeft 0.2s ease-in forwards ;
472
+ }
473
+
474
+ @keyframes showInfoRight {
475
+ from {
476
+ opacity : 0 ;
477
+ transform : translateY (-50% ) scale (0.9 , 1 );
478
+ }
479
+ to {
480
+ opacity : 1 ;
481
+ transform : translateY (-50% ) scale (1 , 1 );
482
+ }
449
483
}
450
484
451
- @keyframes showInfo {
485
+ @keyframes showInfoLeft {
452
486
from {
453
487
opacity : 0 ;
454
488
transform : translateY (-50% ) scale (0.9 , 1 );
0 commit comments