intelica-library-ui 0.1.78 → 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);
@@ -3097,30 +3110,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.1", ngImpor
3097
3110
  }] });
3098
3111
 
3099
3112
  class EchartService {
3100
- getDefaultSeriesColors() {
3113
+ _sharedService = inject(SharedService);
3114
+ /// Chart Generals
3115
+ getDefultAxisConfiguration(type, data, showAxis = true, showSplitLine = false) {
3101
3116
  return {
3102
- mastercard: "#ff7f00",
3103
- visa: "#17375E",
3104
- amex: "#348AD5",
3105
- orange: "#ff7f00",
3106
- blue: "#17375E",
3107
- gray: "#D3D3D3",
3108
- gray3: "#a6a5a1",
3109
- };
3110
- }
3111
- getTooltipCssText() {
3112
- return `border-color: ${this.getDefaultSeriesColors()["blue"]};`;
3113
- }
3114
- getTooltipFormatter(htmlContent) {
3115
- return `
3116
- <div>
3117
- ${htmlContent}
3118
- </div>
3119
- `;
3120
- }
3121
- getDefultAxisConfiguration(type, show = true, data) {
3122
- let axis = {
3123
- show: show,
3117
+ show: showAxis,
3124
3118
  type: type,
3125
3119
  data: data,
3126
3120
  axisTick: {
@@ -3128,31 +3122,149 @@ class EchartService {
3128
3122
  },
3129
3123
  axisLine: {
3130
3124
  show: false,
3125
+ lineStyle: { color: getColor('gray'), type: 'dashed' },
3131
3126
  },
3132
3127
  splitLine: {
3133
- show: false,
3128
+ show: showSplitLine,
3129
+ lineStyle: {
3130
+ color: Color.gray,
3131
+ type: 'dashed',
3132
+ width: 1,
3133
+ },
3134
3134
  },
3135
3135
  axisLabel: {
3136
- color: this.getDefaultSeriesColors()["blue"],
3137
- fontSize: 12,
3136
+ show: showAxis,
3137
+ color: Color.gray3,
3138
+ fontSize: 14,
3139
+ padding: 10,
3138
3140
  },
3139
3141
  };
3140
- 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;
3141
3253
  }
3142
3254
  getRateDoughnutPie(data) {
3143
- const rateData = data.find(d => d.name.toLowerCase() !== "placeholder");
3255
+ const rateData = data.find((d) => d.name.toLowerCase() !== 'placeholder');
3144
3256
  return {
3145
3257
  tooltip: {
3146
- trigger: "none",
3258
+ trigger: 'none',
3147
3259
  },
3148
3260
  series: [
3149
3261
  {
3150
- name: "RateDoughnutPie",
3151
- type: "pie",
3262
+ name: 'RateDoughnutPie',
3263
+ type: 'pie',
3152
3264
  tooltip: {
3153
- trigger: "none",
3265
+ trigger: 'none',
3154
3266
  },
3155
- radius: ["70%", "60%"],
3267
+ radius: ['70%', '60%'],
3156
3268
  data: data,
3157
3269
  startAngle: 0,
3158
3270
  selectedMode: false,
@@ -3163,20 +3275,20 @@ class EchartService {
3163
3275
  return `${rateData.name}`;
3164
3276
  },
3165
3277
  color: rateData.itemStyle.color,
3166
- fontSize: "40",
3167
- position: "center",
3278
+ fontSize: '40',
3279
+ position: 'center',
3168
3280
  },
3169
3281
  },
3170
3282
  ],
3171
3283
  };
3172
3284
  }
3173
3285
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: EchartService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
3174
- 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' });
3175
3287
  }
3176
3288
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: EchartService, decorators: [{
3177
3289
  type: Injectable,
3178
3290
  args: [{
3179
- providedIn: "root",
3291
+ providedIn: 'root',
3180
3292
  }]
3181
3293
  }] });
3182
3294
 
@@ -5603,5 +5715,5 @@ const IntelicaTheme = definePreset(Aura, {
5603
5715
  * Generated bundle index. Do not edit.
5604
5716
  */
5605
5717
 
5606
- 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, TemplateMenuComponent, 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 };
5607
5719
  //# sourceMappingURL=intelica-library-ui.mjs.map