├── docs ├── _includes │ ├── _topnav.html │ ├── _layout_head.html │ ├── _layout_footer.html │ ├── _example_about.html │ ├── _layout_js.html │ ├── _layout_meta.html │ ├── _example_controls.html │ ├── _example_demonstrates.html │ ├── _example_sources.html │ └── _layout_css.html ├── _data │ └── globals.json ├── favicon.ico ├── _config_local.yml ├── README.md ├── index.md ├── _layouts │ ├── default.html │ └── layout-classic-examples.html ├── assets │ ├── style.css │ └── examples-classic.css ├── _config.yml ├── examples │ └── classic │ │ ├── example01-simple.html │ │ ├── example95-plugin-autotooltips.html │ │ ├── example97-frozen-columns.html │ │ ├── example03-events.html │ │ ├── example06-editing-with-undo.html │ │ ├── example05-editing.html │ │ ├── example02-formatters.html │ │ ├── example04-highlighting.html │ │ ├── example07-compound-editors.html │ │ └── example08-modal-editor-form.html └── _plugins │ └── cachebust.rb ├── src ├── core │ ├── viewrange.ts │ ├── base.ts │ ├── selection-model.ts │ ├── viewportinfo.ts │ ├── grid-plugin.ts │ ├── index.ts │ ├── grid-signals.ts │ ├── cellnavigation.ts │ ├── idataview.ts │ ├── cellrange.ts │ ├── eventargs.ts │ ├── group.ts │ ├── util.tsx │ ├── column.ts │ ├── editing.ts │ ├── draggable.ts │ └── formatting.ts ├── grid │ ├── index.ts │ ├── types.ts │ ├── render-args.ts │ ├── eventargs.ts │ ├── event-utils.ts │ ├── internal.tsx │ ├── render-row.ts │ ├── render-cell.ts │ ├── layout.ts │ ├── column-sorting.tsx │ ├── tree-columns.ts │ └── draggable.ts ├── editors │ └── index.ts ├── layouts │ ├── layout-host.ts │ ├── layout-engine.ts │ ├── basic-layout.tsx │ ├── frozen-layout.tsx │ └── layout-components.tsx ├── index.ts ├── formatters │ ├── index.ts │ └── formatters.ts └── plugins │ ├── autotooltips.ts │ ├── rowmovemanager.ts │ └── rowselectionmodel.ts ├── vitest.config.ts ├── test ├── tsconfig.json ├── core │ ├── base.spec.ts │ ├── group.spec.ts │ ├── range.spec.ts │ ├── column.spec.ts │ └── editlock.spec.ts ├── mocks │ ├── mock-signal.ts │ └── mock-layout-host.ts ├── grid │ ├── internal.spec.ts │ ├── grid.plugin.spec.ts │ ├── grid.selectionModel.spec.ts │ ├── basiclayout.spec.ts │ └── frozenlayout.spec.ts ├── layouts │ └── basic-layout.spec.tsx └── plugins │ └── autotooltips.spec.ts ├── .editorconfig ├── .gitignore ├── tsconfig.json ├── Serenity.SleekGrid.csproj ├── LICENSE ├── README.md └── package.json /docs/_includes/_topnav.html: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /docs/_data/globals.json: -------------------------------------------------------------------------------- 1 | { 2 | } 3 | -------------------------------------------------------------------------------- /docs/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/serenity-is/sleekgrid/HEAD/docs/favicon.ico -------------------------------------------------------------------------------- /docs/_config_local.yml: -------------------------------------------------------------------------------- 1 | local: true 2 | packageurl: 3 | sleekgrid: 4 | '/sleekgrid/assets/local' 5 | -------------------------------------------------------------------------------- /docs/_includes/_layout_head.html: -------------------------------------------------------------------------------- 1 | {% include _layout_meta.html %} 2 |
fromRow.
6 | * @param toCell {Integer} Optional. Ending cell. Defaults to fromCell.
7 | */
8 | export class CellRange {
9 |
10 | declare public fromRow: number;
11 | declare public fromCell: number;
12 | declare public toRow: number;
13 | declare public toCell: number;
14 |
15 | constructor(fromRow: number, fromCell: number, toRow?: number, toCell?: number) {
16 | if (toRow === undefined && toCell === undefined) {
17 | toRow = fromRow;
18 | toCell = fromCell;
19 | }
20 |
21 | this.fromRow = Math.min(fromRow, toRow);
22 | this.fromCell = Math.min(fromCell, toCell);
23 | this.toRow = Math.max(fromRow, toRow);
24 | this.toCell = Math.max(fromCell, toCell);
25 | }
26 |
27 | /***
28 | * Returns whether a range represents a single row.
29 | */
30 | isSingleRow(): boolean {
31 | return this.fromRow == this.toRow;
32 | }
33 |
34 | /***
35 | * Returns whether a range represents a single cell.
36 | */
37 | isSingleCell(): boolean {
38 | return this.fromRow == this.toRow && this.fromCell == this.toCell;
39 | }
40 |
41 | /***
42 | * Returns whether a range contains a given cell.
43 | */
44 | contains(row: number, cell: number): boolean {
45 | return row >= this.fromRow && row <= this.toRow &&
46 | cell >= this.fromCell && cell <= this.toCell;
47 | }
48 |
49 | /***
50 | * Returns a readable representation of a range.
51 | */
52 | toString(): string {
53 | if (this.isSingleCell()) {
54 | return "(" + this.fromRow + ":" + this.fromCell + ")";
55 | }
56 | else {
57 | return "(" + this.fromRow + ":" + this.fromCell + " - " + this.toRow + ":" + this.toCell + ")";
58 | }
59 | }
60 | }
61 |
--------------------------------------------------------------------------------
/test/mocks/mock-layout-host.ts:
--------------------------------------------------------------------------------
1 | import { EventEmitter } from "../../src/core";
2 | import type { Column } from "../../src/core/column";
3 | import type { RowCell } from "../../src/core/editing";
4 | import type { GridSignals } from "../../src/core/grid-signals";
5 | import { GridOptions } from "../../src/core/gridoptions";
6 | import type { ViewportInfo } from "../../src/core/viewportinfo";
7 | import type { LayoutHost } from "../../src/layouts/layout-host";
8 | import { createGridSignalsAndRefs } from "../../src/layouts/layout-refs";
9 |
10 | export function mockLayoutHost(): LayoutHost & {
11 | signals: GridSignals,
12 | opt: GridOptions