ngx-wapp-components 3.0.14 → 3.0.15-alpha.1

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.
@@ -9263,7 +9263,12 @@ class WChartBarComponent {
9263
9263
  maintainAspectRatio: false,
9264
9264
  aspectRatio: 0.6,
9265
9265
  layout: {
9266
- padding: 12
9266
+ padding: {
9267
+ top: 12,
9268
+ right: 40,
9269
+ left: 12,
9270
+ bottom: 12
9271
+ }
9267
9272
  },
9268
9273
  plugins: {
9269
9274
  title: {
@@ -9302,13 +9307,30 @@ class WChartBarComponent {
9302
9307
  },
9303
9308
  datalabels: {
9304
9309
  display: this._chartConfig.showDataLabels,
9305
- color: this._chartConfig.textColor ?? this.textInverseColor,
9310
+ //color: this._chartConfig.textColor ?? this.textInverseColor,
9311
+ color: (ctx) => {
9312
+ const bg = ctx.dataset?.backgroundColor;
9313
+ const baseFont = this._chartConfig.textColor ?? this.textInverseColor;
9314
+ if (bg) {
9315
+ return this.idealTextColorFor(bg, baseFont);
9316
+ }
9317
+ return baseFont;
9318
+ },
9306
9319
  anchor: 'end',
9307
- align: 'start',
9308
- textStrokeColor: 'rgba(31, 34, 36, 0.6)',
9309
- textStrokeWidth: 2,
9320
+ align: 'end',
9321
+ //textStrokeColor: 'rgba(31, 34, 36, 0.6)',
9322
+ textStrokeColor: (ctx) => {
9323
+ const bg = ctx.dataset?.backgroundColor;
9324
+ const baseFont = this._chartConfig.textColor ?? this.textInverseColor;
9325
+ if (bg) {
9326
+ return this.idealTextStrokeColorFor(bg, baseFont);
9327
+ }
9328
+ return 'rgba(31, 34, 36, 0.6)';
9329
+ },
9330
+ textStrokeWidth: 0,
9310
9331
  font: {
9311
- size: 10
9332
+ size: 16,
9333
+ weight: 'bold'
9312
9334
  },
9313
9335
  formatter: function (value, index, values) { return value || null; }
9314
9336
  }
@@ -9388,16 +9410,17 @@ class WChartBarComponent {
9388
9410
  fillData() {
9389
9411
  let lengths = [];
9390
9412
  this._chartConfig.data.forEach((element, index) => {
9391
- this.data.datasets.push({
9392
- type: 'bar',
9393
- label: element.legend,
9394
- backgroundColor: element.color || this.style.getPropertyValue(index == 0 ? '--w-primary-800' : '--w-primary-100'),
9395
- data: element.data,
9396
- borderRadius: 4,
9397
- barThickness: this._chartConfig.widthBars ?? this.widthBars,
9398
- extraLegend: element.extraLegend,
9399
- extraData: element.extraData || [],
9400
- });
9413
+ this.backgroundColor =
9414
+ this.data.datasets.push({
9415
+ type: 'bar',
9416
+ label: element.legend,
9417
+ backgroundColor: element.color || this.style.getPropertyValue(index == 0 ? '--w-primary-800' : '--w-primary-100'),
9418
+ data: element.data,
9419
+ borderRadius: 4,
9420
+ barThickness: this._chartConfig.widthBars ?? this.widthBars,
9421
+ extraLegend: element.extraLegend,
9422
+ extraData: element.extraData || [],
9423
+ });
9401
9424
  lengths.push(element.data.length);
9402
9425
  });
9403
9426
  if (this.setAutoHeight == true && this.isHorizontal == true) {
@@ -9444,6 +9467,46 @@ class WChartBarComponent {
9444
9467
  }
9445
9468
  return label;
9446
9469
  }
9470
+ idealTextColorFor(bgHex, textColor) {
9471
+ switch (bgHex) {
9472
+ case '#b5dced':
9473
+ if (textColor) {
9474
+ if (textColor.toLowerCase() == '#e46d3d') {
9475
+ return '#ad300d';
9476
+ }
9477
+ }
9478
+ return '#10485d';
9479
+ case '#10485d':
9480
+ if (textColor) {
9481
+ if (textColor.toLowerCase() == '#e46d3d') {
9482
+ return '#e46d3d';
9483
+ }
9484
+ }
9485
+ return '#fff';
9486
+ default:
9487
+ return '#fff';
9488
+ }
9489
+ }
9490
+ idealTextStrokeColorFor(bgHex, textColor) {
9491
+ switch (bgHex) {
9492
+ case '#b5dced':
9493
+ if (textColor) {
9494
+ if (textColor.toLowerCase() == '#e46d3d') {
9495
+ return 'rgba(93, 124, 144, 0.6)';
9496
+ }
9497
+ }
9498
+ return 'rgba(122, 156, 175, 0.6)';
9499
+ case '#10485d':
9500
+ if (textColor) {
9501
+ if (textColor.toLowerCase() == '#e46d3d') {
9502
+ return 'rgba(42, 26, 20, 0.6)';
9503
+ }
9504
+ }
9505
+ return 'rgba(26, 26, 26, 0.6)';
9506
+ default:
9507
+ return 'rgba(26, 26, 26, 0.6)';
9508
+ }
9509
+ }
9447
9510
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.0", ngImport: i0, type: WChartBarComponent, deps: [{ token: WSummaryPipe }], target: i0.ɵɵFactoryTarget.Component }); }
9448
9511
  static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.0", type: WChartBarComponent, isStandalone: false, selector: "w-chart-bar", inputs: { title: "title", config: "config", isHorizontal: "isHorizontal", width: "width", height: "height", setAutoHeight: "setAutoHeight", maxLabelLength: "maxLabelLength", labelConfig: "labelConfig" }, outputs: { onDataSelectedEvent: "onDataSelected" }, providers: [WSummaryPipe], viewQueries: [{ propertyName: "wChartBar", first: true, predicate: ["wChartBar"], descendants: true }], usesOnChanges: true, ngImport: i0, template: "<p-chart #wChartBar type=\"bar\" [data]=\"data\" [options]=\"options\" [width]=\"width\" [height]=\"setAutoHeight == true ? baseHeightPx : height\" (onDataSelect)=\"onDataSelected($event)\"></p-chart>", styles: [".heading1{font-size:2.6666666667rem;line-height:3rem;font-weight:700}.heading2{font-size:2.3333333333rem;line-height:2.6666666667rem;font-weight:700}.heading3{font-size:2rem;line-height:2.3333333333rem;font-weight:700}.heading4{font-size:1.6666666667rem;line-height:2rem;font-weight:700}.heading5,.w-sidebar-title-text{font-size:1.5rem;line-height:1.8333333333rem;font-weight:700}.heading6{font-size:1.3333333333rem;line-height:1.6666666667rem;font-weight:700}.subtitle1,.w-tab-text,.w-panel-title-text{font-size:1.1666666667rem;line-height:1.3333333333rem;font-weight:700}.subtitle2,.w-table-th-text,.w-panel-subtitle-text,.w-input-small-label-text-typography,.w-input-small-label-text,.w-input-small-label-disabled,.w-view-small-label-text-typography,.w-view-small-label-text,.w-button-small-text-label-text-typography,.w-button-small-text-label-text{font-size:1rem;line-height:1.1666666667rem;font-weight:600}.body,.w-image-file-uploader-navigators-text,.w-table-td-text,.w-chip-text,.w-panel-content,.w-input-small-select-options-text,.w-input-small-placeholder-text-typography,.w-input-small-placeholder-text-disabled,.w-input-small-placeholder-text,.w-view-small-value-text-typography,.w-view-small-value-text,.w-button-small-label-text-typography,.w-button-small-tertiary-label-text{font-size:1rem;line-height:1.1666666667rem;font-weight:400}.caption,.w-input-success-alert-text{font-size:.6666666667rem;line-height:1rem;font-weight:400}.light,.w-input-small-placeholder-text-only-color{font-size:.9166666667rem;line-height:1.0833333333rem;font-weight:300}.small,.w-error-message,.w-input-error-alert-text,.w-input-warning-alert-text,.w-button-small-label-text-typography-sm{font-size:.8333333333rem;line-height:1rem;font-weight:400}.textMainColor{color:#1f2224}.textSoftColor{color:#5f6468}.textSofterColor{color:#9aa0a7}.textSoftestColor{color:#e8ebee}.textInverseColor{color:#fff}.spacingXXS{padding:4px}.spacingXSM{padding:6px}.spacingXSMDivider{height:6px}.spacingXS{padding:8px}.spacingS{padding:12px}.spacingM{padding:16px}.spacingL{padding:20px}.spacingXL{padding:24px}.spacingXXL{padding:28px}.spacingXXXL{padding:32px}.panel-title-gap-divider{height:20px}.panel-section-gap-divider{height:32px}.input-vertical-gap-divider{height:24px}.input-label-gap-divider{height:6px}.focusedInput{border:1px solid rgba(0,157,253,.25);box-shadow:0 0 10px #00b3eb40}.focus{box-shadow:0 0 8px #00a6e980}.hover{border-radius:8px;border:1px solid #00b3eb}.hoveredInput{border-radius:8px;border:1px solid rgba(0,179,235,.5)}.input-generic-valid{border-radius:8px;border:1px solid #B3FFD3}.input-generic-valid-focus{border-radius:8px;border:1px solid #B3FFD3!important;box-shadow:0 0 8px #46ff9b80!important;padding-left:16px}.input-generic-warning{border-radius:8px;border:1px solid #FFECB8!important}.input-generic-warning-focus{border-radius:8px;border:1px solid #FFECB8!important;box-shadow:0 0 8px #ffcd4680!important;padding-left:16px}.input-generic-error-focus{border-radius:8px;border:1px solid #FFBDBD!important;box-shadow:0 0 8px #ff555580!important;padding-left:16px}.input-generic-error{border-radius:8px;border:1px solid #FFBDBD}.toggle-small-typography{font-size:12px;line-height:16px;font-weight:600}.w-button-small-label-text-typography,.w-button-small-tertiary-label-text,.w-button-small-label-text-typography-sm{font-weight:600}.w-button-small-tertiary-label-text{color:#5f6468}.w-button-small-text-label-text{color:#1f2224}.w-button-small-icon-text{font-size:12px;font-weight:600}.w-table-button-small-icon-text{font-size:12px;color:#9aa0a7}.w-control-button-small-label-text{font-size:12px;font-weight:600;line-height:16px}.w-control-button-x-small-icon-text{font-size:10px;font-weight:700}.w-control-button-small-icon-text{font-size:8px;font-weight:700}.w-button-medium-label-text-typography,.w-button-medium-tertiary-label-text{font-size:16px;font-weight:600;line-height:16px}.w-button-medium-tertiary-label-text{color:#1f2224}.w-button-medium-icon-text{font-size:16px}.w-control-button-medium-label-text{font-size:14px;font-weight:600;line-height:16px}.w-control-button-medium-icon-text{font-size:12px;font-weight:700}.w-button-large-label-text-typography,.w-button-large-tertiary-label-text{font-size:20px;font-weight:600;line-height:24px}.w-button-large-tertiary-label-text{color:#1f2224}.w-button-x-small-label-text{font-size:10px;font-weight:600;line-height:10px}.w-button-small-only-label-text{font-size:12px;font-weight:600;line-height:16px}.w-button-large-icon-text{font-size:24px}.w-view-small-label-text{color:#1f2224}.w-view-small-value-text{color:#5f6468}.w-input-no-label-height{height:14px}.w-input-disabled{background-color:#f8f9fa!important;border-color:#e8ebee!important;opacity:.6!important}.w-input-small-label-text-typography,.w-input-small-label-text,.w-input-small-label-disabled{height:fit-content}.w-input-small-label-text,.w-input-small-label-disabled{color:#1f2224}.w-input-small-label-disabled{color:#9aa0a7}.w-input-small-label-text-content{padding:12px 8px 8px 0;margin:0}.w-input-small-label-text-content-no-top{padding-top:0}.w-input-small-placeholder-text{color:#1f2224}.w-input-small-placeholder-text-only-color{color:#9aa0a7;line-height:1.3333333333rem}.w-input-small-placeholder-text-disabled,.w-input-small-placeholder-text-disabled-only-color{color:#5f6468}.w-input-small-text-icon,.w-input-small-select-options-text{color:#1f2224}.w-input-medium-label-text-typography,.w-input-medium-label-text,.w-input-medium-label-disabled{font-size:14px;font-weight:600;line-height:16px}.w-input-medium-label-text,.w-input-medium-label-disabled{color:#1f2224}.w-input-medium-label-disabled{color:#9aa0a7}.w-input-medium-placeholder-text-typography,.w-input-medium-placeholder-text-disabled,.w-input-medium-placeholder-text{font-size:16px;font-weight:400;line-height:24px}.w-input-medium-placeholder-text,.w-input-medium-placeholder-text-only-color{color:#1f2224}.w-input-medium-placeholder-text-disabled,.w-input-medium-placeholder-text-disabled-only-color{color:#5f6468}.w-input-medium-text-icon{color:#1f2224}.w-input-medium-select-options-text{font-size:16px;font-weight:400;line-height:24px;color:#1f2224}.w-input-success-alert-text{color:#00db5d;padding:8px 8px 0;margin-top:0}.w-input-warning-alert-text{color:#eeae00;padding:0 4px;margin-top:-2px}.w-input-error-alert-text{color:#e50000;padding:0 4px;margin-top:-2px}.w-input-alert-message-height{height:32px}.w-error-message{color:#e50000;padding:0 4px;margin-top:-2px}.w-sidebar-title-text,.w-panel-title-text,.w-panel-subtitle-text{color:#1f2224}.w-panel-content{color:#5f6468}.w-tab-text,.w-chip-text{color:#1f2224}.w-badge-text{font-size:10px;font-weight:700;line-height:8px}.w-table-th-text{color:#1f2224}.w-table-td-text{color:#5f6468}.w-table-height{padding:6px 8px 5px}.w-table-no-buttons-height{padding:16px 8px 15px!important}.w-tree-table-height{padding:8px 8px 7px}.w-image-file-uploader-navigators-text{font-size:12px;color:#fff}.grid{margin:0}::ng-deep .p-tooltip,.p-tooltip{filter:0px 0px 1px 0px rgba(0,0,0,.1) inset,1px 1px 5px rgba(0,0,0,.06),1px 1px 1px rgba(0,0,0,.08)}::ng-deep .p-tooltip .p-tooltip-text,.p-tooltip .p-tooltip-text{background:#fff!important;color:#1f2224;padding:12px 16px;max-width:192px;width:max-content;margin-left:3px;pointer-events:none}::ng-deep .p-tooltip.p-tooltip-left,.p-tooltip.p-tooltip-left{margin-right:6px;width:max-content;transform:translate(-6px)}::ng-deep .p-tooltip.p-tooltip-left .p-tooltip-arrow,.p-tooltip.p-tooltip-left .p-tooltip-arrow{border-left-color:#fff!important;top:50%;right:-3px;margin-top:-4px;border-width:4px 0 4px 6px!important}::ng-deep .p-tooltip.p-tooltip-right,.p-tooltip.p-tooltip-right{margin-left:6px;width:max-content;transform:translateY(-1px)}::ng-deep .p-tooltip.p-tooltip-right .p-tooltip-arrow,.p-tooltip.p-tooltip-right .p-tooltip-arrow{border-right-color:#fff!important;top:50%;left:0;margin-top:-4px;border-width:4px 6px 4px 0!important}::ng-deep .p-tooltip.p-tooltip-bottom .p-tooltip-arrow,.p-tooltip.p-tooltip-bottom .p-tooltip-arrow{border-bottom-color:#fff!important;border-width:0 4px 6px 4px!important;margin-top:-3px}\n"], dependencies: [{ kind: "component", type: i2$b.UIChart, selector: "p-chart", inputs: ["type", "plugins", "width", "height", "responsive", "ariaLabel", "ariaLabelledBy", "data", "options"], outputs: ["onDataSelect"] }] }); }
9449
9512
  }