@limetech/lime-elements 40.22.0 → 40.23.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 +7 -0
- package/dist/cjs/lime-elements.cjs.js +1 -1
- package/dist/cjs/limel-form.cjs.entry.js +202 -15
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/components/form/filled-defaults.js +132 -0
- package/dist/collection/components/form/form.js +93 -15
- package/dist/collection/components/form/form.test-schemas.js +50 -0
- package/dist/esm/lime-elements.js +1 -1
- package/dist/esm/limel-form.entry.js +202 -15
- package/dist/esm/loader.js +1 -1
- package/dist/lime-elements/lime-elements.esm.js +1 -1
- package/dist/lime-elements/{p-9b2623fe.entry.js → p-f71fbc9e.entry.js} +1 -1
- package/dist/types/components/form/filled-defaults.d.ts +12 -0
- package/dist/types/components/form/form.d.ts +17 -0
- package/dist/types/components/form/form.test-schemas.d.ts +2 -0
- package/dist/types/components.d.ts +15 -0
- package/package.json +3 -3
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The value without the defaults that were filled into the value the form was
|
|
3
|
+
* given, as long as they still hold their default. A default the user changed
|
|
4
|
+
* stays, and so do the defaults of what the user added, such as a list item.
|
|
5
|
+
*
|
|
6
|
+
* @param value - the value the form holds, with the defaults filled in
|
|
7
|
+
* @param filled - the value the form was given, with the defaults filled in
|
|
8
|
+
* @param given - the value the form was given
|
|
9
|
+
* @returns the value without the defaults that were filled in
|
|
10
|
+
*/
|
|
11
|
+
export declare function withoutFilledDefaults(value: unknown, filled: unknown, given: unknown): unknown;
|
|
12
|
+
//# sourceMappingURL=filled-defaults.d.ts.map
|
|
@@ -21,6 +21,7 @@ import { HeadingLevel } from '../../global/shared-types/heading-level.types';
|
|
|
21
21
|
* @exampleComponent limel-example-code-editor-form
|
|
22
22
|
* @exampleComponent limel-example-form-highlighted-field
|
|
23
23
|
* @exampleComponent limel-example-form-heading-level
|
|
24
|
+
* @exampleComponent limel-example-form-include-defaults
|
|
24
25
|
*/
|
|
25
26
|
export declare class Form {
|
|
26
27
|
/**
|
|
@@ -72,6 +73,18 @@ export declare class Form {
|
|
|
72
73
|
* which keeps untouched required-empty fields silent.
|
|
73
74
|
*/
|
|
74
75
|
revealErrors: boolean;
|
|
76
|
+
/**
|
|
77
|
+
* Set to `false` to leave the defaults of the schema out of the value,
|
|
78
|
+
* so that it stays as it was given until the user changes something. The
|
|
79
|
+
* form still shows the defaults. A default the user changes is in the
|
|
80
|
+
* value from then on, and so are the defaults that a change brings in,
|
|
81
|
+
* such as those of a new list item or of fields that depend on the
|
|
82
|
+
* changed one. Pass the value the form emits back in as `value`.
|
|
83
|
+
* The form validates what it shows, defaults included. When the user
|
|
84
|
+
* changes everything back, the value is what the form was given, also
|
|
85
|
+
* when that is `null` or `undefined`.
|
|
86
|
+
*/
|
|
87
|
+
includeDefaults: boolean;
|
|
75
88
|
/**
|
|
76
89
|
* The path in the value of a field to take the user to, such as
|
|
77
90
|
* `['heroes', 2, 'name']`. When it changes, the form opens the sections
|
|
@@ -95,11 +108,14 @@ export declare class Form {
|
|
|
95
108
|
validate: EventEmitter<ValidationStatus>;
|
|
96
109
|
private host;
|
|
97
110
|
private isValid;
|
|
111
|
+
private currentValue;
|
|
112
|
+
private givenValue?;
|
|
98
113
|
private root;
|
|
99
114
|
private initialized;
|
|
100
115
|
constructor();
|
|
101
116
|
connectedCallback(): void;
|
|
102
117
|
componentWillLoad(): void;
|
|
118
|
+
protected handleValueChange(): void;
|
|
103
119
|
componentDidLoad(): void;
|
|
104
120
|
protected handleHeadingLevelChange(): void;
|
|
105
121
|
private warnIfHeadingLevelIsInvalid;
|
|
@@ -112,6 +128,7 @@ export declare class Form {
|
|
|
112
128
|
private showHighlightedField;
|
|
113
129
|
private get rootElement();
|
|
114
130
|
private handleChange;
|
|
131
|
+
private getGivenValue;
|
|
115
132
|
private validateFormData;
|
|
116
133
|
/**
|
|
117
134
|
* Returns a copy of the schema with `$id` replaced by a content-based
|
|
@@ -56,4 +56,6 @@ export declare const untitledRootSchema: FormSchema;
|
|
|
56
56
|
export declare const nestedCollapsibleSchema: FormSchema;
|
|
57
57
|
export declare const untitledCollapsibleSchema: FormSchema;
|
|
58
58
|
export declare const untitledRowSchema: FormSchema;
|
|
59
|
+
export declare const dependencyWithDefaultsSchema: FormSchema;
|
|
60
|
+
export declare const dependencyWithChangingDefaultSchema: FormSchema;
|
|
59
61
|
//# sourceMappingURL=form.test-schemas.d.ts.map
|
|
@@ -1924,6 +1924,7 @@ export namespace Components {
|
|
|
1924
1924
|
* @exampleComponent limel-example-code-editor-form
|
|
1925
1925
|
* @exampleComponent limel-example-form-highlighted-field
|
|
1926
1926
|
* @exampleComponent limel-example-form-heading-level
|
|
1927
|
+
* @exampleComponent limel-example-form-include-defaults
|
|
1927
1928
|
*/
|
|
1928
1929
|
interface LimelForm {
|
|
1929
1930
|
/**
|
|
@@ -1945,6 +1946,11 @@ export namespace Components {
|
|
|
1945
1946
|
* @beta
|
|
1946
1947
|
*/
|
|
1947
1948
|
"highlightedField"?: Array<string | number>;
|
|
1949
|
+
/**
|
|
1950
|
+
* Set to `false` to leave the defaults of the schema out of the value, so that it stays as it was given until the user changes something. The form still shows the defaults. A default the user changes is in the value from then on, and so are the defaults that a change brings in, such as those of a new list item or of fields that depend on the changed one. Pass the value the form emits back in as `value`. The form validates what it shows, defaults included. When the user changes everything back, the value is what the form was given, also when that is `null` or `undefined`.
|
|
1951
|
+
* @default true
|
|
1952
|
+
*/
|
|
1953
|
+
"includeDefaults": boolean;
|
|
1948
1954
|
/**
|
|
1949
1955
|
* 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.
|
|
1950
1956
|
*/
|
|
@@ -5784,6 +5790,7 @@ declare global {
|
|
|
5784
5790
|
* @exampleComponent limel-example-code-editor-form
|
|
5785
5791
|
* @exampleComponent limel-example-form-highlighted-field
|
|
5786
5792
|
* @exampleComponent limel-example-form-heading-level
|
|
5793
|
+
* @exampleComponent limel-example-form-include-defaults
|
|
5787
5794
|
*/
|
|
5788
5795
|
interface HTMLLimelFormElement extends Components.LimelForm, HTMLStencilElement {
|
|
5789
5796
|
addEventListener<K extends keyof HTMLLimelFormElementEventMap>(type: K, listener: (this: HTMLLimelFormElement, ev: LimelFormCustomEvent<HTMLLimelFormElementEventMap[K]>) => any, options?: boolean | AddEventListenerOptions): void;
|
|
@@ -9284,6 +9291,7 @@ declare namespace LocalJSX {
|
|
|
9284
9291
|
* @exampleComponent limel-example-code-editor-form
|
|
9285
9292
|
* @exampleComponent limel-example-form-highlighted-field
|
|
9286
9293
|
* @exampleComponent limel-example-form-heading-level
|
|
9294
|
+
* @exampleComponent limel-example-form-include-defaults
|
|
9287
9295
|
*/
|
|
9288
9296
|
interface LimelForm {
|
|
9289
9297
|
/**
|
|
@@ -9305,6 +9313,11 @@ declare namespace LocalJSX {
|
|
|
9305
9313
|
* @beta
|
|
9306
9314
|
*/
|
|
9307
9315
|
"highlightedField"?: Array<string | number>;
|
|
9316
|
+
/**
|
|
9317
|
+
* Set to `false` to leave the defaults of the schema out of the value, so that it stays as it was given until the user changes something. The form still shows the defaults. A default the user changes is in the value from then on, and so are the defaults that a change brings in, such as those of a new list item or of fields that depend on the changed one. Pass the value the form emits back in as `value`. The form validates what it shows, defaults included. When the user changes everything back, the value is what the form was given, also when that is `null` or `undefined`.
|
|
9318
|
+
* @default true
|
|
9319
|
+
*/
|
|
9320
|
+
"includeDefaults"?: boolean;
|
|
9308
9321
|
/**
|
|
9309
9322
|
* Emitted when a change is made within the form
|
|
9310
9323
|
*/
|
|
@@ -12319,6 +12332,7 @@ declare namespace LocalJSX {
|
|
|
12319
12332
|
"disabled": boolean;
|
|
12320
12333
|
"headingLevel": HeadingLevel;
|
|
12321
12334
|
"revealErrors": boolean;
|
|
12335
|
+
"includeDefaults": boolean;
|
|
12322
12336
|
}
|
|
12323
12337
|
interface LimelFormHeaderAttributes {
|
|
12324
12338
|
"heading": string;
|
|
@@ -13445,6 +13459,7 @@ declare module "@stencil/core" {
|
|
|
13445
13459
|
* @exampleComponent limel-example-code-editor-form
|
|
13446
13460
|
* @exampleComponent limel-example-form-highlighted-field
|
|
13447
13461
|
* @exampleComponent limel-example-form-heading-level
|
|
13462
|
+
* @exampleComponent limel-example-form-include-defaults
|
|
13448
13463
|
*/
|
|
13449
13464
|
"limel-form": LocalJSX.IntrinsicElements["limel-form"] & JSXBase.HTMLAttributes<HTMLLimelFormElement>;
|
|
13450
13465
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@limetech/lime-elements",
|
|
3
|
-
"version": "40.
|
|
3
|
+
"version": "40.23.0",
|
|
4
4
|
"description": "Lime Elements",
|
|
5
5
|
"author": "Lime Technologies",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -77,9 +77,9 @@
|
|
|
77
77
|
"dayjs": "^1.11.23",
|
|
78
78
|
"diff": "^9.0.0",
|
|
79
79
|
"echarts": "^6.1.0",
|
|
80
|
-
"eslint": "^10.
|
|
80
|
+
"eslint": "^10.14.0",
|
|
81
81
|
"flatpickr": "^4.6.13",
|
|
82
|
-
"glob": "^
|
|
82
|
+
"glob": "^14.0.3",
|
|
83
83
|
"globals": "^17.13.0",
|
|
84
84
|
"hast-util-from-dom": "^5.0.1",
|
|
85
85
|
"hast-util-to-mdast": "^10.1.2",
|