@object-ui/plugin-timeline 17.3.0 → 17.6.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/CHANGELOG.md +400 -0
- package/README.md +0 -11
- package/dist/ObjectTimeline.d.ts +35 -0
- package/dist/ObjectTimeline.d.ts.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +151 -135
- package/dist/index.umd.cjs +1 -1
- package/dist/renderer.d.ts +19 -1
- package/dist/renderer.d.ts.map +1 -1
- package/dist/useTimelineTranslation.d.ts +25 -0
- package/dist/useTimelineTranslation.d.ts.map +1 -1
- package/package.json +10 -10
package/dist/index.js
CHANGED
|
@@ -2,13 +2,30 @@ import * as e from "react";
|
|
|
2
2
|
import { useCallback as t, useEffect as n, useMemo as r, useState as i } from "react";
|
|
3
3
|
import { NavigationOverlay as a, cn as o, cva as s, renderChildren as c } from "@object-ui/components";
|
|
4
4
|
import { jsx as l, jsxs as u } from "react/jsx-runtime";
|
|
5
|
-
import { ComponentRegistry as d, buildExpandFields as f,
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
5
|
+
import { ComponentRegistry as d, buildExpandFields as f, convertSortToQueryParams as p, extractRecords as m } from "@object-ui/core";
|
|
6
|
+
import { createSafeTranslation as h, useDisplayLocale as g } from "@object-ui/i18n";
|
|
7
|
+
import { ElementDataSourceGate as ee, useDataScope as te, useNavigationOverlay as ne, useSafeFieldLabel as re, useSchemaContext as _ } from "@object-ui/react";
|
|
8
|
+
import { usePullToRefresh as ie } from "@object-ui/mobile";
|
|
8
9
|
import { z as v } from "zod";
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
//#region src/useTimelineTranslation.ts
|
|
11
|
+
var y = {
|
|
12
|
+
"timeline.bucket.overdue": "Overdue",
|
|
13
|
+
"timeline.bucket.today": "Today",
|
|
14
|
+
"timeline.bucket.tomorrow": "Tomorrow",
|
|
15
|
+
"timeline.bucket.thisWeek": "This week",
|
|
16
|
+
"timeline.bucket.nextWeek": "Next week",
|
|
17
|
+
"timeline.bucket.later": "Later",
|
|
18
|
+
"timeline.bucket.noDate": "No date",
|
|
19
|
+
"timeline.bucket.unassigned": "Unassigned",
|
|
20
|
+
"timeline.relative.today": "Today",
|
|
21
|
+
"timeline.relative.tomorrow": "Tomorrow",
|
|
22
|
+
"timeline.relative.yesterday": "Yesterday",
|
|
23
|
+
"timeline.relative.inDays": "In {{n}} days",
|
|
24
|
+
"timeline.relative.daysAgo": "{{n}} days ago",
|
|
25
|
+
"timeline.scale.week": "Week {{n}}",
|
|
26
|
+
"timeline.scale.quarter": "Q{{quarter}} {{year}}",
|
|
27
|
+
"timeline.gantt.rowLabel": "Items"
|
|
28
|
+
}, b = "timeline.bucket.today", x = (e, t) => Object.entries(t ?? {}).reduce((e, [t, n]) => e.split(`{{${t}}}`).join(String(n)), y[e] || e), S = h(y, b), C = /* @__PURE__ */ new Set([
|
|
12
29
|
"hour",
|
|
13
30
|
"day",
|
|
14
31
|
"week",
|
|
@@ -16,69 +33,72 @@ var b = /* @__PURE__ */ new Set([
|
|
|
16
33
|
"quarter",
|
|
17
34
|
"year"
|
|
18
35
|
]);
|
|
19
|
-
function
|
|
36
|
+
function w(e) {
|
|
20
37
|
let t = e.scale ?? e.timeScale;
|
|
21
|
-
return typeof t == "string" &&
|
|
38
|
+
return typeof t == "string" && C.has(t) ? t : "month";
|
|
22
39
|
}
|
|
23
|
-
function
|
|
24
|
-
let
|
|
25
|
-
if (Number.isNaN(
|
|
26
|
-
let
|
|
40
|
+
function T(e, t, n, r = "en", i = x) {
|
|
41
|
+
let a = [], o = new Date(t), s = new Date(n);
|
|
42
|
+
if (Number.isNaN(o.getTime()) || Number.isNaN(s.getTime()) || o > s) return a;
|
|
43
|
+
let c = new Date(o);
|
|
27
44
|
switch (e) {
|
|
28
45
|
case "hour":
|
|
29
|
-
for (;
|
|
46
|
+
for (; c <= s;) a.push(c.toLocaleString(r, {
|
|
30
47
|
month: "short",
|
|
31
48
|
day: "numeric",
|
|
32
49
|
hour: "numeric"
|
|
33
|
-
})),
|
|
50
|
+
})), c.setHours(c.getHours() + 1);
|
|
34
51
|
break;
|
|
35
52
|
case "day":
|
|
36
|
-
for (;
|
|
53
|
+
for (; c <= s;) a.push(c.toLocaleDateString(r, {
|
|
37
54
|
month: "short",
|
|
38
55
|
day: "numeric"
|
|
39
|
-
})),
|
|
56
|
+
})), c.setDate(c.getDate() + 1);
|
|
40
57
|
break;
|
|
41
58
|
case "week": {
|
|
42
59
|
let e = 1;
|
|
43
|
-
for (;
|
|
60
|
+
for (; c <= s;) a.push(i("timeline.scale.week", { n: e++ })), c.setDate(c.getDate() + 7);
|
|
44
61
|
break;
|
|
45
62
|
}
|
|
46
63
|
case "quarter":
|
|
47
|
-
for (
|
|
64
|
+
for (c.setMonth(Math.floor(c.getMonth() / 3) * 3, 1); c <= s;) a.push(i("timeline.scale.quarter", {
|
|
65
|
+
quarter: Math.floor(c.getMonth() / 3) + 1,
|
|
66
|
+
year: c.getFullYear()
|
|
67
|
+
})), c.setMonth(c.getMonth() + 3);
|
|
48
68
|
break;
|
|
49
69
|
case "year":
|
|
50
|
-
for (
|
|
70
|
+
for (c.setMonth(0, 1); c <= s;) a.push(String(c.getFullYear())), c.setFullYear(c.getFullYear() + 1);
|
|
51
71
|
break;
|
|
52
|
-
default: for (;
|
|
72
|
+
default: for (; c <= s;) a.push(c.toLocaleDateString(r, {
|
|
53
73
|
month: "short",
|
|
54
74
|
year: "numeric"
|
|
55
|
-
})),
|
|
75
|
+
})), c.setMonth(c.getMonth() + 1);
|
|
56
76
|
}
|
|
57
|
-
return
|
|
77
|
+
return a;
|
|
58
78
|
}
|
|
59
|
-
function
|
|
79
|
+
function E(e) {
|
|
60
80
|
let t = e.flatMap((e) => (e.items || []).flatMap((e) => [e.startDate, e.endDate])), n = Math.min(...t.map((e) => new Date(e).getTime())), r = Math.max(...t.map((e) => new Date(e).getTime()));
|
|
61
81
|
return {
|
|
62
82
|
minDate: new Date(n).toISOString().split("T")[0],
|
|
63
83
|
maxDate: new Date(r).toISOString().split("T")[0]
|
|
64
84
|
};
|
|
65
85
|
}
|
|
66
|
-
function
|
|
86
|
+
function D(e, t, n, r) {
|
|
67
87
|
let i = new Date(e).getTime(), a = new Date(t).getTime(), o = new Date(n).getTime(), s = new Date(r).getTime() - o, c = i - o, l = a - i;
|
|
68
88
|
return {
|
|
69
89
|
start: c / s * 100,
|
|
70
90
|
width: l / s * 100
|
|
71
91
|
};
|
|
72
92
|
}
|
|
73
|
-
function
|
|
74
|
-
let
|
|
75
|
-
return t === "short" ?
|
|
93
|
+
function O(e, t, n) {
|
|
94
|
+
let r = new Date(e);
|
|
95
|
+
return t === "short" ? r.toLocaleDateString(n) : t === "long" ? r.toLocaleDateString(n, {
|
|
76
96
|
year: "numeric",
|
|
77
97
|
month: "long",
|
|
78
98
|
day: "numeric"
|
|
79
|
-
}) :
|
|
99
|
+
}) : r.toISOString().split("T")[0];
|
|
80
100
|
}
|
|
81
|
-
function
|
|
101
|
+
function k({ label: e, color: t }) {
|
|
82
102
|
let n = t ? {
|
|
83
103
|
backgroundColor: `${t}22`,
|
|
84
104
|
color: t,
|
|
@@ -90,7 +110,7 @@ function E({ label: e, color: t }) {
|
|
|
90
110
|
children: e
|
|
91
111
|
});
|
|
92
112
|
}
|
|
93
|
-
function
|
|
113
|
+
function A(e) {
|
|
94
114
|
let t = [];
|
|
95
115
|
for (let n of e) {
|
|
96
116
|
let e = n.group == null ? "" : String(n.group), r = t[t.length - 1];
|
|
@@ -101,14 +121,14 @@ function D(e) {
|
|
|
101
121
|
}
|
|
102
122
|
return t;
|
|
103
123
|
}
|
|
104
|
-
var
|
|
105
|
-
let { variant: r = "vertical", items: i = [], dateFormat: a = "short", onItemClick: s } = e;
|
|
124
|
+
var j = ({ schema: e, className: t, ...n }) => {
|
|
125
|
+
let { variant: r = "vertical", items: i = [], dateFormat: a = "short", onItemClick: s } = e, d = g(), { t: f } = S();
|
|
106
126
|
if (r === "vertical") {
|
|
107
|
-
let e =
|
|
127
|
+
let e = A(i), r = e.some((e) => e.key !== ""), f = (e, t) => {
|
|
108
128
|
let n = e.color ? {
|
|
109
129
|
backgroundColor: `${e.color}33`,
|
|
110
130
|
borderColor: e.color
|
|
111
|
-
} : void 0, r = e.time ?
|
|
131
|
+
} : void 0, r = e.time ? O(e.time, a, d) : e.startDate ? O(e.startDate, a, d) : "", i = e.endDate && e.endDate !== e.startDate ? O(e.endDate, a, d) : "", f = Array.isArray(e.meta) ? e.meta : [];
|
|
112
132
|
return /* @__PURE__ */ u(I, {
|
|
113
133
|
density: "compact",
|
|
114
134
|
className: o(e.className, s && "cursor-pointer"),
|
|
@@ -133,9 +153,9 @@ var O = ({ schema: e, className: t, ...n }) => {
|
|
|
133
153
|
className: "text-sm sm:text-base mb-1",
|
|
134
154
|
children: e.title
|
|
135
155
|
}),
|
|
136
|
-
|
|
156
|
+
f.length > 0 && /* @__PURE__ */ l("div", {
|
|
137
157
|
className: "flex flex-wrap gap-1.5 mt-1 mb-1",
|
|
138
|
-
children:
|
|
158
|
+
children: f.map((e) => /* @__PURE__ */ l(k, {
|
|
139
159
|
label: e.label,
|
|
140
160
|
color: e.color
|
|
141
161
|
}, e.key))
|
|
@@ -161,13 +181,13 @@ var O = ({ schema: e, className: t, ...n }) => {
|
|
|
161
181
|
})]
|
|
162
182
|
}), /* @__PURE__ */ l(P, {
|
|
163
183
|
className: "mt-3",
|
|
164
|
-
children: e.items.map((e, n) =>
|
|
184
|
+
children: e.items.map((e, n) => f(e, `${t}-${n}`))
|
|
165
185
|
})]
|
|
166
186
|
}, `${e.key}-${t}`))
|
|
167
187
|
}) : /* @__PURE__ */ l(P, {
|
|
168
188
|
className: t,
|
|
169
189
|
...n,
|
|
170
|
-
children: i.map((e, t) =>
|
|
190
|
+
children: i.map((e, t) => f(e, t))
|
|
171
191
|
});
|
|
172
192
|
}
|
|
173
193
|
if (r === "horizontal") return /* @__PURE__ */ l(U, {
|
|
@@ -189,7 +209,7 @@ var O = ({ schema: e, className: t, ...n }) => {
|
|
|
189
209
|
children: [
|
|
190
210
|
e.time && /* @__PURE__ */ l(V, {
|
|
191
211
|
dateTime: e.time,
|
|
192
|
-
children:
|
|
212
|
+
children: O(e.time, a, d)
|
|
193
213
|
}),
|
|
194
214
|
e.title && /* @__PURE__ */ l(B, { children: e.title }),
|
|
195
215
|
e.description && /* @__PURE__ */ l(H, {
|
|
@@ -203,7 +223,7 @@ var O = ({ schema: e, className: t, ...n }) => {
|
|
|
203
223
|
}, t))
|
|
204
224
|
});
|
|
205
225
|
if (r === "gantt") {
|
|
206
|
-
let r =
|
|
226
|
+
let r = E(i), c = e.minDate || r.minDate, p = e.maxDate || r.maxDate, m = T(w(e), c, p, d, f);
|
|
207
227
|
return /* @__PURE__ */ u(G, {
|
|
208
228
|
className: o("overflow-x-auto [-webkit-overflow-scrolling:touch]", t),
|
|
209
229
|
...n,
|
|
@@ -211,11 +231,11 @@ var O = ({ schema: e, className: t, ...n }) => {
|
|
|
211
231
|
className: "flex items-center px-2 sm:px-4 py-2 sm:py-3",
|
|
212
232
|
children: /* @__PURE__ */ l("span", {
|
|
213
233
|
className: "font-semibold text-xs sm:text-sm",
|
|
214
|
-
children: e.rowLabel || "
|
|
234
|
+
children: e.rowLabel || f("timeline.gantt.rowLabel")
|
|
215
235
|
})
|
|
216
236
|
}), /* @__PURE__ */ l(J, { children: /* @__PURE__ */ l("div", {
|
|
217
237
|
className: "flex h-full",
|
|
218
|
-
children:
|
|
238
|
+
children: m.map((e, t) => /* @__PURE__ */ l("div", {
|
|
219
239
|
className: "flex-1 px-1 sm:px-2 py-2 sm:py-3 border-r text-xs font-medium text-center",
|
|
220
240
|
children: e
|
|
221
241
|
}, t))
|
|
@@ -230,13 +250,13 @@ var O = ({ schema: e, className: t, ...n }) => {
|
|
|
230
250
|
children: i.map((e, t) => /* @__PURE__ */ l(Y, {
|
|
231
251
|
className: "relative",
|
|
232
252
|
children: (e.items || []).map((n, r) => {
|
|
233
|
-
let i =
|
|
253
|
+
let i = D(n.startDate, n.endDate, c, p);
|
|
234
254
|
return /* @__PURE__ */ l(Z, {
|
|
235
255
|
start: i.start,
|
|
236
256
|
width: i.width,
|
|
237
257
|
variant: n.variant || "default",
|
|
238
258
|
onClick: () => s?.(n, e, t, r),
|
|
239
|
-
title: `${n.title || ""}\n${
|
|
259
|
+
title: `${n.title || ""}\n${O(n.startDate, a, d)} - ${O(n.endDate, a, d)}`,
|
|
240
260
|
children: /* @__PURE__ */ l(Q, { children: n.title })
|
|
241
261
|
}, r);
|
|
242
262
|
})
|
|
@@ -247,7 +267,7 @@ var O = ({ schema: e, className: t, ...n }) => {
|
|
|
247
267
|
}
|
|
248
268
|
return null;
|
|
249
269
|
};
|
|
250
|
-
d.register("timeline",
|
|
270
|
+
d.register("timeline", j, {
|
|
251
271
|
namespace: "plugin-timeline",
|
|
252
272
|
label: "Timeline",
|
|
253
273
|
category: "data-display",
|
|
@@ -442,34 +462,12 @@ d.register("timeline", O, {
|
|
|
442
462
|
}
|
|
443
463
|
}
|
|
444
464
|
});
|
|
445
|
-
var k = y({
|
|
446
|
-
"timeline.bucket.overdue": "Overdue",
|
|
447
|
-
"timeline.bucket.today": "Today",
|
|
448
|
-
"timeline.bucket.tomorrow": "Tomorrow",
|
|
449
|
-
"timeline.bucket.thisWeek": "This week",
|
|
450
|
-
"timeline.bucket.nextWeek": "Next week",
|
|
451
|
-
"timeline.bucket.later": "Later",
|
|
452
|
-
"timeline.bucket.noDate": "No date",
|
|
453
|
-
"timeline.bucket.unassigned": "Unassigned",
|
|
454
|
-
"timeline.relative.today": "Today",
|
|
455
|
-
"timeline.relative.tomorrow": "Tomorrow",
|
|
456
|
-
"timeline.relative.yesterday": "Yesterday",
|
|
457
|
-
"timeline.relative.inDays": "In {{n}} days",
|
|
458
|
-
"timeline.relative.daysAgo": "{{n}} days ago"
|
|
459
|
-
}, "timeline.bucket.today"), A = {
|
|
460
|
-
fieldOptionLabel: (e, t, n, r) => r,
|
|
461
|
-
translateOptions: (e, t, n) => n,
|
|
462
|
-
fieldLabel: (e, t, n) => n
|
|
463
|
-
};
|
|
464
|
-
function j() {
|
|
465
|
-
return g() ?? A;
|
|
466
|
-
}
|
|
467
465
|
var M = v.object({
|
|
468
466
|
title: v.string().optional(),
|
|
469
467
|
date: v.string().optional(),
|
|
470
468
|
description: v.string().optional(),
|
|
471
469
|
variant: v.string().optional()
|
|
472
|
-
}),
|
|
470
|
+
}), ae = v.object({
|
|
473
471
|
mapping: M.optional(),
|
|
474
472
|
objectName: v.string().optional(),
|
|
475
473
|
titleField: v.string().optional(),
|
|
@@ -487,65 +485,72 @@ var M = v.object({
|
|
|
487
485
|
"quarter",
|
|
488
486
|
"year"
|
|
489
487
|
]).optional()
|
|
490
|
-
}), N = ({ schema: e, dataSource: o, className: s, onRowClick: c, onItemClick: d, ...
|
|
491
|
-
let [
|
|
492
|
-
let t = Array.isArray(e.items) && e.items.length > 0, n = Array.isArray(
|
|
488
|
+
}), N = ({ schema: e, dataSource: o, className: s, onRowClick: c, onItemClick: d, ...h }) => {
|
|
489
|
+
let [g, ee] = i([]), [_, v] = i(() => {
|
|
490
|
+
let t = Array.isArray(e.items) && e.items.length > 0, n = Array.isArray(h.data) && h.data.length > 0;
|
|
493
491
|
return !t && !n && !!e.objectName;
|
|
494
|
-
}), [
|
|
492
|
+
}), [y, b] = i(null), [x, C] = i(0), [w, T] = i(null), E = e.timeline;
|
|
495
493
|
n(() => {
|
|
496
|
-
let t =
|
|
494
|
+
let t = ae.safeParse(e);
|
|
497
495
|
t.success || console.warn("[ObjectTimeline] Invalid timeline configuration:", t.error.format());
|
|
498
496
|
}, [e]);
|
|
499
|
-
let
|
|
497
|
+
let D = te(e.bind);
|
|
500
498
|
n(() => {
|
|
501
499
|
let t = !0;
|
|
502
500
|
return (async () => {
|
|
503
501
|
if (!(!o || typeof o.getObjectSchema != "function" || !e.objectName)) try {
|
|
504
502
|
let n = await o.getObjectSchema(e.objectName);
|
|
505
|
-
t &&
|
|
503
|
+
t && T(n);
|
|
506
504
|
} catch (e) {
|
|
507
505
|
console.warn("Failed to fetch object def for ObjectTimeline", e);
|
|
508
506
|
}
|
|
509
507
|
})(), () => {
|
|
510
508
|
t = !1;
|
|
511
509
|
};
|
|
512
|
-
}, [e.objectName, o])
|
|
513
|
-
|
|
510
|
+
}, [e.objectName, o]);
|
|
511
|
+
let O = JSON.stringify(e.filter ?? null), k = JSON.stringify(e.sort ?? null);
|
|
512
|
+
n(() => {
|
|
513
|
+
e.objectName && !D && !e.items && !h.data ? (async () => {
|
|
514
514
|
if (!o || typeof o.find != "function" || !e.objectName) {
|
|
515
|
-
|
|
515
|
+
v(!1);
|
|
516
516
|
return;
|
|
517
517
|
}
|
|
518
|
-
|
|
518
|
+
v(!0);
|
|
519
519
|
try {
|
|
520
|
-
let t = f(
|
|
521
|
-
|
|
520
|
+
let t = f(w?.fields), n = await o.find(e.objectName, {
|
|
521
|
+
$filter: e.filter,
|
|
522
|
+
$orderby: p(e.sort),
|
|
523
|
+
$top: e.limit ?? 100,
|
|
522
524
|
...t.length > 0 ? { $expand: t } : {}
|
|
523
|
-
}), r =
|
|
524
|
-
|
|
525
|
+
}), r = m(n);
|
|
526
|
+
ee(r);
|
|
525
527
|
} catch (e) {
|
|
526
|
-
console.error(e),
|
|
528
|
+
console.error(e), b(e);
|
|
527
529
|
} finally {
|
|
528
|
-
|
|
530
|
+
v(!1);
|
|
529
531
|
}
|
|
530
|
-
})() :
|
|
532
|
+
})() : v(!1);
|
|
531
533
|
}, [
|
|
532
534
|
e.objectName,
|
|
533
535
|
o,
|
|
534
|
-
|
|
536
|
+
D,
|
|
535
537
|
e.items,
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
538
|
+
h.data,
|
|
539
|
+
x,
|
|
540
|
+
w,
|
|
541
|
+
O,
|
|
542
|
+
k,
|
|
543
|
+
e.limit
|
|
539
544
|
]);
|
|
540
|
-
let
|
|
545
|
+
let A = h.data || D || g, { t: M } = S(), { fieldOptionLabel: N } = re(), P = E?.titleField ?? e.mapping?.title ?? e.titleField ?? "name", F = E?.startDateField ?? E?.dateField ?? e.mapping?.date ?? e.startDateField ?? e.dateField ?? "date", I = E?.endDateField ?? e.endDateField ?? F, L = e.mapping?.description ?? e.descriptionField ?? "description", R = e.mapping?.variant ?? "variant", z = E?.groupByField ?? e.groupByField, B = E?.colorField ?? e.colorField, V = r(() => {
|
|
541
546
|
if (e.items) return e.items;
|
|
542
|
-
if (!
|
|
543
|
-
let t =
|
|
547
|
+
if (!A || !Array.isArray(A)) return [];
|
|
548
|
+
let t = w?.fields ?? {}, n = e.objectName || "", r = (e) => {
|
|
544
549
|
if (!e || !t[e]?.options) return {};
|
|
545
550
|
let n = {};
|
|
546
551
|
for (let r of t[e].options) r && r.value != null && (n[String(r.value)] = r);
|
|
547
552
|
return n;
|
|
548
|
-
}, i = r(
|
|
553
|
+
}, i = r(B), a = Array.isArray(E?.metaFields) ? E.metaFields.filter((e) => typeof e == "string" && e) : ["status", "priority"].filter((e) => t[e]), o = {};
|
|
549
554
|
for (let e of a) o[e] = r(e);
|
|
550
555
|
let s = (e) => {
|
|
551
556
|
if (e == null || e === "") return;
|
|
@@ -557,11 +562,11 @@ var M = v.object({
|
|
|
557
562
|
if (t == null || t === "") return null;
|
|
558
563
|
let i = r[String(t)];
|
|
559
564
|
return {
|
|
560
|
-
label: i?.label ?
|
|
565
|
+
label: i?.label ? N(n, e, String(t), i.label) : String(t),
|
|
561
566
|
color: i?.color
|
|
562
567
|
};
|
|
563
|
-
}, l =
|
|
564
|
-
let t = e[
|
|
568
|
+
}, l = A.map((e) => {
|
|
569
|
+
let t = e[F], r = e[I], i = B ? e[B] : void 0, l = z ? e[z] : void 0, u = [];
|
|
565
570
|
if (n) for (let t of a) {
|
|
566
571
|
let n = c(t, e[t], o[t] || {});
|
|
567
572
|
n && u.push({
|
|
@@ -571,12 +576,12 @@ var M = v.object({
|
|
|
571
576
|
});
|
|
572
577
|
}
|
|
573
578
|
return {
|
|
574
|
-
title: e[
|
|
579
|
+
title: e[P],
|
|
575
580
|
time: t,
|
|
576
581
|
startDate: t,
|
|
577
582
|
endDate: r,
|
|
578
|
-
description: e[
|
|
579
|
-
variant: e[
|
|
583
|
+
description: e[L],
|
|
584
|
+
variant: e[R] || "default",
|
|
580
585
|
color: s(i),
|
|
581
586
|
group: l,
|
|
582
587
|
meta: u,
|
|
@@ -585,17 +590,17 @@ var M = v.object({
|
|
|
585
590
|
});
|
|
586
591
|
l.sort((e, t) => (e.startDate ? new Date(e.startDate).getTime() : Infinity) - (t.startDate ? new Date(t.startDate).getTime() : Infinity));
|
|
587
592
|
let u = /* @__PURE__ */ new Date(), d = (e) => new Date(e.getFullYear(), e.getMonth(), e.getDate()).getTime(), f = d(u), p = 864e5, m = f - (u.getDay() + 6) % 7 * p + 7 * p, h = m + 7 * p, g = (e) => {
|
|
588
|
-
if (!e) return
|
|
593
|
+
if (!e) return M("timeline.bucket.noDate");
|
|
589
594
|
let t = d(new Date(e));
|
|
590
|
-
return Number.isNaN(t) ?
|
|
595
|
+
return Number.isNaN(t) ? M("timeline.bucket.noDate") : t < f ? M("timeline.bucket.overdue") : t === f ? M("timeline.bucket.today") : t === f + p ? M("timeline.bucket.tomorrow") : M(t < m ? "timeline.bucket.thisWeek" : t < h ? "timeline.bucket.nextWeek" : "timeline.bucket.later");
|
|
591
596
|
};
|
|
592
|
-
if (
|
|
593
|
-
let e = r(
|
|
597
|
+
if (z && !l.every((e) => e.group == null || e.group === "")) {
|
|
598
|
+
let e = r(z);
|
|
594
599
|
return l.map((t) => {
|
|
595
|
-
let n = c(
|
|
600
|
+
let n = c(z, t.group, e);
|
|
596
601
|
return {
|
|
597
602
|
...t,
|
|
598
|
-
group: n ? n.label : t.group != null && t.group !== "" ? String(t.group) :
|
|
603
|
+
group: n ? n.label : t.group != null && t.group !== "" ? String(t.group) : M("timeline.bucket.unassigned")
|
|
599
604
|
};
|
|
600
605
|
});
|
|
601
606
|
}
|
|
@@ -605,43 +610,43 @@ var M = v.object({
|
|
|
605
610
|
}));
|
|
606
611
|
}, [
|
|
607
612
|
e.items,
|
|
608
|
-
|
|
609
|
-
|
|
613
|
+
A,
|
|
614
|
+
w,
|
|
610
615
|
e.objectName,
|
|
616
|
+
P,
|
|
611
617
|
F,
|
|
612
618
|
I,
|
|
613
619
|
L,
|
|
614
620
|
R,
|
|
615
|
-
z,
|
|
616
|
-
V,
|
|
617
621
|
B,
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
622
|
+
z,
|
|
623
|
+
M,
|
|
624
|
+
N
|
|
625
|
+
]), H = t(async () => {
|
|
626
|
+
C((e) => e + 1);
|
|
627
|
+
}, []), { ref: U, isRefreshing: W, pullDistance: G } = ie({
|
|
628
|
+
onRefresh: H,
|
|
624
629
|
enabled: !!e.objectName && !!o
|
|
625
|
-
}),
|
|
630
|
+
}), K = ne({
|
|
626
631
|
navigation: e.navigation,
|
|
627
632
|
objectName: e.objectName,
|
|
628
633
|
onRowClick: c ?? d
|
|
629
|
-
}),
|
|
634
|
+
}), q = E?.scale ?? e.scale, J = {
|
|
630
635
|
...e,
|
|
631
|
-
items:
|
|
636
|
+
items: V || [],
|
|
632
637
|
className: s || e.className,
|
|
633
|
-
...
|
|
638
|
+
...q ? { timeScale: q } : {},
|
|
634
639
|
onItemClick: (e) => {
|
|
635
640
|
let t = e._data || e;
|
|
636
|
-
|
|
641
|
+
K.handleClick(t), d?.(t);
|
|
637
642
|
}
|
|
638
643
|
};
|
|
639
|
-
return
|
|
644
|
+
return y ? /* @__PURE__ */ u("div", {
|
|
640
645
|
className: "p-4 text-destructive",
|
|
641
646
|
"data-testid": "timeline-error",
|
|
642
647
|
role: "alert",
|
|
643
|
-
children: ["Error loading timeline: ",
|
|
644
|
-
}) :
|
|
648
|
+
children: ["Error loading timeline: ", y.message]
|
|
649
|
+
}) : _ && (!V || V.length === 0) ? /* @__PURE__ */ u("div", {
|
|
645
650
|
className: "flex flex-col h-full min-h-[200px] p-4 gap-3",
|
|
646
651
|
"data-testid": "timeline-loading",
|
|
647
652
|
role: "status",
|
|
@@ -664,17 +669,17 @@ var M = v.object({
|
|
|
664
669
|
})]
|
|
665
670
|
}, e))]
|
|
666
671
|
}) : /* @__PURE__ */ u("div", {
|
|
667
|
-
ref:
|
|
672
|
+
ref: U,
|
|
668
673
|
className: "relative overflow-auto h-full min-w-0",
|
|
669
674
|
children: [
|
|
670
|
-
|
|
675
|
+
G > 0 && /* @__PURE__ */ l("div", {
|
|
671
676
|
className: "flex items-center justify-center text-xs text-muted-foreground",
|
|
672
|
-
style: { height:
|
|
673
|
-
children:
|
|
677
|
+
style: { height: G },
|
|
678
|
+
children: W ? "Refreshing…" : "Pull to refresh"
|
|
674
679
|
}),
|
|
675
|
-
/* @__PURE__ */ l(
|
|
676
|
-
|
|
677
|
-
...
|
|
680
|
+
/* @__PURE__ */ l(j, { schema: J }),
|
|
681
|
+
K.isOverlay && /* @__PURE__ */ l(a, {
|
|
682
|
+
...K,
|
|
678
683
|
title: "Timeline Item",
|
|
679
684
|
children: (e) => /* @__PURE__ */ l("div", {
|
|
680
685
|
className: "space-y-3",
|
|
@@ -823,12 +828,23 @@ var Q = e.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ l("div", {
|
|
|
823
828
|
...t
|
|
824
829
|
}));
|
|
825
830
|
Q.displayName = "TimelineGanttBarContent";
|
|
826
|
-
var
|
|
831
|
+
var oe = {
|
|
832
|
+
filter: !0,
|
|
833
|
+
sort: !0,
|
|
834
|
+
limit: "limit"
|
|
835
|
+
}, $ = ({ schema: e, ...t }) => {
|
|
827
836
|
let { dataSource: n } = _() || {};
|
|
828
|
-
return /* @__PURE__ */ l(
|
|
837
|
+
return /* @__PURE__ */ l(ee, {
|
|
829
838
|
schema: e,
|
|
839
|
+
mapping: oe,
|
|
830
840
|
dataSource: n,
|
|
831
|
-
|
|
841
|
+
testId: "object-timeline",
|
|
842
|
+
errorTitle: "This timeline’s data source could not be resolved",
|
|
843
|
+
children: (e) => /* @__PURE__ */ l(N, {
|
|
844
|
+
schema: e,
|
|
845
|
+
dataSource: n,
|
|
846
|
+
...t
|
|
847
|
+
})
|
|
832
848
|
});
|
|
833
849
|
};
|
|
834
850
|
d.register("object-timeline", $, {
|
|
@@ -871,4 +887,4 @@ d.register("object-timeline", $, {
|
|
|
871
887
|
}]
|
|
872
888
|
});
|
|
873
889
|
//#endregion
|
|
874
|
-
export { N as ObjectTimeline, $ as ObjectTimelineRenderer,
|
|
890
|
+
export { N as ObjectTimeline, $ as ObjectTimelineRenderer, C as TIMELINE_SCALES, P as Timeline, z as TimelineContent, H as TimelineDescription, G as TimelineGantt, Z as TimelineGanttBar, Q as TimelineGanttBarContent, J as TimelineGanttGrid, K as TimelineGanttHeader, X as TimelineGanttLabel, Y as TimelineGanttRow, q as TimelineGanttRowLabels, U as TimelineHorizontal, W as TimelineHorizontalItem, I as TimelineItem, R as TimelineMarker, j as TimelineRenderer, V as TimelineTime, B as TimelineTitle, T as generateTimeScaleHeaders, w as resolveTimelineScale, F as timelineItemVariants, L as timelineMarkerVariants };
|