@gridkitjs/core 0.0.0-dev-20261109124753 → 0.0.0-dev-20261109125954

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/index.d.ts CHANGED
@@ -1142,6 +1142,13 @@ interface GridCommandHost {
1142
1142
  * The export command that asked then did not run.
1143
1143
  */
1144
1144
  readonly saveFile: ((file: ExportFile | Promise<ExportFile>) => void) | ((file: ExportFile | Promise<ExportFile>) => boolean);
1145
+ /**
1146
+ * Whether `saveFile` would save a file asked for now. An export command
1147
+ * asks first, and while it is `false` builds no file and does not run, so
1148
+ * a writer is never run for a file the host would drop. Left out, every
1149
+ * file can be saved.
1150
+ */
1151
+ readonly canSave?: (() => boolean) | undefined;
1145
1152
  /**
1146
1153
  * Puts a copy on the clipboard, as text and as HTML, and announces it —
1147
1154
  * `count` and `unit` say what to announce — or that the browser refused.
package/dist/index.js CHANGED
@@ -3710,6 +3710,9 @@ function exportCommand({
3710
3710
  isVisible: (context) => isOn(context, EXPORT_AREAS) && resolveExportWriters(context.options.exportWriters).has(format) && (!selection || context.state.rowSelection.length > 0),
3711
3711
  isEnabled: (context) => (selection ? context.selectedRows() : context.view.rows).length > 0,
3712
3712
  execute: (context) => {
3713
+ if (context.host.canSave?.() === false) {
3714
+ return false;
3715
+ }
3713
3716
  const { export: defaults = {}, exportWriters } = context.options;
3714
3717
  const file = exportFile(
3715
3718
  context,