@richardmcquiston01/dashboard-widgets-toolkit 0.14.0 → 0.16.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/dist/core.cjs +2232 -1587
- package/dist/core.cjs.map +1 -1
- package/dist/core.d.cts +49 -3
- package/dist/core.d.ts +49 -3
- package/dist/core.js +2210 -1588
- package/dist/core.js.map +1 -1
- package/dist/index.cjs +2232 -1587
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2210 -1588
- package/dist/index.js.map +1 -1
- package/dist/react.cjs +600 -59
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.cts +25 -2
- package/dist/react.d.ts +25 -2
- package/dist/react.js +600 -59
- package/dist/react.js.map +1 -1
- package/dist/{storage-_Eb8Y98-.d.cts → storage-oivwB7al.d.cts} +247 -56
- package/dist/{storage-_Eb8Y98-.d.ts → storage-oivwB7al.d.ts} +247 -56
- package/package.json +1 -1
|
@@ -738,6 +738,112 @@ declare function tableDetailData(data: TableWidgetData): DetailData;
|
|
|
738
738
|
*/
|
|
739
739
|
declare function deriveDetailData(data: WidgetData, locale?: Locale): DetailData | undefined;
|
|
740
740
|
|
|
741
|
+
/**
|
|
742
|
+
* Alternate views: other ways to show the same data. A widget declares
|
|
743
|
+
* `views`, each one built from the widget's own payload by a named,
|
|
744
|
+
* parameterized conversion (data, not functions, so definitions stay JSON).
|
|
745
|
+
* Switching is instant: no second load. Pure functions, no I/O.
|
|
746
|
+
*/
|
|
747
|
+
|
|
748
|
+
/** The key of the widget's own kind, always available as a view. */
|
|
749
|
+
declare const BASE_VIEW_KEY = "base";
|
|
750
|
+
/** Most views one widget may declare, the base view not counted. */
|
|
751
|
+
declare const MAX_WIDGET_VIEWS = 8;
|
|
752
|
+
/** How a view is built from the widget's payload. */
|
|
753
|
+
type ViewConversion = {
|
|
754
|
+
readonly type: 'tableToBarList';
|
|
755
|
+
/** Column index of the bar labels. */
|
|
756
|
+
readonly label: number;
|
|
757
|
+
/** Column index of the bar values (cells need a numeric `value`). */
|
|
758
|
+
readonly value: number;
|
|
759
|
+
} | {
|
|
760
|
+
readonly type: 'tableToGraph';
|
|
761
|
+
/** Column index of the x labels. */
|
|
762
|
+
readonly label: number;
|
|
763
|
+
/** Column indexes of the series (cells need a numeric `value`). */
|
|
764
|
+
readonly values: readonly number[];
|
|
765
|
+
readonly chartType: 'bar' | 'line';
|
|
766
|
+
/** How the numbers read. Default `number`. */
|
|
767
|
+
readonly valueFormat?: ValueFormat;
|
|
768
|
+
readonly currency?: string;
|
|
769
|
+
} | {
|
|
770
|
+
readonly type: 'barListToTable';
|
|
771
|
+
/** Heading of the label column. Default "Name". */
|
|
772
|
+
readonly labelHeading?: string;
|
|
773
|
+
/** Heading of the value column. Default "Value". */
|
|
774
|
+
readonly valueHeading?: string;
|
|
775
|
+
} | {
|
|
776
|
+
readonly type: 'graphToTable';
|
|
777
|
+
} | {
|
|
778
|
+
readonly type: 'barListToGraph';
|
|
779
|
+
readonly chartType: 'bar' | 'line';
|
|
780
|
+
/** Name of the one series. Default "Value". */
|
|
781
|
+
readonly seriesName?: string;
|
|
782
|
+
readonly valueFormat?: ValueFormat;
|
|
783
|
+
readonly currency?: string;
|
|
784
|
+
};
|
|
785
|
+
/** The kinds a conversion reads and produces. */
|
|
786
|
+
declare const VIEW_CONVERSIONS: Readonly<Record<ViewConversion['type'], {
|
|
787
|
+
from: WidgetKind;
|
|
788
|
+
to: WidgetKind;
|
|
789
|
+
}>>;
|
|
790
|
+
/** One alternate way to show a widget. */
|
|
791
|
+
interface WidgetView {
|
|
792
|
+
/** Unique within the widget; not `base`. Stored in the viewer's settings. */
|
|
793
|
+
readonly key: string;
|
|
794
|
+
/** What the viewer sees in the View field, e.g. "Bars". */
|
|
795
|
+
readonly label: string;
|
|
796
|
+
/** What this view renders; must match what the conversion produces. */
|
|
797
|
+
readonly kind: WidgetKind;
|
|
798
|
+
/** Builds this view from the widget's payload. */
|
|
799
|
+
readonly convert: ViewConversion;
|
|
800
|
+
}
|
|
801
|
+
/** What these functions need from a definition. */
|
|
802
|
+
type ViewsItem = Pick<WidgetDefinition, 'key' | 'kind'> & Partial<Pick<WidgetDefinition, 'views' | 'defaultView' | 'baseViewLabel'>>;
|
|
803
|
+
/** A kind's plain name, used for the base view unless `baseViewLabel` is set. */
|
|
804
|
+
declare function kindLabel(kind: WidgetKind): string;
|
|
805
|
+
/** Whether the definition offers a choice of views. */
|
|
806
|
+
declare function hasViews(item: Pick<ViewsItem, 'views'>): boolean;
|
|
807
|
+
/** The view with this key, or undefined (`base` is not a declared view). */
|
|
808
|
+
declare function findView(item: Pick<ViewsItem, 'views'>, key: string): WidgetView | undefined;
|
|
809
|
+
/** Every view a viewer may pick: the base first, then the declared ones. */
|
|
810
|
+
declare function viewChoices(item: ViewsItem): readonly {
|
|
811
|
+
key: string;
|
|
812
|
+
label: string;
|
|
813
|
+
kind: WidgetKind;
|
|
814
|
+
}[];
|
|
815
|
+
/**
|
|
816
|
+
* The view in effect: the viewer's pick when the definition declares it,
|
|
817
|
+
* else `defaultView`, else the base. Always a valid key.
|
|
818
|
+
*/
|
|
819
|
+
declare function effectiveViewKey(item: ViewsItem, chosen: string | undefined): string;
|
|
820
|
+
/** The kind the widget renders as under this view key. */
|
|
821
|
+
declare function viewKind(item: ViewsItem, chosen: string | undefined): WidgetKind;
|
|
822
|
+
/** Options for `convertView`. */
|
|
823
|
+
interface ConvertViewOptions {
|
|
824
|
+
/** Locale for numbers a conversion has to format (graph to table). */
|
|
825
|
+
readonly locale?: Locale;
|
|
826
|
+
}
|
|
827
|
+
/**
|
|
828
|
+
* Builds a view's payload from the widget's payload. The error names the
|
|
829
|
+
* widget, the view and what to fix, for example `Widget "top-products" view
|
|
830
|
+
* "bars": row 3, column 2 ("Sold") has no numeric value. Add value to the
|
|
831
|
+
* cells.` Never throws.
|
|
832
|
+
*/
|
|
833
|
+
declare function convertView(widgetKey: string, view: Pick<WidgetView, 'key' | 'convert'>, data: WidgetData, options?: ConvertViewOptions): Result<WidgetData>;
|
|
834
|
+
/**
|
|
835
|
+
* What a view keeps of a table, for the dialog: "Shows Name and Sold only."
|
|
836
|
+
* Empty when the view loses nothing worth saying.
|
|
837
|
+
*/
|
|
838
|
+
declare function viewNote(view: WidgetView, data: WidgetData | undefined): string;
|
|
839
|
+
/**
|
|
840
|
+
* The widget as the chosen view shows it: the payload converted and the
|
|
841
|
+
* definition's `kind` set to the view's kind, so renderers work unchanged.
|
|
842
|
+
* A widget that isn't `ok`, or whose view is the base, comes back as is; a
|
|
843
|
+
* failed conversion becomes an `error` widget naming the fix.
|
|
844
|
+
*/
|
|
845
|
+
declare function applyView<W extends DashboardWidget>(widget: W, chosen: string | undefined, options?: ConvertViewOptions): DashboardWidget;
|
|
846
|
+
|
|
741
847
|
/** A size hint for grid layouts; renderers may map it to column spans. */
|
|
742
848
|
declare const WIDGET_SIZES: readonly ["small", "medium", "large", "full"];
|
|
743
849
|
type WidgetSize = (typeof WIDGET_SIZES)[number];
|
|
@@ -815,6 +921,21 @@ interface WidgetDefinition {
|
|
|
815
921
|
* `ProviderOptions.options`. See `options.ts`.
|
|
816
922
|
*/
|
|
817
923
|
readonly options?: readonly WidgetOption[];
|
|
924
|
+
/**
|
|
925
|
+
* Other ways to show this widget, built from its payload by a named
|
|
926
|
+
* conversion (a table as bars or a chart). The widget's own `kind` is
|
|
927
|
+
* always available as the view `base`. See `views.ts`.
|
|
928
|
+
*/
|
|
929
|
+
readonly views?: readonly WidgetView[];
|
|
930
|
+
/** The view shown until a viewer picks another: `base` or a `views` key. Default `base`. */
|
|
931
|
+
readonly defaultView?: string;
|
|
932
|
+
/** What the base view is called in the View field. Default: its kind's name. */
|
|
933
|
+
readonly baseViewLabel?: string;
|
|
934
|
+
/**
|
|
935
|
+
* Set on a clone (see `clones.ts`): the key of the widget it copies. Its
|
|
936
|
+
* data comes from that widget's provider. Authors never set it.
|
|
937
|
+
*/
|
|
938
|
+
readonly sourceKey?: string;
|
|
818
939
|
}
|
|
819
940
|
/** What a viewer may not do to a locked widget. */
|
|
820
941
|
interface WidgetLock {
|
|
@@ -826,6 +947,8 @@ interface WidgetLock {
|
|
|
826
947
|
readonly minimize?: boolean;
|
|
827
948
|
/** Can't be given a title, width or option values of the viewer's own. */
|
|
828
949
|
readonly options?: boolean;
|
|
950
|
+
/** Can't be duplicated into a clone. */
|
|
951
|
+
readonly clone?: boolean;
|
|
829
952
|
}
|
|
830
953
|
/** `WidgetLock` with every default filled in. */
|
|
831
954
|
type ResolvedWidgetLock = Required<WidgetLock>;
|
|
@@ -845,70 +968,63 @@ declare function sortDefinitions<D extends WidgetDefinition>(definitions: readon
|
|
|
845
968
|
/** Whether a widget is active and visible to someone with these roles. */
|
|
846
969
|
declare function isWidgetVisibleTo(definition: WidgetDefinition, roles: readonly string[] | undefined): boolean;
|
|
847
970
|
|
|
848
|
-
/** The parts of a widget definition that decide its place in a grid. */
|
|
849
|
-
interface GridItem {
|
|
850
|
-
readonly key: string;
|
|
851
|
-
readonly defaultSize?: WidgetSize;
|
|
852
|
-
readonly fill?: WidgetFill;
|
|
853
|
-
readonly width?: number;
|
|
854
|
-
}
|
|
855
|
-
/** Columns in a grid that uses widget `width`. */
|
|
856
|
-
declare const WIDTH_COLUMNS = 12;
|
|
857
|
-
/** Smallest and largest `width`, in twelfths of a row. */
|
|
858
|
-
declare const MIN_WIDGET_WIDTH = 2;
|
|
859
|
-
declare const MAX_WIDGET_WIDTH = 12;
|
|
860
|
-
/** Whether `value` is a valid widget `width`: an integer from 2 to 12. */
|
|
861
|
-
declare function isWidgetWidth(value: unknown): value is number;
|
|
862
|
-
/** The width (in twelfths) a `defaultSize` stands for. Default `medium`. */
|
|
863
|
-
declare function widthForSize(size: WidgetSize | undefined): number;
|
|
864
|
-
/** The 12-column width of an item: its `width`, else from its size. */
|
|
865
|
-
declare function itemWidth(item: GridItem): number;
|
|
866
|
-
/** Whether a grid of `items` should use 12 columns (any item sets `width`). */
|
|
867
|
-
declare function usesWidthColumns(items: readonly GridItem[]): boolean;
|
|
868
|
-
/** Whether the widget should take the columns left over in its row. */
|
|
869
|
-
declare function fillsWidth(fill: WidgetFill | undefined): boolean;
|
|
870
|
-
/** Whether the widget should stretch to the height of its row. */
|
|
871
|
-
declare function fillsHeight(fill: WidgetFill | undefined): boolean;
|
|
872
971
|
/**
|
|
873
|
-
*
|
|
874
|
-
*
|
|
972
|
+
* Clones: copies of a widget a viewer made to keep it twice with different
|
|
973
|
+
* settings (another view, width or option values). A clone is stored as
|
|
974
|
+
* `{ key, from }` in `layout.clones`, its settings under its own key in
|
|
975
|
+
* `layout.settings`, and it shares the original's provider. Pure functions,
|
|
976
|
+
* no I/O.
|
|
875
977
|
*/
|
|
876
|
-
|
|
978
|
+
|
|
979
|
+
/** A widget the viewer made from another. */
|
|
980
|
+
interface WidgetClone {
|
|
981
|
+
/** Unique across definitions and clones: `from#1`, `from#2`, ... */
|
|
982
|
+
readonly key: string;
|
|
983
|
+
/** The original's key. Always an original, never another clone. */
|
|
984
|
+
readonly from: string;
|
|
985
|
+
}
|
|
877
986
|
/**
|
|
878
|
-
*
|
|
879
|
-
*
|
|
880
|
-
* not fit), then gives the columns left over in each row to the items that
|
|
881
|
-
* `fill` their width, shared evenly (earlier items get the remainder).
|
|
882
|
-
*
|
|
883
|
-
* Returns the column span for each width-filling item, keyed by `key`. Items
|
|
884
|
-
* that do not fill width keep their normal size and are not in the map.
|
|
987
|
+
* Most clones `parseLayout` keeps: a safety ceiling against malformed or
|
|
988
|
+
* hostile JSON, not a product limit (a page's capacity is the real limit).
|
|
885
989
|
*/
|
|
886
|
-
declare
|
|
990
|
+
declare const MAX_PARSED_CLONES = 500;
|
|
991
|
+
/** What these functions need from a definition. */
|
|
992
|
+
type CloneItem = Pick<WidgetDefinition, 'key'> & Partial<Pick<WidgetDefinition, 'title' | 'locked' | 'sourceKey'>>;
|
|
993
|
+
/** Options for the clone functions. */
|
|
994
|
+
interface CloneOptions {
|
|
995
|
+
/** Keep clones that a widget's `locked.clone` forbids (an administrator). */
|
|
996
|
+
readonly overrideLocks?: boolean;
|
|
997
|
+
}
|
|
887
998
|
/**
|
|
888
|
-
*
|
|
889
|
-
*
|
|
999
|
+
* Reads the `clones` field of a saved layout. Anything malformed is dropped
|
|
1000
|
+
* (wrong types, empty or repeated keys, a clone of itself). Returns undefined
|
|
1001
|
+
* when nothing usable is left.
|
|
890
1002
|
*/
|
|
891
|
-
declare function
|
|
892
|
-
/**
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
readonly spans: readonly number[];
|
|
897
|
-
}
|
|
1003
|
+
declare function parseClones(raw: unknown): readonly WidgetClone[] | undefined;
|
|
1004
|
+
/** The JSON-ready form of `layout.clones`; undefined when there are none. */
|
|
1005
|
+
declare function serializeClones(clones: readonly WidgetClone[] | undefined): WidgetClone[] | undefined;
|
|
1006
|
+
/** The number in a clone key (`orders#3` is 3), or undefined. */
|
|
1007
|
+
declare function cloneNumber(key: string): number | undefined;
|
|
898
1008
|
/**
|
|
899
|
-
* The
|
|
900
|
-
*
|
|
901
|
-
*
|
|
902
|
-
*
|
|
903
|
-
*
|
|
1009
|
+
* The clones that can exist for these definitions: the original is a real
|
|
1010
|
+
* widget (not itself a clone), the key doesn't shadow another widget, and the
|
|
1011
|
+
* original's `locked.clone` allows it. Returns the same array when nothing is
|
|
1012
|
+
* dropped. Clones already present as definitions (see `withClones`) count as
|
|
1013
|
+
* valid, so the function is idempotent.
|
|
904
1014
|
*/
|
|
905
|
-
declare function
|
|
1015
|
+
declare function cleanClones<D extends CloneItem>(definitions: readonly D[], clones: readonly WidgetClone[] | undefined, options?: CloneOptions): readonly WidgetClone[] | undefined;
|
|
906
1016
|
/**
|
|
907
|
-
*
|
|
908
|
-
*
|
|
909
|
-
*
|
|
1017
|
+
* The definitions with each clone added right after its original. A clone's
|
|
1018
|
+
* definition copies the original's, with its own key, `sourceKey` set to the
|
|
1019
|
+
* original, the title "Original (#n)" and no locks (a clone is the viewer's
|
|
1020
|
+
* to move, hide and delete). Settings still apply on top (`effectiveDefinitions`).
|
|
1021
|
+
* Pass the result to `useWidgets` so clones load, and to the settings and
|
|
1022
|
+
* layout functions. Idempotent; returns the same array when there are no
|
|
1023
|
+
* clones to add.
|
|
910
1024
|
*/
|
|
911
|
-
declare function
|
|
1025
|
+
declare function withClones<D extends CloneItem>(definitions: readonly D[], layout: {
|
|
1026
|
+
readonly clones?: readonly WidgetClone[];
|
|
1027
|
+
}, options?: CloneOptions): readonly D[];
|
|
912
1028
|
|
|
913
1029
|
/**
|
|
914
1030
|
* A viewer's own choices for a widget: a title, a width and values for the
|
|
@@ -927,6 +1043,8 @@ interface WidgetViewerSettings {
|
|
|
927
1043
|
readonly flexible?: boolean;
|
|
928
1044
|
/** Values for declared options, by option key. */
|
|
929
1045
|
readonly options?: Readonly<Record<string, OptionValue>>;
|
|
1046
|
+
/** The view to show: `base` or a key from the definition's `views`. */
|
|
1047
|
+
readonly view?: string;
|
|
930
1048
|
}
|
|
931
1049
|
/** Viewer settings by widget key. */
|
|
932
1050
|
type LayoutSettings = Readonly<Record<string, WidgetViewerSettings>>;
|
|
@@ -938,7 +1056,7 @@ declare const MAX_WIDGET_TITLE_LENGTH = 80;
|
|
|
938
1056
|
*/
|
|
939
1057
|
declare const MAX_PARSED_SETTINGS = 500;
|
|
940
1058
|
/** What these functions need from a definition. */
|
|
941
|
-
type SettingsItem = Pick<WidgetDefinition, 'key'> & Partial<Pick<WidgetDefinition, 'title' | 'width' | 'minWidth' | 'maxWidth' | 'fill' | 'locked' | 'options'>>;
|
|
1059
|
+
type SettingsItem = Pick<WidgetDefinition, 'key'> & Partial<Pick<WidgetDefinition, 'title' | 'width' | 'minWidth' | 'maxWidth' | 'fill' | 'locked' | 'options' | 'views' | 'defaultView'>>;
|
|
942
1060
|
/**
|
|
943
1061
|
* Reads the `settings` field of a saved layout. Anything malformed is
|
|
944
1062
|
* dropped (wrong types, titles over the limit are cut, widths outside 2 to
|
|
@@ -999,6 +1117,8 @@ interface WidgetSettingsPatch {
|
|
|
999
1117
|
readonly flexible?: boolean | undefined;
|
|
1000
1118
|
/** Replaces all of the widget's option values (`undefined` clears them). */
|
|
1001
1119
|
readonly options?: Readonly<Record<string, OptionValue>> | undefined;
|
|
1120
|
+
/** The view key (`base` or a declared view); `undefined` clears it. */
|
|
1121
|
+
readonly view?: string | undefined;
|
|
1002
1122
|
}
|
|
1003
1123
|
type LayoutWithSettings<L> = L & {
|
|
1004
1124
|
readonly settings?: LayoutSettings;
|
|
@@ -1072,6 +1192,12 @@ interface DashboardLayout {
|
|
|
1072
1192
|
* widget key. See `settings.ts`. Absent when they chose nothing.
|
|
1073
1193
|
*/
|
|
1074
1194
|
readonly settings?: LayoutSettings;
|
|
1195
|
+
/**
|
|
1196
|
+
* Widgets the viewer made from others, as `{ key, from }`. Their settings
|
|
1197
|
+
* live in `settings` under their own key. See `clones.ts`. Absent when
|
|
1198
|
+
* there are none.
|
|
1199
|
+
*/
|
|
1200
|
+
readonly clones?: readonly WidgetClone[];
|
|
1075
1201
|
}
|
|
1076
1202
|
/** One page of a paged layout: the same lists as a layout, plus a name. */
|
|
1077
1203
|
interface LayoutPage {
|
|
@@ -1170,6 +1296,71 @@ interface EnforceLocksOptions {
|
|
|
1170
1296
|
*/
|
|
1171
1297
|
declare function enforceLocks<T extends LayoutItem>(definitions: readonly T[], layout: DashboardLayout, options?: EnforceLocksOptions): DashboardLayout;
|
|
1172
1298
|
|
|
1299
|
+
/** The parts of a widget definition that decide its place in a grid. */
|
|
1300
|
+
interface GridItem {
|
|
1301
|
+
readonly key: string;
|
|
1302
|
+
readonly defaultSize?: WidgetSize;
|
|
1303
|
+
readonly fill?: WidgetFill;
|
|
1304
|
+
readonly width?: number;
|
|
1305
|
+
}
|
|
1306
|
+
/** Columns in a grid that uses widget `width`. */
|
|
1307
|
+
declare const WIDTH_COLUMNS = 12;
|
|
1308
|
+
/** Smallest and largest `width`, in twelfths of a row. */
|
|
1309
|
+
declare const MIN_WIDGET_WIDTH = 2;
|
|
1310
|
+
declare const MAX_WIDGET_WIDTH = 12;
|
|
1311
|
+
/** Whether `value` is a valid widget `width`: an integer from 2 to 12. */
|
|
1312
|
+
declare function isWidgetWidth(value: unknown): value is number;
|
|
1313
|
+
/** The width (in twelfths) a `defaultSize` stands for. Default `medium`. */
|
|
1314
|
+
declare function widthForSize(size: WidgetSize | undefined): number;
|
|
1315
|
+
/** The 12-column width of an item: its `width`, else from its size. */
|
|
1316
|
+
declare function itemWidth(item: GridItem): number;
|
|
1317
|
+
/** Whether a grid of `items` should use 12 columns (any item sets `width`). */
|
|
1318
|
+
declare function usesWidthColumns(items: readonly GridItem[]): boolean;
|
|
1319
|
+
/** Whether the widget should take the columns left over in its row. */
|
|
1320
|
+
declare function fillsWidth(fill: WidgetFill | undefined): boolean;
|
|
1321
|
+
/** Whether the widget should stretch to the height of its row. */
|
|
1322
|
+
declare function fillsHeight(fill: WidgetFill | undefined): boolean;
|
|
1323
|
+
/**
|
|
1324
|
+
* Columns a size takes in a grid of `columns` tracks: `large` spans
|
|
1325
|
+
* `largeSpan` (default 2), `full` spans every column, anything else one.
|
|
1326
|
+
*/
|
|
1327
|
+
declare function baseColumnSpan(size: WidgetSize | undefined, columns: number, largeSpan?: number): number;
|
|
1328
|
+
/**
|
|
1329
|
+
* Places `items` in a grid of `columns` tracks the way a sparse grid
|
|
1330
|
+
* auto-places them (left to right, wrapping to a new row when an item does
|
|
1331
|
+
* not fit), then gives the columns left over in each row to the items that
|
|
1332
|
+
* `fill` their width, shared evenly (earlier items get the remainder).
|
|
1333
|
+
*
|
|
1334
|
+
* Returns the column span for each width-filling item, keyed by `key`. Items
|
|
1335
|
+
* that do not fill width keep their normal size and are not in the map.
|
|
1336
|
+
*/
|
|
1337
|
+
declare function fillColumnSpans(items: readonly GridItem[], columns: number, largeSpan?: number): Map<string, number>;
|
|
1338
|
+
/**
|
|
1339
|
+
* Like `fillColumnSpans` for a 12-column grid: each item starts at its
|
|
1340
|
+
* `width` (see `itemWidth`) and width-fillers share the leftover twelfths.
|
|
1341
|
+
*/
|
|
1342
|
+
declare function fillWidthSpans(items: readonly GridItem[]): Map<string, number>;
|
|
1343
|
+
/** One row of a placed grid: the widgets in it and their final column spans. */
|
|
1344
|
+
interface PlacedRow {
|
|
1345
|
+
readonly keys: readonly string[];
|
|
1346
|
+
/** Column spans, in `keys` order, after width-fillers took the leftovers. */
|
|
1347
|
+
readonly spans: readonly number[];
|
|
1348
|
+
}
|
|
1349
|
+
/**
|
|
1350
|
+
* The rows `items` occupy in a 12-column grid, exactly as `fillWidthSpans`
|
|
1351
|
+
* places them: left to right, a widget that doesn't fit in the rest of a row
|
|
1352
|
+
* starts the next row whole (a widget is never split), and width-fillers then
|
|
1353
|
+
* grow into the leftover columns. Growth never changes how many rows there
|
|
1354
|
+
* are.
|
|
1355
|
+
*/
|
|
1356
|
+
declare function placeRows(items: readonly GridItem[]): readonly PlacedRow[];
|
|
1357
|
+
/**
|
|
1358
|
+
* How many of `items`, in order, fit in `maxRows` rows of a 12-column grid.
|
|
1359
|
+
* Placement is left to right, so this is the length of the longest prefix
|
|
1360
|
+
* whose rows number at most `maxRows`.
|
|
1361
|
+
*/
|
|
1362
|
+
declare function fitCount(items: readonly GridItem[], maxRows: number): number;
|
|
1363
|
+
|
|
1173
1364
|
/**
|
|
1174
1365
|
* Pages of widgets: a dashboard split into pages, like the home screens of a
|
|
1175
1366
|
* phone. Each page is a small layout (order, hidden, minimized) with a name
|
|
@@ -1471,4 +1662,4 @@ interface LayoutPersistence {
|
|
|
1471
1662
|
*/
|
|
1472
1663
|
declare function createLayoutPersistence(adapter: StorageAdapter, options?: LayoutPersistenceOptions): LayoutPersistence;
|
|
1473
1664
|
|
|
1474
|
-
export {
|
|
1665
|
+
export { DEFAULT_MAX_LAYOUT_BYTES as $, type AlertListWidgetData as A, type BarListWidgetData as B, type CloneOptions as C, type DashboardWidget as D, type BooleanOption as E, type CachedPayload as F, type GraphWidgetData as G, type ChoiceOption as H, type CloneItem as I, type ColorOption as J, type KpiWidgetData as K, type Locale as L, type ColumnsOption as M, type NiceDomain as N, type OptionValues as O, type PageItem as P, type ConflictPolicy as Q, type ResolvedTableControls as R, type StoreScope as S, type TableWidgetData as T, type ConvertViewOptions as U, DATE_RANGE_PRESETS as V, type WidgetSize as W, DEFAULT_COMPARISON_LABEL as X, DEFAULT_CURRENCY as Y, DEFAULT_DETAIL_PAGE_SIZE as Z, DEFAULT_EMPTY_TEXT as _, type WidgetFill as a, type SortOption as a$, DEFAULT_PAGE_KEY as a0, DEFAULT_PAGE_ROWS as a1, DETAIL_MODES as a2, type DateRangeOption as a3, type DateRangePreset as a4, type DeltaDirection as a5, type DeltaSentiment as a6, type DetailCell as a7, type DetailColumn as a8, type DetailMode as a9, MAX_PARSED_CLONES as aA, MAX_PARSED_PAGES as aB, MAX_PARSED_SETTINGS as aC, MAX_TEXT_OPTION_LENGTH as aD, MAX_WIDGET_OPTIONS as aE, MAX_WIDGET_TITLE_LENGTH as aF, MAX_WIDGET_VIEWS as aG, MAX_WIDGET_WIDTH as aH, MIN_WIDGET_WIDTH as aI, type NormalizeSettingsOptions as aJ, type NumberOption as aK, OPTION_KEY_PATTERN as aL, type Ok as aM, type OkWidget as aN, type OptionContext as aO, type OptionValue as aP, type PageRoom as aQ, type PlacedRow as aR, type ProviderOptions as aS, type ResolvedDetailOptions as aT, type ResolvedWidget as aU, type ResolvedWidgetLock as aV, type RetryOptions as aW, type SaveOptions as aX, type SavedLayout as aY, type SettingsItem as aZ, type SortDirection as a_, type DetailPage as aa, type DetailProvider as ab, type DetailProviders as ac, EMPTY_LAYOUT as ad, type EmptyWidget as ae, type EncodingOptions as af, type EnforceLocksOptions as ag, type Err as ah, type ErrorWidget as ai, type FormatOptions as aj, type GraphPoint as ak, type GraphSeries as al, type GridItem as am, type KpiDelta as an, type KpiDeltaOptions as ao, LAYOUT_ENVELOPE_VERSION as ap, type LayoutItem as aq, type LayoutPage as ar, type LayoutPersistenceOptions as as, type LayoutSettings as at, type LoadedLayout as au, type LoadingWidget as av, MAX_DETAIL_PAGE_SIZE as aw, MAX_GRAPH_SERIES as ax, MAX_PAGE_ROWS as ay, MAX_PAGE_TITLE_LENGTH as az, type WidgetDefinition as b, hasPages as b$, type StorageAdapter as b0, type StorageLogEvent as b1, type StoreErrorCode as b2, type StoreResult as b3, type StoredValue as b4, type TableCell as b5, type TableColumn as b6, type TextOption as b7, VALUE_FORMATS as b8, VIEW_CONVERSIONS as b9, clearWidgetSettings as bA, cloneNumber as bB, coerceOptionValue as bC, convertView as bD, createLayoutPersistence as bE, defaultDetailQuery as bF, defaultOptionValue as bG, defineWidget as bH, deriveDetailData as bI, describeUnknownError as bJ, effectiveDefinitions as bK, effectiveViewKey as bL, emptyTextFor as bM, emptyWidget as bN, enforceLocks as bO, err as bP, failedWidget as bQ, fillColumnSpans as bR, fillWidthSpans as bS, fillsHeight as bT, fillsWidth as bU, finalizeWidget as bV, findView as bW, fitCount as bX, formatCount as bY, formatPercentChange as bZ, formatValue as b_, type ValueFormat as ba, type ViewConversion as bb, type ViewsItem as bc, WIDGET_FILLS as bd, WIDGET_KINDS as be, WIDGET_OPTION_TYPES as bf, WIDGET_SIZES as bg, WIDTH_COLUMNS as bh, type WidgetCache as bi, type WidgetDataOf as bj, type WidgetDetailOptions as bk, type WidgetEmptyState as bl, type WidgetLock as bm, type WidgetOption as bn, type WidgetProvider as bo, type WidgetStatus as bp, type WidgetTableControls as bq, type WidgetView as br, addPage as bs, applyClientOptions as bt, applySettings as bu, applyView as bv, assignPages as bw, baseColumnSpan as bx, cacheKeyFor as by, cleanClones as bz, type DetailProviderOptions as c, resolveWidgetUnapplied as c$, hasViews as c0, hiddenWidgets as c1, hideWidget as c2, isClientApplied as c3, isColumnKeyFor as c4, isFlexible as c5, isHidden as c6, isIsoInterval as c7, isMinimized as c8, isOptionsLocked as c9, optionValuesFromLayout as cA, optionsCacheSuffix as cB, pageLayout as cC, pageList as cD, pageOf as cE, pageRoom as cF, pageWidgets as cG, parseClones as cH, parseDetailQuery as cI, parseLayout as cJ, parseSettings as cK, parseSortValue as cL, percentChange as cM, placeRows as cN, pruneLayout as cO, queryRows as cP, readOnly as cQ, removePage as cR, renamePage as cS, resolveDateRange as cT, resolveDetailOptions as cU, resolveOptionValues as cV, resolvePageKey as cW, resolvePayload as cX, resolveTableControls as cY, resolveWidget as cZ, resolveWidgetLock as c_, isTitleInUse as ca, isWidgetEmptyState as cb, isWidgetKind as cc, isWidgetVisibleTo as cd, isWidgetWidth as ce, itemWidth as cf, kindLabel as cg, kpiDelta as ch, labelStride as ci, loadingWidgets as cj, memoryAdapter as ck, minimizeWidget as cl, movePage as cm, moveWidget as cn, moveWidgetBy as co, moveWidgetDown as cp, moveWidgetToPage as cq, moveWidgetUp as cr, nextPageKey as cs, niceDomain as ct, niceStep as cu, normalizeLayout as cv, normalizeSettings as cw, normalizeTitle as cx, ok as cy, optionValuesFor as cz, type DetailData as d, resolveWidgets as d0, restoreWidget as d1, sameOptionValues as d2, serializeClones as d3, serializeDetailQuery as d4, serializeLayout as d5, serializeSettings as d6, setWidgetSettings as d7, shareOf as d8, showWidget as d9, sortDefinitions as da, sortFromOptions as db, tableDetailData as dc, toggleHidden as dd, toggleMinimized as de, usesWidthColumns as df, utf8Length as dg, validateDetailData as dh, viewChoices as di, viewKind as dj, viewNote as dk, visibleWidgets as dl, widgetOptionValues as dm, widgetsFor as dn, widthForSize as dp, widthRange as dq, widthShareLabel as dr, withClones as ds, withEncoding as dt, withFallback as du, withLogging as dv, withPageLayout as dw, withPrefix as dx, withReadCache as dy, withRetry as dz, type DetailQuery as e, type DashboardLayout as f, type WidgetViewerSettings as g, type WidgetSettingsPatch as h, type GaugeWidgetData as i, type DetailSort as j, type TextWidgetData as k, type WidgetData as l, type LayoutPersistence as m, type NormalizeOptions as n, type ResolveOptions as o, type WidgetContext as p, type WidgetProviders as q, type PageOptions as r, type Result as s, type WidgetClone as t, type WidgetKind as u, type WidgetPayload as v, type AddPageOptions as w, type AlertListItem as x, BASE_VIEW_KEY as y, type BarListItem as z };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@richardmcquiston01/dashboard-widgets-toolkit",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.16.0",
|
|
4
4
|
"description": "Framework-agnostic dashboard widget toolkit: typed widget definitions and data payloads (KPI, gauge, table, bar list, alert list, chart), user layout (order, hide, minimise), and React renderers. Bring your own data providers.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"dashboard",
|