@ni/nimble-components 35.10.1 → 35.12.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 +1279 -470
- package/dist/all-components-bundle.js.map +1 -1
- package/dist/all-components-bundle.min.js +3587 -3321
- package/dist/all-components-bundle.min.js.map +1 -1
- package/dist/custom-elements.json +90 -0
- package/dist/custom-elements.md +11 -10
- package/dist/esm/combobox/styles.js +7 -0
- package/dist/esm/combobox/styles.js.map +1 -1
- package/dist/esm/number-field/styles.js +8 -0
- package/dist/esm/number-field/styles.js.map +1 -1
- package/dist/esm/table/components/group-row/index.d.ts +6 -0
- package/dist/esm/table/components/group-row/index.js +14 -0
- package/dist/esm/table/components/group-row/index.js.map +1 -1
- package/dist/esm/table/components/group-row/styles.js +91 -5
- package/dist/esm/table/components/group-row/styles.js.map +1 -1
- package/dist/esm/table/components/group-row/template.js +6 -1
- package/dist/esm/table/components/group-row/template.js.map +1 -1
- package/dist/esm/table/components/row/index.js +3 -1
- package/dist/esm/table/components/row/index.js.map +1 -1
- package/dist/esm/table/components/row/styles.js +79 -2
- package/dist/esm/table/components/row/styles.js.map +1 -1
- package/dist/esm/table/components/row/template.js +43 -31
- package/dist/esm/table/components/row/template.js.map +1 -1
- package/dist/esm/table/index.d.ts +13 -0
- package/dist/esm/table/index.js +51 -2
- package/dist/esm/table/index.js.map +1 -1
- package/dist/esm/table/models/table-layout-manager.d.ts +1 -1
- package/dist/esm/table/models/table-layout-manager.js +8 -6
- package/dist/esm/table/models/table-layout-manager.js.map +1 -1
- package/dist/esm/table/models/table-update-tracker.d.ts +1 -1
- package/dist/esm/table/models/table-update-tracker.js +7 -1
- package/dist/esm/table/models/table-update-tracker.js.map +1 -1
- package/dist/esm/table/models/table-validator.d.ts +2 -0
- package/dist/esm/table/models/table-validator.js +10 -2
- package/dist/esm/table/models/table-validator.js.map +1 -1
- package/dist/esm/table/styles.js +23 -5
- package/dist/esm/table/styles.js.map +1 -1
- package/dist/esm/table/template.d.ts +2 -1
- package/dist/esm/table/template.js +23 -13
- package/dist/esm/table/template.js.map +1 -1
- package/dist/esm/table/types.d.ts +9 -0
- package/dist/esm/table/types.js +7 -0
- package/dist/esm/table/types.js.map +1 -1
- package/dist/esm/table-column/base/models/column-internals.d.ts +5 -1
- package/dist/esm/table-column/base/models/column-internals.js +4 -1
- package/dist/esm/table-column/base/models/column-internals.js.map +1 -1
- package/dist/esm/table-column/mapping/index.d.ts +4 -0
- package/dist/esm/table-column/mapping/index.js +2 -1
- package/dist/esm/table-column/mapping/index.js.map +1 -1
- package/dist/esm/table-column/mixins/pinnable-column.d.ts +11 -0
- package/dist/esm/table-column/mixins/pinnable-column.js +18 -0
- package/dist/esm/table-column/mixins/pinnable-column.js.map +1 -0
- package/dist/esm/text-area/styles.js +4 -1
- package/dist/esm/text-area/styles.js.map +1 -1
- package/dist/esm/text-field/styles.js +3 -0
- package/dist/esm/text-field/styles.js.map +1 -1
- package/package.json +1 -1
|
@@ -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');
|
|
@@ -22240,6 +22242,7 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
22240
22242
|
${styles$L}
|
|
22241
22243
|
|
|
22242
22244
|
:host {
|
|
22245
|
+
field-sizing: fixed;
|
|
22243
22246
|
--ni-private-hover-bottom-border-width: 2px;
|
|
22244
22247
|
--ni-private-bottom-border-width: 1px;
|
|
22245
22248
|
--ni-private-height-within-border: calc(
|
|
@@ -22248,6 +22251,7 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
22248
22251
|
}
|
|
22249
22252
|
|
|
22250
22253
|
.control {
|
|
22254
|
+
field-sizing: inherit;
|
|
22251
22255
|
bottom-border-width: var(--ni-private-bottom-border-width);
|
|
22252
22256
|
}
|
|
22253
22257
|
|
|
@@ -22255,7 +22259,12 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
22255
22259
|
border-bottom-color: ${borderHoverColor};
|
|
22256
22260
|
}
|
|
22257
22261
|
|
|
22262
|
+
slot[name='control'] {
|
|
22263
|
+
field-sizing: inherit;
|
|
22264
|
+
}
|
|
22265
|
+
|
|
22258
22266
|
.selected-value {
|
|
22267
|
+
field-sizing: inherit;
|
|
22259
22268
|
-webkit-appearance: none;
|
|
22260
22269
|
background: transparent;
|
|
22261
22270
|
border: none;
|
|
@@ -28103,6 +28112,7 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
28103
28112
|
outline: none;
|
|
28104
28113
|
${userSelectNone}
|
|
28105
28114
|
color: ${bodyFontColor};
|
|
28115
|
+
field-sizing: fixed;
|
|
28106
28116
|
--ni-private-hover-indicator-width: calc(${borderWidth} + 1px);
|
|
28107
28117
|
--ni-private-height-within-border: calc(
|
|
28108
28118
|
${controlHeight} - 2 * ${borderWidth}
|
|
@@ -28135,6 +28145,7 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
28135
28145
|
position: relative;
|
|
28136
28146
|
display: flex;
|
|
28137
28147
|
flex-direction: row;
|
|
28148
|
+
field-sizing: inherit;
|
|
28138
28149
|
justify-content: center;
|
|
28139
28150
|
align-items: center;
|
|
28140
28151
|
border-radius: 0px;
|
|
@@ -28202,12 +28213,17 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
28202
28213
|
font: inherit;
|
|
28203
28214
|
background: transparent;
|
|
28204
28215
|
color: inherit;
|
|
28216
|
+
field-sizing: inherit;
|
|
28205
28217
|
height: var(--ni-private-height-within-border);
|
|
28206
28218
|
width: 100%;
|
|
28207
28219
|
border: none;
|
|
28208
28220
|
padding: 0px;
|
|
28209
28221
|
padding-left: ${mediumPadding};
|
|
28210
28222
|
}
|
|
28223
|
+
|
|
28224
|
+
:host([hide-step]) .control {
|
|
28225
|
+
padding-right: ${smallPadding};
|
|
28226
|
+
}
|
|
28211
28227
|
|
|
28212
28228
|
.control:hover,
|
|
28213
28229
|
.control:focus,
|
|
@@ -28305,6 +28321,7 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
28305
28321
|
|
|
28306
28322
|
:host([full-bleed]) .control {
|
|
28307
28323
|
padding-left: 0px;
|
|
28324
|
+
padding-right: 0px;
|
|
28308
28325
|
}
|
|
28309
28326
|
`));
|
|
28310
28327
|
|
|
@@ -28860,8 +28877,11 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
28860
28877
|
if (!childA.sameMarkup(childB))
|
|
28861
28878
|
return pos;
|
|
28862
28879
|
if (childA.isText && childA.text != childB.text) {
|
|
28863
|
-
|
|
28880
|
+
let tA = childA.text, tB = childB.text, j = 0;
|
|
28881
|
+
for (; tA[j] == tB[j]; j++)
|
|
28864
28882
|
pos++;
|
|
28883
|
+
if (j && j < tA.length && j < tB.length && surrogateHigh(tA.charCodeAt(j - 1)) && surrogateLow(tA.charCodeAt(j)))
|
|
28884
|
+
pos--;
|
|
28865
28885
|
return pos;
|
|
28866
28886
|
}
|
|
28867
28887
|
if (childA.content.size || childB.content.size) {
|
|
@@ -28885,12 +28905,17 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
28885
28905
|
if (!childA.sameMarkup(childB))
|
|
28886
28906
|
return { a: posA, b: posB };
|
|
28887
28907
|
if (childA.isText && childA.text != childB.text) {
|
|
28888
|
-
let
|
|
28889
|
-
while (
|
|
28890
|
-
|
|
28908
|
+
let tA = childA.text, tB = childB.text, iA = tA.length, iB = tB.length;
|
|
28909
|
+
while (iA > 0 && iB > 0 && tA[iA - 1] == tB[iB - 1]) {
|
|
28910
|
+
iA--;
|
|
28911
|
+
iB--;
|
|
28891
28912
|
posA--;
|
|
28892
28913
|
posB--;
|
|
28893
28914
|
}
|
|
28915
|
+
if (iA && iB && iA < tA.length && surrogateHigh(tA.charCodeAt(iA - 1)) && surrogateLow(tA.charCodeAt(iA))) {
|
|
28916
|
+
posA++;
|
|
28917
|
+
posB++;
|
|
28918
|
+
}
|
|
28894
28919
|
return { a: posA, b: posB };
|
|
28895
28920
|
}
|
|
28896
28921
|
if (childA.content.size || childB.content.size) {
|
|
@@ -28902,6 +28927,8 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
28902
28927
|
posB -= size;
|
|
28903
28928
|
}
|
|
28904
28929
|
}
|
|
28930
|
+
function surrogateLow(ch) { return ch >= 0xDC00 && ch < 0xE000; }
|
|
28931
|
+
function surrogateHigh(ch) { return ch >= 0xD800 && ch < 0xDC00; }
|
|
28905
28932
|
|
|
28906
28933
|
/**
|
|
28907
28934
|
A fragment represents a node's collection of child nodes.
|
|
@@ -29582,7 +29609,8 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
29582
29609
|
addNode($end.nodeBefore, target);
|
|
29583
29610
|
}
|
|
29584
29611
|
function close(node, content) {
|
|
29585
|
-
node.type.
|
|
29612
|
+
if (!node.type.validContent(content))
|
|
29613
|
+
throw new ReplaceError("Invalid content for node " + node.type.name);
|
|
29586
29614
|
return node.copy(content);
|
|
29587
29615
|
}
|
|
29588
29616
|
function replaceThreeWay($from, $start, $end, $to, depth) {
|
|
@@ -30893,13 +30921,12 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
30893
30921
|
return built;
|
|
30894
30922
|
}
|
|
30895
30923
|
function checkAttrs(attrs, values, type, name) {
|
|
30896
|
-
for (let
|
|
30897
|
-
if (!(
|
|
30898
|
-
throw new RangeError(`Unsupported attribute ${
|
|
30899
|
-
for (let
|
|
30900
|
-
|
|
30901
|
-
|
|
30902
|
-
attr.validate(values[name]);
|
|
30924
|
+
for (let attr in values)
|
|
30925
|
+
if (!(attr in attrs))
|
|
30926
|
+
throw new RangeError(`Unsupported attribute ${attr} for ${type} of type ${name}`);
|
|
30927
|
+
for (let attr in attrs) {
|
|
30928
|
+
if (attrs[attr].validate)
|
|
30929
|
+
attrs[attr].validate(values[attr]);
|
|
30903
30930
|
}
|
|
30904
30931
|
}
|
|
30905
30932
|
function initAttrs(typeName, attrs) {
|
|
@@ -38552,14 +38579,14 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
38552
38579
|
syncNodeSelection(view, sel);
|
|
38553
38580
|
if (!editorOwnsSelection(view))
|
|
38554
38581
|
return;
|
|
38555
|
-
//
|
|
38556
|
-
//
|
|
38557
|
-
|
|
38558
|
-
if (!force &&
|
|
38582
|
+
// Need to delay selection normalization during a native selection
|
|
38583
|
+
// drag on Chrome, or it will cause further dragging to glitch.
|
|
38584
|
+
let mouseDown = view.input.mouseDown;
|
|
38585
|
+
if (!force && chrome && mouseDown) {
|
|
38559
38586
|
let domSel = view.domSelectionRange(), curSel = view.domObserver.currentSelection;
|
|
38560
38587
|
if (domSel.anchorNode && curSel.anchorNode &&
|
|
38561
|
-
isEquivalentPosition(domSel.anchorNode, domSel.anchorOffset, curSel.anchorNode, curSel.anchorOffset)
|
|
38562
|
-
|
|
38588
|
+
isEquivalentPosition(domSel.anchorNode, domSel.anchorOffset, curSel.anchorNode, curSel.anchorOffset) &&
|
|
38589
|
+
mouseDown.delaySelUpdate()) {
|
|
38563
38590
|
view.domObserver.setCurSelection();
|
|
38564
38591
|
return;
|
|
38565
38592
|
}
|
|
@@ -39411,6 +39438,8 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
39411
39438
|
view.input.lastSelectionTime = Date.now();
|
|
39412
39439
|
}
|
|
39413
39440
|
function destroyInput(view) {
|
|
39441
|
+
if (view.input.mouseDown)
|
|
39442
|
+
view.input.mouseDown.done();
|
|
39414
39443
|
view.domObserver.stop();
|
|
39415
39444
|
for (let type in view.input.eventHandlers)
|
|
39416
39445
|
view.dom.removeEventListener(type, view.input.eventHandlers[type]);
|
|
@@ -39449,7 +39478,7 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
39449
39478
|
editHandlers.keydown = (view, _event) => {
|
|
39450
39479
|
let event = _event;
|
|
39451
39480
|
view.input.shiftKey = event.keyCode == 16 || event.shiftKey;
|
|
39452
|
-
if (inOrNearComposition(view
|
|
39481
|
+
if (inOrNearComposition(view))
|
|
39453
39482
|
return;
|
|
39454
39483
|
view.input.lastKeyCode = event.keyCode;
|
|
39455
39484
|
view.input.lastKeyCodeTime = Date.now();
|
|
@@ -39487,7 +39516,7 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
39487
39516
|
};
|
|
39488
39517
|
editHandlers.keypress = (view, _event) => {
|
|
39489
39518
|
let event = _event;
|
|
39490
|
-
if (inOrNearComposition(view
|
|
39519
|
+
if (inOrNearComposition(view) || !event.charCode ||
|
|
39491
39520
|
event.ctrlKey && !event.altKey || mac$2 && event.metaKey)
|
|
39492
39521
|
return;
|
|
39493
39522
|
if (view.someProp("handleKeyPress", f => f(view, event))) {
|
|
@@ -39581,26 +39610,28 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
39581
39610
|
function defaultTripleClick(view, inside, event) {
|
|
39582
39611
|
if (event.button != 0)
|
|
39583
39612
|
return false;
|
|
39584
|
-
let doc = view.state.doc;
|
|
39585
|
-
if (
|
|
39586
|
-
if (doc.inlineContent) {
|
|
39587
|
-
updateSelection(view, TextSelection.create(doc, 0, doc.content.size));
|
|
39588
|
-
return true;
|
|
39589
|
-
}
|
|
39613
|
+
let selection = selectionForTripleClick(view, inside, true), doc = view.state.doc;
|
|
39614
|
+
if (!selection)
|
|
39590
39615
|
return false;
|
|
39591
|
-
|
|
39616
|
+
updateSelection(view, selection);
|
|
39617
|
+
if (selection instanceof TextSelection && doc.eq(view.state.doc))
|
|
39618
|
+
view.input.mouseDown = new TripleClickDrag(view, selection);
|
|
39619
|
+
return true;
|
|
39620
|
+
}
|
|
39621
|
+
function selectionForTripleClick(view, inside, selectNodes) {
|
|
39622
|
+
let doc = view.state.doc;
|
|
39623
|
+
if (inside == -1)
|
|
39624
|
+
return doc.inlineContent ? TextSelection.create(doc, 0, doc.content.size) : null;
|
|
39592
39625
|
let $pos = doc.resolve(inside);
|
|
39593
39626
|
for (let i = $pos.depth + 1; i > 0; i--) {
|
|
39594
39627
|
let node = i > $pos.depth ? $pos.nodeAfter : $pos.node(i);
|
|
39595
39628
|
let nodePos = $pos.before(i);
|
|
39596
39629
|
if (node.inlineContent)
|
|
39597
|
-
|
|
39598
|
-
else if (NodeSelection.isSelectable(node))
|
|
39599
|
-
|
|
39600
|
-
else
|
|
39601
|
-
continue;
|
|
39602
|
-
return true;
|
|
39630
|
+
return TextSelection.create(doc, nodePos + 1, nodePos + 1 + node.content.size);
|
|
39631
|
+
else if (selectNodes && NodeSelection.isSelectable(node))
|
|
39632
|
+
return NodeSelection.create(doc, nodePos);
|
|
39603
39633
|
}
|
|
39634
|
+
return null;
|
|
39604
39635
|
}
|
|
39605
39636
|
function forceDOMFlush(view) {
|
|
39606
39637
|
return endComposition(view);
|
|
@@ -39619,13 +39650,13 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
39619
39650
|
type = "tripleClick";
|
|
39620
39651
|
}
|
|
39621
39652
|
view.input.lastClick = { time: now, x: event.clientX, y: event.clientY, type, button: event.button };
|
|
39653
|
+
if (view.input.mouseDown)
|
|
39654
|
+
view.input.mouseDown.done();
|
|
39622
39655
|
let pos = view.posAtCoords(eventCoords(event));
|
|
39623
39656
|
if (!pos)
|
|
39624
39657
|
return;
|
|
39625
39658
|
if (type == "singleClick") {
|
|
39626
|
-
|
|
39627
|
-
view.input.mouseDown.done();
|
|
39628
|
-
view.input.mouseDown = new MouseDown(view, pos, event, !!flushed);
|
|
39659
|
+
view.input.mouseDown = new LeftMouseDown(view, pos, event, !!flushed);
|
|
39629
39660
|
}
|
|
39630
39661
|
else if ((type == "doubleClick" ? handleDoubleClick : handleTripleClick)(view, pos.pos, pos.inside, event)) {
|
|
39631
39662
|
event.preventDefault();
|
|
@@ -39635,13 +39666,34 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
39635
39666
|
}
|
|
39636
39667
|
};
|
|
39637
39668
|
class MouseDown {
|
|
39638
|
-
constructor(view
|
|
39669
|
+
constructor(view) {
|
|
39639
39670
|
this.view = view;
|
|
39671
|
+
this.mightDrag = null;
|
|
39672
|
+
view.root.addEventListener("mouseup", this.up = this.up.bind(this));
|
|
39673
|
+
view.root.addEventListener("mousemove", this.move = this.move.bind(this));
|
|
39674
|
+
}
|
|
39675
|
+
up(event) {
|
|
39676
|
+
this.done();
|
|
39677
|
+
}
|
|
39678
|
+
move(event) {
|
|
39679
|
+
if (event.buttons == 0)
|
|
39680
|
+
this.done();
|
|
39681
|
+
}
|
|
39682
|
+
done() {
|
|
39683
|
+
this.view.root.removeEventListener("mouseup", this.up);
|
|
39684
|
+
this.view.root.removeEventListener("mousemove", this.move);
|
|
39685
|
+
if (this.view.input.mouseDown == this)
|
|
39686
|
+
this.view.input.mouseDown = null;
|
|
39687
|
+
}
|
|
39688
|
+
delaySelUpdate() { return false; }
|
|
39689
|
+
}
|
|
39690
|
+
class LeftMouseDown extends MouseDown {
|
|
39691
|
+
constructor(view, pos, event, flushed) {
|
|
39692
|
+
super(view);
|
|
39640
39693
|
this.pos = pos;
|
|
39641
39694
|
this.event = event;
|
|
39642
39695
|
this.flushed = flushed;
|
|
39643
39696
|
this.delayedSelectionSync = false;
|
|
39644
|
-
this.mightDrag = null;
|
|
39645
39697
|
this.startDoc = view.state.doc;
|
|
39646
39698
|
this.selectNode = !!event[selectNodeModifier];
|
|
39647
39699
|
this.allowDefault = event.shiftKey;
|
|
@@ -39679,13 +39731,10 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
39679
39731
|
}, 20);
|
|
39680
39732
|
this.view.domObserver.start();
|
|
39681
39733
|
}
|
|
39682
|
-
view.root.addEventListener("mouseup", this.up = this.up.bind(this));
|
|
39683
|
-
view.root.addEventListener("mousemove", this.move = this.move.bind(this));
|
|
39684
39734
|
setSelectionOrigin(view, "pointer");
|
|
39685
39735
|
}
|
|
39686
39736
|
done() {
|
|
39687
|
-
|
|
39688
|
-
this.view.root.removeEventListener("mousemove", this.move);
|
|
39737
|
+
super.done();
|
|
39689
39738
|
if (this.mightDrag && this.target) {
|
|
39690
39739
|
this.view.domObserver.stop();
|
|
39691
39740
|
if (this.mightDrag.addAttr)
|
|
@@ -39695,8 +39744,10 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
39695
39744
|
this.view.domObserver.start();
|
|
39696
39745
|
}
|
|
39697
39746
|
if (this.delayedSelectionSync)
|
|
39698
|
-
setTimeout(() =>
|
|
39699
|
-
|
|
39747
|
+
setTimeout(() => {
|
|
39748
|
+
if (!this.view.isDestroyed)
|
|
39749
|
+
selectionToDOM(this.view);
|
|
39750
|
+
});
|
|
39700
39751
|
}
|
|
39701
39752
|
up(event) {
|
|
39702
39753
|
this.done();
|
|
@@ -39735,14 +39786,41 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
39735
39786
|
move(event) {
|
|
39736
39787
|
this.updateAllowDefault(event);
|
|
39737
39788
|
setSelectionOrigin(this.view, "pointer");
|
|
39738
|
-
|
|
39739
|
-
this.done();
|
|
39789
|
+
super.move(event);
|
|
39740
39790
|
}
|
|
39741
39791
|
updateAllowDefault(event) {
|
|
39742
39792
|
if (!this.allowDefault && (Math.abs(this.event.x - event.clientX) > 4 ||
|
|
39743
39793
|
Math.abs(this.event.y - event.clientY) > 4))
|
|
39744
39794
|
this.allowDefault = true;
|
|
39745
39795
|
}
|
|
39796
|
+
delaySelUpdate() {
|
|
39797
|
+
if (!this.allowDefault)
|
|
39798
|
+
return false;
|
|
39799
|
+
this.delayedSelectionSync = true;
|
|
39800
|
+
return true;
|
|
39801
|
+
}
|
|
39802
|
+
}
|
|
39803
|
+
class TripleClickDrag extends MouseDown {
|
|
39804
|
+
constructor(view, startSelection) {
|
|
39805
|
+
super(view);
|
|
39806
|
+
this.startSelection = startSelection;
|
|
39807
|
+
this.startDoc = view.state.doc;
|
|
39808
|
+
}
|
|
39809
|
+
move(event) {
|
|
39810
|
+
if (event.buttons == 0 || this.view.isDestroyed || !this.view.state.doc.eq(this.startDoc)) {
|
|
39811
|
+
this.done();
|
|
39812
|
+
return;
|
|
39813
|
+
}
|
|
39814
|
+
event.preventDefault();
|
|
39815
|
+
setSelectionOrigin(this.view, "pointer");
|
|
39816
|
+
let pos = this.view.posAtCoords(eventCoords(event));
|
|
39817
|
+
let target = pos && selectionForTripleClick(this.view, pos.inside, false);
|
|
39818
|
+
if (!target)
|
|
39819
|
+
return;
|
|
39820
|
+
let { doc } = this.view.state, start = this.startSelection;
|
|
39821
|
+
let [anchor, head] = target.from < start.from ? [start.to, target.from] : [start.from, target.to];
|
|
39822
|
+
updateSelection(this.view, TextSelection.create(doc, anchor, head));
|
|
39823
|
+
}
|
|
39746
39824
|
}
|
|
39747
39825
|
handlers.touchstart = view => {
|
|
39748
39826
|
view.input.lastTouch = Date.now();
|
|
@@ -39767,7 +39845,7 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
39767
39845
|
// This guards against the case where compositionend is triggered without the keyboard
|
|
39768
39846
|
// (e.g. character confirmation may be done with the mouse), and keydown is triggered
|
|
39769
39847
|
// afterwards- we wouldn't want to ignore the keydown event in this case.
|
|
39770
|
-
if (safari && Math.abs(
|
|
39848
|
+
if (safari && Math.abs(Date.now() - view.input.compositionEndedAt) < 500) {
|
|
39771
39849
|
view.input.compositionEndedAt = -2e8;
|
|
39772
39850
|
return true;
|
|
39773
39851
|
}
|
|
@@ -39826,7 +39904,7 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
39826
39904
|
editHandlers.compositionend = (view, event) => {
|
|
39827
39905
|
if (view.composing) {
|
|
39828
39906
|
view.input.composing = false;
|
|
39829
|
-
view.input.compositionEndedAt =
|
|
39907
|
+
view.input.compositionEndedAt = Date.now();
|
|
39830
39908
|
view.input.compositionPendingChanges = view.domObserver.pendingRecords().length ? view.input.compositionID : 0;
|
|
39831
39909
|
view.input.compositionNode = null;
|
|
39832
39910
|
if (view.input.badSafariComposition)
|
|
@@ -39845,7 +39923,7 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
39845
39923
|
function clearComposition(view) {
|
|
39846
39924
|
if (view.composing) {
|
|
39847
39925
|
view.input.composing = false;
|
|
39848
|
-
view.input.compositionEndedAt =
|
|
39926
|
+
view.input.compositionEndedAt = Date.now();
|
|
39849
39927
|
}
|
|
39850
39928
|
while (view.input.compositionNodes.length > 0)
|
|
39851
39929
|
view.input.compositionNodes.pop().markParentsDirty();
|
|
@@ -39871,11 +39949,6 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
39871
39949
|
}
|
|
39872
39950
|
return textBefore || textAfter;
|
|
39873
39951
|
}
|
|
39874
|
-
function timestampFromCustomEvent() {
|
|
39875
|
-
let event = document.createEvent("Event");
|
|
39876
|
-
event.initEvent("event", true, true);
|
|
39877
|
-
return event.timeStamp;
|
|
39878
|
-
}
|
|
39879
39952
|
/**
|
|
39880
39953
|
@internal
|
|
39881
39954
|
*/
|
|
@@ -41032,7 +41105,10 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
41032
41105
|
}
|
|
41033
41106
|
}
|
|
41034
41107
|
}
|
|
41035
|
-
if (added.some(n => n.nodeName == "BR") &&
|
|
41108
|
+
if (added.some(n => n.nodeName == "BR") &&
|
|
41109
|
+
(view.input.lastKeyCode == 8 || view.input.lastKeyCode == 46 ||
|
|
41110
|
+
chrome && (view.composing || view.input.compositionEndedAt > Date.now() - 50) &&
|
|
41111
|
+
mutations.some(m => m.type == "childList" && m.removedNodes.length))) {
|
|
41036
41112
|
// Browsers sometimes insert a bogus break node if you
|
|
41037
41113
|
// backspace out the last bit of text before an inline-flex node (#1552)
|
|
41038
41114
|
for (let node of added)
|
|
@@ -41588,38 +41664,28 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
41588
41664
|
return end;
|
|
41589
41665
|
}
|
|
41590
41666
|
function findDiff(a, b, pos, preferredPos, preferredSide) {
|
|
41591
|
-
let start = a.findDiffStart(b, pos);
|
|
41667
|
+
let start = a.findDiffStart(b, pos), lenA = pos + a.size, lenB = pos + b.size;
|
|
41592
41668
|
if (start == null)
|
|
41593
41669
|
return null;
|
|
41594
|
-
let { a: endA, b: endB } = a.findDiffEnd(b,
|
|
41670
|
+
let { a: endA, b: endB } = a.findDiffEnd(b, lenA, lenB);
|
|
41595
41671
|
if (preferredSide == "end") {
|
|
41596
41672
|
let adjust = Math.max(0, start - Math.min(endA, endB));
|
|
41597
41673
|
preferredPos -= endA + adjust - start;
|
|
41598
41674
|
}
|
|
41599
|
-
if (endA < start &&
|
|
41675
|
+
if (endA < start && lenA < lenB) {
|
|
41600
41676
|
let move = preferredPos <= start && preferredPos >= endA ? start - preferredPos : 0;
|
|
41601
41677
|
start -= move;
|
|
41602
|
-
if (start && start < b.size && isSurrogatePair(b.textBetween(start - 1, start + 1)))
|
|
41603
|
-
start += move ? 1 : -1;
|
|
41604
41678
|
endB = start + (endB - endA);
|
|
41605
41679
|
endA = start;
|
|
41606
41680
|
}
|
|
41607
41681
|
else if (endB < start) {
|
|
41608
41682
|
let move = preferredPos <= start && preferredPos >= endB ? start - preferredPos : 0;
|
|
41609
41683
|
start -= move;
|
|
41610
|
-
if (start && start < a.size && isSurrogatePair(a.textBetween(start - 1, start + 1)))
|
|
41611
|
-
start += move ? 1 : -1;
|
|
41612
41684
|
endA = start + (endA - endB);
|
|
41613
41685
|
endB = start;
|
|
41614
41686
|
}
|
|
41615
41687
|
return { start, endA, endB };
|
|
41616
41688
|
}
|
|
41617
|
-
function isSurrogatePair(str) {
|
|
41618
|
-
if (str.length != 2)
|
|
41619
|
-
return false;
|
|
41620
|
-
let a = str.charCodeAt(0), b = str.charCodeAt(1);
|
|
41621
|
-
return a >= 0xDC00 && a <= 0xDFFF && b >= 0xD800 && b <= 0xDBFF;
|
|
41622
|
-
}
|
|
41623
41689
|
/**
|
|
41624
41690
|
An editor view manages the DOM structure that represents an
|
|
41625
41691
|
editable document. Its state and behavior are determined by its
|
|
@@ -41811,9 +41877,10 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
41811
41877
|
// a DOM selection change and the "selectionchange" event for it
|
|
41812
41878
|
// can cause a spurious DOM selection update, disrupting mouse
|
|
41813
41879
|
// drag selection.
|
|
41880
|
+
let mouseDown = this.input.mouseDown;
|
|
41814
41881
|
if (forceSelUpdate ||
|
|
41815
|
-
!(
|
|
41816
|
-
anchorInRightPlace(this))) {
|
|
41882
|
+
!(mouseDown && this.domObserver.currentSelection.eq(this.domSelectionRange()) &&
|
|
41883
|
+
anchorInRightPlace(this) && mouseDown.delaySelUpdate())) {
|
|
41817
41884
|
selectionToDOM(this, forceSelUpdate);
|
|
41818
41885
|
}
|
|
41819
41886
|
else {
|
|
@@ -42739,7 +42806,9 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
42739
42806
|
function getNodeType(nameOrType, schema) {
|
|
42740
42807
|
if (typeof nameOrType === "string") {
|
|
42741
42808
|
if (!schema.nodes[nameOrType]) {
|
|
42742
|
-
throw Error(
|
|
42809
|
+
throw Error(
|
|
42810
|
+
`There is no node type named '${nameOrType}'. Maybe you forgot to add the extension?`
|
|
42811
|
+
);
|
|
42743
42812
|
}
|
|
42744
42813
|
return schema.nodes[nameOrType];
|
|
42745
42814
|
}
|
|
@@ -42898,7 +42967,9 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
42898
42967
|
function getMarkType(nameOrType, schema) {
|
|
42899
42968
|
if (typeof nameOrType === "string") {
|
|
42900
42969
|
if (!schema.marks[nameOrType]) {
|
|
42901
|
-
throw Error(
|
|
42970
|
+
throw Error(
|
|
42971
|
+
`There is no mark type named '${nameOrType}'. Maybe you forgot to add the extension?`
|
|
42972
|
+
);
|
|
42902
42973
|
}
|
|
42903
42974
|
return schema.marks[nameOrType];
|
|
42904
42975
|
}
|
|
@@ -42955,9 +43026,17 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
42955
43026
|
const minPos = selectionAtStart.from;
|
|
42956
43027
|
const maxPos = selectionAtEnd.to;
|
|
42957
43028
|
if (position === "all") {
|
|
42958
|
-
return TextSelection.create(
|
|
43029
|
+
return TextSelection.create(
|
|
43030
|
+
doc,
|
|
43031
|
+
minMax(0, minPos, maxPos),
|
|
43032
|
+
minMax(doc.content.size, minPos, maxPos)
|
|
43033
|
+
);
|
|
42959
43034
|
}
|
|
42960
|
-
return TextSelection.create(
|
|
43035
|
+
return TextSelection.create(
|
|
43036
|
+
doc,
|
|
43037
|
+
minMax(position, minPos, maxPos),
|
|
43038
|
+
minMax(position, minPos, maxPos)
|
|
43039
|
+
);
|
|
42961
43040
|
}
|
|
42962
43041
|
|
|
42963
43042
|
// src/utilities/isAndroid.ts
|
|
@@ -42967,7 +43046,9 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
42967
43046
|
|
|
42968
43047
|
// src/utilities/isiOS.ts
|
|
42969
43048
|
function isiOS() {
|
|
42970
|
-
return ["iPad Simulator", "iPhone Simulator", "iPod Simulator", "iPad", "iPhone", "iPod"].includes(
|
|
43049
|
+
return ["iPad Simulator", "iPhone Simulator", "iPod Simulator", "iPad", "iPhone", "iPod"].includes(
|
|
43050
|
+
navigator.platform
|
|
43051
|
+
) || // iPad on iOS 13 detection
|
|
42971
43052
|
navigator.userAgent.includes("Mac") && "ontouchend" in document;
|
|
42972
43053
|
}
|
|
42973
43054
|
|
|
@@ -43030,7 +43111,11 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
43030
43111
|
|
|
43031
43112
|
// src/commands/insertContent.ts
|
|
43032
43113
|
var insertContent = (value, options) => ({ tr, commands }) => {
|
|
43033
|
-
return commands.insertContentAt(
|
|
43114
|
+
return commands.insertContentAt(
|
|
43115
|
+
{ from: tr.selection.from, to: tr.selection.to },
|
|
43116
|
+
value,
|
|
43117
|
+
options
|
|
43118
|
+
);
|
|
43034
43119
|
};
|
|
43035
43120
|
|
|
43036
43121
|
// src/utilities/elementFromString.ts
|
|
@@ -43048,7 +43133,9 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
43048
43133
|
};
|
|
43049
43134
|
function elementFromString(value) {
|
|
43050
43135
|
if (typeof window === "undefined") {
|
|
43051
|
-
throw new Error(
|
|
43136
|
+
throw new Error(
|
|
43137
|
+
"[tiptap error]: there is no window object available, so this function cannot be used"
|
|
43138
|
+
);
|
|
43052
43139
|
}
|
|
43053
43140
|
const wrappedValue = `<body>${value}</body>`;
|
|
43054
43141
|
const html = new window.DOMParser().parseFromString(wrappedValue, "text/html").body;
|
|
@@ -43113,9 +43200,15 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
43113
43200
|
})
|
|
43114
43201
|
});
|
|
43115
43202
|
if (options.slice) {
|
|
43116
|
-
DOMParser.fromSchema(contentCheckSchema).parseSlice(
|
|
43203
|
+
DOMParser.fromSchema(contentCheckSchema).parseSlice(
|
|
43204
|
+
elementFromString(content),
|
|
43205
|
+
options.parseOptions
|
|
43206
|
+
);
|
|
43117
43207
|
} else {
|
|
43118
|
-
DOMParser.fromSchema(contentCheckSchema).parse(
|
|
43208
|
+
DOMParser.fromSchema(contentCheckSchema).parse(
|
|
43209
|
+
elementFromString(content),
|
|
43210
|
+
options.parseOptions
|
|
43211
|
+
);
|
|
43119
43212
|
}
|
|
43120
43213
|
if (options.errorOnInvalidContent && hasInvalidContent) {
|
|
43121
43214
|
throw new Error("[tiptap error]: Invalid HTML content", {
|
|
@@ -43485,7 +43578,11 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
43485
43578
|
if (markType === mark.type) {
|
|
43486
43579
|
canReset = true;
|
|
43487
43580
|
if (dispatch) {
|
|
43488
|
-
tr.addMark(
|
|
43581
|
+
tr.addMark(
|
|
43582
|
+
pos,
|
|
43583
|
+
pos + node.nodeSize,
|
|
43584
|
+
markType.create(deleteProps(mark.attrs, attributes))
|
|
43585
|
+
);
|
|
43489
43586
|
}
|
|
43490
43587
|
}
|
|
43491
43588
|
});
|
|
@@ -43654,7 +43751,11 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
43654
43751
|
options: extension.options,
|
|
43655
43752
|
storage: extension.storage
|
|
43656
43753
|
};
|
|
43657
|
-
const addExtensions = getExtensionField(
|
|
43754
|
+
const addExtensions = getExtensionField(
|
|
43755
|
+
extension,
|
|
43756
|
+
"addExtensions",
|
|
43757
|
+
context
|
|
43758
|
+
);
|
|
43658
43759
|
if (addExtensions) {
|
|
43659
43760
|
return [extension, ...flattenExtensions(addExtensions())];
|
|
43660
43761
|
}
|
|
@@ -43692,7 +43793,9 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
43692
43793
|
|
|
43693
43794
|
// src/helpers/splitExtensions.ts
|
|
43694
43795
|
function splitExtensions(extensions) {
|
|
43695
|
-
const baseExtensions = extensions.filter(
|
|
43796
|
+
const baseExtensions = extensions.filter(
|
|
43797
|
+
(extension) => extension.type === "extension"
|
|
43798
|
+
);
|
|
43696
43799
|
const nodeExtensions = extensions.filter((extension) => extension.type === "node");
|
|
43697
43800
|
const markExtensions = extensions.filter((extension) => extension.type === "mark");
|
|
43698
43801
|
return {
|
|
@@ -43768,11 +43871,7 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
43768
43871
|
options: extension.options,
|
|
43769
43872
|
storage: extension.storage
|
|
43770
43873
|
};
|
|
43771
|
-
const addAttributes = getExtensionField(
|
|
43772
|
-
extension,
|
|
43773
|
-
"addAttributes",
|
|
43774
|
-
context
|
|
43775
|
-
);
|
|
43874
|
+
const addAttributes = getExtensionField(extension, "addAttributes", context);
|
|
43776
43875
|
if (!addAttributes) {
|
|
43777
43876
|
return;
|
|
43778
43877
|
}
|
|
@@ -43872,10 +43971,15 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
43872
43971
|
if (key === "class") {
|
|
43873
43972
|
const valueClasses = value ? String(value).split(" ") : [];
|
|
43874
43973
|
const existingClasses = mergedAttributes[key] ? mergedAttributes[key].split(" ") : [];
|
|
43875
|
-
const insertClasses = valueClasses.filter(
|
|
43974
|
+
const insertClasses = valueClasses.filter(
|
|
43975
|
+
(valueClass) => !existingClasses.includes(valueClass)
|
|
43976
|
+
);
|
|
43876
43977
|
mergedAttributes[key] = [...existingClasses, ...insertClasses].join(" ");
|
|
43877
43978
|
} else if (key === "style") {
|
|
43878
|
-
const styleMap = new Map([
|
|
43979
|
+
const styleMap = new Map([
|
|
43980
|
+
...parseStyleEntries(mergedAttributes[key]),
|
|
43981
|
+
...parseStyleEntries(value)
|
|
43982
|
+
]);
|
|
43879
43983
|
mergedAttributes[key] = Array.from(styleMap.entries()).map(([property, val]) => `${property}: ${val}`).join("; ");
|
|
43880
43984
|
} else {
|
|
43881
43985
|
mergedAttributes[key] = value;
|
|
@@ -43971,7 +44075,9 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
43971
44075
|
const topNode = (_a = nodeExtensions.find((extension) => getExtensionField(extension, "topNode"))) == null ? void 0 : _a.name;
|
|
43972
44076
|
const nodes = Object.fromEntries(
|
|
43973
44077
|
nodeExtensions.map((extension) => {
|
|
43974
|
-
const extensionAttributes = allAttributes.filter(
|
|
44078
|
+
const extensionAttributes = allAttributes.filter(
|
|
44079
|
+
(attribute) => attribute.type === extension.name
|
|
44080
|
+
);
|
|
43975
44081
|
const context = {
|
|
43976
44082
|
name: extension.name,
|
|
43977
44083
|
options: extension.options,
|
|
@@ -43979,7 +44085,11 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
43979
44085
|
editor
|
|
43980
44086
|
};
|
|
43981
44087
|
const extraNodeFields = extensions.reduce((fields, e) => {
|
|
43982
|
-
const extendNodeSchema = getExtensionField(
|
|
44088
|
+
const extendNodeSchema = getExtensionField(
|
|
44089
|
+
e,
|
|
44090
|
+
"extendNodeSchema",
|
|
44091
|
+
context
|
|
44092
|
+
);
|
|
43983
44093
|
return {
|
|
43984
44094
|
...fields,
|
|
43985
44095
|
...extendNodeSchema ? extendNodeSchema(extension) : {}
|
|
@@ -43987,36 +44097,62 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
43987
44097
|
}, {});
|
|
43988
44098
|
const schema = cleanUpSchemaItem({
|
|
43989
44099
|
...extraNodeFields,
|
|
43990
|
-
content: callOrReturn(
|
|
44100
|
+
content: callOrReturn(
|
|
44101
|
+
getExtensionField(extension, "content", context)
|
|
44102
|
+
),
|
|
43991
44103
|
marks: callOrReturn(getExtensionField(extension, "marks", context)),
|
|
43992
44104
|
group: callOrReturn(getExtensionField(extension, "group", context)),
|
|
43993
44105
|
inline: callOrReturn(getExtensionField(extension, "inline", context)),
|
|
43994
44106
|
atom: callOrReturn(getExtensionField(extension, "atom", context)),
|
|
43995
|
-
selectable: callOrReturn(
|
|
43996
|
-
|
|
44107
|
+
selectable: callOrReturn(
|
|
44108
|
+
getExtensionField(extension, "selectable", context)
|
|
44109
|
+
),
|
|
44110
|
+
draggable: callOrReturn(
|
|
44111
|
+
getExtensionField(extension, "draggable", context)
|
|
44112
|
+
),
|
|
43997
44113
|
code: callOrReturn(getExtensionField(extension, "code", context)),
|
|
43998
|
-
whitespace: callOrReturn(
|
|
44114
|
+
whitespace: callOrReturn(
|
|
44115
|
+
getExtensionField(extension, "whitespace", context)
|
|
44116
|
+
),
|
|
43999
44117
|
linebreakReplacement: callOrReturn(
|
|
44000
|
-
getExtensionField(
|
|
44118
|
+
getExtensionField(
|
|
44119
|
+
extension,
|
|
44120
|
+
"linebreakReplacement",
|
|
44121
|
+
context
|
|
44122
|
+
)
|
|
44123
|
+
),
|
|
44124
|
+
defining: callOrReturn(
|
|
44125
|
+
getExtensionField(extension, "defining", context)
|
|
44126
|
+
),
|
|
44127
|
+
isolating: callOrReturn(
|
|
44128
|
+
getExtensionField(extension, "isolating", context)
|
|
44001
44129
|
),
|
|
44002
|
-
defining: callOrReturn(getExtensionField(extension, "defining", context)),
|
|
44003
|
-
isolating: callOrReturn(getExtensionField(extension, "isolating", context)),
|
|
44004
44130
|
attrs: Object.fromEntries(extensionAttributes.map(buildAttributeSpec))
|
|
44005
44131
|
});
|
|
44006
|
-
const parseHTML = callOrReturn(
|
|
44132
|
+
const parseHTML = callOrReturn(
|
|
44133
|
+
getExtensionField(extension, "parseHTML", context)
|
|
44134
|
+
);
|
|
44007
44135
|
if (parseHTML) {
|
|
44008
44136
|
schema.parseDOM = parseHTML.map(
|
|
44009
44137
|
(parseRule) => injectExtensionAttributesToParseRule(parseRule, extensionAttributes)
|
|
44010
44138
|
);
|
|
44011
44139
|
}
|
|
44012
|
-
const renderHTML = getExtensionField(
|
|
44140
|
+
const renderHTML = getExtensionField(
|
|
44141
|
+
extension,
|
|
44142
|
+
"renderHTML",
|
|
44143
|
+
context
|
|
44144
|
+
);
|
|
44013
44145
|
if (renderHTML) {
|
|
44014
44146
|
schema.toDOM = (node) => renderHTML({
|
|
44015
44147
|
node,
|
|
44016
44148
|
HTMLAttributes: getRenderedAttributes(node, extensionAttributes)
|
|
44017
44149
|
});
|
|
44018
44150
|
}
|
|
44019
|
-
const renderText = getExtensionField(
|
|
44151
|
+
const renderText = getExtensionField(
|
|
44152
|
+
extension,
|
|
44153
|
+
"renderText",
|
|
44154
|
+
context
|
|
44155
|
+
);
|
|
44020
44156
|
if (renderText) {
|
|
44021
44157
|
schema.toText = renderText;
|
|
44022
44158
|
}
|
|
@@ -44025,7 +44161,9 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
44025
44161
|
);
|
|
44026
44162
|
const marks = Object.fromEntries(
|
|
44027
44163
|
markExtensions.map((extension) => {
|
|
44028
|
-
const extensionAttributes = allAttributes.filter(
|
|
44164
|
+
const extensionAttributes = allAttributes.filter(
|
|
44165
|
+
(attribute) => attribute.type === extension.name
|
|
44166
|
+
);
|
|
44029
44167
|
const context = {
|
|
44030
44168
|
name: extension.name,
|
|
44031
44169
|
options: extension.options,
|
|
@@ -44033,7 +44171,11 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
44033
44171
|
editor
|
|
44034
44172
|
};
|
|
44035
44173
|
const extraMarkFields = extensions.reduce((fields, e) => {
|
|
44036
|
-
const extendMarkSchema = getExtensionField(
|
|
44174
|
+
const extendMarkSchema = getExtensionField(
|
|
44175
|
+
e,
|
|
44176
|
+
"extendMarkSchema",
|
|
44177
|
+
context
|
|
44178
|
+
);
|
|
44037
44179
|
return {
|
|
44038
44180
|
...fields,
|
|
44039
44181
|
...extendMarkSchema ? extendMarkSchema(extension) : {}
|
|
@@ -44041,20 +44183,32 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
44041
44183
|
}, {});
|
|
44042
44184
|
const schema = cleanUpSchemaItem({
|
|
44043
44185
|
...extraMarkFields,
|
|
44044
|
-
inclusive: callOrReturn(
|
|
44045
|
-
|
|
44186
|
+
inclusive: callOrReturn(
|
|
44187
|
+
getExtensionField(extension, "inclusive", context)
|
|
44188
|
+
),
|
|
44189
|
+
excludes: callOrReturn(
|
|
44190
|
+
getExtensionField(extension, "excludes", context)
|
|
44191
|
+
),
|
|
44046
44192
|
group: callOrReturn(getExtensionField(extension, "group", context)),
|
|
44047
|
-
spanning: callOrReturn(
|
|
44193
|
+
spanning: callOrReturn(
|
|
44194
|
+
getExtensionField(extension, "spanning", context)
|
|
44195
|
+
),
|
|
44048
44196
|
code: callOrReturn(getExtensionField(extension, "code", context)),
|
|
44049
44197
|
attrs: Object.fromEntries(extensionAttributes.map(buildAttributeSpec))
|
|
44050
44198
|
});
|
|
44051
|
-
const parseHTML = callOrReturn(
|
|
44199
|
+
const parseHTML = callOrReturn(
|
|
44200
|
+
getExtensionField(extension, "parseHTML", context)
|
|
44201
|
+
);
|
|
44052
44202
|
if (parseHTML) {
|
|
44053
44203
|
schema.parseDOM = parseHTML.map(
|
|
44054
44204
|
(parseRule) => injectExtensionAttributesToParseRule(parseRule, extensionAttributes)
|
|
44055
44205
|
);
|
|
44056
44206
|
}
|
|
44057
|
-
const renderHTML = getExtensionField(
|
|
44207
|
+
const renderHTML = getExtensionField(
|
|
44208
|
+
extension,
|
|
44209
|
+
"renderHTML",
|
|
44210
|
+
context
|
|
44211
|
+
);
|
|
44058
44212
|
if (renderHTML) {
|
|
44059
44213
|
schema.toDOM = (mark) => renderHTML({
|
|
44060
44214
|
mark,
|
|
@@ -44308,16 +44462,20 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
44308
44462
|
var getTextContentFromNodes = ($from, maxMatch = 500) => {
|
|
44309
44463
|
let textBefore = "";
|
|
44310
44464
|
const sliceEndPos = $from.parentOffset;
|
|
44311
|
-
$from.parent.nodesBetween(
|
|
44312
|
-
|
|
44313
|
-
|
|
44314
|
-
|
|
44315
|
-
|
|
44316
|
-
|
|
44317
|
-
|
|
44318
|
-
|
|
44319
|
-
|
|
44320
|
-
|
|
44465
|
+
$from.parent.nodesBetween(
|
|
44466
|
+
Math.max(0, sliceEndPos - maxMatch),
|
|
44467
|
+
sliceEndPos,
|
|
44468
|
+
(node, pos, parent, index) => {
|
|
44469
|
+
var _a, _b;
|
|
44470
|
+
const chunk = ((_b = (_a = node.type.spec).toText) == null ? void 0 : _b.call(_a, {
|
|
44471
|
+
node,
|
|
44472
|
+
pos,
|
|
44473
|
+
parent,
|
|
44474
|
+
index
|
|
44475
|
+
})) || node.textContent || "%leaf%";
|
|
44476
|
+
textBefore += node.isAtom && !node.isText ? chunk : chunk.slice(0, Math.max(0, sliceEndPos - pos));
|
|
44477
|
+
}
|
|
44478
|
+
);
|
|
44321
44479
|
return textBefore;
|
|
44322
44480
|
};
|
|
44323
44481
|
|
|
@@ -44688,7 +44846,11 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
44688
44846
|
const { selection, doc } = tr;
|
|
44689
44847
|
const { $from, $to } = selection;
|
|
44690
44848
|
const extensionAttributes = editor.extensionManager.attributes;
|
|
44691
|
-
const newAttributes = getSplittedAttributes(
|
|
44849
|
+
const newAttributes = getSplittedAttributes(
|
|
44850
|
+
extensionAttributes,
|
|
44851
|
+
$from.node().type.name,
|
|
44852
|
+
$from.node().attrs
|
|
44853
|
+
);
|
|
44692
44854
|
if (selection instanceof NodeSelection && selection.node.isBlock) {
|
|
44693
44855
|
if (!$from.parentOffset || !canSplit(doc, $from.pos)) {
|
|
44694
44856
|
return false;
|
|
@@ -44767,7 +44929,7 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
44767
44929
|
wrap = Fragment.from($from.node(d).copy(wrap));
|
|
44768
44930
|
}
|
|
44769
44931
|
const depthAfter = (
|
|
44770
|
-
//
|
|
44932
|
+
// oxlint-disable-next-line no-nested-ternary
|
|
44771
44933
|
$from.indexAfter(-1) < $from.node(-2).childCount ? 1 : $from.indexAfter(-2) < $from.node(-3).childCount ? 2 : 3
|
|
44772
44934
|
);
|
|
44773
44935
|
const newNextTypeAttributes2 = {
|
|
@@ -44996,15 +45158,22 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
44996
45158
|
};
|
|
44997
45159
|
|
|
44998
45160
|
// src/commands/unsetAllMarks.ts
|
|
44999
|
-
var unsetAllMarks = () => ({ tr, dispatch }) => {
|
|
45161
|
+
var unsetAllMarks = (options = {}) => ({ tr, dispatch, editor }) => {
|
|
45162
|
+
const { ignoreClearable = false } = options;
|
|
45000
45163
|
const { selection } = tr;
|
|
45001
45164
|
const { empty, ranges } = selection;
|
|
45002
45165
|
if (empty) {
|
|
45003
45166
|
return true;
|
|
45004
45167
|
}
|
|
45168
|
+
const { nonClearableMarks } = editor.extensionManager;
|
|
45005
45169
|
if (dispatch) {
|
|
45170
|
+
const clearableMarkTypes = Object.values(editor.schema.marks).filter(
|
|
45171
|
+
(markType) => ignoreClearable || !nonClearableMarks.includes(markType.name)
|
|
45172
|
+
);
|
|
45006
45173
|
ranges.forEach((range) => {
|
|
45007
|
-
|
|
45174
|
+
for (const markType of clearableMarkTypes) {
|
|
45175
|
+
tr.removeMark(range.$from.pos, range.$to.pos, markType);
|
|
45176
|
+
}
|
|
45008
45177
|
});
|
|
45009
45178
|
}
|
|
45010
45179
|
return true;
|
|
@@ -45239,7 +45408,9 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
45239
45408
|
result.data = inputRuleMatch.data;
|
|
45240
45409
|
if (inputRuleMatch.replaceWith) {
|
|
45241
45410
|
if (!inputRuleMatch.text.includes(inputRuleMatch.replaceWith)) {
|
|
45242
|
-
console.warn(
|
|
45411
|
+
console.warn(
|
|
45412
|
+
'[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'
|
|
45413
|
+
);
|
|
45243
45414
|
}
|
|
45244
45415
|
result.push(inputRuleMatch.replaceWith);
|
|
45245
45416
|
}
|
|
@@ -45447,7 +45618,7 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
45447
45618
|
getExtensionField(this, "addOptions", {
|
|
45448
45619
|
name: this.name
|
|
45449
45620
|
})
|
|
45450
|
-
)
|
|
45621
|
+
)
|
|
45451
45622
|
};
|
|
45452
45623
|
}
|
|
45453
45624
|
get storage() {
|
|
@@ -45457,7 +45628,7 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
45457
45628
|
name: this.name,
|
|
45458
45629
|
options: this.options
|
|
45459
45630
|
})
|
|
45460
|
-
)
|
|
45631
|
+
)
|
|
45461
45632
|
};
|
|
45462
45633
|
}
|
|
45463
45634
|
configure(options = {}) {
|
|
@@ -45551,7 +45722,9 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
45551
45722
|
result.data = pasteRuleMatch.data;
|
|
45552
45723
|
if (pasteRuleMatch.replaceWith) {
|
|
45553
45724
|
if (!pasteRuleMatch.text.includes(pasteRuleMatch.replaceWith)) {
|
|
45554
|
-
console.warn(
|
|
45725
|
+
console.warn(
|
|
45726
|
+
'[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'
|
|
45727
|
+
);
|
|
45555
45728
|
}
|
|
45556
45729
|
result.push(pasteRuleMatch.replaceWith);
|
|
45557
45730
|
}
|
|
@@ -45693,7 +45866,10 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
45693
45866
|
setTimeout(() => {
|
|
45694
45867
|
const selection = dragFromOtherEditor.state.selection;
|
|
45695
45868
|
if (selection) {
|
|
45696
|
-
dragFromOtherEditor.commands.deleteRange({
|
|
45869
|
+
dragFromOtherEditor.commands.deleteRange({
|
|
45870
|
+
from: selection.from,
|
|
45871
|
+
to: selection.to
|
|
45872
|
+
});
|
|
45697
45873
|
}
|
|
45698
45874
|
}, 10);
|
|
45699
45875
|
}
|
|
@@ -45758,6 +45934,7 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
45758
45934
|
var ExtensionManager = class {
|
|
45759
45935
|
constructor(extensions, editor) {
|
|
45760
45936
|
this.splittableMarks = [];
|
|
45937
|
+
this.nonClearableMarks = [];
|
|
45761
45938
|
this.editor = editor;
|
|
45762
45939
|
this.baseExtensions = extensions;
|
|
45763
45940
|
this.extensions = resolveExtensions(extensions);
|
|
@@ -45777,7 +45954,11 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
45777
45954
|
editor: this.editor,
|
|
45778
45955
|
type: getSchemaTypeByName(extension.name, this.schema)
|
|
45779
45956
|
};
|
|
45780
|
-
const addCommands = getExtensionField(
|
|
45957
|
+
const addCommands = getExtensionField(
|
|
45958
|
+
extension,
|
|
45959
|
+
"addCommands",
|
|
45960
|
+
context
|
|
45961
|
+
);
|
|
45781
45962
|
if (!addCommands) {
|
|
45782
45963
|
return commands;
|
|
45783
45964
|
}
|
|
@@ -45822,7 +46003,11 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
45822
46003
|
}
|
|
45823
46004
|
const keyMapPlugin = keymap(defaultBindings);
|
|
45824
46005
|
plugins.push(keyMapPlugin);
|
|
45825
|
-
const addInputRules = getExtensionField(
|
|
46006
|
+
const addInputRules = getExtensionField(
|
|
46007
|
+
extension,
|
|
46008
|
+
"addInputRules",
|
|
46009
|
+
context
|
|
46010
|
+
);
|
|
45826
46011
|
if (isExtensionRulesEnabled(extension, editor.options.enableInputRules) && addInputRules) {
|
|
45827
46012
|
const rules = addInputRules();
|
|
45828
46013
|
if (rules && rules.length) {
|
|
@@ -45834,7 +46019,11 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
45834
46019
|
plugins.push(...inputPlugins);
|
|
45835
46020
|
}
|
|
45836
46021
|
}
|
|
45837
|
-
const addPasteRules = getExtensionField(
|
|
46022
|
+
const addPasteRules = getExtensionField(
|
|
46023
|
+
extension,
|
|
46024
|
+
"addPasteRules",
|
|
46025
|
+
context
|
|
46026
|
+
);
|
|
45838
46027
|
if (isExtensionRulesEnabled(extension, editor.options.enablePasteRules) && addPasteRules) {
|
|
45839
46028
|
const rules = addPasteRules();
|
|
45840
46029
|
if (rules && rules.length) {
|
|
@@ -45871,7 +46060,9 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
45871
46060
|
const { nodeExtensions } = splitExtensions(this.extensions);
|
|
45872
46061
|
return Object.fromEntries(
|
|
45873
46062
|
nodeExtensions.filter((extension) => !!getExtensionField(extension, "addNodeView")).map((extension) => {
|
|
45874
|
-
const extensionAttributes = this.attributes.filter(
|
|
46063
|
+
const extensionAttributes = this.attributes.filter(
|
|
46064
|
+
(attribute) => attribute.type === extension.name
|
|
46065
|
+
);
|
|
45875
46066
|
const context = {
|
|
45876
46067
|
name: extension.name,
|
|
45877
46068
|
options: extension.options,
|
|
@@ -45879,7 +46070,11 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
45879
46070
|
editor,
|
|
45880
46071
|
type: getNodeType(extension.name, this.schema)
|
|
45881
46072
|
};
|
|
45882
|
-
const addNodeView = getExtensionField(
|
|
46073
|
+
const addNodeView = getExtensionField(
|
|
46074
|
+
extension,
|
|
46075
|
+
"addNodeView",
|
|
46076
|
+
context
|
|
46077
|
+
);
|
|
45883
46078
|
if (!addNodeView) {
|
|
45884
46079
|
return [];
|
|
45885
46080
|
}
|
|
@@ -45973,7 +46168,9 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
45973
46168
|
const { markExtensions } = splitExtensions(this.extensions);
|
|
45974
46169
|
return Object.fromEntries(
|
|
45975
46170
|
markExtensions.filter((extension) => !!getExtensionField(extension, "addMarkView")).map((extension) => {
|
|
45976
|
-
const extensionAttributes = this.attributes.filter(
|
|
46171
|
+
const extensionAttributes = this.attributes.filter(
|
|
46172
|
+
(attribute) => attribute.type === extension.name
|
|
46173
|
+
);
|
|
45977
46174
|
const context = {
|
|
45978
46175
|
name: extension.name,
|
|
45979
46176
|
options: extension.options,
|
|
@@ -45981,7 +46178,11 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
45981
46178
|
editor,
|
|
45982
46179
|
type: getMarkType(extension.name, this.schema)
|
|
45983
46180
|
};
|
|
45984
|
-
const addMarkView = getExtensionField(
|
|
46181
|
+
const addMarkView = getExtensionField(
|
|
46182
|
+
extension,
|
|
46183
|
+
"addMarkView",
|
|
46184
|
+
context
|
|
46185
|
+
);
|
|
45985
46186
|
if (!addMarkView) {
|
|
45986
46187
|
return [];
|
|
45987
46188
|
}
|
|
@@ -46045,7 +46246,7 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
46045
46246
|
extensions.map((extension) => [extension.name, extension.storage])
|
|
46046
46247
|
);
|
|
46047
46248
|
extensions.forEach((extension) => {
|
|
46048
|
-
var _a;
|
|
46249
|
+
var _a, _b;
|
|
46049
46250
|
const context = {
|
|
46050
46251
|
name: extension.name,
|
|
46051
46252
|
options: extension.options,
|
|
@@ -46058,8 +46259,18 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
46058
46259
|
if (keepOnSplit) {
|
|
46059
46260
|
this.splittableMarks.push(extension.name);
|
|
46060
46261
|
}
|
|
46262
|
+
const clearable = (_b = callOrReturn(
|
|
46263
|
+
getExtensionField(extension, "clearable", context)
|
|
46264
|
+
)) != null ? _b : true;
|
|
46265
|
+
if (!clearable) {
|
|
46266
|
+
this.nonClearableMarks.push(extension.name);
|
|
46267
|
+
}
|
|
46061
46268
|
}
|
|
46062
|
-
const onBeforeCreate = getExtensionField(
|
|
46269
|
+
const onBeforeCreate = getExtensionField(
|
|
46270
|
+
extension,
|
|
46271
|
+
"onBeforeCreate",
|
|
46272
|
+
context
|
|
46273
|
+
);
|
|
46063
46274
|
const onCreate = getExtensionField(extension, "onCreate", context);
|
|
46064
46275
|
const onUpdate = getExtensionField(extension, "onUpdate", context);
|
|
46065
46276
|
const onSelectionUpdate = getExtensionField(
|
|
@@ -46067,7 +46278,11 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
46067
46278
|
"onSelectionUpdate",
|
|
46068
46279
|
context
|
|
46069
46280
|
);
|
|
46070
|
-
const onTransaction = getExtensionField(
|
|
46281
|
+
const onTransaction = getExtensionField(
|
|
46282
|
+
extension,
|
|
46283
|
+
"onTransaction",
|
|
46284
|
+
context
|
|
46285
|
+
);
|
|
46071
46286
|
const onFocus = getExtensionField(extension, "onFocus", context);
|
|
46072
46287
|
const onBlur = getExtensionField(extension, "onBlur", context);
|
|
46073
46288
|
const onDestroy = getExtensionField(extension, "onDestroy", context);
|
|
@@ -46158,15 +46373,16 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
46158
46373
|
const { editor } = this;
|
|
46159
46374
|
const { state, schema } = editor;
|
|
46160
46375
|
const { doc, selection } = state;
|
|
46161
|
-
const { ranges } = selection;
|
|
46162
|
-
const from = Math.min(...ranges.map((range2) => range2.$from.pos));
|
|
46163
|
-
const to = Math.max(...ranges.map((range2) => range2.$to.pos));
|
|
46164
46376
|
const textSerializers = getTextSerializersFromSchema(schema);
|
|
46165
|
-
const
|
|
46166
|
-
|
|
46167
|
-
...
|
|
46377
|
+
const { blockSeparator } = this.options;
|
|
46378
|
+
const options = {
|
|
46379
|
+
...blockSeparator !== void 0 ? { blockSeparator } : {},
|
|
46168
46380
|
textSerializers
|
|
46169
|
-
}
|
|
46381
|
+
};
|
|
46382
|
+
const sortedRanges = [...selection.ranges].sort((a, b) => a.$from.pos - b.$from.pos);
|
|
46383
|
+
return sortedRanges.map(
|
|
46384
|
+
({ $from, $to }) => getTextBetween(doc, { from: $from.pos, to: $to.pos }, options)
|
|
46385
|
+
).join(blockSeparator != null ? blockSeparator : "\n\n");
|
|
46170
46386
|
}
|
|
46171
46387
|
}
|
|
46172
46388
|
})
|
|
@@ -46192,28 +46408,35 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
46192
46408
|
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$")) {
|
|
46193
46409
|
return;
|
|
46194
46410
|
}
|
|
46195
|
-
const nextTransaction = combineTransactionSteps(transaction.before, [
|
|
46411
|
+
const nextTransaction = combineTransactionSteps(transaction.before, [
|
|
46412
|
+
transaction,
|
|
46413
|
+
...appendedTransactions
|
|
46414
|
+
]);
|
|
46196
46415
|
const changes = getChangedRanges(nextTransaction);
|
|
46197
46416
|
changes.forEach((change) => {
|
|
46198
46417
|
if (nextTransaction.mapping.mapResult(change.oldRange.from).deletedAfter && nextTransaction.mapping.mapResult(change.oldRange.to).deletedBefore) {
|
|
46199
|
-
nextTransaction.before.nodesBetween(
|
|
46200
|
-
|
|
46201
|
-
|
|
46202
|
-
|
|
46203
|
-
|
|
46204
|
-
|
|
46205
|
-
|
|
46206
|
-
|
|
46207
|
-
|
|
46208
|
-
|
|
46209
|
-
|
|
46210
|
-
|
|
46211
|
-
|
|
46212
|
-
|
|
46213
|
-
|
|
46214
|
-
|
|
46215
|
-
|
|
46216
|
-
|
|
46418
|
+
nextTransaction.before.nodesBetween(
|
|
46419
|
+
change.oldRange.from,
|
|
46420
|
+
change.oldRange.to,
|
|
46421
|
+
(node, from) => {
|
|
46422
|
+
const to = from + node.nodeSize - 2;
|
|
46423
|
+
const isFullyWithinRange = change.oldRange.from <= from && to <= change.oldRange.to;
|
|
46424
|
+
this.editor.emit("delete", {
|
|
46425
|
+
type: "node",
|
|
46426
|
+
node,
|
|
46427
|
+
from,
|
|
46428
|
+
to,
|
|
46429
|
+
newFrom: nextTransaction.mapping.map(from),
|
|
46430
|
+
newTo: nextTransaction.mapping.map(to),
|
|
46431
|
+
deletedRange: change.oldRange,
|
|
46432
|
+
newRange: change.newRange,
|
|
46433
|
+
partial: !isFullyWithinRange,
|
|
46434
|
+
editor: this.editor,
|
|
46435
|
+
transaction,
|
|
46436
|
+
combinedTransform: nextTransaction
|
|
46437
|
+
});
|
|
46438
|
+
}
|
|
46439
|
+
);
|
|
46217
46440
|
}
|
|
46218
46441
|
});
|
|
46219
46442
|
const mapping = nextTransaction.mapping;
|
|
@@ -46393,7 +46616,9 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
46393
46616
|
return;
|
|
46394
46617
|
}
|
|
46395
46618
|
const docChanges = transactions.some((transaction) => transaction.docChanged) && !oldState.doc.eq(newState.doc);
|
|
46396
|
-
const ignoreTr = transactions.some(
|
|
46619
|
+
const ignoreTr = transactions.some(
|
|
46620
|
+
(transaction) => transaction.getMeta("preventClearDocument")
|
|
46621
|
+
);
|
|
46397
46622
|
if (!docChanges || ignoreTr) {
|
|
46398
46623
|
return;
|
|
46399
46624
|
}
|
|
@@ -46562,7 +46787,9 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
46562
46787
|
let to = this.to;
|
|
46563
46788
|
if (this.isBlock) {
|
|
46564
46789
|
if (this.content.size === 0) {
|
|
46565
|
-
console.error(
|
|
46790
|
+
console.error(
|
|
46791
|
+
`You can\u2019t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`
|
|
46792
|
+
);
|
|
46566
46793
|
return;
|
|
46567
46794
|
}
|
|
46568
46795
|
from = this.from + 1;
|
|
@@ -46633,7 +46860,12 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
46633
46860
|
if (!isBlock && !isInline && $pos.depth <= this.depth) {
|
|
46634
46861
|
return;
|
|
46635
46862
|
}
|
|
46636
|
-
const childNodePos = new _NodePos(
|
|
46863
|
+
const childNodePos = new _NodePos(
|
|
46864
|
+
$pos,
|
|
46865
|
+
this.editor,
|
|
46866
|
+
isBlock,
|
|
46867
|
+
isBlock || isInline ? node : null
|
|
46868
|
+
);
|
|
46637
46869
|
if (isBlock) {
|
|
46638
46870
|
childNodePos.actualDepth = this.depth + 1;
|
|
46639
46871
|
}
|
|
@@ -46684,7 +46916,9 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
46684
46916
|
return;
|
|
46685
46917
|
}
|
|
46686
46918
|
if (childPos.node.type.name === selector) {
|
|
46687
|
-
const doesAllAttributesMatch = attrKeys.every(
|
|
46919
|
+
const doesAllAttributesMatch = attrKeys.every(
|
|
46920
|
+
(key) => attributes[key] === childPos.node.attrs[key]
|
|
46921
|
+
);
|
|
46688
46922
|
if (doesAllAttributesMatch) {
|
|
46689
46923
|
nodes.push(childPos);
|
|
46690
46924
|
}
|
|
@@ -46781,7 +47015,7 @@ img.ProseMirror-separator {
|
|
|
46781
47015
|
|
|
46782
47016
|
// src/utilities/createStyleTag.ts
|
|
46783
47017
|
function createStyleTag(style2, nonce, suffix) {
|
|
46784
|
-
const tiptapStyleTag = document.querySelector(`style[data-tiptap-style${""}]`);
|
|
47018
|
+
const tiptapStyleTag = document.querySelector(`style[data-tiptap-style${suffix ? `-${suffix}` : ""}]`);
|
|
46785
47019
|
if (tiptapStyleTag !== null) {
|
|
46786
47020
|
return tiptapStyleTag;
|
|
46787
47021
|
}
|
|
@@ -46789,7 +47023,7 @@ img.ProseMirror-separator {
|
|
|
46789
47023
|
if (nonce) {
|
|
46790
47024
|
styleNode.setAttribute("nonce", nonce);
|
|
46791
47025
|
}
|
|
46792
|
-
styleNode.setAttribute(`data-tiptap-style${""}`, "");
|
|
47026
|
+
styleNode.setAttribute(`data-tiptap-style${suffix ? `-${suffix}` : ""}`, "");
|
|
46793
47027
|
styleNode.innerHTML = style2;
|
|
46794
47028
|
document.getElementsByTagName("head")[0].appendChild(styleNode);
|
|
46795
47029
|
return styleNode;
|
|
@@ -47148,7 +47382,9 @@ img.ProseMirror-separator {
|
|
|
47148
47382
|
errorOnInvalidContent: this.options.enableContentCheck
|
|
47149
47383
|
});
|
|
47150
47384
|
} catch (e) {
|
|
47151
|
-
if (!(e instanceof Error) || !["[tiptap error]: Invalid JSON content", "[tiptap error]: Invalid HTML content"].includes(
|
|
47385
|
+
if (!(e instanceof Error) || !["[tiptap error]: Invalid JSON content", "[tiptap error]: Invalid HTML content"].includes(
|
|
47386
|
+
e.message
|
|
47387
|
+
)) {
|
|
47152
47388
|
throw e;
|
|
47153
47389
|
}
|
|
47154
47390
|
this.emit("contentError", {
|
|
@@ -47158,7 +47394,9 @@ img.ProseMirror-separator {
|
|
|
47158
47394
|
if ("collaboration" in this.storage && typeof this.storage.collaboration === "object" && this.storage.collaboration) {
|
|
47159
47395
|
this.storage.collaboration.isDisabled = true;
|
|
47160
47396
|
}
|
|
47161
|
-
this.options.extensions = this.options.extensions.filter(
|
|
47397
|
+
this.options.extensions = this.options.extensions.filter(
|
|
47398
|
+
(extension) => extension.name !== "collaboration"
|
|
47399
|
+
);
|
|
47162
47400
|
this.createExtensionManager();
|
|
47163
47401
|
}
|
|
47164
47402
|
});
|
|
@@ -47276,7 +47514,7 @@ img.ProseMirror-separator {
|
|
|
47276
47514
|
this.emit("focus", {
|
|
47277
47515
|
editor: this,
|
|
47278
47516
|
event: focus2.event,
|
|
47279
|
-
//
|
|
47517
|
+
// oxlint-disable-next-lineno-non-null-assertion
|
|
47280
47518
|
transaction: mostRecentFocusTr
|
|
47281
47519
|
});
|
|
47282
47520
|
}
|
|
@@ -47284,7 +47522,7 @@ img.ProseMirror-separator {
|
|
|
47284
47522
|
this.emit("blur", {
|
|
47285
47523
|
editor: this,
|
|
47286
47524
|
event: blur2.event,
|
|
47287
|
-
//
|
|
47525
|
+
// oxlint-disable-next-lineno-non-null-assertion
|
|
47288
47526
|
transaction: mostRecentFocusTr
|
|
47289
47527
|
});
|
|
47290
47528
|
}
|
|
@@ -47802,7 +48040,9 @@ ${renderedContent}
|
|
|
47802
48040
|
return index !== void 0 ? index : -1;
|
|
47803
48041
|
},
|
|
47804
48042
|
tokenize(src, _tokens, _lexer) {
|
|
47805
|
-
const tokenPattern = selfClosing ? new RegExp(`^\\[${escapedShortcode}\\s*([^\\]]*)\\]`) : new RegExp(
|
|
48043
|
+
const tokenPattern = selfClosing ? new RegExp(`^\\[${escapedShortcode}\\s*([^\\]]*)\\]`) : new RegExp(
|
|
48044
|
+
`^\\[${escapedShortcode}\\s*([^\\]]*)\\]([\\s\\S]*?)\\[\\/${escapedShortcode}\\]`
|
|
48045
|
+
);
|
|
47806
48046
|
const match = src.match(tokenPattern);
|
|
47807
48047
|
if (!match) {
|
|
47808
48048
|
return void 0;
|
|
@@ -48098,7 +48338,9 @@ ${indentedChild}`;
|
|
|
48098
48338
|
const marks = storedMarks || selection.$to.parentOffset && selection.$from.marks();
|
|
48099
48339
|
return chain().insertContent({ type: this.name }).command(({ tr, dispatch }) => {
|
|
48100
48340
|
if (dispatch && marks && keepMarks) {
|
|
48101
|
-
const filteredMarks = marks.filter(
|
|
48341
|
+
const filteredMarks = marks.filter(
|
|
48342
|
+
(mark) => splittableMarks.includes(mark.type.name)
|
|
48343
|
+
);
|
|
48102
48344
|
tr.ensureMarks(filteredMarks);
|
|
48103
48345
|
}
|
|
48104
48346
|
return true;
|
|
@@ -58869,7 +59111,9 @@ ${indentedChild}`;
|
|
|
58869
59111
|
}
|
|
58870
59112
|
const { children, ...rest } = attributes != null ? attributes : {};
|
|
58871
59113
|
if (tag === "svg") {
|
|
58872
|
-
throw new Error(
|
|
59114
|
+
throw new Error(
|
|
59115
|
+
"SVG elements are not supported in the JSX syntax, use the array syntax instead"
|
|
59116
|
+
);
|
|
58873
59117
|
}
|
|
58874
59118
|
return [tag, rest, children];
|
|
58875
59119
|
};
|
|
@@ -60840,7 +61084,9 @@ ${indentedChild}`;
|
|
|
60840
61084
|
key: new PluginKey("autolink"),
|
|
60841
61085
|
appendTransaction: (transactions, oldState, newState) => {
|
|
60842
61086
|
const docChanges = transactions.some((transaction) => transaction.docChanged) && !oldState.doc.eq(newState.doc);
|
|
60843
|
-
const preventAutolink = transactions.some(
|
|
61087
|
+
const preventAutolink = transactions.some(
|
|
61088
|
+
(transaction) => transaction.getMeta("preventAutolink")
|
|
61089
|
+
);
|
|
60844
61090
|
if (!docChanges || preventAutolink) {
|
|
60845
61091
|
return;
|
|
60846
61092
|
}
|
|
@@ -60848,7 +61094,11 @@ ${indentedChild}`;
|
|
|
60848
61094
|
const transform = combineTransactionSteps(oldState.doc, [...transactions]);
|
|
60849
61095
|
const changes = getChangedRanges(transform);
|
|
60850
61096
|
changes.forEach(({ newRange }) => {
|
|
60851
|
-
const nodesInChangedRanges = findChildrenInRange(
|
|
61097
|
+
const nodesInChangedRanges = findChildrenInRange(
|
|
61098
|
+
newState.doc,
|
|
61099
|
+
newRange,
|
|
61100
|
+
(node) => node.isTextblock
|
|
61101
|
+
);
|
|
60852
61102
|
let textBlock;
|
|
60853
61103
|
let textBeforeWhitespace;
|
|
60854
61104
|
if (nodesInChangedRanges.length > 1) {
|
|
@@ -60865,7 +61115,12 @@ ${indentedChild}`;
|
|
|
60865
61115
|
return;
|
|
60866
61116
|
}
|
|
60867
61117
|
textBlock = nodesInChangedRanges[0];
|
|
60868
|
-
textBeforeWhitespace = newState.doc.textBetween(
|
|
61118
|
+
textBeforeWhitespace = newState.doc.textBetween(
|
|
61119
|
+
textBlock.pos,
|
|
61120
|
+
newRange.to,
|
|
61121
|
+
void 0,
|
|
61122
|
+
" "
|
|
61123
|
+
);
|
|
60869
61124
|
}
|
|
60870
61125
|
if (textBlock && textBeforeWhitespace) {
|
|
60871
61126
|
const wordsBeforeWhitespace = textBeforeWhitespace.split(UNICODE_WHITESPACE_REGEX).filter(Boolean);
|
|
@@ -60877,7 +61132,9 @@ ${indentedChild}`;
|
|
|
60877
61132
|
if (!lastWordBeforeSpace) {
|
|
60878
61133
|
return false;
|
|
60879
61134
|
}
|
|
60880
|
-
const linksBeforeSpace = tokenize(lastWordBeforeSpace).map(
|
|
61135
|
+
const linksBeforeSpace = tokenize(lastWordBeforeSpace).map(
|
|
61136
|
+
(t) => t.toObject(options.defaultProtocol)
|
|
61137
|
+
);
|
|
60881
61138
|
if (!isValidLinkStructure(linksBeforeSpace)) {
|
|
60882
61139
|
return false;
|
|
60883
61140
|
}
|
|
@@ -60891,7 +61148,9 @@ ${indentedChild}`;
|
|
|
60891
61148
|
}
|
|
60892
61149
|
return !newState.doc.rangeHasMark(link.from, link.to, newState.schema.marks.code);
|
|
60893
61150
|
}).filter((link) => options.validate(link.value)).filter((link) => options.shouldAutoLink(link.value)).forEach((link) => {
|
|
60894
|
-
if (getMarksBetween(link.from, link.to, newState.doc).some(
|
|
61151
|
+
if (getMarksBetween(link.from, link.to, newState.doc).some(
|
|
61152
|
+
(item) => item.mark.type === options.type
|
|
61153
|
+
)) {
|
|
60895
61154
|
return;
|
|
60896
61155
|
}
|
|
60897
61156
|
tr.addMark(
|
|
@@ -60989,7 +61248,18 @@ ${indentedChild}`;
|
|
|
60989
61248
|
});
|
|
60990
61249
|
}
|
|
60991
61250
|
function isAllowedUri(uri, protocols) {
|
|
60992
|
-
const allowedProtocols = [
|
|
61251
|
+
const allowedProtocols = [
|
|
61252
|
+
"http",
|
|
61253
|
+
"https",
|
|
61254
|
+
"ftp",
|
|
61255
|
+
"ftps",
|
|
61256
|
+
"mailto",
|
|
61257
|
+
"tel",
|
|
61258
|
+
"callto",
|
|
61259
|
+
"sms",
|
|
61260
|
+
"cid",
|
|
61261
|
+
"xmpp"
|
|
61262
|
+
];
|
|
60993
61263
|
if (protocols) {
|
|
60994
61264
|
protocols.forEach((protocol) => {
|
|
60995
61265
|
const nextProtocol = typeof protocol === "string" ? protocol : protocol.scheme;
|
|
@@ -61000,7 +61270,7 @@ ${indentedChild}`;
|
|
|
61000
61270
|
}
|
|
61001
61271
|
return !uri || uri.replace(UNICODE_WHITESPACE_REGEX_GLOBAL, "").match(
|
|
61002
61272
|
new RegExp(
|
|
61003
|
-
//
|
|
61273
|
+
// oxlint-disable-next-line no-useless-escape
|
|
61004
61274
|
`^(?:(?:${allowedProtocols.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,
|
|
61005
61275
|
"i"
|
|
61006
61276
|
)
|
|
@@ -61014,7 +61284,9 @@ ${indentedChild}`;
|
|
|
61014
61284
|
onCreate() {
|
|
61015
61285
|
if (this.options.validate && !this.options.shouldAutoLink) {
|
|
61016
61286
|
this.options.shouldAutoLink = this.options.validate;
|
|
61017
|
-
console.warn(
|
|
61287
|
+
console.warn(
|
|
61288
|
+
"The `validate` option is deprecated. Rename to the `shouldAutoLink` option instead."
|
|
61289
|
+
);
|
|
61018
61290
|
}
|
|
61019
61291
|
this.options.protocols.forEach((protocol) => {
|
|
61020
61292
|
if (typeof protocol === "string") {
|
|
@@ -61321,6 +61593,109 @@ ${indentedChild}`;
|
|
|
61321
61593
|
return [inputRule];
|
|
61322
61594
|
}
|
|
61323
61595
|
});
|
|
61596
|
+
|
|
61597
|
+
// src/helpers/getBranchingNestedListAtCursor.ts
|
|
61598
|
+
var getBranchingNestedListAtCursor = (state, itemName, wrapperNames) => {
|
|
61599
|
+
const { selection } = state;
|
|
61600
|
+
if (!selection.empty) {
|
|
61601
|
+
return null;
|
|
61602
|
+
}
|
|
61603
|
+
const { $from } = selection;
|
|
61604
|
+
if (!$from.parent.isTextblock) {
|
|
61605
|
+
return null;
|
|
61606
|
+
}
|
|
61607
|
+
if ($from.parentOffset !== $from.parent.content.size) {
|
|
61608
|
+
return null;
|
|
61609
|
+
}
|
|
61610
|
+
let listItemDepth = -1;
|
|
61611
|
+
for (let depth = $from.depth; depth > 0; depth -= 1) {
|
|
61612
|
+
if ($from.node(depth).type.name === itemName) {
|
|
61613
|
+
listItemDepth = depth;
|
|
61614
|
+
break;
|
|
61615
|
+
}
|
|
61616
|
+
}
|
|
61617
|
+
if (listItemDepth < 0) {
|
|
61618
|
+
return null;
|
|
61619
|
+
}
|
|
61620
|
+
const listItem = $from.node(listItemDepth);
|
|
61621
|
+
const indexInListItem = $from.index(listItemDepth);
|
|
61622
|
+
if (indexInListItem + 1 >= listItem.childCount) {
|
|
61623
|
+
return null;
|
|
61624
|
+
}
|
|
61625
|
+
const nextChild = listItem.child(indexInListItem + 1);
|
|
61626
|
+
if (!wrapperNames.includes(nextChild.type.name)) {
|
|
61627
|
+
return null;
|
|
61628
|
+
}
|
|
61629
|
+
const itemType = state.schema.nodes[itemName];
|
|
61630
|
+
let hasBranching = false;
|
|
61631
|
+
nextChild.forEach((child) => {
|
|
61632
|
+
if (child.type === itemType && child.childCount > 1) {
|
|
61633
|
+
hasBranching = true;
|
|
61634
|
+
}
|
|
61635
|
+
});
|
|
61636
|
+
if (!hasBranching) {
|
|
61637
|
+
return null;
|
|
61638
|
+
}
|
|
61639
|
+
const nodeAfter = state.doc.resolve($from.after()).nodeAfter;
|
|
61640
|
+
if (!nodeAfter || !wrapperNames.includes(nodeAfter.type.name)) {
|
|
61641
|
+
return null;
|
|
61642
|
+
}
|
|
61643
|
+
const items = [];
|
|
61644
|
+
nodeAfter.forEach((child) => {
|
|
61645
|
+
items.push(child);
|
|
61646
|
+
});
|
|
61647
|
+
if (items.length === 0) {
|
|
61648
|
+
return null;
|
|
61649
|
+
}
|
|
61650
|
+
return {
|
|
61651
|
+
listItemDepth,
|
|
61652
|
+
nestedList: nodeAfter,
|
|
61653
|
+
nestedListPos: $from.after(),
|
|
61654
|
+
insertPos: $from.after(listItemDepth),
|
|
61655
|
+
items
|
|
61656
|
+
};
|
|
61657
|
+
};
|
|
61658
|
+
|
|
61659
|
+
// src/helpers/hoistBranchingNestedList.ts
|
|
61660
|
+
var hoistBranchingNestedList = (state, dispatch, itemName, wrapperNames) => {
|
|
61661
|
+
const context = getBranchingNestedListAtCursor(state, itemName, wrapperNames);
|
|
61662
|
+
if (!context) {
|
|
61663
|
+
return false;
|
|
61664
|
+
}
|
|
61665
|
+
const { selection } = state;
|
|
61666
|
+
const { nestedList, nestedListPos, insertPos, items } = context;
|
|
61667
|
+
const tr = state.tr;
|
|
61668
|
+
tr.delete(nestedListPos, nestedListPos + nestedList.nodeSize);
|
|
61669
|
+
const mappedInsertPos = tr.mapping.map(insertPos);
|
|
61670
|
+
tr.insert(mappedInsertPos, Fragment.from(items));
|
|
61671
|
+
tr.setSelection(selection.map(tr.doc, tr.mapping));
|
|
61672
|
+
if (dispatch) {
|
|
61673
|
+
dispatch(tr);
|
|
61674
|
+
}
|
|
61675
|
+
return true;
|
|
61676
|
+
};
|
|
61677
|
+
|
|
61678
|
+
// src/helpers/handleDeleteBranchingNestedList.ts
|
|
61679
|
+
var handleDeleteBranchingNestedList = (editor, itemName, wrapperNames) => {
|
|
61680
|
+
return hoistBranchingNestedList(editor.state, editor.view.dispatch, itemName, wrapperNames);
|
|
61681
|
+
};
|
|
61682
|
+
|
|
61683
|
+
// src/helpers/createBranchingListDeleteKeymap.ts
|
|
61684
|
+
var createBranchingListDeleteKeymap = (itemName, wrapperNames) => {
|
|
61685
|
+
return Extension.create({
|
|
61686
|
+
name: `${itemName}BranchingDeleteKeymap`,
|
|
61687
|
+
priority: 101,
|
|
61688
|
+
addKeyboardShortcuts() {
|
|
61689
|
+
const handleDelete2 = () => handleDeleteBranchingNestedList(this.editor, itemName, wrapperNames);
|
|
61690
|
+
return {
|
|
61691
|
+
Delete: handleDelete2,
|
|
61692
|
+
"Mod-Delete": handleDelete2
|
|
61693
|
+
};
|
|
61694
|
+
}
|
|
61695
|
+
});
|
|
61696
|
+
};
|
|
61697
|
+
|
|
61698
|
+
// src/item/list-item.ts
|
|
61324
61699
|
function isSameLineOrderedListToken(token) {
|
|
61325
61700
|
var _a, _b;
|
|
61326
61701
|
const nestedToken = (_a = token.tokens) == null ? void 0 : _a[0];
|
|
@@ -61435,6 +61810,14 @@ ${indentedChild}`;
|
|
|
61435
61810
|
ctx
|
|
61436
61811
|
);
|
|
61437
61812
|
},
|
|
61813
|
+
addExtensions() {
|
|
61814
|
+
return [
|
|
61815
|
+
createBranchingListDeleteKeymap(this.name, [
|
|
61816
|
+
this.options.bulletListTypeName,
|
|
61817
|
+
this.options.orderedListTypeName
|
|
61818
|
+
])
|
|
61819
|
+
];
|
|
61820
|
+
},
|
|
61438
61821
|
addKeyboardShortcuts() {
|
|
61439
61822
|
return {
|
|
61440
61823
|
Enter: () => this.editor.commands.splitListItem(this.name),
|
|
@@ -61499,33 +61882,6 @@ ${indentedChild}`;
|
|
|
61499
61882
|
return true;
|
|
61500
61883
|
};
|
|
61501
61884
|
|
|
61502
|
-
// src/keymap/listHelpers/hasListItemBefore.ts
|
|
61503
|
-
var hasListItemBefore = (typeOrName, state) => {
|
|
61504
|
-
var _a;
|
|
61505
|
-
const { $anchor } = state.selection;
|
|
61506
|
-
const $targetPos = state.doc.resolve($anchor.pos - 2);
|
|
61507
|
-
if ($targetPos.index() === 0) {
|
|
61508
|
-
return false;
|
|
61509
|
-
}
|
|
61510
|
-
if (((_a = $targetPos.nodeBefore) == null ? void 0 : _a.type.name) !== typeOrName) {
|
|
61511
|
-
return false;
|
|
61512
|
-
}
|
|
61513
|
-
return true;
|
|
61514
|
-
};
|
|
61515
|
-
var listItemHasSubList = (typeOrName, state, node) => {
|
|
61516
|
-
if (!node) {
|
|
61517
|
-
return false;
|
|
61518
|
-
}
|
|
61519
|
-
const nodeType = getNodeType(typeOrName, state.schema);
|
|
61520
|
-
let hasSubList = false;
|
|
61521
|
-
node.descendants((child) => {
|
|
61522
|
-
if (child.type === nodeType) {
|
|
61523
|
-
hasSubList = true;
|
|
61524
|
-
}
|
|
61525
|
-
});
|
|
61526
|
-
return hasSubList;
|
|
61527
|
-
};
|
|
61528
|
-
|
|
61529
61885
|
// src/keymap/listHelpers/handleBackspace.ts
|
|
61530
61886
|
var handleBackspace = (editor, name, parentListTypes) => {
|
|
61531
61887
|
if (editor.commands.undoInputRule()) {
|
|
@@ -61556,16 +61912,6 @@ ${indentedChild}`;
|
|
|
61556
61912
|
if (!isAtStartOfNode(editor.state)) {
|
|
61557
61913
|
return false;
|
|
61558
61914
|
}
|
|
61559
|
-
const listItemPos = findListItemPos(name, editor.state);
|
|
61560
|
-
if (!listItemPos) {
|
|
61561
|
-
return false;
|
|
61562
|
-
}
|
|
61563
|
-
const $prev = editor.state.doc.resolve(listItemPos.$pos.pos - 2);
|
|
61564
|
-
const prevNode = $prev.node(listItemPos.depth);
|
|
61565
|
-
const previousListItemHasSubList = listItemHasSubList(name, editor.state, prevNode);
|
|
61566
|
-
if (hasListItemBefore(name, editor.state) && !previousListItemHasSubList) {
|
|
61567
|
-
return editor.commands.joinItemBackward();
|
|
61568
|
-
}
|
|
61569
61915
|
return editor.chain().liftListItem(name).run();
|
|
61570
61916
|
};
|
|
61571
61917
|
|
|
@@ -61631,6 +61977,33 @@ ${indentedChild}`;
|
|
|
61631
61977
|
return true;
|
|
61632
61978
|
};
|
|
61633
61979
|
|
|
61980
|
+
// src/keymap/listHelpers/hasListItemBefore.ts
|
|
61981
|
+
var hasListItemBefore = (typeOrName, state) => {
|
|
61982
|
+
var _a;
|
|
61983
|
+
const { $anchor } = state.selection;
|
|
61984
|
+
const $targetPos = state.doc.resolve($anchor.pos - 2);
|
|
61985
|
+
if ($targetPos.index() === 0) {
|
|
61986
|
+
return false;
|
|
61987
|
+
}
|
|
61988
|
+
if (((_a = $targetPos.nodeBefore) == null ? void 0 : _a.type.name) !== typeOrName) {
|
|
61989
|
+
return false;
|
|
61990
|
+
}
|
|
61991
|
+
return true;
|
|
61992
|
+
};
|
|
61993
|
+
var listItemHasSubList = (typeOrName, state, node) => {
|
|
61994
|
+
if (!node) {
|
|
61995
|
+
return false;
|
|
61996
|
+
}
|
|
61997
|
+
const nodeType = getNodeType(typeOrName, state.schema);
|
|
61998
|
+
let hasSubList = false;
|
|
61999
|
+
node.descendants((child) => {
|
|
62000
|
+
if (child.type === nodeType) {
|
|
62001
|
+
hasSubList = true;
|
|
62002
|
+
}
|
|
62003
|
+
});
|
|
62004
|
+
return hasSubList;
|
|
62005
|
+
};
|
|
62006
|
+
|
|
61634
62007
|
// src/keymap/list-keymap.ts
|
|
61635
62008
|
var ListKeymap = Extension.create({
|
|
61636
62009
|
name: "listKeymap",
|
|
@@ -61707,7 +62080,14 @@ ${indentedChild}`;
|
|
|
61707
62080
|
var INDENTED_LINE_REGEX = /^\s/;
|
|
61708
62081
|
function isBlockContentLine(line) {
|
|
61709
62082
|
const trimmedLine = line.trimStart();
|
|
61710
|
-
return
|
|
62083
|
+
return (
|
|
62084
|
+
// oxlint-disable-next-line prefer-string-starts-ends-with
|
|
62085
|
+
/^[-+*]\s+/.test(trimmedLine) || // oxlint-disable-next-line prefer-string-starts-ends-with
|
|
62086
|
+
/^\d+\.\s+/.test(trimmedLine) || // oxlint-disable-next-line prefer-string-starts-ends-with
|
|
62087
|
+
/^>\s?/.test(trimmedLine) || // oxlint-disable-next-line prefer-string-starts-ends-with
|
|
62088
|
+
/^```/.test(trimmedLine) || // oxlint-disable-next-line prefer-string-starts-ends-with
|
|
62089
|
+
/^~~~/.test(trimmedLine)
|
|
62090
|
+
);
|
|
61711
62091
|
}
|
|
61712
62092
|
function splitItemContent(contentLines) {
|
|
61713
62093
|
const paragraphLines = [];
|
|
@@ -62083,6 +62463,12 @@ ${indentedChild}`;
|
|
|
62083
62463
|
const prefix = `- [${checkedChar}] `;
|
|
62084
62464
|
return renderNestedMarkdownContent(node, h, prefix);
|
|
62085
62465
|
},
|
|
62466
|
+
addExtensions() {
|
|
62467
|
+
if (!this.options.nested) {
|
|
62468
|
+
return [];
|
|
62469
|
+
}
|
|
62470
|
+
return [createBranchingListDeleteKeymap(this.name, [this.options.taskListTypeName])];
|
|
62471
|
+
},
|
|
62086
62472
|
addKeyboardShortcuts() {
|
|
62087
62473
|
const shortcuts = {
|
|
62088
62474
|
Enter: () => this.editor.commands.splitListItem(this.name),
|
|
@@ -62221,7 +62607,11 @@ ${indentedChild}`;
|
|
|
62221
62607
|
];
|
|
62222
62608
|
},
|
|
62223
62609
|
renderHTML({ HTMLAttributes }) {
|
|
62224
|
-
return [
|
|
62610
|
+
return [
|
|
62611
|
+
"ul",
|
|
62612
|
+
mergeAttributes(this.options.HTMLAttributes, HTMLAttributes, { "data-type": this.name }),
|
|
62613
|
+
0
|
|
62614
|
+
];
|
|
62225
62615
|
},
|
|
62226
62616
|
parseMarkdown: (token, h) => {
|
|
62227
62617
|
return h.createNode("taskList", {}, h.parseChildren(token.items || []));
|
|
@@ -62358,7 +62748,14 @@ ${indentedChild}`;
|
|
|
62358
62748
|
// src/suggestion.ts
|
|
62359
62749
|
function findSuggestionMatch(config) {
|
|
62360
62750
|
var _a;
|
|
62361
|
-
const {
|
|
62751
|
+
const {
|
|
62752
|
+
char,
|
|
62753
|
+
allowSpaces: allowSpacesOption,
|
|
62754
|
+
allowToIncludeChar,
|
|
62755
|
+
allowedPrefixes,
|
|
62756
|
+
startOfLine,
|
|
62757
|
+
$position
|
|
62758
|
+
} = config;
|
|
62362
62759
|
const allowSpaces = allowSpacesOption && !allowToIncludeChar;
|
|
62363
62760
|
const escapedChar = escapeForRegEx(char);
|
|
62364
62761
|
const suffix = new RegExp(`\\s${escapedChar}$`);
|
|
@@ -62491,7 +62888,11 @@ ${indentedChild}`;
|
|
|
62491
62888
|
text: (state == null ? void 0 : state.text) || null,
|
|
62492
62889
|
items: [],
|
|
62493
62890
|
command: (commandProps) => {
|
|
62494
|
-
return command({
|
|
62891
|
+
return command({
|
|
62892
|
+
editor,
|
|
62893
|
+
range: (state == null ? void 0 : state.range) || { from: 0, to: 0 },
|
|
62894
|
+
props: commandProps
|
|
62895
|
+
});
|
|
62495
62896
|
},
|
|
62496
62897
|
decorationNode,
|
|
62497
62898
|
clientRect: clientRectFor(view, decorationNode)
|
|
@@ -62521,7 +62922,9 @@ ${indentedChild}`;
|
|
|
62521
62922
|
return;
|
|
62522
62923
|
}
|
|
62523
62924
|
const state = handleExit && !handleStart ? prev : next;
|
|
62524
|
-
const decorationNode = view.dom.querySelector(
|
|
62925
|
+
const decorationNode = view.dom.querySelector(
|
|
62926
|
+
`[data-decoration-id="${state.decorationId}"]`
|
|
62927
|
+
);
|
|
62525
62928
|
props = {
|
|
62526
62929
|
editor,
|
|
62527
62930
|
range: state.range,
|
|
@@ -62873,7 +63276,11 @@ ${indentedChild}`;
|
|
|
62873
63276
|
suggestion
|
|
62874
63277
|
});
|
|
62875
63278
|
if (typeof html === "string") {
|
|
62876
|
-
return [
|
|
63279
|
+
return [
|
|
63280
|
+
"span",
|
|
63281
|
+
mergeAttributes({ "data-type": this.name }, this.options.HTMLAttributes, HTMLAttributes),
|
|
63282
|
+
html
|
|
63283
|
+
];
|
|
62877
63284
|
}
|
|
62878
63285
|
return html;
|
|
62879
63286
|
},
|
|
@@ -64206,6 +64613,9 @@ ${indentedChild}`;
|
|
|
64206
64613
|
};
|
|
64207
64614
|
}
|
|
64208
64615
|
});
|
|
64616
|
+
var DEFAULT_DATA_ATTRIBUTE = "placeholder";
|
|
64617
|
+
var PLUGIN_KEY = new PluginKey("tiptap__placeholder");
|
|
64618
|
+
var VIEWPORT_OVERSCAN_PX = 200;
|
|
64209
64619
|
function createPlaceholderDecoration(options) {
|
|
64210
64620
|
const {
|
|
64211
64621
|
editor,
|
|
@@ -64232,6 +64642,96 @@ ${indentedChild}`;
|
|
|
64232
64642
|
});
|
|
64233
64643
|
}
|
|
64234
64644
|
|
|
64645
|
+
// src/placeholder/utils/buildPlaceholderDecorations.ts
|
|
64646
|
+
function resolveEmptyNodeClass(emptyNodeClass, props) {
|
|
64647
|
+
return typeof emptyNodeClass === "function" ? emptyNodeClass(props) : emptyNodeClass;
|
|
64648
|
+
}
|
|
64649
|
+
function buildPlaceholderDecorations({
|
|
64650
|
+
editor,
|
|
64651
|
+
options,
|
|
64652
|
+
dataAttribute,
|
|
64653
|
+
doc,
|
|
64654
|
+
selection
|
|
64655
|
+
}) {
|
|
64656
|
+
var _a, _b;
|
|
64657
|
+
const active = editor.isEditable || !options.showOnlyWhenEditable;
|
|
64658
|
+
if (!active) {
|
|
64659
|
+
return null;
|
|
64660
|
+
}
|
|
64661
|
+
const { anchor } = selection;
|
|
64662
|
+
const decorations = [];
|
|
64663
|
+
const isEmptyDoc = editor.isEmpty;
|
|
64664
|
+
const useResolvedPath = options.showOnlyCurrent && !options.includeChildren;
|
|
64665
|
+
if (useResolvedPath) {
|
|
64666
|
+
const resolved = doc.resolve(anchor);
|
|
64667
|
+
const node = resolved.depth > 0 ? resolved.node(1) : resolved.nodeAfter;
|
|
64668
|
+
const nodeStart = resolved.depth > 0 ? resolved.before(1) : anchor;
|
|
64669
|
+
if (node && node.type.isTextblock && isNodeEmpty(node)) {
|
|
64670
|
+
const hasAnchor = anchor >= nodeStart && anchor <= nodeStart + node.nodeSize;
|
|
64671
|
+
decorations.push(
|
|
64672
|
+
createPlaceholderDecoration({
|
|
64673
|
+
editor,
|
|
64674
|
+
isEmptyDoc,
|
|
64675
|
+
dataAttribute,
|
|
64676
|
+
hasAnchor,
|
|
64677
|
+
placeholder: options.placeholder,
|
|
64678
|
+
classes: {
|
|
64679
|
+
emptyEditor: options.emptyEditorClass,
|
|
64680
|
+
emptyNode: resolveEmptyNodeClass(options.emptyNodeClass, {
|
|
64681
|
+
editor,
|
|
64682
|
+
node,
|
|
64683
|
+
pos: nodeStart,
|
|
64684
|
+
hasAnchor
|
|
64685
|
+
})
|
|
64686
|
+
},
|
|
64687
|
+
node,
|
|
64688
|
+
pos: nodeStart
|
|
64689
|
+
})
|
|
64690
|
+
);
|
|
64691
|
+
}
|
|
64692
|
+
} else {
|
|
64693
|
+
const pluginState = PLUGIN_KEY.getState(editor.state);
|
|
64694
|
+
const from = (_a = pluginState == null ? void 0 : pluginState.topPos) != null ? _a : 0;
|
|
64695
|
+
const to = (_b = pluginState == null ? void 0 : pluginState.bottomPos) != null ? _b : doc.content.size;
|
|
64696
|
+
doc.nodesBetween(from, to, (node, pos) => {
|
|
64697
|
+
const hasAnchor = anchor >= pos && anchor <= pos + node.nodeSize;
|
|
64698
|
+
const isEmpty = !node.isLeaf && isNodeEmpty(node);
|
|
64699
|
+
if (!node.type.isTextblock) {
|
|
64700
|
+
return options.includeChildren;
|
|
64701
|
+
}
|
|
64702
|
+
if ((hasAnchor || !options.showOnlyCurrent) && isEmpty) {
|
|
64703
|
+
decorations.push(
|
|
64704
|
+
createPlaceholderDecoration({
|
|
64705
|
+
editor,
|
|
64706
|
+
isEmptyDoc,
|
|
64707
|
+
dataAttribute,
|
|
64708
|
+
hasAnchor,
|
|
64709
|
+
placeholder: options.placeholder,
|
|
64710
|
+
classes: {
|
|
64711
|
+
emptyEditor: options.emptyEditorClass,
|
|
64712
|
+
emptyNode: resolveEmptyNodeClass(options.emptyNodeClass, {
|
|
64713
|
+
editor,
|
|
64714
|
+
node,
|
|
64715
|
+
pos,
|
|
64716
|
+
hasAnchor
|
|
64717
|
+
})
|
|
64718
|
+
},
|
|
64719
|
+
node,
|
|
64720
|
+
pos
|
|
64721
|
+
})
|
|
64722
|
+
);
|
|
64723
|
+
}
|
|
64724
|
+
return options.includeChildren;
|
|
64725
|
+
});
|
|
64726
|
+
}
|
|
64727
|
+
return DecorationSet.create(doc, decorations);
|
|
64728
|
+
}
|
|
64729
|
+
|
|
64730
|
+
// src/placeholder/utils/preparePlaceholderAttribute.ts
|
|
64731
|
+
function preparePlaceholderAttribute(attr) {
|
|
64732
|
+
return attr.replace(/\s+/g, "-").replace(/[^a-zA-Z0-9-]/g, "").replace(/^[0-9-]+/, "").replace(/^-+/, "").toLowerCase();
|
|
64733
|
+
}
|
|
64734
|
+
|
|
64235
64735
|
// src/placeholder/utils/findScrollParent.ts
|
|
64236
64736
|
function isScrollable(el) {
|
|
64237
64737
|
const style = getComputedStyle(el);
|
|
@@ -64272,8 +64772,8 @@ ${indentedChild}`;
|
|
|
64272
64772
|
}) {
|
|
64273
64773
|
const editorRect = view.dom.getBoundingClientRect();
|
|
64274
64774
|
const containerRect = scrollContainer ? getContainerRect(scrollContainer) : { top: 0, bottom: window.innerHeight };
|
|
64275
|
-
const visibleTop = Math.max(editorRect.top, containerRect.top);
|
|
64276
|
-
const visibleBottom = Math.min(editorRect.bottom, containerRect.bottom);
|
|
64775
|
+
const visibleTop = Math.max(editorRect.top, containerRect.top) - VIEWPORT_OVERSCAN_PX;
|
|
64776
|
+
const visibleBottom = Math.min(editorRect.bottom, containerRect.bottom) + VIEWPORT_OVERSCAN_PX;
|
|
64277
64777
|
if (visibleTop >= visibleBottom) {
|
|
64278
64778
|
return { top: 0, bottom: doc.content.size };
|
|
64279
64779
|
}
|
|
@@ -64287,33 +64787,97 @@ ${indentedChild}`;
|
|
|
64287
64787
|
};
|
|
64288
64788
|
}
|
|
64289
64789
|
|
|
64290
|
-
// src/placeholder/utils/
|
|
64291
|
-
|
|
64292
|
-
|
|
64293
|
-
|
|
64294
|
-
|
|
64790
|
+
// src/placeholder/utils/viewportTracking.ts
|
|
64791
|
+
var viewportPluginState = {
|
|
64792
|
+
/**
|
|
64793
|
+
* Initialises the viewport state with no known positions.
|
|
64794
|
+
* @returns The initial viewport state.
|
|
64795
|
+
*/
|
|
64796
|
+
init() {
|
|
64797
|
+
return { topPos: null, bottomPos: null };
|
|
64798
|
+
},
|
|
64799
|
+
/**
|
|
64800
|
+
* Updates the viewport state from incoming transactions.
|
|
64801
|
+
* @param tr - The transaction being applied.
|
|
64802
|
+
* @param prev - The previous viewport state.
|
|
64803
|
+
* @returns The next viewport state.
|
|
64804
|
+
*/
|
|
64805
|
+
apply(tr, prev) {
|
|
64806
|
+
const meta = tr.getMeta(PLUGIN_KEY);
|
|
64807
|
+
if (meta == null ? void 0 : meta.positions) {
|
|
64808
|
+
return { topPos: meta.positions.top, bottomPos: meta.positions.bottom };
|
|
64809
|
+
}
|
|
64810
|
+
if (!tr.docChanged) {
|
|
64811
|
+
return prev;
|
|
64812
|
+
}
|
|
64813
|
+
return {
|
|
64814
|
+
topPos: prev.topPos !== null ? tr.mapping.map(prev.topPos) : null,
|
|
64815
|
+
bottomPos: prev.bottomPos !== null ? tr.mapping.map(prev.bottomPos) : null
|
|
64816
|
+
};
|
|
64817
|
+
}
|
|
64818
|
+
};
|
|
64819
|
+
function createViewportPluginView(view) {
|
|
64820
|
+
const scrollContainer = findScrollParent(view.dom);
|
|
64821
|
+
const computeAndDispatch = () => {
|
|
64822
|
+
const positions = getViewportBoundaryPositions({
|
|
64823
|
+
view,
|
|
64824
|
+
doc: view.state.doc,
|
|
64825
|
+
scrollContainer
|
|
64826
|
+
});
|
|
64827
|
+
const prev = PLUGIN_KEY.getState(view.state);
|
|
64828
|
+
if ((prev == null ? void 0 : prev.topPos) === positions.top && (prev == null ? void 0 : prev.bottomPos) === positions.bottom) {
|
|
64295
64829
|
return;
|
|
64296
64830
|
}
|
|
64297
|
-
|
|
64298
|
-
|
|
64299
|
-
|
|
64300
|
-
|
|
64301
|
-
|
|
64302
|
-
const
|
|
64303
|
-
|
|
64304
|
-
|
|
64305
|
-
|
|
64831
|
+
const tr = view.state.tr.setMeta(PLUGIN_KEY, { positions });
|
|
64832
|
+
view.dispatch(tr);
|
|
64833
|
+
};
|
|
64834
|
+
let frame = null;
|
|
64835
|
+
let lastCompute = 0;
|
|
64836
|
+
const MIN_SCROLL_INTERVAL = 150;
|
|
64837
|
+
const scheduleFrame = () => {
|
|
64838
|
+
if (frame !== null) return;
|
|
64839
|
+
frame = requestAnimationFrame(() => {
|
|
64840
|
+
frame = null;
|
|
64841
|
+
const now = performance.now();
|
|
64842
|
+
if (now - lastCompute >= MIN_SCROLL_INTERVAL) {
|
|
64843
|
+
lastCompute = now;
|
|
64844
|
+
computeAndDispatch();
|
|
64845
|
+
} else {
|
|
64846
|
+
scheduleFrame();
|
|
64847
|
+
}
|
|
64848
|
+
});
|
|
64849
|
+
};
|
|
64850
|
+
scrollContainer.addEventListener("scroll", scheduleFrame, { passive: true });
|
|
64851
|
+
computeAndDispatch();
|
|
64852
|
+
return {
|
|
64853
|
+
update(_view, prevState) {
|
|
64854
|
+
if (view.state.doc.content.size !== prevState.doc.content.size) {
|
|
64855
|
+
scheduleFrame();
|
|
64856
|
+
}
|
|
64857
|
+
},
|
|
64858
|
+
destroy: () => {
|
|
64859
|
+
if (frame !== null) {
|
|
64860
|
+
cancelAnimationFrame(frame);
|
|
64861
|
+
}
|
|
64862
|
+
scrollContainer.removeEventListener("scroll", scheduleFrame);
|
|
64306
64863
|
}
|
|
64307
64864
|
};
|
|
64308
|
-
return { call, cancel };
|
|
64309
64865
|
}
|
|
64310
64866
|
|
|
64311
|
-
// src/placeholder/
|
|
64312
|
-
|
|
64313
|
-
|
|
64314
|
-
return
|
|
64867
|
+
// src/placeholder/plugins/PlaceholderPlugin.ts
|
|
64868
|
+
function createPlaceholderPlugin({ editor, options }) {
|
|
64869
|
+
const dataAttribute = options.dataAttribute ? `data-${preparePlaceholderAttribute(options.dataAttribute)}` : `data-${DEFAULT_DATA_ATTRIBUTE}`;
|
|
64870
|
+
return new Plugin({
|
|
64871
|
+
key: PLUGIN_KEY,
|
|
64872
|
+
state: viewportPluginState,
|
|
64873
|
+
view: createViewportPluginView,
|
|
64874
|
+
props: {
|
|
64875
|
+
decorations: ({ doc, selection }) => buildPlaceholderDecorations({ editor, options, dataAttribute, doc, selection })
|
|
64876
|
+
}
|
|
64877
|
+
});
|
|
64315
64878
|
}
|
|
64316
|
-
|
|
64879
|
+
|
|
64880
|
+
// src/placeholder/placeholder.ts
|
|
64317
64881
|
var Placeholder = Extension.create({
|
|
64318
64882
|
name: "placeholder",
|
|
64319
64883
|
addOptions() {
|
|
@@ -64328,134 +64892,16 @@ ${indentedChild}`;
|
|
|
64328
64892
|
};
|
|
64329
64893
|
},
|
|
64330
64894
|
addProseMirrorPlugins() {
|
|
64331
|
-
|
|
64332
|
-
return [
|
|
64333
|
-
new Plugin({
|
|
64334
|
-
state: {
|
|
64335
|
-
init() {
|
|
64336
|
-
return {
|
|
64337
|
-
// null means "no viewport info yet" — decoration callback falls
|
|
64338
|
-
// back to full document scan until the scroll handler fires.
|
|
64339
|
-
topPos: null,
|
|
64340
|
-
bottomPos: null
|
|
64341
|
-
};
|
|
64342
|
-
},
|
|
64343
|
-
apply(tr, prev) {
|
|
64344
|
-
const meta = tr.getMeta(PLUGIN_KEY);
|
|
64345
|
-
if (meta == null ? void 0 : meta.positions) {
|
|
64346
|
-
return {
|
|
64347
|
-
topPos: meta.positions.top,
|
|
64348
|
-
bottomPos: meta.positions.bottom
|
|
64349
|
-
};
|
|
64350
|
-
}
|
|
64351
|
-
if (!tr.docChanged) {
|
|
64352
|
-
return prev;
|
|
64353
|
-
}
|
|
64354
|
-
return {
|
|
64355
|
-
topPos: prev.topPos !== null ? tr.mapping.map(prev.topPos) : null,
|
|
64356
|
-
bottomPos: prev.bottomPos !== null ? tr.mapping.map(prev.bottomPos) : null
|
|
64357
|
-
};
|
|
64358
|
-
}
|
|
64359
|
-
},
|
|
64360
|
-
key: PLUGIN_KEY,
|
|
64361
|
-
view(view) {
|
|
64362
|
-
const scrollContainer = findScrollParent(view.dom);
|
|
64363
|
-
const computeAndDispatch = () => {
|
|
64364
|
-
const positions = getViewportBoundaryPositions({
|
|
64365
|
-
view,
|
|
64366
|
-
doc: view.state.doc,
|
|
64367
|
-
scrollContainer
|
|
64368
|
-
});
|
|
64369
|
-
const prev = PLUGIN_KEY.getState(view.state);
|
|
64370
|
-
if (prev.topPos === positions.top && prev.bottomPos === positions.bottom) {
|
|
64371
|
-
return;
|
|
64372
|
-
}
|
|
64373
|
-
const tr = view.state.tr.setMeta(PLUGIN_KEY, { positions }).setMeta("tiptap__viewportUpdate", true);
|
|
64374
|
-
view.dispatch(tr);
|
|
64375
|
-
};
|
|
64376
|
-
const { call: throttledUpdate, cancel: cancelThrottle } = throttle(computeAndDispatch, 250);
|
|
64377
|
-
const scrollParent = scrollContainer;
|
|
64378
|
-
scrollParent.addEventListener("scroll", throttledUpdate, { passive: true });
|
|
64379
|
-
computeAndDispatch();
|
|
64380
|
-
return {
|
|
64381
|
-
update(_, prevState) {
|
|
64382
|
-
if (view.state.doc.content.size !== prevState.doc.content.size) {
|
|
64383
|
-
computeAndDispatch();
|
|
64384
|
-
}
|
|
64385
|
-
},
|
|
64386
|
-
destroy: () => {
|
|
64387
|
-
cancelThrottle();
|
|
64388
|
-
scrollParent.removeEventListener("scroll", throttledUpdate);
|
|
64389
|
-
}
|
|
64390
|
-
};
|
|
64391
|
-
},
|
|
64392
|
-
props: {
|
|
64393
|
-
decorations: ({ doc, selection }) => {
|
|
64394
|
-
var _a, _b;
|
|
64395
|
-
const active = this.editor.isEditable || !this.options.showOnlyWhenEditable;
|
|
64396
|
-
if (!active) {
|
|
64397
|
-
return null;
|
|
64398
|
-
}
|
|
64399
|
-
const { anchor } = selection;
|
|
64400
|
-
const decorations = [];
|
|
64401
|
-
const isEmptyDoc = this.editor.isEmpty;
|
|
64402
|
-
const useResolvedPath = this.options.showOnlyCurrent && !this.options.includeChildren;
|
|
64403
|
-
if (useResolvedPath) {
|
|
64404
|
-
const resolved = doc.resolve(anchor);
|
|
64405
|
-
if (resolved.depth > 0) {
|
|
64406
|
-
const node = resolved.node(1);
|
|
64407
|
-
const nodeStart = resolved.before(1);
|
|
64408
|
-
if (node.type.isTextblock && isNodeEmpty(node)) {
|
|
64409
|
-
const hasAnchor = anchor >= nodeStart && anchor <= nodeStart + node.nodeSize;
|
|
64410
|
-
const decoration = createPlaceholderDecoration({
|
|
64411
|
-
node,
|
|
64412
|
-
dataAttribute,
|
|
64413
|
-
hasAnchor,
|
|
64414
|
-
placeholder: this.options.placeholder,
|
|
64415
|
-
classes: {
|
|
64416
|
-
emptyEditor: this.options.emptyEditorClass,
|
|
64417
|
-
emptyNode: this.options.emptyNodeClass
|
|
64418
|
-
},
|
|
64419
|
-
editor: this.editor,
|
|
64420
|
-
isEmptyDoc,
|
|
64421
|
-
pos: resolved.before(1)
|
|
64422
|
-
});
|
|
64423
|
-
decorations.push(decoration);
|
|
64424
|
-
}
|
|
64425
|
-
}
|
|
64426
|
-
} else {
|
|
64427
|
-
const pluginState = PLUGIN_KEY.getState(this.editor.state);
|
|
64428
|
-
const from = (_a = pluginState.topPos) != null ? _a : 0;
|
|
64429
|
-
const to = (_b = pluginState.bottomPos) != null ? _b : doc.content.size;
|
|
64430
|
-
doc.nodesBetween(from, to, (node, pos) => {
|
|
64431
|
-
const hasAnchor = anchor >= pos && anchor <= pos + node.nodeSize;
|
|
64432
|
-
const isEmpty = !node.isLeaf && isNodeEmpty(node);
|
|
64433
|
-
if (!node.type.isTextblock) {
|
|
64434
|
-
return this.options.includeChildren;
|
|
64435
|
-
}
|
|
64436
|
-
if ((hasAnchor || !this.options.showOnlyCurrent) && isEmpty) {
|
|
64437
|
-
const decoration = createPlaceholderDecoration({
|
|
64438
|
-
classes: { emptyEditor: this.options.emptyEditorClass, emptyNode: this.options.emptyNodeClass },
|
|
64439
|
-
editor: this.editor,
|
|
64440
|
-
isEmptyDoc,
|
|
64441
|
-
dataAttribute,
|
|
64442
|
-
hasAnchor,
|
|
64443
|
-
placeholder: this.options.placeholder,
|
|
64444
|
-
node,
|
|
64445
|
-
pos
|
|
64446
|
-
});
|
|
64447
|
-
decorations.push(decoration);
|
|
64448
|
-
}
|
|
64449
|
-
return this.options.includeChildren;
|
|
64450
|
-
});
|
|
64451
|
-
}
|
|
64452
|
-
return DecorationSet.create(doc, decorations);
|
|
64453
|
-
}
|
|
64454
|
-
}
|
|
64455
|
-
})
|
|
64456
|
-
];
|
|
64895
|
+
return [createPlaceholderPlugin({ editor: this.editor, options: this.options })];
|
|
64457
64896
|
}
|
|
64458
64897
|
});
|
|
64898
|
+
var selectionStyle = `.ProseMirror:not(.ProseMirror-focused) *::selection {
|
|
64899
|
+
background: transparent;
|
|
64900
|
+
}
|
|
64901
|
+
|
|
64902
|
+
.ProseMirror:not(.ProseMirror-focused) *::-moz-selection {
|
|
64903
|
+
background: transparent;
|
|
64904
|
+
}`;
|
|
64459
64905
|
Extension.create({
|
|
64460
64906
|
name: "selection",
|
|
64461
64907
|
addOptions() {
|
|
@@ -64465,6 +64911,9 @@ ${indentedChild}`;
|
|
|
64465
64911
|
},
|
|
64466
64912
|
addProseMirrorPlugins() {
|
|
64467
64913
|
const { editor, options } = this;
|
|
64914
|
+
if (editor.options.injectCSS && typeof document !== "undefined") {
|
|
64915
|
+
createStyleTag(selectionStyle, editor.options.injectNonce, "selection");
|
|
64916
|
+
}
|
|
64468
64917
|
return [
|
|
64469
64918
|
new Plugin({
|
|
64470
64919
|
key: new PluginKey("selection"),
|
|
@@ -64485,7 +64934,10 @@ ${indentedChild}`;
|
|
|
64485
64934
|
}
|
|
64486
64935
|
});
|
|
64487
64936
|
var skipTrailingNodeMeta = "skipTrailingNode";
|
|
64488
|
-
function nodeEqualsType({
|
|
64937
|
+
function nodeEqualsType({
|
|
64938
|
+
types,
|
|
64939
|
+
node
|
|
64940
|
+
}) {
|
|
64489
64941
|
return node && Array.isArray(types) && types.includes(node.type) || (node == null ? void 0 : node.type) === types;
|
|
64490
64942
|
}
|
|
64491
64943
|
Extension.create({
|
|
@@ -71144,6 +71596,12 @@ ${indentedChild}`;
|
|
|
71144
71596
|
canLoadChildren: 'can-load-children',
|
|
71145
71597
|
loadingChildren: 'loading-children'
|
|
71146
71598
|
};
|
|
71599
|
+
/**
|
|
71600
|
+
* The possible pin locations for a table column.
|
|
71601
|
+
*/
|
|
71602
|
+
const TableColumnPinLocation = {
|
|
71603
|
+
left: 'left'
|
|
71604
|
+
};
|
|
71147
71605
|
/**
|
|
71148
71606
|
* The possible directions a table column can be sorted in.
|
|
71149
71607
|
*/
|
|
@@ -71484,6 +71942,9 @@ ${indentedChild}`;
|
|
|
71484
71942
|
__decorate([
|
|
71485
71943
|
observable
|
|
71486
71944
|
], ColumnInternals.prototype, "currentSortDirection", void 0);
|
|
71945
|
+
__decorate([
|
|
71946
|
+
observable
|
|
71947
|
+
], ColumnInternals.prototype, "pinLocation", void 0);
|
|
71487
71948
|
function isColumnInternalsProperty(changedProperty, ...args) {
|
|
71488
71949
|
for (const arg of args) {
|
|
71489
71950
|
if (changedProperty === arg) {
|
|
@@ -71557,6 +72018,7 @@ ${indentedChild}`;
|
|
|
71557
72018
|
this.idFieldNameNotConfigured = false;
|
|
71558
72019
|
this.invalidColumnConfiguration = false;
|
|
71559
72020
|
this.invalidParentIdConfiguration = false;
|
|
72021
|
+
this.invalidPinnedColumnConfiguration = false;
|
|
71560
72022
|
this.recordIds = new Set();
|
|
71561
72023
|
}
|
|
71562
72024
|
getValidity() {
|
|
@@ -71570,7 +72032,8 @@ ${indentedChild}`;
|
|
|
71570
72032
|
duplicateGroupIndex: this.duplicateGroupIndex,
|
|
71571
72033
|
idFieldNameNotConfigured: this.idFieldNameNotConfigured,
|
|
71572
72034
|
invalidColumnConfiguration: this.invalidColumnConfiguration,
|
|
71573
|
-
invalidParentIdConfiguration: this.invalidParentIdConfiguration
|
|
72035
|
+
invalidParentIdConfiguration: this.invalidParentIdConfiguration,
|
|
72036
|
+
invalidPinnedColumnConfiguration: this.invalidPinnedColumnConfiguration
|
|
71574
72037
|
};
|
|
71575
72038
|
}
|
|
71576
72039
|
isValid() {
|
|
@@ -71653,6 +72116,12 @@ ${indentedChild}`;
|
|
|
71653
72116
|
this.invalidColumnConfiguration = columns.some(x => !x.columnInternals.validator.isColumnValid);
|
|
71654
72117
|
return !this.invalidColumnConfiguration;
|
|
71655
72118
|
}
|
|
72119
|
+
validatePinnedColumnConfigurations(columns) {
|
|
72120
|
+
this.invalidPinnedColumnConfiguration = columns.some(x => x.columnInternals.pinLocation === TableColumnPinLocation.left
|
|
72121
|
+
&& (x.columnInternals.pixelWidth === undefined
|
|
72122
|
+
|| !x.columnInternals.resizingDisabled));
|
|
72123
|
+
return !this.invalidPinnedColumnConfiguration;
|
|
72124
|
+
}
|
|
71656
72125
|
getPresentRecordIds(requestedRecordIds) {
|
|
71657
72126
|
return requestedRecordIds.filter(id => this.recordIds.has(id));
|
|
71658
72127
|
}
|
|
@@ -71712,12 +72181,7 @@ focus outline in that case.
|
|
|
71712
72181
|
.header-row-container {
|
|
71713
72182
|
position: sticky;
|
|
71714
72183
|
top: 0;
|
|
71715
|
-
}
|
|
71716
|
-
|
|
71717
|
-
.header-row {
|
|
71718
72184
|
display: flex;
|
|
71719
|
-
background: ${applicationBackgroundColor};
|
|
71720
|
-
position: relative;
|
|
71721
72185
|
width: fit-content;
|
|
71722
72186
|
min-width: max(
|
|
71723
72187
|
100%,
|
|
@@ -71726,8 +72190,16 @@ focus outline in that case.
|
|
|
71726
72190
|
var(--ni-private-table-header-container-margin-right)
|
|
71727
72191
|
)
|
|
71728
72192
|
);
|
|
72193
|
+
}
|
|
72194
|
+
|
|
72195
|
+
.header-row {
|
|
72196
|
+
display: flex;
|
|
72197
|
+
background: ${applicationBackgroundColor};
|
|
72198
|
+
position: relative;
|
|
72199
|
+
width: fit-content;
|
|
71729
72200
|
left: var(--ni-private-table-scroll-x);
|
|
71730
72201
|
align-items: center;
|
|
72202
|
+
flex: 1;
|
|
71731
72203
|
}
|
|
71732
72204
|
|
|
71733
72205
|
.header-row-action-container {
|
|
@@ -71779,6 +72251,17 @@ focus outline in that case.
|
|
|
71779
72251
|
overflow: hidden;
|
|
71780
72252
|
}
|
|
71781
72253
|
|
|
72254
|
+
.pinned-columns-header-container {
|
|
72255
|
+
display: grid;
|
|
72256
|
+
grid-template-columns: var(--ni-private-table-pinned-columns-row-grid-columns);
|
|
72257
|
+
position: sticky;
|
|
72258
|
+
left: 0;
|
|
72259
|
+
align-self: stretch;
|
|
72260
|
+
background: ${applicationBackgroundColor};
|
|
72261
|
+
z-index: ${ZIndexLevels.zIndex1};
|
|
72262
|
+
box-shadow: inset -2px 0 0 0 ${tableRowBorderColor};
|
|
72263
|
+
}
|
|
72264
|
+
|
|
71782
72265
|
.column-divider {
|
|
71783
72266
|
border-left: var(--ni-private-column-divider-width) solid
|
|
71784
72267
|
${popupBorderColor};
|
|
@@ -71879,6 +72362,10 @@ focus outline in that case.
|
|
|
71879
72362
|
${accessiblyHidden}
|
|
71880
72363
|
}
|
|
71881
72364
|
`.withBehaviors(themeBehavior(Theme.color, css `
|
|
72365
|
+
.pinned-columns-header-container {
|
|
72366
|
+
box-shadow: inset -2px 0 0 0 ${hexToRgbaCssColor(White, 0.1)};
|
|
72367
|
+
}
|
|
72368
|
+
|
|
71882
72369
|
.table-row-container::before {
|
|
71883
72370
|
content: '';
|
|
71884
72371
|
width: 100%;
|
|
@@ -72060,7 +72547,7 @@ focus outline in that case.
|
|
|
72060
72547
|
position: absolute;
|
|
72061
72548
|
}
|
|
72062
72549
|
|
|
72063
|
-
:host([selectable]
|
|
72550
|
+
:host([selectable][allow-hover]:hover)::before {
|
|
72064
72551
|
background-color: ${fillHoverColor};
|
|
72065
72552
|
}
|
|
72066
72553
|
|
|
@@ -72133,6 +72620,46 @@ focus outline in that case.
|
|
|
72133
72620
|
width: ${mediumPadding};
|
|
72134
72621
|
}
|
|
72135
72622
|
|
|
72623
|
+
.pinned-cell-container {
|
|
72624
|
+
display: grid;
|
|
72625
|
+
grid-template-columns: var(--ni-private-table-pinned-columns-row-grid-columns);
|
|
72626
|
+
position: sticky;
|
|
72627
|
+
left: 0;
|
|
72628
|
+
background: ${applicationBackgroundColor};
|
|
72629
|
+
z-index: ${ZIndexLevels.zIndex1};
|
|
72630
|
+
box-shadow: inset -2px 0 0 0 ${tableRowBorderColor};
|
|
72631
|
+
}
|
|
72632
|
+
|
|
72633
|
+
:host([selectable][allow-hover]:hover) .pinned-cell-container {
|
|
72634
|
+
background: linear-gradient(${fillHoverColor}, ${fillHoverColor}),
|
|
72635
|
+
${applicationBackgroundColor};
|
|
72636
|
+
}
|
|
72637
|
+
|
|
72638
|
+
:host([selected]) .pinned-cell-container {
|
|
72639
|
+
background: linear-gradient(${fillSelectedColor}, ${fillSelectedColor}),
|
|
72640
|
+
${applicationBackgroundColor};
|
|
72641
|
+
}
|
|
72642
|
+
|
|
72643
|
+
:host([selected][allow-hover]:hover) .pinned-cell-container {
|
|
72644
|
+
background: linear-gradient(
|
|
72645
|
+
${fillHoverSelectedColor},
|
|
72646
|
+
${fillHoverSelectedColor}
|
|
72647
|
+
),
|
|
72648
|
+
${applicationBackgroundColor};
|
|
72649
|
+
}
|
|
72650
|
+
|
|
72651
|
+
:host(${focusVisible}) .pinned-cell-container {
|
|
72652
|
+
box-shadow:
|
|
72653
|
+
inset calc(2 * ${borderWidth}) 0 0 ${borderHoverColor},
|
|
72654
|
+
inset 0 calc(2 * ${borderWidth}) 0 ${borderHoverColor},
|
|
72655
|
+
inset 0 calc(-2 * ${borderWidth}) 0 ${borderHoverColor},
|
|
72656
|
+
inset -2px 0 0 0 ${tableRowBorderColor};
|
|
72657
|
+
}
|
|
72658
|
+
${'' /* Pushing the pinned-cell-container to a higher z-index for breakpoint menu behavior (not required by table directly) */}
|
|
72659
|
+
:host([menu-open]) .pinned-cell-container {
|
|
72660
|
+
z-index: ${ZIndexLevels.zIndex1000};
|
|
72661
|
+
}
|
|
72662
|
+
|
|
72136
72663
|
.cell-container {
|
|
72137
72664
|
display: grid;
|
|
72138
72665
|
width: 100%;
|
|
@@ -72208,6 +72735,42 @@ focus outline in that case.
|
|
|
72208
72735
|
:host([selected][allow-hover]:hover)::before {
|
|
72209
72736
|
background-color: ${hexToRgbaCssColor(White, 0.2)};
|
|
72210
72737
|
}
|
|
72738
|
+
|
|
72739
|
+
.pinned-cell-container {
|
|
72740
|
+
box-shadow: inset -2px 0 0 0 ${hexToRgbaCssColor(White, 0.1)};
|
|
72741
|
+
}
|
|
72742
|
+
|
|
72743
|
+
:host([selectable][allow-hover]:hover) .pinned-cell-container {
|
|
72744
|
+
background: linear-gradient(
|
|
72745
|
+
${hexToRgbaCssColor(White, 0.05)},
|
|
72746
|
+
${hexToRgbaCssColor(White, 0.05)}
|
|
72747
|
+
),
|
|
72748
|
+
${applicationBackgroundColor};
|
|
72749
|
+
}
|
|
72750
|
+
|
|
72751
|
+
:host([selected]) .pinned-cell-container {
|
|
72752
|
+
background: linear-gradient(
|
|
72753
|
+
${hexToRgbaCssColor(White, 0.25)},
|
|
72754
|
+
${hexToRgbaCssColor(White, 0.25)}
|
|
72755
|
+
),
|
|
72756
|
+
${applicationBackgroundColor};
|
|
72757
|
+
}
|
|
72758
|
+
|
|
72759
|
+
:host([selected][allow-hover]:hover) .pinned-cell-container {
|
|
72760
|
+
background: linear-gradient(
|
|
72761
|
+
${hexToRgbaCssColor(White, 0.2)},
|
|
72762
|
+
${hexToRgbaCssColor(White, 0.2)}
|
|
72763
|
+
),
|
|
72764
|
+
${applicationBackgroundColor};
|
|
72765
|
+
}
|
|
72766
|
+
|
|
72767
|
+
:host(${focusVisible}) .pinned-cell-container {
|
|
72768
|
+
box-shadow:
|
|
72769
|
+
inset calc(2 * ${borderWidth}) 0 0 ${borderHoverColor},
|
|
72770
|
+
inset 0 calc(2 * ${borderWidth}) 0 ${borderHoverColor},
|
|
72771
|
+
inset 0 calc(-2 * ${borderWidth}) 0 ${borderHoverColor},
|
|
72772
|
+
inset -2px 0 0 0 ${hexToRgbaCssColor(White, 0.1)};
|
|
72773
|
+
}
|
|
72211
72774
|
`));
|
|
72212
72775
|
|
|
72213
72776
|
const styles$i = css `
|
|
@@ -72358,6 +72921,37 @@ focus outline in that case.
|
|
|
72358
72921
|
DesignSystem.getOrCreate().withPrefix('nimble').register(nimbleTableCell());
|
|
72359
72922
|
const tableCellTag = 'nimble-table-cell';
|
|
72360
72923
|
|
|
72924
|
+
const rowCellTemplate = html `
|
|
72925
|
+
<${tableCellTag}
|
|
72926
|
+
class="cell"
|
|
72927
|
+
:cellState="${(_, c) => c.parent.cellStates[c.index]}"
|
|
72928
|
+
:cellViewTemplate="${x => x.columnInternals.cellViewTemplate}"
|
|
72929
|
+
:column="${x => x}"
|
|
72930
|
+
column-id="${x => x.columnId}"
|
|
72931
|
+
:recordId="${(_, c) => c.parent.recordId}"
|
|
72932
|
+
?has-action-menu="${x => !!x.actionMenuSlot}"
|
|
72933
|
+
action-menu-label="${x => x.actionMenuLabel}"
|
|
72934
|
+
@cell-action-menu-beforetoggle="${(x, c) => c.parent.onCellActionMenuBeforeToggle(c.event, x)}"
|
|
72935
|
+
@cell-action-menu-toggle="${(x, c) => c.parent.onCellActionMenuToggle(c.event, x)}"
|
|
72936
|
+
@cell-view-slots-request="${(x, c) => c.parent.onCellViewSlotsRequest(x, c.event)}"
|
|
72937
|
+
:nestingLevel="${(_, c) => c.parent.cellIndentLevels[c.index]}"
|
|
72938
|
+
>
|
|
72939
|
+
|
|
72940
|
+
${when((x, c) => (c.parent.currentActionMenuColumn === x) && x.actionMenuSlot, html `
|
|
72941
|
+
<slot
|
|
72942
|
+
name="${x => `row-action-menu-${x.actionMenuSlot}`}"
|
|
72943
|
+
slot="cellActionMenu"
|
|
72944
|
+
></slot>
|
|
72945
|
+
`)}
|
|
72946
|
+
|
|
72947
|
+
${repeat(x => x.columnInternals.slotNames, html `
|
|
72948
|
+
<slot
|
|
72949
|
+
name="${(x, c) => uniquifySlotNameForColumn(c.parent, x)}"
|
|
72950
|
+
slot="${(x, c) => uniquifySlotNameForColumn(c.parent, x)}"
|
|
72951
|
+
></slot>
|
|
72952
|
+
`)}
|
|
72953
|
+
</${tableCellTag}>
|
|
72954
|
+
`;
|
|
72361
72955
|
const template$j = html `
|
|
72362
72956
|
<template
|
|
72363
72957
|
role="row"
|
|
@@ -72365,6 +72959,14 @@ focus outline in that case.
|
|
|
72365
72959
|
aria-expanded=${x => x.expanded}
|
|
72366
72960
|
style="--ni-private-table-row-indent-level: ${x => x.nestingLevel};"
|
|
72367
72961
|
>
|
|
72962
|
+
<span class="pinned-cell-container">
|
|
72963
|
+
${repeat(x => x.columns, html `
|
|
72964
|
+
${when(x => !x.columnHidden && x.columnInternals.pinLocation === TableColumnPinLocation.left, html `
|
|
72965
|
+
${rowCellTemplate}
|
|
72966
|
+
`)}
|
|
72967
|
+
`, { recycle: false, positioning: true })}
|
|
72968
|
+
</span>
|
|
72969
|
+
|
|
72368
72970
|
${when(x => !x.rowOperationGridCellHidden, html `
|
|
72369
72971
|
<span role="gridcell" class="row-operations-container">
|
|
72370
72972
|
${when(x => x.showSelectionCheckbox, html `
|
|
@@ -72382,7 +72984,7 @@ focus outline in that case.
|
|
|
72382
72984
|
`)}
|
|
72383
72985
|
</span>
|
|
72384
72986
|
`)}
|
|
72385
|
-
<span class="row-front-spacer ${x => (x.isTopLevelParentRow || !x.reserveCollapseSpace ? 'reduced-size-spacer' : '')}"></span>
|
|
72987
|
+
<span class="row-front-spacer ${x => (x.isTopLevelParentRow || !x.reserveCollapseSpace ? 'reduced-size-spacer' : '')} ${x => (x.showSelectionCheckbox ? 'selectable' : '')}"></span>
|
|
72386
72988
|
${when(x => x.isParentRow, html `
|
|
72387
72989
|
${when(x => x.loading, html `
|
|
72388
72990
|
<span class="spinner-container">
|
|
@@ -72413,36 +73015,8 @@ focus outline in that case.
|
|
|
72413
73015
|
class="cell-container ${x => (x.isNestedParent ? 'nested-parent' : '')}"
|
|
72414
73016
|
>
|
|
72415
73017
|
${repeat(x => x.columns, html `
|
|
72416
|
-
${when(x => !x.columnHidden, html `
|
|
72417
|
-
|
|
72418
|
-
class="cell"
|
|
72419
|
-
:cellState="${(_, c) => c.parent.cellStates[c.index]}"
|
|
72420
|
-
:cellViewTemplate="${x => x.columnInternals.cellViewTemplate}"
|
|
72421
|
-
:column="${x => x}"
|
|
72422
|
-
column-id="${x => x.columnId}"
|
|
72423
|
-
:recordId="${(_, c) => c.parent.recordId}"
|
|
72424
|
-
?has-action-menu="${x => !!x.actionMenuSlot}"
|
|
72425
|
-
action-menu-label="${x => x.actionMenuLabel}"
|
|
72426
|
-
@cell-action-menu-beforetoggle="${(x, c) => c.parent.onCellActionMenuBeforeToggle(c.event, x)}"
|
|
72427
|
-
@cell-action-menu-toggle="${(x, c) => c.parent.onCellActionMenuToggle(c.event, x)}"
|
|
72428
|
-
@cell-view-slots-request="${(x, c) => c.parent.onCellViewSlotsRequest(x, c.event)}"
|
|
72429
|
-
:nestingLevel="${(_, c) => c.parent.cellIndentLevels[c.index]}"
|
|
72430
|
-
>
|
|
72431
|
-
|
|
72432
|
-
${when((x, c) => (c.parent.currentActionMenuColumn === x) && x.actionMenuSlot, html `
|
|
72433
|
-
<slot
|
|
72434
|
-
name="${x => `row-action-menu-${x.actionMenuSlot}`}"
|
|
72435
|
-
slot="cellActionMenu"
|
|
72436
|
-
></slot>
|
|
72437
|
-
`)}
|
|
72438
|
-
|
|
72439
|
-
${repeat(x => x.columnInternals.slotNames, html `
|
|
72440
|
-
<slot
|
|
72441
|
-
name="${(x, c) => uniquifySlotNameForColumn(c.parent, x)}"
|
|
72442
|
-
slot="${(x, c) => uniquifySlotNameForColumn(c.parent, x)}"
|
|
72443
|
-
></slot>
|
|
72444
|
-
`)}
|
|
72445
|
-
</${tableCellTag}>
|
|
73018
|
+
${when(x => !x.columnHidden && x.columnInternals.pinLocation !== TableColumnPinLocation.left, html `
|
|
73019
|
+
${rowCellTemplate}
|
|
72446
73020
|
`)}
|
|
72447
73021
|
`, { recycle: false, positioning: true })}
|
|
72448
73022
|
</span>
|
|
@@ -72625,8 +73199,9 @@ focus outline in that case.
|
|
|
72625
73199
|
this.updateCellIndentLevels();
|
|
72626
73200
|
}
|
|
72627
73201
|
updateCellIndentLevels() {
|
|
73202
|
+
const firstNonPinnedIndex = this.columns.findIndex(col => col.columnInternals.pinLocation !== TableColumnPinLocation.left);
|
|
72628
73203
|
this.cellIndentLevels = this.columns.map((_, i) => {
|
|
72629
|
-
return i ===
|
|
73204
|
+
return i === firstNonPinnedIndex ? this.nestingLevel : 0;
|
|
72630
73205
|
});
|
|
72631
73206
|
}
|
|
72632
73207
|
removeColumnObservers() {
|
|
@@ -72768,6 +73343,7 @@ focus outline in that case.
|
|
|
72768
73343
|
height: calc(${controlHeight} + 2 * ${borderWidth});
|
|
72769
73344
|
border-top: calc(2 * ${borderWidth}) solid ${applicationBackgroundColor};
|
|
72770
73345
|
grid-template-columns:
|
|
73346
|
+
calc(var(--ni-private-table-group-row-pinned-column-offset))
|
|
72771
73347
|
calc(
|
|
72772
73348
|
${controlHeight} *
|
|
72773
73349
|
(var(--ni-private-table-group-row-indent-level) + 1)
|
|
@@ -72777,6 +73353,7 @@ focus outline in that case.
|
|
|
72777
73353
|
|
|
72778
73354
|
:host([selectable]) {
|
|
72779
73355
|
grid-template-columns:
|
|
73356
|
+
calc(var(--ni-private-table-group-row-pinned-column-offset))
|
|
72780
73357
|
${controlHeight}
|
|
72781
73358
|
calc(
|
|
72782
73359
|
${controlHeight} *
|
|
@@ -72803,6 +73380,37 @@ focus outline in that case.
|
|
|
72803
73380
|
outline-offset: calc(-2 * ${borderWidth});
|
|
72804
73381
|
}
|
|
72805
73382
|
|
|
73383
|
+
:host([has-pinned-columns]) .pinned-column-spacer {
|
|
73384
|
+
display: block;
|
|
73385
|
+
height: 100%;
|
|
73386
|
+
position: sticky;
|
|
73387
|
+
left: 0;
|
|
73388
|
+
background: ${tableRowBorderColor};
|
|
73389
|
+
z-index: ${ZIndexLevels.zIndex1};
|
|
73390
|
+
}
|
|
73391
|
+
|
|
73392
|
+
:host([allow-hover][has-pinned-columns]:hover) .pinned-column-spacer {
|
|
73393
|
+
background: linear-gradient(${fillHoverColor}, ${fillHoverColor}),
|
|
73394
|
+
${tableRowBorderColor};
|
|
73395
|
+
}
|
|
73396
|
+
|
|
73397
|
+
:host([has-pinned-columns]${focusVisible}) .pinned-column-spacer {
|
|
73398
|
+
box-shadow: inset 2px -2px 0 ${borderHoverColor};
|
|
73399
|
+
}
|
|
73400
|
+
|
|
73401
|
+
.checkbox-container {
|
|
73402
|
+
display: flex;
|
|
73403
|
+
}
|
|
73404
|
+
|
|
73405
|
+
:host([has-pinned-columns]) .checkbox-container {
|
|
73406
|
+
position: relative;
|
|
73407
|
+
}
|
|
73408
|
+
|
|
73409
|
+
:host([allow-hover][has-pinned-columns]:hover) .checkbox-container {
|
|
73410
|
+
background: linear-gradient(${fillHoverColor}, ${fillHoverColor}),
|
|
73411
|
+
${tableRowBorderColor};
|
|
73412
|
+
}
|
|
73413
|
+
|
|
72806
73414
|
.expand-collapse-button {
|
|
72807
73415
|
margin-left: calc(
|
|
72808
73416
|
${mediumPadding} + ${standardPadding} * 2 *
|
|
@@ -72828,10 +73436,6 @@ focus outline in that case.
|
|
|
72828
73436
|
${userSelectNone}
|
|
72829
73437
|
}
|
|
72830
73438
|
|
|
72831
|
-
.checkbox-container {
|
|
72832
|
-
display: flex;
|
|
72833
|
-
}
|
|
72834
|
-
|
|
72835
73439
|
.selection-checkbox {
|
|
72836
73440
|
margin-left: ${standardPadding};
|
|
72837
73441
|
}
|
|
@@ -72843,10 +73447,66 @@ focus outline in that case.
|
|
|
72843
73447
|
:host([allow-hover]:hover)::before {
|
|
72844
73448
|
background-color: ${hexToRgbaCssColor(White, 0.05)};
|
|
72845
73449
|
}
|
|
73450
|
+
|
|
73451
|
+
:host([has-pinned-columns]) .pinned-column-spacer {
|
|
73452
|
+
background: linear-gradient(
|
|
73453
|
+
${hexToRgbaCssColor(White, 0.1)},
|
|
73454
|
+
${hexToRgbaCssColor(White, 0.1)}
|
|
73455
|
+
),
|
|
73456
|
+
${tableRowBorderColor};
|
|
73457
|
+
}
|
|
73458
|
+
|
|
73459
|
+
:host([allow-hover][has-pinned-columns]:hover) .pinned-column-spacer {
|
|
73460
|
+
background: linear-gradient(
|
|
73461
|
+
${hexToRgbaCssColor(White, 0.05)},
|
|
73462
|
+
${hexToRgbaCssColor(White, 0.05)}
|
|
73463
|
+
),
|
|
73464
|
+
linear-gradient(
|
|
73465
|
+
${hexToRgbaCssColor(White, 0.1)},
|
|
73466
|
+
${hexToRgbaCssColor(White, 0.1)}
|
|
73467
|
+
),
|
|
73468
|
+
${tableRowBorderColor};
|
|
73469
|
+
}
|
|
73470
|
+
|
|
73471
|
+
:host([has-pinned-columns]) .checkbox-container {
|
|
73472
|
+
background: linear-gradient(
|
|
73473
|
+
${hexToRgbaCssColor(White, 0.1)},
|
|
73474
|
+
${hexToRgbaCssColor(White, 0.1)}
|
|
73475
|
+
),
|
|
73476
|
+
${tableRowBorderColor};
|
|
73477
|
+
}
|
|
73478
|
+
|
|
73479
|
+
:host([allow-hover][has-pinned-columns]:hover) .checkbox-container {
|
|
73480
|
+
background: linear-gradient(
|
|
73481
|
+
${hexToRgbaCssColor(White, 0.05)},
|
|
73482
|
+
${hexToRgbaCssColor(White, 0.05)}
|
|
73483
|
+
),
|
|
73484
|
+
linear-gradient(
|
|
73485
|
+
${hexToRgbaCssColor(White, 0.1)},
|
|
73486
|
+
${hexToRgbaCssColor(White, 0.1)}
|
|
73487
|
+
),
|
|
73488
|
+
${tableRowBorderColor};
|
|
73489
|
+
}
|
|
72846
73490
|
`), themeBehavior(Theme.dark, css `
|
|
72847
73491
|
:host([allow-hover]:hover)::before {
|
|
72848
73492
|
background-color: ${hexToRgbaCssColor(White, 0.1)};
|
|
72849
73493
|
}
|
|
73494
|
+
|
|
73495
|
+
:host([allow-hover][has-pinned-columns]:hover) .pinned-column-spacer {
|
|
73496
|
+
background: linear-gradient(
|
|
73497
|
+
${hexToRgbaCssColor(White, 0.1)},
|
|
73498
|
+
${hexToRgbaCssColor(White, 0.1)}
|
|
73499
|
+
),
|
|
73500
|
+
${tableRowBorderColor};
|
|
73501
|
+
}
|
|
73502
|
+
|
|
73503
|
+
:host([allow-hover][has-pinned-columns]:hover) .checkbox-container {
|
|
73504
|
+
background: linear-gradient(
|
|
73505
|
+
${hexToRgbaCssColor(White, 0.1)},
|
|
73506
|
+
${hexToRgbaCssColor(White, 0.1)}
|
|
73507
|
+
),
|
|
73508
|
+
${tableRowBorderColor};
|
|
73509
|
+
}
|
|
72850
73510
|
`));
|
|
72851
73511
|
|
|
72852
73512
|
const template$i = html `
|
|
@@ -72854,8 +73514,13 @@ focus outline in that case.
|
|
|
72854
73514
|
role="row"
|
|
72855
73515
|
@click=${x => x.onGroupExpandToggle()}
|
|
72856
73516
|
aria-expanded=${x => x.expanded}
|
|
72857
|
-
style="
|
|
73517
|
+
style="
|
|
73518
|
+
--ni-private-table-group-row-indent-level: ${x => x.nestingLevel};
|
|
73519
|
+
--ni-private-table-group-row-pinned-column-offset: ${x => x.pinnedColumnOffset}px;
|
|
73520
|
+
"
|
|
72858
73521
|
>
|
|
73522
|
+
<span class="pinned-column-spacer"></span>
|
|
73523
|
+
|
|
72859
73524
|
${when(x => x.selectable, html `
|
|
72860
73525
|
<span role="gridcell" class="checkbox-container">
|
|
72861
73526
|
<${checkboxTag}
|
|
@@ -72898,6 +73563,11 @@ focus outline in that case.
|
|
|
72898
73563
|
constructor() {
|
|
72899
73564
|
super(...arguments);
|
|
72900
73565
|
this.nestingLevel = 0;
|
|
73566
|
+
this.pinnedColumnOffset = 0;
|
|
73567
|
+
/**
|
|
73568
|
+
* @internal
|
|
73569
|
+
*/
|
|
73570
|
+
this.hasPinnedColumns = false;
|
|
72901
73571
|
this.expanded = false;
|
|
72902
73572
|
this.selectable = false;
|
|
72903
73573
|
this.selectionState = TableRowSelectionState.notSelected;
|
|
@@ -72955,6 +73625,9 @@ focus outline in that case.
|
|
|
72955
73625
|
cells: []
|
|
72956
73626
|
};
|
|
72957
73627
|
}
|
|
73628
|
+
pinnedColumnOffsetChanged() {
|
|
73629
|
+
this.hasPinnedColumns = this.pinnedColumnOffset > 0;
|
|
73630
|
+
}
|
|
72958
73631
|
selectionStateChanged() {
|
|
72959
73632
|
this.setSelectionCheckboxState();
|
|
72960
73633
|
}
|
|
@@ -72977,6 +73650,12 @@ focus outline in that case.
|
|
|
72977
73650
|
__decorate([
|
|
72978
73651
|
observable
|
|
72979
73652
|
], TableGroupRow.prototype, "nestingLevel", void 0);
|
|
73653
|
+
__decorate([
|
|
73654
|
+
observable
|
|
73655
|
+
], TableGroupRow.prototype, "pinnedColumnOffset", void 0);
|
|
73656
|
+
__decorate([
|
|
73657
|
+
attr({ attribute: 'has-pinned-columns', mode: 'boolean' })
|
|
73658
|
+
], TableGroupRow.prototype, "hasPinnedColumns", void 0);
|
|
72980
73659
|
__decorate([
|
|
72981
73660
|
observable
|
|
72982
73661
|
], TableGroupRow.prototype, "resolvedRowIndex", void 0);
|
|
@@ -73012,6 +73691,21 @@ focus outline in that case.
|
|
|
73012
73691
|
DesignSystem.getOrCreate().withPrefix('nimble').register(nimbleTableGroupRow());
|
|
73013
73692
|
const tableGroupRowTag = 'nimble-table-group-row';
|
|
73014
73693
|
|
|
73694
|
+
const tableHeaderTemplate = html `
|
|
73695
|
+
<${tableHeaderTag}
|
|
73696
|
+
class="header"
|
|
73697
|
+
${'' /* tabindex managed dynamically by KeyboardNavigationManager (if column sorting not disabled) */}
|
|
73698
|
+
sort-direction="${x => (typeof x.columnInternals.currentSortIndex === 'number' ? x.columnInternals.currentSortDirection : TableColumnSortDirection.none)}"
|
|
73699
|
+
?first-sorted-column="${(x, c) => x === c.parent.firstSortedColumn}"
|
|
73700
|
+
?indicators-hidden="${x => x.columnInternals.hideHeaderIndicators}"
|
|
73701
|
+
@keydown="${(x, c) => c.parent.onHeaderKeyDown(x, c.event)}"
|
|
73702
|
+
@click="${(x, c) => c.parent.toggleColumnSort(x, c.event.shiftKey)}"
|
|
73703
|
+
:alignment="${x => x.columnInternals.headerAlignment}"
|
|
73704
|
+
:isGrouped="${x => (typeof x.columnInternals.groupIndex === 'number' && !x.columnInternals.groupingDisabled) || undefined}"
|
|
73705
|
+
>
|
|
73706
|
+
<slot name="${x => x.slot}"></slot>
|
|
73707
|
+
</${tableHeaderTag}>
|
|
73708
|
+
`;
|
|
73015
73709
|
const template$h = html `
|
|
73016
73710
|
<template
|
|
73017
73711
|
role="treegrid"
|
|
@@ -73029,8 +73723,14 @@ focus outline in that case.
|
|
|
73029
73723
|
--ni-private-table-row-grid-columns: ${x => (x.rowGridColumns ? x.rowGridColumns : '')};
|
|
73030
73724
|
--ni-private-table-cursor-override: ${x => (x.layoutManager.isColumnBeingSized ? 'col-resize' : 'default')};
|
|
73031
73725
|
--ni-private-table-scrollable-min-width: ${x => x.tableScrollableMinWidth}px;
|
|
73726
|
+
--ni-private-table-pinned-columns-row-grid-columns: ${x => x.pinnedColumnsGridTemplateColumns};
|
|
73032
73727
|
">
|
|
73033
73728
|
<div role="rowgroup" class="header-row-container">
|
|
73729
|
+
<div class="pinned-columns-header-container">
|
|
73730
|
+
${repeat(x => x.pinnedColumns, html `
|
|
73731
|
+
${tableHeaderTemplate}
|
|
73732
|
+
`, { positioning: true })}
|
|
73733
|
+
</div>
|
|
73034
73734
|
<div class="header-row" role="row">
|
|
73035
73735
|
<span role="${x => (x.showRowOperationColumn ? 'columnheader' : '')}" class="header-row-action-container" ${ref('headerRowActionContainer')}>
|
|
73036
73736
|
${when(x => x.showRowOperationColumn, html `
|
|
@@ -73083,19 +73783,7 @@ focus outline in that case.
|
|
|
73083
73783
|
@pointerdown="${(_, c) => c.parent.onLeftDividerPointerDown(c.event, c.index)}">
|
|
73084
73784
|
</div>
|
|
73085
73785
|
`)}
|
|
73086
|
-
|
|
73087
|
-
class="header"
|
|
73088
|
-
${'' /* tabindex managed dynamically by KeyboardNavigationManager (if column sorting not disabled) */}
|
|
73089
|
-
sort-direction="${x => (typeof x.columnInternals.currentSortIndex === 'number' ? x.columnInternals.currentSortDirection : TableColumnSortDirection.none)}"
|
|
73090
|
-
?first-sorted-column="${(x, c) => x === c.parent.firstSortedColumn}"
|
|
73091
|
-
?indicators-hidden="${x => x.columnInternals.hideHeaderIndicators}"
|
|
73092
|
-
@keydown="${(x, c) => c.parent.onHeaderKeyDown(x, c.event)}"
|
|
73093
|
-
@click="${(x, c) => c.parent.toggleColumnSort(x, c.event.shiftKey)}"
|
|
73094
|
-
:alignment="${x => x.columnInternals.headerAlignment}"
|
|
73095
|
-
:isGrouped=${x => (typeof x.columnInternals.groupIndex === 'number' && !x.columnInternals.groupingDisabled)}
|
|
73096
|
-
>
|
|
73097
|
-
<slot name="${x => x.slot}"></slot>
|
|
73098
|
-
</${tableHeaderTag}>
|
|
73786
|
+
${tableHeaderTemplate}
|
|
73099
73787
|
${when((_, c) => c.index < c.length - 1, html `
|
|
73100
73788
|
<div
|
|
73101
73789
|
class="
|
|
@@ -73128,6 +73816,7 @@ focus outline in that case.
|
|
|
73128
73816
|
:groupRowValue="${(x, c) => c.parent.tableData[x.index]?.groupRowValue}"
|
|
73129
73817
|
?expanded="${(x, c) => c.parent.tableData[x.index]?.isExpanded}"
|
|
73130
73818
|
:nestingLevel="${(x, c) => c.parent.tableData[x.index]?.nestingLevel}"
|
|
73819
|
+
:pinnedColumnOffset="${(_, c) => c.parent.pinnedColumnOffset}"
|
|
73131
73820
|
:immediateChildCount="${(x, c) => c.parent.tableData[x.index]?.immediateChildCount}"
|
|
73132
73821
|
:groupColumn="${(x, c) => c.parent.tableData[x.index]?.groupColumn}"
|
|
73133
73822
|
?selectable="${(_, c) => c.parent.selectionMode === TableRowSelectionMode.multiple}"
|
|
@@ -73387,6 +74076,11 @@ focus outline in that case.
|
|
|
73387
74076
|
return horizontal ? el.scrollLeft * (isRtl && -1 || 1) : el.scrollTop;
|
|
73388
74077
|
});
|
|
73389
74078
|
const measureElement = (element, entry, instance) => {
|
|
74079
|
+
if (instance.options.useCachedMeasurements) {
|
|
74080
|
+
const index = instance.indexFromElement(element);
|
|
74081
|
+
const key = instance.options.getItemKey(index);
|
|
74082
|
+
return instance.itemSizeCache.get(key) ?? instance.options.estimateSize(index);
|
|
74083
|
+
}
|
|
73390
74084
|
if (entry == null ? void 0 : entry.borderBoxSize) {
|
|
73391
74085
|
const box = entry.borderBoxSize[0];
|
|
73392
74086
|
if (box) {
|
|
@@ -73396,6 +74090,14 @@ focus outline in that case.
|
|
|
73396
74090
|
return size;
|
|
73397
74091
|
}
|
|
73398
74092
|
}
|
|
74093
|
+
if (!entry) {
|
|
74094
|
+
const index = instance.indexFromElement(element);
|
|
74095
|
+
const key = instance.options.getItemKey(index);
|
|
74096
|
+
const cachedSize = instance.itemSizeCache.get(key);
|
|
74097
|
+
if (cachedSize !== void 0) {
|
|
74098
|
+
return cachedSize;
|
|
74099
|
+
}
|
|
74100
|
+
}
|
|
73399
74101
|
return element[instance.options.horizontal ? "offsetWidth" : "offsetHeight"];
|
|
73400
74102
|
};
|
|
73401
74103
|
const scrollWithAdjustments = (offset, {
|
|
@@ -73522,7 +74224,8 @@ focus outline in that case.
|
|
|
73522
74224
|
isRtl: false,
|
|
73523
74225
|
useScrollendEvent: false,
|
|
73524
74226
|
useAnimationFrameWithResizeObserver: false,
|
|
73525
|
-
laneAssignmentMode: "estimate"
|
|
74227
|
+
laneAssignmentMode: "estimate",
|
|
74228
|
+
useCachedMeasurements: false
|
|
73526
74229
|
};
|
|
73527
74230
|
for (const key in opts2) {
|
|
73528
74231
|
const v = opts2[key];
|
|
@@ -73531,6 +74234,7 @@ focus outline in that case.
|
|
|
73531
74234
|
const prevOptions = this.options;
|
|
73532
74235
|
let anchor = null;
|
|
73533
74236
|
let followOnAppend = null;
|
|
74237
|
+
let edgeKeysChanged = false;
|
|
73534
74238
|
if (prevOptions !== void 0 && prevOptions.enabled && merged.enabled && merged.anchorTo === "end" && this.scrollElement !== null) {
|
|
73535
74239
|
const prevCount = prevOptions.count;
|
|
73536
74240
|
const nextCount = merged.count;
|
|
@@ -73540,6 +74244,7 @@ focus outline in that case.
|
|
|
73540
74244
|
const didCountChange = nextCount !== prevCount;
|
|
73541
74245
|
const didEdgeKeysChange = didCountChange || prevCount > 0 && nextCount > 0 && (merged.getItemKey(0) !== prevFirstKey || merged.getItemKey(nextCount - 1) !== prevLastKey);
|
|
73542
74246
|
if (didEdgeKeysChange) {
|
|
74247
|
+
edgeKeysChanged = true;
|
|
73543
74248
|
const item = prevCount > 0 ? this.getVirtualItemForOffset(this.getScrollOffset()) ?? measurements[0] : null;
|
|
73544
74249
|
if (item) {
|
|
73545
74250
|
anchor = [item.key, this.getScrollOffset() - item.start];
|
|
@@ -73551,11 +74256,38 @@ focus outline in that case.
|
|
|
73551
74256
|
}
|
|
73552
74257
|
}
|
|
73553
74258
|
this.options = merged;
|
|
73554
|
-
if (
|
|
74259
|
+
if (edgeKeysChanged) {
|
|
74260
|
+
this.pendingMin = 0;
|
|
74261
|
+
this.itemSizeCacheVersion++;
|
|
74262
|
+
}
|
|
74263
|
+
let anchorResolved = false;
|
|
74264
|
+
let anchorDelta = 0;
|
|
74265
|
+
if (anchor && this.scrollOffset !== null) {
|
|
74266
|
+
const [anchorKey, anchorOffset] = anchor;
|
|
74267
|
+
const newMeasurements = this.getMeasurements();
|
|
74268
|
+
const { count, getItemKey } = this.options;
|
|
74269
|
+
let idx = 0;
|
|
74270
|
+
while (idx < count && getItemKey(idx) !== anchorKey) {
|
|
74271
|
+
idx++;
|
|
74272
|
+
}
|
|
74273
|
+
if (idx < count) {
|
|
74274
|
+
const anchorItem = newMeasurements[idx];
|
|
74275
|
+
if (anchorItem) {
|
|
74276
|
+
const newOffset = anchorItem.start + anchorOffset;
|
|
74277
|
+
if (newOffset !== this.scrollOffset) {
|
|
74278
|
+
anchorDelta = newOffset - this.scrollOffset;
|
|
74279
|
+
this.scrollOffset = newOffset;
|
|
74280
|
+
anchorResolved = true;
|
|
74281
|
+
}
|
|
74282
|
+
}
|
|
74283
|
+
}
|
|
74284
|
+
}
|
|
74285
|
+
if (anchorResolved || followOnAppend) {
|
|
73555
74286
|
this.pendingScrollAnchor = [
|
|
73556
|
-
|
|
73557
|
-
|
|
73558
|
-
followOnAppend
|
|
74287
|
+
anchorResolved ? anchor[0] : null,
|
|
74288
|
+
anchorResolved ? anchor[1] : 0,
|
|
74289
|
+
followOnAppend,
|
|
74290
|
+
anchorDelta
|
|
73559
74291
|
];
|
|
73560
74292
|
}
|
|
73561
74293
|
};
|
|
@@ -73692,19 +74424,17 @@ focus outline in that case.
|
|
|
73692
74424
|
const anchor = this.pendingScrollAnchor;
|
|
73693
74425
|
this.pendingScrollAnchor = null;
|
|
73694
74426
|
if (anchor && this.scrollElement && this.options.enabled) {
|
|
73695
|
-
const [key,
|
|
73696
|
-
if (key !== null) {
|
|
73697
|
-
|
|
73698
|
-
|
|
73699
|
-
|
|
73700
|
-
index++;
|
|
73701
|
-
}
|
|
73702
|
-
const item = index < count ? this.getMeasurements()[index] : void 0;
|
|
73703
|
-
if (item) {
|
|
73704
|
-
const delta = item.start + offset - this.getScrollOffset();
|
|
73705
|
-
if (!approxEqual(delta, 0)) {
|
|
73706
|
-
this.applyScrollAdjustment(delta);
|
|
74427
|
+
const [key, _offset, followOnAppend, anchorDelta] = anchor;
|
|
74428
|
+
if (key !== null && !followOnAppend) {
|
|
74429
|
+
if (isIOSWebKit() && (this.isScrolling || this._iosTouching || this._iosJustTouchEnded)) {
|
|
74430
|
+
if (anchorDelta !== 0) {
|
|
74431
|
+
this._iosDeferredAdjustment += anchorDelta;
|
|
73707
74432
|
}
|
|
74433
|
+
} else {
|
|
74434
|
+
this._scrollToOffset(this.getScrollOffset(), {
|
|
74435
|
+
adjustments: void 0,
|
|
74436
|
+
behavior: void 0
|
|
74437
|
+
});
|
|
73708
74438
|
}
|
|
73709
74439
|
}
|
|
73710
74440
|
if (followOnAppend) {
|
|
@@ -74072,13 +74802,13 @@ focus outline in that case.
|
|
|
74072
74802
|
delta,
|
|
74073
74803
|
this
|
|
74074
74804
|
) : (
|
|
74075
|
-
// Default: adjust
|
|
74076
|
-
//
|
|
74077
|
-
//
|
|
74078
|
-
//
|
|
74079
|
-
//
|
|
74080
|
-
//
|
|
74081
|
-
itemStart < this.getScrollOffset() + this.scrollAdjustments && this.scrollDirection !== "backward"
|
|
74805
|
+
// Default: adjust when the resize is an above-viewport item.
|
|
74806
|
+
// First measurement (!has(key)): always adjust — the item
|
|
74807
|
+
// has never been sized, so the estimate→actual delta must
|
|
74808
|
+
// be compensated regardless of scroll direction.
|
|
74809
|
+
// Re-measurement (has(key)): skip during backward scroll
|
|
74810
|
+
// to avoid the "items jump while scrolling up" cascade.
|
|
74811
|
+
itemStart < this.getScrollOffset() + this.scrollAdjustments && (!this.itemSizeCache.has(key) || this.scrollDirection !== "backward")
|
|
74082
74812
|
));
|
|
74083
74813
|
if (this.pendingMin === null || index < this.pendingMin) {
|
|
74084
74814
|
this.pendingMin = index;
|
|
@@ -74671,7 +75401,7 @@ focus outline in that case.
|
|
|
74671
75401
|
};
|
|
74672
75402
|
}
|
|
74673
75403
|
getGridTemplateColumns() {
|
|
74674
|
-
return this.
|
|
75404
|
+
return this.getUnpinnedVisibleColumns()
|
|
74675
75405
|
.map(column => {
|
|
74676
75406
|
const { minPixelWidth, currentPixelWidth, currentFractionalWidth } = column.columnInternals;
|
|
74677
75407
|
if (currentPixelWidth !== undefined) {
|
|
@@ -74697,7 +75427,7 @@ focus outline in that case.
|
|
|
74697
75427
|
this.activeColumnIndex = this.leftColumnIndex + (this.activeColumnDivider % 2);
|
|
74698
75428
|
this.dragStart = dragStart;
|
|
74699
75429
|
this.currentTotalDelta = 0;
|
|
74700
|
-
this.visibleColumns = this.
|
|
75430
|
+
this.visibleColumns = this.getUnpinnedVisibleColumns();
|
|
74701
75431
|
this.setColumnsToFixedSize();
|
|
74702
75432
|
this.initialTableScrollableWidth = this.table.viewport.scrollWidth;
|
|
74703
75433
|
this.initialTableScrollableMinWidth = this.table.tableScrollableMinWidth;
|
|
@@ -74768,7 +75498,7 @@ focus outline in that case.
|
|
|
74768
75498
|
*/
|
|
74769
75499
|
getFirstLeftResizableColumnIndex(columnIndex) {
|
|
74770
75500
|
const visibleColumns = this.visibleColumns.length === 0
|
|
74771
|
-
? this.
|
|
75501
|
+
? this.getUnpinnedVisibleColumns()
|
|
74772
75502
|
: this.visibleColumns;
|
|
74773
75503
|
for (let i = columnIndex; i >= 0; i--) {
|
|
74774
75504
|
const column = visibleColumns[i];
|
|
@@ -74788,7 +75518,7 @@ focus outline in that case.
|
|
|
74788
75518
|
*/
|
|
74789
75519
|
getFirstRightResizableColumnIndex(columnIndex) {
|
|
74790
75520
|
const visibleColumns = this.visibleColumns.length === 0
|
|
74791
|
-
? this.
|
|
75521
|
+
? this.getUnpinnedVisibleColumns()
|
|
74792
75522
|
: this.visibleColumns;
|
|
74793
75523
|
for (let i = columnIndex; i < visibleColumns.length; i++) {
|
|
74794
75524
|
const column = visibleColumns[i];
|
|
@@ -74885,8 +75615,9 @@ focus outline in that case.
|
|
|
74885
75615
|
}
|
|
74886
75616
|
}
|
|
74887
75617
|
}
|
|
74888
|
-
|
|
74889
|
-
return this.table.columns.filter(column => !column.columnHidden
|
|
75618
|
+
getUnpinnedVisibleColumns() {
|
|
75619
|
+
return this.table.columns.filter(column => !column.columnHidden
|
|
75620
|
+
&& column.columnInternals.pinLocation !== TableColumnPinLocation.left);
|
|
74890
75621
|
}
|
|
74891
75622
|
getLeftColumnIndexFromDivider(dividerIndex) {
|
|
74892
75623
|
return Math.floor(dividerIndex / 2);
|
|
@@ -74922,7 +75653,8 @@ focus outline in that case.
|
|
|
74922
75653
|
'columnDefinition',
|
|
74923
75654
|
'actionMenuSlots',
|
|
74924
75655
|
'selectionMode',
|
|
74925
|
-
'actionMenusPreserveSelection'
|
|
75656
|
+
'actionMenusPreserveSelection',
|
|
75657
|
+
'columnPinned'
|
|
74926
75658
|
];
|
|
74927
75659
|
/**
|
|
74928
75660
|
* Helper class to track what updates are needed to the table based on configuration
|
|
@@ -74981,6 +75713,7 @@ focus outline in that case.
|
|
|
74981
75713
|
return (this.isTracked('columnSortDisabled')
|
|
74982
75714
|
|| this.isTracked('columnDefinition')
|
|
74983
75715
|
|| this.isTracked('columnHidden')
|
|
75716
|
+
|| this.isTracked('columnPinned')
|
|
74984
75717
|
|| this.isTracked('selectionMode')
|
|
74985
75718
|
|| this.isTracked('actionMenuSlots'));
|
|
74986
75719
|
}
|
|
@@ -75012,6 +75745,10 @@ focus outline in that case.
|
|
|
75012
75745
|
this.track('columnWidths');
|
|
75013
75746
|
this.track('columnHidden');
|
|
75014
75747
|
}
|
|
75748
|
+
else if (isColumnInternalsProperty(changedColumnProperty, 'pinLocation')) {
|
|
75749
|
+
this.track('columnWidths');
|
|
75750
|
+
this.track('columnPinned');
|
|
75751
|
+
}
|
|
75015
75752
|
else if (isColumnProperty(changedColumnProperty, 'actionMenuSlot')) {
|
|
75016
75753
|
this.track('actionMenuSlots');
|
|
75017
75754
|
}
|
|
@@ -76713,6 +77450,34 @@ focus outline in that case.
|
|
|
76713
77450
|
}
|
|
76714
77451
|
return '';
|
|
76715
77452
|
}
|
|
77453
|
+
/**
|
|
77454
|
+
* @internal
|
|
77455
|
+
*/
|
|
77456
|
+
get pinnedColumnOffset() {
|
|
77457
|
+
let offset = 0;
|
|
77458
|
+
for (const column of this.pinnedColumns) {
|
|
77459
|
+
const resolvedPixelWidth = this.getPinnedColumnResolvedPixelWidth(column);
|
|
77460
|
+
if (resolvedPixelWidth !== undefined) {
|
|
77461
|
+
const coercedPixelWidth = Math.max(column.columnInternals.minPixelWidth, resolvedPixelWidth);
|
|
77462
|
+
offset += coercedPixelWidth;
|
|
77463
|
+
}
|
|
77464
|
+
}
|
|
77465
|
+
return offset;
|
|
77466
|
+
}
|
|
77467
|
+
/**
|
|
77468
|
+
* @internal
|
|
77469
|
+
*/
|
|
77470
|
+
get pinnedColumnsGridTemplateColumns() {
|
|
77471
|
+
return this.pinnedColumns.map(column => {
|
|
77472
|
+
const resolvedPixelWidth = this.getPinnedColumnResolvedPixelWidth(column);
|
|
77473
|
+
if (resolvedPixelWidth !== undefined) {
|
|
77474
|
+
const coercedPixelWidth = Math.max(column.columnInternals.minPixelWidth, resolvedPixelWidth);
|
|
77475
|
+
return `${coercedPixelWidth}px`;
|
|
77476
|
+
}
|
|
77477
|
+
return '';
|
|
77478
|
+
})
|
|
77479
|
+
.join(' ');
|
|
77480
|
+
}
|
|
76716
77481
|
/**
|
|
76717
77482
|
* @internal
|
|
76718
77483
|
*/
|
|
@@ -76763,6 +77528,10 @@ focus outline in that case.
|
|
|
76763
77528
|
* @internal
|
|
76764
77529
|
*/
|
|
76765
77530
|
this.visibleColumns = [];
|
|
77531
|
+
/**
|
|
77532
|
+
* @internal
|
|
77533
|
+
*/
|
|
77534
|
+
this.pinnedColumns = [];
|
|
76766
77535
|
/**
|
|
76767
77536
|
* @internal
|
|
76768
77537
|
* This value determines the size of the viewport area when a user has created horizontal scrollable
|
|
@@ -77115,7 +77884,10 @@ focus outline in that case.
|
|
|
77115
77884
|
}
|
|
77116
77885
|
if (this.tableUpdateTracker.updateColumnWidths) {
|
|
77117
77886
|
this.rowGridColumns = this.layoutManager.getGridTemplateColumns();
|
|
77118
|
-
this.visibleColumns = this.columns.filter(column => !column.columnHidden
|
|
77887
|
+
this.visibleColumns = this.columns.filter(column => !column.columnHidden
|
|
77888
|
+
&& column.columnInternals.pinLocation !== TableColumnPinLocation.left);
|
|
77889
|
+
this.pinnedColumns = this.columns.filter(column => !column.columnHidden
|
|
77890
|
+
&& column.columnInternals.pinLocation === TableColumnPinLocation.left);
|
|
77119
77891
|
}
|
|
77120
77892
|
if (this.tableUpdateTracker.requiresKeyboardFocusReset) {
|
|
77121
77893
|
this.keyboardNavigationManager.resetFocusState();
|
|
@@ -77193,6 +77965,10 @@ focus outline in that case.
|
|
|
77193
77965
|
this.observeColumns();
|
|
77194
77966
|
this.tableUpdateTracker.trackColumnInstancesChanged();
|
|
77195
77967
|
}
|
|
77968
|
+
getPinnedColumnResolvedPixelWidth(column) {
|
|
77969
|
+
const { currentPixelWidth } = column.columnInternals;
|
|
77970
|
+
return currentPixelWidth;
|
|
77971
|
+
}
|
|
77196
77972
|
updateRequestedSlotsForOpeningActionMenu(openActionMenuRecordId) {
|
|
77197
77973
|
for (const actionMenuSlot of this.actionMenuSlots) {
|
|
77198
77974
|
this.requestedSlots.set(actionMenuSlot, {
|
|
@@ -77367,6 +78143,7 @@ focus outline in that case.
|
|
|
77367
78143
|
this.tableValidator.validateColumnSortIndices(this.getColumnsParticipatingInSorting().map(x => x.columnInternals.currentSortIndex));
|
|
77368
78144
|
this.tableValidator.validateColumnGroupIndices(this.getColumnsParticipatingInGrouping().map(x => x.columnInternals.groupIndex));
|
|
77369
78145
|
this.tableValidator.validateColumnConfigurations(this.columns);
|
|
78146
|
+
this.tableValidator.validatePinnedColumnConfigurations(this.columns);
|
|
77370
78147
|
if (this.dataHierarchyManager) {
|
|
77371
78148
|
this.validateWithData(this.dataHierarchyManager.getAllRecords());
|
|
77372
78149
|
}
|
|
@@ -77639,12 +78416,21 @@ focus outline in that case.
|
|
|
77639
78416
|
__decorate([
|
|
77640
78417
|
volatile
|
|
77641
78418
|
], Table$1.prototype, "collapseButtonVisibility", null);
|
|
78419
|
+
__decorate([
|
|
78420
|
+
volatile
|
|
78421
|
+
], Table$1.prototype, "pinnedColumnOffset", null);
|
|
78422
|
+
__decorate([
|
|
78423
|
+
volatile
|
|
78424
|
+
], Table$1.prototype, "pinnedColumnsGridTemplateColumns", null);
|
|
77642
78425
|
__decorate([
|
|
77643
78426
|
observable
|
|
77644
78427
|
], Table$1.prototype, "firstSortedColumn", void 0);
|
|
77645
78428
|
__decorate([
|
|
77646
78429
|
observable
|
|
77647
78430
|
], Table$1.prototype, "visibleColumns", void 0);
|
|
78431
|
+
__decorate([
|
|
78432
|
+
observable
|
|
78433
|
+
], Table$1.prototype, "pinnedColumns", void 0);
|
|
77648
78434
|
__decorate([
|
|
77649
78435
|
observable
|
|
77650
78436
|
], Table$1.prototype, "tableScrollableMinWidth", void 0);
|
|
@@ -78943,6 +79729,23 @@ focus outline in that case.
|
|
|
78943
79729
|
|
|
78944
79730
|
const template$c = html `${template$g}<slot ${slotted('mappings')} name="mapping"></slot>`;
|
|
78945
79731
|
|
|
79732
|
+
// As the returned class is internal to the function, we can't write a signature that uses is directly, so rely on inference
|
|
79733
|
+
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/explicit-function-return-type
|
|
79734
|
+
function mixinPinnableColumnAPI(base) {
|
|
79735
|
+
/**
|
|
79736
|
+
* The Mixin that provides a concrete column with the API to allow pinning
|
|
79737
|
+
* a fixed-width column within a table.
|
|
79738
|
+
*/
|
|
79739
|
+
class PinnableColumn extends base {
|
|
79740
|
+
/** @internal */
|
|
79741
|
+
pinLocationChanged() {
|
|
79742
|
+
this.columnInternals.pinLocation = this.pinLocation;
|
|
79743
|
+
}
|
|
79744
|
+
}
|
|
79745
|
+
attr({ attribute: 'pin-location' })(PinnableColumn.prototype, 'pinLocation');
|
|
79746
|
+
return PinnableColumn;
|
|
79747
|
+
}
|
|
79748
|
+
|
|
78946
79749
|
const enumBaseValidityFlagNames = [
|
|
78947
79750
|
'invalidMappingKeyValueForType',
|
|
78948
79751
|
'duplicateMappingKey',
|
|
@@ -79331,7 +80134,7 @@ focus outline in that case.
|
|
|
79331
80134
|
* Table column that maps number, boolean, or string values to an icon, a spinner,
|
|
79332
80135
|
* text, or an icon/spinner with text.
|
|
79333
80136
|
*/
|
|
79334
|
-
class TableColumnMapping extends mixinGroupableColumnAPI(mixinFractionalWidthColumnAPI(mixinSortableColumnAPI((TableColumnEnumBase)))) {
|
|
80137
|
+
class TableColumnMapping extends mixinGroupableColumnAPI(mixinFractionalWidthColumnAPI(mixinPinnableColumnAPI(mixinSortableColumnAPI((TableColumnEnumBase))))) {
|
|
79335
80138
|
minPixelWidthChanged() {
|
|
79336
80139
|
if (this.widthMode !== TableColumnMappingWidthMode.iconSize) {
|
|
79337
80140
|
this.columnInternals.minPixelWidth = this.getConfiguredMinPixelWidth();
|
|
@@ -80408,6 +81211,8 @@ focus outline in that case.
|
|
|
80408
81211
|
outline: none;
|
|
80409
81212
|
${userSelectNone}
|
|
80410
81213
|
color: ${bodyFontColor};
|
|
81214
|
+
field-sizing: fixed;
|
|
81215
|
+
min-width: 100px;
|
|
80411
81216
|
flex-direction: column;
|
|
80412
81217
|
vertical-align: top;
|
|
80413
81218
|
--ni-private-hover-indicator-width: calc(${borderWidth} + 1px);
|
|
@@ -80439,6 +81244,7 @@ focus outline in that case.
|
|
|
80439
81244
|
display: flex;
|
|
80440
81245
|
justify-content: center;
|
|
80441
81246
|
position: relative;
|
|
81247
|
+
field-sizing: inherit;
|
|
80442
81248
|
height: 100%;
|
|
80443
81249
|
width: 100%;
|
|
80444
81250
|
}
|
|
@@ -80483,7 +81289,7 @@ focus outline in that case.
|
|
|
80483
81289
|
border-radius: 0px;
|
|
80484
81290
|
align-items: flex-end;
|
|
80485
81291
|
border: ${borderWidth} solid transparent;
|
|
80486
|
-
|
|
81292
|
+
field-sizing: inherit;
|
|
80487
81293
|
min-height: calc(${iconSize} + ${standardPadding});
|
|
80488
81294
|
padding: 8px;
|
|
80489
81295
|
${
|
|
@@ -80769,6 +81575,7 @@ focus outline in that case.
|
|
|
80769
81575
|
outline: none;
|
|
80770
81576
|
${userSelectNone}
|
|
80771
81577
|
color: ${bodyFontColor};
|
|
81578
|
+
field-sizing: fixed;
|
|
80772
81579
|
--ni-private-hover-indicator-width: calc(${borderWidth} + 1px);
|
|
80773
81580
|
--ni-private-height-within-border: calc(
|
|
80774
81581
|
${controlHeight} - 2 * ${borderWidth}
|
|
@@ -80803,6 +81610,7 @@ focus outline in that case.
|
|
|
80803
81610
|
display: flex;
|
|
80804
81611
|
flex-direction: row;
|
|
80805
81612
|
border-radius: 0px;
|
|
81613
|
+
field-sizing: inherit;
|
|
80806
81614
|
font: inherit;
|
|
80807
81615
|
align-items: center;
|
|
80808
81616
|
justify-content: center;
|
|
@@ -80881,6 +81689,7 @@ focus outline in that case.
|
|
|
80881
81689
|
background: transparent;
|
|
80882
81690
|
color: inherit;
|
|
80883
81691
|
padding: 0px;
|
|
81692
|
+
field-sizing: inherit;
|
|
80884
81693
|
height: var(--ni-private-height-within-border);
|
|
80885
81694
|
width: 100%;
|
|
80886
81695
|
margin-top: auto;
|