@thoughtspot/ts-chart-sdk 0.0.2-alpha.23 → 0.0.2-alpha.24

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.
Files changed (45) hide show
  1. package/dist/ts-chart-sdk.d.ts +17 -1
  2. package/lib/main/custom-chart-context.d.ts.map +1 -1
  3. package/lib/main/custom-chart-context.js +10 -8
  4. package/lib/main/custom-chart-context.js.map +1 -1
  5. package/lib/main/logger.d.ts +13 -0
  6. package/lib/main/logger.d.ts.map +1 -0
  7. package/lib/main/logger.js +64 -0
  8. package/lib/main/logger.js.map +1 -0
  9. package/lib/main/logger.spec.d.ts +2 -0
  10. package/lib/main/logger.spec.d.ts.map +1 -0
  11. package/lib/main/logger.spec.js +88 -0
  12. package/lib/main/logger.spec.js.map +1 -0
  13. package/lib/main/util.d.ts +2 -0
  14. package/lib/main/util.d.ts.map +1 -1
  15. package/lib/main/util.js +11 -0
  16. package/lib/main/util.js.map +1 -1
  17. package/lib/main/util.spec.js +43 -1
  18. package/lib/main/util.spec.js.map +1 -1
  19. package/lib/react/use-custom-chart-context.d.ts.map +1 -1
  20. package/lib/react/use-custom-chart-context.js +3 -1
  21. package/lib/react/use-custom-chart-context.js.map +1 -1
  22. package/lib/react/use-custom-chart-context.util.d.ts.map +1 -1
  23. package/lib/react/use-custom-chart-context.util.js +5 -3
  24. package/lib/react/use-custom-chart-context.util.js.map +1 -1
  25. package/lib/types/common.types.d.ts +6 -0
  26. package/lib/types/common.types.d.ts.map +1 -1
  27. package/lib/types/ts-to-chart-event.types.d.ts.map +1 -1
  28. package/lib/types/ts-to-chart-event.types.js.map +1 -1
  29. package/lib/types/visual-prop.types.d.ts +11 -1
  30. package/lib/types/visual-prop.types.d.ts.map +1 -1
  31. package/lib/utils/date-formatting.d.ts.map +1 -1
  32. package/lib/utils/date-formatting.js +4 -2
  33. package/lib/utils/date-formatting.js.map +1 -1
  34. package/package.json +1 -1
  35. package/src/main/custom-chart-context.ts +10 -9
  36. package/src/main/logger.spec.ts +114 -0
  37. package/src/main/logger.ts +97 -0
  38. package/src/main/util.spec.ts +54 -1
  39. package/src/main/util.ts +20 -0
  40. package/src/react/use-custom-chart-context.tsx +4 -1
  41. package/src/react/use-custom-chart-context.util.ts +6 -3
  42. package/src/types/common.types.ts +7 -0
  43. package/src/types/ts-to-chart-event.types.ts +0 -1
  44. package/src/types/visual-prop.types.ts +43 -2
  45. package/src/utils/date-formatting.ts +5 -2
@@ -188,10 +188,17 @@ export type SuccessValidationResponse = {
188
188
  visualPropEditorDefinition: VisualPropEditorDefinition;
189
189
  };
190
190
 
191
+ export type VisualPropError = {
192
+ propElementKey: string;
193
+ propElementType: string;
194
+ value: unknown;
195
+ };
196
+
191
197
  // Generic Validation Response
192
198
  export type ValidationResponse = {
193
199
  isValid: boolean;
194
200
  validationErrorMessage?: string[];
201
+ visualPropError?: VisualPropError;
195
202
  };
196
203
 
197
204
  /**
@@ -73,7 +73,6 @@ export enum TSToChartEvent {
73
73
  * @version SDK: 0.1 | ThoughtSpot:
74
74
  */
75
75
  AxisMenuActionClick = 'AxisMenuActionClick',
76
-
77
76
  /**
78
77
  * @version SDK: 0.2 | ThoughtSpot:
79
78
  */
@@ -11,6 +11,11 @@
11
11
  import type { CustomChartContext } from '../main/custom-chart-context';
12
12
  import { ColumnType } from './answer-column.types';
13
13
  import { ChartModel } from './common.types';
14
+
15
+ export type TSTooltipConfig = {
16
+ columnIds: Array<string>;
17
+ };
18
+
14
19
  /**
15
20
  * Configuration for input validation rules
16
21
  */
@@ -386,13 +391,48 @@ export interface Section {
386
391
  */
387
392
  disabled?: boolean;
388
393
  /* Optional property to make the accordian expanded by default. If
389
- * not passed the accordian will remain closed by default. Only works with layout type 'accordian'
394
+ * not passed the accordian will remain closed by default. Only works with layout type
395
+ * 'accordian'
390
396
  *
391
397
  * @version SDK: 0.0.2-alpha.19 | ThoughtSpot:
392
398
  */
393
399
  isAccordianExpanded?: boolean;
394
400
  }
395
401
 
402
+ /**
403
+ * Native charts edit tool tip component defined for regular charts in TS Advance Chart Settings
404
+ *
405
+ * @group Visual Properties Editor
406
+ */
407
+ export interface NativeEditToolTip {
408
+ type: 'tooltipconfig';
409
+ /**
410
+ * Key to store the value
411
+ *
412
+ * @version SDK: 0.1 | ThoughtSpot:
413
+ */
414
+ key: string;
415
+
416
+ /*
417
+ List of column ids that are present in ToolTipConfig by default
418
+ */
419
+
420
+ defaultValue?: TSTooltipConfig;
421
+
422
+ /**
423
+ * I18n'ed string to show on the form label
424
+ *
425
+ * @version SDK: 0.1 | ThoughtSpot:
426
+ */
427
+ label?: string;
428
+ /**
429
+ * Determines whether it should be disabled or not
430
+ *
431
+ * @version SDK: 0.0.2-alpha.13 | ThoughtSpot:
432
+ */
433
+ disabled?: boolean;
434
+ }
435
+
396
436
  /**
397
437
  * Common type placeholder for all the input element types
398
438
  *
@@ -406,7 +446,8 @@ export type PropElement =
406
446
  | ToggleFormDetail
407
447
  | CheckboxFormDetail
408
448
  | RadioButtonFormDetail
409
- | DropDownFormDetail;
449
+ | DropDownFormDetail
450
+ | NativeEditToolTip;
410
451
 
411
452
  /**
412
453
  * Define Column settings, based on column type, settings needs to be defined in
@@ -8,6 +8,7 @@
8
8
 
9
9
  import _ from 'lodash';
10
10
  import { DateTime } from 'luxon';
11
+ import { create } from '../main/logger';
11
12
  import {
12
13
  ChartColumn,
13
14
  ColumnTimeBucket,
@@ -15,6 +16,8 @@ import {
15
16
  DataType,
16
17
  } from '../types/answer-column.types';
17
18
 
19
+ const logger = create('DateFormattingUtilsSdk');
20
+
18
21
  export interface CustomCalendarDate {
19
22
  v: {
20
23
  s: number;
@@ -615,7 +618,7 @@ export function formatDateNum(
615
618
  case dateNumTypes.DATE_NUM_HOUR_IN_DAY:
616
619
  return `${value}`;
617
620
  default:
618
- console.log(
621
+ logger.log(
619
622
  'unknown effectiveDataType for date num',
620
623
  effectiveDataType,
621
624
  );
@@ -664,7 +667,7 @@ export function formatDate(
664
667
  epochMillis = newInputDate.getTime();
665
668
  }
666
669
  if (!_.isNumber(epochMillis)) {
667
- console.log(
670
+ logger.log(
668
671
  'formatDate could not convert input date to a timestamp',
669
672
  inputDate,
670
673
  );