@malloydata/render 0.0.289 → 0.0.291
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/.storybook/malloy-stories-indexer.ts +21 -16
- package/API_MIGRATION.md +189 -0
- package/dist/api/malloy-renderer.d.ts +9 -0
- package/dist/api/malloy-viz.d.ts +19 -0
- package/dist/api/types.d.ts +12 -0
- package/dist/component/dashboard/dashboard.d.ts +1 -1
- package/dist/component/malloy-modal/malloy-modal.d.ts +0 -7
- package/dist/component/render-result-metadata.d.ts +4 -4
- package/dist/component/render.d.ts +5 -23
- package/dist/component/util.d.ts +13 -1
- package/dist/data_tree/cells/atomic.d.ts +75 -0
- package/dist/data_tree/cells/base.d.ts +41 -0
- package/dist/data_tree/cells/index.d.ts +14 -0
- package/dist/data_tree/cells/nest.d.ts +44 -0
- package/dist/data_tree/drilling.d.ts +11 -0
- package/dist/data_tree/fields/atomic.d.ts +67 -0
- package/dist/data_tree/fields/base.d.ts +65 -0
- package/dist/data_tree/fields/index.d.ts +17 -0
- package/dist/data_tree/fields/nest.d.ts +43 -0
- package/dist/data_tree/index.d.ts +11 -0
- package/dist/data_tree/plugins.d.ts +14 -0
- package/dist/data_tree/types.d.ts +68 -0
- package/dist/data_tree/utils.d.ts +19 -0
- package/dist/html/html_view.d.ts +1 -2
- package/dist/html/renderer_types.d.ts +1 -0
- package/dist/index.d.ts +4 -2
- package/dist/module/index.mjs +56960 -51018
- package/dist/module/index.umd.js +973 -402
- package/dist/render-field-metadata.d.ts +33 -0
- package/dist/stories/themes.stories.d.ts +0 -1
- package/dist/stories/vega-config-override.stories.d.ts +0 -1
- package/package.json +6 -18
- package/vite.config.base.ts +6 -0
- package/dist/bundle/main.d.ts +0 -6
- package/dist/bundle/renderer.d.ts +0 -1
- package/dist/component/copy-to-html.d.ts +0 -3
- package/dist/component/malloy-modal/malloy-modal-wc.d.ts +0 -5
- package/dist/component/register-webcomponent.d.ts +0 -15
- package/dist/component/render-webcomponent.d.ts +0 -1
- package/dist/data_tree.d.ts +0 -405
- package/dist/register/register.mjs +0 -162146
- package/dist/register/register.umd.js +0 -1921
- package/dist/register/style.css +0 -1
- package/dist/webcomponent/malloy-render.mjs +0 -162144
- package/dist/webcomponent/malloy-render.umd.js +0 -1921
- package/dist/webcomponent/style.css +0 -1
- package/vite.config.webcomponent-register.ts +0 -12
- package/vite.config.webcomponent.ts +0 -12
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import * as Malloy from '@malloydata/malloy-interfaces';
|
|
2
|
+
import type { Tag } from '@malloydata/malloy-tag';
|
|
3
|
+
import type { Field, NestField, RecordField, RecordOrRepeatedRecordField, BasicAtomicField, TimeField, RootField } from '.';
|
|
4
|
+
import { ArrayField, BooleanField, DateField, JSONField, NumberField, RepeatedRecordField, SQLNativeField, StringField, TimestampField } from '.';
|
|
5
|
+
import type { FieldRegistry } from '../types';
|
|
6
|
+
import type { RenderPluginInstance } from '../plugins';
|
|
7
|
+
export declare abstract class FieldBase {
|
|
8
|
+
readonly field: Malloy.DimensionInfo;
|
|
9
|
+
readonly parent: NestField | undefined;
|
|
10
|
+
readonly tag: Tag;
|
|
11
|
+
readonly path: string[];
|
|
12
|
+
protected readonly metadataTag: Tag;
|
|
13
|
+
readonly renderAs: string;
|
|
14
|
+
readonly valueSet: Set<string | number | boolean>;
|
|
15
|
+
private _pluginData;
|
|
16
|
+
protected registry?: FieldRegistry;
|
|
17
|
+
registerPluginData<T>(pluginType: string, data: T): void;
|
|
18
|
+
getPluginData<T>(pluginType: string): T | undefined;
|
|
19
|
+
getAllFieldInstances(): Field[];
|
|
20
|
+
getPlugins(): RenderPluginInstance[];
|
|
21
|
+
constructor(field: Malloy.DimensionInfo, parent: NestField | undefined, registry?: FieldRegistry);
|
|
22
|
+
isRoot(): boolean;
|
|
23
|
+
root(): RootField;
|
|
24
|
+
get drillPath(): string[];
|
|
25
|
+
get sourceName(): string;
|
|
26
|
+
get sourceArguments(): Malloy.ParameterValue[] | undefined;
|
|
27
|
+
get name(): string;
|
|
28
|
+
fieldAt(path: string[] | string): Field;
|
|
29
|
+
getParentRecord(levelsUp: number): RecordField;
|
|
30
|
+
get key(): string;
|
|
31
|
+
fieldAtPath(path: string[]): Field;
|
|
32
|
+
registerNullValue(): void;
|
|
33
|
+
get drillFilters(): string[];
|
|
34
|
+
getStableDrillFilter(filter: Tag): Malloy.Filter | undefined;
|
|
35
|
+
get stableDrillFilters(): Malloy.Filter[] | undefined;
|
|
36
|
+
get referenceId(): string | undefined;
|
|
37
|
+
private escapeIdentifier;
|
|
38
|
+
private identifierCode;
|
|
39
|
+
drillExpression(): string;
|
|
40
|
+
wasDimension(): boolean;
|
|
41
|
+
wasCalculation(): boolean;
|
|
42
|
+
isHidden(): boolean;
|
|
43
|
+
get minNumber(): number | undefined;
|
|
44
|
+
get maxNumber(): number | undefined;
|
|
45
|
+
get maxString(): string | undefined;
|
|
46
|
+
asField(): Field;
|
|
47
|
+
isArray(): this is ArrayField;
|
|
48
|
+
isRepeatedRecord(): this is RepeatedRecordField;
|
|
49
|
+
isRecord(): this is RecordField;
|
|
50
|
+
isNumber(): this is NumberField;
|
|
51
|
+
isBoolean(): this is BooleanField;
|
|
52
|
+
isString(): this is StringField;
|
|
53
|
+
isRecordOrRepeatedRecord(): this is RecordOrRepeatedRecordField;
|
|
54
|
+
isDate(): this is DateField;
|
|
55
|
+
isTimestamp(): this is TimestampField;
|
|
56
|
+
isTime(): this is TimeField;
|
|
57
|
+
isSQLNative(): this is SQLNativeField;
|
|
58
|
+
isJSON(): this is JSONField;
|
|
59
|
+
isBasic(): this is BasicAtomicField;
|
|
60
|
+
isNest(): this is NestField;
|
|
61
|
+
getLocationInParent(): any;
|
|
62
|
+
isLastChild(): any;
|
|
63
|
+
isFirstChild(): any;
|
|
64
|
+
pathTo(childField: Field): string;
|
|
65
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type * as Malloy from '@malloydata/malloy-interfaces';
|
|
2
|
+
import { BooleanField, DateField, JSONField, NumberField, SQLNativeField, StringField, TimestampField } from './atomic';
|
|
3
|
+
import { ArrayField, RecordField, RepeatedRecordField } from './nest';
|
|
4
|
+
import type { FieldRegistry } from '../types';
|
|
5
|
+
export { ArrayField, RecordField, RepeatedRecordField, RootField } from './nest';
|
|
6
|
+
export { BooleanField, DateField, JSONField, NumberField, SQLNativeField, StringField, TimestampField, } from './atomic';
|
|
7
|
+
export type Field = ArrayField | RepeatedRecordField | RecordField | NumberField | DateField | JSONField | StringField | TimestampField | BooleanField | SQLNativeField;
|
|
8
|
+
export type NestField = RepeatedRecordField | RecordField | ArrayField;
|
|
9
|
+
export type RecordOrRepeatedRecordField = RepeatedRecordField | RecordField;
|
|
10
|
+
export type BasicAtomicField = NumberField | DateField | JSONField | StringField | TimestampField | BooleanField | SQLNativeField;
|
|
11
|
+
export type TimeField = DateField | TimestampField;
|
|
12
|
+
export declare const Field: {
|
|
13
|
+
from(field: Malloy.DimensionInfo, parent: NestField | undefined, registry?: FieldRegistry): Field;
|
|
14
|
+
isNestField(field: Field): field is NestField;
|
|
15
|
+
pathFromString(path: string): any;
|
|
16
|
+
pathToString(path: string): string;
|
|
17
|
+
};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { Tag } from '@malloydata/malloy-tag';
|
|
2
|
+
import { FieldBase } from './base';
|
|
3
|
+
import { Field } from '.';
|
|
4
|
+
import type { ArrayFieldInfo, FieldRegistry, RecordFieldInfo, RepeatedRecordFieldInfo, SortableField } from '../types';
|
|
5
|
+
import type { NestField } from '.';
|
|
6
|
+
export declare class ArrayField extends FieldBase {
|
|
7
|
+
readonly field: ArrayFieldInfo;
|
|
8
|
+
readonly fields: Field[];
|
|
9
|
+
readonly maxUniqueFieldValueCounts: Map<string, number>;
|
|
10
|
+
readonly eachField: Field;
|
|
11
|
+
constructor(field: ArrayFieldInfo, parent: NestField | undefined, registry?: FieldRegistry);
|
|
12
|
+
get isDrillable(): boolean;
|
|
13
|
+
}
|
|
14
|
+
export declare class RepeatedRecordField extends ArrayField {
|
|
15
|
+
readonly field: RepeatedRecordFieldInfo;
|
|
16
|
+
readonly fields: Field[];
|
|
17
|
+
maxRecordCount: number;
|
|
18
|
+
constructor(field: RepeatedRecordFieldInfo, parent: NestField | undefined, registry?: FieldRegistry);
|
|
19
|
+
fieldAtPath(path: string[]): Field;
|
|
20
|
+
registerRecordCount(count: number): void;
|
|
21
|
+
registerValueSetSize(fieldName: string, size: number): void;
|
|
22
|
+
private _fieldsWithOrder;
|
|
23
|
+
get fieldsWithOrder(): SortableField[];
|
|
24
|
+
}
|
|
25
|
+
export declare class RootField extends RepeatedRecordField {
|
|
26
|
+
readonly field: RepeatedRecordFieldInfo;
|
|
27
|
+
readonly modelTag: Tag;
|
|
28
|
+
readonly queryTimezone: string | undefined;
|
|
29
|
+
constructor(field: RepeatedRecordFieldInfo, metadata: {
|
|
30
|
+
modelTag: Tag;
|
|
31
|
+
queryTimezone: string | undefined;
|
|
32
|
+
}, registry?: FieldRegistry);
|
|
33
|
+
}
|
|
34
|
+
export declare class RecordField extends FieldBase {
|
|
35
|
+
readonly field: RecordFieldInfo;
|
|
36
|
+
readonly fields: Field[];
|
|
37
|
+
readonly fieldsByName: Record<string, Field>;
|
|
38
|
+
readonly maxUniqueFieldValueCounts: Map<string, number>;
|
|
39
|
+
constructor(field: RecordFieldInfo, parent: NestField | undefined, registry?: FieldRegistry);
|
|
40
|
+
fieldAtPath(path: string[]): Field;
|
|
41
|
+
private _fieldsWithOrder;
|
|
42
|
+
get fieldsWithOrder(): SortableField[];
|
|
43
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type * as Malloy from '@malloydata/malloy-interfaces';
|
|
2
|
+
import { RootCell } from './cells';
|
|
3
|
+
import type { RenderPlugin } from './plugins';
|
|
4
|
+
export declare function getDataTree(result: Malloy.Result, plugins?: RenderPlugin[]): RootCell;
|
|
5
|
+
export * from './cells/base';
|
|
6
|
+
export * from './types';
|
|
7
|
+
export * from './plugins';
|
|
8
|
+
export * from './fields';
|
|
9
|
+
export * from './cells';
|
|
10
|
+
export * from './utils';
|
|
11
|
+
export * from './drilling';
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Tag } from '@malloydata/malloy-tag';
|
|
2
|
+
import type { Field, NestField } from './fields';
|
|
3
|
+
import type { NestCell } from './cells';
|
|
4
|
+
import type { FieldType } from './types';
|
|
5
|
+
export type RenderPluginInstance = {
|
|
6
|
+
name: string;
|
|
7
|
+
processData(field: NestField, cell: NestCell): void;
|
|
8
|
+
};
|
|
9
|
+
export type RenderPlugin<T extends RenderPluginInstance = RenderPluginInstance> = {
|
|
10
|
+
name: string;
|
|
11
|
+
matches: (fieldTag: Tag, fieldType: FieldType) => boolean;
|
|
12
|
+
plugin: RenderPluginFactory<T>;
|
|
13
|
+
};
|
|
14
|
+
export type RenderPluginFactory<T extends RenderPluginInstance> = (field: Field) => T;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import type * as Malloy from '@malloydata/malloy-interfaces';
|
|
2
|
+
import type { Field } from './fields';
|
|
3
|
+
import type { RenderPluginInstance } from './plugins';
|
|
4
|
+
import type { Cell } from './cells';
|
|
5
|
+
export type DrillEntry = {
|
|
6
|
+
field: Field;
|
|
7
|
+
value: string | number | boolean | Date | null;
|
|
8
|
+
} | {
|
|
9
|
+
where: string;
|
|
10
|
+
};
|
|
11
|
+
export type DrillValue = {
|
|
12
|
+
field: Field;
|
|
13
|
+
value: Cell;
|
|
14
|
+
} | {
|
|
15
|
+
where: string;
|
|
16
|
+
};
|
|
17
|
+
export interface FieldRegistry {
|
|
18
|
+
fieldInstances: Map<string, Field[]>;
|
|
19
|
+
plugins: Map<string, RenderPluginInstance[]>;
|
|
20
|
+
}
|
|
21
|
+
export type SortableField = {
|
|
22
|
+
field: Field;
|
|
23
|
+
dir: 'asc' | 'desc' | undefined;
|
|
24
|
+
};
|
|
25
|
+
export type ArrayFieldInfo = Malloy.DimensionInfo & {
|
|
26
|
+
type: Malloy.AtomicTypeWithArrayType;
|
|
27
|
+
};
|
|
28
|
+
export type RepeatedRecordFieldInfo = Malloy.DimensionInfo & {
|
|
29
|
+
type: Malloy.AtomicTypeWithArrayType & {
|
|
30
|
+
element_type: Malloy.AtomicTypeWithRecordType;
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
export type RecordFieldInfo = Malloy.DimensionInfo & {
|
|
34
|
+
type: Malloy.AtomicTypeWithRecordType;
|
|
35
|
+
};
|
|
36
|
+
export type NumberFieldInfo = Malloy.DimensionInfo & {
|
|
37
|
+
type: Malloy.AtomicTypeWithNumberType;
|
|
38
|
+
};
|
|
39
|
+
export type DateFieldInfo = Malloy.DimensionInfo & {
|
|
40
|
+
type: Malloy.AtomicTypeWithDateType;
|
|
41
|
+
};
|
|
42
|
+
export type JSONFieldInfo = Malloy.DimensionInfo & {
|
|
43
|
+
type: Malloy.AtomicTypeWithJSONType;
|
|
44
|
+
};
|
|
45
|
+
export type StringFieldInfo = Malloy.DimensionInfo & {
|
|
46
|
+
type: Malloy.AtomicTypeWithStringType;
|
|
47
|
+
};
|
|
48
|
+
export type TimestampFieldInfo = Malloy.DimensionInfo & {
|
|
49
|
+
type: Malloy.AtomicTypeWithTimestampType;
|
|
50
|
+
};
|
|
51
|
+
export type BooleanFieldInfo = Malloy.DimensionInfo & {
|
|
52
|
+
type: Malloy.AtomicTypeWithBooleanType;
|
|
53
|
+
};
|
|
54
|
+
export type SQLNativeFieldInfo = Malloy.DimensionInfo & {
|
|
55
|
+
type: Malloy.AtomicTypeWithSQLNativeType;
|
|
56
|
+
};
|
|
57
|
+
export declare enum FieldType {
|
|
58
|
+
Array = "array",
|
|
59
|
+
RepeatedRecord = "repeated_record",
|
|
60
|
+
Record = "record",
|
|
61
|
+
Number = "number",
|
|
62
|
+
Date = "date",
|
|
63
|
+
JSON = "json",
|
|
64
|
+
String = "string",
|
|
65
|
+
Timestamp = "timestamp",
|
|
66
|
+
Boolean = "boolean",
|
|
67
|
+
SQLNative = "sql_native"
|
|
68
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { Tag } from '@malloydata/malloy-tag';
|
|
2
|
+
import type * as Malloy from '@malloydata/malloy-interfaces';
|
|
3
|
+
import type { BooleanFieldInfo, DateFieldInfo, JSONFieldInfo, NumberFieldInfo, RecordFieldInfo, RepeatedRecordFieldInfo, ArrayFieldInfo, SQLNativeFieldInfo, StringFieldInfo, TimestampFieldInfo } from './types';
|
|
4
|
+
import { FieldType } from './types';
|
|
5
|
+
import { type Field } from './fields';
|
|
6
|
+
export declare function isArrayFieldInfo(field: Malloy.DimensionInfo): field is ArrayFieldInfo;
|
|
7
|
+
export declare function isRepeatedRecordFieldInfo(field: Malloy.DimensionInfo): field is RepeatedRecordFieldInfo;
|
|
8
|
+
export declare function isRecordFieldInfo(field: Malloy.DimensionInfo): field is RecordFieldInfo;
|
|
9
|
+
export declare function isNumberFieldInfo(field: Malloy.DimensionInfo): field is NumberFieldInfo;
|
|
10
|
+
export declare function isDateFieldInfo(field: Malloy.DimensionInfo): field is DateFieldInfo;
|
|
11
|
+
export declare function isJSONFieldInfo(field: Malloy.DimensionInfo): field is JSONFieldInfo;
|
|
12
|
+
export declare function isStringFieldInfo(field: Malloy.DimensionInfo): field is StringFieldInfo;
|
|
13
|
+
export declare function isTimestampFieldInfo(field: Malloy.DimensionInfo): field is TimestampFieldInfo;
|
|
14
|
+
export declare function isBooleanFieldInfo(field: Malloy.DimensionInfo): field is BooleanFieldInfo;
|
|
15
|
+
export declare function isSQLNativeFieldInfo(field: Malloy.DimensionInfo): field is SQLNativeFieldInfo;
|
|
16
|
+
export declare function shouldRenderAs(field: Malloy.DimensionInfo, parent: Field | undefined, tagOverride?: Tag): string;
|
|
17
|
+
export declare function tagFor(field: Malloy.DimensionInfo, prefix?: string): Tag;
|
|
18
|
+
export declare function extractLiteralFromTag(value: Tag | undefined): Malloy.LiteralValue | undefined;
|
|
19
|
+
export declare function getFieldType(field: Field): FieldType;
|
package/dist/html/html_view.d.ts
CHANGED
|
@@ -4,11 +4,10 @@ import type { Renderer } from './renderer';
|
|
|
4
4
|
import type { RendererOptions } from './renderer_types';
|
|
5
5
|
import type * as Malloy from '@malloydata/malloy-interfaces';
|
|
6
6
|
import type { Cell, Field } from '../data_tree';
|
|
7
|
-
import { Result } from '@malloydata/malloy';
|
|
8
7
|
export declare class HTMLView {
|
|
9
8
|
private document;
|
|
10
9
|
constructor(document: Document);
|
|
11
|
-
render(
|
|
10
|
+
render(malloyResult: Malloy.Result, options: RendererOptions): Promise<HTMLElement>;
|
|
12
11
|
}
|
|
13
12
|
export declare class JSONView {
|
|
14
13
|
private document;
|
|
@@ -7,5 +7,6 @@ export interface RendererOptions {
|
|
|
7
7
|
titleCase?: boolean;
|
|
8
8
|
queryTimezone?: string;
|
|
9
9
|
nextRendererOptions?: Partial<MalloyRenderProps>;
|
|
10
|
+
useLegacy?: boolean;
|
|
10
11
|
}
|
|
11
12
|
export type DrillFunction = (drillQuery: string, target: HTMLElement, drillFilters: string[]) => void;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
export { HTMLView, JSONView } from './html/html_view';
|
|
2
2
|
export * from './html/data_styles';
|
|
3
3
|
export type { MalloyRenderProps } from './component/render';
|
|
4
|
-
export {
|
|
5
|
-
export {
|
|
4
|
+
export { MalloyRenderer } from '@/api/malloy-renderer';
|
|
5
|
+
export type { MalloyViz } from '@/api/malloy-viz';
|
|
6
|
+
export type { MalloyRendererOptions, RenderFieldMetadata } from '@/api/types';
|
|
7
|
+
export type { DrillData, MalloyClickEventPayload, TableConfig, DashboardConfig, VegaConfigHandler, } from '@/component/types';
|