monkey-style-guide-v2 0.0.22 → 0.0.23
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/esm2022/lib/components/form-field/form-field.component.mjs +2 -2
- package/esm2022/lib/components/index.mjs +2 -1
- package/esm2022/lib/components/input-phone/index.mjs +7 -0
- package/esm2022/lib/components/input-phone/input-phone.component.mjs +324 -0
- package/esm2022/lib/components/modal/modal.component.mjs +2 -2
- package/esm2022/lib/tokens/index.mjs +2 -1
- package/fesm2022/monkey-style-guide-v2.mjs +1594 -1274
- package/fesm2022/monkey-style-guide-v2.mjs.map +1 -1
- package/lib/components/index.d.ts +1 -0
- package/lib/components/input-phone/index.d.ts +6 -0
- package/lib/components/input-phone/input-phone.component.d.ts +68 -0
- package/lib/tokens/index.d.ts +1 -0
- package/monkey-style-guide-v2-0.0.23.tgz +0 -0
- package/package.json +3 -2
- package/monkey-style-guide-v2-0.0.22.tgz +0 -0
|
@@ -14,6 +14,8 @@ import { filter, BehaviorSubject, map, merge, Subject, debounceTime, Subscriptio
|
|
|
14
14
|
import { format, parseISO, subYears, addYears, subMonths, addMonths, getMonth, getYear, startOfWeek, startOfMonth, endOfWeek, endOfMonth, isSameMonth, isBefore, isAfter, isToday, addDays, isWithinInterval, subDays } from 'date-fns';
|
|
15
15
|
import { coerceBooleanProperty } from '@angular/cdk/coercion';
|
|
16
16
|
import { getSupportedInputTypes } from '@angular/cdk/platform';
|
|
17
|
+
import parsePhoneNumberFromString, { getCountries, getCountryCallingCode, getExampleNumber, AsYouType, isValidPhoneNumber } from 'libphonenumber-js';
|
|
18
|
+
import examples from 'libphonenumber-js/examples.mobile.json';
|
|
17
19
|
import { hasModifierKey } from '@angular/cdk/keycodes';
|
|
18
20
|
|
|
19
21
|
const counters = {};
|
|
@@ -985,6 +987,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
|
|
|
985
987
|
|
|
986
988
|
const MONKEY_I18N_WRAPPER = new InjectionToken('');
|
|
987
989
|
const MONKEY_POPOVER_OPTIONS = new InjectionToken('MONKEY_POPOVER_OPTIONS');
|
|
990
|
+
const MONKEY_COUNTRY_CODE = new InjectionToken('+55');
|
|
988
991
|
|
|
989
992
|
class MonkeyPopoverContentComponent {
|
|
990
993
|
constructor(host) {
|
|
@@ -2134,7 +2137,7 @@ class MonkeyFormFieldComponent {
|
|
|
2134
2137
|
}
|
|
2135
2138
|
}
|
|
2136
2139
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: MonkeyFormFieldComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
2137
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.13", type: MonkeyFormFieldComponent, selector: "monkey-form-field", inputs: { id: "id", hideAction: ["hideAction", "hideAction", booleanAttribute], enableClear: ["enableClear", "enableClear", booleanAttribute], size: "size" }, host: { properties: { "class.mecx-disabled": "control.disabled", "class.mecx-form-field-focused": "control.focused", "class.mecx-form-field-invalid": "showInvalid", "class.mecx-form-field-borderless": "hideBorder", "attr.id": "id", "id": "id", "class": "size" }, classAttribute: "mecx-form-field" }, queries: [{ propertyName: "_formFieldControl", first: true, predicate: MonkeyFormFieldControl, descendants: true }, { propertyName: "_labelChildren", predicate: MonkeyLabelDirective, descendants: true }, { propertyName: "_helperChildren", predicate: MonkeyHelperDirective, descendants: true }, { propertyName: "_prefixChildren", predicate: MonkeyPrefixDirective, descendants: true }, { propertyName: "_suffixChildren", predicate: MonkeySuffixDirective, descendants: true }, { propertyName: "_infoChildren", predicate: MonkeyInfoDirective, descendants: true }, { propertyName: "_errorChildren", predicate: MonkeyErrorDirective, descendants: true }], exportAs: ["monkeyFormField"], ngImport: i0, template: "@if (showHeader) {\n <div class=\"mecx-form-field-header\" (click)=\"control.onContainerClick($event)\">\n <label [id]=\"labelId\" [attr.for]=\"control.id\">\n <ng-content select=\"monkey-label\"></ng-content>\n </label>\n <ng-content select=\"monkey-helper\"></ng-content>\n </div>\n}\n\n<div class=\"mecx-form-field-body\" (click)=\"control.onContainerClick($event)\">\n @if (hasPrefix) {\n <ng-content select=\"monkey-prefix\"></ng-content>\n }\n @if (getSymbols(); as symbols) {\n <div class=\"mecx-form-field-prefix-symbol\">\n {{ symbols }}\n </div>\n }\n\n <ng-content></ng-content>\n\n @if (showClear) {\n <util-icon class=\"mecx-clear\" name=\"clear\" (click)=\"onClear($event)\" />\n }\n @if (showCalendar) {\n <util-icon class=\"mecx-calendar\" name=\"calendar\" (click)=\"onOpenCalendar($event)\" />\n }\n @if (showLoading) {\n <util-icon class=\"mecx-form-field-loading\" name=\"loading\" />\n }\n\n @if (hasSuffix) {\n <ng-content select=\"monkey-suffix\"></ng-content>\n }\n</div>\n\n@if (showFooter) {\n <div class=\"mecx-form-field-footer\" (click)=\"control.onContainerClick($event)\">\n @switch (getFooterMessages()) {\n @case ('error') {\n <ng-content select=\"monkey-error\"></ng-content>\n }\n @case ('info') {\n <div class=\"mecx-form-field-info\">\n <ng-content select=\"monkey-info\"></ng-content>\n </div>\n }\n }\n </div>\n}\n", styles: [".mecx-form-field{width:100%;display:inline-flex;flex-direction:column;min-width:0;text-align:left;gap:6px}.mecx-disabled .mecx-form-field{cursor:not-allowed;pointer-events:none}.mecx-form-field-header{display:flex;justify-content:space-between;align-items:center}.mecx-disabled .mecx-form-field-header label{pointer-events:none}.mecx-form-field-body{border-radius:4px;border:2px solid var(--mecx-color-gray-400);padding:8px;gap:4px;background:var(--mecx-color-white);color:var(--mecx-color-gray-500);box-sizing:border-box;height:40px;display:flex;align-items:center;position:relative}.mecx-form-field-invalid .mecx-form-field-body{border:2px solid var(--mecx-color-error-700)}.mecx-form-field-invalid .mecx-form-field-body .mecx-option:not(.mecx-option-disabled).radio:before{border:2px solid var(--mecx-color-error-700)}.mecx-form-field-focused .mecx-form-field-body{outline:2px solid var(--mecx-color-theme-main);outline-offset:1px}.mecx-disabled .mecx-form-field-body{border-color:var(--mecx-color-gray-50);background:var(--mecx-color-gray-50);border-radius:8px}.mecx-form-field-body .mecx-clear,.mecx-form-field-body .mecx-calendar{display:flex;align-items:center;justify-content:center;cursor:pointer}.mecx-form-field-body .mecx-calendar svg path{fill:var(--mecx-color-theme-main)}.sm .mecx-form-field-body{height:32px}.md .mecx-form-field-body{height:40px}.lg .mecx-form-field-body{height:48px}.mecx-form-field-footer{display:flex;flex-direction:column}.mecx-form-field-prefix-symbol{color:var(--mecx-color-gray-700);font-size:16px;font-weight:400;font-style:normal;width:22px;text-align:center}.mecx-form-field-prefix-symbol .mk-i{display:flex}.mecx-disabled .mecx-form-field-prefix-symbol{color:var(--mecx-color-gray-400)!important;pointer-events:none}.mecx-form-field-loading{display:flex}.mecx-form-field-loading svg path{fill:var(--mecx-color-theme-main)}.mecx-form-field-borderless .mecx-form-field-body{background-color:transparent;border:0;border-radius:0;padding:0;height:unset;align-items:flex-start}.mecx-form-field-borderless.mecx-form-field-focused .mecx-form-field-body{outline:none;outline-offset:unset}\n"], dependencies: [{ kind: "component", type: UtilIconComponent, selector: "util-icon", inputs: ["name"] }], encapsulation: i0.ViewEncapsulation.None }); }
|
|
2140
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.13", type: MonkeyFormFieldComponent, selector: "monkey-form-field", inputs: { id: "id", hideAction: ["hideAction", "hideAction", booleanAttribute], enableClear: ["enableClear", "enableClear", booleanAttribute], size: "size" }, host: { properties: { "class.mecx-disabled": "control.disabled", "class.mecx-form-field-focused": "control.focused", "class.mecx-form-field-invalid": "showInvalid", "class.mecx-form-field-borderless": "hideBorder", "attr.id": "id", "id": "id", "class": "size" }, classAttribute: "mecx-form-field" }, queries: [{ propertyName: "_formFieldControl", first: true, predicate: MonkeyFormFieldControl, descendants: true }, { propertyName: "_labelChildren", predicate: MonkeyLabelDirective, descendants: true }, { propertyName: "_helperChildren", predicate: MonkeyHelperDirective, descendants: true }, { propertyName: "_prefixChildren", predicate: MonkeyPrefixDirective, descendants: true }, { propertyName: "_suffixChildren", predicate: MonkeySuffixDirective, descendants: true }, { propertyName: "_infoChildren", predicate: MonkeyInfoDirective, descendants: true }, { propertyName: "_errorChildren", predicate: MonkeyErrorDirective, descendants: true }], exportAs: ["monkeyFormField"], ngImport: i0, template: "@if (showHeader) {\n <div class=\"mecx-form-field-header\" (click)=\"control.onContainerClick($event)\">\n <label [id]=\"labelId\" [attr.for]=\"control.id\">\n <ng-content select=\"monkey-label\"></ng-content>\n </label>\n <ng-content select=\"monkey-helper\"></ng-content>\n </div>\n}\n\n<div class=\"mecx-form-field-body\" (click)=\"control.onContainerClick($event)\">\n @if (hasPrefix) {\n <ng-content select=\"monkey-prefix\"></ng-content>\n }\n @if (getSymbols(); as symbols) {\n <div class=\"mecx-form-field-prefix-symbol\">\n {{ symbols }}\n </div>\n }\n\n <ng-content></ng-content>\n\n @if (showClear) {\n <util-icon class=\"mecx-clear\" name=\"clear\" (click)=\"onClear($event)\" />\n }\n @if (showCalendar) {\n <util-icon class=\"mecx-calendar\" name=\"calendar\" (click)=\"onOpenCalendar($event)\" />\n }\n @if (showLoading) {\n <util-icon class=\"mecx-form-field-loading\" name=\"loading\" />\n }\n\n @if (hasSuffix) {\n <ng-content select=\"monkey-suffix\"></ng-content>\n }\n</div>\n\n@if (showFooter) {\n <div class=\"mecx-form-field-footer\" (click)=\"control.onContainerClick($event)\">\n @switch (getFooterMessages()) {\n @case ('error') {\n <ng-content select=\"monkey-error\"></ng-content>\n }\n @case ('info') {\n <div class=\"mecx-form-field-info\">\n <ng-content select=\"monkey-info\"></ng-content>\n </div>\n }\n }\n </div>\n}\n", styles: [".mecx-form-field{width:100%;display:inline-flex;flex-direction:column;min-width:0;text-align:left;gap:6px}.mecx-disabled .mecx-form-field{cursor:not-allowed;pointer-events:none}.mecx-form-field-header{display:flex;justify-content:space-between;align-items:center}.mecx-disabled .mecx-form-field-header label{pointer-events:none}.mecx-form-field-body{border-radius:4px;border:2px solid var(--mecx-color-gray-400);padding:8px;gap:4px;background:var(--mecx-color-white);color:var(--mecx-color-gray-500);box-sizing:border-box;height:40px;display:flex;align-items:center;position:relative}.mecx-form-field-invalid .mecx-form-field-body{border:2px solid var(--mecx-color-error-700)}.mecx-form-field-invalid .mecx-form-field-body .mecx-option:not(.mecx-option-disabled).radio:before{border:2px solid var(--mecx-color-error-700)}.mecx-form-field-focused .mecx-form-field-body{outline:2px solid var(--mecx-color-theme-main);outline-offset:1px}.mecx-disabled .mecx-form-field-body{border-color:var(--mecx-color-gray-50);background:var(--mecx-color-gray-50);border-radius:8px}.mecx-form-field-body .mecx-clear,.mecx-form-field-body .mecx-calendar{display:flex;align-items:center;justify-content:center;cursor:pointer}.mecx-form-field-body .mecx-calendar svg path{fill:var(--mecx-color-theme-main)}.sm .mecx-form-field-body{height:32px}.md .mecx-form-field-body{height:40px}.lg .mecx-form-field-body{height:48px}.mecx-form-field-footer{display:flex;flex-direction:column}.mecx-form-field-prefix-symbol{color:var(--mecx-color-gray-700);font-size:16px;font-weight:400;font-style:normal;width:22px;text-align:center}.mecx-form-field-prefix-symbol .mk-i{display:flex}.mecx-disabled .mecx-form-field-prefix-symbol{color:var(--mecx-color-gray-400)!important;pointer-events:none}.mecx-form-field-loading{display:flex}.mecx-form-field-loading svg path{fill:var(--mecx-color-theme-main)}.mecx-form-field-borderless .mecx-form-field-body{background-color:transparent;border:0;border-radius:0;padding:0;height:unset;align-items:flex-start;outline:none;outline-offset:unset}.mecx-form-field-borderless.mecx-form-field-focused .mecx-form-field-body{outline:none;outline-offset:unset}\n"], dependencies: [{ kind: "component", type: UtilIconComponent, selector: "util-icon", inputs: ["name"] }], encapsulation: i0.ViewEncapsulation.None }); }
|
|
2138
2141
|
}
|
|
2139
2142
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: MonkeyFormFieldComponent, decorators: [{
|
|
2140
2143
|
type: Component,
|
|
@@ -2147,7 +2150,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
|
|
|
2147
2150
|
'[attr.id]': 'id',
|
|
2148
2151
|
'[id]': 'id',
|
|
2149
2152
|
'[class]': 'size'
|
|
2150
|
-
}, template: "@if (showHeader) {\n <div class=\"mecx-form-field-header\" (click)=\"control.onContainerClick($event)\">\n <label [id]=\"labelId\" [attr.for]=\"control.id\">\n <ng-content select=\"monkey-label\"></ng-content>\n </label>\n <ng-content select=\"monkey-helper\"></ng-content>\n </div>\n}\n\n<div class=\"mecx-form-field-body\" (click)=\"control.onContainerClick($event)\">\n @if (hasPrefix) {\n <ng-content select=\"monkey-prefix\"></ng-content>\n }\n @if (getSymbols(); as symbols) {\n <div class=\"mecx-form-field-prefix-symbol\">\n {{ symbols }}\n </div>\n }\n\n <ng-content></ng-content>\n\n @if (showClear) {\n <util-icon class=\"mecx-clear\" name=\"clear\" (click)=\"onClear($event)\" />\n }\n @if (showCalendar) {\n <util-icon class=\"mecx-calendar\" name=\"calendar\" (click)=\"onOpenCalendar($event)\" />\n }\n @if (showLoading) {\n <util-icon class=\"mecx-form-field-loading\" name=\"loading\" />\n }\n\n @if (hasSuffix) {\n <ng-content select=\"monkey-suffix\"></ng-content>\n }\n</div>\n\n@if (showFooter) {\n <div class=\"mecx-form-field-footer\" (click)=\"control.onContainerClick($event)\">\n @switch (getFooterMessages()) {\n @case ('error') {\n <ng-content select=\"monkey-error\"></ng-content>\n }\n @case ('info') {\n <div class=\"mecx-form-field-info\">\n <ng-content select=\"monkey-info\"></ng-content>\n </div>\n }\n }\n </div>\n}\n", styles: [".mecx-form-field{width:100%;display:inline-flex;flex-direction:column;min-width:0;text-align:left;gap:6px}.mecx-disabled .mecx-form-field{cursor:not-allowed;pointer-events:none}.mecx-form-field-header{display:flex;justify-content:space-between;align-items:center}.mecx-disabled .mecx-form-field-header label{pointer-events:none}.mecx-form-field-body{border-radius:4px;border:2px solid var(--mecx-color-gray-400);padding:8px;gap:4px;background:var(--mecx-color-white);color:var(--mecx-color-gray-500);box-sizing:border-box;height:40px;display:flex;align-items:center;position:relative}.mecx-form-field-invalid .mecx-form-field-body{border:2px solid var(--mecx-color-error-700)}.mecx-form-field-invalid .mecx-form-field-body .mecx-option:not(.mecx-option-disabled).radio:before{border:2px solid var(--mecx-color-error-700)}.mecx-form-field-focused .mecx-form-field-body{outline:2px solid var(--mecx-color-theme-main);outline-offset:1px}.mecx-disabled .mecx-form-field-body{border-color:var(--mecx-color-gray-50);background:var(--mecx-color-gray-50);border-radius:8px}.mecx-form-field-body .mecx-clear,.mecx-form-field-body .mecx-calendar{display:flex;align-items:center;justify-content:center;cursor:pointer}.mecx-form-field-body .mecx-calendar svg path{fill:var(--mecx-color-theme-main)}.sm .mecx-form-field-body{height:32px}.md .mecx-form-field-body{height:40px}.lg .mecx-form-field-body{height:48px}.mecx-form-field-footer{display:flex;flex-direction:column}.mecx-form-field-prefix-symbol{color:var(--mecx-color-gray-700);font-size:16px;font-weight:400;font-style:normal;width:22px;text-align:center}.mecx-form-field-prefix-symbol .mk-i{display:flex}.mecx-disabled .mecx-form-field-prefix-symbol{color:var(--mecx-color-gray-400)!important;pointer-events:none}.mecx-form-field-loading{display:flex}.mecx-form-field-loading svg path{fill:var(--mecx-color-theme-main)}.mecx-form-field-borderless .mecx-form-field-body{background-color:transparent;border:0;border-radius:0;padding:0;height:unset;align-items:flex-start}.mecx-form-field-borderless.mecx-form-field-focused .mecx-form-field-body{outline:none;outline-offset:unset}\n"] }]
|
|
2153
|
+
}, template: "@if (showHeader) {\n <div class=\"mecx-form-field-header\" (click)=\"control.onContainerClick($event)\">\n <label [id]=\"labelId\" [attr.for]=\"control.id\">\n <ng-content select=\"monkey-label\"></ng-content>\n </label>\n <ng-content select=\"monkey-helper\"></ng-content>\n </div>\n}\n\n<div class=\"mecx-form-field-body\" (click)=\"control.onContainerClick($event)\">\n @if (hasPrefix) {\n <ng-content select=\"monkey-prefix\"></ng-content>\n }\n @if (getSymbols(); as symbols) {\n <div class=\"mecx-form-field-prefix-symbol\">\n {{ symbols }}\n </div>\n }\n\n <ng-content></ng-content>\n\n @if (showClear) {\n <util-icon class=\"mecx-clear\" name=\"clear\" (click)=\"onClear($event)\" />\n }\n @if (showCalendar) {\n <util-icon class=\"mecx-calendar\" name=\"calendar\" (click)=\"onOpenCalendar($event)\" />\n }\n @if (showLoading) {\n <util-icon class=\"mecx-form-field-loading\" name=\"loading\" />\n }\n\n @if (hasSuffix) {\n <ng-content select=\"monkey-suffix\"></ng-content>\n }\n</div>\n\n@if (showFooter) {\n <div class=\"mecx-form-field-footer\" (click)=\"control.onContainerClick($event)\">\n @switch (getFooterMessages()) {\n @case ('error') {\n <ng-content select=\"monkey-error\"></ng-content>\n }\n @case ('info') {\n <div class=\"mecx-form-field-info\">\n <ng-content select=\"monkey-info\"></ng-content>\n </div>\n }\n }\n </div>\n}\n", styles: [".mecx-form-field{width:100%;display:inline-flex;flex-direction:column;min-width:0;text-align:left;gap:6px}.mecx-disabled .mecx-form-field{cursor:not-allowed;pointer-events:none}.mecx-form-field-header{display:flex;justify-content:space-between;align-items:center}.mecx-disabled .mecx-form-field-header label{pointer-events:none}.mecx-form-field-body{border-radius:4px;border:2px solid var(--mecx-color-gray-400);padding:8px;gap:4px;background:var(--mecx-color-white);color:var(--mecx-color-gray-500);box-sizing:border-box;height:40px;display:flex;align-items:center;position:relative}.mecx-form-field-invalid .mecx-form-field-body{border:2px solid var(--mecx-color-error-700)}.mecx-form-field-invalid .mecx-form-field-body .mecx-option:not(.mecx-option-disabled).radio:before{border:2px solid var(--mecx-color-error-700)}.mecx-form-field-focused .mecx-form-field-body{outline:2px solid var(--mecx-color-theme-main);outline-offset:1px}.mecx-disabled .mecx-form-field-body{border-color:var(--mecx-color-gray-50);background:var(--mecx-color-gray-50);border-radius:8px}.mecx-form-field-body .mecx-clear,.mecx-form-field-body .mecx-calendar{display:flex;align-items:center;justify-content:center;cursor:pointer}.mecx-form-field-body .mecx-calendar svg path{fill:var(--mecx-color-theme-main)}.sm .mecx-form-field-body{height:32px}.md .mecx-form-field-body{height:40px}.lg .mecx-form-field-body{height:48px}.mecx-form-field-footer{display:flex;flex-direction:column}.mecx-form-field-prefix-symbol{color:var(--mecx-color-gray-700);font-size:16px;font-weight:400;font-style:normal;width:22px;text-align:center}.mecx-form-field-prefix-symbol .mk-i{display:flex}.mecx-disabled .mecx-form-field-prefix-symbol{color:var(--mecx-color-gray-400)!important;pointer-events:none}.mecx-form-field-loading{display:flex}.mecx-form-field-loading svg path{fill:var(--mecx-color-theme-main)}.mecx-form-field-borderless .mecx-form-field-body{background-color:transparent;border:0;border-radius:0;padding:0;height:unset;align-items:flex-start;outline:none;outline-offset:unset}.mecx-form-field-borderless.mecx-form-field-focused .mecx-form-field-body{outline:none;outline-offset:unset}\n"] }]
|
|
2151
2154
|
}], ctorParameters: () => [], propDecorators: { id: [{
|
|
2152
2155
|
type: Input
|
|
2153
2156
|
}], hideAction: [{
|
|
@@ -3463,7 +3466,80 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
|
|
|
3463
3466
|
* This style guide was developed by Monkey Exchange Team
|
|
3464
3467
|
* MIT Licence
|
|
3465
3468
|
************************* */
|
|
3466
|
-
class
|
|
3469
|
+
class MonkeyOptionComponent {
|
|
3470
|
+
constructor() {
|
|
3471
|
+
this.idGenerator = inject(IdGenerator);
|
|
3472
|
+
this.disabled = false;
|
|
3473
|
+
this.type = 'select';
|
|
3474
|
+
this.selected = false;
|
|
3475
|
+
this.tabIndex = 0;
|
|
3476
|
+
this.id = this.idGenerator.getId('mecx-option-');
|
|
3477
|
+
}
|
|
3478
|
+
get displayContent() {
|
|
3479
|
+
return (this._content?.nativeElement.textContent || '').trim();
|
|
3480
|
+
}
|
|
3481
|
+
handleAction(event) {
|
|
3482
|
+
if (this.disabled) {
|
|
3483
|
+
event.stopPropagation();
|
|
3484
|
+
event.preventDefault();
|
|
3485
|
+
}
|
|
3486
|
+
else {
|
|
3487
|
+
this.action?.();
|
|
3488
|
+
}
|
|
3489
|
+
}
|
|
3490
|
+
onClick(event) {
|
|
3491
|
+
this.handleAction(event);
|
|
3492
|
+
}
|
|
3493
|
+
handleKeyDown(event) {
|
|
3494
|
+
const { key } = event;
|
|
3495
|
+
if (key === 'Enter' || key === ' ') {
|
|
3496
|
+
this.handleAction(event);
|
|
3497
|
+
}
|
|
3498
|
+
}
|
|
3499
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: MonkeyOptionComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
3500
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "16.1.0", version: "18.2.13", type: MonkeyOptionComponent, isStandalone: true, selector: "monkey-option", inputs: { value: "value", disabled: ["disabled", "disabled", booleanAttribute], type: "type" }, host: { attributes: { "data-testid": "monkey-option" }, listeners: { "click": "onClick($event)", "keydown": "handleKeyDown($event)" }, properties: { "attr.id": "id", "class.mecx-option-disabled": "disabled", "class.mecx-option-selected": "selected", "attr.tabindex": "disabled ? -1 : tabIndex", "class": "type" }, classAttribute: "mecx-option" }, viewQueries: [{ propertyName: "_content", first: true, predicate: ["content"], descendants: true, static: true }], ngImport: i0, template: `<div #content><ng-content /></div>`, isInline: true, styles: ["monkey-option{display:flex;position:relative;cursor:pointer;padding:16px;line-height:16px;font-size:14px;color:var(--mecx-color-gray-900);transition:all .1s ease-in-out}monkey-option>div{display:flex;white-space:normal;word-break:break-all}monkey-option.select:hover{color:var(--mecx-color-gray-900);background-color:var(--mecx-color-gray-100)}monkey-option.select.mecx-option-disabled{color:var(--mecx-color-gray-400);background-color:#fff;cursor:default}monkey-option.select.mecx-option-selected{color:var(--mecx-color-theme-contrast-main);background-color:var(--mecx-color-theme-main)}.ng-animating monkey-option.select.mecx-option-selected{color:var(--mecx-color-gray-900);background-color:var(--mecx-color-gray-100)}monkey-option.radio{display:flex;align-items:center;gap:10px;padding:8px 24px 8px 0;cursor:pointer;border-radius:4px;-webkit-user-select:none;user-select:none;position:relative}monkey-option.radio:before{content:\"\";width:20px;height:20px;border:2px solid var(--mecx-color-gray-600);border-radius:800px;box-sizing:border-box;background-color:var(--mecx-color-white)}monkey-option.radio:focus{outline:unset;outline-offset:1px}monkey-option.radio:focus:before{outline:2px solid var(--mecx-color-theme-main);outline-offset:1px}monkey-option.radio.mecx-option-selected:before{border:5px solid var(--mecx-color-theme-main)}monkey-option.radio.mecx-option-disabled{opacity:.5;pointer-events:none}monkey-option.radio.mecx-option-disabled:before{background:var(--mecx-color-white);border-color:var(--mecx-color-gray-400)}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
3501
|
+
}
|
|
3502
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: MonkeyOptionComponent, decorators: [{
|
|
3503
|
+
type: Component,
|
|
3504
|
+
args: [{ selector: 'monkey-option', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, template: `<div #content><ng-content /></div>`, encapsulation: ViewEncapsulation.None, host: {
|
|
3505
|
+
'data-testid': 'monkey-option',
|
|
3506
|
+
'[attr.id]': 'id',
|
|
3507
|
+
class: 'mecx-option',
|
|
3508
|
+
'[class.mecx-option-disabled]': 'disabled',
|
|
3509
|
+
'[class.mecx-option-selected]': 'selected',
|
|
3510
|
+
'[attr.tabindex]': 'disabled ? -1 : tabIndex',
|
|
3511
|
+
'[class]': 'type'
|
|
3512
|
+
}, styles: ["monkey-option{display:flex;position:relative;cursor:pointer;padding:16px;line-height:16px;font-size:14px;color:var(--mecx-color-gray-900);transition:all .1s ease-in-out}monkey-option>div{display:flex;white-space:normal;word-break:break-all}monkey-option.select:hover{color:var(--mecx-color-gray-900);background-color:var(--mecx-color-gray-100)}monkey-option.select.mecx-option-disabled{color:var(--mecx-color-gray-400);background-color:#fff;cursor:default}monkey-option.select.mecx-option-selected{color:var(--mecx-color-theme-contrast-main);background-color:var(--mecx-color-theme-main)}.ng-animating monkey-option.select.mecx-option-selected{color:var(--mecx-color-gray-900);background-color:var(--mecx-color-gray-100)}monkey-option.radio{display:flex;align-items:center;gap:10px;padding:8px 24px 8px 0;cursor:pointer;border-radius:4px;-webkit-user-select:none;user-select:none;position:relative}monkey-option.radio:before{content:\"\";width:20px;height:20px;border:2px solid var(--mecx-color-gray-600);border-radius:800px;box-sizing:border-box;background-color:var(--mecx-color-white)}monkey-option.radio:focus{outline:unset;outline-offset:1px}monkey-option.radio:focus:before{outline:2px solid var(--mecx-color-theme-main);outline-offset:1px}monkey-option.radio.mecx-option-selected:before{border:5px solid var(--mecx-color-theme-main)}monkey-option.radio.mecx-option-disabled{opacity:.5;pointer-events:none}monkey-option.radio.mecx-option-disabled:before{background:var(--mecx-color-white);border-color:var(--mecx-color-gray-400)}\n"] }]
|
|
3513
|
+
}], propDecorators: { _content: [{
|
|
3514
|
+
type: ViewChild,
|
|
3515
|
+
args: ['content', { static: true }]
|
|
3516
|
+
}], value: [{
|
|
3517
|
+
type: Input
|
|
3518
|
+
}], disabled: [{
|
|
3519
|
+
type: Input,
|
|
3520
|
+
args: [{ transform: booleanAttribute }]
|
|
3521
|
+
}], type: [{
|
|
3522
|
+
type: Input
|
|
3523
|
+
}], onClick: [{
|
|
3524
|
+
type: HostListener,
|
|
3525
|
+
args: ['click', ['$event']]
|
|
3526
|
+
}], handleKeyDown: [{
|
|
3527
|
+
type: HostListener,
|
|
3528
|
+
args: ['keydown', ['$event']]
|
|
3529
|
+
}] } });
|
|
3530
|
+
|
|
3531
|
+
/** ************************
|
|
3532
|
+
* Copyright Monkey Exchange. All Rights Reserved
|
|
3533
|
+
* This style guide was developed by Monkey Exchange Team
|
|
3534
|
+
* MIT Licence
|
|
3535
|
+
************************* */
|
|
3536
|
+
|
|
3537
|
+
/** ************************
|
|
3538
|
+
* Copyright Monkey Exchange. All Rights Reserved
|
|
3539
|
+
* This style guide was developed by Monkey Exchange Team
|
|
3540
|
+
* MIT Licence
|
|
3541
|
+
************************* */
|
|
3542
|
+
class MonkeySelectComponent {
|
|
3467
3543
|
get disabled() {
|
|
3468
3544
|
if (this.ngControl && this.ngControl.disabled !== null) {
|
|
3469
3545
|
return this.ngControl.disabled;
|
|
@@ -3485,813 +3561,1014 @@ class MonkeyInputUploadComponent {
|
|
|
3485
3561
|
this.stateChanges.next();
|
|
3486
3562
|
}
|
|
3487
3563
|
set value(value) {
|
|
3488
|
-
if (this._value !== value
|
|
3564
|
+
if (this._value !== value) {
|
|
3489
3565
|
this._value = value;
|
|
3490
3566
|
this._onChange(value);
|
|
3491
|
-
this._onTouched(value);
|
|
3492
3567
|
}
|
|
3493
3568
|
}
|
|
3494
3569
|
get value() {
|
|
3495
3570
|
return this._value;
|
|
3496
3571
|
}
|
|
3497
|
-
constructor() {
|
|
3498
|
-
this.
|
|
3572
|
+
constructor(overlay, changeDetectorRef, viewContainerRef, formField) {
|
|
3573
|
+
this.overlay = overlay;
|
|
3574
|
+
this.changeDetectorRef = changeDetectorRef;
|
|
3575
|
+
this.viewContainerRef = viewContainerRef;
|
|
3576
|
+
this.formField = formField;
|
|
3577
|
+
this.tabIndex = 0;
|
|
3578
|
+
this.onChange = new EventEmitter();
|
|
3579
|
+
this.onSearch = new EventEmitter();
|
|
3499
3580
|
this.placeholder = '';
|
|
3500
|
-
this.maxSizeBytes = 5 * 1024 * 1024;
|
|
3501
|
-
this.allowedExtensions = ['.jpg', '.jpeg', '.png', '.pdf', '.txt', '.xls', '.xlsx'];
|
|
3502
3581
|
this.loading = false;
|
|
3503
|
-
this.
|
|
3504
|
-
this.
|
|
3582
|
+
this.showSearch = true;
|
|
3583
|
+
this.searchPlaceholder = '';
|
|
3584
|
+
this.callbackSearch = false;
|
|
3505
3585
|
this._value = null;
|
|
3506
|
-
this.
|
|
3507
|
-
this.
|
|
3586
|
+
this.labelSelected = '';
|
|
3587
|
+
this.overlayRef = null;
|
|
3588
|
+
this._destroyRef = inject(DestroyRef);
|
|
3508
3589
|
this.idGenerator = inject(IdGenerator);
|
|
3509
|
-
this.
|
|
3510
|
-
this.
|
|
3511
|
-
this.type = '';
|
|
3590
|
+
this.ngControl = inject(NgControl, { self: true, optional: true });
|
|
3591
|
+
this._elementRef = inject(ElementRef);
|
|
3512
3592
|
this.currency = false;
|
|
3593
|
+
this.focused = false;
|
|
3594
|
+
this._disabled = false;
|
|
3595
|
+
this.id = this.idGenerator.getId('monkey-select-');
|
|
3513
3596
|
this.percent = false;
|
|
3514
3597
|
this.stateChanges = new Subject();
|
|
3598
|
+
this.type = '';
|
|
3599
|
+
this.searchHandle = new EventEmitter();
|
|
3600
|
+
this.searchDictionary = inject(MonkeyDictionaryService).get('NO-DATA');
|
|
3601
|
+
this.loadingDictionary = inject(MonkeyDictionaryService).get('LOADING');
|
|
3602
|
+
this.showSearchNoData = false;
|
|
3603
|
+
this.isOpen = false;
|
|
3604
|
+
this.searchData = '';
|
|
3605
|
+
this.onAnimationEnd = (event) => {
|
|
3606
|
+
if (event.toState === 'closed') {
|
|
3607
|
+
this.closeOverlay();
|
|
3608
|
+
}
|
|
3609
|
+
};
|
|
3515
3610
|
this._onChange = () => { };
|
|
3516
3611
|
this._onTouched = () => { };
|
|
3517
3612
|
if (this.ngControl) {
|
|
3518
3613
|
this.ngControl.valueAccessor = this;
|
|
3519
3614
|
}
|
|
3520
3615
|
}
|
|
3521
|
-
|
|
3522
|
-
|
|
3523
|
-
|
|
3524
|
-
validateFileExtension(file) {
|
|
3525
|
-
if (!this.allowedExtensions || !this.allowedExtensions.length) {
|
|
3526
|
-
return true;
|
|
3616
|
+
changeControl() {
|
|
3617
|
+
if (this.formField?.control) {
|
|
3618
|
+
this.formField.control.loading = this.loading;
|
|
3527
3619
|
}
|
|
3528
|
-
|
|
3529
|
-
|
|
3530
|
-
|
|
3620
|
+
}
|
|
3621
|
+
changeSelected() {
|
|
3622
|
+
setTimeout(() => {
|
|
3623
|
+
if (this.options) {
|
|
3624
|
+
this.options.forEach((opt) => {
|
|
3625
|
+
opt.selected = opt.value === this.value;
|
|
3626
|
+
});
|
|
3627
|
+
this.updateSelectedLabel();
|
|
3628
|
+
}
|
|
3629
|
+
this.changeDetectorRef.markForCheck();
|
|
3531
3630
|
});
|
|
3532
|
-
return allowedExts.includes(fileExtension);
|
|
3533
3631
|
}
|
|
3534
|
-
|
|
3535
|
-
|
|
3536
|
-
|
|
3537
|
-
|
|
3632
|
+
initializeOptions() {
|
|
3633
|
+
this.options.forEach((option) => {
|
|
3634
|
+
if (!option.action) {
|
|
3635
|
+
option.action = this.selectOption.bind(this, option);
|
|
3636
|
+
}
|
|
3637
|
+
});
|
|
3538
3638
|
}
|
|
3539
|
-
|
|
3540
|
-
if (
|
|
3541
|
-
this.
|
|
3542
|
-
this.
|
|
3543
|
-
this.
|
|
3639
|
+
openDropdown() {
|
|
3640
|
+
if (this.options?.length) {
|
|
3641
|
+
this.formField.control.disableToBeDirty = true;
|
|
3642
|
+
this.isOpen = true;
|
|
3643
|
+
this.createOverlay();
|
|
3544
3644
|
}
|
|
3545
3645
|
}
|
|
3546
|
-
|
|
3646
|
+
closeDropdown() {
|
|
3647
|
+
this.changeDetectorRef.markForCheck();
|
|
3648
|
+
this.isOpen = false;
|
|
3547
3649
|
this.focused = false;
|
|
3548
|
-
this.
|
|
3549
|
-
|
|
3550
|
-
|
|
3551
|
-
ngOnChanges(changes) { }
|
|
3552
|
-
ngOnDestroy() { }
|
|
3553
|
-
registerOnChange(fn) {
|
|
3554
|
-
this._onChange = fn;
|
|
3555
|
-
}
|
|
3556
|
-
registerOnTouched(fn) {
|
|
3557
|
-
this._onTouched = fn;
|
|
3558
|
-
}
|
|
3559
|
-
setDisabledState(isDisabled) {
|
|
3560
|
-
this.disabled = isDisabled;
|
|
3561
|
-
if (this.fileInput) {
|
|
3562
|
-
this.fileInput.nativeElement.disabled = isDisabled;
|
|
3650
|
+
this.formField.control.disableToBeDirty = false;
|
|
3651
|
+
if (!this.callbackSearch) {
|
|
3652
|
+
this.searchData = '';
|
|
3563
3653
|
}
|
|
3564
3654
|
}
|
|
3565
|
-
|
|
3566
|
-
this.
|
|
3567
|
-
|
|
3568
|
-
|
|
3569
|
-
if (this.fileInput) {
|
|
3570
|
-
this.fileInput.nativeElement.value = '';
|
|
3655
|
+
closeOverlay() {
|
|
3656
|
+
if (this.overlayRef) {
|
|
3657
|
+
this.overlayRef.dispose();
|
|
3658
|
+
this.overlayRef = null;
|
|
3571
3659
|
}
|
|
3572
3660
|
}
|
|
3573
|
-
|
|
3574
|
-
|
|
3575
|
-
|
|
3576
|
-
|
|
3577
|
-
|
|
3578
|
-
|
|
3579
|
-
|
|
3580
|
-
|
|
3581
|
-
this.fileInput.nativeElement.value = '';
|
|
3582
|
-
}
|
|
3583
|
-
if (!this.validateFileSize(file)) {
|
|
3584
|
-
this.ngControl?.control?.setErrors({
|
|
3585
|
-
maxFileSize: true,
|
|
3586
|
-
sizeAllowed: formatFileSize(this.maxSizeBytes)
|
|
3661
|
+
initializeWithOverlay() {
|
|
3662
|
+
if (this.showSearch) {
|
|
3663
|
+
const element = this.overlayRef?.overlayElement.querySelector(`#${this.id}-search`);
|
|
3664
|
+
this.options.forEach((opt) => {
|
|
3665
|
+
const element = this.overlayRef?.overlayElement.querySelector(`#${opt.id}`);
|
|
3666
|
+
if (!element)
|
|
3667
|
+
return;
|
|
3668
|
+
element.style.display = '';
|
|
3587
3669
|
});
|
|
3588
|
-
|
|
3589
|
-
|
|
3590
|
-
|
|
3670
|
+
setTimeout(() => {
|
|
3671
|
+
element?.focus();
|
|
3672
|
+
}, 0);
|
|
3673
|
+
this.showSearchNoData = false;
|
|
3591
3674
|
}
|
|
3592
|
-
|
|
3593
|
-
this.
|
|
3594
|
-
|
|
3595
|
-
extensionAllowed: this.allowedExtensions.join(', ')
|
|
3675
|
+
setTimeout(() => {
|
|
3676
|
+
const selected = this.options.find((opt) => {
|
|
3677
|
+
return opt.selected;
|
|
3596
3678
|
});
|
|
3597
|
-
|
|
3598
|
-
|
|
3679
|
+
if (selected) {
|
|
3680
|
+
const element = this.overlayRef?.overlayElement.querySelector(`#${selected.id}`);
|
|
3681
|
+
element?.scrollIntoView({ behavior: 'instant', block: 'center' });
|
|
3682
|
+
}
|
|
3683
|
+
}, 0);
|
|
3684
|
+
}
|
|
3685
|
+
createOverlay() {
|
|
3686
|
+
if (this.overlayRef) {
|
|
3599
3687
|
return;
|
|
3600
3688
|
}
|
|
3601
|
-
|
|
3602
|
-
|
|
3603
|
-
|
|
3604
|
-
|
|
3605
|
-
|
|
3606
|
-
|
|
3607
|
-
|
|
3608
|
-
|
|
3609
|
-
}
|
|
3610
|
-
|
|
3611
|
-
|
|
3612
|
-
|
|
3613
|
-
|
|
3614
|
-
|
|
3615
|
-
|
|
3616
|
-
|
|
3617
|
-
|
|
3618
|
-
|
|
3619
|
-
|
|
3620
|
-
|
|
3621
|
-
|
|
3622
|
-
|
|
3623
|
-
|
|
3624
|
-
|
|
3625
|
-
|
|
3626
|
-
|
|
3627
|
-
|
|
3628
|
-
|
|
3629
|
-
|
|
3630
|
-
|
|
3689
|
+
const offset = 4;
|
|
3690
|
+
const positions = [
|
|
3691
|
+
{
|
|
3692
|
+
originX: 'start',
|
|
3693
|
+
originY: 'bottom',
|
|
3694
|
+
overlayX: 'start',
|
|
3695
|
+
overlayY: 'top',
|
|
3696
|
+
offsetY: offset
|
|
3697
|
+
},
|
|
3698
|
+
{
|
|
3699
|
+
originX: 'start',
|
|
3700
|
+
originY: 'top',
|
|
3701
|
+
overlayX: 'start',
|
|
3702
|
+
overlayY: 'bottom',
|
|
3703
|
+
offsetY: -offset
|
|
3704
|
+
}
|
|
3705
|
+
];
|
|
3706
|
+
let anchor = this.trigger;
|
|
3707
|
+
let width = anchor.nativeElement.offsetWidth;
|
|
3708
|
+
if (this.formField?.elementRef) {
|
|
3709
|
+
const el = this.formField?.elementRef.nativeElement.querySelector('.mecx-form-field-body');
|
|
3710
|
+
anchor = el;
|
|
3711
|
+
width = el.offsetWidth;
|
|
3712
|
+
}
|
|
3713
|
+
const positionStrategy = this.overlay
|
|
3714
|
+
.position()
|
|
3715
|
+
.flexibleConnectedTo(anchor)
|
|
3716
|
+
.withPositions(positions)
|
|
3717
|
+
.withPush(true);
|
|
3718
|
+
this.overlayRef = this.overlay.create({
|
|
3719
|
+
positionStrategy,
|
|
3720
|
+
scrollStrategy: this.overlay.scrollStrategies.block(),
|
|
3721
|
+
width,
|
|
3722
|
+
hasBackdrop: true,
|
|
3723
|
+
backdropClass: 'no-class'
|
|
3724
|
+
});
|
|
3725
|
+
const portal = new TemplatePortal(this.overlayTemplate, this.viewContainerRef);
|
|
3726
|
+
this.overlayRef.attach(portal);
|
|
3727
|
+
this.overlayRef
|
|
3728
|
+
.backdropClick()
|
|
3729
|
+
.pipe(takeUntilDestroyed(this._destroyRef))
|
|
3730
|
+
.subscribe(() => {
|
|
3731
|
+
return this.closeDropdown();
|
|
3732
|
+
});
|
|
3733
|
+
this.initializeWithOverlay();
|
|
3631
3734
|
}
|
|
3632
|
-
|
|
3735
|
+
updateSelectedLabel() {
|
|
3736
|
+
const selectedOption = this.options.find((opt) => {
|
|
3737
|
+
return opt.value === this.value;
|
|
3738
|
+
});
|
|
3739
|
+
this.labelSelected = selectedOption ? selectedOption.displayContent : '';
|
|
3740
|
+
}
|
|
3741
|
+
executeSearch(search) {
|
|
3742
|
+
let found = false;
|
|
3743
|
+
this.options.forEach((opt) => {
|
|
3744
|
+
const element = this.overlayRef?.overlayElement.querySelector(`#${opt.id}`);
|
|
3745
|
+
if (!element)
|
|
3746
|
+
return;
|
|
3747
|
+
const isMatch = normalizeStringToSearch(opt.displayContent).includes(normalizeStringToSearch(search));
|
|
3748
|
+
if (isMatch) {
|
|
3749
|
+
found = true;
|
|
3750
|
+
}
|
|
3751
|
+
element.style.display = isMatch ? '' : 'none';
|
|
3752
|
+
});
|
|
3753
|
+
this.repositionScroll();
|
|
3754
|
+
this.showSearchNoData = !found;
|
|
3755
|
+
}
|
|
3756
|
+
repositionScroll() {
|
|
3757
|
+
const overlayElement = this.overlayRef?.overlayElement.querySelector('.mecx-select-overlay');
|
|
3758
|
+
if (overlayElement) {
|
|
3759
|
+
overlayElement.scrollTop = 0;
|
|
3760
|
+
}
|
|
3761
|
+
}
|
|
3762
|
+
ngOnInit() {
|
|
3763
|
+
this.searchHandle
|
|
3764
|
+
.pipe(debounceTime(200), takeUntilDestroyed(this._destroyRef))
|
|
3765
|
+
.subscribe((search) => {
|
|
3766
|
+
if (this.callbackSearch) {
|
|
3767
|
+
this.onSearch.next(search);
|
|
3768
|
+
this.repositionScroll();
|
|
3769
|
+
}
|
|
3770
|
+
else {
|
|
3771
|
+
this.executeSearch(search);
|
|
3772
|
+
}
|
|
3773
|
+
});
|
|
3774
|
+
}
|
|
3775
|
+
ngAfterContentInit() {
|
|
3776
|
+
this.initializeOptions();
|
|
3777
|
+
this.options.changes.pipe(takeUntilDestroyed(this._destroyRef)).subscribe((resp) => {
|
|
3778
|
+
this.updateSelectedLabel();
|
|
3779
|
+
this.initializeOptions();
|
|
3780
|
+
this.changeSelected();
|
|
3781
|
+
});
|
|
3782
|
+
}
|
|
3783
|
+
ngOnDestroy() {
|
|
3784
|
+
if (this.overlayRef) {
|
|
3785
|
+
this.overlayRef.dispose();
|
|
3786
|
+
}
|
|
3787
|
+
}
|
|
3788
|
+
toggleDropdown() {
|
|
3789
|
+
if (!this.disabled) {
|
|
3790
|
+
if (this.isOpen) {
|
|
3791
|
+
this.closeDropdown();
|
|
3792
|
+
this._onTouched();
|
|
3793
|
+
}
|
|
3794
|
+
else {
|
|
3795
|
+
this.openDropdown();
|
|
3796
|
+
}
|
|
3797
|
+
}
|
|
3798
|
+
}
|
|
3799
|
+
selectOption(option) {
|
|
3800
|
+
if (!option.disabled && !this.disabled) {
|
|
3801
|
+
this.value = option.value;
|
|
3802
|
+
this.updateSelectedLabel();
|
|
3803
|
+
this.closeDropdown();
|
|
3804
|
+
this._onChange(this.value);
|
|
3805
|
+
this.onChange.emit(this.value);
|
|
3806
|
+
this.options.forEach((opt) => {
|
|
3807
|
+
opt.selected = opt.value === this.value;
|
|
3808
|
+
});
|
|
3809
|
+
}
|
|
3810
|
+
}
|
|
3811
|
+
writeValue(value) {
|
|
3812
|
+
this.value = value;
|
|
3813
|
+
this.changeSelected();
|
|
3814
|
+
}
|
|
3815
|
+
onContainerClick(event) {
|
|
3816
|
+
if (this.disabled)
|
|
3817
|
+
return;
|
|
3818
|
+
this.openDropdown();
|
|
3819
|
+
this._elementRef.nativeElement.focus();
|
|
3820
|
+
}
|
|
3821
|
+
_onFocus() {
|
|
3822
|
+
if (!this.disabled) {
|
|
3823
|
+
this.focused = true;
|
|
3824
|
+
this._onTouched();
|
|
3825
|
+
this.stateChanges.next();
|
|
3826
|
+
}
|
|
3827
|
+
}
|
|
3828
|
+
_onBlur() {
|
|
3829
|
+
this.focused = false;
|
|
3830
|
+
this.stateChanges.next();
|
|
3831
|
+
}
|
|
3832
|
+
registerOnChange(fn) {
|
|
3833
|
+
this._onChange = fn;
|
|
3834
|
+
}
|
|
3835
|
+
registerOnTouched(fn) {
|
|
3836
|
+
this._onTouched = fn;
|
|
3837
|
+
}
|
|
3838
|
+
setDisabledState(isDisabled) {
|
|
3839
|
+
this.disabled = isDisabled;
|
|
3840
|
+
}
|
|
3841
|
+
ngOnChanges(changes) {
|
|
3842
|
+
let hasChanges = false;
|
|
3843
|
+
// eslint-disable-next-line dot-notation
|
|
3844
|
+
const changesLoading = changes?.['loading'];
|
|
3845
|
+
if (changesLoading?.currentValue !== changesLoading?.previousValue) {
|
|
3846
|
+
hasChanges = true;
|
|
3847
|
+
this.changeControl();
|
|
3848
|
+
}
|
|
3849
|
+
if (hasChanges) {
|
|
3850
|
+
this.stateChanges.next();
|
|
3851
|
+
}
|
|
3852
|
+
}
|
|
3853
|
+
onHandleSearch(event) {
|
|
3854
|
+
try {
|
|
3855
|
+
const { value } = event.target;
|
|
3856
|
+
const handled = sanitizeString(value);
|
|
3857
|
+
this.searchHandle.next(handled || '');
|
|
3858
|
+
}
|
|
3859
|
+
catch (e) {
|
|
3860
|
+
// not to do
|
|
3861
|
+
}
|
|
3862
|
+
}
|
|
3863
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: MonkeySelectComponent, deps: [{ token: i1$1.Overlay }, { token: i0.ChangeDetectorRef }, { token: i0.ViewContainerRef }, { token: MonkeyFormFieldComponent, optional: true }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
3864
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.13", type: MonkeySelectComponent, isStandalone: true, selector: "monkey-select", inputs: { tabIndex: "tabIndex", placeholder: "placeholder", loading: ["loading", "loading", booleanAttribute], showSearch: ["showSearch", "showSearch", booleanAttribute], searchPlaceholder: "searchPlaceholder", callbackSearch: ["callbackSearch", "callbackSearch", booleanAttribute], disabled: ["disabled", "disabled", booleanAttribute], required: ["required", "required", booleanAttribute], value: "value" }, outputs: { onChange: "onChange", onSearch: "onSearch" }, host: { attributes: { "data-testid": "monkey-select" }, listeners: { "focus": "_onFocus()", "blur": "_onBlur()" }, properties: { "class.mecx-select-disabled": "_disabled", "class.mecx-select-focused": "focused", "attr.id": "id", "attr.tabindex": "disabled ? -1 : tabIndex" }, classAttribute: "mecx-select" }, providers: [
|
|
3865
|
+
// eslint-disable-next-line no-use-before-define
|
|
3866
|
+
{ provide: MonkeyFormFieldControl, useExisting: MonkeySelectComponent }
|
|
3867
|
+
], queries: [{ propertyName: "options", predicate: MonkeyOptionComponent }], viewQueries: [{ propertyName: "overlayTemplate", first: true, predicate: ["overlayTemplate"], descendants: true }, { propertyName: "overlayEl", first: true, predicate: ["overlay"], descendants: true }, { propertyName: "trigger", first: true, predicate: ["trigger"], descendants: true }], usesOnChanges: true, ngImport: i0, template: "<div\n class=\"mecx-select-trigger\"\n [class.open]=\"isOpen\"\n (click)=\"toggleDropdown()\"\n role=\"combobox\"\n [attr.aria-expanded]=\"isOpen\"\n #trigger\n>\n <div class=\"mecx-select-value\" [class.has-value]=\"value\">\n <span>{{ labelSelected || placeholder }}</span>\n </div>\n\n @if (!loading) {\n <util-icon class=\"mecx-select-icon\" name=\"arrowDown\" />\n }\n</div>\n\n<ng-template #overlayTemplate>\n <div class=\"mecx-select-body-overlay\">\n @if (showSearch) {\n <div class=\"mecx-select-search\">\n <util-icon class=\"mecx-select-search-icon\" name=\"search\" />\n <input\n (input)=\"onHandleSearch($event)\"\n type=\"text\"\n [id]=\"id + '-search'\"\n autocomplete=\"off\"\n maxlength=\"50\"\n [placeholder]=\"searchPlaceholder\"\n [(ngModel)]=\"searchData\"\n />\n </div>\n }\n <div\n class=\"mecx-select-overlay\"\n #overlay\n [@animation]=\"isOpen ? 'open' : 'closed'\"\n (@animation.done)=\"onAnimationEnd($event)\"\n >\n <ng-content />\n </div>\n @if (showSearch && showSearchNoData) {\n <div class=\"mecx-select-search-no-data\">\n <util-icon class=\"mecx-select-search-no-data-icon\" name=\"searchFail\" />\n {{ searchDictionary | async }}\n </div>\n }\n @if (loading) {\n <div class=\"mecx-select-search-loading\">\n {{ loadingDictionary | async }}\n </div>\n }\n </div>\n</ng-template>\n", styles: ["monkey-select{display:inline-flex;width:100%;min-width:0;position:relative}monkey-select:focus-visible,monkey-select:focus{outline:none}.mecx-select-trigger{width:100%;display:inline-flex;align-items:center;cursor:pointer;gap:8px;box-sizing:border-box}.mecx-select-trigger .mecx-select-value{flex-grow:1;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;color:var(--mecx-color-gray-500);font-size:14px;line-height:24px;letter-spacing:.42px}.mecx-select-trigger .mecx-select-value.has-value{color:var(--mecx-color-gray-900)}.mecx-select-trigger .mecx-select-icon{display:flex;transition:all .2s ease-in-out}.mecx-select-trigger .mecx-select-icon svg *{stroke:var(--mecx-color-theme-main)}.mecx-select-disabled .mecx-select-trigger{background-color:var(--mecx-color-gray-50);border-color:var(--mecx-color-gray-50);cursor:default}.mecx-select-disabled .mecx-select-trigger .mecx-select-value{color:var(--mecx-color-gray-400)}.mecx-select-disabled .mecx-select-trigger .mecx-select-icon svg *{stroke:var(--mecx-color-gray-400)}.mecx-select-trigger.open .mecx-select-icon{transform:rotate(180deg)}.mecx-select-body-overlay{width:100%;background:#fff;border:2px solid var(--mecx-color-gray-400);overflow:hidden;border-radius:4px;box-shadow:0 16px 32px 0 var(--mecx-color-box-shadow)}.mecx-select-body-overlay .mecx-select-search{display:flex;gap:4px;border-bottom:2px solid var(--mecx-color-gray-400);padding:8px}.mecx-select-body-overlay .mecx-select-search-icon{width:12px;display:flex}.mecx-select-body-overlay .mecx-select-search-icon svg path{stroke:var(--mecx-color-gray-600)}.mecx-select-body-overlay input{border:none;width:90%;color:var(--mecx-color-gray-600)!important;font-size:12px;letter-spacing:.54px}.mecx-select-body-overlay .mecx-select-search-no-data,.mecx-select-body-overlay .mecx-select-search-loading{padding:12px;display:flex;justify-content:center;flex-direction:column;align-items:center;gap:4px;color:var(--mecx-color-gray-600);font-size:12px;letter-spacing:.54px;text-align:center}.mecx-select-body-overlay .mecx-select-search-no-data-icon svg path,.mecx-select-body-overlay .mecx-select-search-loading-icon svg path{stroke:var(--mecx-color-gray-600)}.mecx-select-overlay{width:100%;background:#fff;overflow:hidden auto;max-height:360px}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "pipe", type: i1.AsyncPipe, name: "async" }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.MaxLengthValidator, selector: "[maxlength][formControlName],[maxlength][formControl],[maxlength][ngModel]", inputs: ["maxlength"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: UtilIconComponent, selector: "util-icon", inputs: ["name"] }], animations: [
|
|
3868
|
+
trigger('animation', [
|
|
3869
|
+
transition(':enter', [
|
|
3870
|
+
style({
|
|
3871
|
+
opacity: 0,
|
|
3872
|
+
transform: 'scaleY(.9)'
|
|
3873
|
+
}),
|
|
3874
|
+
animate('100ms ease-in-out', style({
|
|
3875
|
+
opacity: 1,
|
|
3876
|
+
transform: 'scaleY(1)'
|
|
3877
|
+
}))
|
|
3878
|
+
]),
|
|
3879
|
+
state('closed', style({
|
|
3880
|
+
transform: 'scaleY(.9)',
|
|
3881
|
+
opacity: 0
|
|
3882
|
+
})),
|
|
3883
|
+
transition('closed <=> open', animate('200ms ease-in-out'))
|
|
3884
|
+
])
|
|
3885
|
+
], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
3633
3886
|
}
|
|
3634
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type:
|
|
3887
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: MonkeySelectComponent, decorators: [{
|
|
3635
3888
|
type: Component,
|
|
3636
|
-
args: [{ selector: 'monkey-
|
|
3637
|
-
<div class="mecx-input-upload-value" [class.has-value]="value">
|
|
3638
|
-
{{ value?.fileName || placeholder }}
|
|
3639
|
-
</div>
|
|
3640
|
-
<input
|
|
3641
|
-
(change)="onFileSelected($event)"
|
|
3642
|
-
type="file"
|
|
3643
|
-
class="file-input"
|
|
3644
|
-
#fileInput
|
|
3645
|
-
[accept]="allowedExtensions.join(',')"
|
|
3646
|
-
/>
|
|
3647
|
-
@if (loading) {
|
|
3648
|
-
<div class="progress">
|
|
3649
|
-
<div class="progress-bar" [style.width.%]="progress"></div>
|
|
3650
|
-
</div>
|
|
3651
|
-
}
|
|
3652
|
-
`, providers: [
|
|
3889
|
+
args: [{ selector: 'monkey-select', standalone: true, imports: [CommonModule, ReactiveFormsModule, FormsModule, UtilIconComponent], changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, providers: [
|
|
3653
3890
|
// eslint-disable-next-line no-use-before-define
|
|
3654
|
-
{ provide: MonkeyFormFieldControl, useExisting:
|
|
3891
|
+
{ provide: MonkeyFormFieldControl, useExisting: MonkeySelectComponent }
|
|
3892
|
+
], animations: [
|
|
3893
|
+
trigger('animation', [
|
|
3894
|
+
transition(':enter', [
|
|
3895
|
+
style({
|
|
3896
|
+
opacity: 0,
|
|
3897
|
+
transform: 'scaleY(.9)'
|
|
3898
|
+
}),
|
|
3899
|
+
animate('100ms ease-in-out', style({
|
|
3900
|
+
opacity: 1,
|
|
3901
|
+
transform: 'scaleY(1)'
|
|
3902
|
+
}))
|
|
3903
|
+
]),
|
|
3904
|
+
state('closed', style({
|
|
3905
|
+
transform: 'scaleY(.9)',
|
|
3906
|
+
opacity: 0
|
|
3907
|
+
})),
|
|
3908
|
+
transition('closed <=> open', animate('200ms ease-in-out'))
|
|
3909
|
+
])
|
|
3655
3910
|
], host: {
|
|
3656
|
-
'
|
|
3657
|
-
class: 'mecx-
|
|
3658
|
-
'[class.mecx-
|
|
3659
|
-
'[class.mecx-
|
|
3911
|
+
'data-testid': 'monkey-select',
|
|
3912
|
+
class: 'mecx-select',
|
|
3913
|
+
'[class.mecx-select-disabled]': '_disabled',
|
|
3914
|
+
'[class.mecx-select-focused]': 'focused',
|
|
3660
3915
|
'[attr.id]': 'id',
|
|
3661
3916
|
'[attr.tabindex]': 'disabled ? -1 : tabIndex',
|
|
3662
3917
|
'(focus)': '_onFocus()',
|
|
3663
3918
|
'(blur)': '_onBlur()'
|
|
3664
|
-
},
|
|
3665
|
-
}], ctorParameters: () => [
|
|
3919
|
+
}, template: "<div\n class=\"mecx-select-trigger\"\n [class.open]=\"isOpen\"\n (click)=\"toggleDropdown()\"\n role=\"combobox\"\n [attr.aria-expanded]=\"isOpen\"\n #trigger\n>\n <div class=\"mecx-select-value\" [class.has-value]=\"value\">\n <span>{{ labelSelected || placeholder }}</span>\n </div>\n\n @if (!loading) {\n <util-icon class=\"mecx-select-icon\" name=\"arrowDown\" />\n }\n</div>\n\n<ng-template #overlayTemplate>\n <div class=\"mecx-select-body-overlay\">\n @if (showSearch) {\n <div class=\"mecx-select-search\">\n <util-icon class=\"mecx-select-search-icon\" name=\"search\" />\n <input\n (input)=\"onHandleSearch($event)\"\n type=\"text\"\n [id]=\"id + '-search'\"\n autocomplete=\"off\"\n maxlength=\"50\"\n [placeholder]=\"searchPlaceholder\"\n [(ngModel)]=\"searchData\"\n />\n </div>\n }\n <div\n class=\"mecx-select-overlay\"\n #overlay\n [@animation]=\"isOpen ? 'open' : 'closed'\"\n (@animation.done)=\"onAnimationEnd($event)\"\n >\n <ng-content />\n </div>\n @if (showSearch && showSearchNoData) {\n <div class=\"mecx-select-search-no-data\">\n <util-icon class=\"mecx-select-search-no-data-icon\" name=\"searchFail\" />\n {{ searchDictionary | async }}\n </div>\n }\n @if (loading) {\n <div class=\"mecx-select-search-loading\">\n {{ loadingDictionary | async }}\n </div>\n }\n </div>\n</ng-template>\n", styles: ["monkey-select{display:inline-flex;width:100%;min-width:0;position:relative}monkey-select:focus-visible,monkey-select:focus{outline:none}.mecx-select-trigger{width:100%;display:inline-flex;align-items:center;cursor:pointer;gap:8px;box-sizing:border-box}.mecx-select-trigger .mecx-select-value{flex-grow:1;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;color:var(--mecx-color-gray-500);font-size:14px;line-height:24px;letter-spacing:.42px}.mecx-select-trigger .mecx-select-value.has-value{color:var(--mecx-color-gray-900)}.mecx-select-trigger .mecx-select-icon{display:flex;transition:all .2s ease-in-out}.mecx-select-trigger .mecx-select-icon svg *{stroke:var(--mecx-color-theme-main)}.mecx-select-disabled .mecx-select-trigger{background-color:var(--mecx-color-gray-50);border-color:var(--mecx-color-gray-50);cursor:default}.mecx-select-disabled .mecx-select-trigger .mecx-select-value{color:var(--mecx-color-gray-400)}.mecx-select-disabled .mecx-select-trigger .mecx-select-icon svg *{stroke:var(--mecx-color-gray-400)}.mecx-select-trigger.open .mecx-select-icon{transform:rotate(180deg)}.mecx-select-body-overlay{width:100%;background:#fff;border:2px solid var(--mecx-color-gray-400);overflow:hidden;border-radius:4px;box-shadow:0 16px 32px 0 var(--mecx-color-box-shadow)}.mecx-select-body-overlay .mecx-select-search{display:flex;gap:4px;border-bottom:2px solid var(--mecx-color-gray-400);padding:8px}.mecx-select-body-overlay .mecx-select-search-icon{width:12px;display:flex}.mecx-select-body-overlay .mecx-select-search-icon svg path{stroke:var(--mecx-color-gray-600)}.mecx-select-body-overlay input{border:none;width:90%;color:var(--mecx-color-gray-600)!important;font-size:12px;letter-spacing:.54px}.mecx-select-body-overlay .mecx-select-search-no-data,.mecx-select-body-overlay .mecx-select-search-loading{padding:12px;display:flex;justify-content:center;flex-direction:column;align-items:center;gap:4px;color:var(--mecx-color-gray-600);font-size:12px;letter-spacing:.54px;text-align:center}.mecx-select-body-overlay .mecx-select-search-no-data-icon svg path,.mecx-select-body-overlay .mecx-select-search-loading-icon svg path{stroke:var(--mecx-color-gray-600)}.mecx-select-overlay{width:100%;background:#fff;overflow:hidden auto;max-height:360px}\n"] }]
|
|
3920
|
+
}], ctorParameters: () => [{ type: i1$1.Overlay }, { type: i0.ChangeDetectorRef }, { type: i0.ViewContainerRef }, { type: MonkeyFormFieldComponent, decorators: [{
|
|
3921
|
+
type: Optional
|
|
3922
|
+
}] }], propDecorators: { overlayTemplate: [{
|
|
3666
3923
|
type: ViewChild,
|
|
3667
|
-
args: ['
|
|
3668
|
-
}],
|
|
3669
|
-
type:
|
|
3670
|
-
|
|
3671
|
-
|
|
3672
|
-
|
|
3673
|
-
|
|
3674
|
-
}],
|
|
3675
|
-
type:
|
|
3676
|
-
|
|
3677
|
-
|
|
3678
|
-
|
|
3679
|
-
}],
|
|
3680
|
-
type:
|
|
3681
|
-
}],
|
|
3682
|
-
type:
|
|
3683
|
-
|
|
3684
|
-
|
|
3685
|
-
|
|
3686
|
-
|
|
3687
|
-
|
|
3688
|
-
|
|
3689
|
-
}],
|
|
3690
|
-
type:
|
|
3691
|
-
|
|
3692
|
-
|
|
3693
|
-
|
|
3694
|
-
|
|
3695
|
-
|
|
3696
|
-
|
|
3697
|
-
|
|
3698
|
-
|
|
3699
|
-
|
|
3700
|
-
|
|
3701
|
-
|
|
3702
|
-
|
|
3703
|
-
|
|
3704
|
-
|
|
3705
|
-
|
|
3706
|
-
this.mkAlign = 'end';
|
|
3707
|
-
this.id = inject(IdGenerator).getId('monkey-modal-actions-');
|
|
3708
|
-
}
|
|
3709
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: MonkeyModalActionsDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
3710
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.13", type: MonkeyModalActionsDirective, selector: "monkey-modal-actions, [monkey-modal-actions]", inputs: { mkAlign: "mkAlign" }, host: { properties: { "class": "'mecx-modal-actions align-'+mkAlign", "attr.id": "id || null" } }, ngImport: i0 }); }
|
|
3711
|
-
}
|
|
3712
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: MonkeyModalActionsDirective, decorators: [{
|
|
3713
|
-
type: Directive,
|
|
3714
|
-
args: [{
|
|
3715
|
-
selector: 'monkey-modal-actions, [monkey-modal-actions]',
|
|
3716
|
-
host: {
|
|
3717
|
-
'[class]': `'mecx-modal-actions align-'+mkAlign`,
|
|
3718
|
-
'[attr.id]': 'id || null'
|
|
3719
|
-
}
|
|
3720
|
-
}]
|
|
3721
|
-
}], propDecorators: { mkAlign: [{
|
|
3722
|
-
type: Input
|
|
3723
|
-
}] } });
|
|
3724
|
-
|
|
3725
|
-
/** ************************
|
|
3726
|
-
* Copyright Monkey Exchange. All Rights Reserved
|
|
3727
|
-
* This style guide was developed by Monkey Exchange Team
|
|
3728
|
-
* MIT Licence
|
|
3729
|
-
************************* */
|
|
3730
|
-
class MonkeyModalContentDirective {
|
|
3731
|
-
constructor() {
|
|
3732
|
-
this.id = inject(IdGenerator).getId('monkey-modal-content-');
|
|
3733
|
-
}
|
|
3734
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: MonkeyModalContentDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
3735
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.13", type: MonkeyModalContentDirective, selector: "monkey-modal-content, [monkey-modal-content]", host: { properties: { "attr.id": "id || null" }, classAttribute: "mecx-modal-content" }, ngImport: i0 }); }
|
|
3736
|
-
}
|
|
3737
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: MonkeyModalContentDirective, decorators: [{
|
|
3738
|
-
type: Directive,
|
|
3739
|
-
args: [{
|
|
3740
|
-
selector: 'monkey-modal-content, [monkey-modal-content]',
|
|
3741
|
-
host: {
|
|
3742
|
-
class: 'mecx-modal-content',
|
|
3743
|
-
'[attr.id]': 'id || null'
|
|
3744
|
-
}
|
|
3745
|
-
}]
|
|
3746
|
-
}] });
|
|
3747
|
-
|
|
3748
|
-
/** ************************
|
|
3749
|
-
* Copyright Monkey Exchange. All Rights Reserved
|
|
3750
|
-
* This style guide was developed by Monkey Exchange Team
|
|
3751
|
-
* MIT Licence
|
|
3752
|
-
************************* */
|
|
3753
|
-
class MonkeyModalSubtitleDirective {
|
|
3754
|
-
constructor() {
|
|
3755
|
-
this.id = inject(IdGenerator).getId('monkey-modal-subtitle-');
|
|
3756
|
-
}
|
|
3757
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: MonkeyModalSubtitleDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
3758
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.13", type: MonkeyModalSubtitleDirective, selector: "monkey-modal-subtitle, [monkey-modal-subtitle]", host: { properties: { "attr.id": "id || null" }, classAttribute: "mecx-modal-subtitle" }, ngImport: i0 }); }
|
|
3759
|
-
}
|
|
3760
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: MonkeyModalSubtitleDirective, decorators: [{
|
|
3761
|
-
type: Directive,
|
|
3762
|
-
args: [{
|
|
3763
|
-
selector: 'monkey-modal-subtitle, [monkey-modal-subtitle]',
|
|
3764
|
-
host: {
|
|
3765
|
-
class: 'mecx-modal-subtitle',
|
|
3766
|
-
'[attr.id]': 'id || null'
|
|
3767
|
-
}
|
|
3768
|
-
}]
|
|
3769
|
-
}] });
|
|
3770
|
-
|
|
3771
|
-
/** ************************
|
|
3772
|
-
* Copyright Monkey Exchange. All Rights Reserved
|
|
3773
|
-
* This style guide was developed by Monkey Exchange Team
|
|
3774
|
-
* MIT Licence
|
|
3775
|
-
************************* */
|
|
3776
|
-
class MonkeyModalTitleDirective {
|
|
3777
|
-
constructor() {
|
|
3778
|
-
this.id = inject(IdGenerator).getId('monkey-modal-title-');
|
|
3779
|
-
}
|
|
3780
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: MonkeyModalTitleDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
3781
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.13", type: MonkeyModalTitleDirective, selector: "monkey-modal-title, [monkey-modal-title]", host: { properties: { "attr.id": "id || null" }, classAttribute: "mecx-modal-title" }, ngImport: i0 }); }
|
|
3782
|
-
}
|
|
3783
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: MonkeyModalTitleDirective, decorators: [{
|
|
3784
|
-
type: Directive,
|
|
3785
|
-
args: [{
|
|
3786
|
-
selector: 'monkey-modal-title, [monkey-modal-title]',
|
|
3787
|
-
host: {
|
|
3788
|
-
class: 'mecx-modal-title',
|
|
3789
|
-
'[attr.id]': 'id || null'
|
|
3790
|
-
}
|
|
3791
|
-
}]
|
|
3792
|
-
}] });
|
|
3924
|
+
args: ['overlayTemplate']
|
|
3925
|
+
}], overlayEl: [{
|
|
3926
|
+
type: ViewChild,
|
|
3927
|
+
args: ['overlay']
|
|
3928
|
+
}], trigger: [{
|
|
3929
|
+
type: ViewChild,
|
|
3930
|
+
args: ['trigger']
|
|
3931
|
+
}], options: [{
|
|
3932
|
+
type: ContentChildren,
|
|
3933
|
+
args: [MonkeyOptionComponent]
|
|
3934
|
+
}], tabIndex: [{
|
|
3935
|
+
type: Input
|
|
3936
|
+
}], onChange: [{
|
|
3937
|
+
type: Output
|
|
3938
|
+
}], onSearch: [{
|
|
3939
|
+
type: Output
|
|
3940
|
+
}], placeholder: [{
|
|
3941
|
+
type: Input,
|
|
3942
|
+
args: [{ required: true }]
|
|
3943
|
+
}], loading: [{
|
|
3944
|
+
type: Input,
|
|
3945
|
+
args: [{ transform: booleanAttribute }]
|
|
3946
|
+
}], showSearch: [{
|
|
3947
|
+
type: Input,
|
|
3948
|
+
args: [{ transform: booleanAttribute }]
|
|
3949
|
+
}], searchPlaceholder: [{
|
|
3950
|
+
type: Input
|
|
3951
|
+
}], callbackSearch: [{
|
|
3952
|
+
type: Input,
|
|
3953
|
+
args: [{ transform: booleanAttribute }]
|
|
3954
|
+
}], disabled: [{
|
|
3955
|
+
type: Input,
|
|
3956
|
+
args: [{ transform: booleanAttribute }]
|
|
3957
|
+
}], required: [{
|
|
3958
|
+
type: Input,
|
|
3959
|
+
args: [{ transform: booleanAttribute }]
|
|
3960
|
+
}], value: [{
|
|
3961
|
+
type: Input
|
|
3962
|
+
}] } });
|
|
3793
3963
|
|
|
3794
3964
|
/** ************************
|
|
3795
3965
|
* Copyright Monkey Exchange. All Rights Reserved
|
|
3796
3966
|
* This style guide was developed by Monkey Exchange Team
|
|
3797
3967
|
* MIT Licence
|
|
3798
3968
|
************************* */
|
|
3799
|
-
class MonkeyModalConfig {
|
|
3800
|
-
constructor() {
|
|
3801
|
-
this.panelClass = '';
|
|
3802
|
-
this.hasBackdrop = true;
|
|
3803
|
-
this.backdropClass = 'mecx-modal-overlay';
|
|
3804
|
-
this.disableClose = false;
|
|
3805
|
-
this.disableBackdropClose = false;
|
|
3806
|
-
this.fullscreen = false;
|
|
3807
|
-
this.position = 'center-center';
|
|
3808
|
-
this.data = null;
|
|
3809
|
-
this.closeOnNavigation = true;
|
|
3810
|
-
}
|
|
3811
|
-
}
|
|
3812
3969
|
|
|
3813
3970
|
/** ************************
|
|
3814
3971
|
* Copyright Monkey Exchange. All Rights Reserved
|
|
3815
3972
|
* This style guide was developed by Monkey Exchange Team
|
|
3816
3973
|
* MIT Licence
|
|
3817
3974
|
************************* */
|
|
3818
|
-
class
|
|
3819
|
-
|
|
3820
|
-
this.
|
|
3821
|
-
|
|
3822
|
-
this.closed = new Subject();
|
|
3823
|
-
this.id = config.id;
|
|
3824
|
-
this.icon = config.icon;
|
|
3825
|
-
this.disableClose = config.disableClose;
|
|
3826
|
-
this.disableBackdropClose = config.disableBackdropClose;
|
|
3827
|
-
this.closeOnNavigation = config.closeOnNavigation;
|
|
3828
|
-
this.backdropClick = overlayRef.backdropClick();
|
|
3829
|
-
this.keydownEvents = overlayRef.keydownEvents();
|
|
3830
|
-
this.outsidePointerEvents = overlayRef.outsidePointerEvents();
|
|
3831
|
-
if (!this.disableBackdropClose) {
|
|
3832
|
-
this.keydownEvents.subscribe((event) => {
|
|
3833
|
-
if (event.key === 'Escape' && !this.disableClose && !hasModifierKey(event)) {
|
|
3834
|
-
event.preventDefault();
|
|
3835
|
-
this.close(undefined);
|
|
3836
|
-
}
|
|
3837
|
-
});
|
|
3838
|
-
this.backdropClick.subscribe(() => {
|
|
3839
|
-
if (!this.disableClose) {
|
|
3840
|
-
this.close(undefined);
|
|
3841
|
-
}
|
|
3842
|
-
});
|
|
3975
|
+
class MonkeyInputPhoneComponent {
|
|
3976
|
+
get disabled() {
|
|
3977
|
+
if (this.ngControl && this.ngControl.disabled !== null) {
|
|
3978
|
+
return this.ngControl.disabled;
|
|
3843
3979
|
}
|
|
3980
|
+
return this._disabled;
|
|
3844
3981
|
}
|
|
3845
|
-
|
|
3846
|
-
|
|
3847
|
-
|
|
3848
|
-
|
|
3849
|
-
|
|
3850
|
-
active.blur();
|
|
3851
|
-
}
|
|
3852
|
-
this.componentElement.querySelectorAll('monkey-modal')[0].classList.add('fade-out');
|
|
3853
|
-
setTimeout(() => {
|
|
3854
|
-
this.overlayRef.detach();
|
|
3855
|
-
}, 150);
|
|
3856
|
-
closedSubject.next(result);
|
|
3857
|
-
closedSubject.complete();
|
|
3858
|
-
// eslint-disable-next-line no-multi-assign
|
|
3859
|
-
this.componentInstance = null;
|
|
3982
|
+
set disabled(value) {
|
|
3983
|
+
this._disabled = value;
|
|
3984
|
+
if (this.focused) {
|
|
3985
|
+
this.focused = false;
|
|
3986
|
+
this.stateChanges.next();
|
|
3860
3987
|
}
|
|
3861
3988
|
}
|
|
3862
|
-
|
|
3863
|
-
return this.
|
|
3864
|
-
}
|
|
3865
|
-
}
|
|
3866
|
-
|
|
3867
|
-
class MonkeyModalComponent {
|
|
3868
|
-
constructor(_elementRef, overlayRef, modalRef) {
|
|
3869
|
-
this._elementRef = _elementRef;
|
|
3870
|
-
this.overlayRef = overlayRef;
|
|
3871
|
-
this.modalRef = modalRef;
|
|
3872
|
-
this._navigationSubscription = null;
|
|
3873
|
-
this._router = inject(Router);
|
|
3874
|
-
// not to do
|
|
3989
|
+
get required() {
|
|
3990
|
+
return this._required ?? this.ngControl?.control?.hasValidator(Validators.required) ?? false;
|
|
3875
3991
|
}
|
|
3876
|
-
|
|
3877
|
-
|
|
3878
|
-
|
|
3879
|
-
}
|
|
3880
|
-
if (this.modalRef?.closeOnNavigation) {
|
|
3881
|
-
this._navigationSubscription = this._router.events.subscribe((event) => {
|
|
3882
|
-
if (event instanceof NavigationStart) {
|
|
3883
|
-
this.close();
|
|
3884
|
-
}
|
|
3885
|
-
});
|
|
3886
|
-
}
|
|
3992
|
+
set required(value) {
|
|
3993
|
+
this._required = value;
|
|
3994
|
+
this.stateChanges.next();
|
|
3887
3995
|
}
|
|
3888
|
-
|
|
3889
|
-
if (this.
|
|
3890
|
-
this.
|
|
3891
|
-
this.
|
|
3996
|
+
set value(value) {
|
|
3997
|
+
if (this._value !== value && value !== undefined) {
|
|
3998
|
+
this._value = value;
|
|
3999
|
+
this.formatValue(value);
|
|
4000
|
+
this._onChange(value);
|
|
4001
|
+
this._onTouched(value);
|
|
3892
4002
|
}
|
|
3893
4003
|
}
|
|
3894
|
-
|
|
3895
|
-
|
|
3896
|
-
element.classList.add('fade-out');
|
|
3897
|
-
setTimeout(() => {
|
|
3898
|
-
this.modalRef?.close();
|
|
3899
|
-
}, 150);
|
|
4004
|
+
get value() {
|
|
4005
|
+
return this._value;
|
|
3900
4006
|
}
|
|
3901
|
-
|
|
3902
|
-
|
|
3903
|
-
|
|
3904
|
-
|
|
3905
|
-
|
|
3906
|
-
|
|
3907
|
-
|
|
3908
|
-
|
|
3909
|
-
|
|
3910
|
-
|
|
3911
|
-
|
|
3912
|
-
|
|
3913
|
-
|
|
3914
|
-
|
|
3915
|
-
|
|
3916
|
-
|
|
3917
|
-
|
|
3918
|
-
|
|
3919
|
-
|
|
3920
|
-
|
|
3921
|
-
|
|
3922
|
-
|
|
3923
|
-
|
|
3924
|
-
|
|
3925
|
-
|
|
3926
|
-
|
|
3927
|
-
|
|
3928
|
-
|
|
3929
|
-
|
|
3930
|
-
|
|
3931
|
-
|
|
3932
|
-
|
|
3933
|
-
|
|
3934
|
-
}
|
|
3935
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: MonkeyModalComponent, decorators: [{
|
|
3936
|
-
type: Component,
|
|
3937
|
-
args: [{ encapsulation: ViewEncapsulation.None, selector: 'monkey-modal', template: `
|
|
3938
|
-
<div class="mecx-modal-header">
|
|
3939
|
-
<div class="mecx-modal-header-group">
|
|
3940
|
-
<div class="mecx-modal-header-title">
|
|
3941
|
-
@if (modalRef?.icon) {
|
|
3942
|
-
<div class="mecx-modal-header-icon">
|
|
3943
|
-
<monkey-icon [icon]="modalRef?.icon + ''" first></monkey-icon>
|
|
3944
|
-
</div>
|
|
3945
|
-
}
|
|
3946
|
-
<ng-content select="monkey-modal-title"></ng-content>
|
|
3947
|
-
<ng-content select="[monkey-modal-title]"></ng-content>
|
|
3948
|
-
</div>
|
|
3949
|
-
|
|
3950
|
-
<ng-content select="monkey-modal-subtitle"></ng-content>
|
|
3951
|
-
<ng-content select="[monkey-modal-subtitle]"></ng-content>
|
|
3952
|
-
</div>
|
|
3953
|
-
@if (!modalRef?.disableClose) {
|
|
3954
|
-
<monkey-icon-button
|
|
3955
|
-
size="sm"
|
|
3956
|
-
type="tertiary"
|
|
3957
|
-
icon="close"
|
|
3958
|
-
class="mecx-modal-close"
|
|
3959
|
-
(click)="close()"
|
|
3960
|
-
>
|
|
3961
|
-
</monkey-icon-button>
|
|
3962
|
-
}
|
|
3963
|
-
</div>
|
|
3964
|
-
<ng-content select="monkey-modal-content"></ng-content>
|
|
3965
|
-
<ng-content select="[monkey-modal-content]"></ng-content>
|
|
3966
|
-
<ng-content select="monkey-modal-actions"></ng-content>
|
|
3967
|
-
<ng-content select="[monkey-modal-actions]"></ng-content>
|
|
3968
|
-
`, host: {
|
|
3969
|
-
class: 'mecx-modal',
|
|
3970
|
-
tabindex: '-1',
|
|
3971
|
-
'[attr.id]': 'modalRef?.id || null'
|
|
3972
|
-
}, styles: ["monkey-modal{width:100%;height:100%;display:flex;flex-direction:column;background:#fff;border-radius:8px}.mecx-modal{opacity:0;animation:modalFadeIn .2s ease-out forwards;transition:opacity .15s ease-in}.mecx-modal.fade-out{animation:modalFadeOut .15s ease-in forwards}@keyframes modalFadeIn{0%{opacity:0;transform:scale(.8)}to{opacity:1;transform:scale(1)}}@keyframes modalFadeOut{0%{opacity:1;transform:scale(1)}to{opacity:0;transform:scale(.8)}}.mecx-modal-header{display:flex;gap:12px;align-items:flex-start;justify-content:space-between;border-bottom:1px solid var(--mecx-color-gray-200);padding:12px;position:relative}.mecx-modal-header-group{display:flex;flex-direction:column;align-items:flex-start;justify-content:flex-start;gap:4px}.mecx-modal-header-title{display:flex;gap:8px;align-items:center;justify-content:flex-start}.mecx-modal-header-icon{padding:8px;display:flex;align-items:center;justify-content:center;background:var(--mecx-color-gray-100);border-radius:8px;font-size:24px;color:var(--mecx-color-gray-900)}.mecx-modal-title{font-size:18px;font-style:normal;font-weight:400;line-height:24px;letter-spacing:.54px;color:var(--mecx-color-gray-900)}.mecx-modal-subtitle{font-size:14px;font-style:normal;font-weight:400;line-height:24px;letter-spacing:.42px;color:var(--mecx-color-gray-700)}.mecx-modal-content{display:block;flex-grow:1;box-sizing:border-box;overflow:auto;max-height:65vh;padding:12px;scrollbar-color:var(--mecx-color-gray-400) transparent}.mecx-modal-actions{display:flex;flex-wrap:wrap;gap:8px;border-top:1px solid var(--mecx-color-gray-200);padding:12px}.mecx-modal-actions.align-start{justify-content:flex-start}.mecx-modal-actions.align-center{justify-content:center}.mecx-modal-actions.align-end{justify-content:flex-end}.mecx-modal-overlay{background:#00000052}.monkey-modal-panel{padding:16px}.monkey-modal-panel.monkey-modal-fullscreen{width:100%!important;max-width:100%!important;height:100%!important;max-height:100%!important;padding:0}.monkey-modal-panel.monkey-modal-fullscreen monkey-modal{border-radius:0}.monkey-modal-panel.monkey-modal-fullscreen monkey-modal .mecx-modal-content{max-height:100%}\n"] }]
|
|
3973
|
-
}], ctorParameters: () => [{ type: i0.ElementRef }, { type: i1$1.OverlayRef, decorators: [{
|
|
3974
|
-
type: Optional
|
|
3975
|
-
}] }, { type: MonkeyModalRef, decorators: [{
|
|
3976
|
-
type: Optional
|
|
3977
|
-
}] }] });
|
|
3978
|
-
|
|
3979
|
-
/** ************************
|
|
3980
|
-
* Copyright Monkey Exchange. All Rights Reserved
|
|
3981
|
-
* This style guide was developed by Monkey Exchange Team
|
|
3982
|
-
* MIT Licence
|
|
3983
|
-
************************* */
|
|
3984
|
-
const MECX_MODAL_DATA = new InjectionToken('mecxModalData');
|
|
3985
|
-
const MECX_MODAL_DEFAULT_CONFIG = new InjectionToken('mecxModalDefaultConfig');
|
|
3986
|
-
const MECX_MODAL_CONFIRMATION_CONFIG = new InjectionToken('mecxModalConfirmationConfig');
|
|
3987
|
-
/**
|
|
3988
|
-
* @license
|
|
3989
|
-
* Copyright Google LLC All Rights Reserved.
|
|
3990
|
-
*
|
|
3991
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
3992
|
-
* found in the LICENSE file at https://angular.dev/license
|
|
3993
|
-
*/
|
|
3994
|
-
function reverseForEach(items, callback) {
|
|
3995
|
-
let i = items.length;
|
|
3996
|
-
// eslint-disable-next-line no-plusplus
|
|
3997
|
-
while (i--) {
|
|
3998
|
-
callback(items[i]);
|
|
4007
|
+
constructor() {
|
|
4008
|
+
this.placeholder = '';
|
|
4009
|
+
this.tabIndex = 0;
|
|
4010
|
+
this._disabled = false;
|
|
4011
|
+
this._value = null;
|
|
4012
|
+
this.ngControl = inject(NgControl, { self: true, optional: true });
|
|
4013
|
+
this.idGenerator = inject(IdGenerator);
|
|
4014
|
+
this.countryCode = inject(MONKEY_COUNTRY_CODE);
|
|
4015
|
+
this.locale = inject(LOCALE_ID);
|
|
4016
|
+
this.id = this.idGenerator.getId('monkey-input-upload-');
|
|
4017
|
+
this.inputId = this.idGenerator.getId('monkey-input-upload-input-');
|
|
4018
|
+
this.focused = false;
|
|
4019
|
+
this.type = 'input-phone';
|
|
4020
|
+
this.stateChanges = new Subject();
|
|
4021
|
+
this.countries = getCountries()
|
|
4022
|
+
.map((code) => {
|
|
4023
|
+
return {
|
|
4024
|
+
code: `+${getCountryCallingCode(code)}`,
|
|
4025
|
+
name: this.getCountryNameFromCode(code),
|
|
4026
|
+
flag: `${this.isoToFlagEmoji(code)} `
|
|
4027
|
+
};
|
|
4028
|
+
})
|
|
4029
|
+
.sort((a, b) => {
|
|
4030
|
+
return a.name.localeCompare(b.name);
|
|
4031
|
+
});
|
|
4032
|
+
this.countriesFiltered = this.countries;
|
|
4033
|
+
this.selectedCallingCode = this.countryCode.toString();
|
|
4034
|
+
this.phoneFormatted = '';
|
|
4035
|
+
this.phoneValid = false;
|
|
4036
|
+
this._onChange = () => { };
|
|
4037
|
+
this._onTouched = () => { };
|
|
4038
|
+
if (this.ngControl) {
|
|
4039
|
+
this.ngControl.valueAccessor = this;
|
|
4040
|
+
}
|
|
3999
4041
|
}
|
|
4000
|
-
|
|
4001
|
-
|
|
4002
|
-
|
|
4003
|
-
|
|
4004
|
-
|
|
4005
|
-
|
|
4006
|
-
|
|
4007
|
-
|
|
4008
|
-
|
|
4009
|
-
this.config = config;
|
|
4010
|
-
this.modalRef = modalRef;
|
|
4011
|
-
// not to do
|
|
4042
|
+
getCountryNameFromCode(code) {
|
|
4043
|
+
try {
|
|
4044
|
+
const locale = this.locale.toString();
|
|
4045
|
+
const display = new Intl.DisplayNames([locale], { type: 'region' });
|
|
4046
|
+
return display.of(code.toUpperCase()) || code;
|
|
4047
|
+
}
|
|
4048
|
+
catch {
|
|
4049
|
+
return code;
|
|
4050
|
+
}
|
|
4012
4051
|
}
|
|
4013
|
-
|
|
4014
|
-
|
|
4052
|
+
getCountryByCallingCode(code) {
|
|
4053
|
+
const cleanCode = code.replace('+', '');
|
|
4054
|
+
return (getCountries().find((country) => {
|
|
4055
|
+
return getCountryCallingCode(country) === cleanCode;
|
|
4056
|
+
}) || null);
|
|
4015
4057
|
}
|
|
4016
|
-
|
|
4017
|
-
|
|
4058
|
+
isoToFlagEmoji(isoCode) {
|
|
4059
|
+
return isoCode.toUpperCase().replace(/./g, (char) => {
|
|
4060
|
+
return String.fromCodePoint(127397 + char.charCodeAt(0));
|
|
4061
|
+
});
|
|
4018
4062
|
}
|
|
4019
|
-
|
|
4020
|
-
|
|
4021
|
-
|
|
4022
|
-
|
|
4023
|
-
|
|
4024
|
-
|
|
4025
|
-
|
|
4026
|
-
|
|
4027
|
-
|
|
4028
|
-
|
|
4029
|
-
|
|
4030
|
-
|
|
4031
|
-
|
|
4032
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: MonkeyModalDefaultComponent, decorators: [{
|
|
4033
|
-
type: Component,
|
|
4034
|
-
args: [{
|
|
4035
|
-
selector: 'monkey-modal-default',
|
|
4036
|
-
template: `
|
|
4037
|
-
<monkey-modal>
|
|
4038
|
-
<monkey-modal-title [innerHTML]="config.title"></monkey-modal-title>
|
|
4039
|
-
<monkey-modal-subtitle [innerHTML]="config.subtitle"></monkey-modal-subtitle>
|
|
4040
|
-
<monkey-modal-content [innerHTML]="config.content"></monkey-modal-content>
|
|
4041
|
-
<monkey-modal-actions mkAlign="end">
|
|
4042
|
-
<monkey-button type="tertiary" (click)="onClose()">{{ config.cancelLabel }}</monkey-button>
|
|
4043
|
-
<monkey-button type="primary" (click)="onSubmit()">{{ config.okLabel }}</monkey-button>
|
|
4044
|
-
</monkey-modal-actions>
|
|
4045
|
-
</monkey-modal>
|
|
4046
|
-
`
|
|
4047
|
-
}]
|
|
4048
|
-
}], ctorParameters: () => [{ type: undefined, decorators: [{
|
|
4049
|
-
type: Inject,
|
|
4050
|
-
args: [MECX_MODAL_DEFAULT_CONFIG]
|
|
4051
|
-
}] }, { type: MonkeyModalRef, decorators: [{
|
|
4052
|
-
type: Inject,
|
|
4053
|
-
args: [MonkeyModalRef]
|
|
4054
|
-
}] }] });
|
|
4055
|
-
|
|
4056
|
-
class MonkeyModalConfirmationComponent {
|
|
4057
|
-
constructor(config, modalRef) {
|
|
4058
|
-
this.config = config;
|
|
4059
|
-
this.modalRef = modalRef;
|
|
4060
|
-
// not to do
|
|
4063
|
+
getCountryFromPhoneNumber(input, changedCountry) {
|
|
4064
|
+
try {
|
|
4065
|
+
if (changedCountry) {
|
|
4066
|
+
return this.selectedCallingCode;
|
|
4067
|
+
}
|
|
4068
|
+
const parsed = parsePhoneNumberFromString(input);
|
|
4069
|
+
const country = getCountryCallingCode(parsed?.country);
|
|
4070
|
+
return `+${country}`;
|
|
4071
|
+
}
|
|
4072
|
+
catch (e) {
|
|
4073
|
+
// not to do
|
|
4074
|
+
}
|
|
4075
|
+
return this.selectedCallingCode;
|
|
4061
4076
|
}
|
|
4062
|
-
|
|
4063
|
-
this.
|
|
4077
|
+
performValue(value) {
|
|
4078
|
+
this._value = `${this.selectedCallingCode}${value}`;
|
|
4079
|
+
this._onChange(this._value);
|
|
4080
|
+
this._onTouched(this._value);
|
|
4064
4081
|
}
|
|
4065
|
-
|
|
4066
|
-
this
|
|
4082
|
+
validateValue() {
|
|
4083
|
+
const { phoneValid } = this;
|
|
4084
|
+
if (!phoneValid) {
|
|
4085
|
+
const countryCode = this.getCountryByCallingCode(this.selectedCallingCode);
|
|
4086
|
+
const example = getExampleNumber(countryCode, examples);
|
|
4087
|
+
this.ngControl?.control?.setErrors({
|
|
4088
|
+
phone: true,
|
|
4089
|
+
phoneAllowed: example?.nationalNumber
|
|
4090
|
+
});
|
|
4091
|
+
}
|
|
4067
4092
|
}
|
|
4068
|
-
|
|
4069
|
-
|
|
4070
|
-
|
|
4071
|
-
|
|
4072
|
-
|
|
4073
|
-
|
|
4074
|
-
<monkey-icon [icon]="config.icon" size="xxl"></monkey-icon>
|
|
4075
|
-
</div>
|
|
4093
|
+
formatValue(value, changedCountry = false) {
|
|
4094
|
+
if (!value) {
|
|
4095
|
+
this.phoneFormatted = '';
|
|
4096
|
+
this.phoneValid = false;
|
|
4097
|
+
this.validateValue();
|
|
4098
|
+
return;
|
|
4076
4099
|
}
|
|
4077
|
-
|
|
4078
|
-
|
|
4079
|
-
|
|
4080
|
-
|
|
4081
|
-
|
|
4082
|
-
|
|
4083
|
-
|
|
4084
|
-
|
|
4085
|
-
|
|
4100
|
+
const detectedCallingCode = this.getCountryFromPhoneNumber(value, changedCountry);
|
|
4101
|
+
const isCountryChanged = changedCountry || detectedCallingCode !== this.selectedCallingCode;
|
|
4102
|
+
if (isCountryChanged && detectedCallingCode) {
|
|
4103
|
+
this.selectedCallingCode = detectedCallingCode;
|
|
4104
|
+
}
|
|
4105
|
+
const countryCode = this.getCountryByCallingCode(this.selectedCallingCode);
|
|
4106
|
+
if (!countryCode) {
|
|
4107
|
+
this.phoneFormatted = value;
|
|
4108
|
+
this.phoneValid = false;
|
|
4109
|
+
this.validateValue();
|
|
4110
|
+
return;
|
|
4111
|
+
}
|
|
4112
|
+
const nationalPart = value.replace(this.selectedCallingCode, '').replace(/[^\d+]/g, '');
|
|
4113
|
+
const formatter = new AsYouType(countryCode);
|
|
4114
|
+
this.phoneFormatted = formatter.input(nationalPart);
|
|
4115
|
+
this.performValue(nationalPart);
|
|
4116
|
+
this.phoneValid = isValidPhoneNumber(nationalPart, countryCode);
|
|
4117
|
+
this.validateValue();
|
|
4118
|
+
}
|
|
4119
|
+
ngAfterContentInit() { }
|
|
4120
|
+
ngOnChanges(changes) { }
|
|
4121
|
+
ngOnDestroy() { }
|
|
4122
|
+
onContainerClick(event) {
|
|
4123
|
+
this.inputs.first.nativeElement.focus();
|
|
4124
|
+
}
|
|
4125
|
+
_onFocus() {
|
|
4126
|
+
if (!this.disabled) {
|
|
4127
|
+
this.focused = true;
|
|
4128
|
+
this._onTouched();
|
|
4129
|
+
this.stateChanges.next();
|
|
4130
|
+
}
|
|
4131
|
+
}
|
|
4132
|
+
_onBlur() {
|
|
4133
|
+
this.focused = false;
|
|
4134
|
+
this.stateChanges.next();
|
|
4135
|
+
this.validateValue();
|
|
4136
|
+
}
|
|
4137
|
+
registerOnChange(fn) {
|
|
4138
|
+
this._onChange = fn;
|
|
4139
|
+
}
|
|
4140
|
+
registerOnTouched(fn) {
|
|
4141
|
+
this._onTouched = fn;
|
|
4142
|
+
}
|
|
4143
|
+
setDisabledState(isDisabled) {
|
|
4144
|
+
this.disabled = isDisabled;
|
|
4145
|
+
}
|
|
4146
|
+
writeValue(value) {
|
|
4147
|
+
this.value = value;
|
|
4148
|
+
}
|
|
4149
|
+
onInputChange(event) {
|
|
4150
|
+
const { value } = event.target;
|
|
4151
|
+
this.formatValue(value);
|
|
4152
|
+
}
|
|
4153
|
+
onCountryChange() {
|
|
4154
|
+
this.formatValue(this._value, true);
|
|
4155
|
+
this.validateValue();
|
|
4156
|
+
}
|
|
4157
|
+
getMaxLength() {
|
|
4158
|
+
try {
|
|
4159
|
+
const countryCode = this.getCountryByCallingCode(this.selectedCallingCode);
|
|
4160
|
+
if (!countryCode)
|
|
4161
|
+
return 20;
|
|
4162
|
+
const example = getExampleNumber(countryCode, examples);
|
|
4163
|
+
const formatted = new AsYouType(countryCode).input(example.nationalNumber);
|
|
4164
|
+
return formatted.length;
|
|
4165
|
+
}
|
|
4166
|
+
catch {
|
|
4167
|
+
return 20;
|
|
4168
|
+
}
|
|
4169
|
+
}
|
|
4170
|
+
onHandleSearchSelect(query) {
|
|
4171
|
+
const normalizedQuery = query.trim().toLowerCase();
|
|
4172
|
+
this.countriesFiltered = this.countries.filter(({ name }) => {
|
|
4173
|
+
return name.toLowerCase().includes(normalizedQuery);
|
|
4174
|
+
});
|
|
4175
|
+
}
|
|
4176
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: MonkeyInputPhoneComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
4177
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.13", type: MonkeyInputPhoneComponent, isStandalone: true, selector: "monkey-input-phone", inputs: { placeholder: "placeholder", tabIndex: "tabIndex", disabled: ["disabled", "disabled", booleanAttribute], required: ["required", "required", booleanAttribute], value: "value" }, host: { listeners: { "focus": "_onFocus()", "blur": "_onBlur()" }, properties: { "attr.data-testid": "'monkey-input-phone'", "class.mecx-input-phone-disabled": "_disabled", "class.mecx-input-phone-focused": "focused", "attr.id": "id", "attr.tabindex": "disabled ? -1 : tabIndex" }, classAttribute: "mecx-input-phone" }, providers: [
|
|
4178
|
+
// eslint-disable-next-line no-use-before-define
|
|
4179
|
+
{ provide: MonkeyFormFieldControl, useExisting: MonkeyInputPhoneComponent }
|
|
4180
|
+
], viewQueries: [{ propertyName: "inputs", predicate: ["input"], descendants: true }], usesOnChanges: true, ngImport: i0, template: `
|
|
4181
|
+
<monkey-select
|
|
4182
|
+
placeholder=""
|
|
4183
|
+
[disabled]="disabled"
|
|
4184
|
+
showSearch
|
|
4185
|
+
[(ngModel)]="selectedCallingCode"
|
|
4186
|
+
class="mecx-phone-select-country"
|
|
4187
|
+
(onChange)="onCountryChange()"
|
|
4188
|
+
callbackSearch
|
|
4189
|
+
(onSearch)="onHandleSearchSelect($event)"
|
|
4190
|
+
>
|
|
4191
|
+
@for (item of countriesFiltered; track $index) {
|
|
4192
|
+
<monkey-option [value]="item.code">
|
|
4193
|
+
<span class="option-flag">{{ item.flag }}</span>
|
|
4194
|
+
<div class="option-name">{{ item.name }} {{ item.code }}</div>
|
|
4195
|
+
</monkey-option>
|
|
4196
|
+
}
|
|
4197
|
+
</monkey-select>
|
|
4198
|
+
<input
|
|
4199
|
+
#input
|
|
4200
|
+
class="mecx-input"
|
|
4201
|
+
[attr.disabled]="disabled"
|
|
4202
|
+
placeholder="Enter phone number"
|
|
4203
|
+
(input)="onInputChange($event)"
|
|
4204
|
+
[ngModel]="phoneFormatted"
|
|
4205
|
+
[maxlength]="getMaxLength()"
|
|
4206
|
+
(focus)="_onFocus()"
|
|
4207
|
+
(blur)="_onBlur()"
|
|
4208
|
+
[attr.id]="inputId"
|
|
4209
|
+
/>
|
|
4210
|
+
`, isInline: true, styles: [":host{display:inline-flex;width:100%;min-width:0}:host.mecx-input-phone-disabled monkey-select{border-right:2px solid var(--mecx-color-gray-200)}:host monkey-select{width:164px;border-right:2px solid var(--mecx-color-gray-400)}:host input{width:100%;border:none;margin-left:8px}monkey-option .option-flag{font-size:30px}monkey-option .option-name{letter-spacing:.48px;margin-left:4px}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.MaxLengthValidator, selector: "[maxlength][formControlName],[maxlength][formControl],[maxlength][ngModel]", inputs: ["maxlength"] }, { kind: "directive", type: i2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "component", type: MonkeySelectComponent, selector: "monkey-select", inputs: ["tabIndex", "placeholder", "loading", "showSearch", "searchPlaceholder", "callbackSearch", "disabled", "required", "value"], outputs: ["onChange", "onSearch"] }, { kind: "component", type: MonkeyOptionComponent, selector: "monkey-option", inputs: ["value", "disabled", "type"] }, { kind: "ngmodule", type: MonkeyFormFieldModule }] }); }
|
|
4086
4211
|
}
|
|
4087
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type:
|
|
4212
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: MonkeyInputPhoneComponent, decorators: [{
|
|
4088
4213
|
type: Component,
|
|
4089
|
-
args: [{ selector: 'monkey-
|
|
4090
|
-
|
|
4091
|
-
|
|
4092
|
-
|
|
4093
|
-
|
|
4094
|
-
|
|
4095
|
-
|
|
4096
|
-
|
|
4097
|
-
|
|
4098
|
-
|
|
4099
|
-
|
|
4100
|
-
|
|
4101
|
-
|
|
4102
|
-
|
|
4103
|
-
|
|
4104
|
-
|
|
4105
|
-
|
|
4106
|
-
|
|
4107
|
-
|
|
4108
|
-
|
|
4109
|
-
|
|
4110
|
-
|
|
4111
|
-
|
|
4112
|
-
|
|
4214
|
+
args: [{ selector: 'monkey-input-phone', standalone: true, imports: [
|
|
4215
|
+
CommonModule,
|
|
4216
|
+
FormsModule,
|
|
4217
|
+
ReactiveFormsModule,
|
|
4218
|
+
MonkeySelectComponent,
|
|
4219
|
+
MonkeyOptionComponent,
|
|
4220
|
+
MonkeyFormFieldModule
|
|
4221
|
+
], template: `
|
|
4222
|
+
<monkey-select
|
|
4223
|
+
placeholder=""
|
|
4224
|
+
[disabled]="disabled"
|
|
4225
|
+
showSearch
|
|
4226
|
+
[(ngModel)]="selectedCallingCode"
|
|
4227
|
+
class="mecx-phone-select-country"
|
|
4228
|
+
(onChange)="onCountryChange()"
|
|
4229
|
+
callbackSearch
|
|
4230
|
+
(onSearch)="onHandleSearchSelect($event)"
|
|
4231
|
+
>
|
|
4232
|
+
@for (item of countriesFiltered; track $index) {
|
|
4233
|
+
<monkey-option [value]="item.code">
|
|
4234
|
+
<span class="option-flag">{{ item.flag }}</span>
|
|
4235
|
+
<div class="option-name">{{ item.name }} {{ item.code }}</div>
|
|
4236
|
+
</monkey-option>
|
|
4237
|
+
}
|
|
4238
|
+
</monkey-select>
|
|
4239
|
+
<input
|
|
4240
|
+
#input
|
|
4241
|
+
class="mecx-input"
|
|
4242
|
+
[attr.disabled]="disabled"
|
|
4243
|
+
placeholder="Enter phone number"
|
|
4244
|
+
(input)="onInputChange($event)"
|
|
4245
|
+
[ngModel]="phoneFormatted"
|
|
4246
|
+
[maxlength]="getMaxLength()"
|
|
4247
|
+
(focus)="_onFocus()"
|
|
4248
|
+
(blur)="_onBlur()"
|
|
4249
|
+
[attr.id]="inputId"
|
|
4250
|
+
/>
|
|
4251
|
+
`, providers: [
|
|
4252
|
+
// eslint-disable-next-line no-use-before-define
|
|
4253
|
+
{ provide: MonkeyFormFieldControl, useExisting: MonkeyInputPhoneComponent }
|
|
4254
|
+
], host: {
|
|
4255
|
+
'[attr.data-testid]': "'monkey-input-phone'",
|
|
4256
|
+
class: 'mecx-input-phone',
|
|
4257
|
+
'[class.mecx-input-phone-disabled]': '_disabled',
|
|
4258
|
+
'[class.mecx-input-phone-focused]': 'focused',
|
|
4259
|
+
'[attr.id]': 'id',
|
|
4260
|
+
'[attr.tabindex]': 'disabled ? -1 : tabIndex',
|
|
4261
|
+
'(focus)': '_onFocus()',
|
|
4262
|
+
'(blur)': '_onBlur()'
|
|
4263
|
+
}, styles: [":host{display:inline-flex;width:100%;min-width:0}:host.mecx-input-phone-disabled monkey-select{border-right:2px solid var(--mecx-color-gray-200)}:host monkey-select{width:164px;border-right:2px solid var(--mecx-color-gray-400)}:host input{width:100%;border:none;margin-left:8px}monkey-option .option-flag{font-size:30px}monkey-option .option-name{letter-spacing:.48px;margin-left:4px}\n"] }]
|
|
4264
|
+
}], ctorParameters: () => [], propDecorators: { placeholder: [{
|
|
4265
|
+
type: Input
|
|
4266
|
+
}], tabIndex: [{
|
|
4267
|
+
type: Input
|
|
4268
|
+
}], disabled: [{
|
|
4269
|
+
type: Input,
|
|
4270
|
+
args: [{ transform: booleanAttribute }]
|
|
4271
|
+
}], required: [{
|
|
4272
|
+
type: Input,
|
|
4273
|
+
args: [{ transform: booleanAttribute }]
|
|
4274
|
+
}], value: [{
|
|
4275
|
+
type: Input
|
|
4276
|
+
}], inputs: [{
|
|
4277
|
+
type: ViewChildren,
|
|
4278
|
+
args: ['input']
|
|
4279
|
+
}] } });
|
|
4113
4280
|
|
|
4114
4281
|
/** ************************
|
|
4115
4282
|
* Copyright Monkey Exchange. All Rights Reserved
|
|
4116
4283
|
* This style guide was developed by Monkey Exchange Team
|
|
4117
4284
|
* MIT Licence
|
|
4118
4285
|
************************* */
|
|
4119
|
-
class MonkeyModalModule {
|
|
4120
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: MonkeyModalModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
4121
|
-
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.2.13", ngImport: i0, type: MonkeyModalModule, declarations: [MonkeyModalComponent,
|
|
4122
|
-
MonkeyModalDefaultComponent,
|
|
4123
|
-
MonkeyModalConfirmationComponent,
|
|
4124
|
-
MonkeyModalTitleDirective,
|
|
4125
|
-
MonkeyModalSubtitleDirective,
|
|
4126
|
-
MonkeyModalContentDirective,
|
|
4127
|
-
MonkeyModalActionsDirective], imports: [CommonModule, MonkeyButtonComponent, MonkeyIconButtonComponent, MonkeyIconComponent], exports: [MonkeyModalComponent,
|
|
4128
|
-
MonkeyModalTitleDirective,
|
|
4129
|
-
MonkeyModalSubtitleDirective,
|
|
4130
|
-
MonkeyModalContentDirective,
|
|
4131
|
-
MonkeyModalActionsDirective] }); }
|
|
4132
|
-
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: MonkeyModalModule, imports: [CommonModule, MonkeyButtonComponent, MonkeyIconButtonComponent, MonkeyIconComponent] }); }
|
|
4133
|
-
}
|
|
4134
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: MonkeyModalModule, decorators: [{
|
|
4135
|
-
type: NgModule,
|
|
4136
|
-
args: [{
|
|
4137
|
-
imports: [CommonModule, MonkeyButtonComponent, MonkeyIconButtonComponent, MonkeyIconComponent],
|
|
4138
|
-
declarations: [
|
|
4139
|
-
MonkeyModalComponent,
|
|
4140
|
-
MonkeyModalDefaultComponent,
|
|
4141
|
-
MonkeyModalConfirmationComponent,
|
|
4142
|
-
MonkeyModalTitleDirective,
|
|
4143
|
-
MonkeyModalSubtitleDirective,
|
|
4144
|
-
MonkeyModalContentDirective,
|
|
4145
|
-
MonkeyModalActionsDirective
|
|
4146
|
-
],
|
|
4147
|
-
exports: [
|
|
4148
|
-
MonkeyModalComponent,
|
|
4149
|
-
MonkeyModalTitleDirective,
|
|
4150
|
-
MonkeyModalSubtitleDirective,
|
|
4151
|
-
MonkeyModalContentDirective,
|
|
4152
|
-
MonkeyModalActionsDirective
|
|
4153
|
-
]
|
|
4154
|
-
}]
|
|
4155
|
-
}] });
|
|
4156
4286
|
|
|
4157
4287
|
/** ************************
|
|
4158
4288
|
* Copyright Monkey Exchange. All Rights Reserved
|
|
4159
4289
|
* This style guide was developed by Monkey Exchange Team
|
|
4160
4290
|
* MIT Licence
|
|
4161
4291
|
************************* */
|
|
4162
|
-
class
|
|
4163
|
-
|
|
4164
|
-
this.
|
|
4165
|
-
|
|
4166
|
-
this._overlay = inject(Overlay);
|
|
4167
|
-
this._openDialogsAtThisLevel = [];
|
|
4168
|
-
this._parentDialog = inject(MonkeyModalService, { optional: true, skipSelf: true });
|
|
4169
|
-
}
|
|
4170
|
-
get openDialogs() {
|
|
4171
|
-
return this._parentDialog ? this._parentDialog.openDialogs : this._openDialogsAtThisLevel;
|
|
4172
|
-
}
|
|
4173
|
-
getOverlayConfig(config) {
|
|
4174
|
-
let positionStrategy;
|
|
4175
|
-
const marginStrategy = '20px';
|
|
4176
|
-
if (config.position === 'left-top') {
|
|
4177
|
-
positionStrategy = this._overlay.position().global().left(marginStrategy).top(marginStrategy);
|
|
4178
|
-
}
|
|
4179
|
-
else if (config.position === 'center-top') {
|
|
4180
|
-
positionStrategy = this._overlay.position().global().centerHorizontally().top(marginStrategy);
|
|
4292
|
+
class MonkeyInputUploadComponent {
|
|
4293
|
+
get disabled() {
|
|
4294
|
+
if (this.ngControl && this.ngControl.disabled !== null) {
|
|
4295
|
+
return this.ngControl.disabled;
|
|
4181
4296
|
}
|
|
4182
|
-
|
|
4183
|
-
|
|
4184
|
-
|
|
4185
|
-
|
|
4186
|
-
|
|
4187
|
-
|
|
4297
|
+
return this._disabled;
|
|
4298
|
+
}
|
|
4299
|
+
set disabled(value) {
|
|
4300
|
+
this._disabled = value;
|
|
4301
|
+
if (this.focused) {
|
|
4302
|
+
this.focused = false;
|
|
4303
|
+
this.stateChanges.next();
|
|
4188
4304
|
}
|
|
4189
|
-
|
|
4190
|
-
|
|
4305
|
+
}
|
|
4306
|
+
get required() {
|
|
4307
|
+
return this._required ?? this.ngControl?.control?.hasValidator(Validators.required) ?? false;
|
|
4308
|
+
}
|
|
4309
|
+
set required(value) {
|
|
4310
|
+
this._required = value;
|
|
4311
|
+
this.stateChanges.next();
|
|
4312
|
+
}
|
|
4313
|
+
set value(value) {
|
|
4314
|
+
if (this._value !== value && value !== undefined) {
|
|
4315
|
+
this._value = value;
|
|
4316
|
+
this._onChange(value);
|
|
4317
|
+
this._onTouched(value);
|
|
4191
4318
|
}
|
|
4192
|
-
|
|
4193
|
-
|
|
4319
|
+
}
|
|
4320
|
+
get value() {
|
|
4321
|
+
return this._value;
|
|
4322
|
+
}
|
|
4323
|
+
constructor() {
|
|
4324
|
+
this.progress = 0;
|
|
4325
|
+
this.placeholder = '';
|
|
4326
|
+
this.maxSizeBytes = 5 * 1024 * 1024;
|
|
4327
|
+
this.allowedExtensions = ['.jpg', '.jpeg', '.png', '.pdf', '.txt', '.xls', '.xlsx'];
|
|
4328
|
+
this.loading = false;
|
|
4329
|
+
this.tabIndex = 0;
|
|
4330
|
+
this._disabled = false;
|
|
4331
|
+
this._value = null;
|
|
4332
|
+
this.onChange = new EventEmitter();
|
|
4333
|
+
this.ngControl = inject(NgControl, { self: true, optional: true });
|
|
4334
|
+
this.idGenerator = inject(IdGenerator);
|
|
4335
|
+
this.id = this.idGenerator.getId('monkey-input-upload-');
|
|
4336
|
+
this.focused = false;
|
|
4337
|
+
this.type = '';
|
|
4338
|
+
this.currency = false;
|
|
4339
|
+
this.percent = false;
|
|
4340
|
+
this.stateChanges = new Subject();
|
|
4341
|
+
this._onChange = () => { };
|
|
4342
|
+
this._onTouched = () => { };
|
|
4343
|
+
if (this.ngControl) {
|
|
4344
|
+
this.ngControl.valueAccessor = this;
|
|
4194
4345
|
}
|
|
4195
|
-
|
|
4196
|
-
|
|
4346
|
+
}
|
|
4347
|
+
validateFileSize(file) {
|
|
4348
|
+
return file.size <= this.maxSizeBytes;
|
|
4349
|
+
}
|
|
4350
|
+
validateFileExtension(file) {
|
|
4351
|
+
if (!this.allowedExtensions || !this.allowedExtensions.length) {
|
|
4352
|
+
return true;
|
|
4197
4353
|
}
|
|
4198
|
-
|
|
4199
|
-
|
|
4200
|
-
|
|
4201
|
-
|
|
4202
|
-
|
|
4203
|
-
|
|
4354
|
+
const fileExtension = getFileExtension(file.name);
|
|
4355
|
+
const allowedExts = this.allowedExtensions.map((ext) => {
|
|
4356
|
+
return ext.trim().replace('.', '').toLowerCase();
|
|
4357
|
+
});
|
|
4358
|
+
return allowedExts.includes(fileExtension);
|
|
4359
|
+
}
|
|
4360
|
+
onContainerClick(event) {
|
|
4361
|
+
if (!this.loading) {
|
|
4362
|
+
this.fileInput.nativeElement.click();
|
|
4204
4363
|
}
|
|
4205
|
-
|
|
4206
|
-
|
|
4364
|
+
}
|
|
4365
|
+
_onFocus() {
|
|
4366
|
+
if (!this.disabled) {
|
|
4367
|
+
this.focused = true;
|
|
4368
|
+
this._onTouched();
|
|
4369
|
+
this.stateChanges.next();
|
|
4207
4370
|
}
|
|
4208
|
-
|
|
4209
|
-
|
|
4210
|
-
|
|
4211
|
-
|
|
4212
|
-
|
|
4213
|
-
|
|
4371
|
+
}
|
|
4372
|
+
_onBlur() {
|
|
4373
|
+
this.focused = false;
|
|
4374
|
+
this.stateChanges.next();
|
|
4375
|
+
}
|
|
4376
|
+
ngAfterContentInit() { }
|
|
4377
|
+
ngOnChanges(changes) { }
|
|
4378
|
+
ngOnDestroy() { }
|
|
4379
|
+
registerOnChange(fn) {
|
|
4380
|
+
this._onChange = fn;
|
|
4381
|
+
}
|
|
4382
|
+
registerOnTouched(fn) {
|
|
4383
|
+
this._onTouched = fn;
|
|
4384
|
+
}
|
|
4385
|
+
setDisabledState(isDisabled) {
|
|
4386
|
+
this.disabled = isDisabled;
|
|
4387
|
+
if (this.fileInput) {
|
|
4388
|
+
this.fileInput.nativeElement.disabled = isDisabled;
|
|
4214
4389
|
}
|
|
4215
|
-
|
|
4216
|
-
|
|
4217
|
-
|
|
4390
|
+
}
|
|
4391
|
+
writeValue(value) {
|
|
4392
|
+
this.value = value;
|
|
4393
|
+
}
|
|
4394
|
+
reset() {
|
|
4395
|
+
if (this.fileInput) {
|
|
4396
|
+
this.fileInput.nativeElement.value = '';
|
|
4218
4397
|
}
|
|
4219
|
-
|
|
4220
|
-
|
|
4398
|
+
}
|
|
4399
|
+
onFileSelected(event) {
|
|
4400
|
+
const input = event.target;
|
|
4401
|
+
this._onTouched();
|
|
4402
|
+
if (!input.files?.length) {
|
|
4403
|
+
return;
|
|
4221
4404
|
}
|
|
4222
|
-
|
|
4223
|
-
|
|
4405
|
+
const file = input.files.item(0);
|
|
4406
|
+
if (this.fileInput) {
|
|
4407
|
+
this.fileInput.nativeElement.value = '';
|
|
4224
4408
|
}
|
|
4225
|
-
|
|
4226
|
-
|
|
4227
|
-
|
|
4228
|
-
|
|
4229
|
-
|
|
4230
|
-
|
|
4231
|
-
|
|
4232
|
-
|
|
4233
|
-
});
|
|
4234
|
-
if (config.backdropClass) {
|
|
4235
|
-
state.backdropClass = config.backdropClass;
|
|
4409
|
+
if (!this.validateFileSize(file)) {
|
|
4410
|
+
this.ngControl?.control?.setErrors({
|
|
4411
|
+
maxFileSize: true,
|
|
4412
|
+
sizeAllowed: formatFileSize(this.maxSizeBytes)
|
|
4413
|
+
});
|
|
4414
|
+
this._onBlur();
|
|
4415
|
+
this.reset();
|
|
4416
|
+
return;
|
|
4236
4417
|
}
|
|
4237
|
-
if (
|
|
4238
|
-
|
|
4418
|
+
if (!this.validateFileExtension(file)) {
|
|
4419
|
+
this.ngControl?.control?.setErrors({
|
|
4420
|
+
fileExtension: true,
|
|
4421
|
+
extensionAllowed: this.allowedExtensions.join(', ')
|
|
4422
|
+
});
|
|
4423
|
+
this._onBlur();
|
|
4424
|
+
this.reset();
|
|
4425
|
+
return;
|
|
4239
4426
|
}
|
|
4240
|
-
|
|
4241
|
-
|
|
4427
|
+
this._onBlur();
|
|
4428
|
+
if (this.onChange.observed) {
|
|
4429
|
+
this.onChange.emit({ component: this, file: file });
|
|
4242
4430
|
}
|
|
4243
|
-
|
|
4244
|
-
|
|
4245
|
-
|
|
4246
|
-
|
|
4247
|
-
|
|
4248
|
-
{ provide: MonkeyModalRef, useValue: dialogRef },
|
|
4249
|
-
{ provide: MECX_MODAL_DATA, useValue: config.data }
|
|
4250
|
-
];
|
|
4251
|
-
if (config.providers) {
|
|
4252
|
-
providers.push(...config.providers);
|
|
4431
|
+
else {
|
|
4432
|
+
this.value = {
|
|
4433
|
+
fileName: file.name,
|
|
4434
|
+
file
|
|
4435
|
+
};
|
|
4253
4436
|
}
|
|
4254
|
-
return Injector.create({ parent: fallbackInjector, providers });
|
|
4255
4437
|
}
|
|
4256
|
-
|
|
4257
|
-
|
|
4258
|
-
|
|
4259
|
-
|
|
4260
|
-
|
|
4261
|
-
|
|
4262
|
-
|
|
4263
|
-
|
|
4264
|
-
|
|
4265
|
-
|
|
4266
|
-
|
|
4267
|
-
|
|
4268
|
-
|
|
4269
|
-
|
|
4270
|
-
|
|
4271
|
-
|
|
4272
|
-
|
|
4438
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: MonkeyInputUploadComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
4439
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.13", type: MonkeyInputUploadComponent, isStandalone: true, selector: "monkey-input-upload", inputs: { progress: "progress", placeholder: "placeholder", maxSizeBytes: "maxSizeBytes", allowedExtensions: "allowedExtensions", loading: ["loading", "loading", booleanAttribute], tabIndex: "tabIndex", disabled: ["disabled", "disabled", booleanAttribute], required: ["required", "required", booleanAttribute], value: "value" }, outputs: { onChange: "onChange" }, host: { listeners: { "focus": "_onFocus()", "blur": "_onBlur()" }, properties: { "attr.data-testid": "'monkey-input-upload'", "class.mecx-input-upload-disabled": "_disabled", "class.mecx-input-upload-focused": "focused", "attr.id": "id", "attr.tabindex": "disabled ? -1 : tabIndex" }, classAttribute: "mecx-input-upload" }, providers: [
|
|
4440
|
+
// eslint-disable-next-line no-use-before-define
|
|
4441
|
+
{ provide: MonkeyFormFieldControl, useExisting: MonkeyInputUploadComponent }
|
|
4442
|
+
], viewQueries: [{ propertyName: "fileInput", first: true, predicate: ["fileInput"], descendants: true }], usesOnChanges: true, ngImport: i0, template: `
|
|
4443
|
+
<div class="mecx-input-upload-value" [class.has-value]="value">
|
|
4444
|
+
{{ value?.fileName || placeholder }}
|
|
4445
|
+
</div>
|
|
4446
|
+
<input
|
|
4447
|
+
(change)="onFileSelected($event)"
|
|
4448
|
+
type="file"
|
|
4449
|
+
class="file-input"
|
|
4450
|
+
#fileInput
|
|
4451
|
+
[accept]="allowedExtensions.join(',')"
|
|
4452
|
+
/>
|
|
4453
|
+
@if (loading) {
|
|
4454
|
+
<div class="progress">
|
|
4455
|
+
<div class="progress-bar" [style.width.%]="progress"></div>
|
|
4456
|
+
</div>
|
|
4273
4457
|
}
|
|
4274
|
-
|
|
4275
|
-
|
|
4276
|
-
|
|
4277
|
-
|
|
4458
|
+
`, isInline: true, styles: [":host{display:inline-flex;width:100%;min-width:0;cursor:pointer}:host .progress{position:absolute;left:0;bottom:0;right:0;height:2px;background-color:var(--mecx-color-gray-300);width:100%}:host .progress .progress-bar{background-color:var(--mecx-color-success-main);height:100%;transition:width .2s}:host:focus-visible,:host:focus{outline:none}:host .mecx-input-upload-value{font-size:14px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;line-height:24px}:host .mecx-input-upload-value.has-value{color:var(--mecx-color-gray-900)}:host.mecx-input-upload-disabled .mecx-input-upload-value{color:var(--mecx-color-gray-400)!important}:host .file-input{display:none}\n"] }); }
|
|
4459
|
+
}
|
|
4460
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: MonkeyInputUploadComponent, decorators: [{
|
|
4461
|
+
type: Component,
|
|
4462
|
+
args: [{ selector: 'monkey-input-upload', standalone: true, imports: [], template: `
|
|
4463
|
+
<div class="mecx-input-upload-value" [class.has-value]="value">
|
|
4464
|
+
{{ value?.fileName || placeholder }}
|
|
4465
|
+
</div>
|
|
4466
|
+
<input
|
|
4467
|
+
(change)="onFileSelected($event)"
|
|
4468
|
+
type="file"
|
|
4469
|
+
class="file-input"
|
|
4470
|
+
#fileInput
|
|
4471
|
+
[accept]="allowedExtensions.join(',')"
|
|
4472
|
+
/>
|
|
4473
|
+
@if (loading) {
|
|
4474
|
+
<div class="progress">
|
|
4475
|
+
<div class="progress-bar" [style.width.%]="progress"></div>
|
|
4476
|
+
</div>
|
|
4278
4477
|
}
|
|
4279
|
-
|
|
4280
|
-
|
|
4281
|
-
|
|
4478
|
+
`, providers: [
|
|
4479
|
+
// eslint-disable-next-line no-use-before-define
|
|
4480
|
+
{ provide: MonkeyFormFieldControl, useExisting: MonkeyInputUploadComponent }
|
|
4481
|
+
], host: {
|
|
4482
|
+
'[attr.data-testid]': "'monkey-input-upload'",
|
|
4483
|
+
class: 'mecx-input-upload',
|
|
4484
|
+
'[class.mecx-input-upload-disabled]': '_disabled',
|
|
4485
|
+
'[class.mecx-input-upload-focused]': 'focused',
|
|
4486
|
+
'[attr.id]': 'id',
|
|
4487
|
+
'[attr.tabindex]': 'disabled ? -1 : tabIndex',
|
|
4488
|
+
'(focus)': '_onFocus()',
|
|
4489
|
+
'(blur)': '_onBlur()'
|
|
4490
|
+
}, styles: [":host{display:inline-flex;width:100%;min-width:0;cursor:pointer}:host .progress{position:absolute;left:0;bottom:0;right:0;height:2px;background-color:var(--mecx-color-gray-300);width:100%}:host .progress .progress-bar{background-color:var(--mecx-color-success-main);height:100%;transition:width .2s}:host:focus-visible,:host:focus{outline:none}:host .mecx-input-upload-value{font-size:14px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;line-height:24px}:host .mecx-input-upload-value.has-value{color:var(--mecx-color-gray-900)}:host.mecx-input-upload-disabled .mecx-input-upload-value{color:var(--mecx-color-gray-400)!important}:host .file-input{display:none}\n"] }]
|
|
4491
|
+
}], ctorParameters: () => [], propDecorators: { fileInput: [{
|
|
4492
|
+
type: ViewChild,
|
|
4493
|
+
args: ['fileInput']
|
|
4494
|
+
}], progress: [{
|
|
4495
|
+
type: Input
|
|
4496
|
+
}], placeholder: [{
|
|
4497
|
+
type: Input
|
|
4498
|
+
}], maxSizeBytes: [{
|
|
4499
|
+
type: Input
|
|
4500
|
+
}], allowedExtensions: [{
|
|
4501
|
+
type: Input
|
|
4502
|
+
}], loading: [{
|
|
4503
|
+
type: Input,
|
|
4504
|
+
args: [{ transform: booleanAttribute }]
|
|
4505
|
+
}], tabIndex: [{
|
|
4506
|
+
type: Input
|
|
4507
|
+
}], disabled: [{
|
|
4508
|
+
type: Input,
|
|
4509
|
+
args: [{ transform: booleanAttribute }]
|
|
4510
|
+
}], required: [{
|
|
4511
|
+
type: Input,
|
|
4512
|
+
args: [{ transform: booleanAttribute }]
|
|
4513
|
+
}], value: [{
|
|
4514
|
+
type: Input
|
|
4515
|
+
}], onChange: [{
|
|
4516
|
+
type: Output
|
|
4517
|
+
}] } });
|
|
4518
|
+
|
|
4519
|
+
/** ************************
|
|
4520
|
+
* Copyright Monkey Exchange. All Rights Reserved
|
|
4521
|
+
* This style guide was developed by Monkey Exchange Team
|
|
4522
|
+
* MIT Licence
|
|
4523
|
+
************************* */
|
|
4524
|
+
|
|
4525
|
+
/** ************************
|
|
4526
|
+
* Copyright Monkey Exchange. All Rights Reserved
|
|
4527
|
+
* This style guide was developed by Monkey Exchange Team
|
|
4528
|
+
* MIT Licence
|
|
4529
|
+
************************* */
|
|
4530
|
+
class MonkeyModalActionsDirective {
|
|
4531
|
+
constructor() {
|
|
4532
|
+
this.mkAlign = 'end';
|
|
4533
|
+
this.id = inject(IdGenerator).getId('monkey-modal-actions-');
|
|
4282
4534
|
}
|
|
4283
|
-
|
|
4284
|
-
|
|
4285
|
-
|
|
4286
|
-
|
|
4287
|
-
|
|
4535
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: MonkeyModalActionsDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
4536
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.13", type: MonkeyModalActionsDirective, selector: "monkey-modal-actions, [monkey-modal-actions]", inputs: { mkAlign: "mkAlign" }, host: { properties: { "class": "'mecx-modal-actions align-'+mkAlign", "attr.id": "id || null" } }, ngImport: i0 }); }
|
|
4537
|
+
}
|
|
4538
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: MonkeyModalActionsDirective, decorators: [{
|
|
4539
|
+
type: Directive,
|
|
4540
|
+
args: [{
|
|
4541
|
+
selector: 'monkey-modal-actions, [monkey-modal-actions]',
|
|
4542
|
+
host: {
|
|
4543
|
+
'[class]': `'mecx-modal-actions align-'+mkAlign`,
|
|
4544
|
+
'[attr.id]': 'id || null'
|
|
4545
|
+
}
|
|
4546
|
+
}]
|
|
4547
|
+
}], propDecorators: { mkAlign: [{
|
|
4548
|
+
type: Input
|
|
4549
|
+
}] } });
|
|
4550
|
+
|
|
4551
|
+
/** ************************
|
|
4552
|
+
* Copyright Monkey Exchange. All Rights Reserved
|
|
4553
|
+
* This style guide was developed by Monkey Exchange Team
|
|
4554
|
+
* MIT Licence
|
|
4555
|
+
************************* */
|
|
4556
|
+
class MonkeyModalContentDirective {
|
|
4557
|
+
constructor() {
|
|
4558
|
+
this.id = inject(IdGenerator).getId('monkey-modal-content-');
|
|
4288
4559
|
}
|
|
4289
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type:
|
|
4290
|
-
static { this.ɵ
|
|
4560
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: MonkeyModalContentDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
4561
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.13", type: MonkeyModalContentDirective, selector: "monkey-modal-content, [monkey-modal-content]", host: { properties: { "attr.id": "id || null" }, classAttribute: "mecx-modal-content" }, ngImport: i0 }); }
|
|
4291
4562
|
}
|
|
4292
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type:
|
|
4293
|
-
type:
|
|
4294
|
-
args: [{
|
|
4563
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: MonkeyModalContentDirective, decorators: [{
|
|
4564
|
+
type: Directive,
|
|
4565
|
+
args: [{
|
|
4566
|
+
selector: 'monkey-modal-content, [monkey-modal-content]',
|
|
4567
|
+
host: {
|
|
4568
|
+
class: 'mecx-modal-content',
|
|
4569
|
+
'[attr.id]': 'id || null'
|
|
4570
|
+
}
|
|
4571
|
+
}]
|
|
4295
4572
|
}] });
|
|
4296
4573
|
|
|
4297
4574
|
/** ************************
|
|
@@ -4299,316 +4576,549 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
|
|
|
4299
4576
|
* This style guide was developed by Monkey Exchange Team
|
|
4300
4577
|
* MIT Licence
|
|
4301
4578
|
************************* */
|
|
4579
|
+
class MonkeyModalSubtitleDirective {
|
|
4580
|
+
constructor() {
|
|
4581
|
+
this.id = inject(IdGenerator).getId('monkey-modal-subtitle-');
|
|
4582
|
+
}
|
|
4583
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: MonkeyModalSubtitleDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
4584
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.13", type: MonkeyModalSubtitleDirective, selector: "monkey-modal-subtitle, [monkey-modal-subtitle]", host: { properties: { "attr.id": "id || null" }, classAttribute: "mecx-modal-subtitle" }, ngImport: i0 }); }
|
|
4585
|
+
}
|
|
4586
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: MonkeyModalSubtitleDirective, decorators: [{
|
|
4587
|
+
type: Directive,
|
|
4588
|
+
args: [{
|
|
4589
|
+
selector: 'monkey-modal-subtitle, [monkey-modal-subtitle]',
|
|
4590
|
+
host: {
|
|
4591
|
+
class: 'mecx-modal-subtitle',
|
|
4592
|
+
'[attr.id]': 'id || null'
|
|
4593
|
+
}
|
|
4594
|
+
}]
|
|
4595
|
+
}] });
|
|
4302
4596
|
|
|
4303
4597
|
/** ************************
|
|
4304
4598
|
* Copyright Monkey Exchange. All Rights Reserved
|
|
4305
4599
|
* This style guide was developed by Monkey Exchange Team
|
|
4306
4600
|
* MIT Licence
|
|
4307
4601
|
************************* */
|
|
4308
|
-
class
|
|
4602
|
+
class MonkeyModalTitleDirective {
|
|
4309
4603
|
constructor() {
|
|
4310
|
-
this.
|
|
4311
|
-
this.disabled = false;
|
|
4312
|
-
this.type = 'select';
|
|
4313
|
-
this.selected = false;
|
|
4314
|
-
this.tabIndex = 0;
|
|
4315
|
-
this.id = this.idGenerator.getId('mecx-option-');
|
|
4604
|
+
this.id = inject(IdGenerator).getId('monkey-modal-title-');
|
|
4316
4605
|
}
|
|
4317
|
-
|
|
4318
|
-
|
|
4606
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: MonkeyModalTitleDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
4607
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.13", type: MonkeyModalTitleDirective, selector: "monkey-modal-title, [monkey-modal-title]", host: { properties: { "attr.id": "id || null" }, classAttribute: "mecx-modal-title" }, ngImport: i0 }); }
|
|
4608
|
+
}
|
|
4609
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: MonkeyModalTitleDirective, decorators: [{
|
|
4610
|
+
type: Directive,
|
|
4611
|
+
args: [{
|
|
4612
|
+
selector: 'monkey-modal-title, [monkey-modal-title]',
|
|
4613
|
+
host: {
|
|
4614
|
+
class: 'mecx-modal-title',
|
|
4615
|
+
'[attr.id]': 'id || null'
|
|
4616
|
+
}
|
|
4617
|
+
}]
|
|
4618
|
+
}] });
|
|
4619
|
+
|
|
4620
|
+
/** ************************
|
|
4621
|
+
* Copyright Monkey Exchange. All Rights Reserved
|
|
4622
|
+
* This style guide was developed by Monkey Exchange Team
|
|
4623
|
+
* MIT Licence
|
|
4624
|
+
************************* */
|
|
4625
|
+
class MonkeyModalConfig {
|
|
4626
|
+
constructor() {
|
|
4627
|
+
this.panelClass = '';
|
|
4628
|
+
this.hasBackdrop = true;
|
|
4629
|
+
this.backdropClass = 'mecx-modal-overlay';
|
|
4630
|
+
this.disableClose = false;
|
|
4631
|
+
this.disableBackdropClose = false;
|
|
4632
|
+
this.fullscreen = false;
|
|
4633
|
+
this.position = 'center-center';
|
|
4634
|
+
this.data = null;
|
|
4635
|
+
this.closeOnNavigation = true;
|
|
4319
4636
|
}
|
|
4320
|
-
|
|
4321
|
-
|
|
4322
|
-
|
|
4323
|
-
|
|
4637
|
+
}
|
|
4638
|
+
|
|
4639
|
+
/** ************************
|
|
4640
|
+
* Copyright Monkey Exchange. All Rights Reserved
|
|
4641
|
+
* This style guide was developed by Monkey Exchange Team
|
|
4642
|
+
* MIT Licence
|
|
4643
|
+
************************* */
|
|
4644
|
+
class MonkeyModalRef {
|
|
4645
|
+
constructor(overlayRef, config) {
|
|
4646
|
+
this.overlayRef = overlayRef;
|
|
4647
|
+
this.config = config;
|
|
4648
|
+
this.closed = new Subject();
|
|
4649
|
+
this.id = config.id;
|
|
4650
|
+
this.icon = config.icon;
|
|
4651
|
+
this.disableClose = config.disableClose;
|
|
4652
|
+
this.disableBackdropClose = config.disableBackdropClose;
|
|
4653
|
+
this.closeOnNavigation = config.closeOnNavigation;
|
|
4654
|
+
this.backdropClick = overlayRef.backdropClick();
|
|
4655
|
+
this.keydownEvents = overlayRef.keydownEvents();
|
|
4656
|
+
this.outsidePointerEvents = overlayRef.outsidePointerEvents();
|
|
4657
|
+
if (!this.disableBackdropClose) {
|
|
4658
|
+
this.keydownEvents.subscribe((event) => {
|
|
4659
|
+
if (event.key === 'Escape' && !this.disableClose && !hasModifierKey(event)) {
|
|
4660
|
+
event.preventDefault();
|
|
4661
|
+
this.close(undefined);
|
|
4662
|
+
}
|
|
4663
|
+
});
|
|
4664
|
+
this.backdropClick.subscribe(() => {
|
|
4665
|
+
if (!this.disableClose) {
|
|
4666
|
+
this.close(undefined);
|
|
4667
|
+
}
|
|
4668
|
+
});
|
|
4324
4669
|
}
|
|
4325
|
-
|
|
4326
|
-
|
|
4670
|
+
}
|
|
4671
|
+
close(result) {
|
|
4672
|
+
if (this.componentInstance) {
|
|
4673
|
+
const closedSubject = this.closed;
|
|
4674
|
+
const active = document.activeElement;
|
|
4675
|
+
if (active && this.componentElement.contains(active)) {
|
|
4676
|
+
active.blur();
|
|
4677
|
+
}
|
|
4678
|
+
this.componentElement.querySelectorAll('monkey-modal')[0].classList.add('fade-out');
|
|
4679
|
+
setTimeout(() => {
|
|
4680
|
+
this.overlayRef.detach();
|
|
4681
|
+
}, 150);
|
|
4682
|
+
closedSubject.next(result);
|
|
4683
|
+
closedSubject.complete();
|
|
4684
|
+
// eslint-disable-next-line no-multi-assign
|
|
4685
|
+
this.componentInstance = null;
|
|
4327
4686
|
}
|
|
4328
4687
|
}
|
|
4329
|
-
|
|
4330
|
-
this.
|
|
4688
|
+
afterClosed() {
|
|
4689
|
+
return this.closed;
|
|
4331
4690
|
}
|
|
4332
|
-
|
|
4333
|
-
|
|
4334
|
-
|
|
4335
|
-
|
|
4691
|
+
}
|
|
4692
|
+
|
|
4693
|
+
class MonkeyModalComponent {
|
|
4694
|
+
constructor(_elementRef, overlayRef, modalRef) {
|
|
4695
|
+
this._elementRef = _elementRef;
|
|
4696
|
+
this.overlayRef = overlayRef;
|
|
4697
|
+
this.modalRef = modalRef;
|
|
4698
|
+
this._navigationSubscription = null;
|
|
4699
|
+
this._router = inject(Router);
|
|
4700
|
+
// not to do
|
|
4701
|
+
}
|
|
4702
|
+
ngAfterViewInit() {
|
|
4703
|
+
if (this._elementRef) {
|
|
4704
|
+
this._elementRef.nativeElement.focus();
|
|
4705
|
+
}
|
|
4706
|
+
if (this.modalRef?.closeOnNavigation) {
|
|
4707
|
+
this._navigationSubscription = this._router.events.subscribe((event) => {
|
|
4708
|
+
if (event instanceof NavigationStart) {
|
|
4709
|
+
this.close();
|
|
4710
|
+
}
|
|
4711
|
+
});
|
|
4336
4712
|
}
|
|
4337
4713
|
}
|
|
4338
|
-
|
|
4339
|
-
|
|
4714
|
+
ngOnDestroy() {
|
|
4715
|
+
if (this._navigationSubscription) {
|
|
4716
|
+
this._navigationSubscription.unsubscribe();
|
|
4717
|
+
this._navigationSubscription = null;
|
|
4718
|
+
}
|
|
4719
|
+
}
|
|
4720
|
+
close() {
|
|
4721
|
+
const element = this._elementRef.nativeElement;
|
|
4722
|
+
element.classList.add('fade-out');
|
|
4723
|
+
setTimeout(() => {
|
|
4724
|
+
this.modalRef?.close();
|
|
4725
|
+
}, 150);
|
|
4726
|
+
}
|
|
4727
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: MonkeyModalComponent, deps: [{ token: i0.ElementRef }, { token: i1$1.OverlayRef, optional: true }, { token: MonkeyModalRef, optional: true }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
4728
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.13", type: MonkeyModalComponent, selector: "monkey-modal", host: { attributes: { "tabindex": "-1" }, properties: { "attr.id": "modalRef?.id || null" }, classAttribute: "mecx-modal" }, ngImport: i0, template: `
|
|
4729
|
+
<div class="mecx-modal-header">
|
|
4730
|
+
<div class="mecx-modal-header-group">
|
|
4731
|
+
<div class="mecx-modal-header-title">
|
|
4732
|
+
@if (modalRef?.icon) {
|
|
4733
|
+
<div class="mecx-modal-header-icon">
|
|
4734
|
+
<monkey-icon [icon]="modalRef?.icon + ''" first></monkey-icon>
|
|
4735
|
+
</div>
|
|
4736
|
+
}
|
|
4737
|
+
<ng-content select="monkey-modal-title"></ng-content>
|
|
4738
|
+
<ng-content select="[monkey-modal-title]"></ng-content>
|
|
4739
|
+
</div>
|
|
4740
|
+
|
|
4741
|
+
<ng-content select="monkey-modal-subtitle"></ng-content>
|
|
4742
|
+
<ng-content select="[monkey-modal-subtitle]"></ng-content>
|
|
4743
|
+
</div>
|
|
4744
|
+
@if (!modalRef?.disableClose) {
|
|
4745
|
+
<monkey-icon-button
|
|
4746
|
+
size="sm"
|
|
4747
|
+
type="tertiary"
|
|
4748
|
+
icon="close"
|
|
4749
|
+
class="mecx-modal-close"
|
|
4750
|
+
(click)="close()"
|
|
4751
|
+
>
|
|
4752
|
+
</monkey-icon-button>
|
|
4753
|
+
}
|
|
4754
|
+
</div>
|
|
4755
|
+
<ng-content select="monkey-modal-content"></ng-content>
|
|
4756
|
+
<ng-content select="[monkey-modal-content]"></ng-content>
|
|
4757
|
+
<ng-content select="monkey-modal-actions"></ng-content>
|
|
4758
|
+
<ng-content select="[monkey-modal-actions]"></ng-content>
|
|
4759
|
+
`, isInline: true, styles: ["monkey-modal{width:100%;height:100%;display:flex;flex-direction:column;background:#fff;border-radius:8px}.mecx-modal{opacity:0;animation:modal-fade-in .2s ease-out forwards;transition:opacity .15s ease-in}.mecx-modal.fade-out{animation:modal-fade-out .15s ease-in forwards}@keyframes modal-fade-in{0%{opacity:0;transform:scale(.8)}to{opacity:1;transform:scale(1)}}@keyframes modal-fade-out{0%{opacity:1;transform:scale(1)}to{opacity:0;transform:scale(.8)}}.mecx-modal-header{display:flex;gap:12px;align-items:flex-start;justify-content:space-between;border-bottom:1px solid var(--mecx-color-gray-200);padding:12px;position:relative}.mecx-modal-header-group{display:flex;flex-direction:column;align-items:flex-start;justify-content:flex-start;gap:4px}.mecx-modal-header-title{display:flex;gap:8px;align-items:center;justify-content:flex-start}.mecx-modal-header-icon{padding:8px;display:flex;align-items:center;justify-content:center;background:var(--mecx-color-gray-100);border-radius:8px;font-size:24px;color:var(--mecx-color-gray-900)}.mecx-modal-title{font-size:18px;font-style:normal;font-weight:400;line-height:24px;letter-spacing:.54px;color:var(--mecx-color-gray-900)}.mecx-modal-subtitle{font-size:14px;font-style:normal;font-weight:400;line-height:24px;letter-spacing:.42px;color:var(--mecx-color-gray-700)}.mecx-modal-content{display:block;flex-grow:1;box-sizing:border-box;overflow:auto;max-height:65vh;padding:12px;scrollbar-color:var(--mecx-color-gray-400) transparent}.mecx-modal-actions{display:flex;flex-wrap:wrap;gap:8px;border-top:1px solid var(--mecx-color-gray-200);padding:12px}.mecx-modal-actions.align-start{justify-content:flex-start}.mecx-modal-actions.align-center{justify-content:center}.mecx-modal-actions.align-end{justify-content:flex-end}.mecx-modal-overlay{background:#00000052}.monkey-modal-panel{padding:16px}.monkey-modal-panel.monkey-modal-fullscreen{width:100%!important;max-width:100%!important;height:100%!important;max-height:100%!important;padding:0}.monkey-modal-panel.monkey-modal-fullscreen monkey-modal{border-radius:0}.monkey-modal-panel.monkey-modal-fullscreen monkey-modal .mecx-modal-content{max-height:100%}\n"], dependencies: [{ kind: "component", type: MonkeyIconButtonComponent, selector: "monkey-icon-button", inputs: ["type", "size", "disabled", "icon", "id"] }, { kind: "component", type: MonkeyIconComponent, selector: "monkey-icon", inputs: ["icon", "size", "id"] }], encapsulation: i0.ViewEncapsulation.None }); }
|
|
4340
4760
|
}
|
|
4341
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type:
|
|
4761
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: MonkeyModalComponent, decorators: [{
|
|
4342
4762
|
type: Component,
|
|
4343
|
-
args: [{ selector: 'monkey-
|
|
4344
|
-
|
|
4345
|
-
|
|
4346
|
-
|
|
4347
|
-
|
|
4348
|
-
|
|
4349
|
-
|
|
4350
|
-
|
|
4351
|
-
|
|
4352
|
-
|
|
4353
|
-
|
|
4354
|
-
|
|
4355
|
-
|
|
4356
|
-
|
|
4357
|
-
|
|
4358
|
-
|
|
4359
|
-
|
|
4360
|
-
|
|
4361
|
-
|
|
4362
|
-
|
|
4363
|
-
|
|
4364
|
-
|
|
4365
|
-
|
|
4366
|
-
|
|
4367
|
-
|
|
4368
|
-
|
|
4763
|
+
args: [{ encapsulation: ViewEncapsulation.None, selector: 'monkey-modal', template: `
|
|
4764
|
+
<div class="mecx-modal-header">
|
|
4765
|
+
<div class="mecx-modal-header-group">
|
|
4766
|
+
<div class="mecx-modal-header-title">
|
|
4767
|
+
@if (modalRef?.icon) {
|
|
4768
|
+
<div class="mecx-modal-header-icon">
|
|
4769
|
+
<monkey-icon [icon]="modalRef?.icon + ''" first></monkey-icon>
|
|
4770
|
+
</div>
|
|
4771
|
+
}
|
|
4772
|
+
<ng-content select="monkey-modal-title"></ng-content>
|
|
4773
|
+
<ng-content select="[monkey-modal-title]"></ng-content>
|
|
4774
|
+
</div>
|
|
4775
|
+
|
|
4776
|
+
<ng-content select="monkey-modal-subtitle"></ng-content>
|
|
4777
|
+
<ng-content select="[monkey-modal-subtitle]"></ng-content>
|
|
4778
|
+
</div>
|
|
4779
|
+
@if (!modalRef?.disableClose) {
|
|
4780
|
+
<monkey-icon-button
|
|
4781
|
+
size="sm"
|
|
4782
|
+
type="tertiary"
|
|
4783
|
+
icon="close"
|
|
4784
|
+
class="mecx-modal-close"
|
|
4785
|
+
(click)="close()"
|
|
4786
|
+
>
|
|
4787
|
+
</monkey-icon-button>
|
|
4788
|
+
}
|
|
4789
|
+
</div>
|
|
4790
|
+
<ng-content select="monkey-modal-content"></ng-content>
|
|
4791
|
+
<ng-content select="[monkey-modal-content]"></ng-content>
|
|
4792
|
+
<ng-content select="monkey-modal-actions"></ng-content>
|
|
4793
|
+
<ng-content select="[monkey-modal-actions]"></ng-content>
|
|
4794
|
+
`, host: {
|
|
4795
|
+
class: 'mecx-modal',
|
|
4796
|
+
tabindex: '-1',
|
|
4797
|
+
'[attr.id]': 'modalRef?.id || null'
|
|
4798
|
+
}, styles: ["monkey-modal{width:100%;height:100%;display:flex;flex-direction:column;background:#fff;border-radius:8px}.mecx-modal{opacity:0;animation:modal-fade-in .2s ease-out forwards;transition:opacity .15s ease-in}.mecx-modal.fade-out{animation:modal-fade-out .15s ease-in forwards}@keyframes modal-fade-in{0%{opacity:0;transform:scale(.8)}to{opacity:1;transform:scale(1)}}@keyframes modal-fade-out{0%{opacity:1;transform:scale(1)}to{opacity:0;transform:scale(.8)}}.mecx-modal-header{display:flex;gap:12px;align-items:flex-start;justify-content:space-between;border-bottom:1px solid var(--mecx-color-gray-200);padding:12px;position:relative}.mecx-modal-header-group{display:flex;flex-direction:column;align-items:flex-start;justify-content:flex-start;gap:4px}.mecx-modal-header-title{display:flex;gap:8px;align-items:center;justify-content:flex-start}.mecx-modal-header-icon{padding:8px;display:flex;align-items:center;justify-content:center;background:var(--mecx-color-gray-100);border-radius:8px;font-size:24px;color:var(--mecx-color-gray-900)}.mecx-modal-title{font-size:18px;font-style:normal;font-weight:400;line-height:24px;letter-spacing:.54px;color:var(--mecx-color-gray-900)}.mecx-modal-subtitle{font-size:14px;font-style:normal;font-weight:400;line-height:24px;letter-spacing:.42px;color:var(--mecx-color-gray-700)}.mecx-modal-content{display:block;flex-grow:1;box-sizing:border-box;overflow:auto;max-height:65vh;padding:12px;scrollbar-color:var(--mecx-color-gray-400) transparent}.mecx-modal-actions{display:flex;flex-wrap:wrap;gap:8px;border-top:1px solid var(--mecx-color-gray-200);padding:12px}.mecx-modal-actions.align-start{justify-content:flex-start}.mecx-modal-actions.align-center{justify-content:center}.mecx-modal-actions.align-end{justify-content:flex-end}.mecx-modal-overlay{background:#00000052}.monkey-modal-panel{padding:16px}.monkey-modal-panel.monkey-modal-fullscreen{width:100%!important;max-width:100%!important;height:100%!important;max-height:100%!important;padding:0}.monkey-modal-panel.monkey-modal-fullscreen monkey-modal{border-radius:0}.monkey-modal-panel.monkey-modal-fullscreen monkey-modal .mecx-modal-content{max-height:100%}\n"] }]
|
|
4799
|
+
}], ctorParameters: () => [{ type: i0.ElementRef }, { type: i1$1.OverlayRef, decorators: [{
|
|
4800
|
+
type: Optional
|
|
4801
|
+
}] }, { type: MonkeyModalRef, decorators: [{
|
|
4802
|
+
type: Optional
|
|
4803
|
+
}] }] });
|
|
4369
4804
|
|
|
4370
4805
|
/** ************************
|
|
4371
4806
|
* Copyright Monkey Exchange. All Rights Reserved
|
|
4372
4807
|
* This style guide was developed by Monkey Exchange Team
|
|
4373
4808
|
* MIT Licence
|
|
4374
4809
|
************************* */
|
|
4810
|
+
const MECX_MODAL_DATA = new InjectionToken('mecxModalData');
|
|
4811
|
+
const MECX_MODAL_DEFAULT_CONFIG = new InjectionToken('mecxModalDefaultConfig');
|
|
4812
|
+
const MECX_MODAL_CONFIRMATION_CONFIG = new InjectionToken('mecxModalConfirmationConfig');
|
|
4813
|
+
/**
|
|
4814
|
+
* @license
|
|
4815
|
+
* Copyright Google LLC All Rights Reserved.
|
|
4816
|
+
*
|
|
4817
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
4818
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
4819
|
+
*/
|
|
4820
|
+
function reverseForEach(items, callback) {
|
|
4821
|
+
let i = items.length;
|
|
4822
|
+
// eslint-disable-next-line no-plusplus
|
|
4823
|
+
while (i--) {
|
|
4824
|
+
callback(items[i]);
|
|
4825
|
+
}
|
|
4826
|
+
}
|
|
4375
4827
|
|
|
4376
4828
|
/** ************************
|
|
4377
4829
|
* Copyright Monkey Exchange. All Rights Reserved
|
|
4378
4830
|
* This style guide was developed by Monkey Exchange Team
|
|
4379
4831
|
* MIT Licence
|
|
4380
4832
|
************************* */
|
|
4381
|
-
class
|
|
4382
|
-
|
|
4383
|
-
|
|
4384
|
-
|
|
4385
|
-
|
|
4386
|
-
if (this.ngControl && this.ngControl.disabled !== null) {
|
|
4387
|
-
return this.ngControl.disabled;
|
|
4388
|
-
}
|
|
4389
|
-
return this._disabled;
|
|
4390
|
-
}
|
|
4391
|
-
set disabled(value) {
|
|
4392
|
-
this._disabled = value;
|
|
4393
|
-
if (this.focused) {
|
|
4394
|
-
this.focused = false;
|
|
4395
|
-
this.stateChanges.next();
|
|
4396
|
-
}
|
|
4397
|
-
}
|
|
4398
|
-
get required() {
|
|
4399
|
-
return this._required ?? this.ngControl?.control?.hasValidator(Validators.required) ?? false;
|
|
4400
|
-
}
|
|
4401
|
-
set required(value) {
|
|
4402
|
-
this._required = value;
|
|
4403
|
-
this.stateChanges.next();
|
|
4404
|
-
}
|
|
4405
|
-
set value(value) {
|
|
4406
|
-
if (this._value !== value) {
|
|
4407
|
-
this._value = value;
|
|
4408
|
-
this._onChange(value);
|
|
4409
|
-
}
|
|
4410
|
-
}
|
|
4411
|
-
get value() {
|
|
4412
|
-
return this._value;
|
|
4413
|
-
}
|
|
4414
|
-
constructor(changeDetectorRef, formField) {
|
|
4415
|
-
this.changeDetectorRef = changeDetectorRef;
|
|
4416
|
-
this.formField = formField;
|
|
4417
|
-
this.tabIndex = 0;
|
|
4418
|
-
this.onChange = new EventEmitter();
|
|
4419
|
-
this.onSearch = new EventEmitter();
|
|
4420
|
-
this.position = 'horizontal';
|
|
4421
|
-
this.size = 'lg';
|
|
4422
|
-
this._value = null;
|
|
4423
|
-
this._destroyRef = inject(DestroyRef);
|
|
4424
|
-
this.idGenerator = inject(IdGenerator);
|
|
4425
|
-
this.ngControl = inject(NgControl, { self: true, optional: true });
|
|
4426
|
-
this._elementRef = inject(ElementRef);
|
|
4427
|
-
this.focused = false;
|
|
4428
|
-
this._disabled = false;
|
|
4429
|
-
this.id = this.idGenerator.getId('monkey-radiobutton-');
|
|
4430
|
-
this.stateChanges = new Subject();
|
|
4431
|
-
this.type = 'radio-button';
|
|
4432
|
-
this._onChange = () => { };
|
|
4433
|
-
this._onTouched = () => { };
|
|
4434
|
-
if (this.ngControl) {
|
|
4435
|
-
this.ngControl.valueAccessor = this;
|
|
4436
|
-
}
|
|
4437
|
-
}
|
|
4438
|
-
changeSelected() {
|
|
4439
|
-
setTimeout(() => {
|
|
4440
|
-
if (this.options) {
|
|
4441
|
-
this.options.forEach((opt) => {
|
|
4442
|
-
opt.selected = opt.value === this.value;
|
|
4443
|
-
});
|
|
4444
|
-
}
|
|
4445
|
-
this.changeDetectorRef.markForCheck();
|
|
4446
|
-
});
|
|
4447
|
-
}
|
|
4448
|
-
initializeOptions() {
|
|
4449
|
-
setTimeout(() => {
|
|
4450
|
-
this.options?.forEach((option) => {
|
|
4451
|
-
option.type = 'radio';
|
|
4452
|
-
if (!option.action) {
|
|
4453
|
-
option.action = this.selectOption.bind(this, option);
|
|
4454
|
-
}
|
|
4455
|
-
});
|
|
4456
|
-
this.changeDetectorRef.markForCheck();
|
|
4457
|
-
}, 0);
|
|
4458
|
-
}
|
|
4459
|
-
ngAfterContentInit() {
|
|
4460
|
-
this.initializeOptions();
|
|
4461
|
-
this.options.changes.pipe(takeUntilDestroyed(this._destroyRef)).subscribe(() => {
|
|
4462
|
-
this.initializeOptions();
|
|
4463
|
-
this.changeSelected();
|
|
4464
|
-
});
|
|
4465
|
-
}
|
|
4466
|
-
selectOption(option) {
|
|
4467
|
-
if (!option.disabled && !this.disabled) {
|
|
4468
|
-
this.value = option.value;
|
|
4469
|
-
this._onChange(this.value);
|
|
4470
|
-
this.onChange.emit(this.value);
|
|
4471
|
-
this.options.forEach((opt) => {
|
|
4472
|
-
opt.selected = opt.value === this.value;
|
|
4473
|
-
});
|
|
4474
|
-
}
|
|
4475
|
-
}
|
|
4476
|
-
writeValue(value) {
|
|
4477
|
-
this.value = value;
|
|
4478
|
-
this.changeSelected();
|
|
4479
|
-
}
|
|
4480
|
-
onContainerClick(event) {
|
|
4481
|
-
if (this.disabled)
|
|
4482
|
-
return;
|
|
4483
|
-
this._elementRef.nativeElement.focus();
|
|
4833
|
+
class MonkeyModalDefaultComponent {
|
|
4834
|
+
constructor(config, modalRef) {
|
|
4835
|
+
this.config = config;
|
|
4836
|
+
this.modalRef = modalRef;
|
|
4837
|
+
// not to do
|
|
4484
4838
|
}
|
|
4485
|
-
|
|
4486
|
-
|
|
4487
|
-
this.focused = true;
|
|
4488
|
-
this._onTouched();
|
|
4489
|
-
this.stateChanges.next();
|
|
4490
|
-
}
|
|
4839
|
+
onSubmit() {
|
|
4840
|
+
this.modalRef.close(true);
|
|
4491
4841
|
}
|
|
4492
|
-
|
|
4493
|
-
this.
|
|
4494
|
-
this.stateChanges.next();
|
|
4842
|
+
onClose() {
|
|
4843
|
+
this.modalRef.close();
|
|
4495
4844
|
}
|
|
4496
|
-
|
|
4497
|
-
|
|
4845
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: MonkeyModalDefaultComponent, deps: [{ token: MECX_MODAL_DEFAULT_CONFIG }, { token: MonkeyModalRef }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
4846
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.13", type: MonkeyModalDefaultComponent, selector: "monkey-modal-default", ngImport: i0, template: `
|
|
4847
|
+
<monkey-modal>
|
|
4848
|
+
<monkey-modal-title [innerHTML]="config.title"></monkey-modal-title>
|
|
4849
|
+
<monkey-modal-subtitle [innerHTML]="config.subtitle"></monkey-modal-subtitle>
|
|
4850
|
+
<monkey-modal-content [innerHTML]="config.content"></monkey-modal-content>
|
|
4851
|
+
<monkey-modal-actions mkAlign="end">
|
|
4852
|
+
<monkey-button type="tertiary" (click)="onClose()">{{ config.cancelLabel }}</monkey-button>
|
|
4853
|
+
<monkey-button type="primary" (click)="onSubmit()">{{ config.okLabel }}</monkey-button>
|
|
4854
|
+
</monkey-modal-actions>
|
|
4855
|
+
</monkey-modal>
|
|
4856
|
+
`, isInline: true, dependencies: [{ kind: "component", type: MonkeyButtonComponent, selector: "monkey-button", inputs: ["disabled", "size", "type", "id"] }, { kind: "component", type: MonkeyModalComponent, selector: "monkey-modal" }, { kind: "directive", type: MonkeyModalTitleDirective, selector: "monkey-modal-title, [monkey-modal-title]" }, { kind: "directive", type: MonkeyModalSubtitleDirective, selector: "monkey-modal-subtitle, [monkey-modal-subtitle]" }, { kind: "directive", type: MonkeyModalContentDirective, selector: "monkey-modal-content, [monkey-modal-content]" }, { kind: "directive", type: MonkeyModalActionsDirective, selector: "monkey-modal-actions, [monkey-modal-actions]", inputs: ["mkAlign"] }] }); }
|
|
4857
|
+
}
|
|
4858
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: MonkeyModalDefaultComponent, decorators: [{
|
|
4859
|
+
type: Component,
|
|
4860
|
+
args: [{
|
|
4861
|
+
selector: 'monkey-modal-default',
|
|
4862
|
+
template: `
|
|
4863
|
+
<monkey-modal>
|
|
4864
|
+
<monkey-modal-title [innerHTML]="config.title"></monkey-modal-title>
|
|
4865
|
+
<monkey-modal-subtitle [innerHTML]="config.subtitle"></monkey-modal-subtitle>
|
|
4866
|
+
<monkey-modal-content [innerHTML]="config.content"></monkey-modal-content>
|
|
4867
|
+
<monkey-modal-actions mkAlign="end">
|
|
4868
|
+
<monkey-button type="tertiary" (click)="onClose()">{{ config.cancelLabel }}</monkey-button>
|
|
4869
|
+
<monkey-button type="primary" (click)="onSubmit()">{{ config.okLabel }}</monkey-button>
|
|
4870
|
+
</monkey-modal-actions>
|
|
4871
|
+
</monkey-modal>
|
|
4872
|
+
`
|
|
4873
|
+
}]
|
|
4874
|
+
}], ctorParameters: () => [{ type: undefined, decorators: [{
|
|
4875
|
+
type: Inject,
|
|
4876
|
+
args: [MECX_MODAL_DEFAULT_CONFIG]
|
|
4877
|
+
}] }, { type: MonkeyModalRef, decorators: [{
|
|
4878
|
+
type: Inject,
|
|
4879
|
+
args: [MonkeyModalRef]
|
|
4880
|
+
}] }] });
|
|
4881
|
+
|
|
4882
|
+
class MonkeyModalConfirmationComponent {
|
|
4883
|
+
constructor(config, modalRef) {
|
|
4884
|
+
this.config = config;
|
|
4885
|
+
this.modalRef = modalRef;
|
|
4886
|
+
// not to do
|
|
4498
4887
|
}
|
|
4499
|
-
|
|
4500
|
-
this.
|
|
4888
|
+
onSubmit() {
|
|
4889
|
+
this.modalRef.close(true);
|
|
4501
4890
|
}
|
|
4502
|
-
|
|
4503
|
-
this.
|
|
4504
|
-
this.initializeOptions();
|
|
4891
|
+
onClose() {
|
|
4892
|
+
this.modalRef.close();
|
|
4505
4893
|
}
|
|
4506
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type:
|
|
4507
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "
|
|
4508
|
-
|
|
4509
|
-
|
|
4510
|
-
|
|
4894
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: MonkeyModalConfirmationComponent, deps: [{ token: MECX_MODAL_CONFIRMATION_CONFIG }, { token: MonkeyModalRef }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
4895
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.13", type: MonkeyModalConfirmationComponent, selector: "monkey-modal-confirmation", ngImport: i0, template: `
|
|
4896
|
+
<monkey-modal class="modal-confirmation">
|
|
4897
|
+
<monkey-modal-content>
|
|
4898
|
+
@if (config.icon) {
|
|
4899
|
+
<div class="modal-confirmation-icon {{ config.type }}">
|
|
4900
|
+
<monkey-icon [icon]="config.icon" size="xxl"></monkey-icon>
|
|
4901
|
+
</div>
|
|
4902
|
+
}
|
|
4903
|
+
<div class="confirmation-title" [innerHTML]="config.title"></div>
|
|
4904
|
+
<div class="confirmation-description" [innerHTML]="config.content"></div>
|
|
4905
|
+
</monkey-modal-content>
|
|
4906
|
+
<monkey-modal-actions>
|
|
4907
|
+
<monkey-button type="tertiary" (click)="onClose()">{{ config.cancelLabel }}</monkey-button>
|
|
4908
|
+
<monkey-button type="primary" (click)="onSubmit()">{{ config.okLabel }}</monkey-button>
|
|
4909
|
+
</monkey-modal-actions>
|
|
4910
|
+
</monkey-modal>
|
|
4911
|
+
`, isInline: true, styles: [".modal-confirmation .mecx-modal-header{border:none}.modal-confirmation .confirmation-title{color:var(--mecx-color-gray-900);text-align:center;font-size:18px;font-style:normal;font-weight:400;line-height:24px;letter-spacing:.54px;margin-bottom:8px}.modal-confirmation .confirmation-description{color:var(--mecx-color-gray-700);text-align:center;font-size:14px;font-style:normal;font-weight:400;line-height:24px;letter-spacing:.42px;margin-bottom:24px}.modal-confirmation .modal-confirmation-icon{width:80px;height:80px;border-radius:50%;display:flex;margin:0 auto 16px;align-items:center;justify-content:center;background-color:var(--mecx-color-gray-50)}.modal-confirmation .modal-confirmation-icon monkey-icon{color:var(--mecx-color-gray-900)}.modal-confirmation .modal-confirmation-icon.warning{background-color:var(--mecx-color-warning-100)}.modal-confirmation .modal-confirmation-icon.warning monkey-icon{color:var(--mecx-color-warning-500)}.modal-confirmation .modal-confirmation-icon.error{background-color:var(--mecx-color-error-100)}.modal-confirmation .modal-confirmation-icon.error monkey-icon{color:var(--mecx-color-error-500)}.modal-confirmation .modal-confirmation-icon.success{background-color:var(--mecx-color-success-100)}.modal-confirmation .modal-confirmation-icon.success monkey-icon{color:var(--mecx-color-success-500)}\n"], dependencies: [{ kind: "component", type: MonkeyButtonComponent, selector: "monkey-button", inputs: ["disabled", "size", "type", "id"] }, { kind: "component", type: MonkeyIconComponent, selector: "monkey-icon", inputs: ["icon", "size", "id"] }, { kind: "component", type: MonkeyModalComponent, selector: "monkey-modal" }, { kind: "directive", type: MonkeyModalContentDirective, selector: "monkey-modal-content, [monkey-modal-content]" }, { kind: "directive", type: MonkeyModalActionsDirective, selector: "monkey-modal-actions, [monkey-modal-actions]", inputs: ["mkAlign"] }], encapsulation: i0.ViewEncapsulation.None }); }
|
|
4511
4912
|
}
|
|
4512
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type:
|
|
4913
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: MonkeyModalConfirmationComponent, decorators: [{
|
|
4513
4914
|
type: Component,
|
|
4514
|
-
args: [{ selector: 'monkey-
|
|
4515
|
-
|
|
4516
|
-
|
|
4517
|
-
|
|
4518
|
-
|
|
4519
|
-
|
|
4520
|
-
|
|
4521
|
-
|
|
4522
|
-
|
|
4523
|
-
|
|
4524
|
-
|
|
4525
|
-
|
|
4526
|
-
|
|
4527
|
-
|
|
4528
|
-
|
|
4529
|
-
|
|
4530
|
-
|
|
4531
|
-
|
|
4532
|
-
|
|
4533
|
-
|
|
4534
|
-
|
|
4535
|
-
|
|
4536
|
-
|
|
4537
|
-
|
|
4538
|
-
}], position: [{
|
|
4539
|
-
type: Input
|
|
4540
|
-
}], size: [{
|
|
4541
|
-
type: Input
|
|
4542
|
-
}], classes: [{
|
|
4543
|
-
type: HostBinding,
|
|
4544
|
-
args: ['class']
|
|
4545
|
-
}], disabled: [{
|
|
4546
|
-
type: Input,
|
|
4547
|
-
args: [{ transform: booleanAttribute }]
|
|
4548
|
-
}], required: [{
|
|
4549
|
-
type: Input,
|
|
4550
|
-
args: [{ transform: booleanAttribute }]
|
|
4551
|
-
}], value: [{
|
|
4552
|
-
type: Input
|
|
4553
|
-
}] } });
|
|
4915
|
+
args: [{ selector: 'monkey-modal-confirmation', encapsulation: ViewEncapsulation.None, template: `
|
|
4916
|
+
<monkey-modal class="modal-confirmation">
|
|
4917
|
+
<monkey-modal-content>
|
|
4918
|
+
@if (config.icon) {
|
|
4919
|
+
<div class="modal-confirmation-icon {{ config.type }}">
|
|
4920
|
+
<monkey-icon [icon]="config.icon" size="xxl"></monkey-icon>
|
|
4921
|
+
</div>
|
|
4922
|
+
}
|
|
4923
|
+
<div class="confirmation-title" [innerHTML]="config.title"></div>
|
|
4924
|
+
<div class="confirmation-description" [innerHTML]="config.content"></div>
|
|
4925
|
+
</monkey-modal-content>
|
|
4926
|
+
<monkey-modal-actions>
|
|
4927
|
+
<monkey-button type="tertiary" (click)="onClose()">{{ config.cancelLabel }}</monkey-button>
|
|
4928
|
+
<monkey-button type="primary" (click)="onSubmit()">{{ config.okLabel }}</monkey-button>
|
|
4929
|
+
</monkey-modal-actions>
|
|
4930
|
+
</monkey-modal>
|
|
4931
|
+
`, styles: [".modal-confirmation .mecx-modal-header{border:none}.modal-confirmation .confirmation-title{color:var(--mecx-color-gray-900);text-align:center;font-size:18px;font-style:normal;font-weight:400;line-height:24px;letter-spacing:.54px;margin-bottom:8px}.modal-confirmation .confirmation-description{color:var(--mecx-color-gray-700);text-align:center;font-size:14px;font-style:normal;font-weight:400;line-height:24px;letter-spacing:.42px;margin-bottom:24px}.modal-confirmation .modal-confirmation-icon{width:80px;height:80px;border-radius:50%;display:flex;margin:0 auto 16px;align-items:center;justify-content:center;background-color:var(--mecx-color-gray-50)}.modal-confirmation .modal-confirmation-icon monkey-icon{color:var(--mecx-color-gray-900)}.modal-confirmation .modal-confirmation-icon.warning{background-color:var(--mecx-color-warning-100)}.modal-confirmation .modal-confirmation-icon.warning monkey-icon{color:var(--mecx-color-warning-500)}.modal-confirmation .modal-confirmation-icon.error{background-color:var(--mecx-color-error-100)}.modal-confirmation .modal-confirmation-icon.error monkey-icon{color:var(--mecx-color-error-500)}.modal-confirmation .modal-confirmation-icon.success{background-color:var(--mecx-color-success-100)}.modal-confirmation .modal-confirmation-icon.success monkey-icon{color:var(--mecx-color-success-500)}\n"] }]
|
|
4932
|
+
}], ctorParameters: () => [{ type: undefined, decorators: [{
|
|
4933
|
+
type: Inject,
|
|
4934
|
+
args: [MECX_MODAL_CONFIRMATION_CONFIG]
|
|
4935
|
+
}] }, { type: MonkeyModalRef, decorators: [{
|
|
4936
|
+
type: Inject,
|
|
4937
|
+
args: [MonkeyModalRef]
|
|
4938
|
+
}] }] });
|
|
4554
4939
|
|
|
4555
4940
|
/** ************************
|
|
4556
4941
|
* Copyright Monkey Exchange. All Rights Reserved
|
|
4557
4942
|
* This style guide was developed by Monkey Exchange Team
|
|
4558
4943
|
* MIT Licence
|
|
4559
4944
|
************************* */
|
|
4945
|
+
class MonkeyModalModule {
|
|
4946
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: MonkeyModalModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
4947
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.2.13", ngImport: i0, type: MonkeyModalModule, declarations: [MonkeyModalComponent,
|
|
4948
|
+
MonkeyModalDefaultComponent,
|
|
4949
|
+
MonkeyModalConfirmationComponent,
|
|
4950
|
+
MonkeyModalTitleDirective,
|
|
4951
|
+
MonkeyModalSubtitleDirective,
|
|
4952
|
+
MonkeyModalContentDirective,
|
|
4953
|
+
MonkeyModalActionsDirective], imports: [CommonModule, MonkeyButtonComponent, MonkeyIconButtonComponent, MonkeyIconComponent], exports: [MonkeyModalComponent,
|
|
4954
|
+
MonkeyModalTitleDirective,
|
|
4955
|
+
MonkeyModalSubtitleDirective,
|
|
4956
|
+
MonkeyModalContentDirective,
|
|
4957
|
+
MonkeyModalActionsDirective] }); }
|
|
4958
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: MonkeyModalModule, imports: [CommonModule, MonkeyButtonComponent, MonkeyIconButtonComponent, MonkeyIconComponent] }); }
|
|
4959
|
+
}
|
|
4960
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: MonkeyModalModule, decorators: [{
|
|
4961
|
+
type: NgModule,
|
|
4962
|
+
args: [{
|
|
4963
|
+
imports: [CommonModule, MonkeyButtonComponent, MonkeyIconButtonComponent, MonkeyIconComponent],
|
|
4964
|
+
declarations: [
|
|
4965
|
+
MonkeyModalComponent,
|
|
4966
|
+
MonkeyModalDefaultComponent,
|
|
4967
|
+
MonkeyModalConfirmationComponent,
|
|
4968
|
+
MonkeyModalTitleDirective,
|
|
4969
|
+
MonkeyModalSubtitleDirective,
|
|
4970
|
+
MonkeyModalContentDirective,
|
|
4971
|
+
MonkeyModalActionsDirective
|
|
4972
|
+
],
|
|
4973
|
+
exports: [
|
|
4974
|
+
MonkeyModalComponent,
|
|
4975
|
+
MonkeyModalTitleDirective,
|
|
4976
|
+
MonkeyModalSubtitleDirective,
|
|
4977
|
+
MonkeyModalContentDirective,
|
|
4978
|
+
MonkeyModalActionsDirective
|
|
4979
|
+
]
|
|
4980
|
+
}]
|
|
4981
|
+
}] });
|
|
4560
4982
|
|
|
4561
4983
|
/** ************************
|
|
4562
4984
|
* Copyright Monkey Exchange. All Rights Reserved
|
|
4563
4985
|
* This style guide was developed by Monkey Exchange Team
|
|
4564
4986
|
* MIT Licence
|
|
4565
4987
|
************************* */
|
|
4566
|
-
class
|
|
4567
|
-
|
|
4568
|
-
|
|
4569
|
-
|
|
4988
|
+
class MonkeyModalService {
|
|
4989
|
+
constructor() {
|
|
4990
|
+
this._idGenerator = inject(IdGenerator);
|
|
4991
|
+
this._injector = inject(Injector);
|
|
4992
|
+
this._overlay = inject(Overlay);
|
|
4993
|
+
this._openDialogsAtThisLevel = [];
|
|
4994
|
+
this._parentDialog = inject(MonkeyModalService, { optional: true, skipSelf: true });
|
|
4995
|
+
}
|
|
4996
|
+
get openDialogs() {
|
|
4997
|
+
return this._parentDialog ? this._parentDialog.openDialogs : this._openDialogsAtThisLevel;
|
|
4998
|
+
}
|
|
4999
|
+
getOverlayConfig(config) {
|
|
5000
|
+
let positionStrategy;
|
|
5001
|
+
const marginStrategy = '20px';
|
|
5002
|
+
if (config.position === 'left-top') {
|
|
5003
|
+
positionStrategy = this._overlay.position().global().left(marginStrategy).top(marginStrategy);
|
|
4570
5004
|
}
|
|
4571
|
-
if (
|
|
4572
|
-
|
|
5005
|
+
else if (config.position === 'center-top') {
|
|
5006
|
+
positionStrategy = this._overlay.position().global().centerHorizontally().top(marginStrategy);
|
|
4573
5007
|
}
|
|
4574
|
-
if (
|
|
4575
|
-
|
|
5008
|
+
else if (config.position === 'right-top') {
|
|
5009
|
+
positionStrategy = this._overlay
|
|
5010
|
+
.position()
|
|
5011
|
+
.global()
|
|
5012
|
+
.right(marginStrategy)
|
|
5013
|
+
.top(marginStrategy);
|
|
4576
5014
|
}
|
|
4577
|
-
if (
|
|
4578
|
-
|
|
5015
|
+
else if (config.position === 'left-center') {
|
|
5016
|
+
positionStrategy = this._overlay.position().global().left(marginStrategy).centerVertically();
|
|
4579
5017
|
}
|
|
4580
|
-
|
|
5018
|
+
else if (config.position === 'center-center') {
|
|
5019
|
+
positionStrategy = this._overlay.position().global().centerHorizontally().centerVertically();
|
|
5020
|
+
}
|
|
5021
|
+
else if (config.position === 'right-center') {
|
|
5022
|
+
positionStrategy = this._overlay.position().global().right(marginStrategy).centerVertically();
|
|
5023
|
+
}
|
|
5024
|
+
else if (config.position === 'left-bottom') {
|
|
5025
|
+
positionStrategy = this._overlay
|
|
5026
|
+
.position()
|
|
5027
|
+
.global()
|
|
5028
|
+
.left(marginStrategy)
|
|
5029
|
+
.bottom(marginStrategy);
|
|
5030
|
+
}
|
|
5031
|
+
else if (config.position === 'center-bottom') {
|
|
5032
|
+
positionStrategy = this._overlay.position().global().centerHorizontally().bottom('20px');
|
|
5033
|
+
}
|
|
5034
|
+
else if (config.position === 'right-bottom') {
|
|
5035
|
+
positionStrategy = this._overlay
|
|
5036
|
+
.position()
|
|
5037
|
+
.global()
|
|
5038
|
+
.right(marginStrategy)
|
|
5039
|
+
.bottom(marginStrategy);
|
|
5040
|
+
}
|
|
5041
|
+
let panelClass = ['monkey-modal-panel'];
|
|
5042
|
+
if (config.fullscreen) {
|
|
5043
|
+
panelClass.push('monkey-modal-fullscreen');
|
|
5044
|
+
}
|
|
5045
|
+
if (Array.isArray(config.panelClass)) {
|
|
5046
|
+
panelClass = [...panelClass, ...config.panelClass];
|
|
5047
|
+
}
|
|
5048
|
+
else {
|
|
5049
|
+
panelClass.push(config.panelClass);
|
|
5050
|
+
}
|
|
5051
|
+
const state = new OverlayConfig({
|
|
5052
|
+
positionStrategy,
|
|
5053
|
+
scrollStrategy: this._overlay.scrollStrategies.block(),
|
|
5054
|
+
panelClass,
|
|
5055
|
+
hasBackdrop: config.hasBackdrop,
|
|
5056
|
+
maxWidth: config.maxWidth,
|
|
5057
|
+
maxHeight: config.maxHeight,
|
|
5058
|
+
disposeOnNavigation: config.closeOnNavigation
|
|
5059
|
+
});
|
|
5060
|
+
if (config.backdropClass) {
|
|
5061
|
+
state.backdropClass = config.backdropClass;
|
|
5062
|
+
}
|
|
5063
|
+
if (config.maxWidth) {
|
|
5064
|
+
state.width = '100%';
|
|
5065
|
+
}
|
|
5066
|
+
if (config.maxHeight) {
|
|
5067
|
+
state.height = '100%';
|
|
5068
|
+
}
|
|
5069
|
+
return state;
|
|
5070
|
+
}
|
|
5071
|
+
createInjector(config, dialogRef, overlayRef, fallbackInjector) {
|
|
5072
|
+
const providers = [
|
|
5073
|
+
{ provide: OverlayRef, useValue: overlayRef },
|
|
5074
|
+
{ provide: MonkeyModalRef, useValue: dialogRef },
|
|
5075
|
+
{ provide: MECX_MODAL_DATA, useValue: config.data }
|
|
5076
|
+
];
|
|
5077
|
+
if (config.providers) {
|
|
5078
|
+
providers.push(...config.providers);
|
|
5079
|
+
}
|
|
5080
|
+
return Injector.create({ parent: fallbackInjector, providers });
|
|
5081
|
+
}
|
|
5082
|
+
open(component, config) {
|
|
5083
|
+
const defaultConfig = new MonkeyModalConfig();
|
|
5084
|
+
config = { ...defaultConfig, ...config };
|
|
5085
|
+
config.id = this._idGenerator.getId('monkey-modal-');
|
|
5086
|
+
const overlayConfig = this.getOverlayConfig(config);
|
|
5087
|
+
const overlayRef = this._overlay.create(overlayConfig);
|
|
5088
|
+
const modalRef = new MonkeyModalRef(overlayRef, config);
|
|
5089
|
+
const injector = this.createInjector(config, modalRef, overlayRef, this._injector);
|
|
5090
|
+
const componentPortal = new ComponentPortal(component, null, injector);
|
|
5091
|
+
const componentRef = overlayRef.attach(componentPortal);
|
|
5092
|
+
const componentElement = componentRef.location.nativeElement;
|
|
5093
|
+
componentElement.style.width = '100%';
|
|
5094
|
+
componentElement.style.height = '100%';
|
|
5095
|
+
modalRef.componentElement = componentElement;
|
|
5096
|
+
modalRef.componentInstance = componentRef.instance;
|
|
5097
|
+
this.openDialogs.push(modalRef);
|
|
5098
|
+
return modalRef;
|
|
4581
5099
|
}
|
|
4582
|
-
|
|
4583
|
-
|
|
5100
|
+
openDefault(params, config) {
|
|
5101
|
+
config.providers = [{ provide: MECX_MODAL_DEFAULT_CONFIG, useValue: params }];
|
|
5102
|
+
config.icon = config.icon ? config.icon : 'help';
|
|
5103
|
+
return this.open(MonkeyModalDefaultComponent, config);
|
|
4584
5104
|
}
|
|
4585
|
-
|
|
4586
|
-
|
|
5105
|
+
openConfirmation(params, config) {
|
|
5106
|
+
config.providers = [{ provide: MECX_MODAL_CONFIRMATION_CONFIG, useValue: params }];
|
|
5107
|
+
return this.open(MonkeyModalConfirmationComponent, config);
|
|
4587
5108
|
}
|
|
4588
|
-
|
|
4589
|
-
this.
|
|
4590
|
-
|
|
4591
|
-
|
|
4592
|
-
this.
|
|
4593
|
-
// eslint-disable-next-line no-self-assign
|
|
4594
|
-
this.id = this.id;
|
|
5109
|
+
closeAll() {
|
|
5110
|
+
reverseForEach(this.openDialogs, (dialog) => {
|
|
5111
|
+
return dialog.close();
|
|
5112
|
+
});
|
|
5113
|
+
this.openDialogs.splice(0, this.openDialogs.length);
|
|
4595
5114
|
}
|
|
4596
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type:
|
|
4597
|
-
static { this.ɵ
|
|
5115
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: MonkeyModalService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
5116
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: MonkeyModalService, providedIn: 'root' }); }
|
|
4598
5117
|
}
|
|
4599
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type:
|
|
4600
|
-
type:
|
|
4601
|
-
args: [{
|
|
4602
|
-
|
|
4603
|
-
'[attr.id]': 'id',
|
|
4604
|
-
'[id]': 'id'
|
|
4605
|
-
}, template: "<div class=\"body\">\n <div>\n <span data-testid=\"label\" *ngIf=\"label() as lb\">\n {{ lb }}\n </span>\n <span data-testid=\"str-label\" class=\"level-info\" *ngIf=\"strengthLabel() as strLabel\">\n {{ strLabel }}\n </span>\n </div>\n <div class=\"bar\"></div>\n</div>\n", styles: ["monkey-security-level{display:flex;align-items:center;gap:8px;width:100%}monkey-security-level span{color:var(--mecx-color-gray-700);font-size:14px;font-style:normal;font-weight:400;line-height:24px;letter-spacing:.42px}monkey-security-level .level-info{color:var(--mecx-color-gray-900);margin-left:24px;font-size:14px;font-style:normal;font-weight:400;line-height:24px;letter-spacing:.42px}monkey-security-level .body{display:flex;flex-direction:column;align-items:baseline;width:100%}monkey-security-level .bar{height:4px;width:100%;max-width:426px;border-radius:8px;background:var(--mecx-color-gray-300);position:relative;overflow:hidden}monkey-security-level .bar:before{content:\"\";display:block;position:absolute;height:100%;left:0;top:0;transition:all 1s}monkey-security-level.very-strong .bar:before{background:var(--mecx-color-success-main);width:100%}monkey-security-level.strong .bar:before{background:var(--mecx-color-success-main);width:80%}monkey-security-level.medium .bar:before{background:var(--mecx-color-warning-main);width:66%}monkey-security-level.weak .bar:before{background:var(--mecx-color-error-700);width:33%}monkey-security-level.empty .bar:before{background:var(--mecx-color-error-700);width:0%}\n"] }]
|
|
4606
|
-
}], ctorParameters: () => [], propDecorators: { class: [{
|
|
4607
|
-
type: HostBinding,
|
|
4608
|
-
args: ['class']
|
|
4609
|
-
}], id: [{
|
|
4610
|
-
type: Input
|
|
4611
|
-
}] } });
|
|
5118
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: MonkeyModalService, decorators: [{
|
|
5119
|
+
type: Injectable,
|
|
5120
|
+
args: [{ providedIn: 'root' }]
|
|
5121
|
+
}] });
|
|
4612
5122
|
|
|
4613
5123
|
/** ************************
|
|
4614
5124
|
* Copyright Monkey Exchange. All Rights Reserved
|
|
@@ -4621,7 +5131,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
|
|
|
4621
5131
|
* This style guide was developed by Monkey Exchange Team
|
|
4622
5132
|
* MIT Licence
|
|
4623
5133
|
************************* */
|
|
4624
|
-
class
|
|
5134
|
+
class MonkeyRadioButtonComponent {
|
|
5135
|
+
get classes() {
|
|
5136
|
+
return `${this.position} ${this.size}`;
|
|
5137
|
+
}
|
|
4625
5138
|
get disabled() {
|
|
4626
5139
|
if (this.ngControl && this.ngControl.disabled !== null) {
|
|
4627
5140
|
return this.ngControl.disabled;
|
|
@@ -4643,246 +5156,69 @@ class MonkeySelectComponent {
|
|
|
4643
5156
|
this.stateChanges.next();
|
|
4644
5157
|
}
|
|
4645
5158
|
set value(value) {
|
|
4646
|
-
if (this._value !== value) {
|
|
4647
|
-
this._value = value;
|
|
4648
|
-
this._onChange(value);
|
|
4649
|
-
}
|
|
4650
|
-
}
|
|
4651
|
-
get value() {
|
|
4652
|
-
return this._value;
|
|
4653
|
-
}
|
|
4654
|
-
constructor(overlay, changeDetectorRef, viewContainerRef, formField) {
|
|
4655
|
-
this.overlay = overlay;
|
|
4656
|
-
this.changeDetectorRef = changeDetectorRef;
|
|
4657
|
-
this.viewContainerRef = viewContainerRef;
|
|
4658
|
-
this.formField = formField;
|
|
4659
|
-
this.tabIndex = 0;
|
|
4660
|
-
this.onChange = new EventEmitter();
|
|
4661
|
-
this.onSearch = new EventEmitter();
|
|
4662
|
-
this.placeholder = '';
|
|
4663
|
-
this.loading = false;
|
|
4664
|
-
this.showSearch = true;
|
|
4665
|
-
this.searchPlaceholder = '';
|
|
4666
|
-
this.callbackSearch = false;
|
|
4667
|
-
this._value = null;
|
|
4668
|
-
this.labelSelected = '';
|
|
4669
|
-
this.overlayRef = null;
|
|
4670
|
-
this._destroyRef = inject(DestroyRef);
|
|
4671
|
-
this.idGenerator = inject(IdGenerator);
|
|
4672
|
-
this.ngControl = inject(NgControl, { self: true, optional: true });
|
|
4673
|
-
this._elementRef = inject(ElementRef);
|
|
4674
|
-
this.currency = false;
|
|
4675
|
-
this.focused = false;
|
|
4676
|
-
this._disabled = false;
|
|
4677
|
-
this.id = this.idGenerator.getId('monkey-select-');
|
|
4678
|
-
this.percent = false;
|
|
4679
|
-
this.stateChanges = new Subject();
|
|
4680
|
-
this.type = '';
|
|
4681
|
-
this.searchHandle = new EventEmitter();
|
|
4682
|
-
this.searchDictionary = inject(MonkeyDictionaryService).get('NO-DATA');
|
|
4683
|
-
this.loadingDictionary = inject(MonkeyDictionaryService).get('LOADING');
|
|
4684
|
-
this.showSearchNoData = false;
|
|
4685
|
-
this.isOpen = false;
|
|
4686
|
-
this.searchData = '';
|
|
4687
|
-
this.onAnimationEnd = (event) => {
|
|
4688
|
-
if (event.toState === 'closed') {
|
|
4689
|
-
this.closeOverlay();
|
|
4690
|
-
}
|
|
4691
|
-
};
|
|
4692
|
-
this._onChange = () => { };
|
|
4693
|
-
this._onTouched = () => { };
|
|
4694
|
-
if (this.ngControl) {
|
|
4695
|
-
this.ngControl.valueAccessor = this;
|
|
4696
|
-
}
|
|
4697
|
-
}
|
|
4698
|
-
changeControl() {
|
|
4699
|
-
if (this.formField?.control) {
|
|
4700
|
-
this.formField.control.loading = this.loading;
|
|
4701
|
-
}
|
|
4702
|
-
}
|
|
4703
|
-
changeSelected() {
|
|
4704
|
-
setTimeout(() => {
|
|
4705
|
-
if (this.options) {
|
|
4706
|
-
this.options.forEach((opt) => {
|
|
4707
|
-
opt.selected = opt.value === this.value;
|
|
4708
|
-
});
|
|
4709
|
-
this.updateSelectedLabel();
|
|
4710
|
-
}
|
|
4711
|
-
this.changeDetectorRef.markForCheck();
|
|
4712
|
-
});
|
|
4713
|
-
}
|
|
4714
|
-
initializeOptions() {
|
|
4715
|
-
this.options.forEach((option) => {
|
|
4716
|
-
if (!option.action) {
|
|
4717
|
-
option.action = this.selectOption.bind(this, option);
|
|
4718
|
-
}
|
|
4719
|
-
});
|
|
4720
|
-
}
|
|
4721
|
-
openDropdown() {
|
|
4722
|
-
if (this.options?.length) {
|
|
4723
|
-
this.formField.control.disableToBeDirty = true;
|
|
4724
|
-
this.isOpen = true;
|
|
4725
|
-
this.createOverlay();
|
|
4726
|
-
}
|
|
4727
|
-
}
|
|
4728
|
-
closeDropdown() {
|
|
4729
|
-
this.changeDetectorRef.markForCheck();
|
|
4730
|
-
this.isOpen = false;
|
|
4731
|
-
this.focused = false;
|
|
4732
|
-
this.formField.control.disableToBeDirty = false;
|
|
4733
|
-
if (!this.callbackSearch) {
|
|
4734
|
-
this.searchData = '';
|
|
4735
|
-
}
|
|
4736
|
-
}
|
|
4737
|
-
closeOverlay() {
|
|
4738
|
-
if (this.overlayRef) {
|
|
4739
|
-
this.overlayRef.dispose();
|
|
4740
|
-
this.overlayRef = null;
|
|
4741
|
-
}
|
|
4742
|
-
}
|
|
4743
|
-
initializeWithOverlay() {
|
|
4744
|
-
if (this.showSearch) {
|
|
4745
|
-
const element = this.overlayRef?.overlayElement.querySelector(`#${this.id}-search`);
|
|
4746
|
-
this.options.forEach((opt) => {
|
|
4747
|
-
const element = this.overlayRef?.overlayElement.querySelector(`#${opt.id}`);
|
|
4748
|
-
if (!element)
|
|
4749
|
-
return;
|
|
4750
|
-
element.style.display = '';
|
|
4751
|
-
});
|
|
4752
|
-
setTimeout(() => {
|
|
4753
|
-
element?.focus();
|
|
4754
|
-
}, 0);
|
|
4755
|
-
this.showSearchNoData = false;
|
|
4756
|
-
}
|
|
4757
|
-
setTimeout(() => {
|
|
4758
|
-
const selected = this.options.find((opt) => {
|
|
4759
|
-
return opt.selected;
|
|
4760
|
-
});
|
|
4761
|
-
if (selected) {
|
|
4762
|
-
const element = this.overlayRef?.overlayElement.querySelector(`#${selected.id}`);
|
|
4763
|
-
element?.scrollIntoView({ behavior: 'instant', block: 'center' });
|
|
4764
|
-
}
|
|
4765
|
-
}, 0);
|
|
4766
|
-
}
|
|
4767
|
-
createOverlay() {
|
|
4768
|
-
if (this.overlayRef) {
|
|
4769
|
-
return;
|
|
4770
|
-
}
|
|
4771
|
-
const offset = 4;
|
|
4772
|
-
const positions = [
|
|
4773
|
-
{
|
|
4774
|
-
originX: 'start',
|
|
4775
|
-
originY: 'bottom',
|
|
4776
|
-
overlayX: 'start',
|
|
4777
|
-
overlayY: 'top',
|
|
4778
|
-
offsetY: offset
|
|
4779
|
-
},
|
|
4780
|
-
{
|
|
4781
|
-
originX: 'start',
|
|
4782
|
-
originY: 'top',
|
|
4783
|
-
overlayX: 'start',
|
|
4784
|
-
overlayY: 'bottom',
|
|
4785
|
-
offsetY: -offset
|
|
4786
|
-
}
|
|
4787
|
-
];
|
|
4788
|
-
let anchor = this.trigger;
|
|
4789
|
-
let width = anchor.nativeElement.offsetWidth;
|
|
4790
|
-
if (this.formField?.elementRef) {
|
|
4791
|
-
const el = this.formField?.elementRef.nativeElement.querySelector('.mecx-form-field-body');
|
|
4792
|
-
anchor = el;
|
|
4793
|
-
width = el.offsetWidth;
|
|
4794
|
-
}
|
|
4795
|
-
const positionStrategy = this.overlay
|
|
4796
|
-
.position()
|
|
4797
|
-
.flexibleConnectedTo(anchor)
|
|
4798
|
-
.withPositions(positions)
|
|
4799
|
-
.withPush(true);
|
|
4800
|
-
this.overlayRef = this.overlay.create({
|
|
4801
|
-
positionStrategy,
|
|
4802
|
-
scrollStrategy: this.overlay.scrollStrategies.block(),
|
|
4803
|
-
width,
|
|
4804
|
-
hasBackdrop: true,
|
|
4805
|
-
backdropClass: 'no-class'
|
|
4806
|
-
});
|
|
4807
|
-
const portal = new TemplatePortal(this.overlayTemplate, this.viewContainerRef);
|
|
4808
|
-
this.overlayRef.attach(portal);
|
|
4809
|
-
this.overlayRef
|
|
4810
|
-
.backdropClick()
|
|
4811
|
-
.pipe(takeUntilDestroyed(this._destroyRef))
|
|
4812
|
-
.subscribe(() => {
|
|
4813
|
-
return this.closeDropdown();
|
|
4814
|
-
});
|
|
4815
|
-
this.initializeWithOverlay();
|
|
4816
|
-
}
|
|
4817
|
-
updateSelectedLabel() {
|
|
4818
|
-
const selectedOption = this.options.find((opt) => {
|
|
4819
|
-
return opt.value === this.value;
|
|
4820
|
-
});
|
|
4821
|
-
this.labelSelected = selectedOption ? selectedOption.displayContent : '';
|
|
4822
|
-
}
|
|
4823
|
-
executeSearch(search) {
|
|
4824
|
-
let found = false;
|
|
4825
|
-
this.options.forEach((opt) => {
|
|
4826
|
-
const element = this.overlayRef?.overlayElement.querySelector(`#${opt.id}`);
|
|
4827
|
-
if (!element)
|
|
4828
|
-
return;
|
|
4829
|
-
const isMatch = normalizeStringToSearch(opt.displayContent).includes(normalizeStringToSearch(search));
|
|
4830
|
-
if (isMatch) {
|
|
4831
|
-
found = true;
|
|
4832
|
-
}
|
|
4833
|
-
element.style.display = isMatch ? '' : 'none';
|
|
4834
|
-
});
|
|
4835
|
-
this.repositionScroll();
|
|
4836
|
-
this.showSearchNoData = !found;
|
|
5159
|
+
if (this._value !== value) {
|
|
5160
|
+
this._value = value;
|
|
5161
|
+
this._onChange(value);
|
|
5162
|
+
}
|
|
4837
5163
|
}
|
|
4838
|
-
|
|
4839
|
-
|
|
4840
|
-
|
|
4841
|
-
|
|
5164
|
+
get value() {
|
|
5165
|
+
return this._value;
|
|
5166
|
+
}
|
|
5167
|
+
constructor(changeDetectorRef, formField) {
|
|
5168
|
+
this.changeDetectorRef = changeDetectorRef;
|
|
5169
|
+
this.formField = formField;
|
|
5170
|
+
this.tabIndex = 0;
|
|
5171
|
+
this.onChange = new EventEmitter();
|
|
5172
|
+
this.onSearch = new EventEmitter();
|
|
5173
|
+
this.position = 'horizontal';
|
|
5174
|
+
this.size = 'lg';
|
|
5175
|
+
this._value = null;
|
|
5176
|
+
this._destroyRef = inject(DestroyRef);
|
|
5177
|
+
this.idGenerator = inject(IdGenerator);
|
|
5178
|
+
this.ngControl = inject(NgControl, { self: true, optional: true });
|
|
5179
|
+
this._elementRef = inject(ElementRef);
|
|
5180
|
+
this.focused = false;
|
|
5181
|
+
this._disabled = false;
|
|
5182
|
+
this.id = this.idGenerator.getId('monkey-radiobutton-');
|
|
5183
|
+
this.stateChanges = new Subject();
|
|
5184
|
+
this.type = 'radio-button';
|
|
5185
|
+
this._onChange = () => { };
|
|
5186
|
+
this._onTouched = () => { };
|
|
5187
|
+
if (this.ngControl) {
|
|
5188
|
+
this.ngControl.valueAccessor = this;
|
|
4842
5189
|
}
|
|
4843
5190
|
}
|
|
4844
|
-
|
|
4845
|
-
|
|
4846
|
-
|
|
4847
|
-
|
|
4848
|
-
|
|
4849
|
-
|
|
4850
|
-
this.repositionScroll();
|
|
4851
|
-
}
|
|
4852
|
-
else {
|
|
4853
|
-
this.executeSearch(search);
|
|
5191
|
+
changeSelected() {
|
|
5192
|
+
setTimeout(() => {
|
|
5193
|
+
if (this.options) {
|
|
5194
|
+
this.options.forEach((opt) => {
|
|
5195
|
+
opt.selected = opt.value === this.value;
|
|
5196
|
+
});
|
|
4854
5197
|
}
|
|
5198
|
+
this.changeDetectorRef.markForCheck();
|
|
4855
5199
|
});
|
|
4856
5200
|
}
|
|
5201
|
+
initializeOptions() {
|
|
5202
|
+
setTimeout(() => {
|
|
5203
|
+
this.options?.forEach((option) => {
|
|
5204
|
+
option.type = 'radio';
|
|
5205
|
+
if (!option.action) {
|
|
5206
|
+
option.action = this.selectOption.bind(this, option);
|
|
5207
|
+
}
|
|
5208
|
+
});
|
|
5209
|
+
this.changeDetectorRef.markForCheck();
|
|
5210
|
+
}, 0);
|
|
5211
|
+
}
|
|
4857
5212
|
ngAfterContentInit() {
|
|
4858
5213
|
this.initializeOptions();
|
|
4859
|
-
this.options.changes.pipe(takeUntilDestroyed(this._destroyRef)).subscribe((
|
|
4860
|
-
this.updateSelectedLabel();
|
|
5214
|
+
this.options.changes.pipe(takeUntilDestroyed(this._destroyRef)).subscribe(() => {
|
|
4861
5215
|
this.initializeOptions();
|
|
4862
5216
|
this.changeSelected();
|
|
4863
5217
|
});
|
|
4864
5218
|
}
|
|
4865
|
-
ngOnDestroy() {
|
|
4866
|
-
if (this.overlayRef) {
|
|
4867
|
-
this.overlayRef.dispose();
|
|
4868
|
-
}
|
|
4869
|
-
}
|
|
4870
|
-
toggleDropdown() {
|
|
4871
|
-
if (!this.disabled) {
|
|
4872
|
-
if (this.isOpen) {
|
|
4873
|
-
this.closeDropdown();
|
|
4874
|
-
this._onTouched();
|
|
4875
|
-
}
|
|
4876
|
-
else {
|
|
4877
|
-
this.openDropdown();
|
|
4878
|
-
}
|
|
4879
|
-
}
|
|
4880
|
-
}
|
|
4881
5219
|
selectOption(option) {
|
|
4882
5220
|
if (!option.disabled && !this.disabled) {
|
|
4883
5221
|
this.value = option.value;
|
|
4884
|
-
this.updateSelectedLabel();
|
|
4885
|
-
this.closeDropdown();
|
|
4886
5222
|
this._onChange(this.value);
|
|
4887
5223
|
this.onChange.emit(this.value);
|
|
4888
5224
|
this.options.forEach((opt) => {
|
|
@@ -4897,7 +5233,6 @@ class MonkeySelectComponent {
|
|
|
4897
5233
|
onContainerClick(event) {
|
|
4898
5234
|
if (this.disabled)
|
|
4899
5235
|
return;
|
|
4900
|
-
this.openDropdown();
|
|
4901
5236
|
this._elementRef.nativeElement.focus();
|
|
4902
5237
|
}
|
|
4903
5238
|
_onFocus() {
|
|
@@ -4919,98 +5254,32 @@ class MonkeySelectComponent {
|
|
|
4919
5254
|
}
|
|
4920
5255
|
setDisabledState(isDisabled) {
|
|
4921
5256
|
this.disabled = isDisabled;
|
|
5257
|
+
this.initializeOptions();
|
|
4922
5258
|
}
|
|
4923
|
-
|
|
4924
|
-
|
|
4925
|
-
// eslint-disable-next-line dot-notation
|
|
4926
|
-
const changesLoading = changes?.['loading'];
|
|
4927
|
-
if (changesLoading?.currentValue !== changesLoading?.previousValue) {
|
|
4928
|
-
hasChanges = true;
|
|
4929
|
-
this.changeControl();
|
|
4930
|
-
}
|
|
4931
|
-
if (hasChanges) {
|
|
4932
|
-
this.stateChanges.next();
|
|
4933
|
-
}
|
|
4934
|
-
}
|
|
4935
|
-
onHandleSearch(event) {
|
|
4936
|
-
try {
|
|
4937
|
-
const { value } = event.target;
|
|
4938
|
-
const handled = sanitizeString(value);
|
|
4939
|
-
this.searchHandle.next(handled || '');
|
|
4940
|
-
}
|
|
4941
|
-
catch (e) {
|
|
4942
|
-
// not to do
|
|
4943
|
-
}
|
|
4944
|
-
}
|
|
4945
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: MonkeySelectComponent, deps: [{ token: i1$1.Overlay }, { token: i0.ChangeDetectorRef }, { token: i0.ViewContainerRef }, { token: MonkeyFormFieldComponent, optional: true }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
4946
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.13", type: MonkeySelectComponent, isStandalone: true, selector: "monkey-select", inputs: { tabIndex: "tabIndex", placeholder: "placeholder", loading: ["loading", "loading", booleanAttribute], showSearch: ["showSearch", "showSearch", booleanAttribute], searchPlaceholder: "searchPlaceholder", callbackSearch: ["callbackSearch", "callbackSearch", booleanAttribute], disabled: ["disabled", "disabled", booleanAttribute], required: ["required", "required", booleanAttribute], value: "value" }, outputs: { onChange: "onChange", onSearch: "onSearch" }, host: { attributes: { "data-testid": "monkey-select" }, listeners: { "focus": "_onFocus()", "blur": "_onBlur()" }, properties: { "class.mecx-select-disabled": "_disabled", "class.mecx-select-focused": "focused", "attr.id": "id", "attr.tabindex": "disabled ? -1 : tabIndex" }, classAttribute: "mecx-select" }, providers: [
|
|
5259
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: MonkeyRadioButtonComponent, deps: [{ token: i0.ChangeDetectorRef }, { token: MonkeyFormFieldComponent, optional: true }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
5260
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "16.1.0", version: "18.2.13", type: MonkeyRadioButtonComponent, isStandalone: true, selector: "monkey-radiobutton", inputs: { tabIndex: "tabIndex", position: "position", size: "size", disabled: ["disabled", "disabled", booleanAttribute], required: ["required", "required", booleanAttribute], value: "value" }, outputs: { onChange: "onChange", onSearch: "onSearch" }, host: { attributes: { "data-testid": "monkey-radiobutton" }, listeners: { "focus": "_onFocus()", "blur": "_onBlur()" }, properties: { "class.mecx-disabled": "disabled", "class.mecx-radiobutton-focused": "focused", "attr.id": "id", "attr.tabindex": "disabled ? -1 : tabIndex", "class": "this.classes" }, classAttribute: "mecx-radiobutton" }, providers: [
|
|
4947
5261
|
// eslint-disable-next-line no-use-before-define
|
|
4948
|
-
{ provide: MonkeyFormFieldControl, useExisting:
|
|
4949
|
-
], queries: [{ propertyName: "options", predicate: MonkeyOptionComponent }],
|
|
4950
|
-
trigger('animation', [
|
|
4951
|
-
transition(':enter', [
|
|
4952
|
-
style({
|
|
4953
|
-
opacity: 0,
|
|
4954
|
-
transform: 'scaleY(.9)'
|
|
4955
|
-
}),
|
|
4956
|
-
animate('100ms ease-in-out', style({
|
|
4957
|
-
opacity: 1,
|
|
4958
|
-
transform: 'scaleY(1)'
|
|
4959
|
-
}))
|
|
4960
|
-
]),
|
|
4961
|
-
state('closed', style({
|
|
4962
|
-
transform: 'scaleY(.9)',
|
|
4963
|
-
opacity: 0
|
|
4964
|
-
})),
|
|
4965
|
-
transition('closed <=> open', animate('200ms ease-in-out'))
|
|
4966
|
-
])
|
|
4967
|
-
], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
5262
|
+
{ provide: MonkeyFormFieldControl, useExisting: MonkeyRadioButtonComponent }
|
|
5263
|
+
], queries: [{ propertyName: "options", predicate: MonkeyOptionComponent }], ngImport: i0, template: "<ng-content />\n", styles: ["monkey-radiobutton{display:inline-flex;width:100%;min-width:0;position:relative;flex-wrap:wrap}monkey-radiobutton:focus-visible,monkey-radiobutton:focus{outline:none}monkey-radiobutton.vertical{flex-direction:column}monkey-radiobutton.mecx-disabled monkey-option{opacity:.5;pointer-events:none}monkey-radiobutton.mecx-disabled monkey-option:before{background:var(--mecx-color-white);border-color:var(--mecx-color-gray-400)}monkey-radiobutton.mecx-form-field-invalid{background:var(--mecx-color-error-700)}monkey-radiobutton.md monkey-option:before{width:16px;height:16px}monkey-radiobutton.sm monkey-option:before{width:14px;height:14px}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "ngmodule", type: FormsModule }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
4968
5264
|
}
|
|
4969
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type:
|
|
5265
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: MonkeyRadioButtonComponent, decorators: [{
|
|
4970
5266
|
type: Component,
|
|
4971
|
-
args: [{ selector: 'monkey-
|
|
5267
|
+
args: [{ selector: 'monkey-radiobutton', standalone: true, imports: [CommonModule, ReactiveFormsModule, FormsModule, UtilIconComponent], changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, providers: [
|
|
4972
5268
|
// eslint-disable-next-line no-use-before-define
|
|
4973
|
-
{ provide: MonkeyFormFieldControl, useExisting:
|
|
4974
|
-
], animations: [
|
|
4975
|
-
trigger('animation', [
|
|
4976
|
-
transition(':enter', [
|
|
4977
|
-
style({
|
|
4978
|
-
opacity: 0,
|
|
4979
|
-
transform: 'scaleY(.9)'
|
|
4980
|
-
}),
|
|
4981
|
-
animate('100ms ease-in-out', style({
|
|
4982
|
-
opacity: 1,
|
|
4983
|
-
transform: 'scaleY(1)'
|
|
4984
|
-
}))
|
|
4985
|
-
]),
|
|
4986
|
-
state('closed', style({
|
|
4987
|
-
transform: 'scaleY(.9)',
|
|
4988
|
-
opacity: 0
|
|
4989
|
-
})),
|
|
4990
|
-
transition('closed <=> open', animate('200ms ease-in-out'))
|
|
4991
|
-
])
|
|
5269
|
+
{ provide: MonkeyFormFieldControl, useExisting: MonkeyRadioButtonComponent }
|
|
4992
5270
|
], host: {
|
|
4993
|
-
'data-testid': 'monkey-
|
|
4994
|
-
class: 'mecx-
|
|
4995
|
-
'[class.mecx-
|
|
4996
|
-
'[class.mecx-
|
|
5271
|
+
'data-testid': 'monkey-radiobutton',
|
|
5272
|
+
class: 'mecx-radiobutton',
|
|
5273
|
+
'[class.mecx-disabled]': 'disabled',
|
|
5274
|
+
'[class.mecx-radiobutton-focused]': 'focused',
|
|
4997
5275
|
'[attr.id]': 'id',
|
|
4998
5276
|
'[attr.tabindex]': 'disabled ? -1 : tabIndex',
|
|
4999
5277
|
'(focus)': '_onFocus()',
|
|
5000
5278
|
'(blur)': '_onBlur()'
|
|
5001
|
-
}, template: "<
|
|
5002
|
-
}], ctorParameters: () => [{ type:
|
|
5279
|
+
}, template: "<ng-content />\n", styles: ["monkey-radiobutton{display:inline-flex;width:100%;min-width:0;position:relative;flex-wrap:wrap}monkey-radiobutton:focus-visible,monkey-radiobutton:focus{outline:none}monkey-radiobutton.vertical{flex-direction:column}monkey-radiobutton.mecx-disabled monkey-option{opacity:.5;pointer-events:none}monkey-radiobutton.mecx-disabled monkey-option:before{background:var(--mecx-color-white);border-color:var(--mecx-color-gray-400)}monkey-radiobutton.mecx-form-field-invalid{background:var(--mecx-color-error-700)}monkey-radiobutton.md monkey-option:before{width:16px;height:16px}monkey-radiobutton.sm monkey-option:before{width:14px;height:14px}\n"] }]
|
|
5280
|
+
}], ctorParameters: () => [{ type: i0.ChangeDetectorRef }, { type: MonkeyFormFieldComponent, decorators: [{
|
|
5003
5281
|
type: Optional
|
|
5004
|
-
}] }], propDecorators: {
|
|
5005
|
-
type: ViewChild,
|
|
5006
|
-
args: ['overlayTemplate']
|
|
5007
|
-
}], overlayEl: [{
|
|
5008
|
-
type: ViewChild,
|
|
5009
|
-
args: ['overlay']
|
|
5010
|
-
}], trigger: [{
|
|
5011
|
-
type: ViewChild,
|
|
5012
|
-
args: ['trigger']
|
|
5013
|
-
}], options: [{
|
|
5282
|
+
}] }], propDecorators: { options: [{
|
|
5014
5283
|
type: ContentChildren,
|
|
5015
5284
|
args: [MonkeyOptionComponent]
|
|
5016
5285
|
}], tabIndex: [{
|
|
@@ -5019,20 +5288,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
|
|
|
5019
5288
|
type: Output
|
|
5020
5289
|
}], onSearch: [{
|
|
5021
5290
|
type: Output
|
|
5022
|
-
}],
|
|
5023
|
-
type: Input,
|
|
5024
|
-
args: [{ required: true }]
|
|
5025
|
-
}], loading: [{
|
|
5026
|
-
type: Input,
|
|
5027
|
-
args: [{ transform: booleanAttribute }]
|
|
5028
|
-
}], showSearch: [{
|
|
5029
|
-
type: Input,
|
|
5030
|
-
args: [{ transform: booleanAttribute }]
|
|
5031
|
-
}], searchPlaceholder: [{
|
|
5291
|
+
}], position: [{
|
|
5032
5292
|
type: Input
|
|
5033
|
-
}],
|
|
5034
|
-
type: Input
|
|
5035
|
-
|
|
5293
|
+
}], size: [{
|
|
5294
|
+
type: Input
|
|
5295
|
+
}], classes: [{
|
|
5296
|
+
type: HostBinding,
|
|
5297
|
+
args: ['class']
|
|
5036
5298
|
}], disabled: [{
|
|
5037
5299
|
type: Input,
|
|
5038
5300
|
args: [{ transform: booleanAttribute }]
|
|
@@ -5049,6 +5311,64 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
|
|
|
5049
5311
|
* MIT Licence
|
|
5050
5312
|
************************* */
|
|
5051
5313
|
|
|
5314
|
+
/** ************************
|
|
5315
|
+
* Copyright Monkey Exchange. All Rights Reserved
|
|
5316
|
+
* This style guide was developed by Monkey Exchange Team
|
|
5317
|
+
* MIT Licence
|
|
5318
|
+
************************* */
|
|
5319
|
+
class MonkeySecurityLevelComponent {
|
|
5320
|
+
get class() {
|
|
5321
|
+
if (this.score() === 0) {
|
|
5322
|
+
return 'empty';
|
|
5323
|
+
}
|
|
5324
|
+
if (this.score() < 300) {
|
|
5325
|
+
return 'weak';
|
|
5326
|
+
}
|
|
5327
|
+
if (this.score() >= 300 && this.score() < 800) {
|
|
5328
|
+
return 'medium';
|
|
5329
|
+
}
|
|
5330
|
+
if (this.score() >= 800 && this.score() < 1000) {
|
|
5331
|
+
return 'strong';
|
|
5332
|
+
}
|
|
5333
|
+
return 'very-strong';
|
|
5334
|
+
}
|
|
5335
|
+
get id() {
|
|
5336
|
+
return this._id;
|
|
5337
|
+
}
|
|
5338
|
+
set id(value) {
|
|
5339
|
+
this._id = value || this._uid;
|
|
5340
|
+
}
|
|
5341
|
+
constructor() {
|
|
5342
|
+
this.label = input();
|
|
5343
|
+
this.score = input.required();
|
|
5344
|
+
this.strengthLabel = input();
|
|
5345
|
+
this._uid = inject(IdGenerator).getId('monkey-security-level-');
|
|
5346
|
+
// eslint-disable-next-line no-self-assign
|
|
5347
|
+
this.id = this.id;
|
|
5348
|
+
}
|
|
5349
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: MonkeySecurityLevelComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
5350
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "18.2.13", type: MonkeySecurityLevelComponent, isStandalone: true, selector: "monkey-security-level", inputs: { label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, score: { classPropertyName: "score", publicName: "score", isSignal: true, isRequired: true, transformFunction: null }, strengthLabel: { classPropertyName: "strengthLabel", publicName: "strengthLabel", isSignal: true, isRequired: false, transformFunction: null }, id: { classPropertyName: "id", publicName: "id", isSignal: false, isRequired: false, transformFunction: null } }, host: { attributes: { "data-testid": "monkey-security-level" }, properties: { "attr.id": "id", "id": "id", "class": "this.class" } }, ngImport: i0, template: "<div class=\"body\">\n <div>\n <span data-testid=\"label\" *ngIf=\"label() as lb\">\n {{ lb }}\n </span>\n <span data-testid=\"str-label\" class=\"level-info\" *ngIf=\"strengthLabel() as strLabel\">\n {{ strLabel }}\n </span>\n </div>\n <div class=\"bar\"></div>\n</div>\n", styles: ["monkey-security-level{display:flex;align-items:center;gap:8px;width:100%}monkey-security-level span{color:var(--mecx-color-gray-700);font-size:14px;font-style:normal;font-weight:400;line-height:24px;letter-spacing:.42px}monkey-security-level .level-info{color:var(--mecx-color-gray-900);margin-left:24px;font-size:14px;font-style:normal;font-weight:400;line-height:24px;letter-spacing:.42px}monkey-security-level .body{display:flex;flex-direction:column;align-items:baseline;width:100%}monkey-security-level .bar{height:4px;width:100%;max-width:426px;border-radius:8px;background:var(--mecx-color-gray-300);position:relative;overflow:hidden}monkey-security-level .bar:before{content:\"\";display:block;position:absolute;height:100%;left:0;top:0;transition:all 1s}monkey-security-level.very-strong .bar:before{background:var(--mecx-color-success-main);width:100%}monkey-security-level.strong .bar:before{background:var(--mecx-color-success-main);width:80%}monkey-security-level.medium .bar:before{background:var(--mecx-color-warning-main);width:66%}monkey-security-level.weak .bar:before{background:var(--mecx-color-error-700);width:33%}monkey-security-level.empty .bar:before{background:var(--mecx-color-error-700);width:0%}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], encapsulation: i0.ViewEncapsulation.None }); }
|
|
5351
|
+
}
|
|
5352
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: MonkeySecurityLevelComponent, decorators: [{
|
|
5353
|
+
type: Component,
|
|
5354
|
+
args: [{ encapsulation: ViewEncapsulation.None, imports: [CommonModule], selector: 'monkey-security-level', standalone: true, host: {
|
|
5355
|
+
'data-testid': 'monkey-security-level',
|
|
5356
|
+
'[attr.id]': 'id',
|
|
5357
|
+
'[id]': 'id'
|
|
5358
|
+
}, template: "<div class=\"body\">\n <div>\n <span data-testid=\"label\" *ngIf=\"label() as lb\">\n {{ lb }}\n </span>\n <span data-testid=\"str-label\" class=\"level-info\" *ngIf=\"strengthLabel() as strLabel\">\n {{ strLabel }}\n </span>\n </div>\n <div class=\"bar\"></div>\n</div>\n", styles: ["monkey-security-level{display:flex;align-items:center;gap:8px;width:100%}monkey-security-level span{color:var(--mecx-color-gray-700);font-size:14px;font-style:normal;font-weight:400;line-height:24px;letter-spacing:.42px}monkey-security-level .level-info{color:var(--mecx-color-gray-900);margin-left:24px;font-size:14px;font-style:normal;font-weight:400;line-height:24px;letter-spacing:.42px}monkey-security-level .body{display:flex;flex-direction:column;align-items:baseline;width:100%}monkey-security-level .bar{height:4px;width:100%;max-width:426px;border-radius:8px;background:var(--mecx-color-gray-300);position:relative;overflow:hidden}monkey-security-level .bar:before{content:\"\";display:block;position:absolute;height:100%;left:0;top:0;transition:all 1s}monkey-security-level.very-strong .bar:before{background:var(--mecx-color-success-main);width:100%}monkey-security-level.strong .bar:before{background:var(--mecx-color-success-main);width:80%}monkey-security-level.medium .bar:before{background:var(--mecx-color-warning-main);width:66%}monkey-security-level.weak .bar:before{background:var(--mecx-color-error-700);width:33%}monkey-security-level.empty .bar:before{background:var(--mecx-color-error-700);width:0%}\n"] }]
|
|
5359
|
+
}], ctorParameters: () => [], propDecorators: { class: [{
|
|
5360
|
+
type: HostBinding,
|
|
5361
|
+
args: ['class']
|
|
5362
|
+
}], id: [{
|
|
5363
|
+
type: Input
|
|
5364
|
+
}] } });
|
|
5365
|
+
|
|
5366
|
+
/** ************************
|
|
5367
|
+
* Copyright Monkey Exchange. All Rights Reserved
|
|
5368
|
+
* This style guide was developed by Monkey Exchange Team
|
|
5369
|
+
* MIT Licence
|
|
5370
|
+
************************* */
|
|
5371
|
+
|
|
5052
5372
|
/** ************************
|
|
5053
5373
|
* Copyright Monkey Exchange. All Rights Reserved
|
|
5054
5374
|
* This style guide was developed by Monkey Exchange Team
|
|
@@ -6369,5 +6689,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
|
|
|
6369
6689
|
* Generated bundle index. Do not edit.
|
|
6370
6690
|
*/
|
|
6371
6691
|
|
|
6372
|
-
export { MECX_MODAL_DATA, MECX_MODAL_DEFAULT_CONFIG, MONKEY_I18N_WRAPPER, MONKEY_POPOVER_OPTIONS, MonkeyAccordionComponent, MonkeyActionBarComponent, MonkeyAlertComponent, MonkeyAvatarComponent, MonkeyBadgeComponent, MonkeyBadgeDirective, MonkeyBreadcrumbComponent, MonkeyButtonComponent, MonkeyCheckboxComponent, MonkeyColumnChecked, MonkeyColumnExpansible, MonkeyColumnSortable, MonkeyColumnStick, MonkeyDateRangeComponent, MonkeyDirectivesModule, MonkeyDividerComponent, MonkeyErrorDirective, MonkeyFormFieldComponent, MonkeyFormFieldControl, MonkeyFormFieldModule, MonkeyHelperDirective, MonkeyIconButtonComponent, MonkeyIconComponent, MonkeyInfoDirective, MonkeyInputCodeComponent, MonkeyInputCurrencyDirective, MonkeyInputDirective, MonkeyInputModule, MonkeyInputUploadComponent, MonkeyLabelDirective, MonkeyModalActionsDirective, MonkeyModalComponent, MonkeyModalConfig, MonkeyModalContentDirective, MonkeyModalModule, MonkeyModalRef, MonkeyModalService, MonkeyModalSubtitleDirective, MonkeyModalTitleDirective, MonkeyOptionComponent, MonkeyPaginationActionComponent, MonkeyPaginationLabelComponent, MonkeyPaginationSizeComponent, MonkeyPopoverContentComponent, MonkeyPopoverDirective, MonkeyPrefixDirective, MonkeyRadioButtonComponent, MonkeySecurityLevelComponent, MonkeySelectComponent, MonkeyStatusComponent, MonkeySuffixDirective, MonkeyTableComponent, MonkeyTableModule, MonkeyToastComponent, MonkeyToastRef, MonkeyToastService, MonkeyToggleComponent, MonkeyToggleLineButtonComponent, MonkeyToggleLineComponent, MonkeyTooltipComponent, MonkeyTooltipDirective, getCurrencySymbol };
|
|
6692
|
+
export { MECX_MODAL_DATA, MECX_MODAL_DEFAULT_CONFIG, MONKEY_COUNTRY_CODE, MONKEY_I18N_WRAPPER, MONKEY_POPOVER_OPTIONS, MonkeyAccordionComponent, MonkeyActionBarComponent, MonkeyAlertComponent, MonkeyAvatarComponent, MonkeyBadgeComponent, MonkeyBadgeDirective, MonkeyBreadcrumbComponent, MonkeyButtonComponent, MonkeyCheckboxComponent, MonkeyColumnChecked, MonkeyColumnExpansible, MonkeyColumnSortable, MonkeyColumnStick, MonkeyDateRangeComponent, MonkeyDirectivesModule, MonkeyDividerComponent, MonkeyErrorDirective, MonkeyFormFieldComponent, MonkeyFormFieldControl, MonkeyFormFieldModule, MonkeyHelperDirective, MonkeyIconButtonComponent, MonkeyIconComponent, MonkeyInfoDirective, MonkeyInputCodeComponent, MonkeyInputCurrencyDirective, MonkeyInputDirective, MonkeyInputModule, MonkeyInputPhoneComponent, MonkeyInputUploadComponent, MonkeyLabelDirective, MonkeyModalActionsDirective, MonkeyModalComponent, MonkeyModalConfig, MonkeyModalContentDirective, MonkeyModalModule, MonkeyModalRef, MonkeyModalService, MonkeyModalSubtitleDirective, MonkeyModalTitleDirective, MonkeyOptionComponent, MonkeyPaginationActionComponent, MonkeyPaginationLabelComponent, MonkeyPaginationSizeComponent, MonkeyPopoverContentComponent, MonkeyPopoverDirective, MonkeyPrefixDirective, MonkeyRadioButtonComponent, MonkeySecurityLevelComponent, MonkeySelectComponent, MonkeyStatusComponent, MonkeySuffixDirective, MonkeyTableComponent, MonkeyTableModule, MonkeyToastComponent, MonkeyToastRef, MonkeyToastService, MonkeyToggleComponent, MonkeyToggleLineButtonComponent, MonkeyToggleLineComponent, MonkeyTooltipComponent, MonkeyTooltipDirective, getCurrencySymbol };
|
|
6373
6693
|
//# sourceMappingURL=monkey-style-guide-v2.mjs.map
|