@panneau/lists 5.0.0-alpha.1 → 5.0.0-alpha.11
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/README.md +3 -3
- package/dist/ItemDetails.css +34 -0
- package/dist/ItemDetails.d.ts +18 -0
- package/dist/ItemDetails.d.ts.map +1 -0
- package/dist/ItemDetails.js +104 -0
- package/dist/ItemDetails.js.map +1 -0
- package/dist/ItemDetails.module.js +16 -0
- package/dist/ItemDetails.module.js.map +1 -0
- package/dist/List.d.ts +2 -2
- package/dist/List.js +54 -12
- package/dist/List.js.map +1 -1
- package/dist/ListSkeleton.d.ts +17 -0
- package/dist/ListSkeleton.d.ts.map +1 -0
- package/dist/ListSkeleton.js +111 -0
- package/dist/ListSkeleton.js.map +1 -0
- package/dist/ListView.css +16 -16
- package/dist/ListView.d.ts +35 -6
- package/dist/ListView.d.ts.map +1 -1
- package/dist/ListView.js +544 -211
- package/dist/ListView.js.map +1 -1
- package/dist/ListView.module.js +10 -10
- package/dist/actions/ActionButton.d.ts +1 -1
- package/dist/actions/ActionButton.d.ts.map +1 -1
- package/dist/actions/ActionButton.js +96 -26
- package/dist/actions/ActionButton.js.map +1 -1
- package/dist/actions/Actions.css +8 -42
- package/dist/actions/Actions.module.js +5 -9
- package/dist/actions/Actions.module.js.map +1 -1
- package/dist/actions/ConfirmDialog.d.ts +15 -3
- package/dist/actions/ConfirmDialog.d.ts.map +1 -1
- package/dist/actions/ConfirmDialog.js +103 -89
- package/dist/actions/ConfirmDialog.js.map +1 -1
- package/dist/actions/RowActions.d.ts +6 -7
- package/dist/actions/RowActions.d.ts.map +1 -1
- package/dist/actions/RowActions.js +59 -53
- package/dist/actions/RowActions.js.map +1 -1
- package/dist/actions/actions.d.ts +5 -4
- package/dist/actions/actions.d.ts.map +1 -1
- package/dist/actions/actions.js +7 -14
- package/dist/actions/actions.js.map +1 -1
- package/dist/actions/icons.js.map +1 -1
- package/dist/cx.js.map +1 -1
- package/dist/displays/Displays.css +25 -13
- package/dist/displays/Displays.module.js +18 -14
- package/dist/displays/Displays.module.js.map +1 -1
- package/dist/displays/displays.d.ts +18 -3
- package/dist/displays/displays.d.ts.map +1 -1
- package/dist/displays/displays.js +355 -12
- package/dist/displays/displays.js.map +1 -1
- package/dist/filters/Filters.css +34 -20
- package/dist/filters/Filters.d.ts +1 -1
- package/dist/filters/Filters.js.map +1 -1
- package/dist/filters/Filters.module.js +13 -9
- package/dist/filters/Filters.module.js.map +1 -1
- package/dist/filters/controls.d.ts +1 -1
- package/dist/filters/controls.d.ts.map +1 -1
- package/dist/filters/controls.js +57 -35
- package/dist/filters/controls.js.map +1 -1
- package/dist/filters/format.d.ts +1 -1
- package/dist/filters/format.js.map +1 -1
- package/dist/index.d.ts +19 -18
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -3
- package/dist/layouts/CardsLayout.css +22 -11
- package/dist/layouts/CardsLayout.d.ts +2 -2
- package/dist/layouts/CardsLayout.d.ts.map +1 -1
- package/dist/layouts/CardsLayout.js +39 -35
- package/dist/layouts/CardsLayout.js.map +1 -1
- package/dist/layouts/CardsLayout.module.js +8 -8
- package/dist/layouts/CardsLayout.module.js.map +1 -1
- package/dist/layouts/ItemTitle.d.ts +3 -1
- package/dist/layouts/ItemTitle.d.ts.map +1 -1
- package/dist/layouts/ItemTitle.js +12 -8
- package/dist/layouts/ItemTitle.js.map +1 -1
- package/dist/layouts/TableLayout.css +60 -35
- package/dist/layouts/TableLayout.d.ts +2 -2
- package/dist/layouts/TableLayout.d.ts.map +1 -1
- package/dist/layouts/TableLayout.js +38 -33
- package/dist/layouts/TableLayout.js.map +1 -1
- package/dist/layouts/TableLayout.module.js +14 -14
- package/dist/layouts/TableLayout.module.js.map +1 -1
- package/dist/layouts/builtIn.d.ts +1 -1
- package/dist/layouts/builtIn.js.map +1 -1
- package/dist/layouts/link.css +3 -3
- package/dist/layouts/link.module.js +1 -1
- package/dist/plugin.d.ts +1 -1
- package/dist/plugin.js.map +1 -1
- package/dist/query.d.ts +1 -1
- package/dist/query.js.map +1 -1
- package/dist/selection.d.ts +1 -1
- package/dist/selection.js.map +1 -1
- package/dist/toolbar/LayoutSwitch.js.map +1 -1
- package/dist/toolbar/Pagination.d.ts +33 -0
- package/dist/toolbar/Pagination.d.ts.map +1 -1
- package/dist/toolbar/Pagination.js +282 -42
- package/dist/toolbar/Pagination.js.map +1 -1
- package/dist/toolbar/SearchField.js.map +1 -1
- package/dist/toolbar/SortSelect.d.ts +1 -1
- package/dist/toolbar/SortSelect.js.map +1 -1
- package/dist/toolbar/Toolbar.css +12 -12
- package/dist/toolbar/Toolbar.module.js +7 -7
- package/dist/types.d.ts +16 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/useDraft.js.map +1 -1
- package/dist/useListState.js.map +1 -1
- package/dist/useRenderValue.d.ts +8 -0
- package/dist/useRenderValue.d.ts.map +1 -0
- package/dist/useRenderValue.js +64 -0
- package/dist/useRenderValue.js.map +1 -0
- package/dist/values.d.ts +3 -1
- package/dist/values.d.ts.map +1 -1
- package/dist/values.js +6 -2
- package/dist/values.js.map +1 -1
- package/package.json +9 -9
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"actions.js","names":[],"sources":["../../src/actions/actions.ts"],"sourcesContent":["import { canRunAction, groupActions } from '@panneau/core';\nimport type { Action, ActionPlacement } from '@panneau/protocol';\n\nimport type { ListItem } from '../types';\n\n/** Actions of a list: a list (grouped by their placements), or already grouped by placement. */\nexport type ListActions = readonly Action[] | Partial<Record<ActionPlacement, readonly Action[]>>;\n\n/**\n * Groups actions by placement, without those the user can't run on the resource\n * (`abilities.run`). Actions already grouped (as `resolveList()` does) are filtered the same way.\n */\nexport function groupListActions(\n actions: ListActions | undefined,\n): Record<ActionPlacement, Action[]> {\n if (actions === undefined) {\n return { row: [], toolbar: [], form: [], menu: [] };\n }\n if (isActionList(actions)) {\n return groupActions(actions);\n }\n const pick = (placement: ActionPlacement) => (actions[placement] ?? []).filter(canRunAction);\n return { row: pick('row'), toolbar: pick('toolbar'), form: pick('form'), menu: pick('menu') };\n}\n\nfunction isActionList(actions: ListActions): actions is readonly Action[] {\n return Array.isArray(actions);\n}\n\n/**\n * Whether an action is available on an item (
|
|
1
|
+
{"version":3,"file":"actions.js","names":["canRunAction","fillActionUrl","groupActions","isActionAllowedOn","Action","ActionPlacement","ListItem","ListActions","Partial","Record","groupListActions","actions","undefined","row","toolbar","form","menu","isActionList","pick","placement","filter","Array","isArray","isAllowedOn","action","item","getActionHref","hasScope","scope","includes"],"sources":["../../src/actions/actions.ts"],"sourcesContent":["import { canRunAction, fillActionUrl, groupActions, isActionAllowedOn } from '@panneau/core';\nimport type { Action, ActionPlacement } from '@panneau/protocol';\n\nimport type { ListItem } from '../types';\n\n/** Actions of a list: a list (grouped by their placements), or already grouped by placement. */\nexport type ListActions = readonly Action[] | Partial<Record<ActionPlacement, readonly Action[]>>;\n\n/**\n * Groups actions by placement, without those the user can't run on the resource\n * (`abilities.run`). Actions already grouped (as `resolveList()` does) are filtered the same way.\n */\nexport function groupListActions(\n actions: ListActions | undefined,\n): Record<ActionPlacement, Action[]> {\n if (actions === undefined) {\n return { row: [], toolbar: [], form: [], menu: [] };\n }\n if (isActionList(actions)) {\n return groupActions(actions);\n }\n const pick = (placement: ActionPlacement) => (actions[placement] ?? []).filter(canRunAction);\n return { row: pick('row'), toolbar: pick('toolbar'), form: pick('form'), menu: pick('menu') };\n}\n\nfunction isActionList(actions: ListActions): actions is readonly Action[] {\n return Array.isArray(actions);\n}\n\n/**\n * Whether an action is available on an item (decisions 0011 and 0040), as `isActionAllowedOn()`\n * of `@panneau/core` says: the built-in item actions need their ability (`view`, `update`,\n * `duplicate`, `delete`), even on an item without abilities. Other links are allowed unless the\n * item says otherwise, and other actions when the item lists their id, or has no abilities.\n */\nexport function isAllowedOn(action: Action, item: ListItem): boolean {\n return isActionAllowedOn(action, item);\n}\n\n/**\n * The link of a `link` action for an item: its `url` template with `{id}` (and other `{field}`\n * values of the item) filled in, or `null` for an action with a `route` or without an item.\n */\nexport function getActionHref(action: Action, item?: ListItem): string | null {\n return fillActionUrl(action, item);\n}\n\n/** Whether an action's scope includes another one. */\nexport function hasScope(action: Action, scope: Action['scope'][number]): boolean {\n return action.scope.includes(scope);\n}\n"],"mappings":";;;;;;AAYA,SAAgBU,iBACZC,SACiC;CACjC,IAAIA,YAAYC,KAAAA,GACZ,OAAO;EAAEC,KAAK,CAAA;EAAIC,SAAS,CAAA;EAAIC,MAAM,CAAA;EAAIC,MAAM,CAAA;CAAG;CAEtD,IAAIC,aAAaN,OAAO,GACpB,OAAOT,aAAaS,OAAO;CAE/B,MAAMO,QAAQC,eAAgCR,QAAQQ,cAAc,CAAA,EAAA,CAAIC,OAAOpB,YAAY;CAC3F,OAAO;EAAEa,KAAKK,KAAK,KAAK;EAAGJ,SAASI,KAAK,SAAS;EAAGH,MAAMG,KAAK,MAAM;EAAGF,MAAME,KAAK,MAAM;CAAE;AAChG;AAEA,SAASD,aAAaN,SAAoD;CACtE,OAAOU,MAAMC,QAAQX,OAAO;AAChC;;;;;;;AAQA,SAAgBY,YAAYC,QAAgBC,MAAyB;CACjE,OAAOtB,kBAAkBqB,QAAQC,IAAI;AACzC;;;;;AAMA,SAAgBC,cAAcF,QAAgBC,MAAgC;CAC1E,OAAOxB,cAAcuB,QAAQC,IAAI;AACrC;;AAGA,SAAgBE,SAASH,QAAgBI,OAAyC;CAC9E,OAAOJ,OAAOI,MAAMC,SAASD,KAAK;AACtC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"icons.js","names":[],"sources":["../../src/actions/icons.ts"],"sourcesContent":["import {\n Copy,\n Download,\n Eye,\n type LucideIcon,\n Pencil,\n RotateCcw,\n Trash2,\n Upload,\n} from 'lucide-react';\n\nimport type { Action } from '@panneau/protocol';\nimport { type IconComponent, getNamedIcon } from '@panneau/ui';\n\n/** Icons of actions by action id, for actions written in code (`{ archive: Archive }`). */\nexport type ActionIcons = Readonly<Record<string, IconComponent>>;\n\n/** Icons of the built-in actions, when they don't name one. */\nconst BUILT_IN_ICONS: Record<string, LucideIcon> = {\n show: Eye,\n edit: Pencil,\n duplicate: Copy,\n delete: Trash2,\n restore: RotateCcw,\n export: Download,\n import: Upload,\n};\n\n/**\n * The icon of an action: the one given for its id in `icons`, then the Lucide icon its `icon`\n * names (`\"send\"`, loaded when it first renders), then the icon of a built-in action.\n */\nexport function getActionIcon(action: Action, icons?: ActionIcons): IconComponent | undefined {\n const given =\n icons !== undefined && Object.hasOwn(icons, action.id) ? icons[action.id] : undefined;\n if (given !== undefined) {\n return given;\n }\n if (action.icon !== undefined && action.icon !== '') {\n return getNamedIcon(action.icon);\n }\n return Object.hasOwn(BUILT_IN_ICONS, action.id) ? BUILT_IN_ICONS[action.id] : undefined;\n}\n"],"mappings":";;;;AAkBA,
|
|
1
|
+
{"version":3,"file":"icons.js","names":["Copy","Download","Eye","LucideIcon","Pencil","RotateCcw","Trash2","Upload","Action","IconComponent","getNamedIcon","ActionIcons","Readonly","Record","BUILT_IN_ICONS","show","edit","duplicate","delete","restore","export","import","getActionIcon","action","icons","given","undefined","Object","hasOwn","id","icon"],"sources":["../../src/actions/icons.ts"],"sourcesContent":["import {\n Copy,\n Download,\n Eye,\n type LucideIcon,\n Pencil,\n RotateCcw,\n Trash2,\n Upload,\n} from 'lucide-react';\n\nimport type { Action } from '@panneau/protocol';\nimport { type IconComponent, getNamedIcon } from '@panneau/ui';\n\n/** Icons of actions by action id, for actions written in code (`{ archive: Archive }`). */\nexport type ActionIcons = Readonly<Record<string, IconComponent>>;\n\n/** Icons of the built-in actions, when they don't name one. */\nconst BUILT_IN_ICONS: Record<string, LucideIcon> = {\n show: Eye,\n edit: Pencil,\n duplicate: Copy,\n delete: Trash2,\n restore: RotateCcw,\n export: Download,\n import: Upload,\n};\n\n/**\n * The icon of an action: the one given for its id in `icons`, then the Lucide icon its `icon`\n * names (`\"send\"`, loaded when it first renders), then the icon of a built-in action.\n */\nexport function getActionIcon(action: Action, icons?: ActionIcons): IconComponent | undefined {\n const given =\n icons !== undefined && Object.hasOwn(icons, action.id) ? icons[action.id] : undefined;\n if (given !== undefined) {\n return given;\n }\n if (action.icon !== undefined && action.icon !== '') {\n return getNamedIcon(action.icon);\n }\n return Object.hasOwn(BUILT_IN_ICONS, action.id) ? BUILT_IN_ICONS[action.id] : undefined;\n}\n"],"mappings":";;;;AAkBA,IAAMc,iBAA6C;CAC/CC,MAAMb;CACNc,MAAMZ;CACNa,WAAWjB;CACXkB,QAAQZ;CACRa,SAASd;CACTe,QAAQnB;CACRoB,QAAQd;AACZ;;;;;AAMA,SAAgBe,cAAcC,QAAgBC,OAAgD;CAC1F,MAAMC,QACFD,UAAUE,KAAAA,KAAaC,OAAOC,OAAOJ,OAAOD,OAAOM,EAAE,IAAIL,MAAMD,OAAOM,MAAMH,KAAAA;CAChF,IAAID,UAAUC,KAAAA,GACV,OAAOD;CAEX,IAAIF,OAAOO,SAASJ,KAAAA,KAAaH,OAAOO,SAAS,IAC7C,OAAOpB,aAAaa,OAAOO,IAAI;CAEnC,OAAOH,OAAOC,OAAOd,gBAAgBS,OAAOM,EAAE,IAAIf,eAAeS,OAAOM,MAAMH,KAAAA;AAClF"}
|
package/dist/cx.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cx.js","names":[],"sources":["../src/cx.ts"],"sourcesContent":["/** Joins class names, skipping empty ones. */\nexport function cx(...classNames: (string | false | null | undefined)[]): string {\n return classNames.filter(Boolean).join(' ');\n}\n"],"mappings":";;AACA,
|
|
1
|
+
{"version":3,"file":"cx.js","names":["cx","classNames","filter","Boolean","join"],"sources":["../src/cx.ts"],"sourcesContent":["/** Joins class names, skipping empty ones. */\nexport function cx(...classNames: (string | false | null | undefined)[]): string {\n return classNames.filter(Boolean).join(' ');\n}\n"],"mappings":";;AACA,SAAgBA,GAAG,GAAGC,YAA2D;CAC7E,OAAOA,WAAWC,OAAOC,OAAO,CAAC,CAACC,KAAK,GAAG;AAC9C"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
.panneau-empty
|
|
1
|
+
.panneau-displays-empty {
|
|
2
2
|
color: var(--panneau-color-text-muted);
|
|
3
3
|
}
|
|
4
4
|
|
|
5
|
-
.panneau-text
|
|
5
|
+
.panneau-displays-text {
|
|
6
6
|
display: -webkit-box;
|
|
7
7
|
overflow: hidden;
|
|
8
8
|
-webkit-line-clamp: 2;
|
|
@@ -11,35 +11,35 @@
|
|
|
11
11
|
overflow-wrap: anywhere;
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
.panneau-badges
|
|
14
|
+
.panneau-displays-badges {
|
|
15
15
|
display: inline-flex;
|
|
16
16
|
flex-wrap: wrap;
|
|
17
17
|
gap: var(--panneau-space-1);
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
.panneau-boolean
|
|
20
|
+
.panneau-displays-boolean {
|
|
21
21
|
display: inline-flex;
|
|
22
22
|
align-items: center;
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
.panneau-true
|
|
25
|
+
.panneau-displays-true {
|
|
26
26
|
color: var(--panneau-color-success);
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
.panneau-false
|
|
29
|
+
.panneau-displays-false {
|
|
30
30
|
color: var(--panneau-color-text-muted);
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
.panneau-number
|
|
34
|
-
font-variant-numeric:
|
|
33
|
+
.panneau-displays-number {
|
|
34
|
+
font-variant-numeric: var(--panneau-font-numeric);
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
-
.panneau-link
|
|
37
|
+
.panneau-displays-link {
|
|
38
38
|
color: var(--panneau-color-link);
|
|
39
39
|
overflow-wrap: anywhere;
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
-
.panneau-color
|
|
42
|
+
.panneau-displays-color {
|
|
43
43
|
display: inline-flex;
|
|
44
44
|
align-items: center;
|
|
45
45
|
gap: var(--panneau-space-2);
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
font-size: var(--panneau-font-size-sm);
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
-
.panneau-swatch
|
|
50
|
+
.panneau-displays-swatch {
|
|
51
51
|
flex: none;
|
|
52
52
|
width: 1rem;
|
|
53
53
|
height: 1rem;
|
|
@@ -55,13 +55,13 @@
|
|
|
55
55
|
border-radius: var(--panneau-radius-sm);
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
-
.panneau-media
|
|
58
|
+
.panneau-displays-media {
|
|
59
59
|
display: inline-flex;
|
|
60
60
|
align-items: center;
|
|
61
61
|
gap: var(--panneau-space-2);
|
|
62
62
|
}
|
|
63
63
|
|
|
64
|
-
.panneau-thumbnail
|
|
64
|
+
.panneau-displays-thumbnail {
|
|
65
65
|
flex: none;
|
|
66
66
|
width: 2.5rem;
|
|
67
67
|
height: 2.5rem;
|
|
@@ -69,3 +69,15 @@
|
|
|
69
69
|
background-color: var(--panneau-color-surface-sunken);
|
|
70
70
|
border-radius: var(--panneau-radius-sm);
|
|
71
71
|
}
|
|
72
|
+
|
|
73
|
+
.panneau-displays-code {
|
|
74
|
+
font-family: var(--panneau-font-family-mono);
|
|
75
|
+
font-size: var(--panneau-font-size-sm);
|
|
76
|
+
white-space: nowrap;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.panneau-displays-tags {
|
|
80
|
+
display: inline-flex;
|
|
81
|
+
flex-wrap: wrap;
|
|
82
|
+
gap: var(--panneau-space-1);
|
|
83
|
+
}
|
|
@@ -1,30 +1,34 @@
|
|
|
1
1
|
import "./Displays.css";
|
|
2
2
|
//#region src/displays/Displays.module.css
|
|
3
|
-
var empty = "panneau-empty
|
|
4
|
-
var text = "panneau-text
|
|
5
|
-
var badges = "panneau-badges
|
|
6
|
-
var boolean = "panneau-boolean
|
|
7
|
-
var number = "panneau-number
|
|
8
|
-
var link = "panneau-link
|
|
9
|
-
var color = "panneau-color
|
|
10
|
-
var swatch = "panneau-swatch
|
|
11
|
-
var media = "panneau-media
|
|
12
|
-
var thumbnail = "panneau-thumbnail
|
|
3
|
+
var empty = "panneau-displays-empty";
|
|
4
|
+
var text = "panneau-displays-text";
|
|
5
|
+
var badges = "panneau-displays-badges";
|
|
6
|
+
var boolean = "panneau-displays-boolean";
|
|
7
|
+
var number = "panneau-displays-number";
|
|
8
|
+
var link = "panneau-displays-link";
|
|
9
|
+
var color = "panneau-displays-color";
|
|
10
|
+
var swatch = "panneau-displays-swatch";
|
|
11
|
+
var media = "panneau-displays-media";
|
|
12
|
+
var thumbnail = "panneau-displays-thumbnail";
|
|
13
|
+
var code = "panneau-displays-code";
|
|
14
|
+
var tags = "panneau-displays-tags";
|
|
13
15
|
var Displays_module_default = {
|
|
14
16
|
empty,
|
|
15
17
|
text,
|
|
16
18
|
badges,
|
|
17
19
|
boolean,
|
|
18
|
-
"true": "panneau-true
|
|
19
|
-
"false": "panneau-false
|
|
20
|
+
"true": "panneau-displays-true",
|
|
21
|
+
"false": "panneau-displays-false",
|
|
20
22
|
number,
|
|
21
23
|
link,
|
|
22
24
|
color,
|
|
23
25
|
swatch,
|
|
24
26
|
media,
|
|
25
|
-
thumbnail
|
|
27
|
+
thumbnail,
|
|
28
|
+
code,
|
|
29
|
+
tags
|
|
26
30
|
};
|
|
27
31
|
//#endregion
|
|
28
|
-
export { badges, boolean, color, Displays_module_default as default, empty, link, media, number, swatch, text, thumbnail };
|
|
32
|
+
export { badges, boolean, code, color, Displays_module_default as default, empty, link, media, number, swatch, tags, text, thumbnail };
|
|
29
33
|
|
|
30
34
|
//# sourceMappingURL=Displays.module.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Displays.module.js","names":[],"sources":["../../src/displays/Displays.module.css"],"sourcesContent":[".empty {\n color: var(--panneau-color-text-muted);\n}\n\n.text {\n display: -webkit-box;\n overflow: hidden;\n -webkit-line-clamp: 2;\n line-clamp: 2;\n -webkit-box-orient: vertical;\n overflow-wrap: anywhere;\n}\n\n.badges {\n display: inline-flex;\n flex-wrap: wrap;\n gap: var(--panneau-space-1);\n}\n\n.boolean {\n display: inline-flex;\n align-items: center;\n}\n\n.true {\n color: var(--panneau-color-success);\n}\n\n.false {\n color: var(--panneau-color-text-muted);\n}\n\n.number {\n font-variant-numeric:
|
|
1
|
+
{"version":3,"file":"Displays.module.js","names":[],"sources":["../../src/displays/Displays.module.css"],"sourcesContent":[".empty {\n color: var(--panneau-color-text-muted);\n}\n\n.text {\n display: -webkit-box;\n overflow: hidden;\n -webkit-line-clamp: 2;\n line-clamp: 2;\n -webkit-box-orient: vertical;\n overflow-wrap: anywhere;\n}\n\n.badges {\n display: inline-flex;\n flex-wrap: wrap;\n gap: var(--panneau-space-1);\n}\n\n.boolean {\n display: inline-flex;\n align-items: center;\n}\n\n.true {\n color: var(--panneau-color-success);\n}\n\n.false {\n color: var(--panneau-color-text-muted);\n}\n\n.number {\n font-variant-numeric: var(--panneau-font-numeric);\n}\n\n.link {\n color: var(--panneau-color-link);\n overflow-wrap: anywhere;\n}\n\n.color {\n display: inline-flex;\n align-items: center;\n gap: var(--panneau-space-2);\n font-family: var(--panneau-font-family-mono);\n font-size: var(--panneau-font-size-sm);\n}\n\n.swatch {\n flex: none;\n width: 1rem;\n height: 1rem;\n border: var(--panneau-border-width) solid var(--panneau-color-border-control);\n border-radius: var(--panneau-radius-sm);\n}\n\n.media {\n display: inline-flex;\n align-items: center;\n gap: var(--panneau-space-2);\n}\n\n.thumbnail {\n flex: none;\n width: 2.5rem;\n height: 2.5rem;\n object-fit: cover;\n background-color: var(--panneau-color-surface-sunken);\n border-radius: var(--panneau-radius-sm);\n}\n\n.code {\n font-family: var(--panneau-font-family-mono);\n font-size: var(--panneau-font-size-sm);\n white-space: nowrap;\n}\n\n.tags {\n display: inline-flex;\n flex-wrap: wrap;\n gap: var(--panneau-space-1);\n}\n"],"mappings":""}
|
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
import type { DisplayEntry, DisplayProps } from '../types';
|
|
1
|
+
import type { DisplayEntry, DisplayProps } from '../types.js';
|
|
2
2
|
/** What a cell shows without a value. Hidden from assistive technologies, which skip the cell. */
|
|
3
3
|
export declare function EmptyValue(): import("react").JSX.Element;
|
|
4
|
-
/**
|
|
5
|
-
|
|
4
|
+
/**
|
|
5
|
+
* Text, on two lines at most. The default display. The value of a `secret` text field
|
|
6
|
+
* (`settings.secret`) shows as dots, never in clear.
|
|
7
|
+
*/
|
|
8
|
+
export declare function TextDisplay({ value, field }: DisplayProps): import("react").JSX.Element;
|
|
6
9
|
/** HTML as plain text. */
|
|
7
10
|
export declare function RichTextDisplay({ value }: DisplayProps): import("react").JSX.Element;
|
|
8
11
|
/** A number, in the format of the locale. */
|
|
@@ -23,6 +26,18 @@ export declare function RelationDisplay({ value }: DisplayProps): import("react"
|
|
|
23
26
|
export declare function UrlDisplay({ value }: DisplayProps): import("react").JSX.Element;
|
|
24
27
|
/** A link that writes an email. */
|
|
25
28
|
export declare function EmailDisplay({ value }: DisplayProps): import("react").JSX.Element;
|
|
29
|
+
/** A link that calls the phone number. */
|
|
30
|
+
export declare function TelDisplay({ value }: DisplayProps): import("react").JSX.Element;
|
|
31
|
+
/** A duration in seconds, with its units: `1 h 5 min`, to the precision of its field. */
|
|
32
|
+
export declare function DurationDisplay({ value, field }: DisplayProps): import("react").JSX.Element;
|
|
33
|
+
/** JSON on one line, shortened. */
|
|
34
|
+
export declare function JsonDisplay({ value }: DisplayProps): import("react").JSX.Element;
|
|
35
|
+
/** Tags, as badges, with the labels of their options. */
|
|
36
|
+
export declare function TagsDisplay({ value, field }: DisplayProps): import("react").JSX.Element;
|
|
37
|
+
/** What a URL embeds: its thumbnail and title, linked to it. */
|
|
38
|
+
export declare function EmbedDisplay({ value }: DisplayProps): import("react").JSX.Element;
|
|
39
|
+
/** A place: its address, or its coordinates. */
|
|
40
|
+
export declare function LocationDisplay({ value }: DisplayProps): import("react").JSX.Element;
|
|
26
41
|
/** A swatch, with the color's code. */
|
|
27
42
|
export declare function ColorDisplay({ value }: DisplayProps): import("react").JSX.Element;
|
|
28
43
|
/** A thumbnail and the name of a media item (or of the first one). */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"displays.d.ts","sourceRoot":"","sources":["../../src/displays/displays.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"displays.d.ts","sourceRoot":"","sources":["../../src/displays/displays.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAI3D,kGAAkG;AAClG,wBAAgB,UAAU,gCAMzB;AAWD;;;GAGG;AACH,wBAAgB,WAAW,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,YAAY,+BAczD;AAED,0BAA0B;AAC1B,wBAAgB,eAAe,CAAC,EAAE,KAAK,EAAE,EAAE,YAAY,+BAStD;AAED,6CAA6C;AAC7C,wBAAgB,aAAa,CAAC,EAAE,KAAK,EAAE,EAAE,YAAY,+BAQpD;AAED,4CAA4C;AAC5C,wBAAgB,cAAc,CAAC,EAAE,KAAK,EAAE,EAAE,YAAY,+BAcrD;AAkBD,2CAA2C;AAC3C,wBAAgB,WAAW,CAAC,EAAE,KAAK,EAAE,EAAE,YAAY,+BAOlD;AAED,sEAAsE;AACtE,wBAAgB,eAAe,CAAC,EAAE,KAAK,EAAE,EAAE,YAAY,+BAWtD;AAED,4DAA4D;AAC5D,wBAAgB,WAAW,CAAC,EAAE,KAAK,EAAE,EAAE,YAAY,+BAQlD;AAED,qDAAqD;AACrD,wBAAgB,aAAa,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,YAAY,+BAkB3D;AAED,mCAAmC;AACnC,wBAAgB,eAAe,CAAC,EAAE,KAAK,EAAE,EAAE,YAAY,+BAUtD;AAED,iCAAiC;AACjC,wBAAgB,UAAU,CAAC,EAAE,KAAK,EAAE,EAAE,YAAY,+BASjD;AAED,mCAAmC;AACnC,wBAAgB,YAAY,CAAC,EAAE,KAAK,EAAE,EAAE,YAAY,+BASnD;AAED,0CAA0C;AAC1C,wBAAgB,UAAU,CAAC,EAAE,KAAK,EAAE,EAAE,YAAY,+BASjD;AAED,yFAAyF;AACzF,wBAAgB,eAAe,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,YAAY,+BAM7D;AAED,mCAAmC;AACnC,wBAAgB,WAAW,CAAC,EAAE,KAAK,EAAE,EAAE,YAAY,+BAUlD;AAED,yDAAyD;AACzD,wBAAgB,WAAW,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,YAAY,+BAezD;AAED,gEAAgE;AAChE,wBAAgB,YAAY,CAAC,EAAE,KAAK,EAAE,EAAE,YAAY,+BAuBnD;AAED,gDAAgD;AAChD,wBAAgB,eAAe,CAAC,EAAE,KAAK,EAAE,EAAE,YAAY,+BAkBtD;AAED,uCAAuC;AACvC,wBAAgB,YAAY,CAAC,EAAE,KAAK,EAAE,EAAE,YAAY,+BAUnD;AAED,sEAAsE;AACtE,wBAAgB,YAAY,CAAC,EAAE,KAAK,EAAE,EAAE,YAAY,+BAenD;AAED;;;;GAIG;AACH,eAAO,MAAM,eAAe,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,CAuBlE,CAAC"}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { messages } from "../messages.js";
|
|
2
|
-
import {
|
|
2
|
+
import { findOption, getFieldOptions, toText } from "../values.js";
|
|
3
3
|
import Displays_module_default from "./Displays.module.js";
|
|
4
4
|
import { c } from "react/compiler-runtime";
|
|
5
5
|
import { Badge, Icon, usePanneauIntl } from "@panneau/ui";
|
|
6
6
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
7
|
import { Check, Minus } from "lucide-react";
|
|
8
8
|
import { toReferences } from "@panneau/fields";
|
|
9
|
+
import { formatDuration } from "@panneau/fields/duration";
|
|
9
10
|
//#region src/displays/displays.tsx
|
|
10
11
|
/** What a cell shows without a value. Hidden from assistive technologies, which skip the cell. */
|
|
11
12
|
function EmptyValue() {
|
|
@@ -24,10 +25,13 @@ function EmptyValue() {
|
|
|
24
25
|
function isEmpty(value) {
|
|
25
26
|
return value === null || value === void 0 || value === "" || Array.isArray(value) && value.length === 0;
|
|
26
27
|
}
|
|
27
|
-
/**
|
|
28
|
+
/**
|
|
29
|
+
* Text, on two lines at most. The default display. The value of a `secret` text field
|
|
30
|
+
* (`settings.secret`) shows as dots, never in clear.
|
|
31
|
+
*/
|
|
28
32
|
function TextDisplay(t0) {
|
|
29
|
-
const $ = c(
|
|
30
|
-
const { value } = t0;
|
|
33
|
+
const $ = c(10);
|
|
34
|
+
const { value, field } = t0;
|
|
31
35
|
const intl = usePanneauIntl();
|
|
32
36
|
let t1;
|
|
33
37
|
if ($[0] !== intl.locale || $[1] !== value) {
|
|
@@ -37,15 +41,42 @@ function TextDisplay(t0) {
|
|
|
37
41
|
$[2] = t1;
|
|
38
42
|
} else t1 = $[2];
|
|
39
43
|
const text = t1;
|
|
44
|
+
if (text === "") {
|
|
45
|
+
let t2;
|
|
46
|
+
if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
|
|
47
|
+
t2 = /* @__PURE__ */ jsx(EmptyValue, {});
|
|
48
|
+
$[3] = t2;
|
|
49
|
+
} else t2 = $[3];
|
|
50
|
+
return t2;
|
|
51
|
+
}
|
|
52
|
+
if (field?.settings?.secret === true) {
|
|
53
|
+
let t2;
|
|
54
|
+
if ($[4] !== intl) {
|
|
55
|
+
t2 = intl.formatMessage(messages.secretValue);
|
|
56
|
+
$[4] = intl;
|
|
57
|
+
$[5] = t2;
|
|
58
|
+
} else t2 = $[5];
|
|
59
|
+
let t3;
|
|
60
|
+
if ($[6] !== t2) {
|
|
61
|
+
t3 = /* @__PURE__ */ jsx("span", {
|
|
62
|
+
role: "img",
|
|
63
|
+
"aria-label": t2,
|
|
64
|
+
children: "••••••••"
|
|
65
|
+
});
|
|
66
|
+
$[6] = t2;
|
|
67
|
+
$[7] = t3;
|
|
68
|
+
} else t3 = $[7];
|
|
69
|
+
return t3;
|
|
70
|
+
}
|
|
40
71
|
let t2;
|
|
41
|
-
if ($[
|
|
42
|
-
t2 =
|
|
72
|
+
if ($[8] !== text) {
|
|
73
|
+
t2 = /* @__PURE__ */ jsx("span", {
|
|
43
74
|
className: Displays_module_default.text,
|
|
44
75
|
children: text
|
|
45
76
|
});
|
|
46
|
-
$[
|
|
47
|
-
$[
|
|
48
|
-
} else t2 = $[
|
|
77
|
+
$[8] = text;
|
|
78
|
+
$[9] = t2;
|
|
79
|
+
} else t2 = $[9];
|
|
49
80
|
return t2;
|
|
50
81
|
}
|
|
51
82
|
/** HTML as plain text. */
|
|
@@ -324,7 +355,13 @@ function SelectDisplay(t0) {
|
|
|
324
355
|
break bb0;
|
|
325
356
|
}
|
|
326
357
|
t1 = Displays_module_default.badges;
|
|
327
|
-
t2 = values.map((entry) =>
|
|
358
|
+
t2 = values.map((entry) => {
|
|
359
|
+
const option = findOption(options, entry);
|
|
360
|
+
return /* @__PURE__ */ jsx(Badge, {
|
|
361
|
+
tone: option?.tone ?? "neutral",
|
|
362
|
+
children: option?.label ?? String(entry)
|
|
363
|
+
}, String(entry));
|
|
364
|
+
});
|
|
328
365
|
}
|
|
329
366
|
$[0] = field;
|
|
330
367
|
$[1] = value;
|
|
@@ -461,6 +498,305 @@ function EmailDisplay(t0) {
|
|
|
461
498
|
} else t2 = $[3];
|
|
462
499
|
return t2;
|
|
463
500
|
}
|
|
501
|
+
/** A link that calls the phone number. */
|
|
502
|
+
function TelDisplay(t0) {
|
|
503
|
+
const $ = c(7);
|
|
504
|
+
const { value } = t0;
|
|
505
|
+
if (typeof value !== "string" || value.trim() === "") {
|
|
506
|
+
let t1;
|
|
507
|
+
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
508
|
+
t1 = /* @__PURE__ */ jsx(EmptyValue, {});
|
|
509
|
+
$[0] = t1;
|
|
510
|
+
} else t1 = $[0];
|
|
511
|
+
return t1;
|
|
512
|
+
}
|
|
513
|
+
let t1;
|
|
514
|
+
if ($[1] !== value) {
|
|
515
|
+
let t2;
|
|
516
|
+
if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
|
|
517
|
+
t2 = /[^\d+]/g;
|
|
518
|
+
$[3] = t2;
|
|
519
|
+
} else t2 = $[3];
|
|
520
|
+
t1 = value.replace(t2, "");
|
|
521
|
+
$[1] = value;
|
|
522
|
+
$[2] = t1;
|
|
523
|
+
} else t1 = $[2];
|
|
524
|
+
const t2 = `tel:${t1}`;
|
|
525
|
+
let t3;
|
|
526
|
+
if ($[4] !== t2 || $[5] !== value) {
|
|
527
|
+
t3 = /* @__PURE__ */ jsx("a", {
|
|
528
|
+
className: Displays_module_default.link,
|
|
529
|
+
href: t2,
|
|
530
|
+
children: value
|
|
531
|
+
});
|
|
532
|
+
$[4] = t2;
|
|
533
|
+
$[5] = value;
|
|
534
|
+
$[6] = t3;
|
|
535
|
+
} else t3 = $[6];
|
|
536
|
+
return t3;
|
|
537
|
+
}
|
|
538
|
+
/** A duration in seconds, with its units: `1 h 5 min`, to the precision of its field. */
|
|
539
|
+
function DurationDisplay(t0) {
|
|
540
|
+
const $ = c(6);
|
|
541
|
+
const { value, field } = t0;
|
|
542
|
+
if (typeof value !== "number" || Number.isNaN(value)) {
|
|
543
|
+
let t1;
|
|
544
|
+
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
545
|
+
t1 = /* @__PURE__ */ jsx(EmptyValue, {});
|
|
546
|
+
$[0] = t1;
|
|
547
|
+
} else t1 = $[0];
|
|
548
|
+
return t1;
|
|
549
|
+
}
|
|
550
|
+
const precision = field?.settings?.precision === "minutes" ? "minutes" : "seconds";
|
|
551
|
+
let t1;
|
|
552
|
+
if ($[1] !== precision || $[2] !== value) {
|
|
553
|
+
t1 = formatDuration(value, { precision });
|
|
554
|
+
$[1] = precision;
|
|
555
|
+
$[2] = value;
|
|
556
|
+
$[3] = t1;
|
|
557
|
+
} else t1 = $[3];
|
|
558
|
+
let t2;
|
|
559
|
+
if ($[4] !== t1) {
|
|
560
|
+
t2 = /* @__PURE__ */ jsx("span", {
|
|
561
|
+
className: Displays_module_default.number,
|
|
562
|
+
children: t1
|
|
563
|
+
});
|
|
564
|
+
$[4] = t1;
|
|
565
|
+
$[5] = t2;
|
|
566
|
+
} else t2 = $[5];
|
|
567
|
+
return t2;
|
|
568
|
+
}
|
|
569
|
+
/** JSON on one line, shortened. */
|
|
570
|
+
function JsonDisplay(t0) {
|
|
571
|
+
const $ = c(9);
|
|
572
|
+
const { value } = t0;
|
|
573
|
+
if (value === null || value === void 0 || typeof value !== "object") {
|
|
574
|
+
let t1;
|
|
575
|
+
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
576
|
+
t1 = /* @__PURE__ */ jsx(EmptyValue, {});
|
|
577
|
+
$[0] = t1;
|
|
578
|
+
} else t1 = $[0];
|
|
579
|
+
return t1;
|
|
580
|
+
}
|
|
581
|
+
let t1;
|
|
582
|
+
let t2;
|
|
583
|
+
let t3;
|
|
584
|
+
if ($[1] !== value) {
|
|
585
|
+
const json = JSON.stringify(value);
|
|
586
|
+
t1 = Displays_module_default.code;
|
|
587
|
+
t2 = json.length > 80 ? json : void 0;
|
|
588
|
+
t3 = json.length > 80 ? `${json.slice(0, 79)}…` : json;
|
|
589
|
+
$[1] = value;
|
|
590
|
+
$[2] = t1;
|
|
591
|
+
$[3] = t2;
|
|
592
|
+
$[4] = t3;
|
|
593
|
+
} else {
|
|
594
|
+
t1 = $[2];
|
|
595
|
+
t2 = $[3];
|
|
596
|
+
t3 = $[4];
|
|
597
|
+
}
|
|
598
|
+
let t4;
|
|
599
|
+
if ($[5] !== t1 || $[6] !== t2 || $[7] !== t3) {
|
|
600
|
+
t4 = /* @__PURE__ */ jsx("code", {
|
|
601
|
+
className: t1,
|
|
602
|
+
title: t2,
|
|
603
|
+
children: t3
|
|
604
|
+
});
|
|
605
|
+
$[5] = t1;
|
|
606
|
+
$[6] = t2;
|
|
607
|
+
$[7] = t3;
|
|
608
|
+
$[8] = t4;
|
|
609
|
+
} else t4 = $[8];
|
|
610
|
+
return t4;
|
|
611
|
+
}
|
|
612
|
+
/** Tags, as badges, with the labels of their options. */
|
|
613
|
+
function TagsDisplay(t0) {
|
|
614
|
+
const $ = c(13);
|
|
615
|
+
const { value, field } = t0;
|
|
616
|
+
let t1;
|
|
617
|
+
let t2;
|
|
618
|
+
let t3;
|
|
619
|
+
if ($[0] !== field?.options || $[1] !== value) {
|
|
620
|
+
t3 = Symbol.for("react.early_return_sentinel");
|
|
621
|
+
bb0: {
|
|
622
|
+
const tags = Array.isArray(value) ? value.filter(_temp2) : [];
|
|
623
|
+
if (tags.length === 0) {
|
|
624
|
+
let t4;
|
|
625
|
+
if ($[5] === Symbol.for("react.memo_cache_sentinel")) {
|
|
626
|
+
t4 = /* @__PURE__ */ jsx(EmptyValue, {});
|
|
627
|
+
$[5] = t4;
|
|
628
|
+
} else t4 = $[5];
|
|
629
|
+
t3 = t4;
|
|
630
|
+
break bb0;
|
|
631
|
+
}
|
|
632
|
+
let t4;
|
|
633
|
+
if ($[6] !== field?.options) {
|
|
634
|
+
t4 = field?.options ?? [];
|
|
635
|
+
$[6] = field?.options;
|
|
636
|
+
$[7] = t4;
|
|
637
|
+
} else t4 = $[7];
|
|
638
|
+
const options = t4;
|
|
639
|
+
t1 = Displays_module_default.tags;
|
|
640
|
+
let t5;
|
|
641
|
+
if ($[8] !== options) {
|
|
642
|
+
t5 = (tag_0) => /* @__PURE__ */ jsx(Badge, { children: options.find((option) => String(option.value) === tag_0)?.label ?? tag_0 }, tag_0);
|
|
643
|
+
$[8] = options;
|
|
644
|
+
$[9] = t5;
|
|
645
|
+
} else t5 = $[9];
|
|
646
|
+
t2 = tags.map(t5);
|
|
647
|
+
}
|
|
648
|
+
$[0] = field?.options;
|
|
649
|
+
$[1] = value;
|
|
650
|
+
$[2] = t1;
|
|
651
|
+
$[3] = t2;
|
|
652
|
+
$[4] = t3;
|
|
653
|
+
} else {
|
|
654
|
+
t1 = $[2];
|
|
655
|
+
t2 = $[3];
|
|
656
|
+
t3 = $[4];
|
|
657
|
+
}
|
|
658
|
+
if (t3 !== Symbol.for("react.early_return_sentinel")) return t3;
|
|
659
|
+
let t4;
|
|
660
|
+
if ($[10] !== t1 || $[11] !== t2) {
|
|
661
|
+
t4 = /* @__PURE__ */ jsx("span", {
|
|
662
|
+
className: t1,
|
|
663
|
+
children: t2
|
|
664
|
+
});
|
|
665
|
+
$[10] = t1;
|
|
666
|
+
$[11] = t2;
|
|
667
|
+
$[12] = t4;
|
|
668
|
+
} else t4 = $[12];
|
|
669
|
+
return t4;
|
|
670
|
+
}
|
|
671
|
+
/** What a URL embeds: its thumbnail and title, linked to it. */
|
|
672
|
+
function _temp2(tag) {
|
|
673
|
+
return typeof tag === "string";
|
|
674
|
+
}
|
|
675
|
+
function EmbedDisplay(t0) {
|
|
676
|
+
const $ = c(12);
|
|
677
|
+
const { value } = t0;
|
|
678
|
+
if (value === null || typeof value !== "object" || typeof value.url !== "string") {
|
|
679
|
+
let t1;
|
|
680
|
+
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
681
|
+
t1 = /* @__PURE__ */ jsx(EmptyValue, {});
|
|
682
|
+
$[0] = t1;
|
|
683
|
+
} else t1 = $[0];
|
|
684
|
+
return t1;
|
|
685
|
+
}
|
|
686
|
+
const { url, title, thumbnailUrl } = value;
|
|
687
|
+
let t1;
|
|
688
|
+
if ($[1] !== thumbnailUrl) {
|
|
689
|
+
t1 = typeof thumbnailUrl === "string" ? /* @__PURE__ */ jsx("img", {
|
|
690
|
+
className: Displays_module_default.thumbnail,
|
|
691
|
+
src: thumbnailUrl,
|
|
692
|
+
alt: ""
|
|
693
|
+
}) : null;
|
|
694
|
+
$[1] = thumbnailUrl;
|
|
695
|
+
$[2] = t1;
|
|
696
|
+
} else t1 = $[2];
|
|
697
|
+
let t2;
|
|
698
|
+
if ($[3] !== title || $[4] !== url) {
|
|
699
|
+
t2 = typeof title === "string" ? title : url.replace(/^https?:\/\//, "");
|
|
700
|
+
$[3] = title;
|
|
701
|
+
$[4] = url;
|
|
702
|
+
$[5] = t2;
|
|
703
|
+
} else t2 = $[5];
|
|
704
|
+
let t3;
|
|
705
|
+
if ($[6] !== t2) {
|
|
706
|
+
t3 = /* @__PURE__ */ jsx("span", {
|
|
707
|
+
className: Displays_module_default.text,
|
|
708
|
+
children: t2
|
|
709
|
+
});
|
|
710
|
+
$[6] = t2;
|
|
711
|
+
$[7] = t3;
|
|
712
|
+
} else t3 = $[7];
|
|
713
|
+
let t4;
|
|
714
|
+
if ($[8] !== t1 || $[9] !== t3 || $[10] !== url) {
|
|
715
|
+
t4 = /* @__PURE__ */ jsxs("a", {
|
|
716
|
+
className: `${Displays_module_default.link} ${Displays_module_default.media}`,
|
|
717
|
+
href: url,
|
|
718
|
+
target: "_blank",
|
|
719
|
+
rel: "noreferrer",
|
|
720
|
+
children: [t1, t3]
|
|
721
|
+
});
|
|
722
|
+
$[8] = t1;
|
|
723
|
+
$[9] = t3;
|
|
724
|
+
$[10] = url;
|
|
725
|
+
$[11] = t4;
|
|
726
|
+
} else t4 = $[11];
|
|
727
|
+
return t4;
|
|
728
|
+
}
|
|
729
|
+
/** A place: its address, or its coordinates. */
|
|
730
|
+
function LocationDisplay(t0) {
|
|
731
|
+
const $ = c(15);
|
|
732
|
+
const { value } = t0;
|
|
733
|
+
const intl = usePanneauIntl();
|
|
734
|
+
if (value === null || typeof value !== "object") {
|
|
735
|
+
let t1;
|
|
736
|
+
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
737
|
+
t1 = /* @__PURE__ */ jsx(EmptyValue, {});
|
|
738
|
+
$[0] = t1;
|
|
739
|
+
} else t1 = $[0];
|
|
740
|
+
return t1;
|
|
741
|
+
}
|
|
742
|
+
const { lat, lng, address } = value;
|
|
743
|
+
if (typeof address === "string" && address !== "") {
|
|
744
|
+
let t1;
|
|
745
|
+
if ($[1] !== address) {
|
|
746
|
+
t1 = /* @__PURE__ */ jsx("span", {
|
|
747
|
+
className: Displays_module_default.text,
|
|
748
|
+
children: address
|
|
749
|
+
});
|
|
750
|
+
$[1] = address;
|
|
751
|
+
$[2] = t1;
|
|
752
|
+
} else t1 = $[2];
|
|
753
|
+
return t1;
|
|
754
|
+
}
|
|
755
|
+
if (typeof lat !== "number" || typeof lng !== "number") {
|
|
756
|
+
let t1;
|
|
757
|
+
if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
|
|
758
|
+
t1 = /* @__PURE__ */ jsx(EmptyValue, {});
|
|
759
|
+
$[3] = t1;
|
|
760
|
+
} else t1 = $[3];
|
|
761
|
+
return t1;
|
|
762
|
+
}
|
|
763
|
+
let t1;
|
|
764
|
+
if ($[4] !== intl) {
|
|
765
|
+
t1 = (number) => intl.formatNumber(number, { maximumFractionDigits: 5 });
|
|
766
|
+
$[4] = intl;
|
|
767
|
+
$[5] = t1;
|
|
768
|
+
} else t1 = $[5];
|
|
769
|
+
const format = t1;
|
|
770
|
+
let t2;
|
|
771
|
+
if ($[6] !== format || $[7] !== lat) {
|
|
772
|
+
t2 = format(lat);
|
|
773
|
+
$[6] = format;
|
|
774
|
+
$[7] = lat;
|
|
775
|
+
$[8] = t2;
|
|
776
|
+
} else t2 = $[8];
|
|
777
|
+
let t3;
|
|
778
|
+
if ($[9] !== format || $[10] !== lng) {
|
|
779
|
+
t3 = format(lng);
|
|
780
|
+
$[9] = format;
|
|
781
|
+
$[10] = lng;
|
|
782
|
+
$[11] = t3;
|
|
783
|
+
} else t3 = $[11];
|
|
784
|
+
let t4;
|
|
785
|
+
if ($[12] !== t2 || $[13] !== t3) {
|
|
786
|
+
t4 = /* @__PURE__ */ jsxs("span", {
|
|
787
|
+
className: Displays_module_default.number,
|
|
788
|
+
children: [
|
|
789
|
+
t2,
|
|
790
|
+
", ",
|
|
791
|
+
t3
|
|
792
|
+
]
|
|
793
|
+
});
|
|
794
|
+
$[12] = t2;
|
|
795
|
+
$[13] = t3;
|
|
796
|
+
$[14] = t4;
|
|
797
|
+
} else t4 = $[14];
|
|
798
|
+
return t4;
|
|
799
|
+
}
|
|
464
800
|
/** A swatch, with the color's code. */
|
|
465
801
|
function ColorDisplay(t0) {
|
|
466
802
|
const $ = c(6);
|
|
@@ -562,9 +898,16 @@ var builtInDisplays = {
|
|
|
562
898
|
url: UrlDisplay,
|
|
563
899
|
email: EmailDisplay,
|
|
564
900
|
color: ColorDisplay,
|
|
565
|
-
media: MediaDisplay
|
|
901
|
+
media: MediaDisplay,
|
|
902
|
+
tel: TelDisplay,
|
|
903
|
+
range: NumberDisplay,
|
|
904
|
+
duration: DurationDisplay,
|
|
905
|
+
json: JsonDisplay,
|
|
906
|
+
tags: TagsDisplay,
|
|
907
|
+
embed: EmbedDisplay,
|
|
908
|
+
location: LocationDisplay
|
|
566
909
|
};
|
|
567
910
|
//#endregion
|
|
568
|
-
export { BooleanDisplay, ColorDisplay, DateDisplay, DateTimeDisplay, EmailDisplay, EmptyValue, MediaDisplay, NumberDisplay, RelationDisplay, RichTextDisplay, SelectDisplay, TextDisplay, TimeDisplay, UrlDisplay, builtInDisplays };
|
|
911
|
+
export { BooleanDisplay, ColorDisplay, DateDisplay, DateTimeDisplay, DurationDisplay, EmailDisplay, EmbedDisplay, EmptyValue, JsonDisplay, LocationDisplay, MediaDisplay, NumberDisplay, RelationDisplay, RichTextDisplay, SelectDisplay, TagsDisplay, TelDisplay, TextDisplay, TimeDisplay, UrlDisplay, builtInDisplays };
|
|
569
912
|
|
|
570
913
|
//# sourceMappingURL=displays.js.map
|