@object-ui/plugin-timeline 4.0.7 → 4.0.8
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 +10 -0
- package/dist/index.js +372 -202
- package/dist/index.umd.cjs +1 -1
- package/dist/packages/plugin-timeline/src/ObjectTimeline.d.ts.map +1 -1
- package/dist/packages/plugin-timeline/src/renderer.d.ts.map +1 -1
- package/dist/packages/plugin-timeline/src/useTimelineTranslation.d.ts +22 -0
- package/dist/packages/plugin-timeline/src/useTimelineTranslation.d.ts.map +1 -0
- package/package.json +9 -9
package/CHANGELOG.md
CHANGED
package/dist/index.js
CHANGED
|
@@ -1,28 +1,28 @@
|
|
|
1
1
|
import * as e from "react";
|
|
2
|
-
import { useCallback as t, useEffect as n,
|
|
3
|
-
import { NavigationOverlay as
|
|
4
|
-
import { jsx as
|
|
5
|
-
import { ComponentRegistry as
|
|
6
|
-
import { useDataScope as
|
|
7
|
-
import { usePullToRefresh as
|
|
8
|
-
import { z as
|
|
2
|
+
import { useCallback as t, useEffect as n, useMemo as r, useState as i } from "react";
|
|
3
|
+
import { NavigationOverlay as a, cn as o, cva as s, renderChildren as c } from "@object-ui/components";
|
|
4
|
+
import { jsx as l, jsxs as u } from "react/jsx-runtime";
|
|
5
|
+
import { ComponentRegistry as d, buildExpandFields as f, extractRecords as p } from "@object-ui/core";
|
|
6
|
+
import { useDataScope as m, useNavigationOverlay as h, useObjectLabel as g, useObjectTranslation as _, useSchemaContext as v } from "@object-ui/react";
|
|
7
|
+
import { usePullToRefresh as ee } from "@object-ui/mobile";
|
|
8
|
+
import { z as y } from "zod";
|
|
9
9
|
//#region src/renderer.tsx
|
|
10
|
-
var
|
|
11
|
-
function
|
|
10
|
+
var b = 10080 * 60 * 1e3;
|
|
11
|
+
function x(e) {
|
|
12
12
|
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()));
|
|
13
13
|
return {
|
|
14
14
|
minDate: new Date(n).toISOString().split("T")[0],
|
|
15
15
|
maxDate: new Date(r).toISOString().split("T")[0]
|
|
16
16
|
};
|
|
17
17
|
}
|
|
18
|
-
function
|
|
18
|
+
function S(e, t, n, r) {
|
|
19
19
|
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;
|
|
20
20
|
return {
|
|
21
21
|
start: c / s * 100,
|
|
22
22
|
width: l / s * 100
|
|
23
23
|
};
|
|
24
24
|
}
|
|
25
|
-
function
|
|
25
|
+
function C(e, t) {
|
|
26
26
|
let n = new Date(e);
|
|
27
27
|
return t === "short" ? n.toLocaleDateString() : t === "long" ? n.toLocaleDateString("en-US", {
|
|
28
28
|
year: "numeric",
|
|
@@ -30,69 +30,133 @@ function x(e, t) {
|
|
|
30
30
|
day: "numeric"
|
|
31
31
|
}) : n.toISOString().split("T")[0];
|
|
32
32
|
}
|
|
33
|
-
|
|
34
|
-
let
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
children: e.icon && /* @__PURE__ */ c("span", {
|
|
44
|
-
className: "text-xs",
|
|
45
|
-
children: e.icon
|
|
46
|
-
})
|
|
47
|
-
}), /* @__PURE__ */ l(j, { children: [
|
|
48
|
-
e.time && /* @__PURE__ */ c(N, {
|
|
49
|
-
dateTime: e.time,
|
|
50
|
-
children: x(e.time, o)
|
|
51
|
-
}),
|
|
52
|
-
e.title && /* @__PURE__ */ c(M, { children: e.title }),
|
|
53
|
-
e.description && /* @__PURE__ */ c(P, {
|
|
54
|
-
className: "line-clamp-2 sm:line-clamp-none",
|
|
55
|
-
children: e.description
|
|
56
|
-
}),
|
|
57
|
-
e.content && s(e.content)
|
|
58
|
-
] })]
|
|
59
|
-
}, t))
|
|
33
|
+
function w({ label: e, color: t }) {
|
|
34
|
+
let n = t ? {
|
|
35
|
+
backgroundColor: `${t}22`,
|
|
36
|
+
color: t,
|
|
37
|
+
borderColor: `${t}55`
|
|
38
|
+
} : void 0;
|
|
39
|
+
return /* @__PURE__ */ l("span", {
|
|
40
|
+
className: o("inline-flex items-center rounded-full border px-2 py-0.5 text-xs font-medium", !t && "bg-muted text-muted-foreground border-transparent"),
|
|
41
|
+
style: n,
|
|
42
|
+
children: e
|
|
60
43
|
});
|
|
61
|
-
|
|
62
|
-
|
|
44
|
+
}
|
|
45
|
+
function T(e) {
|
|
46
|
+
let t = [];
|
|
47
|
+
for (let n of e) {
|
|
48
|
+
let e = n.group == null ? "" : String(n.group), r = t[t.length - 1];
|
|
49
|
+
r && r.key === e ? r.items.push(n) : t.push({
|
|
50
|
+
key: e,
|
|
51
|
+
items: [n]
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
return t;
|
|
55
|
+
}
|
|
56
|
+
var E = ({ schema: e, className: t, ...n }) => {
|
|
57
|
+
let { variant: r = "vertical", items: i = [], dateFormat: a = "short", onItemClick: s } = e;
|
|
58
|
+
if (r === "vertical") {
|
|
59
|
+
let e = T(i), r = e.some((e) => e.key !== ""), d = (e, t) => {
|
|
60
|
+
let n = e.color ? {
|
|
61
|
+
backgroundColor: `${e.color}33`,
|
|
62
|
+
borderColor: e.color
|
|
63
|
+
} : void 0, r = e.time ? C(e.time, a) : e.startDate ? C(e.startDate, a) : "", i = e.endDate && e.endDate !== e.startDate ? C(e.endDate, a) : "", d = Array.isArray(e.meta) ? e.meta : [];
|
|
64
|
+
return /* @__PURE__ */ u(I, {
|
|
65
|
+
density: "compact",
|
|
66
|
+
className: o(e.className, s && "cursor-pointer"),
|
|
67
|
+
onClick: () => s?.(e),
|
|
68
|
+
children: [/* @__PURE__ */ l(R, {
|
|
69
|
+
variant: e.color ? "default" : e.variant || "default",
|
|
70
|
+
style: n,
|
|
71
|
+
children: e.icon && /* @__PURE__ */ l("span", {
|
|
72
|
+
className: "text-xs",
|
|
73
|
+
children: e.icon
|
|
74
|
+
})
|
|
75
|
+
}), /* @__PURE__ */ u(z, { children: [
|
|
76
|
+
(r || i) && /* @__PURE__ */ u(V, {
|
|
77
|
+
dateTime: e.time || e.startDate,
|
|
78
|
+
className: "!mb-1 text-xs",
|
|
79
|
+
children: [r, i && /* @__PURE__ */ u("span", {
|
|
80
|
+
className: "text-muted-foreground/70",
|
|
81
|
+
children: [" → ", i]
|
|
82
|
+
})]
|
|
83
|
+
}),
|
|
84
|
+
e.title && /* @__PURE__ */ l(B, {
|
|
85
|
+
className: "text-sm sm:text-base mb-1",
|
|
86
|
+
children: e.title
|
|
87
|
+
}),
|
|
88
|
+
d.length > 0 && /* @__PURE__ */ l("div", {
|
|
89
|
+
className: "flex flex-wrap gap-1.5 mt-1 mb-1",
|
|
90
|
+
children: d.map((e) => /* @__PURE__ */ l(w, {
|
|
91
|
+
label: e.label,
|
|
92
|
+
color: e.color
|
|
93
|
+
}, e.key))
|
|
94
|
+
}),
|
|
95
|
+
e.description && /* @__PURE__ */ l(H, {
|
|
96
|
+
className: "text-sm text-muted-foreground line-clamp-2 sm:line-clamp-none",
|
|
97
|
+
children: e.description
|
|
98
|
+
}),
|
|
99
|
+
e.content && c(e.content)
|
|
100
|
+
] })]
|
|
101
|
+
}, t);
|
|
102
|
+
};
|
|
103
|
+
return r ? /* @__PURE__ */ l("div", {
|
|
104
|
+
className: o("px-4 sm:px-6 py-2", t),
|
|
105
|
+
...n,
|
|
106
|
+
children: e.map((e, t) => /* @__PURE__ */ u("section", {
|
|
107
|
+
className: "mb-4",
|
|
108
|
+
children: [/* @__PURE__ */ u("header", {
|
|
109
|
+
className: "sticky top-0 z-10 -mx-4 sm:-mx-6 px-4 sm:px-6 py-1.5 backdrop-blur bg-background/90 text-xs font-semibold uppercase tracking-wide text-muted-foreground border-b",
|
|
110
|
+
children: [/* @__PURE__ */ l("span", { children: e.key }), /* @__PURE__ */ l("span", {
|
|
111
|
+
className: "ml-2 text-muted-foreground/60 font-normal normal-case",
|
|
112
|
+
children: e.items.length
|
|
113
|
+
})]
|
|
114
|
+
}), /* @__PURE__ */ l(P, {
|
|
115
|
+
className: "mt-3",
|
|
116
|
+
children: e.items.map((e, n) => d(e, `${t}-${n}`))
|
|
117
|
+
})]
|
|
118
|
+
}, `${e.key}-${t}`))
|
|
119
|
+
}) : /* @__PURE__ */ l(P, {
|
|
120
|
+
className: t,
|
|
121
|
+
...n,
|
|
122
|
+
children: i.map((e, t) => d(e, t))
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
if (r === "horizontal") return /* @__PURE__ */ l(U, {
|
|
126
|
+
className: o("overflow-x-auto [-webkit-overflow-scrolling:touch]", t),
|
|
63
127
|
...n,
|
|
64
|
-
children: i.map((e, t) => /* @__PURE__ */
|
|
65
|
-
className:
|
|
66
|
-
onClick: () =>
|
|
67
|
-
children: [/* @__PURE__ */
|
|
128
|
+
children: i.map((e, t) => /* @__PURE__ */ u(W, {
|
|
129
|
+
className: o(e.className, s && "cursor-pointer"),
|
|
130
|
+
onClick: () => s?.(e),
|
|
131
|
+
children: [/* @__PURE__ */ u("div", {
|
|
68
132
|
className: "flex flex-col items-center",
|
|
69
|
-
children: [/* @__PURE__ */
|
|
133
|
+
children: [/* @__PURE__ */ l(R, {
|
|
70
134
|
variant: e.variant || "default",
|
|
71
|
-
children: e.icon && /* @__PURE__ */
|
|
135
|
+
children: e.icon && /* @__PURE__ */ l("span", {
|
|
72
136
|
className: "text-xs",
|
|
73
137
|
children: e.icon
|
|
74
138
|
})
|
|
75
|
-
}), /* @__PURE__ */
|
|
139
|
+
}), /* @__PURE__ */ u("div", {
|
|
76
140
|
className: "mt-4 text-center",
|
|
77
141
|
children: [
|
|
78
|
-
e.time && /* @__PURE__ */
|
|
142
|
+
e.time && /* @__PURE__ */ l(V, {
|
|
79
143
|
dateTime: e.time,
|
|
80
|
-
children:
|
|
144
|
+
children: C(e.time, a)
|
|
81
145
|
}),
|
|
82
|
-
e.title && /* @__PURE__ */
|
|
83
|
-
e.description && /* @__PURE__ */
|
|
146
|
+
e.title && /* @__PURE__ */ l(B, { children: e.title }),
|
|
147
|
+
e.description && /* @__PURE__ */ l(H, {
|
|
84
148
|
className: "text-center line-clamp-2 sm:line-clamp-none",
|
|
85
149
|
children: e.description
|
|
86
150
|
}),
|
|
87
|
-
e.content &&
|
|
151
|
+
e.content && c(e.content)
|
|
88
152
|
]
|
|
89
153
|
})]
|
|
90
|
-
}), t < i.length - 1 && /* @__PURE__ */
|
|
154
|
+
}), t < i.length - 1 && /* @__PURE__ */ l("div", { className: "absolute left-full w-16 border-t-2 border-gray-200 top-3" })]
|
|
91
155
|
}, t))
|
|
92
156
|
});
|
|
93
157
|
if (r === "gantt") {
|
|
94
|
-
let r =
|
|
95
|
-
let e = [], t = new Date(
|
|
158
|
+
let r = x(i), c = e.minDate || r.minDate, d = e.maxDate || r.maxDate, f = e.timeScale || "month", p = (() => {
|
|
159
|
+
let e = [], t = new Date(c), n = new Date(d);
|
|
96
160
|
if (f === "month") {
|
|
97
161
|
let r = new Date(t);
|
|
98
162
|
for (; r <= n;) e.push(r.toLocaleDateString("en-US", {
|
|
@@ -101,7 +165,7 @@ var S = ({ schema: e, className: t, ...n }) => {
|
|
|
101
165
|
})), r.setMonth(r.getMonth() + 1);
|
|
102
166
|
} else if (f === "week") {
|
|
103
167
|
let r = new Date(t);
|
|
104
|
-
for (; r <= n;) e.push(`Week ${Math.ceil((r.getTime() - t.getTime()) /
|
|
168
|
+
for (; r <= n;) e.push(`Week ${Math.ceil((r.getTime() - t.getTime()) / b) + 1}`), r.setDate(r.getDate() + 7);
|
|
105
169
|
} else if (f === "day") {
|
|
106
170
|
let r = new Date(t);
|
|
107
171
|
for (; r <= n;) e.push(r.toLocaleDateString("en-US", {
|
|
@@ -111,40 +175,40 @@ var S = ({ schema: e, className: t, ...n }) => {
|
|
|
111
175
|
}
|
|
112
176
|
return e;
|
|
113
177
|
})();
|
|
114
|
-
return /* @__PURE__ */
|
|
115
|
-
className:
|
|
178
|
+
return /* @__PURE__ */ u(G, {
|
|
179
|
+
className: o("overflow-x-auto [-webkit-overflow-scrolling:touch]", t),
|
|
116
180
|
...n,
|
|
117
|
-
children: [/* @__PURE__ */
|
|
181
|
+
children: [/* @__PURE__ */ u(K, { children: [/* @__PURE__ */ l(q, {
|
|
118
182
|
className: "flex items-center px-2 sm:px-4 py-2 sm:py-3",
|
|
119
|
-
children: /* @__PURE__ */
|
|
183
|
+
children: /* @__PURE__ */ l("span", {
|
|
120
184
|
className: "font-semibold text-xs sm:text-sm",
|
|
121
185
|
children: e.rowLabel || "Items"
|
|
122
186
|
})
|
|
123
|
-
}), /* @__PURE__ */
|
|
187
|
+
}), /* @__PURE__ */ l(J, { children: /* @__PURE__ */ l("div", {
|
|
124
188
|
className: "flex h-full",
|
|
125
|
-
children: p.map((e, t) => /* @__PURE__ */
|
|
189
|
+
children: p.map((e, t) => /* @__PURE__ */ l("div", {
|
|
126
190
|
className: "flex-1 px-1 sm:px-2 py-2 sm:py-3 border-r text-xs font-medium text-center",
|
|
127
191
|
children: e
|
|
128
192
|
}, t))
|
|
129
|
-
}) })] }), /* @__PURE__ */
|
|
193
|
+
}) })] }), /* @__PURE__ */ l("div", { children: /* @__PURE__ */ u("div", {
|
|
130
194
|
className: "flex",
|
|
131
|
-
children: [/* @__PURE__ */
|
|
195
|
+
children: [/* @__PURE__ */ l(q, { children: i.map((e, t) => /* @__PURE__ */ l(Y, { children: /* @__PURE__ */ l(X, {
|
|
132
196
|
title: e.label,
|
|
133
197
|
className: "truncate",
|
|
134
198
|
children: e.label
|
|
135
|
-
}) }, t)) }), /* @__PURE__ */
|
|
199
|
+
}) }, t)) }), /* @__PURE__ */ l(J, {
|
|
136
200
|
className: "relative",
|
|
137
|
-
children: i.map((e, t) => /* @__PURE__ */
|
|
201
|
+
children: i.map((e, t) => /* @__PURE__ */ l(Y, {
|
|
138
202
|
className: "relative",
|
|
139
203
|
children: (e.items || []).map((n, r) => {
|
|
140
|
-
let i =
|
|
141
|
-
return /* @__PURE__ */
|
|
204
|
+
let i = S(n.startDate, n.endDate, c, d);
|
|
205
|
+
return /* @__PURE__ */ l(Z, {
|
|
142
206
|
start: i.start,
|
|
143
207
|
width: i.width,
|
|
144
208
|
variant: n.variant || "default",
|
|
145
|
-
onClick: () =>
|
|
146
|
-
title: `${n.title || ""}\n${
|
|
147
|
-
children: /* @__PURE__ */
|
|
209
|
+
onClick: () => s?.(n, e, t, r),
|
|
210
|
+
title: `${n.title || ""}\n${C(n.startDate, a)} - ${C(n.endDate, a)}`,
|
|
211
|
+
children: /* @__PURE__ */ l(Q, { children: n.title })
|
|
148
212
|
}, r);
|
|
149
213
|
})
|
|
150
214
|
}, t))
|
|
@@ -154,7 +218,7 @@ var S = ({ schema: e, className: t, ...n }) => {
|
|
|
154
218
|
}
|
|
155
219
|
return null;
|
|
156
220
|
};
|
|
157
|
-
|
|
221
|
+
d.register("timeline", E, {
|
|
158
222
|
namespace: "plugin-timeline",
|
|
159
223
|
label: "Timeline",
|
|
160
224
|
category: "data-display",
|
|
@@ -350,23 +414,64 @@ u.register("timeline", S, {
|
|
|
350
414
|
}
|
|
351
415
|
});
|
|
352
416
|
//#endregion
|
|
417
|
+
//#region src/useTimelineTranslation.ts
|
|
418
|
+
var D = {
|
|
419
|
+
"timeline.bucket.overdue": "Overdue",
|
|
420
|
+
"timeline.bucket.today": "Today",
|
|
421
|
+
"timeline.bucket.tomorrow": "Tomorrow",
|
|
422
|
+
"timeline.bucket.thisWeek": "This week",
|
|
423
|
+
"timeline.bucket.nextWeek": "Next week",
|
|
424
|
+
"timeline.bucket.later": "Later",
|
|
425
|
+
"timeline.bucket.noDate": "No date",
|
|
426
|
+
"timeline.bucket.unassigned": "Unassigned",
|
|
427
|
+
"timeline.relative.today": "Today",
|
|
428
|
+
"timeline.relative.tomorrow": "Tomorrow",
|
|
429
|
+
"timeline.relative.yesterday": "Yesterday",
|
|
430
|
+
"timeline.relative.inDays": "In {{n}} days",
|
|
431
|
+
"timeline.relative.daysAgo": "{{n}} days ago"
|
|
432
|
+
}, O = "timeline.bucket.today";
|
|
433
|
+
function k(e, t) {
|
|
434
|
+
let n = D[e] || e;
|
|
435
|
+
if (t) for (let [e, r] of Object.entries(t)) n = n.replace(`{{${e}}}`, String(r));
|
|
436
|
+
return n;
|
|
437
|
+
}
|
|
438
|
+
function A() {
|
|
439
|
+
try {
|
|
440
|
+
let e = _();
|
|
441
|
+
return e.t(O) === O ? { t: k } : { t: e.t };
|
|
442
|
+
} catch {
|
|
443
|
+
return { t: k };
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
//#endregion
|
|
353
447
|
//#region src/ObjectTimeline.tsx
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
448
|
+
function j() {
|
|
449
|
+
try {
|
|
450
|
+
return g();
|
|
451
|
+
} catch {
|
|
452
|
+
return {
|
|
453
|
+
fieldOptionLabel: (e, t, n, r) => r,
|
|
454
|
+
translateOptions: (e, t, n) => n,
|
|
455
|
+
fieldLabel: (e, t, n) => n
|
|
456
|
+
};
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
var M = y.object({
|
|
460
|
+
title: y.string().optional(),
|
|
461
|
+
date: y.string().optional(),
|
|
462
|
+
description: y.string().optional(),
|
|
463
|
+
variant: y.string().optional()
|
|
464
|
+
}), te = y.object({
|
|
465
|
+
mapping: M.optional(),
|
|
466
|
+
objectName: y.string().optional(),
|
|
467
|
+
titleField: y.string().optional(),
|
|
468
|
+
dateField: y.string().optional(),
|
|
469
|
+
startDateField: y.string().optional(),
|
|
470
|
+
endDateField: y.string().optional(),
|
|
471
|
+
descriptionField: y.string().optional(),
|
|
472
|
+
groupByField: y.string().optional(),
|
|
473
|
+
colorField: y.string().optional(),
|
|
474
|
+
scale: y.enum([
|
|
370
475
|
"hour",
|
|
371
476
|
"day",
|
|
372
477
|
"week",
|
|
@@ -374,37 +479,37 @@ var C = _.object({
|
|
|
374
479
|
"quarter",
|
|
375
480
|
"year"
|
|
376
481
|
]).optional()
|
|
377
|
-
}),
|
|
378
|
-
let [_, v] =
|
|
482
|
+
}), N = ({ schema: e, dataSource: o, className: s, onRowClick: c, onItemClick: d, ...g }) => {
|
|
483
|
+
let [_, v] = i([]), [y, b] = i(!1), [x, S] = i(null), [C, w] = i(0), [T, D] = i(null), O = e.timeline;
|
|
379
484
|
n(() => {
|
|
380
|
-
let t =
|
|
485
|
+
let t = te.safeParse(e);
|
|
381
486
|
t.success || console.warn("[ObjectTimeline] Invalid timeline configuration:", t.error.format());
|
|
382
487
|
}, [e]);
|
|
383
|
-
let
|
|
488
|
+
let k = m(e.bind);
|
|
384
489
|
n(() => {
|
|
385
490
|
let t = !0;
|
|
386
491
|
return (async () => {
|
|
387
|
-
if (!(!
|
|
388
|
-
let n = await
|
|
389
|
-
t &&
|
|
492
|
+
if (!(!o || typeof o.getObjectSchema != "function" || !e.objectName)) try {
|
|
493
|
+
let n = await o.getObjectSchema(e.objectName);
|
|
494
|
+
t && D(n);
|
|
390
495
|
} catch (e) {
|
|
391
496
|
console.warn("Failed to fetch object def for ObjectTimeline", e);
|
|
392
497
|
}
|
|
393
498
|
})(), () => {
|
|
394
499
|
t = !1;
|
|
395
500
|
};
|
|
396
|
-
}, [e.objectName,
|
|
397
|
-
e.objectName && !
|
|
398
|
-
if (!(!
|
|
501
|
+
}, [e.objectName, o]), n(() => {
|
|
502
|
+
e.objectName && !k && !e.items && !g.data && (async () => {
|
|
503
|
+
if (!(!o || typeof o.find != "function" || !e.objectName)) {
|
|
399
504
|
b(!0);
|
|
400
505
|
try {
|
|
401
|
-
let t =
|
|
402
|
-
v(
|
|
506
|
+
let t = f(T?.fields);
|
|
507
|
+
v(p(await o.find(e.objectName, {
|
|
403
508
|
options: { $top: 100 },
|
|
404
509
|
...t.length > 0 ? { $expand: t } : {}
|
|
405
510
|
})));
|
|
406
511
|
} catch (e) {
|
|
407
|
-
console.error(e),
|
|
512
|
+
console.error(e), S(e);
|
|
408
513
|
} finally {
|
|
409
514
|
b(!1);
|
|
410
515
|
}
|
|
@@ -412,71 +517,136 @@ var C = _.object({
|
|
|
412
517
|
})();
|
|
413
518
|
}, [
|
|
414
519
|
e.objectName,
|
|
415
|
-
|
|
416
|
-
|
|
520
|
+
o,
|
|
521
|
+
k,
|
|
417
522
|
e.items,
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
523
|
+
g.data,
|
|
524
|
+
C,
|
|
525
|
+
T
|
|
421
526
|
]);
|
|
422
|
-
let
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
527
|
+
let M = g.data || k || _, { t: N } = A(), { fieldOptionLabel: P } = j(), F = O?.titleField ?? e.mapping?.title ?? e.titleField ?? "name", I = O?.startDateField ?? e.mapping?.date ?? e.startDateField ?? e.dateField ?? "date", L = O?.endDateField ?? e.endDateField ?? I, R = e.mapping?.description ?? e.descriptionField ?? "description", z = e.mapping?.variant ?? "variant", B = O?.groupByField ?? e.groupByField, V = O?.colorField ?? e.colorField, H = r(() => {
|
|
528
|
+
if (e.items) return e.items;
|
|
529
|
+
if (!M || !Array.isArray(M)) return [];
|
|
530
|
+
let t = T?.fields ?? {}, n = e.objectName || "", r = (e) => {
|
|
531
|
+
if (!e || !t[e]?.options) return {};
|
|
532
|
+
let n = {};
|
|
533
|
+
for (let r of t[e].options) r && r.value != null && (n[String(r.value)] = r);
|
|
534
|
+
return n;
|
|
535
|
+
}, i = r(V), a = Array.isArray(O?.metaFields) ? O.metaFields.filter((e) => typeof e == "string" && e) : ["status", "priority"].filter((e) => t[e]), o = {};
|
|
536
|
+
for (let e of a) o[e] = r(e);
|
|
537
|
+
let s = (e) => {
|
|
538
|
+
if (e == null || e === "") return;
|
|
539
|
+
let t = i[String(e)];
|
|
540
|
+
if (t?.color) return String(t.color);
|
|
541
|
+
let n = String(e);
|
|
542
|
+
if (/^#([0-9a-f]{3}){1,2}$/i.test(n) || n.startsWith("rgb") || n.startsWith("hsl")) return n;
|
|
543
|
+
}, c = (e, t, r) => {
|
|
544
|
+
if (t == null || t === "") return null;
|
|
545
|
+
let i = r[String(t)];
|
|
546
|
+
return {
|
|
547
|
+
label: i?.label ? P(n, e, String(t), i.label) : String(t),
|
|
548
|
+
color: i?.color
|
|
549
|
+
};
|
|
550
|
+
}, l = M.map((e) => {
|
|
551
|
+
let t = e[I], r = e[L], i = V ? e[V] : void 0, l = B ? e[B] : void 0, u = [];
|
|
552
|
+
if (n) for (let t of a) {
|
|
553
|
+
let n = c(t, e[t], o[t] || {});
|
|
554
|
+
n && u.push({
|
|
555
|
+
key: t,
|
|
556
|
+
label: n.label,
|
|
557
|
+
color: n.color
|
|
558
|
+
});
|
|
559
|
+
}
|
|
560
|
+
return {
|
|
561
|
+
title: e[F],
|
|
562
|
+
time: t,
|
|
563
|
+
startDate: t,
|
|
564
|
+
endDate: r,
|
|
565
|
+
description: e[R],
|
|
566
|
+
variant: e[z] || "default",
|
|
567
|
+
color: s(i),
|
|
568
|
+
group: l,
|
|
569
|
+
meta: u,
|
|
570
|
+
_data: e
|
|
571
|
+
};
|
|
572
|
+
});
|
|
573
|
+
l.sort((e, t) => (e.startDate ? new Date(e.startDate).getTime() : Infinity) - (t.startDate ? new Date(t.startDate).getTime() : Infinity));
|
|
574
|
+
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) => {
|
|
575
|
+
if (!e) return N("timeline.bucket.noDate");
|
|
576
|
+
let t = d(new Date(e));
|
|
577
|
+
return Number.isNaN(t) ? N("timeline.bucket.noDate") : t < f ? N("timeline.bucket.overdue") : t === f ? N("timeline.bucket.today") : t === f + p ? N("timeline.bucket.tomorrow") : N(t < m ? "timeline.bucket.thisWeek" : t < h ? "timeline.bucket.nextWeek" : "timeline.bucket.later");
|
|
578
|
+
};
|
|
579
|
+
if (B && !l.every((e) => e.group == null || e.group === "")) {
|
|
580
|
+
let e = r(B);
|
|
581
|
+
return l.map((t) => {
|
|
582
|
+
let n = c(B, t.group, e);
|
|
583
|
+
return {
|
|
584
|
+
...t,
|
|
585
|
+
group: n ? n.label : t.group != null && t.group !== "" ? String(t.group) : N("timeline.bucket.unassigned")
|
|
586
|
+
};
|
|
587
|
+
});
|
|
588
|
+
}
|
|
589
|
+
return l.map((e) => ({
|
|
590
|
+
...e,
|
|
591
|
+
group: g(e.startDate)
|
|
435
592
|
}));
|
|
436
|
-
}
|
|
437
|
-
|
|
593
|
+
}, [
|
|
594
|
+
e.items,
|
|
595
|
+
M,
|
|
596
|
+
T,
|
|
597
|
+
e.objectName,
|
|
598
|
+
F,
|
|
599
|
+
I,
|
|
600
|
+
L,
|
|
601
|
+
R,
|
|
602
|
+
z,
|
|
603
|
+
V,
|
|
604
|
+
B,
|
|
605
|
+
N,
|
|
606
|
+
P
|
|
607
|
+
]), { ref: U, isRefreshing: W, pullDistance: G } = ee({
|
|
438
608
|
onRefresh: t(async () => {
|
|
439
|
-
|
|
609
|
+
w((e) => e + 1);
|
|
440
610
|
}, []),
|
|
441
|
-
enabled: !!e.objectName && !!
|
|
442
|
-
}),
|
|
611
|
+
enabled: !!e.objectName && !!o
|
|
612
|
+
}), K = h({
|
|
443
613
|
navigation: e.navigation,
|
|
444
614
|
objectName: e.objectName,
|
|
445
|
-
onRowClick:
|
|
446
|
-
}),
|
|
615
|
+
onRowClick: c ?? d
|
|
616
|
+
}), q = O?.scale ?? e.scale, J = {
|
|
447
617
|
...e,
|
|
448
|
-
items:
|
|
449
|
-
className:
|
|
450
|
-
...
|
|
618
|
+
items: H || [],
|
|
619
|
+
className: s || e.className,
|
|
620
|
+
...q ? { timeScale: q } : {},
|
|
451
621
|
onItemClick: (e) => {
|
|
452
622
|
let t = e._data || e;
|
|
453
|
-
|
|
623
|
+
K.handleClick(t), d?.(t);
|
|
454
624
|
}
|
|
455
625
|
};
|
|
456
|
-
return x ? /* @__PURE__ */
|
|
626
|
+
return x ? /* @__PURE__ */ u("div", {
|
|
457
627
|
className: "p-4 text-red-500",
|
|
458
628
|
children: ["Error loading timeline: ", x.message]
|
|
459
|
-
}) : /* @__PURE__ */
|
|
460
|
-
ref:
|
|
629
|
+
}) : /* @__PURE__ */ u("div", {
|
|
630
|
+
ref: U,
|
|
461
631
|
className: "relative overflow-auto h-full min-w-0",
|
|
462
632
|
children: [
|
|
463
|
-
|
|
633
|
+
G > 0 && /* @__PURE__ */ l("div", {
|
|
464
634
|
className: "flex items-center justify-center text-xs text-muted-foreground",
|
|
465
|
-
style: { height:
|
|
466
|
-
children:
|
|
635
|
+
style: { height: G },
|
|
636
|
+
children: W ? "Refreshing…" : "Pull to refresh"
|
|
467
637
|
}),
|
|
468
|
-
/* @__PURE__ */
|
|
469
|
-
|
|
470
|
-
...
|
|
638
|
+
/* @__PURE__ */ l(E, { schema: J }),
|
|
639
|
+
K.isOverlay && /* @__PURE__ */ l(a, {
|
|
640
|
+
...K,
|
|
471
641
|
title: "Timeline Item",
|
|
472
|
-
children: (e) => /* @__PURE__ */
|
|
642
|
+
children: (e) => /* @__PURE__ */ l("div", {
|
|
473
643
|
className: "space-y-3",
|
|
474
|
-
children: Object.entries(e).map(([e, t]) => /* @__PURE__ */
|
|
644
|
+
children: Object.entries(e).map(([e, t]) => /* @__PURE__ */ u("div", {
|
|
475
645
|
className: "flex flex-col",
|
|
476
|
-
children: [/* @__PURE__ */
|
|
646
|
+
children: [/* @__PURE__ */ l("span", {
|
|
477
647
|
className: "text-xs font-medium text-muted-foreground uppercase tracking-wide",
|
|
478
648
|
children: e.replace(/_/g, " ")
|
|
479
|
-
}), /* @__PURE__ */
|
|
649
|
+
}), /* @__PURE__ */ l("span", {
|
|
480
650
|
className: "text-sm",
|
|
481
651
|
children: String(t ?? "—")
|
|
482
652
|
})]
|
|
@@ -485,26 +655,26 @@ var C = _.object({
|
|
|
485
655
|
})
|
|
486
656
|
]
|
|
487
657
|
});
|
|
488
|
-
},
|
|
658
|
+
}, P = e.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ l("ol", {
|
|
489
659
|
ref: n,
|
|
490
|
-
className:
|
|
660
|
+
className: o("relative ml-3 border-l border-gray-200", e),
|
|
491
661
|
...t
|
|
492
662
|
}));
|
|
493
|
-
|
|
494
|
-
var
|
|
663
|
+
P.displayName = "Timeline";
|
|
664
|
+
var F = s("ml-6", {
|
|
495
665
|
variants: { density: {
|
|
496
666
|
default: "mb-10",
|
|
497
667
|
compact: "mb-3",
|
|
498
668
|
comfortable: "mb-6"
|
|
499
669
|
} },
|
|
500
670
|
defaultVariants: { density: "default" }
|
|
501
|
-
}),
|
|
671
|
+
}), I = e.forwardRef(({ className: e, density: t, ...n }, r) => /* @__PURE__ */ l("li", {
|
|
502
672
|
ref: r,
|
|
503
|
-
className:
|
|
673
|
+
className: o(F({ density: t }), e),
|
|
504
674
|
...n
|
|
505
675
|
}));
|
|
506
|
-
|
|
507
|
-
var
|
|
676
|
+
I.displayName = "TimelineItem";
|
|
677
|
+
var L = s("absolute -left-3 w-6 h-6 rounded-full border-2 flex items-center justify-center", {
|
|
508
678
|
variants: { variant: {
|
|
509
679
|
default: "bg-blue-200 border-blue-400",
|
|
510
680
|
success: "bg-emerald-200 border-emerald-500",
|
|
@@ -516,87 +686,87 @@ var k = o("absolute -left-3 w-6 h-6 rounded-full border-2 flex items-center just
|
|
|
516
686
|
done: "bg-emerald-200 border-emerald-500"
|
|
517
687
|
} },
|
|
518
688
|
defaultVariants: { variant: "default" }
|
|
519
|
-
}),
|
|
689
|
+
}), R = e.forwardRef(({ className: e, variant: t = "default", ...n }, r) => /* @__PURE__ */ l("div", {
|
|
520
690
|
ref: r,
|
|
521
|
-
className:
|
|
691
|
+
className: o(L({ variant: t }), e),
|
|
522
692
|
...n
|
|
523
693
|
}));
|
|
524
|
-
|
|
525
|
-
var
|
|
694
|
+
R.displayName = "TimelineMarker";
|
|
695
|
+
var z = e.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ l("div", {
|
|
526
696
|
ref: n,
|
|
527
697
|
className: e,
|
|
528
698
|
...t
|
|
529
699
|
}));
|
|
530
|
-
|
|
531
|
-
var
|
|
700
|
+
z.displayName = "TimelineContent";
|
|
701
|
+
var B = e.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ l("h3", {
|
|
532
702
|
ref: n,
|
|
533
|
-
className:
|
|
703
|
+
className: o("font-semibold text-lg mb-1", e),
|
|
534
704
|
...t
|
|
535
705
|
}));
|
|
536
|
-
|
|
537
|
-
var
|
|
706
|
+
B.displayName = "TimelineTitle";
|
|
707
|
+
var V = e.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ l("time", {
|
|
538
708
|
ref: n,
|
|
539
|
-
className:
|
|
709
|
+
className: o("text-sm font-normal text-gray-500 mb-2 block", e),
|
|
540
710
|
...t
|
|
541
711
|
}));
|
|
542
|
-
|
|
543
|
-
var
|
|
712
|
+
V.displayName = "TimelineTime";
|
|
713
|
+
var H = e.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ l("p", {
|
|
544
714
|
ref: n,
|
|
545
|
-
className:
|
|
715
|
+
className: o("text-base text-gray-700", e),
|
|
546
716
|
...t
|
|
547
717
|
}));
|
|
548
|
-
|
|
549
|
-
var
|
|
718
|
+
H.displayName = "TimelineDescription";
|
|
719
|
+
var U = e.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ l("div", {
|
|
550
720
|
ref: n,
|
|
551
|
-
className:
|
|
721
|
+
className: o("relative flex overflow-x-auto py-8", e),
|
|
552
722
|
...t
|
|
553
723
|
}));
|
|
554
|
-
|
|
555
|
-
var
|
|
724
|
+
U.displayName = "TimelineHorizontal";
|
|
725
|
+
var W = e.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ l("div", {
|
|
556
726
|
ref: n,
|
|
557
|
-
className:
|
|
727
|
+
className: o("shrink-0 w-64 relative", e),
|
|
558
728
|
...t
|
|
559
729
|
}));
|
|
560
|
-
|
|
561
|
-
var
|
|
730
|
+
W.displayName = "TimelineHorizontalItem";
|
|
731
|
+
var G = e.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ l("div", {
|
|
562
732
|
ref: n,
|
|
563
|
-
className:
|
|
733
|
+
className: o("relative w-full border rounded-lg overflow-hidden", e),
|
|
564
734
|
...t
|
|
565
735
|
}));
|
|
566
|
-
|
|
567
|
-
var
|
|
736
|
+
G.displayName = "TimelineGantt";
|
|
737
|
+
var K = e.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ l("div", {
|
|
568
738
|
ref: n,
|
|
569
|
-
className:
|
|
739
|
+
className: o("flex border-b bg-gray-50", e),
|
|
570
740
|
...t
|
|
571
741
|
}));
|
|
572
|
-
|
|
573
|
-
var
|
|
742
|
+
K.displayName = "TimelineGanttHeader";
|
|
743
|
+
var q = e.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ l("div", {
|
|
574
744
|
ref: n,
|
|
575
|
-
className:
|
|
745
|
+
className: o("w-48 border-r bg-white", e),
|
|
576
746
|
...t
|
|
577
747
|
}));
|
|
578
|
-
|
|
579
|
-
var
|
|
748
|
+
q.displayName = "TimelineGanttRowLabels";
|
|
749
|
+
var J = e.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ l("div", {
|
|
580
750
|
ref: n,
|
|
581
|
-
className:
|
|
751
|
+
className: o("flex-1 overflow-x-auto", e),
|
|
582
752
|
...t
|
|
583
753
|
}));
|
|
584
|
-
|
|
585
|
-
var
|
|
754
|
+
J.displayName = "TimelineGanttGrid";
|
|
755
|
+
var Y = e.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ l("div", {
|
|
586
756
|
ref: n,
|
|
587
|
-
className:
|
|
757
|
+
className: o("flex items-center border-b min-h-12", e),
|
|
588
758
|
...t
|
|
589
759
|
}));
|
|
590
|
-
|
|
591
|
-
var
|
|
760
|
+
Y.displayName = "TimelineGanttRow";
|
|
761
|
+
var X = e.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ l("div", {
|
|
592
762
|
ref: n,
|
|
593
|
-
className:
|
|
763
|
+
className: o("px-4 py-2 font-medium text-sm truncate", e),
|
|
594
764
|
...t
|
|
595
765
|
}));
|
|
596
|
-
|
|
597
|
-
var
|
|
598
|
-
ref:
|
|
599
|
-
className:
|
|
766
|
+
X.displayName = "TimelineGanttLabel";
|
|
767
|
+
var Z = e.forwardRef(({ className: e, start: t = 0, width: n = 100, variant: r = "default", ...i }, a) => /* @__PURE__ */ l("div", {
|
|
768
|
+
ref: a,
|
|
769
|
+
className: o("absolute h-8 rounded-md transition-colors cursor-pointer", {
|
|
600
770
|
default: "bg-blue-500 hover:bg-blue-600",
|
|
601
771
|
success: "bg-green-500 hover:bg-green-600",
|
|
602
772
|
warning: "bg-yellow-500 hover:bg-yellow-600",
|
|
@@ -609,22 +779,22 @@ var U = e.forwardRef(({ className: e, start: t = 0, width: n = 100, variant: r =
|
|
|
609
779
|
},
|
|
610
780
|
...i
|
|
611
781
|
}));
|
|
612
|
-
|
|
613
|
-
var
|
|
782
|
+
Z.displayName = "TimelineGanttBar";
|
|
783
|
+
var Q = e.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ l("div", {
|
|
614
784
|
ref: n,
|
|
615
|
-
className:
|
|
785
|
+
className: o("px-2 py-1 text-white text-xs font-medium truncate", e),
|
|
616
786
|
...t
|
|
617
787
|
}));
|
|
618
|
-
|
|
619
|
-
var
|
|
620
|
-
let { dataSource: n } =
|
|
621
|
-
return /* @__PURE__ */
|
|
788
|
+
Q.displayName = "TimelineGanttBarContent";
|
|
789
|
+
var $ = ({ schema: e, ...t }) => {
|
|
790
|
+
let { dataSource: n } = v() || {};
|
|
791
|
+
return /* @__PURE__ */ l(N, {
|
|
622
792
|
schema: e,
|
|
623
793
|
dataSource: n,
|
|
624
794
|
...t
|
|
625
795
|
});
|
|
626
796
|
};
|
|
627
|
-
|
|
797
|
+
d.register("object-timeline", $, {
|
|
628
798
|
namespace: "plugin-timeline",
|
|
629
799
|
label: "Object Timeline",
|
|
630
800
|
category: "view",
|
|
@@ -643,7 +813,7 @@ u.register("object-timeline", G, {
|
|
|
643
813
|
],
|
|
644
814
|
defaultValue: "vertical"
|
|
645
815
|
}]
|
|
646
|
-
}),
|
|
816
|
+
}), d.register("timeline", $, {
|
|
647
817
|
namespace: "view",
|
|
648
818
|
label: "Timeline View",
|
|
649
819
|
category: "view",
|
|
@@ -664,4 +834,4 @@ u.register("object-timeline", G, {
|
|
|
664
834
|
}]
|
|
665
835
|
});
|
|
666
836
|
//#endregion
|
|
667
|
-
export {
|
|
837
|
+
export { N as ObjectTimeline, $ as ObjectTimelineRenderer, 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, E as TimelineRenderer, V as TimelineTime, B as TimelineTitle, F as timelineItemVariants, L as timelineMarkerVariants };
|
package/dist/index.umd.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require(`react`),require(`@object-ui/components`),require(`react/jsx-runtime`),require(`@object-ui/core`),require(`@object-ui/react`),require(`@object-ui/mobile`),require(`zod`)):typeof define==`function`&&define.amd?define([`exports`,`react`,`@object-ui/components`,`react/jsx-runtime`,`@object-ui/core`,`@object-ui/react`,`@object-ui/mobile`,`zod`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.ObjectUIPluginTimeline={},e.React,e.ObjectUIComponents,e.react_jsx_runtime,e.ObjectUICore,e.ObjectUIReact,e.ObjectUIMobile,e.zod))})(this,function(e,t,n,r,i,a,o,s){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var c=Object.create,l=Object.defineProperty,u=Object.getOwnPropertyDescriptor,d=Object.getOwnPropertyNames,f=Object.getPrototypeOf,p=Object.prototype.hasOwnProperty,m=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=d(t),a=0,o=i.length,s;a<o;a++)s=i[a],!p.call(e,s)&&s!==n&&l(e,s,{get:(e=>t[e]).bind(null,s),enumerable:!(r=u(t,s))||r.enumerable});return e};t=((e,t,n)=>(n=e==null?{}:c(f(e)),m(t||!e||!e.__esModule?l(n,`default`,{value:e,enumerable:!0}):n,e)))(t,1);var h=10080*60*1e3;function g(e){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()));return{minDate:new Date(n).toISOString().split(`T`)[0],maxDate:new Date(r).toISOString().split(`T`)[0]}}function _(e,t,n,r){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;return{start:c/s*100,width:l/s*100}}function v(e,t){let n=new Date(e);return t===`short`?n.toLocaleDateString():t===`long`?n.toLocaleDateString(`en-US`,{year:`numeric`,month:`long`,day:`numeric`}):n.toISOString().split(`T`)[0]}var y=({schema:e,className:t,...i})=>{let{variant:a=`vertical`,items:o=[],dateFormat:s=`short`,onItemClick:c}=e;if(a===`vertical`)return(0,r.jsx)(C,{className:t,...i,children:o.map((e,t)=>(0,r.jsxs)(T,{className:(0,n.cn)(e.className,c&&`cursor-pointer`),onClick:()=>c?.(e),children:[(0,r.jsx)(D,{variant:e.variant||`default`,children:e.icon&&(0,r.jsx)(`span`,{className:`text-xs`,children:e.icon})}),(0,r.jsxs)(O,{children:[e.time&&(0,r.jsx)(A,{dateTime:e.time,children:v(e.time,s)}),e.title&&(0,r.jsx)(k,{children:e.title}),e.description&&(0,r.jsx)(j,{className:`line-clamp-2 sm:line-clamp-none`,children:e.description}),e.content&&(0,n.renderChildren)(e.content)]})]},t))});if(a===`horizontal`)return(0,r.jsx)(M,{className:(0,n.cn)(`overflow-x-auto [-webkit-overflow-scrolling:touch]`,t),...i,children:o.map((e,t)=>(0,r.jsxs)(N,{className:(0,n.cn)(e.className,c&&`cursor-pointer`),onClick:()=>c?.(e),children:[(0,r.jsxs)(`div`,{className:`flex flex-col items-center`,children:[(0,r.jsx)(D,{variant:e.variant||`default`,children:e.icon&&(0,r.jsx)(`span`,{className:`text-xs`,children:e.icon})}),(0,r.jsxs)(`div`,{className:`mt-4 text-center`,children:[e.time&&(0,r.jsx)(A,{dateTime:e.time,children:v(e.time,s)}),e.title&&(0,r.jsx)(k,{children:e.title}),e.description&&(0,r.jsx)(j,{className:`text-center line-clamp-2 sm:line-clamp-none`,children:e.description}),e.content&&(0,n.renderChildren)(e.content)]})]}),t<o.length-1&&(0,r.jsx)(`div`,{className:`absolute left-full w-16 border-t-2 border-gray-200 top-3`})]},t))});if(a===`gantt`){let a=g(o),l=e.minDate||a.minDate,u=e.maxDate||a.maxDate,d=e.timeScale||`month`,f=(()=>{let e=[],t=new Date(l),n=new Date(u);if(d===`month`){let r=new Date(t);for(;r<=n;)e.push(r.toLocaleDateString(`en-US`,{month:`short`,year:`numeric`})),r.setMonth(r.getMonth()+1)}else if(d===`week`){let r=new Date(t);for(;r<=n;)e.push(`Week ${Math.ceil((r.getTime()-t.getTime())/h)+1}`),r.setDate(r.getDate()+7)}else if(d===`day`){let r=new Date(t);for(;r<=n;)e.push(r.toLocaleDateString(`en-US`,{month:`short`,day:`numeric`})),r.setDate(r.getDate()+1)}return e})();return(0,r.jsxs)(P,{className:(0,n.cn)(`overflow-x-auto [-webkit-overflow-scrolling:touch]`,t),...i,children:[(0,r.jsxs)(F,{children:[(0,r.jsx)(I,{className:`flex items-center px-2 sm:px-4 py-2 sm:py-3`,children:(0,r.jsx)(`span`,{className:`font-semibold text-xs sm:text-sm`,children:e.rowLabel||`Items`})}),(0,r.jsx)(L,{children:(0,r.jsx)(`div`,{className:`flex h-full`,children:f.map((e,t)=>(0,r.jsx)(`div`,{className:`flex-1 px-1 sm:px-2 py-2 sm:py-3 border-r text-xs font-medium text-center`,children:e},t))})})]}),(0,r.jsx)(`div`,{children:(0,r.jsxs)(`div`,{className:`flex`,children:[(0,r.jsx)(I,{children:o.map((e,t)=>(0,r.jsx)(R,{children:(0,r.jsx)(z,{title:e.label,className:`truncate`,children:e.label})},t))}),(0,r.jsx)(L,{className:`relative`,children:o.map((e,t)=>(0,r.jsx)(R,{className:`relative`,children:(e.items||[]).map((n,i)=>{let a=_(n.startDate,n.endDate,l,u);return(0,r.jsx)(B,{start:a.start,width:a.width,variant:n.variant||`default`,onClick:()=>c?.(n,e,t,i),title:`${n.title||``}\n${v(n.startDate,s)} - ${v(n.endDate,s)}`,children:(0,r.jsx)(V,{children:n.title})},i)})},t))})]})})]})}return null};i.ComponentRegistry.register(`timeline`,y,{namespace:`plugin-timeline`,label:`Timeline`,category:`data-display`,inputs:[{name:`variant`,type:`enum`,enum:[`vertical`,`horizontal`,`gantt`],label:`Timeline Variant`,defaultValue:`vertical`},{name:`items`,type:`array`,label:`Timeline Items`,description:`For vertical/horizontal: Array of { time, title, description, variant, icon, content }. For gantt: Array of { label, items: [{ title, startDate, endDate, variant }] }`},{name:`dateFormat`,type:`enum`,enum:[`short`,`long`,`iso`],label:`Date Format`,defaultValue:`short`},{name:`timeScale`,type:`enum`,enum:[`day`,`week`,`month`],label:`Time Scale (Gantt only)`,defaultValue:`month`},{name:`rowLabel`,type:`string`,label:`Row Label (Gantt only)`,defaultValue:`Items`},{name:`minDate`,type:`string`,label:`Min Date (Gantt only)`,description:`Override auto-calculated min date (YYYY-MM-DD)`},{name:`maxDate`,type:`string`,label:`Max Date (Gantt only)`,description:`Override auto-calculated max date (YYYY-MM-DD)`},{name:`className`,type:`string`,label:`CSS Class`}],defaultProps:{variant:`vertical`,dateFormat:`short`,items:[{time:`2024-01-15`,title:`Project Started`,description:`Kickoff meeting and initial planning`,variant:`success`,icon:`🚀`},{time:`2024-02-01`,title:`First Milestone`,description:`Completed initial design phase`,variant:`info`,icon:`🎨`},{time:`2024-03-15`,title:`Beta Release`,description:`Released beta version to testers`,variant:`warning`,icon:`⚡`},{time:`2024-04-01`,title:`Launch`,description:`Official product launch`,variant:`success`,icon:`🎉`}]},examples:{vertical:{variant:`vertical`,dateFormat:`long`,items:[{time:`2024-01-15`,title:`Project Started`,description:`Kickoff meeting and initial planning`,variant:`success`},{time:`2024-02-01`,title:`First Milestone`,description:`Completed initial design phase`,variant:`info`}]},horizontal:{variant:`horizontal`,dateFormat:`short`,items:[{time:`2024-01-01`,title:`Q1`,description:`First quarter`,variant:`default`},{time:`2024-04-01`,title:`Q2`,description:`Second quarter`,variant:`info`},{time:`2024-07-01`,title:`Q3`,description:`Third quarter`,variant:`warning`},{time:`2024-10-01`,title:`Q4`,description:`Fourth quarter`,variant:`success`}]},gantt:{variant:`gantt`,dateFormat:`short`,timeScale:`month`,rowLabel:`Projects`,items:[{label:`Backend Development`,items:[{title:`API Design`,startDate:`2024-01-01`,endDate:`2024-01-31`,variant:`success`},{title:`Implementation`,startDate:`2024-02-01`,endDate:`2024-03-31`,variant:`info`}]},{label:`Frontend Development`,items:[{title:`UI Design`,startDate:`2024-01-15`,endDate:`2024-02-15`,variant:`warning`},{title:`Component Dev`,startDate:`2024-02-15`,endDate:`2024-04-15`,variant:`default`}]},{label:`Testing`,items:[{title:`QA Phase`,startDate:`2024-03-01`,endDate:`2024-04-30`,variant:`danger`}]}]}}});var b=s.z.object({title:s.z.string().optional(),date:s.z.string().optional(),description:s.z.string().optional(),variant:s.z.string().optional()}),x=s.z.object({mapping:b.optional(),objectName:s.z.string().optional(),titleField:s.z.string().optional(),dateField:s.z.string().optional(),startDateField:s.z.string().optional(),endDateField:s.z.string().optional(),descriptionField:s.z.string().optional(),groupByField:s.z.string().optional(),colorField:s.z.string().optional(),scale:s.z.enum([`hour`,`day`,`week`,`month`,`quarter`,`year`]).optional()}),S=({schema:e,dataSource:s,className:c,onRowClick:l,onItemClick:u,...d})=>{let[f,p]=(0,t.useState)([]),[m,h]=(0,t.useState)(!1),[g,_]=(0,t.useState)(null),[v,b]=(0,t.useState)(0),[S,C]=(0,t.useState)(null),w=e.timeline;(0,t.useEffect)(()=>{let t=x.safeParse(e);t.success||console.warn(`[ObjectTimeline] Invalid timeline configuration:`,t.error.format())},[e]);let T=(0,a.useDataScope)(e.bind);(0,t.useEffect)(()=>{let t=!0;return(async()=>{if(!(!s||typeof s.getObjectSchema!=`function`||!e.objectName))try{let n=await s.getObjectSchema(e.objectName);t&&C(n)}catch(e){console.warn(`Failed to fetch object def for ObjectTimeline`,e)}})(),()=>{t=!1}},[e.objectName,s]),(0,t.useEffect)(()=>{e.objectName&&!T&&!e.items&&!d.data&&(async()=>{if(!(!s||typeof s.find!=`function`||!e.objectName)){h(!0);try{let t=(0,i.buildExpandFields)(S?.fields);p((0,i.extractRecords)(await s.find(e.objectName,{options:{$top:100},...t.length>0?{$expand:t}:{}})))}catch(e){console.error(e),_(e)}finally{h(!1)}}})()},[e.objectName,s,T,e.items,d.data,v,S]);let E=d.data||T||f,D=e.items;if(!D&&E&&Array.isArray(E)){let t=w?.titleField??e.mapping?.title??e.titleField??`name`,n=w?.startDateField??e.mapping?.date??e.startDateField??e.dateField??`date`,r=w?.endDateField??e.endDateField??n,i=e.mapping?.description??e.descriptionField??`description`,a=e.mapping?.variant??`variant`,o=w?.groupByField??e.groupByField,s=w?.colorField??e.colorField;D=E.map(e=>({title:e[t],time:e[n],startDate:e[n],endDate:e[r],description:e[i],variant:e[a]||`default`,...o?{group:e[o]}:{},...s?{color:e[s]}:{},_data:e}))}let{ref:O,isRefreshing:k,pullDistance:A}=(0,o.usePullToRefresh)({onRefresh:(0,t.useCallback)(async()=>{b(e=>e+1)},[]),enabled:!!e.objectName&&!!s}),j=(0,a.useNavigationOverlay)({navigation:e.navigation,objectName:e.objectName,onRowClick:l??u}),M=w?.scale??e.scale,N={...e,items:D||[],className:c||e.className,...M?{timeScale:M}:{},onItemClick:e=>{let t=e._data||e;j.handleClick(t),u?.(t)}};return g?(0,r.jsxs)(`div`,{className:`p-4 text-red-500`,children:[`Error loading timeline: `,g.message]}):(0,r.jsxs)(`div`,{ref:O,className:`relative overflow-auto h-full min-w-0`,children:[A>0&&(0,r.jsx)(`div`,{className:`flex items-center justify-center text-xs text-muted-foreground`,style:{height:A},children:k?`Refreshing…`:`Pull to refresh`}),(0,r.jsx)(y,{schema:N}),j.isOverlay&&(0,r.jsx)(n.NavigationOverlay,{...j,title:`Timeline Item`,children:e=>(0,r.jsx)(`div`,{className:`space-y-3`,children:Object.entries(e).map(([e,t])=>(0,r.jsxs)(`div`,{className:`flex flex-col`,children:[(0,r.jsx)(`span`,{className:`text-xs font-medium text-muted-foreground uppercase tracking-wide`,children:e.replace(/_/g,` `)}),(0,r.jsx)(`span`,{className:`text-sm`,children:String(t??`—`)})]},e))})})]})},C=t.forwardRef(({className:e,...t},i)=>(0,r.jsx)(`ol`,{ref:i,className:(0,n.cn)(`relative ml-3 border-l border-gray-200`,e),...t}));C.displayName=`Timeline`;var w=(0,n.cva)(`ml-6`,{variants:{density:{default:`mb-10`,compact:`mb-3`,comfortable:`mb-6`}},defaultVariants:{density:`default`}}),T=t.forwardRef(({className:e,density:t,...i},a)=>(0,r.jsx)(`li`,{ref:a,className:(0,n.cn)(w({density:t}),e),...i}));T.displayName=`TimelineItem`;var E=(0,n.cva)(`absolute -left-3 w-6 h-6 rounded-full border-2 flex items-center justify-center`,{variants:{variant:{default:`bg-blue-200 border-blue-400`,success:`bg-emerald-200 border-emerald-500`,warning:`bg-amber-200 border-amber-500`,danger:`bg-red-200 border-red-500`,info:`bg-purple-200 border-purple-500`,todo:`bg-slate-200 border-slate-400`,"in-progress":`bg-blue-200 border-blue-500`,done:`bg-emerald-200 border-emerald-500`}},defaultVariants:{variant:`default`}}),D=t.forwardRef(({className:e,variant:t=`default`,...i},a)=>(0,r.jsx)(`div`,{ref:a,className:(0,n.cn)(E({variant:t}),e),...i}));D.displayName=`TimelineMarker`;var O=t.forwardRef(({className:e,...t},n)=>(0,r.jsx)(`div`,{ref:n,className:e,...t}));O.displayName=`TimelineContent`;var k=t.forwardRef(({className:e,...t},i)=>(0,r.jsx)(`h3`,{ref:i,className:(0,n.cn)(`font-semibold text-lg mb-1`,e),...t}));k.displayName=`TimelineTitle`;var A=t.forwardRef(({className:e,...t},i)=>(0,r.jsx)(`time`,{ref:i,className:(0,n.cn)(`text-sm font-normal text-gray-500 mb-2 block`,e),...t}));A.displayName=`TimelineTime`;var j=t.forwardRef(({className:e,...t},i)=>(0,r.jsx)(`p`,{ref:i,className:(0,n.cn)(`text-base text-gray-700`,e),...t}));j.displayName=`TimelineDescription`;var M=t.forwardRef(({className:e,...t},i)=>(0,r.jsx)(`div`,{ref:i,className:(0,n.cn)(`relative flex overflow-x-auto py-8`,e),...t}));M.displayName=`TimelineHorizontal`;var N=t.forwardRef(({className:e,...t},i)=>(0,r.jsx)(`div`,{ref:i,className:(0,n.cn)(`shrink-0 w-64 relative`,e),...t}));N.displayName=`TimelineHorizontalItem`;var P=t.forwardRef(({className:e,...t},i)=>(0,r.jsx)(`div`,{ref:i,className:(0,n.cn)(`relative w-full border rounded-lg overflow-hidden`,e),...t}));P.displayName=`TimelineGantt`;var F=t.forwardRef(({className:e,...t},i)=>(0,r.jsx)(`div`,{ref:i,className:(0,n.cn)(`flex border-b bg-gray-50`,e),...t}));F.displayName=`TimelineGanttHeader`;var I=t.forwardRef(({className:e,...t},i)=>(0,r.jsx)(`div`,{ref:i,className:(0,n.cn)(`w-48 border-r bg-white`,e),...t}));I.displayName=`TimelineGanttRowLabels`;var L=t.forwardRef(({className:e,...t},i)=>(0,r.jsx)(`div`,{ref:i,className:(0,n.cn)(`flex-1 overflow-x-auto`,e),...t}));L.displayName=`TimelineGanttGrid`;var R=t.forwardRef(({className:e,...t},i)=>(0,r.jsx)(`div`,{ref:i,className:(0,n.cn)(`flex items-center border-b min-h-12`,e),...t}));R.displayName=`TimelineGanttRow`;var z=t.forwardRef(({className:e,...t},i)=>(0,r.jsx)(`div`,{ref:i,className:(0,n.cn)(`px-4 py-2 font-medium text-sm truncate`,e),...t}));z.displayName=`TimelineGanttLabel`;var B=t.forwardRef(({className:e,start:t=0,width:i=100,variant:a=`default`,...o},s)=>(0,r.jsx)(`div`,{ref:s,className:(0,n.cn)(`absolute h-8 rounded-md transition-colors cursor-pointer`,{default:`bg-blue-500 hover:bg-blue-600`,success:`bg-green-500 hover:bg-green-600`,warning:`bg-yellow-500 hover:bg-yellow-600`,danger:`bg-red-500 hover:bg-red-600`,info:`bg-purple-500 hover:bg-purple-600`}[a],e),style:{left:`${t}%`,width:`${i}%`},...o}));B.displayName=`TimelineGanttBar`;var V=t.forwardRef(({className:e,...t},i)=>(0,r.jsx)(`div`,{ref:i,className:(0,n.cn)(`px-2 py-1 text-white text-xs font-medium truncate`,e),...t}));V.displayName=`TimelineGanttBarContent`;var H=({schema:e,...t})=>{let{dataSource:n}=(0,a.useSchemaContext)()||{};return(0,r.jsx)(S,{schema:e,dataSource:n,...t})};i.ComponentRegistry.register(`object-timeline`,H,{namespace:`plugin-timeline`,label:`Object Timeline`,category:`view`,inputs:[{name:`objectName`,type:`string`,label:`Object Name`,required:!0},{name:`variant`,type:`enum`,enum:[`vertical`,`horizontal`,`gantt`],defaultValue:`vertical`}]}),i.ComponentRegistry.register(`timeline`,H,{namespace:`view`,label:`Timeline View`,category:`view`,inputs:[{name:`objectName`,type:`string`,label:`Object Name`,required:!0},{name:`variant`,type:`enum`,enum:[`vertical`,`horizontal`,`gantt`],defaultValue:`vertical`}]}),e.ObjectTimeline=S,e.ObjectTimelineRenderer=H,e.Timeline=C,e.TimelineContent=O,e.TimelineDescription=j,e.TimelineGantt=P,e.TimelineGanttBar=B,e.TimelineGanttBarContent=V,e.TimelineGanttGrid=L,e.TimelineGanttHeader=F,e.TimelineGanttLabel=z,e.TimelineGanttRow=R,e.TimelineGanttRowLabels=I,e.TimelineHorizontal=M,e.TimelineHorizontalItem=N,e.TimelineItem=T,e.TimelineMarker=D,e.TimelineRenderer=y,e.TimelineTime=A,e.TimelineTitle=k,e.timelineItemVariants=w,e.timelineMarkerVariants=E});
|
|
1
|
+
(function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require(`react`),require(`@object-ui/components`),require(`react/jsx-runtime`),require(`@object-ui/core`),require(`@object-ui/react`),require(`@object-ui/mobile`),require(`zod`)):typeof define==`function`&&define.amd?define([`exports`,`react`,`@object-ui/components`,`react/jsx-runtime`,`@object-ui/core`,`@object-ui/react`,`@object-ui/mobile`,`zod`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.ObjectUIPluginTimeline={},e.React,e.ObjectUIComponents,e.react_jsx_runtime,e.ObjectUICore,e.ObjectUIReact,e.ObjectUIMobile,e.zod))})(this,function(e,t,n,r,i,a,o,s){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var c=Object.create,l=Object.defineProperty,u=Object.getOwnPropertyDescriptor,d=Object.getOwnPropertyNames,f=Object.getPrototypeOf,p=Object.prototype.hasOwnProperty,m=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=d(t),a=0,o=i.length,s;a<o;a++)s=i[a],!p.call(e,s)&&s!==n&&l(e,s,{get:(e=>t[e]).bind(null,s),enumerable:!(r=u(t,s))||r.enumerable});return e};t=((e,t,n)=>(n=e==null?{}:c(f(e)),m(t||!e||!e.__esModule?l(n,`default`,{value:e,enumerable:!0}):n,e)))(t,1);var h=10080*60*1e3;function g(e){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()));return{minDate:new Date(n).toISOString().split(`T`)[0],maxDate:new Date(r).toISOString().split(`T`)[0]}}function _(e,t,n,r){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;return{start:c/s*100,width:l/s*100}}function v(e,t){let n=new Date(e);return t===`short`?n.toLocaleDateString():t===`long`?n.toLocaleDateString(`en-US`,{year:`numeric`,month:`long`,day:`numeric`}):n.toISOString().split(`T`)[0]}function y({label:e,color:t}){let i=t?{backgroundColor:`${t}22`,color:t,borderColor:`${t}55`}:void 0;return(0,r.jsx)(`span`,{className:(0,n.cn)(`inline-flex items-center rounded-full border px-2 py-0.5 text-xs font-medium`,!t&&`bg-muted text-muted-foreground border-transparent`),style:i,children:e})}function b(e){let t=[];for(let n of e){let e=n.group==null?``:String(n.group),r=t[t.length-1];r&&r.key===e?r.items.push(n):t.push({key:e,items:[n]})}return t}var x=({schema:e,className:t,...i})=>{let{variant:a=`vertical`,items:o=[],dateFormat:s=`short`,onItemClick:c}=e;if(a===`vertical`){let e=b(o),a=e.some(e=>e.key!==``),l=(e,t)=>{let i=e.color?{backgroundColor:`${e.color}33`,borderColor:e.color}:void 0,a=e.time?v(e.time,s):e.startDate?v(e.startDate,s):``,o=e.endDate&&e.endDate!==e.startDate?v(e.endDate,s):``,l=Array.isArray(e.meta)?e.meta:[];return(0,r.jsxs)(M,{density:`compact`,className:(0,n.cn)(e.className,c&&`cursor-pointer`),onClick:()=>c?.(e),children:[(0,r.jsx)(P,{variant:e.color?`default`:e.variant||`default`,style:i,children:e.icon&&(0,r.jsx)(`span`,{className:`text-xs`,children:e.icon})}),(0,r.jsxs)(F,{children:[(a||o)&&(0,r.jsxs)(L,{dateTime:e.time||e.startDate,className:`!mb-1 text-xs`,children:[a,o&&(0,r.jsxs)(`span`,{className:`text-muted-foreground/70`,children:[` → `,o]})]}),e.title&&(0,r.jsx)(I,{className:`text-sm sm:text-base mb-1`,children:e.title}),l.length>0&&(0,r.jsx)(`div`,{className:`flex flex-wrap gap-1.5 mt-1 mb-1`,children:l.map(e=>(0,r.jsx)(y,{label:e.label,color:e.color},e.key))}),e.description&&(0,r.jsx)(R,{className:`text-sm text-muted-foreground line-clamp-2 sm:line-clamp-none`,children:e.description}),e.content&&(0,n.renderChildren)(e.content)]})]},t)};return a?(0,r.jsx)(`div`,{className:(0,n.cn)(`px-4 sm:px-6 py-2`,t),...i,children:e.map((e,t)=>(0,r.jsxs)(`section`,{className:`mb-4`,children:[(0,r.jsxs)(`header`,{className:`sticky top-0 z-10 -mx-4 sm:-mx-6 px-4 sm:px-6 py-1.5 backdrop-blur bg-background/90 text-xs font-semibold uppercase tracking-wide text-muted-foreground border-b`,children:[(0,r.jsx)(`span`,{children:e.key}),(0,r.jsx)(`span`,{className:`ml-2 text-muted-foreground/60 font-normal normal-case`,children:e.items.length})]}),(0,r.jsx)(A,{className:`mt-3`,children:e.items.map((e,n)=>l(e,`${t}-${n}`))})]},`${e.key}-${t}`))}):(0,r.jsx)(A,{className:t,...i,children:o.map((e,t)=>l(e,t))})}if(a===`horizontal`)return(0,r.jsx)(z,{className:(0,n.cn)(`overflow-x-auto [-webkit-overflow-scrolling:touch]`,t),...i,children:o.map((e,t)=>(0,r.jsxs)(B,{className:(0,n.cn)(e.className,c&&`cursor-pointer`),onClick:()=>c?.(e),children:[(0,r.jsxs)(`div`,{className:`flex flex-col items-center`,children:[(0,r.jsx)(P,{variant:e.variant||`default`,children:e.icon&&(0,r.jsx)(`span`,{className:`text-xs`,children:e.icon})}),(0,r.jsxs)(`div`,{className:`mt-4 text-center`,children:[e.time&&(0,r.jsx)(L,{dateTime:e.time,children:v(e.time,s)}),e.title&&(0,r.jsx)(I,{children:e.title}),e.description&&(0,r.jsx)(R,{className:`text-center line-clamp-2 sm:line-clamp-none`,children:e.description}),e.content&&(0,n.renderChildren)(e.content)]})]}),t<o.length-1&&(0,r.jsx)(`div`,{className:`absolute left-full w-16 border-t-2 border-gray-200 top-3`})]},t))});if(a===`gantt`){let a=g(o),l=e.minDate||a.minDate,u=e.maxDate||a.maxDate,d=e.timeScale||`month`,f=(()=>{let e=[],t=new Date(l),n=new Date(u);if(d===`month`){let r=new Date(t);for(;r<=n;)e.push(r.toLocaleDateString(`en-US`,{month:`short`,year:`numeric`})),r.setMonth(r.getMonth()+1)}else if(d===`week`){let r=new Date(t);for(;r<=n;)e.push(`Week ${Math.ceil((r.getTime()-t.getTime())/h)+1}`),r.setDate(r.getDate()+7)}else if(d===`day`){let r=new Date(t);for(;r<=n;)e.push(r.toLocaleDateString(`en-US`,{month:`short`,day:`numeric`})),r.setDate(r.getDate()+1)}return e})();return(0,r.jsxs)(V,{className:(0,n.cn)(`overflow-x-auto [-webkit-overflow-scrolling:touch]`,t),...i,children:[(0,r.jsxs)(H,{children:[(0,r.jsx)(U,{className:`flex items-center px-2 sm:px-4 py-2 sm:py-3`,children:(0,r.jsx)(`span`,{className:`font-semibold text-xs sm:text-sm`,children:e.rowLabel||`Items`})}),(0,r.jsx)(W,{children:(0,r.jsx)(`div`,{className:`flex h-full`,children:f.map((e,t)=>(0,r.jsx)(`div`,{className:`flex-1 px-1 sm:px-2 py-2 sm:py-3 border-r text-xs font-medium text-center`,children:e},t))})})]}),(0,r.jsx)(`div`,{children:(0,r.jsxs)(`div`,{className:`flex`,children:[(0,r.jsx)(U,{children:o.map((e,t)=>(0,r.jsx)(G,{children:(0,r.jsx)(K,{title:e.label,className:`truncate`,children:e.label})},t))}),(0,r.jsx)(W,{className:`relative`,children:o.map((e,t)=>(0,r.jsx)(G,{className:`relative`,children:(e.items||[]).map((n,i)=>{let a=_(n.startDate,n.endDate,l,u);return(0,r.jsx)(q,{start:a.start,width:a.width,variant:n.variant||`default`,onClick:()=>c?.(n,e,t,i),title:`${n.title||``}\n${v(n.startDate,s)} - ${v(n.endDate,s)}`,children:(0,r.jsx)(J,{children:n.title})},i)})},t))})]})})]})}return null};i.ComponentRegistry.register(`timeline`,x,{namespace:`plugin-timeline`,label:`Timeline`,category:`data-display`,inputs:[{name:`variant`,type:`enum`,enum:[`vertical`,`horizontal`,`gantt`],label:`Timeline Variant`,defaultValue:`vertical`},{name:`items`,type:`array`,label:`Timeline Items`,description:`For vertical/horizontal: Array of { time, title, description, variant, icon, content }. For gantt: Array of { label, items: [{ title, startDate, endDate, variant }] }`},{name:`dateFormat`,type:`enum`,enum:[`short`,`long`,`iso`],label:`Date Format`,defaultValue:`short`},{name:`timeScale`,type:`enum`,enum:[`day`,`week`,`month`],label:`Time Scale (Gantt only)`,defaultValue:`month`},{name:`rowLabel`,type:`string`,label:`Row Label (Gantt only)`,defaultValue:`Items`},{name:`minDate`,type:`string`,label:`Min Date (Gantt only)`,description:`Override auto-calculated min date (YYYY-MM-DD)`},{name:`maxDate`,type:`string`,label:`Max Date (Gantt only)`,description:`Override auto-calculated max date (YYYY-MM-DD)`},{name:`className`,type:`string`,label:`CSS Class`}],defaultProps:{variant:`vertical`,dateFormat:`short`,items:[{time:`2024-01-15`,title:`Project Started`,description:`Kickoff meeting and initial planning`,variant:`success`,icon:`🚀`},{time:`2024-02-01`,title:`First Milestone`,description:`Completed initial design phase`,variant:`info`,icon:`🎨`},{time:`2024-03-15`,title:`Beta Release`,description:`Released beta version to testers`,variant:`warning`,icon:`⚡`},{time:`2024-04-01`,title:`Launch`,description:`Official product launch`,variant:`success`,icon:`🎉`}]},examples:{vertical:{variant:`vertical`,dateFormat:`long`,items:[{time:`2024-01-15`,title:`Project Started`,description:`Kickoff meeting and initial planning`,variant:`success`},{time:`2024-02-01`,title:`First Milestone`,description:`Completed initial design phase`,variant:`info`}]},horizontal:{variant:`horizontal`,dateFormat:`short`,items:[{time:`2024-01-01`,title:`Q1`,description:`First quarter`,variant:`default`},{time:`2024-04-01`,title:`Q2`,description:`Second quarter`,variant:`info`},{time:`2024-07-01`,title:`Q3`,description:`Third quarter`,variant:`warning`},{time:`2024-10-01`,title:`Q4`,description:`Fourth quarter`,variant:`success`}]},gantt:{variant:`gantt`,dateFormat:`short`,timeScale:`month`,rowLabel:`Projects`,items:[{label:`Backend Development`,items:[{title:`API Design`,startDate:`2024-01-01`,endDate:`2024-01-31`,variant:`success`},{title:`Implementation`,startDate:`2024-02-01`,endDate:`2024-03-31`,variant:`info`}]},{label:`Frontend Development`,items:[{title:`UI Design`,startDate:`2024-01-15`,endDate:`2024-02-15`,variant:`warning`},{title:`Component Dev`,startDate:`2024-02-15`,endDate:`2024-04-15`,variant:`default`}]},{label:`Testing`,items:[{title:`QA Phase`,startDate:`2024-03-01`,endDate:`2024-04-30`,variant:`danger`}]}]}}});var S={"timeline.bucket.overdue":`Overdue`,"timeline.bucket.today":`Today`,"timeline.bucket.tomorrow":`Tomorrow`,"timeline.bucket.thisWeek":`This week`,"timeline.bucket.nextWeek":`Next week`,"timeline.bucket.later":`Later`,"timeline.bucket.noDate":`No date`,"timeline.bucket.unassigned":`Unassigned`,"timeline.relative.today":`Today`,"timeline.relative.tomorrow":`Tomorrow`,"timeline.relative.yesterday":`Yesterday`,"timeline.relative.inDays":`In {{n}} days`,"timeline.relative.daysAgo":`{{n}} days ago`},C=`timeline.bucket.today`;function w(e,t){let n=S[e]||e;if(t)for(let[e,r]of Object.entries(t))n=n.replace(`{{${e}}}`,String(r));return n}function T(){try{let e=(0,a.useObjectTranslation)();return e.t(C)===C?{t:w}:{t:e.t}}catch{return{t:w}}}function E(){try{return(0,a.useObjectLabel)()}catch{return{fieldOptionLabel:(e,t,n,r)=>r,translateOptions:(e,t,n)=>n,fieldLabel:(e,t,n)=>n}}}var D=s.z.object({title:s.z.string().optional(),date:s.z.string().optional(),description:s.z.string().optional(),variant:s.z.string().optional()}),O=s.z.object({mapping:D.optional(),objectName:s.z.string().optional(),titleField:s.z.string().optional(),dateField:s.z.string().optional(),startDateField:s.z.string().optional(),endDateField:s.z.string().optional(),descriptionField:s.z.string().optional(),groupByField:s.z.string().optional(),colorField:s.z.string().optional(),scale:s.z.enum([`hour`,`day`,`week`,`month`,`quarter`,`year`]).optional()}),k=({schema:e,dataSource:s,className:c,onRowClick:l,onItemClick:u,...d})=>{let[f,p]=(0,t.useState)([]),[m,h]=(0,t.useState)(!1),[g,_]=(0,t.useState)(null),[v,y]=(0,t.useState)(0),[b,S]=(0,t.useState)(null),C=e.timeline;(0,t.useEffect)(()=>{let t=O.safeParse(e);t.success||console.warn(`[ObjectTimeline] Invalid timeline configuration:`,t.error.format())},[e]);let w=(0,a.useDataScope)(e.bind);(0,t.useEffect)(()=>{let t=!0;return(async()=>{if(!(!s||typeof s.getObjectSchema!=`function`||!e.objectName))try{let n=await s.getObjectSchema(e.objectName);t&&S(n)}catch(e){console.warn(`Failed to fetch object def for ObjectTimeline`,e)}})(),()=>{t=!1}},[e.objectName,s]),(0,t.useEffect)(()=>{e.objectName&&!w&&!e.items&&!d.data&&(async()=>{if(!(!s||typeof s.find!=`function`||!e.objectName)){h(!0);try{let t=(0,i.buildExpandFields)(b?.fields);p((0,i.extractRecords)(await s.find(e.objectName,{options:{$top:100},...t.length>0?{$expand:t}:{}})))}catch(e){console.error(e),_(e)}finally{h(!1)}}})()},[e.objectName,s,w,e.items,d.data,v,b]);let D=d.data||w||f,{t:k}=T(),{fieldOptionLabel:A}=E(),j=C?.titleField??e.mapping?.title??e.titleField??`name`,M=C?.startDateField??e.mapping?.date??e.startDateField??e.dateField??`date`,N=C?.endDateField??e.endDateField??M,P=e.mapping?.description??e.descriptionField??`description`,F=e.mapping?.variant??`variant`,I=C?.groupByField??e.groupByField,L=C?.colorField??e.colorField,R=(0,t.useMemo)(()=>{if(e.items)return e.items;if(!D||!Array.isArray(D))return[];let t=b?.fields??{},n=e.objectName||``,r=e=>{if(!e||!t[e]?.options)return{};let n={};for(let r of t[e].options)r&&r.value!=null&&(n[String(r.value)]=r);return n},i=r(L),a=Array.isArray(C?.metaFields)?C.metaFields.filter(e=>typeof e==`string`&&e):[`status`,`priority`].filter(e=>t[e]),o={};for(let e of a)o[e]=r(e);let s=e=>{if(e==null||e===``)return;let t=i[String(e)];if(t?.color)return String(t.color);let n=String(e);if(/^#([0-9a-f]{3}){1,2}$/i.test(n)||n.startsWith(`rgb`)||n.startsWith(`hsl`))return n},c=(e,t,r)=>{if(t==null||t===``)return null;let i=r[String(t)];return{label:i?.label?A(n,e,String(t),i.label):String(t),color:i?.color}},l=D.map(e=>{let t=e[M],r=e[N],i=L?e[L]:void 0,l=I?e[I]:void 0,u=[];if(n)for(let t of a){let n=c(t,e[t],o[t]||{});n&&u.push({key:t,label:n.label,color:n.color})}return{title:e[j],time:t,startDate:t,endDate:r,description:e[P],variant:e[F]||`default`,color:s(i),group:l,meta:u,_data:e}});l.sort((e,t)=>(e.startDate?new Date(e.startDate).getTime():1/0)-(t.startDate?new Date(t.startDate).getTime():1/0));let u=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=>{if(!e)return k(`timeline.bucket.noDate`);let t=d(new Date(e));return Number.isNaN(t)?k(`timeline.bucket.noDate`):t<f?k(`timeline.bucket.overdue`):t===f?k(`timeline.bucket.today`):t===f+p?k(`timeline.bucket.tomorrow`):k(t<m?`timeline.bucket.thisWeek`:t<h?`timeline.bucket.nextWeek`:`timeline.bucket.later`)};if(I&&!l.every(e=>e.group==null||e.group===``)){let e=r(I);return l.map(t=>{let n=c(I,t.group,e);return{...t,group:n?n.label:t.group!=null&&t.group!==``?String(t.group):k(`timeline.bucket.unassigned`)}})}return l.map(e=>({...e,group:g(e.startDate)}))},[e.items,D,b,e.objectName,j,M,N,P,F,L,I,k,A]),{ref:z,isRefreshing:B,pullDistance:V}=(0,o.usePullToRefresh)({onRefresh:(0,t.useCallback)(async()=>{y(e=>e+1)},[]),enabled:!!e.objectName&&!!s}),H=(0,a.useNavigationOverlay)({navigation:e.navigation,objectName:e.objectName,onRowClick:l??u}),U=C?.scale??e.scale,W={...e,items:R||[],className:c||e.className,...U?{timeScale:U}:{},onItemClick:e=>{let t=e._data||e;H.handleClick(t),u?.(t)}};return g?(0,r.jsxs)(`div`,{className:`p-4 text-red-500`,children:[`Error loading timeline: `,g.message]}):(0,r.jsxs)(`div`,{ref:z,className:`relative overflow-auto h-full min-w-0`,children:[V>0&&(0,r.jsx)(`div`,{className:`flex items-center justify-center text-xs text-muted-foreground`,style:{height:V},children:B?`Refreshing…`:`Pull to refresh`}),(0,r.jsx)(x,{schema:W}),H.isOverlay&&(0,r.jsx)(n.NavigationOverlay,{...H,title:`Timeline Item`,children:e=>(0,r.jsx)(`div`,{className:`space-y-3`,children:Object.entries(e).map(([e,t])=>(0,r.jsxs)(`div`,{className:`flex flex-col`,children:[(0,r.jsx)(`span`,{className:`text-xs font-medium text-muted-foreground uppercase tracking-wide`,children:e.replace(/_/g,` `)}),(0,r.jsx)(`span`,{className:`text-sm`,children:String(t??`—`)})]},e))})})]})},A=t.forwardRef(({className:e,...t},i)=>(0,r.jsx)(`ol`,{ref:i,className:(0,n.cn)(`relative ml-3 border-l border-gray-200`,e),...t}));A.displayName=`Timeline`;var j=(0,n.cva)(`ml-6`,{variants:{density:{default:`mb-10`,compact:`mb-3`,comfortable:`mb-6`}},defaultVariants:{density:`default`}}),M=t.forwardRef(({className:e,density:t,...i},a)=>(0,r.jsx)(`li`,{ref:a,className:(0,n.cn)(j({density:t}),e),...i}));M.displayName=`TimelineItem`;var N=(0,n.cva)(`absolute -left-3 w-6 h-6 rounded-full border-2 flex items-center justify-center`,{variants:{variant:{default:`bg-blue-200 border-blue-400`,success:`bg-emerald-200 border-emerald-500`,warning:`bg-amber-200 border-amber-500`,danger:`bg-red-200 border-red-500`,info:`bg-purple-200 border-purple-500`,todo:`bg-slate-200 border-slate-400`,"in-progress":`bg-blue-200 border-blue-500`,done:`bg-emerald-200 border-emerald-500`}},defaultVariants:{variant:`default`}}),P=t.forwardRef(({className:e,variant:t=`default`,...i},a)=>(0,r.jsx)(`div`,{ref:a,className:(0,n.cn)(N({variant:t}),e),...i}));P.displayName=`TimelineMarker`;var F=t.forwardRef(({className:e,...t},n)=>(0,r.jsx)(`div`,{ref:n,className:e,...t}));F.displayName=`TimelineContent`;var I=t.forwardRef(({className:e,...t},i)=>(0,r.jsx)(`h3`,{ref:i,className:(0,n.cn)(`font-semibold text-lg mb-1`,e),...t}));I.displayName=`TimelineTitle`;var L=t.forwardRef(({className:e,...t},i)=>(0,r.jsx)(`time`,{ref:i,className:(0,n.cn)(`text-sm font-normal text-gray-500 mb-2 block`,e),...t}));L.displayName=`TimelineTime`;var R=t.forwardRef(({className:e,...t},i)=>(0,r.jsx)(`p`,{ref:i,className:(0,n.cn)(`text-base text-gray-700`,e),...t}));R.displayName=`TimelineDescription`;var z=t.forwardRef(({className:e,...t},i)=>(0,r.jsx)(`div`,{ref:i,className:(0,n.cn)(`relative flex overflow-x-auto py-8`,e),...t}));z.displayName=`TimelineHorizontal`;var B=t.forwardRef(({className:e,...t},i)=>(0,r.jsx)(`div`,{ref:i,className:(0,n.cn)(`shrink-0 w-64 relative`,e),...t}));B.displayName=`TimelineHorizontalItem`;var V=t.forwardRef(({className:e,...t},i)=>(0,r.jsx)(`div`,{ref:i,className:(0,n.cn)(`relative w-full border rounded-lg overflow-hidden`,e),...t}));V.displayName=`TimelineGantt`;var H=t.forwardRef(({className:e,...t},i)=>(0,r.jsx)(`div`,{ref:i,className:(0,n.cn)(`flex border-b bg-gray-50`,e),...t}));H.displayName=`TimelineGanttHeader`;var U=t.forwardRef(({className:e,...t},i)=>(0,r.jsx)(`div`,{ref:i,className:(0,n.cn)(`w-48 border-r bg-white`,e),...t}));U.displayName=`TimelineGanttRowLabels`;var W=t.forwardRef(({className:e,...t},i)=>(0,r.jsx)(`div`,{ref:i,className:(0,n.cn)(`flex-1 overflow-x-auto`,e),...t}));W.displayName=`TimelineGanttGrid`;var G=t.forwardRef(({className:e,...t},i)=>(0,r.jsx)(`div`,{ref:i,className:(0,n.cn)(`flex items-center border-b min-h-12`,e),...t}));G.displayName=`TimelineGanttRow`;var K=t.forwardRef(({className:e,...t},i)=>(0,r.jsx)(`div`,{ref:i,className:(0,n.cn)(`px-4 py-2 font-medium text-sm truncate`,e),...t}));K.displayName=`TimelineGanttLabel`;var q=t.forwardRef(({className:e,start:t=0,width:i=100,variant:a=`default`,...o},s)=>(0,r.jsx)(`div`,{ref:s,className:(0,n.cn)(`absolute h-8 rounded-md transition-colors cursor-pointer`,{default:`bg-blue-500 hover:bg-blue-600`,success:`bg-green-500 hover:bg-green-600`,warning:`bg-yellow-500 hover:bg-yellow-600`,danger:`bg-red-500 hover:bg-red-600`,info:`bg-purple-500 hover:bg-purple-600`}[a],e),style:{left:`${t}%`,width:`${i}%`},...o}));q.displayName=`TimelineGanttBar`;var J=t.forwardRef(({className:e,...t},i)=>(0,r.jsx)(`div`,{ref:i,className:(0,n.cn)(`px-2 py-1 text-white text-xs font-medium truncate`,e),...t}));J.displayName=`TimelineGanttBarContent`;var Y=({schema:e,...t})=>{let{dataSource:n}=(0,a.useSchemaContext)()||{};return(0,r.jsx)(k,{schema:e,dataSource:n,...t})};i.ComponentRegistry.register(`object-timeline`,Y,{namespace:`plugin-timeline`,label:`Object Timeline`,category:`view`,inputs:[{name:`objectName`,type:`string`,label:`Object Name`,required:!0},{name:`variant`,type:`enum`,enum:[`vertical`,`horizontal`,`gantt`],defaultValue:`vertical`}]}),i.ComponentRegistry.register(`timeline`,Y,{namespace:`view`,label:`Timeline View`,category:`view`,inputs:[{name:`objectName`,type:`string`,label:`Object Name`,required:!0},{name:`variant`,type:`enum`,enum:[`vertical`,`horizontal`,`gantt`],defaultValue:`vertical`}]}),e.ObjectTimeline=k,e.ObjectTimelineRenderer=Y,e.Timeline=A,e.TimelineContent=F,e.TimelineDescription=R,e.TimelineGantt=V,e.TimelineGanttBar=q,e.TimelineGanttBarContent=J,e.TimelineGanttGrid=W,e.TimelineGanttHeader=H,e.TimelineGanttLabel=K,e.TimelineGanttRow=G,e.TimelineGanttRowLabels=U,e.TimelineHorizontal=z,e.TimelineHorizontalItem=B,e.TimelineItem=M,e.TimelineMarker=P,e.TimelineRenderer=x,e.TimelineTime=L,e.TimelineTitle=I,e.timelineItemVariants=j,e.timelineMarkerVariants=N});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ObjectTimeline.d.ts","sourceRoot":"","sources":["../../../../src/ObjectTimeline.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,
|
|
1
|
+
{"version":3,"file":"ObjectTimeline.d.ts","sourceRoot":"","sources":["../../../../src/ObjectTimeline.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAoD,MAAM,OAAO,CAAC;AACzE,OAAO,KAAK,EAAE,UAAU,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AA8CnF,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,cAAc,GAAG;QACvB,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,4CAA4C;QAC5C,QAAQ,CAAC,EAAE,cAAc,CAAC;QAC1B,kDAAkD;QAClD,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,sDAAsD;QACtD,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,sDAAsD;QACtD,cAAc,CAAC,EAAE,MAAM,CAAC;QACxB,oDAAoD;QACpD,YAAY,CAAC,EAAE,MAAM,CAAC;QACtB,gBAAgB,CAAC,EAAE,MAAM,CAAC;QAC1B,oDAAoD;QACpD,YAAY,CAAC,EAAE,MAAM,CAAC;QACtB,kDAAkD;QAClD,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,6CAA6C;QAC7C,KAAK,CAAC,EAAE,MAAM,GAAG,KAAK,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,GAAG,MAAM,CAAC;QAE/D,OAAO,CAAC,EAAE;YACR,KAAK,CAAC,EAAE,MAAM,CAAC;YACf,IAAI,CAAC,EAAE,MAAM,CAAC;YACd,WAAW,CAAC,EAAE,MAAM,CAAC;YACrB,OAAO,CAAC,EAAE,MAAM,CAAC;SAClB,CAAA;KACF,CAAC;IACF,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,CAAC,MAAM,EAAE,GAAG,KAAK,IAAI,CAAC;IACnC,WAAW,CAAC,EAAE,CAAC,MAAM,EAAE,GAAG,KAAK,IAAI,CAAC;CACrC;AAED,eAAO,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC,mBAAmB,CA2SxD,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"renderer.d.ts","sourceRoot":"","sources":["../../../../src/renderer.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;
|
|
1
|
+
{"version":3,"file":"renderer.d.ts","sourceRoot":"","sources":["../../../../src/renderer.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAmHvD,eAAO,MAAM,gBAAgB,GAAI,iCAAiC;IAAE,MAAM,EAAE,cAAc,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;CAAE,mDAoQjI,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ObjectUI
|
|
3
|
+
* Copyright (c) 2024-present ObjectStack Inc.
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the MIT license found in the
|
|
6
|
+
* LICENSE file in the root directory of this source tree.
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Default English translations for ObjectTimeline. Mirrors the
|
|
10
|
+
* createSafeTranslationHook pattern used by plugin-detail / plugin-list so
|
|
11
|
+
* the timeline keeps working when rendered standalone (Storybook, tests,
|
|
12
|
+
* embed) without an I18nProvider on the React tree.
|
|
13
|
+
*/
|
|
14
|
+
export declare const TIMELINE_DEFAULT_TRANSLATIONS: Record<string, string>;
|
|
15
|
+
declare function fallback(key: string, options?: Record<string, unknown>): string;
|
|
16
|
+
export declare function useTimelineTranslation(): {
|
|
17
|
+
t: typeof fallback;
|
|
18
|
+
} | {
|
|
19
|
+
t: import('i18next').TFunction<string, undefined>;
|
|
20
|
+
};
|
|
21
|
+
export {};
|
|
22
|
+
//# sourceMappingURL=useTimelineTranslation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useTimelineTranslation.d.ts","sourceRoot":"","sources":["../../../../src/useTimelineTranslation.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH;;;;;GAKG;AACH,eAAO,MAAM,6BAA6B,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAchE,CAAC;AAIF,iBAAS,QAAQ,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAQxE;AAED,wBAAgB,sBAAsB;;;;EAWrC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@object-ui/plugin-timeline",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.8",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"description": "Timeline component plugin for Object UI",
|
|
@@ -24,14 +24,14 @@
|
|
|
24
24
|
}
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@objectstack/spec": "^4.0.
|
|
27
|
+
"@objectstack/spec": "^4.0.5",
|
|
28
28
|
"class-variance-authority": "^0.7.1",
|
|
29
29
|
"zod": "^4.4.3",
|
|
30
|
-
"@object-ui/components": "4.0.
|
|
31
|
-
"@object-ui/core": "4.0.
|
|
32
|
-
"@object-ui/mobile": "4.0.
|
|
33
|
-
"@object-ui/react": "4.0.
|
|
34
|
-
"@object-ui/types": "4.0.
|
|
30
|
+
"@object-ui/components": "4.0.8",
|
|
31
|
+
"@object-ui/core": "4.0.8",
|
|
32
|
+
"@object-ui/mobile": "4.0.8",
|
|
33
|
+
"@object-ui/react": "4.0.8",
|
|
34
|
+
"@object-ui/types": "4.0.8"
|
|
35
35
|
},
|
|
36
36
|
"peerDependencies": {
|
|
37
37
|
"react": "^18.0.0 || ^19.0.0",
|
|
@@ -42,9 +42,9 @@
|
|
|
42
42
|
"@types/react-dom": "19.2.3",
|
|
43
43
|
"@vitejs/plugin-react": "^6.0.1",
|
|
44
44
|
"typescript": "^6.0.3",
|
|
45
|
-
"vite": "^8.0.
|
|
45
|
+
"vite": "^8.0.12",
|
|
46
46
|
"vite-plugin-dts": "^5.0.0",
|
|
47
|
-
"@object-ui/data-objectstack": "4.0.
|
|
47
|
+
"@object-ui/data-objectstack": "4.0.8"
|
|
48
48
|
},
|
|
49
49
|
"keywords": [
|
|
50
50
|
"objectui",
|