@unicef-polymer/etools-form-builder 3.1.5 → 3.1.6
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.
|
@@ -3,6 +3,7 @@ import { css, html, LitElement } from 'lit';
|
|
|
3
3
|
import { property } from 'lit/decorators.js';
|
|
4
4
|
import { validate } from '../lib/utils/validations.helper';
|
|
5
5
|
import { FlexLayoutClasses } from '../lib/styles/flex-layout-classes';
|
|
6
|
+
import { fireEvent } from '../lib/utils/fire-custom-event';
|
|
6
7
|
/**
|
|
7
8
|
* Class that contains common properties and methods for single and repeatable fields
|
|
8
9
|
*/
|
|
@@ -10,6 +11,7 @@ export class AbstractFieldBaseClass extends LitElement {
|
|
|
10
11
|
set isReadonly(readonly) {
|
|
11
12
|
this._readonly = readonly;
|
|
12
13
|
this.setDefaultValue(readonly, this._defaultValue);
|
|
14
|
+
fireEvent(this, 'readonly-changed', { value: readonly });
|
|
13
15
|
this.requestUpdate();
|
|
14
16
|
}
|
|
15
17
|
get isReadonly() {
|
|
@@ -5,6 +5,9 @@ import '../../rich-editor/rich-text';
|
|
|
5
5
|
export declare class TextField extends BaseField<string> {
|
|
6
6
|
protected originalValue: string | null;
|
|
7
7
|
protected controlTemplate(): TemplateResult;
|
|
8
|
+
connectedCallback(): void;
|
|
9
|
+
disconnectedCallback(): void;
|
|
10
|
+
handleReadonlyChange(_e: CustomEvent): void;
|
|
8
11
|
updated(changedProperties: PropertyValues): void;
|
|
9
12
|
protected customValidation(): string | null;
|
|
10
13
|
static get styles(): CSSResultArray;
|
|
@@ -39,6 +39,20 @@ let TextField = class TextField extends BaseField {
|
|
|
39
39
|
</etools-textarea>
|
|
40
40
|
`;
|
|
41
41
|
}
|
|
42
|
+
connectedCallback() {
|
|
43
|
+
super.connectedCallback();
|
|
44
|
+
document.addEventListener('readonly-changed', this.handleReadonlyChange.bind(this));
|
|
45
|
+
}
|
|
46
|
+
disconnectedCallback() {
|
|
47
|
+
super.disconnectedCallback();
|
|
48
|
+
document.removeEventListener('readonly-changed', this.handleReadonlyChange.bind(this));
|
|
49
|
+
}
|
|
50
|
+
handleReadonlyChange(_e) {
|
|
51
|
+
// for rich editor need to reset the value here because of the logic below
|
|
52
|
+
if (this.showRichEditor && this.originalValue !== this.value) {
|
|
53
|
+
this.originalValue = this.value;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
42
56
|
updated(changedProperties) {
|
|
43
57
|
super.updated(changedProperties);
|
|
44
58
|
// set control value only at the beginning with a proxy param (originalValue),
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unicef-polymer/etools-form-builder",
|
|
3
3
|
"description": "Etools FM Form Builder components",
|
|
4
|
-
"version": "3.1.
|
|
4
|
+
"version": "3.1.6",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"contributors": [
|
|
7
7
|
"eTools Team"
|
|
@@ -32,14 +32,14 @@
|
|
|
32
32
|
"typescript": "^4.9.5"
|
|
33
33
|
},
|
|
34
34
|
"peerDependencies": {
|
|
35
|
-
"@unicef-polymer/etools-unicef": ">=1.2.
|
|
35
|
+
"@unicef-polymer/etools-unicef": ">=1.2.3"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"@eslint/eslintrc": "^3.2.0",
|
|
39
39
|
"@eslint/js": "^9.16.0",
|
|
40
40
|
"@typescript-eslint/eslint-plugin": "^8.17.0",
|
|
41
41
|
"@typescript-eslint/parser": "^8.17.0",
|
|
42
|
-
"@unicef-polymer/etools-unicef": "^1.2.
|
|
42
|
+
"@unicef-polymer/etools-unicef": "^1.2.3",
|
|
43
43
|
"eslint": "^9.16.0",
|
|
44
44
|
"eslint-config-prettier": "^9.1.0",
|
|
45
45
|
"eslint-plugin-html": "^8.1.2",
|