@limetech/lime-elements 37.6.0 → 37.7.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/CHANGELOG.md +8 -0
- package/dist/cjs/index.cjs.js +23 -8
- package/dist/cjs/index.cjs.js.map +1 -1
- package/dist/cjs/limel-form.cjs.entry.js +1 -2
- package/dist/cjs/limel-form.cjs.entry.js.map +1 -1
- package/dist/collection/components/form/adapters/widget-adapter.js.map +1 -1
- package/dist/collection/components/form/form.js +14 -5
- package/dist/collection/components/form/form.js.map +1 -1
- package/dist/collection/components/form/form.types.js +1 -0
- package/dist/collection/components/form/form.types.js.map +1 -1
- package/dist/collection/components/form/help/help.js.map +1 -1
- package/dist/collection/components/form/templates/object-field.js +1 -2
- package/dist/collection/components/form/templates/object-field.js.map +1 -1
- package/dist/collection/components/form/templates/types.js.map +1 -1
- package/dist/collection/components/form/widgets/types.js.map +1 -1
- package/dist/esm/index.js +24 -2
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/limel-form.entry.js +1 -2
- package/dist/esm/limel-form.entry.js.map +1 -1
- package/dist/lime-elements/index.esm.js +1 -1
- package/dist/lime-elements/index.esm.js.map +1 -1
- package/dist/lime-elements/lime-elements.esm.js +1 -1
- package/dist/lime-elements/{p-870d72f1.entry.js → p-64e352ec.entry.js} +5 -5
- package/dist/lime-elements/p-64e352ec.entry.js.map +1 -0
- package/dist/types/components/form/form.d.ts +3 -6
- package/dist/types/components/form/form.types.d.ts +37 -7
- package/dist/types/components/form/help/help.d.ts +2 -2
- package/dist/types/components/form/templates/types.d.ts +2 -2
- package/dist/types/components/form/widgets/types.d.ts +2 -2
- package/dist/types/components.d.ts +6 -12
- package/package.json +3 -3
- package/dist/cjs/form.types-e76a78e1.js +0 -26
- package/dist/cjs/form.types-e76a78e1.js.map +0 -1
- package/dist/collection/components/form/internal.types.js +0 -2
- package/dist/collection/components/form/internal.types.js.map +0 -1
- package/dist/esm/form.types-e39f98a4.js +0 -26
- package/dist/esm/form.types-e39f98a4.js.map +0 -1
- package/dist/lime-elements/p-067efbaf.js +0 -2
- package/dist/lime-elements/p-067efbaf.js.map +0 -1
- package/dist/lime-elements/p-870d72f1.entry.js.map +0 -1
- package/dist/types/components/form/internal.types.d.ts +0 -6
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { EventEmitter } from '../../stencil-public-runtime';
|
|
2
|
-
import { FormError, ValidationError, ValidationStatus } from './form.types';
|
|
2
|
+
import { FormError, FormSchema, ValidationError, ValidationStatus } from './form.types';
|
|
3
3
|
/**
|
|
4
4
|
* @exampleComponent limel-example-form
|
|
5
5
|
* @exampleComponent limel-example-nested-form
|
|
@@ -18,10 +18,7 @@ export declare class Form {
|
|
|
18
18
|
/**
|
|
19
19
|
* The schema used to render the form
|
|
20
20
|
*/
|
|
21
|
-
schema:
|
|
22
|
-
id?: string;
|
|
23
|
-
[key: string]: any;
|
|
24
|
-
};
|
|
21
|
+
schema: FormSchema;
|
|
25
22
|
/**
|
|
26
23
|
* Value of the form
|
|
27
24
|
*/
|
|
@@ -39,7 +36,7 @@ export declare class Form {
|
|
|
39
36
|
* factory must return an object where each key is the name of the property
|
|
40
37
|
* that should be set, along with its value.
|
|
41
38
|
*/
|
|
42
|
-
propsFactory?: (schema:
|
|
39
|
+
propsFactory?: (schema: FormSchema) => Record<string, any>;
|
|
43
40
|
/**
|
|
44
41
|
* Custom function to customize the default error messages
|
|
45
42
|
*/
|
|
@@ -1,5 +1,21 @@
|
|
|
1
|
+
import { JSONSchema7 } from 'json-schema';
|
|
1
2
|
import { Help } from '../help/help.types';
|
|
2
3
|
import { EventEmitter } from '../../stencil-public-runtime';
|
|
4
|
+
declare module 'json-schema' {
|
|
5
|
+
interface JSONSchema7 {
|
|
6
|
+
/**
|
|
7
|
+
* @internal
|
|
8
|
+
* Unique identifier for the schema
|
|
9
|
+
*/
|
|
10
|
+
id?: string;
|
|
11
|
+
/**
|
|
12
|
+
* Lime elements specific options that can be specified in a schema
|
|
13
|
+
*/
|
|
14
|
+
lime?: Omit<LimeSchemaOptions, 'layout'> & {
|
|
15
|
+
layout?: Partial<LimeLayoutOptions>;
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
}
|
|
3
19
|
/**
|
|
4
20
|
* @public
|
|
5
21
|
*/
|
|
@@ -93,11 +109,11 @@ export interface FormInfo {
|
|
|
93
109
|
/**
|
|
94
110
|
* The schema of the current property
|
|
95
111
|
*/
|
|
96
|
-
schema?:
|
|
112
|
+
schema?: FormSchema;
|
|
97
113
|
/**
|
|
98
114
|
* The schema of the whole form
|
|
99
115
|
*/
|
|
100
|
-
rootSchema?:
|
|
116
|
+
rootSchema?: FormSchema;
|
|
101
117
|
/**
|
|
102
118
|
* A tree of errors for this property and its children
|
|
103
119
|
*/
|
|
@@ -151,13 +167,18 @@ export interface LimeSchemaOptions {
|
|
|
151
167
|
* When specified on an object it will render the sub components with the
|
|
152
168
|
* specified layout
|
|
153
169
|
*/
|
|
154
|
-
layout?:
|
|
170
|
+
layout?: LimeLayoutOptions;
|
|
155
171
|
/**
|
|
156
172
|
* Mark the field as disabled
|
|
157
173
|
*/
|
|
158
174
|
disabled?: boolean;
|
|
159
|
-
help?: string | Help
|
|
175
|
+
help?: string | Partial<Help>;
|
|
160
176
|
}
|
|
177
|
+
/**
|
|
178
|
+
* @public
|
|
179
|
+
* Options for a layout to be used in a form
|
|
180
|
+
*/
|
|
181
|
+
export type LimeLayoutOptions = GridLayoutOptions & RowLayoutOptions;
|
|
161
182
|
/**
|
|
162
183
|
* Options for a component to be rendered inside a form
|
|
163
184
|
*
|
|
@@ -177,7 +198,7 @@ export interface FormComponentOptions {
|
|
|
177
198
|
/**
|
|
178
199
|
* @public
|
|
179
200
|
*/
|
|
180
|
-
export interface FormLayoutOptions<T = FormLayoutType.Default> {
|
|
201
|
+
export interface FormLayoutOptions<T extends FormLayoutType | `${FormLayoutType}` = FormLayoutType.Default> {
|
|
181
202
|
/**
|
|
182
203
|
* The type of layout to use
|
|
183
204
|
*/
|
|
@@ -185,8 +206,9 @@ export interface FormLayoutOptions<T = FormLayoutType.Default> {
|
|
|
185
206
|
}
|
|
186
207
|
/**
|
|
187
208
|
* @public
|
|
209
|
+
* Layout options for a grid layout
|
|
188
210
|
*/
|
|
189
|
-
export interface GridLayoutOptions extends FormLayoutOptions<FormLayoutType
|
|
211
|
+
export interface GridLayoutOptions extends FormLayoutOptions<FormLayoutType | `${FormLayoutType}`> {
|
|
190
212
|
/**
|
|
191
213
|
* When specified on a component within the grid, the component will take
|
|
192
214
|
* up the the specified number of columns in the form
|
|
@@ -210,8 +232,9 @@ export interface GridLayoutOptions extends FormLayoutOptions<FormLayoutType.Grid
|
|
|
210
232
|
}
|
|
211
233
|
/**
|
|
212
234
|
* @public
|
|
235
|
+
* Layout options for a row layout
|
|
213
236
|
*/
|
|
214
|
-
export interface RowLayoutOptions extends FormLayoutOptions<FormLayoutType
|
|
237
|
+
export interface RowLayoutOptions extends FormLayoutOptions<FormLayoutType | `${FormLayoutType}`> {
|
|
215
238
|
/**
|
|
216
239
|
* When specified on a field, the chosen icon will be displayed
|
|
217
240
|
* on the left side of the row, beside the title.
|
|
@@ -220,6 +243,7 @@ export interface RowLayoutOptions extends FormLayoutOptions<FormLayoutType.Row>
|
|
|
220
243
|
}
|
|
221
244
|
/**
|
|
222
245
|
* @public
|
|
246
|
+
* Represents the layout types for a form.
|
|
223
247
|
*/
|
|
224
248
|
export declare enum FormLayoutType {
|
|
225
249
|
/**
|
|
@@ -239,4 +263,10 @@ export declare enum FormLayoutType {
|
|
|
239
263
|
*/
|
|
240
264
|
Row = "row"
|
|
241
265
|
}
|
|
266
|
+
/**
|
|
267
|
+
* @public
|
|
268
|
+
* Represents the JSON schema with Lime specific options
|
|
269
|
+
*/
|
|
270
|
+
export interface FormSchema extends JSONSchema7 {
|
|
271
|
+
}
|
|
242
272
|
//# sourceMappingURL=form.types.d.ts.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { LimeElementsAdapter } from '../adapters/base-adapter';
|
|
3
|
-
import {
|
|
4
|
-
export declare function getHelpComponent(schema:
|
|
3
|
+
import { FormSchema } from '../form.types';
|
|
4
|
+
export declare function getHelpComponent(schema: FormSchema): React.ReactElement<{
|
|
5
5
|
value: string;
|
|
6
6
|
}, string | React.JSXElementConstructor<any>> | React.CElement<{
|
|
7
7
|
name: string;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { ObjectFieldTemplateProps, ArrayFieldTemplateProps } from '@rjsf/core';
|
|
2
|
-
import {
|
|
2
|
+
import { FormSchema } from '../form.types';
|
|
3
3
|
export { FieldTemplateProps, ArrayFieldTemplateProps } from '@rjsf/core';
|
|
4
4
|
export type TemplateProps = ObjectFieldTemplateProps | ArrayFieldTemplateProps;
|
|
5
5
|
export type ObjectFieldProperty = ObjectFieldTemplateProps['properties'][0];
|
|
6
6
|
export type ArrayFieldItem = ArrayFieldTemplateProps['items'][0];
|
|
7
7
|
export interface LimeObjectFieldTemplateProps extends ObjectFieldTemplateProps {
|
|
8
|
-
schema:
|
|
8
|
+
schema: FormSchema;
|
|
9
9
|
}
|
|
10
10
|
export interface Runnable {
|
|
11
11
|
run: (event: any) => void;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { WidgetProps as RjsfWidgetProps } from '@rjsf/core';
|
|
2
|
-
import {
|
|
2
|
+
import { FormSchema } from '../form.types';
|
|
3
3
|
export interface WidgetProps extends RjsfWidgetProps {
|
|
4
|
-
schema:
|
|
4
|
+
schema: FormSchema;
|
|
5
5
|
}
|
|
6
6
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -23,7 +23,7 @@ import { DockItem } from "./components/dock/dock.types";
|
|
|
23
23
|
import { FileInfo } from "./components/file/file.types";
|
|
24
24
|
import { OfficeViewer } from "./components/file-viewer/file-viewer.types";
|
|
25
25
|
import { FlexContainerAlign, FlexContainerDirection, FlexContainerJustify } from "./components/flex-container/flex-container.types";
|
|
26
|
-
import { FormError, ValidationError, ValidationStatus } from "./components/form/form.types";
|
|
26
|
+
import { FormError, FormSchema, ValidationError, ValidationStatus } from "./components/form/form.types";
|
|
27
27
|
import { IconSize } from "./components/icon/icon.types";
|
|
28
28
|
import { Link as Link1 } from "./global/shared-types/link.types";
|
|
29
29
|
import { InfoTileProgress } from "./components/info-tile/info-tile.types";
|
|
@@ -56,7 +56,7 @@ export { DockItem } from "./components/dock/dock.types";
|
|
|
56
56
|
export { FileInfo } from "./components/file/file.types";
|
|
57
57
|
export { OfficeViewer } from "./components/file-viewer/file-viewer.types";
|
|
58
58
|
export { FlexContainerAlign, FlexContainerDirection, FlexContainerJustify } from "./components/flex-container/flex-container.types";
|
|
59
|
-
export { FormError, ValidationError, ValidationStatus } from "./components/form/form.types";
|
|
59
|
+
export { FormError, FormSchema, ValidationError, ValidationStatus } from "./components/form/form.types";
|
|
60
60
|
export { IconSize } from "./components/icon/icon.types";
|
|
61
61
|
export { Link as Link1 } from "./global/shared-types/link.types";
|
|
62
62
|
export { InfoTileProgress } from "./components/info-tile/info-tile.types";
|
|
@@ -1138,14 +1138,11 @@ export namespace Components {
|
|
|
1138
1138
|
/**
|
|
1139
1139
|
* Factory for creating properties for custom form components When using custom components in the form some properties might have to be set dynamically. If this factory is set, it will be called with the current schema for the field for each custom component in the form. The factory must return an object where each key is the name of the property that should be set, along with its value.
|
|
1140
1140
|
*/
|
|
1141
|
-
"propsFactory"?: (schema:
|
|
1141
|
+
"propsFactory"?: (schema: FormSchema) => Record<string, any>;
|
|
1142
1142
|
/**
|
|
1143
1143
|
* The schema used to render the form
|
|
1144
1144
|
*/
|
|
1145
|
-
"schema":
|
|
1146
|
-
id?: string;
|
|
1147
|
-
[key: string]: any;
|
|
1148
|
-
};
|
|
1145
|
+
"schema": FormSchema;
|
|
1149
1146
|
/**
|
|
1150
1147
|
* Custom function to customize the default error messages
|
|
1151
1148
|
*/
|
|
@@ -5067,14 +5064,11 @@ declare namespace LocalJSX {
|
|
|
5067
5064
|
/**
|
|
5068
5065
|
* Factory for creating properties for custom form components When using custom components in the form some properties might have to be set dynamically. If this factory is set, it will be called with the current schema for the field for each custom component in the form. The factory must return an object where each key is the name of the property that should be set, along with its value.
|
|
5069
5066
|
*/
|
|
5070
|
-
"propsFactory"?: (schema:
|
|
5067
|
+
"propsFactory"?: (schema: FormSchema) => Record<string, any>;
|
|
5071
5068
|
/**
|
|
5072
5069
|
* The schema used to render the form
|
|
5073
5070
|
*/
|
|
5074
|
-
"schema"?:
|
|
5075
|
-
id?: string;
|
|
5076
|
-
[key: string]: any;
|
|
5077
|
-
};
|
|
5071
|
+
"schema"?: FormSchema;
|
|
5078
5072
|
/**
|
|
5079
5073
|
* Custom function to customize the default error messages
|
|
5080
5074
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@limetech/lime-elements",
|
|
3
|
-
"version": "37.
|
|
3
|
+
"version": "37.7.0",
|
|
4
4
|
"description": "Lime Elements",
|
|
5
5
|
"author": "Lime Technologies",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -43,8 +43,8 @@
|
|
|
43
43
|
"generate": "stencil generate"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
|
-
"@commitlint/config-conventional": "^19.0.
|
|
47
|
-
"@microsoft/api-extractor": "^7.41.
|
|
46
|
+
"@commitlint/config-conventional": "^19.0.3",
|
|
47
|
+
"@microsoft/api-extractor": "^7.41.1",
|
|
48
48
|
"@popperjs/core": "^2.11.8",
|
|
49
49
|
"@rjsf/core": "^2.4.2",
|
|
50
50
|
"@rollup/plugin-node-resolve": "^13.3.0",
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* @public
|
|
5
|
-
*/
|
|
6
|
-
exports.FormLayoutType = void 0;
|
|
7
|
-
(function (FormLayoutType) {
|
|
8
|
-
/**
|
|
9
|
-
* The default layout
|
|
10
|
-
*/
|
|
11
|
-
FormLayoutType["Default"] = "default";
|
|
12
|
-
/**
|
|
13
|
-
* Render the form fields using a responsive grid layout
|
|
14
|
-
*/
|
|
15
|
-
FormLayoutType["Grid"] = "grid";
|
|
16
|
-
/**
|
|
17
|
-
* Render the form fields in full-width rows.
|
|
18
|
-
* Each row can have a leading `icon`, and a field.
|
|
19
|
-
* `title` and `description` provided by the schema will be placed
|
|
20
|
-
* on the row itself, and not on the field.
|
|
21
|
-
* This layout is good for creating UIs for user settings pages.
|
|
22
|
-
*/
|
|
23
|
-
FormLayoutType["Row"] = "row";
|
|
24
|
-
})(exports.FormLayoutType || (exports.FormLayoutType = {}));
|
|
25
|
-
|
|
26
|
-
//# sourceMappingURL=form.types-e76a78e1.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"file":"form.types-e76a78e1.js","mappings":";;AAqQA;;;AAGYA;AAAZ,WAAY,cAAc;;;;EAItB,qCAAmB,CAAA;;;;EAKnB,+BAAa,CAAA;;;;;;;;EASb,6BAAW,CAAA;AACf,CAAC,EAnBWA,sBAAc,KAAdA,sBAAc;;","names":["FormLayoutType"],"sources":["./src/components/form/form.types.ts"],"sourcesContent":["import { Help } from '../help/help.types';\nimport { EventEmitter } from '@stencil/core';\n\n/**\n * @public\n */\nexport interface ValidationStatus {\n /**\n * True if the form is valid, false otherwise\n *\n * If the form is invalid, any errors can be found on the `errors` property\n */\n valid: boolean;\n\n /**\n * List of validation errors\n */\n errors?: FormError[];\n}\n\n/**\n * @public\n */\nexport interface FormError {\n /**\n * Name of the error\n */\n name: string;\n\n /**\n * Params of the error\n */\n params?: unknown;\n\n /**\n * Name of the invalid property\n */\n property: string;\n\n /**\n * Path to the property within the schema\n */\n schemaPath: string;\n\n /**\n * String describing the error\n */\n message: string;\n}\n\n/**\n * @public\n */\nexport type ValidationError = {\n /**\n * Name of the field the error belongs to\n */\n [key: string]: string[] | ValidationError;\n};\n\n/**\n * @public\n */\nexport interface FormComponent<T = any> {\n /**\n * The value of the current property\n */\n value: T;\n\n /**\n * Whether or not the current property is required\n */\n required?: boolean;\n\n /**\n * Whether or not the current property is readonly\n */\n readonly?: boolean;\n\n /**\n * Whether or not the current property is disabled\n */\n disabled?: boolean;\n\n /**\n * The label of the current property\n */\n label?: string;\n\n /**\n * The helper text for the current property\n */\n helperText?: string;\n\n /**\n * Additional contextual information about the form\n */\n formInfo?: FormInfo;\n\n /**\n * The event to emit when the value of the current property has changed\n */\n change: EventEmitter<T>;\n}\n\n/**\n * @public\n */\nexport interface FormInfo {\n /**\n * The schema of the current property\n */\n schema?: object;\n\n /**\n * The schema of the whole form\n */\n rootSchema?: object;\n\n /**\n * A tree of errors for this property and its children\n */\n errorSchema?: object;\n\n /**\n * The value of the whole form\n */\n rootValue?: any;\n\n /**\n * The name of the current property\n */\n name?: string;\n\n /**\n * Path to the property within the schema\n */\n schemaPath?: string[];\n}\n\n/**\n * Lime elements specific options that can be specified under the `lime` key in\n * a schema, e.g.\n *\n * ```ts\n * const schema = {\n * type: 'object',\n * lime: {\n * collapsible: true,\n * },\n * };\n * ```\n *\n * @public\n */\nexport interface LimeSchemaOptions {\n /**\n * When specified on an object it will render all sub components inside a\n * collapsible section\n */\n collapsible?: boolean;\n\n /**\n * When `collapsible` is `true`, set this to `false` to make the\n * collapsible section load in the open state.\n * Defaults to `true`.\n */\n collapsed?: boolean;\n\n /**\n * Will render the field using the specified component. The component\n * should implement the `FormComponent` interface\n */\n component?: FormComponentOptions;\n\n /**\n * When specified on an object it will render the sub components with the\n * specified layout\n */\n layout?: FormLayoutOptions<any>;\n\n /**\n * Mark the field as disabled\n */\n disabled?: boolean;\n\n help?: string | Help;\n}\n\n/**\n * Options for a component to be rendered inside a form\n *\n * @public\n */\nexport interface FormComponentOptions {\n /**\n * Name of the component\n */\n name?: string;\n\n /**\n * Extra properties to give the component in addition to the properties\n * specified on the `FormComponent` interface\n */\n props?: Record<string, any>;\n}\n\n/**\n * @public\n */\nexport interface FormLayoutOptions<T = FormLayoutType.Default> {\n /**\n * The type of layout to use\n */\n type: T;\n}\n\n/**\n * @public\n */\nexport interface GridLayoutOptions\n extends FormLayoutOptions<FormLayoutType.Grid> {\n /**\n * When specified on a component within the grid, the component will take\n * up the the specified number of columns in the form\n */\n // eslint-disable-next-line no-magic-numbers\n colSpan?: 1 | 2 | 3 | 4 | 5 | 'all';\n\n /**\n * When specified on a component within the grid, the component will take\n * up the the specified number of rows in the form\n */\n rowSpan?: number;\n\n /**\n * Number of columns to use in the layout\n */\n // eslint-disable-next-line no-magic-numbers\n columns?: 1 | 2 | 3 | 4 | 5;\n\n /**\n * Attempts to fill in holes earlier in the grid, if smaller items come up\n * later. This may cause items to appear out-of-order, when doing so would\n * fill holes left by larger items. Defaults to `true`.\n */\n dense?: boolean;\n}\n\n/**\n * @public\n */\nexport interface RowLayoutOptions\n extends FormLayoutOptions<FormLayoutType.Row> {\n /**\n * When specified on a field, the chosen icon will be displayed\n * on the left side of the row, beside the title.\n */\n icon?: string;\n}\n\n/**\n * @public\n */\nexport enum FormLayoutType {\n /**\n * The default layout\n */\n Default = 'default',\n\n /**\n * Render the form fields using a responsive grid layout\n */\n Grid = 'grid',\n\n /**\n * Render the form fields in full-width rows.\n * Each row can have a leading `icon`, and a field.\n * `title` and `description` provided by the schema will be placed\n * on the row itself, and not on the field.\n * This layout is good for creating UIs for user settings pages.\n */\n Row = 'row',\n}\n"],"version":3}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"internal.types.js","sourceRoot":"","sources":["../../../src/components/form/internal.types.ts"],"names":[],"mappings":"","sourcesContent":["import { JSONSchema7 } from 'json-schema';\nimport { LimeSchemaOptions } from './form.types';\n\nexport interface LimeJSONSchema extends JSONSchema7 {\n lime?: LimeSchemaOptions;\n}\n"]}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @public
|
|
3
|
-
*/
|
|
4
|
-
var FormLayoutType;
|
|
5
|
-
(function (FormLayoutType) {
|
|
6
|
-
/**
|
|
7
|
-
* The default layout
|
|
8
|
-
*/
|
|
9
|
-
FormLayoutType["Default"] = "default";
|
|
10
|
-
/**
|
|
11
|
-
* Render the form fields using a responsive grid layout
|
|
12
|
-
*/
|
|
13
|
-
FormLayoutType["Grid"] = "grid";
|
|
14
|
-
/**
|
|
15
|
-
* Render the form fields in full-width rows.
|
|
16
|
-
* Each row can have a leading `icon`, and a field.
|
|
17
|
-
* `title` and `description` provided by the schema will be placed
|
|
18
|
-
* on the row itself, and not on the field.
|
|
19
|
-
* This layout is good for creating UIs for user settings pages.
|
|
20
|
-
*/
|
|
21
|
-
FormLayoutType["Row"] = "row";
|
|
22
|
-
})(FormLayoutType || (FormLayoutType = {}));
|
|
23
|
-
|
|
24
|
-
export { FormLayoutType as F };
|
|
25
|
-
|
|
26
|
-
//# sourceMappingURL=form.types-e39f98a4.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"file":"form.types-e39f98a4.js","mappings":"AAqQA;;;IAGY;AAAZ,WAAY,cAAc;;;;EAItB,qCAAmB,CAAA;;;;EAKnB,+BAAa,CAAA;;;;;;;;EASb,6BAAW,CAAA;AACf,CAAC,EAnBW,cAAc,KAAd,cAAc;;;;","names":[],"sources":["./src/components/form/form.types.ts"],"sourcesContent":["import { Help } from '../help/help.types';\nimport { EventEmitter } from '@stencil/core';\n\n/**\n * @public\n */\nexport interface ValidationStatus {\n /**\n * True if the form is valid, false otherwise\n *\n * If the form is invalid, any errors can be found on the `errors` property\n */\n valid: boolean;\n\n /**\n * List of validation errors\n */\n errors?: FormError[];\n}\n\n/**\n * @public\n */\nexport interface FormError {\n /**\n * Name of the error\n */\n name: string;\n\n /**\n * Params of the error\n */\n params?: unknown;\n\n /**\n * Name of the invalid property\n */\n property: string;\n\n /**\n * Path to the property within the schema\n */\n schemaPath: string;\n\n /**\n * String describing the error\n */\n message: string;\n}\n\n/**\n * @public\n */\nexport type ValidationError = {\n /**\n * Name of the field the error belongs to\n */\n [key: string]: string[] | ValidationError;\n};\n\n/**\n * @public\n */\nexport interface FormComponent<T = any> {\n /**\n * The value of the current property\n */\n value: T;\n\n /**\n * Whether or not the current property is required\n */\n required?: boolean;\n\n /**\n * Whether or not the current property is readonly\n */\n readonly?: boolean;\n\n /**\n * Whether or not the current property is disabled\n */\n disabled?: boolean;\n\n /**\n * The label of the current property\n */\n label?: string;\n\n /**\n * The helper text for the current property\n */\n helperText?: string;\n\n /**\n * Additional contextual information about the form\n */\n formInfo?: FormInfo;\n\n /**\n * The event to emit when the value of the current property has changed\n */\n change: EventEmitter<T>;\n}\n\n/**\n * @public\n */\nexport interface FormInfo {\n /**\n * The schema of the current property\n */\n schema?: object;\n\n /**\n * The schema of the whole form\n */\n rootSchema?: object;\n\n /**\n * A tree of errors for this property and its children\n */\n errorSchema?: object;\n\n /**\n * The value of the whole form\n */\n rootValue?: any;\n\n /**\n * The name of the current property\n */\n name?: string;\n\n /**\n * Path to the property within the schema\n */\n schemaPath?: string[];\n}\n\n/**\n * Lime elements specific options that can be specified under the `lime` key in\n * a schema, e.g.\n *\n * ```ts\n * const schema = {\n * type: 'object',\n * lime: {\n * collapsible: true,\n * },\n * };\n * ```\n *\n * @public\n */\nexport interface LimeSchemaOptions {\n /**\n * When specified on an object it will render all sub components inside a\n * collapsible section\n */\n collapsible?: boolean;\n\n /**\n * When `collapsible` is `true`, set this to `false` to make the\n * collapsible section load in the open state.\n * Defaults to `true`.\n */\n collapsed?: boolean;\n\n /**\n * Will render the field using the specified component. The component\n * should implement the `FormComponent` interface\n */\n component?: FormComponentOptions;\n\n /**\n * When specified on an object it will render the sub components with the\n * specified layout\n */\n layout?: FormLayoutOptions<any>;\n\n /**\n * Mark the field as disabled\n */\n disabled?: boolean;\n\n help?: string | Help;\n}\n\n/**\n * Options for a component to be rendered inside a form\n *\n * @public\n */\nexport interface FormComponentOptions {\n /**\n * Name of the component\n */\n name?: string;\n\n /**\n * Extra properties to give the component in addition to the properties\n * specified on the `FormComponent` interface\n */\n props?: Record<string, any>;\n}\n\n/**\n * @public\n */\nexport interface FormLayoutOptions<T = FormLayoutType.Default> {\n /**\n * The type of layout to use\n */\n type: T;\n}\n\n/**\n * @public\n */\nexport interface GridLayoutOptions\n extends FormLayoutOptions<FormLayoutType.Grid> {\n /**\n * When specified on a component within the grid, the component will take\n * up the the specified number of columns in the form\n */\n // eslint-disable-next-line no-magic-numbers\n colSpan?: 1 | 2 | 3 | 4 | 5 | 'all';\n\n /**\n * When specified on a component within the grid, the component will take\n * up the the specified number of rows in the form\n */\n rowSpan?: number;\n\n /**\n * Number of columns to use in the layout\n */\n // eslint-disable-next-line no-magic-numbers\n columns?: 1 | 2 | 3 | 4 | 5;\n\n /**\n * Attempts to fill in holes earlier in the grid, if smaller items come up\n * later. This may cause items to appear out-of-order, when doing so would\n * fill holes left by larger items. Defaults to `true`.\n */\n dense?: boolean;\n}\n\n/**\n * @public\n */\nexport interface RowLayoutOptions\n extends FormLayoutOptions<FormLayoutType.Row> {\n /**\n * When specified on a field, the chosen icon will be displayed\n * on the left side of the row, beside the title.\n */\n icon?: string;\n}\n\n/**\n * @public\n */\nexport enum FormLayoutType {\n /**\n * The default layout\n */\n Default = 'default',\n\n /**\n * Render the form fields using a responsive grid layout\n */\n Grid = 'grid',\n\n /**\n * Render the form fields in full-width rows.\n * Each row can have a leading `icon`, and a field.\n * `title` and `description` provided by the schema will be placed\n * on the row itself, and not on the field.\n * This layout is good for creating UIs for user settings pages.\n */\n Row = 'row',\n}\n"],"version":3}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["FormLayoutType"],"sources":["./src/components/form/form.types.ts"],"sourcesContent":["import { Help } from '../help/help.types';\nimport { EventEmitter } from '@stencil/core';\n\n/**\n * @public\n */\nexport interface ValidationStatus {\n /**\n * True if the form is valid, false otherwise\n *\n * If the form is invalid, any errors can be found on the `errors` property\n */\n valid: boolean;\n\n /**\n * List of validation errors\n */\n errors?: FormError[];\n}\n\n/**\n * @public\n */\nexport interface FormError {\n /**\n * Name of the error\n */\n name: string;\n\n /**\n * Params of the error\n */\n params?: unknown;\n\n /**\n * Name of the invalid property\n */\n property: string;\n\n /**\n * Path to the property within the schema\n */\n schemaPath: string;\n\n /**\n * String describing the error\n */\n message: string;\n}\n\n/**\n * @public\n */\nexport type ValidationError = {\n /**\n * Name of the field the error belongs to\n */\n [key: string]: string[] | ValidationError;\n};\n\n/**\n * @public\n */\nexport interface FormComponent<T = any> {\n /**\n * The value of the current property\n */\n value: T;\n\n /**\n * Whether or not the current property is required\n */\n required?: boolean;\n\n /**\n * Whether or not the current property is readonly\n */\n readonly?: boolean;\n\n /**\n * Whether or not the current property is disabled\n */\n disabled?: boolean;\n\n /**\n * The label of the current property\n */\n label?: string;\n\n /**\n * The helper text for the current property\n */\n helperText?: string;\n\n /**\n * Additional contextual information about the form\n */\n formInfo?: FormInfo;\n\n /**\n * The event to emit when the value of the current property has changed\n */\n change: EventEmitter<T>;\n}\n\n/**\n * @public\n */\nexport interface FormInfo {\n /**\n * The schema of the current property\n */\n schema?: object;\n\n /**\n * The schema of the whole form\n */\n rootSchema?: object;\n\n /**\n * A tree of errors for this property and its children\n */\n errorSchema?: object;\n\n /**\n * The value of the whole form\n */\n rootValue?: any;\n\n /**\n * The name of the current property\n */\n name?: string;\n\n /**\n * Path to the property within the schema\n */\n schemaPath?: string[];\n}\n\n/**\n * Lime elements specific options that can be specified under the `lime` key in\n * a schema, e.g.\n *\n * ```ts\n * const schema = {\n * type: 'object',\n * lime: {\n * collapsible: true,\n * },\n * };\n * ```\n *\n * @public\n */\nexport interface LimeSchemaOptions {\n /**\n * When specified on an object it will render all sub components inside a\n * collapsible section\n */\n collapsible?: boolean;\n\n /**\n * When `collapsible` is `true`, set this to `false` to make the\n * collapsible section load in the open state.\n * Defaults to `true`.\n */\n collapsed?: boolean;\n\n /**\n * Will render the field using the specified component. The component\n * should implement the `FormComponent` interface\n */\n component?: FormComponentOptions;\n\n /**\n * When specified on an object it will render the sub components with the\n * specified layout\n */\n layout?: FormLayoutOptions<any>;\n\n /**\n * Mark the field as disabled\n */\n disabled?: boolean;\n\n help?: string | Help;\n}\n\n/**\n * Options for a component to be rendered inside a form\n *\n * @public\n */\nexport interface FormComponentOptions {\n /**\n * Name of the component\n */\n name?: string;\n\n /**\n * Extra properties to give the component in addition to the properties\n * specified on the `FormComponent` interface\n */\n props?: Record<string, any>;\n}\n\n/**\n * @public\n */\nexport interface FormLayoutOptions<T = FormLayoutType.Default> {\n /**\n * The type of layout to use\n */\n type: T;\n}\n\n/**\n * @public\n */\nexport interface GridLayoutOptions\n extends FormLayoutOptions<FormLayoutType.Grid> {\n /**\n * When specified on a component within the grid, the component will take\n * up the the specified number of columns in the form\n */\n // eslint-disable-next-line no-magic-numbers\n colSpan?: 1 | 2 | 3 | 4 | 5 | 'all';\n\n /**\n * When specified on a component within the grid, the component will take\n * up the the specified number of rows in the form\n */\n rowSpan?: number;\n\n /**\n * Number of columns to use in the layout\n */\n // eslint-disable-next-line no-magic-numbers\n columns?: 1 | 2 | 3 | 4 | 5;\n\n /**\n * Attempts to fill in holes earlier in the grid, if smaller items come up\n * later. This may cause items to appear out-of-order, when doing so would\n * fill holes left by larger items. Defaults to `true`.\n */\n dense?: boolean;\n}\n\n/**\n * @public\n */\nexport interface RowLayoutOptions\n extends FormLayoutOptions<FormLayoutType.Row> {\n /**\n * When specified on a field, the chosen icon will be displayed\n * on the left side of the row, beside the title.\n */\n icon?: string;\n}\n\n/**\n * @public\n */\nexport enum FormLayoutType {\n /**\n * The default layout\n */\n Default = 'default',\n\n /**\n * Render the form fields using a responsive grid layout\n */\n Grid = 'grid',\n\n /**\n * Render the form fields in full-width rows.\n * Each row can have a leading `icon`, and a field.\n * `title` and `description` provided by the schema will be placed\n * on the row itself, and not on the field.\n * This layout is good for creating UIs for user settings pages.\n */\n Row = 'row',\n}\n"],"mappings":"IAwQYA,GAAZ,SAAYA,GAIRA,EAAA,qBAKAA,EAAA,eASAA,EAAA,YACH,EAnBD,CAAYA,MAAc,Y"}
|