@revolist/revogrid 3.2.13 → 3.2.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 (55) hide show
  1. package/custom-element/_baseIteratee.js +2070 -0
  2. package/custom-element/columnService.js +743 -0
  3. package/custom-element/consts.js +46 -0
  4. package/custom-element/data.store.js +545 -0
  5. package/custom-element/debounce.js +217 -0
  6. package/custom-element/dimension.helpers.js +340 -0
  7. package/custom-element/each.js +180 -0
  8. package/custom-element/filter.button.js +36 -0
  9. package/custom-element/identity.js +26 -0
  10. package/custom-element/index.d.ts +15 -98
  11. package/custom-element/index.js +15 -29221
  12. package/custom-element/isSymbol.js +220 -0
  13. package/custom-element/keys.js +561 -0
  14. package/custom-element/localScrollService.js +86 -0
  15. package/custom-element/revo-grid.d.ts +11 -0
  16. package/custom-element/revo-grid.js +3662 -0
  17. package/custom-element/revogr-clipboard.d.ts +11 -0
  18. package/custom-element/revogr-clipboard.js +72 -0
  19. package/custom-element/revogr-data.d.ts +11 -0
  20. package/custom-element/revogr-data.js +9 -0
  21. package/custom-element/revogr-data2.js +171 -0
  22. package/custom-element/revogr-edit.d.ts +11 -0
  23. package/custom-element/revogr-edit.js +9 -0
  24. package/custom-element/revogr-edit2.js +402 -0
  25. package/custom-element/revogr-filter-panel.d.ts +11 -0
  26. package/custom-element/revogr-filter-panel.js +308 -0
  27. package/custom-element/revogr-focus.d.ts +11 -0
  28. package/custom-element/revogr-focus.js +9 -0
  29. package/custom-element/revogr-focus2.js +64 -0
  30. package/custom-element/revogr-header.d.ts +11 -0
  31. package/custom-element/revogr-header.js +9 -0
  32. package/custom-element/revogr-header2.js +591 -0
  33. package/custom-element/revogr-order-editor.d.ts +11 -0
  34. package/custom-element/revogr-order-editor.js +9 -0
  35. package/custom-element/revogr-order-editor2.js +190 -0
  36. package/custom-element/revogr-overlay-selection.d.ts +11 -0
  37. package/custom-element/revogr-overlay-selection.js +9 -0
  38. package/custom-element/revogr-overlay-selection2.js +741 -0
  39. package/custom-element/revogr-row-headers.d.ts +11 -0
  40. package/custom-element/revogr-row-headers.js +9 -0
  41. package/custom-element/revogr-row-headers2.js +403 -0
  42. package/custom-element/revogr-scroll-virtual.d.ts +11 -0
  43. package/custom-element/revogr-scroll-virtual.js +9 -0
  44. package/custom-element/revogr-scroll-virtual2.js +135 -0
  45. package/custom-element/revogr-temp-range.d.ts +11 -0
  46. package/custom-element/revogr-temp-range.js +9 -0
  47. package/custom-element/revogr-temp-range2.js +17275 -0
  48. package/custom-element/revogr-viewport-scroll.d.ts +11 -0
  49. package/custom-element/revogr-viewport-scroll.js +9 -0
  50. package/custom-element/revogr-viewport-scroll2.js +367 -0
  51. package/custom-element/selection.utils.js +106 -0
  52. package/custom-element/toInteger.js +107 -0
  53. package/custom-element/toNumber.js +105 -0
  54. package/custom-element/utils.js +69 -0
  55. package/package.json +2 -2
@@ -0,0 +1,11 @@
1
+ import type { Components, JSX } from "../dist/types/components";
2
+
3
+ interface RevogrViewportScroll extends Components.RevogrViewportScroll, HTMLElement {}
4
+ export const RevogrViewportScroll: {
5
+ prototype: RevogrViewportScroll;
6
+ new (): RevogrViewportScroll;
7
+ };
8
+ /**
9
+ * Used to define this component and all nested components recursively.
10
+ */
11
+ export const defineCustomElement: () => void;
@@ -0,0 +1,9 @@
1
+ /*!
2
+ * Built by Revolist
3
+ */
4
+ import { R as RevogrViewportScroll$1, d as defineCustomElement$1 } from './revogr-viewport-scroll2.js';
5
+
6
+ const RevogrViewportScroll = RevogrViewportScroll$1;
7
+ const defineCustomElement = defineCustomElement$1;
8
+
9
+ export { RevogrViewportScroll, defineCustomElement };
@@ -0,0 +1,367 @@
1
+ /*!
2
+ * Built by Revolist
3
+ */
4
+ import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/core/internal/client';
5
+ import { e as each } from './each.js';
6
+ import { d as debounce_1 } from './debounce.js';
7
+ import { b as isObject_1 } from './isSymbol.js';
8
+ import { L as LocalScrollService } from './localScrollService.js';
9
+
10
+ const HEADER_SLOT = 'header';
11
+ const FOOTER_SLOT = 'footer';
12
+ const CONTENT_SLOT = 'content';
13
+ const DATA_SLOT = 'data';
14
+ /** Receive last visible in viewport by required type */
15
+ function getLastCell(data, rowType) {
16
+ return {
17
+ x: data.viewports[data.colType].store.get('realCount'),
18
+ y: data.viewports[rowType].store.get('realCount'),
19
+ };
20
+ }
21
+
22
+ /** Error message constants. */
23
+ var FUNC_ERROR_TEXT = 'Expected a function';
24
+
25
+ /**
26
+ * Creates a throttled function that only invokes `func` at most once per
27
+ * every `wait` milliseconds. The throttled function comes with a `cancel`
28
+ * method to cancel delayed `func` invocations and a `flush` method to
29
+ * immediately invoke them. Provide `options` to indicate whether `func`
30
+ * should be invoked on the leading and/or trailing edge of the `wait`
31
+ * timeout. The `func` is invoked with the last arguments provided to the
32
+ * throttled function. Subsequent calls to the throttled function return the
33
+ * result of the last `func` invocation.
34
+ *
35
+ * **Note:** If `leading` and `trailing` options are `true`, `func` is
36
+ * invoked on the trailing edge of the timeout only if the throttled function
37
+ * is invoked more than once during the `wait` timeout.
38
+ *
39
+ * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
40
+ * until to the next tick, similar to `setTimeout` with a timeout of `0`.
41
+ *
42
+ * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
43
+ * for details over the differences between `_.throttle` and `_.debounce`.
44
+ *
45
+ * @static
46
+ * @memberOf _
47
+ * @since 0.1.0
48
+ * @category Function
49
+ * @param {Function} func The function to throttle.
50
+ * @param {number} [wait=0] The number of milliseconds to throttle invocations to.
51
+ * @param {Object} [options={}] The options object.
52
+ * @param {boolean} [options.leading=true]
53
+ * Specify invoking on the leading edge of the timeout.
54
+ * @param {boolean} [options.trailing=true]
55
+ * Specify invoking on the trailing edge of the timeout.
56
+ * @returns {Function} Returns the new throttled function.
57
+ * @example
58
+ *
59
+ * // Avoid excessively updating the position while scrolling.
60
+ * jQuery(window).on('scroll', _.throttle(updatePosition, 100));
61
+ *
62
+ * // Invoke `renewToken` when the click event is fired, but not more than once every 5 minutes.
63
+ * var throttled = _.throttle(renewToken, 300000, { 'trailing': false });
64
+ * jQuery(element).on('click', throttled);
65
+ *
66
+ * // Cancel the trailing throttled invocation.
67
+ * jQuery(window).on('popstate', throttled.cancel);
68
+ */
69
+ function throttle(func, wait, options) {
70
+ var leading = true,
71
+ trailing = true;
72
+
73
+ if (typeof func != 'function') {
74
+ throw new TypeError(FUNC_ERROR_TEXT);
75
+ }
76
+ if (isObject_1(options)) {
77
+ leading = 'leading' in options ? !!options.leading : leading;
78
+ trailing = 'trailing' in options ? !!options.trailing : trailing;
79
+ }
80
+ return debounce_1(func, wait, {
81
+ 'leading': leading,
82
+ 'maxWait': wait,
83
+ 'trailing': trailing
84
+ });
85
+ }
86
+
87
+ var throttle_1 = throttle;
88
+
89
+ async function resizeObserver() {
90
+ if (!('ResizeObserver' in window)) {
91
+ const module = await import('./resize-observer.js');
92
+ window.ResizeObserver = module.ResizeObserver;
93
+ }
94
+ }
95
+
96
+ class GridResizeService {
97
+ constructor(el, events) {
98
+ this.events = events;
99
+ this.resizeObserver = null;
100
+ this.resize = throttle_1((e, o) => { var _a; return (_a = this.events) === null || _a === void 0 ? void 0 : _a.resize(e, o); }, 10);
101
+ this.init(el);
102
+ }
103
+ async init(el) {
104
+ var _a;
105
+ await resizeObserver();
106
+ this.resizeObserver = new ResizeObserver(this.resize);
107
+ (_a = this.resizeObserver) === null || _a === void 0 ? void 0 : _a.observe(el);
108
+ }
109
+ destroy() {
110
+ var _a;
111
+ (_a = this.resizeObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
112
+ this.resizeObserver = null;
113
+ }
114
+ }
115
+
116
+ const revogrViewportScrollStyleCss = ".revo-drag-icon{-webkit-mask-image:url(\"data:image/svg+xml,%3C%3Fxml version='1.0' encoding='UTF-8'%3F%3E%3Csvg viewBox='0 0 438 383' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink'%3E%3Cg%3E%3Cpath d='M421.875,70.40625 C426.432292,70.40625 430.175781,68.9414062 433.105469,66.0117188 C436.035156,63.0820312 437.5,59.3385417 437.5,54.78125 L437.5,54.78125 L437.5,15.71875 C437.5,11.1614583 436.035156,7.41796875 433.105469,4.48828125 C430.175781,1.55859375 426.432292,0.09375 421.875,0.09375 L421.875,0.09375 L15.625,0.09375 C11.0677083,0.09375 7.32421875,1.55859375 4.39453125,4.48828125 C1.46484375,7.41796875 0,11.1614583 0,15.71875 L0,15.71875 L0,54.78125 C0,59.3385417 1.46484375,63.0820312 4.39453125,66.0117188 C7.32421875,68.9414062 11.0677083,70.40625 15.625,70.40625 L15.625,70.40625 L421.875,70.40625 Z M421.875,226.65625 C426.432292,226.65625 430.175781,225.191406 433.105469,222.261719 C436.035156,219.332031 437.5,215.588542 437.5,211.03125 L437.5,211.03125 L437.5,171.96875 C437.5,167.411458 436.035156,163.667969 433.105469,160.738281 C430.175781,157.808594 426.432292,156.34375 421.875,156.34375 L421.875,156.34375 L15.625,156.34375 C11.0677083,156.34375 7.32421875,157.808594 4.39453125,160.738281 C1.46484375,163.667969 0,167.411458 0,171.96875 L0,171.96875 L0,211.03125 C0,215.588542 1.46484375,219.332031 4.39453125,222.261719 C7.32421875,225.191406 11.0677083,226.65625 15.625,226.65625 L15.625,226.65625 L421.875,226.65625 Z M421.875,382.90625 C426.432292,382.90625 430.175781,381.441406 433.105469,378.511719 C436.035156,375.582031 437.5,371.838542 437.5,367.28125 L437.5,367.28125 L437.5,328.21875 C437.5,323.661458 436.035156,319.917969 433.105469,316.988281 C430.175781,314.058594 426.432292,312.59375 421.875,312.59375 L421.875,312.59375 L15.625,312.59375 C11.0677083,312.59375 7.32421875,314.058594 4.39453125,316.988281 C1.46484375,319.917969 0,323.661458 0,328.21875 L0,328.21875 L0,367.28125 C0,371.838542 1.46484375,375.582031 4.39453125,378.511719 C7.32421875,381.441406 11.0677083,382.90625 15.625,382.90625 L15.625,382.90625 L421.875,382.90625 Z'%3E%3C/path%3E%3C/g%3E%3C/svg%3E\");mask-image:url(\"data:image/svg+xml,%3C%3Fxml version='1.0' encoding='UTF-8'%3F%3E%3Csvg viewBox='0 0 438 383' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink'%3E%3Cg%3E%3Cpath d='M421.875,70.40625 C426.432292,70.40625 430.175781,68.9414062 433.105469,66.0117188 C436.035156,63.0820312 437.5,59.3385417 437.5,54.78125 L437.5,54.78125 L437.5,15.71875 C437.5,11.1614583 436.035156,7.41796875 433.105469,4.48828125 C430.175781,1.55859375 426.432292,0.09375 421.875,0.09375 L421.875,0.09375 L15.625,0.09375 C11.0677083,0.09375 7.32421875,1.55859375 4.39453125,4.48828125 C1.46484375,7.41796875 0,11.1614583 0,15.71875 L0,15.71875 L0,54.78125 C0,59.3385417 1.46484375,63.0820312 4.39453125,66.0117188 C7.32421875,68.9414062 11.0677083,70.40625 15.625,70.40625 L15.625,70.40625 L421.875,70.40625 Z M421.875,226.65625 C426.432292,226.65625 430.175781,225.191406 433.105469,222.261719 C436.035156,219.332031 437.5,215.588542 437.5,211.03125 L437.5,211.03125 L437.5,171.96875 C437.5,167.411458 436.035156,163.667969 433.105469,160.738281 C430.175781,157.808594 426.432292,156.34375 421.875,156.34375 L421.875,156.34375 L15.625,156.34375 C11.0677083,156.34375 7.32421875,157.808594 4.39453125,160.738281 C1.46484375,163.667969 0,167.411458 0,171.96875 L0,171.96875 L0,211.03125 C0,215.588542 1.46484375,219.332031 4.39453125,222.261719 C7.32421875,225.191406 11.0677083,226.65625 15.625,226.65625 L15.625,226.65625 L421.875,226.65625 Z M421.875,382.90625 C426.432292,382.90625 430.175781,381.441406 433.105469,378.511719 C436.035156,375.582031 437.5,371.838542 437.5,367.28125 L437.5,367.28125 L437.5,328.21875 C437.5,323.661458 436.035156,319.917969 433.105469,316.988281 C430.175781,314.058594 426.432292,312.59375 421.875,312.59375 L421.875,312.59375 L15.625,312.59375 C11.0677083,312.59375 7.32421875,314.058594 4.39453125,316.988281 C1.46484375,319.917969 0,323.661458 0,328.21875 L0,328.21875 L0,367.28125 C0,371.838542 1.46484375,375.582031 4.39453125,378.511719 C7.32421875,381.441406 11.0677083,382.90625 15.625,382.90625 L15.625,382.90625 L421.875,382.90625 Z'%3E%3C/path%3E%3C/g%3E%3C/svg%3E\");width:11px;height:7px;background-size:cover;background-repeat:no-repeat}.revo-alt-icon{-webkit-mask-image:url(\"data:image/svg+xml,%3C%3Fxml version='1.0' encoding='UTF-8'%3F%3E%3Csvg viewBox='0 0 384 383' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink'%3E%3Cg%3E%3Cpath d='M192.4375,383 C197.424479,383 201.663411,381.254557 205.154297,377.763672 L205.154297,377.763672 L264.25,318.667969 C270.234375,312.683594 271.605794,306.075846 268.364258,298.844727 C265.122721,291.613607 259.51237,287.998047 251.533203,287.998047 L251.533203,287.998047 L213.382812,287.998047 L213.382812,212.445312 L288.935547,212.445312 L288.935547,250.595703 C288.935547,258.57487 292.551107,264.185221 299.782227,267.426758 C307.013346,270.668294 313.621094,269.296875 319.605469,263.3125 L319.605469,263.3125 L378.701172,204.216797 C382.192057,200.725911 383.9375,196.486979 383.9375,191.5 C383.9375,186.513021 382.192057,182.274089 378.701172,178.783203 L378.701172,178.783203 L319.605469,119.6875 C313.621094,114.201823 307.013346,112.955078 299.782227,115.947266 C292.551107,118.939453 288.935547,124.42513 288.935547,132.404297 L288.935547,132.404297 L288.935547,170.554688 L213.382812,170.554688 L213.382812,95.0019531 L251.533203,95.0019531 C259.51237,95.0019531 264.998047,91.3863932 267.990234,84.1552734 C270.982422,76.9241536 269.735677,70.3164062 264.25,64.3320312 L264.25,64.3320312 L205.154297,5.23632812 C201.663411,1.74544271 197.424479,0 192.4375,0 C187.450521,0 183.211589,1.74544271 179.720703,5.23632812 L179.720703,5.23632812 L120.625,64.3320312 C114.640625,70.3164062 113.269206,76.9241536 116.510742,84.1552734 C119.752279,91.3863932 125.36263,95.0019531 133.341797,95.0019531 L133.341797,95.0019531 L171.492188,95.0019531 L171.492188,170.554688 L95.9394531,170.554688 L95.9394531,132.404297 C95.9394531,124.42513 92.3238932,118.814779 85.0927734,115.573242 C77.8616536,112.331706 71.2539062,113.703125 65.2695312,119.6875 L65.2695312,119.6875 L6.17382812,178.783203 C2.68294271,182.274089 0.9375,186.513021 0.9375,191.5 C0.9375,196.486979 2.68294271,200.725911 6.17382812,204.216797 L6.17382812,204.216797 L65.2695312,263.3125 C71.2539062,268.798177 77.8616536,270.044922 85.0927734,267.052734 C92.3238932,264.060547 95.9394531,258.57487 95.9394531,250.595703 L95.9394531,250.595703 L95.9394531,212.445312 L171.492188,212.445312 L171.492188,287.998047 L133.341797,287.998047 C125.36263,287.998047 119.876953,291.613607 116.884766,298.844727 C113.892578,306.075846 115.139323,312.683594 120.625,318.667969 L120.625,318.667969 L179.720703,377.763672 C183.211589,381.254557 187.450521,383 192.4375,383 Z'%3E%3C/path%3E%3C/g%3E%3C/svg%3E\");mask-image:url(\"data:image/svg+xml,%3C%3Fxml version='1.0' encoding='UTF-8'%3F%3E%3Csvg viewBox='0 0 384 383' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink'%3E%3Cg%3E%3Cpath d='M192.4375,383 C197.424479,383 201.663411,381.254557 205.154297,377.763672 L205.154297,377.763672 L264.25,318.667969 C270.234375,312.683594 271.605794,306.075846 268.364258,298.844727 C265.122721,291.613607 259.51237,287.998047 251.533203,287.998047 L251.533203,287.998047 L213.382812,287.998047 L213.382812,212.445312 L288.935547,212.445312 L288.935547,250.595703 C288.935547,258.57487 292.551107,264.185221 299.782227,267.426758 C307.013346,270.668294 313.621094,269.296875 319.605469,263.3125 L319.605469,263.3125 L378.701172,204.216797 C382.192057,200.725911 383.9375,196.486979 383.9375,191.5 C383.9375,186.513021 382.192057,182.274089 378.701172,178.783203 L378.701172,178.783203 L319.605469,119.6875 C313.621094,114.201823 307.013346,112.955078 299.782227,115.947266 C292.551107,118.939453 288.935547,124.42513 288.935547,132.404297 L288.935547,132.404297 L288.935547,170.554688 L213.382812,170.554688 L213.382812,95.0019531 L251.533203,95.0019531 C259.51237,95.0019531 264.998047,91.3863932 267.990234,84.1552734 C270.982422,76.9241536 269.735677,70.3164062 264.25,64.3320312 L264.25,64.3320312 L205.154297,5.23632812 C201.663411,1.74544271 197.424479,0 192.4375,0 C187.450521,0 183.211589,1.74544271 179.720703,5.23632812 L179.720703,5.23632812 L120.625,64.3320312 C114.640625,70.3164062 113.269206,76.9241536 116.510742,84.1552734 C119.752279,91.3863932 125.36263,95.0019531 133.341797,95.0019531 L133.341797,95.0019531 L171.492188,95.0019531 L171.492188,170.554688 L95.9394531,170.554688 L95.9394531,132.404297 C95.9394531,124.42513 92.3238932,118.814779 85.0927734,115.573242 C77.8616536,112.331706 71.2539062,113.703125 65.2695312,119.6875 L65.2695312,119.6875 L6.17382812,178.783203 C2.68294271,182.274089 0.9375,186.513021 0.9375,191.5 C0.9375,196.486979 2.68294271,200.725911 6.17382812,204.216797 L6.17382812,204.216797 L65.2695312,263.3125 C71.2539062,268.798177 77.8616536,270.044922 85.0927734,267.052734 C92.3238932,264.060547 95.9394531,258.57487 95.9394531,250.595703 L95.9394531,250.595703 L95.9394531,212.445312 L171.492188,212.445312 L171.492188,287.998047 L133.341797,287.998047 C125.36263,287.998047 119.876953,291.613607 116.884766,298.844727 C113.892578,306.075846 115.139323,312.683594 120.625,318.667969 L120.625,318.667969 L179.720703,377.763672 C183.211589,381.254557 187.450521,383 192.4375,383 Z'%3E%3C/path%3E%3C/g%3E%3C/svg%3E\");width:11px;height:11px;background-size:cover;background-repeat:no-repeat}.arrow-down{position:absolute;right:5px;top:0}.arrow-down svg{width:8px;margin-top:5px;margin-left:5px;opacity:0.4}.cell-value-wrapper{margin-right:10px;overflow:hidden;text-overflow:ellipsis}.revo-button{position:relative;overflow:hidden;color:#fff;background-color:#6200ee;height:34px;line-height:34px;padding:0 15px;outline:0;border:0;border-radius:7px;box-sizing:border-box;cursor:pointer}.revo-button.green{background-color:#2ee072;border:1px solid #20d565}.revo-button.red{background-color:#E0662E;border:1px solid #d55920}.revo-button:disabled,.revo-button[disabled]{cursor:not-allowed !important;filter:opacity(0.35) !important}.revo-button.light{border:2px solid #cedefa;line-height:32px;background:none;color:#4876ca;box-shadow:none}.rowHeaders{z-index:2;font-size:10px;display:flex;height:100%}.rowHeaders revogr-data .rgCell{text-align:center}.rowHeaders .rgCell{padding:0 1em !important;min-width:100%}revogr-viewport-scroll{-ms-overflow-style:none;scrollbar-width:none;overflow-x:auto;overflow-y:hidden;position:relative;z-index:1;height:100%}revogr-viewport-scroll::-webkit-scrollbar{display:none;-webkit-appearance:none}revogr-viewport-scroll.colPinStart,revogr-viewport-scroll.colPinEnd{z-index:2}revogr-viewport-scroll.rgCol{flex-grow:1}revogr-viewport-scroll .content-wrapper{overflow:hidden}revogr-viewport-scroll .inner-content-table{display:flex;flex-direction:column;max-height:100%;width:100%;min-width:100%;position:relative;z-index:0}revogr-viewport-scroll .vertical-inner{overflow-y:auto;position:relative;width:100%;flex-grow:1;-ms-overflow-style:none;scrollbar-width:none;}revogr-viewport-scroll .vertical-inner::-webkit-scrollbar{display:none;-webkit-appearance:none}revogr-viewport-scroll .vertical-inner revogr-data,revogr-viewport-scroll .vertical-inner revogr-overlay-selection{height:100%}";
117
+
118
+ const RevogrViewportScroll = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
119
+ constructor() {
120
+ super();
121
+ this.__registerHost();
122
+ this.scrollViewport = createEvent(this, "scrollViewport", 3);
123
+ this.resizeViewport = createEvent(this, "resizeViewport", 7);
124
+ this.scrollchange = createEvent(this, "scrollchange", 7);
125
+ this.scrollThrottling = 30;
126
+ /**
127
+ * Width of inner content
128
+ */
129
+ this.contentWidth = 0;
130
+ /**
131
+ * Height of inner content
132
+ */
133
+ this.contentHeight = 0;
134
+ this.oldValY = this.contentHeight;
135
+ this.oldValX = this.contentWidth;
136
+ /**
137
+ * Last mw event time for trigger scroll function below
138
+ * If mousewheel function was ignored we still need to trigger render
139
+ */
140
+ this.mouseWheelScroll = { rgCol: 0, rgRow: 0 };
141
+ }
142
+ async setScroll(e) {
143
+ var _a;
144
+ this.latestScrollUpdate(e.dimension);
145
+ (_a = this.scrollService) === null || _a === void 0 ? void 0 : _a.setScroll(e);
146
+ }
147
+ /**
148
+ * update on delta in case we don't know existing position or external change
149
+ * @param e
150
+ */
151
+ async changeScroll(e) {
152
+ if (e.delta) {
153
+ switch (e.dimension) {
154
+ case 'rgCol':
155
+ e.coordinate = this.horizontalScroll.scrollLeft + e.delta;
156
+ break;
157
+ case 'rgRow':
158
+ e.coordinate = this.verticalScroll.scrollTop + e.delta;
159
+ break;
160
+ }
161
+ this.setScroll(e);
162
+ }
163
+ return e;
164
+ }
165
+ connectedCallback() {
166
+ /**
167
+ * Bind scroll functions for farther usage
168
+ */
169
+ if ('ontouchstart' in document.documentElement) {
170
+ this.scrollThrottling = 0;
171
+ }
172
+ else {
173
+ this.verticalMouseWheel = this.onVerticalMouseWheel.bind(this, 'rgRow', 'deltaY');
174
+ this.horizontalMouseWheel = this.onHorizontalMouseWheel.bind(this, 'rgCol', 'deltaX');
175
+ }
176
+ /**
177
+ * Create local scroll service
178
+ */
179
+ this.scrollService = new LocalScrollService({
180
+ beforeScroll: e => this.scrollViewport.emit(e),
181
+ afterScroll: e => {
182
+ switch (e.dimension) {
183
+ case 'rgCol':
184
+ this.horizontalScroll.scrollLeft = e.coordinate;
185
+ break;
186
+ case 'rgRow':
187
+ this.verticalScroll.scrollTop = e.coordinate;
188
+ break;
189
+ }
190
+ },
191
+ });
192
+ }
193
+ componentDidLoad() {
194
+ /**
195
+ * Track horizontal viewport resize
196
+ */
197
+ this.horisontalResize = new GridResizeService(this.horizontalScroll, {
198
+ resize: entries => {
199
+ var _a, _b;
200
+ let height = ((_a = entries[0]) === null || _a === void 0 ? void 0 : _a.contentRect.height) || 0;
201
+ if (height) {
202
+ height -= this.header.clientHeight + this.footer.clientHeight;
203
+ }
204
+ const els = {
205
+ rgRow: {
206
+ size: height,
207
+ contentSize: this.contentHeight,
208
+ scroll: this.verticalScroll.scrollTop,
209
+ },
210
+ rgCol: {
211
+ size: ((_b = entries[0]) === null || _b === void 0 ? void 0 : _b.contentRect.width) || 0,
212
+ contentSize: this.contentWidth,
213
+ scroll: this.horizontalScroll.scrollLeft,
214
+ },
215
+ };
216
+ each(els, (item, dimension) => {
217
+ var _a;
218
+ this.resizeViewport.emit({ dimension, size: item.size });
219
+ (_a = this.scrollService) === null || _a === void 0 ? void 0 : _a.scroll(item.scroll, dimension, true);
220
+ // track scroll visibility on outer element change
221
+ this.setScrollVisibility(dimension, item.size, item.contentSize);
222
+ });
223
+ },
224
+ });
225
+ }
226
+ /**
227
+ * Check if scroll present or not per type
228
+ * Trigger this method on inner content size change or on outer element size change
229
+ * If inner content bigger then outer size then scroll is present and mousewheel binding required
230
+ * @param type - dimension type 'rgRow/y' or 'rgCol/x'
231
+ * @param size - outer content size
232
+ * @param innerContentSize - inner content size
233
+ */
234
+ setScrollVisibility(type, size, innerContentSize) {
235
+ // test if scroll present
236
+ const hasScroll = size < innerContentSize;
237
+ let el;
238
+ // event reference for binding
239
+ let event;
240
+ switch (type) {
241
+ case 'rgCol':
242
+ el = this.horizontalScroll;
243
+ event = this.horizontalMouseWheel;
244
+ break;
245
+ case 'rgRow':
246
+ el = this.verticalScroll;
247
+ event = this.verticalMouseWheel;
248
+ break;
249
+ }
250
+ // based on scroll visibility assign or remove class and event
251
+ if (hasScroll) {
252
+ el.classList.add(`scroll-${type}`);
253
+ el.addEventListener('mousewheel', event);
254
+ }
255
+ else {
256
+ el.classList.remove(`scroll-${type}`);
257
+ el.removeEventListener('mousewheel', event);
258
+ }
259
+ this.scrollchange.emit({ type, hasScroll });
260
+ }
261
+ disconnectedCallback() {
262
+ this.verticalScroll.removeEventListener('mousewheel', this.verticalMouseWheel);
263
+ this.horizontalScroll.removeEventListener('mousewheel', this.horizontalMouseWheel);
264
+ this.horisontalResize.destroy();
265
+ }
266
+ async componentDidRender() {
267
+ // scroll update if number of rows changed
268
+ if (this.contentHeight < this.oldValY && this.verticalScroll) {
269
+ this.verticalScroll.scrollTop += this.contentHeight - this.oldValY;
270
+ }
271
+ this.oldValY = this.contentHeight;
272
+ // scroll update if number of cols changed
273
+ if (this.contentWidth < this.oldValX) {
274
+ this.horizontalScroll.scrollLeft += this.contentWidth - this.oldValX;
275
+ }
276
+ this.oldValX = this.contentWidth;
277
+ this.scrollService.setParams({
278
+ contentSize: this.contentHeight,
279
+ clientSize: this.verticalScroll.clientHeight,
280
+ virtualSize: 0,
281
+ }, 'rgRow');
282
+ this.scrollService.setParams({
283
+ contentSize: this.contentWidth,
284
+ clientSize: this.horizontalScroll.clientWidth,
285
+ virtualSize: 0,
286
+ }, 'rgCol');
287
+ this.setScrollVisibility('rgRow', this.verticalScroll.clientHeight, this.contentHeight);
288
+ this.setScrollVisibility('rgCol', this.horizontalScroll.clientWidth, this.contentWidth);
289
+ }
290
+ render() {
291
+ return (h(Host, { onScroll: (e) => this.onScroll('rgCol', e) }, h("div", { class: "inner-content-table", style: { width: `${this.contentWidth}px` } }, h("div", { class: "header-wrapper", ref: e => (this.header = e) }, h("slot", { name: HEADER_SLOT })), h("div", { class: "vertical-inner", ref: el => (this.verticalScroll = el), onScroll: (e) => this.onScroll('rgRow', e) }, h("div", { class: "content-wrapper", style: { height: `${this.contentHeight}px` } }, h("slot", { name: CONTENT_SLOT }))), h("div", { class: "footer-wrapper", ref: e => (this.footer = e) }, h("slot", { name: FOOTER_SLOT })))));
292
+ }
293
+ /**
294
+ * Extra layer for scroll event monitoring, where MouseWheel event is not passing
295
+ * We need to trigger scroll event in case there is no mousewheel event
296
+ */
297
+ onScroll(dimension, e) {
298
+ var _a;
299
+ const target = e.target;
300
+ let scroll = 0;
301
+ switch (dimension) {
302
+ case 'rgCol':
303
+ scroll = target === null || target === void 0 ? void 0 : target.scrollLeft;
304
+ break;
305
+ case 'rgRow':
306
+ scroll = target === null || target === void 0 ? void 0 : target.scrollTop;
307
+ break;
308
+ }
309
+ const change = new Date().getTime() - this.mouseWheelScroll[dimension];
310
+ if (change > this.scrollThrottling) {
311
+ (_a = this.scrollService) === null || _a === void 0 ? void 0 : _a.scroll(scroll, dimension);
312
+ }
313
+ }
314
+ /** remember last mw event time */
315
+ latestScrollUpdate(dimension) {
316
+ this.mouseWheelScroll[dimension] = new Date().getTime();
317
+ }
318
+ /**
319
+ * On vertical mousewheel event
320
+ * @param type
321
+ * @param delta
322
+ * @param e
323
+ */
324
+ onVerticalMouseWheel(type, delta, e) {
325
+ var _a;
326
+ e.preventDefault();
327
+ const pos = this.verticalScroll.scrollTop + e[delta];
328
+ (_a = this.scrollService) === null || _a === void 0 ? void 0 : _a.scroll(pos, type, undefined, e[delta]);
329
+ this.latestScrollUpdate(type);
330
+ }
331
+ /**
332
+ * On horizontal mousewheel event
333
+ * @param type
334
+ * @param delta
335
+ * @param e
336
+ */
337
+ onHorizontalMouseWheel(type, delta, e) {
338
+ var _a;
339
+ e.preventDefault();
340
+ const pos = this.horizontalScroll.scrollLeft + e[delta];
341
+ (_a = this.scrollService) === null || _a === void 0 ? void 0 : _a.scroll(pos, type, undefined, e[delta]);
342
+ this.latestScrollUpdate(type);
343
+ }
344
+ get horizontalScroll() { return this; }
345
+ static get style() { return revogrViewportScrollStyleCss; }
346
+ }, [4, "revogr-viewport-scroll", {
347
+ "contentWidth": [2, "content-width"],
348
+ "contentHeight": [2, "content-height"],
349
+ "setScroll": [64],
350
+ "changeScroll": [64]
351
+ }]);
352
+ function defineCustomElement() {
353
+ if (typeof customElements === "undefined") {
354
+ return;
355
+ }
356
+ const components = ["revogr-viewport-scroll"];
357
+ components.forEach(tagName => { switch (tagName) {
358
+ case "revogr-viewport-scroll":
359
+ if (!customElements.get(tagName)) {
360
+ customElements.define(tagName, RevogrViewportScroll);
361
+ }
362
+ break;
363
+ } });
364
+ }
365
+ defineCustomElement();
366
+
367
+ export { CONTENT_SLOT as C, DATA_SLOT as D, FOOTER_SLOT as F, HEADER_SLOT as H, RevogrViewportScroll as R, defineCustomElement as d, getLastCell as g };
@@ -0,0 +1,106 @@
1
+ /*!
2
+ * Built by Revolist
3
+ */
4
+ import { a as getItemByPosition, g as getItemByIndex } from './dimension.helpers.js';
5
+
6
+ /** Calculate cell based on x, y position */
7
+ function getCurrentCell({ x, y }, { el, rows, cols }) {
8
+ const { top, left, height, width } = el.getBoundingClientRect();
9
+ let cellY = y - top;
10
+ // limit to element height
11
+ if (cellY >= height) {
12
+ cellY = height - 1;
13
+ }
14
+ let cellX = x - left;
15
+ // limit to element width
16
+ if (cellX >= width) {
17
+ cellX = width - 1;
18
+ }
19
+ const rgRow = getItemByPosition(rows, cellY);
20
+ const rgCol = getItemByPosition(cols, cellX);
21
+ // before first
22
+ if (rgCol.itemIndex < 0) {
23
+ rgCol.itemIndex = 0;
24
+ }
25
+ // before first
26
+ if (rgRow.itemIndex < 0) {
27
+ rgRow.itemIndex = 0;
28
+ }
29
+ return { x: rgCol.itemIndex, y: rgRow.itemIndex };
30
+ }
31
+ function getCoordinate(range, focus, changes, isMulti = false) {
32
+ const updateCoordinate = (c) => {
33
+ const start = { x: range.x, y: range.y };
34
+ const end = isMulti ? { x: range.x1, y: range.y1 } : start;
35
+ const point = end[c] > focus[c] ? end : start;
36
+ point[c] += changes[c];
37
+ return { start, end };
38
+ };
39
+ if (changes.x) {
40
+ return updateCoordinate('x');
41
+ }
42
+ if (changes.y) {
43
+ return updateCoordinate('y');
44
+ }
45
+ return null;
46
+ }
47
+ /** check if out of range */
48
+ function isAfterLast({ x, y }, { lastCell }) {
49
+ return x >= lastCell.x || y >= lastCell.y;
50
+ }
51
+ /** check if out of range */
52
+ function isBeforeFirst({ x, y }) {
53
+ return x < 0 || y < 0;
54
+ }
55
+ /** Compare cells, only 1 coordinate difference is possible */
56
+ function getDirectionCoordinate(initial, last) {
57
+ const c = ['x', 'y'];
58
+ for (let k of c) {
59
+ if (initial[k] !== last[k]) {
60
+ return { [k]: 1 };
61
+ }
62
+ }
63
+ return null;
64
+ }
65
+ function getLargestAxis(initial, last) {
66
+ const cell = {};
67
+ const c = ['x', 'y'];
68
+ for (let k of c) {
69
+ cell[k] = Math.abs(initial[k] - last[k]);
70
+ }
71
+ if (cell.x > cell.y) {
72
+ return { x: 1 };
73
+ }
74
+ if (cell.y > cell.x) {
75
+ return { y: 1 };
76
+ }
77
+ return null;
78
+ }
79
+ function styleByCellProps(styles) {
80
+ return {
81
+ left: `${styles.left}px`,
82
+ top: `${styles.top}px`,
83
+ width: `${styles.width}px`,
84
+ height: `${styles.height}px`,
85
+ };
86
+ }
87
+ function getCell({ x, y, x1, y1 }, dimensionRow, dimensionCol) {
88
+ const top = getItemByIndex(dimensionRow, y).start;
89
+ const left = getItemByIndex(dimensionCol, x).start;
90
+ const bottom = getItemByIndex(dimensionRow, y1).end;
91
+ const right = getItemByIndex(dimensionCol, x1).end;
92
+ return {
93
+ left,
94
+ right,
95
+ top,
96
+ bottom,
97
+ width: right - left,
98
+ height: bottom - top,
99
+ };
100
+ }
101
+ function getElStyle(range, dimensionRow, dimensionCol) {
102
+ const styles = getCell(range, dimensionRow, dimensionCol);
103
+ return styleByCellProps(styles);
104
+ }
105
+
106
+ export { getCoordinate as a, isBeforeFirst as b, getCell as c, getCurrentCell as d, getDirectionCoordinate as e, getLargestAxis as f, getElStyle as g, isAfterLast as i };
@@ -0,0 +1,107 @@
1
+ /*!
2
+ * Built by Revolist
3
+ */
4
+ import { t as toNumber_1 } from './toNumber.js';
5
+
6
+ /**
7
+ * The base implementation of `_.findIndex` and `_.findLastIndex` without
8
+ * support for iteratee shorthands.
9
+ *
10
+ * @private
11
+ * @param {Array} array The array to inspect.
12
+ * @param {Function} predicate The function invoked per iteration.
13
+ * @param {number} fromIndex The index to search from.
14
+ * @param {boolean} [fromRight] Specify iterating from right to left.
15
+ * @returns {number} Returns the index of the matched value, else `-1`.
16
+ */
17
+ function baseFindIndex(array, predicate, fromIndex, fromRight) {
18
+ var length = array.length,
19
+ index = fromIndex + (fromRight ? 1 : -1);
20
+
21
+ while ((fromRight ? index-- : ++index < length)) {
22
+ if (predicate(array[index], index, array)) {
23
+ return index;
24
+ }
25
+ }
26
+ return -1;
27
+ }
28
+
29
+ var _baseFindIndex = baseFindIndex;
30
+
31
+ /** Used as references for various `Number` constants. */
32
+ var INFINITY = 1 / 0,
33
+ MAX_INTEGER = 1.7976931348623157e+308;
34
+
35
+ /**
36
+ * Converts `value` to a finite number.
37
+ *
38
+ * @static
39
+ * @memberOf _
40
+ * @since 4.12.0
41
+ * @category Lang
42
+ * @param {*} value The value to convert.
43
+ * @returns {number} Returns the converted number.
44
+ * @example
45
+ *
46
+ * _.toFinite(3.2);
47
+ * // => 3.2
48
+ *
49
+ * _.toFinite(Number.MIN_VALUE);
50
+ * // => 5e-324
51
+ *
52
+ * _.toFinite(Infinity);
53
+ * // => 1.7976931348623157e+308
54
+ *
55
+ * _.toFinite('3.2');
56
+ * // => 3.2
57
+ */
58
+ function toFinite(value) {
59
+ if (!value) {
60
+ return value === 0 ? value : 0;
61
+ }
62
+ value = toNumber_1(value);
63
+ if (value === INFINITY || value === -INFINITY) {
64
+ var sign = (value < 0 ? -1 : 1);
65
+ return sign * MAX_INTEGER;
66
+ }
67
+ return value === value ? value : 0;
68
+ }
69
+
70
+ var toFinite_1 = toFinite;
71
+
72
+ /**
73
+ * Converts `value` to an integer.
74
+ *
75
+ * **Note:** This method is loosely based on
76
+ * [`ToInteger`](http://www.ecma-international.org/ecma-262/7.0/#sec-tointeger).
77
+ *
78
+ * @static
79
+ * @memberOf _
80
+ * @since 4.0.0
81
+ * @category Lang
82
+ * @param {*} value The value to convert.
83
+ * @returns {number} Returns the converted integer.
84
+ * @example
85
+ *
86
+ * _.toInteger(3.2);
87
+ * // => 3
88
+ *
89
+ * _.toInteger(Number.MIN_VALUE);
90
+ * // => 0
91
+ *
92
+ * _.toInteger(Infinity);
93
+ * // => 1.7976931348623157e+308
94
+ *
95
+ * _.toInteger('3.2');
96
+ * // => 3
97
+ */
98
+ function toInteger(value) {
99
+ var result = toFinite_1(value),
100
+ remainder = result % 1;
101
+
102
+ return result === result ? (remainder ? result - remainder : result) : 0;
103
+ }
104
+
105
+ var toInteger_1 = toInteger;
106
+
107
+ export { _baseFindIndex as _, toFinite_1 as a, toInteger_1 as t };