@sedoo/unidoo 0.1.76 → 0.2.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.
Files changed (96) hide show
  1. package/dist/unidoo/404.html +25 -0
  2. package/dist/unidoo/README.html +28 -0
  3. package/dist/unidoo/api-examples.html +115 -0
  4. package/dist/unidoo/assets/README.md.BZ5Xhpv0.js +1 -0
  5. package/dist/unidoo/assets/README.md.BZ5Xhpv0.lean.js +1 -0
  6. package/dist/unidoo/assets/api-examples.md.DBhC6zLa.js +16 -0
  7. package/dist/unidoo/assets/api-examples.md.DBhC6zLa.lean.js +1 -0
  8. package/dist/unidoo/assets/app._GYTos2W.js +1 -0
  9. package/dist/unidoo/assets/captcha_README.md.DD-ycQoE.js +14 -0
  10. package/dist/unidoo/assets/captcha_README.md.DD-ycQoE.lean.js +1 -0
  11. package/dist/unidoo/assets/chunks/framework.BNUUHgeN.js +20 -0
  12. package/dist/unidoo/assets/chunks/theme.dgUwZt0m.js +17 -0
  13. package/dist/unidoo/assets/confirm-dialog_README.md.TA2YAyOM.js +40 -0
  14. package/dist/unidoo/assets/confirm-dialog_README.md.TA2YAyOM.lean.js +1 -0
  15. package/dist/unidoo/assets/crud-table_README.md.DssifgeL.js +24 -0
  16. package/dist/unidoo/assets/crud-table_README.md.DssifgeL.lean.js +1 -0
  17. package/dist/unidoo/assets/index.md.D-nQzHqq.js +1 -0
  18. package/dist/unidoo/assets/index.md.D-nQzHqq.lean.js +1 -0
  19. package/dist/unidoo/assets/inter-italic-cyrillic-ext.r48I6akx.woff2 +0 -0
  20. package/dist/unidoo/assets/inter-italic-cyrillic.By2_1cv3.woff2 +0 -0
  21. package/dist/unidoo/assets/inter-italic-greek-ext.1u6EdAuj.woff2 +0 -0
  22. package/dist/unidoo/assets/inter-italic-greek.DJ8dCoTZ.woff2 +0 -0
  23. package/dist/unidoo/assets/inter-italic-latin-ext.CN1xVJS-.woff2 +0 -0
  24. package/dist/unidoo/assets/inter-italic-latin.C2AdPX0b.woff2 +0 -0
  25. package/dist/unidoo/assets/inter-italic-vietnamese.BSbpV94h.woff2 +0 -0
  26. package/dist/unidoo/assets/inter-roman-cyrillic-ext.BBPuwvHQ.woff2 +0 -0
  27. package/dist/unidoo/assets/inter-roman-cyrillic.C5lxZ8CY.woff2 +0 -0
  28. package/dist/unidoo/assets/inter-roman-greek-ext.CqjqNYQ-.woff2 +0 -0
  29. package/dist/unidoo/assets/inter-roman-greek.BBVDIX6e.woff2 +0 -0
  30. package/dist/unidoo/assets/inter-roman-latin-ext.4ZJIpNVo.woff2 +0 -0
  31. package/dist/unidoo/assets/inter-roman-latin.Di8DUHzh.woff2 +0 -0
  32. package/dist/unidoo/assets/inter-roman-vietnamese.BjW4sHH5.woff2 +0 -0
  33. package/dist/unidoo/assets/markdown-examples.md.qFdbvAEC.js +33 -0
  34. package/dist/unidoo/assets/markdown-examples.md.qFdbvAEC.lean.js +1 -0
  35. package/dist/unidoo/assets/style.DcdIs2mU.css +5 -0
  36. package/dist/unidoo/assets/unidoo-alert_README.md.CDBoKUvE.js +21 -0
  37. package/dist/unidoo/assets/unidoo-alert_README.md.CDBoKUvE.lean.js +1 -0
  38. package/dist/unidoo/assets/unidoo-formatError_README.md.D88kRSAN.js +20 -0
  39. package/dist/unidoo/assets/unidoo-formatError_README.md.D88kRSAN.lean.js +1 -0
  40. package/dist/unidoo/assets/unidoo-heatmap_README.md.CWPHTlQQ.js +9 -0
  41. package/dist/unidoo/assets/unidoo-heatmap_README.md.CWPHTlQQ.lean.js +1 -0
  42. package/dist/unidoo/assets/unidoo-integration_README.md.BfYvxL4t.js +3 -0
  43. package/dist/unidoo/assets/unidoo-integration_README.md.BfYvxL4t.lean.js +1 -0
  44. package/dist/unidoo/assets/unidoo-keycloak_README.md.BFwhUR1e.js +94 -0
  45. package/dist/unidoo/assets/unidoo-keycloak_README.md.BFwhUR1e.lean.js +1 -0
  46. package/dist/unidoo/assets/unidoo-mapgeofeatures_README.md.DRFYhHxL.js +17 -0
  47. package/dist/unidoo/assets/unidoo-mapgeofeatures_README.md.DRFYhHxL.lean.js +1 -0
  48. package/dist/unidoo/assets/unidoo-markdown_README.md.CJiUs_1Z.js +3 -0
  49. package/dist/unidoo/assets/unidoo-markdown_README.md.CJiUs_1Z.lean.js +1 -0
  50. package/dist/unidoo/assets/unidoo-player_README.md.C-ZkMmPM.js +41 -0
  51. package/dist/unidoo/assets/unidoo-player_README.md.C-ZkMmPM.lean.js +1 -0
  52. package/dist/unidoo/assets/unidoo-sso-users_README.md.CW5npEfC.js +1 -0
  53. package/dist/unidoo/assets/unidoo-sso-users_README.md.CW5npEfC.lean.js +1 -0
  54. package/dist/unidoo/assets/unidoo-trajectorymap_README.md.SsigyJ2k.js +4 -0
  55. package/dist/unidoo/assets/unidoo-trajectorymap_README.md.SsigyJ2k.lean.js +1 -0
  56. package/dist/unidoo/assets/unidoo-uuid_README.md.ciL1hMaH.js +7 -0
  57. package/dist/unidoo/assets/unidoo-uuid_README.md.ciL1hMaH.lean.js +1 -0
  58. package/dist/unidoo/assets/unidoo-viewer_README.md.ClgkM8DW.js +4 -0
  59. package/dist/unidoo/assets/unidoo-viewer_README.md.ClgkM8DW.lean.js +1 -0
  60. package/dist/unidoo/captcha/README.html +41 -0
  61. package/dist/unidoo/confirm-dialog/README.html +67 -0
  62. package/dist/unidoo/crud-table/README.html +51 -0
  63. package/dist/unidoo/hashmap.json +1 -0
  64. package/dist/unidoo/index.html +28 -0
  65. package/dist/unidoo/markdown-examples.html +60 -0
  66. package/dist/unidoo/unidoo-alert/README.html +48 -0
  67. package/dist/unidoo/unidoo-formatError/README.html +47 -0
  68. package/dist/unidoo/unidoo-heatmap/README.html +36 -0
  69. package/dist/unidoo/unidoo-integration/README.html +30 -0
  70. package/dist/unidoo/unidoo-keycloak/README.html +121 -0
  71. package/dist/unidoo/unidoo-mapgeofeatures/README.html +44 -0
  72. package/dist/unidoo/unidoo-markdown/README.html +30 -0
  73. package/dist/unidoo/unidoo-player/README.html +68 -0
  74. package/dist/unidoo/unidoo-sso-users/README.html +28 -0
  75. package/dist/unidoo/unidoo-trajectorymap/README.html +31 -0
  76. package/dist/unidoo/unidoo-uuid/README.html +34 -0
  77. package/dist/unidoo/unidoo-viewer/README.html +31 -0
  78. package/dist/unidoo/unidoo.css +1 -0
  79. package/dist/unidoo/unidoo.es.js +290 -0
  80. package/dist/unidoo/unidoo.umd.js +1 -1888
  81. package/dist/unidoo/vp-icons.css +1 -0
  82. package/package.json +29 -34
  83. package/src/components/UnidooAlert.vue +166 -117
  84. package/src/components/UnidooCaptcha.vue +70 -84
  85. package/src/index.js +7 -0
  86. package/src/plugin.js +23 -278
  87. package/src/plugin.js.old +281 -0
  88. package/src/services/alertService.js +102 -0
  89. package/src/services/uuidService.js +25 -0
  90. package/dist/auth/auth.common.js +0 -11
  91. package/dist/auth/auth.umd.js +0 -11
  92. package/dist/auth/auth.umd.min.js +0 -11
  93. package/dist/auth/demo.html +0 -8
  94. package/dist/unidoo/demo.html +0 -8
  95. package/dist/unidoo/unidoo.common.js +0 -1888
  96. package/dist/unidoo/unidoo.umd.min.js +0 -1888
package/src/plugin.js CHANGED
@@ -1,281 +1,26 @@
1
- // Import vue components
2
- // import * as components from './components/index'
3
- // var components = {}
4
- import vueCustomElement from "vue-custom-element";
5
- import UnidooMapGeoFeatures from "./components/UnidooMapGeoFeatures.vue";
6
- import vuetify from "./plugins/vuetify";
7
- import axios from "axios";
8
- import VueAxios from 'vue-axios';
9
-
10
- // install function executed by Vue.use()
11
- function install(Vue, options = {}) {
12
- if (install.installed) return;
13
- install.installed = true;
14
-
15
- // Add component UnidooMapGeoFeatures as a custom element
16
- const VueComponent = [
17
- UnidooMapGeoFeatures,
18
- ]
19
- // function to install component in VueComponent array as a custom element
20
- installCustomElement(Vue, options, VueComponent);
21
-
22
- if (requireComponent !== undefined) {
23
- // For each matching file name...
24
- requireComponent.keys().forEach((fileName) => {
25
- // Get the component config
26
- const componentConfig = requireComponent(fileName);
27
- // Get the PascalCase version of the component name
28
- const componentName = fileName
29
- .split("/")
30
- .pop()
31
- .replace(/\.\w+$/, "");
32
- // components[componentName] = componentConfig.default || componentConfig
33
- // Globally register the component
34
- Vue.component(componentName, componentConfig.default || componentConfig);
35
- });
36
- }
37
-
38
- // Register Global event to show AppMessage, related to AppSnackbar
39
- // https://medium.com/@panzelva/writing-modals-for-vue-js-callable-from-anywhere-6994d180451
40
- this.EventBus = new Vue();
41
- Vue.prototype.$unidooAlert = {
42
- show(params) {
43
- plugin.EventBus.$emit("unidoo-alert-show", params);
44
- },
45
-
46
- defaultParams(params) {
47
- plugin.EventBus.$emit("unidoo-alert-params", params);
48
- },
49
-
50
- showSuccess(message, closeButtonLabel) {
51
- if (closeButtonLabel) {
52
- this.showMessage(message, "success", 4000, "top", closeButtonLabel);
53
- } else {
54
- this.showMessage(message, "success");
55
- }
56
- },
57
-
58
- showWarning(message, closeButtonLabel) {
59
- if (closeButtonLabel) {
60
- this.showMessage(message, "warning", 6000, "top", closeButtonLabel);
61
- } else {
62
- this.showMessage(message, "warning", 6000);
63
- }
64
- },
65
-
66
- /**
67
- * Display the given error message for 8 seconds
68
- * @param {string} message
69
- */
70
- showError(message, closeButtonLabel) {
71
- if (closeButtonLabel) {
72
- this.showMessage(message, "error", 8000, "top", closeButtonLabel);
73
- } else {
74
- this.showMessage(message, "error", 8000);
75
- }
76
- },
77
-
78
- /**
79
- * This method return the message from an error object ResponseStatusException or RuntimeException
80
- * @param {string} prefix e.g. 'An error has occured :'
81
- * @param {*} error The error object from the catch(function(error)
82
- * @returns {string} The error message
83
- */
84
- formatError(prefix, error) {
85
- let message = "An error has occured";
86
- if (typeof error === "object") {
87
- if (
88
- error.response &&
89
- error.response.data &&
90
- error.response.data.message
91
- ) {
92
- message = prefix + " " + error.response.data.message;
93
- } else if (error.message) {
94
- message = prefix + " " + error.message;
95
- }
96
- }
97
- return message;
98
- },
99
-
100
- showMessage(message, type, timeout, position, closeButtonLabel) {
101
- const params = {};
102
- if (position) {
103
- params.position = position;
104
- }
105
-
106
- if (timeout) {
107
- params.timeout = timeout;
108
- }
109
-
110
- if (closeButtonLabel) {
111
- params.closeButtonLabel = closeButtonLabel;
112
- }
113
-
114
- params.message = message;
115
- params.type = type;
116
- this.show(params);
117
- },
118
- };
119
-
120
- Vue.prototype.$unidooUuid = {
121
- randomUuidV4() {
122
- return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(
123
- c
124
- ) {
125
- var r = (Math.random() * 16) | 0;
126
- var v = c === "x" ? r : (r & 0x3) | 0x8;
127
- return v.toString(16);
128
- });
129
- },
130
- };
131
-
132
- Vue.prototype.$unidooConfirmDialog = {
133
- showWithParams(params) {
134
- plugin.EventBus.$emit("unidoo-confirm-dialog-show", params);
135
- },
136
-
137
- defaultParams(params) {
138
- plugin.EventBus.$emit("unidoo-confirm-dialog-params", params);
139
- },
140
-
141
- show(
142
- callback,
143
- message,
144
- title,
145
- titleClasses,
146
- width,
147
- cancelButtonLabel,
148
- confirmButtonLabel
149
- ) {
150
- const params = {};
151
- if (callback) {
152
- params.callback = callback;
153
- }
154
-
155
- if (message) {
156
- params.message = message;
157
- }
158
-
159
- if (title) {
160
- params.title = title;
161
- }
162
-
163
- if (titleClasses) {
164
- params.titleClasses = titleClasses;
165
- }
166
-
167
- if (width) {
168
- params.width = width;
169
- }
170
-
171
- if (cancelButtonLabel) {
172
- params.cancelButtonLabel = cancelButtonLabel;
173
- }
174
-
175
- if (confirmButtonLabel) {
176
- params.confirmButtonLabel = confirmButtonLabel;
177
- }
178
-
179
- this.showWithParams(params);
180
- },
181
- };
182
-
183
- Vue.prototype.$unidooCrudTable = {
184
- show(params) {
185
- plugin.EventBus.$emit("unidoo-crud-show", params);
186
- },
187
- };
188
-
189
- Vue.prototype.$unidooHeatmap = {
190
- setDate(date, key) {
191
- plugin.EventBus.$emit("unidoo-heatmap-set-date", {
192
- date: date,
193
- key: key,
194
- });
195
- },
196
-
197
- getDate(key) {
198
- plugin.EventBus.$emit("unidoo-heatmap-get-date", { key: key });
199
- },
200
- };
201
-
202
- Vue.prototype.$unidooDateSwitcher = {
203
- update(data, key) {
204
- plugin.EventBus.$emit("unidoo-dateswitcher-update", {
205
- data: data,
206
- key: key,
207
- });
208
- },
209
- };
210
- }
211
-
212
- // Function to install components as custom elements
213
- function installCustomElement(Vue, options, VueComponent) {
214
- // Use Vue.customElement to enable the be able to use the component UnidooMapGeoFeatures as a custom element in WordPress
215
- Vue.use(vueCustomElement);
216
-
217
- // Check if vuetify instance is provided in options in the target project which use the custom element using : Vue.use(Unidoo, { vuetify });
218
- let vuetifyInstance = null;
219
- if (options.vuetify !== undefined) {
220
- vuetifyInstance = options.vuetify;
221
- // Ensure the icons object exists before trying to set iconfont
222
- if (!vuetifyInstance.icons) {
223
- vuetifyInstance.icons = {};
224
- }
225
- if (options.iconfont !== undefined) {
226
- vuetifyInstance.icons.iconfont = options.iconfont;
227
- }
228
- } else {
229
- vuetifyInstance = vuetify;
1
+ import mitt from 'mitt'
2
+ import UnidooAlert from './components/UnidooAlert.vue'
3
+ import { createAlertService } from './services/alertService.js'
4
+ import { createUuidService } from './services/uuidService.js'
5
+
6
+ const Unidoo = {
7
+ install(app, options = {}) {
8
+ const eventBus = mitt()
9
+ const unidooAlert = createAlertService(eventBus)
10
+ const unidooUuid = createUuidService()
11
+
12
+ app.component('UnidooAlert', UnidooAlert)
13
+
14
+ // For Option API
15
+ app.config.globalProperties.$unidooAlert = unidooAlert
16
+ app.config.globalProperties.$unidooUuid = unidooUuid
17
+
18
+ // For Composition API
19
+ app.provide('unidooAlert', unidooAlert)
20
+ app.provide('unidooUuid', unidooUuid)
21
+
22
+ app.provide('unidooEventBus', eventBus)
230
23
  }
231
-
232
- // Check if axios instance is provided in options in the target project which use the custom element using : Vue.use(Unidoo, { axios });
233
- const axiosInstance = options.axios || null;
234
- if (!axiosInstance) {
235
- Vue.use(VueAxios, axios);
236
- }
237
-
238
- VueComponent.forEach(comp => {
239
- if (vuetifyInstance) {
240
- comp.vuetify = vuetifyInstance;
241
- }
242
- if (axiosInstance) {
243
- comp.axios = axiosInstance;
244
- }
245
- Vue.customElement(comp.name, comp.default || comp)
246
- });
247
- }
248
-
249
- // Create module definition for Vue.use()
250
- const plugin = {
251
- install,
252
- };
253
-
254
- // To auto-install when vue is found
255
-
256
- let GlobalVue = null;
257
- if (typeof window !== "undefined") {
258
- GlobalVue = window.Vue;
259
- } else if (typeof global !== "undefined") {
260
- GlobalVue = global.Vue;
261
- }
262
- if (GlobalVue) {
263
- GlobalVue.use(plugin);
264
24
  }
265
25
 
266
- const requireComponent = require.context(
267
- // Look for files in the current directory
268
- "./components",
269
- // Look in subdirectories
270
- true,
271
- // Only include "_base-" prefixed .vue files
272
- /[\w-]+\.vue$/
273
- );
274
-
275
- // Default export is library as a whole, registered via Vue.use()
276
- export default plugin;
277
-
278
- // To allow individual component use, export components
279
- // each can be registered via Vue.component()
280
- // console.log({components})
281
- // export {components}
26
+ export default Unidoo
@@ -0,0 +1,281 @@
1
+ // Import vue components
2
+ // import * as components from './components/index'
3
+ // var components = {}
4
+ import vueCustomElement from "vue-custom-element";
5
+ import UnidooMapGeoFeatures from "./components/UnidooMapGeoFeatures.vue";
6
+ import vuetify from "./plugins/vuetify";
7
+ import axios from "axios";
8
+ import VueAxios from 'vue-axios';
9
+
10
+ // install function executed by Vue.use()
11
+ function install(Vue, options = {}) {
12
+ if (install.installed) return;
13
+ install.installed = true;
14
+
15
+ // Add component UnidooMapGeoFeatures as a custom element
16
+ const VueComponent = [
17
+ UnidooMapGeoFeatures,
18
+ ]
19
+ // function to install component in VueComponent array as a custom element
20
+ installCustomElement(Vue, options, VueComponent);
21
+
22
+ if (requireComponent !== undefined) {
23
+ // For each matching file name...
24
+ requireComponent.keys().forEach((fileName) => {
25
+ // Get the component config
26
+ const componentConfig = requireComponent(fileName);
27
+ // Get the PascalCase version of the component name
28
+ const componentName = fileName
29
+ .split("/")
30
+ .pop()
31
+ .replace(/\.\w+$/, "");
32
+ // components[componentName] = componentConfig.default || componentConfig
33
+ // Globally register the component
34
+ Vue.component(componentName, componentConfig.default || componentConfig);
35
+ });
36
+ }
37
+
38
+ // Register Global event to show AppMessage, related to AppSnackbar
39
+ // https://medium.com/@panzelva/writing-modals-for-vue-js-callable-from-anywhere-6994d180451
40
+ this.EventBus = new Vue();
41
+ Vue.prototype.$unidooAlert = {
42
+ show(params) {
43
+ plugin.EventBus.$emit("unidoo-alert-show", params);
44
+ },
45
+
46
+ defaultParams(params) {
47
+ plugin.EventBus.$emit("unidoo-alert-params", params);
48
+ },
49
+
50
+ showSuccess(message, closeButtonLabel) {
51
+ if (closeButtonLabel) {
52
+ this.showMessage(message, "success", 4000, "top", closeButtonLabel);
53
+ } else {
54
+ this.showMessage(message, "success");
55
+ }
56
+ },
57
+
58
+ showWarning(message, closeButtonLabel) {
59
+ if (closeButtonLabel) {
60
+ this.showMessage(message, "warning", 6000, "top", closeButtonLabel);
61
+ } else {
62
+ this.showMessage(message, "warning", 6000);
63
+ }
64
+ },
65
+
66
+ /**
67
+ * Display the given error message for 8 seconds
68
+ * @param {string} message
69
+ */
70
+ showError(message, closeButtonLabel) {
71
+ if (closeButtonLabel) {
72
+ this.showMessage(message, "error", 8000, "top", closeButtonLabel);
73
+ } else {
74
+ this.showMessage(message, "error", 8000);
75
+ }
76
+ },
77
+
78
+ /**
79
+ * This method return the message from an error object ResponseStatusException or RuntimeException
80
+ * @param {string} prefix e.g. 'An error has occured :'
81
+ * @param {*} error The error object from the catch(function(error)
82
+ * @returns {string} The error message
83
+ */
84
+ formatError(prefix, error) {
85
+ let message = "An error has occured";
86
+ if (typeof error === "object") {
87
+ if (
88
+ error.response &&
89
+ error.response.data &&
90
+ error.response.data.message
91
+ ) {
92
+ message = prefix + " " + error.response.data.message;
93
+ } else if (error.message) {
94
+ message = prefix + " " + error.message;
95
+ }
96
+ }
97
+ return message;
98
+ },
99
+
100
+ showMessage(message, type, timeout, position, closeButtonLabel) {
101
+ const params = {};
102
+ if (position) {
103
+ params.position = position;
104
+ }
105
+
106
+ if (timeout) {
107
+ params.timeout = timeout;
108
+ }
109
+
110
+ if (closeButtonLabel) {
111
+ params.closeButtonLabel = closeButtonLabel;
112
+ }
113
+
114
+ params.message = message;
115
+ params.type = type;
116
+ this.show(params);
117
+ },
118
+ };
119
+
120
+ Vue.prototype.$unidooUuid = {
121
+ randomUuidV4() {
122
+ return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(
123
+ c
124
+ ) {
125
+ var r = (Math.random() * 16) | 0;
126
+ var v = c === "x" ? r : (r & 0x3) | 0x8;
127
+ return v.toString(16);
128
+ });
129
+ },
130
+ };
131
+
132
+ Vue.prototype.$unidooConfirmDialog = {
133
+ showWithParams(params) {
134
+ plugin.EventBus.$emit("unidoo-confirm-dialog-show", params);
135
+ },
136
+
137
+ defaultParams(params) {
138
+ plugin.EventBus.$emit("unidoo-confirm-dialog-params", params);
139
+ },
140
+
141
+ show(
142
+ callback,
143
+ message,
144
+ title,
145
+ titleClasses,
146
+ width,
147
+ cancelButtonLabel,
148
+ confirmButtonLabel
149
+ ) {
150
+ const params = {};
151
+ if (callback) {
152
+ params.callback = callback;
153
+ }
154
+
155
+ if (message) {
156
+ params.message = message;
157
+ }
158
+
159
+ if (title) {
160
+ params.title = title;
161
+ }
162
+
163
+ if (titleClasses) {
164
+ params.titleClasses = titleClasses;
165
+ }
166
+
167
+ if (width) {
168
+ params.width = width;
169
+ }
170
+
171
+ if (cancelButtonLabel) {
172
+ params.cancelButtonLabel = cancelButtonLabel;
173
+ }
174
+
175
+ if (confirmButtonLabel) {
176
+ params.confirmButtonLabel = confirmButtonLabel;
177
+ }
178
+
179
+ this.showWithParams(params);
180
+ },
181
+ };
182
+
183
+ Vue.prototype.$unidooCrudTable = {
184
+ show(params) {
185
+ plugin.EventBus.$emit("unidoo-crud-show", params);
186
+ },
187
+ };
188
+
189
+ Vue.prototype.$unidooHeatmap = {
190
+ setDate(date, key) {
191
+ plugin.EventBus.$emit("unidoo-heatmap-set-date", {
192
+ date: date,
193
+ key: key,
194
+ });
195
+ },
196
+
197
+ getDate(key) {
198
+ plugin.EventBus.$emit("unidoo-heatmap-get-date", { key: key });
199
+ },
200
+ };
201
+
202
+ Vue.prototype.$unidooDateSwitcher = {
203
+ update(data, key) {
204
+ plugin.EventBus.$emit("unidoo-dateswitcher-update", {
205
+ data: data,
206
+ key: key,
207
+ });
208
+ },
209
+ };
210
+ }
211
+
212
+ // Function to install components as custom elements
213
+ function installCustomElement(Vue, options, VueComponent) {
214
+ // Use Vue.customElement to enable the be able to use the component UnidooMapGeoFeatures as a custom element in WordPress
215
+ Vue.use(vueCustomElement);
216
+
217
+ // Check if vuetify instance is provided in options in the target project which use the custom element using : Vue.use(Unidoo, { vuetify });
218
+ let vuetifyInstance = null;
219
+ if (options.vuetify !== undefined) {
220
+ vuetifyInstance = options.vuetify;
221
+ // Ensure the icons object exists before trying to set iconfont
222
+ if (!vuetifyInstance.icons) {
223
+ vuetifyInstance.icons = {};
224
+ }
225
+ if (options.iconfont !== undefined) {
226
+ vuetifyInstance.icons.iconfont = options.iconfont;
227
+ }
228
+ } else {
229
+ vuetifyInstance = vuetify;
230
+ }
231
+
232
+ // Check if axios instance is provided in options in the target project which use the custom element using : Vue.use(Unidoo, { axios });
233
+ const axiosInstance = options.axios || null;
234
+ if (!axiosInstance) {
235
+ Vue.use(VueAxios, axios);
236
+ }
237
+
238
+ VueComponent.forEach(comp => {
239
+ if (vuetifyInstance) {
240
+ comp.vuetify = vuetifyInstance;
241
+ }
242
+ if (axiosInstance) {
243
+ comp.axios = axiosInstance;
244
+ }
245
+ Vue.customElement(comp.name, comp.default || comp)
246
+ });
247
+ }
248
+
249
+ // Create module definition for Vue.use()
250
+ const plugin = {
251
+ install,
252
+ };
253
+
254
+ // To auto-install when vue is found
255
+
256
+ let GlobalVue = null;
257
+ if (typeof window !== "undefined") {
258
+ GlobalVue = window.Vue;
259
+ } else if (typeof global !== "undefined") {
260
+ GlobalVue = global.Vue;
261
+ }
262
+ if (GlobalVue) {
263
+ GlobalVue.use(plugin);
264
+ }
265
+
266
+ const requireComponent = require.context(
267
+ // Look for files in the current directory
268
+ "./components",
269
+ // Look in subdirectories
270
+ true,
271
+ // Only include "_base-" prefixed .vue files
272
+ /[\w-]+\.vue$/
273
+ );
274
+
275
+ // Default export is library as a whole, registered via Vue.use()
276
+ export default plugin;
277
+
278
+ // To allow individual component use, export components
279
+ // each can be registered via Vue.component()
280
+ // console.log({components})
281
+ // export {components}
@@ -0,0 +1,102 @@
1
+ export function createAlertService(eventBus) {
2
+ function show(params = {}) {
3
+ eventBus.emit('unidoo-alert-show', params)
4
+ }
5
+
6
+ function defaultParams(params = {}) {
7
+ eventBus.emit('unidoo-alert-params', params)
8
+ }
9
+
10
+ function showMessage(
11
+ message,
12
+ type,
13
+ timeout,
14
+ position,
15
+ closeButtonLabel
16
+ ) {
17
+ const params = {
18
+ message,
19
+ type
20
+ }
21
+
22
+ if (timeout !== undefined) {
23
+ params.timeout = timeout
24
+ }
25
+
26
+ if (position !== undefined) {
27
+ params.position = position
28
+ }
29
+
30
+ if (closeButtonLabel !== undefined) {
31
+ params.closeButtonLabel = closeButtonLabel
32
+ }
33
+
34
+ show(params)
35
+ }
36
+
37
+ function showSuccess(message, closeButtonLabel) {
38
+ if (closeButtonLabel) {
39
+ showMessage(
40
+ message,
41
+ 'success',
42
+ 4000,
43
+ 'top',
44
+ closeButtonLabel
45
+ )
46
+ } else {
47
+ showMessage(message, 'success')
48
+ }
49
+ }
50
+
51
+ function showWarning(message, closeButtonLabel) {
52
+ if (closeButtonLabel) {
53
+ showMessage(
54
+ message,
55
+ 'warning',
56
+ 6000,
57
+ 'top',
58
+ closeButtonLabel
59
+ )
60
+ } else {
61
+ showMessage(message, 'warning', 6000)
62
+ }
63
+ }
64
+
65
+ function showError(message, closeButtonLabel) {
66
+ if (closeButtonLabel) {
67
+ showMessage(
68
+ message,
69
+ 'error',
70
+ 8000,
71
+ 'top',
72
+ closeButtonLabel
73
+ )
74
+ } else {
75
+ showMessage(message, 'error', 8000)
76
+ }
77
+ }
78
+
79
+ function formatError(prefix, error) {
80
+ let message = 'An error has occured'
81
+
82
+ if (error && typeof error === 'object') {
83
+ if (error.response?.data?.message) {
84
+ message = `${prefix} ${error.response.data.message}`
85
+ } else if (error.message) {
86
+ message = `${prefix} ${error.message}`
87
+ }
88
+ }
89
+
90
+ return message
91
+ }
92
+
93
+ return {
94
+ show,
95
+ defaultParams,
96
+ showMessage,
97
+ showSuccess,
98
+ showWarning,
99
+ showError,
100
+ formatError
101
+ }
102
+ }
@@ -0,0 +1,25 @@
1
+ export function createUuidService() {
2
+ function randomUuidV4() {
3
+ if (typeof crypto !== 'undefined' && crypto.randomUUID) {
4
+ return crypto.randomUUID()
5
+ }
6
+
7
+ return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(
8
+ /[xy]/g,
9
+ (character) => {
10
+ const random = (Math.random() * 16) | 0
11
+
12
+ const value =
13
+ character === 'x'
14
+ ? random
15
+ : (random & 0x3) | 0x8
16
+
17
+ return value.toString(16)
18
+ }
19
+ )
20
+ }
21
+
22
+ return {
23
+ randomUuidV4
24
+ }
25
+ }