@adiba-banking-cloud/backoffice 0.0.99 → 0.0.101

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.
@@ -11378,7 +11378,11 @@ const EqualizerColumn = props => {
11378
11378
  plotBgColor: props.plotBgColor,
11379
11379
  colors: [props.color || "blue"],
11380
11380
  title: props.title,
11381
- inverted: props.inverted
11381
+ inverted: props.inverted,
11382
+ showDataLabels: props.showDataLabels,
11383
+ showXLabel: props.showXLabel,
11384
+ showYLabel: props.showYLabel,
11385
+ showAxisLabel: props.showAxisLabel
11382
11386
  };
11383
11387
  return /*#__PURE__*/React.createElement(Column, chartOptions);
11384
11388
  };
@@ -11393,7 +11397,11 @@ const SimpleColumn = props => {
11393
11397
  plotBgColor: props.plotBgColor,
11394
11398
  colors: [props.color || "gray"],
11395
11399
  title: props.title,
11396
- inverted: props.inverted
11400
+ inverted: props.inverted,
11401
+ showDataLabels: props.showDataLabels,
11402
+ showXLabel: props.showXLabel,
11403
+ showYLabel: props.showYLabel,
11404
+ showAxisLabel: props.showAxisLabel
11397
11405
  };
11398
11406
  return /*#__PURE__*/React.createElement(Column, chartOptions);
11399
11407
  };
@@ -11403,16 +11411,18 @@ const StackedColumn = props => {
11403
11411
  }));
11404
11412
  };
11405
11413
  const initSeries$2 = props => {
11406
- const renderXAxis = categories => ({
11414
+ const renderXAxis = (categories, showXLabel) => ({
11407
11415
  categories,
11408
11416
  labels: {
11417
+ enabled: showXLabel !== false,
11418
+ // Default to true if not specified
11409
11419
  style: {
11410
11420
  textTransform: "uppercase",
11411
11421
  color: "#575E77"
11412
11422
  }
11413
11423
  }
11414
11424
  });
11415
- const renderYAxis = (equalizer, series) => ({
11425
+ const renderYAxis = (equalizer, series, showYLabel) => ({
11416
11426
  allowDecimals: false,
11417
11427
  title: {
11418
11428
  text: null
@@ -11420,6 +11430,8 @@ const initSeries$2 = props => {
11420
11430
  gridLineDashStyle: "Dot",
11421
11431
  gridLineWidth: 2,
11422
11432
  labels: {
11433
+ enabled: showYLabel !== false,
11434
+ // Default to true if not specified
11423
11435
  formatter: ctx => {
11424
11436
  if (!equalizer || series.length > 1) {
11425
11437
  return ctx.value;
@@ -11429,21 +11441,52 @@ const initSeries$2 = props => {
11429
11441
  }
11430
11442
  }
11431
11443
  });
11432
- const renderSeries = (seriesData, seriesColors, equalizer) => {
11444
+ const renderSeries = (seriesData, seriesColors, equalizer, showDataLabels, showAxisLabel) => {
11433
11445
  if (seriesData.length > 1 || !equalizer) {
11434
11446
  let br = undefined;
11435
11447
  if (seriesData.length > 1 && equalizer) {
11436
11448
  br = 20;
11437
11449
  }
11438
- return seriesData.map((data, key) => ({
11439
- name: props.yAxisLabel[key],
11440
- color: seriesColors ? seriesColors[key] : "gray",
11441
- data,
11442
- borderRadiusTopLeft: br,
11443
- borderRadiusTopRight: br,
11444
- borderRadiusBottomLeft: br,
11445
- borderRadiusBottomRight: br
11446
- }));
11450
+ return seriesData.map((data, key) => {
11451
+ const dataLabelConfig = {
11452
+ enabled: false
11453
+ };
11454
+ if (showDataLabels || showAxisLabel) {
11455
+ dataLabelConfig.enabled = true;
11456
+ dataLabelConfig.style = {
11457
+ color: "#575E77",
11458
+ fontSize: "12px",
11459
+ fontWeight: "500",
11460
+ textShadow: "none"
11461
+ };
11462
+ dataLabelConfig.align = "center";
11463
+ dataLabelConfig.verticalAlign = props.inverted ? "middle" : "bottom";
11464
+
11465
+ // Combine value and axis label if both are enabled
11466
+ dataLabelConfig.formatter = function () {
11467
+ const value = showDataLabels ? this.y?.toString() || "" : "";
11468
+ const axisLabel = showAxisLabel ? this.point?.category || this.category || this.x || "" : "";
11469
+ if (showDataLabels && showAxisLabel) {
11470
+ return `${axisLabel}<br/>${value}`;
11471
+ } else if (showDataLabels) {
11472
+ return value;
11473
+ } else if (showAxisLabel) {
11474
+ return axisLabel;
11475
+ }
11476
+ return "";
11477
+ };
11478
+ }
11479
+ return {
11480
+ name: props.yAxisLabel[key],
11481
+ color: seriesColors ? seriesColors[key] : "gray",
11482
+ data,
11483
+ borderRadiusTopLeft: br,
11484
+ borderRadiusTopRight: br,
11485
+ borderRadiusBottomLeft: br,
11486
+ borderRadiusBottomRight: br,
11487
+ dataLabels: dataLabelConfig
11488
+ };
11489
+ });
11447
11490
  }
11448
11491
  if (seriesData.length == 1 && equalizer) {
11449
11492
  const boundary = computeBoundary(seriesData[0]);
@@ -11457,15 +11500,47 @@ const initSeries$2 = props => {
11457
11500
  innerWidth: 8,
11458
11501
  color: "#EEEEEE",
11459
11502
  enableMouseTracking: false,
11460
- showInLegend: false
11503
+ showInLegend: false,
11504
+ dataLabels: {
11505
+ enabled: false
11506
+ }
11461
11507
  });
11508
+ const dataLabelConfig = {
11509
+ enabled: false
11510
+ };
11511
+ if (showDataLabels || showAxisLabel) {
11512
+ dataLabelConfig.enabled = true;
11513
+ dataLabelConfig.style = {
11514
+ color: "#575E77",
11515
+ fontSize: "12px",
11516
+ fontWeight: "500",
11517
+ textShadow: "none"
11518
+ };
11519
+ dataLabelConfig.align = "center";
11520
+ dataLabelConfig.verticalAlign = props.inverted ? "middle" : "bottom";
11521
+
11522
+ // Combine value and axis label if both are enabled
11523
+ dataLabelConfig.formatter = function () {
11524
+ const value = showDataLabels ? this.y?.toString() || "" : "";
11525
+ const axisLabel = showAxisLabel ? this.category || "" : "";
11526
+ if (showDataLabels && showAxisLabel) {
11527
+ return `${axisLabel}<br/>${value}`;
11528
+ } else if (showDataLabels) {
11529
+ return value;
11530
+ } else if (showAxisLabel) {
11531
+ return axisLabel;
11532
+ }
11533
+ return "";
11534
+ };
11535
+ }
11462
11536
  const mainSeries = {
11463
11537
  ...fillSeries(boundary),
11464
11538
  ...{
11465
11539
  name: props.yAxisLabel[0],
11466
11540
  color: seriesColors ? seriesColors[0] : "gray",
11467
11541
  data: seriesData[0],
11468
- enableMouseTracking: true
11542
+ enableMouseTracking: true,
11543
+ dataLabels: dataLabelConfig
11469
11544
  }
11470
11545
  };
11471
11546
  return [fillSeries(boundary), mainSeries];
@@ -11514,10 +11589,10 @@ const initSeries$2 = props => {
11514
11589
  return plot;
11515
11590
  };
11516
11591
  return {
11517
- xAxis: renderXAxis(props.xAxisLabel),
11518
- yAxis: renderYAxis(props.equalizer, props.series),
11592
+ xAxis: renderXAxis(props.xAxisLabel, props.showXLabel),
11593
+ yAxis: renderYAxis(props.equalizer, props.series, props.showYLabel),
11519
11594
  plotOptions: renderPlot(props.equalizer),
11520
- series: renderSeries(props.series, props?.colors, props.equalizer)
11595
+ series: renderSeries(props.series, props?.colors, props.equalizer, props.showDataLabels, props.showAxisLabel)
11521
11596
  };
11522
11597
  };
11523
11598
 
@@ -11357,7 +11357,11 @@ const EqualizerColumn = props => {
11357
11357
  plotBgColor: props.plotBgColor,
11358
11358
  colors: [props.color || "blue"],
11359
11359
  title: props.title,
11360
- inverted: props.inverted
11360
+ inverted: props.inverted,
11361
+ showDataLabels: props.showDataLabels,
11362
+ showXLabel: props.showXLabel,
11363
+ showYLabel: props.showYLabel,
11364
+ showAxisLabel: props.showAxisLabel
11361
11365
  };
11362
11366
  return /*#__PURE__*/React.createElement(Column, chartOptions);
11363
11367
  };
@@ -11372,7 +11376,11 @@ const SimpleColumn = props => {
11372
11376
  plotBgColor: props.plotBgColor,
11373
11377
  colors: [props.color || "gray"],
11374
11378
  title: props.title,
11375
- inverted: props.inverted
11379
+ inverted: props.inverted,
11380
+ showDataLabels: props.showDataLabels,
11381
+ showXLabel: props.showXLabel,
11382
+ showYLabel: props.showYLabel,
11383
+ showAxisLabel: props.showAxisLabel
11376
11384
  };
11377
11385
  return /*#__PURE__*/React.createElement(Column, chartOptions);
11378
11386
  };
@@ -11382,16 +11390,18 @@ const StackedColumn = props => {
11382
11390
  }));
11383
11391
  };
11384
11392
  const initSeries$2 = props => {
11385
- const renderXAxis = categories => ({
11393
+ const renderXAxis = (categories, showXLabel) => ({
11386
11394
  categories,
11387
11395
  labels: {
11396
+ enabled: showXLabel !== false,
11397
+ // Default to true if not specified
11388
11398
  style: {
11389
11399
  textTransform: "uppercase",
11390
11400
  color: "#575E77"
11391
11401
  }
11392
11402
  }
11393
11403
  });
11394
- const renderYAxis = (equalizer, series) => ({
11404
+ const renderYAxis = (equalizer, series, showYLabel) => ({
11395
11405
  allowDecimals: false,
11396
11406
  title: {
11397
11407
  text: null
@@ -11399,6 +11409,8 @@ const initSeries$2 = props => {
11399
11409
  gridLineDashStyle: "Dot",
11400
11410
  gridLineWidth: 2,
11401
11411
  labels: {
11412
+ enabled: showYLabel !== false,
11413
+ // Default to true if not specified
11402
11414
  formatter: ctx => {
11403
11415
  if (!equalizer || series.length > 1) {
11404
11416
  return ctx.value;
@@ -11408,21 +11420,52 @@ const initSeries$2 = props => {
11408
11420
  }
11409
11421
  }
11410
11422
  });
11411
- const renderSeries = (seriesData, seriesColors, equalizer) => {
11423
+ const renderSeries = (seriesData, seriesColors, equalizer, showDataLabels, showAxisLabel) => {
11412
11424
  if (seriesData.length > 1 || !equalizer) {
11413
11425
  let br = undefined;
11414
11426
  if (seriesData.length > 1 && equalizer) {
11415
11427
  br = 20;
11416
11428
  }
11417
- return seriesData.map((data, key) => ({
11418
- name: props.yAxisLabel[key],
11419
- color: seriesColors ? seriesColors[key] : "gray",
11420
- data,
11421
- borderRadiusTopLeft: br,
11422
- borderRadiusTopRight: br,
11423
- borderRadiusBottomLeft: br,
11424
- borderRadiusBottomRight: br
11425
- }));
11429
+ return seriesData.map((data, key) => {
11430
+ const dataLabelConfig = {
11431
+ enabled: false
11432
+ };
11433
+ if (showDataLabels || showAxisLabel) {
11434
+ dataLabelConfig.enabled = true;
11435
+ dataLabelConfig.style = {
11436
+ color: "#575E77",
11437
+ fontSize: "12px",
11438
+ fontWeight: "500",
11439
+ textShadow: "none"
11440
+ };
11441
+ dataLabelConfig.align = "center";
11442
+ dataLabelConfig.verticalAlign = props.inverted ? "middle" : "bottom";
11443
+
11444
+ // Combine value and axis label if both are enabled
11445
+ dataLabelConfig.formatter = function () {
11446
+ const value = showDataLabels ? this.y?.toString() || "" : "";
11447
+ const axisLabel = showAxisLabel ? this.point?.category || this.category || this.x || "" : "";
11448
+ if (showDataLabels && showAxisLabel) {
11449
+ return `${axisLabel}<br/>${value}`;
11450
+ } else if (showDataLabels) {
11451
+ return value;
11452
+ } else if (showAxisLabel) {
11453
+ return axisLabel;
11454
+ }
11455
+ return "";
11456
+ };
11457
+ }
11458
+ return {
11459
+ name: props.yAxisLabel[key],
11460
+ color: seriesColors ? seriesColors[key] : "gray",
11461
+ data,
11462
+ borderRadiusTopLeft: br,
11463
+ borderRadiusTopRight: br,
11464
+ borderRadiusBottomLeft: br,
11465
+ borderRadiusBottomRight: br,
11466
+ dataLabels: dataLabelConfig
11467
+ };
11468
+ });
11426
11469
  }
11427
11470
  if (seriesData.length == 1 && equalizer) {
11428
11471
  const boundary = computeBoundary(seriesData[0]);
@@ -11436,15 +11479,47 @@ const initSeries$2 = props => {
11436
11479
  innerWidth: 8,
11437
11480
  color: "#EEEEEE",
11438
11481
  enableMouseTracking: false,
11439
- showInLegend: false
11482
+ showInLegend: false,
11483
+ dataLabels: {
11484
+ enabled: false
11485
+ }
11440
11486
  });
11487
+ const dataLabelConfig = {
11488
+ enabled: false
11489
+ };
11490
+ if (showDataLabels || showAxisLabel) {
11491
+ dataLabelConfig.enabled = true;
11492
+ dataLabelConfig.style = {
11493
+ color: "#575E77",
11494
+ fontSize: "12px",
11495
+ fontWeight: "500",
11496
+ textShadow: "none"
11497
+ };
11498
+ dataLabelConfig.align = "center";
11499
+ dataLabelConfig.verticalAlign = props.inverted ? "middle" : "bottom";
11500
+
11501
+ // Combine value and axis label if both are enabled
11502
+ dataLabelConfig.formatter = function () {
11503
+ const value = showDataLabels ? this.y?.toString() || "" : "";
11504
+ const axisLabel = showAxisLabel ? this.category || "" : "";
11505
+ if (showDataLabels && showAxisLabel) {
11506
+ return `${axisLabel}<br/>${value}`;
11507
+ } else if (showDataLabels) {
11508
+ return value;
11509
+ } else if (showAxisLabel) {
11510
+ return axisLabel;
11511
+ }
11512
+ return "";
11513
+ };
11514
+ }
11441
11515
  const mainSeries = {
11442
11516
  ...fillSeries(boundary),
11443
11517
  ...{
11444
11518
  name: props.yAxisLabel[0],
11445
11519
  color: seriesColors ? seriesColors[0] : "gray",
11446
11520
  data: seriesData[0],
11447
- enableMouseTracking: true
11521
+ enableMouseTracking: true,
11522
+ dataLabels: dataLabelConfig
11448
11523
  }
11449
11524
  };
11450
11525
  return [fillSeries(boundary), mainSeries];
@@ -11493,10 +11568,10 @@ const initSeries$2 = props => {
11493
11568
  return plot;
11494
11569
  };
11495
11570
  return {
11496
- xAxis: renderXAxis(props.xAxisLabel),
11497
- yAxis: renderYAxis(props.equalizer, props.series),
11571
+ xAxis: renderXAxis(props.xAxisLabel, props.showXLabel),
11572
+ yAxis: renderYAxis(props.equalizer, props.series, props.showYLabel),
11498
11573
  plotOptions: renderPlot(props.equalizer),
11499
- series: renderSeries(props.series, props?.colors, props.equalizer)
11574
+ series: renderSeries(props.series, props?.colors, props.equalizer, props.showDataLabels, props.showAxisLabel)
11500
11575
  };
11501
11576
  };
11502
11577
 
@@ -9,6 +9,10 @@ export interface ChartProps {
9
9
  withLegend: boolean;
10
10
  equalizer: boolean;
11
11
  inverted?: boolean;
12
+ showDataLabels?: boolean;
13
+ showXLabel?: boolean;
14
+ showYLabel?: boolean;
15
+ showAxisLabel?: boolean;
12
16
  }
13
17
  export interface SimpleChartProps {
14
18
  bgColor?: string;
@@ -20,6 +24,10 @@ export interface SimpleChartProps {
20
24
  series: number[];
21
25
  withLegend: boolean;
22
26
  inverted?: boolean;
27
+ showDataLabels?: boolean;
28
+ showXLabel?: boolean;
29
+ showYLabel?: boolean;
30
+ showAxisLabel?: boolean;
23
31
  }
24
32
  export interface ChartConfig {
25
33
  chart: object;
@@ -56,4 +64,15 @@ export interface ChartSeries {
56
64
  color: string;
57
65
  enableMouseTracking?: boolean;
58
66
  showInLegend?: boolean;
67
+ dataLabels?: {
68
+ enabled: boolean;
69
+ style?: {
70
+ color?: string;
71
+ fontSize?: string;
72
+ fontWeight?: string;
73
+ };
74
+ align?: string;
75
+ verticalAlign?: string;
76
+ formatter?: (this: any) => string;
77
+ };
59
78
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@adiba-banking-cloud/backoffice",
3
3
  "author": "TUROG Technologies",
4
- "version": "0.0.99",
4
+ "version": "0.0.101",
5
5
  "description": "An ADIBA component library for backoffice and dashboard applications",
6
6
  "license": "ISC",
7
7
  "main": "build/index.cjs.js",