ng-zenduit 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +24 -0
- package/esm2020/lib/breadcrumbs/zendu-breadcrumbs.component.mjs +37 -0
- package/esm2020/lib/card-block/zendu-card-block.component.mjs +21 -0
- package/esm2020/lib/checkbox/zendu-checkbox.component.mjs +44 -0
- package/esm2020/lib/colorpicker/zendu-colorpicker.component.mjs +106 -0
- package/esm2020/lib/column-configuration/columnState.mjs +2 -0
- package/esm2020/lib/column-configuration/zendu-column-configuration.component.mjs +118 -0
- package/esm2020/lib/datepicker/date-picker-day.mjs +2 -0
- package/esm2020/lib/datepicker/date-picker-hint.mjs +2 -0
- package/esm2020/lib/datepicker/datepicker.mjs +9 -0
- package/esm2020/lib/datepicker/zendu-datepicker.component.mjs +434 -0
- package/esm2020/lib/doc-scanner/zendu-doc-scanner.component.mjs +628 -0
- package/esm2020/lib/file-upload/zendu-file-upload.component.mjs +107 -0
- package/esm2020/lib/filter/dateRange.mjs +2 -0
- package/esm2020/lib/filter/filtersConfig.mjs +2 -0
- package/esm2020/lib/filter/numberRange.mjs +2 -0
- package/esm2020/lib/filter/zendu-filter.component.mjs +461 -0
- package/esm2020/lib/icon/zendu-icon.component.mjs +24 -0
- package/esm2020/lib/local.lock.mjs +33 -0
- package/esm2020/lib/location-search/location.address.mjs +2 -0
- package/esm2020/lib/location-search/zendu-location-search.component.mjs +129 -0
- package/esm2020/lib/map/map.types.mjs +2 -0
- package/esm2020/lib/map/zendu-map.component.mjs +129 -0
- package/esm2020/lib/map-preview/zendu-map-preview.component.mjs +30 -0
- package/esm2020/lib/ng-zenduit.module.mjs +158 -0
- package/esm2020/lib/pagination-bar/pageItem.mjs +2 -0
- package/esm2020/lib/pagination-bar/zendu-pagination-bar.component.mjs +71 -0
- package/esm2020/lib/phone-input/zendu-phone-input.component.mjs +141 -0
- package/esm2020/lib/progress/zendu-progress.component.mjs +29 -0
- package/esm2020/lib/radio-button/radio-button.component.mjs +48 -0
- package/esm2020/lib/search-box/zendu-search-box.component.mjs +124 -0
- package/esm2020/lib/select/templates/zendu-select-option.directive.mjs +16 -0
- package/esm2020/lib/select/templates/zendu-select-value.directive.mjs +16 -0
- package/esm2020/lib/select/zendu-select.component.mjs +303 -0
- package/esm2020/lib/services/geoconding.service.mjs +61 -0
- package/esm2020/lib/services/map.service.mjs +181 -0
- package/esm2020/lib/services/opencv.service.mjs +109 -0
- package/esm2020/lib/services/zendu-notify.service.mjs +92 -0
- package/esm2020/lib/sort-header/zendu-sort-header.component.mjs +36 -0
- package/esm2020/lib/spinner/zendu-spinner.component.mjs +11 -0
- package/esm2020/lib/toggle/zendu-toggle.component.mjs +32 -0
- package/esm2020/lib/toggle-slide/zendu-toggle-slide.component.mjs +27 -0
- package/esm2020/lib/util.mjs +93 -0
- package/esm2020/ng-zenduit.mjs +5 -0
- package/esm2020/public-api.mjs +42 -0
- package/fesm2015/ng-zenduit.mjs +3768 -0
- package/fesm2015/ng-zenduit.mjs.map +1 -0
- package/fesm2020/ng-zenduit.mjs +3735 -0
- package/fesm2020/ng-zenduit.mjs.map +1 -0
- package/icons/arrow-down-small.svg +3 -0
- package/icons/arrow-up-small.svg +3 -0
- package/icons/calendar.svg +6 -0
- package/icons/cross.svg +3 -0
- package/icons/date.svg +3 -0
- package/icons/expand.svg +3 -0
- package/icons/filter.svg +3 -0
- package/icons/play.svg +10 -0
- package/icons/redo.svg +3 -0
- package/icons/rotate.svg +3 -0
- package/icons/time.svg +4 -0
- package/icons/undo.svg +3 -0
- package/index.d.ts +5 -0
- package/lib/breadcrumbs/zendu-breadcrumbs.component.d.ts +22 -0
- package/lib/card-block/zendu-card-block.component.d.ts +9 -0
- package/lib/checkbox/zendu-checkbox.component.d.ts +17 -0
- package/lib/colorpicker/zendu-colorpicker.component.d.ts +28 -0
- package/lib/column-configuration/columnState.d.ts +7 -0
- package/lib/column-configuration/zendu-column-configuration.component.d.ts +43 -0
- package/lib/datepicker/date-picker-day.d.ts +8 -0
- package/lib/datepicker/date-picker-hint.d.ts +5 -0
- package/lib/datepicker/datepicker.d.ts +7 -0
- package/lib/datepicker/zendu-datepicker.component.d.ts +94 -0
- package/lib/doc-scanner/zendu-doc-scanner.component.d.ts +82 -0
- package/lib/file-upload/zendu-file-upload.component.d.ts +28 -0
- package/lib/filter/dateRange.d.ts +4 -0
- package/lib/filter/filtersConfig.d.ts +88 -0
- package/lib/filter/numberRange.d.ts +4 -0
- package/lib/filter/zendu-filter.component.d.ts +59 -0
- package/lib/icon/zendu-icon.component.d.ts +10 -0
- package/lib/local.lock.d.ts +8 -0
- package/lib/location-search/location.address.d.ts +12 -0
- package/lib/location-search/zendu-location-search.component.d.ts +32 -0
- package/lib/map/map.types.d.ts +33 -0
- package/lib/map/zendu-map.component.d.ts +23 -0
- package/lib/map-preview/zendu-map-preview.component.d.ts +11 -0
- package/lib/ng-zenduit.module.d.ts +34 -0
- package/lib/pagination-bar/pageItem.d.ts +4 -0
- package/lib/pagination-bar/zendu-pagination-bar.component.d.ts +25 -0
- package/lib/phone-input/zendu-phone-input.component.d.ts +39 -0
- package/lib/progress/zendu-progress.component.d.ts +14 -0
- package/lib/radio-button/radio-button.component.d.ts +18 -0
- package/lib/search-box/zendu-search-box.component.d.ts +26 -0
- package/lib/select/templates/zendu-select-option.directive.d.ts +8 -0
- package/lib/select/templates/zendu-select-value.directive.d.ts +8 -0
- package/lib/select/zendu-select.component.d.ts +107 -0
- package/lib/services/geoconding.service.d.ts +23 -0
- package/lib/services/map.service.d.ts +22 -0
- package/lib/services/opencv.service.d.ts +46 -0
- package/lib/services/zendu-notify.service.d.ts +10 -0
- package/lib/sort-header/zendu-sort-header.component.d.ts +10 -0
- package/lib/spinner/zendu-spinner.component.d.ts +5 -0
- package/lib/toggle/zendu-toggle.component.d.ts +14 -0
- package/lib/toggle-slide/zendu-toggle-slide.component.d.ts +13 -0
- package/lib/util.d.ts +11 -0
- package/package.json +36 -0
- package/public-api.d.ts +38 -0
- package/styles/action-menu.scss +127 -0
- package/styles/all.scss +11 -0
- package/styles/button.scss +188 -0
- package/styles/colors.scss +125 -0
- package/styles/common-form.scss +159 -0
- package/styles/extenal.scss +2 -0
- package/styles/ghost.scss +38 -0
- package/styles/global-restyle.scss +25 -0
- package/styles/page-layout.scss +82 -0
- package/styles/snackbar.scss +91 -0
- package/styles/table.scss +107 -0
|
@@ -0,0 +1,3735 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { Injectable, EventEmitter, Component, Input, Output, HostListener, ViewChild, Directive, ContentChild, NgModule } from '@angular/core';
|
|
3
|
+
import { show } from 'node-snackbar';
|
|
4
|
+
import * as i1 from '@angular/common';
|
|
5
|
+
import { CommonModule } from '@angular/common';
|
|
6
|
+
import * as i2 from '@angular/forms';
|
|
7
|
+
import { FormsModule } from '@angular/forms';
|
|
8
|
+
import * as i2$1 from '@angular/cdk/drag-drop';
|
|
9
|
+
import { moveItemInArray, DragDropModule } from '@angular/cdk/drag-drop';
|
|
10
|
+
import moment from 'moment/moment';
|
|
11
|
+
import uniqBy from 'lodash.uniqby';
|
|
12
|
+
import { PhoneNumberUtil } from 'google-libphonenumber';
|
|
13
|
+
import { fabric } from 'fabric';
|
|
14
|
+
import { Subject } from 'rxjs';
|
|
15
|
+
import { debounceTime, distinctUntilChanged } from 'rxjs/operators';
|
|
16
|
+
|
|
17
|
+
class ZenNotifyService {
|
|
18
|
+
info(msg, duration = 5000, hasDismiss = true) {
|
|
19
|
+
console.log(msg);
|
|
20
|
+
show({
|
|
21
|
+
pos: "top-center",
|
|
22
|
+
text: msg,
|
|
23
|
+
textColor: "white",
|
|
24
|
+
duration: duration,
|
|
25
|
+
actionText: "dismiss",
|
|
26
|
+
actionTextColor: "white",
|
|
27
|
+
showAction: hasDismiss
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
success(msg, duration = 5000, hasDismiss = true) {
|
|
31
|
+
console.log(msg);
|
|
32
|
+
show({
|
|
33
|
+
pos: "top-center",
|
|
34
|
+
text: msg,
|
|
35
|
+
textColor: "white",
|
|
36
|
+
backgroundColor: "#5cbb3a",
|
|
37
|
+
duration: duration,
|
|
38
|
+
actionText: "dismiss",
|
|
39
|
+
actionTextColor: "white",
|
|
40
|
+
showAction: hasDismiss
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
warn(msg, duration = 5000, hasDismiss = true) {
|
|
44
|
+
console.warn(msg);
|
|
45
|
+
show({
|
|
46
|
+
pos: "top-center",
|
|
47
|
+
text: msg,
|
|
48
|
+
textColor: "white",
|
|
49
|
+
backgroundColor: "#f1b10b",
|
|
50
|
+
duration: duration,
|
|
51
|
+
actionText: "dismiss",
|
|
52
|
+
actionTextColor: "white",
|
|
53
|
+
showAction: hasDismiss
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
error(err, duration = 5000, hasDismiss = true) {
|
|
57
|
+
console.error(err);
|
|
58
|
+
show({
|
|
59
|
+
pos: "top-center",
|
|
60
|
+
text: this.getErrorMessage(err),
|
|
61
|
+
textColor: "white",
|
|
62
|
+
backgroundColor: "#dc3e33",
|
|
63
|
+
duration: duration,
|
|
64
|
+
actionText: "dismiss",
|
|
65
|
+
actionTextColor: "white",
|
|
66
|
+
showAction: hasDismiss
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
getErrorMessage(ex) {
|
|
70
|
+
if (!ex) {
|
|
71
|
+
return '';
|
|
72
|
+
}
|
|
73
|
+
if (typeof ex === 'string') {
|
|
74
|
+
return ex;
|
|
75
|
+
}
|
|
76
|
+
else if (typeof ex.error === 'string') {
|
|
77
|
+
return ex.error;
|
|
78
|
+
}
|
|
79
|
+
else if (ex.error && ex.error.message) {
|
|
80
|
+
return ex.error.message;
|
|
81
|
+
}
|
|
82
|
+
else if (ex.message) {
|
|
83
|
+
return ex.message;
|
|
84
|
+
}
|
|
85
|
+
else if (ex.status && ex.statusText) {
|
|
86
|
+
return `Http error ${ex.status} ${ex.statusText}`;
|
|
87
|
+
}
|
|
88
|
+
else if (ex.statusText) {
|
|
89
|
+
return ex.statusText;
|
|
90
|
+
}
|
|
91
|
+
else {
|
|
92
|
+
console.warn('Can\'t extract error message from object:', ex);
|
|
93
|
+
return '';
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
ZenNotifyService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: ZenNotifyService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
98
|
+
ZenNotifyService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: ZenNotifyService, providedIn: 'root' });
|
|
99
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: ZenNotifyService, decorators: [{
|
|
100
|
+
type: Injectable,
|
|
101
|
+
args: [{
|
|
102
|
+
providedIn: 'root'
|
|
103
|
+
}]
|
|
104
|
+
}] });
|
|
105
|
+
|
|
106
|
+
class ZenduCheckboxComponent {
|
|
107
|
+
constructor() {
|
|
108
|
+
this.checkedChange = new EventEmitter();
|
|
109
|
+
this.label = 'Enable';
|
|
110
|
+
this.disabled = false;
|
|
111
|
+
this.disableValueChange = false;
|
|
112
|
+
this.indeterminate = false;
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Toggle state
|
|
116
|
+
*/
|
|
117
|
+
toggle() {
|
|
118
|
+
if (this.disabled || this.disableValueChange) {
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
121
|
+
this.checked = !this.checked;
|
|
122
|
+
this.indeterminate = false;
|
|
123
|
+
this.checkedChange.emit(this.checked);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
ZenduCheckboxComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: ZenduCheckboxComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
127
|
+
ZenduCheckboxComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.12", type: ZenduCheckboxComponent, selector: "zen-checkbox", inputs: { checked: "checked", label: "label", disabled: "disabled", disableValueChange: "disableValueChange", indeterminate: "indeterminate", imageUrl: "imageUrl" }, outputs: { checkedChange: "checkedChange" }, ngImport: i0, template: "<div class=\"checkbox-component\"\n [ngClass]=\"{'app-disabled': disabled}\"\n (click)=\"toggle()\">\n <button class=\"app-checkbox\"\n [ngClass]=\"{ 'app-checked': checked && !indeterminate, 'app-indeterminate': indeterminate }\">\n <i *ngIf=\"checked && !indeterminate\"\n class=\"material-icons app-checkbox-icon\">done</i>\n <i *ngIf=\"indeterminate\"\n class=\"material-icons app-checkbox-icon\">remove</i>\n </button>\n <div class=\"app-checkbox-label\"\n *ngIf=\"label\">\n <img class=\"checkbox-image\"\n [src]=\"imageUrl\"\n *ngIf=\"imageUrl\">\n {{label}}\n </div>\n</div>", styles: [".checkbox-component{display:flex;align-items:center;cursor:pointer;gap:8px}.checkbox-component .app-checkbox{padding:4px;position:relative;width:20px;min-width:20px;height:20px;min-height:20px;border:1.6px solid #d6d6d8;border-radius:2px;box-sizing:border-box;color:#fff;background:transparent}.checkbox-component .app-checkbox:focus{outline:none;box-shadow:0 0 2px 2px #2188d94d}.checkbox-component .app-checkbox.app-checked{border-color:var(--color-primary, #2188d9);color:var(--color-primary, #2188d9)}.checkbox-component .app-checkbox.app-checked+.app-checkbox-label{color:#4f4f4f}.checkbox-component .app-checkbox.app-indeterminate{border-color:var(--color-primary, #2188d9);color:var(--color-primary, #2188d9)}.checkbox-component .app-checkbox .app-checkbox-icon{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);font-size:18px}.checkbox-component .app-checkbox-label{font-weight:400;font-size:14px;line-height:130%;color:#828282;display:flex;align-items:center}.checkbox-component .app-checkbox-label .checkbox-image{margin-right:8px;width:36px}.checkbox-component:hover,.checkbox-component:focus{outline:none;text-decoration:none}.checkbox-component:hover .app-checkbox,.checkbox-component:focus .app-checkbox{border-color:#16598d}.checkbox-component:hover .app-checkbox.app-checked,.checkbox-component:focus .app-checkbox.app-checked{border-color:#16598d;color:#16598d}.checkbox-component:hover .app-checkbox.app-indeterminate,.checkbox-component:focus .app-checkbox.app-indeterminate{border-color:#16598d;color:#16598d}.checkbox-component.app-disabled{cursor:not-allowed}.checkbox-component.app-disabled .app-checkbox{border-color:#ececed}.checkbox-component.app-disabled .app-checkbox.app-checked,.checkbox-component.app-disabled .app-checkbox.app-indeterminate{border-color:#ececed;color:#ececed}.checkbox-component.app-disabled .app-checkbox-label{color:#ececed}\n"], dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
|
|
128
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: ZenduCheckboxComponent, decorators: [{
|
|
129
|
+
type: Component,
|
|
130
|
+
args: [{ selector: 'zen-checkbox', template: "<div class=\"checkbox-component\"\n [ngClass]=\"{'app-disabled': disabled}\"\n (click)=\"toggle()\">\n <button class=\"app-checkbox\"\n [ngClass]=\"{ 'app-checked': checked && !indeterminate, 'app-indeterminate': indeterminate }\">\n <i *ngIf=\"checked && !indeterminate\"\n class=\"material-icons app-checkbox-icon\">done</i>\n <i *ngIf=\"indeterminate\"\n class=\"material-icons app-checkbox-icon\">remove</i>\n </button>\n <div class=\"app-checkbox-label\"\n *ngIf=\"label\">\n <img class=\"checkbox-image\"\n [src]=\"imageUrl\"\n *ngIf=\"imageUrl\">\n {{label}}\n </div>\n</div>", styles: [".checkbox-component{display:flex;align-items:center;cursor:pointer;gap:8px}.checkbox-component .app-checkbox{padding:4px;position:relative;width:20px;min-width:20px;height:20px;min-height:20px;border:1.6px solid #d6d6d8;border-radius:2px;box-sizing:border-box;color:#fff;background:transparent}.checkbox-component .app-checkbox:focus{outline:none;box-shadow:0 0 2px 2px #2188d94d}.checkbox-component .app-checkbox.app-checked{border-color:var(--color-primary, #2188d9);color:var(--color-primary, #2188d9)}.checkbox-component .app-checkbox.app-checked+.app-checkbox-label{color:#4f4f4f}.checkbox-component .app-checkbox.app-indeterminate{border-color:var(--color-primary, #2188d9);color:var(--color-primary, #2188d9)}.checkbox-component .app-checkbox .app-checkbox-icon{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);font-size:18px}.checkbox-component .app-checkbox-label{font-weight:400;font-size:14px;line-height:130%;color:#828282;display:flex;align-items:center}.checkbox-component .app-checkbox-label .checkbox-image{margin-right:8px;width:36px}.checkbox-component:hover,.checkbox-component:focus{outline:none;text-decoration:none}.checkbox-component:hover .app-checkbox,.checkbox-component:focus .app-checkbox{border-color:#16598d}.checkbox-component:hover .app-checkbox.app-checked,.checkbox-component:focus .app-checkbox.app-checked{border-color:#16598d;color:#16598d}.checkbox-component:hover .app-checkbox.app-indeterminate,.checkbox-component:focus .app-checkbox.app-indeterminate{border-color:#16598d;color:#16598d}.checkbox-component.app-disabled{cursor:not-allowed}.checkbox-component.app-disabled .app-checkbox{border-color:#ececed}.checkbox-component.app-disabled .app-checkbox.app-checked,.checkbox-component.app-disabled .app-checkbox.app-indeterminate{border-color:#ececed;color:#ececed}.checkbox-component.app-disabled .app-checkbox-label{color:#ececed}\n"] }]
|
|
131
|
+
}], propDecorators: { checked: [{
|
|
132
|
+
type: Input
|
|
133
|
+
}], checkedChange: [{
|
|
134
|
+
type: Output
|
|
135
|
+
}], label: [{
|
|
136
|
+
type: Input
|
|
137
|
+
}], disabled: [{
|
|
138
|
+
type: Input
|
|
139
|
+
}], disableValueChange: [{
|
|
140
|
+
type: Input
|
|
141
|
+
}], indeterminate: [{
|
|
142
|
+
type: Input
|
|
143
|
+
}], imageUrl: [{
|
|
144
|
+
type: Input
|
|
145
|
+
}] } });
|
|
146
|
+
|
|
147
|
+
class ZenduColorPickerComponent {
|
|
148
|
+
constructor(_element) {
|
|
149
|
+
this._element = _element;
|
|
150
|
+
this.colorChange = new EventEmitter();
|
|
151
|
+
this.icon = "text";
|
|
152
|
+
this.showNone = true;
|
|
153
|
+
this.opened = false;
|
|
154
|
+
this.menuLeft = "0px";
|
|
155
|
+
this.menuTop = "";
|
|
156
|
+
this.menuBottom = "";
|
|
157
|
+
this.colorsRows = [
|
|
158
|
+
{ colors: ["#000000", "#666666", "#b7b7b7", "#cccccc", "#d9d9d9", "#efefef", "#ffffff"] },
|
|
159
|
+
{ colors: ["#CC0000", "#E69138", "#F1C232", "#6AA84F", "#3C78D8", "#674EA7", "#A64D79"] },
|
|
160
|
+
{ colors: ["#E06666", "#F6B26B", "#FFD966", "#93C47D", "#6D9EEB", "#8E7CC3", "#C27BA0"] },
|
|
161
|
+
{ colors: ["#EA9999", "#F9CB9C", "#FFE599", "#B6D7A8", "#A4C2F4", "#B4A7D6", "#D5A6BD"] },
|
|
162
|
+
{ colors: ["#F4CCCC", "#FCE5CD", "#FFF2CC", "#D9EAD3", "#C9DAF8", "#D9D2E9", "#EAD1DC"] }
|
|
163
|
+
];
|
|
164
|
+
}
|
|
165
|
+
outsideHandling(event) {
|
|
166
|
+
if (!document.body.contains(event.target)) {
|
|
167
|
+
// element not in the DOM
|
|
168
|
+
return;
|
|
169
|
+
}
|
|
170
|
+
if (this._element.nativeElement.contains(event.target)) {
|
|
171
|
+
return;
|
|
172
|
+
}
|
|
173
|
+
this.hidePicker();
|
|
174
|
+
}
|
|
175
|
+
scroll() {
|
|
176
|
+
this.updatePlacement();
|
|
177
|
+
}
|
|
178
|
+
ngOnChanges(changes) {
|
|
179
|
+
if (changes["customTarget"] &&
|
|
180
|
+
changes["customTarget"].currentValue &&
|
|
181
|
+
this.customTarget) {
|
|
182
|
+
this.customTarget.addEventListener("click", this.toggleEvent.bind(this));
|
|
183
|
+
}
|
|
184
|
+
this.updatePlacement();
|
|
185
|
+
}
|
|
186
|
+
toggleEvent(evt) {
|
|
187
|
+
this.toggle();
|
|
188
|
+
evt.stopPropagation();
|
|
189
|
+
}
|
|
190
|
+
toggle() {
|
|
191
|
+
this.updatePlacement();
|
|
192
|
+
this.opened = !this.opened;
|
|
193
|
+
}
|
|
194
|
+
updatePlacement() {
|
|
195
|
+
let container;
|
|
196
|
+
if (this.customTarget) {
|
|
197
|
+
container = this.customTarget;
|
|
198
|
+
}
|
|
199
|
+
else {
|
|
200
|
+
const component = this._element.nativeElement;
|
|
201
|
+
container = component.getElementsByClassName("colorpicker-component").item(0);
|
|
202
|
+
}
|
|
203
|
+
const left = container.getBoundingClientRect().left;
|
|
204
|
+
const top = container.getBoundingClientRect().top;
|
|
205
|
+
const bottom = container.getBoundingClientRect().bottom;
|
|
206
|
+
const margin = 8;
|
|
207
|
+
this.menuLeft = `${left}px`;
|
|
208
|
+
const distToBottomOfPage = window.innerHeight - top;
|
|
209
|
+
if (distToBottomOfPage > 150) {
|
|
210
|
+
this.menuTop = `${bottom + margin}px`;
|
|
211
|
+
this.menuBottom = "";
|
|
212
|
+
}
|
|
213
|
+
else {
|
|
214
|
+
const bottomFixed = window.innerHeight - top + margin;
|
|
215
|
+
this.menuBottom = `${bottomFixed}px`;
|
|
216
|
+
this.menuTop = "";
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
hidePicker() {
|
|
220
|
+
this.opened = false;
|
|
221
|
+
}
|
|
222
|
+
selectColor(color) {
|
|
223
|
+
this.color = color;
|
|
224
|
+
this.colorChange.emit(color);
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
ZenduColorPickerComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: ZenduColorPickerComponent, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
228
|
+
ZenduColorPickerComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.12", type: ZenduColorPickerComponent, selector: "zen-colorpicker", inputs: { color: "color", icon: "icon", customTarget: "customTarget", showNone: "showNone" }, outputs: { colorChange: "colorChange" }, host: { listeners: { "window:mousedown": "outsideHandling($event)", "window:scroll": "scroll()" } }, usesOnChanges: true, ngImport: i0, template: "<div class=\"colorpicker-component\"\n (click)=\"toggle()\"\n [class.opened]=\"opened\"\n [class.no-size]=\"customTarget\">\n\n <ng-container *ngIf=\"!customTarget\">\n <div *ngIf=\"icon == 'text'\">\n <img src=\"https://storage.googleapis.com/zenduit-icons/components/color_picker_text.svg\"\n class=\"icon-text\">\n </div>\n\n <div *ngIf=\"icon == 'paint'\">\n <img src=\"https://storage.googleapis.com/zenduit-icons/components/color_picker_paint.svg\"\n class=\"icon-paint\">\n </div>\n\n <div class=\"toggle\">\n <i class=\"material-icons\">arrow_drop_down</i>\n </div>\n\n <div class=\"color-line\"\n [ngStyle]=\"{'border-color': color}\">\n </div>\n </ng-container>\n\n <div *ngIf=\"opened\"\n class=\"color-menu\"\n [ngStyle]=\"{ 'left': menuLeft, 'top': menuTop, 'bottom': menuBottom }\">\n\n <div class=\"colors-container\">\n <div *ngFor=\"let row of colorsRows\"\n class=\"color-row\">\n <div *ngFor=\"let rowColor of row.colors\"\n (click)=\"selectColor(rowColor)\"\n class=\"color-item\"\n [ngStyle]=\"{'background-color': rowColor}\">\n <div *ngIf=\"rowColor == color\"\n class=\"select-icon\">\n <i class=\"material-icons\">check</i>\n </div>\n </div>\n </div>\n </div>\n\n <div *ngIf=\"showNone\"\n class=\"no-color\"\n (click)=\"selectColor('')\">\n None\n </div>\n </div>\n</div>\n", styles: [".colorpicker-component{border:1px solid var(--color-primary, #2188d9);position:relative;border-radius:4px;padding:3px 4px;width:29px;height:19px;display:flex;cursor:pointer}.colorpicker-component.no-size{border:0;width:0px;height:0px;padding:0;margin:0}.colorpicker-component .color-line{width:14px;border:2px solid;position:absolute;bottom:5px;left:3px;z-index:1;background-color:#000}.colorpicker-component .material-icons{color:#333;font-size:16px}.colorpicker-component .icon-paint{margin-bottom:2px;margin-left:2px;height:13px;width:13px}.colorpicker-component .icon-text{margin-bottom:4px;margin-left:2px;height:11px;width:11px}.colorpicker-component .toggle{padding-top:4px}.colorpicker-component.opened{background:rgba(33,136,217,.1)}.colorpicker-component.opened .material-icons{color:var(--color-primary, #2188d9)!important}.colorpicker-component .color-menu{background:#ffffff;box-shadow:0 2px 4px -1px #00000008,0 4px 5px #0000003d,0 1px 10px #0000001a;border-radius:8px;position:fixed;overflow-y:auto;white-space:initial;padding:4px;z-index:10}.colorpicker-component .color-menu .colors-container .color-row{display:flex;align-items:center;justify-content:space-between}.colorpicker-component .color-menu .colors-container .color-row .color-item{width:14px;height:14px;cursor:pointer;border:1px solid #d5d5d5;border-radius:1px;margin:1px}.colorpicker-component .color-menu .colors-container .color-row .select-icon{position:relative}.colorpicker-component .color-menu .colors-container .color-row .select-icon .material-icons{position:absolute;color:#fff!important;font-size:12px;font-weight:700}.colorpicker-component .color-menu .no-color{background:#ffffff;border:1px solid #b0b0b0;border-radius:5px;font-family:Roboto;font-style:normal;font-weight:400;font-size:12px;display:flex;justify-content:center;margin-top:5px;cursor:pointer;color:#333}\n"], dependencies: [{ kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }] });
|
|
229
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: ZenduColorPickerComponent, decorators: [{
|
|
230
|
+
type: Component,
|
|
231
|
+
args: [{ selector: 'zen-colorpicker', template: "<div class=\"colorpicker-component\"\n (click)=\"toggle()\"\n [class.opened]=\"opened\"\n [class.no-size]=\"customTarget\">\n\n <ng-container *ngIf=\"!customTarget\">\n <div *ngIf=\"icon == 'text'\">\n <img src=\"https://storage.googleapis.com/zenduit-icons/components/color_picker_text.svg\"\n class=\"icon-text\">\n </div>\n\n <div *ngIf=\"icon == 'paint'\">\n <img src=\"https://storage.googleapis.com/zenduit-icons/components/color_picker_paint.svg\"\n class=\"icon-paint\">\n </div>\n\n <div class=\"toggle\">\n <i class=\"material-icons\">arrow_drop_down</i>\n </div>\n\n <div class=\"color-line\"\n [ngStyle]=\"{'border-color': color}\">\n </div>\n </ng-container>\n\n <div *ngIf=\"opened\"\n class=\"color-menu\"\n [ngStyle]=\"{ 'left': menuLeft, 'top': menuTop, 'bottom': menuBottom }\">\n\n <div class=\"colors-container\">\n <div *ngFor=\"let row of colorsRows\"\n class=\"color-row\">\n <div *ngFor=\"let rowColor of row.colors\"\n (click)=\"selectColor(rowColor)\"\n class=\"color-item\"\n [ngStyle]=\"{'background-color': rowColor}\">\n <div *ngIf=\"rowColor == color\"\n class=\"select-icon\">\n <i class=\"material-icons\">check</i>\n </div>\n </div>\n </div>\n </div>\n\n <div *ngIf=\"showNone\"\n class=\"no-color\"\n (click)=\"selectColor('')\">\n None\n </div>\n </div>\n</div>\n", styles: [".colorpicker-component{border:1px solid var(--color-primary, #2188d9);position:relative;border-radius:4px;padding:3px 4px;width:29px;height:19px;display:flex;cursor:pointer}.colorpicker-component.no-size{border:0;width:0px;height:0px;padding:0;margin:0}.colorpicker-component .color-line{width:14px;border:2px solid;position:absolute;bottom:5px;left:3px;z-index:1;background-color:#000}.colorpicker-component .material-icons{color:#333;font-size:16px}.colorpicker-component .icon-paint{margin-bottom:2px;margin-left:2px;height:13px;width:13px}.colorpicker-component .icon-text{margin-bottom:4px;margin-left:2px;height:11px;width:11px}.colorpicker-component .toggle{padding-top:4px}.colorpicker-component.opened{background:rgba(33,136,217,.1)}.colorpicker-component.opened .material-icons{color:var(--color-primary, #2188d9)!important}.colorpicker-component .color-menu{background:#ffffff;box-shadow:0 2px 4px -1px #00000008,0 4px 5px #0000003d,0 1px 10px #0000001a;border-radius:8px;position:fixed;overflow-y:auto;white-space:initial;padding:4px;z-index:10}.colorpicker-component .color-menu .colors-container .color-row{display:flex;align-items:center;justify-content:space-between}.colorpicker-component .color-menu .colors-container .color-row .color-item{width:14px;height:14px;cursor:pointer;border:1px solid #d5d5d5;border-radius:1px;margin:1px}.colorpicker-component .color-menu .colors-container .color-row .select-icon{position:relative}.colorpicker-component .color-menu .colors-container .color-row .select-icon .material-icons{position:absolute;color:#fff!important;font-size:12px;font-weight:700}.colorpicker-component .color-menu .no-color{background:#ffffff;border:1px solid #b0b0b0;border-radius:5px;font-family:Roboto;font-style:normal;font-weight:400;font-size:12px;display:flex;justify-content:center;margin-top:5px;cursor:pointer;color:#333}\n"] }]
|
|
232
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef }]; }, propDecorators: { color: [{
|
|
233
|
+
type: Input
|
|
234
|
+
}], colorChange: [{
|
|
235
|
+
type: Output
|
|
236
|
+
}], icon: [{
|
|
237
|
+
type: Input
|
|
238
|
+
}], customTarget: [{
|
|
239
|
+
type: Input
|
|
240
|
+
}], showNone: [{
|
|
241
|
+
type: Input
|
|
242
|
+
}], outsideHandling: [{
|
|
243
|
+
type: HostListener,
|
|
244
|
+
args: ['window:mousedown', ['$event']]
|
|
245
|
+
}], scroll: [{
|
|
246
|
+
type: HostListener,
|
|
247
|
+
args: ['window:scroll', []]
|
|
248
|
+
}] } });
|
|
249
|
+
|
|
250
|
+
class Util {
|
|
251
|
+
static debounce(func, wait, immediate) {
|
|
252
|
+
let timeout;
|
|
253
|
+
const context = this;
|
|
254
|
+
return function executedFunction() {
|
|
255
|
+
const args = arguments;
|
|
256
|
+
const later = function () {
|
|
257
|
+
timeout = null;
|
|
258
|
+
if (!immediate) {
|
|
259
|
+
func.apply(context, args);
|
|
260
|
+
}
|
|
261
|
+
};
|
|
262
|
+
const callNow = immediate && !timeout;
|
|
263
|
+
clearTimeout(timeout);
|
|
264
|
+
timeout = setTimeout(later, wait);
|
|
265
|
+
if (callNow) {
|
|
266
|
+
func.apply(context, args);
|
|
267
|
+
}
|
|
268
|
+
};
|
|
269
|
+
}
|
|
270
|
+
static clone(source) {
|
|
271
|
+
let str = JSON.stringify(source);
|
|
272
|
+
let outObj = JSON.parse(str);
|
|
273
|
+
this.updateClone(outObj);
|
|
274
|
+
// Convert in the output object ISO string to Date object
|
|
275
|
+
//
|
|
276
|
+
// @ts-ignore
|
|
277
|
+
for (let key of Object.keys(source)) {
|
|
278
|
+
const val = source[key];
|
|
279
|
+
if (val &&
|
|
280
|
+
typeof val == "object" &&
|
|
281
|
+
typeof val.getTime == "function" &&
|
|
282
|
+
typeof val.getDate == "function") {
|
|
283
|
+
outObj[key] = new Date(val);
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
return outObj;
|
|
287
|
+
}
|
|
288
|
+
/**
|
|
289
|
+
* Remove internal angularjs properties
|
|
290
|
+
* @param obj
|
|
291
|
+
*/
|
|
292
|
+
static updateClone(obj) {
|
|
293
|
+
if (!obj) {
|
|
294
|
+
return;
|
|
295
|
+
}
|
|
296
|
+
if (Array.isArray(obj)) {
|
|
297
|
+
for (let item of obj) {
|
|
298
|
+
if (!item) {
|
|
299
|
+
item = item;
|
|
300
|
+
}
|
|
301
|
+
this.updateClone(item);
|
|
302
|
+
}
|
|
303
|
+
return;
|
|
304
|
+
}
|
|
305
|
+
let type = typeof obj;
|
|
306
|
+
if (type == "string" || type == "number") {
|
|
307
|
+
return;
|
|
308
|
+
}
|
|
309
|
+
// Remove invalid props
|
|
310
|
+
let keys = Object.keys(obj);
|
|
311
|
+
keys.forEach((key) => {
|
|
312
|
+
if (key[0] == '$' ||
|
|
313
|
+
key[0] == '&') {
|
|
314
|
+
delete obj[key];
|
|
315
|
+
return;
|
|
316
|
+
}
|
|
317
|
+
let val = obj[key];
|
|
318
|
+
if (Array.isArray(val)) {
|
|
319
|
+
let arr = val;
|
|
320
|
+
for (let k of arr) {
|
|
321
|
+
this.updateClone(k);
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
else if (typeof val == "object") {
|
|
325
|
+
this.updateClone(val);
|
|
326
|
+
}
|
|
327
|
+
});
|
|
328
|
+
}
|
|
329
|
+
static copyProperties(source, dest) {
|
|
330
|
+
for (let key of Object.keys(source)) {
|
|
331
|
+
dest[key] = source[key];
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
static sleep(ms) {
|
|
335
|
+
return new Promise((resolve) => {
|
|
336
|
+
setTimeout(() => {
|
|
337
|
+
resolve();
|
|
338
|
+
}, ms);
|
|
339
|
+
});
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
class ZenduSearchBoxComponent {
|
|
344
|
+
constructor(_element, _ngZone) {
|
|
345
|
+
this._element = _element;
|
|
346
|
+
this._ngZone = _ngZone;
|
|
347
|
+
this.textChange = new EventEmitter();
|
|
348
|
+
this.autoFocus = true;
|
|
349
|
+
this.placeholder = "Search";
|
|
350
|
+
this._focusAttempts = 0;
|
|
351
|
+
this.setDelay(500);
|
|
352
|
+
}
|
|
353
|
+
set delay(val) {
|
|
354
|
+
this.setDelay(val);
|
|
355
|
+
}
|
|
356
|
+
ngOnInit() {
|
|
357
|
+
// give 100ms for autoFocus initalization
|
|
358
|
+
setTimeout(() => {
|
|
359
|
+
if (this.autoFocus) {
|
|
360
|
+
this.doFocus();
|
|
361
|
+
}
|
|
362
|
+
}, 100);
|
|
363
|
+
}
|
|
364
|
+
onChange() {
|
|
365
|
+
this._debouncedInvoke();
|
|
366
|
+
}
|
|
367
|
+
clearFromParent() {
|
|
368
|
+
this.text = "";
|
|
369
|
+
}
|
|
370
|
+
clear() {
|
|
371
|
+
this.text = "";
|
|
372
|
+
this._debouncedInvoke();
|
|
373
|
+
}
|
|
374
|
+
invokeChange() {
|
|
375
|
+
this._ngZone.run(() => {
|
|
376
|
+
this.textChange.emit(this.text);
|
|
377
|
+
});
|
|
378
|
+
}
|
|
379
|
+
setDelay(delay) {
|
|
380
|
+
this._debouncedInvoke = Util.debounce(() => {
|
|
381
|
+
this.invokeChange();
|
|
382
|
+
}, delay);
|
|
383
|
+
}
|
|
384
|
+
activateSearchBox() {
|
|
385
|
+
this.searchInput.nativeElement.focus();
|
|
386
|
+
}
|
|
387
|
+
doFocus() {
|
|
388
|
+
this._focusAttempts++;
|
|
389
|
+
if (this._focusAttempts > 100) {
|
|
390
|
+
// stop attempts to initalize
|
|
391
|
+
return;
|
|
392
|
+
}
|
|
393
|
+
const input = this.getInput(this._element.nativeElement);
|
|
394
|
+
if (!input) {
|
|
395
|
+
// wait 100ms to run the next check
|
|
396
|
+
setTimeout(() => {
|
|
397
|
+
this.doFocus();
|
|
398
|
+
}, 100);
|
|
399
|
+
return;
|
|
400
|
+
}
|
|
401
|
+
// check if element visible or not
|
|
402
|
+
const height = input.clientHeight;
|
|
403
|
+
if (height == 0) {
|
|
404
|
+
// wait 100ms to run the next check
|
|
405
|
+
setTimeout(() => {
|
|
406
|
+
this.doFocus();
|
|
407
|
+
}, 100);
|
|
408
|
+
return;
|
|
409
|
+
}
|
|
410
|
+
// set focus to element
|
|
411
|
+
setTimeout(() => {
|
|
412
|
+
input.focus();
|
|
413
|
+
}, 1);
|
|
414
|
+
}
|
|
415
|
+
getInput(element) {
|
|
416
|
+
if (!element) {
|
|
417
|
+
return null;
|
|
418
|
+
}
|
|
419
|
+
if (element.nodeName == "INPUT") {
|
|
420
|
+
return element;
|
|
421
|
+
}
|
|
422
|
+
for (let idx = 0; idx < element.children.length; idx++) {
|
|
423
|
+
const el = element.children.item(idx);
|
|
424
|
+
if (el && el.nodeName == "INPUT") {
|
|
425
|
+
return el;
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
// find input in the children tree
|
|
429
|
+
for (let idx = 0; idx < element.children.length; idx++) {
|
|
430
|
+
const el = element.children.item(idx);
|
|
431
|
+
if (!el) {
|
|
432
|
+
continue;
|
|
433
|
+
}
|
|
434
|
+
const elInput = this.getInput(el);
|
|
435
|
+
if (elInput) {
|
|
436
|
+
return elInput;
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
return null;
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
ZenduSearchBoxComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: ZenduSearchBoxComponent, deps: [{ token: i0.ElementRef }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Component });
|
|
443
|
+
ZenduSearchBoxComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.12", type: ZenduSearchBoxComponent, selector: "zen-search-box", inputs: { text: "text", delay: "delay", autoFocus: "autoFocus", placeholder: "placeholder" }, outputs: { textChange: "textChange" }, viewQueries: [{ propertyName: "searchInput", first: true, predicate: ["searchInput"], descendants: true }], ngImport: i0, template: "<div class=\"search-box-component\">\n <i class=\"svg-icons\"\n (click)=\"activateSearchBox()\">\n <svg width=\"20\"\n height=\"20\"\n viewBox=\"0 0 20 20\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\">\n <circle cx=\"8.33333\"\n cy=\"8.33333\"\n r=\"5.83333\"\n stroke=\"#828282\"\n stroke-width=\"1.6\" />\n <path d=\"M17.5 17.5001L12.9166 12.9167\"\n stroke=\"#828282\"\n stroke-width=\"1.6\"\n stroke-linecap=\"round\" />\n </svg>\n </i>\n <input [(ngModel)]=\"text\"\n class=\"search-box\"\n (ngModelChange)=\"onChange()\"\n placeholder=\"{{placeholder}}\"\n #searchInput>\n <i class=\"material-icons close-icon\"\n *ngIf=\"text\"\n (click)=\"clear()\">close</i>\n</div>", styles: [".search-box-component{display:flex;flex-direction:row;justify-content:flex-start;align-items:center;gap:8px;width:100%;height:40px;background:#FFFFFF;border:1px solid #F2F2F2;box-sizing:border-box;border-radius:4px;padding:8px}.search-box-component:hover{border-color:#b8b9bc}.search-box-component:focus-within{box-shadow:0 0 2px 2px #2188d94d}.search-box-component input{border:0;font-style:normal;font-weight:400;font-size:14px;line-height:130%;width:100%;outline:none;color:#4f4f4f;font-family:Roboto}.search-box-component input::placeholder{color:#828282}.search-box-component .svg-icons{display:flex}.search-box-component .material-icons{color:#828282;-webkit-user-select:none;user-select:none}.search-box-component .material-icons.close-icon{cursor:pointer}\n"], dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { 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.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }] });
|
|
444
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: ZenduSearchBoxComponent, decorators: [{
|
|
445
|
+
type: Component,
|
|
446
|
+
args: [{ selector: 'zen-search-box', template: "<div class=\"search-box-component\">\n <i class=\"svg-icons\"\n (click)=\"activateSearchBox()\">\n <svg width=\"20\"\n height=\"20\"\n viewBox=\"0 0 20 20\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\">\n <circle cx=\"8.33333\"\n cy=\"8.33333\"\n r=\"5.83333\"\n stroke=\"#828282\"\n stroke-width=\"1.6\" />\n <path d=\"M17.5 17.5001L12.9166 12.9167\"\n stroke=\"#828282\"\n stroke-width=\"1.6\"\n stroke-linecap=\"round\" />\n </svg>\n </i>\n <input [(ngModel)]=\"text\"\n class=\"search-box\"\n (ngModelChange)=\"onChange()\"\n placeholder=\"{{placeholder}}\"\n #searchInput>\n <i class=\"material-icons close-icon\"\n *ngIf=\"text\"\n (click)=\"clear()\">close</i>\n</div>", styles: [".search-box-component{display:flex;flex-direction:row;justify-content:flex-start;align-items:center;gap:8px;width:100%;height:40px;background:#FFFFFF;border:1px solid #F2F2F2;box-sizing:border-box;border-radius:4px;padding:8px}.search-box-component:hover{border-color:#b8b9bc}.search-box-component:focus-within{box-shadow:0 0 2px 2px #2188d94d}.search-box-component input{border:0;font-style:normal;font-weight:400;font-size:14px;line-height:130%;width:100%;outline:none;color:#4f4f4f;font-family:Roboto}.search-box-component input::placeholder{color:#828282}.search-box-component .svg-icons{display:flex}.search-box-component .material-icons{color:#828282;-webkit-user-select:none;user-select:none}.search-box-component .material-icons.close-icon{cursor:pointer}\n"] }]
|
|
447
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.NgZone }]; }, propDecorators: { text: [{
|
|
448
|
+
type: Input
|
|
449
|
+
}], textChange: [{
|
|
450
|
+
type: Output
|
|
451
|
+
}], delay: [{
|
|
452
|
+
type: Input
|
|
453
|
+
}], autoFocus: [{
|
|
454
|
+
type: Input
|
|
455
|
+
}], placeholder: [{
|
|
456
|
+
type: Input
|
|
457
|
+
}], searchInput: [{
|
|
458
|
+
type: ViewChild,
|
|
459
|
+
args: ['searchInput', { static: false }]
|
|
460
|
+
}] } });
|
|
461
|
+
|
|
462
|
+
class ZenduColumnConfigurationComponent {
|
|
463
|
+
constructor(_element) {
|
|
464
|
+
this._element = _element;
|
|
465
|
+
/**
|
|
466
|
+
* callback to emit changes for parent component
|
|
467
|
+
*/
|
|
468
|
+
this.configurationChange = new EventEmitter();
|
|
469
|
+
/**
|
|
470
|
+
* input propery
|
|
471
|
+
*/
|
|
472
|
+
this.configuration = [];
|
|
473
|
+
/**
|
|
474
|
+
* Default configuration for reset button
|
|
475
|
+
*/
|
|
476
|
+
this.defaultConfiguration = [];
|
|
477
|
+
/**
|
|
478
|
+
* dropdown position
|
|
479
|
+
*/
|
|
480
|
+
this.dropdownPosition = 'right';
|
|
481
|
+
/**
|
|
482
|
+
* Inital configuration
|
|
483
|
+
*/
|
|
484
|
+
this._sourceConfiguration = [];
|
|
485
|
+
this.tempColumnConfiguration = [];
|
|
486
|
+
this.filteredColumnsConfiguration = [];
|
|
487
|
+
this.showPanel = false;
|
|
488
|
+
this.searchText = '';
|
|
489
|
+
}
|
|
490
|
+
outsideHandling(event) {
|
|
491
|
+
if (!document.body.contains(event.target)) {
|
|
492
|
+
// element not in the DOM
|
|
493
|
+
return;
|
|
494
|
+
}
|
|
495
|
+
if (this._element.nativeElement.contains(event.target)) {
|
|
496
|
+
return;
|
|
497
|
+
}
|
|
498
|
+
// hide the menu for outside click
|
|
499
|
+
this.hide();
|
|
500
|
+
}
|
|
501
|
+
ngOnChanges(changes) {
|
|
502
|
+
if (changes.configuration.currentValue && this.configuration) {
|
|
503
|
+
this.initData();
|
|
504
|
+
}
|
|
505
|
+
}
|
|
506
|
+
initData() {
|
|
507
|
+
this.tempColumnConfiguration = Util.clone(this.configuration);
|
|
508
|
+
this._sourceConfiguration = Util.clone(this.configuration);
|
|
509
|
+
this.filterItems();
|
|
510
|
+
}
|
|
511
|
+
togglePanel() {
|
|
512
|
+
this.showPanel = !this.showPanel;
|
|
513
|
+
// clear search
|
|
514
|
+
this.searchText = '';
|
|
515
|
+
if (this.showPanel) {
|
|
516
|
+
// restore inital values on open
|
|
517
|
+
this.tempColumnConfiguration = Util.clone(this._sourceConfiguration);
|
|
518
|
+
}
|
|
519
|
+
this.filterItems();
|
|
520
|
+
}
|
|
521
|
+
apply() {
|
|
522
|
+
this.configuration = Util.clone(this.tempColumnConfiguration);
|
|
523
|
+
// overwrite the default as well
|
|
524
|
+
this._sourceConfiguration = Util.clone(this.tempColumnConfiguration);
|
|
525
|
+
this.showPanel = false;
|
|
526
|
+
this.configurationChange.emit(this.configuration);
|
|
527
|
+
}
|
|
528
|
+
hide() {
|
|
529
|
+
this.showPanel = false;
|
|
530
|
+
}
|
|
531
|
+
onDrop(event) {
|
|
532
|
+
moveItemInArray(this.filteredColumnsConfiguration, event.previousIndex, event.currentIndex);
|
|
533
|
+
this.tempColumnConfiguration = this.filteredColumnsConfiguration;
|
|
534
|
+
}
|
|
535
|
+
reset() {
|
|
536
|
+
if (this.defaultConfiguration && this.defaultConfiguration.length) {
|
|
537
|
+
// use the default configuration
|
|
538
|
+
this.tempColumnConfiguration = Util.clone(this.defaultConfiguration);
|
|
539
|
+
}
|
|
540
|
+
else {
|
|
541
|
+
// activate all items
|
|
542
|
+
for (const item of this.tempColumnConfiguration) {
|
|
543
|
+
item.isVisible = true;
|
|
544
|
+
}
|
|
545
|
+
}
|
|
546
|
+
this.filterItems();
|
|
547
|
+
}
|
|
548
|
+
filterItems() {
|
|
549
|
+
this.filteredColumnsConfiguration = this.tempColumnConfiguration.filter((col) => col.displayName
|
|
550
|
+
.toLowerCase()
|
|
551
|
+
.includes(this.searchText.trim().toLowerCase()));
|
|
552
|
+
}
|
|
553
|
+
}
|
|
554
|
+
ZenduColumnConfigurationComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: ZenduColumnConfigurationComponent, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
555
|
+
ZenduColumnConfigurationComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.12", type: ZenduColumnConfigurationComponent, selector: "zen-column-configuration", inputs: { configuration: "configuration", defaultConfiguration: "defaultConfiguration", dropdownPosition: "dropdownPosition" }, outputs: { configurationChange: "configurationChange" }, host: { listeners: { "window:mousedown": "outsideHandling($event)" } }, usesOnChanges: true, ngImport: i0, template: "<div class=\"column-config-component\">\n <button class=\"button-basic button-icon\"\n [ngClass]=\"{ 'active': showPanel }\"\n (click)=\"togglePanel()\">\n <i class=\"material-icons\">view_column</i>\n </button>\n\n <div *ngIf=\"showPanel\"\n class=\"action-menu column-config-menu\"\n [ngClass]=\"{'right': dropdownPosition === 'right'}\">\n <div class=\"action-menu-header\">\n <div class=\"title\">Manage Columns</div>\n <zen-search-box [(text)]=\"searchText\"\n (textChange)=\"filterItems()\"></zen-search-box>\n </div>\n\n\n <div class=\"action-menu-body dnd-container\"\n cdkDropList\n (cdkDropListDropped)=\"onDrop($event)\">\n <div *ngFor=\"let config of filteredColumnsConfiguration\"\n class=\"action-item-checkbox drag-item\"\n cdkDrag>\n <zen-checkbox class=\"flex-1\"\n [(checked)]=\"config.isVisible\"\n [label]=\"config.displayName\"></zen-checkbox>\n <i class=\"material-icons drag-icon\">drag_handle</i>\n </div>\n </div>\n\n <div class=\"action-menu-footer\">\n <button (click)=\"reset()\"\n type=\"button\"\n class=\"button-stroked full-width\">Reset</button>\n <button (click)=\"apply()\"\n type=\"button\"\n class=\"button-flat full-width\">Apply</button>\n </div>\n </div>\n</div>\n", styles: [".column-config-component{display:inline-block;position:relative}.column-config-component .column-config-menu{top:115%;width:300px}.column-config-component .column-config-menu.right{right:0}.column-config-component .column-config-menu .dnd-container{max-height:218px;overflow-y:auto}.column-config-component .column-config-menu .dnd-container .drag-item{justify-content:space-between}.column-config-component .column-config-menu .dnd-container .drag-item .drag-icon{cursor:move;color:#b8b9bc}.column-config-component .column-config-menu .dnd-container .dndDraggingSource{display:none}.column-config-component .column-config-menu .dnd-container .dndPlaceholder{background-color:#b8b9bc;display:block;min-height:40px}\n"], dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2$1.CdkDropList, selector: "[cdkDropList], cdk-drop-list", inputs: ["cdkDropListConnectedTo", "cdkDropListData", "cdkDropListOrientation", "id", "cdkDropListLockAxis", "cdkDropListDisabled", "cdkDropListSortingDisabled", "cdkDropListEnterPredicate", "cdkDropListSortPredicate", "cdkDropListAutoScrollDisabled", "cdkDropListAutoScrollStep"], outputs: ["cdkDropListDropped", "cdkDropListEntered", "cdkDropListExited", "cdkDropListSorted"], exportAs: ["cdkDropList"] }, { kind: "directive", type: i2$1.CdkDrag, selector: "[cdkDrag]", inputs: ["cdkDragData", "cdkDragLockAxis", "cdkDragRootElement", "cdkDragBoundary", "cdkDragStartDelay", "cdkDragFreeDragPosition", "cdkDragDisabled", "cdkDragConstrainPosition", "cdkDragPreviewClass", "cdkDragPreviewContainer"], outputs: ["cdkDragStarted", "cdkDragReleased", "cdkDragEnded", "cdkDragEntered", "cdkDragExited", "cdkDragDropped", "cdkDragMoved"], exportAs: ["cdkDrag"] }, { kind: "component", type: ZenduCheckboxComponent, selector: "zen-checkbox", inputs: ["checked", "label", "disabled", "disableValueChange", "indeterminate", "imageUrl"], outputs: ["checkedChange"] }, { kind: "component", type: ZenduSearchBoxComponent, selector: "zen-search-box", inputs: ["text", "delay", "autoFocus", "placeholder"], outputs: ["textChange"] }] });
|
|
556
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: ZenduColumnConfigurationComponent, decorators: [{
|
|
557
|
+
type: Component,
|
|
558
|
+
args: [{ selector: 'zen-column-configuration', template: "<div class=\"column-config-component\">\n <button class=\"button-basic button-icon\"\n [ngClass]=\"{ 'active': showPanel }\"\n (click)=\"togglePanel()\">\n <i class=\"material-icons\">view_column</i>\n </button>\n\n <div *ngIf=\"showPanel\"\n class=\"action-menu column-config-menu\"\n [ngClass]=\"{'right': dropdownPosition === 'right'}\">\n <div class=\"action-menu-header\">\n <div class=\"title\">Manage Columns</div>\n <zen-search-box [(text)]=\"searchText\"\n (textChange)=\"filterItems()\"></zen-search-box>\n </div>\n\n\n <div class=\"action-menu-body dnd-container\"\n cdkDropList\n (cdkDropListDropped)=\"onDrop($event)\">\n <div *ngFor=\"let config of filteredColumnsConfiguration\"\n class=\"action-item-checkbox drag-item\"\n cdkDrag>\n <zen-checkbox class=\"flex-1\"\n [(checked)]=\"config.isVisible\"\n [label]=\"config.displayName\"></zen-checkbox>\n <i class=\"material-icons drag-icon\">drag_handle</i>\n </div>\n </div>\n\n <div class=\"action-menu-footer\">\n <button (click)=\"reset()\"\n type=\"button\"\n class=\"button-stroked full-width\">Reset</button>\n <button (click)=\"apply()\"\n type=\"button\"\n class=\"button-flat full-width\">Apply</button>\n </div>\n </div>\n</div>\n", styles: [".column-config-component{display:inline-block;position:relative}.column-config-component .column-config-menu{top:115%;width:300px}.column-config-component .column-config-menu.right{right:0}.column-config-component .column-config-menu .dnd-container{max-height:218px;overflow-y:auto}.column-config-component .column-config-menu .dnd-container .drag-item{justify-content:space-between}.column-config-component .column-config-menu .dnd-container .drag-item .drag-icon{cursor:move;color:#b8b9bc}.column-config-component .column-config-menu .dnd-container .dndDraggingSource{display:none}.column-config-component .column-config-menu .dnd-container .dndPlaceholder{background-color:#b8b9bc;display:block;min-height:40px}\n"] }]
|
|
559
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef }]; }, propDecorators: { configurationChange: [{
|
|
560
|
+
type: Output
|
|
561
|
+
}], configuration: [{
|
|
562
|
+
type: Input
|
|
563
|
+
}], defaultConfiguration: [{
|
|
564
|
+
type: Input
|
|
565
|
+
}], dropdownPosition: [{
|
|
566
|
+
type: Input
|
|
567
|
+
}], outsideHandling: [{
|
|
568
|
+
type: HostListener,
|
|
569
|
+
args: ['window:mousedown', ['$event']]
|
|
570
|
+
}] } });
|
|
571
|
+
|
|
572
|
+
var DATEPICKER_POSITION;
|
|
573
|
+
(function (DATEPICKER_POSITION) {
|
|
574
|
+
DATEPICKER_POSITION["AUTO"] = "auto";
|
|
575
|
+
DATEPICKER_POSITION["LEFT"] = "left";
|
|
576
|
+
DATEPICKER_POSITION["RIGHT"] = "right";
|
|
577
|
+
DATEPICKER_POSITION["TOP"] = "top";
|
|
578
|
+
DATEPICKER_POSITION["BOTTOM"] = "bottom";
|
|
579
|
+
})(DATEPICKER_POSITION || (DATEPICKER_POSITION = {}));
|
|
580
|
+
|
|
581
|
+
class ZenduIconComponent {
|
|
582
|
+
constructor(_host) {
|
|
583
|
+
this._host = _host;
|
|
584
|
+
}
|
|
585
|
+
ngOnChanges(changes) {
|
|
586
|
+
if (this.src) {
|
|
587
|
+
// apply styles to host
|
|
588
|
+
const host = this._host.nativeElement;
|
|
589
|
+
host.style["mask-image"] = `url(${this.src})`;
|
|
590
|
+
host.style["-webkit-mask-image"] = `url(${this.src})`;
|
|
591
|
+
}
|
|
592
|
+
}
|
|
593
|
+
}
|
|
594
|
+
ZenduIconComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: ZenduIconComponent, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
595
|
+
ZenduIconComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.12", type: ZenduIconComponent, selector: "zen-icon", inputs: { src: "src" }, usesOnChanges: true, ngImport: i0, template: "", styles: [":host{background-color:#000;width:24px;height:24px;-webkit-mask-size:contain;mask-size:contain;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat;display:block}\n"] });
|
|
596
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: ZenduIconComponent, decorators: [{
|
|
597
|
+
type: Component,
|
|
598
|
+
args: [{ selector: 'zen-icon', template: "", styles: [":host{background-color:#000;width:24px;height:24px;-webkit-mask-size:contain;mask-size:contain;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat;display:block}\n"] }]
|
|
599
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef }]; }, propDecorators: { src: [{
|
|
600
|
+
type: Input
|
|
601
|
+
}] } });
|
|
602
|
+
|
|
603
|
+
const defaultHours = '12';
|
|
604
|
+
const defaultMinuts = '00';
|
|
605
|
+
class ZenduDatepickerComponent {
|
|
606
|
+
constructor(_element) {
|
|
607
|
+
this._element = _element;
|
|
608
|
+
/**
|
|
609
|
+
* callback to emit changes for parent component
|
|
610
|
+
*/
|
|
611
|
+
this.dateChange = new EventEmitter();
|
|
612
|
+
this.showTime = false;
|
|
613
|
+
this.showDate = true;
|
|
614
|
+
this.boxDesign = false;
|
|
615
|
+
this.highlightDays = [];
|
|
616
|
+
this.autoConfirm = false;
|
|
617
|
+
/**
|
|
618
|
+
* datepicker states
|
|
619
|
+
*/
|
|
620
|
+
this.highlightError = false;
|
|
621
|
+
this.disabled = false;
|
|
622
|
+
this.readonly = false;
|
|
623
|
+
this.xPosition = DATEPICKER_POSITION.AUTO;
|
|
624
|
+
this.yPosition = DATEPICKER_POSITION.AUTO;
|
|
625
|
+
this.selectedTime = { Hr: 1, Min: 0 };
|
|
626
|
+
this.isPickerVisible = false;
|
|
627
|
+
this.dayRows = [];
|
|
628
|
+
this.daysTitle = "";
|
|
629
|
+
this.weekDays = ["Mo", "Tu", "We", "Th", "Fri", "Sa", "Su"];
|
|
630
|
+
this.currentSlot = new Date();
|
|
631
|
+
this.hour = defaultHours;
|
|
632
|
+
this.min = defaultMinuts;
|
|
633
|
+
this.isPM = false;
|
|
634
|
+
this.months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
|
|
635
|
+
this.years = [];
|
|
636
|
+
this.monthPickerVisible = false;
|
|
637
|
+
this.yearPickerVisible = false;
|
|
638
|
+
this.right = false;
|
|
639
|
+
this.bottom = false;
|
|
640
|
+
}
|
|
641
|
+
outsideHandling(event) {
|
|
642
|
+
if (!document.body.contains(event.target)) {
|
|
643
|
+
// element not in the DOM
|
|
644
|
+
return;
|
|
645
|
+
}
|
|
646
|
+
if (this._element.nativeElement.contains(event.target)) {
|
|
647
|
+
return;
|
|
648
|
+
}
|
|
649
|
+
this.hideTimePicker();
|
|
650
|
+
}
|
|
651
|
+
scroll() {
|
|
652
|
+
this.updatePlacement();
|
|
653
|
+
}
|
|
654
|
+
ngOnChanges(changes) {
|
|
655
|
+
if (this.date) {
|
|
656
|
+
this._dateToSet = new Date(this.date);
|
|
657
|
+
this.selectedTime = {
|
|
658
|
+
Hr: moment(this.date).hours(),
|
|
659
|
+
Min: moment(this.date).minutes()
|
|
660
|
+
};
|
|
661
|
+
}
|
|
662
|
+
}
|
|
663
|
+
updatePlacement() {
|
|
664
|
+
this.right = false;
|
|
665
|
+
this.bottom = false;
|
|
666
|
+
if (this.xPosition === DATEPICKER_POSITION.AUTO && this.getHorizontalMenuDirection() === DATEPICKER_POSITION.LEFT) {
|
|
667
|
+
this.right = true;
|
|
668
|
+
}
|
|
669
|
+
if (this.yPosition === DATEPICKER_POSITION.AUTO && this.getVerticalMenuDirection() === DATEPICKER_POSITION.TOP) {
|
|
670
|
+
this.bottom = true;
|
|
671
|
+
}
|
|
672
|
+
if (this.xPosition === DATEPICKER_POSITION.RIGHT) {
|
|
673
|
+
this.right = true;
|
|
674
|
+
}
|
|
675
|
+
if (this.yPosition === DATEPICKER_POSITION.TOP) {
|
|
676
|
+
this.bottom = true;
|
|
677
|
+
}
|
|
678
|
+
}
|
|
679
|
+
getVerticalMenuDirection() {
|
|
680
|
+
const element = this._element.nativeElement;
|
|
681
|
+
const top = element.getBoundingClientRect().top;
|
|
682
|
+
const height = window.innerHeight;
|
|
683
|
+
if (top > (height / 2)) {
|
|
684
|
+
return DATEPICKER_POSITION.TOP;
|
|
685
|
+
}
|
|
686
|
+
else {
|
|
687
|
+
return DATEPICKER_POSITION.BOTTOM;
|
|
688
|
+
}
|
|
689
|
+
}
|
|
690
|
+
/**
|
|
691
|
+
* Used to get datepicker position
|
|
692
|
+
* @returns either "left" or "right"
|
|
693
|
+
*/
|
|
694
|
+
getHorizontalMenuDirection() {
|
|
695
|
+
const element = this._element.nativeElement;
|
|
696
|
+
const left = element.getBoundingClientRect().left;
|
|
697
|
+
const width = window.innerWidth;
|
|
698
|
+
if (left > (width / 2)) {
|
|
699
|
+
return DATEPICKER_POSITION.LEFT;
|
|
700
|
+
}
|
|
701
|
+
else {
|
|
702
|
+
return DATEPICKER_POSITION.RIGHT;
|
|
703
|
+
}
|
|
704
|
+
}
|
|
705
|
+
togglePicker() {
|
|
706
|
+
if (this.disabled)
|
|
707
|
+
return;
|
|
708
|
+
this._dateToSet = this.date ? new Date(this.date) : null;
|
|
709
|
+
this.isPickerVisible = !this.isPickerVisible;
|
|
710
|
+
if (this.showDate) {
|
|
711
|
+
this.currentSlot = this._dateToSet || new Date();
|
|
712
|
+
this.updateDays();
|
|
713
|
+
}
|
|
714
|
+
if (this.showTime) {
|
|
715
|
+
this.selectedTime = {
|
|
716
|
+
Hr: moment(this.date).hours(),
|
|
717
|
+
Min: moment(this.date).minutes()
|
|
718
|
+
};
|
|
719
|
+
if (this.date) {
|
|
720
|
+
const formatted = moment(this.date).format('hh:mm A');
|
|
721
|
+
this.isPM = formatted.includes('PM');
|
|
722
|
+
this.hour = formatted.slice(0, 2);
|
|
723
|
+
this.min = formatted.slice(3, 5);
|
|
724
|
+
}
|
|
725
|
+
}
|
|
726
|
+
this.updatePlacement();
|
|
727
|
+
}
|
|
728
|
+
updateDays() {
|
|
729
|
+
if (!this.currentSlot) {
|
|
730
|
+
this.currentSlot = new Date();
|
|
731
|
+
}
|
|
732
|
+
this.daysTitle = moment(this.currentSlot).format("MMM yyyy");
|
|
733
|
+
this.dayRows = [];
|
|
734
|
+
let current = moment(this.currentSlot).startOf("month").startOf("week").add(1, "day");
|
|
735
|
+
let end = moment(this.currentSlot).endOf("month").endOf("week").add(1, "day");
|
|
736
|
+
const currentMonth = moment(this.currentSlot).month();
|
|
737
|
+
const date = moment(this._dateToSet);
|
|
738
|
+
while (current <= end) {
|
|
739
|
+
const row = { days: [] };
|
|
740
|
+
this.dayRows.push(row);
|
|
741
|
+
for (let idx = 0; idx < 7; idx++) {
|
|
742
|
+
let isSelected = false;
|
|
743
|
+
if (date) {
|
|
744
|
+
isSelected = current.date() == date.date() &&
|
|
745
|
+
date.month() == current.month();
|
|
746
|
+
}
|
|
747
|
+
let isOutside = currentMonth != current.month();
|
|
748
|
+
let isDisabled = false;
|
|
749
|
+
if (this.minDate && current.toDate() < this.minDate) {
|
|
750
|
+
isDisabled = true;
|
|
751
|
+
}
|
|
752
|
+
else if (this.maxDate && current.toDate() > this.maxDate) {
|
|
753
|
+
isDisabled = true;
|
|
754
|
+
}
|
|
755
|
+
let isHighlighted = false;
|
|
756
|
+
if (this.highlightDays && this.highlightDays.length) {
|
|
757
|
+
isHighlighted = this.highlightDays.indexOf(current.valueOf()) >= 0;
|
|
758
|
+
}
|
|
759
|
+
row.days.push({
|
|
760
|
+
date: current.toDate(),
|
|
761
|
+
lbl: moment(current).date().toString(),
|
|
762
|
+
isOutside: isOutside,
|
|
763
|
+
selected: isSelected,
|
|
764
|
+
isDisabled: isDisabled,
|
|
765
|
+
isHighlighted: isHighlighted
|
|
766
|
+
});
|
|
767
|
+
current = moment(current).add(1, "day");
|
|
768
|
+
}
|
|
769
|
+
}
|
|
770
|
+
}
|
|
771
|
+
nextMonth() {
|
|
772
|
+
this.currentSlot = moment(this.currentSlot).add(1, "month").toDate();
|
|
773
|
+
this.updateDays();
|
|
774
|
+
}
|
|
775
|
+
prevMonth() {
|
|
776
|
+
this.currentSlot = moment(this.currentSlot).subtract(1, "month").toDate();
|
|
777
|
+
this.updateDays();
|
|
778
|
+
}
|
|
779
|
+
nextYear() {
|
|
780
|
+
this.currentSlot = moment(this.currentSlot).add(1, "year").toDate();
|
|
781
|
+
this.updateDays();
|
|
782
|
+
}
|
|
783
|
+
prevYear() {
|
|
784
|
+
this.currentSlot = moment(this.currentSlot).subtract(1, "year").toDate();
|
|
785
|
+
this.updateDays();
|
|
786
|
+
}
|
|
787
|
+
nextYearGroup() {
|
|
788
|
+
this.years = this.years.map(year => year + 15);
|
|
789
|
+
}
|
|
790
|
+
prevYearGroup() {
|
|
791
|
+
this.years = this.years.map(year => year - 15);
|
|
792
|
+
}
|
|
793
|
+
selectDay(day) {
|
|
794
|
+
if (day.isDisabled) {
|
|
795
|
+
// day is disabled
|
|
796
|
+
return;
|
|
797
|
+
}
|
|
798
|
+
if (this.showTime) {
|
|
799
|
+
this._dateToSet = moment(day.date).hour(this.selectedTime.Hr).minute(this.selectedTime.Min).toDate();
|
|
800
|
+
}
|
|
801
|
+
else {
|
|
802
|
+
this._dateToSet = new Date(day.date);
|
|
803
|
+
if (this.autoConfirm) {
|
|
804
|
+
this.apply();
|
|
805
|
+
}
|
|
806
|
+
}
|
|
807
|
+
this.updateDays();
|
|
808
|
+
}
|
|
809
|
+
selectMonth(month) {
|
|
810
|
+
const newDate = new Date(this.currentSlot);
|
|
811
|
+
newDate.setMonth(month);
|
|
812
|
+
this.currentSlot = newDate;
|
|
813
|
+
this.updateDays();
|
|
814
|
+
this.monthPickerVisible = false;
|
|
815
|
+
}
|
|
816
|
+
selectYear(year) {
|
|
817
|
+
const newDate = new Date(this.currentSlot);
|
|
818
|
+
newDate.setFullYear(year);
|
|
819
|
+
this.currentSlot = newDate;
|
|
820
|
+
this.updateDays();
|
|
821
|
+
this.yearPickerVisible = false;
|
|
822
|
+
}
|
|
823
|
+
hideTimePicker() {
|
|
824
|
+
this.isPickerVisible = false;
|
|
825
|
+
}
|
|
826
|
+
timeChanged() {
|
|
827
|
+
let min = parseInt(this.min);
|
|
828
|
+
let hour = parseInt(this.hour);
|
|
829
|
+
if (isNaN(hour) || isNaN(min)) {
|
|
830
|
+
return;
|
|
831
|
+
}
|
|
832
|
+
hour = Math.min(hour, 12);
|
|
833
|
+
hour = Math.max(hour, 1);
|
|
834
|
+
min = Math.min(min, 59);
|
|
835
|
+
min = Math.max(min, 0);
|
|
836
|
+
const time = moment(`${hour} ${min} ${this.isPM ? "pm" : "am"}`, "h:m a");
|
|
837
|
+
this.selectedTime = {
|
|
838
|
+
Hr: time.hours(),
|
|
839
|
+
Min: time.minutes()
|
|
840
|
+
};
|
|
841
|
+
// added below condition because we can select the time without date, and it was showing invalid date in the input box
|
|
842
|
+
// second condition is required to disable apply button when date is not selected
|
|
843
|
+
if (this._dateToSet) {
|
|
844
|
+
this._dateToSet = moment(this._dateToSet).hour(this.selectedTime.Hr).minute(this.selectedTime.Min).toDate();
|
|
845
|
+
}
|
|
846
|
+
else if (!this.showDate) {
|
|
847
|
+
this._dateToSet = moment().hour(this.selectedTime.Hr).minute(this.selectedTime.Min).toDate();
|
|
848
|
+
}
|
|
849
|
+
// format
|
|
850
|
+
if (hour < 10) {
|
|
851
|
+
this.hour = `0${hour}`;
|
|
852
|
+
}
|
|
853
|
+
else {
|
|
854
|
+
this.hour = `${hour}`;
|
|
855
|
+
}
|
|
856
|
+
if (min < 10) {
|
|
857
|
+
this.min = `0${min}`;
|
|
858
|
+
}
|
|
859
|
+
else {
|
|
860
|
+
this.min = `${min}`;
|
|
861
|
+
}
|
|
862
|
+
}
|
|
863
|
+
formattedDate() {
|
|
864
|
+
if (!this.date) {
|
|
865
|
+
return "";
|
|
866
|
+
}
|
|
867
|
+
if (this.boxDesign && moment(this.date).isSame(moment(), "day")) {
|
|
868
|
+
return 'Today';
|
|
869
|
+
}
|
|
870
|
+
if (this.showDate && !this.showTime && !this.boxDesign) {
|
|
871
|
+
// Expanded formatting for date only picker
|
|
872
|
+
return moment(this.date).format("ddd, DD MMM YYYY");
|
|
873
|
+
}
|
|
874
|
+
return moment(this.date).format("MMM DD, YY");
|
|
875
|
+
}
|
|
876
|
+
formattedTime() {
|
|
877
|
+
if (!this.date) {
|
|
878
|
+
return "";
|
|
879
|
+
}
|
|
880
|
+
return moment(this.date).format("h:mm A");
|
|
881
|
+
}
|
|
882
|
+
toggleTime() {
|
|
883
|
+
this.isPM = !this.isPM;
|
|
884
|
+
this.timeChanged();
|
|
885
|
+
}
|
|
886
|
+
showMonthPicker() {
|
|
887
|
+
this.monthPickerVisible = true;
|
|
888
|
+
}
|
|
889
|
+
showYearPicker() {
|
|
890
|
+
this.yearPickerVisible = true;
|
|
891
|
+
this.years = [];
|
|
892
|
+
for (let i = this.currentSlot.getFullYear() - 7; i < this.currentSlot.getFullYear() + 8; i++) {
|
|
893
|
+
this.years.push(i);
|
|
894
|
+
}
|
|
895
|
+
}
|
|
896
|
+
hourUp() {
|
|
897
|
+
let hour = parseInt(this.hour);
|
|
898
|
+
if (isNaN(hour)) {
|
|
899
|
+
return;
|
|
900
|
+
}
|
|
901
|
+
hour++;
|
|
902
|
+
this.hour = hour.toString();
|
|
903
|
+
this.timeChanged();
|
|
904
|
+
}
|
|
905
|
+
hourDown() {
|
|
906
|
+
let hour = parseInt(this.hour);
|
|
907
|
+
if (isNaN(hour)) {
|
|
908
|
+
return;
|
|
909
|
+
}
|
|
910
|
+
hour--;
|
|
911
|
+
this.hour = hour.toString();
|
|
912
|
+
this.timeChanged();
|
|
913
|
+
}
|
|
914
|
+
minUp() {
|
|
915
|
+
let min = parseInt(this.min);
|
|
916
|
+
if (isNaN(min)) {
|
|
917
|
+
return;
|
|
918
|
+
}
|
|
919
|
+
min++;
|
|
920
|
+
this.min = min.toString();
|
|
921
|
+
this.timeChanged();
|
|
922
|
+
}
|
|
923
|
+
minDown() {
|
|
924
|
+
let min = parseInt(this.min);
|
|
925
|
+
if (isNaN(min)) {
|
|
926
|
+
return;
|
|
927
|
+
}
|
|
928
|
+
min--;
|
|
929
|
+
this.min = min.toString();
|
|
930
|
+
this.timeChanged();
|
|
931
|
+
}
|
|
932
|
+
apply() {
|
|
933
|
+
if (this._dateToSet) {
|
|
934
|
+
// If time selection has enabled and user keeps default time then triggering the timeChanged function
|
|
935
|
+
if (this.showTime && this.hour === defaultHours && this.min === defaultMinuts) {
|
|
936
|
+
this.timeChanged();
|
|
937
|
+
}
|
|
938
|
+
this.date = new Date(this._dateToSet);
|
|
939
|
+
}
|
|
940
|
+
this.dateChange.emit(this.date);
|
|
941
|
+
this.hideTimePicker();
|
|
942
|
+
}
|
|
943
|
+
cancel() {
|
|
944
|
+
this.hideTimePicker();
|
|
945
|
+
}
|
|
946
|
+
clear() {
|
|
947
|
+
this._dateToSet = null;
|
|
948
|
+
this.hour = defaultHours;
|
|
949
|
+
this.min = defaultMinuts;
|
|
950
|
+
this.date = null;
|
|
951
|
+
this.apply();
|
|
952
|
+
}
|
|
953
|
+
getIcon() {
|
|
954
|
+
// Change picker icon based on mode
|
|
955
|
+
switch (true) {
|
|
956
|
+
case this.showDate && this.showTime:
|
|
957
|
+
// Date + Time
|
|
958
|
+
return 'assets/ng-zenduit/icons/date.svg';
|
|
959
|
+
case this.showDate && !this.showTime:
|
|
960
|
+
// Date only
|
|
961
|
+
return 'assets/ng-zenduit/icons/calendar.svg';
|
|
962
|
+
case !this.showDate && this.showTime:
|
|
963
|
+
// Time only
|
|
964
|
+
return 'assets/ng-zenduit/icons/time.svg';
|
|
965
|
+
default:
|
|
966
|
+
return 'assets/ng-zenduit/icons/date.svg';
|
|
967
|
+
}
|
|
968
|
+
}
|
|
969
|
+
selectHintDate(date) {
|
|
970
|
+
if (!date) {
|
|
971
|
+
console.error('Invalid hint');
|
|
972
|
+
return;
|
|
973
|
+
}
|
|
974
|
+
this._dateToSet = new Date(date);
|
|
975
|
+
this.selectedTime = {
|
|
976
|
+
Hr: moment(date).hours(),
|
|
977
|
+
Min: moment(date).minutes()
|
|
978
|
+
};
|
|
979
|
+
if (this.autoConfirm) {
|
|
980
|
+
this.apply();
|
|
981
|
+
}
|
|
982
|
+
this.updateDays();
|
|
983
|
+
}
|
|
984
|
+
}
|
|
985
|
+
ZenduDatepickerComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: ZenduDatepickerComponent, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
986
|
+
ZenduDatepickerComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.12", type: ZenduDatepickerComponent, selector: "zen-datepicker", inputs: { date: "date", showTime: "showTime", showDate: "showDate", containerClass: "containerClass", minDate: "minDate", maxDate: "maxDate", boxDesign: "boxDesign", highlightDays: "highlightDays", autoConfirm: "autoConfirm", hint: "hint", highlightError: "highlightError", disabled: "disabled", readonly: "readonly", xPosition: "xPosition", yPosition: "yPosition" }, outputs: { dateChange: "dateChange" }, host: { listeners: { "window:mousedown": "outsideHandling($event)", "window:scroll": "scroll()" } }, usesOnChanges: true, ngImport: i0, template: "<div class=\"date-component\">\n <!-- Material design datepicker toggle -->\n <ng-container *ngIf=\"!boxDesign\">\n <button class=\"date-toggle\"\n [disabled]=\"disabled || readonly\"\n (click)=\"togglePicker()\"\n [ngClass]=\"{'active': isPickerVisible,'error': highlightError,'readonly': readonly}\">\n\n <div class=\"date-content\">\n <!-- date placeholder -->\n <div class=\"date-placeholder\"\n *ngIf=\"!date\">\n Select Date\n </div>\n\n <!-- Selected datetime -->\n <div *ngIf=\"date\">\n <span *ngIf=\"showDate\">{{formattedDate()}}</span>\n <span *ngIf=\"showTime\"> {{formattedTime()}}</span>\n </div>\n </div>\n\n <!-- Datepicker icon, depends on picker type -->\n <zen-icon class=\"date-icon\"\n [src]=\"getIcon()\"\n [ngClass]=\"{'filled': date}\">\n </zen-icon>\n </button>\n </ng-container>\n\n <!-- Box design datepicker toggle -->\n <ng-container *ngIf=\"boxDesign\">\n <button class=\"date-toggle new-box-design\"\n [disabled]=\"disabled || readonly\"\n (click)=\"togglePicker()\"\n [ngClass]=\"{'active': isPickerVisible,'error': highlightError,'readonly': readonly}\">\n\n <!-- Datepicker icon, depends on picker type -->\n <zen-icon class=\"date-icon\"\n [src]=\"getIcon()\"\n [ngClass]=\"{'filled': date}\">\n </zen-icon>\n\n <div class=\"date-content new-box-design\">\n <!-- date placeholder -->\n <div class=\"date-placeholder\"\n *ngIf=\"!date\">\n Select Date\n </div>\n\n <!-- Selected datetime -->\n <div *ngIf=\"date\">\n <span *ngIf=\"showDate\">{{formattedDate()}}</span>\n <span *ngIf=\"showTime\"> {{formattedTime()}}</span>\n </div>\n </div>\n </button>\n </ng-container>\n\n <!-- Datepicker popup -->\n <div *ngIf=\"isPickerVisible\"\n class=\"date-menu\"\n [ngClass]=\"{ 'right': right, 'bottom': bottom }\">\n <div class=\"date-modal\">\n <ng-container *ngIf=\"showDate\">\n <div class=\"days-toolbar\">\n <i (click)=\"prevMonth()\"\n class=\"material-icons\">navigate_before</i>\n <span class=\"title\"\n (click)=\"showMonthPicker()\">{{daysTitle}}</span>\n <i (click)=\"nextMonth()\"\n class=\"material-icons\">navigate_next</i>\n </div>\n <div class=\"days-container\">\n <div class=\"week-days\">\n <div *ngFor=\"let weekDay of weekDays\"\n class=\"week-day\">\n {{weekDay}}\n </div>\n </div>\n <div *ngFor=\"let row of dayRows\"\n class=\"day-row\">\n <div *ngFor=\"let day of row.days\"\n (click)=\"selectDay(day)\"\n class=\"day-item\"\n [class.ousideRange]=\"day.isOutside\"\n [class.selected]=\"day.selected\"\n [class.disabledDay]=\"day.isDisabled\">\n {{day.lbl}}\n <zen-icon *ngIf=\"day.isHighlighted\"\n class=\"highlight-icon\"\n src=\"assets/ng-zenduit/icons/play.svg\"></zen-icon>\n </div>\n </div>\n </div>\n </ng-container>\n\n <div *ngIf=\"showTime\"\n class=\"time-container\">\n\n <div class=\"time-lbl\">\n Select Time:\n </div>\n\n <div class=\"time-picker\">\n <div class=\"input-wrapper\">\n <zen-icon (click)=\"hourUp()\"\n src=\"assets/ng-zenduit/icons/arrow-up-small.svg\"></zen-icon>\n <input [(ngModel)]=\"hour\"\n (ngModelChange)=\"timeChanged()\" />\n <zen-icon (click)=\"hourDown()\"\n src=\"assets/ng-zenduit/icons/arrow-down-small.svg\"></zen-icon>\n </div>\n <label>:</label>\n <div class=\"input-wrapper\">\n <zen-icon (click)=\"minUp()\"\n src=\"assets/ng-zenduit/icons/arrow-up-small.svg\"></zen-icon>\n <input [(ngModel)]=\"min\"\n (ngModelChange)=\"timeChanged()\" />\n <zen-icon (click)=\"minDown()\"\n src=\"assets/ng-zenduit/icons/arrow-down-small.svg\"></zen-icon>\n </div>\n <div class=\"am-pm-picker\">\n <div class=\"main\"\n (click)=\"toggleTime()\">\n {{isPM ? 'PM' : 'AM'}}\n </div>\n <div class=\"sub\"\n (click)=\"toggleTime()\">\n {{isPM ? 'AM' : 'PM'}}\n </div>\n </div>\n </div>\n </div>\n\n <div class=\"hint\"\n *ngIf=\"hint\">\n <div class=\"hint-description\">\n {{hint.description}}\n </div>\n <div class=\"hint-date\"\n (click)=\"selectHintDate(hint.date)\">\n {{hint.maskText}}\n </div>\n </div>\n\n <div class=\"footer\"\n *ngIf=\"!autoConfirm || showTime\">\n <button *ngIf=\"date\"\n (click)=\"clear()\"\n class=\"button-stroked\">\n Clear\n </button>\n <button *ngIf=\"!date\"\n (click)=\"cancel()\"\n class=\"button-stroked\">\n Cancel\n </button>\n <button [disabled]=\"!_dateToSet\"\n (click)=\"apply()\"\n class=\"button-flat\">\n Apply\n </button>\n </div>\n\n <ng-container *ngIf=\"monthPickerVisible\">\n <div class=\"month-picker\">\n <div class=\"days-toolbar\">\n <i (click)=\"prevYear()\"\n class=\"material-icons\">navigate_before</i>\n <span class=\"title\"\n (click)=\"showYearPicker()\">{{ currentSlot | date: 'yyyy' }}</span>\n <i (click)=\"nextYear()\"\n class=\"material-icons\">navigate_next</i>\n </div>\n <div class=\"months-container\">\n <div class=\"month-item\"\n *ngFor=\"let month of months; index as index\"\n (click)=\"selectMonth(index)\">\n {{ month }}\n </div>\n </div>\n </div>\n </ng-container>\n\n <ng-container *ngIf=\"yearPickerVisible\">\n <div class=\"month-picker\">\n <div class=\"days-toolbar\">\n <i (click)=\"prevYearGroup()\"\n class=\"material-icons\">navigate_before</i>\n <span class=\"title\"\n (click)=\"showYearPicker()\">{{ currentSlot | date: 'yyyy' }}</span>\n <i (click)=\"nextYearGroup()\"\n class=\"material-icons\">navigate_next</i>\n </div>\n <div class=\"months-container\">\n <div class=\"month-item\"\n *ngFor=\"let year of years\"\n (click)=\"selectYear(year)\">\n {{ year }}\n </div>\n </div>\n </div>\n </ng-container>\n </div>\n <div class=\"date-modal-extra-space\"></div>\n </div>\n</div>\n", styles: [".date-component{width:100%;position:relative}.date-component .date-toggle{display:flex;align-items:center;justify-content:space-between;position:relative;gap:9px;transition:.3s;width:100%;background:var(--color-white-primary, #ffffff);-webkit-appearance:none;appearance:none;outline:none;cursor:pointer;border:none;border-radius:0;border-bottom:1px solid var(--color-white-tint-4, #d6d6d8);padding:0 0 8px;font-size:14px;font-style:normal;font-weight:400;line-height:130%;color:var(--color-grey-primary, #4f4f4f)}.date-component .date-toggle.new-box-design{border:1px solid var(--color-white-tint-1, #f2f2f2);border-radius:2px;padding:6px 12px;gap:4px!important}.date-component .date-toggle:hover .date-placeholder{color:var(--color-grey-shade-2, #828282)}.date-component .date-toggle:hover .date-icon{background-color:var(--color-grey-shade-2, #828282)}.date-component .date-toggle:focus,.date-component .date-toggle.active{border-color:var(--color-blue-primary, #2188d9)}.date-component .date-toggle:focus .date-icon,.date-component .date-toggle.active .date-icon{background-color:var(--color-blue-primary, #2188d9)!important}.date-component .date-toggle[disabled]{cursor:not-allowed;border-color:var(--color-white-tint-3, #e0e0e0)}.date-component .date-toggle[disabled] .date-content{color:var(--color-white-tint-3, #e0e0e0)!important}.date-component .date-toggle[disabled] .date-icon{background-color:var(--color-white-tint-3, #e0e0e0)!important}.date-component .date-toggle.readonly{cursor:default;border-color:var(--color-white-tint-3, #e0e0e0)}.date-component .date-toggle.readonly .date-content{color:var(--color-white-tint-3, #e0e0e0)!important}.date-component .date-toggle.readonly .date-icon{background-color:var(--color-white-tint-3, #e0e0e0)!important}.date-component .date-toggle.error{border-color:var(--color-error-primary, #dc3e33)}.date-component .date-toggle.error .date-icon{background-color:var(--color-error-primary, #dc3e33)!important}.date-component .date-toggle.error .date-content.new-box-design{color:var(--color-error-primary, #dc3e33)!important}.date-component .date-content{flex:1;font-size:16px;text-align:left;height:18px;min-width:30px;color:var(--color-grey-primary, #4f4f4f);white-space:nowrap;transition:.3s}.date-component .date-content .date-placeholder{transition:.3s;color:var(--color-white-tint-6, #bebebe)}.date-component .date-content.new-box-design{color:var(--color-grey-shade-2, #828282)}.date-component .date-icon{width:24px;height:24px;background-color:var(--color-white-tint-6, #bebebe);transition:.3s}.date-component .date-icon.filled{background-color:var(--color-grey-shade-2, #828282)}.date-component .date-menu{width:320px;background:transparent;position:absolute;z-index:10}.date-component .date-menu .date-modal{border-radius:8px;width:320px;overflow-y:auto;white-space:initial;background:#ffffff;box-shadow:0 2px 4px -1px #00000008,0 4px 5px #0000003d,0 1px 10px #0000001a}.date-component .date-menu .date-modal-extra-space{height:10px;margin:0 0 -10px;background:transparent}.date-component .date-menu .days-toolbar{display:flex;align-items:center;justify-content:space-between;padding:16px 34px}.date-component .date-menu .days-toolbar .material-icons{color:#333;font-size:20px;cursor:pointer;-webkit-user-select:none;user-select:none}.date-component .date-menu .days-toolbar .title{font-size:14px;font-weight:500;color:var(--color-grey-primary, #4f4f4f);cursor:pointer}.date-component .date-menu .days-container{border-bottom:1px solid #f2f2f2;padding:0 24px}.date-component .date-menu .days-container .week-days{display:flex;align-items:center;justify-content:space-between;font-size:14px;color:var(--color-grey-primary, #4f4f4f);font-weight:500;margin-bottom:8px;cursor:default}.date-component .date-menu .days-container .week-days .week-day{width:39px;text-align:center}.date-component .date-menu .days-container .day-row{display:flex;align-items:center;justify-content:space-between;font-size:14px;font-weight:400;color:var(--color-grey-primary, #4f4f4f)}.date-component .date-menu .days-container .day-row .day-item{position:relative;width:39px;height:39px;display:flex;justify-content:center;align-items:center;cursor:pointer;border-radius:4px}.date-component .date-menu .days-container .day-row .day-item .highlight-icon{position:absolute;right:0;height:14px;width:14px;background-color:#5cbb3a}.date-component .date-menu .days-container .day-row .day-item:hover{background:var(--color-blue-tint-1, #f4f9fd);color:var(--color-blue-primary, #2188d9)}.date-component .date-menu .days-container .day-row .day-item.selected{background:var(--color-primary, #2188d9);color:#fff}.date-component .date-menu .days-container .day-row .day-item.selected .highlight-icon{background-color:#fff}.date-component .date-menu .days-container .day-row .day-item.ousideRange{color:#b8b9bc}.date-component .date-menu .days-container .day-row .day-item.disabledDay{color:#b8b9bc;cursor:not-allowed!important}.date-component .time-container{display:flex;padding:16px 24px;justify-content:space-between;border-bottom:1px solid #f2f2f2;align-items:center}.date-component .time-container .time-lbl{font-weight:500;font-size:14px;color:var(--color-grey-primary, #4f4f4f);white-space:nowrap}.date-component .time-container .time-picker{display:flex;align-items:center;gap:7px}.date-component .time-container .time-picker .input-wrapper{display:flex;flex-direction:column;align-items:center}.date-component .time-container .time-picker .input-wrapper zen-icon{background-color:var(--color-white-tint-4, #d6d6d8);width:16px;height:16px;cursor:pointer}.date-component .time-container .time-picker .input-wrapper input{width:30px;height:25px;text-align:center;border:1px solid var(--color-white-tint-1, #f2f2f2);font-weight:400;font-size:14px;color:var(--color-grey-primary, #4f4f4f);border-radius:2px}.date-component .time-container .time-picker .input-wrapper input:focus{outline:none;border-color:var(--color-blue-primary, #2188d9)}.date-component .time-container .time-picker .am-pm-picker{font-weight:400;font-size:14px;padding-top:18px;cursor:pointer}.date-component .time-container .time-picker .am-pm-picker .main{color:var(--color-grey-primary, #4f4f4f)}.date-component .time-container .time-picker .am-pm-picker .sub{color:var(--color-white-tint-4, #d6d6d8)}.date-component .hint{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:4px;padding:16px 24px;border-bottom:1px solid #ECECED;font-style:normal;font-weight:400;font-size:14px;line-height:130%;color:#4f4f4f}.date-component .hint .hint-date{cursor:pointer;text-decoration-line:underline}.date-component .footer{display:flex;justify-content:end;gap:16px;padding:16px 24px}.date-component .month-picker{position:absolute;inset:0;background:white}.date-component .month-picker .months-container{display:flex;flex-wrap:wrap;justify-content:space-between;padding:10px 20px}.date-component .month-picker .months-container .month-item{display:inline-flex;align-items:center;justify-content:center;height:50px;width:30%;cursor:pointer;color:var(--color-grey-shade-2, #828282);border-radius:4px}.date-component .month-picker .months-container .month-item:hover{color:#fff;background-color:var(--color-blue-primary, #2188d9)}.date-component .right{right:0}.date-component .bottom{bottom:42px}\n"], dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { 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.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: ZenduIconComponent, selector: "zen-icon", inputs: ["src"] }, { kind: "pipe", type: i1.DatePipe, name: "date" }] });
|
|
987
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: ZenduDatepickerComponent, decorators: [{
|
|
988
|
+
type: Component,
|
|
989
|
+
args: [{ selector: 'zen-datepicker', template: "<div class=\"date-component\">\n <!-- Material design datepicker toggle -->\n <ng-container *ngIf=\"!boxDesign\">\n <button class=\"date-toggle\"\n [disabled]=\"disabled || readonly\"\n (click)=\"togglePicker()\"\n [ngClass]=\"{'active': isPickerVisible,'error': highlightError,'readonly': readonly}\">\n\n <div class=\"date-content\">\n <!-- date placeholder -->\n <div class=\"date-placeholder\"\n *ngIf=\"!date\">\n Select Date\n </div>\n\n <!-- Selected datetime -->\n <div *ngIf=\"date\">\n <span *ngIf=\"showDate\">{{formattedDate()}}</span>\n <span *ngIf=\"showTime\"> {{formattedTime()}}</span>\n </div>\n </div>\n\n <!-- Datepicker icon, depends on picker type -->\n <zen-icon class=\"date-icon\"\n [src]=\"getIcon()\"\n [ngClass]=\"{'filled': date}\">\n </zen-icon>\n </button>\n </ng-container>\n\n <!-- Box design datepicker toggle -->\n <ng-container *ngIf=\"boxDesign\">\n <button class=\"date-toggle new-box-design\"\n [disabled]=\"disabled || readonly\"\n (click)=\"togglePicker()\"\n [ngClass]=\"{'active': isPickerVisible,'error': highlightError,'readonly': readonly}\">\n\n <!-- Datepicker icon, depends on picker type -->\n <zen-icon class=\"date-icon\"\n [src]=\"getIcon()\"\n [ngClass]=\"{'filled': date}\">\n </zen-icon>\n\n <div class=\"date-content new-box-design\">\n <!-- date placeholder -->\n <div class=\"date-placeholder\"\n *ngIf=\"!date\">\n Select Date\n </div>\n\n <!-- Selected datetime -->\n <div *ngIf=\"date\">\n <span *ngIf=\"showDate\">{{formattedDate()}}</span>\n <span *ngIf=\"showTime\"> {{formattedTime()}}</span>\n </div>\n </div>\n </button>\n </ng-container>\n\n <!-- Datepicker popup -->\n <div *ngIf=\"isPickerVisible\"\n class=\"date-menu\"\n [ngClass]=\"{ 'right': right, 'bottom': bottom }\">\n <div class=\"date-modal\">\n <ng-container *ngIf=\"showDate\">\n <div class=\"days-toolbar\">\n <i (click)=\"prevMonth()\"\n class=\"material-icons\">navigate_before</i>\n <span class=\"title\"\n (click)=\"showMonthPicker()\">{{daysTitle}}</span>\n <i (click)=\"nextMonth()\"\n class=\"material-icons\">navigate_next</i>\n </div>\n <div class=\"days-container\">\n <div class=\"week-days\">\n <div *ngFor=\"let weekDay of weekDays\"\n class=\"week-day\">\n {{weekDay}}\n </div>\n </div>\n <div *ngFor=\"let row of dayRows\"\n class=\"day-row\">\n <div *ngFor=\"let day of row.days\"\n (click)=\"selectDay(day)\"\n class=\"day-item\"\n [class.ousideRange]=\"day.isOutside\"\n [class.selected]=\"day.selected\"\n [class.disabledDay]=\"day.isDisabled\">\n {{day.lbl}}\n <zen-icon *ngIf=\"day.isHighlighted\"\n class=\"highlight-icon\"\n src=\"assets/ng-zenduit/icons/play.svg\"></zen-icon>\n </div>\n </div>\n </div>\n </ng-container>\n\n <div *ngIf=\"showTime\"\n class=\"time-container\">\n\n <div class=\"time-lbl\">\n Select Time:\n </div>\n\n <div class=\"time-picker\">\n <div class=\"input-wrapper\">\n <zen-icon (click)=\"hourUp()\"\n src=\"assets/ng-zenduit/icons/arrow-up-small.svg\"></zen-icon>\n <input [(ngModel)]=\"hour\"\n (ngModelChange)=\"timeChanged()\" />\n <zen-icon (click)=\"hourDown()\"\n src=\"assets/ng-zenduit/icons/arrow-down-small.svg\"></zen-icon>\n </div>\n <label>:</label>\n <div class=\"input-wrapper\">\n <zen-icon (click)=\"minUp()\"\n src=\"assets/ng-zenduit/icons/arrow-up-small.svg\"></zen-icon>\n <input [(ngModel)]=\"min\"\n (ngModelChange)=\"timeChanged()\" />\n <zen-icon (click)=\"minDown()\"\n src=\"assets/ng-zenduit/icons/arrow-down-small.svg\"></zen-icon>\n </div>\n <div class=\"am-pm-picker\">\n <div class=\"main\"\n (click)=\"toggleTime()\">\n {{isPM ? 'PM' : 'AM'}}\n </div>\n <div class=\"sub\"\n (click)=\"toggleTime()\">\n {{isPM ? 'AM' : 'PM'}}\n </div>\n </div>\n </div>\n </div>\n\n <div class=\"hint\"\n *ngIf=\"hint\">\n <div class=\"hint-description\">\n {{hint.description}}\n </div>\n <div class=\"hint-date\"\n (click)=\"selectHintDate(hint.date)\">\n {{hint.maskText}}\n </div>\n </div>\n\n <div class=\"footer\"\n *ngIf=\"!autoConfirm || showTime\">\n <button *ngIf=\"date\"\n (click)=\"clear()\"\n class=\"button-stroked\">\n Clear\n </button>\n <button *ngIf=\"!date\"\n (click)=\"cancel()\"\n class=\"button-stroked\">\n Cancel\n </button>\n <button [disabled]=\"!_dateToSet\"\n (click)=\"apply()\"\n class=\"button-flat\">\n Apply\n </button>\n </div>\n\n <ng-container *ngIf=\"monthPickerVisible\">\n <div class=\"month-picker\">\n <div class=\"days-toolbar\">\n <i (click)=\"prevYear()\"\n class=\"material-icons\">navigate_before</i>\n <span class=\"title\"\n (click)=\"showYearPicker()\">{{ currentSlot | date: 'yyyy' }}</span>\n <i (click)=\"nextYear()\"\n class=\"material-icons\">navigate_next</i>\n </div>\n <div class=\"months-container\">\n <div class=\"month-item\"\n *ngFor=\"let month of months; index as index\"\n (click)=\"selectMonth(index)\">\n {{ month }}\n </div>\n </div>\n </div>\n </ng-container>\n\n <ng-container *ngIf=\"yearPickerVisible\">\n <div class=\"month-picker\">\n <div class=\"days-toolbar\">\n <i (click)=\"prevYearGroup()\"\n class=\"material-icons\">navigate_before</i>\n <span class=\"title\"\n (click)=\"showYearPicker()\">{{ currentSlot | date: 'yyyy' }}</span>\n <i (click)=\"nextYearGroup()\"\n class=\"material-icons\">navigate_next</i>\n </div>\n <div class=\"months-container\">\n <div class=\"month-item\"\n *ngFor=\"let year of years\"\n (click)=\"selectYear(year)\">\n {{ year }}\n </div>\n </div>\n </div>\n </ng-container>\n </div>\n <div class=\"date-modal-extra-space\"></div>\n </div>\n</div>\n", styles: [".date-component{width:100%;position:relative}.date-component .date-toggle{display:flex;align-items:center;justify-content:space-between;position:relative;gap:9px;transition:.3s;width:100%;background:var(--color-white-primary, #ffffff);-webkit-appearance:none;appearance:none;outline:none;cursor:pointer;border:none;border-radius:0;border-bottom:1px solid var(--color-white-tint-4, #d6d6d8);padding:0 0 8px;font-size:14px;font-style:normal;font-weight:400;line-height:130%;color:var(--color-grey-primary, #4f4f4f)}.date-component .date-toggle.new-box-design{border:1px solid var(--color-white-tint-1, #f2f2f2);border-radius:2px;padding:6px 12px;gap:4px!important}.date-component .date-toggle:hover .date-placeholder{color:var(--color-grey-shade-2, #828282)}.date-component .date-toggle:hover .date-icon{background-color:var(--color-grey-shade-2, #828282)}.date-component .date-toggle:focus,.date-component .date-toggle.active{border-color:var(--color-blue-primary, #2188d9)}.date-component .date-toggle:focus .date-icon,.date-component .date-toggle.active .date-icon{background-color:var(--color-blue-primary, #2188d9)!important}.date-component .date-toggle[disabled]{cursor:not-allowed;border-color:var(--color-white-tint-3, #e0e0e0)}.date-component .date-toggle[disabled] .date-content{color:var(--color-white-tint-3, #e0e0e0)!important}.date-component .date-toggle[disabled] .date-icon{background-color:var(--color-white-tint-3, #e0e0e0)!important}.date-component .date-toggle.readonly{cursor:default;border-color:var(--color-white-tint-3, #e0e0e0)}.date-component .date-toggle.readonly .date-content{color:var(--color-white-tint-3, #e0e0e0)!important}.date-component .date-toggle.readonly .date-icon{background-color:var(--color-white-tint-3, #e0e0e0)!important}.date-component .date-toggle.error{border-color:var(--color-error-primary, #dc3e33)}.date-component .date-toggle.error .date-icon{background-color:var(--color-error-primary, #dc3e33)!important}.date-component .date-toggle.error .date-content.new-box-design{color:var(--color-error-primary, #dc3e33)!important}.date-component .date-content{flex:1;font-size:16px;text-align:left;height:18px;min-width:30px;color:var(--color-grey-primary, #4f4f4f);white-space:nowrap;transition:.3s}.date-component .date-content .date-placeholder{transition:.3s;color:var(--color-white-tint-6, #bebebe)}.date-component .date-content.new-box-design{color:var(--color-grey-shade-2, #828282)}.date-component .date-icon{width:24px;height:24px;background-color:var(--color-white-tint-6, #bebebe);transition:.3s}.date-component .date-icon.filled{background-color:var(--color-grey-shade-2, #828282)}.date-component .date-menu{width:320px;background:transparent;position:absolute;z-index:10}.date-component .date-menu .date-modal{border-radius:8px;width:320px;overflow-y:auto;white-space:initial;background:#ffffff;box-shadow:0 2px 4px -1px #00000008,0 4px 5px #0000003d,0 1px 10px #0000001a}.date-component .date-menu .date-modal-extra-space{height:10px;margin:0 0 -10px;background:transparent}.date-component .date-menu .days-toolbar{display:flex;align-items:center;justify-content:space-between;padding:16px 34px}.date-component .date-menu .days-toolbar .material-icons{color:#333;font-size:20px;cursor:pointer;-webkit-user-select:none;user-select:none}.date-component .date-menu .days-toolbar .title{font-size:14px;font-weight:500;color:var(--color-grey-primary, #4f4f4f);cursor:pointer}.date-component .date-menu .days-container{border-bottom:1px solid #f2f2f2;padding:0 24px}.date-component .date-menu .days-container .week-days{display:flex;align-items:center;justify-content:space-between;font-size:14px;color:var(--color-grey-primary, #4f4f4f);font-weight:500;margin-bottom:8px;cursor:default}.date-component .date-menu .days-container .week-days .week-day{width:39px;text-align:center}.date-component .date-menu .days-container .day-row{display:flex;align-items:center;justify-content:space-between;font-size:14px;font-weight:400;color:var(--color-grey-primary, #4f4f4f)}.date-component .date-menu .days-container .day-row .day-item{position:relative;width:39px;height:39px;display:flex;justify-content:center;align-items:center;cursor:pointer;border-radius:4px}.date-component .date-menu .days-container .day-row .day-item .highlight-icon{position:absolute;right:0;height:14px;width:14px;background-color:#5cbb3a}.date-component .date-menu .days-container .day-row .day-item:hover{background:var(--color-blue-tint-1, #f4f9fd);color:var(--color-blue-primary, #2188d9)}.date-component .date-menu .days-container .day-row .day-item.selected{background:var(--color-primary, #2188d9);color:#fff}.date-component .date-menu .days-container .day-row .day-item.selected .highlight-icon{background-color:#fff}.date-component .date-menu .days-container .day-row .day-item.ousideRange{color:#b8b9bc}.date-component .date-menu .days-container .day-row .day-item.disabledDay{color:#b8b9bc;cursor:not-allowed!important}.date-component .time-container{display:flex;padding:16px 24px;justify-content:space-between;border-bottom:1px solid #f2f2f2;align-items:center}.date-component .time-container .time-lbl{font-weight:500;font-size:14px;color:var(--color-grey-primary, #4f4f4f);white-space:nowrap}.date-component .time-container .time-picker{display:flex;align-items:center;gap:7px}.date-component .time-container .time-picker .input-wrapper{display:flex;flex-direction:column;align-items:center}.date-component .time-container .time-picker .input-wrapper zen-icon{background-color:var(--color-white-tint-4, #d6d6d8);width:16px;height:16px;cursor:pointer}.date-component .time-container .time-picker .input-wrapper input{width:30px;height:25px;text-align:center;border:1px solid var(--color-white-tint-1, #f2f2f2);font-weight:400;font-size:14px;color:var(--color-grey-primary, #4f4f4f);border-radius:2px}.date-component .time-container .time-picker .input-wrapper input:focus{outline:none;border-color:var(--color-blue-primary, #2188d9)}.date-component .time-container .time-picker .am-pm-picker{font-weight:400;font-size:14px;padding-top:18px;cursor:pointer}.date-component .time-container .time-picker .am-pm-picker .main{color:var(--color-grey-primary, #4f4f4f)}.date-component .time-container .time-picker .am-pm-picker .sub{color:var(--color-white-tint-4, #d6d6d8)}.date-component .hint{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:4px;padding:16px 24px;border-bottom:1px solid #ECECED;font-style:normal;font-weight:400;font-size:14px;line-height:130%;color:#4f4f4f}.date-component .hint .hint-date{cursor:pointer;text-decoration-line:underline}.date-component .footer{display:flex;justify-content:end;gap:16px;padding:16px 24px}.date-component .month-picker{position:absolute;inset:0;background:white}.date-component .month-picker .months-container{display:flex;flex-wrap:wrap;justify-content:space-between;padding:10px 20px}.date-component .month-picker .months-container .month-item{display:inline-flex;align-items:center;justify-content:center;height:50px;width:30%;cursor:pointer;color:var(--color-grey-shade-2, #828282);border-radius:4px}.date-component .month-picker .months-container .month-item:hover{color:#fff;background-color:var(--color-blue-primary, #2188d9)}.date-component .right{right:0}.date-component .bottom{bottom:42px}\n"] }]
|
|
990
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef }]; }, propDecorators: { date: [{
|
|
991
|
+
type: Input
|
|
992
|
+
}], dateChange: [{
|
|
993
|
+
type: Output
|
|
994
|
+
}], showTime: [{
|
|
995
|
+
type: Input
|
|
996
|
+
}], showDate: [{
|
|
997
|
+
type: Input
|
|
998
|
+
}], containerClass: [{
|
|
999
|
+
type: Input
|
|
1000
|
+
}], minDate: [{
|
|
1001
|
+
type: Input
|
|
1002
|
+
}], maxDate: [{
|
|
1003
|
+
type: Input
|
|
1004
|
+
}], boxDesign: [{
|
|
1005
|
+
type: Input
|
|
1006
|
+
}], highlightDays: [{
|
|
1007
|
+
type: Input
|
|
1008
|
+
}], autoConfirm: [{
|
|
1009
|
+
type: Input
|
|
1010
|
+
}], hint: [{
|
|
1011
|
+
type: Input
|
|
1012
|
+
}], highlightError: [{
|
|
1013
|
+
type: Input
|
|
1014
|
+
}], disabled: [{
|
|
1015
|
+
type: Input
|
|
1016
|
+
}], readonly: [{
|
|
1017
|
+
type: Input
|
|
1018
|
+
}], xPosition: [{
|
|
1019
|
+
type: Input
|
|
1020
|
+
}], yPosition: [{
|
|
1021
|
+
type: Input
|
|
1022
|
+
}], outsideHandling: [{
|
|
1023
|
+
type: HostListener,
|
|
1024
|
+
args: ['window:mousedown', ['$event']]
|
|
1025
|
+
}], scroll: [{
|
|
1026
|
+
type: HostListener,
|
|
1027
|
+
args: ['window:scroll', []]
|
|
1028
|
+
}] } });
|
|
1029
|
+
|
|
1030
|
+
class ZenduToggleSlideComponent {
|
|
1031
|
+
constructor() {
|
|
1032
|
+
this.enabledChange = new EventEmitter();
|
|
1033
|
+
}
|
|
1034
|
+
/**
|
|
1035
|
+
* Toggle state
|
|
1036
|
+
*/
|
|
1037
|
+
toggle() {
|
|
1038
|
+
this.enabled = !this.enabled;
|
|
1039
|
+
this.enabledChange.emit(this.enabled);
|
|
1040
|
+
}
|
|
1041
|
+
}
|
|
1042
|
+
ZenduToggleSlideComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: ZenduToggleSlideComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1043
|
+
ZenduToggleSlideComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.12", type: ZenduToggleSlideComponent, selector: "zen-toggle-slide", inputs: { enabled: "enabled", disabled: "disabled" }, outputs: { enabledChange: "enabledChange" }, ngImport: i0, template: "<button class=\"toggle-slide-component\"\n (click)=\"toggle()\"\n [disabled]=\"disabled\"\n [class.active]=\"enabled\"\n [class.disabled]=\"disabled\">\n\n <div class=\"toggle-slider\"></div>\n <div class=\"toggle-btn\"></div>\n</button>\n", styles: [".toggle-slide-component{position:relative;padding:8px;background:none;border:none;cursor:pointer;outline:none}.toggle-slide-component .toggle-slider{width:25px;height:4px;background:#def0ff;border-radius:2px}.toggle-slide-component .toggle-btn{position:absolute;left:2px;top:3px;background:#ffffff;width:15px;height:15px;border-radius:8px;box-shadow:0 0 10px #bee1fd;transition:.4s}.toggle-slide-component:focus .toggle-slider,.toggle-slide-component:focus .toggle-btn{box-shadow:0 0 2px 2px #2188d94d}.toggle-slide-component:hover .toggle-slider{background:#d5ebfd}.toggle-slide-component.active .toggle-slider,.toggle-slide-component.active .toggle-btn{background:var(--color-primary, #2188d9)}.toggle-slide-component.active .toggle-btn{left:24px;background:var(--color-primary, #2188d9)}.toggle-slide-component.active:hover .toggle-slider,.toggle-slide-component.active:hover .toggle-btn{background-color:#0d74c5}.toggle-slide-component.disabled{cursor:not-allowed}.toggle-slide-component.disabled .toggle-slider,.toggle-slide-component.disabled .toggle-btn{background:#d0d0d2}\n"] });
|
|
1044
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: ZenduToggleSlideComponent, decorators: [{
|
|
1045
|
+
type: Component,
|
|
1046
|
+
args: [{ selector: 'zen-toggle-slide', template: "<button class=\"toggle-slide-component\"\n (click)=\"toggle()\"\n [disabled]=\"disabled\"\n [class.active]=\"enabled\"\n [class.disabled]=\"disabled\">\n\n <div class=\"toggle-slider\"></div>\n <div class=\"toggle-btn\"></div>\n</button>\n", styles: [".toggle-slide-component{position:relative;padding:8px;background:none;border:none;cursor:pointer;outline:none}.toggle-slide-component .toggle-slider{width:25px;height:4px;background:#def0ff;border-radius:2px}.toggle-slide-component .toggle-btn{position:absolute;left:2px;top:3px;background:#ffffff;width:15px;height:15px;border-radius:8px;box-shadow:0 0 10px #bee1fd;transition:.4s}.toggle-slide-component:focus .toggle-slider,.toggle-slide-component:focus .toggle-btn{box-shadow:0 0 2px 2px #2188d94d}.toggle-slide-component:hover .toggle-slider{background:#d5ebfd}.toggle-slide-component.active .toggle-slider,.toggle-slide-component.active .toggle-btn{background:var(--color-primary, #2188d9)}.toggle-slide-component.active .toggle-btn{left:24px;background:var(--color-primary, #2188d9)}.toggle-slide-component.active:hover .toggle-slider,.toggle-slide-component.active:hover .toggle-btn{background-color:#0d74c5}.toggle-slide-component.disabled{cursor:not-allowed}.toggle-slide-component.disabled .toggle-slider,.toggle-slide-component.disabled .toggle-btn{background:#d0d0d2}\n"] }]
|
|
1047
|
+
}], propDecorators: { enabled: [{
|
|
1048
|
+
type: Input
|
|
1049
|
+
}], enabledChange: [{
|
|
1050
|
+
type: Output
|
|
1051
|
+
}], disabled: [{
|
|
1052
|
+
type: Input
|
|
1053
|
+
}] } });
|
|
1054
|
+
|
|
1055
|
+
class ZenduRadioButtonComponent {
|
|
1056
|
+
constructor() {
|
|
1057
|
+
this.radioChange = new EventEmitter();
|
|
1058
|
+
this.disabled = false;
|
|
1059
|
+
}
|
|
1060
|
+
ngOnInit() {
|
|
1061
|
+
}
|
|
1062
|
+
ngOnChanges(changes) {
|
|
1063
|
+
if (changes["selected"]) {
|
|
1064
|
+
if (changes["selected"].currentValue) {
|
|
1065
|
+
this.selectedRadio = this.value;
|
|
1066
|
+
}
|
|
1067
|
+
else {
|
|
1068
|
+
this.selectedRadio = "";
|
|
1069
|
+
}
|
|
1070
|
+
}
|
|
1071
|
+
}
|
|
1072
|
+
emitChange(event) {
|
|
1073
|
+
if (this.disabled) {
|
|
1074
|
+
return;
|
|
1075
|
+
}
|
|
1076
|
+
this.radioChange.emit(event.target.value);
|
|
1077
|
+
}
|
|
1078
|
+
}
|
|
1079
|
+
ZenduRadioButtonComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: ZenduRadioButtonComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1080
|
+
ZenduRadioButtonComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.12", type: ZenduRadioButtonComponent, selector: "zen-radio", inputs: { selected: "selected", label: "label", value: "value", name: "name", disabled: "disabled", imageUrl: "imageUrl" }, outputs: { radioChange: "radioChange" }, usesOnChanges: true, ngImport: i0, template: "<div class=\"radio-component\"\n [ngClass]=\"{'disabled-radio': disabled}\">\n <input type=\"radio\"\n class=\"radio-input\"\n name=\"{{name}}\"\n [value]=\"value\"\n [disabled]=\"disabled\"\n id=\"{{value}}\"\n [checked]=\"selectedRadio === value\"\n (change)=\"emitChange($event)\" />\n\n <label class=\"app-radio-button-label\"\n for=\"{{value}}\">\n <img class=\"radio-image\"\n [src]=\"imageUrl\"\n *ngIf=\"imageUrl\">\n {{label}}\n </label>\n</div>", styles: [".radio-component{display:flex;align-items:center;cursor:pointer;gap:8px;color:#828282;font-size:14px}.radio-component .radio-input{position:absolute;left:-9999px}.radio-component .radio-input+label{position:relative;padding:0 0 0 24px;cursor:pointer;display:flex;align-items:center;font-weight:400;width:100%}.radio-component .radio-input+label:before{content:\"\";background:#fff;border:1.6px solid #D6D6D8;height:16.67px;width:16.67px;border-radius:50%;position:absolute;left:0}.radio-component .radio-input+label:hover:before{border:1.6px solid #828282}.radio-component .radio-input+label:after{content:\"\";background:#2188D9;width:10px;height:10px;border-radius:50%;position:absolute;left:5px;opacity:0;transform:scale(2);transition:transform .3s linear,opacity .3s linear}.radio-component .radio-input:checked+label{color:#4f4f4f}.radio-component .radio-input:checked+label:before{border:1.6px solid #2188D9}.radio-component .radio-input:checked+label:hover:before{border:1.6px solid #16598D}.radio-component .radio-input:checked+label:after{opacity:1;transform:scale(1)}.radio-component .radio-input:checked+label:hover:after{background:#16598D}.radio-component .radio-image{margin-right:8px}.radio-component.disabled-radio .radio-input+label{cursor:not-allowed;color:#e0e0e0}.radio-component.disabled-radio .radio-input+label:before{border:1.6px solid #E0E0E0}.radio-component.disabled-radio .radio-input:checked+label:hover:before{border:1.6px solid #E0E0E0}.radio-component.disabled-radio .radio-input:checked+label:after{background:#E0E0E0}\n"], dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
|
|
1081
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: ZenduRadioButtonComponent, decorators: [{
|
|
1082
|
+
type: Component,
|
|
1083
|
+
args: [{ selector: 'zen-radio', template: "<div class=\"radio-component\"\n [ngClass]=\"{'disabled-radio': disabled}\">\n <input type=\"radio\"\n class=\"radio-input\"\n name=\"{{name}}\"\n [value]=\"value\"\n [disabled]=\"disabled\"\n id=\"{{value}}\"\n [checked]=\"selectedRadio === value\"\n (change)=\"emitChange($event)\" />\n\n <label class=\"app-radio-button-label\"\n for=\"{{value}}\">\n <img class=\"radio-image\"\n [src]=\"imageUrl\"\n *ngIf=\"imageUrl\">\n {{label}}\n </label>\n</div>", styles: [".radio-component{display:flex;align-items:center;cursor:pointer;gap:8px;color:#828282;font-size:14px}.radio-component .radio-input{position:absolute;left:-9999px}.radio-component .radio-input+label{position:relative;padding:0 0 0 24px;cursor:pointer;display:flex;align-items:center;font-weight:400;width:100%}.radio-component .radio-input+label:before{content:\"\";background:#fff;border:1.6px solid #D6D6D8;height:16.67px;width:16.67px;border-radius:50%;position:absolute;left:0}.radio-component .radio-input+label:hover:before{border:1.6px solid #828282}.radio-component .radio-input+label:after{content:\"\";background:#2188D9;width:10px;height:10px;border-radius:50%;position:absolute;left:5px;opacity:0;transform:scale(2);transition:transform .3s linear,opacity .3s linear}.radio-component .radio-input:checked+label{color:#4f4f4f}.radio-component .radio-input:checked+label:before{border:1.6px solid #2188D9}.radio-component .radio-input:checked+label:hover:before{border:1.6px solid #16598D}.radio-component .radio-input:checked+label:after{opacity:1;transform:scale(1)}.radio-component .radio-input:checked+label:hover:after{background:#16598D}.radio-component .radio-image{margin-right:8px}.radio-component.disabled-radio .radio-input+label{cursor:not-allowed;color:#e0e0e0}.radio-component.disabled-radio .radio-input+label:before{border:1.6px solid #E0E0E0}.radio-component.disabled-radio .radio-input:checked+label:hover:before{border:1.6px solid #E0E0E0}.radio-component.disabled-radio .radio-input:checked+label:after{background:#E0E0E0}\n"] }]
|
|
1084
|
+
}], ctorParameters: function () { return []; }, propDecorators: { selected: [{
|
|
1085
|
+
type: Input
|
|
1086
|
+
}], radioChange: [{
|
|
1087
|
+
type: Output
|
|
1088
|
+
}], label: [{
|
|
1089
|
+
type: Input
|
|
1090
|
+
}], value: [{
|
|
1091
|
+
type: Input
|
|
1092
|
+
}], name: [{
|
|
1093
|
+
type: Input
|
|
1094
|
+
}], disabled: [{
|
|
1095
|
+
type: Input
|
|
1096
|
+
}], imageUrl: [{
|
|
1097
|
+
type: Input
|
|
1098
|
+
}] } });
|
|
1099
|
+
|
|
1100
|
+
class ZenduFilterComponent {
|
|
1101
|
+
constructor() {
|
|
1102
|
+
this.config = { items: [] };
|
|
1103
|
+
this.position = 'right';
|
|
1104
|
+
this.resetBehavior = 'clear';
|
|
1105
|
+
this.filterChange = new EventEmitter();
|
|
1106
|
+
this.isVisible = false;
|
|
1107
|
+
this.isVisibleChange = new EventEmitter();
|
|
1108
|
+
this.customTrigger = false;
|
|
1109
|
+
this.searchText = '';
|
|
1110
|
+
this.isApplied = false;
|
|
1111
|
+
this.lastAppliedFilter = {};
|
|
1112
|
+
this.menuLeft = "0px";
|
|
1113
|
+
this.menuRight = "0px";
|
|
1114
|
+
this.menuTop = "0px";
|
|
1115
|
+
this.menuBottom = "0px";
|
|
1116
|
+
this.errorMessage = [];
|
|
1117
|
+
this.datepickerPosition = DATEPICKER_POSITION;
|
|
1118
|
+
}
|
|
1119
|
+
ngOnChanges(changes) {
|
|
1120
|
+
if (changes.config && changes.config.currentValue) {
|
|
1121
|
+
// init values
|
|
1122
|
+
for (const item of this.config.items) {
|
|
1123
|
+
if (item.type === 'multiselect') {
|
|
1124
|
+
item.dataSource = item.dataSource ? this.extractUniqueDataSource(item.dataSource) : [];
|
|
1125
|
+
}
|
|
1126
|
+
else if (item.type === 'dateRange' && !item.dateRange) {
|
|
1127
|
+
item.dateRange = { start: null, end: null };
|
|
1128
|
+
}
|
|
1129
|
+
else if (item.type === 'numberRange' && !item.numberRange) {
|
|
1130
|
+
item.numberRange = {};
|
|
1131
|
+
}
|
|
1132
|
+
if (typeof item.showTime !== 'boolean') {
|
|
1133
|
+
item.showTime = true;
|
|
1134
|
+
}
|
|
1135
|
+
}
|
|
1136
|
+
this.filterItems();
|
|
1137
|
+
this.resetedFilter = this.getFilterObject();
|
|
1138
|
+
this.filter = this.getFilterObject();
|
|
1139
|
+
this.lastAppliedFilter = Util.clone(this.filter);
|
|
1140
|
+
}
|
|
1141
|
+
if (changes.filter && changes.filter.currentValue) {
|
|
1142
|
+
this.lastAppliedFilter = Util.clone(changes.filter.currentValue);
|
|
1143
|
+
this.updateAppliedState();
|
|
1144
|
+
}
|
|
1145
|
+
if (changes.isVisible && changes.isVisible.currentValue) {
|
|
1146
|
+
this.updatePlacement();
|
|
1147
|
+
this.focusSearchBox();
|
|
1148
|
+
}
|
|
1149
|
+
}
|
|
1150
|
+
outsideHandling(event) {
|
|
1151
|
+
if (!this.isVisible) {
|
|
1152
|
+
return;
|
|
1153
|
+
}
|
|
1154
|
+
const target = event.target;
|
|
1155
|
+
if (!document.body.contains(target)) {
|
|
1156
|
+
// element not in the DOM
|
|
1157
|
+
return;
|
|
1158
|
+
}
|
|
1159
|
+
if (this._componentElement.nativeElement.contains(target)) {
|
|
1160
|
+
return;
|
|
1161
|
+
}
|
|
1162
|
+
// hide the menu for outside click
|
|
1163
|
+
this.hide();
|
|
1164
|
+
// restore values
|
|
1165
|
+
this.restorePreviousApplied();
|
|
1166
|
+
}
|
|
1167
|
+
windowSizeHandling() {
|
|
1168
|
+
if (!this.isVisible) {
|
|
1169
|
+
return;
|
|
1170
|
+
}
|
|
1171
|
+
this.updatePlacement();
|
|
1172
|
+
}
|
|
1173
|
+
windowScroll() {
|
|
1174
|
+
if (!this.isVisible) {
|
|
1175
|
+
return;
|
|
1176
|
+
}
|
|
1177
|
+
this.updatePlacement();
|
|
1178
|
+
}
|
|
1179
|
+
handleMouseScroll(event) {
|
|
1180
|
+
if (!this.isVisible) {
|
|
1181
|
+
return;
|
|
1182
|
+
}
|
|
1183
|
+
const target = event.target;
|
|
1184
|
+
if (!document.body.contains(target)) {
|
|
1185
|
+
return;
|
|
1186
|
+
}
|
|
1187
|
+
if (this._componentElement.nativeElement.contains(target) && !target.classList.contains('button-stroked')) {
|
|
1188
|
+
return;
|
|
1189
|
+
}
|
|
1190
|
+
this.hide();
|
|
1191
|
+
this.restorePreviousApplied();
|
|
1192
|
+
}
|
|
1193
|
+
onWindowKeyDown(event) {
|
|
1194
|
+
if (!this.isVisible) {
|
|
1195
|
+
return;
|
|
1196
|
+
}
|
|
1197
|
+
if (event.key === 'ArrowUp' || event.key === 'ArrowDown' || event.key === 'PageUp' || event.key === 'PageDown' || event.key === 'Home' || event.key === 'End') {
|
|
1198
|
+
const target = event.target;
|
|
1199
|
+
if (!document.body.contains(target)) {
|
|
1200
|
+
return;
|
|
1201
|
+
}
|
|
1202
|
+
if (this._componentElement.nativeElement.contains(target) && !target.classList.contains('button-stroked')) {
|
|
1203
|
+
return;
|
|
1204
|
+
}
|
|
1205
|
+
this.hide();
|
|
1206
|
+
this.restorePreviousApplied();
|
|
1207
|
+
}
|
|
1208
|
+
}
|
|
1209
|
+
focusSearchBox() {
|
|
1210
|
+
this.searchBox.doFocus();
|
|
1211
|
+
}
|
|
1212
|
+
isMenuIsVisible(item) {
|
|
1213
|
+
if (item.filteredDataSource && this.searchText) {
|
|
1214
|
+
if (!item.filteredDataSource.length) {
|
|
1215
|
+
return false;
|
|
1216
|
+
}
|
|
1217
|
+
}
|
|
1218
|
+
return true;
|
|
1219
|
+
}
|
|
1220
|
+
extractUniqueDataSource(array) {
|
|
1221
|
+
const items = array.filter(el => {
|
|
1222
|
+
return Boolean(typeof el.id === 'number' ? typeof el.id !== undefined : el.id &&
|
|
1223
|
+
typeof el.name === 'number' ? typeof el.name !== undefined : el.name);
|
|
1224
|
+
});
|
|
1225
|
+
return uniqBy(items, (el) => el.id);
|
|
1226
|
+
}
|
|
1227
|
+
onSelectAll(item) {
|
|
1228
|
+
item.dataSource.forEach(d => d.checked = item.isSelectedAll);
|
|
1229
|
+
}
|
|
1230
|
+
isItemActive(item) {
|
|
1231
|
+
if (item.type === 'multiselect') {
|
|
1232
|
+
const checkedItems = item.dataSource.filter(el => el.checked);
|
|
1233
|
+
item.isSelectedAll = checkedItems.length === item.dataSource.length;
|
|
1234
|
+
return checkedItems.length > 0;
|
|
1235
|
+
}
|
|
1236
|
+
else if (item.type === 'radio') {
|
|
1237
|
+
const selectedRadio = item.radioOptions.find(ro => ro.selected);
|
|
1238
|
+
return selectedRadio ? true : false;
|
|
1239
|
+
}
|
|
1240
|
+
else if (item.type === 'numberRange') {
|
|
1241
|
+
return Boolean(item.numberRange.from || item.numberRange.to);
|
|
1242
|
+
}
|
|
1243
|
+
else if (item.type === 'dateRange') {
|
|
1244
|
+
return Boolean(item.dateRange.start || item.dateRange.end);
|
|
1245
|
+
}
|
|
1246
|
+
else if (item.type === 'date') {
|
|
1247
|
+
return Boolean(item.date);
|
|
1248
|
+
}
|
|
1249
|
+
else {
|
|
1250
|
+
return false;
|
|
1251
|
+
}
|
|
1252
|
+
}
|
|
1253
|
+
searchTextChanged() {
|
|
1254
|
+
this.filterItems();
|
|
1255
|
+
}
|
|
1256
|
+
filterItems() {
|
|
1257
|
+
let filteredItemsCount = 0; // Initialize with 0
|
|
1258
|
+
for (const configItem of this.config.items) {
|
|
1259
|
+
if (configItem.type === 'multiselect') {
|
|
1260
|
+
configItem.filteredDataSource = configItem.dataSource.filter(el => {
|
|
1261
|
+
const preparedName = typeof el.name === 'number' ? el.name.toString() : el.name;
|
|
1262
|
+
return preparedName.toLowerCase().includes(this.searchText.toLowerCase());
|
|
1263
|
+
});
|
|
1264
|
+
filteredItemsCount += configItem.filteredDataSource.length; // Increment the count by the length of filteredDataSource
|
|
1265
|
+
}
|
|
1266
|
+
else if (configItem.type === 'dateRange') {
|
|
1267
|
+
if (this.searchText && !Boolean(configItem.dateRange.start || configItem.dateRange.end)) {
|
|
1268
|
+
configItem.filteredDataSource = [];
|
|
1269
|
+
}
|
|
1270
|
+
}
|
|
1271
|
+
else if (configItem.type === 'numberRange') {
|
|
1272
|
+
if (this.searchText && !Boolean(configItem.numberRange.from || configItem.numberRange.to)) {
|
|
1273
|
+
configItem.filteredDataSource = [];
|
|
1274
|
+
}
|
|
1275
|
+
}
|
|
1276
|
+
}
|
|
1277
|
+
this.showNoFilterResult = this.searchText && filteredItemsCount === 0;
|
|
1278
|
+
}
|
|
1279
|
+
resetFilters() {
|
|
1280
|
+
let selectAll = this.resetBehavior === "set_all";
|
|
1281
|
+
for (const item of this.config.items) {
|
|
1282
|
+
if (item.dataSource) {
|
|
1283
|
+
item.isSelectedAll = selectAll;
|
|
1284
|
+
for (const dsItem of item.dataSource) {
|
|
1285
|
+
dsItem.checked = selectAll;
|
|
1286
|
+
}
|
|
1287
|
+
}
|
|
1288
|
+
if (item.dateRange) {
|
|
1289
|
+
item.dateRange = { start: null, end: null };
|
|
1290
|
+
}
|
|
1291
|
+
if (item.numberRange) {
|
|
1292
|
+
item.numberRange = { from: null, to: null };
|
|
1293
|
+
}
|
|
1294
|
+
if (item.date) {
|
|
1295
|
+
item.date = new Date();
|
|
1296
|
+
}
|
|
1297
|
+
if (item.type === 'toggle') {
|
|
1298
|
+
item.enabled = false;
|
|
1299
|
+
}
|
|
1300
|
+
if (item.type === 'radio') {
|
|
1301
|
+
item.radioOptions.forEach(e => {
|
|
1302
|
+
if (e.id === item.selectedRadio) {
|
|
1303
|
+
e.selected = true;
|
|
1304
|
+
}
|
|
1305
|
+
else {
|
|
1306
|
+
e.selected = false;
|
|
1307
|
+
}
|
|
1308
|
+
});
|
|
1309
|
+
}
|
|
1310
|
+
}
|
|
1311
|
+
}
|
|
1312
|
+
restorePreviousApplied() {
|
|
1313
|
+
for (const item of this.config.items) {
|
|
1314
|
+
switch (item.type) {
|
|
1315
|
+
case 'multiselect':
|
|
1316
|
+
if (item.dataSource) {
|
|
1317
|
+
const selection = this.lastAppliedFilter[item.key];
|
|
1318
|
+
for (const dataItem of item.dataSource) {
|
|
1319
|
+
dataItem.checked = selection ? selection.includes(dataItem.id) : false;
|
|
1320
|
+
}
|
|
1321
|
+
}
|
|
1322
|
+
break;
|
|
1323
|
+
case 'dateRange':
|
|
1324
|
+
item.dateRange = this.lastAppliedFilter[item.key] || { start: null, end: null };
|
|
1325
|
+
break;
|
|
1326
|
+
case 'numberRange':
|
|
1327
|
+
item.numberRange = this.lastAppliedFilter[item.key] || {};
|
|
1328
|
+
break;
|
|
1329
|
+
case 'toggle':
|
|
1330
|
+
item.dateRange = this.lastAppliedFilter[item.key];
|
|
1331
|
+
break;
|
|
1332
|
+
case 'date':
|
|
1333
|
+
item.date = this.lastAppliedFilter[item.key];
|
|
1334
|
+
break;
|
|
1335
|
+
case 'radio':
|
|
1336
|
+
item.selectedRadio = this.lastAppliedFilter[item.key];
|
|
1337
|
+
break;
|
|
1338
|
+
}
|
|
1339
|
+
}
|
|
1340
|
+
}
|
|
1341
|
+
reset() {
|
|
1342
|
+
this.resetFilters();
|
|
1343
|
+
this.filter = this.getFilterObject();
|
|
1344
|
+
this.resetedFilter = this.getFilterObject();
|
|
1345
|
+
}
|
|
1346
|
+
apply() {
|
|
1347
|
+
this.filter = this.getFilterObject();
|
|
1348
|
+
let hasError = false;
|
|
1349
|
+
for (const iterator of this.config.items) {
|
|
1350
|
+
const itemFlag = this.onCheckValidity(iterator);
|
|
1351
|
+
if (!itemFlag) {
|
|
1352
|
+
hasError = true;
|
|
1353
|
+
}
|
|
1354
|
+
}
|
|
1355
|
+
if (hasError) {
|
|
1356
|
+
setTimeout(() => this.errorMessage = [], 5000);
|
|
1357
|
+
return;
|
|
1358
|
+
}
|
|
1359
|
+
else {
|
|
1360
|
+
this.errorMessage = [];
|
|
1361
|
+
}
|
|
1362
|
+
this.lastAppliedFilter = Util.clone(this.filter);
|
|
1363
|
+
this.filterChange.emit(this.filter);
|
|
1364
|
+
// update the apply state
|
|
1365
|
+
this.updateAppliedState();
|
|
1366
|
+
this.hide();
|
|
1367
|
+
}
|
|
1368
|
+
updateAppliedState() {
|
|
1369
|
+
this.isApplied = false;
|
|
1370
|
+
if (Object.keys(this.filter).length > 0) {
|
|
1371
|
+
if (this.resetedFilter) {
|
|
1372
|
+
// Filter was reset, so compare the reset filter object with the current filter
|
|
1373
|
+
// When user click on Reset and Then Apply, filter must unhighlighted
|
|
1374
|
+
if (JSON.stringify(this.resetedFilter) !== JSON.stringify(this.filter)) {
|
|
1375
|
+
this.isApplied = true;
|
|
1376
|
+
}
|
|
1377
|
+
}
|
|
1378
|
+
else {
|
|
1379
|
+
this.isApplied = true;
|
|
1380
|
+
}
|
|
1381
|
+
}
|
|
1382
|
+
}
|
|
1383
|
+
getFilterObject() {
|
|
1384
|
+
const filter = {};
|
|
1385
|
+
for (const item of this.config.items) {
|
|
1386
|
+
switch (item.type) {
|
|
1387
|
+
case 'multiselect':
|
|
1388
|
+
if (item.dataSource && item.dataSource.length) {
|
|
1389
|
+
const checkedIds = item.dataSource
|
|
1390
|
+
.filter(i => i.checked)
|
|
1391
|
+
.map(i => i.id);
|
|
1392
|
+
if (checkedIds.length) {
|
|
1393
|
+
filter[item.key] = checkedIds;
|
|
1394
|
+
}
|
|
1395
|
+
}
|
|
1396
|
+
break;
|
|
1397
|
+
case 'dateRange':
|
|
1398
|
+
if (item.dateRange &&
|
|
1399
|
+
item.dateRange.start &&
|
|
1400
|
+
item.dateRange.end) {
|
|
1401
|
+
filter[item.key] = item.dateRange;
|
|
1402
|
+
}
|
|
1403
|
+
break;
|
|
1404
|
+
case 'numberRange':
|
|
1405
|
+
if (item.numberRange &&
|
|
1406
|
+
typeof item?.numberRange?.from === 'number' &&
|
|
1407
|
+
typeof item?.numberRange?.to === 'number') {
|
|
1408
|
+
filter[item.key] = item.numberRange;
|
|
1409
|
+
}
|
|
1410
|
+
break;
|
|
1411
|
+
case 'toggle':
|
|
1412
|
+
filter[item.key] = item.enabled || false;
|
|
1413
|
+
break;
|
|
1414
|
+
case 'date':
|
|
1415
|
+
if (item.date) {
|
|
1416
|
+
filter[item.key] = item.date;
|
|
1417
|
+
}
|
|
1418
|
+
break;
|
|
1419
|
+
case 'radio':
|
|
1420
|
+
filter[item.key] = item.radioOptions.find(ro => ro.selected)?.id;
|
|
1421
|
+
break;
|
|
1422
|
+
}
|
|
1423
|
+
}
|
|
1424
|
+
return filter;
|
|
1425
|
+
}
|
|
1426
|
+
hide() {
|
|
1427
|
+
this.isVisible = false;
|
|
1428
|
+
this.searchText = '';
|
|
1429
|
+
this.filterItems();
|
|
1430
|
+
this.isVisibleChange.emit(false);
|
|
1431
|
+
}
|
|
1432
|
+
radioChanged(value, item) {
|
|
1433
|
+
item.radioOptions.forEach(opt => opt.selected = opt.id === value);
|
|
1434
|
+
}
|
|
1435
|
+
toggle() {
|
|
1436
|
+
this.isVisible = !this.isVisible;
|
|
1437
|
+
this.updatePlacement();
|
|
1438
|
+
this.focusSearchBox();
|
|
1439
|
+
}
|
|
1440
|
+
onCheckValidity(item) {
|
|
1441
|
+
if (item.type === 'numberRange') {
|
|
1442
|
+
if (typeof item.numberRange.from === 'number' && typeof item.numberRange.to === 'number' && item.numberRange.from >= item.numberRange.to) {
|
|
1443
|
+
this.errorMessage.push(`Invalid Number range, Min number should be less than Max number.`);
|
|
1444
|
+
return false;
|
|
1445
|
+
}
|
|
1446
|
+
}
|
|
1447
|
+
if (item.type === 'dateRange') {
|
|
1448
|
+
if (item.dateRange.start && item.dateRange.end && new Date(item.dateRange.start) >= new Date(item.dateRange.end)) {
|
|
1449
|
+
this.errorMessage.push(`Invalid Date range, Start date should be less than End date.`);
|
|
1450
|
+
return false;
|
|
1451
|
+
}
|
|
1452
|
+
}
|
|
1453
|
+
return true;
|
|
1454
|
+
}
|
|
1455
|
+
updatePlacement() {
|
|
1456
|
+
const container = this._componentElement.nativeElement;
|
|
1457
|
+
const rect = container.getBoundingClientRect();
|
|
1458
|
+
const left = rect.left;
|
|
1459
|
+
const right = rect.right;
|
|
1460
|
+
const top = rect.top;
|
|
1461
|
+
const bottom = window.innerHeight - top;
|
|
1462
|
+
//Update left-right position
|
|
1463
|
+
if (this.position.includes("auto")) {
|
|
1464
|
+
const horizontalPosition = this.getHorizontalPosition();
|
|
1465
|
+
this.menuRight = horizontalPosition === "left" ? `${window.innerWidth - right}px` : "unset";
|
|
1466
|
+
this.menuLeft = horizontalPosition === "right" ? `${left}px` : "unset";
|
|
1467
|
+
}
|
|
1468
|
+
else if (this.position.includes("left")) {
|
|
1469
|
+
this.menuRight = `${window.innerWidth - right}px`;
|
|
1470
|
+
this.menuLeft = "unset";
|
|
1471
|
+
}
|
|
1472
|
+
else {
|
|
1473
|
+
this.menuLeft = `${left}px`;
|
|
1474
|
+
this.menuRight = "unset";
|
|
1475
|
+
}
|
|
1476
|
+
//Update top-bottom position
|
|
1477
|
+
if (this.position.includes("auto")) {
|
|
1478
|
+
const verticalPosition = this.getVerticalPosition();
|
|
1479
|
+
this.menuTop = verticalPosition === "bottom" ? `${top + 42}px` : "unset";
|
|
1480
|
+
this.menuBottom = verticalPosition === "top" ? `${bottom}px` : "unset";
|
|
1481
|
+
}
|
|
1482
|
+
else if (this.position.includes("top")) {
|
|
1483
|
+
this.menuTop = "unset";
|
|
1484
|
+
this.menuBottom = `${bottom + 10}px`;
|
|
1485
|
+
}
|
|
1486
|
+
else {
|
|
1487
|
+
this.menuTop = `${top + 55}px`;
|
|
1488
|
+
this.menuBottom = "unset";
|
|
1489
|
+
}
|
|
1490
|
+
}
|
|
1491
|
+
getVerticalPosition() {
|
|
1492
|
+
const top = this._componentElement.nativeElement.getBoundingClientRect().top;
|
|
1493
|
+
return top > window.innerHeight / 2 ? "top" : "bottom";
|
|
1494
|
+
}
|
|
1495
|
+
getHorizontalPosition() {
|
|
1496
|
+
const left = this._componentElement.nativeElement.getBoundingClientRect().left;
|
|
1497
|
+
return left > window.innerWidth / 2 ? "left" : "right";
|
|
1498
|
+
}
|
|
1499
|
+
}
|
|
1500
|
+
ZenduFilterComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: ZenduFilterComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1501
|
+
ZenduFilterComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.12", type: ZenduFilterComponent, selector: "zen-filter", inputs: { config: "config", filter: "filter", position: "position", resetBehavior: "resetBehavior", isVisible: "isVisible", customTrigger: "customTrigger", imageUrl: "imageUrl", label: "label" }, outputs: { filterChange: "filterChange", isVisibleChange: "isVisibleChange" }, host: { listeners: { "window:mousedown": "outsideHandling($event)", "window:resize": "windowSizeHandling($event)", "window:scroll": "windowScroll($event)", "window:wheel": "handleMouseScroll($event)", "window:keydown": "onWindowKeyDown($event)" } }, viewQueries: [{ propertyName: "searchBox", first: true, predicate: ["searchBox"], descendants: true }, { propertyName: "_componentElement", first: true, predicate: ["mainComponent"], descendants: true }], usesOnChanges: true, ngImport: i0, template: "<div class=\"filters-component\"\n\t #mainComponent\n\t click-out=\"isVisible && hide()\">\n\n\t<ng-container *ngIf=\"!customTrigger\">\n\t\t<button (click)=\"toggle()\"\n\t\t\t\tclass=\"button-stroked filter {{isApplied ? 'applied' : ''}}\">\n\t\t\t<zen-icon [src]=\"imageUrl\"\n\t\t\t\t\t *ngIf=\"imageUrl\"></zen-icon>\n\t\t\t<i class=\"filter-icon material-icons\"\n\t\t\t *ngIf=\"!imageUrl\">filter_list</i>\n\t\t\t<span *ngIf=\"label\">{{ label }}</span>\n\t\t</button>\n\t</ng-container>\n\n\t<ng-content *ngIf=\"customTrigger\"></ng-content>\n\n\t<div [hidden]=\"!isVisible\"\n\t\t class=\"action-menu menu-content\"\n\t\t [class.customTrigger]=\"customTrigger\"\n\t\t [ngStyle]=\"{ 'left': menuLeft, 'right': menuRight, 'top': menuTop, 'bottom': menuBottom }\">\n\t\t<div class=\"action-menu-header\">\n\t\t\t<zen-search-box [(text)]=\"searchText\"\n\t\t\t\t\t\t\t#searchBox\n\t\t\t\t\t\t\t(textChange)=\"searchTextChanged()\"></zen-search-box>\n\t\t</div>\n\n\t\t<div class=\"action-menu-body items-wrapper\">\n\t\t\t<ng-container *ngIf=\"errorMessage.length\">\n\t\t\t\t<li *ngFor=\"let item of errorMessage\" class=\"error-msg\">{{item}}</li>\n\t\t\t</ng-container>\n\t\t\t\n\t\t\t<div *ngFor=\"let item of config.items\">\n\t\t\t\t<div class=\"menu-item\"\n\t\t\t\t\t *ngIf=\"isMenuIsVisible(item)\">\n\n\t\t\t\t\t<!-- Divider between two filter -->\n\t\t\t\t\t<div *ngIf=\"item.type === 'divider'\">\n\t\t\t\t\t\t<p class=\"filter-divider\"></p>\n\t\t\t\t\t</div>\n\n\t\t\t\t\t<!-- Boolean toggle -->\n\t\t\t\t\t<div *ngIf=\"item.type === 'toggle'\"\n\t\t\t\t\t\t class=\"action-item toggle-row\">\n\t\t\t\t\t\t<div>{{item.title}}</div>\n\t\t\t\t\t\t<zen-toggle-slide [(enabled)]=\"item.enabled\"></zen-toggle-slide>\n\t\t\t\t\t</div>\n\n\t\t\t\t\t<button class=\"action-item expander-item\"\n\t\t\t\t\t\t\t*ngIf=\"item.type != 'toggle' && item.type != 'divider' && !item.disableCollapse\"\n\t\t\t\t\t\t\t(click)=\"item.expanded = !item.expanded\"\n\t\t\t\t\t\t\t[ngClass]=\"{'active': isItemActive(item), 'expanded': item.expanded}\">\n\t\t\t\t\t\t<i class=\"material-icons expand-icon\"\n\t\t\t\t\t\t [ngClass]=\"{'active': item.expanded}\">expand_more</i>\n\t\t\t\t\t\t{{item.title}}\n\t\t\t\t\t</button>\n\n\t\t\t\t\t<ng-container *ngIf=\"item.expanded || item.disableCollapse\">\n\t\t\t\t\t\t<div [ngSwitch]=\"item.type\">\n\t\t\t\t\t\t\t<!-- Multiselect -->\n\t\t\t\t\t\t\t<div *ngSwitchCase=\"'multiselect'\">\n\t\t\t\t\t\t\t\t<div class=\"action-item-checkbox ds-item select-all\">\n\t\t\t\t\t\t\t\t\t<zen-checkbox *ngIf=\"item.dataSource.length === item.filteredDataSource.length\"\n\t\t\t\t\t\t\t\t\t\t\t\t [(checked)]=\"item.isSelectedAll\"\n\t\t\t\t\t\t\t\t\t\t\t\t [indeterminate]=\"isItemActive(item) && !item.isSelectedAll\"\n\t\t\t\t\t\t\t\t\t\t\t\t label=\"Select All\"\n\t\t\t\t\t\t\t\t\t\t\t\t (checkedChange)=\"onSelectAll(item)\">\n\t\t\t\t\t\t\t\t\t</zen-checkbox>\n\t\t\t\t\t\t\t\t</div>\n\n\t\t\t\t\t\t\t\t<div *ngFor=\"let dsItem of item.filteredDataSource\"\n\t\t\t\t\t\t\t\t\t class=\"action-item-checkbox ds-item\">\n\t\t\t\t\t\t\t\t\t<zen-checkbox [(checked)]=\"dsItem.checked\"\n\t\t\t\t\t\t\t\t\t\t\t\t [imageUrl]=\"dsItem.imageUrl\"\n\t\t\t\t\t\t\t\t\t\t\t\t [label]=\"dsItem.name\"></zen-checkbox>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t</div>\n\n\t\t\t\t\t\t\t<!-- Date range picker -->\n\t\t\t\t\t\t\t<div *ngSwitchCase=\"'dateRange'\">\n\t\t\t\t\t\t\t\t<div class=\"ds-item filter-row\">\n\t\t\t\t\t\t\t\t\t<div class=\"lbl\">From:</div>\n\t\t\t\t\t\t\t\t\t<zen-datepicker class=\"width-full\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t[(date)]=\"item.dateRange.start\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t[showTime]=\"item.showTime\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t[yPosition]=\"item.config?.yPosition ?? datepickerPosition.AUTO\">\n\t\t\t\t\t\t\t\t\t</zen-datepicker>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t<div class=\"ds-item filter-row\">\n\t\t\t\t\t\t\t\t\t<div class=\"lbl\">To:</div>\n\t\t\t\t\t\t\t\t\t<zen-datepicker class=\"width-full\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t[(date)]=\"item.dateRange.end\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t[showTime]=\"item.showTime\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t[yPosition]=\"item.config?.yPosition ?? datepickerPosition.AUTO\">\n\t\t\t\t\t\t\t\t\t</zen-datepicker>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t</div>\n\n\t\t\t\t\t\t\t<!-- Date picker -->\n\t\t\t\t\t\t\t<div *ngSwitchCase=\"'date'\">\n\t\t\t\t\t\t\t\t<div class=\"ds-item filter-row\">\n\t\t\t\t\t\t\t\t\t<div class=\"lbl\">Date:</div>\n\t\t\t\t\t\t\t\t\t<zen-datepicker class=\"width-full\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t[(date)]=\"item.date\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t[showTime]=\"item.showTime\">\n\t\t\t\t\t\t\t\t\t</zen-datepicker>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t</div>\n\n\t\t\t\t\t\t\t<!-- Number range -->\n\t\t\t\t\t\t\t<div *ngSwitchCase=\"'numberRange'\"\n\t\t\t\t\t\t\t\t class=\"filter-row number-range-row\">\n\t\t\t\t\t\t\t\t<div>\n\t\t\t\t\t\t\t\t\t<div class=\"lbl\">Min:</div>\n\t\t\t\t\t\t\t\t\t<input class=\"material-input\"\n\t\t\t\t\t\t\t\t\t\t [(ngModel)]=\"item.numberRange.from\"\n\t\t\t\t\t\t\t\t\t\t type=\"number\" />\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t<div>\n\t\t\t\t\t\t\t\t\t<div class=\"lbl\">Max:</div>\n\t\t\t\t\t\t\t\t\t<input class=\"material-input\"\n\t\t\t\t\t\t\t\t\t\t [(ngModel)]=\"item.numberRange.to\"\n\t\t\t\t\t\t\t\t\t\t type=\"number\" />\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t</div>\n\n\t\t\t\t\t\t\t<!-- Radio -->\n\t\t\t\t\t\t\t<div *ngSwitchCase=\"'radio'\">\n\t\t\t\t\t\t\t\t<div *ngFor=\"let option of item.radioOptions\"\n\t\t\t\t\t\t\t\t\t class=\"action-item-radio ds-item\"\n\t\t\t\t\t\t\t\t\t [ngClass]=\"{'active': option.selected}\">\n\t\t\t\t\t\t\t\t\t<zen-radio [value]=\"option.id\"\n\t\t\t\t\t\t\t\t\t\t\t [label]=\"option.name\"\n\t\t\t\t\t\t\t\t\t\t\t [name]=\"item.key\"\n\t\t\t\t\t\t\t\t\t\t\t [imageUrl]=\"option.imageUrl\"\n\t\t\t\t\t\t\t\t\t\t\t [selected]=\"option.selected\"\n\t\t\t\t\t\t\t\t\t\t\t (radioChange)=\"radioChanged($event, item)\"\n\t\t\t\t\t\t\t\t\t\t\t [disabled]=\"option.disabled\"></zen-radio>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</ng-container>\n\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t\t<span *ngIf=\"showNoFilterResult\"\n\t\t\t\t class=\"no-item\">No Results Found..</span>\n\t\t</div>\n\n\t\t<div class=\"action-menu-footer\">\n\t\t\t<button (click)=\"reset()\"\n\t\t\t\t\tclass=\"button-stroked full-width\">\n\t\t\t\tReset\n\t\t\t</button>\n\t\t\t<button (click)=\"apply()\"\n\t\t\t\t\tclass=\"button-flat full-width\">\n\t\t\t\tApply\n\t\t\t</button>\n\t\t</div>\n\n\t</div>\n</div>", styles: [".filters-component{display:inline-block;position:relative}.filters-component .filter{color:#828282;position:relative;border-color:#ececed;padding:0 7px;height:38px}.filters-component .filter zen-icon{background:#828282}.filters-component .filter.applied{color:var(--color-primary, #2188d9);background:#f4f9fd;border:1px solid var(--color-primary, #2188d9)}.filters-component .filter.applied zen-icon{background:var(--color-primary, #2188d9)}.filters-component .filter .dot{background:var(--color-primary, #2188d9);width:4px;height:4px;position:absolute;border-radius:50%;left:42px;top:9px}.filters-component .menu-content{width:360px;white-space:initial;position:fixed}.filters-component .menu-content.customTrigger{top:30px}.filters-component .menu-content .items-wrapper{overflow-y:auto;max-height:calc(100vh - 407px);position:relative}.filters-component .menu-content .items-wrapper .expander-item{outline:none;border:none;display:flex;width:100%}.filters-component .menu-content .items-wrapper .action-item{color:#828282}.filters-component .menu-content .items-wrapper .action-item.expanded,.filters-component .menu-content .items-wrapper .action-item.active{background:#f4f9fd;color:#4f4f4f}.filters-component .menu-content .items-wrapper .expand-icon{transition:.3s}.filters-component .menu-content .items-wrapper .expand-icon.active{transform:rotate(180deg)}.filters-component .menu-content .items-wrapper .ds-item{padding-left:48px}.filters-component .menu-content .items-wrapper .no-item,.filters-component .menu-content .items-wrapper .error-msg{color:#dc3e33;display:flex;flex-direction:row;align-items:center;padding:10px 16px;font-weight:400;font-size:14px}.filters-component .menu-content .items-wrapper .select-all{font-weight:500}.filters-component .menu-content .items-wrapper .filter-row{padding:0 16px}.filters-component .menu-content .items-wrapper .filter-row:not(:last-of-type){margin-bottom:20px}.filters-component .menu-content .items-wrapper .filter-row .lbl{color:#60636c;font-size:14px;margin-bottom:8px}.filters-component .menu-content .items-wrapper .filter-row:focus-within .lbl{color:var(--color-primary, #2188d9)}.filters-component .menu-content .items-wrapper .number-range-row{display:flex;margin-left:32px;gap:16px;margin-bottom:10px}.filters-component .menu-content .items-wrapper .toggle-row{justify-content:space-between}.hidden{display:none}\n"], dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "directive", type: i1.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { kind: "directive", type: i1.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { 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.NumberValueAccessor, selector: "input[type=number][formControlName],input[type=number][formControl],input[type=number][ngModel]" }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: ZenduCheckboxComponent, selector: "zen-checkbox", inputs: ["checked", "label", "disabled", "disableValueChange", "indeterminate", "imageUrl"], outputs: ["checkedChange"] }, { kind: "component", type: ZenduToggleSlideComponent, selector: "zen-toggle-slide", inputs: ["enabled", "disabled"], outputs: ["enabledChange"] }, { kind: "component", type: ZenduSearchBoxComponent, selector: "zen-search-box", inputs: ["text", "delay", "autoFocus", "placeholder"], outputs: ["textChange"] }, { kind: "component", type: ZenduDatepickerComponent, selector: "zen-datepicker", inputs: ["date", "showTime", "showDate", "containerClass", "minDate", "maxDate", "boxDesign", "highlightDays", "autoConfirm", "hint", "highlightError", "disabled", "readonly", "xPosition", "yPosition"], outputs: ["dateChange"] }, { kind: "component", type: ZenduRadioButtonComponent, selector: "zen-radio", inputs: ["selected", "label", "value", "name", "disabled", "imageUrl"], outputs: ["radioChange"] }, { kind: "component", type: ZenduIconComponent, selector: "zen-icon", inputs: ["src"] }] });
|
|
1502
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: ZenduFilterComponent, decorators: [{
|
|
1503
|
+
type: Component,
|
|
1504
|
+
args: [{ selector: 'zen-filter', template: "<div class=\"filters-component\"\n\t #mainComponent\n\t click-out=\"isVisible && hide()\">\n\n\t<ng-container *ngIf=\"!customTrigger\">\n\t\t<button (click)=\"toggle()\"\n\t\t\t\tclass=\"button-stroked filter {{isApplied ? 'applied' : ''}}\">\n\t\t\t<zen-icon [src]=\"imageUrl\"\n\t\t\t\t\t *ngIf=\"imageUrl\"></zen-icon>\n\t\t\t<i class=\"filter-icon material-icons\"\n\t\t\t *ngIf=\"!imageUrl\">filter_list</i>\n\t\t\t<span *ngIf=\"label\">{{ label }}</span>\n\t\t</button>\n\t</ng-container>\n\n\t<ng-content *ngIf=\"customTrigger\"></ng-content>\n\n\t<div [hidden]=\"!isVisible\"\n\t\t class=\"action-menu menu-content\"\n\t\t [class.customTrigger]=\"customTrigger\"\n\t\t [ngStyle]=\"{ 'left': menuLeft, 'right': menuRight, 'top': menuTop, 'bottom': menuBottom }\">\n\t\t<div class=\"action-menu-header\">\n\t\t\t<zen-search-box [(text)]=\"searchText\"\n\t\t\t\t\t\t\t#searchBox\n\t\t\t\t\t\t\t(textChange)=\"searchTextChanged()\"></zen-search-box>\n\t\t</div>\n\n\t\t<div class=\"action-menu-body items-wrapper\">\n\t\t\t<ng-container *ngIf=\"errorMessage.length\">\n\t\t\t\t<li *ngFor=\"let item of errorMessage\" class=\"error-msg\">{{item}}</li>\n\t\t\t</ng-container>\n\t\t\t\n\t\t\t<div *ngFor=\"let item of config.items\">\n\t\t\t\t<div class=\"menu-item\"\n\t\t\t\t\t *ngIf=\"isMenuIsVisible(item)\">\n\n\t\t\t\t\t<!-- Divider between two filter -->\n\t\t\t\t\t<div *ngIf=\"item.type === 'divider'\">\n\t\t\t\t\t\t<p class=\"filter-divider\"></p>\n\t\t\t\t\t</div>\n\n\t\t\t\t\t<!-- Boolean toggle -->\n\t\t\t\t\t<div *ngIf=\"item.type === 'toggle'\"\n\t\t\t\t\t\t class=\"action-item toggle-row\">\n\t\t\t\t\t\t<div>{{item.title}}</div>\n\t\t\t\t\t\t<zen-toggle-slide [(enabled)]=\"item.enabled\"></zen-toggle-slide>\n\t\t\t\t\t</div>\n\n\t\t\t\t\t<button class=\"action-item expander-item\"\n\t\t\t\t\t\t\t*ngIf=\"item.type != 'toggle' && item.type != 'divider' && !item.disableCollapse\"\n\t\t\t\t\t\t\t(click)=\"item.expanded = !item.expanded\"\n\t\t\t\t\t\t\t[ngClass]=\"{'active': isItemActive(item), 'expanded': item.expanded}\">\n\t\t\t\t\t\t<i class=\"material-icons expand-icon\"\n\t\t\t\t\t\t [ngClass]=\"{'active': item.expanded}\">expand_more</i>\n\t\t\t\t\t\t{{item.title}}\n\t\t\t\t\t</button>\n\n\t\t\t\t\t<ng-container *ngIf=\"item.expanded || item.disableCollapse\">\n\t\t\t\t\t\t<div [ngSwitch]=\"item.type\">\n\t\t\t\t\t\t\t<!-- Multiselect -->\n\t\t\t\t\t\t\t<div *ngSwitchCase=\"'multiselect'\">\n\t\t\t\t\t\t\t\t<div class=\"action-item-checkbox ds-item select-all\">\n\t\t\t\t\t\t\t\t\t<zen-checkbox *ngIf=\"item.dataSource.length === item.filteredDataSource.length\"\n\t\t\t\t\t\t\t\t\t\t\t\t [(checked)]=\"item.isSelectedAll\"\n\t\t\t\t\t\t\t\t\t\t\t\t [indeterminate]=\"isItemActive(item) && !item.isSelectedAll\"\n\t\t\t\t\t\t\t\t\t\t\t\t label=\"Select All\"\n\t\t\t\t\t\t\t\t\t\t\t\t (checkedChange)=\"onSelectAll(item)\">\n\t\t\t\t\t\t\t\t\t</zen-checkbox>\n\t\t\t\t\t\t\t\t</div>\n\n\t\t\t\t\t\t\t\t<div *ngFor=\"let dsItem of item.filteredDataSource\"\n\t\t\t\t\t\t\t\t\t class=\"action-item-checkbox ds-item\">\n\t\t\t\t\t\t\t\t\t<zen-checkbox [(checked)]=\"dsItem.checked\"\n\t\t\t\t\t\t\t\t\t\t\t\t [imageUrl]=\"dsItem.imageUrl\"\n\t\t\t\t\t\t\t\t\t\t\t\t [label]=\"dsItem.name\"></zen-checkbox>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t</div>\n\n\t\t\t\t\t\t\t<!-- Date range picker -->\n\t\t\t\t\t\t\t<div *ngSwitchCase=\"'dateRange'\">\n\t\t\t\t\t\t\t\t<div class=\"ds-item filter-row\">\n\t\t\t\t\t\t\t\t\t<div class=\"lbl\">From:</div>\n\t\t\t\t\t\t\t\t\t<zen-datepicker class=\"width-full\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t[(date)]=\"item.dateRange.start\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t[showTime]=\"item.showTime\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t[yPosition]=\"item.config?.yPosition ?? datepickerPosition.AUTO\">\n\t\t\t\t\t\t\t\t\t</zen-datepicker>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t<div class=\"ds-item filter-row\">\n\t\t\t\t\t\t\t\t\t<div class=\"lbl\">To:</div>\n\t\t\t\t\t\t\t\t\t<zen-datepicker class=\"width-full\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t[(date)]=\"item.dateRange.end\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t[showTime]=\"item.showTime\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t[yPosition]=\"item.config?.yPosition ?? datepickerPosition.AUTO\">\n\t\t\t\t\t\t\t\t\t</zen-datepicker>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t</div>\n\n\t\t\t\t\t\t\t<!-- Date picker -->\n\t\t\t\t\t\t\t<div *ngSwitchCase=\"'date'\">\n\t\t\t\t\t\t\t\t<div class=\"ds-item filter-row\">\n\t\t\t\t\t\t\t\t\t<div class=\"lbl\">Date:</div>\n\t\t\t\t\t\t\t\t\t<zen-datepicker class=\"width-full\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t[(date)]=\"item.date\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t[showTime]=\"item.showTime\">\n\t\t\t\t\t\t\t\t\t</zen-datepicker>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t</div>\n\n\t\t\t\t\t\t\t<!-- Number range -->\n\t\t\t\t\t\t\t<div *ngSwitchCase=\"'numberRange'\"\n\t\t\t\t\t\t\t\t class=\"filter-row number-range-row\">\n\t\t\t\t\t\t\t\t<div>\n\t\t\t\t\t\t\t\t\t<div class=\"lbl\">Min:</div>\n\t\t\t\t\t\t\t\t\t<input class=\"material-input\"\n\t\t\t\t\t\t\t\t\t\t [(ngModel)]=\"item.numberRange.from\"\n\t\t\t\t\t\t\t\t\t\t type=\"number\" />\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t<div>\n\t\t\t\t\t\t\t\t\t<div class=\"lbl\">Max:</div>\n\t\t\t\t\t\t\t\t\t<input class=\"material-input\"\n\t\t\t\t\t\t\t\t\t\t [(ngModel)]=\"item.numberRange.to\"\n\t\t\t\t\t\t\t\t\t\t type=\"number\" />\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t</div>\n\n\t\t\t\t\t\t\t<!-- Radio -->\n\t\t\t\t\t\t\t<div *ngSwitchCase=\"'radio'\">\n\t\t\t\t\t\t\t\t<div *ngFor=\"let option of item.radioOptions\"\n\t\t\t\t\t\t\t\t\t class=\"action-item-radio ds-item\"\n\t\t\t\t\t\t\t\t\t [ngClass]=\"{'active': option.selected}\">\n\t\t\t\t\t\t\t\t\t<zen-radio [value]=\"option.id\"\n\t\t\t\t\t\t\t\t\t\t\t [label]=\"option.name\"\n\t\t\t\t\t\t\t\t\t\t\t [name]=\"item.key\"\n\t\t\t\t\t\t\t\t\t\t\t [imageUrl]=\"option.imageUrl\"\n\t\t\t\t\t\t\t\t\t\t\t [selected]=\"option.selected\"\n\t\t\t\t\t\t\t\t\t\t\t (radioChange)=\"radioChanged($event, item)\"\n\t\t\t\t\t\t\t\t\t\t\t [disabled]=\"option.disabled\"></zen-radio>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</ng-container>\n\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t\t<span *ngIf=\"showNoFilterResult\"\n\t\t\t\t class=\"no-item\">No Results Found..</span>\n\t\t</div>\n\n\t\t<div class=\"action-menu-footer\">\n\t\t\t<button (click)=\"reset()\"\n\t\t\t\t\tclass=\"button-stroked full-width\">\n\t\t\t\tReset\n\t\t\t</button>\n\t\t\t<button (click)=\"apply()\"\n\t\t\t\t\tclass=\"button-flat full-width\">\n\t\t\t\tApply\n\t\t\t</button>\n\t\t</div>\n\n\t</div>\n</div>", styles: [".filters-component{display:inline-block;position:relative}.filters-component .filter{color:#828282;position:relative;border-color:#ececed;padding:0 7px;height:38px}.filters-component .filter zen-icon{background:#828282}.filters-component .filter.applied{color:var(--color-primary, #2188d9);background:#f4f9fd;border:1px solid var(--color-primary, #2188d9)}.filters-component .filter.applied zen-icon{background:var(--color-primary, #2188d9)}.filters-component .filter .dot{background:var(--color-primary, #2188d9);width:4px;height:4px;position:absolute;border-radius:50%;left:42px;top:9px}.filters-component .menu-content{width:360px;white-space:initial;position:fixed}.filters-component .menu-content.customTrigger{top:30px}.filters-component .menu-content .items-wrapper{overflow-y:auto;max-height:calc(100vh - 407px);position:relative}.filters-component .menu-content .items-wrapper .expander-item{outline:none;border:none;display:flex;width:100%}.filters-component .menu-content .items-wrapper .action-item{color:#828282}.filters-component .menu-content .items-wrapper .action-item.expanded,.filters-component .menu-content .items-wrapper .action-item.active{background:#f4f9fd;color:#4f4f4f}.filters-component .menu-content .items-wrapper .expand-icon{transition:.3s}.filters-component .menu-content .items-wrapper .expand-icon.active{transform:rotate(180deg)}.filters-component .menu-content .items-wrapper .ds-item{padding-left:48px}.filters-component .menu-content .items-wrapper .no-item,.filters-component .menu-content .items-wrapper .error-msg{color:#dc3e33;display:flex;flex-direction:row;align-items:center;padding:10px 16px;font-weight:400;font-size:14px}.filters-component .menu-content .items-wrapper .select-all{font-weight:500}.filters-component .menu-content .items-wrapper .filter-row{padding:0 16px}.filters-component .menu-content .items-wrapper .filter-row:not(:last-of-type){margin-bottom:20px}.filters-component .menu-content .items-wrapper .filter-row .lbl{color:#60636c;font-size:14px;margin-bottom:8px}.filters-component .menu-content .items-wrapper .filter-row:focus-within .lbl{color:var(--color-primary, #2188d9)}.filters-component .menu-content .items-wrapper .number-range-row{display:flex;margin-left:32px;gap:16px;margin-bottom:10px}.filters-component .menu-content .items-wrapper .toggle-row{justify-content:space-between}.hidden{display:none}\n"] }]
|
|
1505
|
+
}], ctorParameters: function () { return []; }, propDecorators: { config: [{
|
|
1506
|
+
type: Input
|
|
1507
|
+
}], filter: [{
|
|
1508
|
+
type: Input
|
|
1509
|
+
}], position: [{
|
|
1510
|
+
type: Input
|
|
1511
|
+
}], resetBehavior: [{
|
|
1512
|
+
type: Input
|
|
1513
|
+
}], filterChange: [{
|
|
1514
|
+
type: Output
|
|
1515
|
+
}], isVisible: [{
|
|
1516
|
+
type: Input
|
|
1517
|
+
}], isVisibleChange: [{
|
|
1518
|
+
type: Output
|
|
1519
|
+
}], customTrigger: [{
|
|
1520
|
+
type: Input
|
|
1521
|
+
}], imageUrl: [{
|
|
1522
|
+
type: Input
|
|
1523
|
+
}], label: [{
|
|
1524
|
+
type: Input
|
|
1525
|
+
}], searchBox: [{
|
|
1526
|
+
type: ViewChild,
|
|
1527
|
+
args: ['searchBox', { static: false }]
|
|
1528
|
+
}], _componentElement: [{
|
|
1529
|
+
type: ViewChild,
|
|
1530
|
+
args: ['mainComponent', { static: false }]
|
|
1531
|
+
}], outsideHandling: [{
|
|
1532
|
+
type: HostListener,
|
|
1533
|
+
args: ['window:mousedown', ['$event']]
|
|
1534
|
+
}], windowSizeHandling: [{
|
|
1535
|
+
type: HostListener,
|
|
1536
|
+
args: ['window:resize', ['$event']]
|
|
1537
|
+
}], windowScroll: [{
|
|
1538
|
+
type: HostListener,
|
|
1539
|
+
args: ['window:scroll', ['$event']]
|
|
1540
|
+
}], handleMouseScroll: [{
|
|
1541
|
+
type: HostListener,
|
|
1542
|
+
args: ['window:wheel', ['$event']]
|
|
1543
|
+
}], onWindowKeyDown: [{
|
|
1544
|
+
type: HostListener,
|
|
1545
|
+
args: ['window:keydown', ['$event']]
|
|
1546
|
+
}] } });
|
|
1547
|
+
|
|
1548
|
+
class ZenduSelectOptionDirective {
|
|
1549
|
+
constructor(template) {
|
|
1550
|
+
this.template = template;
|
|
1551
|
+
}
|
|
1552
|
+
}
|
|
1553
|
+
ZenduSelectOptionDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: ZenduSelectOptionDirective, deps: [{ token: i0.TemplateRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
1554
|
+
ZenduSelectOptionDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.2.12", type: ZenduSelectOptionDirective, selector: "[zen-select-option]", ngImport: i0 });
|
|
1555
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: ZenduSelectOptionDirective, decorators: [{
|
|
1556
|
+
type: Directive,
|
|
1557
|
+
args: [{
|
|
1558
|
+
selector: '[zen-select-option]'
|
|
1559
|
+
}]
|
|
1560
|
+
}], ctorParameters: function () { return [{ type: i0.TemplateRef }]; } });
|
|
1561
|
+
|
|
1562
|
+
class ZenduSelectValueDirective {
|
|
1563
|
+
constructor(template) {
|
|
1564
|
+
this.template = template;
|
|
1565
|
+
}
|
|
1566
|
+
}
|
|
1567
|
+
ZenduSelectValueDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: ZenduSelectValueDirective, deps: [{ token: i0.TemplateRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
1568
|
+
ZenduSelectValueDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.2.12", type: ZenduSelectValueDirective, selector: "[zen-select-value]", ngImport: i0 });
|
|
1569
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: ZenduSelectValueDirective, decorators: [{
|
|
1570
|
+
type: Directive,
|
|
1571
|
+
args: [{
|
|
1572
|
+
selector: '[zen-select-value]'
|
|
1573
|
+
}]
|
|
1574
|
+
}], ctorParameters: function () { return [{ type: i0.TemplateRef }]; } });
|
|
1575
|
+
|
|
1576
|
+
class ZenduSelectComponent {
|
|
1577
|
+
constructor(_element) {
|
|
1578
|
+
this._element = _element;
|
|
1579
|
+
/**
|
|
1580
|
+
* callback to emit changes for parent component
|
|
1581
|
+
*/
|
|
1582
|
+
this.selectModelChange = new EventEmitter();
|
|
1583
|
+
/**
|
|
1584
|
+
* List of options for select
|
|
1585
|
+
*/
|
|
1586
|
+
this.options = [];
|
|
1587
|
+
/**
|
|
1588
|
+
* Property to set custom placeholder value
|
|
1589
|
+
*/
|
|
1590
|
+
this.placeholder = 'Select Items';
|
|
1591
|
+
/**
|
|
1592
|
+
* Component property to disable component
|
|
1593
|
+
*/
|
|
1594
|
+
this.disabled = false;
|
|
1595
|
+
/**
|
|
1596
|
+
* Show the custom icon for toggle
|
|
1597
|
+
*/
|
|
1598
|
+
this.customIcon = "";
|
|
1599
|
+
/**
|
|
1600
|
+
* Color for custom icon
|
|
1601
|
+
*/
|
|
1602
|
+
this.customIconColor = "";
|
|
1603
|
+
/**
|
|
1604
|
+
* Truncate text with "..." at the end
|
|
1605
|
+
*/
|
|
1606
|
+
this.isTruncate = false;
|
|
1607
|
+
/**
|
|
1608
|
+
* Is dropdown expanded
|
|
1609
|
+
*/
|
|
1610
|
+
this.isExpanded = false;
|
|
1611
|
+
this.searchText = '';
|
|
1612
|
+
this.labelText = '';
|
|
1613
|
+
this.isTopMenuDirection = false;
|
|
1614
|
+
}
|
|
1615
|
+
outsideHandling(event) {
|
|
1616
|
+
if (!document.body.contains(event.target)) {
|
|
1617
|
+
// element not in the DOM
|
|
1618
|
+
return;
|
|
1619
|
+
}
|
|
1620
|
+
if (this._element.nativeElement.contains(event.target)) {
|
|
1621
|
+
return;
|
|
1622
|
+
}
|
|
1623
|
+
// hide the menu for outside click
|
|
1624
|
+
this.hideDropDown();
|
|
1625
|
+
}
|
|
1626
|
+
scroll() {
|
|
1627
|
+
this.updatePlacement();
|
|
1628
|
+
}
|
|
1629
|
+
ngOnChanges(changeObj) {
|
|
1630
|
+
this.filterOptions();
|
|
1631
|
+
this.updateLabel();
|
|
1632
|
+
}
|
|
1633
|
+
isModelEmpty() {
|
|
1634
|
+
if (this.isMultiselect) {
|
|
1635
|
+
return !this.selectModel || !this.selectModel.length;
|
|
1636
|
+
}
|
|
1637
|
+
else {
|
|
1638
|
+
return typeof this.selectModel === 'undefined' || this.selectModel === null;
|
|
1639
|
+
}
|
|
1640
|
+
}
|
|
1641
|
+
handleOptionClick(option) {
|
|
1642
|
+
const optionValue = this.returnOption ? option : this.getId(option);
|
|
1643
|
+
if (this.isMultiselect) {
|
|
1644
|
+
this.toggleOption(optionValue);
|
|
1645
|
+
}
|
|
1646
|
+
else {
|
|
1647
|
+
this.singleSelect(optionValue);
|
|
1648
|
+
}
|
|
1649
|
+
this.emitChange();
|
|
1650
|
+
}
|
|
1651
|
+
// Logic for single select
|
|
1652
|
+
singleSelect(value) {
|
|
1653
|
+
this.selectModel = value;
|
|
1654
|
+
// Hide dropdown if single select
|
|
1655
|
+
this.hideDropDown();
|
|
1656
|
+
}
|
|
1657
|
+
toggleExpand() {
|
|
1658
|
+
this.isExpanded = !this.isExpanded;
|
|
1659
|
+
this.searchText = "";
|
|
1660
|
+
this.filterOptions();
|
|
1661
|
+
this.updatePlacement();
|
|
1662
|
+
}
|
|
1663
|
+
// Logic for multiselect
|
|
1664
|
+
toggleOption(value) {
|
|
1665
|
+
if (!Array.isArray(this.selectModel)) {
|
|
1666
|
+
this.selectModel = [];
|
|
1667
|
+
}
|
|
1668
|
+
const index = this.getElementIndex(value);
|
|
1669
|
+
if (index < 0) {
|
|
1670
|
+
this.selectModel.push(value);
|
|
1671
|
+
}
|
|
1672
|
+
else {
|
|
1673
|
+
this.selectModel.splice(index, 1);
|
|
1674
|
+
}
|
|
1675
|
+
this.updateLabel();
|
|
1676
|
+
}
|
|
1677
|
+
getElementIndex(value) {
|
|
1678
|
+
if (typeof value === 'object') {
|
|
1679
|
+
const valueId = this.getId(value);
|
|
1680
|
+
return this.selectModel.findIndex(el => this.getId(el) === valueId);
|
|
1681
|
+
}
|
|
1682
|
+
else {
|
|
1683
|
+
return this.selectModel.indexOf(value);
|
|
1684
|
+
}
|
|
1685
|
+
}
|
|
1686
|
+
toggleAll() {
|
|
1687
|
+
if (this.selectModel.length !== this.options.length) {
|
|
1688
|
+
this.selectModel = this.options.map(el => this.returnOption ? el : this.getId(el));
|
|
1689
|
+
}
|
|
1690
|
+
else {
|
|
1691
|
+
this.selectModel = [];
|
|
1692
|
+
}
|
|
1693
|
+
this.emitChange();
|
|
1694
|
+
}
|
|
1695
|
+
onSearchChange() {
|
|
1696
|
+
this.filterOptions();
|
|
1697
|
+
}
|
|
1698
|
+
filterOptions() {
|
|
1699
|
+
const options = this.options.slice(0);
|
|
1700
|
+
if (!this.searchText) {
|
|
1701
|
+
this.filteredOptions = options;
|
|
1702
|
+
return;
|
|
1703
|
+
}
|
|
1704
|
+
const regex = new RegExp(this.searchText, 'i');
|
|
1705
|
+
this.filteredOptions = options.filter(option => regex.test(this.getName(option)));
|
|
1706
|
+
}
|
|
1707
|
+
isSelected(option) {
|
|
1708
|
+
if (this.isModelEmpty()) {
|
|
1709
|
+
return false;
|
|
1710
|
+
}
|
|
1711
|
+
const optionId = this.getId(option);
|
|
1712
|
+
if (this.isMultiselect) {
|
|
1713
|
+
return this.selectModel.findIndex(el => this.getId(el) === optionId) >= 0;
|
|
1714
|
+
}
|
|
1715
|
+
else {
|
|
1716
|
+
return this.getId(this.selectModel) === optionId;
|
|
1717
|
+
}
|
|
1718
|
+
}
|
|
1719
|
+
updateLabel() {
|
|
1720
|
+
if (this.isModelEmpty()) {
|
|
1721
|
+
return;
|
|
1722
|
+
}
|
|
1723
|
+
if (this.isMultiselect) {
|
|
1724
|
+
const selectedCount = this.selectModel.length;
|
|
1725
|
+
if (selectedCount === 1) {
|
|
1726
|
+
this.labelText = this.getNameFromValue(this.selectModel[0]);
|
|
1727
|
+
}
|
|
1728
|
+
else {
|
|
1729
|
+
this.labelText = `${selectedCount} Selected`;
|
|
1730
|
+
}
|
|
1731
|
+
}
|
|
1732
|
+
else {
|
|
1733
|
+
this.labelText = this.getNameFromValue(this.selectModel);
|
|
1734
|
+
}
|
|
1735
|
+
}
|
|
1736
|
+
getNameFromValue(val) {
|
|
1737
|
+
if (this.returnOption) {
|
|
1738
|
+
return this.getName(val);
|
|
1739
|
+
}
|
|
1740
|
+
else {
|
|
1741
|
+
if (!this.options || !this.options.length) {
|
|
1742
|
+
return '';
|
|
1743
|
+
}
|
|
1744
|
+
return this.getName(this.options.find(el => this.getId(el) === val));
|
|
1745
|
+
}
|
|
1746
|
+
}
|
|
1747
|
+
getName(option) {
|
|
1748
|
+
if (typeof option === 'object') {
|
|
1749
|
+
if (this.displayProp) {
|
|
1750
|
+
return this.GetRecursiveProperty(option, this.displayProp);
|
|
1751
|
+
}
|
|
1752
|
+
else {
|
|
1753
|
+
console.error('App-Select: when using objects as model, a displayProp value is mandatory.');
|
|
1754
|
+
return "";
|
|
1755
|
+
}
|
|
1756
|
+
}
|
|
1757
|
+
else {
|
|
1758
|
+
return option;
|
|
1759
|
+
}
|
|
1760
|
+
}
|
|
1761
|
+
getId(option) {
|
|
1762
|
+
if (typeof option === 'object') {
|
|
1763
|
+
if (this.idProp) {
|
|
1764
|
+
return this.GetRecursiveProperty(option, this.idProp);
|
|
1765
|
+
}
|
|
1766
|
+
else {
|
|
1767
|
+
console.error('App-Select: when using objects as model, a idProp value is mandatory.');
|
|
1768
|
+
return "";
|
|
1769
|
+
}
|
|
1770
|
+
}
|
|
1771
|
+
else {
|
|
1772
|
+
return option;
|
|
1773
|
+
}
|
|
1774
|
+
}
|
|
1775
|
+
GetRecursiveProperty(object, path) {
|
|
1776
|
+
return path.split('.').reduce((obj, x) => {
|
|
1777
|
+
if (obj) {
|
|
1778
|
+
return obj[x];
|
|
1779
|
+
}
|
|
1780
|
+
else {
|
|
1781
|
+
return null;
|
|
1782
|
+
}
|
|
1783
|
+
}, object);
|
|
1784
|
+
}
|
|
1785
|
+
async hideDropDown() {
|
|
1786
|
+
this.isExpanded = false;
|
|
1787
|
+
}
|
|
1788
|
+
emitChange() {
|
|
1789
|
+
// notify with timeout
|
|
1790
|
+
// allow output property "enabled" applied by parent first and then emit the onChange
|
|
1791
|
+
setTimeout(() => {
|
|
1792
|
+
this.selectModelChange.emit(this.selectModel);
|
|
1793
|
+
}, 1);
|
|
1794
|
+
}
|
|
1795
|
+
updatePlacement() {
|
|
1796
|
+
// update menu position base on scroll
|
|
1797
|
+
this.isTopMenuDirection = this.getMenuDirection() === "top";
|
|
1798
|
+
}
|
|
1799
|
+
getMenuDirection() {
|
|
1800
|
+
const element = this._element.nativeElement;
|
|
1801
|
+
const top = element.getBoundingClientRect().top;
|
|
1802
|
+
const height = window.innerHeight;
|
|
1803
|
+
if (top > (height / 2)) {
|
|
1804
|
+
return "top";
|
|
1805
|
+
}
|
|
1806
|
+
else {
|
|
1807
|
+
return "bottom";
|
|
1808
|
+
}
|
|
1809
|
+
}
|
|
1810
|
+
getMaxMenuHeight() {
|
|
1811
|
+
const containerElement = this.getContainerElement();
|
|
1812
|
+
if (!containerElement || !containerElement.clientHeight) {
|
|
1813
|
+
return "190px";
|
|
1814
|
+
}
|
|
1815
|
+
const parentHeight = containerElement.clientHeight;
|
|
1816
|
+
let height = Math.round((parentHeight / 2) - 25);
|
|
1817
|
+
height = Math.min(216, height);
|
|
1818
|
+
height = Math.max(96, height);
|
|
1819
|
+
return `${height}px`;
|
|
1820
|
+
}
|
|
1821
|
+
getContainerElement() {
|
|
1822
|
+
const component = this._element.nativeElement;
|
|
1823
|
+
const container = component.getElementsByClassName("app-select").item(0);
|
|
1824
|
+
return container.offsetParent;
|
|
1825
|
+
}
|
|
1826
|
+
}
|
|
1827
|
+
ZenduSelectComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: ZenduSelectComponent, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
1828
|
+
ZenduSelectComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.12", type: ZenduSelectComponent, selector: "zen-select", inputs: { selectModel: "selectModel", options: "options", placeholder: "placeholder", displayProp: "displayProp", idProp: "idProp", hasSearch: "hasSearch", returnOption: "returnOption", isMultiselect: "isMultiselect", disabled: "disabled", customIcon: "customIcon", customIconColor: "customIconColor", isTruncate: "isTruncate" }, outputs: { selectModelChange: "selectModelChange" }, host: { listeners: { "window:mousedown": "outsideHandling($event)", "window:scroll": "scroll()" } }, queries: [{ propertyName: "optionTemplate", first: true, predicate: ZenduSelectOptionDirective, descendants: true }, { propertyName: "valueTemplate", first: true, predicate: ZenduSelectValueDirective, descendants: true }], usesOnChanges: true, ngImport: i0, template: "<div class=\"app-select\">\n <button class=\"app-select-toggle\"\n [disabled]=\"disabled\"\n (click)=\"toggleExpand()\"\n [ngClass]=\"{'active': isExpanded}\">\n <div class=\"app-select-label\">\n <div class=\"placeholder\"\n *ngIf=\"isModelEmpty()\">\n <span>{{placeholder}}</span>\n </div>\n <div class=\"selected-item\"\n *ngIf=\"!isMultiselect && !isModelEmpty()\">\n <ng-template *ngIf=\"valueTemplate && selectModel[0]; else tplValueText\"\n [ngTemplateOutlet]=\"valueTemplate.template\"\n [ngTemplateOutletContext]=\"{ selectModel: selectModel, labelText: labelText }\"></ng-template>\n <ng-template #tplValueText>\n <span>{{ labelText }}</span>\n </ng-template>\n </div>\n <div class=\"selected-item\"\n *ngIf=\"isMultiselect && !isModelEmpty()\">\n <span>{{ labelText }}</span>\n </div>\n </div>\n <i *ngIf=\"!customIcon\"\n class=\"material-icons app-select-icon\">expand_more</i>\n <i *ngIf=\"customIcon\"\n class=\"material-icons-outlined custom-icon\"\n [style.color]=\"customIconColor\">{{customIcon}}</i>\n </button>\n\n <div class=\"action-menu-container\">\n <div class=\"action-menu app-select-dropdown-wrapper\"\n [ngClass]=\"{ 'show-top': isTopMenuDirection }\">\n <div class=\"app-select-dropdown\"\n *ngIf=\"isExpanded\">\n <div class=\"action-menu-header\"\n *ngIf=\"hasSearch\">\n <!--Search options-->\n <div class=\"search-wrapper\">\n <zen-search-box [(text)]=\"searchText\"\n (textChange)=\"onSearchChange()\"></zen-search-box>\n </div>\n </div>\n <div class=\"action-menu-body\">\n <!--No options found-->\n <div class=\"no-options-found\"\n *ngIf=\"!filteredOptions.length\">\n No matching options found\n </div>\n\n <!--Select All Option-->\n <div class=\"action-item-checkbox select-all\"\n *ngIf=\"isMultiselect && !searchText\"\n (click)=\"toggleAll()\">\n <zen-checkbox [checked]=\"selectModel.length === options.length\"\n [indeterminate]=\"selectModel.length !== options.length && selectModel.length\"\n [disableValueChange]=\"true\"\n [label]=\"'Select All'\"></zen-checkbox>\n </div>\n\n <!--Single select Options-->\n <ng-container *ngIf=\"!isMultiselect\">\n <a class=\"action-item\"\n *ngFor=\"let option of filteredOptions\"\n (click)=\"handleOptionClick(option)\"\n [ngClass]=\"{ 'active': isSelected(option) }\">\n <span *ngIf=\"!isMultiselect\"\n [class.action-item-truncate]=\"isTruncate\">\n <ng-template *ngIf=\"optionTemplate; else tplOptionText\"\n [ngTemplateOutlet]=\"optionTemplate.template\"\n [ngTemplateOutletContext]=\"{ option: option }\">\n </ng-template>\n <ng-template #tplOptionText>\n {{ getName(option) }}\n </ng-template>\n </span>\n </a>\n </ng-container>\n\n <!--Multiselect Options-->\n <ng-container *ngIf=\"isMultiselect\">\n <div class=\"action-item-checkbox\"\n *ngFor=\"let option of filteredOptions\"\n (click)=\"handleOptionClick(option)\">\n <zen-checkbox *ngIf=\"isMultiselect\"\n [checked]=\"isSelected(option)\"\n [label]=\"getName(option)\"\n [disableValueChange]=\"true\"></zen-checkbox>\n </div>\n </ng-container>\n </div>\n </div>\n </div>\n </div>\n</div>", styles: [".app-select{width:100%;position:relative}.app-select ::-webkit-scrollbar-thumb{background-color:var(--color-primary, #2188d9)}.app-select .app-select-toggle{display:flex;align-items:center;justify-content:space-between;position:relative;transition:.3s;width:100%;background:#ffffff;-webkit-appearance:none;appearance:none;outline:none;cursor:pointer;border:none;border-radius:0;border-bottom:1px solid #d6d6d8;padding:0 0 8px;font-style:normal;font-weight:400;font-size:16px;line-height:24px;color:#333}.app-select .app-select-toggle .app-select-label{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-style:normal;font-weight:400;font-size:14px;line-height:24px}.app-select .app-select-toggle .app-select-label .placeholder{color:#bebebe}.app-select .app-select-toggle .app-select-label .selected-item{color:#333}.app-select .app-select-toggle .custom-icon{color:#bebebe}.app-select .app-select-toggle .app-select-icon{color:#bebebe;transition:.3s}.app-select .app-select-toggle:focus{border-color:var(--color-primary, #2188d9)}.app-select .app-select-toggle:focus .app-select-icon,.app-select .app-select-toggle:focus .custom-icon{color:var(--color-primary, #2188d9)!important}.app-select .app-select-toggle[readonly],.app-select .app-select-toggle[disabled]{cursor:not-allowed;color:#b8b9bc;border-color:#d0d0d2}.app-select .app-select-toggle.active{border-color:var(--color-primary, #2188d9)}.app-select .app-select-toggle.active .custom-icon{color:var(--color-primary, #2188d9)!important}.app-select .app-select-toggle.active .app-select-icon{transform:rotate(180deg);color:var(--color-primary, #2188d9)}.app-select .action-menu-container{position:sticky;width:inherit;z-index:10}.app-select .app-select-dropdown-wrapper{top:115%;width:inherit}.app-select .app-select-dropdown-wrapper.show-top{top:unset;bottom:115%}.app-select .app-select-dropdown-wrapper .action-menu-body{max-height:200px;overflow:auto}.app-select .app-select-dropdown-wrapper .no-options-found{background:#ffffff;color:#b8b9bc;padding:8px 16px;text-decoration:none;font-style:normal;font-weight:400;font-size:16px;line-height:24px}.app-select .app-select-dropdown-wrapper .select-all{font-weight:500}\n"], dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: ZenduCheckboxComponent, selector: "zen-checkbox", inputs: ["checked", "label", "disabled", "disableValueChange", "indeterminate", "imageUrl"], outputs: ["checkedChange"] }, { kind: "component", type: ZenduSearchBoxComponent, selector: "zen-search-box", inputs: ["text", "delay", "autoFocus", "placeholder"], outputs: ["textChange"] }] });
|
|
1829
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: ZenduSelectComponent, decorators: [{
|
|
1830
|
+
type: Component,
|
|
1831
|
+
args: [{ selector: 'zen-select', template: "<div class=\"app-select\">\n <button class=\"app-select-toggle\"\n [disabled]=\"disabled\"\n (click)=\"toggleExpand()\"\n [ngClass]=\"{'active': isExpanded}\">\n <div class=\"app-select-label\">\n <div class=\"placeholder\"\n *ngIf=\"isModelEmpty()\">\n <span>{{placeholder}}</span>\n </div>\n <div class=\"selected-item\"\n *ngIf=\"!isMultiselect && !isModelEmpty()\">\n <ng-template *ngIf=\"valueTemplate && selectModel[0]; else tplValueText\"\n [ngTemplateOutlet]=\"valueTemplate.template\"\n [ngTemplateOutletContext]=\"{ selectModel: selectModel, labelText: labelText }\"></ng-template>\n <ng-template #tplValueText>\n <span>{{ labelText }}</span>\n </ng-template>\n </div>\n <div class=\"selected-item\"\n *ngIf=\"isMultiselect && !isModelEmpty()\">\n <span>{{ labelText }}</span>\n </div>\n </div>\n <i *ngIf=\"!customIcon\"\n class=\"material-icons app-select-icon\">expand_more</i>\n <i *ngIf=\"customIcon\"\n class=\"material-icons-outlined custom-icon\"\n [style.color]=\"customIconColor\">{{customIcon}}</i>\n </button>\n\n <div class=\"action-menu-container\">\n <div class=\"action-menu app-select-dropdown-wrapper\"\n [ngClass]=\"{ 'show-top': isTopMenuDirection }\">\n <div class=\"app-select-dropdown\"\n *ngIf=\"isExpanded\">\n <div class=\"action-menu-header\"\n *ngIf=\"hasSearch\">\n <!--Search options-->\n <div class=\"search-wrapper\">\n <zen-search-box [(text)]=\"searchText\"\n (textChange)=\"onSearchChange()\"></zen-search-box>\n </div>\n </div>\n <div class=\"action-menu-body\">\n <!--No options found-->\n <div class=\"no-options-found\"\n *ngIf=\"!filteredOptions.length\">\n No matching options found\n </div>\n\n <!--Select All Option-->\n <div class=\"action-item-checkbox select-all\"\n *ngIf=\"isMultiselect && !searchText\"\n (click)=\"toggleAll()\">\n <zen-checkbox [checked]=\"selectModel.length === options.length\"\n [indeterminate]=\"selectModel.length !== options.length && selectModel.length\"\n [disableValueChange]=\"true\"\n [label]=\"'Select All'\"></zen-checkbox>\n </div>\n\n <!--Single select Options-->\n <ng-container *ngIf=\"!isMultiselect\">\n <a class=\"action-item\"\n *ngFor=\"let option of filteredOptions\"\n (click)=\"handleOptionClick(option)\"\n [ngClass]=\"{ 'active': isSelected(option) }\">\n <span *ngIf=\"!isMultiselect\"\n [class.action-item-truncate]=\"isTruncate\">\n <ng-template *ngIf=\"optionTemplate; else tplOptionText\"\n [ngTemplateOutlet]=\"optionTemplate.template\"\n [ngTemplateOutletContext]=\"{ option: option }\">\n </ng-template>\n <ng-template #tplOptionText>\n {{ getName(option) }}\n </ng-template>\n </span>\n </a>\n </ng-container>\n\n <!--Multiselect Options-->\n <ng-container *ngIf=\"isMultiselect\">\n <div class=\"action-item-checkbox\"\n *ngFor=\"let option of filteredOptions\"\n (click)=\"handleOptionClick(option)\">\n <zen-checkbox *ngIf=\"isMultiselect\"\n [checked]=\"isSelected(option)\"\n [label]=\"getName(option)\"\n [disableValueChange]=\"true\"></zen-checkbox>\n </div>\n </ng-container>\n </div>\n </div>\n </div>\n </div>\n</div>", styles: [".app-select{width:100%;position:relative}.app-select ::-webkit-scrollbar-thumb{background-color:var(--color-primary, #2188d9)}.app-select .app-select-toggle{display:flex;align-items:center;justify-content:space-between;position:relative;transition:.3s;width:100%;background:#ffffff;-webkit-appearance:none;appearance:none;outline:none;cursor:pointer;border:none;border-radius:0;border-bottom:1px solid #d6d6d8;padding:0 0 8px;font-style:normal;font-weight:400;font-size:16px;line-height:24px;color:#333}.app-select .app-select-toggle .app-select-label{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-style:normal;font-weight:400;font-size:14px;line-height:24px}.app-select .app-select-toggle .app-select-label .placeholder{color:#bebebe}.app-select .app-select-toggle .app-select-label .selected-item{color:#333}.app-select .app-select-toggle .custom-icon{color:#bebebe}.app-select .app-select-toggle .app-select-icon{color:#bebebe;transition:.3s}.app-select .app-select-toggle:focus{border-color:var(--color-primary, #2188d9)}.app-select .app-select-toggle:focus .app-select-icon,.app-select .app-select-toggle:focus .custom-icon{color:var(--color-primary, #2188d9)!important}.app-select .app-select-toggle[readonly],.app-select .app-select-toggle[disabled]{cursor:not-allowed;color:#b8b9bc;border-color:#d0d0d2}.app-select .app-select-toggle.active{border-color:var(--color-primary, #2188d9)}.app-select .app-select-toggle.active .custom-icon{color:var(--color-primary, #2188d9)!important}.app-select .app-select-toggle.active .app-select-icon{transform:rotate(180deg);color:var(--color-primary, #2188d9)}.app-select .action-menu-container{position:sticky;width:inherit;z-index:10}.app-select .app-select-dropdown-wrapper{top:115%;width:inherit}.app-select .app-select-dropdown-wrapper.show-top{top:unset;bottom:115%}.app-select .app-select-dropdown-wrapper .action-menu-body{max-height:200px;overflow:auto}.app-select .app-select-dropdown-wrapper .no-options-found{background:#ffffff;color:#b8b9bc;padding:8px 16px;text-decoration:none;font-style:normal;font-weight:400;font-size:16px;line-height:24px}.app-select .app-select-dropdown-wrapper .select-all{font-weight:500}\n"] }]
|
|
1832
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef }]; }, propDecorators: { selectModel: [{
|
|
1833
|
+
type: Input
|
|
1834
|
+
}], selectModelChange: [{
|
|
1835
|
+
type: Output
|
|
1836
|
+
}], options: [{
|
|
1837
|
+
type: Input
|
|
1838
|
+
}], placeholder: [{
|
|
1839
|
+
type: Input
|
|
1840
|
+
}], displayProp: [{
|
|
1841
|
+
type: Input
|
|
1842
|
+
}], idProp: [{
|
|
1843
|
+
type: Input
|
|
1844
|
+
}], hasSearch: [{
|
|
1845
|
+
type: Input
|
|
1846
|
+
}], returnOption: [{
|
|
1847
|
+
type: Input
|
|
1848
|
+
}], isMultiselect: [{
|
|
1849
|
+
type: Input
|
|
1850
|
+
}], disabled: [{
|
|
1851
|
+
type: Input
|
|
1852
|
+
}], customIcon: [{
|
|
1853
|
+
type: Input
|
|
1854
|
+
}], customIconColor: [{
|
|
1855
|
+
type: Input
|
|
1856
|
+
}], isTruncate: [{
|
|
1857
|
+
type: Input
|
|
1858
|
+
}], optionTemplate: [{
|
|
1859
|
+
type: ContentChild,
|
|
1860
|
+
args: [ZenduSelectOptionDirective]
|
|
1861
|
+
}], valueTemplate: [{
|
|
1862
|
+
type: ContentChild,
|
|
1863
|
+
args: [ZenduSelectValueDirective]
|
|
1864
|
+
}], outsideHandling: [{
|
|
1865
|
+
type: HostListener,
|
|
1866
|
+
args: ['window:mousedown', ['$event']]
|
|
1867
|
+
}], scroll: [{
|
|
1868
|
+
type: HostListener,
|
|
1869
|
+
args: ['window:scroll', []]
|
|
1870
|
+
}] } });
|
|
1871
|
+
|
|
1872
|
+
class ZenduPaginationBarComponent {
|
|
1873
|
+
constructor() {
|
|
1874
|
+
this.pageChange = new EventEmitter();
|
|
1875
|
+
this.perPageChange = new EventEmitter();
|
|
1876
|
+
this.pagesInGroup = 7;
|
|
1877
|
+
this.availablePagesSize = [10, 20, 30, 40, 50];
|
|
1878
|
+
this.page = 1;
|
|
1879
|
+
this.perPage = 10;
|
|
1880
|
+
}
|
|
1881
|
+
ngOnChanges(changes) {
|
|
1882
|
+
if (changes["count"]) {
|
|
1883
|
+
this.reCalculatePageCount();
|
|
1884
|
+
}
|
|
1885
|
+
}
|
|
1886
|
+
nextPage() {
|
|
1887
|
+
if (this.page + 1 > this.totalPages) {
|
|
1888
|
+
return;
|
|
1889
|
+
}
|
|
1890
|
+
this.page++;
|
|
1891
|
+
this.pageChange.emit(this.page);
|
|
1892
|
+
}
|
|
1893
|
+
prevPage() {
|
|
1894
|
+
if (this.page - 1 <= 0) {
|
|
1895
|
+
return;
|
|
1896
|
+
}
|
|
1897
|
+
this.page--;
|
|
1898
|
+
this.pageChange.emit(this.page);
|
|
1899
|
+
}
|
|
1900
|
+
updatePageSize() {
|
|
1901
|
+
this.reCalculatePageCount();
|
|
1902
|
+
this.page = 1;
|
|
1903
|
+
this.pageChange.emit(this.page);
|
|
1904
|
+
this.perPageChange.emit(this.perPage);
|
|
1905
|
+
}
|
|
1906
|
+
endRowSize() {
|
|
1907
|
+
const to = this.page * this.perPage;
|
|
1908
|
+
if (to <= this.count) {
|
|
1909
|
+
return to;
|
|
1910
|
+
}
|
|
1911
|
+
else {
|
|
1912
|
+
return this.count;
|
|
1913
|
+
}
|
|
1914
|
+
}
|
|
1915
|
+
reCalculatePageCount() {
|
|
1916
|
+
let pages = this.count / this.perPage;
|
|
1917
|
+
if (this.count % this.perPage !== 0) {
|
|
1918
|
+
pages++;
|
|
1919
|
+
}
|
|
1920
|
+
this.totalPages = pages;
|
|
1921
|
+
}
|
|
1922
|
+
}
|
|
1923
|
+
ZenduPaginationBarComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: ZenduPaginationBarComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1924
|
+
ZenduPaginationBarComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.12", type: ZenduPaginationBarComponent, selector: "zen-pagination-bar", inputs: { page: "page", perPage: "perPage", count: "count" }, outputs: { pageChange: "pageChange", perPageChange: "perPageChange" }, usesOnChanges: true, ngImport: i0, template: "<div class=\"pagination-component\">\n <div class=\"select-dropdown\">\n <label>Rows per page:</label>\n <zen-select [(selectModel)]=\"perPage\"\n [options]=\"availablePagesSize\"\n (selectModelChange)=\"updatePageSize()\"></zen-select>\n </div>\n <div class=\"pages\">\n <button class=\"pagination-button\"\n [disabled]=\"page - 1 <= 0\"\n (click)=\"prevPage()\">\n <i class=\"material-icons\">keyboard_arrow_left</i>\n </button>\n <label>{{((page - 1) * perPage) + 1 }} - {{endRowSize()}} of {{count}}</label>\n <button class=\"pagination-button\"\n [disabled]=\"page + 1 > totalPages\"\n (click)=\"nextPage()\">\n <i class=\"material-icons\">keyboard_arrow_right</i>\n </button>\n </div>\n</div>\n", styles: [".pagination-component{display:flex;flex-direction:row;justify-content:space-between;align-items:center}.pagination-component .select-dropdown{display:flex;flex-direction:row;align-items:center;gap:8px}.pagination-component .select-dropdown label{margin:0;font-style:normal;font-weight:400;font-size:12px;line-height:120%;color:#4f4f4f}.pagination-component .pages{display:flex;flex-direction:row;align-items:center;gap:8px}.pagination-component .pages label{margin:0;font-style:normal;font-weight:400;font-size:12px;line-height:16px;color:#828282}.pagination-component .pages .pagination-button{display:flex;flex-direction:row;align-items:center;height:16px;padding:0;box-sizing:border-box;white-space:nowrap;border:none;border-radius:50%;transition:.1s;cursor:pointer;color:#828282;background:#FFFFFF}.pagination-component .pages .pagination-button:hover{color:#4f4f4f;background:#F2F2F2}.pagination-component .pages .pagination-button:focus{outline:none;color:#2188d9;background:#F4F9FD}.pagination-component .pages .pagination-button:disabled{color:#e0e0e0;background:#FFFFFF;cursor:not-allowed}.pagination-component .pages .pagination-button .material-icons{font-size:16px;height:16px;width:16px}\n"], dependencies: [{ kind: "component", type: ZenduSelectComponent, selector: "zen-select", inputs: ["selectModel", "options", "placeholder", "displayProp", "idProp", "hasSearch", "returnOption", "isMultiselect", "disabled", "customIcon", "customIconColor", "isTruncate"], outputs: ["selectModelChange"] }] });
|
|
1925
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: ZenduPaginationBarComponent, decorators: [{
|
|
1926
|
+
type: Component,
|
|
1927
|
+
args: [{ selector: 'zen-pagination-bar', template: "<div class=\"pagination-component\">\n <div class=\"select-dropdown\">\n <label>Rows per page:</label>\n <zen-select [(selectModel)]=\"perPage\"\n [options]=\"availablePagesSize\"\n (selectModelChange)=\"updatePageSize()\"></zen-select>\n </div>\n <div class=\"pages\">\n <button class=\"pagination-button\"\n [disabled]=\"page - 1 <= 0\"\n (click)=\"prevPage()\">\n <i class=\"material-icons\">keyboard_arrow_left</i>\n </button>\n <label>{{((page - 1) * perPage) + 1 }} - {{endRowSize()}} of {{count}}</label>\n <button class=\"pagination-button\"\n [disabled]=\"page + 1 > totalPages\"\n (click)=\"nextPage()\">\n <i class=\"material-icons\">keyboard_arrow_right</i>\n </button>\n </div>\n</div>\n", styles: [".pagination-component{display:flex;flex-direction:row;justify-content:space-between;align-items:center}.pagination-component .select-dropdown{display:flex;flex-direction:row;align-items:center;gap:8px}.pagination-component .select-dropdown label{margin:0;font-style:normal;font-weight:400;font-size:12px;line-height:120%;color:#4f4f4f}.pagination-component .pages{display:flex;flex-direction:row;align-items:center;gap:8px}.pagination-component .pages label{margin:0;font-style:normal;font-weight:400;font-size:12px;line-height:16px;color:#828282}.pagination-component .pages .pagination-button{display:flex;flex-direction:row;align-items:center;height:16px;padding:0;box-sizing:border-box;white-space:nowrap;border:none;border-radius:50%;transition:.1s;cursor:pointer;color:#828282;background:#FFFFFF}.pagination-component .pages .pagination-button:hover{color:#4f4f4f;background:#F2F2F2}.pagination-component .pages .pagination-button:focus{outline:none;color:#2188d9;background:#F4F9FD}.pagination-component .pages .pagination-button:disabled{color:#e0e0e0;background:#FFFFFF;cursor:not-allowed}.pagination-component .pages .pagination-button .material-icons{font-size:16px;height:16px;width:16px}\n"] }]
|
|
1928
|
+
}], ctorParameters: function () { return []; }, propDecorators: { page: [{
|
|
1929
|
+
type: Input
|
|
1930
|
+
}], perPage: [{
|
|
1931
|
+
type: Input
|
|
1932
|
+
}], count: [{
|
|
1933
|
+
type: Input
|
|
1934
|
+
}], pageChange: [{
|
|
1935
|
+
type: Output
|
|
1936
|
+
}], perPageChange: [{
|
|
1937
|
+
type: Output
|
|
1938
|
+
}] } });
|
|
1939
|
+
|
|
1940
|
+
class ZenduPhoneInputComponent {
|
|
1941
|
+
constructor() {
|
|
1942
|
+
this.maxLength = 12;
|
|
1943
|
+
this.phoneChange = new EventEmitter();
|
|
1944
|
+
this.validChange = new EventEmitter();
|
|
1945
|
+
this.disabled = false;
|
|
1946
|
+
this.phoneText = "";
|
|
1947
|
+
this.countryList = [
|
|
1948
|
+
{
|
|
1949
|
+
countryCode: "US",
|
|
1950
|
+
countryName: "America",
|
|
1951
|
+
countryCallingCode: "+1",
|
|
1952
|
+
flag: "https://storage.googleapis.com/zenduit-icons/Flags/USA.svg"
|
|
1953
|
+
},
|
|
1954
|
+
{
|
|
1955
|
+
countryCode: "CA",
|
|
1956
|
+
countryName: "Canada",
|
|
1957
|
+
countryCallingCode: "+1",
|
|
1958
|
+
flag: "https://storage.googleapis.com/zenduit-icons/Flags/Canada.svg"
|
|
1959
|
+
},
|
|
1960
|
+
{
|
|
1961
|
+
countryCode: "MX",
|
|
1962
|
+
countryName: "Mexico",
|
|
1963
|
+
countryCallingCode: "+52",
|
|
1964
|
+
flag: "https://storage.googleapis.com/zenduit-icons/Flags/Mexico.svg"
|
|
1965
|
+
}
|
|
1966
|
+
];
|
|
1967
|
+
this.customCountry = {
|
|
1968
|
+
countryCode: "",
|
|
1969
|
+
countryName: "Custom",
|
|
1970
|
+
countryCallingCode: "",
|
|
1971
|
+
flag: "https://storage.googleapis.com/zenduit-icons/Flags/Custom.svg"
|
|
1972
|
+
};
|
|
1973
|
+
this.isExpanded = false;
|
|
1974
|
+
this.selectedCountry = this.countryList[1];
|
|
1975
|
+
}
|
|
1976
|
+
ngOnInit() {
|
|
1977
|
+
this.parseNumber();
|
|
1978
|
+
}
|
|
1979
|
+
ngOnChanges(changes) {
|
|
1980
|
+
if (changes["phone"] && (!this.selectedCountry || !this.selectedCountry.countryCode)) {
|
|
1981
|
+
this.parseNumber();
|
|
1982
|
+
}
|
|
1983
|
+
}
|
|
1984
|
+
parseNumber() {
|
|
1985
|
+
try {
|
|
1986
|
+
this.phoneText = this.phone;
|
|
1987
|
+
if (this.phone) {
|
|
1988
|
+
const countryFromList = this.countryList.find(country => this.phone.startsWith(country.countryCallingCode) || `+${this.phone}`.startsWith(country.countryCallingCode));
|
|
1989
|
+
if (countryFromList) {
|
|
1990
|
+
this.selectedCountry = countryFromList || this.customCountry;
|
|
1991
|
+
const phoneNumberUtil = PhoneNumberUtil.getInstance();
|
|
1992
|
+
const parsedPhone = phoneNumberUtil.parse(this.phone || "", 'US');
|
|
1993
|
+
setTimeout(() => {
|
|
1994
|
+
if (this.phoneText.startsWith('+')) {
|
|
1995
|
+
this.phoneText = this.phoneText.replace(`+${parsedPhone.getCountryCode()}`, "");
|
|
1996
|
+
}
|
|
1997
|
+
else if (this.phoneText.startsWith(parsedPhone.getCountryCode())) {
|
|
1998
|
+
this.phoneText = this.phoneText.replace(parsedPhone.getCountryCode(), "");
|
|
1999
|
+
}
|
|
2000
|
+
this.phoneChanged();
|
|
2001
|
+
});
|
|
2002
|
+
}
|
|
2003
|
+
else {
|
|
2004
|
+
this.selectedCountry = this.customCountry;
|
|
2005
|
+
}
|
|
2006
|
+
}
|
|
2007
|
+
else {
|
|
2008
|
+
this.selectedCountry = this.customCountry;
|
|
2009
|
+
}
|
|
2010
|
+
}
|
|
2011
|
+
catch (err) {
|
|
2012
|
+
console.warn(`Can't parse phone: ${this.phone}`, err);
|
|
2013
|
+
this.selectedCountry = this.customCountry;
|
|
2014
|
+
}
|
|
2015
|
+
}
|
|
2016
|
+
countryChanged(country) {
|
|
2017
|
+
this.isExpanded = false;
|
|
2018
|
+
this.selectedCountry = country;
|
|
2019
|
+
this.phoneChanged();
|
|
2020
|
+
}
|
|
2021
|
+
phoneChanged(input) {
|
|
2022
|
+
// allow + in custom country
|
|
2023
|
+
let custom = false;
|
|
2024
|
+
if (this.selectedCountry === this.customCountry && this.phoneText.includes('+')) {
|
|
2025
|
+
custom = true;
|
|
2026
|
+
}
|
|
2027
|
+
const phoneText = (this.phoneText || '').replace(/\D/g, '');
|
|
2028
|
+
this.phoneText = custom ? `+${phoneText}` : phoneText;
|
|
2029
|
+
if (input && input.value !== this.phoneText) {
|
|
2030
|
+
input.value = this.phoneText;
|
|
2031
|
+
}
|
|
2032
|
+
const fullNumber = `${this.selectedCountry.countryCallingCode}${this.phoneText}`;
|
|
2033
|
+
if (this.phone !== fullNumber) {
|
|
2034
|
+
this.phoneChange.emit(fullNumber);
|
|
2035
|
+
}
|
|
2036
|
+
const phoneNumberUtil = PhoneNumberUtil.getInstance();
|
|
2037
|
+
if (this.selectedCountry === this.customCountry) {
|
|
2038
|
+
this.validChange.emit(true);
|
|
2039
|
+
}
|
|
2040
|
+
else {
|
|
2041
|
+
try {
|
|
2042
|
+
this.validChange.emit(phoneNumberUtil.isValidNumber(phoneNumberUtil.parseAndKeepRawInput(fullNumber)));
|
|
2043
|
+
}
|
|
2044
|
+
catch {
|
|
2045
|
+
this.validChange.emit(false);
|
|
2046
|
+
}
|
|
2047
|
+
}
|
|
2048
|
+
}
|
|
2049
|
+
hideDropDown() {
|
|
2050
|
+
this.isExpanded = false;
|
|
2051
|
+
}
|
|
2052
|
+
toggle() {
|
|
2053
|
+
if (this.disabled) {
|
|
2054
|
+
return;
|
|
2055
|
+
}
|
|
2056
|
+
this.isExpanded = !this.isExpanded;
|
|
2057
|
+
}
|
|
2058
|
+
}
|
|
2059
|
+
ZenduPhoneInputComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: ZenduPhoneInputComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2060
|
+
ZenduPhoneInputComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.12", type: ZenduPhoneInputComponent, selector: "zen-phone-input", inputs: { phone: "phone", maxLength: "maxLength", disabled: "disabled" }, outputs: { phoneChange: "phoneChange", validChange: "validChange" }, usesOnChanges: true, ngImport: i0, template: "<div class=\"phone-input-component\">\n <div class=\"material-input\">\n <a class=\"country-select\"\n (click)=\"toggle()\">\n <img class=\"country-flag\"\n [src]=\"selectedCountry.flag\">\n <i class=\"material-icons expand-icon\"\n [ngClass]=\"{'active': isExpanded}\">expand_more</i>\n <div class=\"code\">{{ selectedCountry.countryCallingCode }}</div>\n </a>\n <input class=\"phone-input\"\n type=\"text\"\n [(ngModel)]=\"phoneText\"\n (ngModelChange)=\"phoneChanged(input)\"\n (click)=\"isExpanded = false\"\n [disabled]=\"disabled\"\n country-code=\"selectedCountry.countryCode\"\n [maxlength]=\"maxLength\"\n #input>\n </div>\n\n <div class=\"action-menu country-dropdown-list\"\n *ngIf=\"isExpanded\">\n <div class=\"action-menu-body\">\n <!--Country's List-->\n <a class=\"action-item\"\n *ngFor=\"let country of countryList\"\n [ngClass]=\"{'active': selectedCountry.countryName === country.countryName}\"\n (click)=\"countryChanged(country)\">\n <img class=\"country-flag\"\n [src]=\"country.flag\">\n <div>{{ country.countryName }}</div>\n <div>{{ country.countryCallingCode }}</div>\n </a>\n\n <!--Custom Country-->\n <a class=\"action-item\"\n [ngClass]=\"{'active': selectedCountry.countryName === customCountry.countryName}\"\n (click)=\"countryChanged(customCountry)\">\n <img class=\"country-flag\"\n [src]=\"customCountry.flag\">\n <div>{{ customCountry.countryName }}</div>\n <div>{{ customCountry.countryCallingCode }}</div>\n </a>\n </div>\n </div>\n</div>\n", styles: [".phone-input-component{position:relative;width:100%}.phone-input-component .material-input,.phone-input-component .zen-input{display:flex;align-items:center;gap:8px}.phone-input-component .material-input .country-select,.phone-input-component .zen-input .country-select{display:flex;align-items:center;gap:8px;cursor:pointer;-webkit-user-select:none;user-select:none;text-decoration:none;outline:none}.phone-input-component .material-input .country-select .expand-icon,.phone-input-component .zen-input .country-select .expand-icon{color:#60636c;transition:.3s}.phone-input-component .material-input .country-select .expand-icon.active,.phone-input-component .zen-input .country-select .expand-icon.active{color:#2188d9;transform:rotate(180deg)}.phone-input-component .material-input .country-select .code,.phone-input-component .zen-input .country-select .code{font-style:normal;font-weight:400;font-size:16px;line-height:24px;color:#333}.phone-input-component .material-input .country-select:focus .expand-icon,.phone-input-component .zen-input .country-select:focus .expand-icon{color:#2188d9}.phone-input-component .material-input .phone-input,.phone-input-component .zen-input .phone-input{flex:1;border:none;outline:none;font-style:normal;font-weight:400;font-size:16px;line-height:24px;color:#333;background:transparent}.phone-input-component .country-dropdown-list{width:inherit;margin-top:8px}\n"], dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { 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"] }] });
|
|
2061
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: ZenduPhoneInputComponent, decorators: [{
|
|
2062
|
+
type: Component,
|
|
2063
|
+
args: [{ selector: 'zen-phone-input', template: "<div class=\"phone-input-component\">\n <div class=\"material-input\">\n <a class=\"country-select\"\n (click)=\"toggle()\">\n <img class=\"country-flag\"\n [src]=\"selectedCountry.flag\">\n <i class=\"material-icons expand-icon\"\n [ngClass]=\"{'active': isExpanded}\">expand_more</i>\n <div class=\"code\">{{ selectedCountry.countryCallingCode }}</div>\n </a>\n <input class=\"phone-input\"\n type=\"text\"\n [(ngModel)]=\"phoneText\"\n (ngModelChange)=\"phoneChanged(input)\"\n (click)=\"isExpanded = false\"\n [disabled]=\"disabled\"\n country-code=\"selectedCountry.countryCode\"\n [maxlength]=\"maxLength\"\n #input>\n </div>\n\n <div class=\"action-menu country-dropdown-list\"\n *ngIf=\"isExpanded\">\n <div class=\"action-menu-body\">\n <!--Country's List-->\n <a class=\"action-item\"\n *ngFor=\"let country of countryList\"\n [ngClass]=\"{'active': selectedCountry.countryName === country.countryName}\"\n (click)=\"countryChanged(country)\">\n <img class=\"country-flag\"\n [src]=\"country.flag\">\n <div>{{ country.countryName }}</div>\n <div>{{ country.countryCallingCode }}</div>\n </a>\n\n <!--Custom Country-->\n <a class=\"action-item\"\n [ngClass]=\"{'active': selectedCountry.countryName === customCountry.countryName}\"\n (click)=\"countryChanged(customCountry)\">\n <img class=\"country-flag\"\n [src]=\"customCountry.flag\">\n <div>{{ customCountry.countryName }}</div>\n <div>{{ customCountry.countryCallingCode }}</div>\n </a>\n </div>\n </div>\n</div>\n", styles: [".phone-input-component{position:relative;width:100%}.phone-input-component .material-input,.phone-input-component .zen-input{display:flex;align-items:center;gap:8px}.phone-input-component .material-input .country-select,.phone-input-component .zen-input .country-select{display:flex;align-items:center;gap:8px;cursor:pointer;-webkit-user-select:none;user-select:none;text-decoration:none;outline:none}.phone-input-component .material-input .country-select .expand-icon,.phone-input-component .zen-input .country-select .expand-icon{color:#60636c;transition:.3s}.phone-input-component .material-input .country-select .expand-icon.active,.phone-input-component .zen-input .country-select .expand-icon.active{color:#2188d9;transform:rotate(180deg)}.phone-input-component .material-input .country-select .code,.phone-input-component .zen-input .country-select .code{font-style:normal;font-weight:400;font-size:16px;line-height:24px;color:#333}.phone-input-component .material-input .country-select:focus .expand-icon,.phone-input-component .zen-input .country-select:focus .expand-icon{color:#2188d9}.phone-input-component .material-input .phone-input,.phone-input-component .zen-input .phone-input{flex:1;border:none;outline:none;font-style:normal;font-weight:400;font-size:16px;line-height:24px;color:#333;background:transparent}.phone-input-component .country-dropdown-list{width:inherit;margin-top:8px}\n"] }]
|
|
2064
|
+
}], ctorParameters: function () { return []; }, propDecorators: { phone: [{
|
|
2065
|
+
type: Input
|
|
2066
|
+
}], maxLength: [{
|
|
2067
|
+
type: Input
|
|
2068
|
+
}], phoneChange: [{
|
|
2069
|
+
type: Output
|
|
2070
|
+
}], validChange: [{
|
|
2071
|
+
type: Output
|
|
2072
|
+
}], disabled: [{
|
|
2073
|
+
type: Input
|
|
2074
|
+
}] } });
|
|
2075
|
+
|
|
2076
|
+
class ZenduSortHeaderComponent {
|
|
2077
|
+
constructor() {
|
|
2078
|
+
this.sortChange = new EventEmitter();
|
|
2079
|
+
}
|
|
2080
|
+
toggleSort() {
|
|
2081
|
+
switch (this.sort) {
|
|
2082
|
+
case 'asc':
|
|
2083
|
+
this.sort = 'desc';
|
|
2084
|
+
this.sortChange.emit(this.sort);
|
|
2085
|
+
break;
|
|
2086
|
+
case 'desc':
|
|
2087
|
+
this.sort = 'asc';
|
|
2088
|
+
this.sortChange.emit(this.sort);
|
|
2089
|
+
break;
|
|
2090
|
+
default:
|
|
2091
|
+
this.sort = 'asc';
|
|
2092
|
+
this.sortChange.emit(this.sort);
|
|
2093
|
+
}
|
|
2094
|
+
}
|
|
2095
|
+
}
|
|
2096
|
+
ZenduSortHeaderComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: ZenduSortHeaderComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2097
|
+
ZenduSortHeaderComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.12", type: ZenduSortHeaderComponent, selector: "zen-sort", inputs: { sort: "sort", active: "active" }, outputs: { sortChange: "sortChange" }, ngImport: i0, template: "<div class=\"sort-option\"\n (click)=\"toggleSort()\">\n <div>\n <i class=\"material-icons sort-icon\"\n [ngClass]=\"active && sort === 'asc' ? 'sort-icon-active' : ''\">\n keyboard_arrow_up\n </i>\n </div>\n <div>\n <i class=\"material-icons sort-icon\"\n [ngClass]=\"active && sort === 'desc' ? 'sort-icon-active' : ''\">\n keyboard_arrow_down\n </i>\n </div>\n</div>\n", styles: [".sort-option{display:flex;flex-direction:column;cursor:pointer;-webkit-user-select:none;user-select:none}.sort-option .sort-icon{display:flex;color:#cfe9fd;height:10px;align-items:center;font-weight:500;font-size:20px;transition:.3s}.sort-option .sort-icon-active{color:#2188d9}\n"], dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }] });
|
|
2098
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: ZenduSortHeaderComponent, decorators: [{
|
|
2099
|
+
type: Component,
|
|
2100
|
+
args: [{ selector: 'zen-sort', template: "<div class=\"sort-option\"\n (click)=\"toggleSort()\">\n <div>\n <i class=\"material-icons sort-icon\"\n [ngClass]=\"active && sort === 'asc' ? 'sort-icon-active' : ''\">\n keyboard_arrow_up\n </i>\n </div>\n <div>\n <i class=\"material-icons sort-icon\"\n [ngClass]=\"active && sort === 'desc' ? 'sort-icon-active' : ''\">\n keyboard_arrow_down\n </i>\n </div>\n</div>\n", styles: [".sort-option{display:flex;flex-direction:column;cursor:pointer;-webkit-user-select:none;user-select:none}.sort-option .sort-icon{display:flex;color:#cfe9fd;height:10px;align-items:center;font-weight:500;font-size:20px;transition:.3s}.sort-option .sort-icon-active{color:#2188d9}\n"] }]
|
|
2101
|
+
}], propDecorators: { sort: [{
|
|
2102
|
+
type: Input
|
|
2103
|
+
}], sortChange: [{
|
|
2104
|
+
type: Output
|
|
2105
|
+
}], active: [{
|
|
2106
|
+
type: Input
|
|
2107
|
+
}] } });
|
|
2108
|
+
|
|
2109
|
+
class ZenduToggleComponent {
|
|
2110
|
+
constructor() {
|
|
2111
|
+
this.enabledChange = new EventEmitter();
|
|
2112
|
+
this.onLabel = "On";
|
|
2113
|
+
this.offLabel = "Off";
|
|
2114
|
+
}
|
|
2115
|
+
/**
|
|
2116
|
+
* Toggle state
|
|
2117
|
+
*/
|
|
2118
|
+
toggle() {
|
|
2119
|
+
this.enabled = !this.enabled;
|
|
2120
|
+
this.enabledChange.emit(this.enabled);
|
|
2121
|
+
}
|
|
2122
|
+
}
|
|
2123
|
+
ZenduToggleComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: ZenduToggleComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2124
|
+
ZenduToggleComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.12", type: ZenduToggleComponent, selector: "zen-toggle", inputs: { enabled: "enabled", onLabel: "onLabel", offLabel: "offLabel" }, outputs: { enabledChange: "enabledChange" }, ngImport: i0, template: "<div class=\"toggle-component\">\n <div class=\"toggle-component-content\"\n (click)=\"toggle()\">\n <div class=\"toggle-state toggle-state-left\"\n [ngClass]=\"enabled ? 'toggle-active' : ''\">\n {{onLabel}}\n </div>\n <div class=\"toggle-state toggle-state-right\"\n [ngClass]=\"enabled ? '' : 'toggle-active'\">\n {{offLabel}}\n </div>\n </div>\n</div>", styles: [".toggle-component{display:inline-block}.toggle-component .toggle-component-content{display:flex;flex-direction:row;align-items:center;justify-content:stretch;color:var(--color-grey-shade-2, #828282);cursor:pointer}.toggle-component .toggle-state{border:1px solid var(--color-grey-shade-2, #828282);padding:10px 16px;min-width:70px;text-align:center}.toggle-component .toggle-state-left{border-radius:4px 0 0 4px;border-right:1px solid var(--color-primary, #2188d9)}.toggle-component .toggle-state-right{border-radius:0 4px 4px 0;border-left:none}.toggle-component .toggle-active{background-color:var(--color-blue-tint-1, #f4f9fd);color:var(--color-primary, #2188d9);border-color:var(--color-primary, #2188d9)}\n"], dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }] });
|
|
2125
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: ZenduToggleComponent, decorators: [{
|
|
2126
|
+
type: Component,
|
|
2127
|
+
args: [{ selector: 'zen-toggle', template: "<div class=\"toggle-component\">\n <div class=\"toggle-component-content\"\n (click)=\"toggle()\">\n <div class=\"toggle-state toggle-state-left\"\n [ngClass]=\"enabled ? 'toggle-active' : ''\">\n {{onLabel}}\n </div>\n <div class=\"toggle-state toggle-state-right\"\n [ngClass]=\"enabled ? '' : 'toggle-active'\">\n {{offLabel}}\n </div>\n </div>\n</div>", styles: [".toggle-component{display:inline-block}.toggle-component .toggle-component-content{display:flex;flex-direction:row;align-items:center;justify-content:stretch;color:var(--color-grey-shade-2, #828282);cursor:pointer}.toggle-component .toggle-state{border:1px solid var(--color-grey-shade-2, #828282);padding:10px 16px;min-width:70px;text-align:center}.toggle-component .toggle-state-left{border-radius:4px 0 0 4px;border-right:1px solid var(--color-primary, #2188d9)}.toggle-component .toggle-state-right{border-radius:0 4px 4px 0;border-left:none}.toggle-component .toggle-active{background-color:var(--color-blue-tint-1, #f4f9fd);color:var(--color-primary, #2188d9);border-color:var(--color-primary, #2188d9)}\n"] }]
|
|
2128
|
+
}], propDecorators: { enabled: [{
|
|
2129
|
+
type: Input
|
|
2130
|
+
}], enabledChange: [{
|
|
2131
|
+
type: Output
|
|
2132
|
+
}], onLabel: [{
|
|
2133
|
+
type: Input
|
|
2134
|
+
}], offLabel: [{
|
|
2135
|
+
type: Input
|
|
2136
|
+
}] } });
|
|
2137
|
+
|
|
2138
|
+
class ZenduCardBlockComponent {
|
|
2139
|
+
}
|
|
2140
|
+
ZenduCardBlockComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: ZenduCardBlockComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2141
|
+
ZenduCardBlockComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.12", type: ZenduCardBlockComponent, selector: "zen-card-block", inputs: { icon: "icon", title: "title", text: "text", selected: "selected" }, ngImport: i0, template: "<div class=\"component\">\n <zen-icon *ngIf=\"icon\"\n [src]=\"icon\"></zen-icon>\n\n <div class=\"title\">\n {{title}}\n </div>\n <div class=\"text\">\n {{text}}\n </div>\n</div>\n", styles: [".component{border-radius:10px;border:2px solid transparent;background:var(--color-white-primary, #ffffff);box-shadow:0 0 20px 2px #f0f0f0;padding:16px;box-sizing:border-box;display:flex;flex-direction:column;justify-content:center;align-items:center;height:100%;width:100%}.component:hover{border:2px solid var(--color-grey-shade-7, #121212)}.component zen-icon{width:50px;height:50px}.component .title{width:167px;text-align:center;font-family:Roboto;font-size:32px;font-style:normal;font-weight:500}.component .text{color:var(--color-white-tint-6, #bebebe);text-align:center;margin-top:22px;font-size:16px;font-style:normal;font-weight:400;line-height:130%}\n"], dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: ZenduIconComponent, selector: "zen-icon", inputs: ["src"] }] });
|
|
2142
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: ZenduCardBlockComponent, decorators: [{
|
|
2143
|
+
type: Component,
|
|
2144
|
+
args: [{ selector: 'zen-card-block', template: "<div class=\"component\">\n <zen-icon *ngIf=\"icon\"\n [src]=\"icon\"></zen-icon>\n\n <div class=\"title\">\n {{title}}\n </div>\n <div class=\"text\">\n {{text}}\n </div>\n</div>\n", styles: [".component{border-radius:10px;border:2px solid transparent;background:var(--color-white-primary, #ffffff);box-shadow:0 0 20px 2px #f0f0f0;padding:16px;box-sizing:border-box;display:flex;flex-direction:column;justify-content:center;align-items:center;height:100%;width:100%}.component:hover{border:2px solid var(--color-grey-shade-7, #121212)}.component zen-icon{width:50px;height:50px}.component .title{width:167px;text-align:center;font-family:Roboto;font-size:32px;font-style:normal;font-weight:500}.component .text{color:var(--color-white-tint-6, #bebebe);text-align:center;margin-top:22px;font-size:16px;font-style:normal;font-weight:400;line-height:130%}\n"] }]
|
|
2145
|
+
}], propDecorators: { icon: [{
|
|
2146
|
+
type: Input
|
|
2147
|
+
}], title: [{
|
|
2148
|
+
type: Input
|
|
2149
|
+
}], text: [{
|
|
2150
|
+
type: Input
|
|
2151
|
+
}], selected: [{
|
|
2152
|
+
type: Input
|
|
2153
|
+
}] } });
|
|
2154
|
+
|
|
2155
|
+
class ZenduMapPreviewComponent {
|
|
2156
|
+
constructor() {
|
|
2157
|
+
this.source = "";
|
|
2158
|
+
}
|
|
2159
|
+
ngOnChanges(changes) {
|
|
2160
|
+
if (this.apiKey && this.lat && this.lng) {
|
|
2161
|
+
this.source = `https://image.maps.ls.hereapi.com/mia/1.6/mapview?apiKey=${this.apiKey}&c=${this.lat},${this.lng}` +
|
|
2162
|
+
`&z=14&w=222&h=80&&base=reduced.night&incidents=off&traffic=off`;
|
|
2163
|
+
}
|
|
2164
|
+
else {
|
|
2165
|
+
this.source = "";
|
|
2166
|
+
}
|
|
2167
|
+
}
|
|
2168
|
+
}
|
|
2169
|
+
ZenduMapPreviewComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: ZenduMapPreviewComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2170
|
+
ZenduMapPreviewComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.12", type: ZenduMapPreviewComponent, selector: "zen-map-preview", inputs: { lat: "lat", lng: "lng", apiKey: "apiKey" }, usesOnChanges: true, ngImport: i0, template: "<div class=\"component\"\n [ngStyle]=\"{ 'background-image': 'url('+source+')' }\">\n</div>\n", styles: [".component{width:100%;height:100%;background-size:cover;background-position:center;background-repeat:no-repeat}\n"], dependencies: [{ kind: "directive", type: i1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }] });
|
|
2171
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: ZenduMapPreviewComponent, decorators: [{
|
|
2172
|
+
type: Component,
|
|
2173
|
+
args: [{ selector: 'zen-map-preview', template: "<div class=\"component\"\n [ngStyle]=\"{ 'background-image': 'url('+source+')' }\">\n</div>\n", styles: [".component{width:100%;height:100%;background-size:cover;background-position:center;background-repeat:no-repeat}\n"] }]
|
|
2174
|
+
}], propDecorators: { lat: [{
|
|
2175
|
+
type: Input
|
|
2176
|
+
}], lng: [{
|
|
2177
|
+
type: Input
|
|
2178
|
+
}], apiKey: [{
|
|
2179
|
+
type: Input
|
|
2180
|
+
}] } });
|
|
2181
|
+
|
|
2182
|
+
class ZenduSpinner {
|
|
2183
|
+
}
|
|
2184
|
+
ZenduSpinner.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: ZenduSpinner, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2185
|
+
ZenduSpinner.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.12", type: ZenduSpinner, selector: "zen-spinner", ngImport: i0, template: "<div class=\"component\">\n</div>\n", styles: [".component{width:64px;height:64px;border:6px solid var(--color-primary, #2188d9);border-bottom-color:transparent;border-radius:50%;display:inline-block;box-sizing:border-box;animation:rotation_spinner 1s linear infinite}@keyframes rotation_spinner{0%{transform:rotate(0)}to{transform:rotate(360deg)}}\n"] });
|
|
2186
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: ZenduSpinner, decorators: [{
|
|
2187
|
+
type: Component,
|
|
2188
|
+
args: [{ selector: 'zen-spinner', template: "<div class=\"component\">\n</div>\n", styles: [".component{width:64px;height:64px;border:6px solid var(--color-primary, #2188d9);border-bottom-color:transparent;border-radius:50%;display:inline-block;box-sizing:border-box;animation:rotation_spinner 1s linear infinite}@keyframes rotation_spinner{0%{transform:rotate(0)}to{transform:rotate(360deg)}}\n"] }]
|
|
2189
|
+
}] });
|
|
2190
|
+
|
|
2191
|
+
class LocalLock {
|
|
2192
|
+
constructor() {
|
|
2193
|
+
this._acquired = false;
|
|
2194
|
+
this._waitingResolvers = [];
|
|
2195
|
+
}
|
|
2196
|
+
lock() {
|
|
2197
|
+
return new Promise(resolve => {
|
|
2198
|
+
if (!this._acquired) {
|
|
2199
|
+
this._acquired = true;
|
|
2200
|
+
resolve();
|
|
2201
|
+
return;
|
|
2202
|
+
}
|
|
2203
|
+
this._waitingResolvers.push(resolve);
|
|
2204
|
+
});
|
|
2205
|
+
}
|
|
2206
|
+
release() {
|
|
2207
|
+
if (!this._acquired) {
|
|
2208
|
+
// Trying to release an unacquired lock
|
|
2209
|
+
return;
|
|
2210
|
+
}
|
|
2211
|
+
if (this._waitingResolvers.length > 0) {
|
|
2212
|
+
const resolve = this._waitingResolvers.shift();
|
|
2213
|
+
resolve();
|
|
2214
|
+
}
|
|
2215
|
+
else {
|
|
2216
|
+
this._acquired = false;
|
|
2217
|
+
}
|
|
2218
|
+
}
|
|
2219
|
+
isLock() {
|
|
2220
|
+
return this._acquired;
|
|
2221
|
+
}
|
|
2222
|
+
}
|
|
2223
|
+
|
|
2224
|
+
class OpenCVService {
|
|
2225
|
+
/**
|
|
2226
|
+
* extract paper from the image
|
|
2227
|
+
* @returns
|
|
2228
|
+
*/
|
|
2229
|
+
async extractPaper(options) {
|
|
2230
|
+
// load open cv
|
|
2231
|
+
await this.loadOpenCv();
|
|
2232
|
+
const htmlImage = await this.loadImage(options.src);
|
|
2233
|
+
console.log("image is ready");
|
|
2234
|
+
const scanner = new window["jscanify"];
|
|
2235
|
+
return scanner.extractPaper(htmlImage, options.height, options.width, options.corners);
|
|
2236
|
+
}
|
|
2237
|
+
/**
|
|
2238
|
+
* Get the paper corners from the specific image
|
|
2239
|
+
* @param src
|
|
2240
|
+
* @returns
|
|
2241
|
+
*/
|
|
2242
|
+
async getPaperCorners(src, height, width) {
|
|
2243
|
+
// load opencv
|
|
2244
|
+
await this.loadOpenCv();
|
|
2245
|
+
const cv = this.getCVInternal();
|
|
2246
|
+
const htmlImage = await this.loadImage(src);
|
|
2247
|
+
console.log("image is ready", htmlImage);
|
|
2248
|
+
const scanner = new window["jscanify"];
|
|
2249
|
+
const img = cv.imread(htmlImage);
|
|
2250
|
+
const maxContour = scanner.findPaperContour(img);
|
|
2251
|
+
if (!maxContour) {
|
|
2252
|
+
return null;
|
|
2253
|
+
}
|
|
2254
|
+
const res = scanner.getCornerPoints(maxContour, img);
|
|
2255
|
+
return res;
|
|
2256
|
+
}
|
|
2257
|
+
loadImage(src) {
|
|
2258
|
+
return new Promise((resolve) => {
|
|
2259
|
+
const image = new Image();
|
|
2260
|
+
image.src = src;
|
|
2261
|
+
image.onload = function () {
|
|
2262
|
+
resolve(image);
|
|
2263
|
+
};
|
|
2264
|
+
});
|
|
2265
|
+
}
|
|
2266
|
+
async loadOpenCv() {
|
|
2267
|
+
try {
|
|
2268
|
+
await OpenCVService._lock.lock();
|
|
2269
|
+
if (OpenCVService._isOpenCVLoaded) {
|
|
2270
|
+
return;
|
|
2271
|
+
}
|
|
2272
|
+
console.log("load opencv...");
|
|
2273
|
+
// Storage bucket available here:
|
|
2274
|
+
// https://console.cloud.google.com/storage/browser/ng-zenduit/scripts?project=zendu-one
|
|
2275
|
+
// load open cv script
|
|
2276
|
+
this.loadScript("https://storage.googleapis.com/ng-zenduit/scripts/opencv_4.7.0.js");
|
|
2277
|
+
await this.waitInitalization("cv");
|
|
2278
|
+
// load jscanify script
|
|
2279
|
+
this.loadScript("https://storage.googleapis.com/ng-zenduit/scripts/jscanify_1.2.0.js");
|
|
2280
|
+
await this.waitInitalization("jscanify");
|
|
2281
|
+
console.log("OpenCV is ready");
|
|
2282
|
+
OpenCVService._isOpenCVLoaded = true;
|
|
2283
|
+
}
|
|
2284
|
+
finally {
|
|
2285
|
+
OpenCVService._lock.release();
|
|
2286
|
+
}
|
|
2287
|
+
}
|
|
2288
|
+
loadScript(src) {
|
|
2289
|
+
const script = document.createElement('script');
|
|
2290
|
+
script.setAttribute('type', 'text/javascript');
|
|
2291
|
+
script.src = src;
|
|
2292
|
+
// insert script to document
|
|
2293
|
+
const node = document.getElementsByTagName('script')[0];
|
|
2294
|
+
if (node) {
|
|
2295
|
+
node.parentNode.insertBefore(script, node);
|
|
2296
|
+
}
|
|
2297
|
+
else {
|
|
2298
|
+
document.head.appendChild(script);
|
|
2299
|
+
}
|
|
2300
|
+
}
|
|
2301
|
+
async waitInitalization(globalVarName) {
|
|
2302
|
+
const timeout = Date.now() + 60000;
|
|
2303
|
+
// wait cv first
|
|
2304
|
+
while (true) {
|
|
2305
|
+
if (window[globalVarName]) {
|
|
2306
|
+
break;
|
|
2307
|
+
}
|
|
2308
|
+
await Util.sleep(1000);
|
|
2309
|
+
if (Date.now() > timeout) {
|
|
2310
|
+
throw `Failed initalize OpenCV. Reason: timeout`;
|
|
2311
|
+
}
|
|
2312
|
+
}
|
|
2313
|
+
}
|
|
2314
|
+
getCVInternal() {
|
|
2315
|
+
return window["cv"];
|
|
2316
|
+
}
|
|
2317
|
+
}
|
|
2318
|
+
OpenCVService._isOpenCVLoaded = false;
|
|
2319
|
+
OpenCVService._lock = new LocalLock();
|
|
2320
|
+
OpenCVService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: OpenCVService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
2321
|
+
OpenCVService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: OpenCVService, providedIn: 'root' });
|
|
2322
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: OpenCVService, decorators: [{
|
|
2323
|
+
type: Injectable,
|
|
2324
|
+
args: [{
|
|
2325
|
+
providedIn: 'root'
|
|
2326
|
+
}]
|
|
2327
|
+
}] });
|
|
2328
|
+
|
|
2329
|
+
class ZenduDocScanner {
|
|
2330
|
+
constructor(_opencv) {
|
|
2331
|
+
this._opencv = _opencv;
|
|
2332
|
+
this.src = '';
|
|
2333
|
+
this.width = 0;
|
|
2334
|
+
this.height = 0;
|
|
2335
|
+
this.isScanStart = false;
|
|
2336
|
+
this.canAddText = false;
|
|
2337
|
+
this.canDoodle = false;
|
|
2338
|
+
this.currentStateIndex = -1;
|
|
2339
|
+
this.canvasStates = [];
|
|
2340
|
+
this.isResize = false;
|
|
2341
|
+
this.isRedoing = false;
|
|
2342
|
+
this.isUndoing = false;
|
|
2343
|
+
this.extracted = new EventEmitter();
|
|
2344
|
+
this.cornersChanged = new EventEmitter();
|
|
2345
|
+
this.canAddTextOrDoole = new EventEmitter();
|
|
2346
|
+
this.canRedoOrUndo = new EventEmitter();
|
|
2347
|
+
this.screenPoints = [];
|
|
2348
|
+
this._scaleFactor = 1;
|
|
2349
|
+
this._controls = [];
|
|
2350
|
+
this.selectedColor = '#121212';
|
|
2351
|
+
this.isScaned = false;
|
|
2352
|
+
this.textAdded = false;
|
|
2353
|
+
this.icons = {
|
|
2354
|
+
cross: new Image(),
|
|
2355
|
+
rotate: new Image(),
|
|
2356
|
+
expand: new Image(),
|
|
2357
|
+
};
|
|
2358
|
+
this.Image = {
|
|
2359
|
+
height: 0,
|
|
2360
|
+
width: 0,
|
|
2361
|
+
};
|
|
2362
|
+
this.borderWidth = 5;
|
|
2363
|
+
this.colors = [
|
|
2364
|
+
{ hexCode: '#FFFFFF', selected: false },
|
|
2365
|
+
{ hexCode: '#121212', selected: false },
|
|
2366
|
+
{ hexCode: '#2188D9', selected: false },
|
|
2367
|
+
{ hexCode: '#DC3E33', selected: false },
|
|
2368
|
+
{ hexCode: '#219653', selected: false },
|
|
2369
|
+
{ hexCode: '#F1B10B', selected: false },
|
|
2370
|
+
{ hexCode: '#00F0FF', selected: false },
|
|
2371
|
+
];
|
|
2372
|
+
}
|
|
2373
|
+
set done(completed) {
|
|
2374
|
+
console.log('mark as completed', completed);
|
|
2375
|
+
if (completed) {
|
|
2376
|
+
this.completeScan(completed);
|
|
2377
|
+
}
|
|
2378
|
+
}
|
|
2379
|
+
ngAfterViewInit() {
|
|
2380
|
+
this.icons.cross.src = 'assets/ng-zenduit/icons/cross.svg';
|
|
2381
|
+
this.icons.rotate.src = 'assets/ng-zenduit/icons/rotate.svg';
|
|
2382
|
+
this.icons.expand.src = 'assets/ng-zenduit/icons/expand.svg';
|
|
2383
|
+
setTimeout(async () => {
|
|
2384
|
+
await this.init();
|
|
2385
|
+
// Add an event listener for canvas edits
|
|
2386
|
+
}, 1);
|
|
2387
|
+
}
|
|
2388
|
+
onCanvasEdit() {
|
|
2389
|
+
let objects = this._canvas.getObjects();
|
|
2390
|
+
if (objects && objects.length)
|
|
2391
|
+
this._canvas._activeObject = objects[objects.length - 1];
|
|
2392
|
+
if (!this.isScanStart && !this.isRedoing && !this.isUndoing) {
|
|
2393
|
+
this.canRedoOrUndo.emit({
|
|
2394
|
+
canUndo: this.currentStateIndex >= 0 ? true : false,
|
|
2395
|
+
canRedo: this.currentStateIndex < this.canvasStates.length - 1 ? true : false,
|
|
2396
|
+
});
|
|
2397
|
+
this.saveCanvasState();
|
|
2398
|
+
}
|
|
2399
|
+
}
|
|
2400
|
+
ngOnChanges(changes) {
|
|
2401
|
+
// When src changes
|
|
2402
|
+
if (changes['src'] && this._canvas) {
|
|
2403
|
+
this.build();
|
|
2404
|
+
}
|
|
2405
|
+
//When user start scan
|
|
2406
|
+
if (changes['isScanStart'] && changes['isScanStart'].currentValue) {
|
|
2407
|
+
if (this.src && this._canvas && this.isScanStart) {
|
|
2408
|
+
this.addPointsTodoc();
|
|
2409
|
+
this.canDoodle = false;
|
|
2410
|
+
this._canvas.isDrawingMode = false;
|
|
2411
|
+
this.isScaned = true;
|
|
2412
|
+
this._canvas.selection = false;
|
|
2413
|
+
this.textAdded = false;
|
|
2414
|
+
}
|
|
2415
|
+
}
|
|
2416
|
+
// When user wants to draw
|
|
2417
|
+
if (changes['canDoodle'] &&
|
|
2418
|
+
changes['canDoodle'].currentValue &&
|
|
2419
|
+
this._canvas) {
|
|
2420
|
+
if (this.canDoodle) {
|
|
2421
|
+
this._canvas.isDrawingMode = this.canDoodle;
|
|
2422
|
+
this._canvas.freeDrawingBrush = this.canDoodle
|
|
2423
|
+
? new fabric.PencilBrush(this._canvas)
|
|
2424
|
+
: null;
|
|
2425
|
+
this._canvas.freeDrawingBrush.width = 10;
|
|
2426
|
+
this._canvas.freeDrawingBrush.color = this.selectedColor;
|
|
2427
|
+
this._canvas.selection = false;
|
|
2428
|
+
this.isScanStart = false;
|
|
2429
|
+
this.textAdded = false;
|
|
2430
|
+
this._canvas.renderAll();
|
|
2431
|
+
}
|
|
2432
|
+
}
|
|
2433
|
+
// When user wants to add text
|
|
2434
|
+
if (changes['canAddText'] &&
|
|
2435
|
+
changes['canAddText'].currentValue &&
|
|
2436
|
+
this.canAddText) {
|
|
2437
|
+
this.canDoodle = false;
|
|
2438
|
+
this._canvas.isDrawingMode = false;
|
|
2439
|
+
this.isScanStart = false;
|
|
2440
|
+
}
|
|
2441
|
+
if (changes['isUndoing'] && changes['isUndoing'].currentValue)
|
|
2442
|
+
this.undo();
|
|
2443
|
+
if (changes['isRedoing'] && changes['isRedoing'].currentValue)
|
|
2444
|
+
this.redo();
|
|
2445
|
+
}
|
|
2446
|
+
// To change the color of brush or text
|
|
2447
|
+
chngClrTextOrBrush(color, changeFor) {
|
|
2448
|
+
this.selectedColor = color;
|
|
2449
|
+
this.colors.map((clr, index) => {
|
|
2450
|
+
this.colors[index] = { ...this.colors[index], selected: false };
|
|
2451
|
+
if (this.colors[index].hexCode === color) {
|
|
2452
|
+
this.colors[index] = { ...this.colors[index], selected: true };
|
|
2453
|
+
}
|
|
2454
|
+
});
|
|
2455
|
+
if (changeFor === 'text') {
|
|
2456
|
+
const activeObject = this._canvas.getActiveObject();
|
|
2457
|
+
if (activeObject && activeObject.type === 'i-text') {
|
|
2458
|
+
// Check if an active text object is selected
|
|
2459
|
+
activeObject.set('fill', this.selectedColor); // Update the fill color
|
|
2460
|
+
this._canvas.renderAll(); // Render the canvas to see the changes
|
|
2461
|
+
}
|
|
2462
|
+
this._canvas.renderAll();
|
|
2463
|
+
// this.onCanvasEdit();
|
|
2464
|
+
}
|
|
2465
|
+
else {
|
|
2466
|
+
this._canvas.freeDrawingBrush.color = color;
|
|
2467
|
+
}
|
|
2468
|
+
this.selectedColor = color;
|
|
2469
|
+
}
|
|
2470
|
+
async addPointsTodoc() {
|
|
2471
|
+
const corners = await this._opencv.getPaperCorners(this._canvas.toDataURL({
|
|
2472
|
+
format: 'jpeg',
|
|
2473
|
+
quality: 1,
|
|
2474
|
+
}), this.Image.height, this.Image.width);
|
|
2475
|
+
if (corners) {
|
|
2476
|
+
this.screenPoints = [
|
|
2477
|
+
corners.topLeftCorner,
|
|
2478
|
+
corners.topRightCorner,
|
|
2479
|
+
corners.bottomRightCorner,
|
|
2480
|
+
corners.bottomLeftCorner,
|
|
2481
|
+
];
|
|
2482
|
+
}
|
|
2483
|
+
else {
|
|
2484
|
+
console.error(`can't detect document corners`);
|
|
2485
|
+
const width = this._canvas.getWidth() / this._scaleFactor;
|
|
2486
|
+
const height = this._canvas.getHeight() / this._scaleFactor;
|
|
2487
|
+
const offset = 20;
|
|
2488
|
+
this.screenPoints = [
|
|
2489
|
+
{ x: offset, y: 0 },
|
|
2490
|
+
{ x: width - offset, y: 0 },
|
|
2491
|
+
{ x: width - offset, y: height - offset },
|
|
2492
|
+
{ x: offset, y: height - offset },
|
|
2493
|
+
];
|
|
2494
|
+
}
|
|
2495
|
+
// add polygon
|
|
2496
|
+
//
|
|
2497
|
+
this._cornersPg = new fabric.Polygon(this.screenPoints, {
|
|
2498
|
+
stroke: '#2188d9',
|
|
2499
|
+
strokeWidth: 10,
|
|
2500
|
+
selectable: false,
|
|
2501
|
+
fill: 'rgba(33, 136, 217, 0.1)',
|
|
2502
|
+
hasBorders: true,
|
|
2503
|
+
objectCaching: false,
|
|
2504
|
+
});
|
|
2505
|
+
this._canvas.add(this._cornersPg);
|
|
2506
|
+
this.createControls(this._cornersPg);
|
|
2507
|
+
}
|
|
2508
|
+
async init(src) {
|
|
2509
|
+
// Create canvas with new changed src
|
|
2510
|
+
if (src) {
|
|
2511
|
+
this.createCanvas();
|
|
2512
|
+
}
|
|
2513
|
+
else {
|
|
2514
|
+
try {
|
|
2515
|
+
if (!this._canvasElement || !this._canvasElement.nativeElement) {
|
|
2516
|
+
// canvas is not ready
|
|
2517
|
+
return;
|
|
2518
|
+
}
|
|
2519
|
+
if (this._canvas) {
|
|
2520
|
+
// canvas already initalized
|
|
2521
|
+
return;
|
|
2522
|
+
}
|
|
2523
|
+
this.createCanvas();
|
|
2524
|
+
}
|
|
2525
|
+
catch (err) {
|
|
2526
|
+
console.error(err);
|
|
2527
|
+
}
|
|
2528
|
+
}
|
|
2529
|
+
}
|
|
2530
|
+
async createCanvas() {
|
|
2531
|
+
// documentation: http://fabricjs.com/docs/fabric.Canvas.html
|
|
2532
|
+
let canvas = this._canvasElement.nativeElement;
|
|
2533
|
+
this._canvas = new fabric.Canvas(canvas, {
|
|
2534
|
+
backgroundColor: 'white',
|
|
2535
|
+
selection: false,
|
|
2536
|
+
});
|
|
2537
|
+
const { width, height } = this.getCanvasSize();
|
|
2538
|
+
this._canvas.setWidth(width);
|
|
2539
|
+
this._canvas.setHeight(height);
|
|
2540
|
+
this._canvas.on('object:added', this.onCanvasEdit.bind(this));
|
|
2541
|
+
this._canvas.on('object:modified', this.onCanvasEdit.bind(this));
|
|
2542
|
+
this._canvas.on('mouse:down', this.addTextOnClick.bind(this));
|
|
2543
|
+
this._canvas.on('mouse:move', this.resizeText.bind(this));
|
|
2544
|
+
this._canvas.on('mouse:up', this.stopResizeText.bind(this));
|
|
2545
|
+
if (this.src) {
|
|
2546
|
+
await this.build();
|
|
2547
|
+
}
|
|
2548
|
+
}
|
|
2549
|
+
renderIcon(ctx, left, top, styleOverride, fabricObject, iconName) {
|
|
2550
|
+
var size = 42;
|
|
2551
|
+
var iconBackgroundSize = 50; // Adjust the size as needed
|
|
2552
|
+
ctx.save();
|
|
2553
|
+
// Draw a background circle behind the icon
|
|
2554
|
+
ctx.fillStyle = 'white'; // Set the background color
|
|
2555
|
+
ctx.beginPath();
|
|
2556
|
+
ctx.arc(left, top - 10, iconBackgroundSize / 2, 0, 2 * Math.PI);
|
|
2557
|
+
ctx.fill();
|
|
2558
|
+
var img = this.icons[iconName];
|
|
2559
|
+
img.onload = function () { };
|
|
2560
|
+
ctx.translate(left, top - 10);
|
|
2561
|
+
ctx.rotate(fabric.util.degreesToRadians(fabricObject.angle));
|
|
2562
|
+
ctx.drawImage(img, -size / 2, -size / 2, size, size);
|
|
2563
|
+
ctx.restore();
|
|
2564
|
+
}
|
|
2565
|
+
stopResizeText(event) {
|
|
2566
|
+
if (this.isResize) {
|
|
2567
|
+
this.saveCanvasState();
|
|
2568
|
+
this.isResize = false;
|
|
2569
|
+
}
|
|
2570
|
+
}
|
|
2571
|
+
resizeText(event) {
|
|
2572
|
+
if (this.isResize) {
|
|
2573
|
+
const target = event.target;
|
|
2574
|
+
const deltaY = event.e.clientY - this.initialMouseY;
|
|
2575
|
+
// Limit the scaling factor to prevent excessive resizing
|
|
2576
|
+
const scalingFactor = Math.min(2, Math.max(0.5, 1 + deltaY / 100));
|
|
2577
|
+
// Calculate the new font size based on the original size and scaling factor
|
|
2578
|
+
const newFontSize = this.originalFontSize * scalingFactor;
|
|
2579
|
+
// Set the font size of the text object
|
|
2580
|
+
target.fontSize = newFontSize;
|
|
2581
|
+
// Re-render the canvas to see the live change
|
|
2582
|
+
event.target.canvas.renderAll();
|
|
2583
|
+
}
|
|
2584
|
+
}
|
|
2585
|
+
addTextOnClick(event) {
|
|
2586
|
+
let _text = new fabric.IText('Type your text here', {
|
|
2587
|
+
left: event.pointer.x,
|
|
2588
|
+
top: event.pointer.y,
|
|
2589
|
+
fill: this.selectedColor,
|
|
2590
|
+
fontSize: 50,
|
|
2591
|
+
fontFamily: 'Roboto',
|
|
2592
|
+
selectable: true,
|
|
2593
|
+
fontWeight: 400,
|
|
2594
|
+
borderScaleFactor: 3,
|
|
2595
|
+
borderColor: 'white',
|
|
2596
|
+
backgroundColor: 'transparent',
|
|
2597
|
+
cornerColor: 'white',
|
|
2598
|
+
padding: 42,
|
|
2599
|
+
width: 200, // Set the initial width of the text box
|
|
2600
|
+
});
|
|
2601
|
+
//Custom controls for add text box
|
|
2602
|
+
let customControls = {
|
|
2603
|
+
removeControl: new fabric.Control({
|
|
2604
|
+
x: -0.5,
|
|
2605
|
+
y: -0.5,
|
|
2606
|
+
offsetY: 16,
|
|
2607
|
+
cursorStyle: 'pointer',
|
|
2608
|
+
render: (ctx, left, top, styleOverride, fabricObject) => {
|
|
2609
|
+
return this.renderIcon(ctx, left, top, styleOverride, fabricObject, 'cross');
|
|
2610
|
+
},
|
|
2611
|
+
mouseUpHandler: (eventData, transform) => {
|
|
2612
|
+
var target = transform.target;
|
|
2613
|
+
var canvas = target.canvas;
|
|
2614
|
+
canvas.remove(target);
|
|
2615
|
+
canvas.requestRenderAll();
|
|
2616
|
+
this.saveCanvasState();
|
|
2617
|
+
return true;
|
|
2618
|
+
},
|
|
2619
|
+
}),
|
|
2620
|
+
rotateControl: new fabric.Control({
|
|
2621
|
+
x: 0.5,
|
|
2622
|
+
y: -0.5,
|
|
2623
|
+
offsetY: 16,
|
|
2624
|
+
cursorStyle: 'pointer',
|
|
2625
|
+
render: (ctx, left, top, styleOverride, fabricObject) => {
|
|
2626
|
+
return this.renderIcon(ctx, left, top, styleOverride, fabricObject, 'rotate');
|
|
2627
|
+
},
|
|
2628
|
+
mouseUpHandler: (eventData, transform) => {
|
|
2629
|
+
let fabricObject = transform.target;
|
|
2630
|
+
const rotationIncrement = 30; // Rotation increment in degrees
|
|
2631
|
+
fabricObject.set('angle', (fabricObject.angle + rotationIncrement) % 360);
|
|
2632
|
+
fabricObject.setCoords(); // Update object's coordinates
|
|
2633
|
+
this.saveCanvasState();
|
|
2634
|
+
return true;
|
|
2635
|
+
},
|
|
2636
|
+
}),
|
|
2637
|
+
expantControl: new fabric.Control({
|
|
2638
|
+
x: 0.5,
|
|
2639
|
+
y: 0.5,
|
|
2640
|
+
offsetY: 16,
|
|
2641
|
+
cursorStyle: 'grab',
|
|
2642
|
+
render: (ctx, left, top, styleOverride, fabricObject) => {
|
|
2643
|
+
return this.renderIcon(ctx, left, top, styleOverride, fabricObject, 'expand');
|
|
2644
|
+
},
|
|
2645
|
+
}),
|
|
2646
|
+
};
|
|
2647
|
+
if (event.transform && event.transform.action === 'scale') {
|
|
2648
|
+
this.isResize = true;
|
|
2649
|
+
this.initialMouseY = event.e.clientY;
|
|
2650
|
+
this.originalFontSize = event.target.fontSize;
|
|
2651
|
+
}
|
|
2652
|
+
if (!this.textAdded &&
|
|
2653
|
+
!this.canDoodle &&
|
|
2654
|
+
!this.isScanStart &&
|
|
2655
|
+
this.canAddText) {
|
|
2656
|
+
_text.controls = customControls;
|
|
2657
|
+
this._canvas.add(_text);
|
|
2658
|
+
this._canvas.renderAll();
|
|
2659
|
+
this.textAdded = true;
|
|
2660
|
+
}
|
|
2661
|
+
}
|
|
2662
|
+
// Function to save the canvas state
|
|
2663
|
+
saveCanvasState() {
|
|
2664
|
+
const state = JSON.stringify(this._canvas.toJSON());
|
|
2665
|
+
// const state = this._canvas.getObjects()[this._canvas.getObjects.length - 1]
|
|
2666
|
+
if (this.currentStateIndex < this.canvasStates.length - 1) {
|
|
2667
|
+
this.canvasStates.length = this.currentStateIndex + 1; // Remove future states
|
|
2668
|
+
}
|
|
2669
|
+
let activeObj = this._canvas.getActiveObject();
|
|
2670
|
+
if (activeObj && activeObj.type === 'path') {
|
|
2671
|
+
// set remove border and controls for drawing
|
|
2672
|
+
activeObj.set({
|
|
2673
|
+
hasControls: false,
|
|
2674
|
+
selectable: false,
|
|
2675
|
+
hasBorders: false,
|
|
2676
|
+
});
|
|
2677
|
+
}
|
|
2678
|
+
const customControl = activeObj && activeObj.controls ? activeObj.controls : null;
|
|
2679
|
+
this.canvasStates.push({ state, customControl });
|
|
2680
|
+
this.currentStateIndex++;
|
|
2681
|
+
}
|
|
2682
|
+
redo() {
|
|
2683
|
+
this.isRedoing = true;
|
|
2684
|
+
if (this.currentStateIndex < this.canvasStates.length - 1) {
|
|
2685
|
+
this.currentStateIndex++;
|
|
2686
|
+
const nextState = this.canvasStates[this.currentStateIndex];
|
|
2687
|
+
this.canRedoOrUndo.emit({
|
|
2688
|
+
canUndo: this.currentStateIndex > 0 ? true : false,
|
|
2689
|
+
canRedo: this.currentStateIndex < this.canvasStates.length - 1 ? true : false,
|
|
2690
|
+
});
|
|
2691
|
+
this._canvas.loadFromJSON(nextState.state, () => {
|
|
2692
|
+
let activeObject = this._canvas.getActiveObject();
|
|
2693
|
+
this._canvas.getObjects().forEach((obj) => {
|
|
2694
|
+
if (obj !== activeObject) {
|
|
2695
|
+
obj.evented = false;
|
|
2696
|
+
}
|
|
2697
|
+
});
|
|
2698
|
+
if (activeObject && activeObject.type !== 'path') {
|
|
2699
|
+
activeObject.controls =
|
|
2700
|
+
nextState && nextState.customControl
|
|
2701
|
+
? nextState.customControl
|
|
2702
|
+
: null;
|
|
2703
|
+
activeObject.set({
|
|
2704
|
+
padding: 42,
|
|
2705
|
+
borderScaleFactor: 3,
|
|
2706
|
+
borderColor: 'white',
|
|
2707
|
+
});
|
|
2708
|
+
this.textAdded = true;
|
|
2709
|
+
this.canAddTextOrDoole.emit({ key: 'doodle', value: false });
|
|
2710
|
+
this.canAddTextOrDoole.emit({ key: 'text', value: true });
|
|
2711
|
+
}
|
|
2712
|
+
else {
|
|
2713
|
+
activeObject.set({
|
|
2714
|
+
hasControls: false,
|
|
2715
|
+
selectable: false,
|
|
2716
|
+
hasBorders: false,
|
|
2717
|
+
});
|
|
2718
|
+
this.canAddTextOrDoole.emit({ key: 'text', value: false });
|
|
2719
|
+
this.canAddTextOrDoole.emit({ key: 'doodle', value: true });
|
|
2720
|
+
this._canvas.selection = false;
|
|
2721
|
+
}
|
|
2722
|
+
this._canvas.renderAll();
|
|
2723
|
+
});
|
|
2724
|
+
}
|
|
2725
|
+
}
|
|
2726
|
+
undo() {
|
|
2727
|
+
this.isUndoing = true;
|
|
2728
|
+
if (this.currentStateIndex > 0) {
|
|
2729
|
+
this.currentStateIndex--;
|
|
2730
|
+
const previousState = this.canvasStates[this.currentStateIndex];
|
|
2731
|
+
this.canRedoOrUndo.emit({
|
|
2732
|
+
canUndo: this.currentStateIndex > 0 ? true : false,
|
|
2733
|
+
canRedo: this.currentStateIndex < this.canvasStates.length - 1 ? true : false,
|
|
2734
|
+
});
|
|
2735
|
+
this._canvas.loadFromJSON(previousState.state, () => {
|
|
2736
|
+
let activeObject = this._canvas.getActiveObject();
|
|
2737
|
+
if (activeObject) {
|
|
2738
|
+
if (activeObject.type !== 'path') {
|
|
2739
|
+
activeObject.set({
|
|
2740
|
+
padding: 42,
|
|
2741
|
+
borderScaleFactor: 3,
|
|
2742
|
+
borderColor: 'white',
|
|
2743
|
+
});
|
|
2744
|
+
this._canvas.isDrawingMode = false;
|
|
2745
|
+
this._canvas.freeDrawingBrush = null;
|
|
2746
|
+
this.textAdded = true;
|
|
2747
|
+
this.canAddTextOrDoole.emit({ key: 'doodle', value: false });
|
|
2748
|
+
this.canAddTextOrDoole.emit({ key: 'text', value: true });
|
|
2749
|
+
}
|
|
2750
|
+
else {
|
|
2751
|
+
activeObject.set({
|
|
2752
|
+
hasControls: false,
|
|
2753
|
+
hasBorders: false,
|
|
2754
|
+
});
|
|
2755
|
+
this._canvas.selection = false;
|
|
2756
|
+
this.canAddTextOrDoole.emit({ key: 'text', value: false });
|
|
2757
|
+
this.canAddTextOrDoole.emit({ key: 'doodle', value: true });
|
|
2758
|
+
}
|
|
2759
|
+
this._canvas.getActiveObject().controls =
|
|
2760
|
+
previousState && previousState.customControl
|
|
2761
|
+
? previousState.customControl
|
|
2762
|
+
: null;
|
|
2763
|
+
}
|
|
2764
|
+
this._canvas.getObjects().forEach((obj) => {
|
|
2765
|
+
if (obj !== activeObject) {
|
|
2766
|
+
obj.evented = false;
|
|
2767
|
+
}
|
|
2768
|
+
});
|
|
2769
|
+
this._canvas.renderAll();
|
|
2770
|
+
});
|
|
2771
|
+
}
|
|
2772
|
+
}
|
|
2773
|
+
getCanvasSize() {
|
|
2774
|
+
const img = new Image();
|
|
2775
|
+
img.src = this.src;
|
|
2776
|
+
const box = this._component.nativeElement.getBoundingClientRect();
|
|
2777
|
+
const width = this.width || box.width || 1;
|
|
2778
|
+
const height = this.height || box.height || 1;
|
|
2779
|
+
return { width, height };
|
|
2780
|
+
}
|
|
2781
|
+
/**
|
|
2782
|
+
* recognize paper corners
|
|
2783
|
+
*/
|
|
2784
|
+
async build() {
|
|
2785
|
+
if (!this.src || !this._canvas) {
|
|
2786
|
+
return;
|
|
2787
|
+
}
|
|
2788
|
+
const bg = await this.loadBackgroundImage(this.src);
|
|
2789
|
+
// Remove all the existing objects before add the new image to background
|
|
2790
|
+
this._canvas.clear();
|
|
2791
|
+
const imgSize = bg.getOriginalSize();
|
|
2792
|
+
this.Image = {
|
|
2793
|
+
height: imgSize.height * this._scaleFactor,
|
|
2794
|
+
width: imgSize.width * this._scaleFactor,
|
|
2795
|
+
};
|
|
2796
|
+
const scaleX = this._canvas.width / imgSize.width;
|
|
2797
|
+
const scaleY = this._canvas.height / imgSize.height;
|
|
2798
|
+
this._scaleFactor = Math.min(scaleY, scaleX);
|
|
2799
|
+
this._canvas.setDimensions({
|
|
2800
|
+
width: imgSize.width,
|
|
2801
|
+
height: imgSize.height,
|
|
2802
|
+
}, {
|
|
2803
|
+
backstoreOnly: true,
|
|
2804
|
+
});
|
|
2805
|
+
this._canvas.setBackgroundImage(bg, () => {
|
|
2806
|
+
this._canvas.renderAll();
|
|
2807
|
+
});
|
|
2808
|
+
this.saveCanvasState();
|
|
2809
|
+
this._canvas.renderAll();
|
|
2810
|
+
}
|
|
2811
|
+
createControls(polygon) {
|
|
2812
|
+
// remove previous controls
|
|
2813
|
+
if (this._controls.length) {
|
|
2814
|
+
this._canvas.remove(...this._controls);
|
|
2815
|
+
this._controls = [];
|
|
2816
|
+
}
|
|
2817
|
+
if (polygon) {
|
|
2818
|
+
for (const [index, point] of polygon.points.entries()) {
|
|
2819
|
+
const circle = this.createControl(index, polygon);
|
|
2820
|
+
this._controls.push(circle);
|
|
2821
|
+
this._canvas.add(circle);
|
|
2822
|
+
}
|
|
2823
|
+
}
|
|
2824
|
+
}
|
|
2825
|
+
createControl(index, polygon) {
|
|
2826
|
+
const point = polygon.points[index];
|
|
2827
|
+
const circle = new fabric.Circle({
|
|
2828
|
+
left: point.x,
|
|
2829
|
+
top: point.y,
|
|
2830
|
+
originX: 'center',
|
|
2831
|
+
originY: 'center',
|
|
2832
|
+
fill: '#2188d9',
|
|
2833
|
+
radius: 20,
|
|
2834
|
+
hasRotatingPoint: false,
|
|
2835
|
+
hasBorders: false,
|
|
2836
|
+
hasControls: false,
|
|
2837
|
+
objectCaching: false,
|
|
2838
|
+
});
|
|
2839
|
+
circle.on('moving', (evt) => {
|
|
2840
|
+
if (evt.pointer) {
|
|
2841
|
+
polygon.points[index] = new fabric.Point(evt.pointer.x, evt.pointer.y);
|
|
2842
|
+
polygon.dirty = true;
|
|
2843
|
+
}
|
|
2844
|
+
});
|
|
2845
|
+
circle.on('mouseup', (evt) => {
|
|
2846
|
+
this.cornersChanged.emit();
|
|
2847
|
+
this.screenPoints[index] = polygon.points[index];
|
|
2848
|
+
});
|
|
2849
|
+
return circle;
|
|
2850
|
+
}
|
|
2851
|
+
loadBackgroundImage(src) {
|
|
2852
|
+
return new Promise((resolve, reject) => {
|
|
2853
|
+
const img = new Image();
|
|
2854
|
+
img.onload = () => {
|
|
2855
|
+
let fabImage = new fabric.Image(img);
|
|
2856
|
+
resolve(fabImage);
|
|
2857
|
+
};
|
|
2858
|
+
img.src = src;
|
|
2859
|
+
});
|
|
2860
|
+
}
|
|
2861
|
+
async completeScan(completed) {
|
|
2862
|
+
if (!completed) {
|
|
2863
|
+
return;
|
|
2864
|
+
}
|
|
2865
|
+
console.log(`complete scan & extract paper`);
|
|
2866
|
+
if (!this._cornersPg) {
|
|
2867
|
+
console.error(`Corner line is not available`);
|
|
2868
|
+
}
|
|
2869
|
+
if (this._cornersPg) {
|
|
2870
|
+
this._canvas.remove(this._cornersPg);
|
|
2871
|
+
this._canvas.remove(...this._controls);
|
|
2872
|
+
this._canvas.renderAll();
|
|
2873
|
+
}
|
|
2874
|
+
let output;
|
|
2875
|
+
if (this.isScaned) {
|
|
2876
|
+
output = await this._opencv.extractPaper({
|
|
2877
|
+
src: this._canvas.toDataURL({ quality: 1 }),
|
|
2878
|
+
corners: {
|
|
2879
|
+
topLeftCorner: this.screenPoints[0],
|
|
2880
|
+
topRightCorner: this.screenPoints[1],
|
|
2881
|
+
bottomRightCorner: this.screenPoints[2],
|
|
2882
|
+
bottomLeftCorner: this.screenPoints[3],
|
|
2883
|
+
},
|
|
2884
|
+
height: this._canvas.height,
|
|
2885
|
+
width: this._canvas.width,
|
|
2886
|
+
});
|
|
2887
|
+
this._canvas.remove(...this._canvas.getObjects());
|
|
2888
|
+
this.isScaned = false;
|
|
2889
|
+
}
|
|
2890
|
+
else {
|
|
2891
|
+
output = this._canvas.toCanvasElement();
|
|
2892
|
+
}
|
|
2893
|
+
this.currentStateIndex = null;
|
|
2894
|
+
this.canvasStates = [];
|
|
2895
|
+
this.canRedoOrUndo.emit({
|
|
2896
|
+
canUndo: this.currentStateIndex > 0 ? true : false,
|
|
2897
|
+
canRedo: this.currentStateIndex < this.canvasStates.length - 1 ? true : false,
|
|
2898
|
+
});
|
|
2899
|
+
this.extracted.emit(output);
|
|
2900
|
+
this.cleanupCanvas();
|
|
2901
|
+
}
|
|
2902
|
+
cleanupCanvas() {
|
|
2903
|
+
this._canvas.getObjects().forEach((obj) => (obj.evented = false));
|
|
2904
|
+
this._canvas.selection = false;
|
|
2905
|
+
this._canvas.isDrawingMode = false;
|
|
2906
|
+
this.canDoodle = false;
|
|
2907
|
+
this.isScanStart = false;
|
|
2908
|
+
this.canAddText = false;
|
|
2909
|
+
this.textAdded = false;
|
|
2910
|
+
this._canvas.renderAll();
|
|
2911
|
+
}
|
|
2912
|
+
}
|
|
2913
|
+
ZenduDocScanner.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: ZenduDocScanner, deps: [{ token: OpenCVService }], target: i0.ɵɵFactoryTarget.Component });
|
|
2914
|
+
ZenduDocScanner.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.12", type: ZenduDocScanner, selector: "zen-doc-scanner", inputs: { src: "src", width: "width", height: "height", isScanStart: "isScanStart", canAddText: "canAddText", canDoodle: "canDoodle", isRedoing: "isRedoing", isUndoing: "isUndoing", done: "done" }, outputs: { extracted: "extracted", cornersChanged: "cornersChanged", canAddTextOrDoole: "canAddTextOrDoole", canRedoOrUndo: "canRedoOrUndo" }, viewQueries: [{ propertyName: "_canvasElement", first: true, predicate: ["drawCanas"], descendants: true }, { propertyName: "_component", first: true, predicate: ["componentWrapper"], descendants: true }], usesOnChanges: true, ngImport: i0, template: "<div #componentWrapper\n class=\"component\">\n <canvas #drawCanas></canvas>\n <div class=\"colors-container\" *ngIf=\"canDoodle || canAddText\">\n <div class=\"colors\" *ngFor=\"let color of colors\" [ngStyle]=\"{'background': color.hexCode, 'border':color.selected ? '1.6px solid white' : 'none'}\" (click)=\"chngClrTextOrBrush(color.hexCode, canAddText ? 'text': 'doodle')\"></div>\n </div>\n</div>\n", styles: [".component{width:100%;height:100%}.colors-container{display:flex;height:20px;gap:16px;padding:8px 62px;justify-content:space-between;background:#262626}.colors-container .colors{width:20px;height:20px;border-radius:50%}\n"], dependencies: [{ kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }] });
|
|
2915
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: ZenduDocScanner, decorators: [{
|
|
2916
|
+
type: Component,
|
|
2917
|
+
args: [{ selector: 'zen-doc-scanner', template: "<div #componentWrapper\n class=\"component\">\n <canvas #drawCanas></canvas>\n <div class=\"colors-container\" *ngIf=\"canDoodle || canAddText\">\n <div class=\"colors\" *ngFor=\"let color of colors\" [ngStyle]=\"{'background': color.hexCode, 'border':color.selected ? '1.6px solid white' : 'none'}\" (click)=\"chngClrTextOrBrush(color.hexCode, canAddText ? 'text': 'doodle')\"></div>\n </div>\n</div>\n", styles: [".component{width:100%;height:100%}.colors-container{display:flex;height:20px;gap:16px;padding:8px 62px;justify-content:space-between;background:#262626}.colors-container .colors{width:20px;height:20px;border-radius:50%}\n"] }]
|
|
2918
|
+
}], ctorParameters: function () { return [{ type: OpenCVService }]; }, propDecorators: { _canvasElement: [{
|
|
2919
|
+
type: ViewChild,
|
|
2920
|
+
args: ['drawCanas']
|
|
2921
|
+
}], _component: [{
|
|
2922
|
+
type: ViewChild,
|
|
2923
|
+
args: ['componentWrapper']
|
|
2924
|
+
}], src: [{
|
|
2925
|
+
type: Input
|
|
2926
|
+
}], width: [{
|
|
2927
|
+
type: Input
|
|
2928
|
+
}], height: [{
|
|
2929
|
+
type: Input
|
|
2930
|
+
}], isScanStart: [{
|
|
2931
|
+
type: Input
|
|
2932
|
+
}], canAddText: [{
|
|
2933
|
+
type: Input
|
|
2934
|
+
}], canDoodle: [{
|
|
2935
|
+
type: Input
|
|
2936
|
+
}], isRedoing: [{
|
|
2937
|
+
type: Input
|
|
2938
|
+
}], isUndoing: [{
|
|
2939
|
+
type: Input
|
|
2940
|
+
}], done: [{
|
|
2941
|
+
type: Input
|
|
2942
|
+
}], extracted: [{
|
|
2943
|
+
type: Output
|
|
2944
|
+
}], cornersChanged: [{
|
|
2945
|
+
type: Output
|
|
2946
|
+
}], canAddTextOrDoole: [{
|
|
2947
|
+
type: Output
|
|
2948
|
+
}], canRedoOrUndo: [{
|
|
2949
|
+
type: Output
|
|
2950
|
+
}] } });
|
|
2951
|
+
|
|
2952
|
+
class ZenduBreadcrumbs {
|
|
2953
|
+
constructor() {
|
|
2954
|
+
this.steps = [];
|
|
2955
|
+
/**
|
|
2956
|
+
* Enable manual activation. In this case active trips will managed by app
|
|
2957
|
+
*/
|
|
2958
|
+
this.manualNavigation = false;
|
|
2959
|
+
this.onActivate = new EventEmitter();
|
|
2960
|
+
}
|
|
2961
|
+
onStepClick(step) {
|
|
2962
|
+
if (this.manualNavigation) {
|
|
2963
|
+
return;
|
|
2964
|
+
}
|
|
2965
|
+
const activeIdx = this.steps.indexOf(step);
|
|
2966
|
+
// update states
|
|
2967
|
+
for (let [idx, step] of this.steps.entries()) {
|
|
2968
|
+
step.active = idx <= activeIdx;
|
|
2969
|
+
}
|
|
2970
|
+
this.onActivate.emit(step);
|
|
2971
|
+
}
|
|
2972
|
+
}
|
|
2973
|
+
ZenduBreadcrumbs.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: ZenduBreadcrumbs, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2974
|
+
ZenduBreadcrumbs.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.12", type: ZenduBreadcrumbs, selector: "zen-breadcrumbs", inputs: { steps: "steps", manualNavigation: "manualNavigation" }, outputs: { onActivate: "onActivate" }, ngImport: i0, template: "<div class=\"component\">\n <ng-container *ngFor=\"let step of steps; let isLast = last;\">\n <div class=\"line\"\n [ngClass]=\"{\n 'active': step.active,\n 'width': steps.length !== 1\n }\"></div>\n <div class=\"step\"\n [ngClass]=\"{\n 'active': step.active,\n 'mannual-navigation': manualNavigation,\n 'text-nowrap': steps.length === 1\n }\"\n (click)=\"onStepClick(step)\">\n {{step.text}}\n </div>\n <!-- last line -->\n <div *ngIf=\"isLast\"\n class=\"line\"\n [ngClass]=\"{\n 'active': step.active,\n 'width': steps.length !== 1\n }\"></div>\n </ng-container>\n\n</div>", styles: [".component{display:flex;align-items:center;position:relative;width:100%}.component .line{flex:1;background-color:var(--color-white-tint-2, #ececed);height:8px;width:100%}.component .line.active{background-color:var(--color-primary, #2188d9)}.component .line.width{width:12px}.component :first-child.line{flex:unset;border-top-left-radius:4px;border-bottom-left-radius:4px}.component :last-child.line{flex:unset;border-top-right-radius:4px;border-bottom-right-radius:4px}.component .step{background:white;position:relative;display:flex;padding:8px 24px;justify-content:center;align-items:center;margin:0 -2px;border-radius:50px;border:2px solid var(--color-primary, #2188d9);color:var(--color-primary, #2188d9);font-size:16px;font-style:normal;font-weight:400;cursor:pointer}.component .step.active{background-color:var(--color-primary, #2188d9);color:var(--color-white-primary, #ffffff)}.component .step.mannual-navigation{cursor:default}.component .step.text-nowrap{white-space:nowrap}\n"], dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
|
|
2975
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: ZenduBreadcrumbs, decorators: [{
|
|
2976
|
+
type: Component,
|
|
2977
|
+
args: [{ selector: 'zen-breadcrumbs', template: "<div class=\"component\">\n <ng-container *ngFor=\"let step of steps; let isLast = last;\">\n <div class=\"line\"\n [ngClass]=\"{\n 'active': step.active,\n 'width': steps.length !== 1\n }\"></div>\n <div class=\"step\"\n [ngClass]=\"{\n 'active': step.active,\n 'mannual-navigation': manualNavigation,\n 'text-nowrap': steps.length === 1\n }\"\n (click)=\"onStepClick(step)\">\n {{step.text}}\n </div>\n <!-- last line -->\n <div *ngIf=\"isLast\"\n class=\"line\"\n [ngClass]=\"{\n 'active': step.active,\n 'width': steps.length !== 1\n }\"></div>\n </ng-container>\n\n</div>", styles: [".component{display:flex;align-items:center;position:relative;width:100%}.component .line{flex:1;background-color:var(--color-white-tint-2, #ececed);height:8px;width:100%}.component .line.active{background-color:var(--color-primary, #2188d9)}.component .line.width{width:12px}.component :first-child.line{flex:unset;border-top-left-radius:4px;border-bottom-left-radius:4px}.component :last-child.line{flex:unset;border-top-right-radius:4px;border-bottom-right-radius:4px}.component .step{background:white;position:relative;display:flex;padding:8px 24px;justify-content:center;align-items:center;margin:0 -2px;border-radius:50px;border:2px solid var(--color-primary, #2188d9);color:var(--color-primary, #2188d9);font-size:16px;font-style:normal;font-weight:400;cursor:pointer}.component .step.active{background-color:var(--color-primary, #2188d9);color:var(--color-white-primary, #ffffff)}.component .step.mannual-navigation{cursor:default}.component .step.text-nowrap{white-space:nowrap}\n"] }]
|
|
2978
|
+
}], propDecorators: { steps: [{
|
|
2979
|
+
type: Input
|
|
2980
|
+
}], manualNavigation: [{
|
|
2981
|
+
type: Input
|
|
2982
|
+
}], onActivate: [{
|
|
2983
|
+
type: Output
|
|
2984
|
+
}] } });
|
|
2985
|
+
|
|
2986
|
+
class MapService {
|
|
2987
|
+
createDeviceMarker(device, minZoom) {
|
|
2988
|
+
const contentHtml = this.getDeviceContent(device);
|
|
2989
|
+
const lat = Math.max(Math.min(device.latitude, 180), -180);
|
|
2990
|
+
const lng = Math.max(Math.min(device.longitude, 180), -180);
|
|
2991
|
+
const deviceMarker = new H.map.DomMarker(new H.geo.Point(lat, lng), {
|
|
2992
|
+
zIndex: 10,
|
|
2993
|
+
icon: new H.map.DomIcon(contentHtml),
|
|
2994
|
+
data: device,
|
|
2995
|
+
min: minZoom ? minZoom : 0
|
|
2996
|
+
});
|
|
2997
|
+
return deviceMarker;
|
|
2998
|
+
}
|
|
2999
|
+
getDeviceContent(device) {
|
|
3000
|
+
let devIcon = "";
|
|
3001
|
+
if (device.icon) {
|
|
3002
|
+
devIcon = device.icon;
|
|
3003
|
+
}
|
|
3004
|
+
else {
|
|
3005
|
+
// Default icon
|
|
3006
|
+
devIcon = "https://storage.googleapis.com/ng-zenduit/icon/car.svg";
|
|
3007
|
+
}
|
|
3008
|
+
let isDriving = device.isDriving || false;
|
|
3009
|
+
let driveClass = "";
|
|
3010
|
+
if (isDriving) {
|
|
3011
|
+
driveClass = "driving-marker";
|
|
3012
|
+
}
|
|
3013
|
+
let directionSvg = 'https://storage.googleapis.com/ng-zenduit/icon/device_direction.svg';
|
|
3014
|
+
let displayDirection = isDriving ? "block" : "none";
|
|
3015
|
+
let classList = isDriving ? "moving" : "stopped";
|
|
3016
|
+
const lblContent = `<div class='gotrax-label ${classList}'>` +
|
|
3017
|
+
` <span>${device.name}</span>` +
|
|
3018
|
+
` <div class='gotrax-speed-label'></div>` +
|
|
3019
|
+
`</div>`;
|
|
3020
|
+
const bearing = device.bearing || 0;
|
|
3021
|
+
let contentHtml = `<div>` +
|
|
3022
|
+
`<div class='g-marker-vehilce-wrapper'>` +
|
|
3023
|
+
`<div class='g-marker-vehilce'>` +
|
|
3024
|
+
`<div class='${driveClass} gotrax-img'>
|
|
3025
|
+
${lblContent}
|
|
3026
|
+
<div class='g-marker-icon ${classList}'><img class="g-marker-img svg-color white" src=${devIcon} />
|
|
3027
|
+
<div class="direction-arrow" style="display: ${displayDirection};transform: rotate(${bearing}deg); background-image: url('${directionSvg}');"></div>
|
|
3028
|
+
</div></div>` +
|
|
3029
|
+
`</div>` + // close g-marker-vehilce
|
|
3030
|
+
`</div>` + // close g-marker-vehilce-wrapper
|
|
3031
|
+
`</div>`;
|
|
3032
|
+
return contentHtml;
|
|
3033
|
+
}
|
|
3034
|
+
zoomToBounds(map, bounds) {
|
|
3035
|
+
if (!bounds || bounds.isEmpty()) {
|
|
3036
|
+
return;
|
|
3037
|
+
}
|
|
3038
|
+
if (isNaN(bounds.getCenter().lat) ||
|
|
3039
|
+
isNaN(bounds.getCenter().lng)) {
|
|
3040
|
+
return;
|
|
3041
|
+
}
|
|
3042
|
+
this.zoomToLatLngs(map, [bounds.getTopLeft(), bounds.getBottomRight()]);
|
|
3043
|
+
}
|
|
3044
|
+
zoomToLatLngs(map, pnts, zoom = 15) {
|
|
3045
|
+
if (!pnts || pnts.length == 0) {
|
|
3046
|
+
return;
|
|
3047
|
+
}
|
|
3048
|
+
if (pnts.length == 1) {
|
|
3049
|
+
map.setZoom(zoom);
|
|
3050
|
+
map.setCenter(new H.geo.Point(pnts[0].lat, pnts[0].lng));
|
|
3051
|
+
return;
|
|
3052
|
+
}
|
|
3053
|
+
const latLngs = [];
|
|
3054
|
+
pnts.forEach(p => latLngs.push(p.lat, p.lng, 0));
|
|
3055
|
+
const bounds = H.geo.Rect.coverLatLngAlts(latLngs);
|
|
3056
|
+
const minSize = 0.001;
|
|
3057
|
+
if (bounds.getWidth() < minSize &&
|
|
3058
|
+
bounds.getHeight() < minSize) {
|
|
3059
|
+
map.setCenter(bounds.getCenter());
|
|
3060
|
+
map.setZoom(17);
|
|
3061
|
+
}
|
|
3062
|
+
else {
|
|
3063
|
+
const p1 = bounds.getBottomRight();
|
|
3064
|
+
const p2 = bounds.getTopLeft();
|
|
3065
|
+
const width = Math.max(bounds.getWidth(), minSize);
|
|
3066
|
+
const height = Math.max(bounds.getHeight(), minSize);
|
|
3067
|
+
// add offset for zooming
|
|
3068
|
+
const targetBox = H.geo.Rect.coverLatLngAlts([
|
|
3069
|
+
p1.lat - (height * 0.15),
|
|
3070
|
+
p2.lng - (width * 0.15),
|
|
3071
|
+
0,
|
|
3072
|
+
p2.lat + (height * 0.15),
|
|
3073
|
+
p1.lng + (width * 0.15),
|
|
3074
|
+
0
|
|
3075
|
+
]);
|
|
3076
|
+
map.getViewPort().resize();
|
|
3077
|
+
map.getViewModel().setLookAtData({ bounds: targetBox });
|
|
3078
|
+
}
|
|
3079
|
+
}
|
|
3080
|
+
/**
|
|
3081
|
+
* Create polylines for given trip and date range.
|
|
3082
|
+
* Method create separte polylines for logs outside the date range.
|
|
3083
|
+
*/
|
|
3084
|
+
createTripPolyline(trip, map, theme) {
|
|
3085
|
+
let result = {};
|
|
3086
|
+
let coords = new Array();
|
|
3087
|
+
trip.logs.forEach(log => {
|
|
3088
|
+
let latLng = new H.geo.Point(log.latitude, log.longitude);
|
|
3089
|
+
coords.push(latLng.lat, latLng.lng);
|
|
3090
|
+
});
|
|
3091
|
+
if (coords.length < 2) {
|
|
3092
|
+
// Skip the empty path
|
|
3093
|
+
return result;
|
|
3094
|
+
}
|
|
3095
|
+
if (theme == "black") {
|
|
3096
|
+
const pl = this.createPl(coords, "#000000", 2);
|
|
3097
|
+
pl.setZIndex(1);
|
|
3098
|
+
result.polyline = pl;
|
|
3099
|
+
map.addObject(pl);
|
|
3100
|
+
}
|
|
3101
|
+
else {
|
|
3102
|
+
const pl = this.createPl(coords, "#9510e6", 5);
|
|
3103
|
+
pl.setZIndex(1);
|
|
3104
|
+
result.polyline = pl;
|
|
3105
|
+
let arrow = this.createArrow(coords);
|
|
3106
|
+
result.arrows = arrow;
|
|
3107
|
+
map.addObjects([pl, arrow]);
|
|
3108
|
+
// store additional information about polyline
|
|
3109
|
+
pl.setData({ type: "trip", trip: trip });
|
|
3110
|
+
arrow.setData({ type: "trip", trip: trip });
|
|
3111
|
+
}
|
|
3112
|
+
return result;
|
|
3113
|
+
}
|
|
3114
|
+
createPl(coords, color, strokeWeight) {
|
|
3115
|
+
const pl = new H.map.Polyline(H.geo.LineString.fromLatLngArray(coords), {
|
|
3116
|
+
style: {
|
|
3117
|
+
strokeColor: color,
|
|
3118
|
+
lineWidth: strokeWeight
|
|
3119
|
+
},
|
|
3120
|
+
arrows: {
|
|
3121
|
+
fillColor: "#ffffff"
|
|
3122
|
+
},
|
|
3123
|
+
zIndex: 0
|
|
3124
|
+
});
|
|
3125
|
+
return pl;
|
|
3126
|
+
}
|
|
3127
|
+
createArrow(coords) {
|
|
3128
|
+
return new H.map.Polyline(H.geo.LineString.fromLatLngArray(coords), {
|
|
3129
|
+
style: {
|
|
3130
|
+
lineWidth: 5,
|
|
3131
|
+
fillColor: 'white',
|
|
3132
|
+
strokeColor: 'rgba(255, 255, 255, 1)',
|
|
3133
|
+
lineDash: [0, 5],
|
|
3134
|
+
lineTailCap: 'arrow-tail',
|
|
3135
|
+
lineHeadCap: 'arrow-head'
|
|
3136
|
+
},
|
|
3137
|
+
zIndex: 1
|
|
3138
|
+
});
|
|
3139
|
+
}
|
|
3140
|
+
createStopMarker(map, log, stopIdx, tag, theme) {
|
|
3141
|
+
let icon;
|
|
3142
|
+
if (theme == "black") {
|
|
3143
|
+
const src = "https://storage.googleapis.com/ng-zenduit/icon/stop-icon-black.svg";
|
|
3144
|
+
icon = new H.map.DomIcon(`<div class="g-stop-img"><img src="${src}"/></div>`);
|
|
3145
|
+
}
|
|
3146
|
+
else {
|
|
3147
|
+
// deafault
|
|
3148
|
+
icon = new H.map.DomIcon(`<div class="g-stop"><label>${stopIdx}</label></div>`);
|
|
3149
|
+
}
|
|
3150
|
+
let stop = new H.map.DomMarker(new H.geo.Point(log.latitude, log.longitude), {
|
|
3151
|
+
icon: icon,
|
|
3152
|
+
zIndex: 2
|
|
3153
|
+
});
|
|
3154
|
+
map.addObject(stop);
|
|
3155
|
+
stop.setData(tag);
|
|
3156
|
+
return stop;
|
|
3157
|
+
}
|
|
3158
|
+
}
|
|
3159
|
+
MapService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: MapService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
3160
|
+
MapService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: MapService });
|
|
3161
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: MapService, decorators: [{
|
|
3162
|
+
type: Injectable
|
|
3163
|
+
}] });
|
|
3164
|
+
|
|
3165
|
+
class ZenduMapComponent {
|
|
3166
|
+
constructor() {
|
|
3167
|
+
this.trips = [];
|
|
3168
|
+
this.devices = [];
|
|
3169
|
+
this.theme = 'default';
|
|
3170
|
+
this._objects = [];
|
|
3171
|
+
this._mapService = new MapService();
|
|
3172
|
+
}
|
|
3173
|
+
ngOnChanges(changes) {
|
|
3174
|
+
if (this.apiKey && !this._platform) {
|
|
3175
|
+
this.init();
|
|
3176
|
+
}
|
|
3177
|
+
if (changes["trips"] || changes["devices"]) {
|
|
3178
|
+
this.updateEntities();
|
|
3179
|
+
}
|
|
3180
|
+
}
|
|
3181
|
+
init() {
|
|
3182
|
+
this._platform = new H.service.Platform({
|
|
3183
|
+
apikey: this.apiKey
|
|
3184
|
+
});
|
|
3185
|
+
setTimeout(() => {
|
|
3186
|
+
this.initMap();
|
|
3187
|
+
this.updateEntities();
|
|
3188
|
+
}, 1000);
|
|
3189
|
+
}
|
|
3190
|
+
initMap() {
|
|
3191
|
+
// Obtain the default map types from the platform object
|
|
3192
|
+
const defaultLayers = this._platform.createDefaultLayers();
|
|
3193
|
+
this._map = new H.Map(this._mapElement.nativeElement, defaultLayers.vector.normal.map, {
|
|
3194
|
+
zoom: 3,
|
|
3195
|
+
center: { lat: 34.366, lng: -89.519 }
|
|
3196
|
+
});
|
|
3197
|
+
// Create the default UI
|
|
3198
|
+
const ui = H.ui.UI.createDefault(this._map, defaultLayers);
|
|
3199
|
+
const mapSettings = ui.getControl('mapsettings');
|
|
3200
|
+
mapSettings.setAlignment(H.ui.LayoutAlignment.RIGHT_TOP);
|
|
3201
|
+
mapSettings.setVisibility(false);
|
|
3202
|
+
const scalebar = ui.getControl('scalebar');
|
|
3203
|
+
scalebar.setAlignment(H.ui.LayoutAlignment.RIGHT_BOTTOM);
|
|
3204
|
+
const zoom = ui.getControl('zoom');
|
|
3205
|
+
zoom.setAlignment(H.ui.LayoutAlignment.RIGHT_BOTTOM);
|
|
3206
|
+
this._map.getBaseLayer().setMin(3);
|
|
3207
|
+
// MapEvents enables the event system
|
|
3208
|
+
// Behavior implements default interactions for pan/zoom (also on mobile touch environments)
|
|
3209
|
+
const behavior = new H.mapevents.Behavior(new H.mapevents.MapEvents(this._map));
|
|
3210
|
+
}
|
|
3211
|
+
updateEntities() {
|
|
3212
|
+
if (!this._map) {
|
|
3213
|
+
// map is not ready
|
|
3214
|
+
return;
|
|
3215
|
+
}
|
|
3216
|
+
this.clearEntities();
|
|
3217
|
+
this.createTrips();
|
|
3218
|
+
this.createDevices();
|
|
3219
|
+
}
|
|
3220
|
+
createTrips() {
|
|
3221
|
+
if (!this.trips || !this.trips.length) {
|
|
3222
|
+
return;
|
|
3223
|
+
}
|
|
3224
|
+
let box = null;
|
|
3225
|
+
for (const trip of this.trips) {
|
|
3226
|
+
const res = this._mapService.createTripPolyline(trip, this._map, this.theme);
|
|
3227
|
+
if (res.polyline) {
|
|
3228
|
+
this._objects.push(res.polyline);
|
|
3229
|
+
if (box) {
|
|
3230
|
+
box = box.mergeRect(res.polyline.getBoundingBox());
|
|
3231
|
+
}
|
|
3232
|
+
else {
|
|
3233
|
+
box = res.polyline.getBoundingBox();
|
|
3234
|
+
}
|
|
3235
|
+
}
|
|
3236
|
+
if (res.arrows) {
|
|
3237
|
+
this._objects.push(res.arrows);
|
|
3238
|
+
}
|
|
3239
|
+
}
|
|
3240
|
+
// create stop points
|
|
3241
|
+
//
|
|
3242
|
+
for (const [stopIdx, trip] of this.trips.entries()) {
|
|
3243
|
+
let stopLog = trip.logs[trip.logs.length - 1];
|
|
3244
|
+
this._objects.push(this._mapService.createStopMarker(this._map, stopLog, stopIdx + 1, trip, this.theme));
|
|
3245
|
+
}
|
|
3246
|
+
if (this.theme == "black") {
|
|
3247
|
+
// create a marker for first stop as well
|
|
3248
|
+
let stopLog = this.trips[0].logs[0];
|
|
3249
|
+
this._objects.push(this._mapService.createStopMarker(this._map, stopLog, 0, this.trips[0], this.theme));
|
|
3250
|
+
}
|
|
3251
|
+
if (box) {
|
|
3252
|
+
this._mapService.zoomToBounds(this._map, box);
|
|
3253
|
+
}
|
|
3254
|
+
}
|
|
3255
|
+
createDevices() {
|
|
3256
|
+
if (!this.devices || !this.devices.length) {
|
|
3257
|
+
return;
|
|
3258
|
+
}
|
|
3259
|
+
for (const device of this.devices) {
|
|
3260
|
+
const marker = this._mapService.createDeviceMarker(device);
|
|
3261
|
+
this._map.addObject(marker);
|
|
3262
|
+
this._objects.push(marker);
|
|
3263
|
+
}
|
|
3264
|
+
}
|
|
3265
|
+
clearEntities() {
|
|
3266
|
+
if (!this._map) {
|
|
3267
|
+
return;
|
|
3268
|
+
}
|
|
3269
|
+
this._map.removeObjects(this._objects);
|
|
3270
|
+
this._objects = [];
|
|
3271
|
+
}
|
|
3272
|
+
}
|
|
3273
|
+
ZenduMapComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: ZenduMapComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
3274
|
+
ZenduMapComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.12", type: ZenduMapComponent, selector: "zen-map", inputs: { apiKey: "apiKey", trips: "trips", devices: "devices", theme: "theme" }, viewQueries: [{ propertyName: "_mapElement", first: true, predicate: ["map"], descendants: true }], usesOnChanges: true, ngImport: i0, template: "<div class=\"component\">\n <div #map\n class=\"zen-map\"></div>\n</div>\n", styles: [".component{width:100%;height:100%}.component .zen-map{width:100%;height:100%;min-width:100px;min-height:100px}::ng-deep .component .zen-map .g-stop{display:flex;align-items:center;justify-content:center;padding:0 5px;min-width:16px;height:24px;background:#2188d9;border:1px solid black;border-radius:1px}::ng-deep .component .zen-map .g-stop label{color:#fff;display:block;text-align:center;margin:0!important}::ng-deep .component .zen-map .g-stop-img{position:relative}::ng-deep .component .zen-map .g-stop-img img{height:50px;position:relative;top:-49px;left:-20px}::ng-deep .component .zen-map .g-marker-vehilce-wrapper{position:absolute;bottom:0;width:54px;display:flex;flex-direction:column;align-items:center;left:-27px}::ng-deep .component .zen-map .g-marker-vehilce-wrapper .gotrax-img{display:flex;flex-direction:row;justify-content:center;align-items:center}::ng-deep .component .zen-map .g-marker-vehilce-wrapper .g-marker-vehilce{position:relative;cursor:pointer}::ng-deep .component .zen-map .g-marker-vehilce-wrapper .gotrax-label-wrapper{position:absolute;bottom:42px;width:400px;left:-200px;display:flex}::ng-deep .component .zen-map .g-marker-vehilce-wrapper .gotrax-label{font-weight:400;font-size:14px;border-radius:2px;text-align:center;white-space:nowrap;max-width:400px;text-overflow:ellipsis;overflow-x:hidden;color:#fff;position:absolute;top:-28px;padding:0 12px;line-height:18px}::ng-deep .component .zen-map .g-marker-vehilce-wrapper .gotrax-img>.g-marker-icon{width:30px;height:30px;display:flex;flex-direction:row;justify-content:center;align-items:center}::ng-deep .component .zen-map .g-marker-vehilce-wrapper .direction-arrow{height:72px;width:72px;background-repeat:no-repeat;background-size:15px;background-position:top;position:absolute}::ng-deep .component .zen-map .g-marker-vehilce-wrapper .gotrax-label.moving{background-color:#2188d9}::ng-deep .component .zen-map .g-marker-vehilce-wrapper .gotrax-label.stopped{background-color:#2188d9}::ng-deep .component .zen-map .g-marker-vehilce-wrapper .gotrax-img>.g-marker-icon.moving{border-radius:50%;background-color:#2188d9;width:36px;height:36px}::ng-deep .component .zen-map .g-marker-vehilce-wrapper .gotrax-img>.g-marker-icon.stopped{background-color:#2188d9}::ng-deep .component .zen-map .g-marker-vehilce-wrapper .svg-color.white{filter:invert(100%) sepia(4%) saturate(1%) hue-rotate(347deg) brightness(105%) contrast(100%)}::ng-deep .component .zen-map .g-marker-vehilce-wrapper .g-marker-img{display:block;margin:auto;height:15px}\n"] });
|
|
3275
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: ZenduMapComponent, decorators: [{
|
|
3276
|
+
type: Component,
|
|
3277
|
+
args: [{ selector: 'zen-map', template: "<div class=\"component\">\n <div #map\n class=\"zen-map\"></div>\n</div>\n", styles: [".component{width:100%;height:100%}.component .zen-map{width:100%;height:100%;min-width:100px;min-height:100px}::ng-deep .component .zen-map .g-stop{display:flex;align-items:center;justify-content:center;padding:0 5px;min-width:16px;height:24px;background:#2188d9;border:1px solid black;border-radius:1px}::ng-deep .component .zen-map .g-stop label{color:#fff;display:block;text-align:center;margin:0!important}::ng-deep .component .zen-map .g-stop-img{position:relative}::ng-deep .component .zen-map .g-stop-img img{height:50px;position:relative;top:-49px;left:-20px}::ng-deep .component .zen-map .g-marker-vehilce-wrapper{position:absolute;bottom:0;width:54px;display:flex;flex-direction:column;align-items:center;left:-27px}::ng-deep .component .zen-map .g-marker-vehilce-wrapper .gotrax-img{display:flex;flex-direction:row;justify-content:center;align-items:center}::ng-deep .component .zen-map .g-marker-vehilce-wrapper .g-marker-vehilce{position:relative;cursor:pointer}::ng-deep .component .zen-map .g-marker-vehilce-wrapper .gotrax-label-wrapper{position:absolute;bottom:42px;width:400px;left:-200px;display:flex}::ng-deep .component .zen-map .g-marker-vehilce-wrapper .gotrax-label{font-weight:400;font-size:14px;border-radius:2px;text-align:center;white-space:nowrap;max-width:400px;text-overflow:ellipsis;overflow-x:hidden;color:#fff;position:absolute;top:-28px;padding:0 12px;line-height:18px}::ng-deep .component .zen-map .g-marker-vehilce-wrapper .gotrax-img>.g-marker-icon{width:30px;height:30px;display:flex;flex-direction:row;justify-content:center;align-items:center}::ng-deep .component .zen-map .g-marker-vehilce-wrapper .direction-arrow{height:72px;width:72px;background-repeat:no-repeat;background-size:15px;background-position:top;position:absolute}::ng-deep .component .zen-map .g-marker-vehilce-wrapper .gotrax-label.moving{background-color:#2188d9}::ng-deep .component .zen-map .g-marker-vehilce-wrapper .gotrax-label.stopped{background-color:#2188d9}::ng-deep .component .zen-map .g-marker-vehilce-wrapper .gotrax-img>.g-marker-icon.moving{border-radius:50%;background-color:#2188d9;width:36px;height:36px}::ng-deep .component .zen-map .g-marker-vehilce-wrapper .gotrax-img>.g-marker-icon.stopped{background-color:#2188d9}::ng-deep .component .zen-map .g-marker-vehilce-wrapper .svg-color.white{filter:invert(100%) sepia(4%) saturate(1%) hue-rotate(347deg) brightness(105%) contrast(100%)}::ng-deep .component .zen-map .g-marker-vehilce-wrapper .g-marker-img{display:block;margin:auto;height:15px}\n"] }]
|
|
3278
|
+
}], propDecorators: { _mapElement: [{
|
|
3279
|
+
type: ViewChild,
|
|
3280
|
+
args: ["map"]
|
|
3281
|
+
}], apiKey: [{
|
|
3282
|
+
type: Input
|
|
3283
|
+
}], trips: [{
|
|
3284
|
+
type: Input
|
|
3285
|
+
}], devices: [{
|
|
3286
|
+
type: Input
|
|
3287
|
+
}], theme: [{
|
|
3288
|
+
type: Input
|
|
3289
|
+
}] } });
|
|
3290
|
+
|
|
3291
|
+
class ZenduFileUpload {
|
|
3292
|
+
constructor() {
|
|
3293
|
+
this.fileTypes = `image/*`;
|
|
3294
|
+
this.uploadState = "";
|
|
3295
|
+
/**
|
|
3296
|
+
* fire when user clicked on "Upload now"
|
|
3297
|
+
*/
|
|
3298
|
+
this.uploadFile = new EventEmitter();
|
|
3299
|
+
/**
|
|
3300
|
+
* fired when user click "Cancel"
|
|
3301
|
+
*/
|
|
3302
|
+
this.uploadCancelled = new EventEmitter();
|
|
3303
|
+
this.isFileSelected = false;
|
|
3304
|
+
this.isFileDragover = false;
|
|
3305
|
+
this.filename = "";
|
|
3306
|
+
this._selectedFiles = [];
|
|
3307
|
+
}
|
|
3308
|
+
// Dragover listener
|
|
3309
|
+
onDragOver(evt) {
|
|
3310
|
+
evt.preventDefault();
|
|
3311
|
+
evt.stopPropagation();
|
|
3312
|
+
this.isFileDragover = true;
|
|
3313
|
+
}
|
|
3314
|
+
// Dragleave listener
|
|
3315
|
+
onDragLeave(evt) {
|
|
3316
|
+
evt.preventDefault();
|
|
3317
|
+
evt.stopPropagation();
|
|
3318
|
+
this.isFileDragover = false;
|
|
3319
|
+
}
|
|
3320
|
+
// Drop listener
|
|
3321
|
+
ondrop(evt) {
|
|
3322
|
+
evt.preventDefault();
|
|
3323
|
+
evt.stopPropagation();
|
|
3324
|
+
this.isFileDragover = false;
|
|
3325
|
+
let target = evt.dataTransfer;
|
|
3326
|
+
if (target && target.files?.length) {
|
|
3327
|
+
this.handleFiles(target.files);
|
|
3328
|
+
}
|
|
3329
|
+
console.log('File Dropped');
|
|
3330
|
+
}
|
|
3331
|
+
async onFileInput(evt) {
|
|
3332
|
+
const target = evt.target;
|
|
3333
|
+
if (target && target.files) {
|
|
3334
|
+
await this.handleFiles(target.files);
|
|
3335
|
+
}
|
|
3336
|
+
}
|
|
3337
|
+
async handleFiles(files) {
|
|
3338
|
+
console.log(`handle files`, files);
|
|
3339
|
+
if (!files.length) {
|
|
3340
|
+
return;
|
|
3341
|
+
}
|
|
3342
|
+
this.filename = files.item(0).name;
|
|
3343
|
+
this._selectedFiles = [];
|
|
3344
|
+
for (let idx = 0; idx < files.length; idx++) {
|
|
3345
|
+
this._selectedFiles.push(files[idx]);
|
|
3346
|
+
}
|
|
3347
|
+
this.isFileSelected = true;
|
|
3348
|
+
this.uploadState = '';
|
|
3349
|
+
}
|
|
3350
|
+
uploadNow() {
|
|
3351
|
+
if (!this._selectedFiles.length) {
|
|
3352
|
+
console.error(`no files for uploading`);
|
|
3353
|
+
return;
|
|
3354
|
+
}
|
|
3355
|
+
this.uploadFile.emit(this._selectedFiles);
|
|
3356
|
+
}
|
|
3357
|
+
clear() {
|
|
3358
|
+
this.isFileSelected = false;
|
|
3359
|
+
this.isFileDragover = false;
|
|
3360
|
+
this.filename = "";
|
|
3361
|
+
this._selectedFiles = [];
|
|
3362
|
+
this.uploadState = "";
|
|
3363
|
+
}
|
|
3364
|
+
cancelUploading() {
|
|
3365
|
+
this.uploadCancelled.emit();
|
|
3366
|
+
this.clear();
|
|
3367
|
+
}
|
|
3368
|
+
}
|
|
3369
|
+
ZenduFileUpload.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: ZenduFileUpload, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
3370
|
+
ZenduFileUpload.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.12", type: ZenduFileUpload, selector: "zen-file-upload", inputs: { fileTypes: "fileTypes", uploadState: "uploadState" }, outputs: { uploadFile: "uploadFile", uploadCancelled: "uploadCancelled" }, host: { listeners: { "dragover": "onDragOver($event)", "dragleave": "onDragLeave($event)", "drop": "ondrop($event)" } }, ngImport: i0, template: "<div class=\"component\">\n <div class=\"title\">\n <span *ngIf=\"uploadState != 'done'\">Upload File</span>\n <span *ngIf=\"uploadState == 'done'\">Uploaded File</span>\n </div>\n <div class=\"drop-area\"\n [class.dragover]=\"isFileDragover\"\n *ngIf=\"uploadState != 'done'\">\n\n <div class=\"box\"\n *ngIf=\"!isFileSelected\">\n <div>\n <zen-icon class=\"doc-icon\"\n src=\"https://storage.googleapis.com/ng-zenduit/icon/document.svg\"></zen-icon>\n </div>\n <div>\n <div>Drag and Drop Here</div>\n <div>or</div>\n <span class=\"browse\"\n (click)=\"fileIp.click()\">Browse</span>\n\n <form><input type=\"file\"\n [accept]=\"fileTypes\"\n #fileIp\n (change)=\"onFileInput($event)\" /></form>\n </div>\n </div>\n\n <ng-container *ngIf=\"isFileSelected\">\n <!-- File selected state -->\n <ng-container *ngIf=\"uploadState == ''\">\n <div class=\"box-selected-file\">\n <div class=\"close-wrapper\">\n <zen-icon (click)=\"clear()\"\n class=\"close-icon\"\n src=\"https://storage.googleapis.com/ng-zenduit/icon/cross.svg\"></zen-icon>\n </div>\n <div>\n <zen-icon class=\"img-icon\"\n src=\"https://storage.googleapis.com/ng-zenduit/icon/image.svg\"></zen-icon>\n </div>\n <div class=\"filename\">\n {{filename}}\n </div>\n </div>\n </ng-container>\n\n <!-- Uploading state -->\n <ng-container *ngIf=\"uploadState == 'uploading'\">\n <div class=\"box-file-uploading\">\n <div class=\"file-description\">\n <zen-icon class=\"img-icon-sm\"\n src=\"https://storage.googleapis.com/ng-zenduit/icon/image-sm.svg\"></zen-icon>\n <div>{{filename}}</div>\n </div>\n <div class=\"progress\">\n <div class=\"progress-bar-value\"></div>\n </div>\n </div>\n </ng-container>\n </ng-container>\n </div>\n\n\n <!-- Uploading done -->\n <div *ngIf=\"uploadState == 'done'\"\n class=\"box-upload-done\">\n <div class=\"file-description\">\n <zen-icon class=\"img-icon\"\n src=\"https://storage.googleapis.com/ng-zenduit/icon/image.svg\"></zen-icon>\n <div class=\"filename\">{{filename}}</div>\n <div class=\"close-btn\">\n <zen-icon (click)=\"clear()\"\n class=\"close-icon\"\n src=\"https://storage.googleapis.com/ng-zenduit/icon/cross.svg\"></zen-icon>\n </div>\n\n </div>\n </div>\n\n <div class=\"btn-upload-wrapper\">\n\n <button *ngIf=\"uploadState == ''\"\n (click)=\"uploadNow()\"\n class=\"button-flat full-width\"\n [disabled]=\"!isFileSelected\">\n Upload Now\n </button>\n\n <button *ngIf=\"uploadState == 'uploading'\"\n (click)=\"cancelUploading()\"\n class=\"button-alert full-width\"\n [disabled]=\"!isFileSelected\">\n Cancel\n </button>\n </div>\n\n</div>\n", styles: [".component{border-radius:4px;border:1px solid var(--color-white-tint-3, #e0e0e0);padding:24px;box-sizing:border-box;font-family:Roboto;width:100%;height:100%}.component .title{font-size:16px;font-style:normal;font-weight:500;margin-bottom:16px}.component .drop-area{border-radius:4px;border:1px dashed var(--color-white-tint-3, #e0e0e0);min-width:100px;margin-bottom:16px}.component .drop-area input[type=file]{display:none}.component .drop-area .box{padding:26px;box-sizing:border-box;display:flex;flex-direction:column;align-items:center;justify-content:center;text-align:center;gap:4px;color:var(--color-grey-primary, #4f4f4f);font-size:14px;font-style:normal;font-weight:400}.component .drop-area .box .browse{color:var(--color-primary, #2188d9);font-style:normal;font-weight:500;line-height:130%;letter-spacing:.28px;text-decoration:underline;cursor:pointer}.component .drop-area .doc-icon{width:28px;height:28px;background-color:var(--color-grey-primary, #4f4f4f)}.component .drop-area.dragover{border:1px dashed var(--color-primary, #2188d9)}.component .drop-area.dragover .doc-icon{background-color:var(--color-primary, #2188d9)}.component .drop-area .box-selected-file{display:flex;flex-direction:column;align-items:center;justify-content:center;text-align:center;gap:4px;margin:8px}.component .drop-area .box-selected-file .img-icon{background-color:var(--color-grey-primary, #4f4f4f);width:52px;height:52px}.component .drop-area .box-selected-file .close-wrapper{width:100%;display:flex;justify-content:end;margin-bottom:8px}.component .drop-area .box-selected-file .close-wrapper .close-icon{background-color:var(--color-error-primary, #dc3e33);cursor:pointer}.component .drop-area .box-selected-file .filename{color:var(--color-grey-primary, #4f4f4f);font-size:14px;font-style:normal;font-weight:400;margin-bottom:30px}.component .drop-area .box-file-uploading{padding:56px 28px;box-sizing:border-box}.component .drop-area .box-file-uploading .file-description{display:flex;align-items:center;gap:8px;font-size:14px;font-style:normal;font-weight:400;margin-bottom:5px}.component .drop-area .box-file-uploading .file-description .img-icon-sm{background-color:var(--color-grey-primary, #4f4f4f);width:28px;height:28px}.component .drop-area .box-file-uploading .progress{border-radius:4px;background-color:var(--color-white-tint-3, #e0e0e0);width:100%;height:5px;overflow:hidden}.component .drop-area .box-file-uploading .progress .progress-bar-value{width:100%;height:100%;background-color:var(--color-primary, #2188d9);animation:indeterminateAnimation 1s infinite linear;transform-origin:0% 50%}.component .box-upload-done .file-description{display:flex;align-items:center;gap:4px;font-size:14px;font-style:normal;font-weight:400}.component .box-upload-done .file-description .filename{flex:1}.component .box-upload-done .file-description .close-icon{background-color:var(--color-error-primary, #dc3e33);cursor:pointer}.component .box-upload-done .file-description .img-icon{background-color:var(--color-grey-primary, #4f4f4f);width:52px;height:52px}.component .btn-upload-wrapper button{width:100%}@keyframes indeterminateAnimation{0%{transform:translate(0) scaleX(0)}40%{transform:translate(0) scaleX(.4)}to{transform:translate(100%) scaleX(.5)}}\n"], dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i2.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i2.NgForm, selector: "form:not([ngNoForm]):not([formGroup]),ng-form,[ngForm]", inputs: ["ngFormOptions"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "component", type: ZenduIconComponent, selector: "zen-icon", inputs: ["src"] }] });
|
|
3371
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: ZenduFileUpload, decorators: [{
|
|
3372
|
+
type: Component,
|
|
3373
|
+
args: [{ selector: 'zen-file-upload', template: "<div class=\"component\">\n <div class=\"title\">\n <span *ngIf=\"uploadState != 'done'\">Upload File</span>\n <span *ngIf=\"uploadState == 'done'\">Uploaded File</span>\n </div>\n <div class=\"drop-area\"\n [class.dragover]=\"isFileDragover\"\n *ngIf=\"uploadState != 'done'\">\n\n <div class=\"box\"\n *ngIf=\"!isFileSelected\">\n <div>\n <zen-icon class=\"doc-icon\"\n src=\"https://storage.googleapis.com/ng-zenduit/icon/document.svg\"></zen-icon>\n </div>\n <div>\n <div>Drag and Drop Here</div>\n <div>or</div>\n <span class=\"browse\"\n (click)=\"fileIp.click()\">Browse</span>\n\n <form><input type=\"file\"\n [accept]=\"fileTypes\"\n #fileIp\n (change)=\"onFileInput($event)\" /></form>\n </div>\n </div>\n\n <ng-container *ngIf=\"isFileSelected\">\n <!-- File selected state -->\n <ng-container *ngIf=\"uploadState == ''\">\n <div class=\"box-selected-file\">\n <div class=\"close-wrapper\">\n <zen-icon (click)=\"clear()\"\n class=\"close-icon\"\n src=\"https://storage.googleapis.com/ng-zenduit/icon/cross.svg\"></zen-icon>\n </div>\n <div>\n <zen-icon class=\"img-icon\"\n src=\"https://storage.googleapis.com/ng-zenduit/icon/image.svg\"></zen-icon>\n </div>\n <div class=\"filename\">\n {{filename}}\n </div>\n </div>\n </ng-container>\n\n <!-- Uploading state -->\n <ng-container *ngIf=\"uploadState == 'uploading'\">\n <div class=\"box-file-uploading\">\n <div class=\"file-description\">\n <zen-icon class=\"img-icon-sm\"\n src=\"https://storage.googleapis.com/ng-zenduit/icon/image-sm.svg\"></zen-icon>\n <div>{{filename}}</div>\n </div>\n <div class=\"progress\">\n <div class=\"progress-bar-value\"></div>\n </div>\n </div>\n </ng-container>\n </ng-container>\n </div>\n\n\n <!-- Uploading done -->\n <div *ngIf=\"uploadState == 'done'\"\n class=\"box-upload-done\">\n <div class=\"file-description\">\n <zen-icon class=\"img-icon\"\n src=\"https://storage.googleapis.com/ng-zenduit/icon/image.svg\"></zen-icon>\n <div class=\"filename\">{{filename}}</div>\n <div class=\"close-btn\">\n <zen-icon (click)=\"clear()\"\n class=\"close-icon\"\n src=\"https://storage.googleapis.com/ng-zenduit/icon/cross.svg\"></zen-icon>\n </div>\n\n </div>\n </div>\n\n <div class=\"btn-upload-wrapper\">\n\n <button *ngIf=\"uploadState == ''\"\n (click)=\"uploadNow()\"\n class=\"button-flat full-width\"\n [disabled]=\"!isFileSelected\">\n Upload Now\n </button>\n\n <button *ngIf=\"uploadState == 'uploading'\"\n (click)=\"cancelUploading()\"\n class=\"button-alert full-width\"\n [disabled]=\"!isFileSelected\">\n Cancel\n </button>\n </div>\n\n</div>\n", styles: [".component{border-radius:4px;border:1px solid var(--color-white-tint-3, #e0e0e0);padding:24px;box-sizing:border-box;font-family:Roboto;width:100%;height:100%}.component .title{font-size:16px;font-style:normal;font-weight:500;margin-bottom:16px}.component .drop-area{border-radius:4px;border:1px dashed var(--color-white-tint-3, #e0e0e0);min-width:100px;margin-bottom:16px}.component .drop-area input[type=file]{display:none}.component .drop-area .box{padding:26px;box-sizing:border-box;display:flex;flex-direction:column;align-items:center;justify-content:center;text-align:center;gap:4px;color:var(--color-grey-primary, #4f4f4f);font-size:14px;font-style:normal;font-weight:400}.component .drop-area .box .browse{color:var(--color-primary, #2188d9);font-style:normal;font-weight:500;line-height:130%;letter-spacing:.28px;text-decoration:underline;cursor:pointer}.component .drop-area .doc-icon{width:28px;height:28px;background-color:var(--color-grey-primary, #4f4f4f)}.component .drop-area.dragover{border:1px dashed var(--color-primary, #2188d9)}.component .drop-area.dragover .doc-icon{background-color:var(--color-primary, #2188d9)}.component .drop-area .box-selected-file{display:flex;flex-direction:column;align-items:center;justify-content:center;text-align:center;gap:4px;margin:8px}.component .drop-area .box-selected-file .img-icon{background-color:var(--color-grey-primary, #4f4f4f);width:52px;height:52px}.component .drop-area .box-selected-file .close-wrapper{width:100%;display:flex;justify-content:end;margin-bottom:8px}.component .drop-area .box-selected-file .close-wrapper .close-icon{background-color:var(--color-error-primary, #dc3e33);cursor:pointer}.component .drop-area .box-selected-file .filename{color:var(--color-grey-primary, #4f4f4f);font-size:14px;font-style:normal;font-weight:400;margin-bottom:30px}.component .drop-area .box-file-uploading{padding:56px 28px;box-sizing:border-box}.component .drop-area .box-file-uploading .file-description{display:flex;align-items:center;gap:8px;font-size:14px;font-style:normal;font-weight:400;margin-bottom:5px}.component .drop-area .box-file-uploading .file-description .img-icon-sm{background-color:var(--color-grey-primary, #4f4f4f);width:28px;height:28px}.component .drop-area .box-file-uploading .progress{border-radius:4px;background-color:var(--color-white-tint-3, #e0e0e0);width:100%;height:5px;overflow:hidden}.component .drop-area .box-file-uploading .progress .progress-bar-value{width:100%;height:100%;background-color:var(--color-primary, #2188d9);animation:indeterminateAnimation 1s infinite linear;transform-origin:0% 50%}.component .box-upload-done .file-description{display:flex;align-items:center;gap:4px;font-size:14px;font-style:normal;font-weight:400}.component .box-upload-done .file-description .filename{flex:1}.component .box-upload-done .file-description .close-icon{background-color:var(--color-error-primary, #dc3e33);cursor:pointer}.component .box-upload-done .file-description .img-icon{background-color:var(--color-grey-primary, #4f4f4f);width:52px;height:52px}.component .btn-upload-wrapper button{width:100%}@keyframes indeterminateAnimation{0%{transform:translate(0) scaleX(0)}40%{transform:translate(0) scaleX(.4)}to{transform:translate(100%) scaleX(.5)}}\n"] }]
|
|
3374
|
+
}], propDecorators: { fileTypes: [{
|
|
3375
|
+
type: Input
|
|
3376
|
+
}], uploadState: [{
|
|
3377
|
+
type: Input
|
|
3378
|
+
}], uploadFile: [{
|
|
3379
|
+
type: Output
|
|
3380
|
+
}], uploadCancelled: [{
|
|
3381
|
+
type: Output
|
|
3382
|
+
}], onDragOver: [{
|
|
3383
|
+
type: HostListener,
|
|
3384
|
+
args: ['dragover', ['$event']]
|
|
3385
|
+
}], onDragLeave: [{
|
|
3386
|
+
type: HostListener,
|
|
3387
|
+
args: ['dragleave', ['$event']]
|
|
3388
|
+
}], ondrop: [{
|
|
3389
|
+
type: HostListener,
|
|
3390
|
+
args: ['drop', ['$event']]
|
|
3391
|
+
}] } });
|
|
3392
|
+
|
|
3393
|
+
class ZenduProgress {
|
|
3394
|
+
constructor() {
|
|
3395
|
+
this.type = "bar";
|
|
3396
|
+
/**
|
|
3397
|
+
* progress value [0, 100]
|
|
3398
|
+
*/
|
|
3399
|
+
this.value = 20;
|
|
3400
|
+
/**
|
|
3401
|
+
* progress text
|
|
3402
|
+
*/
|
|
3403
|
+
this.text = "";
|
|
3404
|
+
}
|
|
3405
|
+
}
|
|
3406
|
+
ZenduProgress.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: ZenduProgress, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
3407
|
+
ZenduProgress.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.12", type: ZenduProgress, selector: "zen-progress", inputs: { type: "type", value: "value", text: "text" }, ngImport: i0, template: "<div class=\"component\">\n <!-- Progres bar -->\n <div *ngIf=\"type == 'bar'\">\n <div class=\"progress-bar\">\n <div class=\"progress-bar-val\"\n [ngStyle]=\"{ 'width': value + '%' }\">\n <span class=\"value-text\">{{value}}%</span>\n </div>\n </div>\n <div class=\"progress-text\">\n {{text}}\n </div>\n </div>\n\n <!-- Circle progress -->\n <div *ngIf=\"type == 'circle'\"\n class=\"progress-circle-wrapper\">\n\n\n <div class=\"progress-circle\"\n [class.show-full-right-side]=\"value>=50\">\n\n <div class=\"center-pipe\"></div>\n\n <div class=\"circle-clipper\">\n <div class=\"right-full-bar progress-val-50\"></div>\n <div class=\"progress-bar-val progress-val-{{value}}\"></div>\n </div>\n <div class=\"text-wrapper\">\n <div class=\"text\"> {{value}}%</div>\n <div class=\"progress-text\">{{text}}</div>\n </div>\n </div>\n </div>\n\n <!-- Half-Circle progress -->\n <div *ngIf=\"type == 'half-circle'\"\n class=\"progress-half-circle-wrapper\">\n\n <div class=\"progress-circle\">\n <div class=\"center-pipe\"></div>\n\n <div class=\"circle-clipper\">\n <div class=\"right-full-bar progress-val-50\"></div>\n <div class=\"progress-bar-val progress-val-{{value}}\"></div>\n </div>\n <div class=\"text-wrapper\">\n <div class=\"text\"> {{value}}%</div>\n <div class=\"progress-text\">{{text}}</div>\n </div>\n </div>\n </div>\n</div>\n", styles: [".component{font-family:Roboto}.component .progress-bar{min-width:100px;width:100%;height:24px;border-radius:4px;background-color:var(--color-white-tint-2, #ececed);overflow:hidden;position:relative}.component .progress-bar .progress-bar-val{height:100%;display:block;width:0;background-color:var(--color-primary, #2188d9);line-height:24px;position:absolute;text-align:end;padding-right:5px;transition:width 1s}.component .progress-bar .progress-bar-val .value-text{color:var(--color-white-primary, #ffffff);font-size:14px;font-style:normal;font-weight:500}.component .progress-text{color:var(--color-white-tint-4, #d6d6d8);overflow:hidden;font-size:14px;font-style:normal;font-weight:400;margin-top:8px}.component .progress-circle-wrapper .progress-circle{position:relative;width:188px;height:188px;background-color:var(--color-white-tint-2, #ececed);border-radius:50%}.component .progress-circle-wrapper .progress-circle .center-pipe{position:absolute;top:15px;left:15px;border-radius:50%;width:160px;height:160px;background-color:#fff}.component .progress-circle-wrapper .progress-circle .circle-clipper{border-radius:50%;width:188px;height:188px;position:absolute;clip:rect(0,188px,188px,94px)}.component .progress-circle-wrapper .progress-circle .progress-bar-val{position:absolute;clip:rect(0,94px,188px,0);width:188px;height:188px;border-radius:50%;border:15px solid var(--color-primary, #2188d9);box-sizing:border-box}.component .progress-circle-wrapper .progress-circle .progress-val-0{transform:rotate(0)}.component .progress-circle-wrapper .progress-circle .progress-val-1{transform:rotate(3.6deg)}.component .progress-circle-wrapper .progress-circle .progress-val-2{transform:rotate(7.2deg)}.component .progress-circle-wrapper .progress-circle .progress-val-3{transform:rotate(10.8deg)}.component .progress-circle-wrapper .progress-circle .progress-val-4{transform:rotate(14.4deg)}.component .progress-circle-wrapper .progress-circle .progress-val-5{transform:rotate(18deg)}.component .progress-circle-wrapper .progress-circle .progress-val-6{transform:rotate(21.6deg)}.component .progress-circle-wrapper .progress-circle .progress-val-7{transform:rotate(25.2deg)}.component .progress-circle-wrapper .progress-circle .progress-val-8{transform:rotate(28.8deg)}.component .progress-circle-wrapper .progress-circle .progress-val-9{transform:rotate(32.4deg)}.component .progress-circle-wrapper .progress-circle .progress-val-10{transform:rotate(36deg)}.component .progress-circle-wrapper .progress-circle .progress-val-11{transform:rotate(39.6deg)}.component .progress-circle-wrapper .progress-circle .progress-val-12{transform:rotate(43.2deg)}.component .progress-circle-wrapper .progress-circle .progress-val-13{transform:rotate(46.8deg)}.component .progress-circle-wrapper .progress-circle .progress-val-14{transform:rotate(50.4deg)}.component .progress-circle-wrapper .progress-circle .progress-val-15{transform:rotate(54deg)}.component .progress-circle-wrapper .progress-circle .progress-val-16{transform:rotate(57.6deg)}.component .progress-circle-wrapper .progress-circle .progress-val-17{transform:rotate(61.2deg)}.component .progress-circle-wrapper .progress-circle .progress-val-18{transform:rotate(64.8deg)}.component .progress-circle-wrapper .progress-circle .progress-val-19{transform:rotate(68.4deg)}.component .progress-circle-wrapper .progress-circle .progress-val-20{transform:rotate(72deg)}.component .progress-circle-wrapper .progress-circle .progress-val-21{transform:rotate(75.6deg)}.component .progress-circle-wrapper .progress-circle .progress-val-22{transform:rotate(79.2deg)}.component .progress-circle-wrapper .progress-circle .progress-val-23{transform:rotate(82.8deg)}.component .progress-circle-wrapper .progress-circle .progress-val-24{transform:rotate(86.4deg)}.component .progress-circle-wrapper .progress-circle .progress-val-25{transform:rotate(90deg)}.component .progress-circle-wrapper .progress-circle .progress-val-26{transform:rotate(93.6deg)}.component .progress-circle-wrapper .progress-circle .progress-val-27{transform:rotate(97.2deg)}.component .progress-circle-wrapper .progress-circle .progress-val-28{transform:rotate(100.8deg)}.component .progress-circle-wrapper .progress-circle .progress-val-29{transform:rotate(104.4deg)}.component .progress-circle-wrapper .progress-circle .progress-val-30{transform:rotate(108deg)}.component .progress-circle-wrapper .progress-circle .progress-val-31{transform:rotate(111.6deg)}.component .progress-circle-wrapper .progress-circle .progress-val-32{transform:rotate(115.2deg)}.component .progress-circle-wrapper .progress-circle .progress-val-33{transform:rotate(118.8deg)}.component .progress-circle-wrapper .progress-circle .progress-val-34{transform:rotate(122.4deg)}.component .progress-circle-wrapper .progress-circle .progress-val-35{transform:rotate(126deg)}.component .progress-circle-wrapper .progress-circle .progress-val-36{transform:rotate(129.6deg)}.component .progress-circle-wrapper .progress-circle .progress-val-37{transform:rotate(133.2deg)}.component .progress-circle-wrapper .progress-circle .progress-val-38{transform:rotate(136.8deg)}.component .progress-circle-wrapper .progress-circle .progress-val-39{transform:rotate(140.4deg)}.component .progress-circle-wrapper .progress-circle .progress-val-40{transform:rotate(144deg)}.component .progress-circle-wrapper .progress-circle .progress-val-41{transform:rotate(147.6deg)}.component .progress-circle-wrapper .progress-circle .progress-val-42{transform:rotate(151.2deg)}.component .progress-circle-wrapper .progress-circle .progress-val-43{transform:rotate(154.8deg)}.component .progress-circle-wrapper .progress-circle .progress-val-44{transform:rotate(158.4deg)}.component .progress-circle-wrapper .progress-circle .progress-val-45{transform:rotate(162deg)}.component .progress-circle-wrapper .progress-circle .progress-val-46{transform:rotate(165.6deg)}.component .progress-circle-wrapper .progress-circle .progress-val-47{transform:rotate(169.2deg)}.component .progress-circle-wrapper .progress-circle .progress-val-48{transform:rotate(172.8deg)}.component .progress-circle-wrapper .progress-circle .progress-val-49{transform:rotate(176.4deg)}.component .progress-circle-wrapper .progress-circle .progress-val-50{transform:rotate(180deg)}.component .progress-circle-wrapper .progress-circle .progress-val-51{transform:rotate(183.6deg)}.component .progress-circle-wrapper .progress-circle .progress-val-52{transform:rotate(187.2deg)}.component .progress-circle-wrapper .progress-circle .progress-val-53{transform:rotate(190.8deg)}.component .progress-circle-wrapper .progress-circle .progress-val-54{transform:rotate(194.4deg)}.component .progress-circle-wrapper .progress-circle .progress-val-55{transform:rotate(198deg)}.component .progress-circle-wrapper .progress-circle .progress-val-56{transform:rotate(201.6deg)}.component .progress-circle-wrapper .progress-circle .progress-val-57{transform:rotate(205.2deg)}.component .progress-circle-wrapper .progress-circle .progress-val-58{transform:rotate(208.8deg)}.component .progress-circle-wrapper .progress-circle .progress-val-59{transform:rotate(212.4deg)}.component .progress-circle-wrapper .progress-circle .progress-val-60{transform:rotate(216deg)}.component .progress-circle-wrapper .progress-circle .progress-val-61{transform:rotate(219.6deg)}.component .progress-circle-wrapper .progress-circle .progress-val-62{transform:rotate(223.2deg)}.component .progress-circle-wrapper .progress-circle .progress-val-63{transform:rotate(226.8deg)}.component .progress-circle-wrapper .progress-circle .progress-val-64{transform:rotate(230.4deg)}.component .progress-circle-wrapper .progress-circle .progress-val-65{transform:rotate(234deg)}.component .progress-circle-wrapper .progress-circle .progress-val-66{transform:rotate(237.6deg)}.component .progress-circle-wrapper .progress-circle .progress-val-67{transform:rotate(241.2deg)}.component .progress-circle-wrapper .progress-circle .progress-val-68{transform:rotate(244.8deg)}.component .progress-circle-wrapper .progress-circle .progress-val-69{transform:rotate(248.4deg)}.component .progress-circle-wrapper .progress-circle .progress-val-70{transform:rotate(252deg)}.component .progress-circle-wrapper .progress-circle .progress-val-71{transform:rotate(255.6deg)}.component .progress-circle-wrapper .progress-circle .progress-val-72{transform:rotate(259.2deg)}.component .progress-circle-wrapper .progress-circle .progress-val-73{transform:rotate(262.8deg)}.component .progress-circle-wrapper .progress-circle .progress-val-74{transform:rotate(266.4deg)}.component .progress-circle-wrapper .progress-circle .progress-val-75{transform:rotate(270deg)}.component .progress-circle-wrapper .progress-circle .progress-val-76{transform:rotate(273.6deg)}.component .progress-circle-wrapper .progress-circle .progress-val-77{transform:rotate(277.2deg)}.component .progress-circle-wrapper .progress-circle .progress-val-78{transform:rotate(280.8deg)}.component .progress-circle-wrapper .progress-circle .progress-val-79{transform:rotate(284.4deg)}.component .progress-circle-wrapper .progress-circle .progress-val-80{transform:rotate(288deg)}.component .progress-circle-wrapper .progress-circle .progress-val-81{transform:rotate(291.6deg)}.component .progress-circle-wrapper .progress-circle .progress-val-82{transform:rotate(295.2deg)}.component .progress-circle-wrapper .progress-circle .progress-val-83{transform:rotate(298.8deg)}.component .progress-circle-wrapper .progress-circle .progress-val-84{transform:rotate(302.4deg)}.component .progress-circle-wrapper .progress-circle .progress-val-85{transform:rotate(306deg)}.component .progress-circle-wrapper .progress-circle .progress-val-86{transform:rotate(309.6deg)}.component .progress-circle-wrapper .progress-circle .progress-val-87{transform:rotate(313.2deg)}.component .progress-circle-wrapper .progress-circle .progress-val-88{transform:rotate(316.8deg)}.component .progress-circle-wrapper .progress-circle .progress-val-89{transform:rotate(320.4deg)}.component .progress-circle-wrapper .progress-circle .progress-val-90{transform:rotate(324deg)}.component .progress-circle-wrapper .progress-circle .progress-val-91{transform:rotate(327.6deg)}.component .progress-circle-wrapper .progress-circle .progress-val-92{transform:rotate(331.2deg)}.component .progress-circle-wrapper .progress-circle .progress-val-93{transform:rotate(334.8deg)}.component .progress-circle-wrapper .progress-circle .progress-val-94{transform:rotate(338.4deg)}.component .progress-circle-wrapper .progress-circle .progress-val-95{transform:rotate(342deg)}.component .progress-circle-wrapper .progress-circle .progress-val-96{transform:rotate(345.6deg)}.component .progress-circle-wrapper .progress-circle .progress-val-97{transform:rotate(349.2deg)}.component .progress-circle-wrapper .progress-circle .progress-val-98{transform:rotate(352.8deg)}.component .progress-circle-wrapper .progress-circle .progress-val-99{transform:rotate(356.4deg)}.component .progress-circle-wrapper .progress-circle .progress-val-100{transform:rotate(360deg)}.component .progress-circle-wrapper .progress-circle .right-full-bar{display:none}.component .progress-circle-wrapper .progress-circle.show-full-right-side .circle-clipper{clip:rect(auto,auto,auto,auto)}.component .progress-circle-wrapper .progress-circle.show-full-right-side .right-full-bar{position:absolute;display:block;clip:rect(0,94px,188px,0);width:188px;height:188px;border-radius:50%;border:15px solid var(--color-primary, #2188d9);box-sizing:border-box;transform:rotate(180deg)}.component .progress-circle-wrapper .text-wrapper{position:absolute;width:188px;height:188px;justify-content:center;z-index:10;display:flex;flex-direction:column;align-items:center}.component .progress-circle-wrapper .text-wrapper .text{font-size:32px;font-style:normal;font-weight:500;color:var(--color-primary, #2188d9)}.component .progress-circle-wrapper .text-wrapper .progress-text{color:var(--color-grey-primary, #4f4f4f);font-size:14px;font-style:normal;font-weight:400}.component .progress-half-circle-wrapper{height:94px;overflow:hidden}.component .progress-half-circle-wrapper .progress-circle{position:relative;width:188px;height:188px;background-color:var(--color-white-tint-2, #ececed);border-radius:50%}.component .progress-half-circle-wrapper .progress-circle .center-pipe{position:absolute;top:15px;left:15px;border-radius:50%;width:160px;height:160px;background-color:#fff}.component .progress-half-circle-wrapper .progress-circle .circle-clipper{border-radius:50%;width:188px;height:188px;position:absolute}.component .progress-half-circle-wrapper .progress-circle .progress-bar-val{position:absolute;clip:rect(0,94px,188px,0);width:188px;height:188px;border-radius:50%;border:15px solid var(--color-primary, #2188d9);box-sizing:border-box}.component .progress-half-circle-wrapper .progress-circle .progress-val-0{transform:rotate(-90deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-1{transform:rotate(-88.2deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-2{transform:rotate(-86.4deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-3{transform:rotate(-84.6deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-4{transform:rotate(-82.8deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-5{transform:rotate(-81deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-6{transform:rotate(-79.2deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-7{transform:rotate(-77.4deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-8{transform:rotate(-75.6deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-9{transform:rotate(-73.8deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-10{transform:rotate(-72deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-11{transform:rotate(-70.2deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-12{transform:rotate(-68.4deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-13{transform:rotate(-66.6deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-14{transform:rotate(-64.8deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-15{transform:rotate(-63deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-16{transform:rotate(-61.2deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-17{transform:rotate(-59.4deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-18{transform:rotate(-57.6deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-19{transform:rotate(-55.8deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-20{transform:rotate(-54deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-21{transform:rotate(-52.2deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-22{transform:rotate(-50.4deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-23{transform:rotate(-48.6deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-24{transform:rotate(-46.8deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-25{transform:rotate(-45deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-26{transform:rotate(-43.2deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-27{transform:rotate(-41.4deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-28{transform:rotate(-39.6deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-29{transform:rotate(-37.8deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-30{transform:rotate(-36deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-31{transform:rotate(-34.2deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-32{transform:rotate(-32.4deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-33{transform:rotate(-30.6deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-34{transform:rotate(-28.8deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-35{transform:rotate(-27deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-36{transform:rotate(-25.2deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-37{transform:rotate(-23.4deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-38{transform:rotate(-21.6deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-39{transform:rotate(-19.8deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-40{transform:rotate(-18deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-41{transform:rotate(-16.2deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-42{transform:rotate(-14.4deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-43{transform:rotate(-12.6deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-44{transform:rotate(-10.8deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-45{transform:rotate(-9deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-46{transform:rotate(-7.2deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-47{transform:rotate(-5.4deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-48{transform:rotate(-3.6deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-49{transform:rotate(-1.8deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-50{transform:rotate(0)}.component .progress-half-circle-wrapper .progress-circle .progress-val-51{transform:rotate(1.8deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-52{transform:rotate(3.6deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-53{transform:rotate(5.4deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-54{transform:rotate(7.2deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-55{transform:rotate(9deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-56{transform:rotate(10.8deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-57{transform:rotate(12.6deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-58{transform:rotate(14.4deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-59{transform:rotate(16.2deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-60{transform:rotate(18deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-61{transform:rotate(19.8deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-62{transform:rotate(21.6deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-63{transform:rotate(23.4deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-64{transform:rotate(25.2deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-65{transform:rotate(27deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-66{transform:rotate(28.8deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-67{transform:rotate(30.6deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-68{transform:rotate(32.4deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-69{transform:rotate(34.2deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-70{transform:rotate(36deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-71{transform:rotate(37.8deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-72{transform:rotate(39.6deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-73{transform:rotate(41.4deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-74{transform:rotate(43.2deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-75{transform:rotate(45deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-76{transform:rotate(46.8deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-77{transform:rotate(48.6deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-78{transform:rotate(50.4deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-79{transform:rotate(52.2deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-80{transform:rotate(54deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-81{transform:rotate(55.8deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-82{transform:rotate(57.6deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-83{transform:rotate(59.4deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-84{transform:rotate(61.2deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-85{transform:rotate(63deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-86{transform:rotate(64.8deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-87{transform:rotate(66.6deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-88{transform:rotate(68.4deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-89{transform:rotate(70.2deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-90{transform:rotate(72deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-91{transform:rotate(73.8deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-92{transform:rotate(75.6deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-93{transform:rotate(77.4deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-94{transform:rotate(79.2deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-95{transform:rotate(81deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-96{transform:rotate(82.8deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-97{transform:rotate(84.6deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-98{transform:rotate(86.4deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-99{transform:rotate(88.2deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-100{transform:rotate(90deg)}.component .progress-half-circle-wrapper .text-wrapper{position:absolute;width:188px;height:94px;justify-content:center;z-index:10;display:flex;flex-direction:column;align-items:center;justify-content:end}.component .progress-half-circle-wrapper .text-wrapper .text{font-size:20px;font-style:normal;font-weight:500;color:var(--color-primary, #2188d9)}.component .progress-half-circle-wrapper .text-wrapper .progress-text{color:var(--color-grey-primary, #4f4f4f);font-size:14px;font-style:normal;font-weight:400}\n"], dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }] });
|
|
3408
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: ZenduProgress, decorators: [{
|
|
3409
|
+
type: Component,
|
|
3410
|
+
args: [{ selector: 'zen-progress', template: "<div class=\"component\">\n <!-- Progres bar -->\n <div *ngIf=\"type == 'bar'\">\n <div class=\"progress-bar\">\n <div class=\"progress-bar-val\"\n [ngStyle]=\"{ 'width': value + '%' }\">\n <span class=\"value-text\">{{value}}%</span>\n </div>\n </div>\n <div class=\"progress-text\">\n {{text}}\n </div>\n </div>\n\n <!-- Circle progress -->\n <div *ngIf=\"type == 'circle'\"\n class=\"progress-circle-wrapper\">\n\n\n <div class=\"progress-circle\"\n [class.show-full-right-side]=\"value>=50\">\n\n <div class=\"center-pipe\"></div>\n\n <div class=\"circle-clipper\">\n <div class=\"right-full-bar progress-val-50\"></div>\n <div class=\"progress-bar-val progress-val-{{value}}\"></div>\n </div>\n <div class=\"text-wrapper\">\n <div class=\"text\"> {{value}}%</div>\n <div class=\"progress-text\">{{text}}</div>\n </div>\n </div>\n </div>\n\n <!-- Half-Circle progress -->\n <div *ngIf=\"type == 'half-circle'\"\n class=\"progress-half-circle-wrapper\">\n\n <div class=\"progress-circle\">\n <div class=\"center-pipe\"></div>\n\n <div class=\"circle-clipper\">\n <div class=\"right-full-bar progress-val-50\"></div>\n <div class=\"progress-bar-val progress-val-{{value}}\"></div>\n </div>\n <div class=\"text-wrapper\">\n <div class=\"text\"> {{value}}%</div>\n <div class=\"progress-text\">{{text}}</div>\n </div>\n </div>\n </div>\n</div>\n", styles: [".component{font-family:Roboto}.component .progress-bar{min-width:100px;width:100%;height:24px;border-radius:4px;background-color:var(--color-white-tint-2, #ececed);overflow:hidden;position:relative}.component .progress-bar .progress-bar-val{height:100%;display:block;width:0;background-color:var(--color-primary, #2188d9);line-height:24px;position:absolute;text-align:end;padding-right:5px;transition:width 1s}.component .progress-bar .progress-bar-val .value-text{color:var(--color-white-primary, #ffffff);font-size:14px;font-style:normal;font-weight:500}.component .progress-text{color:var(--color-white-tint-4, #d6d6d8);overflow:hidden;font-size:14px;font-style:normal;font-weight:400;margin-top:8px}.component .progress-circle-wrapper .progress-circle{position:relative;width:188px;height:188px;background-color:var(--color-white-tint-2, #ececed);border-radius:50%}.component .progress-circle-wrapper .progress-circle .center-pipe{position:absolute;top:15px;left:15px;border-radius:50%;width:160px;height:160px;background-color:#fff}.component .progress-circle-wrapper .progress-circle .circle-clipper{border-radius:50%;width:188px;height:188px;position:absolute;clip:rect(0,188px,188px,94px)}.component .progress-circle-wrapper .progress-circle .progress-bar-val{position:absolute;clip:rect(0,94px,188px,0);width:188px;height:188px;border-radius:50%;border:15px solid var(--color-primary, #2188d9);box-sizing:border-box}.component .progress-circle-wrapper .progress-circle .progress-val-0{transform:rotate(0)}.component .progress-circle-wrapper .progress-circle .progress-val-1{transform:rotate(3.6deg)}.component .progress-circle-wrapper .progress-circle .progress-val-2{transform:rotate(7.2deg)}.component .progress-circle-wrapper .progress-circle .progress-val-3{transform:rotate(10.8deg)}.component .progress-circle-wrapper .progress-circle .progress-val-4{transform:rotate(14.4deg)}.component .progress-circle-wrapper .progress-circle .progress-val-5{transform:rotate(18deg)}.component .progress-circle-wrapper .progress-circle .progress-val-6{transform:rotate(21.6deg)}.component .progress-circle-wrapper .progress-circle .progress-val-7{transform:rotate(25.2deg)}.component .progress-circle-wrapper .progress-circle .progress-val-8{transform:rotate(28.8deg)}.component .progress-circle-wrapper .progress-circle .progress-val-9{transform:rotate(32.4deg)}.component .progress-circle-wrapper .progress-circle .progress-val-10{transform:rotate(36deg)}.component .progress-circle-wrapper .progress-circle .progress-val-11{transform:rotate(39.6deg)}.component .progress-circle-wrapper .progress-circle .progress-val-12{transform:rotate(43.2deg)}.component .progress-circle-wrapper .progress-circle .progress-val-13{transform:rotate(46.8deg)}.component .progress-circle-wrapper .progress-circle .progress-val-14{transform:rotate(50.4deg)}.component .progress-circle-wrapper .progress-circle .progress-val-15{transform:rotate(54deg)}.component .progress-circle-wrapper .progress-circle .progress-val-16{transform:rotate(57.6deg)}.component .progress-circle-wrapper .progress-circle .progress-val-17{transform:rotate(61.2deg)}.component .progress-circle-wrapper .progress-circle .progress-val-18{transform:rotate(64.8deg)}.component .progress-circle-wrapper .progress-circle .progress-val-19{transform:rotate(68.4deg)}.component .progress-circle-wrapper .progress-circle .progress-val-20{transform:rotate(72deg)}.component .progress-circle-wrapper .progress-circle .progress-val-21{transform:rotate(75.6deg)}.component .progress-circle-wrapper .progress-circle .progress-val-22{transform:rotate(79.2deg)}.component .progress-circle-wrapper .progress-circle .progress-val-23{transform:rotate(82.8deg)}.component .progress-circle-wrapper .progress-circle .progress-val-24{transform:rotate(86.4deg)}.component .progress-circle-wrapper .progress-circle .progress-val-25{transform:rotate(90deg)}.component .progress-circle-wrapper .progress-circle .progress-val-26{transform:rotate(93.6deg)}.component .progress-circle-wrapper .progress-circle .progress-val-27{transform:rotate(97.2deg)}.component .progress-circle-wrapper .progress-circle .progress-val-28{transform:rotate(100.8deg)}.component .progress-circle-wrapper .progress-circle .progress-val-29{transform:rotate(104.4deg)}.component .progress-circle-wrapper .progress-circle .progress-val-30{transform:rotate(108deg)}.component .progress-circle-wrapper .progress-circle .progress-val-31{transform:rotate(111.6deg)}.component .progress-circle-wrapper .progress-circle .progress-val-32{transform:rotate(115.2deg)}.component .progress-circle-wrapper .progress-circle .progress-val-33{transform:rotate(118.8deg)}.component .progress-circle-wrapper .progress-circle .progress-val-34{transform:rotate(122.4deg)}.component .progress-circle-wrapper .progress-circle .progress-val-35{transform:rotate(126deg)}.component .progress-circle-wrapper .progress-circle .progress-val-36{transform:rotate(129.6deg)}.component .progress-circle-wrapper .progress-circle .progress-val-37{transform:rotate(133.2deg)}.component .progress-circle-wrapper .progress-circle .progress-val-38{transform:rotate(136.8deg)}.component .progress-circle-wrapper .progress-circle .progress-val-39{transform:rotate(140.4deg)}.component .progress-circle-wrapper .progress-circle .progress-val-40{transform:rotate(144deg)}.component .progress-circle-wrapper .progress-circle .progress-val-41{transform:rotate(147.6deg)}.component .progress-circle-wrapper .progress-circle .progress-val-42{transform:rotate(151.2deg)}.component .progress-circle-wrapper .progress-circle .progress-val-43{transform:rotate(154.8deg)}.component .progress-circle-wrapper .progress-circle .progress-val-44{transform:rotate(158.4deg)}.component .progress-circle-wrapper .progress-circle .progress-val-45{transform:rotate(162deg)}.component .progress-circle-wrapper .progress-circle .progress-val-46{transform:rotate(165.6deg)}.component .progress-circle-wrapper .progress-circle .progress-val-47{transform:rotate(169.2deg)}.component .progress-circle-wrapper .progress-circle .progress-val-48{transform:rotate(172.8deg)}.component .progress-circle-wrapper .progress-circle .progress-val-49{transform:rotate(176.4deg)}.component .progress-circle-wrapper .progress-circle .progress-val-50{transform:rotate(180deg)}.component .progress-circle-wrapper .progress-circle .progress-val-51{transform:rotate(183.6deg)}.component .progress-circle-wrapper .progress-circle .progress-val-52{transform:rotate(187.2deg)}.component .progress-circle-wrapper .progress-circle .progress-val-53{transform:rotate(190.8deg)}.component .progress-circle-wrapper .progress-circle .progress-val-54{transform:rotate(194.4deg)}.component .progress-circle-wrapper .progress-circle .progress-val-55{transform:rotate(198deg)}.component .progress-circle-wrapper .progress-circle .progress-val-56{transform:rotate(201.6deg)}.component .progress-circle-wrapper .progress-circle .progress-val-57{transform:rotate(205.2deg)}.component .progress-circle-wrapper .progress-circle .progress-val-58{transform:rotate(208.8deg)}.component .progress-circle-wrapper .progress-circle .progress-val-59{transform:rotate(212.4deg)}.component .progress-circle-wrapper .progress-circle .progress-val-60{transform:rotate(216deg)}.component .progress-circle-wrapper .progress-circle .progress-val-61{transform:rotate(219.6deg)}.component .progress-circle-wrapper .progress-circle .progress-val-62{transform:rotate(223.2deg)}.component .progress-circle-wrapper .progress-circle .progress-val-63{transform:rotate(226.8deg)}.component .progress-circle-wrapper .progress-circle .progress-val-64{transform:rotate(230.4deg)}.component .progress-circle-wrapper .progress-circle .progress-val-65{transform:rotate(234deg)}.component .progress-circle-wrapper .progress-circle .progress-val-66{transform:rotate(237.6deg)}.component .progress-circle-wrapper .progress-circle .progress-val-67{transform:rotate(241.2deg)}.component .progress-circle-wrapper .progress-circle .progress-val-68{transform:rotate(244.8deg)}.component .progress-circle-wrapper .progress-circle .progress-val-69{transform:rotate(248.4deg)}.component .progress-circle-wrapper .progress-circle .progress-val-70{transform:rotate(252deg)}.component .progress-circle-wrapper .progress-circle .progress-val-71{transform:rotate(255.6deg)}.component .progress-circle-wrapper .progress-circle .progress-val-72{transform:rotate(259.2deg)}.component .progress-circle-wrapper .progress-circle .progress-val-73{transform:rotate(262.8deg)}.component .progress-circle-wrapper .progress-circle .progress-val-74{transform:rotate(266.4deg)}.component .progress-circle-wrapper .progress-circle .progress-val-75{transform:rotate(270deg)}.component .progress-circle-wrapper .progress-circle .progress-val-76{transform:rotate(273.6deg)}.component .progress-circle-wrapper .progress-circle .progress-val-77{transform:rotate(277.2deg)}.component .progress-circle-wrapper .progress-circle .progress-val-78{transform:rotate(280.8deg)}.component .progress-circle-wrapper .progress-circle .progress-val-79{transform:rotate(284.4deg)}.component .progress-circle-wrapper .progress-circle .progress-val-80{transform:rotate(288deg)}.component .progress-circle-wrapper .progress-circle .progress-val-81{transform:rotate(291.6deg)}.component .progress-circle-wrapper .progress-circle .progress-val-82{transform:rotate(295.2deg)}.component .progress-circle-wrapper .progress-circle .progress-val-83{transform:rotate(298.8deg)}.component .progress-circle-wrapper .progress-circle .progress-val-84{transform:rotate(302.4deg)}.component .progress-circle-wrapper .progress-circle .progress-val-85{transform:rotate(306deg)}.component .progress-circle-wrapper .progress-circle .progress-val-86{transform:rotate(309.6deg)}.component .progress-circle-wrapper .progress-circle .progress-val-87{transform:rotate(313.2deg)}.component .progress-circle-wrapper .progress-circle .progress-val-88{transform:rotate(316.8deg)}.component .progress-circle-wrapper .progress-circle .progress-val-89{transform:rotate(320.4deg)}.component .progress-circle-wrapper .progress-circle .progress-val-90{transform:rotate(324deg)}.component .progress-circle-wrapper .progress-circle .progress-val-91{transform:rotate(327.6deg)}.component .progress-circle-wrapper .progress-circle .progress-val-92{transform:rotate(331.2deg)}.component .progress-circle-wrapper .progress-circle .progress-val-93{transform:rotate(334.8deg)}.component .progress-circle-wrapper .progress-circle .progress-val-94{transform:rotate(338.4deg)}.component .progress-circle-wrapper .progress-circle .progress-val-95{transform:rotate(342deg)}.component .progress-circle-wrapper .progress-circle .progress-val-96{transform:rotate(345.6deg)}.component .progress-circle-wrapper .progress-circle .progress-val-97{transform:rotate(349.2deg)}.component .progress-circle-wrapper .progress-circle .progress-val-98{transform:rotate(352.8deg)}.component .progress-circle-wrapper .progress-circle .progress-val-99{transform:rotate(356.4deg)}.component .progress-circle-wrapper .progress-circle .progress-val-100{transform:rotate(360deg)}.component .progress-circle-wrapper .progress-circle .right-full-bar{display:none}.component .progress-circle-wrapper .progress-circle.show-full-right-side .circle-clipper{clip:rect(auto,auto,auto,auto)}.component .progress-circle-wrapper .progress-circle.show-full-right-side .right-full-bar{position:absolute;display:block;clip:rect(0,94px,188px,0);width:188px;height:188px;border-radius:50%;border:15px solid var(--color-primary, #2188d9);box-sizing:border-box;transform:rotate(180deg)}.component .progress-circle-wrapper .text-wrapper{position:absolute;width:188px;height:188px;justify-content:center;z-index:10;display:flex;flex-direction:column;align-items:center}.component .progress-circle-wrapper .text-wrapper .text{font-size:32px;font-style:normal;font-weight:500;color:var(--color-primary, #2188d9)}.component .progress-circle-wrapper .text-wrapper .progress-text{color:var(--color-grey-primary, #4f4f4f);font-size:14px;font-style:normal;font-weight:400}.component .progress-half-circle-wrapper{height:94px;overflow:hidden}.component .progress-half-circle-wrapper .progress-circle{position:relative;width:188px;height:188px;background-color:var(--color-white-tint-2, #ececed);border-radius:50%}.component .progress-half-circle-wrapper .progress-circle .center-pipe{position:absolute;top:15px;left:15px;border-radius:50%;width:160px;height:160px;background-color:#fff}.component .progress-half-circle-wrapper .progress-circle .circle-clipper{border-radius:50%;width:188px;height:188px;position:absolute}.component .progress-half-circle-wrapper .progress-circle .progress-bar-val{position:absolute;clip:rect(0,94px,188px,0);width:188px;height:188px;border-radius:50%;border:15px solid var(--color-primary, #2188d9);box-sizing:border-box}.component .progress-half-circle-wrapper .progress-circle .progress-val-0{transform:rotate(-90deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-1{transform:rotate(-88.2deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-2{transform:rotate(-86.4deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-3{transform:rotate(-84.6deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-4{transform:rotate(-82.8deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-5{transform:rotate(-81deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-6{transform:rotate(-79.2deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-7{transform:rotate(-77.4deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-8{transform:rotate(-75.6deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-9{transform:rotate(-73.8deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-10{transform:rotate(-72deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-11{transform:rotate(-70.2deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-12{transform:rotate(-68.4deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-13{transform:rotate(-66.6deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-14{transform:rotate(-64.8deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-15{transform:rotate(-63deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-16{transform:rotate(-61.2deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-17{transform:rotate(-59.4deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-18{transform:rotate(-57.6deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-19{transform:rotate(-55.8deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-20{transform:rotate(-54deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-21{transform:rotate(-52.2deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-22{transform:rotate(-50.4deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-23{transform:rotate(-48.6deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-24{transform:rotate(-46.8deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-25{transform:rotate(-45deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-26{transform:rotate(-43.2deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-27{transform:rotate(-41.4deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-28{transform:rotate(-39.6deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-29{transform:rotate(-37.8deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-30{transform:rotate(-36deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-31{transform:rotate(-34.2deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-32{transform:rotate(-32.4deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-33{transform:rotate(-30.6deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-34{transform:rotate(-28.8deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-35{transform:rotate(-27deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-36{transform:rotate(-25.2deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-37{transform:rotate(-23.4deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-38{transform:rotate(-21.6deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-39{transform:rotate(-19.8deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-40{transform:rotate(-18deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-41{transform:rotate(-16.2deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-42{transform:rotate(-14.4deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-43{transform:rotate(-12.6deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-44{transform:rotate(-10.8deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-45{transform:rotate(-9deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-46{transform:rotate(-7.2deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-47{transform:rotate(-5.4deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-48{transform:rotate(-3.6deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-49{transform:rotate(-1.8deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-50{transform:rotate(0)}.component .progress-half-circle-wrapper .progress-circle .progress-val-51{transform:rotate(1.8deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-52{transform:rotate(3.6deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-53{transform:rotate(5.4deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-54{transform:rotate(7.2deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-55{transform:rotate(9deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-56{transform:rotate(10.8deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-57{transform:rotate(12.6deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-58{transform:rotate(14.4deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-59{transform:rotate(16.2deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-60{transform:rotate(18deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-61{transform:rotate(19.8deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-62{transform:rotate(21.6deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-63{transform:rotate(23.4deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-64{transform:rotate(25.2deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-65{transform:rotate(27deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-66{transform:rotate(28.8deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-67{transform:rotate(30.6deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-68{transform:rotate(32.4deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-69{transform:rotate(34.2deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-70{transform:rotate(36deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-71{transform:rotate(37.8deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-72{transform:rotate(39.6deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-73{transform:rotate(41.4deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-74{transform:rotate(43.2deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-75{transform:rotate(45deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-76{transform:rotate(46.8deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-77{transform:rotate(48.6deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-78{transform:rotate(50.4deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-79{transform:rotate(52.2deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-80{transform:rotate(54deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-81{transform:rotate(55.8deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-82{transform:rotate(57.6deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-83{transform:rotate(59.4deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-84{transform:rotate(61.2deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-85{transform:rotate(63deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-86{transform:rotate(64.8deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-87{transform:rotate(66.6deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-88{transform:rotate(68.4deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-89{transform:rotate(70.2deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-90{transform:rotate(72deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-91{transform:rotate(73.8deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-92{transform:rotate(75.6deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-93{transform:rotate(77.4deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-94{transform:rotate(79.2deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-95{transform:rotate(81deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-96{transform:rotate(82.8deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-97{transform:rotate(84.6deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-98{transform:rotate(86.4deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-99{transform:rotate(88.2deg)}.component .progress-half-circle-wrapper .progress-circle .progress-val-100{transform:rotate(90deg)}.component .progress-half-circle-wrapper .text-wrapper{position:absolute;width:188px;height:94px;justify-content:center;z-index:10;display:flex;flex-direction:column;align-items:center;justify-content:end}.component .progress-half-circle-wrapper .text-wrapper .text{font-size:20px;font-style:normal;font-weight:500;color:var(--color-primary, #2188d9)}.component .progress-half-circle-wrapper .text-wrapper .progress-text{color:var(--color-grey-primary, #4f4f4f);font-size:14px;font-style:normal;font-weight:400}\n"] }]
|
|
3411
|
+
}], propDecorators: { type: [{
|
|
3412
|
+
type: Input
|
|
3413
|
+
}], value: [{
|
|
3414
|
+
type: Input
|
|
3415
|
+
}], text: [{
|
|
3416
|
+
type: Input
|
|
3417
|
+
}] } });
|
|
3418
|
+
|
|
3419
|
+
class GeocodingService {
|
|
3420
|
+
setAPIKey(apiKey) {
|
|
3421
|
+
this._platform = new H.service.Platform({
|
|
3422
|
+
apikey: apiKey
|
|
3423
|
+
});
|
|
3424
|
+
}
|
|
3425
|
+
async geocode(searchText) {
|
|
3426
|
+
return new Promise((resolve, reject) => {
|
|
3427
|
+
if (!this._platform) {
|
|
3428
|
+
reject("API KEY NOT SET");
|
|
3429
|
+
return;
|
|
3430
|
+
}
|
|
3431
|
+
const geocoder = this._platform.getGeocodingService();
|
|
3432
|
+
geocoder.geocode({ searchText: searchText }, (res) => {
|
|
3433
|
+
let locations = res.Response.View[0] ? res.Response.View[0].Result : [];
|
|
3434
|
+
let outItems = new Array();
|
|
3435
|
+
let boxOffset = 0.001;
|
|
3436
|
+
for (let location of locations) {
|
|
3437
|
+
let lat = location.Location.DisplayPosition.Latitude;
|
|
3438
|
+
let lng = location.Location.DisplayPosition.Longitude;
|
|
3439
|
+
let p1 = new H.geo.Point(lat - boxOffset, lng - boxOffset);
|
|
3440
|
+
let p2 = new H.geo.Point(lat + boxOffset, lng + boxOffset);
|
|
3441
|
+
let bounds = H.geo.Rect.coverPoints([p1, p2]);
|
|
3442
|
+
let street = location.Location.Address.Street;
|
|
3443
|
+
if (location.Location.Address.HouseNumber) {
|
|
3444
|
+
street += " " + location.Location.Address.HouseNumber;
|
|
3445
|
+
}
|
|
3446
|
+
outItems.push({
|
|
3447
|
+
name: location.Location.Address.Label,
|
|
3448
|
+
city: location.Location.Address.City,
|
|
3449
|
+
country: location.Location.Address.Country,
|
|
3450
|
+
postalCode: location.Location.Address.PostalCode,
|
|
3451
|
+
state: location.Location.Address.State,
|
|
3452
|
+
street: street,
|
|
3453
|
+
bounds: {
|
|
3454
|
+
xmin: bounds.getLeft(),
|
|
3455
|
+
xmax: bounds.getRight(),
|
|
3456
|
+
ymin: Math.min(bounds.getBottom(), bounds.getTop()),
|
|
3457
|
+
ymax: Math.max(bounds.getBottom(), bounds.getTop())
|
|
3458
|
+
}
|
|
3459
|
+
});
|
|
3460
|
+
}
|
|
3461
|
+
resolve(outItems);
|
|
3462
|
+
}, (e) => {
|
|
3463
|
+
console.warn(e);
|
|
3464
|
+
resolve([]);
|
|
3465
|
+
});
|
|
3466
|
+
});
|
|
3467
|
+
}
|
|
3468
|
+
}
|
|
3469
|
+
GeocodingService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: GeocodingService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
3470
|
+
GeocodingService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: GeocodingService, providedIn: 'root' });
|
|
3471
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: GeocodingService, decorators: [{
|
|
3472
|
+
type: Injectable,
|
|
3473
|
+
args: [{
|
|
3474
|
+
providedIn: 'root'
|
|
3475
|
+
}]
|
|
3476
|
+
}] });
|
|
3477
|
+
|
|
3478
|
+
class ZenduLocationSearch {
|
|
3479
|
+
constructor(_geocoding, _cdRef) {
|
|
3480
|
+
this._geocoding = _geocoding;
|
|
3481
|
+
this._cdRef = _cdRef;
|
|
3482
|
+
this.displaySearchIcon = true;
|
|
3483
|
+
this.addressChange = new EventEmitter();
|
|
3484
|
+
this.materialStyle = true;
|
|
3485
|
+
this.placeholder = "Search address";
|
|
3486
|
+
this.disabled = false;
|
|
3487
|
+
this.onSelect = new EventEmitter;
|
|
3488
|
+
// it will apply to input element text and icon color:
|
|
3489
|
+
// ie. input like { color: blue}
|
|
3490
|
+
this.customStyles = {};
|
|
3491
|
+
this.addressSearchChanged = new Subject();
|
|
3492
|
+
this.isSearching = false;
|
|
3493
|
+
this.ignoreFirstLoad = false;
|
|
3494
|
+
this.addressList = [];
|
|
3495
|
+
this.addressSearchChanged
|
|
3496
|
+
.pipe(debounceTime(200), distinctUntilChanged())
|
|
3497
|
+
.subscribe((addressSearch) => {
|
|
3498
|
+
this.address = addressSearch;
|
|
3499
|
+
this.isSearching = true;
|
|
3500
|
+
if (this._cancelation) {
|
|
3501
|
+
// cancel previous
|
|
3502
|
+
this._cancelation.cancelled = true;
|
|
3503
|
+
}
|
|
3504
|
+
this._cancelation = { cancelled: false };
|
|
3505
|
+
this.makeSearch(this._cancelation);
|
|
3506
|
+
});
|
|
3507
|
+
}
|
|
3508
|
+
/**
|
|
3509
|
+
* HERE MAPS API Key
|
|
3510
|
+
*/
|
|
3511
|
+
set apiKey(apiKey) {
|
|
3512
|
+
this._geocoding.setAPIKey(apiKey);
|
|
3513
|
+
}
|
|
3514
|
+
async ngOnChanges(changes) {
|
|
3515
|
+
if (changes['address'] && this.address) {
|
|
3516
|
+
this._cancelation = { cancelled: false };
|
|
3517
|
+
await this.makeSearch(this._cancelation);
|
|
3518
|
+
const address = this.addressList.find(addr => addr.name === this.address);
|
|
3519
|
+
if (address) {
|
|
3520
|
+
this.selectAddress(address);
|
|
3521
|
+
}
|
|
3522
|
+
}
|
|
3523
|
+
}
|
|
3524
|
+
addressChanged(text) {
|
|
3525
|
+
this.isSearching = true;
|
|
3526
|
+
this.addressChange.emit(text);
|
|
3527
|
+
this.addressSearchChanged.next(text);
|
|
3528
|
+
this._cdRef.detectChanges();
|
|
3529
|
+
}
|
|
3530
|
+
async makeSearch(cancellation) {
|
|
3531
|
+
try {
|
|
3532
|
+
if (!this.ignoreFirstLoad) {
|
|
3533
|
+
this.ignoreFirstLoad = true;
|
|
3534
|
+
return;
|
|
3535
|
+
}
|
|
3536
|
+
this.addressList = [];
|
|
3537
|
+
if (!this.address) {
|
|
3538
|
+
this.isSearching = false;
|
|
3539
|
+
return;
|
|
3540
|
+
}
|
|
3541
|
+
this.addressList = [];
|
|
3542
|
+
let locations = await this._geocoding.geocode(this.address);
|
|
3543
|
+
if (this._cancelation.cancelled) {
|
|
3544
|
+
// request cancelled
|
|
3545
|
+
return;
|
|
3546
|
+
}
|
|
3547
|
+
for (let location of locations) {
|
|
3548
|
+
this.addressList.push({
|
|
3549
|
+
name: location.name,
|
|
3550
|
+
bounds: location.bounds
|
|
3551
|
+
});
|
|
3552
|
+
}
|
|
3553
|
+
this.addressList = [...new Map(this.addressList.map((item) => [item.name, item])).values()];
|
|
3554
|
+
if (this.addressList.length > 20) {
|
|
3555
|
+
this.addressList = this.addressList.slice(0, 20);
|
|
3556
|
+
}
|
|
3557
|
+
this.isSearching = false;
|
|
3558
|
+
}
|
|
3559
|
+
catch (err) {
|
|
3560
|
+
console.error(err);
|
|
3561
|
+
}
|
|
3562
|
+
finally {
|
|
3563
|
+
this._cdRef.detectChanges();
|
|
3564
|
+
}
|
|
3565
|
+
}
|
|
3566
|
+
selectAddress(address) {
|
|
3567
|
+
this.address = address.name;
|
|
3568
|
+
if (this.onSelect) {
|
|
3569
|
+
this.addressList = [];
|
|
3570
|
+
this.onSelect.emit(address);
|
|
3571
|
+
}
|
|
3572
|
+
}
|
|
3573
|
+
}
|
|
3574
|
+
ZenduLocationSearch.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: ZenduLocationSearch, deps: [{ token: GeocodingService }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
3575
|
+
ZenduLocationSearch.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.12", type: ZenduLocationSearch, selector: "zen-location-search", inputs: { apiKey: "apiKey", address: "address", displaySearchIcon: "displaySearchIcon", materialStyle: "materialStyle", placeholder: "placeholder", disabled: "disabled", customStyles: "customStyles" }, outputs: { addressChange: "addressChange", onSelect: "onSelect" }, usesOnChanges: true, ngImport: i0, template: "<div class=\"component\">\n\n <div class=\"search-input-wrapper\"\n [class.boundaries]=\"!materialStyle\">\n <zen-icon src=\"https://storage.googleapis.com/ng-zenduit/icon/search.svg\"\n class=\"search-icon\"\n *ngIf=\"displaySearchIcon\"\n [style]=\"{'background-color': customStyles.color}\"></zen-icon>\n\n <input type=\"text\"\n class=\"material-input\"\n [style]=\"customStyles\"\n [placeholder]=\"placeholder\"\n [disabled]=\"disabled\"\n [(ngModel)]=\"address\"\n [ngClass]=\"{'no-icon': !displaySearchIcon}\"\n (ngModelChange)='addressChanged($event)'>\n </div>\n\n <div class=\"search-list\"\n [class.boundaries]=\"!materialStyle\"\n *ngIf=\"address\"\n appClickOutside\n (clickOutside)=\"addressList = [];\">\n <ul class=\"search-item-list\"\n *ngIf=\"addressList.length || isSearching\">\n <li *ngIf=\"isSearching\">Searching</li>\n <div *ngIf=\"!isSearching\">\n <li *ngFor=\"let address of addressList\"\n (click)=\"selectAddress(address)\">\n {{address.name}}\n </li>\n </div>\n </ul>\n </div>\n</div>\n", styles: [".component,.component .search-input-wrapper{position:relative}.component .search-input-wrapper .search-icon{position:absolute;left:4px;background-color:var(--color-white-tint-6, #bebebe)}.component .search-input-wrapper .material-input{padding-left:38px}.component .search-input-wrapper .material-input.no-icon{padding-left:8px}.component .search-input-wrapper .material-input.no-icon::placeholder{font-size:14px}.component .search-input-wrapper.boundaries .material-input{border:1px solid var(--color-white-tint-4, #d6d6d8);padding-top:8px;border-radius:4px;height:40px;font-style:normal;font-weight:400;font-size:14px;line-height:130%;color:var(--color-grey-primary, #4f4f4f)}.component .search-input-wrapper.boundaries .material-input:hover{border-color:#b8b9bc}.component .search-input-wrapper.boundaries .material-input:focus-within{box-shadow:0 0 2px 2px #2188d94d}.component .search-input-wrapper.boundaries .search-icon{top:8px;left:8px}.component .search-list{position:absolute;top:40px;left:16px;z-index:1;min-width:278px;max-width:420px;box-shadow:0 4px 10px #060c1b26;background:white}.component .search-list.boundaries{top:45px}.component .search-list ul.search-item-list{list-style-type:none;max-width:420px;max-height:30vh;overflow-y:scroll;overflow-x:inherit;margin:0;padding:5px 10px}.component .search-list ul.search-item-list li{background-color:#fff;padding:5px 10px;align-items:flex-start;color:#828282;cursor:pointer;width:100%;font-family:Roboto;font-style:normal;font-weight:400;font-size:14px}.component .search-list ul.search-item-list li:hover{text-decoration:none;background-color:#f5f5f5}\n"], dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { 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.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: ZenduIconComponent, selector: "zen-icon", inputs: ["src"] }] });
|
|
3576
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: ZenduLocationSearch, decorators: [{
|
|
3577
|
+
type: Component,
|
|
3578
|
+
args: [{ selector: 'zen-location-search', template: "<div class=\"component\">\n\n <div class=\"search-input-wrapper\"\n [class.boundaries]=\"!materialStyle\">\n <zen-icon src=\"https://storage.googleapis.com/ng-zenduit/icon/search.svg\"\n class=\"search-icon\"\n *ngIf=\"displaySearchIcon\"\n [style]=\"{'background-color': customStyles.color}\"></zen-icon>\n\n <input type=\"text\"\n class=\"material-input\"\n [style]=\"customStyles\"\n [placeholder]=\"placeholder\"\n [disabled]=\"disabled\"\n [(ngModel)]=\"address\"\n [ngClass]=\"{'no-icon': !displaySearchIcon}\"\n (ngModelChange)='addressChanged($event)'>\n </div>\n\n <div class=\"search-list\"\n [class.boundaries]=\"!materialStyle\"\n *ngIf=\"address\"\n appClickOutside\n (clickOutside)=\"addressList = [];\">\n <ul class=\"search-item-list\"\n *ngIf=\"addressList.length || isSearching\">\n <li *ngIf=\"isSearching\">Searching</li>\n <div *ngIf=\"!isSearching\">\n <li *ngFor=\"let address of addressList\"\n (click)=\"selectAddress(address)\">\n {{address.name}}\n </li>\n </div>\n </ul>\n </div>\n</div>\n", styles: [".component,.component .search-input-wrapper{position:relative}.component .search-input-wrapper .search-icon{position:absolute;left:4px;background-color:var(--color-white-tint-6, #bebebe)}.component .search-input-wrapper .material-input{padding-left:38px}.component .search-input-wrapper .material-input.no-icon{padding-left:8px}.component .search-input-wrapper .material-input.no-icon::placeholder{font-size:14px}.component .search-input-wrapper.boundaries .material-input{border:1px solid var(--color-white-tint-4, #d6d6d8);padding-top:8px;border-radius:4px;height:40px;font-style:normal;font-weight:400;font-size:14px;line-height:130%;color:var(--color-grey-primary, #4f4f4f)}.component .search-input-wrapper.boundaries .material-input:hover{border-color:#b8b9bc}.component .search-input-wrapper.boundaries .material-input:focus-within{box-shadow:0 0 2px 2px #2188d94d}.component .search-input-wrapper.boundaries .search-icon{top:8px;left:8px}.component .search-list{position:absolute;top:40px;left:16px;z-index:1;min-width:278px;max-width:420px;box-shadow:0 4px 10px #060c1b26;background:white}.component .search-list.boundaries{top:45px}.component .search-list ul.search-item-list{list-style-type:none;max-width:420px;max-height:30vh;overflow-y:scroll;overflow-x:inherit;margin:0;padding:5px 10px}.component .search-list ul.search-item-list li{background-color:#fff;padding:5px 10px;align-items:flex-start;color:#828282;cursor:pointer;width:100%;font-family:Roboto;font-style:normal;font-weight:400;font-size:14px}.component .search-list ul.search-item-list li:hover{text-decoration:none;background-color:#f5f5f5}\n"] }]
|
|
3579
|
+
}], ctorParameters: function () { return [{ type: GeocodingService }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { apiKey: [{
|
|
3580
|
+
type: Input
|
|
3581
|
+
}], address: [{
|
|
3582
|
+
type: Input
|
|
3583
|
+
}], displaySearchIcon: [{
|
|
3584
|
+
type: Input
|
|
3585
|
+
}], addressChange: [{
|
|
3586
|
+
type: Output
|
|
3587
|
+
}], materialStyle: [{
|
|
3588
|
+
type: Input
|
|
3589
|
+
}], placeholder: [{
|
|
3590
|
+
type: Input
|
|
3591
|
+
}], disabled: [{
|
|
3592
|
+
type: Input
|
|
3593
|
+
}], onSelect: [{
|
|
3594
|
+
type: Output
|
|
3595
|
+
}], customStyles: [{
|
|
3596
|
+
type: Input
|
|
3597
|
+
}] } });
|
|
3598
|
+
|
|
3599
|
+
class NgZenduitModule {
|
|
3600
|
+
}
|
|
3601
|
+
NgZenduitModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: NgZenduitModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
3602
|
+
NgZenduitModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.2.12", ngImport: i0, type: NgZenduitModule, declarations: [ZenduCheckboxComponent,
|
|
3603
|
+
ZenduToggleComponent,
|
|
3604
|
+
ZenduToggleSlideComponent,
|
|
3605
|
+
ZenduSearchBoxComponent,
|
|
3606
|
+
ZenduSelectComponent,
|
|
3607
|
+
ZenduSelectOptionDirective,
|
|
3608
|
+
ZenduSelectValueDirective,
|
|
3609
|
+
ZenduDatepickerComponent,
|
|
3610
|
+
ZenduFilterComponent,
|
|
3611
|
+
ZenduPaginationBarComponent,
|
|
3612
|
+
ZenduColumnConfigurationComponent,
|
|
3613
|
+
ZenduSortHeaderComponent,
|
|
3614
|
+
ZenduPhoneInputComponent,
|
|
3615
|
+
ZenduColorPickerComponent,
|
|
3616
|
+
ZenduRadioButtonComponent,
|
|
3617
|
+
ZenduIconComponent,
|
|
3618
|
+
ZenduCardBlockComponent,
|
|
3619
|
+
ZenduMapPreviewComponent,
|
|
3620
|
+
ZenduSpinner,
|
|
3621
|
+
ZenduDocScanner,
|
|
3622
|
+
ZenduBreadcrumbs,
|
|
3623
|
+
ZenduMapComponent,
|
|
3624
|
+
ZenduFileUpload,
|
|
3625
|
+
ZenduProgress,
|
|
3626
|
+
ZenduLocationSearch], imports: [CommonModule,
|
|
3627
|
+
FormsModule,
|
|
3628
|
+
DragDropModule], exports: [ZenduCheckboxComponent,
|
|
3629
|
+
ZenduToggleComponent,
|
|
3630
|
+
ZenduToggleSlideComponent,
|
|
3631
|
+
ZenduSearchBoxComponent,
|
|
3632
|
+
ZenduSelectComponent,
|
|
3633
|
+
ZenduSelectOptionDirective,
|
|
3634
|
+
ZenduSelectValueDirective,
|
|
3635
|
+
ZenduDatepickerComponent,
|
|
3636
|
+
ZenduFilterComponent,
|
|
3637
|
+
ZenduPaginationBarComponent,
|
|
3638
|
+
ZenduColumnConfigurationComponent,
|
|
3639
|
+
ZenduSortHeaderComponent,
|
|
3640
|
+
ZenduPhoneInputComponent,
|
|
3641
|
+
ZenduColorPickerComponent,
|
|
3642
|
+
ZenduRadioButtonComponent,
|
|
3643
|
+
ZenduIconComponent,
|
|
3644
|
+
ZenduCardBlockComponent,
|
|
3645
|
+
ZenduMapPreviewComponent,
|
|
3646
|
+
ZenduSpinner,
|
|
3647
|
+
ZenduDocScanner,
|
|
3648
|
+
ZenduBreadcrumbs,
|
|
3649
|
+
ZenduMapComponent,
|
|
3650
|
+
ZenduFileUpload,
|
|
3651
|
+
ZenduProgress,
|
|
3652
|
+
ZenduLocationSearch] });
|
|
3653
|
+
NgZenduitModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: NgZenduitModule, providers: [
|
|
3654
|
+
OpenCVService
|
|
3655
|
+
], imports: [CommonModule,
|
|
3656
|
+
FormsModule,
|
|
3657
|
+
DragDropModule] });
|
|
3658
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: NgZenduitModule, decorators: [{
|
|
3659
|
+
type: NgModule,
|
|
3660
|
+
args: [{
|
|
3661
|
+
declarations: [
|
|
3662
|
+
ZenduCheckboxComponent,
|
|
3663
|
+
ZenduToggleComponent,
|
|
3664
|
+
ZenduToggleSlideComponent,
|
|
3665
|
+
ZenduSearchBoxComponent,
|
|
3666
|
+
ZenduSelectComponent,
|
|
3667
|
+
ZenduSelectOptionDirective,
|
|
3668
|
+
ZenduSelectValueDirective,
|
|
3669
|
+
ZenduDatepickerComponent,
|
|
3670
|
+
ZenduFilterComponent,
|
|
3671
|
+
ZenduPaginationBarComponent,
|
|
3672
|
+
ZenduColumnConfigurationComponent,
|
|
3673
|
+
ZenduSortHeaderComponent,
|
|
3674
|
+
ZenduPhoneInputComponent,
|
|
3675
|
+
ZenduColorPickerComponent,
|
|
3676
|
+
ZenduRadioButtonComponent,
|
|
3677
|
+
ZenduIconComponent,
|
|
3678
|
+
ZenduCardBlockComponent,
|
|
3679
|
+
ZenduMapPreviewComponent,
|
|
3680
|
+
ZenduSpinner,
|
|
3681
|
+
ZenduDocScanner,
|
|
3682
|
+
ZenduBreadcrumbs,
|
|
3683
|
+
ZenduMapComponent,
|
|
3684
|
+
ZenduFileUpload,
|
|
3685
|
+
ZenduProgress,
|
|
3686
|
+
ZenduLocationSearch
|
|
3687
|
+
],
|
|
3688
|
+
providers: [
|
|
3689
|
+
OpenCVService
|
|
3690
|
+
],
|
|
3691
|
+
imports: [
|
|
3692
|
+
CommonModule,
|
|
3693
|
+
FormsModule,
|
|
3694
|
+
DragDropModule
|
|
3695
|
+
],
|
|
3696
|
+
exports: [
|
|
3697
|
+
ZenduCheckboxComponent,
|
|
3698
|
+
ZenduToggleComponent,
|
|
3699
|
+
ZenduToggleSlideComponent,
|
|
3700
|
+
ZenduSearchBoxComponent,
|
|
3701
|
+
ZenduSelectComponent,
|
|
3702
|
+
ZenduSelectOptionDirective,
|
|
3703
|
+
ZenduSelectValueDirective,
|
|
3704
|
+
ZenduDatepickerComponent,
|
|
3705
|
+
ZenduFilterComponent,
|
|
3706
|
+
ZenduPaginationBarComponent,
|
|
3707
|
+
ZenduColumnConfigurationComponent,
|
|
3708
|
+
ZenduSortHeaderComponent,
|
|
3709
|
+
ZenduPhoneInputComponent,
|
|
3710
|
+
ZenduColorPickerComponent,
|
|
3711
|
+
ZenduRadioButtonComponent,
|
|
3712
|
+
ZenduIconComponent,
|
|
3713
|
+
ZenduCardBlockComponent,
|
|
3714
|
+
ZenduMapPreviewComponent,
|
|
3715
|
+
ZenduSpinner,
|
|
3716
|
+
ZenduDocScanner,
|
|
3717
|
+
ZenduBreadcrumbs,
|
|
3718
|
+
ZenduMapComponent,
|
|
3719
|
+
ZenduFileUpload,
|
|
3720
|
+
ZenduProgress,
|
|
3721
|
+
ZenduLocationSearch
|
|
3722
|
+
]
|
|
3723
|
+
}]
|
|
3724
|
+
}] });
|
|
3725
|
+
|
|
3726
|
+
/*
|
|
3727
|
+
* Public API of ng-zenduit
|
|
3728
|
+
*/
|
|
3729
|
+
|
|
3730
|
+
/**
|
|
3731
|
+
* Generated bundle index. Do not edit.
|
|
3732
|
+
*/
|
|
3733
|
+
|
|
3734
|
+
export { DATEPICKER_POSITION, NgZenduitModule, ZenNotifyService, ZenduBreadcrumbs, ZenduCardBlockComponent, ZenduCheckboxComponent, ZenduColorPickerComponent, ZenduColumnConfigurationComponent, ZenduDatepickerComponent, ZenduDocScanner, ZenduFileUpload, ZenduFilterComponent, ZenduIconComponent, ZenduLocationSearch, ZenduMapComponent, ZenduMapPreviewComponent, ZenduPaginationBarComponent, ZenduPhoneInputComponent, ZenduProgress, ZenduRadioButtonComponent, ZenduSearchBoxComponent, ZenduSelectComponent, ZenduSelectOptionDirective, ZenduSelectValueDirective, ZenduSortHeaderComponent, ZenduSpinner, ZenduToggleComponent, ZenduToggleSlideComponent };
|
|
3735
|
+
//# sourceMappingURL=ng-zenduit.mjs.map
|