@revolist/revogrid 3.6.8 → 3.6.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/custom-element/revo-grid.js +1 -0
- package/custom-element/revo-grid.js.map +1 -1
- package/custom-element/revogr-clipboard.js +1 -0
- package/custom-element/revogr-clipboard.js.map +1 -1
- package/custom-element/revogr-data2.js +1 -0
- package/custom-element/revogr-data2.js.map +1 -1
- package/custom-element/revogr-edit2.js +1 -0
- package/custom-element/revogr-edit2.js.map +1 -1
- package/custom-element/revogr-filter-panel.js +1 -0
- package/custom-element/revogr-filter-panel.js.map +1 -1
- package/custom-element/revogr-focus2.js +1 -0
- package/custom-element/revogr-focus2.js.map +1 -1
- package/custom-element/revogr-header2.js +1 -0
- package/custom-element/revogr-header2.js.map +1 -1
- package/custom-element/revogr-order-editor2.js +1 -0
- package/custom-element/revogr-order-editor2.js.map +1 -1
- package/custom-element/revogr-overlay-selection2.js +1 -0
- package/custom-element/revogr-overlay-selection2.js.map +1 -1
- package/custom-element/revogr-row-headers2.js +1 -0
- package/custom-element/revogr-row-headers2.js.map +1 -1
- package/custom-element/revogr-scroll-virtual2.js +1 -0
- package/custom-element/revogr-scroll-virtual2.js.map +1 -1
- package/custom-element/revogr-temp-range2.js +1 -0
- package/custom-element/revogr-temp-range2.js.map +1 -1
- package/custom-element/revogr-viewport-scroll2.js +1 -0
- package/custom-element/revogr-viewport-scroll2.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"file":"revogr-viewport-scroll2.js","mappings":";;;;;;;;;MAIa,WAAW,GAAG,SAAS;MACvB,WAAW,GAAG,SAAS;MACvB,YAAY,GAAG,UAAU;MACzB,SAAS,GAAG,OAAO;AAEhC;SACgB,WAAW,CAAC,IAAoB,EAAE,OAAoC;EACpF,OAAO;IACL,CAAC,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,KAAK,CAAC,G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M,GAAG,GAAG,IAAI,CAAC,cAAc,CAAC,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC;IACrD,MAAA,IAAI,CAAC,aAAa,0CAAE,MAAM,CAAC,GAAG,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;IAC3D,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,CAAC;GAC/B;;;;;;;EAQO,sBAAsB,CAAC,IAA4B,EAAE,KAA0B,EAAE,CAAa;;IACpG,CAAC,CAAC,cAAc,EAAE,CAAC;IACnB,MAAM,GAAG,GAAG,IAAI,CAAC,gBAAgB,CAAC,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC;IACxD,MAAA,IAAI,CAAC,aAAa,0CAAE,MAAM,CAAC,GAAG,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;IAC3D,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,CAAC;GAC/B;;;;;;;;;;;;;;;;;;;;;;;;;","names":["isObject","debounce","throttle"],"sources":["src/components/revo-grid/viewport.helpers.ts","node_modules/lodash/throttle.js","src/utils/resizeObserver.ts","src/components/revo-grid/viewport.resize.service.ts","src/components/scroll/revogr-viewport-scroll-style.scss?tag=revogr-viewport-scroll","src/components/scroll/revogr-viewport-scroll.tsx"],"sourcesContent":["/** Collect data for pinned columns in required @ViewportProps format */\nimport { RevoGrid, Selection } from '../../interfaces';\nimport { ViewportColumn } from './viewport.interfaces';\n\nexport const HEADER_SLOT = 'header';\nexport const FOOTER_SLOT = 'footer';\nexport const CONTENT_SLOT = 'content';\nexport const DATA_SLOT = 'data';\n\n/** Receive last visible in viewport by required type */\nexport function getLastCell(data: ViewportColumn, rowType: RevoGrid.MultiDimensionType): Selection.Cell {\n return {\n x: data.viewports[data.colType].store.get('realCount'),\n y: data.viewports[rowType].store.get('realCount'),\n };\n}\n","var debounce = require('./debounce'),\n isObject = require('./isObject');\n\n/** Error message constants. */\nvar FUNC_ERROR_TEXT = 'Expected a function';\n\n/**\n * Creates a throttled function that only invokes `func` at most once per\n * every `wait` milliseconds. The throttled function comes with a `cancel`\n * method to cancel delayed `func` invocations and a `flush` method to\n * immediately invoke them. Provide `options` to indicate whether `func`\n * should be invoked on the leading and/or trailing edge of the `wait`\n * timeout. The `func` is invoked with the last arguments provided to the\n * throttled function. Subsequent calls to the throttled function return the\n * result of the last `func` invocation.\n *\n * **Note:** If `leading` and `trailing` options are `true`, `func` is\n * invoked on the trailing edge of the timeout only if the throttled function\n * is invoked more than once during the `wait` timeout.\n *\n * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred\n * until to the next tick, similar to `setTimeout` with a timeout of `0`.\n *\n * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)\n * for details over the differences between `_.throttle` and `_.debounce`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Function\n * @param {Function} func The function to throttle.\n * @param {number} [wait=0] The number of milliseconds to throttle invocations to.\n * @param {Object} [options={}] The options object.\n * @param {boolean} [options.leading=true]\n * Specify invoking on the leading edge of the timeout.\n * @param {boolean} [options.trailing=true]\n * Specify invoking on the trailing edge of the timeout.\n * @returns {Function} Returns the new throttled function.\n * @example\n *\n * // Avoid excessively updating the position while scrolling.\n * jQuery(window).on('scroll', _.throttle(updatePosition, 100));\n *\n * // Invoke `renewToken` when the click event is fired, but not more than once every 5 minutes.\n * var throttled = _.throttle(renewToken, 300000, { 'trailing': false });\n * jQuery(element).on('click', throttled);\n *\n * // Cancel the trailing throttled invocation.\n * jQuery(window).on('popstate', throttled.cancel);\n */\nfunction throttle(func, wait, options) {\n var leading = true,\n trailing = true;\n\n if (typeof func != 'function') {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n if (isObject(options)) {\n leading = 'leading' in options ? !!options.leading : leading;\n trailing = 'trailing' in options ? !!options.trailing : trailing;\n }\n return debounce(func, wait, {\n 'leading': leading,\n 'maxWait': wait,\n 'trailing': trailing\n });\n}\n\nmodule.exports = throttle;\n","export async function resizeObserver() {\n if (!('ResizeObserver' in window)) {\n const module = await import('@juggle/resize-observer');\n (window as Window & typeof globalThis).ResizeObserver = (module.ResizeObserver as unknown) as typeof ResizeObserver;\n }\n}\n","import throttle from 'lodash/throttle';\nimport { resizeObserver } from '../../utils/resizeObserver';\ninterface Events {\n resize(entries: ReadonlyArray<ResizeObserverEntry>, observer: ResizeObserver): void;\n}\nexport default class GridResizeService {\n private resizeObserver: ResizeObserver | null = null;\n private resize = throttle((e: ReadonlyArray<ResizeObserverEntry>, o: ResizeObserver) => this.events?.resize(e, o), 10);\n constructor(el: HTMLElement, private events: Events) {\n this.init(el);\n }\n\n async init(el: HTMLElement): Promise<void> {\n await resizeObserver();\n this.resizeObserver = new ResizeObserver(this.resize);\n this.resizeObserver?.observe(el);\n }\n\n public destroy(): void {\n this.resizeObserver?.disconnect();\n this.resizeObserver = null;\n }\n}\n","@mixin noScroll {\n /* Hide scrollbar for IE and Edge */\n -ms-overflow-style: none;\n scrollbar-width: none; /* Firefox */\n /* Hide scrollbar for Chrome, Safari and Opera */\n &::-webkit-scrollbar {\n display: none;\n -webkit-appearance: none;\n }\n}\n\n.rowHeaders {\n z-index: 2;\n font-size: 10px;\n display: flex;\n height: 100%;\n\n revogr-data .rgCell {\n text-align: center;\n }\n\n .rgCell {\n padding: 0 1em !important;\n min-width: 100%;\n }\n}\n\nrevogr-viewport-scroll {\n @include noScroll;\n\n overflow-x: auto;\n overflow-y: hidden;\n position: relative;\n z-index: 1;\n height: 100%;\n\n &.colPinStart,\n &.colPinEnd {\n z-index: 2;\n }\n\n &.rgCol {\n flex-grow: 1;\n }\n\n .content-wrapper {\n overflow: hidden;\n }\n\n .inner-content-table {\n display: flex;\n flex-direction: column;\n max-height: 100%;\n width: 100%;\n min-width: 100%;\n position: relative;\n z-index: 0;\n }\n\n .vertical-inner {\n overflow-y: auto;\n position: relative;\n width: 100%;\n flex-grow: 1;\n @include noScroll;\n\n revogr-data,\n revogr-overlay-selection {\n height: 100%;\n }\n }\n}\n","import { Component, Event, EventEmitter, h, Method, Element, Prop, Host } from '@stencil/core';\nimport each from 'lodash/each';\n\nimport GridResizeService from '../revo-grid/viewport.resize.service';\nimport LocalScrollService from '../../services/localScrollService';\nimport { RevoGrid } from '../../interfaces';\nimport { CONTENT_SLOT, FOOTER_SLOT, HEADER_SLOT } from '../revo-grid/viewport.helpers';\n\n/**\n * Service for tracking grid scrolling\n */\n@Component({\n tag: 'revogr-viewport-scroll',\n styleUrl: 'revogr-viewport-scroll-style.scss',\n})\nexport class RevogrViewportScroll {\n @Event({ bubbles: false }) scrollViewport: EventEmitter<RevoGrid.ViewPortScrollEvent>;\n @Event() resizeViewport: EventEmitter<RevoGrid.ViewPortResizeEvent>;\n @Event() scrollchange: EventEmitter<{ type: RevoGrid.DimensionType; hasScroll: boolean; }>;\n private scrollThrottling = 30;\n\n /**\n * Width of inner content\n */\n @Prop() contentWidth = 0;\n /**\n * Height of inner content\n */\n @Prop() contentHeight = 0;\n\n private oldValY = this.contentHeight;\n private oldValX = this.contentWidth;\n\n @Element() horizontalScroll: HTMLElement;\n private verticalScroll: HTMLElement;\n private header: HTMLElement;\n private footer: HTMLElement;\n\n /**\n * Static functions to bind wheel change\n */\n private horizontalMouseWheel: (e: WheelEvent) => void;\n private verticalMouseWheel: (e: WheelEvent) => void;\n\n private horisontalResize: GridResizeService;\n private scrollService: LocalScrollService;\n\n /**\n * Last mw event time for trigger scroll function below\n * If mousewheel function was ignored we still need to trigger render\n */\n private mouseWheelScroll: Record<RevoGrid.DimensionType, number> = { rgCol: 0, rgRow: 0 };\n @Method() async setScroll(e: RevoGrid.ViewPortScrollEvent): Promise<void> {\n this.latestScrollUpdate(e.dimension);\n this.scrollService?.setScroll(e);\n }\n\n /**\n * update on delta in case we don't know existing position or external change\n * @param e\n */\n @Method() async changeScroll(e: RevoGrid.ViewPortScrollEvent): Promise<RevoGrid.ViewPortScrollEvent> {\n if (e.delta) {\n switch (e.dimension) {\n case 'rgCol':\n e.coordinate = this.horizontalScroll.scrollLeft + e.delta;\n break;\n case 'rgRow':\n e.coordinate = this.verticalScroll.scrollTop + e.delta;\n break;\n }\n this.setScroll(e);\n }\n return e;\n }\n\n connectedCallback() {\n /**\n * Bind scroll functions for farther usage\n */\n\n if ('ontouchstart' in document.documentElement) {\n this.scrollThrottling = 0;\n } else {\n this.verticalMouseWheel = this.onVerticalMouseWheel.bind(this, 'rgRow', 'deltaY');\n this.horizontalMouseWheel = this.onHorizontalMouseWheel.bind(this, 'rgCol', 'deltaX');\n }\n /**\n * Create local scroll service\n */\n this.scrollService = new LocalScrollService({\n beforeScroll: e => this.scrollViewport.emit(e),\n afterScroll: e => {\n switch (e.dimension) {\n case 'rgCol':\n this.horizontalScroll.scrollLeft = e.coordinate;\n break;\n case 'rgRow':\n this.verticalScroll.scrollTop = e.coordinate;\n break;\n }\n },\n });\n }\n\n componentDidLoad() {\n /**\n * Track horizontal viewport resize\n */\n this.horisontalResize = new GridResizeService(this.horizontalScroll, {\n resize: entries => {\n let height = entries[0]?.contentRect.height || 0;\n if (height) {\n height -= this.header.clientHeight + this.footer.clientHeight;\n }\n const els = {\n rgRow: {\n size: height,\n contentSize: this.contentHeight,\n scroll: this.verticalScroll.scrollTop,\n },\n rgCol: {\n size: entries[0]?.contentRect.width || 0,\n contentSize: this.contentWidth,\n scroll: this.horizontalScroll.scrollLeft,\n },\n };\n each(els, (item, dimension: RevoGrid.DimensionType) => {\n this.resizeViewport.emit({ dimension, size: item.size });\n this.scrollService?.scroll(item.scroll, dimension, true);\n // track scroll visibility on outer element change\n this.setScrollVisibility(dimension, item.size, item.contentSize);\n });\n },\n });\n }\n\n /**\n * Check if scroll present or not per type\n * Trigger this method on inner content size change or on outer element size change\n * If inner content bigger then outer size then scroll is present and mousewheel binding required\n * @param type - dimension type 'rgRow/y' or 'rgCol/x'\n * @param size - outer content size\n * @param innerContentSize - inner content size\n */\n setScrollVisibility(type: RevoGrid.DimensionType, size: number, innerContentSize: number) {\n // test if scroll present\n const hasScroll = size < innerContentSize;\n let el: HTMLElement;\n // event reference for binding\n let event: (e: MouseEvent) => void;\n switch (type) {\n case 'rgCol':\n el = this.horizontalScroll;\n event = this.horizontalMouseWheel;\n break;\n case 'rgRow':\n el = this.verticalScroll;\n event = this.verticalMouseWheel;\n break;\n }\n // based on scroll visibility assign or remove class and event\n if (hasScroll) {\n el.classList.add(`scroll-${type}`);\n el.addEventListener('mousewheel', event);\n } else {\n el.classList.remove(`scroll-${type}`);\n el.removeEventListener('mousewheel', event);\n }\n this.scrollchange.emit({ type, hasScroll });\n }\n\n disconnectedCallback() {\n this.verticalScroll.removeEventListener('mousewheel', this.verticalMouseWheel);\n this.horizontalScroll.removeEventListener('mousewheel', this.horizontalMouseWheel);\n this.horisontalResize.destroy();\n }\n\n async componentDidRender() {\n // scroll update if number of rows changed\n if (this.contentHeight < this.oldValY && this.verticalScroll) {\n this.verticalScroll.scrollTop += this.contentHeight - this.oldValY;\n }\n this.oldValY = this.contentHeight;\n\n // scroll update if number of cols changed\n if (this.contentWidth < this.oldValX) {\n this.horizontalScroll.scrollLeft += this.contentWidth - this.oldValX;\n }\n this.oldValX = this.contentWidth;\n\n this.scrollService.setParams(\n {\n contentSize: this.contentHeight,\n clientSize: this.verticalScroll.clientHeight,\n virtualSize: 0,\n },\n 'rgRow',\n );\n\n this.scrollService.setParams(\n {\n contentSize: this.contentWidth,\n clientSize: this.horizontalScroll.clientWidth,\n virtualSize: 0,\n },\n 'rgCol',\n );\n this.setScrollVisibility('rgRow', this.verticalScroll.clientHeight, this.contentHeight);\n this.setScrollVisibility('rgCol', this.horizontalScroll.clientWidth, this.contentWidth);\n }\n\n render() {\n return (\n <Host onScroll={(e: MouseEvent) => this.onScroll('rgCol', e)}>\n <div class=\"inner-content-table\" style={{ width: `${this.contentWidth}px` }}>\n <div class=\"header-wrapper\" ref={e => (this.header = e)}>\n <slot name={HEADER_SLOT} />\n </div>\n <div class=\"vertical-inner\" ref={el => (this.verticalScroll = el)} onScroll={(e: MouseEvent) => this.onScroll('rgRow', e)}>\n <div class=\"content-wrapper\" style={{ height: `${this.contentHeight}px` }}>\n <slot name={CONTENT_SLOT} />\n </div>\n </div>\n <div class=\"footer-wrapper\" ref={e => (this.footer = e)}>\n <slot name={FOOTER_SLOT} />\n </div>\n </div>\n </Host>\n );\n }\n\n /**\n * Extra layer for scroll event monitoring, where MouseWheel event is not passing\n * We need to trigger scroll event in case there is no mousewheel event\n */\n private onScroll(dimension: RevoGrid.DimensionType, e: MouseEvent) {\n const target = e.target as HTMLElement | undefined;\n let scroll = 0;\n switch (dimension) {\n case 'rgCol':\n scroll = target?.scrollLeft;\n break;\n case 'rgRow':\n scroll = target?.scrollTop;\n break;\n }\n const change = new Date().getTime() - this.mouseWheelScroll[dimension];\n if (change > this.scrollThrottling) {\n this.scrollService?.scroll(scroll, dimension);\n }\n }\n\n /** remember last mw event time */\n private latestScrollUpdate(dimension: RevoGrid.DimensionType) {\n this.mouseWheelScroll[dimension] = new Date().getTime();\n }\n\n /**\n * On vertical mousewheel event\n * @param type\n * @param delta\n * @param e\n */\n private onVerticalMouseWheel(type: RevoGrid.DimensionType, delta: 'deltaX' | 'deltaY', e: WheelEvent) {\n e.preventDefault();\n const pos = this.verticalScroll.scrollTop + e[delta];\n this.scrollService?.scroll(pos, type, undefined, e[delta]);\n this.latestScrollUpdate(type);\n }\n\n /**\n * On horizontal mousewheel event\n * @param type\n * @param delta\n * @param e\n */\n private onHorizontalMouseWheel(type: RevoGrid.DimensionType, delta: 'deltaX' | 'deltaY', e: WheelEvent) {\n e.preventDefault();\n const pos = this.horizontalScroll.scrollLeft + e[delta];\n this.scrollService?.scroll(pos, type, undefined, e[delta]);\n this.latestScrollUpdate(type);\n }\n}\n"],"version":3}
|
|
1
|
+
{"file":"revogr-viewport-scroll2.js","mappings":";;;;;;;;;MAIa,WAAW,GAAG,SAAS;MACvB,WAAW,GAAG,SAAS;MACvB,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AgB,CAAC,SAAS,CAAC,GAAG,IAAI,IAAI,EAAE,CAAC,OAAO,EAAE,CAAC;GACzD;;;;;;;EAQO,oBAAoB,CAAC,IAA4B,EAAE,KAA0B,EAAE,CAAa;;IAClG,CAAC,CAAC,cAAc,EAAE,CAAC;IACnB,MAAM,GAAG,GAAG,IAAI,CAAC,cAAc,CAAC,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC;IACrD,MAAA,IAAI,CAAC,aAAa,0CAAE,MAAM,CAAC,GAAG,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;IAC3D,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,CAAC;GAC/B;;;;;;;EAQO,sBAAsB,CAAC,IAA4B,EAAE,KAA0B,EAAE,CAAa;;IACpG,CAAC,CAAC,cAAc,EAAE,CAAC;IACnB,MAAM,GAAG,GAAG,IAAI,CAAC,gBAAgB,CAAC,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC;IACxD,MAAA,IAAI,CAAC,aAAa,0CAAE,MAAM,CAAC,GAAG,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;IAC3D,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,CAAC;GAC/B;;;;;;;;;;;;;;;;;;;;;;;;;;","names":["isObject","debounce","throttle"],"sources":["src/components/revo-grid/viewport.helpers.ts","node_modules/lodash/throttle.js","src/utils/resizeObserver.ts","src/components/revo-grid/viewport.resize.service.ts","src/components/scroll/revogr-viewport-scroll-style.scss?tag=revogr-viewport-scroll","src/components/scroll/revogr-viewport-scroll.tsx"],"sourcesContent":["/** Collect data for pinned columns in required @ViewportProps format */\nimport { RevoGrid, Selection } from '../../interfaces';\nimport { ViewportColumn } from './viewport.interfaces';\n\nexport const HEADER_SLOT = 'header';\nexport const FOOTER_SLOT = 'footer';\nexport const CONTENT_SLOT = 'content';\nexport const DATA_SLOT = 'data';\n\n/** Receive last visible in viewport by required type */\nexport function getLastCell(data: ViewportColumn, rowType: RevoGrid.MultiDimensionType): Selection.Cell {\n return {\n x: data.viewports[data.colType].store.get('realCount'),\n y: data.viewports[rowType].store.get('realCount'),\n };\n}\n","var debounce = require('./debounce'),\n isObject = require('./isObject');\n\n/** Error message constants. */\nvar FUNC_ERROR_TEXT = 'Expected a function';\n\n/**\n * Creates a throttled function that only invokes `func` at most once per\n * every `wait` milliseconds. The throttled function comes with a `cancel`\n * method to cancel delayed `func` invocations and a `flush` method to\n * immediately invoke them. Provide `options` to indicate whether `func`\n * should be invoked on the leading and/or trailing edge of the `wait`\n * timeout. The `func` is invoked with the last arguments provided to the\n * throttled function. Subsequent calls to the throttled function return the\n * result of the last `func` invocation.\n *\n * **Note:** If `leading` and `trailing` options are `true`, `func` is\n * invoked on the trailing edge of the timeout only if the throttled function\n * is invoked more than once during the `wait` timeout.\n *\n * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred\n * until to the next tick, similar to `setTimeout` with a timeout of `0`.\n *\n * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)\n * for details over the differences between `_.throttle` and `_.debounce`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Function\n * @param {Function} func The function to throttle.\n * @param {number} [wait=0] The number of milliseconds to throttle invocations to.\n * @param {Object} [options={}] The options object.\n * @param {boolean} [options.leading=true]\n * Specify invoking on the leading edge of the timeout.\n * @param {boolean} [options.trailing=true]\n * Specify invoking on the trailing edge of the timeout.\n * @returns {Function} Returns the new throttled function.\n * @example\n *\n * // Avoid excessively updating the position while scrolling.\n * jQuery(window).on('scroll', _.throttle(updatePosition, 100));\n *\n * // Invoke `renewToken` when the click event is fired, but not more than once every 5 minutes.\n * var throttled = _.throttle(renewToken, 300000, { 'trailing': false });\n * jQuery(element).on('click', throttled);\n *\n * // Cancel the trailing throttled invocation.\n * jQuery(window).on('popstate', throttled.cancel);\n */\nfunction throttle(func, wait, options) {\n var leading = true,\n trailing = true;\n\n if (typeof func != 'function') {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n if (isObject(options)) {\n leading = 'leading' in options ? !!options.leading : leading;\n trailing = 'trailing' in options ? !!options.trailing : trailing;\n }\n return debounce(func, wait, {\n 'leading': leading,\n 'maxWait': wait,\n 'trailing': trailing\n });\n}\n\nmodule.exports = throttle;\n","export async function resizeObserver() {\n if (!('ResizeObserver' in window)) {\n const module = await import('@juggle/resize-observer');\n (window as Window & typeof globalThis).ResizeObserver = (module.ResizeObserver as unknown) as typeof ResizeObserver;\n }\n}\n","import throttle from 'lodash/throttle';\nimport { resizeObserver } from '../../utils/resizeObserver';\ninterface Events {\n resize(entries: ReadonlyArray<ResizeObserverEntry>, observer: ResizeObserver): void;\n}\nexport default class GridResizeService {\n private resizeObserver: ResizeObserver | null = null;\n private resize = throttle((e: ReadonlyArray<ResizeObserverEntry>, o: ResizeObserver) => this.events?.resize(e, o), 10);\n constructor(el: HTMLElement, private events: Events) {\n this.init(el);\n }\n\n async init(el: HTMLElement): Promise<void> {\n await resizeObserver();\n this.resizeObserver = new ResizeObserver(this.resize);\n this.resizeObserver?.observe(el);\n }\n\n public destroy(): void {\n this.resizeObserver?.disconnect();\n this.resizeObserver = null;\n }\n}\n","@mixin noScroll {\n /* Hide scrollbar for IE and Edge */\n -ms-overflow-style: none;\n scrollbar-width: none; /* Firefox */\n /* Hide scrollbar for Chrome, Safari and Opera */\n &::-webkit-scrollbar {\n display: none;\n -webkit-appearance: none;\n }\n}\n\n.rowHeaders {\n z-index: 2;\n font-size: 10px;\n display: flex;\n height: 100%;\n\n revogr-data .rgCell {\n text-align: center;\n }\n\n .rgCell {\n padding: 0 1em !important;\n min-width: 100%;\n }\n}\n\nrevogr-viewport-scroll {\n @include noScroll;\n\n overflow-x: auto;\n overflow-y: hidden;\n position: relative;\n z-index: 1;\n height: 100%;\n\n &.colPinStart,\n &.colPinEnd {\n z-index: 2;\n }\n\n &.rgCol {\n flex-grow: 1;\n }\n\n .content-wrapper {\n overflow: hidden;\n }\n\n .inner-content-table {\n display: flex;\n flex-direction: column;\n max-height: 100%;\n width: 100%;\n min-width: 100%;\n position: relative;\n z-index: 0;\n }\n\n .vertical-inner {\n overflow-y: auto;\n position: relative;\n width: 100%;\n flex-grow: 1;\n @include noScroll;\n\n revogr-data,\n revogr-overlay-selection {\n height: 100%;\n }\n }\n}\n","import { Component, Event, EventEmitter, h, Method, Element, Prop, Host } from '@stencil/core';\nimport each from 'lodash/each';\n\nimport GridResizeService from '../revo-grid/viewport.resize.service';\nimport LocalScrollService from '../../services/localScrollService';\nimport { RevoGrid } from '../../interfaces';\nimport { CONTENT_SLOT, FOOTER_SLOT, HEADER_SLOT } from '../revo-grid/viewport.helpers';\n\n/**\n * Service for tracking grid scrolling\n */\n@Component({\n tag: 'revogr-viewport-scroll',\n styleUrl: 'revogr-viewport-scroll-style.scss',\n})\nexport class RevogrViewportScroll {\n @Event({ bubbles: false }) scrollViewport: EventEmitter<RevoGrid.ViewPortScrollEvent>;\n @Event() resizeViewport: EventEmitter<RevoGrid.ViewPortResizeEvent>;\n @Event() scrollchange: EventEmitter<{ type: RevoGrid.DimensionType; hasScroll: boolean; }>;\n private scrollThrottling = 30;\n\n /**\n * Width of inner content\n */\n @Prop() contentWidth = 0;\n /**\n * Height of inner content\n */\n @Prop() contentHeight = 0;\n\n private oldValY = this.contentHeight;\n private oldValX = this.contentWidth;\n\n @Element() horizontalScroll: HTMLElement;\n private verticalScroll: HTMLElement;\n private header: HTMLElement;\n private footer: HTMLElement;\n\n /**\n * Static functions to bind wheel change\n */\n private horizontalMouseWheel: (e: WheelEvent) => void;\n private verticalMouseWheel: (e: WheelEvent) => void;\n\n private horisontalResize: GridResizeService;\n private scrollService: LocalScrollService;\n\n /**\n * Last mw event time for trigger scroll function below\n * If mousewheel function was ignored we still need to trigger render\n */\n private mouseWheelScroll: Record<RevoGrid.DimensionType, number> = { rgCol: 0, rgRow: 0 };\n @Method() async setScroll(e: RevoGrid.ViewPortScrollEvent): Promise<void> {\n this.latestScrollUpdate(e.dimension);\n this.scrollService?.setScroll(e);\n }\n\n /**\n * update on delta in case we don't know existing position or external change\n * @param e\n */\n @Method() async changeScroll(e: RevoGrid.ViewPortScrollEvent): Promise<RevoGrid.ViewPortScrollEvent> {\n if (e.delta) {\n switch (e.dimension) {\n case 'rgCol':\n e.coordinate = this.horizontalScroll.scrollLeft + e.delta;\n break;\n case 'rgRow':\n e.coordinate = this.verticalScroll.scrollTop + e.delta;\n break;\n }\n this.setScroll(e);\n }\n return e;\n }\n\n connectedCallback() {\n /**\n * Bind scroll functions for farther usage\n */\n\n if ('ontouchstart' in document.documentElement) {\n this.scrollThrottling = 0;\n } else {\n this.verticalMouseWheel = this.onVerticalMouseWheel.bind(this, 'rgRow', 'deltaY');\n this.horizontalMouseWheel = this.onHorizontalMouseWheel.bind(this, 'rgCol', 'deltaX');\n }\n /**\n * Create local scroll service\n */\n this.scrollService = new LocalScrollService({\n beforeScroll: e => this.scrollViewport.emit(e),\n afterScroll: e => {\n switch (e.dimension) {\n case 'rgCol':\n this.horizontalScroll.scrollLeft = e.coordinate;\n break;\n case 'rgRow':\n this.verticalScroll.scrollTop = e.coordinate;\n break;\n }\n },\n });\n }\n\n componentDidLoad() {\n /**\n * Track horizontal viewport resize\n */\n this.horisontalResize = new GridResizeService(this.horizontalScroll, {\n resize: entries => {\n let height = entries[0]?.contentRect.height || 0;\n if (height) {\n height -= this.header.clientHeight + this.footer.clientHeight;\n }\n const els = {\n rgRow: {\n size: height,\n contentSize: this.contentHeight,\n scroll: this.verticalScroll.scrollTop,\n },\n rgCol: {\n size: entries[0]?.contentRect.width || 0,\n contentSize: this.contentWidth,\n scroll: this.horizontalScroll.scrollLeft,\n },\n };\n each(els, (item, dimension: RevoGrid.DimensionType) => {\n this.resizeViewport.emit({ dimension, size: item.size });\n this.scrollService?.scroll(item.scroll, dimension, true);\n // track scroll visibility on outer element change\n this.setScrollVisibility(dimension, item.size, item.contentSize);\n });\n },\n });\n }\n\n /**\n * Check if scroll present or not per type\n * Trigger this method on inner content size change or on outer element size change\n * If inner content bigger then outer size then scroll is present and mousewheel binding required\n * @param type - dimension type 'rgRow/y' or 'rgCol/x'\n * @param size - outer content size\n * @param innerContentSize - inner content size\n */\n setScrollVisibility(type: RevoGrid.DimensionType, size: number, innerContentSize: number) {\n // test if scroll present\n const hasScroll = size < innerContentSize;\n let el: HTMLElement;\n // event reference for binding\n let event: (e: MouseEvent) => void;\n switch (type) {\n case 'rgCol':\n el = this.horizontalScroll;\n event = this.horizontalMouseWheel;\n break;\n case 'rgRow':\n el = this.verticalScroll;\n event = this.verticalMouseWheel;\n break;\n }\n // based on scroll visibility assign or remove class and event\n if (hasScroll) {\n el.classList.add(`scroll-${type}`);\n el.addEventListener('mousewheel', event);\n } else {\n el.classList.remove(`scroll-${type}`);\n el.removeEventListener('mousewheel', event);\n }\n this.scrollchange.emit({ type, hasScroll });\n }\n\n disconnectedCallback() {\n this.verticalScroll.removeEventListener('mousewheel', this.verticalMouseWheel);\n this.horizontalScroll.removeEventListener('mousewheel', this.horizontalMouseWheel);\n this.horisontalResize.destroy();\n }\n\n async componentDidRender() {\n // scroll update if number of rows changed\n if (this.contentHeight < this.oldValY && this.verticalScroll) {\n this.verticalScroll.scrollTop += this.contentHeight - this.oldValY;\n }\n this.oldValY = this.contentHeight;\n\n // scroll update if number of cols changed\n if (this.contentWidth < this.oldValX) {\n this.horizontalScroll.scrollLeft += this.contentWidth - this.oldValX;\n }\n this.oldValX = this.contentWidth;\n\n this.scrollService.setParams(\n {\n contentSize: this.contentHeight,\n clientSize: this.verticalScroll.clientHeight,\n virtualSize: 0,\n },\n 'rgRow',\n );\n\n this.scrollService.setParams(\n {\n contentSize: this.contentWidth,\n clientSize: this.horizontalScroll.clientWidth,\n virtualSize: 0,\n },\n 'rgCol',\n );\n this.setScrollVisibility('rgRow', this.verticalScroll.clientHeight, this.contentHeight);\n this.setScrollVisibility('rgCol', this.horizontalScroll.clientWidth, this.contentWidth);\n }\n\n render() {\n return (\n <Host onScroll={(e: MouseEvent) => this.onScroll('rgCol', e)}>\n <div class=\"inner-content-table\" style={{ width: `${this.contentWidth}px` }}>\n <div class=\"header-wrapper\" ref={e => (this.header = e)}>\n <slot name={HEADER_SLOT} />\n </div>\n <div class=\"vertical-inner\" ref={el => (this.verticalScroll = el)} onScroll={(e: MouseEvent) => this.onScroll('rgRow', e)}>\n <div class=\"content-wrapper\" style={{ height: `${this.contentHeight}px` }}>\n <slot name={CONTENT_SLOT} />\n </div>\n </div>\n <div class=\"footer-wrapper\" ref={e => (this.footer = e)}>\n <slot name={FOOTER_SLOT} />\n </div>\n </div>\n </Host>\n );\n }\n\n /**\n * Extra layer for scroll event monitoring, where MouseWheel event is not passing\n * We need to trigger scroll event in case there is no mousewheel event\n */\n private onScroll(dimension: RevoGrid.DimensionType, e: MouseEvent) {\n const target = e.target as HTMLElement | undefined;\n let scroll = 0;\n switch (dimension) {\n case 'rgCol':\n scroll = target?.scrollLeft;\n break;\n case 'rgRow':\n scroll = target?.scrollTop;\n break;\n }\n const change = new Date().getTime() - this.mouseWheelScroll[dimension];\n if (change > this.scrollThrottling) {\n this.scrollService?.scroll(scroll, dimension);\n }\n }\n\n /** remember last mw event time */\n private latestScrollUpdate(dimension: RevoGrid.DimensionType) {\n this.mouseWheelScroll[dimension] = new Date().getTime();\n }\n\n /**\n * On vertical mousewheel event\n * @param type\n * @param delta\n * @param e\n */\n private onVerticalMouseWheel(type: RevoGrid.DimensionType, delta: 'deltaX' | 'deltaY', e: WheelEvent) {\n e.preventDefault();\n const pos = this.verticalScroll.scrollTop + e[delta];\n this.scrollService?.scroll(pos, type, undefined, e[delta]);\n this.latestScrollUpdate(type);\n }\n\n /**\n * On horizontal mousewheel event\n * @param type\n * @param delta\n * @param e\n */\n private onHorizontalMouseWheel(type: RevoGrid.DimensionType, delta: 'deltaX' | 'deltaY', e: WheelEvent) {\n e.preventDefault();\n const pos = this.horizontalScroll.scrollLeft + e[delta];\n this.scrollService?.scroll(pos, type, undefined, e[delta]);\n this.latestScrollUpdate(type);\n }\n}\n"],"version":3}
|