@object-ui/plugin-timeline 17.6.0 → 18.0.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 +2739 -0
- package/README.md +57 -1
- package/dist/ObjectTimeline.d.ts +72 -9
- package/dist/ObjectTimeline.d.ts.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +641 -398
- package/dist/index.umd.cjs +1 -1
- package/dist/renderHandoff.d.ts +63 -0
- package/dist/renderHandoff.d.ts.map +1 -0
- package/dist/renderer.d.ts +123 -19
- package/dist/renderer.d.ts.map +1 -1
- package/dist/useTimelineTranslation.d.ts.map +1 -1
- package/package.json +14 -11
package/dist/index.js
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import * as e from "react";
|
|
2
|
-
import { useCallback as t, useEffect as n, useMemo as r,
|
|
3
|
-
import { NavigationOverlay as
|
|
4
|
-
import { jsx as
|
|
5
|
-
import { ComponentRegistry as
|
|
6
|
-
import { createSafeTranslation as
|
|
7
|
-
import { ElementDataSourceGate as
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
2
|
+
import { useCallback as t, useEffect as n, useMemo as r, useRef as i, useState as a } from "react";
|
|
3
|
+
import { NavigationOverlay as o, cn as s, cva as c, renderChildren as l } from "@object-ui/components";
|
|
4
|
+
import { jsx as u, jsxs as d } from "react/jsx-runtime";
|
|
5
|
+
import { ComponentRegistry as f, buildExpandFields as p, convertSortToQueryParams as m, createFieldColorResolver as h, elementDataSourceBlock as g, extractRecords as _, isRealCalendarDate as v, recordDisplayValueAt as y, toDateInputValue as b, toDisplayDate as x, toDisplayEndDate as ee, toDomProps as S } from "@object-ui/core";
|
|
6
|
+
import { createSafeTranslation as te, firstDayOfWeek as ne, useDisplayLocale as re, useObjectTranslation as ie } from "@object-ui/i18n";
|
|
7
|
+
import { ElementDataSourceGate as C, useDataInvalidation as ae, useDataScope as oe, useFilterScope as se, useNavigationOverlay as ce, useResolvedFilter as le, useSafeFieldLabel as ue, useSchemaContext as de, useSettledSchema as fe } from "@object-ui/react";
|
|
8
|
+
import { usePermissions as pe } from "@object-ui/permissions";
|
|
9
|
+
import { usePullToRefresh as me } from "@object-ui/mobile";
|
|
10
|
+
import { z as w } from "zod";
|
|
10
11
|
//#region src/useTimelineTranslation.ts
|
|
11
|
-
var
|
|
12
|
-
"timeline.bucket.
|
|
12
|
+
var T = {
|
|
13
|
+
"timeline.bucket.earlier": "Earlier",
|
|
13
14
|
"timeline.bucket.today": "Today",
|
|
14
15
|
"timeline.bucket.tomorrow": "Tomorrow",
|
|
15
16
|
"timeline.bucket.thisWeek": "This week",
|
|
@@ -17,15 +18,15 @@ var y = {
|
|
|
17
18
|
"timeline.bucket.later": "Later",
|
|
18
19
|
"timeline.bucket.noDate": "No date",
|
|
19
20
|
"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
21
|
"timeline.scale.week": "Week {{n}}",
|
|
26
22
|
"timeline.scale.quarter": "Q{{quarter}} {{year}}",
|
|
27
|
-
"timeline.gantt.rowLabel": "Items"
|
|
28
|
-
|
|
23
|
+
"timeline.gantt.rowLabel": "Items",
|
|
24
|
+
"timeline.gantt.unusableRange.malformedDate": "Unusable gantt date range — {{path}} is {{value}}, which is not a valid date. Every gantt date has to parse: the startDate and endDate on every row item, plus any minDate / maxDate pinned on the schema.",
|
|
25
|
+
"timeline.gantt.unusableRange.inverted": "Unusable gantt date range — minDate {{minDate}} is after maxDate {{maxDate}}. A pinned minDate / maxDate overrides the range computed from the rows, so this axis has no columns and no bar can be placed on it; swap the two values.",
|
|
26
|
+
"timeline.gantt.unusableRange.malformedRow": "Unusable gantt rows — {{path}} is {{value}}, which is not a row shape. A gantt draws items as a list of rows, every row as an object with a label and its own items, and every row's items as a list of bars; a null, a number, a string or a plain object in any of those places cannot be drawn.",
|
|
27
|
+
"timeline.unsupported.objectBoundGantt": "Unsupported variant \"gantt\" — an object-bound timeline renders the feed variants ({{variants}}). Gantt needs literal rows, each with its own nested items, so the gantt axis (scale) has no effect here.",
|
|
28
|
+
"timeline.unconfigured.noDateAxis": "Timeline date axis required — this view declares no date field, and an object-bound timeline will not invent one. Declare one of: {{fields}}. The first is the spec spelling; the rest are legacy aliases."
|
|
29
|
+
}, E = "timeline.bucket.today", he = (e, t) => Object.entries(t ?? {}).reduce((e, [t, n]) => e.split(`{{${t}}}`).join(String(n)), T[e] || e), ge = te(T, E), D = /* @__PURE__ */ new Set([
|
|
29
30
|
"hour",
|
|
30
31
|
"day",
|
|
31
32
|
"week",
|
|
@@ -33,242 +34,420 @@ var y = {
|
|
|
33
34
|
"quarter",
|
|
34
35
|
"year"
|
|
35
36
|
]);
|
|
36
|
-
function
|
|
37
|
-
let t = e.scale
|
|
38
|
-
return typeof t == "string" &&
|
|
37
|
+
function O(e) {
|
|
38
|
+
let t = e.scale;
|
|
39
|
+
return typeof t == "string" && D.has(t) ? t : "month";
|
|
39
40
|
}
|
|
40
|
-
function
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
41
|
+
function k(e) {
|
|
42
|
+
return typeof e == "string" ? x(e) : new Date(e);
|
|
43
|
+
}
|
|
44
|
+
function A(e) {
|
|
45
|
+
let t = new Date(e);
|
|
46
|
+
return t.setHours(0, 0, 0, 0), t;
|
|
47
|
+
}
|
|
48
|
+
var _e = 36e5, ve = {
|
|
49
|
+
floor: (e) => {
|
|
50
|
+
let t = new Date(e);
|
|
51
|
+
return t.setMinutes(0, 0, 0), t;
|
|
52
|
+
},
|
|
53
|
+
step: (e) => {
|
|
54
|
+
e.setTime(e.getTime() + _e);
|
|
55
|
+
},
|
|
56
|
+
label: (e, t, n) => e.toLocaleString(n, {
|
|
57
|
+
month: "short",
|
|
58
|
+
day: "numeric",
|
|
59
|
+
hour: "numeric"
|
|
60
|
+
})
|
|
61
|
+
}, ye = {
|
|
62
|
+
floor: A,
|
|
63
|
+
step: (e) => {
|
|
64
|
+
e.setDate(e.getDate() + 1);
|
|
65
|
+
},
|
|
66
|
+
label: (e, t, n) => e.toLocaleDateString(n, {
|
|
67
|
+
month: "short",
|
|
68
|
+
day: "numeric"
|
|
69
|
+
})
|
|
70
|
+
}, be = {
|
|
71
|
+
floor: A,
|
|
72
|
+
step: (e) => {
|
|
73
|
+
e.setDate(e.getDate() + 7);
|
|
74
|
+
},
|
|
75
|
+
label: (e, t, n, r) => r("timeline.scale.week", { n: t + 1 })
|
|
76
|
+
}, j = {
|
|
77
|
+
floor: (e) => {
|
|
78
|
+
let t = A(e);
|
|
79
|
+
return t.setDate(1), t;
|
|
80
|
+
},
|
|
81
|
+
step: (e) => {
|
|
82
|
+
e.setMonth(e.getMonth() + 1);
|
|
83
|
+
},
|
|
84
|
+
label: (e, t, n) => e.toLocaleDateString(n, {
|
|
85
|
+
month: "short",
|
|
86
|
+
year: "numeric"
|
|
87
|
+
})
|
|
88
|
+
}, M = {
|
|
89
|
+
floor: (e) => {
|
|
90
|
+
let t = A(e);
|
|
91
|
+
return t.setMonth(Math.floor(t.getMonth() / 3) * 3, 1), t;
|
|
92
|
+
},
|
|
93
|
+
step: (e) => {
|
|
94
|
+
e.setMonth(e.getMonth() + 3);
|
|
95
|
+
},
|
|
96
|
+
label: (e, t, n, r) => r("timeline.scale.quarter", {
|
|
97
|
+
quarter: Math.floor(e.getMonth() / 3) + 1,
|
|
98
|
+
year: e.getFullYear()
|
|
99
|
+
})
|
|
100
|
+
}, N = {
|
|
101
|
+
floor: (e) => {
|
|
102
|
+
let t = A(e);
|
|
103
|
+
return t.setMonth(0, 1), t;
|
|
104
|
+
},
|
|
105
|
+
step: (e) => {
|
|
106
|
+
e.setFullYear(e.getFullYear() + 1);
|
|
107
|
+
},
|
|
108
|
+
label: (e) => String(e.getFullYear())
|
|
109
|
+
};
|
|
110
|
+
function xe(e) {
|
|
44
111
|
switch (e) {
|
|
45
|
-
case "hour":
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
})), c.setMonth(c.getMonth() + 3);
|
|
68
|
-
break;
|
|
69
|
-
case "year":
|
|
70
|
-
for (c.setMonth(0, 1); c <= s;) a.push(String(c.getFullYear())), c.setFullYear(c.getFullYear() + 1);
|
|
71
|
-
break;
|
|
72
|
-
default: for (; c <= s;) a.push(c.toLocaleDateString(r, {
|
|
73
|
-
month: "short",
|
|
74
|
-
year: "numeric"
|
|
75
|
-
})), c.setMonth(c.getMonth() + 1);
|
|
112
|
+
case "hour": return ve;
|
|
113
|
+
case "day": return ye;
|
|
114
|
+
case "week": return be;
|
|
115
|
+
case "quarter": return M;
|
|
116
|
+
case "year": return N;
|
|
117
|
+
default: return j;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
function P(e) {
|
|
121
|
+
return typeof e == "string" ? ee(e) : k(e);
|
|
122
|
+
}
|
|
123
|
+
function F(e, t, n, r, i, a) {
|
|
124
|
+
let o = k(t).getTime(), s = k(n).getTime();
|
|
125
|
+
if (Number.isNaN(o) || Number.isNaN(s) || o > s) return;
|
|
126
|
+
let c = a === void 0 ? s : Math.max(s, a), l = xe(e), u = [], d = l.floor(new Date(o));
|
|
127
|
+
for (; d.getTime() <= c;) {
|
|
128
|
+
let e = d.getTime(), t = l.label(new Date(e), u.length, r, i);
|
|
129
|
+
l.step(d), u.push({
|
|
130
|
+
start: e,
|
|
131
|
+
end: d.getTime(),
|
|
132
|
+
label: t
|
|
133
|
+
});
|
|
76
134
|
}
|
|
77
|
-
return
|
|
135
|
+
return {
|
|
136
|
+
start: u[0].start,
|
|
137
|
+
end: u[u.length - 1].end,
|
|
138
|
+
units: u
|
|
139
|
+
};
|
|
78
140
|
}
|
|
79
|
-
function
|
|
80
|
-
let
|
|
141
|
+
function I(e, t, n) {
|
|
142
|
+
let r = e.end - e.start;
|
|
143
|
+
return {
|
|
144
|
+
start: (t - e.start) / r * 100,
|
|
145
|
+
width: (n - t) / r * 100
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
function Se(e, t, n, r = "en", i = he) {
|
|
149
|
+
let a = F(e, t, n, r, i);
|
|
150
|
+
return a ? a.units.map((e) => e.label) : [];
|
|
151
|
+
}
|
|
152
|
+
function L() {
|
|
153
|
+
let e = b(/* @__PURE__ */ new Date());
|
|
154
|
+
return {
|
|
155
|
+
minDate: e,
|
|
156
|
+
maxDate: e
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
function R(e) {
|
|
160
|
+
if (!Array.isArray(e)) return {
|
|
161
|
+
ok: !1,
|
|
162
|
+
path: "items",
|
|
163
|
+
value: e
|
|
164
|
+
};
|
|
165
|
+
let t = [];
|
|
166
|
+
for (let n = 0; n < e.length; n++) {
|
|
167
|
+
let r = e[n];
|
|
168
|
+
if (typeof r != "object" || !r || Array.isArray(r)) return {
|
|
169
|
+
ok: !1,
|
|
170
|
+
path: `items[${n}]`,
|
|
171
|
+
value: r
|
|
172
|
+
};
|
|
173
|
+
let i = r.items;
|
|
174
|
+
if (i && !Array.isArray(i)) return {
|
|
175
|
+
ok: !1,
|
|
176
|
+
path: `items[${n}].items`,
|
|
177
|
+
value: i
|
|
178
|
+
};
|
|
179
|
+
t.push({
|
|
180
|
+
authored: r,
|
|
181
|
+
label: r.label,
|
|
182
|
+
items: i || []
|
|
183
|
+
});
|
|
184
|
+
}
|
|
81
185
|
return {
|
|
82
|
-
|
|
83
|
-
|
|
186
|
+
ok: !0,
|
|
187
|
+
rows: t
|
|
84
188
|
};
|
|
85
189
|
}
|
|
86
|
-
function
|
|
87
|
-
let
|
|
190
|
+
function z(e) {
|
|
191
|
+
let t = e.flatMap((e) => e.items.flatMap((e) => [e.startDate, e.endDate]));
|
|
192
|
+
if (t.length === 0) return L();
|
|
193
|
+
let n = Math.min(...t.map((e) => k(e).getTime())), r = Math.max(...t.map((e) => k(e).getTime())), i = Math.max(...e.flatMap((e) => e.items.map((e) => {
|
|
194
|
+
let t = k(e.startDate).getTime(), n = P(e.endDate).getTime();
|
|
195
|
+
return n > t ? n - 1 : t;
|
|
196
|
+
})));
|
|
88
197
|
return {
|
|
89
|
-
|
|
90
|
-
|
|
198
|
+
minDate: b(new Date(n)),
|
|
199
|
+
maxDate: b(new Date(r)),
|
|
200
|
+
through: i
|
|
91
201
|
};
|
|
92
202
|
}
|
|
93
|
-
|
|
94
|
-
|
|
203
|
+
var B = (e) => {
|
|
204
|
+
try {
|
|
205
|
+
return Date.prototype.getTime.call(e), !0;
|
|
206
|
+
} catch {
|
|
207
|
+
return !1;
|
|
208
|
+
}
|
|
209
|
+
};
|
|
210
|
+
function V(e) {
|
|
211
|
+
return typeof e == "string" ? JSON.stringify(e) : e === void 0 ? "undefined" : e === null ? "null" : typeof e == "symbol" ? e.toString() : typeof e == "bigint" ? `${e}n` : typeof e == "number" || typeof e == "boolean" ? String(e) : B(e) ? Date.prototype.toString.call(e) : Array.isArray(e) ? "an array" : typeof e == "function" ? "a function" : "an object";
|
|
212
|
+
}
|
|
213
|
+
var Ce = (e) => typeof e == "string" || typeof e == "number" && Number.isFinite(e) || B(e);
|
|
214
|
+
function we(e, t, n) {
|
|
215
|
+
let r = (e) => !Ce(e) || Number.isNaN(k(e).getTime());
|
|
216
|
+
for (let t = 0; t < e.length; t++) {
|
|
217
|
+
let n = e[t].items;
|
|
218
|
+
for (let e = 0; e < n.length; e++) for (let i of ["startDate", "endDate"]) {
|
|
219
|
+
let a = n[e]?.[i];
|
|
220
|
+
if (r(a)) return {
|
|
221
|
+
path: `items[${t}].items[${e}].${i}`,
|
|
222
|
+
value: a
|
|
223
|
+
};
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
for (let [e, i] of [["minDate", t], ["maxDate", n]]) if (i && r(i)) return {
|
|
227
|
+
path: e,
|
|
228
|
+
value: i
|
|
229
|
+
};
|
|
230
|
+
}
|
|
231
|
+
function H(e, t, n) {
|
|
232
|
+
return I(n, k(e).getTime(), P(t).getTime());
|
|
233
|
+
}
|
|
234
|
+
function U(e, t, n) {
|
|
235
|
+
let r = x(e);
|
|
95
236
|
return t === "short" ? r.toLocaleDateString(n) : t === "long" ? r.toLocaleDateString(n, {
|
|
96
237
|
year: "numeric",
|
|
97
238
|
month: "long",
|
|
98
239
|
day: "numeric"
|
|
99
|
-
}) : r.toISOString().split("T")[0];
|
|
240
|
+
}) : Number.isNaN(r.getTime()) ? String(e) : v(e) ? b(r) : r.toISOString().split("T")[0];
|
|
100
241
|
}
|
|
101
|
-
function
|
|
242
|
+
function W({ label: e, color: t }) {
|
|
102
243
|
let n = t ? {
|
|
103
244
|
backgroundColor: `${t}22`,
|
|
104
245
|
color: t,
|
|
105
246
|
borderColor: `${t}55`
|
|
106
247
|
} : void 0;
|
|
107
|
-
return /* @__PURE__ */
|
|
108
|
-
className:
|
|
248
|
+
return /* @__PURE__ */ u("span", {
|
|
249
|
+
className: s("inline-flex items-center rounded-full border px-2 py-0.5 text-xs font-medium", !t && "bg-muted text-muted-foreground border-transparent"),
|
|
109
250
|
style: n,
|
|
110
251
|
children: e
|
|
111
252
|
});
|
|
112
253
|
}
|
|
113
|
-
function
|
|
114
|
-
let t = [];
|
|
115
|
-
for (let
|
|
116
|
-
let e =
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
254
|
+
function Te(e) {
|
|
255
|
+
let t = [], n = /* @__PURE__ */ new Map();
|
|
256
|
+
for (let r of e) {
|
|
257
|
+
let e = r.group == null ? "" : String(r.group), i = n.get(e);
|
|
258
|
+
if (i) i.items.push(r);
|
|
259
|
+
else {
|
|
260
|
+
let i = {
|
|
261
|
+
key: e,
|
|
262
|
+
items: [r]
|
|
263
|
+
};
|
|
264
|
+
n.set(e, i), t.push(i);
|
|
265
|
+
}
|
|
121
266
|
}
|
|
122
267
|
return t;
|
|
123
268
|
}
|
|
124
|
-
var
|
|
125
|
-
let { variant:
|
|
126
|
-
if (
|
|
127
|
-
let e =
|
|
269
|
+
var Ee = ({ schema: e, className: t, style: n, ...r }) => {
|
|
270
|
+
let { variant: i = "vertical", items: a = [], dateFormat: o = "short", onItemClick: c } = e, f = re(), { t: p } = ge();
|
|
271
|
+
if (i === "vertical") {
|
|
272
|
+
let e = Te(a), i = e.some((e) => e.key !== ""), p = (e, t) => {
|
|
128
273
|
let n = e.color ? {
|
|
129
274
|
backgroundColor: `${e.color}33`,
|
|
130
275
|
borderColor: e.color
|
|
131
|
-
} : void 0, r = e.time ?
|
|
132
|
-
return /* @__PURE__ */
|
|
276
|
+
} : void 0, r = e.time ? U(e.time, o, f) : e.startDate ? U(e.startDate, o, f) : "", i = e.endDate && e.endDate !== e.startDate ? U(e.endDate, o, f) : "", a = Array.isArray(e.meta) ? e.meta : [];
|
|
277
|
+
return /* @__PURE__ */ d(Ie, {
|
|
133
278
|
density: "compact",
|
|
134
|
-
className:
|
|
135
|
-
onClick: () =>
|
|
136
|
-
children: [/* @__PURE__ */
|
|
279
|
+
className: s(e.className, c && "cursor-pointer"),
|
|
280
|
+
onClick: () => c?.(e),
|
|
281
|
+
children: [/* @__PURE__ */ u(K, {
|
|
137
282
|
variant: e.color ? "default" : e.variant || "default",
|
|
138
283
|
style: n,
|
|
139
|
-
children: e.icon && /* @__PURE__ */
|
|
284
|
+
children: e.icon && /* @__PURE__ */ u("span", {
|
|
140
285
|
className: "text-xs",
|
|
141
286
|
children: e.icon
|
|
142
287
|
})
|
|
143
|
-
}), /* @__PURE__ */
|
|
144
|
-
(r || i) && /* @__PURE__ */
|
|
288
|
+
}), /* @__PURE__ */ d(Re, { children: [
|
|
289
|
+
(r || i) && /* @__PURE__ */ d(J, {
|
|
145
290
|
dateTime: e.time || e.startDate,
|
|
146
291
|
className: "!mb-1 text-xs",
|
|
147
|
-
children: [r, i && /* @__PURE__ */
|
|
292
|
+
children: [r, i && /* @__PURE__ */ d("span", {
|
|
148
293
|
className: "text-muted-foreground/70",
|
|
149
294
|
children: [" → ", i]
|
|
150
295
|
})]
|
|
151
296
|
}),
|
|
152
|
-
e.title && /* @__PURE__ */
|
|
297
|
+
e.title && /* @__PURE__ */ u(q, {
|
|
153
298
|
className: "text-sm sm:text-base mb-1",
|
|
154
299
|
children: e.title
|
|
155
300
|
}),
|
|
156
|
-
|
|
301
|
+
a.length > 0 && /* @__PURE__ */ u("div", {
|
|
157
302
|
className: "flex flex-wrap gap-1.5 mt-1 mb-1",
|
|
158
|
-
children:
|
|
303
|
+
children: a.map((e) => /* @__PURE__ */ u(W, {
|
|
159
304
|
label: e.label,
|
|
160
305
|
color: e.color
|
|
161
306
|
}, e.key))
|
|
162
307
|
}),
|
|
163
|
-
e.description && /* @__PURE__ */
|
|
308
|
+
e.description && /* @__PURE__ */ u(Y, {
|
|
164
309
|
className: "text-sm text-muted-foreground line-clamp-2 sm:line-clamp-none",
|
|
165
310
|
children: e.description
|
|
166
311
|
}),
|
|
167
|
-
|
|
312
|
+
l(e.content)
|
|
168
313
|
] })]
|
|
169
314
|
}, t);
|
|
170
315
|
};
|
|
171
|
-
return
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
316
|
+
return i ? /* @__PURE__ */ u("div", {
|
|
317
|
+
...S(r),
|
|
318
|
+
className: s("px-4 sm:px-6 py-2", t),
|
|
319
|
+
style: n,
|
|
320
|
+
children: e.map((e, t) => /* @__PURE__ */ d("section", {
|
|
175
321
|
className: "mb-4",
|
|
176
|
-
children: [/* @__PURE__ */
|
|
322
|
+
children: [/* @__PURE__ */ d("header", {
|
|
177
323
|
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",
|
|
178
|
-
children: [/* @__PURE__ */
|
|
324
|
+
children: [/* @__PURE__ */ u("span", { children: e.key }), /* @__PURE__ */ u("span", {
|
|
179
325
|
className: "ml-2 text-muted-foreground/60 font-normal normal-case",
|
|
180
326
|
children: e.items.length
|
|
181
327
|
})]
|
|
182
|
-
}), /* @__PURE__ */
|
|
328
|
+
}), /* @__PURE__ */ u(G, {
|
|
183
329
|
className: "mt-3",
|
|
184
|
-
children: e.items.map((e, n) =>
|
|
330
|
+
children: e.items.map((e, n) => p(e, `${t}-${n}`))
|
|
185
331
|
})]
|
|
186
332
|
}, `${e.key}-${t}`))
|
|
187
|
-
}) : /* @__PURE__ */
|
|
333
|
+
}) : /* @__PURE__ */ u(G, {
|
|
334
|
+
...S(r),
|
|
188
335
|
className: t,
|
|
189
|
-
|
|
190
|
-
children:
|
|
336
|
+
style: n,
|
|
337
|
+
children: a.map((e, t) => p(e, t))
|
|
191
338
|
});
|
|
192
339
|
}
|
|
193
|
-
if (
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
340
|
+
if (i === "horizontal") return /* @__PURE__ */ u(ze, {
|
|
341
|
+
...S(r),
|
|
342
|
+
className: s("overflow-x-auto [-webkit-overflow-scrolling:touch]", t),
|
|
343
|
+
style: n,
|
|
344
|
+
children: a.map((e, t) => /* @__PURE__ */ d(Be, {
|
|
345
|
+
className: s(e.className, c && "cursor-pointer"),
|
|
346
|
+
onClick: () => c?.(e),
|
|
347
|
+
children: [/* @__PURE__ */ d("div", {
|
|
200
348
|
className: "flex flex-col items-center",
|
|
201
|
-
children: [/* @__PURE__ */
|
|
349
|
+
children: [/* @__PURE__ */ u(K, {
|
|
202
350
|
variant: e.variant || "default",
|
|
203
|
-
children: e.icon && /* @__PURE__ */
|
|
351
|
+
children: e.icon && /* @__PURE__ */ u("span", {
|
|
204
352
|
className: "text-xs",
|
|
205
353
|
children: e.icon
|
|
206
354
|
})
|
|
207
|
-
}), /* @__PURE__ */
|
|
355
|
+
}), /* @__PURE__ */ d("div", {
|
|
208
356
|
className: "mt-4 text-center",
|
|
209
357
|
children: [
|
|
210
|
-
e.time && /* @__PURE__ */
|
|
358
|
+
e.time && /* @__PURE__ */ u(J, {
|
|
211
359
|
dateTime: e.time,
|
|
212
|
-
children:
|
|
360
|
+
children: U(e.time, o, f)
|
|
213
361
|
}),
|
|
214
|
-
e.title && /* @__PURE__ */
|
|
215
|
-
e.description && /* @__PURE__ */
|
|
362
|
+
e.title && /* @__PURE__ */ u(q, { children: e.title }),
|
|
363
|
+
e.description && /* @__PURE__ */ u(Y, {
|
|
216
364
|
className: "text-center line-clamp-2 sm:line-clamp-none",
|
|
217
365
|
children: e.description
|
|
218
366
|
}),
|
|
219
|
-
|
|
367
|
+
l(e.content)
|
|
220
368
|
]
|
|
221
369
|
})]
|
|
222
|
-
}), t <
|
|
370
|
+
}), t < a.length - 1 && /* @__PURE__ */ u("div", { className: "absolute left-full w-16 border-t-2 border-gray-200 top-3" })]
|
|
223
371
|
}, t))
|
|
224
372
|
});
|
|
225
|
-
if (
|
|
226
|
-
let
|
|
227
|
-
return /* @__PURE__ */ u(
|
|
228
|
-
className:
|
|
229
|
-
|
|
230
|
-
|
|
373
|
+
if (i === "gantt") {
|
|
374
|
+
let i = R(a);
|
|
375
|
+
if (!i.ok) return /* @__PURE__ */ u("div", {
|
|
376
|
+
className: "p-4 text-destructive",
|
|
377
|
+
"data-testid": "timeline-unusable-date-range",
|
|
378
|
+
role: "alert",
|
|
379
|
+
children: p("timeline.gantt.unusableRange.malformedRow", {
|
|
380
|
+
path: i.path,
|
|
381
|
+
value: V(i.value)
|
|
382
|
+
})
|
|
383
|
+
});
|
|
384
|
+
let l = i.rows, m = we(l, e.minDate, e.maxDate);
|
|
385
|
+
if (m) return /* @__PURE__ */ u("div", {
|
|
386
|
+
className: "p-4 text-destructive",
|
|
387
|
+
"data-testid": "timeline-unusable-date-range",
|
|
388
|
+
role: "alert",
|
|
389
|
+
children: p("timeline.gantt.unusableRange.malformedDate", {
|
|
390
|
+
path: m.path,
|
|
391
|
+
value: V(m.value)
|
|
392
|
+
})
|
|
393
|
+
});
|
|
394
|
+
let h = z(l), g = e.minDate || h.minDate, _ = e.maxDate || h.maxDate, v = F(O(e), g, _, f, p, e.maxDate ? void 0 : h.through);
|
|
395
|
+
return v ? /* @__PURE__ */ d(Ve, {
|
|
396
|
+
...S(r),
|
|
397
|
+
className: s("overflow-x-auto [-webkit-overflow-scrolling:touch]", t),
|
|
398
|
+
style: n,
|
|
399
|
+
children: [/* @__PURE__ */ d(He, { children: [/* @__PURE__ */ u(X, {
|
|
231
400
|
className: "flex items-center px-2 sm:px-4 py-2 sm:py-3",
|
|
232
|
-
children: /* @__PURE__ */
|
|
401
|
+
children: /* @__PURE__ */ u("span", {
|
|
233
402
|
className: "font-semibold text-xs sm:text-sm",
|
|
234
|
-
children: e.rowLabel ||
|
|
403
|
+
children: e.rowLabel || p("timeline.gantt.rowLabel")
|
|
235
404
|
})
|
|
236
|
-
}), /* @__PURE__ */
|
|
405
|
+
}), /* @__PURE__ */ u(Z, { children: /* @__PURE__ */ u("div", {
|
|
237
406
|
className: "flex h-full",
|
|
238
|
-
children:
|
|
239
|
-
className: "
|
|
240
|
-
|
|
407
|
+
children: v.units.map((e, t) => /* @__PURE__ */ u("div", {
|
|
408
|
+
className: "shrink-0 min-w-0 overflow-hidden px-1 sm:px-2 py-2 sm:py-3 border-r text-xs font-medium text-center",
|
|
409
|
+
style: { width: `${I(v, e.start, e.end).width}%` },
|
|
410
|
+
children: e.label
|
|
241
411
|
}, t))
|
|
242
|
-
}) })] }), /* @__PURE__ */
|
|
412
|
+
}) })] }), /* @__PURE__ */ u("div", { children: /* @__PURE__ */ d("div", {
|
|
243
413
|
className: "flex",
|
|
244
|
-
children: [/* @__PURE__ */
|
|
414
|
+
children: [/* @__PURE__ */ u(X, { children: l.map((e, t) => /* @__PURE__ */ u(Q, { children: /* @__PURE__ */ u(Ue, {
|
|
245
415
|
title: e.label,
|
|
246
416
|
className: "truncate",
|
|
247
417
|
children: e.label
|
|
248
|
-
}) }, t)) }), /* @__PURE__ */
|
|
418
|
+
}) }, t)) }), /* @__PURE__ */ u(Z, {
|
|
249
419
|
className: "relative",
|
|
250
|
-
children:
|
|
420
|
+
children: l.map((e, t) => /* @__PURE__ */ u(Q, {
|
|
251
421
|
className: "relative",
|
|
252
|
-
children:
|
|
253
|
-
let i =
|
|
254
|
-
return /* @__PURE__ */
|
|
422
|
+
children: e.items.map((n, r) => {
|
|
423
|
+
let i = H(n.startDate, n.endDate, v);
|
|
424
|
+
return /* @__PURE__ */ u(We, {
|
|
255
425
|
start: i.start,
|
|
256
426
|
width: i.width,
|
|
257
427
|
variant: n.variant || "default",
|
|
258
|
-
onClick: () =>
|
|
259
|
-
title: `${n.title || ""}\n${
|
|
260
|
-
children: /* @__PURE__ */
|
|
428
|
+
onClick: () => c?.(n, e.authored, t, r),
|
|
429
|
+
title: `${n.title || ""}\n${U(n.startDate, o, f)} - ${U(n.endDate, o, f)}`,
|
|
430
|
+
children: /* @__PURE__ */ u(Ge, { children: n.title })
|
|
261
431
|
}, r);
|
|
262
432
|
})
|
|
263
433
|
}, t))
|
|
264
434
|
})]
|
|
265
435
|
}) })]
|
|
436
|
+
}) : /* @__PURE__ */ u("div", {
|
|
437
|
+
className: "p-4 text-destructive",
|
|
438
|
+
"data-testid": "timeline-unusable-date-range",
|
|
439
|
+
role: "alert",
|
|
440
|
+
children: p("timeline.gantt.unusableRange.inverted", {
|
|
441
|
+
minDate: V(g),
|
|
442
|
+
maxDate: V(_)
|
|
443
|
+
})
|
|
266
444
|
});
|
|
267
445
|
}
|
|
268
446
|
return null;
|
|
269
447
|
};
|
|
270
|
-
|
|
448
|
+
f.register("timeline", Ee, {
|
|
271
449
|
namespace: "plugin-timeline",
|
|
450
|
+
skipFallback: !0,
|
|
272
451
|
label: "Timeline",
|
|
273
452
|
category: "data-display",
|
|
274
453
|
inputs: [
|
|
@@ -279,14 +458,11 @@ d.register("timeline", j, {
|
|
|
279
458
|
"vertical",
|
|
280
459
|
"horizontal",
|
|
281
460
|
"gantt"
|
|
282
|
-
]
|
|
283
|
-
label: "Timeline Variant",
|
|
284
|
-
defaultValue: "vertical"
|
|
461
|
+
]
|
|
285
462
|
},
|
|
286
463
|
{
|
|
287
464
|
name: "items",
|
|
288
465
|
type: "array",
|
|
289
|
-
label: "Timeline Items",
|
|
290
466
|
description: "For vertical/horizontal: Array of { time, title, description, variant, icon, content }. For gantt: Array of { label, items: [{ title, startDate, endDate, variant }] }"
|
|
291
467
|
},
|
|
292
468
|
{
|
|
@@ -296,43 +472,30 @@ d.register("timeline", j, {
|
|
|
296
472
|
"short",
|
|
297
473
|
"long",
|
|
298
474
|
"iso"
|
|
299
|
-
]
|
|
300
|
-
label: "Date Format",
|
|
301
|
-
defaultValue: "short"
|
|
475
|
+
]
|
|
302
476
|
},
|
|
303
477
|
{
|
|
304
|
-
name: "
|
|
478
|
+
name: "scale",
|
|
305
479
|
type: "enum",
|
|
306
|
-
enum: [
|
|
307
|
-
"day",
|
|
308
|
-
"week",
|
|
309
|
-
"month"
|
|
310
|
-
],
|
|
311
|
-
label: "Time Scale (Gantt only)",
|
|
312
|
-
defaultValue: "month"
|
|
480
|
+
enum: [...D]
|
|
313
481
|
},
|
|
314
482
|
{
|
|
315
483
|
name: "rowLabel",
|
|
316
|
-
type: "string"
|
|
317
|
-
label: "Row Label (Gantt only)",
|
|
318
|
-
defaultValue: "Items"
|
|
484
|
+
type: "string"
|
|
319
485
|
},
|
|
320
486
|
{
|
|
321
487
|
name: "minDate",
|
|
322
488
|
type: "string",
|
|
323
|
-
label: "Min Date (Gantt only)",
|
|
324
489
|
description: "Override auto-calculated min date (YYYY-MM-DD)"
|
|
325
490
|
},
|
|
326
491
|
{
|
|
327
492
|
name: "maxDate",
|
|
328
493
|
type: "string",
|
|
329
|
-
label: "Max Date (Gantt only)",
|
|
330
494
|
description: "Override auto-calculated max date (YYYY-MM-DD)"
|
|
331
495
|
},
|
|
332
496
|
{
|
|
333
497
|
name: "className",
|
|
334
|
-
type: "string"
|
|
335
|
-
label: "CSS Class"
|
|
498
|
+
type: "string"
|
|
336
499
|
}
|
|
337
500
|
],
|
|
338
501
|
defaultProps: {
|
|
@@ -418,7 +581,7 @@ d.register("timeline", j, {
|
|
|
418
581
|
gantt: {
|
|
419
582
|
variant: "gantt",
|
|
420
583
|
dateFormat: "short",
|
|
421
|
-
|
|
584
|
+
scale: "month",
|
|
422
585
|
rowLabel: "Projects",
|
|
423
586
|
items: [
|
|
424
587
|
{
|
|
@@ -462,22 +625,36 @@ d.register("timeline", j, {
|
|
|
462
625
|
}
|
|
463
626
|
}
|
|
464
627
|
});
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
}
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
startDateField
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
628
|
+
function De(e) {
|
|
629
|
+
return typeof e == "number" && Number.isInteger(e) && e > 0;
|
|
630
|
+
}
|
|
631
|
+
function Oe(e, t) {
|
|
632
|
+
return De(e) ? e : t;
|
|
633
|
+
}
|
|
634
|
+
function ke(e, t) {
|
|
635
|
+
return e == null || De(e) ? null : `[ObjectUI] ObjectTimeline row cap: ${typeof t == "string" && t ? `object-timeline on ${t}` : "object-timeline"} declared limit: ${String(e)}, which is not a positive integer. A row cap must be a positive integer (the spec refuses zero and negative values), so it was ignored and this timeline fell back to its default row cap (100).`;
|
|
636
|
+
}
|
|
637
|
+
var Ae = ["vertical", "horizontal"], je = [
|
|
638
|
+
"timeline.startDateField",
|
|
639
|
+
"mapping.date",
|
|
640
|
+
"startDateField",
|
|
641
|
+
"dateField"
|
|
642
|
+
], Me = w.object({
|
|
643
|
+
title: w.string().optional(),
|
|
644
|
+
date: w.string().optional(),
|
|
645
|
+
description: w.string().optional(),
|
|
646
|
+
variant: w.string().optional()
|
|
647
|
+
}), Ne = w.object({
|
|
648
|
+
mapping: Me.optional(),
|
|
649
|
+
objectName: w.string().optional(),
|
|
650
|
+
titleField: w.string().optional(),
|
|
651
|
+
dateField: w.string().optional(),
|
|
652
|
+
startDateField: w.string().optional(),
|
|
653
|
+
endDateField: w.string().optional(),
|
|
654
|
+
descriptionField: w.string().optional(),
|
|
655
|
+
groupByField: w.string().optional(),
|
|
656
|
+
colorField: w.string().optional(),
|
|
657
|
+
scale: w.enum([
|
|
481
658
|
"hour",
|
|
482
659
|
"day",
|
|
483
660
|
"week",
|
|
@@ -485,174 +662,182 @@ var M = v.object({
|
|
|
485
662
|
"quarter",
|
|
486
663
|
"year"
|
|
487
664
|
]).optional()
|
|
488
|
-
}),
|
|
489
|
-
let [
|
|
490
|
-
let t = Array.isArray(e.items) && e.items.length > 0, n = Array.isArray(
|
|
665
|
+
}), Pe = ({ schema: e, dataSource: s, className: c, onRowClick: l, onItemClick: f, ...g }) => {
|
|
666
|
+
let [v, b] = a([]), [ee, S] = a(() => {
|
|
667
|
+
let t = Array.isArray(e.items) && e.items.length > 0, n = Array.isArray(g.data) && g.data.length > 0;
|
|
491
668
|
return !t && !n && !!e.objectName;
|
|
492
|
-
}), [
|
|
669
|
+
}), [te, ie] = a(null), C = i(0), [de, w] = a(0), T = e.timeline;
|
|
493
670
|
n(() => {
|
|
494
|
-
let t =
|
|
671
|
+
let t = Ne.safeParse(e);
|
|
495
672
|
t.success || console.warn("[ObjectTimeline] Invalid timeline configuration:", t.error.format());
|
|
496
|
-
}, [e])
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
if (!(!o || typeof o.getObjectSchema != "function" || !e.objectName)) try {
|
|
502
|
-
let n = await o.getObjectSchema(e.objectName);
|
|
503
|
-
t && T(n);
|
|
504
|
-
} catch (e) {
|
|
505
|
-
console.warn("Failed to fetch object def for ObjectTimeline", e);
|
|
506
|
-
}
|
|
507
|
-
})(), () => {
|
|
508
|
-
t = !1;
|
|
509
|
-
};
|
|
510
|
-
}, [e.objectName, o]);
|
|
511
|
-
let O = JSON.stringify(e.filter ?? null), k = JSON.stringify(e.sort ?? null);
|
|
673
|
+
}, [e]), n(() => {
|
|
674
|
+
let t = ke(e.limit, e.objectName);
|
|
675
|
+
t && console.warn(t);
|
|
676
|
+
}, [e.limit, e.objectName]);
|
|
677
|
+
let E = oe(e.bind), { ready: he, def: D } = fe(e.objectName ?? "", s), O = pe(), k = se(), A = le(e.filter, k), _e = JSON.stringify(A ?? null), ve = JSON.stringify(e.sort ?? null), ye = !!e.objectName && !E && !e.items && !g.data, be = ae(ye ? e.objectName : void 0);
|
|
512
678
|
n(() => {
|
|
513
|
-
|
|
514
|
-
if (!
|
|
515
|
-
|
|
679
|
+
let t = ++C.current, n = () => C.current === t, r = async () => {
|
|
680
|
+
if (!s || typeof s.find != "function" || !e.objectName) {
|
|
681
|
+
S(!1);
|
|
516
682
|
return;
|
|
517
683
|
}
|
|
518
|
-
|
|
684
|
+
S(!0);
|
|
519
685
|
try {
|
|
520
|
-
let t =
|
|
521
|
-
$filter:
|
|
522
|
-
$orderby:
|
|
523
|
-
$top: e.limit
|
|
524
|
-
...
|
|
525
|
-
}),
|
|
526
|
-
|
|
686
|
+
let t = p(D?.fields), r = O?.isLoaded ? t.filter((t) => O.checkField(e.objectName, t, "read")) : t, i = await s.find(e.objectName, {
|
|
687
|
+
$filter: A,
|
|
688
|
+
$orderby: m(e.sort),
|
|
689
|
+
$top: Oe(e.limit, 100),
|
|
690
|
+
...r.length > 0 ? { $expand: r } : {}
|
|
691
|
+
}), a = _(i);
|
|
692
|
+
n() && (b(a), ie(null));
|
|
527
693
|
} catch (e) {
|
|
528
|
-
console.error(e),
|
|
694
|
+
console.error(e), n() && ie(e);
|
|
529
695
|
} finally {
|
|
530
|
-
|
|
696
|
+
n() && S(!1);
|
|
531
697
|
}
|
|
532
|
-
}
|
|
698
|
+
};
|
|
699
|
+
if (ye) {
|
|
700
|
+
if (!he) return;
|
|
701
|
+
r();
|
|
702
|
+
} else S(!1);
|
|
533
703
|
}, [
|
|
534
704
|
e.objectName,
|
|
535
|
-
|
|
536
|
-
|
|
705
|
+
s,
|
|
706
|
+
E,
|
|
537
707
|
e.items,
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
708
|
+
g.data,
|
|
709
|
+
de,
|
|
710
|
+
he,
|
|
711
|
+
D,
|
|
712
|
+
_e,
|
|
713
|
+
ve,
|
|
714
|
+
e.limit,
|
|
541
715
|
O,
|
|
542
|
-
|
|
543
|
-
e.limit
|
|
716
|
+
be
|
|
544
717
|
]);
|
|
545
|
-
let
|
|
718
|
+
let j = g.data || E || v, { t: M } = ge(), { fieldOptionLabel: N } = ue(), xe = re(), P = T?.titleField ?? e.mapping?.title ?? e.titleField ?? "name", F = T?.startDateField ?? e.mapping?.date ?? e.startDateField ?? e.dateField, I = T?.endDateField ?? e.endDateField ?? F, Se = e.mapping?.description ?? e.descriptionField ?? "description", L = e.mapping?.variant ?? "variant", R = T?.groupByField ?? e.groupByField, z = T?.colorField ?? e.colorField, B = r(() => {
|
|
546
719
|
if (e.items) return e.items;
|
|
547
|
-
if (!
|
|
548
|
-
let t =
|
|
549
|
-
if (!e || !
|
|
550
|
-
let
|
|
551
|
-
for (let
|
|
552
|
-
return
|
|
553
|
-
},
|
|
554
|
-
for (let e of
|
|
555
|
-
let
|
|
556
|
-
if (e == null || e === "") return;
|
|
557
|
-
let t = i[String(e)];
|
|
558
|
-
if (t?.color) return String(t.color);
|
|
559
|
-
let n = String(e);
|
|
560
|
-
if (/^#([0-9a-f]{3}){1,2}$/i.test(n) || n.startsWith("rgb") || n.startsWith("hsl")) return n;
|
|
561
|
-
}, c = (e, t, r) => {
|
|
720
|
+
if (!j || !Array.isArray(j) || !F) return [];
|
|
721
|
+
let t = F, n = I ?? F, r = D?.fields ?? {}, i = e.objectName || "", a = (e) => {
|
|
722
|
+
if (!e || !r[e]?.options) return {};
|
|
723
|
+
let t = {};
|
|
724
|
+
for (let n of r[e].options) n && n.value != null && (t[String(n.value)] = n);
|
|
725
|
+
return t;
|
|
726
|
+
}, o = ["status", "priority"].filter((e) => r[e]), s = {};
|
|
727
|
+
for (let e of o) s[e] = a(e);
|
|
728
|
+
let c = h(r[z ?? ""]), l = (e, t, n) => {
|
|
562
729
|
if (t == null || t === "") return null;
|
|
563
|
-
let
|
|
730
|
+
let r = n[String(t)];
|
|
564
731
|
return {
|
|
565
|
-
label:
|
|
566
|
-
color:
|
|
732
|
+
label: r?.label ? N(i, e, String(t), r.label) : String(t),
|
|
733
|
+
color: r?.color
|
|
567
734
|
};
|
|
568
|
-
},
|
|
569
|
-
let
|
|
570
|
-
if (
|
|
571
|
-
let n =
|
|
572
|
-
n &&
|
|
735
|
+
}, u = j.map((e) => {
|
|
736
|
+
let r = e[t], a = e[n], u = z ? e[z] : void 0, d = R ? e[R] : void 0, f = [];
|
|
737
|
+
if (i) for (let t of o) {
|
|
738
|
+
let n = l(t, e[t], s[t] || {});
|
|
739
|
+
n && f.push({
|
|
573
740
|
key: t,
|
|
574
741
|
label: n.label,
|
|
575
742
|
color: n.color
|
|
576
743
|
});
|
|
577
744
|
}
|
|
578
745
|
return {
|
|
579
|
-
title: e
|
|
580
|
-
time:
|
|
581
|
-
startDate:
|
|
582
|
-
endDate:
|
|
583
|
-
description: e
|
|
584
|
-
variant: e[
|
|
585
|
-
color:
|
|
586
|
-
group:
|
|
587
|
-
meta:
|
|
746
|
+
title: y(e, P),
|
|
747
|
+
time: r,
|
|
748
|
+
startDate: r,
|
|
749
|
+
endDate: a,
|
|
750
|
+
description: y(e, Se),
|
|
751
|
+
variant: e[L] || "default",
|
|
752
|
+
color: c(u),
|
|
753
|
+
group: d,
|
|
754
|
+
meta: f,
|
|
588
755
|
_data: e
|
|
589
756
|
};
|
|
590
|
-
})
|
|
591
|
-
|
|
592
|
-
|
|
757
|
+
}), d = (e) => {
|
|
758
|
+
if (!e) return Infinity;
|
|
759
|
+
let t = x(e).getTime();
|
|
760
|
+
return Number.isNaN(t) ? Infinity : t;
|
|
761
|
+
};
|
|
762
|
+
u.sort((e, t) => d(e.startDate) - d(t.startDate));
|
|
763
|
+
let f = /* @__PURE__ */ new Date(), p = (e) => new Date(e.getFullYear(), e.getMonth(), e.getDate()).getTime(), m = (e) => new Date(f.getFullYear(), f.getMonth(), f.getDate() + e).getTime(), g = m(0), _ = m(1), v = (f.getDay() - ne(xe) + 7) % 7, b = m(7 - v), ee = m(14 - v), S = (e) => {
|
|
593
764
|
if (!e) return M("timeline.bucket.noDate");
|
|
594
|
-
let t =
|
|
595
|
-
return Number.isNaN(t) ?
|
|
765
|
+
let t = p(x(e));
|
|
766
|
+
return M(Number.isNaN(t) ? "timeline.bucket.noDate" : t < g ? "timeline.bucket.earlier" : t === g ? "timeline.bucket.today" : t === _ ? "timeline.bucket.tomorrow" : t < b ? "timeline.bucket.thisWeek" : t < ee ? "timeline.bucket.nextWeek" : "timeline.bucket.later");
|
|
596
767
|
};
|
|
597
|
-
if (
|
|
598
|
-
let e =
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
return {
|
|
602
|
-
...t,
|
|
603
|
-
group: n ? n.label : t.group != null && t.group !== "" ? String(t.group) : M("timeline.bucket.unassigned")
|
|
604
|
-
};
|
|
768
|
+
if (R) {
|
|
769
|
+
let e = a(R), t = u.map((t) => {
|
|
770
|
+
let n = t.group != null && t.group !== "" ? e[String(t.group)] : void 0;
|
|
771
|
+
return n?.label ? N(i, R, String(t.group), n.label) : Array.isArray(t.group) ? String(t.group) : y(t._data, R);
|
|
605
772
|
});
|
|
773
|
+
if (t.some((e) => e !== void 0)) return u.map((e, n) => ({
|
|
774
|
+
...e,
|
|
775
|
+
group: t[n] ?? M("timeline.bucket.unassigned")
|
|
776
|
+
}));
|
|
606
777
|
}
|
|
607
|
-
return
|
|
778
|
+
return u.map((e) => ({
|
|
608
779
|
...e,
|
|
609
|
-
group:
|
|
780
|
+
group: S(e.startDate)
|
|
610
781
|
}));
|
|
611
782
|
}, [
|
|
612
783
|
e.items,
|
|
613
|
-
|
|
614
|
-
|
|
784
|
+
j,
|
|
785
|
+
D,
|
|
615
786
|
e.objectName,
|
|
616
787
|
P,
|
|
617
788
|
F,
|
|
618
789
|
I,
|
|
790
|
+
Se,
|
|
619
791
|
L,
|
|
620
|
-
R,
|
|
621
|
-
B,
|
|
622
792
|
z,
|
|
793
|
+
R,
|
|
623
794
|
M,
|
|
624
|
-
N
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
795
|
+
N,
|
|
796
|
+
xe
|
|
797
|
+
]), V = t(async () => {
|
|
798
|
+
w((e) => e + 1);
|
|
799
|
+
}, []), { ref: Ce, isRefreshing: we, pullDistance: H } = me({
|
|
800
|
+
onRefresh: V,
|
|
801
|
+
enabled: !!e.objectName && !!s
|
|
802
|
+
}), U = ce({
|
|
631
803
|
navigation: e.navigation,
|
|
632
804
|
objectName: e.objectName,
|
|
633
|
-
onRowClick:
|
|
634
|
-
}),
|
|
805
|
+
onRowClick: l ?? f
|
|
806
|
+
}), W = T?.scale ?? e.scale, Te = !!e.items;
|
|
807
|
+
if (!Te && e.variant === "gantt") return /* @__PURE__ */ u("div", {
|
|
808
|
+
className: "p-4 text-destructive",
|
|
809
|
+
"data-testid": "timeline-unsupported-variant",
|
|
810
|
+
role: "alert",
|
|
811
|
+
children: M("timeline.unsupported.objectBoundGantt", { variants: Ae.join(", ") })
|
|
812
|
+
});
|
|
813
|
+
if (!Te && !F) return /* @__PURE__ */ u("div", {
|
|
814
|
+
className: "p-4 text-destructive",
|
|
815
|
+
"data-testid": "timeline-missing-date-axis",
|
|
816
|
+
role: "alert",
|
|
817
|
+
children: M("timeline.unconfigured.noDateAxis", { fields: je.join(", ") })
|
|
818
|
+
});
|
|
819
|
+
let De = {
|
|
635
820
|
...e,
|
|
636
|
-
items:
|
|
637
|
-
className:
|
|
638
|
-
...
|
|
821
|
+
items: B || [],
|
|
822
|
+
className: c || e.className,
|
|
823
|
+
...W ? { scale: W } : {},
|
|
639
824
|
onItemClick: (e) => {
|
|
640
825
|
let t = e._data || e;
|
|
641
|
-
|
|
826
|
+
U.handleClick(t), f?.(t);
|
|
642
827
|
}
|
|
643
828
|
};
|
|
644
|
-
return
|
|
829
|
+
return te ? /* @__PURE__ */ d("div", {
|
|
645
830
|
className: "p-4 text-destructive",
|
|
646
831
|
"data-testid": "timeline-error",
|
|
647
832
|
role: "alert",
|
|
648
|
-
children: ["Error loading timeline: ",
|
|
649
|
-
}) :
|
|
833
|
+
children: ["Error loading timeline: ", te.message]
|
|
834
|
+
}) : ee && (!B || B.length === 0) ? /* @__PURE__ */ d("div", {
|
|
650
835
|
className: "flex flex-col h-full min-h-[200px] p-4 gap-3",
|
|
651
836
|
"data-testid": "timeline-loading",
|
|
652
837
|
role: "status",
|
|
653
838
|
"aria-live": "polite",
|
|
654
839
|
"aria-busy": "true",
|
|
655
|
-
children: [/* @__PURE__ */
|
|
840
|
+
children: [/* @__PURE__ */ u("span", {
|
|
656
841
|
className: "sr-only",
|
|
657
842
|
children: "Loading timeline…"
|
|
658
843
|
}), [
|
|
@@ -660,35 +845,36 @@ var M = v.object({
|
|
|
660
845
|
1,
|
|
661
846
|
2,
|
|
662
847
|
3
|
|
663
|
-
].map((e) => /* @__PURE__ */
|
|
848
|
+
].map((e) => /* @__PURE__ */ d("div", {
|
|
664
849
|
className: "flex items-start gap-3",
|
|
665
850
|
style: { opacity: Math.max(.3, 1 - e * .18) },
|
|
666
|
-
children: [/* @__PURE__ */
|
|
851
|
+
children: [/* @__PURE__ */ u("div", { className: "h-3 w-3 rounded-full bg-muted/70 animate-pulse mt-1.5 shrink-0" }), /* @__PURE__ */ d("div", {
|
|
667
852
|
className: "flex-1 space-y-2",
|
|
668
|
-
children: [/* @__PURE__ */
|
|
853
|
+
children: [/* @__PURE__ */ u("div", { className: "h-4 w-1/3 rounded bg-muted/70 animate-pulse" }), /* @__PURE__ */ u("div", { className: "h-3 w-2/3 rounded bg-muted/50 animate-pulse" })]
|
|
669
854
|
})]
|
|
670
855
|
}, e))]
|
|
671
|
-
}) : /* @__PURE__ */
|
|
672
|
-
ref:
|
|
856
|
+
}) : /* @__PURE__ */ d("div", {
|
|
857
|
+
ref: Ce,
|
|
673
858
|
className: "relative overflow-auto h-full min-w-0",
|
|
859
|
+
"data-testid": "timeline-canvas",
|
|
674
860
|
children: [
|
|
675
|
-
|
|
861
|
+
H > 0 && /* @__PURE__ */ u("div", {
|
|
676
862
|
className: "flex items-center justify-center text-xs text-muted-foreground",
|
|
677
|
-
style: { height:
|
|
678
|
-
children:
|
|
863
|
+
style: { height: H },
|
|
864
|
+
children: we ? "Refreshing…" : "Pull to refresh"
|
|
679
865
|
}),
|
|
680
|
-
/* @__PURE__ */
|
|
681
|
-
|
|
682
|
-
...
|
|
866
|
+
/* @__PURE__ */ u(Ee, { schema: De }),
|
|
867
|
+
U.isOverlay && /* @__PURE__ */ u(o, {
|
|
868
|
+
...U,
|
|
683
869
|
title: "Timeline Item",
|
|
684
|
-
children: (e) => /* @__PURE__ */
|
|
870
|
+
children: (e) => /* @__PURE__ */ u("div", {
|
|
685
871
|
className: "space-y-3",
|
|
686
|
-
children: Object.entries(e).map(([e, t]) => /* @__PURE__ */
|
|
872
|
+
children: Object.entries(e).map(([e, t]) => /* @__PURE__ */ d("div", {
|
|
687
873
|
className: "flex flex-col",
|
|
688
|
-
children: [/* @__PURE__ */
|
|
874
|
+
children: [/* @__PURE__ */ u("span", {
|
|
689
875
|
className: "text-xs font-medium text-muted-foreground uppercase tracking-wide",
|
|
690
876
|
children: e.replace(/_/g, " ")
|
|
691
|
-
}), /* @__PURE__ */
|
|
877
|
+
}), /* @__PURE__ */ u("span", {
|
|
692
878
|
className: "text-sm",
|
|
693
879
|
children: String(t ?? "—")
|
|
694
880
|
})]
|
|
@@ -697,26 +883,26 @@ var M = v.object({
|
|
|
697
883
|
})
|
|
698
884
|
]
|
|
699
885
|
});
|
|
700
|
-
},
|
|
886
|
+
}, G = e.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ u("ol", {
|
|
701
887
|
ref: n,
|
|
702
|
-
className:
|
|
888
|
+
className: s("relative ml-3 border-l border-gray-200", e),
|
|
703
889
|
...t
|
|
704
890
|
}));
|
|
705
|
-
|
|
706
|
-
var
|
|
891
|
+
G.displayName = "Timeline";
|
|
892
|
+
var Fe = c("ml-6", {
|
|
707
893
|
variants: { density: {
|
|
708
894
|
default: "mb-10",
|
|
709
895
|
compact: "mb-3",
|
|
710
896
|
comfortable: "mb-6"
|
|
711
897
|
} },
|
|
712
898
|
defaultVariants: { density: "default" }
|
|
713
|
-
}),
|
|
899
|
+
}), Ie = e.forwardRef(({ className: e, density: t, ...n }, r) => /* @__PURE__ */ u("li", {
|
|
714
900
|
ref: r,
|
|
715
|
-
className:
|
|
901
|
+
className: s(Fe({ density: t }), e),
|
|
716
902
|
...n
|
|
717
903
|
}));
|
|
718
|
-
|
|
719
|
-
var
|
|
904
|
+
Ie.displayName = "TimelineItem";
|
|
905
|
+
var Le = c("absolute -left-3 w-6 h-6 rounded-full border-2 flex items-center justify-center", {
|
|
720
906
|
variants: { variant: {
|
|
721
907
|
default: "bg-blue-200 border-blue-400",
|
|
722
908
|
success: "bg-emerald-200 border-emerald-500",
|
|
@@ -728,87 +914,87 @@ var L = s("absolute -left-3 w-6 h-6 rounded-full border-2 flex items-center just
|
|
|
728
914
|
done: "bg-emerald-200 border-emerald-500"
|
|
729
915
|
} },
|
|
730
916
|
defaultVariants: { variant: "default" }
|
|
731
|
-
}),
|
|
917
|
+
}), K = e.forwardRef(({ className: e, variant: t = "default", ...n }, r) => /* @__PURE__ */ u("div", {
|
|
732
918
|
ref: r,
|
|
733
|
-
className:
|
|
919
|
+
className: s(Le({ variant: t }), e),
|
|
734
920
|
...n
|
|
735
921
|
}));
|
|
736
|
-
|
|
737
|
-
var
|
|
922
|
+
K.displayName = "TimelineMarker";
|
|
923
|
+
var Re = e.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ u("div", {
|
|
738
924
|
ref: n,
|
|
739
925
|
className: e,
|
|
740
926
|
...t
|
|
741
927
|
}));
|
|
742
|
-
|
|
743
|
-
var
|
|
928
|
+
Re.displayName = "TimelineContent";
|
|
929
|
+
var q = e.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ u("h3", {
|
|
744
930
|
ref: n,
|
|
745
|
-
className:
|
|
931
|
+
className: s("font-semibold text-lg mb-1", e),
|
|
746
932
|
...t
|
|
747
933
|
}));
|
|
748
|
-
|
|
749
|
-
var
|
|
934
|
+
q.displayName = "TimelineTitle";
|
|
935
|
+
var J = e.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ u("time", {
|
|
750
936
|
ref: n,
|
|
751
|
-
className:
|
|
937
|
+
className: s("text-sm font-normal text-gray-500 mb-2 block", e),
|
|
752
938
|
...t
|
|
753
939
|
}));
|
|
754
|
-
|
|
755
|
-
var
|
|
940
|
+
J.displayName = "TimelineTime";
|
|
941
|
+
var Y = e.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ u("p", {
|
|
756
942
|
ref: n,
|
|
757
|
-
className:
|
|
943
|
+
className: s("text-base text-gray-700", e),
|
|
758
944
|
...t
|
|
759
945
|
}));
|
|
760
|
-
|
|
761
|
-
var
|
|
946
|
+
Y.displayName = "TimelineDescription";
|
|
947
|
+
var ze = e.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ u("div", {
|
|
762
948
|
ref: n,
|
|
763
|
-
className:
|
|
949
|
+
className: s("relative flex overflow-x-auto py-8", e),
|
|
764
950
|
...t
|
|
765
951
|
}));
|
|
766
|
-
|
|
767
|
-
var
|
|
952
|
+
ze.displayName = "TimelineHorizontal";
|
|
953
|
+
var Be = e.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ u("div", {
|
|
768
954
|
ref: n,
|
|
769
|
-
className:
|
|
955
|
+
className: s("shrink-0 w-64 relative", e),
|
|
770
956
|
...t
|
|
771
957
|
}));
|
|
772
|
-
|
|
773
|
-
var
|
|
958
|
+
Be.displayName = "TimelineHorizontalItem";
|
|
959
|
+
var Ve = e.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ u("div", {
|
|
774
960
|
ref: n,
|
|
775
|
-
className:
|
|
961
|
+
className: s("relative w-full border rounded-lg overflow-hidden", e),
|
|
776
962
|
...t
|
|
777
963
|
}));
|
|
778
|
-
|
|
779
|
-
var
|
|
964
|
+
Ve.displayName = "TimelineGantt";
|
|
965
|
+
var He = e.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ u("div", {
|
|
780
966
|
ref: n,
|
|
781
|
-
className:
|
|
967
|
+
className: s("flex border-b bg-gray-50", e),
|
|
782
968
|
...t
|
|
783
969
|
}));
|
|
784
|
-
|
|
785
|
-
var
|
|
970
|
+
He.displayName = "TimelineGanttHeader";
|
|
971
|
+
var X = e.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ u("div", {
|
|
786
972
|
ref: n,
|
|
787
|
-
className:
|
|
973
|
+
className: s("w-48 border-r bg-white", e),
|
|
788
974
|
...t
|
|
789
975
|
}));
|
|
790
|
-
|
|
791
|
-
var
|
|
976
|
+
X.displayName = "TimelineGanttRowLabels";
|
|
977
|
+
var Z = e.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ u("div", {
|
|
792
978
|
ref: n,
|
|
793
|
-
className:
|
|
979
|
+
className: s("flex-1 overflow-x-auto", e),
|
|
794
980
|
...t
|
|
795
981
|
}));
|
|
796
|
-
|
|
797
|
-
var
|
|
982
|
+
Z.displayName = "TimelineGanttGrid";
|
|
983
|
+
var Q = e.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ u("div", {
|
|
798
984
|
ref: n,
|
|
799
|
-
className:
|
|
985
|
+
className: s("flex items-center border-b min-h-12", e),
|
|
800
986
|
...t
|
|
801
987
|
}));
|
|
802
|
-
|
|
803
|
-
var
|
|
988
|
+
Q.displayName = "TimelineGanttRow";
|
|
989
|
+
var Ue = e.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ u("div", {
|
|
804
990
|
ref: n,
|
|
805
|
-
className:
|
|
991
|
+
className: s("px-4 py-2 font-medium text-sm truncate", e),
|
|
806
992
|
...t
|
|
807
993
|
}));
|
|
808
|
-
|
|
809
|
-
var
|
|
994
|
+
Ue.displayName = "TimelineGanttLabel";
|
|
995
|
+
var We = e.forwardRef(({ className: e, start: t = 0, width: n = 100, variant: r = "default", ...i }, a) => /* @__PURE__ */ u("div", {
|
|
810
996
|
ref: a,
|
|
811
|
-
className:
|
|
997
|
+
className: s("absolute h-8 rounded-md transition-colors cursor-pointer", {
|
|
812
998
|
default: "bg-blue-500 hover:bg-blue-600",
|
|
813
999
|
success: "bg-green-500 hover:bg-green-600",
|
|
814
1000
|
warning: "bg-yellow-500 hover:bg-yellow-600",
|
|
@@ -821,70 +1007,127 @@ var Z = e.forwardRef(({ className: e, start: t = 0, width: n = 100, variant: r =
|
|
|
821
1007
|
},
|
|
822
1008
|
...i
|
|
823
1009
|
}));
|
|
824
|
-
|
|
825
|
-
var
|
|
1010
|
+
We.displayName = "TimelineGanttBar";
|
|
1011
|
+
var Ge = e.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ u("div", {
|
|
826
1012
|
ref: n,
|
|
827
|
-
className:
|
|
1013
|
+
className: s("px-2 py-1 text-white text-xs font-medium truncate", e),
|
|
828
1014
|
...t
|
|
829
1015
|
}));
|
|
830
|
-
|
|
831
|
-
var
|
|
1016
|
+
Ge.displayName = "TimelineGanttBarContent";
|
|
1017
|
+
var Ke = {
|
|
832
1018
|
filter: !0,
|
|
833
1019
|
sort: !0,
|
|
834
1020
|
limit: "limit"
|
|
835
|
-
}, $ = ({ schema: e, ...t }) => {
|
|
836
|
-
let { dataSource: n } =
|
|
837
|
-
return /* @__PURE__ */
|
|
1021
|
+
}, $ = g(({ schema: e, ...t }) => {
|
|
1022
|
+
let { dataSource: n } = de() || {}, { t: r } = ie();
|
|
1023
|
+
return /* @__PURE__ */ u(C, {
|
|
838
1024
|
schema: e,
|
|
839
|
-
mapping:
|
|
1025
|
+
mapping: Ke,
|
|
840
1026
|
dataSource: n,
|
|
841
1027
|
testId: "object-timeline",
|
|
842
|
-
errorTitle: "This timeline’s data source could not be resolved",
|
|
843
|
-
children: (e) => /* @__PURE__ */
|
|
1028
|
+
errorTitle: r("element.timeline.sourceUnresolved", { defaultValue: "This timeline’s data source could not be resolved" }),
|
|
1029
|
+
children: (e) => /* @__PURE__ */ u(Pe, {
|
|
844
1030
|
schema: e,
|
|
845
1031
|
dataSource: n,
|
|
846
1032
|
...t
|
|
847
1033
|
})
|
|
848
1034
|
});
|
|
849
|
-
}
|
|
850
|
-
|
|
851
|
-
namespace: "plugin-timeline",
|
|
852
|
-
label: "Object Timeline",
|
|
853
|
-
category: "view",
|
|
854
|
-
inputs: [{
|
|
1035
|
+
}), qe = [
|
|
1036
|
+
{
|
|
855
1037
|
name: "objectName",
|
|
856
1038
|
type: "string",
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
1039
|
+
description: "Object this timeline binds to. Optional because the component-level `dataSource` binding can supply the object instead — this block registers through `ElementDataSourceGate`, which lowers the binding onto this key before the renderer sees the node. A timeline drawn from `items`, `data` or a `bind` path issues no query and needs none to draw, but `navigation` still reads it: without it `page` opens nothing and `new_window` / `openNewTab` open no record page."
|
|
1040
|
+
},
|
|
1041
|
+
{
|
|
860
1042
|
name: "variant",
|
|
861
1043
|
type: "enum",
|
|
862
1044
|
enum: [
|
|
863
1045
|
"vertical",
|
|
864
1046
|
"horizontal",
|
|
865
1047
|
"gantt"
|
|
1048
|
+
]
|
|
1049
|
+
},
|
|
1050
|
+
{
|
|
1051
|
+
name: "filter",
|
|
1052
|
+
type: "array",
|
|
1053
|
+
description: "Base query filter in the rule-array form `[{ field, operator, value }, ...]`, narrowing the records the timeline fetches. Context tokens such as `{current_user_id}` are resolved first, then the filter is lowered to `$filter` on the query. Authored `items` or `data` suppress that query, so the key then narrows nothing. The MongoDB-style record form is not this key’s shape."
|
|
1054
|
+
},
|
|
1055
|
+
{
|
|
1056
|
+
name: "sort",
|
|
1057
|
+
type: "array",
|
|
1058
|
+
description: "Order of the records the timeline fetches, in `[{ field, order }]` form, lowered to `$orderby` on the same query. The rail draws entries composed from records by their start date, earliest first, whatever this order. Authored `items` or `data` suppress the query, so the key then orders nothing."
|
|
1059
|
+
},
|
|
1060
|
+
{
|
|
1061
|
+
name: "navigation",
|
|
1062
|
+
type: "object",
|
|
1063
|
+
description: "What an entry click opens — the `{ mode, size, openNewTab, preventNavigation }` block a list view declares. With the key ABSENT a click opens nothing: this renderer supplies no drawer default. `mode` is an overlay (`drawer`, `modal`, `split`, `popover`), `new_window`, `page` or `none`, and a block written without `mode` takes the spec’s `page` default. `drawer`, `modal` and `popover` open the entry’s record in that overlay, but `split` opens nothing, because the timeline hands the split shell no main panel; `new_window` opens the record page in a new tab; `none` opens nothing. `page` opens the record page of the timeline’s `objectName` through the record navigator the host publishes (the console publishes one on its custom pages, record pages and list views); under a host that publishes none, such as an embedded renderer, or on a timeline that names no `objectName`, there is no record page to open and the click opens nothing. `preventNavigation: true` opens nothing whatever the mode, `openNewTab: true` opens the record page in a new tab and outranks every mode except `none`, and `size` sets the overlay width. On a timeline that names no `objectName`, `new_window` and `openNewTab` open no record page either: the new tab’s address is a slash and the entry’s `id` alone (its `_id` when it has no `id`, `undefined` when it has neither). A click handler from a parent view outranks the whole key."
|
|
1064
|
+
},
|
|
1065
|
+
{
|
|
1066
|
+
name: "timeline",
|
|
1067
|
+
type: "object",
|
|
1068
|
+
description: "Timeline configuration, the author face — the same block `ListViewSchema.timeline` declares: { startDateField, endDateField, titleField, groupByField, colorField, scale }. The flat top-level spellings beside it are the runtime handoff, not a second authoring spelling. On entries composed from records, `startDateField` is the entry’s date, `endDateField` the end printed after it, `titleField` the title, `groupByField` the field whose value heads each group (without it, entries group into date buckets), and `colorField` the field whose option colour, or the value itself when it is a colour literal, paints the marker. Each outranks the flat key of the same binding, and `titleField` / `startDateField` outrank `mapping`’s `title` / `date`. `scale` sets the axis unit of the gantt branch, which on this block draws authored `items` only."
|
|
1069
|
+
},
|
|
1070
|
+
{
|
|
1071
|
+
name: "limit",
|
|
1072
|
+
type: "number",
|
|
1073
|
+
description: "Maximum number of records loaded onto the rail (row cap); lowered to the query's top-level `$top` (renderer default 100). A timeline renders one rail with no pagination control, so this is the author's window rather than a page size. A value that is not a positive integer is ignored with a console warning, and the default cap applies."
|
|
1074
|
+
},
|
|
1075
|
+
{
|
|
1076
|
+
name: "data",
|
|
1077
|
+
type: "array",
|
|
1078
|
+
description: "Pre-fetched records — read FIRST as the rail's row source, ahead of the data-scope binding and the fetch, and composed into entries through the same `timeline` field bindings a fetched row takes; authoring it suppresses the object query entirely. Distinct from `items`, which is the already-composed entry shape and wins over this key when both are written."
|
|
1079
|
+
},
|
|
1080
|
+
{
|
|
1081
|
+
name: "items",
|
|
1082
|
+
type: "array",
|
|
1083
|
+
description: "Static inline entries — read ahead of every record source, `data` above included, and bypasses the object query entirely (the renderer becomes a pass-through). Each entry is the kind this node's `variant` selects: a feed entry `{ time?, title, description?, variant?, icon?, content?, className? }` (`variant` absent / `vertical` / `horizontal`), or a gantt row `{ label, items? }` (`variant: 'gantt'`) whose bars are `{ title?, startDate?, endDate?, variant? }`, each date a string or epoch milliseconds. These are `@object-ui/types`'s `TimelineFeedItem` and `TimelineGanttItem`. They are drawn as written: the `timeline` block’s field bindings, `mapping` and `descriptionField` do not apply to them."
|
|
1084
|
+
},
|
|
1085
|
+
{
|
|
1086
|
+
name: "dateFormat",
|
|
1087
|
+
type: "enum",
|
|
1088
|
+
enum: [
|
|
1089
|
+
"short",
|
|
1090
|
+
"long",
|
|
1091
|
+
"iso"
|
|
866
1092
|
],
|
|
867
|
-
|
|
868
|
-
}
|
|
869
|
-
|
|
1093
|
+
description: "How each entry's date is rendered (renderer default `short`): `short` / `long` are locale-formatted, `iso` is the locale-free machine form."
|
|
1094
|
+
},
|
|
1095
|
+
{
|
|
1096
|
+
name: "rowLabel",
|
|
1097
|
+
type: "string",
|
|
1098
|
+
description: "Header label for the gantt row column — read by the gantt branch only, which on this block needs authored `items`. Without it the header shows the default label."
|
|
1099
|
+
},
|
|
1100
|
+
{
|
|
1101
|
+
name: "minDate",
|
|
1102
|
+
type: "string",
|
|
1103
|
+
description: "Pin the gantt axis start (ISO `yyyy-mm-dd`) instead of deriving it from the rows; only a non-empty value is honoured. A value that is not a date, or a `minDate` after `maxDate`, refuses the chart with a diagnostic naming it."
|
|
1104
|
+
},
|
|
1105
|
+
{
|
|
1106
|
+
name: "maxDate",
|
|
1107
|
+
type: "string",
|
|
1108
|
+
description: "Pin the gantt axis end (ISO `yyyy-mm-dd`) instead of deriving it from the rows; only a non-empty value is honoured. A value that is not a date, or a `maxDate` before `minDate`, refuses the chart with a diagnostic naming it."
|
|
1109
|
+
},
|
|
1110
|
+
{
|
|
1111
|
+
name: "descriptionField",
|
|
1112
|
+
type: "string",
|
|
1113
|
+
description: "Field rendered as each entry's description (renderer default `description`). It is declared flat because the `timeline` block has no member for it, and `mapping.description` outranks it when both are written."
|
|
1114
|
+
},
|
|
1115
|
+
{
|
|
1116
|
+
name: "mapping",
|
|
1117
|
+
type: "object",
|
|
1118
|
+
description: "Record-to-entry field mapping `{ title?, date?, description?, variant? }`, each a field name — the binding record read BETWEEN the `timeline` block and the flat fallbacks. Its `variant` member (the field whose value picks each marker colour, renderer default `variant`) is the only spelling that binding has. On the vertical rail a colour that `timeline.colorField` resolves for an entry outranks that marker colour."
|
|
1119
|
+
}
|
|
1120
|
+
];
|
|
1121
|
+
f.register("object-timeline", $, {
|
|
1122
|
+
namespace: "plugin-timeline",
|
|
1123
|
+
label: "Object Timeline",
|
|
1124
|
+
category: "view",
|
|
1125
|
+
inputs: [...qe]
|
|
1126
|
+
}), f.register("timeline", $, {
|
|
870
1127
|
namespace: "view",
|
|
871
1128
|
label: "Timeline View",
|
|
872
1129
|
category: "view",
|
|
873
|
-
inputs: [
|
|
874
|
-
name: "objectName",
|
|
875
|
-
type: "string",
|
|
876
|
-
label: "Object Name",
|
|
877
|
-
required: !0
|
|
878
|
-
}, {
|
|
879
|
-
name: "variant",
|
|
880
|
-
type: "enum",
|
|
881
|
-
enum: [
|
|
882
|
-
"vertical",
|
|
883
|
-
"horizontal",
|
|
884
|
-
"gantt"
|
|
885
|
-
],
|
|
886
|
-
defaultValue: "vertical"
|
|
887
|
-
}]
|
|
1130
|
+
inputs: [...qe]
|
|
888
1131
|
});
|
|
889
1132
|
//#endregion
|
|
890
|
-
export {
|
|
1133
|
+
export { Pe as ObjectTimeline, $ as ObjectTimelineRenderer, D as TIMELINE_SCALES, G as Timeline, Re as TimelineContent, Y as TimelineDescription, Ve as TimelineGantt, We as TimelineGanttBar, Ge as TimelineGanttBarContent, Z as TimelineGanttGrid, He as TimelineGanttHeader, Ue as TimelineGanttLabel, Q as TimelineGanttRow, X as TimelineGanttRowLabels, ze as TimelineHorizontal, Be as TimelineHorizontalItem, Ie as TimelineItem, K as TimelineMarker, Ee as TimelineRenderer, J as TimelineTime, q as TimelineTitle, Se as generateTimeScaleHeaders, O as resolveTimelineScale, Fe as timelineItemVariants, Le as timelineMarkerVariants };
|