@ni/nimble-components 24.1.13 → 24.1.14

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.
Files changed (74) hide show
  1. package/dist/all-components-bundle.js +1620 -1340
  2. package/dist/all-components-bundle.js.map +1 -1
  3. package/dist/all-components-bundle.min.js +1814 -1784
  4. package/dist/all-components-bundle.min.js.map +1 -1
  5. package/dist/esm/anchor/index.js.map +1 -1
  6. package/dist/esm/anchor-button/index.js.map +1 -1
  7. package/dist/esm/anchor-menu-item/index.js.map +1 -1
  8. package/dist/esm/anchor-tab/index.js.map +1 -1
  9. package/dist/esm/anchor-tabs/index.js.map +1 -1
  10. package/dist/esm/anchor-tree-item/index.js.map +1 -1
  11. package/dist/esm/banner/index.js.map +1 -1
  12. package/dist/esm/breadcrumb/index.js.map +1 -1
  13. package/dist/esm/button/index.js.map +1 -1
  14. package/dist/esm/card-button/index.js.map +1 -1
  15. package/dist/esm/combobox/index.js.map +1 -1
  16. package/dist/esm/dialog/index.js.map +1 -1
  17. package/dist/esm/drawer/index.js.map +1 -1
  18. package/dist/esm/icon-base/index.js.map +1 -1
  19. package/dist/esm/label-provider/core/index.js.map +1 -1
  20. package/dist/esm/label-provider/rich-text/index.js.map +1 -1
  21. package/dist/esm/label-provider/table/index.js.map +1 -1
  22. package/dist/esm/list-option/index.js.map +1 -1
  23. package/dist/esm/mapping/base/index.js.map +1 -1
  24. package/dist/esm/mapping/icon/index.js.map +1 -1
  25. package/dist/esm/mapping/spinner/index.js.map +1 -1
  26. package/dist/esm/mapping/text/index.js.map +1 -1
  27. package/dist/esm/mapping/user/index.js.map +1 -1
  28. package/dist/esm/menu-button/index.js.map +1 -1
  29. package/dist/esm/number-field/index.js.map +1 -1
  30. package/dist/esm/rich-text/base/index.js.map +1 -1
  31. package/dist/esm/rich-text/editor/index.js.map +1 -1
  32. package/dist/esm/rich-text/mention-listbox/index.js.map +1 -1
  33. package/dist/esm/rich-text/models/markdown-parser.js.map +1 -1
  34. package/dist/esm/rich-text/viewer/index.js.map +1 -1
  35. package/dist/esm/rich-text-mention/base/index.js.map +1 -1
  36. package/dist/esm/rich-text-mention/base/models/mention-internals.js.map +1 -1
  37. package/dist/esm/rich-text-mention/base/view/index.js.map +1 -1
  38. package/dist/esm/select/index.js.map +1 -1
  39. package/dist/esm/spinner/index.js.map +1 -1
  40. package/dist/esm/table/components/cell/index.js.map +1 -1
  41. package/dist/esm/table/components/group-row/index.js.map +1 -1
  42. package/dist/esm/table/components/header/index.js.map +1 -1
  43. package/dist/esm/table/components/row/index.js.map +1 -1
  44. package/dist/esm/table/index.js.map +1 -1
  45. package/dist/esm/table/models/table-layout-manager.js.map +1 -1
  46. package/dist/esm/table/models/virtualizer.js.map +1 -1
  47. package/dist/esm/table-column/anchor/cell-view/index.js.map +1 -1
  48. package/dist/esm/table-column/anchor/index.js.map +1 -1
  49. package/dist/esm/table-column/base/cell-view/index.js.map +1 -1
  50. package/dist/esm/table-column/base/group-header-view/index.js.map +1 -1
  51. package/dist/esm/table-column/base/index.js.map +1 -1
  52. package/dist/esm/table-column/base/models/column-internals.js.map +1 -1
  53. package/dist/esm/table-column/base/models/column-validator.js.map +1 -1
  54. package/dist/esm/table-column/date-text/index.js.map +1 -1
  55. package/dist/esm/table-column/enum-base/index.js.map +1 -1
  56. package/dist/esm/table-column/icon/cell-view/index.js.map +1 -1
  57. package/dist/esm/table-column/icon/group-header-view/index.js.map +1 -1
  58. package/dist/esm/table-column/number-text/index.js.map +1 -1
  59. package/dist/esm/table-column/text-base/cell-view/index.js.map +1 -1
  60. package/dist/esm/table-column/text-base/group-header-view/index.js.map +1 -1
  61. package/dist/esm/table-column/text-base/index.js.map +1 -1
  62. package/dist/esm/text-area/index.js.map +1 -1
  63. package/dist/esm/text-field/index.js.map +1 -1
  64. package/dist/esm/theme-provider/index.js.map +1 -1
  65. package/dist/esm/toggle-button/index.js.map +1 -1
  66. package/dist/esm/tooltip/index.js.map +1 -1
  67. package/dist/esm/tree-item/index.js.map +1 -1
  68. package/dist/esm/tree-view/index.js.map +1 -1
  69. package/dist/esm/unit/base/unit.js.map +1 -1
  70. package/dist/esm/unit/byte/index.js.map +1 -1
  71. package/dist/esm/utilities/models/document-element-lang.js.map +1 -1
  72. package/dist/esm/utilities/unit-format/default-unit-format.js.map +1 -1
  73. package/dist/esm/wafer-map/index.js.map +1 -1
  74. package/package.json +4 -4
@@ -16333,7 +16333,7 @@
16333
16333
 
16334
16334
  /**
16335
16335
  * Do not edit directly
16336
- * Generated on Wed, 10 Apr 2024 21:43:42 GMT
16336
+ * Generated on Mon, 15 Apr 2024 17:21:28 GMT
16337
16337
  */
16338
16338
 
16339
16339
  const Information100DarkUi = "#a46eff";
@@ -28524,6 +28524,8 @@
28524
28524
  return found;
28525
28525
  }
28526
28526
 
28527
+ function isTagRule(rule) { return rule.tag != null; }
28528
+ function isStyleRule(rule) { return rule.style != null; }
28527
28529
  /**
28528
28530
  A DOM parser represents a strategy for parsing DOM content into a
28529
28531
  ProseMirror document conforming to a given schema. Its behavior is
@@ -28555,9 +28557,9 @@
28555
28557
  */
28556
28558
  this.styles = [];
28557
28559
  rules.forEach(rule => {
28558
- if (rule.tag)
28560
+ if (isTagRule(rule))
28559
28561
  this.tags.push(rule);
28560
- else if (rule.style)
28562
+ else if (isStyleRule(rule))
28561
28563
  this.styles.push(rule);
28562
28564
  });
28563
28565
  // Only normalize list elements when lists in the schema can't directly contain themselves
@@ -32551,6 +32553,9 @@
32551
32553
  range.setStart(node, from || 0);
32552
32554
  return range;
32553
32555
  };
32556
+ const clearReusedRange = function () {
32557
+ reusedRange = null;
32558
+ };
32554
32559
  // Scans forward and backward through DOM positions equivalent to the
32555
32560
  // given one to see if the two are in the same place (i.e. after a
32556
32561
  // text node vs at the end of that text node)
@@ -32585,6 +32590,44 @@
32585
32590
  function nodeSize(node) {
32586
32591
  return node.nodeType == 3 ? node.nodeValue.length : node.childNodes.length;
32587
32592
  }
32593
+ function textNodeBefore$1(node, offset) {
32594
+ for (;;) {
32595
+ if (node.nodeType == 3 && offset)
32596
+ return node;
32597
+ if (node.nodeType == 1 && offset > 0) {
32598
+ if (node.contentEditable == "false")
32599
+ return null;
32600
+ node = node.childNodes[offset - 1];
32601
+ offset = nodeSize(node);
32602
+ }
32603
+ else if (node.parentNode && !hasBlockDesc(node)) {
32604
+ offset = domIndex(node);
32605
+ node = node.parentNode;
32606
+ }
32607
+ else {
32608
+ return null;
32609
+ }
32610
+ }
32611
+ }
32612
+ function textNodeAfter$1(node, offset) {
32613
+ for (;;) {
32614
+ if (node.nodeType == 3 && offset < node.nodeValue.length)
32615
+ return node;
32616
+ if (node.nodeType == 1 && offset < node.childNodes.length) {
32617
+ if (node.contentEditable == "false")
32618
+ return null;
32619
+ node = node.childNodes[offset];
32620
+ offset = 0;
32621
+ }
32622
+ else if (node.parentNode && !hasBlockDesc(node)) {
32623
+ offset = domIndex(node) + 1;
32624
+ node = node.parentNode;
32625
+ }
32626
+ else {
32627
+ return null;
32628
+ }
32629
+ }
32630
+ }
32588
32631
  function isOnEdge(node, offset, parent) {
32589
32632
  for (let atStart = offset == 0, atEnd = offset == nodeSize(node); atStart || atEnd;) {
32590
32633
  if (node == parent)
@@ -32661,6 +32704,12 @@
32661
32704
  const webkit_version = webkit ? +(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent) || [0, 0])[1] : 0;
32662
32705
 
32663
32706
  function windowRect(doc) {
32707
+ let vp = doc.defaultView && doc.defaultView.visualViewport;
32708
+ if (vp)
32709
+ return {
32710
+ left: 0, right: vp.width,
32711
+ top: 0, bottom: vp.height
32712
+ };
32664
32713
  return { left: 0, right: doc.documentElement.clientWidth,
32665
32714
  top: 0, bottom: doc.documentElement.clientHeight };
32666
32715
  }
@@ -33596,6 +33645,7 @@
33596
33645
  }
33597
33646
  get domAtom() { return false; }
33598
33647
  get ignoreForCoords() { return false; }
33648
+ isText(text) { return false; }
33599
33649
  }
33600
33650
  // A widget desc represents a widget decoration, which is a DOM node
33601
33651
  // drawn between the document nodes.
@@ -33858,8 +33908,7 @@
33858
33908
  let { from, to } = view.state.selection;
33859
33909
  if (!(view.state.selection instanceof TextSelection) || from < pos || to > pos + this.node.content.size)
33860
33910
  return null;
33861
- let sel = view.domSelectionRange();
33862
- let textNode = nearbyTextNode(sel.focusNode, sel.focusOffset);
33911
+ let textNode = view.input.compositionNode;
33863
33912
  if (!textNode || !this.dom.contains(textNode.parentNode))
33864
33913
  return null;
33865
33914
  if (this.node.inlineContent) {
@@ -34001,6 +34050,7 @@
34001
34050
  this.dirty = NODE_DIRTY;
34002
34051
  }
34003
34052
  get domAtom() { return false; }
34053
+ isText(text) { return this.node.text == text; }
34004
34054
  }
34005
34055
  // A dummy desc used to tag trailing BR or IMG nodes created to work
34006
34056
  // around contentEditable terribleness.
@@ -34570,25 +34620,6 @@
34570
34620
  dom.style.cssText = oldCSS;
34571
34621
  }
34572
34622
  }
34573
- function nearbyTextNode(node, offset) {
34574
- for (;;) {
34575
- if (node.nodeType == 3)
34576
- return node;
34577
- if (node.nodeType == 1 && offset > 0) {
34578
- if (node.childNodes.length > offset && node.childNodes[offset].nodeType == 3)
34579
- return node.childNodes[offset];
34580
- node = node.childNodes[offset - 1];
34581
- offset = nodeSize(node);
34582
- }
34583
- else if (node.nodeType == 1 && offset < node.childNodes.length) {
34584
- node = node.childNodes[offset];
34585
- offset = 0;
34586
- }
34587
- else {
34588
- return null;
34589
- }
34590
- }
34591
- }
34592
34623
  // Find a piece of text in an inline fragment, overlapping from-to
34593
34624
  function findTextInFragment(frag, text, from, to) {
34594
34625
  for (let i = 0, pos = 0; i < frag.childCount && pos <= to;) {
@@ -35493,6 +35524,7 @@
35493
35524
  this.lastTouch = 0;
35494
35525
  this.lastAndroidDelete = 0;
35495
35526
  this.composing = false;
35527
+ this.compositionNode = null;
35496
35528
  this.composingTimeout = -1;
35497
35529
  this.compositionNodes = [];
35498
35530
  this.compositionEndedAt = -2e8;
@@ -35929,6 +35961,7 @@
35929
35961
  view.input.composing = false;
35930
35962
  view.input.compositionEndedAt = event.timeStamp;
35931
35963
  view.input.compositionPendingChanges = view.domObserver.pendingRecords().length ? view.input.compositionID : 0;
35964
+ view.input.compositionNode = null;
35932
35965
  if (view.input.compositionPendingChanges)
35933
35966
  Promise.resolve().then(() => view.domObserver.flush());
35934
35967
  view.input.compositionID++;
@@ -35948,6 +35981,25 @@
35948
35981
  while (view.input.compositionNodes.length > 0)
35949
35982
  view.input.compositionNodes.pop().markParentsDirty();
35950
35983
  }
35984
+ function findCompositionNode(view) {
35985
+ let sel = view.domSelectionRange();
35986
+ if (!sel.focusNode)
35987
+ return null;
35988
+ let textBefore = textNodeBefore$1(sel.focusNode, sel.focusOffset);
35989
+ let textAfter = textNodeAfter$1(sel.focusNode, sel.focusOffset);
35990
+ if (textBefore && textAfter && textBefore != textAfter) {
35991
+ let descAfter = textAfter.pmViewDesc;
35992
+ if (!descAfter || !descAfter.isText(textAfter.nodeValue)) {
35993
+ return textAfter;
35994
+ }
35995
+ else if (view.input.compositionNode == textAfter) {
35996
+ let descBefore = textBefore.pmViewDesc;
35997
+ if (!(!descBefore || !descBefore.isText(textBefore.nodeValue)))
35998
+ return textAfter;
35999
+ }
36000
+ }
36001
+ return textBefore;
36002
+ }
35951
36003
  function timestampFromCustomEvent() {
35952
36004
  let event = document.createEvent("Event");
35953
36005
  event.initEvent("event", true, true);
@@ -37182,9 +37234,25 @@
37182
37234
  cssCheckWarned = true;
37183
37235
  }
37184
37236
  }
37237
+ function rangeToSelectionRange(view, range) {
37238
+ let anchorNode = range.startContainer, anchorOffset = range.startOffset;
37239
+ let focusNode = range.endContainer, focusOffset = range.endOffset;
37240
+ let currentAnchor = view.domAtPos(view.state.selection.anchor);
37241
+ // Since such a range doesn't distinguish between anchor and head,
37242
+ // use a heuristic that flips it around if its end matches the
37243
+ // current anchor.
37244
+ if (isEquivalentPosition(currentAnchor.node, currentAnchor.offset, focusNode, focusOffset))
37245
+ [anchorNode, anchorOffset, focusNode, focusOffset] = [focusNode, focusOffset, anchorNode, anchorOffset];
37246
+ return { anchorNode, anchorOffset, focusNode, focusOffset };
37247
+ }
37185
37248
  // Used to work around a Safari Selection/shadow DOM bug
37186
37249
  // Based on https://github.com/codemirror/dev/issues/414 fix
37187
- function safariShadowSelectionRange(view) {
37250
+ function safariShadowSelectionRange(view, selection) {
37251
+ if (selection.getComposedRanges) {
37252
+ let range = selection.getComposedRanges(view.root)[0];
37253
+ if (range)
37254
+ return rangeToSelectionRange(view, range);
37255
+ }
37188
37256
  let found;
37189
37257
  function read(event) {
37190
37258
  event.preventDefault();
@@ -37199,15 +37267,7 @@
37199
37267
  view.dom.addEventListener("beforeinput", read, true);
37200
37268
  document.execCommand("indent");
37201
37269
  view.dom.removeEventListener("beforeinput", read, true);
37202
- let anchorNode = found.startContainer, anchorOffset = found.startOffset;
37203
- let focusNode = found.endContainer, focusOffset = found.endOffset;
37204
- let currentAnchor = view.domAtPos(view.state.selection.anchor);
37205
- // Since such a range doesn't distinguish between anchor and head,
37206
- // use a heuristic that flips it around if its end matches the
37207
- // current anchor.
37208
- if (isEquivalentPosition(currentAnchor.node, currentAnchor.offset, focusNode, focusOffset))
37209
- [anchorNode, anchorOffset, focusNode, focusOffset] = [focusNode, focusOffset, anchorNode, anchorOffset];
37210
- return { anchorNode, anchorOffset, focusNode, focusOffset };
37270
+ return found ? rangeToSelectionRange(view, found) : null;
37211
37271
  }
37212
37272
 
37213
37273
  // Note that all referencing and parsing is done with the
@@ -37350,13 +37410,6 @@
37350
37410
  return;
37351
37411
  }
37352
37412
  }
37353
- // Chrome sometimes leaves the cursor before the inserted text when
37354
- // composing after a cursor wrapper. This moves it forward.
37355
- if (chrome && view.cursorWrapper && parse.sel && parse.sel.anchor == view.cursorWrapper.deco.from &&
37356
- parse.sel.head == parse.sel.anchor) {
37357
- let size = change.endB - change.start;
37358
- parse.sel = { anchor: parse.sel.anchor + size, head: parse.sel.anchor + size };
37359
- }
37360
37413
  view.input.domChangeCount++;
37361
37414
  // Handle the case where overwriting a selection by typing matches
37362
37415
  // the start or end of the selected content, creating a change
@@ -37402,7 +37455,7 @@
37402
37455
  }
37403
37456
  // Same for backspace
37404
37457
  if (view.state.selection.anchor > change.start &&
37405
- looksLikeJoin(doc, change.start, change.endA, $from, $to) &&
37458
+ looksLikeBackspace(doc, change.start, change.endA, $from, $to) &&
37406
37459
  view.someProp("handleKeyDown", f => f(view, keyEvent(8, "Backspace")))) {
37407
37460
  if (android && chrome)
37408
37461
  view.domObserver.suppressSelectionUpdates(); // #820
@@ -37514,14 +37567,18 @@
37514
37567
  if (Fragment.from(updated).eq(cur))
37515
37568
  return { mark, type };
37516
37569
  }
37517
- function looksLikeJoin(old, start, end, $newStart, $newEnd) {
37518
- if (!$newStart.parent.isTextblock ||
37519
- // The content must have shrunk
37520
- end - start <= $newEnd.pos - $newStart.pos ||
37570
+ function looksLikeBackspace(old, start, end, $newStart, $newEnd) {
37571
+ if ( // The content must have shrunk
37572
+ end - start <= $newEnd.pos - $newStart.pos ||
37521
37573
  // newEnd must point directly at or after the end of the block that newStart points into
37522
37574
  skipClosingAndOpening($newStart, true, false) < $newEnd.pos)
37523
37575
  return false;
37524
37576
  let $start = old.resolve(start);
37577
+ // Handle the case where, rather than joining blocks, the change just removed an entire block
37578
+ if (!$newStart.parent.isTextblock) {
37579
+ let after = $start.nodeAfter;
37580
+ return after != null && end == start + after.nodeSize;
37581
+ }
37525
37582
  // Start must be at the end of a block
37526
37583
  if ($start.parentOffset < $start.parent.content.size || !$start.parent.isTextblock)
37527
37584
  return false;
@@ -37759,8 +37816,10 @@
37759
37816
  // tracks that and forces a selection reset when our update
37760
37817
  // did write to the node.
37761
37818
  let chromeKludge = chrome ? (this.trackWrites = this.domSelectionRange().focusNode) : null;
37819
+ if (this.composing)
37820
+ this.input.compositionNode = findCompositionNode(this);
37762
37821
  if (redraw || !this.docView.update(state.doc, outerDeco, innerDeco, this)) {
37763
- this.docView.updateOuterDeco([]);
37822
+ this.docView.updateOuterDeco(outerDeco);
37764
37823
  this.docView.destroy();
37765
37824
  this.docView = docViewDesc(state.doc, outerDeco, innerDeco, this.dom, this);
37766
37825
  }
@@ -38037,6 +38096,7 @@
38037
38096
  }
38038
38097
  this.docView.destroy();
38039
38098
  this.docView = null;
38099
+ clearReusedRange();
38040
38100
  }
38041
38101
  /**
38042
38102
  This is true when the view has been
@@ -38072,8 +38132,9 @@
38072
38132
  @internal
38073
38133
  */
38074
38134
  domSelectionRange() {
38075
- return safari && this.root.nodeType === 11 && deepActiveElement(this.dom.ownerDocument) == this.dom
38076
- ? safariShadowSelectionRange(this) : this.domSelection();
38135
+ let sel = this.domSelection();
38136
+ return safari && this.root.nodeType === 11 &&
38137
+ deepActiveElement(this.dom.ownerDocument) == this.dom && safariShadowSelectionRange(this, sel) || sel;
38077
38138
  }
38078
38139
  /**
38079
38140
  @internal
@@ -39737,6 +39798,23 @@
39737
39798
  if (stored) {
39738
39799
  return stored;
39739
39800
  }
39801
+ // if InputRule is triggered by insertContent()
39802
+ const simulatedInputMeta = tr.getMeta('applyInputRules');
39803
+ const isSimulatedInput = !!simulatedInputMeta;
39804
+ if (isSimulatedInput) {
39805
+ setTimeout(() => {
39806
+ const { from, text } = simulatedInputMeta;
39807
+ const to = from + text.length;
39808
+ run$1$1({
39809
+ editor,
39810
+ from,
39811
+ to,
39812
+ text,
39813
+ rules,
39814
+ plugin,
39815
+ });
39816
+ });
39817
+ }
39740
39818
  return tr.selectionSet || tr.docChanged ? null : prev;
39741
39819
  },
39742
39820
  },
@@ -39868,6 +39946,14 @@
39868
39946
  const success = handlers.every(handler => handler !== null);
39869
39947
  return success;
39870
39948
  }
39949
+ const createClipboardPasteEvent = (text) => {
39950
+ var _a;
39951
+ const event = new ClipboardEvent('paste', {
39952
+ clipboardData: new DataTransfer(),
39953
+ });
39954
+ (_a = event.clipboardData) === null || _a === void 0 ? void 0 : _a.setData('text/html', text);
39955
+ return event;
39956
+ };
39871
39957
  /**
39872
39958
  * Create an paste rules plugin. When enabled, it will cause pasted
39873
39959
  * text that matches any of the given rules to trigger the rule’s
@@ -39880,6 +39966,28 @@
39880
39966
  let isDroppedFromProseMirror = false;
39881
39967
  let pasteEvent = typeof ClipboardEvent !== 'undefined' ? new ClipboardEvent('paste') : null;
39882
39968
  let dropEvent = typeof DragEvent !== 'undefined' ? new DragEvent('drop') : null;
39969
+ const processEvent = ({ state, from, to, rule, pasteEvt, }) => {
39970
+ const tr = state.tr;
39971
+ const chainableState = createChainableState({
39972
+ state,
39973
+ transaction: tr,
39974
+ });
39975
+ const handler = run$2({
39976
+ editor,
39977
+ state: chainableState,
39978
+ from: Math.max(from - 1, 0),
39979
+ to: to.b - 1,
39980
+ rule,
39981
+ pasteEvent: pasteEvt,
39982
+ dropEvent,
39983
+ });
39984
+ if (!handler || !tr.steps.length) {
39985
+ return;
39986
+ }
39987
+ dropEvent = typeof DragEvent !== 'undefined' ? new DragEvent('drop') : null;
39988
+ pasteEvent = typeof ClipboardEvent !== 'undefined' ? new ClipboardEvent('paste') : null;
39989
+ return tr;
39990
+ };
39883
39991
  const plugins = rules.map(rule => {
39884
39992
  return new Plugin({
39885
39993
  // we register a global drag handler to track the current drag source element
@@ -39917,38 +40025,39 @@
39917
40025
  const transaction = transactions[0];
39918
40026
  const isPaste = transaction.getMeta('uiEvent') === 'paste' && !isPastedFromProseMirror;
39919
40027
  const isDrop = transaction.getMeta('uiEvent') === 'drop' && !isDroppedFromProseMirror;
39920
- if (!isPaste && !isDrop) {
40028
+ // if PasteRule is triggered by insertContent()
40029
+ const simulatedPasteMeta = transaction.getMeta('applyPasteRules');
40030
+ const isSimulatedPaste = !!simulatedPasteMeta;
40031
+ if (!isPaste && !isDrop && !isSimulatedPaste) {
39921
40032
  return;
39922
40033
  }
39923
- // stop if there is no changed range
40034
+ // Handle simulated paste
40035
+ if (isSimulatedPaste) {
40036
+ const { from, text } = simulatedPasteMeta;
40037
+ const to = from + text.length;
40038
+ const pasteEvt = createClipboardPasteEvent(text);
40039
+ return processEvent({
40040
+ rule,
40041
+ state,
40042
+ from,
40043
+ to: { b: to },
40044
+ pasteEvt,
40045
+ });
40046
+ }
40047
+ // handle actual paste/drop
39924
40048
  const from = oldState.doc.content.findDiffStart(state.doc.content);
39925
40049
  const to = oldState.doc.content.findDiffEnd(state.doc.content);
40050
+ // stop if there is no changed range
39926
40051
  if (!isNumber$1(from) || !to || from === to.b) {
39927
40052
  return;
39928
40053
  }
39929
- // build a chainable state
39930
- // so we can use a single transaction for all paste rules
39931
- const tr = state.tr;
39932
- const chainableState = createChainableState({
39933
- state,
39934
- transaction: tr,
39935
- });
39936
- const handler = run$2({
39937
- editor,
39938
- state: chainableState,
39939
- from: Math.max(from - 1, 0),
39940
- to: to.b - 1,
40054
+ return processEvent({
39941
40055
  rule,
39942
- pasteEvent,
39943
- dropEvent,
40056
+ state,
40057
+ from,
40058
+ to,
40059
+ pasteEvt: pasteEvent,
39944
40060
  });
39945
- // stop if there are no changes
39946
- if (!handler || !tr.steps.length) {
39947
- return;
39948
- }
39949
- dropEvent = typeof DragEvent !== 'undefined' ? new DragEvent('drop') : null;
39950
- pasteEvent = typeof ClipboardEvent !== 'undefined' ? new ClipboardEvent('paste') : null;
39951
- return tr;
39952
40061
  },
39953
40062
  });
39954
40063
  });
@@ -40292,8 +40401,10 @@
40292
40401
  range,
40293
40402
  });
40294
40403
  }
40404
+ // do not descend into child nodes when there exists a serializer
40405
+ return false;
40295
40406
  }
40296
- else if (node.isText) {
40407
+ if (node.isText) {
40297
40408
  text += (_a = node === null || node === void 0 ? void 0 : node.text) === null || _a === void 0 ? void 0 : _a.slice(Math.max(from, pos) - pos, to - pos); // eslint-disable-line
40298
40409
  separated = false;
40299
40410
  }
@@ -40313,6 +40424,11 @@
40313
40424
 
40314
40425
  const ClipboardTextSerializer = Extension.create({
40315
40426
  name: 'clipboardTextSerializer',
40427
+ addOptions() {
40428
+ return {
40429
+ blockSeparator: undefined,
40430
+ };
40431
+ },
40316
40432
  addProseMirrorPlugins() {
40317
40433
  return [
40318
40434
  new Plugin({
@@ -40328,6 +40444,9 @@
40328
40444
  const textSerializers = getTextSerializersFromSchema(schema);
40329
40445
  const range = { from, to };
40330
40446
  return getTextBetween(doc, range, {
40447
+ ...(this.options.blockSeparator !== undefined
40448
+ ? { blockSeparator: this.options.blockSeparator }
40449
+ : {}),
40331
40450
  textSerializers,
40332
40451
  });
40333
40452
  },
@@ -40734,6 +40853,8 @@
40734
40853
  options = {
40735
40854
  parseOptions: {},
40736
40855
  updateSelection: true,
40856
+ applyInputRules: false,
40857
+ applyPasteRules: false,
40737
40858
  ...options,
40738
40859
  };
40739
40860
  const content = createNodeFromContent(value, editor.schema, {
@@ -40769,28 +40890,37 @@
40769
40890
  to += 1;
40770
40891
  }
40771
40892
  }
40893
+ let newContent;
40772
40894
  // if there is only plain text we have to use `insertText`
40773
40895
  // because this will keep the current marks
40774
40896
  if (isOnlyTextContent) {
40775
40897
  // if value is string, we can use it directly
40776
40898
  // otherwise if it is an array, we have to join it
40777
40899
  if (Array.isArray(value)) {
40778
- tr.insertText(value.map(v => v.text || '').join(''), from, to);
40900
+ newContent = value.map(v => v.text || '').join('');
40779
40901
  }
40780
40902
  else if (typeof value === 'object' && !!value && !!value.text) {
40781
- tr.insertText(value.text, from, to);
40903
+ newContent = value.text;
40782
40904
  }
40783
40905
  else {
40784
- tr.insertText(value, from, to);
40906
+ newContent = value;
40785
40907
  }
40908
+ tr.insertText(newContent, from, to);
40786
40909
  }
40787
40910
  else {
40788
- tr.replaceWith(from, to, content);
40911
+ newContent = content;
40912
+ tr.replaceWith(from, to, newContent);
40789
40913
  }
40790
40914
  // set cursor at end of inserted content
40791
40915
  if (options.updateSelection) {
40792
40916
  selectionToInsertionEnd(tr, tr.steps.length - 1, -1);
40793
40917
  }
40918
+ if (options.applyInputRules) {
40919
+ tr.setMeta('applyInputRules', { from, text: newContent });
40920
+ }
40921
+ if (options.applyPasteRules) {
40922
+ tr.setMeta('applyPasteRules', { from, text: newContent });
40923
+ }
40794
40924
  }
40795
40925
  return true;
40796
40926
  };
@@ -42117,7 +42247,7 @@
42117
42247
  const { selection, doc } = tr;
42118
42248
  const { empty, $anchor } = selection;
42119
42249
  const { pos, parent } = $anchor;
42120
- const $parentPos = $anchor.parent.isTextblock ? tr.doc.resolve(pos - 1) : $anchor;
42250
+ const $parentPos = $anchor.parent.isTextblock && pos > 0 ? tr.doc.resolve(pos - 1) : $anchor;
42121
42251
  const parentIsIsolating = $parentPos.parent.type.spec.isolating;
42122
42252
  const parentPos = $anchor.pos - $anchor.parentOffset;
42123
42253
  const isAtStart = (parentIsIsolating && $parentPos.parent.childCount === 1)
@@ -42233,16 +42363,6 @@
42233
42363
  },
42234
42364
  });
42235
42365
 
42236
- var extensions = /*#__PURE__*/Object.freeze({
42237
- __proto__: null,
42238
- ClipboardTextSerializer: ClipboardTextSerializer,
42239
- Commands: Commands,
42240
- Editable: Editable,
42241
- FocusEvents: FocusEvents,
42242
- Keymap: Keymap,
42243
- Tabindex: Tabindex
42244
- });
42245
-
42246
42366
  class NodePos {
42247
42367
  constructor(pos, editor, isBlock = false, node = null) {
42248
42368
  this.currentNode = null;
@@ -42337,7 +42457,7 @@
42337
42457
  const children = [];
42338
42458
  this.node.content.forEach((node, offset) => {
42339
42459
  const isBlock = node.isBlock && !node.isTextblock;
42340
- const targetPos = this.pos + offset + (isBlock ? 0 : 1);
42460
+ const targetPos = this.pos + offset + 1;
42341
42461
  const $pos = this.resolvedPos.doc.resolve(targetPos);
42342
42462
  if (!isBlock && $pos.depth <= this.depth) {
42343
42463
  return;
@@ -42386,7 +42506,7 @@
42386
42506
  querySelectorAll(selector, attributes = {}, firstItemOnly = false) {
42387
42507
  let nodes = [];
42388
42508
  // iterate through children recursively finding all nodes which match the selector with the node name
42389
- if (this.isBlock || !this.children || this.children.length === 0) {
42509
+ if (!this.children || this.children.length === 0) {
42390
42510
  return nodes;
42391
42511
  }
42392
42512
  this.children.forEach(childPos => {
@@ -42523,6 +42643,7 @@ img.ProseMirror-separator {
42523
42643
  editable: true,
42524
42644
  editorProps: {},
42525
42645
  parseOptions: {},
42646
+ coreExtensionOptions: {},
42526
42647
  enableInputRules: true,
42527
42648
  enablePasteRules: true,
42528
42649
  enableCoreExtensions: true,
@@ -42668,7 +42789,17 @@ img.ProseMirror-separator {
42668
42789
  * Creates an extension manager.
42669
42790
  */
42670
42791
  createExtensionManager() {
42671
- const coreExtensions = this.options.enableCoreExtensions ? Object.values(extensions) : [];
42792
+ var _a, _b;
42793
+ const coreExtensions = this.options.enableCoreExtensions ? [
42794
+ Editable,
42795
+ ClipboardTextSerializer.configure({
42796
+ blockSeparator: (_b = (_a = this.options.coreExtensionOptions) === null || _a === void 0 ? void 0 : _a.clipboardTextSerializer) === null || _b === void 0 ? void 0 : _b.blockSeparator,
42797
+ }),
42798
+ Commands,
42799
+ FocusEvents,
42800
+ Keymap,
42801
+ Tabindex,
42802
+ ] : [];
42672
42803
  const allExtensions = [...coreExtensions, ...this.options.extensions].filter(extension => {
42673
42804
  return ['extension', 'node', 'mark'].includes(extension === null || extension === void 0 ? void 0 : extension.type);
42674
42805
  });
@@ -45272,7 +45403,7 @@ img.ProseMirror-separator {
45272
45403
 
45273
45404
  // Currently without astral characters support.
45274
45405
  function isPunctChar (ch) {
45275
- return P.test(ch)
45406
+ return P.test(ch) || regex.test(ch)
45276
45407
  }
45277
45408
 
45278
45409
  // Markdown ASCII punctuation characters.
@@ -45461,7 +45592,6 @@ img.ProseMirror-separator {
45461
45592
  const result = {
45462
45593
  ok: false,
45463
45594
  pos: 0,
45464
- lines: 0,
45465
45595
  str: ''
45466
45596
  };
45467
45597
 
@@ -45532,52 +45662,66 @@ img.ProseMirror-separator {
45532
45662
  //
45533
45663
 
45534
45664
 
45535
- function parseLinkTitle (str, start, max) {
45536
- let code, marker;
45537
- let lines = 0;
45665
+ // Parse link title within `str` in [start, max] range,
45666
+ // or continue previous parsing if `prev_state` is defined (equal to result of last execution).
45667
+ //
45668
+ function parseLinkTitle (str, start, max, prev_state) {
45669
+ let code;
45538
45670
  let pos = start;
45539
45671
 
45540
- const result = {
45672
+ const state = {
45673
+ // if `true`, this is a valid link title
45541
45674
  ok: false,
45675
+ // if `true`, this link can be continued on the next line
45676
+ can_continue: false,
45677
+ // if `ok`, it's the position of the first character after the closing marker
45542
45678
  pos: 0,
45543
- lines: 0,
45544
- str: ''
45679
+ // if `ok`, it's the unescaped title
45680
+ str: '',
45681
+ // expected closing marker character code
45682
+ marker: 0
45545
45683
  };
45546
45684
 
45547
- if (pos >= max) { return result }
45685
+ if (prev_state) {
45686
+ // this is a continuation of a previous parseLinkTitle call on the next line,
45687
+ // used in reference links only
45688
+ state.str = prev_state.str;
45689
+ state.marker = prev_state.marker;
45690
+ } else {
45691
+ if (pos >= max) { return state }
45548
45692
 
45549
- marker = str.charCodeAt(pos);
45693
+ let marker = str.charCodeAt(pos);
45694
+ if (marker !== 0x22 /* " */ && marker !== 0x27 /* ' */ && marker !== 0x28 /* ( */) { return state }
45550
45695
 
45551
- if (marker !== 0x22 /* " */ && marker !== 0x27 /* ' */ && marker !== 0x28 /* ( */) { return result }
45696
+ start++;
45697
+ pos++;
45552
45698
 
45553
- pos++;
45699
+ // if opening marker is "(", switch it to closing marker ")"
45700
+ if (marker === 0x28) { marker = 0x29; }
45554
45701
 
45555
- // if opening marker is "(", switch it to closing marker ")"
45556
- if (marker === 0x28) { marker = 0x29; }
45702
+ state.marker = marker;
45703
+ }
45557
45704
 
45558
45705
  while (pos < max) {
45559
45706
  code = str.charCodeAt(pos);
45560
- if (code === marker) {
45561
- result.pos = pos + 1;
45562
- result.lines = lines;
45563
- result.str = unescapeAll(str.slice(start + 1, pos));
45564
- result.ok = true;
45565
- return result
45566
- } else if (code === 0x28 /* ( */ && marker === 0x29 /* ) */) {
45567
- return result
45568
- } else if (code === 0x0A) {
45569
- lines++;
45707
+ if (code === state.marker) {
45708
+ state.pos = pos + 1;
45709
+ state.str += unescapeAll(str.slice(start, pos));
45710
+ state.ok = true;
45711
+ return state
45712
+ } else if (code === 0x28 /* ( */ && state.marker === 0x29 /* ) */) {
45713
+ return state
45570
45714
  } else if (code === 0x5C /* \ */ && pos + 1 < max) {
45571
45715
  pos++;
45572
- if (str.charCodeAt(pos) === 0x0A) {
45573
- lines++;
45574
- }
45575
45716
  }
45576
45717
 
45577
45718
  pos++;
45578
45719
  }
45579
45720
 
45580
- return result
45721
+ // no closing marker found, but this link title may continue on the next line (for references)
45722
+ state.can_continue = true;
45723
+ state.str += unescapeAll(str.slice(start, pos));
45724
+ return state
45581
45725
  }
45582
45726
 
45583
45727
  // Just a shortcut for bulk export
@@ -45727,7 +45871,7 @@ img.ProseMirror-separator {
45727
45871
  * }
45728
45872
  * ```
45729
45873
  *
45730
- * See [source code](https://github.com/markdown-it/markdown-it/blob/master/lib/renderer.js)
45874
+ * See [source code](https://github.com/markdown-it/markdown-it/blob/master/lib/renderer.mjs)
45731
45875
  * for more details and examples.
45732
45876
  **/
45733
45877
  this.rules = assign$2({}, default_rules);
@@ -47240,6 +47384,14 @@ img.ProseMirror-separator {
47240
47384
  // GFM table, https://github.github.com/gfm/#tables-extension-
47241
47385
 
47242
47386
 
47387
+ // Limit the amount of empty autocompleted cells in a table,
47388
+ // see https://github.com/markdown-it/markdown-it/issues/1000,
47389
+ //
47390
+ // Both pulldown-cmark and commonmark-hs limit the number of cells this way to ~200k.
47391
+ // We set it to 65k, which can expand user input by a factor of x370
47392
+ // (256x256 square is 1.8kB expanded into 650kB).
47393
+ const MAX_AUTOCOMPLETED_CELLS = 0x10000;
47394
+
47243
47395
  function getLine (state, line) {
47244
47396
  const pos = state.bMarks[line] + state.tShift[line];
47245
47397
  const max = state.eMarks[line];
@@ -47395,6 +47547,7 @@ img.ProseMirror-separator {
47395
47547
  state.push('thead_close', 'thead', -1);
47396
47548
 
47397
47549
  let tbodyLines;
47550
+ let autocompletedCells = 0;
47398
47551
 
47399
47552
  for (nextLine = startLine + 2; nextLine < endLine; nextLine++) {
47400
47553
  if (state.sCount[nextLine] < state.blkIndent) { break }
@@ -47415,6 +47568,11 @@ img.ProseMirror-separator {
47415
47568
  if (columns.length && columns[0] === '') columns.shift();
47416
47569
  if (columns.length && columns[columns.length - 1] === '') columns.pop();
47417
47570
 
47571
+ // note: autocomplete count can be negative if user specifies more columns than header,
47572
+ // but that does not affect intended use (which is limiting expansion)
47573
+ autocompletedCells += columnCount - columns.length;
47574
+ if (autocompletedCells > MAX_AUTOCOMPLETED_CELLS) { break }
47575
+
47418
47576
  if (nextLine === startLine + 2) {
47419
47577
  const token_tbo = state.push('tbody_open', 'tbody', 1);
47420
47578
  token_tbo.map = tbodyLines = [startLine + 2, 0];
@@ -48158,8 +48316,6 @@ img.ProseMirror-separator {
48158
48316
  }
48159
48317
 
48160
48318
  function reference (state, startLine, _endLine, silent) {
48161
- let lines = 0;
48162
-
48163
48319
  let pos = state.bMarks[startLine] + state.tShift[startLine];
48164
48320
  let max = state.eMarks[startLine];
48165
48321
  let nextLine = startLine + 1;
@@ -48169,45 +48325,53 @@ img.ProseMirror-separator {
48169
48325
 
48170
48326
  if (state.src.charCodeAt(pos) !== 0x5B/* [ */) { return false }
48171
48327
 
48172
- // Simple check to quickly interrupt scan on [link](url) at the start of line.
48173
- // Can be useful on practice: https://github.com/markdown-it/markdown-it/issues/54
48174
- while (++pos < max) {
48175
- if (state.src.charCodeAt(pos) === 0x5D /* ] */ &&
48176
- state.src.charCodeAt(pos - 1) !== 0x5C/* \ */) {
48177
- if (pos + 1 === max) { return false }
48178
- if (state.src.charCodeAt(pos + 1) !== 0x3A/* : */) { return false }
48179
- break
48180
- }
48181
- }
48182
-
48183
- const endLine = state.lineMax;
48328
+ function getNextLine (nextLine) {
48329
+ const endLine = state.lineMax;
48184
48330
 
48185
- // jump line-by-line until empty one or EOF
48186
- const terminatorRules = state.md.block.ruler.getRules('reference');
48331
+ if (nextLine >= endLine || state.isEmpty(nextLine)) {
48332
+ // empty line or end of input
48333
+ return null
48334
+ }
48187
48335
 
48188
- const oldParentType = state.parentType;
48189
- state.parentType = 'reference';
48336
+ let isContinuation = false;
48190
48337
 
48191
- for (; nextLine < endLine && !state.isEmpty(nextLine); nextLine++) {
48192
48338
  // this would be a code block normally, but after paragraph
48193
48339
  // it's considered a lazy continuation regardless of what's there
48194
- if (state.sCount[nextLine] - state.blkIndent > 3) { continue }
48340
+ if (state.sCount[nextLine] - state.blkIndent > 3) { isContinuation = true; }
48195
48341
 
48196
48342
  // quirk for blockquotes, this line should already be checked by that rule
48197
- if (state.sCount[nextLine] < 0) { continue }
48343
+ if (state.sCount[nextLine] < 0) { isContinuation = true; }
48344
+
48345
+ if (!isContinuation) {
48346
+ const terminatorRules = state.md.block.ruler.getRules('reference');
48347
+ const oldParentType = state.parentType;
48348
+ state.parentType = 'reference';
48349
+
48350
+ // Some tags can terminate paragraph without empty line.
48351
+ let terminate = false;
48352
+ for (let i = 0, l = terminatorRules.length; i < l; i++) {
48353
+ if (terminatorRules[i](state, nextLine, endLine, true)) {
48354
+ terminate = true;
48355
+ break
48356
+ }
48357
+ }
48198
48358
 
48199
- // Some tags can terminate paragraph without empty line.
48200
- let terminate = false;
48201
- for (let i = 0, l = terminatorRules.length; i < l; i++) {
48202
- if (terminatorRules[i](state, nextLine, endLine, true)) {
48203
- terminate = true;
48204
- break
48359
+ state.parentType = oldParentType;
48360
+ if (terminate) {
48361
+ // terminated by another block
48362
+ return null
48205
48363
  }
48206
48364
  }
48207
- if (terminate) { break }
48365
+
48366
+ const pos = state.bMarks[nextLine] + state.tShift[nextLine];
48367
+ const max = state.eMarks[nextLine];
48368
+
48369
+ // max + 1 explicitly includes the newline
48370
+ return state.src.slice(pos, max + 1)
48208
48371
  }
48209
48372
 
48210
- const str = state.getLines(startLine, nextLine, state.blkIndent, false).trim();
48373
+ let str = state.src.slice(pos, max + 1);
48374
+
48211
48375
  max = str.length;
48212
48376
  let labelEnd = -1;
48213
48377
 
@@ -48219,11 +48383,21 @@ img.ProseMirror-separator {
48219
48383
  labelEnd = pos;
48220
48384
  break
48221
48385
  } else if (ch === 0x0A /* \n */) {
48222
- lines++;
48386
+ const lineContent = getNextLine(nextLine);
48387
+ if (lineContent !== null) {
48388
+ str += lineContent;
48389
+ max = str.length;
48390
+ nextLine++;
48391
+ }
48223
48392
  } else if (ch === 0x5C /* \ */) {
48224
48393
  pos++;
48225
48394
  if (pos < max && str.charCodeAt(pos) === 0x0A) {
48226
- lines++;
48395
+ const lineContent = getNextLine(nextLine);
48396
+ if (lineContent !== null) {
48397
+ str += lineContent;
48398
+ max = str.length;
48399
+ nextLine++;
48400
+ }
48227
48401
  }
48228
48402
  }
48229
48403
  }
@@ -48235,7 +48409,12 @@ img.ProseMirror-separator {
48235
48409
  for (pos = labelEnd + 2; pos < max; pos++) {
48236
48410
  const ch = str.charCodeAt(pos);
48237
48411
  if (ch === 0x0A) {
48238
- lines++;
48412
+ const lineContent = getNextLine(nextLine);
48413
+ if (lineContent !== null) {
48414
+ str += lineContent;
48415
+ max = str.length;
48416
+ nextLine++;
48417
+ }
48239
48418
  } else if (isSpace(ch)) ; else {
48240
48419
  break
48241
48420
  }
@@ -48250,11 +48429,10 @@ img.ProseMirror-separator {
48250
48429
  if (!state.md.validateLink(href)) { return false }
48251
48430
 
48252
48431
  pos = destRes.pos;
48253
- lines += destRes.lines;
48254
48432
 
48255
48433
  // save cursor state, we could require to rollback later
48256
48434
  const destEndPos = pos;
48257
- const destEndLineNo = lines;
48435
+ const destEndLineNo = nextLine;
48258
48436
 
48259
48437
  // [label]: destination 'title'
48260
48438
  // ^^^ skipping those spaces
@@ -48262,7 +48440,12 @@ img.ProseMirror-separator {
48262
48440
  for (; pos < max; pos++) {
48263
48441
  const ch = str.charCodeAt(pos);
48264
48442
  if (ch === 0x0A) {
48265
- lines++;
48443
+ const lineContent = getNextLine(nextLine);
48444
+ if (lineContent !== null) {
48445
+ str += lineContent;
48446
+ max = str.length;
48447
+ nextLine++;
48448
+ }
48266
48449
  } else if (isSpace(ch)) ; else {
48267
48450
  break
48268
48451
  }
@@ -48270,17 +48453,25 @@ img.ProseMirror-separator {
48270
48453
 
48271
48454
  // [label]: destination 'title'
48272
48455
  // ^^^^^^^ parse this
48273
- const titleRes = state.md.helpers.parseLinkTitle(str, pos, max);
48456
+ let titleRes = state.md.helpers.parseLinkTitle(str, pos, max);
48457
+ while (titleRes.can_continue) {
48458
+ const lineContent = getNextLine(nextLine);
48459
+ if (lineContent === null) break
48460
+ str += lineContent;
48461
+ pos = max;
48462
+ max = str.length;
48463
+ nextLine++;
48464
+ titleRes = state.md.helpers.parseLinkTitle(str, pos, max, titleRes);
48465
+ }
48274
48466
  let title;
48275
48467
 
48276
48468
  if (pos < max && start !== pos && titleRes.ok) {
48277
48469
  title = titleRes.str;
48278
48470
  pos = titleRes.pos;
48279
- lines += titleRes.lines;
48280
48471
  } else {
48281
48472
  title = '';
48282
48473
  pos = destEndPos;
48283
- lines = destEndLineNo;
48474
+ nextLine = destEndLineNo;
48284
48475
  }
48285
48476
 
48286
48477
  // skip trailing spaces until the rest of the line
@@ -48296,7 +48487,7 @@ img.ProseMirror-separator {
48296
48487
  // but it could still be a valid reference if we roll back
48297
48488
  title = '';
48298
48489
  pos = destEndPos;
48299
- lines = destEndLineNo;
48490
+ nextLine = destEndLineNo;
48300
48491
  while (pos < max) {
48301
48492
  const ch = str.charCodeAt(pos);
48302
48493
  if (!isSpace(ch)) { break }
@@ -48327,9 +48518,7 @@ img.ProseMirror-separator {
48327
48518
  state.env.references[label] = { title, href };
48328
48519
  }
48329
48520
 
48330
- state.parentType = oldParentType;
48331
-
48332
- state.line = startLine + lines + 1;
48521
+ state.line = nextLine;
48333
48522
  return true
48334
48523
  }
48335
48524
 
@@ -48386,8 +48575,8 @@ img.ProseMirror-separator {
48386
48575
  'option',
48387
48576
  'p',
48388
48577
  'param',
48578
+ 'search',
48389
48579
  'section',
48390
- 'source',
48391
48580
  'summary',
48392
48581
  'table',
48393
48582
  'tbody',
@@ -48416,9 +48605,9 @@ img.ProseMirror-separator {
48416
48605
  const open_tag = '<[A-Za-z][A-Za-z0-9\\-]*' + attribute + '*\\s*\\/?>';
48417
48606
 
48418
48607
  const close_tag = '<\\/[A-Za-z][A-Za-z0-9\\-]*\\s*>';
48419
- const comment = '<!---->|<!--(?:-?[^>-])(?:-?[^-])*-->';
48608
+ const comment = '<!---?>|<!--(?:[^-]|-[^-]|--[^>])*-->';
48420
48609
  const processing = '<[?][\\s\\S]*?[?]>';
48421
- const declaration = '<![A-Z]+\\s+[^>]*>';
48610
+ const declaration = '<![A-Za-z][^>]*>';
48422
48611
  const cdata = '<!\\[CDATA\\[[\\s\\S]*?\\]\\]>';
48423
48612
 
48424
48613
  const HTML_TAG_RE = new RegExp('^(?:' + open_tag + '|' + close_tag + '|' + comment +
@@ -48879,9 +49068,6 @@ img.ProseMirror-separator {
48879
49068
  // - canSplitWord - determine if these markers can be found inside a word
48880
49069
  //
48881
49070
  StateInline.prototype.scanDelims = function (start, canSplitWord) {
48882
- let can_open, can_close;
48883
- let left_flanking = true;
48884
- let right_flanking = true;
48885
49071
  const max = this.posMax;
48886
49072
  const marker = this.src.charCodeAt(start);
48887
49073
 
@@ -48902,29 +49088,13 @@ img.ProseMirror-separator {
48902
49088
  const isLastWhiteSpace = isWhiteSpace(lastChar);
48903
49089
  const isNextWhiteSpace = isWhiteSpace(nextChar);
48904
49090
 
48905
- if (isNextWhiteSpace) {
48906
- left_flanking = false;
48907
- } else if (isNextPunctChar) {
48908
- if (!(isLastWhiteSpace || isLastPunctChar)) {
48909
- left_flanking = false;
48910
- }
48911
- }
48912
-
48913
- if (isLastWhiteSpace) {
48914
- right_flanking = false;
48915
- } else if (isLastPunctChar) {
48916
- if (!(isNextWhiteSpace || isNextPunctChar)) {
48917
- right_flanking = false;
48918
- }
48919
- }
49091
+ const left_flanking =
49092
+ !isNextWhiteSpace && (!isNextPunctChar || isLastWhiteSpace || isLastPunctChar);
49093
+ const right_flanking =
49094
+ !isLastWhiteSpace && (!isLastPunctChar || isNextWhiteSpace || isNextPunctChar);
48920
49095
 
48921
- if (!canSplitWord) {
48922
- can_open = left_flanking && (!right_flanking || isLastPunctChar);
48923
- can_close = right_flanking && (!left_flanking || isNextPunctChar);
48924
- } else {
48925
- can_open = left_flanking;
48926
- can_close = right_flanking;
48927
- }
49096
+ const can_open = left_flanking && (canSplitWord || !right_flanking || isLastPunctChar);
49097
+ const can_close = right_flanking && (canSplitWord || !left_flanking || isNextPunctChar);
48928
49098
 
48929
49099
  return { can_open, can_close, length: count }
48930
49100
  };
@@ -48992,7 +49162,7 @@ img.ProseMirror-separator {
48992
49162
  // Alternative implementation, for memory.
48993
49163
  //
48994
49164
  // It costs 10% of performance, but allows extend terminators list, if place it
48995
- // to `ParcerInline` property. Probably, will switch to it sometime, such
49165
+ // to `ParserInline` property. Probably, will switch to it sometime, such
48996
49166
  // flexibility required.
48997
49167
 
48998
49168
  /*
@@ -51916,12 +52086,12 @@ img.ProseMirror-separator {
51916
52086
  * MarkdownIt provides named presets as a convenience to quickly
51917
52087
  * enable/disable active syntax rules and options for common use cases.
51918
52088
  *
51919
- * - ["commonmark"](https://github.com/markdown-it/markdown-it/blob/master/lib/presets/commonmark.js) -
52089
+ * - ["commonmark"](https://github.com/markdown-it/markdown-it/blob/master/lib/presets/commonmark.mjs) -
51920
52090
  * configures parser to strict [CommonMark](http://commonmark.org/) mode.
51921
- * - [default](https://github.com/markdown-it/markdown-it/blob/master/lib/presets/default.js) -
52091
+ * - [default](https://github.com/markdown-it/markdown-it/blob/master/lib/presets/default.mjs) -
51922
52092
  * similar to GFM, used when no preset name given. Enables all available rules,
51923
52093
  * but still without html, typographer & autolinker.
51924
- * - ["zero"](https://github.com/markdown-it/markdown-it/blob/master/lib/presets/zero.js) -
52094
+ * - ["zero"](https://github.com/markdown-it/markdown-it/blob/master/lib/presets/zero.mjs) -
51925
52095
  * all rules disabled. Useful to quickly setup your config via `.enable()`.
51926
52096
  * For example, when you need only `bold` and `italic` markup and nothing else.
51927
52097
  *
@@ -51938,7 +52108,7 @@ img.ProseMirror-separator {
51938
52108
  * Can be useful for external highlighters.
51939
52109
  * - __linkify__ - `false`. Set `true` to autoconvert URL-like text to links.
51940
52110
  * - __typographer__ - `false`. Set `true` to enable [some language-neutral
51941
- * replacement](https://github.com/markdown-it/markdown-it/blob/master/lib/rules_core/replacements.js) +
52111
+ * replacement](https://github.com/markdown-it/markdown-it/blob/master/lib/rules_core/replacements.mjs) +
51942
52112
  * quotes beautification (smartquotes).
51943
52113
  * - __quotes__ - `“”‘’`, String or Array. Double + single quotes replacement
51944
52114
  * pairs, when typographer enabled and smartquotes on. For example, you can
@@ -52064,7 +52234,7 @@ img.ProseMirror-separator {
52064
52234
  * md.renderer.rules['my_token'] = myToken
52065
52235
  * ```
52066
52236
  *
52067
- * See [[Renderer]] docs and [source code](https://github.com/markdown-it/markdown-it/blob/master/lib/renderer.js).
52237
+ * See [[Renderer]] docs and [source code](https://github.com/markdown-it/markdown-it/blob/master/lib/renderer.mjs).
52068
52238
  **/
52069
52239
  this.renderer = new Renderer();
52070
52240
 
@@ -52072,7 +52242,7 @@ img.ProseMirror-separator {
52072
52242
  * MarkdownIt#linkify -> LinkifyIt
52073
52243
  *
52074
52244
  * [linkify-it](https://github.com/markdown-it/linkify-it) instance.
52075
- * Used by [linkify](https://github.com/markdown-it/markdown-it/blob/master/lib/rules_core/linkify.js)
52245
+ * Used by [linkify](https://github.com/markdown-it/markdown-it/blob/master/lib/rules_core/linkify.mjs)
52076
52246
  * rule.
52077
52247
  **/
52078
52248
  this.linkify = new LinkifyIt();
@@ -53811,10 +53981,10 @@ img.ProseMirror-separator {
53811
53981
  observable
53812
53982
  ], RichText.prototype, "configuration", void 0);
53813
53983
 
53814
- const starInputRegex$1 = /(?:^|\s)((?:\*\*)((?:[^*]+))(?:\*\*))$/;
53815
- const starPasteRegex$1 = /(?:^|\s)((?:\*\*)((?:[^*]+))(?:\*\*))/g;
53816
- const underscoreInputRegex$1 = /(?:^|\s)((?:__)((?:[^__]+))(?:__))$/;
53817
- const underscorePasteRegex$1 = /(?:^|\s)((?:__)((?:[^__]+))(?:__))/g;
53984
+ const starInputRegex$1 = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/;
53985
+ const starPasteRegex$1 = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g;
53986
+ const underscoreInputRegex$1 = /(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/;
53987
+ const underscorePasteRegex$1 = /(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g;
53818
53988
  const Bold = Mark.create({
53819
53989
  name: 'bold',
53820
53990
  addOptions() {
@@ -54542,16 +54712,16 @@ img.ProseMirror-separator {
54542
54712
  }
54543
54713
  // Apply the latest event from one branch to the document and shift the event
54544
54714
  // onto the other branch.
54545
- function histTransaction(history, state, dispatch, redo) {
54715
+ function histTransaction(history, state, redo) {
54546
54716
  let preserveItems = mustPreserveItems(state);
54547
54717
  let histOptions = historyKey.get(state).spec.config;
54548
54718
  let pop = (redo ? history.undone : history.done).popEvent(state, preserveItems);
54549
54719
  if (!pop)
54550
- return;
54720
+ return null;
54551
54721
  let selection = pop.selection.resolve(pop.transform.doc);
54552
54722
  let added = (redo ? history.done : history.undone).addTransform(pop.transform, state.selection.getBookmark(), histOptions, preserveItems);
54553
54723
  let newHist = new HistoryState(redo ? added : pop.remaining, redo ? pop.remaining : added, null, 0, -1);
54554
- dispatch(pop.transform.setSelection(selection).setMeta(historyKey, { redo, historyState: newHist }).scrollIntoView());
54724
+ return pop.transform.setSelection(selection).setMeta(historyKey, { redo, historyState: newHist });
54555
54725
  }
54556
54726
  let cachedPreserveItems = false, cachedPreserveItemsPlugins = null;
54557
54727
  // Check whether any plugin in the given state has a
@@ -54610,28 +54780,27 @@ img.ProseMirror-separator {
54610
54780
  }
54611
54781
  });
54612
54782
  }
54783
+ function buildCommand(redo, scroll) {
54784
+ return (state, dispatch) => {
54785
+ let hist = historyKey.getState(state);
54786
+ if (!hist || (redo ? hist.undone : hist.done).eventCount == 0)
54787
+ return false;
54788
+ if (dispatch) {
54789
+ let tr = histTransaction(hist, state, redo);
54790
+ if (tr)
54791
+ dispatch(scroll ? tr.scrollIntoView() : tr);
54792
+ }
54793
+ return true;
54794
+ };
54795
+ }
54613
54796
  /**
54614
54797
  A command function that undoes the last change, if any.
54615
54798
  */
54616
- const undo = (state, dispatch) => {
54617
- let hist = historyKey.getState(state);
54618
- if (!hist || hist.done.eventCount == 0)
54619
- return false;
54620
- if (dispatch)
54621
- histTransaction(hist, state, dispatch, false);
54622
- return true;
54623
- };
54799
+ const undo = buildCommand(false, true);
54624
54800
  /**
54625
54801
  A command function that redoes the last undone change, if any.
54626
54802
  */
54627
- const redo = (state, dispatch) => {
54628
- let hist = historyKey.getState(state);
54629
- if (!hist || hist.undone.eventCount == 0)
54630
- return false;
54631
- if (dispatch)
54632
- histTransaction(hist, state, dispatch, true);
54633
- return true;
54634
- };
54803
+ const redo = buildCommand(true, true);
54635
54804
 
54636
54805
  const History = Extension.create({
54637
54806
  name: 'history',
@@ -54668,10 +54837,10 @@ img.ProseMirror-separator {
54668
54837
  },
54669
54838
  });
54670
54839
 
54671
- const starInputRegex = /(?:^|\s)((?:\*)((?:[^*]+))(?:\*))$/;
54672
- const starPasteRegex = /(?:^|\s)((?:\*)((?:[^*]+))(?:\*))/g;
54673
- const underscoreInputRegex = /(?:^|\s)((?:_)((?:[^_]+))(?:_))$/;
54674
- const underscorePasteRegex = /(?:^|\s)((?:_)((?:[^_]+))(?:_))/g;
54840
+ const starInputRegex = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/;
54841
+ const starPasteRegex = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g;
54842
+ const underscoreInputRegex = /(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/;
54843
+ const underscorePasteRegex = /(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g;
54675
54844
  const Italic = Mark.create({
54676
54845
  name: 'italic',
54677
54846
  addOptions() {
@@ -56487,6 +56656,25 @@ img.ProseMirror-separator {
56487
56656
  return filtered;
56488
56657
  }
56489
56658
 
56659
+ /**
56660
+ * Check if the provided tokens form a valid link structure, which can either be a single link token
56661
+ * or a link token surrounded by parentheses or square brackets.
56662
+ *
56663
+ * This ensures that only complete and valid text is hyperlinked, preventing cases where a valid
56664
+ * top-level domain (TLD) is immediately followed by an invalid character, like a number. For
56665
+ * example, with the `find` method from Linkify, entering `example.com1` would result in
56666
+ * `example.com` being linked and the trailing `1` left as plain text. By using the `tokenize`
56667
+ * method, we can perform more comprehensive validation on the input text.
56668
+ */
56669
+ function isValidLinkStructure(tokens) {
56670
+ if (tokens.length === 1) {
56671
+ return tokens[0].isLink;
56672
+ }
56673
+ if (tokens.length === 3 && tokens[1].isLink) {
56674
+ return ['()', '[]'].includes(tokens[0].value + tokens[2].value);
56675
+ }
56676
+ return false;
56677
+ }
56490
56678
  function autolink(options) {
56491
56679
  return new Plugin({
56492
56680
  key: new PluginKey('autolink'),
@@ -56525,7 +56713,11 @@ img.ProseMirror-separator {
56525
56713
  if (!lastWordBeforeSpace) {
56526
56714
  return false;
56527
56715
  }
56528
- find$1(lastWordBeforeSpace)
56716
+ const linksBeforeSpace = tokenize(lastWordBeforeSpace).map(t => t.toObject());
56717
+ if (!isValidLinkStructure(linksBeforeSpace)) {
56718
+ return false;
56719
+ }
56720
+ linksBeforeSpace
56529
56721
  .filter(link => link.isLink)
56530
56722
  // Calculate link position.
56531
56723
  .map(link => ({
@@ -56572,6 +56764,9 @@ img.ProseMirror-separator {
56572
56764
  props: {
56573
56765
  handleClick: (view, pos, event) => {
56574
56766
  var _a, _b;
56767
+ if (options.whenNotEditable && view.editable) {
56768
+ return false;
56769
+ }
56575
56770
  if (event.button !== 0) {
56576
56771
  return false;
56577
56772
  }
@@ -56746,6 +56941,7 @@ img.ProseMirror-separator {
56746
56941
  if (this.options.openOnClick) {
56747
56942
  plugins.push(clickHandler({
56748
56943
  type: this.type,
56944
+ whenNotEditable: this.options.openOnClick === 'whenNotEditable',
56749
56945
  }));
56750
56946
  }
56751
56947
  if (this.options.linkOnPaste) {
@@ -57121,7 +57317,7 @@ img.ProseMirror-separator {
57121
57317
  text: state.text,
57122
57318
  items: [],
57123
57319
  command: commandProps => {
57124
- command({
57320
+ return command({
57125
57321
  editor,
57126
57322
  range: state.range,
57127
57323
  props: commandProps,
@@ -57275,11 +57471,12 @@ img.ProseMirror-separator {
57275
57471
  var _a;
57276
57472
  return `${options.suggestion.char}${(_a = node.attrs.label) !== null && _a !== void 0 ? _a : node.attrs.id}`;
57277
57473
  },
57474
+ deleteTriggerWithBackspace: false,
57278
57475
  renderHTML({ options, node }) {
57279
57476
  var _a;
57280
57477
  return [
57281
57478
  'span',
57282
- this.HTMLAttributes,
57479
+ mergeAttributes(this.HTMLAttributes, options.HTMLAttributes),
57283
57480
  `${options.suggestion.char}${(_a = node.attrs.label) !== null && _a !== void 0 ? _a : node.attrs.id}`,
57284
57481
  ];
57285
57482
  },
@@ -57371,8 +57568,10 @@ img.ProseMirror-separator {
57371
57568
  }),
57372
57569
  ];
57373
57570
  }
57571
+ const mergedOptions = { ...this.options };
57572
+ mergedOptions.HTMLAttributes = mergeAttributes({ 'data-type': this.name }, this.options.HTMLAttributes, HTMLAttributes);
57374
57573
  const html = this.options.renderHTML({
57375
- options: this.options,
57574
+ options: mergedOptions,
57376
57575
  node,
57377
57576
  });
57378
57577
  if (typeof html === 'string') {
@@ -57409,7 +57608,7 @@ img.ProseMirror-separator {
57409
57608
  state.doc.nodesBetween(anchor - 1, anchor, (node, pos) => {
57410
57609
  if (node.type.name === this.name) {
57411
57610
  isMention = true;
57412
- tr.insertText(this.options.suggestion.char || '', pos, pos + node.nodeSize);
57611
+ tr.insertText(this.options.deleteTriggerWithBackspace ? '' : this.options.suggestion.char || '', pos, pos + node.nodeSize);
57413
57612
  return false;
57414
57613
  }
57415
57614
  });
@@ -60012,6 +60211,31 @@ img.ProseMirror-separator {
60012
60211
  *
60013
60212
  * @license MIT
60014
60213
  */
60214
+ // type Person = {
60215
+ // firstName: string
60216
+ // lastName: string
60217
+ // age: number
60218
+ // visits: number
60219
+ // status: string
60220
+ // progress: number
60221
+ // createdAt: Date
60222
+ // nested: {
60223
+ // foo: [
60224
+ // {
60225
+ // bar: 'bar'
60226
+ // }
60227
+ // ]
60228
+ // bar: { subBar: boolean }[]
60229
+ // baz: {
60230
+ // foo: 'foo'
60231
+ // bar: {
60232
+ // baz: 'baz'
60233
+ // }
60234
+ // }
60235
+ // }
60236
+ // }
60237
+
60238
+
60015
60239
  // Is this type a tuple?
60016
60240
 
60017
60241
  // If this type is a tuple, what indices are allowed?
@@ -60099,6 +60323,32 @@ img.ProseMirror-separator {
60099
60323
  };
60100
60324
  }
60101
60325
 
60326
+ function createCell(table, row, column, columnId) {
60327
+ const getRenderValue = () => {
60328
+ var _cell$getValue;
60329
+ return (_cell$getValue = cell.getValue()) != null ? _cell$getValue : table.options.renderFallbackValue;
60330
+ };
60331
+ const cell = {
60332
+ id: `${row.id}_${column.id}`,
60333
+ row,
60334
+ column,
60335
+ getValue: () => row.getValue(columnId),
60336
+ renderValue: getRenderValue,
60337
+ getContext: memo$1(() => [table, column, row, cell], (table, column, row, cell) => ({
60338
+ table,
60339
+ column,
60340
+ row,
60341
+ cell: cell,
60342
+ getValue: cell.getValue,
60343
+ renderValue: cell.renderValue
60344
+ }), getMemoOptions(table.options, 'debugCells', 'cell.getContext'))
60345
+ };
60346
+ table._features.forEach(feature => {
60347
+ feature.createCell == null || feature.createCell(cell, column, row, table);
60348
+ }, {});
60349
+ return cell;
60350
+ }
60351
+
60102
60352
  function createColumn(table, columnDef, depth, parent) {
60103
60353
  var _ref, _resolvedColumnDef$id;
60104
60354
  const defaultColumn = table._getDefaultColumnDef();
@@ -60158,7 +60408,7 @@ img.ProseMirror-separator {
60158
60408
  feature.createColumn == null || feature.createColumn(column, table);
60159
60409
  }
60160
60410
 
60161
- // Yes, we have to convert table to uknown, because we know more than the compiler here.
60411
+ // Yes, we have to convert table to unknown, because we know more than the compiler here.
60162
60412
  return column;
60163
60413
  }
60164
60414
 
@@ -60415,98 +60665,809 @@ img.ProseMirror-separator {
60415
60665
  return headerGroups;
60416
60666
  }
60417
60667
 
60418
- //
60668
+ const createRow = (table, id, original, rowIndex, depth, subRows, parentId) => {
60669
+ let row = {
60670
+ id,
60671
+ index: rowIndex,
60672
+ original,
60673
+ depth,
60674
+ parentId,
60675
+ _valuesCache: {},
60676
+ _uniqueValuesCache: {},
60677
+ getValue: columnId => {
60678
+ if (row._valuesCache.hasOwnProperty(columnId)) {
60679
+ return row._valuesCache[columnId];
60680
+ }
60681
+ const column = table.getColumn(columnId);
60682
+ if (!(column != null && column.accessorFn)) {
60683
+ return undefined;
60684
+ }
60685
+ row._valuesCache[columnId] = column.accessorFn(row.original, rowIndex);
60686
+ return row._valuesCache[columnId];
60687
+ },
60688
+ getUniqueValues: columnId => {
60689
+ if (row._uniqueValuesCache.hasOwnProperty(columnId)) {
60690
+ return row._uniqueValuesCache[columnId];
60691
+ }
60692
+ const column = table.getColumn(columnId);
60693
+ if (!(column != null && column.accessorFn)) {
60694
+ return undefined;
60695
+ }
60696
+ if (!column.columnDef.getUniqueValues) {
60697
+ row._uniqueValuesCache[columnId] = [row.getValue(columnId)];
60698
+ return row._uniqueValuesCache[columnId];
60699
+ }
60700
+ row._uniqueValuesCache[columnId] = column.columnDef.getUniqueValues(row.original, rowIndex);
60701
+ return row._uniqueValuesCache[columnId];
60702
+ },
60703
+ renderValue: columnId => {
60704
+ var _row$getValue;
60705
+ return (_row$getValue = row.getValue(columnId)) != null ? _row$getValue : table.options.renderFallbackValue;
60706
+ },
60707
+ subRows: subRows != null ? subRows : [],
60708
+ getLeafRows: () => flattenBy(row.subRows, d => d.subRows),
60709
+ getParentRow: () => row.parentId ? table.getRow(row.parentId, true) : undefined,
60710
+ getParentRows: () => {
60711
+ let parentRows = [];
60712
+ let currentRow = row;
60713
+ while (true) {
60714
+ const parentRow = currentRow.getParentRow();
60715
+ if (!parentRow) break;
60716
+ parentRows.push(parentRow);
60717
+ currentRow = parentRow;
60718
+ }
60719
+ return parentRows.reverse();
60720
+ },
60721
+ getAllCells: memo$1(() => [table.getAllLeafColumns()], leafColumns => {
60722
+ return leafColumns.map(column => {
60723
+ return createCell(table, row, column, column.id);
60724
+ });
60725
+ }, getMemoOptions(table.options, 'debugRows', 'getAllCells')),
60726
+ _getAllCellsByColumnId: memo$1(() => [row.getAllCells()], allCells => {
60727
+ return allCells.reduce((acc, cell) => {
60728
+ acc[cell.column.id] = cell;
60729
+ return acc;
60730
+ }, {});
60731
+ }, getMemoOptions(table.options, 'debugRows', 'getAllCellsByColumnId'))
60732
+ };
60733
+ for (let i = 0; i < table._features.length; i++) {
60734
+ const feature = table._features[i];
60735
+ feature == null || feature.createRow == null || feature.createRow(row, table);
60736
+ }
60737
+ return row;
60738
+ };
60419
60739
 
60420
60740
  //
60421
60741
 
60422
- const defaultColumnSizing = {
60423
- size: 150,
60424
- minSize: 20,
60425
- maxSize: Number.MAX_SAFE_INTEGER
60742
+ const ColumnFaceting = {
60743
+ createColumn: (column, table) => {
60744
+ column._getFacetedRowModel = table.options.getFacetedRowModel && table.options.getFacetedRowModel(table, column.id);
60745
+ column.getFacetedRowModel = () => {
60746
+ if (!column._getFacetedRowModel) {
60747
+ return table.getPreFilteredRowModel();
60748
+ }
60749
+ return column._getFacetedRowModel();
60750
+ };
60751
+ column._getFacetedUniqueValues = table.options.getFacetedUniqueValues && table.options.getFacetedUniqueValues(table, column.id);
60752
+ column.getFacetedUniqueValues = () => {
60753
+ if (!column._getFacetedUniqueValues) {
60754
+ return new Map();
60755
+ }
60756
+ return column._getFacetedUniqueValues();
60757
+ };
60758
+ column._getFacetedMinMaxValues = table.options.getFacetedMinMaxValues && table.options.getFacetedMinMaxValues(table, column.id);
60759
+ column.getFacetedMinMaxValues = () => {
60760
+ if (!column._getFacetedMinMaxValues) {
60761
+ return undefined;
60762
+ }
60763
+ return column._getFacetedMinMaxValues();
60764
+ };
60765
+ }
60426
60766
  };
60427
- const getDefaultColumnSizingInfoState = () => ({
60428
- startOffset: null,
60429
- startSize: null,
60430
- deltaOffset: null,
60431
- deltaPercentage: null,
60432
- isResizingColumn: false,
60433
- columnSizingStart: []
60434
- });
60435
- const ColumnSizing = {
60767
+
60768
+ const includesString = (row, columnId, filterValue) => {
60769
+ var _row$getValue;
60770
+ const search = filterValue.toLowerCase();
60771
+ return Boolean((_row$getValue = row.getValue(columnId)) == null || (_row$getValue = _row$getValue.toString()) == null || (_row$getValue = _row$getValue.toLowerCase()) == null ? void 0 : _row$getValue.includes(search));
60772
+ };
60773
+ includesString.autoRemove = val => testFalsey(val);
60774
+ const includesStringSensitive = (row, columnId, filterValue) => {
60775
+ var _row$getValue2;
60776
+ return Boolean((_row$getValue2 = row.getValue(columnId)) == null || (_row$getValue2 = _row$getValue2.toString()) == null ? void 0 : _row$getValue2.includes(filterValue));
60777
+ };
60778
+ includesStringSensitive.autoRemove = val => testFalsey(val);
60779
+ const equalsString = (row, columnId, filterValue) => {
60780
+ var _row$getValue3;
60781
+ return ((_row$getValue3 = row.getValue(columnId)) == null || (_row$getValue3 = _row$getValue3.toString()) == null ? void 0 : _row$getValue3.toLowerCase()) === (filterValue == null ? void 0 : filterValue.toLowerCase());
60782
+ };
60783
+ equalsString.autoRemove = val => testFalsey(val);
60784
+ const arrIncludes = (row, columnId, filterValue) => {
60785
+ var _row$getValue4;
60786
+ return (_row$getValue4 = row.getValue(columnId)) == null ? void 0 : _row$getValue4.includes(filterValue);
60787
+ };
60788
+ arrIncludes.autoRemove = val => testFalsey(val) || !(val != null && val.length);
60789
+ const arrIncludesAll = (row, columnId, filterValue) => {
60790
+ return !filterValue.some(val => {
60791
+ var _row$getValue5;
60792
+ return !((_row$getValue5 = row.getValue(columnId)) != null && _row$getValue5.includes(val));
60793
+ });
60794
+ };
60795
+ arrIncludesAll.autoRemove = val => testFalsey(val) || !(val != null && val.length);
60796
+ const arrIncludesSome = (row, columnId, filterValue) => {
60797
+ return filterValue.some(val => {
60798
+ var _row$getValue6;
60799
+ return (_row$getValue6 = row.getValue(columnId)) == null ? void 0 : _row$getValue6.includes(val);
60800
+ });
60801
+ };
60802
+ arrIncludesSome.autoRemove = val => testFalsey(val) || !(val != null && val.length);
60803
+ const equals = (row, columnId, filterValue) => {
60804
+ return row.getValue(columnId) === filterValue;
60805
+ };
60806
+ equals.autoRemove = val => testFalsey(val);
60807
+ const weakEquals = (row, columnId, filterValue) => {
60808
+ return row.getValue(columnId) == filterValue;
60809
+ };
60810
+ weakEquals.autoRemove = val => testFalsey(val);
60811
+ const inNumberRange = (row, columnId, filterValue) => {
60812
+ let [min, max] = filterValue;
60813
+ const rowValue = row.getValue(columnId);
60814
+ return rowValue >= min && rowValue <= max;
60815
+ };
60816
+ inNumberRange.resolveFilterValue = val => {
60817
+ let [unsafeMin, unsafeMax] = val;
60818
+ let parsedMin = typeof unsafeMin !== 'number' ? parseFloat(unsafeMin) : unsafeMin;
60819
+ let parsedMax = typeof unsafeMax !== 'number' ? parseFloat(unsafeMax) : unsafeMax;
60820
+ let min = unsafeMin === null || Number.isNaN(parsedMin) ? -Infinity : parsedMin;
60821
+ let max = unsafeMax === null || Number.isNaN(parsedMax) ? Infinity : parsedMax;
60822
+ if (min > max) {
60823
+ const temp = min;
60824
+ min = max;
60825
+ max = temp;
60826
+ }
60827
+ return [min, max];
60828
+ };
60829
+ inNumberRange.autoRemove = val => testFalsey(val) || testFalsey(val[0]) && testFalsey(val[1]);
60830
+
60831
+ // Export
60832
+
60833
+ const filterFns = {
60834
+ includesString,
60835
+ includesStringSensitive,
60836
+ equalsString,
60837
+ arrIncludes,
60838
+ arrIncludesAll,
60839
+ arrIncludesSome,
60840
+ equals,
60841
+ weakEquals,
60842
+ inNumberRange
60843
+ };
60844
+ // Utils
60845
+
60846
+ function testFalsey(val) {
60847
+ return val === undefined || val === null || val === '';
60848
+ }
60849
+
60850
+ //
60851
+
60852
+ const ColumnFiltering = {
60436
60853
  getDefaultColumnDef: () => {
60437
- return defaultColumnSizing;
60854
+ return {
60855
+ filterFn: 'auto'
60856
+ };
60438
60857
  },
60439
60858
  getInitialState: state => {
60440
60859
  return {
60441
- columnSizing: {},
60442
- columnSizingInfo: getDefaultColumnSizingInfoState(),
60860
+ columnFilters: [],
60443
60861
  ...state
60444
60862
  };
60445
60863
  },
60446
60864
  getDefaultOptions: table => {
60447
60865
  return {
60448
- columnResizeMode: 'onEnd',
60449
- columnResizeDirection: 'ltr',
60450
- onColumnSizingChange: makeStateUpdater('columnSizing', table),
60451
- onColumnSizingInfoChange: makeStateUpdater('columnSizingInfo', table)
60866
+ onColumnFiltersChange: makeStateUpdater('columnFilters', table),
60867
+ filterFromLeafRows: false,
60868
+ maxLeafRowFilterDepth: 100
60452
60869
  };
60453
60870
  },
60454
60871
  createColumn: (column, table) => {
60455
- column.getSize = () => {
60456
- var _column$columnDef$min, _ref, _column$columnDef$max;
60457
- const columnSize = table.getState().columnSizing[column.id];
60458
- return Math.min(Math.max((_column$columnDef$min = column.columnDef.minSize) != null ? _column$columnDef$min : defaultColumnSizing.minSize, (_ref = columnSize != null ? columnSize : column.columnDef.size) != null ? _ref : defaultColumnSizing.size), (_column$columnDef$max = column.columnDef.maxSize) != null ? _column$columnDef$max : defaultColumnSizing.maxSize);
60459
- };
60460
- column.getStart = memo$1(position => [position, _getVisibleLeafColumns(table, position), table.getState().columnSizing], (position, columns) => columns.slice(0, column.getIndex(position)).reduce((sum, column) => sum + column.getSize(), 0), getMemoOptions(table.options, 'debugColumns', 'getStart'));
60461
- column.getAfter = memo$1(position => [position, _getVisibleLeafColumns(table, position), table.getState().columnSizing], (position, columns) => columns.slice(column.getIndex(position) + 1).reduce((sum, column) => sum + column.getSize(), 0), getMemoOptions(table.options, 'debugColumns', 'getAfter'));
60462
- column.resetSize = () => {
60463
- table.setColumnSizing(_ref2 => {
60464
- let {
60465
- [column.id]: _,
60466
- ...rest
60467
- } = _ref2;
60468
- return rest;
60469
- });
60872
+ column.getAutoFilterFn = () => {
60873
+ const firstRow = table.getCoreRowModel().flatRows[0];
60874
+ const value = firstRow == null ? void 0 : firstRow.getValue(column.id);
60875
+ if (typeof value === 'string') {
60876
+ return filterFns.includesString;
60877
+ }
60878
+ if (typeof value === 'number') {
60879
+ return filterFns.inNumberRange;
60880
+ }
60881
+ if (typeof value === 'boolean') {
60882
+ return filterFns.equals;
60883
+ }
60884
+ if (value !== null && typeof value === 'object') {
60885
+ return filterFns.equals;
60886
+ }
60887
+ if (Array.isArray(value)) {
60888
+ return filterFns.arrIncludes;
60889
+ }
60890
+ return filterFns.weakEquals;
60470
60891
  };
60471
- column.getCanResize = () => {
60472
- var _column$columnDef$ena, _table$options$enable;
60473
- return ((_column$columnDef$ena = column.columnDef.enableResizing) != null ? _column$columnDef$ena : true) && ((_table$options$enable = table.options.enableColumnResizing) != null ? _table$options$enable : true);
60892
+ column.getFilterFn = () => {
60893
+ var _table$options$filter, _table$options$filter2;
60894
+ return isFunction(column.columnDef.filterFn) ? column.columnDef.filterFn : column.columnDef.filterFn === 'auto' ? column.getAutoFilterFn() : // @ts-ignore
60895
+ (_table$options$filter = (_table$options$filter2 = table.options.filterFns) == null ? void 0 : _table$options$filter2[column.columnDef.filterFn]) != null ? _table$options$filter : filterFns[column.columnDef.filterFn];
60474
60896
  };
60475
- column.getIsResizing = () => {
60476
- return table.getState().columnSizingInfo.isResizingColumn === column.id;
60897
+ column.getCanFilter = () => {
60898
+ var _column$columnDef$ena, _table$options$enable, _table$options$enable2;
60899
+ return ((_column$columnDef$ena = column.columnDef.enableColumnFilter) != null ? _column$columnDef$ena : true) && ((_table$options$enable = table.options.enableColumnFilters) != null ? _table$options$enable : true) && ((_table$options$enable2 = table.options.enableFilters) != null ? _table$options$enable2 : true) && !!column.accessorFn;
60477
60900
  };
60478
- },
60479
- createHeader: (header, table) => {
60480
- header.getSize = () => {
60481
- let sum = 0;
60482
- const recurse = header => {
60483
- if (header.subHeaders.length) {
60484
- header.subHeaders.forEach(recurse);
60485
- } else {
60486
- var _header$column$getSiz;
60487
- sum += (_header$column$getSiz = header.column.getSize()) != null ? _header$column$getSiz : 0;
60488
- }
60489
- };
60490
- recurse(header);
60491
- return sum;
60901
+ column.getIsFiltered = () => column.getFilterIndex() > -1;
60902
+ column.getFilterValue = () => {
60903
+ var _table$getState$colum;
60904
+ return (_table$getState$colum = table.getState().columnFilters) == null || (_table$getState$colum = _table$getState$colum.find(d => d.id === column.id)) == null ? void 0 : _table$getState$colum.value;
60492
60905
  };
60493
- header.getStart = () => {
60494
- if (header.index > 0) {
60495
- const prevSiblingHeader = header.headerGroup.headers[header.index - 1];
60496
- return prevSiblingHeader.getStart() + prevSiblingHeader.getSize();
60497
- }
60498
- return 0;
60906
+ column.getFilterIndex = () => {
60907
+ var _table$getState$colum2, _table$getState$colum3;
60908
+ return (_table$getState$colum2 = (_table$getState$colum3 = table.getState().columnFilters) == null ? void 0 : _table$getState$colum3.findIndex(d => d.id === column.id)) != null ? _table$getState$colum2 : -1;
60499
60909
  };
60500
- header.getResizeHandler = _contextDocument => {
60501
- const column = table.getColumn(header.column.id);
60502
- const canResize = column == null ? void 0 : column.getCanResize();
60503
- return e => {
60504
- if (!column || !canResize) {
60505
- return;
60506
- }
60507
- e.persist == null || e.persist();
60508
- if (isTouchStartEvent(e)) {
60509
- // lets not respond to multiple touches (e.g. 2 or 3 fingers)
60910
+ column.setFilterValue = value => {
60911
+ table.setColumnFilters(old => {
60912
+ const filterFn = column.getFilterFn();
60913
+ const previousFilter = old == null ? void 0 : old.find(d => d.id === column.id);
60914
+ const newFilter = functionalUpdate(value, previousFilter ? previousFilter.value : undefined);
60915
+
60916
+ //
60917
+ if (shouldAutoRemoveFilter(filterFn, newFilter, column)) {
60918
+ var _old$filter;
60919
+ return (_old$filter = old == null ? void 0 : old.filter(d => d.id !== column.id)) != null ? _old$filter : [];
60920
+ }
60921
+ const newFilterObj = {
60922
+ id: column.id,
60923
+ value: newFilter
60924
+ };
60925
+ if (previousFilter) {
60926
+ var _old$map;
60927
+ return (_old$map = old == null ? void 0 : old.map(d => {
60928
+ if (d.id === column.id) {
60929
+ return newFilterObj;
60930
+ }
60931
+ return d;
60932
+ })) != null ? _old$map : [];
60933
+ }
60934
+ if (old != null && old.length) {
60935
+ return [...old, newFilterObj];
60936
+ }
60937
+ return [newFilterObj];
60938
+ });
60939
+ };
60940
+ },
60941
+ createRow: (row, _table) => {
60942
+ row.columnFilters = {};
60943
+ row.columnFiltersMeta = {};
60944
+ },
60945
+ createTable: table => {
60946
+ table.setColumnFilters = updater => {
60947
+ const leafColumns = table.getAllLeafColumns();
60948
+ const updateFn = old => {
60949
+ var _functionalUpdate;
60950
+ return (_functionalUpdate = functionalUpdate(updater, old)) == null ? void 0 : _functionalUpdate.filter(filter => {
60951
+ const column = leafColumns.find(d => d.id === filter.id);
60952
+ if (column) {
60953
+ const filterFn = column.getFilterFn();
60954
+ if (shouldAutoRemoveFilter(filterFn, filter.value, column)) {
60955
+ return false;
60956
+ }
60957
+ }
60958
+ return true;
60959
+ });
60960
+ };
60961
+ table.options.onColumnFiltersChange == null || table.options.onColumnFiltersChange(updateFn);
60962
+ };
60963
+ table.resetColumnFilters = defaultState => {
60964
+ var _table$initialState$c, _table$initialState;
60965
+ table.setColumnFilters(defaultState ? [] : (_table$initialState$c = (_table$initialState = table.initialState) == null ? void 0 : _table$initialState.columnFilters) != null ? _table$initialState$c : []);
60966
+ };
60967
+ table.getPreFilteredRowModel = () => table.getCoreRowModel();
60968
+ table.getFilteredRowModel = () => {
60969
+ if (!table._getFilteredRowModel && table.options.getFilteredRowModel) {
60970
+ table._getFilteredRowModel = table.options.getFilteredRowModel(table);
60971
+ }
60972
+ if (table.options.manualFiltering || !table._getFilteredRowModel) {
60973
+ return table.getPreFilteredRowModel();
60974
+ }
60975
+ return table._getFilteredRowModel();
60976
+ };
60977
+ }
60978
+ };
60979
+ function shouldAutoRemoveFilter(filterFn, value, column) {
60980
+ return (filterFn && filterFn.autoRemove ? filterFn.autoRemove(value, column) : false) || typeof value === 'undefined' || typeof value === 'string' && !value;
60981
+ }
60982
+
60983
+ const sum = (columnId, _leafRows, childRows) => {
60984
+ // It's faster to just add the aggregations together instead of
60985
+ // process leaf nodes individually
60986
+ return childRows.reduce((sum, next) => {
60987
+ const nextValue = next.getValue(columnId);
60988
+ return sum + (typeof nextValue === 'number' ? nextValue : 0);
60989
+ }, 0);
60990
+ };
60991
+ const min = (columnId, _leafRows, childRows) => {
60992
+ let min;
60993
+ childRows.forEach(row => {
60994
+ const value = row.getValue(columnId);
60995
+ if (value != null && (min > value || min === undefined && value >= value)) {
60996
+ min = value;
60997
+ }
60998
+ });
60999
+ return min;
61000
+ };
61001
+ const max = (columnId, _leafRows, childRows) => {
61002
+ let max;
61003
+ childRows.forEach(row => {
61004
+ const value = row.getValue(columnId);
61005
+ if (value != null && (max < value || max === undefined && value >= value)) {
61006
+ max = value;
61007
+ }
61008
+ });
61009
+ return max;
61010
+ };
61011
+ const extent = (columnId, _leafRows, childRows) => {
61012
+ let min;
61013
+ let max;
61014
+ childRows.forEach(row => {
61015
+ const value = row.getValue(columnId);
61016
+ if (value != null) {
61017
+ if (min === undefined) {
61018
+ if (value >= value) min = max = value;
61019
+ } else {
61020
+ if (min > value) min = value;
61021
+ if (max < value) max = value;
61022
+ }
61023
+ }
61024
+ });
61025
+ return [min, max];
61026
+ };
61027
+ const mean = (columnId, leafRows) => {
61028
+ let count = 0;
61029
+ let sum = 0;
61030
+ leafRows.forEach(row => {
61031
+ let value = row.getValue(columnId);
61032
+ if (value != null && (value = +value) >= value) {
61033
+ ++count, sum += value;
61034
+ }
61035
+ });
61036
+ if (count) return sum / count;
61037
+ return;
61038
+ };
61039
+ const median = (columnId, leafRows) => {
61040
+ if (!leafRows.length) {
61041
+ return;
61042
+ }
61043
+ const values = leafRows.map(row => row.getValue(columnId));
61044
+ if (!isNumberArray$1(values)) {
61045
+ return;
61046
+ }
61047
+ if (values.length === 1) {
61048
+ return values[0];
61049
+ }
61050
+ const mid = Math.floor(values.length / 2);
61051
+ const nums = values.sort((a, b) => a - b);
61052
+ return values.length % 2 !== 0 ? nums[mid] : (nums[mid - 1] + nums[mid]) / 2;
61053
+ };
61054
+ const unique = (columnId, leafRows) => {
61055
+ return Array.from(new Set(leafRows.map(d => d.getValue(columnId))).values());
61056
+ };
61057
+ const uniqueCount = (columnId, leafRows) => {
61058
+ return new Set(leafRows.map(d => d.getValue(columnId))).size;
61059
+ };
61060
+ const count = (_columnId, leafRows) => {
61061
+ return leafRows.length;
61062
+ };
61063
+ const aggregationFns = {
61064
+ sum,
61065
+ min,
61066
+ max,
61067
+ extent,
61068
+ mean,
61069
+ median,
61070
+ unique,
61071
+ uniqueCount,
61072
+ count
61073
+ };
61074
+
61075
+ //
61076
+
61077
+ const ColumnGrouping = {
61078
+ getDefaultColumnDef: () => {
61079
+ return {
61080
+ aggregatedCell: props => {
61081
+ var _toString, _props$getValue;
61082
+ return (_toString = (_props$getValue = props.getValue()) == null || _props$getValue.toString == null ? void 0 : _props$getValue.toString()) != null ? _toString : null;
61083
+ },
61084
+ aggregationFn: 'auto'
61085
+ };
61086
+ },
61087
+ getInitialState: state => {
61088
+ return {
61089
+ grouping: [],
61090
+ ...state
61091
+ };
61092
+ },
61093
+ getDefaultOptions: table => {
61094
+ return {
61095
+ onGroupingChange: makeStateUpdater('grouping', table),
61096
+ groupedColumnMode: 'reorder'
61097
+ };
61098
+ },
61099
+ createColumn: (column, table) => {
61100
+ column.toggleGrouping = () => {
61101
+ table.setGrouping(old => {
61102
+ // Find any existing grouping for this column
61103
+ if (old != null && old.includes(column.id)) {
61104
+ return old.filter(d => d !== column.id);
61105
+ }
61106
+ return [...(old != null ? old : []), column.id];
61107
+ });
61108
+ };
61109
+ column.getCanGroup = () => {
61110
+ var _column$columnDef$ena, _table$options$enable;
61111
+ return ((_column$columnDef$ena = column.columnDef.enableGrouping) != null ? _column$columnDef$ena : true) && ((_table$options$enable = table.options.enableGrouping) != null ? _table$options$enable : true) && (!!column.accessorFn || !!column.columnDef.getGroupingValue);
61112
+ };
61113
+ column.getIsGrouped = () => {
61114
+ var _table$getState$group;
61115
+ return (_table$getState$group = table.getState().grouping) == null ? void 0 : _table$getState$group.includes(column.id);
61116
+ };
61117
+ column.getGroupedIndex = () => {
61118
+ var _table$getState$group2;
61119
+ return (_table$getState$group2 = table.getState().grouping) == null ? void 0 : _table$getState$group2.indexOf(column.id);
61120
+ };
61121
+ column.getToggleGroupingHandler = () => {
61122
+ const canGroup = column.getCanGroup();
61123
+ return () => {
61124
+ if (!canGroup) return;
61125
+ column.toggleGrouping();
61126
+ };
61127
+ };
61128
+ column.getAutoAggregationFn = () => {
61129
+ const firstRow = table.getCoreRowModel().flatRows[0];
61130
+ const value = firstRow == null ? void 0 : firstRow.getValue(column.id);
61131
+ if (typeof value === 'number') {
61132
+ return aggregationFns.sum;
61133
+ }
61134
+ if (Object.prototype.toString.call(value) === '[object Date]') {
61135
+ return aggregationFns.extent;
61136
+ }
61137
+ };
61138
+ column.getAggregationFn = () => {
61139
+ var _table$options$aggreg, _table$options$aggreg2;
61140
+ if (!column) {
61141
+ throw new Error();
61142
+ }
61143
+ return isFunction(column.columnDef.aggregationFn) ? column.columnDef.aggregationFn : column.columnDef.aggregationFn === 'auto' ? column.getAutoAggregationFn() : (_table$options$aggreg = (_table$options$aggreg2 = table.options.aggregationFns) == null ? void 0 : _table$options$aggreg2[column.columnDef.aggregationFn]) != null ? _table$options$aggreg : aggregationFns[column.columnDef.aggregationFn];
61144
+ };
61145
+ },
61146
+ createTable: table => {
61147
+ table.setGrouping = updater => table.options.onGroupingChange == null ? void 0 : table.options.onGroupingChange(updater);
61148
+ table.resetGrouping = defaultState => {
61149
+ var _table$initialState$g, _table$initialState;
61150
+ table.setGrouping(defaultState ? [] : (_table$initialState$g = (_table$initialState = table.initialState) == null ? void 0 : _table$initialState.grouping) != null ? _table$initialState$g : []);
61151
+ };
61152
+ table.getPreGroupedRowModel = () => table.getFilteredRowModel();
61153
+ table.getGroupedRowModel = () => {
61154
+ if (!table._getGroupedRowModel && table.options.getGroupedRowModel) {
61155
+ table._getGroupedRowModel = table.options.getGroupedRowModel(table);
61156
+ }
61157
+ if (table.options.manualGrouping || !table._getGroupedRowModel) {
61158
+ return table.getPreGroupedRowModel();
61159
+ }
61160
+ return table._getGroupedRowModel();
61161
+ };
61162
+ },
61163
+ createRow: (row, table) => {
61164
+ row.getIsGrouped = () => !!row.groupingColumnId;
61165
+ row.getGroupingValue = columnId => {
61166
+ if (row._groupingValuesCache.hasOwnProperty(columnId)) {
61167
+ return row._groupingValuesCache[columnId];
61168
+ }
61169
+ const column = table.getColumn(columnId);
61170
+ if (!(column != null && column.columnDef.getGroupingValue)) {
61171
+ return row.getValue(columnId);
61172
+ }
61173
+ row._groupingValuesCache[columnId] = column.columnDef.getGroupingValue(row.original);
61174
+ return row._groupingValuesCache[columnId];
61175
+ };
61176
+ row._groupingValuesCache = {};
61177
+ },
61178
+ createCell: (cell, column, row, table) => {
61179
+ cell.getIsGrouped = () => column.getIsGrouped() && column.id === row.groupingColumnId;
61180
+ cell.getIsPlaceholder = () => !cell.getIsGrouped() && column.getIsGrouped();
61181
+ cell.getIsAggregated = () => {
61182
+ var _row$subRows;
61183
+ return !cell.getIsGrouped() && !cell.getIsPlaceholder() && !!((_row$subRows = row.subRows) != null && _row$subRows.length);
61184
+ };
61185
+ }
61186
+ };
61187
+ function orderColumns(leafColumns, grouping, groupedColumnMode) {
61188
+ if (!(grouping != null && grouping.length) || !groupedColumnMode) {
61189
+ return leafColumns;
61190
+ }
61191
+ const nonGroupingColumns = leafColumns.filter(col => !grouping.includes(col.id));
61192
+ if (groupedColumnMode === 'remove') {
61193
+ return nonGroupingColumns;
61194
+ }
61195
+ const groupingColumns = grouping.map(g => leafColumns.find(col => col.id === g)).filter(Boolean);
61196
+ return [...groupingColumns, ...nonGroupingColumns];
61197
+ }
61198
+
61199
+ //
61200
+
61201
+ const ColumnOrdering = {
61202
+ getInitialState: state => {
61203
+ return {
61204
+ columnOrder: [],
61205
+ ...state
61206
+ };
61207
+ },
61208
+ getDefaultOptions: table => {
61209
+ return {
61210
+ onColumnOrderChange: makeStateUpdater('columnOrder', table)
61211
+ };
61212
+ },
61213
+ createColumn: (column, table) => {
61214
+ column.getIndex = memo$1(position => [_getVisibleLeafColumns(table, position)], columns => columns.findIndex(d => d.id === column.id), getMemoOptions(table.options, 'debugColumns', 'getIndex'));
61215
+ column.getIsFirstColumn = position => {
61216
+ var _columns$;
61217
+ const columns = _getVisibleLeafColumns(table, position);
61218
+ return ((_columns$ = columns[0]) == null ? void 0 : _columns$.id) === column.id;
61219
+ };
61220
+ column.getIsLastColumn = position => {
61221
+ var _columns;
61222
+ const columns = _getVisibleLeafColumns(table, position);
61223
+ return ((_columns = columns[columns.length - 1]) == null ? void 0 : _columns.id) === column.id;
61224
+ };
61225
+ },
61226
+ createTable: table => {
61227
+ table.setColumnOrder = updater => table.options.onColumnOrderChange == null ? void 0 : table.options.onColumnOrderChange(updater);
61228
+ table.resetColumnOrder = defaultState => {
61229
+ var _table$initialState$c;
61230
+ table.setColumnOrder(defaultState ? [] : (_table$initialState$c = table.initialState.columnOrder) != null ? _table$initialState$c : []);
61231
+ };
61232
+ table._getOrderColumnsFn = memo$1(() => [table.getState().columnOrder, table.getState().grouping, table.options.groupedColumnMode], (columnOrder, grouping, groupedColumnMode) => columns => {
61233
+ // Sort grouped columns to the start of the column list
61234
+ // before the headers are built
61235
+ let orderedColumns = [];
61236
+
61237
+ // If there is no order, return the normal columns
61238
+ if (!(columnOrder != null && columnOrder.length)) {
61239
+ orderedColumns = columns;
61240
+ } else {
61241
+ const columnOrderCopy = [...columnOrder];
61242
+
61243
+ // If there is an order, make a copy of the columns
61244
+ const columnsCopy = [...columns];
61245
+
61246
+ // And make a new ordered array of the columns
61247
+
61248
+ // Loop over the columns and place them in order into the new array
61249
+ while (columnsCopy.length && columnOrderCopy.length) {
61250
+ const targetColumnId = columnOrderCopy.shift();
61251
+ const foundIndex = columnsCopy.findIndex(d => d.id === targetColumnId);
61252
+ if (foundIndex > -1) {
61253
+ orderedColumns.push(columnsCopy.splice(foundIndex, 1)[0]);
61254
+ }
61255
+ }
61256
+
61257
+ // If there are any columns left, add them to the end
61258
+ orderedColumns = [...orderedColumns, ...columnsCopy];
61259
+ }
61260
+ return orderColumns(orderedColumns, grouping, groupedColumnMode);
61261
+ }, getMemoOptions(table.options, 'debugTable', '_getOrderColumnsFn'));
61262
+ }
61263
+ };
61264
+
61265
+ //
61266
+
61267
+ const getDefaultColumnPinningState = () => ({
61268
+ left: [],
61269
+ right: []
61270
+ });
61271
+ const ColumnPinning = {
61272
+ getInitialState: state => {
61273
+ return {
61274
+ columnPinning: getDefaultColumnPinningState(),
61275
+ ...state
61276
+ };
61277
+ },
61278
+ getDefaultOptions: table => {
61279
+ return {
61280
+ onColumnPinningChange: makeStateUpdater('columnPinning', table)
61281
+ };
61282
+ },
61283
+ createColumn: (column, table) => {
61284
+ column.pin = position => {
61285
+ const columnIds = column.getLeafColumns().map(d => d.id).filter(Boolean);
61286
+ table.setColumnPinning(old => {
61287
+ var _old$left3, _old$right3;
61288
+ if (position === 'right') {
61289
+ var _old$left, _old$right;
61290
+ return {
61291
+ left: ((_old$left = old == null ? void 0 : old.left) != null ? _old$left : []).filter(d => !(columnIds != null && columnIds.includes(d))),
61292
+ right: [...((_old$right = old == null ? void 0 : old.right) != null ? _old$right : []).filter(d => !(columnIds != null && columnIds.includes(d))), ...columnIds]
61293
+ };
61294
+ }
61295
+ if (position === 'left') {
61296
+ var _old$left2, _old$right2;
61297
+ return {
61298
+ left: [...((_old$left2 = old == null ? void 0 : old.left) != null ? _old$left2 : []).filter(d => !(columnIds != null && columnIds.includes(d))), ...columnIds],
61299
+ right: ((_old$right2 = old == null ? void 0 : old.right) != null ? _old$right2 : []).filter(d => !(columnIds != null && columnIds.includes(d)))
61300
+ };
61301
+ }
61302
+ return {
61303
+ left: ((_old$left3 = old == null ? void 0 : old.left) != null ? _old$left3 : []).filter(d => !(columnIds != null && columnIds.includes(d))),
61304
+ right: ((_old$right3 = old == null ? void 0 : old.right) != null ? _old$right3 : []).filter(d => !(columnIds != null && columnIds.includes(d)))
61305
+ };
61306
+ });
61307
+ };
61308
+ column.getCanPin = () => {
61309
+ const leafColumns = column.getLeafColumns();
61310
+ return leafColumns.some(d => {
61311
+ var _d$columnDef$enablePi, _ref, _table$options$enable;
61312
+ return ((_d$columnDef$enablePi = d.columnDef.enablePinning) != null ? _d$columnDef$enablePi : true) && ((_ref = (_table$options$enable = table.options.enableColumnPinning) != null ? _table$options$enable : table.options.enablePinning) != null ? _ref : true);
61313
+ });
61314
+ };
61315
+ column.getIsPinned = () => {
61316
+ const leafColumnIds = column.getLeafColumns().map(d => d.id);
61317
+ const {
61318
+ left,
61319
+ right
61320
+ } = table.getState().columnPinning;
61321
+ const isLeft = leafColumnIds.some(d => left == null ? void 0 : left.includes(d));
61322
+ const isRight = leafColumnIds.some(d => right == null ? void 0 : right.includes(d));
61323
+ return isLeft ? 'left' : isRight ? 'right' : false;
61324
+ };
61325
+ column.getPinnedIndex = () => {
61326
+ var _table$getState$colum, _table$getState$colum2;
61327
+ const position = column.getIsPinned();
61328
+ return position ? (_table$getState$colum = (_table$getState$colum2 = table.getState().columnPinning) == null || (_table$getState$colum2 = _table$getState$colum2[position]) == null ? void 0 : _table$getState$colum2.indexOf(column.id)) != null ? _table$getState$colum : -1 : 0;
61329
+ };
61330
+ },
61331
+ createRow: (row, table) => {
61332
+ row.getCenterVisibleCells = memo$1(() => [row._getAllVisibleCells(), table.getState().columnPinning.left, table.getState().columnPinning.right], (allCells, left, right) => {
61333
+ const leftAndRight = [...(left != null ? left : []), ...(right != null ? right : [])];
61334
+ return allCells.filter(d => !leftAndRight.includes(d.column.id));
61335
+ }, getMemoOptions(table.options, 'debugRows', 'getCenterVisibleCells'));
61336
+ row.getLeftVisibleCells = memo$1(() => [row._getAllVisibleCells(), table.getState().columnPinning.left], (allCells, left) => {
61337
+ const cells = (left != null ? left : []).map(columnId => allCells.find(cell => cell.column.id === columnId)).filter(Boolean).map(d => ({
61338
+ ...d,
61339
+ position: 'left'
61340
+ }));
61341
+ return cells;
61342
+ }, getMemoOptions(table.options, 'debugRows', 'getLeftVisibleCells'));
61343
+ row.getRightVisibleCells = memo$1(() => [row._getAllVisibleCells(), table.getState().columnPinning.right], (allCells, right) => {
61344
+ const cells = (right != null ? right : []).map(columnId => allCells.find(cell => cell.column.id === columnId)).filter(Boolean).map(d => ({
61345
+ ...d,
61346
+ position: 'right'
61347
+ }));
61348
+ return cells;
61349
+ }, getMemoOptions(table.options, 'debugRows', 'getRightVisibleCells'));
61350
+ },
61351
+ createTable: table => {
61352
+ table.setColumnPinning = updater => table.options.onColumnPinningChange == null ? void 0 : table.options.onColumnPinningChange(updater);
61353
+ table.resetColumnPinning = defaultState => {
61354
+ var _table$initialState$c, _table$initialState;
61355
+ return table.setColumnPinning(defaultState ? getDefaultColumnPinningState() : (_table$initialState$c = (_table$initialState = table.initialState) == null ? void 0 : _table$initialState.columnPinning) != null ? _table$initialState$c : getDefaultColumnPinningState());
61356
+ };
61357
+ table.getIsSomeColumnsPinned = position => {
61358
+ var _pinningState$positio;
61359
+ const pinningState = table.getState().columnPinning;
61360
+ if (!position) {
61361
+ var _pinningState$left, _pinningState$right;
61362
+ return Boolean(((_pinningState$left = pinningState.left) == null ? void 0 : _pinningState$left.length) || ((_pinningState$right = pinningState.right) == null ? void 0 : _pinningState$right.length));
61363
+ }
61364
+ return Boolean((_pinningState$positio = pinningState[position]) == null ? void 0 : _pinningState$positio.length);
61365
+ };
61366
+ table.getLeftLeafColumns = memo$1(() => [table.getAllLeafColumns(), table.getState().columnPinning.left], (allColumns, left) => {
61367
+ return (left != null ? left : []).map(columnId => allColumns.find(column => column.id === columnId)).filter(Boolean);
61368
+ }, getMemoOptions(table.options, 'debugColumns', 'getLeftLeafColumns'));
61369
+ table.getRightLeafColumns = memo$1(() => [table.getAllLeafColumns(), table.getState().columnPinning.right], (allColumns, right) => {
61370
+ return (right != null ? right : []).map(columnId => allColumns.find(column => column.id === columnId)).filter(Boolean);
61371
+ }, getMemoOptions(table.options, 'debugColumns', 'getRightLeafColumns'));
61372
+ table.getCenterLeafColumns = memo$1(() => [table.getAllLeafColumns(), table.getState().columnPinning.left, table.getState().columnPinning.right], (allColumns, left, right) => {
61373
+ const leftAndRight = [...(left != null ? left : []), ...(right != null ? right : [])];
61374
+ return allColumns.filter(d => !leftAndRight.includes(d.id));
61375
+ }, getMemoOptions(table.options, 'debugColumns', 'getCenterLeafColumns'));
61376
+ }
61377
+ };
61378
+
61379
+ //
61380
+
61381
+ //
61382
+
61383
+ const defaultColumnSizing = {
61384
+ size: 150,
61385
+ minSize: 20,
61386
+ maxSize: Number.MAX_SAFE_INTEGER
61387
+ };
61388
+ const getDefaultColumnSizingInfoState = () => ({
61389
+ startOffset: null,
61390
+ startSize: null,
61391
+ deltaOffset: null,
61392
+ deltaPercentage: null,
61393
+ isResizingColumn: false,
61394
+ columnSizingStart: []
61395
+ });
61396
+ const ColumnSizing = {
61397
+ getDefaultColumnDef: () => {
61398
+ return defaultColumnSizing;
61399
+ },
61400
+ getInitialState: state => {
61401
+ return {
61402
+ columnSizing: {},
61403
+ columnSizingInfo: getDefaultColumnSizingInfoState(),
61404
+ ...state
61405
+ };
61406
+ },
61407
+ getDefaultOptions: table => {
61408
+ return {
61409
+ columnResizeMode: 'onEnd',
61410
+ columnResizeDirection: 'ltr',
61411
+ onColumnSizingChange: makeStateUpdater('columnSizing', table),
61412
+ onColumnSizingInfoChange: makeStateUpdater('columnSizingInfo', table)
61413
+ };
61414
+ },
61415
+ createColumn: (column, table) => {
61416
+ column.getSize = () => {
61417
+ var _column$columnDef$min, _ref, _column$columnDef$max;
61418
+ const columnSize = table.getState().columnSizing[column.id];
61419
+ return Math.min(Math.max((_column$columnDef$min = column.columnDef.minSize) != null ? _column$columnDef$min : defaultColumnSizing.minSize, (_ref = columnSize != null ? columnSize : column.columnDef.size) != null ? _ref : defaultColumnSizing.size), (_column$columnDef$max = column.columnDef.maxSize) != null ? _column$columnDef$max : defaultColumnSizing.maxSize);
61420
+ };
61421
+ column.getStart = memo$1(position => [position, _getVisibleLeafColumns(table, position), table.getState().columnSizing], (position, columns) => columns.slice(0, column.getIndex(position)).reduce((sum, column) => sum + column.getSize(), 0), getMemoOptions(table.options, 'debugColumns', 'getStart'));
61422
+ column.getAfter = memo$1(position => [position, _getVisibleLeafColumns(table, position), table.getState().columnSizing], (position, columns) => columns.slice(column.getIndex(position) + 1).reduce((sum, column) => sum + column.getSize(), 0), getMemoOptions(table.options, 'debugColumns', 'getAfter'));
61423
+ column.resetSize = () => {
61424
+ table.setColumnSizing(_ref2 => {
61425
+ let {
61426
+ [column.id]: _,
61427
+ ...rest
61428
+ } = _ref2;
61429
+ return rest;
61430
+ });
61431
+ };
61432
+ column.getCanResize = () => {
61433
+ var _column$columnDef$ena, _table$options$enable;
61434
+ return ((_column$columnDef$ena = column.columnDef.enableResizing) != null ? _column$columnDef$ena : true) && ((_table$options$enable = table.options.enableColumnResizing) != null ? _table$options$enable : true);
61435
+ };
61436
+ column.getIsResizing = () => {
61437
+ return table.getState().columnSizingInfo.isResizingColumn === column.id;
61438
+ };
61439
+ },
61440
+ createHeader: (header, table) => {
61441
+ header.getSize = () => {
61442
+ let sum = 0;
61443
+ const recurse = header => {
61444
+ if (header.subHeaders.length) {
61445
+ header.subHeaders.forEach(recurse);
61446
+ } else {
61447
+ var _header$column$getSiz;
61448
+ sum += (_header$column$getSiz = header.column.getSize()) != null ? _header$column$getSiz : 0;
61449
+ }
61450
+ };
61451
+ recurse(header);
61452
+ return sum;
61453
+ };
61454
+ header.getStart = () => {
61455
+ if (header.index > 0) {
61456
+ const prevSiblingHeader = header.headerGroup.headers[header.index - 1];
61457
+ return prevSiblingHeader.getStart() + prevSiblingHeader.getSize();
61458
+ }
61459
+ return 0;
61460
+ };
61461
+ header.getResizeHandler = _contextDocument => {
61462
+ const column = table.getColumn(header.column.id);
61463
+ const canResize = column == null ? void 0 : column.getCanResize();
61464
+ return e => {
61465
+ if (!column || !canResize) {
61466
+ return;
61467
+ }
61468
+ e.persist == null || e.persist();
61469
+ if (isTouchStartEvent(e)) {
61470
+ // lets not respond to multiple touches (e.g. 2 or 3 fingers)
60510
61471
  if (e.touches && e.touches.length > 1) {
60511
61472
  return;
60512
61473
  }
@@ -60668,424 +61629,90 @@ img.ProseMirror-separator {
60668
61629
 
60669
61630
  //
60670
61631
 
60671
- const Expanding = {
61632
+ const ColumnVisibility = {
60672
61633
  getInitialState: state => {
60673
61634
  return {
60674
- expanded: {},
61635
+ columnVisibility: {},
60675
61636
  ...state
60676
61637
  };
60677
61638
  },
60678
61639
  getDefaultOptions: table => {
60679
61640
  return {
60680
- onExpandedChange: makeStateUpdater('expanded', table),
60681
- paginateExpandedRows: true
61641
+ onColumnVisibilityChange: makeStateUpdater('columnVisibility', table)
60682
61642
  };
60683
61643
  },
60684
- createTable: table => {
60685
- let registered = false;
60686
- let queued = false;
60687
- table._autoResetExpanded = () => {
60688
- var _ref, _table$options$autoRe;
60689
- if (!registered) {
60690
- table._queue(() => {
60691
- registered = true;
60692
- });
60693
- return;
60694
- }
60695
- if ((_ref = (_table$options$autoRe = table.options.autoResetAll) != null ? _table$options$autoRe : table.options.autoResetExpanded) != null ? _ref : !table.options.manualExpanding) {
60696
- if (queued) return;
60697
- queued = true;
60698
- table._queue(() => {
60699
- table.resetExpanded();
60700
- queued = false;
60701
- });
60702
- }
60703
- };
60704
- table.setExpanded = updater => table.options.onExpandedChange == null ? void 0 : table.options.onExpandedChange(updater);
60705
- table.toggleAllRowsExpanded = expanded => {
60706
- if (expanded != null ? expanded : !table.getIsAllRowsExpanded()) {
60707
- table.setExpanded(true);
60708
- } else {
60709
- table.setExpanded({});
61644
+ createColumn: (column, table) => {
61645
+ column.toggleVisibility = value => {
61646
+ if (column.getCanHide()) {
61647
+ table.setColumnVisibility(old => ({
61648
+ ...old,
61649
+ [column.id]: value != null ? value : !column.getIsVisible()
61650
+ }));
60710
61651
  }
60711
61652
  };
60712
- table.resetExpanded = defaultState => {
60713
- var _table$initialState$e, _table$initialState;
60714
- table.setExpanded(defaultState ? {} : (_table$initialState$e = (_table$initialState = table.initialState) == null ? void 0 : _table$initialState.expanded) != null ? _table$initialState$e : {});
61653
+ column.getIsVisible = () => {
61654
+ var _ref, _table$getState$colum;
61655
+ const childColumns = column.columns;
61656
+ return (_ref = childColumns.length ? childColumns.some(c => c.getIsVisible()) : (_table$getState$colum = table.getState().columnVisibility) == null ? void 0 : _table$getState$colum[column.id]) != null ? _ref : true;
60715
61657
  };
60716
- table.getCanSomeRowsExpand = () => {
60717
- return table.getPrePaginationRowModel().flatRows.some(row => row.getCanExpand());
61658
+ column.getCanHide = () => {
61659
+ var _column$columnDef$ena, _table$options$enable;
61660
+ return ((_column$columnDef$ena = column.columnDef.enableHiding) != null ? _column$columnDef$ena : true) && ((_table$options$enable = table.options.enableHiding) != null ? _table$options$enable : true);
60718
61661
  };
60719
- table.getToggleAllRowsExpandedHandler = () => {
61662
+ column.getToggleVisibilityHandler = () => {
60720
61663
  return e => {
60721
- e.persist == null || e.persist();
60722
- table.toggleAllRowsExpanded();
60723
- };
60724
- };
60725
- table.getIsSomeRowsExpanded = () => {
60726
- const expanded = table.getState().expanded;
60727
- return expanded === true || Object.values(expanded).some(Boolean);
60728
- };
60729
- table.getIsAllRowsExpanded = () => {
60730
- const expanded = table.getState().expanded;
60731
-
60732
- // If expanded is true, save some cycles and return true
60733
- if (typeof expanded === 'boolean') {
60734
- return expanded === true;
60735
- }
60736
- if (!Object.keys(expanded).length) {
60737
- return false;
60738
- }
60739
-
60740
- // If any row is not expanded, return false
60741
- if (table.getRowModel().flatRows.some(row => !row.getIsExpanded())) {
60742
- return false;
60743
- }
60744
-
60745
- // They must all be expanded :shrug:
60746
- return true;
60747
- };
60748
- table.getExpandedDepth = () => {
60749
- let maxDepth = 0;
60750
- const rowIds = table.getState().expanded === true ? Object.keys(table.getRowModel().rowsById) : Object.keys(table.getState().expanded);
60751
- rowIds.forEach(id => {
60752
- const splitId = id.split('.');
60753
- maxDepth = Math.max(maxDepth, splitId.length);
60754
- });
60755
- return maxDepth;
60756
- };
60757
- table.getPreExpandedRowModel = () => table.getSortedRowModel();
60758
- table.getExpandedRowModel = () => {
60759
- if (!table._getExpandedRowModel && table.options.getExpandedRowModel) {
60760
- table._getExpandedRowModel = table.options.getExpandedRowModel(table);
60761
- }
60762
- if (table.options.manualExpanding || !table._getExpandedRowModel) {
60763
- return table.getPreExpandedRowModel();
60764
- }
60765
- return table._getExpandedRowModel();
60766
- };
60767
- },
60768
- createRow: (row, table) => {
60769
- row.toggleExpanded = expanded => {
60770
- table.setExpanded(old => {
60771
- var _expanded;
60772
- const exists = old === true ? true : !!(old != null && old[row.id]);
60773
- let oldExpanded = {};
60774
- if (old === true) {
60775
- Object.keys(table.getRowModel().rowsById).forEach(rowId => {
60776
- oldExpanded[rowId] = true;
60777
- });
60778
- } else {
60779
- oldExpanded = old;
60780
- }
60781
- expanded = (_expanded = expanded) != null ? _expanded : !exists;
60782
- if (!exists && expanded) {
60783
- return {
60784
- ...oldExpanded,
60785
- [row.id]: true
60786
- };
60787
- }
60788
- if (exists && !expanded) {
60789
- const {
60790
- [row.id]: _,
60791
- ...rest
60792
- } = oldExpanded;
60793
- return rest;
60794
- }
60795
- return old;
60796
- });
60797
- };
60798
- row.getIsExpanded = () => {
60799
- var _table$options$getIsR;
60800
- const expanded = table.getState().expanded;
60801
- return !!((_table$options$getIsR = table.options.getIsRowExpanded == null ? void 0 : table.options.getIsRowExpanded(row)) != null ? _table$options$getIsR : expanded === true || (expanded == null ? void 0 : expanded[row.id]));
60802
- };
60803
- row.getCanExpand = () => {
60804
- var _table$options$getRow, _table$options$enable, _row$subRows;
60805
- return (_table$options$getRow = table.options.getRowCanExpand == null ? void 0 : table.options.getRowCanExpand(row)) != null ? _table$options$getRow : ((_table$options$enable = table.options.enableExpanding) != null ? _table$options$enable : true) && !!((_row$subRows = row.subRows) != null && _row$subRows.length);
60806
- };
60807
- row.getIsAllParentsExpanded = () => {
60808
- let isFullyExpanded = true;
60809
- let currentRow = row;
60810
- while (isFullyExpanded && currentRow.parentId) {
60811
- currentRow = table.getRow(currentRow.parentId, true);
60812
- isFullyExpanded = currentRow.getIsExpanded();
60813
- }
60814
- return isFullyExpanded;
60815
- };
60816
- row.getToggleExpandedHandler = () => {
60817
- const canExpand = row.getCanExpand();
60818
- return () => {
60819
- if (!canExpand) return;
60820
- row.toggleExpanded();
61664
+ column.toggleVisibility == null || column.toggleVisibility(e.target.checked);
60821
61665
  };
60822
61666
  };
60823
- }
60824
- };
60825
-
60826
- const includesString = (row, columnId, filterValue) => {
60827
- var _row$getValue;
60828
- const search = filterValue.toLowerCase();
60829
- return Boolean((_row$getValue = row.getValue(columnId)) == null || (_row$getValue = _row$getValue.toString()) == null || (_row$getValue = _row$getValue.toLowerCase()) == null ? void 0 : _row$getValue.includes(search));
60830
- };
60831
- includesString.autoRemove = val => testFalsey(val);
60832
- const includesStringSensitive = (row, columnId, filterValue) => {
60833
- var _row$getValue2;
60834
- return Boolean((_row$getValue2 = row.getValue(columnId)) == null || (_row$getValue2 = _row$getValue2.toString()) == null ? void 0 : _row$getValue2.includes(filterValue));
60835
- };
60836
- includesStringSensitive.autoRemove = val => testFalsey(val);
60837
- const equalsString = (row, columnId, filterValue) => {
60838
- var _row$getValue3;
60839
- return ((_row$getValue3 = row.getValue(columnId)) == null || (_row$getValue3 = _row$getValue3.toString()) == null ? void 0 : _row$getValue3.toLowerCase()) === (filterValue == null ? void 0 : filterValue.toLowerCase());
60840
- };
60841
- equalsString.autoRemove = val => testFalsey(val);
60842
- const arrIncludes = (row, columnId, filterValue) => {
60843
- var _row$getValue4;
60844
- return (_row$getValue4 = row.getValue(columnId)) == null ? void 0 : _row$getValue4.includes(filterValue);
60845
- };
60846
- arrIncludes.autoRemove = val => testFalsey(val) || !(val != null && val.length);
60847
- const arrIncludesAll = (row, columnId, filterValue) => {
60848
- return !filterValue.some(val => {
60849
- var _row$getValue5;
60850
- return !((_row$getValue5 = row.getValue(columnId)) != null && _row$getValue5.includes(val));
60851
- });
60852
- };
60853
- arrIncludesAll.autoRemove = val => testFalsey(val) || !(val != null && val.length);
60854
- const arrIncludesSome = (row, columnId, filterValue) => {
60855
- return filterValue.some(val => {
60856
- var _row$getValue6;
60857
- return (_row$getValue6 = row.getValue(columnId)) == null ? void 0 : _row$getValue6.includes(val);
60858
- });
60859
- };
60860
- arrIncludesSome.autoRemove = val => testFalsey(val) || !(val != null && val.length);
60861
- const equals = (row, columnId, filterValue) => {
60862
- return row.getValue(columnId) === filterValue;
60863
- };
60864
- equals.autoRemove = val => testFalsey(val);
60865
- const weakEquals = (row, columnId, filterValue) => {
60866
- return row.getValue(columnId) == filterValue;
60867
- };
60868
- weakEquals.autoRemove = val => testFalsey(val);
60869
- const inNumberRange = (row, columnId, filterValue) => {
60870
- let [min, max] = filterValue;
60871
- const rowValue = row.getValue(columnId);
60872
- return rowValue >= min && rowValue <= max;
60873
- };
60874
- inNumberRange.resolveFilterValue = val => {
60875
- let [unsafeMin, unsafeMax] = val;
60876
- let parsedMin = typeof unsafeMin !== 'number' ? parseFloat(unsafeMin) : unsafeMin;
60877
- let parsedMax = typeof unsafeMax !== 'number' ? parseFloat(unsafeMax) : unsafeMax;
60878
- let min = unsafeMin === null || Number.isNaN(parsedMin) ? -Infinity : parsedMin;
60879
- let max = unsafeMax === null || Number.isNaN(parsedMax) ? Infinity : parsedMax;
60880
- if (min > max) {
60881
- const temp = min;
60882
- min = max;
60883
- max = temp;
60884
- }
60885
- return [min, max];
60886
- };
60887
- inNumberRange.autoRemove = val => testFalsey(val) || testFalsey(val[0]) && testFalsey(val[1]);
60888
-
60889
- // Export
60890
-
60891
- const filterFns = {
60892
- includesString,
60893
- includesStringSensitive,
60894
- equalsString,
60895
- arrIncludes,
60896
- arrIncludesAll,
60897
- arrIncludesSome,
60898
- equals,
60899
- weakEquals,
60900
- inNumberRange
60901
- };
60902
- // Utils
60903
-
60904
- function testFalsey(val) {
60905
- return val === undefined || val === null || val === '';
60906
- }
60907
-
60908
- //
60909
-
60910
- const Filters = {
60911
- getDefaultColumnDef: () => {
60912
- return {
60913
- filterFn: 'auto'
60914
- };
60915
- },
60916
- getInitialState: state => {
60917
- return {
60918
- columnFilters: [],
60919
- globalFilter: undefined,
60920
- // filtersProgress: 1,
60921
- // facetProgress: {},
60922
- ...state
60923
- };
60924
- },
60925
- getDefaultOptions: table => {
60926
- return {
60927
- onColumnFiltersChange: makeStateUpdater('columnFilters', table),
60928
- onGlobalFilterChange: makeStateUpdater('globalFilter', table),
60929
- filterFromLeafRows: false,
60930
- maxLeafRowFilterDepth: 100,
60931
- globalFilterFn: 'auto',
60932
- getColumnCanGlobalFilter: column => {
60933
- var _table$getCoreRowMode;
60934
- const value = (_table$getCoreRowMode = table.getCoreRowModel().flatRows[0]) == null || (_table$getCoreRowMode = _table$getCoreRowMode._getAllCellsByColumnId()[column.id]) == null ? void 0 : _table$getCoreRowMode.getValue();
60935
- return typeof value === 'string' || typeof value === 'number';
60936
- }
60937
- };
60938
- },
60939
- createColumn: (column, table) => {
60940
- column.getAutoFilterFn = () => {
60941
- const firstRow = table.getCoreRowModel().flatRows[0];
60942
- const value = firstRow == null ? void 0 : firstRow.getValue(column.id);
60943
- if (typeof value === 'string') {
60944
- return filterFns.includesString;
60945
- }
60946
- if (typeof value === 'number') {
60947
- return filterFns.inNumberRange;
60948
- }
60949
- if (typeof value === 'boolean') {
60950
- return filterFns.equals;
60951
- }
60952
- if (value !== null && typeof value === 'object') {
60953
- return filterFns.equals;
60954
- }
60955
- if (Array.isArray(value)) {
60956
- return filterFns.arrIncludes;
60957
- }
60958
- return filterFns.weakEquals;
60959
- };
60960
- column.getFilterFn = () => {
60961
- var _table$options$filter, _table$options$filter2;
60962
- return isFunction(column.columnDef.filterFn) ? column.columnDef.filterFn : column.columnDef.filterFn === 'auto' ? column.getAutoFilterFn() : // @ts-ignore
60963
- (_table$options$filter = (_table$options$filter2 = table.options.filterFns) == null ? void 0 : _table$options$filter2[column.columnDef.filterFn]) != null ? _table$options$filter : filterFns[column.columnDef.filterFn];
60964
- };
60965
- column.getCanFilter = () => {
60966
- var _column$columnDef$ena, _table$options$enable, _table$options$enable2;
60967
- return ((_column$columnDef$ena = column.columnDef.enableColumnFilter) != null ? _column$columnDef$ena : true) && ((_table$options$enable = table.options.enableColumnFilters) != null ? _table$options$enable : true) && ((_table$options$enable2 = table.options.enableFilters) != null ? _table$options$enable2 : true) && !!column.accessorFn;
60968
- };
60969
- column.getCanGlobalFilter = () => {
60970
- var _column$columnDef$ena2, _table$options$enable3, _table$options$enable4, _table$options$getCol;
60971
- return ((_column$columnDef$ena2 = column.columnDef.enableGlobalFilter) != null ? _column$columnDef$ena2 : true) && ((_table$options$enable3 = table.options.enableGlobalFilter) != null ? _table$options$enable3 : true) && ((_table$options$enable4 = table.options.enableFilters) != null ? _table$options$enable4 : true) && ((_table$options$getCol = table.options.getColumnCanGlobalFilter == null ? void 0 : table.options.getColumnCanGlobalFilter(column)) != null ? _table$options$getCol : true) && !!column.accessorFn;
60972
- };
60973
- column.getIsFiltered = () => column.getFilterIndex() > -1;
60974
- column.getFilterValue = () => {
60975
- var _table$getState$colum;
60976
- return (_table$getState$colum = table.getState().columnFilters) == null || (_table$getState$colum = _table$getState$colum.find(d => d.id === column.id)) == null ? void 0 : _table$getState$colum.value;
60977
- };
60978
- column.getFilterIndex = () => {
60979
- var _table$getState$colum2, _table$getState$colum3;
60980
- return (_table$getState$colum2 = (_table$getState$colum3 = table.getState().columnFilters) == null ? void 0 : _table$getState$colum3.findIndex(d => d.id === column.id)) != null ? _table$getState$colum2 : -1;
60981
- };
60982
- column.setFilterValue = value => {
60983
- table.setColumnFilters(old => {
60984
- const filterFn = column.getFilterFn();
60985
- const previousfilter = old == null ? void 0 : old.find(d => d.id === column.id);
60986
- const newFilter = functionalUpdate(value, previousfilter ? previousfilter.value : undefined);
60987
-
60988
- //
60989
- if (shouldAutoRemoveFilter(filterFn, newFilter, column)) {
60990
- var _old$filter;
60991
- return (_old$filter = old == null ? void 0 : old.filter(d => d.id !== column.id)) != null ? _old$filter : [];
60992
- }
60993
- const newFilterObj = {
60994
- id: column.id,
60995
- value: newFilter
60996
- };
60997
- if (previousfilter) {
60998
- var _old$map;
60999
- return (_old$map = old == null ? void 0 : old.map(d => {
61000
- if (d.id === column.id) {
61001
- return newFilterObj;
61002
- }
61003
- return d;
61004
- })) != null ? _old$map : [];
61005
- }
61006
- if (old != null && old.length) {
61007
- return [...old, newFilterObj];
61008
- }
61009
- return [newFilterObj];
61010
- });
61011
- };
61012
- column._getFacetedRowModel = table.options.getFacetedRowModel && table.options.getFacetedRowModel(table, column.id);
61013
- column.getFacetedRowModel = () => {
61014
- if (!column._getFacetedRowModel) {
61015
- return table.getPreFilteredRowModel();
61016
- }
61017
- return column._getFacetedRowModel();
61018
- };
61019
- column._getFacetedUniqueValues = table.options.getFacetedUniqueValues && table.options.getFacetedUniqueValues(table, column.id);
61020
- column.getFacetedUniqueValues = () => {
61021
- if (!column._getFacetedUniqueValues) {
61022
- return new Map();
61023
- }
61024
- return column._getFacetedUniqueValues();
61025
- };
61026
- column._getFacetedMinMaxValues = table.options.getFacetedMinMaxValues && table.options.getFacetedMinMaxValues(table, column.id);
61027
- column.getFacetedMinMaxValues = () => {
61028
- if (!column._getFacetedMinMaxValues) {
61029
- return undefined;
61030
- }
61031
- return column._getFacetedMinMaxValues();
61032
- };
61033
- // () => [column.getFacetedRowModel()],
61034
- // facetedRowModel => getRowModelMinMaxValues(facetedRowModel, column.id),
61035
61667
  },
61036
61668
  createRow: (row, table) => {
61037
- row.columnFilters = {};
61038
- row.columnFiltersMeta = {};
61669
+ row._getAllVisibleCells = memo$1(() => [row.getAllCells(), table.getState().columnVisibility], cells => {
61670
+ return cells.filter(cell => cell.column.getIsVisible());
61671
+ }, getMemoOptions(table.options, 'debugRows', '_getAllVisibleCells'));
61672
+ row.getVisibleCells = memo$1(() => [row.getLeftVisibleCells(), row.getCenterVisibleCells(), row.getRightVisibleCells()], (left, center, right) => [...left, ...center, ...right], getMemoOptions(table.options, 'debugRows', 'getVisibleCells'));
61039
61673
  },
61040
61674
  createTable: table => {
61041
- table.getGlobalAutoFilterFn = () => {
61042
- return filterFns.includesString;
61043
- };
61044
- table.getGlobalFilterFn = () => {
61045
- var _table$options$filter3, _table$options$filter4;
61046
- const {
61047
- globalFilterFn: globalFilterFn
61048
- } = table.options;
61049
- return isFunction(globalFilterFn) ? globalFilterFn : globalFilterFn === 'auto' ? table.getGlobalAutoFilterFn() : // @ts-ignore
61050
- (_table$options$filter3 = (_table$options$filter4 = table.options.filterFns) == null ? void 0 : _table$options$filter4[globalFilterFn]) != null ? _table$options$filter3 : filterFns[globalFilterFn];
61051
- };
61052
- table.setColumnFilters = updater => {
61053
- const leafColumns = table.getAllLeafColumns();
61054
- const updateFn = old => {
61055
- var _functionalUpdate;
61056
- return (_functionalUpdate = functionalUpdate(updater, old)) == null ? void 0 : _functionalUpdate.filter(filter => {
61057
- const column = leafColumns.find(d => d.id === filter.id);
61058
- if (column) {
61059
- const filterFn = column.getFilterFn();
61060
- if (shouldAutoRemoveFilter(filterFn, filter.value, column)) {
61061
- return false;
61062
- }
61063
- }
61064
- return true;
61065
- });
61066
- };
61067
- table.options.onColumnFiltersChange == null || table.options.onColumnFiltersChange(updateFn);
61068
- };
61069
- table.setGlobalFilter = updater => {
61070
- table.options.onGlobalFilterChange == null || table.options.onGlobalFilterChange(updater);
61071
- };
61072
- table.resetGlobalFilter = defaultState => {
61073
- table.setGlobalFilter(defaultState ? undefined : table.initialState.globalFilter);
61675
+ const makeVisibleColumnsMethod = (key, getColumns) => {
61676
+ return memo$1(() => [getColumns(), getColumns().filter(d => d.getIsVisible()).map(d => d.id).join('_')], columns => {
61677
+ return columns.filter(d => d.getIsVisible == null ? void 0 : d.getIsVisible());
61678
+ }, getMemoOptions(table.options, 'debugColumns', key));
61074
61679
  };
61075
- table.resetColumnFilters = defaultState => {
61076
- var _table$initialState$c, _table$initialState;
61077
- table.setColumnFilters(defaultState ? [] : (_table$initialState$c = (_table$initialState = table.initialState) == null ? void 0 : _table$initialState.columnFilters) != null ? _table$initialState$c : []);
61680
+ table.getVisibleFlatColumns = makeVisibleColumnsMethod('getVisibleFlatColumns', () => table.getAllFlatColumns());
61681
+ table.getVisibleLeafColumns = makeVisibleColumnsMethod('getVisibleLeafColumns', () => table.getAllLeafColumns());
61682
+ table.getLeftVisibleLeafColumns = makeVisibleColumnsMethod('getLeftVisibleLeafColumns', () => table.getLeftLeafColumns());
61683
+ table.getRightVisibleLeafColumns = makeVisibleColumnsMethod('getRightVisibleLeafColumns', () => table.getRightLeafColumns());
61684
+ table.getCenterVisibleLeafColumns = makeVisibleColumnsMethod('getCenterVisibleLeafColumns', () => table.getCenterLeafColumns());
61685
+ table.setColumnVisibility = updater => table.options.onColumnVisibilityChange == null ? void 0 : table.options.onColumnVisibilityChange(updater);
61686
+ table.resetColumnVisibility = defaultState => {
61687
+ var _table$initialState$c;
61688
+ table.setColumnVisibility(defaultState ? {} : (_table$initialState$c = table.initialState.columnVisibility) != null ? _table$initialState$c : {});
61078
61689
  };
61079
- table.getPreFilteredRowModel = () => table.getCoreRowModel();
61080
- table.getFilteredRowModel = () => {
61081
- if (!table._getFilteredRowModel && table.options.getFilteredRowModel) {
61082
- table._getFilteredRowModel = table.options.getFilteredRowModel(table);
61083
- }
61084
- if (table.options.manualFiltering || !table._getFilteredRowModel) {
61085
- return table.getPreFilteredRowModel();
61086
- }
61087
- return table._getFilteredRowModel();
61690
+ table.toggleAllColumnsVisible = value => {
61691
+ var _value;
61692
+ value = (_value = value) != null ? _value : !table.getIsAllColumnsVisible();
61693
+ table.setColumnVisibility(table.getAllLeafColumns().reduce((obj, column) => ({
61694
+ ...obj,
61695
+ [column.id]: !value ? !(column.getCanHide != null && column.getCanHide()) : value
61696
+ }), {}));
61697
+ };
61698
+ table.getIsAllColumnsVisible = () => !table.getAllLeafColumns().some(column => !(column.getIsVisible != null && column.getIsVisible()));
61699
+ table.getIsSomeColumnsVisible = () => table.getAllLeafColumns().some(column => column.getIsVisible == null ? void 0 : column.getIsVisible());
61700
+ table.getToggleAllColumnsVisibilityHandler = () => {
61701
+ return e => {
61702
+ var _target;
61703
+ table.toggleAllColumnsVisible((_target = e.target) == null ? void 0 : _target.checked);
61704
+ };
61088
61705
  };
61706
+ }
61707
+ };
61708
+ function _getVisibleLeafColumns(table, position) {
61709
+ return !position ? table.getVisibleLeafColumns() : position === 'center' ? table.getCenterVisibleLeafColumns() : position === 'left' ? table.getLeftVisibleLeafColumns() : table.getRightVisibleLeafColumns();
61710
+ }
61711
+
61712
+ //
61713
+
61714
+ const GlobalFaceting = {
61715
+ createTable: table => {
61089
61716
  table._getGlobalFacetedRowModel = table.options.getFacetedRowModel && table.options.getFacetedRowModel(table, '__global__');
61090
61717
  table.getGlobalFacetedRowModel = () => {
61091
61718
  if (table.options.manualFiltering || !table._getGlobalFacetedRowModel) {
@@ -61109,289 +61736,207 @@ img.ProseMirror-separator {
61109
61736
  };
61110
61737
  }
61111
61738
  };
61112
- function shouldAutoRemoveFilter(filterFn, value, column) {
61113
- return (filterFn && filterFn.autoRemove ? filterFn.autoRemove(value, column) : false) || typeof value === 'undefined' || typeof value === 'string' && !value;
61114
- }
61115
-
61116
- const sum = (columnId, _leafRows, childRows) => {
61117
- // It's faster to just add the aggregations together instead of
61118
- // process leaf nodes individually
61119
- return childRows.reduce((sum, next) => {
61120
- const nextValue = next.getValue(columnId);
61121
- return sum + (typeof nextValue === 'number' ? nextValue : 0);
61122
- }, 0);
61123
- };
61124
- const min = (columnId, _leafRows, childRows) => {
61125
- let min;
61126
- childRows.forEach(row => {
61127
- const value = row.getValue(columnId);
61128
- if (value != null && (min > value || min === undefined && value >= value)) {
61129
- min = value;
61130
- }
61131
- });
61132
- return min;
61133
- };
61134
- const max = (columnId, _leafRows, childRows) => {
61135
- let max;
61136
- childRows.forEach(row => {
61137
- const value = row.getValue(columnId);
61138
- if (value != null && (max < value || max === undefined && value >= value)) {
61139
- max = value;
61140
- }
61141
- });
61142
- return max;
61143
- };
61144
- const extent = (columnId, _leafRows, childRows) => {
61145
- let min;
61146
- let max;
61147
- childRows.forEach(row => {
61148
- const value = row.getValue(columnId);
61149
- if (value != null) {
61150
- if (min === undefined) {
61151
- if (value >= value) min = max = value;
61152
- } else {
61153
- if (min > value) min = value;
61154
- if (max < value) max = value;
61155
- }
61156
- }
61157
- });
61158
- return [min, max];
61159
- };
61160
- const mean = (columnId, leafRows) => {
61161
- let count = 0;
61162
- let sum = 0;
61163
- leafRows.forEach(row => {
61164
- let value = row.getValue(columnId);
61165
- if (value != null && (value = +value) >= value) {
61166
- ++count, sum += value;
61167
- }
61168
- });
61169
- if (count) return sum / count;
61170
- return;
61171
- };
61172
- const median = (columnId, leafRows) => {
61173
- if (!leafRows.length) {
61174
- return;
61175
- }
61176
- const values = leafRows.map(row => row.getValue(columnId));
61177
- if (!isNumberArray$1(values)) {
61178
- return;
61179
- }
61180
- if (values.length === 1) {
61181
- return values[0];
61182
- }
61183
- const mid = Math.floor(values.length / 2);
61184
- const nums = values.sort((a, b) => a - b);
61185
- return values.length % 2 !== 0 ? nums[mid] : (nums[mid - 1] + nums[mid]) / 2;
61186
- };
61187
- const unique = (columnId, leafRows) => {
61188
- return Array.from(new Set(leafRows.map(d => d.getValue(columnId))).values());
61189
- };
61190
- const uniqueCount = (columnId, leafRows) => {
61191
- return new Set(leafRows.map(d => d.getValue(columnId))).size;
61192
- };
61193
- const count = (_columnId, leafRows) => {
61194
- return leafRows.length;
61195
- };
61196
- const aggregationFns = {
61197
- sum,
61198
- min,
61199
- max,
61200
- extent,
61201
- mean,
61202
- median,
61203
- unique,
61204
- uniqueCount,
61205
- count
61206
- };
61207
61739
 
61208
61740
  //
61209
61741
 
61210
- const Grouping = {
61211
- getDefaultColumnDef: () => {
61212
- return {
61213
- aggregatedCell: props => {
61214
- var _toString, _props$getValue;
61215
- return (_toString = (_props$getValue = props.getValue()) == null || _props$getValue.toString == null ? void 0 : _props$getValue.toString()) != null ? _toString : null;
61216
- },
61217
- aggregationFn: 'auto'
61218
- };
61219
- },
61742
+ const GlobalFiltering = {
61220
61743
  getInitialState: state => {
61221
61744
  return {
61222
- grouping: [],
61745
+ globalFilter: undefined,
61223
61746
  ...state
61224
61747
  };
61225
61748
  },
61226
61749
  getDefaultOptions: table => {
61227
61750
  return {
61228
- onGroupingChange: makeStateUpdater('grouping', table),
61229
- groupedColumnMode: 'reorder'
61751
+ onGlobalFilterChange: makeStateUpdater('globalFilter', table),
61752
+ globalFilterFn: 'auto',
61753
+ getColumnCanGlobalFilter: column => {
61754
+ var _table$getCoreRowMode;
61755
+ const value = (_table$getCoreRowMode = table.getCoreRowModel().flatRows[0]) == null || (_table$getCoreRowMode = _table$getCoreRowMode._getAllCellsByColumnId()[column.id]) == null ? void 0 : _table$getCoreRowMode.getValue();
61756
+ return typeof value === 'string' || typeof value === 'number';
61757
+ }
61230
61758
  };
61231
61759
  },
61232
61760
  createColumn: (column, table) => {
61233
- column.toggleGrouping = () => {
61234
- table.setGrouping(old => {
61235
- // Find any existing grouping for this column
61236
- if (old != null && old.includes(column.id)) {
61237
- return old.filter(d => d !== column.id);
61238
- }
61239
- return [...(old != null ? old : []), column.id];
61240
- });
61241
- };
61242
- column.getCanGroup = () => {
61243
- var _ref, _ref2, _ref3, _column$columnDef$ena;
61244
- return (_ref = (_ref2 = (_ref3 = (_column$columnDef$ena = column.columnDef.enableGrouping) != null ? _column$columnDef$ena : true) != null ? _ref3 : table.options.enableGrouping) != null ? _ref2 : true) != null ? _ref : !!column.accessorFn;
61245
- };
61246
- column.getIsGrouped = () => {
61247
- var _table$getState$group;
61248
- return (_table$getState$group = table.getState().grouping) == null ? void 0 : _table$getState$group.includes(column.id);
61249
- };
61250
- column.getGroupedIndex = () => {
61251
- var _table$getState$group2;
61252
- return (_table$getState$group2 = table.getState().grouping) == null ? void 0 : _table$getState$group2.indexOf(column.id);
61253
- };
61254
- column.getToggleGroupingHandler = () => {
61255
- const canGroup = column.getCanGroup();
61256
- return () => {
61257
- if (!canGroup) return;
61258
- column.toggleGrouping();
61259
- };
61260
- };
61261
- column.getAutoAggregationFn = () => {
61262
- const firstRow = table.getCoreRowModel().flatRows[0];
61263
- const value = firstRow == null ? void 0 : firstRow.getValue(column.id);
61264
- if (typeof value === 'number') {
61265
- return aggregationFns.sum;
61266
- }
61267
- if (Object.prototype.toString.call(value) === '[object Date]') {
61268
- return aggregationFns.extent;
61269
- }
61270
- };
61271
- column.getAggregationFn = () => {
61272
- var _table$options$aggreg, _table$options$aggreg2;
61273
- if (!column) {
61274
- throw new Error();
61275
- }
61276
- return isFunction(column.columnDef.aggregationFn) ? column.columnDef.aggregationFn : column.columnDef.aggregationFn === 'auto' ? column.getAutoAggregationFn() : (_table$options$aggreg = (_table$options$aggreg2 = table.options.aggregationFns) == null ? void 0 : _table$options$aggreg2[column.columnDef.aggregationFn]) != null ? _table$options$aggreg : aggregationFns[column.columnDef.aggregationFn];
61761
+ column.getCanGlobalFilter = () => {
61762
+ var _column$columnDef$ena, _table$options$enable, _table$options$enable2, _table$options$getCol;
61763
+ return ((_column$columnDef$ena = column.columnDef.enableGlobalFilter) != null ? _column$columnDef$ena : true) && ((_table$options$enable = table.options.enableGlobalFilter) != null ? _table$options$enable : true) && ((_table$options$enable2 = table.options.enableFilters) != null ? _table$options$enable2 : true) && ((_table$options$getCol = table.options.getColumnCanGlobalFilter == null ? void 0 : table.options.getColumnCanGlobalFilter(column)) != null ? _table$options$getCol : true) && !!column.accessorFn;
61277
61764
  };
61278
61765
  },
61279
61766
  createTable: table => {
61280
- table.setGrouping = updater => table.options.onGroupingChange == null ? void 0 : table.options.onGroupingChange(updater);
61281
- table.resetGrouping = defaultState => {
61282
- var _table$initialState$g, _table$initialState;
61283
- table.setGrouping(defaultState ? [] : (_table$initialState$g = (_table$initialState = table.initialState) == null ? void 0 : _table$initialState.grouping) != null ? _table$initialState$g : []);
61767
+ table.getGlobalAutoFilterFn = () => {
61768
+ return filterFns.includesString;
61284
61769
  };
61285
- table.getPreGroupedRowModel = () => table.getFilteredRowModel();
61286
- table.getGroupedRowModel = () => {
61287
- if (!table._getGroupedRowModel && table.options.getGroupedRowModel) {
61288
- table._getGroupedRowModel = table.options.getGroupedRowModel(table);
61289
- }
61290
- if (table.options.manualGrouping || !table._getGroupedRowModel) {
61291
- return table.getPreGroupedRowModel();
61292
- }
61293
- return table._getGroupedRowModel();
61770
+ table.getGlobalFilterFn = () => {
61771
+ var _table$options$filter, _table$options$filter2;
61772
+ const {
61773
+ globalFilterFn: globalFilterFn
61774
+ } = table.options;
61775
+ return isFunction(globalFilterFn) ? globalFilterFn : globalFilterFn === 'auto' ? table.getGlobalAutoFilterFn() : (_table$options$filter = (_table$options$filter2 = table.options.filterFns) == null ? void 0 : _table$options$filter2[globalFilterFn]) != null ? _table$options$filter : filterFns[globalFilterFn];
61294
61776
  };
61295
- },
61296
- createRow: (row, table) => {
61297
- row.getIsGrouped = () => !!row.groupingColumnId;
61298
- row.getGroupingValue = columnId => {
61299
- if (row._groupingValuesCache.hasOwnProperty(columnId)) {
61300
- return row._groupingValuesCache[columnId];
61301
- }
61302
- const column = table.getColumn(columnId);
61303
- if (!(column != null && column.columnDef.getGroupingValue)) {
61304
- return row.getValue(columnId);
61305
- }
61306
- row._groupingValuesCache[columnId] = column.columnDef.getGroupingValue(row.original);
61307
- return row._groupingValuesCache[columnId];
61777
+ table.setGlobalFilter = updater => {
61778
+ table.options.onGlobalFilterChange == null || table.options.onGlobalFilterChange(updater);
61308
61779
  };
61309
- row._groupingValuesCache = {};
61310
- },
61311
- createCell: (cell, column, row, table) => {
61312
- cell.getIsGrouped = () => column.getIsGrouped() && column.id === row.groupingColumnId;
61313
- cell.getIsPlaceholder = () => !cell.getIsGrouped() && column.getIsGrouped();
61314
- cell.getIsAggregated = () => {
61315
- var _row$subRows;
61316
- return !cell.getIsGrouped() && !cell.getIsPlaceholder() && !!((_row$subRows = row.subRows) != null && _row$subRows.length);
61780
+ table.resetGlobalFilter = defaultState => {
61781
+ table.setGlobalFilter(defaultState ? undefined : table.initialState.globalFilter);
61317
61782
  };
61318
61783
  }
61319
61784
  };
61320
- function orderColumns(leafColumns, grouping, groupedColumnMode) {
61321
- if (!(grouping != null && grouping.length) || !groupedColumnMode) {
61322
- return leafColumns;
61323
- }
61324
- const nonGroupingColumns = leafColumns.filter(col => !grouping.includes(col.id));
61325
- if (groupedColumnMode === 'remove') {
61326
- return nonGroupingColumns;
61327
- }
61328
- const groupingColumns = grouping.map(g => leafColumns.find(col => col.id === g)).filter(Boolean);
61329
- return [...groupingColumns, ...nonGroupingColumns];
61330
- }
61331
61785
 
61332
61786
  //
61333
61787
 
61334
- const Ordering = {
61788
+ const RowExpanding = {
61335
61789
  getInitialState: state => {
61336
61790
  return {
61337
- columnOrder: [],
61791
+ expanded: {},
61338
61792
  ...state
61339
61793
  };
61340
61794
  },
61341
61795
  getDefaultOptions: table => {
61342
61796
  return {
61343
- onColumnOrderChange: makeStateUpdater('columnOrder', table)
61344
- };
61345
- },
61346
- createColumn: (column, table) => {
61347
- column.getIndex = memo$1(position => [_getVisibleLeafColumns(table, position)], columns => columns.findIndex(d => d.id === column.id), getMemoOptions(table.options, 'debugColumns', 'getIndex'));
61348
- column.getIsFirstColumn = position => {
61349
- var _columns$;
61350
- const columns = _getVisibleLeafColumns(table, position);
61351
- return ((_columns$ = columns[0]) == null ? void 0 : _columns$.id) === column.id;
61352
- };
61353
- column.getIsLastColumn = position => {
61354
- var _columns;
61355
- const columns = _getVisibleLeafColumns(table, position);
61356
- return ((_columns = columns[columns.length - 1]) == null ? void 0 : _columns.id) === column.id;
61797
+ onExpandedChange: makeStateUpdater('expanded', table),
61798
+ paginateExpandedRows: true
61357
61799
  };
61358
61800
  },
61359
61801
  createTable: table => {
61360
- table.setColumnOrder = updater => table.options.onColumnOrderChange == null ? void 0 : table.options.onColumnOrderChange(updater);
61361
- table.resetColumnOrder = defaultState => {
61362
- var _table$initialState$c;
61363
- table.setColumnOrder(defaultState ? [] : (_table$initialState$c = table.initialState.columnOrder) != null ? _table$initialState$c : []);
61802
+ let registered = false;
61803
+ let queued = false;
61804
+ table._autoResetExpanded = () => {
61805
+ var _ref, _table$options$autoRe;
61806
+ if (!registered) {
61807
+ table._queue(() => {
61808
+ registered = true;
61809
+ });
61810
+ return;
61811
+ }
61812
+ if ((_ref = (_table$options$autoRe = table.options.autoResetAll) != null ? _table$options$autoRe : table.options.autoResetExpanded) != null ? _ref : !table.options.manualExpanding) {
61813
+ if (queued) return;
61814
+ queued = true;
61815
+ table._queue(() => {
61816
+ table.resetExpanded();
61817
+ queued = false;
61818
+ });
61819
+ }
61364
61820
  };
61365
- table._getOrderColumnsFn = memo$1(() => [table.getState().columnOrder, table.getState().grouping, table.options.groupedColumnMode], (columnOrder, grouping, groupedColumnMode) => columns => {
61366
- // Sort grouped columns to the start of the column list
61367
- // before the headers are built
61368
- let orderedColumns = [];
61369
-
61370
- // If there is no order, return the normal columns
61371
- if (!(columnOrder != null && columnOrder.length)) {
61372
- orderedColumns = columns;
61821
+ table.setExpanded = updater => table.options.onExpandedChange == null ? void 0 : table.options.onExpandedChange(updater);
61822
+ table.toggleAllRowsExpanded = expanded => {
61823
+ if (expanded != null ? expanded : !table.getIsAllRowsExpanded()) {
61824
+ table.setExpanded(true);
61373
61825
  } else {
61374
- const columnOrderCopy = [...columnOrder];
61826
+ table.setExpanded({});
61827
+ }
61828
+ };
61829
+ table.resetExpanded = defaultState => {
61830
+ var _table$initialState$e, _table$initialState;
61831
+ table.setExpanded(defaultState ? {} : (_table$initialState$e = (_table$initialState = table.initialState) == null ? void 0 : _table$initialState.expanded) != null ? _table$initialState$e : {});
61832
+ };
61833
+ table.getCanSomeRowsExpand = () => {
61834
+ return table.getPrePaginationRowModel().flatRows.some(row => row.getCanExpand());
61835
+ };
61836
+ table.getToggleAllRowsExpandedHandler = () => {
61837
+ return e => {
61838
+ e.persist == null || e.persist();
61839
+ table.toggleAllRowsExpanded();
61840
+ };
61841
+ };
61842
+ table.getIsSomeRowsExpanded = () => {
61843
+ const expanded = table.getState().expanded;
61844
+ return expanded === true || Object.values(expanded).some(Boolean);
61845
+ };
61846
+ table.getIsAllRowsExpanded = () => {
61847
+ const expanded = table.getState().expanded;
61375
61848
 
61376
- // If there is an order, make a copy of the columns
61377
- const columnsCopy = [...columns];
61849
+ // If expanded is true, save some cycles and return true
61850
+ if (typeof expanded === 'boolean') {
61851
+ return expanded === true;
61852
+ }
61853
+ if (!Object.keys(expanded).length) {
61854
+ return false;
61855
+ }
61378
61856
 
61379
- // And make a new ordered array of the columns
61857
+ // If any row is not expanded, return false
61858
+ if (table.getRowModel().flatRows.some(row => !row.getIsExpanded())) {
61859
+ return false;
61860
+ }
61380
61861
 
61381
- // Loop over the columns and place them in order into the new array
61382
- while (columnsCopy.length && columnOrderCopy.length) {
61383
- const targetColumnId = columnOrderCopy.shift();
61384
- const foundIndex = columnsCopy.findIndex(d => d.id === targetColumnId);
61385
- if (foundIndex > -1) {
61386
- orderedColumns.push(columnsCopy.splice(foundIndex, 1)[0]);
61387
- }
61862
+ // They must all be expanded :shrug:
61863
+ return true;
61864
+ };
61865
+ table.getExpandedDepth = () => {
61866
+ let maxDepth = 0;
61867
+ const rowIds = table.getState().expanded === true ? Object.keys(table.getRowModel().rowsById) : Object.keys(table.getState().expanded);
61868
+ rowIds.forEach(id => {
61869
+ const splitId = id.split('.');
61870
+ maxDepth = Math.max(maxDepth, splitId.length);
61871
+ });
61872
+ return maxDepth;
61873
+ };
61874
+ table.getPreExpandedRowModel = () => table.getSortedRowModel();
61875
+ table.getExpandedRowModel = () => {
61876
+ if (!table._getExpandedRowModel && table.options.getExpandedRowModel) {
61877
+ table._getExpandedRowModel = table.options.getExpandedRowModel(table);
61878
+ }
61879
+ if (table.options.manualExpanding || !table._getExpandedRowModel) {
61880
+ return table.getPreExpandedRowModel();
61881
+ }
61882
+ return table._getExpandedRowModel();
61883
+ };
61884
+ },
61885
+ createRow: (row, table) => {
61886
+ row.toggleExpanded = expanded => {
61887
+ table.setExpanded(old => {
61888
+ var _expanded;
61889
+ const exists = old === true ? true : !!(old != null && old[row.id]);
61890
+ let oldExpanded = {};
61891
+ if (old === true) {
61892
+ Object.keys(table.getRowModel().rowsById).forEach(rowId => {
61893
+ oldExpanded[rowId] = true;
61894
+ });
61895
+ } else {
61896
+ oldExpanded = old;
61388
61897
  }
61389
-
61390
- // If there are any columns left, add them to the end
61391
- orderedColumns = [...orderedColumns, ...columnsCopy];
61898
+ expanded = (_expanded = expanded) != null ? _expanded : !exists;
61899
+ if (!exists && expanded) {
61900
+ return {
61901
+ ...oldExpanded,
61902
+ [row.id]: true
61903
+ };
61904
+ }
61905
+ if (exists && !expanded) {
61906
+ const {
61907
+ [row.id]: _,
61908
+ ...rest
61909
+ } = oldExpanded;
61910
+ return rest;
61911
+ }
61912
+ return old;
61913
+ });
61914
+ };
61915
+ row.getIsExpanded = () => {
61916
+ var _table$options$getIsR;
61917
+ const expanded = table.getState().expanded;
61918
+ return !!((_table$options$getIsR = table.options.getIsRowExpanded == null ? void 0 : table.options.getIsRowExpanded(row)) != null ? _table$options$getIsR : expanded === true || (expanded == null ? void 0 : expanded[row.id]));
61919
+ };
61920
+ row.getCanExpand = () => {
61921
+ var _table$options$getRow, _table$options$enable, _row$subRows;
61922
+ return (_table$options$getRow = table.options.getRowCanExpand == null ? void 0 : table.options.getRowCanExpand(row)) != null ? _table$options$getRow : ((_table$options$enable = table.options.enableExpanding) != null ? _table$options$enable : true) && !!((_row$subRows = row.subRows) != null && _row$subRows.length);
61923
+ };
61924
+ row.getIsAllParentsExpanded = () => {
61925
+ let isFullyExpanded = true;
61926
+ let currentRow = row;
61927
+ while (isFullyExpanded && currentRow.parentId) {
61928
+ currentRow = table.getRow(currentRow.parentId, true);
61929
+ isFullyExpanded = currentRow.getIsExpanded();
61392
61930
  }
61393
- return orderColumns(orderedColumns, grouping, groupedColumnMode);
61394
- }, getMemoOptions(table.options, 'debugTable', '_getOrderColumnsFn'));
61931
+ return isFullyExpanded;
61932
+ };
61933
+ row.getToggleExpandedHandler = () => {
61934
+ const canExpand = row.getCanExpand();
61935
+ return () => {
61936
+ if (!canExpand) return;
61937
+ row.toggleExpanded();
61938
+ };
61939
+ };
61395
61940
  }
61396
61941
  };
61397
61942
 
@@ -61403,7 +61948,7 @@ img.ProseMirror-separator {
61403
61948
  pageIndex: defaultPageIndex,
61404
61949
  pageSize: defaultPageSize
61405
61950
  });
61406
- const Pagination = {
61951
+ const RowPagination = {
61407
61952
  getInitialState: state => {
61408
61953
  return {
61409
61954
  ...state,
@@ -61550,88 +62095,34 @@ img.ProseMirror-separator {
61550
62095
 
61551
62096
  //
61552
62097
 
61553
- const getDefaultColumnPinningState = () => ({
61554
- left: [],
61555
- right: []
61556
- });
61557
62098
  const getDefaultRowPinningState = () => ({
61558
62099
  top: [],
61559
62100
  bottom: []
61560
62101
  });
61561
- const Pinning = {
62102
+ const RowPinning = {
61562
62103
  getInitialState: state => {
61563
62104
  return {
61564
- columnPinning: getDefaultColumnPinningState(),
61565
62105
  rowPinning: getDefaultRowPinningState(),
61566
62106
  ...state
61567
62107
  };
61568
62108
  },
61569
62109
  getDefaultOptions: table => {
61570
62110
  return {
61571
- onColumnPinningChange: makeStateUpdater('columnPinning', table),
61572
62111
  onRowPinningChange: makeStateUpdater('rowPinning', table)
61573
62112
  };
61574
62113
  },
61575
- createColumn: (column, table) => {
61576
- column.pin = position => {
61577
- const columnIds = column.getLeafColumns().map(d => d.id).filter(Boolean);
61578
- table.setColumnPinning(old => {
61579
- var _old$left3, _old$right3;
61580
- if (position === 'right') {
61581
- var _old$left, _old$right;
61582
- return {
61583
- left: ((_old$left = old == null ? void 0 : old.left) != null ? _old$left : []).filter(d => !(columnIds != null && columnIds.includes(d))),
61584
- right: [...((_old$right = old == null ? void 0 : old.right) != null ? _old$right : []).filter(d => !(columnIds != null && columnIds.includes(d))), ...columnIds]
61585
- };
61586
- }
61587
- if (position === 'left') {
61588
- var _old$left2, _old$right2;
61589
- return {
61590
- left: [...((_old$left2 = old == null ? void 0 : old.left) != null ? _old$left2 : []).filter(d => !(columnIds != null && columnIds.includes(d))), ...columnIds],
61591
- right: ((_old$right2 = old == null ? void 0 : old.right) != null ? _old$right2 : []).filter(d => !(columnIds != null && columnIds.includes(d)))
61592
- };
61593
- }
61594
- return {
61595
- left: ((_old$left3 = old == null ? void 0 : old.left) != null ? _old$left3 : []).filter(d => !(columnIds != null && columnIds.includes(d))),
61596
- right: ((_old$right3 = old == null ? void 0 : old.right) != null ? _old$right3 : []).filter(d => !(columnIds != null && columnIds.includes(d)))
61597
- };
61598
- });
61599
- };
61600
- column.getCanPin = () => {
61601
- const leafColumns = column.getLeafColumns();
61602
- return leafColumns.some(d => {
61603
- var _d$columnDef$enablePi, _ref, _table$options$enable;
61604
- return ((_d$columnDef$enablePi = d.columnDef.enablePinning) != null ? _d$columnDef$enablePi : true) && ((_ref = (_table$options$enable = table.options.enableColumnPinning) != null ? _table$options$enable : table.options.enablePinning) != null ? _ref : true);
61605
- });
61606
- };
61607
- column.getIsPinned = () => {
61608
- const leafColumnIds = column.getLeafColumns().map(d => d.id);
61609
- const {
61610
- left,
61611
- right
61612
- } = table.getState().columnPinning;
61613
- const isLeft = leafColumnIds.some(d => left == null ? void 0 : left.includes(d));
61614
- const isRight = leafColumnIds.some(d => right == null ? void 0 : right.includes(d));
61615
- return isLeft ? 'left' : isRight ? 'right' : false;
61616
- };
61617
- column.getPinnedIndex = () => {
61618
- var _table$getState$colum, _table$getState$colum2;
61619
- const position = column.getIsPinned();
61620
- return position ? (_table$getState$colum = (_table$getState$colum2 = table.getState().columnPinning) == null || (_table$getState$colum2 = _table$getState$colum2[position]) == null ? void 0 : _table$getState$colum2.indexOf(column.id)) != null ? _table$getState$colum : -1 : 0;
61621
- };
61622
- },
61623
62114
  createRow: (row, table) => {
61624
62115
  row.pin = (position, includeLeafRows, includeParentRows) => {
61625
- const leafRowIds = includeLeafRows ? row.getLeafRows().map(_ref2 => {
62116
+ const leafRowIds = includeLeafRows ? row.getLeafRows().map(_ref => {
61626
62117
  let {
61627
62118
  id
61628
- } = _ref2;
62119
+ } = _ref;
61629
62120
  return id;
61630
62121
  }) : [];
61631
- const parentRowIds = includeParentRows ? row.getParentRows().map(_ref3 => {
62122
+ const parentRowIds = includeParentRows ? row.getParentRows().map(_ref2 => {
61632
62123
  let {
61633
62124
  id
61634
- } = _ref3;
62125
+ } = _ref2;
61635
62126
  return id;
61636
62127
  }) : [];
61637
62128
  const rowIds = new Set([...parentRowIds, row.id, ...leafRowIds]);
@@ -61658,7 +62149,7 @@ img.ProseMirror-separator {
61658
62149
  });
61659
62150
  };
61660
62151
  row.getCanPin = () => {
61661
- var _ref4;
62152
+ var _ref3;
61662
62153
  const {
61663
62154
  enableRowPinning,
61664
62155
  enablePinning
@@ -61666,7 +62157,7 @@ img.ProseMirror-separator {
61666
62157
  if (typeof enableRowPinning === 'function') {
61667
62158
  return enableRowPinning(row);
61668
62159
  }
61669
- return (_ref4 = enableRowPinning != null ? enableRowPinning : enablePinning) != null ? _ref4 : true;
62160
+ return (_ref3 = enableRowPinning != null ? enableRowPinning : enablePinning) != null ? _ref3 : true;
61670
62161
  };
61671
62162
  row.getIsPinned = () => {
61672
62163
  const rowIds = [row.id];
@@ -61682,71 +62173,29 @@ img.ProseMirror-separator {
61682
62173
  var _table$_getPinnedRows, _visiblePinnedRowIds$;
61683
62174
  const position = row.getIsPinned();
61684
62175
  if (!position) return -1;
61685
- const visiblePinnedRowIds = (_table$_getPinnedRows = table._getPinnedRows(position)) == null ? void 0 : _table$_getPinnedRows.map(_ref5 => {
62176
+ const visiblePinnedRowIds = (_table$_getPinnedRows = table._getPinnedRows(position)) == null ? void 0 : _table$_getPinnedRows.map(_ref4 => {
61686
62177
  let {
61687
62178
  id
61688
- } = _ref5;
62179
+ } = _ref4;
61689
62180
  return id;
61690
62181
  });
61691
62182
  return (_visiblePinnedRowIds$ = visiblePinnedRowIds == null ? void 0 : visiblePinnedRowIds.indexOf(row.id)) != null ? _visiblePinnedRowIds$ : -1;
61692
62183
  };
61693
- row.getCenterVisibleCells = memo$1(() => [row._getAllVisibleCells(), table.getState().columnPinning.left, table.getState().columnPinning.right], (allCells, left, right) => {
61694
- const leftAndRight = [...(left != null ? left : []), ...(right != null ? right : [])];
61695
- return allCells.filter(d => !leftAndRight.includes(d.column.id));
61696
- }, getMemoOptions(table.options, 'debugRows', 'getCenterVisibleCells'));
61697
- row.getLeftVisibleCells = memo$1(() => [row._getAllVisibleCells(), table.getState().columnPinning.left], (allCells, left) => {
61698
- const cells = (left != null ? left : []).map(columnId => allCells.find(cell => cell.column.id === columnId)).filter(Boolean).map(d => ({
61699
- ...d,
61700
- position: 'left'
61701
- }));
61702
- return cells;
61703
- }, getMemoOptions(table.options, 'debugRows', 'getLeftVisibleCells'));
61704
- row.getRightVisibleCells = memo$1(() => [row._getAllVisibleCells(), table.getState().columnPinning.right], (allCells, right) => {
61705
- const cells = (right != null ? right : []).map(columnId => allCells.find(cell => cell.column.id === columnId)).filter(Boolean).map(d => ({
61706
- ...d,
61707
- position: 'right'
61708
- }));
61709
- return cells;
61710
- }, getMemoOptions(table.options, 'debugRows', 'getRightVisibleCells'));
61711
62184
  },
61712
62185
  createTable: table => {
61713
- table.setColumnPinning = updater => table.options.onColumnPinningChange == null ? void 0 : table.options.onColumnPinningChange(updater);
61714
- table.resetColumnPinning = defaultState => {
61715
- var _table$initialState$c, _table$initialState;
61716
- return table.setColumnPinning(defaultState ? getDefaultColumnPinningState() : (_table$initialState$c = (_table$initialState = table.initialState) == null ? void 0 : _table$initialState.columnPinning) != null ? _table$initialState$c : getDefaultColumnPinningState());
61717
- };
61718
- table.getIsSomeColumnsPinned = position => {
61719
- var _pinningState$positio;
61720
- const pinningState = table.getState().columnPinning;
61721
- if (!position) {
61722
- var _pinningState$left, _pinningState$right;
61723
- return Boolean(((_pinningState$left = pinningState.left) == null ? void 0 : _pinningState$left.length) || ((_pinningState$right = pinningState.right) == null ? void 0 : _pinningState$right.length));
61724
- }
61725
- return Boolean((_pinningState$positio = pinningState[position]) == null ? void 0 : _pinningState$positio.length);
61726
- };
61727
- table.getLeftLeafColumns = memo$1(() => [table.getAllLeafColumns(), table.getState().columnPinning.left], (allColumns, left) => {
61728
- return (left != null ? left : []).map(columnId => allColumns.find(column => column.id === columnId)).filter(Boolean);
61729
- }, getMemoOptions(table.options, 'debugColumns', 'getLeftLeafColumns'));
61730
- table.getRightLeafColumns = memo$1(() => [table.getAllLeafColumns(), table.getState().columnPinning.right], (allColumns, right) => {
61731
- return (right != null ? right : []).map(columnId => allColumns.find(column => column.id === columnId)).filter(Boolean);
61732
- }, getMemoOptions(table.options, 'debugColumns', 'getRightLeafColumns'));
61733
- table.getCenterLeafColumns = memo$1(() => [table.getAllLeafColumns(), table.getState().columnPinning.left, table.getState().columnPinning.right], (allColumns, left, right) => {
61734
- const leftAndRight = [...(left != null ? left : []), ...(right != null ? right : [])];
61735
- return allColumns.filter(d => !leftAndRight.includes(d.id));
61736
- }, getMemoOptions(table.options, 'debugColumns', 'getCenterLeafColumns'));
61737
62186
  table.setRowPinning = updater => table.options.onRowPinningChange == null ? void 0 : table.options.onRowPinningChange(updater);
61738
62187
  table.resetRowPinning = defaultState => {
61739
- var _table$initialState$r, _table$initialState2;
61740
- return table.setRowPinning(defaultState ? getDefaultRowPinningState() : (_table$initialState$r = (_table$initialState2 = table.initialState) == null ? void 0 : _table$initialState2.rowPinning) != null ? _table$initialState$r : getDefaultRowPinningState());
62188
+ var _table$initialState$r, _table$initialState;
62189
+ return table.setRowPinning(defaultState ? getDefaultRowPinningState() : (_table$initialState$r = (_table$initialState = table.initialState) == null ? void 0 : _table$initialState.rowPinning) != null ? _table$initialState$r : getDefaultRowPinningState());
61741
62190
  };
61742
62191
  table.getIsSomeRowsPinned = position => {
61743
- var _pinningState$positio2;
62192
+ var _pinningState$positio;
61744
62193
  const pinningState = table.getState().rowPinning;
61745
62194
  if (!position) {
61746
62195
  var _pinningState$top, _pinningState$bottom;
61747
62196
  return Boolean(((_pinningState$top = pinningState.top) == null ? void 0 : _pinningState$top.length) || ((_pinningState$bottom = pinningState.bottom) == null ? void 0 : _pinningState$bottom.length));
61748
62197
  }
61749
- return Boolean((_pinningState$positio2 = pinningState[position]) == null ? void 0 : _pinningState$positio2.length);
62198
+ return Boolean((_pinningState$positio = pinningState[position]) == null ? void 0 : _pinningState$positio.length);
61750
62199
  };
61751
62200
  table._getPinnedRows = memo$1(position => [table.getRowModel().rows, table.getState().rowPinning[position], position], (visibleRows, pinnedRowIds, position) => {
61752
62201
  var _table$options$keepPi;
@@ -62252,7 +62701,7 @@ img.ProseMirror-separator {
62252
62701
 
62253
62702
  //
62254
62703
 
62255
- const Sorting = {
62704
+ const RowSorting = {
62256
62705
  getInitialState: state => {
62257
62706
  return {
62258
62707
  sorting: [],
@@ -62459,99 +62908,24 @@ img.ProseMirror-separator {
62459
62908
  }
62460
62909
  };
62461
62910
 
62462
- //
62463
-
62464
- const Visibility = {
62465
- getInitialState: state => {
62466
- return {
62467
- columnVisibility: {},
62468
- ...state
62469
- };
62470
- },
62471
- getDefaultOptions: table => {
62472
- return {
62473
- onColumnVisibilityChange: makeStateUpdater('columnVisibility', table)
62474
- };
62475
- },
62476
- createColumn: (column, table) => {
62477
- column.toggleVisibility = value => {
62478
- if (column.getCanHide()) {
62479
- table.setColumnVisibility(old => ({
62480
- ...old,
62481
- [column.id]: value != null ? value : !column.getIsVisible()
62482
- }));
62483
- }
62484
- };
62485
- column.getIsVisible = () => {
62486
- var _ref, _table$getState$colum;
62487
- const childColumns = column.columns;
62488
- return (_ref = childColumns.length ? childColumns.some(c => c.getIsVisible()) : (_table$getState$colum = table.getState().columnVisibility) == null ? void 0 : _table$getState$colum[column.id]) != null ? _ref : true;
62489
- };
62490
- column.getCanHide = () => {
62491
- var _column$columnDef$ena, _table$options$enable;
62492
- return ((_column$columnDef$ena = column.columnDef.enableHiding) != null ? _column$columnDef$ena : true) && ((_table$options$enable = table.options.enableHiding) != null ? _table$options$enable : true);
62493
- };
62494
- column.getToggleVisibilityHandler = () => {
62495
- return e => {
62496
- column.toggleVisibility == null || column.toggleVisibility(e.target.checked);
62497
- };
62498
- };
62499
- },
62500
- createRow: (row, table) => {
62501
- row._getAllVisibleCells = memo$1(() => [row.getAllCells(), table.getState().columnVisibility], cells => {
62502
- return cells.filter(cell => cell.column.getIsVisible());
62503
- }, getMemoOptions(table.options, 'debugRows', '_getAllVisibleCells'));
62504
- row.getVisibleCells = memo$1(() => [row.getLeftVisibleCells(), row.getCenterVisibleCells(), row.getRightVisibleCells()], (left, center, right) => [...left, ...center, ...right], getMemoOptions(table.options, 'debugRows', 'getVisibleCells'));
62505
- },
62506
- createTable: table => {
62507
- const makeVisibleColumnsMethod = (key, getColumns) => {
62508
- return memo$1(() => [getColumns(), getColumns().filter(d => d.getIsVisible()).map(d => d.id).join('_')], columns => {
62509
- return columns.filter(d => d.getIsVisible == null ? void 0 : d.getIsVisible());
62510
- }, getMemoOptions(table.options, 'debugColumns', key));
62511
- };
62512
- table.getVisibleFlatColumns = makeVisibleColumnsMethod('getVisibleFlatColumns', () => table.getAllFlatColumns());
62513
- table.getVisibleLeafColumns = makeVisibleColumnsMethod('getVisibleLeafColumns', () => table.getAllLeafColumns());
62514
- table.getLeftVisibleLeafColumns = makeVisibleColumnsMethod('getLeftVisibleLeafColumns', () => table.getLeftLeafColumns());
62515
- table.getRightVisibleLeafColumns = makeVisibleColumnsMethod('getRightVisibleLeafColumns', () => table.getRightLeafColumns());
62516
- table.getCenterVisibleLeafColumns = makeVisibleColumnsMethod('getCenterVisibleLeafColumns', () => table.getCenterLeafColumns());
62517
- table.setColumnVisibility = updater => table.options.onColumnVisibilityChange == null ? void 0 : table.options.onColumnVisibilityChange(updater);
62518
- table.resetColumnVisibility = defaultState => {
62519
- var _table$initialState$c;
62520
- table.setColumnVisibility(defaultState ? {} : (_table$initialState$c = table.initialState.columnVisibility) != null ? _table$initialState$c : {});
62521
- };
62522
- table.toggleAllColumnsVisible = value => {
62523
- var _value;
62524
- value = (_value = value) != null ? _value : !table.getIsAllColumnsVisible();
62525
- table.setColumnVisibility(table.getAllLeafColumns().reduce((obj, column) => ({
62526
- ...obj,
62527
- [column.id]: !value ? !(column.getCanHide != null && column.getCanHide()) : value
62528
- }), {}));
62529
- };
62530
- table.getIsAllColumnsVisible = () => !table.getAllLeafColumns().some(column => !(column.getIsVisible != null && column.getIsVisible()));
62531
- table.getIsSomeColumnsVisible = () => table.getAllLeafColumns().some(column => column.getIsVisible == null ? void 0 : column.getIsVisible());
62532
- table.getToggleAllColumnsVisibilityHandler = () => {
62533
- return e => {
62534
- var _target;
62535
- table.toggleAllColumnsVisible((_target = e.target) == null ? void 0 : _target.checked);
62536
- };
62537
- };
62538
- }
62539
- };
62540
- function _getVisibleLeafColumns(table, position) {
62541
- return !position ? table.getVisibleLeafColumns() : position === 'center' ? table.getCenterVisibleLeafColumns() : position === 'left' ? table.getLeftVisibleLeafColumns() : table.getRightVisibleLeafColumns();
62542
- }
62543
-
62544
- const features = [Headers, Visibility, Ordering, Pinning, Filters, Sorting, Grouping, Expanding, Pagination, RowSelection, ColumnSizing];
62911
+ const builtInFeatures = [Headers, ColumnVisibility, ColumnOrdering, ColumnPinning, ColumnFaceting, ColumnFiltering, GlobalFaceting,
62912
+ //depends on ColumnFaceting
62913
+ GlobalFiltering,
62914
+ //depends on ColumnFiltering
62915
+ RowSorting, ColumnGrouping,
62916
+ //depends on RowSorting
62917
+ RowExpanding, RowPagination, RowPinning, RowSelection, ColumnSizing];
62545
62918
 
62546
62919
  //
62547
62920
 
62548
62921
  function createTable(options) {
62549
- var _options$initialState;
62550
- if (options.debugAll || options.debugTable) {
62922
+ var _options$_features, _options$initialState;
62923
+ if ((options.debugAll || options.debugTable)) {
62551
62924
  console.info('Creating Table Instance...');
62552
62925
  }
62926
+ const _features = [...builtInFeatures, ...((_options$_features = options._features) != null ? _options$_features : [])];
62553
62927
  let table = {
62554
- _features: features
62928
+ _features
62555
62929
  };
62556
62930
  const defaultOptions = table._features.reduce((obj, feature) => {
62557
62931
  return Object.assign(obj, feature.getDefaultOptions == null ? void 0 : feature.getDefaultOptions(table));
@@ -62577,7 +62951,7 @@ img.ProseMirror-separator {
62577
62951
  const queued = [];
62578
62952
  let queuedTimeout = false;
62579
62953
  const coreInstance = {
62580
- _features: features,
62954
+ _features,
62581
62955
  options: {
62582
62956
  ...defaultOptions,
62583
62957
  ...options
@@ -62713,104 +63087,6 @@ img.ProseMirror-separator {
62713
63087
  return table;
62714
63088
  }
62715
63089
 
62716
- function createCell(table, row, column, columnId) {
62717
- const getRenderValue = () => {
62718
- var _cell$getValue;
62719
- return (_cell$getValue = cell.getValue()) != null ? _cell$getValue : table.options.renderFallbackValue;
62720
- };
62721
- const cell = {
62722
- id: `${row.id}_${column.id}`,
62723
- row,
62724
- column,
62725
- getValue: () => row.getValue(columnId),
62726
- renderValue: getRenderValue,
62727
- getContext: memo$1(() => [table, column, row, cell], (table, column, row, cell) => ({
62728
- table,
62729
- column,
62730
- row,
62731
- cell: cell,
62732
- getValue: cell.getValue,
62733
- renderValue: cell.renderValue
62734
- }), getMemoOptions(table.options, 'debugCells', 'cell.getContext'))
62735
- };
62736
- table._features.forEach(feature => {
62737
- feature.createCell == null || feature.createCell(cell, column, row, table);
62738
- }, {});
62739
- return cell;
62740
- }
62741
-
62742
- const createRow = (table, id, original, rowIndex, depth, subRows, parentId) => {
62743
- let row = {
62744
- id,
62745
- index: rowIndex,
62746
- original,
62747
- depth,
62748
- parentId,
62749
- _valuesCache: {},
62750
- _uniqueValuesCache: {},
62751
- getValue: columnId => {
62752
- if (row._valuesCache.hasOwnProperty(columnId)) {
62753
- return row._valuesCache[columnId];
62754
- }
62755
- const column = table.getColumn(columnId);
62756
- if (!(column != null && column.accessorFn)) {
62757
- return undefined;
62758
- }
62759
- row._valuesCache[columnId] = column.accessorFn(row.original, rowIndex);
62760
- return row._valuesCache[columnId];
62761
- },
62762
- getUniqueValues: columnId => {
62763
- if (row._uniqueValuesCache.hasOwnProperty(columnId)) {
62764
- return row._uniqueValuesCache[columnId];
62765
- }
62766
- const column = table.getColumn(columnId);
62767
- if (!(column != null && column.accessorFn)) {
62768
- return undefined;
62769
- }
62770
- if (!column.columnDef.getUniqueValues) {
62771
- row._uniqueValuesCache[columnId] = [row.getValue(columnId)];
62772
- return row._uniqueValuesCache[columnId];
62773
- }
62774
- row._uniqueValuesCache[columnId] = column.columnDef.getUniqueValues(row.original, rowIndex);
62775
- return row._uniqueValuesCache[columnId];
62776
- },
62777
- renderValue: columnId => {
62778
- var _row$getValue;
62779
- return (_row$getValue = row.getValue(columnId)) != null ? _row$getValue : table.options.renderFallbackValue;
62780
- },
62781
- subRows: subRows != null ? subRows : [],
62782
- getLeafRows: () => flattenBy(row.subRows, d => d.subRows),
62783
- getParentRow: () => row.parentId ? table.getRow(row.parentId, true) : undefined,
62784
- getParentRows: () => {
62785
- let parentRows = [];
62786
- let currentRow = row;
62787
- while (true) {
62788
- const parentRow = currentRow.getParentRow();
62789
- if (!parentRow) break;
62790
- parentRows.push(parentRow);
62791
- currentRow = parentRow;
62792
- }
62793
- return parentRows.reverse();
62794
- },
62795
- getAllCells: memo$1(() => [table.getAllLeafColumns()], leafColumns => {
62796
- return leafColumns.map(column => {
62797
- return createCell(table, row, column, column.id);
62798
- });
62799
- }, getMemoOptions(table.options, 'debugRows', 'getAllCells')),
62800
- _getAllCellsByColumnId: memo$1(() => [row.getAllCells()], allCells => {
62801
- return allCells.reduce((acc, cell) => {
62802
- acc[cell.column.id] = cell;
62803
- return acc;
62804
- }, {});
62805
- }, getMemoOptions(table.options, 'debugRows', 'getAllCellsByColumnId'))
62806
- };
62807
- for (let i = 0; i < table._features.length; i++) {
62808
- const feature = table._features[i];
62809
- feature == null || feature.createRow == null || feature.createRow(row, table);
62810
- }
62811
- return row;
62812
- };
62813
-
62814
63090
  function getCoreRowModel() {
62815
63091
  return table => memo$1(() => [table.options.data], data => {
62816
63092
  const rowModel = {
@@ -62859,87 +63135,33 @@ img.ProseMirror-separator {
62859
63135
  }, getMemoOptions(table.options, 'debugTable', 'getRowModel', () => table._autoResetPageIndex()));
62860
63136
  }
62861
63137
 
62862
- function getSortedRowModel() {
62863
- return table => memo$1(() => [table.getState().sorting, table.getPreSortedRowModel()], (sorting, rowModel) => {
62864
- if (!rowModel.rows.length || !(sorting != null && sorting.length)) {
63138
+ function getExpandedRowModel() {
63139
+ return table => memo$1(() => [table.getState().expanded, table.getPreExpandedRowModel(), table.options.paginateExpandedRows], (expanded, rowModel, paginateExpandedRows) => {
63140
+ if (!rowModel.rows.length || expanded !== true && !Object.keys(expanded != null ? expanded : {}).length) {
62865
63141
  return rowModel;
62866
63142
  }
62867
- const sortingState = table.getState().sorting;
62868
- const sortedFlatRows = [];
62869
-
62870
- // Filter out sortings that correspond to non existing columns
62871
- const availableSorting = sortingState.filter(sort => {
62872
- var _table$getColumn;
62873
- return (_table$getColumn = table.getColumn(sort.id)) == null ? void 0 : _table$getColumn.getCanSort();
62874
- });
62875
- const columnInfoById = {};
62876
- availableSorting.forEach(sortEntry => {
62877
- const column = table.getColumn(sortEntry.id);
62878
- if (!column) return;
62879
- columnInfoById[sortEntry.id] = {
62880
- sortUndefined: column.columnDef.sortUndefined,
62881
- invertSorting: column.columnDef.invertSorting,
62882
- sortingFn: column.getSortingFn()
62883
- };
62884
- });
62885
- const sortData = rows => {
62886
- // This will also perform a stable sorting using the row index
62887
- // if needed.
62888
- const sortedData = rows.map(row => ({
62889
- ...row
62890
- }));
62891
- sortedData.sort((rowA, rowB) => {
62892
- for (let i = 0; i < availableSorting.length; i += 1) {
62893
- var _sortEntry$desc;
62894
- const sortEntry = availableSorting[i];
62895
- const columnInfo = columnInfoById[sortEntry.id];
62896
- const isDesc = (_sortEntry$desc = sortEntry == null ? void 0 : sortEntry.desc) != null ? _sortEntry$desc : false;
62897
- let sortInt = 0;
62898
-
62899
- // All sorting ints should always return in ascending order
62900
- if (columnInfo.sortUndefined) {
62901
- const aValue = rowA.getValue(sortEntry.id);
62902
- const bValue = rowB.getValue(sortEntry.id);
62903
- const aUndefined = aValue === undefined;
62904
- const bUndefined = bValue === undefined;
62905
- if (aUndefined || bUndefined) {
62906
- sortInt = aUndefined && bUndefined ? 0 : aUndefined ? columnInfo.sortUndefined : -columnInfo.sortUndefined;
62907
- }
62908
- }
62909
- if (sortInt === 0) {
62910
- sortInt = columnInfo.sortingFn(rowA, rowB, sortEntry.id);
62911
- }
62912
-
62913
- // If sorting is non-zero, take care of desc and inversion
62914
- if (sortInt !== 0) {
62915
- if (isDesc) {
62916
- sortInt *= -1;
62917
- }
62918
- if (columnInfo.invertSorting) {
62919
- sortInt *= -1;
62920
- }
62921
- return sortInt;
62922
- }
62923
- }
62924
- return rowA.index - rowB.index;
62925
- });
62926
-
62927
- // If there are sub-rows, sort them
62928
- sortedData.forEach(row => {
62929
- var _row$subRows;
62930
- sortedFlatRows.push(row);
62931
- if ((_row$subRows = row.subRows) != null && _row$subRows.length) {
62932
- row.subRows = sortData(row.subRows);
62933
- }
62934
- });
62935
- return sortedData;
62936
- };
62937
- return {
62938
- rows: sortData(rowModel.rows),
62939
- flatRows: sortedFlatRows,
62940
- rowsById: rowModel.rowsById
62941
- };
62942
- }, getMemoOptions(table.options, 'debugTable', 'getSortedRowModel', () => table._autoResetPageIndex()));
63143
+ if (!paginateExpandedRows) {
63144
+ // Only expand rows at this point if they are being paginated
63145
+ return rowModel;
63146
+ }
63147
+ return expandRows(rowModel);
63148
+ }, getMemoOptions(table.options, 'debugTable', 'getExpandedRowModel'));
63149
+ }
63150
+ function expandRows(rowModel) {
63151
+ const expandedRows = [];
63152
+ const handleRow = row => {
63153
+ var _row$subRows;
63154
+ expandedRows.push(row);
63155
+ if ((_row$subRows = row.subRows) != null && _row$subRows.length && row.getIsExpanded()) {
63156
+ row.subRows.forEach(handleRow);
63157
+ }
63158
+ };
63159
+ rowModel.rows.forEach(handleRow);
63160
+ return {
63161
+ rows: expandedRows,
63162
+ flatRows: rowModel.flatRows,
63163
+ rowsById: rowModel.rowsById
63164
+ };
62943
63165
  }
62944
63166
 
62945
63167
  function getGroupedRowModel() {
@@ -63075,33 +63297,90 @@ img.ProseMirror-separator {
63075
63297
  }, groupMap);
63076
63298
  }
63077
63299
 
63078
- function getExpandedRowModel() {
63079
- return table => memo$1(() => [table.getState().expanded, table.getPreExpandedRowModel(), table.options.paginateExpandedRows], (expanded, rowModel, paginateExpandedRows) => {
63080
- if (!rowModel.rows.length || expanded !== true && !Object.keys(expanded != null ? expanded : {}).length) {
63081
- return rowModel;
63082
- }
63083
- if (!paginateExpandedRows) {
63084
- // Only expand rows at this point if they are being paginated
63300
+ function getSortedRowModel() {
63301
+ return table => memo$1(() => [table.getState().sorting, table.getPreSortedRowModel()], (sorting, rowModel) => {
63302
+ if (!rowModel.rows.length || !(sorting != null && sorting.length)) {
63085
63303
  return rowModel;
63086
63304
  }
63087
- return expandRows(rowModel);
63088
- }, getMemoOptions(table.options, 'debugTable', 'getExpandedRowModel'));
63089
- }
63090
- function expandRows(rowModel) {
63091
- const expandedRows = [];
63092
- const handleRow = row => {
63093
- var _row$subRows;
63094
- expandedRows.push(row);
63095
- if ((_row$subRows = row.subRows) != null && _row$subRows.length && row.getIsExpanded()) {
63096
- row.subRows.forEach(handleRow);
63097
- }
63098
- };
63099
- rowModel.rows.forEach(handleRow);
63100
- return {
63101
- rows: expandedRows,
63102
- flatRows: rowModel.flatRows,
63103
- rowsById: rowModel.rowsById
63104
- };
63305
+ const sortingState = table.getState().sorting;
63306
+ const sortedFlatRows = [];
63307
+
63308
+ // Filter out sortings that correspond to non existing columns
63309
+ const availableSorting = sortingState.filter(sort => {
63310
+ var _table$getColumn;
63311
+ return (_table$getColumn = table.getColumn(sort.id)) == null ? void 0 : _table$getColumn.getCanSort();
63312
+ });
63313
+ const columnInfoById = {};
63314
+ availableSorting.forEach(sortEntry => {
63315
+ const column = table.getColumn(sortEntry.id);
63316
+ if (!column) return;
63317
+ columnInfoById[sortEntry.id] = {
63318
+ sortUndefined: column.columnDef.sortUndefined,
63319
+ invertSorting: column.columnDef.invertSorting,
63320
+ sortingFn: column.getSortingFn()
63321
+ };
63322
+ });
63323
+ const sortData = rows => {
63324
+ // This will also perform a stable sorting using the row index
63325
+ // if needed.
63326
+ const sortedData = rows.map(row => ({
63327
+ ...row
63328
+ }));
63329
+ sortedData.sort((rowA, rowB) => {
63330
+ for (let i = 0; i < availableSorting.length; i += 1) {
63331
+ var _sortEntry$desc;
63332
+ const sortEntry = availableSorting[i];
63333
+ const columnInfo = columnInfoById[sortEntry.id];
63334
+ const sortUndefined = columnInfo.sortUndefined;
63335
+ const isDesc = (_sortEntry$desc = sortEntry == null ? void 0 : sortEntry.desc) != null ? _sortEntry$desc : false;
63336
+ let sortInt = 0;
63337
+
63338
+ // All sorting ints should always return in ascending order
63339
+ if (sortUndefined) {
63340
+ const aValue = rowA.getValue(sortEntry.id);
63341
+ const bValue = rowB.getValue(sortEntry.id);
63342
+ const aUndefined = aValue === undefined;
63343
+ const bUndefined = bValue === undefined;
63344
+ if (aUndefined || bUndefined) {
63345
+ if (sortUndefined === 'first') return aUndefined ? -1 : 1;
63346
+ if (sortUndefined === 'last') return aUndefined ? 1 : -1;
63347
+ sortInt = aUndefined && bUndefined ? 0 : aUndefined ? sortUndefined : -sortUndefined;
63348
+ }
63349
+ }
63350
+ if (sortInt === 0) {
63351
+ sortInt = columnInfo.sortingFn(rowA, rowB, sortEntry.id);
63352
+ }
63353
+
63354
+ // If sorting is non-zero, take care of desc and inversion
63355
+ if (sortInt !== 0) {
63356
+ if (isDesc) {
63357
+ sortInt *= -1;
63358
+ }
63359
+ if (columnInfo.invertSorting) {
63360
+ sortInt *= -1;
63361
+ }
63362
+ return sortInt;
63363
+ }
63364
+ }
63365
+ return rowA.index - rowB.index;
63366
+ });
63367
+
63368
+ // If there are sub-rows, sort them
63369
+ sortedData.forEach(row => {
63370
+ var _row$subRows;
63371
+ sortedFlatRows.push(row);
63372
+ if ((_row$subRows = row.subRows) != null && _row$subRows.length) {
63373
+ row.subRows = sortData(row.subRows);
63374
+ }
63375
+ });
63376
+ return sortedData;
63377
+ };
63378
+ return {
63379
+ rows: sortData(rowModel.rows),
63380
+ flatRows: sortedFlatRows,
63381
+ rowsById: rowModel.rowsById
63382
+ };
63383
+ }, getMemoOptions(table.options, 'debugTable', 'getSortedRowModel', () => table._autoResetPageIndex()));
63105
63384
  }
63106
63385
 
63107
63386
  const TableRecordDelayedHierarchyState = {
@@ -65065,6 +65344,7 @@ img.ProseMirror-separator {
65065
65344
  measureElement,
65066
65345
  initialRect: { width: 0, height: 0 },
65067
65346
  scrollMargin: 0,
65347
+ gap: 0,
65068
65348
  scrollingDelay: 150,
65069
65349
  indexAttribute: "data-index",
65070
65350
  initialMeasurementsCache: [],
@@ -65208,7 +65488,7 @@ img.ProseMirror-separator {
65208
65488
  for (let i = min; i < count; i++) {
65209
65489
  const key = getItemKey(i);
65210
65490
  const furthestMeasurement = this.options.lanes === 1 ? measurements[i - 1] : this.getFurthestMeasurement(measurements, i);
65211
- const start = furthestMeasurement ? furthestMeasurement.end : paddingStart + scrollMargin;
65491
+ const start = furthestMeasurement ? furthestMeasurement.end + this.options.gap : paddingStart + scrollMargin;
65212
65492
  const measuredSize = itemSizeCache.get(key);
65213
65493
  const size = typeof measuredSize === "number" ? measuredSize : this.options.estimateSize(i);
65214
65494
  const end = start + size;
@@ -65300,7 +65580,7 @@ img.ProseMirror-separator {
65300
65580
  const itemSize = this.itemSizeCache.get(item.key) ?? item.size;
65301
65581
  const delta = size - itemSize;
65302
65582
  if (delta !== 0) {
65303
- if (item.start < this.scrollOffset + this.scrollAdjustments) {
65583
+ if (this.shouldAdjustScrollPositionOnItemSizeChange !== void 0 ? this.shouldAdjustScrollPositionOnItemSizeChange(item, delta, this) : item.start < this.scrollOffset + this.scrollAdjustments) {
65304
65584
  if (this.options.debug) {
65305
65585
  console.info("correction", delta);
65306
65586
  }
@@ -65468,7 +65748,7 @@ img.ProseMirror-separator {
65468
65748
  };
65469
65749
  this.setOptions(opts);
65470
65750
  this.scrollRect = this.options.initialRect;
65471
- this.scrollOffset = this.options.initialOffset;
65751
+ this.scrollOffset = typeof this.options.initialOffset === "function" ? this.options.initialOffset() : this.options.initialOffset;
65472
65752
  this.measurementsCache = this.options.initialMeasurementsCache;
65473
65753
  this.measurementsCache.forEach((item) => {
65474
65754
  this.itemSizeCache.set(item.key, item.size);