@declarion/react 0.250.0 → 0.251.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist-lib/components/fields/cells/factories/duration.js +44 -0
- package/dist-lib/components/fields/cells/registry.js +34 -32
- package/dist-lib/components/pages/SmartListPage.impl.js +280 -279
- package/dist-lib/components/pages/SmartRecordListPage.impl.js +293 -292
- package/dist-lib/hooks/useSearchDraft.js +12 -0
- package/package.json +1 -1
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { EMPTY_CELL as e } from "./emptyCell.js";
|
|
2
|
+
import { coerceDisplayString as t } from "../../../../lib/display-value.js";
|
|
3
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
4
|
+
// src/components/fields/cells/factories/duration.tsx
|
|
5
|
+
var r = {
|
|
6
|
+
ns: 1,
|
|
7
|
+
us: 1e3,
|
|
8
|
+
ms: 1e6,
|
|
9
|
+
s: 1e9,
|
|
10
|
+
min: 6e10,
|
|
11
|
+
h: 36e11
|
|
12
|
+
}, i = [
|
|
13
|
+
["h", "hour"],
|
|
14
|
+
["min", "minute"],
|
|
15
|
+
["s", "second"],
|
|
16
|
+
["ms", "millisecond"],
|
|
17
|
+
["us", "microsecond"],
|
|
18
|
+
["ns", "nanosecond"]
|
|
19
|
+
], a = {
|
|
20
|
+
fontSize: 12.5,
|
|
21
|
+
fontVariantNumeric: "tabular-nums"
|
|
22
|
+
}, o = (o) => {
|
|
23
|
+
let { field: s, fieldName: c, t: l } = o, u = s.unit ? s.unit.display || s.unit.storage : void 0, d = new Map(i.map(([e, t]) => [e, new Intl.NumberFormat(l.language, {
|
|
24
|
+
style: "unit",
|
|
25
|
+
unit: t,
|
|
26
|
+
unitDisplay: "short",
|
|
27
|
+
maximumFractionDigits: 1
|
|
28
|
+
})]));
|
|
29
|
+
return (o, s) => {
|
|
30
|
+
if (o == null || o === "") return e;
|
|
31
|
+
let l = r[s.$units?.[c] || u || ""], f = typeof o == "number" ? o : Number(o);
|
|
32
|
+
if (l === void 0 || !Number.isFinite(f)) return /* @__PURE__ */ n("span", {
|
|
33
|
+
style: a,
|
|
34
|
+
children: t(o)
|
|
35
|
+
});
|
|
36
|
+
let p = f * l, [m] = i.find(([e]) => Math.abs(p) >= r[e]) ?? ["ns"];
|
|
37
|
+
return /* @__PURE__ */ n("span", {
|
|
38
|
+
className: "num",
|
|
39
|
+
style: a,
|
|
40
|
+
children: d.get(m).format(p / r[m])
|
|
41
|
+
});
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
export { r as NANOSECONDS_PER_UNIT, o as durationFactory };
|
|
@@ -7,21 +7,22 @@ import { dateFactory as a, timeFactory as o } from "./factories/date.js";
|
|
|
7
7
|
import { timeAgoFactory as s, timestampFullFactory as c } from "./factories/timestamp.js";
|
|
8
8
|
import { nextRunFactory as l } from "./factories/nextRun.js";
|
|
9
9
|
import { moneyFactory as u } from "./factories/money.js";
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
10
|
+
import { durationFactory as d } from "./factories/duration.js";
|
|
11
|
+
import { refLinkFactory as f } from "./factories/refLink.js";
|
|
12
|
+
import { urlFactory as p } from "./factories/url.js";
|
|
13
|
+
import { emailFactory as m } from "./factories/email.js";
|
|
14
|
+
import { phoneFactory as h } from "./factories/phone.js";
|
|
15
|
+
import { numberFactory as g } from "./factories/number.js";
|
|
16
|
+
import { codeFactory as _ } from "./factories/code.js";
|
|
17
|
+
import { linkFactory as v } from "./factories/link.js";
|
|
18
|
+
import { jsonFactory as y } from "./factories/json.js";
|
|
19
|
+
import { markdownFactory as b } from "./factories/markdown.js";
|
|
20
|
+
import { passwordMaskFactory as x } from "./factories/passwordMask.js";
|
|
21
|
+
import { richTextPreviewFactory as S } from "./factories/richTextPreview.js";
|
|
22
|
+
import { multilangInlineFactory as C } from "./factories/multilangInline.js";
|
|
23
|
+
import { fileReferenceFactory as w } from "./factories/fileReference.js";
|
|
23
24
|
// src/components/fields/cells/registry.ts
|
|
24
|
-
var
|
|
25
|
+
var T = {
|
|
25
26
|
text: e,
|
|
26
27
|
bool_pill: t,
|
|
27
28
|
badge: n,
|
|
@@ -33,25 +34,26 @@ var w = {
|
|
|
33
34
|
time: o,
|
|
34
35
|
next_run: l,
|
|
35
36
|
money: u,
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
37
|
+
duration: d,
|
|
38
|
+
ref_link: f,
|
|
39
|
+
file_ref: w,
|
|
40
|
+
url: p,
|
|
41
|
+
email: m,
|
|
42
|
+
phone: h,
|
|
43
|
+
number: g,
|
|
44
|
+
percent: g,
|
|
45
|
+
code: _,
|
|
46
|
+
link: v,
|
|
47
|
+
json: y,
|
|
48
|
+
markdown: b,
|
|
49
|
+
password_mask: x,
|
|
50
|
+
rich_text_preview: S,
|
|
51
|
+
multilang_inline: C
|
|
50
52
|
};
|
|
51
|
-
Object.keys(
|
|
52
|
-
function
|
|
53
|
-
let t = e.field.display?.widget ?? "text", n =
|
|
53
|
+
Object.keys(T).sort();
|
|
54
|
+
function E(e) {
|
|
55
|
+
let t = e.field.display?.widget ?? "text", n = T[t];
|
|
54
56
|
if (!n) throw Error(`resolveCellRenderer: no factory registered for widget "${t}" (field "${e.fieldName}"). The engine must stamp a smart default at YAML-load time; an unknown widget here indicates an out-of-sync allow-list.`);
|
|
55
57
|
return n(e);
|
|
56
58
|
}
|
|
57
|
-
export {
|
|
59
|
+
export { E as resolveCellRenderer };
|