@tanstack/svelte-table 8.11.2 → 8.11.4

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.
@@ -1,21 +1,5 @@
1
1
  /**
2
- * svelte-table
3
- *
4
- * Copyright (c) TanStack
5
- *
6
- * This source code is licensed under the MIT license found in the
7
- * LICENSE.md file in the root directory of this source tree.
8
- *
9
- * @license MIT
10
- */
11
- (function (global, factory) {
12
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('svelte/internal'), require('svelte/store')) :
13
- typeof define === 'function' && define.amd ? define(['exports', 'svelte/internal', 'svelte/store'], factory) :
14
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.SvelteTable = {}, global.SvelteInternal, global.SvelteStore));
15
- })(this, (function (exports, internal, store) { 'use strict';
16
-
17
- /**
18
- * table-core
2
+ * svelte-table
19
3
  *
20
4
  * Copyright (c) TanStack
21
5
  *
@@ -24,6 +8,22 @@
24
8
  *
25
9
  * @license MIT
26
10
  */
11
+ (function (global, factory) {
12
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('svelte/internal'), require('svelte/internal/disclose-version'), require('svelte/store')) :
13
+ typeof define === 'function' && define.amd ? define(['exports', 'svelte/internal', 'svelte/internal/disclose-version', 'svelte/store'], factory) :
14
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.SvelteTable = {}, global.SvelteInternal, null, global.SvelteStore));
15
+ })(this, (function (exports, internal, discloseVersion, store) { 'use strict';
16
+
17
+ /**
18
+ * table-core
19
+ *
20
+ * Copyright (c) TanStack
21
+ *
22
+ * This source code is licensed under the MIT license found in the
23
+ * LICENSE.md file in the root directory of this source tree.
24
+ *
25
+ * @license MIT
26
+ */
27
27
  // Is this type a tuple?
28
28
 
29
29
  // If this type is a tuple, what indices are allowed?
@@ -616,7 +616,10 @@
616
616
  }
617
617
  return 0;
618
618
  };
619
- header.getResizeHandler = () => {
619
+ header.getResizeHandler = function (contextDocument) {
620
+ if (contextDocument === void 0) {
621
+ contextDocument = document;
622
+ }
620
623
  const column = table.getColumn(header.column.id);
621
624
  const canResize = column == null ? void 0 : column.getCanResize();
622
625
  return e => {
@@ -676,8 +679,8 @@
676
679
  const mouseEvents = {
677
680
  moveHandler: e => onMove(e.clientX),
678
681
  upHandler: e => {
679
- document.removeEventListener('mousemove', mouseEvents.moveHandler);
680
- document.removeEventListener('mouseup', mouseEvents.upHandler);
682
+ contextDocument.removeEventListener('mousemove', mouseEvents.moveHandler);
683
+ contextDocument.removeEventListener('mouseup', mouseEvents.upHandler);
681
684
  onEnd(e.clientX);
682
685
  }
683
686
  };
@@ -692,8 +695,8 @@
692
695
  },
693
696
  upHandler: e => {
694
697
  var _e$touches$;
695
- document.removeEventListener('touchmove', touchEvents.moveHandler);
696
- document.removeEventListener('touchend', touchEvents.upHandler);
698
+ contextDocument.removeEventListener('touchmove', touchEvents.moveHandler);
699
+ contextDocument.removeEventListener('touchend', touchEvents.upHandler);
697
700
  if (e.cancelable) {
698
701
  e.preventDefault();
699
702
  e.stopPropagation();
@@ -705,11 +708,11 @@
705
708
  passive: false
706
709
  } : false;
707
710
  if (isTouchStartEvent(e)) {
708
- document.addEventListener('touchmove', touchEvents.moveHandler, passiveIfSupported);
709
- document.addEventListener('touchend', touchEvents.upHandler, passiveIfSupported);
711
+ contextDocument.addEventListener('touchmove', touchEvents.moveHandler, passiveIfSupported);
712
+ contextDocument.addEventListener('touchend', touchEvents.upHandler, passiveIfSupported);
710
713
  } else {
711
- document.addEventListener('mousemove', mouseEvents.moveHandler, passiveIfSupported);
712
- document.addEventListener('mouseup', mouseEvents.upHandler, passiveIfSupported);
714
+ contextDocument.addEventListener('mousemove', mouseEvents.moveHandler, passiveIfSupported);
715
+ contextDocument.addEventListener('mouseup', mouseEvents.upHandler, passiveIfSupported);
713
716
  }
714
717
  table.setColumnSizingInfo(old => ({
715
718
  ...old,
@@ -2812,11 +2815,15 @@
2812
2815
  getRowModel: () => {
2813
2816
  return table.getPaginationRowModel();
2814
2817
  },
2818
+ //in next version, we should just pass in the row model as the optional 2nd arg
2815
2819
  getRow: (id, searchAll) => {
2816
- const row = (searchAll ? table.getCoreRowModel() : table.getRowModel()).rowsById[id];
2820
+ let row = (searchAll ? table.getPrePaginationRowModel() : table.getRowModel()).rowsById[id];
2817
2821
  if (!row) {
2818
- {
2819
- throw new Error(`getRow expected an ID, but got ${id}`);
2822
+ row = table.getCoreRowModel().rowsById[id];
2823
+ if (!row) {
2824
+ {
2825
+ throw new Error(`getRow could not find row with ID: ${id}`);
2826
+ }
2820
2827
  }
2821
2828
  }
2822
2829
  return row;
@@ -3753,7 +3760,7 @@
3753
3760
  });
3754
3761
  }
3755
3762
 
3756
- /* packages/svelte-table/src/placeholder.svelte generated by Svelte v3.59.2 */
3763
+ /* src/placeholder.svelte generated by Svelte v4.2.8 */
3757
3764
 
3758
3765
  function create_fragment$1(ctx) {
3759
3766
  let t;
@@ -3771,7 +3778,9 @@
3771
3778
  i: internal.noop,
3772
3779
  o: internal.noop,
3773
3780
  d(detaching) {
3774
- if (detaching) internal.detach(t);
3781
+ if (detaching) {
3782
+ internal.detach(t);
3783
+ }
3775
3784
  }
3776
3785
  };
3777
3786
  }
@@ -3786,12 +3795,12 @@
3786
3795
  return [content];
3787
3796
  }
3788
3797
 
3789
- class Placeholder$1 extends internal.SvelteComponent {
3798
+ let Placeholder$1 = class Placeholder extends internal.SvelteComponent {
3790
3799
  constructor(options) {
3791
3800
  super();
3792
3801
  internal.init(this, options, instance, create_fragment$1, internal.safe_not_equal, { content: 0 });
3793
3802
  }
3794
- }
3803
+ };
3795
3804
 
3796
3805
  const PlaceholderServer = internal.create_ssr_component(($$result, $$props, $$bindings, slots) => {
3797
3806
  return `${internal.escape($$props.content)}`;
@@ -3985,7 +3994,5 @@
3985
3994
  exports.shouldAutoRemoveFilter = shouldAutoRemoveFilter;
3986
3995
  exports.sortingFns = sortingFns;
3987
3996
 
3988
- Object.defineProperty(exports, '__esModule', { value: true });
3989
-
3990
3997
  }));
3991
3998
  //# sourceMappingURL=index.development.js.map