@unicef-polymer/etools-form-builder 2.1.8 → 2.1.9

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.
Files changed (87) hide show
  1. package/LICENSE +674 -674
  2. package/README.md +1 -1
  3. package/dist/assets/translations.d.ts +6 -6
  4. package/dist/assets/translations.js +67 -67
  5. package/dist/form-attachments-popup/form-attachments-popup.d.ts +86 -86
  6. package/dist/form-attachments-popup/form-attachments-popup.helper.d.ts +8 -8
  7. package/dist/form-attachments-popup/form-attachments-popup.helper.js +14 -14
  8. package/dist/form-attachments-popup/form-attachments-popup.js +255 -255
  9. package/dist/form-attachments-popup/form-attachments-popup.tpl.d.ts +3 -3
  10. package/dist/form-attachments-popup/form-attachments-popup.tpl.js +91 -91
  11. package/dist/form-attachments-popup/index.d.ts +2 -2
  12. package/dist/form-attachments-popup/index.js +2 -2
  13. package/dist/form-fields/abstract-field-base.class.d.ts +33 -33
  14. package/dist/form-fields/abstract-field-base.class.js +213 -213
  15. package/dist/form-fields/field-renderer-component.d.ts +20 -20
  16. package/dist/form-fields/field-renderer-component.js +255 -255
  17. package/dist/form-fields/index.d.ts +12 -12
  18. package/dist/form-fields/index.js +12 -12
  19. package/dist/form-fields/repeatable-fields/repeatable-attachment-field.d.ts +17 -17
  20. package/dist/form-fields/repeatable-fields/repeatable-attachment-field.js +209 -209
  21. package/dist/form-fields/repeatable-fields/repeatable-base-field.d.ts +20 -20
  22. package/dist/form-fields/repeatable-fields/repeatable-base-field.js +124 -124
  23. package/dist/form-fields/repeatable-fields/repeatable-number-field.d.ts +10 -10
  24. package/dist/form-fields/repeatable-fields/repeatable-number-field.js +67 -67
  25. package/dist/form-fields/repeatable-fields/repeatable-scale-field.d.ts +15 -15
  26. package/dist/form-fields/repeatable-fields/repeatable-scale-field.js +108 -108
  27. package/dist/form-fields/repeatable-fields/repeatable-text-field.d.ts +8 -8
  28. package/dist/form-fields/repeatable-fields/repeatable-text-field.js +53 -53
  29. package/dist/form-fields/single-fields/attachment-field.d.ts +16 -16
  30. package/dist/form-fields/single-fields/attachment-field.js +98 -98
  31. package/dist/form-fields/single-fields/base-field.d.ts +11 -11
  32. package/dist/form-fields/single-fields/base-field.js +58 -58
  33. package/dist/form-fields/single-fields/boolean-field.d.ts +8 -8
  34. package/dist/form-fields/single-fields/boolean-field.js +49 -49
  35. package/dist/form-fields/single-fields/number-field.d.ts +10 -10
  36. package/dist/form-fields/single-fields/number-field.js +67 -67
  37. package/dist/form-fields/single-fields/scale-field.d.ts +18 -18
  38. package/dist/form-fields/single-fields/scale-field.js +108 -108
  39. package/dist/form-fields/single-fields/text-field.d.ts +8 -8
  40. package/dist/form-fields/single-fields/text-field.js +54 -54
  41. package/dist/form-groups/form-abstract-group.d.ts +71 -71
  42. package/dist/form-groups/form-abstract-group.js +398 -398
  43. package/dist/form-groups/form-card.d.ts +32 -32
  44. package/dist/form-groups/form-card.js +113 -113
  45. package/dist/form-groups/form-collapsed-card.d.ts +71 -71
  46. package/dist/form-groups/form-collapsed-card.js +259 -259
  47. package/dist/form-groups/index.d.ts +3 -3
  48. package/dist/form-groups/index.js +3 -3
  49. package/dist/index.d.ts +3 -3
  50. package/dist/index.js +3 -3
  51. package/dist/lib/additional-components/confirmation-dialog.d.ts +18 -18
  52. package/dist/lib/additional-components/confirmation-dialog.js +72 -72
  53. package/dist/lib/additional-components/etools-fb-card.d.ts +21 -21
  54. package/dist/lib/additional-components/etools-fb-card.js +239 -239
  55. package/dist/lib/styles/attachments.styles.d.ts +2 -2
  56. package/dist/lib/styles/attachments.styles.js +72 -72
  57. package/dist/lib/styles/card-styles.d.ts +2 -2
  58. package/dist/lib/styles/card-styles.js +154 -154
  59. package/dist/lib/styles/dialog.styles.d.ts +2 -2
  60. package/dist/lib/styles/dialog.styles.js +85 -85
  61. package/dist/lib/styles/elevation-styles.d.ts +9 -9
  62. package/dist/lib/styles/elevation-styles.js +43 -43
  63. package/dist/lib/styles/flex-layout-classes.d.ts +2 -2
  64. package/dist/lib/styles/flex-layout-classes.js +319 -319
  65. package/dist/lib/styles/form-builder-card.styles.d.ts +2 -2
  66. package/dist/lib/styles/form-builder-card.styles.js +49 -49
  67. package/dist/lib/styles/input-styles.d.ts +2 -2
  68. package/dist/lib/styles/input-styles.js +138 -138
  69. package/dist/lib/styles/page-layout-styles.d.ts +2 -2
  70. package/dist/lib/styles/page-layout-styles.js +201 -201
  71. package/dist/lib/styles/shared-styles.d.ts +2 -2
  72. package/dist/lib/styles/shared-styles.js +70 -70
  73. package/dist/lib/types/form-builder.interfaces.d.ts +83 -83
  74. package/dist/lib/types/form-builder.interfaces.js +0 -0
  75. package/dist/lib/types/form-builder.types.d.ts +59 -59
  76. package/dist/lib/types/form-builder.types.js +0 -0
  77. package/dist/lib/types/global.types.d.ts +4 -4
  78. package/dist/lib/types/global.types.js +0 -0
  79. package/dist/lib/utils/dialog.d.ts +10 -10
  80. package/dist/lib/utils/dialog.js +21 -21
  81. package/dist/lib/utils/fire-custom-event.d.ts +1 -1
  82. package/dist/lib/utils/fire-custom-event.js +7 -7
  83. package/dist/lib/utils/translate.d.ts +1 -1
  84. package/dist/lib/utils/translate.js +9 -9
  85. package/dist/lib/utils/validations.helper.d.ts +26 -26
  86. package/dist/lib/utils/validations.helper.js +42 -42
  87. package/package.json +56 -56
package/README.md CHANGED
@@ -1 +1 @@
1
- # Etools FM Form Builder Components
1
+ # Etools FM Form Builder Components
@@ -1,6 +1,6 @@
1
- declare const translations: {
2
- [lang: string]: {
3
- [key: string]: string;
4
- };
5
- };
6
- export default translations;
1
+ declare const translations: {
2
+ [lang: string]: {
3
+ [key: string]: string;
4
+ };
5
+ };
6
+ export default translations;
@@ -1,67 +1,67 @@
1
- const translations = {
2
- en: {
3
- SAVE: 'Save',
4
- DOWNLOAD: 'Download',
5
- CHANGE: 'Change',
6
- DELETE: 'Delete',
7
- CANCEL: 'Cancel',
8
- OK: 'Ok',
9
- ADD: 'Add',
10
- UPLOAD_ATTACHMENTS_FAILED: 'Can not upload attachments. Please try again later',
11
- REQUIRED_FIELD: 'This field is required',
12
- MUST_BE_INTEGER: 'Must be an integer',
13
- MUST_BE_NUMBER: 'Must be a number',
14
- CLEAR: 'Clear',
15
- GROUP_REQUIRED: 'Group is required. At least one group must exist',
16
- GROUP: 'group',
17
- THIS_GROUP: 'this group',
18
- CHECK_FIELDS_TRY_AGAIN: 'Please check all fields and try again',
19
- CONFIRM_DELETE: 'Are you sure you want to delete',
20
- UPLOAD_FILES: 'Upload Files',
21
- FILE: 'File',
22
- FILES: 'Files',
23
- ATTACHMENTS_FOR: 'Attachments for',
24
- PARTNER: 'Partner',
25
- CP_OUTPUT: 'CP Output',
26
- PD_SSFA: 'PD/SSFA',
27
- TEXT_MUST_BE_LESS_CHARS: 'Text must be less than {0} character',
28
- DOES_NOT_MATCH_PATTERN: 'Does not match allowed pattern',
29
- NUMBER_MUST_BE_GREATER_THAN: 'Number must be greater than {0}',
30
- NUMBER_MUST_BE_LOWER_THAN: 'Number must be lower than {0}',
31
- DOCUMENT_TYPE: 'Document type',
32
- SELECT_DOCUMENT_TYPE: 'Select Document Type'
33
- },
34
- fr: {
35
- SAVE: 'Sauvegarder',
36
- DOWNLOAD: 'Télécharger',
37
- CHANGE: 'Changer',
38
- DELETE: 'Effacer',
39
- CANCEL: 'Annuler',
40
- OK: "D'accord",
41
- ADD: 'Ajouter',
42
- UPLOAD_ATTACHMENTS_FAILED: 'Impossible de télécharger les pièces jointes. Veuillez réessayer plus tard',
43
- REQUIRED_FIELD: 'Ce champ est requis',
44
- MUST_BE_INTEGER: 'Doit être un entier',
45
- MUST_BE_NUMBER: 'Doit être un nombre',
46
- CLEAR: 'Dégager',
47
- GROUP_REQUIRED: 'Le groupe est requis. Au moins un groupe doit exister',
48
- GROUP: 'groupe',
49
- THIS_GROUP: 'ce groupe',
50
- CHECK_FIELDS_TRY_AGAIN: 'Veuillez vérifier tous les champs et réessayer',
51
- CONFIRM_DELETE: 'Etes-vous sûr que vous voulez supprimer',
52
- UPLOAD_FILES: 'Télécharger des fichiers',
53
- FILE: 'Dossier',
54
- FILES: 'Des dossiers',
55
- ATTACHMENTS_FOR: 'Pièces jointes pour',
56
- PARTNER: 'Partenaire',
57
- CP_OUTPUT: 'Sortie CP',
58
- PD_SSFA: 'PD/SSFA',
59
- TEXT_MUST_BE_LESS_CHARS: 'Le texte doit comporter moins de {0} caractères',
60
- DOES_NOT_MATCH_PATTERN: 'Ne correspond pas au modèle autorisé',
61
- NUMBER_MUST_BE_GREATER_THAN: 'Le nombre doit être supérieur à {0}',
62
- NUMBER_MUST_BE_LOWER_THAN: 'Le nombre doit être inférieur à {0}',
63
- DOCUMENT_TYPE: 'Type de document',
64
- SELECT_DOCUMENT_TYPE: 'Sélectionnez le type de document'
65
- }
66
- };
67
- export default translations;
1
+ const translations = {
2
+ en: {
3
+ SAVE: 'Save',
4
+ DOWNLOAD: 'Download',
5
+ CHANGE: 'Change',
6
+ DELETE: 'Delete',
7
+ CANCEL: 'Cancel',
8
+ OK: 'Ok',
9
+ ADD: 'Add',
10
+ UPLOAD_ATTACHMENTS_FAILED: 'Can not upload attachments. Please try again later',
11
+ REQUIRED_FIELD: 'This field is required',
12
+ MUST_BE_INTEGER: 'Must be an integer',
13
+ MUST_BE_NUMBER: 'Must be a number',
14
+ CLEAR: 'Clear',
15
+ GROUP_REQUIRED: 'Group is required. At least one group must exist',
16
+ GROUP: 'group',
17
+ THIS_GROUP: 'this group',
18
+ CHECK_FIELDS_TRY_AGAIN: 'Please check all fields and try again',
19
+ CONFIRM_DELETE: 'Are you sure you want to delete',
20
+ UPLOAD_FILES: 'Upload Files',
21
+ FILE: 'File',
22
+ FILES: 'Files',
23
+ ATTACHMENTS_FOR: 'Attachments for',
24
+ PARTNER: 'Partner',
25
+ CP_OUTPUT: 'CP Output',
26
+ PD_SPD: 'PD/SPD',
27
+ TEXT_MUST_BE_LESS_CHARS: 'Text must be less than {0} character',
28
+ DOES_NOT_MATCH_PATTERN: 'Does not match allowed pattern',
29
+ NUMBER_MUST_BE_GREATER_THAN: 'Number must be greater than {0}',
30
+ NUMBER_MUST_BE_LOWER_THAN: 'Number must be lower than {0}',
31
+ DOCUMENT_TYPE: 'Document type',
32
+ SELECT_DOCUMENT_TYPE: 'Select Document Type'
33
+ },
34
+ fr: {
35
+ SAVE: 'Sauvegarder',
36
+ DOWNLOAD: 'Télécharger',
37
+ CHANGE: 'Changer',
38
+ DELETE: 'Effacer',
39
+ CANCEL: 'Annuler',
40
+ OK: "D'accord",
41
+ ADD: 'Ajouter',
42
+ UPLOAD_ATTACHMENTS_FAILED: 'Impossible de télécharger les pièces jointes. Veuillez réessayer plus tard',
43
+ REQUIRED_FIELD: 'Ce champ est requis',
44
+ MUST_BE_INTEGER: 'Doit être un entier',
45
+ MUST_BE_NUMBER: 'Doit être un nombre',
46
+ CLEAR: 'Dégager',
47
+ GROUP_REQUIRED: 'Le groupe est requis. Au moins un groupe doit exister',
48
+ GROUP: 'groupe',
49
+ THIS_GROUP: 'ce groupe',
50
+ CHECK_FIELDS_TRY_AGAIN: 'Veuillez vérifier tous les champs et réessayer',
51
+ CONFIRM_DELETE: 'Etes-vous sûr que vous voulez supprimer',
52
+ UPLOAD_FILES: 'Télécharger des fichiers',
53
+ FILE: 'Dossier',
54
+ FILES: 'Des dossiers',
55
+ ATTACHMENTS_FOR: 'Pièces jointes pour',
56
+ PARTNER: 'Partenaire',
57
+ CP_OUTPUT: 'Sortie CP',
58
+ PD_SPD: 'PD/SPD',
59
+ TEXT_MUST_BE_LESS_CHARS: 'Le texte doit comporter moins de {0} caractères',
60
+ DOES_NOT_MATCH_PATTERN: 'Ne correspond pas au modèle autorisé',
61
+ NUMBER_MUST_BE_GREATER_THAN: 'Le nombre doit être supérieur à {0}',
62
+ NUMBER_MUST_BE_LOWER_THAN: 'Le nombre doit être inférieur à {0}',
63
+ DOCUMENT_TYPE: 'Type de document',
64
+ SELECT_DOCUMENT_TYPE: 'Sélectionnez le type de document'
65
+ }
66
+ };
67
+ export default translations;
@@ -1,86 +1,86 @@
1
- import '@unicef-polymer/etools-dialog/etools-dialog';
2
- import '@unicef-polymer/etools-upload/etools-upload-multi';
3
- import '@unicef-polymer/etools-dropdown/etools-dropdown';
4
- import '@polymer/paper-button/paper-button';
5
- import '@polymer/iron-icons/iron-icons';
6
- import { CSSResultArray, LitElement, TemplateResult } from 'lit-element';
7
- import { GenericObject } from '../lib/types/global.types';
8
- import { BlueprintMetadata } from '../lib/types/form-builder.types';
9
- export declare type FormBuilderAttachmentsPopupData = {
10
- attachments: StoredAttachment[];
11
- metadata: BlueprintMetadata;
12
- title: string;
13
- readonly?: boolean;
14
- computedPath: string[];
15
- errors: GenericObject[];
16
- };
17
- export declare type StoredAttachment = {
18
- attachment: string | number;
19
- filename: string;
20
- file_type: number | null;
21
- url?: string;
22
- composedPath?: string[];
23
- };
24
- export declare type UploadedAttachment = {
25
- id: number;
26
- object_link: string;
27
- file_type: string;
28
- file_link: string;
29
- filename: string;
30
- uploaded_by: string;
31
- created: string;
32
- attachment: number;
33
- };
34
- export declare type OfflineSavedAttachment = {
35
- id: string;
36
- filetype: string;
37
- filename: string;
38
- extraInfo: string[];
39
- unsynced: boolean;
40
- };
41
- export declare type UploadFinishedDetails = {
42
- success: (UploadedAttachment | OfflineSavedAttachment)[];
43
- error: any[];
44
- };
45
- export declare type SingleUploadFinishedDetails = {
46
- success: UploadedAttachment | OfflineSavedAttachment;
47
- error: any[];
48
- };
49
- export declare class FormAttachmentsPopup extends LitElement {
50
- dialogOpened: boolean;
51
- saveBtnClicked: boolean;
52
- attachments: StoredAttachment[];
53
- metadata: BlueprintMetadata;
54
- language: string;
55
- link: HTMLLinkElement;
56
- readonly: boolean;
57
- popupTitle: string;
58
- computedPath: string[];
59
- errors: GenericObject;
60
- /**
61
- * Array of offline saved fileIds that was remove from popup.
62
- * We need to remove them from IDB but only after confirm button click
63
- */
64
- private filesForRemove;
65
- private originalAttachments;
66
- set dialogData({ attachments, title, metadata, readonly, computedPath, errors }: FormBuilderAttachmentsPopupData);
67
- get uploadUrl(): string;
68
- get jwtLocalStorageKey(): string;
69
- constructor();
70
- render(): TemplateResult | void;
71
- /**
72
- * on Cancel button click
73
- * Remove offline saved attachments from IDB if they are missing in originalAttachments
74
- */
75
- onClose(): void;
76
- saveChanges(): Promise<void>;
77
- checkFileType(index: number): boolean;
78
- retrieveErrorMessage(index: number): string;
79
- protected downloadFile(attachment: GenericObject): void;
80
- protected changeFileType(attachment: GenericObject, newType: number | null, index: number): void;
81
- protected attachmentsUploaded({ success, error }: UploadFinishedDetails): void;
82
- protected deleteAttachment(index: number): void;
83
- private isUploadedAttachment;
84
- private isOfflineSavedAttachment;
85
- static get styles(): CSSResultArray;
86
- }
1
+ import '@unicef-polymer/etools-dialog/etools-dialog';
2
+ import '@unicef-polymer/etools-upload/etools-upload-multi';
3
+ import '@unicef-polymer/etools-dropdown/etools-dropdown';
4
+ import '@polymer/paper-button/paper-button';
5
+ import '@polymer/iron-icons/iron-icons';
6
+ import { CSSResultArray, LitElement, TemplateResult } from 'lit-element';
7
+ import { GenericObject } from '../lib/types/global.types';
8
+ import { BlueprintMetadata } from '../lib/types/form-builder.types';
9
+ export declare type FormBuilderAttachmentsPopupData = {
10
+ attachments: StoredAttachment[];
11
+ metadata: BlueprintMetadata;
12
+ title: string;
13
+ readonly?: boolean;
14
+ computedPath: string[];
15
+ errors: GenericObject[];
16
+ };
17
+ export declare type StoredAttachment = {
18
+ attachment: string | number;
19
+ filename: string;
20
+ file_type: number | null;
21
+ url?: string;
22
+ composedPath?: string[];
23
+ };
24
+ export declare type UploadedAttachment = {
25
+ id: number;
26
+ object_link: string;
27
+ file_type: string;
28
+ file_link: string;
29
+ filename: string;
30
+ uploaded_by: string;
31
+ created: string;
32
+ attachment: number;
33
+ };
34
+ export declare type OfflineSavedAttachment = {
35
+ id: string;
36
+ filetype: string;
37
+ filename: string;
38
+ extraInfo: string[];
39
+ unsynced: boolean;
40
+ };
41
+ export declare type UploadFinishedDetails = {
42
+ success: (UploadedAttachment | OfflineSavedAttachment)[];
43
+ error: any[];
44
+ };
45
+ export declare type SingleUploadFinishedDetails = {
46
+ success: UploadedAttachment | OfflineSavedAttachment;
47
+ error: any[];
48
+ };
49
+ export declare class FormAttachmentsPopup extends LitElement {
50
+ dialogOpened: boolean;
51
+ saveBtnClicked: boolean;
52
+ attachments: StoredAttachment[];
53
+ metadata: BlueprintMetadata;
54
+ language: string;
55
+ link: HTMLLinkElement;
56
+ readonly: boolean;
57
+ popupTitle: string;
58
+ computedPath: string[];
59
+ errors: GenericObject;
60
+ /**
61
+ * Array of offline saved fileIds that was remove from popup.
62
+ * We need to remove them from IDB but only after confirm button click
63
+ */
64
+ private filesForRemove;
65
+ private originalAttachments;
66
+ set dialogData({ attachments, title, metadata, readonly, computedPath, errors }: FormBuilderAttachmentsPopupData);
67
+ get uploadUrl(): string;
68
+ get jwtLocalStorageKey(): string;
69
+ constructor();
70
+ render(): TemplateResult | void;
71
+ /**
72
+ * on Cancel button click
73
+ * Remove offline saved attachments from IDB if they are missing in originalAttachments
74
+ */
75
+ onClose(): void;
76
+ saveChanges(): Promise<void>;
77
+ checkFileType(index: number): boolean;
78
+ retrieveErrorMessage(index: number): string;
79
+ protected downloadFile(attachment: GenericObject): void;
80
+ protected changeFileType(attachment: GenericObject, newType: number | null, index: number): void;
81
+ protected attachmentsUploaded({ success, error }: UploadFinishedDetails): void;
82
+ protected deleteAttachment(index: number): void;
83
+ private isUploadedAttachment;
84
+ private isOfflineSavedAttachment;
85
+ static get styles(): CSSResultArray;
86
+ }
@@ -1,8 +1,8 @@
1
- export declare class FormAttachmentsPopupHelper {
2
- get isInitialized(): boolean;
3
- uploadUrl: string | null;
4
- jwtLocalStorageKey?: string;
5
- initialize(uploadUrl: string, jwtLocalStorageKey?: string): void;
6
- }
7
- declare const AttachmentsHelper: FormAttachmentsPopupHelper;
8
- export { AttachmentsHelper };
1
+ export declare class FormAttachmentsPopupHelper {
2
+ get isInitialized(): boolean;
3
+ uploadUrl: string | null;
4
+ jwtLocalStorageKey?: string;
5
+ initialize(uploadUrl: string, jwtLocalStorageKey?: string): void;
6
+ }
7
+ declare const AttachmentsHelper: FormAttachmentsPopupHelper;
8
+ export { AttachmentsHelper };
@@ -1,14 +1,14 @@
1
- export class FormAttachmentsPopupHelper {
2
- constructor() {
3
- this.uploadUrl = null;
4
- }
5
- get isInitialized() {
6
- return Boolean(this.uploadUrl);
7
- }
8
- initialize(uploadUrl, jwtLocalStorageKey) {
9
- this.uploadUrl = uploadUrl;
10
- this.jwtLocalStorageKey = jwtLocalStorageKey;
11
- }
12
- }
13
- const AttachmentsHelper = new FormAttachmentsPopupHelper();
14
- export { AttachmentsHelper };
1
+ export class FormAttachmentsPopupHelper {
2
+ constructor() {
3
+ this.uploadUrl = null;
4
+ }
5
+ get isInitialized() {
6
+ return Boolean(this.uploadUrl);
7
+ }
8
+ initialize(uploadUrl, jwtLocalStorageKey) {
9
+ this.uploadUrl = uploadUrl;
10
+ this.jwtLocalStorageKey = jwtLocalStorageKey;
11
+ }
12
+ }
13
+ const AttachmentsHelper = new FormAttachmentsPopupHelper();
14
+ export { AttachmentsHelper };