@dashboard-designer/ui 0.2.1 → 0.2.3

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/README.md CHANGED
@@ -209,3 +209,29 @@ buttons. These application-provided callbacks are not stored in dashboard JSON.
209
209
 
210
210
  The native Angular package exposes the equivalent `[toolbarButtons]` input on
211
211
  its designer and viewer, using text or `TemplateRef` icons instead of React nodes.
212
+
213
+
214
+ ## Hide toolbar controls from application code
215
+
216
+ Use `toolbarVisibility` on the designer or viewer. Set a key to `false` to hide
217
+ that control; omitted keys retain their normal behavior. `true` does not override
218
+ read-only mode, permissions, or the dashboard's export settings.
219
+
220
+ ```ts
221
+ const toolbarVisibility = { share: false, settings: false, print: false, pdf: false, json: false, email: false };
222
+ ```
223
+
224
+ ```tsx
225
+ <DashboardViewer dashboard={dashboard} apiBaseUrl={apiBaseUrl} auth={auth}
226
+ toolbarVisibility={toolbarVisibility} />
227
+ // Use hideToolbar={true} to hide the entire header, including custom buttons.
228
+ ```
229
+
230
+ Supported keys: `refresh`, `lastRefresh`, `filters`, `variables`, `print`, `pdf`,
231
+ `json`, `email`, `edit`, `share`, `settings`, `history`, `undo`, `redo`, `reset`,
232
+ `add`, `save`, `drillBack`, and `import` (Angular's built-in import control).
233
+ For custom buttons use their existing `visible: false` or `visible: context =>
234
+ boolean` option. Update the inputs/props to change visibility at runtime. These
235
+ options are application configuration and are not saved in dashboard JSON.
236
+ Hiding a control is presentation only, not an authorization mechanism; keyboard
237
+ shortcuts and other entry points remain subject to their existing permissions.
package/dist/index.d.ts CHANGED
@@ -29,7 +29,11 @@ interface DashboardToolbarButton {
29
29
  }
30
30
  interface DashboardToolbarProps {
31
31
  toolbarButtons?: readonly DashboardToolbarButton[];
32
+ hideToolbar?: boolean;
33
+ toolbarVisibility?: DashboardToolbarVisibility;
32
34
  }
35
+ /** False hides a built-in control; omitted keys retain normal behavior. */
36
+ type DashboardToolbarVisibility = Partial<Record<'refresh' | 'filters' | 'variables' | 'print' | 'pdf' | 'json' | 'email' | 'edit' | 'share' | 'settings' | 'history' | 'undo' | 'redo' | 'reset' | 'add' | 'save' | 'import' | 'drillBack' | 'lastRefresh', boolean>>;
33
37
 
34
38
  interface ChartDataRowActionContext {
35
39
  dashboardId: string;
@@ -69,7 +73,7 @@ interface DashboardDesignerProps extends DashboardVariableProps, ChartDataAction
69
73
  /** When set, shows Edit / Done in the dashboard toolbar. */
70
74
  onToggleEdit?: () => void;
71
75
  }
72
- declare function DashboardDesigner({ dashboard: initial, apiBaseUrl, auth, locale, onChange, onSave, readOnly, onToggleEdit, predefinedVariables, variableValues, variablesReady, resolveVariables, chartDataRowActions, toolbarButtons, }: DashboardDesignerProps): React__default.JSX.Element;
76
+ declare function DashboardDesigner({ dashboard: initial, apiBaseUrl, auth, locale, onChange, onSave, readOnly, onToggleEdit, predefinedVariables, variableValues, variablesReady, resolveVariables, chartDataRowActions, toolbarButtons, hideToolbar, toolbarVisibility, }: DashboardDesignerProps): React__default.JSX.Element;
73
77
 
74
78
  interface DashboardViewerProps extends DashboardVariableProps, ChartDataActionProps, DashboardToolbarProps {
75
79
  dashboard: Dashboard;
@@ -216,6 +220,8 @@ interface ChartRendererProps {
216
220
  declare function ChartRenderer({ widget, data, locale, currency, loading, onDrillDown, onDataClick, listboxSelection, onListboxSelectionChange, chartColors, }: ChartRendererProps): React__default.JSX.Element;
217
221
 
218
222
  interface FilterBarProps {
223
+ clearable?: boolean;
224
+ suggestionRows?: Record<string, unknown>[];
219
225
  filters: FilterDef[];
220
226
  onChange: (filters: FilterDef[]) => void;
221
227
  title?: string;
@@ -231,7 +237,7 @@ interface FilterBarProps {
231
237
  /** Applied to newly added filters (where = row-level, having = aggregated). */
232
238
  defaultClause?: 'where' | 'having';
233
239
  }
234
- declare function FilterBar({ filters, onChange, title, hint, editable, fieldOptions, fieldPlaceholder, fieldEmptyLabel, fieldDisabled, hideHeader, defaultClause, }: FilterBarProps): React__default.JSX.Element;
240
+ declare function FilterBar({ filters, suggestionRows, clearable, onChange, title, hint, editable, fieldOptions, fieldPlaceholder, fieldEmptyLabel, fieldDisabled, hideHeader, defaultClause, }: FilterBarProps): React__default.JSX.Element;
235
241
 
236
242
  declare function ensureI18n(locale?: string): i18next.i18n;
237
243
 
@@ -280,4 +286,4 @@ declare function downloadDashboardJson(dashboard: Dashboard): void;
280
286
  /** Read a File as text and return JSON. */
281
287
  declare function readJsonFile(file: File): Promise<unknown>;
282
288
 
283
- export { type ChartDataActionProps, type ChartDataRowAction, type ChartDataRowActionContext, ChartRenderer, DashboardApiClient, DashboardDesigner, type DashboardDesignerProps, type DashboardToolbarButton, type DashboardToolbarContext, type DashboardToolbarProps, type DashboardVariableProps, DashboardViewer, type DashboardViewerProps, FieldHelp, type FieldHelpProps, FieldLabel, type FieldLabelProps, FilterBar, ICON_SIZE, SearchableSelect, type SearchableSelectProps, chartTypeIcon, downloadDashboardJson, ensureI18n, navIcon, readJsonFile };
289
+ export { type ChartDataActionProps, type ChartDataRowAction, type ChartDataRowActionContext, ChartRenderer, DashboardApiClient, DashboardDesigner, type DashboardDesignerProps, type DashboardToolbarButton, type DashboardToolbarContext, type DashboardToolbarProps, type DashboardToolbarVisibility, type DashboardVariableProps, DashboardViewer, type DashboardViewerProps, FieldHelp, type FieldHelpProps, FieldLabel, type FieldLabelProps, FilterBar, ICON_SIZE, SearchableSelect, type SearchableSelectProps, chartTypeIcon, downloadDashboardJson, ensureI18n, navIcon, readJsonFile };