@nongt/visql 0.0.0-stage → 0.3.0
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.
- package/LICENSE +21 -0
- package/README.md +916 -2
- package/dist/PipelineEditor-DNZkDSaY.js +10042 -0
- package/dist/calendarDate-CYlr9TvX.js +43 -0
- package/dist/core-api-CBN6rAQG.js +1052 -0
- package/dist/core.js +80 -0
- package/dist/fixtures.js +7 -0
- package/dist/index.js +145 -0
- package/dist/issueLocation-Cw5sttQL.js +3183 -0
- package/dist/mui-date-pickers.js +117 -0
- package/dist/mui.js +510 -0
- package/dist/schema-z95dxLxu.js +839 -0
- package/dist/sql-import.js +1366 -0
- package/dist/style.css +1 -0
- package/dist/tokens-BTaVMSOx.js +95 -0
- package/dist/types/adapters/mui/MuiDatePicker.d.ts +12 -0
- package/dist/types/adapters/mui/MuiDateTimePicker.d.ts +10 -0
- package/dist/types/adapters/mui/MuiListInput.d.ts +9 -0
- package/dist/types/adapters/mui/MuiTimePicker.d.ts +10 -0
- package/dist/types/adapters/mui/QueryBuilder.d.ts +12 -0
- package/dist/types/adapters/mui/components.d.ts +16 -0
- package/dist/types/adapters/mui/index.d.ts +6 -0
- package/dist/types/adapters/mui/muiPickers.d.ts +6 -0
- package/dist/types/adapters/mui/pickerStyles.d.ts +28 -0
- package/dist/types/adapters/mui/theme.d.ts +11 -0
- package/dist/types/core/BetweenOnTextContext.d.ts +11 -0
- package/dist/types/core/DialectContext.d.ts +10 -0
- package/dist/types/core/DrillDownContext.d.ts +22 -0
- package/dist/types/core/ExistsContext.d.ts +29 -0
- package/dist/types/core/FlowDirectionContext.d.ts +8 -0
- package/dist/types/core/FlowOrientationContext.d.ts +6 -0
- package/dist/types/core/FunctionsContext.d.ts +25 -0
- package/dist/types/core/GroupKeysContext.d.ts +18 -0
- package/dist/types/core/MeasureLockContext.d.ts +12 -0
- package/dist/types/core/ReadOnlyContext.d.ts +6 -0
- package/dist/types/core/SchemaContext.d.ts +8 -0
- package/dist/types/core/SubqueryContext.d.ts +16 -0
- package/dist/types/core/UnionBranchContext.d.ts +6 -0
- package/dist/types/core/ValueInputContext.d.ts +24 -0
- package/dist/types/core/absolutePath.d.ts +57 -0
- package/dist/types/core/ast.d.ts +154 -0
- package/dist/types/core/astChildren.d.ts +4 -0
- package/dist/types/core/astEqual.d.ts +4 -0
- package/dist/types/core/astMap.d.ts +21 -0
- package/dist/types/core/calendarDate.d.ts +21 -0
- package/dist/types/core/columnFormats.d.ts +23 -0
- package/dist/types/core/components/BoolPicker.d.ts +8 -0
- package/dist/types/core/components/NumberInput.d.ts +8 -0
- package/dist/types/core/components/ReadOnlyPart.d.ts +10 -0
- package/dist/types/core/components/TextInput.d.ts +8 -0
- package/dist/types/core/components/expression/BinaryView.d.ts +10 -0
- package/dist/types/core/components/expression/ExprSummary.d.ts +12 -0
- package/dist/types/core/components/expression/ExpressionTypeSelector.d.ts +35 -0
- package/dist/types/core/components/expression/ExpressionView.d.ts +30 -0
- package/dist/types/core/components/expression/FieldView.d.ts +15 -0
- package/dist/types/core/components/expression/FormulaPeek.d.ts +14 -0
- package/dist/types/core/components/expression/FunctionArgInput.d.ts +22 -0
- package/dist/types/core/components/expression/FunctionView.d.ts +7 -0
- package/dist/types/core/components/expression/ListView.d.ts +20 -0
- package/dist/types/core/components/expression/LiteralView.d.ts +23 -0
- package/dist/types/core/components/expression/LogicalView.d.ts +9 -0
- package/dist/types/core/components/expression/MeasureMenu.d.ts +21 -0
- package/dist/types/core/components/expression/ParamView.d.ts +13 -0
- package/dist/types/core/components/expression/RelativeDateView.d.ts +15 -0
- package/dist/types/core/components/expression/SubqueryView.d.ts +8 -0
- package/dist/types/core/components/expression/formulaClasses.d.ts +8 -0
- package/dist/types/core/components/flow/CaseBranchFlowNode.d.ts +5 -0
- package/dist/types/core/components/flow/CaseElseFlowNode.d.ts +5 -0
- package/dist/types/core/components/flow/CaseFlowNode.d.ts +5 -0
- package/dist/types/core/components/flow/ConditionFlowNode.d.ts +5 -0
- package/dist/types/core/components/flow/CreateConditionFlowNode.d.ts +14 -0
- package/dist/types/core/components/flow/CreateHavingFlowNode.d.ts +11 -0
- package/dist/types/core/components/flow/DistinctToggle.d.ts +10 -0
- package/dist/types/core/components/flow/ExistsFlowNode.d.ts +9 -0
- package/dist/types/core/components/flow/FromFlowNode.d.ts +110 -0
- package/dist/types/core/components/flow/FunctionArgFlowNode.d.ts +5 -0
- package/dist/types/core/components/flow/FunctionCallFlowNode.d.ts +5 -0
- package/dist/types/core/components/flow/FunctionSortKeys.d.ts +10 -0
- package/dist/types/core/components/flow/GroupBgNode.d.ts +14 -0
- package/dist/types/core/components/flow/GroupByFlowNode.d.ts +29 -0
- package/dist/types/core/components/flow/IfElseFlowNode.d.ts +5 -0
- package/dist/types/core/components/flow/IfFlowNode.d.ts +5 -0
- package/dist/types/core/components/flow/IfThenFlowNode.d.ts +5 -0
- package/dist/types/core/components/flow/LeafConditionFrame.d.ts +19 -0
- package/dist/types/core/components/flow/LogicalFlowNode.d.ts +5 -0
- package/dist/types/core/components/flow/MoveTooltip.d.ts +19 -0
- package/dist/types/core/components/flow/NotFlowNode.d.ts +5 -0
- package/dist/types/core/components/flow/OrderByFlowNode.d.ts +32 -0
- package/dist/types/core/components/flow/SectionLabelFlowNode.d.ts +7 -0
- package/dist/types/core/components/flow/SelectFlowNode.d.ts +49 -0
- package/dist/types/core/components/flow/SharedQueriesFlowNode.d.ts +39 -0
- package/dist/types/core/components/flow/SummaryPill.d.ts +12 -0
- package/dist/types/core/components/flow/WarningNote.d.ts +9 -0
- package/dist/types/core/components/flow/chainSides.d.ts +18 -0
- package/dist/types/core/components/flow/dragContext.d.ts +12 -0
- package/dist/types/core/components/flow/moveTooltipHysteresis.d.ts +18 -0
- package/dist/types/core/components/flow/useRowDrag.d.ts +34 -0
- package/dist/types/core/components/flow/useRowReorderFlip.d.ts +30 -0
- package/dist/types/core/derivedTables.d.ts +98 -0
- package/dist/types/core/distinctSort.d.ts +7 -0
- package/dist/types/core/drillPath.d.ts +11 -0
- package/dist/types/core/exists.d.ts +7 -0
- package/dist/types/core/existsMenu.d.ts +61 -0
- package/dist/types/core/expressionFlow.d.ts +428 -0
- package/dist/types/core/fanOut.d.ts +58 -0
- package/dist/types/core/findParts.d.ts +19 -0
- package/dist/types/core/flowTrees.d.ts +20 -0
- package/dist/types/core/focusKey.d.ts +10 -0
- package/dist/types/core/formula.d.ts +24 -0
- package/dist/types/core/formulaPeek.d.ts +16 -0
- package/dist/types/core/functionRegistry.d.ts +117 -0
- package/dist/types/core/grouping.d.ts +58 -0
- package/dist/types/core/history.d.ts +25 -0
- package/dist/types/core/i18n/defaultMessages.d.ts +367 -0
- package/dist/types/core/i18n/messages.d.ts +273 -0
- package/dist/types/core/i18n/relativeDateWords.d.ts +3 -0
- package/dist/types/core/id.d.ts +5 -0
- package/dist/types/core/issueAnchor.d.ts +29 -0
- package/dist/types/core/issueLocation.d.ts +105 -0
- package/dist/types/core/limits.d.ts +17 -0
- package/dist/types/core/measures.d.ts +51 -0
- package/dist/types/core/params.d.ts +30 -0
- package/dist/types/core/pipelineAnchor.d.ts +118 -0
- package/dist/types/core/pipelineFlow.d.ts +271 -0
- package/dist/types/core/queryAst.d.ts +201 -0
- package/dist/types/core/queryHelpers.d.ts +113 -0
- package/dist/types/core/queryValidation.d.ts +206 -0
- package/dist/types/core/relativeDates.d.ts +11 -0
- package/dist/types/core/resolveNames.d.ts +17 -0
- package/dist/types/core/rowRange.d.ts +3 -0
- package/dist/types/core/schema.d.ts +119 -0
- package/dist/types/core/scopeQuery.d.ts +45 -0
- package/dist/types/core/selectColumns.d.ts +23 -0
- package/dist/types/core/settleQuery.d.ts +11 -0
- package/dist/types/core/sharedQueries.d.ts +66 -0
- package/dist/types/core/sqlGen.d.ts +102 -0
- package/dist/types/core/sqlOffsets.d.ts +5 -0
- package/dist/types/core/sqlSpans.d.ts +33 -0
- package/dist/types/core/storedQuery.d.ts +43 -0
- package/dist/types/core/summarize.d.ts +3 -0
- package/dist/types/core/theme/tokens.d.ts +74 -0
- package/dist/types/core/ui/UIContext.d.ts +6 -0
- package/dist/types/core/ui/index.d.ts +12 -0
- package/dist/types/core/ui/types.d.ts +264 -0
- package/dist/types/core/unionTables.d.ts +121 -0
- package/dist/types/core/useValueTypes.d.ts +12 -0
- package/dist/types/core/valueTypes.d.ts +54 -0
- package/dist/types/core-api.d.ts +20 -0
- package/dist/types/features/queryEditor/ExpressionFlowCanvas.d.ts +10 -0
- package/dist/types/features/queryEditor/FindBox.d.ts +12 -0
- package/dist/types/features/queryEditor/FlowCanvas.d.ts +96 -0
- package/dist/types/features/queryEditor/FocusPulse.d.ts +10 -0
- package/dist/types/features/queryEditor/IssuesButton.d.ts +16 -0
- package/dist/types/features/queryEditor/PipelineEditor.d.ts +210 -0
- package/dist/types/features/queryEditor/QueryOutline.d.ts +16 -0
- package/dist/types/features/queryEditor/ResultsPanel.d.ts +11 -0
- package/dist/types/features/queryEditor/RunButton.d.ts +11 -0
- package/dist/types/features/queryEditor/SubFlowPanel.d.ts +24 -0
- package/dist/types/features/queryEditor/UndoRedoToast.d.ts +6 -0
- package/dist/types/features/queryEditor/canvasPositioning.d.ts +81 -0
- package/dist/types/features/queryEditor/findKeys.d.ts +3 -0
- package/dist/types/features/queryEditor/flowDragUtils.d.ts +16 -0
- package/dist/types/features/queryEditor/focusContext.d.ts +24 -0
- package/dist/types/features/queryEditor/hoveredPart.d.ts +32 -0
- package/dist/types/features/queryEditor/issueFocusParts.d.ts +9 -0
- package/dist/types/features/queryEditor/issueLocationText.d.ts +7 -0
- package/dist/types/features/queryEditor/issueText.d.ts +11 -0
- package/dist/types/features/queryEditor/outlineSections.d.ts +23 -0
- package/dist/types/features/queryEditor/run.d.ts +36 -0
- package/dist/types/features/queryEditor/sectionLabels.d.ts +15 -0
- package/dist/types/features/queryEditor/treeScopeContext.d.ts +14 -0
- package/dist/types/features/queryEditor/useRemeasureOnDirectionChange.d.ts +7 -0
- package/dist/types/features/queryEditor/useRevealNewNodes.d.ts +35 -0
- package/dist/types/features/queryEditor/withTreeScope.d.ts +10 -0
- package/dist/types/fixtures.d.ts +44 -0
- package/dist/types/index.d.ts +13 -0
- package/dist/types/mui-date-pickers.d.ts +3 -0
- package/dist/types/mui.d.ts +2 -0
- package/dist/types/sql-import.d.ts +3 -0
- package/dist/types/sqlImport/context.d.ts +71 -0
- package/dist/types/sqlImport/expressions.d.ts +11 -0
- package/dist/types/sqlImport/importSql.d.ts +28 -0
- package/dist/types/sqlImport/parse.d.ts +6 -0
- package/dist/types/sqlImport/syntax.d.ts +245 -0
- package/dist/types/sqlImport/tokenize.d.ts +26 -0
- package/package.json +164 -3
|
@@ -0,0 +1,264 @@
|
|
|
1
|
+
import type { ComponentType, MouseEventHandler, ReactElement, ReactNode, Ref, SyntheticEvent } from 'react';
|
|
2
|
+
import type { QueryBuilderTheme } from '../theme/tokens.js';
|
|
3
|
+
/** The UI primitives the editor is built from. Every editor component draws
|
|
4
|
+
* its buttons, inputs and pickers through these (via `useUI()`), never by
|
|
5
|
+
* importing a component library directly — so a host can swap the whole
|
|
6
|
+
* kit, or single primitives, through PipelineEditor's `components` prop.
|
|
7
|
+
*
|
|
8
|
+
* Props are the editor's own contract, deliberately small: only what the
|
|
9
|
+
* editor actually uses. Anything smart (auto-selecting a typed column,
|
|
10
|
+
* building a function's default args, filtering options by column type)
|
|
11
|
+
* lives in the editor on top of these — an adapter only renders. MUI is
|
|
12
|
+
* the default adapter (src/adapters/mui). */
|
|
13
|
+
/** Semantic color of a control — adapters map it onto their own palette,
|
|
14
|
+
* which should follow the editor's color tokens (see theme/tokens.ts). */
|
|
15
|
+
export type UIColor = 'primary' | 'secondary' | 'error' | 'warning' | 'inherit';
|
|
16
|
+
export type UISize = 'small' | 'medium';
|
|
17
|
+
export interface TooltipProps {
|
|
18
|
+
title: string;
|
|
19
|
+
placement?: 'top' | 'bottom' | 'left' | 'right';
|
|
20
|
+
/** Controlled open state — omit to let the adapter open on hover/focus. */
|
|
21
|
+
open?: boolean;
|
|
22
|
+
onOpen?: (event: SyntheticEvent) => void;
|
|
23
|
+
onClose?: (event: Event | SyntheticEvent) => void;
|
|
24
|
+
/** Hover delays in ms — adapters may ignore these. */
|
|
25
|
+
enterDelay?: number;
|
|
26
|
+
leaveDelay?: number;
|
|
27
|
+
/** A single element able to hold a ref and receive hover/focus events. */
|
|
28
|
+
children: ReactElement;
|
|
29
|
+
}
|
|
30
|
+
export interface IconButtonProps {
|
|
31
|
+
/** The icon. */
|
|
32
|
+
children: ReactNode;
|
|
33
|
+
onClick?: MouseEventHandler<HTMLButtonElement>;
|
|
34
|
+
onClickCapture?: MouseEventHandler<HTMLButtonElement>;
|
|
35
|
+
disabled?: boolean;
|
|
36
|
+
color?: UIColor;
|
|
37
|
+
size?: UISize;
|
|
38
|
+
className?: string;
|
|
39
|
+
'aria-label'?: string;
|
|
40
|
+
/** A navigation control (e.g. closing a panel) rather than an edit —
|
|
41
|
+
* stays visible in read-only mode. */
|
|
42
|
+
navigation?: boolean;
|
|
43
|
+
}
|
|
44
|
+
export interface ButtonProps {
|
|
45
|
+
children: ReactNode;
|
|
46
|
+
onClick?: MouseEventHandler<HTMLButtonElement>;
|
|
47
|
+
/** 'contained' is a filled pill (e.g. the AND/OR toggle), 'text' a plain
|
|
48
|
+
* label button. Default 'text'. */
|
|
49
|
+
variant?: 'text' | 'contained';
|
|
50
|
+
color?: UIColor;
|
|
51
|
+
size?: UISize;
|
|
52
|
+
startIcon?: ReactNode;
|
|
53
|
+
className?: string;
|
|
54
|
+
ref?: Ref<HTMLButtonElement>;
|
|
55
|
+
/** The button shows a value (e.g. the AND/OR toggle): in read-only mode it
|
|
56
|
+
* stays visible as an inert label instead of being hidden. */
|
|
57
|
+
showsValue?: boolean;
|
|
58
|
+
/** An on/off toggle, and whether it's on — reaches the element as
|
|
59
|
+
* `aria-pressed` (a kit passes extra props through, see IconButton). */
|
|
60
|
+
pressed?: boolean;
|
|
61
|
+
}
|
|
62
|
+
export interface TextFieldProps {
|
|
63
|
+
value?: string | number;
|
|
64
|
+
onChange?: (value: string) => void;
|
|
65
|
+
onBlur?: () => void;
|
|
66
|
+
/** The input's kind: `datetime-local` and `time` for a date and time or
|
|
67
|
+
* a time of day (issue 130) — values as `YYYY-MM-DDTHH:MM` / `HH:MM(:SS)`
|
|
68
|
+
* text, the browser's own, which the editor reads as its UTC fields. */
|
|
69
|
+
type?: 'text' | 'number' | 'datetime-local' | 'time';
|
|
70
|
+
placeholder?: string;
|
|
71
|
+
/** Class for the outer element. */
|
|
72
|
+
className?: string;
|
|
73
|
+
/** Class for the `<input>` itself — the editor uses this for sizing
|
|
74
|
+
* (e.g. `field-sizing-content` so the input grows with its text). */
|
|
75
|
+
inputClassName?: string;
|
|
76
|
+
/** Visually joined to the control on its left (no rounded left corners,
|
|
77
|
+
* matching height) — e.g. the value input after the type badge. */
|
|
78
|
+
grouped?: boolean;
|
|
79
|
+
/** Not editable (the editor sets this in read-only mode). */
|
|
80
|
+
disabled?: boolean;
|
|
81
|
+
/** Shown as a normal input that can be focused but not typed in — e.g. a
|
|
82
|
+
* value marked as the empty text, which shows "Empty". */
|
|
83
|
+
readOnly?: boolean;
|
|
84
|
+
/** A name edited in place (a derived table's alias): no box, just the
|
|
85
|
+
* text — the editor styles it through `inputClassName`. */
|
|
86
|
+
inline?: boolean;
|
|
87
|
+
/** At most this many characters can be typed. */
|
|
88
|
+
maxLength?: number;
|
|
89
|
+
}
|
|
90
|
+
export interface SelectOption {
|
|
91
|
+
value: string;
|
|
92
|
+
label: string;
|
|
93
|
+
}
|
|
94
|
+
export interface SelectProps {
|
|
95
|
+
value: string;
|
|
96
|
+
options: SelectOption[];
|
|
97
|
+
onChange: (value: string) => void;
|
|
98
|
+
/** 'compact' is the small inline variant used inside function arguments. */
|
|
99
|
+
density?: 'normal' | 'compact';
|
|
100
|
+
className?: string;
|
|
101
|
+
grouped?: boolean;
|
|
102
|
+
disabled?: boolean;
|
|
103
|
+
}
|
|
104
|
+
/** Why the text in a Combobox changed: the user typing ('input'), the
|
|
105
|
+
* adapter syncing it to a picked option ('reset'), or it being cleared. */
|
|
106
|
+
export type ComboboxInputReason = 'input' | 'reset' | 'clear';
|
|
107
|
+
export interface ComboboxProps<T> {
|
|
108
|
+
options: readonly T[];
|
|
109
|
+
/** The picked option — `null` for none. */
|
|
110
|
+
value?: T | null;
|
|
111
|
+
onChange?: (value: T | null) => void;
|
|
112
|
+
/** Controlled text in the input. */
|
|
113
|
+
inputValue?: string;
|
|
114
|
+
onInputChange?: (text: string, reason: ComboboxInputReason) => void;
|
|
115
|
+
getOptionLabel?: (option: T) => string;
|
|
116
|
+
getOptionKey?: (option: T) => string;
|
|
117
|
+
/** The text typing is matched against, when it's more than the label
|
|
118
|
+
* (a function's other names: GROUP_CONCAT finds STRING_AGG). */
|
|
119
|
+
searchText?: (option: T) => string;
|
|
120
|
+
/** Group heading for an option (e.g. its table) — options arrive already
|
|
121
|
+
* ordered by group. '' is a group with no heading (actions after the
|
|
122
|
+
* groups). */
|
|
123
|
+
groupBy?: (option: T) => string;
|
|
124
|
+
/** A group heading drawn in the accent colour ('accent'), to set it
|
|
125
|
+
* apart (the query's sub queries among the schema's tables). */
|
|
126
|
+
groupTone?: (group: string) => 'accent' | undefined;
|
|
127
|
+
/** Free text is allowed, not just the listed options (function names). */
|
|
128
|
+
freeSolo?: boolean;
|
|
129
|
+
/** An action among the choices ("Create Sub Query"), not a value: listed
|
|
130
|
+
* whatever is typed, in its place (last), and drawn as a command —
|
|
131
|
+
* set apart from the choices above it. */
|
|
132
|
+
isAction?: (option: T) => boolean;
|
|
133
|
+
label?: string;
|
|
134
|
+
placeholder?: string;
|
|
135
|
+
/** Shown in the list when nothing in it matches, or it's empty — e.g.
|
|
136
|
+
* why there's nothing to pick here. The kit's own text otherwise. */
|
|
137
|
+
noOptionsText?: string;
|
|
138
|
+
/** At most this many characters can be typed (the editor always passes
|
|
139
|
+
* one: what it stores, e.g. a function's name, or only searches with). */
|
|
140
|
+
maxLength?: number;
|
|
141
|
+
className?: string;
|
|
142
|
+
inputClassName?: string;
|
|
143
|
+
grouped?: boolean;
|
|
144
|
+
/** 'dark' when drawn directly on a dark node panel rather than a light
|
|
145
|
+
* field card. */
|
|
146
|
+
appearance?: 'light' | 'dark';
|
|
147
|
+
disabled?: boolean;
|
|
148
|
+
/** Focused as it mounts, its list open: a box opened to type in at once
|
|
149
|
+
* (Find, issue 131). */
|
|
150
|
+
autoFocus?: boolean;
|
|
151
|
+
}
|
|
152
|
+
export type ComboboxComponent = <T>(props: ComboboxProps<T>) => ReactNode;
|
|
153
|
+
export interface MenuItemSpec {
|
|
154
|
+
key: string;
|
|
155
|
+
label: string;
|
|
156
|
+
selected?: boolean;
|
|
157
|
+
/** Shown, not picked — e.g. a choice that doesn't apply here, `detail`
|
|
158
|
+
* saying why. */
|
|
159
|
+
disabled?: boolean;
|
|
160
|
+
/** A second, smaller line under the label. */
|
|
161
|
+
detail?: string;
|
|
162
|
+
/** Before the label: e.g. a problem's severity (the problems list). */
|
|
163
|
+
icon?: ReactNode;
|
|
164
|
+
/** The colour the kit gives `icon` (drawn in `currentColor`): its danger
|
|
165
|
+
* or warning colour. A menu opens outside the editor's element, where
|
|
166
|
+
* the editor's own colour tokens don't reach — the kit has them (its
|
|
167
|
+
* Provider's `tokens`). */
|
|
168
|
+
tone?: 'danger' | 'warning';
|
|
169
|
+
onClick: () => void;
|
|
170
|
+
}
|
|
171
|
+
export interface MenuSection {
|
|
172
|
+
/** Optional heading shown above the section's items. */
|
|
173
|
+
title?: string;
|
|
174
|
+
items: MenuItemSpec[];
|
|
175
|
+
}
|
|
176
|
+
export interface MenuProps {
|
|
177
|
+
anchorEl: HTMLElement | null;
|
|
178
|
+
open: boolean;
|
|
179
|
+
onClose: () => void;
|
|
180
|
+
sections: MenuSection[];
|
|
181
|
+
}
|
|
182
|
+
/** A date input. Its value is a calendar day held in a Date's UTC fields
|
|
183
|
+
* — 3 Oct 2026 is `2026-10-03T00:00:00Z` (see calendarDate.ts: build it
|
|
184
|
+
* with `calendarDay`, read it with the UTC getters or `isoDay`) — never
|
|
185
|
+
* local midnight, which is another day in another zone. */
|
|
186
|
+
export interface DatePickerProps {
|
|
187
|
+
value?: Date;
|
|
188
|
+
onChange?: (value: Date | undefined) => void;
|
|
189
|
+
className?: string;
|
|
190
|
+
grouped?: boolean;
|
|
191
|
+
disabled?: boolean;
|
|
192
|
+
}
|
|
193
|
+
/** A date and time input (issue 130): a wall-clock time held in a Date's
|
|
194
|
+
* UTC fields, as DatePicker's day is (see calendarDate.ts). */
|
|
195
|
+
export interface DateTimePickerProps {
|
|
196
|
+
value?: Date;
|
|
197
|
+
onChange?: (value: Date | undefined) => void;
|
|
198
|
+
className?: string;
|
|
199
|
+
grouped?: boolean;
|
|
200
|
+
disabled?: boolean;
|
|
201
|
+
}
|
|
202
|
+
/** A time-of-day input (issue 130): `HH:MM:SS` text. */
|
|
203
|
+
export interface TimePickerProps {
|
|
204
|
+
value?: string;
|
|
205
|
+
onChange?: (value: string | undefined) => void;
|
|
206
|
+
className?: string;
|
|
207
|
+
grouped?: boolean;
|
|
208
|
+
disabled?: boolean;
|
|
209
|
+
}
|
|
210
|
+
/** One of ListInput's values (a chip), or one of its choices. `key` tells
|
|
211
|
+
* them apart: the editor's own, given back as it was. */
|
|
212
|
+
export interface ListInputItem {
|
|
213
|
+
key: string;
|
|
214
|
+
label: string;
|
|
215
|
+
}
|
|
216
|
+
/** Several values in one field (issue 130: IN's values): a chip each, and
|
|
217
|
+
* text typed to add one — or, with `options`, picks from a fixed set. */
|
|
218
|
+
export interface ListInputProps {
|
|
219
|
+
items: ListInputItem[];
|
|
220
|
+
/** A fixed set to pick from (a column's options, yes / no): nothing is
|
|
221
|
+
* typed then. */
|
|
222
|
+
options?: ListInputItem[];
|
|
223
|
+
/** The values after an edit, in order: a chip kept, or an option picked,
|
|
224
|
+
* as it was given; text typed in (Enter) as a string. */
|
|
225
|
+
onChange?: (values: (ListInputItem | string)[]) => void;
|
|
226
|
+
/** Whether typed text can be added (it reads as a value of the type):
|
|
227
|
+
* Enter adds nothing until it can. */
|
|
228
|
+
canAdd?: (text: string) => boolean;
|
|
229
|
+
placeholder?: string;
|
|
230
|
+
maxLength?: number;
|
|
231
|
+
className?: string;
|
|
232
|
+
grouped?: boolean;
|
|
233
|
+
disabled?: boolean;
|
|
234
|
+
}
|
|
235
|
+
/** Wraps the whole editor once — the place for an adapter's own theme or
|
|
236
|
+
* context providers. Receives the color tokens currently in effect so the
|
|
237
|
+
* kit can follow them. */
|
|
238
|
+
export interface UIProviderProps {
|
|
239
|
+
tokens: QueryBuilderTheme;
|
|
240
|
+
/** PipelineEditor's `fontFamily`, when set — for widgets the kit renders
|
|
241
|
+
* outside the editor's root (popovers, menus), which don't inherit it.
|
|
242
|
+
* Undefined means the host page's font. */
|
|
243
|
+
fontFamily?: string;
|
|
244
|
+
children: ReactNode;
|
|
245
|
+
}
|
|
246
|
+
export interface UIComponents {
|
|
247
|
+
Provider: ComponentType<UIProviderProps>;
|
|
248
|
+
Tooltip: ComponentType<TooltipProps>;
|
|
249
|
+
IconButton: ComponentType<IconButtonProps>;
|
|
250
|
+
Button: ComponentType<ButtonProps>;
|
|
251
|
+
TextField: ComponentType<TextFieldProps>;
|
|
252
|
+
Select: ComponentType<SelectProps>;
|
|
253
|
+
Combobox: ComboboxComponent;
|
|
254
|
+
Menu: ComponentType<MenuProps>;
|
|
255
|
+
DatePicker: ComponentType<DatePickerProps>;
|
|
256
|
+
/** Optional: without one, the kit's TextField as a `datetime-local`
|
|
257
|
+
* input (the browser's own picker). */
|
|
258
|
+
DateTimePicker?: ComponentType<DateTimePickerProps>;
|
|
259
|
+
/** Optional: without one, the kit's TextField as a `time` input. */
|
|
260
|
+
TimePicker?: ComponentType<TimePickerProps>;
|
|
261
|
+
/** Optional: without one, IN's values are the editor's own chips, with
|
|
262
|
+
* an input of their type (a picker for a date) to add one. */
|
|
263
|
+
ListInput?: ComponentType<ListInputProps>;
|
|
264
|
+
}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import type { ExpressionNode } from './ast.js';
|
|
2
|
+
import { type DerivedFrom, type DerivedQuery, type QueryBody, type QueryPipeline, type QueryValue, type UnionQuery } from './queryAst.js';
|
|
3
|
+
import { type DatabaseSchema } from './schema.js';
|
|
4
|
+
/** A table to add to the union: its name, its own columns
|
|
5
|
+
* (`sales_target.amount`), its own conditions, and its label (its
|
|
6
|
+
* `source` value; default the table's label). */
|
|
7
|
+
export interface UnionTableSpec {
|
|
8
|
+
table: string;
|
|
9
|
+
columns: {
|
|
10
|
+
expression: ExpressionNode;
|
|
11
|
+
alias?: string;
|
|
12
|
+
}[];
|
|
13
|
+
where?: ExpressionNode;
|
|
14
|
+
label?: string;
|
|
15
|
+
}
|
|
16
|
+
/** How the union is built. */
|
|
17
|
+
export interface UnionTableOptions {
|
|
18
|
+
/** A shared column the new table can't reach: refused (`'refuse'`, the
|
|
19
|
+
* default — the union only has what every table reaches), or a typed
|
|
20
|
+
* NULL in its branch (`'null'`). A condition on such a column outside
|
|
21
|
+
* the union then drops that table's rows. */
|
|
22
|
+
unshared?: 'refuse' | 'null';
|
|
23
|
+
/** Add a `source` column: each branch's label. */
|
|
24
|
+
source?: boolean;
|
|
25
|
+
/** Add a `rows_<table>` column per table: 1 in its branch, NULL in the
|
|
26
|
+
* others — COUNT of it counts that table's rows. */
|
|
27
|
+
rowMarkers?: boolean;
|
|
28
|
+
/** The union's alias (default `stacked`), on its first call. */
|
|
29
|
+
alias?: string;
|
|
30
|
+
}
|
|
31
|
+
/** What a union's column is (see unionTableColumns). */
|
|
32
|
+
export type UnionTableColumnKind = 'shared' | 'own' | 'source' | 'rows';
|
|
33
|
+
/** One of a union's columns: its kind, and the tables (the branches', in
|
|
34
|
+
* order) that fill it and that leave it NULL. */
|
|
35
|
+
export interface UnionTableColumn {
|
|
36
|
+
name: string;
|
|
37
|
+
kind: UnionTableColumnKind;
|
|
38
|
+
filledBy: string[];
|
|
39
|
+
nullIn: string[];
|
|
40
|
+
}
|
|
41
|
+
/** The union `query` reads from — its FROM, when that's a union — else
|
|
42
|
+
* undefined. */
|
|
43
|
+
export declare function unionOf(query: QueryBody): (DerivedFrom & {
|
|
44
|
+
query: UnionQuery;
|
|
45
|
+
}) | undefined;
|
|
46
|
+
/** The union's columns (see UnionTableColumn); [] when `query` reads no
|
|
47
|
+
* union of tables. */
|
|
48
|
+
export declare function unionTableColumns(schema: DatabaseSchema, query: QueryBody): UnionTableColumn[];
|
|
49
|
+
/** `query` with `spec`'s table's rows added as a union (issue 121): the
|
|
50
|
+
* first call turns a query of one table's detail rows into `FROM (it UNION
|
|
51
|
+
* ALL the table) AS stacked`, its columns read from the union; later calls
|
|
52
|
+
* add a branch. The new table's branch fills every shared column it
|
|
53
|
+
* reaches, and copies the conditions on them; its own columns are new
|
|
54
|
+
* columns, NULL in the other branches (and the others' in its). Throws,
|
|
55
|
+
* naming why, when it can't be added: see UnionTableOptions' `unshared`,
|
|
56
|
+
* unionableTables. */
|
|
57
|
+
export declare function addUnionTable(schema: DatabaseSchema, query: QueryPipeline, spec: UnionTableSpec, options?: UnionTableOptions): QueryPipeline;
|
|
58
|
+
/** The tables `addUnionTable` takes for `query`, by its options: one not
|
|
59
|
+
* in the union yet that reaches at least one of its shared columns (all of
|
|
60
|
+
* them, unless `unshared: 'null'`) and follows its conditions. Worked out
|
|
61
|
+
* from the relations, without building each union. */
|
|
62
|
+
export declare function unionableTables(schema: DatabaseSchema, query: QueryPipeline, options?: Pick<UnionTableOptions, 'unshared'>): string[];
|
|
63
|
+
/** `next` — the query after an edit of `previous` — with every union's
|
|
64
|
+
* branches lined up (issue 121): editing one branch's columns (adding,
|
|
65
|
+
* removing, renaming, reordering one) does the same in the others, a
|
|
66
|
+
* typed NULL where they have no value. settleQuery applies it to every
|
|
67
|
+
* edit, so the editor's canvases and the code helpers alike keep a union
|
|
68
|
+
* whole. */
|
|
69
|
+
export declare function keepUnionsAligned(schema: DatabaseSchema, previous: QueryValue | undefined, next: QueryValue): QueryValue;
|
|
70
|
+
/** `query` with the branch `index` of its union removed (issue 121), the
|
|
71
|
+
* columns only it filled going with it (see droppedColumns) — from every
|
|
72
|
+
* branch, and the SELECT columns that read them. One query left stays a
|
|
73
|
+
* union of one, so another can be added again (issue 153: it used to be
|
|
74
|
+
* unwrapped back into the query, or a join's into a plain sub query).
|
|
75
|
+
* Unchanged when it's the only one, or isn't there. */
|
|
76
|
+
export declare function removeUnionTable<Q extends QueryBody>(query: Q, index: number, unionId?: string): Q;
|
|
77
|
+
/** A name for a new union in `query` (`union_1`, `union_2`, …): not one
|
|
78
|
+
* of its tables' names, nor a schema table's. */
|
|
79
|
+
export declare function unionName(schema: DatabaseSchema, query?: QueryBody): string;
|
|
80
|
+
/** A query (`id` its id) reading a new union, `unionId` named `alias`, of
|
|
81
|
+
* one query so far: FROM `from`, nothing picked yet. One query is a union
|
|
82
|
+
* not finished (validateQuery says so) until another is added
|
|
83
|
+
* (addUnionBranch). */
|
|
84
|
+
export declare function createUnion(id: string, unionId: string, alias: string, from: DerivedQuery['from']): QueryPipeline;
|
|
85
|
+
/** `query` as a union's first branch (`unionId`, named `alias`): its own
|
|
86
|
+
* tables, conditions, groups and columns (each named), read from the union
|
|
87
|
+
* — its sort keys too, when they're columns it picks (others stay as they
|
|
88
|
+
* are, for validateQuery to point at); its paging stays on it. */
|
|
89
|
+
export declare function unionWithQuery<Q extends QueryBody>(query: Q, unionId: string, alias: string): Q;
|
|
90
|
+
/** `query` with a new branch, FROM `from`, added to its union `unionId`
|
|
91
|
+
* (its FROM's or a join's): a typed NULL for each of the union's columns,
|
|
92
|
+
* to be filled in there (a field picked, a value typed). Unchanged when
|
|
93
|
+
* there's no such union. */
|
|
94
|
+
export declare function addUnionBranch<Q extends QueryBody>(schema: DatabaseSchema, query: Q, unionId: string, from: DerivedQuery['from']): Q;
|
|
95
|
+
/** `query` with a new union (`unionId`) of one query so far, FROM `from`,
|
|
96
|
+
* LEFT JOINed: its ON started as a sub query's (derivedOnSeed), to be
|
|
97
|
+
* finished once its columns are picked. */
|
|
98
|
+
export declare function addUnionJoin<Q extends QueryBody>(schema: DatabaseSchema, query: Q, unionId: string, from: DerivedQuery['from']): Q;
|
|
99
|
+
/** `query` with its union `unionId` written `UNION ALL` (`all`) or `UNION`,
|
|
100
|
+
* which merges rows the same in every column — never for detail rows a
|
|
101
|
+
* grid sums. */
|
|
102
|
+
export declare function setUnionAll<Q extends QueryBody>(query: Q, unionId: string, all: boolean): Q;
|
|
103
|
+
/** `query` with its union `unionId`'s column at `index` named `name`: the
|
|
104
|
+
* first query's alias (the others follow, keepUnionsAligned), and every
|
|
105
|
+
* field of `query` reading it by the old name. Unchanged for a name that's
|
|
106
|
+
* empty, too long or another column's. */
|
|
107
|
+
export declare function renameUnionColumn<Q extends QueryBody>(schema: DatabaseSchema, query: Q, unionId: string, index: number, name: string): Q;
|
|
108
|
+
/** `query` with its union `unionId` of one query back as a plain query
|
|
109
|
+
* (issue 153) — the reverse of making one, for the union's row:
|
|
110
|
+
* - FROM's, its query no summary (no GROUP BY, HAVING, DISTINCT or
|
|
111
|
+
* aggregate): its tables, joins and conditions become the query's own,
|
|
112
|
+
* and what read the union (`union_1.city`) reads what it was
|
|
113
|
+
* (`store.city`), a SELECT column keeping its name.
|
|
114
|
+
* - FROM's, a summary, read by a query that only picks and sorts its
|
|
115
|
+
* columns (no conditions, groups or joins of its own): the summary
|
|
116
|
+
* becomes the query, with the query's columns, sort and paging.
|
|
117
|
+
* - Otherwise (a summary the query filters or groups further; a join's):
|
|
118
|
+
* a plain sub query, `FROM (SELECT …) AS union_1` — merging would
|
|
119
|
+
* change what it means.
|
|
120
|
+
* Unchanged when there's no such union, or it has more than one query. */
|
|
121
|
+
export declare function unwrapUnion<Q extends QueryBody>(query: Q, unionId: string): Q;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { ExpressionNode, ValueType } from './ast.js';
|
|
2
|
+
import { type Table, type TableColumn } from './schema.js';
|
|
3
|
+
/** The column a field names on this canvas — by its alias inside an EXISTS
|
|
4
|
+
* (FieldView's tables), else by its name, a sub query's by its alias —
|
|
5
|
+
* when it names one the schema (or a sub query) has. */
|
|
6
|
+
export declare function useFieldColumn(): (node: ExpressionNode | undefined) => {
|
|
7
|
+
table: Table;
|
|
8
|
+
column: TableColumn;
|
|
9
|
+
} | undefined;
|
|
10
|
+
/** The type of what an expression on this canvas gives (issue 130, see
|
|
11
|
+
* expressionType) — a value compared with it follows it. */
|
|
12
|
+
export declare function useExpressionType(): (node: ExpressionNode | undefined) => ValueType | undefined;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import type { ExpressionNode, FieldNode, ListNode, LiteralNode, LiteralValue, ValueType } from './ast.js';
|
|
2
|
+
import { type FunctionRegistry } from './functionRegistry.js';
|
|
3
|
+
import type { ColumnOption, DatabaseColumnType } from './schema.js';
|
|
4
|
+
export type { ValueType };
|
|
5
|
+
/** The types a user picks for a value with nothing typed to compare with —
|
|
6
|
+
* the type badge's choices (see LiteralNode's `as`). */
|
|
7
|
+
export declare const PICKED_VALUE_TYPES: readonly ["text", "number", "date", "boolean"];
|
|
8
|
+
export type PickedValueType = typeof PICKED_VALUE_TYPES[number];
|
|
9
|
+
/** The type of a column's values. */
|
|
10
|
+
export declare function columnValueType(type: DatabaseColumnType): ValueType;
|
|
11
|
+
/** The type of a SQL type name (a CAST's), by what it starts with:
|
|
12
|
+
* `INT…` a whole number, `DECIMAL(10, 2)` a number, `DATETIME` a day and a
|
|
13
|
+
* time. Undefined for one it doesn't know. */
|
|
14
|
+
export declare function sqlTypeValueType(name: string): ValueType | undefined;
|
|
15
|
+
/** A literal's own type: the one picked for it (`as`), else what its value
|
|
16
|
+
* is. Undefined for null, or a value with no type yet (a blank). */
|
|
17
|
+
export declare function literalValueType(literal: LiteralNode): ValueType | undefined;
|
|
18
|
+
/** The type of `node`'s value, when it's known: a field's column (by
|
|
19
|
+
* `fieldType`, which knows the query's tables), a function's result (by
|
|
20
|
+
* its signature's `returns`), IF/CASE by their branches, a literal by
|
|
21
|
+
* itself. Undefined when nothing says (a param, a field with no column,
|
|
22
|
+
* an unknown function). */
|
|
23
|
+
export declare function expressionType(node: ExpressionNode | undefined, fieldType: (field: FieldNode) => ValueType | undefined, registry: FunctionRegistry): ValueType | undefined;
|
|
24
|
+
/** The type a literal in a comparison holds: what it's compared with, when
|
|
25
|
+
* that's known — else its own. */
|
|
26
|
+
export declare function valueTypeAgainst(literal: LiteralNode, other: ValueType | undefined): ValueType | undefined;
|
|
27
|
+
/** `value` as a `type` value, when it reads as one cleanly; undefined when
|
|
28
|
+
* it doesn't (the caller clears it). A blank stays blank. */
|
|
29
|
+
export declare function convertValue(value: LiteralValue, type: ValueType): LiteralValue | undefined;
|
|
30
|
+
/** `literal` as a value of `type` — what's compared with it now has that
|
|
31
|
+
* type (convert-or-clear, issue 130): its value converted when it reads
|
|
32
|
+
* cleanly as one, else cleared (left blank). With `options` (a column's
|
|
33
|
+
* fixed set), only one of those: the option it names, or blank. The type
|
|
34
|
+
* it was picked as (`as`) goes: the type is the other side's now. The
|
|
35
|
+
* same object when nothing changes. Undefined `type`: left as it is. */
|
|
36
|
+
export declare function settleLiteral(literal: LiteralNode, type: ValueType | undefined, options?: readonly ColumnOption[]): LiteralNode;
|
|
37
|
+
/** IN's values as values of `type` (settleLiteral, each): one that
|
|
38
|
+
* doesn't read as one goes — or, for BETWEEN's bounds (`bounds`), is
|
|
39
|
+
* cleared in its place. Expressions other than values stay. The same
|
|
40
|
+
* object when nothing changes. */
|
|
41
|
+
export declare function settleList(list: ListNode, type: ValueType | undefined, options?: readonly ColumnOption[], bounds?: boolean): ListNode;
|
|
42
|
+
/** The picked type (PICKED_VALUE_TYPES) a literal reads as: a whole or
|
|
43
|
+
* any number as `number`, a day or a day and time as `date`. (A literal's
|
|
44
|
+
* own type is never a time: that's text unless a column says otherwise.)
|
|
45
|
+
* Undefined while it has no type (a blank). */
|
|
46
|
+
export declare function pickedValueType(literal: LiteralNode): PickedValueType | undefined;
|
|
47
|
+
/** `node` made a value of the type picked for it (`as`): a literal's value
|
|
48
|
+
* converted when it reads cleanly as one, else a blank of that type. */
|
|
49
|
+
export declare function pickValueType(node: ExpressionNode, picked: PickedValueType): LiteralNode;
|
|
50
|
+
/** The operators a comparison offers for a value of `type` (all of them
|
|
51
|
+
* when it isn't known): text matches patterns, and is a range only when
|
|
52
|
+
* `textRange` says so (BetweenOnText); numbers, dates and times are
|
|
53
|
+
* ordered; yes/no is only equal or not. */
|
|
54
|
+
export declare function operatorsFor(type: ValueType | undefined, textRange?: boolean): readonly string[] | undefined;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export { MAX_NAME_LENGTH, branchesOf, hasBaseTable, isUnion, type DerivedFrom, type DerivedJoin, type DerivedQuery, type EmptyQuery, type NestedQuery, type UnionQuery, type FromClause, type GroupByItem, type JoinClause, type JoinType, type OrderByItem, type QueryPipeline, type QueryValue, type SelectItem, type SortDirection, type TableFrom, type TableJoin, type SharedFrom, type SharedJoin, type SharedQuery, } from './core/queryAst.js';
|
|
2
|
+
export { MAX_NUMBER_DIGITS, MAX_TEXT_LENGTH, MAX_TYPE_NAME_LENGTH } from './core/limits.js';
|
|
3
|
+
export { calendarDay, fromIsoDay, isoDay } from './core/calendarDate.js';
|
|
4
|
+
export { createEmptyQuery } from './core/pipelineFlow.js';
|
|
5
|
+
export { addMeasure, keepMeasuresInStep, measureFacts, type MeasureFact, type MeasureSpec, } from './core/measures.js';
|
|
6
|
+
export type { BinaryNode, BinaryOperator, CaseNode, ExistsNode, ExistsQuery, ExpressionNode, FieldNode, FunctionCallNode, FunctionSortKey, IfNode, LiteralNode, LiteralValue, LogicalNode, LogicalOperator, NotNode, ParamNode, RelativeDate, ListNode, SubqueryNode, } from './core/ast.js';
|
|
7
|
+
export { addUnionBranch, addUnionJoin, addUnionTable, createUnion, removeUnionTable, renameUnionColumn, setUnionAll, unwrapUnion, unionName, unionWithQuery, unionableTables, unionTableColumns, type UnionTableOptions, type UnionTableColumn, type UnionTableColumnKind, type UnionTableSpec, } from './core/unionTables.js';
|
|
8
|
+
export { SharedBaseError, addSharedQuery, joinSharedQuery, makeShared, makeSubQuery, removeSharedQuery, renameSharedQuery, setSharedBase, sharedQueryName, sharedUses, } from './core/sharedQueries.js';
|
|
9
|
+
export { joinMultiplicity, repeatedReads, repeatedTables, rowsPerBase, type JoinMultiplicity, } from './core/fanOut.js';
|
|
10
|
+
export { ScopeError, scopeQuery, unscopedBodies, type ScopeRule, } from './core/scopeQuery.js';
|
|
11
|
+
export { addCondition, addGroupBy, addJoin, addOrderBy, addSelectItem, expr, removeJoin, requireBaseTable, setBaseTable, setDistinct, setHaving, setPaging, } from './core/queryHelpers.js';
|
|
12
|
+
export { queryParams, type QueryParam } from './core/params.js';
|
|
13
|
+
export { relativeDateLabel } from './core/relativeDates.js';
|
|
14
|
+
export { QUERY_FORMAT_VERSION, QueryFormatError, loadQuery, saveQuery, type StoredQuery, } from './core/storedQuery.js';
|
|
15
|
+
export type { ResolveName } from './core/resolveNames.js';
|
|
16
|
+
export { astToParameterizedSql, astToSql, DIALECTS, DIALECT_LABELS, type ParameterizedSql, type ParameterizedSqlOptions, type SqlDialect, } from './core/sqlGen.js';
|
|
17
|
+
export { EMPTY_SCHEMA, filterSchema, validateSchema, type DatabaseColumnType, type DatabaseSchema, type ColumnOption, type Relation, type SchemaIssue, type SchemaIssueKind, type Table, type TableColumn, } from './core/schema.js';
|
|
18
|
+
export { QUERY_ISSUE_KINDS, QUERY_WARNING_KINDS, validateQuery, type QueryIssue, type QueryIssueKind, type QueryWarningKind, type QueryIssueSeverity, type ValidateQueryOptions, } from './core/queryValidation.js';
|
|
19
|
+
export { default as issueLocation, type IssueLocationStep } from './core/issueLocation.js';
|
|
20
|
+
export { DEFAULT_FUNCTIONS, functionsForDialect, type ArgDef, type ArgKind, type FunctionRegistry, type FunctionSignature, } from './core/functionRegistry.js';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ExpressionNode } from '../../core/ast.js';
|
|
2
|
+
import { type ExpressionFlowDispatch } from '../../core/expressionFlow.js';
|
|
3
|
+
export interface ExpressionFlowCanvasProps {
|
|
4
|
+
ast: ExpressionNode;
|
|
5
|
+
dispatch: ExpressionFlowDispatch;
|
|
6
|
+
hideChrome?: boolean;
|
|
7
|
+
recalcRevision?: number;
|
|
8
|
+
}
|
|
9
|
+
declare const ExpressionFlowCanvas: ({ ast, dispatch, hideChrome, recalcRevision, }: ExpressionFlowCanvasProps) => import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export default ExpressionFlowCanvas;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { QueryPipeline } from '../../core/queryAst.js';
|
|
2
|
+
interface Props {
|
|
3
|
+
query: QueryPipeline;
|
|
4
|
+
open: boolean;
|
|
5
|
+
onOpenChange: (open: boolean) => void;
|
|
6
|
+
/** Picked: go to it. */
|
|
7
|
+
onGo: (pathSegments: (string | number)[]) => void;
|
|
8
|
+
}
|
|
9
|
+
/** The button above the canvas, and the box it opens (also on Ctrl/⌘+F,
|
|
10
|
+
* see PipelineEditor). */
|
|
11
|
+
declare const FindBox: ({ query, open, onOpenChange, onGo, }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export default FindBox;
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import type { ExpressionNode } from '../../core/ast.js';
|
|
2
|
+
import type { DrillLevel } from '../../core/DrillDownContext.js';
|
|
3
|
+
import { type FromFlowNodeData } from '../../core/components/flow/FromFlowNode.js';
|
|
4
|
+
import { type SharedSection } from '../../core/components/flow/SharedQueriesFlowNode.js';
|
|
5
|
+
import { type SelectFlowNodeData } from '../../core/components/flow/SelectFlowNode.js';
|
|
6
|
+
import { type FlowAction, type FlowDispatch } from '../../core/expressionFlow.js';
|
|
7
|
+
import type { PipelineAction } from '../../core/pipelineFlow.js';
|
|
8
|
+
import type { PipelineScopeRoot } from '../../core/pipelineAnchor.js';
|
|
9
|
+
import type { QueryPipeline, SelectItem } from '../../core/queryAst.js';
|
|
10
|
+
import type { GroupingProblems } from '../../core/grouping.js';
|
|
11
|
+
import type { ExistsCandidate } from '../../core/existsMenu.js';
|
|
12
|
+
import { type SectionLabels } from './sectionLabels.js';
|
|
13
|
+
import { type MeasureLock } from '../../core/MeasureLockContext.js';
|
|
14
|
+
export interface MainPipelineBundle {
|
|
15
|
+
pipeline: QueryPipeline | undefined;
|
|
16
|
+
dispatch: (action: PipelineAction) => void;
|
|
17
|
+
onEditJoinCondition: (joinId: string, label: string) => void;
|
|
18
|
+
onCreateCondition: () => void;
|
|
19
|
+
drillDownFor: (scopeRoot?: PipelineScopeRoot) => (level: DrillLevel) => void;
|
|
20
|
+
/** Edits HAVING, shown as its own condition tree under Group Rows —
|
|
21
|
+
* what its nodes dispatch, like the WHERE canvas's own `dispatch`. */
|
|
22
|
+
havingDispatch: FlowDispatch;
|
|
23
|
+
/** Starts HAVING with a condition to fill in. */
|
|
24
|
+
onCreateHaving: () => void;
|
|
25
|
+
/** What the EXISTS button lists in HAVING's tree; null: not offered
|
|
26
|
+
* there. (WHERE's comes from the canvas's own ExistsMenuContext.) */
|
|
27
|
+
havingExists?: ExistsCandidate[] | null;
|
|
28
|
+
/** The caption above HAVING's tree. */
|
|
29
|
+
havingCaption: string;
|
|
30
|
+
/** What the query's grouping gets wrong, if it's grouped — see
|
|
31
|
+
* groupingProblems. Worked out by PipelineEditor, which has the
|
|
32
|
+
* function registry. */
|
|
33
|
+
grouping?: GroupingProblems;
|
|
34
|
+
/** Tables whose rows the joins repeat, read by a sum, average or count
|
|
35
|
+
* (see fanOut) — warned about on the FROM node. */
|
|
36
|
+
fanOutTables?: string[];
|
|
37
|
+
/** Captions above the FROM / WHERE / SELECT sections. Any omitted key
|
|
38
|
+
* falls back to `DEFAULT_SECTION_LABELS`. */
|
|
39
|
+
sectionLabels?: Partial<SectionLabels>;
|
|
40
|
+
/** Opens a derived table's own canvas (its FROM row's Open button). */
|
|
41
|
+
onOpenDerived?: (joinId: string, label: string) => void;
|
|
42
|
+
/** Opens a new sub query's canvas ("Create Sub Query" in FROM's pickers),
|
|
43
|
+
* to become a join or the base. */
|
|
44
|
+
onCreateSubQuery?: (as: 'join' | 'base') => void;
|
|
45
|
+
/** "Measure from…" in a SELECT column's type menu (see MeasureMenu). */
|
|
46
|
+
measures?: SelectFlowNodeData['measures'];
|
|
47
|
+
/** Adding another table's rows (a union, issue 121), when offered: see
|
|
48
|
+
* FromFlowNodeData's `unions`. */
|
|
49
|
+
unions?: FromFlowNodeData['unions'];
|
|
50
|
+
/** A measure's canvas, while kept in step with the report: the parts
|
|
51
|
+
* that follow it, read-only (MeasureLockContext), and what it follows,
|
|
52
|
+
* said on its FROM node. */
|
|
53
|
+
measureLock?: MeasureLock;
|
|
54
|
+
/** One of a union's branches (issue 121): its NULLs say so. */
|
|
55
|
+
unionBranch?: boolean;
|
|
56
|
+
measureNote?: string[];
|
|
57
|
+
/** Whether SELECT has an aggregate: until then, Group Rows isn't shown
|
|
58
|
+
* (unless it already has keys or HAVING), nor its "+"s — grouping by
|
|
59
|
+
* hand without anything summed up only drops duplicate rows. Default
|
|
60
|
+
* true. */
|
|
61
|
+
selectsAggregate?: boolean;
|
|
62
|
+
/** In a grouped query, the columns a field outside an aggregate may be in
|
|
63
|
+
* HAVING and the sort keys (groupKeyColumns); undefined otherwise. */
|
|
64
|
+
groupKeys?: readonly string[];
|
|
65
|
+
/** In a grouped query, SELECT's columns that sum something up: picked by
|
|
66
|
+
* name in HAVING and the sort keys (aggregateColumns). */
|
|
67
|
+
aggregateColumns?: readonly SelectItem[];
|
|
68
|
+
/** The most columns its SELECT takes: 1 on IN's sub query (issue 122),
|
|
69
|
+
* which compares with one. No limit otherwise. */
|
|
70
|
+
maxColumns?: number;
|
|
71
|
+
/** A derived table's canvas: no Sort & Limit (it has no ORDER BY or
|
|
72
|
+
* paging), and its FROM keeps a table. */
|
|
73
|
+
nested?: boolean;
|
|
74
|
+
/** Shared queries (issue 194), when offered: FROM's pickers' (see
|
|
75
|
+
* FromFlowNodeData). */
|
|
76
|
+
shared?: FromFlowNodeData['shared'];
|
|
77
|
+
/** The whole query's canvas: its Shared Queries section, shown before
|
|
78
|
+
* FROM once there's one. */
|
|
79
|
+
sharedSection?: SharedSection;
|
|
80
|
+
}
|
|
81
|
+
export interface FlowCanvasProps {
|
|
82
|
+
ast?: ExpressionNode;
|
|
83
|
+
dispatch: (action: FlowAction) => void;
|
|
84
|
+
hideChrome?: boolean;
|
|
85
|
+
recalcRevision?: number;
|
|
86
|
+
/** True only for the main (non-drilled) canvas — lets its root be deleted
|
|
87
|
+
* outright when it has no children, instead of being permanently stuck. */
|
|
88
|
+
allowRootDelete?: boolean;
|
|
89
|
+
/** Only ever passed by PipelineEditor.tsx's own top-level canvas — adds the
|
|
90
|
+
* FROM node (and whatever it connects to) to this same graph. Every
|
|
91
|
+
* SubFlowPanel-driven sub-canvas never passes this, so its own rendering
|
|
92
|
+
* stays completely unaffected. */
|
|
93
|
+
mainPipeline?: MainPipelineBundle;
|
|
94
|
+
}
|
|
95
|
+
declare const FlowCanvas: ({ ast, dispatch, hideChrome, recalcRevision, allowRootDelete, mainPipeline, }: FlowCanvasProps) => import("react/jsx-runtime").JSX.Element;
|
|
96
|
+
export default FlowCanvas;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type FocusTarget } from './focusContext.js';
|
|
2
|
+
/** Inside a <ReactFlow>: when this canvas gets a FocusContext target, finds
|
|
3
|
+
* the deepest of `nodeIds(target)` that's on the canvas, pans to it unless
|
|
4
|
+
* it's all in view already (keeping the zoom), and pulses a ring around it
|
|
5
|
+
* three times once it is — around the narrowest of the target's `parts`
|
|
6
|
+
* inside it there is (a comparison's side, a row), else all of it. */
|
|
7
|
+
declare const FocusPulse: ({ nodeIds }: {
|
|
8
|
+
nodeIds: (target: FocusTarget) => string[];
|
|
9
|
+
}) => import("react/jsx-runtime").JSX.Element | null;
|
|
10
|
+
export default FocusPulse;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { QueryPipeline } from '../../core/queryAst.js';
|
|
2
|
+
import type { QueryIssue } from '../../core/queryValidation.js';
|
|
3
|
+
interface Props {
|
|
4
|
+
issues: QueryIssue[];
|
|
5
|
+
/** The query they're about, to say where each is. */
|
|
6
|
+
query?: QueryPipeline;
|
|
7
|
+
/** An entry of the list was picked: show where that issue is. */
|
|
8
|
+
onSelect: (issue: QueryIssue) => void;
|
|
9
|
+
}
|
|
10
|
+
/** The query's problems, in the bar above the canvas: how many errors and
|
|
11
|
+
* warnings (each its colour and icon). Opens their list (issue 132):
|
|
12
|
+
* errors, then warnings, each entry by its place — a section of the
|
|
13
|
+
* canvas, or a sub query — and saying where it is; picking one goes to
|
|
14
|
+
* it. Nothing at all without problems. */
|
|
15
|
+
declare const IssuesButton: ({ issues, query, onSelect }: Props) => import("react/jsx-runtime").JSX.Element | null;
|
|
16
|
+
export default IssuesButton;
|