@cratis/stage.runtime 4.190.1 → 4.190.3

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.
@@ -1,4 +1,5 @@
1
1
  import type { ExternalComponent, FormField } from '@cratis/scene.model';
2
+ import type { StageDataState } from './stageData';
2
3
  import { schemaPropertiesOf } from './stageFormSchema';
3
4
  import type { SchemaProperty } from './stageFormSchema';
4
5
  export { schemaPropertiesOf };
@@ -27,8 +28,16 @@ export declare function StageCommandForm({ element }: StageCommandFormProps): im
27
28
  * A schema that marks the identifier the command acts on (`x-identity`, a task dialog's) says which one that is: only it is created, and a
28
29
  * reference to another entity gets only what the address or the session supplies. A schema that marks none - an authored form's - leaves
29
30
  * every identifier it does not show to the session, as it always has.
31
+ *
32
+ * The address wins, then the selected row, then the identity the session already holds: a row the person selected is the entity the action is
33
+ * about, even when the session holds another one. An identifier that a row the person could select carries (`selectableRows`) names an entity
34
+ * that already exists: with no row selected the session does not invent it, so the value stays missing until a row is chosen. The identifier
35
+ * a task dialog acts on (`x-identity`) is still created - the basket a shopper starts - even when a row on the screen shows the same name.
36
+ *
37
+ * An action on a list (`rowAction`) acts on the row the person selected, whatever the schema marks: an identifier a row carries comes from the
38
+ * address or the selected row only - never from the session, and is never created.
30
39
  */
31
- export declare function sessionIdentifiers(fields: FormField[], schema: SchemaProperty[], parameters: Record<string, string>, selectedRows?: Record<string, unknown>[]): StageCommandContent;
40
+ export declare function sessionIdentifiers(fields: FormField[], schema: SchemaProperty[], parameters: Record<string, string>, selectedRows?: Record<string, unknown>[], selectableRows?: Record<string, unknown>[], rowAction?: boolean): StageCommandContent;
32
41
  /**
33
42
  * Whether a task dialog leaves an identifier out of what it asks: the identifier the command acts on (`x-identity`) - the shopper's basket,
34
43
  * which the session supplies or creates - or one the address or the session already supplies. Every other identifier is a reference to
@@ -58,3 +67,19 @@ export declare function suppliedIdentifier(property: SchemaProperty, parameters:
58
67
  * @returns The selected row's value, or nothing when no selected row (or more than one, differently) carries one.
59
68
  */
60
69
  export declare function selectedIdentifier(property: SchemaProperty, selectedRows: Record<string, unknown>[]): string | undefined;
70
+ /** Whether a row the person could select carries a property of this name - the key of an entity that already exists on the screen. */
71
+ export declare function carriedBy(property: SchemaProperty, rows: Record<string, unknown>[]): boolean;
72
+ /** The rows of every query the screen has read: the rows a table shows and the person could select. */
73
+ export declare function selectableRowsOf(queries: StageDataState['queries']): Record<string, unknown>[];
74
+ /**
75
+ * The required identifiers a command acts on that the form does not show and that a selectable row supplies, and for which no row has been
76
+ * selected yet and nothing else (the screen's address) supplies them. A toolbar action with any of these waits for a selected row - also when
77
+ * the schema marks it as the identifier the command acts on (`x-identity`), which the host does for every modeled command.
78
+ *
79
+ * @param schema The command's properties.
80
+ * @param parameters The screen's address parameters.
81
+ * @param selectedRows The rows currently selected on the screen.
82
+ * @param selectableRows The rows the person could select.
83
+ * @returns The names of the identifiers still waiting for a selection.
84
+ */
85
+ export declare function identifiersAwaitingSelection(schema: SchemaProperty[], parameters: Record<string, string>, selectedRows: Record<string, unknown>[], selectableRows: Record<string, unknown>[]): string[];
@@ -0,0 +1,11 @@
1
+ import type { ExternalComponent } from '@cratis/scene.model';
2
+ interface StageConfirmDialogProps {
3
+ element: ExternalComponent;
4
+ }
5
+ /**
6
+ * A screen that confirms a decision: its title, a button for each decision and, once one is chosen, only that decision's form. The entity the
7
+ * decision is about is the screen's, so the identifier the command acts on is not asked for - the address, the selected row or the identity the action creates supplies it - and a
8
+ * successful decision takes the person to the screen the action names.
9
+ */
10
+ export declare function StageConfirmDialog({ element }: StageConfirmDialogProps): import("react").JSX.Element;
11
+ export {};
@@ -1,14 +1,10 @@
1
1
  import { type ArcConfiguration } from '@cratis/arc.react';
2
2
  import { Command, type ICommandResult } from '@cratis/arc/commands';
3
3
  import type { StageCommandOutcome } from './StageCommandOutcome';
4
+ import { hostedBasePath } from './hostedBasePath';
5
+ export { hostedBasePath };
4
6
  /** Resolves only native Arc command proxies; unrelated registry entries cannot execute. */
5
7
  export declare function registeredCommand(name: string, typeName?: string, route?: string): (new () => Command) | undefined;
6
- /**
7
- * The path the page is served under, without a trailing slash: empty at the root of a host, `/api/play/{id}` when a
8
- * reverse proxy (Studio's Play) hangs the Stage off a prefix. Registered command routes start with `/`, so without this
9
- * they would be posted to the root of the proxy's host instead of to the Stage.
10
- */
11
- export declare function hostedBasePath(): string;
12
8
  /**
13
9
  * Points a command at the path the page is served under when Arc was not given a base path. Arc's own command form builds its command from
14
10
  * Arc's default configuration, whose empty base path posts to the root of the host - Studio's Play at `/api/play/{id}/` refused that with `405`.
@@ -0,0 +1,8 @@
1
+ /**
2
+ * The path the page is served under, without a trailing slash: empty at the root of a host, `/api/play/{id}` when a
3
+ * reverse proxy (Studio's Play) hangs the Stage off a prefix. Registered command and query routes start with `/`, so without
4
+ * this they would go to the root of the proxy's host instead of to the Stage.
5
+ */
6
+ export declare function hostedBasePath(): string;
7
+ /** Arc's default configuration carries an empty base path, so an empty one means "not configured" just like an absent one. */
8
+ export declare function apiBasePathFor(arcApiBasePath?: string): string;