@omegagrid/dashboard 0.11.25 → 0.11.27

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.
@@ -13,6 +13,7 @@ export declare class DashboardItemModel {
13
13
  w: number;
14
14
  h: number;
15
15
  title: string;
16
+ hidden: boolean;
16
17
  constructor(model: DashboardModel, index: number, source?: DashboardItemSource);
17
18
  pupulate(source: DashboardItemSource): void;
18
19
  getSourceData(): DashboardItemSource;
@@ -1 +1 @@
1
- {"version":3,"file":"dashboardItemModel.d.ts","sourceRoot":"","sources":["../../src/model/dashboardItemModel.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAC/C,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD,qBAAa,kBAAkB;IAgB7B,QAAQ,CAAC,KAAK,EAAE,cAAc;IAd/B,OAAO,CAAC,MAAM,CAAS;IACvB,IAAI,KAAK,IACQ,MAAM,CADW;IAClC,IAAI,KAAK,CAAC,KAAK,EAAE,MAAM,EAAyB;IAEhD,OAAO,CAAC,GAAG,CAAc;IACzB,IAAI,EAAE,gBAAsB;IAE5B,CAAC,SAAK;IACN,CAAC,SAAK;IACN,CAAC,SAAK;IACN,CAAC,SAAK;IACN,KAAK,EAAE,MAAM,CAAC;gBAGJ,KAAK,EAAE,cAAc,EAC9B,KAAK,EAAE,MAAM,EACb,MAAM,CAAC,EAAE,mBAAmB;IAM7B,QAAQ,CAAC,MAAM,EAAE,mBAAmB;IASpC,aAAa,IAAI,mBAAmB;CAWpC"}
1
+ {"version":3,"file":"dashboardItemModel.d.ts","sourceRoot":"","sources":["../../src/model/dashboardItemModel.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAC/C,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD,qBAAa,kBAAkB;IAiB7B,QAAQ,CAAC,KAAK,EAAE,cAAc;IAf/B,OAAO,CAAC,MAAM,CAAS;IACvB,IAAI,KAAK,IACQ,MAAM,CADW;IAClC,IAAI,KAAK,CAAC,KAAK,EAAE,MAAM,EAAyB;IAEhD,OAAO,CAAC,GAAG,CAAc;IACzB,IAAI,EAAE,gBAAsB;IAE5B,CAAC,SAAK;IACN,CAAC,SAAK;IACN,CAAC,SAAK;IACN,CAAC,SAAK;IACN,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,UAAS;gBAGL,KAAK,EAAE,cAAc,EAC9B,KAAK,EAAE,MAAM,EACb,MAAM,CAAC,EAAE,mBAAmB;IAM7B,QAAQ,CAAC,MAAM,EAAE,mBAAmB;IAUpC,aAAa,IAAI,mBAAmB;CAYpC"}
@@ -8,6 +8,7 @@ export class DashboardItemModel {
8
8
  this.y = 0;
9
9
  this.w = 1;
10
10
  this.h = 1;
11
+ this.hidden = false;
11
12
  this._index = index;
12
13
  if (source)
13
14
  this.pupulate(source);
@@ -19,6 +20,7 @@ export class DashboardItemModel {
19
20
  this.w = source.w || 1;
20
21
  this.h = source.h || 1;
21
22
  this.title = source.title || `#${this.index + 1}`;
23
+ this.hidden = !!source.hidden;
22
24
  }
23
25
  getSourceData() {
24
26
  return {
@@ -27,7 +29,8 @@ export class DashboardItemModel {
27
29
  x: this.x,
28
30
  y: this.y,
29
31
  w: this.w,
30
- h: this.h
32
+ h: this.h,
33
+ ...(this.hidden ? { hidden: true } : {})
31
34
  };
32
35
  }
33
36
  }
@@ -1 +1 @@
1
- {"version":3,"file":"dashboardItemModel.js","sourceRoot":"","sources":["../../src/model/dashboardItemModel.ts"],"names":[],"mappings":"AAIA,MAAM,OAAO,kBAAkB;IAG9B,IAAI,KAAK,KAAK,OAAO,IAAI,CAAC,MAAM,CAAA,CAAC,CAAC;IAClC,IAAI,KAAK,CAAC,KAAa,IAAI,IAAI,CAAC,MAAM,GAAG,KAAK,CAAA,CAAC,CAAC;IAGhD,IAAI,EAAE,KAAK,OAAO,IAAI,CAAC,GAAG,CAAA,CAAC,CAAC;IAQ5B,YACU,KAAqB,EAC9B,KAAa,EACb,MAA4B;QAFnB,UAAK,GAAL,KAAK,CAAgB;QAP/B,MAAC,GAAG,CAAC,CAAC;QACN,MAAC,GAAG,CAAC,CAAC;QACN,MAAC,GAAG,CAAC,CAAC;QACN,MAAC,GAAG,CAAC,CAAC;QAQL,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;QACpB,IAAI,MAAM;YAAE,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IACnC,CAAC;IAED,QAAQ,CAAC,MAA2B;QACnC,IAAI,CAAC,GAAG,GAAG,MAAM,CAAC,EAAE,CAAC;QACrB,IAAI,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC;QAClB,IAAI,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC;QAClB,IAAI,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC;QACvB,IAAI,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC;QACvB,IAAI,CAAC,KAAK,GAAG,MAAM,CAAC,KAAK,IAAI,IAAI,IAAI,CAAC,KAAK,GAAG,CAAC,EAAE,CAAC;IACnD,CAAC;IAED,aAAa;QACZ,OAAO;YACN,EAAE,EAAE,IAAI,CAAC,EAAE;YACX,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,CAAC,EAAE,IAAI,CAAC,CAAC;YACT,CAAC,EAAE,IAAI,CAAC,CAAC;YACT,CAAC,EAAE,IAAI,CAAC,CAAC;YACT,CAAC,EAAE,IAAI,CAAC,CAAC;SACT,CAAC;IACH,CAAC;CAED","sourcesContent":["import { ComponentId } from \"@omegagrid/core\";\nimport { DashboardItemSource } from \"../types\";\nimport { DashboardModel } from \"./dashboardModel\";\n\nexport class DashboardItemModel {\n\n\tprivate _index: number;\n\tget index() { return this._index }\n\tset index(value: number) { this._index = value }\n\n\tprivate _id: ComponentId;\n\tget id() { return this._id }\n\n\tx = 0;\n\ty = 0;\n\tw = 1;\n\th = 1;\n\ttitle: string;\n\n\tconstructor(\n\t\treadonly model: DashboardModel, \n\t\tindex: number, \n\t\tsource?: DashboardItemSource\n\t) {\n\t\tthis._index = index;\n\t\tif (source) this.pupulate(source);\n\t}\n\n\tpupulate(source: DashboardItemSource) {\n\t\tthis._id = source.id;\n\t\tthis.x = source.x;\n\t\tthis.y = source.y;\n\t\tthis.w = source.w || 1;\n\t\tthis.h = source.h || 1;\n\t\tthis.title = source.title || `#${this.index + 1}`;\n\t}\n\n\tgetSourceData(): DashboardItemSource {\n\t\treturn {\n\t\t\tid: this.id,\n\t\t\ttitle: this.title,\n\t\t\tx: this.x,\n\t\t\ty: this.y,\n\t\t\tw: this.w,\n\t\t\th: this.h\n\t\t};\n\t}\n\n}"]}
1
+ {"version":3,"file":"dashboardItemModel.js","sourceRoot":"","sources":["../../src/model/dashboardItemModel.ts"],"names":[],"mappings":"AAIA,MAAM,OAAO,kBAAkB;IAG9B,IAAI,KAAK,KAAK,OAAO,IAAI,CAAC,MAAM,CAAA,CAAC,CAAC;IAClC,IAAI,KAAK,CAAC,KAAa,IAAI,IAAI,CAAC,MAAM,GAAG,KAAK,CAAA,CAAC,CAAC;IAGhD,IAAI,EAAE,KAAK,OAAO,IAAI,CAAC,GAAG,CAAA,CAAC,CAAC;IAS5B,YACU,KAAqB,EAC9B,KAAa,EACb,MAA4B;QAFnB,UAAK,GAAL,KAAK,CAAgB;QAR/B,MAAC,GAAG,CAAC,CAAC;QACN,MAAC,GAAG,CAAC,CAAC;QACN,MAAC,GAAG,CAAC,CAAC;QACN,MAAC,GAAG,CAAC,CAAC;QAEN,WAAM,GAAG,KAAK,CAAC;QAOd,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;QACpB,IAAI,MAAM;YAAE,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IACnC,CAAC;IAED,QAAQ,CAAC,MAA2B;QACnC,IAAI,CAAC,GAAG,GAAG,MAAM,CAAC,EAAE,CAAC;QACrB,IAAI,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC;QAClB,IAAI,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC;QAClB,IAAI,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC;QACvB,IAAI,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC;QACvB,IAAI,CAAC,KAAK,GAAG,MAAM,CAAC,KAAK,IAAI,IAAI,IAAI,CAAC,KAAK,GAAG,CAAC,EAAE,CAAC;QAClD,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC;IAC/B,CAAC;IAED,aAAa;QACZ,OAAO;YACN,EAAE,EAAE,IAAI,CAAC,EAAE;YACX,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,CAAC,EAAE,IAAI,CAAC,CAAC;YACT,CAAC,EAAE,IAAI,CAAC,CAAC;YACT,CAAC,EAAE,IAAI,CAAC,CAAC;YACT,CAAC,EAAE,IAAI,CAAC,CAAC;YACT,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,EAAC,MAAM,EAAE,IAAI,EAAC,CAAC,CAAC,CAAC,EAAE,CAAC;SACtC,CAAC;IACH,CAAC;CAED","sourcesContent":["import { ComponentId } from \"@omegagrid/core\";\nimport { DashboardItemSource } from \"../types\";\nimport { DashboardModel } from \"./dashboardModel\";\n\nexport class DashboardItemModel {\n\n\tprivate _index: number;\n\tget index() { return this._index }\n\tset index(value: number) { this._index = value }\n\n\tprivate _id: ComponentId;\n\tget id() { return this._id }\n\n\tx = 0;\n\ty = 0;\n\tw = 1;\n\th = 1;\n\ttitle: string;\n\thidden = false;\n\n\tconstructor(\n\t\treadonly model: DashboardModel, \n\t\tindex: number, \n\t\tsource?: DashboardItemSource\n\t) {\n\t\tthis._index = index;\n\t\tif (source) this.pupulate(source);\n\t}\n\n\tpupulate(source: DashboardItemSource) {\n\t\tthis._id = source.id;\n\t\tthis.x = source.x;\n\t\tthis.y = source.y;\n\t\tthis.w = source.w || 1;\n\t\tthis.h = source.h || 1;\n\t\tthis.title = source.title || `#${this.index + 1}`;\n\t\tthis.hidden = !!source.hidden;\n\t}\n\n\tgetSourceData(): DashboardItemSource {\n\t\treturn {\n\t\t\tid: this.id,\n\t\t\ttitle: this.title,\n\t\t\tx: this.x,\n\t\t\ty: this.y,\n\t\t\tw: this.w,\n\t\t\th: this.h,\n\t\t\t...(this.hidden ? {hidden: true} : {})\n\t\t};\n\t}\n\n}"]}
@@ -12,6 +12,15 @@ export declare class DashboardModel {
12
12
  get size(): Size;
13
13
  getSourceData(): DashboardSource;
14
14
  updatePositions(positions: Rect[]): void;
15
+ /**
16
+ * Positions of the items outside design mode (index aligned with items,
17
+ * null for hidden items). With the autoCompact option the space left by
18
+ * hidden items is taken by the visible ones: they move into it towards the start of the cross axis
19
+ * first (left in vertical orientation), then along the scroll axis, as long
20
+ * as the cells they enter were freed by a hidden or moved item. Gaps left
21
+ * in the layout on purpose are kept. The item model positions do not change.
22
+ */
23
+ getViewPositions(): Rect[];
15
24
  calculatePositions(movingItem: DashboardItemModel, rect: Rect): Rect[];
16
25
  /**
17
26
  * Detects and fixes collisions between dashboard items
@@ -1 +1 @@
1
- {"version":3,"file":"dashboardModel.d.ts","sourceRoot":"","sources":["../../src/model/dashboardModel.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,IAAI,EAAS,MAAM,iBAAiB,CAAC;AAEpD,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAC7D,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE1D,qBAAa,cAAc;IAE1B,OAAO,CAAC,QAAQ,CAAm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O;CAYxB"}
@@ -42,6 +42,60 @@ export class DashboardModel {
42
42
  this._size.h = Math.max(this._size.h, item.y + item.h);
43
43
  });
44
44
  }
45
+ /**
46
+ * Positions of the items outside design mode (index aligned with items,
47
+ * null for hidden items). With the autoCompact option the space left by
48
+ * hidden items is taken by the visible ones: they move into it towards the start of the cross axis
49
+ * first (left in vertical orientation), then along the scroll axis, as long
50
+ * as the cells they enter were freed by a hidden or moved item. Gaps left
51
+ * in the layout on purpose are kept. The item model positions do not change.
52
+ */
53
+ getViewPositions() {
54
+ const positions = this._items.map(item => item.hidden ? null : { x: item.x, y: item.y, w: item.w, h: item.h });
55
+ if (!this._options.autoCompact || !this._items.some(item => item.hidden))
56
+ return positions;
57
+ const key = (x, y) => `${x}:${y}`;
58
+ const occupied = new Set();
59
+ const freed = new Set();
60
+ const cells = (rect, fn) => {
61
+ for (let x = rect.x; x < rect.x + rect.w; x++) {
62
+ for (let y = rect.y; y < rect.y + rect.h; y++)
63
+ fn(key(x, y));
64
+ }
65
+ };
66
+ this._items.forEach((item, i) => cells(item, cell => (positions[i] ? occupied : freed).add(cell)));
67
+ // one step of the rect in the given direction, the entered cells must be freed and empty
68
+ const move = (rect, dx, dy) => {
69
+ const target = { ...rect, x: rect.x + dx, y: rect.y + dy };
70
+ if (target.x < 0 || target.y < 0)
71
+ return false;
72
+ const entered = [];
73
+ cells(target, cell => entered.push(cell));
74
+ const own = new Set();
75
+ cells(rect, cell => own.add(cell));
76
+ if (entered.some(cell => !own.has(cell) && (occupied.has(cell) || !freed.has(cell))))
77
+ return false;
78
+ own.forEach(cell => {
79
+ occupied.delete(cell);
80
+ freed.add(cell);
81
+ });
82
+ entered.forEach(cell => occupied.add(cell));
83
+ Object.assign(rect, target);
84
+ return true;
85
+ };
86
+ const vertical = this._options.orientation !== 'horizontal';
87
+ const steps = vertical ? [[-1, 0], [0, -1]] : [[0, -1], [-1, 0]];
88
+ const visible = positions.filter(Boolean).sort((a, b) => vertical ? (a.y - b.y || a.x - b.x) : (a.x - b.x || a.y - b.y));
89
+ let changed = true;
90
+ while (changed) {
91
+ changed = false;
92
+ visible.forEach(rect => steps.forEach(([dx, dy]) => {
93
+ while (move(rect, dx, dy))
94
+ changed = true;
95
+ }));
96
+ }
97
+ return positions;
98
+ }
45
99
  calculatePositions(movingItem, rect) {
46
100
  const newPositions = new Array(this._items.length);
47
101
  const columns = this._options.columns || Infinity;
@@ -1 +1 @@
1
- {"version":3,"file":"dashboardModel.js","sourceRoot":"","sources":["../../src/model/dashboardModel.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,KAAK,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,SAAS,MAAM,cAAc,CAAC;AAErC,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE1D,MAAM,OAAO,cAAc;IAG1B,IAAI,OAAO,KAAK,OAAO,IAAI,CAAC,QAAQ,CAAA,CAAC,CAAC;IAGtC,IAAI,KAAK,KAAK,OAAO,IAAI,CAAC,MAAM,CAAA,CAAC,CAAC;IAElC,YAAY,MAAwB;QAH5B,WAAM,GAAyB,EAAE,CAAC;QAIzC,IAAI,MAAM;YAAE,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IACnC,CAAC;IAED,QAAQ,CAAC,MAAuB;QAC/B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC,EAAE,EAAE,CAAC,IAAI,kBAAkB,CAAC,IAAI,EAAE,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC;QACnF,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC,SAAS,CAAC,SAAS,CAAC,eAAe,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC;IAC5E,CAAC;IAGD,IAAI,IAAI;QACP,IAAI,IAAI,CAAC,KAAK;YAAE,OAAO,IAAI,CAAC,KAAK,CAAC;QAClC,IAAI,CAAC,KAAK,GAAG,EAAC,CAAC,EAAE,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O,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;gBACxC,CAAC;YACF,CAAC;iBAAM,CAAC;gBACP,IAAI,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,GAAG,IAAI,EAAE,CAAC;oBAC5B,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;gBACrC,CAAC;YACF,CAAC;QACF,CAAC;QAED,iDAAiD;QACjD,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;IACnB,CAAC;IAED;;;OAGG;IACH,aAAa;QACZ,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;YAC7C,KAAK,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;gBACjD,IAAI,KAAK,CAAC,aAAa,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;oBACzD,OAAO,IAAI,CAAC;gBACb,CAAC;YACF,CAAC;QACF,CAAC;QAED,OAAO,KAAK,CAAC;IACd,CAAC;CAED","sourcesContent":["import { Rect, Size, utils } from \"@omegagrid/core\";\nimport constants from \"../constants\";\nimport { DashboardOptions, DashboardSource } from \"../types\";\nimport { DashboardItemModel } from \"./dashboardItemModel\";\n\nexport class DashboardModel {\n\n\tprivate _options: DashboardOptions;\n\tget options() { return this._options }\n\n\tprivate _items: DashboardItemModel[] = [];\n\tget items() { return this._items }\n\n\tconstructor(source?: DashboardSource) {\n\t\tif (source) this.populate(source);\n\t}\n\n\tpopulate(source: DashboardSource) {\n\t\tthis._items = source.items.map((item, i) => new DashboardItemModel(this, i, item));\n\t\tthis._options = utils.mergeDeep(constants.DEFAULT_OPTIONS, source.options);\n\t}\n\n\tprivate _size: Size;\n\tget size() {\n\t\tif (this._size) return this._size;\n\t\tthis._size = {w: 0, h: 0};\n\t\tthis._items.forEach(item => {\n\t\t\tthis._size.w = Math.max(this._size.w, item.x + item.w);\n\t\t\tthis._size.h = Math.max(this._size.h, item.y + item.h);\n\t\t});\n\t\treturn this._size;\n\t}\n\n\tgetSourceData(): DashboardSource {\n\t\treturn {\n\t\t\titems: this._items.map(item => item.getSourceData()),\n\t\t\toptions: this._options\n\t\t};\n\t}\n\n\tupdatePositions(positions: Rect[]) {\n\t\tthis._size = {w: 0, h: 0};\n\t\tthis._items.forEach((item, i) => {\n\t\t\tif (positions[i]) {\n\t\t\t\titem.x = positions[i].x;\n\t\t\t\titem.y = positions[i].y;\n\t\t\t\titem.w = positions[i].w;\n\t\t\t\titem.h = positions[i].h;\n\t\t\t}\n\t\t\tthis._size.w = Math.max(this._size.w, item.x + item.w);\n\t\t\tthis._size.h = Math.max(this._size.h, item.y + item.h);\n\t\t});\n\t}\n\n\tcalculatePositions(movingItem: DashboardItemModel, rect: Rect) {\n\t\tconst newPositions: Rect[] = new Array(this._items.length);\n\t\tconst columns = this._options.columns || Infinity;\n\t\tconst rows = this._options.rows || Infinity;\n\t\tconst orientation = this._options.orientation;\n\n\t\t// Set the position for the moving item with boundary constraints\n\t\tconst movingIndex = this._items.indexOf(movingItem);\n\t\tif (movingIndex !== -1) {\n\t\t\tnewPositions[movingIndex] = { \n\t\t\t\tx: Math.max(0, rect.x), \n\t\t\t\ty: Math.max(0, rect.y), \n\t\t\t\tw: orientation == 'vertical' ? Math.min(rect.w, columns - Math.max(0, rect.x)) : rect.w,\n\t\t\t\th: orientation == 'horizontal' ? Math.min(rect.h, rows - Math.max(0, rect.y)) : rect.h\n\t\t\t};\n\t\t}\n\t\t\n\t\t// First pass: identify collisions and set initial positions\n\t\tthis._items.forEach((item, i) => {\n\t\t\tif (i !== movingIndex) {\n\t\t\t\tnewPositions[i] = { x: item.x, y: item.y, w: item.w, h: item.h };\n\t\t\t}\n\t\t});\n\t\t\n\t\t// Resolve collisions recursively\n\t\tconst processedItems = new Set<number>();\n\t\tprocessedItems.add(movingIndex);\n\t\t\n\t\tconst resolveCollisions = (itemIndex: number) => {\n\t\t\tconst itemRect = newPositions[itemIndex];\n\t\t\t\n\t\t\tfor (let i = 0; i < this._items.length; i++) {\n\t\t\t\t// Skip if it's the same item or already processed in this recursive call\n\t\t\t\tif (i === itemIndex || processedItems.has(i)) continue;\n\t\t\t\t\n\t\t\t\tconst otherRect = newPositions[i];\n\t\t\t\tconst intersection = utils.rectIntersect(itemRect, otherRect);\n\t\t\t\t\n\t\t\t\tif (intersection) {\n\t\t\t\t\t// Calculate distances to move in each direction\n\t\t\t\t\tconst moveDown = itemRect.y + itemRect.h - otherRect.y;\n\t\t\t\t\tconst moveRight = itemRect.x + itemRect.w - otherRect.x;\n\t\t\t\t\tconst moveUp = otherRect.y + otherRect.h - itemRect.y;\n\t\t\t\t\tconst moveLeft = otherRect.x + otherRect.w - itemRect.x;\n\t\t\t\t\t\n\t\t\t\t\tif (orientation === 'vertical') {\n\t\t\t\t\t\t// In vertical orientation, prioritize downward movement\n\t\t\t\t\t\tif (moveDown <= moveUp && moveDown <= moveRight && moveDown <= moveLeft) {\n\t\t\t\t\t\t\totherRect.y = Math.max(0, itemRect.y + itemRect.h);\n\t\t\t\t\t\t} else if (moveUp <= moveRight && moveUp <= moveLeft && itemRect.y - otherRect.h >= 0) {\n\t\t\t\t\t\t\totherRect.y = Math.max(0, itemRect.y - otherRect.h);\n\t\t\t\t\t\t} else if (moveRight <= moveLeft && itemRect.x + itemRect.w + otherRect.w <= columns) {\n\t\t\t\t\t\t\totherRect.x = Math.min(columns - otherRect.w, itemRect.x + itemRect.w);\n\t\t\t\t\t\t} else if (itemRect.x - otherRect.w >= 0) {\n\t\t\t\t\t\t\totherRect.x = Math.max(0, itemRect.x - otherRect.w);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t// Default to moving down if other directions would cause boundary violations\n\t\t\t\t\t\t\totherRect.y = Math.max(0, itemRect.y + itemRect.h);\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t\t// Ensure width doesn't exceed container\n\t\t\t\t\t\tif (otherRect.x + otherRect.w > columns) {\n\t\t\t\t\t\t\totherRect.w = Math.max(1, columns - otherRect.x);\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// In horizontal orientation, prioritize rightward movement\n\t\t\t\t\t\tif (moveRight <= moveUp && moveRight <= moveDown && moveRight <= moveLeft) {\n\t\t\t\t\t\t\totherRect.x = Math.max(0, itemRect.x + itemRect.w);\n\t\t\t\t\t\t} else if (moveLeft <= moveUp && moveLeft <= moveDown && itemRect.x - otherRect.w >= 0) {\n\t\t\t\t\t\t\totherRect.x = Math.max(0, itemRect.x - otherRect.w);\n\t\t\t\t\t\t} else if (moveDown <= moveUp && itemRect.y + itemRect.h + otherRect.h <= rows) {\n\t\t\t\t\t\t\totherRect.y = Math.min(rows - otherRect.h, itemRect.y + itemRect.h);\n\t\t\t\t\t\t} else if (itemRect.y - otherRect.h >= 0) {\n\t\t\t\t\t\t\totherRect.y = Math.max(0, itemRect.y - otherRect.h);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t// Default to moving right if other directions would cause boundary violations\n\t\t\t\t\t\t\totherRect.x = Math.max(0, itemRect.x + itemRect.w);\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t\t// Ensure height doesn't exceed container\n\t\t\t\t\t\tif (otherRect.y + otherRect.h > rows) {\n\t\t\t\t\t\t\totherRect.h = Math.max(1, rows - otherRect.y);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\t// Mark this item as processed in the current recursive call\n\t\t\t\t\tprocessedItems.add(i);\n\t\t\t\t\t\n\t\t\t\t\t// Recursively resolve any new collisions this movement might have caused\n\t\t\t\t\tresolveCollisions(i);\n\t\t\t\t\t\n\t\t\t\t\t// Remove from processed set after recursion to allow for future collision checks\n\t\t\t\t\tprocessedItems.delete(i);\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\t\t\n\t\t// Start resolving collisions from the moving item\n\t\tresolveCollisions(movingIndex);\n\t\t\n\t\t// Final pass to ensure all items are within bounds\n\t\tfor (let i = 0; i < newPositions.length; i++) {\n\t\t\tif (newPositions[i]) {\n\t\t\t\tnewPositions[i].x = Math.max(0, newPositions[i].x);\n\t\t\t\tnewPositions[i].y = Math.max(0, newPositions[i].y);\n\t\t\t\t\n\t\t\t\t// Apply container constraints based on orientation\n\t\t\t\tif (orientation === 'vertical') {\n\t\t\t\t\tif (newPositions[i].x + newPositions[i].w > columns) {\n\t\t\t\t\t\tnewPositions[i].w = Math.max(1, columns - newPositions[i].x);\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tif (newPositions[i].y + newPositions[i].h > rows) {\n\t\t\t\t\t\tnewPositions[i].h = Math.max(1, rows - newPositions[i].y);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\treturn newPositions;\n\t}\n\n\t/**\n\t * Detects and fixes collisions between dashboard items\n\t * Applies collision fixes directly to the dashboard items\n\t */\n\tdetectAndFixCollisions(): void {\n\t\tconst columns = this._options.columns || Infinity;\n\t\tconst rows = this._options.rows || Infinity;\n\t\tconst orientation = this._options.orientation;\n\t\tconst processedItems = new Set<number>();\n\n\t\tconst resolveCollisions = (itemIndex: number) => {\n\t\t\tif (processedItems.has(itemIndex)) return;\n\t\t\t\n\t\t\tconst itemRect = this._items[itemIndex];\n\t\t\tif (!itemRect) return;\n\n\t\t\tfor (let i = 0; i < this._items.length; i++) {\n\t\t\t\tif (i === itemIndex) continue;\n\n\t\t\t\tconst otherRect = this._items[i];\n\t\t\t\tconst intersection = utils.rectIntersect(itemRect, otherRect);\n\n\t\t\t\tif (intersection) {\n\t\t\t\t\t// Calculate distances to move in each direction\n\t\t\t\t\tconst moveDown = itemRect.y + itemRect.h - otherRect.y;\n\t\t\t\t\tconst moveRight = itemRect.x + itemRect.w - otherRect.x;\n\t\t\t\t\tconst moveUp = otherRect.y + otherRect.h - itemRect.y;\n\t\t\t\t\tconst moveLeft = otherRect.x + otherRect.w - itemRect.x;\n\n\t\t\t\t\t// Choose movement direction based on orientation and smallest displacement\n\t\t\t\t\tif (orientation === 'vertical') {\n\t\t\t\t\t\tif (moveDown <= moveUp && moveDown <= moveRight && moveDown <= moveLeft) {\n\t\t\t\t\t\t\totherRect.y = Math.max(0, itemRect.y + itemRect.h);\n\t\t\t\t\t\t} else if (moveUp <= moveRight && moveUp <= moveLeft && itemRect.y - otherRect.h >= 0) {\n\t\t\t\t\t\t\totherRect.y = Math.max(0, itemRect.y - otherRect.h);\n\t\t\t\t\t\t} else if (moveRight <= moveLeft && itemRect.x + itemRect.w + otherRect.w <= columns) {\n\t\t\t\t\t\t\totherRect.x = Math.min(columns - otherRect.w, itemRect.x + itemRect.w);\n\t\t\t\t\t\t} else if (itemRect.x - otherRect.w >= 0) {\n\t\t\t\t\t\t\totherRect.x = Math.max(0, itemRect.x - otherRect.w);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\totherRect.y = Math.max(0, itemRect.y + itemRect.h);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// Ensure width doesn't exceed container\n\t\t\t\t\t\tif (otherRect.x + otherRect.w > columns) {\n\t\t\t\t\t\t\totherRect.w = Math.max(1, columns - otherRect.x);\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// Horizontal orientation\n\t\t\t\t\t\tif (moveRight <= moveUp && moveRight <= moveDown && moveRight <= moveLeft) {\n\t\t\t\t\t\t\totherRect.x = Math.max(0, itemRect.x + itemRect.w);\n\t\t\t\t\t\t} else if (moveLeft <= moveUp && moveLeft <= moveDown && itemRect.x - otherRect.w >= 0) {\n\t\t\t\t\t\t\totherRect.x = Math.max(0, itemRect.x - otherRect.w);\n\t\t\t\t\t\t} else if (moveDown <= moveUp && itemRect.y + itemRect.h + otherRect.h <= rows) {\n\t\t\t\t\t\t\totherRect.y = Math.min(rows - otherRect.h, itemRect.y + itemRect.h);\n\t\t\t\t\t\t} else if (itemRect.y - otherRect.h >= 0) {\n\t\t\t\t\t\t\totherRect.y = Math.max(0, itemRect.y - otherRect.h);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\totherRect.x = Math.max(0, itemRect.x + itemRect.w);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// Ensure height doesn't exceed container\n\t\t\t\t\t\tif (otherRect.y + otherRect.h > rows) {\n\t\t\t\t\t\t\totherRect.h = Math.max(1, rows - otherRect.y);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\t// Recursively resolve new collisions\n\t\t\t\t\tresolveCollisions(i);\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\n\t\t// Process all items to resolve collisions\n\t\tfor (let i = 0; i < this._items.length; i++) {\n\t\t\tif (!processedItems.has(i)) {\n\t\t\t\tresolveCollisions(i);\n\t\t\t\tprocessedItems.add(i);\n\t\t\t}\n\t\t}\n\n\t\t// Final pass to ensure all items are within bounds\n\t\tfor (let i = 0; i < this._items.length; i++) {\n\t\t\tconst item = this._items[i];\n\t\t\titem.x = Math.max(0, item.x);\n\t\t\titem.y = Math.max(0, item.y);\n\n\t\t\t// Apply container constraints based on orientation\n\t\t\tif (orientation === 'vertical') {\n\t\t\t\tif (item.x + item.w > columns) {\n\t\t\t\t\titem.w = Math.max(1, columns - item.x);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif (item.y + item.h > rows) {\n\t\t\t\t\titem.h = Math.max(1, rows - item.y);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Clear cached size since positions have changed\n\t\tthis._size = null;\n\t}\n\n\t/**\n\t * Detects if there are any collisions between dashboard items\n\t * @returns True if collisions are detected, false otherwise\n\t */\n\thasCollisions(): boolean {\n\t\tfor (let i = 0; i < this._items.length; i++) {\n\t\t\tfor (let j = i + 1; j < this._items.length; j++) {\n\t\t\t\tif (utils.rectIntersect(this._items[i], this._items[j])) {\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\treturn false;\n\t}\n\n}"]}
1
+ {"version":3,"file":"dashboardModel.js","sourceRoot":"","sources":["../../src/model/dashboardModel.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,KAAK,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,SAAS,MAAM,cAAc,CAAC;AAErC,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE1D,MAAM,OAAO,cAAc;IAG1B,IAAI,OAAO,KAAK,OAAO,IAAI,CAAC,QAAQ,CAAA,CAAC,CAAC;IAGtC,IAAI,KAAK,KAAK,OAAO,IAAI,CAAC,MAAM,CAAA,CAAC,CAAC;IAElC,YAAY,MAAwB;QAH5B,WAAM,GAAyB,EAAE,CAAC;QAIzC,IAAI,MAAM;YAAE,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IACnC,CAAC;IAED,QAAQ,CAAC,MAAuB;QAC/B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC,EAAE,EAAE,CAAC,IAAI,kBAAkB,CAAC,IAAI,EAAE,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC;QACnF,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC,SAAS,CAAC,SAAS,CAAC,eAAe,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC;IAC5E,CAAC;IAGD,IAAI,IAAI;QACP,IAAI,IAAI,CAAC,KAAK;YAAE,OAAO,IAAI,CAAC,KAAK,CAAC;QAClC,IAAI,CAAC,KAAK,GAAG,EAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAC,CAAC;QAC1B,IA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E,OAAO,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;gBACxC,CAAC;YACF,CAAC;iBAAM,CAAC;gBACP,IAAI,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,GAAG,IAAI,EAAE,CAAC;oBAC5B,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;gBACrC,CAAC;YACF,CAAC;QACF,CAAC;QAED,iDAAiD;QACjD,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;IACnB,CAAC;IAED;;;OAGG;IACH,aAAa;QACZ,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;YAC7C,KAAK,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;gBACjD,IAAI,KAAK,CAAC,aAAa,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;oBACzD,OAAO,IAAI,CAAC;gBACb,CAAC;YACF,CAAC;QACF,CAAC;QAED,OAAO,KAAK,CAAC;IACd,CAAC;CAED","sourcesContent":["import { Rect, Size, utils } from \"@omegagrid/core\";\nimport constants from \"../constants\";\nimport { DashboardOptions, DashboardSource } from \"../types\";\nimport { DashboardItemModel } from \"./dashboardItemModel\";\n\nexport class DashboardModel {\n\n\tprivate _options: DashboardOptions;\n\tget options() { return this._options }\n\n\tprivate _items: DashboardItemModel[] = [];\n\tget items() { return this._items }\n\n\tconstructor(source?: DashboardSource) {\n\t\tif (source) this.populate(source);\n\t}\n\n\tpopulate(source: DashboardSource) {\n\t\tthis._items = source.items.map((item, i) => new DashboardItemModel(this, i, item));\n\t\tthis._options = utils.mergeDeep(constants.DEFAULT_OPTIONS, source.options);\n\t}\n\n\tprivate _size: Size;\n\tget size() {\n\t\tif (this._size) return this._size;\n\t\tthis._size = {w: 0, h: 0};\n\t\tthis._items.forEach(item => {\n\t\t\tthis._size.w = Math.max(this._size.w, item.x + item.w);\n\t\t\tthis._size.h = Math.max(this._size.h, item.y + item.h);\n\t\t});\n\t\treturn this._size;\n\t}\n\n\tgetSourceData(): DashboardSource {\n\t\treturn {\n\t\t\titems: this._items.map(item => item.getSourceData()),\n\t\t\toptions: this._options\n\t\t};\n\t}\n\n\tupdatePositions(positions: Rect[]) {\n\t\tthis._size = {w: 0, h: 0};\n\t\tthis._items.forEach((item, i) => {\n\t\t\tif (positions[i]) {\n\t\t\t\titem.x = positions[i].x;\n\t\t\t\titem.y = positions[i].y;\n\t\t\t\titem.w = positions[i].w;\n\t\t\t\titem.h = positions[i].h;\n\t\t\t}\n\t\t\tthis._size.w = Math.max(this._size.w, item.x + item.w);\n\t\t\tthis._size.h = Math.max(this._size.h, item.y + item.h);\n\t\t});\n\t}\n\n\t/**\n\t * Positions of the items outside design mode (index aligned with items,\n\t * null for hidden items). With the autoCompact option the space left by\n\t * hidden items is taken by the visible ones: they move into it towards the start of the cross axis\n\t * first (left in vertical orientation), then along the scroll axis, as long\n\t * as the cells they enter were freed by a hidden or moved item. Gaps left\n\t * in the layout on purpose are kept. The item model positions do not change.\n\t */\n\tgetViewPositions(): Rect[] {\n\t\tconst positions: Rect[] = this._items.map(item => item.hidden ? null : {x: item.x, y: item.y, w: item.w, h: item.h});\n\t\tif (!this._options.autoCompact || !this._items.some(item => item.hidden)) return positions;\n\n\t\tconst key = (x: number, y: number) => `${x}:${y}`;\n\t\tconst occupied = new Set<string>();\n\t\tconst freed = new Set<string>();\n\t\tconst cells = (rect: Rect, fn: (cell: string) => void) => {\n\t\t\tfor (let x = rect.x; x < rect.x + rect.w; x++) {\n\t\t\t\tfor (let y = rect.y; y < rect.y + rect.h; y++) fn(key(x, y));\n\t\t\t}\n\t\t};\n\t\tthis._items.forEach((item, i) => cells(item, cell => (positions[i] ? occupied : freed).add(cell)));\n\n\t\t// one step of the rect in the given direction, the entered cells must be freed and empty\n\t\tconst move = (rect: Rect, dx: number, dy: number) => {\n\t\t\tconst target = {...rect, x: rect.x + dx, y: rect.y + dy};\n\t\t\tif (target.x < 0 || target.y < 0) return false;\n\t\t\tconst entered: string[] = [];\n\t\t\tcells(target, cell => entered.push(cell));\n\t\t\tconst own = new Set<string>();\n\t\t\tcells(rect, cell => own.add(cell));\n\t\t\tif (entered.some(cell => !own.has(cell) && (occupied.has(cell) || !freed.has(cell)))) return false;\n\n\t\t\town.forEach(cell => {\n\t\t\t\toccupied.delete(cell);\n\t\t\t\tfreed.add(cell);\n\t\t\t});\n\t\t\tentered.forEach(cell => occupied.add(cell));\n\t\t\tObject.assign(rect, target);\n\t\t\treturn true;\n\t\t};\n\n\t\tconst vertical = this._options.orientation !== 'horizontal';\n\t\tconst steps: [number, number][] = vertical ? [[-1, 0], [0, -1]] : [[0, -1], [-1, 0]];\n\t\tconst visible = positions.filter(Boolean).sort((a, b) => vertical ? (a.y - b.y || a.x - b.x) : (a.x - b.x || a.y - b.y));\n\n\t\tlet changed = true;\n\t\twhile (changed) {\n\t\t\tchanged = false;\n\t\t\tvisible.forEach(rect => steps.forEach(([dx, dy]) => {\n\t\t\t\twhile (move(rect, dx, dy)) changed = true;\n\t\t\t}));\n\t\t}\n\n\t\treturn positions;\n\t}\n\n\tcalculatePositions(movingItem: DashboardItemModel, rect: Rect) {\n\t\tconst newPositions: Rect[] = new Array(this._items.length);\n\t\tconst columns = this._options.columns || Infinity;\n\t\tconst rows = this._options.rows || Infinity;\n\t\tconst orientation = this._options.orientation;\n\n\t\t// Set the position for the moving item with boundary constraints\n\t\tconst movingIndex = this._items.indexOf(movingItem);\n\t\tif (movingIndex !== -1) {\n\t\t\tnewPositions[movingIndex] = { \n\t\t\t\tx: Math.max(0, rect.x), \n\t\t\t\ty: Math.max(0, rect.y), \n\t\t\t\tw: orientation == 'vertical' ? Math.min(rect.w, columns - Math.max(0, rect.x)) : rect.w,\n\t\t\t\th: orientation == 'horizontal' ? Math.min(rect.h, rows - Math.max(0, rect.y)) : rect.h\n\t\t\t};\n\t\t}\n\t\t\n\t\t// First pass: identify collisions and set initial positions\n\t\tthis._items.forEach((item, i) => {\n\t\t\tif (i !== movingIndex) {\n\t\t\t\tnewPositions[i] = { x: item.x, y: item.y, w: item.w, h: item.h };\n\t\t\t}\n\t\t});\n\t\t\n\t\t// Resolve collisions recursively\n\t\tconst processedItems = new Set<number>();\n\t\tprocessedItems.add(movingIndex);\n\t\t\n\t\tconst resolveCollisions = (itemIndex: number) => {\n\t\t\tconst itemRect = newPositions[itemIndex];\n\t\t\t\n\t\t\tfor (let i = 0; i < this._items.length; i++) {\n\t\t\t\t// Skip if it's the same item or already processed in this recursive call\n\t\t\t\tif (i === itemIndex || processedItems.has(i)) continue;\n\t\t\t\t\n\t\t\t\tconst otherRect = newPositions[i];\n\t\t\t\tconst intersection = utils.rectIntersect(itemRect, otherRect);\n\t\t\t\t\n\t\t\t\tif (intersection) {\n\t\t\t\t\t// Calculate distances to move in each direction\n\t\t\t\t\tconst moveDown = itemRect.y + itemRect.h - otherRect.y;\n\t\t\t\t\tconst moveRight = itemRect.x + itemRect.w - otherRect.x;\n\t\t\t\t\tconst moveUp = otherRect.y + otherRect.h - itemRect.y;\n\t\t\t\t\tconst moveLeft = otherRect.x + otherRect.w - itemRect.x;\n\t\t\t\t\t\n\t\t\t\t\tif (orientation === 'vertical') {\n\t\t\t\t\t\t// In vertical orientation, prioritize downward movement\n\t\t\t\t\t\tif (moveDown <= moveUp && moveDown <= moveRight && moveDown <= moveLeft) {\n\t\t\t\t\t\t\totherRect.y = Math.max(0, itemRect.y + itemRect.h);\n\t\t\t\t\t\t} else if (moveUp <= moveRight && moveUp <= moveLeft && itemRect.y - otherRect.h >= 0) {\n\t\t\t\t\t\t\totherRect.y = Math.max(0, itemRect.y - otherRect.h);\n\t\t\t\t\t\t} else if (moveRight <= moveLeft && itemRect.x + itemRect.w + otherRect.w <= columns) {\n\t\t\t\t\t\t\totherRect.x = Math.min(columns - otherRect.w, itemRect.x + itemRect.w);\n\t\t\t\t\t\t} else if (itemRect.x - otherRect.w >= 0) {\n\t\t\t\t\t\t\totherRect.x = Math.max(0, itemRect.x - otherRect.w);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t// Default to moving down if other directions would cause boundary violations\n\t\t\t\t\t\t\totherRect.y = Math.max(0, itemRect.y + itemRect.h);\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t\t// Ensure width doesn't exceed container\n\t\t\t\t\t\tif (otherRect.x + otherRect.w > columns) {\n\t\t\t\t\t\t\totherRect.w = Math.max(1, columns - otherRect.x);\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// In horizontal orientation, prioritize rightward movement\n\t\t\t\t\t\tif (moveRight <= moveUp && moveRight <= moveDown && moveRight <= moveLeft) {\n\t\t\t\t\t\t\totherRect.x = Math.max(0, itemRect.x + itemRect.w);\n\t\t\t\t\t\t} else if (moveLeft <= moveUp && moveLeft <= moveDown && itemRect.x - otherRect.w >= 0) {\n\t\t\t\t\t\t\totherRect.x = Math.max(0, itemRect.x - otherRect.w);\n\t\t\t\t\t\t} else if (moveDown <= moveUp && itemRect.y + itemRect.h + otherRect.h <= rows) {\n\t\t\t\t\t\t\totherRect.y = Math.min(rows - otherRect.h, itemRect.y + itemRect.h);\n\t\t\t\t\t\t} else if (itemRect.y - otherRect.h >= 0) {\n\t\t\t\t\t\t\totherRect.y = Math.max(0, itemRect.y - otherRect.h);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t// Default to moving right if other directions would cause boundary violations\n\t\t\t\t\t\t\totherRect.x = Math.max(0, itemRect.x + itemRect.w);\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t\t// Ensure height doesn't exceed container\n\t\t\t\t\t\tif (otherRect.y + otherRect.h > rows) {\n\t\t\t\t\t\t\totherRect.h = Math.max(1, rows - otherRect.y);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\t// Mark this item as processed in the current recursive call\n\t\t\t\t\tprocessedItems.add(i);\n\t\t\t\t\t\n\t\t\t\t\t// Recursively resolve any new collisions this movement might have caused\n\t\t\t\t\tresolveCollisions(i);\n\t\t\t\t\t\n\t\t\t\t\t// Remove from processed set after recursion to allow for future collision checks\n\t\t\t\t\tprocessedItems.delete(i);\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\t\t\n\t\t// Start resolving collisions from the moving item\n\t\tresolveCollisions(movingIndex);\n\t\t\n\t\t// Final pass to ensure all items are within bounds\n\t\tfor (let i = 0; i < newPositions.length; i++) {\n\t\t\tif (newPositions[i]) {\n\t\t\t\tnewPositions[i].x = Math.max(0, newPositions[i].x);\n\t\t\t\tnewPositions[i].y = Math.max(0, newPositions[i].y);\n\t\t\t\t\n\t\t\t\t// Apply container constraints based on orientation\n\t\t\t\tif (orientation === 'vertical') {\n\t\t\t\t\tif (newPositions[i].x + newPositions[i].w > columns) {\n\t\t\t\t\t\tnewPositions[i].w = Math.max(1, columns - newPositions[i].x);\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tif (newPositions[i].y + newPositions[i].h > rows) {\n\t\t\t\t\t\tnewPositions[i].h = Math.max(1, rows - newPositions[i].y);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\treturn newPositions;\n\t}\n\n\t/**\n\t * Detects and fixes collisions between dashboard items\n\t * Applies collision fixes directly to the dashboard items\n\t */\n\tdetectAndFixCollisions(): void {\n\t\tconst columns = this._options.columns || Infinity;\n\t\tconst rows = this._options.rows || Infinity;\n\t\tconst orientation = this._options.orientation;\n\t\tconst processedItems = new Set<number>();\n\n\t\tconst resolveCollisions = (itemIndex: number) => {\n\t\t\tif (processedItems.has(itemIndex)) return;\n\t\t\t\n\t\t\tconst itemRect = this._items[itemIndex];\n\t\t\tif (!itemRect) return;\n\n\t\t\tfor (let i = 0; i < this._items.length; i++) {\n\t\t\t\tif (i === itemIndex) continue;\n\n\t\t\t\tconst otherRect = this._items[i];\n\t\t\t\tconst intersection = utils.rectIntersect(itemRect, otherRect);\n\n\t\t\t\tif (intersection) {\n\t\t\t\t\t// Calculate distances to move in each direction\n\t\t\t\t\tconst moveDown = itemRect.y + itemRect.h - otherRect.y;\n\t\t\t\t\tconst moveRight = itemRect.x + itemRect.w - otherRect.x;\n\t\t\t\t\tconst moveUp = otherRect.y + otherRect.h - itemRect.y;\n\t\t\t\t\tconst moveLeft = otherRect.x + otherRect.w - itemRect.x;\n\n\t\t\t\t\t// Choose movement direction based on orientation and smallest displacement\n\t\t\t\t\tif (orientation === 'vertical') {\n\t\t\t\t\t\tif (moveDown <= moveUp && moveDown <= moveRight && moveDown <= moveLeft) {\n\t\t\t\t\t\t\totherRect.y = Math.max(0, itemRect.y + itemRect.h);\n\t\t\t\t\t\t} else if (moveUp <= moveRight && moveUp <= moveLeft && itemRect.y - otherRect.h >= 0) {\n\t\t\t\t\t\t\totherRect.y = Math.max(0, itemRect.y - otherRect.h);\n\t\t\t\t\t\t} else if (moveRight <= moveLeft && itemRect.x + itemRect.w + otherRect.w <= columns) {\n\t\t\t\t\t\t\totherRect.x = Math.min(columns - otherRect.w, itemRect.x + itemRect.w);\n\t\t\t\t\t\t} else if (itemRect.x - otherRect.w >= 0) {\n\t\t\t\t\t\t\totherRect.x = Math.max(0, itemRect.x - otherRect.w);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\totherRect.y = Math.max(0, itemRect.y + itemRect.h);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// Ensure width doesn't exceed container\n\t\t\t\t\t\tif (otherRect.x + otherRect.w > columns) {\n\t\t\t\t\t\t\totherRect.w = Math.max(1, columns - otherRect.x);\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// Horizontal orientation\n\t\t\t\t\t\tif (moveRight <= moveUp && moveRight <= moveDown && moveRight <= moveLeft) {\n\t\t\t\t\t\t\totherRect.x = Math.max(0, itemRect.x + itemRect.w);\n\t\t\t\t\t\t} else if (moveLeft <= moveUp && moveLeft <= moveDown && itemRect.x - otherRect.w >= 0) {\n\t\t\t\t\t\t\totherRect.x = Math.max(0, itemRect.x - otherRect.w);\n\t\t\t\t\t\t} else if (moveDown <= moveUp && itemRect.y + itemRect.h + otherRect.h <= rows) {\n\t\t\t\t\t\t\totherRect.y = Math.min(rows - otherRect.h, itemRect.y + itemRect.h);\n\t\t\t\t\t\t} else if (itemRect.y - otherRect.h >= 0) {\n\t\t\t\t\t\t\totherRect.y = Math.max(0, itemRect.y - otherRect.h);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\totherRect.x = Math.max(0, itemRect.x + itemRect.w);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// Ensure height doesn't exceed container\n\t\t\t\t\t\tif (otherRect.y + otherRect.h > rows) {\n\t\t\t\t\t\t\totherRect.h = Math.max(1, rows - otherRect.y);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\t// Recursively resolve new collisions\n\t\t\t\t\tresolveCollisions(i);\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\n\t\t// Process all items to resolve collisions\n\t\tfor (let i = 0; i < this._items.length; i++) {\n\t\t\tif (!processedItems.has(i)) {\n\t\t\t\tresolveCollisions(i);\n\t\t\t\tprocessedItems.add(i);\n\t\t\t}\n\t\t}\n\n\t\t// Final pass to ensure all items are within bounds\n\t\tfor (let i = 0; i < this._items.length; i++) {\n\t\t\tconst item = this._items[i];\n\t\t\titem.x = Math.max(0, item.x);\n\t\t\titem.y = Math.max(0, item.y);\n\n\t\t\t// Apply container constraints based on orientation\n\t\t\tif (orientation === 'vertical') {\n\t\t\t\tif (item.x + item.w > columns) {\n\t\t\t\t\titem.w = Math.max(1, columns - item.x);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif (item.y + item.h > rows) {\n\t\t\t\t\titem.h = Math.max(1, rows - item.y);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Clear cached size since positions have changed\n\t\tthis._size = null;\n\t}\n\n\t/**\n\t * Detects if there are any collisions between dashboard items\n\t * @returns True if collisions are detected, false otherwise\n\t */\n\thasCollisions(): boolean {\n\t\tfor (let i = 0; i < this._items.length; i++) {\n\t\t\tfor (let j = i + 1; j < this._items.length; j++) {\n\t\t\t\tif (utils.rectIntersect(this._items[i], this._items[j])) {\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\treturn false;\n\t}\n\n}"]}
package/dist/types.d.ts CHANGED
@@ -13,6 +13,11 @@ export type DashboardItemSource = {
13
13
  h?: number;
14
14
  /** title shown in design mode */
15
15
  title?: string;
16
+ /**
17
+ * Item is not displayed outside design mode, with autoCompact the space
18
+ * it leaves is taken by the other items (see DashboardModel.getViewPositions)
19
+ */
20
+ hidden?: boolean;
16
21
  };
17
22
  export type DashboardOptions = {
18
23
  /** number of columns */
@@ -27,6 +32,8 @@ export type DashboardOptions = {
27
32
  gap?: number;
28
33
  /** Orientation of dashboard */
29
34
  orientation?: 'horizontal' | 'vertical' | null;
35
+ /** Outside design mode the visible items take the space left by the hidden ones (default false) */
36
+ autoCompact?: boolean;
30
37
  overlay?: {
31
38
  /** opacity of overlay in design mode */
32
39
  opacity?: number;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAElD,MAAM,MAAM,mBAAmB,GAAG;IACjC,0BAA0B;IAC1B,EAAE,EAAE,WAAW,CAAC;IAEhB,cAAc;IACd,CAAC,EA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AAC;IAEV,cAAc;IACd,CAAC,EAAE,MAAM,CAAC;IAEV,YAAY;IACZ,CAAC,CAAC,EAAE,MAAM,CAAC;IAEX,aAAa;IACb,CAAC,CAAC,EAAE,MAAM,CAAC;IAEX,iCAAiC;IACjC,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;;OAGG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;CACjB,CAAA;AAED,MAAM,MAAM,gBAAgB,GAAG;IAC9B,wBAAwB;IACxB,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB,yBAAyB;IACzB,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB,qBAAqB;IACrB,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd,uBAAuB;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,4BAA4B;IAC5B,GAAG,CAAC,EAAE,MAAM,CAAC;IAEb,+BAA+B;IAC/B,WAAW,CAAC,EAAE,YAAY,GAAG,UAAU,GAAG,IAAI,CAAC;IAE/C,mGAAmG;IACnG,WAAW,CAAC,EAAE,OAAO,CAAC;IAEtB,OAAO,CAAC,EAAE;QACT,wCAAwC;QACxC,OAAO,CAAC,EAAE,MAAM,CAAC;QAEjB;;;;WAIG;QACH,QAAQ,CAAC,EAAE,CAAC,GAAG,EAAE,cAAc,EAAE,KAAK,EAAE,kBAAkB,KAAK,IAAI,CAAC;KACpE,CAAA;CACD,CAAA;AAED,MAAM,MAAM,eAAe,GAAG;IAC7B,sBAAsB;IACtB,KAAK,CAAC,EAAE,mBAAmB,EAAE,CAAC;IAE9B,wBAAwB;IACxB,OAAO,CAAC,EAAE,gBAAgB,CAAC;CAC3B,CAAA"}
package/dist/types.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"","sourcesContent":["import { ComponentId } from \"@omegagrid/core\";\nimport type { DashboardItemModel } from \"./model\";\n\nexport type DashboardItemSource = {\n\t/** id of the component */\n\tid: ComponentId;\n\n\t/** x coord */\n\tx: number;\n\n\t/** y coord */\n\ty: number;\n\t\n\t/** width */\n\tw?: number;\n\n\t/** height */\n\th?: number;\n\n\t/** title shown in design mode */\n\ttitle?: string;\n}\n\nexport type DashboardOptions = {\n\t/** number of columns */\n\tcolumns?: number;\n\n\t/** fixed column width */\n\tcolumnWidth?: number;\n\n\t/** number of rows */\n\trows?: number;\n\n\t/** fixed row height */\n\trowHeight?: number;\n\n\t/** The gap between items */\n\tgap?: number;\n\n\t/** Orientation of dashboard */\n\torientation?: 'horizontal' | 'vertical' | null;\n\n\toverlay?: {\n\t\t/** opacity of overlay in design mode */\n\t\topacity?: number;\n\n\t\t/**\n\t\t * Custom design mode overlay renderer. When set, a plain div is rendered\n\t\t * over the item instead of the default og-overlay and this function is\n\t\t * called to fill its content (e.g. title and item controls).\n\t\t */\n\t\trenderer?: (div: HTMLDivElement, model: DashboardItemModel) => void;\n\t}\n}\n\nexport type DashboardSource = {\n\t/** Dashboard items */\n\titems?: DashboardItemSource[];\n\n\t/** Dashboard options */\n\toptions?: DashboardOptions;\n}"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"","sourcesContent":["import { ComponentId } from \"@omegagrid/core\";\nimport type { DashboardItemModel } from \"./model\";\n\nexport type DashboardItemSource = {\n\t/** id of the component */\n\tid: ComponentId;\n\n\t/** x coord */\n\tx: number;\n\n\t/** y coord */\n\ty: number;\n\t\n\t/** width */\n\tw?: number;\n\n\t/** height */\n\th?: number;\n\n\t/** title shown in design mode */\n\ttitle?: string;\n\n\t/**\n\t * Item is not displayed outside design mode, with autoCompact the space\n\t * it leaves is taken by the other items (see DashboardModel.getViewPositions)\n\t */\n\thidden?: boolean;\n}\n\nexport type DashboardOptions = {\n\t/** number of columns */\n\tcolumns?: number;\n\n\t/** fixed column width */\n\tcolumnWidth?: number;\n\n\t/** number of rows */\n\trows?: number;\n\n\t/** fixed row height */\n\trowHeight?: number;\n\n\t/** The gap between items */\n\tgap?: number;\n\n\t/** Orientation of dashboard */\n\torientation?: 'horizontal' | 'vertical' | null;\n\n\t/** Outside design mode the visible items take the space left by the hidden ones (default false) */\n\tautoCompact?: boolean;\n\n\toverlay?: {\n\t\t/** opacity of overlay in design mode */\n\t\topacity?: number;\n\n\t\t/**\n\t\t * Custom design mode overlay renderer. When set, a plain div is rendered\n\t\t * over the item instead of the default og-overlay and this function is\n\t\t * called to fill its content (e.g. title and item controls).\n\t\t */\n\t\trenderer?: (div: HTMLDivElement, model: DashboardItemModel) => void;\n\t}\n}\n\nexport type DashboardSource = {\n\t/** Dashboard items */\n\titems?: DashboardItemSource[];\n\n\t/** Dashboard options */\n\toptions?: DashboardOptions;\n}"]}
@@ -48,6 +48,8 @@ export declare class Dashboard extends OmegaComponent implements Layout {
48
48
  setSourceData(source: DashboardSource): void;
49
49
  setItemPosition(elm: HTMLElement, rect: Rect): void;
50
50
  fixCollisions(): void;
51
+ /** items rendered in the current mode, hidden items are rendered in design mode only */
52
+ get renderedItems(): DashboardItemModel[];
51
53
  layout(): void;
52
54
  drawGrid(): Promise<void>;
53
55
  updated(): void;
@@ -1 +1 @@
1
- {"version":3,"file":"dashboard.d.ts","sourceRoot":"","sources":["../../src/ui/dashboard.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,EAAE,cAAc,EAAO,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAKvH,OAAO,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC9D,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAC3C,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD,qBAAa,cAAe,SAAQ,KAAK;IAExC,QAAQ,CAAC,IAAI,EAAE,aAAa,CAAC;IAC7B,QAAQ,CAAC,KAAK,EAAE,kBAAkB,CAAC;gBAEvB,IAAI,EAAE,M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;IAEF,OAAO,CAAC,SAAS,CAAO;IACxB,IAAI,QAAQ,SAYX;IAED,SAAS,CAAC,IAAI,EAAE,aAAa;IAO7B,WAAW,CAAC,IAAI,EAAE,aAAa;IAO/B,QAAQ;IAUR,IAAI,YAAY,WAEf;IAED,cAAc,CAAC,MAAM,EAAE,MAAM;IAI7B,cAAc,CAAC,MAAM,EAAE,MAAM;IAI7B,sBAAsB;IAOtB,aAAa,CAAC,IAAI,EAAE,IAAI;IAQxB,eAAe,CAAC,IAAI,EAAE,aAAa;IAuCnC,oBAAoB,CAAC,IAAI,EAAE,aAAa;IAsCxC,eAAe;IAiDf,cAAc;IAQd,iBAAiB;IA8CjB,WAAW,GAAI,GAAG,cAAc,UAS/B;IAED,aAAa,GAAI,GAAG,cAAc,UAUjC;;IAYD,qBAAqB,CAAC,IAAI,EAAE,IAAI,GAAI,IAAI;IAWxC,eAAe,CAAC,IAAI,EAAE,IAAI;IAK1B,eAAe;IAIf,aAAa,CAAC,MAAM,EAAE,eAAe;IAMrC,eAAe,CAAC,GAAG,EAAE,WAAW,EAAE,IAAI,EAAE,IAAI;IAM5C,aAAa;IAMb,wFAAwF;IACxF,IAAI,aAAa,yBAEhB;IAED,MAAM;IAkCA,QAAQ;IAyCd,OAAO;IAIP,MAAM,kDAgBC;CAEP"}
@@ -269,7 +269,7 @@ let Dashboard = class Dashboard extends OmegaComponent {
269
269
  ${this.noGrid ? '' : html `<canvas class="item-grid"></canvas>`}
270
270
  <div class="item-placeholder"></div>
271
271
  ` : null}
272
- ${repeat(this.model.items, item => item.id, item => html `
272
+ ${repeat(this.renderedItems, item => item.id, item => html `
273
273
  <og-dashboard-item
274
274
  ?designMode="${this.designMode}"
275
275
  .model="${item}"
@@ -319,14 +319,34 @@ let Dashboard = class Dashboard extends OmegaComponent {
319
319
  this.model.detectAndFixCollisions();
320
320
  this.layout();
321
321
  }
322
+ /** items rendered in the current mode, hidden items are rendered in design mode only */
323
+ get renderedItems() {
324
+ return this.designMode ? this.model.items : this.model.items.filter(item => !item.hidden);
325
+ }
322
326
  layout() {
323
327
  this._baseSize = null;
324
328
  if (!this.model)
325
329
  return;
326
- this.items?.forEach((item) => this.setItemPosition(item, item.model));
327
- const h = Math.max(this.model.size.h * (this.baseSize.h + this.model.options.gap) + this.model.options.gap, this.container.clientHeight);
330
+ let size = this.model.size;
331
+ if (this.designMode) {
332
+ this.items?.forEach((item) => this.setItemPosition(item, item.model));
333
+ }
334
+ else {
335
+ // hidden items are not rendered and the others take their space
336
+ const positions = this.model.getViewPositions();
337
+ size = { w: 0, h: 0 };
338
+ this.items?.forEach((item) => {
339
+ const rect = positions[item.model.index];
340
+ if (!rect)
341
+ return;
342
+ this.setItemPosition(item, rect);
343
+ size.w = Math.max(size.w, rect.x + rect.w);
344
+ size.h = Math.max(size.h, rect.y + rect.h);
345
+ });
346
+ }
347
+ const h = Math.max(size.h * (this.baseSize.h + this.model.options.gap) + this.model.options.gap, this.container.clientHeight);
328
348
  dom.setSize(this.content, {
329
- w: this.model.size.w * (this.baseSize.w + this.model.options.gap) + this.model.options.gap,
349
+ w: size.w * (this.baseSize.w + this.model.options.gap) + this.model.options.gap,
330
350
  h: h
331
351
  });
332
352
  this.items?.forEach((item) => item.layout());
@@ -1 +1 @@
1
- {"version":3,"file":"dashboard.js","sourceRoot":"","sources":["../../src/ui/dashboard.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAoB,cAAc,EAAU,cAAc,EAAE,GAAG,EAAyB,MAAM,iBAAiB,CAAC;AACvH,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAC3B,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7E,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAClD,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1C,OAAO,EAAsB,cAAc,EAAE,MAAM,UAAU,CAAC;AAI9D,M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kB,CAAC;0CACF;AAGxB;IADC,KAAK,CAAC,mBAAmB,CAAC;8CACC;AAG5B;IADC,KAAK,CAAC,YAAY,CAAC;6CACU;AA7BlB,SAAS;IADrB,aAAa,CAAC,cAAc,CAAC;GACjB,SAAS,CAwbrB","sourcesContent":["import { ComponentFactory, ComponentStore, Layout, OmegaComponent, dom, Rect, Container, Size } from '@omegagrid/core';\nimport { html } from 'lit';\nimport { customElement, property, query, queryAll } from 'lit/decorators.js';\nimport { repeat } from 'lit/directives/repeat.js';\nimport { style } from './dashboard.style';\nimport { DashboardItemModel, DashboardModel } from '../model';\nimport { DashboardSource } from '../types';\nimport { DashboardItem } from './dashboardItem';\n\nexport class DashboardEvent extends Event {\n\n\treadonly item: DashboardItem;\n\treadonly model: DashboardItemModel;\n\n\tconstructor(type: string, args: Partial<DashboardEvent>) {\n\t\tsuper(`dashboard.${type}`, {bubbles: true, composed: true});\n\t\tObject.assign(this, args);\n\t}\n}\n\n@customElement('og-dashboard')\nexport class Dashboard extends OmegaComponent implements Layout {\n\n\tstatic styles = [OmegaComponent.styles, style];\n\n\t@property({type: Object})\n\tmodel: DashboardModel;\n\n\t@property({type: Boolean, reflect: true})\n\tdesignMode = false;\n\n\t@property({type: Boolean})\n\tnoGrid = false;\n\n\t@property({type: Object})\n\tcreateComponent: ComponentFactory;\n\n\t@queryAll('og-dashboard-item')\n\titems: NodeList;\n\n\t@query('og-container')\n\tcontainer: Container;\n\n\t@query('[slot=\"content\"]')\n\tcontent: HTMLDivElement;\n\n\t@query('.item-placeholder')\n\tplaceholder: HTMLDivElement;\n\n\t@query('.item-grid')\n\tgridCanvas: HTMLCanvasElement;\n\n\tprivate _currentItem: DashboardItem;\n\tprivate _previewPositions: Rect[];\n\tprivate _autoScrollInterval: number = null;\n\tprivate _autoScrollSpeed = { x: 0, y: 0 };\n\tprivate _isResizing = false;\n\n\treadonly components = new ComponentStore<HTMLElement & Layout>(\n\t\tid => this.createComponent ? this.createComponent(id) as HTMLElement & Layout : null\n\t);\n\n\tprivate _baseSize: Size;\n\tget baseSize() {\n\t\tif (this._baseSize) return this._baseSize;\n\t\tconst { columns, columnWidth, rows, rowHeight, gap } = this.model.options;\n\n\t\tthis._baseSize = {\n\t\t\tw: columnWidth || (columns ? (this.container.clientWidth - ((columns + 1) * gap)) / columns : null),\n\t\t\th: rowHeight || (rows ? (this.container.clientHeight - ((rows + 1) * gap)) / rows : null),\n\t\t};\n\n\t\tif (this._baseSize.w == null) this._baseSize.w = this._baseSize.h;\n\t\tif (this._baseSize.h == null) this._baseSize.h = this._baseSize.w;\n\t\treturn this._baseSize;\n\t}\n\n\tstartMove(item: DashboardItem) {\n\t\tthis._currentItem = item;\n\t\tthis._currentItem.classList.toggle('active', true);\n\t\tthis.classList.toggle('moving', true);\n\t\tthis._isResizing = false;\n\t}\n\n\tstartResize(item: DashboardItem) {\n\t\tthis._currentItem = item;\n\t\tthis._currentItem.classList.toggle('active', true);\n\t\tthis.classList.toggle('moving', true);\n\t\tthis._isResizing = true;\n\t}\n\n\tstopMove() {\n\t\tif (!this._currentItem) return;\n\t\tthis._currentItem.classList.toggle('active', false);\n\t\tthis._currentItem = null;\n\t\tthis.classList.toggle('moving', false);\n\t\tthis.hidePlaceholder();\n\t\tthis.updatePreviewPositions();\n\t\tthis.stopAutoScroll();\n\t}\n\n\tget scrollOffset() {\n\t\treturn this.container?.verticalSlider?.value || 0;\n\t}\n\n\toffsetToXCoord(offset: number) {\n\t\treturn Math.max(0, Math.floor(offset / (this.baseSize.w + this.model.options.gap)));\n\t}\n\n\toffsetToYCoord(offset: number) {\n\t\treturn Math.max(0, Math.floor(offset / (this.baseSize.h + this.model.options.gap)));\n\t}\n\n\tupdatePreviewPositions() {\n\t\tif (!this._previewPositions) return;\n\t\tthis.model.updatePositions(this._previewPositions);\n\t\tthis._previewPositions = null;\n\t\tthis.layout();\n\t}\n\n\tpreviewLayout(rect: Rect) {\n\t\tthis._previewPositions = this.model.calculatePositions(this._currentItem.model, rect);\n\t\tthis._previewPositions.forEach((rect, i) => {\n\t\t\tconst item = this.items[i] as DashboardItem;\n\t\t\tif (item && item != this._currentItem) this.setItemPosition(item, rect);\n\t\t});\n\t}\n\n\tcheckAutoScroll(item: DashboardItem) {\n\t\tif (!this.container) return;\n\n\t\t// For resize, also expand content area preemptively so there's space to scroll into\n\t\tif (this._isResizing) {\n\t\t\tthis.checkResizeExpansion(item);\n\t\t}\n\n\t\tconst threshold = 50; // pixels from edge to trigger scroll\n\t\tconst scrollSpeed = 5; // pixels per frame\n\t\tconst containerRect = this.container.getBoundingClientRect();\n\t\tconst itemRect = item.getBoundingClientRect();\n\n\t\tlet scrollX = 0;\n\t\tlet scrollY = 0;\n\n\t\t// Check horizontal scrolling\n\t\tif (itemRect.right > containerRect.right - threshold) {\n\t\t\tscrollX = scrollSpeed;\n\t\t} else if (itemRect.left < containerRect.left + threshold) {\n\t\t\tscrollX = -scrollSpeed;\n\t\t}\n\n\t\t// Check vertical scrolling\n\t\tif (itemRect.bottom > containerRect.bottom - threshold) {\n\t\t\tscrollY = scrollSpeed;\n\t\t} else if (itemRect.top < containerRect.top + threshold) {\n\t\t\tscrollY = -scrollSpeed;\n\t\t}\n\n\t\tthis._autoScrollSpeed = { x: scrollX, y: scrollY };\n\n\t\tif ((scrollX !== 0 || scrollY !== 0) && !this._autoScrollInterval) {\n\t\t\tthis.startAutoScroll();\n\t\t} else if (scrollX === 0 && scrollY === 0 && this._autoScrollInterval) {\n\t\t\tthis.stopAutoScroll();\n\t\t}\n\t}\n\n\tcheckResizeExpansion(item: DashboardItem) {\n\t\tif (!this.container || !this.model) return;\n\n\t\tconst baseSize = this.baseSize;\n\t\tconst gap = this.model.options.gap;\n\n\t\t// Item edges in content coordinates - offsetTop is already content-relative\n\t\tconst itemBottom = item.offsetTop + item.offsetHeight;\n\t\tconst itemRight = item.offsetLeft + item.offsetWidth;\n\t\tconst currentContentHeight = this.content.offsetHeight;\n\t\tconst currentContentWidth = this.content.offsetWidth;\n\n\t\t// Threshold: expand when item is within 1 grid cell of the content edge\n\t\tconst thresholdY = baseSize.h + gap;\n\t\tconst thresholdX = baseSize.w + gap;\n\n\t\tlet newHeight = currentContentHeight;\n\t\tlet newWidth = currentContentWidth;\n\t\tlet needsUpdate = false;\n\n\t\tif (itemBottom > currentContentHeight - thresholdY) {\n\t\t\tnewHeight = currentContentHeight + 5 * (baseSize.h + gap);\n\t\t\tneedsUpdate = true;\n\t\t}\n\n\t\tif (itemRight > currentContentWidth - thresholdX) {\n\t\t\tnewWidth = currentContentWidth + 5 * (baseSize.w + gap);\n\t\t\tneedsUpdate = true;\n\t\t}\n\n\t\tif (needsUpdate) {\n\t\t\tdom.setSize(this.content, { w: newWidth, h: newHeight });\n\t\t\tthis.model.size.w = Math.max(this.model.size.w, Math.ceil((newWidth - gap) / (baseSize.w + gap)));\n\t\t\tthis.model.size.h = Math.max(this.model.size.h, Math.ceil((newHeight - gap) / (baseSize.h + gap)));\n\t\t\tthis.drawGrid();\n\t\t}\n\t}\n\n\tstartAutoScroll() {\n\t\tif (this._autoScrollInterval) return;\n\n\t\tthis._autoScrollInterval = window.setInterval(() => {\n\t\t\tif (!this.container) return;\n\n\t\t\tconst { x, y } = this._autoScrollSpeed;\n\n\t\t\t// Scroll vertically\n\t\t\tif (y !== 0 && this.container.verticalSlider) {\n\t\t\t\tconst currentScroll = this.container.verticalSlider.value;\n\t\t\t\tconst maxScroll = this.container.verticalSlider.maxValue;\n\n\t\t\t\t// Expand content area if scrolling down near the bottom\n\t\t\t\tif (y > 0 && currentScroll >= maxScroll * 0.85) {\n\t\t\t\t\tthis.expandContentArea();\n\t\t\t\t\t// After expanding, continue scrolling\n\t\t\t\t\tconst newMaxScroll = this.container.verticalSlider.maxValue;\n\t\t\t\t\tthis.container.scrollVerticalTo(Math.min(newMaxScroll, currentScroll + y));\n\t\t\t\t} else {\n\t\t\t\t\tconst newScroll = Math.max(0, Math.min(maxScroll, currentScroll + y));\n\t\t\t\t\tthis.container.scrollVerticalTo(newScroll);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Scroll horizontally\n\t\t\tif (x !== 0 && this.container.horizontalSlider) {\n\t\t\t\tconst currentScroll = this.container.horizontalSlider.value;\n\t\t\t\tconst maxScroll = this.container.horizontalSlider.maxValue;\n\n\t\t\t\t// Expand content area if scrolling right near the edge\n\t\t\t\tif (x > 0 && currentScroll >= maxScroll * 0.85) {\n\t\t\t\t\tthis.expandContentArea();\n\t\t\t\t\t// After expanding, continue scrolling\n\t\t\t\t\tconst newMaxScroll = this.container.horizontalSlider.maxValue;\n\t\t\t\t\tthis.container.scrollHorizontalTo(Math.min(newMaxScroll, currentScroll + x));\n\t\t\t\t} else {\n\t\t\t\t\tconst newScroll = Math.max(0, Math.min(maxScroll, currentScroll + x));\n\t\t\t\t\tthis.container.scrollHorizontalTo(newScroll);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// During resize, update item size with new scroll offset so placeholder follows smoothly\n\t\t\tif (this._isResizing && this._currentItem) {\n\t\t\t\tthis._currentItem.updateResize();\n\t\t\t}\n\t\t}, 16); // ~60fps\n\t}\n\n\tstopAutoScroll() {\n\t\tif (this._autoScrollInterval) {\n\t\t\twindow.clearInterval(this._autoScrollInterval);\n\t\t\tthis._autoScrollInterval = null;\n\t\t}\n\t\tthis._autoScrollSpeed = { x: 0, y: 0 };\n\t}\n\n\texpandContentArea() {\n\t\tif (!this.model || !this._currentItem) return;\n\n\t\t// Calculate how much space we need based on current item position\n\t\tconst topOffset = this.scrollOffset;\n\t\tconst itemBottom = this._currentItem.offsetTop + this._currentItem.offsetHeight + topOffset;\n\t\tconst itemRight = this._currentItem.offsetLeft + this._currentItem.offsetWidth;\n\n\t\tconst currentContentHeight = this.content.offsetHeight;\n\t\tconst currentContentWidth = this.content.offsetWidth;\n\n\t\t// Expand by 2 grid cells if needed\n\t\tconst expandRows = 2;\n\t\tconst expandCols = 2;\n\t\tconst baseSize = this.baseSize;\n\t\tconst gap = this.model.options.gap;\n\n\t\tlet newHeight = currentContentHeight;\n\t\tlet newWidth = currentContentWidth;\n\n\t\t// Check if we need more height - only expand, never shrink\n\t\tif (itemBottom > currentContentHeight - gap * 2) {\n\t\t\tnewHeight = Math.max(currentContentHeight, currentContentHeight + expandRows * (baseSize.h + gap));\n\t\t}\n\n\t\t// Check if we need more width - only expand, never shrink\n\t\tif (itemRight > currentContentWidth - gap * 2) {\n\t\t\tnewWidth = Math.max(currentContentWidth, currentContentWidth + expandCols * (baseSize.w + gap));\n\t\t}\n\n\t\t// Only update if size actually changed\n\t\tif (newHeight !== currentContentHeight || newWidth !== currentContentWidth) {\n\t\t\tdom.setSize(this.content, { w: newWidth, h: newHeight });\n\n\t\t\t// Update model size to match new content dimensions\n\t\t\tconst newModelWidth = Math.ceil((newWidth - gap) / (baseSize.w + gap));\n\t\t\tconst newModelHeight = Math.ceil((newHeight - gap) / (baseSize.h + gap));\n\n\t\t\t// Only update if model size increased\n\t\t\tthis.model.size.w = Math.max(this.model.size.w, newModelWidth);\n\t\t\tthis.model.size.h = Math.max(this.model.size.h, newModelHeight);\n\n\t\t\tthis.drawGrid();\n\t\t}\n\t}\n\n\t_onItemMove = (e: DashboardEvent) => {\n\t\tif (!e.item.moving) return;\n\t\tconst topOffset = this.scrollOffset;\n\t\tconst x = this.offsetToXCoord(e.item.offsetLeft);\n\t\tconst y = this.offsetToYCoord(e.item.offsetTop + topOffset);\n\t\tconst rect: Rect = {x, y, w: e.item.model.w, h: e.item.model.h};\n\t\tthis.showPlaceholder(rect);\n\t\tthis.previewLayout(rect);\n\t\tthis.checkAutoScroll(e.item);\n\t}\n\n\t_onItemResize = (e: DashboardEvent) => {\n\t\tif (!e.item.resizing) return;\n\t\tconst gap = this.model.options.gap;\n\t\t// Snap to the nearest cell count so the item can shrink down to a single cell\n\t\tconst w = Math.max(1, Math.round((e.item.offsetWidth + gap) / (this.baseSize.w + gap)));\n\t\tconst h = Math.max(1, Math.round((e.item.offsetHeight + gap) / (this.baseSize.h + gap)));\n\t\tconst rect: Rect = {x: e.item.model.x, y: e.item.model.y, w, h};\n\t\tthis.showPlaceholder(rect);\n\t\tthis.previewLayout(rect);\n\t\tthis.checkAutoScroll(e.item);\n\t}\n\n\tconstructor() {\n\t\tsuper();\n\t\tthis.addEventListener('dashboard.movestart', (e: DashboardEvent) => this.startMove(e.item));\n\t\tthis.addEventListener('dashboard.resizestart', (e: DashboardEvent) => this.startResize(e.item));\n\t\tthis.addEventListener('dashboard.movestop', () => this.stopMove());\n\t\tthis.addEventListener('dashboard.resizestop', () => this.stopMove());\n\t\tthis.addEventListener('dashboard.move', this._onItemMove);\n\t\tthis.addEventListener('dashboard.resize', this._onItemResize);\n\t}\n\n\tcalculateItemLocation(item: Rect) : Rect {\n\t\tconst baseSize = this.baseSize;\n\t\tconst gap = this.model.options.gap;\n\t\treturn {\n\t\t\tx: item.x * (baseSize.w + gap) + gap,\n\t\t\ty: item.y * (baseSize.h + gap) + gap,\n\t\t\tw: item.w * (baseSize.w + gap) - gap,\n\t\t\th: item.h * (baseSize.h + gap) - gap,\n\t\t};\n\t}\n\n\tshowPlaceholder(rect: Rect) {\n\t\tdom.showElement(this.placeholder);\n\t\tthis.setItemPosition(this.placeholder, rect);\n\t}\n\n\thidePlaceholder() {\n\t\tdom.hideElement(this.placeholder);\n\t}\n\n\tsetSourceData(source: DashboardSource) {\n\t\tthis.components.clear();\n\t\tthis.model = new DashboardModel(source);\n\t\tthis.model.detectAndFixCollisions();\n\t}\n\n\tsetItemPosition(elm: HTMLElement, rect: Rect) {\n\t\tconst {x, y, w, h} = this.calculateItemLocation(rect);\n\t\tdom.setSize(elm, { w, h});\n\t\tdom.setPosition(elm, {l: x, t: y});\n\t}\n\n\tfixCollisions() {\n\t\tif (!this.model) return;\n\t\tthis.model.detectAndFixCollisions();\n\t\tthis.layout();\n\t}\n\n\tlayout() {\n\t\tthis._baseSize = null;\n\t\tif (!this.model) return;\n\t\tthis.items?.forEach((item: DashboardItem) => this.setItemPosition(item, item.model));\n\n\t\tconst h = Math.max(\n\t\t\tthis.model.size.h * (this.baseSize.h + this.model.options.gap) + this.model.options.gap,\n\t\t\tthis.container.clientHeight\n\t\t);\n\n\t\tdom.setSize(this.content, {\n\t\t\tw: this.model.size.w * (this.baseSize.w + this.model.options.gap) + this.model.options.gap,\n\t\t\th: h\n\t\t});\n\n\t\tthis.items?.forEach((item: DashboardItem) => item.layout());\n\t\tthis.drawGrid();\n\t}\n\n\tasync drawGrid() {\n\t\tif (!this.gridCanvas) return;\n\t\tif (this.container.isUpdatePending) await this.container.updateComplete;\n\n\t\tconst ctx = this.gridCanvas.getContext('2d');\n\t\tif (!ctx) return;\n\n\t\tconst gap = this.model.options.gap;\n\t\tconst baseSize = this.baseSize;\n\n\t\tthis.gridCanvas.style.width = '100%';\n\t\tthis.gridCanvas.style.height = '100%';\n\t\tconst width = this.gridCanvas.offsetWidth;\n\t\tthis.gridCanvas.width = width;\n\t\tconst height = this.gridCanvas.offsetHeight;\n\t\tthis.gridCanvas.height = height;\n\t\tconst columns = width / baseSize.w;\n\t\tconst rows = height / baseSize.h;\n\n\n\t\tctx.clearRect(0, 0, width, height);\n\t\tctx.strokeStyle = 'rgba(116,116,116,0.2)';\n\t\tctx.lineWidth = 1;\n\n\t\tfor (let i = 0; i <= columns; i++) {\n\t\t\tconst x = Math.round(i * (baseSize.w + gap) + gap / 2) + 0.5;\n\t\t\tctx.beginPath();\n\t\t\tctx.moveTo(x, 0);\n\t\t\tctx.lineTo(x, height);\n\t\t\tctx.stroke();\n\t\t}\n\n\t\tfor (let i = 0; i <= rows; i++) {\n\t\t\tconst y = Math.round(i * (baseSize.h + gap) + gap / 2) + 0.5;\n\t\t\tctx.beginPath();\n\t\t\tctx.moveTo(0, y);\n\t\t\tctx.lineTo(width, y);\n\t\t\tctx.stroke();\n\t\t}\n\t}\n\n\tupdated() {\n\t\tthis.layout();\n\t}\n\n\trender = () => this.model ? html`\n\t\t<og-container scrollMode=\"${this.model.options?.orientation == 'horizontal' ? 'horizontal' : 'vertical'}\">\n\t\t\t<div slot=\"content\">\n\t\t\t\t${this.designMode ? html`\n\t\t\t\t\t${this.noGrid ? '' : html`<canvas class=\"item-grid\"></canvas>`}\n\t\t\t\t\t<div class=\"item-placeholder\"></div>\n\t\t\t\t` : null}\n\t\t\t\t${repeat(this.model.items, item => item.id, item => html`\n\t\t\t\t\t<og-dashboard-item\n\t\t\t\t\t\t?designMode=\"${this.designMode}\"\n\t\t\t\t\t\t.model=\"${item}\"\n\t\t\t\t\t\t.components=\"${this.components}\">\n\t\t\t\t\t</og-dashboard-item>\n\t\t\t\t`)}\n\t\t\t</div>\n\t\t</og-container>\n\t` : '';\n\n}\n"]}
1
+ {"version":3,"file":"dashboard.js","sourceRoot":"","sources":["../../src/ui/dashboard.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAoB,cAAc,EAAU,cAAc,EAAE,GAAG,EAAyB,MAAM,iBAAiB,CAAC;AACvH,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAC3B,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7E,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAClD,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1C,OAAO,EAAsB,cAAc,EAAE,MAAM,UAAU,CAAC;AAI9D,MAAM,OAAO,cAAe,SAAQ,KAAK;IAKxC,YAAY,IAAY,EAAE,IAA6B;QACtD,KAAK,CAAC,aAAa,IAAI,EAAE,EAAE,EAAC,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAC,CAAC,CAAC;QAC5D,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IAC3B,CAAC;CACD;AAGM,IAAM,SAAS,GAAf,MAAM,SAAU,SAAQ,cAAc;IA0C5C,IAAI,QAAQ;QACX,IAAI,IAAI,CAAC,SAAS;YAAE,OAA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AAC;YACjB,GAAG,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;YACrB,GAAG,CAAC,MAAM,EAAE,CAAC;QACd,CAAC;IACF,CAAC;IAED,OAAO;QACN,IAAI,CAAC,MAAM,EAAE,CAAC;IACf,CAAC;;AAtbM,gBAAM,GAAG,CAAC,cAAc,CAAC,MAAM,EAAE,KAAK,CAAC,AAAjC,CAAkC;AAG/C;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,MAAM,EAAC,CAAC;wCACH;AAGtB;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAC,CAAC;6CACtB;AAGnB;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,OAAO,EAAC,CAAC;yCACX;AAGf;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,MAAM,EAAC,CAAC;kDACS;AAGlC;IADC,QAAQ,CAAC,mBAAmB,CAAC;wCACd;AAGhB;IADC,KAAK,CAAC,cAAc,CAAC;4CACD;AAGrB;IADC,KAAK,CAAC,kBAAkB,CAAC;0CACF;AAGxB;IADC,KAAK,CAAC,mBAAmB,CAAC;8CACC;AAG5B;IADC,KAAK,CAAC,YAAY,CAAC;6CACU;AA7BlB,SAAS;IADrB,aAAa,CAAC,cAAc,CAAC;GACjB,SAAS,CA4crB","sourcesContent":["import { ComponentFactory, ComponentStore, Layout, OmegaComponent, dom, Rect, Container, Size } from '@omegagrid/core';\nimport { html } from 'lit';\nimport { customElement, property, query, queryAll } from 'lit/decorators.js';\nimport { repeat } from 'lit/directives/repeat.js';\nimport { style } from './dashboard.style';\nimport { DashboardItemModel, DashboardModel } from '../model';\nimport { DashboardSource } from '../types';\nimport { DashboardItem } from './dashboardItem';\n\nexport class DashboardEvent extends Event {\n\n\treadonly item: DashboardItem;\n\treadonly model: DashboardItemModel;\n\n\tconstructor(type: string, args: Partial<DashboardEvent>) {\n\t\tsuper(`dashboard.${type}`, {bubbles: true, composed: true});\n\t\tObject.assign(this, args);\n\t}\n}\n\n@customElement('og-dashboard')\nexport class Dashboard extends OmegaComponent implements Layout {\n\n\tstatic styles = [OmegaComponent.styles, style];\n\n\t@property({type: Object})\n\tmodel: DashboardModel;\n\n\t@property({type: Boolean, reflect: true})\n\tdesignMode = false;\n\n\t@property({type: Boolean})\n\tnoGrid = false;\n\n\t@property({type: Object})\n\tcreateComponent: ComponentFactory;\n\n\t@queryAll('og-dashboard-item')\n\titems: NodeList;\n\n\t@query('og-container')\n\tcontainer: Container;\n\n\t@query('[slot=\"content\"]')\n\tcontent: HTMLDivElement;\n\n\t@query('.item-placeholder')\n\tplaceholder: HTMLDivElement;\n\n\t@query('.item-grid')\n\tgridCanvas: HTMLCanvasElement;\n\n\tprivate _currentItem: DashboardItem;\n\tprivate _previewPositions: Rect[];\n\tprivate _autoScrollInterval: number = null;\n\tprivate _autoScrollSpeed = { x: 0, y: 0 };\n\tprivate _isResizing = false;\n\n\treadonly components = new ComponentStore<HTMLElement & Layout>(\n\t\tid => this.createComponent ? this.createComponent(id) as HTMLElement & Layout : null\n\t);\n\n\tprivate _baseSize: Size;\n\tget baseSize() {\n\t\tif (this._baseSize) return this._baseSize;\n\t\tconst { columns, columnWidth, rows, rowHeight, gap } = this.model.options;\n\n\t\tthis._baseSize = {\n\t\t\tw: columnWidth || (columns ? (this.container.clientWidth - ((columns + 1) * gap)) / columns : null),\n\t\t\th: rowHeight || (rows ? (this.container.clientHeight - ((rows + 1) * gap)) / rows : null),\n\t\t};\n\n\t\tif (this._baseSize.w == null) this._baseSize.w = this._baseSize.h;\n\t\tif (this._baseSize.h == null) this._baseSize.h = this._baseSize.w;\n\t\treturn this._baseSize;\n\t}\n\n\tstartMove(item: DashboardItem) {\n\t\tthis._currentItem = item;\n\t\tthis._currentItem.classList.toggle('active', true);\n\t\tthis.classList.toggle('moving', true);\n\t\tthis._isResizing = false;\n\t}\n\n\tstartResize(item: DashboardItem) {\n\t\tthis._currentItem = item;\n\t\tthis._currentItem.classList.toggle('active', true);\n\t\tthis.classList.toggle('moving', true);\n\t\tthis._isResizing = true;\n\t}\n\n\tstopMove() {\n\t\tif (!this._currentItem) return;\n\t\tthis._currentItem.classList.toggle('active', false);\n\t\tthis._currentItem = null;\n\t\tthis.classList.toggle('moving', false);\n\t\tthis.hidePlaceholder();\n\t\tthis.updatePreviewPositions();\n\t\tthis.stopAutoScroll();\n\t}\n\n\tget scrollOffset() {\n\t\treturn this.container?.verticalSlider?.value || 0;\n\t}\n\n\toffsetToXCoord(offset: number) {\n\t\treturn Math.max(0, Math.floor(offset / (this.baseSize.w + this.model.options.gap)));\n\t}\n\n\toffsetToYCoord(offset: number) {\n\t\treturn Math.max(0, Math.floor(offset / (this.baseSize.h + this.model.options.gap)));\n\t}\n\n\tupdatePreviewPositions() {\n\t\tif (!this._previewPositions) return;\n\t\tthis.model.updatePositions(this._previewPositions);\n\t\tthis._previewPositions = null;\n\t\tthis.layout();\n\t}\n\n\tpreviewLayout(rect: Rect) {\n\t\tthis._previewPositions = this.model.calculatePositions(this._currentItem.model, rect);\n\t\tthis._previewPositions.forEach((rect, i) => {\n\t\t\tconst item = this.items[i] as DashboardItem;\n\t\t\tif (item && item != this._currentItem) this.setItemPosition(item, rect);\n\t\t});\n\t}\n\n\tcheckAutoScroll(item: DashboardItem) {\n\t\tif (!this.container) return;\n\n\t\t// For resize, also expand content area preemptively so there's space to scroll into\n\t\tif (this._isResizing) {\n\t\t\tthis.checkResizeExpansion(item);\n\t\t}\n\n\t\tconst threshold = 50; // pixels from edge to trigger scroll\n\t\tconst scrollSpeed = 5; // pixels per frame\n\t\tconst containerRect = this.container.getBoundingClientRect();\n\t\tconst itemRect = item.getBoundingClientRect();\n\n\t\tlet scrollX = 0;\n\t\tlet scrollY = 0;\n\n\t\t// Check horizontal scrolling\n\t\tif (itemRect.right > containerRect.right - threshold) {\n\t\t\tscrollX = scrollSpeed;\n\t\t} else if (itemRect.left < containerRect.left + threshold) {\n\t\t\tscrollX = -scrollSpeed;\n\t\t}\n\n\t\t// Check vertical scrolling\n\t\tif (itemRect.bottom > containerRect.bottom - threshold) {\n\t\t\tscrollY = scrollSpeed;\n\t\t} else if (itemRect.top < containerRect.top + threshold) {\n\t\t\tscrollY = -scrollSpeed;\n\t\t}\n\n\t\tthis._autoScrollSpeed = { x: scrollX, y: scrollY };\n\n\t\tif ((scrollX !== 0 || scrollY !== 0) && !this._autoScrollInterval) {\n\t\t\tthis.startAutoScroll();\n\t\t} else if (scrollX === 0 && scrollY === 0 && this._autoScrollInterval) {\n\t\t\tthis.stopAutoScroll();\n\t\t}\n\t}\n\n\tcheckResizeExpansion(item: DashboardItem) {\n\t\tif (!this.container || !this.model) return;\n\n\t\tconst baseSize = this.baseSize;\n\t\tconst gap = this.model.options.gap;\n\n\t\t// Item edges in content coordinates - offsetTop is already content-relative\n\t\tconst itemBottom = item.offsetTop + item.offsetHeight;\n\t\tconst itemRight = item.offsetLeft + item.offsetWidth;\n\t\tconst currentContentHeight = this.content.offsetHeight;\n\t\tconst currentContentWidth = this.content.offsetWidth;\n\n\t\t// Threshold: expand when item is within 1 grid cell of the content edge\n\t\tconst thresholdY = baseSize.h + gap;\n\t\tconst thresholdX = baseSize.w + gap;\n\n\t\tlet newHeight = currentContentHeight;\n\t\tlet newWidth = currentContentWidth;\n\t\tlet needsUpdate = false;\n\n\t\tif (itemBottom > currentContentHeight - thresholdY) {\n\t\t\tnewHeight = currentContentHeight + 5 * (baseSize.h + gap);\n\t\t\tneedsUpdate = true;\n\t\t}\n\n\t\tif (itemRight > currentContentWidth - thresholdX) {\n\t\t\tnewWidth = currentContentWidth + 5 * (baseSize.w + gap);\n\t\t\tneedsUpdate = true;\n\t\t}\n\n\t\tif (needsUpdate) {\n\t\t\tdom.setSize(this.content, { w: newWidth, h: newHeight });\n\t\t\tthis.model.size.w = Math.max(this.model.size.w, Math.ceil((newWidth - gap) / (baseSize.w + gap)));\n\t\t\tthis.model.size.h = Math.max(this.model.size.h, Math.ceil((newHeight - gap) / (baseSize.h + gap)));\n\t\t\tthis.drawGrid();\n\t\t}\n\t}\n\n\tstartAutoScroll() {\n\t\tif (this._autoScrollInterval) return;\n\n\t\tthis._autoScrollInterval = window.setInterval(() => {\n\t\t\tif (!this.container) return;\n\n\t\t\tconst { x, y } = this._autoScrollSpeed;\n\n\t\t\t// Scroll vertically\n\t\t\tif (y !== 0 && this.container.verticalSlider) {\n\t\t\t\tconst currentScroll = this.container.verticalSlider.value;\n\t\t\t\tconst maxScroll = this.container.verticalSlider.maxValue;\n\n\t\t\t\t// Expand content area if scrolling down near the bottom\n\t\t\t\tif (y > 0 && currentScroll >= maxScroll * 0.85) {\n\t\t\t\t\tthis.expandContentArea();\n\t\t\t\t\t// After expanding, continue scrolling\n\t\t\t\t\tconst newMaxScroll = this.container.verticalSlider.maxValue;\n\t\t\t\t\tthis.container.scrollVerticalTo(Math.min(newMaxScroll, currentScroll + y));\n\t\t\t\t} else {\n\t\t\t\t\tconst newScroll = Math.max(0, Math.min(maxScroll, currentScroll + y));\n\t\t\t\t\tthis.container.scrollVerticalTo(newScroll);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Scroll horizontally\n\t\t\tif (x !== 0 && this.container.horizontalSlider) {\n\t\t\t\tconst currentScroll = this.container.horizontalSlider.value;\n\t\t\t\tconst maxScroll = this.container.horizontalSlider.maxValue;\n\n\t\t\t\t// Expand content area if scrolling right near the edge\n\t\t\t\tif (x > 0 && currentScroll >= maxScroll * 0.85) {\n\t\t\t\t\tthis.expandContentArea();\n\t\t\t\t\t// After expanding, continue scrolling\n\t\t\t\t\tconst newMaxScroll = this.container.horizontalSlider.maxValue;\n\t\t\t\t\tthis.container.scrollHorizontalTo(Math.min(newMaxScroll, currentScroll + x));\n\t\t\t\t} else {\n\t\t\t\t\tconst newScroll = Math.max(0, Math.min(maxScroll, currentScroll + x));\n\t\t\t\t\tthis.container.scrollHorizontalTo(newScroll);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// During resize, update item size with new scroll offset so placeholder follows smoothly\n\t\t\tif (this._isResizing && this._currentItem) {\n\t\t\t\tthis._currentItem.updateResize();\n\t\t\t}\n\t\t}, 16); // ~60fps\n\t}\n\n\tstopAutoScroll() {\n\t\tif (this._autoScrollInterval) {\n\t\t\twindow.clearInterval(this._autoScrollInterval);\n\t\t\tthis._autoScrollInterval = null;\n\t\t}\n\t\tthis._autoScrollSpeed = { x: 0, y: 0 };\n\t}\n\n\texpandContentArea() {\n\t\tif (!this.model || !this._currentItem) return;\n\n\t\t// Calculate how much space we need based on current item position\n\t\tconst topOffset = this.scrollOffset;\n\t\tconst itemBottom = this._currentItem.offsetTop + this._currentItem.offsetHeight + topOffset;\n\t\tconst itemRight = this._currentItem.offsetLeft + this._currentItem.offsetWidth;\n\n\t\tconst currentContentHeight = this.content.offsetHeight;\n\t\tconst currentContentWidth = this.content.offsetWidth;\n\n\t\t// Expand by 2 grid cells if needed\n\t\tconst expandRows = 2;\n\t\tconst expandCols = 2;\n\t\tconst baseSize = this.baseSize;\n\t\tconst gap = this.model.options.gap;\n\n\t\tlet newHeight = currentContentHeight;\n\t\tlet newWidth = currentContentWidth;\n\n\t\t// Check if we need more height - only expand, never shrink\n\t\tif (itemBottom > currentContentHeight - gap * 2) {\n\t\t\tnewHeight = Math.max(currentContentHeight, currentContentHeight + expandRows * (baseSize.h + gap));\n\t\t}\n\n\t\t// Check if we need more width - only expand, never shrink\n\t\tif (itemRight > currentContentWidth - gap * 2) {\n\t\t\tnewWidth = Math.max(currentContentWidth, currentContentWidth + expandCols * (baseSize.w + gap));\n\t\t}\n\n\t\t// Only update if size actually changed\n\t\tif (newHeight !== currentContentHeight || newWidth !== currentContentWidth) {\n\t\t\tdom.setSize(this.content, { w: newWidth, h: newHeight });\n\n\t\t\t// Update model size to match new content dimensions\n\t\t\tconst newModelWidth = Math.ceil((newWidth - gap) / (baseSize.w + gap));\n\t\t\tconst newModelHeight = Math.ceil((newHeight - gap) / (baseSize.h + gap));\n\n\t\t\t// Only update if model size increased\n\t\t\tthis.model.size.w = Math.max(this.model.size.w, newModelWidth);\n\t\t\tthis.model.size.h = Math.max(this.model.size.h, newModelHeight);\n\n\t\t\tthis.drawGrid();\n\t\t}\n\t}\n\n\t_onItemMove = (e: DashboardEvent) => {\n\t\tif (!e.item.moving) return;\n\t\tconst topOffset = this.scrollOffset;\n\t\tconst x = this.offsetToXCoord(e.item.offsetLeft);\n\t\tconst y = this.offsetToYCoord(e.item.offsetTop + topOffset);\n\t\tconst rect: Rect = {x, y, w: e.item.model.w, h: e.item.model.h};\n\t\tthis.showPlaceholder(rect);\n\t\tthis.previewLayout(rect);\n\t\tthis.checkAutoScroll(e.item);\n\t}\n\n\t_onItemResize = (e: DashboardEvent) => {\n\t\tif (!e.item.resizing) return;\n\t\tconst gap = this.model.options.gap;\n\t\t// Snap to the nearest cell count so the item can shrink down to a single cell\n\t\tconst w = Math.max(1, Math.round((e.item.offsetWidth + gap) / (this.baseSize.w + gap)));\n\t\tconst h = Math.max(1, Math.round((e.item.offsetHeight + gap) / (this.baseSize.h + gap)));\n\t\tconst rect: Rect = {x: e.item.model.x, y: e.item.model.y, w, h};\n\t\tthis.showPlaceholder(rect);\n\t\tthis.previewLayout(rect);\n\t\tthis.checkAutoScroll(e.item);\n\t}\n\n\tconstructor() {\n\t\tsuper();\n\t\tthis.addEventListener('dashboard.movestart', (e: DashboardEvent) => this.startMove(e.item));\n\t\tthis.addEventListener('dashboard.resizestart', (e: DashboardEvent) => this.startResize(e.item));\n\t\tthis.addEventListener('dashboard.movestop', () => this.stopMove());\n\t\tthis.addEventListener('dashboard.resizestop', () => this.stopMove());\n\t\tthis.addEventListener('dashboard.move', this._onItemMove);\n\t\tthis.addEventListener('dashboard.resize', this._onItemResize);\n\t}\n\n\tcalculateItemLocation(item: Rect) : Rect {\n\t\tconst baseSize = this.baseSize;\n\t\tconst gap = this.model.options.gap;\n\t\treturn {\n\t\t\tx: item.x * (baseSize.w + gap) + gap,\n\t\t\ty: item.y * (baseSize.h + gap) + gap,\n\t\t\tw: item.w * (baseSize.w + gap) - gap,\n\t\t\th: item.h * (baseSize.h + gap) - gap,\n\t\t};\n\t}\n\n\tshowPlaceholder(rect: Rect) {\n\t\tdom.showElement(this.placeholder);\n\t\tthis.setItemPosition(this.placeholder, rect);\n\t}\n\n\thidePlaceholder() {\n\t\tdom.hideElement(this.placeholder);\n\t}\n\n\tsetSourceData(source: DashboardSource) {\n\t\tthis.components.clear();\n\t\tthis.model = new DashboardModel(source);\n\t\tthis.model.detectAndFixCollisions();\n\t}\n\n\tsetItemPosition(elm: HTMLElement, rect: Rect) {\n\t\tconst {x, y, w, h} = this.calculateItemLocation(rect);\n\t\tdom.setSize(elm, { w, h});\n\t\tdom.setPosition(elm, {l: x, t: y});\n\t}\n\n\tfixCollisions() {\n\t\tif (!this.model) return;\n\t\tthis.model.detectAndFixCollisions();\n\t\tthis.layout();\n\t}\n\n\t/** items rendered in the current mode, hidden items are rendered in design mode only */\n\tget renderedItems() {\n\t\treturn this.designMode ? this.model.items : this.model.items.filter(item => !item.hidden);\n\t}\n\n\tlayout() {\n\t\tthis._baseSize = null;\n\t\tif (!this.model) return;\n\n\t\tlet size = this.model.size;\n\t\tif (this.designMode) {\n\t\t\tthis.items?.forEach((item: DashboardItem) => this.setItemPosition(item, item.model));\n\t\t} else {\n\t\t\t// hidden items are not rendered and the others take their space\n\t\t\tconst positions = this.model.getViewPositions();\n\t\t\tsize = {w: 0, h: 0};\n\t\t\tthis.items?.forEach((item: DashboardItem) => {\n\t\t\t\tconst rect = positions[item.model.index];\n\t\t\t\tif (!rect) return;\n\t\t\t\tthis.setItemPosition(item, rect);\n\t\t\t\tsize.w = Math.max(size.w, rect.x + rect.w);\n\t\t\t\tsize.h = Math.max(size.h, rect.y + rect.h);\n\t\t\t});\n\t\t}\n\n\t\tconst h = Math.max(\n\t\t\tsize.h * (this.baseSize.h + this.model.options.gap) + this.model.options.gap,\n\t\t\tthis.container.clientHeight\n\t\t);\n\n\t\tdom.setSize(this.content, {\n\t\t\tw: size.w * (this.baseSize.w + this.model.options.gap) + this.model.options.gap,\n\t\t\th: h\n\t\t});\n\n\t\tthis.items?.forEach((item: DashboardItem) => item.layout());\n\t\tthis.drawGrid();\n\t}\n\n\tasync drawGrid() {\n\t\tif (!this.gridCanvas) return;\n\t\tif (this.container.isUpdatePending) await this.container.updateComplete;\n\n\t\tconst ctx = this.gridCanvas.getContext('2d');\n\t\tif (!ctx) return;\n\n\t\tconst gap = this.model.options.gap;\n\t\tconst baseSize = this.baseSize;\n\n\t\tthis.gridCanvas.style.width = '100%';\n\t\tthis.gridCanvas.style.height = '100%';\n\t\tconst width = this.gridCanvas.offsetWidth;\n\t\tthis.gridCanvas.width = width;\n\t\tconst height = this.gridCanvas.offsetHeight;\n\t\tthis.gridCanvas.height = height;\n\t\tconst columns = width / baseSize.w;\n\t\tconst rows = height / baseSize.h;\n\n\n\t\tctx.clearRect(0, 0, width, height);\n\t\tctx.strokeStyle = 'rgba(116,116,116,0.2)';\n\t\tctx.lineWidth = 1;\n\n\t\tfor (let i = 0; i <= columns; i++) {\n\t\t\tconst x = Math.round(i * (baseSize.w + gap) + gap / 2) + 0.5;\n\t\t\tctx.beginPath();\n\t\t\tctx.moveTo(x, 0);\n\t\t\tctx.lineTo(x, height);\n\t\t\tctx.stroke();\n\t\t}\n\n\t\tfor (let i = 0; i <= rows; i++) {\n\t\t\tconst y = Math.round(i * (baseSize.h + gap) + gap / 2) + 0.5;\n\t\t\tctx.beginPath();\n\t\t\tctx.moveTo(0, y);\n\t\t\tctx.lineTo(width, y);\n\t\t\tctx.stroke();\n\t\t}\n\t}\n\n\tupdated() {\n\t\tthis.layout();\n\t}\n\n\trender = () => this.model ? html`\n\t\t<og-container scrollMode=\"${this.model.options?.orientation == 'horizontal' ? 'horizontal' : 'vertical'}\">\n\t\t\t<div slot=\"content\">\n\t\t\t\t${this.designMode ? html`\n\t\t\t\t\t${this.noGrid ? '' : html`<canvas class=\"item-grid\"></canvas>`}\n\t\t\t\t\t<div class=\"item-placeholder\"></div>\n\t\t\t\t` : null}\n\t\t\t\t${repeat(this.renderedItems, item => item.id, item => html`\n\t\t\t\t\t<og-dashboard-item\n\t\t\t\t\t\t?designMode=\"${this.designMode}\"\n\t\t\t\t\t\t.model=\"${item}\"\n\t\t\t\t\t\t.components=\"${this.components}\">\n\t\t\t\t\t</og-dashboard-item>\n\t\t\t\t`)}\n\t\t\t</div>\n\t\t</og-container>\n\t` : '';\n\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@omegagrid/dashboard",
3
- "version": "0.11.25",
3
+ "version": "0.11.27",
4
4
  "license": "UNLICENSED",
5
5
  "description": "Dashboard component",
6
6
  "main": "./dist/index.js",
@@ -28,8 +28,8 @@
28
28
  },
29
29
  "dependencies": {
30
30
  "@fortawesome/fontawesome-svg-core": "^7.0.1",
31
- "@omegagrid/core": "^0.11.25",
32
- "@omegagrid/localize": "^0.11.25",
31
+ "@omegagrid/core": "^0.11.27",
32
+ "@omegagrid/localize": "^0.11.27",
33
33
  "date-fns": "^3.2.0",
34
34
  "lit": "^3.1.1",
35
35
  "ts-debounce": "^4.0.0"