@unicef-polymer/etools-form-builder 2.1.0 → 2.1.1
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/LICENSE +674 -674
- package/README.md +1 -1
- package/dist/form-attachments-popup/form-attachments-popup.d.ts +85 -85
- package/dist/form-attachments-popup/form-attachments-popup.helper.d.ts +8 -8
- package/dist/form-attachments-popup/form-attachments-popup.helper.js +14 -14
- package/dist/form-attachments-popup/form-attachments-popup.js +248 -248
- package/dist/form-attachments-popup/form-attachments-popup.tpl.d.ts +3 -3
- package/dist/form-attachments-popup/form-attachments-popup.tpl.js +89 -89
- package/dist/form-attachments-popup/index.d.ts +2 -2
- package/dist/form-attachments-popup/index.js +2 -2
- package/dist/form-fields/abstract-field-base.class.d.ts +28 -28
- package/dist/form-fields/abstract-field-base.class.js +176 -176
- package/dist/form-fields/field-renderer-component.d.ts +20 -20
- package/dist/form-fields/field-renderer-component.js +249 -249
- package/dist/form-fields/index.d.ts +12 -12
- package/dist/form-fields/index.js +12 -12
- package/dist/form-fields/repeatable-fields/repeatable-attachment-field.d.ts +17 -17
- package/dist/form-fields/repeatable-fields/repeatable-attachment-field.js +208 -208
- package/dist/form-fields/repeatable-fields/repeatable-base-field.d.ts +20 -20
- package/dist/form-fields/repeatable-fields/repeatable-base-field.js +123 -123
- package/dist/form-fields/repeatable-fields/repeatable-number-field.d.ts +10 -10
- package/dist/form-fields/repeatable-fields/repeatable-number-field.js +66 -66
- package/dist/form-fields/repeatable-fields/repeatable-scale-field.d.ts +15 -15
- package/dist/form-fields/repeatable-fields/repeatable-scale-field.js +108 -108
- package/dist/form-fields/repeatable-fields/repeatable-text-field.d.ts +8 -8
- package/dist/form-fields/repeatable-fields/repeatable-text-field.js +53 -53
- package/dist/form-fields/single-fields/attachment-field.d.ts +16 -16
- package/dist/form-fields/single-fields/attachment-field.js +97 -97
- package/dist/form-fields/single-fields/base-field.d.ts +11 -11
- package/dist/form-fields/single-fields/base-field.js +57 -57
- package/dist/form-fields/single-fields/boolean-field.d.ts +8 -8
- package/dist/form-fields/single-fields/boolean-field.js +49 -49
- package/dist/form-fields/single-fields/number-field.d.ts +10 -10
- package/dist/form-fields/single-fields/number-field.js +66 -66
- package/dist/form-fields/single-fields/scale-field.d.ts +18 -18
- package/dist/form-fields/single-fields/scale-field.js +107 -107
- package/dist/form-fields/single-fields/text-field.d.ts +8 -8
- package/dist/form-fields/single-fields/text-field.js +54 -54
- package/dist/form-groups/form-abstract-group.d.ts +60 -60
- package/dist/form-groups/form-abstract-group.js +353 -353
- package/dist/form-groups/form-card.d.ts +32 -32
- package/dist/form-groups/form-card.js +108 -108
- package/dist/form-groups/form-collapsed-card.d.ts +70 -70
- package/dist/form-groups/form-collapsed-card.js +253 -253
- package/dist/form-groups/index.d.ts +3 -3
- package/dist/form-groups/index.js +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +3 -3
- package/dist/lib/additional-components/confirmation-dialog.d.ts +16 -16
- package/dist/lib/additional-components/confirmation-dialog.js +65 -65
- package/dist/lib/additional-components/etools-fb-card.d.ts +16 -16
- package/dist/lib/additional-components/etools-fb-card.js +215 -215
- package/dist/lib/styles/attachments.styles.d.ts +2 -2
- package/dist/lib/styles/attachments.styles.js +72 -72
- package/dist/lib/styles/card-styles.d.ts +2 -2
- package/dist/lib/styles/card-styles.js +154 -154
- package/dist/lib/styles/dialog.styles.d.ts +2 -2
- package/dist/lib/styles/dialog.styles.js +85 -85
- package/dist/lib/styles/elevation-styles.d.ts +9 -9
- package/dist/lib/styles/elevation-styles.js +43 -43
- package/dist/lib/styles/flex-layout-classes.d.ts +2 -2
- package/dist/lib/styles/flex-layout-classes.js +319 -319
- package/dist/lib/styles/form-builder-card.styles.d.ts +2 -2
- package/dist/lib/styles/form-builder-card.styles.js +49 -49
- package/dist/lib/styles/input-styles.d.ts +2 -2
- package/dist/lib/styles/input-styles.js +138 -138
- package/dist/lib/styles/page-layout-styles.d.ts +2 -2
- package/dist/lib/styles/page-layout-styles.js +201 -201
- package/dist/lib/styles/shared-styles.d.ts +2 -2
- package/dist/lib/styles/shared-styles.js +70 -70
- package/dist/lib/types/form-builder.interfaces.d.ts +83 -83
- package/dist/lib/types/form-builder.interfaces.js +0 -0
- package/dist/lib/types/form-builder.types.d.ts +59 -59
- package/dist/lib/types/form-builder.types.js +0 -0
- package/dist/lib/types/global.types.d.ts +4 -4
- package/dist/lib/types/global.types.js +0 -0
- package/dist/lib/utils/dialog.d.ts +10 -10
- package/dist/lib/utils/dialog.js +21 -21
- package/dist/lib/utils/fire-custom-event.d.ts +1 -1
- package/dist/lib/utils/fire-custom-event.js +7 -7
- package/dist/lib/utils/validations.helper.d.ts +26 -26
- package/dist/lib/utils/validations.helper.js +35 -35
- package/package.json +56 -56
|
@@ -1,66 +1,66 @@
|
|
|
1
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
-
};
|
|
7
|
-
import { css, customElement, html } from 'lit-element';
|
|
8
|
-
import { BaseField } from './base-field';
|
|
9
|
-
import '@polymer/paper-input/paper-input';
|
|
10
|
-
import { InputStyles } from '../../lib/styles/input-styles';
|
|
11
|
-
let NumberField = class NumberField extends BaseField {
|
|
12
|
-
constructor() {
|
|
13
|
-
super(...arguments);
|
|
14
|
-
this.isInteger = false;
|
|
15
|
-
}
|
|
16
|
-
controlTemplate() {
|
|
17
|
-
return html `
|
|
18
|
-
${InputStyles}
|
|
19
|
-
<paper-input
|
|
20
|
-
class="no-padding-left"
|
|
21
|
-
no-label-float
|
|
22
|
-
placeholder="${this.isReadonly ? '—' : this.placeholder}"
|
|
23
|
-
.value="${this.value}"
|
|
24
|
-
@value-changed="${({ detail }) => this.valueChanged(detail.value)}"
|
|
25
|
-
@focus="${() => (this.touched = true)}"
|
|
26
|
-
placeholder="—"
|
|
27
|
-
?invalid="${this.errorMessage}"
|
|
28
|
-
error-message="${this.errorMessage}"
|
|
29
|
-
?readonly="${this.isReadonly}"
|
|
30
|
-
>
|
|
31
|
-
</paper-input>
|
|
32
|
-
`;
|
|
33
|
-
}
|
|
34
|
-
valueChanged(newValue) {
|
|
35
|
-
const formatted = Number(newValue);
|
|
36
|
-
const isNumber = !isNaN(formatted) && `${newValue}` !== '' && `${newValue}` !== 'null';
|
|
37
|
-
super.valueChanged(isNumber ? formatted : newValue);
|
|
38
|
-
}
|
|
39
|
-
customValidation(value) {
|
|
40
|
-
if (!value) {
|
|
41
|
-
return null;
|
|
42
|
-
}
|
|
43
|
-
if (isNaN(value)) {
|
|
44
|
-
return 'Must be a number';
|
|
45
|
-
}
|
|
46
|
-
const integerValidation = !this.isInteger || value - Math.floor(value) === 0;
|
|
47
|
-
return integerValidation ? null : 'Must be an integer';
|
|
48
|
-
}
|
|
49
|
-
static get styles() {
|
|
50
|
-
// language=CSS
|
|
51
|
-
return [
|
|
52
|
-
...BaseField.styles,
|
|
53
|
-
css `
|
|
54
|
-
@media (max-width: 380px) {
|
|
55
|
-
.no-padding-left {
|
|
56
|
-
padding-left: 0;
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
`
|
|
60
|
-
];
|
|
61
|
-
}
|
|
62
|
-
};
|
|
63
|
-
NumberField = __decorate([
|
|
64
|
-
customElement('number-field')
|
|
65
|
-
], NumberField);
|
|
66
|
-
export { NumberField };
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import { css, customElement, html } from 'lit-element';
|
|
8
|
+
import { BaseField } from './base-field';
|
|
9
|
+
import '@polymer/paper-input/paper-input';
|
|
10
|
+
import { InputStyles } from '../../lib/styles/input-styles';
|
|
11
|
+
let NumberField = class NumberField extends BaseField {
|
|
12
|
+
constructor() {
|
|
13
|
+
super(...arguments);
|
|
14
|
+
this.isInteger = false;
|
|
15
|
+
}
|
|
16
|
+
controlTemplate() {
|
|
17
|
+
return html `
|
|
18
|
+
${InputStyles}
|
|
19
|
+
<paper-input
|
|
20
|
+
class="no-padding-left"
|
|
21
|
+
no-label-float
|
|
22
|
+
placeholder="${this.isReadonly ? '—' : this.placeholder}"
|
|
23
|
+
.value="${this.value}"
|
|
24
|
+
@value-changed="${({ detail }) => this.valueChanged(detail.value)}"
|
|
25
|
+
@focus="${() => (this.touched = true)}"
|
|
26
|
+
placeholder="—"
|
|
27
|
+
?invalid="${this.errorMessage}"
|
|
28
|
+
error-message="${this.errorMessage}"
|
|
29
|
+
?readonly="${this.isReadonly}"
|
|
30
|
+
>
|
|
31
|
+
</paper-input>
|
|
32
|
+
`;
|
|
33
|
+
}
|
|
34
|
+
valueChanged(newValue) {
|
|
35
|
+
const formatted = Number(newValue);
|
|
36
|
+
const isNumber = !isNaN(formatted) && `${newValue}` !== '' && `${newValue}` !== 'null';
|
|
37
|
+
super.valueChanged(isNumber ? formatted : newValue);
|
|
38
|
+
}
|
|
39
|
+
customValidation(value) {
|
|
40
|
+
if (!value) {
|
|
41
|
+
return null;
|
|
42
|
+
}
|
|
43
|
+
if (isNaN(value)) {
|
|
44
|
+
return 'Must be a number';
|
|
45
|
+
}
|
|
46
|
+
const integerValidation = !this.isInteger || value - Math.floor(value) === 0;
|
|
47
|
+
return integerValidation ? null : 'Must be an integer';
|
|
48
|
+
}
|
|
49
|
+
static get styles() {
|
|
50
|
+
// language=CSS
|
|
51
|
+
return [
|
|
52
|
+
...BaseField.styles,
|
|
53
|
+
css `
|
|
54
|
+
@media (max-width: 380px) {
|
|
55
|
+
.no-padding-left {
|
|
56
|
+
padding-left: 0;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
`
|
|
60
|
+
];
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
NumberField = __decorate([
|
|
64
|
+
customElement('number-field')
|
|
65
|
+
], NumberField);
|
|
66
|
+
export { NumberField };
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { TemplateResult, CSSResultArray } from 'lit-element';
|
|
2
|
-
import { BaseField } from './base-field';
|
|
3
|
-
import '@polymer/paper-radio-group/paper-radio-group';
|
|
4
|
-
import '@polymer/paper-radio-button/paper-radio-button';
|
|
5
|
-
import { PaperRadioButtonElement } from '@polymer/paper-radio-button/paper-radio-button';
|
|
6
|
-
export declare type FieldOption = {
|
|
7
|
-
value: any;
|
|
8
|
-
label: string;
|
|
9
|
-
};
|
|
10
|
-
export declare class ScaleField extends BaseField<string | number | null> {
|
|
11
|
-
options: (FieldOption | string | number)[];
|
|
12
|
-
protected controlTemplate(): TemplateResult;
|
|
13
|
-
protected getLabel(option: FieldOption | string | number): unknown;
|
|
14
|
-
protected getValue(option: FieldOption | string | number): unknown;
|
|
15
|
-
protected onSelect(item: PaperRadioButtonElement): void;
|
|
16
|
-
protected customValidation(): string | null;
|
|
17
|
-
static get styles(): CSSResultArray;
|
|
18
|
-
}
|
|
1
|
+
import { TemplateResult, CSSResultArray } from 'lit-element';
|
|
2
|
+
import { BaseField } from './base-field';
|
|
3
|
+
import '@polymer/paper-radio-group/paper-radio-group';
|
|
4
|
+
import '@polymer/paper-radio-button/paper-radio-button';
|
|
5
|
+
import { PaperRadioButtonElement } from '@polymer/paper-radio-button/paper-radio-button';
|
|
6
|
+
export declare type FieldOption = {
|
|
7
|
+
value: any;
|
|
8
|
+
label: string;
|
|
9
|
+
};
|
|
10
|
+
export declare class ScaleField extends BaseField<string | number | null> {
|
|
11
|
+
options: (FieldOption | string | number)[];
|
|
12
|
+
protected controlTemplate(): TemplateResult;
|
|
13
|
+
protected getLabel(option: FieldOption | string | number): unknown;
|
|
14
|
+
protected getValue(option: FieldOption | string | number): unknown;
|
|
15
|
+
protected onSelect(item: PaperRadioButtonElement): void;
|
|
16
|
+
protected customValidation(): string | null;
|
|
17
|
+
static get styles(): CSSResultArray;
|
|
18
|
+
}
|
|
@@ -1,107 +1,107 @@
|
|
|
1
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
-
};
|
|
7
|
-
import { html, property, css, customElement } from 'lit-element';
|
|
8
|
-
import { BaseField } from './base-field';
|
|
9
|
-
import { repeat } from 'lit-html/directives/repeat';
|
|
10
|
-
import '@polymer/paper-radio-group/paper-radio-group';
|
|
11
|
-
import '@polymer/paper-radio-button/paper-radio-button';
|
|
12
|
-
import { InputStyles } from '../../lib/styles/input-styles';
|
|
13
|
-
let ScaleField = class ScaleField extends BaseField {
|
|
14
|
-
constructor() {
|
|
15
|
-
super(...arguments);
|
|
16
|
-
this.options = [];
|
|
17
|
-
}
|
|
18
|
-
controlTemplate() {
|
|
19
|
-
return html `
|
|
20
|
-
${InputStyles}
|
|
21
|
-
<div class="container">
|
|
22
|
-
<paper-radio-group
|
|
23
|
-
class="radio-group"
|
|
24
|
-
selected="${this.value}"
|
|
25
|
-
@iron-select="${({ detail }) => this.onSelect(detail.item)}"
|
|
26
|
-
>
|
|
27
|
-
${repeat(this.options, (option) => html `
|
|
28
|
-
<paper-radio-button class="radio-button" name="${this.getValue(option)}">
|
|
29
|
-
${this.getLabel(option)}
|
|
30
|
-
</paper-radio-button>
|
|
31
|
-
`)}
|
|
32
|
-
</paper-radio-group>
|
|
33
|
-
|
|
34
|
-
<paper-button ?hidden="${this.isReadonly}" @click="${() => this.valueChanged(null)}" class="clear-button">
|
|
35
|
-
<iron-icon icon="clear"></iron-icon>Clear
|
|
36
|
-
</paper-button>
|
|
37
|
-
</div>
|
|
38
|
-
<div ?hidden="${!this.errorMessage}" class="error-text">${this.errorMessage}</div>
|
|
39
|
-
`;
|
|
40
|
-
}
|
|
41
|
-
getLabel(option) {
|
|
42
|
-
return typeof option === 'object' ? option.label : option;
|
|
43
|
-
}
|
|
44
|
-
getValue(option) {
|
|
45
|
-
return typeof option === 'object' ? option.value : option;
|
|
46
|
-
}
|
|
47
|
-
onSelect(item) {
|
|
48
|
-
const newValue = item.get('name');
|
|
49
|
-
if (newValue !== this.value) {
|
|
50
|
-
this.touched = true;
|
|
51
|
-
}
|
|
52
|
-
this.valueChanged(newValue);
|
|
53
|
-
}
|
|
54
|
-
customValidation() {
|
|
55
|
-
return null;
|
|
56
|
-
}
|
|
57
|
-
static get styles() {
|
|
58
|
-
// language=CSS
|
|
59
|
-
return [
|
|
60
|
-
...BaseField.styles,
|
|
61
|
-
css `
|
|
62
|
-
.container {
|
|
63
|
-
position: relative;
|
|
64
|
-
min-height: 48px;
|
|
65
|
-
display: flex;
|
|
66
|
-
align-items: center;
|
|
67
|
-
flex-direction: row;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
.radio-group {
|
|
71
|
-
display: flex;
|
|
72
|
-
flex-direction: row;
|
|
73
|
-
flex-wrap: wrap;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
:host([is-readonly]) paper-radio-group {
|
|
77
|
-
pointer-events: none;
|
|
78
|
-
opacity: 0.55;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
@media (max-width: 1080px) {
|
|
82
|
-
.container {
|
|
83
|
-
flex-direction: column;
|
|
84
|
-
align-items: flex-start;
|
|
85
|
-
}
|
|
86
|
-
.radio-group {
|
|
87
|
-
flex-direction: column;
|
|
88
|
-
}
|
|
89
|
-
.radio-button {
|
|
90
|
-
padding-left: 3px;
|
|
91
|
-
}
|
|
92
|
-
.clear-button {
|
|
93
|
-
margin: 0;
|
|
94
|
-
padding-left: 0;
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
`
|
|
98
|
-
];
|
|
99
|
-
}
|
|
100
|
-
};
|
|
101
|
-
__decorate([
|
|
102
|
-
property({ type: Array })
|
|
103
|
-
], ScaleField.prototype, "options", void 0);
|
|
104
|
-
ScaleField = __decorate([
|
|
105
|
-
customElement('scale-field')
|
|
106
|
-
], ScaleField);
|
|
107
|
-
export { ScaleField };
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import { html, property, css, customElement } from 'lit-element';
|
|
8
|
+
import { BaseField } from './base-field';
|
|
9
|
+
import { repeat } from 'lit-html/directives/repeat';
|
|
10
|
+
import '@polymer/paper-radio-group/paper-radio-group';
|
|
11
|
+
import '@polymer/paper-radio-button/paper-radio-button';
|
|
12
|
+
import { InputStyles } from '../../lib/styles/input-styles';
|
|
13
|
+
let ScaleField = class ScaleField extends BaseField {
|
|
14
|
+
constructor() {
|
|
15
|
+
super(...arguments);
|
|
16
|
+
this.options = [];
|
|
17
|
+
}
|
|
18
|
+
controlTemplate() {
|
|
19
|
+
return html `
|
|
20
|
+
${InputStyles}
|
|
21
|
+
<div class="container">
|
|
22
|
+
<paper-radio-group
|
|
23
|
+
class="radio-group"
|
|
24
|
+
selected="${this.value}"
|
|
25
|
+
@iron-select="${({ detail }) => this.onSelect(detail.item)}"
|
|
26
|
+
>
|
|
27
|
+
${repeat(this.options, (option) => html `
|
|
28
|
+
<paper-radio-button class="radio-button" name="${this.getValue(option)}">
|
|
29
|
+
${this.getLabel(option)}
|
|
30
|
+
</paper-radio-button>
|
|
31
|
+
`)}
|
|
32
|
+
</paper-radio-group>
|
|
33
|
+
|
|
34
|
+
<paper-button ?hidden="${this.isReadonly}" @click="${() => this.valueChanged(null)}" class="clear-button">
|
|
35
|
+
<iron-icon icon="clear"></iron-icon>Clear
|
|
36
|
+
</paper-button>
|
|
37
|
+
</div>
|
|
38
|
+
<div ?hidden="${!this.errorMessage}" class="error-text">${this.errorMessage}</div>
|
|
39
|
+
`;
|
|
40
|
+
}
|
|
41
|
+
getLabel(option) {
|
|
42
|
+
return typeof option === 'object' ? option.label : option;
|
|
43
|
+
}
|
|
44
|
+
getValue(option) {
|
|
45
|
+
return typeof option === 'object' ? option.value : option;
|
|
46
|
+
}
|
|
47
|
+
onSelect(item) {
|
|
48
|
+
const newValue = item.get('name');
|
|
49
|
+
if (newValue !== this.value) {
|
|
50
|
+
this.touched = true;
|
|
51
|
+
}
|
|
52
|
+
this.valueChanged(newValue);
|
|
53
|
+
}
|
|
54
|
+
customValidation() {
|
|
55
|
+
return null;
|
|
56
|
+
}
|
|
57
|
+
static get styles() {
|
|
58
|
+
// language=CSS
|
|
59
|
+
return [
|
|
60
|
+
...BaseField.styles,
|
|
61
|
+
css `
|
|
62
|
+
.container {
|
|
63
|
+
position: relative;
|
|
64
|
+
min-height: 48px;
|
|
65
|
+
display: flex;
|
|
66
|
+
align-items: center;
|
|
67
|
+
flex-direction: row;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.radio-group {
|
|
71
|
+
display: flex;
|
|
72
|
+
flex-direction: row;
|
|
73
|
+
flex-wrap: wrap;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
:host([is-readonly]) paper-radio-group {
|
|
77
|
+
pointer-events: none;
|
|
78
|
+
opacity: 0.55;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
@media (max-width: 1080px) {
|
|
82
|
+
.container {
|
|
83
|
+
flex-direction: column;
|
|
84
|
+
align-items: flex-start;
|
|
85
|
+
}
|
|
86
|
+
.radio-group {
|
|
87
|
+
flex-direction: column;
|
|
88
|
+
}
|
|
89
|
+
.radio-button {
|
|
90
|
+
padding-left: 3px;
|
|
91
|
+
}
|
|
92
|
+
.clear-button {
|
|
93
|
+
margin: 0;
|
|
94
|
+
padding-left: 0;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
`
|
|
98
|
+
];
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
__decorate([
|
|
102
|
+
property({ type: Array })
|
|
103
|
+
], ScaleField.prototype, "options", void 0);
|
|
104
|
+
ScaleField = __decorate([
|
|
105
|
+
customElement('scale-field')
|
|
106
|
+
], ScaleField);
|
|
107
|
+
export { ScaleField };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { CSSResultArray, TemplateResult } from 'lit-element';
|
|
2
|
-
import { BaseField } from './base-field';
|
|
3
|
-
import '@polymer/paper-input/paper-textarea';
|
|
4
|
-
export declare class TextField extends BaseField<string> {
|
|
5
|
-
protected controlTemplate(): TemplateResult;
|
|
6
|
-
protected customValidation(): string | null;
|
|
7
|
-
static get styles(): CSSResultArray;
|
|
8
|
-
}
|
|
1
|
+
import { CSSResultArray, TemplateResult } from 'lit-element';
|
|
2
|
+
import { BaseField } from './base-field';
|
|
3
|
+
import '@polymer/paper-input/paper-textarea';
|
|
4
|
+
export declare class TextField extends BaseField<string> {
|
|
5
|
+
protected controlTemplate(): TemplateResult;
|
|
6
|
+
protected customValidation(): string | null;
|
|
7
|
+
static get styles(): CSSResultArray;
|
|
8
|
+
}
|
|
@@ -1,54 +1,54 @@
|
|
|
1
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
-
};
|
|
7
|
-
import { css, customElement, html } from 'lit-element';
|
|
8
|
-
import { BaseField } from './base-field';
|
|
9
|
-
import '@polymer/paper-input/paper-textarea';
|
|
10
|
-
import { InputStyles } from '../../lib/styles/input-styles';
|
|
11
|
-
let TextField = class TextField extends BaseField {
|
|
12
|
-
controlTemplate() {
|
|
13
|
-
return html `
|
|
14
|
-
${InputStyles}
|
|
15
|
-
<paper-textarea
|
|
16
|
-
id="textarea"
|
|
17
|
-
class="no-padding-left"
|
|
18
|
-
no-label-float
|
|
19
|
-
placeholder="${this.isReadonly ? '—' : this.placeholder}"
|
|
20
|
-
.value="${this.value}"
|
|
21
|
-
@value-changed="${({ detail }) => this.valueChanged(detail.value)}"
|
|
22
|
-
@focus="${() => (this.touched = true)}"
|
|
23
|
-
placeholder="—"
|
|
24
|
-
?readonly="${this.isReadonly}"
|
|
25
|
-
?invalid="${this.errorMessage}"
|
|
26
|
-
error-message="${this.errorMessage}"
|
|
27
|
-
>
|
|
28
|
-
</paper-textarea>
|
|
29
|
-
`;
|
|
30
|
-
}
|
|
31
|
-
customValidation() {
|
|
32
|
-
return null;
|
|
33
|
-
}
|
|
34
|
-
static get styles() {
|
|
35
|
-
// language=CSS
|
|
36
|
-
return [
|
|
37
|
-
...BaseField.styles,
|
|
38
|
-
css `
|
|
39
|
-
:host(.wide) paper-textarea {
|
|
40
|
-
padding-left: 0;
|
|
41
|
-
}
|
|
42
|
-
@media (max-width: 380px) {
|
|
43
|
-
.no-padding-left {
|
|
44
|
-
padding-left: 0;
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
`
|
|
48
|
-
];
|
|
49
|
-
}
|
|
50
|
-
};
|
|
51
|
-
TextField = __decorate([
|
|
52
|
-
customElement('text-field')
|
|
53
|
-
], TextField);
|
|
54
|
-
export { TextField };
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import { css, customElement, html } from 'lit-element';
|
|
8
|
+
import { BaseField } from './base-field';
|
|
9
|
+
import '@polymer/paper-input/paper-textarea';
|
|
10
|
+
import { InputStyles } from '../../lib/styles/input-styles';
|
|
11
|
+
let TextField = class TextField extends BaseField {
|
|
12
|
+
controlTemplate() {
|
|
13
|
+
return html `
|
|
14
|
+
${InputStyles}
|
|
15
|
+
<paper-textarea
|
|
16
|
+
id="textarea"
|
|
17
|
+
class="no-padding-left"
|
|
18
|
+
no-label-float
|
|
19
|
+
placeholder="${this.isReadonly ? '—' : this.placeholder}"
|
|
20
|
+
.value="${this.value}"
|
|
21
|
+
@value-changed="${({ detail }) => this.valueChanged(detail.value)}"
|
|
22
|
+
@focus="${() => (this.touched = true)}"
|
|
23
|
+
placeholder="—"
|
|
24
|
+
?readonly="${this.isReadonly}"
|
|
25
|
+
?invalid="${this.errorMessage}"
|
|
26
|
+
error-message="${this.errorMessage}"
|
|
27
|
+
>
|
|
28
|
+
</paper-textarea>
|
|
29
|
+
`;
|
|
30
|
+
}
|
|
31
|
+
customValidation() {
|
|
32
|
+
return null;
|
|
33
|
+
}
|
|
34
|
+
static get styles() {
|
|
35
|
+
// language=CSS
|
|
36
|
+
return [
|
|
37
|
+
...BaseField.styles,
|
|
38
|
+
css `
|
|
39
|
+
:host(.wide) paper-textarea {
|
|
40
|
+
padding-left: 0;
|
|
41
|
+
}
|
|
42
|
+
@media (max-width: 380px) {
|
|
43
|
+
.no-padding-left {
|
|
44
|
+
padding-left: 0;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
`
|
|
48
|
+
];
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
TextField = __decorate([
|
|
52
|
+
customElement('text-field')
|
|
53
|
+
], TextField);
|
|
54
|
+
export { TextField };
|
|
@@ -1,60 +1,60 @@
|
|
|
1
|
-
import { LitElement, TemplateResult, CSSResultArray } from 'lit-element';
|
|
2
|
-
import '../form-fields/single-fields/text-field';
|
|
3
|
-
import '../form-fields/single-fields/number-field';
|
|
4
|
-
import '../form-fields/single-fields/scale-field';
|
|
5
|
-
import '@polymer/paper-input/paper-textarea';
|
|
6
|
-
import { IFormBuilderAbstractGroup } from '../lib/types/form-builder.interfaces';
|
|
7
|
-
import { BlueprintField, BlueprintGroup, BlueprintMetadata, Information } from '../lib/types/form-builder.types';
|
|
8
|
-
import { GenericObject } from '../lib/types/global.types';
|
|
9
|
-
export declare enum FieldTypes {
|
|
10
|
-
FILE_TYPE = "file",
|
|
11
|
-
TEXT_TYPE = "text",
|
|
12
|
-
NUMBER_TYPE = "number",
|
|
13
|
-
BOOL_TYPE = "bool",
|
|
14
|
-
SCALE_TYPE = "likert_scale",
|
|
15
|
-
NUMBER_INTEGER_TYPE = "number-integer",
|
|
16
|
-
NUMBER_FLOAT_TYPE = "number-float"
|
|
17
|
-
}
|
|
18
|
-
export declare enum StructureTypes {
|
|
19
|
-
WIDE = "wide",
|
|
20
|
-
ADDITIONAL = "additional",
|
|
21
|
-
CARD = "card",
|
|
22
|
-
ABSTRACT = "abstract",
|
|
23
|
-
COLLAPSED = "collapse",
|
|
24
|
-
ATTACHMENTS_BUTTON = "floating_attachments"
|
|
25
|
-
}
|
|
26
|
-
export declare class FormAbstractGroup extends LitElement implements IFormBuilderAbstractGroup {
|
|
27
|
-
groupStructure: BlueprintGroup;
|
|
28
|
-
metadata: BlueprintMetadata;
|
|
29
|
-
parentGroupName: string;
|
|
30
|
-
readonly: boolean;
|
|
31
|
-
protected _errors: GenericObject;
|
|
32
|
-
protected _value: GenericObject;
|
|
33
|
-
computedPath: string[];
|
|
34
|
-
/**
|
|
35
|
-
* Make value property immutable
|
|
36
|
-
* @param value
|
|
37
|
-
*/
|
|
38
|
-
set value(value: GenericObject);
|
|
39
|
-
get value(): GenericObject;
|
|
40
|
-
/**
|
|
41
|
-
* Setter for handling error.
|
|
42
|
-
* Normally we wouldn't have errors as string or string[] for FormGroups.
|
|
43
|
-
* In cases they appear - show toast with error text and reset it.
|
|
44
|
-
* Otherwise it will be impossible to clear that error from field elements
|
|
45
|
-
* @param errors
|
|
46
|
-
*/
|
|
47
|
-
set errors(errors: GenericObject | string[] | null);
|
|
48
|
-
render(): TemplateResult;
|
|
49
|
-
renderChild(child: BlueprintGroup | BlueprintField | Information): TemplateResult | TemplateResult[];
|
|
50
|
-
renderField(blueprintField: BlueprintField): TemplateResult;
|
|
51
|
-
renderInformation(information: Information): TemplateResult;
|
|
52
|
-
renderGroup(groupStructure: BlueprintGroup): TemplateResult | TemplateResult[];
|
|
53
|
-
getGroupTemplate(groupStructure: BlueprintGroup, index?: number): TemplateResult;
|
|
54
|
-
valueChanged(event: CustomEvent, name: string, index?: number): void;
|
|
55
|
-
errorChanged(event: CustomEvent, name: string, index?: number): void;
|
|
56
|
-
addGroup(name: string): void;
|
|
57
|
-
removeGroup(group: BlueprintGroup, index?: number): void;
|
|
58
|
-
protected getErrorMessage(fieldName: string): string | null;
|
|
59
|
-
static get styles(): CSSResultArray;
|
|
60
|
-
}
|
|
1
|
+
import { LitElement, TemplateResult, CSSResultArray } from 'lit-element';
|
|
2
|
+
import '../form-fields/single-fields/text-field';
|
|
3
|
+
import '../form-fields/single-fields/number-field';
|
|
4
|
+
import '../form-fields/single-fields/scale-field';
|
|
5
|
+
import '@polymer/paper-input/paper-textarea';
|
|
6
|
+
import { IFormBuilderAbstractGroup } from '../lib/types/form-builder.interfaces';
|
|
7
|
+
import { BlueprintField, BlueprintGroup, BlueprintMetadata, Information } from '../lib/types/form-builder.types';
|
|
8
|
+
import { GenericObject } from '../lib/types/global.types';
|
|
9
|
+
export declare enum FieldTypes {
|
|
10
|
+
FILE_TYPE = "file",
|
|
11
|
+
TEXT_TYPE = "text",
|
|
12
|
+
NUMBER_TYPE = "number",
|
|
13
|
+
BOOL_TYPE = "bool",
|
|
14
|
+
SCALE_TYPE = "likert_scale",
|
|
15
|
+
NUMBER_INTEGER_TYPE = "number-integer",
|
|
16
|
+
NUMBER_FLOAT_TYPE = "number-float"
|
|
17
|
+
}
|
|
18
|
+
export declare enum StructureTypes {
|
|
19
|
+
WIDE = "wide",
|
|
20
|
+
ADDITIONAL = "additional",
|
|
21
|
+
CARD = "card",
|
|
22
|
+
ABSTRACT = "abstract",
|
|
23
|
+
COLLAPSED = "collapse",
|
|
24
|
+
ATTACHMENTS_BUTTON = "floating_attachments"
|
|
25
|
+
}
|
|
26
|
+
export declare class FormAbstractGroup extends LitElement implements IFormBuilderAbstractGroup {
|
|
27
|
+
groupStructure: BlueprintGroup;
|
|
28
|
+
metadata: BlueprintMetadata;
|
|
29
|
+
parentGroupName: string;
|
|
30
|
+
readonly: boolean;
|
|
31
|
+
protected _errors: GenericObject;
|
|
32
|
+
protected _value: GenericObject;
|
|
33
|
+
computedPath: string[];
|
|
34
|
+
/**
|
|
35
|
+
* Make value property immutable
|
|
36
|
+
* @param value
|
|
37
|
+
*/
|
|
38
|
+
set value(value: GenericObject);
|
|
39
|
+
get value(): GenericObject;
|
|
40
|
+
/**
|
|
41
|
+
* Setter for handling error.
|
|
42
|
+
* Normally we wouldn't have errors as string or string[] for FormGroups.
|
|
43
|
+
* In cases they appear - show toast with error text and reset it.
|
|
44
|
+
* Otherwise it will be impossible to clear that error from field elements
|
|
45
|
+
* @param errors
|
|
46
|
+
*/
|
|
47
|
+
set errors(errors: GenericObject | string[] | null);
|
|
48
|
+
render(): TemplateResult;
|
|
49
|
+
renderChild(child: BlueprintGroup | BlueprintField | Information): TemplateResult | TemplateResult[];
|
|
50
|
+
renderField(blueprintField: BlueprintField): TemplateResult;
|
|
51
|
+
renderInformation(information: Information): TemplateResult;
|
|
52
|
+
renderGroup(groupStructure: BlueprintGroup): TemplateResult | TemplateResult[];
|
|
53
|
+
getGroupTemplate(groupStructure: BlueprintGroup, index?: number): TemplateResult;
|
|
54
|
+
valueChanged(event: CustomEvent, name: string, index?: number): void;
|
|
55
|
+
errorChanged(event: CustomEvent, name: string, index?: number): void;
|
|
56
|
+
addGroup(name: string): void;
|
|
57
|
+
removeGroup(group: BlueprintGroup, index?: number): void;
|
|
58
|
+
protected getErrorMessage(fieldName: string): string | null;
|
|
59
|
+
static get styles(): CSSResultArray;
|
|
60
|
+
}
|