@abi-software/map-utilities 1.0.0 → 1.0.1-beta.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/map-utilities.js +3195 -3101
- package/dist/map-utilities.umd.cjs +11 -11
- package/dist/style.css +1 -1
- package/package.json +1 -1
- package/src/components/CopyToClipboard/CopyToClipboard.vue +146 -0
- package/src/components/index.js +2 -1
- package/src/components.d.ts +3 -0
package/package.json
CHANGED
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<el-tooltip
|
|
3
|
+
:content="textLabel"
|
|
4
|
+
placement="bottom"
|
|
5
|
+
:hide-after="autoHideTimeout"
|
|
6
|
+
effect="clipboard-tooltip"
|
|
7
|
+
@hide="resetSettings"
|
|
8
|
+
>
|
|
9
|
+
<el-button
|
|
10
|
+
class="copy-clipboard-button"
|
|
11
|
+
:class="theme"
|
|
12
|
+
size="small"
|
|
13
|
+
@click="copyToClipboard"
|
|
14
|
+
>
|
|
15
|
+
<el-icon :color="iconColor">
|
|
16
|
+
<el-icon-copy-document />
|
|
17
|
+
</el-icon>
|
|
18
|
+
<span class="visually-hidden">{{ textLabel }}</span>
|
|
19
|
+
</el-button>
|
|
20
|
+
</el-tooltip>
|
|
21
|
+
</template>
|
|
22
|
+
|
|
23
|
+
<script>
|
|
24
|
+
const labelBefore = 'Copy to clipboard';
|
|
25
|
+
const labelAfter = 'Copied!';
|
|
26
|
+
const appPrimaryColor = '#8300bf';
|
|
27
|
+
|
|
28
|
+
export default {
|
|
29
|
+
name: 'CopyToClipboard',
|
|
30
|
+
props: {
|
|
31
|
+
content: {
|
|
32
|
+
type: String,
|
|
33
|
+
default: '',
|
|
34
|
+
},
|
|
35
|
+
/**
|
|
36
|
+
* Theme 'primary' or 'dark' or any name not 'light'
|
|
37
|
+
* will show primary button color.
|
|
38
|
+
*/
|
|
39
|
+
theme: {
|
|
40
|
+
type: String,
|
|
41
|
+
default: 'light',
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
data: function () {
|
|
45
|
+
return {
|
|
46
|
+
textLabel: labelBefore,
|
|
47
|
+
autoHideTimeout: 0,
|
|
48
|
+
iconColor: appPrimaryColor,
|
|
49
|
+
};
|
|
50
|
+
},
|
|
51
|
+
mounted: function () {
|
|
52
|
+
if (this.theme !== 'light') {
|
|
53
|
+
this.iconColor = 'white';
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
methods: {
|
|
57
|
+
copyToClipboard: async function () {
|
|
58
|
+
let copiedSuccessfully = true;
|
|
59
|
+
this.autoHideTimeout = 600;
|
|
60
|
+
|
|
61
|
+
try {
|
|
62
|
+
await navigator.clipboard.writeText(this.content);
|
|
63
|
+
} catch (err) {
|
|
64
|
+
console.error(
|
|
65
|
+
"Error when trying to use navigator.clipboard.writeText()",
|
|
66
|
+
err
|
|
67
|
+
);
|
|
68
|
+
copiedSuccessfully = false;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
if (copiedSuccessfully) {
|
|
72
|
+
this.textLabel = labelAfter;
|
|
73
|
+
} else {
|
|
74
|
+
this.textLabel = 'Error trying to copy to clipboard!';
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
resetSettings: function () {
|
|
78
|
+
this.autoHideTimeout = 0;
|
|
79
|
+
this.textLabel = labelBefore;
|
|
80
|
+
},
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
</script>
|
|
84
|
+
|
|
85
|
+
<style lang="scss" scoped>
|
|
86
|
+
.copy-clipboard-button {
|
|
87
|
+
margin-left: 0px !important;
|
|
88
|
+
margin-top: 0px !important;
|
|
89
|
+
padding: 0.25rem;
|
|
90
|
+
font-size: 14px !important;
|
|
91
|
+
transition: all 0.25s ease;
|
|
92
|
+
|
|
93
|
+
&,
|
|
94
|
+
&:focus,
|
|
95
|
+
&:active {
|
|
96
|
+
color: #fff !important;
|
|
97
|
+
background: $app-primary-color;
|
|
98
|
+
border-color: $app-primary-color !important;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
&:hover {
|
|
102
|
+
background: #ac76c5 !important;
|
|
103
|
+
border-color: #ac76c5 !important;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
&.light {
|
|
107
|
+
&,
|
|
108
|
+
&:focus,
|
|
109
|
+
&:active {
|
|
110
|
+
color: $app-primary-color !important;
|
|
111
|
+
background: transparent;
|
|
112
|
+
border-color: transparent !important;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
&:hover {
|
|
116
|
+
background: #f3e6f9 !important;
|
|
117
|
+
border-color: #f3e6f9 !important;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
.visually-hidden {
|
|
123
|
+
clip: rect(0 0 0 0);
|
|
124
|
+
clip-path: inset(50%);
|
|
125
|
+
height: 1px;
|
|
126
|
+
overflow: hidden;
|
|
127
|
+
position: absolute;
|
|
128
|
+
white-space: nowrap;
|
|
129
|
+
width: 1px;
|
|
130
|
+
}
|
|
131
|
+
</style>
|
|
132
|
+
|
|
133
|
+
<style lang="scss">
|
|
134
|
+
.el-popper.is-clipboard-tooltip {
|
|
135
|
+
padding: 4px 10px;
|
|
136
|
+
font-family: Asap;
|
|
137
|
+
background: #f3ecf6 !important;
|
|
138
|
+
border: 1px solid $app-primary-color;
|
|
139
|
+
|
|
140
|
+
& .el-popper__arrow::before {
|
|
141
|
+
border: 1px solid;
|
|
142
|
+
border-color: $app-primary-color;
|
|
143
|
+
background: #f3ecf6;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
</style>
|
package/src/components/index.js
CHANGED
|
@@ -2,5 +2,6 @@ import DrawToolbar from "./DrawToolbar/DrawToolbar.vue";
|
|
|
2
2
|
import HelpModeDialog from "./HelpModeDialog/HelpModeDialog.vue";
|
|
3
3
|
import Tooltip from "./Tooltip/Tooltip.vue";
|
|
4
4
|
import TreeControls from "./TreeControls/TreeControls.vue";
|
|
5
|
+
import CopyToClipboard from "./CopyToClipboard/CopyToClipboard.vue";
|
|
5
6
|
|
|
6
|
-
export { DrawToolbar, HelpModeDialog, Tooltip, TreeControls };
|
|
7
|
+
export { DrawToolbar, HelpModeDialog, Tooltip, TreeControls, CopyToClipboard };
|
package/src/components.d.ts
CHANGED
|
@@ -9,6 +9,7 @@ declare module 'vue' {
|
|
|
9
9
|
export interface GlobalComponents {
|
|
10
10
|
AnnotationPopup: typeof import('./components/Tooltip/AnnotationPopup.vue')['default']
|
|
11
11
|
ConnectionDialog: typeof import('./components/DrawToolbar/ConnectionDialog.vue')['default']
|
|
12
|
+
CopyToClipboard: typeof import('./components/CopyToClipboard/CopyToClipboard.vue')['default']
|
|
12
13
|
DrawToolbar: typeof import('./components/DrawToolbar/DrawToolbar.vue')['default']
|
|
13
14
|
ElButton: typeof import('element-plus/es')['ElButton']
|
|
14
15
|
ElButtonGroup: typeof import('element-plus/es')['ElButtonGroup']
|
|
@@ -19,6 +20,7 @@ declare module 'vue' {
|
|
|
19
20
|
ElIconArrowDown: typeof import('@element-plus/icons-vue')['ArrowDown']
|
|
20
21
|
ElIconArrowUp: typeof import('@element-plus/icons-vue')['ArrowUp']
|
|
21
22
|
ElIconClose: typeof import('@element-plus/icons-vue')['Close']
|
|
23
|
+
ElIconCopyDocument: typeof import('@element-plus/icons-vue')['CopyDocument']
|
|
22
24
|
ElIconDelete: typeof import('@element-plus/icons-vue')['Delete']
|
|
23
25
|
ElIconEdit: typeof import('@element-plus/icons-vue')['Edit']
|
|
24
26
|
ElIconFinished: typeof import('@element-plus/icons-vue')['Finished']
|
|
@@ -29,6 +31,7 @@ declare module 'vue' {
|
|
|
29
31
|
ElPopover: typeof import('element-plus/es')['ElPopover']
|
|
30
32
|
ElRow: typeof import('element-plus/es')['ElRow']
|
|
31
33
|
ElSelect: typeof import('element-plus/es')['ElSelect']
|
|
34
|
+
ElTooltip: typeof import('element-plus/es')['ElTooltip']
|
|
32
35
|
ElTree: typeof import('element-plus/es')['ElTree']
|
|
33
36
|
ExternalResourceCard: typeof import('./components/Tooltip/ExternalResourceCard.vue')['default']
|
|
34
37
|
HelpModeDialog: typeof import('./components/HelpModeDialog/HelpModeDialog.vue')['default']
|