@quicdata/analytics 0.0.6 → 0.0.7
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.
|
@@ -11,10 +11,13 @@ export declare class AnalyticsWidgetToolbar extends LitElement {
|
|
|
11
11
|
activeCount: number;
|
|
12
12
|
private _dialogOpen;
|
|
13
13
|
private _portalRoot;
|
|
14
|
+
private _inFilterChange;
|
|
15
|
+
private _onEscapeKey;
|
|
14
16
|
updated(changed: Map<string, unknown>): void;
|
|
15
17
|
disconnectedCallback(): void;
|
|
16
18
|
private _renderOverlayPortal;
|
|
17
19
|
private _onFilterIconClick;
|
|
20
|
+
private _onOverlayClick;
|
|
18
21
|
private _onDialogClose;
|
|
19
22
|
private _onFilterChange;
|
|
20
23
|
private _onFilterBarClose;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"widget-toolbar.d.ts","sourceRoot":"","sources":["../../../../libs/analytics/src/filters/widget-toolbar.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAa,MAAM,KAAK,CAAC;AAG5C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAiEzD;;;GAGG;AACH,qBACa,sBAAuB,SAAQ,UAAU;IACpD,OAAgB,MAAM,0BA8DpB;IAEyB,OAAO,EAAE,gBAAgB,EAAE,CAAM;IAChC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,CAAM;IACvD,WAAW,SAAK;IAEnC,OAAO,CAAC,WAAW,CAAS;IACrC,OAAO,CAAC,WAAW,CAA4B;
|
|
1
|
+
{"version":3,"file":"widget-toolbar.d.ts","sourceRoot":"","sources":["../../../../libs/analytics/src/filters/widget-toolbar.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAa,MAAM,KAAK,CAAC;AAG5C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAiEzD;;;GAGG;AACH,qBACa,sBAAuB,SAAQ,UAAU;IACpD,OAAgB,MAAM,0BA8DpB;IAEyB,OAAO,EAAE,gBAAgB,EAAE,CAAM;IAChC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,CAAM;IACvD,WAAW,SAAK;IAEnC,OAAO,CAAC,WAAW,CAAS;IACrC,OAAO,CAAC,WAAW,CAA4B;IAC/C,OAAO,CAAC,eAAe,CAAS;IAChC,OAAO,CAAC,YAAY,CAMlB;IAEO,OAAO,CAAC,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;IAgB5C,oBAAoB,IAAI,IAAI;IASrC,OAAO,CAAC,oBAAoB;IA+B5B,OAAO,CAAC,kBAAkB,CAExB;IAEF,OAAO,CAAC,eAAe,CAGrB;IAEF,OAAO,CAAC,cAAc,CAKpB;IAEF,OAAO,CAAC,eAAe,CAgBrB;IAEF,OAAO,CAAC,iBAAiB,CAEvB;IAEO,MAAM;CAsBhB;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,0BAA0B,EAAE,sBAAsB,CAAC;KACpD;CACF"}
|
|
@@ -76,6 +76,48 @@ let AnalyticsWidgetToolbar = class AnalyticsWidgetToolbar extends LitElement {
|
|
|
76
76
|
this.activeCount = 0;
|
|
77
77
|
this._dialogOpen = false;
|
|
78
78
|
this._portalRoot = null;
|
|
79
|
+
this._inFilterChange = false;
|
|
80
|
+
this._onEscapeKey = (e) => {
|
|
81
|
+
if (!this._dialogOpen)
|
|
82
|
+
return;
|
|
83
|
+
if (e.key === 'Escape') {
|
|
84
|
+
e.preventDefault();
|
|
85
|
+
this._onDialogClose();
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
this._onFilterIconClick = () => {
|
|
89
|
+
this._dialogOpen = true;
|
|
90
|
+
};
|
|
91
|
+
this._onOverlayClick = (e) => {
|
|
92
|
+
if (e.target !== e.currentTarget)
|
|
93
|
+
return; // only close when clicking mask, not dialog
|
|
94
|
+
this._onDialogClose();
|
|
95
|
+
};
|
|
96
|
+
this._onDialogClose = () => {
|
|
97
|
+
this._dialogOpen = false;
|
|
98
|
+
this.dispatchEvent(new CustomEvent(EVENT_FILTER_CLOSE, { bubbles: true, composed: true }));
|
|
99
|
+
};
|
|
100
|
+
this._onFilterChange = (e) => {
|
|
101
|
+
if (this._inFilterChange)
|
|
102
|
+
return;
|
|
103
|
+
if (e.target === this)
|
|
104
|
+
return;
|
|
105
|
+
e.stopPropagation();
|
|
106
|
+
this._inFilterChange = true;
|
|
107
|
+
try {
|
|
108
|
+
this.dispatchEvent(new CustomEvent(EVENT_FILTER_CHANGE, {
|
|
109
|
+
bubbles: true,
|
|
110
|
+
composed: true,
|
|
111
|
+
detail: e.detail,
|
|
112
|
+
}));
|
|
113
|
+
}
|
|
114
|
+
finally {
|
|
115
|
+
this._inFilterChange = false;
|
|
116
|
+
}
|
|
117
|
+
};
|
|
118
|
+
this._onFilterBarClose = () => {
|
|
119
|
+
this._dialogOpen = false;
|
|
120
|
+
};
|
|
79
121
|
}
|
|
80
122
|
static { this.styles = css `
|
|
81
123
|
:host {
|
|
@@ -148,10 +190,12 @@ let AnalyticsWidgetToolbar = class AnalyticsWidgetToolbar extends LitElement {
|
|
|
148
190
|
document.body.appendChild(this._portalRoot);
|
|
149
191
|
}
|
|
150
192
|
render(this._renderOverlayPortal(), this._portalRoot);
|
|
193
|
+
window.addEventListener('keydown', this._onEscapeKey);
|
|
151
194
|
}
|
|
152
195
|
else if (this._portalRoot) {
|
|
153
196
|
this._portalRoot.remove();
|
|
154
197
|
this._portalRoot = null;
|
|
198
|
+
window.removeEventListener('keydown', this._onEscapeKey);
|
|
155
199
|
}
|
|
156
200
|
}
|
|
157
201
|
disconnectedCallback() {
|
|
@@ -159,6 +203,7 @@ let AnalyticsWidgetToolbar = class AnalyticsWidgetToolbar extends LitElement {
|
|
|
159
203
|
this._portalRoot.remove();
|
|
160
204
|
this._portalRoot = null;
|
|
161
205
|
}
|
|
206
|
+
window.removeEventListener('keydown', this._onEscapeKey);
|
|
162
207
|
super.disconnectedCallback();
|
|
163
208
|
}
|
|
164
209
|
_renderOverlayPortal() {
|
|
@@ -169,7 +214,7 @@ let AnalyticsWidgetToolbar = class AnalyticsWidgetToolbar extends LitElement {
|
|
|
169
214
|
role="dialog"
|
|
170
215
|
aria-modal="true"
|
|
171
216
|
aria-label="Filters"
|
|
172
|
-
@click=${this.
|
|
217
|
+
@click=${this._onOverlayClick}
|
|
173
218
|
>
|
|
174
219
|
<div class="dialog" @click=${(e) => e.stopPropagation()}>
|
|
175
220
|
<button type="button" class="dialog-close" aria-label="Close" @click=${this._onDialogClose}>
|
|
@@ -191,24 +236,6 @@ let AnalyticsWidgetToolbar = class AnalyticsWidgetToolbar extends LitElement {
|
|
|
191
236
|
</div>
|
|
192
237
|
`;
|
|
193
238
|
}
|
|
194
|
-
_onFilterIconClick() {
|
|
195
|
-
this._dialogOpen = true;
|
|
196
|
-
}
|
|
197
|
-
_onDialogClose() {
|
|
198
|
-
this._dialogOpen = false;
|
|
199
|
-
this.dispatchEvent(new CustomEvent(EVENT_FILTER_CLOSE, { bubbles: true, composed: true }));
|
|
200
|
-
}
|
|
201
|
-
_onFilterChange(e) {
|
|
202
|
-
e.stopPropagation();
|
|
203
|
-
this.dispatchEvent(new CustomEvent(EVENT_FILTER_CHANGE, {
|
|
204
|
-
bubbles: true,
|
|
205
|
-
composed: true,
|
|
206
|
-
detail: e.detail,
|
|
207
|
-
}));
|
|
208
|
-
}
|
|
209
|
-
_onFilterBarClose() {
|
|
210
|
-
this._dialogOpen = false;
|
|
211
|
-
}
|
|
212
239
|
render() {
|
|
213
240
|
const hasFilters = this.filters.length > 0;
|
|
214
241
|
if (!hasFilters)
|