@cosmicdrift/kumiko-renderer 0.414.0 → 0.416.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/app/action-form-body.d.ts +1 -1
- package/dist/app/action-form-body.js +43 -16
- package/dist/app/action-form-support.d.ts +4 -1
- package/dist/app/action-form-support.js +8 -4
- package/dist/app/client-actions.js +6 -4
- package/dist/app/config-edit-body.js +13 -4
- package/dist/app/entity-list-screen.js +12 -9
- package/dist/app/extension-sections.d.ts +2 -0
- package/dist/app/list-facets.d.ts +1 -0
- package/dist/app/list-facets.js +10 -1
- package/dist/app/named-filter-facet.d.ts +0 -1
- package/dist/app/named-filter-facet.js +19 -10
- package/dist/app/projection-detail-body.js +8 -6
- package/dist/app/projection-detail-guidance-data.js +3 -1
- package/dist/app/projection-detail-guidance.d.ts +1 -1
- package/dist/app/projection-detail-guidance.js +45 -33
- package/dist/app/projection-detail-header-model.d.ts +1 -1
- package/dist/app/projection-detail-header-model.js +10 -5
- package/dist/app/projection-detail-header.js +5 -4
- package/dist/app/projection-detail-navigation.d.ts +6 -0
- package/dist/app/projection-detail-navigation.js +18 -4
- package/dist/app/screen-access.js +1 -2
- package/dist/app/screen-shared.d.ts +1 -0
- package/dist/app/screen-shared.js +23 -3
- package/dist/app/use-entity-list-payload.d.ts +2 -1
- package/dist/app/use-entity-list-payload.js +4 -2
- package/dist/app/use-projection-detail-actions.d.ts +14 -0
- package/dist/app/use-projection-detail-actions.js +40 -16
- package/dist/app/use-projection-detail-data.d.ts +2 -0
- package/dist/app/use-projection-detail-data.js +37 -10
- package/dist/app/use-row-decoration.d.ts +6 -4
- package/dist/app/use-row-decoration.js +67 -19
- package/dist/app/use-screen-list-rows.js +1 -1
- package/dist/card-options.d.ts +25 -0
- package/dist/card-options.js +1 -0
- package/dist/components/ai-assist-payload.d.ts +2 -0
- package/dist/components/ai-assist-payload.js +8 -0
- package/dist/components/edit-mounts.d.ts +3 -2
- package/dist/components/edit-mounts.js +2 -2
- package/dist/components/list-empty-state.d.ts +5 -0
- package/dist/components/list-empty-state.js +17 -1
- package/dist/components/multi-select-chips.d.ts +10 -0
- package/dist/components/multi-select-chips.js +18 -0
- package/dist/components/related-list-section.js +44 -32
- package/dist/components/related-photo-grid.d.ts +11 -0
- package/dist/components/related-photo-grid.js +40 -0
- package/dist/components/render-edit-action-button.d.ts +2 -2
- package/dist/components/render-edit-field-grid.js +3 -3
- package/dist/components/render-edit-header-actions.d.ts +2 -1
- package/dist/components/render-edit-header-actions.js +18 -1
- package/dist/components/render-edit-layout.js +2 -2
- package/dist/components/render-edit-logic.js +1 -0
- package/dist/components/render-edit-section-kinds.js +11 -0
- package/dist/components/render-edit-types.d.ts +11 -1
- package/dist/components/render-field-ai-assist.d.ts +13 -0
- package/dist/components/render-field-ai-assist.js +89 -0
- package/dist/components/render-field-choice-inputs.js +4 -0
- package/dist/components/render-field-control.d.ts +1 -1
- package/dist/components/render-field-control.js +18 -8
- package/dist/components/render-field-value-chips.d.ts +9 -0
- package/dist/components/render-field-value-chips.js +45 -0
- package/dist/components/render-field-write-only.js +12 -4
- package/dist/components/render-list-hint-columns.d.ts +2 -0
- package/dist/components/render-list-hint-columns.js +23 -0
- package/dist/components/render-list-toolbar-model.d.ts +2 -2
- package/dist/components/use-render-edit-sections.js +5 -1
- package/dist/components/use-render-list-columns.js +3 -3
- package/dist/context/screen-focus-context.d.ts +1 -1
- package/dist/context/screen-focus-context.js +3 -3
- package/dist/data-table-facet-types.d.ts +4 -0
- package/dist/headless/format/index.d.ts +1 -0
- package/dist/headless/format/index.js +20 -0
- package/dist/headless/format/phone.d.ts +1 -0
- package/dist/headless/format/phone.js +8 -0
- package/dist/headless/format/relative-time.d.ts +13 -0
- package/dist/headless/format/relative-time.js +60 -0
- package/dist/headless/format/safe-locale.d.ts +1 -0
- package/dist/headless/format/safe-locale.js +13 -0
- package/dist/headless/index.d.ts +3 -3
- package/dist/headless/index.js +3 -3
- package/dist/headless/pwa-service-worker-meta.d.ts +3 -0
- package/dist/headless/pwa-service-worker-meta.js +10 -0
- package/dist/headless/view-model/edit.d.ts +3 -2
- package/dist/headless/view-model/edit.js +78 -2
- package/dist/headless/view-model/field-text.d.ts +9 -0
- package/dist/headless/view-model/field-text.js +19 -0
- package/dist/headless/view-model/index.d.ts +1 -0
- package/dist/headless/view-model/index.js +1 -0
- package/dist/headless/view-model/types.d.ts +33 -3
- package/dist/i18n-defaults.js +4 -1
- package/dist/index.d.ts +1 -1
- package/dist/metric-types.d.ts +2 -0
- package/dist/primitives-record-guidance.d.ts +30 -1
- package/dist/primitives.d.ts +17 -27
- package/dist/web/app/dashboard-body.js +3 -2
- package/dist/web/app/dashboard-header.js +1 -1
- package/dist/web/app/dashboard-list-panel.js +9 -13
- package/dist/web/app/dashboard-panel-columns.d.ts +9 -0
- package/dist/web/app/dashboard-panel-columns.js +14 -0
- package/dist/web/app/dashboard-panels.d.ts +1 -0
- package/dist/web/app/dashboard-panels.js +9 -7
- package/dist/web/app/dashboard-reference-list-table.js +1 -0
- package/dist/web/app/dashboard-shared.js +3 -2
- package/dist/web/app/dashboard-stat-group-panel.d.ts +1 -0
- package/dist/web/app/dashboard-stat-group-panel.js +22 -8
- package/dist/web/app/dashboard-text-panel.d.ts +1 -0
- package/dist/web/app/dashboard-text-panel.js +18 -12
- package/dist/web/app/relative-time.d.ts +0 -5
- package/dist/web/app/relative-time.js +1 -20
- package/dist/web/drawn-icons.d.ts +6 -0
- package/dist/web/drawn-icons.js +30 -0
- package/dist/web/icons.js +6 -5
- package/dist/web/index.d.ts +2 -0
- package/dist/web/index.js +2 -0
- package/dist/web/layout/default-app-shell.js +3 -3
- package/dist/web/layout/nav-collapse-state.d.ts +2 -0
- package/dist/web/layout/nav-collapse-state.js +10 -0
- package/dist/web/layout/nav-tree.js +46 -23
- package/dist/web/layout/notification-bell.d.ts +7 -2
- package/dist/web/layout/notification-bell.js +16 -5
- package/dist/web/layout/shell-focus.d.ts +2 -2
- package/dist/web/layout/shell-focus.js +7 -3
- package/dist/web/layout/shell-header.d.ts +2 -1
- package/dist/web/layout/shell-header.js +56 -27
- package/dist/web/layout/shell-style.d.ts +3 -0
- package/dist/web/layout/shell-style.js +6 -0
- package/dist/web/layout/workspace-shell.d.ts +11 -1
- package/dist/web/layout/workspace-shell.js +6 -4
- package/dist/web/primitives/banner.d.ts +1 -1
- package/dist/web/primitives/banner.js +19 -9
- package/dist/web/primitives/card.js +18 -8
- package/dist/web/primitives/data-table/actions-column.d.ts +1 -1
- package/dist/web/primitives/data-table/actions-column.js +3 -1
- package/dist/web/primitives/data-table/card-body.d.ts +1 -1
- package/dist/web/primitives/data-table/card-body.js +11 -6
- package/dist/web/primitives/data-table/card-row.js +27 -18
- package/dist/web/primitives/data-table/data-cell-props.d.ts +2 -0
- package/dist/web/primitives/data-table/data-cell-props.js +2 -0
- package/dist/web/primitives/data-table/hint-cell.d.ts +1 -3
- package/dist/web/primitives/data-table/hint-cell.js +4 -10
- package/dist/web/primitives/data-table/row-click-guard.d.ts +2 -0
- package/dist/web/primitives/data-table/row-click-guard.js +19 -0
- package/dist/web/primitives/data-table/row-render-parts.d.ts +1 -1
- package/dist/web/primitives/data-table/row-render-parts.js +3 -2
- package/dist/web/primitives/data-table/sort-options-select.js +3 -3
- package/dist/web/primitives/data-table/table-body.js +2 -1
- package/dist/web/primitives/data-table/table-content.js +10 -6
- package/dist/web/primitives/data-table/table-view.js +8 -3
- package/dist/web/primitives/data-table/toolbar.d.ts +2 -0
- package/dist/web/primitives/data-table/toolbar.js +44 -9
- package/dist/web/primitives/data-table/totals-footer.js +4 -3
- package/dist/web/primitives/data-table-cell.d.ts +4 -1
- package/dist/web/primitives/data-table-cell.js +60 -20
- package/dist/web/primitives/default-form.js +6 -3
- package/dist/web/primitives/drawer.js +5 -1
- package/dist/web/primitives/facet-filter.d.ts +1 -1
- package/dist/web/primitives/facet-filter.js +16 -8
- package/dist/web/primitives/facet-search-filter.d.ts +2 -1
- package/dist/web/primitives/facet-search-filter.js +3 -2
- package/dist/web/primitives/facet-trigger-label.d.ts +8 -0
- package/dist/web/primitives/facet-trigger-label.js +9 -0
- package/dist/web/primitives/file-view-action.js +4 -1
- package/dist/web/primitives/form-footer-parts.js +4 -1
- package/dist/web/primitives/form.js +6 -8
- package/dist/web/primitives/index.js +4 -0
- package/dist/web/primitives/layout-elements.d.ts +1 -1
- package/dist/web/primitives/layout-elements.js +3 -3
- package/dist/web/primitives/locale-number.d.ts +0 -1
- package/dist/web/primitives/locale-number.js +1 -13
- package/dist/web/primitives/metric.js +17 -5
- package/dist/web/primitives/money-input.js +2 -1
- package/dist/web/primitives/narrow-pinned-footer.js +7 -3
- package/dist/web/primitives/number-input.js +2 -1
- package/dist/web/primitives/page-header.js +3 -2
- package/dist/web/primitives/pager.d.ts +3 -2
- package/dist/web/primitives/pager.js +16 -20
- package/dist/web/primitives/photo-grid.d.ts +3 -0
- package/dist/web/primitives/photo-grid.js +5 -0
- package/dist/web/primitives/record-breadcrumb.js +1 -1
- package/dist/web/primitives/record-steps.d.ts +1 -1
- package/dist/web/primitives/record-steps.js +11 -6
- package/dist/web/primitives/record-summary.d.ts +1 -1
- package/dist/web/primitives/record-summary.js +8 -3
- package/dist/web/primitives/segmented-select.js +6 -3
- package/dist/web/primitives/step-list.d.ts +3 -0
- package/dist/web/primitives/step-list.js +11 -0
- package/dist/web/primitives/tabs.js +6 -1
- package/dist/web/pwa/pwa-support.js +19 -1
- package/dist/web/ui/sidebar.d.ts +2 -1
- package/dist/web/ui/sidebar.js +4 -3
- package/dist/web/widgets/ai-text-field.js +3 -2
- package/dist/web/widgets/dashboard-list-cards.js +6 -14
- package/dist/web/widgets/dashboard-list.d.ts +10 -0
- package/dist/web/widgets/dashboard-list.js +36 -10
- package/dist/web/widgets/drawer-panel-class.d.ts +1 -0
- package/dist/web/widgets/drawer-panel-class.js +9 -1
- package/dist/web/widgets/drawer.js +2 -2
- package/dist/web/widgets/pdf-viewer-toolbar.js +3 -2
- package/dist/web/widgets/sheet-parts.js +3 -1
- package/dist/web/widgets/stat-box-cell.js +1 -1
- package/dist/web/widgets/stat.d.ts +7 -1
- package/dist/web/widgets/stat.js +12 -4
- package/dist/web/widgets/step-list-row.d.ts +4 -0
- package/dist/web/widgets/step-list-row.js +22 -14
- package/dist/web/widgets/step-list.d.ts +12 -4
- package/dist/web/widgets/step-list.js +38 -20
- package/package.json +5 -5
- package/src/changes.json +126 -0
- package/src/web/styles.css +6 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function resolveSafeLocale(locale: string | undefined): string;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
const FALLBACK_LOCALE = "en-US";
|
|
2
|
+
// An invalid tag makes every Intl constructor and toLocaleString throw a
|
|
3
|
+
// RangeError; without an ErrorBoundary that would take down the page on
|
|
4
|
+
// focus/blur. Canonicalizing once up front keeps all call sites safe.
|
|
5
|
+
export function resolveSafeLocale(locale) {
|
|
6
|
+
const candidate = locale ?? (typeof navigator !== "undefined" ? navigator.language : undefined) ?? "";
|
|
7
|
+
try {
|
|
8
|
+
return Intl.getCanonicalLocales(candidate)[0] ?? FALLBACK_LOCALE;
|
|
9
|
+
}
|
|
10
|
+
catch {
|
|
11
|
+
return FALLBACK_LOCALE;
|
|
12
|
+
}
|
|
13
|
+
}
|
package/dist/headless/index.d.ts
CHANGED
|
@@ -5,12 +5,12 @@ export type { BatchResult, Command, Dispatcher, DispatcherError, DispatcherStatu
|
|
|
5
5
|
export { generateRequestId, StreamFrame, type StreamFrameEvent } from "./dispatcher/index.ts";
|
|
6
6
|
export type { FieldConditionPredicate, FieldConditions, FieldConditionValue, FieldState, FormController, FormControllerOptions, FormSnapshot, FormValues, SubmitConfig, SubmitPayloadMode, SubmitResult, } from "./form/index.ts";
|
|
7
7
|
export { createFormController, groupIssuesByPath, I18N_KEY_PARAM, relevantFieldIssues, zodErrorToFieldIssues, } from "./form/index.ts";
|
|
8
|
-
export { applyFormatSpec, currencyDecimals, DOCUMENT_FALLBACK_CURRENCY, EMPTY_VALUE_PLACEHOLDER, escapeHtml, escapeHtmlAttr, escapeXml, formatDocumentDate, formatDocumentMoney, formatDocumentPercent, formatMoney, type HtmlValue, html, isSafeHref, RawHtml, raw, resolveSafeMoneyLocale, stripControlChars, toInstant, } from "./format/index.ts";
|
|
8
|
+
export { applyFormatSpec, currencyDecimals, DOCUMENT_FALLBACK_CURRENCY, EMPTY_VALUE_PLACEHOLDER, escapeHtml, escapeHtmlAttr, escapeXml, formatDocumentDate, formatDocumentMoney, formatDocumentPercent, formatMoney, type HtmlValue, html, isSafeHref, RawHtml, raw, resolveSafeMoneyLocale, stripControlChars, telHref, toInstant, } from "./format/index.ts";
|
|
9
9
|
export type { NavDefinition, NavNode, NavRegistrySlice, NavTree, ResolveNavigationOptions, } from "./nav/index.ts";
|
|
10
10
|
export { resolveNavigation } from "./nav/index.ts";
|
|
11
11
|
export { pluralKey } from "./plural-key.ts";
|
|
12
|
-
export { PWA_SERVICE_WORKER_META_NAME } from "./pwa-service-worker-meta.ts";
|
|
12
|
+
export { PWA_CACHE_NAME_PREFIX, PWA_CACHE_SCOPE_HASH_LENGTH, PWA_SERVICE_WORKER_META_NAME, pwaCacheScopePrefixOf, } from "./pwa-service-worker-meta.ts";
|
|
13
13
|
export type { Store, WritableStore } from "./store/index.ts";
|
|
14
14
|
export { createStore, shallowEqual } from "./store/index.ts";
|
|
15
15
|
export type { CellLink, CellLinkItem, ComputeEditViewModelInput, ComputeListViewModelInput, DerivedCellRoundingTarget, EditExtensionSectionViewModel, EditFieldSpec, EditFieldsSectionViewModel, EditFieldViewModel, EditFormMode, EditRelatedListSectionViewModel, EditSectionSpec, EditSectionViewModel, EditViewModel, EditWriteFormSectionViewModel, EmbeddedDerivedOp, EmbeddedListCellViewModel, EmbeddedListIssueGroups, FieldConditionCtx, FieldRenderer, ListColumnCellDisplay, ListColumnFileDisplay, ListColumnHintViewModel, ListColumnSpec, ListColumnViewModel, ListRowViewModel, ListViewModel, RuntimeCellLink, RuntimeCellLinkItems, RuntimeRenderer, ScreenSlots, Translate, } from "./view-model/index.ts";
|
|
16
|
-
export { buildOptionLabels, computeDerivedCellValue, computeEditViewModel, computeListViewModel, computeRelatedListSectionViewModel, embeddedCellLabelKey, embeddedCellOptionLabelKey, fieldLabelKey, fieldOptionLabelKey, fieldOptionLabelKeyPrefix, groupEmbeddedListIssues, roundDerivedCellValue, sumEmbeddedListColumn, withDerivedCells, } from "./view-model/index.ts";
|
|
16
|
+
export { buildOptionLabels, computeDerivedCellValue, computeEditViewModel, computeListViewModel, computeRelatedListSectionViewModel, embeddedCellLabelKey, embeddedCellOptionLabelKey, fieldLabelKey, fieldOptionLabelKey, fieldOptionLabelKeyPrefix, fieldTextKey, groupEmbeddedListIssues, resolveFieldText, roundDerivedCellValue, sumEmbeddedListColumn, withDerivedCells, } from "./view-model/index.ts";
|
package/dist/headless/index.js
CHANGED
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
export { parseRefTarget } from "@cosmicdrift/kumiko-framework/ui-types";
|
|
4
4
|
export { generateRequestId, StreamFrame } from "./dispatcher/index.js";
|
|
5
5
|
export { createFormController, groupIssuesByPath, I18N_KEY_PARAM, relevantFieldIssues, zodErrorToFieldIssues, } from "./form/index.js";
|
|
6
|
-
export { applyFormatSpec, currencyDecimals, DOCUMENT_FALLBACK_CURRENCY, EMPTY_VALUE_PLACEHOLDER, escapeHtml, escapeHtmlAttr, escapeXml, formatDocumentDate, formatDocumentMoney, formatDocumentPercent, formatMoney, html, isSafeHref, RawHtml, raw, resolveSafeMoneyLocale, stripControlChars, toInstant, } from "./format/index.js";
|
|
6
|
+
export { applyFormatSpec, currencyDecimals, DOCUMENT_FALLBACK_CURRENCY, EMPTY_VALUE_PLACEHOLDER, escapeHtml, escapeHtmlAttr, escapeXml, formatDocumentDate, formatDocumentMoney, formatDocumentPercent, formatMoney, html, isSafeHref, RawHtml, raw, resolveSafeMoneyLocale, stripControlChars, telHref, toInstant, } from "./format/index.js";
|
|
7
7
|
export { resolveNavigation } from "./nav/index.js";
|
|
8
8
|
export { pluralKey } from "./plural-key.js";
|
|
9
|
-
export { PWA_SERVICE_WORKER_META_NAME } from "./pwa-service-worker-meta.js";
|
|
9
|
+
export { PWA_CACHE_NAME_PREFIX, PWA_CACHE_SCOPE_HASH_LENGTH, PWA_SERVICE_WORKER_META_NAME, pwaCacheScopePrefixOf, } from "./pwa-service-worker-meta.js";
|
|
10
10
|
export { createStore, shallowEqual } from "./store/index.js";
|
|
11
|
-
export { buildOptionLabels, computeDerivedCellValue, computeEditViewModel, computeListViewModel, computeRelatedListSectionViewModel, embeddedCellLabelKey, embeddedCellOptionLabelKey, fieldLabelKey, fieldOptionLabelKey, fieldOptionLabelKeyPrefix, groupEmbeddedListIssues, roundDerivedCellValue, sumEmbeddedListColumn, withDerivedCells, } from "./view-model/index.js";
|
|
11
|
+
export { buildOptionLabels, computeDerivedCellValue, computeEditViewModel, computeListViewModel, computeRelatedListSectionViewModel, embeddedCellLabelKey, embeddedCellOptionLabelKey, fieldLabelKey, fieldOptionLabelKey, fieldOptionLabelKeyPrefix, fieldTextKey, groupEmbeddedListIssues, resolveFieldText, roundDerivedCellValue, sumEmbeddedListColumn, withDerivedCells, } from "./view-model/index.js";
|
|
@@ -1,3 +1,13 @@
|
|
|
1
1
|
// The server writes this meta into the HTML shell only when the app enables `pwa`, and the
|
|
2
2
|
// web client registers the service worker named in its content only when it finds it.
|
|
3
3
|
export const PWA_SERVICE_WORKER_META_NAME = "kumiko-pwa-sw";
|
|
4
|
+
// CacheStorage is shared by the whole origin, so each base path gets its own prefix to keep one
|
|
5
|
+
// app's activation from deleting the precache of another app on the same origin.
|
|
6
|
+
export const PWA_CACHE_NAME_PREFIX = "kumiko-pwa-";
|
|
7
|
+
export const PWA_CACHE_SCOPE_HASH_LENGTH = 8;
|
|
8
|
+
// Must match the prefix the server derives from the shell URL, which equals the worker's scope path.
|
|
9
|
+
export async function pwaCacheScopePrefixOf(scopePath) {
|
|
10
|
+
const digest = await crypto.subtle.digest("SHA-256", new TextEncoder().encode(scopePath));
|
|
11
|
+
const hex = Array.from(new Uint8Array(digest), (byte) => byte.toString(16).padStart(2, "0")).join("");
|
|
12
|
+
return `${PWA_CACHE_NAME_PREFIX}${hex.slice(0, PWA_CACHE_SCOPE_HASH_LENGTH)}-`;
|
|
13
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { EditRelatedListSection, EntityDefinition, EntityEditScreenDefinition, FormDerivationScreen } from "@cosmicdrift/kumiko-framework/ui-types";
|
|
2
|
-
import type { EditRelatedListSectionViewModel, EditViewModel, Translate } from "./types.ts";
|
|
1
|
+
import type { EditRelatedListSection, EditStepListSection, EntityDefinition, EntityEditScreenDefinition, FormDerivationScreen } from "@cosmicdrift/kumiko-framework/ui-types";
|
|
2
|
+
import type { EditRelatedListSectionViewModel, EditStepListSectionViewModel, EditViewModel, Translate } from "./types.ts";
|
|
3
3
|
export type ComputeEditViewModelInput<TValues extends Readonly<Record<string, unknown>> = Readonly<Record<string, unknown>>> = {
|
|
4
4
|
readonly screen: EntityEditScreenDefinition;
|
|
5
5
|
readonly entity: Pick<EntityDefinition, "fields" | "defaultCurrency">;
|
|
@@ -21,5 +21,6 @@ export type ComputeEditViewModelInput<TValues extends Readonly<Record<string, un
|
|
|
21
21
|
readonly actionFormScreenQn?: string;
|
|
22
22
|
};
|
|
23
23
|
export type EditFormMode = "create" | "update";
|
|
24
|
+
export declare function computeStepListSectionViewModel(sectionSpec: EditStepListSection, values: Readonly<Record<string, unknown>>, translate: Translate): EditStepListSectionViewModel;
|
|
24
25
|
export declare function computeRelatedListSectionViewModel(sectionSpec: EditRelatedListSection, translate: Translate): EditRelatedListSectionViewModel;
|
|
25
26
|
export declare function computeEditViewModel<TValues extends Readonly<Record<string, unknown>> = Readonly<Record<string, unknown>>>(input: ComputeEditViewModelInput<TValues>): EditViewModel;
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { availableSelectOptions, evalFieldCondition, isExtensionEditSection, isFieldRequired, isFieldsEditSection, isFieldVisible, isFormDerivationInputMode, isUnusedFallbackOperand, isWriteFormEditSection, normalizeEditField, parseRefTarget, sectionFieldSpecs, WRITE_FORM_SECTION_ENTITY, } from "@cosmicdrift/kumiko-framework/ui-types";
|
|
2
|
+
import { SELECT_OPTION_TONES } from "@cosmicdrift/kumiko-types/fields";
|
|
3
|
+
import { isOneOf, propertyOf } from "@cosmicdrift/kumiko-types/type-guards";
|
|
2
4
|
import { buildEmbeddedListCell } from "./embedded-list-cells.js";
|
|
5
|
+
import { resolveFieldText } from "./field-text.js";
|
|
3
6
|
import { buildOptionLabels, fieldLabelKey, fieldOptionLabelKey } from "./list.js";
|
|
4
7
|
// Resolves a writeForm section's own fieldDefs/fields through the same
|
|
5
8
|
// per-field pipeline as a plain fields section, by reusing the pipeline
|
|
@@ -61,6 +64,48 @@ function translateSectionTexts(section, translate) {
|
|
|
61
64
|
function wasEmptiedByWriteExclusion(declaredFieldSpecs, remainingFields) {
|
|
62
65
|
return declaredFieldSpecs.length > 0 && remainingFields.length === 0;
|
|
63
66
|
}
|
|
67
|
+
function readOptionalString(entry, key) {
|
|
68
|
+
const value = propertyOf(entry, key);
|
|
69
|
+
return typeof value === "string" ? value : undefined;
|
|
70
|
+
}
|
|
71
|
+
function readStepListItem(entry) {
|
|
72
|
+
const title = readOptionalString(entry, "title");
|
|
73
|
+
if (title === undefined)
|
|
74
|
+
return undefined;
|
|
75
|
+
const status = readOptionalString(entry, "status");
|
|
76
|
+
const statusTone = propertyOf(entry, "statusTone");
|
|
77
|
+
const description = readOptionalString(entry, "description");
|
|
78
|
+
return {
|
|
79
|
+
title,
|
|
80
|
+
...(status !== undefined && { status }),
|
|
81
|
+
...(isOneOf(SELECT_OPTION_TONES, statusTone) && { statusTone }),
|
|
82
|
+
...(description !== undefined && { description }),
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
// Malformed entries of the record's array are skipped: the screen must not crash on a bad row.
|
|
86
|
+
export function computeStepListSectionViewModel(sectionSpec, values, translate) {
|
|
87
|
+
const raw = values[sectionSpec.field];
|
|
88
|
+
const items = Array.isArray(raw) ? raw : [];
|
|
89
|
+
return {
|
|
90
|
+
kind: "stepList",
|
|
91
|
+
...(sectionSpec.id !== undefined && { id: sectionSpec.id }),
|
|
92
|
+
...(sectionSpec.title !== undefined && { title: translate(sectionSpec.title) }),
|
|
93
|
+
items: items.flatMap((entry) => {
|
|
94
|
+
const item = readStepListItem(entry);
|
|
95
|
+
if (item === undefined)
|
|
96
|
+
return [];
|
|
97
|
+
const { title, status, statusTone, description } = item;
|
|
98
|
+
return [
|
|
99
|
+
{
|
|
100
|
+
title: translate(title),
|
|
101
|
+
...(status !== undefined && { status: translate(status) }),
|
|
102
|
+
...(statusTone !== undefined && { statusTone }),
|
|
103
|
+
...(description !== undefined && { description: translate(description) }),
|
|
104
|
+
},
|
|
105
|
+
];
|
|
106
|
+
}),
|
|
107
|
+
};
|
|
108
|
+
}
|
|
64
109
|
// relatedList runs its own query — nothing here to resolve against
|
|
65
110
|
// entity/values, the spec passes through verbatim.
|
|
66
111
|
export function computeRelatedListSectionViewModel(sectionSpec, translate) {
|
|
@@ -89,6 +134,7 @@ export function computeRelatedListSectionViewModel(sectionSpec, translate) {
|
|
|
89
134
|
...(sectionSpec.rowTone !== undefined && { rowTone: sectionSpec.rowTone }),
|
|
90
135
|
...(sectionSpec.toolbarActions !== undefined && { toolbarActions: sectionSpec.toolbarActions }),
|
|
91
136
|
...(sectionSpec.actions !== undefined && { actions: sectionSpec.actions }),
|
|
137
|
+
...(sectionSpec.photoGrid !== undefined && { photoGrid: sectionSpec.photoGrid }),
|
|
92
138
|
...(sectionSpec.emptyState !== undefined && {
|
|
93
139
|
emptyState: {
|
|
94
140
|
title: translate(sectionSpec.emptyState.title),
|
|
@@ -129,6 +175,33 @@ function deriveFieldAffixHints(normalized, translate) {
|
|
|
129
175
|
...(normalized.fillAction !== undefined && {
|
|
130
176
|
fillAction: { ...normalized.fillAction, label: translate(normalized.fillAction.label) },
|
|
131
177
|
}),
|
|
178
|
+
...(normalized.aiAssist !== undefined && {
|
|
179
|
+
aiAssist: {
|
|
180
|
+
query: normalized.aiAssist.query,
|
|
181
|
+
resultField: normalized.aiAssist.resultField,
|
|
182
|
+
...(normalized.aiAssist.noteField !== undefined && {
|
|
183
|
+
noteField: normalized.aiAssist.noteField,
|
|
184
|
+
}),
|
|
185
|
+
...(normalized.aiAssist.contextFields !== undefined && {
|
|
186
|
+
contextFields: normalized.aiAssist.contextFields,
|
|
187
|
+
}),
|
|
188
|
+
...(normalized.aiAssist.chips !== undefined && {
|
|
189
|
+
chips: normalized.aiAssist.chips.map((chip) => ({
|
|
190
|
+
...chip,
|
|
191
|
+
label: translate(chip.label),
|
|
192
|
+
})),
|
|
193
|
+
}),
|
|
194
|
+
...(normalized.aiAssist.prompt !== undefined && {
|
|
195
|
+
prompt: {
|
|
196
|
+
param: normalized.aiAssist.prompt.param,
|
|
197
|
+
...(normalized.aiAssist.prompt.placeholder !== undefined && {
|
|
198
|
+
placeholder: translate(normalized.aiAssist.prompt.placeholder),
|
|
199
|
+
}),
|
|
200
|
+
},
|
|
201
|
+
}),
|
|
202
|
+
},
|
|
203
|
+
}),
|
|
204
|
+
...(normalized.valueChips !== undefined && { valueChips: normalized.valueChips }),
|
|
132
205
|
};
|
|
133
206
|
}
|
|
134
207
|
function deriveSelectOptionsQuery(fieldDef) {
|
|
@@ -395,6 +468,9 @@ export function computeEditViewModel(input) {
|
|
|
395
468
|
if (isWriteFormEditSection(sectionSpec)) {
|
|
396
469
|
return computeWriteFormSectionViewModel(sectionSpec, screen.id, values, translate, featureName);
|
|
397
470
|
}
|
|
471
|
+
if (sectionSpec.kind === "stepList") {
|
|
472
|
+
return computeStepListSectionViewModel(sectionSpec, values, translate);
|
|
473
|
+
}
|
|
398
474
|
if (!isFieldsEditSection(sectionSpec)) {
|
|
399
475
|
return computeRelatedListSectionViewModel(sectionSpec, translate);
|
|
400
476
|
}
|
|
@@ -423,8 +499,8 @@ export function computeEditViewModel(input) {
|
|
|
423
499
|
? parseRefTarget(normalized.refEntity, featureName)
|
|
424
500
|
: undefined;
|
|
425
501
|
const effectiveType = declaredRefTarget !== undefined ? "reference" : fieldDef.type;
|
|
426
|
-
const label =
|
|
427
|
-
fieldLabelKey(featureName, screen.entity, normalized.field));
|
|
502
|
+
const label = resolveFieldText(screen.fieldLabels?.[normalized.field] ??
|
|
503
|
+
fieldLabelKey(featureName, screen.entity, normalized.field), values, translate).text;
|
|
428
504
|
const visible = isEditFieldVisible(normalized, fieldDef, values);
|
|
429
505
|
// `readOnly` (camelCase) is the name on both sides: EditFieldSpec
|
|
430
506
|
// in the engine, and the view-model emitted here. One convention
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { FieldTextRef } from "@cosmicdrift/kumiko-framework/ui-types";
|
|
2
|
+
import type { Translate } from "./types.ts";
|
|
3
|
+
export declare function fieldTextKey(ref: FieldTextRef): string;
|
|
4
|
+
/** Translates a label or help text, filling `{placeholder}`s from the form values (hidden
|
|
5
|
+
* fields included). `complete` is false while any referenced value is empty. */
|
|
6
|
+
export declare function resolveFieldText(ref: FieldTextRef, values: Readonly<Record<string, unknown>>, translate: Translate): {
|
|
7
|
+
readonly text: string;
|
|
8
|
+
readonly complete: boolean;
|
|
9
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export function fieldTextKey(ref) {
|
|
2
|
+
return typeof ref === "string" ? ref : ref.key;
|
|
3
|
+
}
|
|
4
|
+
/** Translates a label or help text, filling `{placeholder}`s from the form values (hidden
|
|
5
|
+
* fields included). `complete` is false while any referenced value is empty. */
|
|
6
|
+
export function resolveFieldText(ref, values, translate) {
|
|
7
|
+
if (typeof ref === "string")
|
|
8
|
+
return { text: translate(ref), complete: true };
|
|
9
|
+
const params = {};
|
|
10
|
+
let complete = true;
|
|
11
|
+
for (const [placeholder, fieldName] of Object.entries(ref.params)) {
|
|
12
|
+
const value = values[fieldName];
|
|
13
|
+
const text = value === undefined || value === null ? "" : String(value);
|
|
14
|
+
if (text === "")
|
|
15
|
+
complete = false;
|
|
16
|
+
params[placeholder] = text;
|
|
17
|
+
}
|
|
18
|
+
return { text: translate(ref.key, params), complete };
|
|
19
|
+
}
|
|
@@ -2,6 +2,7 @@ export type { ComputeEditViewModelInput, EditFormMode } from "./edit.ts";
|
|
|
2
2
|
export { computeEditViewModel, computeRelatedListSectionViewModel } from "./edit.ts";
|
|
3
3
|
export type { DerivedCellRoundingTarget, EmbeddedDerivedOp, EmbeddedListIssueGroups, } from "./embedded-list.ts";
|
|
4
4
|
export { computeDerivedCellValue, groupEmbeddedListIssues, roundDerivedCellValue, sumEmbeddedListColumn, withDerivedCells, } from "./embedded-list.ts";
|
|
5
|
+
export { fieldTextKey, resolveFieldText } from "./field-text.ts";
|
|
5
6
|
export type { ComputeListViewModelInput } from "./list.ts";
|
|
6
7
|
export { buildOptionLabels, computeListViewModel, embeddedCellLabelKey, embeddedCellOptionLabelKey, fieldLabelKey, fieldOptionLabelKey, fieldOptionLabelKeyPrefix, } from "./list.ts";
|
|
7
8
|
export type { CellLink, CellLinkItem, EditExtensionSectionViewModel, EditFieldSpec, EditFieldsSectionViewModel, EditFieldViewModel, EditRelatedListSectionViewModel, EditSectionSpec, EditSectionViewModel, EditViewModel, EditWriteFormSectionViewModel, EmbeddedListCellViewModel, FieldConditionCtx, FieldRenderer, ListColumnCellDisplay, ListColumnFileDisplay, ListColumnHintViewModel, ListColumnSpec, ListColumnViewModel, ListRowViewModel, ListViewModel, RuntimeCellLink, RuntimeCellLinkItems, RuntimeRenderer, ScreenSlots, Translate, } from "./types.ts";
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
export { computeEditViewModel, computeRelatedListSectionViewModel } from "./edit.js";
|
|
2
2
|
export { computeDerivedCellValue, groupEmbeddedListIssues, roundDerivedCellValue, sumEmbeddedListColumn, withDerivedCells, } from "./embedded-list.js";
|
|
3
|
+
export { fieldTextKey, resolveFieldText } from "./field-text.js";
|
|
3
4
|
export { buildOptionLabels, computeListViewModel, embeddedCellLabelKey, embeddedCellOptionLabelKey, fieldLabelKey, fieldOptionLabelKey, fieldOptionLabelKeyPrefix, } from "./list.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { EditFieldSpec, EditSectionSpec, EmbeddedDerivedCellDef, FieldAffix, FieldCondition, FieldFillAction, FieldIconKey, FieldRenderer, IconKey, ListBulkAction, ListColumnSpec, ListFacetSpec, ListSortSpec, ListTableOptions, OptionsQueryPayload, PlatformComponent, RelatedListEmptyStateVariant, RelatedListRowTone, RelatedListToolbarAction, RowAction, RowActionMode, ScreenSlots, SelectOptionTone } from "@cosmicdrift/kumiko-framework/ui-types";
|
|
1
|
+
import type { EditFieldSpec, EditSectionSpec, EmbeddedDerivedCellDef, FieldAffix, FieldAiAssist, FieldCondition, FieldFillAction, FieldIconKey, FieldRenderer, FieldValueChips, IconKey, ListBulkAction, ListColumnSpec, ListFacetSpec, ListSortSpec, ListTableOptions, OptionsQueryPayload, PlatformComponent, RelatedListEmptyStateVariant, RelatedListRowTone, RelatedListToolbarAction, RowAction, RowActionMode, ScreenSlots, SelectOptionTone } from "@cosmicdrift/kumiko-framework/ui-types";
|
|
2
2
|
export type RuntimeRenderer = (value: unknown, row?: Readonly<Record<string, unknown>>) => string;
|
|
3
3
|
/** Where a cell's text links to. `href` comes from NavApi.hrefFor (new-tab and
|
|
4
4
|
* copy-link work); `onPress` is the in-app navigation for a plain click. */
|
|
@@ -60,6 +60,8 @@ export type ListColumnViewModel = {
|
|
|
60
60
|
readonly hideOnNarrow?: boolean;
|
|
61
61
|
/** Mirrors `ListColumnSpec.showOnNarrowOnly`: the table layout skips the column. */
|
|
62
62
|
readonly showOnNarrowOnly?: boolean;
|
|
63
|
+
/** Mirrors `ListColumnSpec.narrowInline`: the card draws consecutive such columns on one line. */
|
|
64
|
+
readonly narrowInline?: boolean;
|
|
63
65
|
/** Only for `type: "number"` — mirrors `NumberFieldDef.grouping` (default
|
|
64
66
|
* `true`). `false` renders without thousands-separators (e.g. a model
|
|
65
67
|
* year). */
|
|
@@ -79,6 +81,10 @@ export type ListColumnViewModel = {
|
|
|
79
81
|
readonly badgeToneField?: string;
|
|
80
82
|
/** `false`: the pill has no leading dot. */
|
|
81
83
|
readonly badgeDot?: false;
|
|
84
|
+
/** Row field with the label of a pill drawn beside the cell value (`ListColumnSpec.pillField`). */
|
|
85
|
+
readonly pillField?: string;
|
|
86
|
+
/** Row field naming the pill tone. */
|
|
87
|
+
readonly pillToneField?: string;
|
|
82
88
|
/** `false`: an empty cell stays blank instead of showing "—". */
|
|
83
89
|
readonly emptyPlaceholder?: false;
|
|
84
90
|
};
|
|
@@ -87,6 +93,8 @@ export type ListColumnHintViewModel = {
|
|
|
87
93
|
readonly detailField?: string;
|
|
88
94
|
/** `ListColumnHint.narrowDetailField`: replaces `detailField` in the phone card. */
|
|
89
95
|
readonly narrowDetailField?: string;
|
|
96
|
+
/** `ListColumnHint.narrowField`: replaces the sentence value in the phone card. */
|
|
97
|
+
readonly narrowField?: string;
|
|
90
98
|
readonly toneField?: string;
|
|
91
99
|
readonly reasonField?: string;
|
|
92
100
|
readonly reasonOpenField?: string;
|
|
@@ -183,7 +191,7 @@ export type EditFieldViewModel = {
|
|
|
183
191
|
* toggle instead of the default combobox dropdown. Set for
|
|
184
192
|
* `type: "select"` when SelectFieldDef.display is "radio" or "dropdown" —
|
|
185
193
|
* the renderer then skips its own radio-vs-dropdown heuristic. */
|
|
186
|
-
readonly display?: "checkboxes" | "dropdown" | "radio";
|
|
194
|
+
readonly display?: "checkboxes" | "chips" | "dropdown" | "radio";
|
|
187
195
|
/** `type: "select"` only: tone per option, shown on the selected radio segment. */
|
|
188
196
|
readonly optionTones?: Readonly<Partial<Record<string, SelectOptionTone>>>;
|
|
189
197
|
/** Set for `type: "multiSelect"` when MultiSelectFieldDef.columns is
|
|
@@ -285,6 +293,10 @@ export type EditFieldViewModel = {
|
|
|
285
293
|
readonly suffix?: FieldAffix;
|
|
286
294
|
/** From EditFieldSpec.fillAction, `label` already translated. */
|
|
287
295
|
readonly fillAction?: FieldFillAction;
|
|
296
|
+
/** From EditFieldSpec.aiAssist, chip labels and the prompt placeholder already translated. */
|
|
297
|
+
readonly aiAssist?: FieldAiAssist;
|
|
298
|
+
/** From EditFieldSpec.valueChips. */
|
|
299
|
+
readonly valueChips?: FieldValueChips;
|
|
288
300
|
/** Only set for an embedded-LIST field (`multiple: true`) — the per-cell
|
|
289
301
|
* metadata the renderer needs to draw each column/cell. Absent for a
|
|
290
302
|
* plain (non-list) embedded field. */
|
|
@@ -327,7 +339,7 @@ export type EditFieldViewModel = {
|
|
|
327
339
|
readonly field: string;
|
|
328
340
|
};
|
|
329
341
|
};
|
|
330
|
-
export type EditSectionViewModel = EditFieldsSectionViewModel | EditExtensionSectionViewModel | EditRelatedListSectionViewModel | EditWriteFormSectionViewModel;
|
|
342
|
+
export type EditSectionViewModel = EditFieldsSectionViewModel | EditExtensionSectionViewModel | EditRelatedListSectionViewModel | EditWriteFormSectionViewModel | EditStepListSectionViewModel;
|
|
331
343
|
export type EditFieldsSectionViewModel = {
|
|
332
344
|
readonly kind: "fields";
|
|
333
345
|
/** From `EditFieldsSection.id`. The boot-validator makes it mandatory under
|
|
@@ -390,6 +402,19 @@ export type EditExtensionSectionViewModel = {
|
|
|
390
402
|
/** From `EditExtensionSection.actions`. */
|
|
391
403
|
readonly actions?: readonly RowAction[];
|
|
392
404
|
};
|
|
405
|
+
export type EditStepListSectionViewModel = {
|
|
406
|
+
readonly kind: "stepList";
|
|
407
|
+
readonly id?: string;
|
|
408
|
+
readonly title?: string;
|
|
409
|
+
/** Read from the record at view-model time; texts are already translated. */
|
|
410
|
+
readonly items: readonly {
|
|
411
|
+
readonly title: string;
|
|
412
|
+
readonly status?: string;
|
|
413
|
+
readonly statusTone?: SelectOptionTone;
|
|
414
|
+
readonly description?: string;
|
|
415
|
+
}[];
|
|
416
|
+
readonly actions?: undefined;
|
|
417
|
+
};
|
|
393
418
|
export type EditRelatedListSectionViewModel = {
|
|
394
419
|
readonly kind: "relatedList";
|
|
395
420
|
readonly id?: string;
|
|
@@ -422,6 +447,11 @@ export type EditRelatedListSectionViewModel = {
|
|
|
422
447
|
* Section's title row, distinct from `toolbarActions` (which render
|
|
423
448
|
* above the table itself). */
|
|
424
449
|
readonly actions?: readonly RowAction[];
|
|
450
|
+
/** From `EditRelatedListSection.photoGrid` — draws the rows as image tiles. */
|
|
451
|
+
readonly photoGrid?: {
|
|
452
|
+
readonly imageField: string;
|
|
453
|
+
readonly captionField?: string;
|
|
454
|
+
};
|
|
425
455
|
/** From `EditRelatedListSection.emptyState` — forwarded to the
|
|
426
456
|
* DataTable's `emptyState` prop when the section has zero rows. */
|
|
427
457
|
readonly emptyState?: {
|
package/dist/i18n-defaults.js
CHANGED
|
@@ -48,6 +48,8 @@ export const kumikoDefaultTranslations = {
|
|
|
48
48
|
"kumiko.field.file-list.preview": "Preview",
|
|
49
49
|
"kumiko.field.file-list.view": "View",
|
|
50
50
|
"kumiko.field.fillAction.failed": "Could not fetch a suggestion.",
|
|
51
|
+
"kumiko.field.aiAssist.prompt": "Tell the AI what to change",
|
|
52
|
+
"kumiko.field.aiAssist.failed": "The AI could not rewrite the text.",
|
|
51
53
|
"kumiko.field.writeOnly.remove": "Remove stored value",
|
|
52
54
|
"kumiko.field.writeOnly.set": "Set",
|
|
53
55
|
"kumiko.field.writeOnly.maskedSet": "•••••••••• set",
|
|
@@ -156,7 +158,6 @@ export const kumikoDefaultTranslations = {
|
|
|
156
158
|
"kumiko.pager.status": "{from}–{to} of {total}",
|
|
157
159
|
"kumiko.pager.goToPage": "Page {page}",
|
|
158
160
|
"kumiko.form.all-required": "All fields are required.",
|
|
159
|
-
"kumiko.pager.status.noun": "{from}–{to} of {total} {noun}",
|
|
160
161
|
"kumiko.pager.pageSize": "{size} per page",
|
|
161
162
|
"kumiko.pager.pageSizeLabel": "Entries per page",
|
|
162
163
|
"kumiko.list.count.noun": "{count} {noun}",
|
|
@@ -284,6 +285,8 @@ export const kumikoDefaultTranslations = {
|
|
|
284
285
|
"kumiko.widget.message-thread.showImages": "Load images",
|
|
285
286
|
"kumiko.widget.message-reader.mail": "Mail",
|
|
286
287
|
"kumiko.widget.step-list.progress": "{done} of {total} done",
|
|
288
|
+
"kumiko.widget.step-list.total.one": "1 step",
|
|
289
|
+
"kumiko.widget.step-list.total.other": "{count} steps",
|
|
287
290
|
"kumiko.widget.step-list.progressLabel": "Progress",
|
|
288
291
|
"kumiko.widget.step-list.moreSteps": "and {count} more steps",
|
|
289
292
|
"kumiko.widget.step-list.waitingFor": "Waiting for: {reason}",
|
package/dist/index.d.ts
CHANGED
|
@@ -94,7 +94,7 @@ export { InsideDrawerProvider, useInsideDrawer } from "./inside-drawer.ts";
|
|
|
94
94
|
export { hasUnsavedInput, registerUnsavedInputSource, requestLeave, setLeaveConfirmer, useUnsavedInputSource, } from "./leave-guard.ts";
|
|
95
95
|
export { LeaveGuardDialog } from "./leave-guard-dialog.tsx";
|
|
96
96
|
export { PageHeaderCompactProvider, PageHeaderSlotAvailableProvider, usePageHeaderCompact, usePageHeaderSlotAvailable, } from "./page-header-slot.ts";
|
|
97
|
-
export type { ActionMenuItemSpec, ActionOverflowMenuProps, AppPrimitives, BannerProps, BulkRowOutcome, ButtonProps, CardOptions, CardProps, CardSlots, CopyButtonProps, CorePrimitives, DataTableBulk, DataTableBulkAction, DataTableDateRangeFacet, DataTableFacet, DataTableFacetChip, DataTableProps, DataTableRowAction, DataTableRowActionMode, DataTableSort, DataTableSortDir, DialogProps, DrawerProps, EmbeddedListCellType, EmbeddedListColumn, EmbeddedListInputProps, EmbeddedListTotal, FieldCellWidth, FieldProps, FileValueListProps, FillContainerProps, FooterActionMarker, FooterActionRole, FormProps, FormSectionNavItem, FormWidth, GridCellProps, GridProps, HeadingProps, InputEndAction, InputFillAction, InputProps, JsonViewProps, LightboxImage, LightboxProps, LinkProps, MetricBandProps, MetricProps, ModalProps, PageHeaderProps, PickedFile, PrimitivesProviderProps, PrimitivesRegistry, ProgressProps, ProgressTone, PromoPanelAction, PromoPanelProps, RecordBreadcrumbProps, RecordStepsProps, RecordSummaryProps, RuntimeRenderer, SecretRevealProps, SecretRevealValue, SectionProps, ShareButtonProps, StatusBadgeProps, StatusTone, StepBarProps, StickyActionBarProps, StickyPrimaryActionMarker, TabsProps, TextProps, TrailingInputAction, WizardStepGroupProps, } from "./primitives.tsx";
|
|
97
|
+
export type { ActionMenuItemSpec, ActionOverflowMenuProps, AppPrimitives, BannerProps, BulkRowOutcome, ButtonProps, CardOptions, CardProps, CardSlots, CopyButtonProps, CorePrimitives, DataTableBulk, DataTableBulkAction, DataTableDateRangeFacet, DataTableFacet, DataTableFacetChip, DataTableProps, DataTableRowAction, DataTableRowActionMode, DataTableSort, DataTableSortDir, DialogProps, DrawerProps, EmbeddedListCellType, EmbeddedListColumn, EmbeddedListInputProps, EmbeddedListTotal, FieldCellWidth, FieldProps, FileValueListProps, FillContainerProps, FooterActionMarker, FooterActionRole, FormProps, FormSectionNavItem, FormWidth, GridCellProps, GridProps, HeadingProps, InputEndAction, InputFillAction, InputProps, JsonViewProps, LightboxImage, LightboxProps, LinkProps, MetricBandProps, MetricProps, ModalProps, PageHeaderProps, PhotoGridProps, PickedFile, PrimitivesProviderProps, PrimitivesRegistry, ProgressProps, ProgressTone, PromoPanelAction, PromoPanelProps, RecordBreadcrumbProps, RecordStepsProps, RecordSummaryProps, RuntimeRenderer, SecretRevealProps, SecretRevealValue, SectionProps, ShareButtonProps, StatusBadgeProps, StatusTone, StepBarProps, StepListProps, StickyActionBarProps, StickyPrimaryActionMarker, TabsProps, TextProps, TrailingInputAction, WizardStepGroupProps, } from "./primitives.tsx";
|
|
98
98
|
export { FOOTER_ACTION_ROLE_PROP, NARROW_LABEL_PROP, PrimitivesProvider, STICKY_PRIMARY_ACTION_PROP, shouldRenderActionsIconOnly, statusToneForOptionTone, statusToneForValue, useOptionalPrimitives, usePrimitives, } from "./primitives.tsx";
|
|
99
99
|
export type { SessionEndedSignal, SessionEndedSignalProviderProps, } from "./session/session-ended.tsx";
|
|
100
100
|
export { createSessionEndedSignal, isSessionEndedError, SESSION_ENDED_ERROR_CODES, SessionEndedSignalProvider, useSessionEndedSignal, withSessionEndedDetection, } from "./session/session-ended.tsx";
|
package/dist/metric-types.d.ts
CHANGED
|
@@ -17,6 +17,8 @@ export type MetricProps = {
|
|
|
17
17
|
readonly icon?: NavIconKey;
|
|
18
18
|
/** Small muted line under the value (see `MetricSpec.subField`). */
|
|
19
19
|
readonly sub?: string;
|
|
20
|
+
/** Replaces `sub` below `sm` (see `MetricSpec.subFieldNarrow`). */
|
|
21
|
+
readonly narrowSub?: string;
|
|
20
22
|
};
|
|
21
23
|
/** Band above the tabs of a record detail: optional subtitle line plus the
|
|
22
24
|
* metrics as a definition list. `children` are `Metric` tiles. */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { SelectOptionTone } from "@cosmicdrift/kumiko-framework/ui-types";
|
|
1
|
+
import type { NavIconKey, SelectOptionTone } from "@cosmicdrift/kumiko-framework/ui-types";
|
|
2
2
|
import type { ReactNode } from "react";
|
|
3
3
|
import type { CellLink } from "./headless/index.ts";
|
|
4
4
|
/** Path above a record header; an item with a `link` is a link, the last item without one names the current record. */
|
|
@@ -16,6 +16,31 @@ export type RecordSummaryProps = {
|
|
|
16
16
|
/** Shown instead of `text` below the sm breakpoint. */
|
|
17
17
|
readonly narrowText?: string;
|
|
18
18
|
readonly tone?: SelectOptionTone;
|
|
19
|
+
/** Leads the sentence; the sentence then has no bordered box. */
|
|
20
|
+
readonly icon?: NavIconKey;
|
|
21
|
+
readonly testId?: string;
|
|
22
|
+
};
|
|
23
|
+
/** Grid of image tiles; each tile shows a stored file and its own action buttons underneath. */
|
|
24
|
+
export type PhotoGridProps = {
|
|
25
|
+
readonly tiles: readonly {
|
|
26
|
+
readonly id: string;
|
|
27
|
+
/** FileRef id of the image; a tile without one shows a placeholder. */
|
|
28
|
+
readonly imageId?: string;
|
|
29
|
+
readonly caption?: string;
|
|
30
|
+
readonly actions?: ReactNode;
|
|
31
|
+
}[];
|
|
32
|
+
readonly testId?: string;
|
|
33
|
+
};
|
|
34
|
+
/** Vertical numbered steps joined by a line; each step has a title, an optional status pill and
|
|
35
|
+
* a description line. */
|
|
36
|
+
export type StepListProps = {
|
|
37
|
+
readonly items: readonly {
|
|
38
|
+
readonly id: string;
|
|
39
|
+
readonly title: string;
|
|
40
|
+
readonly status?: string;
|
|
41
|
+
readonly statusTone?: SelectOptionTone;
|
|
42
|
+
readonly description?: string;
|
|
43
|
+
}[];
|
|
19
44
|
readonly testId?: string;
|
|
20
45
|
};
|
|
21
46
|
/** "Next steps" panel; an item's `reason` sits behind a toggle labelled `reasonLabel`. */
|
|
@@ -30,9 +55,13 @@ export type RecordStepsProps = {
|
|
|
30
55
|
/** Toggle label for the hidden steps; receives their count. */
|
|
31
56
|
readonly moreLabel?: (hiddenCount: number) => string;
|
|
32
57
|
readonly lessLabel?: string;
|
|
58
|
+
/** Label before the further actions of each item. */
|
|
59
|
+
readonly moreActionsLabel?: string;
|
|
33
60
|
readonly items: readonly {
|
|
34
61
|
readonly id: string;
|
|
35
62
|
readonly title: string;
|
|
63
|
+
/** Replaces `title` below the sm breakpoint. */
|
|
64
|
+
readonly narrowTitle?: string;
|
|
36
65
|
readonly detail?: string;
|
|
37
66
|
/** Replaces `detail` below the sm breakpoint. */
|
|
38
67
|
readonly narrowDetail?: string;
|
package/dist/primitives.d.ts
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import type { ConfigCascade, ConfigScope, ConfigValueSource } from "@cosmicdrift/kumiko-framework/engine";
|
|
2
2
|
import type { FieldIconKey, FormWidth, IconKey, NavIconKey, RowActionDisplay, SelectOptionTone } from "@cosmicdrift/kumiko-framework/ui-types";
|
|
3
3
|
import { type ComponentType, type FormEvent, type KeyboardEvent, type ReactNode, type Ref } from "react";
|
|
4
|
+
import type { CardOptions } from "./card-options.ts";
|
|
4
5
|
import type { DataTableBulk } from "./data-table-bulk-types.ts";
|
|
5
6
|
import type { DataTableDateRangeFacet, DataTableFacet } from "./data-table-facet-types.ts";
|
|
6
7
|
import type { DataTableTableBlock } from "./data-table-view-types.ts";
|
|
7
8
|
import type { EmbeddedListInputProps } from "./embedded-list-types.ts";
|
|
8
9
|
import type { FieldIssue, ListColumnViewModel, ListRowViewModel, RuntimeRenderer } from "./headless/index.ts";
|
|
9
10
|
import type { MetricBandProps, MetricProps } from "./metric-types.ts";
|
|
10
|
-
import type { RecordBreadcrumbProps, RecordStepsProps, RecordSummaryProps } from "./primitives-record-guidance.ts";
|
|
11
|
+
import type { PhotoGridProps, RecordBreadcrumbProps, RecordStepsProps, RecordSummaryProps, StepListProps } from "./primitives-record-guidance.ts";
|
|
11
12
|
import type { StatusBadgeOptionTone, StatusTone } from "./status-tone.ts";
|
|
12
13
|
export type { EmbeddedListCellType, EmbeddedListColumn, EmbeddedListInputProps, EmbeddedListTotal, } from "./embedded-list-types.ts";
|
|
13
14
|
export type { RuntimeRenderer };
|
|
@@ -22,7 +23,8 @@ export type DataAttributes = Readonly<Record<`data-${string}`, string>>;
|
|
|
22
23
|
* split can't inspect (see `ScreenSlots.footerPrimary`). */
|
|
23
24
|
export declare const STICKY_PRIMARY_ACTION_PROP: "kumikoStickyPrimaryAction";
|
|
24
25
|
export type StickyPrimaryActionMarker = Partial<Record<typeof STICKY_PRIMARY_ACTION_PROP, boolean>>;
|
|
25
|
-
|
|
26
|
+
/** "inline" keeps a non-primary action as a visible button in the phone footer instead of the "…" menu. */
|
|
27
|
+
export type FooterActionRole = "back" | "primary" | "inline";
|
|
26
28
|
/** Tells the pinned phone footer which node is Back and which is the primary
|
|
27
29
|
* action, for buttons that are not `type="submit"` (e.g. the wizard Back). */
|
|
28
30
|
export declare const FOOTER_ACTION_ROLE_PROP: "kumikoFooterActionRole";
|
|
@@ -126,6 +128,10 @@ export type BannerProps = {
|
|
|
126
128
|
readonly icon?: NavIconKey;
|
|
127
129
|
/** Bold heading above `children`, inside the text column. */
|
|
128
130
|
readonly title?: ReactNode;
|
|
131
|
+
/** Replaces `title` below sm. */
|
|
132
|
+
readonly narrowTitle?: ReactNode;
|
|
133
|
+
/** Replaces `children` below sm and stays visible there even when `inline` drops the text. */
|
|
134
|
+
readonly narrowText?: ReactNode;
|
|
129
135
|
readonly titleTestId?: string;
|
|
130
136
|
readonly children?: ReactNode;
|
|
131
137
|
/** Structured text after `children`; `strong` parts render emphasized.
|
|
@@ -691,7 +697,7 @@ export declare function shouldRenderActionsIconOnly(actions: readonly {
|
|
|
691
697
|
export type { BulkRowOutcome, DataTableBulk, DataTableBulkAction, } from "./data-table-bulk-types.ts";
|
|
692
698
|
export type { DataTableDateRangeFacet, DataTableFacet, DataTableFacetChip, } from "./data-table-facet-types.ts";
|
|
693
699
|
export type { MetricBandProps, MetricProps } from "./metric-types.ts";
|
|
694
|
-
export type { RecordBreadcrumbProps, RecordStepsProps, RecordSummaryProps, } from "./primitives-record-guidance.ts";
|
|
700
|
+
export type { PhotoGridProps, RecordBreadcrumbProps, RecordStepsProps, RecordSummaryProps, StepListProps, } from "./primitives-record-guidance.ts";
|
|
695
701
|
export type DataTableProps = {
|
|
696
702
|
readonly columns: readonly ListColumnViewModel[];
|
|
697
703
|
readonly rows: readonly ListRowViewModel[];
|
|
@@ -722,7 +728,7 @@ export type DataTableProps = {
|
|
|
722
728
|
* - `"inline"`: ALWAYS inline buttons, left-aligned, even with >2 (no
|
|
723
729
|
* kebab). Actions then sit at the same x-position across all rows
|
|
724
730
|
* (no drifting with label width) and all lists in an app look alike.
|
|
725
|
-
* - `"menu"`: every action in the kebab, the row opener included; phone cards draw none. */
|
|
731
|
+
* - `"menu"`: every action in the kebab, the row opener included; phone cards draw none when the row opens, a card without a row target keeps it. */
|
|
726
732
|
readonly rowActionMode?: DataTableRowActionMode;
|
|
727
733
|
/** Present: row checkboxes plus a selection bar that runs these actions once per selected row. */
|
|
728
734
|
readonly bulk?: DataTableBulk;
|
|
@@ -1001,6 +1007,8 @@ export type GridProps = {
|
|
|
1001
1007
|
* a `role="group"` so a Field whose control is a set of inputs (checkbox
|
|
1002
1008
|
* group) still gives screen readers a group name. */
|
|
1003
1009
|
readonly ariaLabelledBy?: string;
|
|
1010
|
+
/** With `columns: "auto"`: the small gap of a chip row instead of the tile gap. */
|
|
1011
|
+
readonly tight?: boolean;
|
|
1004
1012
|
};
|
|
1005
1013
|
/** Width class of a field cell inside a `flow` grid: sized by what the field holds. */
|
|
1006
1014
|
export type FieldCellWidth = "text" | "number" | "money" | "date" | "timestamp" | "select" | "full" | "toggle";
|
|
@@ -1168,29 +1176,7 @@ export type CardSlots = {
|
|
|
1168
1176
|
/** Footer content, separated by a top border; aligned to the right by default. */
|
|
1169
1177
|
readonly footer?: ReactNode;
|
|
1170
1178
|
};
|
|
1171
|
-
|
|
1172
|
-
export type CardOptions = {
|
|
1173
|
-
/** Body-Padding (px-6 py-6). false = randlos (Tabelle/eigene Tiles). Default true. */
|
|
1174
|
-
readonly padded?: boolean;
|
|
1175
|
-
/** Eckenradius. Default "xl" (= Entity-Card). */
|
|
1176
|
-
readonly radius?: "lg" | "xl";
|
|
1177
|
-
/** Separates the footer with `border-t` and `bg-muted/30`. Defaults to true. */
|
|
1178
|
-
readonly footerBordered?: boolean;
|
|
1179
|
-
/** Footer horizontal padding. false = none, so footer content aligns with the card edge. Default true. */
|
|
1180
|
-
readonly footerInset?: boolean;
|
|
1181
|
-
/** Joins the ancestor fillHeight flex chain — a tabs-mode
|
|
1182
|
-
* relatedList table sizing to the panel instead of the page — instead of
|
|
1183
|
-
* normal document-flow height. Default false. */
|
|
1184
|
-
readonly fillHeight?: boolean;
|
|
1185
|
-
/** false drops border, background, shadow and radius but keeps padding and
|
|
1186
|
-
* header slots — a panel inside a host surface such as a tab panel. Default true. */
|
|
1187
|
-
readonly framed?: boolean;
|
|
1188
|
-
/** The card is the whole screen body (secretMint reveal and done phase):
|
|
1189
|
-
* no frame, the shared screen insets and width of form screens, children
|
|
1190
|
-
* stacked with a gap. Without it such a screen sits raw against the
|
|
1191
|
-
* shell edge. Default false. */
|
|
1192
|
-
readonly screenBody?: boolean;
|
|
1193
|
-
};
|
|
1179
|
+
export type { CardOptions };
|
|
1194
1180
|
/** Generic card chrome (border/background/radius/shadow plus
|
|
1195
1181
|
* header/body/footer) as a primitive, providing one implementation for all
|
|
1196
1182
|
* card surfaces. It is slot- and option-based so the contract can evolve
|
|
@@ -1512,6 +1498,10 @@ export type CorePrimitives = {
|
|
|
1512
1498
|
readonly RecordBreadcrumb?: ComponentType<RecordBreadcrumbProps>;
|
|
1513
1499
|
/** Optional — without it the summary renders as plain text. */
|
|
1514
1500
|
readonly RecordSummary?: ComponentType<RecordSummaryProps>;
|
|
1501
|
+
/** Optional — without it a relatedList with `photoGrid` falls back to its table. */
|
|
1502
|
+
readonly PhotoGrid?: ComponentType<PhotoGridProps>;
|
|
1503
|
+
/** Optional — without it a stepList section renders nothing. */
|
|
1504
|
+
readonly StepList?: ComponentType<StepListProps>;
|
|
1515
1505
|
/** Optional — without it the steps render as a plain card. */
|
|
1516
1506
|
readonly RecordSteps?: ComponentType<RecordStepsProps>;
|
|
1517
1507
|
/** Optional: without an implementation, callers with >2 header/row
|
|
@@ -6,6 +6,7 @@ import { buildScopeBadge, dashboardDescription, recordTitleText, renderActionErr
|
|
|
6
6
|
import { ListPanelBody } from "./dashboard-list-panel.js";
|
|
7
7
|
import { HiddenOnNarrow } from "./dashboard-narrow-gate.js";
|
|
8
8
|
import { panelsInNarrowOrder } from "./dashboard-narrow-order.js";
|
|
9
|
+
import { DashboardPanelGrid } from "./dashboard-panel-columns.js";
|
|
9
10
|
import { ChartPanelBody, CustomPanelBody, FeedPanelBody, ProgressListPanelBody, StatPanelBody, } from "./dashboard-panels.js";
|
|
10
11
|
import { ScreenPanelTile } from "./dashboard-screen-tiles.js";
|
|
11
12
|
import { DashboardQueryContext, HALF_PANEL, PanelLoadedContext, STAT_PANEL, THIRD_PANEL, TWO_THIRDS_PANEL, useDashboardFormats, WIDE_PANEL, } from "./dashboard-shared.js";
|
|
@@ -54,7 +55,7 @@ function PanelBody({ panel, label, featureName, screenId, screenParams, translat
|
|
|
54
55
|
return (_jsx(FeedPanelBody, { panel: panel, label: text, screenParams: screenParams, translate: translate }));
|
|
55
56
|
}
|
|
56
57
|
if (panel.kind === "text") {
|
|
57
|
-
return (_jsx(TextPanelBody, { panel: panel, label: label, screenParams: screenParams, translate: translate }));
|
|
58
|
+
return (_jsx(TextPanelBody, { screenId: screenId, panel: panel, label: label, screenParams: screenParams, translate: translate }));
|
|
58
59
|
}
|
|
59
60
|
return (_jsx(ProgressListPanelBody, { panel: panel, label: text, screenParams: screenParams, translate: translate }));
|
|
60
61
|
}
|
|
@@ -106,5 +107,5 @@ export function WebDashboardBody({ featureName, screen, translate, }) {
|
|
|
106
107
|
const headerActionsBar = renderHeaderActionsBar(model);
|
|
107
108
|
// The shell header owns the title; the badge and the actions sit in it there.
|
|
108
109
|
const badgeInHeader = scopeBadge !== null && usesPageHeaderSlot;
|
|
109
|
-
return (_jsx(PanelLoadedContext.Provider, { value: params.reportLoaded, children: _jsx(DashboardQueryContext.Provider, { value: record.queryRuntime, children: _jsxs(PageSection, { className: "flex flex-col gap-4", testId: `dashboard-${screen.id}`, children: [renderPageHeaderSlot(model, headerActionsBar, badgeInHeader), renderTitleRow(model, headerActionsBar, badgeInHeader), renderActionErrorBanner(primitives, actionError), renderRecordError(model, recordQuery.error, recordRow, refetchRecord), renderDescriptionAndNotice(model, description), _jsxs(VisibilityQueryContext.Provider, { value: visibility.gateResultsWithPending, children: [_jsx(VisibilityGateQueries, { gates: visibility.visibilityGates, onResult: visibility.gateResults.report, onForget: visibility.gateResults.forget }), _jsx(
|
|
110
|
+
return (_jsx(PanelLoadedContext.Provider, { value: params.reportLoaded, children: _jsx(DashboardQueryContext.Provider, { value: record.queryRuntime, children: _jsxs(PageSection, { className: "flex flex-col gap-4", testId: `dashboard-${screen.id}`, children: [renderPageHeaderSlot(model, headerActionsBar, badgeInHeader), renderTitleRow(model, headerActionsBar, badgeInHeader), renderActionErrorBanner(primitives, actionError), renderRecordError(model, recordQuery.error, recordRow, refetchRecord), renderDescriptionAndNotice(model, description), _jsxs(VisibilityQueryContext.Provider, { value: visibility.gateResultsWithPending, children: [_jsx(VisibilityGateQueries, { gates: visibility.visibilityGates, onResult: visibility.gateResults.report, onForget: visibility.gateResults.forget }), _jsx(DashboardPanelGrid, { layout: screen.layout, panels: panelsInNarrowOrder(screen.panels, belowSm), belowSm: belowSm, renderPanel: (panel) => renderDashboardPanel(panel, featureName, screen.id, screenParams, effectiveTranslate) })] })] }) }) }));
|
|
110
111
|
}
|
|
@@ -60,7 +60,7 @@ function renderDateStamp(model) {
|
|
|
60
60
|
const { screen } = model;
|
|
61
61
|
if (screen.showUpdatedAt === false || !hasDataPanel(screen.panels))
|
|
62
62
|
return null;
|
|
63
|
-
return (_jsx("span", { "data-testid": `dashboard-${screen.id}-updated-at`, className: "whitespace-nowrap text-
|
|
63
|
+
return (_jsx("span", { "data-testid": `dashboard-${screen.id}-updated-at`, className: "whitespace-nowrap text-[13px] text-muted-foreground max-sm:hidden", children: model.formatLongDate(model.loadedAtMs) }));
|
|
64
64
|
}
|
|
65
65
|
function hasDataPanel(panels) {
|
|
66
66
|
return panels.some((panel) => panel.kind === "text"
|