@pixerate/editor-svelte 0.8.0 → 0.9.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/index.d.ts +70 -7
- package/dist/index.js +327 -206
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/src/EditableTextNodeEditor.svelte +4 -1
- package/src/createNavigationGuard.svelte.ts +97 -0
- package/src/index.d.ts +70 -7
- package/src/index.ts +23 -4
- package/src/navigationGuard.ts +82 -0
package/dist/index.js
CHANGED
|
@@ -43,7 +43,7 @@ var root = $2.from_html(`<div class="flex items-center justify-center p-4 text-s
|
|
|
43
43
|
var root_1 = $2.from_html(`<div draggable="false"><!> <div></div></div>`);
|
|
44
44
|
function EditableTextNodeEditor($$anchor, $$props) {
|
|
45
45
|
$2.push($$props, true);
|
|
46
|
-
let className = $2.prop($$props, "class", 3, ""), editorClass = $2.prop($$props, "editorClass", 3, ""), content = $2.prop($$props, "content", 3, void 0), showMenu = $2.prop($$props, "showMenu", 3, true), editable = $2.prop($$props, "editable", 3, true), editor = $2.prop($$props, "editor", 15), extensions = $2.prop($$props, "extensions", 19, () => []), placeholder = $2.prop($$props, "placeholder", 3, ""), markdown = $2.prop($$props, "markdown", 3, void 0), richTextOptions = $2.prop($$props, "richTextOptions", 19, () => ({})), autofocus = $2.prop($$props, "autofocus", 3, false), image = $2.prop($$props, "image", 3, void 0), uploadImage = $2.prop($$props, "uploadImage", 3, void 0);
|
|
46
|
+
let className = $2.prop($$props, "class", 3, ""), editorClass = $2.prop($$props, "editorClass", 3, ""), content = $2.prop($$props, "content", 3, void 0), showMenu = $2.prop($$props, "showMenu", 3, true), editable = $2.prop($$props, "editable", 3, true), editor = $2.prop($$props, "editor", 15), extensions = $2.prop($$props, "extensions", 19, () => []), placeholder = $2.prop($$props, "placeholder", 3, ""), markdown = $2.prop($$props, "markdown", 3, void 0), richTextOptions = $2.prop($$props, "richTextOptions", 19, () => ({})), autofocus = $2.prop($$props, "autofocus", 3, false), image = $2.prop($$props, "image", 3, void 0), uploadImage = $2.prop($$props, "uploadImage", 3, void 0), onUploadError = $2.prop($$props, "onUploadError", 3, void 0);
|
|
47
47
|
let element = $2.state(void 0);
|
|
48
48
|
$2.user_effect(() => {
|
|
49
49
|
if (editor() && editor().isEditable !== editable()) {
|
|
@@ -55,10 +55,11 @@ function EditableTextNodeEditor($$anchor, $$props) {
|
|
|
55
55
|
richTextOptions: {
|
|
56
56
|
placeholder: placeholder(),
|
|
57
57
|
...markdown() !== void 0 ? { markdown: markdown() } : {},
|
|
58
|
-
...image() !== void 0 || uploadImage() !== void 0 ? {
|
|
58
|
+
...image() !== void 0 || uploadImage() !== void 0 || onUploadError() !== void 0 ? {
|
|
59
59
|
image: image() === false ? false : {
|
|
60
60
|
...typeof image() === "object" ? image() : {},
|
|
61
|
-
...uploadImage() ? { upload: uploadImage() } : {}
|
|
61
|
+
...uploadImage() ? { upload: uploadImage() } : {},
|
|
62
|
+
...onUploadError() ? { onUploadError: onUploadError() } : {}
|
|
62
63
|
}
|
|
63
64
|
} : {},
|
|
64
65
|
...richTextOptions()
|
|
@@ -228,29 +229,144 @@ function TemplateRenderer($$anchor, $$props) {
|
|
|
228
229
|
}
|
|
229
230
|
$4.delegate(["click"]);
|
|
230
231
|
|
|
232
|
+
// src/navigationGuard.ts
|
|
233
|
+
function navigationGuard(node, options) {
|
|
234
|
+
let isDirty = options.isDirty;
|
|
235
|
+
let enabled = options.enabled ?? true;
|
|
236
|
+
let onBlocked = options.onBlocked;
|
|
237
|
+
function handleBeforeUnload(e) {
|
|
238
|
+
if (!enabled || !isDirty) return;
|
|
239
|
+
e.preventDefault();
|
|
240
|
+
e.returnValue = "";
|
|
241
|
+
}
|
|
242
|
+
function handleClick(e) {
|
|
243
|
+
if (!enabled || !isDirty) return;
|
|
244
|
+
const target = e.target;
|
|
245
|
+
const anchor = target?.closest?.("a");
|
|
246
|
+
if (!anchor) return;
|
|
247
|
+
if (anchor.target === "_blank") return;
|
|
248
|
+
if (typeof window !== "undefined") {
|
|
249
|
+
const isInternal = anchor.host === window.location.host;
|
|
250
|
+
if (!isInternal) return;
|
|
251
|
+
if (anchor.pathname === window.location.pathname && anchor.search === window.location.search) {
|
|
252
|
+
return;
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
e.preventDefault();
|
|
256
|
+
e.stopPropagation();
|
|
257
|
+
const href = anchor.href;
|
|
258
|
+
onBlocked?.(href);
|
|
259
|
+
}
|
|
260
|
+
if (typeof window !== "undefined") {
|
|
261
|
+
window.addEventListener("beforeunload", handleBeforeUnload);
|
|
262
|
+
}
|
|
263
|
+
node.addEventListener("click", handleClick, { capture: true });
|
|
264
|
+
return {
|
|
265
|
+
update(newOptions) {
|
|
266
|
+
isDirty = newOptions.isDirty;
|
|
267
|
+
enabled = newOptions.enabled ?? true;
|
|
268
|
+
onBlocked = newOptions.onBlocked;
|
|
269
|
+
},
|
|
270
|
+
destroy() {
|
|
271
|
+
if (typeof window !== "undefined") {
|
|
272
|
+
window.removeEventListener("beforeunload", handleBeforeUnload);
|
|
273
|
+
}
|
|
274
|
+
node.removeEventListener("click", handleClick, { capture: true });
|
|
275
|
+
}
|
|
276
|
+
};
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
// src/createNavigationGuard.svelte.ts
|
|
280
|
+
import * as $5 from "svelte/internal/client";
|
|
281
|
+
function createNavigationGuard(options) {
|
|
282
|
+
let showConfirm = $5.state(false);
|
|
283
|
+
let pendingUrl = $5.state(null);
|
|
284
|
+
const getIsDirty = () => typeof options.isDirty === "function" ? options.isDirty() : options.isDirty;
|
|
285
|
+
const getEnabled = () => typeof options.enabled === "function" ? options.enabled() : options.enabled ?? true;
|
|
286
|
+
function handleBeforeUnload(e) {
|
|
287
|
+
if (!getEnabled() || !getIsDirty()) return;
|
|
288
|
+
e.preventDefault();
|
|
289
|
+
e.returnValue = "";
|
|
290
|
+
}
|
|
291
|
+
if (typeof window !== "undefined") {
|
|
292
|
+
window.addEventListener("beforeunload", handleBeforeUnload);
|
|
293
|
+
}
|
|
294
|
+
function intercept(url) {
|
|
295
|
+
if (getEnabled() && getIsDirty()) {
|
|
296
|
+
$5.set(pendingUrl, url, true);
|
|
297
|
+
$5.set(showConfirm, true);
|
|
298
|
+
options.onBlocked?.(url);
|
|
299
|
+
return true;
|
|
300
|
+
}
|
|
301
|
+
return false;
|
|
302
|
+
}
|
|
303
|
+
function confirmLeave() {
|
|
304
|
+
$5.set(showConfirm, false);
|
|
305
|
+
const target = $5.get(pendingUrl);
|
|
306
|
+
if (target) {
|
|
307
|
+
if (options.onNavigate) {
|
|
308
|
+
options.onNavigate(target);
|
|
309
|
+
} else if (typeof window !== "undefined") {
|
|
310
|
+
window.location.href = target;
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
function cancelLeave() {
|
|
315
|
+
$5.set(showConfirm, false);
|
|
316
|
+
$5.set(pendingUrl, null);
|
|
317
|
+
}
|
|
318
|
+
function destroy() {
|
|
319
|
+
if (typeof window !== "undefined") {
|
|
320
|
+
window.removeEventListener("beforeunload", handleBeforeUnload);
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
return {
|
|
324
|
+
get showConfirm() {
|
|
325
|
+
return $5.get(showConfirm);
|
|
326
|
+
},
|
|
327
|
+
setShowConfirm(val) {
|
|
328
|
+
$5.set(showConfirm, val, true);
|
|
329
|
+
},
|
|
330
|
+
get pendingUrl() {
|
|
331
|
+
return $5.get(pendingUrl);
|
|
332
|
+
},
|
|
333
|
+
intercept,
|
|
334
|
+
confirmLeave,
|
|
335
|
+
cancelLeave,
|
|
336
|
+
destroy
|
|
337
|
+
};
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
// src/index.ts
|
|
341
|
+
import {
|
|
342
|
+
DirtyTracker,
|
|
343
|
+
createDirtyTracker,
|
|
344
|
+
defaultIsEqual
|
|
345
|
+
} from "@pixerate/editor";
|
|
346
|
+
|
|
231
347
|
// src/spreadsheet/SpreadsheetEditor.svelte
|
|
232
348
|
import "svelte/internal/disclose-version";
|
|
233
|
-
import * as $
|
|
349
|
+
import * as $8 from "svelte/internal/client";
|
|
234
350
|
import { indexToColName as indexToColName2 } from "@pixerate/editor";
|
|
235
351
|
|
|
236
352
|
// src/spreadsheet/FormulaBar.svelte
|
|
237
353
|
import "svelte/internal/disclose-version";
|
|
238
|
-
import * as $
|
|
354
|
+
import * as $6 from "svelte/internal/client";
|
|
239
355
|
import { indexToColName } from "@pixerate/editor";
|
|
240
|
-
var root4 = $
|
|
356
|
+
var root4 = $6.from_html(`<div><div class="flex h-6 min-w-[3rem] items-center justify-center rounded border border-border bg-background px-1.5 font-semibold text-foreground"> </div> <div class="flex items-center text-muted-foreground select-none"><span class="italic font-serif font-bold text-sm text-primary">fx</span></div> <input type="text" class="flex-1 bg-transparent px-2 py-0.5 outline-none font-sans text-xs text-foreground placeholder:text-muted-foreground/60 focus:bg-background focus:ring-1 focus:ring-primary rounded" placeholder="Enter a value or formula (e.g. =SUM(A1:A5))"/></div>`);
|
|
241
357
|
function FormulaBar($$anchor, $$props) {
|
|
242
|
-
$
|
|
243
|
-
let sheetState = $
|
|
244
|
-
let effectiveCoord = $
|
|
358
|
+
$6.push($$props, true);
|
|
359
|
+
let sheetState = $6.prop($$props, "sheetState", 7), activeCoord = $6.prop($$props, "activeCoord", 3, null), value = $6.prop($$props, "value", 15, ""), className = $6.prop($$props, "class", 3, "");
|
|
360
|
+
let effectiveCoord = $6.derived(() => {
|
|
245
361
|
if (sheetState()) return sheetState().activeCell;
|
|
246
362
|
return activeCoord();
|
|
247
363
|
});
|
|
248
|
-
let coordLabel = $
|
|
249
|
-
if (!$
|
|
250
|
-
const colName = indexToColName($
|
|
251
|
-
return `${colName}${$
|
|
364
|
+
let coordLabel = $6.derived(() => {
|
|
365
|
+
if (!$6.get(effectiveCoord)) return "--";
|
|
366
|
+
const colName = indexToColName($6.get(effectiveCoord).col);
|
|
367
|
+
return `${colName}${$6.get(effectiveCoord).row + 1}`;
|
|
252
368
|
});
|
|
253
|
-
let effectiveValue = $
|
|
369
|
+
let effectiveValue = $6.derived(() => {
|
|
254
370
|
if (sheetState()) {
|
|
255
371
|
if (sheetState().editingCell) return sheetState().draftValue;
|
|
256
372
|
if (!sheetState().activeCell) return "";
|
|
@@ -268,11 +384,11 @@ function FormulaBar($$anchor, $$props) {
|
|
|
268
384
|
const row = sheetState().document.rows[sheetState().activeCell.row];
|
|
269
385
|
const col = sheetState().document.columns[sheetState().activeCell.col];
|
|
270
386
|
if (row && col) {
|
|
271
|
-
sheetState().setCellValue(row.id, col.id, $
|
|
387
|
+
sheetState().setCellValue(row.id, col.id, $6.get(effectiveValue));
|
|
272
388
|
}
|
|
273
389
|
sheetState().commitEditing();
|
|
274
390
|
}
|
|
275
|
-
$$props.onCommit?.($
|
|
391
|
+
$$props.onCommit?.($6.get(effectiveValue));
|
|
276
392
|
} else if (e.key === "Escape") {
|
|
277
393
|
e.preventDefault();
|
|
278
394
|
if (sheetState()) {
|
|
@@ -294,28 +410,28 @@ function FormulaBar($$anchor, $$props) {
|
|
|
294
410
|
$$props.onChange?.(target.value);
|
|
295
411
|
}
|
|
296
412
|
var div = root4();
|
|
297
|
-
var div_1 = $
|
|
298
|
-
var text = $
|
|
299
|
-
var input = $
|
|
300
|
-
$
|
|
301
|
-
$
|
|
302
|
-
$
|
|
303
|
-
$
|
|
304
|
-
$
|
|
305
|
-
$
|
|
413
|
+
var div_1 = $6.child(div);
|
|
414
|
+
var text = $6.only_child(div_1, true);
|
|
415
|
+
var input = $6.sibling(div_1, 4);
|
|
416
|
+
$6.remove_input_defaults(input);
|
|
417
|
+
$6.reset(div);
|
|
418
|
+
$6.template_effect(() => {
|
|
419
|
+
$6.set_class(div, 1, `flex items-center gap-2 border-b border-border bg-muted/20 px-3 py-1.5 text-xs font-mono ${className() ?? ""}`);
|
|
420
|
+
$6.set_text(text, $6.get(coordLabel));
|
|
421
|
+
$6.set_value(input, $6.get(effectiveValue));
|
|
306
422
|
});
|
|
307
|
-
$
|
|
308
|
-
$
|
|
309
|
-
$
|
|
310
|
-
$
|
|
423
|
+
$6.delegated("input", input, handleInput);
|
|
424
|
+
$6.delegated("keydown", input, handleKeyDown);
|
|
425
|
+
$6.append($$anchor, div);
|
|
426
|
+
$6.pop();
|
|
311
427
|
}
|
|
312
|
-
$
|
|
428
|
+
$6.delegate(["input", "keydown"]);
|
|
313
429
|
|
|
314
430
|
// src/spreadsheet/spreadsheet.svelte.ts
|
|
315
|
-
import * as $
|
|
431
|
+
import * as $7 from "svelte/internal/client";
|
|
316
432
|
import { SpreadsheetController } from "@pixerate/editor";
|
|
317
433
|
function createReactiveSpreadsheet(options = {}) {
|
|
318
|
-
let doc = $
|
|
434
|
+
let doc = $7.state($7.proxy({
|
|
319
435
|
id: options.document?.id || `sheet_${Date.now()}`,
|
|
320
436
|
name: options.document?.name || "Sheet 1",
|
|
321
437
|
columns: options.document?.columns || [],
|
|
@@ -324,47 +440,47 @@ function createReactiveSpreadsheet(options = {}) {
|
|
|
324
440
|
createdAt: options.document?.createdAt || Date.now(),
|
|
325
441
|
updatedAt: options.document?.updatedAt || Date.now()
|
|
326
442
|
}));
|
|
327
|
-
let activeCell = $
|
|
328
|
-
let selectedRange = $
|
|
329
|
-
let editingCell = $
|
|
330
|
-
let draftValue = $
|
|
443
|
+
let activeCell = $7.state(null);
|
|
444
|
+
let selectedRange = $7.state(null);
|
|
445
|
+
let editingCell = $7.state(null);
|
|
446
|
+
let draftValue = $7.state("");
|
|
331
447
|
const controller = new SpreadsheetController({
|
|
332
448
|
...options,
|
|
333
449
|
document: options.document,
|
|
334
450
|
onDocumentChange: (updated) => {
|
|
335
|
-
$
|
|
451
|
+
$7.set(doc, { ...updated }, true);
|
|
336
452
|
options.onDocumentChange?.(updated);
|
|
337
453
|
},
|
|
338
454
|
onSelectionChange: (active, range) => {
|
|
339
|
-
$
|
|
340
|
-
$
|
|
455
|
+
$7.set(activeCell, active, true);
|
|
456
|
+
$7.set(selectedRange, range, true);
|
|
341
457
|
options.onSelectionChange?.(active, range);
|
|
342
458
|
},
|
|
343
459
|
onCellCommit: (rowId, colId, raw, value) => {
|
|
344
460
|
options.onCellCommit?.(rowId, colId, raw, value);
|
|
345
461
|
}
|
|
346
462
|
});
|
|
347
|
-
$
|
|
348
|
-
$
|
|
349
|
-
$
|
|
463
|
+
$7.set(doc, { ...controller.document }, true);
|
|
464
|
+
$7.set(activeCell, controller.activeCell, true);
|
|
465
|
+
$7.set(selectedRange, controller.selectedRange, true);
|
|
350
466
|
return {
|
|
351
467
|
get document() {
|
|
352
|
-
return $
|
|
468
|
+
return $7.get(doc);
|
|
353
469
|
},
|
|
354
470
|
get activeCell() {
|
|
355
|
-
return $
|
|
471
|
+
return $7.get(activeCell);
|
|
356
472
|
},
|
|
357
473
|
get selectedRange() {
|
|
358
|
-
return $
|
|
474
|
+
return $7.get(selectedRange);
|
|
359
475
|
},
|
|
360
476
|
get editingCell() {
|
|
361
|
-
return $
|
|
477
|
+
return $7.get(editingCell);
|
|
362
478
|
},
|
|
363
479
|
get draftValue() {
|
|
364
|
-
return $
|
|
480
|
+
return $7.get(draftValue);
|
|
365
481
|
},
|
|
366
482
|
set draftValue(val) {
|
|
367
|
-
$
|
|
483
|
+
$7.set(draftValue, val, true);
|
|
368
484
|
controller.draftValue = val;
|
|
369
485
|
},
|
|
370
486
|
controller,
|
|
@@ -373,124 +489,124 @@ function createReactiveSpreadsheet(options = {}) {
|
|
|
373
489
|
},
|
|
374
490
|
setCellValue(rowId, colId, raw) {
|
|
375
491
|
controller.setCellValue(rowId, colId, raw);
|
|
376
|
-
$
|
|
492
|
+
$7.set(doc, { ...controller.document }, true);
|
|
377
493
|
},
|
|
378
494
|
selectCell(row, col, extendSelection = false) {
|
|
379
495
|
controller.selectCell(row, col, extendSelection);
|
|
380
|
-
$
|
|
381
|
-
$
|
|
496
|
+
$7.set(activeCell, controller.activeCell, true);
|
|
497
|
+
$7.set(selectedRange, controller.selectedRange, true);
|
|
382
498
|
},
|
|
383
499
|
selectRange(range) {
|
|
384
500
|
controller.selectRange(range);
|
|
385
|
-
$
|
|
501
|
+
$7.set(selectedRange, controller.selectedRange, true);
|
|
386
502
|
},
|
|
387
503
|
startEditing(row, col, initialVal) {
|
|
388
504
|
controller.startEditing(row, col, initialVal);
|
|
389
|
-
$
|
|
390
|
-
$
|
|
391
|
-
$
|
|
505
|
+
$7.set(activeCell, controller.activeCell, true);
|
|
506
|
+
$7.set(editingCell, controller.editingCell, true);
|
|
507
|
+
$7.set(draftValue, controller.draftValue, true);
|
|
392
508
|
},
|
|
393
509
|
commitEditing(val) {
|
|
394
510
|
controller.commitEditing(val);
|
|
395
|
-
$
|
|
396
|
-
$
|
|
397
|
-
$
|
|
511
|
+
$7.set(editingCell, null);
|
|
512
|
+
$7.set(draftValue, "");
|
|
513
|
+
$7.set(doc, { ...controller.document }, true);
|
|
398
514
|
},
|
|
399
515
|
cancelEditing() {
|
|
400
516
|
controller.cancelEditing();
|
|
401
|
-
$
|
|
402
|
-
$
|
|
517
|
+
$7.set(editingCell, null);
|
|
518
|
+
$7.set(draftValue, "");
|
|
403
519
|
},
|
|
404
520
|
moveCursor(dir, extend = false) {
|
|
405
521
|
controller.moveCursor(dir, extend);
|
|
406
|
-
$
|
|
407
|
-
$
|
|
522
|
+
$7.set(activeCell, controller.activeCell, true);
|
|
523
|
+
$7.set(selectedRange, controller.selectedRange, true);
|
|
408
524
|
},
|
|
409
525
|
insertColumn(index2, config) {
|
|
410
526
|
controller.insertColumn(index2, config);
|
|
411
|
-
$
|
|
527
|
+
$7.set(doc, { ...controller.document }, true);
|
|
412
528
|
},
|
|
413
529
|
deleteColumn(colId) {
|
|
414
530
|
controller.deleteColumn(colId);
|
|
415
|
-
$
|
|
531
|
+
$7.set(doc, { ...controller.document }, true);
|
|
416
532
|
},
|
|
417
533
|
insertRow(index2, config) {
|
|
418
534
|
controller.insertRow(index2, config);
|
|
419
|
-
$
|
|
535
|
+
$7.set(doc, { ...controller.document }, true);
|
|
420
536
|
},
|
|
421
537
|
deleteRow(rowId) {
|
|
422
538
|
controller.deleteRow(rowId);
|
|
423
|
-
$
|
|
539
|
+
$7.set(doc, { ...controller.document }, true);
|
|
424
540
|
},
|
|
425
541
|
setColumnWidth(colId, width) {
|
|
426
542
|
controller.setColumnWidth(colId, width);
|
|
427
|
-
$
|
|
543
|
+
$7.set(doc, { ...controller.document }, true);
|
|
428
544
|
},
|
|
429
545
|
autoFitColumnWidth(colId, customWidth) {
|
|
430
546
|
controller.autoFitColumnWidth(colId, customWidth);
|
|
431
|
-
$
|
|
547
|
+
$7.set(doc, { ...controller.document }, true);
|
|
432
548
|
},
|
|
433
549
|
loadDocument(document2) {
|
|
434
550
|
controller.loadDocument(document2);
|
|
435
|
-
$
|
|
436
|
-
$
|
|
437
|
-
$
|
|
438
|
-
$
|
|
439
|
-
$
|
|
551
|
+
$7.set(doc, { ...controller.document }, true);
|
|
552
|
+
$7.set(activeCell, controller.activeCell, true);
|
|
553
|
+
$7.set(selectedRange, controller.selectedRange, true);
|
|
554
|
+
$7.set(editingCell, controller.editingCell, true);
|
|
555
|
+
$7.set(draftValue, controller.draftValue, true);
|
|
440
556
|
},
|
|
441
557
|
syncWithDataSource() {
|
|
442
558
|
controller.syncWithDataSource();
|
|
443
559
|
controller.recalculateAll();
|
|
444
|
-
$
|
|
560
|
+
$7.set(doc, { ...controller.document }, true);
|
|
445
561
|
},
|
|
446
562
|
registerDataSource(ds) {
|
|
447
563
|
controller.registerDataSource(ds);
|
|
448
|
-
$
|
|
564
|
+
$7.set(doc, { ...controller.document }, true);
|
|
449
565
|
},
|
|
450
566
|
setPrimaryDataSource(id) {
|
|
451
567
|
controller.setPrimaryDataSource(id);
|
|
452
|
-
$
|
|
568
|
+
$7.set(doc, { ...controller.document }, true);
|
|
453
569
|
},
|
|
454
570
|
recalculateAll() {
|
|
455
571
|
controller.recalculateAll();
|
|
456
|
-
$
|
|
572
|
+
$7.set(doc, { ...controller.document }, true);
|
|
457
573
|
},
|
|
458
574
|
exportToTsv() {
|
|
459
575
|
return controller.exportToTsv();
|
|
460
576
|
},
|
|
461
577
|
importFromTsv(data) {
|
|
462
578
|
controller.importFromTsv(data);
|
|
463
|
-
$
|
|
579
|
+
$7.set(doc, { ...controller.document }, true);
|
|
464
580
|
},
|
|
465
581
|
undo() {
|
|
466
582
|
controller.undo();
|
|
467
|
-
$
|
|
583
|
+
$7.set(doc, { ...controller.document }, true);
|
|
468
584
|
},
|
|
469
585
|
redo() {
|
|
470
586
|
controller.redo();
|
|
471
|
-
$
|
|
587
|
+
$7.set(doc, { ...controller.document }, true);
|
|
472
588
|
}
|
|
473
589
|
};
|
|
474
590
|
}
|
|
475
591
|
|
|
476
592
|
// src/spreadsheet/SpreadsheetEditor.svelte
|
|
477
|
-
var root5 = $
|
|
478
|
-
var root_13 = $
|
|
479
|
-
var root_22 = $
|
|
480
|
-
var root_32 = $
|
|
481
|
-
var root_42 = $
|
|
482
|
-
var root_5 = $
|
|
483
|
-
var root_6 = $
|
|
484
|
-
var root_7 = $
|
|
593
|
+
var root5 = $8.from_html(`<th><div class="flex items-center justify-between gap-1 min-w-0 overflow-hidden truncate"><span class="truncate font-semibold text-foreground text-xs min-w-0"> </span> <span class="text-[10px] text-muted-foreground/70 font-mono font-normal shrink-0"> </span></div> <div class="col-resize-handle svelte-m799ch" style="position: absolute; top: 0; bottom: 0; width: 12px; right: -6px; cursor: col-resize !important; z-index: 20; display: flex; justify-content: center; touch-action: none;" role="separator" aria-orientation="vertical" tabindex="-1"><div class="col-resize-handle-line svelte-m799ch"></div></div></th>`);
|
|
594
|
+
var root_13 = $8.from_html(`<th class="w-10 min-w-[2.5rem] px-1 text-center bg-muted/40 hover:bg-muted cursor-pointer transition-colors svelte-m799ch" title="Add Column"><span class="text-xs font-bold text-muted-foreground">+</span></th>`);
|
|
595
|
+
var root_22 = $8.from_html(`<input type="text" class="absolute inset-0 w-full h-full px-2 py-1 bg-background text-foreground outline-none font-sans text-xs border-2 border-primary z-20"/>`);
|
|
596
|
+
var root_32 = $8.from_html(`<span> </span>`);
|
|
597
|
+
var root_42 = $8.from_html(`<td style="max-width: 0; overflow: hidden;"><!></td>`);
|
|
598
|
+
var root_5 = $8.from_html(`<td class="w-10 min-w-[2.5rem] bg-muted/10 border-r border-border svelte-m799ch"></td>`);
|
|
599
|
+
var root_6 = $8.from_html(`<tr class="border-b border-border hover:bg-muted/10 transition-colors"><td class="w-12 min-w-[3rem] sticky left-0 z-10 bg-muted/50 border-r border-border text-center text-[10px] text-muted-foreground font-mono select-none svelte-m799ch"> </td><!><!><td class="border-b border-border bg-transparent p-0 svelte-m799ch"></td></tr>`);
|
|
600
|
+
var root_7 = $8.from_html(`<div tabindex="0" role="grid" aria-label="Spreadsheet"><!> <div class="relative flex-1 overflow-auto"><table class="border-collapse table-fixed w-max min-w-full svelte-m799ch"><thead><tr class="h-7 bg-muted/60 sticky top-0 z-20 border-b border-border shadow-xs"><th class="w-12 min-w-[3rem] sticky left-0 z-30 bg-muted/90 border-r border-border text-center text-[10px] text-muted-foreground font-medium svelte-m799ch">#</th><!><!><th class="border-b border-border bg-transparent p-0 font-normal svelte-m799ch"></th></tr></thead><tbody></tbody></table></div></div>`);
|
|
485
601
|
function SpreadsheetEditor($$anchor, $$props) {
|
|
486
|
-
$
|
|
487
|
-
let sheetState = $
|
|
488
|
-
let isReadOnly = $
|
|
489
|
-
let gridContainer = $
|
|
490
|
-
let resizingColId = $
|
|
491
|
-
let hoveredColId = $
|
|
492
|
-
let resizeStartX = $
|
|
493
|
-
let resizeStartWidth = $
|
|
602
|
+
$8.push($$props, true);
|
|
603
|
+
let sheetState = $8.prop($$props, "sheetState", 23, createReactiveSpreadsheet), readOnly = $8.prop($$props, "readOnly", 3, false), readonly = $8.prop($$props, "readonly", 3, false), showFormulaBar = $8.prop($$props, "showFormulaBar", 3, true), className = $8.prop($$props, "class", 3, "");
|
|
604
|
+
let isReadOnly = $8.derived(() => readOnly() || readonly());
|
|
605
|
+
let gridContainer = $8.state(null);
|
|
606
|
+
let resizingColId = $8.state(null);
|
|
607
|
+
let hoveredColId = $8.state(null);
|
|
608
|
+
let resizeStartX = $8.state(0);
|
|
609
|
+
let resizeStartWidth = $8.state(0);
|
|
494
610
|
function handleCellClick(rIdx, cIdx, e) {
|
|
495
611
|
if (sheetState().editingCell && (sheetState().editingCell.row !== rIdx || sheetState().editingCell.col !== cIdx)) {
|
|
496
612
|
sheetState().commitEditing();
|
|
@@ -498,7 +614,7 @@ function SpreadsheetEditor($$anchor, $$props) {
|
|
|
498
614
|
sheetState().selectCell(rIdx, cIdx, e.shiftKey);
|
|
499
615
|
}
|
|
500
616
|
function handleCellDblClick(rIdx, cIdx) {
|
|
501
|
-
if ($
|
|
617
|
+
if ($8.get(isReadOnly)) return;
|
|
502
618
|
const col = sheetState().document.columns[cIdx];
|
|
503
619
|
if (col?.readOnly) return;
|
|
504
620
|
sheetState().startEditing(rIdx, cIdx);
|
|
@@ -536,11 +652,11 @@ function SpreadsheetEditor($$anchor, $$props) {
|
|
|
536
652
|
} else if (e.key === "Enter") {
|
|
537
653
|
e.preventDefault();
|
|
538
654
|
const col = sheetState().document.columns[sheetState().activeCell.col];
|
|
539
|
-
if (!$
|
|
655
|
+
if (!$8.get(isReadOnly) && !col?.readOnly) {
|
|
540
656
|
sheetState().startEditing();
|
|
541
657
|
}
|
|
542
658
|
} else if (e.key === "Backspace" || e.key === "Delete") {
|
|
543
|
-
if ($
|
|
659
|
+
if ($8.get(isReadOnly)) return;
|
|
544
660
|
const row = sheetState().document.rows[sheetState().activeCell.row];
|
|
545
661
|
const col = sheetState().document.columns[sheetState().activeCell.col];
|
|
546
662
|
if (row && col && !col.readOnly) {
|
|
@@ -558,7 +674,7 @@ function SpreadsheetEditor($$anchor, $$props) {
|
|
|
558
674
|
e.preventDefault();
|
|
559
675
|
const tsv = sheetState().exportToTsv();
|
|
560
676
|
navigator.clipboard?.writeText(tsv);
|
|
561
|
-
} else if (!$
|
|
677
|
+
} else if (!$8.get(isReadOnly) && e.key.length === 1 && !e.ctrlKey && !e.metaKey && !e.altKey) {
|
|
562
678
|
const col = sheetState().document.columns[sheetState().activeCell.col];
|
|
563
679
|
if (!col?.readOnly) {
|
|
564
680
|
sheetState().startEditing(sheetState().activeCell.row, sheetState().activeCell.col, e.key);
|
|
@@ -568,9 +684,9 @@ function SpreadsheetEditor($$anchor, $$props) {
|
|
|
568
684
|
function handleResizeStart(colId, width, e) {
|
|
569
685
|
e.preventDefault();
|
|
570
686
|
e.stopPropagation();
|
|
571
|
-
$
|
|
572
|
-
$
|
|
573
|
-
$
|
|
687
|
+
$8.set(resizingColId, colId, true);
|
|
688
|
+
$8.set(resizeStartX, e.clientX, true);
|
|
689
|
+
$8.set(resizeStartWidth, width, true);
|
|
574
690
|
if (typeof document !== "undefined") {
|
|
575
691
|
document.body.style.cursor = "col-resize";
|
|
576
692
|
document.body.style.userSelect = "none";
|
|
@@ -579,17 +695,17 @@ function SpreadsheetEditor($$anchor, $$props) {
|
|
|
579
695
|
let pendingWidth = width;
|
|
580
696
|
let hasDragged = false;
|
|
581
697
|
const handleMouseMove = (moveEvent) => {
|
|
582
|
-
if (!$
|
|
583
|
-
const delta = moveEvent.clientX - $
|
|
698
|
+
if (!$8.get(resizingColId)) return;
|
|
699
|
+
const delta = moveEvent.clientX - $8.get(resizeStartX);
|
|
584
700
|
if (Math.abs(delta) > 2) {
|
|
585
701
|
hasDragged = true;
|
|
586
702
|
}
|
|
587
|
-
pendingWidth = Math.max(30, $
|
|
703
|
+
pendingWidth = Math.max(30, $8.get(resizeStartWidth) + delta);
|
|
588
704
|
if (rafId === null) {
|
|
589
705
|
rafId = requestAnimationFrame(() => {
|
|
590
706
|
rafId = null;
|
|
591
|
-
if ($
|
|
592
|
-
sheetState().setColumnWidth($
|
|
707
|
+
if ($8.get(resizingColId)) {
|
|
708
|
+
sheetState().setColumnWidth($8.get(resizingColId), pendingWidth);
|
|
593
709
|
}
|
|
594
710
|
});
|
|
595
711
|
}
|
|
@@ -599,14 +715,14 @@ function SpreadsheetEditor($$anchor, $$props) {
|
|
|
599
715
|
cancelAnimationFrame(rafId);
|
|
600
716
|
rafId = null;
|
|
601
717
|
}
|
|
602
|
-
if ($
|
|
603
|
-
sheetState().setColumnWidth($
|
|
604
|
-
const col = sheetState().document.columns.find((c) => c.id === $
|
|
718
|
+
if ($8.get(resizingColId) && hasDragged) {
|
|
719
|
+
sheetState().setColumnWidth($8.get(resizingColId), pendingWidth);
|
|
720
|
+
const col = sheetState().document.columns.find((c) => c.id === $8.get(resizingColId));
|
|
605
721
|
if (col && $$props.onColumnResize) {
|
|
606
722
|
$$props.onColumnResize(col.id, col.width || pendingWidth);
|
|
607
723
|
}
|
|
608
724
|
}
|
|
609
|
-
$
|
|
725
|
+
$8.set(resizingColId, null);
|
|
610
726
|
if (typeof document !== "undefined") {
|
|
611
727
|
document.body.style.cursor = "";
|
|
612
728
|
document.body.style.userSelect = "";
|
|
@@ -669,14 +785,14 @@ function SpreadsheetEditor($$anchor, $$props) {
|
|
|
669
785
|
const col = sheetState().document.columns.find((c) => c.id === colId);
|
|
670
786
|
if (!col) return;
|
|
671
787
|
let calculatedWidth = 0;
|
|
672
|
-
if ($
|
|
673
|
-
const table = $
|
|
788
|
+
if ($8.get(gridContainer) && typeof document !== "undefined") {
|
|
789
|
+
const table = $8.get(gridContainer).querySelector("table");
|
|
674
790
|
if (table) {
|
|
675
791
|
const thElements = table.querySelectorAll("thead th");
|
|
676
792
|
const th = thElements[colIndex + 1];
|
|
677
793
|
if (th) {
|
|
678
794
|
const headerInner = th.firstElementChild || th;
|
|
679
|
-
const headerW = measureElementContentWidth(headerInner, $
|
|
795
|
+
const headerW = measureElementContentWidth(headerInner, $8.get(gridContainer));
|
|
680
796
|
calculatedWidth = Math.max(calculatedWidth, headerW + 28);
|
|
681
797
|
}
|
|
682
798
|
const rows = table.querySelectorAll("tbody tr");
|
|
@@ -685,7 +801,7 @@ function SpreadsheetEditor($$anchor, $$props) {
|
|
|
685
801
|
const tr = rows[r];
|
|
686
802
|
const td = tr.children[colIndex + 1];
|
|
687
803
|
if (td) {
|
|
688
|
-
const cellW = measureElementContentWidth(td, $
|
|
804
|
+
const cellW = measureElementContentWidth(td, $8.get(gridContainer));
|
|
689
805
|
calculatedWidth = Math.max(calculatedWidth, cellW + 20);
|
|
690
806
|
}
|
|
691
807
|
}
|
|
@@ -730,7 +846,7 @@ function SpreadsheetEditor($$anchor, $$props) {
|
|
|
730
846
|
return sheetState().activeCell?.row === rIdx && sheetState().activeCell?.col === cIdx;
|
|
731
847
|
}
|
|
732
848
|
var div = root_7();
|
|
733
|
-
var node_1 = $
|
|
849
|
+
var node_1 = $8.child(div);
|
|
734
850
|
{
|
|
735
851
|
var consequent = ($$anchor2) => {
|
|
736
852
|
FormulaBar($$anchor2, {
|
|
@@ -739,137 +855,137 @@ function SpreadsheetEditor($$anchor, $$props) {
|
|
|
739
855
|
}
|
|
740
856
|
});
|
|
741
857
|
};
|
|
742
|
-
$
|
|
858
|
+
$8.if(node_1, ($$render) => {
|
|
743
859
|
if (showFormulaBar()) $$render(consequent);
|
|
744
860
|
});
|
|
745
861
|
}
|
|
746
|
-
var div_1 = $
|
|
747
|
-
var table_1 = $
|
|
748
|
-
var thead = $
|
|
749
|
-
var tr_1 = $
|
|
750
|
-
var node_2 = $
|
|
751
|
-
$
|
|
862
|
+
var div_1 = $8.sibling(node_1, 2);
|
|
863
|
+
var table_1 = $8.child(div_1);
|
|
864
|
+
var thead = $8.child(table_1);
|
|
865
|
+
var tr_1 = $8.child(thead);
|
|
866
|
+
var node_2 = $8.sibling($8.child(tr_1));
|
|
867
|
+
$8.each(node_2, 19, () => sheetState().document.columns, (col) => col.id, ($$anchor2, col, cIdx) => {
|
|
752
868
|
var th_1 = root5();
|
|
753
|
-
var div_2 = $
|
|
754
|
-
var span = $
|
|
755
|
-
var text = $
|
|
756
|
-
var span_1 = $
|
|
757
|
-
var text_1 = $
|
|
758
|
-
$
|
|
759
|
-
var div_3 = $
|
|
760
|
-
var div_4 = $
|
|
761
|
-
$
|
|
762
|
-
$
|
|
763
|
-
$
|
|
764
|
-
$
|
|
765
|
-
$
|
|
766
|
-
$
|
|
767
|
-
$
|
|
869
|
+
var div_2 = $8.child(th_1);
|
|
870
|
+
var span = $8.child(div_2);
|
|
871
|
+
var text = $8.only_child(span, true);
|
|
872
|
+
var span_1 = $8.sibling(span, 2);
|
|
873
|
+
var text_1 = $8.only_child(span_1);
|
|
874
|
+
$8.reset(div_2);
|
|
875
|
+
var div_3 = $8.sibling(div_2, 2);
|
|
876
|
+
var div_4 = $8.only_child(div_3);
|
|
877
|
+
$8.reset(th_1);
|
|
878
|
+
$8.template_effect(() => {
|
|
879
|
+
$8.set_class(th_1, 1, `relative border-r border-border px-2 text-left font-medium text-muted-foreground hover:bg-muted/90 transition-colors group overflow-hidden max-w-0 ${$$props.onColumnHeaderClick ? "cursor-pointer" : "cursor-default"}`, "svelte-m799ch");
|
|
880
|
+
$8.set_style(th_1, `width: ${($8.get(col).width || 130) ?? ""}px; min-width: ${($8.get(col).width || 130) ?? ""}px; max-width: ${($8.get(col).width || 130) ?? ""}px; overflow: hidden;`);
|
|
881
|
+
$8.set_text(text, $8.get(col).title);
|
|
882
|
+
$8.set_text(text_1, `(${$8.get(col).key ?? ""})`);
|
|
883
|
+
$8.set_style(div_4, `width: 2px; height: 100%; pointer-events: none; transition: background-color 150ms ease; background-color: ${$8.get(resizingColId) === $8.get(col).id ? "var(--primary, #6366f1)" : $8.get(hoveredColId) === $8.get(col).id ? "color-mix(in srgb, var(--primary, #6366f1) 75%, transparent)" : "transparent"};`);
|
|
768
884
|
});
|
|
769
|
-
$
|
|
770
|
-
$
|
|
771
|
-
$
|
|
772
|
-
$
|
|
773
|
-
if ($
|
|
885
|
+
$8.delegated("click", th_1, () => $$props.onColumnHeaderClick?.($8.get(col)));
|
|
886
|
+
$8.delegated("dblclick", th_1, (e) => handleHeaderDblClick($8.get(col).id, $8.get(cIdx), e));
|
|
887
|
+
$8.event("mouseenter", div_3, () => $8.set(hoveredColId, $8.get(col).id, true));
|
|
888
|
+
$8.event("mouseleave", div_3, () => {
|
|
889
|
+
if ($8.get(hoveredColId) === $8.get(col).id) $8.set(hoveredColId, null);
|
|
774
890
|
});
|
|
775
|
-
$
|
|
776
|
-
$
|
|
777
|
-
$
|
|
891
|
+
$8.delegated("mousedown", div_3, (e) => handleResizeStart($8.get(col).id, $8.get(col).width || 130, e));
|
|
892
|
+
$8.delegated("dblclick", div_3, (e) => handleResizeDblClick($8.get(col).id, $8.get(cIdx), e));
|
|
893
|
+
$8.append($$anchor2, th_1);
|
|
778
894
|
});
|
|
779
|
-
var node_3 = $
|
|
895
|
+
var node_3 = $8.sibling(node_2);
|
|
780
896
|
{
|
|
781
897
|
var consequent_1 = ($$anchor2) => {
|
|
782
898
|
var th_2 = root_13();
|
|
783
|
-
$
|
|
899
|
+
$8.delegated("click", th_2, function(...$$args) {
|
|
784
900
|
$$props.onAddColumnClick?.apply(this, $$args);
|
|
785
901
|
});
|
|
786
|
-
$
|
|
902
|
+
$8.append($$anchor2, th_2);
|
|
787
903
|
};
|
|
788
|
-
$
|
|
904
|
+
$8.if(node_3, ($$render) => {
|
|
789
905
|
if ($$props.onAddColumnClick) $$render(consequent_1);
|
|
790
906
|
});
|
|
791
907
|
}
|
|
792
|
-
$
|
|
793
|
-
$
|
|
794
|
-
$
|
|
795
|
-
var tbody = $
|
|
796
|
-
$
|
|
908
|
+
$8.next();
|
|
909
|
+
$8.reset(tr_1);
|
|
910
|
+
$8.reset(thead);
|
|
911
|
+
var tbody = $8.sibling(thead);
|
|
912
|
+
$8.each(tbody, 23, () => sheetState().document.rows, (row) => row.id, ($$anchor2, row, rIdx) => {
|
|
797
913
|
var tr_2 = root_6();
|
|
798
|
-
var td_1 = $
|
|
799
|
-
var text_2 = $
|
|
800
|
-
var node_4 = $
|
|
801
|
-
$
|
|
802
|
-
const cell = $
|
|
803
|
-
const selected = $
|
|
804
|
-
const active = $
|
|
805
|
-
const isEditing = $
|
|
914
|
+
var td_1 = $8.child(tr_2);
|
|
915
|
+
var text_2 = $8.only_child(td_1, true);
|
|
916
|
+
var node_4 = $8.sibling(td_1);
|
|
917
|
+
$8.each(node_4, 19, () => sheetState().document.columns, (col) => col.id, ($$anchor3, col, cIdx) => {
|
|
918
|
+
const cell = $8.derived(() => sheetState().getCell($8.get(row).id, $8.get(col).id));
|
|
919
|
+
const selected = $8.derived(() => isCellSelected($8.get(rIdx), $8.get(cIdx)));
|
|
920
|
+
const active = $8.derived(() => isActiveCell($8.get(rIdx), $8.get(cIdx)));
|
|
921
|
+
const isEditing = $8.derived(() => sheetState().editingCell?.row === $8.get(rIdx) && sheetState().editingCell?.col === $8.get(cIdx));
|
|
806
922
|
var td_2 = root_42();
|
|
807
|
-
var node_5 = $
|
|
923
|
+
var node_5 = $8.child(td_2);
|
|
808
924
|
{
|
|
809
925
|
var consequent_2 = ($$anchor4) => {
|
|
810
926
|
var input = root_22();
|
|
811
|
-
$
|
|
812
|
-
$
|
|
813
|
-
$
|
|
814
|
-
$
|
|
927
|
+
$8.remove_input_defaults(input);
|
|
928
|
+
$8.event("blur", input, () => sheetState().commitEditing());
|
|
929
|
+
$8.bind_value(input, () => sheetState().draftValue, ($$value) => sheetState().draftValue = $$value);
|
|
930
|
+
$8.append($$anchor4, input);
|
|
815
931
|
};
|
|
816
932
|
var consequent_3 = ($$anchor4) => {
|
|
817
|
-
const cellArg = $
|
|
818
|
-
var fragment_1 = $
|
|
819
|
-
var node_6 = $
|
|
820
|
-
$
|
|
821
|
-
$
|
|
933
|
+
const cellArg = $8.derived(() => Object.assign({ row: $8.get(row), col: $8.get(col), cell: $8.get(cell) }, $8.get(cell)));
|
|
934
|
+
var fragment_1 = $8.comment();
|
|
935
|
+
var node_6 = $8.first_child(fragment_1);
|
|
936
|
+
$8.snippet(node_6, () => $$props.customCellRenderer, () => $8.get(cellArg), () => $8.get(col), () => $8.get(row));
|
|
937
|
+
$8.append($$anchor4, fragment_1);
|
|
822
938
|
};
|
|
823
939
|
var alternate = ($$anchor4) => {
|
|
824
940
|
var span_2 = root_32();
|
|
825
|
-
var text_3 = $
|
|
826
|
-
$
|
|
827
|
-
$
|
|
828
|
-
$
|
|
941
|
+
var text_3 = $8.only_child(span_2, true);
|
|
942
|
+
$8.template_effect(() => {
|
|
943
|
+
$8.set_class(span_2, 1, `truncate block max-w-full ${$8.get(cell).error ? "text-destructive font-semibold" : ""}`);
|
|
944
|
+
$8.set_text(text_3, $8.get(cell).error || ($8.get(cell).value ?? ""));
|
|
829
945
|
});
|
|
830
|
-
$
|
|
946
|
+
$8.append($$anchor4, span_2);
|
|
831
947
|
};
|
|
832
|
-
$
|
|
833
|
-
if ($
|
|
948
|
+
$8.if(node_5, ($$render) => {
|
|
949
|
+
if ($8.get(isEditing)) $$render(consequent_2);
|
|
834
950
|
else if ($$props.customCellRenderer) $$render(consequent_3, 1);
|
|
835
951
|
else $$render(alternate, -1);
|
|
836
952
|
});
|
|
837
953
|
}
|
|
838
|
-
$
|
|
839
|
-
$
|
|
840
|
-
$
|
|
841
|
-
$
|
|
842
|
-
$
|
|
954
|
+
$8.reset(td_2);
|
|
955
|
+
$8.template_effect(() => $8.set_class(td_2, 1, `relative border-r border-border px-2 py-1 truncate max-w-0 text-foreground transition-colors ${$8.get(selected) ? "bg-primary/10" : ""} ${$8.get(active) ? "ring-2 ring-primary ring-inset z-10" : ""}`, "svelte-m799ch"));
|
|
956
|
+
$8.delegated("click", td_2, (e) => handleCellClick($8.get(rIdx), $8.get(cIdx), e));
|
|
957
|
+
$8.delegated("dblclick", td_2, () => handleCellDblClick($8.get(rIdx), $8.get(cIdx)));
|
|
958
|
+
$8.append($$anchor3, td_2);
|
|
843
959
|
});
|
|
844
|
-
var node_7 = $
|
|
960
|
+
var node_7 = $8.sibling(node_4);
|
|
845
961
|
{
|
|
846
962
|
var consequent_4 = ($$anchor3) => {
|
|
847
963
|
var td_3 = root_5();
|
|
848
|
-
$
|
|
964
|
+
$8.append($$anchor3, td_3);
|
|
849
965
|
};
|
|
850
|
-
$
|
|
966
|
+
$8.if(node_7, ($$render) => {
|
|
851
967
|
if ($$props.onAddColumnClick) $$render(consequent_4);
|
|
852
968
|
});
|
|
853
969
|
}
|
|
854
|
-
$
|
|
855
|
-
$
|
|
856
|
-
$
|
|
857
|
-
$
|
|
858
|
-
$
|
|
970
|
+
$8.next();
|
|
971
|
+
$8.reset(tr_2);
|
|
972
|
+
$8.template_effect(() => {
|
|
973
|
+
$8.set_style(tr_2, `height: ${($8.get(row).height || 32) ?? ""}px;`);
|
|
974
|
+
$8.set_text(text_2, $8.get(rIdx) + 1);
|
|
859
975
|
});
|
|
860
|
-
$
|
|
976
|
+
$8.append($$anchor2, tr_2);
|
|
861
977
|
});
|
|
862
|
-
$
|
|
863
|
-
$
|
|
864
|
-
$
|
|
865
|
-
$
|
|
866
|
-
$
|
|
867
|
-
$
|
|
868
|
-
$
|
|
869
|
-
$
|
|
870
|
-
$
|
|
978
|
+
$8.reset(tbody);
|
|
979
|
+
$8.reset(table_1);
|
|
980
|
+
$8.reset(div_1);
|
|
981
|
+
$8.reset(div);
|
|
982
|
+
$8.bind_this(div, ($$value) => $8.set(gridContainer, $$value), () => $8.get(gridContainer));
|
|
983
|
+
$8.template_effect(() => $8.set_class(div, 1, `flex flex-col h-full w-full overflow-hidden border border-border bg-background select-none outline-none text-foreground font-sans text-xs ${className() ?? ""}`, "svelte-m799ch"));
|
|
984
|
+
$8.delegated("keydown", div, handleKeyDown);
|
|
985
|
+
$8.append($$anchor, div);
|
|
986
|
+
$8.pop();
|
|
871
987
|
}
|
|
872
|
-
$
|
|
988
|
+
$8.delegate(["keydown", "click", "dblclick", "mousedown"]);
|
|
873
989
|
|
|
874
990
|
// src/index.ts
|
|
875
991
|
var EditableTextNodeEditor2 = EditableTextNodeEditor;
|
|
@@ -877,12 +993,17 @@ var BubbleMenu2 = BubbleMenu;
|
|
|
877
993
|
var TemplateRenderer2 = TemplateRenderer;
|
|
878
994
|
export {
|
|
879
995
|
BubbleMenu2 as BubbleMenu,
|
|
996
|
+
DirtyTracker,
|
|
880
997
|
EditableTextNodeEditor2 as EditableTextNodeEditor,
|
|
881
998
|
FormulaBar,
|
|
882
999
|
SpreadsheetEditor,
|
|
883
1000
|
TemplateRenderer2 as TemplateRenderer,
|
|
1001
|
+
createDirtyTracker,
|
|
1002
|
+
createNavigationGuard,
|
|
884
1003
|
createReactiveEditor,
|
|
885
1004
|
createReactiveSpreadsheet,
|
|
886
|
-
|
|
1005
|
+
defaultIsEqual,
|
|
1006
|
+
initiateEditor,
|
|
1007
|
+
navigationGuard
|
|
887
1008
|
};
|
|
888
1009
|
//# sourceMappingURL=index.js.map
|