@richardmcquiston01/dashboard-widgets-toolkit 0.13.0 → 0.15.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 +1089 -347
- package/dist/core.cjs.map +1 -1
- package/dist/core.d.cts +2 -2
- package/dist/core.d.ts +2 -2
- package/dist/core.js +1061 -348
- package/dist/core.js.map +1 -1
- package/dist/index.cjs +1089 -347
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1061 -348
- package/dist/index.js.map +1 -1
- package/dist/react.cjs +1173 -121
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.cts +57 -4
- package/dist/react.d.ts +57 -4
- package/dist/react.js +1173 -122
- package/dist/react.js.map +1 -1
- package/dist/{storage-DNB7gjvT.d.cts → storage-DwJ-vGJg.d.cts} +264 -3
- package/dist/{storage-DNB7gjvT.d.ts → storage-DwJ-vGJg.d.ts} +264 -3
- package/dist/styles.css +146 -0
- 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];
|
|
@@ -775,6 +881,14 @@ interface WidgetDefinition {
|
|
|
775
881
|
* give widgets more room automatically.
|
|
776
882
|
*/
|
|
777
883
|
readonly width?: number;
|
|
884
|
+
/**
|
|
885
|
+
* The narrowest and widest a viewer may make the widget (integers from 2 to
|
|
886
|
+
* 12, `minWidth <= width <= maxWidth`). A table that needs room sets
|
|
887
|
+
* `minWidth: 6`; a KPI tile that looks silly wide sets `maxWidth: 4`.
|
|
888
|
+
* Without them the full 2 to 12 range applies.
|
|
889
|
+
*/
|
|
890
|
+
readonly minWidth?: number;
|
|
891
|
+
readonly maxWidth?: number;
|
|
778
892
|
/**
|
|
779
893
|
* Gives the widget a detail view: a full list with sorting, filtering and
|
|
780
894
|
* paging. `true` uses defaults. The data comes from a detail provider.
|
|
@@ -790,8 +904,8 @@ interface WidgetDefinition {
|
|
|
790
904
|
/** Fill free space in the row (height, width or both). Default: none. */
|
|
791
905
|
readonly fill?: WidgetFill;
|
|
792
906
|
/**
|
|
793
|
-
* Keeps viewers from
|
|
794
|
-
* move, hide and
|
|
907
|
+
* Keeps viewers from changing this widget. `true` locks everything:
|
|
908
|
+
* move, hide, minimize and options. Use an object to lock only some; fields left out
|
|
795
909
|
* are not locked.
|
|
796
910
|
*/
|
|
797
911
|
readonly locked?: boolean | WidgetLock;
|
|
@@ -807,6 +921,16 @@ interface WidgetDefinition {
|
|
|
807
921
|
* `ProviderOptions.options`. See `options.ts`.
|
|
808
922
|
*/
|
|
809
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;
|
|
810
934
|
}
|
|
811
935
|
/** What a viewer may not do to a locked widget. */
|
|
812
936
|
interface WidgetLock {
|
|
@@ -816,6 +940,8 @@ interface WidgetLock {
|
|
|
816
940
|
readonly hide?: boolean;
|
|
817
941
|
/** Can't be collapsed to its header. */
|
|
818
942
|
readonly minimize?: boolean;
|
|
943
|
+
/** Can't be given a title, width or option values of the viewer's own. */
|
|
944
|
+
readonly options?: boolean;
|
|
819
945
|
}
|
|
820
946
|
/** `WidgetLock` with every default filled in. */
|
|
821
947
|
type ResolvedWidgetLock = Required<WidgetLock>;
|
|
@@ -900,6 +1026,136 @@ declare function placeRows(items: readonly GridItem[]): readonly PlacedRow[];
|
|
|
900
1026
|
*/
|
|
901
1027
|
declare function fitCount(items: readonly GridItem[], maxRows: number): number;
|
|
902
1028
|
|
|
1029
|
+
/**
|
|
1030
|
+
* A viewer's own choices for a widget: a title, a width and values for the
|
|
1031
|
+
* options its author declared. They live in the layout (`layout.settings`),
|
|
1032
|
+
* so the consumer's existing persistence saves them, and they override what
|
|
1033
|
+
* the definition says without changing it. Pure functions, no I/O.
|
|
1034
|
+
*/
|
|
1035
|
+
|
|
1036
|
+
/** What one viewer chose for one widget. Every field is optional. */
|
|
1037
|
+
interface WidgetViewerSettings {
|
|
1038
|
+
/** Replaces the widget's title. Plain text, at most 80 characters. */
|
|
1039
|
+
readonly title?: string;
|
|
1040
|
+
/** Share of the row in twelfths, within the definition's min and max. */
|
|
1041
|
+
readonly width?: number;
|
|
1042
|
+
/** May grow into the columns left over in its row (see `fill`). */
|
|
1043
|
+
readonly flexible?: boolean;
|
|
1044
|
+
/** Values for declared options, by option key. */
|
|
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;
|
|
1048
|
+
}
|
|
1049
|
+
/** Viewer settings by widget key. */
|
|
1050
|
+
type LayoutSettings = Readonly<Record<string, WidgetViewerSettings>>;
|
|
1051
|
+
/** Longest title a viewer can give a widget; longer ones are cut. */
|
|
1052
|
+
declare const MAX_WIDGET_TITLE_LENGTH = 80;
|
|
1053
|
+
/**
|
|
1054
|
+
* Most widgets `parseLayout` keeps settings for: a safety ceiling against
|
|
1055
|
+
* malformed or hostile JSON, not a product limit.
|
|
1056
|
+
*/
|
|
1057
|
+
declare const MAX_PARSED_SETTINGS = 500;
|
|
1058
|
+
/** What these functions need from a definition. */
|
|
1059
|
+
type SettingsItem = Pick<WidgetDefinition, 'key'> & Partial<Pick<WidgetDefinition, 'title' | 'width' | 'minWidth' | 'maxWidth' | 'fill' | 'locked' | 'options' | 'views' | 'defaultView'>>;
|
|
1060
|
+
/**
|
|
1061
|
+
* Reads the `settings` field of a saved layout. Anything malformed is
|
|
1062
|
+
* dropped (wrong types, titles over the limit are cut, widths outside 2 to
|
|
1063
|
+
* 12), never an error. Returns undefined when nothing usable is left.
|
|
1064
|
+
*/
|
|
1065
|
+
declare function parseSettings(raw: unknown): LayoutSettings | undefined;
|
|
1066
|
+
/** The JSON-ready form of `layout.settings`; fields keep a stable order. */
|
|
1067
|
+
declare function serializeSettings(settings: LayoutSettings | undefined): Record<string, WidgetViewerSettings> | undefined;
|
|
1068
|
+
/** The narrowest and widest share a widget may take. */
|
|
1069
|
+
declare function widthRange(item: Pick<SettingsItem, 'minWidth' | 'maxWidth'>): {
|
|
1070
|
+
readonly min: number;
|
|
1071
|
+
readonly max: number;
|
|
1072
|
+
};
|
|
1073
|
+
/** A width as a share of the row: 2 is `1/6`, 6 is `1/2`, 12 is `Full`. */
|
|
1074
|
+
declare function widthShareLabel(width: number): string;
|
|
1075
|
+
/** Whether the lock on this widget forbids viewer settings. */
|
|
1076
|
+
declare function isOptionsLocked(item: Pick<SettingsItem, 'locked'>): boolean;
|
|
1077
|
+
/** Whether the widget grows into free columns: the viewer's choice, else its `fill`. */
|
|
1078
|
+
declare function isFlexible(item: Pick<SettingsItem, 'fill'>, settings: WidgetViewerSettings | undefined): boolean;
|
|
1079
|
+
/**
|
|
1080
|
+
* The definition as this viewer sees it: their title, their width (kept
|
|
1081
|
+
* within the definition's limits) and their choice of Flexible applied on
|
|
1082
|
+
* top of the author's. Returns the same object when there is nothing to
|
|
1083
|
+
* apply. Options are not part of the definition; read them with
|
|
1084
|
+
* `widgetOptionValues`.
|
|
1085
|
+
*/
|
|
1086
|
+
declare function applySettings<D extends SettingsItem>(definition: D, settings: WidgetViewerSettings | undefined): D;
|
|
1087
|
+
/**
|
|
1088
|
+
* The definitions with each viewer's settings applied. A widget whose lock
|
|
1089
|
+
* forbids options (`locked.options`) ignores them, so a saved layout can't
|
|
1090
|
+
* reach around a lock. Pass `overrideLocks` for an administrator.
|
|
1091
|
+
*/
|
|
1092
|
+
declare function effectiveDefinitions<D extends SettingsItem>(definitions: readonly D[], layout: {
|
|
1093
|
+
readonly settings?: LayoutSettings;
|
|
1094
|
+
}, options?: {
|
|
1095
|
+
readonly overrideLocks?: boolean;
|
|
1096
|
+
}): D[];
|
|
1097
|
+
/**
|
|
1098
|
+
* The chosen option values for a widget, resolved: the viewer's where valid,
|
|
1099
|
+
* else the author's defaults. Empty when it declares no options.
|
|
1100
|
+
*/
|
|
1101
|
+
declare function widgetOptionValues(definition: Pick<SettingsItem, 'options'>, settings: WidgetViewerSettings | undefined): OptionValues;
|
|
1102
|
+
/**
|
|
1103
|
+
* What to pass `useWidgets({ optionValues })` so the data follows the
|
|
1104
|
+
* layout: for every widget that declares options, the viewer's chosen
|
|
1105
|
+
* values (empty when they haven't chosen, which means the defaults). Every
|
|
1106
|
+
* such widget is listed so Reset sends its defaults back to the provider.
|
|
1107
|
+
*/
|
|
1108
|
+
declare function optionValuesFromLayout(definitions: readonly Pick<SettingsItem, 'key' | 'options' | 'locked'>[], layout: {
|
|
1109
|
+
readonly settings?: LayoutSettings;
|
|
1110
|
+
}, options?: {
|
|
1111
|
+
readonly overrideLocks?: boolean;
|
|
1112
|
+
}): Record<string, Readonly<Record<string, OptionValue>>>;
|
|
1113
|
+
/** Fields `setWidgetSettings` can change; `undefined` clears one. */
|
|
1114
|
+
interface WidgetSettingsPatch {
|
|
1115
|
+
readonly title?: string | undefined;
|
|
1116
|
+
readonly width?: number | undefined;
|
|
1117
|
+
readonly flexible?: boolean | undefined;
|
|
1118
|
+
/** Replaces all of the widget's option values (`undefined` clears them). */
|
|
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;
|
|
1122
|
+
}
|
|
1123
|
+
type LayoutWithSettings<L> = L & {
|
|
1124
|
+
readonly settings?: LayoutSettings;
|
|
1125
|
+
};
|
|
1126
|
+
/**
|
|
1127
|
+
* A layout with `patch` applied to one widget's settings. Fields the patch
|
|
1128
|
+
* names as `undefined` are cleared; others stay. An entry left empty is
|
|
1129
|
+
* removed. Returns the same layout when nothing changes.
|
|
1130
|
+
*/
|
|
1131
|
+
declare function setWidgetSettings<L extends object>(layout: LayoutWithSettings<L>, key: string, patch: WidgetSettingsPatch): LayoutWithSettings<L>;
|
|
1132
|
+
/** A layout without one widget's settings (Reset to defaults). */
|
|
1133
|
+
declare function clearWidgetSettings<L extends object>(layout: LayoutWithSettings<L>, key: string): LayoutWithSettings<L>;
|
|
1134
|
+
/** Lower-cased, trimmed and Unicode-normalized, for comparing titles. */
|
|
1135
|
+
declare function normalizeTitle(title: string): string;
|
|
1136
|
+
/**
|
|
1137
|
+
* Whether another widget already shows `title`: compared trimmed,
|
|
1138
|
+
* case-insensitive and Unicode-normalized, against the other widgets'
|
|
1139
|
+
* effective titles. A dialog uses it to refuse a duplicate.
|
|
1140
|
+
*/
|
|
1141
|
+
declare function isTitleInUse<D extends SettingsItem>(definitions: readonly D[], layout: {
|
|
1142
|
+
readonly settings?: LayoutSettings;
|
|
1143
|
+
}, key: string, title: string): boolean;
|
|
1144
|
+
/** Options for `normalizeSettings`. */
|
|
1145
|
+
interface NormalizeSettingsOptions {
|
|
1146
|
+
/** Keep settings that a widget's `locked.options` forbids. */
|
|
1147
|
+
readonly overrideLocks?: boolean;
|
|
1148
|
+
}
|
|
1149
|
+
/**
|
|
1150
|
+
* Cleans a layout's settings against the definitions, for a save endpoint:
|
|
1151
|
+
* drops settings of unknown widgets and of widgets locked against options,
|
|
1152
|
+
* clamps widths to `minWidth` and `maxWidth`, trims titles, drops option
|
|
1153
|
+
* values the definition didn't declare or that aren't valid for their
|
|
1154
|
+
* option, and makes titles unique by appending "(#n)". Idempotent; returns
|
|
1155
|
+
* the same layout when nothing changes.
|
|
1156
|
+
*/
|
|
1157
|
+
declare function normalizeSettings<D extends SettingsItem, L extends object>(definitions: readonly D[], layout: LayoutWithSettings<L>, options?: NormalizeSettingsOptions): LayoutWithSettings<L>;
|
|
1158
|
+
|
|
903
1159
|
/**
|
|
904
1160
|
* A viewer's dashboard customization: order, hidden and minimized widgets.
|
|
905
1161
|
* Pure functions over a small JSON-serialisable object. Persist it however
|
|
@@ -931,6 +1187,11 @@ interface DashboardLayout {
|
|
|
931
1187
|
* empty. See `pages.ts`.
|
|
932
1188
|
*/
|
|
933
1189
|
readonly pages?: readonly LayoutPage[];
|
|
1190
|
+
/**
|
|
1191
|
+
* What the viewer chose for each widget (title, width, option values), by
|
|
1192
|
+
* widget key. See `settings.ts`. Absent when they chose nothing.
|
|
1193
|
+
*/
|
|
1194
|
+
readonly settings?: LayoutSettings;
|
|
934
1195
|
}
|
|
935
1196
|
/** One page of a paged layout: the same lists as a layout, plus a name. */
|
|
936
1197
|
interface LayoutPage {
|
|
@@ -1330,4 +1591,4 @@ interface LayoutPersistence {
|
|
|
1330
1591
|
*/
|
|
1331
1592
|
declare function createLayoutPersistence(adapter: StorageAdapter, options?: LayoutPersistenceOptions): LayoutPersistence;
|
|
1332
1593
|
|
|
1333
|
-
export { type
|
|
1594
|
+
export { type DateRangeOption as $, type AlertListWidgetData as A, type BarListWidgetData as B, type CachedPayload as C, type DashboardWidget as D, type ColorOption as E, type ColumnsOption as F, type GraphWidgetData as G, type ConflictPolicy as H, type ConvertViewOptions as I, DATE_RANGE_PRESETS as J, type KpiWidgetData as K, type Locale as L, DEFAULT_COMPARISON_LABEL as M, type NiceDomain as N, type OptionValues as O, type PageItem as P, DEFAULT_CURRENCY as Q, type ResolvedTableControls as R, type StoreScope as S, type TableWidgetData as T, DEFAULT_DETAIL_PAGE_SIZE as U, DEFAULT_EMPTY_TEXT as V, type WidgetSize as W, DEFAULT_MAX_LAYOUT_BYTES as X, DEFAULT_PAGE_KEY as Y, DEFAULT_PAGE_ROWS as Z, DETAIL_MODES as _, type WidgetFill as a, type StoreResult as a$, type DateRangePreset as a0, type DeltaDirection as a1, type DeltaSentiment as a2, type DetailCell as a3, type DetailColumn as a4, type DetailMode as a5, type DetailPage as a6, type DetailProvider as a7, type DetailProviders as a8, EMPTY_LAYOUT as a9, MAX_WIDGET_TITLE_LENGTH as aA, MAX_WIDGET_VIEWS as aB, MAX_WIDGET_WIDTH as aC, MIN_WIDGET_WIDTH as aD, type NormalizeSettingsOptions as aE, type NumberOption as aF, OPTION_KEY_PATTERN as aG, type Ok as aH, type OkWidget as aI, type OptionContext as aJ, type OptionValue as aK, type PageOptions as aL, type PageRoom as aM, type PlacedRow as aN, type ProviderOptions as aO, type ResolvedDetailOptions as aP, type ResolvedWidget as aQ, type ResolvedWidgetLock as aR, type RetryOptions as aS, type SaveOptions as aT, type SavedLayout as aU, type SettingsItem as aV, type SortDirection as aW, type SortOption as aX, type StorageAdapter as aY, type StorageLogEvent as aZ, type StoreErrorCode as a_, type EmptyWidget as aa, type EncodingOptions as ab, type EnforceLocksOptions as ac, type Err as ad, type ErrorWidget as ae, type FormatOptions as af, type GraphPoint as ag, type GraphSeries as ah, type GridItem as ai, type KpiDelta as aj, type KpiDeltaOptions as ak, LAYOUT_ENVELOPE_VERSION as al, type LayoutItem as am, type LayoutPage as an, type LayoutPersistenceOptions as ao, type LayoutSettings as ap, type LoadedLayout as aq, type LoadingWidget as ar, MAX_DETAIL_PAGE_SIZE as as, MAX_GRAPH_SERIES as at, MAX_PAGE_ROWS as au, MAX_PAGE_TITLE_LENGTH as av, MAX_PARSED_PAGES as aw, MAX_PARSED_SETTINGS as ax, MAX_TEXT_OPTION_LENGTH as ay, MAX_WIDGET_OPTIONS as az, type WidgetDefinition as b, isFlexible as b$, type StoredValue as b0, type TableCell as b1, type TableColumn as b2, type TextOption as b3, VALUE_FORMATS as b4, VIEW_CONVERSIONS as b5, type ValueFormat as b6, type ViewConversion as b7, type ViewsItem as b8, WIDGET_FILLS as b9, defaultOptionValue as bA, defineWidget as bB, deriveDetailData as bC, describeUnknownError as bD, effectiveDefinitions as bE, effectiveViewKey as bF, emptyTextFor as bG, emptyWidget as bH, enforceLocks as bI, err as bJ, failedWidget as bK, fillColumnSpans as bL, fillWidthSpans as bM, fillsHeight as bN, fillsWidth as bO, finalizeWidget as bP, findView as bQ, fitCount as bR, formatCount as bS, formatPercentChange as bT, formatValue as bU, hasPages as bV, hasViews as bW, hiddenWidgets as bX, hideWidget as bY, isClientApplied as bZ, isColumnKeyFor as b_, WIDGET_KINDS as ba, WIDGET_OPTION_TYPES as bb, WIDGET_SIZES as bc, WIDTH_COLUMNS as bd, type WidgetCache as be, type WidgetDataOf as bf, type WidgetDetailOptions as bg, type WidgetEmptyState as bh, type WidgetLock as bi, type WidgetOption as bj, type WidgetProvider as bk, type WidgetStatus as bl, type WidgetTableControls as bm, type WidgetView as bn, addPage as bo, applyClientOptions as bp, applySettings as bq, applyView as br, assignPages as bs, baseColumnSpan as bt, cacheKeyFor as bu, clearWidgetSettings as bv, coerceOptionValue as bw, convertView as bx, createLayoutPersistence as by, defaultDetailQuery as bz, type DetailProviderOptions as c, setWidgetSettings as c$, isHidden as c0, isIsoInterval as c1, isMinimized as c2, isOptionsLocked as c3, isTitleInUse as c4, isWidgetEmptyState as c5, isWidgetKind as c6, isWidgetVisibleTo as c7, isWidgetWidth as c8, itemWidth as c9, pageWidgets as cA, parseDetailQuery as cB, parseLayout as cC, parseSettings as cD, parseSortValue as cE, percentChange as cF, placeRows as cG, pruneLayout as cH, queryRows as cI, readOnly as cJ, removePage as cK, renamePage as cL, resolveDateRange as cM, resolveDetailOptions as cN, resolveOptionValues as cO, resolvePageKey as cP, resolvePayload as cQ, resolveTableControls as cR, resolveWidget as cS, resolveWidgetLock as cT, resolveWidgetUnapplied as cU, resolveWidgets as cV, restoreWidget as cW, sameOptionValues as cX, serializeDetailQuery as cY, serializeLayout as cZ, serializeSettings as c_, kindLabel as ca, kpiDelta as cb, labelStride as cc, loadingWidgets as cd, memoryAdapter as ce, minimizeWidget as cf, movePage as cg, moveWidget as ch, moveWidgetBy as ci, moveWidgetDown as cj, moveWidgetToPage as ck, moveWidgetUp as cl, nextPageKey as cm, niceDomain as cn, niceStep as co, normalizeLayout as cp, normalizeSettings as cq, normalizeTitle as cr, ok as cs, optionValuesFor as ct, optionValuesFromLayout as cu, optionsCacheSuffix as cv, pageLayout as cw, pageList as cx, pageOf as cy, pageRoom as cz, type DetailData as d, shareOf as d0, showWidget as d1, sortDefinitions as d2, sortFromOptions as d3, tableDetailData as d4, toggleHidden as d5, toggleMinimized as d6, usesWidthColumns as d7, utf8Length as d8, validateDetailData as d9, viewChoices as da, viewKind as db, viewNote as dc, visibleWidgets as dd, widgetOptionValues as de, widgetsFor as df, widthForSize as dg, widthRange as dh, widthShareLabel as di, withEncoding as dj, withFallback as dk, withLogging as dl, withPageLayout as dm, withPrefix as dn, withReadCache as dp, withRetry as dq, 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 Result as r, type WidgetKind as s, type WidgetPayload as t, type AddPageOptions as u, type AlertListItem as v, BASE_VIEW_KEY as w, type BarListItem as x, type BooleanOption as y, type ChoiceOption as z };
|
package/dist/styles.css
CHANGED
|
@@ -935,3 +935,149 @@
|
|
|
935
935
|
display: inline-flex;
|
|
936
936
|
}
|
|
937
937
|
}
|
|
938
|
+
|
|
939
|
+
/* Options dialog --------------------------------------------------------- */
|
|
940
|
+
|
|
941
|
+
:where(.dwt-options-dialog) {
|
|
942
|
+
margin: auto;
|
|
943
|
+
box-sizing: border-box;
|
|
944
|
+
width: min(520px, 100vw - 32px);
|
|
945
|
+
max-height: calc(100vh - 32px);
|
|
946
|
+
padding: 0;
|
|
947
|
+
overflow: auto;
|
|
948
|
+
color: var(--dwt-text);
|
|
949
|
+
background: var(--dwt-surface);
|
|
950
|
+
border: 1px solid var(--dwt-border);
|
|
951
|
+
border-radius: var(--dwt-radius, 8px);
|
|
952
|
+
font-family: var(--dwt-font);
|
|
953
|
+
}
|
|
954
|
+
|
|
955
|
+
:where(.dwt-options-dialog)::backdrop {
|
|
956
|
+
background: rgba(0, 0, 0, 0.5);
|
|
957
|
+
}
|
|
958
|
+
|
|
959
|
+
:where(.dwt-options) {
|
|
960
|
+
display: flex;
|
|
961
|
+
flex-direction: column;
|
|
962
|
+
gap: 14px;
|
|
963
|
+
padding: 20px;
|
|
964
|
+
}
|
|
965
|
+
|
|
966
|
+
:where(.dwt-options-heading) {
|
|
967
|
+
margin: 0;
|
|
968
|
+
font-size: 1.125rem;
|
|
969
|
+
}
|
|
970
|
+
|
|
971
|
+
:where(.dwt-options-field) {
|
|
972
|
+
display: flex;
|
|
973
|
+
flex-direction: column;
|
|
974
|
+
gap: 4px;
|
|
975
|
+
font-size: 0.875rem;
|
|
976
|
+
}
|
|
977
|
+
|
|
978
|
+
:where(.dwt-options-field label, .dwt-options-group legend) {
|
|
979
|
+
color: var(--dwt-text-secondary);
|
|
980
|
+
}
|
|
981
|
+
|
|
982
|
+
:where(.dwt-options-field input, .dwt-options-field select) {
|
|
983
|
+
box-sizing: border-box;
|
|
984
|
+
max-width: 100%;
|
|
985
|
+
min-height: 32px;
|
|
986
|
+
padding: 4px 8px;
|
|
987
|
+
color: var(--dwt-text);
|
|
988
|
+
background: var(--dwt-surface);
|
|
989
|
+
border: 1px solid var(--dwt-border);
|
|
990
|
+
border-radius: 6px;
|
|
991
|
+
font: inherit;
|
|
992
|
+
}
|
|
993
|
+
|
|
994
|
+
:where(.dwt-options-field input[type='color']) {
|
|
995
|
+
width: 56px;
|
|
996
|
+
padding: 2px;
|
|
997
|
+
}
|
|
998
|
+
|
|
999
|
+
:where(.dwt-options-pair) {
|
|
1000
|
+
display: flex;
|
|
1001
|
+
flex-wrap: wrap;
|
|
1002
|
+
gap: 8px;
|
|
1003
|
+
}
|
|
1004
|
+
|
|
1005
|
+
:where(.dwt-options-check) {
|
|
1006
|
+
display: flex;
|
|
1007
|
+
align-items: center;
|
|
1008
|
+
gap: 8px;
|
|
1009
|
+
font-size: 0.875rem;
|
|
1010
|
+
}
|
|
1011
|
+
|
|
1012
|
+
:where(.dwt-options-group, .dwt-options-columns) {
|
|
1013
|
+
display: flex;
|
|
1014
|
+
flex-direction: column;
|
|
1015
|
+
gap: 12px;
|
|
1016
|
+
margin: 0;
|
|
1017
|
+
padding: 12px;
|
|
1018
|
+
border: 1px solid var(--dwt-border);
|
|
1019
|
+
border-radius: 6px;
|
|
1020
|
+
}
|
|
1021
|
+
|
|
1022
|
+
:where(.dwt-options-columns) {
|
|
1023
|
+
padding: 8px 12px;
|
|
1024
|
+
font-size: 0.875rem;
|
|
1025
|
+
}
|
|
1026
|
+
|
|
1027
|
+
:where(.dwt-options-columns ul) {
|
|
1028
|
+
margin: 0;
|
|
1029
|
+
padding: 0;
|
|
1030
|
+
list-style: none;
|
|
1031
|
+
}
|
|
1032
|
+
|
|
1033
|
+
:where(.dwt-options-columns li) {
|
|
1034
|
+
display: flex;
|
|
1035
|
+
align-items: center;
|
|
1036
|
+
justify-content: space-between;
|
|
1037
|
+
gap: 8px;
|
|
1038
|
+
min-height: 32px;
|
|
1039
|
+
}
|
|
1040
|
+
|
|
1041
|
+
:where(.dwt-options-columns label) {
|
|
1042
|
+
display: flex;
|
|
1043
|
+
align-items: center;
|
|
1044
|
+
gap: 8px;
|
|
1045
|
+
}
|
|
1046
|
+
|
|
1047
|
+
:where(.dwt-options-move) {
|
|
1048
|
+
display: inline-flex;
|
|
1049
|
+
gap: 4px;
|
|
1050
|
+
}
|
|
1051
|
+
|
|
1052
|
+
:where(.dwt-options-error) {
|
|
1053
|
+
margin: 0;
|
|
1054
|
+
color: var(--dwt-bad);
|
|
1055
|
+
font-size: 0.8125rem;
|
|
1056
|
+
}
|
|
1057
|
+
|
|
1058
|
+
:where(.dwt-options-actions) {
|
|
1059
|
+
display: flex;
|
|
1060
|
+
flex-wrap: wrap;
|
|
1061
|
+
align-items: center;
|
|
1062
|
+
gap: 8px;
|
|
1063
|
+
}
|
|
1064
|
+
|
|
1065
|
+
:where(.dwt-options-actions button:disabled) {
|
|
1066
|
+
opacity: 0.5;
|
|
1067
|
+
cursor: default;
|
|
1068
|
+
}
|
|
1069
|
+
|
|
1070
|
+
@media (max-width: 640px) {
|
|
1071
|
+
:where(.dwt-options-dialog) {
|
|
1072
|
+
width: 100vw;
|
|
1073
|
+
max-width: 100vw;
|
|
1074
|
+
max-height: 100vh;
|
|
1075
|
+
border-radius: 0;
|
|
1076
|
+
}
|
|
1077
|
+
}
|
|
1078
|
+
|
|
1079
|
+
:where(.dwt-button-primary) {
|
|
1080
|
+
color: var(--dwt-surface);
|
|
1081
|
+
background: var(--dwt-link);
|
|
1082
|
+
border-color: transparent;
|
|
1083
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@richardmcquiston01/dashboard-widgets-toolkit",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.15.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",
|