@adiba-banking-cloud/backoffice 0.0.99 → 0.0.100

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,51 @@ 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
+ };
11461
+ dataLabelConfig.align = "center";
11462
+ dataLabelConfig.verticalAlign = props.inverted ? "middle" : "bottom";
11463
+
11464
+ // Combine value and axis label if both are enabled
11465
+ dataLabelConfig.formatter = function () {
11466
+ const value = showDataLabels ? this.y?.toString() || "" : "";
11467
+ const axisLabel = showAxisLabel ? this.point?.category || this.category || this.x || "" : "";
11468
+ if (showDataLabels && showAxisLabel) {
11469
+ return `${axisLabel}<br/>${value}`;
11470
+ } else if (showDataLabels) {
11471
+ return value;
11472
+ } else if (showAxisLabel) {
11473
+ return axisLabel;
11474
+ }
11475
+ return "";
11476
+ };
11477
+ }
11478
+ return {
11479
+ name: props.yAxisLabel[key],
11480
+ color: seriesColors ? seriesColors[key] : "gray",
11481
+ data,
11482
+ borderRadiusTopLeft: br,
11483
+ borderRadiusTopRight: br,
11484
+ borderRadiusBottomLeft: br,
11485
+ borderRadiusBottomRight: br,
11486
+ dataLabels: dataLabelConfig
11487
+ };
11488
+ });
11447
11489
  }
11448
11490
  if (seriesData.length == 1 && equalizer) {
11449
11491
  const boundary = computeBoundary(seriesData[0]);
@@ -11457,15 +11499,46 @@ const initSeries$2 = props => {
11457
11499
  innerWidth: 8,
11458
11500
  color: "#EEEEEE",
11459
11501
  enableMouseTracking: false,
11460
- showInLegend: false
11502
+ showInLegend: false,
11503
+ dataLabels: {
11504
+ enabled: false
11505
+ }
11461
11506
  });
11507
+ const dataLabelConfig = {
11508
+ enabled: false
11509
+ };
11510
+ if (showDataLabels || showAxisLabel) {
11511
+ dataLabelConfig.enabled = true;
11512
+ dataLabelConfig.style = {
11513
+ color: "#575E77",
11514
+ fontSize: "12px",
11515
+ fontWeight: "500"
11516
+ };
11517
+ dataLabelConfig.align = "center";
11518
+ dataLabelConfig.verticalAlign = props.inverted ? "middle" : "bottom";
11519
+
11520
+ // Combine value and axis label if both are enabled
11521
+ dataLabelConfig.formatter = function () {
11522
+ const value = showDataLabels ? this.y?.toString() || "" : "";
11523
+ const axisLabel = showAxisLabel ? this.category || "" : "";
11524
+ if (showDataLabels && showAxisLabel) {
11525
+ return `${axisLabel}<br/>${value}`;
11526
+ } else if (showDataLabels) {
11527
+ return value;
11528
+ } else if (showAxisLabel) {
11529
+ return axisLabel;
11530
+ }
11531
+ return "";
11532
+ };
11533
+ }
11462
11534
  const mainSeries = {
11463
11535
  ...fillSeries(boundary),
11464
11536
  ...{
11465
11537
  name: props.yAxisLabel[0],
11466
11538
  color: seriesColors ? seriesColors[0] : "gray",
11467
11539
  data: seriesData[0],
11468
- enableMouseTracking: true
11540
+ enableMouseTracking: true,
11541
+ dataLabels: dataLabelConfig
11469
11542
  }
11470
11543
  };
11471
11544
  return [fillSeries(boundary), mainSeries];
@@ -11514,10 +11587,10 @@ const initSeries$2 = props => {
11514
11587
  return plot;
11515
11588
  };
11516
11589
  return {
11517
- xAxis: renderXAxis(props.xAxisLabel),
11518
- yAxis: renderYAxis(props.equalizer, props.series),
11590
+ xAxis: renderXAxis(props.xAxisLabel, props.showXLabel),
11591
+ yAxis: renderYAxis(props.equalizer, props.series, props.showYLabel),
11519
11592
  plotOptions: renderPlot(props.equalizer),
11520
- series: renderSeries(props.series, props?.colors, props.equalizer)
11593
+ series: renderSeries(props.series, props?.colors, props.equalizer, props.showDataLabels, props.showAxisLabel)
11521
11594
  };
11522
11595
  };
11523
11596
 
@@ -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,51 @@ 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
+ };
11440
+ dataLabelConfig.align = "center";
11441
+ dataLabelConfig.verticalAlign = props.inverted ? "middle" : "bottom";
11442
+
11443
+ // Combine value and axis label if both are enabled
11444
+ dataLabelConfig.formatter = function () {
11445
+ const value = showDataLabels ? this.y?.toString() || "" : "";
11446
+ const axisLabel = showAxisLabel ? this.point?.category || this.category || this.x || "" : "";
11447
+ if (showDataLabels && showAxisLabel) {
11448
+ return `${axisLabel}<br/>${value}`;
11449
+ } else if (showDataLabels) {
11450
+ return value;
11451
+ } else if (showAxisLabel) {
11452
+ return axisLabel;
11453
+ }
11454
+ return "";
11455
+ };
11456
+ }
11457
+ return {
11458
+ name: props.yAxisLabel[key],
11459
+ color: seriesColors ? seriesColors[key] : "gray",
11460
+ data,
11461
+ borderRadiusTopLeft: br,
11462
+ borderRadiusTopRight: br,
11463
+ borderRadiusBottomLeft: br,
11464
+ borderRadiusBottomRight: br,
11465
+ dataLabels: dataLabelConfig
11466
+ };
11467
+ });
11426
11468
  }
11427
11469
  if (seriesData.length == 1 && equalizer) {
11428
11470
  const boundary = computeBoundary(seriesData[0]);
@@ -11436,15 +11478,46 @@ const initSeries$2 = props => {
11436
11478
  innerWidth: 8,
11437
11479
  color: "#EEEEEE",
11438
11480
  enableMouseTracking: false,
11439
- showInLegend: false
11481
+ showInLegend: false,
11482
+ dataLabels: {
11483
+ enabled: false
11484
+ }
11440
11485
  });
11486
+ const dataLabelConfig = {
11487
+ enabled: false
11488
+ };
11489
+ if (showDataLabels || showAxisLabel) {
11490
+ dataLabelConfig.enabled = true;
11491
+ dataLabelConfig.style = {
11492
+ color: "#575E77",
11493
+ fontSize: "12px",
11494
+ fontWeight: "500"
11495
+ };
11496
+ dataLabelConfig.align = "center";
11497
+ dataLabelConfig.verticalAlign = props.inverted ? "middle" : "bottom";
11498
+
11499
+ // Combine value and axis label if both are enabled
11500
+ dataLabelConfig.formatter = function () {
11501
+ const value = showDataLabels ? this.y?.toString() || "" : "";
11502
+ const axisLabel = showAxisLabel ? this.category || "" : "";
11503
+ if (showDataLabels && showAxisLabel) {
11504
+ return `${axisLabel}<br/>${value}`;
11505
+ } else if (showDataLabels) {
11506
+ return value;
11507
+ } else if (showAxisLabel) {
11508
+ return axisLabel;
11509
+ }
11510
+ return "";
11511
+ };
11512
+ }
11441
11513
  const mainSeries = {
11442
11514
  ...fillSeries(boundary),
11443
11515
  ...{
11444
11516
  name: props.yAxisLabel[0],
11445
11517
  color: seriesColors ? seriesColors[0] : "gray",
11446
11518
  data: seriesData[0],
11447
- enableMouseTracking: true
11519
+ enableMouseTracking: true,
11520
+ dataLabels: dataLabelConfig
11448
11521
  }
11449
11522
  };
11450
11523
  return [fillSeries(boundary), mainSeries];
@@ -11493,10 +11566,10 @@ const initSeries$2 = props => {
11493
11566
  return plot;
11494
11567
  };
11495
11568
  return {
11496
- xAxis: renderXAxis(props.xAxisLabel),
11497
- yAxis: renderYAxis(props.equalizer, props.series),
11569
+ xAxis: renderXAxis(props.xAxisLabel, props.showXLabel),
11570
+ yAxis: renderYAxis(props.equalizer, props.series, props.showYLabel),
11498
11571
  plotOptions: renderPlot(props.equalizer),
11499
- series: renderSeries(props.series, props?.colors, props.equalizer)
11572
+ series: renderSeries(props.series, props?.colors, props.equalizer, props.showDataLabels, props.showAxisLabel)
11500
11573
  };
11501
11574
  };
11502
11575
 
@@ -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.100",
5
5
  "description": "An ADIBA component library for backoffice and dashboard applications",
6
6
  "license": "ISC",
7
7
  "main": "build/index.cjs.js",