@unicef-polymer/etools-form-builder 0.1.23 → 1.0.0-rc.2
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/form-attachments-popup/form-attachments-popup.d.ts +1 -1
- package/dist/form-fields/base-field.d.ts +1 -1
- package/dist/form-fields/base-field.js +2 -4
- package/dist/form-fields/scale-field.js +1 -3
- package/dist/form-groups/form-abstract-group.d.ts +2 -2
- package/dist/form-groups/form-abstract-group.js +2 -4
- package/dist/form-groups/form-card.d.ts +5 -5
- package/dist/form-groups/form-card.js +1 -1
- package/dist/form-groups/form-collapsed-card.js +2 -6
- package/dist/lib/styles/form-builder-card.styles.js +5 -0
- package/package.json +8 -8
|
@@ -42,11 +42,11 @@ export declare class FormAttachmentsPopup extends LitElement {
|
|
|
42
42
|
saveBtnClicked: boolean;
|
|
43
43
|
attachments: StoredAttachment[];
|
|
44
44
|
metadata: BlueprintMetadata;
|
|
45
|
+
link: HTMLLinkElement;
|
|
45
46
|
readonly: boolean;
|
|
46
47
|
popupTitle: string;
|
|
47
48
|
computedPath: string[];
|
|
48
49
|
errors: GenericObject;
|
|
49
|
-
link: HTMLLinkElement;
|
|
50
50
|
/**
|
|
51
51
|
* Array of offline saved fileIds that was remove from popup.
|
|
52
52
|
* We need to remove them from IDB but only after confirm button click
|
|
@@ -5,10 +5,10 @@ export declare abstract class BaseField<T> extends LitElement {
|
|
|
5
5
|
isReadonly: boolean;
|
|
6
6
|
required: boolean;
|
|
7
7
|
value: T | null;
|
|
8
|
+
protected _errorMessage: string | null;
|
|
8
9
|
validators: FieldValidator[];
|
|
9
10
|
set errorMessage(message: string | null);
|
|
10
11
|
get errorMessage(): string | null;
|
|
11
|
-
protected _errorMessage: string | null;
|
|
12
12
|
protected render(): TemplateResult;
|
|
13
13
|
protected questionTemplate(): TemplateResult;
|
|
14
14
|
protected valueChanged(newValue: T): void;
|
|
@@ -15,8 +15,8 @@ export class BaseField extends LitElement {
|
|
|
15
15
|
this.isReadonly = false;
|
|
16
16
|
this.required = false;
|
|
17
17
|
this.value = null;
|
|
18
|
-
this.validators = [];
|
|
19
18
|
this._errorMessage = null;
|
|
19
|
+
this.validators = [];
|
|
20
20
|
}
|
|
21
21
|
set errorMessage(message) {
|
|
22
22
|
this._errorMessage = message;
|
|
@@ -33,9 +33,7 @@ export class BaseField extends LitElement {
|
|
|
33
33
|
`;
|
|
34
34
|
}
|
|
35
35
|
questionTemplate() {
|
|
36
|
-
return html `
|
|
37
|
-
<span class="question-text">${this.questionText}</span>
|
|
38
|
-
`;
|
|
36
|
+
return html ` <span class="question-text">${this.questionText}</span> `;
|
|
39
37
|
}
|
|
40
38
|
valueChanged(newValue) {
|
|
41
39
|
this.validateField(newValue);
|
|
@@ -25,9 +25,7 @@ export class ScaleField extends BaseField {
|
|
|
25
25
|
@iron-select="${({ detail }) => this.onSelect(detail.item)}"
|
|
26
26
|
>
|
|
27
27
|
${repeat(this.options, (option) => html `
|
|
28
|
-
<paper-radio-button class="radio-button" name="${option.value}">
|
|
29
|
-
${option.label}
|
|
30
|
-
</paper-radio-button>
|
|
28
|
+
<paper-radio-button class="radio-button" name="${option.value}"> ${option.label} </paper-radio-button>
|
|
31
29
|
`)}
|
|
32
30
|
</paper-radio-group>
|
|
33
31
|
|
|
@@ -29,6 +29,8 @@ export declare class FormAbstractGroup extends LitElement implements IFormBuilde
|
|
|
29
29
|
metadata: BlueprintMetadata;
|
|
30
30
|
parentGroupName: string;
|
|
31
31
|
readonly: boolean;
|
|
32
|
+
protected _errors: GenericObject;
|
|
33
|
+
protected _value: GenericObject;
|
|
32
34
|
computedPath: string[];
|
|
33
35
|
/**
|
|
34
36
|
* Make value property immutable
|
|
@@ -44,8 +46,6 @@ export declare class FormAbstractGroup extends LitElement implements IFormBuilde
|
|
|
44
46
|
* @param errors
|
|
45
47
|
*/
|
|
46
48
|
set errors(errors: GenericObject | string[] | null);
|
|
47
|
-
protected _errors: GenericObject;
|
|
48
|
-
protected _value: GenericObject;
|
|
49
49
|
render(): TemplateResult;
|
|
50
50
|
renderChild(child: BlueprintGroup | BlueprintField): TemplateResult;
|
|
51
51
|
renderField(blueprintField: BlueprintField): TemplateResult;
|
|
@@ -42,9 +42,9 @@ export class FormAbstractGroup extends LitElement {
|
|
|
42
42
|
super(...arguments);
|
|
43
43
|
this.parentGroupName = '';
|
|
44
44
|
this.readonly = true;
|
|
45
|
-
this.computedPath = [];
|
|
46
45
|
this._errors = {};
|
|
47
46
|
this._value = {};
|
|
47
|
+
this.computedPath = [];
|
|
48
48
|
}
|
|
49
49
|
/**
|
|
50
50
|
* Make value property immutable
|
|
@@ -97,9 +97,7 @@ export class FormAbstractGroup extends LitElement {
|
|
|
97
97
|
const isAdditional = blueprintField.styling.includes(StructureTypes.ADDITIONAL);
|
|
98
98
|
if (isWide) {
|
|
99
99
|
return html `
|
|
100
|
-
<div class="${isAdditional ? 'additional-field' : ''}">
|
|
101
|
-
${this.renderWideField(blueprintField)}
|
|
102
|
-
</div>
|
|
100
|
+
<div class="${isAdditional ? 'additional-field' : ''}">${this.renderWideField(blueprintField)}</div>
|
|
103
101
|
`;
|
|
104
102
|
}
|
|
105
103
|
else {
|
|
@@ -4,6 +4,11 @@ import { FormAbstractGroup } from './form-abstract-group';
|
|
|
4
4
|
import { GenericObject } from '../lib/types/global.types';
|
|
5
5
|
import '@polymer/iron-collapse';
|
|
6
6
|
export declare class FormCard extends FormAbstractGroup implements IFormBuilderCard {
|
|
7
|
+
protected _value: GenericObject;
|
|
8
|
+
/**
|
|
9
|
+
* Show save button only if value was changed by user
|
|
10
|
+
*/
|
|
11
|
+
private showSaveButton;
|
|
7
12
|
/**
|
|
8
13
|
* Overrides value property. Saves originalValue.
|
|
9
14
|
* We need to update inner _value only if it wasn't change
|
|
@@ -11,12 +16,7 @@ export declare class FormCard extends FormAbstractGroup implements IFormBuilderC
|
|
|
11
16
|
*/
|
|
12
17
|
set value(value: GenericObject);
|
|
13
18
|
get value(): GenericObject;
|
|
14
|
-
protected _value: GenericObject;
|
|
15
19
|
protected originalValue: GenericObject;
|
|
16
|
-
/**
|
|
17
|
-
* Show save button only if value was changed by user
|
|
18
|
-
*/
|
|
19
|
-
private showSaveButton;
|
|
20
20
|
/**
|
|
21
21
|
* Extends parent render method,
|
|
22
22
|
* adds card-container html wrapper and dynamic save button
|
|
@@ -13,11 +13,11 @@ export class FormCard extends FormAbstractGroup {
|
|
|
13
13
|
constructor() {
|
|
14
14
|
super(...arguments);
|
|
15
15
|
this._value = {};
|
|
16
|
-
this.originalValue = {};
|
|
17
16
|
/**
|
|
18
17
|
* Show save button only if value was changed by user
|
|
19
18
|
*/
|
|
20
19
|
this.showSaveButton = false;
|
|
20
|
+
this.originalValue = {};
|
|
21
21
|
}
|
|
22
22
|
/**
|
|
23
23
|
* Overrides value property. Saves originalValue.
|
|
@@ -81,12 +81,8 @@ export class FormCollapsedCard extends FormAbstractGroup {
|
|
|
81
81
|
@cancel="${() => this.cancelEdit()}"
|
|
82
82
|
>
|
|
83
83
|
<!-- Open Attachments popup button -->
|
|
84
|
-
<div slot="actions" class="layout horizontal center">
|
|
85
|
-
|
|
86
|
-
</div>
|
|
87
|
-
<div slot="content">
|
|
88
|
-
${this.renderGroupChildren()}
|
|
89
|
-
</div>
|
|
84
|
+
<div slot="actions" class="layout horizontal center">${this.getAdditionalButtons()}</div>
|
|
85
|
+
<div slot="content">${this.renderGroupChildren()}</div>
|
|
90
86
|
</etools-fb-card>
|
|
91
87
|
</section>
|
|
92
88
|
`;
|
|
@@ -15,6 +15,11 @@ export const FormBuilderCardStyles = css `
|
|
|
15
15
|
color: var(--primary-color);
|
|
16
16
|
font-weight: 500;
|
|
17
17
|
}
|
|
18
|
+
.attachments-button:focus {
|
|
19
|
+
outline: 0;
|
|
20
|
+
box-shadow: 0 0 5px 5px rgb(170 165 165 / 20%);
|
|
21
|
+
background-color: rgba(170, 165, 165, 0.2);
|
|
22
|
+
}
|
|
18
23
|
.attachments-button iron-icon {
|
|
19
24
|
margin-right: 8px;
|
|
20
25
|
}
|
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": "0.
|
|
4
|
+
"version": "1.0.0-rc.2",
|
|
5
5
|
"contributors": [
|
|
6
6
|
"eTools Team"
|
|
7
7
|
],
|
|
@@ -14,9 +14,9 @@
|
|
|
14
14
|
],
|
|
15
15
|
"scripts": {
|
|
16
16
|
"build": "tsc --skipLibCheck",
|
|
17
|
-
"lint": "
|
|
17
|
+
"lint": "eslint src/",
|
|
18
18
|
"prepare": "rm -rf ./dist && npm run build",
|
|
19
|
-
"
|
|
19
|
+
"prepublishOnly": "npm run lint"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"@polymer/iron-collapse": "^3.0.1",
|
|
@@ -27,12 +27,12 @@
|
|
|
27
27
|
"@polymer/paper-radio-group": "^3.0.1",
|
|
28
28
|
"@polymer/paper-toast": "^3.0.1",
|
|
29
29
|
"@types/ramda": "^0.26.43",
|
|
30
|
-
"@unicef-polymer/etools-dialog": "
|
|
31
|
-
"@unicef-polymer/etools-dropdown": "^3.
|
|
30
|
+
"@unicef-polymer/etools-dialog": "5.0.0-rc.2",
|
|
31
|
+
"@unicef-polymer/etools-dropdown": "^3.7.6",
|
|
32
32
|
"@unicef-polymer/etools-upload": "^3.5.0",
|
|
33
|
-
"@webcomponents/webcomponentsjs": "^2.
|
|
33
|
+
"@webcomponents/webcomponentsjs": "^2.6.0",
|
|
34
34
|
"lit-element": "^2.4.0",
|
|
35
|
-
"lit-translate": "^1.1
|
|
35
|
+
"lit-translate": "^1.2.1",
|
|
36
36
|
"ramda": "^0.27.1",
|
|
37
37
|
"web-animations-js": "^2.3.2"
|
|
38
38
|
},
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"eslint-plugin-lit": "^1.2.4",
|
|
47
47
|
"eslint-plugin-prettier": "^3.1.3",
|
|
48
48
|
"minimist": ">=0.2.1",
|
|
49
|
-
"prettier": "
|
|
49
|
+
"prettier": "~2.2.0",
|
|
50
50
|
"typescript": "^3.9.7"
|
|
51
51
|
}
|
|
52
52
|
}
|