@omegagrid/dialog 0.9.38 → 0.9.40
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/components/dialog.d.ts +15 -2
- package/dist/components/dialog.d.ts.map +1 -1
- package/dist/components/dialog.js +146 -35
- package/dist/components/dialog.js.map +1 -1
- package/dist/components/dialog.style.d.ts.map +1 -1
- package/dist/components/dialog.style.js +15 -20
- package/dist/components/dialog.style.js.map +1 -1
- package/dist/types.d.ts +1 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/package.json +2 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Layout, Overlay, VerticalPosition } from '@omegagrid/core';
|
|
1
|
+
import { Layout, Overlay, Position, VerticalPosition } from '@omegagrid/core';
|
|
2
2
|
import { LitElement } from 'lit';
|
|
3
3
|
import { DialogAlert, DialogButton, DialogLocation, DialogOptions } from '../types';
|
|
4
4
|
export declare class DialogEvent extends Event {
|
|
@@ -10,28 +10,39 @@ export declare class Dialog extends LitElement implements Layout {
|
|
|
10
10
|
static styles: import("lit").CSSResult[];
|
|
11
11
|
resizable: boolean;
|
|
12
12
|
closable: boolean;
|
|
13
|
+
maximizable: boolean;
|
|
13
14
|
scrollable: boolean;
|
|
14
15
|
disableButtons: boolean;
|
|
15
16
|
disableAutoclose: boolean;
|
|
16
17
|
buttonPosition: VerticalPosition;
|
|
17
18
|
alertPosition: VerticalPosition;
|
|
18
19
|
component: HTMLElement;
|
|
19
|
-
|
|
20
|
+
caption: string;
|
|
20
21
|
width: string | number;
|
|
21
22
|
height: string | number;
|
|
22
23
|
buttons: DialogButton[];
|
|
24
|
+
animation: number;
|
|
23
25
|
loaderVisible: boolean;
|
|
24
26
|
body: HTMLDivElement;
|
|
27
|
+
header: HTMLDivElement;
|
|
28
|
+
titleElm: HTMLDivElement;
|
|
25
29
|
loader: Overlay;
|
|
26
30
|
alerts: DialogAlert[];
|
|
27
31
|
private _parent;
|
|
32
|
+
private _animationRunning;
|
|
28
33
|
private _movingOffset;
|
|
29
34
|
private _elementOffset;
|
|
35
|
+
private _boundsBeforeMaximize;
|
|
36
|
+
get isMaximized(): boolean;
|
|
30
37
|
private _location;
|
|
31
38
|
set location(value: DialogLocation);
|
|
32
39
|
get location(): DialogLocation;
|
|
40
|
+
private _isOpen;
|
|
41
|
+
get isOpen(): boolean;
|
|
33
42
|
layout(): void;
|
|
34
43
|
_onKeyDown: (e: KeyboardEvent) => void;
|
|
44
|
+
maximize(): void;
|
|
45
|
+
toggleMaximize(): void;
|
|
35
46
|
constructor();
|
|
36
47
|
setOptions(options: DialogOptions): void;
|
|
37
48
|
getOptions(): DialogOptions;
|
|
@@ -49,7 +60,9 @@ export declare class Dialog extends LitElement implements Layout {
|
|
|
49
60
|
hideLoader(): void;
|
|
50
61
|
updated(props: Map<PropertyKey, unknown>): void;
|
|
51
62
|
render: () => import("lit-html").TemplateResult<1>;
|
|
63
|
+
calculatePosition(): Position;
|
|
52
64
|
positionDialog(location: DialogLocation): void;
|
|
65
|
+
animatePositionDialog(location: DialogLocation, seconds: number): void;
|
|
53
66
|
open(parent: HTMLElement, location?: DialogLocation): void;
|
|
54
67
|
close(dispatchEvent?: boolean): void;
|
|
55
68
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dialog.d.ts","sourceRoot":"","sources":["../../src/components/dialog.ts"],"names":[],"mappings":"AAAA,OAAO,EAAO,MAAM,
|
|
1
|
+
{"version":3,"file":"dialog.d.ts","sourceRoot":"","sources":["../../src/components/dialog.ts"],"names":[],"mappings":"AAAA,OAAO,EAAO,MAAM,EAAQ,OAAO,EAAE,QAAQ,EAAS,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAChG,OAAO,EAAE,UAAU,EAAQ,MAAM,KAAK,CAAC;AAGvC,OAAO,EAAE,WAAW,EAAE,YAAY,EAAsB,cAAc,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAWxG,qB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R,cAAc;;IAmBd,UAAU,CAAC,OAAO,EAAE,aAAa;IAKjC,UAAU,IAAI,aAAa;IAkB3B,YAAY;IAIZ,MAAM;IASN,QAAQ,CAAC,KAAK,EAAE,WAAW;IAM3B,WAAW;IAIX,oBAAoB;IAIpB,WAAW;IAKX,gBAAgB,aAEd;IAEF,kBAAkB,GAAI,GAAG,UAAU,UAKjC;IAEF,kBAAkB,GAAI,GAAG,UAAU,UAOjC;IAEF,QAAQ,GAAI,KAAK,YAAY,UAG5B;IAED,UAAU;IAKV,UAAU;IAKV,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,WAAW,EAAE,OAAO,CAAC;IAkBxC,MAAM,6CA6CL;IAED,iBAAiB,IAAI,QAAQ;IA0B7B,cAAc,CAAC,QAAQ,EAAE,cAAc;IAMvC,qBAAqB,CAAC,QAAQ,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM;IAsC/D,IAAI,CAAC,MAAM,EAAE,WAAW,EAAE,QAAQ,CAAC,EAAE,cAAc;IAenD,KAAK,CAAC,aAAa,UAAO;CAM1B"}
|
|
@@ -24,31 +24,65 @@ export class DialogEvent extends Event {
|
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
26
|
let Dialog = class Dialog extends LitElement {
|
|
27
|
+
get isMaximized() { return this._boundsBeforeMaximize != null; }
|
|
27
28
|
set location(value) { this.positionDialog(value); }
|
|
28
29
|
get location() {
|
|
29
30
|
if (this._location == null)
|
|
30
31
|
this._location = { x: this.offsetLeft, y: this.offsetTop };
|
|
31
32
|
return this._location;
|
|
32
33
|
}
|
|
34
|
+
get isOpen() { return this._isOpen; }
|
|
33
35
|
layout() {
|
|
34
|
-
if (this.component
|
|
35
|
-
|
|
36
|
+
if (!this.component || !this.component.layout)
|
|
37
|
+
return;
|
|
38
|
+
this.component.layout({
|
|
39
|
+
parent: this,
|
|
40
|
+
elements: new Map([
|
|
41
|
+
['body', this.body],
|
|
42
|
+
['header', this.header],
|
|
43
|
+
['title', this.titleElm]
|
|
44
|
+
])
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
maximize() {
|
|
48
|
+
if (this._boundsBeforeMaximize)
|
|
49
|
+
return;
|
|
50
|
+
this._boundsBeforeMaximize = dom.getBounds(this);
|
|
51
|
+
dom.setBounds(this, {
|
|
52
|
+
x: 0,
|
|
53
|
+
y: 0,
|
|
54
|
+
w: this._parent.clientWidth,
|
|
55
|
+
h: this._parent.clientHeight
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
toggleMaximize() {
|
|
59
|
+
if (this._boundsBeforeMaximize) {
|
|
60
|
+
dom.setBounds(this, this._boundsBeforeMaximize);
|
|
61
|
+
this._boundsBeforeMaximize = null;
|
|
62
|
+
}
|
|
63
|
+
else {
|
|
64
|
+
this.maximize();
|
|
36
65
|
}
|
|
37
66
|
}
|
|
38
67
|
constructor() {
|
|
39
68
|
super();
|
|
40
69
|
this.resizable = false;
|
|
41
70
|
this.closable = false;
|
|
71
|
+
this.maximizable = false;
|
|
42
72
|
this.scrollable = false;
|
|
43
73
|
this.disableButtons = false;
|
|
44
74
|
this.disableAutoclose = false;
|
|
45
75
|
this.buttonPosition = 'bottom';
|
|
46
76
|
this.alertPosition = 'top';
|
|
47
77
|
this.buttons = [];
|
|
78
|
+
this.animation = 0.2;
|
|
48
79
|
this.loaderVisible = false;
|
|
49
80
|
this.alerts = [];
|
|
81
|
+
this._animationRunning = false;
|
|
50
82
|
this._movingOffset = null;
|
|
51
83
|
this._elementOffset = null;
|
|
84
|
+
this._boundsBeforeMaximize = null;
|
|
85
|
+
this._isOpen = false;
|
|
52
86
|
this._onKeyDown = (e) => {
|
|
53
87
|
switch (e.key) {
|
|
54
88
|
case 'Enter':
|
|
@@ -95,14 +129,19 @@ let Dialog = class Dialog extends LitElement {
|
|
|
95
129
|
<og-alert .text="${alert.text}" .type="${alert.type}" closable></og-alert>
|
|
96
130
|
`);
|
|
97
131
|
return html `
|
|
98
|
-
<div
|
|
99
|
-
<div
|
|
100
|
-
${this.
|
|
132
|
+
<div class="header" @mousedown="${this._onHeaderMouseDown}">
|
|
133
|
+
<div class="title">${this.caption ? html `${this.caption}` : html `<slot name="header"></slot>`}</div>
|
|
134
|
+
${this.maximizable ? html `<og-button color="transparent" icon="window-maximize" @click="${() => this.toggleMaximize()}"></og-button>` : ``}
|
|
135
|
+
${this.closable ? html `<og-close @click="${() => this.close()}"></og-close>` : ``}
|
|
101
136
|
</div>
|
|
102
|
-
|
|
103
|
-
${this.
|
|
104
|
-
|
|
137
|
+
|
|
138
|
+
${this.buttons.length > 0 && this.buttonPosition == 'top' ? html `<div class="buttons">${buttons}</div>` : ``}
|
|
139
|
+
|
|
140
|
+
${this.alerts.length > 0 && this.alertPosition == 'top' ? html `<div class="alerts">${alerts}</div>` : ``}
|
|
141
|
+
|
|
142
|
+
<div class="body">
|
|
105
143
|
${this.loaderVisible ? html `<og-overlay defaultLoader></og-overlay>` : ``}
|
|
144
|
+
|
|
106
145
|
${this.scrollable ? html `
|
|
107
146
|
<og-container>
|
|
108
147
|
${this.component
|
|
@@ -115,20 +154,28 @@ let Dialog = class Dialog extends LitElement {
|
|
|
115
154
|
: html `<slot name="content"></slot>`}
|
|
116
155
|
`}
|
|
117
156
|
</div>
|
|
118
|
-
|
|
119
|
-
${this.
|
|
157
|
+
|
|
158
|
+
${this.alerts.length > 0 && this.alertPosition == 'bottom' ? html `<div class="alerts">${alerts}</div>` : ``}
|
|
159
|
+
|
|
160
|
+
${this.buttons.length > 0 && this.buttonPosition == 'bottom' ? html `<div class="buttons">${buttons}</div>` : ``}
|
|
120
161
|
`;
|
|
121
162
|
};
|
|
122
163
|
this.addEventListener('keydown', this._onKeyDown);
|
|
123
|
-
(new ResizeObserver(() =>
|
|
164
|
+
(new ResizeObserver(() => {
|
|
165
|
+
if (this._animationRunning)
|
|
166
|
+
return;
|
|
167
|
+
this.layout();
|
|
168
|
+
this.dispatchEvent(new DialogEvent('resize', this, null));
|
|
169
|
+
})).observe(this);
|
|
124
170
|
}
|
|
125
171
|
setOptions(options) {
|
|
126
172
|
Object.assign(this, options);
|
|
127
173
|
this.requestUpdate();
|
|
128
174
|
}
|
|
129
175
|
getOptions() {
|
|
176
|
+
const bounds = dom.getBounds(this);
|
|
130
177
|
return {
|
|
131
|
-
|
|
178
|
+
caption: this.caption,
|
|
132
179
|
buttons: this.buttons,
|
|
133
180
|
disableButtons: this.disableButtons,
|
|
134
181
|
disableAutoclose: this.disableAutoclose,
|
|
@@ -137,9 +184,9 @@ let Dialog = class Dialog extends LitElement {
|
|
|
137
184
|
closable: this.closable,
|
|
138
185
|
resizable: this.resizable,
|
|
139
186
|
scrollable: this.scrollable,
|
|
140
|
-
width:
|
|
141
|
-
height:
|
|
142
|
-
location:
|
|
187
|
+
width: bounds.w,
|
|
188
|
+
height: bounds.h,
|
|
189
|
+
location: { x: bounds.x, y: bounds.y }
|
|
143
190
|
};
|
|
144
191
|
}
|
|
145
192
|
firstUpdated() {
|
|
@@ -177,7 +224,7 @@ let Dialog = class Dialog extends LitElement {
|
|
|
177
224
|
this.disableButtons = false;
|
|
178
225
|
}
|
|
179
226
|
updated(props) {
|
|
180
|
-
if (this.loaderVisible && this.loader) {
|
|
227
|
+
if (this.loaderVisible && this.loader && this.body) {
|
|
181
228
|
this.loader.show(this.body);
|
|
182
229
|
}
|
|
183
230
|
if (props.has('width') && this.width) {
|
|
@@ -186,50 +233,102 @@ let Dialog = class Dialog extends LitElement {
|
|
|
186
233
|
if (props.has('height') && this.height) {
|
|
187
234
|
dom.setSize(this, { h: this.height });
|
|
188
235
|
}
|
|
236
|
+
if (props.has('component')) {
|
|
237
|
+
this.layout();
|
|
238
|
+
}
|
|
189
239
|
}
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
240
|
+
calculatePosition() {
|
|
241
|
+
const location = this.location;
|
|
242
|
+
const position = {};
|
|
243
|
+
if (location == 'center') {
|
|
244
|
+
position.l = this._parent.clientWidth / 2 - this.offsetWidth / 2;
|
|
245
|
+
position.t = this._parent.clientHeight / 2 - this.offsetHeight / 2;
|
|
246
|
+
}
|
|
196
247
|
else {
|
|
197
248
|
if (utils.isString(location.x)) {
|
|
198
249
|
if (location.x == 'left')
|
|
199
|
-
|
|
250
|
+
position.l = 0;
|
|
200
251
|
else if (location.x == 'right')
|
|
201
|
-
|
|
252
|
+
position.l = this._parent.clientWidth - this.offsetWidth;
|
|
202
253
|
else
|
|
203
|
-
|
|
254
|
+
position.l = this._parent.clientWidth / 2 - this.offsetWidth / 2;
|
|
204
255
|
}
|
|
205
256
|
else {
|
|
206
|
-
|
|
257
|
+
position.l = location.x;
|
|
207
258
|
}
|
|
208
259
|
if (utils.isString(location.y)) {
|
|
209
260
|
if (location.y == 'top')
|
|
210
|
-
|
|
261
|
+
position.t = 0;
|
|
211
262
|
else if (location.y == 'bottom')
|
|
212
|
-
|
|
263
|
+
position.t = this._parent.clientHeight - this.offsetHeight;
|
|
213
264
|
else
|
|
214
|
-
|
|
265
|
+
position.t = this._parent.clientHeight / 2 - this.offsetHeight / 2;
|
|
215
266
|
}
|
|
216
267
|
else {
|
|
217
|
-
|
|
268
|
+
position.t = location.y;
|
|
218
269
|
}
|
|
219
270
|
}
|
|
271
|
+
return position;
|
|
272
|
+
}
|
|
273
|
+
positionDialog(location) {
|
|
274
|
+
this._location = location;
|
|
275
|
+
if (!this._parent)
|
|
276
|
+
return;
|
|
277
|
+
dom.setPosition(this, this.calculatePosition());
|
|
278
|
+
}
|
|
279
|
+
animatePositionDialog(location, seconds) {
|
|
280
|
+
this._location = location;
|
|
281
|
+
this.style.visibility = 'hidden';
|
|
282
|
+
dom.showElement(this, this.scrollable || this.height ? 'flex' : 'block');
|
|
283
|
+
const position = this.calculatePosition();
|
|
284
|
+
const bounds = dom.getBounds(this);
|
|
285
|
+
this._animationRunning = true;
|
|
286
|
+
dom.setBounds(this, {
|
|
287
|
+
x: position.l + bounds.w / 2,
|
|
288
|
+
y: position.t + bounds.h / 2,
|
|
289
|
+
w: 0,
|
|
290
|
+
h: 0
|
|
291
|
+
});
|
|
292
|
+
setTimeout(() => {
|
|
293
|
+
this.style.visibility = 'visible';
|
|
294
|
+
this.style.transition = [
|
|
295
|
+
`top ${seconds}s ease-in-out`,
|
|
296
|
+
`left ${seconds}s ease-in-out`,
|
|
297
|
+
`width ${seconds}s ease-in-out`,
|
|
298
|
+
`height ${seconds}s ease-in-out`
|
|
299
|
+
].join(',');
|
|
300
|
+
setTimeout(() => dom.setBounds(this, {
|
|
301
|
+
x: position.l,
|
|
302
|
+
y: position.t,
|
|
303
|
+
w: bounds.w,
|
|
304
|
+
h: bounds.h
|
|
305
|
+
}), 0);
|
|
306
|
+
setTimeout(() => {
|
|
307
|
+
this.style.transition = '';
|
|
308
|
+
this._animationRunning = false;
|
|
309
|
+
}, seconds * 1000);
|
|
310
|
+
}, 1);
|
|
220
311
|
}
|
|
221
312
|
open(parent, location) {
|
|
222
313
|
this._parent = parent;
|
|
223
314
|
location = location || this.location || 'center';
|
|
224
|
-
console.log(location);
|
|
225
315
|
(parent.shadowRoot ? parent.shadowRoot : parent).appendChild(this);
|
|
226
|
-
|
|
227
|
-
|
|
316
|
+
this.updateComplete.then(() => {
|
|
317
|
+
if (this.animation > 0) {
|
|
318
|
+
this.animatePositionDialog(location, this.animation);
|
|
319
|
+
}
|
|
320
|
+
else {
|
|
321
|
+
dom.showElement(this, this.scrollable || this.height ? 'flex' : 'block');
|
|
322
|
+
this.positionDialog(location);
|
|
323
|
+
}
|
|
324
|
+
});
|
|
325
|
+
this._isOpen = true;
|
|
228
326
|
}
|
|
229
327
|
close(dispatchEvent = true) {
|
|
230
328
|
dom.remove(this);
|
|
231
329
|
if (dispatchEvent)
|
|
232
330
|
this.dispatchEvent(new DialogEvent('close', this, null));
|
|
331
|
+
this._isOpen = false;
|
|
233
332
|
}
|
|
234
333
|
};
|
|
235
334
|
Dialog.styles = [style];
|
|
@@ -239,6 +338,9 @@ __decorate([
|
|
|
239
338
|
__decorate([
|
|
240
339
|
property({ type: Boolean, reflect: true })
|
|
241
340
|
], Dialog.prototype, "closable", void 0);
|
|
341
|
+
__decorate([
|
|
342
|
+
property({ type: Boolean, reflect: true })
|
|
343
|
+
], Dialog.prototype, "maximizable", void 0);
|
|
242
344
|
__decorate([
|
|
243
345
|
property({ type: Boolean, reflect: true })
|
|
244
346
|
], Dialog.prototype, "scrollable", void 0);
|
|
@@ -259,7 +361,7 @@ __decorate([
|
|
|
259
361
|
], Dialog.prototype, "component", void 0);
|
|
260
362
|
__decorate([
|
|
261
363
|
property({ type: String })
|
|
262
|
-
], Dialog.prototype, "
|
|
364
|
+
], Dialog.prototype, "caption", void 0);
|
|
263
365
|
__decorate([
|
|
264
366
|
property({ type: String, reflect: true })
|
|
265
367
|
], Dialog.prototype, "width", void 0);
|
|
@@ -269,12 +371,21 @@ __decorate([
|
|
|
269
371
|
__decorate([
|
|
270
372
|
property({ type: Array })
|
|
271
373
|
], Dialog.prototype, "buttons", void 0);
|
|
374
|
+
__decorate([
|
|
375
|
+
property({ type: Number })
|
|
376
|
+
], Dialog.prototype, "animation", void 0);
|
|
272
377
|
__decorate([
|
|
273
378
|
state()
|
|
274
379
|
], Dialog.prototype, "loaderVisible", void 0);
|
|
275
380
|
__decorate([
|
|
276
|
-
query('
|
|
381
|
+
query('.body')
|
|
277
382
|
], Dialog.prototype, "body", void 0);
|
|
383
|
+
__decorate([
|
|
384
|
+
query('.header')
|
|
385
|
+
], Dialog.prototype, "header", void 0);
|
|
386
|
+
__decorate([
|
|
387
|
+
query('.title')
|
|
388
|
+
], Dialog.prototype, "titleElm", void 0);
|
|
278
389
|
__decorate([
|
|
279
390
|
query('og-overlay')
|
|
280
391
|
], Dialog.prototype, "loader", void 0);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dialog.js","sourceRoot":"","sources":["../../src/components/dialog.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,GAAG,EAAmB,KAAK,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,EAAC,IAAI,EAAE,MAAM,EAAC,CAAC;sCACV;AAGf;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAC,CAAC;qCACnB;AAGrB;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAC,CAAC;sCAClB;AAGtB;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,KAAK,EAAC,CAAC;uCACK;AAG7B;IADC,KAAK,EAAE;6CACc;AAGtB;IADC,KAAK,CAAC,OAAO,CAAC;oCACM;AAGrB;IADC,KAAK,CAAC,YAAY,CAAC;sCACJ;AAGhB;IADC,KAAK,EAAE;sCACmB;AAlDf,MAAM;IADlB,aAAa,CAAC,WAAW,CAAC;GACd,MAAM,CA2QlB","sourcesContent":["import { dom, Layout, Overlay, utils, VerticalPosition } from '@omegagrid/core';\nimport { LitElement, html } from 'lit';\nimport { customElement, property, query, state } from 'lit/decorators.js';\nimport { map } from 'lit/directives/map.js';\nimport { DialogAlert, DialogButton, DialogButtonConfig, DialogLocation, DialogOptions } from '../types';\nimport { style } from './dialog.style';\n\nconst DEFAULT_BUTTON_CONFIG = new Map<DialogButton, DialogButtonConfig>([\n\t['ok', {type: 'ok', text: 'OK', default: true}],\n\t['cancel', {type: 'cancel', text: 'Cancel'}],\n\t['yes', {type: 'yes', text: 'Yes'}],\n\t['no', {type: 'no', text: 'No'}],\n\t['close', {type: 'close', text: 'Close'}]\n]);\n\nexport class DialogEvent extends Event {\n\t\n\tconstructor(\n\t\ttype: string,\n\t\tpublic readonly dialog: Dialog,\n\t\tpublic readonly button: DialogButton\n\t) {\n\t\tsuper(`dialog.${type}`, {bubbles: true, composed: true, cancelable: true});\n\t}\n\n}\n\n@customElement('og-dialog')\nexport class Dialog extends LitElement implements Layout {\n\n\tstatic styles = [style];\n\n\t@property({type: Boolean, reflect: true})\n\tresizable = false;\n\n\t@property({type: Boolean, reflect: true})\n\tclosable = false;\n\n\t@property({type: Boolean, reflect: true})\n\tscrollable = false;\n\n\t@property({type: Boolean, reflect: true})\n\tdisableButtons = false;\n\n\t@property({type: Boolean, reflect: true})\n\tdisableAutoclose = false;\n\n\t@property({type: String, reflect: true})\n\tbuttonPosition: VerticalPosition = 'bottom';\n\n\t@property({type: String, reflect: true})\n\talertPosition: VerticalPosition = 'top';\n\n\t@property({type: Object})\n\tcomponent: HTMLElement;\n\n\t@property({type: String})\n\theader: string;\n\n\t@property({type: String, reflect: true})\n\twidth: string|number;\n\n\t@property({type: String, reflect: true})\n\theight: string|number;\n\n\t@property({type: Array})\n\tbuttons: DialogButton[] = [];\n\n\t@state()\n\tloaderVisible = false;\n\n\t@query('#body')\n\tbody: HTMLDivElement;\n\n\t@query('og-overlay')\n\tloader: Overlay;\n\n\t@state()\n\talerts: DialogAlert[] = [];\n\n\tprivate _parent: HTMLElement;\n\tprivate _movingOffset: {top: number, left: number} = null;\n\tprivate _elementOffset: {top: number, left: number} = null;\n\t\n\tprivate _location: DialogLocation;\n\tset location(value: DialogLocation) { this.positionDialog(value) }\n\tget location() {\n\t\tif (this._location == null) this._location = {x: this.offsetLeft, y: this.offsetTop}\n\t\treturn this._location;\n\t}\n\n\t\n\tlayout() {\n\t\tif (this.component && (this.component as Layout).layout) {\n\t\t\t(this.component as Layout).layout();\n\t\t}\n\t}\n\n\t_onKeyDown = (e: KeyboardEvent) => {\n\t\tswitch (e.key) {\n\t\t\tcase 'Enter':\n\t\t\t\tthis.submit();\n\t\t\t\tbreak;\n\t\t\tcase 'Escape':\n\t\t\t\tif (this.closable) this.close();\n\t\t\t\tbreak;\n\t\t}\n\t}\n\n\tconstructor() {\n\t\tsuper();\n\t\tthis.addEventListener('keydown', this._onKeyDown);\n\t\t(new ResizeObserver(() => this.layout())).observe(this);\n\t}\n\n\tsetOptions(options: DialogOptions) {\n\t\tObject.assign(this, options);\n\t\tthis.requestUpdate();\n\t}\n\n\tgetOptions(): DialogOptions {\n\t\treturn {\n\t\t\theader: this.header,\n\t\t\tbuttons: this.buttons,\n\t\t\tdisableButtons: this.disableButtons,\n\t\t\tdisableAutoclose: this.disableAutoclose,\n\t\t\tbuttonPosition: this.buttonPosition,\n\t\t\talertPosition: this.alertPosition,\n\t\t\tclosable: this.closable,\n\t\t\tresizable: this.resizable,\n\t\t\tscrollable: this.scrollable,\n\t\t\twidth: this.width,\n\t\t\theight: this.height,\n\t\t\tlocation: this.location\n\t\t};\n\t}\n\n\tfirstUpdated() {\n\t\tthis.tabIndex = 0;\n\t}\n\n\tsubmit() {\n\t\tfor (const btn of this.buttons) {\n\t\t\tif (DEFAULT_BUTTON_CONFIG.get(btn).default) {\n\t\t\t\tthis._onClick(btn);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\n\taddAlert(alert: DialogAlert) {\n\t\tconst alerts = [...this.alerts];\n\t\talerts.push(alert);\n\t\tthis.alerts = alerts;\n\t}\n\n\tclearAlerts() {\n\t\tthis.alerts = [];\n\t}\n\n\tdisconnectedCallback() {\n\t\tthis.clearEvents();\n\t}\n\n\tclearEvents() {\n\t\tthis._parent.removeEventListener('mouseup', this._onParentMouseUp);\n\t\tthis._parent.removeEventListener('mousemove', this._onParentMouseMove);\n\t}\n\n\t_onParentMouseUp = () => {\n\t\tthis.clearEvents();\n\t};\n\n\t_onHeaderMouseDown = (e: MouseEvent) => {\n\t\tthis._movingOffset = {left: e.clientX, top: e.clientY}; \n\t\tthis._elementOffset = {left: this.offsetLeft, top: this.offsetTop};\n\t\tthis._parent.addEventListener('mouseup', this._onParentMouseUp);\n\t\tthis._parent.addEventListener('mousemove', this._onParentMouseMove);\n\t};\n\n\t_onParentMouseMove = (e: MouseEvent) => {\n\t\tthis._location = null;\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, \n\t\t});\n\t\tthis.dispatchEvent(new DialogEvent('move', this, null));\n\t};\n\n\t_onClick = (btn: DialogButton) => {\n\t\tconst res = this.dispatchEvent(new DialogEvent('click', this, btn));\n\t\tif (res && !this.disableAutoclose) this.close();\n\t}\n\n\tshowLoader() {\n\t\tthis.loaderVisible = true;\n\t\tthis.disableButtons = true;\n\t}\n\n\thideLoader() {\n\t\tthis.loaderVisible = false;\n\t\tthis.disableButtons = false;\n\t}\n\n\tupdated(props: Map<PropertyKey, unknown>) {\n\t\tif (this.loaderVisible && this.loader) {\n\t\t\tthis.loader.show(this.body);\n\t\t}\n\n\t\tif (props.has('width') && this.width) {\n\t\t\tdom.setSize(this, {w: this.width});\n\t\t}\n\n\t\tif (props.has('height') && this.height) {\n\t\t\tdom.setSize(this, {h: this.height});\n\t\t}\n\t}\n\n\trender = () => {\n\t\tconst buttons = map(this.buttons, btn => html`\n\t\t\t<og-button \n\t\t\t\t.text=\"${DEFAULT_BUTTON_CONFIG.get(btn).text}\"\n\t\t\t\t@click=\"${() => this._onClick(btn)}\"\n\t\t\t\t?disabled=\"${this.disableButtons}\"\n\t\t\t\t?default=\"${DEFAULT_BUTTON_CONFIG.get(btn).default}\">\n\t\t\t</og-button>\n\t\t`);\n\n\t\tconst alerts = map(this.alerts, alert => html`\n\t\t\t<og-alert .text=\"${alert.text}\" .type=\"${alert.type}\" closable></og-alert>\n\t\t`);\n\n\t\treturn html`\n\t\t\t<div id=\"header\" @mousedown=\"${this._onHeaderMouseDown}\">\n\t\t\t\t<div id=\"title\">${this.header ? html`${this.header}` : html`<slot name=\"header\"></slot>`}</div>\n\t\t\t\t${this.closable ? html`<div id=\"close\" @click=\"${() => this.close()}\">×</div>` : ``}\n\t\t\t</div>\n\t\t\t${this.buttons.length > 0 && this.buttonPosition == 'top' ? html`<div id=\"buttons\">${buttons}</div>` : ``}\n\t\t\t${this.alerts.length > 0 && this.alertPosition == 'top' ? html`<div id=\"alerts\">${alerts}</div>` : ``}\n\t\t\t<div id=\"body\">\n\t\t\t\t${this.loaderVisible ? html`<og-overlay defaultLoader></og-overlay>` : ``}\n\t\t\t\t${this.scrollable ? html`\n\t\t\t\t\t<og-container>\n\t\t\t\t\t\t${this.component\n\t\t\t\t\t\t\t? html`<div slot=\"content\">${this.component}</div>`\n\t\t\t\t\t\t\t: html`<slot name=\"content\" slot=\"content\"></slot>`}\n\t\t\t\t\t</og-container>\n\t\t\t\t` : html`\n\t\t\t\t\t${this.component\n\t\t\t\t\t\t? html`<div slot=\"content\" style=\"height: 100%\">${this.component}</div>`\n\t\t\t\t\t\t: html`<slot name=\"content\"></slot>`}\n\t\t\t\t`}\n\t\t\t</div>\n\t\t\t${this.alerts.length > 0 && this.alertPosition == 'bottom' ? html`<div id=\"alerts\">${alerts}</div>` : ``}\n\t\t\t${this.buttons.length > 0 && this.buttonPosition == 'bottom' ? html`<div id=\"buttons\">${buttons}</div>` : ``}\n\t\t`;\n\t}\n\n\tpositionDialog(location: DialogLocation) {\n\t\tthis._location = location;\n\t\tif (!this._parent) return;\n\t\tif (location == 'center') dom.setCenterPosition(this, this._parent);\n\t\telse {\n\t\t\tif (utils.isString(location.x)) {\n\t\t\t\tif (location.x == 'left') dom.setPosition(this, {l: 0});\n\t\t\t\telse if (location.x == 'right') dom.setPosition(this, {r: 0});\n\t\t\t\telse dom.setCenterPosition(this, this._parent, {horizontal: true, vertical: false});\n\t\t\t} else {\n\t\t\t\tdom.setPosition(this, {l: location.x as number});\n\t\t\t}\n\t\t\t\n\t\t\tif (utils.isString(location.y)) {\n\t\t\t\tif (location.y == 'top') dom.setPosition(this, {t: 0});\n\t\t\t\telse if (location.y == 'bottom') dom.setPosition(this, {b: 0});\n\t\t\t\telse dom.setCenterPosition(this, this._parent, {horizontal: false, vertical: true});\n\t\t\t} else {\n\t\t\t\tdom.setPosition(this, {t: location.y as number});\n\t\t\t}\n\t\t}\n\t}\n\n\topen(parent: HTMLElement, location?: DialogLocation) {\n\t\tthis._parent = parent;\n\t\tlocation = location || this.location || 'center';\n\t\tconsole.log(location);\n\t\t(parent.shadowRoot ? parent.shadowRoot : parent).appendChild(this);\n\t\tdom.showElement(this, this.scrollable || this.height ? 'flex' : 'block');\n\t\tthis.updateComplete.then(() => this.positionDialog(location));\n\t}\n\n\tclose(dispatchEvent = true) {\n\t\tdom.remove(this);\n\t\tif (dispatchEvent) this.dispatchEvent(new DialogEvent('close', this, null));\n\t}\n\n}"]}
|
|
1
|
+
{"version":3,"file":"dialog.js","sourceRoot":"","sources":["../../src/components/dialog.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,GAAG,EAAmC,KAAK,EAAoB,MAAM,iBAAiB,CAAC;AAChG,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AACvC,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1E,OAAO,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAC;AAE5C,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAEvC,MAAM,qBAAqB,GAAG,IAAI,GAAG,CAAmC;IACvE,CAAC,IAAI,EAAE,EAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAC,CAAC;IAC/C,CAAC,QAAQ,EAAE,EAAC,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,QAAQ,EAAC,CAAC;IAC5C,CAAC,KAAK,EAAE,EAAC,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAC,CAAC;IACnC,CAAC,IAAI,EAAE,EAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAC,CAAC;IAChC,CAAC,OAAO,EAAE,EAAC,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAC,CAAC;CACzC,CAAC,CAAC;AAEH,MAAM,OAAO,WAAY,SAAQ,KAAK;IAErC,YACC,IAAY,EACI,MAAc,EACd,MAAoB;QAEpC,KAAK,CAAC,UAAU,IAAI,EA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IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAC,CAAC;gDAChB;AAGzB;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAC,CAAC;8CACI;AAG5C;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAC,CAAC;6CACA;AAGxC;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,MAAM,EAAC,CAAC;yCACF;AAGvB;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,MAAM,EAAC,CAAC;uCACT;AAGhB;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAC,CAAC;qCACnB;AAGrB;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAC,CAAC;sCAClB;AAGtB;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,KAAK,EAAC,CAAC;uCACK;AAG7B;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,MAAM,EAAC,CAAC;yCACT;AAGhB;IADC,KAAK,EAAE;6CACc;AAGtB;IADC,KAAK,CAAC,OAAO,CAAC;oCACM;AAGrB;IADC,KAAK,CAAC,SAAS,CAAC;sCACM;AAGvB;IADC,KAAK,CAAC,QAAQ,CAAC;wCACS;AAGzB;IADC,KAAK,CAAC,YAAY,CAAC;sCACJ;AAGhB;IADC,KAAK,EAAE;sCACmB;AA9Df,MAAM;IADlB,aAAa,CAAC,WAAW,CAAC;GACd,MAAM,CA6XlB","sourcesContent":["import { dom, Layout, Rect, Overlay, Position, utils, VerticalPosition } from '@omegagrid/core';\nimport { LitElement, html } from 'lit';\nimport { customElement, property, query, state } from 'lit/decorators.js';\nimport { map } from 'lit/directives/map.js';\nimport { DialogAlert, DialogButton, DialogButtonConfig, DialogLocation, DialogOptions } from '../types';\nimport { style } from './dialog.style';\n\nconst DEFAULT_BUTTON_CONFIG = new Map<DialogButton, DialogButtonConfig>([\n\t['ok', {type: 'ok', text: 'OK', default: true}],\n\t['cancel', {type: 'cancel', text: 'Cancel'}],\n\t['yes', {type: 'yes', text: 'Yes'}],\n\t['no', {type: 'no', text: 'No'}],\n\t['close', {type: 'close', text: 'Close'}]\n]);\n\nexport class DialogEvent extends Event {\n\t\n\tconstructor(\n\t\ttype: string,\n\t\tpublic readonly dialog: Dialog,\n\t\tpublic readonly button: DialogButton\n\t) {\n\t\tsuper(`dialog.${type}`, {bubbles: true, composed: true, cancelable: true});\n\t}\n\n}\n\n@customElement('og-dialog')\nexport class Dialog extends LitElement implements Layout {\n\n\tstatic styles = [style];\n\n\t@property({type: Boolean, reflect: true})\n\tresizable = false;\n\n\t@property({type: Boolean, reflect: true})\n\tclosable = false;\n\n\t@property({type: Boolean, reflect: true})\n\tmaximizable = false;\n\n\t@property({type: Boolean, reflect: true})\n\tscrollable = false;\n\n\t@property({type: Boolean, reflect: true})\n\tdisableButtons = false;\n\n\t@property({type: Boolean, reflect: true})\n\tdisableAutoclose = false;\n\n\t@property({type: String, reflect: true})\n\tbuttonPosition: VerticalPosition = 'bottom';\n\n\t@property({type: String, reflect: true})\n\talertPosition: VerticalPosition = 'top';\n\n\t@property({type: Object})\n\tcomponent: HTMLElement;\n\n\t@property({type: String})\n\tcaption: string;\n\n\t@property({type: String, reflect: true})\n\twidth: string|number;\n\n\t@property({type: String, reflect: true})\n\theight: string|number;\n\n\t@property({type: Array})\n\tbuttons: DialogButton[] = [];\n\n\t@property({type: Number})\n\tanimation = 0.2;\n\n\t@state()\n\tloaderVisible = false;\n\n\t@query('.body')\n\tbody: HTMLDivElement;\n\n\t@query('.header')\n\theader: HTMLDivElement;\n\n\t@query('.title')\n\ttitleElm: HTMLDivElement;\n\n\t@query('og-overlay')\n\tloader: Overlay;\n\n\t@state()\n\talerts: DialogAlert[] = [];\n\n\tprivate _parent: HTMLElement;\n\tprivate _animationRunning = false;\n\tprivate _movingOffset: {top: number, left: number} = null;\n\tprivate _elementOffset: {top: number, left: number} = null;\n\tprivate _boundsBeforeMaximize: Rect = null;\n\n\tget isMaximized() { return this._boundsBeforeMaximize != null }\n\t\n\tprivate _location: DialogLocation;\n\tset location(value: DialogLocation) { this.positionDialog(value) }\n\tget location() {\n\t\tif (this._location == null) this._location = {x: this.offsetLeft, y: this.offsetTop}\n\t\treturn this._location;\n\t}\n\n\tprivate _isOpen = false;\n\tget isOpen() { return this._isOpen }\n\t\n\tlayout() {\n\t\tif (!this.component || !(this.component as Layout).layout) return;\n\t\t(this.component as Layout).layout({\n\t\t\tparent: this,\n\t\t\telements: new Map<string, HTMLElement>([\n\t\t\t\t['body', this.body],\n\t\t\t\t['header', this.header],\n\t\t\t\t['title', this.titleElm]\n\t\t\t])\n\t\t});\n\t}\n\n\t_onKeyDown = (e: KeyboardEvent) => {\n\t\tswitch (e.key) {\n\t\t\tcase 'Enter':\n\t\t\t\tthis.submit();\n\t\t\t\tbreak;\n\t\t\tcase 'Escape':\n\t\t\t\tif (this.closable) this.close();\n\t\t\t\tbreak;\n\t\t}\n\t}\n\n\tmaximize() {\n\t\tif (this._boundsBeforeMaximize) return;\n\t\tthis._boundsBeforeMaximize = dom.getBounds(this);\n\t\tdom.setBounds(this, {\n\t\t\tx: 0,\n\t\t\ty: 0,\n\t\t\tw: this._parent.clientWidth,\n\t\t\th: this._parent.clientHeight\n\t\t});\n\t}\n\n\ttoggleMaximize() {\n\t\tif (this._boundsBeforeMaximize) {\n\t\t\tdom.setBounds(this, this._boundsBeforeMaximize);\n\t\t\tthis._boundsBeforeMaximize = null;\n\t\t} else {\n\t\t\tthis.maximize();\n\t\t}\n\t}\n\n\tconstructor() {\n\t\tsuper();\n\t\tthis.addEventListener('keydown', this._onKeyDown);\n\t\t(new ResizeObserver(() => {\n\t\t\tif (this._animationRunning) return;\n\t\t\tthis.layout();\n\t\t\tthis.dispatchEvent(new DialogEvent('resize', this, null));\n\t\t})).observe(this);\n\t}\n\n\tsetOptions(options: DialogOptions) {\n\t\tObject.assign(this, options);\n\t\tthis.requestUpdate();\n\t}\n\n\tgetOptions(): DialogOptions {\n\t\tconst bounds = dom.getBounds(this);\n\t\treturn {\n\t\t\tcaption: this.caption,\n\t\t\tbuttons: this.buttons,\n\t\t\tdisableButtons: this.disableButtons,\n\t\t\tdisableAutoclose: this.disableAutoclose,\n\t\t\tbuttonPosition: this.buttonPosition,\n\t\t\talertPosition: this.alertPosition,\n\t\t\tclosable: this.closable,\n\t\t\tresizable: this.resizable,\n\t\t\tscrollable: this.scrollable,\n\t\t\twidth: bounds.w,\n\t\t\theight: bounds.h,\n\t\t\tlocation: {x: bounds.x, y: bounds.y}\n\t\t};\n\t}\n\n\tfirstUpdated() {\n\t\tthis.tabIndex = 0;\n\t}\n\n\tsubmit() {\n\t\tfor (const btn of this.buttons) {\n\t\t\tif (DEFAULT_BUTTON_CONFIG.get(btn).default) {\n\t\t\t\tthis._onClick(btn);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\n\taddAlert(alert: DialogAlert) {\n\t\tconst alerts = [...this.alerts];\n\t\talerts.push(alert);\n\t\tthis.alerts = alerts;\n\t}\n\n\tclearAlerts() {\n\t\tthis.alerts = [];\n\t}\n\n\tdisconnectedCallback() {\n\t\tthis.clearEvents();\n\t}\n\n\tclearEvents() {\n\t\tthis._parent.removeEventListener('mouseup', this._onParentMouseUp);\n\t\tthis._parent.removeEventListener('mousemove', this._onParentMouseMove);\n\t}\n\n\t_onParentMouseUp = () => {\n\t\tthis.clearEvents();\n\t};\n\n\t_onHeaderMouseDown = (e: MouseEvent) => {\n\t\tthis._movingOffset = {left: e.clientX, top: e.clientY}; \n\t\tthis._elementOffset = {left: this.offsetLeft, top: this.offsetTop};\n\t\tthis._parent.addEventListener('mouseup', this._onParentMouseUp);\n\t\tthis._parent.addEventListener('mousemove', this._onParentMouseMove);\n\t};\n\n\t_onParentMouseMove = (e: MouseEvent) => {\n\t\tthis._location = null;\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, \n\t\t});\n\t\tthis.dispatchEvent(new DialogEvent('move', this, null));\n\t};\n\n\t_onClick = (btn: DialogButton) => {\n\t\tconst res = this.dispatchEvent(new DialogEvent('click', this, btn));\n\t\tif (res && !this.disableAutoclose) this.close();\n\t}\n\n\tshowLoader() {\n\t\tthis.loaderVisible = true;\n\t\tthis.disableButtons = true;\n\t}\n\n\thideLoader() {\n\t\tthis.loaderVisible = false;\n\t\tthis.disableButtons = false;\n\t}\n\n\tupdated(props: Map<PropertyKey, unknown>) {\n\t\tif (this.loaderVisible && this.loader && this.body) {\n\t\t\tthis.loader.show(this.body);\n\t\t}\n\n\t\tif (props.has('width') && this.width) {\n\t\t\tdom.setSize(this, {w: this.width});\n\t\t}\n\n\t\tif (props.has('height') && this.height) {\n\t\t\tdom.setSize(this, {h: this.height});\n\t\t}\n\n\t\tif (props.has('component')) {\n\t\t\tthis.layout();\n\t\t}\n\t}\n\n\trender = () => {\n\t\tconst buttons = map(this.buttons, btn => html`\n\t\t\t<og-button \n\t\t\t\t.text=\"${DEFAULT_BUTTON_CONFIG.get(btn).text}\"\n\t\t\t\t@click=\"${() => this._onClick(btn)}\"\n\t\t\t\t?disabled=\"${this.disableButtons}\"\n\t\t\t\t?default=\"${DEFAULT_BUTTON_CONFIG.get(btn).default}\">\n\t\t\t</og-button>\n\t\t`);\n\n\t\tconst alerts = map(this.alerts, alert => html`\n\t\t\t<og-alert .text=\"${alert.text}\" .type=\"${alert.type}\" closable></og-alert>\n\t\t`);\n\n\t\treturn html`\n\t\t\t<div class=\"header\" @mousedown=\"${this._onHeaderMouseDown}\">\n\t\t\t\t<div class=\"title\">${this.caption ? html`${this.caption}` : html`<slot name=\"header\"></slot>`}</div>\n\t\t\t\t${this.maximizable ? html`<og-button color=\"transparent\" icon=\"window-maximize\" @click=\"${() => this.toggleMaximize()}\"></og-button>` : ``}\n\t\t\t\t${this.closable ? html`<og-close @click=\"${() => this.close()}\"></og-close>` : ``}\n\t\t\t</div>\n\n\t\t\t${this.buttons.length > 0 && this.buttonPosition == 'top' ? html`<div class=\"buttons\">${buttons}</div>` : ``}\n\n\t\t\t${this.alerts.length > 0 && this.alertPosition == 'top' ? html`<div class=\"alerts\">${alerts}</div>` : ``}\n\n\t\t\t<div class=\"body\">\n\t\t\t\t${this.loaderVisible ? html`<og-overlay defaultLoader></og-overlay>` : ``}\n\n\t\t\t\t${this.scrollable ? html`\n\t\t\t\t\t<og-container>\n\t\t\t\t\t\t${this.component\n\t\t\t\t\t\t\t? html`<div slot=\"content\">${this.component}</div>`\n\t\t\t\t\t\t\t: html`<slot name=\"content\" slot=\"content\"></slot>`}\n\t\t\t\t\t</og-container>\n\t\t\t\t` : html`\n\t\t\t\t\t${this.component\n\t\t\t\t\t\t? html`<div slot=\"content\" style=\"height: 100%\">${this.component}</div>`\n\t\t\t\t\t\t: html`<slot name=\"content\"></slot>`}\n\t\t\t\t`}\n\t\t\t</div>\n\n\t\t\t${this.alerts.length > 0 && this.alertPosition == 'bottom' ? html`<div class=\"alerts\">${alerts}</div>` : ``}\n\n\t\t\t${this.buttons.length > 0 && this.buttonPosition == 'bottom' ? html`<div class=\"buttons\">${buttons}</div>` : ``}\n\t\t`;\n\t}\n\n\tcalculatePosition(): Position {\n\t\tconst location = this.location;\n\t\tconst position: Position = {};\n\t\tif (location == 'center') {\n\t\t\tposition.l = this._parent.clientWidth / 2 - this.offsetWidth / 2;\n\t\t\tposition.t = this._parent.clientHeight / 2 - this.offsetHeight / 2;\n\t\t} else {\n\t\t\tif (utils.isString(location.x)) {\n\t\t\t\tif (location.x == 'left') position.l = 0;\n\t\t\t\telse if (location.x == 'right') position.l = this._parent.clientWidth - this.offsetWidth;\n\t\t\t\telse position.l = this._parent.clientWidth / 2 - this.offsetWidth / 2;\n\t\t\t} else {\n\t\t\t\tposition.l = location.x as number;\n\t\t\t}\n\n\t\t\tif (utils.isString(location.y)) {\n\t\t\t\tif (location.y == 'top') position.t = 0;\n\t\t\t\telse if (location.y == 'bottom') position.t = this._parent.clientHeight - this.offsetHeight;\n\t\t\t\telse position.t = this._parent.clientHeight / 2 - this.offsetHeight / 2;\n\t\t\t} else {\n\t\t\t\tposition.t = location.y as number;\n\t\t\t}\n\t\t}\n\t\treturn position;\n\t}\n\n\tpositionDialog(location: DialogLocation) {\n\t\tthis._location = location;\n\t\tif (!this._parent) return;\n\t\tdom.setPosition(this, this.calculatePosition());\n\t}\n\n\tanimatePositionDialog(location: DialogLocation, seconds: number) {\n\t\tthis._location = location;\n\t\tthis.style.visibility = 'hidden';\n\t\tdom.showElement(this, this.scrollable || this.height ? 'flex' : 'block');\n\t\t\n\t\tconst position = this.calculatePosition();\n\t\tconst bounds = dom.getBounds(this);\n\t\tthis._animationRunning = true;\n\n\t\tdom.setBounds(this, {\n\t\t\tx: position.l + bounds.w / 2,\n\t\t\ty: position.t + bounds.h / 2,\n\t\t\tw: 0,\n\t\t\th: 0\n\t\t});\n\n\t\tsetTimeout(() => {\n\t\t\tthis.style.visibility = 'visible';\n\t\t\tthis.style.transition = [\n\t\t\t\t`top ${seconds}s ease-in-out`,\n\t\t\t\t`left ${seconds}s ease-in-out`, \n\t\t\t\t`width ${seconds}s ease-in-out`,\n\t\t\t\t`height ${seconds}s ease-in-out`\n\t\t\t].join(',');\n\n\t\t\tsetTimeout(() => dom.setBounds(this, {\n\t\t\t\tx: position.l,\n\t\t\t\ty: position.t,\n\t\t\t\tw: bounds.w,\n\t\t\t\th: bounds.h\n\t\t\t}), 0);\n\t\t\tsetTimeout(() => {\n\t\t\t\tthis.style.transition = '';\n\t\t\t\tthis._animationRunning = false;\n\t\t\t}, seconds * 1000);\n\t\t}, 1);\n\t}\n\t\n\topen(parent: HTMLElement, location?: DialogLocation) {\n\t\tthis._parent = parent;\n\t\tlocation = location || this.location || 'center';\n\t\t(parent.shadowRoot ? parent.shadowRoot : parent).appendChild(this);\n\t\tthis.updateComplete.then(() => {\n\t\t\tif (this.animation > 0) {\n\t\t\t\tthis.animatePositionDialog(location, this.animation);\n\t\t\t} else {\n\t\t\t\tdom.showElement(this, this.scrollable || this.height ? 'flex' : 'block');\n\t\t\t\tthis.positionDialog(location);\n\t\t\t}\n\t\t});\n\t\tthis._isOpen = true;\n\t}\n\n\tclose(dispatchEvent = true) {\n\t\tdom.remove(this);\n\t\tif (dispatchEvent) this.dispatchEvent(new DialogEvent('close', this, null));\n\t\tthis._isOpen = false;\n\t}\n\n}"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dialog.style.d.ts","sourceRoot":"","sources":["../../src/components/dialog.style.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,KAAK,
|
|
1
|
+
{"version":3,"file":"dialog.style.d.ts","sourceRoot":"","sources":["../../src/components/dialog.style.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,KAAK,yBAyEjB,CAAC"}
|
|
@@ -26,46 +26,41 @@ export const style = css `
|
|
|
26
26
|
resize: both;
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
|
|
29
|
+
.header {
|
|
30
30
|
display: flex;
|
|
31
|
-
padding: 0 10px;
|
|
32
31
|
flex: 0;
|
|
33
32
|
cursor: move;
|
|
33
|
+
align-items: center;
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
|
|
36
|
+
.title {
|
|
37
37
|
flex: 1;
|
|
38
38
|
line-height: ${constants.DIALOG_HEADER_HEIGHT}px;
|
|
39
|
+
padding-left: 10px;
|
|
39
40
|
}
|
|
40
41
|
|
|
41
|
-
|
|
42
|
-
flex: 0;
|
|
43
|
-
margin-
|
|
44
|
-
min-width: ${constants.DIALOG_HEADER_HEIGHT / 2}px;
|
|
45
|
-
height: ${constants.DIALOG_HEADER_HEIGHT / 2}px;
|
|
46
|
-
line-height: ${constants.DIALOG_HEADER_HEIGHT / 2}px;
|
|
47
|
-
border-radius: 50%;
|
|
48
|
-
cursor: pointer;
|
|
49
|
-
text-align: center;
|
|
42
|
+
.header og-close {
|
|
43
|
+
flex: 0 0 22px;
|
|
44
|
+
margin-right: 5px;
|
|
50
45
|
}
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
46
|
+
|
|
47
|
+
.header og-button {
|
|
48
|
+
flex: 0 0 30px;
|
|
49
|
+
margin-right: 5px;
|
|
55
50
|
}
|
|
56
51
|
|
|
57
|
-
|
|
52
|
+
.body {
|
|
58
53
|
position: relative;
|
|
59
54
|
flex: 1;
|
|
60
55
|
overflow: hidden;
|
|
61
56
|
border-top: 1px solid var(--og-border-color);
|
|
62
57
|
}
|
|
63
58
|
|
|
64
|
-
|
|
59
|
+
.body og-container {
|
|
65
60
|
height: 100%;
|
|
66
61
|
}
|
|
67
62
|
|
|
68
|
-
|
|
63
|
+
.buttons {
|
|
69
64
|
display: flex;
|
|
70
65
|
flex-direction: row;
|
|
71
66
|
gap: 8px;
|
|
@@ -74,7 +69,7 @@ export const style = css `
|
|
|
74
69
|
border-top: 1px solid var(--og-border-color);
|
|
75
70
|
}
|
|
76
71
|
|
|
77
|
-
|
|
72
|
+
.buttons og-button {
|
|
78
73
|
min-width: 80px;
|
|
79
74
|
text-align: center;
|
|
80
75
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dialog.style.js","sourceRoot":"","sources":["../../src/components/dialog.style.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAC1B,OAAO,SAAS,MAAM,cAAc,CAAC;AAErC,MAAM,CAAC,MAAM,KAAK,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAmCP,SAAS,CAAC,oBAAoB
|
|
1
|
+
{"version":3,"file":"dialog.style.js","sourceRoot":"","sources":["../../src/components/dialog.style.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAC1B,OAAO,SAAS,MAAM,cAAc,CAAC;AAErC,MAAM,CAAC,MAAM,KAAK,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAmCP,SAAS,CAAC,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAsC9C,CAAC","sourcesContent":["import { css } from 'lit';\nimport constants from '../constants';\n\nexport const style = css`\n\t* {\n\t\tbox-sizing: border-box;\n\t}\n\n\t:host {\n\t\tdisplay: none;\n\t\tflex-direction: column;\n\t\tbackground: var(--og-dialog-background);\n\t\tcolor: var(--og-dialog-color);\n\t\tborder: 1px solid var(--og-border-color);\n\t\tfont-size: var(--og-font-size);\n\t\tfont-family: var(--og-font-family);\n\t\twidth: 400px;\n\t\tposition: absolute;\n\t\toverflow: hidden;\n\t\toutline: none;\n\t\tbox-shadow: 8px 8px 4px -3px var(--og-dialog-shadow);\n\t\tz-index: 500;\n\t\tborder-radius: var(--og-base-radius);\n\t}\n\n\t:host([resizable]) {\n\t\tresize: both;\n\t}\n\n\t.header {\n\t\tdisplay: flex;\n\t\tflex: 0;\n\t\tcursor: move;\n\t\talign-items: center;\n\t}\n\n\t.title {\n\t\tflex: 1;\n\t\tline-height: ${constants.DIALOG_HEADER_HEIGHT}px;\n\t\tpadding-left: 10px;\n\t}\n\n\t.header og-close {\n\t\tflex: 0 0 22px;\n\t\tmargin-right: 5px;\n\t}\n\n\t.header og-button {\n\t\tflex: 0 0 30px;\n\t\tmargin-right: 5px;\n\t}\n\n\t.body {\n\t\tposition: relative;\n\t\tflex: 1;\n\t\toverflow: hidden;\n\t\tborder-top: 1px solid var(--og-border-color);\n\t}\n\n\t.body og-container {\n\t\theight: 100%;\n\t}\n\n\t.buttons {\n\t\tdisplay: flex;\n\t\tflex-direction: row;\n\t\tgap: 8px;\n\t\tjustify-content: flex-end;\n\t\tpadding: 8px;\n\t\tborder-top: 1px solid var(--og-border-color);\n\t}\n\n\t.buttons og-button {\n\t\tmin-width: 80px;\n\t\ttext-align: center;\n\t}\n`;"]}
|
package/dist/types.d.ts
CHANGED
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAElF,MAAM,MAAM,YAAY,GAAG,IAAI,GAAG,QAAQ,GAAG,KAAK,GAAG,IAAI,GAAG,OAAO,GAAG,QAAQ,CAAC;AAG/E,MAAM,MAAM,kBAAkB,GAAG;IAChC,IAAI,EAAE,YAAY,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,OAAO,CAAA;CACjB,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,SAAS,CAAA;CACf,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG;IAC5B,CAAC,CAAC,EAAE,MAAM,GAAC,kBAAkB,CAAC;IAC9B,CAAC,CAAC,EAAE,MAAM,GAAC,gBAAgB,CAAC;CAC5B,GAAG,QAAQ,CAAC;AAEb,MAAM,MAAM,aAAa,GAAG;IAC3B,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAElF,MAAM,MAAM,YAAY,GAAG,IAAI,GAAG,QAAQ,GAAG,KAAK,GAAG,IAAI,GAAG,OAAO,GAAG,QAAQ,CAAC;AAG/E,MAAM,MAAM,kBAAkB,GAAG;IAChC,IAAI,EAAE,YAAY,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,OAAO,CAAA;CACjB,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,SAAS,CAAA;CACf,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG;IAC5B,CAAC,CAAC,EAAE,MAAM,GAAC,kBAAkB,CAAC;IAC9B,CAAC,CAAC,EAAE,MAAM,GAAC,gBAAgB,CAAC;CAC5B,GAAG,QAAQ,CAAC;AAEb,MAAM,MAAM,aAAa,GAAG;IAC3B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,YAAY,EAAE,CAAC;IACzB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,cAAc,CAAC,EAAE,gBAAgB,CAAC;IAClC,aAAa,CAAC,EAAE,gBAAgB,CAAC;IACjC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,GAAC,MAAM,CAAC;IACtB,MAAM,CAAC,EAAE,MAAM,GAAC,MAAM,CAAC;IACvB,QAAQ,CAAC,EAAE,cAAc,CAAA;CACzB,CAAA"}
|
package/dist/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"","sourcesContent":["import { AlertType, HorizontalPosition, VerticalPosition } from \"@omegagrid/core\";\n\nexport type DialogButton = 'ok' | 'cancel' | 'yes' | 'no' | 'close' | 'custom';\n// export type DialogLocation = 'top' | 'bottom';\n\nexport type DialogButtonConfig = {\n\ttype: DialogButton,\n\ttext: string,\n\tdefault?: boolean\n};\n\nexport type DialogAlert = {\n\ttext: string,\n\ttype: AlertType\n};\n\nexport type DialogLocation = {\n\tx?: number|HorizontalPosition,\n\ty?: number|VerticalPosition,\n} | 'center';\n\nexport type DialogOptions = {\n\
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"","sourcesContent":["import { AlertType, HorizontalPosition, VerticalPosition } from \"@omegagrid/core\";\n\nexport type DialogButton = 'ok' | 'cancel' | 'yes' | 'no' | 'close' | 'custom';\n// export type DialogLocation = 'top' | 'bottom';\n\nexport type DialogButtonConfig = {\n\ttype: DialogButton,\n\ttext: string,\n\tdefault?: boolean\n};\n\nexport type DialogAlert = {\n\ttext: string,\n\ttype: AlertType\n};\n\nexport type DialogLocation = {\n\tx?: number|HorizontalPosition,\n\ty?: number|VerticalPosition,\n} | 'center';\n\nexport type DialogOptions = {\n\tcaption?: string,\n\tbuttons?: DialogButton[],\n\tdisableButtons?: boolean,\n\tdisableAutoclose?: boolean,\n\tbuttonPosition?: VerticalPosition,\n\talertPosition?: VerticalPosition,\n\tclosable?: boolean,\n\tresizable?: boolean,\n\tscrollable?: boolean,\n\twidth?: string|number,\n\theight?: string|number,\n\tlocation?: DialogLocation\n}"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@omegagrid/dialog",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.40",
|
|
4
4
|
"license": "UNLICENSED",
|
|
5
5
|
"description": "Dialog component",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
30
|
"@fortawesome/fontawesome-svg-core": "^7.0.1",
|
|
31
|
-
"@omegagrid/core": "^0.9.
|
|
31
|
+
"@omegagrid/core": "^0.9.40",
|
|
32
32
|
"lit": "^3.1.1",
|
|
33
33
|
"monaco-editor": "^0.52.2",
|
|
34
34
|
"ts-debounce": "^4.0.0",
|