intelica-library-ui 0.1.77 → 0.1.79

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.
@@ -156,6 +156,19 @@ const domain = window.location.hostname.split(".").slice(-2).join(".");
156
156
  const secure = !domain.includes("localhost");
157
157
  const CookieAttributesGeneral = { domain: domain, path: "/", secure: secure };
158
158
 
159
+ const Color = {
160
+ mastercard: '#ff7f00',
161
+ visa: '#17375E',
162
+ amex: '#348AD5',
163
+ orange: '#ff7f00',
164
+ blue: '#17375E',
165
+ gray: '#D3D3D3',
166
+ gray3: '#a6a5a1',
167
+ };
168
+ const getColor = (name) => {
169
+ return Color[name];
170
+ };
171
+
159
172
  class FeatureFlagService {
160
173
  _http = inject(HttpClient);
161
174
  _configService = inject(ConfigService);
@@ -2553,6 +2566,163 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.1", ngImpor
2553
2566
  type: Output
2554
2567
  }] } });
2555
2568
 
2569
+ class TemplateMenuComponent {
2570
+ termPipe;
2571
+ GlobalTermService = inject(GlobalTermService);
2572
+ Popover;
2573
+ MenuButton;
2574
+ PopoverContainer;
2575
+ template;
2576
+ IsPopoverOpen = false;
2577
+ IsClickInsideDatepicker = false;
2578
+ /**
2579
+ * Indica si el menú de acciones está visible o no.
2580
+ * @type {boolean}
2581
+ * @default false
2582
+ */
2583
+ ShowActionsMenu = false;
2584
+ /**
2585
+ * Indica si la sección de selección de acciones está visible o no.
2586
+ * @type {boolean}
2587
+ * @default false
2588
+ */
2589
+ ShowSelectActions = false;
2590
+ constructor(termPipe) {
2591
+ this.termPipe = termPipe;
2592
+ }
2593
+ ngOnInit() {
2594
+ // const specificRegex = /local.*filt|filt.*local/i;
2595
+ // const generalRegex = /filt/i;
2596
+ // const specificResults = this.actions.filter(action => specificRegex.test(action.name));
2597
+ // if (specificResults.length === 0) {
2598
+ // const generalResults = this.actions.filter(action => generalRegex.test(action.name));
2599
+ // generalResults.forEach(action => this.showTemplate(action));
2600
+ // } else {
2601
+ // specificResults.forEach(action => this.showTemplate(action));
2602
+ // }
2603
+ }
2604
+ openPopover() {
2605
+ this.IsPopoverOpen = true;
2606
+ // Cambia el estado de visibilidad del menú de acciones.
2607
+ this.ShowActionsMenu = true;
2608
+ // Muestra u oculta el menú de selección de acciones.
2609
+ this.ShowSelectActions = true;
2610
+ this.Popover.nativeElement.style.display = "block";
2611
+ this.MenuButton.nativeElement.classList.add("active");
2612
+ this.PopoverContainer.nativeElement.classList.add("backdrop-visible");
2613
+ }
2614
+ closePopover() {
2615
+ this.IsPopoverOpen = false;
2616
+ // Cambia el estado de visibilidad del menú de acciones.
2617
+ this.ShowActionsMenu = false;
2618
+ // Muestra u oculta el menú de selección de acciones.
2619
+ this.ShowSelectActions = true;
2620
+ this.Popover.nativeElement.style.display = "none";
2621
+ this.MenuButton.nativeElement.classList.remove("active");
2622
+ this.PopoverContainer.nativeElement.classList.remove("backdrop-visible");
2623
+ }
2624
+ /** Método para alternar el estado del popover */
2625
+ togglePopover(event) {
2626
+ this.IsPopoverOpen ? this.closePopover() : this.openPopover();
2627
+ }
2628
+ onMouseDown(event) {
2629
+ const target = event.target;
2630
+ if (target.closest(".p-datepicker") || target.closest(".p-inputtext") || target.closest(".p-select-panel") || target.closest(".p-multiselect-panel")) {
2631
+ this.IsClickInsideDatepicker = true;
2632
+ }
2633
+ }
2634
+ onMouseDownOutsideBody(event) {
2635
+ const target = event.target;
2636
+ if (target.closest(".p-datepicker") || target.closest(".p-inputtext") || target.closest(".p-select-panel") || target.closest(".p-multiselect-panel")) {
2637
+ this.IsClickInsideDatepicker = true;
2638
+ }
2639
+ }
2640
+ onMouseUp(event) {
2641
+ setTimeout(() => {
2642
+ this.IsClickInsideDatepicker = false;
2643
+ }, 100);
2644
+ }
2645
+ closeAll(event) {
2646
+ if (!event)
2647
+ return;
2648
+ const target = event.target;
2649
+ const allowedClasses = [
2650
+ "prSelect",
2651
+ "p-select-option-selected",
2652
+ "p-select-option",
2653
+ "p-datepicker-panel",
2654
+ "p-datepicker-select-month",
2655
+ "p-button-text",
2656
+ "p-datepicker-select-year",
2657
+ "p-datepicker-month",
2658
+ "p-datepicker-year",
2659
+ "p-checkbox-input",
2660
+ "p-multiselect-option",
2661
+ "p-multiselect-filter",
2662
+ "p-multiselect-empty-message",
2663
+ "p-inputicon",
2664
+ "p-tree-node-selected",
2665
+ "p-tree-node-content",
2666
+ "p-multiselect-header",
2667
+ "grButton--icon-close-modal",
2668
+ "p-overlay-mask",
2669
+ "p-select-clear-icon",
2670
+ "formRowInputClear",
2671
+ "icon-times",
2672
+ "p-select-empty-message",
2673
+ "p-select-list",
2674
+ "p-iconfield",
2675
+ "p-inputtext",
2676
+ "p-select-header",
2677
+ "p-overlay",
2678
+ "p-select-filter",
2679
+ "p-overlay-content",
2680
+ "p-select-overlay",
2681
+ "p-select-panel",
2682
+ "p-multiselect-panel",
2683
+ ];
2684
+ if (this.IsClickInsideDatepicker) {
2685
+ return;
2686
+ }
2687
+ if (allowedClasses.some(className => target.closest(`.${className}`))) {
2688
+ return;
2689
+ }
2690
+ if (this.Popover && !this.Popover.nativeElement.contains(target) && this.MenuButton && !this.MenuButton.nativeElement.contains(target)) {
2691
+ this.closePopover();
2692
+ }
2693
+ }
2694
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: TemplateMenuComponent, deps: [{ token: TermPipe }], target: i0.ɵɵFactoryTarget.Component });
2695
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.1", type: TemplateMenuComponent, isStandalone: true, selector: "intelica-template-menu", host: { listeners: { "mousedown": "onMouseDown($event)", "window:mousedown": "onMouseDownOutsideBody($event)", "mouseup": "onMouseUp($event)", "document:click": "closeAll($event)" } }, queries: [{ propertyName: "template", first: true, predicate: ["template"], descendants: true, static: true }], viewQueries: [{ propertyName: "Popover", first: true, predicate: ["popover"], descendants: true }, { propertyName: "MenuButton", first: true, predicate: ["menuButton"], descendants: true }, { propertyName: "PopoverContainer", first: true, predicate: ["popoverContainer"], descendants: true }], ngImport: i0, template: "<div #popoverContainer class=\"grPopoverContainer\">\r\n\t<button #menuButton class=\"grMenuTemplate\" (click)=\"togglePopover($event)\">\r\n\t\t<span class=\"grMenuTemplate__ico\"><i class=\"icon icon-filter-option\"></i></span>\r\n\t\t<span class=\"grMenuTemplate__txt\">{{ \"Filters\" | term : GlobalTermService.languageCode }}</span>\r\n\t</button>\r\n\t<div class=\"grPopover\" #popover>\r\n\t\t<!-- Men\u00FA -->\r\n\t\t<div class=\"grPopoverMenu\" *ngIf=\"ShowActionsMenu\" [ngClass]=\"{ hidden: !ShowSelectActions }\">\r\n\t\t\t<div class=\"grPopoverHeader\">\r\n\t\t\t\t<h3>\r\n\t\t\t\t\t<span>{{ \"Filters\" | term : GlobalTermService.languageCode }}</span>\r\n\t\t\t\t</h3>\r\n\t\t\t</div>\r\n\t\t\t<div class=\"grPopoverBody grPopoverBody--template\">\r\n\t\t\t\t<ng-container *ngIf=\"template\">\r\n\t\t\t\t\t<ng-container [ngTemplateOutlet]=\"template\"></ng-container>\r\n\t\t\t\t</ng-container>\r\n\t\t\t</div>\r\n\t\t</div>\r\n\t</div>\r\n</div>\r\n", dependencies: [{ kind: "ngmodule", type: ButtonModule }, { kind: "ngmodule", type: InputGroupAddonModule }, { kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1$1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1$1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "ngmodule", type: RippleModule }, { kind: "pipe", type: TermPipe, name: "term" }] });
2696
+ }
2697
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: TemplateMenuComponent, decorators: [{
2698
+ type: Component,
2699
+ args: [{ selector: "intelica-template-menu", imports: [ButtonModule, InputGroupAddonModule, CommonModule, RippleModule, TermPipe], template: "<div #popoverContainer class=\"grPopoverContainer\">\r\n\t<button #menuButton class=\"grMenuTemplate\" (click)=\"togglePopover($event)\">\r\n\t\t<span class=\"grMenuTemplate__ico\"><i class=\"icon icon-filter-option\"></i></span>\r\n\t\t<span class=\"grMenuTemplate__txt\">{{ \"Filters\" | term : GlobalTermService.languageCode }}</span>\r\n\t</button>\r\n\t<div class=\"grPopover\" #popover>\r\n\t\t<!-- Men\u00FA -->\r\n\t\t<div class=\"grPopoverMenu\" *ngIf=\"ShowActionsMenu\" [ngClass]=\"{ hidden: !ShowSelectActions }\">\r\n\t\t\t<div class=\"grPopoverHeader\">\r\n\t\t\t\t<h3>\r\n\t\t\t\t\t<span>{{ \"Filters\" | term : GlobalTermService.languageCode }}</span>\r\n\t\t\t\t</h3>\r\n\t\t\t</div>\r\n\t\t\t<div class=\"grPopoverBody grPopoverBody--template\">\r\n\t\t\t\t<ng-container *ngIf=\"template\">\r\n\t\t\t\t\t<ng-container [ngTemplateOutlet]=\"template\"></ng-container>\r\n\t\t\t\t</ng-container>\r\n\t\t\t</div>\r\n\t\t</div>\r\n\t</div>\r\n</div>\r\n" }]
2700
+ }], ctorParameters: () => [{ type: TermPipe }], propDecorators: { Popover: [{
2701
+ type: ViewChild,
2702
+ args: ["popover"]
2703
+ }], MenuButton: [{
2704
+ type: ViewChild,
2705
+ args: ["menuButton"]
2706
+ }], PopoverContainer: [{
2707
+ type: ViewChild,
2708
+ args: ["popoverContainer"]
2709
+ }], template: [{
2710
+ type: ContentChild,
2711
+ args: ["template", { static: true }]
2712
+ }], onMouseDown: [{
2713
+ type: HostListener,
2714
+ args: ["mousedown", ["$event"]]
2715
+ }], onMouseDownOutsideBody: [{
2716
+ type: HostListener,
2717
+ args: ["window:mousedown", ["$event"]]
2718
+ }], onMouseUp: [{
2719
+ type: HostListener,
2720
+ args: ["mouseup", ["$event"]]
2721
+ }], closeAll: [{
2722
+ type: HostListener,
2723
+ args: ["document:click", ["$event"]]
2724
+ }] } });
2725
+
2556
2726
  class HtmlToExcelService {
2557
2727
  ExportTOExcel(idTabla, html, filename, tabname, extension) {
2558
2728
  let Table = document.getElementById(idTabla);
@@ -2940,30 +3110,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.1", ngImpor
2940
3110
  }] });
2941
3111
 
2942
3112
  class EchartService {
2943
- getDefaultSeriesColors() {
3113
+ _sharedService = inject(SharedService);
3114
+ /// Chart Generals
3115
+ getDefultAxisConfiguration(type, data, showAxis = true, showSplitLine = false) {
2944
3116
  return {
2945
- mastercard: "#ff7f00",
2946
- visa: "#17375E",
2947
- amex: "#348AD5",
2948
- orange: "#ff7f00",
2949
- blue: "#17375E",
2950
- gray: "#D3D3D3",
2951
- gray3: "#a6a5a1",
2952
- };
2953
- }
2954
- getTooltipCssText() {
2955
- return `border-color: ${this.getDefaultSeriesColors()["blue"]};`;
2956
- }
2957
- getTooltipFormatter(htmlContent) {
2958
- return `
2959
- <div>
2960
- ${htmlContent}
2961
- </div>
2962
- `;
2963
- }
2964
- getDefultAxisConfiguration(type, show = true, data) {
2965
- let axis = {
2966
- show: show,
3117
+ show: showAxis,
2967
3118
  type: type,
2968
3119
  data: data,
2969
3120
  axisTick: {
@@ -2971,31 +3122,149 @@ class EchartService {
2971
3122
  },
2972
3123
  axisLine: {
2973
3124
  show: false,
3125
+ lineStyle: { color: getColor('gray'), type: 'dashed' },
2974
3126
  },
2975
3127
  splitLine: {
2976
- show: false,
3128
+ show: showSplitLine,
3129
+ lineStyle: {
3130
+ color: Color.gray,
3131
+ type: 'dashed',
3132
+ width: 1,
3133
+ },
2977
3134
  },
2978
3135
  axisLabel: {
2979
- color: this.getDefaultSeriesColors()["blue"],
2980
- fontSize: 12,
3136
+ show: showAxis,
3137
+ color: Color.gray3,
3138
+ fontSize: 14,
3139
+ padding: 10,
2981
3140
  },
2982
3141
  };
2983
- return axis;
3142
+ }
3143
+ getCategoryAxisConfiguration(data) {
3144
+ return this.getDefultAxisConfiguration('category', data, true);
3145
+ }
3146
+ getValueAxisConfiguration(showAxis = false, format = false, showAxisLines = false) {
3147
+ let axisConfiguration = this.getDefultAxisConfiguration('value', undefined, showAxis, showAxisLines);
3148
+ if (format) {
3149
+ axisConfiguration.axisLabel.formatter = (value) => this._sharedService.FormatNumberWithSuffix(value);
3150
+ }
3151
+ console.log(axisConfiguration);
3152
+ return axisConfiguration;
3153
+ }
3154
+ getTooltipFormatter(color, title, body) {
3155
+ return `
3156
+ <div style="font-size: 12px; color: ${color}; border-radius: 6px; min-width: 120px; text-align: center;">
3157
+ <b style=" font-size: 13px;">${title} </b><br>
3158
+ <hr style="border: 1px solid ${color}; margin: 4px 0;">
3159
+ ${body}
3160
+ </div>
3161
+ `;
3162
+ }
3163
+ getGridConfiguration() {
3164
+ return {
3165
+ left: '10%',
3166
+ right: '10%',
3167
+ bottom: '10%',
3168
+ containLabel: true,
3169
+ };
3170
+ }
3171
+ getLegendConfiguration() {
3172
+ return {
3173
+ orient: 'horizontal', // 'horizontal | vertical'
3174
+ icon: 'circle',
3175
+ bottom: 5,
3176
+ align: 'auto',
3177
+ itemGap: 20,
3178
+ textStyle: { color: Color.blue, fontSize: 14 },
3179
+ };
3180
+ }
3181
+ /// Charts Configuration
3182
+ getBarChartOptions(categories, series, labelConfig, tooltipConfig) {
3183
+ return {
3184
+ xAxis: this.getCategoryAxisConfiguration(categories),
3185
+ yAxis: this.getValueAxisConfiguration(),
3186
+ series: [
3187
+ ...series.map((item) => ({
3188
+ type: 'bar',
3189
+ name: item.name,
3190
+ itemStyle: { color: item.color },
3191
+ data: item.value,
3192
+ barWidth: '25%',
3193
+ barGap: '0%',
3194
+ label: {
3195
+ show: true,
3196
+ position: 'top',
3197
+ color: Color.blue,
3198
+ fontSize: 12,
3199
+ formatter: labelConfig,
3200
+ },
3201
+ })),
3202
+ ],
3203
+ tooltip: {
3204
+ trigger: 'item',
3205
+ backgroundColor: '#FFFFFF',
3206
+ borderWidth: 2,
3207
+ textStyle: { fontSize: 12 },
3208
+ formatter: tooltipConfig,
3209
+ },
3210
+ grid: this.getGridConfiguration(),
3211
+ legend: this.getLegendConfiguration(),
3212
+ };
3213
+ }
3214
+ getBarChartStackOptions(categories, series, labelConfig, tooltipConfig) {
3215
+ let barBase = this.getBarChartOptions(categories, series, labelConfig, tooltipConfig);
3216
+ barBase.series.forEach((serie, index) => {
3217
+ serie.barWidth = '50%';
3218
+ serie.barGap = '0%';
3219
+ serie.barCategoryGap = '10%';
3220
+ serie.stack = 'total';
3221
+ if (index < series.length - 1) {
3222
+ serie.label = undefined;
3223
+ }
3224
+ });
3225
+ return barBase;
3226
+ }
3227
+ getBarChartHorizontalOptions(categories, series, labelConfig, tooltipConfig) {
3228
+ let barBase = this.getBarChartOptions(categories, series, labelConfig, tooltipConfig);
3229
+ barBase.xAxis = this.getValueAxisConfiguration();
3230
+ barBase.yAxis = this.getCategoryAxisConfiguration(categories);
3231
+ barBase.series.forEach((serie) => {
3232
+ if (serie.label) {
3233
+ serie.label.position = 'right';
3234
+ }
3235
+ });
3236
+ return barBase;
3237
+ }
3238
+ getBarChartHorizontalStackOptions(categories, series, labelConfig, tooltipConfig) {
3239
+ let barBase = this.getBarChartHorizontalOptions(categories, series, labelConfig, tooltipConfig);
3240
+ barBase.series.forEach((serie, index) => {
3241
+ serie.barWidth = '50%';
3242
+ serie.barGap = '0%';
3243
+ serie.barCategoryGap = '10%';
3244
+ serie.stack = 'total';
3245
+ if (serie.label) {
3246
+ serie.label.position = 'right';
3247
+ }
3248
+ if (index < series.length - 1) {
3249
+ serie.label = undefined;
3250
+ }
3251
+ });
3252
+ return barBase;
2984
3253
  }
2985
3254
  getRateDoughnutPie(data) {
2986
- const rateData = data.find(d => d.name.toLowerCase() !== "placeholder");
3255
+ const rateData = data.find((d) => d.name.toLowerCase() !== 'placeholder');
2987
3256
  return {
2988
3257
  tooltip: {
2989
- trigger: "none",
3258
+ trigger: 'none',
2990
3259
  },
2991
3260
  series: [
2992
3261
  {
2993
- name: "RateDoughnutPie",
2994
- type: "pie",
3262
+ name: 'RateDoughnutPie',
3263
+ type: 'pie',
2995
3264
  tooltip: {
2996
- trigger: "none",
3265
+ trigger: 'none',
2997
3266
  },
2998
- radius: ["70%", "60%"],
3267
+ radius: ['70%', '60%'],
2999
3268
  data: data,
3000
3269
  startAngle: 0,
3001
3270
  selectedMode: false,
@@ -3006,20 +3275,20 @@ class EchartService {
3006
3275
  return `${rateData.name}`;
3007
3276
  },
3008
3277
  color: rateData.itemStyle.color,
3009
- fontSize: "40",
3010
- position: "center",
3278
+ fontSize: '40',
3279
+ position: 'center',
3011
3280
  },
3012
3281
  },
3013
3282
  ],
3014
3283
  };
3015
3284
  }
3016
3285
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: EchartService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
3017
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: EchartService, providedIn: "root" });
3286
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: EchartService, providedIn: 'root' });
3018
3287
  }
3019
3288
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: EchartService, decorators: [{
3020
3289
  type: Injectable,
3021
3290
  args: [{
3022
- providedIn: "root",
3291
+ providedIn: 'root',
3023
3292
  }]
3024
3293
  }] });
3025
3294
 
@@ -5446,5 +5715,5 @@ const IntelicaTheme = definePreset(Aura, {
5446
5715
  * Generated bundle index. Do not edit.
5447
5716
  */
5448
5717
 
5449
- export { ActionDirective, ActionsMenuComponent, ButtonSplitComponent, ColumnComponent, ColumnGroupComponent, CompareByField, ConfigService, CookieAttributesGeneral, DynamicInputValidation, EchartComponent, EchartService, EmailInputValidation, ErrorInterceptor, FeatureFlagService, GlobalFeatureFlagService, GlobalTermService, HtmlToExcelService, InitializeConfigService, InputValidation, IntelicaTheme, ItemSplitDirective, LanguageService, ModalDialogComponent, OrderConstants, PaginatorComponent, Patterns, PopoverComponent, ProfileService, RecordPerPageComponent, RefreshTokenInterceptor, RowResumenComponent, SearchComponent, SharedService, SortingComponent, SpinnerComponent, SpinnerService, SweetAlertService, TableComponent, TermGuard, TermPipe, TermService, decryptData, encryptData };
5718
+ export { ActionDirective, ActionsMenuComponent, ButtonSplitComponent, Color, ColumnComponent, ColumnGroupComponent, CompareByField, ConfigService, CookieAttributesGeneral, DynamicInputValidation, EchartComponent, EchartService, EmailInputValidation, ErrorInterceptor, FeatureFlagService, GlobalFeatureFlagService, GlobalTermService, HtmlToExcelService, InitializeConfigService, InputValidation, IntelicaTheme, ItemSplitDirective, LanguageService, ModalDialogComponent, OrderConstants, PaginatorComponent, Patterns, PopoverComponent, ProfileService, RecordPerPageComponent, RefreshTokenInterceptor, RowResumenComponent, SearchComponent, SharedService, SortingComponent, SpinnerComponent, SpinnerService, SweetAlertService, TableComponent, TemplateMenuComponent, TermGuard, TermPipe, TermService, decryptData, encryptData, getColor };
5450
5719
  //# sourceMappingURL=intelica-library-ui.mjs.map