@sedoo/unidoo 0.1.16 → 0.1.18

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sedoo/unidoo",
3
- "version": "0.1.16",
3
+ "version": "0.1.18",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "build": "npm run build:unidoo && npm run build:auth",
@@ -24,7 +24,8 @@
24
24
  "keycloak-js": "^8.0.2",
25
25
  "ol": "^6.8.1",
26
26
  "v-tooltip": "^2.1.3",
27
- "vue-axios": "3.2.4"
27
+ "vue-axios": "3.2.4",
28
+ "vue-custom-element": "^3.3.0"
28
29
  },
29
30
  "devDependencies": {
30
31
  "@vue/cli-plugin-babel": "4.5.7",
@@ -1,62 +1,126 @@
1
1
  <template>
2
- <span>
3
- <v-snackbar v-model="snackbar" :color="type" :timeout="timeout" :centered="position == 'centered'" :top="position == 'top'" :bottom="position == 'bottom'">
4
- {{ message }}
5
- <v-btn dark text @click="snackbar = false">{{closeButtonLabel}}</v-btn>
6
- </v-snackbar>
2
+ <span>
3
+ <v-snackbar
4
+ v-model="snackbar"
5
+ :color="type"
6
+ :timeout="timeout"
7
+ :centered="position == 'centered'"
8
+ :top="position == 'top'"
9
+ :bottom="position == 'bottom'"
10
+ >
11
+ <v-container>
12
+ <v-row>
13
+ <v-progress-linear
14
+ absolute
15
+ top
16
+ rounded
17
+ rounded-bar
18
+ :value="progressValue"
19
+ :color="progressColor"
20
+ />
21
+ </v-row>
22
+ <v-row align="center">
23
+ {{ message }}
24
+ <v-spacer></v-spacer>
25
+ <v-btn dark text @click="snackbar = false">{{
26
+ closeButtonLabel
27
+ }}</v-btn>
28
+ </v-row>
29
+ </v-container>
30
+ </v-snackbar>
7
31
  </span>
8
32
  </template>
9
33
 
10
34
  <script>
11
- import Plugin from '../plugin.js'
35
+ import Plugin from "../plugin.js";
12
36
 
13
37
  export default {
14
- components: {
38
+ components: {},
39
+ computed: {
40
+ progressValue() {
41
+ return Math.floor(100 * (1 - this.currenttime / this.timeout));
42
+ },
43
+ progressColor() {
44
+ if (this.type == "success") {
45
+ return "#1B5E20";
46
+ }
47
+ if (this.type == "error") {
48
+ return "#D50000";
49
+ }
50
+ if (this.type == "warning") {
51
+ return "#E65100";
52
+ }
53
+ return "";
54
+ },
15
55
  },
16
- data () {
56
+ data() {
17
57
  return {
18
58
  snackbar: false,
19
- message: '',
20
- type: '',
21
- position: 'top',
59
+ message: "",
60
+ type: "",
61
+ position: "top",
22
62
  timeout: 4000,
23
- closeButtonLabel: "Close"
24
- }
63
+ currenttime: 0,
64
+ closeButtonLabel: "Close",
65
+ };
25
66
  },
67
+
68
+ watch: {
69
+ snackbar(value) {
70
+ this.computeProgression(value);
71
+ },
72
+ },
73
+
26
74
  methods: {
27
- show (params) {
28
- this.message = params.message
29
- this.position = params.position ? params.position : this.position
30
- this.timeout = params.timeout ? params.timeout : this.timeout
31
- this.type = params.type ? params.type : this.type
32
- this.closeButtonLabel = params.closeButtonLabel ? params.closeButtonLabel : this.closeButtonLabel
33
- this.snackbar = true
75
+ show(params) {
76
+ this.currenttime = 0;
77
+ this.message = params.message;
78
+ this.position = params.position ? params.position : this.position;
79
+ this.timeout = params.timeout ? params.timeout : this.timeout;
80
+ this.type = params.type ? params.type : this.type;
81
+ this.closeButtonLabel = params.closeButtonLabel
82
+ ? params.closeButtonLabel
83
+ : this.closeButtonLabel;
84
+ this.snackbar = true;
34
85
  },
35
86
 
36
- params (params) {
37
- this.position = params.position ? params.position : this.position
38
- this.timeout = params.timeout ? params.timeout : this.timeout
39
- this.type = params.type ? params.type : this.type
40
- this.closeButtonLabel = params.closeButtonLabel ? params.closeButtonLabel : this.closeButtonLabel
41
- }
87
+ params(params) {
88
+ this.position = params.position ? params.position : this.position;
89
+ this.timeout = params.timeout ? params.timeout : this.timeout;
90
+ this.type = params.type ? params.type : this.type;
91
+ this.closeButtonLabel = params.closeButtonLabel
92
+ ? params.closeButtonLabel
93
+ : this.closeButtonLabel;
94
+ },
95
+
96
+ computeProgression(value) {
97
+ if (value == false) {
98
+ if (this.timer !== null) {
99
+ clearInterval(this.timer);
100
+ }
101
+ } else {
102
+ const self = this;
103
+ this.timer = setInterval(() => {
104
+ self.currenttime += 100;
105
+ }, 100);
106
+ }
107
+ },
42
108
  },
43
- beforeMount () {
44
- Plugin.EventBus.$on('unidoo-alert-show', params => {
45
- this.show(params)
46
- })
47
109
 
48
- Plugin.EventBus.$on('unidoo-alert-params', params => {
49
- this.params(params)
50
- })
51
- }
110
+ beforeMount() {
111
+ Plugin.EventBus.$on("unidoo-alert-show", (params) => {
112
+ this.show(params);
113
+ });
52
114
 
53
- }
115
+ Plugin.EventBus.$on("unidoo-alert-params", (params) => {
116
+ this.params(params);
117
+ });
118
+ },
119
+ };
54
120
  </script>
55
121
 
56
122
  <style scoped>
57
-
58
123
  .v-snack:not(.v-snack--absolute) {
59
124
  z-index: 2000;
60
125
  }
61
-
62
126
  </style>