@unicef-polymer/etools-form-builder 1.0.1 → 1.0.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 +77 -77
- 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 +191 -191
- package/dist/form-attachments-popup/form-attachments-popup.tpl.d.ts +8 -8
- package/dist/form-attachments-popup/form-attachments-popup.tpl.js +15 -15
- package/dist/form-attachments-popup/index.d.ts +2 -2
- package/dist/form-attachments-popup/index.js +2 -2
- package/dist/form-fields/base-field.d.ts +20 -20
- package/dist/form-fields/base-field.js +80 -80
- package/dist/form-fields/custom-elements.define.d.ts +1 -1
- package/dist/form-fields/custom-elements.define.js +11 -11
- package/dist/form-fields/index.d.ts +5 -5
- package/dist/form-fields/index.js +5 -5
- package/dist/form-fields/number-field.d.ts +9 -9
- package/dist/form-fields/number-field.js +24 -24
- package/dist/form-fields/scale-field.d.ts +16 -16
- package/dist/form-fields/scale-field.js +38 -38
- package/dist/form-fields/text-field.d.ts +8 -8
- package/dist/form-fields/text-field.js +19 -19
- package/dist/form-fields/wide-field.d.ts +11 -11
- package/dist/form-fields/wide-field.js +36 -36
- package/dist/form-groups/custom-elements.define.d.ts +1 -1
- package/dist/form-groups/custom-elements.define.js +9 -9
- package/dist/form-groups/form-abstract-group.d.ts +60 -60
- package/dist/form-groups/form-abstract-group.js +199 -199
- package/dist/form-groups/form-card.d.ts +31 -31
- package/dist/form-groups/form-card.js +69 -69
- package/dist/form-groups/form-collapsed-card.d.ts +68 -68
- package/dist/form-groups/form-collapsed-card.js +209 -209
- package/dist/form-groups/index.d.ts +3 -3
- package/dist/form-groups/index.js +3 -3
- package/dist/index.d.ts +14 -14
- package/dist/index.js +19 -19
- package/dist/lib/additional-components/etools-fb-card.d.ts +16 -16
- package/dist/lib/additional-components/etools-fb-card.js +80 -80
- package/dist/lib/styles/attachments.styles.d.ts +2 -2
- package/dist/lib/styles/attachments.styles.js +3 -3
- package/dist/lib/styles/card-styles.d.ts +2 -2
- package/dist/lib/styles/card-styles.js +3 -3
- package/dist/lib/styles/dialog.styles.d.ts +2 -2
- package/dist/lib/styles/dialog.styles.js +3 -3
- package/dist/lib/styles/elevation-styles.d.ts +9 -9
- package/dist/lib/styles/elevation-styles.js +10 -10
- package/dist/lib/styles/flex-layout-classes.d.ts +2 -2
- package/dist/lib/styles/flex-layout-classes.js +3 -3
- package/dist/lib/styles/form-builder-card.styles.d.ts +2 -2
- package/dist/lib/styles/form-builder-card.styles.js +3 -3
- package/dist/lib/styles/input-styles.d.ts +2 -2
- package/dist/lib/styles/input-styles.js +3 -3
- package/dist/lib/styles/page-layout-styles.d.ts +2 -2
- package/dist/lib/styles/page-layout-styles.js +3 -3
- package/dist/lib/styles/shared-styles.d.ts +2 -2
- package/dist/lib/styles/shared-styles.js +3 -3
- package/dist/lib/types/form-builder.interfaces.d.ts +83 -83
- package/dist/lib/types/form-builder.types.d.ts +53 -53
- package/dist/lib/types/global.types.d.ts +4 -4
- 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 +1 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from './form-attachments-popup';
|
|
2
|
-
export * from './form-attachments-popup.helper';
|
|
1
|
+
export * from './form-attachments-popup';
|
|
2
|
+
export * from './form-attachments-popup.helper';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from './form-attachments-popup';
|
|
2
|
-
export * from './form-attachments-popup.helper';
|
|
1
|
+
export * from './form-attachments-popup';
|
|
2
|
+
export * from './form-attachments-popup.helper';
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import { CSSResultArray, LitElement, TemplateResult } from 'lit-element';
|
|
2
|
-
import { FieldValidator } from '../lib/utils/validations.helper';
|
|
3
|
-
export declare abstract class BaseField<T> extends LitElement {
|
|
4
|
-
questionText: string;
|
|
5
|
-
isReadonly: boolean;
|
|
6
|
-
required: boolean;
|
|
7
|
-
value: T | null;
|
|
8
|
-
protected _errorMessage: string | null;
|
|
9
|
-
validators: FieldValidator[];
|
|
10
|
-
set errorMessage(message: string | null);
|
|
11
|
-
get errorMessage(): string | null;
|
|
12
|
-
protected render(): TemplateResult;
|
|
13
|
-
protected questionTemplate(): TemplateResult;
|
|
14
|
-
protected valueChanged(newValue: T): void;
|
|
15
|
-
protected validateField(value: T): void;
|
|
16
|
-
protected metaValidation(value: T): string | null;
|
|
17
|
-
protected abstract customValidation(value: T): string | null;
|
|
18
|
-
protected abstract controlTemplate(): TemplateResult;
|
|
19
|
-
static get styles(): CSSResultArray;
|
|
20
|
-
}
|
|
1
|
+
import { CSSResultArray, LitElement, TemplateResult } from 'lit-element';
|
|
2
|
+
import { FieldValidator } from '../lib/utils/validations.helper';
|
|
3
|
+
export declare abstract class BaseField<T> extends LitElement {
|
|
4
|
+
questionText: string;
|
|
5
|
+
isReadonly: boolean;
|
|
6
|
+
required: boolean;
|
|
7
|
+
value: T | null;
|
|
8
|
+
protected _errorMessage: string | null;
|
|
9
|
+
validators: FieldValidator[];
|
|
10
|
+
set errorMessage(message: string | null);
|
|
11
|
+
get errorMessage(): string | null;
|
|
12
|
+
protected render(): TemplateResult;
|
|
13
|
+
protected questionTemplate(): TemplateResult;
|
|
14
|
+
protected valueChanged(newValue: T): void;
|
|
15
|
+
protected validateField(value: T): void;
|
|
16
|
+
protected metaValidation(value: T): string | null;
|
|
17
|
+
protected abstract customValidation(value: T): string | null;
|
|
18
|
+
protected abstract controlTemplate(): TemplateResult;
|
|
19
|
+
static get styles(): CSSResultArray;
|
|
20
|
+
}
|
|
@@ -1,69 +1,69 @@
|
|
|
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, html, LitElement, property } from 'lit-element';
|
|
8
|
-
import { fireEvent } from '../lib/utils/fire-custom-event';
|
|
9
|
-
import { FlexLayoutClasses } from '../lib/styles/flex-layout-classes';
|
|
10
|
-
import { validate } from '../lib/utils/validations.helper';
|
|
11
|
-
export class BaseField extends LitElement {
|
|
12
|
-
constructor() {
|
|
13
|
-
super(...arguments);
|
|
14
|
-
this.questionText = '';
|
|
15
|
-
this.isReadonly = false;
|
|
16
|
-
this.required = false;
|
|
17
|
-
this.value = null;
|
|
18
|
-
this._errorMessage = null;
|
|
19
|
-
this.validators = [];
|
|
20
|
-
}
|
|
21
|
-
set errorMessage(message) {
|
|
22
|
-
this._errorMessage = message;
|
|
23
|
-
}
|
|
24
|
-
get errorMessage() {
|
|
25
|
-
return this.isReadonly ? null : this._errorMessage;
|
|
26
|
-
}
|
|
27
|
-
render() {
|
|
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, html, LitElement, property } from 'lit-element';
|
|
8
|
+
import { fireEvent } from '../lib/utils/fire-custom-event';
|
|
9
|
+
import { FlexLayoutClasses } from '../lib/styles/flex-layout-classes';
|
|
10
|
+
import { validate } from '../lib/utils/validations.helper';
|
|
11
|
+
export class BaseField extends LitElement {
|
|
12
|
+
constructor() {
|
|
13
|
+
super(...arguments);
|
|
14
|
+
this.questionText = '';
|
|
15
|
+
this.isReadonly = false;
|
|
16
|
+
this.required = false;
|
|
17
|
+
this.value = null;
|
|
18
|
+
this._errorMessage = null;
|
|
19
|
+
this.validators = [];
|
|
20
|
+
}
|
|
21
|
+
set errorMessage(message) {
|
|
22
|
+
this._errorMessage = message;
|
|
23
|
+
}
|
|
24
|
+
get errorMessage() {
|
|
25
|
+
return this.isReadonly ? null : this._errorMessage;
|
|
26
|
+
}
|
|
27
|
+
render() {
|
|
28
28
|
return html `
|
|
29
29
|
<div class="finding-container">
|
|
30
30
|
<div class="question"><slot>${this.questionTemplate()}</slot></div>
|
|
31
31
|
<div class="question-control">${this.controlTemplate()}</div>
|
|
32
32
|
</div>
|
|
33
|
-
`;
|
|
34
|
-
}
|
|
35
|
-
questionTemplate() {
|
|
36
|
-
return html ` <span class="question-text">${this.questionText}</span> `;
|
|
37
|
-
}
|
|
38
|
-
valueChanged(newValue) {
|
|
39
|
-
this.validateField(newValue);
|
|
40
|
-
if (newValue !== this.value) {
|
|
41
|
-
this.value = newValue;
|
|
42
|
-
fireEvent(this, 'value-changed', { value: newValue });
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
validateField(value) {
|
|
46
|
-
let errorMessage;
|
|
47
|
-
if (this.required && !value) {
|
|
48
|
-
errorMessage = 'This field is required!';
|
|
49
|
-
}
|
|
50
|
-
else {
|
|
51
|
-
errorMessage = this.metaValidation(value);
|
|
52
|
-
}
|
|
53
|
-
if (this._errorMessage !== errorMessage) {
|
|
54
|
-
fireEvent(this, 'error-changed', { error: errorMessage });
|
|
55
|
-
this._errorMessage = errorMessage;
|
|
56
|
-
this.requestUpdate();
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
metaValidation(value) {
|
|
60
|
-
const message = validate(this.validators, value);
|
|
61
|
-
return message ? message : this.customValidation(value);
|
|
62
|
-
}
|
|
63
|
-
static get styles() {
|
|
64
|
-
// language=CSS
|
|
65
|
-
return [
|
|
66
|
-
FlexLayoutClasses,
|
|
33
|
+
`;
|
|
34
|
+
}
|
|
35
|
+
questionTemplate() {
|
|
36
|
+
return html ` <span class="question-text">${this.questionText}</span> `;
|
|
37
|
+
}
|
|
38
|
+
valueChanged(newValue) {
|
|
39
|
+
this.validateField(newValue);
|
|
40
|
+
if (newValue !== this.value) {
|
|
41
|
+
this.value = newValue;
|
|
42
|
+
fireEvent(this, 'value-changed', { value: newValue });
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
validateField(value) {
|
|
46
|
+
let errorMessage;
|
|
47
|
+
if (this.required && !value) {
|
|
48
|
+
errorMessage = 'This field is required!';
|
|
49
|
+
}
|
|
50
|
+
else {
|
|
51
|
+
errorMessage = this.metaValidation(value);
|
|
52
|
+
}
|
|
53
|
+
if (this._errorMessage !== errorMessage) {
|
|
54
|
+
fireEvent(this, 'error-changed', { error: errorMessage });
|
|
55
|
+
this._errorMessage = errorMessage;
|
|
56
|
+
this.requestUpdate();
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
metaValidation(value) {
|
|
60
|
+
const message = validate(this.validators, value);
|
|
61
|
+
return message ? message : this.customValidation(value);
|
|
62
|
+
}
|
|
63
|
+
static get styles() {
|
|
64
|
+
// language=CSS
|
|
65
|
+
return [
|
|
66
|
+
FlexLayoutClasses,
|
|
67
67
|
css `
|
|
68
68
|
:host {
|
|
69
69
|
display: block;
|
|
@@ -133,22 +133,22 @@ export class BaseField extends LitElement {
|
|
|
133
133
|
flex: 0 1 auto;
|
|
134
134
|
}
|
|
135
135
|
}
|
|
136
|
-
`
|
|
137
|
-
];
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
__decorate([
|
|
141
|
-
property({ type: String })
|
|
142
|
-
], BaseField.prototype, "questionText", void 0);
|
|
143
|
-
__decorate([
|
|
144
|
-
property({ type: Boolean, attribute: 'is-readonly' })
|
|
145
|
-
], BaseField.prototype, "isReadonly", void 0);
|
|
146
|
-
__decorate([
|
|
147
|
-
property({ type: Boolean, attribute: 'required', reflect: true })
|
|
148
|
-
], BaseField.prototype, "required", void 0);
|
|
149
|
-
__decorate([
|
|
150
|
-
property()
|
|
151
|
-
], BaseField.prototype, "value", void 0);
|
|
152
|
-
__decorate([
|
|
153
|
-
property()
|
|
154
|
-
], BaseField.prototype, "_errorMessage", void 0);
|
|
136
|
+
`
|
|
137
|
+
];
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
__decorate([
|
|
141
|
+
property({ type: String })
|
|
142
|
+
], BaseField.prototype, "questionText", void 0);
|
|
143
|
+
__decorate([
|
|
144
|
+
property({ type: Boolean, attribute: 'is-readonly' })
|
|
145
|
+
], BaseField.prototype, "isReadonly", void 0);
|
|
146
|
+
__decorate([
|
|
147
|
+
property({ type: Boolean, attribute: 'required', reflect: true })
|
|
148
|
+
], BaseField.prototype, "required", void 0);
|
|
149
|
+
__decorate([
|
|
150
|
+
property()
|
|
151
|
+
], BaseField.prototype, "value", void 0);
|
|
152
|
+
__decorate([
|
|
153
|
+
property()
|
|
154
|
+
], BaseField.prototype, "_errorMessage", void 0);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export {};
|
|
1
|
+
export {};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Form field elements
|
|
3
|
-
*/
|
|
4
|
-
import { TextField } from './text-field';
|
|
5
|
-
import { NumberField } from './number-field';
|
|
6
|
-
import { ScaleField } from './scale-field';
|
|
7
|
-
import { WideField } from './wide-field';
|
|
8
|
-
window.customElements.define('number-field', NumberField);
|
|
9
|
-
window.customElements.define('text-field', TextField);
|
|
10
|
-
window.customElements.define('scale-field', ScaleField);
|
|
11
|
-
window.customElements.define('wide-field', WideField);
|
|
1
|
+
/**
|
|
2
|
+
* Form field elements
|
|
3
|
+
*/
|
|
4
|
+
import { TextField } from './text-field';
|
|
5
|
+
import { NumberField } from './number-field';
|
|
6
|
+
import { ScaleField } from './scale-field';
|
|
7
|
+
import { WideField } from './wide-field';
|
|
8
|
+
window.customElements.define('number-field', NumberField);
|
|
9
|
+
window.customElements.define('text-field', TextField);
|
|
10
|
+
window.customElements.define('scale-field', ScaleField);
|
|
11
|
+
window.customElements.define('wide-field', WideField);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export * from './base-field';
|
|
2
|
-
export * from './number-field';
|
|
3
|
-
export * from './text-field';
|
|
4
|
-
export * from './scale-field';
|
|
5
|
-
export * from './wide-field';
|
|
1
|
+
export * from './base-field';
|
|
2
|
+
export * from './number-field';
|
|
3
|
+
export * from './text-field';
|
|
4
|
+
export * from './scale-field';
|
|
5
|
+
export * from './wide-field';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export * from './base-field';
|
|
2
|
-
export * from './number-field';
|
|
3
|
-
export * from './text-field';
|
|
4
|
-
export * from './scale-field';
|
|
5
|
-
export * from './wide-field';
|
|
1
|
+
export * from './base-field';
|
|
2
|
+
export * from './number-field';
|
|
3
|
+
export * from './text-field';
|
|
4
|
+
export * from './scale-field';
|
|
5
|
+
export * from './wide-field';
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { CSSResultArray, TemplateResult } from 'lit-element';
|
|
2
|
-
import { BaseField } from './base-field';
|
|
3
|
-
import '@polymer/paper-input/paper-input';
|
|
4
|
-
export declare class NumberField extends BaseField<number> {
|
|
5
|
-
protected controlTemplate(): TemplateResult;
|
|
6
|
-
protected valueChanged(newValue: number): void;
|
|
7
|
-
protected customValidation(value: number): string | null;
|
|
8
|
-
static get styles(): CSSResultArray;
|
|
9
|
-
}
|
|
1
|
+
import { CSSResultArray, TemplateResult } from 'lit-element';
|
|
2
|
+
import { BaseField } from './base-field';
|
|
3
|
+
import '@polymer/paper-input/paper-input';
|
|
4
|
+
export declare class NumberField extends BaseField<number> {
|
|
5
|
+
protected controlTemplate(): TemplateResult;
|
|
6
|
+
protected valueChanged(newValue: number): void;
|
|
7
|
+
protected customValidation(value: number): string | null;
|
|
8
|
+
static get styles(): CSSResultArray;
|
|
9
|
+
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { css, html } from 'lit-element';
|
|
2
|
-
import { BaseField } from './base-field';
|
|
3
|
-
import '@polymer/paper-input/paper-input';
|
|
4
|
-
import { InputStyles } from '../lib/styles/input-styles';
|
|
5
|
-
export class NumberField extends BaseField {
|
|
6
|
-
controlTemplate() {
|
|
1
|
+
import { css, html } from 'lit-element';
|
|
2
|
+
import { BaseField } from './base-field';
|
|
3
|
+
import '@polymer/paper-input/paper-input';
|
|
4
|
+
import { InputStyles } from '../lib/styles/input-styles';
|
|
5
|
+
export class NumberField extends BaseField {
|
|
6
|
+
controlTemplate() {
|
|
7
7
|
return html `
|
|
8
8
|
${InputStyles}
|
|
9
9
|
<paper-input
|
|
@@ -17,27 +17,27 @@ export class NumberField extends BaseField {
|
|
|
17
17
|
?disabled="${this.isReadonly}"
|
|
18
18
|
>
|
|
19
19
|
</paper-input>
|
|
20
|
-
`;
|
|
21
|
-
}
|
|
22
|
-
valueChanged(newValue) {
|
|
23
|
-
const formatted = Number(newValue);
|
|
24
|
-
const isNumber = !isNaN(formatted) && `${newValue}` !== '' && `${newValue}` !== 'null';
|
|
25
|
-
super.valueChanged(isNumber ? formatted : newValue);
|
|
26
|
-
}
|
|
27
|
-
customValidation(value) {
|
|
28
|
-
return value && isNaN(value) ? 'Must be a number' : null;
|
|
29
|
-
}
|
|
30
|
-
static get styles() {
|
|
31
|
-
// language=CSS
|
|
32
|
-
return [
|
|
33
|
-
...BaseField.styles,
|
|
20
|
+
`;
|
|
21
|
+
}
|
|
22
|
+
valueChanged(newValue) {
|
|
23
|
+
const formatted = Number(newValue);
|
|
24
|
+
const isNumber = !isNaN(formatted) && `${newValue}` !== '' && `${newValue}` !== 'null';
|
|
25
|
+
super.valueChanged(isNumber ? formatted : newValue);
|
|
26
|
+
}
|
|
27
|
+
customValidation(value) {
|
|
28
|
+
return value && isNaN(value) ? 'Must be a number' : null;
|
|
29
|
+
}
|
|
30
|
+
static get styles() {
|
|
31
|
+
// language=CSS
|
|
32
|
+
return [
|
|
33
|
+
...BaseField.styles,
|
|
34
34
|
css `
|
|
35
35
|
@media (max-width: 380px) {
|
|
36
36
|
.no-padding-left {
|
|
37
37
|
padding-left: 0;
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
|
-
`
|
|
41
|
-
];
|
|
42
|
-
}
|
|
43
|
-
}
|
|
40
|
+
`
|
|
41
|
+
];
|
|
42
|
+
}
|
|
43
|
+
}
|
|
@@ -1,16 +1,16 @@
|
|
|
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 | null> {
|
|
11
|
-
options: FieldOption[];
|
|
12
|
-
protected controlTemplate(): TemplateResult;
|
|
13
|
-
protected onSelect(item: PaperRadioButtonElement): void;
|
|
14
|
-
protected customValidation(): string | null;
|
|
15
|
-
static get styles(): CSSResultArray;
|
|
16
|
-
}
|
|
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 | null> {
|
|
11
|
+
options: FieldOption[];
|
|
12
|
+
protected controlTemplate(): TemplateResult;
|
|
13
|
+
protected onSelect(item: PaperRadioButtonElement): void;
|
|
14
|
+
protected customValidation(): string | null;
|
|
15
|
+
static get styles(): CSSResultArray;
|
|
16
|
+
}
|
|
@@ -1,21 +1,21 @@
|
|
|
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 } 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
|
-
export class ScaleField extends BaseField {
|
|
14
|
-
constructor() {
|
|
15
|
-
super(...arguments);
|
|
16
|
-
this.options = [];
|
|
17
|
-
}
|
|
18
|
-
controlTemplate() {
|
|
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 } 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
|
+
export class ScaleField extends BaseField {
|
|
14
|
+
constructor() {
|
|
15
|
+
super(...arguments);
|
|
16
|
+
this.options = [];
|
|
17
|
+
}
|
|
18
|
+
controlTemplate() {
|
|
19
19
|
return html `
|
|
20
20
|
${InputStyles}
|
|
21
21
|
<div class="container">
|
|
@@ -33,19 +33,19 @@ export class ScaleField extends BaseField {
|
|
|
33
33
|
<iron-icon icon="clear"></iron-icon>Clear
|
|
34
34
|
</paper-button>
|
|
35
35
|
</div>
|
|
36
|
-
`;
|
|
37
|
-
}
|
|
38
|
-
onSelect(item) {
|
|
39
|
-
const newValue = item.get('name');
|
|
40
|
-
this.valueChanged(newValue);
|
|
41
|
-
}
|
|
42
|
-
customValidation() {
|
|
43
|
-
return null;
|
|
44
|
-
}
|
|
45
|
-
static get styles() {
|
|
46
|
-
// language=CSS
|
|
47
|
-
return [
|
|
48
|
-
...BaseField.styles,
|
|
36
|
+
`;
|
|
37
|
+
}
|
|
38
|
+
onSelect(item) {
|
|
39
|
+
const newValue = item.get('name');
|
|
40
|
+
this.valueChanged(newValue);
|
|
41
|
+
}
|
|
42
|
+
customValidation() {
|
|
43
|
+
return null;
|
|
44
|
+
}
|
|
45
|
+
static get styles() {
|
|
46
|
+
// language=CSS
|
|
47
|
+
return [
|
|
48
|
+
...BaseField.styles,
|
|
49
49
|
css `
|
|
50
50
|
.container {
|
|
51
51
|
position: relative;
|
|
@@ -82,10 +82,10 @@ export class ScaleField extends BaseField {
|
|
|
82
82
|
padding-left: 0;
|
|
83
83
|
}
|
|
84
84
|
}
|
|
85
|
-
`
|
|
86
|
-
];
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
__decorate([
|
|
90
|
-
property({ type: Array })
|
|
91
|
-
], ScaleField.prototype, "options", void 0);
|
|
85
|
+
`
|
|
86
|
+
];
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
__decorate([
|
|
90
|
+
property({ type: Array })
|
|
91
|
+
], ScaleField.prototype, "options", void 0);
|
|
@@ -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,9 +1,9 @@
|
|
|
1
|
-
import { css, html } from 'lit-element';
|
|
2
|
-
import { BaseField } from './base-field';
|
|
3
|
-
import '@polymer/paper-input/paper-textarea';
|
|
4
|
-
import { InputStyles } from '../lib/styles/input-styles';
|
|
5
|
-
export class TextField extends BaseField {
|
|
6
|
-
controlTemplate() {
|
|
1
|
+
import { css, html } from 'lit-element';
|
|
2
|
+
import { BaseField } from './base-field';
|
|
3
|
+
import '@polymer/paper-input/paper-textarea';
|
|
4
|
+
import { InputStyles } from '../lib/styles/input-styles';
|
|
5
|
+
export class TextField extends BaseField {
|
|
6
|
+
controlTemplate() {
|
|
7
7
|
return html `
|
|
8
8
|
${InputStyles}
|
|
9
9
|
<paper-textarea
|
|
@@ -18,22 +18,22 @@ export class TextField extends BaseField {
|
|
|
18
18
|
error-message="${this.errorMessage}"
|
|
19
19
|
>
|
|
20
20
|
</paper-textarea>
|
|
21
|
-
`;
|
|
22
|
-
}
|
|
23
|
-
customValidation() {
|
|
24
|
-
return null;
|
|
25
|
-
}
|
|
26
|
-
static get styles() {
|
|
27
|
-
// language=CSS
|
|
28
|
-
return [
|
|
29
|
-
...BaseField.styles,
|
|
21
|
+
`;
|
|
22
|
+
}
|
|
23
|
+
customValidation() {
|
|
24
|
+
return null;
|
|
25
|
+
}
|
|
26
|
+
static get styles() {
|
|
27
|
+
// language=CSS
|
|
28
|
+
return [
|
|
29
|
+
...BaseField.styles,
|
|
30
30
|
css `
|
|
31
31
|
@media (max-width: 380px) {
|
|
32
32
|
.no-padding-left {
|
|
33
33
|
padding-left: 0;
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
|
-
`
|
|
37
|
-
];
|
|
38
|
-
}
|
|
39
|
-
}
|
|
36
|
+
`
|
|
37
|
+
];
|
|
38
|
+
}
|
|
39
|
+
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { TemplateResult, CSSResultArray } from 'lit-element';
|
|
2
|
-
import { BaseField } from './base-field';
|
|
3
|
-
import '@polymer/paper-input/paper-textarea';
|
|
4
|
-
export declare class WideField extends BaseField<string> {
|
|
5
|
-
label: string;
|
|
6
|
-
placeholder: string;
|
|
7
|
-
protected render(): TemplateResult;
|
|
8
|
-
protected controlTemplate(): TemplateResult;
|
|
9
|
-
protected customValidation(): string | null;
|
|
10
|
-
static get styles(): CSSResultArray;
|
|
11
|
-
}
|
|
1
|
+
import { TemplateResult, CSSResultArray } from 'lit-element';
|
|
2
|
+
import { BaseField } from './base-field';
|
|
3
|
+
import '@polymer/paper-input/paper-textarea';
|
|
4
|
+
export declare class WideField extends BaseField<string> {
|
|
5
|
+
label: string;
|
|
6
|
+
placeholder: string;
|
|
7
|
+
protected render(): TemplateResult;
|
|
8
|
+
protected controlTemplate(): TemplateResult;
|
|
9
|
+
protected customValidation(): string | null;
|
|
10
|
+
static get styles(): CSSResultArray;
|
|
11
|
+
}
|