web-mojo 2.1.1108 → 2.1.1110
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/admin.cjs.js +1 -1
- package/dist/admin.cjs.js.map +1 -1
- package/dist/admin.es.js +18 -16
- package/dist/admin.es.js.map +1 -1
- package/dist/auth.cjs.js +1 -1
- package/dist/auth.es.js +1 -1
- package/dist/charts.cjs.js +1 -1
- package/dist/charts.css +118 -0
- package/dist/charts.es.js +4 -4
- package/dist/chat.css +3 -18
- package/dist/chunks/{ChatView-CTe1wlQP.js → ChatView-BsANcDiL.js} +31 -8
- package/dist/chunks/ChatView-BsANcDiL.js.map +1 -0
- package/dist/chunks/{ChatView-BL4kPmQd.js → ChatView-DSEEMnNt.js} +2 -2
- package/dist/chunks/ChatView-DSEEMnNt.js.map +1 -0
- package/dist/chunks/{Collection-Ds4EOzap.js → Collection-CqLcHgQG.js} +2 -2
- package/dist/chunks/{Collection-Ds4EOzap.js.map → Collection-CqLcHgQG.js.map} +1 -1
- package/dist/chunks/{Collection-bgdNt0wV.js → Collection-vtImpCcS.js} +2 -2
- package/dist/chunks/{Collection-bgdNt0wV.js.map → Collection-vtImpCcS.js.map} +1 -1
- package/dist/chunks/{ContextMenu-DwvxeWLt.js → ContextMenu-BY3BgxM5.js} +2 -2
- package/dist/chunks/{ContextMenu-DwvxeWLt.js.map → ContextMenu-BY3BgxM5.js.map} +1 -1
- package/dist/chunks/{ContextMenu-KHTc-Ubo.js → ContextMenu-DfrWFc5y.js} +3 -3
- package/dist/chunks/{ContextMenu-KHTc-Ubo.js.map → ContextMenu-DfrWFc5y.js.map} +1 -1
- package/dist/chunks/{DataView-DbexZltc.js → DataView-CHvoEI4M.js} +2 -2
- package/dist/chunks/{DataView-DbexZltc.js.map → DataView-CHvoEI4M.js.map} +1 -1
- package/dist/chunks/{DataView-DAGqpR7b.js → DataView-CsYXM9vF.js} +2 -2
- package/dist/chunks/{DataView-DAGqpR7b.js.map → DataView-CsYXM9vF.js.map} +1 -1
- package/dist/chunks/{Dialog-DE-21f_8.js → Dialog-BKPwBCDC.js} +2 -2
- package/dist/chunks/Dialog-BKPwBCDC.js.map +1 -0
- package/dist/chunks/{Dialog-CXOsYNLf.js → Dialog-D4DsB-N1.js} +6 -6
- package/dist/chunks/Dialog-D4DsB-N1.js.map +1 -0
- package/dist/chunks/{FormView-Dya3nBrn.js → FormView-B9nIO_AX.js} +2 -2
- package/dist/chunks/{FormView-Dya3nBrn.js.map → FormView-B9nIO_AX.js.map} +1 -1
- package/dist/chunks/{FormView-DbPZwhZ6.js → FormView-DYX_yeho.js} +2 -2
- package/dist/chunks/{FormView-DbPZwhZ6.js.map → FormView-DYX_yeho.js.map} +1 -1
- package/dist/chunks/{ListView-DFP4ie99.js → ListView-BtZ7fylv.js} +3 -3
- package/dist/chunks/{ListView-DFP4ie99.js.map → ListView-BtZ7fylv.js.map} +1 -1
- package/dist/chunks/{ListView-BQgv3OvQ.js → ListView-D2vt0koT.js} +2 -2
- package/dist/chunks/{ListView-BQgv3OvQ.js.map → ListView-D2vt0koT.js.map} +1 -1
- package/dist/chunks/{MetricsMiniChartWidget-DOcsPk5u.js → MetricsMiniChartWidget-BJJY9R-s.js} +2 -2
- package/dist/chunks/MetricsMiniChartWidget-BJJY9R-s.js.map +1 -0
- package/dist/chunks/{MetricsMiniChartWidget-Dan8l57G.js → MetricsMiniChartWidget-bmnV82d1.js} +340 -9
- package/dist/chunks/{MetricsMiniChartWidget-Dan8l57G.js.map → MetricsMiniChartWidget-bmnV82d1.js.map} +1 -1
- package/dist/chunks/{PDFViewer-B1g6Q6ae.js → PDFViewer-Bzifr-dn.js} +3 -3
- package/dist/chunks/{PDFViewer-B1g6Q6ae.js.map → PDFViewer-Bzifr-dn.js.map} +1 -1
- package/dist/chunks/{PDFViewer-DDb7xLGo.js → PDFViewer-Cgr3T15i.js} +2 -2
- package/dist/chunks/{PDFViewer-DDb7xLGo.js.map → PDFViewer-Cgr3T15i.js.map} +1 -1
- package/dist/chunks/{Rest-C3KvOEeY.js → Rest-C3fPzCIA.js} +2 -2
- package/dist/chunks/Rest-C3fPzCIA.js.map +1 -0
- package/dist/chunks/{Rest-BIyXKaFn.js → Rest-DYPLEzNy.js} +2 -2
- package/dist/chunks/Rest-DYPLEzNy.js.map +1 -0
- package/dist/chunks/{TokenManager-DUmZuAKG.js → TokenManager-CKkIWgzy.js} +6 -6
- package/dist/chunks/TokenManager-CKkIWgzy.js.map +1 -0
- package/dist/chunks/TokenManager-DSyRWlvc.js +2 -0
- package/dist/chunks/TokenManager-DSyRWlvc.js.map +1 -0
- package/dist/chunks/{WebSocketClient-CGQLSIgP.js → WebSocketClient-CkAL55qy.js} +2 -2
- package/dist/chunks/{WebSocketClient-CGQLSIgP.js.map → WebSocketClient-CkAL55qy.js.map} +1 -1
- package/dist/chunks/{WebSocketClient-sEN2DmCF.js → WebSocketClient-Dzwprd15.js} +2 -2
- package/dist/chunks/{WebSocketClient-sEN2DmCF.js.map → WebSocketClient-Dzwprd15.js.map} +1 -1
- package/dist/chunks/{version-DIk6UpNb.js → version-C5lFa1F0.js} +2 -2
- package/dist/chunks/{version-DIk6UpNb.js.map → version-C5lFa1F0.js.map} +1 -1
- package/dist/chunks/{version-CrckCqr_.js → version-FRgkiWti.js} +4 -4
- package/dist/chunks/{version-CrckCqr_.js.map → version-FRgkiWti.js.map} +1 -1
- package/dist/core.css +58 -52
- package/dist/css/web-mojo.css +1 -1
- package/dist/docit.cjs.js +1 -1
- package/dist/docit.es.js +6 -6
- package/dist/index.cjs.js +1 -1
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +71 -132
- package/dist/index.es.js.map +1 -1
- package/dist/lightbox.cjs.js +1 -1
- package/dist/lightbox.es.js +5 -5
- package/dist/map.cjs.js +1 -1
- package/dist/map.es.js +2 -2
- package/dist/timeline.cjs.js +1 -1
- package/dist/timeline.es.js +4 -4
- package/package.json +1 -1
- package/dist/chunks/ChatView-BL4kPmQd.js.map +0 -1
- package/dist/chunks/ChatView-CTe1wlQP.js.map +0 -1
- package/dist/chunks/Dialog-CXOsYNLf.js.map +0 -1
- package/dist/chunks/Dialog-DE-21f_8.js.map +0 -1
- package/dist/chunks/MetricsMiniChartWidget-DOcsPk5u.js.map +0 -1
- package/dist/chunks/Rest-BIyXKaFn.js.map +0 -1
- package/dist/chunks/Rest-C3KvOEeY.js.map +0 -1
- package/dist/chunks/TokenManager-B0Z_dd7k.js +0 -2
- package/dist/chunks/TokenManager-B0Z_dd7k.js.map +0 -1
- package/dist/chunks/TokenManager-DUmZuAKG.js.map +0 -1
package/dist/chunks/{MetricsMiniChartWidget-Dan8l57G.js → MetricsMiniChartWidget-bmnV82d1.js}
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { D as Dialog } from "./Dialog-
|
|
2
|
-
import { V as View, d as dataFormatter } from "./Rest-
|
|
3
|
-
import { W as WebSocketClient } from "./WebSocketClient-
|
|
1
|
+
import { D as Dialog } from "./Dialog-D4DsB-N1.js";
|
|
2
|
+
import { V as View, d as dataFormatter } from "./Rest-C3fPzCIA.js";
|
|
3
|
+
import { W as WebSocketClient } from "./WebSocketClient-CkAL55qy.js";
|
|
4
4
|
class BaseChart extends View {
|
|
5
5
|
constructor(options = {}) {
|
|
6
6
|
super({
|
|
@@ -2696,6 +2696,10 @@ class MetricsMiniChartWidget extends View {
|
|
|
2696
2696
|
this.subtitle = options.subtitle || "";
|
|
2697
2697
|
this.background = options.background || null;
|
|
2698
2698
|
this.textColor = options.textColor || null;
|
|
2699
|
+
this.showSettings = options.showSettings || false;
|
|
2700
|
+
this.settingsKey = options.settingsKey || null;
|
|
2701
|
+
this.showDateRange = options.showDateRange || false;
|
|
2702
|
+
this._pendingSettings = null;
|
|
2699
2703
|
this.showTrending = !!options.showTrending;
|
|
2700
2704
|
this.trendRange = options.trendRange ?? null;
|
|
2701
2705
|
this.trendOffset = options.trendOffset ?? 0;
|
|
@@ -2706,7 +2710,7 @@ class MetricsMiniChartWidget extends View {
|
|
|
2706
2710
|
this.trendingPercent = 0;
|
|
2707
2711
|
this.trendingUp = null;
|
|
2708
2712
|
this.hasTrending = false;
|
|
2709
|
-
this.trendingClass = "";
|
|
2713
|
+
this.trendingClass = "metrics-mini-chart-trending-text";
|
|
2710
2714
|
this.trendingIcon = "";
|
|
2711
2715
|
this.trendingLabel = "";
|
|
2712
2716
|
this.chartOptions = {
|
|
@@ -2755,6 +2759,9 @@ class MetricsMiniChartWidget extends View {
|
|
|
2755
2759
|
};
|
|
2756
2760
|
}
|
|
2757
2761
|
async onInit() {
|
|
2762
|
+
if (this.showSettings && this.settingsKey) {
|
|
2763
|
+
this._loadSettings();
|
|
2764
|
+
}
|
|
2758
2765
|
this.chart = new MetricsMiniChart({
|
|
2759
2766
|
...this.chartOptions,
|
|
2760
2767
|
containerId: "chart"
|
|
@@ -2767,16 +2774,23 @@ class MetricsMiniChartWidget extends View {
|
|
|
2767
2774
|
icon: this.icon,
|
|
2768
2775
|
template: `
|
|
2769
2776
|
<div class="d-flex justify-content-between align-items-start mb-2">
|
|
2770
|
-
<div class="me-3">
|
|
2777
|
+
<div class="me-3 flex-grow-1">
|
|
2771
2778
|
<h6 class="card-title mb-1" style="${this.textColor ? `color: ${this.textColor}` : ""}">${this.title}</h6>
|
|
2772
|
-
<div class="
|
|
2779
|
+
<div class="metrics-mini-chart-subtitle" style="${this.textColor ? `color: ${this.textColor}` : ""}">${this.subtitle}</div>
|
|
2773
2780
|
{{#hasTrending}}
|
|
2774
|
-
<div class="
|
|
2781
|
+
<div class="{{trendingClass}}" style="${this.textColor ? `color: ${this.textColor}` : ""}">
|
|
2775
2782
|
<i class="{{trendingIcon}} me-1"></i>{{trendingLabel}}
|
|
2776
2783
|
</div>
|
|
2777
2784
|
{{/hasTrending}}
|
|
2778
2785
|
</div>
|
|
2779
|
-
|
|
2786
|
+
<div class="d-flex align-items-center gap-2">
|
|
2787
|
+
${this.showSettings ? `
|
|
2788
|
+
<button class="btn btn-link p-0 text-muted metrics-settings-btn" type="button" data-settings-trigger style="${this.textColor ? `color: ${this.textColor} !important` : ""}">
|
|
2789
|
+
<i class="bi bi-gear-fill" style="font-size: 1.1rem;"></i>
|
|
2790
|
+
</button>
|
|
2791
|
+
` : ""}
|
|
2792
|
+
${this.icon ? `<i class="${this.icon} fs-4 flex-shrink-0" aria-hidden="true" style="${this.textColor ? `color: ${this.textColor}` : ""}"></i>` : ""}
|
|
2793
|
+
</div>
|
|
2780
2794
|
</div>`
|
|
2781
2795
|
});
|
|
2782
2796
|
this.addChild(this.header);
|
|
@@ -2785,8 +2799,19 @@ class MetricsMiniChartWidget extends View {
|
|
|
2785
2799
|
}
|
|
2786
2800
|
this.updateFromChartData({ render: false });
|
|
2787
2801
|
}
|
|
2802
|
+
async onAfterRender() {
|
|
2803
|
+
await super.onAfterRender();
|
|
2804
|
+
if (this.showSettings) {
|
|
2805
|
+
this._initSettingsPopover();
|
|
2806
|
+
}
|
|
2807
|
+
}
|
|
2788
2808
|
onChildMetricsLoaded() {
|
|
2789
2809
|
this.updateFromChartData({ render: true });
|
|
2810
|
+
if (this.showSettings && this.isMounted()) {
|
|
2811
|
+
setTimeout(() => {
|
|
2812
|
+
this._initSettingsPopover();
|
|
2813
|
+
}, 100);
|
|
2814
|
+
}
|
|
2790
2815
|
}
|
|
2791
2816
|
updateFromChartData({ render = true } = {}) {
|
|
2792
2817
|
const values = Array.isArray(this.chart?.data) ? this.chart.data : null;
|
|
@@ -2808,6 +2833,7 @@ class MetricsMiniChartWidget extends View {
|
|
|
2808
2833
|
const offset = Math.max(0, parseInt(this.trendOffset || 0, 10) || 0);
|
|
2809
2834
|
const endIndex = Math.max(0, nums.length - 1 - offset);
|
|
2810
2835
|
this.header.now_value = nums[endIndex];
|
|
2836
|
+
this._updateGranularityLabels();
|
|
2811
2837
|
let hasTrend = false;
|
|
2812
2838
|
let lastSum = 0;
|
|
2813
2839
|
let prevSum = 0;
|
|
@@ -2869,6 +2895,29 @@ class MetricsMiniChartWidget extends View {
|
|
|
2869
2895
|
this.header.render();
|
|
2870
2896
|
}
|
|
2871
2897
|
}
|
|
2898
|
+
/**
|
|
2899
|
+
* Update labels based on current granularity
|
|
2900
|
+
* @private
|
|
2901
|
+
*/
|
|
2902
|
+
_updateGranularityLabels() {
|
|
2903
|
+
const granularity = this.chartOptions.granularity || "days";
|
|
2904
|
+
const nowLabels = {
|
|
2905
|
+
"hours": "This Hour",
|
|
2906
|
+
"days": "Today",
|
|
2907
|
+
"weeks": "This Week",
|
|
2908
|
+
"months": "This Month",
|
|
2909
|
+
"years": "This Year"
|
|
2910
|
+
};
|
|
2911
|
+
const totalLabels = {
|
|
2912
|
+
"hours": "Total (24h)",
|
|
2913
|
+
"days": "Total (Period)",
|
|
2914
|
+
"weeks": "Total (Period)",
|
|
2915
|
+
"months": "Total (Period)",
|
|
2916
|
+
"years": "Total (Period)"
|
|
2917
|
+
};
|
|
2918
|
+
this.header.now_label = nowLabels[granularity] || "Current";
|
|
2919
|
+
this.header.total_label = totalLabels[granularity] || "Total";
|
|
2920
|
+
}
|
|
2872
2921
|
get cardStyle() {
|
|
2873
2922
|
const styles = [];
|
|
2874
2923
|
if (this.background) styles.push(`background: ${this.background}`);
|
|
@@ -2887,17 +2936,299 @@ class MetricsMiniChartWidget extends View {
|
|
|
2887
2936
|
`;
|
|
2888
2937
|
}
|
|
2889
2938
|
async onBeforeDestroy() {
|
|
2939
|
+
if (this._settingsPopover) {
|
|
2940
|
+
this._settingsPopover.dispose();
|
|
2941
|
+
this._settingsPopover = null;
|
|
2942
|
+
}
|
|
2890
2943
|
if (this.chart?.off) {
|
|
2891
2944
|
this.chart.off("metrics:loaded", this.onChildMetricsLoaded, this);
|
|
2892
2945
|
}
|
|
2893
2946
|
await super.onBeforeDestroy();
|
|
2894
2947
|
}
|
|
2948
|
+
/**
|
|
2949
|
+
* Initialize settings popover
|
|
2950
|
+
* @private
|
|
2951
|
+
*/
|
|
2952
|
+
_initSettingsPopover() {
|
|
2953
|
+
const button = this.element.querySelector("[data-settings-trigger]");
|
|
2954
|
+
if (!button) {
|
|
2955
|
+
console.warn("MetricsMiniChartWidget: Settings button not found");
|
|
2956
|
+
return;
|
|
2957
|
+
}
|
|
2958
|
+
if (this._settingsPopover) {
|
|
2959
|
+
try {
|
|
2960
|
+
this._settingsPopover.dispose();
|
|
2961
|
+
} catch (e) {
|
|
2962
|
+
console.warn("Error disposing popover:", e);
|
|
2963
|
+
}
|
|
2964
|
+
this._settingsPopover = null;
|
|
2965
|
+
}
|
|
2966
|
+
const content = this._getSettingsContent();
|
|
2967
|
+
this._settingsPopover = new bootstrap.Popover(button, {
|
|
2968
|
+
content,
|
|
2969
|
+
html: true,
|
|
2970
|
+
placement: "bottom",
|
|
2971
|
+
trigger: "click",
|
|
2972
|
+
sanitize: false,
|
|
2973
|
+
customClass: "metrics-chart-settings-popover"
|
|
2974
|
+
});
|
|
2975
|
+
button.addEventListener("shown.bs.popover", () => {
|
|
2976
|
+
setTimeout(() => {
|
|
2977
|
+
this._attachSettingsHandlers();
|
|
2978
|
+
}, 10);
|
|
2979
|
+
});
|
|
2980
|
+
button.addEventListener("inserted.bs.popover", () => {
|
|
2981
|
+
this._attachSettingsHandlers();
|
|
2982
|
+
});
|
|
2983
|
+
}
|
|
2984
|
+
/**
|
|
2985
|
+
* Generate settings popover HTML content
|
|
2986
|
+
* @private
|
|
2987
|
+
*/
|
|
2988
|
+
_getSettingsContent() {
|
|
2989
|
+
return `
|
|
2990
|
+
<div class="metrics-chart-settings-content" style="min-width: 220px;">
|
|
2991
|
+
<div class="d-flex justify-content-between align-items-center mb-2 pb-2 border-bottom">
|
|
2992
|
+
<h6 class="mb-0">Chart Settings</h6>
|
|
2993
|
+
<button type="button" class="btn-close btn-close-sm" data-setting-action="close" aria-label="Close"></button>
|
|
2994
|
+
</div>
|
|
2995
|
+
|
|
2996
|
+
<label class="form-label small mb-1">Granularity</label>
|
|
2997
|
+
<select class="form-select form-select-sm mb-2" data-setting="granularity">
|
|
2998
|
+
<option value="hours" ${this.chartOptions.granularity === "hours" ? "selected" : ""}>Hours</option>
|
|
2999
|
+
<option value="days" ${this.chartOptions.granularity === "days" ? "selected" : ""}>Days</option>
|
|
3000
|
+
<option value="weeks" ${this.chartOptions.granularity === "weeks" ? "selected" : ""}>Weeks</option>
|
|
3001
|
+
<option value="months" ${this.chartOptions.granularity === "months" ? "selected" : ""}>Months</option>
|
|
3002
|
+
<option value="years" ${this.chartOptions.granularity === "years" ? "selected" : ""}>Years</option>
|
|
3003
|
+
</select>
|
|
3004
|
+
|
|
3005
|
+
<label class="form-label small mb-1">Chart Type</label>
|
|
3006
|
+
<select class="form-select form-select-sm mb-2" data-setting="chartType">
|
|
3007
|
+
<option value="line" ${this.chartOptions.chartType === "line" ? "selected" : ""}>Line</option>
|
|
3008
|
+
<option value="bar" ${this.chartOptions.chartType === "bar" ? "selected" : ""}>Bar</option>
|
|
3009
|
+
</select>
|
|
3010
|
+
|
|
3011
|
+
${this.showDateRange ? `
|
|
3012
|
+
<label class="form-label small mb-1">Date Range</label>
|
|
3013
|
+
<input type="date" class="form-control form-control-sm mb-1" data-setting="dateStart" value="${this.chartOptions.dateStart || ""}" />
|
|
3014
|
+
<input type="date" class="form-control form-control-sm mb-2" data-setting="dateEnd" value="${this.chartOptions.dateEnd || ""}" />
|
|
3015
|
+
` : ""}
|
|
3016
|
+
|
|
3017
|
+
<div class="d-grid gap-2">
|
|
3018
|
+
<button type="button" class="btn btn-sm btn-primary" data-setting-action="apply">Apply</button>
|
|
3019
|
+
<button type="button" class="btn btn-sm btn-outline-secondary" data-setting-action="cancel">Cancel</button>
|
|
3020
|
+
</div>
|
|
3021
|
+
</div>
|
|
3022
|
+
`;
|
|
3023
|
+
}
|
|
3024
|
+
/**
|
|
3025
|
+
* Attach event handlers to settings controls in popover
|
|
3026
|
+
* @private
|
|
3027
|
+
*/
|
|
3028
|
+
_attachSettingsHandlers() {
|
|
3029
|
+
let popoverElement = document.querySelector(".metrics-chart-settings-popover");
|
|
3030
|
+
if (!popoverElement) {
|
|
3031
|
+
popoverElement = document.querySelector(".popover.metrics-chart-settings-popover");
|
|
3032
|
+
}
|
|
3033
|
+
if (!popoverElement) {
|
|
3034
|
+
const popovers = document.querySelectorAll(".popover.show");
|
|
3035
|
+
if (popovers.length > 0) {
|
|
3036
|
+
popoverElement = popovers[popovers.length - 1];
|
|
3037
|
+
}
|
|
3038
|
+
}
|
|
3039
|
+
if (!popoverElement) {
|
|
3040
|
+
console.warn("MetricsMiniChartWidget: Could not find popover element");
|
|
3041
|
+
return;
|
|
3042
|
+
}
|
|
3043
|
+
this._pendingSettings = {
|
|
3044
|
+
granularity: this.chartOptions.granularity,
|
|
3045
|
+
chartType: this.chartOptions.chartType,
|
|
3046
|
+
dateStart: this.chartOptions.dateStart,
|
|
3047
|
+
dateEnd: this.chartOptions.dateEnd
|
|
3048
|
+
};
|
|
3049
|
+
const granularitySelect = popoverElement.querySelector('[data-setting="granularity"]');
|
|
3050
|
+
if (granularitySelect) {
|
|
3051
|
+
granularitySelect.addEventListener("change", (e) => {
|
|
3052
|
+
this._pendingSettings.granularity = e.target.value;
|
|
3053
|
+
});
|
|
3054
|
+
}
|
|
3055
|
+
const chartTypeSelect = popoverElement.querySelector('[data-setting="chartType"]');
|
|
3056
|
+
if (chartTypeSelect) {
|
|
3057
|
+
chartTypeSelect.addEventListener("change", (e) => {
|
|
3058
|
+
this._pendingSettings.chartType = e.target.value;
|
|
3059
|
+
});
|
|
3060
|
+
}
|
|
3061
|
+
if (this.showDateRange) {
|
|
3062
|
+
const dateStartInput = popoverElement.querySelector('[data-setting="dateStart"]');
|
|
3063
|
+
if (dateStartInput) {
|
|
3064
|
+
dateStartInput.addEventListener("change", (e) => {
|
|
3065
|
+
this._pendingSettings.dateStart = e.target.value;
|
|
3066
|
+
});
|
|
3067
|
+
}
|
|
3068
|
+
const dateEndInput = popoverElement.querySelector('[data-setting="dateEnd"]');
|
|
3069
|
+
if (dateEndInput) {
|
|
3070
|
+
dateEndInput.addEventListener("change", (e) => {
|
|
3071
|
+
this._pendingSettings.dateEnd = e.target.value;
|
|
3072
|
+
});
|
|
3073
|
+
}
|
|
3074
|
+
}
|
|
3075
|
+
const applyButton = popoverElement.querySelector('[data-setting-action="apply"]');
|
|
3076
|
+
if (applyButton) {
|
|
3077
|
+
applyButton.addEventListener("click", async () => {
|
|
3078
|
+
await this._applyPendingSettings();
|
|
3079
|
+
if (this._settingsPopover) {
|
|
3080
|
+
this._settingsPopover.hide();
|
|
3081
|
+
}
|
|
3082
|
+
});
|
|
3083
|
+
}
|
|
3084
|
+
const cancelButton = popoverElement.querySelector('[data-setting-action="cancel"]');
|
|
3085
|
+
if (cancelButton) {
|
|
3086
|
+
cancelButton.addEventListener("click", () => {
|
|
3087
|
+
this._pendingSettings = null;
|
|
3088
|
+
if (this._settingsPopover) {
|
|
3089
|
+
this._settingsPopover.hide();
|
|
3090
|
+
}
|
|
3091
|
+
});
|
|
3092
|
+
}
|
|
3093
|
+
const closeButton = popoverElement.querySelector('[data-setting-action="close"]');
|
|
3094
|
+
if (closeButton) {
|
|
3095
|
+
closeButton.addEventListener("click", () => {
|
|
3096
|
+
this._pendingSettings = null;
|
|
3097
|
+
if (this._settingsPopover) {
|
|
3098
|
+
this._settingsPopover.hide();
|
|
3099
|
+
}
|
|
3100
|
+
});
|
|
3101
|
+
}
|
|
3102
|
+
}
|
|
3103
|
+
/**
|
|
3104
|
+
* Apply all pending settings changes
|
|
3105
|
+
* @private
|
|
3106
|
+
*/
|
|
3107
|
+
async _applyPendingSettings() {
|
|
3108
|
+
if (!this._pendingSettings) return;
|
|
3109
|
+
let hasChanges = false;
|
|
3110
|
+
if (this._pendingSettings.granularity !== this.chartOptions.granularity) {
|
|
3111
|
+
this.chartOptions.granularity = this._pendingSettings.granularity;
|
|
3112
|
+
this.chart.granularity = this._pendingSettings.granularity;
|
|
3113
|
+
hasChanges = true;
|
|
3114
|
+
}
|
|
3115
|
+
if (this._pendingSettings.chartType !== this.chartOptions.chartType) {
|
|
3116
|
+
this.chartOptions.chartType = this._pendingSettings.chartType;
|
|
3117
|
+
this.chart.chartType = this._pendingSettings.chartType;
|
|
3118
|
+
hasChanges = true;
|
|
3119
|
+
}
|
|
3120
|
+
if (this._pendingSettings.dateStart !== this.chartOptions.dateStart) {
|
|
3121
|
+
this.chartOptions.dateStart = this._pendingSettings.dateStart;
|
|
3122
|
+
this.chart.dateStart = this._pendingSettings.dateStart;
|
|
3123
|
+
hasChanges = true;
|
|
3124
|
+
}
|
|
3125
|
+
if (this._pendingSettings.dateEnd !== this.chartOptions.dateEnd) {
|
|
3126
|
+
this.chartOptions.dateEnd = this._pendingSettings.dateEnd;
|
|
3127
|
+
this.chart.dateEnd = this._pendingSettings.dateEnd;
|
|
3128
|
+
hasChanges = true;
|
|
3129
|
+
}
|
|
3130
|
+
if (hasChanges) {
|
|
3131
|
+
this._saveSettings();
|
|
3132
|
+
await this.chart.refresh();
|
|
3133
|
+
setTimeout(() => {
|
|
3134
|
+
if (this.showSettings && this.isMounted()) {
|
|
3135
|
+
this._initSettingsPopover();
|
|
3136
|
+
}
|
|
3137
|
+
}, 150);
|
|
3138
|
+
}
|
|
3139
|
+
this._pendingSettings = null;
|
|
3140
|
+
}
|
|
2895
3141
|
refresh() {
|
|
2896
3142
|
if (this.chart) {
|
|
2897
3143
|
if (this.account) this.chart.account = this.account;
|
|
2898
3144
|
this.chart.refresh();
|
|
2899
3145
|
}
|
|
2900
3146
|
}
|
|
3147
|
+
/**
|
|
3148
|
+
* Handle granularity change
|
|
3149
|
+
*/
|
|
3150
|
+
async onActionChangeGranularity(event, element) {
|
|
3151
|
+
const newGranularity = element.value;
|
|
3152
|
+
this.chartOptions.granularity = newGranularity;
|
|
3153
|
+
this.chart.granularity = newGranularity;
|
|
3154
|
+
this._saveSettings();
|
|
3155
|
+
await this.chart.refresh();
|
|
3156
|
+
}
|
|
3157
|
+
/**
|
|
3158
|
+
* Handle chart type change
|
|
3159
|
+
*/
|
|
3160
|
+
async onActionChangeChartType(event, element) {
|
|
3161
|
+
const newChartType = element.value;
|
|
3162
|
+
this.chartOptions.chartType = newChartType;
|
|
3163
|
+
this.chart.chartType = newChartType;
|
|
3164
|
+
this._saveSettings();
|
|
3165
|
+
await this.chart.refresh();
|
|
3166
|
+
}
|
|
3167
|
+
/**
|
|
3168
|
+
* Handle date start change
|
|
3169
|
+
*/
|
|
3170
|
+
async onActionChangeDateStart(event, element) {
|
|
3171
|
+
const newDateStart = element.value;
|
|
3172
|
+
this.chartOptions.dateStart = newDateStart;
|
|
3173
|
+
this.chart.dateStart = newDateStart;
|
|
3174
|
+
this._saveSettings();
|
|
3175
|
+
await this.chart.refresh();
|
|
3176
|
+
}
|
|
3177
|
+
/**
|
|
3178
|
+
* Handle date end change
|
|
3179
|
+
*/
|
|
3180
|
+
async onActionChangeDateEnd(event, element) {
|
|
3181
|
+
const newDateEnd = element.value;
|
|
3182
|
+
this.chartOptions.dateEnd = newDateEnd;
|
|
3183
|
+
this.chart.dateEnd = newDateEnd;
|
|
3184
|
+
this._saveSettings();
|
|
3185
|
+
await this.chart.refresh();
|
|
3186
|
+
}
|
|
3187
|
+
/**
|
|
3188
|
+
* Load settings from localStorage
|
|
3189
|
+
* @private
|
|
3190
|
+
*/
|
|
3191
|
+
_loadSettings() {
|
|
3192
|
+
if (!this.settingsKey) return;
|
|
3193
|
+
try {
|
|
3194
|
+
const stored = localStorage.getItem(`metrics-chart-${this.settingsKey}`);
|
|
3195
|
+
if (stored) {
|
|
3196
|
+
const settings = JSON.parse(stored);
|
|
3197
|
+
if (settings.granularity) {
|
|
3198
|
+
this.chartOptions.granularity = settings.granularity;
|
|
3199
|
+
}
|
|
3200
|
+
if (settings.chartType) {
|
|
3201
|
+
this.chartOptions.chartType = settings.chartType;
|
|
3202
|
+
}
|
|
3203
|
+
if (settings.dateStart !== void 0) {
|
|
3204
|
+
this.chartOptions.dateStart = settings.dateStart;
|
|
3205
|
+
}
|
|
3206
|
+
if (settings.dateEnd !== void 0) {
|
|
3207
|
+
this.chartOptions.dateEnd = settings.dateEnd;
|
|
3208
|
+
}
|
|
3209
|
+
}
|
|
3210
|
+
} catch (error) {
|
|
3211
|
+
console.error("Failed to load chart settings:", error);
|
|
3212
|
+
}
|
|
3213
|
+
}
|
|
3214
|
+
/**
|
|
3215
|
+
* Save settings to localStorage
|
|
3216
|
+
* @private
|
|
3217
|
+
*/
|
|
3218
|
+
_saveSettings() {
|
|
3219
|
+
if (!this.settingsKey) return;
|
|
3220
|
+
try {
|
|
3221
|
+
const settings = {
|
|
3222
|
+
granularity: this.chartOptions.granularity,
|
|
3223
|
+
chartType: this.chartOptions.chartType,
|
|
3224
|
+
dateStart: this.chartOptions.dateStart,
|
|
3225
|
+
dateEnd: this.chartOptions.dateEnd
|
|
3226
|
+
};
|
|
3227
|
+
localStorage.setItem(`metrics-chart-${this.settingsKey}`, JSON.stringify(settings));
|
|
3228
|
+
} catch (error) {
|
|
3229
|
+
console.error("Failed to save chart settings:", error);
|
|
3230
|
+
}
|
|
3231
|
+
}
|
|
2901
3232
|
}
|
|
2902
3233
|
export {
|
|
2903
3234
|
BaseChart as B,
|
|
@@ -2908,4 +3239,4 @@ export {
|
|
|
2908
3239
|
MetricsMiniChart as b,
|
|
2909
3240
|
MetricsMiniChartWidget as c
|
|
2910
3241
|
};
|
|
2911
|
-
//# sourceMappingURL=MetricsMiniChartWidget-
|
|
3242
|
+
//# sourceMappingURL=MetricsMiniChartWidget-bmnV82d1.js.map
|