@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,20 +1,20 @@
|
|
|
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 } 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
|
-
export class WideField extends BaseField {
|
|
12
|
-
constructor() {
|
|
13
|
-
super(...arguments);
|
|
14
|
-
this.label = '';
|
|
15
|
-
this.placeholder = '';
|
|
16
|
-
}
|
|
17
|
-
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 { html, property } 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
|
+
export class WideField extends BaseField {
|
|
12
|
+
constructor() {
|
|
13
|
+
super(...arguments);
|
|
14
|
+
this.label = '';
|
|
15
|
+
this.placeholder = '';
|
|
16
|
+
}
|
|
17
|
+
render() {
|
|
18
18
|
return html `
|
|
19
19
|
${InputStyles}
|
|
20
20
|
<paper-textarea
|
|
@@ -30,22 +30,22 @@ export class WideField extends BaseField {
|
|
|
30
30
|
@value-changed="${({ detail }) => this.valueChanged(detail.value)}"
|
|
31
31
|
>
|
|
32
32
|
</paper-textarea>
|
|
33
|
-
`;
|
|
34
|
-
}
|
|
35
|
-
controlTemplate() {
|
|
36
|
-
return html ``;
|
|
37
|
-
}
|
|
38
|
-
customValidation() {
|
|
39
|
-
return null;
|
|
40
|
-
}
|
|
41
|
-
static get styles() {
|
|
42
|
-
// language=CSS
|
|
43
|
-
return [...BaseField.styles];
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
__decorate([
|
|
47
|
-
property()
|
|
48
|
-
], WideField.prototype, "label", void 0);
|
|
49
|
-
__decorate([
|
|
50
|
-
property()
|
|
51
|
-
], WideField.prototype, "placeholder", void 0);
|
|
33
|
+
`;
|
|
34
|
+
}
|
|
35
|
+
controlTemplate() {
|
|
36
|
+
return html ``;
|
|
37
|
+
}
|
|
38
|
+
customValidation() {
|
|
39
|
+
return null;
|
|
40
|
+
}
|
|
41
|
+
static get styles() {
|
|
42
|
+
// language=CSS
|
|
43
|
+
return [...BaseField.styles];
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
__decorate([
|
|
47
|
+
property()
|
|
48
|
+
], WideField.prototype, "label", void 0);
|
|
49
|
+
__decorate([
|
|
50
|
+
property()
|
|
51
|
+
], WideField.prototype, "placeholder", void 0);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export {};
|
|
1
|
+
export {};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Form group elements
|
|
3
|
-
*/
|
|
4
|
-
import { FormAbstractGroup } from './form-abstract-group';
|
|
5
|
-
import { FormCard } from './form-card';
|
|
6
|
-
import { FormCollapsedCard } from './form-collapsed-card';
|
|
7
|
-
window.customElements.define('form-abstract-group', FormAbstractGroup);
|
|
8
|
-
window.customElements.define('form-card', FormCard);
|
|
9
|
-
window.customElements.define('form-collapsed-card', FormCollapsedCard);
|
|
1
|
+
/**
|
|
2
|
+
* Form group elements
|
|
3
|
+
*/
|
|
4
|
+
import { FormAbstractGroup } from './form-abstract-group';
|
|
5
|
+
import { FormCard } from './form-card';
|
|
6
|
+
import { FormCollapsedCard } from './form-collapsed-card';
|
|
7
|
+
window.customElements.define('form-abstract-group', FormAbstractGroup);
|
|
8
|
+
window.customElements.define('form-card', FormCard);
|
|
9
|
+
window.customElements.define('form-collapsed-card', FormCollapsedCard);
|
|
@@ -1,60 +1,60 @@
|
|
|
1
|
-
import { LitElement, TemplateResult, CSSResultArray } from 'lit-element';
|
|
2
|
-
import '../form-fields/text-field';
|
|
3
|
-
import '../form-fields/number-field';
|
|
4
|
-
import '../form-fields/scale-field';
|
|
5
|
-
import '../form-fields/wide-field';
|
|
6
|
-
import '@polymer/paper-input/paper-textarea';
|
|
7
|
-
import { IFormBuilderAbstractGroup } from '../lib/types/form-builder.interfaces';
|
|
8
|
-
import { BlueprintField, BlueprintGroup, BlueprintMetadata } from '../lib/types/form-builder.types';
|
|
9
|
-
import { GenericObject } from '../lib/types/global.types';
|
|
10
|
-
export declare enum FieldTypes {
|
|
11
|
-
FILE_TYPE = "file",
|
|
12
|
-
TEXT_TYPE = "text",
|
|
13
|
-
NUMBER_TYPE = "number",
|
|
14
|
-
BOOL_TYPE = "bool",
|
|
15
|
-
SCALE_TYPE = "likert_scale",
|
|
16
|
-
NUMBER_INTEGER_TYPE = "number-integer",
|
|
17
|
-
NUMBER_FLOAT_TYPE = "number-float"
|
|
18
|
-
}
|
|
19
|
-
export declare enum StructureTypes {
|
|
20
|
-
WIDE = "wide",
|
|
21
|
-
ADDITIONAL = "additional",
|
|
22
|
-
CARD = "card",
|
|
23
|
-
ABSTRACT = "abstract",
|
|
24
|
-
COLLAPSED = "collapse",
|
|
25
|
-
ATTACHMENTS_BUTTON = "floating_attachments"
|
|
26
|
-
}
|
|
27
|
-
export declare class FormAbstractGroup extends LitElement implements IFormBuilderAbstractGroup {
|
|
28
|
-
groupStructure: BlueprintGroup;
|
|
29
|
-
metadata: BlueprintMetadata;
|
|
30
|
-
parentGroupName: string;
|
|
31
|
-
readonly: boolean;
|
|
32
|
-
protected _errors: GenericObject;
|
|
33
|
-
protected _value: GenericObject;
|
|
34
|
-
computedPath: string[];
|
|
35
|
-
/**
|
|
36
|
-
* Make value property immutable
|
|
37
|
-
* @param value
|
|
38
|
-
*/
|
|
39
|
-
set value(value: GenericObject);
|
|
40
|
-
get value(): GenericObject;
|
|
41
|
-
/**
|
|
42
|
-
* Setter for handling error.
|
|
43
|
-
* Normally we wouldn't have errors as string or string[] for FormGroups.
|
|
44
|
-
* In cases they appear - show toast with error text and reset it.
|
|
45
|
-
* Otherwise it will be impossible to clear that error from field elements
|
|
46
|
-
* @param errors
|
|
47
|
-
*/
|
|
48
|
-
set errors(errors: GenericObject | string[] | null);
|
|
49
|
-
render(): TemplateResult;
|
|
50
|
-
renderChild(child: BlueprintGroup | BlueprintField): TemplateResult;
|
|
51
|
-
renderField(blueprintField: BlueprintField): TemplateResult;
|
|
52
|
-
renderWideField({ name, label, placeholder, required, validations }: BlueprintField): TemplateResult;
|
|
53
|
-
renderStandardField({ input_type, name, label, help_text, options_key, required, validations }: BlueprintField): TemplateResult;
|
|
54
|
-
renderFieldLabel(label: string, helperText: string): TemplateResult;
|
|
55
|
-
renderGroup(groupStructure: BlueprintGroup): TemplateResult;
|
|
56
|
-
valueChanged(event: CustomEvent, name: string): void;
|
|
57
|
-
errorChanged(event: CustomEvent, name: string): 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/text-field';
|
|
3
|
+
import '../form-fields/number-field';
|
|
4
|
+
import '../form-fields/scale-field';
|
|
5
|
+
import '../form-fields/wide-field';
|
|
6
|
+
import '@polymer/paper-input/paper-textarea';
|
|
7
|
+
import { IFormBuilderAbstractGroup } from '../lib/types/form-builder.interfaces';
|
|
8
|
+
import { BlueprintField, BlueprintGroup, BlueprintMetadata } from '../lib/types/form-builder.types';
|
|
9
|
+
import { GenericObject } from '../lib/types/global.types';
|
|
10
|
+
export declare enum FieldTypes {
|
|
11
|
+
FILE_TYPE = "file",
|
|
12
|
+
TEXT_TYPE = "text",
|
|
13
|
+
NUMBER_TYPE = "number",
|
|
14
|
+
BOOL_TYPE = "bool",
|
|
15
|
+
SCALE_TYPE = "likert_scale",
|
|
16
|
+
NUMBER_INTEGER_TYPE = "number-integer",
|
|
17
|
+
NUMBER_FLOAT_TYPE = "number-float"
|
|
18
|
+
}
|
|
19
|
+
export declare enum StructureTypes {
|
|
20
|
+
WIDE = "wide",
|
|
21
|
+
ADDITIONAL = "additional",
|
|
22
|
+
CARD = "card",
|
|
23
|
+
ABSTRACT = "abstract",
|
|
24
|
+
COLLAPSED = "collapse",
|
|
25
|
+
ATTACHMENTS_BUTTON = "floating_attachments"
|
|
26
|
+
}
|
|
27
|
+
export declare class FormAbstractGroup extends LitElement implements IFormBuilderAbstractGroup {
|
|
28
|
+
groupStructure: BlueprintGroup;
|
|
29
|
+
metadata: BlueprintMetadata;
|
|
30
|
+
parentGroupName: string;
|
|
31
|
+
readonly: boolean;
|
|
32
|
+
protected _errors: GenericObject;
|
|
33
|
+
protected _value: GenericObject;
|
|
34
|
+
computedPath: string[];
|
|
35
|
+
/**
|
|
36
|
+
* Make value property immutable
|
|
37
|
+
* @param value
|
|
38
|
+
*/
|
|
39
|
+
set value(value: GenericObject);
|
|
40
|
+
get value(): GenericObject;
|
|
41
|
+
/**
|
|
42
|
+
* Setter for handling error.
|
|
43
|
+
* Normally we wouldn't have errors as string or string[] for FormGroups.
|
|
44
|
+
* In cases they appear - show toast with error text and reset it.
|
|
45
|
+
* Otherwise it will be impossible to clear that error from field elements
|
|
46
|
+
* @param errors
|
|
47
|
+
*/
|
|
48
|
+
set errors(errors: GenericObject | string[] | null);
|
|
49
|
+
render(): TemplateResult;
|
|
50
|
+
renderChild(child: BlueprintGroup | BlueprintField): TemplateResult;
|
|
51
|
+
renderField(blueprintField: BlueprintField): TemplateResult;
|
|
52
|
+
renderWideField({ name, label, placeholder, required, validations }: BlueprintField): TemplateResult;
|
|
53
|
+
renderStandardField({ input_type, name, label, help_text, options_key, required, validations }: BlueprintField): TemplateResult;
|
|
54
|
+
renderFieldLabel(label: string, helperText: string): TemplateResult;
|
|
55
|
+
renderGroup(groupStructure: BlueprintGroup): TemplateResult;
|
|
56
|
+
valueChanged(event: CustomEvent, name: string): void;
|
|
57
|
+
errorChanged(event: CustomEvent, name: string): void;
|
|
58
|
+
protected getErrorMessage(fieldName: string): string | null;
|
|
59
|
+
static get styles(): CSSResultArray;
|
|
60
|
+
}
|