@feedmepos/mf-report 5.27.54 → 5.28.0
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/{App-C6xpf-Q0.js → App-BDhSFQX_.js} +45 -44
- package/dist/DateRangeSelect-CRsKMi0U.js +437 -0
- package/dist/{Default.vue_vue_type_script_setup_true_lang-BwPZXC_d.js → Default.vue_vue_type_script_setup_true_lang-WGOOX2b8.js} +12 -11
- package/dist/{DynamicWidget.vue_vue_type_script_setup_true_lang-BpgXiPBY.js → DynamicWidget.vue_vue_type_script_setup_true_lang-CQM-l5Rk.js} +182 -181
- package/dist/{GlobalFilterSelect.vue_vue_type_script_setup_true_lang-CVShUWJC.js → GlobalFilterSelect.vue_vue_type_script_setup_true_lang-CMioHpn1.js} +5091 -5717
- package/dist/{InsightView-BYW66Wrv.js → InsightView-lnOobZAr.js} +17 -15
- package/dist/{Integration-DQPJBE-0.js → Integration-D5ssimUg.js} +27 -25
- package/dist/{Integrations-BW4H9lUS.js → Integrations-CaqGvkzI.js} +8 -7
- package/dist/{Layout-CMlh08aB.js → Layout-DS0XCT_E.js} +1 -1
- package/dist/LocationSelect.vue_vue_type_script_setup_true_lang-DC9QYJk-.js +8055 -0
- package/dist/{MenuTab.vue_vue_type_script_setup_true_lang-BUvD1_b0.js → MenuTab.vue_vue_type_script_setup_true_lang-nOukNXp3.js} +11 -10
- package/dist/{NavigationTab.vue_vue_type_script_setup_true_lang-TpeQ_Wm1.js → NavigationTab.vue_vue_type_script_setup_true_lang-DXNbt08D.js} +9636 -17677
- package/dist/{OverviewView-BtGpQkBY.js → OverviewView-BkIozvMs.js} +5 -5
- package/dist/{Report-CJ9myNLK.js → Report-HiSGRNhn.js} +27 -25
- package/dist/ReportCanvasView-ILVhB1KL.js +448 -0
- package/dist/{ReportEditor-DtnTBbY1.js → ReportEditor-B4tyVB8s.js} +30 -28
- package/dist/{ReportView-Ci8nFyI9.js → ReportView-CIQQHvWT.js} +14 -13
- package/dist/ReportViewRoute-B3KwVB0v.js +18 -0
- package/dist/{SelectComponent.vue_vue_type_script_setup_true_lang-Ckn2p74A.js → SelectComponent.vue_vue_type_script_setup_true_lang-DW7Dk7iQ.js} +1 -1
- package/dist/{Setting-QSiMSAQk.js → Setting-CvToMUKq.js} +5 -5
- package/dist/{Template-CAPlAQO9.js → Template-BBQEaHrM.js} +10 -9
- package/dist/{TileEditor-e7ZCWMU9.js → TileEditor-Cqy98LmJ.js} +19 -17
- package/dist/{TilePageStack.vue_vue_type_script_setup_true_lang-B4g3YPzM.js → TilePageStack.vue_vue_type_script_setup_true_lang-CzggUdfI.js} +3 -3
- package/dist/{TransitionFade-DqIazHHG.js → TransitionFade-D-8BYs6T.js} +36 -33
- package/dist/{_plugin-vue_export-helper-kkiiQoKl.js → _plugin-vue_export-helper-C6QDExPN.js} +276 -291
- package/dist/{app-BAgs-zHf.js → app-Bjt_JuJi.js} +670 -567
- package/dist/app.js +1 -1
- package/dist/assets/{formatChartData.worker-epD1fsTW.js → formatChartData.worker-BeBGCyYW.js} +1 -1
- package/dist/assets/{processTableData.worker-BJZ_Z45H.js → processTableData.worker-frTYV0ok.js} +39 -39
- package/dist/global-loader-BuxFfehu.js +19 -0
- package/dist/index-CtZE4sab.js +82 -0
- package/dist/report-DjGDWvm3.js +635 -0
- package/dist/report-canvas-frame.html +888 -0
- package/dist/report-canvas-libs/chart.js-4.js +14 -0
- package/dist/report-canvas-libs/fm-ui-1.js +904 -0
- package/dist/style.css +1 -1
- package/dist/{useRestaurantPermission-ChYMJfXG.js → useRestaurantPermission-Dkbh_cv8.js} +4 -4
- package/package.json +1 -1
- package/dist/DateRangeSelect-DYVOvSCA.js +0 -517
|
@@ -1,16 +1,17 @@
|
|
|
1
|
-
import { defineComponent as me, resolveComponent as X, createBlock as pe, openBlock as A, unref as u, isRef as Fe, withCtx as W, createElementVNode as
|
|
1
|
+
import { defineComponent as me, resolveComponent as X, createBlock as pe, openBlock as A, unref as u, isRef as Fe, withCtx as W, createElementVNode as oe, createVNode as Y, toDisplayString as ae, createTextVNode as Ne, onMounted as fe, watch as C, ref as U, computed as se, onBeforeMount as $e, onBeforeUnmount as xe, createElementBlock as H, Fragment as Je } from "vue";
|
|
2
2
|
import { detectLocale as j, useCoreStore as V } from "@feedmepos/mf-common";
|
|
3
|
-
import { d as q, u as Qe, a as ie, b as Ue, c as ce, e as je, f as Pe, g as de } from "./app-
|
|
3
|
+
import { d as q, u as Qe, a as ie, b as Ue, c as ce, e as je, f as Pe, g as de } from "./app-Bjt_JuJi.js";
|
|
4
4
|
import { storeToRefs as k } from "pinia";
|
|
5
|
-
import { u as Ge
|
|
6
|
-
import { u as
|
|
7
|
-
import { u as
|
|
5
|
+
import { u as Ge } from "./global-loader-BuxFfehu.js";
|
|
6
|
+
import { u as Ke, a as We } from "./report-DjGDWvm3.js";
|
|
7
|
+
import { u as He, _ as Ve } from "./NavigationTab.vue_vue_type_script_setup_true_lang-DXNbt08D.js";
|
|
8
8
|
import { u as ue } from "./message-dialog-UoMWOnil.js";
|
|
9
|
+
import { u as Xe } from "./_plugin-vue_export-helper-C6QDExPN.js";
|
|
9
10
|
import { useRoute as Ye, useRouter as Ze } from "vue-router";
|
|
10
11
|
const Me = { class: "fm-typo-en-body-md-400 text-ellipsis overflow-hidden" }, et = /* @__PURE__ */ me({
|
|
11
12
|
__name: "Dialog",
|
|
12
13
|
setup(T) {
|
|
13
|
-
const { t: c } =
|
|
14
|
+
const { t: c } = Xe(), f = ue(), { isOpened: g, message: R, title: L } = k(ue());
|
|
14
15
|
return (O, _) => {
|
|
15
16
|
const z = X("FmButton"), P = X("FmDialog");
|
|
16
17
|
return A(), pe(P, {
|
|
@@ -21,13 +22,13 @@ const Me = { class: "fm-typo-en-body-md-400 text-ellipsis overflow-hidden" }, et
|
|
|
21
22
|
"z-index": 3e3
|
|
22
23
|
}, {
|
|
23
24
|
"dialog-header": W(() => [
|
|
24
|
-
Ne(
|
|
25
|
+
Ne(ae(u(L)), 1)
|
|
25
26
|
]),
|
|
26
27
|
default: W(() => [
|
|
27
|
-
|
|
28
|
+
oe("p", Me, ae(u(R)), 1)
|
|
28
29
|
]),
|
|
29
30
|
"dialog-footer": W(() => [
|
|
30
|
-
_[1] || (_[1] =
|
|
31
|
+
_[1] || (_[1] = oe("div", { class: "grow" }, null, -1)),
|
|
31
32
|
Y(z, {
|
|
32
33
|
label: u(c)("report.common.cancel"),
|
|
33
34
|
variant: "tertiary",
|
|
@@ -61,7 +62,7 @@ function tt() {
|
|
|
61
62
|
};
|
|
62
63
|
}
|
|
63
64
|
q.locale(j() === "zh-CN" ? "zh-cn" : "en");
|
|
64
|
-
const nt = ["src"], rt = ["src"],
|
|
65
|
+
const nt = ["src"], rt = ["src"], gt = /* @__PURE__ */ me({
|
|
65
66
|
__name: "App",
|
|
66
67
|
setup(T) {
|
|
67
68
|
const { businessId: c, token: f, country: g } = k(Qe()), { sessionUser: R, currentBusiness: L, currentCountry: O, registerSidebarComponent: _ } = V(), {
|
|
@@ -70,7 +71,7 @@ const nt = ["src"], rt = ["src"], ft = /* @__PURE__ */ me({
|
|
|
70
71
|
beginBusinessLoad: G,
|
|
71
72
|
completeBusinessLoad: ge,
|
|
72
73
|
resetTimezoneContext: ye
|
|
73
|
-
} = ie(), ve = Ue(), { getFeatureFlags: Se } = ve, { version: y } = k(ce()), { getSettings: De } = je(), { promptLoader: he } =
|
|
74
|
+
} = ie(), ve = Ue(), { getFeatureFlags: Se } = ve, { version: y } = k(ce()), { getSettings: De } = je(), { promptLoader: he } = Ge(), n = Ye(), B = Ze(), E = Ke(), Z = He(), a = ie(), F = ce(), { suppressReportRouteSync: N } = k(F), { getReports: Ie, getOverviewReport: _e, getReportConfig: Re, currentReportId: M } = E, { currentReportId: Le, reports: Ee } = k(E), { getSchema: be } = We(), { fetchSchedules: we } = Z, { init: Ae } = Pe(), K = U("v5"), $ = U(!1), x = U(!0), Ce = se(() => `https://portal-v1.feedme.cc/b/${c.value}/report/CLOSE_UP?showHeader=false&country=${g.value.toUpperCase()}&menuOption=business-report&token=${f.value}&v2=true&reportV5Button=true`), ke = se(() => `https://report-v4.feedme.cc?businessId=${c.value}&country=${g.value}&token=${f.value}&reportV3Button=true`);
|
|
74
75
|
C(
|
|
75
76
|
[() => L.value, () => R.value, () => O.value],
|
|
76
77
|
() => {
|
|
@@ -101,9 +102,9 @@ const nt = ["src"], rt = ["src"], ft = /* @__PURE__ */ me({
|
|
|
101
102
|
C(y, () => {
|
|
102
103
|
["v3", "v4"].includes(y.value) ? V().hideSidebarToggle(!0) : V().hideSidebarToggle(!1);
|
|
103
104
|
}), $e(() => {
|
|
104
|
-
_(
|
|
105
|
+
_(Ve);
|
|
105
106
|
}), fe(() => {
|
|
106
|
-
console.log("5.
|
|
107
|
+
console.log("5.28.0", !0), window.addEventListener("message", ee), window.addEventListener("message", te);
|
|
107
108
|
}), xe(() => {
|
|
108
109
|
window.removeEventListener("message", ee), window.removeEventListener("message", te), E.$dispose(), Z.$dispose();
|
|
109
110
|
});
|
|
@@ -119,14 +120,14 @@ const nt = ["src"], rt = ["src"], ft = /* @__PURE__ */ me({
|
|
|
119
120
|
const e = t.includes("%") ? [t, qe(t)] : [t];
|
|
120
121
|
for (const r of e)
|
|
121
122
|
try {
|
|
122
|
-
const
|
|
123
|
-
if (typeof
|
|
123
|
+
const o = JSON.parse(r);
|
|
124
|
+
if (typeof o == "string")
|
|
124
125
|
try {
|
|
125
|
-
return JSON.parse(
|
|
126
|
+
return JSON.parse(o);
|
|
126
127
|
} catch {
|
|
127
|
-
return
|
|
128
|
+
return o;
|
|
128
129
|
}
|
|
129
|
-
return
|
|
130
|
+
return o;
|
|
130
131
|
} catch {
|
|
131
132
|
}
|
|
132
133
|
}
|
|
@@ -137,37 +138,37 @@ const nt = ["src"], rt = ["src"], ft = /* @__PURE__ */ me({
|
|
|
137
138
|
}
|
|
138
139
|
function l(t, e, r) {
|
|
139
140
|
if (typeof t != "string" || t.length === 0) return;
|
|
140
|
-
const
|
|
141
|
-
return (e === "start" ?
|
|
141
|
+
const o = t.includes("T") ? q(t).tz(r) : q.tz(t, r);
|
|
142
|
+
return (e === "start" ? o.startOf("day") : o.endOf("day")).utc().toISOString();
|
|
142
143
|
}
|
|
143
144
|
function Te(t = n.query) {
|
|
144
|
-
const e = t, r =
|
|
145
|
+
const e = t, r = a.timezone, o = l(e.startDate, "start", r), d = l(e.endDate, "end", r), i = typeof e.timeStart == "string", v = typeof e.timeEnd == "string", S = J(e.timeStart), D = J(e.timeEnd), b = ne(S) ? S : null, h = ne(D) ? D : null, m = l(e.compareStartDate, "start", r), w = l(e.compareEndDate, "end", r), Q = e.isAllLocation === "true" || e.isAllLocation === void 0;
|
|
145
146
|
let p = [];
|
|
146
147
|
if (Q)
|
|
147
|
-
p =
|
|
148
|
+
p = a.selectedLocationIds ?? [];
|
|
148
149
|
else {
|
|
149
150
|
const s = J(e.locationIds);
|
|
150
151
|
p = Array.isArray(s) ? s : [];
|
|
151
152
|
}
|
|
152
153
|
let I = e.reportId || M;
|
|
153
|
-
if (Ee.value.find((s) => s.id === I) || (I = M), I && I !== E.currentReportId && E.updateCurrentReportId(I),
|
|
154
|
-
const s =
|
|
155
|
-
(s.startDate !==
|
|
154
|
+
if (Ee.value.find((s) => s.id === I) || (I = M), I && I !== E.currentReportId && E.updateCurrentReportId(I), o || d) {
|
|
155
|
+
const s = a.dateRange;
|
|
156
|
+
(s.startDate !== o || s.endDate !== d) && a.setDateRange({ startDate: o, endDate: d });
|
|
156
157
|
}
|
|
157
158
|
if (i || v) {
|
|
158
|
-
const s =
|
|
159
|
-
(s.start !== b || s.end !== h) &&
|
|
159
|
+
const s = a.timeRange;
|
|
160
|
+
(s.start !== b || s.end !== h) && a.setTimeRange({ start: b, end: h });
|
|
160
161
|
}
|
|
161
162
|
if (m || w) {
|
|
162
|
-
const s =
|
|
163
|
-
(s.startDate !== m || s.endDate !== w) &&
|
|
163
|
+
const s = a.compareDateRange;
|
|
164
|
+
(s.startDate !== m || s.endDate !== w) && a.setCompareDateRange({
|
|
164
165
|
startDate: m,
|
|
165
166
|
endDate: w
|
|
166
167
|
});
|
|
167
168
|
}
|
|
168
169
|
if (!Q) {
|
|
169
|
-
const s =
|
|
170
|
-
s.length === p.length && s.every((ze, Be) => ze === p[Be]) ||
|
|
170
|
+
const s = a.selectedLocationIds;
|
|
171
|
+
s.length === p.length && s.every((ze, Be) => ze === p[Be]) || a.setSelectedLocationIds(p);
|
|
171
172
|
}
|
|
172
173
|
return {
|
|
173
174
|
// TODO: this returned value can used for getBusinessSetting
|
|
@@ -187,16 +188,16 @@ const nt = ["src"], rt = ["src"], ft = /* @__PURE__ */ me({
|
|
|
187
188
|
async (t, e) => {
|
|
188
189
|
if (t !== "") {
|
|
189
190
|
$.value = !1, G(t);
|
|
190
|
-
const r = "mf-report-prev-business-id",
|
|
191
|
+
const r = "mf-report-prev-business-id", o = (() => {
|
|
191
192
|
try {
|
|
192
193
|
return sessionStorage.getItem(r);
|
|
193
194
|
} catch {
|
|
194
195
|
return null;
|
|
195
196
|
}
|
|
196
|
-
})(), d = !!
|
|
197
|
+
})(), d = !!o && o !== t;
|
|
197
198
|
let i = { ...n.query }, v = !1;
|
|
198
199
|
if (!x.value || e !== void 0 || d) {
|
|
199
|
-
ye(),
|
|
200
|
+
ye(), a.setSelectedLocationIds([]);
|
|
200
201
|
const {
|
|
201
202
|
locationIds: S,
|
|
202
203
|
startDate: D,
|
|
@@ -277,11 +278,11 @@ const nt = ["src"], rt = ["src"], ft = /* @__PURE__ */ me({
|
|
|
277
278
|
), C(
|
|
278
279
|
() => ($.value, {
|
|
279
280
|
reportId: Le.value,
|
|
280
|
-
selectedLocationIds:
|
|
281
|
-
dateRange:
|
|
282
|
-
timeRange:
|
|
283
|
-
compareDateRange:
|
|
284
|
-
timezone:
|
|
281
|
+
selectedLocationIds: a.selectedLocationIds,
|
|
282
|
+
dateRange: a.dateRange,
|
|
283
|
+
timeRange: a.timeRange,
|
|
284
|
+
compareDateRange: a.compareDateRange,
|
|
285
|
+
timezone: a.timezone
|
|
285
286
|
}),
|
|
286
287
|
(t) => {
|
|
287
288
|
if (!$.value || !t.reportId || x.value) return;
|
|
@@ -289,7 +290,7 @@ const nt = ["src"], rt = ["src"], ft = /* @__PURE__ */ me({
|
|
|
289
290
|
N.value = !1;
|
|
290
291
|
return;
|
|
291
292
|
}
|
|
292
|
-
const e = t.selectedLocationIds, r = t.dateRange,
|
|
293
|
+
const e = t.selectedLocationIds, r = t.dateRange, o = t.timeRange, d = t.compareDateRange, i = {
|
|
293
294
|
...n.query,
|
|
294
295
|
reportId: t.reportId,
|
|
295
296
|
startDate: l(r.startDate, "start", t.timezone),
|
|
@@ -300,9 +301,9 @@ const nt = ["src"], rt = ["src"], ft = /* @__PURE__ */ me({
|
|
|
300
301
|
t.timezone
|
|
301
302
|
),
|
|
302
303
|
compareEndDate: l(d.endDate, "end", t.timezone),
|
|
303
|
-
timeStart:
|
|
304
|
-
timeEnd:
|
|
305
|
-
}, v = e.length ===
|
|
304
|
+
timeStart: o.start ? JSON.stringify(o.start) : void 0,
|
|
305
|
+
timeEnd: o.end ? JSON.stringify(o.end) : void 0
|
|
306
|
+
}, v = e.length === a.locations.length;
|
|
306
307
|
i.isAllLocation = String(v), v ? delete i.locationIds : e.length > 0 ? i.locationIds = JSON.stringify(e) : delete i.locationIds;
|
|
307
308
|
const S = JSON.stringify(n.query), D = JSON.stringify(i);
|
|
308
309
|
S !== D && B.replace({
|
|
@@ -330,5 +331,5 @@ const nt = ["src"], rt = ["src"], ft = /* @__PURE__ */ me({
|
|
|
330
331
|
}
|
|
331
332
|
});
|
|
332
333
|
export {
|
|
333
|
-
|
|
334
|
+
gt as default
|
|
334
335
|
};
|
|
@@ -0,0 +1,437 @@
|
|
|
1
|
+
import { defineComponent as te, resolveComponent as A, createBlock as b, openBlock as C, normalizeClass as ce, withCtx as U, createCommentVNode as E, createElementVNode as I, toDisplayString as me, renderSlot as fe, mergeModels as K, useModel as z, ref as O, computed as L, watch as M, nextTick as J, onMounted as De, onBeforeUnmount as ye, createElementBlock as pe, unref as Y, createVNode as Q } from "vue";
|
|
2
|
+
import { d as u, a as ge, C as P, j as ve } from "./app-Bjt_JuJi.js";
|
|
3
|
+
import { detectLocale as X } from "@feedmepos/mf-common";
|
|
4
|
+
import { u as he, _ as Ce } from "./_plugin-vue_export-helper-C6QDExPN.js";
|
|
5
|
+
import { storeToRefs as be } from "pinia";
|
|
6
|
+
import { useSnackbar as Re } from "@feedmepos/ui-library";
|
|
7
|
+
var $ = /* @__PURE__ */ ((e) => (e.Year = "YEAR", e.Month = "MONTH", e.Week = "WEEK", e.Day = "DAY", e))($ || {}), Me = /* @__PURE__ */ ((e) => (e.Yesterday = "YESTERDAY", e.Today = "TODAY", e))(Me || {});
|
|
8
|
+
function ze(e, n = 100) {
|
|
9
|
+
let l = null;
|
|
10
|
+
const f = function(...D) {
|
|
11
|
+
return l && clearTimeout(l), new Promise((d) => {
|
|
12
|
+
l = setTimeout(() => {
|
|
13
|
+
l = null;
|
|
14
|
+
const h = e(...D);
|
|
15
|
+
d(h);
|
|
16
|
+
}, n);
|
|
17
|
+
});
|
|
18
|
+
};
|
|
19
|
+
return f.cancel = () => {
|
|
20
|
+
l && (clearTimeout(l), l = null);
|
|
21
|
+
}, f;
|
|
22
|
+
}
|
|
23
|
+
function Se() {
|
|
24
|
+
return [...Array(12).keys()].map((e) => u().month(e).format("MMM"));
|
|
25
|
+
}
|
|
26
|
+
function Le(e, n, l = "") {
|
|
27
|
+
const f = (r) => /^[\x00-\x7F]*$/.test(r) ? " " : "", D = (r) => /^每年/.test(r), d = (r) => /^每周|^每週/.test(r), h = (r) => /^每月/.test(r);
|
|
28
|
+
switch (e.type) {
|
|
29
|
+
case $.Day:
|
|
30
|
+
return n("report.schedule.everyDay");
|
|
31
|
+
case $.Week: {
|
|
32
|
+
const r = n("report.schedule.everyWeek"), y = d(r);
|
|
33
|
+
let s = `${r}${f(r)}`;
|
|
34
|
+
const p = [
|
|
35
|
+
n("report.days.sunday"),
|
|
36
|
+
n("report.days.monday"),
|
|
37
|
+
n("report.days.tuesday"),
|
|
38
|
+
n("report.days.wednesday"),
|
|
39
|
+
n("report.days.thursday"),
|
|
40
|
+
n("report.days.friday"),
|
|
41
|
+
n("report.days.saturday")
|
|
42
|
+
];
|
|
43
|
+
if (e.days)
|
|
44
|
+
for (let m = 0; m < e.days.length; m++) {
|
|
45
|
+
const T = y ? p[e.days[m]].replace(/^[周週]/, "") : p[e.days[m]];
|
|
46
|
+
s = s + T + (m !== e.days.length - 1 ? "," : "");
|
|
47
|
+
}
|
|
48
|
+
return s;
|
|
49
|
+
}
|
|
50
|
+
case $.Month: {
|
|
51
|
+
const r = n("report.schedule.everyMonth"), y = h(r);
|
|
52
|
+
let s = `${r}${f(r)}`;
|
|
53
|
+
return e.days && (s = s + (y ? e.days.map((p) => `${p}日`).join(",") : e.days.join(","))), s;
|
|
54
|
+
}
|
|
55
|
+
case $.Year: {
|
|
56
|
+
if (!e.months && !e.days)
|
|
57
|
+
return n("report.schedule.customDate");
|
|
58
|
+
const r = n("report.schedule.everyYear"), y = D(r);
|
|
59
|
+
let s = `${r}${y ? " " : f(r)}`;
|
|
60
|
+
if (e.months) {
|
|
61
|
+
const p = Se();
|
|
62
|
+
s = s + e.months.map((m) => p[m - 1]).join(",");
|
|
63
|
+
}
|
|
64
|
+
return e.months && e.days && (s = y ? `${s} 的 ` : `${s} ${n("report.common.and")} `), e.days && (s = s + (y ? e.days.map((p) => `${p}日`).join(",") : e.days.join(","))), s;
|
|
65
|
+
}
|
|
66
|
+
default:
|
|
67
|
+
return l;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
function Z(e = {
|
|
71
|
+
startDate: null,
|
|
72
|
+
endDate: null,
|
|
73
|
+
locale: "en-US",
|
|
74
|
+
timezone: void 0
|
|
75
|
+
}) {
|
|
76
|
+
if (!e.startDate || !e.endDate)
|
|
77
|
+
return "No comparison";
|
|
78
|
+
let n = u().subtract(1, "day").endOf("day"), l = u().endOf("day");
|
|
79
|
+
return e.startDate && (n = e.timezone ? u(e.startDate).tz(e.timezone).locale(e.locale) : u(e.startDate).locale(e.locale)), e.endDate && (l = e.timezone ? u(e.endDate).tz(e.timezone).locale(e.locale) : u(e.endDate).locale(e.locale)), n.format("YYYY") !== l.format("YYYY") ? `${n.format("DD MMM YYYY")} - ${l.format("DD MMM YYYY")}` : `${n.format("DD MMM")} - ${l.format("DD MMM YYYY")}`;
|
|
80
|
+
}
|
|
81
|
+
function Ue(e = {
|
|
82
|
+
startTime: null,
|
|
83
|
+
endTime: null,
|
|
84
|
+
locale: "en-US"
|
|
85
|
+
}) {
|
|
86
|
+
const n = "hh:mmA", { startTime: l, endTime: f, locale: D } = e;
|
|
87
|
+
if (!l || !f) return "";
|
|
88
|
+
const d = u().set("hour", l.hour).set("minute", l.minute).locale(D), h = u().set("hour", f.hour).set("minute", f.minute).locale(D);
|
|
89
|
+
return `${d.format(n)}-${h.format(n)}`;
|
|
90
|
+
}
|
|
91
|
+
const Ye = { class: "fm-typo-en-body-md-600 flex items-center gap-1 flex-1 min-w-0" }, $e = { class: "text-ellipsis overflow-hidden whitespace-nowrap flex-1 min-w-0" }, Te = { class: "whitespace-nowrap flex-none" }, _ = /* @__PURE__ */ te({
|
|
92
|
+
__name: "FilterChip",
|
|
93
|
+
props: {
|
|
94
|
+
label: {
|
|
95
|
+
type: String,
|
|
96
|
+
default: ""
|
|
97
|
+
},
|
|
98
|
+
leftIcon: {
|
|
99
|
+
type: String,
|
|
100
|
+
default: ""
|
|
101
|
+
},
|
|
102
|
+
rightIcon: {
|
|
103
|
+
type: String,
|
|
104
|
+
default: ""
|
|
105
|
+
},
|
|
106
|
+
trailingIcon: {
|
|
107
|
+
type: String,
|
|
108
|
+
default: ""
|
|
109
|
+
},
|
|
110
|
+
loading: {
|
|
111
|
+
type: Boolean,
|
|
112
|
+
default: !1
|
|
113
|
+
}
|
|
114
|
+
},
|
|
115
|
+
setup(e) {
|
|
116
|
+
const n = e;
|
|
117
|
+
return (l, f) => {
|
|
118
|
+
const D = A("FmIcon"), d = A("FmCircularProgress"), h = A("FmChip");
|
|
119
|
+
return C(), b(h, {
|
|
120
|
+
"aria-busy": n.loading,
|
|
121
|
+
class: ce([
|
|
122
|
+
"bg-fm-color-neutral-gray-100 text-fm-color-neutral-gray-400 max-w-[400px] flex items-center gap-1 transition-opacity",
|
|
123
|
+
n.loading && "opacity-80"
|
|
124
|
+
])
|
|
125
|
+
}, {
|
|
126
|
+
default: U(() => [
|
|
127
|
+
e.leftIcon ? (C(), b(D, {
|
|
128
|
+
key: 0,
|
|
129
|
+
name: n.leftIcon,
|
|
130
|
+
size: "sm",
|
|
131
|
+
outline: "",
|
|
132
|
+
class: "flex-none"
|
|
133
|
+
}, null, 8, ["name"])) : E("", !0),
|
|
134
|
+
I("div", Ye, [
|
|
135
|
+
I("span", $e, me(n.label), 1),
|
|
136
|
+
e.rightIcon ? (C(), b(D, {
|
|
137
|
+
key: 0,
|
|
138
|
+
name: e.rightIcon,
|
|
139
|
+
size: "sm",
|
|
140
|
+
outline: "",
|
|
141
|
+
class: "flex-none"
|
|
142
|
+
}, null, 8, ["name"])) : E("", !0),
|
|
143
|
+
I("span", Te, [
|
|
144
|
+
fe(l.$slots, "default")
|
|
145
|
+
]),
|
|
146
|
+
n.loading ? (C(), b(d, {
|
|
147
|
+
key: 1,
|
|
148
|
+
size: "md",
|
|
149
|
+
class: "flex-none scale-75"
|
|
150
|
+
})) : e.trailingIcon ? (C(), b(D, {
|
|
151
|
+
key: 2,
|
|
152
|
+
name: e.trailingIcon,
|
|
153
|
+
size: "sm",
|
|
154
|
+
outline: "",
|
|
155
|
+
class: "flex-none"
|
|
156
|
+
}, null, 8, ["name"])) : E("", !0)
|
|
157
|
+
])
|
|
158
|
+
]),
|
|
159
|
+
_: 3
|
|
160
|
+
}, 8, ["aria-busy", "class"]);
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
}), we = { class: "flex gap-2 items-center" }, S = "YYYY-MM-DD", ee = ".fm-calendar__cell[id]", xe = ".fm-calendar__cell__button", ke = /* @__PURE__ */ te({
|
|
164
|
+
__name: "DateRangeSelect",
|
|
165
|
+
props: /* @__PURE__ */ K({
|
|
166
|
+
compare: {
|
|
167
|
+
type: Boolean,
|
|
168
|
+
default: !1
|
|
169
|
+
},
|
|
170
|
+
datePredefinedRanges: {
|
|
171
|
+
type: Array,
|
|
172
|
+
default: () => ve()
|
|
173
|
+
},
|
|
174
|
+
label: {
|
|
175
|
+
type: String,
|
|
176
|
+
required: !1,
|
|
177
|
+
default: null
|
|
178
|
+
},
|
|
179
|
+
removable: {
|
|
180
|
+
type: Boolean,
|
|
181
|
+
required: !1,
|
|
182
|
+
default: !1
|
|
183
|
+
},
|
|
184
|
+
minDate: {
|
|
185
|
+
type: String,
|
|
186
|
+
required: !1,
|
|
187
|
+
default: void 0
|
|
188
|
+
}
|
|
189
|
+
}, {
|
|
190
|
+
compareType: {
|
|
191
|
+
type: String,
|
|
192
|
+
default: P.PRECEDING_PERIOD
|
|
193
|
+
},
|
|
194
|
+
compareTypeModifiers: {},
|
|
195
|
+
dateRange: {
|
|
196
|
+
type: Object,
|
|
197
|
+
default: () => ({
|
|
198
|
+
startDate: void 0,
|
|
199
|
+
endDate: void 0
|
|
200
|
+
})
|
|
201
|
+
},
|
|
202
|
+
dateRangeModifiers: {},
|
|
203
|
+
compareDateRange: {
|
|
204
|
+
type: Object,
|
|
205
|
+
default: () => ({
|
|
206
|
+
startDate: void 0,
|
|
207
|
+
endDate: void 0
|
|
208
|
+
})
|
|
209
|
+
},
|
|
210
|
+
compareDateRangeModifiers: {}
|
|
211
|
+
}),
|
|
212
|
+
emits: /* @__PURE__ */ K(["update", "chip-closed"], ["update:compareType", "update:dateRange", "update:compareDateRange"]),
|
|
213
|
+
setup(e, { emit: n }) {
|
|
214
|
+
const { t: l, locale: f } = he(), D = Re();
|
|
215
|
+
function d(t) {
|
|
216
|
+
return t ? t.includes("T") ? u(t).tz(p.value).format(S) : u(t).format(S) : null;
|
|
217
|
+
}
|
|
218
|
+
const h = n, r = z(e, "compareType"), y = z(e, "dateRange"), s = z(e, "compareDateRange"), { timezone: p } = be(ge());
|
|
219
|
+
let m = null, T = 0, R = null;
|
|
220
|
+
const w = /* @__PURE__ */ new Set(), N = O(!1), B = O(!1), x = L(
|
|
221
|
+
() => N.value || B.value
|
|
222
|
+
), V = L(
|
|
223
|
+
() => e.minDate ? l("report.messages.noPermissionDateAccess", { date: e.minDate }) : ""
|
|
224
|
+
);
|
|
225
|
+
function j(t) {
|
|
226
|
+
return !!(e.minDate && u(t).isBefore(u(e.minDate, S), "day"));
|
|
227
|
+
}
|
|
228
|
+
function ae() {
|
|
229
|
+
const t = Date.now();
|
|
230
|
+
t - T < 1e3 || (T = t, D == null || D.open({
|
|
231
|
+
type: "error",
|
|
232
|
+
message: V.value
|
|
233
|
+
}));
|
|
234
|
+
}
|
|
235
|
+
function ne(t) {
|
|
236
|
+
return t instanceof HTMLElement && t.matches(ee) ? [t] : "querySelectorAll" in t ? Array.from(t.querySelectorAll(ee)) : [];
|
|
237
|
+
}
|
|
238
|
+
function re(t = document) {
|
|
239
|
+
e.minDate && ne(t).forEach((a) => {
|
|
240
|
+
const i = u(a.id), o = i.isValid() && j(i), v = a.querySelector(xe);
|
|
241
|
+
a.classList.toggle("report-date-access-disabled", o), v && (v.setAttribute("aria-disabled", String(o)), v.title = o ? V.value : "");
|
|
242
|
+
});
|
|
243
|
+
}
|
|
244
|
+
function q(t = [document]) {
|
|
245
|
+
!e.minDate || !x.value || (t.forEach((a) => w.add(a)), R === null && (R = window.requestAnimationFrame(() => {
|
|
246
|
+
R = null;
|
|
247
|
+
const a = Array.from(w);
|
|
248
|
+
w.clear(), a.length || a.push(document), a.forEach((i) => re(i));
|
|
249
|
+
})));
|
|
250
|
+
}
|
|
251
|
+
function W() {
|
|
252
|
+
m == null || m.disconnect(), m = null, R !== null && (window.cancelAnimationFrame(R), R = null), w.clear();
|
|
253
|
+
}
|
|
254
|
+
function oe() {
|
|
255
|
+
m || !e.minDate || !x.value || (m = new MutationObserver((t) => {
|
|
256
|
+
const a = /* @__PURE__ */ new Set();
|
|
257
|
+
t.forEach((i) => {
|
|
258
|
+
a.add(i.target), i.addedNodes.forEach((o) => {
|
|
259
|
+
o instanceof HTMLElement && a.add(o);
|
|
260
|
+
});
|
|
261
|
+
}), q(Array.from(a));
|
|
262
|
+
}), m.observe(document.body, { childList: !0, subtree: !0 }));
|
|
263
|
+
}
|
|
264
|
+
function F() {
|
|
265
|
+
if (!e.minDate || !x.value) {
|
|
266
|
+
W();
|
|
267
|
+
return;
|
|
268
|
+
}
|
|
269
|
+
oe(), q();
|
|
270
|
+
}
|
|
271
|
+
function H(t, a = !0) {
|
|
272
|
+
return t && (j(u(t, S)) ? (a && ae(), e.minDate) : t);
|
|
273
|
+
}
|
|
274
|
+
function G(t, a = {}) {
|
|
275
|
+
const i = a.notify ?? !0;
|
|
276
|
+
let o = H(t.startDate, i), v = H(t.endDate, i);
|
|
277
|
+
return o && v && u(o, S).isAfter(u(v, S), "day") && (o = e.minDate ?? v, v = o), { startDate: o, endDate: v };
|
|
278
|
+
}
|
|
279
|
+
function k(t, a) {
|
|
280
|
+
return t.startDate === a.startDate && t.endDate === a.endDate;
|
|
281
|
+
}
|
|
282
|
+
const c = O({
|
|
283
|
+
startDate: d(y.value.startDate),
|
|
284
|
+
endDate: d(y.value.endDate)
|
|
285
|
+
}), g = O({
|
|
286
|
+
startDate: s.value.startDate ? d(s.value.startDate) : null,
|
|
287
|
+
endDate: s.value.endDate ? d(s.value.endDate) : null
|
|
288
|
+
});
|
|
289
|
+
M(
|
|
290
|
+
[() => c.value],
|
|
291
|
+
() => {
|
|
292
|
+
const t = G(c.value);
|
|
293
|
+
if (!k(t, c.value)) {
|
|
294
|
+
c.value = t;
|
|
295
|
+
return;
|
|
296
|
+
}
|
|
297
|
+
c.value.endDate || (c.value.endDate = c.value.startDate);
|
|
298
|
+
const a = {
|
|
299
|
+
startDate: u.tz(c.value.startDate, p.value).startOf("day").utc().toISOString(),
|
|
300
|
+
endDate: u.tz(c.value.endDate, p.value).endOf("day").utc().toISOString()
|
|
301
|
+
};
|
|
302
|
+
y.value = a, h("update", a);
|
|
303
|
+
},
|
|
304
|
+
{ deep: !0 }
|
|
305
|
+
), M([() => g.value], () => {
|
|
306
|
+
const t = G(g.value, {
|
|
307
|
+
notify: r.value === P.CUSTOM
|
|
308
|
+
});
|
|
309
|
+
if (!k(t, g.value)) {
|
|
310
|
+
g.value = t;
|
|
311
|
+
return;
|
|
312
|
+
}
|
|
313
|
+
const a = g.value.startDate, i = g.value.endDate, o = a ? u(
|
|
314
|
+
a instanceof Date ? a : u(a).toDate()
|
|
315
|
+
).startOf("day").tz(p.value, !0).toISOString() : void 0, v = i ? u(i instanceof Date ? i : u(i).toDate()).tz(p.value, !0).endOf("day").toISOString() : void 0;
|
|
316
|
+
s.value = {
|
|
317
|
+
startDate: o,
|
|
318
|
+
endDate: v
|
|
319
|
+
};
|
|
320
|
+
}), M(
|
|
321
|
+
() => y.value,
|
|
322
|
+
() => {
|
|
323
|
+
const t = {
|
|
324
|
+
startDate: d(y.value.startDate),
|
|
325
|
+
endDate: d(y.value.endDate)
|
|
326
|
+
};
|
|
327
|
+
k(t, c.value) || (c.value = t);
|
|
328
|
+
},
|
|
329
|
+
{ deep: !0 }
|
|
330
|
+
), M(
|
|
331
|
+
() => s.value,
|
|
332
|
+
() => {
|
|
333
|
+
const t = {
|
|
334
|
+
startDate: d(s.value.startDate),
|
|
335
|
+
endDate: d(s.value.endDate)
|
|
336
|
+
};
|
|
337
|
+
k(t, g.value) || (g.value = t);
|
|
338
|
+
},
|
|
339
|
+
{ deep: !0 }
|
|
340
|
+
), M(
|
|
341
|
+
() => e.minDate,
|
|
342
|
+
async () => {
|
|
343
|
+
await J(), F();
|
|
344
|
+
}
|
|
345
|
+
), M(
|
|
346
|
+
() => x.value,
|
|
347
|
+
async () => {
|
|
348
|
+
await J(), F();
|
|
349
|
+
}
|
|
350
|
+
), De(() => {
|
|
351
|
+
F();
|
|
352
|
+
}), ye(() => {
|
|
353
|
+
W();
|
|
354
|
+
});
|
|
355
|
+
function le(t) {
|
|
356
|
+
r.value = t;
|
|
357
|
+
}
|
|
358
|
+
function se(t) {
|
|
359
|
+
N.value = t;
|
|
360
|
+
}
|
|
361
|
+
function ue(t) {
|
|
362
|
+
B.value = t;
|
|
363
|
+
}
|
|
364
|
+
function ie(t) {
|
|
365
|
+
h("chip-closed", t);
|
|
366
|
+
}
|
|
367
|
+
const de = L(() => {
|
|
368
|
+
const t = X(), a = t.startsWith("zh") ? "" : " ", i = l("report.common.comparedTo"), o = Z({
|
|
369
|
+
startDate: g.value.startDate ?? null,
|
|
370
|
+
endDate: g.value.endDate ?? null,
|
|
371
|
+
locale: t
|
|
372
|
+
});
|
|
373
|
+
return r.value === P.NO_COMPARISON ? `${i}: ${l(`report.compare.${r.value}`)}` : r.value === P.CUSTOM ? `${i}: ${o}` : `${i}${a}${l(`report.compare.${r.value}`).toLowerCase()}: ${o}`;
|
|
374
|
+
});
|
|
375
|
+
return (t, a) => {
|
|
376
|
+
const i = A("FmSimpleDateRangePicker");
|
|
377
|
+
return C(), pe("div", we, [
|
|
378
|
+
(C(), b(i, {
|
|
379
|
+
key: `date-picker-${Y(f)}`,
|
|
380
|
+
modelValue: c.value,
|
|
381
|
+
"onUpdate:modelValue": a[1] || (a[1] = (o) => c.value = o),
|
|
382
|
+
"show-predefined-range": "",
|
|
383
|
+
min: e.minDate,
|
|
384
|
+
"predefined-range": e.datePredefinedRanges.map((o) => ({
|
|
385
|
+
...o,
|
|
386
|
+
label: Y(l)(`report.date.${o.label}`)
|
|
387
|
+
})),
|
|
388
|
+
class: "w-2/6",
|
|
389
|
+
onPopoverChanged: se
|
|
390
|
+
}, {
|
|
391
|
+
"trigger-button": U(() => [
|
|
392
|
+
Q(_, {
|
|
393
|
+
"left-icon": e.label ? "filter_alt" : "calendar_month",
|
|
394
|
+
label: e.label ?? Y(Z)({
|
|
395
|
+
startDate: c.value.startDate ?? "",
|
|
396
|
+
endDate: c.value.endDate ?? "",
|
|
397
|
+
locale: Y(X)()
|
|
398
|
+
}),
|
|
399
|
+
removable: e.removable,
|
|
400
|
+
onChipClosed: a[0] || (a[0] = (o) => ie(!0))
|
|
401
|
+
}, null, 8, ["left-icon", "label", "removable"])
|
|
402
|
+
]),
|
|
403
|
+
_: 1
|
|
404
|
+
}, 8, ["modelValue", "min", "predefined-range"])),
|
|
405
|
+
e.compare ? (C(), b(i, {
|
|
406
|
+
key: `compare-date-picker-${Y(f)}`,
|
|
407
|
+
modelValue: g.value,
|
|
408
|
+
"onUpdate:modelValue": a[2] || (a[2] = (o) => g.value = o),
|
|
409
|
+
"compare-type": r.value,
|
|
410
|
+
"onUpdate:compareType": a[3] || (a[3] = (o) => r.value = o),
|
|
411
|
+
"show-predefined-range": "",
|
|
412
|
+
min: e.minDate,
|
|
413
|
+
"compare-target": c.value,
|
|
414
|
+
"default-compare-type": r.value,
|
|
415
|
+
onPopoverChanged: ue,
|
|
416
|
+
onSelectComparison: le
|
|
417
|
+
}, {
|
|
418
|
+
"trigger-button": U(() => [
|
|
419
|
+
Q(_, { label: de.value }, null, 8, ["label"])
|
|
420
|
+
]),
|
|
421
|
+
_: 1
|
|
422
|
+
}, 8, ["modelValue", "compare-type", "min", "compare-target", "default-compare-type"])) : E("", !0)
|
|
423
|
+
]);
|
|
424
|
+
};
|
|
425
|
+
}
|
|
426
|
+
}), Ne = /* @__PURE__ */ Ce(ke, [["__scopeId", "data-v-e0ce1b3c"]]);
|
|
427
|
+
export {
|
|
428
|
+
$ as C,
|
|
429
|
+
Ne as D,
|
|
430
|
+
_,
|
|
431
|
+
Me as a,
|
|
432
|
+
Le as b,
|
|
433
|
+
Ue as c,
|
|
434
|
+
ze as d,
|
|
435
|
+
Z as e,
|
|
436
|
+
Se as g
|
|
437
|
+
};
|