@searsuite/sear-plugin-checkbox 0.0.0-stage → 0.0.1
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/LICENSE +29 -0
- package/README.md +8 -2
- package/dist/CheckboxCellCommitStrategy.d.ts +17 -0
- package/dist/CheckboxCellCommitStrategy.d.ts.map +1 -0
- package/dist/CheckboxCellCommitStrategy.js +25 -0
- package/dist/CheckboxCellCommitStrategy.js.map +1 -0
- package/dist/CheckboxCellTypeDefinition.d.ts +35 -0
- package/dist/CheckboxCellTypeDefinition.d.ts.map +1 -0
- package/dist/CheckboxCellTypeDefinition.js +42 -0
- package/dist/CheckboxCellTypeDefinition.js.map +1 -0
- package/dist/CheckboxCellValue.d.ts +22 -0
- package/dist/CheckboxCellValue.d.ts.map +1 -0
- package/dist/CheckboxCellValue.js +24 -0
- package/dist/CheckboxCellValue.js.map +1 -0
- package/dist/CheckboxCommands.d.ts +29 -0
- package/dist/CheckboxCommands.d.ts.map +1 -0
- package/dist/CheckboxCommands.js +15 -0
- package/dist/CheckboxCommands.js.map +1 -0
- package/dist/CheckboxError.d.ts +15 -0
- package/dist/CheckboxError.d.ts.map +1 -0
- package/dist/CheckboxError.js +19 -0
- package/dist/CheckboxError.js.map +1 -0
- package/dist/SheetCheckboxOptions.d.ts +31 -0
- package/dist/SheetCheckboxOptions.d.ts.map +1 -0
- package/dist/SheetCheckboxOptions.js +3 -0
- package/dist/SheetCheckboxOptions.js.map +1 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +34 -0
- package/dist/index.js.map +1 -0
- package/dist/normalizeCheckboxRange.d.ts +6 -0
- package/dist/normalizeCheckboxRange.d.ts.map +1 -0
- package/dist/normalizeCheckboxRange.js +25 -0
- package/dist/normalizeCheckboxRange.js.map +1 -0
- package/dist/planCheckboxWrites.d.ts +11 -0
- package/dist/planCheckboxWrites.d.ts.map +1 -0
- package/dist/planCheckboxWrites.js +85 -0
- package/dist/planCheckboxWrites.js.map +1 -0
- package/dist/render/CheckboxCell.d.ts +8 -0
- package/dist/render/CheckboxCell.d.ts.map +1 -0
- package/dist/render/CheckboxCell.js +34 -0
- package/dist/render/CheckboxCell.js.map +1 -0
- package/dist/render/CheckboxGlyphNode.d.ts +8 -0
- package/dist/render/CheckboxGlyphNode.d.ts.map +1 -0
- package/dist/render/CheckboxGlyphNode.js +46 -0
- package/dist/render/CheckboxGlyphNode.js.map +1 -0
- package/dist/render/CheckboxRenderContract.d.ts +6 -0
- package/dist/render/CheckboxRenderContract.d.ts.map +1 -0
- package/dist/render/CheckboxRenderContract.js +6 -0
- package/dist/render/CheckboxRenderContract.js.map +1 -0
- package/dist/sheetPlugin/checkbox/SheetCheckboxPlugin.d.ts +30 -0
- package/dist/sheetPlugin/checkbox/SheetCheckboxPlugin.d.ts.map +1 -0
- package/dist/sheetPlugin/checkbox/SheetCheckboxPlugin.js +143 -0
- package/dist/sheetPlugin/checkbox/SheetCheckboxPlugin.js.map +1 -0
- package/package.json +56 -3
package/LICENSE
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 LIZHAOTING (Eric)
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
22
|
+
|
|
23
|
+
## Liability
|
|
24
|
+
|
|
25
|
+
To the maximum extent permitted by applicable law, in no event shall the authors or copyright holders be liable for any claim, damages, or other liability, whether in an action of contract, tort, or otherwise, arising from, out of, or in connection with the software or the use or other dealings in the software.
|
|
26
|
+
|
|
27
|
+
## Warranty
|
|
28
|
+
|
|
29
|
+
This software is provided "as is", without warranty of any kind, express or implied, including but not limited to the warranties of merchantability, fitness for a particular purpose, and noninfringement. In no event shall the authors or copyright holders be liable for any claim, damages, or other liability, whether in an action of contract, tort, or otherwise, arising from, out of, or in connection with the software or the use or other dealings in the software.
|
package/README.md
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @searsuite/sear-plugin-checkbox
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Adds a portable checkbox cell type and typed Sheet commands.
|
|
4
|
+
|
|
5
|
+
[API reference](https://searsuite.com/docs/ref/#sear-plugin-checkbox)
|
|
6
|
+
|
|
7
|
+
## Repository
|
|
8
|
+
|
|
9
|
+
Repository: [searsuite/packages/sear-plugin-checkbox](https://github.com/SearSuite/searsuite/tree/main/packages/sear-plugin-checkbox).
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type CellCommitContext, type CellCommitStrategyDefinition } from '@searsuite/sear-domain-cell-types';
|
|
2
|
+
/** Retains checkbox identity for boolean edits, including cells governed by checkbox validation. */
|
|
3
|
+
export declare class CheckboxCellCommitStrategy implements CellCommitStrategyDefinition {
|
|
4
|
+
private readonly hasRule?;
|
|
5
|
+
/** Stable editor-local strategy identity. */ readonly key = "checkbox";
|
|
6
|
+
/** Runs before numeric/formula/string fallbacks, only for checkbox targets. */ readonly priority = 1100;
|
|
7
|
+
/** Creates a target predicate owned by the current editor. */ constructor(hasRule?: ((row: number, column: number) => boolean) | undefined);
|
|
8
|
+
/** Reports whether this strategy owns the target's edit semantics. */ matches(context: CellCommitContext): boolean;
|
|
9
|
+
/** Produces boolean cells, clears empty edits, or leaves permitted invalid warning input as text. */ commit(context: CellCommitContext): {
|
|
10
|
+
type: "string";
|
|
11
|
+
value: string;
|
|
12
|
+
} | {
|
|
13
|
+
type: string;
|
|
14
|
+
value: boolean;
|
|
15
|
+
} | null;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=CheckboxCellCommitStrategy.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CheckboxCellCommitStrategy.d.ts","sourceRoot":"","sources":["../src/CheckboxCellCommitStrategy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,KAAK,iBAAiB,EAAE,KAAK,4BAA4B,EAAE,MAAM,mCAAmC,CAAC;AAExH,oGAAoG;AACpG,qBAAa,0BAA2B,YAAW,4BAA4B;IAI3E,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC;IAH3B,6CAA6C,CAAC,SAAgB,GAAG,cAAc;IAC/E,+EAA+E,CAAC,SAAgB,QAAQ,QAAQ;IAChH,8DAA8D,aAC3C,OAAO,CAAC,GAAE,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,KAAK,OAAO,aAAA;IAErE,sEAAsE,CAAQ,OAAO,CACnF,OAAO,EAAE,iBAAiB,GACzB,OAAO;IAGV,qGAAqG,CAAQ,MAAM,CACjH,OAAO,EAAE,iBAAiB;;;;;;;CAM7B"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CheckboxCellCommitStrategy = void 0;
|
|
4
|
+
const sear_domain_cell_types_1 = require("@searsuite/sear-domain-cell-types");
|
|
5
|
+
const CheckboxCellValue_1 = require("./CheckboxCellValue");
|
|
6
|
+
/** Retains checkbox identity for boolean edits, including cells governed by checkbox validation. */
|
|
7
|
+
class CheckboxCellCommitStrategy {
|
|
8
|
+
/** Creates a target predicate owned by the current editor. */ constructor(hasRule) {
|
|
9
|
+
this.hasRule = hasRule;
|
|
10
|
+
/** Stable editor-local strategy identity. */ this.key = 'checkbox';
|
|
11
|
+
/** Runs before numeric/formula/string fallbacks, only for checkbox targets. */ this.priority = 1100;
|
|
12
|
+
}
|
|
13
|
+
/** Reports whether this strategy owns the target's edit semantics. */ matches(context) {
|
|
14
|
+
var _a, _b;
|
|
15
|
+
return ((_a = context.previous) === null || _a === void 0 ? void 0 : _a.type) === CheckboxCellValue_1.CheckboxCellType || !!((_b = this.hasRule) === null || _b === void 0 ? void 0 : _b.call(this, context.row, context.col));
|
|
16
|
+
}
|
|
17
|
+
/** Produces boolean cells, clears empty edits, or leaves permitted invalid warning input as text. */ commit(context) {
|
|
18
|
+
if (!context.plainText.trim())
|
|
19
|
+
return null;
|
|
20
|
+
const value = (0, CheckboxCellValue_1.parseCheckboxText)(context.plainText);
|
|
21
|
+
return value === null ? { type: sear_domain_cell_types_1.CellType.String, value: context.plainText } : { type: CheckboxCellValue_1.CheckboxCellType, value };
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
exports.CheckboxCellCommitStrategy = CheckboxCellCommitStrategy;
|
|
25
|
+
//# sourceMappingURL=CheckboxCellCommitStrategy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CheckboxCellCommitStrategy.js","sourceRoot":"","sources":["../src/CheckboxCellCommitStrategy.ts"],"names":[],"mappings":";;;AAAA,8EAAwH;AACxH,2DAA0E;AAC1E,oGAAoG;AACpG,MAAa,0BAA0B;IAGrC,8DAA8D,CAAC,YAC5C,OAAkD;QAAlD,YAAO,GAAP,OAAO,CAA2C;QAHrE,6CAA6C,CAAiB,QAAG,GAAG,UAAU,CAAC;QAC/E,+EAA+E,CAAiB,aAAQ,GAAG,IAAI,CAAC;IAG7G,CAAC;IACJ,sEAAsE,CAAQ,OAAO,CACnF,OAA0B;;QAE1B,OAAO,CAAA,MAAA,OAAO,CAAC,QAAQ,0CAAE,IAAI,MAAK,oCAAgB,IAAI,CAAC,CAAC,CAAA,MAAA,IAAI,CAAC,OAAO,qDAAG,OAAO,CAAC,GAAG,EAAE,OAAO,CAAC,GAAG,CAAC,CAAA,CAAC;IACnG,CAAC;IACD,qGAAqG,CAAQ,MAAM,CACjH,OAA0B;QAE1B,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,IAAI,EAAE;YAAE,OAAO,IAAI,CAAC;QAC3C,MAAM,KAAK,GAAG,IAAA,qCAAiB,EAAC,OAAO,CAAC,SAAS,CAAC,CAAC;QACnD,OAAO,KAAK,KAAK,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,iCAAQ,CAAC,MAAM,EAAE,KAAK,EAAE,OAAO,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,oCAAgB,EAAE,KAAK,EAAE,CAAC;IAClH,CAAC;CACF;AAlBD,gEAkBC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { CellTypeDefinition } from '@searsuite/sear-domain-cell';
|
|
2
|
+
import { CheckboxCellCommitStrategy } from './CheckboxCellCommitStrategy';
|
|
3
|
+
/** Atomic catalog contribution for rendering, editing, display and clipboard behavior. */
|
|
4
|
+
export declare class CheckboxCellTypeDefinition extends CellTypeDefinition {
|
|
5
|
+
private readonly hasRule?;
|
|
6
|
+
/** Persisted feature identifier. */ readonly type = "checkbox";
|
|
7
|
+
/** Binds rule-aware edit conversion to one editor. */ constructor(hasRule?: ((row: number, column: number) => boolean) | undefined);
|
|
8
|
+
/** Validates persisted booleans before creating a glyph. */ isStoredValue(cell: {
|
|
9
|
+
value?: unknown;
|
|
10
|
+
}): boolean;
|
|
11
|
+
/** Creates the checkbox edit strategy. */ createCommitStrategies(): CheckboxCellCommitStrategy[];
|
|
12
|
+
/** Registers portable glyph rendering. */ createRenderer(): import("@searsuite/sear-domain-cell").CellRendererDefinition;
|
|
13
|
+
/** Provides stable boolean text for searches and measurements. */ createDisplayTextProvider(): {
|
|
14
|
+
cellType: string;
|
|
15
|
+
getDisplayText: (cell: {
|
|
16
|
+
value?: unknown;
|
|
17
|
+
}) => string;
|
|
18
|
+
};
|
|
19
|
+
/** Preserves checkbox identity on native copies; plain text remains TRUE/FALSE. */ createClipboardCodec(): {
|
|
20
|
+
cellType: string;
|
|
21
|
+
encode: (cell: {
|
|
22
|
+
value?: unknown;
|
|
23
|
+
}) => {
|
|
24
|
+
value: unknown;
|
|
25
|
+
};
|
|
26
|
+
decode: (data: unknown) => {
|
|
27
|
+
type: string;
|
|
28
|
+
value: boolean;
|
|
29
|
+
} | null;
|
|
30
|
+
toPlainText: (cell: {
|
|
31
|
+
value?: unknown;
|
|
32
|
+
}) => string;
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=CheckboxCellTypeDefinition.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CheckboxCellTypeDefinition.d.ts","sourceRoot":"","sources":["../src/CheckboxCellTypeDefinition.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAsB,MAAM,6BAA6B,CAAC;AAErF,OAAO,EAAE,0BAA0B,EAAE,MAAM,8BAA8B,CAAC;AAE1E,0FAA0F;AAC1F,qBAAa,0BAA2B,SAAQ,kBAAkB;IAG9D,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC;IAF3B,oCAAoC,CAAC,SAAgB,IAAI,cAAoB;IAC7E,sDAAsD,aACnC,OAAO,CAAC,GAAE,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,KAAK,OAAO,aAAA;IAIrE,4DAA4D,CAAiB,aAAa,CAAC,IAAI,EAAE;QAC/F,KAAK,CAAC,EAAE,OAAO,CAAC;KACjB,GAAG,OAAO;IAGX,0CAA0C,CAAiB,sBAAsB;IAGjF,0CAA0C,CAAiB,cAAc;IAGzE,kEAAkE,CAAiB,yBAAyB;;+BAGjF;YAAE,KAAK,CAAC,EAAE,OAAO,CAAA;SAAE;;IAG9C,mFAAmF,CAAiB,oBAAoB;;uBAGrG;YAAE,KAAK,CAAC,EAAE,OAAO,CAAA;SAAE;;;uBACnB,OAAO;;;;4BAIF;YAAE,KAAK,CAAC,EAAE,OAAO,CAAA;SAAE;;CAG5C"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CheckboxCellTypeDefinition = void 0;
|
|
4
|
+
const sear_domain_cell_1 = require("@searsuite/sear-domain-cell");
|
|
5
|
+
const CheckboxCellValue_1 = require("./CheckboxCellValue");
|
|
6
|
+
const CheckboxCellCommitStrategy_1 = require("./CheckboxCellCommitStrategy");
|
|
7
|
+
const CheckboxCell_1 = require("./render/CheckboxCell");
|
|
8
|
+
/** Atomic catalog contribution for rendering, editing, display and clipboard behavior. */
|
|
9
|
+
class CheckboxCellTypeDefinition extends sear_domain_cell_1.CellTypeDefinition {
|
|
10
|
+
/** Binds rule-aware edit conversion to one editor. */ constructor(hasRule) {
|
|
11
|
+
super();
|
|
12
|
+
this.hasRule = hasRule;
|
|
13
|
+
/** Persisted feature identifier. */ this.type = CheckboxCellValue_1.CheckboxCellType;
|
|
14
|
+
}
|
|
15
|
+
/** Validates persisted booleans before creating a glyph. */ isStoredValue(cell) {
|
|
16
|
+
return typeof cell.value === 'boolean';
|
|
17
|
+
}
|
|
18
|
+
/** Creates the checkbox edit strategy. */ createCommitStrategies() {
|
|
19
|
+
return [new CheckboxCellCommitStrategy_1.CheckboxCellCommitStrategy(this.hasRule)];
|
|
20
|
+
}
|
|
21
|
+
/** Registers portable glyph rendering. */ createRenderer() {
|
|
22
|
+
return (0, sear_domain_cell_1.defineCellRenderer)(CheckboxCellValue_1.CheckboxCellType, CheckboxCell_1.CheckboxCell);
|
|
23
|
+
}
|
|
24
|
+
/** Provides stable boolean text for searches and measurements. */ createDisplayTextProvider() {
|
|
25
|
+
return {
|
|
26
|
+
cellType: CheckboxCellValue_1.CheckboxCellType,
|
|
27
|
+
getDisplayText: (cell) => (typeof cell.value === 'boolean' ? (0, CheckboxCellValue_1.checkboxText)(cell.value) : ''),
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
/** Preserves checkbox identity on native copies; plain text remains TRUE/FALSE. */ createClipboardCodec() {
|
|
31
|
+
return {
|
|
32
|
+
cellType: CheckboxCellValue_1.CheckboxCellType,
|
|
33
|
+
encode: (cell) => ({ value: cell.value }),
|
|
34
|
+
decode: (data) => data && typeof data === 'object' && typeof data.value === 'boolean'
|
|
35
|
+
? { type: CheckboxCellValue_1.CheckboxCellType, value: data.value }
|
|
36
|
+
: null,
|
|
37
|
+
toPlainText: (cell) => (typeof cell.value === 'boolean' ? (0, CheckboxCellValue_1.checkboxText)(cell.value) : ''),
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
exports.CheckboxCellTypeDefinition = CheckboxCellTypeDefinition;
|
|
42
|
+
//# sourceMappingURL=CheckboxCellTypeDefinition.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CheckboxCellTypeDefinition.js","sourceRoot":"","sources":["../src/CheckboxCellTypeDefinition.ts"],"names":[],"mappings":";;;AAAA,kEAAqF;AACrF,2DAAqE;AACrE,6EAA0E;AAC1E,wDAAqD;AACrD,0FAA0F;AAC1F,MAAa,0BAA2B,SAAQ,qCAAkB;IAEhE,sDAAsD,CAAC,YACpC,OAAkD;QAEnE,KA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C,CAAC,IAAA,gCAAY,EAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;SAC9G,CAAC;IACJ,CAAC;CACF;AAnCD,gEAmCC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { type CellMatrixElement } from '@searsuite/sear-domain-cell-types';
|
|
2
|
+
/** Stable persisted identifier owned by the checkbox extension. */
|
|
3
|
+
export declare const CheckboxCellType = "checkbox";
|
|
4
|
+
/** A checkbox's persisted boolean state. */
|
|
5
|
+
export interface CheckboxCellValue extends CellMatrixElement {
|
|
6
|
+
/** Feature-owned cell identifier. */ type: typeof CheckboxCellType;
|
|
7
|
+
/** Boolean used directly by formula semantics. */ value: boolean;
|
|
8
|
+
}
|
|
9
|
+
/** Removal policies shared by command inputs and hosts. */
|
|
10
|
+
export declare const CheckboxRemovalMode: {
|
|
11
|
+
readonly Text: "text";
|
|
12
|
+
readonly Clear: "clear";
|
|
13
|
+
};
|
|
14
|
+
/** One supported removal policy. */
|
|
15
|
+
export type CheckboxRemovalMode = (typeof CheckboxRemovalMode)[keyof typeof CheckboxRemovalMode];
|
|
16
|
+
/** Reports whether a persisted value is a well-formed checkbox. */
|
|
17
|
+
export declare function isCheckboxCell(cell: CellMatrixElement | null | undefined): cell is CheckboxCellValue;
|
|
18
|
+
/** Converts explicit boolean editor text without coercing numbers or other strings. */
|
|
19
|
+
export declare function parseCheckboxText(text: string): boolean | null;
|
|
20
|
+
/** Formats the boolean display, editor and clipboard representation. */
|
|
21
|
+
export declare function checkboxText(value: boolean): string;
|
|
22
|
+
//# sourceMappingURL=CheckboxCellValue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CheckboxCellValue.d.ts","sourceRoot":"","sources":["../src/CheckboxCellValue.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AAC3E,mEAAmE;AACnE,eAAO,MAAM,gBAAgB,aAAa,CAAC;AAC3C,4CAA4C;AAC5C,MAAM,WAAW,iBAAkB,SAAQ,iBAAiB;IAC1D,qCAAqC,CAAC,IAAI,EAAE,OAAO,gBAAgB,CAAC;IACpE,kDAAkD,CAAC,KAAK,EAAE,OAAO,CAAC;CACnE;AACD,2DAA2D;AAC3D,eAAO,MAAM,mBAAmB;;;CAA4C,CAAC;AAC7E,oCAAoC;AACpC,MAAM,MAAM,mBAAmB,GAAG,CAAC,OAAO,mBAAmB,CAAC,CAAC,MAAM,OAAO,mBAAmB,CAAC,CAAC;AACjG,mEAAmE;AACnE,wBAAgB,cAAc,CAAC,IAAI,EAAE,iBAAiB,GAAG,IAAI,GAAG,SAAS,GAAG,IAAI,IAAI,iBAAiB,CAEpG;AACD,uFAAuF;AACvF,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,GAAG,IAAI,CAG9D;AACD,wEAAwE;AACxE,wBAAgB,YAAY,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAEnD"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CheckboxRemovalMode = exports.CheckboxCellType = void 0;
|
|
4
|
+
exports.isCheckboxCell = isCheckboxCell;
|
|
5
|
+
exports.parseCheckboxText = parseCheckboxText;
|
|
6
|
+
exports.checkboxText = checkboxText;
|
|
7
|
+
/** Stable persisted identifier owned by the checkbox extension. */
|
|
8
|
+
exports.CheckboxCellType = 'checkbox';
|
|
9
|
+
/** Removal policies shared by command inputs and hosts. */
|
|
10
|
+
exports.CheckboxRemovalMode = { Text: 'text', Clear: 'clear' };
|
|
11
|
+
/** Reports whether a persisted value is a well-formed checkbox. */
|
|
12
|
+
function isCheckboxCell(cell) {
|
|
13
|
+
return (cell === null || cell === void 0 ? void 0 : cell.type) === exports.CheckboxCellType && typeof cell.value === 'boolean';
|
|
14
|
+
}
|
|
15
|
+
/** Converts explicit boolean editor text without coercing numbers or other strings. */
|
|
16
|
+
function parseCheckboxText(text) {
|
|
17
|
+
const value = text.trim().toUpperCase();
|
|
18
|
+
return value === 'TRUE' ? true : value === 'FALSE' ? false : null;
|
|
19
|
+
}
|
|
20
|
+
/** Formats the boolean display, editor and clipboard representation. */
|
|
21
|
+
function checkboxText(value) {
|
|
22
|
+
return value ? 'TRUE' : 'FALSE';
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=CheckboxCellValue.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CheckboxCellValue.js","sourceRoot":"","sources":["../src/CheckboxCellValue.ts"],"names":[],"mappings":";;;AAaA,wCAEC;AAED,8CAGC;AAED,oCAEC;AAvBD,mEAAmE;AACtD,QAAA,gBAAgB,GAAG,UAAU,CAAC;AAM3C,2DAA2D;AAC9C,QAAA,mBAAmB,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAW,CAAC;AAG7E,mEAAmE;AACnE,SAAgB,cAAc,CAAC,IAA0C;IACvE,OAAO,CAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,IAAI,MAAK,wBAAgB,IAAI,OAAO,IAAI,CAAC,KAAK,KAAK,SAAS,CAAC;AAC5E,CAAC;AACD,uFAAuF;AACvF,SAAgB,iBAAiB,CAAC,IAAY;IAC5C,MAAM,KAAK,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;IACxC,OAAO,KAAK,KAAK,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,KAAK,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC;AACpE,CAAC;AACD,wEAAwE;AACxE,SAAgB,YAAY,CAAC,KAAc;IACzC,OAAO,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC;AAClC,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { type SheetRangeInput } from '@searsuite/sear-assembly-commands';
|
|
2
|
+
import { type CheckboxRemovalMode } from './CheckboxCellValue';
|
|
3
|
+
/** Converts empty or explicit boolean cells; replacement of other content requires opt-in. */
|
|
4
|
+
export interface InsertCheckboxesInput extends SheetRangeInput {
|
|
5
|
+
/** Optional forced initial state; otherwise existing boolean states are retained. */ readonly checked?: boolean;
|
|
6
|
+
/** Explicitly replace other persisted content. */ readonly replaceExisting?: boolean;
|
|
7
|
+
}
|
|
8
|
+
/** Inserts checkbox cells in one cell-owner transaction. */
|
|
9
|
+
export declare const InsertCheckboxesCommand: import("@searsuite/sear-assembly-commands").SheetCommandDefinition<InsertCheckboxesInput, import("@searsuite/sear-assembly-commands").SheetCommandResult>;
|
|
10
|
+
/** Sets only existing checkbox cells in the range. */
|
|
11
|
+
export declare const SetCheckboxesCommand: import("@searsuite/sear-assembly-commands").SheetCommandDefinition<SheetRangeInput & {
|
|
12
|
+
readonly checked: boolean;
|
|
13
|
+
}, import("@searsuite/sear-assembly-commands").SheetCommandResult>;
|
|
14
|
+
/** Checks a mixed/unchecked range, or unchecks an entirely checked range. */
|
|
15
|
+
export declare const ToggleCheckboxesCommand: import("@searsuite/sear-assembly-commands").SheetCommandDefinition<SheetRangeInput, import("@searsuite/sear-assembly-commands").SheetCommandResult>;
|
|
16
|
+
/** Converts only existing checkbox cells to text or clears them. */
|
|
17
|
+
export declare const RemoveCheckboxesCommand: import("@searsuite/sear-assembly-commands").SheetCommandDefinition<SheetRangeInput & {
|
|
18
|
+
readonly mode?: CheckboxRemovalMode;
|
|
19
|
+
}, import("@searsuite/sear-assembly-commands").SheetCommandResult>;
|
|
20
|
+
/** Read-only aggregate of existing checkbox states. */
|
|
21
|
+
export interface CheckboxRangeStatus {
|
|
22
|
+
/** Well-formed checkbox count. */ readonly count: number;
|
|
23
|
+
/** Checked checkbox count. */ readonly checked: number;
|
|
24
|
+
/** Unchecked checkbox count. */ readonly unchecked: number;
|
|
25
|
+
/** Whether both states occur in the range. */ readonly mixed: boolean;
|
|
26
|
+
}
|
|
27
|
+
/** Reads sparse checkbox state without traversing every empty coordinate. */
|
|
28
|
+
export declare const ReadCheckboxRangeQuery: import("@searsuite/sear-assembly-commands").SheetQueryDefinition<SheetRangeInput, CheckboxRangeStatus>;
|
|
29
|
+
//# sourceMappingURL=CheckboxCommands.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CheckboxCommands.d.ts","sourceRoot":"","sources":["../src/CheckboxCommands.ts"],"names":[],"mappings":"AAAA,OAAO,EAAwC,KAAK,eAAe,EAAE,MAAM,mCAAmC,CAAC;AAC/G,OAAO,EAAE,KAAK,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC/D,8FAA8F;AAC9F,MAAM,WAAW,qBAAsB,SAAQ,eAAe;IAC5D,qFAAqF,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC;IACjH,kDAAkD,CAAC,QAAQ,CAAC,eAAe,CAAC,EAAE,OAAO,CAAC;CACvF;AACD,4DAA4D;AAC5D,eAAO,MAAM,uBAAuB,2JAAqE,CAAC;AAC1G,sDAAsD;AACtD,eAAO,MAAM,oBAAoB;sBAA4D,OAAO;kEAEnG,CAAC;AACF,6EAA6E;AAC7E,eAAO,MAAM,uBAAuB,qJAA+D,CAAC;AACpG,oEAAoE;AACpE,eAAO,MAAM,uBAAuB;oBAA0D,mBAAmB;kEAEhH,CAAC;AACF,uDAAuD;AACvD,MAAM,WAAW,mBAAmB;IAClC,kCAAkC,CAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IAC1D,8BAA8B,CAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACxD,gCAAgC,CAAC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC5D,8CAA8C,CAAC,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;CACxE;AACD,6EAA6E;AAC7E,eAAO,MAAM,sBAAsB,wGAElC,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ReadCheckboxRangeQuery = exports.RemoveCheckboxesCommand = exports.ToggleCheckboxesCommand = exports.SetCheckboxesCommand = exports.InsertCheckboxesCommand = void 0;
|
|
4
|
+
const sear_assembly_commands_1 = require("@searsuite/sear-assembly-commands");
|
|
5
|
+
/** Inserts checkbox cells in one cell-owner transaction. */
|
|
6
|
+
exports.InsertCheckboxesCommand = (0, sear_assembly_commands_1.defineSheetCommand)('sheet.checkbox.insert');
|
|
7
|
+
/** Sets only existing checkbox cells in the range. */
|
|
8
|
+
exports.SetCheckboxesCommand = (0, sear_assembly_commands_1.defineSheetCommand)('sheet.checkbox.set');
|
|
9
|
+
/** Checks a mixed/unchecked range, or unchecks an entirely checked range. */
|
|
10
|
+
exports.ToggleCheckboxesCommand = (0, sear_assembly_commands_1.defineSheetCommand)('sheet.checkbox.toggle');
|
|
11
|
+
/** Converts only existing checkbox cells to text or clears them. */
|
|
12
|
+
exports.RemoveCheckboxesCommand = (0, sear_assembly_commands_1.defineSheetCommand)('sheet.checkbox.remove');
|
|
13
|
+
/** Reads sparse checkbox state without traversing every empty coordinate. */
|
|
14
|
+
exports.ReadCheckboxRangeQuery = (0, sear_assembly_commands_1.defineSheetQuery)('sheet.checkbox.readRange');
|
|
15
|
+
//# sourceMappingURL=CheckboxCommands.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CheckboxCommands.js","sourceRoot":"","sources":["../src/CheckboxCommands.ts"],"names":[],"mappings":";;;AAAA,8EAA+G;AAO/G,4DAA4D;AAC/C,QAAA,uBAAuB,GAAG,IAAA,2CAAkB,EAAwB,uBAAuB,CAAC,CAAC;AAC1G,sDAAsD;AACzC,QAAA,oBAAoB,GAAG,IAAA,2CAAkB,EACpD,oBAAoB,CACrB,CAAC;AACF,6EAA6E;AAChE,QAAA,uBAAuB,GAAG,IAAA,2CAAkB,EAAkB,uBAAuB,CAAC,CAAC;AACpG,oEAAoE;AACvD,QAAA,uBAAuB,GAAG,IAAA,2CAAkB,EACvD,uBAAuB,CACxB,CAAC;AAQF,6EAA6E;AAChE,QAAA,sBAAsB,GAAG,IAAA,yCAAgB,EACpD,0BAA0B,CAC3B,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { SearError, type SearErrorDetails } from '@searsuite/sear-foundation-error';
|
|
2
|
+
/** Stable checkbox diagnostic codes. */
|
|
3
|
+
export declare const CheckboxErrorCode: {
|
|
4
|
+
readonly Invalid: "CHECKBOX_INVALID";
|
|
5
|
+
readonly Conflict: "CHECKBOX_CONTENT_CONFLICT";
|
|
6
|
+
readonly Limit: "CHECKBOX_RANGE_LIMIT";
|
|
7
|
+
};
|
|
8
|
+
/** One checkbox diagnostic identity. */
|
|
9
|
+
export type CheckboxErrorCode = (typeof CheckboxErrorCode)[keyof typeof CheckboxErrorCode];
|
|
10
|
+
/** Checkbox-specific public error with structured context. */
|
|
11
|
+
export declare class CheckboxError extends SearError {
|
|
12
|
+
readonly code: CheckboxErrorCode;
|
|
13
|
+
/** Creates a feature diagnostic. */ constructor(code: CheckboxErrorCode, message: string, details?: SearErrorDetails);
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=CheckboxError.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CheckboxError.d.ts","sourceRoot":"","sources":["../src/CheckboxError.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AACpF,wCAAwC;AACxC,eAAO,MAAM,iBAAiB;;;;CAIpB,CAAC;AACX,wCAAwC;AACxC,MAAM,MAAM,iBAAiB,GAAG,CAAC,OAAO,iBAAiB,CAAC,CAAC,MAAM,OAAO,iBAAiB,CAAC,CAAC;AAC3F,8DAA8D;AAC9D,qBAAa,aAAc,SAAQ,SAAS;aAEf,IAAI,EAAE,iBAAiB;IADlD,oCAAoC,aACT,IAAI,EAAE,iBAAiB,EAChD,OAAO,EAAE,MAAM,EACf,OAAO,GAAE,gBAAqB;CAIjC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CheckboxError = exports.CheckboxErrorCode = void 0;
|
|
4
|
+
const sear_foundation_error_1 = require("@searsuite/sear-foundation-error");
|
|
5
|
+
/** Stable checkbox diagnostic codes. */
|
|
6
|
+
exports.CheckboxErrorCode = {
|
|
7
|
+
Invalid: 'CHECKBOX_INVALID',
|
|
8
|
+
Conflict: 'CHECKBOX_CONTENT_CONFLICT',
|
|
9
|
+
Limit: 'CHECKBOX_RANGE_LIMIT',
|
|
10
|
+
};
|
|
11
|
+
/** Checkbox-specific public error with structured context. */
|
|
12
|
+
class CheckboxError extends sear_foundation_error_1.SearError {
|
|
13
|
+
/** Creates a feature diagnostic. */ constructor(code, message, details = {}) {
|
|
14
|
+
super(message, details);
|
|
15
|
+
this.code = code;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
exports.CheckboxError = CheckboxError;
|
|
19
|
+
//# sourceMappingURL=CheckboxError.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CheckboxError.js","sourceRoot":"","sources":["../src/CheckboxError.ts"],"names":[],"mappings":";;;AAAA,4EAAoF;AACpF,wCAAwC;AAC3B,QAAA,iBAAiB,GAAG;IAC/B,OAAO,EAAE,kBAAkB;IAC3B,QAAQ,EAAE,2BAA2B;IACrC,KAAK,EAAE,sBAAsB;CACrB,CAAC;AAGX,8DAA8D;AAC9D,MAAa,aAAc,SAAQ,iCAAS;IAC1C,oCAAoC,CAAC,YACV,IAAuB,EAChD,OAAe,EACf,UAA4B,EAAE;QAE9B,KAAK,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QAJC,SAAI,GAAJ,IAAI,CAAmB;IAKlD,CAAC;CACF;AARD,sCAQC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { type CursorRegistry } from '@searsuite/sear-render-cursor';
|
|
2
|
+
import { type CellMatrixElement, SheetCellInputValidationRegistry } from '@searsuite/sear-domain-cell-types';
|
|
3
|
+
import { type CellTypeCatalog } from '@searsuite/sear-domain-cell';
|
|
4
|
+
import { type Transaction } from '@searsuite/sear-domain-transaction';
|
|
5
|
+
import { type CellFormulaValueConverterRegistry } from '@searsuite/sear-plugin-formula';
|
|
6
|
+
import { type SheetRangeInput } from '@searsuite/sear-assembly-commands';
|
|
7
|
+
/** Planned update owned by the ordinary cell-data plugin. */
|
|
8
|
+
export interface CheckboxCellWrite {
|
|
9
|
+
/** Absolute row. */ readonly row: number;
|
|
10
|
+
/** Absolute column. */ readonly column: number;
|
|
11
|
+
/** Replacement cell; null clears it. */ readonly cell: CellMatrixElement | null;
|
|
12
|
+
}
|
|
13
|
+
/** Editor-local dependencies; checkbox state stays in the cell-data owner. */
|
|
14
|
+
export interface SheetCheckboxOptions {
|
|
15
|
+
/** Optional editor-local cursor registry. */ readonly cursor?: CursorRegistry;
|
|
16
|
+
/** Cell-type extension catalog. */ readonly catalog: CellTypeCatalog;
|
|
17
|
+
/** Formula converter registry, when formula support is installed. */ readonly formulas?: CellFormulaValueConverterRegistry;
|
|
18
|
+
/** Shared cell-edit validation registry. */ readonly inputValidation?: SheetCellInputValidationRegistry;
|
|
19
|
+
/** Reads current Sheet dimensions. */ readShape(): readonly [number, number];
|
|
20
|
+
/** Reads current persisted cell values. */ readCell(row: number, column: number): CellMatrixElement | null;
|
|
21
|
+
/** True when a merged range hides this coordinate behind its anchor. */ isMergedCoveredCell?(row: number, column: number): boolean;
|
|
22
|
+
/** Visits persisted sparse entries inside the inclusive selection. */ forEachStored(range: SheetRangeInput, visit: (cell: CellMatrixElement | null, row: number, column: number) => void): void;
|
|
23
|
+
/** Creates a semantic cell-owner transaction without mutating live data. */ createTransaction(writes: readonly CheckboxCellWrite[]): Transaction;
|
|
24
|
+
/** Reports a checkbox validation rule, including cells currently showing warning text. */ hasCheckboxRule?(row: number, column: number): boolean;
|
|
25
|
+
/** Rejects incompatible existing validation on direct checkbox commands. */ validateValue?(row: number, column: number, text: string): {
|
|
26
|
+
readonly reject: boolean;
|
|
27
|
+
readonly message?: string;
|
|
28
|
+
};
|
|
29
|
+
/** Allows the composition root to commit or reject an active edit before pointer toggling. */ beforeToggle?(): boolean;
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=SheetCheckboxOptions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SheetCheckboxOptions.d.ts","sourceRoot":"","sources":["../src/SheetCheckboxOptions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,+BAA+B,CAAC;AACpE,OAAO,EAAE,KAAK,iBAAiB,EAAE,gCAAgC,EAAE,MAAM,mCAAmC,CAAC;AAC7G,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,6BAA6B,CAAC;AACnE,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,oCAAoC,CAAC;AACtE,OAAO,EAAE,KAAK,iCAAiC,EAAE,MAAM,gCAAgC,CAAC;AACxF,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,mCAAmC,CAAC;AACzE,6DAA6D;AAC7D,MAAM,WAAW,iBAAiB;IAChC,oBAAoB,CAAC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IAC1C,uBAAuB,CAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IAChD,wCAAwC,CAAC,QAAQ,CAAC,IAAI,EAAE,iBAAiB,GAAG,IAAI,CAAC;CAClF;AACD,8EAA8E;AAC9E,MAAM,WAAW,oBAAoB;IACnC,6CAA6C,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,cAAc,CAAC;IAC/E,mCAAmC,CAAC,QAAQ,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@ -0,0 +1,13 @@
|
|
|
1
|
+
/** Portable boolean checkbox cell type, typed commands and stateless Sheet integration. @packageDocumentation */
|
|
2
|
+
export * from './CheckboxCellValue';
|
|
3
|
+
export * from './CheckboxError';
|
|
4
|
+
export * from './CheckboxCommands';
|
|
5
|
+
export * from './SheetCheckboxOptions';
|
|
6
|
+
export * from './normalizeCheckboxRange';
|
|
7
|
+
export * from './CheckboxCellCommitStrategy';
|
|
8
|
+
export * from './CheckboxCellTypeDefinition';
|
|
9
|
+
export { SheetCheckboxPlugin } from './sheetPlugin/checkbox/SheetCheckboxPlugin';
|
|
10
|
+
export { CheckboxCell } from './render/CheckboxCell';
|
|
11
|
+
export { CheckboxGlyphRole } from './render/CheckboxRenderContract';
|
|
12
|
+
export { CheckboxGlyphNode } from './render/CheckboxGlyphNode';
|
|
13
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,iHAAiH;AACjH,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,wBAAwB,CAAC;AACvC,cAAc,0BAA0B,CAAC;AACzC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,8BAA8B,CAAC;AAC7C,OAAO,EAAE,mBAAmB,EAAE,MAAM,4CAA4C,CAAC;AACjF,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AACpE,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.CheckboxGlyphNode = exports.CheckboxGlyphRole = exports.CheckboxCell = exports.SheetCheckboxPlugin = void 0;
|
|
18
|
+
/** Portable boolean checkbox cell type, typed commands and stateless Sheet integration. @packageDocumentation */
|
|
19
|
+
__exportStar(require("./CheckboxCellValue"), exports);
|
|
20
|
+
__exportStar(require("./CheckboxError"), exports);
|
|
21
|
+
__exportStar(require("./CheckboxCommands"), exports);
|
|
22
|
+
__exportStar(require("./SheetCheckboxOptions"), exports);
|
|
23
|
+
__exportStar(require("./normalizeCheckboxRange"), exports);
|
|
24
|
+
__exportStar(require("./CheckboxCellCommitStrategy"), exports);
|
|
25
|
+
__exportStar(require("./CheckboxCellTypeDefinition"), exports);
|
|
26
|
+
var SheetCheckboxPlugin_1 = require("./sheetPlugin/checkbox/SheetCheckboxPlugin");
|
|
27
|
+
Object.defineProperty(exports, "SheetCheckboxPlugin", { enumerable: true, get: function () { return SheetCheckboxPlugin_1.SheetCheckboxPlugin; } });
|
|
28
|
+
var CheckboxCell_1 = require("./render/CheckboxCell");
|
|
29
|
+
Object.defineProperty(exports, "CheckboxCell", { enumerable: true, get: function () { return CheckboxCell_1.CheckboxCell; } });
|
|
30
|
+
var CheckboxRenderContract_1 = require("./render/CheckboxRenderContract");
|
|
31
|
+
Object.defineProperty(exports, "CheckboxGlyphRole", { enumerable: true, get: function () { return CheckboxRenderContract_1.CheckboxGlyphRole; } });
|
|
32
|
+
var CheckboxGlyphNode_1 = require("./render/CheckboxGlyphNode");
|
|
33
|
+
Object.defineProperty(exports, "CheckboxGlyphNode", { enumerable: true, get: function () { return CheckboxGlyphNode_1.CheckboxGlyphNode; } });
|
|
34
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,iHAAiH;AACjH,sDAAoC;AACpC,kDAAgC;AAChC,qDAAmC;AACnC,yDAAuC;AACvC,2DAAyC;AACzC,+DAA6C;AAC7C,+DAA6C;AAC7C,kFAAiF;AAAxE,0HAAA,mBAAmB,OAAA;AAC5B,sDAAqD;AAA5C,4GAAA,YAAY,OAAA;AACrB,0EAAoE;AAA3D,2HAAA,iBAAiB,OAAA;AAC1B,gEAA+D;AAAtD,sHAAA,iBAAiB,OAAA"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type SheetRangeInput } from '@searsuite/sear-assembly-commands';
|
|
2
|
+
/** Maximum number of persisted cells one checkbox command can change. */
|
|
3
|
+
export declare const CheckboxMutationLimit = 10000;
|
|
4
|
+
/** Validates and orders a public range without limiting sparse read traversal by viewport. */
|
|
5
|
+
export declare function normalizeCheckboxRange(input: SheetRangeInput, shape: readonly [number, number]): SheetRangeInput;
|
|
6
|
+
//# sourceMappingURL=normalizeCheckboxRange.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"normalizeCheckboxRange.d.ts","sourceRoot":"","sources":["../src/normalizeCheckboxRange.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,mCAAmC,CAAC;AAEzE,yEAAyE;AACzE,eAAO,MAAM,qBAAqB,QAAQ,CAAC;AAC3C,8FAA8F;AAC9F,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,eAAe,EAAE,KAAK,EAAE,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,eAAe,CAkBhH"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CheckboxMutationLimit = void 0;
|
|
4
|
+
exports.normalizeCheckboxRange = normalizeCheckboxRange;
|
|
5
|
+
const CheckboxError_1 = require("./CheckboxError");
|
|
6
|
+
/** Maximum number of persisted cells one checkbox command can change. */
|
|
7
|
+
exports.CheckboxMutationLimit = 10000;
|
|
8
|
+
/** Validates and orders a public range without limiting sparse read traversal by viewport. */
|
|
9
|
+
function normalizeCheckboxRange(input, shape) {
|
|
10
|
+
if (!input ||
|
|
11
|
+
!Array.isArray(input.anchor) ||
|
|
12
|
+
!Array.isArray(input.focus) ||
|
|
13
|
+
input.anchor.length !== 2 ||
|
|
14
|
+
input.focus.length !== 2 ||
|
|
15
|
+
![...input.anchor, ...input.focus].every((v) => Number.isSafeInteger(v) && v >= 0))
|
|
16
|
+
throw new CheckboxError_1.CheckboxError(CheckboxError_1.CheckboxErrorCode.Invalid, 'Checkbox range requires nonnegative integer coordinates.');
|
|
17
|
+
const anchor = [
|
|
18
|
+
Math.min(input.anchor[0], input.focus[0]),
|
|
19
|
+
Math.min(input.anchor[1], input.focus[1]),
|
|
20
|
+
], focus = [Math.max(input.anchor[0], input.focus[0]), Math.max(input.anchor[1], input.focus[1])];
|
|
21
|
+
if (focus[0] >= shape[0] || focus[1] >= shape[1])
|
|
22
|
+
throw new CheckboxError_1.CheckboxError(CheckboxError_1.CheckboxErrorCode.Invalid, 'Checkbox range exceeds the Sheet.', { shape });
|
|
23
|
+
return { anchor, focus };
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=normalizeCheckboxRange.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
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K,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACnH,IAAI,KAAK,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,CAAC;QAC9C,MAAM,IAAI,6BAAa,CAAC,iCAAiB,CAAC,OAAO,EAAE,mCAAmC,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC;IACrG,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC;AAC3B,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type SheetRangeInput } from '@searsuite/sear-assembly-commands';
|
|
2
|
+
import { type SheetCheckboxOptions, type CheckboxCellWrite } from './SheetCheckboxOptions';
|
|
3
|
+
import { CheckboxRemovalMode } from './CheckboxCellValue';
|
|
4
|
+
import { type InsertCheckboxesInput, type CheckboxRangeStatus } from './CheckboxCommands';
|
|
5
|
+
/** Reads a source range sparsely, independent of viewport size. */
|
|
6
|
+
export declare function readCheckboxRange(range: SheetRangeInput, source: SheetCheckboxOptions): CheckboxRangeStatus;
|
|
7
|
+
/** Plans bounded insertion; existing formulas and non-boolean values require explicit replacement. */
|
|
8
|
+
export declare function planInsertCheckboxes(input: InsertCheckboxesInput, range: SheetRangeInput, source: SheetCheckboxOptions): CheckboxCellWrite[];
|
|
9
|
+
/** Plans sparse state changes or removal, preserving all unrelated cell contents. */
|
|
10
|
+
export declare function planCheckboxChanges(range: SheetRangeInput, source: SheetCheckboxOptions, checked: boolean | null, remove?: CheckboxRemovalMode): CheckboxCellWrite[];
|
|
11
|
+
//# sourceMappingURL=planCheckboxWrites.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"planCheckboxWrites.d.ts","sourceRoot":"","sources":["../src/planCheckboxWrites.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,mCAAmC,CAAC;AACzE,OAAO,EAAE,KAAK,oBAAoB,EAAE,KAAK,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3F,OAAO,EAEL,mBAAmB,EAIpB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,KAAK,qBAAqB,EAAE,KAAK,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAG1F,mEAAmE;AACnE,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,eAAe,EAAE,MAAM,EAAE,oBAAoB,GAAG,mBAAmB,CAU3G;AAkBD,sGAAsG;AACtG,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,qBAAqB,EAC5B,KAAK,EAAE,eAAe,EACtB,MAAM,EAAE,oBAAoB,GAC3B,iBAAiB,EAAE,CAoCrB;AACD,qFAAqF;AACrF,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,eAAe,EACtB,MAAM,EAAE,oBAAoB,EAC5B,OAAO,EAAE,OAAO,GAAG,IAAI,EACvB,MAAM,CAAC,EAAE,mBAAmB,GAC3B,iBAAiB,EAAE,CAqBrB"}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.readCheckboxRange = readCheckboxRange;
|
|
4
|
+
exports.planInsertCheckboxes = planInsertCheckboxes;
|
|
5
|
+
exports.planCheckboxChanges = planCheckboxChanges;
|
|
6
|
+
const sear_domain_cell_types_1 = require("@searsuite/sear-domain-cell-types");
|
|
7
|
+
const CheckboxCellValue_1 = require("./CheckboxCellValue");
|
|
8
|
+
const CheckboxError_1 = require("./CheckboxError");
|
|
9
|
+
const normalizeCheckboxRange_1 = require("./normalizeCheckboxRange");
|
|
10
|
+
/** Reads a source range sparsely, independent of viewport size. */
|
|
11
|
+
function readCheckboxRange(range, source) {
|
|
12
|
+
let count = 0, checked = 0;
|
|
13
|
+
source.forEachStored(range, (cell) => {
|
|
14
|
+
if ((0, CheckboxCellValue_1.isCheckboxCell)(cell)) {
|
|
15
|
+
count++;
|
|
16
|
+
if (cell.value)
|
|
17
|
+
checked++;
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
return { count, checked, unchecked: count - checked, mixed: checked > 0 && checked < count };
|
|
21
|
+
}
|
|
22
|
+
function write(row, column, cell, source) {
|
|
23
|
+
var _a, _b;
|
|
24
|
+
if ((0, CheckboxCellValue_1.isCheckboxCell)(cell)) {
|
|
25
|
+
const validation = (_a = source.validateValue) === null || _a === void 0 ? void 0 : _a.call(source, row, column, (0, CheckboxCellValue_1.checkboxText)(cell.value));
|
|
26
|
+
if (validation === null || validation === void 0 ? void 0 : validation.reject)
|
|
27
|
+
throw new CheckboxError_1.CheckboxError(CheckboxError_1.CheckboxErrorCode.Conflict, (_b = validation.message) !== null && _b !== void 0 ? _b : 'Checkbox value conflicts with cell validation.', { row, column });
|
|
28
|
+
}
|
|
29
|
+
return { row, column, cell };
|
|
30
|
+
}
|
|
31
|
+
/** Plans bounded insertion; existing formulas and non-boolean values require explicit replacement. */
|
|
32
|
+
function planInsertCheckboxes(input, range, source) {
|
|
33
|
+
var _a, _b, _c;
|
|
34
|
+
if ((input.checked !== undefined && typeof input.checked !== 'boolean') ||
|
|
35
|
+
(input.replaceExisting !== undefined && typeof input.replaceExisting !== 'boolean'))
|
|
36
|
+
throw new CheckboxError_1.CheckboxError(CheckboxError_1.CheckboxErrorCode.Invalid, 'Invalid checkbox insertion options.');
|
|
37
|
+
const size = (range.focus[0] - range.anchor[0] + 1) * (range.focus[1] - range.anchor[1] + 1);
|
|
38
|
+
if (!Number.isSafeInteger(size) || size > normalizeCheckboxRange_1.CheckboxMutationLimit)
|
|
39
|
+
throw new CheckboxError_1.CheckboxError(CheckboxError_1.CheckboxErrorCode.Limit, 'Checkbox insertion exceeds the mutation budget.', {
|
|
40
|
+
limit: normalizeCheckboxRange_1.CheckboxMutationLimit,
|
|
41
|
+
});
|
|
42
|
+
const result = [];
|
|
43
|
+
for (let row = range.anchor[0]; row <= range.focus[0]; row++)
|
|
44
|
+
for (let column = range.anchor[1]; column <= range.focus[1]; column++) {
|
|
45
|
+
if ((_a = source.isMergedCoveredCell) === null || _a === void 0 ? void 0 : _a.call(source, row, column))
|
|
46
|
+
continue;
|
|
47
|
+
const old = source.readCell(row, column), boolean = (0, CheckboxCellValue_1.isCheckboxCell)(old)
|
|
48
|
+
? old.value
|
|
49
|
+
: (old === null || old === void 0 ? void 0 : old.type) === sear_domain_cell_types_1.CellType.String && typeof old.value === 'string'
|
|
50
|
+
? (0, CheckboxCellValue_1.parseCheckboxText)(old.value)
|
|
51
|
+
: (old === null || old === void 0 ? void 0 : old.type) !== sear_domain_cell_types_1.CellType.Formula && typeof (old === null || old === void 0 ? void 0 : old.value) === 'boolean'
|
|
52
|
+
? old.value
|
|
53
|
+
: null;
|
|
54
|
+
if (old && boolean === null && !(old.type === sear_domain_cell_types_1.CellType.String && old.value === '') && !input.replaceExisting)
|
|
55
|
+
throw new CheckboxError_1.CheckboxError(CheckboxError_1.CheckboxErrorCode.Conflict, 'Selected cells contain non-boolean data. Enable replacement explicitly.', { row, column, reason: 'nonBoolean' });
|
|
56
|
+
const value = (_c = (_b = input.checked) !== null && _b !== void 0 ? _b : boolean) !== null && _c !== void 0 ? _c : false;
|
|
57
|
+
if ((0, CheckboxCellValue_1.isCheckboxCell)(old) && old.value === value)
|
|
58
|
+
continue;
|
|
59
|
+
result.push(write(row, column, (0, CheckboxCellValue_1.isCheckboxCell)(old) ? Object.assign(Object.assign({}, old), { value }) : { type: CheckboxCellValue_1.CheckboxCellType, value }, source));
|
|
60
|
+
}
|
|
61
|
+
return result;
|
|
62
|
+
}
|
|
63
|
+
/** Plans sparse state changes or removal, preserving all unrelated cell contents. */
|
|
64
|
+
function planCheckboxChanges(range, source, checked, remove) {
|
|
65
|
+
if ((checked !== null && typeof checked !== 'boolean') ||
|
|
66
|
+
(remove !== undefined && !Object.values(CheckboxCellValue_1.CheckboxRemovalMode).includes(remove)))
|
|
67
|
+
throw new CheckboxError_1.CheckboxError(CheckboxError_1.CheckboxErrorCode.Invalid, 'Invalid checkbox update options.');
|
|
68
|
+
const result = [];
|
|
69
|
+
source.forEachStored(range, (old, row, column) => {
|
|
70
|
+
if (!(0, CheckboxCellValue_1.isCheckboxCell)(old))
|
|
71
|
+
return;
|
|
72
|
+
const cell = remove === CheckboxCellValue_1.CheckboxRemovalMode.Clear
|
|
73
|
+
? null
|
|
74
|
+
: remove === CheckboxCellValue_1.CheckboxRemovalMode.Text
|
|
75
|
+
? { type: sear_domain_cell_types_1.CellType.String, value: (0, CheckboxCellValue_1.checkboxText)(old.value) }
|
|
76
|
+
: Object.assign(Object.assign({}, old), { value: checked !== null && checked !== void 0 ? checked : !old.value });
|
|
77
|
+
if (!remove && old.value === (cell === null || cell === void 0 ? void 0 : cell.value))
|
|
78
|
+
return;
|
|
79
|
+
if (result.length >= normalizeCheckboxRange_1.CheckboxMutationLimit)
|
|
80
|
+
throw new CheckboxError_1.CheckboxError(CheckboxError_1.CheckboxErrorCode.Limit, 'Checkbox update exceeds the mutation budget.');
|
|
81
|
+
result.push(write(row, column, cell, source));
|
|
82
|
+
});
|
|
83
|
+
return result;
|
|
84
|
+
}
|
|
85
|
+
//# sourceMappingURL=planCheckboxWrites.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"planCheckboxWrites.js","sourceRoot":"","sources":["../src/planCheckboxWrites.ts"],"names":[],"mappings":";;AAcA,8CAUC;AAmBD,oDAwCC;AAED,kDA0BC;AA/GD,8EAAqF;AAGrF,2DAM6B;AAE7B,mDAAmE;AACnE,qEAAiE;AACjE,mEAAmE;AACnE,SAAgB,iBAAiB,CAAC,KAAsB,EAAE,MAA4B;IACpF,IAAI,KAAK,GAAG,CAAC,EACX,OAAO,GAAG,CAAC,CAAC;IACd,MAAM,CAAC,aAAa,CAAC,KAAK,EAAE,CAAC,IAAI,EAAE,EAAE;QACnC,IAAI,IAAA,kCAAc,EAAC,IAAI,CAAC,EAAE,CAAC;YACzB,KAAK,EAA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,OAAO,EAAE,kCAAkC,CAAC,CAAC;IACzF,MAAM,MAAM,GAAwB,EAAE,CAAC;IACvC,MAAM,CAAC,aAAa,CAAC,KAAK,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,MAAM,EAAE,EAAE;QAC/C,IAAI,CAAC,IAAA,kCAAc,EAAC,GAAG,CAAC;YAAE,OAAO;QACjC,MAAM,IAAI,GACR,MAAM,KAAK,uCAAmB,CAAC,KAAK;YAClC,CAAC,CAAC,IAAI;YACN,CAAC,CAAC,MAAM,KAAK,uCAAmB,CAAC,IAAI;gBACrC,CAAC,CAAC,EAAE,IAAI,EAAE,iCAAQ,CAAC,MAAM,EAAE,KAAK,EAAE,IAAA,gCAAY,EAAC,GAAG,CAAC,KAAK,CAAC,EAAE;gBAC3D,CAAC,iCAAM,GAAG,KAAE,KAAK,EAAE,OAAO,aAAP,OAAO,cAAP,OAAO,GAAI,CAAC,GAAG,CAAC,KAAK,GAAE,CAAC;QAC/C,IAAI,CAAC,MAAM,IAAI,GAAG,CAAC,KAAK,MAAK,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,KAAK,CAAA;YAAE,OAAO;QACjD,IAAI,MAAM,CAAC,MAAM,IAAI,8CAAqB;YACxC,MAAM,IAAI,6BAAa,CAAC,iCAAiB,CAAC,KAAK,EAAE,8CAA8C,CAAC,CAAC;QACnG,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC;IAChD,CAAC,CAAC,CAAC;IACH,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Cell, type CellProperties } from '@searsuite/sear-render-registry';
|
|
2
|
+
import { FixBoxNode } from '@searsuite/sear-render-node';
|
|
3
|
+
/** Renders a centered symbol while leaving the rest of the cell available for selection. */
|
|
4
|
+
export declare class CheckboxCell extends Cell<CellProperties<boolean>> {
|
|
5
|
+
/** Creates a glyph only for well-formed boolean values. */ render(): FixBoxNode<CellProperties<boolean>>;
|
|
6
|
+
/** Preserves boolean editor, auto-size and plain-text semantics. */ getDisplayText(): string;
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=CheckboxCell.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CheckboxCell.d.ts","sourceRoot":"","sources":["../../src/render/CheckboxCell.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,KAAK,cAAc,EAAE,MAAM,iCAAiC,CAAC;AAC5E,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAGzD,4FAA4F;AAC5F,qBAAa,YAAa,SAAQ,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC;IAC7D,2DAA2D,CAAQ,MAAM,IAAI,UAAU,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC;IA4BhH,oEAAoE,CAAQ,cAAc,IAAI,MAAM;CAGrG"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CheckboxCell = void 0;
|
|
4
|
+
const CheckboxRenderContract_1 = require("./CheckboxRenderContract");
|
|
5
|
+
const sear_render_registry_1 = require("@searsuite/sear-render-registry");
|
|
6
|
+
const sear_render_node_1 = require("@searsuite/sear-render-node");
|
|
7
|
+
const CheckboxCellValue_1 = require("../CheckboxCellValue");
|
|
8
|
+
const CheckboxGlyphNode_1 = require("./CheckboxGlyphNode");
|
|
9
|
+
/** Renders a centered symbol while leaving the rest of the cell available for selection. */
|
|
10
|
+
class CheckboxCell extends sear_render_registry_1.Cell {
|
|
11
|
+
/** Creates a glyph only for well-formed boolean values. */ render() {
|
|
12
|
+
var _a, _b, _c, _d, _e;
|
|
13
|
+
const outer = new sear_render_node_1.FixBoxNode(this.positionRect, this.properties);
|
|
14
|
+
if (typeof this.data.value !== 'boolean')
|
|
15
|
+
return outer;
|
|
16
|
+
const size = Math.min(16, this.positionRect.width - 6, this.positionRect.height - 6);
|
|
17
|
+
if (size < 6)
|
|
18
|
+
return outer;
|
|
19
|
+
const merged = ((_a = this.properties.endRowIndex) !== null && _a !== void 0 ? _a : this.properties.startRowIndex) !== this.properties.startRowIndex ||
|
|
20
|
+
((_b = this.properties.endColIndex) !== null && _b !== void 0 ? _b : this.properties.startColIndex) !== this.properties.startColIndex;
|
|
21
|
+
const glyph = new CheckboxGlyphNode_1.CheckboxGlyphNode({
|
|
22
|
+
x: this.positionRect.x + (this.positionRect.width - size) / 2,
|
|
23
|
+
y: this.positionRect.y + (this.positionRect.height - size) / 2,
|
|
24
|
+
width: size,
|
|
25
|
+
height: size,
|
|
26
|
+
}, Object.assign(Object.assign({}, this.properties), { depth: ((_c = this.properties.depth) !== null && _c !== void 0 ? _c : 0) + 1, value: this.data.value, semanticOwner: CheckboxCellValue_1.CheckboxCellType, semanticRole: this.data.value ? CheckboxRenderContract_1.CheckboxGlyphRole.Checked : CheckboxRenderContract_1.CheckboxGlyphRole.Unchecked, nodeKey: `checkbox:${merged ? 'merged' : 'grid'}:${(_d = this.context.row) !== null && _d !== void 0 ? _d : this.properties.startRowIndex}:${(_e = this.context.col) !== null && _e !== void 0 ? _e : this.properties.startColIndex}` }));
|
|
27
|
+
return outer.add(glyph);
|
|
28
|
+
}
|
|
29
|
+
/** Preserves boolean editor, auto-size and plain-text semantics. */ getDisplayText() {
|
|
30
|
+
return typeof this.data.value === 'boolean' ? (0, CheckboxCellValue_1.checkboxText)(this.data.value) : '';
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
exports.CheckboxCell = CheckboxCell;
|
|
34
|
+
//# sourceMappingURL=CheckboxCell.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CheckboxCell.js","sourceRoot":"","sources":["../../src/render/CheckboxCell.ts"],"names":[],"mappings":";;;AAAA,qEAA6D;AAC7D,0EAA4E;AAC5E,kEA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,GAAG,CAAC,EACvC,KAAK,EAAE,IAAI,CAAC,IAAI,CAAC,KAAK,EACtB,aAAa,EAAE,oCAAgB,EAC/B,YAAY,EAAE,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,0CAAiB,CAAC,OAAO,CAAC,CAAC,CAAC,0CAAiB,CAAC,SAAS,EACvF,OAAO,EAAE,YAAY,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,IAAI,MAAA,IAAI,CAAC,OAAO,CAAC,GAAG,mCAAI,IAAI,CAAC,UAAU,CAAC,aAAa,IAClG,MAAA,IAAI,CAAC,OAAO,CAAC,GAAG,mCAAI,IAAI,CAAC,UAAU,CAAC,aACtC,EAAE,IAEL,CAAC;QACF,OAAO,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IAC1B,CAAC;IACD,oEAAoE,CAAQ,cAAc;QACxF,OAAO,OAAO,IAAI,CAAC,IAAI,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,IAAA,gCAAY,EAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IACnF,CAAC;CACF;AAhCD,oCAgCC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { FixBoxNode, type ClipRegion } from '@searsuite/sear-render-node';
|
|
2
|
+
import { type RenderContext } from '@searsuite/sear-render-context';
|
|
3
|
+
import { type CellProperties } from '@searsuite/sear-render-registry';
|
|
4
|
+
/** Portable checkbox symbol; its own bounds are the pointer hit region. */
|
|
5
|
+
export declare class CheckboxGlyphNode extends FixBoxNode<CellProperties<boolean>> {
|
|
6
|
+
/** Paints the symbol using paths supported by every render adapter. */ drawScene(context: RenderContext, _clip?: ClipRegion): void;
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=CheckboxGlyphNode.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CheckboxGlyphNode.d.ts","sourceRoot":"","sources":["../../src/render/CheckboxGlyphNode.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,KAAK,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAC1E,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,gCAAgC,CAAC;AACpE,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACtE,2EAA2E;AAC3E,qBAAa,iBAAkB,SAAQ,UAAU,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC;IACxE,uEAAuE,CAAiB,SAAS,CAC/F,OAAO,EAAE,aAAa,EACtB,KAAK,CAAC,EAAE,UAAU,GACjB,IAAI;CAiCR"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CheckboxGlyphNode = void 0;
|
|
4
|
+
const CheckboxCellValue_1 = require("../CheckboxCellValue");
|
|
5
|
+
const CheckboxRenderContract_1 = require("./CheckboxRenderContract");
|
|
6
|
+
const sear_render_node_1 = require("@searsuite/sear-render-node");
|
|
7
|
+
/** Portable checkbox symbol; its own bounds are the pointer hit region. */
|
|
8
|
+
class CheckboxGlyphNode extends sear_render_node_1.FixBoxNode {
|
|
9
|
+
/** Paints the symbol using paths supported by every render adapter. */ drawScene(context, _clip) {
|
|
10
|
+
context.beginNodeSemantics({
|
|
11
|
+
owner: CheckboxCellValue_1.CheckboxCellType,
|
|
12
|
+
role: this.properties.value ? CheckboxRenderContract_1.CheckboxGlyphRole.Checked : CheckboxRenderContract_1.CheckboxGlyphRole.Unchecked,
|
|
13
|
+
});
|
|
14
|
+
context.save();
|
|
15
|
+
if (_clip) {
|
|
16
|
+
context.beginPath();
|
|
17
|
+
if (Array.isArray(_clip)) {
|
|
18
|
+
_clip.forEach((p, i) => (i ? context.lineTo(...p) : context.moveTo(...p)));
|
|
19
|
+
context.closePath();
|
|
20
|
+
}
|
|
21
|
+
else
|
|
22
|
+
context.rect(_clip.x, _clip.y, _clip.width, _clip.height);
|
|
23
|
+
context.clip();
|
|
24
|
+
}
|
|
25
|
+
context.beginPath();
|
|
26
|
+
context.rect(this.x, this.y, this.width, this.height);
|
|
27
|
+
context.setFillStyle(this.properties.value ? '#256cfb' : '#ffffff');
|
|
28
|
+
context.fill();
|
|
29
|
+
context.setStrokeStyle(this.properties.value ? '#256cfb' : '#737b88');
|
|
30
|
+
context.setLineWidth(1);
|
|
31
|
+
context.stroke();
|
|
32
|
+
if (this.properties.value) {
|
|
33
|
+
context.beginPath();
|
|
34
|
+
context.moveTo(this.x + this.width * 0.2, this.y + this.height * 0.52);
|
|
35
|
+
context.lineTo(this.x + this.width * 0.43, this.y + this.height * 0.75);
|
|
36
|
+
context.lineTo(this.x + this.width * 0.82, this.y + this.height * 0.25);
|
|
37
|
+
context.setStrokeStyle('#ffffff');
|
|
38
|
+
context.setLineWidth(Math.max(1, this.width / 8));
|
|
39
|
+
context.stroke();
|
|
40
|
+
}
|
|
41
|
+
context.restore();
|
|
42
|
+
context.endNodeSemantics();
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
exports.CheckboxGlyphNode = CheckboxGlyphNode;
|
|
46
|
+
//# sourceMappingURL=CheckboxGlyphNode.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CheckboxGlyphNode.js","sourceRoot":"","sources":["../../src/render/CheckboxGlyphNode.ts"],"names":[],"mappings":";;;AAAA,4DAAwD;AACxD,qEAA6D;AAC7D,kEAA0E;AAG1E,2EAA2E;AAC3E,MAAa,iBAAkB,SAAQ,6BAAmC;IACxE,uEAAuE,CAAiB,SAAS,CAC/F,OAAsB,EACtB,KAAkB;QAElB,OAAO,CAAC,kBAAkB,CAAC;YACzB,KAAK,EAAE,oCAAgB;YACvB,IAAI,EAAE,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,0CAAiB,CAAC,OAAO,CAAC,CAAC,CAAC,0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C;YAC1B,OAAO,CAAC,SAAS,EAAE,CAAC;YACpB,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,KAAK,GAAG,GAAG,EAAE,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;YACvE,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,KAAK,GAAG,IAAI,EAAE,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;YACxE,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,KAAK,GAAG,IAAI,EAAE,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;YACxE,OAAO,CAAC,cAAc,CAAC,SAAS,CAAC,CAAC;YAClC,OAAO,CAAC,YAAY,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC;YAClD,OAAO,CAAC,MAAM,EAAE,CAAC;QACnB,CAAC;QACD,OAAO,CAAC,OAAO,EAAE,CAAC;QAClB,OAAO,CAAC,gBAAgB,EAAE,CAAC;IAC7B,CAAC;CACF;AArCD,8CAqCC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CheckboxRenderContract.d.ts","sourceRoot":"","sources":["../../src/render/CheckboxRenderContract.ts"],"names":[],"mappings":"AAAA,mFAAmF;AACnF,eAAO,MAAM,iBAAiB;;;CAA0D,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CheckboxGlyphRole = void 0;
|
|
4
|
+
/** Stable semantic state roles used by checkbox render targets and diagnostics. */
|
|
5
|
+
exports.CheckboxGlyphRole = { Checked: 'checked', Unchecked: 'unchecked' };
|
|
6
|
+
//# sourceMappingURL=CheckboxRenderContract.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CheckboxRenderContract.js","sourceRoot":"","sources":["../../src/render/CheckboxRenderContract.ts"],"names":[],"mappings":";;;AAAA,mFAAmF;AACtE,QAAA,iBAAiB,GAAG,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,WAAW,EAAW,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { Plugin, PluginKey } from '@searsuite/sear-assembly-plugin';
|
|
2
|
+
import { type SheetCommandBus, type SheetQueryRegistry } from '@searsuite/sear-assembly-commands';
|
|
3
|
+
import { type CellProperties } from '@searsuite/sear-render-registry';
|
|
4
|
+
import { type EventWithOffsetAndTarget } from '@searsuite/sear-render-event-engine';
|
|
5
|
+
import { type SheetCheckboxOptions } from '../../SheetCheckboxOptions';
|
|
6
|
+
/** Stateless feature; persistent values, history and collaboration belong to the ordinary cell owner. */
|
|
7
|
+
export declare class SheetCheckboxPlugin extends Plugin<unknown, CellProperties, null> {
|
|
8
|
+
#private;
|
|
9
|
+
private readonly options;
|
|
10
|
+
/** Editor-local DI token. */ static readonly symbol: unique symbol;
|
|
11
|
+
/** Intercepts glyph hits before selection and text editing. */ readonly depth = -25;
|
|
12
|
+
/** Stateless input features need no duplicate-depth warning. */ readonly warnOnDuplicateDepth = false;
|
|
13
|
+
/** Installs all type capabilities atomically into the owning editor's registries. */ constructor(options: SheetCheckboxOptions);
|
|
14
|
+
/** Registers owner-targeted commands; each change is one staged cell transaction. */ registerCommands(commands: SheetCommandBus): void;
|
|
15
|
+
/** Publishes sparse range-state reads. */ registerQueries(queries: SheetQueryRegistry): void;
|
|
16
|
+
/** Changes a glyph through typed selection and toggle commands, never through direct matrix mutation. */ onMouseDown(_core: unknown, event: EventWithOffsetAndTarget<CellProperties>): boolean | void;
|
|
17
|
+
/** Consumes glyph double-clicks so they do not enter text editing. */ onDblClick(_core: unknown, event: EventWithOffsetAndTarget<CellProperties>): boolean | void;
|
|
18
|
+
/** No independent document state is registered. */ registerState(): {
|
|
19
|
+
key: PluginKey;
|
|
20
|
+
state: null;
|
|
21
|
+
dataEngine: {
|
|
22
|
+
enabled: boolean;
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
/** No render configuration is contributed. */ getPluginConfig(): null;
|
|
26
|
+
/** The feature never owns or directly applies cell state. */ apply(): null;
|
|
27
|
+
/** Glyphs are rendered by the catalog's ordinary cell renderer. */ render(): null;
|
|
28
|
+
/** Restores all replaced capabilities and releases handlers idempotently. */ destroy(): void;
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=SheetCheckboxPlugin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SheetCheckboxPlugin.d.ts","sourceRoot":"","sources":["../../../src/sheetPlugin/checkbox/SheetCheckboxPlugin.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AAEpE,OAAO,EAAE,KAAK,eAAe,EAAE,KAAK,kBAAkB,EAAwB,MAAM,mCAAmC,CAAC;AAGxH,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACtE,OAAO,EAAE,KAAK,wBAAwB,EAAE,MAAM,qCAAqC,CAAC;AAcpF,OAAO,EAAE,KAAK,oBAAoB,EAA0B,MAAM,4BAA4B,CAAC;AAC/F,yGAAyG;AACzG,qBACa,mBAAoB,SAAQ,MAAM,CAAC,OAAO,EAAE,cAAc,EAAE,IAAI,CAAC;;IAQ1E,OAAO,CAAC,QAAQ,CAAC,OAAO;IAP1B,6BAA6B,CAAC,gBAAuB,MAAM,gBAAqC;IAChG,+DAA+D,CAAC,SAAyB,KAAK,OAAO;IACrG,gEAAgE,CAAC,SAAyB,oBAAoB,SACtG;IAGR,qFAAqF,aAClE,OAAO,EAAE,oBAAoB;IAuChD,qFAAqF,CAAQ,gBAAgB,CAC3G,QAAQ,EAAE,eAAe,GACxB,IAAI;IAgCP,0CAA0C,CAAQ,eAAe,CAAC,OAAO,EAAE,kBAAkB,GAAG,IAAI;IAKpG,yGAAyG,CAAQ,WAAW,CAC1H,KAAK,EAAE,OAAO,EACd,KAAK,EAAE,wBAAwB,CAAC,cAAc,CAAC,GAC9C,OAAO,GAAG,IAAI;IAcjB,sEAAsE,CAAQ,UAAU,CACtF,KAAK,EAAE,OAAO,EACd,KAAK,EAAE,wBAAwB,CAAC,cAAc,CAAC,GAC9C,OAAO,GAAG,IAAI;IAGjB,mDAAmD,CAAQ,aAAa;;;;;;;IAGxE,8CAA8C,CAAQ,eAAe,IAAI,IAAI;IAG7E,6DAA6D,CAAQ,KAAK,IAAI,IAAI;IAGlF,mEAAmE,CAAQ,MAAM,IAAI,IAAI;IAGzF,6EAA6E,CAAQ,OAAO,IAAI,IAAI;CAKrG"}
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
9
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
10
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
11
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
12
|
+
};
|
|
13
|
+
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
14
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
15
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
16
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
17
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
18
|
+
};
|
|
19
|
+
var _SheetCheckboxPlugin_commands, _SheetCheckboxPlugin_disposers;
|
|
20
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
+
exports.SheetCheckboxPlugin = void 0;
|
|
22
|
+
const sear_render_cursor_1 = require("@searsuite/sear-render-cursor");
|
|
23
|
+
const sear_assembly_plugin_1 = require("@searsuite/sear-assembly-plugin");
|
|
24
|
+
const sear_assembly_core_1 = require("@searsuite/sear-assembly-core");
|
|
25
|
+
const sear_foundation_di_1 = require("@searsuite/sear-foundation-di");
|
|
26
|
+
const sear_foundation_error_1 = require("@searsuite/sear-foundation-error");
|
|
27
|
+
const sear_plugin_selection_1 = require("@searsuite/sear-plugin-selection");
|
|
28
|
+
const sear_domain_formula_engine_1 = require("@searsuite/sear-domain-formula-engine");
|
|
29
|
+
const CheckboxCellTypeDefinition_1 = require("../../CheckboxCellTypeDefinition");
|
|
30
|
+
const CheckboxCellValue_1 = require("../../CheckboxCellValue");
|
|
31
|
+
const CheckboxCommands_1 = require("../../CheckboxCommands");
|
|
32
|
+
const normalizeCheckboxRange_1 = require("../../normalizeCheckboxRange");
|
|
33
|
+
const planCheckboxWrites_1 = require("../../planCheckboxWrites");
|
|
34
|
+
/** Stateless feature; persistent values, history and collaboration belong to the ordinary cell owner. */
|
|
35
|
+
let SheetCheckboxPlugin = class SheetCheckboxPlugin extends sear_assembly_plugin_1.Plugin {
|
|
36
|
+
/** Installs all type capabilities atomically into the owning editor's registries. */ constructor(options) {
|
|
37
|
+
super({ key: new sear_assembly_plugin_1.PluginKey('SheetCheckboxPlugin'), state: null });
|
|
38
|
+
this.options = options;
|
|
39
|
+
/** Intercepts glyph hits before selection and text editing. */ this.depth = -25;
|
|
40
|
+
/** Stateless input features need no duplicate-depth warning. */ this.warnOnDuplicateDepth = false;
|
|
41
|
+
_SheetCheckboxPlugin_commands.set(this, null);
|
|
42
|
+
_SheetCheckboxPlugin_disposers.set(this, []);
|
|
43
|
+
try {
|
|
44
|
+
if (options.cursor)
|
|
45
|
+
__classPrivateFieldGet(this, _SheetCheckboxPlugin_disposers, "f").push(options.cursor.register({
|
|
46
|
+
kind: sear_render_cursor_1.CursorRuleKind.Predicate,
|
|
47
|
+
key: 'sheet.checkbox',
|
|
48
|
+
priority: sear_render_cursor_1.CursorRulePriority.High,
|
|
49
|
+
test: (props) => props.semanticOwner === CheckboxCellValue_1.CheckboxCellType,
|
|
50
|
+
cursor: sear_render_cursor_1.CursorToken.Pointer,
|
|
51
|
+
}));
|
|
52
|
+
__classPrivateFieldGet(this, _SheetCheckboxPlugin_disposers, "f").push(options.catalog.register(new CheckboxCellTypeDefinition_1.CheckboxCellTypeDefinition(options.hasCheckboxRule)));
|
|
53
|
+
if (options.formulas)
|
|
54
|
+
__classPrivateFieldGet(this, _SheetCheckboxPlugin_disposers, "f").push(options.formulas.register({
|
|
55
|
+
cellType: CheckboxCellValue_1.CheckboxCellType,
|
|
56
|
+
toFormulaValue: (cell) => ((0, CheckboxCellValue_1.isCheckboxCell)(cell) ? cell.value : (0, sear_domain_formula_engine_1.createFormulaError)(sear_domain_formula_engine_1.FormulaErrorCode.Value)),
|
|
57
|
+
}));
|
|
58
|
+
if (options.inputValidation)
|
|
59
|
+
__classPrivateFieldGet(this, _SheetCheckboxPlugin_disposers, "f").push(options.inputValidation.register('sheet.checkbox', (row, column, text) => {
|
|
60
|
+
var _a;
|
|
61
|
+
const owns = (0, CheckboxCellValue_1.isCheckboxCell)(options.readCell(row, column)) && !((_a = options.hasCheckboxRule) === null || _a === void 0 ? void 0 : _a.call(options, row, column)), valid = !owns || !text.trim() || (0, CheckboxCellValue_1.parseCheckboxText)(text) !== null;
|
|
62
|
+
return Object.assign({ valid, reject: !valid }, (!valid ? { message: 'Checkboxes accept only TRUE or FALSE. Clear the cell to remove the checkbox.' } : {}));
|
|
63
|
+
}));
|
|
64
|
+
}
|
|
65
|
+
catch (error) {
|
|
66
|
+
this.destroy();
|
|
67
|
+
throw error;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
/** Registers owner-targeted commands; each change is one staged cell transaction. */ registerCommands(commands) {
|
|
71
|
+
if (__classPrivateFieldGet(this, _SheetCheckboxPlugin_commands, "f") && __classPrivateFieldGet(this, _SheetCheckboxPlugin_commands, "f") !== commands) {
|
|
72
|
+
throw new sear_foundation_error_1.SearError('Sheet checkbox commands are already bound to an editor.');
|
|
73
|
+
}
|
|
74
|
+
__classPrivateFieldSet(this, _SheetCheckboxPlugin_commands, commands, "f");
|
|
75
|
+
const range = (input) => (0, normalizeCheckboxRange_1.normalizeCheckboxRange)(input, this.options.readShape()), pipeline = (id, writes) => {
|
|
76
|
+
const p = new sear_assembly_core_1.Pipeline(id);
|
|
77
|
+
if (writes.length)
|
|
78
|
+
p.addTransaction('checkbox.cells', this.options.createTransaction(writes));
|
|
79
|
+
return { id, execute: () => ({ pipeline: p }) };
|
|
80
|
+
};
|
|
81
|
+
commands.register(CheckboxCommands_1.InsertCheckboxesCommand, (input) => pipeline(CheckboxCommands_1.InsertCheckboxesCommand.id, (0, planCheckboxWrites_1.planInsertCheckboxes)(input, range(input), this.options)));
|
|
82
|
+
commands.register(CheckboxCommands_1.SetCheckboxesCommand, (input) => pipeline(CheckboxCommands_1.SetCheckboxesCommand.id, (0, planCheckboxWrites_1.planCheckboxChanges)(range(input), this.options, input.checked)));
|
|
83
|
+
commands.register(CheckboxCommands_1.ToggleCheckboxesCommand, (input) => {
|
|
84
|
+
const r = range(input), state = (0, planCheckboxWrites_1.readCheckboxRange)(r, this.options);
|
|
85
|
+
return pipeline(CheckboxCommands_1.ToggleCheckboxesCommand.id, (0, planCheckboxWrites_1.planCheckboxChanges)(r, this.options, state.count === 0 ? true : state.checked !== state.count));
|
|
86
|
+
});
|
|
87
|
+
commands.register(CheckboxCommands_1.RemoveCheckboxesCommand, (input) => {
|
|
88
|
+
var _a;
|
|
89
|
+
return pipeline(CheckboxCommands_1.RemoveCheckboxesCommand.id, (0, planCheckboxWrites_1.planCheckboxChanges)(range(input), this.options, null, (_a = input.mode) !== null && _a !== void 0 ? _a : CheckboxCellValue_1.CheckboxRemovalMode.Text));
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
/** Publishes sparse range-state reads. */ registerQueries(queries) {
|
|
93
|
+
queries.register(CheckboxCommands_1.ReadCheckboxRangeQuery, (input) => (0, planCheckboxWrites_1.readCheckboxRange)((0, normalizeCheckboxRange_1.normalizeCheckboxRange)(input, this.options.readShape()), this.options));
|
|
94
|
+
}
|
|
95
|
+
/** Changes a glyph through typed selection and toggle commands, never through direct matrix mutation. */ onMouseDown(_core, event) {
|
|
96
|
+
var _a, _b;
|
|
97
|
+
const props = (_a = event.target) === null || _a === void 0 ? void 0 : _a.properties;
|
|
98
|
+
if ((props === null || props === void 0 ? void 0 : props.semanticOwner) !== CheckboxCellValue_1.CheckboxCellType || ((_b = event.origin.button) !== null && _b !== void 0 ? _b : 0) !== 0)
|
|
99
|
+
return;
|
|
100
|
+
const row = props.startRowIndex, column = props.startColIndex;
|
|
101
|
+
if (row === undefined || column === undefined || !__classPrivateFieldGet(this, _SheetCheckboxPlugin_commands, "f"))
|
|
102
|
+
return false;
|
|
103
|
+
event.origin.preventDefault();
|
|
104
|
+
if (this.options.beforeToggle && !this.options.beforeToggle())
|
|
105
|
+
return false;
|
|
106
|
+
if (__classPrivateFieldGet(this, _SheetCheckboxPlugin_commands, "f").has(sear_plugin_selection_1.SelectRangeCommand))
|
|
107
|
+
__classPrivateFieldGet(this, _SheetCheckboxPlugin_commands, "f").run(sear_plugin_selection_1.SelectRangeCommand, { anchor: [row, column], focus: [row, column] });
|
|
108
|
+
__classPrivateFieldGet(this, _SheetCheckboxPlugin_commands, "f").run(CheckboxCommands_1.ToggleCheckboxesCommand, { anchor: [row, column], focus: [row, column] });
|
|
109
|
+
event.origin.preventDefault();
|
|
110
|
+
return false;
|
|
111
|
+
}
|
|
112
|
+
/** Consumes glyph double-clicks so they do not enter text editing. */ onDblClick(_core, event) {
|
|
113
|
+
var _a;
|
|
114
|
+
if (((_a = event.target) === null || _a === void 0 ? void 0 : _a.properties.semanticOwner) === CheckboxCellValue_1.CheckboxCellType)
|
|
115
|
+
return false;
|
|
116
|
+
}
|
|
117
|
+
/** No independent document state is registered. */ registerState() {
|
|
118
|
+
return { key: this.key, state: null, dataEngine: { enabled: false } };
|
|
119
|
+
}
|
|
120
|
+
/** No render configuration is contributed. */ getPluginConfig() {
|
|
121
|
+
return null;
|
|
122
|
+
}
|
|
123
|
+
/** The feature never owns or directly applies cell state. */ apply() {
|
|
124
|
+
return null;
|
|
125
|
+
}
|
|
126
|
+
/** Glyphs are rendered by the catalog's ordinary cell renderer. */ render() {
|
|
127
|
+
return null;
|
|
128
|
+
}
|
|
129
|
+
/** Restores all replaced capabilities and releases handlers idempotently. */ destroy() {
|
|
130
|
+
this.assertRuntimeWriteAllowed();
|
|
131
|
+
__classPrivateFieldSet(this, _SheetCheckboxPlugin_commands, null, "f");
|
|
132
|
+
for (const dispose of __classPrivateFieldGet(this, _SheetCheckboxPlugin_disposers, "f").splice(0).reverse())
|
|
133
|
+
dispose();
|
|
134
|
+
}
|
|
135
|
+
};
|
|
136
|
+
exports.SheetCheckboxPlugin = SheetCheckboxPlugin;
|
|
137
|
+
_SheetCheckboxPlugin_commands = new WeakMap();
|
|
138
|
+
_SheetCheckboxPlugin_disposers = new WeakMap();
|
|
139
|
+
/** Editor-local DI token. */ SheetCheckboxPlugin.symbol = Symbol.for('SheetCheckboxPlugin');
|
|
140
|
+
exports.SheetCheckboxPlugin = SheetCheckboxPlugin = __decorate([
|
|
141
|
+
(0, sear_foundation_di_1.Injectable)()
|
|
142
|
+
], SheetCheckboxPlugin);
|
|
143
|
+
//# sourceMappingURL=SheetCheckboxPlugin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SheetCheckboxPlugin.js","sourceRoot":"","sources":["../../../src/sheetPlugin/checkbox/SheetCheckboxPlugin.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,sEAAgG;AAChG,0EAAoE;AACpE,sEAAyD;AAEzD,sEAA2D;AAC3D,4EAA6D;AAG7D,4EAAsE;AACtE,sFAA6F;AAC7F,iFAA8E;AAC9E,+DAAmH;AACnH,6DAMgC;AAChC,yEAAsE;AACtE,iEAAwG;AAExG,yGAAyG;AAElG,IAAM,mBAAmB,GAAzB,MAAM,mBAAoB,SAAQ,6BAAqC;IAO5E,qFAAqF,CAAC,YACnE,OAA6B;QAE9C,KAAK,CAAC,EAAE,GAAG,EAAE,IAAI,gCAAS,CAAC,qBAAqB,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;QAFjD,YAAO,GAAP,OAAO,CAAsB;QANhD,+DAA+D,CAA0B,UAAK,GAAG,CAAC,EAAE,CAAC;QACrG,gEAAgE,CAA0B,yBAAoB,GAC5G,KAAK,CAAC;QACR,wCAAoC,IAAI,EAAC;QAChC,yCAA6B,EAAE,EAAC;QAKvC,IAAI,CAAC;YACH,IAAI,OAAO,CAAC,MAAM;gBAChB,uBAAA,IAAI,sCAAW,CAAC,IAAI,CAClB,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC;oBACtB,IAAI,EAAE,mCAAc,CAAC,SAAS;oBAC9B,GAAG,EAAE,gBAAgB;oBACrB,QAAQ,EAAE,uCAAkB,CAAC,IAAI;oBACjC,IAAI,EAAE,CAAC,KAAK,EAAE,EAAE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Aa,MAAK,oCAAgB;YAAE,OAAO,KAAK,CAAC;IAChF,CAAC;IACD,mDAAmD,CAAQ,aAAa;QACtE,OAAO,EAAE,GAAG,EAAE,IAAI,CAAC,GAAG,EAAE,KAAK,EAAE,IAAI,EAAE,UAAU,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,CAAC;IACxE,CAAC;IACD,8CAA8C,CAAQ,eAAe;QACnE,OAAO,IAAI,CAAC;IACd,CAAC;IACD,6DAA6D,CAAQ,KAAK;QACxE,OAAO,IAAI,CAAC;IACd,CAAC;IACD,mEAAmE,CAAQ,MAAM;QAC/E,OAAO,IAAI,CAAC;IACd,CAAC;IACD,6EAA6E,CAAQ,OAAO;QAC1F,IAAI,CAAC,yBAAyB,EAAE,CAAC;QACjC,uBAAA,IAAI,iCAAa,IAAI,MAAA,CAAC;QACtB,KAAK,MAAM,OAAO,IAAI,uBAAA,IAAI,sCAAW,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,OAAO,EAAE;YAAE,OAAO,EAAE,CAAC;IACvE,CAAC;;AA7HU,kDAAmB;;;AAC9B,6BAA6B,CAAwB,0BAAM,GAAG,MAAM,CAAC,GAAG,CAAC,qBAAqB,CAAC,AAApC,CAAqC;8BADrF,mBAAmB;IAD/B,IAAA,+BAAU,GAAE;GACA,mBAAmB,CA8H/B"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,59 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@searsuite/sear-plugin-checkbox",
|
|
3
|
-
"
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"description": "Adds a portable checkbox cell type and typed Sheet commands.",
|
|
4
|
+
"version": "0.0.1",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"homepage": "https://searsuite.com/",
|
|
7
|
+
"keywords": [
|
|
8
|
+
"searsuite",
|
|
9
|
+
"spreadsheet",
|
|
10
|
+
"checkboxes",
|
|
11
|
+
"plugin"
|
|
12
|
+
],
|
|
13
|
+
"main": "./dist/index.js",
|
|
14
|
+
"types": "./dist/index.d.ts",
|
|
15
|
+
"files": [
|
|
16
|
+
"dist"
|
|
17
|
+
],
|
|
18
|
+
"dependencies": {
|
|
19
|
+
"@searsuite/sear-assembly-commands": "0.0.1",
|
|
20
|
+
"@searsuite/sear-assembly-core": "0.0.1",
|
|
21
|
+
"@searsuite/sear-assembly-plugin": "0.0.1",
|
|
22
|
+
"@searsuite/sear-domain-cell": "0.0.1",
|
|
23
|
+
"@searsuite/sear-domain-formula-engine": "0.0.1",
|
|
24
|
+
"@searsuite/sear-domain-transaction": "0.0.1",
|
|
25
|
+
"@searsuite/sear-foundation-di": "0.0.1",
|
|
26
|
+
"@searsuite/sear-foundation-error": "0.0.1",
|
|
27
|
+
"@searsuite/sear-plugin-formula": "0.0.1",
|
|
28
|
+
"@searsuite/sear-render-cursor": "0.0.1",
|
|
29
|
+
"@searsuite/sear-domain-cell-types": "0.0.1",
|
|
30
|
+
"@searsuite/sear-render-node": "0.0.1",
|
|
31
|
+
"@searsuite/sear-render-event-engine": "0.0.1",
|
|
32
|
+
"@searsuite/sear-plugin-selection": "0.0.1",
|
|
33
|
+
"@searsuite/sear-render-registry": "0.0.1",
|
|
34
|
+
"@searsuite/sear-render-context": "0.0.1"
|
|
35
|
+
},
|
|
36
|
+
"exports": {
|
|
37
|
+
".": {
|
|
38
|
+
"types": "./dist/index.d.ts",
|
|
39
|
+
"default": "./dist/index.js"
|
|
40
|
+
},
|
|
41
|
+
"./package.json": "./package.json"
|
|
42
|
+
},
|
|
43
|
+
"repository": {
|
|
44
|
+
"type": "git",
|
|
45
|
+
"url": "git+https://github.com/SearSuite/searsuite.git",
|
|
46
|
+
"directory": "packages/sear-plugin-checkbox"
|
|
47
|
+
},
|
|
48
|
+
"bugs": {
|
|
49
|
+
"url": "https://github.com/SearSuite/searsuite/issues"
|
|
50
|
+
},
|
|
51
|
+
"engines": {
|
|
52
|
+
"node": ">=22"
|
|
53
|
+
},
|
|
54
|
+
"scripts": {
|
|
55
|
+
"build": "pnpm run clean && pnpm run compile",
|
|
56
|
+
"clean": "rimraf ./dist",
|
|
57
|
+
"compile": "tsc -p tsconfig.build.json"
|
|
58
|
+
}
|
|
6
59
|
}
|