@itfin/components 1.2.48 → 1.2.49

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": "@itfin/components",
3
- "version": "1.2.48",
3
+ "version": "1.2.49",
4
4
  "author": "Vitalii Savchuk <esvit666@gmail.com>",
5
5
  "scripts": {
6
6
  "serve": "vue-cli-service serve",
@@ -6,6 +6,7 @@ const MessageConstructor = Vue.extend(ToastContainer);
6
6
  const instances = [];
7
7
  let count = 1;
8
8
  const containers = {};
9
+ const instancesIds = {};
9
10
 
10
11
  const Message = function (options) {
11
12
  const userOnClose = options.onClose;
@@ -28,6 +29,11 @@ const Message = function (options) {
28
29
  containerEl.style.zIndex = options.zIndex;
29
30
  }
30
31
 
32
+ if (options.Id && options.closeById) {
33
+ Message.closeById(options.Id);
34
+ return;
35
+ }
36
+
31
37
  const id = count++;
32
38
  options.onClose = function () {
33
39
  Message.close(id, userOnClose);
@@ -51,6 +57,7 @@ const Message = function (options) {
51
57
  instance.show = true;
52
58
 
53
59
  instances.push(instance);
60
+ instancesIds[options.Id] = instance;
54
61
 
55
62
  return instance;
56
63
  };
@@ -97,6 +104,13 @@ Message.closeAll = function () {
97
104
  }
98
105
  };
99
106
 
107
+ Message.closeById = function (id) {
108
+ if (instancesIds[id]) {
109
+ instancesIds[id].close();
110
+ delete instancesIds.id;
111
+ }
112
+ }
113
+
100
114
  const types = ['info', 'success', 'error', 'warning', 'loading'];
101
115
 
102
116
  types.forEach((type) => {