web-mojo 2.2.0 → 2.2.1
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.es.js +5 -5
- package/dist/auth.cjs.js +1 -1
- package/dist/auth.es.js +1 -1
- package/dist/charts.cjs.js +1 -1
- package/dist/charts.es.js +2 -2
- package/dist/chunks/{ChatView-BsANcDiL.js → ChatView-CWNoGk-B.js} +4 -4
- package/dist/chunks/{ChatView-BsANcDiL.js.map → ChatView-CWNoGk-B.js.map} +1 -1
- package/dist/chunks/{Collection-vtImpCcS.js → Collection-C7rteLDn.js} +2 -2
- package/dist/chunks/{Collection-vtImpCcS.js.map → Collection-C7rteLDn.js.map} +1 -1
- package/dist/chunks/{ContextMenu-DfrWFc5y.js → ContextMenu-JJ51hS-a.js} +2 -2
- package/dist/chunks/{ContextMenu-DfrWFc5y.js.map → ContextMenu-JJ51hS-a.js.map} +1 -1
- package/dist/chunks/{ListView-BtZ7fylv.js → ListView-DWaowghQ.js} +2 -2
- package/dist/chunks/{ListView-BtZ7fylv.js.map → ListView-DWaowghQ.js.map} +1 -1
- package/dist/chunks/{MetricsMiniChartWidget-DaP5lSll.js → MetricsMiniChartWidget-BHrvOb3y.js} +47 -76
- package/dist/chunks/{MetricsMiniChartWidget-DaP5lSll.js.map → MetricsMiniChartWidget-BHrvOb3y.js.map} +1 -1
- package/dist/chunks/{MetricsMiniChartWidget-CTPAXwFC.js → MetricsMiniChartWidget-CZ-cQgUg.js} +2 -2
- package/dist/chunks/MetricsMiniChartWidget-CZ-cQgUg.js.map +1 -0
- package/dist/chunks/{TokenManager-CKkIWgzy.js → TokenManager-CoHKTGNX.js} +3 -3
- package/dist/chunks/{TokenManager-CKkIWgzy.js.map → TokenManager-CoHKTGNX.js.map} +1 -1
- package/dist/chunks/{version-YvYg2w4d.js → version-C9Ldou9O.js} +2 -2
- package/dist/chunks/{version-YvYg2w4d.js.map → version-C9Ldou9O.js.map} +1 -1
- package/dist/chunks/{version-uoDXr8WG.js → version-DMWafX9X.js} +4 -4
- package/dist/chunks/{version-uoDXr8WG.js.map → version-DMWafX9X.js.map} +1 -1
- package/dist/docit.cjs.js +1 -1
- package/dist/docit.es.js +4 -4
- package/dist/index.cjs.js +1 -1
- package/dist/index.es.js +8 -8
- package/dist/lightbox.cjs.js +1 -1
- package/dist/lightbox.es.js +1 -1
- package/dist/map.es.js +1 -1
- package/dist/timeline.es.js +2 -2
- package/package.json +1 -1
- package/dist/chunks/MetricsMiniChartWidget-CTPAXwFC.js.map +0 -1
package/dist/chunks/{MetricsMiniChartWidget-DaP5lSll.js → MetricsMiniChartWidget-BHrvOb3y.js}
RENAMED
|
@@ -2544,7 +2544,7 @@ class MetricsMiniChart extends MiniChart {
|
|
|
2544
2544
|
this.isLoading = false;
|
|
2545
2545
|
this.lastFetch = null;
|
|
2546
2546
|
this.refreshInterval = options.refreshInterval;
|
|
2547
|
-
if (!this.dateStart || !this.dateEnd) {
|
|
2547
|
+
if ((!this.dateStart || !this.dateEnd) && this.defaultDateRange) {
|
|
2548
2548
|
this.setQuickRange(this.defaultDateRange);
|
|
2549
2549
|
}
|
|
2550
2550
|
if (this.slugs && !Array.isArray(this.slugs)) {
|
|
@@ -2697,6 +2697,18 @@ class SettingsView extends View {
|
|
|
2697
2697
|
this.dateEnd = options.dateEnd;
|
|
2698
2698
|
this.showDateRange = options.showDateRange;
|
|
2699
2699
|
}
|
|
2700
|
+
formatDateForInput(date) {
|
|
2701
|
+
if (!date) return "";
|
|
2702
|
+
if (typeof date === "string" && /^\d{4}-\d{2}-\d{2}$/.test(date)) {
|
|
2703
|
+
return date;
|
|
2704
|
+
}
|
|
2705
|
+
const d = date instanceof Date ? date : new Date(date);
|
|
2706
|
+
if (isNaN(d.getTime())) return "";
|
|
2707
|
+
const year = d.getFullYear();
|
|
2708
|
+
const month = String(d.getMonth() + 1).padStart(2, "0");
|
|
2709
|
+
const day = String(d.getDate()).padStart(2, "0");
|
|
2710
|
+
return `${year}-${month}-${day}`;
|
|
2711
|
+
}
|
|
2700
2712
|
getTemplate() {
|
|
2701
2713
|
return `
|
|
2702
2714
|
<div style="min-width: 220px;">
|
|
@@ -2722,8 +2734,8 @@ class SettingsView extends View {
|
|
|
2722
2734
|
|
|
2723
2735
|
${this.showDateRange ? `
|
|
2724
2736
|
<label class="form-label small mb-1">Date Range</label>
|
|
2725
|
-
<input type="date" class="form-control form-control-sm mb-1" data-setting="dateStart" value="${this.dateStart
|
|
2726
|
-
<input type="date" class="form-control form-control-sm mb-2" data-setting="dateEnd" value="${this.dateEnd
|
|
2737
|
+
<input type="date" class="form-control form-control-sm mb-1" data-setting="dateStart" value="${this.formatDateForInput(this.dateStart)}" />
|
|
2738
|
+
<input type="date" class="form-control form-control-sm mb-2" data-setting="dateEnd" value="${this.formatDateForInput(this.dateEnd)}" />
|
|
2727
2739
|
` : ""}
|
|
2728
2740
|
|
|
2729
2741
|
<div class="d-grid gap-2">
|
|
@@ -2763,7 +2775,6 @@ class MetricsMiniChartWidget extends View {
|
|
|
2763
2775
|
this.settingsKey = options.settingsKey || null;
|
|
2764
2776
|
this.showDateRange = options.showDateRange || false;
|
|
2765
2777
|
this.showRefresh = options.showRefresh !== false;
|
|
2766
|
-
this._pendingSettings = null;
|
|
2767
2778
|
this.showTrending = !!options.showTrending;
|
|
2768
2779
|
this.trendRange = options.trendRange ?? null;
|
|
2769
2780
|
this.trendOffset = options.trendOffset ?? 0;
|
|
@@ -2779,7 +2790,6 @@ class MetricsMiniChartWidget extends View {
|
|
|
2779
2790
|
this.trendingLabel = "";
|
|
2780
2791
|
this.chartOptions = {
|
|
2781
2792
|
endpoint: options.endpoint,
|
|
2782
|
-
// defaults inside MetricsMiniChart
|
|
2783
2793
|
account: options.account,
|
|
2784
2794
|
granularity: options.granularity,
|
|
2785
2795
|
slugs: options.slugs,
|
|
@@ -2788,7 +2798,6 @@ class MetricsMiniChartWidget extends View {
|
|
|
2788
2798
|
dateEnd: options.dateEnd,
|
|
2789
2799
|
defaultDateRange: options.defaultDateRange,
|
|
2790
2800
|
refreshInterval: options.refreshInterval,
|
|
2791
|
-
// Visuals and interactions
|
|
2792
2801
|
chartType: options.chartType || "line",
|
|
2793
2802
|
showTooltip: options.showTooltip !== void 0 ? options.showTooltip : true,
|
|
2794
2803
|
showXAxis: options.showXAxis || false,
|
|
@@ -2800,19 +2809,16 @@ class MetricsMiniChartWidget extends View {
|
|
|
2800
2809
|
smoothing: options.smoothing ?? 0.3,
|
|
2801
2810
|
strokeWidth: options.strokeWidth,
|
|
2802
2811
|
barGap: options.barGap,
|
|
2803
|
-
// Optional formatters and templates
|
|
2804
2812
|
valueFormat: options.valueFormat,
|
|
2805
2813
|
labelFormat: options.labelFormat,
|
|
2806
2814
|
tooltipFormatter: options.tooltipFormatter,
|
|
2807
2815
|
tooltipTemplate: options.tooltipTemplate,
|
|
2808
|
-
// Crosshair and axis styling overrides (optional passthroughs)
|
|
2809
2816
|
showCrosshair: options.showCrosshair,
|
|
2810
2817
|
crosshairColor: options.crosshairColor,
|
|
2811
2818
|
crosshairWidth: options.crosshairWidth,
|
|
2812
2819
|
xAxisColor: options.xAxisColor,
|
|
2813
2820
|
xAxisWidth: options.xAxisWidth,
|
|
2814
2821
|
xAxisDashed: options.xAxisDashed,
|
|
2815
|
-
// Other rendering params
|
|
2816
2822
|
padding: options.padding,
|
|
2817
2823
|
minValue: options.minValue,
|
|
2818
2824
|
maxValue: options.maxValue,
|
|
@@ -2829,7 +2835,6 @@ class MetricsMiniChartWidget extends View {
|
|
|
2829
2835
|
this.chart = new MetricsMiniChart({
|
|
2830
2836
|
...this.chartOptions,
|
|
2831
2837
|
containerId: "chart"
|
|
2832
|
-
// mount inside our template container
|
|
2833
2838
|
});
|
|
2834
2839
|
this.addChild(this.chart);
|
|
2835
2840
|
this.header = new View({
|
|
@@ -2851,6 +2856,19 @@ class MetricsMiniChartWidget extends View {
|
|
|
2851
2856
|
</div>`
|
|
2852
2857
|
});
|
|
2853
2858
|
this.addChild(this.header);
|
|
2859
|
+
if (this.showSettings) {
|
|
2860
|
+
this.settingsView = new SettingsView({
|
|
2861
|
+
containerId: "settings",
|
|
2862
|
+
granularity: this.chartOptions.granularity,
|
|
2863
|
+
chartType: this.chartOptions.chartType,
|
|
2864
|
+
dateStart: this.chartOptions.dateStart,
|
|
2865
|
+
dateEnd: this.chartOptions.dateEnd,
|
|
2866
|
+
showDateRange: this.showDateRange
|
|
2867
|
+
});
|
|
2868
|
+
this.settingsView.on("settings:apply", (data) => this._handleSettingsApply(data));
|
|
2869
|
+
this.settingsView.on("settings:cancel", () => this._handleSettingsCancel());
|
|
2870
|
+
this.addChild(this.settingsView);
|
|
2871
|
+
}
|
|
2854
2872
|
if (this.chart?.on) {
|
|
2855
2873
|
this.chart.on("metrics:loaded", this.onChildMetricsLoaded, this);
|
|
2856
2874
|
}
|
|
@@ -2858,18 +2876,12 @@ class MetricsMiniChartWidget extends View {
|
|
|
2858
2876
|
}
|
|
2859
2877
|
async onAfterRender() {
|
|
2860
2878
|
await super.onAfterRender();
|
|
2861
|
-
if (this.showSettings) {
|
|
2879
|
+
if (this.showSettings && this.settingsView) {
|
|
2862
2880
|
this._initSettingsPopover();
|
|
2863
2881
|
}
|
|
2864
2882
|
}
|
|
2865
2883
|
onChildMetricsLoaded() {
|
|
2866
2884
|
this.updateFromChartData({ render: true });
|
|
2867
|
-
if (this.showSettings && this.isMounted() && !this._skipNextPopoverInit) {
|
|
2868
|
-
setTimeout(() => {
|
|
2869
|
-
this._initSettingsPopover();
|
|
2870
|
-
}, 100);
|
|
2871
|
-
}
|
|
2872
|
-
this._skipNextPopoverInit = false;
|
|
2873
2885
|
}
|
|
2874
2886
|
updateFromChartData({ render = true } = {}) {
|
|
2875
2887
|
const values = Array.isArray(this.chart?.data) ? this.chart.data : null;
|
|
@@ -2953,10 +2965,6 @@ class MetricsMiniChartWidget extends View {
|
|
|
2953
2965
|
this.header.render();
|
|
2954
2966
|
}
|
|
2955
2967
|
}
|
|
2956
|
-
/**
|
|
2957
|
-
* Update labels based on current granularity
|
|
2958
|
-
* @private
|
|
2959
|
-
*/
|
|
2960
2968
|
_updateGranularityLabels() {
|
|
2961
2969
|
const granularity = this.chartOptions.granularity || "days";
|
|
2962
2970
|
const nowLabels = {
|
|
@@ -2994,7 +3002,7 @@ class MetricsMiniChartWidget extends View {
|
|
|
2994
3002
|
</button>
|
|
2995
3003
|
` : ""}
|
|
2996
3004
|
${this.showSettings ? `
|
|
2997
|
-
<button class="btn btn-link p-0 text-muted metrics-settings-btn" type="button" data-settings
|
|
3005
|
+
<button class="btn btn-link p-0 text-muted metrics-settings-btn" type="button" data-action="toggle-settings" style="${this.textColor ? `color: ${this.textColor} !important` : ""}">
|
|
2998
3006
|
<i class="bi bi-gear-fill"></i>
|
|
2999
3007
|
</button>
|
|
3000
3008
|
` : ""}
|
|
@@ -3003,15 +3011,12 @@ class MetricsMiniChartWidget extends View {
|
|
|
3003
3011
|
<div class="card-body p-3">
|
|
3004
3012
|
<div data-container="chart-header"></div>
|
|
3005
3013
|
<div data-container="chart"></div>
|
|
3014
|
+
<div data-container="settings" style="display: none;"></div>
|
|
3006
3015
|
</div>
|
|
3007
3016
|
</div>
|
|
3008
3017
|
`;
|
|
3009
3018
|
}
|
|
3010
3019
|
async onBeforeDestroy() {
|
|
3011
|
-
if (this._settingsView) {
|
|
3012
|
-
await this._settingsView.destroy();
|
|
3013
|
-
this._settingsView = null;
|
|
3014
|
-
}
|
|
3015
3020
|
if (this._settingsPopover) {
|
|
3016
3021
|
this._settingsPopover.dispose();
|
|
3017
3022
|
this._settingsPopover = null;
|
|
@@ -3022,50 +3027,30 @@ class MetricsMiniChartWidget extends View {
|
|
|
3022
3027
|
await super.onBeforeDestroy();
|
|
3023
3028
|
}
|
|
3024
3029
|
/**
|
|
3025
|
-
*
|
|
3030
|
+
* Toggle settings popover
|
|
3031
|
+
*/
|
|
3032
|
+
async onActionToggleSettings(event, element) {
|
|
3033
|
+
if (!this._settingsPopover) {
|
|
3034
|
+
this._initSettingsPopover();
|
|
3035
|
+
}
|
|
3036
|
+
this._settingsPopover?.toggle();
|
|
3037
|
+
}
|
|
3038
|
+
/**
|
|
3039
|
+
* Initialize settings popover (once)
|
|
3026
3040
|
* @private
|
|
3027
3041
|
*/
|
|
3028
3042
|
_initSettingsPopover() {
|
|
3029
|
-
const button = this.element.querySelector(
|
|
3030
|
-
if (!button) return;
|
|
3031
|
-
if (this.
|
|
3032
|
-
this._settingsView.destroy();
|
|
3033
|
-
this._settingsView = null;
|
|
3034
|
-
}
|
|
3035
|
-
if (this._settingsPopover) {
|
|
3036
|
-
this._settingsPopover.dispose();
|
|
3037
|
-
this._settingsPopover = null;
|
|
3038
|
-
}
|
|
3039
|
-
if (this._popoverShownHandler) {
|
|
3040
|
-
button.removeEventListener("shown.bs.popover", this._popoverShownHandler);
|
|
3041
|
-
}
|
|
3042
|
-
this._settingsView = new SettingsView({
|
|
3043
|
-
granularity: this.chartOptions.granularity,
|
|
3044
|
-
chartType: this.chartOptions.chartType,
|
|
3045
|
-
dateStart: this.chartOptions.dateStart,
|
|
3046
|
-
dateEnd: this.chartOptions.dateEnd,
|
|
3047
|
-
showDateRange: this.showDateRange
|
|
3048
|
-
});
|
|
3049
|
-
this._settingsView.on("settings:apply", (data) => this._handleSettingsApply(data));
|
|
3050
|
-
this._settingsView.on("settings:cancel", () => this._handleSettingsCancel());
|
|
3051
|
-
this._settingsView.render();
|
|
3052
|
-
this._popoverShownHandler = () => {
|
|
3053
|
-
const popoverBody = document.querySelector(".popover.show .popover-body");
|
|
3054
|
-
if (popoverBody && this._settingsView) {
|
|
3055
|
-
popoverBody.innerHTML = "";
|
|
3056
|
-
popoverBody.appendChild(this._settingsView.element);
|
|
3057
|
-
this._settingsView.bindEvents();
|
|
3058
|
-
}
|
|
3059
|
-
};
|
|
3043
|
+
const button = this.element.querySelector('[data-action="toggle-settings"]');
|
|
3044
|
+
if (!button || !this.settingsView || !this.settingsView.element) return;
|
|
3045
|
+
if (this._settingsPopover) return;
|
|
3060
3046
|
this._settingsPopover = new bootstrap.Popover(button, {
|
|
3061
|
-
content:
|
|
3047
|
+
content: this.settingsView.element,
|
|
3062
3048
|
html: true,
|
|
3063
3049
|
placement: "bottom",
|
|
3064
|
-
trigger: "
|
|
3050
|
+
trigger: "manual",
|
|
3065
3051
|
sanitize: false,
|
|
3066
3052
|
customClass: "metrics-chart-settings-popover"
|
|
3067
3053
|
});
|
|
3068
|
-
button.addEventListener("shown.bs.popover", this._popoverShownHandler);
|
|
3069
3054
|
}
|
|
3070
3055
|
/**
|
|
3071
3056
|
* Handle settings apply
|
|
@@ -3133,13 +3118,7 @@ class MetricsMiniChartWidget extends View {
|
|
|
3133
3118
|
}
|
|
3134
3119
|
if (hasChanges) {
|
|
3135
3120
|
this._saveSettings();
|
|
3136
|
-
this._skipNextPopoverInit = true;
|
|
3137
3121
|
await this.chart.refresh();
|
|
3138
|
-
setTimeout(() => {
|
|
3139
|
-
if (this.showSettings && this.isMounted()) {
|
|
3140
|
-
this._initSettingsPopover();
|
|
3141
|
-
}
|
|
3142
|
-
}, 150);
|
|
3143
3122
|
}
|
|
3144
3123
|
}
|
|
3145
3124
|
/**
|
|
@@ -3173,10 +3152,6 @@ class MetricsMiniChartWidget extends View {
|
|
|
3173
3152
|
this.chart.refresh();
|
|
3174
3153
|
}
|
|
3175
3154
|
}
|
|
3176
|
-
/**
|
|
3177
|
-
* Load settings from localStorage
|
|
3178
|
-
* @private
|
|
3179
|
-
*/
|
|
3180
3155
|
_loadSettings() {
|
|
3181
3156
|
if (!this.settingsKey) return;
|
|
3182
3157
|
try {
|
|
@@ -3200,10 +3175,6 @@ class MetricsMiniChartWidget extends View {
|
|
|
3200
3175
|
console.error("Failed to load chart settings:", error);
|
|
3201
3176
|
}
|
|
3202
3177
|
}
|
|
3203
|
-
/**
|
|
3204
|
-
* Save settings to localStorage
|
|
3205
|
-
* @private
|
|
3206
|
-
*/
|
|
3207
3178
|
_saveSettings() {
|
|
3208
3179
|
if (!this.settingsKey) return;
|
|
3209
3180
|
try {
|
|
@@ -3228,4 +3199,4 @@ export {
|
|
|
3228
3199
|
MetricsMiniChart as b,
|
|
3229
3200
|
MetricsMiniChartWidget as c
|
|
3230
3201
|
};
|
|
3231
|
-
//# sourceMappingURL=MetricsMiniChartWidget-
|
|
3202
|
+
//# sourceMappingURL=MetricsMiniChartWidget-BHrvOb3y.js.map
|