@revolist/revogrid 4.12.4 → 4.12.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/revogr-attribution_7.cjs.entry.js +23 -8
- package/dist/cjs/revogr-attribution_7.cjs.entry.js.map +1 -1
- package/dist/cjs/revogr-data_4.cjs.entry.js +58 -36
- package/dist/cjs/revogr-data_4.cjs.entry.js.map +1 -1
- package/dist/cjs/revogr-filter-panel.cjs.entry.js.map +1 -1
- package/dist/cjs/{throttle-08957661.js → throttle-5674040a.js} +4 -1
- package/dist/cjs/throttle-5674040a.js.map +1 -0
- package/dist/collection/components/overlay/revogr-overlay-selection.js +2 -2
- package/dist/collection/components/revoGrid/revo-grid.js +2 -2
- package/dist/collection/components/revoGrid/viewport.resize.service.js +19 -4
- package/dist/collection/components/revoGrid/viewport.resize.service.js.map +1 -1
- package/dist/collection/components/scroll/revogr-viewport-scroll.js +38 -31
- package/dist/collection/components/scroll/revogr-viewport-scroll.js.map +1 -1
- package/dist/collection/components/scrollable/revogr-scroll-virtual.js +23 -8
- package/dist/collection/components/scrollable/revogr-scroll-virtual.js.map +1 -1
- package/dist/collection/plugins/filter/filter.panel.js +8 -4
- package/dist/collection/plugins/filter/filter.panel.js.map +1 -1
- package/dist/collection/plugins/filter/filter.types.js +7 -0
- package/dist/collection/plugins/filter/filter.types.js.map +1 -1
- package/dist/collection/services/local.scroll.service.js +3 -0
- package/dist/collection/services/local.scroll.service.js.map +1 -1
- package/dist/collection/types/interfaces.js.map +1 -1
- package/dist/esm/revogr-attribution_7.entry.js +23 -8
- package/dist/esm/revogr-attribution_7.entry.js.map +1 -1
- package/dist/esm/revogr-data_4.entry.js +58 -36
- package/dist/esm/revogr-data_4.entry.js.map +1 -1
- package/dist/esm/revogr-filter-panel.entry.js.map +1 -1
- package/dist/esm/{throttle-05489451.js → throttle-dec28f5b.js} +4 -1
- package/dist/esm/throttle-dec28f5b.js.map +1 -0
- package/dist/revo-grid/revogr-attribution_7.entry.js +1 -1
- package/dist/revo-grid/revogr-attribution_7.entry.js.map +1 -1
- package/dist/revo-grid/revogr-data_4.entry.js +1 -1
- package/dist/revo-grid/revogr-data_4.entry.js.map +1 -1
- package/dist/revo-grid/revogr-filter-panel.entry.js.map +1 -1
- package/dist/revo-grid/throttle-dec28f5b.js +5 -0
- package/dist/revo-grid/throttle-dec28f5b.js.map +1 -0
- package/dist/types/components/revoGrid/viewport.resize.service.d.ts +8 -6
- package/dist/types/components/scroll/revogr-viewport-scroll.d.ts +2 -2
- package/dist/types/components.d.ts +2 -2
- package/dist/types/plugins/filter/filter.panel.d.ts +1 -1
- package/dist/types/plugins/filter/filter.types.d.ts +19 -19
- package/dist/types/types/interfaces.d.ts +6 -6
- package/hydrate/index.js +82 -42
- package/hydrate/index.mjs +82 -42
- package/package.json +1 -1
- package/standalone/local.scroll.timer.js +3 -0
- package/standalone/local.scroll.timer.js.map +1 -1
- package/standalone/revogr-filter-panel.js.map +1 -1
- package/standalone/revogr-scroll-virtual2.js +22 -7
- package/standalone/revogr-scroll-virtual2.js.map +1 -1
- package/standalone/revogr-viewport-scroll2.js +57 -35
- package/standalone/revogr-viewport-scroll2.js.map +1 -1
- package/dist/cjs/throttle-08957661.js.map +0 -1
- package/dist/esm/throttle-05489451.js.map +0 -1
- package/dist/revo-grid/throttle-05489451.js +0 -5
- package/dist/revo-grid/throttle-05489451.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"file":"local.scroll.timer.js","mappings":";;;;;AAqBA,MAAM,aAAa,GAAW;IAC5B,WAAW,EAAE,CAAC;IACd,UAAU,EAAE,CAAC;IACb,WAAW,EAAE,CAAC;IACd,OAAO,EAAE,CAAC;CACX,CAAC;AACF,MAAM,aAAa,GAAG,CAAC,CAAC,CAAC;AAEzB;;;;SAIgB,cAAc,CAC5B,WAAmB,EACnB,UAAkB,EAClB,WAAW,GAAG,CAAC;IAEf,OAAO,WAAW,IAAI,WAAW,GAAG,UA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SACT,CAAC;KAE2C;IAE7C,aAAa,CAAC,CAAmD;QAC/D,IAAI,CAAC,yBAAyB,CAAC,CAAC,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,UAAU,CAAC;KAC5D;;;;IAKD,kBAAkB,CAAC,SAAwB;QACzC,IAAI,CAAC,yBAAyB,CAAC,SAAS,CAAC,GAAG,IAAI,IAAI,EAAE,CAAC,OAAO,EAAE,CAAC;KAClE;;;;IAKD,OAAO,CAAC,IAAmB,EAAE,UAAkB;QAC7C,MAAM,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC,yBAAyB,CAAC,IAAI,CAAC,CAAC;;QAE3E,QACE,MAAM,GAAG,IAAI,CAAC,gBAAgB;YAC9B,UAAU,KAAK,IAAI,CAAC,yBAAyB,CAAC,IAAI,CAAC,EACnD;KACH;;;;;","names":[],"sources":["src/services/local.scroll.service.ts","src/services/local.scroll.timer.ts"],"sourcesContent":["import type { DimensionType, ViewPortScrollEvent } from '@type';\nimport { scaleValue } from '../utils';\n\ninterface Config {\n skipAnimationFrame?: boolean;\n // scroll event inited and direction cached\n // scrollingService.proxyScroll get tiggered\n // setScroll event called from scrollingService\n runScroll(e: ViewPortScrollEvent): void;\n // all operation finished, apply scroll values\n applyScroll(e: ViewPortScrollEvent): void;\n}\n\ntype Params = {\n contentSize: number;\n virtualContentSize?: number;\n clientSize: number;\n virtualSize: number;\n maxSize?: number;\n};\n\nconst initialParams: Params = {\n contentSize: 0,\n clientSize: 0,\n virtualSize: 0,\n maxSize: 0,\n};\nconst NO_COORDINATE = -1;\n\n/**\n * Based on content size, client size and virtual size\n * return full size\n */\nexport function getContentSize(\n contentSize: number,\n clientSize: number,\n virtualSize = 0,\n): number {\n return contentSize + (virtualSize ? clientSize - virtualSize : 0);\n}\n\nexport default class LocalScrollService {\n private preventArtificialScroll: Record<DimensionType, (() => void) | null> = {\n rgRow: null,\n rgCol: null,\n };\n // to check if scroll changed\n private previousScroll: Record<DimensionType, number> = {\n rgRow: NO_COORDINATE,\n rgCol: NO_COORDINATE,\n };\n private params: Record<DimensionType, Params> = {\n rgRow: { ...initialParams },\n rgCol: { ...initialParams },\n };\n\n constructor(private cfg: Config) {}\n\n setParams(params: Params, dimension: DimensionType) {\n const virtualContentSize = getContentSize(\n params.contentSize,\n params.clientSize,\n params.virtualSize,\n );\n this.params[dimension] = {\n ...params,\n maxSize: virtualContentSize - params.clientSize,\n virtualContentSize,\n };\n }\n\n // apply scroll values after scroll done\n async setScroll(e: ViewPortScrollEvent) {\n this.cancelScroll(e.dimension);\n\n // start frame animation\n const frameAnimation = new Promise<void>((resolve, reject) => {\n // for example safari desktop has issues with animation frame\n if (this.cfg.skipAnimationFrame) {\n return resolve();\n }\n const animationId = window.requestAnimationFrame(() => {\n resolve();\n });\n this.preventArtificialScroll[e.dimension] = reject.bind(\n null,\n animationId,\n );\n });\n\n try {\n await frameAnimation;\n const params = this.getParams(e.dimension);\n e.coordinate = Math.ceil(e.coordinate);\n this.previousScroll[e.dimension] = this.wrapCoordinate(\n e.coordinate,\n params,\n );\n this.preventArtificialScroll[e.dimension] = null;\n this.cfg.applyScroll({\n ...e,\n coordinate: params.virtualSize\n ? this.convert(e.coordinate, params, false)\n : e.coordinate,\n });\n } catch (id) {\n window.cancelAnimationFrame(id);\n }\n }\n\n /**\n * On scroll event started\n */\n scroll(\n coordinate: number,\n dimension: DimensionType,\n force = false,\n delta?: number,\n outside = false,\n ) {\n // cancel all previous scrolls for same dimension\n this.cancelScroll(dimension);\n\n // drop if no change\n if (!force && this.previousScroll[dimension] === coordinate) {\n this.previousScroll[dimension] = NO_COORDINATE;\n return;\n }\n\n const param = this.getParams(dimension);\n // let component know about scroll event started\n this.cfg.runScroll({\n dimension: dimension,\n coordinate: param.virtualSize\n ? this.convert(coordinate, param)\n : coordinate,\n delta,\n outside,\n });\n }\n\n private getParams(dimension: DimensionType): Params {\n return this.params[dimension];\n }\n\n // check if scroll outside of region to avoid looping\n private wrapCoordinate(c: number, param: Params): number {\n if (c < 0) {\n return NO_COORDINATE;\n }\n\n if (typeof param.maxSize === 'number' && c > param.maxSize) {\n return param.maxSize;\n }\n return c;\n }\n\n // prevent already started scroll, performance optimization\n private cancelScroll(dimension: DimensionType) {\n this.preventArtificialScroll[dimension]?.();\n this.preventArtificialScroll[dimension] = null;\n }\n\n /* convert virtual to real and back, scale range */\n private convert(pos: number, param: Params, toReal = true): number {\n const minRange = param.clientSize;\n const from: [number, number] = [0, (param.virtualContentSize ?? minRange) - minRange];\n const to: [number, number] = [0, param.contentSize - param.virtualSize];\n if (toReal) {\n return scaleValue(pos, from, to);\n }\n return scaleValue(pos, to, from);\n }\n}\n","import type { DimensionType } from '@type';\n/**\n * Apply changes only if mousewheel event happened some time ago (scrollThrottling)\n */\nexport class LocalScrollTimer {\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 mouseWheelScrollTimestamp: Record<DimensionType, number> = {\n rgCol: 0,\n rgRow: 0,\n };\n private lastKnownScrollCoordinate: Record<DimensionType, number> = {\n rgCol: 0,\n rgRow: 0,\n };\n\n constructor(private scrollThrottling = 10) {}\n\n setCoordinate(e: { dimension: DimensionType; coordinate: number }) {\n this.lastKnownScrollCoordinate[e.dimension] = e.coordinate;\n }\n\n /**\n * Remember last mw event time\n */\n latestScrollUpdate(dimension: DimensionType) {\n this.mouseWheelScrollTimestamp[dimension] = new Date().getTime();\n }\n\n /**\n * Check if scroll is ready to accept new value\n */\n isReady(type: DimensionType, coordinate: number) {\n const change = new Date().getTime() - this.mouseWheelScrollTimestamp[type];\n // apply after throttling\n return (\n change > this.scrollThrottling &&\n coordinate !== this.lastKnownScrollCoordinate[type]\n );\n }\n}\n"],"version":3}
|
|
1
|
+
{"file":"local.scroll.timer.js","mappings":";;;;;AAqBA,MAAM,aAAa,GAAW;IAC5B,WAAW,EAAE,CAAC;IACd,UAAU,EAAE,CAAC;IACb,WAAW,EAAE,CAAC;IACd,OAAO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;;;AC9KH;;;MAGa,gBAAgB;IAc3B,YAAoB,mBAAmB,EAAE;QAArB,qBAAgB,GAAhB,gBAAgB,CAAK;;;;;QATjC,8BAAyB,GAAkC;YACjE,KAAK,EAAE,CAAC;YACR,KAAK,EAAE,CAAC;SACT,CAAC;QACM,8BAAyB,GAAkC;YACjE,KAAK,EAAE,CAAC;YACR,KAAK,EAAE,CAAC;SACT,CAAC;KAE2C;IAE7C,aAAa,CAAC,CAAmD;QAC/D,IAAI,CAAC,yBAAyB,CAAC,CAAC,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,UAAU,CAAC;KAC5D;;;;IAKD,kBAAkB,CAAC,SAAwB;QACzC,IAAI,CAAC,yBAAyB,CAAC,SAAS,CAAC,GAAG,IAAI,IAAI,EAAE,CAAC,OAAO,EAAE,CAAC;KAClE;;;;IAKD,OAAO,CAAC,IAAmB,EAAE,UAAkB;QAC7C,MAAM,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC,yBAAyB,CAAC,IAAI,CAAC,CAAC;;QAE3E,QACE,MAAM,GAAG,IAAI,CAAC,gBAAgB;YAC9B,UAAU,KAAK,IAAI,CAAC,yBAAyB,CAAC,IAAI,CAAC,EACnD;KACH;;;;;","names":[],"sources":["src/services/local.scroll.service.ts","src/services/local.scroll.timer.ts"],"sourcesContent":["import type { DimensionType, ViewPortScrollEvent } from '@type';\nimport { scaleValue } from '../utils';\n\ninterface Config {\n skipAnimationFrame?: boolean;\n // scroll event inited and direction cached\n // scrollingService.proxyScroll get tiggered\n // setScroll event called from scrollingService\n runScroll(e: ViewPortScrollEvent): void;\n // all operation finished, apply scroll values\n applyScroll(e: ViewPortScrollEvent): void;\n}\n\ntype Params = {\n contentSize: number;\n virtualContentSize?: number;\n clientSize: number;\n virtualSize: number;\n maxSize?: number;\n};\n\nconst initialParams: Params = {\n contentSize: 0,\n clientSize: 0,\n virtualSize: 0,\n maxSize: 0,\n};\nconst NO_COORDINATE = -1;\n\n/**\n * Based on content size, client size and virtual size\n * return full size\n */\nexport function getContentSize(\n contentSize: number,\n clientSize: number,\n virtualSize = 0,\n): number {\n if (virtualSize > contentSize) {\n return 0;\n }\n return contentSize + (virtualSize ? clientSize - virtualSize : 0);\n}\n\nexport default class LocalScrollService {\n private preventArtificialScroll: Record<DimensionType, (() => void) | null> = {\n rgRow: null,\n rgCol: null,\n };\n // to check if scroll changed\n private previousScroll: Record<DimensionType, number> = {\n rgRow: NO_COORDINATE,\n rgCol: NO_COORDINATE,\n };\n private params: Record<DimensionType, Params> = {\n rgRow: { ...initialParams },\n rgCol: { ...initialParams },\n };\n\n constructor(private cfg: Config) {}\n\n setParams(params: Params, dimension: DimensionType) {\n const virtualContentSize = getContentSize(\n params.contentSize,\n params.clientSize,\n params.virtualSize,\n );\n this.params[dimension] = {\n ...params,\n maxSize: virtualContentSize - params.clientSize,\n virtualContentSize,\n };\n }\n\n // apply scroll values after scroll done\n async setScroll(e: ViewPortScrollEvent) {\n this.cancelScroll(e.dimension);\n\n // start frame animation\n const frameAnimation = new Promise<void>((resolve, reject) => {\n // for example safari desktop has issues with animation frame\n if (this.cfg.skipAnimationFrame) {\n return resolve();\n }\n const animationId = window.requestAnimationFrame(() => {\n resolve();\n });\n this.preventArtificialScroll[e.dimension] = reject.bind(\n null,\n animationId,\n );\n });\n\n try {\n await frameAnimation;\n const params = this.getParams(e.dimension);\n e.coordinate = Math.ceil(e.coordinate);\n this.previousScroll[e.dimension] = this.wrapCoordinate(\n e.coordinate,\n params,\n );\n this.preventArtificialScroll[e.dimension] = null;\n this.cfg.applyScroll({\n ...e,\n coordinate: params.virtualSize\n ? this.convert(e.coordinate, params, false)\n : e.coordinate,\n });\n } catch (id) {\n window.cancelAnimationFrame(id);\n }\n }\n\n /**\n * On scroll event started\n */\n scroll(\n coordinate: number,\n dimension: DimensionType,\n force = false,\n delta?: number,\n outside = false,\n ) {\n // cancel all previous scrolls for same dimension\n this.cancelScroll(dimension);\n\n // drop if no change\n if (!force && this.previousScroll[dimension] === coordinate) {\n this.previousScroll[dimension] = NO_COORDINATE;\n return;\n }\n\n const param = this.getParams(dimension);\n // let component know about scroll event started\n this.cfg.runScroll({\n dimension: dimension,\n coordinate: param.virtualSize\n ? this.convert(coordinate, param)\n : coordinate,\n delta,\n outside,\n });\n }\n\n private getParams(dimension: DimensionType): Params {\n return this.params[dimension];\n }\n\n // check if scroll outside of region to avoid looping\n private wrapCoordinate(c: number, param: Params): number {\n if (c < 0) {\n return NO_COORDINATE;\n }\n\n if (typeof param.maxSize === 'number' && c > param.maxSize) {\n return param.maxSize;\n }\n return c;\n }\n\n // prevent already started scroll, performance optimization\n private cancelScroll(dimension: DimensionType) {\n this.preventArtificialScroll[dimension]?.();\n this.preventArtificialScroll[dimension] = null;\n }\n\n /* convert virtual to real and back, scale range */\n private convert(pos: number, param: Params, toReal = true): number {\n const minRange = param.clientSize;\n const from: [number, number] = [0, (param.virtualContentSize ?? minRange) - minRange];\n const to: [number, number] = [0, param.contentSize - param.virtualSize];\n if (toReal) {\n return scaleValue(pos, from, to);\n }\n return scaleValue(pos, to, from);\n }\n}\n","import type { DimensionType } from '@type';\n/**\n * Apply changes only if mousewheel event happened some time ago (scrollThrottling)\n */\nexport class LocalScrollTimer {\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 mouseWheelScrollTimestamp: Record<DimensionType, number> = {\n rgCol: 0,\n rgRow: 0,\n };\n private lastKnownScrollCoordinate: Record<DimensionType, number> = {\n rgCol: 0,\n rgRow: 0,\n };\n\n constructor(private scrollThrottling = 10) {}\n\n setCoordinate(e: { dimension: DimensionType; coordinate: number }) {\n this.lastKnownScrollCoordinate[e.dimension] = e.coordinate;\n }\n\n /**\n * Remember last mw event time\n */\n latestScrollUpdate(dimension: DimensionType) {\n this.mouseWheelScrollTimestamp[dimension] = new Date().getTime();\n }\n\n /**\n * Check if scroll is ready to accept new value\n */\n isReady(type: DimensionType, coordinate: number) {\n const change = new Date().getTime() - this.mouseWheelScrollTimestamp[type];\n // apply after throttling\n return (\n change > this.scrollThrottling &&\n coordinate !== this.lastKnownScrollCoordinate[type]\n );\n }\n}\n"],"version":3}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"file":"revogr-filter-panel.js","mappings":";;;;;;;AAAA,CAAC,SAAS,OAAO;IACf,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,OAAO,EAAE;QAC9B,OAAO,CAAC,SAAS,CAAC,OAAO;YACrB,OAAO,CAAC,SAA+E,CAAC,iBAAiB,IAAI,OAAO,CAAC,SAAS,CAAC,qBAAqB,CAAC;KAC1J;IAED,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,OAAO,EAAE;QAC9B,OAAO,CAAC,SAAS,CAAC,OAAO,GAAG,UAAU,CAAS;YAC7C,IAAI,EAAE,GAAuD,IAAI,CAAC;YAElE,GAAG;gBACD,IAAI,OAAO,CAAC,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE;oBACzC,OAAO,EAAE,CAAC;iBACX;gBACD,EAAE,GAAG,EAAE,CAAC,aAAa,IAAI,EAAE,CAAC,UAAU,CAAC;aACxC,QAAQ,EAAE,KAAK,IAAI,IAAI,EAAE,CAAC,QAAQ,KAAK,CAAC,EAAE;YAC3C,OAAO,IAAI,CAAC;SACb,CAAC;KACH;AACH,CAAC,GAAG;;ACnBJ,MAAM,cAAc,GAAG,66TAA66T,CAAC;AACr8T,gCAAe,cAAc;;AC2B7B,MAAM,WAAW,GAAe,MAAM,CAAC;AAEvC,MAAM,iBAAiB,GAAG,mBAAmB,CAAC;AAC9C,MAAM,wBAAwB,GAAG,0BAA0B,CAAC;AAC5D,MAAM,SAAS,GAAG,YAAY,CAAC;MAYlB,WAAW;;;;;;QACd,2BAAsB,GAAmB;YAC/C,KAAK,EAAE,WAAW;YAClB,EAAE,EAAE,IAAI;YACR,IAAI,EAAE,MAAM;;YAEZ,KAAK,EAA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MAAM,CACN;SACV,EACA,CAAC,IAAI,CAAC,uBAAuB,IAAI;YAChC,cACE,EAAE,EAAC,gBAAgB,gBACR,IAAI,EACf,KAAK,EAAC,mBAAmB,EACzB,OAAO,EAAE,MAAM,IAAI,CAAC,QAAQ,EAAE,IAE7B,KAAK,CAAC,EAAE,CACF;YAET,cACE,EAAE,EAAC,mBAAmB,gBACX,OAAO,EAClB,KAAK,EAAC,qBAAqB,EAC3B,OAAO,EAAE,MAAM,IAAI,CAAC,OAAO,EAAE,IAE5B,KAAK,CAAC,KAAK,CACL;SACV,CACG,EACN,YAAM,IAAI,EAAC,QAAQ,GAAG,CACjB,EACP;KACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":[],"sources":["src/utils/closest.polifill.ts","src/plugins/filter/filter.style.scss?tag=revogr-filter-panel","src/plugins/filter/filter.panel.tsx"],"sourcesContent":["(function closest() {\n if (!Element.prototype.matches) {\n Element.prototype.matches =\n ((Element.prototype as unknown) as { msMatchesSelector: (selectors: string) => boolean }).msMatchesSelector || Element.prototype.webkitMatchesSelector;\n }\n\n if (!Element.prototype.closest) {\n Element.prototype.closest = function (s: string) {\n let el: HTMLElement | Element | (Node & ParentNode) | null = this;\n\n do {\n if (Element.prototype.matches.call(el, s)) {\n return el;\n }\n el = el.parentElement || el.parentNode;\n } while (el !== null && el.nodeType === 1);\n return null;\n };\n }\n})();\n","revogr-filter-panel {\n position: absolute;\n display: block;\n top: 0;\n left: 0;\n z-index: 100;\n max-height: calc(100% - 80px);\n min-width: 250px;\n overflow: auto;\n\n opacity: 1;\n transform: none;\n background-color: #fff;\n transform-origin: 62px 0px;\n box-shadow: 0 5px 18px -2px rgba(black, 20%);\n padding: 10px;\n border-radius: 4px;\n\n min-width: 220px;\n text-align: left;\n\n .filter-holder > div {\n display: flex;\n flex-direction: column;\n }\n\n label {\n font-size: 13px;\n display: block;\n padding: 8px 0;\n }\n\n select {\n width: 100%;\n }\n\n input[type='text'] {\n border: 0;\n min-height: 34px;\n margin: 5px 0;\n background: #f3f3f3;\n border-radius: 5px;\n padding: 0 10px;\n box-sizing: border-box;\n width: 100%;\n }\n\n button {\n margin-top: 10px;\n margin-right: 5px;\n }\n\n .filter-actions {\n text-align: right;\n margin-right: -5px;\n }\n}\n\n.rgHeaderCell {\n &:hover .rv-filter {\n transition:\n opacity 267ms cubic-bezier(0.4, 0, 0.2, 1) 0ms,\n transform 178ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;\n }\n &:hover .rv-filter,\n .rv-filter.active {\n opacity: 1;\n }\n\n .rv-filter {\n $btn-size: 24px;\n height: $btn-size;\n width: $btn-size;\n background: none;\n border: 0;\n opacity: 0;\n visibility: visible;\n cursor: pointer;\n border-radius: 4px;\n\n &.active {\n color: #10224a;\n }\n\n .filter-img {\n $img-size: 11px;\n color: gray;\n width: $img-size;\n }\n }\n}\n\n.select-css {\n $gradient: 'data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%23007CB2%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E';\n $linearGradient: linear-gradient(to bottom, #ffffff 0%, #ffffff 100%);\n $borderColor: #f1f1f1;\n\n display: block;\n font-family: sans-serif;\n font-weight: 600;\n color: #444;\n line-height: 1.3;\n padding: 0.6em 1.4em 0.5em 0.8em;\n width: 100%;\n max-width: 100%; /* useful when width is set to anything other than 100% */\n box-sizing: border-box;\n margin: 0;\n border: 1px solid $borderColor;\n box-shadow: transparent;\n border-radius: 0.5em;\n appearance: none;\n background-color: #fff;\n background-image: url($gradient), $linearGradient;\n background-repeat: no-repeat, repeat;\n /* arrow icon position (1em from the right, 50% vertical) , then gradient position*/\n background-position:\n right 0.7em top 50%,\n 0 0;\n /* icon size, then gradient */\n background-size:\n 0.65em auto,\n 100%;\n\n /* Hide arrow icon in IE browsers */\n &::-ms-expand {\n display: none;\n }\n /* Hover style */\n &:hover {\n border-color: rgb(197, 197, 197);\n }\n /* Focus style */\n &:focus {\n border-color: $borderColor;\n box-shadow: 0 0 1px 3px rgba(59, 153, 252, 0.7);\n box-shadow: 0 0 0 3px -moz-mac-focusring;\n color: #222;\n outline: none;\n }\n\n /* Set options to normal weight */\n option {\n font-weight: normal;\n }\n\n /* Disabled styles */\n &:disabled,\n &[aria-disabled='true'] {\n color: gray;\n background-image: url('data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22graytext%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E'),\n linear-gradient(to bottom, #ffffff 0%, #ffffff 100%);\n }\n\n &:disabled:hover,\n &[aria-disabled='true'] {\n border-color: $borderColor;\n }\n}\n\n.multi-filter-list {\n margin-top: 5px;\n margin-bottom: 5px;\n\n div {\n white-space: nowrap;\n }\n\n .multi-filter-list-action {\n display: flex;\n\n justify-content: space-between;\n align-items: center;\n }\n\n .and-or-button {\n margin: 0 0 0 10px;\n min-width: 58px;\n cursor: pointer;\n }\n .trash-button {\n $btn-remove-size: 22px;\n margin: 0 0 -2px 6px;\n cursor: pointer;\n\n width: $btn-remove-size;\n height: 100%;\n font-size: 16px;\n\n .trash-img {\n width: 1em;\n }\n }\n}\n\n.add-filter-divider {\n display: block;\n margin: 0 -10px 10px -10px;\n\n border-bottom: 1px solid #d9d9d9;\n height: 10px;\n}\n\n.select-input {\n display: flex;\n justify-content: space-between;\n align-items: center;\n}\n\nrevo-grid[theme^='dark'] {\n revogr-filter-panel {\n background-color: $el-color-dark;\n\n .add-filter-divider {\n border-bottom-color: $el-color-dark;\n }\n\n input[type=text] {\n background-color: $font-color-dark;\n color: black;\n }\n }\n}","// filter.panel.tsx\n\nimport {\n h,\n Component,\n Event,\n EventEmitter,\n Host,\n Listen,\n Method,\n Prop,\n State,\n type VNode,\n Element,\n} from '@stencil/core';\nimport debounce from 'lodash/debounce';\n\nimport { AndOrButton, isFilterBtn, TrashButton } from './filter.button';\nimport '../../utils/closest.polifill';\nimport {\n FilterCaptions,\n LogicFunction,\n MultiFilterItem,\n ShowData,\n} from './filter.types';\nimport type { ColumnProp } from '@type';\nimport { FilterType } from './filter.indexed';\n\nconst defaultType: FilterType = 'none';\n\nconst FILTER_LIST_CLASS = 'multi-filter-list';\nconst FILTER_LIST_CLASS_ACTION = 'multi-filter-list-action';\nconst FILTER_ID = 'add-filter';\n\n/**\n * Filter panel for editing filters\n */\n/**\n * @internal\n */\n@Component({\n tag: 'revogr-filter-panel',\n styleUrl: 'filter.style.scss',\n})\nexport class FilterPanel {\n private filterCaptionsInternal: FilterCaptions = {\n title: 'Filter by',\n ok: 'Ok',\n save: 'Save',\n // drops the filter\n reset: 'Reset',\n cancel: 'Cancel',\n add: 'Add condition',\n placeholder: 'Enter value...',\n and: 'and',\n or: 'or',\n };\n\n @Element() element!: HTMLElement;\n @State() isFilterIdSet = false;\n @State() filterId = 0;\n @State() currentFilterId = -1;\n @State() currentFilterType: FilterType = defaultType;\n @State() changes: ShowData | undefined;\n @State() filterItems: MultiFilterItem = {};\n @Prop() filterNames: Record<string, string> = {};\n @Prop() filterEntities: Record<string, LogicFunction> = {};\n @Prop() filterCaptions: FilterCaptions | undefined;\n /**\n * Disables dynamic filtering. A way to apply filters on Save only\n */\n @Prop() disableDynamicFiltering = false;\n @Event() filterChange: EventEmitter<MultiFilterItem>;\n @Event() resetChange: EventEmitter<ColumnProp>;\n\n @Listen('mousedown', { target: 'document' }) onMouseDown(e: MouseEvent) {\n // click on anything then select drops values to default\n if (!this.changes || e.defaultPrevented) {\n return;\n }\n const path = e.composedPath();\n const select = document.getElementById(FILTER_ID);\n if (select instanceof HTMLSelectElement) {\n // click on select should be skipped\n if (path.includes(select)) {\n return;\n }\n select.value = defaultType;\n }\n this.currentFilterType = defaultType;\n if (this.changes) {\n this.changes.type = defaultType;\n }\n this.currentFilterId = -1;\n\n const isOutside = !path.includes(this.element);\n\n if (\n e.target instanceof HTMLElement &&\n isOutside &&\n !isFilterBtn(e.target)\n ) {\n this.changes = undefined;\n }\n }\n\n @Method() async show(newEntity?: ShowData) {\n this.changes = newEntity;\n this.filterItems = newEntity?.filterItems || {};\n if (this.changes) {\n this.changes.type = this.changes.type || defaultType;\n }\n }\n\n @Method() async getChanges() {\n return this.changes;\n }\n\n componentWillRender() {\n if (!this.isFilterIdSet) {\n this.isFilterIdSet = true;\n const filterItems = Object.keys(this.filterItems);\n for (const prop of filterItems) {\n // we set the proper filterId so there won't be any conflict when removing filters\n this.filterId += this.filterItems[prop].length;\n }\n }\n }\n\n getFilterItemsList() {\n const prop = this.changes?.prop;\n if (typeof prop === 'undefined') return '';\n\n const propFilters = this.filterItems[prop] ?? [];\n const capts = Object.assign(\n this.filterCaptionsInternal,\n this.filterCaptions,\n );\n return (\n <div key={this.filterId}>\n {propFilters.map((filter, index) => {\n let andOrButton;\n if (filter.hidden) {\n return;\n }\n\n // hide toggle button if there is only one filter and the last one\n if (index !== this.filterItems[prop].length - 1) {\n andOrButton = (\n <div onClick={() => this.toggleFilterAndOr(filter.id)}>\n <AndOrButton\n text={filter.relation === 'and' ? capts.and : capts.or}\n />\n </div>\n );\n }\n\n return (\n <div key={filter.id} class={FILTER_LIST_CLASS}>\n <div class={{ 'select-input': true }}>\n <select\n class=\"select-css select-filter\"\n onChange={e => this.onFilterTypeChange(e, prop, index)}\n >\n {this.renderSelectOptions(\n this.filterItems[prop][index].type,\n true,\n )}\n </select>\n <div class={FILTER_LIST_CLASS_ACTION}>{andOrButton}</div>\n <div onClick={() => this.onRemoveFilter(filter.id)}>\n <TrashButton />\n </div>\n </div>\n <div>{this.renderExtra(prop, index)}</div>\n </div>\n );\n })}\n\n {propFilters.filter(f => !f.hidden).length > 0 ? <div class=\"add-filter-divider\" /> : ''}\n </div>\n );\n }\n\n private autoCorrect(el?: HTMLElement | null) {\n if (!el) {\n return;\n }\n const pos = el.getBoundingClientRect();\n const maxLeft = window.innerWidth - pos.width;\n\n if (pos.left > maxLeft && el.offsetLeft) {\n el.style.left = `${maxLeft - (el.parentElement?.getBoundingClientRect().left ?? 0)}px`;\n }\n }\n\n private onFilterTypeChange(e: Event, prop: ColumnProp, index: number) {\n if (!(e.target instanceof HTMLSelectElement)) {\n return;\n }\n this.filterItems[prop][index].type = e.target.value as FilterType;\n\n // this re-renders the input to know if we need extra input\n this.filterId++;\n\n // adding setTimeout will wait for the next tick DOM update then focus on input\n setTimeout(() => {\n const input = document.getElementById(\n 'filter-input-' + this.filterItems[prop][index].id,\n );\n if (input instanceof HTMLInputElement) {\n input.focus();\n }\n }, 0);\n\n if (!this.disableDynamicFiltering) {\n this.debouncedApplyFilter();\n }\n }\n\n private debouncedApplyFilter = debounce(() => {\n this.filterChange.emit(this.filterItems);\n }, 400);\n\n private onAddNewFilter(e: Event) {\n const el = e.target as HTMLSelectElement;\n this.currentFilterType = el.value as FilterType;\n this.addNewFilterToProp();\n\n // reset value after adding new filter\n const select = document.getElementById('add-filter') as HTMLSelectElement;\n if (select) {\n select.value = defaultType;\n this.currentFilterType = defaultType;\n }\n\n if (!this.disableDynamicFiltering) {\n this.debouncedApplyFilter();\n }\n }\n\n private addNewFilterToProp() {\n const prop = this.changes?.prop;\n if (!(prop || prop === 0)) return;\n\n if (!this.filterItems[prop]) {\n this.filterItems[prop] = [];\n }\n\n if (this.currentFilterType === 'none') return;\n\n this.filterId++;\n this.currentFilterId = this.filterId;\n\n this.filterItems[prop].push({\n id: this.currentFilterId,\n type: this.currentFilterType,\n value: '',\n relation: 'and',\n });\n\n // adding setTimeout will wait for the next tick DOM update then focus on input\n setTimeout(() => {\n const input = document.getElementById(\n 'filter-input-' + this.currentFilterId,\n ) as HTMLInputElement;\n if (input) input.focus();\n }, 0);\n }\n\n private onUserInput(index: number, prop: ColumnProp, event: Event) {\n // update the value of the filter item\n this.filterItems[prop][index].value = (\n event.target as HTMLInputElement\n ).value;\n\n if (!this.disableDynamicFiltering) {\n this.debouncedApplyFilter();\n }\n }\n\n private onKeyDown(e: KeyboardEvent) {\n if (e.key.toLowerCase() === 'enter') {\n const select = document.getElementById('add-filter') as HTMLSelectElement;\n if (select) {\n select.value = defaultType;\n this.currentFilterType = defaultType;\n this.addNewFilterToProp();\n select.focus();\n }\n return;\n }\n // keep event local, don't escalate farther to dom\n e.stopPropagation();\n }\n\n private onSave() {\n this.filterChange.emit(this.filterItems);\n }\n\n private onCancel() {\n this.changes = undefined;\n }\n\n private onReset() {\n this.assertChanges();\n\n this.resetChange.emit(this.changes?.prop);\n\n // this updates the DOM which is used by getFilterItemsList() key\n this.filterId++;\n }\n\n private onRemoveFilter(id: number) {\n this.assertChanges();\n\n // this is for reactivity issues for getFilterItemsList()\n this.filterId++;\n\n const prop = this.changes?.prop;\n\n const items = this.filterItems[prop ?? ''];\n if (!items) return;\n\n const index = items.findIndex(d => d.id === id);\n if (index === -1) return;\n items.splice(index, 1);\n\n // let's remove the prop if no more filters so the filter icon will be removed\n if (items.length === 0) delete this.filterItems[prop ?? ''];\n\n if (!this.disableDynamicFiltering) {\n this.debouncedApplyFilter();\n }\n }\n\n private toggleFilterAndOr(id: number) {\n this.assertChanges();\n\n // this is for reactivity issues for getFilterItemsList()\n this.filterId++;\n\n const prop = this.changes?.prop;\n\n const items = this.filterItems[prop ?? ''];\n if (!items) return;\n\n const index = items.findIndex(d => d.id === id);\n if (index === -1) return;\n\n items[index].relation = items[index].relation === 'and' ? 'or' : 'and';\n if (!this.disableDynamicFiltering) {\n this.debouncedApplyFilter();\n }\n }\n\n private assertChanges() {\n if (!this.changes) {\n throw new Error('Changes required per edit');\n }\n }\n\n renderSelectOptions(type: FilterType, isDefaultTypeRemoved = false) {\n if (!this.changes) {\n return;\n }\n const options: VNode[] = [];\n const prop = this.changes.prop;\n\n const hidden = new Set<string>();\n Object.entries(this.filterItems).forEach(([_, values]) => {\n values.forEach((filter) => {\n if (filter.hidden) {\n hidden.add(filter.type);\n }\n })\n });\n\n if (!isDefaultTypeRemoved) {\n const capts = Object.assign(\n this.filterCaptionsInternal,\n this.filterCaptions,\n );\n\n options.push(\n <option\n selected={this.currentFilterType === defaultType}\n value={defaultType}\n >\n {prop && this.filterItems[prop] && this.filterItems[prop].length > 0\n ? capts.add\n : this.filterNames[defaultType]}\n </option>,\n );\n }\n\n for (let gIndex in this.changes.filterTypes) {\n const group = this.changes.filterTypes[gIndex].filter(k => !hidden.has(k));\n if (group.length) {\n options.push(\n ...group.map(k => (\n <option value={k} selected={type === k}>\n {this.filterNames[k]}\n </option>\n )),\n );\n options.push(<option disabled></option>);\n }\n }\n return options;\n }\n\n renderExtra(prop: ColumnProp, index: number) {\n const currentFilter = this.filterItems[prop];\n\n if (!currentFilter) return '';\n\n if (this.filterEntities[currentFilter[index].type].extra !== 'input')\n return '';\n\n const capts = Object.assign(\n this.filterCaptionsInternal,\n this.filterCaptions,\n );\n\n return (\n <input\n id={`filter-input-${currentFilter[index].id}`}\n placeholder={capts.placeholder}\n type=\"text\"\n value={currentFilter[index].value}\n onInput={this.onUserInput.bind(this, index, prop)}\n onKeyDown={e => this.onKeyDown(e)}\n />\n );\n }\n\n render() {\n if (!this.changes) {\n return <Host style={{ display: 'none' }}></Host>;\n }\n const style = {\n display: 'block',\n left: `${this.changes.x}px`,\n top: `${this.changes.y}px`,\n };\n\n const capts = Object.assign(\n this.filterCaptionsInternal,\n this.filterCaptions,\n );\n\n return (\n <Host\n style={style}\n ref={el => {\n this.changes?.autoCorrect && this.autoCorrect(el);\n }}\n >\n <slot slot=\"header\" />\n { this.changes.extraContent?.(this.changes) || '' }\n\n { this.changes?.hideDefaultFilters !== true && (\n [\n <label>{capts.title}</label>,\n <div class=\"filter-holder\">{this.getFilterItemsList()}</div>,\n <div class=\"add-filter\">\n <select\n id={FILTER_ID}\n class=\"select-css\"\n onChange={e => this.onAddNewFilter(e)}\n >\n {this.renderSelectOptions(this.currentFilterType)}\n </select>\n </div>\n ]\n )}\n\n <slot />\n <div class=\"filter-actions\">\n {this.disableDynamicFiltering && [\n <button\n id=\"revo-button-save\"\n aria-label=\"save\"\n class=\"revo-button green\"\n onClick={() => this.onSave()}\n >\n {capts.save}\n </button>,\n <button\n id=\"revo-button-ok\"\n aria-label=\"ok\"\n class=\"revo-button green\"\n onClick={() => this.onCancel()}\n >\n {capts.cancel}\n </button>,\n ]}\n {!this.disableDynamicFiltering && [\n <button\n id=\"revo-button-ok\"\n aria-label=\"ok\"\n class=\"revo-button green\"\n onClick={() => this.onCancel()}\n >\n {capts.ok}\n </button>,\n\n <button\n id=\"revo-button-reset\"\n aria-label=\"reset\"\n class=\"revo-button outline\"\n onClick={() => this.onReset()}\n >\n {capts.reset}\n </button>,\n ]}\n </div>\n <slot slot=\"footer\" />\n </Host>\n );\n }\n}\n"],"version":3}
|
|
1
|
+
{"file":"revogr-filter-panel.js","mappings":";;;;;;;AAAA,CAAC,SAAS,OAAO;IACf,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,OAAO,EAAE;QAC9B,OAAO,CAAC,SAAS,CAAC,OAAO;YACrB,OAAO,CAAC,SAA+E,CAAC,iBAAiB,IAAI,OAAO,CAAC,SAAS,CAAC,qBAAq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AQ,GAAG,CACjB,EACP;KACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":[],"sources":["src/utils/closest.polifill.ts","src/plugins/filter/filter.style.scss?tag=revogr-filter-panel","src/plugins/filter/filter.panel.tsx"],"sourcesContent":["(function closest() {\n if (!Element.prototype.matches) {\n Element.prototype.matches =\n ((Element.prototype as unknown) as { msMatchesSelector: (selectors: string) => boolean }).msMatchesSelector || Element.prototype.webkitMatchesSelector;\n }\n\n if (!Element.prototype.closest) {\n Element.prototype.closest = function (s: string) {\n let el: HTMLElement | Element | (Node & ParentNode) | null = this;\n\n do {\n if (Element.prototype.matches.call(el, s)) {\n return el;\n }\n el = el.parentElement || el.parentNode;\n } while (el !== null && el.nodeType === 1);\n return null;\n };\n }\n})();\n","revogr-filter-panel {\n position: absolute;\n display: block;\n top: 0;\n left: 0;\n z-index: 100;\n max-height: calc(100% - 80px);\n min-width: 250px;\n overflow: auto;\n\n opacity: 1;\n transform: none;\n background-color: #fff;\n transform-origin: 62px 0px;\n box-shadow: 0 5px 18px -2px rgba(black, 20%);\n padding: 10px;\n border-radius: 4px;\n\n min-width: 220px;\n text-align: left;\n\n .filter-holder > div {\n display: flex;\n flex-direction: column;\n }\n\n label {\n font-size: 13px;\n display: block;\n padding: 8px 0;\n }\n\n select {\n width: 100%;\n }\n\n input[type='text'] {\n border: 0;\n min-height: 34px;\n margin: 5px 0;\n background: #f3f3f3;\n border-radius: 5px;\n padding: 0 10px;\n box-sizing: border-box;\n width: 100%;\n }\n\n button {\n margin-top: 10px;\n margin-right: 5px;\n }\n\n .filter-actions {\n text-align: right;\n margin-right: -5px;\n }\n}\n\n.rgHeaderCell {\n &:hover .rv-filter {\n transition:\n opacity 267ms cubic-bezier(0.4, 0, 0.2, 1) 0ms,\n transform 178ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;\n }\n &:hover .rv-filter,\n .rv-filter.active {\n opacity: 1;\n }\n\n .rv-filter {\n $btn-size: 24px;\n height: $btn-size;\n width: $btn-size;\n background: none;\n border: 0;\n opacity: 0;\n visibility: visible;\n cursor: pointer;\n border-radius: 4px;\n\n &.active {\n color: #10224a;\n }\n\n .filter-img {\n $img-size: 11px;\n color: gray;\n width: $img-size;\n }\n }\n}\n\n.select-css {\n $gradient: 'data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%23007CB2%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E';\n $linearGradient: linear-gradient(to bottom, #ffffff 0%, #ffffff 100%);\n $borderColor: #f1f1f1;\n\n display: block;\n font-family: sans-serif;\n font-weight: 600;\n color: #444;\n line-height: 1.3;\n padding: 0.6em 1.4em 0.5em 0.8em;\n width: 100%;\n max-width: 100%; /* useful when width is set to anything other than 100% */\n box-sizing: border-box;\n margin: 0;\n border: 1px solid $borderColor;\n box-shadow: transparent;\n border-radius: 0.5em;\n appearance: none;\n background-color: #fff;\n background-image: url($gradient), $linearGradient;\n background-repeat: no-repeat, repeat;\n /* arrow icon position (1em from the right, 50% vertical) , then gradient position*/\n background-position:\n right 0.7em top 50%,\n 0 0;\n /* icon size, then gradient */\n background-size:\n 0.65em auto,\n 100%;\n\n /* Hide arrow icon in IE browsers */\n &::-ms-expand {\n display: none;\n }\n /* Hover style */\n &:hover {\n border-color: rgb(197, 197, 197);\n }\n /* Focus style */\n &:focus {\n border-color: $borderColor;\n box-shadow: 0 0 1px 3px rgba(59, 153, 252, 0.7);\n box-shadow: 0 0 0 3px -moz-mac-focusring;\n color: #222;\n outline: none;\n }\n\n /* Set options to normal weight */\n option {\n font-weight: normal;\n }\n\n /* Disabled styles */\n &:disabled,\n &[aria-disabled='true'] {\n color: gray;\n background-image: url('data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22graytext%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E'),\n linear-gradient(to bottom, #ffffff 0%, #ffffff 100%);\n }\n\n &:disabled:hover,\n &[aria-disabled='true'] {\n border-color: $borderColor;\n }\n}\n\n.multi-filter-list {\n margin-top: 5px;\n margin-bottom: 5px;\n\n div {\n white-space: nowrap;\n }\n\n .multi-filter-list-action {\n display: flex;\n\n justify-content: space-between;\n align-items: center;\n }\n\n .and-or-button {\n margin: 0 0 0 10px;\n min-width: 58px;\n cursor: pointer;\n }\n .trash-button {\n $btn-remove-size: 22px;\n margin: 0 0 -2px 6px;\n cursor: pointer;\n\n width: $btn-remove-size;\n height: 100%;\n font-size: 16px;\n\n .trash-img {\n width: 1em;\n }\n }\n}\n\n.add-filter-divider {\n display: block;\n margin: 0 -10px 10px -10px;\n\n border-bottom: 1px solid #d9d9d9;\n height: 10px;\n}\n\n.select-input {\n display: flex;\n justify-content: space-between;\n align-items: center;\n}\n\nrevo-grid[theme^='dark'] {\n revogr-filter-panel {\n background-color: $el-color-dark;\n\n .add-filter-divider {\n border-bottom-color: $el-color-dark;\n }\n\n input[type=text] {\n background-color: $font-color-dark;\n color: black;\n }\n }\n}","// filter.panel.tsx\n\nimport {\n h,\n Component,\n Event,\n EventEmitter,\n Host,\n Listen,\n Method,\n Prop,\n State,\n type VNode,\n Element,\n} from '@stencil/core';\nimport debounce from 'lodash/debounce';\n\nimport { AndOrButton, isFilterBtn, TrashButton } from './filter.button';\nimport '../../utils/closest.polifill';\nimport {\n FilterCaptions,\n LogicFunction,\n MultiFilterItem,\n ShowData,\n} from './filter.types';\nimport type { ColumnProp } from '@type';\nimport { FilterType } from './filter.indexed';\n\nconst defaultType: FilterType = 'none';\n\nconst FILTER_LIST_CLASS = 'multi-filter-list';\nconst FILTER_LIST_CLASS_ACTION = 'multi-filter-list-action';\nconst FILTER_ID = 'add-filter';\n\n/**\n * Filter panel for editing filters\n */\n/**\n * @internal\n */\n@Component({\n tag: 'revogr-filter-panel',\n styleUrl: 'filter.style.scss',\n})\nexport class FilterPanel {\n private filterCaptionsInternal: FilterCaptions = {\n title: 'Filter by',\n ok: 'Ok',\n save: 'Save',\n // drops the filter\n reset: 'Reset',\n cancel: 'Cancel',\n add: 'Add condition',\n placeholder: 'Enter value...',\n and: 'and',\n or: 'or',\n };\n\n @Element() element!: HTMLElement;\n @State() isFilterIdSet = false;\n @State() filterId = 0;\n @State() currentFilterId = -1;\n @State() currentFilterType: FilterType = defaultType;\n @State() changes: ShowData | undefined;\n @State() filterItems: MultiFilterItem = {};\n @Prop() filterNames: Record<string, string> = {};\n @Prop() filterEntities: Record<string, LogicFunction> = {};\n @Prop() filterCaptions: Partial<FilterCaptions> | undefined;\n /**\n * Disables dynamic filtering. A way to apply filters on Save only\n */\n @Prop() disableDynamicFiltering = false;\n @Event() filterChange: EventEmitter<MultiFilterItem>;\n @Event() resetChange: EventEmitter<ColumnProp>;\n\n @Listen('mousedown', { target: 'document' }) onMouseDown(e: MouseEvent) {\n // click on anything then select drops values to default\n if (!this.changes || e.defaultPrevented) {\n return;\n }\n const path = e.composedPath();\n const select = document.getElementById(FILTER_ID);\n if (select instanceof HTMLSelectElement) {\n // click on select should be skipped\n if (path.includes(select)) {\n return;\n }\n select.value = defaultType;\n }\n this.currentFilterType = defaultType;\n if (this.changes) {\n this.changes.type = defaultType;\n }\n this.currentFilterId = -1;\n\n const isOutside = !path.includes(this.element);\n\n if (\n e.target instanceof HTMLElement &&\n isOutside &&\n !isFilterBtn(e.target)\n ) {\n this.changes = undefined;\n }\n }\n\n @Method() async show(newEntity?: ShowData) {\n this.changes = newEntity;\n this.filterItems = newEntity?.filterItems || {};\n if (this.changes) {\n this.changes.type = this.changes.type || defaultType;\n }\n }\n\n @Method() async getChanges() {\n return this.changes;\n }\n\n componentWillRender() {\n if (!this.isFilterIdSet) {\n this.isFilterIdSet = true;\n const filterItems = Object.keys(this.filterItems);\n for (const prop of filterItems) {\n // we set the proper filterId so there won't be any conflict when removing filters\n this.filterId += this.filterItems[prop].length;\n }\n }\n }\n\n getFilterItemsList() {\n const prop = this.changes?.prop;\n if (typeof prop === 'undefined') return '';\n\n const propFilters = this.filterItems[prop] ?? [];\n const capts = Object.assign(\n this.filterCaptionsInternal,\n this.filterCaptions,\n );\n return (\n <div key={this.filterId}>\n {propFilters.map((filter, index) => {\n let andOrButton;\n if (filter.hidden) {\n return;\n }\n\n // hide toggle button if there is only one filter and the last one\n if (index !== this.filterItems[prop].length - 1) {\n andOrButton = (\n <div onClick={() => this.toggleFilterAndOr(filter.id)}>\n <AndOrButton\n text={filter.relation === 'and' ? capts.and : capts.or}\n />\n </div>\n );\n }\n\n return (\n <div key={filter.id} class={FILTER_LIST_CLASS}>\n <div class={{ 'select-input': true }}>\n <select\n class=\"select-css select-filter\"\n onChange={e => this.onFilterTypeChange(e, prop, index)}\n >\n {this.renderSelectOptions(\n this.filterItems[prop][index].type,\n true,\n )}\n </select>\n <div class={FILTER_LIST_CLASS_ACTION}>{andOrButton}</div>\n <div onClick={() => this.onRemoveFilter(filter.id)}>\n <TrashButton />\n </div>\n </div>\n <div>{this.renderExtra(prop, index)}</div>\n </div>\n );\n })}\n\n {propFilters.filter(f => !f.hidden).length > 0 ? <div class=\"add-filter-divider\" /> : ''}\n </div>\n );\n }\n\n private autoCorrect(el?: HTMLElement | null) {\n if (!el) {\n return;\n }\n const pos = el.getBoundingClientRect();\n const maxLeft = window.innerWidth - pos.width;\n\n if (pos.left > maxLeft && el.offsetLeft) {\n el.style.left = `${maxLeft - (el.parentElement?.getBoundingClientRect().left ?? 0)}px`;\n }\n }\n\n private onFilterTypeChange(e: Event, prop: ColumnProp, index: number) {\n if (!(e.target instanceof HTMLSelectElement)) {\n return;\n }\n this.filterItems[prop][index].type = e.target.value as FilterType;\n\n // this re-renders the input to know if we need extra input\n this.filterId++;\n\n // adding setTimeout will wait for the next tick DOM update then focus on input\n setTimeout(() => {\n const input = document.getElementById(\n 'filter-input-' + this.filterItems[prop][index].id,\n );\n if (input instanceof HTMLInputElement) {\n input.focus();\n }\n }, 0);\n\n if (!this.disableDynamicFiltering) {\n this.debouncedApplyFilter();\n }\n }\n\n private debouncedApplyFilter = debounce(() => {\n this.filterChange.emit(this.filterItems);\n }, 400);\n\n private onAddNewFilter(e: Event) {\n const el = e.target as HTMLSelectElement;\n this.currentFilterType = el.value as FilterType;\n this.addNewFilterToProp();\n\n // reset value after adding new filter\n const select = document.getElementById('add-filter') as HTMLSelectElement;\n if (select) {\n select.value = defaultType;\n this.currentFilterType = defaultType;\n }\n\n if (!this.disableDynamicFiltering) {\n this.debouncedApplyFilter();\n }\n }\n\n private addNewFilterToProp() {\n const prop = this.changes?.prop;\n if (!(prop || prop === 0)) return;\n\n if (!this.filterItems[prop]) {\n this.filterItems[prop] = [];\n }\n\n if (this.currentFilterType === 'none') return;\n\n this.filterId++;\n this.currentFilterId = this.filterId;\n\n this.filterItems[prop].push({\n id: this.currentFilterId,\n type: this.currentFilterType,\n value: '',\n relation: 'and',\n });\n\n // adding setTimeout will wait for the next tick DOM update then focus on input\n setTimeout(() => {\n const input = document.getElementById(\n 'filter-input-' + this.currentFilterId,\n ) as HTMLInputElement;\n if (input) input.focus();\n }, 0);\n }\n\n private onUserInput(index: number, prop: ColumnProp, event: Event) {\n // update the value of the filter item\n this.filterItems[prop][index].value = (\n event.target as HTMLInputElement\n ).value;\n\n if (!this.disableDynamicFiltering) {\n this.debouncedApplyFilter();\n }\n }\n\n private onKeyDown(e: KeyboardEvent) {\n if (e.key.toLowerCase() === 'enter') {\n const select = document.getElementById('add-filter') as HTMLSelectElement;\n if (select) {\n select.value = defaultType;\n this.currentFilterType = defaultType;\n this.addNewFilterToProp();\n select.focus();\n }\n return;\n }\n // keep event local, don't escalate farther to dom\n e.stopPropagation();\n }\n\n private onSave() {\n this.filterChange.emit(this.filterItems);\n }\n\n private onCancel() {\n this.changes = undefined;\n }\n\n private onReset() {\n this.assertChanges();\n\n this.resetChange.emit(this.changes?.prop);\n\n // this updates the DOM which is used by getFilterItemsList() key\n this.filterId++;\n }\n\n private onRemoveFilter(id: number) {\n this.assertChanges();\n\n // this is for reactivity issues for getFilterItemsList()\n this.filterId++;\n\n const prop = this.changes?.prop;\n\n const items = this.filterItems[prop ?? ''];\n if (!items) return;\n\n const index = items.findIndex(d => d.id === id);\n if (index === -1) return;\n items.splice(index, 1);\n\n // let's remove the prop if no more filters so the filter icon will be removed\n if (items.length === 0) delete this.filterItems[prop ?? ''];\n\n if (!this.disableDynamicFiltering) {\n this.debouncedApplyFilter();\n }\n }\n\n private toggleFilterAndOr(id: number) {\n this.assertChanges();\n\n // this is for reactivity issues for getFilterItemsList()\n this.filterId++;\n\n const prop = this.changes?.prop;\n\n const items = this.filterItems[prop ?? ''];\n if (!items) return;\n\n const index = items.findIndex(d => d.id === id);\n if (index === -1) return;\n\n items[index].relation = items[index].relation === 'and' ? 'or' : 'and';\n if (!this.disableDynamicFiltering) {\n this.debouncedApplyFilter();\n }\n }\n\n private assertChanges() {\n if (!this.changes) {\n throw new Error('Changes required per edit');\n }\n }\n\n renderSelectOptions(type: FilterType, isDefaultTypeRemoved = false) {\n if (!this.changes) {\n return;\n }\n const options: VNode[] = [];\n const prop = this.changes.prop;\n\n const hidden = new Set<string>();\n Object.entries(this.filterItems).forEach(([_, values]) => {\n values.forEach((filter) => {\n if (filter.hidden) {\n hidden.add(filter.type);\n }\n })\n });\n\n if (!isDefaultTypeRemoved) {\n const capts = Object.assign(\n this.filterCaptionsInternal,\n this.filterCaptions,\n );\n\n options.push(\n <option\n selected={this.currentFilterType === defaultType}\n value={defaultType}\n >\n {prop && this.filterItems[prop] && this.filterItems[prop].length > 0\n ? capts.add\n : this.filterNames[defaultType]}\n </option>,\n );\n }\n\n for (let gIndex in this.changes.filterTypes) {\n const group = this.changes.filterTypes[gIndex].filter(k => !hidden.has(k));\n if (group.length) {\n options.push(\n ...group.map(k => (\n <option value={k} selected={type === k}>\n {this.filterNames[k]}\n </option>\n )),\n );\n options.push(<option disabled></option>);\n }\n }\n return options;\n }\n\n renderExtra(prop: ColumnProp, index: number) {\n const currentFilter = this.filterItems[prop];\n\n if (!currentFilter) return '';\n\n if (this.filterEntities[currentFilter[index].type].extra !== 'input')\n return '';\n\n const capts = Object.assign(\n this.filterCaptionsInternal,\n this.filterCaptions,\n );\n\n return (\n <input\n id={`filter-input-${currentFilter[index].id}`}\n placeholder={capts.placeholder}\n type=\"text\"\n value={currentFilter[index].value}\n onInput={this.onUserInput.bind(this, index, prop)}\n onKeyDown={e => this.onKeyDown(e)}\n />\n );\n }\n\n render() {\n if (!this.changes) {\n return <Host style={{ display: 'none' }}></Host>;\n }\n const style = {\n display: 'block',\n left: `${this.changes.x}px`,\n top: `${this.changes.y}px`,\n };\n\n const capts = Object.assign(\n this.filterCaptionsInternal,\n this.filterCaptions,\n );\n\n return (\n <Host\n style={style}\n ref={el => {\n this.changes?.autoCorrect && this.autoCorrect(el);\n }}\n >\n <slot slot=\"header\" />\n { this.changes.extraContent?.(this.changes) || '' }\n\n { this.changes?.hideDefaultFilters !== true && (\n [\n <label>{capts.title}</label>,\n <div class=\"filter-holder\">{this.getFilterItemsList()}</div>,\n <div class=\"add-filter\">\n <select\n id={FILTER_ID}\n class=\"select-css\"\n onChange={e => this.onAddNewFilter(e)}\n >\n {this.renderSelectOptions(this.currentFilterType)}\n </select>\n </div>\n ]\n )}\n\n <slot />\n <div class=\"filter-actions\">\n {this.disableDynamicFiltering && [\n <button\n id=\"revo-button-save\"\n aria-label=\"save\"\n class=\"revo-button green\"\n onClick={() => this.onSave()}\n >\n {capts.save}\n </button>,\n <button\n id=\"revo-button-ok\"\n aria-label=\"ok\"\n class=\"revo-button green\"\n onClick={() => this.onCancel()}\n >\n {capts.cancel}\n </button>,\n ]}\n {!this.disableDynamicFiltering && [\n <button\n id=\"revo-button-ok\"\n aria-label=\"ok\"\n class=\"revo-button green\"\n onClick={() => this.onCancel()}\n >\n {capts.ok}\n </button>,\n\n <button\n id=\"revo-button-reset\"\n aria-label=\"reset\"\n class=\"revo-button outline\"\n onClick={() => this.onReset()}\n >\n {capts.reset}\n </button>,\n ]}\n </div>\n <slot slot=\"footer\" />\n </Host>\n );\n }\n}\n"],"version":3}
|
|
@@ -126,15 +126,31 @@ const RevogrScrollVirtual = /*@__PURE__*/ proxyCustomElement(class RevogrScrollV
|
|
|
126
126
|
}
|
|
127
127
|
componentDidRender() {
|
|
128
128
|
const type = this.dimension === 'rgRow' ? 'scrollHeight' : 'scrollWidth';
|
|
129
|
-
|
|
130
|
-
|
|
129
|
+
// Get scrollbar size once during component initialization
|
|
130
|
+
const scrollbarSize = this.scrollSize;
|
|
131
|
+
// Calculate if content exceeds viewport size
|
|
132
|
+
// Add scrollbar size to the comparison to account for other dimension's scrollbar
|
|
133
|
+
const hasScroll = this.element[type] > this.size + scrollbarSize;
|
|
134
|
+
// Set scroll size based on whether scroll is needed
|
|
135
|
+
this.size = hasScroll ? this.scrollSize : 0;
|
|
136
|
+
let additionalScrollbarSize = 0;
|
|
137
|
+
if (this.dimension === 'rgRow') {
|
|
138
|
+
additionalScrollbarSize =
|
|
139
|
+
this.element.scrollWidth > this.element.clientWidth
|
|
140
|
+
? scrollbarSize
|
|
141
|
+
: 0;
|
|
131
142
|
}
|
|
132
143
|
else {
|
|
133
|
-
|
|
144
|
+
additionalScrollbarSize =
|
|
145
|
+
this.element.scrollHeight > this.element.clientHeight
|
|
146
|
+
? scrollbarSize
|
|
147
|
+
: 0;
|
|
134
148
|
}
|
|
149
|
+
const clientSize = this.size + additionalScrollbarSize;
|
|
135
150
|
this.localScrollService.setParams({
|
|
136
151
|
contentSize: this.dimensionStore.get('realSize'),
|
|
137
|
-
clientSize
|
|
152
|
+
// Add scrollbar size to clientSize if other dimension has scroll
|
|
153
|
+
clientSize,
|
|
138
154
|
virtualSize: this.viewportStore.get('clientSize'),
|
|
139
155
|
}, this.dimension);
|
|
140
156
|
}
|
|
@@ -155,9 +171,8 @@ const RevogrScrollVirtual = /*@__PURE__*/ proxyCustomElement(class RevogrScrollV
|
|
|
155
171
|
}
|
|
156
172
|
render() {
|
|
157
173
|
const sizeType = this.dimension === 'rgRow' ? 'height' : 'width';
|
|
158
|
-
const size = getContentSize(this.dimensionStore.get('realSize'), this.size, this.viewportStore.get('clientSize')
|
|
159
|
-
)
|
|
160
|
-
return (h(Host, { key: '2d11902403db45b805bde88b6fc40acff4b6b910', onScroll: (e) => this.onScroll(e) }, h("div", { key: '74978e90cbf66e3fb6dcc25bd5882346f1515c39', style: {
|
|
174
|
+
const size = getContentSize(this.dimensionStore.get('realSize'), this.size, this.viewportStore.get('clientSize'));
|
|
175
|
+
return (h(Host, { key: '7789bd408d3e154836bcd2aed4ebaa1663e7f968', onScroll: (e) => this.onScroll(e) }, h("div", { key: '40549da97df3a580ad2ddef13fe7b4dbe6df54bc', style: {
|
|
161
176
|
[sizeType]: `${size}px`,
|
|
162
177
|
} })));
|
|
163
178
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"file":"revogr-scroll-virtual2.js","mappings":";;;;;;;AAEA;;;MAGa,oBAAoB;IAE/B,YAAoB,OAAoB;QAApB,YAAO,GAAP,OAAO,CAAa;QADhC,0BAAqB,GAAG,CAAC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AAU,EAAE,IAAI,CAAC,IAAI;YACrB,WAAW,EAAE,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,YAAY,CAAC;SAClD,EACD,IAAI,CAAC,SAAS,CACf,CAAC;KACH;IAED,QAAQ,CAAC,CAAa;;QACpB,IAAI,EAAE,CAAC,CAAC,MAAM,YAAY,OAAO,CAAC,EAAE;YAClC,OAAO;SACR;QACD,MAAM,MAAM,GAAG,CAAC,CAAC,MAAM,CAAC;QACxB,IAAI,IAAI,GAA+B,YAAY,CAAC;QACpD,IAAI,IAAI,CAAC,SAAS,KAAK,OAAO,EAAE;YAC9B,IAAI,GAAG,WAAW,CAAC;SACpB;;QAED,IAAI,IAAI,CAAC,gBAAgB,CAAC,OAAO,CAAC,IAAI,CAAC,SAAS,EAAE,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,EAAE;YACpE,MAAA,IAAI,CAAC,kBAAkB,0CAAE,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;SACpE;KACF;IAED,MAAM;QACJ,MAAM,QAAQ,GAAG,IAAI,CAAC,SAAS,KAAK,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAC;QACjE,MAAM,IAAI,GAAG,cAAc,CACzB,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,UAAU,CAAC,EACnC,IAAI,CAAC,IAAI,EACT,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,YAAY,CAAC;SACrC,CAAC;QACF,QACE,EAAC,IAAI,qDAAC,QAAQ,EAAE,CAAC,CAAa,KAAK,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,IACjD,4DACE,KAAK,EAAE;gBACL,CAAC,QAAQ,GAAG,GAAG,IAAI,IAAI;aACxB,GACD,CACG,EACP;KACH;;;;;;;;;;;;;;;;;;;;;;;;;;","names":[],"sources":["src/components/scrollable/autohide-scroll.plugin.ts","src/components/scrollable/revogr-scroll-style.scss?tag=revogr-scroll-virtual","src/components/scrollable/revogr-scroll-virtual.tsx"],"sourcesContent":["\n\n/**\n * Autohide scroll for MacOS when scroll is visible only for 1 sec\n */\nexport class AutohideScrollPlugin {\n private autohideScrollTimeout = 0;\n constructor(private element: HTMLElement) {\n }\n\n /**\n * When scroll size updates set it up for autohide\n */\n setScrollSize(s: number) {\n if (!s) {\n this.element.setAttribute('autohide', 'true');\n } else {\n this.element.removeAttribute('autohide');\n }\n }\n\n /**\n * On each scroll check if it's time to show\n */\n checkScroll({\n scrollSize,\n contentSize,\n virtualSize,\n }: {\n scrollSize: number;\n contentSize: number;\n virtualSize: number;\n }) {\n const hasScroll = contentSize > virtualSize;\n const isHidden = !scrollSize && hasScroll;\n if (isHidden) {\n this.element.setAttribute('visible', 'true');\n this.autohideScrollTimeout = this.show(\n this.element,\n this.autohideScrollTimeout,\n );\n }\n }\n\n private show(element?: HTMLElement, timeout?: number): number {\n clearTimeout(timeout);\n return Number(\n setTimeout(() => {\n element?.removeAttribute('visible');\n }, 1000),\n );\n }\n clear() {\n clearTimeout(this.autohideScrollTimeout);\n }\n}\n","revogr-scroll-virtual {\n $min-size: 20px;\n\n // show scroll only for 1 sec\n &[autohide] {\n position: absolute;\n z-index: 100 !important;\n\n &.vertical {\n top: 0;\n right: 0;\n\n &[visible] {\n min-width: $min-size !important;\n }\n }\n\n &.horizontal {\n bottom: 0;\n left: 0;\n\n &[visible] {\n min-height: $min-size !important;\n }\n }\n }\n\n &.vertical {\n overflow-y: auto;\n overflow-x: hidden;\n height: 100%;\n\n > div {\n width: 1px;\n }\n }\n\n &.horizontal {\n overflow-x: auto;\n overflow-y: hidden;\n width: 100%;\n\n > div {\n height: 1px;\n }\n }\n}\n","import {\n Component,\n Element as StencilElement,\n Event,\n EventEmitter,\n h,\n Host,\n Method,\n Prop,\n} from '@stencil/core';\nimport LocalScrollService, { getContentSize } from '../../services/local.scroll.service';\nimport type {\n DimensionType,\n ViewportState,\n DimensionSettingsState,\n ViewPortScrollEvent,\n} from '@type';\nimport { AutohideScrollPlugin } from './autohide-scroll.plugin';\nimport { LocalScrollTimer } from '../../services/local.scroll.timer';\nimport { type Observable, getScrollbarSize } from '../../utils';\n\n/**\n * Virtual scroll component\n */\n@Component({\n tag: 'revogr-scroll-virtual',\n styleUrl: 'revogr-scroll-style.scss',\n})\nexport class RevogrScrollVirtual {\n /**\n * Scroll dimension (`X` - `rgCol` or `Y` - `rgRow`)\n */\n @Prop() dimension: DimensionType = 'rgRow';\n\n /**\n * Viewport\n */\n @Prop() viewportStore!: Observable<ViewportState>;\n /**\n * Dimensions\n */\n @Prop() dimensionStore!: Observable<DimensionSettingsState>;\n\n /**\n * Scroll event\n */\n @Event({ eventName: 'scrollvirtual' })\n scrollVirtual: EventEmitter<ViewPortScrollEvent>;\n\n @StencilElement() element: HTMLElement;\n private autohideScrollPlugin: AutohideScrollPlugin;\n private scrollSize = 0;\n private localScrollService: LocalScrollService;\n private localScrollTimer: LocalScrollTimer;\n\n @Method()\n async setScroll(e: ViewPortScrollEvent): Promise<void> {\n if (this.dimension !== e.dimension) {\n return;\n }\n this.localScrollTimer.latestScrollUpdate(e.dimension);\n this.localScrollService?.setScroll(e);\n if (e.coordinate) {\n this.autohideScrollPlugin.checkScroll({\n scrollSize: this.scrollSize,\n contentSize: this.dimensionStore.get('realSize'),\n virtualSize: this.viewportStore.get('virtualSize'),\n });\n }\n }\n\n /**\n * Update if `delta` exists in case we don't know current position or if it's external change\n */\n @Method()\n async changeScroll(e: ViewPortScrollEvent): Promise<ViewPortScrollEvent> {\n if (e.delta) {\n switch (e.dimension) {\n case 'rgCol':\n e.coordinate = this.element.scrollLeft + e.delta;\n break;\n case 'rgRow':\n e.coordinate = this.element.scrollTop + e.delta;\n break;\n }\n this.setScroll(e);\n }\n return e;\n }\n\n set size(s: number) {\n this.autohideScrollPlugin.setScrollSize(s);\n if (this.dimension === 'rgRow') {\n this.element.style.minWidth = `${s}px`;\n return;\n }\n this.element.style.minHeight = `${s}px`;\n }\n\n get size(): number {\n if (this.dimension === 'rgRow') {\n return this.element.clientHeight;\n }\n return this.element.clientWidth;\n }\n\n connectedCallback() {\n this.autohideScrollPlugin = new AutohideScrollPlugin(this.element);\n this.localScrollTimer = new LocalScrollTimer('ontouchstart' in document.documentElement ? 0 : 10);\n this.localScrollService = new LocalScrollService({\n runScroll: e => this.scrollVirtual.emit(e),\n applyScroll: e => {\n this.localScrollTimer.setCoordinate(e);\n const type = e.dimension === 'rgRow' ? 'scrollTop' : 'scrollLeft';\n // this will trigger on scroll event\n this.element[type] = e.coordinate;\n },\n });\n }\n\n disconnectedCallback() {\n this.autohideScrollPlugin.clear();\n }\n\n componentWillLoad() {\n this.scrollSize = getScrollbarSize(document);\n }\n\n componentDidRender() {\n const type = this.dimension === 'rgRow' ? 'scrollHeight' : 'scrollWidth';\n if (this.element[type] > this.size) {\n this.size = this.scrollSize;\n } else {\n this.size = 0;\n }\n this.localScrollService.setParams(\n {\n contentSize: this.dimensionStore.get('realSize'),\n clientSize: this.size,\n virtualSize: this.viewportStore.get('clientSize'),\n },\n this.dimension,\n );\n }\n\n onScroll(e: MouseEvent) {\n if (!(e.target instanceof Element)) {\n return;\n }\n const target = e.target;\n let type: 'scrollLeft' | 'scrollTop' = 'scrollLeft';\n if (this.dimension === 'rgRow') {\n type = 'scrollTop';\n }\n // apply after throttling\n if (this.localScrollTimer.isReady(this.dimension, target[type] || 0)) {\n this.localScrollService?.scroll(target[type] || 0, this.dimension);\n }\n }\n\n render() {\n const sizeType = this.dimension === 'rgRow' ? 'height' : 'width';\n const size = getContentSize(\n this.dimensionStore.get('realSize'),\n this.size,\n this.viewportStore.get('clientSize') // content viewport size\n );\n return (\n <Host onScroll={(e: MouseEvent) => this.onScroll(e)}>\n <div\n style={{\n [sizeType]: `${size}px`,\n }}\n />\n </Host>\n );\n }\n}\n"],"version":3}
|
|
1
|
+
{"file":"revogr-scroll-virtual2.js","mappings":";;;;;;;AAEA;;;MAGa,oBAAoB;IAE/B,YAAoB,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,QAAQ,GAAG,OAAO,CAAC;QACjE,MAAM,IAAI,GAAG,cAAc,CACzB,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,UAAU,CAAC,EACnC,IAAI,CAAC,IAAI,EACT,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,YAAY,CAAC,CACrC,CAAC;QACF,QACE,EAAC,IAAI,qDAAC,QAAQ,EAAE,CAAC,CAAa,KAAK,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,IACjD,4DACE,KAAK,EAAE;gBACL,CAAC,QAAQ,GAAG,GAAG,IAAI,IAAI;aACxB,GACD,CACG,EACP;KACH;;;;;;;;;;;;;;;;;;;;;;;;;;","names":[],"sources":["src/components/scrollable/autohide-scroll.plugin.ts","src/components/scrollable/revogr-scroll-style.scss?tag=revogr-scroll-virtual","src/components/scrollable/revogr-scroll-virtual.tsx"],"sourcesContent":["\n\n/**\n * Autohide scroll for MacOS when scroll is visible only for 1 sec\n */\nexport class AutohideScrollPlugin {\n private autohideScrollTimeout = 0;\n constructor(private element: HTMLElement) {\n }\n\n /**\n * When scroll size updates set it up for autohide\n */\n setScrollSize(s: number) {\n if (!s) {\n this.element.setAttribute('autohide', 'true');\n } else {\n this.element.removeAttribute('autohide');\n }\n }\n\n /**\n * On each scroll check if it's time to show\n */\n checkScroll({\n scrollSize,\n contentSize,\n virtualSize,\n }: {\n scrollSize: number;\n contentSize: number;\n virtualSize: number;\n }) {\n const hasScroll = contentSize > virtualSize;\n const isHidden = !scrollSize && hasScroll;\n if (isHidden) {\n this.element.setAttribute('visible', 'true');\n this.autohideScrollTimeout = this.show(\n this.element,\n this.autohideScrollTimeout,\n );\n }\n }\n\n private show(element?: HTMLElement, timeout?: number): number {\n clearTimeout(timeout);\n return Number(\n setTimeout(() => {\n element?.removeAttribute('visible');\n }, 1000),\n );\n }\n clear() {\n clearTimeout(this.autohideScrollTimeout);\n }\n}\n","revogr-scroll-virtual {\n $min-size: 20px;\n\n // show scroll only for 1 sec\n &[autohide] {\n position: absolute;\n z-index: 100 !important;\n\n &.vertical {\n top: 0;\n right: 0;\n\n &[visible] {\n min-width: $min-size !important;\n }\n }\n\n &.horizontal {\n bottom: 0;\n left: 0;\n\n &[visible] {\n min-height: $min-size !important;\n }\n }\n }\n\n &.vertical {\n overflow-y: auto;\n overflow-x: hidden;\n height: 100%;\n\n > div {\n width: 1px;\n }\n }\n\n &.horizontal {\n overflow-x: auto;\n overflow-y: hidden;\n width: 100%;\n\n > div {\n height: 1px;\n }\n }\n}\n","import {\n Component,\n Element as StencilElement,\n Event,\n EventEmitter,\n h,\n Host,\n Method,\n Prop,\n} from '@stencil/core';\nimport LocalScrollService, {\n getContentSize,\n} from '../../services/local.scroll.service';\nimport type {\n DimensionType,\n ViewportState,\n DimensionSettingsState,\n ViewPortScrollEvent,\n} from '@type';\nimport { AutohideScrollPlugin } from './autohide-scroll.plugin';\nimport { LocalScrollTimer } from '../../services/local.scroll.timer';\nimport { type Observable, getScrollbarSize } from '../../utils';\n\n/**\n * Virtual scroll component\n */\n@Component({\n tag: 'revogr-scroll-virtual',\n styleUrl: 'revogr-scroll-style.scss',\n})\nexport class RevogrScrollVirtual {\n /**\n * Scroll dimension (`X` - `rgCol` or `Y` - `rgRow`)\n */\n @Prop() dimension: DimensionType = 'rgRow';\n\n /**\n * Viewport\n */\n @Prop() viewportStore!: Observable<ViewportState>;\n /**\n * Dimensions\n */\n @Prop() dimensionStore!: Observable<DimensionSettingsState>;\n\n /**\n * Scroll event\n */\n @Event({ eventName: 'scrollvirtual' })\n scrollVirtual: EventEmitter<ViewPortScrollEvent>;\n\n @StencilElement() element: HTMLElement;\n private autohideScrollPlugin: AutohideScrollPlugin;\n private scrollSize = 0;\n private localScrollService: LocalScrollService;\n private localScrollTimer: LocalScrollTimer;\n\n @Method()\n async setScroll(e: ViewPortScrollEvent): Promise<void> {\n if (this.dimension !== e.dimension) {\n return;\n }\n this.localScrollTimer.latestScrollUpdate(e.dimension);\n this.localScrollService?.setScroll(e);\n if (e.coordinate) {\n this.autohideScrollPlugin.checkScroll({\n scrollSize: this.scrollSize,\n contentSize: this.dimensionStore.get('realSize'),\n virtualSize: this.viewportStore.get('virtualSize'),\n });\n }\n }\n\n /**\n * Update if `delta` exists in case we don't know current position or if it's external change\n */\n @Method()\n async changeScroll(e: ViewPortScrollEvent): Promise<ViewPortScrollEvent> {\n if (e.delta) {\n switch (e.dimension) {\n case 'rgCol':\n e.coordinate = this.element.scrollLeft + e.delta;\n break;\n case 'rgRow':\n e.coordinate = this.element.scrollTop + e.delta;\n break;\n }\n this.setScroll(e);\n }\n return e;\n }\n\n set size(s: number) {\n this.autohideScrollPlugin.setScrollSize(s);\n if (this.dimension === 'rgRow') {\n this.element.style.minWidth = `${s}px`;\n return;\n }\n this.element.style.minHeight = `${s}px`;\n }\n\n get size(): number {\n if (this.dimension === 'rgRow') {\n return this.element.clientHeight;\n }\n return this.element.clientWidth;\n }\n\n connectedCallback() {\n this.autohideScrollPlugin = new AutohideScrollPlugin(this.element);\n this.localScrollTimer = new LocalScrollTimer(\n 'ontouchstart' in document.documentElement ? 0 : 10,\n );\n this.localScrollService = new LocalScrollService({\n runScroll: e => this.scrollVirtual.emit(e),\n applyScroll: e => {\n this.localScrollTimer.setCoordinate(e);\n const type = e.dimension === 'rgRow' ? 'scrollTop' : 'scrollLeft';\n // this will trigger on scroll event\n this.element[type] = e.coordinate;\n },\n });\n }\n\n disconnectedCallback() {\n this.autohideScrollPlugin.clear();\n }\n\n componentWillLoad() {\n this.scrollSize = getScrollbarSize(document);\n }\n\n componentDidRender() {\n const type = this.dimension === 'rgRow' ? 'scrollHeight' : 'scrollWidth';\n // Get scrollbar size once during component initialization\n const scrollbarSize = this.scrollSize;\n // Calculate if content exceeds viewport size\n // Add scrollbar size to the comparison to account for other dimension's scrollbar\n const hasScroll = this.element[type] > this.size + scrollbarSize;\n // Set scroll size based on whether scroll is needed\n this.size = hasScroll ? this.scrollSize : 0;\n\n let additionalScrollbarSize = 0;\n if (this.dimension === 'rgRow') {\n additionalScrollbarSize =\n this.element.scrollWidth > this.element.clientWidth\n ? scrollbarSize\n : 0;\n } else {\n additionalScrollbarSize =\n this.element.scrollHeight > this.element.clientHeight\n ? scrollbarSize\n : 0;\n }\n\n const clientSize = this.size + additionalScrollbarSize;\n\n this.localScrollService.setParams(\n {\n contentSize: this.dimensionStore.get('realSize'),\n // Add scrollbar size to clientSize if other dimension has scroll\n clientSize,\n virtualSize: this.viewportStore.get('clientSize'),\n },\n this.dimension,\n );\n }\n\n onScroll(e: MouseEvent) {\n if (!(e.target instanceof Element)) {\n return;\n }\n const target = e.target;\n let type: 'scrollLeft' | 'scrollTop' = 'scrollLeft';\n if (this.dimension === 'rgRow') {\n type = 'scrollTop';\n }\n // apply after throttling\n if (this.localScrollTimer.isReady(this.dimension, target[type] || 0)) {\n this.localScrollService?.scroll(target[type] || 0, this.dimension);\n }\n }\n\n render() {\n const sizeType = this.dimension === 'rgRow' ? 'height' : 'width';\n const size = getContentSize(\n this.dimensionStore.get('realSize'),\n this.size,\n this.viewportStore.get('clientSize'), // content viewport size\n );\n return (\n <Host onScroll={(e: MouseEvent) => this.onScroll(e)}>\n <div\n style={{\n [sizeType]: `${size}px`,\n }}\n />\n </Host>\n );\n }\n}\n"],"version":3}
|
|
@@ -59,16 +59,31 @@ async function resizeObserver() {
|
|
|
59
59
|
}
|
|
60
60
|
|
|
61
61
|
class GridResizeService {
|
|
62
|
-
constructor(el,
|
|
63
|
-
this.
|
|
62
|
+
constructor(el, resize) {
|
|
63
|
+
this.resize = resize;
|
|
64
64
|
this.resizeObserver = null;
|
|
65
|
-
this.
|
|
65
|
+
this.previousSize = {
|
|
66
|
+
width: 0,
|
|
67
|
+
height: 0,
|
|
68
|
+
};
|
|
69
|
+
this.apply = throttle((e) => {
|
|
70
|
+
var _a;
|
|
71
|
+
if (!e.length) {
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
const entry = {
|
|
75
|
+
width: e[0].contentRect.width,
|
|
76
|
+
height: e[0].contentRect.height,
|
|
77
|
+
};
|
|
78
|
+
(_a = this.resize) === null || _a === void 0 ? void 0 : _a.call(this, entry, this.previousSize);
|
|
79
|
+
this.previousSize = entry;
|
|
80
|
+
}, 10);
|
|
66
81
|
this.init(el);
|
|
67
82
|
}
|
|
68
83
|
async init(el) {
|
|
69
84
|
var _a;
|
|
70
85
|
await resizeObserver();
|
|
71
|
-
this.resizeObserver = new ResizeObserver(this.
|
|
86
|
+
this.resizeObserver = new ResizeObserver(this.apply);
|
|
72
87
|
(_a = this.resizeObserver) === null || _a === void 0 ? void 0 : _a.observe(el);
|
|
73
88
|
}
|
|
74
89
|
destroy() {
|
|
@@ -185,38 +200,45 @@ const RevogrViewportScroll = /*@__PURE__*/ proxyCustomElement(class RevogrViewpo
|
|
|
185
200
|
}
|
|
186
201
|
componentDidLoad() {
|
|
187
202
|
// track horizontal viewport resize
|
|
188
|
-
this.resizeService = new GridResizeService(this.horizontalScroll, {
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
203
|
+
this.resizeService = new GridResizeService(this.horizontalScroll, (entry, previousSize) => {
|
|
204
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
205
|
+
const els = {};
|
|
206
|
+
if (entry.height !== previousSize.height) {
|
|
207
|
+
let height = entry.height || 0;
|
|
192
208
|
if (height) {
|
|
193
|
-
height -=
|
|
209
|
+
height -=
|
|
210
|
+
((_b = (_a = this.header) === null || _a === void 0 ? void 0 : _a.clientHeight) !== null && _b !== void 0 ? _b : 0) +
|
|
211
|
+
((_d = (_c = this.footer) === null || _c === void 0 ? void 0 : _c.clientHeight) !== null && _d !== void 0 ? _d : 0);
|
|
194
212
|
}
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
213
|
+
els.rgRow = {
|
|
214
|
+
size: height,
|
|
215
|
+
contentSize: this.contentHeight,
|
|
216
|
+
scroll: (_f = (_e = this.verticalScroll) === null || _e === void 0 ? void 0 : _e.scrollTop) !== null && _f !== void 0 ? _f : 0,
|
|
217
|
+
noScroll: false,
|
|
218
|
+
};
|
|
219
|
+
}
|
|
220
|
+
if (entry.width !== previousSize.width) {
|
|
221
|
+
els.rgCol = {
|
|
222
|
+
size: entry.width || 0,
|
|
223
|
+
contentSize: this.contentWidth,
|
|
224
|
+
scroll: this.horizontalScroll.scrollLeft,
|
|
225
|
+
noScroll: this.colType !== 'rgCol',
|
|
208
226
|
};
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
227
|
+
}
|
|
228
|
+
for (const [dim, item] of Object.entries(els)) {
|
|
229
|
+
const dimension = dim;
|
|
230
|
+
this.resizeViewport.emit({
|
|
231
|
+
dimension,
|
|
232
|
+
size: item.size,
|
|
233
|
+
rowHeader: this.rowHeader,
|
|
234
|
+
});
|
|
235
|
+
if (item.noScroll) {
|
|
236
|
+
continue;
|
|
218
237
|
}
|
|
219
|
-
|
|
238
|
+
(_g = this.localScrollService) === null || _g === void 0 ? void 0 : _g.scroll((_h = item.scroll) !== null && _h !== void 0 ? _h : 0, dimension, true);
|
|
239
|
+
// track scroll visibility on outer element change
|
|
240
|
+
this.setScrollVisibility(dimension, item.size, item.contentSize);
|
|
241
|
+
}
|
|
220
242
|
});
|
|
221
243
|
}
|
|
222
244
|
/**
|
|
@@ -269,7 +291,7 @@ const RevogrViewportScroll = /*@__PURE__*/ proxyCustomElement(class RevogrViewpo
|
|
|
269
291
|
this.setScrollVisibility('rgCol', this.horizontalScroll.clientWidth, this.contentWidth);
|
|
270
292
|
}
|
|
271
293
|
render() {
|
|
272
|
-
return (h(Host, { key: '
|
|
294
|
+
return (h(Host, { key: '970ac2365588d1c894d9684113eb9beaf64e1a1d', onWheel: this.horizontalMouseWheel, onScroll: (e) => this.applyScroll('rgCol', e) }, h("div", { key: 'dc57aab1bde4496e83131d80a7e189db25b93312', class: "inner-content-table", style: { width: `${this.contentWidth}px` } }, h("div", { key: 'bd014cf0a67bb913016f00f7838344611a1b26df', class: "header-wrapper", ref: e => (this.header = e) }, h("slot", { key: '772eb408b6ea670624cc338550215565ec36ef89', name: HEADER_SLOT })), h("div", { key: '5dcf061c78864b0dc4e4ffbcc28c0ebb3536ce8b', class: "vertical-inner", ref: el => (this.verticalScroll = el), onWheel: this.verticalMouseWheel, onScroll: (e) => this.applyScroll('rgRow', e) }, h("div", { key: 'b45f46aedefe82843b086cdca822e05339a77fda', class: "content-wrapper", style: { height: `${this.contentHeight}px` } }, h("slot", { key: '8d07196c79741ace0f4c734138d69abdf96fee4f', name: CONTENT_SLOT }))), h("div", { key: 'f6313f9394e99a3ad07895ed06e965540268b35a', class: "footer-wrapper", ref: e => (this.footer = e) }, h("slot", { key: 'b1bcdb75bb5e4dcc1e43493d7b4f01b2578352e4', name: FOOTER_SLOT })))));
|
|
273
295
|
}
|
|
274
296
|
/**
|
|
275
297
|
* Extra layer for scroll event monitoring, where MouseWheel event is not passing
|
|
@@ -317,7 +339,7 @@ const RevogrViewportScroll = /*@__PURE__*/ proxyCustomElement(class RevogrViewpo
|
|
|
317
339
|
const clientHeight = (_d = (_c = this.verticalScroll) === null || _c === void 0 ? void 0 : _c.clientHeight) !== null && _d !== void 0 ? _d : 0;
|
|
318
340
|
const scrollHeight = (_f = (_e = this.verticalScroll) === null || _e === void 0 ? void 0 : _e.scrollHeight) !== null && _f !== void 0 ? _f : 0;
|
|
319
341
|
// Detect if the user has reached the bottom
|
|
320
|
-
const atBottom =
|
|
342
|
+
const atBottom = scrollTop + clientHeight >= scrollHeight && e.deltaY > 0;
|
|
321
343
|
const atTop = scrollTop === 0 && e.deltaY < 0;
|
|
322
344
|
if (!atBottom && !atTop) {
|
|
323
345
|
(_g = e.preventDefault) === null || _g === void 0 ? void 0 : _g.call(e);
|
|
@@ -339,7 +361,7 @@ const RevogrViewportScroll = /*@__PURE__*/ proxyCustomElement(class RevogrViewpo
|
|
|
339
361
|
}
|
|
340
362
|
const { scrollLeft, scrollWidth, clientWidth } = this.horizontalScroll;
|
|
341
363
|
// Detect if the user has reached the right end
|
|
342
|
-
const atRight =
|
|
364
|
+
const atRight = scrollLeft + clientWidth >= scrollWidth && e.deltaX > 0;
|
|
343
365
|
// Detect if the user has reached the left end
|
|
344
366
|
const atLeft = scrollLeft === 0 && e.deltaX < 0;
|
|
345
367
|
if (!atRight && !atLeft) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"file":"revogr-viewport-scroll2.js","mappings":";;;;;;;AAAA;;;AAMA;;;MAGa,WAAW,GAAG,SAAS;MACvB,WAAW,GAAG,SAAS;MACvB,YAAY,GAAG,UAAU;MACzB,SAAS,GAAG,OAAO;AAEhC;;;;;SAKgB,WAAW,CACzB,IAAoB,EACpB,OAA2B;;IAG3B,MAAM,sBAAsB,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;;IAGnF,MAAM,mBAAmB,GAAG,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;;IAG3E,OAAO;QACL,CAAC,EAAE,sBAAsB;QACzB,CAAC,EAAE,mBAAmB;KACvB,CAAC;AACJ,CAAC;SAGe,qBAAqB,CACnC,IAAoB,EACpB,IAAmB,EACnB,IAAc,EACd,KAAe;IAEf,OAAO;QACL,OAAO,EAAE,IAAI,CAAC,QAAQ;QACtB,WAAW,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,KAAK;QAC/C,WAAW,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,KAAK;;QAEvC,QAAQ,EAAE,WAAW,CAAC,I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AE;YACvB,MAAA,CAAC,CAAC,cAAc,iDAAI,CAAC;SACtB;QACD,MAAM,GAAG,GAAG,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC;QAClC,MAAA,IAAI,CAAC,kBAAkB,0CAAE,MAAM,CAAC,GAAG,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;QAChE,IAAI,CAAC,gBAAgB,CAAC,kBAAkB,CAAC,IAAI,CAAC,CAAC;KAChD;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":[],"sources":["src/components/revoGrid/viewport.helpers.ts","src/utils/resize-observer.polifill.ts","src/components/revoGrid/viewport.resize.service.ts","src/components/scroll/revogr-viewport-scroll-style.scss?tag=revogr-viewport-scroll","src/components/scroll/revogr-viewport-scroll.tsx"],"sourcesContent":["/**\n * Collects data for pinned columns in the required @ViewportProps format.\n */\n\nimport { DimensionRows, MultiDimensionType, SlotType, Cell, ViewportColumn } from '@type';\n\n/**\n * Represents the slot names for the viewport slots.\n */\nexport const HEADER_SLOT = 'header'; // Slot name for the header slot\nexport const FOOTER_SLOT = 'footer'; // Slot name for the footer slot\nexport const CONTENT_SLOT = 'content'; // Slot name for the content slot\nexport const DATA_SLOT = 'data'; // Slot name for the data slot\n\n/**\n * Returns the last visible cell in the viewport for a given row type.\n * Coordinates are not zero-based and are relative to the viewport.\n * If needed to be zero-based they can be adjusted by subtracting 1.\n */\nexport function getLastCell(\n data: ViewportColumn,\n rowType: MultiDimensionType,\n): Cell {\n // Get the last visible column count from the viewport column data.\n const lastVisibleColumnCount = data.viewports[data.colType].store.get('realCount');\n\n // Get the last visible row count for the given row type from the viewport column data.\n const lastVisibleRowCount = data.viewports[rowType].store.get('realCount');\n\n // Return the last visible cell with the last visible column count and row count.\n return {\n x: lastVisibleColumnCount,\n y: lastVisibleRowCount,\n };\n}\n\n\nexport function viewportDataPartition(\n data: ViewportColumn,\n type: DimensionRows,\n slot: SlotType,\n fixed?: boolean,\n) {\n return {\n colData: data.colStore,\n viewportCol: data.viewports[data.colType].store,\n viewportRow: data.viewports[type].store,\n // lastCell is the last real coordinate + 1\n lastCell: getLastCell(data, type),\n slot,\n type,\n canDrag: !fixed,\n position: data.position,\n dataStore: data.rowStores[type].store,\n dimensionCol: data.dimensions[data.colType].store,\n dimensionRow: data.dimensions[type].store,\n style: fixed\n ? { height: `${data.dimensions[type].store.get('realSize')}px` }\n : undefined,\n };\n}\n\nexport type VPPartition = ReturnType<typeof viewportDataPartition>;","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/resize-observer.polifill';\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() {\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 // make sure it would work\n &.colPinEnd:has(.active) {\n overflow: visible;\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 outline: none; // avoid accessibility focus issue\n @include noScroll;\n\n revogr-data,\n revogr-overlay-selection {\n height: 100%;\n }\n }\n}\n","import {\n Component,\n Event,\n EventEmitter,\n h,\n Method,\n Element,\n Prop,\n Host,\n Listen,\n} from '@stencil/core';\n\nimport GridResizeService from '../revoGrid/viewport.resize.service';\nimport LocalScrollService from '../../services/local.scroll.service';\nimport { LocalScrollTimer } from '../../services/local.scroll.timer';\nimport {\n CONTENT_SLOT,\n FOOTER_SLOT,\n HEADER_SLOT,\n} from '../revoGrid/viewport.helpers';\nimport type {\n DimensionCols,\n DimensionType,\n ElementScroll,\n ScrollCoordinateEvent,\n ViewPortResizeEvent,\n ViewPortScrollEvent\n} from '@type';\n\ntype Delta = 'deltaX' | 'deltaY';\ntype LocalScrollEvent = {\n preventDefault(): void;\n} & { [x in Delta]: number };\n\n/**\n * Viewport scroll component for RevoGrid\n * @slot - content\n * @slot header - header\n * @slot footer - footer\n */\n@Component({\n tag: 'revogr-viewport-scroll',\n styleUrl: 'revogr-viewport-scroll-style.scss',\n})\nexport class RevogrViewportScroll implements ElementScroll {\n /**\n * Enable row header\n */\n @Prop() readonly rowHeader: boolean;\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 @Prop() colType!: DimensionCols | 'rowHeaders';\n\n /**\n * Before scroll event\n */\n @Event({ eventName: 'scrollviewport', bubbles: true }) scrollViewport: EventEmitter<ViewPortScrollEvent>;\n /**\n * Viewport resize\n */\n @Event({ eventName: 'resizeviewport' }) resizeViewport: EventEmitter<ViewPortResizeEvent>;\n\n /**\n * Triggered on scroll change, can be used to get information about scroll visibility\n */\n @Event() scrollchange: EventEmitter<{\n type: DimensionType;\n hasScroll: boolean;\n }>;\n\n /**\n * Silently scroll to coordinate\n * Made to align negative coordinates for mobile devices\n */\n @Event({ eventName: 'scrollviewportsilent' }) silentScroll: EventEmitter<ViewPortScrollEvent>;\n\n @Element() horizontalScroll: HTMLElement;\n\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: Partial<LocalScrollEvent>) => void;\n private verticalMouseWheel: (e: Partial<LocalScrollEvent>) => void;\n\n private resizeService?: GridResizeService;\n private localScrollService: LocalScrollService;\n private localScrollTimer: LocalScrollTimer;\n\n\n @Method() async setScroll(e: ViewPortScrollEvent) {\n this.localScrollTimer.latestScrollUpdate(e.dimension);\n this.localScrollService?.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(\n e: ViewPortScrollEvent,\n silent = false,\n ) {\n if (silent) {\n if (e.coordinate && this.verticalScroll) {\n switch (e.dimension) {\n // for mobile devices to skip negative scroll loop. only on vertical scroll\n case 'rgRow':\n this.verticalScroll.style.transform = `translateY(${-1 * e.coordinate}px)`;\n break;\n }\n }\n return;\n }\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 ?? 0) + e.delta;\n break;\n }\n this.setScroll(e);\n }\n return e;\n }\n\n /**\n * Dispatch this event to trigger vertical mouse wheel from plugins\n */\n @Listen('mousewheel-vertical') mousewheelVertical({\n detail: e,\n }: CustomEvent<LocalScrollEvent>) {\n this.verticalMouseWheel(e);\n }\n /**\n * Dispatch this event to trigger horizontal mouse wheel from plugins\n */\n @Listen('mousewheel-horizontal') mousewheelHorizontal({\n detail: e,\n }: CustomEvent<LocalScrollEvent>) {\n this.horizontalMouseWheel(e);\n }\n /**\n * Allows to use outside listener\n */\n @Listen('scroll-coordinate') scrollApply({\n detail: { type, coordinate },\n }: CustomEvent<ScrollCoordinateEvent>) {\n this.applyOnScroll(type, coordinate, true);\n }\n\n connectedCallback() {\n /**\n * Bind scroll functions for farther usage\n */\n // allow mousewheel for all devices including mobile\n this.verticalMouseWheel = this.onVerticalMouseWheel.bind(\n this,\n 'rgRow',\n 'deltaY',\n );\n this.horizontalMouseWheel = this.onHorizontalMouseWheel.bind(\n this,\n 'rgCol',\n 'deltaX',\n );\n this.localScrollTimer = new LocalScrollTimer('ontouchstart' in document.documentElement ? 0 : 10);\n /**\n * Create local scroll service\n */\n this.localScrollService = new LocalScrollService({\n // to improve safari smoothnes on scroll\n // skipAnimationFrame: isSafariDesktop(),\n runScroll: e => this.scrollViewport.emit(e),\n applyScroll: e => {\n this.localScrollTimer.setCoordinate(e);\n switch (e.dimension) {\n case 'rgCol':\n // this will trigger on scroll event\n this.horizontalScroll.scrollLeft = e.coordinate;\n break;\n case 'rgRow':\n if (this.verticalScroll) {\n // this will trigger on scroll event\n this.verticalScroll.scrollTop = e.coordinate;\n // for mobile devices to skip negative scroll loop. only on vertical scroll\n if (this.verticalScroll.style.transform) {\n this.verticalScroll.style.transform = '';\n }\n }\n break;\n }\n },\n });\n }\n\n componentDidLoad() {\n // track horizontal viewport resize\n this.resizeService = new GridResizeService(this.horizontalScroll, {\n resize: entries => {\n let height = entries[0]?.contentRect.height || 0;\n if (height) {\n height -= (this.header?.clientHeight ?? 0) + (this.footer?.clientHeight ?? 0);\n }\n const els = {\n rgRow: {\n size: height,\n contentSize: this.contentHeight,\n scroll: this.verticalScroll?.scrollTop,\n noScroll: false,\n },\n rgCol: {\n size: entries[0]?.contentRect.width || 0,\n contentSize: this.contentWidth,\n scroll: this.horizontalScroll.scrollLeft,\n noScroll: this.colType !== 'rgCol',\n },\n };\n for (const [dim, item] of Object.entries(els)) {\n const dimension = dim as DimensionType;\n this.resizeViewport.emit({ dimension, size: item.size, rowHeader: this.rowHeader });\n if (item.noScroll) {\n continue;\n }\n this.localScrollService?.scroll(item.scroll ?? 0, 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(\n type: DimensionType,\n size: number,\n innerContentSize: number,\n ) {\n // test if scroll present\n const hasScroll = size < innerContentSize;\n let el: HTMLElement | undefined;\n // event reference for binding\n switch (type) {\n case 'rgCol':\n el = this.horizontalScroll;\n break;\n case 'rgRow':\n el = this.verticalScroll;\n break;\n }\n // based on scroll visibility assign or remove class and event\n if (hasScroll) {\n el?.classList.add(`scroll-${type}`);\n } else {\n el?.classList.remove(`scroll-${type}`);\n }\n this.scrollchange.emit({ type, hasScroll });\n }\n\n disconnectedCallback() {\n this.resizeService?.destroy();\n }\n\n async componentDidRender() {\n this.localScrollService.setParams(\n {\n contentSize: this.contentHeight,\n clientSize: this.verticalScroll?.clientHeight ?? 0,\n virtualSize: 0,\n },\n 'rgRow',\n );\n\n this.localScrollService.setParams(\n {\n contentSize: this.contentWidth,\n clientSize: this.horizontalScroll.clientWidth,\n virtualSize: 0,\n },\n 'rgCol',\n );\n this.setScrollVisibility(\n 'rgRow',\n this.verticalScroll?.clientHeight ?? 0,\n this.contentHeight,\n );\n this.setScrollVisibility(\n 'rgCol',\n this.horizontalScroll.clientWidth,\n this.contentWidth,\n );\n }\n\n render() {\n return (\n <Host\n onWheel={this.horizontalMouseWheel}\n onScroll={(e: UIEvent) => this.applyScroll('rgCol', e)}\n >\n <div\n class=\"inner-content-table\"\n style={{ width: `${this.contentWidth}px` }}\n >\n <div class=\"header-wrapper\" ref={e => (this.header = e)}>\n <slot name={HEADER_SLOT} />\n </div>\n <div\n class=\"vertical-inner\"\n ref={el => (this.verticalScroll = el)}\n onWheel={this.verticalMouseWheel}\n onScroll={(e: MouseEvent) => this.applyScroll('rgRow', e)}\n >\n <div\n class=\"content-wrapper\"\n style={{ height: `${this.contentHeight}px` }}\n >\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 * 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 @Method() async applyScroll(type: DimensionType, e: UIEvent) {\n if (!(e.target instanceof HTMLElement)) {\n return;\n }\n let scroll = 0;\n switch (type) {\n case 'rgCol':\n scroll = e.target.scrollLeft;\n break;\n case 'rgRow':\n scroll = e.target.scrollTop;\n break;\n }\n\n // for mobile devices to skip negative scroll loop\n if (scroll < 0) {\n this.silentScroll.emit({ dimension: type, coordinate: scroll });\n return;\n }\n this.applyOnScroll(type, scroll);\n }\n\n /**\n * Applies change on scroll event only if mousewheel event happened some time ago\n */\n private applyOnScroll(\n type: DimensionType,\n coordinate: number,\n outside = false,\n ) {\n // apply after throttling\n if (this.localScrollTimer.isReady(type, coordinate)) {\n this.localScrollService?.scroll(\n coordinate,\n type,\n undefined,\n undefined,\n outside,\n );\n }\n }\n\n /**\n * On vertical mousewheel event\n * @param type\n * @param delta\n * @param e\n */\n private onVerticalMouseWheel(\n type: DimensionType,\n delta: Delta,\n e: LocalScrollEvent,\n ) {\n const scrollTop = this.verticalScroll?.scrollTop ?? 0;\n const clientHeight = this.verticalScroll?.clientHeight ?? 0;\n const scrollHeight = this.verticalScroll?.scrollHeight ?? 0;\n\n // Detect if the user has reached the bottom\n const atBottom = (scrollTop + clientHeight >= scrollHeight) && e.deltaY > 0;\n const atTop = scrollTop === 0 && e.deltaY < 0;\n if (!atBottom && !atTop) {\n e.preventDefault?.();\n }\n const pos = scrollTop + e[delta];\n this.localScrollService?.scroll(pos, type, undefined, e[delta]);\n this.localScrollTimer.latestScrollUpdate(type);\n }\n\n /**\n * On horizontal mousewheel event\n * @param type\n * @param delta\n * @param e\n */\n private onHorizontalMouseWheel(\n type: DimensionType,\n delta: Delta,\n e: LocalScrollEvent,\n ) {\n if (!e.deltaX) {\n return;\n }\n const { scrollLeft, scrollWidth, clientWidth } = this.horizontalScroll;\n\n // Detect if the user has reached the right end\n const atRight = (scrollLeft + clientWidth >= scrollWidth) && e.deltaX > 0;\n\n // Detect if the user has reached the left end\n const atLeft = scrollLeft === 0 && e.deltaX < 0;\n if (!atRight && !atLeft) {\n e.preventDefault?.();\n }\n const pos = scrollLeft + e[delta];\n this.localScrollService?.scroll(pos, type, undefined, e[delta]);\n this.localScrollTimer.latestScrollUpdate(type);\n }\n}\n"],"version":3}
|
|
1
|
+
{"file":"revogr-viewport-scroll2.js","mappings":";;;;;;;AAAA;;;AAMA;;;MAGa,WAAW,GAAG,SAAS;MACvB,WAAW,GAAG,SAAS;MACvB,YAAY,GAAG,UAAU;MACzB,SAAS,GAAG,OAAO;AAEhC;;;;;SAKgB,WAAW,CACzB,IAAoB,EACpB,OAA2B;;IAG3B,MAAM,sBAAsB,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;;IAGnF,MAAM,mBAAmB,GAAG,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;;IAG3E,OAAO;QACL,CAAC,EAAE,sBAAsB;QACzB,CAAC,EAAE,mBAAmB;KACvB,CAAC;AACJ,CAAC;SAGe,qBAAqB,CACnC,IAAoB,EACpB,IAAmB,EACnB,IAAc,EACd,KAAe;IAEf,OAAO;QACL,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AA,IAAI,CAAC,kBAAkB,0CAAE,MAAM,CAAC,GAAG,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;QAChE,IAAI,CAAC,gBAAgB,CAAC,kBAAkB,CAAC,IAAI,CAAC,CAAC;KAChD;;;;;;;IAQO,sBAAsB,CAC5B,IAAmB,EACnB,KAAY,EACZ,CAAmB;;QAEnB,IAAI,CAAC,CAAC,CAAC,MAAM,EAAE;YACb,OAAO;SACR;QACD,MAAM,EAAE,UAAU,EAAE,WAAW,EAAE,WAAW,EAAE,GAAG,IAAI,CAAC,gBAAgB,CAAC;;QAGvE,MAAM,OAAO,GAAG,UAAU,GAAG,WAAW,IAAI,WAAW,IAAI,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC;;QAGxE,MAAM,MAAM,GAAG,UAAU,KAAK,CAAC,IAAI,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC;QAChD,IAAI,CAAC,OAAO,IAAI,CAAC,MAAM,EAAE;YACvB,MAAA,CAAC,CAAC,cAAc,iDAAI,CAAC;SACtB;QACD,MAAM,GAAG,GAAG,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC;QAClC,MAAA,IAAI,CAAC,kBAAkB,0CAAE,MAAM,CAAC,GAAG,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;QAChE,IAAI,CAAC,gBAAgB,CAAC,kBAAkB,CAAC,IAAI,CAAC,CAAC;KAChD;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":[],"sources":["src/components/revoGrid/viewport.helpers.ts","src/utils/resize-observer.polifill.ts","src/components/revoGrid/viewport.resize.service.ts","src/components/scroll/revogr-viewport-scroll-style.scss?tag=revogr-viewport-scroll","src/components/scroll/revogr-viewport-scroll.tsx"],"sourcesContent":["/**\n * Collects data for pinned columns in the required @ViewportProps format.\n */\n\nimport { DimensionRows, MultiDimensionType, SlotType, Cell, ViewportColumn } from '@type';\n\n/**\n * Represents the slot names for the viewport slots.\n */\nexport const HEADER_SLOT = 'header'; // Slot name for the header slot\nexport const FOOTER_SLOT = 'footer'; // Slot name for the footer slot\nexport const CONTENT_SLOT = 'content'; // Slot name for the content slot\nexport const DATA_SLOT = 'data'; // Slot name for the data slot\n\n/**\n * Returns the last visible cell in the viewport for a given row type.\n * Coordinates are not zero-based and are relative to the viewport.\n * If needed to be zero-based they can be adjusted by subtracting 1.\n */\nexport function getLastCell(\n data: ViewportColumn,\n rowType: MultiDimensionType,\n): Cell {\n // Get the last visible column count from the viewport column data.\n const lastVisibleColumnCount = data.viewports[data.colType].store.get('realCount');\n\n // Get the last visible row count for the given row type from the viewport column data.\n const lastVisibleRowCount = data.viewports[rowType].store.get('realCount');\n\n // Return the last visible cell with the last visible column count and row count.\n return {\n x: lastVisibleColumnCount,\n y: lastVisibleRowCount,\n };\n}\n\n\nexport function viewportDataPartition(\n data: ViewportColumn,\n type: DimensionRows,\n slot: SlotType,\n fixed?: boolean,\n) {\n return {\n colData: data.colStore,\n viewportCol: data.viewports[data.colType].store,\n viewportRow: data.viewports[type].store,\n // lastCell is the last real coordinate + 1\n lastCell: getLastCell(data, type),\n slot,\n type,\n canDrag: !fixed,\n position: data.position,\n dataStore: data.rowStores[type].store,\n dimensionCol: data.dimensions[data.colType].store,\n dimensionRow: data.dimensions[type].store,\n style: fixed\n ? { height: `${data.dimensions[type].store.get('realSize')}px` }\n : undefined,\n };\n}\n\nexport type VPPartition = ReturnType<typeof viewportDataPartition>;","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/resize-observer.polifill';\n\ntype ResizeEntry = {\n width: number;\n height: number;\n};\nexport default class GridResizeService {\n private resizeObserver: ResizeObserver | null = null;\n private previousSize: ResizeEntry = {\n width: 0,\n height: 0,\n };\n private readonly apply = throttle(\n (e: ReadonlyArray<ResizeObserverEntry>) => {\n if (!e.length) {\n return;\n }\n const entry = {\n width: e[0].contentRect.width,\n height: e[0].contentRect.height,\n };\n this.resize?.(entry, this.previousSize);\n this.previousSize = entry;\n },\n 10,\n );\n constructor(\n el: HTMLElement,\n private readonly resize: (\n entry: ResizeEntry,\n previousSize: ResizeEntry,\n ) => void,\n ) {\n this.init(el);\n }\n\n async init(el: HTMLElement): Promise<void> {\n await resizeObserver();\n this.resizeObserver = new ResizeObserver(this.apply);\n this.resizeObserver?.observe(el);\n }\n\n public destroy() {\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 // make sure it would work\n &.colPinEnd:has(.active) {\n overflow: visible;\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 outline: none; // avoid accessibility focus issue\n @include noScroll;\n\n revogr-data,\n revogr-overlay-selection {\n height: 100%;\n }\n }\n}\n","import {\n Component,\n Event,\n EventEmitter,\n h,\n Method,\n Element,\n Prop,\n Host,\n Listen,\n} from '@stencil/core';\n\nimport GridResizeService from '../revoGrid/viewport.resize.service';\nimport LocalScrollService from '../../services/local.scroll.service';\nimport { LocalScrollTimer } from '../../services/local.scroll.timer';\nimport {\n CONTENT_SLOT,\n FOOTER_SLOT,\n HEADER_SLOT,\n} from '../revoGrid/viewport.helpers';\nimport type {\n DimensionCols,\n DimensionType,\n ElementScroll,\n ScrollCoordinateEvent,\n ViewPortResizeEvent,\n ViewPortScrollEvent,\n} from '@type';\n\ntype Delta = 'deltaX' | 'deltaY';\ntype LocalScrollEvent = {\n preventDefault(): void;\n} & { [x in Delta]: number };\n\n/**\n * Viewport scroll component for RevoGrid\n * @slot - content\n * @slot header - header\n * @slot footer - footer\n */\n@Component({\n tag: 'revogr-viewport-scroll',\n styleUrl: 'revogr-viewport-scroll-style.scss',\n})\nexport class RevogrViewportScroll implements ElementScroll {\n /**\n * Enable row header\n */\n @Prop() readonly rowHeader: boolean;\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 @Prop() colType!: DimensionCols | 'rowHeaders';\n\n /**\n * Before scroll event\n */\n @Event({ eventName: 'scrollviewport', bubbles: true })\n scrollViewport: EventEmitter<ViewPortScrollEvent>;\n /**\n * Viewport resize\n */\n @Event({ eventName: 'resizeviewport' })\n resizeViewport: EventEmitter<ViewPortResizeEvent>;\n\n /**\n * Triggered on scroll change, can be used to get information about scroll visibility\n */\n @Event() scrollchange: EventEmitter<{\n type: DimensionType;\n hasScroll: boolean;\n }>;\n\n /**\n * Silently scroll to coordinate\n * Made to align negative coordinates for mobile devices\n */\n @Event({ eventName: 'scrollviewportsilent' })\n silentScroll: EventEmitter<ViewPortScrollEvent>;\n\n @Element() horizontalScroll: HTMLElement;\n\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: Partial<LocalScrollEvent>) => void;\n private verticalMouseWheel: (e: Partial<LocalScrollEvent>) => void;\n\n private resizeService?: GridResizeService;\n private localScrollService: LocalScrollService;\n private localScrollTimer: LocalScrollTimer;\n\n @Method() async setScroll(e: ViewPortScrollEvent) {\n this.localScrollTimer.latestScrollUpdate(e.dimension);\n this.localScrollService?.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: ViewPortScrollEvent, silent = false) {\n if (silent) {\n if (e.coordinate && this.verticalScroll) {\n switch (e.dimension) {\n // for mobile devices to skip negative scroll loop. only on vertical scroll\n case 'rgRow':\n this.verticalScroll.style.transform = `translateY(${-1 * e.coordinate}px)`;\n break;\n }\n }\n return;\n }\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 ?? 0) + e.delta;\n break;\n }\n this.setScroll(e);\n }\n return e;\n }\n\n /**\n * Dispatch this event to trigger vertical mouse wheel from plugins\n */\n @Listen('mousewheel-vertical') mousewheelVertical({\n detail: e,\n }: CustomEvent<LocalScrollEvent>) {\n this.verticalMouseWheel(e);\n }\n /**\n * Dispatch this event to trigger horizontal mouse wheel from plugins\n */\n @Listen('mousewheel-horizontal') mousewheelHorizontal({\n detail: e,\n }: CustomEvent<LocalScrollEvent>) {\n this.horizontalMouseWheel(e);\n }\n /**\n * Allows to use outside listener\n */\n @Listen('scroll-coordinate') scrollApply({\n detail: { type, coordinate },\n }: CustomEvent<ScrollCoordinateEvent>) {\n this.applyOnScroll(type, coordinate, true);\n }\n\n connectedCallback() {\n /**\n * Bind scroll functions for farther usage\n */\n // allow mousewheel for all devices including mobile\n this.verticalMouseWheel = this.onVerticalMouseWheel.bind(\n this,\n 'rgRow',\n 'deltaY',\n );\n this.horizontalMouseWheel = this.onHorizontalMouseWheel.bind(\n this,\n 'rgCol',\n 'deltaX',\n );\n this.localScrollTimer = new LocalScrollTimer(\n 'ontouchstart' in document.documentElement ? 0 : 10,\n );\n /**\n * Create local scroll service\n */\n this.localScrollService = new LocalScrollService({\n // to improve safari smoothnes on scroll\n // skipAnimationFrame: isSafariDesktop(),\n runScroll: e => this.scrollViewport.emit(e),\n applyScroll: e => {\n this.localScrollTimer.setCoordinate(e);\n switch (e.dimension) {\n case 'rgCol':\n // this will trigger on scroll event\n this.horizontalScroll.scrollLeft = e.coordinate;\n break;\n case 'rgRow':\n if (this.verticalScroll) {\n // this will trigger on scroll event\n this.verticalScroll.scrollTop = e.coordinate;\n // for mobile devices to skip negative scroll loop. only on vertical scroll\n if (this.verticalScroll.style.transform) {\n this.verticalScroll.style.transform = '';\n }\n }\n break;\n }\n },\n });\n }\n\n componentDidLoad() {\n // track horizontal viewport resize\n this.resizeService = new GridResizeService(\n this.horizontalScroll,\n (entry, previousSize) => {\n const els: Partial<\n Record<\n DimensionType,\n {\n size: number;\n contentSize: number;\n scroll: number;\n noScroll: boolean;\n }\n >\n > = {};\n if (entry.height !== previousSize.height) {\n let height = entry.height || 0;\n if (height) {\n height -=\n (this.header?.clientHeight ?? 0) +\n (this.footer?.clientHeight ?? 0);\n }\n els.rgRow = {\n size: height,\n contentSize: this.contentHeight,\n scroll: this.verticalScroll?.scrollTop ?? 0,\n noScroll: false,\n };\n }\n if (entry.width !== previousSize.width) {\n els.rgCol = {\n size: entry.width || 0,\n contentSize: this.contentWidth,\n scroll: this.horizontalScroll.scrollLeft,\n noScroll: this.colType !== 'rgCol',\n };\n }\n\n for (const [dim, item] of Object.entries(els)) {\n const dimension = dim as DimensionType;\n this.resizeViewport.emit({\n dimension,\n size: item.size,\n rowHeader: this.rowHeader,\n });\n if (item.noScroll) {\n continue;\n }\n this.localScrollService?.scroll(item.scroll ?? 0, 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(\n type: DimensionType,\n size: number,\n innerContentSize: number,\n ) {\n // test if scroll present\n const hasScroll = size < innerContentSize;\n let el: HTMLElement | undefined;\n // event reference for binding\n switch (type) {\n case 'rgCol':\n el = this.horizontalScroll;\n break;\n case 'rgRow':\n el = this.verticalScroll;\n break;\n }\n // based on scroll visibility assign or remove class and event\n if (hasScroll) {\n el?.classList.add(`scroll-${type}`);\n } else {\n el?.classList.remove(`scroll-${type}`);\n }\n this.scrollchange.emit({ type, hasScroll });\n }\n\n disconnectedCallback() {\n this.resizeService?.destroy();\n }\n\n async componentDidRender() {\n this.localScrollService.setParams(\n {\n contentSize: this.contentHeight,\n clientSize: this.verticalScroll?.clientHeight ?? 0,\n virtualSize: 0,\n },\n 'rgRow',\n );\n\n this.localScrollService.setParams(\n {\n contentSize: this.contentWidth,\n clientSize: this.horizontalScroll.clientWidth,\n virtualSize: 0,\n },\n 'rgCol',\n );\n this.setScrollVisibility(\n 'rgRow',\n this.verticalScroll?.clientHeight ?? 0,\n this.contentHeight,\n );\n this.setScrollVisibility(\n 'rgCol',\n this.horizontalScroll.clientWidth,\n this.contentWidth,\n );\n }\n\n render() {\n return (\n <Host\n onWheel={this.horizontalMouseWheel}\n onScroll={(e: UIEvent) => this.applyScroll('rgCol', e)}\n >\n <div\n class=\"inner-content-table\"\n style={{ width: `${this.contentWidth}px` }}\n >\n <div class=\"header-wrapper\" ref={e => (this.header = e)}>\n <slot name={HEADER_SLOT} />\n </div>\n <div\n class=\"vertical-inner\"\n ref={el => (this.verticalScroll = el)}\n onWheel={this.verticalMouseWheel}\n onScroll={(e: MouseEvent) => this.applyScroll('rgRow', e)}\n >\n <div\n class=\"content-wrapper\"\n style={{ height: `${this.contentHeight}px` }}\n >\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 * 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 @Method() async applyScroll(type: DimensionType, e: UIEvent) {\n if (!(e.target instanceof HTMLElement)) {\n return;\n }\n let scroll = 0;\n switch (type) {\n case 'rgCol':\n scroll = e.target.scrollLeft;\n break;\n case 'rgRow':\n scroll = e.target.scrollTop;\n break;\n }\n\n // for mobile devices to skip negative scroll loop\n if (scroll < 0) {\n this.silentScroll.emit({ dimension: type, coordinate: scroll });\n return;\n }\n this.applyOnScroll(type, scroll);\n }\n\n /**\n * Applies change on scroll event only if mousewheel event happened some time ago\n */\n private applyOnScroll(\n type: DimensionType,\n coordinate: number,\n outside = false,\n ) {\n // apply after throttling\n if (this.localScrollTimer.isReady(type, coordinate)) {\n this.localScrollService?.scroll(\n coordinate,\n type,\n undefined,\n undefined,\n outside,\n );\n }\n }\n\n /**\n * On vertical mousewheel event\n * @param type\n * @param delta\n * @param e\n */\n private onVerticalMouseWheel(\n type: DimensionType,\n delta: Delta,\n e: LocalScrollEvent,\n ) {\n const scrollTop = this.verticalScroll?.scrollTop ?? 0;\n const clientHeight = this.verticalScroll?.clientHeight ?? 0;\n const scrollHeight = this.verticalScroll?.scrollHeight ?? 0;\n\n // Detect if the user has reached the bottom\n const atBottom = scrollTop + clientHeight >= scrollHeight && e.deltaY > 0;\n const atTop = scrollTop === 0 && e.deltaY < 0;\n if (!atBottom && !atTop) {\n e.preventDefault?.();\n }\n const pos = scrollTop + e[delta];\n this.localScrollService?.scroll(pos, type, undefined, e[delta]);\n this.localScrollTimer.latestScrollUpdate(type);\n }\n\n /**\n * On horizontal mousewheel event\n * @param type\n * @param delta\n * @param e\n */\n private onHorizontalMouseWheel(\n type: DimensionType,\n delta: Delta,\n e: LocalScrollEvent,\n ) {\n if (!e.deltaX) {\n return;\n }\n const { scrollLeft, scrollWidth, clientWidth } = this.horizontalScroll;\n\n // Detect if the user has reached the right end\n const atRight = scrollLeft + clientWidth >= scrollWidth && e.deltaX > 0;\n\n // Detect if the user has reached the left end\n const atLeft = scrollLeft === 0 && e.deltaX < 0;\n if (!atRight && !atLeft) {\n e.preventDefault?.();\n }\n const pos = scrollLeft + e[delta];\n this.localScrollService?.scroll(pos, type, undefined, e[delta]);\n this.localScrollTimer.latestScrollUpdate(type);\n }\n}\n"],"version":3}
|