@casualoffice/sheets 0.12.0 → 0.14.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/chrome.d.cts CHANGED
@@ -7,8 +7,22 @@ import '@univerjs/core';
7
7
  interface ToolbarProps {
8
8
  /** Live API, or `null` until the editor is ready. */
9
9
  api: CasualSheetsAPI | null;
10
+ /**
11
+ * Per-control / per-group feature flags. A key set to `false` hides that
12
+ * control or group; omitted keys default to enabled. Keys:
13
+ * history · clipboard · format-painter · font · font-style · color ·
14
+ * borders · alignment · merge · number · autosum · clear-format ·
15
+ * format-cells · insert-chart · pivot-table
16
+ */
17
+ features?: Record<string, boolean>;
18
+ /**
19
+ * Host hook for dialogs the SDK has no built-in UI for (Format Cells, Insert
20
+ * Chart, PivotTable). When provided, those controls render and call this with
21
+ * a `kind`; when omitted, they are not rendered (no fake dialog).
22
+ */
23
+ onDialogRequest?: (kind: string, context?: unknown) => void;
10
24
  }
11
- declare function Toolbar({ api }: ToolbarProps): react.JSX.Element;
25
+ declare function Toolbar({ api, features, onDialogRequest }: ToolbarProps): react.JSX.Element;
12
26
 
13
27
  interface FormulaBarProps {
14
28
  /** Live API, or `null` until the editor is ready. */
@@ -61,11 +75,30 @@ interface AutoSumPickerProps {
61
75
  }
62
76
  declare function AutoSumPicker({ api }: AutoSumPickerProps): react.JSX.Element;
63
77
 
78
+ /**
79
+ * Dialog kinds the host can choose to render via `onDialogRequest`. These are
80
+ * the actions the SDK chrome can't fulfil on its own (no built-in modal). The
81
+ * string is passed straight to the host hook; the `context` (when present)
82
+ * carries the pre-resolved A1 selection so the host doesn't have to re-read it.
83
+ */
84
+ type MenuDialogKind = 'format-cells' | 'find-replace' | 'insert-cells' | 'delete-cells' | 'paste-special' | 'insert-chart' | 'insert-pivot' | 'insert-sparkline' | 'insert-function' | 'name-manager' | 'goal-seek' | 'data-validation' | 'conditional-formatting' | 'custom-sort' | 'properties' | 'about' | 'keyboard-shortcuts';
64
85
  interface MenuBarProps {
65
86
  /** Live API, or `null` until the editor is ready. */
66
87
  api: CasualSheetsAPI | null;
88
+ /**
89
+ * Per-feature toggles. A control / menu whose `feature` key is `false` is not
90
+ * rendered. Unknown / omitted keys default to enabled.
91
+ */
92
+ features?: Record<string, boolean>;
93
+ /**
94
+ * Host hook for actions the SDK can't render itself (Format Cells, Insert
95
+ * Chart, PivotTable, Find & Replace, Insert/Delete cells, …). Called with the
96
+ * dialog `kind` and an optional `context` (the active selection in A1 for
97
+ * range-seeded dialogs). When omitted, those items are not rendered.
98
+ */
99
+ onDialogRequest?: (kind: MenuDialogKind, context?: unknown) => void;
67
100
  }
68
- declare function MenuBar({ api }: MenuBarProps): react.JSX.Element;
101
+ declare function MenuBar({ api, features, onDialogRequest }: MenuBarProps): react.JSX.Element;
69
102
 
70
103
  interface NameBoxProps {
71
104
  /** Live API, or `null` until the editor is ready. */
package/dist/chrome.d.ts CHANGED
@@ -7,8 +7,22 @@ import '@univerjs/core';
7
7
  interface ToolbarProps {
8
8
  /** Live API, or `null` until the editor is ready. */
9
9
  api: CasualSheetsAPI | null;
10
+ /**
11
+ * Per-control / per-group feature flags. A key set to `false` hides that
12
+ * control or group; omitted keys default to enabled. Keys:
13
+ * history · clipboard · format-painter · font · font-style · color ·
14
+ * borders · alignment · merge · number · autosum · clear-format ·
15
+ * format-cells · insert-chart · pivot-table
16
+ */
17
+ features?: Record<string, boolean>;
18
+ /**
19
+ * Host hook for dialogs the SDK has no built-in UI for (Format Cells, Insert
20
+ * Chart, PivotTable). When provided, those controls render and call this with
21
+ * a `kind`; when omitted, they are not rendered (no fake dialog).
22
+ */
23
+ onDialogRequest?: (kind: string, context?: unknown) => void;
10
24
  }
11
- declare function Toolbar({ api }: ToolbarProps): react.JSX.Element;
25
+ declare function Toolbar({ api, features, onDialogRequest }: ToolbarProps): react.JSX.Element;
12
26
 
13
27
  interface FormulaBarProps {
14
28
  /** Live API, or `null` until the editor is ready. */
@@ -61,11 +75,30 @@ interface AutoSumPickerProps {
61
75
  }
62
76
  declare function AutoSumPicker({ api }: AutoSumPickerProps): react.JSX.Element;
63
77
 
78
+ /**
79
+ * Dialog kinds the host can choose to render via `onDialogRequest`. These are
80
+ * the actions the SDK chrome can't fulfil on its own (no built-in modal). The
81
+ * string is passed straight to the host hook; the `context` (when present)
82
+ * carries the pre-resolved A1 selection so the host doesn't have to re-read it.
83
+ */
84
+ type MenuDialogKind = 'format-cells' | 'find-replace' | 'insert-cells' | 'delete-cells' | 'paste-special' | 'insert-chart' | 'insert-pivot' | 'insert-sparkline' | 'insert-function' | 'name-manager' | 'goal-seek' | 'data-validation' | 'conditional-formatting' | 'custom-sort' | 'properties' | 'about' | 'keyboard-shortcuts';
64
85
  interface MenuBarProps {
65
86
  /** Live API, or `null` until the editor is ready. */
66
87
  api: CasualSheetsAPI | null;
88
+ /**
89
+ * Per-feature toggles. A control / menu whose `feature` key is `false` is not
90
+ * rendered. Unknown / omitted keys default to enabled.
91
+ */
92
+ features?: Record<string, boolean>;
93
+ /**
94
+ * Host hook for actions the SDK can't render itself (Format Cells, Insert
95
+ * Chart, PivotTable, Find & Replace, Insert/Delete cells, …). Called with the
96
+ * dialog `kind` and an optional `context` (the active selection in A1 for
97
+ * range-seeded dialogs). When omitted, those items are not rendered.
98
+ */
99
+ onDialogRequest?: (kind: MenuDialogKind, context?: unknown) => void;
67
100
  }
68
- declare function MenuBar({ api }: MenuBarProps): react.JSX.Element;
101
+ declare function MenuBar({ api, features, onDialogRequest }: MenuBarProps): react.JSX.Element;
69
102
 
70
103
  interface NameBoxProps {
71
104
  /** Live API, or `null` until the editor is ready. */