@datarailsshared/dr_renderer 1.5.133 → 1.5.146

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.
@@ -10,7 +10,7 @@ on:
10
10
  branches:
11
11
  - 'master'
12
12
  - 'main'
13
- - 'move-to-jfrog'
13
+ - 'migration-to-github'
14
14
 
15
15
  concurrency:
16
16
  group: '${{ github.ref }}-${{ github.workflow }}'
@@ -18,7 +18,7 @@ concurrency:
18
18
 
19
19
  permissions:
20
20
  contents: read
21
- packages: read
21
+ packages: write
22
22
 
23
23
  jobs:
24
24
  publish-npm:
@@ -34,40 +34,12 @@ jobs:
34
34
  secrets:
35
35
  NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
36
36
 
37
- publish-jfrog:
38
- name: Publish to JFrog Artifactory
37
+ publish-gh-packages:
38
+ name: Publish to GitHub Packages
39
39
  needs: publish-npm
40
- if: ${{ github.event_name == 'push' && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main' || github.ref == 'refs/heads/move-to-jfrog') }}
41
- runs-on: ubuntu-latest
42
- steps:
43
- - name: Checkout code
44
- uses: actions/checkout@v4
45
-
46
- - name: Setup Node.js
47
- uses: actions/setup-node@v4
48
- with:
49
- node-version: '14.16.1'
50
-
51
- - name: Install dependencies
52
- run: npm install
53
-
54
- - name: Update package version
55
- run: |
56
- VERSION="${{ needs.publish-npm.outputs.version }}"
57
- sed -i "s/{{cicd_version}}/$VERSION/g" package.json
58
- echo "Updated package.json to version $VERSION"
59
-
60
- - name: Configure npm for JFrog Artifactory
61
- env:
62
- ARTIFACTORY_NPM_REPO: ${{ secrets.ARTIFACTORY_NPM_REPO }}
63
- ARTIFACTORY_TOKEN: ${{ secrets.ARTIFACTORY_TOKEN }}
64
- run: |
65
- REGISTRY_HOST=$(echo "$ARTIFACTORY_NPM_REPO" | sed 's|https://||' | sed 's|/$||')
66
- {
67
- echo "registry=${ARTIFACTORY_NPM_REPO}"
68
- echo "//${REGISTRY_HOST}/:_authToken=${ARTIFACTORY_TOKEN}"
69
- } > .npmrc
70
- echo "✓ npm configured for JFrog Artifactory"
71
-
72
- - name: Publish to JFrog Artifactory
73
- run: npm publish
40
+ uses: datarails/dr_github_reusable/.github/workflows/npm-publish-gh-packages.yml@main
41
+ with:
42
+ node_version: '14.16.1'
43
+ package_scope: '@datarails'
44
+ version: ${{ needs.publish-npm.outputs.version }}
45
+ secrets: inherit
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@datarailsshared/dr_renderer",
3
- "version": "1.5.133",
3
+ "version": "1.5.146",
4
4
  "description": "DataRails charts and tables renderer",
5
5
  "keywords": [
6
6
  "datarails",
@@ -771,7 +771,7 @@ DrGaugeChart.getGoalTitleText = function(options) {
771
771
  }
772
772
 
773
773
  DrGaugeChart.dynamicGoalFeatureEnabled = function() {
774
- return DrGaugeChart.highchartsRenderer.hasFeature(helpers.FEATURES.ENABLE_GAUGE_DYNAMIC_GOAL);
774
+ return DrGaugeChart.highchartsRenderer.environment.enableGaugeDynamicGoal;
775
775
  }
776
776
 
777
777
  module.exports = { DrGaugeChart, GAUGE_OPTIONS_DEFAULT };
@@ -70,12 +70,6 @@ function isShowingEmptyValues(additionOptions) {
70
70
  }
71
71
 
72
72
  const DELIMER = ' , '
73
- const FEATURES = {
74
- ENABLE_NEW_WIDGET_VALUE_FORMATTING: 'enable_new_widget_value_formatting',
75
- MULTIPLE_DIMENSION_TAGS: 'multiple_dimension_tags',
76
- USE_NEW_SCENARIO_TAG: 'use_new_scenario_tag',
77
- ENABLE_GAUGE_DYNAMIC_GOAL: 'enable_gauge_dynamic_goal',
78
- }
79
73
 
80
74
  module.exports = {
81
75
  capitalize,
@@ -85,6 +79,5 @@ module.exports = {
85
79
  removeSVGTextCorrection,
86
80
  disableLegendInteractionIfRequired,
87
81
  isShowingEmptyValues,
88
- FEATURES,
89
82
  DELIMER
90
83
  }
@@ -72,10 +72,11 @@ const CHART_AXIS_DEFAULT_LABEL = 'Axis (Category)';
72
72
 
73
73
  const CHART_LEGEND_DEFAULT_LABEL = 'Legend (Series)';
74
74
 
75
- const FEATURES = helpers.FEATURES;
76
-
77
75
  const TICKS_COUNT = 5;
78
76
 
77
+ /**
78
+ * @param {EnvironmentOptions} envOptions
79
+ */
79
80
  let getHighchartsRenderer = function ($, document, Highcharts, default_colors, highchartsRenderer,
80
81
  DataFormatter, lodash, moment_lib, isNewAngular, envOptions) {
81
82
 
@@ -116,7 +117,6 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
116
117
  DrGaugeChart.highchartsRenderer = highchartsRenderer;
117
118
  lodash.assign(highchartsRenderer, HIGHCHARTS_CONSTANTS);
118
119
 
119
- highchartsRenderer.enabledNewWidgetValueFormatting = false;
120
120
  let disableAnimation = false;
121
121
  const environment = envOptions || {};
122
122
  highchartsRenderer.environment = environment;
@@ -327,14 +327,6 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
327
327
  };
328
328
  };
329
329
 
330
- highchartsRenderer.hasFeature = function(featureFlagKey) {
331
- return lodash.includes(highchartsRenderer.features || [], featureFlagKey);
332
- }
333
- highchartsRenderer.setFeatures = function(features) {
334
- highchartsRenderer.features = features || [];
335
- highchartsRenderer.enabledNewWidgetValueFormatting = highchartsRenderer.hasFeature(FEATURES.ENABLE_NEW_WIDGET_VALUE_FORMATTING);
336
- }
337
- highchartsRenderer.setFeatures(lodash.get(environment, 'features', []));
338
330
  disableAnimation = !!lodash.get(environment, 'disable_animation', false);
339
331
 
340
332
  // fix issue of use tootip.stickOnContact with tooltip.outside , source: https://github.com/highcharts/highcharts/pull/15960
@@ -4006,7 +3998,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
4006
3998
  calculated_formats: calculated_info.formats,
4007
3999
  isChangeable: false,
4008
4000
  push: function (record) {
4009
- if (highchartsRenderer.enabledNewWidgetValueFormatting) {
4001
+ if (highchartsRenderer.environment.enabledNewWidgetValueFormatting) {
4010
4002
  record.formats = highchartsRenderer.getRecordFormats(render_options, record['DR_Values']);
4011
4003
  }
4012
4004
 
@@ -4175,7 +4167,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
4175
4167
  var val = parseFloat(record[attr]);
4176
4168
 
4177
4169
  if (!isNaN(val)) {
4178
- if (highchartsRenderer.enabledNewWidgetValueFormatting) {
4170
+ if (highchartsRenderer.environment.enabledNewWidgetValueFormatting) {
4179
4171
  record.formats = highchartsRenderer.getRecordFormats(render_options, record['DR_Values']);
4180
4172
  }
4181
4173
 
@@ -4270,7 +4262,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
4270
4262
  var ref, x;
4271
4263
  x = parseFloat(record[attr]);
4272
4264
  if (!isNaN(x)) {
4273
- if (highchartsRenderer.enabledNewWidgetValueFormatting) {
4265
+ if (highchartsRenderer.environment.enabledNewWidgetValueFormatting) {
4274
4266
  record.formats = highchartsRenderer.getRecordFormats(render_options, record['DR_Values']);
4275
4267
  }
4276
4268
 
@@ -4363,7 +4355,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
4363
4355
  var ref, x;
4364
4356
  x = parseFloat(record[attr]);
4365
4357
  if (!isNaN(x)) {
4366
- if (highchartsRenderer.enabledNewWidgetValueFormatting) {
4358
+ if (highchartsRenderer.environment.enabledNewWidgetValueFormatting) {
4367
4359
  record.formats = highchartsRenderer.getRecordFormats(render_options, record['DR_Values']);
4368
4360
  }
4369
4361
 
@@ -4457,7 +4449,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
4457
4449
  var ref, x;
4458
4450
  x = parseFloat(record[attr]);
4459
4451
  if (!isNaN(x)) {
4460
- if (highchartsRenderer.enabledNewWidgetValueFormatting) {
4452
+ if (highchartsRenderer.environment.enabledNewWidgetValueFormatting) {
4461
4453
  record.formats = highchartsRenderer.getRecordFormats(render_options, record['DR_Values']);
4462
4454
  }
4463
4455
 
@@ -5164,7 +5156,6 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
5164
5156
  ob.is_calculated = template_field.is_calculated;
5165
5157
  ob.values = [];
5166
5158
  ob.new_name = highchartsRenderer.getFieldName(ob.name);
5167
- ob.name_class = highchartsRenderer.getFieldColorClass(template_field);
5168
5159
  ob.date_field_before_split = template_field.date_field_before_split;
5169
5160
  ob.mandatory = template_field.mandatory;
5170
5161
  ob.category = template_field.category;
@@ -5185,35 +5176,6 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
5185
5176
  return tooltip.length ? tooltip.join('\n\n') : highchartsRenderer.getFieldName(highchartsRenderer.decodeFunc(field.name));
5186
5177
  };
5187
5178
 
5188
- highchartsRenderer.isSystemField = function (field) {
5189
- const dynamicSystemFields = [];
5190
-
5191
- const areMultipleAndScenarioTags = highchartsRenderer.hasFeature(FEATURES.MULTIPLE_DIMENSION_TAGS)
5192
- && highchartsRenderer.hasFeature(FEATURES.USE_NEW_SCENARIO_TAG);
5193
-
5194
- if (areMultipleAndScenarioTags) {
5195
- dynamicSystemFields.push('Scenario', 'Budget Cycle');
5196
- }
5197
-
5198
- const regexDelimer = '|';
5199
- const dynamicSystemFieldsRegex = dynamicSystemFields.length ? dynamicSystemFields.join(regexDelimer) + regexDelimer : '';
5200
- var regex = new RegExp(`^(${dynamicSystemFieldsRegex}Calc_Model_Name|Calc_Model_ID|Parent_Name|Parent_Id|FileBox_ID|FileBox_Name|DataMapper_Name|Doc_ID|Doc_version|Label|Submission_Date|User|table_id|Latest_In_Dim|Tab_name|CP_Name|DT_.+|VT_.+|System_.+)$`, "m");
5201
-
5202
- return (field.category && field.category.includes("")) || regex.test(field.name)
5203
- };
5204
-
5205
- highchartsRenderer.getFieldColorClass = function (field) {
5206
- let ret = "green_field"
5207
- if (highchartsRenderer.isSystemField(field)) {
5208
- ret = "blue_filed";
5209
- }
5210
- if (field.mandatory) {
5211
- ret += ' mandatoryfieldborder ';
5212
-
5213
- }
5214
- return ret;
5215
- };
5216
-
5217
5179
  highchartsRenderer.decodeTemplates = function (templates) {
5218
5180
  lodash.forEach(templates, function (template) {
5219
5181
  template.name = highchartsRenderer.decodeFunc(template.name);
@@ -6143,8 +6105,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
6143
6105
 
6144
6106
  highchartsRenderer.suboptions = optionsBuilders.createDefaultSuboptions({
6145
6107
  CHART_TYPES: highchartsRenderer.CHART_TYPES,
6146
- hasFeature: highchartsRenderer.hasFeature,
6147
- ENABLE_GAUGE_DYNAMIC_GOAL: FEATURES.ENABLE_GAUGE_DYNAMIC_GOAL,
6108
+ enableGaugeDynamicGoal: highchartsRenderer.environment.enableGaugeDynamicGoal,
6148
6109
  defaultGaugeSegments: GAUGE_OPTIONS_DEFAULT.segments,
6149
6110
  });
6150
6111
 
@@ -6404,9 +6365,9 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
6404
6365
  [highchartsRenderer.CHART_TYPES.GAUGE_CHART_ENHANCED]: {
6405
6366
  name: 'Gauge chart',
6406
6367
  categoryLabel: 'Gauge',
6407
- displayLabelInEditor: highchartsRenderer.hasFeature(FEATURES.ENABLE_GAUGE_DYNAMIC_GOAL),
6408
- label: highchartsRenderer.hasFeature(FEATURES.ENABLE_GAUGE_DYNAMIC_GOAL) ? 'Static goal' : 'Gauge',
6409
- title: highchartsRenderer.hasFeature(FEATURES.ENABLE_GAUGE_DYNAMIC_GOAL)
6368
+ displayLabelInEditor: highchartsRenderer.environment.enableGaugeDynamicGoal,
6369
+ label: highchartsRenderer.environment.enableGaugeDynamicGoal ? 'Static goal' : 'Gauge',
6370
+ title: highchartsRenderer.environment.enableGaugeDynamicGoal
6410
6371
  ? 'Measures progress toward a goal or a KPI.'
6411
6372
  : 'Track actual performance against targets from your budget or forecast files.',
6412
6373
  axisName: 'X-Axis',
@@ -6929,7 +6890,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
6929
6890
  highchartsRenderer.suboptions["gauge_segments"],
6930
6891
  highchartsRenderer.suboptions["gauge_is_absolute"],
6931
6892
  ],
6932
- hidden: !highchartsRenderer.hasFeature(FEATURES.ENABLE_GAUGE_DYNAMIC_GOAL),
6893
+ hidden: !highchartsRenderer.environment.enableGaugeDynamicGoal,
6933
6894
  },
6934
6895
  ]
6935
6896
  },
@@ -8222,7 +8183,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
8222
8183
  // In all other cases we are applying format from editor panel to both of them (specification: DR-20955)
8223
8184
  highchartsRenderer.isUsingWidgetValuesFormat = function (pivotData, render_options, widget_values_format) {
8224
8185
  const { isSecondaryAxis, isCustomFormat } = highchartsRenderer.checkFormats(render_options, widget_values_format);
8225
- return !highchartsRenderer.enabledNewWidgetValueFormatting || !highchartsRenderer.isChartWithMultiValues(pivotData) || !isSecondaryAxis || isCustomFormat;
8186
+ return !highchartsRenderer.environment.enabledNewWidgetValueFormatting || !highchartsRenderer.isChartWithMultiValues(pivotData) || !isSecondaryAxis || isCustomFormat;
8226
8187
  }
8227
8188
 
8228
8189
  highchartsRenderer.isFormattingNumberAxis = function (pivotData) {
@@ -8238,10 +8199,11 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
8238
8199
  lodash.forEach(values, (value, key) => {
8239
8200
  const formatInfo = pivotData[type][key] || {};
8240
8201
  const valueToFloat = parseFloat(value);
8202
+ const isBlankDate = formatInfo.type === 'Date' && (value === '' || value === '[blank]');
8241
8203
  const isDate = formatInfo.type === 'Date' && (moment_lib(valueToFloat).isValid() || moment_lib(value, formatInfo.format).isValid());
8242
8204
  const isNumberFormatting = !isDate && formatInfo.format && highchartsRenderer.isFormattingNumberAxis(pivotData);
8243
8205
 
8244
- if (isNumberFormatting || isDate) {
8206
+ if (isNumberFormatting || isDate || isBlankDate) {
8245
8207
  values[key] = highchartsRenderer.returnRawDataValue(
8246
8208
  formatInfo.type,
8247
8209
  !isNaN(valueToFloat) ? valueToFloat : value,
package/src/index.d.ts CHANGED
@@ -39,6 +39,12 @@ declare namespace DrRenderFactory {
39
39
  fiscal_year_starts_from?: number;
40
40
  fiscal_year_back?: boolean;
41
41
  enableStackedPercentCharts?: boolean;
42
+
43
+ /** TODO: remove in DR-42736 */
44
+ enabledNewWidgetValueFormatting?: boolean;
45
+
46
+ /** Allow specifying custom gauge goal title */
47
+ enableGaugeDynamicGoal?: boolean;
42
48
  }
43
49
 
44
50
  interface Factory {
@@ -56,10 +56,10 @@ const LABEL_PIE_DISABLED_CONDITION = {
56
56
  */
57
57
  const TOOLTIP_DISABLED_CONDITION = {
58
58
  disabled_str: '!{var}.show_out_of_x_axis && !{var}.show_out_of_data_series && !{var}.show_value && !{var}.show_x_axis && !{var}.show_data_series',
59
- disabled_fn: (value) => !value.show_out_of_x_axis
60
- && !value.show_out_of_data_series
61
- && !value.show_value
62
- && !value.show_x_axis
59
+ disabled_fn: (value) => !value.show_out_of_x_axis
60
+ && !value.show_out_of_data_series
61
+ && !value.show_value
62
+ && !value.show_x_axis
63
63
  && !value.show_data_series,
64
64
  };
65
65
 
@@ -217,8 +217,8 @@ const createSuboption = (categoryType, categoryLabel, elements, options = {}) =>
217
217
  * @param {LabelOptions} value - Current option values
218
218
  */
219
219
  const labelValueClickFn = (value) => {
220
- value.show = value.show
221
- ? value.show_out_of_x_axis || value.show_out_of_data_series || value.show_value
220
+ value.show = value.show
221
+ ? value.show_out_of_x_axis || value.show_out_of_data_series || value.show_value
222
222
  : value.show;
223
223
  };
224
224
 
@@ -227,8 +227,8 @@ const labelValueClickFn = (value) => {
227
227
  * @param {LabelPieOptions} value - Current option values
228
228
  */
229
229
  const labelPieClickFn = (value) => {
230
- value.show = value.show
231
- ? value.show_percentage_in_labels || value.show_value_in_labels
230
+ value.show = value.show
231
+ ? value.show_percentage_in_labels || value.show_value_in_labels
232
232
  : value.show;
233
233
  };
234
234
 
@@ -247,8 +247,8 @@ const tooltipClickFn = (value) => {
247
247
  * @param {TooltipPieOptions} value - Current option values
248
248
  */
249
249
  const tooltipPieClickFn = (value) => {
250
- value.show = value.show
251
- ? value.show_percentage || value.show_value
250
+ value.show = value.show
251
+ ? value.show_percentage || value.show_value
252
252
  : value.show;
253
253
  };
254
254
 
@@ -299,8 +299,7 @@ const withLabelPie = () => createSuboption('label_pie', 'Label', [
299
299
  /**
300
300
  * Label gauge configuration options.
301
301
  * @typedef {Object} LabelGaugeConfig
302
- * @property {FeatureChecker} [hasFeature] - Feature flag checker function
303
- * @property {string} [ENABLE_GAUGE_DYNAMIC_GOAL] - Feature flag name
302
+ * @property {boolean} [enableGaugeDynamicGoal] - Allow specifying custom gauge goal title
304
303
  */
305
304
 
306
305
  /**
@@ -309,8 +308,8 @@ const withLabelPie = () => createSuboption('label_pie', 'Label', [
309
308
  * @returns {SuboptionDefinition}
310
309
  */
311
310
  const withLabelGauge = (config = {}) => {
312
- const { hasFeature, ENABLE_GAUGE_DYNAMIC_GOAL } = config;
313
-
311
+ const { enableGaugeDynamicGoal } = config;
312
+
314
313
  return createSuboption('label', 'Label', [
315
314
  GAUGE_SHOW_TOGGLE,
316
315
  ...createLabelStyleGroup({ fontSize: 16, fontColor: '#333' }),
@@ -320,7 +319,7 @@ const withLabelGauge = (config = {}) => {
320
319
  createCheckbox('show_goal_name', 'Show Goal label', true),
321
320
  createInput('goal_name', 'Goal name', 'Goal', {
322
321
  show_in_one_row: true,
323
- showFn: () => !!(hasFeature && ENABLE_GAUGE_DYNAMIC_GOAL && hasFeature(ENABLE_GAUGE_DYNAMIC_GOAL)),
322
+ showFn: () => !!enableGaugeDynamicGoal,
324
323
  }),
325
324
  ]);
326
325
  };
@@ -359,8 +358,8 @@ const withLabelWithPercentagePercentStacked = () => {
359
358
  createToggle('hide_subtotals', 'Hide subtotals', false),
360
359
  ...createLabelStyleGroup(),
361
360
  createDivider(),
362
- createCheckbox('show_value', 'Value', true, { clickFn: labelValueClickFn }),
363
- createCheckbox('show_out_of_x_axis', '% Out of [X Axis]', false, { clickFn: labelValueClickFn }),
361
+ createCheckbox('show_value', 'Value', false, { clickFn: labelValueClickFn }),
362
+ createCheckbox('show_out_of_x_axis', '% Out of [X Axis]', true, { clickFn: labelValueClickFn }),
364
363
  createCheckbox('show_out_of_data_series', '% Out of [Data Series]', false, { clickFn: labelValueClickFn }),
365
364
  // present_total and show_percentage removed - total is always 100% for percent stacking
366
365
  ]);
@@ -491,7 +490,7 @@ const withTableOptions = () => {
491
490
  */
492
491
  const withTableOptionsTranspose = (config = {}) => {
493
492
  const { CHART_TYPES } = config;
494
-
493
+
495
494
  return createSuboption('table_options', 'Table', [
496
495
  createInput('table_colors_offset', 'Colors offset', 0),
497
496
  createCheckbox('show_column_total', 'Column totals', true),
@@ -878,7 +877,7 @@ module.exports = {
878
877
  LABEL_PIE_DISABLED_CONDITION,
879
878
  TOOLTIP_DISABLED_CONDITION,
880
879
  TOOLTIP_PIE_DISABLED_CONDITION,
881
-
880
+
882
881
  // Reusable elements
883
882
  LABEL_SHOW_TOGGLE,
884
883
  LABEL_PIE_SHOW_TOGGLE,
@@ -886,39 +885,39 @@ module.exports = {
886
885
  TOOLTIP_SHOW_TOGGLE,
887
886
  TOOLTIP_PIE_SHOW_TOGGLE,
888
887
  GAUGE_SHOW_TOGGLE,
889
-
888
+
890
889
  // Helper
891
890
  createSuboption,
892
-
891
+
893
892
  // Label builders
894
893
  withLabel,
895
894
  withLabelPie,
896
895
  withLabelGauge,
897
896
  withLabelWithPercentage,
898
897
  withLabelWithPercentagePercentStacked,
899
-
898
+
900
899
  // Tooltip builders
901
900
  withTooltip,
902
901
  withTooltipPie,
903
902
  withTooltipGauge,
904
-
903
+
905
904
  // Axis builders
906
905
  withAxisY,
907
906
  withAxisYPercentStacked,
908
907
  withAxisX,
909
-
908
+
910
909
  // Table builders
911
910
  withTableOptions,
912
911
  withTableOptionsTranspose,
913
912
  withTableOptionsGauge,
914
913
  withTableDesignOptions,
915
-
914
+
916
915
  // Chart config builders
917
916
  withChart,
918
917
  withChartGrid,
919
918
  withChartForecast,
920
919
  withChartPosition,
921
-
920
+
922
921
  // Other builders
923
922
  withWidgetLibrary,
924
923
  withSubtitle,
@@ -935,7 +934,7 @@ module.exports = {
935
934
  withGaugeGoal,
936
935
  withGaugeSegments,
937
936
  withGaugeIsAbsolute,
938
-
937
+
939
938
  // Click handlers (exported for testing)
940
939
  labelValueClickFn,
941
940
  labelPieClickFn,
@@ -1,23 +1,23 @@
1
1
  /**
2
2
  * @fileoverview Chart Options Builder API
3
- *
3
+ *
4
4
  * This module provides a functional builder pattern for creating chart suboption
5
5
  * configurations. It allows for composable, reusable option definitions with
6
6
  * full type support.
7
- *
7
+ *
8
8
  * @module @datarailsshared/dr_renderer/options
9
- *
9
+ *
10
10
  * @example
11
11
  * // Import builders
12
12
  * const { withLabel, withTooltip, buildSuboptions } = require('@datarailsshared/dr_renderer').options;
13
- *
13
+ *
14
14
  * // Build custom suboptions
15
15
  * const suboptions = buildSuboptions([withLabel, withTooltip]);
16
- *
16
+ *
17
17
  * @example
18
18
  * // Get preset for a chart type
19
19
  * const { getPresetForChart, buildSuboptionsForChart } = require('@datarailsshared/dr_renderer').options;
20
- *
20
+ *
21
21
  * const columnChartOptions = buildSuboptionsForChart('column-chart');
22
22
  */
23
23
 
@@ -51,8 +51,7 @@ const helpers = require('./helpers');
51
51
  * Configuration for createDefaultSuboptions.
52
52
  * @typedef {Object} CreateDefaultSuboptionsConfig
53
53
  * @property {import('./constants').ChartTypesMap} [CHART_TYPES] - Chart types enum (for table options)
54
- * @property {FeatureChecker} [hasFeature] - Feature flag checker function
55
- * @property {string} [ENABLE_GAUGE_DYNAMIC_GOAL] - Feature flag name for gauge dynamic goal
54
+ * @property {boolean} [enableGaugeDynamicGoal] - Allow specifying custom gauge goal title
56
55
  * @property {import('./builders').GaugeSegment[]} [defaultGaugeSegments] - Default gauge segments array
57
56
  */
58
57
 
@@ -79,10 +78,7 @@ const createDefaultSuboptions = (config = {}) => ({
79
78
  'chart_position': builders.withChartPosition(),
80
79
  'label': builders.withLabel(),
81
80
  'label_pie': builders.withLabelPie(),
82
- 'label_gauge': builders.withLabelGauge({
83
- hasFeature: config.hasFeature,
84
- ENABLE_GAUGE_DYNAMIC_GOAL: config.ENABLE_GAUGE_DYNAMIC_GOAL
85
- }),
81
+ 'label_gauge': builders.withLabelGauge({ enableGaugeDynamicGoal: config.enableGaugeDynamicGoal }),
86
82
  'label_with_percentage': builders.withLabelWithPercentage(),
87
83
  'label_with_percentage_percent_stacked': builders.withLabelWithPercentagePercentStacked(),
88
84
  'axisY': builders.withAxisY(),
@@ -118,7 +114,7 @@ module.exports = {
118
114
  LABEL_DEFAULT_OPTIONS: constants.LABEL_DEFAULT_OPTIONS,
119
115
  SUBOPTIONS_FONT_SIZE_VALUES: constants.SUBOPTIONS_FONT_SIZE_VALUES,
120
116
  DEFAULT_CATEGORY_CLASS: constants.DEFAULT_CATEGORY_CLASS,
121
-
117
+
122
118
  // Element factories
123
119
  createToggle: elements.createToggle,
124
120
  createCheckbox: elements.createCheckbox,
@@ -132,36 +128,36 @@ module.exports = {
132
128
  createFontStylingGroup: elements.createFontStylingGroup,
133
129
  createLabelStyleGroup: elements.createLabelStyleGroup,
134
130
  createTooltipStyleGroup: elements.createTooltipStyleGroup,
135
-
131
+
136
132
  // Label builders
137
133
  withLabel: builders.withLabel,
138
134
  withLabelPie: builders.withLabelPie,
139
135
  withLabelGauge: builders.withLabelGauge,
140
136
  withLabelWithPercentage: builders.withLabelWithPercentage,
141
137
  withLabelWithPercentagePercentStacked: builders.withLabelWithPercentagePercentStacked,
142
-
138
+
143
139
  // Tooltip builders
144
140
  withTooltip: builders.withTooltip,
145
141
  withTooltipPie: builders.withTooltipPie,
146
142
  withTooltipGauge: builders.withTooltipGauge,
147
-
143
+
148
144
  // Axis builders
149
145
  withAxisY: builders.withAxisY,
150
146
  withAxisYPercentStacked: builders.withAxisYPercentStacked,
151
147
  withAxisX: builders.withAxisX,
152
-
148
+
153
149
  // Table builders
154
150
  withTableOptions: builders.withTableOptions,
155
151
  withTableOptionsTranspose: builders.withTableOptionsTranspose,
156
152
  withTableOptionsGauge: builders.withTableOptionsGauge,
157
153
  withTableDesignOptions: builders.withTableDesignOptions,
158
-
154
+
159
155
  // Chart config builders
160
156
  withChart: builders.withChart,
161
157
  withChartGrid: builders.withChartGrid,
162
158
  withChartForecast: builders.withChartForecast,
163
159
  withChartPosition: builders.withChartPosition,
164
-
160
+
165
161
  // Other builders
166
162
  withWidgetLibrary: builders.withWidgetLibrary,
167
163
  withSubtitle: builders.withSubtitle,
@@ -178,16 +174,16 @@ module.exports = {
178
174
  withGaugeGoal: builders.withGaugeGoal,
179
175
  withGaugeSegments: builders.withGaugeSegments,
180
176
  withGaugeIsAbsolute: builders.withGaugeIsAbsolute,
181
-
177
+
182
178
  // Helper function
183
179
  createSuboption: builders.createSuboption,
184
-
180
+
185
181
  // Reusable disabled conditions
186
182
  LABEL_DISABLED_CONDITION: builders.LABEL_DISABLED_CONDITION,
187
183
  LABEL_PIE_DISABLED_CONDITION: builders.LABEL_PIE_DISABLED_CONDITION,
188
184
  TOOLTIP_DISABLED_CONDITION: builders.TOOLTIP_DISABLED_CONDITION,
189
185
  TOOLTIP_PIE_DISABLED_CONDITION: builders.TOOLTIP_PIE_DISABLED_CONDITION,
190
-
186
+
191
187
  // Reusable elements
192
188
  LABEL_SHOW_TOGGLE: builders.LABEL_SHOW_TOGGLE,
193
189
  LABEL_PIE_SHOW_TOGGLE: builders.LABEL_PIE_SHOW_TOGGLE,
@@ -195,7 +191,7 @@ module.exports = {
195
191
  TOOLTIP_SHOW_TOGGLE: builders.TOOLTIP_SHOW_TOGGLE,
196
192
  TOOLTIP_PIE_SHOW_TOGGLE: builders.TOOLTIP_PIE_SHOW_TOGGLE,
197
193
  GAUGE_SHOW_TOGGLE: builders.GAUGE_SHOW_TOGGLE,
198
-
194
+
199
195
  // Presets and utilities
200
196
  CHART_TYPES: constants.CHART_TYPES,
201
197
  CHART_PRESETS: presets.CHART_PRESETS,
@@ -206,10 +202,10 @@ module.exports = {
206
202
  buildSuboptions: presets.buildSuboptions,
207
203
  getChartTypes: presets.getChartTypes,
208
204
  hasPreset: presets.hasPreset,
209
-
205
+
210
206
  // Helpers
211
207
  chartHasVerticalDataLabelsOption: helpers.chartHasVerticalDataLabelsOption,
212
-
208
+
213
209
  // Factory functions
214
210
  createDefaultSuboptions,
215
211
  };