@uwdata/mosaic-spec 0.16.1 → 0.17.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/package.json +8 -12
- package/src/ast/TransformNode.js +11 -17
- package/src/ast/WindowFrameNode.js +61 -0
- package/src/config/transforms.js +8 -0
- package/src/constants.js +1 -0
- package/src/spec/Interval.ts +75 -0
- package/src/spec/Transform.ts +56 -46
- package/tsconfig.json +10 -8
- package/LICENSE +0 -47
- package/dist/mosaic-schema.json +0 -200164
- package/dist/types/ast/ASTNode.d.ts +0 -26
- package/dist/types/ast/ColumnParamRefNode.d.ts +0 -8
- package/dist/types/ast/DataNode.d.ts +0 -60
- package/dist/types/ast/ExpressionNode.d.ts +0 -13
- package/dist/types/ast/HConcatNode.d.ts +0 -10
- package/dist/types/ast/HSpaceNode.d.ts +0 -11
- package/dist/types/ast/InputNode.d.ts +0 -8
- package/dist/types/ast/LiteralNode.d.ts +0 -7
- package/dist/types/ast/OptionsNode.d.ts +0 -10
- package/dist/types/ast/ParamNode.d.ts +0 -8
- package/dist/types/ast/ParamRefNode.d.ts +0 -8
- package/dist/types/ast/PlotAttributeNode.d.ts +0 -18
- package/dist/types/ast/PlotFromNode.d.ts +0 -9
- package/dist/types/ast/PlotInteractorNode.d.ts +0 -8
- package/dist/types/ast/PlotLegendNode.d.ts +0 -10
- package/dist/types/ast/PlotMarkNode.d.ts +0 -10
- package/dist/types/ast/PlotNode.d.ts +0 -11
- package/dist/types/ast/SelectionNode.d.ts +0 -24
- package/dist/types/ast/SpecNode.d.ts +0 -10
- package/dist/types/ast/TransformNode.d.ts +0 -21
- package/dist/types/ast/VConcatNode.d.ts +0 -10
- package/dist/types/ast/VSpaceNode.d.ts +0 -11
- package/dist/types/ast-to-dom.d.ts +0 -40
- package/dist/types/ast-to-esm.d.ts +0 -64
- package/dist/types/config/components.d.ts +0 -4
- package/dist/types/config/extensions.d.ts +0 -9
- package/dist/types/config/inputs.d.ts +0 -5
- package/dist/types/config/plots.d.ts +0 -34
- package/dist/types/config/transforms.d.ts +0 -4
- package/dist/types/constants.d.ts +0 -31
- package/dist/types/index.d.ts +0 -29
- package/dist/types/parse-spec.d.ts +0 -111
- package/dist/types/spec/CSSStyles.d.ts +0 -3
- package/dist/types/spec/Data.d.ts +0 -165
- package/dist/types/spec/Expression.d.ts +0 -27
- package/dist/types/spec/HConcat.d.ts +0 -8
- package/dist/types/spec/HSpace.d.ts +0 -9
- package/dist/types/spec/Input.d.ts +0 -212
- package/dist/types/spec/Param.d.ts +0 -63
- package/dist/types/spec/Plot.d.ts +0 -14
- package/dist/types/spec/PlotAttribute.d.ts +0 -1534
- package/dist/types/spec/PlotFrom.d.ts +0 -20
- package/dist/types/spec/PlotInteractor.d.ts +0 -9
- package/dist/types/spec/PlotLegend.d.ts +0 -68
- package/dist/types/spec/PlotMark.d.ts +0 -28
- package/dist/types/spec/PlotTypes.d.ts +0 -293
- package/dist/types/spec/Spec.d.ts +0 -52
- package/dist/types/spec/Transform.d.ts +0 -346
- package/dist/types/spec/VConcat.d.ts +0 -8
- package/dist/types/spec/VSpace.d.ts +0 -9
- package/dist/types/spec/interactors/BrushStyles.d.ts +0 -27
- package/dist/types/spec/interactors/Highlight.d.ts +0 -37
- package/dist/types/spec/interactors/Interval1D.d.ts +0 -42
- package/dist/types/spec/interactors/Interval2D.d.ts +0 -47
- package/dist/types/spec/interactors/Nearest.d.ts +0 -44
- package/dist/types/spec/interactors/PanZoom.d.ts +0 -58
- package/dist/types/spec/interactors/Region.d.ts +0 -32
- package/dist/types/spec/interactors/Toggle.d.ts +0 -59
- package/dist/types/spec/marks/Area.d.ts +0 -139
- package/dist/types/spec/marks/Arrow.d.ts +0 -94
- package/dist/types/spec/marks/Axis.d.ts +0 -281
- package/dist/types/spec/marks/Bar.d.ts +0 -150
- package/dist/types/spec/marks/Cell.d.ts +0 -57
- package/dist/types/spec/marks/Contour.d.ts +0 -23
- package/dist/types/spec/marks/Delaunay.d.ts +0 -86
- package/dist/types/spec/marks/DenseLine.d.ts +0 -27
- package/dist/types/spec/marks/Density.d.ts +0 -136
- package/dist/types/spec/marks/Dot.d.ts +0 -133
- package/dist/types/spec/marks/ErrorBar.d.ts +0 -82
- package/dist/types/spec/marks/Frame.d.ts +0 -21
- package/dist/types/spec/marks/Geo.d.ts +0 -53
- package/dist/types/spec/marks/Hexbin.d.ts +0 -30
- package/dist/types/spec/marks/Hexgrid.d.ts +0 -25
- package/dist/types/spec/marks/Image.d.ts +0 -89
- package/dist/types/spec/marks/Line.d.ts +0 -82
- package/dist/types/spec/marks/Link.d.ts +0 -60
- package/dist/types/spec/marks/Marks.d.ts +0 -910
- package/dist/types/spec/marks/Raster.d.ts +0 -124
- package/dist/types/spec/marks/Rect.d.ts +0 -166
- package/dist/types/spec/marks/Regression.d.ts +0 -58
- package/dist/types/spec/marks/Rule.d.ts +0 -100
- package/dist/types/spec/marks/Text.d.ts +0 -110
- package/dist/types/spec/marks/Tick.d.ts +0 -61
- package/dist/types/spec/marks/Vector.d.ts +0 -99
- package/dist/types/spec/marks/Waffle.d.ts +0 -58
- package/dist/types/util.d.ts +0 -12
- package/jsconfig.json +0 -10
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @typedef {{
|
|
3
|
-
* attributes: Set<string>;
|
|
4
|
-
* interactors: Set<string>;
|
|
5
|
-
* legends: Set<string>;
|
|
6
|
-
* marks: Set<string>;
|
|
7
|
-
* }} PlotNames names for supported plot elements
|
|
8
|
-
*/
|
|
9
|
-
/**
|
|
10
|
-
* Parse a Mosaic specification to an AST (abstract syntax tree).
|
|
11
|
-
* @param {import('./spec/Spec.js').Spec} spec The input specification.
|
|
12
|
-
* @param {object} [options] Optional parse options object.
|
|
13
|
-
* @param {Map<string, Function>} [options.components] Map of component names to parse functions.
|
|
14
|
-
* @param {Set<string>} [options.transforms] The names of allowed transform functions.
|
|
15
|
-
* @param {Set<string>} [options.inputs] The names of supported input widgets.
|
|
16
|
-
* @param {PlotNames} [options.plot] The names of supported plot elements.
|
|
17
|
-
* @param {any[]} [options.params] An array of [name, node] pairs of pre-parsed
|
|
18
|
-
* Param or Selection AST nodes.
|
|
19
|
-
* @param {any[]} [options.datasets] An array of [name, node] pairs of pre-parsed
|
|
20
|
-
* dataset definition AST nodes.
|
|
21
|
-
* @returns {SpecNode} The top-level AST spec node.
|
|
22
|
-
*/
|
|
23
|
-
export function parseSpec(spec: import("./spec/Spec.js").Spec, options?: {
|
|
24
|
-
components?: Map<string, Function>;
|
|
25
|
-
transforms?: Set<string>;
|
|
26
|
-
inputs?: Set<string>;
|
|
27
|
-
plot?: PlotNames;
|
|
28
|
-
params?: any[];
|
|
29
|
-
datasets?: any[];
|
|
30
|
-
}): SpecNode;
|
|
31
|
-
export class ParseContext {
|
|
32
|
-
/**
|
|
33
|
-
* Create a new parser context.
|
|
34
|
-
* @param {object} [options]
|
|
35
|
-
* @param {Map<string, Function>} [options.components] Map of component names to parse functions.
|
|
36
|
-
* @param {Set<string>} [options.transforms] The names of allowed transform functions.
|
|
37
|
-
* @param {Set<string>} [options.inputs] The names of supported input widgets.
|
|
38
|
-
* @param {PlotNames} [options.plot] The names of supported plot elements.
|
|
39
|
-
* @param {any[]} [options.params] An array of [name, node] pairs of pre-parsed
|
|
40
|
-
* Param or Selection AST nodes.
|
|
41
|
-
* @param {any[]} [options.datasets] An array of [name, node] pairs of pre-parsed
|
|
42
|
-
* dataset definition AST nodes.
|
|
43
|
-
*/
|
|
44
|
-
constructor({ components, transforms, inputs, plot, params, datasets }?: {
|
|
45
|
-
components?: Map<string, Function>;
|
|
46
|
-
transforms?: Set<string>;
|
|
47
|
-
inputs?: Set<string>;
|
|
48
|
-
plot?: PlotNames;
|
|
49
|
-
params?: any[];
|
|
50
|
-
datasets?: any[];
|
|
51
|
-
});
|
|
52
|
-
components: Map<string, Function>;
|
|
53
|
-
transforms: Set<string>;
|
|
54
|
-
inputs: Set<string>;
|
|
55
|
-
plot: PlotNames;
|
|
56
|
-
params: Map<any, any>;
|
|
57
|
-
datasets: Map<any, any>;
|
|
58
|
-
parse(spec: any): SpecNode;
|
|
59
|
-
plotDefaults: import("./ast/PlotAttributeNode.js").PlotAttributeNode[];
|
|
60
|
-
parseComponent(spec: any): any;
|
|
61
|
-
/**
|
|
62
|
-
* Test if a value is a param reference, if so, generates a parameter
|
|
63
|
-
* definition as needed and returns a new ParamRefNode. Otherwise,
|
|
64
|
-
* returns a LiteralNode for the given value.
|
|
65
|
-
* @param {*} value The value to test.
|
|
66
|
-
* @returns {ParamRefNode|LiteralNode} An AST node for the input value.
|
|
67
|
-
*/
|
|
68
|
-
maybeParam(value: any): ParamRefNode | LiteralNode;
|
|
69
|
-
/**
|
|
70
|
-
* Test if a value is a param reference, if so, generates a selection
|
|
71
|
-
* definition as needed and returns a new ParamRefNode. Otherwise,
|
|
72
|
-
* returns a LiteralNode for the given value.
|
|
73
|
-
* @param {*} value The value to test.
|
|
74
|
-
* @returns {ParamRefNode|LiteralNode} An AST node for the input value.
|
|
75
|
-
*/
|
|
76
|
-
maybeSelection(value: any): ParamRefNode | LiteralNode;
|
|
77
|
-
/**
|
|
78
|
-
* Create a parameter reference. Generates a parameter definition if needed
|
|
79
|
-
* and returns a new ParamRefNode.
|
|
80
|
-
* @param {string} name The parameter name.
|
|
81
|
-
* @param {() => ParamNode | SelectionNode} [makeNode] A Param or Selection AST
|
|
82
|
-
* node constructor.
|
|
83
|
-
* @returns {ParamRefNode|null} A node referring to the param or selection.
|
|
84
|
-
*/
|
|
85
|
-
paramRef(name: string, makeNode?: () => ParamNode | SelectionNode): ParamRefNode | null;
|
|
86
|
-
/**
|
|
87
|
-
* Create a selection reference. Generates a selection definition if needed
|
|
88
|
-
* and returns a new ParamRefNode. Returns null if a non-selection parameter
|
|
89
|
-
* with the same name already exists and *strict* is true.
|
|
90
|
-
* @param {string} name The selection name.
|
|
91
|
-
* @param {boolean} [strict=false] Indicates if this method may return param
|
|
92
|
-
* references (false, default) or only selection references (true).
|
|
93
|
-
* @returns {ParamRefNode|null} A node referring to the param or selection.
|
|
94
|
-
*/
|
|
95
|
-
selectionRef(name: string, strict?: boolean): ParamRefNode | null;
|
|
96
|
-
error(message: any, data: any): void;
|
|
97
|
-
}
|
|
98
|
-
/**
|
|
99
|
-
* names for supported plot elements
|
|
100
|
-
*/
|
|
101
|
-
export type PlotNames = {
|
|
102
|
-
attributes: Set<string>;
|
|
103
|
-
interactors: Set<string>;
|
|
104
|
-
legends: Set<string>;
|
|
105
|
-
marks: Set<string>;
|
|
106
|
-
};
|
|
107
|
-
import { SpecNode } from './ast/SpecNode.js';
|
|
108
|
-
import { ParamRefNode } from './ast/ParamRefNode.js';
|
|
109
|
-
import { LiteralNode } from './ast/LiteralNode.js';
|
|
110
|
-
import { ParamNode } from './ast/ParamNode.js';
|
|
111
|
-
import { SelectionNode } from './ast/SelectionNode.js';
|
|
@@ -1,165 +0,0 @@
|
|
|
1
|
-
export interface DataBaseOptions {
|
|
2
|
-
/**
|
|
3
|
-
* A list of column names to extract upon load.
|
|
4
|
-
* Any other columns are omitted.
|
|
5
|
-
*/
|
|
6
|
-
select?: string[];
|
|
7
|
-
/**
|
|
8
|
-
* A filter (WHERE clause) to apply upon load.
|
|
9
|
-
* Only rows that pass the filted are included.
|
|
10
|
-
*/
|
|
11
|
-
where?: string | string[];
|
|
12
|
-
/**
|
|
13
|
-
* Flag (default `false`) to generate a view instead of a table.
|
|
14
|
-
*/
|
|
15
|
-
view?: boolean;
|
|
16
|
-
/**
|
|
17
|
-
* Flag (default `true`) to generate a temporary view or table.
|
|
18
|
-
*/
|
|
19
|
-
temp?: boolean;
|
|
20
|
-
/**
|
|
21
|
-
* Flag (default `true`) to replace an existing table of the same name.
|
|
22
|
-
* If `false`, creating a new table with an existing name raises an error.
|
|
23
|
-
*/
|
|
24
|
-
replace?: boolean;
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* A SQL query defining a new temporary database table.
|
|
28
|
-
*/
|
|
29
|
-
export type DataQuery = string;
|
|
30
|
-
/**
|
|
31
|
-
* An inline array of data objects to treat as JSON data.
|
|
32
|
-
*/
|
|
33
|
-
export type DataArray = object[];
|
|
34
|
-
/**
|
|
35
|
-
* A data definition that loads an external data file.
|
|
36
|
-
*/
|
|
37
|
-
export interface DataFile extends DataBaseOptions {
|
|
38
|
-
/**
|
|
39
|
-
* The data file to load. If no type option is provided,
|
|
40
|
-
* the file suffix must be one of `.csv`, `.json`, or `.parquet`.
|
|
41
|
-
*/
|
|
42
|
-
file: `${string}.parquet` | `${string}.csv` | `${string}.json`;
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* A data definition that queries an existing table.
|
|
46
|
-
*/
|
|
47
|
-
export interface DataTable extends DataBaseOptions {
|
|
48
|
-
/**
|
|
49
|
-
* The data source type. One of:
|
|
50
|
-
* - `"table"`: Define a new table based on a SQL query.
|
|
51
|
-
* - `"csv"`: Load a comma-separated values (CSV) file.
|
|
52
|
-
* - `"json"`: Load JavaScript Object Notation (json) data.
|
|
53
|
-
* - `"parquet"`: Load a Parquet file.
|
|
54
|
-
* - `"spatial"`: Load a spatial data file format via `ST_Read`.
|
|
55
|
-
*/
|
|
56
|
-
type: 'table';
|
|
57
|
-
/**
|
|
58
|
-
* A SQL query string for the desired table data.
|
|
59
|
-
*/
|
|
60
|
-
query: string;
|
|
61
|
-
}
|
|
62
|
-
/**
|
|
63
|
-
* A data definition that loads a parquet file.
|
|
64
|
-
*/
|
|
65
|
-
export interface DataParquet extends DataBaseOptions {
|
|
66
|
-
/**
|
|
67
|
-
* The data source type. One of:
|
|
68
|
-
* - `"table"`: Define a new table based on a SQL query.
|
|
69
|
-
* - `"csv"`: Load a comma-separated values (CSV) file.
|
|
70
|
-
* - `"json"`: Load JavaScript Object Notation (json) data.
|
|
71
|
-
* - `"parquet"`: Load a Parquet file.
|
|
72
|
-
* - `"spatial"`: Load a spatial data file format via `ST_Read`.
|
|
73
|
-
*/
|
|
74
|
-
type: 'parquet';
|
|
75
|
-
/**
|
|
76
|
-
* The file path for the dataset to load.
|
|
77
|
-
*/
|
|
78
|
-
file: string;
|
|
79
|
-
}
|
|
80
|
-
/**
|
|
81
|
-
* A data definition that loads a csv file.
|
|
82
|
-
*/
|
|
83
|
-
export interface DataCSV extends DataBaseOptions {
|
|
84
|
-
/**
|
|
85
|
-
* The data source type. One of:
|
|
86
|
-
* - `"table"`: Define a new table based on a SQL query.
|
|
87
|
-
* - `"csv"`: Load a comma-separated values (CSV) file.
|
|
88
|
-
* - `"json"`: Load JavaScript Object Notation (json) data.
|
|
89
|
-
* - `"parquet"`: Load a Parquet file.
|
|
90
|
-
* - `"spatial"`: Load a spatial data file format via `ST_Read`.
|
|
91
|
-
*/
|
|
92
|
-
type: 'csv';
|
|
93
|
-
/**
|
|
94
|
-
* The file path for the dataset to load.
|
|
95
|
-
*/
|
|
96
|
-
file: string;
|
|
97
|
-
/**
|
|
98
|
-
* The column delimiter string. If not specified, DuckDB will try to infer
|
|
99
|
-
* the delimiter automatically.
|
|
100
|
-
*/
|
|
101
|
-
delimiter?: string;
|
|
102
|
-
/**
|
|
103
|
-
* The sample size, in table rows, to consult for type inference.
|
|
104
|
-
* Set to `-1` to process all rows in the dataset.
|
|
105
|
-
*/
|
|
106
|
-
sample_size?: number;
|
|
107
|
-
}
|
|
108
|
-
/**
|
|
109
|
-
* A data definition that loads a supported spatial data file format.
|
|
110
|
-
*/
|
|
111
|
-
export interface DataSpatial extends DataBaseOptions {
|
|
112
|
-
/**
|
|
113
|
-
* The data source type. One of:
|
|
114
|
-
* - `"table"`: Define a new table based on a SQL query.
|
|
115
|
-
* - `"csv"`: Load a comma-separated values (CSV) file.
|
|
116
|
-
* - `"json"`: Load JavaScript Object Notation (json) data.
|
|
117
|
-
* - `"parquet"`: Load a Parquet file.
|
|
118
|
-
* - `"spatial"`: Load a spatial data file format via `ST_Read`.
|
|
119
|
-
*/
|
|
120
|
-
type: 'spatial';
|
|
121
|
-
/**
|
|
122
|
-
* The file path for the spatial dataset to load. See the [DuckDB spatial
|
|
123
|
-
* documention][1] for more information on supported file types.
|
|
124
|
-
*
|
|
125
|
-
* [1]: https://duckdb.org/docs/extensions/spatial.html#st_read--read-spatial-data-from-files
|
|
126
|
-
*/
|
|
127
|
-
file: string;
|
|
128
|
-
/**
|
|
129
|
-
* The named layer to load from the file. For example, in a TopoJSON file
|
|
130
|
-
* the layer is the named object to extract. For Excel spreadsheet files,
|
|
131
|
-
* the layer is the name of the worksheet to extract.
|
|
132
|
-
*/
|
|
133
|
-
layer?: string;
|
|
134
|
-
}
|
|
135
|
-
export interface DataJSON extends DataBaseOptions {
|
|
136
|
-
/**
|
|
137
|
-
* The data source type. One of:
|
|
138
|
-
* - `"table"`: Define a new table based on a SQL query.
|
|
139
|
-
* - `"csv"`: Load a comma-separated values (CSV) file.
|
|
140
|
-
* - `"json"`: Load JavaScript Object Notation (json) data.
|
|
141
|
-
* - `"parquet"`: Load a Parquet file.
|
|
142
|
-
* - `"spatial"`: Load a spatial data file format via `ST_Read`.
|
|
143
|
-
*/
|
|
144
|
-
type: 'json';
|
|
145
|
-
/**
|
|
146
|
-
* The file path for the dataset to load.
|
|
147
|
-
*/
|
|
148
|
-
file: string;
|
|
149
|
-
}
|
|
150
|
-
export interface DataJSONObjects extends DataBaseOptions {
|
|
151
|
-
/**
|
|
152
|
-
* The data source type. One of:
|
|
153
|
-
* - `"table"`: Define a new table based on a SQL query.
|
|
154
|
-
* - `"csv"`: Load a comma-separated values (CSV) file.
|
|
155
|
-
* - `"json"`: Load JavaScript Object Notation (json) data.
|
|
156
|
-
* - `"parquet"`: Load a Parquet file.
|
|
157
|
-
* - `"spatial"`: Load a spatial data file format via `ST_Read`.
|
|
158
|
-
*/
|
|
159
|
-
type?: 'json';
|
|
160
|
-
/**
|
|
161
|
-
* An array of inline objects in JSON-style format.
|
|
162
|
-
*/
|
|
163
|
-
data: object[];
|
|
164
|
-
}
|
|
165
|
-
export type DataDefinition = DataQuery | DataArray | DataFile | DataTable | DataParquet | DataCSV | DataSpatial | DataJSON | DataJSONObjects;
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
export type Expression = SQLExpression | AggregateExpression;
|
|
2
|
-
/** A custom SQL expression. */
|
|
3
|
-
export interface SQLExpression {
|
|
4
|
-
/**
|
|
5
|
-
* A SQL expression string to derive a new column value.
|
|
6
|
-
* Embedded Param refrences, such as `$param + 1`, are supported.
|
|
7
|
-
* For expressions with aggregate functions, use *agg* instead.
|
|
8
|
-
*/
|
|
9
|
-
sql: string;
|
|
10
|
-
/**
|
|
11
|
-
* A label for this expression, for example to label a plot axis.
|
|
12
|
-
*/
|
|
13
|
-
label?: string;
|
|
14
|
-
}
|
|
15
|
-
/** A custom SQL aggregate expression. */
|
|
16
|
-
export interface AggregateExpression {
|
|
17
|
-
/**
|
|
18
|
-
* A SQL expression string to calculate an aggregate value.
|
|
19
|
-
* Embedded Param references, such as `SUM($param + 1)`, are supported.
|
|
20
|
-
* For expressions without aggregate functions, use *sql* instead.
|
|
21
|
-
*/
|
|
22
|
-
agg: string;
|
|
23
|
-
/**
|
|
24
|
-
* A label for this expression, for example to label a plot axis.
|
|
25
|
-
*/
|
|
26
|
-
label?: string;
|
|
27
|
-
}
|
|
@@ -1,212 +0,0 @@
|
|
|
1
|
-
import { ParamRef } from './Param.js';
|
|
2
|
-
/** A menu input component. */
|
|
3
|
-
export interface Menu {
|
|
4
|
-
/**
|
|
5
|
-
* A menu input widget.
|
|
6
|
-
*/
|
|
7
|
-
input: 'menu';
|
|
8
|
-
/**
|
|
9
|
-
* The output selection. A selection clause is added for the
|
|
10
|
-
* currently selected menu option.
|
|
11
|
-
*/
|
|
12
|
-
as?: ParamRef;
|
|
13
|
-
/**
|
|
14
|
-
* The database column name to use within generated selection clause
|
|
15
|
-
* predicates. Defaults to the `column` property.
|
|
16
|
-
*/
|
|
17
|
-
field?: string;
|
|
18
|
-
/**
|
|
19
|
-
* The name of a database table to use as a data source for this widget.
|
|
20
|
-
* Used in conjunction with the `column` property.
|
|
21
|
-
*/
|
|
22
|
-
from?: string;
|
|
23
|
-
/**
|
|
24
|
-
* The name of a database column from which to pull menu options.
|
|
25
|
-
* The unique column values are used as menu options.
|
|
26
|
-
* Used in conjunction with the `from` property.
|
|
27
|
-
*/
|
|
28
|
-
column?: string;
|
|
29
|
-
/**
|
|
30
|
-
* A selection to filter the database table indicated by the `from` property.
|
|
31
|
-
*/
|
|
32
|
-
filterBy?: ParamRef;
|
|
33
|
-
/**
|
|
34
|
-
* A text label for this input.
|
|
35
|
-
*/
|
|
36
|
-
label?: string;
|
|
37
|
-
/**
|
|
38
|
-
* An array of menu options, as literal values or option objects.
|
|
39
|
-
* Option objects have a `value` property and an optional `label` property.
|
|
40
|
-
* If no label is provided, the string-coerced value is used.
|
|
41
|
-
*/
|
|
42
|
-
options?: Array<any | {
|
|
43
|
-
value: any;
|
|
44
|
-
label?: string;
|
|
45
|
-
}>;
|
|
46
|
-
/**
|
|
47
|
-
* The initial selected menu value.
|
|
48
|
-
*/
|
|
49
|
-
value?: any;
|
|
50
|
-
}
|
|
51
|
-
/** A search input component. */
|
|
52
|
-
export interface Search {
|
|
53
|
-
/**
|
|
54
|
-
* A text search input widget.
|
|
55
|
-
*/
|
|
56
|
-
input: 'search';
|
|
57
|
-
/**
|
|
58
|
-
* The output selection. A selection clause is added for the
|
|
59
|
-
* current text search query.
|
|
60
|
-
*/
|
|
61
|
-
as?: ParamRef;
|
|
62
|
-
/**
|
|
63
|
-
* The database column name to use within generated selection clause
|
|
64
|
-
* predicates. Defaults to the `column` property.
|
|
65
|
-
*/
|
|
66
|
-
field?: string;
|
|
67
|
-
/**
|
|
68
|
-
* The type of text search query to perform. One of:
|
|
69
|
-
* - `"contains"` (default): the query string may appear anywhere in the text
|
|
70
|
-
* - `"prefix"`: the query string must appear at the start of the text
|
|
71
|
-
* - `"suffix"`: the query string must appear at the end of the text
|
|
72
|
-
* - `"regexp"`: the query string is a regular expression the text must match
|
|
73
|
-
*/
|
|
74
|
-
type?: 'contains' | 'prefix' | 'suffix' | 'regexp';
|
|
75
|
-
/**
|
|
76
|
-
* The name of a database table to use as an autocomplete data source
|
|
77
|
-
* for this widget. Used in conjunction with the `column` property.
|
|
78
|
-
*/
|
|
79
|
-
from?: string;
|
|
80
|
-
/**
|
|
81
|
-
* The name of a database column from which to pull valid search results.
|
|
82
|
-
* The unique column values are used as search autocomplete values.
|
|
83
|
-
* Used in conjunction with the `from` property.
|
|
84
|
-
*/
|
|
85
|
-
column?: string;
|
|
86
|
-
/**
|
|
87
|
-
* A selection to filter the database table indicated by the `from` property.
|
|
88
|
-
*/
|
|
89
|
-
filterBy?: ParamRef;
|
|
90
|
-
/**
|
|
91
|
-
* A text label for this input.
|
|
92
|
-
*/
|
|
93
|
-
label?: string;
|
|
94
|
-
}
|
|
95
|
-
/** A slider input component. */
|
|
96
|
-
export interface Slider {
|
|
97
|
-
/**
|
|
98
|
-
* A slider input widget.
|
|
99
|
-
*/
|
|
100
|
-
input: 'slider';
|
|
101
|
-
/**
|
|
102
|
-
* The output selection. A selection clause is added for the
|
|
103
|
-
* currently selected slider option.
|
|
104
|
-
*/
|
|
105
|
-
as?: ParamRef;
|
|
106
|
-
/**
|
|
107
|
-
* The database column name to use within generated selection clause
|
|
108
|
-
* predicates. Defaults to the `column` property.
|
|
109
|
-
*/
|
|
110
|
-
field?: string;
|
|
111
|
-
/**
|
|
112
|
-
* The type of selection clause predicate to generate if the **as** option
|
|
113
|
-
* is a Selection. If `'point'` (the default), the selection predicate is an
|
|
114
|
-
* equality check for the slider value. If `'interval'`, the predicate checks
|
|
115
|
-
* an interval from the minimum to the current slider value.
|
|
116
|
-
*/
|
|
117
|
-
select?: 'point' | 'interval';
|
|
118
|
-
/**
|
|
119
|
-
* The name of a database table to use as a data source for this widget.
|
|
120
|
-
* Used in conjunction with the `column` property.
|
|
121
|
-
* The minimum and maximum values of the column determine the slider range.
|
|
122
|
-
*/
|
|
123
|
-
from?: string;
|
|
124
|
-
/**
|
|
125
|
-
* The name of a database column whose values determine the slider range.
|
|
126
|
-
* Used in conjunction with the `from` property.
|
|
127
|
-
* The minimum and maximum values of the column determine the slider range.
|
|
128
|
-
*/
|
|
129
|
-
column?: string;
|
|
130
|
-
/**
|
|
131
|
-
* A selection to filter the database table indicated by the `from` property.
|
|
132
|
-
*/
|
|
133
|
-
filterBy?: ParamRef;
|
|
134
|
-
/**
|
|
135
|
-
* The minumum slider value.
|
|
136
|
-
*/
|
|
137
|
-
min?: number;
|
|
138
|
-
/**
|
|
139
|
-
* The maximum slider value.
|
|
140
|
-
*/
|
|
141
|
-
max?: number;
|
|
142
|
-
/**
|
|
143
|
-
* The slider step, the amount to increment between consecutive values.
|
|
144
|
-
*/
|
|
145
|
-
step?: number;
|
|
146
|
-
/**
|
|
147
|
-
* A text label for this input.
|
|
148
|
-
*/
|
|
149
|
-
label?: string;
|
|
150
|
-
/**
|
|
151
|
-
* The initial slider value.
|
|
152
|
-
*/
|
|
153
|
-
value?: number;
|
|
154
|
-
/**
|
|
155
|
-
* The width of the slider in screen pixels.
|
|
156
|
-
*/
|
|
157
|
-
width?: number;
|
|
158
|
-
}
|
|
159
|
-
/** A table grid view component. */
|
|
160
|
-
export interface Table {
|
|
161
|
-
/**
|
|
162
|
-
* A table grid widget.
|
|
163
|
-
*/
|
|
164
|
-
input: 'table';
|
|
165
|
-
/**
|
|
166
|
-
* The output selection. A selection clause is added for each
|
|
167
|
-
* currently selected table row.
|
|
168
|
-
*/
|
|
169
|
-
as?: ParamRef;
|
|
170
|
-
/**
|
|
171
|
-
* The name of a database table to use as a data source for this widget.
|
|
172
|
-
*/
|
|
173
|
-
from: string | ParamRef;
|
|
174
|
-
/**
|
|
175
|
-
* A list of column names to include in the table grid.
|
|
176
|
-
* If unspecified, all table columns are included.
|
|
177
|
-
*/
|
|
178
|
-
columns?: string[];
|
|
179
|
-
/**
|
|
180
|
-
* A selection to filter the database table indicated by the `from` property.
|
|
181
|
-
*/
|
|
182
|
-
filterBy?: ParamRef;
|
|
183
|
-
/**
|
|
184
|
-
* An object of per-column alignment values.
|
|
185
|
-
* Column names should be object keys, which map to alignment values.
|
|
186
|
-
* Valid alignment values are: `"left"`, `"right"`, `"center"`, and `"justify"`.
|
|
187
|
-
* By default, numbers are right-aligned and other values are left-aligned.
|
|
188
|
-
*/
|
|
189
|
-
align?: {
|
|
190
|
-
[column: string]: 'left' | 'right' | 'center' | 'justify';
|
|
191
|
-
};
|
|
192
|
-
/**
|
|
193
|
-
* If a number, sets the total width of the table widget, in pixels.
|
|
194
|
-
* If an object, provides per-column pixel width values.
|
|
195
|
-
* Column names should be object keys, mapped to numeric width values.
|
|
196
|
-
*/
|
|
197
|
-
width?: number | {
|
|
198
|
-
[column: string]: number;
|
|
199
|
-
};
|
|
200
|
-
/**
|
|
201
|
-
* The maximum width of the table widget, in pixels.
|
|
202
|
-
*/
|
|
203
|
-
maxWidth?: number;
|
|
204
|
-
/**
|
|
205
|
-
* The height of the table widget, in pixels.
|
|
206
|
-
*/
|
|
207
|
-
height?: number;
|
|
208
|
-
/**
|
|
209
|
-
* The number of rows load in a new batch upon table scroll.
|
|
210
|
-
*/
|
|
211
|
-
rowBatch?: number;
|
|
212
|
-
}
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
export type ParamRef = `$${string}`;
|
|
2
|
-
/** Base properties shared by Param definitions. */
|
|
3
|
-
export interface ParamBase {
|
|
4
|
-
/**
|
|
5
|
-
* The type of reactive parameter. One of:
|
|
6
|
-
* - `"value"` (default) for a standard `Param`
|
|
7
|
-
* - `"intersect"` for a `Selection` that intersects clauses (logical "and")
|
|
8
|
-
* - `"union"` for a `Selection` that unions clauses (logical "or")
|
|
9
|
-
* - `"single"` for a `Selection` that retains a single clause only
|
|
10
|
-
* - `"crossfilter"` for a cross-filtered intersection `Selection`
|
|
11
|
-
*/
|
|
12
|
-
select?: 'value';
|
|
13
|
-
}
|
|
14
|
-
/** A Param definition. */
|
|
15
|
-
export interface Param extends ParamBase {
|
|
16
|
-
/**
|
|
17
|
-
* The initial parameter value.
|
|
18
|
-
*/
|
|
19
|
-
value: ParamValue;
|
|
20
|
-
}
|
|
21
|
-
/** A Date-valued Param definition. */
|
|
22
|
-
export interface ParamDate extends ParamBase {
|
|
23
|
-
/**
|
|
24
|
-
* The initial parameter value as an ISO date/time
|
|
25
|
-
* string to be parsed to a Date object.
|
|
26
|
-
*/
|
|
27
|
-
date: string;
|
|
28
|
-
}
|
|
29
|
-
/** Literal Param values. */
|
|
30
|
-
export type ParamLiteral = null | string | number | boolean;
|
|
31
|
-
/** Valid Param values. */
|
|
32
|
-
export type ParamValue = ParamLiteral | Array<ParamLiteral | ParamRef>;
|
|
33
|
-
/** A Selection definition. */
|
|
34
|
-
export interface Selection {
|
|
35
|
-
/**
|
|
36
|
-
* The type of reactive parameter. One of:
|
|
37
|
-
* - `"value"` (default) for a standard `Param`
|
|
38
|
-
* - `"intersect"` for a `Selection` that intersects clauses (logical "and")
|
|
39
|
-
* - `"union"` for a `Selection` that unions clauses (logical "or")
|
|
40
|
-
* - `"single"` for a `Selection` that retains a single clause only
|
|
41
|
-
* - `"crossfilter"` for a cross-filtered intersection `Selection`
|
|
42
|
-
*/
|
|
43
|
-
select: 'crossfilter' | 'intersect' | 'single' | 'union';
|
|
44
|
-
/**
|
|
45
|
-
* A flag for cross-filtering, where selections made in a plot filter others
|
|
46
|
-
* but not oneself (default `false`, except for `crossfilter` selections).
|
|
47
|
-
*/
|
|
48
|
-
cross?: boolean;
|
|
49
|
-
/**
|
|
50
|
-
* A flag for setting an initial empty selection state. If true, a selection
|
|
51
|
-
* with no clauses corresponds to an empty selection with no records. If
|
|
52
|
-
* false, a selection with no clauses selects all values.
|
|
53
|
-
*/
|
|
54
|
-
empty?: boolean;
|
|
55
|
-
/**
|
|
56
|
-
* Upstream selections whose clauses should be included as part of this
|
|
57
|
-
* selection. Any clauses or activations published to the upstream
|
|
58
|
-
* selections will be relayed to this selection.
|
|
59
|
-
*/
|
|
60
|
-
include?: ParamRef | ParamRef[];
|
|
61
|
-
}
|
|
62
|
-
/** A Param or Selection definition. */
|
|
63
|
-
export type ParamDefinition = ParamValue | Param | ParamDate | Selection;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { PlotAttributes } from './PlotAttribute.js';
|
|
2
|
-
import { PlotInteractor } from './PlotInteractor.js';
|
|
3
|
-
import { PlotLegend } from './PlotLegend.js';
|
|
4
|
-
import { PlotMark } from './PlotMark.js';
|
|
5
|
-
/** A plot component. */
|
|
6
|
-
export interface Plot extends PlotAttributes {
|
|
7
|
-
/**
|
|
8
|
-
* An array of plot marks, interactors, or legends.
|
|
9
|
-
* Marks are graphical elements that make up plot layers.
|
|
10
|
-
* Unless otherwise configured, interactors will use the nearest
|
|
11
|
-
* previous mark as a basis for which data fields to select.
|
|
12
|
-
*/
|
|
13
|
-
plot: (PlotMark | PlotInteractor | PlotLegend)[];
|
|
14
|
-
}
|