@protobase/ui 0.63.4 → 0.64.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/account/change-email-dialog.js +1 -1
- package/dist/account/devices-section.js +12 -6
- package/dist/account/messages.js +2 -333
- package/dist/account/passkeys-section.js +3 -3
- package/dist/account/password-change-dialog.js +3 -3
- package/dist/account/sign-in-policy-form.js +6 -3
- package/dist/account/sign-in-providers-section.js +1 -1
- package/dist/account/staff-sign-in-log.js +5 -5
- package/dist/action-card/messages.js +2 -5
- package/dist/activity-chart/activity-chart.js +5 -7
- package/dist/activity-chart/activity-tooltip.js +1 -1
- package/dist/activity-chart/messages.js +2 -11
- package/dist/app/app.js +2 -3
- package/dist/app/batch-failure.js +5 -1
- package/dist/app/change-confirm/messages.js +2 -13
- package/dist/app/change-confirm/use-change-confirm.js +15 -18
- package/dist/app/charts/chart-groups.js +3 -1
- package/dist/app/charts/chart-view.js +1 -1
- package/dist/app/charts/group-bars.js +1 -1
- package/dist/app/charts/messages.js +2 -23
- package/dist/app/charts/period-chart.js +1 -1
- package/dist/app/comments/comment-composer.js +1 -1
- package/dist/app/comments/comments-section.js +2 -2
- package/dist/app/comments/messages.js +2 -19
- package/dist/app/confirm-sign-in-messages.js +2 -19
- package/dist/app/confirm-sign-in.js +1 -1
- package/dist/app/create/create-page.js +3 -3
- package/dist/app/create/create-record-form.js +3 -3
- package/dist/app/create/create-route.js +1 -1
- package/dist/app/create/messages.js +2 -29
- package/dist/app/custom-section.js +2 -3
- package/dist/app/delete/blocked-delete.js +5 -2
- package/dist/app/delete/dialogs.js +21 -8
- package/dist/app/delete/messages.js +2 -63
- package/dist/app/delete/use-delete-flow.js +6 -5
- package/dist/app/displays/board-column.js +2 -2
- package/dist/app/displays/board-columns.js +1 -1
- package/dist/app/displays/board-display.js +21 -9
- package/dist/app/displays/calendar-display.js +16 -7
- package/dist/app/displays/cards-display.js +2 -2
- package/dist/app/displays/custom-display.js +1 -2
- package/dist/app/displays/list-cards.js +2 -2
- package/dist/app/displays/map-display.js +19 -6
- package/dist/app/displays/messages.js +2 -147
- package/dist/app/displays/period-controls.js +2 -2
- package/dist/app/displays/timeline-display.js +16 -7
- package/dist/app/displays/timeline-range.js +1 -1
- package/dist/app/displays/use-board-move.js +4 -4
- package/dist/app/displays/use-calendar-move.js +2 -2
- package/dist/app/document-title.js +1 -1
- package/dist/app/embedded-list/cut-off-note.js +7 -1
- package/dist/app/embedded-list/embedded-list.js +1 -1
- package/dist/app/embedded-list/embedded-row-targets.js +3 -3
- package/dist/app/embedded-list/messages.js +2 -21
- package/dist/app/export/builder-port.js +1 -1
- package/dist/app/export/export-dialog.js +14 -8
- package/dist/app/export/messages.js +2 -75
- package/dist/app/export/use-export-flow.js +9 -3
- package/dist/app/field-editor.js +3 -3
- package/dist/app/field-errors.js +18 -7
- package/dist/app/field-messages.js +2 -45
- package/dist/app/field-types/members/messages.js +2 -15
- package/dist/app/field-types/messages.js +2 -5
- package/dist/app/field-types/widget-part.js +1 -1
- package/dist/app/file-field.js +3 -3
- package/dist/app/gallery/gallery-section.js +6 -3
- package/dist/app/gallery/messages.js +2 -27
- package/dist/app/gallery/photo-details.js +3 -3
- package/dist/app/hand-order/hand-sorted-list.js +2 -3
- package/dist/app/hand-order/messages.js +2 -29
- package/dist/app/hand-order/use-hand-order.js +2 -2
- package/dist/app/history/describe-change.js +1 -1
- package/dist/app/history/history-section.js +1 -1
- package/dist/app/history/messages.js +2 -29
- package/dist/app/import/convert.js +19 -10
- package/dist/app/import/import-check-step.js +5 -5
- package/dist/app/import/import-dialog.js +5 -2
- package/dist/app/import/import-file-step.js +1 -1
- package/dist/app/import/import-mapping-step.js +3 -3
- package/dist/app/import/messages.js +2 -197
- package/dist/app/import/prepare-rows.js +11 -4
- package/dist/app/import/sheet-cell.js +1 -1
- package/dist/app/import/xlsx-reader.js +2 -2
- package/dist/app/import/zip-reader.js +4 -1
- package/dist/app/incoming-card.js +1 -1
- package/dist/app/list-actions/use-list-actions.js +4 -1
- package/dist/app/list-edit/messages.js +2 -11
- package/dist/app/list-edit/use-list-edits.js +1 -1
- package/dist/app/list-empty-state.js +7 -4
- package/dist/app/list-group-chart.js +1 -1
- package/dist/app/list-messages.js +2 -53
- package/dist/app/list-page.js +9 -9
- package/dist/app/live-update/messages.js +2 -11
- package/dist/app/map/messages.js +2 -11
- package/dist/app/messages.js +2 -139
- package/dist/app/meta-gate-messages.js +2 -13
- package/dist/app/nav-from-meta.js +2 -2
- package/dist/app/new-version/messages.js +2 -21
- package/dist/app/new-version/new-version-banner.js +1 -2
- package/dist/app/new-version/new-version-toast.js +1 -1
- package/dist/app/pages/action-inputs/action-inputs-dialog.js +1 -1
- package/dist/app/pages/action-inputs/input-answers.js +1 -1
- package/dist/app/pages/blocks/field.js +1 -1
- package/dist/app/pages/blocks/modal-form.js +3 -3
- package/dist/app/pages/blocks/settings.js +3 -3
- package/dist/app/pages/blocks/tabs.js +1 -1
- package/dist/app/pages/composed-page.js +1 -2
- package/dist/app/pages/custom-boundary.js +1 -2
- package/dist/app/pages/messages.js +2 -79
- package/dist/app/pages/record-actions.js +1 -1
- package/dist/app/pages/render-node.js +2 -3
- package/dist/app/pages/use-run-action.js +15 -7
- package/dist/app/picker/picker-combobox.js +1 -1
- package/dist/app/rank-after/dependency-rule.js +8 -2
- package/dist/app/rank-after/messages.js +2 -5
- package/dist/app/rank-after/ranked-place.js +7 -1
- package/dist/app/record-chart/messages.js +2 -25
- package/dist/app/record-chart/record-chart-section.js +2 -2
- package/dist/app/record-lines-cell.js +4 -1
- package/dist/app/record-lines.js +5 -5
- package/dist/app/record-messages.js +2 -83
- package/dist/app/record-page.js +8 -8
- package/dist/app/record-row/messages.js +2 -23
- package/dist/app/record-row/record-row-body.js +2 -2
- package/dist/app/record-row/record-row.js +3 -3
- package/dist/app/record-row/saved-record-row.js +3 -3
- package/dist/app/related-cards/messages.js +2 -15
- package/dist/app/related-cards/related-card.js +1 -1
- package/dist/app/related-cards/related-cards.js +1 -1
- package/dist/app/related-dots/dots-summary.js +1 -1
- package/dist/app/related-dots/messages.js +2 -5
- package/dist/app/related-dots/related-dots.js +2 -3
- package/dist/app/related-section.js +1 -1
- package/dist/app/relation-picker.js +1 -1
- package/dist/app/runtime/messages.js +2 -55
- package/dist/app/runtime/runtime-status.js +12 -3
- package/dist/app/saved/messages.js +2 -19
- package/dist/app/saved/saved-list.js +3 -3
- package/dist/app/search/messages.js +2 -19
- package/dist/app/search/navigation-hits.js +1 -1
- package/dist/app/search/search-model.js +9 -3
- package/dist/app/searches/messages.js +2 -93
- package/dist/app/searches/save-search-button.js +3 -3
- package/dist/app/searches/saved-search-rows.js +3 -3
- package/dist/app/searches/saved-search-section.js +4 -4
- package/dist/app/searches/saved-searches.js +14 -12
- package/dist/app/searches/search-controls.js +2 -2
- package/dist/app/searches/search-diff.js +8 -2
- package/dist/app/searches/update-search-dialog.js +10 -4
- package/dist/app/searches/use-save-search.js +2 -2
- package/dist/app/searches/use-search-row.js +2 -2
- package/dist/app/sensitive-field.js +3 -3
- package/dist/app/source-notice.js +3 -3
- package/dist/app/staff-banner.js +12 -8
- package/dist/app/use-live-save.js +2 -2
- package/dist/app/value-badge.js +3 -4
- package/dist/app-shell/global-search.js +2 -2
- package/dist/app-shell/messages.js +2 -63
- package/dist/app-shell/profile-menu.js +2 -2
- package/dist/app-shell/sidebar-group.js +2 -2
- package/dist/app-shell/sidebar.js +1 -2
- package/dist/app-shell/top-bar.js +1 -1
- package/dist/assistant-dock/messages.js +2 -23
- package/dist/auth/auth-gate.js +1 -1
- package/dist/auth/auth-messages.js +9 -88
- package/dist/auth/email-code-form.js +2 -3
- package/dist/auth/forgot-password-form.js +3 -4
- package/dist/auth/messages.js +2 -203
- package/dist/auth/provider-sign-in-page.js +3 -3
- package/dist/auth/resend-code-button.js +1 -1
- package/dist/auth/reset-password-form.js +1 -1
- package/dist/auth/reset-password-page.js +1 -1
- package/dist/auth/sign-in-form.js +3 -3
- package/dist/auth/sign-up-code-form.js +2 -3
- package/dist/auth/sign-up-details-form.js +3 -4
- package/dist/auth/staff-sign-in-form.js +3 -3
- package/dist/calls/call-guests-panel.js +2 -2
- package/dist/calls/call-lobby-notice.js +1 -1
- package/dist/calls/call-mark.js +1 -1
- package/dist/calls/call-people.js +1 -1
- package/dist/calls/call-rings.js +1 -1
- package/dist/calls/call-tile.js +2 -2
- package/dist/calls/messages.js +2 -139
- package/dist/carousel/carousel-controls.js +4 -1
- package/dist/carousel/messages.js +2 -13
- package/dist/chat/chat-message.js +1 -1
- package/dist/chat/messages.js +2 -19
- package/dist/compact-table/compact-table.js +1 -1
- package/dist/compact-table/messages.js +2 -15
- package/dist/data-grid/cell-text.js +8 -7
- package/dist/data-grid/cells.js +9 -6
- package/dist/data-grid/grid-footer.js +1 -1
- package/dist/data-grid/grid-row.js +2 -2
- package/dist/data-grid/header-menu.js +1 -1
- package/dist/data-grid/messages.js +2 -49
- package/dist/data-grid/resize-handle.js +1 -1
- package/dist/data-grid/row-reorder.js +20 -5
- package/dist/filter-panel/active-filter-chips.js +1 -1
- package/dist/filter-panel/date-presets.js +2 -2
- package/dist/filter-panel/facet-combobox.js +1 -1
- package/dist/filter-panel/facet-group.js +1 -1
- package/dist/filter-panel/messages.js +2 -49
- package/dist/filter-panel/range-filter.js +1 -1
- package/dist/format/date.js +4 -4
- package/dist/format/messages.js +2 -21
- package/dist/format/money.js +1 -1
- package/dist/format/number.js +5 -2
- package/dist/forms/messages.js +2 -21
- package/dist/forms/public-form-page.js +1 -1
- package/dist/index.js +3 -3
- package/dist/inline-child-table/inline-child-table.js +19 -4
- package/dist/inline-child-table/line-row.js +2 -2
- package/dist/inline-child-table/messages.js +2 -51
- package/dist/invitations/link-notice.js +2 -3
- package/dist/invitations/messages.js +2 -21
- package/dist/invitations/pending-invitation-row.js +1 -1
- package/dist/lists/messages.js +2 -5
- package/dist/live/columns-from-model.js +14 -31
- package/dist/live/display-value.js +1 -1
- package/dist/live/messages.js +2 -15
- package/dist/live/value-color.js +13 -3
- package/dist/live/view-fields.js +4 -2
- package/dist/locale/en.js +1399 -0
- package/dist/locale/messages.js +38 -7
- package/dist/locale/nl.js +1399 -0
- package/dist/markdown/messages.js +2 -13
- package/dist/mentions/messages.js +2 -13
- package/dist/notifications/bell/messages.js +2 -35
- package/dist/notifications/bell/notification-item.js +1 -1
- package/dist/notifications/bell/unread-label.js +1 -1
- package/dist/organizations/invitation-page.js +32 -14
- package/dist/organizations/invitations-page.js +1 -1
- package/dist/organizations/members-page.js +2 -2
- package/dist/organizations/messages.js +2 -187
- package/dist/organizations/organization-page.js +4 -4
- package/dist/organizations/organizations-page.js +1 -1
- package/dist/package.js +1 -1
- package/dist/plugins/load-plugin.js +2 -2
- package/dist/plugins/messages.js +2 -33
- package/dist/plugins/plugin-notice.js +7 -5
- package/dist/primitives/badge.d.ts +2 -1
- package/dist/primitives/dialog.d.ts +7 -2
- package/dist/primitives/dialog.js +9 -4
- package/dist/primitives/messages.js +2 -13
- package/dist/primitives/token.js +1 -1
- package/dist/record-view/field.js +3 -3
- package/dist/record-view/messages.js +2 -37
- package/dist/record-view/record-header.js +4 -4
- package/dist/roles/messages.js +2 -11
- package/dist/shell/assets/app-CN_7en9q.js +8 -0
- package/dist/shell/assets/{calls-BIXaKTs0.js → calls-D5RK7EJu.js} +2 -2
- package/dist/shell/assets/export-worker-ClXdfeuq.js +15 -0
- package/dist/shell/assets/{index-BshKxX1Z.js → index-DMaCBpbN.js} +2 -2
- package/dist/shell/assets/index-Or2wt-ck.css +2 -0
- package/dist/shell/assets/{maplibre-CjNYwEqW.js → maplibre-CRmpQfDl.js} +3 -3
- package/dist/shell/assets/parse-worker-DxsmAjef.js +18 -0
- package/dist/shell/assets/preload-helper-BgLOXTzV.js +2 -0
- package/dist/shell/assets/{record-map-DjqQGqZ2.js → record-map-DsP4sXes.js} +2 -2
- package/dist/shell/assets/{records-map-D1SJKyvj.js → records-map-WFMHgKdf.js} +2 -2
- package/dist/shell/assets/shared-protobase-ui-CP2mMFbh.js +2 -0
- package/dist/shell/assets/vendor-Kvdo8Jrw.js +73 -0
- package/dist/shell/index.html +6 -6
- package/dist/shell/protobase.shell.json +2 -2
- package/dist/shell/protobase.sw.js +2 -2
- package/dist/shell-source-maps/assets/app-CN_7en9q.js.map +1 -0
- package/dist/shell-source-maps/assets/{calls-BIXaKTs0.js.map → calls-D5RK7EJu.js.map} +1 -1
- package/dist/shell-source-maps/assets/export-worker-ClXdfeuq.js.map +1 -0
- package/dist/shell-source-maps/assets/{index-BshKxX1Z.js.map → index-DMaCBpbN.js.map} +1 -1
- package/dist/shell-source-maps/assets/{maplibre-CjNYwEqW.js.map → maplibre-CRmpQfDl.js.map} +1 -1
- package/dist/shell-source-maps/assets/parse-worker-DxsmAjef.js.map +1 -0
- package/dist/shell-source-maps/assets/preload-helper-BgLOXTzV.js.map +1 -0
- package/dist/shell-source-maps/assets/{record-map-DjqQGqZ2.js.map → record-map-DsP4sXes.js.map} +1 -1
- package/dist/shell-source-maps/assets/{records-map-D1SJKyvj.js.map → records-map-WFMHgKdf.js.map} +1 -1
- package/dist/shell-source-maps/assets/shared-protobase-ui-CP2mMFbh.js.map +1 -0
- package/dist/shell-source-maps/assets/vendor-Kvdo8Jrw.js.map +1 -0
- package/dist/side-panel/messages.js +2 -5
- package/dist/status/messages.js +2 -59
- package/dist/status/status-dialog.js +1 -1
- package/dist/toasts/messages.js +2 -5
- package/dist/users/create-user-form.js +1 -1
- package/dist/users/messages.js +2 -49
- package/package.json +5 -4
- package/dist/app-shell/nav.js +0 -85
- package/dist/locale/slotted.js +0 -14
- package/dist/mocks/activity.js +0 -24
- package/dist/mocks/rng.js +0 -20
- package/dist/mocks/users.js +0 -63
- package/dist/shell/assets/app-CBYlZ19-.js +0 -9
- package/dist/shell/assets/export-worker-3e4Zsv0a.js +0 -3
- package/dist/shell/assets/index-BvT0X9o1.css +0 -2
- package/dist/shell/assets/parse-worker-UhbwEjS0.js +0 -6
- package/dist/shell/assets/preload-helper-SYSsmQ2O.js +0 -2
- package/dist/shell/assets/shared-protobase-ui-DibYt-TM.js +0 -2
- package/dist/shell/assets/vendor-xNCj9Gc_.js +0 -63
- package/dist/shell-source-maps/assets/app-CBYlZ19-.js.map +0 -1
- package/dist/shell-source-maps/assets/export-worker-3e4Zsv0a.js.map +0 -1
- package/dist/shell-source-maps/assets/parse-worker-UhbwEjS0.js.map +0 -1
- package/dist/shell-source-maps/assets/preload-helper-SYSsmQ2O.js.map +0 -1
- package/dist/shell-source-maps/assets/shared-protobase-ui-DibYt-TM.js.map +0 -1
- package/dist/shell-source-maps/assets/vendor-xNCj9Gc_.js.map +0 -1
|
@@ -1,52 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { messages } from "../locale/messages.js";
|
|
2
2
|
//#region src/filter-panel/messages.ts
|
|
3
|
-
const text =
|
|
4
|
-
en: {
|
|
5
|
-
today: "Today",
|
|
6
|
-
yesterday: "Yesterday",
|
|
7
|
-
"24h": "Last 24 hours",
|
|
8
|
-
"7d": "Last 7 days",
|
|
9
|
-
"30d": "Last 30 days",
|
|
10
|
-
"90d": "Last 90 days",
|
|
11
|
-
month: "This month",
|
|
12
|
-
quarter: "This quarter",
|
|
13
|
-
year: "This year",
|
|
14
|
-
unknownPreset: (id) => `The server offers the preset "${id}", which this UI does not know`,
|
|
15
|
-
unsupported: (id) => `${id} (unsupported)`,
|
|
16
|
-
remove: (label) => `Remove ${label}`,
|
|
17
|
-
clearAll: "Clear all",
|
|
18
|
-
searchIn: (label) => `Search ${label.toLowerCase()}`,
|
|
19
|
-
noMatches: "No matches",
|
|
20
|
-
moreFilters: "More filters",
|
|
21
|
-
filters: "Filters",
|
|
22
|
-
date: "Date",
|
|
23
|
-
showOnly: "Show only",
|
|
24
|
-
minimum: (label) => `${label} minimum`,
|
|
25
|
-
maximum: (label) => `${label} maximum`
|
|
26
|
-
},
|
|
27
|
-
nl: {
|
|
28
|
-
today: "Vandaag",
|
|
29
|
-
yesterday: "Gisteren",
|
|
30
|
-
"24h": "Afgelopen 24 uur",
|
|
31
|
-
"7d": "Afgelopen 7 dagen",
|
|
32
|
-
"30d": "Afgelopen 30 dagen",
|
|
33
|
-
"90d": "Afgelopen 90 dagen",
|
|
34
|
-
month: "Deze maand",
|
|
35
|
-
quarter: "Dit kwartaal",
|
|
36
|
-
year: "Dit jaar",
|
|
37
|
-
unknownPreset: (id) => `De server biedt de periode "${id}", die deze UI niet kent`,
|
|
38
|
-
unsupported: (id) => `${id} (niet ondersteund)`,
|
|
39
|
-
remove: (label) => `${label} verwijderen`,
|
|
40
|
-
clearAll: "Alles wissen",
|
|
41
|
-
searchIn: (label) => `Zoeken in ${label.toLowerCase()}`,
|
|
42
|
-
noMatches: "Niets gevonden",
|
|
43
|
-
moreFilters: "Meer filters",
|
|
44
|
-
filters: "Filters",
|
|
45
|
-
date: "Datum",
|
|
46
|
-
showOnly: "Alleen tonen",
|
|
47
|
-
minimum: (label) => `${label} minimum`,
|
|
48
|
-
maximum: (label) => `${label} maximum`
|
|
49
|
-
}
|
|
50
|
-
});
|
|
3
|
+
const text = messages("filter-panel");
|
|
51
4
|
//#endregion
|
|
52
5
|
export { text };
|
|
@@ -49,7 +49,7 @@ const RangeFilter = ({ config, value, onChange }) => {
|
|
|
49
49
|
children: [0, 1].map((thumb) => /* @__PURE__ */ jsx("input", {
|
|
50
50
|
type: "range",
|
|
51
51
|
className: "pb-range",
|
|
52
|
-
"aria-label": thumb === 0 ? text("minimum", config.label) : text("maximum", config.label),
|
|
52
|
+
"aria-label": thumb === 0 ? text("minimum", { label: config.label }) : text("maximum", { label: config.label }),
|
|
53
53
|
min,
|
|
54
54
|
max,
|
|
55
55
|
step,
|
package/dist/format/date.js
CHANGED
|
@@ -63,10 +63,10 @@ const formatDayRange = (from, to) => day().formatRange(from, to);
|
|
|
63
63
|
/** "09:30": an instant's time on the clock of `zone`, the viewer's unless given. */
|
|
64
64
|
const formatTime = (ms, zone = viewerZone()) => zonedFormats(zone).time.format(ms);
|
|
65
65
|
const formatAgo = (seconds) => {
|
|
66
|
-
if (seconds < 60) return text("secondsAgo", seconds);
|
|
67
|
-
if (seconds < 3600) return text("minutesAgo", Math.floor(seconds / 60));
|
|
68
|
-
if (seconds < 86400) return text("hoursAgo", Math.floor(seconds / 3600));
|
|
69
|
-
return text("daysAgo", Math.floor(seconds / 86400));
|
|
66
|
+
if (seconds < 60) return text("secondsAgo", { count: seconds });
|
|
67
|
+
if (seconds < 3600) return text("minutesAgo", { count: Math.floor(seconds / 60) });
|
|
68
|
+
if (seconds < 86400) return text("hoursAgo", { count: Math.floor(seconds / 3600) });
|
|
69
|
+
return text("daysAgo", { count: Math.floor(seconds / 86400) });
|
|
70
70
|
};
|
|
71
71
|
const relative = () => cachedFormat("relative", (tag) => new Intl.RelativeTimeFormat(tag, { numeric: "auto" }));
|
|
72
72
|
const units = [
|
package/dist/format/messages.js
CHANGED
|
@@ -1,24 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { messages } from "../locale/messages.js";
|
|
2
2
|
//#region src/format/messages.ts
|
|
3
|
-
const text =
|
|
4
|
-
en: {
|
|
5
|
-
rows: (count, one) => `${count} ${one ? "row" : "rows"}`,
|
|
6
|
-
aboutRows: (count) => `about ${count} rows`,
|
|
7
|
-
secondsAgo: (count) => `${count} s ago`,
|
|
8
|
-
minutesAgo: (count) => `${count} min ago`,
|
|
9
|
-
hoursAgo: (count) => `${count} h ago`,
|
|
10
|
-
daysAgo: (count) => `${count} d ago`,
|
|
11
|
-
justNow: "just now"
|
|
12
|
-
},
|
|
13
|
-
nl: {
|
|
14
|
-
rows: (count, one) => `${count} ${one ? "rij" : "rijen"}`,
|
|
15
|
-
aboutRows: (count) => `ongeveer ${count} rijen`,
|
|
16
|
-
secondsAgo: (count) => `${count} s geleden`,
|
|
17
|
-
minutesAgo: (count) => `${count} min geleden`,
|
|
18
|
-
hoursAgo: (count) => `${count} u geleden`,
|
|
19
|
-
daysAgo: (count) => `${count} d geleden`,
|
|
20
|
-
justNow: "zojuist"
|
|
21
|
-
}
|
|
22
|
-
});
|
|
3
|
+
const text = messages("format");
|
|
23
4
|
//#endregion
|
|
24
5
|
export { text };
|
package/dist/format/money.js
CHANGED
|
@@ -9,6 +9,6 @@ const formatterFor = (currency, decimals) => cachedFormat(`money:${currency}:${d
|
|
|
9
9
|
}
|
|
10
10
|
}));
|
|
11
11
|
/** An amount in cents in the currency, with its usual decimals or `decimals` of them. */
|
|
12
|
-
const formatMoney = (cents, currency
|
|
12
|
+
const formatMoney = (cents, currency, decimals) => formatterFor(currency, decimals).format(cents / 100);
|
|
13
13
|
//#endregion
|
|
14
14
|
export { formatMoney };
|
package/dist/format/number.js
CHANGED
|
@@ -6,9 +6,12 @@ const formatInt = (value) => grouped().format(value);
|
|
|
6
6
|
const formatSigned = (value) => value > 0 ? `+${grouped().format(value)}` : grouped().format(value).replace("-", "−");
|
|
7
7
|
const formatPercent = (value) => `${value}%`;
|
|
8
8
|
const formatApproxRows = (count) => {
|
|
9
|
-
if (count < 1e4) return text("rows",
|
|
9
|
+
if (count < 1e4) return text("rows", {
|
|
10
|
+
count: formatInt(count),
|
|
11
|
+
n: count
|
|
12
|
+
});
|
|
10
13
|
const magnitude = 10 ** (Math.floor(Math.log10(count)) - 3);
|
|
11
|
-
return text("aboutRows", formatInt(Math.round(count / magnitude) * magnitude));
|
|
14
|
+
return text("aboutRows", { count: formatInt(Math.round(count / magnitude) * magnitude) });
|
|
12
15
|
};
|
|
13
16
|
//#endregion
|
|
14
17
|
export { formatApproxRows, formatInt, formatPercent, formatSigned };
|
package/dist/forms/messages.js
CHANGED
|
@@ -1,24 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { messages } from "../locale/messages.js";
|
|
2
2
|
//#region src/forms/messages.ts
|
|
3
|
-
const text =
|
|
4
|
-
en: {
|
|
5
|
-
loading: "Loading",
|
|
6
|
-
notFound: "Not found",
|
|
7
|
-
noForm: "There is no form at this address.",
|
|
8
|
-
setByDatabase: "Set by the database",
|
|
9
|
-
notSent: "Not sent",
|
|
10
|
-
send: "Send",
|
|
11
|
-
checkTooLong: "The check that you are not a bot took too long; send the form again"
|
|
12
|
-
},
|
|
13
|
-
nl: {
|
|
14
|
-
loading: "Laden",
|
|
15
|
-
notFound: "Niet gevonden",
|
|
16
|
-
noForm: "Er is geen formulier op dit adres.",
|
|
17
|
-
setByDatabase: "Ingevuld door de database",
|
|
18
|
-
notSent: "Niet verzonden",
|
|
19
|
-
send: "Verzenden",
|
|
20
|
-
checkTooLong: "De controle of je geen bot bent duurde te lang; verzend het formulier opnieuw"
|
|
21
|
-
}
|
|
22
|
-
});
|
|
3
|
+
const text = messages("forms");
|
|
23
4
|
//#endregion
|
|
24
5
|
export { text };
|
|
@@ -4,8 +4,8 @@ import { Spinner } from "../primitives/spinner.js";
|
|
|
4
4
|
import { text } from "../app/meta-gate-messages.js";
|
|
5
5
|
import { Notice } from "../app/meta-gate.js";
|
|
6
6
|
import { Button } from "../primitives/button.js";
|
|
7
|
-
import { Field } from "../record-view/field.js";
|
|
8
7
|
import { humanize } from "../live/naming.js";
|
|
8
|
+
import { Field } from "../record-view/field.js";
|
|
9
9
|
import { createBody, hasDatabaseDefault, initialDraft, isRequired, numberDefault } from "../app/create/create-values.js";
|
|
10
10
|
import { ErrorBanner } from "../app/error-banner.js";
|
|
11
11
|
import { FieldEditor } from "../app/field-editor.js";
|
package/dist/index.js
CHANGED
|
@@ -4,12 +4,12 @@ import { Spinner } from "./primitives/spinner.js";
|
|
|
4
4
|
import { Button, buttonClass } from "./primitives/button.js";
|
|
5
5
|
import { Dialog } from "./primitives/dialog.js";
|
|
6
6
|
import { ResponsiveDialog } from "./primitives/responsive-dialog.js";
|
|
7
|
-
import { useFieldControl } from "./primitives/field-control.js";
|
|
8
|
-
import { Input } from "./primitives/input.js";
|
|
9
|
-
import { Field } from "./record-view/field.js";
|
|
10
7
|
import { Section } from "./record-view/section.js";
|
|
11
8
|
import { AppLink, useAppAddress } from "./app/use-app-address.js";
|
|
12
9
|
import { Segmented } from "./primitives/segmented.js";
|
|
10
|
+
import { useFieldControl } from "./primitives/field-control.js";
|
|
11
|
+
import { Field } from "./record-view/field.js";
|
|
12
|
+
import { Input } from "./primitives/input.js";
|
|
13
13
|
import { Textarea } from "./primitives/textarea.js";
|
|
14
14
|
import { useList } from "./data/use-list.js";
|
|
15
15
|
import { statusRefreshMs, useOwnStatus, useStatuses } from "./status/use-statuses.js";
|
|
@@ -17,10 +17,25 @@ const announcementsFor = (lines, lineName) => {
|
|
|
17
17
|
};
|
|
18
18
|
const place = (id) => lines.findIndex((line) => line.id === id) + 1;
|
|
19
19
|
return {
|
|
20
|
-
onDragStart: ({ active }) => text("pickedUp",
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
20
|
+
onDragStart: ({ active }) => text("pickedUp", {
|
|
21
|
+
name: name(active.id),
|
|
22
|
+
place: place(active.id),
|
|
23
|
+
count: lines.length
|
|
24
|
+
}),
|
|
25
|
+
onDragOver: ({ active, over }) => over ? text("over", {
|
|
26
|
+
name: name(active.id),
|
|
27
|
+
place: place(over.id),
|
|
28
|
+
count: lines.length
|
|
29
|
+
}) : void 0,
|
|
30
|
+
onDragEnd: ({ active, over }) => over ? text("dropped", {
|
|
31
|
+
name: name(active.id),
|
|
32
|
+
place: place(over.id),
|
|
33
|
+
count: lines.length
|
|
34
|
+
}) : text("droppedAtStart", { name: name(active.id) }),
|
|
35
|
+
onDragCancel: ({ active }) => text("cancelled", {
|
|
36
|
+
name: name(active.id),
|
|
37
|
+
place: place(active.id)
|
|
38
|
+
})
|
|
24
39
|
};
|
|
25
40
|
};
|
|
26
41
|
/** The lines of a record as rows of the given columns, put in order by dragging or from each row's menu. */
|
|
@@ -37,7 +37,7 @@ const LineRow = ({ line, name, columns, position, count, reorderable, onRemove,
|
|
|
37
37
|
reorderable ? /* @__PURE__ */ jsx("button", {
|
|
38
38
|
ref: setActivatorNodeRef,
|
|
39
39
|
type: "button",
|
|
40
|
-
"aria-label": text("dragToReorder", name),
|
|
40
|
+
"aria-label": text("dragToReorder", { name }),
|
|
41
41
|
...attributes,
|
|
42
42
|
...listeners,
|
|
43
43
|
style: { touchAction: "none" },
|
|
@@ -49,7 +49,7 @@ const LineRow = ({ line, name, columns, position, count, reorderable, onRemove,
|
|
|
49
49
|
children: column.cell(line)
|
|
50
50
|
}, column.key)),
|
|
51
51
|
menu.length > 0 ? /* @__PURE__ */ jsx(LineMenu, {
|
|
52
|
-
label: text("actionsFor", name),
|
|
52
|
+
label: text("actionsFor", { name }),
|
|
53
53
|
items: menu
|
|
54
54
|
}) : /* @__PURE__ */ jsx("span", {}),
|
|
55
55
|
error && /* @__PURE__ */ jsx("p", {
|
|
@@ -1,54 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { messages } from "../locale/messages.js";
|
|
2
2
|
//#region src/inline-child-table/messages.ts
|
|
3
|
-
const text =
|
|
4
|
-
en: {
|
|
5
|
-
instructions: "To pick up a line, press space or enter on its drag handle. Use the up and down arrow keys to move it, space or enter to drop it, and escape to cancel. The row menu also has Move up and Move down.",
|
|
6
|
-
line: "line",
|
|
7
|
-
pickedUp: (name, place, count) => `Picked up ${name}, line ${place} of ${count}.`,
|
|
8
|
-
over: (name, place, count) => `${name} is over line ${place} of ${count}.`,
|
|
9
|
-
dropped: (name, place, count) => `${name} was dropped at line ${place} of ${count}.`,
|
|
10
|
-
droppedAtStart: (name) => `${name} was dropped where it started.`,
|
|
11
|
-
cancelled: (name, place) => `Moving ${name} was cancelled. It is back at line ${place}.`,
|
|
12
|
-
item: "Item",
|
|
13
|
-
qty: "Qty",
|
|
14
|
-
quantity: "Quantity",
|
|
15
|
-
unitPrice: "Unit price",
|
|
16
|
-
lineTotal: "Line total",
|
|
17
|
-
addLine: "Add line",
|
|
18
|
-
noLines: "No lines yet.",
|
|
19
|
-
moveUp: "Move up",
|
|
20
|
-
moveDown: "Move down",
|
|
21
|
-
removeLine: "Remove line",
|
|
22
|
-
dragToReorder: (name) => `Drag to reorder ${name}`,
|
|
23
|
-
actionsFor: (name) => `Actions for ${name}`,
|
|
24
|
-
subtotal: "Subtotal",
|
|
25
|
-
vat: (percent) => `VAT ${percent}%`,
|
|
26
|
-
total: "Total"
|
|
27
|
-
},
|
|
28
|
-
nl: {
|
|
29
|
-
instructions: "Druk op spatie of enter op de sleepgreep om een regel op te pakken. Verplaats hem met de pijltjestoetsen omhoog en omlaag, zet hem neer met spatie of enter, en annuleer met escape. Het regelmenu heeft ook Omhoog en Omlaag.",
|
|
30
|
-
line: "regel",
|
|
31
|
-
pickedUp: (name, place, count) => `${name} opgepakt, regel ${place} van ${count}.`,
|
|
32
|
-
over: (name, place, count) => `${name} is boven regel ${place} van ${count}.`,
|
|
33
|
-
dropped: (name, place, count) => `${name} is neergezet op regel ${place} van ${count}.`,
|
|
34
|
-
droppedAtStart: (name) => `${name} is neergezet waar hij begon.`,
|
|
35
|
-
cancelled: (name, place) => `Verplaatsen van ${name} is geannuleerd. Hij staat weer op regel ${place}.`,
|
|
36
|
-
item: "Artikel",
|
|
37
|
-
qty: "Aantal",
|
|
38
|
-
quantity: "Aantal",
|
|
39
|
-
unitPrice: "Stukprijs",
|
|
40
|
-
lineTotal: "Regeltotaal",
|
|
41
|
-
addLine: "Regel toevoegen",
|
|
42
|
-
noLines: "Nog geen regels.",
|
|
43
|
-
moveUp: "Omhoog",
|
|
44
|
-
moveDown: "Omlaag",
|
|
45
|
-
removeLine: "Regel verwijderen",
|
|
46
|
-
dragToReorder: (name) => `Sleep om ${name} te verplaatsen`,
|
|
47
|
-
actionsFor: (name) => `Acties voor ${name}`,
|
|
48
|
-
subtotal: "Subtotaal",
|
|
49
|
-
vat: (percent) => `Btw ${percent}%`,
|
|
50
|
-
total: "Totaal"
|
|
51
|
-
}
|
|
52
|
-
});
|
|
3
|
+
const text = messages("inline-child-table");
|
|
53
4
|
//#endregion
|
|
54
5
|
export { text };
|
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
import { slotted } from "../locale/slotted.js";
|
|
2
1
|
import { text } from "./messages.js";
|
|
3
2
|
import { jsx } from "react/jsx-runtime";
|
|
4
3
|
//#region src/invitations/link-notice.tsx
|
|
5
4
|
/** The invitation link to pass on, when the app cannot email it. */
|
|
6
5
|
const LinkNotice = ({ link }) => link ? /* @__PURE__ */ jsx("p", {
|
|
7
6
|
className: "mt-3 break-all rounded-md border bg-muted px-3 py-2 text-xs",
|
|
8
|
-
children:
|
|
7
|
+
children: text.rich("passLinkOn", { link: /* @__PURE__ */ jsx("span", {
|
|
9
8
|
className: "font-mono",
|
|
10
9
|
children: link
|
|
11
|
-
}))
|
|
10
|
+
}) })
|
|
12
11
|
}) : null;
|
|
13
12
|
//#endregion
|
|
14
13
|
export { LinkNotice };
|
|
@@ -1,24 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { messages } from "../locale/messages.js";
|
|
2
2
|
//#region src/invitations/messages.ts
|
|
3
|
-
const text =
|
|
4
|
-
en: {
|
|
5
|
-
email: "Email",
|
|
6
|
-
invite: "Invite",
|
|
7
|
-
expired: "Expired",
|
|
8
|
-
until: (date) => `Until ${date}`,
|
|
9
|
-
sendAgain: "Send again",
|
|
10
|
-
revoke: "Revoke",
|
|
11
|
-
passLinkOn: "This app cannot send email, so pass this link on yourself. It works once, until the invitation expires: {}"
|
|
12
|
-
},
|
|
13
|
-
nl: {
|
|
14
|
-
email: "E-mailadres",
|
|
15
|
-
invite: "Uitnodigen",
|
|
16
|
-
expired: "Verlopen",
|
|
17
|
-
until: (date) => `Tot ${date}`,
|
|
18
|
-
sendAgain: "Opnieuw sturen",
|
|
19
|
-
revoke: "Intrekken",
|
|
20
|
-
passLinkOn: "Deze app kan geen e-mail sturen, dus geef deze link zelf door. Die werkt één keer, tot de uitnodiging verloopt: {}"
|
|
21
|
-
}
|
|
22
|
-
});
|
|
3
|
+
const text = messages("invitations");
|
|
23
4
|
//#endregion
|
|
24
5
|
export { text };
|
|
@@ -28,7 +28,7 @@ const PendingInvitationRow = ({ email, gives, expiresAt, onResend, onRevoke }) =
|
|
|
28
28
|
children: [
|
|
29
29
|
gives,
|
|
30
30
|
" · ",
|
|
31
|
-
expired ? text("expired") : text("until", new Date(expiresAt).toLocaleDateString(formatTag()))
|
|
31
|
+
expired ? text("expired") : text("until", { date: new Date(expiresAt).toLocaleDateString(formatTag()) })
|
|
32
32
|
]
|
|
33
33
|
})]
|
|
34
34
|
}),
|
package/dist/lists/messages.js
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { messages } from "../locale/messages.js";
|
|
2
2
|
//#region src/lists/messages.ts
|
|
3
|
-
const text =
|
|
4
|
-
en: { showMore: "Show more" },
|
|
5
|
-
nl: { showMore: "Meer tonen" }
|
|
6
|
-
});
|
|
3
|
+
const text = messages("lists");
|
|
7
4
|
//#endregion
|
|
8
5
|
export { text };
|
|
@@ -4,28 +4,10 @@ import { markdownExcerpt } from "../markdown/markdown-excerpt.js";
|
|
|
4
4
|
import { isMarkdown } from "../markdown/markdown-hint.js";
|
|
5
5
|
import { recordTitleField } from "./model-helpers.js";
|
|
6
6
|
import { contactFormat } from "./contact-links.js";
|
|
7
|
+
import { valueTone } from "./value-color.js";
|
|
7
8
|
import { listColumnNames } from "@protobase/schema/internal";
|
|
8
9
|
import { enumLabel } from "@protobase/schema";
|
|
9
10
|
//#region src/live/columns-from-model.ts
|
|
10
|
-
const tones = {
|
|
11
|
-
draft: "neutral",
|
|
12
|
-
confirmed: "blue",
|
|
13
|
-
picking: "amber",
|
|
14
|
-
shipped: "violet",
|
|
15
|
-
delivered: "green",
|
|
16
|
-
cancelled: "red",
|
|
17
|
-
sent: "blue",
|
|
18
|
-
paid: "green",
|
|
19
|
-
overdue: "red",
|
|
20
|
-
lead: "blue",
|
|
21
|
-
active: "green",
|
|
22
|
-
dormant: "neutral",
|
|
23
|
-
receipt: "green",
|
|
24
|
-
issue: "blue",
|
|
25
|
-
transfer: "violet",
|
|
26
|
-
adjustment: "amber"
|
|
27
|
-
};
|
|
28
|
-
const toneFor = (value) => tones[value] ?? "neutral";
|
|
29
11
|
const widths = {
|
|
30
12
|
text: 200,
|
|
31
13
|
id: 140,
|
|
@@ -47,7 +29,6 @@ const fixedKinds = /* @__PURE__ */ new Set([
|
|
|
47
29
|
"boolean",
|
|
48
30
|
"percent"
|
|
49
31
|
]);
|
|
50
|
-
const idLike = /^(number|sku|reference|code)$/;
|
|
51
32
|
const kindOf = (field, view, index) => {
|
|
52
33
|
switch (field.type) {
|
|
53
34
|
case "relation": return "relation";
|
|
@@ -56,14 +37,14 @@ const kindOf = (field, view, index) => {
|
|
|
56
37
|
case "boolean": return "boolean";
|
|
57
38
|
case "timestamp": return "datetime";
|
|
58
39
|
case "date": return "date";
|
|
59
|
-
case "decimal": return view?.format === "percent" ? "percent" : view?.
|
|
40
|
+
case "decimal": return view?.format === "percent" ? "percent" : view?.currency !== void 0 ? "money" : "number";
|
|
60
41
|
case "integer":
|
|
61
|
-
case "bigint": return
|
|
62
|
-
default: return
|
|
42
|
+
case "bigint": return view?.format === "signed" ? "signed" : "number";
|
|
43
|
+
default: return view?.format === "code" || index === 0 && field.name === "id" ? "id" : "text";
|
|
63
44
|
}
|
|
64
45
|
};
|
|
65
46
|
const currencyCents = (value) => Math.round(Number.parseFloat(String(value)) * 100);
|
|
66
|
-
/** Grid columns for `names`, by default the view's list: kinds follow the field types and the view's format hints. */
|
|
47
|
+
/** Grid columns for `names`, by default the view's list: kinds follow the field types and the view's format and currency hints. */
|
|
67
48
|
const columnsFromModel = (resource, view, highlight = [], names = listColumnNames(resource, view)) => {
|
|
68
49
|
const title = recordTitleField(resource, view);
|
|
69
50
|
return names.flatMap((name, index) => {
|
|
@@ -72,29 +53,31 @@ const columnsFromModel = (resource, view, highlight = [], names = listColumnName
|
|
|
72
53
|
const viewField = view?.fields[name];
|
|
73
54
|
const kind = kindOf(field, viewField, index);
|
|
74
55
|
const labels = Object.fromEntries((field.enumValues ?? []).map((value) => [value, enumLabel(value, viewField?.valueLabels)]));
|
|
75
|
-
const
|
|
56
|
+
const prefix = (kind === "number" || kind === "signed") && viewField?.prefix ? viewField.prefix : void 0;
|
|
57
|
+
const affixWidth = Math.ceil(((prefix?.length ?? 0) + (viewField?.suffix?.length ?? 0)) * 7.2);
|
|
76
58
|
return [{
|
|
77
59
|
id: name,
|
|
78
60
|
header: viewField?.label ?? humanize(name),
|
|
79
61
|
kind,
|
|
80
|
-
width: (name === "name" ? 260 : widths[kind]) +
|
|
62
|
+
width: (name === "name" ? 260 : widths[kind]) + affixWidth,
|
|
81
63
|
sortable: field.sortable,
|
|
82
|
-
minWidth: Math.max(kind === "id" ? 150 : 0, headerWidth(viewField?.label ?? humanize(name), field.sortable), kind === "status" ? badgeWidth(Object.values(labels)) : 0,
|
|
64
|
+
minWidth: Math.max(kind === "id" ? 150 : 0, headerWidth(viewField?.label ?? humanize(name), field.sortable), kind === "status" ? badgeWidth(Object.values(labels)) : 0, affixWidth > 0 ? widths[kind] + affixWidth : 0),
|
|
83
65
|
...fixedKinds.has(kind) && { fixed: true },
|
|
84
66
|
...name === title && { title: true },
|
|
85
67
|
...kind === "text" && name !== title && contactFormat(viewField) && { link: contactFormat(viewField) },
|
|
86
68
|
...highlight.includes(name) && { highlight: true },
|
|
87
69
|
...field.type === "enum" && {
|
|
88
|
-
tones: Object.fromEntries((field.enumValues ?? []).map((value) => [value,
|
|
70
|
+
tones: Object.fromEntries((field.enumValues ?? []).map((value) => [value, valueTone(viewField?.valueColors, value)])),
|
|
89
71
|
labels
|
|
90
72
|
},
|
|
91
73
|
...field.type === "enum" && viewField?.valueColors && { colors: viewField.valueColors },
|
|
92
74
|
...field.type === "enum" && viewField?.badgeShape && { shape: viewField.badgeShape },
|
|
75
|
+
...prefix !== void 0 && { prefix },
|
|
93
76
|
...viewField?.suffix !== void 0 && { suffix: viewField.suffix },
|
|
94
77
|
...kind === "datetime" && viewField?.format === "relative" && { relative: true },
|
|
95
78
|
...kind === "money" && viewField?.decimals !== void 0 && { decimals: viewField.decimals },
|
|
96
|
-
...kind === "money" && {
|
|
97
|
-
currency:
|
|
79
|
+
...kind === "money" && viewField?.currency !== void 0 && {
|
|
80
|
+
currency: viewField.currency,
|
|
98
81
|
value: (row) => row[name] == null ? null : currencyCents(row[name])
|
|
99
82
|
},
|
|
100
83
|
...(kind === "datetime" || kind === "date") && { value: (row) => row[name] == null ? null : Date.parse(String(row[name])) },
|
|
@@ -104,4 +87,4 @@ const columnsFromModel = (resource, view, highlight = [], names = listColumnName
|
|
|
104
87
|
});
|
|
105
88
|
};
|
|
106
89
|
//#endregion
|
|
107
|
-
export { columnsFromModel, listColumnNames
|
|
90
|
+
export { columnsFromModel, listColumnNames };
|
|
@@ -40,7 +40,7 @@ const valueTitle = (field, value, zone = viewerZone(), hints = {}) => {
|
|
|
40
40
|
const ms = Date.parse(value);
|
|
41
41
|
if (Number.isNaN(ms)) return void 0;
|
|
42
42
|
if (hints.format === "relative") return formatDateTime(ms, zone);
|
|
43
|
-
return text("shownIn", zoneLabel(ms, zone));
|
|
43
|
+
return text("shownIn", { zone: zoneLabel(ms, zone) });
|
|
44
44
|
};
|
|
45
45
|
//#endregion
|
|
46
46
|
export { displayValue, valueTitle };
|
package/dist/live/messages.js
CHANGED
|
@@ -1,18 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { messages } from "../locale/messages.js";
|
|
2
2
|
//#region src/live/messages.ts
|
|
3
|
-
const text =
|
|
4
|
-
en: {
|
|
5
|
-
yes: "Yes",
|
|
6
|
-
no: "No",
|
|
7
|
-
shownIn: (zone) => `Shown in ${zone}`,
|
|
8
|
-
fileMissing: "File missing"
|
|
9
|
-
},
|
|
10
|
-
nl: {
|
|
11
|
-
yes: "Ja",
|
|
12
|
-
no: "Nee",
|
|
13
|
-
shownIn: (zone) => `Getoond in ${zone}`,
|
|
14
|
-
fileMissing: "Bestand ontbreekt"
|
|
15
|
-
}
|
|
16
|
-
});
|
|
3
|
+
const text = messages("live");
|
|
17
4
|
//#endregion
|
|
18
5
|
export { text };
|
package/dist/live/value-color.js
CHANGED
|
@@ -1,8 +1,18 @@
|
|
|
1
|
+
import { isBadgeTone } from "@protobase/schema";
|
|
1
2
|
//#region src/live/value-color.ts
|
|
2
|
-
|
|
3
|
-
const valueColor = (colors, value) => {
|
|
3
|
+
const declared = (colors, value) => {
|
|
4
4
|
const key = String(value);
|
|
5
5
|
return colors && Object.hasOwn(colors, key) ? colors[key] : void 0;
|
|
6
6
|
};
|
|
7
|
+
/** The hex colour a view gives a value's badge, if any; a tone name is no colour. */
|
|
8
|
+
const valueColor = (colors, value) => {
|
|
9
|
+
const color = declared(colors, value);
|
|
10
|
+
return color === void 0 || isBadgeTone(color) ? void 0 : color;
|
|
11
|
+
};
|
|
12
|
+
/** The tone a view gives a value's badge, `neutral` when it names none. */
|
|
13
|
+
const valueTone = (colors, value) => {
|
|
14
|
+
const tone = declared(colors, value);
|
|
15
|
+
return tone !== void 0 && isBadgeTone(tone) ? tone : "neutral";
|
|
16
|
+
};
|
|
7
17
|
//#endregion
|
|
8
|
-
export { valueColor };
|
|
18
|
+
export { valueColor, valueTone };
|
package/dist/live/view-fields.js
CHANGED
|
@@ -68,11 +68,13 @@ const widgetFields = (view, model) => {
|
|
|
68
68
|
};
|
|
69
69
|
/** Whether a range draws its histogram: only a `range` widget that asks for one. */
|
|
70
70
|
const rangeHistogram = (view, field) => (view?.filters ?? []).some((widget) => widget.kind === "range" && widget.field === field && widget.histogram);
|
|
71
|
-
/** How a range's values read
|
|
71
|
+
/** How a range's values read: money in the view's currency, "€450,000", else with its prefix and suffix, "85 m²". */
|
|
72
72
|
const rangeFormat = (view, field) => {
|
|
73
73
|
const hints = view?.fields[field];
|
|
74
74
|
const suffix = hints?.suffix ?? "";
|
|
75
|
-
|
|
75
|
+
const currency = hints?.currency;
|
|
76
|
+
if (currency !== void 0) return (value) => `${formatMoney(value * 100, currency).replace(".00", "")}${suffix}`;
|
|
77
|
+
return (value) => `${hints?.prefix ?? ""}${value}${suffix}`;
|
|
76
78
|
};
|
|
77
79
|
//#endregion
|
|
78
80
|
export { rangeFormat, rangeHistogram, widgetFields };
|