@panneau/lists 5.0.0-alpha.17 → 5.0.0-alpha.18
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 +14 -14
- package/dist/ListSkeleton.d.ts +3 -1
- package/dist/ListSkeleton.d.ts.map +1 -1
- package/dist/ListSkeleton.js +34 -30
- package/dist/ListSkeleton.js.map +1 -1
- package/dist/ListView.d.ts +3 -2
- package/dist/ListView.d.ts.map +1 -1
- package/dist/ListView.js +7 -4
- package/dist/ListView.js.map +1 -1
- package/dist/actions/ConfirmDialog.d.ts +5 -1
- package/dist/actions/ConfirmDialog.d.ts.map +1 -1
- package/dist/actions/ConfirmDialog.js +7 -3
- package/dist/actions/ConfirmDialog.js.map +1 -1
- package/dist/displays/Displays.css +6 -0
- package/dist/displays/Displays.module.js +3 -1
- package/dist/displays/Displays.module.js.map +1 -1
- package/dist/displays/displays.d.ts +9 -1
- package/dist/displays/displays.d.ts.map +1 -1
- package/dist/displays/displays.js +132 -27
- package/dist/displays/displays.js.map +1 -1
- package/dist/images.d.ts +3 -2
- package/dist/images.d.ts.map +1 -1
- package/dist/images.js +24 -3
- package/dist/images.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -3
- package/dist/inline/InlineCell.d.ts +3 -1
- package/dist/inline/InlineCell.d.ts.map +1 -1
- package/dist/inline/InlineCell.js +153 -134
- package/dist/inline/InlineCell.js.map +1 -1
- package/dist/layouts/TableLayout.css +31 -0
- package/dist/layouts/TableLayout.d.ts +4 -3
- package/dist/layouts/TableLayout.d.ts.map +1 -1
- package/dist/layouts/TableLayout.js +87 -54
- package/dist/layouts/TableLayout.js.map +1 -1
- package/dist/layouts/TableLayout.module.js +5 -1
- package/dist/layouts/TableLayout.module.js.map +1 -1
- package/dist/types.d.ts +4 -1
- package/dist/types.d.ts.map +1 -1
- package/package.json +7 -7
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import type { ListActionEvent, ListActionPreview } from '../types.js';
|
|
2
|
-
/**
|
|
2
|
+
/**
|
|
3
|
+
* Whether an action needs a confirmation: it asks for one, or it is undoable but runs on more items
|
|
4
|
+
* than an undo can put back (`asksConfirmation()`, decision 0063), or some selected items are
|
|
5
|
+
* skipped.
|
|
6
|
+
*/
|
|
3
7
|
export declare function needsConfirmation(event: ListActionEvent): boolean;
|
|
4
8
|
/** The dry run of a query selection: in progress, or done with the backend's count. */
|
|
5
9
|
export type ConfirmPreview = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConfirmDialog.d.ts","sourceRoot":"","sources":["../../src/actions/ConfirmDialog.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ConfirmDialog.d.ts","sourceRoot":"","sources":["../../src/actions/ConfirmDialog.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAoBnE;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,eAAe,GAAG,OAAO,CAEjE;AAED,uFAAuF;AACvF,MAAM,MAAM,cAAc,GAAG;IAAE,MAAM,EAAE,SAAS,CAAA;CAAE,GAAG,CAAC;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE,GAAG,iBAAiB,CAAC,CAAC;AAE9F,MAAM,WAAW,kBAAkB;IAC/B,kEAAkE;IAClE,KAAK,EAAE,eAAe,GAAG,IAAI,CAAC;IAC9B;;;OAGG;IACH,OAAO,CAAC,EAAE,cAAc,GAAG,IAAI,CAAC;IAChC,SAAS,EAAE,CAAC,KAAK,EAAE,eAAe,KAAK,IAAI,CAAC;IAC5C,QAAQ,EAAE,MAAM,IAAI,CAAC;CACxB;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,EAAE,KAAK,EAAE,OAAc,EAAE,SAAS,EAAE,QAAQ,EAAE,EAAE,kBAAkB,sCA+D/F"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { messages } from "../messages.js";
|
|
2
2
|
import Actions_module_default from "./Actions.module.js";
|
|
3
|
+
import { asksConfirmation } from "@panneau/core";
|
|
3
4
|
import { c } from "react/compiler-runtime";
|
|
4
5
|
import { getActionLabel } from "@panneau/intl";
|
|
5
6
|
import { Button, Dialog, Spinner, usePanneauIntl } from "@panneau/ui";
|
|
@@ -13,10 +14,13 @@ function formatDefinitionMessage(intl, message, values) {
|
|
|
13
14
|
return message;
|
|
14
15
|
}
|
|
15
16
|
}
|
|
16
|
-
/**
|
|
17
|
+
/**
|
|
18
|
+
* Whether an action needs a confirmation: it asks for one, or it is undoable but runs on more items
|
|
19
|
+
* than an undo can put back (`asksConfirmation()`, decision 0063), or some selected items are
|
|
20
|
+
* skipped.
|
|
21
|
+
*/
|
|
17
22
|
function needsConfirmation(event) {
|
|
18
|
-
|
|
19
|
-
return confirm !== void 0 && confirm !== false || event.skipped.length > 0;
|
|
23
|
+
return asksConfirmation(event.action, event.count) || event.skipped.length > 0;
|
|
20
24
|
}
|
|
21
25
|
/**
|
|
22
26
|
* Asks before running an action (decision 0017): the action's `confirm` title and message (an ICU
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConfirmDialog.js","names":["IntlShape","getActionLabel","Button","Dialog","Spinner","usePanneauIntl","messages","ListActionEvent","ListActionPreview","styles","formatDefinitionMessage","intl","message","values","Record","String","formatters","getMessageFormat","locale","format","needsConfirmation","event","
|
|
1
|
+
{"version":3,"file":"ConfirmDialog.js","names":["IntlShape","asksConfirmation","getActionLabel","Button","Dialog","Spinner","usePanneauIntl","messages","ListActionEvent","ListActionPreview","styles","formatDefinitionMessage","intl","message","values","Record","String","formatters","getMessageFormat","locale","format","needsConfirmation","event","action","count","skipped","length","ConfirmPreview","status","ConfirmDialogProps","preview","onConfirm","onCancel","ConfirmDialog","t0","$","_c","t1","undefined","loading","T0","t10","t2","t3","t4","t5","t6","t7","t8","t9","confirm","label","open","title","formatMessage","confirmTitle","t11","cancelLabel","cancel","destructive","confirmLabel","confirmMessage","t12","confirmChecking","confirmSkipped","t13","_c","_Fragment","styles"],"sources":["../../src/actions/ConfirmDialog.tsx"],"sourcesContent":["import type { IntlShape } from 'react-intl';\n\nimport { asksConfirmation } from '@panneau/core';\nimport { getActionLabel } from '@panneau/intl';\nimport { Button, Dialog, Spinner, usePanneauIntl } from '@panneau/ui';\n\nimport { messages } from '../messages';\nimport type { ListActionEvent, ListActionPreview } from '../types';\nimport styles from './Actions.module.css';\n\n/** Formats an ICU message of the definition (`{count, plural, …}`) in the locale. */\nfunction formatDefinitionMessage(\n intl: IntlShape,\n message: string,\n values: Record<string, unknown>,\n) {\n try {\n return String(\n intl.formatters\n .getMessageFormat(message, intl.locale)\n .format(values as Record<string, string | number>),\n );\n } catch {\n return message;\n }\n}\n\n/**\n * Whether an action needs a confirmation: it asks for one, or it is undoable but runs on more items\n * than an undo can put back (`asksConfirmation()`, decision 0063), or some selected items are\n * skipped.\n */\nexport function needsConfirmation(event: ListActionEvent): boolean {\n return asksConfirmation(event.action, event.count) || event.skipped.length > 0;\n}\n\n/** The dry run of a query selection: in progress, or done with the backend's count. */\nexport type ConfirmPreview = { status: 'loading' } | ({ status: 'done' } & ListActionPreview);\n\nexport interface ConfirmDialogProps {\n /** The action to confirm, or `null` when the dialog is closed. */\n event: ListActionEvent | null;\n /**\n * What the backend told about a query selection. Its count of skipped items replaces the\n * count of the current page; while it loads, the dialog says so and can't be confirmed.\n */\n preview?: ConfirmPreview | null;\n onConfirm: (event: ListActionEvent) => void;\n onCancel: () => void;\n}\n\n/**\n * Asks before running an action (decision 0017): the action's `confirm` title and message (an ICU\n * message with `{count}`), or default ones, and how many selected items will be skipped: those of\n * the current page that don't allow it, or the backend's count for every item matching a query.\n */\nexport function ConfirmDialog({ event, preview = null, onConfirm, onCancel }: ConfirmDialogProps) {\n const intl = usePanneauIntl();\n if (event === null) {\n return null;\n }\n const { action, count } = event;\n const loading = preview?.status === 'loading';\n const skipped = preview?.status === 'done' ? preview.skipped : event.skipped.length;\n const confirm = typeof action.confirm === 'object' ? action.confirm : {};\n const label = getActionLabel(action, intl);\n const values = { count, action: label };\n return (\n <Dialog\n isOpen\n onOpenChange={(open) => {\n if (!open) {\n onCancel();\n }\n }}\n role=\"alertdialog\"\n isDismissable={false}\n size=\"sm\"\n title={\n confirm.title !== undefined\n ? formatDefinitionMessage(intl, confirm.title, values)\n : intl.formatMessage(messages.confirmTitle, { action: label })\n }\n footer={\n <>\n <Button variant=\"ghost\" onPress={onCancel}>\n {confirm.cancelLabel ?? intl.formatMessage(messages.cancel)}\n </Button>\n <Button\n variant={action.destructive === true ? 'danger' : 'primary'}\n autoFocus\n isDisabled={loading}\n onPress={() => onConfirm(event)}\n >\n {confirm.confirmLabel ?? label}\n </Button>\n </>\n }\n >\n <p className={styles.message}>\n {confirm.message !== undefined\n ? formatDefinitionMessage(intl, confirm.message, values)\n : intl.formatMessage(messages.confirmMessage, values)}\n </p>\n {loading ? (\n <div className={styles.skipped}>\n <Spinner\n size=\"sm\"\n label={intl.formatMessage(messages.confirmChecking)}\n showLabel\n />\n </div>\n ) : skipped > 0 ? (\n <p className={styles.skipped}>\n {intl.formatMessage(messages.confirmSkipped, { count: skipped })}\n </p>\n ) : null}\n </Dialog>\n );\n}\n"],"mappings":";;;;;;;;;AAWA,SAASW,wBACLC,MACAC,SACAC,QACF;CACE,IAAI;EACA,OAAOE,OACHJ,KAAKK,WACAC,iBAAiBL,SAASD,KAAKO,MAAM,CAAC,CACtCC,OAAON,MAAyC,CACzD;CACJ,QAAQ;EACJ,OAAOD;CACX;AACJ;;;;;;AAOA,SAAgBQ,kBAAkBC,OAAiC;CAC/D,OAAOrB,iBAAiBqB,MAAMC,QAAQD,MAAME,KAAK,KAAKF,MAAMG,QAAQC,SAAS;AACjF;;;;;;AAsBA,SAAOO,cAAAC,IAAA;CAAA,MAAAC,IAAAC,EAAA,EAAA;CAAuB,MAAA,EAAAd,OAAAQ,SAAAO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AAb,EAAA,MAAAc;EAAAd,EAAA,MAAA8B;CAAA,OAAAA,MAAA9B,EAAA;CAAA,OAjDT8B;AAiDS"}
|
|
@@ -10,6 +10,7 @@ var color = "panneau-displays-color";
|
|
|
10
10
|
var paletteColor = "panneau-displays-palette-color";
|
|
11
11
|
var swatch = "panneau-displays-swatch";
|
|
12
12
|
var media = "panneau-displays-media";
|
|
13
|
+
var files = "panneau-displays-files";
|
|
13
14
|
var thumbnail = "panneau-displays-thumbnail";
|
|
14
15
|
var code = "panneau-displays-code";
|
|
15
16
|
var tags = "panneau-displays-tags";
|
|
@@ -30,6 +31,7 @@ var Displays_module_default = {
|
|
|
30
31
|
paletteColor,
|
|
31
32
|
swatch,
|
|
32
33
|
media,
|
|
34
|
+
files,
|
|
33
35
|
thumbnail,
|
|
34
36
|
code,
|
|
35
37
|
tags,
|
|
@@ -39,6 +41,6 @@ var Displays_module_default = {
|
|
|
39
41
|
regionFlag
|
|
40
42
|
};
|
|
41
43
|
//#endregion
|
|
42
|
-
export { badges, boolean, code, color, countries, Displays_module_default as default, empty, flag, flagged, link, media, number, paletteColor, regionFlag, swatch, tags, text, thumbnail };
|
|
44
|
+
export { badges, boolean, code, color, countries, Displays_module_default as default, empty, files, flag, flagged, link, media, number, paletteColor, regionFlag, swatch, tags, text, thumbnail };
|
|
43
45
|
|
|
44
46
|
//# 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: 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.paletteColor {\n display: inline-flex;\n align-items: center;\n gap: var(--panneau-space-2);\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\n/* Several countries. */\n.countries {\n display: inline-flex;\n flex-wrap: wrap;\n gap: var(--panneau-space-1) var(--panneau-space-3);\n}\n\n/* A value after a flag: a country, a region, a phone number. */\n.flagged {\n display: inline-flex;\n align-items: baseline;\n gap: var(--panneau-space-2);\n min-width: 0;\n}\n\n.flag {\n flex: 0 0 auto;\n}\n\n/* The flag of a region is an image: centered on the text, where an emoji sits on its baseline. */\n.regionFlag {\n align-self: center;\n}\n"],"mappings":""}
|
|
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.paletteColor {\n display: inline-flex;\n align-items: center;\n gap: var(--panneau-space-2);\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.files {\n display: inline-flex;\n flex-direction: column;\n gap: var(--panneau-space-1);\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\n/* Several countries. */\n.countries {\n display: inline-flex;\n flex-wrap: wrap;\n gap: var(--panneau-space-1) var(--panneau-space-3);\n}\n\n/* A value after a flag: a country, a region, a phone number. */\n.flagged {\n display: inline-flex;\n align-items: baseline;\n gap: var(--panneau-space-2);\n min-width: 0;\n}\n\n.flag {\n flex: 0 0 auto;\n}\n\n/* The flag of a region is an image: centered on the text, where an emoji sits on its baseline. */\n.regionFlag {\n align-self: center;\n}\n"],"mappings":""}
|
|
@@ -73,8 +73,16 @@ export declare function LinkDisplay({ value }: DisplayProps): import("react").JS
|
|
|
73
73
|
* swatch and its label.
|
|
74
74
|
*/
|
|
75
75
|
export declare function ColorDisplay({ value, field }: DisplayProps): import("react").JSX.Element;
|
|
76
|
-
/**
|
|
76
|
+
/**
|
|
77
|
+
* A thumbnail and the name of a media (or of the first one), for `media` and `image` values:
|
|
78
|
+
* a media reference (`{ id, label, media }`), or a media with its URLs.
|
|
79
|
+
*/
|
|
77
80
|
export declare function MediaDisplay({ value }: DisplayProps): import("react").JSX.Element;
|
|
81
|
+
/**
|
|
82
|
+
* Stored files (`file` values): the thumbnail of an image, or an icon, and the name of each file,
|
|
83
|
+
* linked to its URL.
|
|
84
|
+
*/
|
|
85
|
+
export declare function FileDisplay({ value }: DisplayProps): import("react").JSX.Element;
|
|
78
86
|
/**
|
|
79
87
|
* The built-in displays, by name. A column's display is its `display`, its field's `display`, or
|
|
80
88
|
* its field's type: field types are display names. Values without a known display are shown as
|
|
@@ -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":"AAiBA,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,+BAkBzD;AAED,0BAA0B;AAC1B,wBAAgB,eAAe,CAAC,EAAE,KAAK,EAAE,EAAE,YAAY,+BAetD;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,eAA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BnD;AAED,gDAAgD;AAChD,wBAAgB,eAAe,CAAC,EAAE,KAAK,EAAE,EAAE,YAAY,+BAsBtD;AAED,0FAA0F;AAC1F,wBAAgB,cAAc,CAAC,EAAE,KAAK,EAAE,EAAE,YAAY,+BAsBrD;AAID;;;GAGG;AACH,wBAAgB,WAAW,CAAC,EAAE,KAAK,EAAE,EAAE,YAAY,+BAiClD;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,YAAY,+BA0B1D;AAaD;;;GAGG;AACH,wBAAgB,YAAY,CAAC,EAAE,KAAK,EAAE,EAAE,YAAY,+BAmBnD;AAED;;;GAGG;AACH,wBAAgB,WAAW,CAAC,EAAE,KAAK,EAAE,EAAE,YAAY,+BAwClD;AAED;;;;GAIG;AACH,eAAO,MAAM,eAAe,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,CA+BlE,CAAC"}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { messages } from "../messages.js";
|
|
2
|
-
import { findOption, getFieldOptions, toText } from "../values.js";
|
|
2
|
+
import { findOption, getFieldOptions, isRecord, toText } from "../values.js";
|
|
3
|
+
import { getImageUrl } from "../images.js";
|
|
3
4
|
import Displays_module_default from "./Displays.module.js";
|
|
4
5
|
import { c } from "react/compiler-runtime";
|
|
5
6
|
import { fieldsMessages } from "@panneau/intl";
|
|
6
7
|
import { Badge, Icon, usePanneauIntl } from "@panneau/ui";
|
|
7
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
8
9
|
import { Check, File, FileText, Globe, Hash, Mail, Minus, Phone } from "lucide-react";
|
|
9
10
|
import { toReferences } from "@panneau/fields";
|
|
10
11
|
import { formatAddress, isAddress } from "@panneau/fields/address";
|
|
@@ -1438,12 +1439,27 @@ function ColorDisplay(t0) {
|
|
|
1438
1439
|
} else t3 = $[17];
|
|
1439
1440
|
return t3;
|
|
1440
1441
|
}
|
|
1441
|
-
/**
|
|
1442
|
+
/** The text of a media, a reference or a file: its label, name or file name. */
|
|
1443
|
+
function mediaLabel(value) {
|
|
1444
|
+
for (const key of [
|
|
1445
|
+
"label",
|
|
1446
|
+
"name",
|
|
1447
|
+
"filename"
|
|
1448
|
+
]) {
|
|
1449
|
+
const text = value[key];
|
|
1450
|
+
if (typeof text === "string" && text !== "") return text;
|
|
1451
|
+
}
|
|
1452
|
+
return "";
|
|
1453
|
+
}
|
|
1454
|
+
/**
|
|
1455
|
+
* A thumbnail and the name of a media (or of the first one), for `media` and `image` values:
|
|
1456
|
+
* a media reference (`{ id, label, media }`), or a media with its URLs.
|
|
1457
|
+
*/
|
|
1442
1458
|
function MediaDisplay(t0) {
|
|
1443
|
-
const $ = c(
|
|
1459
|
+
const $ = c(12);
|
|
1444
1460
|
const { value } = t0;
|
|
1445
1461
|
const media = Array.isArray(value) ? value[0] : value;
|
|
1446
|
-
if (media
|
|
1462
|
+
if (!isRecord(media)) {
|
|
1447
1463
|
let t1;
|
|
1448
1464
|
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
1449
1465
|
t1 = /* @__PURE__ */ jsx(EmptyValue, {});
|
|
@@ -1451,46 +1467,133 @@ function MediaDisplay(t0) {
|
|
|
1451
1467
|
} else t1 = $[0];
|
|
1452
1468
|
return t1;
|
|
1453
1469
|
}
|
|
1454
|
-
const { thumbnailUrl, url, name, filename } = media;
|
|
1455
|
-
const source = typeof thumbnailUrl === "string" ? thumbnailUrl : typeof url === "string" ? url : null;
|
|
1456
|
-
const label = typeof name === "string" ? name : typeof filename === "string" ? filename : "";
|
|
1457
1470
|
let t1;
|
|
1458
|
-
if ($[1] !==
|
|
1459
|
-
t1 =
|
|
1460
|
-
|
|
1461
|
-
src: source,
|
|
1462
|
-
alt: ""
|
|
1463
|
-
}) : null;
|
|
1464
|
-
$[1] = source;
|
|
1471
|
+
if ($[1] !== media) {
|
|
1472
|
+
t1 = getImageUrl(media);
|
|
1473
|
+
$[1] = media;
|
|
1465
1474
|
$[2] = t1;
|
|
1466
1475
|
} else t1 = $[2];
|
|
1476
|
+
const source = t1;
|
|
1467
1477
|
let t2;
|
|
1468
|
-
if ($[3] !==
|
|
1469
|
-
t2 =
|
|
1478
|
+
if ($[3] !== media) {
|
|
1479
|
+
t2 = mediaLabel(media);
|
|
1480
|
+
$[3] = media;
|
|
1481
|
+
$[4] = t2;
|
|
1482
|
+
} else t2 = $[4];
|
|
1483
|
+
const label = t2;
|
|
1484
|
+
let t3;
|
|
1485
|
+
if ($[5] !== source) {
|
|
1486
|
+
t3 = source !== null ? /* @__PURE__ */ jsx("img", {
|
|
1487
|
+
className: Displays_module_default.thumbnail,
|
|
1488
|
+
src: source,
|
|
1489
|
+
alt: "",
|
|
1490
|
+
loading: "lazy"
|
|
1491
|
+
}) : null;
|
|
1492
|
+
$[5] = source;
|
|
1493
|
+
$[6] = t3;
|
|
1494
|
+
} else t3 = $[6];
|
|
1495
|
+
let t4;
|
|
1496
|
+
if ($[7] !== label) {
|
|
1497
|
+
t4 = label !== "" ? /* @__PURE__ */ jsx("span", {
|
|
1470
1498
|
className: Displays_module_default.text,
|
|
1471
1499
|
"data-clamp": "",
|
|
1472
1500
|
children: label
|
|
1473
1501
|
}) : null;
|
|
1474
|
-
$[
|
|
1475
|
-
$[
|
|
1476
|
-
} else
|
|
1502
|
+
$[7] = label;
|
|
1503
|
+
$[8] = t4;
|
|
1504
|
+
} else t4 = $[8];
|
|
1505
|
+
let t5;
|
|
1506
|
+
if ($[9] !== t3 || $[10] !== t4) {
|
|
1507
|
+
t5 = /* @__PURE__ */ jsxs("span", {
|
|
1508
|
+
className: Displays_module_default.media,
|
|
1509
|
+
children: [t3, t4]
|
|
1510
|
+
});
|
|
1511
|
+
$[9] = t3;
|
|
1512
|
+
$[10] = t4;
|
|
1513
|
+
$[11] = t5;
|
|
1514
|
+
} else t5 = $[11];
|
|
1515
|
+
return t5;
|
|
1516
|
+
}
|
|
1517
|
+
/**
|
|
1518
|
+
* Stored files (`file` values): the thumbnail of an image, or an icon, and the name of each file,
|
|
1519
|
+
* linked to its URL.
|
|
1520
|
+
*/
|
|
1521
|
+
function FileDisplay(t0) {
|
|
1522
|
+
const $ = c(8);
|
|
1523
|
+
const { value } = t0;
|
|
1524
|
+
let t1;
|
|
1525
|
+
let t2;
|
|
1477
1526
|
let t3;
|
|
1527
|
+
if ($[0] !== value) {
|
|
1528
|
+
t3 = Symbol.for("react.early_return_sentinel");
|
|
1529
|
+
bb0: {
|
|
1530
|
+
const files = (Array.isArray(value) ? value : [value]).filter(isRecord);
|
|
1531
|
+
if (files.length === 0) {
|
|
1532
|
+
let t4;
|
|
1533
|
+
if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
|
|
1534
|
+
t4 = /* @__PURE__ */ jsx(EmptyValue, {});
|
|
1535
|
+
$[4] = t4;
|
|
1536
|
+
} else t4 = $[4];
|
|
1537
|
+
t3 = t4;
|
|
1538
|
+
break bb0;
|
|
1539
|
+
}
|
|
1540
|
+
t1 = Displays_module_default.files;
|
|
1541
|
+
t2 = files.map(_temp5);
|
|
1542
|
+
}
|
|
1543
|
+
$[0] = value;
|
|
1544
|
+
$[1] = t1;
|
|
1545
|
+
$[2] = t2;
|
|
1546
|
+
$[3] = t3;
|
|
1547
|
+
} else {
|
|
1548
|
+
t1 = $[1];
|
|
1549
|
+
t2 = $[2];
|
|
1550
|
+
t3 = $[3];
|
|
1551
|
+
}
|
|
1552
|
+
if (t3 !== Symbol.for("react.early_return_sentinel")) return t3;
|
|
1553
|
+
let t4;
|
|
1478
1554
|
if ($[5] !== t1 || $[6] !== t2) {
|
|
1479
|
-
|
|
1480
|
-
className:
|
|
1481
|
-
children:
|
|
1555
|
+
t4 = /* @__PURE__ */ jsx("span", {
|
|
1556
|
+
className: t1,
|
|
1557
|
+
children: t2
|
|
1482
1558
|
});
|
|
1483
1559
|
$[5] = t1;
|
|
1484
1560
|
$[6] = t2;
|
|
1485
|
-
$[7] =
|
|
1486
|
-
} else
|
|
1487
|
-
return
|
|
1561
|
+
$[7] = t4;
|
|
1562
|
+
} else t4 = $[7];
|
|
1563
|
+
return t4;
|
|
1488
1564
|
}
|
|
1489
1565
|
/**
|
|
1490
1566
|
* The built-in displays, by name. A column's display is its `display`, its field's `display`, or
|
|
1491
1567
|
* its field's type: field types are display names. Values without a known display are shown as
|
|
1492
1568
|
* text.
|
|
1493
1569
|
*/
|
|
1570
|
+
function _temp5(file, index) {
|
|
1571
|
+
const image = getImageUrl(file);
|
|
1572
|
+
const name = mediaLabel(file);
|
|
1573
|
+
const content = /* @__PURE__ */ jsxs(Fragment, { children: [image !== null ? /* @__PURE__ */ jsx("img", {
|
|
1574
|
+
className: Displays_module_default.thumbnail,
|
|
1575
|
+
src: image,
|
|
1576
|
+
alt: "",
|
|
1577
|
+
loading: "lazy"
|
|
1578
|
+
}) : /* @__PURE__ */ jsx(Icon, {
|
|
1579
|
+
icon: File,
|
|
1580
|
+
size: "sm"
|
|
1581
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
1582
|
+
className: Displays_module_default.text,
|
|
1583
|
+
"data-clamp": "",
|
|
1584
|
+
children: name !== "" ? name : typeof file.url === "string" ? file.url : ""
|
|
1585
|
+
})] });
|
|
1586
|
+
return typeof file.url === "string" && file.url !== "" ? /* @__PURE__ */ jsx("a", {
|
|
1587
|
+
className: `${Displays_module_default.link} ${Displays_module_default.media}`,
|
|
1588
|
+
href: file.url,
|
|
1589
|
+
target: "_blank",
|
|
1590
|
+
rel: "noreferrer",
|
|
1591
|
+
children: content
|
|
1592
|
+
}, index) : /* @__PURE__ */ jsx("span", {
|
|
1593
|
+
className: Displays_module_default.media,
|
|
1594
|
+
children: content
|
|
1595
|
+
}, index);
|
|
1596
|
+
}
|
|
1494
1597
|
var builtInDisplays = {
|
|
1495
1598
|
text: TextDisplay,
|
|
1496
1599
|
textarea: TextDisplay,
|
|
@@ -1507,6 +1610,8 @@ var builtInDisplays = {
|
|
|
1507
1610
|
email: EmailDisplay,
|
|
1508
1611
|
color: ColorDisplay,
|
|
1509
1612
|
media: MediaDisplay,
|
|
1613
|
+
image: MediaDisplay,
|
|
1614
|
+
file: FileDisplay,
|
|
1510
1615
|
tel: TelDisplay,
|
|
1511
1616
|
range: NumberDisplay,
|
|
1512
1617
|
duration: DurationDisplay,
|
|
@@ -1522,6 +1627,6 @@ var builtInDisplays = {
|
|
|
1522
1627
|
money: MoneyDisplay
|
|
1523
1628
|
};
|
|
1524
1629
|
//#endregion
|
|
1525
|
-
export { AddressDisplay, BooleanDisplay, ColorDisplay, CountryDisplay, DateDisplay, DateRangeDisplay, DateTimeDisplay, DurationDisplay, EmailDisplay, EmbedDisplay, EmptyValue, JsonDisplay, LinkDisplay, LocationDisplay, MediaDisplay, MoneyDisplay, NumberDisplay, RegionDisplay, RelationDisplay, RichTextDisplay, SelectDisplay, TagsDisplay, TelDisplay, TextDisplay, TimeDisplay, UrlDisplay, builtInDisplays };
|
|
1630
|
+
export { AddressDisplay, BooleanDisplay, ColorDisplay, CountryDisplay, DateDisplay, DateRangeDisplay, DateTimeDisplay, DurationDisplay, EmailDisplay, EmbedDisplay, EmptyValue, FileDisplay, JsonDisplay, LinkDisplay, LocationDisplay, MediaDisplay, MoneyDisplay, NumberDisplay, RegionDisplay, RelationDisplay, RichTextDisplay, SelectDisplay, TagsDisplay, TelDisplay, TextDisplay, TimeDisplay, UrlDisplay, builtInDisplays };
|
|
1526
1631
|
|
|
1527
1632
|
//# sourceMappingURL=displays.js.map
|