@it-enterprise/forcebpm-ui-kit 1.0.1 → 1.0.2-beta.10

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/index.js CHANGED
@@ -1,2 +1,8 @@
1
1
  export { default as FHtmlContent } from './src/FHtmlContent.vue'
2
2
  export { default as FAvatar } from './src/FAvatar.vue'
3
+ export { default as FConfirmModal } from './src/FConfirmModal.vue'
4
+ export { default as FPreLoader } from './src/FPreLoader.vue'
5
+ export { default as FNoData } from './src/FNoData.vue'
6
+ export { default as FNotify } from './src/FNotify.vue'
7
+ export { default as FShare } from './src/FShare.vue'
8
+ export { default as FContextMenu } from './src/FContextMenu.vue'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@it-enterprise/forcebpm-ui-kit",
3
- "version": "1.0.1",
3
+ "version": "1.0.2-beta.10",
4
4
  "description": "FBPM UI Kit",
5
5
  "author": "it-enterprise",
6
6
  "license": "MIT",
@@ -18,6 +18,30 @@
18
18
  "./FAvatar": {
19
19
  "import": "./src/FAvatar.vue",
20
20
  "require": "./src/FAvatar.vue"
21
+ },
22
+ "./FConfirmModal": {
23
+ "import": "./src/FConfirmModal.vue",
24
+ "require": "./src/FConfirmModal.vue"
25
+ },
26
+ "./FPreLoader": {
27
+ "import": "./src/FPreLoader.vue",
28
+ "require": "./src/FPreLoader.vue"
29
+ },
30
+ "./FNoData": {
31
+ "import": "./src/FNoData.vue",
32
+ "require": "./src/FNoData.vue"
33
+ },
34
+ "./FNotify": {
35
+ "import": "./src/FNotify.vue",
36
+ "require": "./src/FNotify.vue"
37
+ },
38
+ "./FShare": {
39
+ "import": "./src/FShare.vue",
40
+ "require": "./src/FShare.vue"
41
+ },
42
+ "./FContextMenu": {
43
+ "import": "./src/FContextMenu.vue",
44
+ "require": "./src/FContextMenu.vue"
21
45
  }
22
46
  },
23
47
  "files": [
@@ -59,4 +83,4 @@
59
83
  "url": "https://gitlab.com/it-enterprise/npm-packages/forcebpm-ui-kit/-/issues"
60
84
  },
61
85
  "homepage": "https://gitlab.com/it-enterprise/npm-packages/forcebpm-ui-kit#readme"
62
- }
86
+ }
package/src/FAvatar.vue CHANGED
@@ -44,7 +44,7 @@ const getInitialsByName = name => {
44
44
  return result.slice(0, 2)
45
45
  }
46
46
 
47
- const userPhoto = computed(() => props.fullUser?.value?.photo)
47
+ const userPhoto = computed(() => props.fullUser?.photo)
48
48
 
49
49
  const sizeStyle = computed(() => {
50
50
  return {
@@ -0,0 +1,104 @@
1
+ <script setup>
2
+ // FConfirmModal
3
+ import { onBeforeMount, onBeforeUnmount, ref, defineEmits } from 'vue'
4
+
5
+ const show = ref(false)
6
+ const loading = ref(false)
7
+ const title = ref('')
8
+ const subTitle = ref('')
9
+ const approve = ref(null)
10
+ const decline = ref(null)
11
+
12
+ const emit = defineEmits(['confirmModalMount', 'confirmModalUnmount'])
13
+
14
+ const showModal = props => {
15
+ title.value = props.title
16
+ subTitle.value = props.subTitle
17
+ approve.value = props.approve
18
+ decline.value = props.decline
19
+ show.value = true
20
+ }
21
+
22
+ const approveHandler = async () => {
23
+ if (typeof approve.value === 'function') {
24
+ loading.value = true
25
+ await approve.value()
26
+ }
27
+ loading.value = false
28
+ show.value = false
29
+ }
30
+
31
+ const declineHandler = () => {
32
+ if (typeof decline.value === 'function') {
33
+ decline.value()
34
+ }
35
+ show.value = false
36
+ }
37
+
38
+ onBeforeMount(() => {
39
+ emit('confirmModalMount', showModal)
40
+ })
41
+
42
+ onBeforeUnmount(() => {
43
+ emit('confirmModalUnmount', showModal)
44
+ })
45
+ </script>
46
+ <template>
47
+ <v-dialog v-model="show" content-class="f-confirm-modal" max-width="500" persistent @keydown.esc="declineHandler" @keydown.enter="approveHandler">
48
+ <!-- Header -->
49
+ <div class="f-confirm-modal-header">{{ title }}</div>
50
+
51
+ <!-- Body -->
52
+ <div class="d-flex flex-column">
53
+ <div class="f-confirm-modal-content mt-5 mx-5 mb-10">{{ subTitle }}</div>
54
+
55
+ <!-- Actions -->
56
+ <v-btn class="f-confirm-modal-btn" variant="outlined" :disabled="loading" @click="declineHandler">
57
+ {{ $t('buttons.no') }}
58
+ </v-btn>
59
+ <v-btn class="f-confirm-modal-btn mt-2 mb-10" :loading="loading" @click="approveHandler">
60
+ {{ $t('buttons.yes') }}
61
+ </v-btn>
62
+ </div>
63
+ </v-dialog>
64
+ </template>
65
+
66
+ <style lang="scss" scoped>
67
+ :deep(.f-confirm-modal) {
68
+ background: rgb(var(--v-theme-background));
69
+ box-shadow: 0px 4px 20px 0px rgb(var(--v-theme-title));
70
+ border-radius: 5.8px;
71
+ display: flex;
72
+ flex-direction: column;
73
+ max-height: 90vh;
74
+ .f-confirm-modal-header {
75
+ display: flex;
76
+ justify-content: space-between;
77
+ background: rgb(var(--v-theme-background-dark));
78
+ border-top-left-radius: 5px;
79
+ border-top-right-radius: 5px;
80
+ font-size: 1.15em;
81
+ line-height: 1.25em;
82
+ font-weight: 600;
83
+ color: rgb(var(--v-theme-fields-light));
84
+ padding: 12px 0px 10px 20px;
85
+ }
86
+ .f-confirm-modal-content {
87
+ font-size: 1em;
88
+ line-height: 1.5em;
89
+ color: rgb(var(--v-theme-title));
90
+ }
91
+ .f-confirm-modal-btn {
92
+ margin: 0 34px;
93
+ }
94
+ }
95
+
96
+ .v-theme--dark {
97
+ :deep(.f-confirm-modal) {
98
+ box-shadow: var(--f-box-shadow);
99
+ .f-confirm-modal-header {
100
+ border-bottom: 1px solid rgb(var(--v-theme-line));
101
+ }
102
+ }
103
+ }
104
+ </style>
@@ -0,0 +1,122 @@
1
+ <script setup>
2
+ // FContextMenu
3
+ import { computed, mergeProps } from 'vue'
4
+ const props = defineProps({
5
+ list: {
6
+ type: Array,
7
+ required: true
8
+ // Example of list item:
9
+ // {
10
+ // name: 'Button Name',
11
+ // action: () => {},
12
+ // color: 'text',
13
+ // icon: 'fire',
14
+ // dividerTop: false, // optional setting to add top visual separation of list blocks
15
+ // dividerBottom: false // optional setting to add bottom visual separation of list blocks
16
+ // }
17
+ },
18
+ menuProps: {
19
+ type: Object,
20
+ default: () => ({
21
+ location: 'start'
22
+ })
23
+ },
24
+ tooltipProps: {
25
+ type: Object,
26
+ default: () => ({
27
+ location: 'bottom'
28
+ })
29
+ },
30
+ disabled: {
31
+ type: Boolean,
32
+ default: false
33
+ },
34
+ btnClass: {
35
+ type: String,
36
+ default: ''
37
+ }
38
+ })
39
+
40
+ const menu = defineModel({
41
+ type: Boolean,
42
+ default: false
43
+ })
44
+
45
+ const isEmpty = computed(() => !props.list.length || props.list.every(el => el.hide))
46
+ </script>
47
+
48
+ <template>
49
+ <v-menu v-if="!isEmpty" v-model="menu" v-bind="menuProps" content-class="f-context-menu-content">
50
+ <template #activator="{ props: propsMenu }">
51
+ <v-tooltip :disabled="menu || disabled" :text="$t('tooltip.actions')" v-bind="tooltipProps">
52
+ <template #activator="{ props: propsTooltip }">
53
+ <v-btn
54
+ size="25"
55
+ variant="text"
56
+ class="f-context-menu-activator"
57
+ :class="btnClass"
58
+ :disabled="disabled"
59
+ v-bind="mergeProps(propsMenu, propsTooltip)"
60
+ >
61
+ <FIcon icon="dots" size="18" :color="disabled ? 'disabled' : 'secondary'" />
62
+ </v-btn>
63
+ </template>
64
+ </v-tooltip>
65
+ </template>
66
+
67
+ <v-list>
68
+ <template v-for="(item, idx) in list">
69
+ <template v-if="!item.hide">
70
+ <!-- Divider top -->
71
+ <v-divider v-if="item.dividerTop" :key="`divider-top-${idx}`" class="bg-disabled my-3" />
72
+
73
+ <!-- List item -->
74
+ <v-list-item :key="idx" @click="item.action">
75
+ <v-list-item-title :class="`text-${item.color || 'subTitle'}`">
76
+ <FIcon v-if="item.icon" :icon="item.icon" :color="item.color || 'text'" size="18" />
77
+ <span :class="item.icon ? 'ml-1' : 'ml-5'">{{ item.name }}</span>
78
+ </v-list-item-title>
79
+ </v-list-item>
80
+
81
+ <!-- Divider bottom -->
82
+ <v-divider v-if="item.dividerBottom" :key="`divider-bottom-${idx}`" class="bg-disabled my-3" />
83
+ </template>
84
+ </template>
85
+ </v-list>
86
+ </v-menu>
87
+ </template>
88
+
89
+ <style lang="scss" scoped>
90
+ .f-context-menu-content {
91
+ .v-list {
92
+ padding: 12px 6px;
93
+ overflow-x: hidden;
94
+ .v-list-item {
95
+ padding: 4px 6px;
96
+ min-height: auto;
97
+ :deep(.v-list-item__overlay) {
98
+ border-radius: 5.8px;
99
+ background: rgb(var(--v-theme-primary));
100
+ }
101
+ &:hover {
102
+ :deep(.v-list-item__overlay) {
103
+ opacity: 0.15;
104
+ }
105
+ }
106
+ .v-list-item__content {
107
+ .v-list-item-title {
108
+ display: flex;
109
+ align-items: center;
110
+ font-weight: 600;
111
+ font-size: 1em;
112
+ }
113
+ }
114
+ }
115
+ .v-divider {
116
+ position: relative;
117
+ min-width: calc(100% + 12px);
118
+ left: -6px;
119
+ }
120
+ }
121
+ }
122
+ </style>
@@ -0,0 +1,60 @@
1
+ <script setup>
2
+ // FNoData
3
+ defineProps({
4
+ text: {
5
+ type: String,
6
+ default: null
7
+ },
8
+ height: {
9
+ type: String,
10
+ default: '100%',
11
+ validator: value => {
12
+ return /^(calc\([^()]+\)|\d+(\.\d+)?(px|em|rem|vh|vw|%)|auto)$/.test(value)
13
+ }
14
+ },
15
+ width: {
16
+ type: String,
17
+ default: 'auto',
18
+ validator: value => {
19
+ return /^(calc\([^()]+\)|\d+(\.\d+)?(px|em|rem|vh|vw|%)|auto)$/.test(value)
20
+ }
21
+ },
22
+ gradient: {
23
+ type: String,
24
+ default: ''
25
+ }
26
+ })
27
+
28
+ </script>
29
+
30
+ <template>
31
+ <div class="f-no-data" :style="`height: ${height}; width: ${width}`">
32
+ <div class="f-no-data-overlay" :style="`background: ${gradient}`">
33
+ <span class="f-no-data-text">{{ text || $t('noData.title') }}</span>
34
+ </div>
35
+ </div>
36
+ </template>
37
+
38
+ <style lang="scss" scoped>
39
+ .f-no-data {
40
+ min-height: 150px;
41
+ position: relative;
42
+ .f-no-data-overlay {
43
+ position: absolute;
44
+ display: flex;
45
+ flex-direction: column;
46
+ align-items: center;
47
+ justify-content: center;
48
+ text-align: center;
49
+ height: 100%;
50
+ width: 100%;
51
+ color: rgb(var(--v-theme-primary));
52
+ top: calc(50% - 100% / 2);
53
+ left: calc(50% - 100% / 2);
54
+ font-size: 1em;
55
+ .f-no-data-text {
56
+ width: 250px;
57
+ }
58
+ }
59
+ }
60
+ </style>
@@ -0,0 +1,258 @@
1
+ <script setup>
2
+ // FNotify
3
+ import { computed, ref, onBeforeUnmount, onMounted, watch, defineAsyncComponent, defineEmits } from 'vue'
4
+ const FHtmlContent = defineAsyncComponent(() => import('./FHtmlContent'))
5
+
6
+ const props = defineProps({
7
+ notify: {
8
+ type: Array,
9
+ default: () => []
10
+ }
11
+ })
12
+ const emit = defineEmits(['removeNotify', 'goToL'])
13
+ const timers = ref({}) // Store intervals for each notification by id
14
+ const hoveredNotifyId = ref(null)
15
+ const removeNotifyById = id => {
16
+ clearTimer(id)
17
+ emit('removeNotify', id)
18
+ }
19
+
20
+ const goToL = nf => {
21
+ emit('goToL', nf)
22
+ }
23
+ const removeNotifyAfterTimeOut = notify => {
24
+ // Initialize timer object for this notification
25
+ timers.value[notify.id] = {
26
+ intervalId: null,
27
+ remainingTime: notify.timeout,
28
+ pausedAt: Date.now()
29
+ }
30
+
31
+ const timer = timers.value[notify.id]
32
+
33
+ // Update timer every 100ms
34
+ timer.intervalId = setInterval(() => {
35
+ if (timer.pausedAt && timer.remainingTime) {
36
+ const elapsed = Date.now() - timer.pausedAt
37
+ timer.remainingTime = timer.remainingTime - elapsed
38
+ timer.pausedAt = Date.now()
39
+
40
+ if (timer.remainingTime <= 0) {
41
+ emit('removeNotify', notify.id)
42
+ clearTimer(notify.id)
43
+ }
44
+ }
45
+ }, 100)
46
+ }
47
+ const stopTimer = notifyId => {
48
+ const timer = timers.value[notifyId]
49
+ if (!timer || !timer.intervalId) return
50
+
51
+ // Calculate how much time has passed
52
+ const elapsed = Date.now() - timer.pausedAt
53
+ timer.remainingTime = timer.remainingTime - elapsed
54
+
55
+ // Stop interval
56
+ clearInterval(timer.intervalId)
57
+ timer.intervalId = null
58
+ timer.pausedAt = null
59
+ }
60
+ const continueTimer = notifyId => {
61
+ const timer = timers.value[notifyId]
62
+ if (!timer || !timer.remainingTime || timer.remainingTime <= 0) return
63
+
64
+ // Remember when we continued
65
+ timer.pausedAt = Date.now()
66
+
67
+ // Update every 100ms
68
+ timer.intervalId = setInterval(() => {
69
+ if (timer.pausedAt && timer.remainingTime) {
70
+ const elapsed = Date.now() - timer.pausedAt
71
+ timer.remainingTime = timer.remainingTime - elapsed
72
+ timer.pausedAt = Date.now()
73
+
74
+ if (timer.remainingTime <= 0) {
75
+ emit('removeNotify', notifyId)
76
+ clearTimer(notifyId)
77
+ }
78
+ }
79
+ }, 100)
80
+ }
81
+ const clearTimer = notifyId => {
82
+ const timer = timers.value[notifyId]
83
+ if (!timer) return
84
+
85
+ if (timer.intervalId) clearInterval(timer.intervalId)
86
+
87
+ delete timers.value[notifyId]
88
+ }
89
+ const handleGlobalKeydown = event => {
90
+ // Ctrl+A или Cmd+A (Mac)
91
+ if ((event.ctrlKey || event.metaKey) && event.key === 'a' && hoveredNotifyId.value) {
92
+ event.preventDefault()
93
+
94
+ const hoveredCard = document.querySelector(`[data-notify-id="${hoveredNotifyId.value}"]`)
95
+ if (hoveredCard) {
96
+ const textElement = hoveredCard.querySelector('.snack-text')
97
+ if (textElement) {
98
+ const range = document.createRange()
99
+ const selection = window.getSelection()
100
+
101
+ range.selectNodeContents(textElement)
102
+ selection.removeAllRanges()
103
+ selection.addRange(range)
104
+ }
105
+ }
106
+ }
107
+ }
108
+
109
+ onMounted(() => {
110
+ document.addEventListener('keydown', handleGlobalKeydown)
111
+ })
112
+
113
+ onBeforeUnmount(() => {
114
+ document.removeEventListener('keydown', handleGlobalKeydown)
115
+ })
116
+
117
+ watch(
118
+ props.notify,
119
+ (newval, oldVal) => {
120
+ if (newval.length > oldVal.length) {
121
+ // New notifications added
122
+ const newNotifications = newval.filter(n => !timers.value[n.id])
123
+ newNotifications.forEach(v => removeNotifyAfterTimeOut(v))
124
+ }
125
+ },
126
+ { deep: true }
127
+ )
128
+ </script>
129
+ <template>
130
+ <div v-if="props.notify.length" class="f-notify">
131
+ <div
132
+ v-for="nf in props.notify"
133
+ :key="nf.id"
134
+ :data-notify-id="nf.id"
135
+ :style="`border-color: rgb(var(--v-theme-${!nf.color ? 'secondary' : nf.color}))`"
136
+ class="snack"
137
+ @mouseover="hoveredNotifyId = nf.id"
138
+ @mouseleave="
139
+ () => {
140
+ hoveredNotifyId = null
141
+ continueTimer(nf.id)
142
+ }
143
+ "
144
+ @mouseenter="stopTimer(nf.id)"
145
+ >
146
+ <!-- Icon -->
147
+ <div class="icon" :class="`bg-${nf.color || 'secondary'}`">
148
+ <span v-if="nf.color === 'secondary' || nf.color === undefined" class="simple-icon">i</span>
149
+ <FIcon v-if="nf.color === 'success' || nf.color === 'primary'" icon="check" size="16" color="white" />
150
+ <span v-if="nf.color === 'info'" class="info-icon">!</span>
151
+ <FIcon v-if="nf.color === 'error' || nf.color === 'danger'" icon="times" size="16" color="white" />
152
+ </div>
153
+
154
+ <!-- Text -->
155
+ <div
156
+ v-if="nf.taskId || (nf.businessObjectKey && nf.businessObjectKeyType && nf.businessObjectDefinitionCode)"
157
+ class="text-subTitle"
158
+ style="overflow-wrap: anywhere"
159
+ >
160
+ <div class="d-flex flex-column">
161
+ <span class="snack-text selectable-text">
162
+ {{ nf.text }}
163
+ </span>
164
+ <span v-if="nf.commentId && nf.taskId" class="link-open-text cursor-pointer" @click.stop="goToL(nf)">
165
+ {{ $t('notification.openDescussion') }}
166
+ </span>
167
+ <span v-else-if="nf.taskId" class="link-open-text cursor-pointer" @click.stop="goToL(nf)">
168
+ {{ $t('notification.openTask') }}
169
+ </span>
170
+ <span
171
+ v-else-if="nf.businessObjectKey && nf.businessObjectKeyType && nf.businessObjectDefinitionCode"
172
+ class="link-open-text cursor-pointer"
173
+ @click.stop="goToL(nf)"
174
+ >
175
+ {{ $t('notification.openDocument') }}
176
+ </span>
177
+ </div>
178
+ </div>
179
+ <div v-else class="text-subTitle" style="overflow-wrap: anywhere">
180
+ <FHtmlContent alowed-links class="snack-text selectable-text" :data="nf.text" />
181
+ </div>
182
+
183
+ <!-- Close btn -->
184
+ <v-tooltip :text="$t('buttons.close')" attach offset="12">
185
+ <template #activator="{ props: tooltipProps }">
186
+ <v-btn class="mb-auto ml-auto" size="20" variant="text" v-bind="tooltipProps" @click="removeNotifyById(nf.id)">
187
+ <FIcon icon="times" color="text" size="0.9em" />
188
+ </v-btn>
189
+ </template>
190
+ </v-tooltip>
191
+ </div>
192
+ </div>
193
+ </template>
194
+
195
+ <style lang="scss" scoped>
196
+ .link-open-text {
197
+ margin: 2px 0;
198
+ color: rgb(var(--v-theme-links));
199
+ text-decoration: underline;
200
+ width: max-content;
201
+ }
202
+ .f-notify {
203
+ position: fixed;
204
+ height: auto;
205
+ max-width: 400px;
206
+ width: 100%;
207
+ bottom: 0;
208
+ right: 20px;
209
+ z-index: 4000;
210
+ display: flex;
211
+ flex-direction: column;
212
+ justify-content: flex-end;
213
+ .snack {
214
+ border-width: 0.5px;
215
+ border-style: solid;
216
+ margin: 10px 0;
217
+ position: relative;
218
+ min-width: 100%;
219
+ width: 100%;
220
+ height: auto;
221
+ border-radius: 10.8px;
222
+ box-shadow: var(--f-box-shadow);
223
+ background: rgb(var(--v-theme-background));
224
+ display: flex;
225
+ align-items: center;
226
+ padding: 12px 12px 12px 20px;
227
+ color: rgb(var(--v-theme-subTitle));
228
+ font-size: 0.95em;
229
+ line-height: 1;
230
+ transition: all 0.5s ease-out;
231
+ outline: none;
232
+ .icon {
233
+ margin-right: 12px;
234
+ margin-top: 0;
235
+ margin-bottom: auto;
236
+ height: 32px;
237
+ min-height: 32px;
238
+ width: 32px;
239
+ min-width: 32px;
240
+ display: flex;
241
+ align-items: center;
242
+ justify-content: center;
243
+ border-radius: 50%;
244
+ -webkit-touch-callout: none;
245
+ -webkit-user-select: none;
246
+ -khtml-user-select: none;
247
+ -moz-user-select: none;
248
+ -ms-user-select: none;
249
+ user-select: none;
250
+ .simple-icon,
251
+ .info-icon {
252
+ color: white;
253
+ font-size: 1.8em;
254
+ }
255
+ }
256
+ }
257
+ }
258
+ </style>
@@ -0,0 +1,108 @@
1
+ <script setup>
2
+ // FPreLoader
3
+ const props = defineProps({
4
+ preLoaders: {
5
+ type: Array,
6
+ default: () => []
7
+ }
8
+ })
9
+ </script>
10
+
11
+ <template>
12
+ <v-overlay :model-value="!!props.preLoaders.length" z-index="208" opacity="0.5">
13
+ <div v-if="props.preLoaders.includes('tokenUpdate')" class="text-title">
14
+ {{ $t('updating') }}
15
+ </div>
16
+ <div class="lds-ellipsis">
17
+ <div></div>
18
+ <div></div>
19
+ <div></div>
20
+ <div></div>
21
+ </div>
22
+ </v-overlay>
23
+ </template>
24
+
25
+ <style lang="scss" scoped>
26
+ .v-overlay {
27
+ :deep(.v-overlay__scrim) {
28
+ background: rgb(var(--v-theme-background)) !important;
29
+ }
30
+ }
31
+
32
+ .v-overlay {
33
+ display: flex;
34
+ flex-direction: column;
35
+ align-items: center;
36
+ justify-content: center;
37
+ :deep(.v-overlay__content) {
38
+ display: flex;
39
+ flex-direction: column;
40
+ align-items: center;
41
+ justify-content: center;
42
+ }
43
+ }
44
+
45
+ .lds-ellipsis {
46
+ display: inline-block;
47
+ position: relative;
48
+ width: 80px;
49
+ height: 80px;
50
+ }
51
+
52
+ .lds-ellipsis div {
53
+ position: absolute;
54
+ top: 33px;
55
+ width: 13px;
56
+ height: 13px;
57
+ border-radius: 50%;
58
+ background: rgb(var(--v-theme-primary));
59
+ animation-timing-function: cubic-bezier(0, 1, 1, 0);
60
+ }
61
+
62
+ .lds-ellipsis div:nth-child(1) {
63
+ left: 8px;
64
+ animation: lds-ellipsis1 0.6s infinite;
65
+ }
66
+
67
+ .lds-ellipsis div:nth-child(2) {
68
+ left: 8px;
69
+ animation: lds-ellipsis2 0.6s infinite;
70
+ }
71
+
72
+ .lds-ellipsis div:nth-child(3) {
73
+ left: 32px;
74
+ animation: lds-ellipsis2 0.6s infinite;
75
+ }
76
+
77
+ .lds-ellipsis div:nth-child(4) {
78
+ left: 56px;
79
+ animation: lds-ellipsis3 0.6s infinite;
80
+ }
81
+
82
+ @keyframes lds-ellipsis1 {
83
+ 0% {
84
+ transform: scale(0);
85
+ }
86
+ 100% {
87
+ transform: scale(1);
88
+ }
89
+ }
90
+
91
+ @keyframes lds-ellipsis3 {
92
+ 0% {
93
+ transform: scale(1);
94
+ }
95
+ 100% {
96
+ transform: scale(0);
97
+ }
98
+ }
99
+
100
+ @keyframes lds-ellipsis2 {
101
+ 0% {
102
+ transform: translate(0, 0);
103
+ }
104
+ 100% {
105
+ transform: translate(24px, 0);
106
+ }
107
+ }
108
+ </style>
package/src/FShare.vue ADDED
@@ -0,0 +1,127 @@
1
+ <script setup>
2
+ // FShare
3
+ import { ref, onBeforeMount, onBeforeUnmount, defineEmits } from 'vue'
4
+
5
+ const props = defineProps({
6
+ buttons: {
7
+ type: Array,
8
+ default: () => []
9
+ }
10
+ })
11
+ const modelValue = ref(false)
12
+ const dataObj = ref(null)
13
+
14
+ const emit = defineEmits(['shareOnMount', 'shareOnUnmount'])
15
+
16
+ const open = params => {
17
+ dataObj.value = params
18
+ modelValue.value = true
19
+ }
20
+
21
+ const close = () => {
22
+ dataObj.value = null
23
+ modelValue.value = false
24
+ }
25
+
26
+ const applyMethod = method => {
27
+ method(dataObj.value)
28
+ close()
29
+ }
30
+
31
+ onBeforeMount(() => {
32
+ emit('shareOnMount', open)
33
+ })
34
+ onBeforeUnmount(() => {
35
+ emit('shareOnUnmount', open)
36
+ })
37
+ </script>
38
+ <template>
39
+ <v-dialog v-model="modelValue" min-width="350" content-class="f-dialog">
40
+ <!-- Header -->
41
+ <div class="f-dialog-header">
42
+ <!-- Title -->
43
+ <div class="f-dialog-header-title">{{ $t('buttons.share') }}</div>
44
+ <v-tooltip offset="10" :text="$t('buttons.close')">
45
+ <template #activator="{ props: tooltipProps }">
46
+ <v-btn v-bind="tooltipProps" variant="text" size="32" class="f-dialog-header-action f-dialog-header-action-close" @click="close">
47
+ <FIcon icon="times" size="18" color="fields-light" />
48
+ </v-btn>
49
+ </template>
50
+ </v-tooltip>
51
+ </div>
52
+
53
+ <!-- Body -->
54
+ <div class="f-dialog-body">
55
+ <div class="share-wrap">
56
+ <template v-for="(btn, idx) in props.buttons">
57
+ <v-btn v-if="!btn.hide" :key="idx" variant="text" class="share-btn" color="subTitle" @click="applyMethod(btn.action)">
58
+ <FIcon :icon="btn.icon" size="24" :color="btn.color" />
59
+ <!-- <FHtmlContent :data="btn.name" /> -->
60
+ <span v-if="btn.name" class="share-btn-name">{{ btn.name }}</span>
61
+ </v-btn>
62
+ </template>
63
+ </div>
64
+ </div>
65
+ </v-dialog>
66
+ </template>
67
+ <style lang="scss" scoped>
68
+ :deep(.f-dialog) {
69
+ background: rgb(var(--v-theme-background));
70
+ box-shadow: 0px 4px 20px 0px rgb(var(--v-theme-title));
71
+ border-radius: 5.8px;
72
+ display: flex;
73
+ flex-direction: column;
74
+ max-height: 90vh; // Limit for the entire dialog
75
+ width: auto;
76
+ .f-dialog-header {
77
+ flex-shrink: 0; // Header does not shrink
78
+ display: flex;
79
+ align-items: center;
80
+ justify-content: space-between;
81
+ background: rgb(var(--v-theme-title-dark));
82
+ border-top-left-radius: 5px;
83
+ border-top-right-radius: 5px;
84
+
85
+ .f-dialog-header-title {
86
+ font-size: 1.15em;
87
+ line-height: 1.25em;
88
+ font-weight: 600;
89
+ color: rgb(var(--v-theme-fields-light));
90
+ padding: 12px 0px 10px 20px;
91
+ }
92
+ }
93
+ .f-dialog-body {
94
+ display: flex;
95
+ flex-direction: column;
96
+ flex: 1;
97
+ min-height: 0; // Important for flexbox to work with overflow
98
+ .share-wrap {
99
+ display: flex;
100
+ flex-wrap: wrap;
101
+ gap: 12px;
102
+ padding: 16px;
103
+ justify-content: center;
104
+ height: 90px;
105
+ }
106
+ .share-btn .v-btn__content {
107
+ display: flex;
108
+ align-items: center;
109
+ flex-direction: column;
110
+ width: 100px;
111
+ }
112
+ .share-btn-name {
113
+ width: 100px;
114
+ text-wrap: initial;
115
+ }
116
+ }
117
+ }
118
+
119
+ .v-theme--dark {
120
+ :deep(.f-dialog) {
121
+ box-shadow: var(--f-box-shadow);
122
+ .f-dialog-header {
123
+ border-bottom: 1px solid rgb(var(--v-theme-line));
124
+ }
125
+ }
126
+ }
127
+ </style>