@genesislcap/foundation-layout 14.26.0 → 14.26.2-alpha-4e419a3.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -10,6 +10,7 @@ export { layoutStyles } from '../styles';
10
10
  * @tagname %%prefix%%-layout
11
11
  */
12
12
  export declare class FoundationLayout extends FoundationElement implements LayoutComponent {
13
+ #private;
13
14
  private layout;
14
15
  /** @internal */
15
16
  layoutElement: HTMLElement;
@@ -223,6 +224,16 @@ export declare class FoundationLayout extends FoundationElement implements Layou
223
224
  * @internal
224
225
  */
225
226
  private loadGLConfigAndSetup;
227
+ /**
228
+ * Handles adding the drag event listeners onto the golden layout drag handles
229
+ * @remarks
230
+ * If we only add the event listeners once then once the user drags items around the layout and creates
231
+ * new drag handles, they will not have the event listeners attached. This function will add the event listeners
232
+ * but also ensure that old listeners are cleaned up. To be able to clean up the event we need a reference
233
+ * rather than an anonymous function so we store the bound function in a private variable.
234
+ * @internal
235
+ */
236
+ private attatchResizeEvents;
226
237
  }
227
238
  /**
228
239
  * `ViewTemplate` which defines the html for {@link FoundationLayout}.
@@ -1 +1 @@
1
- {"version":3,"file":"layout-main.d.ts","sourceRoot":"","sources":["../../../src/main/layout-main.ts"],"names":[],"mappings":"AAAA,OAAO,EAOL,cAAc,EACf,MAAM,kCAAkC,CAAC;AAI1C,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAE/D,OAAO,EAEL,eAAe,EAGf,SAAS,EACT,uBAAuB,EACvB,kBAAkB,EAClB,gBAAgB,EAChB,aAAa,EAId,MAAM,WAAW,CAAC;AAKnB,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AASzC;;;;;;GAMG;AACH,qBAAa,gBAAiB,SAAQ,iBAAkB,YAAW,eAAe;IAChF,OAAO,CAAC,MAAM,CAAe;IAC7B,gBAAgB;IAChB,aAAa,EAAE,WAAW,CAAC;IAC3B,OAAO,CAAC,YAAY,CAAqC;IAEzD,gBAAgB;IAChB,CAAC,aAAa,CAAC,SAAmB;IAElC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H,mBAAmB,IAAI,IAAI;IAe3B;;;;;;;OAOG;IACH,gBAAgB,CAAC,CAAC,SAAS,cAAc,EAAE,IAAI,EAAE,CAAC,GAAG,CAAC;IAetD;;;;;;;OAOG;IACH,wBAAwB,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE,EAAE,kBAAkB,GAAG,MAAM;IA0DtE;;;OAGG;IACH,OAAO,CAAC,wBAAwB;IAehC;;;;SAIK;IACL,OAAO,CAAC,kBAAkB;IAY1B;;;;;;;;OAQG;IACH,OAAO,CAAC,kCAAkC;IA4B1C;;;;;;;;;OASG;IACH,OAAO,CAAC,oBAAoB;IAO5B;;;;;;;;OAQG;IACH,OAAO,CAAC,mBAAmB;CAW5B;AAMD;;;;;GAKG;AACH,eAAO,MAAM,cAAc,uEAK1B,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,gBAAgB;;;;;;;;2BAI3B,CAAC"}
@@ -1,5 +1,5 @@
1
- var _a;
2
- import { __decorate } from "tslib";
1
+ var _FoundationLayout__boundDragListener, _a;
2
+ import { __classPrivateFieldGet, __classPrivateFieldSet, __decorate } from "tslib";
3
3
  import { GoldenLayout, LayoutConfig, ResolvedLayoutConfig, } from '@genesis-community/golden-layout';
4
4
  import { Session } from '@genesislcap/foundation-comms';
5
5
  import { layoutCacheDocument, UUID } from '@genesislcap/foundation-utils';
@@ -64,6 +64,8 @@ export class FoundationLayout extends FoundationElement {
64
64
  * Set to true when the user is currently dragging the panes inside of the layout
65
65
  */
66
66
  this.dragging = false;
67
+ /** @internal */
68
+ _FoundationLayout__boundDragListener.set(this, undefined);
67
69
  this.onDragStart = this.onDragStart.bind(this);
68
70
  this.onDragStop = this.onDragStop.bind(this);
69
71
  this.cacheAndSaveLayout = this.cacheAndSaveLayout.bind(this);
@@ -84,14 +86,12 @@ export class FoundationLayout extends FoundationElement {
84
86
  }
85
87
  this.shadowRoot.addEventListener('dragStart', this.onDragStart, true);
86
88
  this.shadowRoot.addEventListener('dragStop', this.onDragStop, true);
87
- this.shadowRoot.addEventListener('itemDestroyed', this.onItemRemoved, true);
88
89
  this.shadowRoot.addEventListener('closeButtonPressed', this.onItemRemoved, true);
89
90
  }
90
91
  /** @internal */
91
92
  disconnectedCallback() {
92
93
  this.shadowRoot.removeEventListener('dragStart', this.onDragStart);
93
94
  this.shadowRoot.removeEventListener('dragStop', this.onDragStop);
94
- this.shadowRoot.removeEventListener('itemDestroyed', this.onItemRemoved);
95
95
  this.shadowRoot.removeEventListener('closeButtonPressed', this.onItemRemoved);
96
96
  }
97
97
  /** @internal */
@@ -102,6 +102,7 @@ export class FoundationLayout extends FoundationElement {
102
102
  onDragStop() {
103
103
  this.dragging = false;
104
104
  this.cacheAndSaveLayout();
105
+ this.attatchResizeEvents();
105
106
  }
106
107
  /** @internal */
107
108
  onItemAdded() {
@@ -452,13 +453,28 @@ export class FoundationLayout extends FoundationElement {
452
453
  loadGLConfigAndSetup(config) {
453
454
  this.hasFirstLoaded = true;
454
455
  this.layout.loadLayout(Object.assign(Object.assign({}, config), glVisualConfig));
455
- const onItemResized = this.onItemResized.bind(this);
456
- this.shadowRoot
457
- .querySelectorAll('div.lm_drag_handle')
458
- .forEach((h) => h.addEventListener('click', () => onItemResized()));
456
+ this.attatchResizeEvents();
457
+ }
458
+ /**
459
+ * Handles adding the drag event listeners onto the golden layout drag handles
460
+ * @remarks
461
+ * If we only add the event listeners once then once the user drags items around the layout and creates
462
+ * new drag handles, they will not have the event listeners attached. This function will add the event listeners
463
+ * but also ensure that old listeners are cleaned up. To be able to clean up the event we need a reference
464
+ * rather than an anonymous function so we store the bound function in a private variable.
465
+ * @internal
466
+ */
467
+ attatchResizeEvents() {
468
+ if (__classPrivateFieldGet(this, _FoundationLayout__boundDragListener, "f") === undefined) {
469
+ __classPrivateFieldSet(this, _FoundationLayout__boundDragListener, () => this.onItemResized.bind(this)(), "f");
470
+ }
471
+ this.shadowRoot.querySelectorAll('div.lm_drag_handle').forEach((h) => {
472
+ h.removeEventListener('click', __classPrivateFieldGet(this, _FoundationLayout__boundDragListener, "f"));
473
+ h.addEventListener('click', __classPrivateFieldGet(this, _FoundationLayout__boundDragListener, "f"));
474
+ });
459
475
  }
460
476
  }
461
- _a = componentType;
477
+ _FoundationLayout__boundDragListener = new WeakMap(), _a = componentType;
462
478
  __decorate([
463
479
  attr({ attribute: 'reload-buffer' })
464
480
  ], FoundationLayout.prototype, "reloadBuffer", void 0);
@@ -33,6 +33,7 @@ export declare const DEFAULT_RELOAD_BUFFER = 500;
33
33
  * @tagname %%prefix%%-layout
34
34
  */
35
35
  export declare class FoundationLayout extends FoundationElement implements LayoutComponent {
36
+ #private;
36
37
  private layout;
37
38
  /** @internal */
38
39
  layoutElement: HTMLElement;
@@ -246,6 +247,16 @@ export declare class FoundationLayout extends FoundationElement implements Layou
246
247
  * @internal
247
248
  */
248
249
  private loadGLConfigAndSetup;
250
+ /**
251
+ * Handles adding the drag event listeners onto the golden layout drag handles
252
+ * @remarks
253
+ * If we only add the event listeners once then once the user drags items around the layout and creates
254
+ * new drag handles, they will not have the event listeners attached. This function will add the event listeners
255
+ * but also ensure that old listeners are cleaned up. To be able to clean up the event we need a reference
256
+ * rather than an anonymous function so we store the bound function in a private variable.
257
+ * @internal
258
+ */
259
+ private attatchResizeEvents;
249
260
  }
250
261
 
251
262
  /**
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@genesislcap/foundation-layout",
3
3
  "description": "Genesis Foundation UI App Layout",
4
- "version": "14.26.0",
4
+ "version": "14.26.2-alpha-4e419a3.0",
5
5
  "license": "SEE LICENSE IN license.txt",
6
6
  "main": "dist/esm/index.js",
7
7
  "types": "dist/foundation-layout.d.ts",
@@ -30,8 +30,8 @@
30
30
  "test:unit:watch": "watchlist src test -- npm run test:unit"
31
31
  },
32
32
  "devDependencies": {
33
- "@genesislcap/foundation-testing": "^14.26.0",
34
- "@genesislcap/genx": "^14.26.0",
33
+ "@genesislcap/foundation-testing": "14.26.2-alpha-4e419a3.0",
34
+ "@genesislcap/genx": "14.26.2-alpha-4e419a3.0",
35
35
  "@playwright/test": "^1.18.1",
36
36
  "c8": "^7.11.0",
37
37
  "esm": "^3.2.25",
@@ -44,8 +44,8 @@
44
44
  },
45
45
  "dependencies": {
46
46
  "@genesis-community/golden-layout": "^2.9.3",
47
- "@genesislcap/foundation-comms": "^14.26.0",
48
- "@genesislcap/foundation-utils": "^14.26.0",
47
+ "@genesislcap/foundation-comms": "14.26.2-alpha-4e419a3.0",
48
+ "@genesislcap/foundation-utils": "14.26.2-alpha-4e419a3.0",
49
49
  "@microsoft/fast-components": "^2.21.3",
50
50
  "@microsoft/fast-element": "^1.7.0",
51
51
  "@microsoft/fast-foundation": "^2.33.2",
@@ -60,5 +60,5 @@
60
60
  "access": "public"
61
61
  },
62
62
  "customElements": "dist/custom-elements.json",
63
- "gitHead": "5f25fc6e5f9068551f1ea703439f460c352b97d4"
63
+ "gitHead": "afa2fcb0f7401b895199d5319ded5b1462b2a2d3"
64
64
  }