@object-ui/plugin-dashboard 17.3.0 → 17.6.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/CHANGELOG.md +1445 -0
- package/README.md +199 -33
- package/dist/DashboardConfigPanel.d.ts +3 -0
- package/dist/DashboardConfigPanel.d.ts.map +1 -1
- package/dist/DashboardFilterBar.d.ts.map +1 -1
- package/dist/DashboardGridLayout.d.ts +27 -0
- package/dist/DashboardGridLayout.d.ts.map +1 -1
- package/dist/DashboardRenderer.d.ts +46 -4
- package/dist/DashboardRenderer.d.ts.map +1 -1
- package/dist/DashboardWithConfig.d.ts.map +1 -1
- package/dist/DatasetWidget.d.ts +70 -6
- package/dist/DatasetWidget.d.ts.map +1 -1
- package/dist/MetricCard.d.ts +29 -10
- package/dist/MetricCard.d.ts.map +1 -1
- package/dist/MetricWidget.d.ts +82 -17
- package/dist/MetricWidget.d.ts.map +1 -1
- package/dist/ObjectDataTable.d.ts +68 -3
- package/dist/ObjectDataTable.d.ts.map +1 -1
- package/dist/ObjectMetricWidget.d.ts +41 -27
- package/dist/ObjectMetricWidget.d.ts.map +1 -1
- package/dist/ObjectPivotTable.d.ts.map +1 -1
- package/dist/PivotTable.d.ts.map +1 -1
- package/dist/RecordDetailDrawer.d.ts.map +1 -1
- package/dist/WidgetConfigPanel.d.ts +28 -0
- package/dist/WidgetConfigPanel.d.ts.map +1 -1
- package/dist/colorVariants.d.ts +56 -0
- package/dist/colorVariants.d.ts.map +1 -0
- package/dist/domPassthroughPins.d.ts +9 -0
- package/dist/domPassthroughPins.d.ts.map +1 -0
- package/dist/index.d.ts +16 -11
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2087 -1564
- package/dist/index.umd.cjs +2 -2
- package/dist/legacyRetiredWidget.d.ts +41 -0
- package/dist/legacyRetiredWidget.d.ts.map +1 -0
- package/dist/recordFields.d.ts +41 -2
- package/dist/recordFields.d.ts.map +1 -1
- package/dist/schemaHostProps.d.ts +80 -0
- package/dist/schemaHostProps.d.ts.map +1 -0
- package/dist/useConfigPanelTranslation.d.ts +35 -0
- package/dist/useConfigPanelTranslation.d.ts.map +1 -0
- package/dist/utils.d.ts +34 -0
- package/dist/utils.d.ts.map +1 -1
- package/package.json +14 -12
package/dist/MetricWidget.d.ts
CHANGED
|
@@ -1,25 +1,74 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
2
|
+
import { I18nLabel } from '@object-ui/types';
|
|
3
|
+
import { MetricColorVariant } from './colorVariants';
|
|
4
|
+
import { SchemaHostProps } from './schemaHostProps';
|
|
5
|
+
/**
|
|
6
|
+
* The variant vocabulary and its two class tables now live in
|
|
7
|
+
* `./colorVariants` — the dataset-bound KPI (`DatasetWidget`, objectui#3359)
|
|
8
|
+
* paints the SAME accents, and two copies of a palette is how a
|
|
9
|
+
* declared-but-unenforced key becomes two disagreeing declarations. Re-exported
|
|
10
|
+
* here because this module was the type's original home.
|
|
11
|
+
*/
|
|
12
|
+
export type { MetricColorVariant };
|
|
13
|
+
/**
|
|
14
|
+
* DOM PASS-THROUGH (objectui#4426). `MetricWidget` ends its prop list with a
|
|
15
|
+
* `...domProps` spread onto the Shadcn `Card` — a `div` — so `id`, `role`,
|
|
16
|
+
* `aria-*`, `data-*`, `tabIndex`, `title` and the DOM event handlers reach the
|
|
17
|
+
* element. objectui#4357 (PR #4428) deliberately KEPT that spread: it is the
|
|
18
|
+
* component's only accessibility passthrough, and removing it would delete the
|
|
19
|
+
* only way a host can put an `id` or an `aria-label` on a KPI card.
|
|
20
|
+
*
|
|
21
|
+
* Until now the type refused what the runtime accepted. A TypeScript consumer
|
|
22
|
+
* importing the component directly could not write `<MetricWidget id="revenue"
|
|
23
|
+
* role="region" aria-label="Revenue KPI" … />` without a cast, while a JS
|
|
24
|
+
* consumer and every SDUI author going through `SchemaRenderer` (untyped at
|
|
25
|
+
* that boundary) got the passthrough for free. This `extends` is that
|
|
26
|
+
* declaration — the mirror image of #4357, closing the same question from the
|
|
27
|
+
* other side: renderer metadata was reaching the DOM because the spread is
|
|
28
|
+
* open; DOM attributes were unreachable because the type was closed.
|
|
29
|
+
*
|
|
30
|
+
* Measured convention, not an invented spelling: an exported `*Props` interface
|
|
31
|
+
* that spreads onto a host element extends `React.HTMLAttributes<HTMLDivElement>`
|
|
32
|
+
* here — `PageHeaderComponentProps` (whose own doc says "it extends
|
|
33
|
+
* `HTMLAttributes` so every DOM prop rides along"), `ChatbotProps`,
|
|
34
|
+
* `ChatbotEnhancedProps`, `TypingIndicatorProps`, `RefreshIndicatorProps`,
|
|
35
|
+
* `FieldProps`, and shadcn's own `BadgeProps`.
|
|
36
|
+
*
|
|
37
|
+
* What this does NOT declare, deliberately: the schema-shaped keys
|
|
38
|
+
* `SchemaRenderer` injects (`schema` / `bind` / `events` / `props` /
|
|
39
|
+
* `ariaLabel` / `ariaDescribedBy` / `dataSource`). None of them is an HTML
|
|
40
|
+
* attribute name, all seven are destructured out and never reach the DOM, and
|
|
41
|
+
* declaring them here would re-assert as a public contract exactly what #4357
|
|
42
|
+
* stripped. They stay in `SchemaHostProps`, intersected in at the component's
|
|
43
|
+
* own signature — the renderer's private door, not the consumer's front door.
|
|
44
|
+
* The narrower `FieldWidgetDomProps` shape (objectui#3221) is the other spelling
|
|
45
|
+
* in this repo, but it exists to be bound key-by-key to a runtime whitelist
|
|
46
|
+
* (`toDomProps`) in both directions; this component has no such whitelist, and
|
|
47
|
+
* inventing a half of one here would declare a set the spread does not enforce.
|
|
48
|
+
* Whether plugin widgets should get that whitelist is objectui#4425.
|
|
49
|
+
*/
|
|
50
|
+
export interface MetricWidgetProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
51
|
+
/**
|
|
52
|
+
* The KPI's heading, in @objectstack/spec's `I18nLabel` vocabulary — a plain
|
|
53
|
+
* string or an inline per-locale map (`{ en: 'Revenue', 'zh-CN': '收入' }`).
|
|
54
|
+
*
|
|
55
|
+
* Was `string | { key?, defaultValue? }` — the key-reference form
|
|
56
|
+
* objectstack#5055 RETIRED. It is not accepted here any more because the spec
|
|
57
|
+
* rejects it at authoring time, and because reading it was never the point:
|
|
58
|
+
* the private resolver behind it ended `defaultValue || key` and never
|
|
59
|
+
* consulted a bundle, so the escape hatch was declared and inert
|
|
60
|
+
* (objectui#4032).
|
|
61
|
+
*/
|
|
62
|
+
label: string | I18nLabel;
|
|
8
63
|
value: string | number;
|
|
9
64
|
trend?: {
|
|
10
65
|
value: number;
|
|
11
|
-
label?: string |
|
|
12
|
-
key?: string;
|
|
13
|
-
defaultValue?: string;
|
|
14
|
-
};
|
|
66
|
+
label?: string | I18nLabel;
|
|
15
67
|
direction?: 'up' | 'down' | 'neutral';
|
|
16
68
|
};
|
|
17
69
|
icon?: React.ReactNode | string;
|
|
18
70
|
className?: string;
|
|
19
|
-
description?: string |
|
|
20
|
-
key?: string;
|
|
21
|
-
defaultValue?: string;
|
|
22
|
-
};
|
|
71
|
+
description?: string | I18nLabel;
|
|
23
72
|
/** When true, the widget is in a loading state (fetching data from server). */
|
|
24
73
|
loading?: boolean;
|
|
25
74
|
/** Error message from a failed data fetch. When set, the widget shows an error state. */
|
|
@@ -30,11 +79,27 @@ export interface MetricWidgetProps {
|
|
|
30
79
|
format?: string;
|
|
31
80
|
/** ISO currency code (e.g. `'USD'`); enables currency formatting on numeric values. */
|
|
32
81
|
currency?: string;
|
|
33
|
-
/**
|
|
82
|
+
/**
|
|
83
|
+
* Static prefix appended in front of the formatted value (e.g. `'$'`, `'¥'`).
|
|
84
|
+
*
|
|
85
|
+
* Same name, same `string` type as the inherited RDFa `prefix` attribute, and
|
|
86
|
+
* this declaration wins: the component reads it and destructures it out, so
|
|
87
|
+
* it never reaches the DOM. That is the accurate contract — it was already
|
|
88
|
+
* true before this interface declared its passthrough.
|
|
89
|
+
*/
|
|
34
90
|
prefix?: string;
|
|
35
91
|
/** Static suffix appended after the formatted value (e.g. `' /mo'`). */
|
|
36
92
|
suffix?: string;
|
|
37
|
-
/**
|
|
93
|
+
/**
|
|
94
|
+
* When set, the entire card becomes clickable and emits this handler.
|
|
95
|
+
*
|
|
96
|
+
* Deliberately NARROWER than the inherited `MouseEventHandler<HTMLDivElement>`:
|
|
97
|
+
* the KPI card treats a click as "the tile was activated" and wires the same
|
|
98
|
+
* handler to Enter/Space, where there is no mouse event to hand over. A
|
|
99
|
+
* zero-arg function is assignable to the inherited signature, so consumers
|
|
100
|
+
* already passing `(e) => …` keep compiling; this only stops the component
|
|
101
|
+
* from promising an event object its keyboard path cannot produce.
|
|
102
|
+
*/
|
|
38
103
|
onClick?: () => void;
|
|
39
104
|
/**
|
|
40
105
|
* Layout variant. `'card'` (default) is the bordered KPI card; `'bare'` drops
|
|
@@ -43,5 +108,5 @@ export interface MetricWidgetProps {
|
|
|
43
108
|
*/
|
|
44
109
|
variant?: 'card' | 'bare';
|
|
45
110
|
}
|
|
46
|
-
export declare const MetricWidget: ({ label, value, trend, icon, className, description, loading, error, colorVariant, format, currency, prefix, suffix, onClick, variant,
|
|
111
|
+
export declare const MetricWidget: ({ label, value, trend, icon, className, description, loading, error, colorVariant, format, currency, prefix, suffix, onClick, variant, schema: _schema, bind: _bind, events: _events, props: _propsBag, ariaLabel: _ariaLabel, ariaDescribedBy: _ariaDescribedBy, dataSource: _dataSource, ...domProps }: MetricWidgetProps & SchemaHostProps) => React.JSX.Element;
|
|
47
112
|
//# sourceMappingURL=MetricWidget.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MetricWidget.d.ts","sourceRoot":"","sources":["../src/MetricWidget.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAkB,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"MetricWidget.d.ts","sourceRoot":"","sources":["../src/MetricWidget.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAkB,MAAM,OAAO,CAAC;AAWvC,OAAO,KAAK,EAA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,MAAM,GAAG,MAAM,CAAC;CAC3B;AAED,eAAO,MAAM,YAAY,GAAI,0SA6B1B,iBAAiB,GAAG,eAAe,sBA6IrC,CAAC"}
|
|
@@ -30,7 +30,40 @@ interface NormalizedColumn {
|
|
|
30
30
|
*
|
|
31
31
|
* - `string[]` entries are converted to `{ header, accessorKey }` objects,
|
|
32
32
|
* handling both snake_case and camelCase for header generation.
|
|
33
|
-
* - Object entries
|
|
33
|
+
* - Object entries have their field identity AND their display text RESOLVED
|
|
34
|
+
* here, at the producer, and stamped onto the data-table adapter's own keys
|
|
35
|
+
* (`accessorKey` / `header`). The adapter reads only those two, and no longer
|
|
36
|
+
* falls back to `name` / `label` (objectui#5120, objectui#5351).
|
|
37
|
+
*
|
|
38
|
+
* Object entries used to be returned raw (objectui#5120). `accessorKey` is the
|
|
39
|
+
* table LIBRARY's column key — `column-identity.ts` names it
|
|
40
|
+
* `TABLE_ADAPTER_COLUMN_KEY` and deliberately holds the metadata-identity fold
|
|
41
|
+
* away from it — so a column authored in the spec-canonical spelling
|
|
42
|
+
* (`{ field: 'stage' }`) reached the adapter carrying no `accessorKey` at all
|
|
43
|
+
* and rendered a header over `row[undefined]`: blank cells, no warning. The
|
|
44
|
+
* `$expand` whitelist in `computeLookupExpand` missed it for the same reason,
|
|
45
|
+
* so a `field`-spelled lookup column also lost its related record.
|
|
46
|
+
*
|
|
47
|
+
* Resolving it HERE is the move objectui#5022 made in `RelatedList` and
|
|
48
|
+
* objectui#5068 generalized in `ObjectGrid`: metadata vocabulary in, adapter
|
|
49
|
+
* vocabulary out, one translation in one place. The adapter stays monolingual;
|
|
50
|
+
* the producer owns the translation.
|
|
51
|
+
*
|
|
52
|
+
* Mirror, don't move — the same three rules `RelatedList` states:
|
|
53
|
+
* - an author-supplied `accessorKey` is NEVER overwritten; a deliberate
|
|
54
|
+
* divergence between the table slot and the metadata key belongs to the
|
|
55
|
+
* author;
|
|
56
|
+
* - the authored spelling is left in place, so a host reading `field` / `name`
|
|
57
|
+
* back off these columns keeps working;
|
|
58
|
+
* - an entry with neither a resolvable identity nor any display text is
|
|
59
|
+
* returned UNTOUCHED — nothing is invented for it. It behaves exactly as it
|
|
60
|
+
* does today: a header over empty cells, silently. Whether that silence
|
|
61
|
+
* deserves a dev-time diagnostic is objectui#5349's question, and is
|
|
62
|
+
* deliberately NOT answered here.
|
|
63
|
+
*
|
|
64
|
+
* Returning the INPUT entry by reference when there is nothing to add is load
|
|
65
|
+
* bearing: data-table re-seeds its column state whenever the list is a new
|
|
66
|
+
* object (objectui#4618), and this widget rebuilds its node on every render.
|
|
34
67
|
*/
|
|
35
68
|
export declare function normalizeColumns(columns: (string | Record<string, any>)[]): NormalizedColumn[];
|
|
36
69
|
/**
|
|
@@ -52,9 +85,41 @@ export declare function normalizeColumns(columns: (string | Record<string, any>)
|
|
|
52
85
|
/**
|
|
53
86
|
* Compute the list of lookup-typed accessors that should be expanded when
|
|
54
87
|
* fetching rows. Returns column accessors whose object schema field type is
|
|
55
|
-
* a relation
|
|
56
|
-
*
|
|
88
|
+
* a relation. Which types those are is NOT restated here: it is
|
|
89
|
+
* {@link EXPANDABLE_FIELD_TYPES}, the family `@object-ui/core` publishes. Used
|
|
90
|
+
* by the dashboard table widget to ask the data adapter to populate referenced
|
|
57
91
|
* records (e.g. `account: { id, name }`) so cells don't show raw FK ids.
|
|
92
|
+
*
|
|
93
|
+
* THE GATE (objectui#4914, ruling B) runs ahead of the relation test. Measured
|
|
94
|
+
* before the ruling: a `record_owner: { type: 'owner' }` column was ACTIVELY
|
|
95
|
+
* requested for `$expand` — the retired spelling got the full relational read
|
|
96
|
+
* path while the same field's editor answered with a tombstone. It is refused
|
|
97
|
+
* now, loudly and once, and the cell shows the raw id it was always going to
|
|
98
|
+
* show once the spelling stopped being a relation. That the author is TOLD is
|
|
99
|
+
* the whole difference between this and the mechanical deletion the
|
|
100
|
+
* measurement rejected.
|
|
101
|
+
*
|
|
102
|
+
* ## The relation test is core's object, not a private copy (objectui#5692)
|
|
103
|
+
*
|
|
104
|
+
* It used to be the inline literal
|
|
105
|
+
* `t === 'lookup' || t === 'reference' || t === 'master_detail' || t === 'user'`
|
|
106
|
+
* — one of TWO copies this package held (the other `LOOKUP_TYPES` in
|
|
107
|
+
* `recordFields.tsx`), neither deriving from nor pinned against the family core
|
|
108
|
+
* publishes. objectui#5312's claim to have converted "the LAST private copy"
|
|
109
|
+
* was false by these two; they predate that sweep and were outside its file
|
|
110
|
+
* surface.
|
|
111
|
+
*
|
|
112
|
+
* This is the LIVE half of that convergence — `computeLookupExpand` drives a
|
|
113
|
+
* real `$expand` on every dashboard table fetch — so both membership deltas are
|
|
114
|
+
* observable here, and both were decided by measurement (see `isLookupType` in
|
|
115
|
+
* `recordFields.tsx` for the full record):
|
|
116
|
+
*
|
|
117
|
+
* - a `tree` column now GETS `$expand`-ed, the same treatment the form / grid
|
|
118
|
+
* road already gives it;
|
|
119
|
+
* - a `reference` column no longer does, and that is a no-op on spec-compliant
|
|
120
|
+
* data: the spelling is absent from `@objectstack/spec`'s closed `FieldType`
|
|
121
|
+
* and refused by `FieldSchema.safeParse`, so no object schema can declare a
|
|
122
|
+
* field whose stored type is `reference`.
|
|
58
123
|
*/
|
|
59
124
|
export declare function computeLookupExpand(schema: {
|
|
60
125
|
columns?: any[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ObjectDataTable.d.ts","sourceRoot":"","sources":["../src/ObjectDataTable.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAgE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"ObjectDataTable.d.ts","sourceRoot":"","sources":["../src/ObjectDataTable.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAgE,MAAM,OAAO,CAAC;AA2BrF,MAAM,WAAW,oBAAoB;IACnC,MAAM,EAAE;QACN,IAAI,EAAE,MAAM,CAAC;QACb,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,YA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|
-
import { DrillDownConfig } from '@object-ui/types';
|
|
2
|
+
import { DrillDownConfig, I18nLabel } from '@object-ui/types';
|
|
3
3
|
import { CompareToConfig } from './utils';
|
|
4
4
|
/**
|
|
5
5
|
* ObjectMetricWidget — Data-bound metric widget.
|
|
@@ -27,31 +27,40 @@ export interface ObjectMetricWidgetProps {
|
|
|
27
27
|
};
|
|
28
28
|
/** Filter conditions */
|
|
29
29
|
filter?: any;
|
|
30
|
-
/**
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
30
|
+
/**
|
|
31
|
+
* The KPI's heading, in @objectstack/spec's `I18nLabel` vocabulary — a plain
|
|
32
|
+
* string or an inline per-locale map (`{ en: 'Revenue', 'zh-CN': '收入' }`).
|
|
33
|
+
*
|
|
34
|
+
* Was `string | { key?, defaultValue? }` — the key-reference form
|
|
35
|
+
* objectstack#5055 RETIRED at rc.6. The sibling `MetricWidgetProps` was
|
|
36
|
+
* migrated for this reason in objectui#4358; this interface was missed in
|
|
37
|
+
* that pass, and the omission was not inert (objectui#5264). This component
|
|
38
|
+
* forwards `label` straight to `MetricWidget`, which resolves it with
|
|
39
|
+
* `pickLocalized`. The retired object hits no locale limb, so resolution
|
|
40
|
+
* falls through to the last resort — the FIRST string property in insertion
|
|
41
|
+
* order — and `{ key, defaultValue }` written in that natural order paints
|
|
42
|
+
* the raw dotted translation key onto the card as its visible label.
|
|
43
|
+
*
|
|
44
|
+
* The producer side already says so: `ObjectMetricPropsSchema.label` in
|
|
45
|
+
* `@objectstack/spec/ui` is `I18nLabelSchema`, and its inline-map key regex
|
|
46
|
+
* rejects `key`/`defaultValue` by name. This declaration now agrees with it.
|
|
47
|
+
*/
|
|
48
|
+
label: string | I18nLabel;
|
|
35
49
|
/** Fallback static value (used when no dataSource or in demo mode) */
|
|
36
50
|
fallbackValue?: string | number;
|
|
37
51
|
/** Trend info */
|
|
38
52
|
trend?: {
|
|
39
53
|
value: number;
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
defaultValue?: string;
|
|
43
|
-
};
|
|
54
|
+
/** Trend caption, same `I18nLabel` vocabulary as {@link ObjectMetricWidgetProps.label}. */
|
|
55
|
+
label?: string | I18nLabel;
|
|
44
56
|
direction?: 'up' | 'down' | 'neutral';
|
|
45
57
|
};
|
|
46
58
|
/** Icon name or ReactNode */
|
|
47
59
|
icon?: React.ReactNode | string;
|
|
48
60
|
/** Additional CSS class */
|
|
49
61
|
className?: string;
|
|
50
|
-
/**
|
|
51
|
-
description?: string |
|
|
52
|
-
key?: string;
|
|
53
|
-
defaultValue?: string;
|
|
54
|
-
};
|
|
62
|
+
/** Sub-caption under the value, same `I18nLabel` vocabulary as {@link ObjectMetricWidgetProps.label}. */
|
|
63
|
+
description?: string | I18nLabel;
|
|
55
64
|
/** External data source (overrides context) */
|
|
56
65
|
dataSource?: any;
|
|
57
66
|
/** Visual color variant for the icon container */
|
|
@@ -77,22 +86,27 @@ export interface ObjectMetricWidgetProps {
|
|
|
77
86
|
* to this metric, filtered by the same `filter` used for aggregation.
|
|
78
87
|
*/
|
|
79
88
|
drillDown?: DrillDownConfig;
|
|
80
|
-
/** Title for the drill-down panel; defaults to the metric label. */
|
|
81
|
-
title?: string | {
|
|
82
|
-
key?: string;
|
|
83
|
-
defaultValue?: string;
|
|
84
|
-
};
|
|
85
89
|
/**
|
|
86
|
-
*
|
|
87
|
-
*
|
|
90
|
+
* Title for the drill-down panel; defaults to the metric label. Same
|
|
91
|
+
* `I18nLabel` vocabulary as {@link ObjectMetricWidgetProps.label}, and
|
|
92
|
+
* resolved through the same `pickLocalized` — see `drawerTitle` below, which
|
|
93
|
+
* used to read the retired form's `defaultValue` limb directly.
|
|
94
|
+
*/
|
|
95
|
+
title?: string | I18nLabel;
|
|
96
|
+
/**
|
|
97
|
+
* Period-over-period comparison configuration — the executor's own
|
|
98
|
+
* `{ kind, dimension? }` contract since objectstack#5011. When set, the
|
|
99
|
+
* widget issues a parallel aggregate for the comparison window and derives a
|
|
88
100
|
* trend (% delta + direction + i18n label like "vs last quarter").
|
|
89
101
|
*
|
|
90
|
-
* - `'previousPeriod'`: same window length immediately before the current.
|
|
91
|
-
* - `'previousYear'`: same window shifted back one year.
|
|
92
|
-
* - `{ offset: '7d' }`: sliding window shifted back by N days/weeks.
|
|
102
|
+
* - `{ kind: 'previousPeriod' }`: same window length immediately before the current.
|
|
103
|
+
* - `{ kind: 'previousYear' }`: same window shifted back one year.
|
|
93
104
|
*
|
|
94
|
-
*
|
|
95
|
-
*
|
|
105
|
+
* `dimension` is not read on this inline path — it names the dataset time
|
|
106
|
+
* dimension the EXECUTOR shifts, and this path shifts the widget's own
|
|
107
|
+
* `filter` instead. Has no effect when no `filter` (or no date filter) is
|
|
108
|
+
* provided — the shift uses the filter's date range to compute the
|
|
109
|
+
* comparison window.
|
|
96
110
|
*/
|
|
97
111
|
compareTo?: CompareToConfig;
|
|
98
112
|
/** Optional i18n translator used to localize the trend label. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ObjectMetricWidget.d.ts","sourceRoot":"","sources":["../src/ObjectMetricWidget.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAgE,MAAM,OAAO,CAAC;AAIrF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"ObjectMetricWidget.d.ts","sourceRoot":"","sources":["../src/ObjectMetricWidget.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAgE,MAAM,OAAO,CAAC;AAIrF,OAAO,KAAK,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAInE,OAAO,EAKL,KAAK,eAAe,EACrB,MAAM,SAAS,CAAC;AAEjB;;;;;;;;;;;;;;GAcG;AACH,MAAM,WAAW,uBAAuB;IACtC,wCAAwC;IACxC,UAAU,EAAE,MAAM,CAAC;IACnB,oDAAoD;IACpD,SAAS,CAAC,EAAE;QAAE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,SAAS,CAAC;IAC3B;;;;;;;;;;;;;;OAcG;IACH,SAAS,CAAC,EAAE,eAAe,CAAC;IAC5B,iEAAiE;IACjE,CAAC,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,KAAK,MAAM,CAAC;IAClD,4EAA4E;IAC5E,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CAC3B;AAED,eAAO,MAAM,kBAAkB,EAAE,KAAK,CAAC,EAAE,CAAC,uBAAuB,CAmWhE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ObjectPivotTable.d.ts","sourceRoot":"","sources":["../src/ObjectPivotTable.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,
|
|
1
|
+
{"version":3,"file":"ObjectPivotTable.d.ts","sourceRoot":"","sources":["../src/ObjectPivotTable.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAA0C,MAAM,OAAO,CAAC;AAQ/D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAwBzD,MAAM,WAAW,qBAAqB;IACpC,MAAM,EAAE,gBAAgB,GAAG;QACzB,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,YAAY,CAAC,EAAE;YAAE,QAAQ,EAAE,MAAM,CAAC;YAAC,MAAM,CAAC,EAAE,MAAM,CAAA;SAAE,CAAC;QACrD,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,MAAM,CAAC,EAAE,GAAG,CAAC;KACd,CAAC;IACF,UAAU,CAAC,EAAE,GAAG,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,gBAAgB,EAAE,KAAK,CAAC,EAAE,CAAC,qBAAqB,CAyO5D,CAAC"}
|
package/dist/PivotTable.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PivotTable.d.ts","sourceRoot":"","sources":["../src/PivotTable.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAkB,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,gBAAgB,EAAoB,MAAM,kBAAkB,CAAC;AAE3E,OAAO,EAAkB,KAAK,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAWlE,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,gBAAgB,CAAC;IACzB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;;;OAKG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACnC,kDAAkD;IAClD,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACtC,gFAAgF;IAChF,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;;;OAIG;IACH,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,UAAU,KAAK,IAAI,CAAC;CAC3C;
|
|
1
|
+
{"version":3,"file":"PivotTable.d.ts","sourceRoot":"","sources":["../src/PivotTable.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAkB,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,gBAAgB,EAAoB,MAAM,kBAAkB,CAAC;AAE3E,OAAO,EAAkB,KAAK,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAWlE,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,gBAAgB,CAAC;IACzB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;;;OAKG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACnC,kDAAkD;IAClD,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACtC,gFAAgF;IAChF,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;;;OAIG;IACH,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,UAAU,KAAK,IAAI,CAAC;CAC3C;AAiFD;;;;;;;;GAQG;AACH,eAAO,MAAM,kBAAkB,EAAE,WAAW,CAAC,MAAM,CAAkD,CAAC;AAwBtG;;;;;GAKG;AACH,eAAO,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,CAoRhD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RecordDetailDrawer.d.ts","sourceRoot":"","sources":["../src/RecordDetailDrawer.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,KAAkB,MAAM,OAAO,CAAC;AAcvC,MAAM,WAAW,uBAAuB;IACtC,iEAAiE;IACjE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI,CAAC;IACnC,4EAA4E;IAC5E,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,wEAAwE;IACxE,YAAY,CAAC,EAAE,GAAG,CAAC;IACnB;;;;OAIG;IACH,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,2EAA2E;IAC3E,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,gEAAgE;IAChE,MAAM,CAAC,EAAE,QAAQ,GAAG,QAAQ,CAAC;IAC7B,gDAAgD;IAChD,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB;AAgBD,eAAO,MAAM,kBAAkB,EAAE,KAAK,CAAC,EAAE,CAAC,uBAAuB,
|
|
1
|
+
{"version":3,"file":"RecordDetailDrawer.d.ts","sourceRoot":"","sources":["../src/RecordDetailDrawer.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,KAAkB,MAAM,OAAO,CAAC;AAcvC,MAAM,WAAW,uBAAuB;IACtC,iEAAiE;IACjE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI,CAAC;IACnC,4EAA4E;IAC5E,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,wEAAwE;IACxE,YAAY,CAAC,EAAE,GAAG,CAAC;IACnB;;;;OAIG;IACH,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,2EAA2E;IAC3E,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,gEAAgE;IAChE,MAAM,CAAC,EAAE,QAAQ,GAAG,QAAQ,CAAC;IAC7B,gDAAgD;IAChD,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB;AAgBD,eAAO,MAAM,kBAAkB,EAAE,KAAK,CAAC,EAAE,CAAC,uBAAuB,CAkFhE,CAAC"}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
import { ConfigPanelSchema } from '@object-ui/components';
|
|
1
2
|
import { WidgetDatasetCatalogEntry } from './dataset-catalog';
|
|
3
|
+
import { ConfigPanelTranslate } from './useConfigPanelTranslation';
|
|
2
4
|
/**
|
|
3
5
|
* ObjectUI
|
|
4
6
|
* Copyright (c) 2024-present ObjectStack Inc.
|
|
@@ -8,6 +10,7 @@ import { WidgetDatasetCatalogEntry } from './dataset-catalog';
|
|
|
8
10
|
*/
|
|
9
11
|
import * as React from 'react';
|
|
10
12
|
export declare function supportsDrillDown(t: string | undefined): boolean;
|
|
13
|
+
export declare function buildWidgetSchema(t: ConfigPanelTranslate, datasets: WidgetDatasetCatalogEntry[] | undefined, widgetType?: string): ConfigPanelSchema;
|
|
11
14
|
export interface WidgetConfigPanelProps {
|
|
12
15
|
/** Whether the panel is open */
|
|
13
16
|
open: boolean;
|
|
@@ -31,6 +34,31 @@ export interface WidgetConfigPanelProps {
|
|
|
31
34
|
/** Whether the dataset catalog is still loading (reserved for future UX). */
|
|
32
35
|
datasetsLoading?: boolean;
|
|
33
36
|
}
|
|
37
|
+
/**
|
|
38
|
+
* Put the `I18nLabel` keys of a draft back into the shape they were stored in.
|
|
39
|
+
*
|
|
40
|
+
* The draft carries ONE string per label key — the active locale's, which is
|
|
41
|
+
* what the text input can hold. Persisting that string as the whole value is
|
|
42
|
+
* the data loss this card is about, so before a save each label key is mapped
|
|
43
|
+
* back against the value the panel was handed:
|
|
44
|
+
*
|
|
45
|
+
* - stored value is a plain string (or absent): nothing was ever collapsed, so
|
|
46
|
+
* the draft's string is already the correct whole value — passed through.
|
|
47
|
+
* - stored value is a map and the draft's string still equals what the panel
|
|
48
|
+
* DISPLAYED: the author never touched this field, so the **original object is
|
|
49
|
+
* returned by reference**. An untouched title survives an unrelated config
|
|
50
|
+
* edit byte-identically — the round trip the ruling requires, and the reason
|
|
51
|
+
* this is an identity restore rather than a rebuild that would happen to
|
|
52
|
+
* produce an equal object (a rebuild would add an entry for the active locale
|
|
53
|
+
* to a map that never had one).
|
|
54
|
+
* - stored value is a map and the string differs: the edit lands in the active
|
|
55
|
+
* locale's entry via `setLocalized`, every other locale preserved.
|
|
56
|
+
*
|
|
57
|
+
* Exported for direct unit testing — the panel path reaches it only through
|
|
58
|
+
* `useConfigDraft`, so a component test alone would be asserting that hook's
|
|
59
|
+
* behaviour as much as this rule.
|
|
60
|
+
*/
|
|
61
|
+
export declare function restoreI18nLabels(draft: Record<string, any>, source: Record<string, any>, language: string | undefined): Record<string, any>;
|
|
34
62
|
export declare function sanitizeDraftForType(draft: Record<string, any>): Record<string, any>;
|
|
35
63
|
export declare function WidgetConfigPanel({ open, onClose, config, onSave, onFieldChange, headerExtra, datasets, datasetsLoading: _datasetsLoading, }: WidgetConfigPanelProps): React.JSX.Element;
|
|
36
64
|
//# sourceMappingURL=WidgetConfigPanel.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WidgetConfigPanel.d.ts","sourceRoot":"","sources":["../src/WidgetConfigPanel.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAY/B,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"WidgetConfigP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AAG,CAAC,EAC1B,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAC3B,QAAQ,EAAE,MAAM,GAAG,SAAS,GAC3B,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAgBrB;AA4BD,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAOpF;AAED,wBAAgB,iBAAiB,CAAC,EAChC,IAAI,EACJ,OAAO,EACP,MAAM,EACN,MAAM,EACN,aAAa,EACb,WAAW,EACX,QAAQ,EACR,eAAe,EAAE,gBAAgB,GAClC,EAAE,sBAAsB,qBAiExB"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The dashboard renderer's `colorVariant` tokens — ONE table, shared by every
|
|
3
|
+
* surface that paints a KPI accent.
|
|
4
|
+
*
|
|
5
|
+
* The vocabulary is `@objectstack/spec`'s `WidgetColorVariantSchema` enum
|
|
6
|
+
* (`packages/spec/src/ui/dashboard.zod.ts`), mirrored by the designer's swatch
|
|
7
|
+
* picker (`app-shell/.../color-variant-field.tsx` — "Canonical semantic
|
|
8
|
+
* palette"). Those three lists must state the same eight tokens; a renderer
|
|
9
|
+
* that invented a ninth variant, or dropped one, would turn a
|
|
10
|
+
* declared-but-unenforced key into the harder bug: two disagreeing
|
|
11
|
+
* declarations. The picker carries three EXTRA display-only aliases
|
|
12
|
+
* (`green`/`red`/`amber`) so a swatch can still be drawn for an off-spec
|
|
13
|
+
* stored value — deliberately NOT honoured here (see `metricAccentTextClass`).
|
|
14
|
+
*
|
|
15
|
+
* Class strings stay static literals so Tailwind's content scanner sees them
|
|
16
|
+
* (`apps/console/src/index.css` sources this package's `src/**`).
|
|
17
|
+
*/
|
|
18
|
+
export type MetricColorVariant = 'default' | 'blue' | 'teal' | 'orange' | 'purple' | 'success' | 'warning' | 'danger';
|
|
19
|
+
/**
|
|
20
|
+
* Icon-chip classes per variant — a soft background + bold foreground that
|
|
21
|
+
* tints the icon container while the rest of the card stays in the neutral
|
|
22
|
+
* Shadcn palette. Used by the card-chrome KPI layout (`MetricWidget`).
|
|
23
|
+
*/
|
|
24
|
+
export declare const VARIANT_ICON_CLASSES: Record<MetricColorVariant, string>;
|
|
25
|
+
/** Text-colour per variant — tints the big number on the chrome-less
|
|
26
|
+
* (`bare` / dataset-bound) KPI layouts, which have no icon chip to carry the
|
|
27
|
+
* accent. */
|
|
28
|
+
export declare const VARIANT_TEXT_CLASSES: Record<MetricColorVariant, string>;
|
|
29
|
+
/**
|
|
30
|
+
* Resolve a widget's declared `colorVariant` to the accent text class for a
|
|
31
|
+
* KPI that already renders in the ambient foreground colour, or `undefined`
|
|
32
|
+
* when there is no accent to add.
|
|
33
|
+
*
|
|
34
|
+
* `undefined` is returned for three distinct inputs, and the caller wants the
|
|
35
|
+
* same thing in all three — emit no extra class at all:
|
|
36
|
+
*
|
|
37
|
+
* - **not declared** — the widget said nothing, so its markup must not change
|
|
38
|
+
* (objectui#3359 pins this byte-for-byte);
|
|
39
|
+
* - **`'default'`** — the enum's own name for "no accent". Painting the
|
|
40
|
+
* explicit `text-foreground` here would be a no-op on a surface that
|
|
41
|
+
* already inherits it, and would make `colorVariant: 'default'` differ from
|
|
42
|
+
* omitting the key purely in class-attribute bytes;
|
|
43
|
+
* - **off-spec token** (`'chartreuse'`, or the picker's display-only
|
|
44
|
+
* `'green'`/`'red'`/`'amber'` aliases) — deliberately no accent and no
|
|
45
|
+
* aliasing. The spec enum rejects these where the metadata is authored and
|
|
46
|
+
* published; teaching the renderer to accept a second spelling would
|
|
47
|
+
* fossilize a dialect the contract does not have (AGENTS.md #0.1). A
|
|
48
|
+
* cosmetic key is also the wrong place to fail a widget's whole render,
|
|
49
|
+
* hence "no accent" rather than an error.
|
|
50
|
+
*
|
|
51
|
+
* `MetricWidget`'s own layouts keep indexing `VARIANT_TEXT_CLASSES` /
|
|
52
|
+
* `VARIANT_ICON_CLASSES` directly — they take a defaulted prop, so `'default'`
|
|
53
|
+
* genuinely resolves to a class there.
|
|
54
|
+
*/
|
|
55
|
+
export declare function metricAccentTextClass(value: unknown): string | undefined;
|
|
56
|
+
//# sourceMappingURL=colorVariants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"colorVariants.d.ts","sourceRoot":"","sources":["../src/colorVariants.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;GAgBG;AAEH,MAAM,MAAM,kBAAkB,GAC1B,SAAS,GAAG,MAAM,GAAG,MAAM,GAAG,QAAQ,GAAG,QAAQ,GACjD,SAAS,GAAG,SAAS,GAAG,QAAQ,CAAC;AAErC;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,EAAE,MAAM,CAAC,kBAAkB,EAAE,MAAM,CASnE,CAAC;AAEF;;cAEc;AACd,eAAO,MAAM,oBAAoB,EAAE,MAAM,CAAC,kBAAkB,EAAE,MAAM,CASnE,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAGxE"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ObjectUI
|
|
3
|
+
* Copyright (c) 2024-present ObjectStack Inc.
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the MIT license found in the
|
|
6
|
+
* LICENSE file in the root directory of this source tree.
|
|
7
|
+
*/
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=domPassthroughPins.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"domPassthroughPins.d.ts","sourceRoot":"","sources":["../src/domPassthroughPins.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAsHH,OAAO,EAAE,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
1
2
|
import { DashboardRenderer } from './DashboardRenderer';
|
|
2
3
|
import { DashboardGridLayout } from './DashboardGridLayout';
|
|
3
4
|
import { MetricWidget } from './MetricWidget';
|
|
@@ -12,18 +13,22 @@ import { DashboardWithConfig } from './DashboardWithConfig';
|
|
|
12
13
|
import { DrillDownDrawer } from './DrillDownDrawer';
|
|
13
14
|
export { DashboardRenderer, DashboardGridLayout, MetricWidget, MetricCard, ObjectMetricWidget, PivotTable, ObjectPivotTable, ObjectDataTable, DashboardConfigPanel, WidgetConfigPanel, DashboardWithConfig, DrillDownDrawer };
|
|
14
15
|
export type { WidgetConfigPanelProps } from './WidgetConfigPanel';
|
|
16
|
+
export { CONFIG_PANEL_DEFAULT_TRANSLATIONS, useConfigPanelTranslation, type ConfigPanelTranslate, } from './useConfigPanelTranslation';
|
|
15
17
|
export type { WidgetDatasetCatalogEntry, WidgetDatasetDimension, WidgetDatasetMeasure, } from './dataset-catalog';
|
|
16
18
|
export declare const dashboardComponents: {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
19
|
+
dashboard: React.ForwardRefExoticComponent<import('./DashboardRenderer').DashboardRendererProps & React.RefAttributes<HTMLDivElement>>;
|
|
20
|
+
metric: ({ label, value, trend, icon, className, description, loading, error, colorVariant, format, currency, prefix, suffix, onClick, variant, schema: _schema, bind: _bind, events: _events, props: _propsBag, ariaLabel: _ariaLabel, ariaDescribedBy: _ariaDescribedBy, dataSource: _dataSource, ...domProps }: import('./MetricWidget').MetricWidgetProps & import('./schemaHostProps').SchemaHostProps) => React.JSX.Element;
|
|
21
|
+
'metric-card': React.FC<import('./MetricCard').MetricCardProps & import('./schemaHostProps').SchemaHostProps>;
|
|
22
|
+
'object-metric': React.FC<{
|
|
23
|
+
[key: string]: any;
|
|
24
|
+
schema?: any;
|
|
25
|
+
}>;
|
|
26
|
+
pivot: React.FC<import('./PivotTable').PivotTableProps>;
|
|
27
|
+
'object-pivot': React.FC<{
|
|
28
|
+
[key: string]: any;
|
|
29
|
+
schema?: any;
|
|
30
|
+
}>;
|
|
31
|
+
'dashboard-grid': React.FC<import('./DashboardGridLayout').DashboardGridLayoutProps>;
|
|
32
|
+
'object-data-table': React.FC<import('./ObjectDataTable').ObjectDataTableProps>;
|
|
28
33
|
};
|
|
29
34
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD,OAAO,EAAE,iBAAi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