@itfin/components 2.0.49 → 2.0.50

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": "2.0.49",
3
+ "version": "2.0.50",
4
4
  "author": "Vitalii Savchuk <esvit666@gmail.com>",
5
5
  "scripts": {
6
6
  "serve": "vue-cli-service serve",
@@ -45,7 +45,6 @@ class itfApp extends Vue {
45
45
  if (typeof document === 'undefined') {
46
46
  return;
47
47
  }
48
- console.trace();
49
48
  return Message.error({
50
49
  isCollapsed: false,
51
50
  showClose: true,
@@ -0,0 +1,3 @@
1
+ <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path d="M9 8.41421L9 15.5858C9 16.4767 10.0771 16.9229 10.7071 16.2929L14.2929 12.7071C14.6834 12.3166 14.6834 11.6834 14.2929 11.2929L10.7071 7.70711C10.0771 7.07714 9 7.52331 9 8.41421Z" fill="currentColor"/>
3
+ </svg>
@@ -0,0 +1,3 @@
1
+ <svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path d="M6.66671 8.33337L10 11.6667L13.3334 8.33337" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"/>
3
+ </svg>
@@ -0,0 +1,3 @@
1
+ <svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path d="M11.6667 13.3333L8.33337 9.99996L11.6667 6.66663" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"/>
3
+ </svg>
@@ -1,3 +1,3 @@
1
- <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
2
- <path d="M9 8.41421L9 15.5858C9 16.4767 10.0771 16.9229 10.7071 16.2929L14.2929 12.7071C14.6834 12.3166 14.6834 11.6834 14.2929 11.2929L10.7071 7.70711C10.0771 7.07714 9 7.52331 9 8.41421Z" fill="currentColor"/>
1
+ <svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path d="M8.33337 13.3333L11.6667 9.99996L8.33337 6.66663" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"/>
3
3
  </svg>
@@ -167,7 +167,7 @@ import { Vue, Component, Prop } from 'vue-property-decorator';
167
167
  import itfIcon from '../icon/Icon.vue';
168
168
  import Panel from './Panel.vue';
169
169
  import {hashToStack, stackToHash} from "@itfin/components/src/components/panels/helpers";
170
- import {setRootPanelList} from "@itfin/components/src/components/panels";
170
+ import {emitGlobalEvent, setRootPanelList} from "@itfin/components/src/components/panels";
171
171
 
172
172
  interface VisualOptions {
173
173
  title: string;
@@ -393,6 +393,7 @@ export default class PanelList extends Vue {
393
393
  }
394
394
 
395
395
  emitEvent(event: string, ...args: any[]) {
396
+ emitGlobalEvent(event, ...args);
396
397
  for (const panel of this.panelsStack) {
397
398
  if (panel.__events[event]) {
398
399
  for (const func of panel.__events[event]) {
@@ -22,3 +22,22 @@ export function setPanelsPathType(settings: any) {
22
22
  export function setRootPanelList(rootPanelList: any) {
23
23
  PanelsSettings.rootPanelList = rootPanelList;
24
24
  }
25
+
26
+ export function emitGlobalEvent(eventName: string, data: any) {
27
+ const event = new CustomEvent(`panel:${eventName}`, { detail: data });
28
+ window.dispatchEvent(event);
29
+ }
30
+
31
+ export function onGlobalEvent(eventName: string|string[], callback: (event: CustomEvent) => void) {
32
+ const eventNames = Array.isArray(eventName) ? eventName : [eventName];
33
+ for (const name of eventNames) {
34
+ window.addEventListener(`panel:${name}`, callback);
35
+ }
36
+ }
37
+
38
+ export function offGlobalEvent(eventName: string|string[], callback: (event: CustomEvent) => void) {
39
+ const eventNames = Array.isArray(eventName) ? eventName : [eventName];
40
+ for (const name of eventNames) {
41
+ window.removeEventListener(`panel:${name}`, callback);
42
+ }
43
+ }