@cosmicdrift/kumiko-types 0.417.0 → 0.418.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/fields.d.ts CHANGED
@@ -227,8 +227,10 @@ export type MultiSelectFieldDef<TOptions extends readonly string[] = readonly st
227
227
  readonly access?: FieldAccess;
228
228
  /** Renderer metadata: `"checkboxes"` renders every option as a visible
229
229
  * checkbox with a select-all toggle. Default (omitted) stays the combobox
230
- * dropdown; `"chips"` renders toggle chips with a check mark on the chosen ones. */
231
- readonly display?: "checkboxes" | "chips" | "dropdown";
230
+ * dropdown; `"chips"` renders toggle chips with a check mark on the chosen ones;
231
+ * `"count"` shows only how many values are held, read-only, for an id list handed in by
232
+ * a `ListBulkFormAction` (no `options` needed). */
233
+ readonly display?: "checkboxes" | "chips" | "dropdown" | "count";
232
234
  /** Renderer metadata: column count for the `"checkboxes"` grid at the widest
233
235
  * breakpoint; narrow viewports always collapse to one column. Omitted =
234
236
  * the renderer picks a sensible count. Ignored unless
@@ -143,6 +143,8 @@ export type ActionFormScreenDefinition = {
143
143
  * While at least one entry is shown, the hints replace the generic
144
144
  * confirmation text. Mutually exclusive with `redirect`. */
145
145
  readonly successItems?: ActionFormSuccessItems;
146
+ /** Preview of what the submit will do, computed by a query from the current form values. */
147
+ readonly preview?: ActionFormPreview;
146
148
  /** Reset the form to its initial values after a successful submit (prefill
147
149
  * kept, typed values cleared). Only applies while the screen stays put,
148
150
  * i.e. without `redirect`. */
@@ -222,6 +224,40 @@ export type ActionFormLoad = {
222
224
  * schema must accept them. */
223
225
  readonly passPrefill?: boolean;
224
226
  };
227
+ /** How a preview value or success fact is formatted, by the same formatters a list cell uses.
228
+ * `number`: a number. `money`: a money object `{ amount, currency }` with `amount` in major units
229
+ * (12.5 is 12.50 EUR), not minor units. `date` and `timestamp`: an ISO date or timestamp string.
230
+ * `text` (default) shows the value as it is. */
231
+ export type ActionFormValueType = "text" | "number" | "money" | "date" | "timestamp";
232
+ /** Rows of the preview panel, read from an array in the preview query's result. */
233
+ export type ActionFormPreviewList = {
234
+ /** Flat field name of an array in the query result; an entry that is no object is skipped. */
235
+ readonly field: string;
236
+ readonly columns: readonly {
237
+ /** Field of one array entry. */
238
+ readonly field: string;
239
+ /** Column header (i18n key). */
240
+ readonly label: string;
241
+ /** Value format of the column; default `text`. */
242
+ readonly type?: ActionFormValueType;
243
+ }[];
244
+ };
245
+ /** Preview panel above the submit button: runs a query over the current form values and shows
246
+ * what the submit would do. Put the rule in one pure function that the query and the write handler
247
+ * both call, so the preview cannot drift from the result. */
248
+ export type ActionFormPreview = {
249
+ /** Query QN. The payload is the current form values (only `fields` when set). It does not run while
250
+ * a required field of the payload is empty; a failed query shows a hint and never blocks the submit. */
251
+ readonly query: string;
252
+ /** Form fields sent to the query; they also trigger a rerun when they change. Default: all fields. */
253
+ readonly fields?: readonly string[];
254
+ /** Panel title (i18n key). */
255
+ readonly title?: string;
256
+ /** Key figures from the query result, shown like the success box facts. */
257
+ readonly facts?: readonly ActionFormSuccessFact[];
258
+ /** Table of rows from the query result. */
259
+ readonly list?: ActionFormPreviewList;
260
+ };
225
261
  /** One key figure of the success box, read from the handler's success payload. */
226
262
  export type ActionFormSuccessFact = {
227
263
  /** Flat field name in the handler's success payload. A number or string is
@@ -230,6 +266,8 @@ export type ActionFormSuccessFact = {
230
266
  readonly field: string;
231
267
  /** Label (i18n key). */
232
268
  readonly label: string;
269
+ /** Format of the value (a money object, a date string, a number); default `text`. Used by the preview facts and the success box alike. */
270
+ readonly type?: ActionFormValueType;
233
271
  };
234
272
  /** Per-entry hints of the success box, read from an array in the handler's success payload. */
235
273
  export type ActionFormSuccessItems = {
@@ -1,8 +1,10 @@
1
+ import type { IconKey } from "./nav-icon.ts";
1
2
  export declare const LIST_BULK_ACTION_KEYS: readonly ["id", "rowAction", "confirm"];
3
+ export declare const LIST_BULK_FORM_ACTION_KEYS: readonly ["id", "label", "icon", "screen", "idsField"];
2
4
  /** Most rows one selection can hold; the loaded page caps it further. */
3
5
  export declare const MAX_BULK_SELECTION = 100;
4
- /** An action that runs a writeHandler row action once per checkbox-selected row. One `/api/write` per row, so access, validation and audit stay per row. */
5
- export type ListBulkAction = {
6
+ /** Runs a writeHandler row action once per checkbox-selected row. One `/api/write` per row, so access, validation and audit stay per row. */
7
+ export type ListBulkRowAction = {
6
8
  /** Stable id, kebab-case, unique among the screen's bulk actions. */
7
9
  readonly id: string;
8
10
  /** Id of a writeHandler entry in the same screen's `rowActions`; it supplies handler, payload, label, style and `visible`. Rows the action's `visible` hides are skipped. */
@@ -10,3 +12,17 @@ export type ListBulkAction = {
10
12
  /** i18n key of the one confirm dialog for the whole selection; gets `{count}` and `{action}`. Without it a `confirm` or `style: "danger"` on the row action still asks once with the default text. */
11
13
  readonly confirm?: string;
12
14
  };
15
+ /** Opens an `actionForm` screen for the whole selection. The ids of all selected rows land as one `string[]` in `idsField`, so the form's handler runs once for all of them. */
16
+ export type ListBulkFormAction = {
17
+ /** Stable id, kebab-case, unique among the screen's bulk actions. */
18
+ readonly id: string;
19
+ /** i18n key of the button label. */
20
+ readonly label: string;
21
+ readonly icon?: IconKey;
22
+ /** Short id (same feature) or `<feature>:screen:<id>` of an `actionForm` screen. */
23
+ readonly screen: string;
24
+ /** Field of that form which receives the selected row ids: a `multiSelect` with `display: "count"`. The ids travel in memory, not in the URL. The client cap `MAX_BULK_SELECTION` is no protection: the form's write handler runs once, so access and audit no longer run per row. The handler must bound the list itself (`z.array(...).max(MAX_BULK_SELECTION)`) and check every id with a tenant-scoped detail, answering `failNotFound` for a foreign or unknown one. */
25
+ readonly idsField: string;
26
+ };
27
+ /** An action over checkbox-selected rows: a writeHandler row action per row (`rowAction`) or one form for all rows (`screen` + `idsField`). */
28
+ export type ListBulkAction = ListBulkRowAction | ListBulkFormAction;
@@ -1,3 +1,4 @@
1
1
  export const LIST_BULK_ACTION_KEYS = ["id", "rowAction", "confirm"];
2
+ export const LIST_BULK_FORM_ACTION_KEYS = ["id", "label", "icon", "screen", "idsField"];
2
3
  /** Most rows one selection can hold; the loaded page caps it further. */
3
4
  export const MAX_BULK_SELECTION = 100;
package/dist/screen.d.ts CHANGED
@@ -131,7 +131,7 @@ export type ScreenNavSugar = {
131
131
  };
132
132
  export type ScreenDefinition = EntityListScreenDefinition | ProjectionListScreenDefinition | ProjectionDetailScreenDefinition | DashboardScreenDefinition | EntityEditScreenDefinition | ActionFormScreenDefinition | ConfigEditScreenDefinition | SecretsEditScreenDefinition | SecretMintScreenDefinition | CustomScreenDefinition;
133
133
  export type { NamedFilterFacetOptions } from "./named-list-filters.ts";
134
- export type { ActionFormFooterAction, ActionFormLoad, ActionFormRedirect, ActionFormScreenDefinition, ActionFormSuccessFact, ActionFormSuccessItems, ActionFormSuccessLink, FormFieldDerivation, FormFieldDerivationWithoutList, SecretMintConfirmStep, SecretMintScreenDefinition, SecretReveal, SecretRevealField, } from "./screen-action-form.ts";
134
+ export type { ActionFormFooterAction, ActionFormLoad, ActionFormPreview, ActionFormPreviewList, ActionFormRedirect, ActionFormScreenDefinition, ActionFormSuccessFact, ActionFormSuccessItems, ActionFormSuccessLink, ActionFormValueType, FormFieldDerivation, FormFieldDerivationWithoutList, SecretMintConfirmStep, SecretMintScreenDefinition, SecretReveal, SecretRevealField, } from "./screen-action-form.ts";
135
135
  export type { ConfigEditAction, ConfigEditScreenDefinition, CustomScreenDefinition, CustomScreenRoute, SecretsEditScreenDefinition, SecretsEditSection, } from "./screen-custom-config.ts";
136
136
  export type { DashboardChartKind, DashboardChartMarkerKind, DashboardChartPanel, DashboardChartRangeOption, DashboardChartRanges, DashboardChartTone, DashboardCurrencyFormat, DashboardCustomPanel, DashboardDateParam, DashboardFeedPanel, DashboardFilterDefinition, DashboardI18nText, DashboardLayout, DashboardListFooterLink, DashboardListNarrow, DashboardListPanel, DashboardListRowLink, DashboardListRowToneMarker, DashboardMoneyParam, DashboardPanelColumn, DashboardPanelDefinition, DashboardPanelEmptyState, DashboardPanelGate, DashboardPanelNarrow, DashboardPanelQueryOptions, DashboardPanelSpan, DashboardPanelVisibility, DashboardProgressListPanel, DashboardProgressTone, DashboardRecordBinding, DashboardRefresh, DashboardRelativeTimeFormat, DashboardRelativeTimeParam, DashboardScopeDefinition, DashboardScreenDefinition, DashboardScreenPanel, DashboardStatGroupLayout, DashboardStatGroupLink, DashboardStatGroupNarrow, DashboardStatGroupPanel, DashboardStatPanel, DashboardStatTone, DashboardText, DashboardTextBlock, DashboardTextPanel, DashboardTextParam, DashboardTimeRangeDefinition, DashboardValueFormat, ScreenVisibility, } from "./screen-dashboard.ts";
137
137
  export { DASHBOARD_MIN_REFRESH_SECONDS, DASHBOARD_STAT_TONES } from "./screen-dashboard.ts";
@@ -142,7 +142,7 @@ export type { EntityListExpandableRow, ExpandableRowGrouping } from "./screen-ex
142
142
  export type { ScreenFallback, ScreenFallbackByReason, ScreenFallbackReason, } from "./screen-fallback.ts";
143
143
  export { fallbackTargetFor, fallbackTargets, SCREEN_FALLBACK_REASONS } from "./screen-fallback.ts";
144
144
  export type { ListBulkAction } from "./screen-list-bulk.ts";
145
- export { LIST_BULK_ACTION_KEYS, MAX_BULK_SELECTION } from "./screen-list-bulk.ts";
145
+ export { LIST_BULK_ACTION_KEYS, LIST_BULK_FORM_ACTION_KEYS, MAX_BULK_SELECTION, } from "./screen-list-bulk.ts";
146
146
  export type { BundledListsOptions, ListColumnPin, ListNarrowFacets, ListPayloadCapabilities, ListTableDensity, ListTableExportOptions, ListTableFrame, ListTableGrouping, ListTableOptions, ListTableSummaryRow, ListTableTotal, ListToolbarActionsPlacement, } from "./screen-list-table.ts";
147
147
  export { DEFAULT_EXPORT_MAX_ROWS, entityHasFilterableFields, entityListDeclaresFilters, entityListDeclaresSearch, LIST_COLUMN_MAX_WIDTH_PX, LIST_COLUMN_PINS, LIST_NARROW_FACETS, LIST_TABLE_DENSITIES, LIST_TABLE_DENSITY_KEYS, LIST_TABLE_EXPORT_KEYS, LIST_TABLE_FRAMES, LIST_TABLE_GROUPING_KEYS, LIST_TABLE_OPTION_KEYS, LIST_TABLE_SUMMARY_ROW_KEYS, LIST_TABLE_TOTAL_KEYS, LIST_TOOLBAR_ACTIONS_PLACEMENTS, listPayloadKeysSent, MAX_EXPORT_MAX_ROWS, } from "./screen-list-table.ts";
148
148
  export type { ListFacetSpec, MetricNavigate, MetricSpec, ProjectionDetailInitialTab, ProjectionDetailScreenDefinition, ProjectionListScreenDefinition, RecordHeaderSpec, RecordHeaderSubtitlePart, } from "./screen-projection.ts";
package/dist/screen.js CHANGED
@@ -1,5 +1,5 @@
1
1
  export { DASHBOARD_MIN_REFRESH_SECONDS, DASHBOARD_STAT_TONES } from "./screen-dashboard.js";
2
2
  export { relatedListGroupHeaderLabel, relatedListGroupKey } from "./screen-entity-edit.js";
3
3
  export { fallbackTargetFor, fallbackTargets, SCREEN_FALLBACK_REASONS } from "./screen-fallback.js";
4
- export { LIST_BULK_ACTION_KEYS, MAX_BULK_SELECTION } from "./screen-list-bulk.js";
4
+ export { LIST_BULK_ACTION_KEYS, LIST_BULK_FORM_ACTION_KEYS, MAX_BULK_SELECTION, } from "./screen-list-bulk.js";
5
5
  export { DEFAULT_EXPORT_MAX_ROWS, entityHasFilterableFields, entityListDeclaresFilters, entityListDeclaresSearch, LIST_COLUMN_MAX_WIDTH_PX, LIST_COLUMN_PINS, LIST_NARROW_FACETS, LIST_TABLE_DENSITIES, LIST_TABLE_DENSITY_KEYS, LIST_TABLE_EXPORT_KEYS, LIST_TABLE_FRAMES, LIST_TABLE_GROUPING_KEYS, LIST_TABLE_OPTION_KEYS, LIST_TABLE_SUMMARY_ROW_KEYS, LIST_TABLE_TOTAL_KEYS, LIST_TOOLBAR_ACTIONS_PLACEMENTS, listPayloadKeysSent, MAX_EXPORT_MAX_ROWS, } from "./screen-list-table.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cosmicdrift/kumiko-types",
3
- "version": "0.417.0",
3
+ "version": "0.418.0",
4
4
  "description": "Framework-Type-Definitions für Kumiko — FeatureDefinition, BootCheck-Types und die reinen Engine-Types. Erlaubt Downstream-Konsumenten, gegen die Type-Contracts zu bauen, ohne das ganze Framework-Package zu importieren. Enthaelt keine identitaets-sensitiven Runtime-Werte mehr (Error-Klassen leben seit #1629 in kumiko-framework, Brand-Symbole nutzen Symbol.for) und ist deshalb eine plain dependency, keine peerDependency.",
5
5
  "license": "MIT",
6
6
  "author": "Marc Frost <marc@cosmicdriftgamestudio.com>",