@cosmicdrift/kumiko-renderer 0.410.0 → 0.412.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.
Files changed (89) hide show
  1. package/dist/app/projection-detail-body.js +1 -0
  2. package/dist/app/projection-detail-header.js +4 -1
  3. package/dist/app/use-projection-detail-actions.d.ts +1 -0
  4. package/dist/app/use-projection-detail-actions.js +7 -2
  5. package/dist/components/render-edit-fields-section.js +2 -1
  6. package/dist/components/render-edit-form-actions.d.ts +1 -0
  7. package/dist/components/render-edit-form-actions.js +10 -5
  8. package/dist/components/render-edit-layout.js +7 -11
  9. package/dist/components/render-edit-logic.d.ts +3 -0
  10. package/dist/components/render-edit-logic.js +10 -0
  11. package/dist/components/render-edit-submit-result.d.ts +1 -1
  12. package/dist/components/render-edit-submit-result.js +2 -2
  13. package/dist/components/render-edit-submit.js +6 -3
  14. package/dist/components/render-edit-titles.d.ts +1 -2
  15. package/dist/components/render-edit-titles.js +1 -2
  16. package/dist/components/render-edit-wizard-navigation.d.ts +1 -1
  17. package/dist/components/render-edit-wizard-navigation.js +8 -4
  18. package/dist/components/render-edit-wizard-rail.d.ts +12 -0
  19. package/dist/components/render-edit-wizard-rail.js +74 -0
  20. package/dist/components/render-field.js +4 -4
  21. package/dist/components/use-render-edit-state.d.ts +1 -0
  22. package/dist/components/use-render-edit-state.js +3 -1
  23. package/dist/data-table-view-types.d.ts +2 -0
  24. package/dist/headless/view-model/edit.js +17 -6
  25. package/dist/headless/view-model/types.d.ts +12 -0
  26. package/dist/hooks/use-list-table.d.ts +1 -0
  27. package/dist/hooks/use-list-table.js +2 -1
  28. package/dist/i18n-defaults.js +18 -0
  29. package/dist/primitives.d.ts +23 -6
  30. package/dist/required-marker-context.d.ts +2 -0
  31. package/dist/required-marker-context.js +3 -0
  32. package/dist/web/index.d.ts +5 -3
  33. package/dist/web/index.js +2 -1
  34. package/dist/web/layout/avatar.d.ts +5 -2
  35. package/dist/web/layout/avatar.js +3 -2
  36. package/dist/web/presence/index.d.ts +8 -0
  37. package/dist/web/presence/index.js +4 -0
  38. package/dist/web/presence/presence-avatars.d.ts +9 -0
  39. package/dist/web/presence/presence-avatars.js +16 -0
  40. package/dist/web/presence/presence-notice.d.ts +13 -0
  41. package/dist/web/presence/presence-notice.js +32 -0
  42. package/dist/web/presence/presence-signal.d.ts +3 -0
  43. package/dist/web/presence/presence-signal.js +20 -0
  44. package/dist/web/presence/use-presence-list.d.ts +12 -0
  45. package/dist/web/presence/use-presence-list.js +34 -0
  46. package/dist/web/presence/use-presence.d.ts +16 -0
  47. package/dist/web/presence/use-presence.js +77 -0
  48. package/dist/web/primitives/banner.d.ts +1 -1
  49. package/dist/web/primitives/banner.js +51 -16
  50. package/dist/web/primitives/data-table/sortable-header.d.ts +3 -1
  51. package/dist/web/primitives/data-table/sortable-header.js +4 -3
  52. package/dist/web/primitives/data-table/table-header-row.js +1 -1
  53. package/dist/web/primitives/field.js +3 -1
  54. package/dist/web/primitives/form.d.ts +3 -1
  55. package/dist/web/primitives/form.js +4 -2
  56. package/dist/web/primitives/layout-elements.d.ts +1 -1
  57. package/dist/web/primitives/layout-elements.js +5 -2
  58. package/dist/web/primitives/layout.d.ts +1 -0
  59. package/dist/web/primitives/layout.js +4 -0
  60. package/dist/web/primitives/metric.js +4 -2
  61. package/dist/web/widgets/choice-cards.d.ts +7 -1
  62. package/dist/web/widgets/choice-cards.js +16 -3
  63. package/dist/web/widgets/composer.d.ts +16 -0
  64. package/dist/web/widgets/composer.js +9 -0
  65. package/dist/web/widgets/detail-list.d.ts +6 -2
  66. package/dist/web/widgets/detail-list.js +7 -3
  67. package/dist/web/widgets/floating-panel.d.ts +16 -1
  68. package/dist/web/widgets/floating-panel.js +23 -7
  69. package/dist/web/widgets/form-fields.d.ts +2 -1
  70. package/dist/web/widgets/form-fields.js +2 -2
  71. package/dist/web/widgets/index.d.ts +4 -2
  72. package/dist/web/widgets/index.js +2 -0
  73. package/dist/web/widgets/mode-switch.d.ts +7 -1
  74. package/dist/web/widgets/mode-switch.js +12 -5
  75. package/dist/web/widgets/result-panel.d.ts +3 -1
  76. package/dist/web/widgets/result-panel.js +3 -2
  77. package/dist/web/widgets/section-nav-layout.d.ts +14 -0
  78. package/dist/web/widgets/section-nav-layout.js +9 -0
  79. package/dist/web/widgets/side-by-side-table.d.ts +3 -1
  80. package/dist/web/widgets/side-by-side-table.js +2 -2
  81. package/dist/web/widgets/step-bar.js +1 -1
  82. package/dist/web/widgets/step-list-row.d.ts +15 -4
  83. package/dist/web/widgets/step-list-row.js +47 -5
  84. package/dist/web/widgets/step-list-selection.d.ts +42 -0
  85. package/dist/web/widgets/step-list-selection.js +134 -0
  86. package/dist/web/widgets/step-list.d.ts +21 -2
  87. package/dist/web/widgets/step-list.js +99 -14
  88. package/package.json +5 -5
  89. package/src/changes.json +84 -0
@@ -75,6 +75,7 @@ export function ProjectionDetailBody({ schema, screen, translate, entityId, }) {
75
75
  openDrawer,
76
76
  detailQuery,
77
77
  reloadDetail,
78
+ activeTabId: activeSection?.id,
78
79
  });
79
80
  const { hasMetrics, headerActionsList, hasHeaderActions, hasHeaderCard, renderedDetailScreen } = useProjectionDetailLayout({ screen, headerActions, hasTabs, detailScreen });
80
81
  const recordId = detailQuery.data?.["id"];
@@ -26,8 +26,11 @@ function renderSubtitleParts(model, subtitleParts) {
26
26
  function renderSubtitleField(model, subtitleField) {
27
27
  const { screen, record, primitives } = model;
28
28
  const { Text, Link } = primitives;
29
+ const subtitleText = String(record[subtitleField] ?? "");
30
+ if (subtitleText === "")
31
+ return undefined;
29
32
  const subtitleHref = resolveSubtitleHref(screen.header, record);
30
- return subtitleHref !== undefined ? (_jsx(Link, { href: subtitleHref, target: "_blank", testId: "kumiko-screen-projection-detail-subtitle", children: String(record[subtitleField] ?? "") })) : (_jsx(Text, { variant: "muted", testId: "kumiko-screen-projection-detail-subtitle", children: String(record[subtitleField] ?? "") }));
33
+ return subtitleHref !== undefined ? (_jsx(Link, { href: subtitleHref, target: "_blank", testId: "kumiko-screen-projection-detail-subtitle", children: subtitleText })) : (_jsx(Text, { variant: "muted", testId: "kumiko-screen-projection-detail-subtitle", children: subtitleText }));
31
34
  }
32
35
  export function renderHeaderSubtitleSlot(model) {
33
36
  const { screen, record, nav, appFeatures, userRoles, host } = model;
@@ -27,6 +27,7 @@ type DetailActionsInput = {
27
27
  readonly openDrawer: ReturnType<typeof useDrawerAction>["openDrawer"];
28
28
  readonly detailQuery: ReturnType<typeof useProjectionDetailData>["detailQuery"];
29
29
  readonly reloadDetail: ReturnType<typeof useProjectionDetailData>["reloadDetail"];
30
+ readonly activeTabId: string | undefined;
30
31
  };
31
32
  export declare function useProjectionDetailActions(input: DetailActionsInput): {
32
33
  buildSectionActions: (actions: readonly RowAction[]) => readonly RenderEditAction[] | undefined;
@@ -5,8 +5,12 @@ import { navigateToReturnOr, navigateWithReturnTo, } from "./return-to.js";
5
5
  import { buildRecordActions } from "./row-actions.js";
6
6
  import { findEditScreenFor } from "./screen-access.js";
7
7
  import { findEntityListScreen, navigateAfterRedirect } from "./screen-shared.js";
8
+ function isShownOnTab(action, activeTabId) {
9
+ return (action.showOnTabs === undefined ||
10
+ (activeTabId !== undefined && action.showOnTabs.includes(activeTabId)));
11
+ }
8
12
  export function useProjectionDetailActions(input) {
9
- const { schema, screen, effectiveTranslate, effectiveEntityId, nav, host, dispatcher, clientActions, appFeatures, userRoles, returnTarget, openDrawer, detailQuery, reloadDetail, } = input;
13
+ const { schema, screen, effectiveTranslate, effectiveEntityId, nav, host, dispatcher, clientActions, appFeatures, userRoles, returnTarget, openDrawer, detailQuery, reloadDetail, activeTabId, } = input;
10
14
  const handleRecordLeft = useCallback((action, resultData, deletedShownRecord) => {
11
15
  const record = detailQuery.data ?? {};
12
16
  // Never return onto the just-deleted record.
@@ -122,7 +126,7 @@ export function useProjectionDetailActions(input) {
122
126
  const headerActions = useMemo(() => {
123
127
  const declaredHasEdit = screen.actions?.some((a) => a.id === "edit") === true;
124
128
  const resolved = buildRecordActions({
125
- actions: screen.actions ?? [],
129
+ actions: (screen.actions ?? []).filter((a) => isShownOnTab(a, activeTabId)),
126
130
  record: detailQuery.data ?? {},
127
131
  translate: effectiveTranslate,
128
132
  nav,
@@ -140,6 +144,7 @@ export function useProjectionDetailActions(input) {
140
144
  return [defaultEditAction, ...(resolved ?? [])];
141
145
  }, [
142
146
  screen.actions,
147
+ activeTabId,
143
148
  defaultEditAction,
144
149
  effectiveTranslate,
145
150
  nav,
@@ -51,7 +51,8 @@ function renderDefaultFieldsSection(rc, section, sectionKey) {
51
51
  const anchorId = sectionNavAnchorId(model.titles.sectionNavItems, sectionIndex);
52
52
  const sectionTitle = resolveSectionTitle(rc, section);
53
53
  const sectionSubtitle = resolveSectionSubtitle(rc, section);
54
- const sectionEl = (_jsxs(Section, { ...(anchorId !== undefined && { id: anchorId }), ...(sectionTitle !== undefined && { title: sectionTitle }), ...(sectionSubtitle !== undefined && { subtitle: sectionSubtitle }), ...(section.icon !== undefined && { icon: section.icon }), ...(sectionActionsEl !== undefined && { actions: sectionActionsEl }), ...(model.footer.isSettingsList && { layout: "settings-list" }), testId: `section-${sectionKey}`, children: [model.engine.sections.showsAllRequiredHint &&
54
+ const sectionEl = (_jsxs(Section, { ...(anchorId !== undefined && { id: anchorId }), ...(sectionTitle !== undefined && { title: sectionTitle }), ...(sectionSubtitle !== undefined && { subtitle: sectionSubtitle }), ...(model.titles.stepRail &&
55
+ section.description !== undefined && { subtitleBelowLgOnly: true }), ...(section.icon !== undefined && { icon: section.icon }), ...(sectionActionsEl !== undefined && { actions: sectionActionsEl }), ...(model.footer.isSettingsList && { layout: "settings-list" }), testId: `section-${sectionKey}`, children: [model.engine.sections.showsAllRequiredHint &&
55
56
  model.engine.state.insideDrawer &&
56
57
  sectionIndex === 0 &&
57
58
  renderAllRequiredHint(model), renderFieldGrid(model, section, section.fields, section.columns, `${sectionKey}-grid`)] }, sectionKey));
@@ -1,4 +1,5 @@
1
1
  import type { ReactNode } from "react";
2
2
  import type { FormValues } from "../headless/index.ts";
3
3
  import type { RenderEditModel } from "./render-edit-render-model.ts";
4
+ export declare function resolveSubmitLabelKey<TValues extends FormValues, TCtx>({ engine: { props, state }, footer, }: RenderEditModel<TValues, TCtx>): string;
4
5
  export declare function renderFormActions<TValues extends FormValues, TCtx>(model: RenderEditModel<TValues, TCtx>): ReactNode;
@@ -1,7 +1,7 @@
1
1
  import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { FOOTER_ACTION_ROLE_PROP, NARROW_LABEL_PROP, STICKY_PRIMARY_ACTION_PROP, } from "../primitives.js";
3
3
  import { EditSlotMount } from "./edit-mounts.js";
4
- import { resolveExtensionEntityId } from "./render-edit-logic.js";
4
+ import { isSubmitBlockedByLayoutCondition, resolveExtensionEntityId } from "./render-edit-logic.js";
5
5
  function renderWizardBackButton({ engine: { state, nav }, footer, }) {
6
6
  const { Button } = state.primitives;
7
7
  return (footer.showWizardBack && (_jsx(Button, { type: "button", variant: "secondary", icon: "chevron-left", onClick: nav.handleWizardBack, testId: "render-edit-wizard-back", [FOOTER_ACTION_ROLE_PROP]: "back", children: state.translate("kumiko.actions.back") })));
@@ -12,10 +12,11 @@ function renderFooterSlot({ engine: { props, state, form, draft, sections, steps
12
12
  }
13
13
  function renderSaveAndCloseButton({ engine: { props, state, steps, handleSubmit }, footer, }) {
14
14
  const { Button } = state.primitives;
15
+ const saveAndCloseOnCreate = props.screen.layout.wizard?.saveAndCloseOnCreate === true;
15
16
  return (state.isWizard &&
16
- !steps.isLastWizardStep &&
17
+ (!steps.isLastWizardStep || saveAndCloseOnCreate) &&
17
18
  footer.showsSubmit &&
18
- !state.isCreateMode && (_jsx(Button, { type: "button", variant: "ghost", disabled: state.isSubmitting || props.disabled, onClick: () => void handleSubmit({ saveNow: true }), testId: "render-edit-wizard-save-close", [STICKY_PRIMARY_ACTION_PROP]: true, children: state.translate("kumiko.wizard.save-and-close") })));
19
+ (!state.isCreateMode || saveAndCloseOnCreate) && (_jsx(Button, { type: "button", variant: "ghost", disabled: state.isSubmitting || props.disabled, onClick: () => void handleSubmit({ saveNow: true }), testId: "render-edit-wizard-save-close", [STICKY_PRIMARY_ACTION_PROP]: true, children: state.translate("kumiko.wizard.save-and-close") })));
19
20
  }
20
21
  function renderWizardNextButton({ engine: { state }, footer, }) {
21
22
  const { Button } = state.primitives;
@@ -47,9 +48,13 @@ function isSubmitDisabled({ engine: { props, state, form }, footer, }) {
47
48
  !footer.isFieldlessSubmitForm &&
48
49
  !state.insideDrawer &&
49
50
  props.submitWithoutChanges !== true;
50
- return isPristine || state.isSubmitting || props.disabled || props.submitBlocked;
51
+ return (isPristine ||
52
+ state.isSubmitting ||
53
+ props.disabled ||
54
+ props.submitBlocked ||
55
+ isSubmitBlockedByLayoutCondition(props.screen.layout, form.snapshot.values));
51
56
  }
52
- function resolveSubmitLabelKey({ engine: { props, state }, footer, }) {
57
+ export function resolveSubmitLabelKey({ engine: { props, state }, footer, }) {
53
58
  if (props.submitLabel !== undefined)
54
59
  return props.submitLabel;
55
60
  if (state.isWizard)
@@ -4,6 +4,7 @@ import { renderActionErrorBanner, renderAllRequiredHint, renderDeleteDialog, ren
4
4
  import { renderFormActions } from "./render-edit-form-actions.js";
5
5
  import { buildHeaderActions } from "./render-edit-header-actions.js";
6
6
  import { renderEditSections } from "./render-edit-section-kinds.js";
7
+ import { deriveWizardRail } from "./render-edit-wizard-rail.js";
7
8
  import { AllFieldsRequiredProvider } from "./render-field.js";
8
9
  function renderPageHeader({ engine: { state }, layout, titles }, { headerMenuItems }) {
9
10
  const { PageHeader, ActionOverflowMenu } = state.primitives;
@@ -15,23 +16,18 @@ function renderPageHeader({ engine: { state }, layout, titles }, { headerMenuIte
15
16
  actions: (_jsx(ActionOverflowMenu, { label: state.translate("kumiko.list.row-actions.more"), items: headerMenuItems, testId: "render-edit-header-menu" })),
16
17
  }) })));
17
18
  }
18
- function renderWizardSideRail({ engine: { state, steps, sections, nav }, titles, }) {
19
+ function renderWizardSideRail(model) {
20
+ const { engine, titles } = model;
21
+ const { state, steps, sections, nav } = engine;
19
22
  const { StepBar } = state.primitives;
20
23
  const { translate } = state;
21
- const { upNextSection, formSubtitle } = titles;
22
24
  if (StepBar === undefined)
23
25
  return undefined;
26
+ const { description, subtitles, upNext } = deriveWizardRail(model);
24
27
  return (_jsx(StepBar, { steps: sections.filteredSections.map((section) => section.title ?? ""), currentIndex: steps.currentStep, compactLabel: titles.compactStepLabel, onStepSelect: nav.handleWizardStepSelect, ...steps.updateModeStepBarProps, orientation: "vertical", heading: translate("kumiko.wizard.step", {
25
28
  current: steps.currentStep + 1,
26
29
  total: steps.lastStepIndex + 1,
27
- }), ...(formSubtitle !== undefined && { description: formSubtitle }), subtitles: sections.filteredSections.map((section) => section.kind === "fields" ? section.subtitle : undefined), ...(upNextSection !== undefined && {
28
- upNext: {
29
- heading: translate("kumiko.wizard.up-next"),
30
- title: upNextSection.title ?? "",
31
- ...(upNextSection.kind === "fields" &&
32
- upNextSection.subtitle !== undefined && { subtitle: upNextSection.subtitle }),
33
- },
34
- }), testId: "render-edit-wizard-steps", compactTestId: "render-edit-wizard-step-label" }));
30
+ }), ...(description !== undefined && { description }), subtitles: subtitles, ...(upNext !== undefined && { upNext }), testId: "render-edit-wizard-steps", compactTestId: "render-edit-wizard-step-label" }));
35
31
  }
36
32
  function buildFormHeadingProps(model) {
37
33
  const { props } = model.engine;
@@ -75,5 +71,5 @@ export function renderEditLayout(model) {
75
71
  const { props, state, sections, handleSubmit } = model.engine;
76
72
  const header = buildHeaderActions(model);
77
73
  const { Form } = state.primitives;
78
- return (_jsxs(ExtensionFormRegistryProvider, { value: state.extensionFormRegistry, children: [state.menuActionConfirmDialog, renderPageHeader(model, header), _jsx(Form, { onSubmit: () => void handleSubmit(), ...(state.focusFirstErrorKey > 0 && { focusFirstErrorKey: state.focusFirstErrorKey }), ...buildFormHeadingProps(model), ...buildFormActionProps(model, header), testId: "render-edit-form", stickyActions: state.isWizard || props.fillScreenHeight === true, ...buildFormChromeProps(model, header), children: _jsxs(AllFieldsRequiredProvider, { value: sections.showsAllRequiredHint, children: [props.leadContent, sections.showsAllRequiredHint && !state.insideDrawer && renderAllRequiredHint(model), renderDraftPicker(model), renderWizardProgress(model), state.isTabs && state.isStepped && renderTabStrip(model), renderEditSections(model), renderFormErrorBanner(model), renderRootIssueBanners(model), renderExtensionErrorBanner(model), renderActionErrorBanner(model), renderDeleteDialog(model)] }) })] }));
74
+ return (_jsxs(ExtensionFormRegistryProvider, { value: state.extensionFormRegistry, children: [state.menuActionConfirmDialog, renderPageHeader(model, header), _jsx(Form, { onSubmit: () => void handleSubmit(), ...(state.focusFirstErrorKey > 0 && { focusFirstErrorKey: state.focusFirstErrorKey }), ...buildFormHeadingProps(model), ...buildFormActionProps(model, header), testId: "render-edit-form", stickyActions: state.isWizard || props.fillScreenHeight === true, ...buildFormChromeProps(model, header), children: _jsxs(AllFieldsRequiredProvider, { value: sections.showsAllRequiredHint || props.screen.layout.hideRequiredMarker === true, children: [props.leadContent, sections.showsAllRequiredHint && !state.insideDrawer && renderAllRequiredHint(model), renderDraftPicker(model), renderWizardProgress(model), state.isTabs && state.isStepped && renderTabStrip(model), renderEditSections(model), renderFormErrorBanner(model), renderRootIssueBanners(model), renderExtensionErrorBanner(model), renderActionErrorBanner(model), renderDeleteDialog(model)] }) })] }));
79
75
  }
@@ -1,6 +1,9 @@
1
+ import { type EntityEditScreenDefinition } from "@cosmicdrift/kumiko-framework/ui-types";
1
2
  import type { DispatcherError, EditFieldViewModel, EditSectionViewModel, FieldIssue, SubmitResult } from "../headless/index.ts";
2
3
  export declare function hasEditableSection(sections: readonly EditSectionViewModel[]): boolean;
3
4
  export declare function resolveExtensionEntityId(entityIdProp: string | null | undefined, vmId: string | null): string | null;
5
+ export declare function isSubmitBlockedByLayoutCondition(layout: EntityEditScreenDefinition["layout"], values: Readonly<Record<string, unknown>>): boolean;
6
+ export declare function createdEntityIdOf(resultData: unknown): string | undefined;
4
7
  export declare function shouldNotifyCaller(result: SubmitResult<unknown>, extensionsPersisted: boolean): boolean;
5
8
  export declare function issueRootField(path: string): string;
6
9
  export declare function hasIssueWithoutRenderedField(issuePaths: readonly string[], sections: readonly EditSectionViewModel[], derivedTargets?: ReadonlySet<string>): boolean;
@@ -1,3 +1,5 @@
1
+ import { evalFieldCondition, } from "@cosmicdrift/kumiko-framework/ui-types";
2
+ import { propertyOf } from "@cosmicdrift/kumiko-types/type-guards";
1
3
  // Hides the Save button when no field is editable and no extension section
2
4
  // contributes to the composed form submit. Extensions that persist via their
3
5
  // own dispatcher writes must not opt in.
@@ -18,6 +20,14 @@ export function hasEditableSection(sections) {
18
20
  export function resolveExtensionEntityId(entityIdProp, vmId) {
19
21
  return entityIdProp !== undefined ? entityIdProp : vmId;
20
22
  }
23
+ export function isSubmitBlockedByLayoutCondition(layout, values) {
24
+ const condition = layout.wizard?.submitDisabledWhen;
25
+ return condition !== undefined && evalFieldCondition(condition, values);
26
+ }
27
+ export function createdEntityIdOf(resultData) {
28
+ const id = propertyOf(resultData, "id");
29
+ return typeof id === "string" && id !== "" ? id : undefined;
30
+ }
21
31
  // After a submit, decide whether to invoke the caller's onSubmit. The success
22
32
  // callback typically navigates away, which unmounts the extension-error banner.
23
33
  // Suppress the callback ONLY when the entity write succeeded but an extension-
@@ -1,7 +1,7 @@
1
1
  import type { FormValues, SubmitResult } from "../headless/index.ts";
2
2
  import type { RenderEditEngineBase } from "./render-edit-render-model.ts";
3
3
  export declare function createSubmitResultHandlers<TValues extends FormValues, TCtx>({ props, state, form, draft, sections, draftActions, nav, }: RenderEditEngineBase<TValues, TCtx>): {
4
- handleSubmitSuccess: (isNoOp: boolean) => Promise<boolean>;
4
+ handleSubmitSuccess: (isNoOp: boolean, createdEntityId: string | undefined) => Promise<boolean>;
5
5
  applySubmitFailure: (result: Exclude<SubmitResult<unknown>, {
6
6
  isSuccess: true;
7
7
  }>) => void;
@@ -12,14 +12,14 @@ export function createSubmitResultHandlers({ props, state, form, draft, sections
12
12
  // would abort an in-flight discard and leave the draft behind after
13
13
  // a successful submit.
14
14
  // Resolves to whether the extension sections persisted (true when none ran).
15
- async function handleSubmitSuccess(isNoOp) {
15
+ async function handleSubmitSuccess(isNoOp, createdEntityId) {
16
16
  state.setFormError(null);
17
17
  state.setExtraDeleteIssues([]);
18
18
  if (!isNoOp) {
19
19
  submittedRef.current = true;
20
20
  await draftActions.discardDraft();
21
21
  }
22
- const extensionsPersisted = await nav.persistExtensions();
22
+ const extensionsPersisted = await nav.persistExtensions(createdEntityId);
23
23
  if (extensionsPersisted)
24
24
  state.extensionDirtyRef.current = false;
25
25
  return extensionsPersisted;
@@ -1,4 +1,4 @@
1
- import { shouldNotifyCaller } from "./render-edit-logic.js";
1
+ import { createdEntityIdOf, isSubmitBlockedByLayoutCondition, shouldNotifyCaller, } from "./render-edit-logic.js";
2
2
  import { createSubmitResultHandlers } from "./render-edit-submit-result.js";
3
3
  // Rebuilt every render on purpose: the closures read this render's snapshot
4
4
  // and extension state, while handleSubmitRef publishes the current one.
@@ -74,7 +74,10 @@ export function createHandleSubmit(engine) {
74
74
  // Sync guard for the in-flight part — React state `isSubmitting` is too late
75
75
  // for double-clicks in the same tick (customSubmit has no submitInFlight of its own).
76
76
  function isSubmitBlocked() {
77
- return props.disabled === true || props.submitBlocked === true || isSubmittingRef.current;
77
+ return (props.disabled === true ||
78
+ props.submitBlocked === true ||
79
+ isSubmitBlockedByLayoutCondition(props.screen.layout, controller.getSnapshot().values) ||
80
+ isSubmittingRef.current);
78
81
  }
79
82
  // Awaits only where the original did: a validation-blocked customSubmit
80
83
  // must settle in the same tick so setIsSubmitting(true/false) batch.
@@ -112,7 +115,7 @@ export function createHandleSubmit(engine) {
112
115
  }
113
116
  let extensionsPersisted = true;
114
117
  if (result.isSuccess)
115
- extensionsPersisted = await handleSubmitSuccess(result.isNoOp === true);
118
+ extensionsPersisted = await handleSubmitSuccess(result.isNoOp === true, createdEntityIdOf(result.data));
116
119
  else
117
120
  applySubmitFailure(result);
118
121
  // On entity-success-but-extension-failure the extension-error
@@ -1,4 +1,4 @@
1
- import type { EditSectionViewModel, FormValues } from "../headless/index.ts";
1
+ import type { FormValues } from "../headless/index.ts";
2
2
  import type { FormSectionNavItem } from "../primitives.tsx";
3
3
  import type { FooterFlags, LayoutFlags } from "./render-edit-layout-flags.ts";
4
4
  import type { RenderEditEngine } from "./render-edit-render-model.ts";
@@ -10,7 +10,6 @@ export type TitleModel = {
10
10
  readonly usesFieldFlow: boolean;
11
11
  readonly titleInHeaderRegion: boolean;
12
12
  readonly stepRail: boolean;
13
- readonly upNextSection: EditSectionViewModel | undefined;
14
13
  readonly sectionNavItems: readonly FormSectionNavItem[];
15
14
  readonly compactStepLabel: string;
16
15
  };
@@ -68,7 +68,7 @@ function deriveFormTitleTexts({ props, state, form }, isCreate) {
68
68
  }
69
69
  export function deriveTitles(engine, layout, footer) {
70
70
  const { props, state, sections, steps } = engine;
71
- const { screen, headerRegion } = props;
71
+ const { headerRegion } = props;
72
72
  const { translate } = state;
73
73
  const { filteredSections } = sections;
74
74
  const { currentStep, lastStepIndex } = steps;
@@ -87,7 +87,6 @@ export function deriveTitles(engine, layout, footer) {
87
87
  // or, without one, the screen title, so a form title above the sections repeats it.
88
88
  titleInHeaderRegion: headerRegion !== undefined && PageHeader !== undefined && state.pageHeaderSlotAvailable,
89
89
  stepRail: state.isWizard && layout.isScreenForm && StepBar !== undefined,
90
- upNextSection: screen.layout.wizard?.aside?.upNext === true ? filteredSections[currentStep + 1] : undefined,
91
90
  sectionNavItems: layout.isScreenForm && !state.isStepped
92
91
  ? deriveSectionNavItems(filteredSections, formTitle)
93
92
  : [],
@@ -1,7 +1,7 @@
1
1
  import type { FormValues } from "../headless/index.ts";
2
2
  import type { RenderEditSteppedCore } from "./render-edit-render-model.ts";
3
3
  export type WizardNavigation = {
4
- readonly persistExtensions: () => Promise<boolean>;
4
+ readonly persistExtensions: (createdEntityId?: string) => Promise<boolean>;
5
5
  readonly jumpToStep: (index: number) => void;
6
6
  readonly handleWizardNext: () => void;
7
7
  readonly handleWizardBack: () => void;
@@ -9,10 +9,14 @@ export function createWizardNavigation({ props, state, form, draft, sections, st
9
9
  const { currentStep, lastStepIndex } = steps;
10
10
  const { hasNavigatedRef } = draft.refs;
11
11
  // Persist all composed extension sections using the resolved entityId.
12
- // false means a section failed and its i18n key is shown in the banner. Without
13
- // entity context (create mode without a route id), there is nothing to write.
14
- async function persistExtensions() {
15
- const entityId = resolveExtensionEntityId(props.entityId, sections.vm.id);
12
+ // false means a section failed and its i18n key is shown in the banner. A wizard
13
+ // creating its record has no route id: the id of the just-created record stands in.
14
+ // Without any id there is nothing to write.
15
+ async function persistExtensions(createdEntityId) {
16
+ const resolvedId = resolveExtensionEntityId(props.entityId, sections.vm.id);
17
+ const entityId = state.isWizard && (resolvedId === null || resolvedId === "")
18
+ ? (createdEntityId ?? resolvedId)
19
+ : resolvedId;
16
20
  if (entityId === null)
17
21
  return true;
18
22
  const results = await state.runExtensionSubmits({ entityId });
@@ -0,0 +1,12 @@
1
+ import { type FormValues } from "../headless/index.ts";
2
+ import type { RenderEditModel } from "./render-edit-render-model.ts";
3
+ export type WizardRail = {
4
+ readonly description: string | undefined;
5
+ readonly subtitles: readonly (string | undefined)[];
6
+ readonly upNext: {
7
+ heading: string;
8
+ title: string;
9
+ subtitle?: string;
10
+ } | undefined;
11
+ };
12
+ export declare function deriveWizardRail<TValues extends FormValues, TCtx>(model: RenderEditModel<TValues, TCtx>): WizardRail;
@@ -0,0 +1,74 @@
1
+ import { EMPTY_VALUE_PLACEHOLDER, } from "../headless/index.js";
2
+ import { resolveSubmitLabelKey } from "./render-edit-form-actions.js";
3
+ import { readOnlyDisplayText } from "./render-field-read-only.js";
4
+ function railTextSection(section) {
5
+ return section?.kind === "fields" || section?.kind === "extension" ? section : undefined;
6
+ }
7
+ function isPrintable(value) {
8
+ return typeof value === "string" || typeof value === "number" || typeof value === "boolean";
9
+ }
10
+ export function deriveWizardRail(model) {
11
+ const { engine, titles } = model;
12
+ const { state, steps, sections, props, form } = engine;
13
+ const { translate, appLocale } = state;
14
+ const { filteredSections } = sections;
15
+ const { currentStep } = steps;
16
+ const wizard = props.screen.layout.wizard;
17
+ const isDone = (index) => index !== currentStep &&
18
+ (steps.wizardDoneSteps !== undefined
19
+ ? steps.wizardDoneSteps[index] === true
20
+ : index < currentStep);
21
+ // An extension has no fields of its own, so its summaryField resolves against every
22
+ // fields section, then against the raw form value (an actionForm field no section lists).
23
+ function summaryValue(section) {
24
+ const name = section.summaryField;
25
+ if (name === undefined)
26
+ return undefined;
27
+ const field = filteredSections
28
+ .flatMap((candidate) => (candidate.kind === "fields" ? candidate.fields : []))
29
+ .find((candidate) => candidate.field === name);
30
+ if (field !== undefined) {
31
+ const text = readOnlyDisplayText(field, appLocale, translate);
32
+ return text === EMPTY_VALUE_PLACEHOLDER ? undefined : text;
33
+ }
34
+ const raw = form.snapshot.values[name];
35
+ return isPrintable(raw) && raw !== "" ? String(raw) : undefined;
36
+ }
37
+ const subtitles = filteredSections.map((section, index) => {
38
+ const texts = railTextSection(section);
39
+ if (texts === undefined || index === currentStep)
40
+ return undefined;
41
+ if (isDone(index)) {
42
+ const summary = summaryValue(texts);
43
+ if (summary !== undefined)
44
+ return summary;
45
+ }
46
+ return texts.subtitle;
47
+ });
48
+ const nextSection = filteredSections[currentStep + 1];
49
+ const nextTexts = railTextSection(nextSection);
50
+ const heading = translate("kumiko.wizard.up-next");
51
+ let upNext;
52
+ if (wizard?.aside?.upNext !== true)
53
+ upNext = undefined;
54
+ else if (nextSection !== undefined) {
55
+ const subtitle = nextTexts?.upNextHint ?? nextTexts?.subtitle;
56
+ upNext = {
57
+ heading,
58
+ title: nextSection.title ?? "",
59
+ ...(subtitle !== undefined && { subtitle }),
60
+ };
61
+ }
62
+ else if (wizard.aside.finishDescription !== undefined) {
63
+ upNext = {
64
+ heading,
65
+ title: translate(resolveSubmitLabelKey(model)),
66
+ subtitle: translate(wizard.aside.finishDescription),
67
+ };
68
+ }
69
+ return {
70
+ description: railTextSection(filteredSections[currentStep])?.description ?? titles.formSubtitle,
71
+ subtitles,
72
+ upNext,
73
+ };
74
+ }
@@ -1,11 +1,11 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import { createContext, useContext } from "react";
2
+ import { useContext } from "react";
3
3
  import { useLocale, useTranslation } from "../i18n.js";
4
4
  import { usePrimitives } from "../primitives.js";
5
+ import { HideRequiredMarkerContext } from "../required-marker-context.js";
5
6
  import { listPrintsOwnIssues, renderControl } from "./render-field-control.js";
6
7
  import { inputId } from "./render-field-meta.js";
7
- const AllFieldsRequiredContext = createContext(false);
8
- export const AllFieldsRequiredProvider = AllFieldsRequiredContext.Provider;
8
+ export const AllFieldsRequiredProvider = HideRequiredMarkerContext.Provider;
9
9
  function fieldOptionalProps({ issues, printsIssues, labelAppendix, fieldAppendix, appendixPlacement, description, status, changed, layout, accent, hideLabel, }) {
10
10
  return {
11
11
  ...(issues !== undefined && printsIssues && { issues }),
@@ -28,7 +28,7 @@ export function RenderField({ field, issues, onChange, onSuggest, featureName, l
28
28
  // consumers and tests must wrap it (createKumikoApp does this).
29
29
  const appLocale = useLocale().locale();
30
30
  const t = useTranslation();
31
- const allFieldsRequired = useContext(AllFieldsRequiredContext);
31
+ const allFieldsRequired = useContext(HideRequiredMarkerContext);
32
32
  if (!field.visible)
33
33
  return null;
34
34
  const id = inputId(field);
@@ -39,6 +39,7 @@ export declare function useRenderEditState({ screen, entityId, translate: transl
39
39
  extensionFormRegistry: import("../app/extension-form-submit.tsx").ExtensionFormRegistry;
40
40
  runExtensionSubmits: (ctx: import("../app/extension-form-submit.tsx").ExtensionSubmitContext) => Promise<readonly import("../app/extension-form-submit.tsx").ExtensionSubmitResult[]>;
41
41
  translate: Translate;
42
+ appLocale: string;
42
43
  dispatcher: import("../headless/index.ts").Dispatcher | undefined;
43
44
  isWizard: boolean;
44
45
  isTabs: boolean;
@@ -2,7 +2,7 @@ import { useCallback, useRef, useState } from "react";
2
2
  import { useExtensionFormHost } from "../app/extension-form-submit.js";
3
3
  import { useOptionalDispatcher } from "../context/dispatcher-context.js";
4
4
  import { useDraftStorage } from "../context/draft-storage-context.js";
5
- import { useTranslation } from "../i18n.js";
5
+ import { useLocale, useTranslation } from "../i18n.js";
6
6
  import { useInsideDrawer } from "../inside-drawer.js";
7
7
  import { usePageHeaderCompact, usePageHeaderSlotAvailable } from "../page-header-slot.js";
8
8
  import { usePrimitives } from "../primitives.js";
@@ -103,6 +103,7 @@ export function useRenderEditState({ screen, entityId, translate: translateProp,
103
103
  // useTranslation throws without a LocaleProvider, which is acceptable because
104
104
  // RenderEdit only runs inside a mounted Kumiko app tree.
105
105
  const t = useTranslation();
106
+ const appLocale = useLocale().locale();
106
107
  const translate = translateProp ?? t;
107
108
  const dispatcher = useOptionalDispatcher();
108
109
  const isWizard = screen.layout.mode === "wizard";
@@ -137,6 +138,7 @@ export function useRenderEditState({ screen, entityId, translate: translateProp,
137
138
  (isTabs && primitives.Tabs !== undefined && primitives.WizardStepGroup !== undefined);
138
139
  return {
139
140
  translate,
141
+ appLocale,
140
142
  dispatcher,
141
143
  isWizard,
142
144
  isTabs,
@@ -64,6 +64,8 @@ export type DataTableTableBlock = {
64
64
  readonly resetAll?: DataTableResetAll;
65
65
  /** Present: the toolbar has an export button (web only). */
66
66
  readonly exportList?: DataTableExport;
67
+ /** Smaller (12px) semibold header row. */
68
+ readonly compactHeader?: boolean;
67
69
  /** Present: the rows are grouped on the server; replaces pager and infinite scroll. */
68
70
  readonly serverGroups?: DataTableServerGroups;
69
71
  /** Present: a footer row with the server-computed totals of the filtered list. */
@@ -49,6 +49,15 @@ function hasVisibleContent(fields, actions, values) {
49
49
  return true;
50
50
  return (actions ?? []).some((action) => action.visible === undefined || evalFieldCondition(action.visible, values));
51
51
  }
52
+ // Untitled section (flat form) → no h3; translate only what is set.
53
+ function translateSectionTexts(section, translate) {
54
+ return {
55
+ ...(section.title !== undefined && { title: translate(section.title) }),
56
+ ...(section.description !== undefined && { description: translate(section.description) }),
57
+ ...(section.subtitle !== undefined && { subtitle: translate(section.subtitle) }),
58
+ ...(section.upNextHint !== undefined && { upNextHint: translate(section.upNextHint) }),
59
+ };
60
+ }
52
61
  function wasEmptiedByWriteExclusion(declaredFieldSpecs, remainingFields) {
53
62
  return declaredFieldSpecs.length > 0 && remainingFields.length === 0;
54
63
  }
@@ -337,6 +346,12 @@ function buildExtensionSectionViewModel(sectionSpec, translate) {
337
346
  kind: "extension",
338
347
  ...(sectionSpec.id !== undefined && { id: sectionSpec.id }),
339
348
  title: translate(sectionSpec.title),
349
+ ...(sectionSpec.description !== undefined && {
350
+ description: translate(sectionSpec.description),
351
+ }),
352
+ ...(sectionSpec.subtitle !== undefined && { subtitle: translate(sectionSpec.subtitle) }),
353
+ ...(sectionSpec.upNextHint !== undefined && { upNextHint: translate(sectionSpec.upNextHint) }),
354
+ ...(sectionSpec.summaryField !== undefined && { summaryField: sectionSpec.summaryField }),
340
355
  component: sectionSpec.component,
341
356
  contributesToFormSubmit: sectionSpec.contributesToFormSubmit === true,
342
357
  // Blank override must fall back to the host value: the renderer's `??`
@@ -485,12 +500,8 @@ export function computeEditViewModel(input) {
485
500
  ...(sectionSpec.id !== undefined && { id: sectionSpec.id }),
486
501
  visible,
487
502
  emptiedByWriteExclusion: wasEmptiedByWriteExclusion(declaredFieldSpecs, fields),
488
- // Untitled section (flat form) → no h3; translate only when set.
489
- ...(sectionSpec.title !== undefined && { title: translate(sectionSpec.title) }),
490
- ...(sectionSpec.description !== undefined && {
491
- description: translate(sectionSpec.description),
492
- }),
493
- ...(sectionSpec.subtitle !== undefined && { subtitle: translate(sectionSpec.subtitle) }),
503
+ ...translateSectionTexts(sectionSpec, translate),
504
+ ...(sectionSpec.summaryField !== undefined && { summaryField: sectionSpec.summaryField }),
494
505
  columns: sectionSpec.columns ?? defaultColumns,
495
506
  fields,
496
507
  ...(groups !== undefined && { groups }),
@@ -316,6 +316,10 @@ export type EditFieldsSectionViewModel = {
316
316
  readonly description?: string;
317
317
  /** Translated `EditFieldsSection.subtitle` (wizard step rail / up-next box). */
318
318
  readonly subtitle?: string;
319
+ /** Translated `EditFieldsSection.upNextHint`. */
320
+ readonly upNextHint?: string;
321
+ /** From `EditFieldsSection.summaryField` (wizard step rail). */
322
+ readonly summaryField?: string;
319
323
  readonly columns: number;
320
324
  readonly fields: readonly EditFieldViewModel[];
321
325
  /** From `EditFieldsSection.groups` — each entry's `fields` are the same
@@ -338,6 +342,14 @@ export type EditExtensionSectionViewModel = {
338
342
  * section, see EditFieldsSectionViewModel.id. */
339
343
  readonly id?: string;
340
344
  readonly title: string;
345
+ /** Translated `EditExtensionSection.description`. */
346
+ readonly description?: string;
347
+ /** Translated `EditExtensionSection.subtitle`. */
348
+ readonly subtitle?: string;
349
+ /** Translated `EditExtensionSection.upNextHint`. */
350
+ readonly upNextHint?: string;
351
+ /** From `EditExtensionSection.summaryField`. */
352
+ readonly summaryField?: string;
341
353
  readonly component: PlatformComponent;
342
354
  readonly contributesToFormSubmit: boolean;
343
355
  /** Section-declared override — see `EditExtensionSection.entityName`. */
@@ -27,6 +27,7 @@ export type ListTableProps = {
27
27
  readonly view?: DataTableViewOptions;
28
28
  readonly resetAll?: DataTableResetAll;
29
29
  readonly exportList?: DataTableExport;
30
+ readonly compactHeader?: boolean;
30
31
  };
31
32
  export type ListTableState = {
32
33
  readonly props: ListTableProps;
@@ -85,7 +85,8 @@ export function useListTable({ storeKey, table, schemaColumns, url, local, expor
85
85
  ...(view !== undefined && { view }),
86
86
  ...(resetAll !== undefined && { resetAll }),
87
87
  ...(exportList !== undefined && { exportList }),
88
- }), [view, resetAll, exportList]);
88
+ ...(options.compactHeader === true && { compactHeader: true }),
89
+ }), [view, resetAll, exportList, options.compactHeader]);
89
90
  const groupField = options.grouping !== undefined && viewState.groupBy !== "" ? viewState.groupBy : undefined;
90
91
  return { props, groupField };
91
92
  }
@@ -268,6 +268,24 @@ export const kumikoDefaultTranslations = {
268
268
  "kumiko.widget.step-list.statusRunning": "Running",
269
269
  "kumiko.widget.step-list.statusRejected": "Rejected",
270
270
  "kumiko.widget.step-list.statusFailed": "Failed",
271
+ "kumiko.widget.step-list.selectAll": "Select all",
272
+ "kumiko.widget.step-list.selectionNone": "Nothing selected",
273
+ "kumiko.widget.step-list.selectionCount.one": "1 selected",
274
+ "kumiko.widget.step-list.selectionCount.other": "{count} selected",
275
+ "kumiko.widget.step-list.selectionMissingInput.one": "1 waiting for input",
276
+ "kumiko.widget.step-list.selectionMissingInput.other": "{count} waiting for input",
277
+ "kumiko.widget.step-list.selectStep": "Select “{title}”",
278
+ "kumiko.widget.step-list.missingInput": "Input missing",
279
+ "kumiko.widget.step-list.autoSelected": "Also selected: needed for {title}",
280
+ "kumiko.widget.step-list.prerequisiteNotSelectable": "Review “{title}” on its own first",
281
+ "kumiko.widget.step-list.actionWithCount": "{label} ({count})",
282
+ "kumiko.widget.presence.viewing": "is looking at this right now",
283
+ "kumiko.widget.presence.editing": "is editing this right now",
284
+ "kumiko.widget.presence.moreOthers.one": "and 1 other person",
285
+ "kumiko.widget.presence.moreOthers.other": "and {count} others",
286
+ "kumiko.widget.presence.sinceJustNow": "just now",
287
+ "kumiko.widget.presence.sinceMinutes": "for {count} min",
288
+ "kumiko.widget.presence.avatarsLabel": "Also here: {names}",
271
289
  "kumiko.widget.step-bar.done": "Done",
272
290
  "kumiko.widget.drawer.restore": "Restore drawer width",
273
291
  "kumiko.widget.drawer.maximize": "Maximize drawer width",