@omegagrid/dashboard 0.10.69 → 0.10.70

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/types.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import { ComponentId } from "@omegagrid/core";
2
+ import type { DashboardItemModel } from "./model";
2
3
  export type DashboardItemSource = {
3
4
  /** id of the component */
4
5
  id: ComponentId;
@@ -29,6 +30,12 @@ export type DashboardOptions = {
29
30
  overlay?: {
30
31
  /** opacity of overlay in design mode */
31
32
  opacity?: number;
33
+ /**
34
+ * Custom design mode overlay renderer. When set, a plain div is rendered
35
+ * over the item instead of the default og-overlay and this function is
36
+ * called to fill its content (e.g. title and item controls).
37
+ */
38
+ renderer?: (div: HTMLDivElement, model: DashboardItemModel) => void;
32
39
  };
33
40
  };
34
41
  export type DashboardSource = {
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAE9C,MAAM,MAAM,mBAAmB,GAAG;IACjC,0BAA0B;IAC1B,EAAE,EAAE,WAAW,CAAC;IAEhB,cAAc;IACd,CAAC,EAAE,MAAM,CAAC;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;CACf,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,4B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AE/C,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\";\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\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\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}"]}
@@ -7,6 +7,8 @@ export declare class DashboardItem extends OmegaComponent implements Layout {
7
7
  designMode: boolean;
8
8
  container: HTMLDivElement;
9
9
  overlay: Overlay;
10
+ customOverlay: HTMLDivElement;
11
+ get overlayRenderer(): (div: HTMLDivElement, model: DashboardItemModel) => void;
10
12
  private _parent;
11
13
  private _mouseOffset;
12
14
  private _movingOffset;
@@ -1 +1 @@
1
- {"version":3,"file":"dashboardItem.d.ts","sourceRoot":"","sources":["../../src/ui/dashboardItem.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAO,MAAM,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAGvF,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAG9C,qBACa,aAAc,SAAQ,cAAe,YAAW,MAAM;IAElE,MAAM,CAAC,MAAM,iCAgBV;IAGH,UAAU,EAAE,cAAc,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CAsBV;IAGH,UAAU,EAAE,cAAc,CAAC,WAAW,GAAG,MAAM,CAAC,CAAC;IAGjD,KAAK,EAAE,kBAAkB,CAAC;IAG1B,UAAU,UAAS;IAGnB,SAAS,EAAE,cAAc,CAAC;IAG1B,OAAO,EAAE,OAAO,CAAC;IAGjB,aAAa,EAAE,cAAc,CAAC;IAE9B,IAAI,eAAe,6DAA2D;IAE9E,OAAO,CAAC,OAAO,CAAY;IAC3B,OAAO,CAAC,YAAY,CAAqC;IACzD,OAAO,CAAC,aAAa,CAAqC;IAC1D,OAAO,CAAC,SAAS,CAAS;IAC1B,OAAO,CAAC,cAAc,CAAqC;IAC3D,OAAO,CAAC,eAAe,CAAiB;IACxC,OAAO,CAAC,YAAY,CAAyC;IAC7D,OAAO,CAAC,oBAAoB,CAAK;IACjC,OAAO,CAAC,eAAe,CAAoB;IAE3C,IAAI,WAAW;aATa,MAAM;cAAQ,MAAM;MASF;IAC9C,IAAI,MAAM,YAAyC;IACnD,IAAI,QAAQ,YAA4B;IAGxC,IAAI,SAAS,kCAIZ;;IAcD,iBAAiB;IAMjB,oBAAoB;IAMpB,WAAW;IAMX,UAAU,aAYR;IAEF,YAAY,GAAI,GAAG,UAAU,UAoB3B;IAEF,YAAY,GAAI,GAAG,UAAU,UAO3B;IAEF,cAAc,GAAI,GAAG,UAAU,UAG7B;IAEF,iGAAiG;IACjG,YAAY;IAMZ,OAAO,CAAC,YAAY;IAYpB,SAAS,aAEP;IAEI,MAAM;IAKZ,WAAW,CAAC,IAAI,GAAE,MAAa,EAAE,MAAM,GAAE,OAAe;IAgBxD,WAAW;IAML,OAAO;IAgBb,MAAM,6CAMJ;CAEF"}
@@ -9,6 +9,7 @@ import { css, html } from "lit";
9
9
  import { customElement, property, query } from "lit/decorators.js";
10
10
  import { Dashboard, DashboardEvent } from "./dashboard";
11
11
  let DashboardItem = class DashboardItem extends OmegaComponent {
12
+ get overlayRenderer() { return this.model?.model?.options?.overlay?.renderer; }
12
13
  get mouseOffset() { return this._mouseOffset; }
13
14
  get moving() { return this._movingOffset !== null; }
14
15
  get resizing() { return this._resizing; }
@@ -82,7 +83,9 @@ let DashboardItem = class DashboardItem extends OmegaComponent {
82
83
  };
83
84
  this.render = () => html `
84
85
  <div class="container"></div>
85
- <og-overlay></og-overlay>
86
+ ${this.overlayRenderer
87
+ ? html `<div class="overlay-custom" style="display: none"></div>`
88
+ : html `<og-overlay></og-overlay>`}
86
89
  `;
87
90
  this.addEventListener('mousedown', this._onMouseDown);
88
91
  this.addEventListener('mouseup', this._onMouseUp);
@@ -129,6 +132,12 @@ let DashboardItem = class DashboardItem extends OmegaComponent {
129
132
  c.layout();
130
133
  }
131
134
  showOverlay(text = null, loader = false) {
135
+ if (this.customOverlay) {
136
+ // custom overlay appearance is fully controlled by the renderer
137
+ dom.showElement(this.customOverlay);
138
+ this.overlayRenderer(this.customOverlay, this.model);
139
+ return;
140
+ }
132
141
  this.overlay.text = text;
133
142
  this.overlay.defaultLoader = loader;
134
143
  const opacity = this.model.model.options.overlay?.opacity ?? 1;
@@ -138,7 +147,9 @@ let DashboardItem = class DashboardItem extends OmegaComponent {
138
147
  dom.hideElement(this.container);
139
148
  }
140
149
  hideOverlay() {
141
- this.overlay.hide();
150
+ if (this.customOverlay)
151
+ dom.hideElement(this.customOverlay);
152
+ this.overlay?.hide();
142
153
  dom.showElement(this.container);
143
154
  }
144
155
  async updated() {
@@ -169,6 +180,12 @@ DashboardItem.styles = [OmegaComponent.styles, css `
169
180
  background-color: var(--og-accent-color);
170
181
  }
171
182
 
183
+ .overlay-custom {
184
+ position: absolute;
185
+ inset: 0;
186
+ z-index: 1101;
187
+ }
188
+
172
189
  .container {
173
190
  height: 100%;
174
191
  }
@@ -188,6 +205,9 @@ __decorate([
188
205
  __decorate([
189
206
  query('og-overlay')
190
207
  ], DashboardItem.prototype, "overlay", void 0);
208
+ __decorate([
209
+ query('.overlay-custom')
210
+ ], DashboardItem.prototype, "customOverlay", void 0);
191
211
  DashboardItem = __decorate([
192
212
  customElement('og-dashboard-item')
193
213
  ], DashboardItem);
@@ -1 +1 @@
1
- {"version":3,"file":"dashboardItem.js","sourceRoot":"","sources":["../../src/ui/dashboardItem.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAkB,GAAG,EAAU,cAAc,EAAW,MAAM,iBAAiB,CAAC;AACvF,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAChC,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAEnE,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAGjD,IAAM,aAAa,GAAnB,MAAM,aAAc,SAAQ,cAAc;IA6ChD,IAAI,WAAW,KAAK,OAAO,IAAI,CAAC,YAAY,CAAA,CAAC,CAAC;IAC9C,IAAI,MAAM,KAAK,OAAO,IAAI,CAAC,aAAa,KAAK,IAAI,CAAA,CAAC,CAAC;IACnD,IAAI,QAAQ,KAAK,OAAO,IAAI,CAAC,SAAS,CAAA,CAAC,CAAC;IAGxC,IAAI,SAAS;QACZ,IAAI,CAAC,IAAI,CAAC,KAAK;YAAE,OAAO,IAAI,CAAC;QAC7B,IAAI,CAAC,IAAI,CAAC,UAAU;YAAE,OAAO,IAAI,CAAC;QAClC,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;IAC3C,CAAC;IAED;QACC,KAAK,EAAE,CAAC;QA9BT,eAAU,GAAG,KAAK,CAAC;QASX,iBAAY,GAAgC,IAAI,CAAC;QACjD,kBAAa,GAAgC,IAAI,CAAC;QAClD,cAAS,GAAG,KAAK,CAAC;QAClB,mBAAc,GAAgC,IAAI,CAAC;QAEnD,iBAAY,GAAoC,IAAI,CAAC;QACrD,yBAAoB,GAAG,CAAC,CAAC;QACzB,oBAAe,GAAe,IAAI,CAAC;QA2C3C,eAAU,GAAG,GAAG,EAAE;YAC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overlay } from \"@omegagrid/core\";\nimport { css, html } from \"lit\";\nimport { customElement, property, query } from \"lit/decorators.js\";\nimport { DashboardItemModel } from \"../model\";\nimport { Dashboard, DashboardEvent } from \"./dashboard\";\n\n@customElement('og-dashboard-item')\nexport class DashboardItem extends OmegaComponent implements Layout {\n\n\tstatic styles = [OmegaComponent.styles, css`\n\t\t:host {\n\t\t\tposition: relative;\n\t\t\toverflow: hidden;\n\t\t}\n\n\t\tog-overlay {\n\t\t\tposition: absolute;\n\t\t\tinset: 0;\n\t\t\tz-index: 1101;\n\t\t\tbackground-color: var(--og-accent-color);\n\t\t}\n\n\t\t.container {\n\t\t\theight: 100%;\n\t\t}\n\t`];\n\n\t@property({type: Object})\n\tcomponents: ComponentStore<HTMLElement & Layout>;\n\n\t@property({type: Object})\n\tmodel: DashboardItemModel;\n\n\t@property({type: Boolean, reflect: true})\n\tdesignMode = false;\n\n\t@query('.container')\n\tcontainer: HTMLDivElement;\n\t\n\t@query('og-overlay')\n\toverlay: Overlay;\n\n\tprivate _parent: Dashboard;\n\tprivate _mouseOffset: {top: number, left: number} = null;\n\tprivate _movingOffset: {top: number, left: number} = null;\n\tprivate _resizing = false;\n\tprivate _elementOffset: {top: number, left: number} = null;\n\tprivate _resizeObserver: ResizeObserver;\n\tprivate _initialSize: {width: number, height: number} = null;\n\tprivate _initialScrollOffset = 0;\n\tprivate _lastMouseEvent: MouseEvent = null;\n\n\tget mouseOffset() { return this._mouseOffset }\n\tget moving() { return this._movingOffset !== null }\n\tget resizing() { return this._resizing }\n\n\n\tget component() {\n\t\tif (!this.model) return null;\n\t\tif (!this.components) return null;\n\t\treturn this.components.get(this.model.id);\n\t}\n\n\tconstructor() {\n\t\tsuper();\n\t\tthis.addEventListener('mousedown', this._onMouseDown);\n\t\tthis.addEventListener('mouseup', this._onMouseUp);\n\t\tthis._resizeObserver = new ResizeObserver(() => {\n\t\t\t// Only dispatch resize event if not manually resizing\n\t\t\tif (!this._resizing) {\n\t\t\t\tthis.dispatchEvent(new DashboardEvent('resize', {item: this, model: this.model}));\n\t\t\t}\n\t\t});\n\t}\n\n\tconnectedCallback() {\n\t\tsuper.connectedCallback();\n\t\tthis._resizeObserver.observe(this);\n\t\tthis._parent = dom.findParent<Dashboard>(this, elm => elm instanceof Dashboard);\n\t}\n\n\tdisconnectedCallback() {\n\t\tthis.clearEvents();\n\t\tthis._parent = null;\n\t\tthis._resizeObserver.unobserve(this);\n\t}\n\n\tclearEvents() {\n\t\tthis._parent.removeEventListener('mouseup', this._onMouseUp);\n\t\tthis._parent.removeEventListener('mousemove', this._onMouseMove);\n\t\tthis._parent.removeEventListener('mousemove', this._onMouseResize);\n\t}\n\n\t_onMouseUp = () => {\n\t\tif (this.resizing) {\n\t\t\tthis.dispatchEvent(new DashboardEvent('resizestop', {item: this, model: this.model}));\n\t\t} else if (this.moving) {\n\t\t\tthis.dispatchEvent(new DashboardEvent('movestop', {item: this, model: this.model}));\n\t\t}\n\n\t\tthis._movingOffset = null;\n\t\tthis._resizing = false;\n\t\tthis._initialSize = null;\n\t\tthis._lastMouseEvent = null;\n\t\tthis.clearEvents();\n\t};\n\n\t_onMouseDown = (e: MouseEvent) => {\n\t\tif (!this._parent.designMode) return;\n\t\tconst scrollOffset = this._parent.scrollOffset;\n\t\tthis._mouseOffset = {top: e.offsetY, left: e.offsetX};\n\t\tif (e.offsetX > this.offsetWidth - 20 && e.offsetY > this.offsetHeight - 20) {\n\t\t\tthis._resizing = true;\n\t\t\t// Store pure client coordinates - NO scroll offset for resize\n\t\t\tthis._movingOffset = {left: e.clientX, top: e.clientY};\n\t\t\tthis._initialSize = {width: this.offsetWidth, height: this.offsetHeight};\n\t\t\tthis._initialScrollOffset = scrollOffset;\n\t\t\tthis._parent.addEventListener('mouseup', this._onMouseUp);\n\t\t\tthis._parent.addEventListener('mousemove', this._onMouseResize);\n\t\t\tthis.dispatchEvent(new DashboardEvent('resizestart', {item: this, model: this.model}));\n\t\t} else {\n\t\t\tthis._movingOffset = {left: e.clientX, top: e.clientY + scrollOffset}; \n\t\t\tthis._elementOffset = {left: this.offsetLeft, top: this.offsetTop + scrollOffset};\n\t\t\tthis._parent.addEventListener('mouseup', this._onMouseUp);\n\t\t\tthis._parent.addEventListener('mousemove', this._onMouseMove);\n\t\t\tthis.dispatchEvent(new DashboardEvent('movestart', {item: this, model: this.model}));\n\t\t}\n\t};\n\n\t_onMouseMove = (e: MouseEvent) => {\n\t\tconst scrollOffset = this._parent.scrollOffset;\n\t\tdom.setPosition(this, {\n\t\t\tl: this._elementOffset.left + e.clientX - this._movingOffset.left,\n\t\t\tt: this._elementOffset.top + e.clientY - this._movingOffset.top + scrollOffset, \n\t\t});\n\t\tthis.dispatchEvent(new DashboardEvent('move', {item: this, model: this.model}));\n\t};\n\n\t_onMouseResize = (e: MouseEvent) => {\n\t\tthis._lastMouseEvent = e;\n\t\tthis._applyResize(e.clientX, e.clientY);\n\t};\n\n\t/** Re-trigger resize calculation with current scroll offset (called from autoscroll interval) */\n\tupdateResize() {\n\t\tif (this._lastMouseEvent) {\n\t\t\tthis._applyResize(this._lastMouseEvent.clientX, this._lastMouseEvent.clientY);\n\t\t}\n\t}\n\n\tprivate _applyResize(clientX: number, clientY: number) {\n\t\tconst scrollDelta = this._parent.scrollOffset - this._initialScrollOffset;\n\t\tconst deltaX = clientX - this._movingOffset.left;\n\t\tconst deltaY = clientY - this._movingOffset.top + scrollDelta;\n\n\t\tconst newWidth = Math.max(50, this._initialSize.width + deltaX);\n\t\tconst newHeight = Math.max(50, this._initialSize.height + deltaY);\n\n\t\tdom.setSize(this, { w: newWidth, h: newHeight });\n\t\tthis.dispatchEvent(new DashboardEvent('resize', {item: this, model: this.model}));\n\t}\n\n\t_onResize = () => {\n\t\tthis.dispatchEvent(new DashboardEvent('resize', {item: this, model: this.model}));\n\t};\n\n\tasync layout() {\n\t\tconst c = await this.component;\n\t\tif (c?.layout) c.layout();\n\t}\n\n\tshowOverlay(text: string = null, loader: boolean = false) {\n\t\tthis.overlay.text = text;\n\t\tthis.overlay.defaultLoader = loader;\n\t\tconst opacity = this.model.model.options.overlay?.opacity ?? 1;\n\t\tthis.overlay.style.opacity = opacity.toString();\n\t\tthis.overlay.show(this);\n\t\tif (opacity >= 1) dom.hideElement(this.container);\n\t}\n\n\thideOverlay() {\n\t\tthis.overlay.hide();\n\t\tdom.showElement(this.container);\n\t}\n\n\tasync updated() {\n\t\tthis.showOverlay(this.designMode ? this.model.title : null);\n\t\tconst component = await this.component;\n\t\tif (component) {\n\t\t\tdom.empty(this.container);\n\t\t\tthis.container.appendChild(component);\n\t\t}\n\t\t\t\n\t\tif (this.designMode) {\n\t\t\tthis.showOverlay(this.model.title, false);\n\t\t} else {\n\t\t\tthis.hideOverlay();\n\t\t}\n\t\t\n\t}\n\n\trender = () => html`\n\t\t<div class=\"container\"></div>\n\t\t<og-overlay></og-overlay>\n\t`;\n\n}"]}
1
+ {"version":3,"file":"dashboardItem.js","sourceRoot":"","sources":["../../src/ui/dashboardItem.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAkB,GAAG,EAAU,cAAc,EAAW,MAAM,iBAAiB,CAAC;AACvF,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAChC,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAEnE,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAGjD,IAAM,aAAa,GAAnB,MAAM,aAAc,SAAQ,cAAc;IA4ChD,IAAI,eAAe,KAAK,OAAO,IAAI,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ,CAAA,CAAC,CAAC;IAY9E,IAAI,WAAW,KAAK,OAAO,IAAI,CAAC,YAAY,CAAA,CAAC,CAAC;IAC9C,IAAI,MAAM,KAAK,OAAO,IAAI,CAAC,aAAa,KAAK,IAAI,CAAA,CAAC,CAAC;IACnD,IAAI,QAAQ,KA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AI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;QAC5D,MAAM,SAAS,GAAG,MAAM,IAAI,CAAC,SAAS,CAAC;QACvC,IAAI,SAAS,EAAE,CAAC;YACf,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;YAC1B,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC;QACvC,CAAC;QAED,IAAI,IAAI,CAAC,UAAU,EAAE,CAAC;YACrB,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;QAC3C,CAAC;aAAM,CAAC;YACP,IAAI,CAAC,WAAW,EAAE,CAAC;QACpB,CAAC;IAEF,CAAC;;AAjNM,oBAAM,GAAG,CAAC,cAAc,CAAC,MAAM,EAAE,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;EAsB1C,CAAC,AAtBW,CAsBV;AAGH;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,MAAM,EAAC,CAAC;iDACwB;AAGjD;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,MAAM,EAAC,CAAC;4CACC;AAG1B;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAC,CAAC;iDACtB;AAGnB;IADC,KAAK,CAAC,YAAY,CAAC;gDACM;AAG1B;IADC,KAAK,CAAC,YAAY,CAAC;8CACH;AAGjB;IADC,KAAK,CAAC,iBAAiB,CAAC;oDACK;AA1ClB,aAAa;IADzB,aAAa,CAAC,mBAAmB,CAAC;GACtB,aAAa,CA6NzB","sourcesContent":["import { ComponentStore, dom, Layout, OmegaComponent, Overlay } from \"@omegagrid/core\";\nimport { css, html } from \"lit\";\nimport { customElement, property, query } from \"lit/decorators.js\";\nimport { DashboardItemModel } from \"../model\";\nimport { Dashboard, DashboardEvent } from \"./dashboard\";\n\n@customElement('og-dashboard-item')\nexport class DashboardItem extends OmegaComponent implements Layout {\n\n\tstatic styles = [OmegaComponent.styles, css`\n\t\t:host {\n\t\t\tposition: relative;\n\t\t\toverflow: hidden;\n\t\t}\n\n\t\tog-overlay {\n\t\t\tposition: absolute;\n\t\t\tinset: 0;\n\t\t\tz-index: 1101;\n\t\t\tbackground-color: var(--og-accent-color);\n\t\t}\n\n\t\t.overlay-custom {\n\t\t\tposition: absolute;\n\t\t\tinset: 0;\n\t\t\tz-index: 1101;\n\t\t}\n\n\t\t.container {\n\t\t\theight: 100%;\n\t\t}\n\t`];\n\n\t@property({type: Object})\n\tcomponents: ComponentStore<HTMLElement & Layout>;\n\n\t@property({type: Object})\n\tmodel: DashboardItemModel;\n\n\t@property({type: Boolean, reflect: true})\n\tdesignMode = false;\n\n\t@query('.container')\n\tcontainer: HTMLDivElement;\n\n\t@query('og-overlay')\n\toverlay: Overlay;\n\n\t@query('.overlay-custom')\n\tcustomOverlay: HTMLDivElement;\n\n\tget overlayRenderer() { return this.model?.model?.options?.overlay?.renderer }\n\n\tprivate _parent: Dashboard;\n\tprivate _mouseOffset: {top: number, left: number} = null;\n\tprivate _movingOffset: {top: number, left: number} = null;\n\tprivate _resizing = false;\n\tprivate _elementOffset: {top: number, left: number} = null;\n\tprivate _resizeObserver: ResizeObserver;\n\tprivate _initialSize: {width: number, height: number} = null;\n\tprivate _initialScrollOffset = 0;\n\tprivate _lastMouseEvent: MouseEvent = null;\n\n\tget mouseOffset() { return this._mouseOffset }\n\tget moving() { return this._movingOffset !== null }\n\tget resizing() { return this._resizing }\n\n\n\tget component() {\n\t\tif (!this.model) return null;\n\t\tif (!this.components) return null;\n\t\treturn this.components.get(this.model.id);\n\t}\n\n\tconstructor() {\n\t\tsuper();\n\t\tthis.addEventListener('mousedown', this._onMouseDown);\n\t\tthis.addEventListener('mouseup', this._onMouseUp);\n\t\tthis._resizeObserver = new ResizeObserver(() => {\n\t\t\t// Only dispatch resize event if not manually resizing\n\t\t\tif (!this._resizing) {\n\t\t\t\tthis.dispatchEvent(new DashboardEvent('resize', {item: this, model: this.model}));\n\t\t\t}\n\t\t});\n\t}\n\n\tconnectedCallback() {\n\t\tsuper.connectedCallback();\n\t\tthis._resizeObserver.observe(this);\n\t\tthis._parent = dom.findParent<Dashboard>(this, elm => elm instanceof Dashboard);\n\t}\n\n\tdisconnectedCallback() {\n\t\tthis.clearEvents();\n\t\tthis._parent = null;\n\t\tthis._resizeObserver.unobserve(this);\n\t}\n\n\tclearEvents() {\n\t\tthis._parent.removeEventListener('mouseup', this._onMouseUp);\n\t\tthis._parent.removeEventListener('mousemove', this._onMouseMove);\n\t\tthis._parent.removeEventListener('mousemove', this._onMouseResize);\n\t}\n\n\t_onMouseUp = () => {\n\t\tif (this.resizing) {\n\t\t\tthis.dispatchEvent(new DashboardEvent('resizestop', {item: this, model: this.model}));\n\t\t} else if (this.moving) {\n\t\t\tthis.dispatchEvent(new DashboardEvent('movestop', {item: this, model: this.model}));\n\t\t}\n\n\t\tthis._movingOffset = null;\n\t\tthis._resizing = false;\n\t\tthis._initialSize = null;\n\t\tthis._lastMouseEvent = null;\n\t\tthis.clearEvents();\n\t};\n\n\t_onMouseDown = (e: MouseEvent) => {\n\t\tif (!this._parent.designMode) return;\n\t\tconst scrollOffset = this._parent.scrollOffset;\n\t\tthis._mouseOffset = {top: e.offsetY, left: e.offsetX};\n\t\tif (e.offsetX > this.offsetWidth - 20 && e.offsetY > this.offsetHeight - 20) {\n\t\t\tthis._resizing = true;\n\t\t\t// Store pure client coordinates - NO scroll offset for resize\n\t\t\tthis._movingOffset = {left: e.clientX, top: e.clientY};\n\t\t\tthis._initialSize = {width: this.offsetWidth, height: this.offsetHeight};\n\t\t\tthis._initialScrollOffset = scrollOffset;\n\t\t\tthis._parent.addEventListener('mouseup', this._onMouseUp);\n\t\t\tthis._parent.addEventListener('mousemove', this._onMouseResize);\n\t\t\tthis.dispatchEvent(new DashboardEvent('resizestart', {item: this, model: this.model}));\n\t\t} else {\n\t\t\tthis._movingOffset = {left: e.clientX, top: e.clientY + scrollOffset}; \n\t\t\tthis._elementOffset = {left: this.offsetLeft, top: this.offsetTop + scrollOffset};\n\t\t\tthis._parent.addEventListener('mouseup', this._onMouseUp);\n\t\t\tthis._parent.addEventListener('mousemove', this._onMouseMove);\n\t\t\tthis.dispatchEvent(new DashboardEvent('movestart', {item: this, model: this.model}));\n\t\t}\n\t};\n\n\t_onMouseMove = (e: MouseEvent) => {\n\t\tconst scrollOffset = this._parent.scrollOffset;\n\t\tdom.setPosition(this, {\n\t\t\tl: this._elementOffset.left + e.clientX - this._movingOffset.left,\n\t\t\tt: this._elementOffset.top + e.clientY - this._movingOffset.top + scrollOffset, \n\t\t});\n\t\tthis.dispatchEvent(new DashboardEvent('move', {item: this, model: this.model}));\n\t};\n\n\t_onMouseResize = (e: MouseEvent) => {\n\t\tthis._lastMouseEvent = e;\n\t\tthis._applyResize(e.clientX, e.clientY);\n\t};\n\n\t/** Re-trigger resize calculation with current scroll offset (called from autoscroll interval) */\n\tupdateResize() {\n\t\tif (this._lastMouseEvent) {\n\t\t\tthis._applyResize(this._lastMouseEvent.clientX, this._lastMouseEvent.clientY);\n\t\t}\n\t}\n\n\tprivate _applyResize(clientX: number, clientY: number) {\n\t\tconst scrollDelta = this._parent.scrollOffset - this._initialScrollOffset;\n\t\tconst deltaX = clientX - this._movingOffset.left;\n\t\tconst deltaY = clientY - this._movingOffset.top + scrollDelta;\n\n\t\tconst newWidth = Math.max(50, this._initialSize.width + deltaX);\n\t\tconst newHeight = Math.max(50, this._initialSize.height + deltaY);\n\n\t\tdom.setSize(this, { w: newWidth, h: newHeight });\n\t\tthis.dispatchEvent(new DashboardEvent('resize', {item: this, model: this.model}));\n\t}\n\n\t_onResize = () => {\n\t\tthis.dispatchEvent(new DashboardEvent('resize', {item: this, model: this.model}));\n\t};\n\n\tasync layout() {\n\t\tconst c = await this.component;\n\t\tif (c?.layout) c.layout();\n\t}\n\n\tshowOverlay(text: string = null, loader: boolean = false) {\n\t\tif (this.customOverlay) {\n\t\t\t// custom overlay appearance is fully controlled by the renderer\n\t\t\tdom.showElement(this.customOverlay);\n\t\t\tthis.overlayRenderer(this.customOverlay, this.model);\n\t\t\treturn;\n\t\t}\n\n\t\tthis.overlay.text = text;\n\t\tthis.overlay.defaultLoader = loader;\n\t\tconst opacity = this.model.model.options.overlay?.opacity ?? 1;\n\t\tthis.overlay.style.opacity = opacity.toString();\n\t\tthis.overlay.show(this);\n\t\tif (opacity >= 1) dom.hideElement(this.container);\n\t}\n\n\thideOverlay() {\n\t\tif (this.customOverlay) dom.hideElement(this.customOverlay);\n\t\tthis.overlay?.hide();\n\t\tdom.showElement(this.container);\n\t}\n\n\tasync updated() {\n\t\tthis.showOverlay(this.designMode ? this.model.title : null);\n\t\tconst component = await this.component;\n\t\tif (component) {\n\t\t\tdom.empty(this.container);\n\t\t\tthis.container.appendChild(component);\n\t\t}\n\t\t\t\n\t\tif (this.designMode) {\n\t\t\tthis.showOverlay(this.model.title, false);\n\t\t} else {\n\t\t\tthis.hideOverlay();\n\t\t}\n\t\t\n\t}\n\n\trender = () => html`\n\t\t<div class=\"container\"></div>\n\t\t${this.overlayRenderer\n\t\t\t? html`<div class=\"overlay-custom\" style=\"display: none\"></div>`\n\t\t\t: html`<og-overlay></og-overlay>`\n\t\t}\n\t`;\n\n}"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@omegagrid/dashboard",
3
- "version": "0.10.69",
3
+ "version": "0.10.70",
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.10.69",
32
- "@omegagrid/localize": "^0.10.69",
31
+ "@omegagrid/core": "^0.10.70",
32
+ "@omegagrid/localize": "^0.10.70",
33
33
  "date-fns": "^3.2.0",
34
34
  "lit": "^3.1.1",
35
35
  "ts-debounce": "^4.0.0"