react-semaphor 0.1.596 → 0.1.598

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 (69) hide show
  1. package/dist/analytics-protocol/index.js +329 -322
  2. package/dist/assistant-context/index.js +1 -1
  3. package/dist/brand-studio/index.js +7 -7
  4. package/dist/briefings/index.js +4 -4
  5. package/dist/chunks/{aggregate-measure-field-DHlDj0Pc.js → aggregate-measure-field-DtKcEjG5.js} +2 -2
  6. package/dist/chunks/{assistant-chat-DodZKMI6.js → assistant-chat-DrI442Ld.js} +13 -13
  7. package/dist/chunks/{bookmark-impact-Dh-wiTs3.js → bookmark-impact-C6uWtNWF.js} +3 -3
  8. package/dist/chunks/{bookmark-state-Be2W3s6t.js → bookmark-state-BfeKmj5s.js} +4 -4
  9. package/dist/chunks/{card-filter-builder-BZIj-ib3.js → card-filter-builder-CSKCSpNo.js} +58 -58
  10. package/dist/chunks/{comparison-window-caption-DmMFtNP5.js → comparison-window-caption-3bum5j00.js} +5 -5
  11. package/dist/chunks/{dashboard-BCd8aKDN.js → dashboard-PYd63LbL.js} +1 -1
  12. package/dist/chunks/{dashboard-briefing-launcher-CE_z5Gh1.js → dashboard-briefing-launcher-C2AuKs10.js} +1157 -1152
  13. package/dist/chunks/{dashboard-controls-IG2KRX1y.js → dashboard-controls-BSbhyIkY.js} +15 -15
  14. package/dist/chunks/{dashboard-json-o-XrNqNW.js → dashboard-json-Bd1rxD3y.js} +4 -4
  15. package/dist/chunks/{dates-B-bKEsiu.js → dates-DHMCf-F7.js} +8 -8
  16. package/dist/chunks/{edit-dashboard-visual-HPTVtWGk.js → edit-dashboard-visual-D_0ZiWev.js} +498 -496
  17. package/dist/chunks/{filter-line-BpdPq1D2.js → filter-line-BdLyPYjH.js} +5 -5
  18. package/dist/chunks/{filter-reach-copy-DoXmRmk-.js → filter-reach-copy-Dxn-mTuG.js} +1301 -1222
  19. package/dist/chunks/{filter-value-text-CDQCIREQ.js → filter-value-text-C6g-nDUW.js} +4 -4
  20. package/dist/chunks/{index-C0jX5wlM.js → index-BHSDE54O.js} +5 -5
  21. package/dist/chunks/{layout-grid-DoFIfQGd.js → layout-grid-CYR-LVpl.js} +1 -1
  22. package/dist/chunks/{list-filter-BeTQxjNy.js → list-filter-B67GsjTw.js} +1 -1
  23. package/dist/chunks/{matrix-analytical-definition-CyWOwLmE.js → matrix-analytical-definition-C0IGLTZH.js} +21 -21
  24. package/dist/chunks/matrix-member-presentation-D5BIYuy5.js +258 -0
  25. package/dist/chunks/{matrix-operation-contract-CAanJeCj.js → matrix-operation-contract-RckfqkQm.js} +15 -15
  26. package/dist/chunks/{metric-comparison-BeKnUD08.js → metric-comparison-DsE8wdRh.js} +1 -1
  27. package/dist/chunks/{paintbrush-KeaU1L1a.js → paintbrush-xDDRjIyF.js} +1 -1
  28. package/dist/chunks/{palette-BcFJLeXB.js → palette-CbOgFCy2.js} +1 -1
  29. package/dist/chunks/{pivot-result-contract-expectations-Dt0E1Wou.js → pivot-result-contract-expectations-Cnq55Uno.js} +44 -44
  30. package/dist/chunks/{pivot-result-identity-BKUjYO1u.js → pivot-result-identity-b4-ugQhm.js} +1 -1
  31. package/dist/chunks/{raw-temporal-value-BzdgeDa7.js → raw-temporal-value-B9W38mi3.js} +1 -1
  32. package/dist/chunks/{report-preferences-dialog-CgskMwZJ.js → report-preferences-dialog-DTu3a7ce.js} +13 -13
  33. package/dist/chunks/{report-runtime-context-g4Zp_TU9.js → report-runtime-context-BvJkcbar.js} +1 -1
  34. package/dist/chunks/{resolve-dashboard-input-context-DfJshnw8.js → resolve-dashboard-input-context-Bw-DesV2.js} +4771 -4712
  35. package/dist/chunks/{save-C9CZAk6V.js → save-BgvAsp6X.js} +1 -1
  36. package/dist/chunks/{saved-dashboard-context-DdhPU2Kq.js → saved-dashboard-context-BFh0oOnF.js} +7 -7
  37. package/dist/chunks/{selection-filter-compiler-BclSpK3P.js → selection-filter-compiler-DHYsq3yM.js} +1 -1
  38. package/dist/chunks/{semaphor-ready-indicator-BuasVClR.js → semaphor-ready-indicator-WvgHMnj8.js} +33384 -32853
  39. package/dist/chunks/{shelf-drop-preview-context-DjOcz0mb.js → shelf-drop-preview-context-D6HgYFJp.js} +5 -5
  40. package/dist/chunks/{stored-dashboard-D6FtWx_3.js → stored-dashboard-vlG0Knxi.js} +94 -94
  41. package/dist/chunks/{style-sheet-parts-DM_Mw_sm.js → style-sheet-parts-ClmvtkSC.js} +2 -2
  42. package/dist/chunks/{table-export-sheet-DBlFMvE8.js → table-export-sheet-Bv6tVuMu.js} +1 -1
  43. package/dist/chunks/{token-types-BB2ImFx6.js → token-types-eMdcuB6j.js} +1 -1
  44. package/dist/chunks/{upload-CMTCg47S.js → upload-ClUeK8F0.js} +1 -1
  45. package/dist/chunks/{validators-BlEWWX9O.js → validators-DwhBEvnh.js} +1074 -1065
  46. package/dist/chunks/{variable-draft-CxdgKDCx.js → variable-draft-CauoSBN0.js} +4 -4
  47. package/dist/dashboard/index.js +2 -2
  48. package/dist/dashboard-authoring/index.js +1752 -1684
  49. package/dist/format-utils/index.js +13 -13
  50. package/dist/index.js +18 -18
  51. package/dist/report-runtime-context/index.js +1 -1
  52. package/dist/style.css +1 -1
  53. package/dist/surfboard/index.js +2 -2
  54. package/dist/types/components/shared/unsaved-changes/unsaved-changes-alert.d.ts +2 -1
  55. package/dist/types/components/sharing-and-management/hooks/paged-list.d.ts +22 -0
  56. package/dist/types/components/sharing-and-management/hooks/use-resource-management.d.ts +17 -2
  57. package/dist/types/index.js +5 -5
  58. package/dist/types/lib/hooks/use-dashboard-unsaved-changes-check.d.ts +9 -1
  59. package/dist/types/lib/utils/filter-default-value-utils.d.ts +1 -1
  60. package/dist/types/shared/analytics-protocol/catalog-field-grounding.d.ts +7 -0
  61. package/dist/types/shared/analytics-protocol/index.d.ts +1 -0
  62. package/dist/types/shared/analytics-protocol/numeric-range-options.d.ts +46 -0
  63. package/dist/types/shared/dashboard-authoring/changes/dashboard-change.d.ts +45 -0
  64. package/dist/types/shared/dashboard-authoring/filter-model/index.d.ts +2 -0
  65. package/dist/types/shared/dashboard-authoring/filter-model/number-condition-spec.d.ts +24 -0
  66. package/dist/types/shared/dashboard-authoring/filter-model/number-range-setting.d.ts +47 -0
  67. package/dist/types/shared/dashboard-authoring/outline/outline-filters.d.ts +6 -2
  68. package/package.json +1 -1
  69. package/dist/chunks/matrix-member-presentation-Bj2YcHAP.js +0 -169
@@ -1,5 +1,5 @@
1
- import { a, R as s, D as o } from "../chunks/report-preferences-dialog-CgskMwZJ.js";
2
- import { C as f, E as D } from "../chunks/bookmark-state-Be2W3s6t.js";
1
+ import { a, R as s, D as o } from "../chunks/report-preferences-dialog-DTu3a7ce.js";
2
+ import { C as f, E as D } from "../chunks/bookmark-state-BfeKmj5s.js";
3
3
  export {
4
4
  f as CONTROL_CARD_DEFAULT_VALUE,
5
5
  a as DisplayFormatPreferencesFields,
@@ -1,7 +1,8 @@
1
1
  type UnsavedChangesAlertProps = {
2
2
  open: boolean;
3
3
  onOpenChange: (open: boolean) => void;
4
- onSave: () => Promise<void>;
4
+ /** Omit when saving can't keep the changes (an open card's draft): no Save button. */
5
+ onSave?: () => Promise<void>;
5
6
  onDiscard: () => void;
6
7
  isSaving: boolean;
7
8
  title?: string;
@@ -0,0 +1,22 @@
1
+ export type PagedList<T> = {
2
+ /** Every row loaded so far, in the server's order. */
3
+ items: T[];
4
+ /** The server's total for the current search and filters. */
5
+ total: number;
6
+ /** Rows the next page holds (0 at the end of the list). */
7
+ nextCount: number;
8
+ isLoading: boolean;
9
+ isFetchingNextPage: boolean;
10
+ fetchNextPage: () => void;
11
+ /** The rows and total are the previous search's, kept on screen while
12
+ * the new answer loads. */
13
+ isPlaceholderData: boolean;
14
+ };
15
+ /** Rows still to load, at most one page. */
16
+ export declare function nextPageCount(loaded: number, total: number, pageSize: number): number;
17
+ /**
18
+ * Two lists read as one category (a tenant-created dashboard's groups: the
19
+ * organization's and the owning tenant's). The first list pages to its end
20
+ * before the second starts.
21
+ */
22
+ export declare function mergePagedLists<T>(first: PagedList<T>, second: PagedList<T>): PagedList<T>;
@@ -1,5 +1,6 @@
1
1
  import { ResourceType, ShareRole, ShareScope } from '../utils/types.js';
2
2
  import { TDashboard, TFrame } from '../../../lib/types/index.js';
3
+ import { PagedList } from './paged-list.js';
3
4
  import { AppearanceSpec } from '../../../lib/appearance/index.js';
4
5
  import { DashboardListViewer } from '../../../shared/dashboard-viewer/index.js';
5
6
  export interface ResourceListItem {
@@ -78,9 +79,23 @@ export interface ShareResourceRequest {
78
79
  }>;
79
80
  message?: string;
80
81
  }
81
- export declare function useTenants(options?: {
82
+ /** A tenant as the tenants list returns it, with its user count. */
83
+ export type TenantListItem = {
84
+ id: string;
85
+ name: string;
86
+ userCount?: number;
87
+ };
88
+ /**
89
+ * Tenants the caller may share with, a page of `pageSize` at a time by
90
+ * offset, searched by name on the server (the route's default page of 500
91
+ * would leave the rest unreachable). Previous pages stay on screen while a
92
+ * new search loads.
93
+ */
94
+ export declare function useTenantPages(params: {
95
+ search?: string;
96
+ }, pageSize: number, options?: {
82
97
  enabled?: boolean;
83
- }): import('@tanstack/react-query').UseQueryResult<any, Error>;
98
+ }): PagedList<TenantListItem>;
84
99
  export declare function useResources(resourceType: ResourceType, search?: string, view?: string, limit?: number, offset?: number): import('@tanstack/react-query').UseQueryResult<any, Error>;
85
100
  export declare function useCreateResource(resourceType: ResourceType, onSuccessCallback?: (data?: any) => void): import('@tanstack/react-query').UseMutationResult<any, Error, CreateResourceRequest, void>;
86
101
  export declare function useUpdateResource(resourceType: ResourceType): import('@tanstack/react-query').UseMutationResult<any, Error, {
@@ -1,8 +1,8 @@
1
- import { B as t, z as r, C as l, E as o, V as i, j as n, c as d, g as m, f as u, b as c, e as E, d as C, a as T, y as p, x as D, o as A, h as I, q as _, w as F, v as S, m as b, n as L, l as f, p as N, k as y, s as R, u as h, i as g, r as x, t as M } from "../chunks/bookmark-state-Be2W3s6t.js";
2
- import { C as V, D as w, L as z, d as U, g as k, h as B, e as K, f as v, c as Y, a as q, i as G, b as P, n as Q, s as W } from "../chunks/validators-BlEWWX9O.js";
3
- import { D as J } from "../chunks/token-types-BB2ImFx6.js";
4
- import { r as H, a as Z } from "../chunks/pivot-result-identity-BKUjYO1u.js";
5
- import { D as ee } from "../chunks/report-runtime-context-g4Zp_TU9.js";
1
+ import { B as t, z as r, C as l, E as o, V as i, j as n, c as d, g as m, f as u, b as c, e as E, d as C, a as T, y as p, x as D, o as A, h as I, q as _, w as F, v as S, m as b, n as L, l as f, p as N, k as y, s as R, u as h, i as g, r as x, t as M } from "../chunks/bookmark-state-BfeKmj5s.js";
2
+ import { C as V, D as w, L as z, d as U, g as k, h as B, e as K, f as v, c as Y, a as q, i as G, b as P, n as Q, s as W } from "../chunks/validators-DwhBEvnh.js";
3
+ import { D as J } from "../chunks/token-types-eMdcuB6j.js";
4
+ import { r as H, a as Z } from "../chunks/pivot-result-identity-b4-ugQhm.js";
5
+ import { D as ee } from "../chunks/report-runtime-context-BvJkcbar.js";
6
6
  const e = [
7
7
  "concatenate",
8
8
  "conditional-category",
@@ -1,3 +1,11 @@
1
1
  import { TDashboard } from '../types/common-types.js';
2
- /** Share the editor's baseline with host navigation, without a second dirty flag. */
2
+ /**
3
+ * Share the editor's baseline with host navigation, without a second dirty flag.
4
+ *
5
+ * An open card editor counts as unsaved: its draft lives in the editor store
6
+ * and reaches the dashboard only when the author applies it, so a comparison
7
+ * of the dashboard alone would let them leave and lose it. Closing the editor
8
+ * (or loading another dashboard) clears `isVisualEditing`, so this never
9
+ * outlives the editor.
10
+ */
3
11
  export declare function useDashboardUnsavedChangesCheck(pristineDashboard: TDashboard | null, isInspectionMode: boolean, lifecycleEnabled?: boolean): () => boolean;
@@ -6,7 +6,7 @@ import { TInlineFilter } from '../types/common-types.js';
6
6
  * clock and Monday weeks; a calendar carries its anchor and fiscal periods.
7
7
  */
8
8
  export type DefaultsCalendar = string | DefaultDateCalendar;
9
- export type DefaultBackedFilter = Pick<TFilter, 'id' | 'column' | 'operation' | 'dataType' | 'nativeDataType' | 'dateSelectionMode' | 'defaultValues' | 'defaultDateFilter' | 'fieldMeta' | 'semanticContext'> & Partial<Pick<TInlineFilter, 'id' | 'column' | 'operation' | 'dataType' | 'nativeDataType' | 'dateSelectionMode' | 'defaultValues' | 'defaultDateFilter' | 'fieldMeta' | 'semanticContext'>>;
9
+ export type DefaultBackedFilter = Pick<TFilter, 'id' | 'column' | 'operation' | 'dataType' | 'nativeDataType' | 'dateSelectionMode' | 'defaultValues' | 'defaultDateFilter' | 'fieldMeta' | 'semanticContext'> & Partial<Pick<TFilter, 'searchMode'>> & Partial<Pick<TInlineFilter, 'id' | 'column' | 'operation' | 'dataType' | 'nativeDataType' | 'dateSelectionMode' | 'defaultValues' | 'defaultDateFilter' | 'fieldMeta' | 'semanticContext'>>;
10
10
  /**
11
11
  * Converts a filter's default configuration into an active runtime filter value.
12
12
  * Returns undefined when no defaults are configured.
@@ -49,6 +49,13 @@ export declare function normalizeAnalyticsCatalogDataType(value: unknown): Analy
49
49
  export type AnalyticsNumericStorageKind = 'integer' | 'decimal' | 'float';
50
50
  /** Native result representation, distinct from the semantic "number" datatype. */
51
51
  export declare function getAnalyticsNumericStorageKind(value: unknown): AnalyticsNumericStorageKind | null;
52
+ /**
53
+ * The decimal places a numeric storage type holds: 0 for integers, `s` for an
54
+ * explicit `decimal(p, s)`, `numeric(p, s)`, `number(p, s)` or ClickHouse
55
+ * `DecimalNN(s)`. Null when the type has no fixed scale (floats, a bare
56
+ * `decimal` or `number`), so nothing may be placed on a grid it doesn't have.
57
+ */
58
+ export declare function getAnalyticsNumericStorageScale(value: unknown): number | null;
52
59
  export declare function isAnalyticsDateLikeDataType(value: unknown): boolean;
53
60
  export declare function isAnalyticsCatalogDateField(field: AnalyticsCatalogField): boolean;
54
61
  export declare function isAnalyticsTechnicalIdentifierField(field: AnalyticsCatalogField): boolean;
@@ -42,6 +42,7 @@ export { filterGroupSchema as savedFilterGroupSchema } from './explorer-input-sc
42
42
  export * from '../temporal/index.js';
43
43
  export * from './agent-time-window.js';
44
44
  export * from './scalar-value.js';
45
+ export * from './numeric-range-options.js';
45
46
  export * from './matrix-window-contract.js';
46
47
  export * from './matrix-member-presentation.js';
47
48
  export { matrixFormattingRoleSchema, type MatrixFormattingRole } from './matrix-path-contract.js';
@@ -0,0 +1,46 @@
1
+ /** The request asks for this shape instead of distinct values. */
2
+ export declare const NUMERIC_RANGE_VALUE_SHAPE: "numeric_range";
3
+ /** At most this many equal-width buckets (NR-D6). */
4
+ export declare const NUMERIC_RANGE_BUCKET_COUNT = 32;
5
+ export type NumericRangeOptions = {
6
+ kind: typeof NUMERIC_RANGE_VALUE_SHAPE;
7
+ /** null when no row has a value. */
8
+ min: number | null;
9
+ max: number | null;
10
+ /** Rows where the field is empty, under the same filters. */
11
+ emptyRows: number;
12
+ /**
13
+ * `width`: equal-width buckets over [min, max], the last one closed at max.
14
+ * `value`: bucket i holds exactly the value min + i: one per whole number
15
+ * from min to max (an integer field whose range spans at most
16
+ * NUMERIC_RANGE_BUCKET_COUNT values), or the one bucket of a field whose
17
+ * every value is min = max, whole or not.
18
+ */
19
+ bucketing: 'width' | 'value';
20
+ /** Rows with a value, per bucket, low to high; [] when min = max or no value. */
21
+ buckets: number[];
22
+ /** Width of a bucket in field units (1 for `value`). */
23
+ bucketWidth: number;
24
+ };
25
+ /**
26
+ * The range options in an option response's first record, or undefined when
27
+ * the response is not one (an older server, an authored option SQL, an
28
+ * aggregate field): the popover then shows its inputs without a distribution.
29
+ */
30
+ export declare function readNumericRangeOptions(record: unknown): NumericRangeOptions | undefined;
31
+ /** Rows that have a value. */
32
+ export declare function numericRangeValueRows(range: NumericRangeOptions): number;
33
+ /** The bounds bucket `index` covers: [from, to). The last width bucket is closed at max. */
34
+ export declare function numericRangeBucketBounds(range: NumericRangeOptions, index: number): {
35
+ from: number;
36
+ to: number;
37
+ };
38
+ /**
39
+ * About how many rows a number condition keeps, read off the distribution
40
+ * the popover already has (never a count query, NR-D7). Null when it can't be
41
+ * read off buckets: Equal to / Not equal to on width buckets.
42
+ */
43
+ export declare function estimateNumericConditionRows(range: NumericRangeOptions, operation: string, values: readonly number[]): {
44
+ rows: number;
45
+ exact: boolean;
46
+ } | null;
@@ -5327,7 +5327,20 @@ export declare const dashboardChangeSchema: z.ZodDiscriminatedUnion<"op", [z.Zod
5327
5327
  datasetName: z.ZodString;
5328
5328
  field: z.ZodString;
5329
5329
  selection: z.ZodOptional<z.ZodEnum<["single", "multiple"]>>;
5330
+ /** A number field: pick a condition (range) or tick values (list); new number filters start as range (number range filters NR-D4). */
5331
+ showAs: z.ZodOptional<z.ZodString>;
5330
5332
  defaultValues: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean]>, "many">>;
5333
+ /** A range filter's default condition. */
5334
+ defaultCondition: z.ZodOptional<z.ZodObject<{
5335
+ operator: z.ZodString;
5336
+ values: z.ZodOptional<z.ZodArray<z.ZodUnknown, "many">>;
5337
+ }, "strict", z.ZodTypeAny, {
5338
+ operator: string;
5339
+ values?: unknown[] | undefined;
5340
+ }, {
5341
+ operator: string;
5342
+ values?: unknown[] | undefined;
5343
+ }>>;
5331
5344
  defaultPeriod: z.ZodOptional<z.ZodType<import('../../analytics-protocol/agent-time-window.js').AgentTimeWindow, z.ZodTypeDef, import('../../analytics-protocol/index.js').SemaphorTimeWindow>>;
5332
5345
  sheetIds: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
5333
5346
  }, "strict", z.ZodTypeAny, {
@@ -5340,6 +5353,11 @@ export declare const dashboardChangeSchema: z.ZodDiscriminatedUnion<"op", [z.Zod
5340
5353
  defaultPeriod?: import('../../analytics-protocol/agent-time-window.js').AgentTimeWindow | undefined;
5341
5354
  defaultValues?: (string | number | boolean)[] | undefined;
5342
5355
  handle?: string | undefined;
5356
+ showAs?: string | undefined;
5357
+ defaultCondition?: {
5358
+ operator: string;
5359
+ values?: unknown[] | undefined;
5360
+ } | undefined;
5343
5361
  sheetIds?: string[] | undefined;
5344
5362
  }, {
5345
5363
  domainId: string;
@@ -5351,13 +5369,30 @@ export declare const dashboardChangeSchema: z.ZodDiscriminatedUnion<"op", [z.Zod
5351
5369
  defaultPeriod?: import('../../analytics-protocol/index.js').SemaphorTimeWindow | undefined;
5352
5370
  defaultValues?: (string | number | boolean)[] | undefined;
5353
5371
  handle?: string | undefined;
5372
+ showAs?: string | undefined;
5373
+ defaultCondition?: {
5374
+ operator: string;
5375
+ values?: unknown[] | undefined;
5376
+ } | undefined;
5354
5377
  sheetIds?: string[] | undefined;
5355
5378
  }>, z.ZodObject<{
5356
5379
  op: z.ZodLiteral<"filter.update">;
5357
5380
  filterId: z.ZodUnion<[z.ZodString, z.ZodString]>;
5358
5381
  label: z.ZodOptional<z.ZodString>;
5359
5382
  selection: z.ZodOptional<z.ZodEnum<["single", "multiple"]>>;
5383
+ showAs: z.ZodOptional<z.ZodString>;
5360
5384
  defaultValues: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean]>, "many">>>;
5385
+ /** null clears it. */
5386
+ defaultCondition: z.ZodOptional<z.ZodNullable<z.ZodObject<{
5387
+ operator: z.ZodString;
5388
+ values: z.ZodOptional<z.ZodArray<z.ZodUnknown, "many">>;
5389
+ }, "strict", z.ZodTypeAny, {
5390
+ operator: string;
5391
+ values?: unknown[] | undefined;
5392
+ }, {
5393
+ operator: string;
5394
+ values?: unknown[] | undefined;
5395
+ }>>>;
5361
5396
  defaultPeriod: z.ZodOptional<z.ZodNullable<z.ZodType<import('../../analytics-protocol/agent-time-window.js').AgentTimeWindow, z.ZodTypeDef, import('../../analytics-protocol/index.js').SemaphorTimeWindow>>>;
5362
5397
  sheetIds: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString, "many">>>;
5363
5398
  }, "strict", z.ZodTypeAny, {
@@ -5367,6 +5402,11 @@ export declare const dashboardChangeSchema: z.ZodDiscriminatedUnion<"op", [z.Zod
5367
5402
  label?: string | undefined;
5368
5403
  defaultPeriod?: import('../../analytics-protocol/agent-time-window.js').AgentTimeWindow | null | undefined;
5369
5404
  defaultValues?: (string | number | boolean)[] | null | undefined;
5405
+ showAs?: string | undefined;
5406
+ defaultCondition?: {
5407
+ operator: string;
5408
+ values?: unknown[] | undefined;
5409
+ } | null | undefined;
5370
5410
  sheetIds?: string[] | null | undefined;
5371
5411
  }, {
5372
5412
  filterId: string;
@@ -5375,6 +5415,11 @@ export declare const dashboardChangeSchema: z.ZodDiscriminatedUnion<"op", [z.Zod
5375
5415
  label?: string | undefined;
5376
5416
  defaultPeriod?: import('../../analytics-protocol/index.js').SemaphorTimeWindow | null | undefined;
5377
5417
  defaultValues?: (string | number | boolean)[] | null | undefined;
5418
+ showAs?: string | undefined;
5419
+ defaultCondition?: {
5420
+ operator: string;
5421
+ values?: unknown[] | undefined;
5422
+ } | null | undefined;
5378
5423
  sheetIds?: string[] | null | undefined;
5379
5424
  }>, z.ZodObject<{
5380
5425
  op: z.ZodLiteral<"filter.remove">;
@@ -8,3 +8,5 @@ export { upgradeToStoredDashboard } from './stored-dashboard.js';
8
8
  /** Every input the dashboard has at runtime, compatibility inputs named as the runtime names them (data variables P1a-21). */
9
9
  export { listDashboardInputsTolerantly } from '../../../lib/dashboard-inputs/build-normalized-dashboard-inputs.js';
10
10
  export * from './date-filter-default.js';
11
+ export * from './number-range-setting.js';
12
+ export * from './number-condition-spec.js';
@@ -0,0 +1,24 @@
1
+ import { Operation } from '../../../components/surfboard/filter/types.js';
2
+ export type NumberConditionOperation = Extract<Operation, '=' | '!=' | '>' | '>=' | '<' | '<=' | 'between' | 'not between' | 'is null' | 'is not null'>;
3
+ export type NumberConditionSpec = {
4
+ operation: NumberConditionOperation;
5
+ /** The menu's words; lowercased, the sentence's ("at least 0.5"). */
6
+ label: string;
7
+ /** How many numbers the condition takes. */
8
+ arity: 0 | 1 | 2;
9
+ /** How an agent writes it, in the card filters' vocabulary (`not_between`, `is_null`). */
10
+ agentOperator: string;
11
+ };
12
+ /** The conditions, in words, in the groups the menu shows (NR-D12). */
13
+ export declare const NUMBER_CONDITION_GROUPS: readonly (readonly NumberConditionSpec[])[];
14
+ export declare const NUMBER_CONDITION_SPECS: readonly NumberConditionSpec[];
15
+ export declare function isNumberConditionOperation(operation: unknown): operation is NumberConditionOperation;
16
+ /** The spec for an operation; Between for one that isn't a condition. */
17
+ export declare function numberConditionSpec(operation: NumberConditionOperation): NumberConditionSpec;
18
+ /** The spec an agent's operator names, if any. */
19
+ export declare function numberConditionSpecForAgent(operator: string): NumberConditionSpec | undefined;
20
+ export type NumberConditionProblem = 'arity' | 'notANumber' | 'reversed';
21
+ /** Why a completed condition can't apply, or undefined when it can. */
22
+ export declare function numberConditionProblem(operation: NumberConditionOperation, values: readonly unknown[]): NumberConditionProblem | undefined;
23
+ /** A condition in words, e.g. "at least 0.5", "between 1 and 2", "is empty". */
24
+ export declare function describeNumberCondition(operation: NumberConditionOperation, values: readonly number[]): string;
@@ -0,0 +1,47 @@
1
+ import { TFilter } from '../../../components/surfboard/filter/types.js';
2
+ import { NumberConditionOperation } from './number-condition-spec.js';
3
+ export type NumberFilterShowAs = 'range' | 'list';
4
+ /** A Range's default condition: the operation and its numbers (none for empty checks). */
5
+ export type NumberConditionDefault = {
6
+ operation: NumberConditionOperation;
7
+ values: number[];
8
+ };
9
+ /** Whether a field type can show as a Range. */
10
+ export declare function canShowAsRange(dataType: string | undefined): boolean;
11
+ /** How a number filter shows; undefined for any other field type. */
12
+ export declare function readNumberFilterShowAs(filter: Pick<TFilter, 'dataType' | 'searchMode'>): NumberFilterShowAs | undefined;
13
+ /** The default condition a Range filter opens with, if it has one. */
14
+ export declare function readNumberConditionDefault(filter: Pick<TFilter, 'dataType' | 'searchMode' | 'operation' | 'defaultValues'>): NumberConditionDefault | undefined;
15
+ /** Why a default condition can't be saved, in words an author or agent reads; undefined when it can. */
16
+ export declare function validateNumberConditionDefault(condition: NumberConditionDefault,
17
+ /** The operator as the caller wrote it (an agent's is_null), for the message. */
18
+ operatorWords?: string): string | undefined;
19
+ /**
20
+ * The fields Show as writes. Range: `searchMode: 'numeric'`; a list default
21
+ * (values to tick) has no meaning as a condition, so it goes. List: the
22
+ * list's own search mode (`auto`, or `text` when it was text), and a
23
+ * condition default goes back to no default under Include.
24
+ */
25
+ export declare function writeNumberFilterShowAs(filter: Pick<TFilter, 'searchMode' | 'operation' | 'defaultValues'>, showAs: NumberFilterShowAs): Partial<Pick<TFilter, 'searchMode' | 'operation' | 'defaultValues'>>;
26
+ /** The fields a Range's default condition writes; null clears it. */
27
+ export declare function writeNumberConditionDefault(condition: NumberConditionDefault | null): Pick<TFilter, 'operation' | 'defaultValues'>;
28
+ /** The Show as a new filter on this field starts with (NR-D4): Range for numbers. */
29
+ export declare function initialNumberFilterSearchMode(dataType: string | undefined): Pick<TFilter, 'searchMode'>;
30
+ /** A Range's default condition read back in words, e.g. "at least 0.5" (NR-D12). */
31
+ export declare function describeNumberConditionDefault(condition: NumberConditionDefault): string;
32
+ /** A default condition as an agent states it (filter.add / filter.update `defaultCondition`), in the card filters' vocabulary. */
33
+ export type AgentNumberConditionDefault = {
34
+ operator: string;
35
+ /** Numbers; the change schema lists them untyped, so they're checked here. */
36
+ values?: unknown[];
37
+ };
38
+ /** An agent's default condition as the filter stores it, or why it can't be one. */
39
+ export declare function readAgentNumberConditionDefault(stated: AgentNumberConditionDefault): {
40
+ ok: true;
41
+ condition: NumberConditionDefault;
42
+ } | {
43
+ ok: false;
44
+ message: string;
45
+ };
46
+ /** A stored default condition as an agent reads it in the outline. */
47
+ export declare function toAgentNumberConditionDefault(condition: NumberConditionDefault): AgentNumberConditionDefault;
@@ -1,6 +1,6 @@
1
1
  import { TDashboard } from '../../../lib/types/common-types.js';
2
2
  import { DashboardFilterNotReachedReason, DashboardRelationshipReachResolver } from '../../../lib/query-context/dashboard-filter-mapping-resolution.js';
3
- import { FilterInputEntry } from '../filter-model/index.js';
3
+ import { AgentNumberConditionDefault, FilterInputEntry, NumberFilterShowAs } from '../filter-model/index.js';
4
4
  import { AgentTimeWindowRefusal } from '../../analytics-protocol/agent-time-window.js';
5
5
  import { RelativeDateWindow } from '../../analytics-protocol/relative-date/index.js';
6
6
  import { CalendarContext } from '../../report-runtime-context/index.js';
@@ -22,8 +22,12 @@ export type OutlineFilter = {
22
22
  datasetName: string;
23
23
  field: string;
24
24
  selection: 'single' | 'multiple';
25
- /** The values it loads with, read through the default owner (a saved default first, else the definition). */
25
+ /** A number filter: range (viewers pick a condition) or list (viewers tick values) (number range filters NR-D2). */
26
+ showAs?: NumberFilterShowAs;
27
+ /** The values it loads with, read through the default owner (a saved default first, else the definition). Not for a range. */
26
28
  defaultValues?: FilterValue[];
29
+ /** A range filter's default condition, as filter.add / filter.update take it. */
30
+ defaultCondition?: AgentNumberConditionDefault;
27
31
  /** The window it loads with, only when the loaded default keeps one (a day picker clamps a wider window to a day). */
28
32
  defaultPeriod?: RelativeDateWindow;
29
33
  /**
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "email": "support@semaphor.cloud"
6
6
  },
7
7
  "license": "MIT",
8
- "version": "0.1.596",
8
+ "version": "0.1.598",
9
9
  "description": "Fully interactive and customizable dashboards for your apps.",
10
10
  "keywords": [
11
11
  "react",
@@ -1,169 +0,0 @@
1
- import { m as p } from "./validators-BlEWWX9O.js";
2
- function h(e) {
3
- const t = b(e);
4
- return d(t) ? t : void 0;
5
- }
6
- function b(e) {
7
- if (typeof e != "string" || e.trim().length === 0)
8
- return;
9
- const t = e.trim().toLowerCase();
10
- switch (t) {
11
- case "=":
12
- return "=";
13
- case "!=":
14
- return "!=";
15
- case "in":
16
- return "in";
17
- case "not_in":
18
- return "not_in";
19
- case "contains":
20
- return "contains";
21
- case "not_contains":
22
- return "not_contains";
23
- case "between":
24
- return "between";
25
- case "not_between":
26
- return "not_between";
27
- case ">":
28
- case ">=":
29
- case "<":
30
- case "<=":
31
- return t;
32
- case "is_null":
33
- return "is_null";
34
- case "is_not_null":
35
- return "is_not_null";
36
- default:
37
- return _(e) ? e : void 0;
38
- }
39
- }
40
- function d(e) {
41
- return e === "=" || e === "!=" || e === "in" || e === "not_in" || e === "contains" || e === "not_contains" || e === "between" || e === "not_between" || e === ">" || e === ">=" || e === "<" || e === "<=";
42
- }
43
- function _(e) {
44
- return d(e) || e === "not_contains" || e === "is_null" || e === "is_not_null";
45
- }
46
- function O(e) {
47
- switch (e) {
48
- case "not in":
49
- return "not_in";
50
- case "like":
51
- return "contains";
52
- case "not like":
53
- return "not_contains";
54
- case "not between":
55
- return "not_between";
56
- case "is null":
57
- case "is not null":
58
- return;
59
- default:
60
- return h(e);
61
- }
62
- }
63
- const w = [
64
- "=",
65
- "!=",
66
- ">",
67
- "<",
68
- ">=",
69
- "<=",
70
- "like",
71
- "not like",
72
- "between",
73
- "not between",
74
- "in",
75
- "not in",
76
- "is null",
77
- "is not null"
78
- ], y = /* @__PURE__ */ new Set(["string", "number", "date", "boolean"]);
79
- function g(e) {
80
- return typeof e == "string" && w.includes(e);
81
- }
82
- function P(e, t) {
83
- switch (e) {
84
- case "is null":
85
- case "is not null":
86
- return t.length === 0;
87
- case "between":
88
- case "not between":
89
- return t.length === 2;
90
- case "in":
91
- case "not in":
92
- return t.length >= 1;
93
- default:
94
- return t.length === 1;
95
- }
96
- }
97
- function S(e) {
98
- if (!e || typeof e != "object" || Array.isArray(e))
99
- return;
100
- const t = e, o = {};
101
- for (const n of A)
102
- t[n] !== void 0 && (o[n] = t[n]);
103
- return o;
104
- }
105
- const A = [
106
- "operation",
107
- "values",
108
- "valueType",
109
- "temporalBucket",
110
- "relativeMeta",
111
- "temporalPrecision"
112
- ];
113
- function E(e) {
114
- const t = S(e);
115
- if (!t) return;
116
- const { operation: o, values: n } = t;
117
- if (!g(o) || !Array.isArray(n) || !P(o, n)) return;
118
- const r = typeof t.valueType == "string" && y.has(t.valueType) ? t.valueType : void 0;
119
- return {
120
- operation: o,
121
- values: n,
122
- ...r ? { valueType: r } : {},
123
- ...t.temporalBucket !== void 0 ? { temporalBucket: t.temporalBucket } : {},
124
- ...t.relativeMeta !== void 0 ? { relativeMeta: t.relativeMeta } : {},
125
- ...t.temporalPrecision !== void 0 ? { temporalPrecision: t.temporalPrecision } : {}
126
- };
127
- }
128
- function v(e) {
129
- const t = E(e);
130
- if (!t)
131
- throw new Error(
132
- `Filter operation "${String(e.operation)}" cannot be expressed as predicate semantics.`
133
- );
134
- return t;
135
- }
136
- function I(e) {
137
- return e.operation === "is null" || e.operation === "is not null";
138
- }
139
- function k(e, t) {
140
- var n;
141
- if (t === null) return !0;
142
- if (t.overrides.length === 0) return e.length <= t.depth;
143
- const o = p(e);
144
- return ((n = t.overrides.find((r) => r.path.length === e.length && p(r.path) === o)) == null ? void 0 : n.expanded) ?? e.length <= t.depth;
145
- }
146
- function N(e) {
147
- var u;
148
- const { path: t, levelCount: o, expansion: n, total: r, axis: f } = e, a = t.length >= o || ((u = t[t.length - 1]) == null ? void 0 : u.member.kind) === "others", c = !a && !e.childrenEmpty, i = c && k(t, n), l = f === "rows" && e.rowLayout !== "tabular", m = i && !!e.skipRedundant && !!e.singleChild, s = !!(r != null && r.visible) && !m;
149
- return {
150
- expandable: c,
151
- expanded: i,
152
- memberVisible: l || !i,
153
- valueVisible: a || s && (!i || r.position === "before"),
154
- subtotalBefore: !l && i && s && r.position === "before",
155
- subtotalAfter: i && s && r.position === "after"
156
- };
157
- }
158
- export {
159
- w as N,
160
- b as a,
161
- E as b,
162
- v as c,
163
- k as d,
164
- I as i,
165
- h as n,
166
- S as p,
167
- N as r,
168
- O as t
169
- };