@unicef-polymer/etools-form-builder 3.0.0-rc.8 → 3.1.0
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/assets/translations.js +70 -2
- package/dist/form-attachments-popup/form-attachments-popup.d.ts +4 -0
- package/dist/form-attachments-popup/form-attachments-popup.js +156 -53
- package/dist/form-fields/abstract-field-base.class.d.ts +1 -0
- package/dist/form-fields/abstract-field-base.class.js +106 -116
- package/dist/form-fields/field-renderer-component.d.ts +7 -3
- package/dist/form-fields/field-renderer-component.js +185 -154
- package/dist/form-fields/repeatable-fields/repeatable-attachment-field.js +112 -112
- package/dist/form-fields/repeatable-fields/repeatable-base-field.js +22 -22
- package/dist/form-fields/repeatable-fields/repeatable-number-field.js +19 -21
- package/dist/form-fields/repeatable-fields/repeatable-scale-field.js +57 -59
- package/dist/form-fields/repeatable-fields/repeatable-text-field.js +19 -24
- package/dist/form-fields/single-fields/attachment-field.js +13 -13
- package/dist/form-fields/single-fields/boolean-field.js +16 -21
- package/dist/form-fields/single-fields/number-field.js +21 -23
- package/dist/form-fields/single-fields/scale-field.js +58 -60
- package/dist/form-fields/single-fields/text-field.js +24 -25
- package/dist/form-groups/form-abstract-group.d.ts +2 -1
- package/dist/form-groups/form-abstract-group.js +129 -127
- package/dist/form-groups/form-card.js +30 -24
- package/dist/form-groups/form-collapsed-card.js +34 -34
- package/dist/lib/additional-components/confirmation-dialog.js +21 -21
- package/dist/lib/additional-components/etools-fb-card.js +136 -135
- package/dist/lib/styles/attachments.styles.js +61 -66
- package/dist/lib/styles/card-styles.js +147 -151
- package/dist/lib/styles/dialog.styles.js +83 -83
- package/dist/lib/styles/elevation-styles.d.ts +2 -2
- package/dist/lib/styles/elevation-styles.js +35 -35
- package/dist/lib/styles/flex-layout-classes.js +316 -316
- package/dist/lib/styles/form-builder-card.styles.js +53 -46
- package/dist/lib/styles/page-layout-styles.js +198 -198
- package/dist/lib/styles/shared-styles.js +61 -67
- package/package.json +55 -55
- package/dist/form-attachments-popup/form-attachments-popup.tpl.d.ts +0 -7
- package/dist/form-attachments-popup/form-attachments-popup.tpl.js +0 -102
- package/dist/lib/styles/input-styles.d.ts +0 -2
- package/dist/lib/styles/input-styles.js +0 -143
package/package.json
CHANGED
|
@@ -1,55 +1,55 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@unicef-polymer/etools-form-builder",
|
|
3
|
-
"description": "Etools FM Form Builder components",
|
|
4
|
-
"version": "3.
|
|
5
|
-
"contributors": [
|
|
6
|
-
"eTools Team"
|
|
7
|
-
],
|
|
8
|
-
"license": "BSD-3-Clause",
|
|
9
|
-
"repository": "https://github.com/unicef-polymer/fm-form-builder",
|
|
10
|
-
"main": "dist/index.js",
|
|
11
|
-
"types": "dist/index.d.ts",
|
|
12
|
-
"files": [
|
|
13
|
-
"dist"
|
|
14
|
-
],
|
|
15
|
-
"scripts": {
|
|
16
|
-
"tsToJs": "rm -rf dist && tsc --skipLibCheck",
|
|
17
|
-
"watch": "tsc --watch",
|
|
18
|
-
"lint": "eslint ./src/**/*.ts --ext ts",
|
|
19
|
-
"format": "eslint --ext .ts ./src/**/*.ts --fix --ignore-path .gitignore",
|
|
20
|
-
"rd:init": "relative-deps init",
|
|
21
|
-
"rd:add": "relative-deps add",
|
|
22
|
-
"rd:reload": "relative-deps",
|
|
23
|
-
"prepublishOnly": "npm run tsToJs"
|
|
24
|
-
},
|
|
25
|
-
"dependencies": {
|
|
26
|
-
"@shoelace-style/shoelace": "
|
|
27
|
-
"@types/ramda": "
|
|
28
|
-
"
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
-
"
|
|
32
|
-
"
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
"
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
"@typescript-eslint/eslint-plugin": "^5.7.0",
|
|
40
|
-
"@typescript-eslint/parser": "^5.7.0",
|
|
41
|
-
"@typescript-eslint/typescript-estree": "^5.7.0",
|
|
42
|
-
"acorn": "^8.0.4",
|
|
43
|
-
"eslint": "^7.32.0",
|
|
44
|
-
"eslint-config-google": "^0.14.0",
|
|
45
|
-
"eslint-config-prettier": "^6.15.0",
|
|
46
|
-
"eslint-plugin-html": "^6.2.0",
|
|
47
|
-
"eslint-plugin-lit": "^1.6.1",
|
|
48
|
-
"eslint-plugin-prettier": "^3.4.1",
|
|
49
|
-
"prettier": "^2.3.2",
|
|
50
|
-
"minimist": ">=0.2.1",
|
|
51
|
-
"lodash": ">=4.17.21",
|
|
52
|
-
"ansi-regex": ">=5.0.1",
|
|
53
|
-
"glob-parent": ">=5.1.2"
|
|
54
|
-
}
|
|
55
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@unicef-polymer/etools-form-builder",
|
|
3
|
+
"description": "Etools FM Form Builder components",
|
|
4
|
+
"version": "3.1.0",
|
|
5
|
+
"contributors": [
|
|
6
|
+
"eTools Team"
|
|
7
|
+
],
|
|
8
|
+
"license": "BSD-3-Clause",
|
|
9
|
+
"repository": "https://github.com/unicef-polymer/fm-form-builder",
|
|
10
|
+
"main": "dist/index.js",
|
|
11
|
+
"types": "dist/index.d.ts",
|
|
12
|
+
"files": [
|
|
13
|
+
"dist"
|
|
14
|
+
],
|
|
15
|
+
"scripts": {
|
|
16
|
+
"tsToJs": "rm -rf dist && tsc --skipLibCheck",
|
|
17
|
+
"watch": "tsc --watch",
|
|
18
|
+
"lint": "eslint ./src/**/*.ts --ext ts",
|
|
19
|
+
"format": "eslint --ext .ts ./src/**/*.ts --fix --ignore-path .gitignore",
|
|
20
|
+
"rd:init": "relative-deps init",
|
|
21
|
+
"rd:add": "relative-deps add",
|
|
22
|
+
"rd:reload": "relative-deps",
|
|
23
|
+
"prepublishOnly": "npm run tsToJs"
|
|
24
|
+
},
|
|
25
|
+
"dependencies": {
|
|
26
|
+
"@shoelace-style/shoelace": "2.18.0",
|
|
27
|
+
"@types/ramda": "0.30.2",
|
|
28
|
+
"lit": "^3.2.1",
|
|
29
|
+
"ramda": "0.30.1",
|
|
30
|
+
"relative-deps": "^1.0.7",
|
|
31
|
+
"typescript": "^4.9.5",
|
|
32
|
+
"web-animations-js": "^2.3.2"
|
|
33
|
+
},
|
|
34
|
+
"peerDependencies": {
|
|
35
|
+
"@unicef-polymer/etools-unicef": ">=1.1.1"
|
|
36
|
+
},
|
|
37
|
+
"devDependencies": {
|
|
38
|
+
"@unicef-polymer/etools-unicef": "^1.1.1",
|
|
39
|
+
"@typescript-eslint/eslint-plugin": "^5.7.0",
|
|
40
|
+
"@typescript-eslint/parser": "^5.7.0",
|
|
41
|
+
"@typescript-eslint/typescript-estree": "^5.7.0",
|
|
42
|
+
"acorn": "^8.0.4",
|
|
43
|
+
"eslint": "^7.32.0",
|
|
44
|
+
"eslint-config-google": "^0.14.0",
|
|
45
|
+
"eslint-config-prettier": "^6.15.0",
|
|
46
|
+
"eslint-plugin-html": "^6.2.0",
|
|
47
|
+
"eslint-plugin-lit": "^1.6.1",
|
|
48
|
+
"eslint-plugin-prettier": "^3.4.1",
|
|
49
|
+
"prettier": "^2.3.2",
|
|
50
|
+
"minimist": ">=0.2.1",
|
|
51
|
+
"lodash": ">=4.17.21",
|
|
52
|
+
"ansi-regex": ">=5.0.1",
|
|
53
|
+
"glob-parent": ">=5.1.2"
|
|
54
|
+
}
|
|
55
|
+
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { FormAttachmentsPopup } from './form-attachments-popup';
|
|
2
|
-
import { TemplateResult } from 'lit';
|
|
3
|
-
import '@unicef-polymer/etools-unicef/src/etools-dialog/etools-dialog.js';
|
|
4
|
-
import '@unicef-polymer/etools-unicef/src/etools-dropdown/etools-dropdown.js';
|
|
5
|
-
import '@unicef-polymer/etools-unicef/src/etools-upload/etools-upload-multi';
|
|
6
|
-
import '@unicef-polymer/etools-unicef/src/etools-button/etools-button';
|
|
7
|
-
export declare function template(this: FormAttachmentsPopup): TemplateResult;
|
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
import { html } from 'lit';
|
|
2
|
-
import { InputStyles } from '../lib/styles/input-styles';
|
|
3
|
-
import { DialogStyles } from '../lib/styles/dialog.styles';
|
|
4
|
-
import { getTranslation } from '../lib/utils/translate';
|
|
5
|
-
import '@unicef-polymer/etools-unicef/src/etools-dialog/etools-dialog.js';
|
|
6
|
-
import '@unicef-polymer/etools-unicef/src/etools-dropdown/etools-dropdown.js';
|
|
7
|
-
import '@unicef-polymer/etools-unicef/src/etools-upload/etools-upload-multi';
|
|
8
|
-
import '@unicef-polymer/etools-unicef/src/etools-button/etools-button';
|
|
9
|
-
export function template() {
|
|
10
|
-
var _a;
|
|
11
|
-
return html `
|
|
12
|
-
${InputStyles} ${DialogStyles}
|
|
13
|
-
<style>
|
|
14
|
-
etools-icon[name='error-outline'] {
|
|
15
|
-
color: var(--etools-upload-danger-color, #ea4022);
|
|
16
|
-
}
|
|
17
|
-
</style>
|
|
18
|
-
<etools-dialog
|
|
19
|
-
id="form-attachments-dialog"
|
|
20
|
-
size="md"
|
|
21
|
-
no-padding
|
|
22
|
-
keep-dialog-open
|
|
23
|
-
?opened="${this.dialogOpened}"
|
|
24
|
-
.okBtnText="${getTranslation(this.language, 'SAVE')}"
|
|
25
|
-
.cancelBtnText="${getTranslation(this.language, 'CANCEL')}"
|
|
26
|
-
.hideConfirmBtn="${this.readonly}"
|
|
27
|
-
dialog-title="${this.popupTitle}"
|
|
28
|
-
@close="${this.onClose}"
|
|
29
|
-
@confirm-btn-clicked="${() => this.saveChanges()}"
|
|
30
|
-
>
|
|
31
|
-
<!-- Link is used to download attachments -->
|
|
32
|
-
<a id="link" target="_blank" hidden></a>
|
|
33
|
-
|
|
34
|
-
<div class="popup-container">
|
|
35
|
-
${(_a = this.attachments) === null || _a === void 0 ? void 0 : _a.map((attachment, index) => {
|
|
36
|
-
var _a, _b;
|
|
37
|
-
return html `
|
|
38
|
-
<div class="file-selector-container with-type-dropdown">
|
|
39
|
-
<!-- Type select Dropdown -->
|
|
40
|
-
<etools-dropdown
|
|
41
|
-
class="type-dropdown file-selector__type-dropdown"
|
|
42
|
-
.selected="${attachment.file_type}"
|
|
43
|
-
@etools-selected-item-changed="${({ detail }) => { var _a; return this.changeFileType(attachment, (_a = detail.selectedItem) === null || _a === void 0 ? void 0 : _a.value, index); }}"
|
|
44
|
-
trigger-value-change-event
|
|
45
|
-
label="${getTranslation(this.language, 'DOCUMENT_TYPE')}"
|
|
46
|
-
placeholder="${getTranslation(this.language, 'SELECT_DOCUMENT_TYPE')}"
|
|
47
|
-
required
|
|
48
|
-
?readonly="${this.readonly}"
|
|
49
|
-
hide-search
|
|
50
|
-
.options="${(_b = (_a = this.metadata) === null || _a === void 0 ? void 0 : _a.options.target_attachments_file_types) === null || _b === void 0 ? void 0 : _b.values}"
|
|
51
|
-
option-label="label"
|
|
52
|
-
option-value="value"
|
|
53
|
-
?invalid="${this.checkFileType(index)}"
|
|
54
|
-
.errorMessage="${this.retrieveErrorMessage(index)}"
|
|
55
|
-
allow-outside-scroll
|
|
56
|
-
dynamic-align
|
|
57
|
-
></etools-dropdown>
|
|
58
|
-
|
|
59
|
-
<!-- File name component -->
|
|
60
|
-
<div class="filename-container file-selector__filename">
|
|
61
|
-
<etools-icon class="file-icon" name="attachment"></etools-icon>
|
|
62
|
-
<span class="filename" title="${attachment.filename}">${attachment.filename}</span>
|
|
63
|
-
</div>
|
|
64
|
-
|
|
65
|
-
<!-- Download Button -->
|
|
66
|
-
<etools-button
|
|
67
|
-
variant="text"
|
|
68
|
-
?hidden="${!attachment.url}"
|
|
69
|
-
class="download-button file-selector__download"
|
|
70
|
-
@click="${() => this.downloadFile(attachment)}"
|
|
71
|
-
>
|
|
72
|
-
<etools-icon name="cloud-download" class="dw-icon" slot="prefix"></etools-icon>
|
|
73
|
-
${getTranslation(this.language, 'DOWNLOAD')}
|
|
74
|
-
</etools-button>
|
|
75
|
-
|
|
76
|
-
<!-- Delete Button -->
|
|
77
|
-
<etools-button
|
|
78
|
-
variant="text"
|
|
79
|
-
class="danger file-selector__delete"
|
|
80
|
-
?hidden="${this.readonly}"
|
|
81
|
-
@click="${() => this.deleteAttachment(index)}"
|
|
82
|
-
>
|
|
83
|
-
${getTranslation(this.language, 'DELETE')}
|
|
84
|
-
</etools-button>
|
|
85
|
-
</div>
|
|
86
|
-
`;
|
|
87
|
-
})}
|
|
88
|
-
|
|
89
|
-
<!-- Upload button -->
|
|
90
|
-
<etools-upload-multi
|
|
91
|
-
class="with-padding"
|
|
92
|
-
activate-offline
|
|
93
|
-
?hidden="${this.readonly}"
|
|
94
|
-
@upload-finished="${({ detail }) => this.attachmentsUploaded(detail)}"
|
|
95
|
-
.endpointInfo="${{ endpoint: this.uploadUrl, extraInfo: { composedPath: this.computedPath } }}"
|
|
96
|
-
.jwtLocalStorageKey="${this.jwtLocalStorageKey}"
|
|
97
|
-
>
|
|
98
|
-
</etools-upload-multi>
|
|
99
|
-
</div>
|
|
100
|
-
</etools-dialog>
|
|
101
|
-
`;
|
|
102
|
-
}
|
|
@@ -1,143 +0,0 @@
|
|
|
1
|
-
import { html } from 'lit';
|
|
2
|
-
// language=HTML
|
|
3
|
-
export const InputStyles = html `
|
|
4
|
-
<style>
|
|
5
|
-
etools-dropdown,
|
|
6
|
-
etools-dropdown-multi,
|
|
7
|
-
paper-input,
|
|
8
|
-
paper-textarea,
|
|
9
|
-
paper-dropdown-menu,
|
|
10
|
-
etools-currency-amount-input,
|
|
11
|
-
datepicker-lite {
|
|
12
|
-
outline: none !important;
|
|
13
|
-
padding: 0 12px;
|
|
14
|
-
color: var(--gray-dark, rgba(0, 0, 0, 0.87));
|
|
15
|
-
box-sizing: border-box;
|
|
16
|
-
|
|
17
|
-
--paper-input-container-input-color: var(--gray-dark, rgba(0, 0, 0, 0.87));
|
|
18
|
-
--esmm-placeholder-color: var(--gray-dark, rgba(0, 0, 0, 0.87));
|
|
19
|
-
--esmm-multi-placeholder-color: var(--gray-dark, rgba(0, 0, 0, 0.87));
|
|
20
|
-
|
|
21
|
-
--paper-input-container-focus-color: var(--primary-color, #0099ff);
|
|
22
|
-
|
|
23
|
-
--paper-input-container-label: {
|
|
24
|
-
color: var(--gray-50, rgba(0, 0, 0, 0.5));
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
--paper-input-container-invalid-color: var(--module-error, #ea4022);
|
|
28
|
-
|
|
29
|
-
--paper-input-char-counter: {
|
|
30
|
-
color: var(--gray-light, rgba(0, 0, 0, 0.38));
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
--paper-input-container-label-floating: {
|
|
34
|
-
-webkit-transform: none;
|
|
35
|
-
-moz-transform: none;
|
|
36
|
-
-ms-transform: none;
|
|
37
|
-
-o-transform: none;
|
|
38
|
-
transform: none;
|
|
39
|
-
top: -21px;
|
|
40
|
-
width: 100%;
|
|
41
|
-
font-size: 12px;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
--etools-currency-container-label-floating: {
|
|
45
|
-
-webkit-transform: none;
|
|
46
|
-
-moz-transform: none;
|
|
47
|
-
-ms-transform: none;
|
|
48
|
-
-o-transform: none;
|
|
49
|
-
transform: none;
|
|
50
|
-
top: -21px;
|
|
51
|
-
width: 100%;
|
|
52
|
-
font-size: 12px;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
--paper-input-container-shared-input-style: {
|
|
56
|
-
font-size: 16px;
|
|
57
|
-
width: 100%;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
--paper-input-prefix: {
|
|
61
|
-
margin-right: 10px;
|
|
62
|
-
color: var(--gray-mid, rgba(0, 0, 0, 0.54));
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
--paper-input-error: {
|
|
66
|
-
overflow: hidden;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
--iron-autogrow-textarea: {
|
|
70
|
-
padding: 0;
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
etools-dropdown-multi[disabled],
|
|
75
|
-
etools-dropdown[disabled],
|
|
76
|
-
paper-textarea[disabled],
|
|
77
|
-
paper-dropdown-menu[disabled],
|
|
78
|
-
paper-input[disabled],
|
|
79
|
-
datepicker-lite[disabled] {
|
|
80
|
-
--paper-input-container: {
|
|
81
|
-
opacity: 1 !important;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
--paper-input-container-underline-focus: {
|
|
85
|
-
display: none;
|
|
86
|
-
}
|
|
87
|
-
--esmm-select-cursor: initial;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
etools-dropdown-multi[readonly],
|
|
91
|
-
etools-dropdown[readonly],
|
|
92
|
-
paper-textarea[readonly],
|
|
93
|
-
paper-dropdown-menu[readonly],
|
|
94
|
-
paper-input[readonly],
|
|
95
|
-
datepicker-lite[readonly] {
|
|
96
|
-
--paper-input-container-underline_-_display: none;
|
|
97
|
-
--paper-input-container-underline-focus_-_display: none;
|
|
98
|
-
--paper-input-container: {
|
|
99
|
-
opacity: 1 !important;
|
|
100
|
-
}
|
|
101
|
-
--paper-input-container-underline: {
|
|
102
|
-
border-bottom: none !important;
|
|
103
|
-
display: none !important;
|
|
104
|
-
}
|
|
105
|
-
--paper-input-container-underline-focus: {
|
|
106
|
-
display: none;
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
--esmm-select-cursor: initial;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
etools-dropdown-multi.required:not([disabled]),
|
|
113
|
-
etools-dropdown-multi[required]:not([disabled]),
|
|
114
|
-
etools-dropdown-multi[required].readonly-required,
|
|
115
|
-
etools-dropdown.required:not([disabled]),
|
|
116
|
-
etools-dropdown[required]:not([disabled]),
|
|
117
|
-
etools-dropdown[required].readonly-required,
|
|
118
|
-
paper-dropdown-menu.required:not([disabled]),
|
|
119
|
-
paper-dropdown-menu[required]:not([disabled]),
|
|
120
|
-
paper-dropdown-menu[required].readonly-required,
|
|
121
|
-
paper-textarea.required:not([disabled]),
|
|
122
|
-
paper-textarea[required]:not([disabled]),
|
|
123
|
-
paper-textarea[required].readonly-required,
|
|
124
|
-
paper-input.required:not([disabled]),
|
|
125
|
-
paper-input[required].readonly-required,
|
|
126
|
-
paper-input[required]:not([disabled]) {
|
|
127
|
-
--paper-input-container-label: {
|
|
128
|
-
background: url('data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%221235%22%20height%3D%221175%22%3E%3Cpath%20fill%3D%22%23de0000%22%20d%3D%22M0%2C449h1235l-999%2C726%20382-1175%20382%2C1175z%22%2F%3E%3C%2Fsvg%3E')
|
|
129
|
-
no-repeat 98% 14%/7px;
|
|
130
|
-
width: auto !important;
|
|
131
|
-
max-width: max-content;
|
|
132
|
-
right: auto;
|
|
133
|
-
padding-right: 15px;
|
|
134
|
-
color: var(--gray-50, rgba(0, 0, 0, 0.5));
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
sl-radio {
|
|
138
|
-
display: inline-block;
|
|
139
|
-
margin-inline-end: 15px;
|
|
140
|
-
--sl-input-font-size-medium: 14px;
|
|
141
|
-
}
|
|
142
|
-
</style>
|
|
143
|
-
`;
|