@cratis/scene.model 4.11.0 → 4.12.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/cjs/forms/CommandFormLayout.js +13 -0
- package/dist/cjs/forms/CommandFormLayout.js.map +1 -0
- package/dist/cjs/forms/Form.js +2 -0
- package/dist/cjs/forms/Form.js.map +1 -1
- package/dist/cjs/forms/FormColumn.js +13 -0
- package/dist/cjs/forms/FormColumn.js.map +1 -0
- package/dist/cjs/forms/FormField.js +3 -6
- package/dist/cjs/forms/FormField.js.map +1 -1
- package/dist/cjs/forms/FormFieldPlacement.js +15 -0
- package/dist/cjs/forms/FormFieldPlacement.js.map +1 -0
- package/dist/cjs/forms/FormGenerationMode.js +14 -0
- package/dist/cjs/forms/FormGenerationMode.js.map +1 -0
- package/dist/cjs/forms/FormWidth.js +11 -0
- package/dist/cjs/forms/FormWidth.js.map +1 -0
- package/dist/cjs/forms/FormWidthUnit.js +16 -0
- package/dist/cjs/forms/FormWidthUnit.js.map +1 -0
- package/dist/cjs/index.js +12 -0
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/forms/CommandFormLayout.d.ts +11 -0
- package/dist/esm/forms/CommandFormLayout.d.ts.map +1 -0
- package/dist/esm/forms/CommandFormLayout.js +11 -0
- package/dist/esm/forms/CommandFormLayout.js.map +1 -0
- package/dist/esm/forms/Form.d.ts +4 -0
- package/dist/esm/forms/Form.d.ts.map +1 -1
- package/dist/esm/forms/Form.js +2 -0
- package/dist/esm/forms/Form.js.map +1 -1
- package/dist/esm/forms/FormColumn.d.ts +9 -0
- package/dist/esm/forms/FormColumn.d.ts.map +1 -0
- package/dist/esm/forms/FormColumn.js +11 -0
- package/dist/esm/forms/FormColumn.js.map +1 -0
- package/dist/esm/forms/FormField.d.ts +2 -0
- package/dist/esm/forms/FormField.d.ts.map +1 -1
- package/dist/esm/forms/FormField.js +3 -6
- package/dist/esm/forms/FormField.js.map +1 -1
- package/dist/esm/forms/FormFieldPlacement.d.ts +11 -0
- package/dist/esm/forms/FormFieldPlacement.d.ts.map +1 -0
- package/dist/esm/forms/FormFieldPlacement.js +13 -0
- package/dist/esm/forms/FormFieldPlacement.js.map +1 -0
- package/dist/esm/forms/FormGenerationMode.d.ts +5 -0
- package/dist/esm/forms/FormGenerationMode.d.ts.map +1 -0
- package/dist/esm/forms/FormGenerationMode.js +12 -0
- package/dist/esm/forms/FormGenerationMode.js.map +1 -0
- package/dist/esm/forms/FormWidth.d.ts +7 -0
- package/dist/esm/forms/FormWidth.d.ts.map +1 -0
- package/dist/esm/forms/FormWidth.js +9 -0
- package/dist/esm/forms/FormWidth.js.map +1 -0
- package/dist/esm/forms/FormWidthUnit.d.ts +7 -0
- package/dist/esm/forms/FormWidthUnit.d.ts.map +1 -0
- package/dist/esm/forms/FormWidthUnit.js +14 -0
- package/dist/esm/forms/FormWidthUnit.js.map +1 -0
- package/dist/esm/forms/index.d.ts +6 -0
- package/dist/esm/forms/index.d.ts.map +1 -1
- package/dist/esm/forms/index.js +6 -0
- package/dist/esm/forms/index.js.map +1 -1
- package/dist/esm/index.js +6 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/tsconfig.tsbuildinfo +1 -1
- package/forms/CommandFormLayout.ts +18 -0
- package/forms/Form.ts +5 -1
- package/forms/FormColumn.ts +16 -0
- package/forms/FormField.ts +4 -1
- package/forms/FormFieldPlacement.ts +18 -0
- package/forms/FormGenerationMode.ts +10 -0
- package/forms/FormWidth.ts +16 -0
- package/forms/FormWidthUnit.ts +12 -0
- package/forms/index.ts +6 -0
- package/package.json +1 -1
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
// Copyright (c) Cratis. All rights reserved.
|
|
2
|
+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
3
|
+
|
|
4
|
+
import { FormColumn } from './FormColumn';
|
|
5
|
+
import { FormFieldPlacement } from './FormFieldPlacement';
|
|
6
|
+
import { FormWidth } from './FormWidth';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Platform-neutral command-form geometry. It is independent of auto/manual field generation mode.
|
|
10
|
+
*/
|
|
11
|
+
export interface CommandFormLayout {
|
|
12
|
+
columns: FormColumn[];
|
|
13
|
+
placements: FormFieldPlacement[];
|
|
14
|
+
columnGap?: FormWidth;
|
|
15
|
+
rowGap?: FormWidth;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export const CommandFormLayoutPropertyNames: (keyof CommandFormLayout)[] = ['columns', 'placements', 'columnGap', 'rowGap'];
|
package/forms/Form.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
// Copyright (c) Cratis. All rights reserved.
|
|
2
2
|
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
3
3
|
|
|
4
|
+
import { CommandFormLayout } from './CommandFormLayout';
|
|
5
|
+
import { FormGenerationMode } from './FormGenerationMode';
|
|
4
6
|
import { PopulateSource } from './PopulateSource';
|
|
5
7
|
import { FormField } from './FormField';
|
|
6
8
|
import { Behavior } from '../interactions';
|
|
@@ -12,6 +14,8 @@ export interface Form {
|
|
|
12
14
|
name: string;
|
|
13
15
|
forCommand: string;
|
|
14
16
|
populateSource?: PopulateSource;
|
|
17
|
+
generationMode?: FormGenerationMode;
|
|
18
|
+
layout?: CommandFormLayout;
|
|
15
19
|
fields: FormField[];
|
|
16
20
|
/**
|
|
17
21
|
* The behaviors attached here - what happens when someone interacts with it. Additive with whatever is
|
|
@@ -20,4 +24,4 @@ export interface Form {
|
|
|
20
24
|
behaviors?: Behavior[];
|
|
21
25
|
}
|
|
22
26
|
|
|
23
|
-
export const FormPropertyNames: (keyof Form)[] = ['name', 'forCommand', 'populateSource', 'fields', 'behaviors'];
|
|
27
|
+
export const FormPropertyNames: (keyof Form)[] = ['name', 'forCommand', 'populateSource', 'generationMode', 'layout', 'fields', 'behaviors'];
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// Copyright (c) Cratis. All rights reserved.
|
|
2
|
+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
3
|
+
|
|
4
|
+
import { FormWidth } from './FormWidth';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* One column in a command-form geometry grid. Indexes are one-based for authored stability.
|
|
8
|
+
*/
|
|
9
|
+
export interface FormColumn {
|
|
10
|
+
index: number;
|
|
11
|
+
width?: FormWidth;
|
|
12
|
+
minWidth?: FormWidth;
|
|
13
|
+
maxWidth?: FormWidth;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export const FormColumnPropertyNames: (keyof FormColumn)[] = ['index', 'width', 'minWidth', 'maxWidth'];
|
package/forms/FormField.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
// Copyright (c) Cratis. All rights reserved.
|
|
2
2
|
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
3
3
|
|
|
4
|
+
import { FormFieldPlacement } from './FormFieldPlacement';
|
|
5
|
+
|
|
4
6
|
/**
|
|
5
7
|
* One field of a {@link Form}. Mirrors the three population tiers Screenplay's `form` construct
|
|
6
8
|
* establishes: auto-mapped by name (`sourceProperty` and `composeUsing` both undefined), explicitly
|
|
@@ -11,6 +13,7 @@ export interface FormField {
|
|
|
11
13
|
sourceProperty?: string;
|
|
12
14
|
composeUsing?: string;
|
|
13
15
|
label?: string;
|
|
16
|
+
placement?: FormFieldPlacement;
|
|
14
17
|
}
|
|
15
18
|
|
|
16
|
-
export const FormFieldPropertyNames: (keyof FormField)[] = ['name', 'sourceProperty', 'composeUsing', 'label'];
|
|
19
|
+
export const FormFieldPropertyNames: (keyof FormField)[] = ['name', 'sourceProperty', 'composeUsing', 'label', 'placement'];
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
// Copyright (c) Cratis. All rights reserved.
|
|
2
|
+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
3
|
+
|
|
4
|
+
import { FormWidth } from './FormWidth';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Authored placement for one command-form field in a platform-neutral grid. Row and column are one-based.
|
|
8
|
+
*/
|
|
9
|
+
export interface FormFieldPlacement {
|
|
10
|
+
field: string;
|
|
11
|
+
row: number;
|
|
12
|
+
column: number;
|
|
13
|
+
rowSpan?: number;
|
|
14
|
+
columnSpan?: number;
|
|
15
|
+
width?: FormWidth;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export const FormFieldPlacementPropertyNames: (keyof FormFieldPlacement)[] = ['field', 'row', 'column', 'rowSpan', 'columnSpan', 'width'];
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// Copyright (c) Cratis. All rights reserved.
|
|
2
|
+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* How a command form's fields are generated.
|
|
6
|
+
*/
|
|
7
|
+
export enum FormGenerationMode {
|
|
8
|
+
Auto = 'auto',
|
|
9
|
+
Manual = 'manual',
|
|
10
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// Copyright (c) Cratis. All rights reserved.
|
|
2
|
+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
3
|
+
|
|
4
|
+
import { FormWidthUnit } from './FormWidthUnit';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* A platform-neutral width value for form geometry.
|
|
8
|
+
*/
|
|
9
|
+
export interface FormWidth {
|
|
10
|
+
unit: FormWidthUnit;
|
|
11
|
+
|
|
12
|
+
/** The numeric value for fraction, pixel and percent widths. Omitted for `auto`. */
|
|
13
|
+
value?: number;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export const FormWidthPropertyNames: (keyof FormWidth)[] = ['unit', 'value'];
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// Copyright (c) Cratis. All rights reserved.
|
|
2
|
+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* The unit used by a command-form column, gap or field width.
|
|
6
|
+
*/
|
|
7
|
+
export enum FormWidthUnit {
|
|
8
|
+
Fraction = 'fraction',
|
|
9
|
+
Pixels = 'pixels',
|
|
10
|
+
Percent = 'percent',
|
|
11
|
+
Auto = 'auto',
|
|
12
|
+
}
|
package/forms/index.ts
CHANGED
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
// Copyright (c) Cratis. All rights reserved.
|
|
2
2
|
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
3
3
|
|
|
4
|
+
export * from './CommandFormLayout';
|
|
4
5
|
export * from './Form';
|
|
6
|
+
export * from './FormColumn';
|
|
5
7
|
export * from './FormField';
|
|
8
|
+
export * from './FormFieldPlacement';
|
|
9
|
+
export * from './FormGenerationMode';
|
|
10
|
+
export * from './FormWidth';
|
|
11
|
+
export * from './FormWidthUnit';
|
|
6
12
|
export * from './PopulateSource';
|
|
7
13
|
export * from './PopulateViaQuery';
|
|
8
14
|
export * from './PopulateFromItem';
|