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

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 (82) hide show
  1. package/dist/assets/translations.d.ts +6 -6
  2. package/dist/assets/translations.js +67 -67
  3. package/dist/form-attachments-popup/form-attachments-popup.d.ts +86 -86
  4. package/dist/form-attachments-popup/form-attachments-popup.helper.d.ts +8 -8
  5. package/dist/form-attachments-popup/form-attachments-popup.helper.js +14 -14
  6. package/dist/form-attachments-popup/form-attachments-popup.js +207 -207
  7. package/dist/form-attachments-popup/form-attachments-popup.tpl.d.ts +3 -3
  8. package/dist/form-attachments-popup/form-attachments-popup.tpl.js +11 -11
  9. package/dist/form-attachments-popup/index.d.ts +2 -2
  10. package/dist/form-attachments-popup/index.js +2 -2
  11. package/dist/form-fields/abstract-field-base.class.d.ts +33 -33
  12. package/dist/form-fields/abstract-field-base.class.js +98 -98
  13. package/dist/form-fields/field-renderer-component.d.ts +20 -20
  14. package/dist/form-fields/field-renderer-component.js +108 -108
  15. package/dist/form-fields/index.d.ts +12 -12
  16. package/dist/form-fields/index.js +12 -12
  17. package/dist/form-fields/repeatable-fields/repeatable-attachment-field.d.ts +17 -17
  18. package/dist/form-fields/repeatable-fields/repeatable-attachment-field.js +100 -100
  19. package/dist/form-fields/repeatable-fields/repeatable-base-field.d.ts +20 -20
  20. package/dist/form-fields/repeatable-fields/repeatable-base-field.js +102 -102
  21. package/dist/form-fields/repeatable-fields/repeatable-number-field.d.ts +10 -10
  22. package/dist/form-fields/repeatable-fields/repeatable-number-field.js +47 -47
  23. package/dist/form-fields/repeatable-fields/repeatable-scale-field.d.ts +15 -15
  24. package/dist/form-fields/repeatable-fields/repeatable-scale-field.js +49 -49
  25. package/dist/form-fields/repeatable-fields/repeatable-text-field.d.ts +8 -8
  26. package/dist/form-fields/repeatable-fields/repeatable-text-field.js +30 -30
  27. package/dist/form-fields/single-fields/attachment-field.d.ts +16 -16
  28. package/dist/form-fields/single-fields/attachment-field.js +85 -85
  29. package/dist/form-fields/single-fields/base-field.d.ts +11 -11
  30. package/dist/form-fields/single-fields/base-field.js +58 -58
  31. package/dist/form-fields/single-fields/boolean-field.d.ts +8 -8
  32. package/dist/form-fields/single-fields/boolean-field.js +29 -29
  33. package/dist/form-fields/single-fields/number-field.d.ts +10 -10
  34. package/dist/form-fields/single-fields/number-field.js +46 -46
  35. package/dist/form-fields/single-fields/scale-field.d.ts +18 -18
  36. package/dist/form-fields/single-fields/scale-field.js +52 -52
  37. package/dist/form-fields/single-fields/text-field.d.ts +8 -8
  38. package/dist/form-fields/single-fields/text-field.js +29 -29
  39. package/dist/form-groups/form-abstract-group.d.ts +71 -65
  40. package/dist/form-groups/form-abstract-group.js +278 -255
  41. package/dist/form-groups/form-card.d.ts +32 -32
  42. package/dist/form-groups/form-card.js +89 -89
  43. package/dist/form-groups/form-collapsed-card.d.ts +71 -70
  44. package/dist/form-groups/form-collapsed-card.js +230 -225
  45. package/dist/form-groups/index.d.ts +3 -3
  46. package/dist/form-groups/index.js +3 -3
  47. package/dist/index.d.ts +3 -3
  48. package/dist/index.js +3 -3
  49. package/dist/lib/additional-components/confirmation-dialog.d.ts +18 -18
  50. package/dist/lib/additional-components/confirmation-dialog.js +52 -52
  51. package/dist/lib/additional-components/etools-fb-card.d.ts +21 -21
  52. package/dist/lib/additional-components/etools-fb-card.js +100 -99
  53. package/dist/lib/styles/attachments.styles.d.ts +2 -2
  54. package/dist/lib/styles/attachments.styles.js +3 -3
  55. package/dist/lib/styles/card-styles.d.ts +2 -2
  56. package/dist/lib/styles/card-styles.js +3 -3
  57. package/dist/lib/styles/dialog.styles.d.ts +2 -2
  58. package/dist/lib/styles/dialog.styles.js +3 -3
  59. package/dist/lib/styles/elevation-styles.d.ts +9 -9
  60. package/dist/lib/styles/elevation-styles.js +10 -10
  61. package/dist/lib/styles/flex-layout-classes.d.ts +2 -2
  62. package/dist/lib/styles/flex-layout-classes.js +3 -3
  63. package/dist/lib/styles/form-builder-card.styles.d.ts +2 -2
  64. package/dist/lib/styles/form-builder-card.styles.js +3 -3
  65. package/dist/lib/styles/input-styles.d.ts +2 -2
  66. package/dist/lib/styles/input-styles.js +3 -3
  67. package/dist/lib/styles/page-layout-styles.d.ts +2 -2
  68. package/dist/lib/styles/page-layout-styles.js +3 -3
  69. package/dist/lib/styles/shared-styles.d.ts +2 -2
  70. package/dist/lib/styles/shared-styles.js +3 -3
  71. package/dist/lib/types/form-builder.interfaces.d.ts +83 -83
  72. package/dist/lib/types/form-builder.types.d.ts +59 -59
  73. package/dist/lib/types/global.types.d.ts +4 -4
  74. package/dist/lib/utils/dialog.d.ts +10 -10
  75. package/dist/lib/utils/dialog.js +21 -21
  76. package/dist/lib/utils/fire-custom-event.d.ts +1 -1
  77. package/dist/lib/utils/fire-custom-event.js +7 -7
  78. package/dist/lib/utils/translate.d.ts +1 -1
  79. package/dist/lib/utils/translate.js +9 -9
  80. package/dist/lib/utils/validations.helper.d.ts +26 -26
  81. package/dist/lib/utils/validations.helper.js +42 -42
  82. package/package.json +1 -1
@@ -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_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,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 };