@gridkitjs/core 0.0.0-dev-20261108231420 → 0.0.0-dev-20261109083020
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 +18 -4
- package/dist/index.js +6 -5
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -576,7 +576,10 @@ interface GridMessages {
|
|
|
576
576
|
exportSelectionJson: string;
|
|
577
577
|
/** `exportSelection.xlsx` */
|
|
578
578
|
exportSelectionXlsx: string;
|
|
579
|
-
/**
|
|
579
|
+
/**
|
|
580
|
+
* Announced when an export's writer fails or the browser refuses its
|
|
581
|
+
* download, so no file is saved.
|
|
582
|
+
*/
|
|
580
583
|
exportFailed: string;
|
|
581
584
|
/** `copy.cell` */
|
|
582
585
|
copyCell: string;
|
|
@@ -590,6 +593,8 @@ interface GridMessages {
|
|
|
590
593
|
copyFailed: string;
|
|
591
594
|
/** `print` */
|
|
592
595
|
print: string;
|
|
596
|
+
/** Announced when the browser fails to print, so nothing is printed. */
|
|
597
|
+
printFailed: string;
|
|
593
598
|
}
|
|
594
599
|
/**
|
|
595
600
|
* The grid's own English, its counts printed in `locale`'s digits —
|
|
@@ -1127,8 +1132,12 @@ interface GridCommandHost {
|
|
|
1127
1132
|
* Saves an export as a file — in a browser, a download. A promise is the
|
|
1128
1133
|
* file of a writer still writing; the host waits for it, and reports a
|
|
1129
1134
|
* rejected one rather than saving.
|
|
1135
|
+
*
|
|
1136
|
+
* Returns `false` for a file it drops without saving, as a host that saves
|
|
1137
|
+
* one file at a time does with one asked for while it waits on the last.
|
|
1138
|
+
* The export command that asked then did not run.
|
|
1130
1139
|
*/
|
|
1131
|
-
readonly saveFile: (file: ExportFile | Promise<ExportFile>) => void;
|
|
1140
|
+
readonly saveFile: ((file: ExportFile | Promise<ExportFile>) => void) | ((file: ExportFile | Promise<ExportFile>) => boolean);
|
|
1132
1141
|
/**
|
|
1133
1142
|
* Puts a copy on the clipboard, as text and as HTML, and announces it —
|
|
1134
1143
|
* `count` and `unit` say what to announce — or that the browser refused.
|
|
@@ -1196,7 +1205,12 @@ interface GridCommand<Row> {
|
|
|
1196
1205
|
readonly isEnabled?: ((context: GridCommandContext<Row>) => boolean) | undefined;
|
|
1197
1206
|
/** Present for a checkable command — drawn as a checkbox item or a toggle button — and says whether it is checked. */
|
|
1198
1207
|
readonly isChecked?: ((context: GridCommandContext<Row>) => boolean) | undefined;
|
|
1199
|
-
|
|
1208
|
+
/**
|
|
1209
|
+
* Does what the command does. Returns `false` when it turns out to do
|
|
1210
|
+
* nothing after all, such as an export the host dropped, so `runCommand`
|
|
1211
|
+
* says it did not run and a renderer does not report it.
|
|
1212
|
+
*/
|
|
1213
|
+
readonly execute: ((context: GridCommandContext<Row>) => void) | ((context: GridCommandContext<Row>) => boolean);
|
|
1200
1214
|
}
|
|
1201
1215
|
|
|
1202
1216
|
/** The id of every command `builtInCommands` returns. */
|
|
@@ -3006,7 +3020,7 @@ declare function resolveCommands<Row>(commands: readonly GridCommand<Row>[] | un
|
|
|
3006
3020
|
* Runs `command` when it is visible and enabled on `context`'s target, and
|
|
3007
3021
|
* says whether it did — so a renderer reports only a command that ran, and a
|
|
3008
3022
|
* stale button or a call through the API cannot run one the grid's state no
|
|
3009
|
-
* longer allows.
|
|
3023
|
+
* longer allows. A command whose `execute` returns `false` did not run.
|
|
3010
3024
|
*/
|
|
3011
3025
|
declare function runCommand<Row>(command: GridCommand<Row>, context: GridCommandContext<Row>): boolean;
|
|
3012
3026
|
|
package/dist/index.js
CHANGED
|
@@ -3321,7 +3321,8 @@ function createDefaultMessages(locale) {
|
|
|
3321
3321
|
copySelection: "Copy selection",
|
|
3322
3322
|
copied: (count, unit) => copied(n, count, unit),
|
|
3323
3323
|
copyFailed: "Copy failed",
|
|
3324
|
-
print: "Print"
|
|
3324
|
+
print: "Print",
|
|
3325
|
+
printFailed: "Print failed"
|
|
3325
3326
|
};
|
|
3326
3327
|
}
|
|
3327
3328
|
var defaultMessages = createDefaultMessages();
|
|
@@ -3712,9 +3713,10 @@ function exportCommand({
|
|
|
3712
3713
|
selection ? { ...defaults, scope: "selection" } : defaults,
|
|
3713
3714
|
resolveExportWriters(exportWriters)
|
|
3714
3715
|
);
|
|
3715
|
-
if (file
|
|
3716
|
-
|
|
3716
|
+
if (file === null) {
|
|
3717
|
+
return;
|
|
3717
3718
|
}
|
|
3719
|
+
return context.host.saveFile(file) !== false;
|
|
3718
3720
|
}
|
|
3719
3721
|
};
|
|
3720
3722
|
}
|
|
@@ -4018,8 +4020,7 @@ function runCommand(command, context) {
|
|
|
4018
4020
|
if (!isCommandVisible(command, context) || !isCommandEnabled(command, context)) {
|
|
4019
4021
|
return false;
|
|
4020
4022
|
}
|
|
4021
|
-
command.execute(context);
|
|
4022
|
-
return true;
|
|
4023
|
+
return command.execute(context) !== false;
|
|
4023
4024
|
}
|
|
4024
4025
|
|
|
4025
4026
|
// src/menu/resolveMenu.ts
|