@rivm-loculus-tools/sequence-editor 0.2.0 → 1.0.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/_chunks/EngineErrorUtil.js +18 -0
- package/dist/_chunks/EngineErrorUtil.js.map +1 -0
- package/dist/_chunks/SequenceEditor.js +311 -312
- package/dist/_chunks/SequenceEditor.js.map +1 -1
- package/dist/_chunks/SequenceEditorEventBusService.js +21 -0
- package/dist/_chunks/SequenceEditorEventBusService.js.map +1 -0
- package/dist/_chunks/SequenceEditorPageDrawer.js +112 -112
- package/dist/_chunks/SequenceEditorPageDrawer.js.map +1 -1
- package/dist/_chunks/sequenceEditorStore.js +4 -0
- package/dist/_chunks/sequenceEditorStore.js.map +1 -1
- package/dist/assets/{index-Dn92arD_.js → index-B5Du4hQk.js} +2 -2
- package/dist/assets/index-B5Du4hQk.js.map +1 -0
- package/dist/classes/services/EditorWorkerService/EditorWorkerService.d.ts +4 -6
- package/dist/classes/services/EditorWorkerService/index.js +112 -1
- package/dist/classes/services/EditorWorkerService/index.js.map +1 -0
- package/dist/classes/services/SequenceEditorEventBusService/SequenceEditorEventBusService.d.ts +2 -4
- package/dist/classes/services/SequenceEditorEventBusService/index.js +1 -16
- package/dist/classes/workers/EngineWorker/EngineWorker.d.ts +3 -2
- package/dist/classes/workers/EngineWorker/index.js +7 -8
- package/dist/classes/workers/EngineWorker/index.js.map +1 -1
- package/dist/components/app/App/App.d.ts +5 -1
- package/dist/components/app/App/index.js +7 -16
- package/dist/components/app/App/index.js.map +1 -1
- package/dist/components/ui/SequenceEditorPageDrawer/SequenceEditorPageDrawerColorForm.d.ts +1 -1
- package/dist/components/ui/SequenceEditorPageHeader/index.js +39 -38
- package/dist/components/ui/SequenceEditorPageHeader/index.js.map +1 -1
- package/dist/components/ui/SequenceEditorSearchBar/index.js +19 -18
- package/dist/components/ui/SequenceEditorSearchBar/index.js.map +1 -1
- package/dist/constants/editor.d.ts +1 -1
- package/dist/constants/editor.js.map +1 -1
- package/dist/constants/keyboard.js +36 -35
- package/dist/constants/keyboard.js.map +1 -1
- package/dist/constants/palette.d.ts +1 -1
- package/dist/constants/palette.js +138 -138
- package/dist/constants/palette.js.map +1 -1
- package/dist/models/config.models.d.ts +3 -0
- package/dist/models/config.models.js +0 -0
- package/dist/models/{model.d.ts → editor.models.d.ts} +8 -1
- package/dist/models/{model.js → editor.models.js} +6 -4
- package/dist/models/editor.models.js.map +1 -0
- package/dist/models/{palette.js → palette.models.js} +2 -2
- package/dist/models/palette.models.js.map +1 -0
- package/dist/{components/pages → pages}/SequenceEditorMainPage/index.js +25 -23
- package/dist/pages/SequenceEditorMainPage/index.js.map +1 -0
- package/dist/stores/sequenceEditorStore/sequenceEditorStore.d.ts +2 -1
- package/dist/utils/EditorUtil/EditorUtil.d.ts +3 -3
- package/dist/utils/EditorUtil/index.js +73 -64
- package/dist/utils/EditorUtil/index.js.map +1 -1
- package/dist/utils/EngineErrorUtil/index.d.ts +1 -0
- package/dist/utils/EngineErrorUtil/index.js +1 -0
- package/dist/utils/PaletteUtil/PaletteUtil.d.ts +1 -1
- package/dist/utils/PaletteUtil/index.js.map +1 -1
- package/dist/utils/SequenceEditorStandardConfigUtil/SequenceEditorStandardConfigUtil.d.ts +4 -0
- package/dist/utils/SequenceEditorStandardConfigUtil/index.d.ts +1 -0
- package/dist/utils/SequenceEditorStandardConfigUtil/index.js +19 -0
- package/dist/utils/SequenceEditorStandardConfigUtil/index.js.map +1 -0
- package/package.json +34 -30
- package/dist/_chunks/EditorWorkerService.js +0 -127
- package/dist/_chunks/EditorWorkerService.js.map +0 -1
- package/dist/assets/index-Dn92arD_.js.map +0 -1
- package/dist/classes/services/SequenceEditorEventBusService/index.js.map +0 -1
- package/dist/components/pages/EmptyWorkspace.d.ts +0 -3
- package/dist/components/pages/SequenceEditorErrorPage/SequenceEditorErrorPage.d.ts +0 -3
- package/dist/components/pages/SequenceEditorErrorPage/index.d.ts +0 -1
- package/dist/components/pages/SequenceEditorErrorPage/index.js +0 -12
- package/dist/components/pages/SequenceEditorErrorPage/index.js.map +0 -1
- package/dist/components/pages/SequenceEditorMainPage/index.js.map +0 -1
- package/dist/components/ui/SequenceEditorPage/SequenceEditorPage.d.ts +0 -5
- package/dist/components/ui/SequenceEditorPage/index.d.ts +0 -1
- package/dist/components/ui/SequenceEditorPage/index.js +0 -15
- package/dist/components/ui/SequenceEditorPage/index.js.map +0 -1
- package/dist/models/editor.d.ts +0 -6
- package/dist/models/editor.js +0 -8
- package/dist/models/editor.js.map +0 -1
- package/dist/models/index.d.ts +0 -3
- package/dist/models/model.js.map +0 -1
- package/dist/models/palette.js.map +0 -1
- /package/dist/models/{palette.d.ts → palette.models.d.ts} +0 -0
- /package/dist/{components/pages → pages}/SequenceEditorMainPage/SequenceEditorMainPage.d.ts +0 -0
- /package/dist/{components/pages → pages}/SequenceEditorMainPage/index.d.ts +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["sequenceEditorStore","SequenceEditor","BiotechOutlinedIcon","SequenceEditorMainPage","loadingStatus","useStore","state","setData","rawFasta","onClickLoadDemoData","useCallback","demoFastaText","container","FastaDataEventBusService","err","errorMessage","ErrorUtil","extraFastaDataImportDialogLoaderActions","useMemo","PageCommon","FastaNotLoaded","FastaDataImportDialogLoader","BackdropSpinner","LOADING_STATUS"],"sources":["../../../src/pages/SequenceEditorMainPage/SequenceEditorMainPage.tsx"],"sourcesContent":["import { container } from 'tsyringe';\nimport { useStore } from 'zustand';\nimport {\n useCallback,\n useMemo,\n} from 'react';\nimport { FastaDataEventBusService } from '@rivm-loculus-tools/common-frontend/classes/services/FastaDataEventBusService';\nimport { ErrorUtil } from '@rivm-loculus-tools/common-frontend/utils/ErrorUtil';\nimport { UrlUtil } from '@rivm-loculus-tools/common-frontend/utils/UrlUtil';\nimport type { DialogAction } from '@gen-epix/ui-core-components/components/Dialog';\nimport { FastaDataImportDialogLoader } from '@rivm-loculus-tools/common-frontend/components/fasta/FastaDataImportDialogLoader';\nimport { BackdropSpinner } from '@gen-epix/ui-core-components/components/BackdropSpinner';\nimport { FastaNotLoaded } from '@rivm-loculus-tools/common-frontend/components/fasta/FastaNotLoaded';\nimport BiotechOutlinedIcon from '@mui/icons-material/BiotechOutlined';\nimport { LOADING_STATUS } from '@rivm-loculus-tools/common-frontend/models/fasta.models';\nimport { PageCommon } from '@rivm-loculus-tools/common-frontend/components/ui/PageCommon';\n\nimport { sequenceEditorStore } from '../../stores/sequenceEditorStore';\nimport { SequenceEditor } from '../../components/ui/SequenceEditor';\n\n\nexport const SequenceEditorMainPage = () => {\n const loadingStatus = useStore(sequenceEditorStore, (state) => state.loadingStatus);\n const setData = useStore(sequenceEditorStore, (state) => state.setData);\n const rawFasta = useStore(sequenceEditorStore, (state) => state.rawFasta);\n\n const onClickLoadDemoData = useCallback(async () => {\n try {\n const fastaRes = await fetch('/sample-data/sarscov2_demo.fasta');\n const demoFastaText = await fastaRes.text();\n\n await setData(demoFastaText);\n container.resolve(FastaDataEventBusService).emit('onCloseImportDialog');\n } catch (err: unknown) {\n container.resolve(FastaDataEventBusService).emit('onCloseImportDialog');\n const errorMessage = `Failed to load demo dataset: ${ErrorUtil.getErrorMessage(err, 'Unknown error')}`;\n container.resolve(FastaDataEventBusService).emit('onShowImportDialog', errorMessage);\n } finally {\n UrlUtil.clearSearchParams();\n }\n }, [setData]);\n\n const extraFastaDataImportDialogLoaderActions = useMemo<DialogAction[]>(() => [\n {\n autoFocus: true,\n color: 'secondary',\n label: 'Demo (SARS-CoV-2)',\n onClick: onClickLoadDemoData,\n variant: 'contained',\n },\n ], [onClickLoadDemoData]);\n\n return (\n <PageCommon\n isNoInteraction={false}\n title={'Sequence Editor'}\n >\n {rawFasta && (\n <SequenceEditor />\n )}\n {!rawFasta && (\n <FastaNotLoaded\n description={'Load a FASTA sequence file to enable the editor.'}\n icon={<BiotechOutlinedIcon sx={{ color: 'text.disabled', fontSize: 72 }} />}\n title={'No FASTA Sequence Loaded'}\n />\n )}\n <FastaDataImportDialogLoader\n extraActions={extraFastaDataImportDialogLoaderActions}\n store={sequenceEditorStore}\n />\n <BackdropSpinner\n label={`Computing phylogenetic tree`}\n open={loadingStatus === LOADING_STATUS.LOADING}\n />\n </PageCommon>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;AAqBA,IAAaG,UAA+B;CAC1C,IAAMC,IAAgBC,EAASL,IAAsB,MAAUM,EAAM,aAAa,GAC5EC,IAAUF,EAASL,IAAsB,MAAUM,EAAM,OAAO,GAChEE,IAAWH,EAASL,IAAsB,MAAUM,EAAM,QAAQ,GAElEG,IAAsBC,EAAY,YAAY;EAClD,IAAI;GAEF,IAAMC,IAAgB,OAAM,MADL,MAAM,kCAAkC,EAAA,CAC1B,KAAK;GAG1C,AADA,MAAMJ,EAAQI,CAAa,GAC3BC,EAAU,QAAQC,CAAwB,CAAC,CAAC,KAAK,qBAAqB;EACxE,SAASC,GAAc;GACrB,EAAU,QAAQD,CAAwB,CAAC,CAAC,KAAK,qBAAqB;GACtE,IAAME,IAAe,gCAAgCC,EAAU,gBAAgBF,GAAK,eAAe;GACnG,EAAU,QAAQD,CAAwB,CAAC,CAAC,KAAK,sBAAsBE,CAAY;EACrF,UAAU;GACR,EAAQ,kBAAkB;EAC5B;CACF,GAAG,CAACR,CAAO,CAAC,GAENU,IAA0CC,QAA8B,CAC5E;EACE,WAAW;EACX,OAAO;EACP,OAAO;EACP,SAAST;EACT,SAAS;CACX,CACF,GAAG,CAACA,CAAmB,CAAC;CAExB,OACE,kBAACU,GAAD;EACE,iBAAiB;EACjB,OAAO;EAFT,UAAA;GAIGX,KACC,kBAACP,GAAD,CAAiB,CAAA;GAElB,CAACO,KACA,kBAACY,GAAD;IACE,aAAa;IACb,MAAM,kBAAClB,GAAD,EAAqB,IAAI;KAAE,OAAO;KAAiB,UAAU;IAAG,EAAI,CAAA;IAC1E,OAAO;GACR,CAAA;GAEH,kBAACmB,GAAD;IACE,cAAcJ;IACd,OAAOjB;GACR,CAAA;GACD,kBAACsB,GAAD;IACE,OAAO;IACP,MAAMlB,MAAkBmB,EAAe;GACxC,CAAA;EACS;;AAEhB"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { FastaDataStoreActions, FastaDataStoreState } from '@rivm-loculus-tools/common-frontend/stores/fastaDataStore';
|
|
2
|
-
import {
|
|
2
|
+
import { EditorSelection, EngineMeta, EngineSearchResult } from '../../models/editor.models';
|
|
3
|
+
import { AminoAcidPalette, NucleotidePalette } from '../../models/palette.models';
|
|
3
4
|
export type SequenceEditorStore = SequenceEditorStoreActions & SequenceEditorStoreState;
|
|
4
5
|
export interface SequenceEditorStoreActions extends FastaDataStoreActions {
|
|
5
6
|
setAminoAcidPalette: (palette: AminoAcidPalette) => void;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { EditorAssembly, EditorPathProperties, EditorSelection, EngineMeta, EngineSearchResult, EngineViewportResult, GridGeometry, GridRange, StatusBarSelectionStats, VisibleGridRange, EDITOR_DIRECTION } from '../../models/editor.models';
|
|
2
|
+
import { AminoAcidPalette, NucleotidePalette } from '../../models/palette.models';
|
|
3
3
|
export declare class EditorUtil {
|
|
4
4
|
static drawCanvas({ canvasElement, devicePixelRatio, geometry, meta, palette, rowNames, rowNamesStartRow, scrollLeft, scrollTop, searchResult, searchResultHighlightedIndex, selection, viewport, viewportHeight, viewportWidth, }: {
|
|
5
5
|
canvasElement: HTMLCanvasElement;
|
|
@@ -19,7 +19,7 @@ export declare class EditorUtil {
|
|
|
19
19
|
viewportWidth: number;
|
|
20
20
|
}): EditorAssembly;
|
|
21
21
|
static getExpandedSelection(currentSelection: EditorSelection, initialSelection: EditorSelection, direction: EDITOR_DIRECTION, metaData: EngineMeta): EditorSelection | null;
|
|
22
|
-
static getMovedSelection(selection: EditorSelection | null, direction: EDITOR_DIRECTION, metaData: EngineMeta): EditorSelection | null;
|
|
22
|
+
static getMovedSelection(selection: EditorSelection | null, direction: EDITOR_DIRECTION, metaData: EngineMeta | null): EditorSelection | null;
|
|
23
23
|
static getMutateArguments(selection: EditorSelection | null, metaData: EngineMeta, offset?: number): {
|
|
24
24
|
endCol: number;
|
|
25
25
|
rows: number[];
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { EDITOR_DIRECTION as t } from "../../models/editor.js";
|
|
3
|
-
import {
|
|
4
|
-
import { DEFAULT_GRID_GEOMETRY as i } from "../../constants/editor.js";
|
|
1
|
+
import { DEFAULT_GRID_GEOMETRY as e } from "../../constants/editor.js";
|
|
2
|
+
import { EDITOR_DIRECTION as t, EDITOR_PATH_PROPERTIES_TYPE as n, MATRIX_TYPE as r } from "../../models/editor.models.js";
|
|
3
|
+
import { PaletteUtil as i } from "../PaletteUtil/index.js";
|
|
5
4
|
import "../../constants/index.js";
|
|
6
5
|
//#region \0rolldown/runtime.js
|
|
7
6
|
var a = Object.create, o = Object.defineProperty, s = Object.getOwnPropertyDescriptor, c = Object.getOwnPropertyNames, l = Object.getPrototypeOf, u = Object.prototype.hasOwnProperty, d = (e, t) => () => (t || (e((t = { exports: {} }).exports, t), e = null), t.exports), f = (e, t, n, r) => {
|
|
@@ -236,77 +235,87 @@ var a = Object.create, o = Object.defineProperty, s = Object.getOwnPropertyDescr
|
|
|
236
235
|
}
|
|
237
236
|
t.exports = o;
|
|
238
237
|
})))(), 1), G = class a {
|
|
239
|
-
static drawCanvas({ canvasElement:
|
|
240
|
-
let
|
|
238
|
+
static drawCanvas({ canvasElement: e, devicePixelRatio: t, geometry: o, meta: s, palette: c, rowNames: l, rowNamesStartRow: u, scrollLeft: d, scrollTop: f, searchResult: p, searchResultHighlightedIndex: m, selection: h, viewport: g, viewportHeight: _, viewportWidth: v }) {
|
|
239
|
+
let y = {
|
|
241
240
|
cells: { pathPropertiesMap: /* @__PURE__ */ new Map() },
|
|
242
241
|
divider: { pathPropertiesMap: /* @__PURE__ */ new Map() },
|
|
243
242
|
labels: { pathPropertiesMap: /* @__PURE__ */ new Map() },
|
|
244
243
|
ruler: { pathPropertiesMap: /* @__PURE__ */ new Map() }
|
|
245
244
|
};
|
|
246
|
-
if (!
|
|
247
|
-
let
|
|
248
|
-
if (!
|
|
249
|
-
let
|
|
250
|
-
return a.draw(
|
|
251
|
-
|
|
252
|
-
let { cellHeight:
|
|
253
|
-
if (!
|
|
254
|
-
let n = Math.max(1,
|
|
255
|
-
if (
|
|
256
|
-
|
|
257
|
-
|
|
245
|
+
if (!e) return y;
|
|
246
|
+
let b = e.getContext("2d");
|
|
247
|
+
if (!b) return y;
|
|
248
|
+
let x = s.sequenceCount.toString().length, S = (e) => h?.rows?.includes(e) ?? !1, C = (e, t) => !!(h?.cells && t >= h.cells.startCol && t <= h.cells.endCol && e >= h.cells.startRow && e <= h.cells.endRow) || !!h?.cols?.includes(t) || !!S(e), w = p && m !== null ? a.searchHitAt(p, m) : null;
|
|
249
|
+
return a.draw(e, t, () => {
|
|
250
|
+
b.clearRect(0, 0, e.width, e.height);
|
|
251
|
+
let { cellHeight: t, cellWidth: s, dividerWidth: m, labelWidth: T, rulerHeight: E } = o, D = T + m, { bytes: O, cols: k, rows: A, startCol: j, startRow: M } = g, N = (p?.positions.length ?? 0) > 0, P = N ? new Uint8Array(A * k) : null, F = w ? new Uint8Array(A * k) : null, I = N ? new Uint8Array(A) : null, L = w ? new Uint8Array(A) : null, R = N ? new Path2D() : null, z = w ? new Path2D() : null, B = !1, V = !1, H = (e, t) => {
|
|
252
|
+
if (!p) return;
|
|
253
|
+
let n = Math.max(1, p.query.length), i = e.row - M;
|
|
254
|
+
if (i < 0 || i >= A) return;
|
|
255
|
+
if (e.matrix_type === r.RECORD_NAME) {
|
|
256
|
+
t.fill(1, i * k, (i + 1) * k);
|
|
257
|
+
return;
|
|
258
|
+
}
|
|
259
|
+
let o = Math.max(j, e.col), s = Math.min(j + k, e.col + n);
|
|
260
|
+
if (o >= s || !a.searchHitContainsCell(e, p.query, e.row, o)) return;
|
|
261
|
+
let c = i * k + o - j;
|
|
262
|
+
t.fill(1, c, c + s - o);
|
|
263
|
+
}, U = (e, t) => {
|
|
264
|
+
e.matrix_type === r.RECORD_NAME && e.row >= M && e.row < M + A && (t[e.row - M] = 1);
|
|
258
265
|
};
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
let
|
|
266
|
+
p && P && (p.positions.forEach((e) => H(e, P)), p.positions.forEach((e) => {
|
|
267
|
+
I && U(e, I);
|
|
268
|
+
}), w && F && (H(w, F), L && U(w, L))), b.font = "12px monospace", b.textAlign = "center", b.textBaseline = "middle";
|
|
269
|
+
for (let e = 0; e < A; e++) {
|
|
270
|
+
let r = (M + e) * t + E - f;
|
|
271
|
+
if (!(r + t < E || r > _)) for (let a = 0; a < k; a++) {
|
|
272
|
+
let o = (j + a) * s + D - d;
|
|
273
|
+
if (o + s < D || o > v) continue;
|
|
274
|
+
let l = O[e * k + a], u = j + a, f = M + e, p = l ?? "", m = String.fromCharCode(p), h = i.paletteEntryFor(c, m), g = h.background;
|
|
266
275
|
l === null ? g = "#e9eef2" : m === " " && (g = "#f7f8f9");
|
|
267
|
-
let
|
|
268
|
-
|
|
269
|
-
let x =
|
|
270
|
-
T.rect(
|
|
271
|
-
col:
|
|
276
|
+
let _ = h.foreground;
|
|
277
|
+
C(f, u) && (g = h.backgroundSelected, _ = h.foregroundSelected);
|
|
278
|
+
let x = e * k + a, S = P?.[x] === 1, w = F?.[x] === 1, T = new Path2D();
|
|
279
|
+
T.rect(o, r, s, t), T.closePath(), y.cells.pathPropertiesMap.set(T, {
|
|
280
|
+
col: u,
|
|
272
281
|
row: f,
|
|
273
282
|
type: n.CELL
|
|
274
|
-
}),
|
|
283
|
+
}), b.fillStyle = g, b.fill(T), (w || L?.[e] === 1) && (b.fillStyle = "rgba(255, 193, 7, 0.35)", b.fillRect(o + 2, r + 2, Math.max(0, s - 4), Math.max(0, t - 4))), b.fillStyle = _, b.fillText(m, o + s / 2, r + t / 2), (S || I?.[e] === 1) && R && (B = !0, R.rect(o + .5, r + .5, s - 1, t - 1), (w || L?.[e] === 1) && z && (V = !0, z.rect(o + 1, r + 1, s - 2, t - 2)));
|
|
275
284
|
}
|
|
276
285
|
}
|
|
277
|
-
|
|
278
|
-
let
|
|
279
|
-
|
|
280
|
-
for (let e = 0; e <
|
|
281
|
-
let t = (
|
|
282
|
-
t &&
|
|
283
|
-
let r = (
|
|
284
|
-
i.rect(r, 0,
|
|
285
|
-
col:
|
|
286
|
+
B && R && (b.strokeStyle = "#000000", b.lineWidth = 1, b.stroke(R)), V && z && (b.lineWidth = 2, b.stroke(z)), b.fillStyle = "#edf2f6", b.fillRect(0, 0, v, E), b.font = "12px monospace", b.textBaseline = "middle";
|
|
287
|
+
let G = [];
|
|
288
|
+
b.strokeStyle = "#9fb3c8", b.lineWidth = 1, b.beginPath();
|
|
289
|
+
for (let e = 0; e < k; e++) {
|
|
290
|
+
let t = (j + e + 1) % 10 == 0;
|
|
291
|
+
t && G.push(e);
|
|
292
|
+
let r = (j + e) * s + D - d, i = new Path2D();
|
|
293
|
+
i.rect(r, 0, s, E), i.closePath(), y.ruler.pathPropertiesMap.set(i, {
|
|
294
|
+
col: j + e,
|
|
286
295
|
type: n.RULER
|
|
287
296
|
});
|
|
288
|
-
let a = r + .5,
|
|
289
|
-
|
|
297
|
+
let a = r + .5, o = t ? 8 : 4;
|
|
298
|
+
b.moveTo(a, E), b.lineTo(a, E - o);
|
|
290
299
|
}
|
|
291
|
-
|
|
292
|
-
let t = (
|
|
293
|
-
t - r / 2 <
|
|
294
|
-
}),
|
|
295
|
-
let
|
|
296
|
-
|
|
297
|
-
for (let e = 0; e <
|
|
298
|
-
let
|
|
299
|
-
if (
|
|
300
|
+
b.stroke(), b.fillStyle = "#486581", b.textAlign = "center", G.forEach((e) => {
|
|
301
|
+
let t = (j + e) * s + D - d, n = String(j + e + 1), r = b.measureText(n).width;
|
|
302
|
+
t - r / 2 < D || t + r / 2 > v || b.fillText(n, t, E / 2);
|
|
303
|
+
}), b.textAlign = "start", b.strokeStyle = "#bcccdc", b.lineWidth = 1, b.beginPath(), b.moveTo(D + .5, 0), b.lineTo(D + .5, _), b.moveTo(0, E + .5), b.lineTo(v, E + .5), b.stroke(), b.fillStyle = "#edf2f6", b.fillRect(0, 0, D, E), b.fillStyle = "#d9e2ec", b.fillRect(T, 0, m, _);
|
|
304
|
+
let K = new Path2D();
|
|
305
|
+
K.rect(T, 0, m, _), K.closePath(), y.divider.pathPropertiesMap.set(K, { type: n.DIVIDER }), b.fillStyle = "#f8fafb", b.fillRect(0, E, T, _ - E), b.font = "12px monospace", b.textBaseline = "middle", b.save(), b.beginPath(), b.rect(0, E, T, _ - E), b.clip();
|
|
306
|
+
for (let e = 0; e < A; e++) {
|
|
307
|
+
let r = (M + e) * t + E - f;
|
|
308
|
+
if (r + t < E || r > _) continue;
|
|
300
309
|
let i = new Path2D();
|
|
301
|
-
i.rect(0,
|
|
302
|
-
row:
|
|
310
|
+
i.rect(0, r, T, t), i.closePath(), y.labels.pathPropertiesMap.set(i, {
|
|
311
|
+
row: M + e,
|
|
303
312
|
type: n.LABEL
|
|
304
313
|
});
|
|
305
|
-
let a =
|
|
306
|
-
|
|
314
|
+
let a = M + e - u, o = M + e, s = I?.[e] === 1, c = L?.[e] === 1, d = !!h?.cols || !!(h?.cells && o >= h.cells.startRow && o <= h.cells.endRow) || S(o);
|
|
315
|
+
b.fillStyle = d ? "#1565c0" : "#f8fafb", b.fillRect(0, r, T, t), s && (b.fillStyle = "#ffecb3", b.fillRect(0, r, T, t)), c && (b.fillStyle = "rgba(255, 193, 7, 0.35)", b.fillRect(2, r + 2, Math.max(0, T - 4), Math.max(0, t - 4))), b.fillStyle = d ? "#ffffff" : "#334e68", b.fillText(`${(0, W.default)(String(M + e + 1), x, "0")}: ${l[a] ?? ""}`, 8, r + t / 2);
|
|
307
316
|
}
|
|
308
|
-
|
|
309
|
-
}),
|
|
317
|
+
b.restore();
|
|
318
|
+
}), y;
|
|
310
319
|
}
|
|
311
320
|
static getExpandedSelection(e, n, r, i) {
|
|
312
321
|
let a = e.cells;
|
|
@@ -361,7 +370,7 @@ var a = Object.create, o = Object.defineProperty, s = Object.getOwnPropertyDescr
|
|
|
361
370
|
return e.rows ? e : null;
|
|
362
371
|
}
|
|
363
372
|
static getMovedSelection(e, n, r) {
|
|
364
|
-
if (!e) return null;
|
|
373
|
+
if (!e || !r) return null;
|
|
365
374
|
let i = n === t.LEFT || n === t.UP ? -1 : 1, a = (e, t, n) => i < 0 ? e > 0 : t < n - 1, o = e.cells;
|
|
366
375
|
if (o) return n === t.LEFT || n === t.RIGHT ? a(o.startCol, o.endCol, r.alignmentWidth) ? { cells: {
|
|
367
376
|
endCol: o.endCol + i,
|
|
@@ -493,14 +502,14 @@ var a = Object.create, o = Object.defineProperty, s = Object.getOwnPropertyDescr
|
|
|
493
502
|
rows: a
|
|
494
503
|
};
|
|
495
504
|
}
|
|
496
|
-
static getVisibleGridRange(
|
|
497
|
-
let { geometry:
|
|
505
|
+
static getVisibleGridRange(t) {
|
|
506
|
+
let { geometry: n = e, numCols: r, numRows: i, scrollLeft: a, scrollTop: o, viewportHeight: s, viewportWidth: c } = t, l = n.labelWidth + n.dividerWidth, u = Math.max(0, Math.floor(a / n.cellWidth)), d = Math.min(r, u + Math.max(1, Math.ceil((c - l) / n.cellWidth) + 1)), f = Math.max(0, Math.floor(Math.max(0, o - n.rulerHeight) / n.cellHeight)), p = Math.min(i, f + Math.max(1, Math.ceil((s - n.rulerHeight) / n.cellHeight) + 1));
|
|
498
507
|
return {
|
|
499
508
|
cache: {
|
|
500
|
-
endCol: Math.min(
|
|
501
|
-
endRow: Math.min(
|
|
502
|
-
startCol: Math.max(0, u -
|
|
503
|
-
startRow: Math.max(0, f -
|
|
509
|
+
endCol: Math.min(r, d + n.numOverscanCols),
|
|
510
|
+
endRow: Math.min(i, p + n.numOverscanRows),
|
|
511
|
+
startCol: Math.max(0, u - n.numOverscanCols),
|
|
512
|
+
startRow: Math.max(0, f - n.numOverscanRows)
|
|
504
513
|
},
|
|
505
514
|
visible: {
|
|
506
515
|
endCol: d,
|