intelica-library-components 1.1.4 → 1.1.13
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.
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { inject, Injectable, signal, Pipe, Component, HostListener, Directive, EventEmitter, Output, Input, forwardRef, TemplateRef, ContentChild, ContentChildren, ViewChild, PLATFORM_ID, Inject, Optional, Host } from '@angular/core';
|
|
2
|
+
import { inject, Injectable, signal, Pipe, Component, HostListener, Directive, EventEmitter, Output, Input, forwardRef, TemplateRef, ContentChild, ContentChildren, ViewChild, PLATFORM_ID, Inject, output, Optional, Host } from '@angular/core';
|
|
3
3
|
import { getCookie, Cookies, setCookie } from 'typescript-cookie';
|
|
4
4
|
import { HttpClient, HttpHeaders } from '@angular/common/http';
|
|
5
|
-
import { BehaviorSubject, catchError, throwError, from, switchMap, Subject, Subscription, of, tap, map } from 'rxjs';
|
|
5
|
+
import { BehaviorSubject, catchError, throwError, from, switchMap, Subject, Subscription, of, delay, tap, map } from 'rxjs';
|
|
6
6
|
import Swal from 'sweetalert2';
|
|
7
7
|
import * as i1 from '@angular/common';
|
|
8
|
-
import { CommonModule, DatePipe, isPlatformBrowser } from '@angular/common';
|
|
8
|
+
import { CommonModule, DatePipe, isPlatformBrowser, NgClass } from '@angular/common';
|
|
9
9
|
import * as i1$1 from '@angular/forms';
|
|
10
10
|
import { FormsModule, FormBuilder, ReactiveFormsModule, NG_VALUE_ACCESSOR } from '@angular/forms';
|
|
11
11
|
import { BadgeModule } from 'primeng/badge';
|
|
@@ -18,7 +18,7 @@ import { TooltipModule } from 'primeng/tooltip';
|
|
|
18
18
|
import moment from 'moment';
|
|
19
19
|
import * as _ from 'lodash';
|
|
20
20
|
import * as i2 from 'primeng/button';
|
|
21
|
-
import { ButtonModule } from 'primeng/button';
|
|
21
|
+
import { ButtonModule, Button } from 'primeng/button';
|
|
22
22
|
import * as i3 from 'primeng/radiobutton';
|
|
23
23
|
import { RadioButtonModule } from 'primeng/radiobutton';
|
|
24
24
|
import * as i1$2 from 'primeng/popover';
|
|
@@ -28,11 +28,12 @@ import { InputText, InputTextModule } from 'primeng/inputtext';
|
|
|
28
28
|
import * as i6 from 'primeng/select';
|
|
29
29
|
import { Select, SelectModule } from 'primeng/select';
|
|
30
30
|
import * as i3$1 from 'primeng/api';
|
|
31
|
+
import { ConfirmationService } from 'primeng/api';
|
|
31
32
|
import { InputGroupAddonModule } from 'primeng/inputgroupaddon';
|
|
32
33
|
import * as i3$2 from 'primeng/ripple';
|
|
33
34
|
import { RippleModule } from 'primeng/ripple';
|
|
34
35
|
import * as i2$3 from 'primeng/datepicker';
|
|
35
|
-
import { DatePickerModule } from 'primeng/datepicker';
|
|
36
|
+
import { DatePickerModule, DatePicker } from 'primeng/datepicker';
|
|
36
37
|
import * as i2$2 from 'primeng/multiselect';
|
|
37
38
|
import { MultiSelectModule } from 'primeng/multiselect';
|
|
38
39
|
import * as i7 from 'primeng/textarea';
|
|
@@ -41,6 +42,8 @@ import { Dialog } from 'primeng/dialog';
|
|
|
41
42
|
import * as echarts from 'echarts';
|
|
42
43
|
import * as i2$4 from 'primeng/skeleton';
|
|
43
44
|
import { SkeletonModule } from 'primeng/skeleton';
|
|
45
|
+
import * as i1$3 from 'primeng/confirmdialog';
|
|
46
|
+
import { ConfirmDialogModule } from 'primeng/confirmdialog';
|
|
44
47
|
import * as XLSX from 'xlsx';
|
|
45
48
|
import { Workbook } from 'exceljs';
|
|
46
49
|
import { saveAs } from 'file-saver';
|
|
@@ -164,13 +167,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.1", ngImpor
|
|
|
164
167
|
}] });
|
|
165
168
|
|
|
166
169
|
class FormatAmountPipe {
|
|
167
|
-
transform(value, shortFormat = false, decimalPlaces = 2) {
|
|
168
|
-
if (value === null || value === undefined) {
|
|
169
|
-
return "
|
|
170
|
+
transform(value, shortFormat = false, decimalPlaces = 2, validNegative = false) {
|
|
171
|
+
if (value === null || value === undefined || value == 0) {
|
|
172
|
+
return "-";
|
|
170
173
|
}
|
|
171
|
-
const numericValue = typeof value === "string" ? parseFloat(value) : value;
|
|
172
|
-
if (isNaN(numericValue)) {
|
|
173
|
-
return "
|
|
174
|
+
const numericValue = typeof value === "string" ? Number.parseFloat(value) : value;
|
|
175
|
+
if (Number.isNaN(numericValue)) {
|
|
176
|
+
return "-";
|
|
174
177
|
}
|
|
175
178
|
let formattedValue;
|
|
176
179
|
if (shortFormat) {
|
|
@@ -179,6 +182,11 @@ class FormatAmountPipe {
|
|
|
179
182
|
else {
|
|
180
183
|
formattedValue = this.formatWithThousandSeparators(numericValue, decimalPlaces);
|
|
181
184
|
}
|
|
185
|
+
if (validNegative) {
|
|
186
|
+
if (numericValue < 0) {
|
|
187
|
+
formattedValue = `(${formattedValue})`;
|
|
188
|
+
}
|
|
189
|
+
}
|
|
182
190
|
return formattedValue;
|
|
183
191
|
}
|
|
184
192
|
getShortFormat(value, decimalPlaces) {
|
|
@@ -191,16 +199,17 @@ class FormatAmountPipe {
|
|
|
191
199
|
];
|
|
192
200
|
for (const { limit, suffix } of suffixes) {
|
|
193
201
|
if (absValue >= limit) {
|
|
194
|
-
return (
|
|
202
|
+
return (absValue / limit).toFixed(decimalPlaces) + suffix;
|
|
195
203
|
}
|
|
196
204
|
}
|
|
197
|
-
return
|
|
205
|
+
return absValue.toFixed(decimalPlaces);
|
|
198
206
|
}
|
|
199
207
|
formatWithThousandSeparators(value, decimalPlaces) {
|
|
208
|
+
const absValue = Math.abs(value);
|
|
200
209
|
return new Intl.NumberFormat("en-US", {
|
|
201
210
|
minimumFractionDigits: decimalPlaces,
|
|
202
211
|
maximumFractionDigits: decimalPlaces,
|
|
203
|
-
}).format(
|
|
212
|
+
}).format(absValue);
|
|
204
213
|
}
|
|
205
214
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.1", ngImport: i0, type: FormatAmountPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
206
215
|
static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "20.3.1", ngImport: i0, type: FormatAmountPipe, isStandalone: true, name: "amount" });
|
|
@@ -251,9 +260,10 @@ const Color = {
|
|
|
251
260
|
amex: "#348AD5",
|
|
252
261
|
orange: "#ff7f00",
|
|
253
262
|
orangeDark: "#CC4900",
|
|
263
|
+
skyBlue: "#7490E2",
|
|
254
264
|
blue: "#17375E",
|
|
255
|
-
gray: "#
|
|
256
|
-
gray3: "#
|
|
265
|
+
gray: "#BABECF",
|
|
266
|
+
gray3: "#4E546F",
|
|
257
267
|
gray5: "#e9e9e9",
|
|
258
268
|
};
|
|
259
269
|
const getColor = (name) => {
|
|
@@ -518,6 +528,33 @@ var TableSortOrder;
|
|
|
518
528
|
TableSortOrder[TableSortOrder["Desc"] = -1] = "Desc";
|
|
519
529
|
})(TableSortOrder || (TableSortOrder = {}));
|
|
520
530
|
|
|
531
|
+
/**
|
|
532
|
+
* Enum representing the different types of alerts available in the system.
|
|
533
|
+
* Each type corresponds to a specific visual style and semantic meaning.
|
|
534
|
+
*/
|
|
535
|
+
var AlertType;
|
|
536
|
+
(function (AlertType) {
|
|
537
|
+
/** Warning alert - Yellow icon and title, used for cautionary messages */
|
|
538
|
+
AlertType["WARNING"] = "warning";
|
|
539
|
+
/** Success alert - Green icon and title, used for successful operations */
|
|
540
|
+
AlertType["SUCCESS"] = "success";
|
|
541
|
+
/** Error alert - Red icon and title, used for error messages */
|
|
542
|
+
AlertType["ERROR"] = "error";
|
|
543
|
+
})(AlertType || (AlertType = {}));
|
|
544
|
+
/**
|
|
545
|
+
* Enum representing the button configuration modes for alerts.
|
|
546
|
+
* Determines which buttons are displayed in the alert dialog.
|
|
547
|
+
*/
|
|
548
|
+
var AlertButtonMode;
|
|
549
|
+
(function (AlertButtonMode) {
|
|
550
|
+
/** Only shows a single OK/Confirm button */
|
|
551
|
+
AlertButtonMode["OK_ONLY"] = "ok_only";
|
|
552
|
+
/** Shows both Confirm and Cancel buttons */
|
|
553
|
+
AlertButtonMode["CONFIRM_CANCEL"] = "confirm_cancel";
|
|
554
|
+
/** Shows only a Confirm button (without cancel) */
|
|
555
|
+
AlertButtonMode["CONFIRM_ONLY"] = "confirm_only";
|
|
556
|
+
})(AlertButtonMode || (AlertButtonMode = {}));
|
|
557
|
+
|
|
521
558
|
class PermissionsService {
|
|
522
559
|
constructor() { }
|
|
523
560
|
async canActivate(next, state) {
|
|
@@ -4917,6 +4954,457 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.1", ngImpor
|
|
|
4917
4954
|
args: ["document:click", ["$event"]]
|
|
4918
4955
|
}] } });
|
|
4919
4956
|
|
|
4957
|
+
/**
|
|
4958
|
+
* Constants for DatePicker custom button types
|
|
4959
|
+
* Use these constants instead of string literals to maintain consistency
|
|
4960
|
+
* and facilitate future changes
|
|
4961
|
+
*/
|
|
4962
|
+
const DATEPICKER_BUTTON_TYPES = {
|
|
4963
|
+
TODAY: 'TODAY',
|
|
4964
|
+
LAST_12_MONTHS: 'LAST_12_MONTHS',
|
|
4965
|
+
CURRENT_YEAR: 'CURRENT_YEAR',
|
|
4966
|
+
CURRENT_MONTH: 'CURRENT_MONTH',
|
|
4967
|
+
};
|
|
4968
|
+
|
|
4969
|
+
class DatepickerComponent {
|
|
4970
|
+
cdr;
|
|
4971
|
+
// Expose constants to template
|
|
4972
|
+
DATEPICKER_BUTTON_TYPES = DATEPICKER_BUTTON_TYPES;
|
|
4973
|
+
/**
|
|
4974
|
+
* @description Readonly input
|
|
4975
|
+
* @default false
|
|
4976
|
+
* @type {boolean}
|
|
4977
|
+
*/
|
|
4978
|
+
readonlyInput = false;
|
|
4979
|
+
/**
|
|
4980
|
+
* @description Show icon
|
|
4981
|
+
* @default false
|
|
4982
|
+
* @type {boolean}
|
|
4983
|
+
*/
|
|
4984
|
+
showIcon = false;
|
|
4985
|
+
/**
|
|
4986
|
+
* @description Number of months to display
|
|
4987
|
+
* @default 2
|
|
4988
|
+
* @type {number}
|
|
4989
|
+
*/
|
|
4990
|
+
numberOfMonths = 2;
|
|
4991
|
+
/**
|
|
4992
|
+
* @description Panel style class
|
|
4993
|
+
* @default "prDatapicker prDatapicker--dropdown"
|
|
4994
|
+
* @type {string}
|
|
4995
|
+
*/
|
|
4996
|
+
panelStyleClass = "prDatapicker prDatapicker--dropdown";
|
|
4997
|
+
/**
|
|
4998
|
+
* @description Manual apply mode - requires Apply button click to confirm selection
|
|
4999
|
+
* @default false
|
|
5000
|
+
* @type {boolean}
|
|
5001
|
+
*/
|
|
5002
|
+
manualApply = false;
|
|
5003
|
+
/**
|
|
5004
|
+
* @description Custom buttons to show in footer
|
|
5005
|
+
* @default []
|
|
5006
|
+
* @type {CustomButtonType[]}
|
|
5007
|
+
*/
|
|
5008
|
+
customButtons = [];
|
|
5009
|
+
/**
|
|
5010
|
+
* @description Date format for display in input
|
|
5011
|
+
* @default "dd M, yy" (e.g., "08 Jan, 2026")
|
|
5012
|
+
* @type {string}
|
|
5013
|
+
*/
|
|
5014
|
+
dateFormat;
|
|
5015
|
+
/**
|
|
5016
|
+
* @description View mode for the datepicker
|
|
5017
|
+
* @default "date"
|
|
5018
|
+
* @type {"date" | "month" | "year"}
|
|
5019
|
+
*/
|
|
5020
|
+
view = "date";
|
|
5021
|
+
/**
|
|
5022
|
+
* @description Selection mode for the datepicker
|
|
5023
|
+
* @default "range"
|
|
5024
|
+
* @type {"single" | "range"}
|
|
5025
|
+
*/
|
|
5026
|
+
selectionMode = "range";
|
|
5027
|
+
/**
|
|
5028
|
+
* @description Change event
|
|
5029
|
+
* @emits {(Date | null)[] | null}
|
|
5030
|
+
* @type {EventEmitter<(Date | null)[] | null>}
|
|
5031
|
+
*/
|
|
5032
|
+
onChangeEvent = new EventEmitter();
|
|
5033
|
+
rangeDates = null;
|
|
5034
|
+
// Temporary selection for manual apply mode
|
|
5035
|
+
tempSelection = null;
|
|
5036
|
+
viewMonth;
|
|
5037
|
+
viewYear;
|
|
5038
|
+
currentYear = new Date().getFullYear();
|
|
5039
|
+
currentMonth = new Date().getMonth();
|
|
5040
|
+
defaultDate;
|
|
5041
|
+
navigatingWithArrows = false;
|
|
5042
|
+
// ViewChild to access datepicker instance
|
|
5043
|
+
datepickerRef;
|
|
5044
|
+
// Flag to control when closing is allowed
|
|
5045
|
+
allowClose = true;
|
|
5046
|
+
// Flag to prevent auto-close immediately after date selection
|
|
5047
|
+
preventAutoClose = false;
|
|
5048
|
+
// Track active button
|
|
5049
|
+
activeButton = null;
|
|
5050
|
+
months = [
|
|
5051
|
+
{ label: "Enero", value: 0 },
|
|
5052
|
+
{ label: "Febrero", value: 1 },
|
|
5053
|
+
{ label: "Marzo", value: 2 },
|
|
5054
|
+
{ label: "Abril", value: 3 },
|
|
5055
|
+
{ label: "Mayo", value: 4 },
|
|
5056
|
+
{ label: "Junio", value: 5 },
|
|
5057
|
+
{ label: "Julio", value: 6 },
|
|
5058
|
+
{ label: "Agosto", value: 7 },
|
|
5059
|
+
{ label: "Septiembre", value: 8 },
|
|
5060
|
+
{ label: "Octubre", value: 9 },
|
|
5061
|
+
{ label: "Noviembre", value: 10 },
|
|
5062
|
+
{ label: "Diciembre", value: 11 },
|
|
5063
|
+
];
|
|
5064
|
+
years = [];
|
|
5065
|
+
onChangeFn = () => { };
|
|
5066
|
+
onTouchedFn = () => { };
|
|
5067
|
+
constructor(cdr) {
|
|
5068
|
+
this.cdr = cdr;
|
|
5069
|
+
const today = new Date();
|
|
5070
|
+
this.viewMonth = today.getMonth();
|
|
5071
|
+
this.viewYear = today.getFullYear();
|
|
5072
|
+
this.defaultDate = new Date(this.viewYear, this.viewMonth, 1);
|
|
5073
|
+
const YEARS_BACK = 10;
|
|
5074
|
+
this.years = [];
|
|
5075
|
+
for (let y = this.viewYear - YEARS_BACK; y <= this.viewYear; y++) {
|
|
5076
|
+
this.years.push(y);
|
|
5077
|
+
}
|
|
5078
|
+
}
|
|
5079
|
+
get filteredMonths() {
|
|
5080
|
+
if (this.navigatingWithArrows) {
|
|
5081
|
+
return this.months;
|
|
5082
|
+
}
|
|
5083
|
+
if (this.viewYear === this.currentYear) {
|
|
5084
|
+
return this.months.filter(m => m.value >= this.currentMonth);
|
|
5085
|
+
}
|
|
5086
|
+
return this.months;
|
|
5087
|
+
}
|
|
5088
|
+
getDateFormat() {
|
|
5089
|
+
if (this.dateFormat) {
|
|
5090
|
+
return this.dateFormat;
|
|
5091
|
+
}
|
|
5092
|
+
switch (this.view) {
|
|
5093
|
+
case 'month':
|
|
5094
|
+
return 'M, yy';
|
|
5095
|
+
case 'year':
|
|
5096
|
+
return 'yy';
|
|
5097
|
+
default:
|
|
5098
|
+
return 'dd M, yy';
|
|
5099
|
+
}
|
|
5100
|
+
}
|
|
5101
|
+
normalizeMonthYear(month, year) {
|
|
5102
|
+
if (month > 11) {
|
|
5103
|
+
return { month: 0, year: year + 1 };
|
|
5104
|
+
}
|
|
5105
|
+
if (month < 0) {
|
|
5106
|
+
return { month: 11, year: year - 1 };
|
|
5107
|
+
}
|
|
5108
|
+
return { month, year };
|
|
5109
|
+
}
|
|
5110
|
+
onMonthChange(event) {
|
|
5111
|
+
this.navigatingWithArrows = true;
|
|
5112
|
+
const normalized = this.normalizeMonthYear(event.month, event.year);
|
|
5113
|
+
this.viewMonth = normalized.month;
|
|
5114
|
+
this.viewYear = normalized.year;
|
|
5115
|
+
}
|
|
5116
|
+
onYearChange(event) {
|
|
5117
|
+
this.navigatingWithArrows = true;
|
|
5118
|
+
const normalized = this.normalizeMonthYear(event.month, event.year);
|
|
5119
|
+
this.viewMonth = normalized.month;
|
|
5120
|
+
this.viewYear = normalized.year;
|
|
5121
|
+
}
|
|
5122
|
+
onViewChange() {
|
|
5123
|
+
this.navigatingWithArrows = false;
|
|
5124
|
+
if (this.viewYear === this.currentYear && this.viewMonth < this.currentMonth) {
|
|
5125
|
+
this.viewMonth = this.currentMonth;
|
|
5126
|
+
}
|
|
5127
|
+
this.defaultDate = new Date(this.viewYear, this.viewMonth, 1);
|
|
5128
|
+
}
|
|
5129
|
+
// Internal model for the datepicker (handles manual apply mode)
|
|
5130
|
+
get internalModel() {
|
|
5131
|
+
// In manual apply mode, show temp selection for the calendar
|
|
5132
|
+
// In normal mode, show the actual value
|
|
5133
|
+
return this.manualApply ? this.tempSelection : this.rangeDates;
|
|
5134
|
+
}
|
|
5135
|
+
// Handle model changes from datepicker
|
|
5136
|
+
onModelChange(val) {
|
|
5137
|
+
// Reset active button when user manually selects dates
|
|
5138
|
+
this.activeButton = null;
|
|
5139
|
+
if (this.manualApply) {
|
|
5140
|
+
// In manual apply mode, only store in temp selection
|
|
5141
|
+
this.tempSelection = val;
|
|
5142
|
+
// Prevent auto-close immediately after date selection
|
|
5143
|
+
this.preventAutoClose = true;
|
|
5144
|
+
// After a brief moment, allow closing by clicking outside
|
|
5145
|
+
setTimeout(() => {
|
|
5146
|
+
this.preventAutoClose = false;
|
|
5147
|
+
}, 200);
|
|
5148
|
+
}
|
|
5149
|
+
else {
|
|
5150
|
+
// In normal mode, update the actual value immediately
|
|
5151
|
+
this.rangeDates = val;
|
|
5152
|
+
this.onChangeEvent.emit(this.rangeDates);
|
|
5153
|
+
this.onChangeFn(this.rangeDates);
|
|
5154
|
+
this.onTouchedFn();
|
|
5155
|
+
}
|
|
5156
|
+
}
|
|
5157
|
+
writeValue(value) {
|
|
5158
|
+
this.rangeDates = value;
|
|
5159
|
+
if (this.manualApply) {
|
|
5160
|
+
this.tempSelection = value;
|
|
5161
|
+
}
|
|
5162
|
+
}
|
|
5163
|
+
registerOnChange(fn) {
|
|
5164
|
+
this.onChangeFn = fn;
|
|
5165
|
+
}
|
|
5166
|
+
registerOnTouched(fn) {
|
|
5167
|
+
this.onTouchedFn = fn;
|
|
5168
|
+
}
|
|
5169
|
+
setDisabledState(isDisabled) {
|
|
5170
|
+
/* opcional: implementar si necesitas deshabilitar el componente desde ngModel */
|
|
5171
|
+
}
|
|
5172
|
+
onDateChange() {
|
|
5173
|
+
this.onChangeEvent.emit(this.rangeDates);
|
|
5174
|
+
this.onChangeFn(this.rangeDates);
|
|
5175
|
+
this.onTouchedFn();
|
|
5176
|
+
}
|
|
5177
|
+
// Event handlers for open/close
|
|
5178
|
+
handleOpen() {
|
|
5179
|
+
if (this.manualApply) {
|
|
5180
|
+
// Initialize temp selection with current value
|
|
5181
|
+
this.tempSelection = this.rangeDates;
|
|
5182
|
+
// Reset flags
|
|
5183
|
+
this.allowClose = false;
|
|
5184
|
+
this.preventAutoClose = false;
|
|
5185
|
+
// Ensure hideOverlay is overridden every time the overlay opens
|
|
5186
|
+
setTimeout(() => {
|
|
5187
|
+
this.setupHideOverlayOverride();
|
|
5188
|
+
}, 0);
|
|
5189
|
+
}
|
|
5190
|
+
}
|
|
5191
|
+
handleClose() {
|
|
5192
|
+
if (this.manualApply) {
|
|
5193
|
+
// Reset temp selection to current value (discards changes if not applied)
|
|
5194
|
+
this.tempSelection = this.rangeDates;
|
|
5195
|
+
// Reset flags
|
|
5196
|
+
this.allowClose = false;
|
|
5197
|
+
this.preventAutoClose = false;
|
|
5198
|
+
// Force the datepicker to refresh its internal model to show the original value
|
|
5199
|
+
// Use setTimeout to ensure the change happens after the close animation
|
|
5200
|
+
setTimeout(() => {
|
|
5201
|
+
if (this.datepickerRef) {
|
|
5202
|
+
// Update the datepicker's internal value
|
|
5203
|
+
this.datepickerRef.value = this.rangeDates;
|
|
5204
|
+
// Trigger change detection
|
|
5205
|
+
this.cdr.detectChanges();
|
|
5206
|
+
}
|
|
5207
|
+
}, 0);
|
|
5208
|
+
}
|
|
5209
|
+
}
|
|
5210
|
+
// Apply button callback
|
|
5211
|
+
applyCallback(event) {
|
|
5212
|
+
// Apply the temporary selection to the actual value
|
|
5213
|
+
this.rangeDates = this.tempSelection;
|
|
5214
|
+
this.onChangeEvent.emit(this.rangeDates);
|
|
5215
|
+
this.onChangeFn(this.rangeDates);
|
|
5216
|
+
this.onTouchedFn();
|
|
5217
|
+
// Allow closing
|
|
5218
|
+
this.allowClose = true;
|
|
5219
|
+
this.preventAutoClose = false;
|
|
5220
|
+
// Close the datepicker overlay
|
|
5221
|
+
if (this.datepickerRef) {
|
|
5222
|
+
this.datepickerRef.overlayVisible = false;
|
|
5223
|
+
}
|
|
5224
|
+
}
|
|
5225
|
+
// Clear button callback
|
|
5226
|
+
clearCallback(event) {
|
|
5227
|
+
// Reset active button
|
|
5228
|
+
this.activeButton = null;
|
|
5229
|
+
if (this.manualApply) {
|
|
5230
|
+
// In manual apply mode, clear both temp selection and actual value
|
|
5231
|
+
this.tempSelection = null;
|
|
5232
|
+
this.rangeDates = null;
|
|
5233
|
+
this.onChangeEvent.emit(this.rangeDates);
|
|
5234
|
+
this.onChangeFn(this.rangeDates);
|
|
5235
|
+
this.onTouchedFn();
|
|
5236
|
+
// Allow closing
|
|
5237
|
+
this.allowClose = true;
|
|
5238
|
+
this.preventAutoClose = false;
|
|
5239
|
+
}
|
|
5240
|
+
else {
|
|
5241
|
+
this.rangeDates = null;
|
|
5242
|
+
this.onChangeEvent.emit(this.rangeDates);
|
|
5243
|
+
this.onChangeFn(this.rangeDates);
|
|
5244
|
+
this.onTouchedFn();
|
|
5245
|
+
}
|
|
5246
|
+
// Close the datepicker overlay
|
|
5247
|
+
if (this.datepickerRef) {
|
|
5248
|
+
this.datepickerRef.overlayVisible = false;
|
|
5249
|
+
}
|
|
5250
|
+
}
|
|
5251
|
+
// Custom button callbacks
|
|
5252
|
+
todayCallback(event) {
|
|
5253
|
+
const today = new Date();
|
|
5254
|
+
const dateRange = [today, today];
|
|
5255
|
+
this.activeButton = DATEPICKER_BUTTON_TYPES.TODAY;
|
|
5256
|
+
if (this.manualApply) {
|
|
5257
|
+
this.tempSelection = dateRange;
|
|
5258
|
+
}
|
|
5259
|
+
else {
|
|
5260
|
+
this.rangeDates = dateRange;
|
|
5261
|
+
this.onChangeEvent.emit(this.rangeDates);
|
|
5262
|
+
this.onChangeFn(this.rangeDates);
|
|
5263
|
+
this.onTouchedFn();
|
|
5264
|
+
}
|
|
5265
|
+
}
|
|
5266
|
+
last12MonthsCallback(event) {
|
|
5267
|
+
const endDate = new Date();
|
|
5268
|
+
const startDate = new Date();
|
|
5269
|
+
startDate.setMonth(startDate.getMonth() - 12);
|
|
5270
|
+
const dateRange = [startDate, endDate];
|
|
5271
|
+
this.activeButton = DATEPICKER_BUTTON_TYPES.LAST_12_MONTHS;
|
|
5272
|
+
if (this.manualApply) {
|
|
5273
|
+
this.tempSelection = dateRange;
|
|
5274
|
+
}
|
|
5275
|
+
else {
|
|
5276
|
+
this.rangeDates = dateRange;
|
|
5277
|
+
this.onChangeEvent.emit(this.rangeDates);
|
|
5278
|
+
this.onChangeFn(this.rangeDates);
|
|
5279
|
+
this.onTouchedFn();
|
|
5280
|
+
}
|
|
5281
|
+
}
|
|
5282
|
+
currentYearCallback(event) {
|
|
5283
|
+
const today = new Date();
|
|
5284
|
+
const startDate = new Date(today.getFullYear(), 0, 1); // January 1st
|
|
5285
|
+
const endDate = new Date(today.getFullYear(), 11, 31); // December 31st
|
|
5286
|
+
const dateRange = [startDate, endDate];
|
|
5287
|
+
this.activeButton = DATEPICKER_BUTTON_TYPES.CURRENT_YEAR;
|
|
5288
|
+
if (this.manualApply) {
|
|
5289
|
+
this.tempSelection = dateRange;
|
|
5290
|
+
}
|
|
5291
|
+
else {
|
|
5292
|
+
this.rangeDates = dateRange;
|
|
5293
|
+
this.onChangeEvent.emit(this.rangeDates);
|
|
5294
|
+
this.onChangeFn(this.rangeDates);
|
|
5295
|
+
this.onTouchedFn();
|
|
5296
|
+
}
|
|
5297
|
+
}
|
|
5298
|
+
currentMonthCallback(event) {
|
|
5299
|
+
const today = new Date();
|
|
5300
|
+
const startDate = new Date(today.getFullYear(), today.getMonth(), 1); // First day of month
|
|
5301
|
+
const lastDay = new Date(today.getFullYear(), today.getMonth() + 1, 0).getDate();
|
|
5302
|
+
const endDate = new Date(today.getFullYear(), today.getMonth(), lastDay); // Last day of month
|
|
5303
|
+
const dateRange = [startDate, endDate];
|
|
5304
|
+
this.activeButton = DATEPICKER_BUTTON_TYPES.CURRENT_MONTH;
|
|
5305
|
+
if (this.manualApply) {
|
|
5306
|
+
this.tempSelection = dateRange;
|
|
5307
|
+
}
|
|
5308
|
+
else {
|
|
5309
|
+
this.rangeDates = dateRange;
|
|
5310
|
+
this.onChangeEvent.emit(this.rangeDates);
|
|
5311
|
+
this.onChangeFn(this.rangeDates);
|
|
5312
|
+
this.onTouchedFn();
|
|
5313
|
+
}
|
|
5314
|
+
}
|
|
5315
|
+
// Helper method to check if a button should be shown
|
|
5316
|
+
shouldShowButton(buttonType) {
|
|
5317
|
+
return this.customButtons.includes(buttonType);
|
|
5318
|
+
}
|
|
5319
|
+
// Helper method to get button class
|
|
5320
|
+
getButtonClass(buttonType) {
|
|
5321
|
+
return this.activeButton === buttonType ? 'btnActive' : 'btnSecond';
|
|
5322
|
+
}
|
|
5323
|
+
ngAfterViewChecked() {
|
|
5324
|
+
// Sync viewYear with PrimeNG's internal year when in month view
|
|
5325
|
+
if (this.view === 'month' && this.datepickerRef && this.datepickerRef.currentYear !== undefined) {
|
|
5326
|
+
if (this.viewYear !== this.datepickerRef.currentYear) {
|
|
5327
|
+
// Use setTimeout to avoid ExpressionChangedAfterItHasBeenCheckedError
|
|
5328
|
+
setTimeout(() => {
|
|
5329
|
+
this.viewYear = this.datepickerRef.currentYear;
|
|
5330
|
+
}, 0);
|
|
5331
|
+
}
|
|
5332
|
+
}
|
|
5333
|
+
}
|
|
5334
|
+
setupHideOverlayOverride() {
|
|
5335
|
+
if (!this.datepickerRef) {
|
|
5336
|
+
return;
|
|
5337
|
+
}
|
|
5338
|
+
// Check if hideOverlay method exists
|
|
5339
|
+
if (!this.datepickerRef.hideOverlay) {
|
|
5340
|
+
return;
|
|
5341
|
+
}
|
|
5342
|
+
// Save the original method only once
|
|
5343
|
+
if (!this.datepickerRef._hideOverlayOriginal) {
|
|
5344
|
+
this.datepickerRef._hideOverlayOriginal = this.datepickerRef.hideOverlay.bind(this.datepickerRef);
|
|
5345
|
+
}
|
|
5346
|
+
// Override the hideOverlay method
|
|
5347
|
+
this.datepickerRef.hideOverlay = () => {
|
|
5348
|
+
// In manual apply mode, prevent auto-close only immediately after date selection
|
|
5349
|
+
if (this.manualApply && this.preventAutoClose) {
|
|
5350
|
+
return;
|
|
5351
|
+
}
|
|
5352
|
+
// In manual apply mode, if closing without Apply button (clicking outside)
|
|
5353
|
+
// Reset temp selection to original value BEFORE closing
|
|
5354
|
+
if (this.manualApply && !this.allowClose) {
|
|
5355
|
+
// Reset temp selection to discard changes
|
|
5356
|
+
this.tempSelection = this.rangeDates;
|
|
5357
|
+
// Update datepicker's internal value
|
|
5358
|
+
this.datepickerRef.value = this.rangeDates;
|
|
5359
|
+
}
|
|
5360
|
+
// Allow closing
|
|
5361
|
+
this.datepickerRef._hideOverlayOriginal();
|
|
5362
|
+
};
|
|
5363
|
+
}
|
|
5364
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.1", ngImport: i0, type: DatepickerComponent, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
5365
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.1", type: DatepickerComponent, isStandalone: true, selector: "intelica-datepicker", inputs: { readonlyInput: "readonlyInput", showIcon: "showIcon", numberOfMonths: "numberOfMonths", panelStyleClass: "panelStyleClass", manualApply: "manualApply", customButtons: "customButtons", dateFormat: "dateFormat", view: "view", selectionMode: "selectionMode" }, outputs: { onChangeEvent: "onChange" }, providers: [
|
|
5366
|
+
{
|
|
5367
|
+
provide: NG_VALUE_ACCESSOR,
|
|
5368
|
+
useExisting: forwardRef(() => DatepickerComponent),
|
|
5369
|
+
multi: true,
|
|
5370
|
+
},
|
|
5371
|
+
], viewQueries: [{ propertyName: "datepickerRef", first: true, predicate: ["datepicker"], descendants: true }], ngImport: i0, template: "<p-datepicker\r\n\t#datepicker\r\n\t[class]=\"panelStyleClass\"\r\n\t[ngModel]=\"internalModel\"\r\n\t(ngModelChange)=\"onModelChange($event)\"\r\n\t[selectionMode]=\"selectionMode\"\r\n\t[numberOfMonths]=\"numberOfMonths\"\r\n\t[readonlyInput]=\"readonlyInput\"\r\n\t[showIcon]=\"showIcon\"\r\n\t[view]=\"view\"\r\n\t[dateFormat]=\"getDateFormat()\"\r\n\t[defaultDate]=\"defaultDate\"\r\n\t(onMonthChange)=\"onMonthChange($event)\"\r\n\t(onYearChange)=\"onYearChange($event)\"\r\n\t(onShow)=\"handleOpen()\"\r\n\t(onHide)=\"handleClose()\"\r\n\t>\r\n\r\n\t<ng-template pTemplate=\"header\">\r\n\t\t<div class=\"prDatapicker__header\">\r\n\t\t\t<div class=\"prDatapicker__content\">\r\n\r\n\t\t\t\t<!-- MES -->\r\n\t\t\t\t<p-select\r\n\t\t\t\t\t*ngIf=\"view === 'date'\"\r\n\t\t\t\t\tclass=\"prSelect\"\r\n\t\t\t\t\t[options]=\"filteredMonths\"\r\n\t\t\t\t\toptionLabel=\"label\"\r\n\t\t\t\t\toptionValue=\"value\"\r\n\t\t\t\t\t[(ngModel)]=\"viewMonth\"\r\n\t\t\t\t\t(ngModelChange)=\"onViewChange()\"\r\n\t\t\t\t\tdropdownIcon=\"icon icon-arrow-down\">\r\n\t\t\t\t</p-select>\r\n\r\n\t\t\t\t<!-- A\u00D1O -->\r\n\t\t\t\t<p-select\r\n\t\t\t\t\t*ngIf=\"view === 'date' || view === 'month'\"\r\n\t\t\t\t\tclass=\"prSelect\"\r\n\t\t\t\t\t[options]=\"years\"\r\n\t\t\t\t\t[(ngModel)]=\"viewYear\"\r\n\t\t\t\t\t(ngModelChange)=\"onViewChange()\"\r\n\t\t\t\t\tdropdownIcon=\"icon icon-arrow-down\"\r\n\t\t\t\t\t[virtualScroll]=\"true\"\r\n\t\t\t\t\t[virtualScrollItemSize]=\"38\">\r\n\t\t\t\t</p-select>\r\n\r\n\t\t\t</div>\r\n\t\t</div>\r\n\t</ng-template>\r\n\t<ng-template pTemplate=\"footer\" *ngIf=\"selectionMode === 'range'\">\r\n\t\t<div class=\"footerDatapicker footerDatapicker--range\">\r\n\t\t\t<div class=\"footerDatapicker__box\">\r\n\t\t\t\t<!-- TODAY button -->\r\n\t\t\t\t<p-button\r\n\t\t\t\t\t*ngIf=\"shouldShowButton(DATEPICKER_BUTTON_TYPES.TODAY)\"\r\n\t\t\t\t\t[class]=\"getButtonClass(DATEPICKER_BUTTON_TYPES.TODAY)\"\r\n\t\t\t\t\tlabel=\"Today\"\r\n\t\t\t\t\t(click)=\"todayCallback($event)\">\r\n\t\t\t\t</p-button>\r\n\t\t\t\t<!-- LAST 12 MONTHS button -->\r\n\t\t\t\t<p-button\r\n\t\t\t\t\t*ngIf=\"shouldShowButton(DATEPICKER_BUTTON_TYPES.LAST_12_MONTHS)\"\r\n\t\t\t\t\t[class]=\"getButtonClass(DATEPICKER_BUTTON_TYPES.LAST_12_MONTHS)\"\r\n\t\t\t\t\tlabel=\"Last 12 months\"\r\n\t\t\t\t\t(click)=\"last12MonthsCallback($event)\">\r\n\t\t\t\t</p-button>\r\n\t\t\t\t<!-- CURRENT YEAR button -->\r\n\t\t\t\t<p-button\r\n\t\t\t\t\t*ngIf=\"shouldShowButton(DATEPICKER_BUTTON_TYPES.CURRENT_YEAR)\"\r\n\t\t\t\t\t[class]=\"getButtonClass(DATEPICKER_BUTTON_TYPES.CURRENT_YEAR)\"\r\n\t\t\t\t\tlabel=\"Current year\"\r\n\t\t\t\t\t(click)=\"currentYearCallback($event)\">\r\n\t\t\t\t</p-button>\r\n\t\t\t\t<!-- CURRENT MONTH button -->\r\n\t\t\t\t<p-button\r\n\t\t\t\t\t*ngIf=\"shouldShowButton(DATEPICKER_BUTTON_TYPES.CURRENT_MONTH)\"\r\n\t\t\t\t\t[class]=\"getButtonClass(DATEPICKER_BUTTON_TYPES.CURRENT_MONTH)\"\r\n\t\t\t\t\tlabel=\"Current month\"\r\n\t\t\t\t\t(click)=\"currentMonthCallback($event)\">\r\n\t\t\t\t</p-button>\r\n\t\t\t</div>\r\n\t\t\t<div class=\"footerDatapicker__box\">\r\n\t\t\t\t<!-- Apply button - shown only in manual apply mode -->\r\n\t\t\t\t<p-button\r\n\t\t\t\t\t*ngIf=\"manualApply\"\r\n\t\t\t\t\tclass=\"btnPrimary\"\r\n\t\t\t\t\tlabel=\"Apply\"\r\n\t\t\t\t\t(click)=\"applyCallback($event)\">\r\n\t\t\t\t</p-button>\r\n\t\t\t\t<!-- Clear button - always shown -->\r\n\t\t\t\t<p-button\r\n\t\t\t\t\tclass=\"btnSecond\"\r\n\t\t\t\t\tlabel=\"Clear\"\r\n\t\t\t\t\t(click)=\"clearCallback($event)\">\r\n\t\t\t\t</p-button>\r\n\t\t\t</div>\r\n\t\t</div>\r\n\t</ng-template>\r\n\r\n</p-datepicker>\r\n", dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: DatePicker, selector: "p-datePicker, p-datepicker, p-date-picker", inputs: ["iconDisplay", "styleClass", "inputStyle", "inputId", "inputStyleClass", "placeholder", "ariaLabelledBy", "ariaLabel", "iconAriaLabel", "dateFormat", "multipleSeparator", "rangeSeparator", "inline", "showOtherMonths", "selectOtherMonths", "showIcon", "icon", "readonlyInput", "shortYearCutoff", "hourFormat", "timeOnly", "stepHour", "stepMinute", "stepSecond", "showSeconds", "showOnFocus", "showWeek", "startWeekFromFirstDayOfYear", "showClear", "dataType", "selectionMode", "maxDateCount", "showButtonBar", "todayButtonStyleClass", "clearButtonStyleClass", "autofocus", "autoZIndex", "baseZIndex", "panelStyleClass", "panelStyle", "keepInvalid", "hideOnDateTimeSelect", "touchUI", "timeSeparator", "focusTrap", "showTransitionOptions", "hideTransitionOptions", "tabindex", "minDate", "maxDate", "disabledDates", "disabledDays", "showTime", "responsiveOptions", "numberOfMonths", "firstDayOfWeek", "view", "defaultDate", "appendTo"], outputs: ["onFocus", "onBlur", "onClose", "onSelect", "onClear", "onInput", "onTodayClick", "onClearClick", "onMonthChange", "onYearChange", "onClickOutside", "onShow"] }, { kind: "ngmodule", type: SelectModule }, { kind: "component", type: i6.Select, selector: "p-select", inputs: ["id", "scrollHeight", "filter", "panelStyle", "styleClass", "panelStyleClass", "readonly", "editable", "tabindex", "placeholder", "loadingIcon", "filterPlaceholder", "filterLocale", "inputId", "dataKey", "filterBy", "filterFields", "autofocus", "resetFilterOnHide", "checkmark", "dropdownIcon", "loading", "optionLabel", "optionValue", "optionDisabled", "optionGroupLabel", "optionGroupChildren", "group", "showClear", "emptyFilterMessage", "emptyMessage", "lazy", "virtualScroll", "virtualScrollItemSize", "virtualScrollOptions", "overlayOptions", "ariaFilterLabel", "ariaLabel", "ariaLabelledBy", "filterMatchMode", "tooltip", "tooltipPosition", "tooltipPositionStyle", "tooltipStyleClass", "focusOnHover", "selectOnFocus", "autoOptionFocus", "autofocusFilter", "filterValue", "options", "appendTo"], outputs: ["onChange", "onFilter", "onFocus", "onBlur", "onClick", "onShow", "onHide", "onClear", "onLazyLoad"] }, { kind: "directive", type: i3$1.PrimeTemplate, selector: "[pTemplate]", inputs: ["type", "pTemplate"] }, { kind: "ngmodule", type: ButtonModule }, { kind: "component", type: i2.Button, selector: "p-button", inputs: ["type", "iconPos", "icon", "badge", "label", "disabled", "loading", "loadingIcon", "raised", "rounded", "text", "plain", "severity", "outlined", "link", "tabindex", "size", "variant", "style", "styleClass", "badgeClass", "badgeSeverity", "ariaLabel", "buttonProps", "autofocus", "fluid"], outputs: ["onClick", "onFocus", "onBlur"] }] });
|
|
5372
|
+
}
|
|
5373
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.1", ngImport: i0, type: DatepickerComponent, decorators: [{
|
|
5374
|
+
type: Component,
|
|
5375
|
+
args: [{ selector: "intelica-datepicker", imports: [CommonModule, FormsModule, DatePicker, SelectModule, ButtonModule], providers: [
|
|
5376
|
+
{
|
|
5377
|
+
provide: NG_VALUE_ACCESSOR,
|
|
5378
|
+
useExisting: forwardRef(() => DatepickerComponent),
|
|
5379
|
+
multi: true,
|
|
5380
|
+
},
|
|
5381
|
+
], template: "<p-datepicker\r\n\t#datepicker\r\n\t[class]=\"panelStyleClass\"\r\n\t[ngModel]=\"internalModel\"\r\n\t(ngModelChange)=\"onModelChange($event)\"\r\n\t[selectionMode]=\"selectionMode\"\r\n\t[numberOfMonths]=\"numberOfMonths\"\r\n\t[readonlyInput]=\"readonlyInput\"\r\n\t[showIcon]=\"showIcon\"\r\n\t[view]=\"view\"\r\n\t[dateFormat]=\"getDateFormat()\"\r\n\t[defaultDate]=\"defaultDate\"\r\n\t(onMonthChange)=\"onMonthChange($event)\"\r\n\t(onYearChange)=\"onYearChange($event)\"\r\n\t(onShow)=\"handleOpen()\"\r\n\t(onHide)=\"handleClose()\"\r\n\t>\r\n\r\n\t<ng-template pTemplate=\"header\">\r\n\t\t<div class=\"prDatapicker__header\">\r\n\t\t\t<div class=\"prDatapicker__content\">\r\n\r\n\t\t\t\t<!-- MES -->\r\n\t\t\t\t<p-select\r\n\t\t\t\t\t*ngIf=\"view === 'date'\"\r\n\t\t\t\t\tclass=\"prSelect\"\r\n\t\t\t\t\t[options]=\"filteredMonths\"\r\n\t\t\t\t\toptionLabel=\"label\"\r\n\t\t\t\t\toptionValue=\"value\"\r\n\t\t\t\t\t[(ngModel)]=\"viewMonth\"\r\n\t\t\t\t\t(ngModelChange)=\"onViewChange()\"\r\n\t\t\t\t\tdropdownIcon=\"icon icon-arrow-down\">\r\n\t\t\t\t</p-select>\r\n\r\n\t\t\t\t<!-- A\u00D1O -->\r\n\t\t\t\t<p-select\r\n\t\t\t\t\t*ngIf=\"view === 'date' || view === 'month'\"\r\n\t\t\t\t\tclass=\"prSelect\"\r\n\t\t\t\t\t[options]=\"years\"\r\n\t\t\t\t\t[(ngModel)]=\"viewYear\"\r\n\t\t\t\t\t(ngModelChange)=\"onViewChange()\"\r\n\t\t\t\t\tdropdownIcon=\"icon icon-arrow-down\"\r\n\t\t\t\t\t[virtualScroll]=\"true\"\r\n\t\t\t\t\t[virtualScrollItemSize]=\"38\">\r\n\t\t\t\t</p-select>\r\n\r\n\t\t\t</div>\r\n\t\t</div>\r\n\t</ng-template>\r\n\t<ng-template pTemplate=\"footer\" *ngIf=\"selectionMode === 'range'\">\r\n\t\t<div class=\"footerDatapicker footerDatapicker--range\">\r\n\t\t\t<div class=\"footerDatapicker__box\">\r\n\t\t\t\t<!-- TODAY button -->\r\n\t\t\t\t<p-button\r\n\t\t\t\t\t*ngIf=\"shouldShowButton(DATEPICKER_BUTTON_TYPES.TODAY)\"\r\n\t\t\t\t\t[class]=\"getButtonClass(DATEPICKER_BUTTON_TYPES.TODAY)\"\r\n\t\t\t\t\tlabel=\"Today\"\r\n\t\t\t\t\t(click)=\"todayCallback($event)\">\r\n\t\t\t\t</p-button>\r\n\t\t\t\t<!-- LAST 12 MONTHS button -->\r\n\t\t\t\t<p-button\r\n\t\t\t\t\t*ngIf=\"shouldShowButton(DATEPICKER_BUTTON_TYPES.LAST_12_MONTHS)\"\r\n\t\t\t\t\t[class]=\"getButtonClass(DATEPICKER_BUTTON_TYPES.LAST_12_MONTHS)\"\r\n\t\t\t\t\tlabel=\"Last 12 months\"\r\n\t\t\t\t\t(click)=\"last12MonthsCallback($event)\">\r\n\t\t\t\t</p-button>\r\n\t\t\t\t<!-- CURRENT YEAR button -->\r\n\t\t\t\t<p-button\r\n\t\t\t\t\t*ngIf=\"shouldShowButton(DATEPICKER_BUTTON_TYPES.CURRENT_YEAR)\"\r\n\t\t\t\t\t[class]=\"getButtonClass(DATEPICKER_BUTTON_TYPES.CURRENT_YEAR)\"\r\n\t\t\t\t\tlabel=\"Current year\"\r\n\t\t\t\t\t(click)=\"currentYearCallback($event)\">\r\n\t\t\t\t</p-button>\r\n\t\t\t\t<!-- CURRENT MONTH button -->\r\n\t\t\t\t<p-button\r\n\t\t\t\t\t*ngIf=\"shouldShowButton(DATEPICKER_BUTTON_TYPES.CURRENT_MONTH)\"\r\n\t\t\t\t\t[class]=\"getButtonClass(DATEPICKER_BUTTON_TYPES.CURRENT_MONTH)\"\r\n\t\t\t\t\tlabel=\"Current month\"\r\n\t\t\t\t\t(click)=\"currentMonthCallback($event)\">\r\n\t\t\t\t</p-button>\r\n\t\t\t</div>\r\n\t\t\t<div class=\"footerDatapicker__box\">\r\n\t\t\t\t<!-- Apply button - shown only in manual apply mode -->\r\n\t\t\t\t<p-button\r\n\t\t\t\t\t*ngIf=\"manualApply\"\r\n\t\t\t\t\tclass=\"btnPrimary\"\r\n\t\t\t\t\tlabel=\"Apply\"\r\n\t\t\t\t\t(click)=\"applyCallback($event)\">\r\n\t\t\t\t</p-button>\r\n\t\t\t\t<!-- Clear button - always shown -->\r\n\t\t\t\t<p-button\r\n\t\t\t\t\tclass=\"btnSecond\"\r\n\t\t\t\t\tlabel=\"Clear\"\r\n\t\t\t\t\t(click)=\"clearCallback($event)\">\r\n\t\t\t\t</p-button>\r\n\t\t\t</div>\r\n\t\t</div>\r\n\t</ng-template>\r\n\r\n</p-datepicker>\r\n" }]
|
|
5382
|
+
}], ctorParameters: () => [{ type: i0.ChangeDetectorRef }], propDecorators: { readonlyInput: [{
|
|
5383
|
+
type: Input
|
|
5384
|
+
}], showIcon: [{
|
|
5385
|
+
type: Input
|
|
5386
|
+
}], numberOfMonths: [{
|
|
5387
|
+
type: Input
|
|
5388
|
+
}], panelStyleClass: [{
|
|
5389
|
+
type: Input
|
|
5390
|
+
}], manualApply: [{
|
|
5391
|
+
type: Input
|
|
5392
|
+
}], customButtons: [{
|
|
5393
|
+
type: Input
|
|
5394
|
+
}], dateFormat: [{
|
|
5395
|
+
type: Input
|
|
5396
|
+
}], view: [{
|
|
5397
|
+
type: Input
|
|
5398
|
+
}], selectionMode: [{
|
|
5399
|
+
type: Input
|
|
5400
|
+
}], onChangeEvent: [{
|
|
5401
|
+
type: Output,
|
|
5402
|
+
args: ["onChange"]
|
|
5403
|
+
}], datepickerRef: [{
|
|
5404
|
+
type: ViewChild,
|
|
5405
|
+
args: ['datepicker']
|
|
5406
|
+
}] } });
|
|
5407
|
+
|
|
4920
5408
|
class SkeletonService {
|
|
4921
5409
|
isLoading = signal(false, ...(ngDevMode ? [{ debugName: "isLoading" }] : []));
|
|
4922
5410
|
hide() {
|
|
@@ -5348,6 +5836,79 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.1", ngImpor
|
|
|
5348
5836
|
type: Input
|
|
5349
5837
|
}] } });
|
|
5350
5838
|
|
|
5839
|
+
class IntelicaAlertComponent {
|
|
5840
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.1", ngImport: i0, type: IntelicaAlertComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
5841
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.1", type: IntelicaAlertComponent, isStandalone: true, selector: "intelica-alert", ngImport: i0, template: "<p-confirmDialog key=\"intelica-alert-dialog\" [style]=\"{width: 'auto', 'max-width': '90cw'}\" [closable]=\"false\"\r\n [visible]=\"undefined\">\r\n <!-- \r\n We use the headless template. \r\n 'message' contains the confirmation object.\r\n 'message.data' contains our custom 'presentationData' object from AlertService.\r\n -->\r\n <ng-template pTemplate=\"headless\" let-message let-onAccept=\"onAccept\" let-onReject=\"onReject\">\r\n <div [style]=\"message.data.dialogStyle\"\r\n style=\"background: white; display: flex; flex-direction: column; align-items: center; padding: 2rem; position: relative; text-align: center;\">\r\n\r\n <!-- Close Button -->\r\n @if (message.data.config.showCloseButton) {\r\n <button type=\"button\"\r\n style=\"position: absolute; top: 0.75rem; right: 0.75rem; background: transparent; border: none; cursor: pointer; padding: 0.5rem; border-radius: 50%; display: flex; align-items: center; justify-content: center; transition: background-color 0.2s;\"\r\n (click)=\"onReject()\" aria-label=\"Cerrar\">\r\n <i class=\"pi pi-times\" style=\"font-size: 1.25rem; color: #6c757d;\"></i>\r\n </button>\r\n }\r\n\r\n <!-- Icon -->\r\n <div [style.backgroundColor]=\"message.data.iconBackgroundColor\"\r\n style=\"width: 80px; height: 80px; border-radius: 50%; display: flex; align-items: center; justify-content: center; margin-bottom: 1.5rem;\">\r\n @if (message.data.config.customImageUrl) {\r\n <img [src]=\"message.data.config.customImageUrl\" style=\"width: 60px; height: 60px; object-fit: contain;\"\r\n alt=\"Alert icon\" />\r\n } @else {\r\n <i [class]=\"message.data.iconClass\" [style.color]=\"message.data.iconColor\"\r\n style=\"font-size: 2.5rem;\"></i>\r\n }\r\n </div>\r\n\r\n <!-- Title -->\r\n <h2 [style.color]=\"message.data.titleColor\"\r\n style=\"margin: 0 0 0.75rem 0; font-size: 1.5rem; font-weight: 600;\">{{ message.header }}</h2>\r\n\r\n <!-- Subtitle / Message -->\r\n @if (message.message) {\r\n <p [style.color]=\"message.data.config.styles?.subtitleColor ?? '#555'\"\r\n style=\"margin: 0 0 1.5rem 0; font-size: 1rem; line-height: 1.5;\">{{ message.message }}</p>\r\n }\r\n\r\n <!-- HTML Content -->\r\n @if (message.data.config.htmlContent) {\r\n <div [innerHTML]=\"message.data.config.htmlContent\"\r\n [style.color]=\"message.data.config.styles?.subtitleColor ?? '#555'\"\r\n style=\"margin-bottom: 1.5rem; width: 100%;\"></div>\r\n }\r\n\r\n <!-- Buttons -->\r\n <div style=\"display: flex; gap: 0.75rem; justify-content: center; width: 100%; margin-top: 0.5rem;\">\r\n <!-- Cancel Button -->\r\n @if (message.data.showCancelButton) {\r\n <p-button [label]=\"message.data.cancelText\" [style]=\"message.data.cancelButtonStyle\"\r\n severity=\"secondary\" [outlined]=\"true\" (onClick)=\"onReject()\" />\r\n }\r\n <!-- Confirm Button -->\r\n <p-button [label]=\"message.data.confirmText\" [style]=\"message.data.confirmButtonStyle\"\r\n (onClick)=\"onAccept()\" />\r\n </div>\r\n </div>\r\n </ng-template>\r\n</p-confirmDialog>\r\n", dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: ConfirmDialogModule }, { kind: "component", type: i1$3.ConfirmDialog, selector: "p-confirmDialog, p-confirmdialog, p-confirm-dialog", inputs: ["header", "icon", "message", "style", "styleClass", "maskStyleClass", "acceptIcon", "acceptLabel", "closeAriaLabel", "acceptAriaLabel", "acceptVisible", "rejectIcon", "rejectLabel", "rejectAriaLabel", "rejectVisible", "acceptButtonStyleClass", "rejectButtonStyleClass", "closeOnEscape", "dismissableMask", "blockScroll", "rtl", "closable", "appendTo", "key", "autoZIndex", "baseZIndex", "transitionOptions", "focusTrap", "defaultFocus", "breakpoints", "visible", "position", "draggable"], outputs: ["onHide"] }, { kind: "directive", type: i3$1.PrimeTemplate, selector: "[pTemplate]", inputs: ["type", "pTemplate"] }, { kind: "ngmodule", type: ButtonModule }, { kind: "component", type: i2.Button, selector: "p-button", inputs: ["type", "iconPos", "icon", "badge", "label", "disabled", "loading", "loadingIcon", "raised", "rounded", "text", "plain", "severity", "outlined", "link", "tabindex", "size", "variant", "style", "styleClass", "badgeClass", "badgeSeverity", "ariaLabel", "buttonProps", "autofocus", "fluid"], outputs: ["onClick", "onFocus", "onBlur"] }] });
|
|
5842
|
+
}
|
|
5843
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.1", ngImport: i0, type: IntelicaAlertComponent, decorators: [{
|
|
5844
|
+
type: Component,
|
|
5845
|
+
args: [{ selector: "intelica-alert", standalone: true, imports: [CommonModule, ConfirmDialogModule, ButtonModule], template: "<p-confirmDialog key=\"intelica-alert-dialog\" [style]=\"{width: 'auto', 'max-width': '90cw'}\" [closable]=\"false\"\r\n [visible]=\"undefined\">\r\n <!-- \r\n We use the headless template. \r\n 'message' contains the confirmation object.\r\n 'message.data' contains our custom 'presentationData' object from AlertService.\r\n -->\r\n <ng-template pTemplate=\"headless\" let-message let-onAccept=\"onAccept\" let-onReject=\"onReject\">\r\n <div [style]=\"message.data.dialogStyle\"\r\n style=\"background: white; display: flex; flex-direction: column; align-items: center; padding: 2rem; position: relative; text-align: center;\">\r\n\r\n <!-- Close Button -->\r\n @if (message.data.config.showCloseButton) {\r\n <button type=\"button\"\r\n style=\"position: absolute; top: 0.75rem; right: 0.75rem; background: transparent; border: none; cursor: pointer; padding: 0.5rem; border-radius: 50%; display: flex; align-items: center; justify-content: center; transition: background-color 0.2s;\"\r\n (click)=\"onReject()\" aria-label=\"Cerrar\">\r\n <i class=\"pi pi-times\" style=\"font-size: 1.25rem; color: #6c757d;\"></i>\r\n </button>\r\n }\r\n\r\n <!-- Icon -->\r\n <div [style.backgroundColor]=\"message.data.iconBackgroundColor\"\r\n style=\"width: 80px; height: 80px; border-radius: 50%; display: flex; align-items: center; justify-content: center; margin-bottom: 1.5rem;\">\r\n @if (message.data.config.customImageUrl) {\r\n <img [src]=\"message.data.config.customImageUrl\" style=\"width: 60px; height: 60px; object-fit: contain;\"\r\n alt=\"Alert icon\" />\r\n } @else {\r\n <i [class]=\"message.data.iconClass\" [style.color]=\"message.data.iconColor\"\r\n style=\"font-size: 2.5rem;\"></i>\r\n }\r\n </div>\r\n\r\n <!-- Title -->\r\n <h2 [style.color]=\"message.data.titleColor\"\r\n style=\"margin: 0 0 0.75rem 0; font-size: 1.5rem; font-weight: 600;\">{{ message.header }}</h2>\r\n\r\n <!-- Subtitle / Message -->\r\n @if (message.message) {\r\n <p [style.color]=\"message.data.config.styles?.subtitleColor ?? '#555'\"\r\n style=\"margin: 0 0 1.5rem 0; font-size: 1rem; line-height: 1.5;\">{{ message.message }}</p>\r\n }\r\n\r\n <!-- HTML Content -->\r\n @if (message.data.config.htmlContent) {\r\n <div [innerHTML]=\"message.data.config.htmlContent\"\r\n [style.color]=\"message.data.config.styles?.subtitleColor ?? '#555'\"\r\n style=\"margin-bottom: 1.5rem; width: 100%;\"></div>\r\n }\r\n\r\n <!-- Buttons -->\r\n <div style=\"display: flex; gap: 0.75rem; justify-content: center; width: 100%; margin-top: 0.5rem;\">\r\n <!-- Cancel Button -->\r\n @if (message.data.showCancelButton) {\r\n <p-button [label]=\"message.data.cancelText\" [style]=\"message.data.cancelButtonStyle\"\r\n severity=\"secondary\" [outlined]=\"true\" (onClick)=\"onReject()\" />\r\n }\r\n <!-- Confirm Button -->\r\n <p-button [label]=\"message.data.confirmText\" [style]=\"message.data.confirmButtonStyle\"\r\n (onClick)=\"onAccept()\" />\r\n </div>\r\n </div>\r\n </ng-template>\r\n</p-confirmDialog>\r\n" }]
|
|
5846
|
+
}] });
|
|
5847
|
+
|
|
5848
|
+
class AddFavoritesService {
|
|
5849
|
+
configService = inject(ConfigService);
|
|
5850
|
+
addPageToFavorites() {
|
|
5851
|
+
return of(void 0).pipe(delay(200), tap(() => console.log("Test: Added current page to favorites")));
|
|
5852
|
+
}
|
|
5853
|
+
isPageFavorite() {
|
|
5854
|
+
return of(false).pipe(delay(200), tap(() => console.log("Test: Checked if current page is favorite")));
|
|
5855
|
+
}
|
|
5856
|
+
simulateToggle() {
|
|
5857
|
+
return of(void 0).pipe(delay(200), tap(() => console.log("Test: Toggle favorite request")));
|
|
5858
|
+
}
|
|
5859
|
+
removeFromFavorites() {
|
|
5860
|
+
return of(void 0).pipe(delay(200), tap(() => console.log("Test: removed from favorites")));
|
|
5861
|
+
}
|
|
5862
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.1", ngImport: i0, type: AddFavoritesService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
5863
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.1", ngImport: i0, type: AddFavoritesService, providedIn: "root" });
|
|
5864
|
+
}
|
|
5865
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.1", ngImport: i0, type: AddFavoritesService, decorators: [{
|
|
5866
|
+
type: Injectable,
|
|
5867
|
+
args: [{
|
|
5868
|
+
providedIn: "root",
|
|
5869
|
+
}]
|
|
5870
|
+
}] });
|
|
5871
|
+
|
|
5872
|
+
const ICON_ON = "icon-favorites-on";
|
|
5873
|
+
const ICON_OFF = "icon-favorites-off";
|
|
5874
|
+
class AddFavoritesComponent {
|
|
5875
|
+
termService = inject(GlobalTermService);
|
|
5876
|
+
favoritesMock = inject(AddFavoritesService);
|
|
5877
|
+
favoriteChanged = output();
|
|
5878
|
+
isFavorite = false;
|
|
5879
|
+
iconClass = ICON_OFF;
|
|
5880
|
+
ngOnInit() {
|
|
5881
|
+
this.loadInitialState();
|
|
5882
|
+
}
|
|
5883
|
+
toggleFavorite() {
|
|
5884
|
+
const action$ = this.isFavorite ? this.favoritesMock.removeFromFavorites() : this.favoritesMock.addPageToFavorites();
|
|
5885
|
+
action$.subscribe({
|
|
5886
|
+
next: () => {
|
|
5887
|
+
this.isFavorite = !this.isFavorite;
|
|
5888
|
+
this.updateIcon();
|
|
5889
|
+
this.favoriteChanged.emit(this.isFavorite);
|
|
5890
|
+
},
|
|
5891
|
+
});
|
|
5892
|
+
}
|
|
5893
|
+
loadInitialState() {
|
|
5894
|
+
this.favoritesMock.isPageFavorite().subscribe({
|
|
5895
|
+
next: isFavorite => {
|
|
5896
|
+
this.isFavorite = isFavorite;
|
|
5897
|
+
this.updateIcon();
|
|
5898
|
+
},
|
|
5899
|
+
});
|
|
5900
|
+
}
|
|
5901
|
+
updateIcon() {
|
|
5902
|
+
this.iconClass = this.isFavorite ? ICON_ON : ICON_OFF;
|
|
5903
|
+
}
|
|
5904
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.1", ngImport: i0, type: AddFavoritesComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
5905
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.1", type: AddFavoritesComponent, isStandalone: true, selector: "intelica-add-favorites", outputs: { favoriteChanged: "favoriteChanged" }, ngImport: i0, template: "<p-button class=\"prButton\" severity=\"secondary\" (onClick)=\"toggleFavorite()\">\r\n\t<i class=\"icon p-button-icon-left\" [ngClass]=\"iconClass\" pButtonIcon></i>\r\n\t<span pButtonLabel>{{ \"ADD_TO_FAVORITES\" | term : termService.languageCode }}</span>\r\n</p-button>\r\n", dependencies: [{ kind: "component", type: Button, selector: "p-button", inputs: ["type", "iconPos", "icon", "badge", "label", "disabled", "loading", "loadingIcon", "raised", "rounded", "text", "plain", "severity", "outlined", "link", "tabindex", "size", "variant", "style", "styleClass", "badgeClass", "badgeSeverity", "ariaLabel", "buttonProps", "autofocus", "fluid"], outputs: ["onClick", "onFocus", "onBlur"] }, { kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "pipe", type: TermPipe, name: "term" }] });
|
|
5906
|
+
}
|
|
5907
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.1", ngImport: i0, type: AddFavoritesComponent, decorators: [{
|
|
5908
|
+
type: Component,
|
|
5909
|
+
args: [{ selector: "intelica-add-favorites", imports: [Button, TermPipe, NgClass], template: "<p-button class=\"prButton\" severity=\"secondary\" (onClick)=\"toggleFavorite()\">\r\n\t<i class=\"icon p-button-icon-left\" [ngClass]=\"iconClass\" pButtonIcon></i>\r\n\t<span pButtonLabel>{{ \"ADD_TO_FAVORITES\" | term : termService.languageCode }}</span>\r\n</p-button>\r\n" }]
|
|
5910
|
+
}] });
|
|
5911
|
+
|
|
5351
5912
|
class CheckboxFilterDirective extends FilterDirective {
|
|
5352
5913
|
constructor() {
|
|
5353
5914
|
super(FilterTypeEnum.Checkbox);
|
|
@@ -5814,6 +6375,50 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.1", ngImpor
|
|
|
5814
6375
|
args: ["onChange", ["$event"]]
|
|
5815
6376
|
}] } });
|
|
5816
6377
|
|
|
6378
|
+
/**
|
|
6379
|
+
* Default configuration values for alerts.
|
|
6380
|
+
*/
|
|
6381
|
+
const ALERT_DEFAULTS = {
|
|
6382
|
+
buttonMode: AlertButtonMode.OK_ONLY,
|
|
6383
|
+
showCloseButton: true,
|
|
6384
|
+
buttons: {
|
|
6385
|
+
confirmText: "Ok",
|
|
6386
|
+
cancelText: "Cancelar",
|
|
6387
|
+
},
|
|
6388
|
+
};
|
|
6389
|
+
/**
|
|
6390
|
+
* Paths to custom SVG icons for alerts.
|
|
6391
|
+
* Icons should be placed in: public/assets/icons/alerts/
|
|
6392
|
+
*/
|
|
6393
|
+
const ALERT_ICON_PATHS = {
|
|
6394
|
+
error: "/assets/icons/alerts/alert-error.svg",
|
|
6395
|
+
// warning: "/assets/icons/alerts/alert-warning.svg",
|
|
6396
|
+
// success: "/assets/icons/alerts/alert-success.svg",
|
|
6397
|
+
};
|
|
6398
|
+
/**
|
|
6399
|
+
* Centralized configuration for each alert type using PrimeNG icons.
|
|
6400
|
+
*/
|
|
6401
|
+
const ALERT_TYPE_CONFIG = {
|
|
6402
|
+
[AlertType.WARNING]: {
|
|
6403
|
+
titleColor: "#f0ad4e",
|
|
6404
|
+
icon: "pi pi-exclamation-triangle",
|
|
6405
|
+
iconBackgroundColor: "#fff3cd",
|
|
6406
|
+
iconColor: "#f0ad4e",
|
|
6407
|
+
},
|
|
6408
|
+
[AlertType.SUCCESS]: {
|
|
6409
|
+
titleColor: "#5cb85c",
|
|
6410
|
+
icon: "pi pi-check-circle",
|
|
6411
|
+
iconBackgroundColor: "#d4edda",
|
|
6412
|
+
iconColor: "#5cb85c",
|
|
6413
|
+
},
|
|
6414
|
+
[AlertType.ERROR]: {
|
|
6415
|
+
titleColor: "#d9534f",
|
|
6416
|
+
icon: "pi pi-times-circle",
|
|
6417
|
+
iconBackgroundColor: "#f8d7da",
|
|
6418
|
+
iconColor: "#d9534f",
|
|
6419
|
+
},
|
|
6420
|
+
};
|
|
6421
|
+
|
|
5817
6422
|
class HtmlToExcelService {
|
|
5818
6423
|
ExportTOExcel(idTabla, html, filename, tabname, extension) {
|
|
5819
6424
|
let Table = document.getElementById(idTabla);
|
|
@@ -6207,6 +6812,239 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.1", ngImpor
|
|
|
6207
6812
|
}]
|
|
6208
6813
|
}] });
|
|
6209
6814
|
|
|
6815
|
+
class AlertService {
|
|
6816
|
+
confirmationService = inject(ConfirmationService);
|
|
6817
|
+
DIALOG_KEY = 'intelica-alert-dialog';
|
|
6818
|
+
/**
|
|
6819
|
+
* Displays a warning alert with yellow styling.
|
|
6820
|
+
* Can be called with (title, subtitle, buttonMode, buttons) OR (title, subtitle, buttons).
|
|
6821
|
+
*/
|
|
6822
|
+
warning(title, subtitle, modeOrButtons, buttons) {
|
|
6823
|
+
const { buttonMode, buttonConfig } = this.resolveArgs(modeOrButtons, buttons);
|
|
6824
|
+
return this.show({
|
|
6825
|
+
type: AlertType.WARNING,
|
|
6826
|
+
title,
|
|
6827
|
+
subtitle,
|
|
6828
|
+
buttonMode,
|
|
6829
|
+
buttons: buttonConfig,
|
|
6830
|
+
});
|
|
6831
|
+
}
|
|
6832
|
+
/**
|
|
6833
|
+
* Displays a success alert with green styling.
|
|
6834
|
+
* Can be called with (title, subtitle, buttonMode, buttons) OR (title, subtitle, buttons).
|
|
6835
|
+
*/
|
|
6836
|
+
success(title, subtitle, modeOrButtons, buttons) {
|
|
6837
|
+
const { buttonMode, buttonConfig } = this.resolveArgs(modeOrButtons, buttons);
|
|
6838
|
+
return this.show({
|
|
6839
|
+
type: AlertType.SUCCESS,
|
|
6840
|
+
title,
|
|
6841
|
+
subtitle,
|
|
6842
|
+
buttonMode,
|
|
6843
|
+
buttons: buttonConfig,
|
|
6844
|
+
});
|
|
6845
|
+
}
|
|
6846
|
+
/**
|
|
6847
|
+
* Displays an error alert with red styling.
|
|
6848
|
+
* Can be called with (title, subtitle, buttonMode, buttons) OR (title, subtitle, buttons).
|
|
6849
|
+
*/
|
|
6850
|
+
error(title, subtitle, modeOrButtons, buttons) {
|
|
6851
|
+
const { buttonMode, buttonConfig } = this.resolveArgs(modeOrButtons, buttons);
|
|
6852
|
+
return this.show({
|
|
6853
|
+
type: AlertType.ERROR,
|
|
6854
|
+
title,
|
|
6855
|
+
subtitle,
|
|
6856
|
+
buttonMode,
|
|
6857
|
+
buttons: buttonConfig,
|
|
6858
|
+
});
|
|
6859
|
+
}
|
|
6860
|
+
/**
|
|
6861
|
+
* Helper to resolve flexible arguments.
|
|
6862
|
+
* If 3rd arg is object (not string enum), treat it as buttons config and default mode to OK_ONLY.
|
|
6863
|
+
* If 3rd arg is string (enum), treat it as mode and 4th as buttons config.
|
|
6864
|
+
*/
|
|
6865
|
+
resolveArgs(modeOrButtons, buttons) {
|
|
6866
|
+
if (modeOrButtons && typeof modeOrButtons === 'object') {
|
|
6867
|
+
// USAGE: success(title, subtitle, { confirmText: 'Ok', cancelText: 'Cancel' })
|
|
6868
|
+
// Auto-detect mode based on presence of cancelText
|
|
6869
|
+
const hasCancel = !!modeOrButtons.cancelText;
|
|
6870
|
+
return {
|
|
6871
|
+
buttonMode: hasCancel ? AlertButtonMode.CONFIRM_CANCEL : AlertButtonMode.OK_ONLY,
|
|
6872
|
+
buttonConfig: modeOrButtons
|
|
6873
|
+
};
|
|
6874
|
+
}
|
|
6875
|
+
// USAGE: success(title, subtitle, AlertButtonMode.CONFIRM_CANCEL, { ... })
|
|
6876
|
+
// OR default
|
|
6877
|
+
return {
|
|
6878
|
+
buttonMode: modeOrButtons ?? AlertButtonMode.OK_ONLY,
|
|
6879
|
+
buttonConfig: buttons
|
|
6880
|
+
};
|
|
6881
|
+
}
|
|
6882
|
+
message(message, type = AlertType.WARNING) {
|
|
6883
|
+
return this.show({
|
|
6884
|
+
type,
|
|
6885
|
+
title: message,
|
|
6886
|
+
buttonMode: AlertButtonMode.OK_ONLY,
|
|
6887
|
+
});
|
|
6888
|
+
}
|
|
6889
|
+
confirm(title, subtitle, confirmText = "Confirmar", cancelText = "Cancelar", type = AlertType.WARNING) {
|
|
6890
|
+
return this.show({
|
|
6891
|
+
type,
|
|
6892
|
+
title,
|
|
6893
|
+
subtitle,
|
|
6894
|
+
buttonMode: AlertButtonMode.CONFIRM_CANCEL,
|
|
6895
|
+
buttons: { confirmText, cancelText },
|
|
6896
|
+
});
|
|
6897
|
+
}
|
|
6898
|
+
showHtml(title, htmlContent, type = AlertType.WARNING, buttonMode = AlertButtonMode.OK_ONLY) {
|
|
6899
|
+
return this.show({
|
|
6900
|
+
type,
|
|
6901
|
+
title,
|
|
6902
|
+
htmlContent,
|
|
6903
|
+
buttonMode,
|
|
6904
|
+
});
|
|
6905
|
+
}
|
|
6906
|
+
showWithStyles(config, styles) {
|
|
6907
|
+
return this.show({
|
|
6908
|
+
...config,
|
|
6909
|
+
styles,
|
|
6910
|
+
});
|
|
6911
|
+
}
|
|
6912
|
+
show(config) {
|
|
6913
|
+
return new Promise((resolve) => {
|
|
6914
|
+
const mergedConfig = this.mergeWithDefaults(config);
|
|
6915
|
+
const typeConfig = ALERT_TYPE_CONFIG[mergedConfig.type];
|
|
6916
|
+
// Prepare data object for the view
|
|
6917
|
+
const data = {
|
|
6918
|
+
config: mergedConfig,
|
|
6919
|
+
typeConfig: typeConfig,
|
|
6920
|
+
iconClass: this.getIconClass(mergedConfig, typeConfig),
|
|
6921
|
+
iconBackgroundColor: this.getIconBackgroundColor(mergedConfig, typeConfig),
|
|
6922
|
+
iconColor: this.getIconColor(mergedConfig, typeConfig),
|
|
6923
|
+
titleColor: this.getTitleColor(mergedConfig, typeConfig),
|
|
6924
|
+
showCancelButton: this.showCancelButton(mergedConfig),
|
|
6925
|
+
confirmText: this.getConfirmText(mergedConfig),
|
|
6926
|
+
cancelText: this.getCancelText(mergedConfig),
|
|
6927
|
+
dialogStyle: {
|
|
6928
|
+
width: mergedConfig.styles?.width ?? "400px",
|
|
6929
|
+
maxWidth: "90vw",
|
|
6930
|
+
borderRadius: "12px",
|
|
6931
|
+
overflow: "hidden",
|
|
6932
|
+
},
|
|
6933
|
+
confirmButtonStyle: this.getConfirmButtonStyle(mergedConfig),
|
|
6934
|
+
cancelButtonStyle: this.getCancelButtonStyle(mergedConfig),
|
|
6935
|
+
// Add manual dismiss handler to data so template can call it if needed,
|
|
6936
|
+
// though explicit close button in template can just use reject or logic.
|
|
6937
|
+
// For custom headers/X buttons usually we initiate close.
|
|
6938
|
+
};
|
|
6939
|
+
const confirmation = {
|
|
6940
|
+
key: this.DIALOG_KEY,
|
|
6941
|
+
message: mergedConfig.subtitle,
|
|
6942
|
+
header: mergedConfig.title,
|
|
6943
|
+
icon: data.iconClass,
|
|
6944
|
+
dismissableMask: true,
|
|
6945
|
+
closeOnEscape: true,
|
|
6946
|
+
accept: () => {
|
|
6947
|
+
resolve({
|
|
6948
|
+
isConfirmed: true,
|
|
6949
|
+
isCancelled: false,
|
|
6950
|
+
isDismissed: false,
|
|
6951
|
+
});
|
|
6952
|
+
},
|
|
6953
|
+
reject: (type) => {
|
|
6954
|
+
resolve({
|
|
6955
|
+
isConfirmed: false,
|
|
6956
|
+
isCancelled: true,
|
|
6957
|
+
isDismissed: false,
|
|
6958
|
+
});
|
|
6959
|
+
},
|
|
6960
|
+
};
|
|
6961
|
+
// Cast to any to allow 'data' property if it doesn't exist on type
|
|
6962
|
+
confirmation.data = data;
|
|
6963
|
+
this.confirmationService.confirm(confirmation);
|
|
6964
|
+
});
|
|
6965
|
+
}
|
|
6966
|
+
// Private Helper Methods (Presentation Logic)
|
|
6967
|
+
mergeWithDefaults(config) {
|
|
6968
|
+
return {
|
|
6969
|
+
...ALERT_DEFAULTS,
|
|
6970
|
+
...config,
|
|
6971
|
+
buttons: {
|
|
6972
|
+
...ALERT_DEFAULTS.buttons,
|
|
6973
|
+
...config.buttons,
|
|
6974
|
+
},
|
|
6975
|
+
};
|
|
6976
|
+
}
|
|
6977
|
+
getIconClass(config, typeConfig) {
|
|
6978
|
+
if (config?.customIcon) {
|
|
6979
|
+
return config.customIcon;
|
|
6980
|
+
}
|
|
6981
|
+
return typeConfig?.icon ?? "pi pi-info-circle";
|
|
6982
|
+
}
|
|
6983
|
+
getIconBackgroundColor(config, typeConfig) {
|
|
6984
|
+
if (config?.styles?.iconBackgroundColor) {
|
|
6985
|
+
return config.styles.iconBackgroundColor;
|
|
6986
|
+
}
|
|
6987
|
+
return typeConfig?.iconBackgroundColor ?? "#e3f2fd";
|
|
6988
|
+
}
|
|
6989
|
+
getIconColor(config, typeConfig) {
|
|
6990
|
+
if (config?.styles?.iconColor) {
|
|
6991
|
+
return config.styles.iconColor;
|
|
6992
|
+
}
|
|
6993
|
+
return typeConfig?.iconColor ?? "#1976d2";
|
|
6994
|
+
}
|
|
6995
|
+
getTitleColor(config, typeConfig) {
|
|
6996
|
+
if (config?.styles?.titleColor) {
|
|
6997
|
+
return config.styles.titleColor;
|
|
6998
|
+
}
|
|
6999
|
+
return typeConfig?.titleColor ?? "#333";
|
|
7000
|
+
}
|
|
7001
|
+
showCancelButton(config) {
|
|
7002
|
+
return config?.buttonMode === AlertButtonMode.CONFIRM_CANCEL;
|
|
7003
|
+
}
|
|
7004
|
+
getConfirmText(config) {
|
|
7005
|
+
return config?.buttons?.confirmText ?? "Ok";
|
|
7006
|
+
}
|
|
7007
|
+
getCancelText(config) {
|
|
7008
|
+
return config?.buttons?.cancelText ?? "Cancelar";
|
|
7009
|
+
}
|
|
7010
|
+
getConfirmButtonStyle(config) {
|
|
7011
|
+
const styles = config?.styles;
|
|
7012
|
+
const baseStyle = {
|
|
7013
|
+
minWidth: "120px",
|
|
7014
|
+
};
|
|
7015
|
+
if (styles?.confirmButtonColor) {
|
|
7016
|
+
baseStyle["backgroundColor"] = styles.confirmButtonColor;
|
|
7017
|
+
baseStyle["borderColor"] = styles.confirmButtonColor;
|
|
7018
|
+
}
|
|
7019
|
+
if (styles?.confirmButtonTextColor) {
|
|
7020
|
+
baseStyle["color"] = styles.confirmButtonTextColor;
|
|
7021
|
+
}
|
|
7022
|
+
return baseStyle;
|
|
7023
|
+
}
|
|
7024
|
+
getCancelButtonStyle(config) {
|
|
7025
|
+
const styles = config?.styles;
|
|
7026
|
+
const baseStyle = {
|
|
7027
|
+
minWidth: "120px",
|
|
7028
|
+
};
|
|
7029
|
+
if (styles?.cancelButtonColor) {
|
|
7030
|
+
baseStyle["backgroundColor"] = styles.cancelButtonColor;
|
|
7031
|
+
baseStyle["borderColor"] = styles.cancelButtonColor;
|
|
7032
|
+
}
|
|
7033
|
+
if (styles?.cancelButtonTextColor) {
|
|
7034
|
+
baseStyle["color"] = styles.cancelButtonTextColor;
|
|
7035
|
+
}
|
|
7036
|
+
return baseStyle;
|
|
7037
|
+
}
|
|
7038
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.1", ngImport: i0, type: AlertService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
7039
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.1", ngImport: i0, type: AlertService, providedIn: "root" });
|
|
7040
|
+
}
|
|
7041
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.1", ngImport: i0, type: AlertService, decorators: [{
|
|
7042
|
+
type: Injectable,
|
|
7043
|
+
args: [{
|
|
7044
|
+
providedIn: "root",
|
|
7045
|
+
}]
|
|
7046
|
+
}] });
|
|
7047
|
+
|
|
6210
7048
|
class LanguageService {
|
|
6211
7049
|
_http = inject(HttpClient);
|
|
6212
7050
|
_configService = inject(ConfigService);
|
|
@@ -6260,14 +7098,17 @@ class EchartService {
|
|
|
6260
7098
|
},
|
|
6261
7099
|
splitLine: {
|
|
6262
7100
|
show: showSplitLine,
|
|
6263
|
-
lineStyle: {
|
|
6264
|
-
|
|
6265
|
-
|
|
6266
|
-
|
|
6267
|
-
},
|
|
7101
|
+
// lineStyle: {
|
|
7102
|
+
// color: Color.gray,
|
|
7103
|
+
// type: "dashed",
|
|
7104
|
+
// width: 1,
|
|
7105
|
+
// },
|
|
7106
|
+
lineStyle: { width: 1, color: Color.gray, type: [5, 5], cap: "round" },
|
|
6268
7107
|
},
|
|
6269
7108
|
axisLabel: {
|
|
6270
|
-
|
|
7109
|
+
fontFamily: "Lato, sans-serif",
|
|
7110
|
+
show: true,
|
|
7111
|
+
// show: showAxis,
|
|
6271
7112
|
color: Color.gray3,
|
|
6272
7113
|
fontSize: 14,
|
|
6273
7114
|
padding: 10,
|
|
@@ -6277,7 +7118,7 @@ class EchartService {
|
|
|
6277
7118
|
getCategoryAxisConfiguration(data) {
|
|
6278
7119
|
return this.getDefultAxisConfiguration("category", data, true);
|
|
6279
7120
|
}
|
|
6280
|
-
getValueAxisConfiguration(showAxis =
|
|
7121
|
+
getValueAxisConfiguration(showAxis = true, format = true, showAxisLines = true) {
|
|
6281
7122
|
let axisConfiguration = this.getDefultAxisConfiguration("value", undefined, showAxis, showAxisLines);
|
|
6282
7123
|
if (format) {
|
|
6283
7124
|
axisConfiguration.axisLabel.formatter = (value) => this._sharedService.FormatNumberWithSuffix(value);
|
|
@@ -6286,20 +7127,37 @@ class EchartService {
|
|
|
6286
7127
|
}
|
|
6287
7128
|
getGridConfiguration() {
|
|
6288
7129
|
return {
|
|
6289
|
-
left: "0%",
|
|
6290
|
-
right: "0%",
|
|
6291
|
-
//bottom: '0%',
|
|
7130
|
+
// left: "0%",
|
|
7131
|
+
// right: "0%",
|
|
7132
|
+
// //bottom: '0%',
|
|
7133
|
+
// containLabel: true,
|
|
7134
|
+
left: 0,
|
|
7135
|
+
right: 0,
|
|
7136
|
+
top: 20,
|
|
7137
|
+
bottom: 40,
|
|
6292
7138
|
containLabel: true,
|
|
6293
7139
|
};
|
|
6294
7140
|
}
|
|
6295
7141
|
getLegendConfiguration() {
|
|
6296
7142
|
return {
|
|
6297
|
-
orient: "horizontal", // 'horizontal | vertical'
|
|
6298
|
-
icon: "circle",
|
|
6299
|
-
bottom: 5,
|
|
6300
|
-
align: "auto",
|
|
6301
|
-
itemGap: 20,
|
|
6302
|
-
textStyle: { color: Color.blue, fontSize: 14 },
|
|
7143
|
+
// orient: "horizontal", // 'horizontal | vertical'
|
|
7144
|
+
// icon: "circle",
|
|
7145
|
+
// bottom: 5,
|
|
7146
|
+
// align: "auto",
|
|
7147
|
+
// itemGap: 20,
|
|
7148
|
+
// textStyle: { color: Color.blue, fontSize: 14 },
|
|
7149
|
+
data: [{ name: "Expenses", icon: "circle" }],
|
|
7150
|
+
bottom: 0,
|
|
7151
|
+
textStyle: {
|
|
7152
|
+
color: "#4E546F",
|
|
7153
|
+
fontFamily: "Lato, sans-serif",
|
|
7154
|
+
fontSize: 12,
|
|
7155
|
+
lineHeight: 12,
|
|
7156
|
+
},
|
|
7157
|
+
itemWidth: 10,
|
|
7158
|
+
itemHeight: 10,
|
|
7159
|
+
itemGap: 25,
|
|
7160
|
+
align: "left",
|
|
6303
7161
|
};
|
|
6304
7162
|
}
|
|
6305
7163
|
/**
|
|
@@ -6335,15 +7193,16 @@ class EchartService {
|
|
|
6335
7193
|
*/
|
|
6336
7194
|
getBarChartOptions(categories, series, labelConfig, tooltipConfig, showLegend = false) {
|
|
6337
7195
|
return {
|
|
7196
|
+
textStyle: { fontFamily: "Lato, sans-serif" },
|
|
6338
7197
|
xAxis: this.getCategoryAxisConfiguration(categories),
|
|
6339
7198
|
yAxis: this.getValueAxisConfiguration(),
|
|
6340
7199
|
series: [
|
|
6341
7200
|
...series.map((item) => ({
|
|
6342
7201
|
type: "bar",
|
|
6343
7202
|
name: item.name,
|
|
6344
|
-
itemStyle: { color: item.color },
|
|
7203
|
+
itemStyle: { color: item.color, borderRadius: 8 },
|
|
6345
7204
|
data: item.value,
|
|
6346
|
-
|
|
7205
|
+
barWidth: "33%",
|
|
6347
7206
|
barGap: "0%",
|
|
6348
7207
|
label: {
|
|
6349
7208
|
show: true,
|
|
@@ -6360,6 +7219,7 @@ class EchartService {
|
|
|
6360
7219
|
borderWidth: 2,
|
|
6361
7220
|
textStyle: { fontSize: 12 },
|
|
6362
7221
|
formatter: tooltipConfig,
|
|
7222
|
+
appendTo: "body",
|
|
6363
7223
|
},
|
|
6364
7224
|
grid: this.getGridConfiguration(),
|
|
6365
7225
|
legend: showLegend ? this.getLegendConfiguration() : undefined,
|
|
@@ -6399,22 +7259,20 @@ class EchartService {
|
|
|
6399
7259
|
getBarChartHorizontalOptions(categories, series, labelConfig, tooltipConfig, showLegend = false, enableSelectStyle = false // 👈 nuevo
|
|
6400
7260
|
) {
|
|
6401
7261
|
let barBase = this.getBarChartOptions(categories, series, labelConfig, tooltipConfig, showLegend);
|
|
6402
|
-
barBase.xAxis = this.getValueAxisConfiguration();
|
|
7262
|
+
barBase.xAxis = this.getValueAxisConfiguration(false, true, false);
|
|
6403
7263
|
barBase.yAxis = this.getCategoryAxisConfiguration(categories);
|
|
6404
7264
|
barBase.series.forEach((serie, idx) => {
|
|
6405
7265
|
if (serie.label) {
|
|
6406
7266
|
serie.label.position = "right";
|
|
6407
7267
|
}
|
|
6408
|
-
const baseColor = serie.itemStyle?.color ??
|
|
6409
|
-
(series[idx] && series[idx].color) ??
|
|
6410
|
-
'#FF8A00';
|
|
7268
|
+
const baseColor = serie.itemStyle?.color ?? (series[idx] && series[idx].color) ?? "#FF8A00";
|
|
6411
7269
|
serie.itemStyle = {
|
|
6412
7270
|
...(serie.itemStyle || {}),
|
|
6413
7271
|
color: baseColor,
|
|
6414
7272
|
borderWidth: 0,
|
|
6415
7273
|
};
|
|
6416
7274
|
if (enableSelectStyle) {
|
|
6417
|
-
serie.selectedMode =
|
|
7275
|
+
serie.selectedMode = "single";
|
|
6418
7276
|
const selectedColor = darkenColor(String(baseColor), 0.38);
|
|
6419
7277
|
serie.select = {
|
|
6420
7278
|
itemStyle: {
|
|
@@ -6478,9 +7336,9 @@ class EchartService {
|
|
|
6478
7336
|
const y = barBase.yAxis;
|
|
6479
7337
|
const gr = barBase.grid;
|
|
6480
7338
|
const defaultCategoryFormatter = (value, index) => {
|
|
6481
|
-
const sangriaBase =
|
|
7339
|
+
const sangriaBase = "\u2008\u2008\u2008\u2008\u2008\u2008\u2009";
|
|
6482
7340
|
const lineLength = 35;
|
|
6483
|
-
const text = String(value ??
|
|
7341
|
+
const text = String(value ?? "");
|
|
6484
7342
|
const prefix = `${index + 1} - `;
|
|
6485
7343
|
const digitCount = String(index + 1).length;
|
|
6486
7344
|
let extraRepeat = 0;
|
|
@@ -6488,10 +7346,10 @@ class EchartService {
|
|
|
6488
7346
|
extraRepeat = 2;
|
|
6489
7347
|
else if (digitCount === 3)
|
|
6490
7348
|
extraRepeat = 5;
|
|
6491
|
-
const sangria = sangriaBase +
|
|
6492
|
-
const words = text.split(
|
|
7349
|
+
const sangria = sangriaBase + "\u2008".repeat(extraRepeat);
|
|
7350
|
+
const words = text.split(" ");
|
|
6493
7351
|
const lines = [];
|
|
6494
|
-
let current =
|
|
7352
|
+
let current = "";
|
|
6495
7353
|
for (const w of words) {
|
|
6496
7354
|
const test = current ? `${current} ${w}` : w;
|
|
6497
7355
|
if (test.length <= lineLength)
|
|
@@ -6504,28 +7362,28 @@ class EchartService {
|
|
|
6504
7362
|
}
|
|
6505
7363
|
if (current)
|
|
6506
7364
|
lines.push(current);
|
|
6507
|
-
return prefix + lines.map((ln, i) => (i === 0 ? ln : `${sangria}${ln}`)).join(
|
|
6508
|
-
};
|
|
6509
|
-
y.inverse = true;
|
|
6510
|
-
y.axisLabel = {
|
|
6511
|
-
...y.axisLabel,
|
|
6512
|
-
color: Color.blue,
|
|
6513
|
-
fontSize: 12,
|
|
6514
|
-
width: categoryWidth,
|
|
6515
|
-
overflow: "break",
|
|
6516
|
-
align: "left",
|
|
6517
|
-
verticalAlign: "middle",
|
|
6518
|
-
margin: categoryWidth + 30,
|
|
6519
|
-
lineHeight: 16,
|
|
6520
|
-
formatter: categoryFormatter || defaultCategoryFormatter,
|
|
7365
|
+
return prefix + lines.map((ln, i) => (i === 0 ? ln : `${sangria}${ln}`)).join("\n");
|
|
6521
7366
|
};
|
|
7367
|
+
// y.inverse = true;
|
|
7368
|
+
// y.axisLabel = {
|
|
7369
|
+
// ...y.axisLabel,
|
|
7370
|
+
// color: Color.blue,
|
|
7371
|
+
// fontSize: 12,
|
|
7372
|
+
// width: categoryWidth,
|
|
7373
|
+
// overflow: "break",
|
|
7374
|
+
// align: "left",
|
|
7375
|
+
// verticalAlign: "middle",
|
|
7376
|
+
// margin: categoryWidth + 30,
|
|
7377
|
+
// lineHeight: 16,
|
|
7378
|
+
// formatter: categoryFormatter || defaultCategoryFormatter,
|
|
7379
|
+
// };
|
|
6522
7380
|
gr.top = "0%";
|
|
6523
7381
|
gr.left = -1 * categoryWidth + 60;
|
|
6524
7382
|
gr.right = 20;
|
|
6525
7383
|
gr.bottom = "0%";
|
|
6526
7384
|
gr.containLabel = true;
|
|
6527
7385
|
}
|
|
6528
|
-
barBase.series.forEach(
|
|
7386
|
+
barBase.series.forEach(serie => {
|
|
6529
7387
|
serie.label = {
|
|
6530
7388
|
...(serie.label || {}),
|
|
6531
7389
|
formatter: labelConfig,
|
|
@@ -6570,6 +7428,7 @@ class EchartService {
|
|
|
6570
7428
|
borderWidth: 2,
|
|
6571
7429
|
textStyle: { fontSize: 12 },
|
|
6572
7430
|
formatter: tooltipConfig,
|
|
7431
|
+
appendTo: "body ",
|
|
6573
7432
|
},
|
|
6574
7433
|
dataZoom: [
|
|
6575
7434
|
{
|
|
@@ -6637,6 +7496,7 @@ class EchartService {
|
|
|
6637
7496
|
tooltip: {
|
|
6638
7497
|
trigger: "item",
|
|
6639
7498
|
formatter: tooltipConfig,
|
|
7499
|
+
appendTo: "body",
|
|
6640
7500
|
// extraCssText: this.chartService.getTooltipCssText(),
|
|
6641
7501
|
},
|
|
6642
7502
|
legend: {
|
|
@@ -6670,6 +7530,7 @@ class EchartService {
|
|
|
6670
7530
|
return {
|
|
6671
7531
|
tooltip: {
|
|
6672
7532
|
trigger: "none",
|
|
7533
|
+
appendTo: "body",
|
|
6673
7534
|
},
|
|
6674
7535
|
series: [
|
|
6675
7536
|
{
|
|
@@ -6700,6 +7561,118 @@ class EchartService {
|
|
|
6700
7561
|
],
|
|
6701
7562
|
};
|
|
6702
7563
|
}
|
|
7564
|
+
/**
|
|
7565
|
+
* Semi doughnut gauge (half circle) with:
|
|
7566
|
+
* - Progress arc
|
|
7567
|
+
* - End dot
|
|
7568
|
+
* - Center letter
|
|
7569
|
+
*
|
|
7570
|
+
* @param letter - Text to show in the center
|
|
7571
|
+
* @param value - Current value
|
|
7572
|
+
* @param textSize - Center letter font size
|
|
7573
|
+
* @param color - Progress and end dot color
|
|
7574
|
+
* @param total - Max value (default 100)
|
|
7575
|
+
*/
|
|
7576
|
+
getRateSemiDoughnutOptions(letter, value, textSize, color, total = 100) {
|
|
7577
|
+
const safeTotal = total > 0 ? total : 100;
|
|
7578
|
+
const safeValue = Math.max(0, Math.min(value, safeTotal));
|
|
7579
|
+
const START_ANGLE = 210;
|
|
7580
|
+
const END_ANGLE = -30;
|
|
7581
|
+
const THICKNESS = 22;
|
|
7582
|
+
const BACKGROUND_COLOR = "#D9D9E3";
|
|
7583
|
+
const TEXT_COLOR = "#4F5470";
|
|
7584
|
+
const MIN_LABEL = "0";
|
|
7585
|
+
const MAX_LABEL = String(safeTotal);
|
|
7586
|
+
const MIN_MAX_FONT_SIZE = 15;
|
|
7587
|
+
return {
|
|
7588
|
+
tooltip: { trigger: "none", appendTo: "body" },
|
|
7589
|
+
series: [
|
|
7590
|
+
/* ================= GAUGE 1: PROGRESS ================= */
|
|
7591
|
+
{
|
|
7592
|
+
type: "gauge",
|
|
7593
|
+
startAngle: START_ANGLE,
|
|
7594
|
+
endAngle: END_ANGLE,
|
|
7595
|
+
min: 0,
|
|
7596
|
+
max: safeTotal,
|
|
7597
|
+
pointer: { show: false },
|
|
7598
|
+
progress: {
|
|
7599
|
+
show: true,
|
|
7600
|
+
roundCap: true,
|
|
7601
|
+
width: THICKNESS,
|
|
7602
|
+
itemStyle: { color },
|
|
7603
|
+
},
|
|
7604
|
+
axisLine: {
|
|
7605
|
+
roundCap: true,
|
|
7606
|
+
lineStyle: {
|
|
7607
|
+
width: THICKNESS,
|
|
7608
|
+
color: [[1, BACKGROUND_COLOR]],
|
|
7609
|
+
},
|
|
7610
|
+
},
|
|
7611
|
+
axisTick: { show: false },
|
|
7612
|
+
splitLine: { show: false },
|
|
7613
|
+
axisLabel: { show: false },
|
|
7614
|
+
detail: {
|
|
7615
|
+
show: true,
|
|
7616
|
+
offsetCenter: [0, "0%"],
|
|
7617
|
+
fontSize: textSize,
|
|
7618
|
+
fontWeight: 700,
|
|
7619
|
+
color: TEXT_COLOR,
|
|
7620
|
+
formatter: () => letter,
|
|
7621
|
+
},
|
|
7622
|
+
data: [
|
|
7623
|
+
{
|
|
7624
|
+
value: safeValue,
|
|
7625
|
+
name: "0",
|
|
7626
|
+
title: {
|
|
7627
|
+
show: true,
|
|
7628
|
+
formatter: () => MIN_LABEL,
|
|
7629
|
+
offsetCenter: ["-80%", "66%"],
|
|
7630
|
+
fontSize: MIN_MAX_FONT_SIZE,
|
|
7631
|
+
color: TEXT_COLOR,
|
|
7632
|
+
},
|
|
7633
|
+
},
|
|
7634
|
+
{
|
|
7635
|
+
value: safeValue,
|
|
7636
|
+
name: "100",
|
|
7637
|
+
title: {
|
|
7638
|
+
show: true,
|
|
7639
|
+
formatter: () => MAX_LABEL,
|
|
7640
|
+
offsetCenter: ["80%", "66%"],
|
|
7641
|
+
fontSize: MIN_MAX_FONT_SIZE,
|
|
7642
|
+
color: TEXT_COLOR,
|
|
7643
|
+
},
|
|
7644
|
+
},
|
|
7645
|
+
],
|
|
7646
|
+
},
|
|
7647
|
+
/* ================= GAUGE 2: END DOT ================= */
|
|
7648
|
+
{
|
|
7649
|
+
type: "gauge",
|
|
7650
|
+
startAngle: START_ANGLE,
|
|
7651
|
+
endAngle: END_ANGLE,
|
|
7652
|
+
min: 0,
|
|
7653
|
+
max: safeTotal,
|
|
7654
|
+
axisLine: { show: false },
|
|
7655
|
+
progress: { show: false },
|
|
7656
|
+
splitLine: { show: false },
|
|
7657
|
+
axisTick: { show: false },
|
|
7658
|
+
axisLabel: { show: false },
|
|
7659
|
+
detail: { show: false },
|
|
7660
|
+
pointer: {
|
|
7661
|
+
show: true,
|
|
7662
|
+
length: "183%",
|
|
7663
|
+
width: 38,
|
|
7664
|
+
icon: "circle",
|
|
7665
|
+
itemStyle: {
|
|
7666
|
+
color,
|
|
7667
|
+
borderColor: BACKGROUND_COLOR,
|
|
7668
|
+
borderWidth: 4,
|
|
7669
|
+
},
|
|
7670
|
+
},
|
|
7671
|
+
data: [{ value: safeValue }],
|
|
7672
|
+
},
|
|
7673
|
+
],
|
|
7674
|
+
};
|
|
7675
|
+
}
|
|
6703
7676
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.1", ngImport: i0, type: EchartService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
6704
7677
|
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.1", ngImport: i0, type: EchartService, providedIn: "root" });
|
|
6705
7678
|
}
|
|
@@ -9190,5 +10163,5 @@ const IntelicaTheme = definePreset(Aura, {
|
|
|
9190
10163
|
* Generated bundle index. Do not edit.
|
|
9191
10164
|
*/
|
|
9192
10165
|
|
|
9193
|
-
export { ActionDirective, ActionsMenuComponent, ButtonSplitComponent, CheckboxFilterDirective, Color, ColumnComponent, ColumnGroupComponent, CompareByField, ConfigService, CookieAttributesGeneral, DataDirective, DateFilterDirective, DateModeOptions, DynamicInputValidation, EchartComponent, EchartService, ElementService, EmailInputValidation, ErrorInterceptor, FeatureFlagService, FilterChipsComponent, FiltersComponent, FormatAmountPipe, GetCookieAttributes, GlobalFeatureFlagService, GlobalTermService, HtmlToExcelService, InitializeConfigService, InputValidation, IntelicaCellCheckboxDirective, IntelicaTheme, ItemSplitDirective, LanguageService, MatrixColumnComponent, MatrixColumnGroupComponent, MatrixTableComponent, ModalDialogComponent, MultiSelectComponent, OrderConstants, PaginatorComponent, Patterns, PopoverComponent, ProfileService, RecordPerPageComponent, RefreshTokenInterceptor, RouteGuard, RowResumenComponent, RowResumenTreeComponent, SearchComponent, SelectDetailFilterDirective, SelectFilterDirective, SharedService, SkeletonChartComponent, SkeletonComponent, SkeletonService, SkeletonTableComponent, SortingComponent, SpinnerComponent, SpinnerService, SweetAlertService, TableComponent, TableFetchComponent, TableSortOrder, TemplateDirective, TemplateMenuComponent, TermGuard, TermPipe, TermService, TextAreaFilterDirective, TextFilterDirective, TextRangeFilterDirective, TreeColumnComponent, TreeColumnGroupComponent, TreeTableComponent, TruncatePipe, decryptData, encryptData, getColor };
|
|
10166
|
+
export { ALERT_DEFAULTS, ALERT_ICON_PATHS, ALERT_TYPE_CONFIG, ActionDirective, ActionsMenuComponent, AddFavoritesComponent, AlertButtonMode, AlertService, AlertType, ButtonSplitComponent, CheckboxFilterDirective, Color, ColumnComponent, ColumnGroupComponent, CompareByField, ConfigService, CookieAttributesGeneral, DATEPICKER_BUTTON_TYPES, DataDirective, DateFilterDirective, DateModeOptions, DatepickerComponent, DynamicInputValidation, EchartComponent, EchartService, ElementService, EmailInputValidation, ErrorInterceptor, FeatureFlagService, FilterChipsComponent, FiltersComponent, FormatAmountPipe, GetCookieAttributes, GlobalFeatureFlagService, GlobalTermService, HtmlToExcelService, InitializeConfigService, InputValidation, IntelicaAlertComponent, IntelicaCellCheckboxDirective, IntelicaTheme, ItemSplitDirective, LanguageService, MatrixColumnComponent, MatrixColumnGroupComponent, MatrixTableComponent, ModalDialogComponent, MultiSelectComponent, OrderConstants, PaginatorComponent, Patterns, PopoverComponent, ProfileService, RecordPerPageComponent, RefreshTokenInterceptor, RouteGuard, RowResumenComponent, RowResumenTreeComponent, SearchComponent, SelectDetailFilterDirective, SelectFilterDirective, SharedService, SkeletonChartComponent, SkeletonComponent, SkeletonService, SkeletonTableComponent, SortingComponent, SpinnerComponent, SpinnerService, SweetAlertService, TableComponent, TableFetchComponent, TableSortOrder, TemplateDirective, TemplateMenuComponent, TermGuard, TermPipe, TermService, TextAreaFilterDirective, TextFilterDirective, TextRangeFilterDirective, TreeColumnComponent, TreeColumnGroupComponent, TreeTableComponent, TruncatePipe, decryptData, encryptData, getColor };
|
|
9194
10167
|
//# sourceMappingURL=intelica-library-components.mjs.map
|