coer-elements 0.0.23 → 0.0.24
Sign up to get free protection for your applications and to get access to all the features.
- package/components/index.d.ts +5 -0
- package/components/lib/coer-button/coer-button.component.d.ts +44 -0
- package/components/lib/coer-checkbox/coer-checkbox.component.d.ts +28 -0
- package/components/lib/coer-filebox/coer-filebox.component.d.ts +33 -0
- package/components/lib/coer-form/coer-form.component.d.ts +33 -0
- package/components/lib/coer-grid/coer-grid.component.d.ts +53 -0
- package/components/lib/coer-grid/coer-grid.extension.d.ts +103 -0
- package/components/lib/coer-grid/coer-grid.templates.d.ts +9 -0
- package/components/lib/coer-modal/coer-modal.component.d.ts +38 -0
- package/components/lib/coer-numberbox/coer-numberbox.component.d.ts +55 -0
- package/components/lib/coer-page-title/coer-page-title.component.d.ts +12 -0
- package/components/lib/coer-selectbox/coer-selectbox.component.d.ts +75 -0
- package/components/lib/coer-switch/coer-switch.component.d.ts +31 -0
- package/components/lib/coer-tab/coer-tab.component.d.ts +35 -0
- package/components/lib/coer-textarea/coer-textarea.component.d.ts +51 -0
- package/components/lib/coer-textbox/coer-textbox.component.d.ts +57 -0
- package/components/lib/components.module.d.ts +30 -0
- package/components/public-api.d.ts +15 -0
- package/directives/index.d.ts +5 -0
- package/directives/lib/coer-ref.directive.d.ts +14 -0
- package/directives/lib/directives.module.d.ts +8 -0
- package/directives/lib/life-cycle.directive.d.ts +16 -0
- package/directives/public-api.d.ts +3 -0
- package/esm2022/components/coer-elements-components.mjs +5 -0
- package/esm2022/components/lib/coer-button/coer-button.component.mjs +133 -0
- package/esm2022/components/lib/coer-checkbox/coer-checkbox.component.mjs +83 -0
- package/esm2022/components/lib/coer-filebox/coer-filebox.component.mjs +102 -0
- package/esm2022/components/lib/coer-form/coer-form.component.mjs +101 -0
- package/esm2022/components/lib/coer-grid/coer-grid.component.mjs +512 -0
- package/esm2022/components/lib/coer-grid/coer-grid.extension.mjs +408 -0
- package/esm2022/components/lib/coer-grid/coer-grid.templates.mjs +30 -0
- package/esm2022/components/lib/coer-modal/coer-modal.component.mjs +107 -0
- package/esm2022/components/lib/coer-numberbox/coer-numberbox.component.mjs +258 -0
- package/esm2022/components/lib/coer-page-title/coer-page-title.component.mjs +44 -0
- package/esm2022/components/lib/coer-selectbox/coer-selectbox.component.mjs +338 -0
- package/esm2022/components/lib/coer-switch/coer-switch.component.mjs +93 -0
- package/esm2022/components/lib/coer-tab/coer-tab.component.mjs +116 -0
- package/esm2022/components/lib/coer-textarea/coer-textarea.component.mjs +156 -0
- package/esm2022/components/lib/coer-textbox/coer-textbox.component.mjs +195 -0
- package/esm2022/components/lib/components.module.mjs +129 -0
- package/esm2022/components/public-api.mjs +16 -0
- package/esm2022/directives/coer-elements-directives.mjs +5 -0
- package/esm2022/directives/lib/coer-ref.directive.mjs +23 -0
- package/esm2022/directives/lib/directives.module.mjs +25 -0
- package/esm2022/directives/lib/life-cycle.directive.mjs +33 -0
- package/esm2022/directives/public-api.mjs +4 -0
- package/esm2022/interfaces/coer-elements-interfaces.mjs +5 -0
- package/esm2022/interfaces/lib/app-source.interface.mjs +2 -0
- package/esm2022/interfaces/lib/coer-filebox/file-image.interface.mjs +2 -0
- package/esm2022/interfaces/lib/coer-filebox/file.interface.mjs +2 -0
- package/esm2022/interfaces/lib/coer-grid/grid-button-by-row.interface.mjs +2 -0
- package/esm2022/interfaces/lib/coer-grid/grid-checkbox.interface.mjs +2 -0
- package/esm2022/interfaces/lib/coer-grid/grid-coer-numberbox.interface.mjs +2 -0
- package/esm2022/interfaces/lib/coer-grid/grid-coer-selectbox.interface.mjs +2 -0
- package/esm2022/interfaces/lib/coer-grid/grid-coer-switch.interface.mjs +2 -0
- package/esm2022/interfaces/lib/coer-grid/grid-coer-textbox.interface.mjs +2 -0
- package/esm2022/interfaces/lib/coer-grid/grid-column.interface.mjs +2 -0
- package/esm2022/interfaces/lib/coer-grid/grid-data-source.interface.mjs +2 -0
- package/esm2022/interfaces/lib/coer-grid/grid-header-button.interface.mjs +2 -0
- package/esm2022/interfaces/lib/coer-grid/grid-header-export-button.interface.mjs +2 -0
- package/esm2022/interfaces/lib/coer-grid/grid-header.interface.mjs +2 -0
- package/esm2022/interfaces/lib/coer-grid/grid-import.interface.mjs +2 -0
- package/esm2022/interfaces/lib/coer-grid/grid-input-checkbox.interface.mjs +2 -0
- package/esm2022/interfaces/lib/coer-grid/grid-input-switch-change.interface.mjs +2 -0
- package/esm2022/interfaces/lib/coer-grid/grid-input-textbox.interface.mjs +2 -0
- package/esm2022/interfaces/lib/coer-grid/grid-item.interface.mjs +2 -0
- package/esm2022/interfaces/lib/coer-grid/grid-keyup-enter.interface.mjs +2 -0
- package/esm2022/interfaces/lib/coer-grid/grid-length.interface.mjs +2 -0
- package/esm2022/interfaces/lib/coer-grid/grid-search.interface.mjs +2 -0
- package/esm2022/interfaces/lib/coer-grid/grid-sort.interface.mjs +2 -0
- package/esm2022/interfaces/lib/coer-menu/menu-option-selected.interface.mjs +2 -0
- package/esm2022/interfaces/lib/coer-menu/menu-selected.interface.mjs +2 -0
- package/esm2022/interfaces/lib/coer-menu/menu.interface.mjs +2 -0
- package/esm2022/interfaces/lib/coer-ref.interface.mjs +2 -0
- package/esm2022/interfaces/lib/page-title/breadcrumb.interface.mjs +2 -0
- package/esm2022/interfaces/lib/page-title/go-back.interface.mjs +2 -0
- package/esm2022/interfaces/lib/screen-size.interface.mjs +2 -0
- package/esm2022/interfaces/lib/service/http-request.interface.mjs +2 -0
- package/esm2022/interfaces/lib/service/http-response.interface.mjs +2 -0
- package/esm2022/interfaces/lib/service/patch.interface.mjs +2 -0
- package/esm2022/interfaces/public-api.mjs +39 -0
- package/esm2022/pipes/coer-elements-pipes.mjs +5 -0
- package/esm2022/pipes/lib/html.pipe.mjs +18 -0
- package/esm2022/pipes/lib/no-image.pipe.mjs +23 -0
- package/esm2022/pipes/lib/numeric-format.pipe.mjs +15 -0
- package/esm2022/pipes/lib/pipes.module.mjs +31 -0
- package/esm2022/pipes/public-api.mjs +5 -0
- package/esm2022/signals/coer-elements-signals.mjs +5 -0
- package/esm2022/signals/lib/breakpoint.signal.mjs +4 -0
- package/esm2022/signals/lib/is-loading.signal.mjs +3 -0
- package/esm2022/signals/lib/is-menu-open.signal.mjs +3 -0
- package/esm2022/signals/lib/is-modal-open.signal.mjs +3 -0
- package/esm2022/signals/lib/menu.signal.mjs +3 -0
- package/esm2022/signals/public-api.mjs +6 -0
- package/esm2022/tools/coer-elements-tools.mjs +5 -0
- package/esm2022/tools/lib/breadcrumbs.class.mjs +63 -0
- package/esm2022/tools/lib/coer-alert/coer-alert.component.mjs +228 -0
- package/esm2022/tools/lib/control-value.class.mjs +46 -0
- package/esm2022/tools/lib/date-time.class.mjs +29 -0
- package/esm2022/tools/lib/files.class.mjs +91 -0
- package/esm2022/tools/lib/menu.class.mjs +23 -0
- package/esm2022/tools/lib/page.class.mjs +156 -0
- package/esm2022/tools/lib/screen.class.mjs +51 -0
- package/esm2022/tools/lib/service.class.mjs +247 -0
- package/esm2022/tools/lib/source.class.mjs +80 -0
- package/esm2022/tools/lib/tools.mjs +220 -0
- package/esm2022/tools/public-api.mjs +12 -0
- package/fesm2022/coer-elements-components.mjs +2718 -0
- package/fesm2022/coer-elements-components.mjs.map +1 -0
- package/fesm2022/coer-elements-directives.mjs +82 -0
- package/fesm2022/coer-elements-directives.mjs.map +1 -0
- package/fesm2022/coer-elements-interfaces.mjs +6 -0
- package/fesm2022/coer-elements-interfaces.mjs.map +1 -0
- package/fesm2022/coer-elements-pipes.mjs +83 -0
- package/fesm2022/coer-elements-pipes.mjs.map +1 -0
- package/fesm2022/coer-elements-signals.mjs +19 -0
- package/fesm2022/coer-elements-signals.mjs.map +1 -0
- package/fesm2022/coer-elements-tools.mjs +1223 -0
- package/fesm2022/coer-elements-tools.mjs.map +1 -0
- package/interfaces/index.d.ts +5 -0
- package/interfaces/lib/app-source.interface.d.ts +4 -0
- package/interfaces/lib/coer-filebox/file-image.interface.d.ts +14 -0
- package/interfaces/lib/coer-filebox/file.interface.d.ts +5 -0
- package/interfaces/lib/coer-grid/grid-button-by-row.interface.d.ts +6 -0
- package/interfaces/lib/coer-grid/grid-checkbox.interface.d.ts +5 -0
- package/interfaces/lib/coer-grid/grid-coer-numberbox.interface.d.ts +12 -0
- package/interfaces/lib/coer-grid/grid-coer-selectbox.interface.d.ts +9 -0
- package/interfaces/lib/coer-grid/grid-coer-switch.interface.d.ts +6 -0
- package/interfaces/lib/coer-grid/grid-coer-textbox.interface.d.ts +11 -0
- package/interfaces/lib/coer-grid/grid-column.interface.d.ts +22 -0
- package/interfaces/lib/coer-grid/grid-data-source.interface.d.ts +6 -0
- package/interfaces/lib/coer-grid/grid-header-button.interface.d.ts +8 -0
- package/interfaces/lib/coer-grid/grid-header-export-button.interface.d.ts +10 -0
- package/interfaces/lib/coer-grid/grid-header.interface.d.ts +5 -0
- package/interfaces/lib/coer-grid/grid-import.interface.d.ts +4 -0
- package/interfaces/lib/coer-grid/grid-input-checkbox.interface.d.ts +5 -0
- package/interfaces/lib/coer-grid/grid-input-switch-change.interface.d.ts +5 -0
- package/interfaces/lib/coer-grid/grid-input-textbox.interface.d.ts +5 -0
- package/interfaces/lib/coer-grid/grid-item.interface.d.ts +5 -0
- package/interfaces/lib/coer-grid/grid-keyup-enter.interface.d.ts +6 -0
- package/interfaces/lib/coer-grid/grid-length.interface.d.ts +5 -0
- package/interfaces/lib/coer-grid/grid-search.interface.d.ts +4 -0
- package/interfaces/lib/coer-grid/grid-sort.interface.d.ts +5 -0
- package/interfaces/lib/coer-menu/menu-option-selected.interface.d.ts +9 -0
- package/interfaces/lib/coer-menu/menu-selected.interface.d.ts +10 -0
- package/interfaces/lib/coer-menu/menu.interface.d.ts +6 -0
- package/interfaces/lib/coer-ref.interface.d.ts +10 -0
- package/interfaces/lib/page-title/breadcrumb.interface.d.ts +6 -0
- package/interfaces/lib/page-title/go-back.interface.d.ts +6 -0
- package/interfaces/lib/screen-size.interface.d.ts +5 -0
- package/interfaces/lib/service/http-request.interface.d.ts +10 -0
- package/interfaces/lib/service/http-response.interface.d.ts +6 -0
- package/interfaces/lib/service/patch.interface.d.ts +5 -0
- package/interfaces/public-api.d.ts +33 -0
- package/package.json +37 -1
- package/pipes/index.d.ts +5 -0
- package/pipes/lib/html.pipe.d.ts +10 -0
- package/pipes/lib/no-image.pipe.d.ts +7 -0
- package/pipes/lib/numeric-format.pipe.d.ts +7 -0
- package/pipes/lib/pipes.module.d.ts +9 -0
- package/pipes/public-api.d.ts +4 -0
- package/signals/index.d.ts +5 -0
- package/signals/lib/breakpoint.signal.d.ts +1 -0
- package/signals/lib/is-loading.signal.d.ts +1 -0
- package/signals/lib/is-menu-open.signal.d.ts +1 -0
- package/signals/lib/is-modal-open.signal.d.ts +1 -0
- package/signals/lib/menu.signal.d.ts +2 -0
- package/signals/public-api.d.ts +5 -0
- package/tools/index.d.ts +5 -0
- package/tools/lib/breadcrumbs.class.d.ts +18 -0
- package/tools/lib/coer-alert/coer-alert.component.d.ts +23 -0
- package/tools/lib/control-value.class.d.ts +25 -0
- package/tools/lib/date-time.class.d.ts +13 -0
- package/tools/lib/files.class.d.ts +16 -0
- package/tools/lib/menu.class.d.ts +8 -0
- package/tools/lib/page.class.d.ts +60 -0
- package/tools/lib/screen.class.d.ts +13 -0
- package/tools/lib/service.class.d.ts +39 -0
- package/tools/lib/source.class.d.ts +20 -0
- package/tools/lib/tools.d.ts +34 -0
- package/tools/public-api.d.ts +11 -0
@@ -0,0 +1,102 @@
|
|
1
|
+
import { Component, computed, inject, Input, input, output, viewChild } from '@angular/core';
|
2
|
+
import { CoerAlert, Files, Tools } from 'coer-elements/tools';
|
3
|
+
import * as i0 from "@angular/core";
|
4
|
+
import * as i1 from "@angular/common";
|
5
|
+
import * as i2 from "../coer-modal/coer-modal.component";
|
6
|
+
import * as i3 from "coer-elements/pipes";
|
7
|
+
export class CoerFilebox {
|
8
|
+
constructor() {
|
9
|
+
//Injections
|
10
|
+
this.alert = inject(CoerAlert);
|
11
|
+
this.IsNull = Tools.IsNull;
|
12
|
+
this.IsNotNull = Tools.IsNotNull;
|
13
|
+
//Elements
|
14
|
+
this.inputFileImage = viewChild.required('inputFileImage');
|
15
|
+
this.modal = viewChild.required('modal');
|
16
|
+
//Variables
|
17
|
+
this.base64 = '';
|
18
|
+
this._image = null;
|
19
|
+
this.imageExtensions = ['png', 'jpeg', 'jpg', 'gif', 'svg'];
|
20
|
+
//Inputs
|
21
|
+
this.type = input('image');
|
22
|
+
this.multiple = input(false);
|
23
|
+
this.isLoading = input(false);
|
24
|
+
this.isDisabled = input(false);
|
25
|
+
//Outputs
|
26
|
+
this.onSelected = output();
|
27
|
+
this.onDeleteImage = output();
|
28
|
+
//computed
|
29
|
+
this._isEnable = computed(() => {
|
30
|
+
return !this.isLoading() && !this.isDisabled();
|
31
|
+
});
|
32
|
+
/** */
|
33
|
+
this.GetExtensionFile = (fileName) => {
|
34
|
+
if (fileName.includes('.')) {
|
35
|
+
let worlds = fileName.split('.');
|
36
|
+
if (worlds.length > 0) {
|
37
|
+
let extension = worlds.pop();
|
38
|
+
extension = extension.trim();
|
39
|
+
extension = extension.toLowerCase();
|
40
|
+
if (extension.length > 0)
|
41
|
+
return extension;
|
42
|
+
}
|
43
|
+
}
|
44
|
+
this.alert.Warning('The file extension could not be recognized', 'Files');
|
45
|
+
return null;
|
46
|
+
};
|
47
|
+
}
|
48
|
+
set image(value) {
|
49
|
+
this._image = Tools.IsNotNull(value) ? value : null;
|
50
|
+
if (Tools.IsNotNull(value)) {
|
51
|
+
if (value?.value?.name) {
|
52
|
+
Files.ConvertToBase64(value?.value).then(base64 => {
|
53
|
+
return this.base64 = base64;
|
54
|
+
});
|
55
|
+
}
|
56
|
+
else
|
57
|
+
this.base64 = value?.value;
|
58
|
+
}
|
59
|
+
}
|
60
|
+
/** */
|
61
|
+
async UploadImages(event) {
|
62
|
+
const selectedFiles = Array.from(event.target.files);
|
63
|
+
const files = [];
|
64
|
+
let extension = null;
|
65
|
+
for (const file of selectedFiles) {
|
66
|
+
extension = this.GetExtensionFile(file.name) || '';
|
67
|
+
if (this.imageExtensions.includes(extension)) {
|
68
|
+
files.push({
|
69
|
+
file: file,
|
70
|
+
extension: extension,
|
71
|
+
base64: await Files.ConvertToBase64(file)
|
72
|
+
});
|
73
|
+
}
|
74
|
+
else
|
75
|
+
this.alert.Warning(`<b>.${extension}</b> extension not allowed`, 'Files');
|
76
|
+
}
|
77
|
+
//Response
|
78
|
+
this.inputFileImage().nativeElement.value = null;
|
79
|
+
this.onSelected.emit([...files]);
|
80
|
+
}
|
81
|
+
/** */
|
82
|
+
DeleteImage(event) {
|
83
|
+
event.stopPropagation();
|
84
|
+
if (this._isEnable()) {
|
85
|
+
this.onDeleteImage.emit();
|
86
|
+
}
|
87
|
+
}
|
88
|
+
/** */
|
89
|
+
ExpandImage(event) {
|
90
|
+
event.stopPropagation();
|
91
|
+
this.modal().Open();
|
92
|
+
}
|
93
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: CoerFilebox, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
94
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "17.3.12", type: CoerFilebox, selector: "coer-filebox", inputs: { type: { classPropertyName: "type", publicName: "type", isSignal: true, isRequired: false, transformFunction: null }, multiple: { classPropertyName: "multiple", publicName: "multiple", isSignal: true, isRequired: false, transformFunction: null }, isLoading: { classPropertyName: "isLoading", publicName: "isLoading", isSignal: true, isRequired: false, transformFunction: null }, isDisabled: { classPropertyName: "isDisabled", publicName: "isDisabled", isSignal: true, isRequired: false, transformFunction: null }, image: { classPropertyName: "image", publicName: "image", isSignal: false, isRequired: false, transformFunction: null } }, outputs: { onSelected: "onSelected", onDeleteImage: "onDeleteImage" }, viewQueries: [{ propertyName: "inputFileImage", first: true, predicate: ["inputFileImage"], descendants: true, isSignal: true }, { propertyName: "modal", first: true, predicate: ["modal"], descendants: true, isSignal: true }], ngImport: i0, template: "<div class=\"coer-filebox\">\r\n @if(type() == 'image') {\r\n <figure (click)=\"_isEnable() ? inputFileImage.click() : null\"\r\n [ngClass]=\"{ 'dashed': IsNull(_image?.value) }\"\r\n [ngStyle]=\"{\r\n 'margin-top': _image?.marginTop || '',\r\n 'margin-right': _image?.marginRight || '',\r\n 'margin-bottom': _image?.marginBottom || '',\r\n 'margin-left': _image?.marginLeft || ''\r\n }\">\r\n\r\n @if(isLoading()) {\r\n <div class=\"loading\">\r\n <i class=\"spinner-border\"></i>\r\n </div>\r\n\r\n <div class=\"placeholder-glow\">\r\n <span class=\"placeholder\"></span>\r\n </div>\r\n }\r\n\r\n <img [src]=\"base64 | noImage\"\r\n [ngStyle]=\"{\r\n 'width': _image?.width || '',\r\n 'max-width': _image?.maxWidth || '',\r\n 'height': _image?.height || '',\r\n 'max-height': _image?.maxHeight || '210px'\r\n }\">\r\n\r\n <input #inputFileImage\r\n type=\"file\"\r\n accept=\"image/png, image/jpeg, image/gif, image/svg+xml\"\r\n (change)=\"UploadImages($event)\"\r\n [multiple]=\"multiple()\">\r\n\r\n @if(_isEnable() && IsNotNull(_image) && IsNotNull(_image!.value)) {\r\n <div class=\"icon-container\">\r\n @if(IsNull(_image?.allowDelete) || _image!.allowDelete) {\r\n <i class=\"fa-solid fa-trash-can\" (click)=\"DeleteImage($event)\"></i>\r\n }\r\n\r\n @if(IsNull(_image?.allowExpand) || _image!.allowExpand) {\r\n <i class=\"fa-solid fa-expand\" (click)=\"ExpandImage($event)\"></i>\r\n }\r\n </div>\r\n }\r\n </figure>\r\n }\r\n\r\n <!-- Modal -->\r\n <coer-modal #modal [title]=\"_image?.name || ''\" height=\"90vh\" width=\"full\">\r\n <div class=\"modal-image\" [ngStyle]=\"{ 'background-image': 'url(' + base64 + ')' }\"></div>\r\n </coer-modal>\r\n</div>", styles: ["div.coer-filebox *{--blue: #0d6efd;--gray: #6c757d;--green: #198754;--yellow: #ffc107;--red: #dc3545;--white: #f5f5f5;--black: #252525;--orange: #fd6031}div.coer-filebox .text-blue{color:#0d6efd!important}div.coer-filebox .text-blue-bold{color:#0d6efd!important;font-weight:700!important}div.coer-filebox .background-blue{background-color:#0d6efd!important}div.coer-filebox .background-border-blue{background-color:#0d6efd!important;border-color:#0d6efd!important}div.coer-filebox .border-blue{border-color:#0d6efd!important}div.coer-filebox .text-gray{color:#6c757d!important}div.coer-filebox .text-gray-bold{color:#6c757d!important;font-weight:700!important}div.coer-filebox .background-gray{background-color:#6c757d!important}div.coer-filebox .background-border-gray{background-color:#6c757d!important;border-color:#6c757d!important}div.coer-filebox .border-gray{border-color:#6c757d!important}div.coer-filebox .text-green{color:#198754!important}div.coer-filebox .text-green-bold{color:#198754!important;font-weight:700!important}div.coer-filebox .background-green{background-color:#198754!important}div.coer-filebox .background-border-green{background-color:#198754!important;border-color:#198754!important}div.coer-filebox .border-green{border-color:#198754!important}div.coer-filebox .text-yellow{color:#ffc107!important}div.coer-filebox .text-yellow-bold{color:#ffc107!important;font-weight:700!important}div.coer-filebox .background-yellow{background-color:#ffc107!important}div.coer-filebox .background-border-yellow{background-color:#ffc107!important;border-color:#ffc107!important}div.coer-filebox .border-yellow{border-color:#ffc107!important}div.coer-filebox .text-red{color:#dc3545!important}div.coer-filebox .text-red-bold{color:#dc3545!important;font-weight:700!important}div.coer-filebox .background-red{background-color:#dc3545!important}div.coer-filebox .background-border-red{background-color:#dc3545!important;border-color:#dc3545!important}div.coer-filebox .border-red{border-color:#dc3545!important}div.coer-filebox .text-white{color:#f5f5f5!important}div.coer-filebox .text-white-bold{color:#f5f5f5!important;font-weight:700!important}div.coer-filebox .background-white{background-color:#f5f5f5!important}div.coer-filebox .background-border-white{background-color:#f5f5f5!important;border-color:#f5f5f5!important}div.coer-filebox .border-white{border-color:#f5f5f5!important}div.coer-filebox .text-black{color:#252525!important}div.coer-filebox .text-black-bold{color:#252525!important;font-weight:700!important}div.coer-filebox .background-black{background-color:#252525!important}div.coer-filebox .background-border-black{background-color:#252525!important;border-color:#252525!important}div.coer-filebox .border-black{border-color:#252525!important}div.coer-filebox .text-orange{color:#fd6031!important}div.coer-filebox .text-orange-bold{color:#fd6031!important;font-weight:700!important}div.coer-filebox .background-orange{background-color:#fd6031!important}div.coer-filebox .background-border-orange{background-color:#fd6031!important;border-color:#fd6031!important}div.coer-filebox .border-orange{border-color:#fd6031!important}div.coer-filebox figure{position:relative;display:flex;align-items:center;justify-content:center;border-radius:3px;overflow:hidden;cursor:pointer;min-height:210px;z-index:1}div.coer-filebox .dashed{border:1px dashed #6c757d;background-color:transparent}div.coer-filebox div.loading{position:absolute;display:flex;align-items:center;justify-content:center;width:100%;height:100%;font-size:25px;background-color:#bbbbbb83!important;flex-direction:column!important;gap:10px!important;cursor:default!important}div.coer-filebox div.loading span.fa-fade{position:relative!important;top:50px!important}div.coer-filebox div.loading i.spinner-border{color:#fd6031!important;width:70px!important;height:70px!important;font-size:20px!important;position:absolute!important}div.coer-filebox span.placeholder{width:calc(100% + 32px)!important;height:100%!important;position:absolute!important;z-index:1!important;top:0!important;left:-16px!important;cursor:wait!important}div.coer-filebox div.icon-container{position:absolute;bottom:5px;right:5px;z-index:2;display:flex;align-items:center;justify-content:flex-end;gap:7px}div.coer-filebox div.icon-container i{color:#6c757d;font-size:20px}div.coer-filebox div.icon-container i:hover{zoom:1.1}div.coer-filebox div.modal-image{width:100%;height:100%;border-bottom-left-radius:5px;border-bottom-right-radius:5px;background-size:contain;background-repeat:no-repeat;background-position:center}\n"], dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "component", type: i2.CoerModal, selector: "coer-modal", inputs: ["id", "title", "icon", "showCloseButton", "width", "height", "maxHeight"], outputs: ["onOpen", "onClose"] }, { kind: "pipe", type: i3.NoImagePipe, name: "noImage" }] }); }
|
95
|
+
}
|
96
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: CoerFilebox, decorators: [{
|
97
|
+
type: Component,
|
98
|
+
args: [{ selector: 'coer-filebox', template: "<div class=\"coer-filebox\">\r\n @if(type() == 'image') {\r\n <figure (click)=\"_isEnable() ? inputFileImage.click() : null\"\r\n [ngClass]=\"{ 'dashed': IsNull(_image?.value) }\"\r\n [ngStyle]=\"{\r\n 'margin-top': _image?.marginTop || '',\r\n 'margin-right': _image?.marginRight || '',\r\n 'margin-bottom': _image?.marginBottom || '',\r\n 'margin-left': _image?.marginLeft || ''\r\n }\">\r\n\r\n @if(isLoading()) {\r\n <div class=\"loading\">\r\n <i class=\"spinner-border\"></i>\r\n </div>\r\n\r\n <div class=\"placeholder-glow\">\r\n <span class=\"placeholder\"></span>\r\n </div>\r\n }\r\n\r\n <img [src]=\"base64 | noImage\"\r\n [ngStyle]=\"{\r\n 'width': _image?.width || '',\r\n 'max-width': _image?.maxWidth || '',\r\n 'height': _image?.height || '',\r\n 'max-height': _image?.maxHeight || '210px'\r\n }\">\r\n\r\n <input #inputFileImage\r\n type=\"file\"\r\n accept=\"image/png, image/jpeg, image/gif, image/svg+xml\"\r\n (change)=\"UploadImages($event)\"\r\n [multiple]=\"multiple()\">\r\n\r\n @if(_isEnable() && IsNotNull(_image) && IsNotNull(_image!.value)) {\r\n <div class=\"icon-container\">\r\n @if(IsNull(_image?.allowDelete) || _image!.allowDelete) {\r\n <i class=\"fa-solid fa-trash-can\" (click)=\"DeleteImage($event)\"></i>\r\n }\r\n\r\n @if(IsNull(_image?.allowExpand) || _image!.allowExpand) {\r\n <i class=\"fa-solid fa-expand\" (click)=\"ExpandImage($event)\"></i>\r\n }\r\n </div>\r\n }\r\n </figure>\r\n }\r\n\r\n <!-- Modal -->\r\n <coer-modal #modal [title]=\"_image?.name || ''\" height=\"90vh\" width=\"full\">\r\n <div class=\"modal-image\" [ngStyle]=\"{ 'background-image': 'url(' + base64 + ')' }\"></div>\r\n </coer-modal>\r\n</div>", styles: ["div.coer-filebox *{--blue: #0d6efd;--gray: #6c757d;--green: #198754;--yellow: #ffc107;--red: #dc3545;--white: #f5f5f5;--black: #252525;--orange: #fd6031}div.coer-filebox .text-blue{color:#0d6efd!important}div.coer-filebox .text-blue-bold{color:#0d6efd!important;font-weight:700!important}div.coer-filebox .background-blue{background-color:#0d6efd!important}div.coer-filebox .background-border-blue{background-color:#0d6efd!important;border-color:#0d6efd!important}div.coer-filebox .border-blue{border-color:#0d6efd!important}div.coer-filebox .text-gray{color:#6c757d!important}div.coer-filebox .text-gray-bold{color:#6c757d!important;font-weight:700!important}div.coer-filebox .background-gray{background-color:#6c757d!important}div.coer-filebox .background-border-gray{background-color:#6c757d!important;border-color:#6c757d!important}div.coer-filebox .border-gray{border-color:#6c757d!important}div.coer-filebox .text-green{color:#198754!important}div.coer-filebox .text-green-bold{color:#198754!important;font-weight:700!important}div.coer-filebox .background-green{background-color:#198754!important}div.coer-filebox .background-border-green{background-color:#198754!important;border-color:#198754!important}div.coer-filebox .border-green{border-color:#198754!important}div.coer-filebox .text-yellow{color:#ffc107!important}div.coer-filebox .text-yellow-bold{color:#ffc107!important;font-weight:700!important}div.coer-filebox .background-yellow{background-color:#ffc107!important}div.coer-filebox .background-border-yellow{background-color:#ffc107!important;border-color:#ffc107!important}div.coer-filebox .border-yellow{border-color:#ffc107!important}div.coer-filebox .text-red{color:#dc3545!important}div.coer-filebox .text-red-bold{color:#dc3545!important;font-weight:700!important}div.coer-filebox .background-red{background-color:#dc3545!important}div.coer-filebox .background-border-red{background-color:#dc3545!important;border-color:#dc3545!important}div.coer-filebox .border-red{border-color:#dc3545!important}div.coer-filebox .text-white{color:#f5f5f5!important}div.coer-filebox .text-white-bold{color:#f5f5f5!important;font-weight:700!important}div.coer-filebox .background-white{background-color:#f5f5f5!important}div.coer-filebox .background-border-white{background-color:#f5f5f5!important;border-color:#f5f5f5!important}div.coer-filebox .border-white{border-color:#f5f5f5!important}div.coer-filebox .text-black{color:#252525!important}div.coer-filebox .text-black-bold{color:#252525!important;font-weight:700!important}div.coer-filebox .background-black{background-color:#252525!important}div.coer-filebox .background-border-black{background-color:#252525!important;border-color:#252525!important}div.coer-filebox .border-black{border-color:#252525!important}div.coer-filebox .text-orange{color:#fd6031!important}div.coer-filebox .text-orange-bold{color:#fd6031!important;font-weight:700!important}div.coer-filebox .background-orange{background-color:#fd6031!important}div.coer-filebox .background-border-orange{background-color:#fd6031!important;border-color:#fd6031!important}div.coer-filebox .border-orange{border-color:#fd6031!important}div.coer-filebox figure{position:relative;display:flex;align-items:center;justify-content:center;border-radius:3px;overflow:hidden;cursor:pointer;min-height:210px;z-index:1}div.coer-filebox .dashed{border:1px dashed #6c757d;background-color:transparent}div.coer-filebox div.loading{position:absolute;display:flex;align-items:center;justify-content:center;width:100%;height:100%;font-size:25px;background-color:#bbbbbb83!important;flex-direction:column!important;gap:10px!important;cursor:default!important}div.coer-filebox div.loading span.fa-fade{position:relative!important;top:50px!important}div.coer-filebox div.loading i.spinner-border{color:#fd6031!important;width:70px!important;height:70px!important;font-size:20px!important;position:absolute!important}div.coer-filebox span.placeholder{width:calc(100% + 32px)!important;height:100%!important;position:absolute!important;z-index:1!important;top:0!important;left:-16px!important;cursor:wait!important}div.coer-filebox div.icon-container{position:absolute;bottom:5px;right:5px;z-index:2;display:flex;align-items:center;justify-content:flex-end;gap:7px}div.coer-filebox div.icon-container i{color:#6c757d;font-size:20px}div.coer-filebox div.icon-container i:hover{zoom:1.1}div.coer-filebox div.modal-image{width:100%;height:100%;border-bottom-left-radius:5px;border-bottom-right-radius:5px;background-size:contain;background-repeat:no-repeat;background-position:center}\n"] }]
|
99
|
+
}], propDecorators: { image: [{
|
100
|
+
type: Input
|
101
|
+
}] } });
|
102
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29lci1maWxlYm94LmNvbXBvbmVudC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uL3Byb2plY3RzL2Nv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FsdWUpIH1cIlxyXG4gICAgICAgICAgICBbbmdTdHlsZV09XCJ7XHJcbiAgICAgICAgICAgICAgICAnbWFyZ2luLXRvcCc6IF9pbWFnZT8ubWFyZ2luVG9wIHx8ICcnLFxyXG4gICAgICAgICAgICAgICAgJ21hcmdpbi1yaWdodCc6IF9pbWFnZT8ubWFyZ2luUmlnaHQgfHwgJycsXHJcbiAgICAgICAgICAgICAgICAnbWFyZ2luLWJvdHRvbSc6IF9pbWFnZT8ubWFyZ2luQm90dG9tIHx8ICcnLFxyXG4gICAgICAgICAgICAgICAgJ21hcmdpbi1sZWZ0JzogX2ltYWdlPy5tYXJnaW5MZWZ0IHx8ICcnXHJcbiAgICAgICAgICAgIH1cIj5cclxuXHJcbiAgICAgICAgICAgIEBpZihpc0xvYWRpbmcoKSkge1xyXG4gICAgICAgICAgICAgICAgPGRpdiBjbGFzcz1cImxvYWRpbmdcIj5cclxuICAgICAgICAgICAgICAgICAgICA8aSBjbGFzcz1cInNwaW5uZXItYm9yZGVyXCI+PC9pPlxyXG4gICAgICAgICAgICAgICAgPC9kaXY+XHJcblxyXG4gICAgICAgICAgICAgICAgPGRpdiBjbGFzcz1cInBsYWNlaG9sZGVyLWdsb3dcIj5cclxuICAgICAgICAgICAgICAgICAgICA8c3BhbiBjbGFzcz1cInBsYWNlaG9sZGVyXCI+PC9zcGFuPlxyXG4gICAgICAgICAgICAgICAgPC9kaXY+XHJcbiAgICAgICAgICAgIH1cclxuXHJcbiAgICAgICAgICAgIDxpbWcgW3NyY109XCJiYXNlNjQgfCBub0ltYWdlXCJcclxuICAgICAgICAgICAgICAgIFtuZ1N0eWxlXT1cIntcclxuICAgICAgICAgICAgICAgICAgICAnd2lkdGgnOiBfaW1hZ2U/LndpZHRoIHx8ICcnLFxyXG4gICAgICAgICAgICAgICAgICAgICdtYXgtd2lkdGgnOiBfaW1hZ2U/Lm1heFdpZHRoIHx8ICcnLFxyXG4gICAgICAgICAgICAgICAgICAgICdoZWlnaHQnOiBfaW1hZ2U/LmhlaWdodCB8fCAnJyxcclxuICAgICAgICAgICAgICAgICAgICAnbWF4LWhlaWdodCc6IF9pbWFnZT8ubWF4SGVpZ2h0IHx8ICcyMTBweCdcclxuICAgICAgICAgICAgICAgIH1cIj5cclxuXHJcbiAgICAgICAgICAgIDxpbnB1dCAjaW5wdXRGaWxlSW1hZ2VcclxuICAgICAgICAgICAgICAgIHR5cGU9XCJmaWxlXCJcclxuICAgICAgICAgICAgICAgIGFjY2VwdD1cImltYWdlL3BuZywgaW1hZ2UvanBlZywgaW1hZ2UvZ2lmLCBpbWFnZS9zdmcreG1sXCJcclxuICAgICAgICAgICAgICAgIChjaGFuZ2UpPVwiVXBsb2FkSW1hZ2VzKCRldmVudClcIlxyXG4gICAgICAgICAgICAgICAgW211bHRpcGxlXT1cIm11bHRpcGxlKClcIj5cclxuXHJcbiAgICAgICAgICAgIEBpZihfaXNFbmFibGUoKSAmJiBJc05vdE51bGwoX2ltYWdlKSAmJiBJc05vdE51bGwoX2ltYWdlIS52YWx1ZSkpIHtcclxuICAgICAgICAgICAgICAgIDxkaXYgY2xhc3M9XCJpY29uLWNvbnRhaW5lclwiPlxyXG4gICAgICAgICAgICAgICAgICAgIEBpZihJc051bGwoX2ltYWdlPy5hbGxvd0RlbGV0ZSkgfHwgX2ltYWdlIS5hbGxvd0RlbGV0ZSkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICA8aSBjbGFzcz1cImZhLXNvbGlkIGZhLXRyYXNoLWNhblwiIChjbGljayk9XCJEZWxldGVJbWFnZSgkZXZlbnQpXCI+PC9pPlxyXG4gICAgICAgICAgICAgICAgICAgIH1cclxuXHJcbiAgICAgICAgICAgICAgICAgICAgQGlmKElzTnVsbChfaW1hZ2U/LmFsbG93RXhwYW5kKSB8fCBfaW1hZ2UhLmFsbG93RXhwYW5kKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIDxpIGNsYXNzPVwiZmEtc29saWQgZmEtZXhwYW5kXCIgKGNsaWNrKT1cIkV4cGFuZEltYWdlKCRldmVudClcIj48L2k+XHJcbiAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgPC9kaXY+XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICA8L2ZpZ3VyZT5cclxuICAgIH1cclxuXHJcbiAgICA8IS0tIE1vZGFsIC0tPlxyXG4gICAgPGNvZXItbW9kYWwgI21vZGFsIFt0aXRsZV09XCJfaW1hZ2U/Lm5hbWUgfHwgJydcIiBoZWlnaHQ9XCI5MHZoXCIgd2lkdGg9XCJmdWxsXCI+XHJcbiAgICAgICAgPGRpdiBjbGFzcz1cIm1vZGFsLWltYWdlXCIgW25nU3R5bGVdPVwieyAnYmFja2dyb3VuZC1pbWFnZSc6ICd1cmwoJyArIGJhc2U2NCArICcpJyB9XCI+PC9kaXY+XHJcbiAgICA8L2NvZXItbW9kYWw+XHJcbjwvZGl2PiJdfQ==
|
@@ -0,0 +1,101 @@
|
|
1
|
+
import { Component, inject, input } from '@angular/core';
|
2
|
+
import { CoerAlert, Tools } from 'coer-elements/tools';
|
3
|
+
import * as i0 from "@angular/core";
|
4
|
+
import * as i1 from "@angular/forms";
|
5
|
+
export class CoerForm {
|
6
|
+
constructor() {
|
7
|
+
//Injection
|
8
|
+
this.alert = inject(CoerAlert);
|
9
|
+
this.formGroup = input.required();
|
10
|
+
this.isLoading = input(false);
|
11
|
+
this.isDisabled = input(false);
|
12
|
+
/** */
|
13
|
+
this.IsInvalidControl = (formControlName) => {
|
14
|
+
return Tools.IsNotNull(this.formGroup().get(formControlName))
|
15
|
+
? (this.formGroup().get(formControlName).touched && this.formGroup().get(formControlName).invalid)
|
16
|
+
: true;
|
17
|
+
};
|
18
|
+
}
|
19
|
+
get _isDisabled() {
|
20
|
+
return this.isLoading() || this.isDisabled();
|
21
|
+
}
|
22
|
+
/** */
|
23
|
+
TouchForm() {
|
24
|
+
this.formGroup().markAllAsTouched();
|
25
|
+
}
|
26
|
+
/** */
|
27
|
+
SetControlValue(formControlName, value) {
|
28
|
+
if (Tools.IsNotNull(this.formGroup().get(formControlName))) {
|
29
|
+
this.formGroup().get(formControlName).setValue(value);
|
30
|
+
}
|
31
|
+
else {
|
32
|
+
this.alert.Warning(`${formControlName} Control`, 'Not Found');
|
33
|
+
}
|
34
|
+
}
|
35
|
+
/** */
|
36
|
+
GetControlValue(formControlName) {
|
37
|
+
return Tools.IsNotNull(this.formGroup().get(formControlName))
|
38
|
+
? this.formGroup().get(formControlName).value
|
39
|
+
: null;
|
40
|
+
}
|
41
|
+
/** Get form value */
|
42
|
+
GetValue() {
|
43
|
+
return Tools.BreakReference(this.formGroup().value);
|
44
|
+
}
|
45
|
+
/** */
|
46
|
+
Reset(properties = null) {
|
47
|
+
if (Tools.IsNull(properties))
|
48
|
+
this.formGroup().reset();
|
49
|
+
else
|
50
|
+
this.formGroup().reset(properties);
|
51
|
+
}
|
52
|
+
/**
|
53
|
+
* Mark all controls as touched.
|
54
|
+
* If form is invalid emit a warning and focus first invalid control.
|
55
|
+
*/
|
56
|
+
IsValid() {
|
57
|
+
this.TouchForm();
|
58
|
+
if (this.formGroup().invalid) {
|
59
|
+
this.alert.Warning('Please complete the required fields', 'Instructions', 'fa-solid fa-list-check');
|
60
|
+
this.Focus();
|
61
|
+
}
|
62
|
+
return {
|
63
|
+
isValid: this.formGroup().valid,
|
64
|
+
formValue: this.GetValue()
|
65
|
+
};
|
66
|
+
}
|
67
|
+
/** Focus the especified control or first invalid control */
|
68
|
+
Focus(formControl = null) {
|
69
|
+
const formControlCollection = new Map();
|
70
|
+
const formControlErrorCollection = new Map();
|
71
|
+
for (const property of Tools.GetObjectProperties(this.formGroup().controls)) {
|
72
|
+
formControlErrorCollection.set(property, this.formGroup().controls[property].errors);
|
73
|
+
const htmlElement = document.querySelector(`[formcontrolname='${property}'] input`);
|
74
|
+
if (Tools.IsNotNull(htmlElement))
|
75
|
+
formControlCollection.set(property, htmlElement);
|
76
|
+
}
|
77
|
+
if (formControlCollection.size > 0) {
|
78
|
+
if (Tools.IsNull(formControl)) {
|
79
|
+
for (const [property, error] of formControlErrorCollection) {
|
80
|
+
if (Tools.IsNotNull(error)) {
|
81
|
+
formControl = property;
|
82
|
+
break;
|
83
|
+
}
|
84
|
+
}
|
85
|
+
if (Tools.IsNull(formControl)) {
|
86
|
+
formControl = Array.from(formControlCollection.keys())[0];
|
87
|
+
}
|
88
|
+
}
|
89
|
+
const element = formControlCollection.get(formControl);
|
90
|
+
if (Tools.IsNotNull(element))
|
91
|
+
element.focus();
|
92
|
+
}
|
93
|
+
}
|
94
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: CoerForm, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
95
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "17.3.12", type: CoerForm, selector: "coer-form", inputs: { formGroup: { classPropertyName: "formGroup", publicName: "formGroup", isSignal: true, isRequired: true, transformFunction: null }, isLoading: { classPropertyName: "isLoading", publicName: "isLoading", isSignal: true, isRequired: false, transformFunction: null }, isDisabled: { classPropertyName: "isDisabled", publicName: "isDisabled", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: "<form [formGroup]=\"formGroup()\" autocomplete=\"off\" class=\"coer-form\">\r\n <fieldset [disabled]=\"_isDisabled\">\r\n <ng-content></ng-content>\r\n </fieldset>\r\n</form>", styles: [""], dependencies: [{ kind: "directive", type: i1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }] }); }
|
96
|
+
}
|
97
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: CoerForm, decorators: [{
|
98
|
+
type: Component,
|
99
|
+
args: [{ selector: 'coer-form', template: "<form [formGroup]=\"formGroup()\" autocomplete=\"off\" class=\"coer-form\">\r\n <fieldset [disabled]=\"_isDisabled\">\r\n <ng-content></ng-content>\r\n </fieldset>\r\n</form>" }]
|
100
|
+
}] });
|
101
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29lci1mb3JtLmNvbXBvbmVudC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uL3Byb2plY3RzL2NvZXItZWxlbWVudHMvY29tcG9uZW50cy9saWIvY29lci1mb3JtL2NvZXItZm9ybS5jb21wb25lbnQudHMiLCIuLi8uLi8uLi8uLi8uLi8uLi9wcm9qZWN0cy9jb2VyLWVsZW1lbnRzL2NvbXBvbmVudHMvbGliL2NvZXItZm9ybS9jb2VyLWZvcm0uY29tcG9uZW50Lmh0bWwiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLFNBQVMsRUFBRSxNQUFNLEVBQUUsS0FBSyxFQUFFLE1BQU0sZUFBZSxDQUFDO0FBRXpELE9BQU8sRUFBRSxTQUFTLEVBQUUsS0FBSyxFQUFFLE1BQU0scUJBQXFCLENBQUM7OztBQU92RCxNQUFNLE9BQU8sUUFBUTtJQUxyQjtRQU9JLFdBQVc7UUFDSCxVQUFLLEdBQUcsTUFBTSxDQUFDLFNBQVMsQ0FBQyxDQUFDO1FBRTNCLGNBQVMsR0FBRyxLQUFLLENBQUMsUUFBUSxFQUFhLENBQUM7UUFDeEMsY0FBUyxHQUFHLEtBQUssQ0FBVSxLQUFLLENBQUMsQ0FBQztRQUNsQyxlQUFVLEdBQUcsS0FBSyxDQUFVLEtBQUssQ0FBQyxDQUFDO1FBYzFDLE1BQU07UUFDQyxxQkFBZ0IsR0FBRyxDQUFDLGVBQXVCLEV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gICAgICAgICAgICBicmVhaztcclxuICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICB9XHJcblxyXG4gICAgICAgICAgICAgICAgaWYoVG9vbHMuSXNOdWxsKGZvcm1Db250cm9sKSkge1xyXG4gICAgICAgICAgICAgICAgICAgIGZvcm1Db250cm9sID0gQXJyYXkuZnJvbShmb3JtQ29udHJvbENvbGxlY3Rpb24ua2V5cygpKVswXTtcclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgfVxyXG5cclxuICAgICAgICAgICAgY29uc3QgZWxlbWVudDogYW55ID0gZm9ybUNvbnRyb2xDb2xsZWN0aW9uLmdldChmb3JtQ29udHJvbCEpO1xyXG4gICAgICAgICAgICBpZihUb29scy5Jc05vdE51bGwoZWxlbWVudCkpIGVsZW1lbnQuZm9jdXMoKTtcclxuICAgICAgICB9XHJcbiAgICB9XHJcbn0iLCI8Zm9ybSBbZm9ybUdyb3VwXT1cImZvcm1Hcm91cCgpXCIgYXV0b2NvbXBsZXRlPVwib2ZmXCIgY2xhc3M9XCJjb2VyLWZvcm1cIj5cclxuICAgIDxmaWVsZHNldCBbZGlzYWJsZWRdPVwiX2lzRGlzYWJsZWRcIj5cclxuICAgICAgICA8bmctY29udGVudD48L25nLWNvbnRlbnQ+XHJcbiAgICA8L2ZpZWxkc2V0PlxyXG48L2Zvcm0+Il19
|