@omegagrid/dashboard 0.9.46 → 0.9.48
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/ui/dashboard.d.ts +9 -0
- package/dist/ui/dashboard.d.ts.map +1 -1
- package/dist/ui/dashboard.js +168 -1
- package/dist/ui/dashboard.js.map +1 -1
- package/dist/ui/dashboard.style.d.ts.map +1 -1
- package/dist/ui/dashboard.style.js +1 -0
- package/dist/ui/dashboard.style.js.map +1 -1
- package/dist/ui/dashboardItem.d.ts +7 -0
- package/dist/ui/dashboardItem.d.ts.map +1 -1
- package/dist/ui/dashboardItem.js +35 -1
- package/dist/ui/dashboardItem.js.map +1 -1
- package/package.json +3 -3
package/dist/ui/dashboard.d.ts
CHANGED
|
@@ -20,16 +20,25 @@ export declare class Dashboard extends OmegaComponent implements Layout {
|
|
|
20
20
|
gridCanvas: HTMLCanvasElement;
|
|
21
21
|
private _currentItem;
|
|
22
22
|
private _previewPositions;
|
|
23
|
+
private _autoScrollInterval;
|
|
24
|
+
private _autoScrollSpeed;
|
|
25
|
+
private _isResizing;
|
|
23
26
|
readonly components: ComponentStore<HTMLElement & Layout>;
|
|
24
27
|
private _baseSize;
|
|
25
28
|
get baseSize(): Size;
|
|
26
29
|
startMove(item: DashboardItem): void;
|
|
30
|
+
startResize(item: DashboardItem): void;
|
|
27
31
|
stopMove(): void;
|
|
28
32
|
get scrollOffset(): number;
|
|
29
33
|
offsetToXCoord(offset: number): number;
|
|
30
34
|
offsetToYCoord(offset: number): number;
|
|
31
35
|
updatePreviewPositions(): void;
|
|
32
36
|
previewLayout(rect: Rect): void;
|
|
37
|
+
checkAutoScroll(item: DashboardItem): void;
|
|
38
|
+
checkResizeExpansion(item: DashboardItem): void;
|
|
39
|
+
startAutoScroll(): void;
|
|
40
|
+
stopAutoScroll(): void;
|
|
41
|
+
expandContentArea(): void;
|
|
33
42
|
_onItemMove: (e: DashboardEvent) => void;
|
|
34
43
|
_onItemResize: (e: DashboardEvent) => void;
|
|
35
44
|
constructor();
|
|
@@ -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,MAAM,EAAE,IAAI,EAAE,OAAO,CAAC,cAAc,CAAC;CAIvD;AAED,qBACa,SAAU,SAAQ,cAAe,YAAW,MAAM;IAE9D,MAAM,CAAC,MAAM,iCAAkC;IAG/C,KAAK,EAAE,cAAc,CAAC;IAGtB,UAAU,UAAS;IAGnB,MAAM,UAAS;IAGf,eAAe,EAAE,gBAAgB,CAAC;IAGlC,KAAK,EAAE,QAAQ,CAAC;IAGhB,SAAS,EAAE,SAAS,CAAC;IAGrB,OAAO,EAAE,cAAc,CAAC;IAGxB,WAAW,EAAE,cAAc,CAAC;IAG5B,UAAU,EAAE,iBAAiB,CAAC;IAE9B,OAAO,CAAC,YAAY,CAAgB;IACpC,OAAO,CAAC,iBAAiB,CAAS;
|
|
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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I,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,UASjC;;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,MAAM;IAcA,QAAQ;IAyCd,OAAO;IAIP,MAAM,kDAgBC;CAEP"}
|
package/dist/ui/dashboard.js
CHANGED
|
@@ -35,6 +35,13 @@ let Dashboard = class Dashboard extends OmegaComponent {
|
|
|
35
35
|
this._currentItem = item;
|
|
36
36
|
this._currentItem.classList.toggle('active', true);
|
|
37
37
|
this.classList.toggle('moving', true);
|
|
38
|
+
this._isResizing = false;
|
|
39
|
+
}
|
|
40
|
+
startResize(item) {
|
|
41
|
+
this._currentItem = item;
|
|
42
|
+
this._currentItem.classList.toggle('active', true);
|
|
43
|
+
this.classList.toggle('moving', true);
|
|
44
|
+
this._isResizing = true;
|
|
38
45
|
}
|
|
39
46
|
stopMove() {
|
|
40
47
|
if (!this._currentItem)
|
|
@@ -44,6 +51,7 @@ let Dashboard = class Dashboard extends OmegaComponent {
|
|
|
44
51
|
this.classList.toggle('moving', false);
|
|
45
52
|
this.hidePlaceholder();
|
|
46
53
|
this.updatePreviewPositions();
|
|
54
|
+
this.stopAutoScroll();
|
|
47
55
|
}
|
|
48
56
|
get scrollOffset() {
|
|
49
57
|
return this.container?.verticalSlider?.value || 0;
|
|
@@ -69,10 +77,167 @@ let Dashboard = class Dashboard extends OmegaComponent {
|
|
|
69
77
|
this.setItemPosition(item, rect);
|
|
70
78
|
});
|
|
71
79
|
}
|
|
80
|
+
checkAutoScroll(item) {
|
|
81
|
+
if (!this.container)
|
|
82
|
+
return;
|
|
83
|
+
// For resize, also expand content area preemptively so there's space to scroll into
|
|
84
|
+
if (this._isResizing) {
|
|
85
|
+
this.checkResizeExpansion(item);
|
|
86
|
+
}
|
|
87
|
+
const threshold = 50; // pixels from edge to trigger scroll
|
|
88
|
+
const scrollSpeed = 5; // pixels per frame
|
|
89
|
+
const containerRect = this.container.getBoundingClientRect();
|
|
90
|
+
const itemRect = item.getBoundingClientRect();
|
|
91
|
+
let scrollX = 0;
|
|
92
|
+
let scrollY = 0;
|
|
93
|
+
// Check horizontal scrolling
|
|
94
|
+
if (itemRect.right > containerRect.right - threshold) {
|
|
95
|
+
scrollX = scrollSpeed;
|
|
96
|
+
}
|
|
97
|
+
else if (itemRect.left < containerRect.left + threshold) {
|
|
98
|
+
scrollX = -scrollSpeed;
|
|
99
|
+
}
|
|
100
|
+
// Check vertical scrolling
|
|
101
|
+
if (itemRect.bottom > containerRect.bottom - threshold) {
|
|
102
|
+
scrollY = scrollSpeed;
|
|
103
|
+
}
|
|
104
|
+
else if (itemRect.top < containerRect.top + threshold) {
|
|
105
|
+
scrollY = -scrollSpeed;
|
|
106
|
+
}
|
|
107
|
+
this._autoScrollSpeed = { x: scrollX, y: scrollY };
|
|
108
|
+
if ((scrollX !== 0 || scrollY !== 0) && !this._autoScrollInterval) {
|
|
109
|
+
this.startAutoScroll();
|
|
110
|
+
}
|
|
111
|
+
else if (scrollX === 0 && scrollY === 0 && this._autoScrollInterval) {
|
|
112
|
+
this.stopAutoScroll();
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
checkResizeExpansion(item) {
|
|
116
|
+
if (!this.container || !this.model)
|
|
117
|
+
return;
|
|
118
|
+
const baseSize = this.baseSize;
|
|
119
|
+
const gap = this.model.options.gap;
|
|
120
|
+
// Item edges in content coordinates - offsetTop is already content-relative
|
|
121
|
+
const itemBottom = item.offsetTop + item.offsetHeight;
|
|
122
|
+
const itemRight = item.offsetLeft + item.offsetWidth;
|
|
123
|
+
const currentContentHeight = this.content.offsetHeight;
|
|
124
|
+
const currentContentWidth = this.content.offsetWidth;
|
|
125
|
+
// Threshold: expand when item is within 1 grid cell of the content edge
|
|
126
|
+
const thresholdY = baseSize.h + gap;
|
|
127
|
+
const thresholdX = baseSize.w + gap;
|
|
128
|
+
let newHeight = currentContentHeight;
|
|
129
|
+
let newWidth = currentContentWidth;
|
|
130
|
+
let needsUpdate = false;
|
|
131
|
+
if (itemBottom > currentContentHeight - thresholdY) {
|
|
132
|
+
newHeight = currentContentHeight + 5 * (baseSize.h + gap);
|
|
133
|
+
needsUpdate = true;
|
|
134
|
+
}
|
|
135
|
+
if (itemRight > currentContentWidth - thresholdX) {
|
|
136
|
+
newWidth = currentContentWidth + 5 * (baseSize.w + gap);
|
|
137
|
+
needsUpdate = true;
|
|
138
|
+
}
|
|
139
|
+
if (needsUpdate) {
|
|
140
|
+
dom.setSize(this.content, { w: newWidth, h: newHeight });
|
|
141
|
+
this.model.size.w = Math.max(this.model.size.w, Math.ceil((newWidth - gap) / (baseSize.w + gap)));
|
|
142
|
+
this.model.size.h = Math.max(this.model.size.h, Math.ceil((newHeight - gap) / (baseSize.h + gap)));
|
|
143
|
+
this.drawGrid();
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
startAutoScroll() {
|
|
147
|
+
if (this._autoScrollInterval)
|
|
148
|
+
return;
|
|
149
|
+
this._autoScrollInterval = window.setInterval(() => {
|
|
150
|
+
if (!this.container)
|
|
151
|
+
return;
|
|
152
|
+
const { x, y } = this._autoScrollSpeed;
|
|
153
|
+
// Scroll vertically
|
|
154
|
+
if (y !== 0 && this.container.verticalSlider) {
|
|
155
|
+
const currentScroll = this.container.verticalSlider.value;
|
|
156
|
+
const maxScroll = this.container.verticalSlider.maxValue;
|
|
157
|
+
// Expand content area if scrolling down near the bottom
|
|
158
|
+
if (y > 0 && currentScroll >= maxScroll * 0.85) {
|
|
159
|
+
this.expandContentArea();
|
|
160
|
+
// After expanding, continue scrolling
|
|
161
|
+
const newMaxScroll = this.container.verticalSlider.maxValue;
|
|
162
|
+
this.container.scrollVerticalTo(Math.min(newMaxScroll, currentScroll + y));
|
|
163
|
+
}
|
|
164
|
+
else {
|
|
165
|
+
const newScroll = Math.max(0, Math.min(maxScroll, currentScroll + y));
|
|
166
|
+
this.container.scrollVerticalTo(newScroll);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
// Scroll horizontally
|
|
170
|
+
if (x !== 0 && this.container.horizontalSlider) {
|
|
171
|
+
const currentScroll = this.container.horizontalSlider.value;
|
|
172
|
+
const maxScroll = this.container.horizontalSlider.maxValue;
|
|
173
|
+
// Expand content area if scrolling right near the edge
|
|
174
|
+
if (x > 0 && currentScroll >= maxScroll * 0.85) {
|
|
175
|
+
this.expandContentArea();
|
|
176
|
+
// After expanding, continue scrolling
|
|
177
|
+
const newMaxScroll = this.container.horizontalSlider.maxValue;
|
|
178
|
+
this.container.scrollHorizontalTo(Math.min(newMaxScroll, currentScroll + x));
|
|
179
|
+
}
|
|
180
|
+
else {
|
|
181
|
+
const newScroll = Math.max(0, Math.min(maxScroll, currentScroll + x));
|
|
182
|
+
this.container.scrollHorizontalTo(newScroll);
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
// During resize, update item size with new scroll offset so placeholder follows smoothly
|
|
186
|
+
if (this._isResizing && this._currentItem) {
|
|
187
|
+
this._currentItem.updateResize();
|
|
188
|
+
}
|
|
189
|
+
}, 16); // ~60fps
|
|
190
|
+
}
|
|
191
|
+
stopAutoScroll() {
|
|
192
|
+
if (this._autoScrollInterval) {
|
|
193
|
+
window.clearInterval(this._autoScrollInterval);
|
|
194
|
+
this._autoScrollInterval = null;
|
|
195
|
+
}
|
|
196
|
+
this._autoScrollSpeed = { x: 0, y: 0 };
|
|
197
|
+
}
|
|
198
|
+
expandContentArea() {
|
|
199
|
+
if (!this.model || !this._currentItem)
|
|
200
|
+
return;
|
|
201
|
+
// Calculate how much space we need based on current item position
|
|
202
|
+
const topOffset = this.scrollOffset;
|
|
203
|
+
const itemBottom = this._currentItem.offsetTop + this._currentItem.offsetHeight + topOffset;
|
|
204
|
+
const itemRight = this._currentItem.offsetLeft + this._currentItem.offsetWidth;
|
|
205
|
+
const currentContentHeight = this.content.offsetHeight;
|
|
206
|
+
const currentContentWidth = this.content.offsetWidth;
|
|
207
|
+
// Expand by 2 grid cells if needed
|
|
208
|
+
const expandRows = 2;
|
|
209
|
+
const expandCols = 2;
|
|
210
|
+
const baseSize = this.baseSize;
|
|
211
|
+
const gap = this.model.options.gap;
|
|
212
|
+
let newHeight = currentContentHeight;
|
|
213
|
+
let newWidth = currentContentWidth;
|
|
214
|
+
// Check if we need more height - only expand, never shrink
|
|
215
|
+
if (itemBottom > currentContentHeight - gap * 2) {
|
|
216
|
+
newHeight = Math.max(currentContentHeight, currentContentHeight + expandRows * (baseSize.h + gap));
|
|
217
|
+
}
|
|
218
|
+
// Check if we need more width - only expand, never shrink
|
|
219
|
+
if (itemRight > currentContentWidth - gap * 2) {
|
|
220
|
+
newWidth = Math.max(currentContentWidth, currentContentWidth + expandCols * (baseSize.w + gap));
|
|
221
|
+
}
|
|
222
|
+
// Only update if size actually changed
|
|
223
|
+
if (newHeight !== currentContentHeight || newWidth !== currentContentWidth) {
|
|
224
|
+
dom.setSize(this.content, { w: newWidth, h: newHeight });
|
|
225
|
+
// Update model size to match new content dimensions
|
|
226
|
+
const newModelWidth = Math.ceil((newWidth - gap) / (baseSize.w + gap));
|
|
227
|
+
const newModelHeight = Math.ceil((newHeight - gap) / (baseSize.h + gap));
|
|
228
|
+
// Only update if model size increased
|
|
229
|
+
this.model.size.w = Math.max(this.model.size.w, newModelWidth);
|
|
230
|
+
this.model.size.h = Math.max(this.model.size.h, newModelHeight);
|
|
231
|
+
this.drawGrid();
|
|
232
|
+
}
|
|
233
|
+
}
|
|
72
234
|
constructor() {
|
|
73
235
|
super();
|
|
74
236
|
this.designMode = false;
|
|
75
237
|
this.noGrid = false;
|
|
238
|
+
this._autoScrollInterval = null;
|
|
239
|
+
this._autoScrollSpeed = { x: 0, y: 0 };
|
|
240
|
+
this._isResizing = false;
|
|
76
241
|
this.components = new ComponentStore(id => this.createComponent ? this.createComponent(id) : null);
|
|
77
242
|
this._onItemMove = (e) => {
|
|
78
243
|
if (!e.item.moving)
|
|
@@ -83,6 +248,7 @@ let Dashboard = class Dashboard extends OmegaComponent {
|
|
|
83
248
|
const rect = { x, y, w: e.item.model.w, h: e.item.model.h };
|
|
84
249
|
this.showPlaceholder(rect);
|
|
85
250
|
this.previewLayout(rect);
|
|
251
|
+
this.checkAutoScroll(e.item);
|
|
86
252
|
};
|
|
87
253
|
this._onItemResize = (e) => {
|
|
88
254
|
if (!e.item.resizing)
|
|
@@ -93,6 +259,7 @@ let Dashboard = class Dashboard extends OmegaComponent {
|
|
|
93
259
|
const rect = { x: e.item.model.x, y: e.item.model.y, w, h };
|
|
94
260
|
this.showPlaceholder(rect);
|
|
95
261
|
this.previewLayout(rect);
|
|
262
|
+
this.checkAutoScroll(e.item);
|
|
96
263
|
};
|
|
97
264
|
this.render = () => this.model ? html `
|
|
98
265
|
<og-container>
|
|
@@ -112,7 +279,7 @@ let Dashboard = class Dashboard extends OmegaComponent {
|
|
|
112
279
|
</og-container>
|
|
113
280
|
` : '';
|
|
114
281
|
this.addEventListener('dashboard.movestart', (e) => this.startMove(e.item));
|
|
115
|
-
this.addEventListener('dashboard.resizestart', (e) => this.
|
|
282
|
+
this.addEventListener('dashboard.resizestart', (e) => this.startResize(e.item));
|
|
116
283
|
this.addEventListener('dashboard.movestop', () => this.stopMove());
|
|
117
284
|
this.addEventListener('dashboard.resizestop', () => this.stopMove());
|
|
118
285
|
this.addEventListener('dashboard.move', this._onItemMove);
|
package/dist/ui/dashboard.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dashboard.js","sourceRoot":"","sources":["../../src/ui/dashboard.ts"],"names":[],"mappings":";;;;;;AA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AAO,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,CAgPrB","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 { map } from 'lit/directives/map.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\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}\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}\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\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}\n\n\t_onItemResize = (e: DashboardEvent) => {\n\t\tif (!e.item.resizing) return;\n\t\tconst topOffset = this.scrollOffset;\n\t\tconst w = this.offsetToXCoord(e.item.offsetLeft + e.item.offsetWidth) - e.item.model.x + 1;\n\t\tconst h = this.offsetToYCoord(e.item.offsetTop + e.item.offsetHeight + topOffset) - e.item.model.y + 1;\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}\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.startMove(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\t\t\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: this.model.size.h * (this.baseSize.h + this.model.options.gap) + this.model.options.gap\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\t\t\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\t\n\trender = () => this.model ? html`\n\t\t<og-container>\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${map(this.model.items, 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}"]}
|
|
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,GAAG,EAAE,MAAM,uBAAuB,CAAC;AAC5C,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;A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,EAAE,CAAC,EAAE,EAAE,CAAC;YAChC,MAAM,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,GAAG,GAAG,CAAC,GAAG,GAAG,GAAG,CAAC,CAAC,GAAG,GAAG,CAAC;YAC7D,GAAG,CAAC,SAAS,EAAE,CAAC;YAChB,GAAG,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;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;;AA5ZM,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,CAkbrB","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 { map } from 'lit/directives/map.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\t\t\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\t\t\t\t\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\t\t\t\t\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\t\t\t\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\t\t\t\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\t\t\t\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 topOffset = this.scrollOffset;\n\t\tconst w = this.offsetToXCoord(e.item.offsetLeft + e.item.offsetWidth) - e.item.model.x + 1;\n\t\tconst h = this.offsetToYCoord(e.item.offsetTop + e.item.offsetHeight + topOffset) - e.item.model.y + 1;\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\t\t\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: this.model.size.h * (this.baseSize.h + this.model.options.gap) + this.model.options.gap\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\t\t\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\t\n\trender = () => this.model ? html`\n\t\t<og-container>\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${map(this.model.items, 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}"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dashboard.style.d.ts","sourceRoot":"","sources":["../../src/ui/dashboard.style.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,KAAK,
|
|
1
|
+
{"version":3,"file":"dashboard.style.d.ts","sourceRoot":"","sources":["../../src/ui/dashboard.style.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,KAAK,yBAyDjB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dashboard.style.js","sourceRoot":"","sources":["../../src/ui/dashboard.style.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE1B,MAAM,CAAC,MAAM,KAAK,GAAG,GAAG,CAAA
|
|
1
|
+
{"version":3,"file":"dashboard.style.js","sourceRoot":"","sources":["../../src/ui/dashboard.style.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE1B,MAAM,CAAC,MAAM,KAAK,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyDvB,CAAC","sourcesContent":["import { css } from 'lit';\n\nexport const style = css`\n\t:host {\n\t\tposition: relative;\n\t\toverflow: hidden;\n\t}\n\n\tog-container {\n\t\twidth: 100%;\n\t\theight: 100%;\n\t}\n\n\tog-dashboard-item {\n\t\t_border: 2px solid var(--og-accent-color);\n\t\tz-index: 100;\n\t\ttransition: left 0.2s, top 0.2s;\n\t}\n\n\tog-dashboard-item.active {\n\t\ttransition: none;\n\t}\n\n\t:host([designMode]) og-dashboard-item {\n\t\tcursor: move;\n\t\tresize: both;\n\t\tbackground-color: var(--og-accent-color);\n\t\tcolor: var(--og-text-color-2);\n\t}\n\t\n\t:host([designMode].moving) og-dashboard-item {\n\t\topacity: 0.6;\n\t}\n\n\t:host([designMode]) og-dashboard-item.active {\n\t\tborder: none;\n\t\tbackground-color: var(--og-accent-color);\n\t\tresize: none;\n\t}\n\n\t:host([designMode].moving) og-dashboard-item.active {\n\t\topacity: 1;\n\t}\n\t\n\t.item-placeholder {\n\t\tdisplay: none;\n\t\tborder: 2px dotted var(--og-accent-color);\n\t\ttransition: left 0.2s, top 0.2s, width 0.2s, height 0.2s;\n\t\tz-index: 99;\n\t}\n\n\t.item-grid {\n\t\tz-index: 98;\n\t\tposition: absolute;\n\t\ttop: 0;\n\t\tleft: 0;\n\t\twidth: 100%;\n\t\theight: 100%;\n\t}\n`;"]}
|
|
@@ -13,6 +13,9 @@ export declare class DashboardItem extends OmegaComponent implements Layout {
|
|
|
13
13
|
private _resizing;
|
|
14
14
|
private _elementOffset;
|
|
15
15
|
private _resizeObserver;
|
|
16
|
+
private _initialSize;
|
|
17
|
+
private _initialScrollOffset;
|
|
18
|
+
private _lastMouseEvent;
|
|
16
19
|
get mouseOffset(): {
|
|
17
20
|
top: number;
|
|
18
21
|
left: number;
|
|
@@ -27,6 +30,10 @@ export declare class DashboardItem extends OmegaComponent implements Layout {
|
|
|
27
30
|
_onMouseUp: () => void;
|
|
28
31
|
_onMouseDown: (e: MouseEvent) => void;
|
|
29
32
|
_onMouseMove: (e: MouseEvent) => void;
|
|
33
|
+
_onMouseResize: (e: MouseEvent) => void;
|
|
34
|
+
/** Re-trigger resize calculation with current scroll offset (called from autoscroll interval) */
|
|
35
|
+
updateResize(): void;
|
|
36
|
+
private _applyResize;
|
|
30
37
|
_onResize: () => void;
|
|
31
38
|
layout(): Promise<void>;
|
|
32
39
|
showOverlay(text?: string, loader?: boolean): void;
|
|
@@ -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,kBA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e,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;IASxD,WAAW;IAKL,OAAO;IAgBb,MAAM,6CAGJ;CAEF"}
|
package/dist/ui/dashboardItem.js
CHANGED
|
@@ -26,6 +26,9 @@ let DashboardItem = class DashboardItem extends OmegaComponent {
|
|
|
26
26
|
this._movingOffset = null;
|
|
27
27
|
this._resizing = false;
|
|
28
28
|
this._elementOffset = null;
|
|
29
|
+
this._initialSize = null;
|
|
30
|
+
this._initialScrollOffset = 0;
|
|
31
|
+
this._lastMouseEvent = null;
|
|
29
32
|
this._onMouseUp = () => {
|
|
30
33
|
if (this.resizing) {
|
|
31
34
|
this.dispatchEvent(new DashboardEvent('resizestop', { item: this, model: this.model }));
|
|
@@ -35,6 +38,8 @@ let DashboardItem = class DashboardItem extends OmegaComponent {
|
|
|
35
38
|
}
|
|
36
39
|
this._movingOffset = null;
|
|
37
40
|
this._resizing = false;
|
|
41
|
+
this._initialSize = null;
|
|
42
|
+
this._lastMouseEvent = null;
|
|
38
43
|
this.clearEvents();
|
|
39
44
|
};
|
|
40
45
|
this._onMouseDown = (e) => {
|
|
@@ -44,6 +49,12 @@ let DashboardItem = class DashboardItem extends OmegaComponent {
|
|
|
44
49
|
this._mouseOffset = { top: e.offsetY, left: e.offsetX };
|
|
45
50
|
if (e.offsetX > this.offsetWidth - 20 && e.offsetY > this.offsetHeight - 20) {
|
|
46
51
|
this._resizing = true;
|
|
52
|
+
// Store pure client coordinates - NO scroll offset for resize
|
|
53
|
+
this._movingOffset = { left: e.clientX, top: e.clientY };
|
|
54
|
+
this._initialSize = { width: this.offsetWidth, height: this.offsetHeight };
|
|
55
|
+
this._initialScrollOffset = scrollOffset;
|
|
56
|
+
this._parent.addEventListener('mouseup', this._onMouseUp);
|
|
57
|
+
this._parent.addEventListener('mousemove', this._onMouseResize);
|
|
47
58
|
this.dispatchEvent(new DashboardEvent('resizestart', { item: this, model: this.model }));
|
|
48
59
|
}
|
|
49
60
|
else {
|
|
@@ -62,6 +73,10 @@ let DashboardItem = class DashboardItem extends OmegaComponent {
|
|
|
62
73
|
});
|
|
63
74
|
this.dispatchEvent(new DashboardEvent('move', { item: this, model: this.model }));
|
|
64
75
|
};
|
|
76
|
+
this._onMouseResize = (e) => {
|
|
77
|
+
this._lastMouseEvent = e;
|
|
78
|
+
this._applyResize(e.clientX, e.clientY);
|
|
79
|
+
};
|
|
65
80
|
this._onResize = () => {
|
|
66
81
|
this.dispatchEvent(new DashboardEvent('resize', { item: this, model: this.model }));
|
|
67
82
|
};
|
|
@@ -72,7 +87,10 @@ let DashboardItem = class DashboardItem extends OmegaComponent {
|
|
|
72
87
|
this.addEventListener('mousedown', this._onMouseDown);
|
|
73
88
|
this.addEventListener('mouseup', this._onMouseUp);
|
|
74
89
|
this._resizeObserver = new ResizeObserver(() => {
|
|
75
|
-
|
|
90
|
+
// Only dispatch resize event if not manually resizing
|
|
91
|
+
if (!this._resizing) {
|
|
92
|
+
this.dispatchEvent(new DashboardEvent('resize', { item: this, model: this.model }));
|
|
93
|
+
}
|
|
76
94
|
});
|
|
77
95
|
}
|
|
78
96
|
connectedCallback() {
|
|
@@ -88,6 +106,22 @@ let DashboardItem = class DashboardItem extends OmegaComponent {
|
|
|
88
106
|
clearEvents() {
|
|
89
107
|
this._parent.removeEventListener('mouseup', this._onMouseUp);
|
|
90
108
|
this._parent.removeEventListener('mousemove', this._onMouseMove);
|
|
109
|
+
this._parent.removeEventListener('mousemove', this._onMouseResize);
|
|
110
|
+
}
|
|
111
|
+
/** Re-trigger resize calculation with current scroll offset (called from autoscroll interval) */
|
|
112
|
+
updateResize() {
|
|
113
|
+
if (this._lastMouseEvent) {
|
|
114
|
+
this._applyResize(this._lastMouseEvent.clientX, this._lastMouseEvent.clientY);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
_applyResize(clientX, clientY) {
|
|
118
|
+
const scrollDelta = this._parent.scrollOffset - this._initialScrollOffset;
|
|
119
|
+
const deltaX = clientX - this._movingOffset.left;
|
|
120
|
+
const deltaY = clientY - this._movingOffset.top + scrollDelta;
|
|
121
|
+
const newWidth = Math.max(50, this._initialSize.width + deltaX);
|
|
122
|
+
const newHeight = Math.max(50, this._initialSize.height + deltaY);
|
|
123
|
+
dom.setSize(this, { w: newWidth, h: newHeight });
|
|
124
|
+
this.dispatchEvent(new DashboardEvent('resize', { item: this, model: this.model }));
|
|
91
125
|
}
|
|
92
126
|
async layout() {
|
|
93
127
|
const c = await this.component;
|
|
@@ -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;IA0ChD,IAAI,WAAW,KAAK,OAAO,IAAI,CAAC,YAAY,CAAA,CAAC,CAAC;IAC9C,IAAI,MAAM,KAAK,OAAO,IA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AC,IAAI,CAAC,SAAS,CAAC,CAAC;IACjC,CAAC;IAED,KAAK,CAAC,OAAO;QACZ,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,IAAI,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;;AAvJM,oBAAM,GAAG,CAAC,cAAc,CAAC,MAAM,EAAE,GAAG,CAAA;;;;;;;;;;;;;;;;EAgB1C,CAAC,AAhBW,CAgBV;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;AAjCL,aAAa;IADzB,aAAa,CAAC,mBAAmB,CAAC;GACtB,aAAa,CAgKzB","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.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\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\tthis.dispatchEvent(new DashboardEvent('resize', {item: this, model: this.model}));\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}\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.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\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_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;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,KA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C,CAAC;aAAM,CAAC;YACP,IAAI,CAAC,WAAW,EAAE,CAAC;QACpB,CAAC;IAEF,CAAC;;AA9LM,oBAAM,GAAG,CAAC,cAAc,CAAC,MAAM,EAAE,GAAG,CAAA;;;;;;;;;;;;;;;;EAgB1C,CAAC,AAhBW,CAgBV;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;AAjCL,aAAa;IADzB,aAAa,CAAC,mBAAmB,CAAC;GACtB,aAAa,CAuMzB","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.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}"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@omegagrid/dashboard",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.48",
|
|
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.9.
|
|
32
|
-
"@omegagrid/localize": "^0.9.
|
|
31
|
+
"@omegagrid/core": "^0.9.48",
|
|
32
|
+
"@omegagrid/localize": "^0.9.48",
|
|
33
33
|
"date-fns": "^3.2.0",
|
|
34
34
|
"lit": "^3.1.1",
|
|
35
35
|
"ts-debounce": "^4.0.0"
|