react-semaphor 0.1.19 → 0.1.21

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.
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../chunks/dashboard-plus-_lhN-s45.js"),r=require("../types/index.cjs");exports.Surfboard=e.DashboardPlus;exports.EMPTY_SELECTION=r.EMPTY_SELECTION;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../chunks/dashboard-plus-CxeKQLr6.js"),r=require("../types/index.cjs");exports.Surfboard=e.DashboardPlus;exports.EMPTY_SELECTION=r.EMPTY_SELECTION;
@@ -1,4 +1,4 @@
1
- import { D as f } from "../chunks/dashboard-plus-XEKMZ7Lk.js";
1
+ import { D as f } from "../chunks/dashboard-plus-DNG6HyXE.js";
2
2
  import { EMPTY_SELECTION as a } from "../types/index.js";
3
3
  export {
4
4
  a as EMPTY_SELECTION,
@@ -104,7 +104,7 @@ declare interface CardConfig {
104
104
  * Configuration for on-click dashboard filters triggered by this card.
105
105
  */
106
106
  clickFilterInteractions?: ClickFilterInteraction[];
107
- comparisonType?: 'none' | 'previous_period' | 'same_period_last_year' | 'target';
107
+ comparisonType?: 'none' | 'previous_period' | 'same_period_last_year' | 'target' | 'start_vs_end';
108
108
  targetValue?: number;
109
109
  showTrendline?: boolean;
110
110
  trendlineWindow?: number;
@@ -347,6 +347,8 @@ export declare type DateOptions = {
347
347
  options: Intl.DateTimeFormatOptions;
348
348
  };
349
349
 
350
+ declare type DateUnit = 'day' | 'week' | 'month' | 'quarter' | 'year';
351
+
350
352
  declare type Dialect = 'mysql' | 'postgres' | 'bigquery' | 'redshift' | 'snowflake' | 'clickhouse' | 'duckdb';
351
353
 
352
354
  export declare type DisplayDataType = 'string' | 'date' | 'number' | 'html' | 'none';
@@ -505,6 +507,7 @@ declare type FilterForCompare = BaseFilter & {
505
507
  declare type FilterForDate = BaseFilter & {
506
508
  operation: 'between' | 'not between';
507
509
  values: [Date, Date];
510
+ relativeMeta?: RelativeDateFilter;
508
511
  };
509
512
 
510
513
  declare type FilterForEqual = BaseFilter & {
@@ -752,6 +755,25 @@ declare type RangeValue = {
752
755
  gt?: string | number;
753
756
  };
754
757
 
758
+ declare type RelativeDateFilter = {
759
+ mode: 'last';
760
+ n: number;
761
+ unit: DateUnit;
762
+ complete?: boolean;
763
+ } | {
764
+ mode: 'this';
765
+ unit: DateUnit;
766
+ toDate?: boolean;
767
+ } | {
768
+ mode: 'previous';
769
+ unit: DateUnit;
770
+ } | {
771
+ mode: 'between';
772
+ unit: DateUnit;
773
+ from: number;
774
+ to: number;
775
+ };
776
+
755
777
  declare type SelectedEntities = DatabaseEntityReference[] | DataModelEntityReference[] | FileEntityReference[];
756
778
 
757
779
  export declare type SelectionState = Record<Level, string | null>;
@@ -344,7 +344,7 @@ export declare interface CardConfig {
344
344
  * Configuration for on-click dashboard filters triggered by this card.
345
345
  */
346
346
  clickFilterInteractions?: ClickFilterInteraction[];
347
- comparisonType?: 'none' | 'previous_period' | 'same_period_last_year' | 'target';
347
+ comparisonType?: 'none' | 'previous_period' | 'same_period_last_year' | 'target' | 'start_vs_end';
348
348
  targetValue?: number;
349
349
  showTrendline?: boolean;
350
350
  trendlineWindow?: number;
@@ -506,6 +506,13 @@ export declare type ConnectionType = 'GoogleSheets' | 'MySQL' | 'MSSQL' | 'Postg
506
506
 
507
507
  export declare type ContainerId = 'groupBy' | 'metrics' | 'pivotBy' | 'sortBy' | 'source';
508
508
 
509
+ /**
510
+ * Factory function to create empty KPI card configuration
511
+ * Returns a fresh config with new array instances to prevent shared references
512
+ * Used when switching to KPI chart type
513
+ */
514
+ export declare const createEmptyKpiConfig: () => CardConfig;
515
+
509
516
  export declare function createSqlGenConfig(column: TDataColumn, preSqlGen: SqlGen, calc?: AggregateCalc): SqlGen;
510
517
 
511
518
  export declare type CustomCard = CardWithContent | CardWithFooter;
@@ -684,6 +691,8 @@ export declare type DateOptions = {
684
691
 
685
692
  export { DateRange }
686
693
 
694
+ declare type DateUnit = 'day' | 'week' | 'month' | 'quarter' | 'year';
695
+
687
696
  export declare type Dialect = 'mysql' | 'postgres' | 'bigquery' | 'redshift' | 'snowflake' | 'clickhouse' | 'duckdb';
688
697
 
689
698
  export declare type DisplayDataType = 'string' | 'date' | 'number' | 'html' | 'none';
@@ -964,6 +973,7 @@ declare type FilterForCompare = BaseFilter & {
964
973
  declare type FilterForDate = BaseFilter & {
965
974
  operation: 'between' | 'not between';
966
975
  values: [Date, Date];
976
+ relativeMeta?: RelativeDateFilter;
967
977
  };
968
978
 
969
979
  declare type FilterForEqual = BaseFilter & {
@@ -1323,6 +1333,25 @@ export declare type RangeValue = {
1323
1333
  gt?: string | number;
1324
1334
  };
1325
1335
 
1336
+ declare type RelativeDateFilter = {
1337
+ mode: 'last';
1338
+ n: number;
1339
+ unit: DateUnit;
1340
+ complete?: boolean;
1341
+ } | {
1342
+ mode: 'this';
1343
+ unit: DateUnit;
1344
+ toDate?: boolean;
1345
+ } | {
1346
+ mode: 'previous';
1347
+ unit: DateUnit;
1348
+ } | {
1349
+ mode: 'between';
1350
+ unit: DateUnit;
1351
+ from: number;
1352
+ to: number;
1353
+ };
1354
+
1326
1355
  export declare function resolveDatamodelName(datamodelName: string): string;
1327
1356
 
1328
1357
  export declare const resolveDataType: (value: any) => string;
@@ -2109,6 +2138,7 @@ export declare function useDateFilterHook(filterId: string): {
2109
2138
  dateRange: DateRange | undefined;
2110
2139
  handleClear: () => void;
2111
2140
  handleChange: (date: DateRange | undefined) => void;
2141
+ handleRelativeChange: (date: DateRange | undefined, relativeMeta: RelativeDateFilter) => void;
2112
2142
  handleReset: () => void;
2113
2143
  };
2114
2144
 
@@ -104,7 +104,7 @@ declare interface CardConfig {
104
104
  * Configuration for on-click dashboard filters triggered by this card.
105
105
  */
106
106
  clickFilterInteractions?: ClickFilterInteraction[];
107
- comparisonType?: 'none' | 'previous_period' | 'same_period_last_year' | 'target';
107
+ comparisonType?: 'none' | 'previous_period' | 'same_period_last_year' | 'target' | 'start_vs_end';
108
108
  targetValue?: number;
109
109
  showTrendline?: boolean;
110
110
  trendlineWindow?: number;
@@ -350,6 +350,8 @@ export declare type DateOptions = {
350
350
  options: Intl.DateTimeFormatOptions;
351
351
  };
352
352
 
353
+ declare type DateUnit = 'day' | 'week' | 'month' | 'quarter' | 'year';
354
+
353
355
  declare type Dialect = 'mysql' | 'postgres' | 'bigquery' | 'redshift' | 'snowflake' | 'clickhouse' | 'duckdb';
354
356
 
355
357
  export declare type DisplayDataType = 'string' | 'date' | 'number' | 'html' | 'none';
@@ -508,6 +510,7 @@ declare type FilterForCompare = BaseFilter & {
508
510
  declare type FilterForDate = BaseFilter & {
509
511
  operation: 'between' | 'not between';
510
512
  values: [Date, Date];
513
+ relativeMeta?: RelativeDateFilter;
511
514
  };
512
515
 
513
516
  declare type FilterForEqual = BaseFilter & {
@@ -755,6 +758,25 @@ declare type RangeValue = {
755
758
  gt?: string | number;
756
759
  };
757
760
 
761
+ declare type RelativeDateFilter = {
762
+ mode: 'last';
763
+ n: number;
764
+ unit: DateUnit;
765
+ complete?: boolean;
766
+ } | {
767
+ mode: 'this';
768
+ unit: DateUnit;
769
+ toDate?: boolean;
770
+ } | {
771
+ mode: 'previous';
772
+ unit: DateUnit;
773
+ } | {
774
+ mode: 'between';
775
+ unit: DateUnit;
776
+ from: number;
777
+ to: number;
778
+ };
779
+
758
780
  declare type SelectedEntities = DatabaseEntityReference[] | DataModelEntityReference[] | FileEntityReference[];
759
781
 
760
782
  export declare type SelectionState = Record<Level, string | null>;
@@ -103,7 +103,7 @@ declare interface CardConfig {
103
103
  * Configuration for on-click dashboard filters triggered by this card.
104
104
  */
105
105
  clickFilterInteractions?: ClickFilterInteraction[];
106
- comparisonType?: 'none' | 'previous_period' | 'same_period_last_year' | 'target';
106
+ comparisonType?: 'none' | 'previous_period' | 'same_period_last_year' | 'target' | 'start_vs_end';
107
107
  targetValue?: number;
108
108
  showTrendline?: boolean;
109
109
  trendlineWindow?: number;
@@ -344,6 +344,8 @@ export declare type DateOptions = {
344
344
  options: Intl.DateTimeFormatOptions;
345
345
  };
346
346
 
347
+ declare type DateUnit = 'day' | 'week' | 'month' | 'quarter' | 'year';
348
+
347
349
  declare type Dialect = 'mysql' | 'postgres' | 'bigquery' | 'redshift' | 'snowflake' | 'clickhouse' | 'duckdb';
348
350
 
349
351
  export declare type DisplayDataType = 'string' | 'date' | 'number' | 'html' | 'none';
@@ -502,6 +504,7 @@ declare type FilterForCompare = BaseFilter & {
502
504
  declare type FilterForDate = BaseFilter & {
503
505
  operation: 'between' | 'not between';
504
506
  values: [Date, Date];
507
+ relativeMeta?: RelativeDateFilter;
505
508
  };
506
509
 
507
510
  declare type FilterForEqual = BaseFilter & {
@@ -749,6 +752,25 @@ declare type RangeValue = {
749
752
  gt?: string | number;
750
753
  };
751
754
 
755
+ declare type RelativeDateFilter = {
756
+ mode: 'last';
757
+ n: number;
758
+ unit: DateUnit;
759
+ complete?: boolean;
760
+ } | {
761
+ mode: 'this';
762
+ unit: DateUnit;
763
+ toDate?: boolean;
764
+ } | {
765
+ mode: 'previous';
766
+ unit: DateUnit;
767
+ } | {
768
+ mode: 'between';
769
+ unit: DateUnit;
770
+ from: number;
771
+ to: number;
772
+ };
773
+
752
774
  declare type SelectedEntities = DatabaseEntityReference[] | DataModelEntityReference[] | FileEntityReference[];
753
775
 
754
776
  export declare type SelectionState = Record<Level, string | null>;
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "email": "support@semaphor.cloud"
6
6
  },
7
7
  "license": "MIT",
8
- "version": "0.1.19",
8
+ "version": "0.1.21",
9
9
  "description": "Fully interactive and customizable dashboards for your apps.",
10
10
  "keywords": [
11
11
  "react",