@ni/ok-components 1.4.2 → 1.5.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/all-components-bundle.js +1264 -476
- package/dist/all-components-bundle.js.map +1 -1
- package/dist/all-components-bundle.min.js +4042 -3797
- package/dist/all-components-bundle.min.js.map +1 -1
- package/dist/custom-elements.json +7 -2
- package/dist/custom-elements.md +3 -3
- package/dist/esm/ts/table-column/breakpoint/index.d.ts +15 -1
- package/dist/esm/ts/table-column/breakpoint/index.js +2 -1
- package/dist/esm/ts/table-column/breakpoint/index.js.map +1 -1
- package/package.json +3 -3
|
@@ -10094,12 +10094,12 @@
|
|
|
10094
10094
|
/* eslint-enable @typescript-eslint/no-non-null-assertion */
|
|
10095
10095
|
|
|
10096
10096
|
/*!
|
|
10097
|
-
* tabbable 6.
|
|
10097
|
+
* tabbable 6.5.0
|
|
10098
10098
|
* @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE
|
|
10099
10099
|
*/
|
|
10100
10100
|
// NOTE: separate `:not()` selectors has broader browser support than the newer
|
|
10101
10101
|
// `:not([inert], [inert] *)` (Feb 2023)
|
|
10102
|
-
var candidateSelectors = ['input:not([inert]):not([inert] *)', 'select:not([inert]):not([inert] *)', 'textarea:not([inert]):not([inert] *)', 'a[href]:not([inert]):not([inert] *)', 'button:not([inert]):not([inert] *)', '[tabindex]:not(slot):not([inert]):not([inert] *)', 'audio[controls]:not([inert]):not([inert] *)', 'video[controls]:not([inert]):not([inert] *)', '[contenteditable]:not([contenteditable="false"]):not([inert]):not([inert] *)', 'details>summary:first-of-type:not([inert]):not([inert] *)', 'details:not([inert]):not([inert] *)'];
|
|
10102
|
+
var candidateSelectors = ['input:not([inert]):not([inert] *)', 'select:not([inert]):not([inert] *)', 'textarea:not([inert]):not([inert] *)', 'a[href]:not([inert]):not([inert] *)', 'area[href]:not([inert]):not([inert] *)', 'button:not([inert]):not([inert] *)', '[tabindex]:not(slot):not([inert]):not([inert] *)', 'audio[controls]:not([inert]):not([inert] *)', 'video[controls]:not([inert]):not([inert] *)', '[contenteditable]:not([contenteditable="false"]):not([inert]):not([inert] *)', 'details>summary:first-of-type:not([inert]):not([inert] *)', 'details:not([inert]):not([inert] *)'];
|
|
10103
10103
|
var NoElement = typeof Element === 'undefined';
|
|
10104
10104
|
var matches$1 = NoElement ? function () {} : Element.prototype.matches || Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector;
|
|
10105
10105
|
var getRootNode = !NoElement && Element.prototype.getRootNode ? function (element) {
|
|
@@ -10204,7 +10204,9 @@
|
|
|
10204
10204
|
// (this is legacy behavior from a very long way back)
|
|
10205
10205
|
// NOTE: we check this regardless of `displayCheck="none"` because this is a
|
|
10206
10206
|
// _visibility_ check, not a _display_ check
|
|
10207
|
-
|
|
10207
|
+
var _getComputedStyle = getComputedStyle(node),
|
|
10208
|
+
visibility = _getComputedStyle.visibility;
|
|
10209
|
+
if (visibility === 'hidden' || visibility === 'collapse') {
|
|
10208
10210
|
return true;
|
|
10209
10211
|
}
|
|
10210
10212
|
var isDirectSummary = matches$1.call(node, 'details>summary:first-of-type');
|
|
@@ -28869,8 +28871,11 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
28869
28871
|
if (!childA.sameMarkup(childB))
|
|
28870
28872
|
return pos;
|
|
28871
28873
|
if (childA.isText && childA.text != childB.text) {
|
|
28872
|
-
|
|
28874
|
+
let tA = childA.text, tB = childB.text, j = 0;
|
|
28875
|
+
for (; tA[j] == tB[j]; j++)
|
|
28873
28876
|
pos++;
|
|
28877
|
+
if (j && j < tA.length && j < tB.length && surrogateHigh(tA.charCodeAt(j - 1)) && surrogateLow(tA.charCodeAt(j)))
|
|
28878
|
+
pos--;
|
|
28874
28879
|
return pos;
|
|
28875
28880
|
}
|
|
28876
28881
|
if (childA.content.size || childB.content.size) {
|
|
@@ -28894,12 +28899,17 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
28894
28899
|
if (!childA.sameMarkup(childB))
|
|
28895
28900
|
return { a: posA, b: posB };
|
|
28896
28901
|
if (childA.isText && childA.text != childB.text) {
|
|
28897
|
-
let
|
|
28898
|
-
while (
|
|
28899
|
-
|
|
28902
|
+
let tA = childA.text, tB = childB.text, iA = tA.length, iB = tB.length;
|
|
28903
|
+
while (iA > 0 && iB > 0 && tA[iA - 1] == tB[iB - 1]) {
|
|
28904
|
+
iA--;
|
|
28905
|
+
iB--;
|
|
28900
28906
|
posA--;
|
|
28901
28907
|
posB--;
|
|
28902
28908
|
}
|
|
28909
|
+
if (iA && iB && iA < tA.length && surrogateHigh(tA.charCodeAt(iA - 1)) && surrogateLow(tA.charCodeAt(iA))) {
|
|
28910
|
+
posA++;
|
|
28911
|
+
posB++;
|
|
28912
|
+
}
|
|
28903
28913
|
return { a: posA, b: posB };
|
|
28904
28914
|
}
|
|
28905
28915
|
if (childA.content.size || childB.content.size) {
|
|
@@ -28911,6 +28921,8 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
28911
28921
|
posB -= size;
|
|
28912
28922
|
}
|
|
28913
28923
|
}
|
|
28924
|
+
function surrogateLow(ch) { return ch >= 0xDC00 && ch < 0xE000; }
|
|
28925
|
+
function surrogateHigh(ch) { return ch >= 0xD800 && ch < 0xDC00; }
|
|
28914
28926
|
|
|
28915
28927
|
/**
|
|
28916
28928
|
A fragment represents a node's collection of child nodes.
|
|
@@ -29591,7 +29603,8 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
29591
29603
|
addNode($end.nodeBefore, target);
|
|
29592
29604
|
}
|
|
29593
29605
|
function close(node, content) {
|
|
29594
|
-
node.type.
|
|
29606
|
+
if (!node.type.validContent(content))
|
|
29607
|
+
throw new ReplaceError("Invalid content for node " + node.type.name);
|
|
29595
29608
|
return node.copy(content);
|
|
29596
29609
|
}
|
|
29597
29610
|
function replaceThreeWay($from, $start, $end, $to, depth) {
|
|
@@ -30902,13 +30915,12 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
30902
30915
|
return built;
|
|
30903
30916
|
}
|
|
30904
30917
|
function checkAttrs(attrs, values, type, name) {
|
|
30905
|
-
for (let
|
|
30906
|
-
if (!(
|
|
30907
|
-
throw new RangeError(`Unsupported attribute ${
|
|
30908
|
-
for (let
|
|
30909
|
-
|
|
30910
|
-
|
|
30911
|
-
attr.validate(values[name]);
|
|
30918
|
+
for (let attr in values)
|
|
30919
|
+
if (!(attr in attrs))
|
|
30920
|
+
throw new RangeError(`Unsupported attribute ${attr} for ${type} of type ${name}`);
|
|
30921
|
+
for (let attr in attrs) {
|
|
30922
|
+
if (attrs[attr].validate)
|
|
30923
|
+
attrs[attr].validate(values[attr]);
|
|
30912
30924
|
}
|
|
30913
30925
|
}
|
|
30914
30926
|
function initAttrs(typeName, attrs) {
|
|
@@ -38561,14 +38573,14 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
38561
38573
|
syncNodeSelection(view, sel);
|
|
38562
38574
|
if (!editorOwnsSelection(view))
|
|
38563
38575
|
return;
|
|
38564
|
-
//
|
|
38565
|
-
//
|
|
38566
|
-
|
|
38567
|
-
if (!force &&
|
|
38576
|
+
// Need to delay selection normalization during a native selection
|
|
38577
|
+
// drag on Chrome, or it will cause further dragging to glitch.
|
|
38578
|
+
let mouseDown = view.input.mouseDown;
|
|
38579
|
+
if (!force && chrome && mouseDown) {
|
|
38568
38580
|
let domSel = view.domSelectionRange(), curSel = view.domObserver.currentSelection;
|
|
38569
38581
|
if (domSel.anchorNode && curSel.anchorNode &&
|
|
38570
|
-
isEquivalentPosition(domSel.anchorNode, domSel.anchorOffset, curSel.anchorNode, curSel.anchorOffset)
|
|
38571
|
-
|
|
38582
|
+
isEquivalentPosition(domSel.anchorNode, domSel.anchorOffset, curSel.anchorNode, curSel.anchorOffset) &&
|
|
38583
|
+
mouseDown.delaySelUpdate()) {
|
|
38572
38584
|
view.domObserver.setCurSelection();
|
|
38573
38585
|
return;
|
|
38574
38586
|
}
|
|
@@ -39420,6 +39432,8 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
39420
39432
|
view.input.lastSelectionTime = Date.now();
|
|
39421
39433
|
}
|
|
39422
39434
|
function destroyInput(view) {
|
|
39435
|
+
if (view.input.mouseDown)
|
|
39436
|
+
view.input.mouseDown.done();
|
|
39423
39437
|
view.domObserver.stop();
|
|
39424
39438
|
for (let type in view.input.eventHandlers)
|
|
39425
39439
|
view.dom.removeEventListener(type, view.input.eventHandlers[type]);
|
|
@@ -39458,7 +39472,7 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
39458
39472
|
editHandlers.keydown = (view, _event) => {
|
|
39459
39473
|
let event = _event;
|
|
39460
39474
|
view.input.shiftKey = event.keyCode == 16 || event.shiftKey;
|
|
39461
|
-
if (inOrNearComposition(view
|
|
39475
|
+
if (inOrNearComposition(view))
|
|
39462
39476
|
return;
|
|
39463
39477
|
view.input.lastKeyCode = event.keyCode;
|
|
39464
39478
|
view.input.lastKeyCodeTime = Date.now();
|
|
@@ -39496,7 +39510,7 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
39496
39510
|
};
|
|
39497
39511
|
editHandlers.keypress = (view, _event) => {
|
|
39498
39512
|
let event = _event;
|
|
39499
|
-
if (inOrNearComposition(view
|
|
39513
|
+
if (inOrNearComposition(view) || !event.charCode ||
|
|
39500
39514
|
event.ctrlKey && !event.altKey || mac$2 && event.metaKey)
|
|
39501
39515
|
return;
|
|
39502
39516
|
if (view.someProp("handleKeyPress", f => f(view, event))) {
|
|
@@ -39590,26 +39604,28 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
39590
39604
|
function defaultTripleClick(view, inside, event) {
|
|
39591
39605
|
if (event.button != 0)
|
|
39592
39606
|
return false;
|
|
39593
|
-
let doc = view.state.doc;
|
|
39594
|
-
if (
|
|
39595
|
-
if (doc.inlineContent) {
|
|
39596
|
-
updateSelection(view, TextSelection.create(doc, 0, doc.content.size));
|
|
39597
|
-
return true;
|
|
39598
|
-
}
|
|
39607
|
+
let selection = selectionForTripleClick(view, inside, true), doc = view.state.doc;
|
|
39608
|
+
if (!selection)
|
|
39599
39609
|
return false;
|
|
39600
|
-
|
|
39610
|
+
updateSelection(view, selection);
|
|
39611
|
+
if (selection instanceof TextSelection && doc.eq(view.state.doc))
|
|
39612
|
+
view.input.mouseDown = new TripleClickDrag(view, selection);
|
|
39613
|
+
return true;
|
|
39614
|
+
}
|
|
39615
|
+
function selectionForTripleClick(view, inside, selectNodes) {
|
|
39616
|
+
let doc = view.state.doc;
|
|
39617
|
+
if (inside == -1)
|
|
39618
|
+
return doc.inlineContent ? TextSelection.create(doc, 0, doc.content.size) : null;
|
|
39601
39619
|
let $pos = doc.resolve(inside);
|
|
39602
39620
|
for (let i = $pos.depth + 1; i > 0; i--) {
|
|
39603
39621
|
let node = i > $pos.depth ? $pos.nodeAfter : $pos.node(i);
|
|
39604
39622
|
let nodePos = $pos.before(i);
|
|
39605
39623
|
if (node.inlineContent)
|
|
39606
|
-
|
|
39607
|
-
else if (NodeSelection.isSelectable(node))
|
|
39608
|
-
|
|
39609
|
-
else
|
|
39610
|
-
continue;
|
|
39611
|
-
return true;
|
|
39624
|
+
return TextSelection.create(doc, nodePos + 1, nodePos + 1 + node.content.size);
|
|
39625
|
+
else if (selectNodes && NodeSelection.isSelectable(node))
|
|
39626
|
+
return NodeSelection.create(doc, nodePos);
|
|
39612
39627
|
}
|
|
39628
|
+
return null;
|
|
39613
39629
|
}
|
|
39614
39630
|
function forceDOMFlush(view) {
|
|
39615
39631
|
return endComposition(view);
|
|
@@ -39628,13 +39644,13 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
39628
39644
|
type = "tripleClick";
|
|
39629
39645
|
}
|
|
39630
39646
|
view.input.lastClick = { time: now, x: event.clientX, y: event.clientY, type, button: event.button };
|
|
39647
|
+
if (view.input.mouseDown)
|
|
39648
|
+
view.input.mouseDown.done();
|
|
39631
39649
|
let pos = view.posAtCoords(eventCoords(event));
|
|
39632
39650
|
if (!pos)
|
|
39633
39651
|
return;
|
|
39634
39652
|
if (type == "singleClick") {
|
|
39635
|
-
|
|
39636
|
-
view.input.mouseDown.done();
|
|
39637
|
-
view.input.mouseDown = new MouseDown(view, pos, event, !!flushed);
|
|
39653
|
+
view.input.mouseDown = new LeftMouseDown(view, pos, event, !!flushed);
|
|
39638
39654
|
}
|
|
39639
39655
|
else if ((type == "doubleClick" ? handleDoubleClick : handleTripleClick)(view, pos.pos, pos.inside, event)) {
|
|
39640
39656
|
event.preventDefault();
|
|
@@ -39644,13 +39660,34 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
39644
39660
|
}
|
|
39645
39661
|
};
|
|
39646
39662
|
class MouseDown {
|
|
39647
|
-
constructor(view
|
|
39663
|
+
constructor(view) {
|
|
39648
39664
|
this.view = view;
|
|
39665
|
+
this.mightDrag = null;
|
|
39666
|
+
view.root.addEventListener("mouseup", this.up = this.up.bind(this));
|
|
39667
|
+
view.root.addEventListener("mousemove", this.move = this.move.bind(this));
|
|
39668
|
+
}
|
|
39669
|
+
up(event) {
|
|
39670
|
+
this.done();
|
|
39671
|
+
}
|
|
39672
|
+
move(event) {
|
|
39673
|
+
if (event.buttons == 0)
|
|
39674
|
+
this.done();
|
|
39675
|
+
}
|
|
39676
|
+
done() {
|
|
39677
|
+
this.view.root.removeEventListener("mouseup", this.up);
|
|
39678
|
+
this.view.root.removeEventListener("mousemove", this.move);
|
|
39679
|
+
if (this.view.input.mouseDown == this)
|
|
39680
|
+
this.view.input.mouseDown = null;
|
|
39681
|
+
}
|
|
39682
|
+
delaySelUpdate() { return false; }
|
|
39683
|
+
}
|
|
39684
|
+
class LeftMouseDown extends MouseDown {
|
|
39685
|
+
constructor(view, pos, event, flushed) {
|
|
39686
|
+
super(view);
|
|
39649
39687
|
this.pos = pos;
|
|
39650
39688
|
this.event = event;
|
|
39651
39689
|
this.flushed = flushed;
|
|
39652
39690
|
this.delayedSelectionSync = false;
|
|
39653
|
-
this.mightDrag = null;
|
|
39654
39691
|
this.startDoc = view.state.doc;
|
|
39655
39692
|
this.selectNode = !!event[selectNodeModifier];
|
|
39656
39693
|
this.allowDefault = event.shiftKey;
|
|
@@ -39688,13 +39725,10 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
39688
39725
|
}, 20);
|
|
39689
39726
|
this.view.domObserver.start();
|
|
39690
39727
|
}
|
|
39691
|
-
view.root.addEventListener("mouseup", this.up = this.up.bind(this));
|
|
39692
|
-
view.root.addEventListener("mousemove", this.move = this.move.bind(this));
|
|
39693
39728
|
setSelectionOrigin(view, "pointer");
|
|
39694
39729
|
}
|
|
39695
39730
|
done() {
|
|
39696
|
-
|
|
39697
|
-
this.view.root.removeEventListener("mousemove", this.move);
|
|
39731
|
+
super.done();
|
|
39698
39732
|
if (this.mightDrag && this.target) {
|
|
39699
39733
|
this.view.domObserver.stop();
|
|
39700
39734
|
if (this.mightDrag.addAttr)
|
|
@@ -39704,8 +39738,10 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
39704
39738
|
this.view.domObserver.start();
|
|
39705
39739
|
}
|
|
39706
39740
|
if (this.delayedSelectionSync)
|
|
39707
|
-
setTimeout(() =>
|
|
39708
|
-
|
|
39741
|
+
setTimeout(() => {
|
|
39742
|
+
if (!this.view.isDestroyed)
|
|
39743
|
+
selectionToDOM(this.view);
|
|
39744
|
+
});
|
|
39709
39745
|
}
|
|
39710
39746
|
up(event) {
|
|
39711
39747
|
this.done();
|
|
@@ -39744,14 +39780,41 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
39744
39780
|
move(event) {
|
|
39745
39781
|
this.updateAllowDefault(event);
|
|
39746
39782
|
setSelectionOrigin(this.view, "pointer");
|
|
39747
|
-
|
|
39748
|
-
this.done();
|
|
39783
|
+
super.move(event);
|
|
39749
39784
|
}
|
|
39750
39785
|
updateAllowDefault(event) {
|
|
39751
39786
|
if (!this.allowDefault && (Math.abs(this.event.x - event.clientX) > 4 ||
|
|
39752
39787
|
Math.abs(this.event.y - event.clientY) > 4))
|
|
39753
39788
|
this.allowDefault = true;
|
|
39754
39789
|
}
|
|
39790
|
+
delaySelUpdate() {
|
|
39791
|
+
if (!this.allowDefault)
|
|
39792
|
+
return false;
|
|
39793
|
+
this.delayedSelectionSync = true;
|
|
39794
|
+
return true;
|
|
39795
|
+
}
|
|
39796
|
+
}
|
|
39797
|
+
class TripleClickDrag extends MouseDown {
|
|
39798
|
+
constructor(view, startSelection) {
|
|
39799
|
+
super(view);
|
|
39800
|
+
this.startSelection = startSelection;
|
|
39801
|
+
this.startDoc = view.state.doc;
|
|
39802
|
+
}
|
|
39803
|
+
move(event) {
|
|
39804
|
+
if (event.buttons == 0 || this.view.isDestroyed || !this.view.state.doc.eq(this.startDoc)) {
|
|
39805
|
+
this.done();
|
|
39806
|
+
return;
|
|
39807
|
+
}
|
|
39808
|
+
event.preventDefault();
|
|
39809
|
+
setSelectionOrigin(this.view, "pointer");
|
|
39810
|
+
let pos = this.view.posAtCoords(eventCoords(event));
|
|
39811
|
+
let target = pos && selectionForTripleClick(this.view, pos.inside, false);
|
|
39812
|
+
if (!target)
|
|
39813
|
+
return;
|
|
39814
|
+
let { doc } = this.view.state, start = this.startSelection;
|
|
39815
|
+
let [anchor, head] = target.from < start.from ? [start.to, target.from] : [start.from, target.to];
|
|
39816
|
+
updateSelection(this.view, TextSelection.create(doc, anchor, head));
|
|
39817
|
+
}
|
|
39755
39818
|
}
|
|
39756
39819
|
handlers.touchstart = view => {
|
|
39757
39820
|
view.input.lastTouch = Date.now();
|
|
@@ -39776,7 +39839,7 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
39776
39839
|
// This guards against the case where compositionend is triggered without the keyboard
|
|
39777
39840
|
// (e.g. character confirmation may be done with the mouse), and keydown is triggered
|
|
39778
39841
|
// afterwards- we wouldn't want to ignore the keydown event in this case.
|
|
39779
|
-
if (safari && Math.abs(
|
|
39842
|
+
if (safari && Math.abs(Date.now() - view.input.compositionEndedAt) < 500) {
|
|
39780
39843
|
view.input.compositionEndedAt = -2e8;
|
|
39781
39844
|
return true;
|
|
39782
39845
|
}
|
|
@@ -39835,7 +39898,7 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
39835
39898
|
editHandlers.compositionend = (view, event) => {
|
|
39836
39899
|
if (view.composing) {
|
|
39837
39900
|
view.input.composing = false;
|
|
39838
|
-
view.input.compositionEndedAt =
|
|
39901
|
+
view.input.compositionEndedAt = Date.now();
|
|
39839
39902
|
view.input.compositionPendingChanges = view.domObserver.pendingRecords().length ? view.input.compositionID : 0;
|
|
39840
39903
|
view.input.compositionNode = null;
|
|
39841
39904
|
if (view.input.badSafariComposition)
|
|
@@ -39854,7 +39917,7 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
39854
39917
|
function clearComposition(view) {
|
|
39855
39918
|
if (view.composing) {
|
|
39856
39919
|
view.input.composing = false;
|
|
39857
|
-
view.input.compositionEndedAt =
|
|
39920
|
+
view.input.compositionEndedAt = Date.now();
|
|
39858
39921
|
}
|
|
39859
39922
|
while (view.input.compositionNodes.length > 0)
|
|
39860
39923
|
view.input.compositionNodes.pop().markParentsDirty();
|
|
@@ -39880,11 +39943,6 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
39880
39943
|
}
|
|
39881
39944
|
return textBefore || textAfter;
|
|
39882
39945
|
}
|
|
39883
|
-
function timestampFromCustomEvent() {
|
|
39884
|
-
let event = document.createEvent("Event");
|
|
39885
|
-
event.initEvent("event", true, true);
|
|
39886
|
-
return event.timeStamp;
|
|
39887
|
-
}
|
|
39888
39946
|
/**
|
|
39889
39947
|
@internal
|
|
39890
39948
|
*/
|
|
@@ -41041,7 +41099,10 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
41041
41099
|
}
|
|
41042
41100
|
}
|
|
41043
41101
|
}
|
|
41044
|
-
if (added.some(n => n.nodeName == "BR") &&
|
|
41102
|
+
if (added.some(n => n.nodeName == "BR") &&
|
|
41103
|
+
(view.input.lastKeyCode == 8 || view.input.lastKeyCode == 46 ||
|
|
41104
|
+
chrome && (view.composing || view.input.compositionEndedAt > Date.now() - 50) &&
|
|
41105
|
+
mutations.some(m => m.type == "childList" && m.removedNodes.length))) {
|
|
41045
41106
|
// Browsers sometimes insert a bogus break node if you
|
|
41046
41107
|
// backspace out the last bit of text before an inline-flex node (#1552)
|
|
41047
41108
|
for (let node of added)
|
|
@@ -41597,38 +41658,28 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
41597
41658
|
return end;
|
|
41598
41659
|
}
|
|
41599
41660
|
function findDiff(a, b, pos, preferredPos, preferredSide) {
|
|
41600
|
-
let start = a.findDiffStart(b, pos);
|
|
41661
|
+
let start = a.findDiffStart(b, pos), lenA = pos + a.size, lenB = pos + b.size;
|
|
41601
41662
|
if (start == null)
|
|
41602
41663
|
return null;
|
|
41603
|
-
let { a: endA, b: endB } = a.findDiffEnd(b,
|
|
41664
|
+
let { a: endA, b: endB } = a.findDiffEnd(b, lenA, lenB);
|
|
41604
41665
|
if (preferredSide == "end") {
|
|
41605
41666
|
let adjust = Math.max(0, start - Math.min(endA, endB));
|
|
41606
41667
|
preferredPos -= endA + adjust - start;
|
|
41607
41668
|
}
|
|
41608
|
-
if (endA < start &&
|
|
41669
|
+
if (endA < start && lenA < lenB) {
|
|
41609
41670
|
let move = preferredPos <= start && preferredPos >= endA ? start - preferredPos : 0;
|
|
41610
41671
|
start -= move;
|
|
41611
|
-
if (start && start < b.size && isSurrogatePair(b.textBetween(start - 1, start + 1)))
|
|
41612
|
-
start += move ? 1 : -1;
|
|
41613
41672
|
endB = start + (endB - endA);
|
|
41614
41673
|
endA = start;
|
|
41615
41674
|
}
|
|
41616
41675
|
else if (endB < start) {
|
|
41617
41676
|
let move = preferredPos <= start && preferredPos >= endB ? start - preferredPos : 0;
|
|
41618
41677
|
start -= move;
|
|
41619
|
-
if (start && start < a.size && isSurrogatePair(a.textBetween(start - 1, start + 1)))
|
|
41620
|
-
start += move ? 1 : -1;
|
|
41621
41678
|
endA = start + (endA - endB);
|
|
41622
41679
|
endB = start;
|
|
41623
41680
|
}
|
|
41624
41681
|
return { start, endA, endB };
|
|
41625
41682
|
}
|
|
41626
|
-
function isSurrogatePair(str) {
|
|
41627
|
-
if (str.length != 2)
|
|
41628
|
-
return false;
|
|
41629
|
-
let a = str.charCodeAt(0), b = str.charCodeAt(1);
|
|
41630
|
-
return a >= 0xDC00 && a <= 0xDFFF && b >= 0xD800 && b <= 0xDBFF;
|
|
41631
|
-
}
|
|
41632
41683
|
/**
|
|
41633
41684
|
An editor view manages the DOM structure that represents an
|
|
41634
41685
|
editable document. Its state and behavior are determined by its
|
|
@@ -41820,9 +41871,10 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
41820
41871
|
// a DOM selection change and the "selectionchange" event for it
|
|
41821
41872
|
// can cause a spurious DOM selection update, disrupting mouse
|
|
41822
41873
|
// drag selection.
|
|
41874
|
+
let mouseDown = this.input.mouseDown;
|
|
41823
41875
|
if (forceSelUpdate ||
|
|
41824
|
-
!(
|
|
41825
|
-
anchorInRightPlace(this))) {
|
|
41876
|
+
!(mouseDown && this.domObserver.currentSelection.eq(this.domSelectionRange()) &&
|
|
41877
|
+
anchorInRightPlace(this) && mouseDown.delaySelUpdate())) {
|
|
41826
41878
|
selectionToDOM(this, forceSelUpdate);
|
|
41827
41879
|
}
|
|
41828
41880
|
else {
|
|
@@ -42748,7 +42800,9 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
42748
42800
|
function getNodeType(nameOrType, schema) {
|
|
42749
42801
|
if (typeof nameOrType === "string") {
|
|
42750
42802
|
if (!schema.nodes[nameOrType]) {
|
|
42751
|
-
throw Error(
|
|
42803
|
+
throw Error(
|
|
42804
|
+
`There is no node type named '${nameOrType}'. Maybe you forgot to add the extension?`
|
|
42805
|
+
);
|
|
42752
42806
|
}
|
|
42753
42807
|
return schema.nodes[nameOrType];
|
|
42754
42808
|
}
|
|
@@ -42907,7 +42961,9 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
42907
42961
|
function getMarkType(nameOrType, schema) {
|
|
42908
42962
|
if (typeof nameOrType === "string") {
|
|
42909
42963
|
if (!schema.marks[nameOrType]) {
|
|
42910
|
-
throw Error(
|
|
42964
|
+
throw Error(
|
|
42965
|
+
`There is no mark type named '${nameOrType}'. Maybe you forgot to add the extension?`
|
|
42966
|
+
);
|
|
42911
42967
|
}
|
|
42912
42968
|
return schema.marks[nameOrType];
|
|
42913
42969
|
}
|
|
@@ -42964,9 +43020,17 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
42964
43020
|
const minPos = selectionAtStart.from;
|
|
42965
43021
|
const maxPos = selectionAtEnd.to;
|
|
42966
43022
|
if (position === "all") {
|
|
42967
|
-
return TextSelection.create(
|
|
43023
|
+
return TextSelection.create(
|
|
43024
|
+
doc,
|
|
43025
|
+
minMax(0, minPos, maxPos),
|
|
43026
|
+
minMax(doc.content.size, minPos, maxPos)
|
|
43027
|
+
);
|
|
42968
43028
|
}
|
|
42969
|
-
return TextSelection.create(
|
|
43029
|
+
return TextSelection.create(
|
|
43030
|
+
doc,
|
|
43031
|
+
minMax(position, minPos, maxPos),
|
|
43032
|
+
minMax(position, minPos, maxPos)
|
|
43033
|
+
);
|
|
42970
43034
|
}
|
|
42971
43035
|
|
|
42972
43036
|
// src/utilities/isAndroid.ts
|
|
@@ -42976,7 +43040,9 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
42976
43040
|
|
|
42977
43041
|
// src/utilities/isiOS.ts
|
|
42978
43042
|
function isiOS() {
|
|
42979
|
-
return ["iPad Simulator", "iPhone Simulator", "iPod Simulator", "iPad", "iPhone", "iPod"].includes(
|
|
43043
|
+
return ["iPad Simulator", "iPhone Simulator", "iPod Simulator", "iPad", "iPhone", "iPod"].includes(
|
|
43044
|
+
navigator.platform
|
|
43045
|
+
) || // iPad on iOS 13 detection
|
|
42980
43046
|
navigator.userAgent.includes("Mac") && "ontouchend" in document;
|
|
42981
43047
|
}
|
|
42982
43048
|
|
|
@@ -43039,7 +43105,11 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
43039
43105
|
|
|
43040
43106
|
// src/commands/insertContent.ts
|
|
43041
43107
|
var insertContent = (value, options) => ({ tr, commands }) => {
|
|
43042
|
-
return commands.insertContentAt(
|
|
43108
|
+
return commands.insertContentAt(
|
|
43109
|
+
{ from: tr.selection.from, to: tr.selection.to },
|
|
43110
|
+
value,
|
|
43111
|
+
options
|
|
43112
|
+
);
|
|
43043
43113
|
};
|
|
43044
43114
|
|
|
43045
43115
|
// src/utilities/elementFromString.ts
|
|
@@ -43057,7 +43127,9 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
43057
43127
|
};
|
|
43058
43128
|
function elementFromString(value) {
|
|
43059
43129
|
if (typeof window === "undefined") {
|
|
43060
|
-
throw new Error(
|
|
43130
|
+
throw new Error(
|
|
43131
|
+
"[tiptap error]: there is no window object available, so this function cannot be used"
|
|
43132
|
+
);
|
|
43061
43133
|
}
|
|
43062
43134
|
const wrappedValue = `<body>${value}</body>`;
|
|
43063
43135
|
const html = new window.DOMParser().parseFromString(wrappedValue, "text/html").body;
|
|
@@ -43122,9 +43194,15 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
43122
43194
|
})
|
|
43123
43195
|
});
|
|
43124
43196
|
if (options.slice) {
|
|
43125
|
-
DOMParser.fromSchema(contentCheckSchema).parseSlice(
|
|
43197
|
+
DOMParser.fromSchema(contentCheckSchema).parseSlice(
|
|
43198
|
+
elementFromString(content),
|
|
43199
|
+
options.parseOptions
|
|
43200
|
+
);
|
|
43126
43201
|
} else {
|
|
43127
|
-
DOMParser.fromSchema(contentCheckSchema).parse(
|
|
43202
|
+
DOMParser.fromSchema(contentCheckSchema).parse(
|
|
43203
|
+
elementFromString(content),
|
|
43204
|
+
options.parseOptions
|
|
43205
|
+
);
|
|
43128
43206
|
}
|
|
43129
43207
|
if (options.errorOnInvalidContent && hasInvalidContent) {
|
|
43130
43208
|
throw new Error("[tiptap error]: Invalid HTML content", {
|
|
@@ -43494,7 +43572,11 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
43494
43572
|
if (markType === mark.type) {
|
|
43495
43573
|
canReset = true;
|
|
43496
43574
|
if (dispatch) {
|
|
43497
|
-
tr.addMark(
|
|
43575
|
+
tr.addMark(
|
|
43576
|
+
pos,
|
|
43577
|
+
pos + node.nodeSize,
|
|
43578
|
+
markType.create(deleteProps(mark.attrs, attributes))
|
|
43579
|
+
);
|
|
43498
43580
|
}
|
|
43499
43581
|
}
|
|
43500
43582
|
});
|
|
@@ -43663,7 +43745,11 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
43663
43745
|
options: extension.options,
|
|
43664
43746
|
storage: extension.storage
|
|
43665
43747
|
};
|
|
43666
|
-
const addExtensions = getExtensionField(
|
|
43748
|
+
const addExtensions = getExtensionField(
|
|
43749
|
+
extension,
|
|
43750
|
+
"addExtensions",
|
|
43751
|
+
context
|
|
43752
|
+
);
|
|
43667
43753
|
if (addExtensions) {
|
|
43668
43754
|
return [extension, ...flattenExtensions(addExtensions())];
|
|
43669
43755
|
}
|
|
@@ -43701,7 +43787,9 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
43701
43787
|
|
|
43702
43788
|
// src/helpers/splitExtensions.ts
|
|
43703
43789
|
function splitExtensions(extensions) {
|
|
43704
|
-
const baseExtensions = extensions.filter(
|
|
43790
|
+
const baseExtensions = extensions.filter(
|
|
43791
|
+
(extension) => extension.type === "extension"
|
|
43792
|
+
);
|
|
43705
43793
|
const nodeExtensions = extensions.filter((extension) => extension.type === "node");
|
|
43706
43794
|
const markExtensions = extensions.filter((extension) => extension.type === "mark");
|
|
43707
43795
|
return {
|
|
@@ -43777,11 +43865,7 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
43777
43865
|
options: extension.options,
|
|
43778
43866
|
storage: extension.storage
|
|
43779
43867
|
};
|
|
43780
|
-
const addAttributes = getExtensionField(
|
|
43781
|
-
extension,
|
|
43782
|
-
"addAttributes",
|
|
43783
|
-
context
|
|
43784
|
-
);
|
|
43868
|
+
const addAttributes = getExtensionField(extension, "addAttributes", context);
|
|
43785
43869
|
if (!addAttributes) {
|
|
43786
43870
|
return;
|
|
43787
43871
|
}
|
|
@@ -43881,10 +43965,15 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
43881
43965
|
if (key === "class") {
|
|
43882
43966
|
const valueClasses = value ? String(value).split(" ") : [];
|
|
43883
43967
|
const existingClasses = mergedAttributes[key] ? mergedAttributes[key].split(" ") : [];
|
|
43884
|
-
const insertClasses = valueClasses.filter(
|
|
43968
|
+
const insertClasses = valueClasses.filter(
|
|
43969
|
+
(valueClass) => !existingClasses.includes(valueClass)
|
|
43970
|
+
);
|
|
43885
43971
|
mergedAttributes[key] = [...existingClasses, ...insertClasses].join(" ");
|
|
43886
43972
|
} else if (key === "style") {
|
|
43887
|
-
const styleMap = new Map([
|
|
43973
|
+
const styleMap = new Map([
|
|
43974
|
+
...parseStyleEntries(mergedAttributes[key]),
|
|
43975
|
+
...parseStyleEntries(value)
|
|
43976
|
+
]);
|
|
43888
43977
|
mergedAttributes[key] = Array.from(styleMap.entries()).map(([property, val]) => `${property}: ${val}`).join("; ");
|
|
43889
43978
|
} else {
|
|
43890
43979
|
mergedAttributes[key] = value;
|
|
@@ -43980,7 +44069,9 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
43980
44069
|
const topNode = (_a = nodeExtensions.find((extension) => getExtensionField(extension, "topNode"))) == null ? void 0 : _a.name;
|
|
43981
44070
|
const nodes = Object.fromEntries(
|
|
43982
44071
|
nodeExtensions.map((extension) => {
|
|
43983
|
-
const extensionAttributes = allAttributes.filter(
|
|
44072
|
+
const extensionAttributes = allAttributes.filter(
|
|
44073
|
+
(attribute) => attribute.type === extension.name
|
|
44074
|
+
);
|
|
43984
44075
|
const context = {
|
|
43985
44076
|
name: extension.name,
|
|
43986
44077
|
options: extension.options,
|
|
@@ -43988,7 +44079,11 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
43988
44079
|
editor
|
|
43989
44080
|
};
|
|
43990
44081
|
const extraNodeFields = extensions.reduce((fields, e) => {
|
|
43991
|
-
const extendNodeSchema = getExtensionField(
|
|
44082
|
+
const extendNodeSchema = getExtensionField(
|
|
44083
|
+
e,
|
|
44084
|
+
"extendNodeSchema",
|
|
44085
|
+
context
|
|
44086
|
+
);
|
|
43992
44087
|
return {
|
|
43993
44088
|
...fields,
|
|
43994
44089
|
...extendNodeSchema ? extendNodeSchema(extension) : {}
|
|
@@ -43996,36 +44091,62 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
43996
44091
|
}, {});
|
|
43997
44092
|
const schema = cleanUpSchemaItem({
|
|
43998
44093
|
...extraNodeFields,
|
|
43999
|
-
content: callOrReturn(
|
|
44094
|
+
content: callOrReturn(
|
|
44095
|
+
getExtensionField(extension, "content", context)
|
|
44096
|
+
),
|
|
44000
44097
|
marks: callOrReturn(getExtensionField(extension, "marks", context)),
|
|
44001
44098
|
group: callOrReturn(getExtensionField(extension, "group", context)),
|
|
44002
44099
|
inline: callOrReturn(getExtensionField(extension, "inline", context)),
|
|
44003
44100
|
atom: callOrReturn(getExtensionField(extension, "atom", context)),
|
|
44004
|
-
selectable: callOrReturn(
|
|
44005
|
-
|
|
44101
|
+
selectable: callOrReturn(
|
|
44102
|
+
getExtensionField(extension, "selectable", context)
|
|
44103
|
+
),
|
|
44104
|
+
draggable: callOrReturn(
|
|
44105
|
+
getExtensionField(extension, "draggable", context)
|
|
44106
|
+
),
|
|
44006
44107
|
code: callOrReturn(getExtensionField(extension, "code", context)),
|
|
44007
|
-
whitespace: callOrReturn(
|
|
44108
|
+
whitespace: callOrReturn(
|
|
44109
|
+
getExtensionField(extension, "whitespace", context)
|
|
44110
|
+
),
|
|
44008
44111
|
linebreakReplacement: callOrReturn(
|
|
44009
|
-
getExtensionField(
|
|
44112
|
+
getExtensionField(
|
|
44113
|
+
extension,
|
|
44114
|
+
"linebreakReplacement",
|
|
44115
|
+
context
|
|
44116
|
+
)
|
|
44117
|
+
),
|
|
44118
|
+
defining: callOrReturn(
|
|
44119
|
+
getExtensionField(extension, "defining", context)
|
|
44120
|
+
),
|
|
44121
|
+
isolating: callOrReturn(
|
|
44122
|
+
getExtensionField(extension, "isolating", context)
|
|
44010
44123
|
),
|
|
44011
|
-
defining: callOrReturn(getExtensionField(extension, "defining", context)),
|
|
44012
|
-
isolating: callOrReturn(getExtensionField(extension, "isolating", context)),
|
|
44013
44124
|
attrs: Object.fromEntries(extensionAttributes.map(buildAttributeSpec))
|
|
44014
44125
|
});
|
|
44015
|
-
const parseHTML = callOrReturn(
|
|
44126
|
+
const parseHTML = callOrReturn(
|
|
44127
|
+
getExtensionField(extension, "parseHTML", context)
|
|
44128
|
+
);
|
|
44016
44129
|
if (parseHTML) {
|
|
44017
44130
|
schema.parseDOM = parseHTML.map(
|
|
44018
44131
|
(parseRule) => injectExtensionAttributesToParseRule(parseRule, extensionAttributes)
|
|
44019
44132
|
);
|
|
44020
44133
|
}
|
|
44021
|
-
const renderHTML = getExtensionField(
|
|
44134
|
+
const renderHTML = getExtensionField(
|
|
44135
|
+
extension,
|
|
44136
|
+
"renderHTML",
|
|
44137
|
+
context
|
|
44138
|
+
);
|
|
44022
44139
|
if (renderHTML) {
|
|
44023
44140
|
schema.toDOM = (node) => renderHTML({
|
|
44024
44141
|
node,
|
|
44025
44142
|
HTMLAttributes: getRenderedAttributes(node, extensionAttributes)
|
|
44026
44143
|
});
|
|
44027
44144
|
}
|
|
44028
|
-
const renderText = getExtensionField(
|
|
44145
|
+
const renderText = getExtensionField(
|
|
44146
|
+
extension,
|
|
44147
|
+
"renderText",
|
|
44148
|
+
context
|
|
44149
|
+
);
|
|
44029
44150
|
if (renderText) {
|
|
44030
44151
|
schema.toText = renderText;
|
|
44031
44152
|
}
|
|
@@ -44034,7 +44155,9 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
44034
44155
|
);
|
|
44035
44156
|
const marks = Object.fromEntries(
|
|
44036
44157
|
markExtensions.map((extension) => {
|
|
44037
|
-
const extensionAttributes = allAttributes.filter(
|
|
44158
|
+
const extensionAttributes = allAttributes.filter(
|
|
44159
|
+
(attribute) => attribute.type === extension.name
|
|
44160
|
+
);
|
|
44038
44161
|
const context = {
|
|
44039
44162
|
name: extension.name,
|
|
44040
44163
|
options: extension.options,
|
|
@@ -44042,7 +44165,11 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
44042
44165
|
editor
|
|
44043
44166
|
};
|
|
44044
44167
|
const extraMarkFields = extensions.reduce((fields, e) => {
|
|
44045
|
-
const extendMarkSchema = getExtensionField(
|
|
44168
|
+
const extendMarkSchema = getExtensionField(
|
|
44169
|
+
e,
|
|
44170
|
+
"extendMarkSchema",
|
|
44171
|
+
context
|
|
44172
|
+
);
|
|
44046
44173
|
return {
|
|
44047
44174
|
...fields,
|
|
44048
44175
|
...extendMarkSchema ? extendMarkSchema(extension) : {}
|
|
@@ -44050,20 +44177,32 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
44050
44177
|
}, {});
|
|
44051
44178
|
const schema = cleanUpSchemaItem({
|
|
44052
44179
|
...extraMarkFields,
|
|
44053
|
-
inclusive: callOrReturn(
|
|
44054
|
-
|
|
44180
|
+
inclusive: callOrReturn(
|
|
44181
|
+
getExtensionField(extension, "inclusive", context)
|
|
44182
|
+
),
|
|
44183
|
+
excludes: callOrReturn(
|
|
44184
|
+
getExtensionField(extension, "excludes", context)
|
|
44185
|
+
),
|
|
44055
44186
|
group: callOrReturn(getExtensionField(extension, "group", context)),
|
|
44056
|
-
spanning: callOrReturn(
|
|
44187
|
+
spanning: callOrReturn(
|
|
44188
|
+
getExtensionField(extension, "spanning", context)
|
|
44189
|
+
),
|
|
44057
44190
|
code: callOrReturn(getExtensionField(extension, "code", context)),
|
|
44058
44191
|
attrs: Object.fromEntries(extensionAttributes.map(buildAttributeSpec))
|
|
44059
44192
|
});
|
|
44060
|
-
const parseHTML = callOrReturn(
|
|
44193
|
+
const parseHTML = callOrReturn(
|
|
44194
|
+
getExtensionField(extension, "parseHTML", context)
|
|
44195
|
+
);
|
|
44061
44196
|
if (parseHTML) {
|
|
44062
44197
|
schema.parseDOM = parseHTML.map(
|
|
44063
44198
|
(parseRule) => injectExtensionAttributesToParseRule(parseRule, extensionAttributes)
|
|
44064
44199
|
);
|
|
44065
44200
|
}
|
|
44066
|
-
const renderHTML = getExtensionField(
|
|
44201
|
+
const renderHTML = getExtensionField(
|
|
44202
|
+
extension,
|
|
44203
|
+
"renderHTML",
|
|
44204
|
+
context
|
|
44205
|
+
);
|
|
44067
44206
|
if (renderHTML) {
|
|
44068
44207
|
schema.toDOM = (mark) => renderHTML({
|
|
44069
44208
|
mark,
|
|
@@ -44317,16 +44456,20 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
44317
44456
|
var getTextContentFromNodes = ($from, maxMatch = 500) => {
|
|
44318
44457
|
let textBefore = "";
|
|
44319
44458
|
const sliceEndPos = $from.parentOffset;
|
|
44320
|
-
$from.parent.nodesBetween(
|
|
44321
|
-
|
|
44322
|
-
|
|
44323
|
-
|
|
44324
|
-
|
|
44325
|
-
|
|
44326
|
-
|
|
44327
|
-
|
|
44328
|
-
|
|
44329
|
-
|
|
44459
|
+
$from.parent.nodesBetween(
|
|
44460
|
+
Math.max(0, sliceEndPos - maxMatch),
|
|
44461
|
+
sliceEndPos,
|
|
44462
|
+
(node, pos, parent, index) => {
|
|
44463
|
+
var _a, _b;
|
|
44464
|
+
const chunk = ((_b = (_a = node.type.spec).toText) == null ? void 0 : _b.call(_a, {
|
|
44465
|
+
node,
|
|
44466
|
+
pos,
|
|
44467
|
+
parent,
|
|
44468
|
+
index
|
|
44469
|
+
})) || node.textContent || "%leaf%";
|
|
44470
|
+
textBefore += node.isAtom && !node.isText ? chunk : chunk.slice(0, Math.max(0, sliceEndPos - pos));
|
|
44471
|
+
}
|
|
44472
|
+
);
|
|
44330
44473
|
return textBefore;
|
|
44331
44474
|
};
|
|
44332
44475
|
|
|
@@ -44697,7 +44840,11 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
44697
44840
|
const { selection, doc } = tr;
|
|
44698
44841
|
const { $from, $to } = selection;
|
|
44699
44842
|
const extensionAttributes = editor.extensionManager.attributes;
|
|
44700
|
-
const newAttributes = getSplittedAttributes(
|
|
44843
|
+
const newAttributes = getSplittedAttributes(
|
|
44844
|
+
extensionAttributes,
|
|
44845
|
+
$from.node().type.name,
|
|
44846
|
+
$from.node().attrs
|
|
44847
|
+
);
|
|
44701
44848
|
if (selection instanceof NodeSelection && selection.node.isBlock) {
|
|
44702
44849
|
if (!$from.parentOffset || !canSplit(doc, $from.pos)) {
|
|
44703
44850
|
return false;
|
|
@@ -44776,7 +44923,7 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
44776
44923
|
wrap = Fragment.from($from.node(d).copy(wrap));
|
|
44777
44924
|
}
|
|
44778
44925
|
const depthAfter = (
|
|
44779
|
-
//
|
|
44926
|
+
// oxlint-disable-next-line no-nested-ternary
|
|
44780
44927
|
$from.indexAfter(-1) < $from.node(-2).childCount ? 1 : $from.indexAfter(-2) < $from.node(-3).childCount ? 2 : 3
|
|
44781
44928
|
);
|
|
44782
44929
|
const newNextTypeAttributes2 = {
|
|
@@ -45005,15 +45152,22 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
45005
45152
|
};
|
|
45006
45153
|
|
|
45007
45154
|
// src/commands/unsetAllMarks.ts
|
|
45008
|
-
var unsetAllMarks = () => ({ tr, dispatch }) => {
|
|
45155
|
+
var unsetAllMarks = (options = {}) => ({ tr, dispatch, editor }) => {
|
|
45156
|
+
const { ignoreClearable = false } = options;
|
|
45009
45157
|
const { selection } = tr;
|
|
45010
45158
|
const { empty, ranges } = selection;
|
|
45011
45159
|
if (empty) {
|
|
45012
45160
|
return true;
|
|
45013
45161
|
}
|
|
45162
|
+
const { nonClearableMarks } = editor.extensionManager;
|
|
45014
45163
|
if (dispatch) {
|
|
45164
|
+
const clearableMarkTypes = Object.values(editor.schema.marks).filter(
|
|
45165
|
+
(markType) => ignoreClearable || !nonClearableMarks.includes(markType.name)
|
|
45166
|
+
);
|
|
45015
45167
|
ranges.forEach((range) => {
|
|
45016
|
-
|
|
45168
|
+
for (const markType of clearableMarkTypes) {
|
|
45169
|
+
tr.removeMark(range.$from.pos, range.$to.pos, markType);
|
|
45170
|
+
}
|
|
45017
45171
|
});
|
|
45018
45172
|
}
|
|
45019
45173
|
return true;
|
|
@@ -45248,7 +45402,9 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
45248
45402
|
result.data = inputRuleMatch.data;
|
|
45249
45403
|
if (inputRuleMatch.replaceWith) {
|
|
45250
45404
|
if (!inputRuleMatch.text.includes(inputRuleMatch.replaceWith)) {
|
|
45251
|
-
console.warn(
|
|
45405
|
+
console.warn(
|
|
45406
|
+
'[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'
|
|
45407
|
+
);
|
|
45252
45408
|
}
|
|
45253
45409
|
result.push(inputRuleMatch.replaceWith);
|
|
45254
45410
|
}
|
|
@@ -45456,7 +45612,7 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
45456
45612
|
getExtensionField(this, "addOptions", {
|
|
45457
45613
|
name: this.name
|
|
45458
45614
|
})
|
|
45459
|
-
)
|
|
45615
|
+
)
|
|
45460
45616
|
};
|
|
45461
45617
|
}
|
|
45462
45618
|
get storage() {
|
|
@@ -45466,7 +45622,7 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
45466
45622
|
name: this.name,
|
|
45467
45623
|
options: this.options
|
|
45468
45624
|
})
|
|
45469
|
-
)
|
|
45625
|
+
)
|
|
45470
45626
|
};
|
|
45471
45627
|
}
|
|
45472
45628
|
configure(options = {}) {
|
|
@@ -45560,7 +45716,9 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
45560
45716
|
result.data = pasteRuleMatch.data;
|
|
45561
45717
|
if (pasteRuleMatch.replaceWith) {
|
|
45562
45718
|
if (!pasteRuleMatch.text.includes(pasteRuleMatch.replaceWith)) {
|
|
45563
|
-
console.warn(
|
|
45719
|
+
console.warn(
|
|
45720
|
+
'[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'
|
|
45721
|
+
);
|
|
45564
45722
|
}
|
|
45565
45723
|
result.push(pasteRuleMatch.replaceWith);
|
|
45566
45724
|
}
|
|
@@ -45702,7 +45860,10 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
45702
45860
|
setTimeout(() => {
|
|
45703
45861
|
const selection = dragFromOtherEditor.state.selection;
|
|
45704
45862
|
if (selection) {
|
|
45705
|
-
dragFromOtherEditor.commands.deleteRange({
|
|
45863
|
+
dragFromOtherEditor.commands.deleteRange({
|
|
45864
|
+
from: selection.from,
|
|
45865
|
+
to: selection.to
|
|
45866
|
+
});
|
|
45706
45867
|
}
|
|
45707
45868
|
}, 10);
|
|
45708
45869
|
}
|
|
@@ -45767,6 +45928,7 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
45767
45928
|
var ExtensionManager = class {
|
|
45768
45929
|
constructor(extensions, editor) {
|
|
45769
45930
|
this.splittableMarks = [];
|
|
45931
|
+
this.nonClearableMarks = [];
|
|
45770
45932
|
this.editor = editor;
|
|
45771
45933
|
this.baseExtensions = extensions;
|
|
45772
45934
|
this.extensions = resolveExtensions(extensions);
|
|
@@ -45786,7 +45948,11 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
45786
45948
|
editor: this.editor,
|
|
45787
45949
|
type: getSchemaTypeByName(extension.name, this.schema)
|
|
45788
45950
|
};
|
|
45789
|
-
const addCommands = getExtensionField(
|
|
45951
|
+
const addCommands = getExtensionField(
|
|
45952
|
+
extension,
|
|
45953
|
+
"addCommands",
|
|
45954
|
+
context
|
|
45955
|
+
);
|
|
45790
45956
|
if (!addCommands) {
|
|
45791
45957
|
return commands;
|
|
45792
45958
|
}
|
|
@@ -45831,7 +45997,11 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
45831
45997
|
}
|
|
45832
45998
|
const keyMapPlugin = keymap(defaultBindings);
|
|
45833
45999
|
plugins.push(keyMapPlugin);
|
|
45834
|
-
const addInputRules = getExtensionField(
|
|
46000
|
+
const addInputRules = getExtensionField(
|
|
46001
|
+
extension,
|
|
46002
|
+
"addInputRules",
|
|
46003
|
+
context
|
|
46004
|
+
);
|
|
45835
46005
|
if (isExtensionRulesEnabled(extension, editor.options.enableInputRules) && addInputRules) {
|
|
45836
46006
|
const rules = addInputRules();
|
|
45837
46007
|
if (rules && rules.length) {
|
|
@@ -45843,7 +46013,11 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
45843
46013
|
plugins.push(...inputPlugins);
|
|
45844
46014
|
}
|
|
45845
46015
|
}
|
|
45846
|
-
const addPasteRules = getExtensionField(
|
|
46016
|
+
const addPasteRules = getExtensionField(
|
|
46017
|
+
extension,
|
|
46018
|
+
"addPasteRules",
|
|
46019
|
+
context
|
|
46020
|
+
);
|
|
45847
46021
|
if (isExtensionRulesEnabled(extension, editor.options.enablePasteRules) && addPasteRules) {
|
|
45848
46022
|
const rules = addPasteRules();
|
|
45849
46023
|
if (rules && rules.length) {
|
|
@@ -45880,7 +46054,9 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
45880
46054
|
const { nodeExtensions } = splitExtensions(this.extensions);
|
|
45881
46055
|
return Object.fromEntries(
|
|
45882
46056
|
nodeExtensions.filter((extension) => !!getExtensionField(extension, "addNodeView")).map((extension) => {
|
|
45883
|
-
const extensionAttributes = this.attributes.filter(
|
|
46057
|
+
const extensionAttributes = this.attributes.filter(
|
|
46058
|
+
(attribute) => attribute.type === extension.name
|
|
46059
|
+
);
|
|
45884
46060
|
const context = {
|
|
45885
46061
|
name: extension.name,
|
|
45886
46062
|
options: extension.options,
|
|
@@ -45888,7 +46064,11 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
45888
46064
|
editor,
|
|
45889
46065
|
type: getNodeType(extension.name, this.schema)
|
|
45890
46066
|
};
|
|
45891
|
-
const addNodeView = getExtensionField(
|
|
46067
|
+
const addNodeView = getExtensionField(
|
|
46068
|
+
extension,
|
|
46069
|
+
"addNodeView",
|
|
46070
|
+
context
|
|
46071
|
+
);
|
|
45892
46072
|
if (!addNodeView) {
|
|
45893
46073
|
return [];
|
|
45894
46074
|
}
|
|
@@ -45982,7 +46162,9 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
45982
46162
|
const { markExtensions } = splitExtensions(this.extensions);
|
|
45983
46163
|
return Object.fromEntries(
|
|
45984
46164
|
markExtensions.filter((extension) => !!getExtensionField(extension, "addMarkView")).map((extension) => {
|
|
45985
|
-
const extensionAttributes = this.attributes.filter(
|
|
46165
|
+
const extensionAttributes = this.attributes.filter(
|
|
46166
|
+
(attribute) => attribute.type === extension.name
|
|
46167
|
+
);
|
|
45986
46168
|
const context = {
|
|
45987
46169
|
name: extension.name,
|
|
45988
46170
|
options: extension.options,
|
|
@@ -45990,7 +46172,11 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
45990
46172
|
editor,
|
|
45991
46173
|
type: getMarkType(extension.name, this.schema)
|
|
45992
46174
|
};
|
|
45993
|
-
const addMarkView = getExtensionField(
|
|
46175
|
+
const addMarkView = getExtensionField(
|
|
46176
|
+
extension,
|
|
46177
|
+
"addMarkView",
|
|
46178
|
+
context
|
|
46179
|
+
);
|
|
45994
46180
|
if (!addMarkView) {
|
|
45995
46181
|
return [];
|
|
45996
46182
|
}
|
|
@@ -46054,7 +46240,7 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
46054
46240
|
extensions.map((extension) => [extension.name, extension.storage])
|
|
46055
46241
|
);
|
|
46056
46242
|
extensions.forEach((extension) => {
|
|
46057
|
-
var _a;
|
|
46243
|
+
var _a, _b;
|
|
46058
46244
|
const context = {
|
|
46059
46245
|
name: extension.name,
|
|
46060
46246
|
options: extension.options,
|
|
@@ -46067,8 +46253,18 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
46067
46253
|
if (keepOnSplit) {
|
|
46068
46254
|
this.splittableMarks.push(extension.name);
|
|
46069
46255
|
}
|
|
46256
|
+
const clearable = (_b = callOrReturn(
|
|
46257
|
+
getExtensionField(extension, "clearable", context)
|
|
46258
|
+
)) != null ? _b : true;
|
|
46259
|
+
if (!clearable) {
|
|
46260
|
+
this.nonClearableMarks.push(extension.name);
|
|
46261
|
+
}
|
|
46070
46262
|
}
|
|
46071
|
-
const onBeforeCreate = getExtensionField(
|
|
46263
|
+
const onBeforeCreate = getExtensionField(
|
|
46264
|
+
extension,
|
|
46265
|
+
"onBeforeCreate",
|
|
46266
|
+
context
|
|
46267
|
+
);
|
|
46072
46268
|
const onCreate = getExtensionField(extension, "onCreate", context);
|
|
46073
46269
|
const onUpdate = getExtensionField(extension, "onUpdate", context);
|
|
46074
46270
|
const onSelectionUpdate = getExtensionField(
|
|
@@ -46076,7 +46272,11 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
46076
46272
|
"onSelectionUpdate",
|
|
46077
46273
|
context
|
|
46078
46274
|
);
|
|
46079
|
-
const onTransaction = getExtensionField(
|
|
46275
|
+
const onTransaction = getExtensionField(
|
|
46276
|
+
extension,
|
|
46277
|
+
"onTransaction",
|
|
46278
|
+
context
|
|
46279
|
+
);
|
|
46080
46280
|
const onFocus = getExtensionField(extension, "onFocus", context);
|
|
46081
46281
|
const onBlur = getExtensionField(extension, "onBlur", context);
|
|
46082
46282
|
const onDestroy = getExtensionField(extension, "onDestroy", context);
|
|
@@ -46167,15 +46367,16 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
46167
46367
|
const { editor } = this;
|
|
46168
46368
|
const { state, schema } = editor;
|
|
46169
46369
|
const { doc, selection } = state;
|
|
46170
|
-
const { ranges } = selection;
|
|
46171
|
-
const from = Math.min(...ranges.map((range2) => range2.$from.pos));
|
|
46172
|
-
const to = Math.max(...ranges.map((range2) => range2.$to.pos));
|
|
46173
46370
|
const textSerializers = getTextSerializersFromSchema(schema);
|
|
46174
|
-
const
|
|
46175
|
-
|
|
46176
|
-
...
|
|
46371
|
+
const { blockSeparator } = this.options;
|
|
46372
|
+
const options = {
|
|
46373
|
+
...blockSeparator !== void 0 ? { blockSeparator } : {},
|
|
46177
46374
|
textSerializers
|
|
46178
|
-
}
|
|
46375
|
+
};
|
|
46376
|
+
const sortedRanges = [...selection.ranges].sort((a, b) => a.$from.pos - b.$from.pos);
|
|
46377
|
+
return sortedRanges.map(
|
|
46378
|
+
({ $from, $to }) => getTextBetween(doc, { from: $from.pos, to: $to.pos }, options)
|
|
46379
|
+
).join(blockSeparator != null ? blockSeparator : "\n\n");
|
|
46179
46380
|
}
|
|
46180
46381
|
}
|
|
46181
46382
|
})
|
|
@@ -46201,28 +46402,35 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
46201
46402
|
if ((_d = (_c2 = (_b2 = (_a2 = this.editor.options.coreExtensionOptions) == null ? void 0 : _a2.delete) == null ? void 0 : _b2.filterTransaction) == null ? void 0 : _c2.call(_b2, transaction)) != null ? _d : transaction.getMeta("y-sync$")) {
|
|
46202
46403
|
return;
|
|
46203
46404
|
}
|
|
46204
|
-
const nextTransaction = combineTransactionSteps(transaction.before, [
|
|
46405
|
+
const nextTransaction = combineTransactionSteps(transaction.before, [
|
|
46406
|
+
transaction,
|
|
46407
|
+
...appendedTransactions
|
|
46408
|
+
]);
|
|
46205
46409
|
const changes = getChangedRanges(nextTransaction);
|
|
46206
46410
|
changes.forEach((change) => {
|
|
46207
46411
|
if (nextTransaction.mapping.mapResult(change.oldRange.from).deletedAfter && nextTransaction.mapping.mapResult(change.oldRange.to).deletedBefore) {
|
|
46208
|
-
nextTransaction.before.nodesBetween(
|
|
46209
|
-
|
|
46210
|
-
|
|
46211
|
-
|
|
46212
|
-
|
|
46213
|
-
|
|
46214
|
-
|
|
46215
|
-
|
|
46216
|
-
|
|
46217
|
-
|
|
46218
|
-
|
|
46219
|
-
|
|
46220
|
-
|
|
46221
|
-
|
|
46222
|
-
|
|
46223
|
-
|
|
46224
|
-
|
|
46225
|
-
|
|
46412
|
+
nextTransaction.before.nodesBetween(
|
|
46413
|
+
change.oldRange.from,
|
|
46414
|
+
change.oldRange.to,
|
|
46415
|
+
(node, from) => {
|
|
46416
|
+
const to = from + node.nodeSize - 2;
|
|
46417
|
+
const isFullyWithinRange = change.oldRange.from <= from && to <= change.oldRange.to;
|
|
46418
|
+
this.editor.emit("delete", {
|
|
46419
|
+
type: "node",
|
|
46420
|
+
node,
|
|
46421
|
+
from,
|
|
46422
|
+
to,
|
|
46423
|
+
newFrom: nextTransaction.mapping.map(from),
|
|
46424
|
+
newTo: nextTransaction.mapping.map(to),
|
|
46425
|
+
deletedRange: change.oldRange,
|
|
46426
|
+
newRange: change.newRange,
|
|
46427
|
+
partial: !isFullyWithinRange,
|
|
46428
|
+
editor: this.editor,
|
|
46429
|
+
transaction,
|
|
46430
|
+
combinedTransform: nextTransaction
|
|
46431
|
+
});
|
|
46432
|
+
}
|
|
46433
|
+
);
|
|
46226
46434
|
}
|
|
46227
46435
|
});
|
|
46228
46436
|
const mapping = nextTransaction.mapping;
|
|
@@ -46402,7 +46610,9 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
46402
46610
|
return;
|
|
46403
46611
|
}
|
|
46404
46612
|
const docChanges = transactions.some((transaction) => transaction.docChanged) && !oldState.doc.eq(newState.doc);
|
|
46405
|
-
const ignoreTr = transactions.some(
|
|
46613
|
+
const ignoreTr = transactions.some(
|
|
46614
|
+
(transaction) => transaction.getMeta("preventClearDocument")
|
|
46615
|
+
);
|
|
46406
46616
|
if (!docChanges || ignoreTr) {
|
|
46407
46617
|
return;
|
|
46408
46618
|
}
|
|
@@ -46571,7 +46781,9 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
46571
46781
|
let to = this.to;
|
|
46572
46782
|
if (this.isBlock) {
|
|
46573
46783
|
if (this.content.size === 0) {
|
|
46574
|
-
console.error(
|
|
46784
|
+
console.error(
|
|
46785
|
+
`You can\u2019t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`
|
|
46786
|
+
);
|
|
46575
46787
|
return;
|
|
46576
46788
|
}
|
|
46577
46789
|
from = this.from + 1;
|
|
@@ -46642,7 +46854,12 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
46642
46854
|
if (!isBlock && !isInline && $pos.depth <= this.depth) {
|
|
46643
46855
|
return;
|
|
46644
46856
|
}
|
|
46645
|
-
const childNodePos = new _NodePos(
|
|
46857
|
+
const childNodePos = new _NodePos(
|
|
46858
|
+
$pos,
|
|
46859
|
+
this.editor,
|
|
46860
|
+
isBlock,
|
|
46861
|
+
isBlock || isInline ? node : null
|
|
46862
|
+
);
|
|
46646
46863
|
if (isBlock) {
|
|
46647
46864
|
childNodePos.actualDepth = this.depth + 1;
|
|
46648
46865
|
}
|
|
@@ -46693,7 +46910,9 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
46693
46910
|
return;
|
|
46694
46911
|
}
|
|
46695
46912
|
if (childPos.node.type.name === selector) {
|
|
46696
|
-
const doesAllAttributesMatch = attrKeys.every(
|
|
46913
|
+
const doesAllAttributesMatch = attrKeys.every(
|
|
46914
|
+
(key) => attributes[key] === childPos.node.attrs[key]
|
|
46915
|
+
);
|
|
46697
46916
|
if (doesAllAttributesMatch) {
|
|
46698
46917
|
nodes.push(childPos);
|
|
46699
46918
|
}
|
|
@@ -46790,7 +47009,7 @@ img.ProseMirror-separator {
|
|
|
46790
47009
|
|
|
46791
47010
|
// src/utilities/createStyleTag.ts
|
|
46792
47011
|
function createStyleTag(style2, nonce, suffix) {
|
|
46793
|
-
const tiptapStyleTag = document.querySelector(`style[data-tiptap-style${""}]`);
|
|
47012
|
+
const tiptapStyleTag = document.querySelector(`style[data-tiptap-style${suffix ? `-${suffix}` : ""}]`);
|
|
46794
47013
|
if (tiptapStyleTag !== null) {
|
|
46795
47014
|
return tiptapStyleTag;
|
|
46796
47015
|
}
|
|
@@ -46798,7 +47017,7 @@ img.ProseMirror-separator {
|
|
|
46798
47017
|
if (nonce) {
|
|
46799
47018
|
styleNode.setAttribute("nonce", nonce);
|
|
46800
47019
|
}
|
|
46801
|
-
styleNode.setAttribute(`data-tiptap-style${""}`, "");
|
|
47020
|
+
styleNode.setAttribute(`data-tiptap-style${suffix ? `-${suffix}` : ""}`, "");
|
|
46802
47021
|
styleNode.innerHTML = style2;
|
|
46803
47022
|
document.getElementsByTagName("head")[0].appendChild(styleNode);
|
|
46804
47023
|
return styleNode;
|
|
@@ -47157,7 +47376,9 @@ img.ProseMirror-separator {
|
|
|
47157
47376
|
errorOnInvalidContent: this.options.enableContentCheck
|
|
47158
47377
|
});
|
|
47159
47378
|
} catch (e) {
|
|
47160
|
-
if (!(e instanceof Error) || !["[tiptap error]: Invalid JSON content", "[tiptap error]: Invalid HTML content"].includes(
|
|
47379
|
+
if (!(e instanceof Error) || !["[tiptap error]: Invalid JSON content", "[tiptap error]: Invalid HTML content"].includes(
|
|
47380
|
+
e.message
|
|
47381
|
+
)) {
|
|
47161
47382
|
throw e;
|
|
47162
47383
|
}
|
|
47163
47384
|
this.emit("contentError", {
|
|
@@ -47167,7 +47388,9 @@ img.ProseMirror-separator {
|
|
|
47167
47388
|
if ("collaboration" in this.storage && typeof this.storage.collaboration === "object" && this.storage.collaboration) {
|
|
47168
47389
|
this.storage.collaboration.isDisabled = true;
|
|
47169
47390
|
}
|
|
47170
|
-
this.options.extensions = this.options.extensions.filter(
|
|
47391
|
+
this.options.extensions = this.options.extensions.filter(
|
|
47392
|
+
(extension) => extension.name !== "collaboration"
|
|
47393
|
+
);
|
|
47171
47394
|
this.createExtensionManager();
|
|
47172
47395
|
}
|
|
47173
47396
|
});
|
|
@@ -47285,7 +47508,7 @@ img.ProseMirror-separator {
|
|
|
47285
47508
|
this.emit("focus", {
|
|
47286
47509
|
editor: this,
|
|
47287
47510
|
event: focus2.event,
|
|
47288
|
-
//
|
|
47511
|
+
// oxlint-disable-next-lineno-non-null-assertion
|
|
47289
47512
|
transaction: mostRecentFocusTr
|
|
47290
47513
|
});
|
|
47291
47514
|
}
|
|
@@ -47293,7 +47516,7 @@ img.ProseMirror-separator {
|
|
|
47293
47516
|
this.emit("blur", {
|
|
47294
47517
|
editor: this,
|
|
47295
47518
|
event: blur2.event,
|
|
47296
|
-
//
|
|
47519
|
+
// oxlint-disable-next-lineno-non-null-assertion
|
|
47297
47520
|
transaction: mostRecentFocusTr
|
|
47298
47521
|
});
|
|
47299
47522
|
}
|
|
@@ -47811,7 +48034,9 @@ ${renderedContent}
|
|
|
47811
48034
|
return index !== void 0 ? index : -1;
|
|
47812
48035
|
},
|
|
47813
48036
|
tokenize(src, _tokens, _lexer) {
|
|
47814
|
-
const tokenPattern = selfClosing ? new RegExp(`^\\[${escapedShortcode}\\s*([^\\]]*)\\]`) : new RegExp(
|
|
48037
|
+
const tokenPattern = selfClosing ? new RegExp(`^\\[${escapedShortcode}\\s*([^\\]]*)\\]`) : new RegExp(
|
|
48038
|
+
`^\\[${escapedShortcode}\\s*([^\\]]*)\\]([\\s\\S]*?)\\[\\/${escapedShortcode}\\]`
|
|
48039
|
+
);
|
|
47815
48040
|
const match = src.match(tokenPattern);
|
|
47816
48041
|
if (!match) {
|
|
47817
48042
|
return void 0;
|
|
@@ -48107,7 +48332,9 @@ ${indentedChild}`;
|
|
|
48107
48332
|
const marks = storedMarks || selection.$to.parentOffset && selection.$from.marks();
|
|
48108
48333
|
return chain().insertContent({ type: this.name }).command(({ tr, dispatch }) => {
|
|
48109
48334
|
if (dispatch && marks && keepMarks) {
|
|
48110
|
-
const filteredMarks = marks.filter(
|
|
48335
|
+
const filteredMarks = marks.filter(
|
|
48336
|
+
(mark) => splittableMarks.includes(mark.type.name)
|
|
48337
|
+
);
|
|
48111
48338
|
tr.ensureMarks(filteredMarks);
|
|
48112
48339
|
}
|
|
48113
48340
|
return true;
|
|
@@ -58293,7 +58520,7 @@ ${indentedChild}`;
|
|
|
58293
58520
|
href: {},
|
|
58294
58521
|
rel: { default: 'noopener noreferrer' },
|
|
58295
58522
|
// Adding `class` here is a workaround to render two mentions without a whitespace as display names
|
|
58296
|
-
//
|
|
58523
|
+
// For more details on this behavior, refer to the issue below:
|
|
58297
58524
|
// https://github.com/ni/nimble/issues/1707
|
|
58298
58525
|
class: { default: '' }
|
|
58299
58526
|
},
|
|
@@ -58332,7 +58559,7 @@ ${indentedChild}`;
|
|
|
58332
58559
|
: null,
|
|
58333
58560
|
rel: node.attrs.rel,
|
|
58334
58561
|
// Adding `class` here is a workaround to render two mentions without a whitespace as display names
|
|
58335
|
-
//
|
|
58562
|
+
// For more details on this behavior, refer to the issue below:
|
|
58336
58563
|
// https://github.com/ni/nimble/issues/1707
|
|
58337
58564
|
class: href,
|
|
58338
58565
|
'underline-hidden': _a$4.startsWithHttpOrHttps(href)
|
|
@@ -58878,7 +59105,9 @@ ${indentedChild}`;
|
|
|
58878
59105
|
}
|
|
58879
59106
|
const { children, ...rest } = attributes != null ? attributes : {};
|
|
58880
59107
|
if (tag === "svg") {
|
|
58881
|
-
throw new Error(
|
|
59108
|
+
throw new Error(
|
|
59109
|
+
"SVG elements are not supported in the JSX syntax, use the array syntax instead"
|
|
59110
|
+
);
|
|
58882
59111
|
}
|
|
58883
59112
|
return [tag, rest, children];
|
|
58884
59113
|
};
|
|
@@ -60849,7 +61078,9 @@ ${indentedChild}`;
|
|
|
60849
61078
|
key: new PluginKey("autolink"),
|
|
60850
61079
|
appendTransaction: (transactions, oldState, newState) => {
|
|
60851
61080
|
const docChanges = transactions.some((transaction) => transaction.docChanged) && !oldState.doc.eq(newState.doc);
|
|
60852
|
-
const preventAutolink = transactions.some(
|
|
61081
|
+
const preventAutolink = transactions.some(
|
|
61082
|
+
(transaction) => transaction.getMeta("preventAutolink")
|
|
61083
|
+
);
|
|
60853
61084
|
if (!docChanges || preventAutolink) {
|
|
60854
61085
|
return;
|
|
60855
61086
|
}
|
|
@@ -60857,7 +61088,11 @@ ${indentedChild}`;
|
|
|
60857
61088
|
const transform = combineTransactionSteps(oldState.doc, [...transactions]);
|
|
60858
61089
|
const changes = getChangedRanges(transform);
|
|
60859
61090
|
changes.forEach(({ newRange }) => {
|
|
60860
|
-
const nodesInChangedRanges = findChildrenInRange(
|
|
61091
|
+
const nodesInChangedRanges = findChildrenInRange(
|
|
61092
|
+
newState.doc,
|
|
61093
|
+
newRange,
|
|
61094
|
+
(node) => node.isTextblock
|
|
61095
|
+
);
|
|
60861
61096
|
let textBlock;
|
|
60862
61097
|
let textBeforeWhitespace;
|
|
60863
61098
|
if (nodesInChangedRanges.length > 1) {
|
|
@@ -60874,7 +61109,12 @@ ${indentedChild}`;
|
|
|
60874
61109
|
return;
|
|
60875
61110
|
}
|
|
60876
61111
|
textBlock = nodesInChangedRanges[0];
|
|
60877
|
-
textBeforeWhitespace = newState.doc.textBetween(
|
|
61112
|
+
textBeforeWhitespace = newState.doc.textBetween(
|
|
61113
|
+
textBlock.pos,
|
|
61114
|
+
newRange.to,
|
|
61115
|
+
void 0,
|
|
61116
|
+
" "
|
|
61117
|
+
);
|
|
60878
61118
|
}
|
|
60879
61119
|
if (textBlock && textBeforeWhitespace) {
|
|
60880
61120
|
const wordsBeforeWhitespace = textBeforeWhitespace.split(UNICODE_WHITESPACE_REGEX).filter(Boolean);
|
|
@@ -60886,7 +61126,9 @@ ${indentedChild}`;
|
|
|
60886
61126
|
if (!lastWordBeforeSpace) {
|
|
60887
61127
|
return false;
|
|
60888
61128
|
}
|
|
60889
|
-
const linksBeforeSpace = tokenize(lastWordBeforeSpace).map(
|
|
61129
|
+
const linksBeforeSpace = tokenize(lastWordBeforeSpace).map(
|
|
61130
|
+
(t) => t.toObject(options.defaultProtocol)
|
|
61131
|
+
);
|
|
60890
61132
|
if (!isValidLinkStructure(linksBeforeSpace)) {
|
|
60891
61133
|
return false;
|
|
60892
61134
|
}
|
|
@@ -60900,7 +61142,9 @@ ${indentedChild}`;
|
|
|
60900
61142
|
}
|
|
60901
61143
|
return !newState.doc.rangeHasMark(link.from, link.to, newState.schema.marks.code);
|
|
60902
61144
|
}).filter((link) => options.validate(link.value)).filter((link) => options.shouldAutoLink(link.value)).forEach((link) => {
|
|
60903
|
-
if (getMarksBetween(link.from, link.to, newState.doc).some(
|
|
61145
|
+
if (getMarksBetween(link.from, link.to, newState.doc).some(
|
|
61146
|
+
(item) => item.mark.type === options.type
|
|
61147
|
+
)) {
|
|
60904
61148
|
return;
|
|
60905
61149
|
}
|
|
60906
61150
|
tr.addMark(
|
|
@@ -60998,7 +61242,18 @@ ${indentedChild}`;
|
|
|
60998
61242
|
});
|
|
60999
61243
|
}
|
|
61000
61244
|
function isAllowedUri(uri, protocols) {
|
|
61001
|
-
const allowedProtocols = [
|
|
61245
|
+
const allowedProtocols = [
|
|
61246
|
+
"http",
|
|
61247
|
+
"https",
|
|
61248
|
+
"ftp",
|
|
61249
|
+
"ftps",
|
|
61250
|
+
"mailto",
|
|
61251
|
+
"tel",
|
|
61252
|
+
"callto",
|
|
61253
|
+
"sms",
|
|
61254
|
+
"cid",
|
|
61255
|
+
"xmpp"
|
|
61256
|
+
];
|
|
61002
61257
|
if (protocols) {
|
|
61003
61258
|
protocols.forEach((protocol) => {
|
|
61004
61259
|
const nextProtocol = typeof protocol === "string" ? protocol : protocol.scheme;
|
|
@@ -61009,7 +61264,7 @@ ${indentedChild}`;
|
|
|
61009
61264
|
}
|
|
61010
61265
|
return !uri || uri.replace(UNICODE_WHITESPACE_REGEX_GLOBAL, "").match(
|
|
61011
61266
|
new RegExp(
|
|
61012
|
-
//
|
|
61267
|
+
// oxlint-disable-next-line no-useless-escape
|
|
61013
61268
|
`^(?:(?:${allowedProtocols.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,
|
|
61014
61269
|
"i"
|
|
61015
61270
|
)
|
|
@@ -61023,7 +61278,9 @@ ${indentedChild}`;
|
|
|
61023
61278
|
onCreate() {
|
|
61024
61279
|
if (this.options.validate && !this.options.shouldAutoLink) {
|
|
61025
61280
|
this.options.shouldAutoLink = this.options.validate;
|
|
61026
|
-
console.warn(
|
|
61281
|
+
console.warn(
|
|
61282
|
+
"The `validate` option is deprecated. Rename to the `shouldAutoLink` option instead."
|
|
61283
|
+
);
|
|
61027
61284
|
}
|
|
61028
61285
|
this.options.protocols.forEach((protocol) => {
|
|
61029
61286
|
if (typeof protocol === "string") {
|
|
@@ -61330,6 +61587,109 @@ ${indentedChild}`;
|
|
|
61330
61587
|
return [inputRule];
|
|
61331
61588
|
}
|
|
61332
61589
|
});
|
|
61590
|
+
|
|
61591
|
+
// src/helpers/getBranchingNestedListAtCursor.ts
|
|
61592
|
+
var getBranchingNestedListAtCursor = (state, itemName, wrapperNames) => {
|
|
61593
|
+
const { selection } = state;
|
|
61594
|
+
if (!selection.empty) {
|
|
61595
|
+
return null;
|
|
61596
|
+
}
|
|
61597
|
+
const { $from } = selection;
|
|
61598
|
+
if (!$from.parent.isTextblock) {
|
|
61599
|
+
return null;
|
|
61600
|
+
}
|
|
61601
|
+
if ($from.parentOffset !== $from.parent.content.size) {
|
|
61602
|
+
return null;
|
|
61603
|
+
}
|
|
61604
|
+
let listItemDepth = -1;
|
|
61605
|
+
for (let depth = $from.depth; depth > 0; depth -= 1) {
|
|
61606
|
+
if ($from.node(depth).type.name === itemName) {
|
|
61607
|
+
listItemDepth = depth;
|
|
61608
|
+
break;
|
|
61609
|
+
}
|
|
61610
|
+
}
|
|
61611
|
+
if (listItemDepth < 0) {
|
|
61612
|
+
return null;
|
|
61613
|
+
}
|
|
61614
|
+
const listItem = $from.node(listItemDepth);
|
|
61615
|
+
const indexInListItem = $from.index(listItemDepth);
|
|
61616
|
+
if (indexInListItem + 1 >= listItem.childCount) {
|
|
61617
|
+
return null;
|
|
61618
|
+
}
|
|
61619
|
+
const nextChild = listItem.child(indexInListItem + 1);
|
|
61620
|
+
if (!wrapperNames.includes(nextChild.type.name)) {
|
|
61621
|
+
return null;
|
|
61622
|
+
}
|
|
61623
|
+
const itemType = state.schema.nodes[itemName];
|
|
61624
|
+
let hasBranching = false;
|
|
61625
|
+
nextChild.forEach((child) => {
|
|
61626
|
+
if (child.type === itemType && child.childCount > 1) {
|
|
61627
|
+
hasBranching = true;
|
|
61628
|
+
}
|
|
61629
|
+
});
|
|
61630
|
+
if (!hasBranching) {
|
|
61631
|
+
return null;
|
|
61632
|
+
}
|
|
61633
|
+
const nodeAfter = state.doc.resolve($from.after()).nodeAfter;
|
|
61634
|
+
if (!nodeAfter || !wrapperNames.includes(nodeAfter.type.name)) {
|
|
61635
|
+
return null;
|
|
61636
|
+
}
|
|
61637
|
+
const items = [];
|
|
61638
|
+
nodeAfter.forEach((child) => {
|
|
61639
|
+
items.push(child);
|
|
61640
|
+
});
|
|
61641
|
+
if (items.length === 0) {
|
|
61642
|
+
return null;
|
|
61643
|
+
}
|
|
61644
|
+
return {
|
|
61645
|
+
listItemDepth,
|
|
61646
|
+
nestedList: nodeAfter,
|
|
61647
|
+
nestedListPos: $from.after(),
|
|
61648
|
+
insertPos: $from.after(listItemDepth),
|
|
61649
|
+
items
|
|
61650
|
+
};
|
|
61651
|
+
};
|
|
61652
|
+
|
|
61653
|
+
// src/helpers/hoistBranchingNestedList.ts
|
|
61654
|
+
var hoistBranchingNestedList = (state, dispatch, itemName, wrapperNames) => {
|
|
61655
|
+
const context = getBranchingNestedListAtCursor(state, itemName, wrapperNames);
|
|
61656
|
+
if (!context) {
|
|
61657
|
+
return false;
|
|
61658
|
+
}
|
|
61659
|
+
const { selection } = state;
|
|
61660
|
+
const { nestedList, nestedListPos, insertPos, items } = context;
|
|
61661
|
+
const tr = state.tr;
|
|
61662
|
+
tr.delete(nestedListPos, nestedListPos + nestedList.nodeSize);
|
|
61663
|
+
const mappedInsertPos = tr.mapping.map(insertPos);
|
|
61664
|
+
tr.insert(mappedInsertPos, Fragment.from(items));
|
|
61665
|
+
tr.setSelection(selection.map(tr.doc, tr.mapping));
|
|
61666
|
+
if (dispatch) {
|
|
61667
|
+
dispatch(tr);
|
|
61668
|
+
}
|
|
61669
|
+
return true;
|
|
61670
|
+
};
|
|
61671
|
+
|
|
61672
|
+
// src/helpers/handleDeleteBranchingNestedList.ts
|
|
61673
|
+
var handleDeleteBranchingNestedList = (editor, itemName, wrapperNames) => {
|
|
61674
|
+
return hoistBranchingNestedList(editor.state, editor.view.dispatch, itemName, wrapperNames);
|
|
61675
|
+
};
|
|
61676
|
+
|
|
61677
|
+
// src/helpers/createBranchingListDeleteKeymap.ts
|
|
61678
|
+
var createBranchingListDeleteKeymap = (itemName, wrapperNames) => {
|
|
61679
|
+
return Extension.create({
|
|
61680
|
+
name: `${itemName}BranchingDeleteKeymap`,
|
|
61681
|
+
priority: 101,
|
|
61682
|
+
addKeyboardShortcuts() {
|
|
61683
|
+
const handleDelete2 = () => handleDeleteBranchingNestedList(this.editor, itemName, wrapperNames);
|
|
61684
|
+
return {
|
|
61685
|
+
Delete: handleDelete2,
|
|
61686
|
+
"Mod-Delete": handleDelete2
|
|
61687
|
+
};
|
|
61688
|
+
}
|
|
61689
|
+
});
|
|
61690
|
+
};
|
|
61691
|
+
|
|
61692
|
+
// src/item/list-item.ts
|
|
61333
61693
|
function isSameLineOrderedListToken(token) {
|
|
61334
61694
|
var _a, _b;
|
|
61335
61695
|
const nestedToken = (_a = token.tokens) == null ? void 0 : _a[0];
|
|
@@ -61444,6 +61804,14 @@ ${indentedChild}`;
|
|
|
61444
61804
|
ctx
|
|
61445
61805
|
);
|
|
61446
61806
|
},
|
|
61807
|
+
addExtensions() {
|
|
61808
|
+
return [
|
|
61809
|
+
createBranchingListDeleteKeymap(this.name, [
|
|
61810
|
+
this.options.bulletListTypeName,
|
|
61811
|
+
this.options.orderedListTypeName
|
|
61812
|
+
])
|
|
61813
|
+
];
|
|
61814
|
+
},
|
|
61447
61815
|
addKeyboardShortcuts() {
|
|
61448
61816
|
return {
|
|
61449
61817
|
Enter: () => this.editor.commands.splitListItem(this.name),
|
|
@@ -61508,33 +61876,6 @@ ${indentedChild}`;
|
|
|
61508
61876
|
return true;
|
|
61509
61877
|
};
|
|
61510
61878
|
|
|
61511
|
-
// src/keymap/listHelpers/hasListItemBefore.ts
|
|
61512
|
-
var hasListItemBefore = (typeOrName, state) => {
|
|
61513
|
-
var _a;
|
|
61514
|
-
const { $anchor } = state.selection;
|
|
61515
|
-
const $targetPos = state.doc.resolve($anchor.pos - 2);
|
|
61516
|
-
if ($targetPos.index() === 0) {
|
|
61517
|
-
return false;
|
|
61518
|
-
}
|
|
61519
|
-
if (((_a = $targetPos.nodeBefore) == null ? void 0 : _a.type.name) !== typeOrName) {
|
|
61520
|
-
return false;
|
|
61521
|
-
}
|
|
61522
|
-
return true;
|
|
61523
|
-
};
|
|
61524
|
-
var listItemHasSubList = (typeOrName, state, node) => {
|
|
61525
|
-
if (!node) {
|
|
61526
|
-
return false;
|
|
61527
|
-
}
|
|
61528
|
-
const nodeType = getNodeType(typeOrName, state.schema);
|
|
61529
|
-
let hasSubList = false;
|
|
61530
|
-
node.descendants((child) => {
|
|
61531
|
-
if (child.type === nodeType) {
|
|
61532
|
-
hasSubList = true;
|
|
61533
|
-
}
|
|
61534
|
-
});
|
|
61535
|
-
return hasSubList;
|
|
61536
|
-
};
|
|
61537
|
-
|
|
61538
61879
|
// src/keymap/listHelpers/handleBackspace.ts
|
|
61539
61880
|
var handleBackspace = (editor, name, parentListTypes) => {
|
|
61540
61881
|
if (editor.commands.undoInputRule()) {
|
|
@@ -61565,16 +61906,6 @@ ${indentedChild}`;
|
|
|
61565
61906
|
if (!isAtStartOfNode(editor.state)) {
|
|
61566
61907
|
return false;
|
|
61567
61908
|
}
|
|
61568
|
-
const listItemPos = findListItemPos(name, editor.state);
|
|
61569
|
-
if (!listItemPos) {
|
|
61570
|
-
return false;
|
|
61571
|
-
}
|
|
61572
|
-
const $prev = editor.state.doc.resolve(listItemPos.$pos.pos - 2);
|
|
61573
|
-
const prevNode = $prev.node(listItemPos.depth);
|
|
61574
|
-
const previousListItemHasSubList = listItemHasSubList(name, editor.state, prevNode);
|
|
61575
|
-
if (hasListItemBefore(name, editor.state) && !previousListItemHasSubList) {
|
|
61576
|
-
return editor.commands.joinItemBackward();
|
|
61577
|
-
}
|
|
61578
61909
|
return editor.chain().liftListItem(name).run();
|
|
61579
61910
|
};
|
|
61580
61911
|
|
|
@@ -61640,6 +61971,33 @@ ${indentedChild}`;
|
|
|
61640
61971
|
return true;
|
|
61641
61972
|
};
|
|
61642
61973
|
|
|
61974
|
+
// src/keymap/listHelpers/hasListItemBefore.ts
|
|
61975
|
+
var hasListItemBefore = (typeOrName, state) => {
|
|
61976
|
+
var _a;
|
|
61977
|
+
const { $anchor } = state.selection;
|
|
61978
|
+
const $targetPos = state.doc.resolve($anchor.pos - 2);
|
|
61979
|
+
if ($targetPos.index() === 0) {
|
|
61980
|
+
return false;
|
|
61981
|
+
}
|
|
61982
|
+
if (((_a = $targetPos.nodeBefore) == null ? void 0 : _a.type.name) !== typeOrName) {
|
|
61983
|
+
return false;
|
|
61984
|
+
}
|
|
61985
|
+
return true;
|
|
61986
|
+
};
|
|
61987
|
+
var listItemHasSubList = (typeOrName, state, node) => {
|
|
61988
|
+
if (!node) {
|
|
61989
|
+
return false;
|
|
61990
|
+
}
|
|
61991
|
+
const nodeType = getNodeType(typeOrName, state.schema);
|
|
61992
|
+
let hasSubList = false;
|
|
61993
|
+
node.descendants((child) => {
|
|
61994
|
+
if (child.type === nodeType) {
|
|
61995
|
+
hasSubList = true;
|
|
61996
|
+
}
|
|
61997
|
+
});
|
|
61998
|
+
return hasSubList;
|
|
61999
|
+
};
|
|
62000
|
+
|
|
61643
62001
|
// src/keymap/list-keymap.ts
|
|
61644
62002
|
var ListKeymap = Extension.create({
|
|
61645
62003
|
name: "listKeymap",
|
|
@@ -61716,7 +62074,14 @@ ${indentedChild}`;
|
|
|
61716
62074
|
var INDENTED_LINE_REGEX = /^\s/;
|
|
61717
62075
|
function isBlockContentLine(line) {
|
|
61718
62076
|
const trimmedLine = line.trimStart();
|
|
61719
|
-
return
|
|
62077
|
+
return (
|
|
62078
|
+
// oxlint-disable-next-line prefer-string-starts-ends-with
|
|
62079
|
+
/^[-+*]\s+/.test(trimmedLine) || // oxlint-disable-next-line prefer-string-starts-ends-with
|
|
62080
|
+
/^\d+\.\s+/.test(trimmedLine) || // oxlint-disable-next-line prefer-string-starts-ends-with
|
|
62081
|
+
/^>\s?/.test(trimmedLine) || // oxlint-disable-next-line prefer-string-starts-ends-with
|
|
62082
|
+
/^```/.test(trimmedLine) || // oxlint-disable-next-line prefer-string-starts-ends-with
|
|
62083
|
+
/^~~~/.test(trimmedLine)
|
|
62084
|
+
);
|
|
61720
62085
|
}
|
|
61721
62086
|
function splitItemContent(contentLines) {
|
|
61722
62087
|
const paragraphLines = [];
|
|
@@ -62092,6 +62457,12 @@ ${indentedChild}`;
|
|
|
62092
62457
|
const prefix = `- [${checkedChar}] `;
|
|
62093
62458
|
return renderNestedMarkdownContent(node, h, prefix);
|
|
62094
62459
|
},
|
|
62460
|
+
addExtensions() {
|
|
62461
|
+
if (!this.options.nested) {
|
|
62462
|
+
return [];
|
|
62463
|
+
}
|
|
62464
|
+
return [createBranchingListDeleteKeymap(this.name, [this.options.taskListTypeName])];
|
|
62465
|
+
},
|
|
62095
62466
|
addKeyboardShortcuts() {
|
|
62096
62467
|
const shortcuts = {
|
|
62097
62468
|
Enter: () => this.editor.commands.splitListItem(this.name),
|
|
@@ -62230,7 +62601,11 @@ ${indentedChild}`;
|
|
|
62230
62601
|
];
|
|
62231
62602
|
},
|
|
62232
62603
|
renderHTML({ HTMLAttributes }) {
|
|
62233
|
-
return [
|
|
62604
|
+
return [
|
|
62605
|
+
"ul",
|
|
62606
|
+
mergeAttributes(this.options.HTMLAttributes, HTMLAttributes, { "data-type": this.name }),
|
|
62607
|
+
0
|
|
62608
|
+
];
|
|
62234
62609
|
},
|
|
62235
62610
|
parseMarkdown: (token, h) => {
|
|
62236
62611
|
return h.createNode("taskList", {}, h.parseChildren(token.items || []));
|
|
@@ -62367,7 +62742,14 @@ ${indentedChild}`;
|
|
|
62367
62742
|
// src/suggestion.ts
|
|
62368
62743
|
function findSuggestionMatch(config) {
|
|
62369
62744
|
var _a;
|
|
62370
|
-
const {
|
|
62745
|
+
const {
|
|
62746
|
+
char,
|
|
62747
|
+
allowSpaces: allowSpacesOption,
|
|
62748
|
+
allowToIncludeChar,
|
|
62749
|
+
allowedPrefixes,
|
|
62750
|
+
startOfLine,
|
|
62751
|
+
$position
|
|
62752
|
+
} = config;
|
|
62371
62753
|
const allowSpaces = allowSpacesOption && !allowToIncludeChar;
|
|
62372
62754
|
const escapedChar = escapeForRegEx(char);
|
|
62373
62755
|
const suffix = new RegExp(`\\s${escapedChar}$`);
|
|
@@ -62500,7 +62882,11 @@ ${indentedChild}`;
|
|
|
62500
62882
|
text: (state == null ? void 0 : state.text) || null,
|
|
62501
62883
|
items: [],
|
|
62502
62884
|
command: (commandProps) => {
|
|
62503
|
-
return command({
|
|
62885
|
+
return command({
|
|
62886
|
+
editor,
|
|
62887
|
+
range: (state == null ? void 0 : state.range) || { from: 0, to: 0 },
|
|
62888
|
+
props: commandProps
|
|
62889
|
+
});
|
|
62504
62890
|
},
|
|
62505
62891
|
decorationNode,
|
|
62506
62892
|
clientRect: clientRectFor(view, decorationNode)
|
|
@@ -62530,7 +62916,9 @@ ${indentedChild}`;
|
|
|
62530
62916
|
return;
|
|
62531
62917
|
}
|
|
62532
62918
|
const state = handleExit && !handleStart ? prev : next;
|
|
62533
|
-
const decorationNode = view.dom.querySelector(
|
|
62919
|
+
const decorationNode = view.dom.querySelector(
|
|
62920
|
+
`[data-decoration-id="${state.decorationId}"]`
|
|
62921
|
+
);
|
|
62534
62922
|
props = {
|
|
62535
62923
|
editor,
|
|
62536
62924
|
range: state.range,
|
|
@@ -62882,7 +63270,11 @@ ${indentedChild}`;
|
|
|
62882
63270
|
suggestion
|
|
62883
63271
|
});
|
|
62884
63272
|
if (typeof html === "string") {
|
|
62885
|
-
return [
|
|
63273
|
+
return [
|
|
63274
|
+
"span",
|
|
63275
|
+
mergeAttributes({ "data-type": this.name }, this.options.HTMLAttributes, HTMLAttributes),
|
|
63276
|
+
html
|
|
63277
|
+
];
|
|
62886
63278
|
}
|
|
62887
63279
|
return html;
|
|
62888
63280
|
},
|
|
@@ -64215,6 +64607,9 @@ ${indentedChild}`;
|
|
|
64215
64607
|
};
|
|
64216
64608
|
}
|
|
64217
64609
|
});
|
|
64610
|
+
var DEFAULT_DATA_ATTRIBUTE = "placeholder";
|
|
64611
|
+
var PLUGIN_KEY = new PluginKey("tiptap__placeholder");
|
|
64612
|
+
var VIEWPORT_OVERSCAN_PX = 200;
|
|
64218
64613
|
function createPlaceholderDecoration(options) {
|
|
64219
64614
|
const {
|
|
64220
64615
|
editor,
|
|
@@ -64241,6 +64636,96 @@ ${indentedChild}`;
|
|
|
64241
64636
|
});
|
|
64242
64637
|
}
|
|
64243
64638
|
|
|
64639
|
+
// src/placeholder/utils/buildPlaceholderDecorations.ts
|
|
64640
|
+
function resolveEmptyNodeClass(emptyNodeClass, props) {
|
|
64641
|
+
return typeof emptyNodeClass === "function" ? emptyNodeClass(props) : emptyNodeClass;
|
|
64642
|
+
}
|
|
64643
|
+
function buildPlaceholderDecorations({
|
|
64644
|
+
editor,
|
|
64645
|
+
options,
|
|
64646
|
+
dataAttribute,
|
|
64647
|
+
doc,
|
|
64648
|
+
selection
|
|
64649
|
+
}) {
|
|
64650
|
+
var _a, _b;
|
|
64651
|
+
const active = editor.isEditable || !options.showOnlyWhenEditable;
|
|
64652
|
+
if (!active) {
|
|
64653
|
+
return null;
|
|
64654
|
+
}
|
|
64655
|
+
const { anchor } = selection;
|
|
64656
|
+
const decorations = [];
|
|
64657
|
+
const isEmptyDoc = editor.isEmpty;
|
|
64658
|
+
const useResolvedPath = options.showOnlyCurrent && !options.includeChildren;
|
|
64659
|
+
if (useResolvedPath) {
|
|
64660
|
+
const resolved = doc.resolve(anchor);
|
|
64661
|
+
const node = resolved.depth > 0 ? resolved.node(1) : resolved.nodeAfter;
|
|
64662
|
+
const nodeStart = resolved.depth > 0 ? resolved.before(1) : anchor;
|
|
64663
|
+
if (node && node.type.isTextblock && isNodeEmpty(node)) {
|
|
64664
|
+
const hasAnchor = anchor >= nodeStart && anchor <= nodeStart + node.nodeSize;
|
|
64665
|
+
decorations.push(
|
|
64666
|
+
createPlaceholderDecoration({
|
|
64667
|
+
editor,
|
|
64668
|
+
isEmptyDoc,
|
|
64669
|
+
dataAttribute,
|
|
64670
|
+
hasAnchor,
|
|
64671
|
+
placeholder: options.placeholder,
|
|
64672
|
+
classes: {
|
|
64673
|
+
emptyEditor: options.emptyEditorClass,
|
|
64674
|
+
emptyNode: resolveEmptyNodeClass(options.emptyNodeClass, {
|
|
64675
|
+
editor,
|
|
64676
|
+
node,
|
|
64677
|
+
pos: nodeStart,
|
|
64678
|
+
hasAnchor
|
|
64679
|
+
})
|
|
64680
|
+
},
|
|
64681
|
+
node,
|
|
64682
|
+
pos: nodeStart
|
|
64683
|
+
})
|
|
64684
|
+
);
|
|
64685
|
+
}
|
|
64686
|
+
} else {
|
|
64687
|
+
const pluginState = PLUGIN_KEY.getState(editor.state);
|
|
64688
|
+
const from = (_a = pluginState == null ? void 0 : pluginState.topPos) != null ? _a : 0;
|
|
64689
|
+
const to = (_b = pluginState == null ? void 0 : pluginState.bottomPos) != null ? _b : doc.content.size;
|
|
64690
|
+
doc.nodesBetween(from, to, (node, pos) => {
|
|
64691
|
+
const hasAnchor = anchor >= pos && anchor <= pos + node.nodeSize;
|
|
64692
|
+
const isEmpty = !node.isLeaf && isNodeEmpty(node);
|
|
64693
|
+
if (!node.type.isTextblock) {
|
|
64694
|
+
return options.includeChildren;
|
|
64695
|
+
}
|
|
64696
|
+
if ((hasAnchor || !options.showOnlyCurrent) && isEmpty) {
|
|
64697
|
+
decorations.push(
|
|
64698
|
+
createPlaceholderDecoration({
|
|
64699
|
+
editor,
|
|
64700
|
+
isEmptyDoc,
|
|
64701
|
+
dataAttribute,
|
|
64702
|
+
hasAnchor,
|
|
64703
|
+
placeholder: options.placeholder,
|
|
64704
|
+
classes: {
|
|
64705
|
+
emptyEditor: options.emptyEditorClass,
|
|
64706
|
+
emptyNode: resolveEmptyNodeClass(options.emptyNodeClass, {
|
|
64707
|
+
editor,
|
|
64708
|
+
node,
|
|
64709
|
+
pos,
|
|
64710
|
+
hasAnchor
|
|
64711
|
+
})
|
|
64712
|
+
},
|
|
64713
|
+
node,
|
|
64714
|
+
pos
|
|
64715
|
+
})
|
|
64716
|
+
);
|
|
64717
|
+
}
|
|
64718
|
+
return options.includeChildren;
|
|
64719
|
+
});
|
|
64720
|
+
}
|
|
64721
|
+
return DecorationSet.create(doc, decorations);
|
|
64722
|
+
}
|
|
64723
|
+
|
|
64724
|
+
// src/placeholder/utils/preparePlaceholderAttribute.ts
|
|
64725
|
+
function preparePlaceholderAttribute(attr) {
|
|
64726
|
+
return attr.replace(/\s+/g, "-").replace(/[^a-zA-Z0-9-]/g, "").replace(/^[0-9-]+/, "").replace(/^-+/, "").toLowerCase();
|
|
64727
|
+
}
|
|
64728
|
+
|
|
64244
64729
|
// src/placeholder/utils/findScrollParent.ts
|
|
64245
64730
|
function isScrollable(el) {
|
|
64246
64731
|
const style = getComputedStyle(el);
|
|
@@ -64281,8 +64766,8 @@ ${indentedChild}`;
|
|
|
64281
64766
|
}) {
|
|
64282
64767
|
const editorRect = view.dom.getBoundingClientRect();
|
|
64283
64768
|
const containerRect = scrollContainer ? getContainerRect(scrollContainer) : { top: 0, bottom: window.innerHeight };
|
|
64284
|
-
const visibleTop = Math.max(editorRect.top, containerRect.top);
|
|
64285
|
-
const visibleBottom = Math.min(editorRect.bottom, containerRect.bottom);
|
|
64769
|
+
const visibleTop = Math.max(editorRect.top, containerRect.top) - VIEWPORT_OVERSCAN_PX;
|
|
64770
|
+
const visibleBottom = Math.min(editorRect.bottom, containerRect.bottom) + VIEWPORT_OVERSCAN_PX;
|
|
64286
64771
|
if (visibleTop >= visibleBottom) {
|
|
64287
64772
|
return { top: 0, bottom: doc.content.size };
|
|
64288
64773
|
}
|
|
@@ -64296,33 +64781,97 @@ ${indentedChild}`;
|
|
|
64296
64781
|
};
|
|
64297
64782
|
}
|
|
64298
64783
|
|
|
64299
|
-
// src/placeholder/utils/
|
|
64300
|
-
|
|
64301
|
-
|
|
64302
|
-
|
|
64303
|
-
|
|
64784
|
+
// src/placeholder/utils/viewportTracking.ts
|
|
64785
|
+
var viewportPluginState = {
|
|
64786
|
+
/**
|
|
64787
|
+
* Initialises the viewport state with no known positions.
|
|
64788
|
+
* @returns The initial viewport state.
|
|
64789
|
+
*/
|
|
64790
|
+
init() {
|
|
64791
|
+
return { topPos: null, bottomPos: null };
|
|
64792
|
+
},
|
|
64793
|
+
/**
|
|
64794
|
+
* Updates the viewport state from incoming transactions.
|
|
64795
|
+
* @param tr - The transaction being applied.
|
|
64796
|
+
* @param prev - The previous viewport state.
|
|
64797
|
+
* @returns The next viewport state.
|
|
64798
|
+
*/
|
|
64799
|
+
apply(tr, prev) {
|
|
64800
|
+
const meta = tr.getMeta(PLUGIN_KEY);
|
|
64801
|
+
if (meta == null ? void 0 : meta.positions) {
|
|
64802
|
+
return { topPos: meta.positions.top, bottomPos: meta.positions.bottom };
|
|
64803
|
+
}
|
|
64804
|
+
if (!tr.docChanged) {
|
|
64805
|
+
return prev;
|
|
64806
|
+
}
|
|
64807
|
+
return {
|
|
64808
|
+
topPos: prev.topPos !== null ? tr.mapping.map(prev.topPos) : null,
|
|
64809
|
+
bottomPos: prev.bottomPos !== null ? tr.mapping.map(prev.bottomPos) : null
|
|
64810
|
+
};
|
|
64811
|
+
}
|
|
64812
|
+
};
|
|
64813
|
+
function createViewportPluginView(view) {
|
|
64814
|
+
const scrollContainer = findScrollParent(view.dom);
|
|
64815
|
+
const computeAndDispatch = () => {
|
|
64816
|
+
const positions = getViewportBoundaryPositions({
|
|
64817
|
+
view,
|
|
64818
|
+
doc: view.state.doc,
|
|
64819
|
+
scrollContainer
|
|
64820
|
+
});
|
|
64821
|
+
const prev = PLUGIN_KEY.getState(view.state);
|
|
64822
|
+
if ((prev == null ? void 0 : prev.topPos) === positions.top && (prev == null ? void 0 : prev.bottomPos) === positions.bottom) {
|
|
64304
64823
|
return;
|
|
64305
64824
|
}
|
|
64306
|
-
|
|
64307
|
-
|
|
64308
|
-
|
|
64309
|
-
|
|
64310
|
-
|
|
64311
|
-
const
|
|
64312
|
-
|
|
64313
|
-
|
|
64314
|
-
|
|
64825
|
+
const tr = view.state.tr.setMeta(PLUGIN_KEY, { positions });
|
|
64826
|
+
view.dispatch(tr);
|
|
64827
|
+
};
|
|
64828
|
+
let frame = null;
|
|
64829
|
+
let lastCompute = 0;
|
|
64830
|
+
const MIN_SCROLL_INTERVAL = 150;
|
|
64831
|
+
const scheduleFrame = () => {
|
|
64832
|
+
if (frame !== null) return;
|
|
64833
|
+
frame = requestAnimationFrame(() => {
|
|
64834
|
+
frame = null;
|
|
64835
|
+
const now = performance.now();
|
|
64836
|
+
if (now - lastCompute >= MIN_SCROLL_INTERVAL) {
|
|
64837
|
+
lastCompute = now;
|
|
64838
|
+
computeAndDispatch();
|
|
64839
|
+
} else {
|
|
64840
|
+
scheduleFrame();
|
|
64841
|
+
}
|
|
64842
|
+
});
|
|
64843
|
+
};
|
|
64844
|
+
scrollContainer.addEventListener("scroll", scheduleFrame, { passive: true });
|
|
64845
|
+
computeAndDispatch();
|
|
64846
|
+
return {
|
|
64847
|
+
update(_view, prevState) {
|
|
64848
|
+
if (view.state.doc.content.size !== prevState.doc.content.size) {
|
|
64849
|
+
scheduleFrame();
|
|
64850
|
+
}
|
|
64851
|
+
},
|
|
64852
|
+
destroy: () => {
|
|
64853
|
+
if (frame !== null) {
|
|
64854
|
+
cancelAnimationFrame(frame);
|
|
64855
|
+
}
|
|
64856
|
+
scrollContainer.removeEventListener("scroll", scheduleFrame);
|
|
64315
64857
|
}
|
|
64316
64858
|
};
|
|
64317
|
-
return { call, cancel };
|
|
64318
64859
|
}
|
|
64319
64860
|
|
|
64320
|
-
// src/placeholder/
|
|
64321
|
-
|
|
64322
|
-
|
|
64323
|
-
return
|
|
64861
|
+
// src/placeholder/plugins/PlaceholderPlugin.ts
|
|
64862
|
+
function createPlaceholderPlugin({ editor, options }) {
|
|
64863
|
+
const dataAttribute = options.dataAttribute ? `data-${preparePlaceholderAttribute(options.dataAttribute)}` : `data-${DEFAULT_DATA_ATTRIBUTE}`;
|
|
64864
|
+
return new Plugin({
|
|
64865
|
+
key: PLUGIN_KEY,
|
|
64866
|
+
state: viewportPluginState,
|
|
64867
|
+
view: createViewportPluginView,
|
|
64868
|
+
props: {
|
|
64869
|
+
decorations: ({ doc, selection }) => buildPlaceholderDecorations({ editor, options, dataAttribute, doc, selection })
|
|
64870
|
+
}
|
|
64871
|
+
});
|
|
64324
64872
|
}
|
|
64325
|
-
|
|
64873
|
+
|
|
64874
|
+
// src/placeholder/placeholder.ts
|
|
64326
64875
|
var Placeholder = Extension.create({
|
|
64327
64876
|
name: "placeholder",
|
|
64328
64877
|
addOptions() {
|
|
@@ -64337,134 +64886,16 @@ ${indentedChild}`;
|
|
|
64337
64886
|
};
|
|
64338
64887
|
},
|
|
64339
64888
|
addProseMirrorPlugins() {
|
|
64340
|
-
|
|
64341
|
-
return [
|
|
64342
|
-
new Plugin({
|
|
64343
|
-
state: {
|
|
64344
|
-
init() {
|
|
64345
|
-
return {
|
|
64346
|
-
// null means "no viewport info yet" — decoration callback falls
|
|
64347
|
-
// back to full document scan until the scroll handler fires.
|
|
64348
|
-
topPos: null,
|
|
64349
|
-
bottomPos: null
|
|
64350
|
-
};
|
|
64351
|
-
},
|
|
64352
|
-
apply(tr, prev) {
|
|
64353
|
-
const meta = tr.getMeta(PLUGIN_KEY);
|
|
64354
|
-
if (meta == null ? void 0 : meta.positions) {
|
|
64355
|
-
return {
|
|
64356
|
-
topPos: meta.positions.top,
|
|
64357
|
-
bottomPos: meta.positions.bottom
|
|
64358
|
-
};
|
|
64359
|
-
}
|
|
64360
|
-
if (!tr.docChanged) {
|
|
64361
|
-
return prev;
|
|
64362
|
-
}
|
|
64363
|
-
return {
|
|
64364
|
-
topPos: prev.topPos !== null ? tr.mapping.map(prev.topPos) : null,
|
|
64365
|
-
bottomPos: prev.bottomPos !== null ? tr.mapping.map(prev.bottomPos) : null
|
|
64366
|
-
};
|
|
64367
|
-
}
|
|
64368
|
-
},
|
|
64369
|
-
key: PLUGIN_KEY,
|
|
64370
|
-
view(view) {
|
|
64371
|
-
const scrollContainer = findScrollParent(view.dom);
|
|
64372
|
-
const computeAndDispatch = () => {
|
|
64373
|
-
const positions = getViewportBoundaryPositions({
|
|
64374
|
-
view,
|
|
64375
|
-
doc: view.state.doc,
|
|
64376
|
-
scrollContainer
|
|
64377
|
-
});
|
|
64378
|
-
const prev = PLUGIN_KEY.getState(view.state);
|
|
64379
|
-
if (prev.topPos === positions.top && prev.bottomPos === positions.bottom) {
|
|
64380
|
-
return;
|
|
64381
|
-
}
|
|
64382
|
-
const tr = view.state.tr.setMeta(PLUGIN_KEY, { positions }).setMeta("tiptap__viewportUpdate", true);
|
|
64383
|
-
view.dispatch(tr);
|
|
64384
|
-
};
|
|
64385
|
-
const { call: throttledUpdate, cancel: cancelThrottle } = throttle(computeAndDispatch, 250);
|
|
64386
|
-
const scrollParent = scrollContainer;
|
|
64387
|
-
scrollParent.addEventListener("scroll", throttledUpdate, { passive: true });
|
|
64388
|
-
computeAndDispatch();
|
|
64389
|
-
return {
|
|
64390
|
-
update(_, prevState) {
|
|
64391
|
-
if (view.state.doc.content.size !== prevState.doc.content.size) {
|
|
64392
|
-
computeAndDispatch();
|
|
64393
|
-
}
|
|
64394
|
-
},
|
|
64395
|
-
destroy: () => {
|
|
64396
|
-
cancelThrottle();
|
|
64397
|
-
scrollParent.removeEventListener("scroll", throttledUpdate);
|
|
64398
|
-
}
|
|
64399
|
-
};
|
|
64400
|
-
},
|
|
64401
|
-
props: {
|
|
64402
|
-
decorations: ({ doc, selection }) => {
|
|
64403
|
-
var _a, _b;
|
|
64404
|
-
const active = this.editor.isEditable || !this.options.showOnlyWhenEditable;
|
|
64405
|
-
if (!active) {
|
|
64406
|
-
return null;
|
|
64407
|
-
}
|
|
64408
|
-
const { anchor } = selection;
|
|
64409
|
-
const decorations = [];
|
|
64410
|
-
const isEmptyDoc = this.editor.isEmpty;
|
|
64411
|
-
const useResolvedPath = this.options.showOnlyCurrent && !this.options.includeChildren;
|
|
64412
|
-
if (useResolvedPath) {
|
|
64413
|
-
const resolved = doc.resolve(anchor);
|
|
64414
|
-
if (resolved.depth > 0) {
|
|
64415
|
-
const node = resolved.node(1);
|
|
64416
|
-
const nodeStart = resolved.before(1);
|
|
64417
|
-
if (node.type.isTextblock && isNodeEmpty(node)) {
|
|
64418
|
-
const hasAnchor = anchor >= nodeStart && anchor <= nodeStart + node.nodeSize;
|
|
64419
|
-
const decoration = createPlaceholderDecoration({
|
|
64420
|
-
node,
|
|
64421
|
-
dataAttribute,
|
|
64422
|
-
hasAnchor,
|
|
64423
|
-
placeholder: this.options.placeholder,
|
|
64424
|
-
classes: {
|
|
64425
|
-
emptyEditor: this.options.emptyEditorClass,
|
|
64426
|
-
emptyNode: this.options.emptyNodeClass
|
|
64427
|
-
},
|
|
64428
|
-
editor: this.editor,
|
|
64429
|
-
isEmptyDoc,
|
|
64430
|
-
pos: resolved.before(1)
|
|
64431
|
-
});
|
|
64432
|
-
decorations.push(decoration);
|
|
64433
|
-
}
|
|
64434
|
-
}
|
|
64435
|
-
} else {
|
|
64436
|
-
const pluginState = PLUGIN_KEY.getState(this.editor.state);
|
|
64437
|
-
const from = (_a = pluginState.topPos) != null ? _a : 0;
|
|
64438
|
-
const to = (_b = pluginState.bottomPos) != null ? _b : doc.content.size;
|
|
64439
|
-
doc.nodesBetween(from, to, (node, pos) => {
|
|
64440
|
-
const hasAnchor = anchor >= pos && anchor <= pos + node.nodeSize;
|
|
64441
|
-
const isEmpty = !node.isLeaf && isNodeEmpty(node);
|
|
64442
|
-
if (!node.type.isTextblock) {
|
|
64443
|
-
return this.options.includeChildren;
|
|
64444
|
-
}
|
|
64445
|
-
if ((hasAnchor || !this.options.showOnlyCurrent) && isEmpty) {
|
|
64446
|
-
const decoration = createPlaceholderDecoration({
|
|
64447
|
-
classes: { emptyEditor: this.options.emptyEditorClass, emptyNode: this.options.emptyNodeClass },
|
|
64448
|
-
editor: this.editor,
|
|
64449
|
-
isEmptyDoc,
|
|
64450
|
-
dataAttribute,
|
|
64451
|
-
hasAnchor,
|
|
64452
|
-
placeholder: this.options.placeholder,
|
|
64453
|
-
node,
|
|
64454
|
-
pos
|
|
64455
|
-
});
|
|
64456
|
-
decorations.push(decoration);
|
|
64457
|
-
}
|
|
64458
|
-
return this.options.includeChildren;
|
|
64459
|
-
});
|
|
64460
|
-
}
|
|
64461
|
-
return DecorationSet.create(doc, decorations);
|
|
64462
|
-
}
|
|
64463
|
-
}
|
|
64464
|
-
})
|
|
64465
|
-
];
|
|
64889
|
+
return [createPlaceholderPlugin({ editor: this.editor, options: this.options })];
|
|
64466
64890
|
}
|
|
64467
64891
|
});
|
|
64892
|
+
var selectionStyle = `.ProseMirror:not(.ProseMirror-focused) *::selection {
|
|
64893
|
+
background: transparent;
|
|
64894
|
+
}
|
|
64895
|
+
|
|
64896
|
+
.ProseMirror:not(.ProseMirror-focused) *::-moz-selection {
|
|
64897
|
+
background: transparent;
|
|
64898
|
+
}`;
|
|
64468
64899
|
Extension.create({
|
|
64469
64900
|
name: "selection",
|
|
64470
64901
|
addOptions() {
|
|
@@ -64474,6 +64905,9 @@ ${indentedChild}`;
|
|
|
64474
64905
|
},
|
|
64475
64906
|
addProseMirrorPlugins() {
|
|
64476
64907
|
const { editor, options } = this;
|
|
64908
|
+
if (editor.options.injectCSS && typeof document !== "undefined") {
|
|
64909
|
+
createStyleTag(selectionStyle, editor.options.injectNonce, "selection");
|
|
64910
|
+
}
|
|
64477
64911
|
return [
|
|
64478
64912
|
new Plugin({
|
|
64479
64913
|
key: new PluginKey("selection"),
|
|
@@ -64494,7 +64928,10 @@ ${indentedChild}`;
|
|
|
64494
64928
|
}
|
|
64495
64929
|
});
|
|
64496
64930
|
var skipTrailingNodeMeta = "skipTrailingNode";
|
|
64497
|
-
function nodeEqualsType({
|
|
64931
|
+
function nodeEqualsType({
|
|
64932
|
+
types,
|
|
64933
|
+
node
|
|
64934
|
+
}) {
|
|
64498
64935
|
return node && Array.isArray(types) && types.includes(node.type) || (node == null ? void 0 : node.type) === types;
|
|
64499
64936
|
}
|
|
64500
64937
|
Extension.create({
|
|
@@ -64679,7 +65116,7 @@ ${indentedChild}`;
|
|
|
64679
65116
|
rel: 'noopener noreferrer',
|
|
64680
65117
|
target: null,
|
|
64681
65118
|
// Adding `class` here is a workaround to render two mentions without a whitespace as display names
|
|
64682
|
-
//
|
|
65119
|
+
// For more details on this behavior, refer to the issue below:
|
|
64683
65120
|
// https://github.com/ni/nimble/issues/1707
|
|
64684
65121
|
class: ''
|
|
64685
65122
|
},
|
|
@@ -71153,6 +71590,12 @@ ${indentedChild}`;
|
|
|
71153
71590
|
canLoadChildren: 'can-load-children',
|
|
71154
71591
|
loadingChildren: 'loading-children'
|
|
71155
71592
|
};
|
|
71593
|
+
/**
|
|
71594
|
+
* The possible pin locations for a table column.
|
|
71595
|
+
*/
|
|
71596
|
+
const TableColumnPinLocation = {
|
|
71597
|
+
left: 'left'
|
|
71598
|
+
};
|
|
71156
71599
|
/**
|
|
71157
71600
|
* The possible directions a table column can be sorted in.
|
|
71158
71601
|
*/
|
|
@@ -71493,6 +71936,9 @@ ${indentedChild}`;
|
|
|
71493
71936
|
__decorate([
|
|
71494
71937
|
observable
|
|
71495
71938
|
], ColumnInternals.prototype, "currentSortDirection", void 0);
|
|
71939
|
+
__decorate([
|
|
71940
|
+
observable
|
|
71941
|
+
], ColumnInternals.prototype, "pinLocation", void 0);
|
|
71496
71942
|
function isColumnInternalsProperty(changedProperty, ...args) {
|
|
71497
71943
|
for (const arg of args) {
|
|
71498
71944
|
if (changedProperty === arg) {
|
|
@@ -71566,6 +72012,7 @@ ${indentedChild}`;
|
|
|
71566
72012
|
this.idFieldNameNotConfigured = false;
|
|
71567
72013
|
this.invalidColumnConfiguration = false;
|
|
71568
72014
|
this.invalidParentIdConfiguration = false;
|
|
72015
|
+
this.invalidPinnedColumnConfiguration = false;
|
|
71569
72016
|
this.recordIds = new Set();
|
|
71570
72017
|
}
|
|
71571
72018
|
getValidity() {
|
|
@@ -71579,7 +72026,8 @@ ${indentedChild}`;
|
|
|
71579
72026
|
duplicateGroupIndex: this.duplicateGroupIndex,
|
|
71580
72027
|
idFieldNameNotConfigured: this.idFieldNameNotConfigured,
|
|
71581
72028
|
invalidColumnConfiguration: this.invalidColumnConfiguration,
|
|
71582
|
-
invalidParentIdConfiguration: this.invalidParentIdConfiguration
|
|
72029
|
+
invalidParentIdConfiguration: this.invalidParentIdConfiguration,
|
|
72030
|
+
invalidPinnedColumnConfiguration: this.invalidPinnedColumnConfiguration
|
|
71583
72031
|
};
|
|
71584
72032
|
}
|
|
71585
72033
|
isValid() {
|
|
@@ -71662,6 +72110,12 @@ ${indentedChild}`;
|
|
|
71662
72110
|
this.invalidColumnConfiguration = columns.some(x => !x.columnInternals.validator.isColumnValid);
|
|
71663
72111
|
return !this.invalidColumnConfiguration;
|
|
71664
72112
|
}
|
|
72113
|
+
validatePinnedColumnConfigurations(columns) {
|
|
72114
|
+
this.invalidPinnedColumnConfiguration = columns.some(x => x.columnInternals.pinLocation === TableColumnPinLocation.left
|
|
72115
|
+
&& (x.columnInternals.pixelWidth === undefined
|
|
72116
|
+
|| !x.columnInternals.resizingDisabled));
|
|
72117
|
+
return !this.invalidPinnedColumnConfiguration;
|
|
72118
|
+
}
|
|
71665
72119
|
getPresentRecordIds(requestedRecordIds) {
|
|
71666
72120
|
return requestedRecordIds.filter(id => this.recordIds.has(id));
|
|
71667
72121
|
}
|
|
@@ -71721,12 +72175,7 @@ focus outline in that case.
|
|
|
71721
72175
|
.header-row-container {
|
|
71722
72176
|
position: sticky;
|
|
71723
72177
|
top: 0;
|
|
71724
|
-
}
|
|
71725
|
-
|
|
71726
|
-
.header-row {
|
|
71727
72178
|
display: flex;
|
|
71728
|
-
background: ${applicationBackgroundColor};
|
|
71729
|
-
position: relative;
|
|
71730
72179
|
width: fit-content;
|
|
71731
72180
|
min-width: max(
|
|
71732
72181
|
100%,
|
|
@@ -71735,8 +72184,16 @@ focus outline in that case.
|
|
|
71735
72184
|
var(--ni-private-table-header-container-margin-right)
|
|
71736
72185
|
)
|
|
71737
72186
|
);
|
|
72187
|
+
}
|
|
72188
|
+
|
|
72189
|
+
.header-row {
|
|
72190
|
+
display: flex;
|
|
72191
|
+
background: ${applicationBackgroundColor};
|
|
72192
|
+
position: relative;
|
|
72193
|
+
width: fit-content;
|
|
71738
72194
|
left: var(--ni-private-table-scroll-x);
|
|
71739
72195
|
align-items: center;
|
|
72196
|
+
flex: 1;
|
|
71740
72197
|
}
|
|
71741
72198
|
|
|
71742
72199
|
.header-row-action-container {
|
|
@@ -71788,6 +72245,17 @@ focus outline in that case.
|
|
|
71788
72245
|
overflow: hidden;
|
|
71789
72246
|
}
|
|
71790
72247
|
|
|
72248
|
+
.pinned-columns-header-container {
|
|
72249
|
+
display: grid;
|
|
72250
|
+
grid-template-columns: var(--ni-private-table-pinned-columns-row-grid-columns);
|
|
72251
|
+
position: sticky;
|
|
72252
|
+
left: 0;
|
|
72253
|
+
align-self: stretch;
|
|
72254
|
+
background: ${applicationBackgroundColor};
|
|
72255
|
+
z-index: ${ZIndexLevels.zIndex1};
|
|
72256
|
+
box-shadow: inset -2px 0 0 0 ${tableRowBorderColor};
|
|
72257
|
+
}
|
|
72258
|
+
|
|
71791
72259
|
.column-divider {
|
|
71792
72260
|
border-left: var(--ni-private-column-divider-width) solid
|
|
71793
72261
|
${popupBorderColor};
|
|
@@ -71888,6 +72356,10 @@ focus outline in that case.
|
|
|
71888
72356
|
${accessiblyHidden}
|
|
71889
72357
|
}
|
|
71890
72358
|
`.withBehaviors(themeBehavior(Theme.color, css `
|
|
72359
|
+
.pinned-columns-header-container {
|
|
72360
|
+
box-shadow: inset -2px 0 0 0 ${hexToRgbaCssColor(White, 0.1)};
|
|
72361
|
+
}
|
|
72362
|
+
|
|
71891
72363
|
.table-row-container::before {
|
|
71892
72364
|
content: '';
|
|
71893
72365
|
width: 100%;
|
|
@@ -72069,7 +72541,7 @@ focus outline in that case.
|
|
|
72069
72541
|
position: absolute;
|
|
72070
72542
|
}
|
|
72071
72543
|
|
|
72072
|
-
:host([selectable]
|
|
72544
|
+
:host([selectable][allow-hover]:hover)::before {
|
|
72073
72545
|
background-color: ${fillHoverColor};
|
|
72074
72546
|
}
|
|
72075
72547
|
|
|
@@ -72142,6 +72614,46 @@ focus outline in that case.
|
|
|
72142
72614
|
width: ${mediumPadding};
|
|
72143
72615
|
}
|
|
72144
72616
|
|
|
72617
|
+
.pinned-cell-container {
|
|
72618
|
+
display: grid;
|
|
72619
|
+
grid-template-columns: var(--ni-private-table-pinned-columns-row-grid-columns);
|
|
72620
|
+
position: sticky;
|
|
72621
|
+
left: 0;
|
|
72622
|
+
background: ${applicationBackgroundColor};
|
|
72623
|
+
z-index: ${ZIndexLevels.zIndex1};
|
|
72624
|
+
box-shadow: inset -2px 0 0 0 ${tableRowBorderColor};
|
|
72625
|
+
}
|
|
72626
|
+
|
|
72627
|
+
:host([selectable][allow-hover]:hover) .pinned-cell-container {
|
|
72628
|
+
background: linear-gradient(${fillHoverColor}, ${fillHoverColor}),
|
|
72629
|
+
${applicationBackgroundColor};
|
|
72630
|
+
}
|
|
72631
|
+
|
|
72632
|
+
:host([selected]) .pinned-cell-container {
|
|
72633
|
+
background: linear-gradient(${fillSelectedColor}, ${fillSelectedColor}),
|
|
72634
|
+
${applicationBackgroundColor};
|
|
72635
|
+
}
|
|
72636
|
+
|
|
72637
|
+
:host([selected][allow-hover]:hover) .pinned-cell-container {
|
|
72638
|
+
background: linear-gradient(
|
|
72639
|
+
${fillHoverSelectedColor},
|
|
72640
|
+
${fillHoverSelectedColor}
|
|
72641
|
+
),
|
|
72642
|
+
${applicationBackgroundColor};
|
|
72643
|
+
}
|
|
72644
|
+
|
|
72645
|
+
:host(${focusVisible}) .pinned-cell-container {
|
|
72646
|
+
box-shadow:
|
|
72647
|
+
inset calc(2 * ${borderWidth}) 0 0 ${borderHoverColor},
|
|
72648
|
+
inset 0 calc(2 * ${borderWidth}) 0 ${borderHoverColor},
|
|
72649
|
+
inset 0 calc(-2 * ${borderWidth}) 0 ${borderHoverColor},
|
|
72650
|
+
inset -2px 0 0 0 ${tableRowBorderColor};
|
|
72651
|
+
}
|
|
72652
|
+
${'' /* Pushing the pinned-cell-container to a higher z-index for breakpoint menu behavior (not required by table directly) */}
|
|
72653
|
+
:host([menu-open]) .pinned-cell-container {
|
|
72654
|
+
z-index: ${ZIndexLevels.zIndex1000};
|
|
72655
|
+
}
|
|
72656
|
+
|
|
72145
72657
|
.cell-container {
|
|
72146
72658
|
display: grid;
|
|
72147
72659
|
width: 100%;
|
|
@@ -72217,6 +72729,42 @@ focus outline in that case.
|
|
|
72217
72729
|
:host([selected][allow-hover]:hover)::before {
|
|
72218
72730
|
background-color: ${hexToRgbaCssColor(White, 0.2)};
|
|
72219
72731
|
}
|
|
72732
|
+
|
|
72733
|
+
.pinned-cell-container {
|
|
72734
|
+
box-shadow: inset -2px 0 0 0 ${hexToRgbaCssColor(White, 0.1)};
|
|
72735
|
+
}
|
|
72736
|
+
|
|
72737
|
+
:host([selectable][allow-hover]:hover) .pinned-cell-container {
|
|
72738
|
+
background: linear-gradient(
|
|
72739
|
+
${hexToRgbaCssColor(White, 0.05)},
|
|
72740
|
+
${hexToRgbaCssColor(White, 0.05)}
|
|
72741
|
+
),
|
|
72742
|
+
${applicationBackgroundColor};
|
|
72743
|
+
}
|
|
72744
|
+
|
|
72745
|
+
:host([selected]) .pinned-cell-container {
|
|
72746
|
+
background: linear-gradient(
|
|
72747
|
+
${hexToRgbaCssColor(White, 0.25)},
|
|
72748
|
+
${hexToRgbaCssColor(White, 0.25)}
|
|
72749
|
+
),
|
|
72750
|
+
${applicationBackgroundColor};
|
|
72751
|
+
}
|
|
72752
|
+
|
|
72753
|
+
:host([selected][allow-hover]:hover) .pinned-cell-container {
|
|
72754
|
+
background: linear-gradient(
|
|
72755
|
+
${hexToRgbaCssColor(White, 0.2)},
|
|
72756
|
+
${hexToRgbaCssColor(White, 0.2)}
|
|
72757
|
+
),
|
|
72758
|
+
${applicationBackgroundColor};
|
|
72759
|
+
}
|
|
72760
|
+
|
|
72761
|
+
:host(${focusVisible}) .pinned-cell-container {
|
|
72762
|
+
box-shadow:
|
|
72763
|
+
inset calc(2 * ${borderWidth}) 0 0 ${borderHoverColor},
|
|
72764
|
+
inset 0 calc(2 * ${borderWidth}) 0 ${borderHoverColor},
|
|
72765
|
+
inset 0 calc(-2 * ${borderWidth}) 0 ${borderHoverColor},
|
|
72766
|
+
inset -2px 0 0 0 ${hexToRgbaCssColor(White, 0.1)};
|
|
72767
|
+
}
|
|
72220
72768
|
`));
|
|
72221
72769
|
|
|
72222
72770
|
const styles$K = css `
|
|
@@ -72367,6 +72915,37 @@ focus outline in that case.
|
|
|
72367
72915
|
DesignSystem.getOrCreate().withPrefix('nimble').register(nimbleTableCell());
|
|
72368
72916
|
const tableCellTag = 'nimble-table-cell';
|
|
72369
72917
|
|
|
72918
|
+
const rowCellTemplate = html `
|
|
72919
|
+
<${tableCellTag}
|
|
72920
|
+
class="cell"
|
|
72921
|
+
:cellState="${(_, c) => c.parent.cellStates[c.index]}"
|
|
72922
|
+
:cellViewTemplate="${x => x.columnInternals.cellViewTemplate}"
|
|
72923
|
+
:column="${x => x}"
|
|
72924
|
+
column-id="${x => x.columnId}"
|
|
72925
|
+
:recordId="${(_, c) => c.parent.recordId}"
|
|
72926
|
+
?has-action-menu="${x => !!x.actionMenuSlot}"
|
|
72927
|
+
action-menu-label="${x => x.actionMenuLabel}"
|
|
72928
|
+
@cell-action-menu-beforetoggle="${(x, c) => c.parent.onCellActionMenuBeforeToggle(c.event, x)}"
|
|
72929
|
+
@cell-action-menu-toggle="${(x, c) => c.parent.onCellActionMenuToggle(c.event, x)}"
|
|
72930
|
+
@cell-view-slots-request="${(x, c) => c.parent.onCellViewSlotsRequest(x, c.event)}"
|
|
72931
|
+
:nestingLevel="${(_, c) => c.parent.cellIndentLevels[c.index]}"
|
|
72932
|
+
>
|
|
72933
|
+
|
|
72934
|
+
${when((x, c) => (c.parent.currentActionMenuColumn === x) && x.actionMenuSlot, html `
|
|
72935
|
+
<slot
|
|
72936
|
+
name="${x => `row-action-menu-${x.actionMenuSlot}`}"
|
|
72937
|
+
slot="cellActionMenu"
|
|
72938
|
+
></slot>
|
|
72939
|
+
`)}
|
|
72940
|
+
|
|
72941
|
+
${repeat(x => x.columnInternals.slotNames, html `
|
|
72942
|
+
<slot
|
|
72943
|
+
name="${(x, c) => uniquifySlotNameForColumn(c.parent, x)}"
|
|
72944
|
+
slot="${(x, c) => uniquifySlotNameForColumn(c.parent, x)}"
|
|
72945
|
+
></slot>
|
|
72946
|
+
`)}
|
|
72947
|
+
</${tableCellTag}>
|
|
72948
|
+
`;
|
|
72370
72949
|
const template$M = html `
|
|
72371
72950
|
<template
|
|
72372
72951
|
role="row"
|
|
@@ -72374,6 +72953,14 @@ focus outline in that case.
|
|
|
72374
72953
|
aria-expanded=${x => x.expanded}
|
|
72375
72954
|
style="--ni-private-table-row-indent-level: ${x => x.nestingLevel};"
|
|
72376
72955
|
>
|
|
72956
|
+
<span class="pinned-cell-container">
|
|
72957
|
+
${repeat(x => x.columns, html `
|
|
72958
|
+
${when(x => !x.columnHidden && x.columnInternals.pinLocation === TableColumnPinLocation.left, html `
|
|
72959
|
+
${rowCellTemplate}
|
|
72960
|
+
`)}
|
|
72961
|
+
`, { recycle: false, positioning: true })}
|
|
72962
|
+
</span>
|
|
72963
|
+
|
|
72377
72964
|
${when(x => !x.rowOperationGridCellHidden, html `
|
|
72378
72965
|
<span role="gridcell" class="row-operations-container">
|
|
72379
72966
|
${when(x => x.showSelectionCheckbox, html `
|
|
@@ -72391,7 +72978,7 @@ focus outline in that case.
|
|
|
72391
72978
|
`)}
|
|
72392
72979
|
</span>
|
|
72393
72980
|
`)}
|
|
72394
|
-
<span class="row-front-spacer ${x => (x.isTopLevelParentRow || !x.reserveCollapseSpace ? 'reduced-size-spacer' : '')}"></span>
|
|
72981
|
+
<span class="row-front-spacer ${x => (x.isTopLevelParentRow || !x.reserveCollapseSpace ? 'reduced-size-spacer' : '')} ${x => (x.showSelectionCheckbox ? 'selectable' : '')}"></span>
|
|
72395
72982
|
${when(x => x.isParentRow, html `
|
|
72396
72983
|
${when(x => x.loading, html `
|
|
72397
72984
|
<span class="spinner-container">
|
|
@@ -72422,36 +73009,8 @@ focus outline in that case.
|
|
|
72422
73009
|
class="cell-container ${x => (x.isNestedParent ? 'nested-parent' : '')}"
|
|
72423
73010
|
>
|
|
72424
73011
|
${repeat(x => x.columns, html `
|
|
72425
|
-
${when(x => !x.columnHidden, html `
|
|
72426
|
-
|
|
72427
|
-
class="cell"
|
|
72428
|
-
:cellState="${(_, c) => c.parent.cellStates[c.index]}"
|
|
72429
|
-
:cellViewTemplate="${x => x.columnInternals.cellViewTemplate}"
|
|
72430
|
-
:column="${x => x}"
|
|
72431
|
-
column-id="${x => x.columnId}"
|
|
72432
|
-
:recordId="${(_, c) => c.parent.recordId}"
|
|
72433
|
-
?has-action-menu="${x => !!x.actionMenuSlot}"
|
|
72434
|
-
action-menu-label="${x => x.actionMenuLabel}"
|
|
72435
|
-
@cell-action-menu-beforetoggle="${(x, c) => c.parent.onCellActionMenuBeforeToggle(c.event, x)}"
|
|
72436
|
-
@cell-action-menu-toggle="${(x, c) => c.parent.onCellActionMenuToggle(c.event, x)}"
|
|
72437
|
-
@cell-view-slots-request="${(x, c) => c.parent.onCellViewSlotsRequest(x, c.event)}"
|
|
72438
|
-
:nestingLevel="${(_, c) => c.parent.cellIndentLevels[c.index]}"
|
|
72439
|
-
>
|
|
72440
|
-
|
|
72441
|
-
${when((x, c) => (c.parent.currentActionMenuColumn === x) && x.actionMenuSlot, html `
|
|
72442
|
-
<slot
|
|
72443
|
-
name="${x => `row-action-menu-${x.actionMenuSlot}`}"
|
|
72444
|
-
slot="cellActionMenu"
|
|
72445
|
-
></slot>
|
|
72446
|
-
`)}
|
|
72447
|
-
|
|
72448
|
-
${repeat(x => x.columnInternals.slotNames, html `
|
|
72449
|
-
<slot
|
|
72450
|
-
name="${(x, c) => uniquifySlotNameForColumn(c.parent, x)}"
|
|
72451
|
-
slot="${(x, c) => uniquifySlotNameForColumn(c.parent, x)}"
|
|
72452
|
-
></slot>
|
|
72453
|
-
`)}
|
|
72454
|
-
</${tableCellTag}>
|
|
73012
|
+
${when(x => !x.columnHidden && x.columnInternals.pinLocation !== TableColumnPinLocation.left, html `
|
|
73013
|
+
${rowCellTemplate}
|
|
72455
73014
|
`)}
|
|
72456
73015
|
`, { recycle: false, positioning: true })}
|
|
72457
73016
|
</span>
|
|
@@ -72634,8 +73193,9 @@ focus outline in that case.
|
|
|
72634
73193
|
this.updateCellIndentLevels();
|
|
72635
73194
|
}
|
|
72636
73195
|
updateCellIndentLevels() {
|
|
73196
|
+
const firstNonPinnedIndex = this.columns.findIndex(col => col.columnInternals.pinLocation !== TableColumnPinLocation.left);
|
|
72637
73197
|
this.cellIndentLevels = this.columns.map((_, i) => {
|
|
72638
|
-
return i ===
|
|
73198
|
+
return i === firstNonPinnedIndex ? this.nestingLevel : 0;
|
|
72639
73199
|
});
|
|
72640
73200
|
}
|
|
72641
73201
|
removeColumnObservers() {
|
|
@@ -72777,6 +73337,7 @@ focus outline in that case.
|
|
|
72777
73337
|
height: calc(${controlHeight} + 2 * ${borderWidth});
|
|
72778
73338
|
border-top: calc(2 * ${borderWidth}) solid ${applicationBackgroundColor};
|
|
72779
73339
|
grid-template-columns:
|
|
73340
|
+
calc(var(--ni-private-table-group-row-pinned-column-offset))
|
|
72780
73341
|
calc(
|
|
72781
73342
|
${controlHeight} *
|
|
72782
73343
|
(var(--ni-private-table-group-row-indent-level) + 1)
|
|
@@ -72786,6 +73347,7 @@ focus outline in that case.
|
|
|
72786
73347
|
|
|
72787
73348
|
:host([selectable]) {
|
|
72788
73349
|
grid-template-columns:
|
|
73350
|
+
calc(var(--ni-private-table-group-row-pinned-column-offset))
|
|
72789
73351
|
${controlHeight}
|
|
72790
73352
|
calc(
|
|
72791
73353
|
${controlHeight} *
|
|
@@ -72812,6 +73374,37 @@ focus outline in that case.
|
|
|
72812
73374
|
outline-offset: calc(-2 * ${borderWidth});
|
|
72813
73375
|
}
|
|
72814
73376
|
|
|
73377
|
+
:host([has-pinned-columns]) .pinned-column-spacer {
|
|
73378
|
+
display: block;
|
|
73379
|
+
height: 100%;
|
|
73380
|
+
position: sticky;
|
|
73381
|
+
left: 0;
|
|
73382
|
+
background: ${tableRowBorderColor};
|
|
73383
|
+
z-index: ${ZIndexLevels.zIndex1};
|
|
73384
|
+
}
|
|
73385
|
+
|
|
73386
|
+
:host([allow-hover][has-pinned-columns]:hover) .pinned-column-spacer {
|
|
73387
|
+
background: linear-gradient(${fillHoverColor}, ${fillHoverColor}),
|
|
73388
|
+
${tableRowBorderColor};
|
|
73389
|
+
}
|
|
73390
|
+
|
|
73391
|
+
:host([has-pinned-columns]${focusVisible}) .pinned-column-spacer {
|
|
73392
|
+
box-shadow: inset 2px -2px 0 ${borderHoverColor};
|
|
73393
|
+
}
|
|
73394
|
+
|
|
73395
|
+
.checkbox-container {
|
|
73396
|
+
display: flex;
|
|
73397
|
+
}
|
|
73398
|
+
|
|
73399
|
+
:host([has-pinned-columns]) .checkbox-container {
|
|
73400
|
+
position: relative;
|
|
73401
|
+
}
|
|
73402
|
+
|
|
73403
|
+
:host([allow-hover][has-pinned-columns]:hover) .checkbox-container {
|
|
73404
|
+
background: linear-gradient(${fillHoverColor}, ${fillHoverColor}),
|
|
73405
|
+
${tableRowBorderColor};
|
|
73406
|
+
}
|
|
73407
|
+
|
|
72815
73408
|
.expand-collapse-button {
|
|
72816
73409
|
margin-left: calc(
|
|
72817
73410
|
${mediumPadding} + ${standardPadding} * 2 *
|
|
@@ -72837,10 +73430,6 @@ focus outline in that case.
|
|
|
72837
73430
|
${userSelectNone$1}
|
|
72838
73431
|
}
|
|
72839
73432
|
|
|
72840
|
-
.checkbox-container {
|
|
72841
|
-
display: flex;
|
|
72842
|
-
}
|
|
72843
|
-
|
|
72844
73433
|
.selection-checkbox {
|
|
72845
73434
|
margin-left: ${standardPadding};
|
|
72846
73435
|
}
|
|
@@ -72852,10 +73441,66 @@ focus outline in that case.
|
|
|
72852
73441
|
:host([allow-hover]:hover)::before {
|
|
72853
73442
|
background-color: ${hexToRgbaCssColor(White, 0.05)};
|
|
72854
73443
|
}
|
|
73444
|
+
|
|
73445
|
+
:host([has-pinned-columns]) .pinned-column-spacer {
|
|
73446
|
+
background: linear-gradient(
|
|
73447
|
+
${hexToRgbaCssColor(White, 0.1)},
|
|
73448
|
+
${hexToRgbaCssColor(White, 0.1)}
|
|
73449
|
+
),
|
|
73450
|
+
${tableRowBorderColor};
|
|
73451
|
+
}
|
|
73452
|
+
|
|
73453
|
+
:host([allow-hover][has-pinned-columns]:hover) .pinned-column-spacer {
|
|
73454
|
+
background: linear-gradient(
|
|
73455
|
+
${hexToRgbaCssColor(White, 0.05)},
|
|
73456
|
+
${hexToRgbaCssColor(White, 0.05)}
|
|
73457
|
+
),
|
|
73458
|
+
linear-gradient(
|
|
73459
|
+
${hexToRgbaCssColor(White, 0.1)},
|
|
73460
|
+
${hexToRgbaCssColor(White, 0.1)}
|
|
73461
|
+
),
|
|
73462
|
+
${tableRowBorderColor};
|
|
73463
|
+
}
|
|
73464
|
+
|
|
73465
|
+
:host([has-pinned-columns]) .checkbox-container {
|
|
73466
|
+
background: linear-gradient(
|
|
73467
|
+
${hexToRgbaCssColor(White, 0.1)},
|
|
73468
|
+
${hexToRgbaCssColor(White, 0.1)}
|
|
73469
|
+
),
|
|
73470
|
+
${tableRowBorderColor};
|
|
73471
|
+
}
|
|
73472
|
+
|
|
73473
|
+
:host([allow-hover][has-pinned-columns]:hover) .checkbox-container {
|
|
73474
|
+
background: linear-gradient(
|
|
73475
|
+
${hexToRgbaCssColor(White, 0.05)},
|
|
73476
|
+
${hexToRgbaCssColor(White, 0.05)}
|
|
73477
|
+
),
|
|
73478
|
+
linear-gradient(
|
|
73479
|
+
${hexToRgbaCssColor(White, 0.1)},
|
|
73480
|
+
${hexToRgbaCssColor(White, 0.1)}
|
|
73481
|
+
),
|
|
73482
|
+
${tableRowBorderColor};
|
|
73483
|
+
}
|
|
72855
73484
|
`), themeBehavior(Theme.dark, css `
|
|
72856
73485
|
:host([allow-hover]:hover)::before {
|
|
72857
73486
|
background-color: ${hexToRgbaCssColor(White, 0.1)};
|
|
72858
73487
|
}
|
|
73488
|
+
|
|
73489
|
+
:host([allow-hover][has-pinned-columns]:hover) .pinned-column-spacer {
|
|
73490
|
+
background: linear-gradient(
|
|
73491
|
+
${hexToRgbaCssColor(White, 0.1)},
|
|
73492
|
+
${hexToRgbaCssColor(White, 0.1)}
|
|
73493
|
+
),
|
|
73494
|
+
${tableRowBorderColor};
|
|
73495
|
+
}
|
|
73496
|
+
|
|
73497
|
+
:host([allow-hover][has-pinned-columns]:hover) .checkbox-container {
|
|
73498
|
+
background: linear-gradient(
|
|
73499
|
+
${hexToRgbaCssColor(White, 0.1)},
|
|
73500
|
+
${hexToRgbaCssColor(White, 0.1)}
|
|
73501
|
+
),
|
|
73502
|
+
${tableRowBorderColor};
|
|
73503
|
+
}
|
|
72859
73504
|
`));
|
|
72860
73505
|
|
|
72861
73506
|
const template$L = html `
|
|
@@ -72863,8 +73508,13 @@ focus outline in that case.
|
|
|
72863
73508
|
role="row"
|
|
72864
73509
|
@click=${x => x.onGroupExpandToggle()}
|
|
72865
73510
|
aria-expanded=${x => x.expanded}
|
|
72866
|
-
style="
|
|
73511
|
+
style="
|
|
73512
|
+
--ni-private-table-group-row-indent-level: ${x => x.nestingLevel};
|
|
73513
|
+
--ni-private-table-group-row-pinned-column-offset: ${x => x.pinnedColumnOffset}px;
|
|
73514
|
+
"
|
|
72867
73515
|
>
|
|
73516
|
+
<span class="pinned-column-spacer"></span>
|
|
73517
|
+
|
|
72868
73518
|
${when(x => x.selectable, html `
|
|
72869
73519
|
<span role="gridcell" class="checkbox-container">
|
|
72870
73520
|
<${checkboxTag}
|
|
@@ -72907,6 +73557,11 @@ focus outline in that case.
|
|
|
72907
73557
|
constructor() {
|
|
72908
73558
|
super(...arguments);
|
|
72909
73559
|
this.nestingLevel = 0;
|
|
73560
|
+
this.pinnedColumnOffset = 0;
|
|
73561
|
+
/**
|
|
73562
|
+
* @internal
|
|
73563
|
+
*/
|
|
73564
|
+
this.hasPinnedColumns = false;
|
|
72910
73565
|
this.expanded = false;
|
|
72911
73566
|
this.selectable = false;
|
|
72912
73567
|
this.selectionState = TableRowSelectionState.notSelected;
|
|
@@ -72964,6 +73619,9 @@ focus outline in that case.
|
|
|
72964
73619
|
cells: []
|
|
72965
73620
|
};
|
|
72966
73621
|
}
|
|
73622
|
+
pinnedColumnOffsetChanged() {
|
|
73623
|
+
this.hasPinnedColumns = this.pinnedColumnOffset > 0;
|
|
73624
|
+
}
|
|
72967
73625
|
selectionStateChanged() {
|
|
72968
73626
|
this.setSelectionCheckboxState();
|
|
72969
73627
|
}
|
|
@@ -72986,6 +73644,12 @@ focus outline in that case.
|
|
|
72986
73644
|
__decorate([
|
|
72987
73645
|
observable
|
|
72988
73646
|
], TableGroupRow.prototype, "nestingLevel", void 0);
|
|
73647
|
+
__decorate([
|
|
73648
|
+
observable
|
|
73649
|
+
], TableGroupRow.prototype, "pinnedColumnOffset", void 0);
|
|
73650
|
+
__decorate([
|
|
73651
|
+
attr({ attribute: 'has-pinned-columns', mode: 'boolean' })
|
|
73652
|
+
], TableGroupRow.prototype, "hasPinnedColumns", void 0);
|
|
72989
73653
|
__decorate([
|
|
72990
73654
|
observable
|
|
72991
73655
|
], TableGroupRow.prototype, "resolvedRowIndex", void 0);
|
|
@@ -73021,6 +73685,21 @@ focus outline in that case.
|
|
|
73021
73685
|
DesignSystem.getOrCreate().withPrefix('nimble').register(nimbleTableGroupRow());
|
|
73022
73686
|
const tableGroupRowTag = 'nimble-table-group-row';
|
|
73023
73687
|
|
|
73688
|
+
const tableHeaderTemplate = html `
|
|
73689
|
+
<${tableHeaderTag}
|
|
73690
|
+
class="header"
|
|
73691
|
+
${'' /* tabindex managed dynamically by KeyboardNavigationManager (if column sorting not disabled) */}
|
|
73692
|
+
sort-direction="${x => (typeof x.columnInternals.currentSortIndex === 'number' ? x.columnInternals.currentSortDirection : TableColumnSortDirection.none)}"
|
|
73693
|
+
?first-sorted-column="${(x, c) => x === c.parent.firstSortedColumn}"
|
|
73694
|
+
?indicators-hidden="${x => x.columnInternals.hideHeaderIndicators}"
|
|
73695
|
+
@keydown="${(x, c) => c.parent.onHeaderKeyDown(x, c.event)}"
|
|
73696
|
+
@click="${(x, c) => c.parent.toggleColumnSort(x, c.event.shiftKey)}"
|
|
73697
|
+
:alignment="${x => x.columnInternals.headerAlignment}"
|
|
73698
|
+
:isGrouped="${x => (typeof x.columnInternals.groupIndex === 'number' && !x.columnInternals.groupingDisabled) || undefined}"
|
|
73699
|
+
>
|
|
73700
|
+
<slot name="${x => x.slot}"></slot>
|
|
73701
|
+
</${tableHeaderTag}>
|
|
73702
|
+
`;
|
|
73024
73703
|
const template$K = html `
|
|
73025
73704
|
<template
|
|
73026
73705
|
role="treegrid"
|
|
@@ -73038,8 +73717,14 @@ focus outline in that case.
|
|
|
73038
73717
|
--ni-private-table-row-grid-columns: ${x => (x.rowGridColumns ? x.rowGridColumns : '')};
|
|
73039
73718
|
--ni-private-table-cursor-override: ${x => (x.layoutManager.isColumnBeingSized ? 'col-resize' : 'default')};
|
|
73040
73719
|
--ni-private-table-scrollable-min-width: ${x => x.tableScrollableMinWidth}px;
|
|
73720
|
+
--ni-private-table-pinned-columns-row-grid-columns: ${x => x.pinnedColumnsGridTemplateColumns};
|
|
73041
73721
|
">
|
|
73042
73722
|
<div role="rowgroup" class="header-row-container">
|
|
73723
|
+
<div class="pinned-columns-header-container">
|
|
73724
|
+
${repeat(x => x.pinnedColumns, html `
|
|
73725
|
+
${tableHeaderTemplate}
|
|
73726
|
+
`, { positioning: true })}
|
|
73727
|
+
</div>
|
|
73043
73728
|
<div class="header-row" role="row">
|
|
73044
73729
|
<span role="${x => (x.showRowOperationColumn ? 'columnheader' : '')}" class="header-row-action-container" ${ref('headerRowActionContainer')}>
|
|
73045
73730
|
${when(x => x.showRowOperationColumn, html `
|
|
@@ -73092,19 +73777,7 @@ focus outline in that case.
|
|
|
73092
73777
|
@pointerdown="${(_, c) => c.parent.onLeftDividerPointerDown(c.event, c.index)}">
|
|
73093
73778
|
</div>
|
|
73094
73779
|
`)}
|
|
73095
|
-
|
|
73096
|
-
class="header"
|
|
73097
|
-
${'' /* tabindex managed dynamically by KeyboardNavigationManager (if column sorting not disabled) */}
|
|
73098
|
-
sort-direction="${x => (typeof x.columnInternals.currentSortIndex === 'number' ? x.columnInternals.currentSortDirection : TableColumnSortDirection.none)}"
|
|
73099
|
-
?first-sorted-column="${(x, c) => x === c.parent.firstSortedColumn}"
|
|
73100
|
-
?indicators-hidden="${x => x.columnInternals.hideHeaderIndicators}"
|
|
73101
|
-
@keydown="${(x, c) => c.parent.onHeaderKeyDown(x, c.event)}"
|
|
73102
|
-
@click="${(x, c) => c.parent.toggleColumnSort(x, c.event.shiftKey)}"
|
|
73103
|
-
:alignment="${x => x.columnInternals.headerAlignment}"
|
|
73104
|
-
:isGrouped=${x => (typeof x.columnInternals.groupIndex === 'number' && !x.columnInternals.groupingDisabled)}
|
|
73105
|
-
>
|
|
73106
|
-
<slot name="${x => x.slot}"></slot>
|
|
73107
|
-
</${tableHeaderTag}>
|
|
73780
|
+
${tableHeaderTemplate}
|
|
73108
73781
|
${when((_, c) => c.index < c.length - 1, html `
|
|
73109
73782
|
<div
|
|
73110
73783
|
class="
|
|
@@ -73137,6 +73810,7 @@ focus outline in that case.
|
|
|
73137
73810
|
:groupRowValue="${(x, c) => c.parent.tableData[x.index]?.groupRowValue}"
|
|
73138
73811
|
?expanded="${(x, c) => c.parent.tableData[x.index]?.isExpanded}"
|
|
73139
73812
|
:nestingLevel="${(x, c) => c.parent.tableData[x.index]?.nestingLevel}"
|
|
73813
|
+
:pinnedColumnOffset="${(_, c) => c.parent.pinnedColumnOffset}"
|
|
73140
73814
|
:immediateChildCount="${(x, c) => c.parent.tableData[x.index]?.immediateChildCount}"
|
|
73141
73815
|
:groupColumn="${(x, c) => c.parent.tableData[x.index]?.groupColumn}"
|
|
73142
73816
|
?selectable="${(_, c) => c.parent.selectionMode === TableRowSelectionMode.multiple}"
|
|
@@ -73396,6 +74070,11 @@ focus outline in that case.
|
|
|
73396
74070
|
return horizontal ? el.scrollLeft * (isRtl && -1 || 1) : el.scrollTop;
|
|
73397
74071
|
});
|
|
73398
74072
|
const measureElement = (element, entry, instance) => {
|
|
74073
|
+
if (instance.options.useCachedMeasurements) {
|
|
74074
|
+
const index = instance.indexFromElement(element);
|
|
74075
|
+
const key = instance.options.getItemKey(index);
|
|
74076
|
+
return instance.itemSizeCache.get(key) ?? instance.options.estimateSize(index);
|
|
74077
|
+
}
|
|
73399
74078
|
if (entry == null ? void 0 : entry.borderBoxSize) {
|
|
73400
74079
|
const box = entry.borderBoxSize[0];
|
|
73401
74080
|
if (box) {
|
|
@@ -73405,6 +74084,14 @@ focus outline in that case.
|
|
|
73405
74084
|
return size;
|
|
73406
74085
|
}
|
|
73407
74086
|
}
|
|
74087
|
+
if (!entry) {
|
|
74088
|
+
const index = instance.indexFromElement(element);
|
|
74089
|
+
const key = instance.options.getItemKey(index);
|
|
74090
|
+
const cachedSize = instance.itemSizeCache.get(key);
|
|
74091
|
+
if (cachedSize !== void 0) {
|
|
74092
|
+
return cachedSize;
|
|
74093
|
+
}
|
|
74094
|
+
}
|
|
73408
74095
|
return element[instance.options.horizontal ? "offsetWidth" : "offsetHeight"];
|
|
73409
74096
|
};
|
|
73410
74097
|
const scrollWithAdjustments = (offset, {
|
|
@@ -73531,7 +74218,8 @@ focus outline in that case.
|
|
|
73531
74218
|
isRtl: false,
|
|
73532
74219
|
useScrollendEvent: false,
|
|
73533
74220
|
useAnimationFrameWithResizeObserver: false,
|
|
73534
|
-
laneAssignmentMode: "estimate"
|
|
74221
|
+
laneAssignmentMode: "estimate",
|
|
74222
|
+
useCachedMeasurements: false
|
|
73535
74223
|
};
|
|
73536
74224
|
for (const key in opts2) {
|
|
73537
74225
|
const v = opts2[key];
|
|
@@ -73540,6 +74228,7 @@ focus outline in that case.
|
|
|
73540
74228
|
const prevOptions = this.options;
|
|
73541
74229
|
let anchor = null;
|
|
73542
74230
|
let followOnAppend = null;
|
|
74231
|
+
let edgeKeysChanged = false;
|
|
73543
74232
|
if (prevOptions !== void 0 && prevOptions.enabled && merged.enabled && merged.anchorTo === "end" && this.scrollElement !== null) {
|
|
73544
74233
|
const prevCount = prevOptions.count;
|
|
73545
74234
|
const nextCount = merged.count;
|
|
@@ -73549,6 +74238,7 @@ focus outline in that case.
|
|
|
73549
74238
|
const didCountChange = nextCount !== prevCount;
|
|
73550
74239
|
const didEdgeKeysChange = didCountChange || prevCount > 0 && nextCount > 0 && (merged.getItemKey(0) !== prevFirstKey || merged.getItemKey(nextCount - 1) !== prevLastKey);
|
|
73551
74240
|
if (didEdgeKeysChange) {
|
|
74241
|
+
edgeKeysChanged = true;
|
|
73552
74242
|
const item = prevCount > 0 ? this.getVirtualItemForOffset(this.getScrollOffset()) ?? measurements[0] : null;
|
|
73553
74243
|
if (item) {
|
|
73554
74244
|
anchor = [item.key, this.getScrollOffset() - item.start];
|
|
@@ -73560,11 +74250,38 @@ focus outline in that case.
|
|
|
73560
74250
|
}
|
|
73561
74251
|
}
|
|
73562
74252
|
this.options = merged;
|
|
73563
|
-
if (
|
|
74253
|
+
if (edgeKeysChanged) {
|
|
74254
|
+
this.pendingMin = 0;
|
|
74255
|
+
this.itemSizeCacheVersion++;
|
|
74256
|
+
}
|
|
74257
|
+
let anchorResolved = false;
|
|
74258
|
+
let anchorDelta = 0;
|
|
74259
|
+
if (anchor && this.scrollOffset !== null) {
|
|
74260
|
+
const [anchorKey, anchorOffset] = anchor;
|
|
74261
|
+
const newMeasurements = this.getMeasurements();
|
|
74262
|
+
const { count, getItemKey } = this.options;
|
|
74263
|
+
let idx = 0;
|
|
74264
|
+
while (idx < count && getItemKey(idx) !== anchorKey) {
|
|
74265
|
+
idx++;
|
|
74266
|
+
}
|
|
74267
|
+
if (idx < count) {
|
|
74268
|
+
const anchorItem = newMeasurements[idx];
|
|
74269
|
+
if (anchorItem) {
|
|
74270
|
+
const newOffset = anchorItem.start + anchorOffset;
|
|
74271
|
+
if (newOffset !== this.scrollOffset) {
|
|
74272
|
+
anchorDelta = newOffset - this.scrollOffset;
|
|
74273
|
+
this.scrollOffset = newOffset;
|
|
74274
|
+
anchorResolved = true;
|
|
74275
|
+
}
|
|
74276
|
+
}
|
|
74277
|
+
}
|
|
74278
|
+
}
|
|
74279
|
+
if (anchorResolved || followOnAppend) {
|
|
73564
74280
|
this.pendingScrollAnchor = [
|
|
73565
|
-
|
|
73566
|
-
|
|
73567
|
-
followOnAppend
|
|
74281
|
+
anchorResolved ? anchor[0] : null,
|
|
74282
|
+
anchorResolved ? anchor[1] : 0,
|
|
74283
|
+
followOnAppend,
|
|
74284
|
+
anchorDelta
|
|
73568
74285
|
];
|
|
73569
74286
|
}
|
|
73570
74287
|
};
|
|
@@ -73701,19 +74418,17 @@ focus outline in that case.
|
|
|
73701
74418
|
const anchor = this.pendingScrollAnchor;
|
|
73702
74419
|
this.pendingScrollAnchor = null;
|
|
73703
74420
|
if (anchor && this.scrollElement && this.options.enabled) {
|
|
73704
|
-
const [key,
|
|
73705
|
-
if (key !== null) {
|
|
73706
|
-
|
|
73707
|
-
|
|
73708
|
-
|
|
73709
|
-
index++;
|
|
73710
|
-
}
|
|
73711
|
-
const item = index < count ? this.getMeasurements()[index] : void 0;
|
|
73712
|
-
if (item) {
|
|
73713
|
-
const delta = item.start + offset - this.getScrollOffset();
|
|
73714
|
-
if (!approxEqual(delta, 0)) {
|
|
73715
|
-
this.applyScrollAdjustment(delta);
|
|
74421
|
+
const [key, _offset, followOnAppend, anchorDelta] = anchor;
|
|
74422
|
+
if (key !== null && !followOnAppend) {
|
|
74423
|
+
if (isIOSWebKit() && (this.isScrolling || this._iosTouching || this._iosJustTouchEnded)) {
|
|
74424
|
+
if (anchorDelta !== 0) {
|
|
74425
|
+
this._iosDeferredAdjustment += anchorDelta;
|
|
73716
74426
|
}
|
|
74427
|
+
} else {
|
|
74428
|
+
this._scrollToOffset(this.getScrollOffset(), {
|
|
74429
|
+
adjustments: void 0,
|
|
74430
|
+
behavior: void 0
|
|
74431
|
+
});
|
|
73717
74432
|
}
|
|
73718
74433
|
}
|
|
73719
74434
|
if (followOnAppend) {
|
|
@@ -74081,13 +74796,13 @@ focus outline in that case.
|
|
|
74081
74796
|
delta,
|
|
74082
74797
|
this
|
|
74083
74798
|
) : (
|
|
74084
|
-
// Default: adjust
|
|
74085
|
-
//
|
|
74086
|
-
//
|
|
74087
|
-
//
|
|
74088
|
-
//
|
|
74089
|
-
//
|
|
74090
|
-
itemStart < this.getScrollOffset() + this.scrollAdjustments && this.scrollDirection !== "backward"
|
|
74799
|
+
// Default: adjust when the resize is an above-viewport item.
|
|
74800
|
+
// First measurement (!has(key)): always adjust — the item
|
|
74801
|
+
// has never been sized, so the estimate→actual delta must
|
|
74802
|
+
// be compensated regardless of scroll direction.
|
|
74803
|
+
// Re-measurement (has(key)): skip during backward scroll
|
|
74804
|
+
// to avoid the "items jump while scrolling up" cascade.
|
|
74805
|
+
itemStart < this.getScrollOffset() + this.scrollAdjustments && (!this.itemSizeCache.has(key) || this.scrollDirection !== "backward")
|
|
74091
74806
|
));
|
|
74092
74807
|
if (this.pendingMin === null || index < this.pendingMin) {
|
|
74093
74808
|
this.pendingMin = index;
|
|
@@ -74680,7 +75395,7 @@ focus outline in that case.
|
|
|
74680
75395
|
};
|
|
74681
75396
|
}
|
|
74682
75397
|
getGridTemplateColumns() {
|
|
74683
|
-
return this.
|
|
75398
|
+
return this.getUnpinnedVisibleColumns()
|
|
74684
75399
|
.map(column => {
|
|
74685
75400
|
const { minPixelWidth, currentPixelWidth, currentFractionalWidth } = column.columnInternals;
|
|
74686
75401
|
if (currentPixelWidth !== undefined) {
|
|
@@ -74706,7 +75421,7 @@ focus outline in that case.
|
|
|
74706
75421
|
this.activeColumnIndex = this.leftColumnIndex + (this.activeColumnDivider % 2);
|
|
74707
75422
|
this.dragStart = dragStart;
|
|
74708
75423
|
this.currentTotalDelta = 0;
|
|
74709
|
-
this.visibleColumns = this.
|
|
75424
|
+
this.visibleColumns = this.getUnpinnedVisibleColumns();
|
|
74710
75425
|
this.setColumnsToFixedSize();
|
|
74711
75426
|
this.initialTableScrollableWidth = this.table.viewport.scrollWidth;
|
|
74712
75427
|
this.initialTableScrollableMinWidth = this.table.tableScrollableMinWidth;
|
|
@@ -74777,7 +75492,7 @@ focus outline in that case.
|
|
|
74777
75492
|
*/
|
|
74778
75493
|
getFirstLeftResizableColumnIndex(columnIndex) {
|
|
74779
75494
|
const visibleColumns = this.visibleColumns.length === 0
|
|
74780
|
-
? this.
|
|
75495
|
+
? this.getUnpinnedVisibleColumns()
|
|
74781
75496
|
: this.visibleColumns;
|
|
74782
75497
|
for (let i = columnIndex; i >= 0; i--) {
|
|
74783
75498
|
const column = visibleColumns[i];
|
|
@@ -74797,7 +75512,7 @@ focus outline in that case.
|
|
|
74797
75512
|
*/
|
|
74798
75513
|
getFirstRightResizableColumnIndex(columnIndex) {
|
|
74799
75514
|
const visibleColumns = this.visibleColumns.length === 0
|
|
74800
|
-
? this.
|
|
75515
|
+
? this.getUnpinnedVisibleColumns()
|
|
74801
75516
|
: this.visibleColumns;
|
|
74802
75517
|
for (let i = columnIndex; i < visibleColumns.length; i++) {
|
|
74803
75518
|
const column = visibleColumns[i];
|
|
@@ -74894,8 +75609,9 @@ focus outline in that case.
|
|
|
74894
75609
|
}
|
|
74895
75610
|
}
|
|
74896
75611
|
}
|
|
74897
|
-
|
|
74898
|
-
return this.table.columns.filter(column => !column.columnHidden
|
|
75612
|
+
getUnpinnedVisibleColumns() {
|
|
75613
|
+
return this.table.columns.filter(column => !column.columnHidden
|
|
75614
|
+
&& column.columnInternals.pinLocation !== TableColumnPinLocation.left);
|
|
74899
75615
|
}
|
|
74900
75616
|
getLeftColumnIndexFromDivider(dividerIndex) {
|
|
74901
75617
|
return Math.floor(dividerIndex / 2);
|
|
@@ -74931,7 +75647,8 @@ focus outline in that case.
|
|
|
74931
75647
|
'columnDefinition',
|
|
74932
75648
|
'actionMenuSlots',
|
|
74933
75649
|
'selectionMode',
|
|
74934
|
-
'actionMenusPreserveSelection'
|
|
75650
|
+
'actionMenusPreserveSelection',
|
|
75651
|
+
'columnPinned'
|
|
74935
75652
|
];
|
|
74936
75653
|
/**
|
|
74937
75654
|
* Helper class to track what updates are needed to the table based on configuration
|
|
@@ -74990,6 +75707,7 @@ focus outline in that case.
|
|
|
74990
75707
|
return (this.isTracked('columnSortDisabled')
|
|
74991
75708
|
|| this.isTracked('columnDefinition')
|
|
74992
75709
|
|| this.isTracked('columnHidden')
|
|
75710
|
+
|| this.isTracked('columnPinned')
|
|
74993
75711
|
|| this.isTracked('selectionMode')
|
|
74994
75712
|
|| this.isTracked('actionMenuSlots'));
|
|
74995
75713
|
}
|
|
@@ -75021,6 +75739,10 @@ focus outline in that case.
|
|
|
75021
75739
|
this.track('columnWidths');
|
|
75022
75740
|
this.track('columnHidden');
|
|
75023
75741
|
}
|
|
75742
|
+
else if (isColumnInternalsProperty(changedColumnProperty, 'pinLocation')) {
|
|
75743
|
+
this.track('columnWidths');
|
|
75744
|
+
this.track('columnPinned');
|
|
75745
|
+
}
|
|
75024
75746
|
else if (isColumnProperty(changedColumnProperty, 'actionMenuSlot')) {
|
|
75025
75747
|
this.track('actionMenuSlots');
|
|
75026
75748
|
}
|
|
@@ -76722,6 +77444,34 @@ focus outline in that case.
|
|
|
76722
77444
|
}
|
|
76723
77445
|
return '';
|
|
76724
77446
|
}
|
|
77447
|
+
/**
|
|
77448
|
+
* @internal
|
|
77449
|
+
*/
|
|
77450
|
+
get pinnedColumnOffset() {
|
|
77451
|
+
let offset = 0;
|
|
77452
|
+
for (const column of this.pinnedColumns) {
|
|
77453
|
+
const resolvedPixelWidth = this.getPinnedColumnResolvedPixelWidth(column);
|
|
77454
|
+
if (resolvedPixelWidth !== undefined) {
|
|
77455
|
+
const coercedPixelWidth = Math.max(column.columnInternals.minPixelWidth, resolvedPixelWidth);
|
|
77456
|
+
offset += coercedPixelWidth;
|
|
77457
|
+
}
|
|
77458
|
+
}
|
|
77459
|
+
return offset;
|
|
77460
|
+
}
|
|
77461
|
+
/**
|
|
77462
|
+
* @internal
|
|
77463
|
+
*/
|
|
77464
|
+
get pinnedColumnsGridTemplateColumns() {
|
|
77465
|
+
return this.pinnedColumns.map(column => {
|
|
77466
|
+
const resolvedPixelWidth = this.getPinnedColumnResolvedPixelWidth(column);
|
|
77467
|
+
if (resolvedPixelWidth !== undefined) {
|
|
77468
|
+
const coercedPixelWidth = Math.max(column.columnInternals.minPixelWidth, resolvedPixelWidth);
|
|
77469
|
+
return `${coercedPixelWidth}px`;
|
|
77470
|
+
}
|
|
77471
|
+
return '';
|
|
77472
|
+
})
|
|
77473
|
+
.join(' ');
|
|
77474
|
+
}
|
|
76725
77475
|
/**
|
|
76726
77476
|
* @internal
|
|
76727
77477
|
*/
|
|
@@ -76772,6 +77522,10 @@ focus outline in that case.
|
|
|
76772
77522
|
* @internal
|
|
76773
77523
|
*/
|
|
76774
77524
|
this.visibleColumns = [];
|
|
77525
|
+
/**
|
|
77526
|
+
* @internal
|
|
77527
|
+
*/
|
|
77528
|
+
this.pinnedColumns = [];
|
|
76775
77529
|
/**
|
|
76776
77530
|
* @internal
|
|
76777
77531
|
* This value determines the size of the viewport area when a user has created horizontal scrollable
|
|
@@ -77124,7 +77878,10 @@ focus outline in that case.
|
|
|
77124
77878
|
}
|
|
77125
77879
|
if (this.tableUpdateTracker.updateColumnWidths) {
|
|
77126
77880
|
this.rowGridColumns = this.layoutManager.getGridTemplateColumns();
|
|
77127
|
-
this.visibleColumns = this.columns.filter(column => !column.columnHidden
|
|
77881
|
+
this.visibleColumns = this.columns.filter(column => !column.columnHidden
|
|
77882
|
+
&& column.columnInternals.pinLocation !== TableColumnPinLocation.left);
|
|
77883
|
+
this.pinnedColumns = this.columns.filter(column => !column.columnHidden
|
|
77884
|
+
&& column.columnInternals.pinLocation === TableColumnPinLocation.left);
|
|
77128
77885
|
}
|
|
77129
77886
|
if (this.tableUpdateTracker.requiresKeyboardFocusReset) {
|
|
77130
77887
|
this.keyboardNavigationManager.resetFocusState();
|
|
@@ -77202,6 +77959,10 @@ focus outline in that case.
|
|
|
77202
77959
|
this.observeColumns();
|
|
77203
77960
|
this.tableUpdateTracker.trackColumnInstancesChanged();
|
|
77204
77961
|
}
|
|
77962
|
+
getPinnedColumnResolvedPixelWidth(column) {
|
|
77963
|
+
const { currentPixelWidth } = column.columnInternals;
|
|
77964
|
+
return currentPixelWidth;
|
|
77965
|
+
}
|
|
77205
77966
|
updateRequestedSlotsForOpeningActionMenu(openActionMenuRecordId) {
|
|
77206
77967
|
for (const actionMenuSlot of this.actionMenuSlots) {
|
|
77207
77968
|
this.requestedSlots.set(actionMenuSlot, {
|
|
@@ -77376,6 +78137,7 @@ focus outline in that case.
|
|
|
77376
78137
|
this.tableValidator.validateColumnSortIndices(this.getColumnsParticipatingInSorting().map(x => x.columnInternals.currentSortIndex));
|
|
77377
78138
|
this.tableValidator.validateColumnGroupIndices(this.getColumnsParticipatingInGrouping().map(x => x.columnInternals.groupIndex));
|
|
77378
78139
|
this.tableValidator.validateColumnConfigurations(this.columns);
|
|
78140
|
+
this.tableValidator.validatePinnedColumnConfigurations(this.columns);
|
|
77379
78141
|
if (this.dataHierarchyManager) {
|
|
77380
78142
|
this.validateWithData(this.dataHierarchyManager.getAllRecords());
|
|
77381
78143
|
}
|
|
@@ -77648,12 +78410,21 @@ focus outline in that case.
|
|
|
77648
78410
|
__decorate([
|
|
77649
78411
|
volatile
|
|
77650
78412
|
], Table$1.prototype, "collapseButtonVisibility", null);
|
|
78413
|
+
__decorate([
|
|
78414
|
+
volatile
|
|
78415
|
+
], Table$1.prototype, "pinnedColumnOffset", null);
|
|
78416
|
+
__decorate([
|
|
78417
|
+
volatile
|
|
78418
|
+
], Table$1.prototype, "pinnedColumnsGridTemplateColumns", null);
|
|
77651
78419
|
__decorate([
|
|
77652
78420
|
observable
|
|
77653
78421
|
], Table$1.prototype, "firstSortedColumn", void 0);
|
|
77654
78422
|
__decorate([
|
|
77655
78423
|
observable
|
|
77656
78424
|
], Table$1.prototype, "visibleColumns", void 0);
|
|
78425
|
+
__decorate([
|
|
78426
|
+
observable
|
|
78427
|
+
], Table$1.prototype, "pinnedColumns", void 0);
|
|
77657
78428
|
__decorate([
|
|
77658
78429
|
observable
|
|
77659
78430
|
], Table$1.prototype, "tableScrollableMinWidth", void 0);
|
|
@@ -78952,6 +79723,23 @@ focus outline in that case.
|
|
|
78952
79723
|
|
|
78953
79724
|
const template$F = html `${template$J}<slot ${slotted('mappings')} name="mapping"></slot>`;
|
|
78954
79725
|
|
|
79726
|
+
// As the returned class is internal to the function, we can't write a signature that uses is directly, so rely on inference
|
|
79727
|
+
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/explicit-function-return-type
|
|
79728
|
+
function mixinPinnableColumnAPI(base) {
|
|
79729
|
+
/**
|
|
79730
|
+
* The Mixin that provides a concrete column with the API to allow pinning
|
|
79731
|
+
* a fixed-width column within a table.
|
|
79732
|
+
*/
|
|
79733
|
+
class PinnableColumn extends base {
|
|
79734
|
+
/** @internal */
|
|
79735
|
+
pinLocationChanged() {
|
|
79736
|
+
this.columnInternals.pinLocation = this.pinLocation;
|
|
79737
|
+
}
|
|
79738
|
+
}
|
|
79739
|
+
attr({ attribute: 'pin-location' })(PinnableColumn.prototype, 'pinLocation');
|
|
79740
|
+
return PinnableColumn;
|
|
79741
|
+
}
|
|
79742
|
+
|
|
78955
79743
|
const enumBaseValidityFlagNames = [
|
|
78956
79744
|
'invalidMappingKeyValueForType',
|
|
78957
79745
|
'duplicateMappingKey',
|
|
@@ -79340,7 +80128,7 @@ focus outline in that case.
|
|
|
79340
80128
|
* Table column that maps number, boolean, or string values to an icon, a spinner,
|
|
79341
80129
|
* text, or an icon/spinner with text.
|
|
79342
80130
|
*/
|
|
79343
|
-
class TableColumnMapping extends mixinGroupableColumnAPI(mixinFractionalWidthColumnAPI(mixinSortableColumnAPI((TableColumnEnumBase)))) {
|
|
80131
|
+
class TableColumnMapping extends mixinGroupableColumnAPI(mixinFractionalWidthColumnAPI(mixinPinnableColumnAPI(mixinSortableColumnAPI((TableColumnEnumBase))))) {
|
|
79344
80132
|
minPixelWidthChanged() {
|
|
79345
80133
|
if (this.widthMode !== TableColumnMappingWidthMode.iconSize) {
|
|
79346
80134
|
this.columnInternals.minPixelWidth = this.getConfiguredMinPixelWidth();
|
|
@@ -99698,7 +100486,7 @@ focus outline in that case.
|
|
|
99698
100486
|
*/
|
|
99699
100487
|
textAreaInputHandler() {
|
|
99700
100488
|
this.value = this.textArea.value;
|
|
99701
|
-
this.isInputEmpty = this.
|
|
100489
|
+
this.isInputEmpty = this.textArea.value.length === 0;
|
|
99702
100490
|
this.adjustTextAreaHeight();
|
|
99703
100491
|
this.queueUpdateScrollbarWidth();
|
|
99704
100492
|
}
|
|
@@ -99720,7 +100508,7 @@ focus outline in that case.
|
|
|
99720
100508
|
valueChanged() {
|
|
99721
100509
|
if (this.textArea) {
|
|
99722
100510
|
this.textArea.value = this.value;
|
|
99723
|
-
this.isInputEmpty = this.
|
|
100511
|
+
this.isInputEmpty = this.textArea.value.length === 0;
|
|
99724
100512
|
this.adjustTextAreaHeight();
|
|
99725
100513
|
this.queueUpdateScrollbarWidth();
|
|
99726
100514
|
}
|
|
@@ -99731,7 +100519,7 @@ focus outline in that case.
|
|
|
99731
100519
|
connectedCallback() {
|
|
99732
100520
|
super.connectedCallback();
|
|
99733
100521
|
this.textArea.value = this.value;
|
|
99734
|
-
this.isInputEmpty = this.
|
|
100522
|
+
this.isInputEmpty = this.textArea.value.length === 0;
|
|
99735
100523
|
this.adjustTextAreaHeight();
|
|
99736
100524
|
this.resizeObserver = new ResizeObserver(() => this.onResize());
|
|
99737
100525
|
this.resizeObserver.observe(this);
|
|
@@ -104301,7 +105089,7 @@ focus outline in that case.
|
|
|
104301
105089
|
/**
|
|
104302
105090
|
* A table column that displays a breakpoint indicator with toggle functionality.
|
|
104303
105091
|
*/
|
|
104304
|
-
class TsTableColumnBreakpoint extends TableColumn {
|
|
105092
|
+
class TsTableColumnBreakpoint extends mixinPinnableColumnAPI((TableColumn)) {
|
|
104305
105093
|
constructor() {
|
|
104306
105094
|
super();
|
|
104307
105095
|
this.position = MenuButtonPosition.auto;
|