@revolist/revogrid 4.10.21 → 4.10.23
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/dimension.helpers-d1fc1dac.js.map +1 -1
- package/dist/cjs/index.cjs.js +2 -2
- package/dist/cjs/revo-grid.cjs.entry.js +37 -21
- package/dist/cjs/revo-grid.cjs.entry.js.map +1 -1
- package/dist/cjs/revogr-attribution_7.cjs.entry.js +10 -8
- package/dist/cjs/revogr-attribution_7.cjs.entry.js.map +1 -1
- package/dist/cjs/revogr-clipboard_3.cjs.entry.js.map +1 -1
- package/dist/cjs/revogr-data_4.cjs.entry.js +1 -1
- package/dist/cjs/revogr-data_4.cjs.entry.js.map +1 -1
- package/dist/cjs/{sorting.plugin-0256bdb5.js → sorting.plugin-d3e3d30f.js} +2 -2
- package/dist/cjs/{sorting.plugin-0256bdb5.js.map → sorting.plugin-d3e3d30f.js.map} +1 -1
- package/dist/cjs/text-editor-62095c25.js.map +1 -1
- package/dist/cjs/{viewport.store-14ff99b9.js → viewport.store-3d351649.js} +4 -2
- package/dist/cjs/viewport.store-3d351649.js.map +1 -0
- package/dist/collection/components/editors/revogr-edit.js +1 -1
- package/dist/collection/components/editors/revogr-edit.js.map +1 -1
- package/dist/collection/components/editors/text-editor.js.map +1 -1
- package/dist/collection/components/overlay/revogr-overlay-selection.js +7 -7
- package/dist/collection/components/overlay/revogr-overlay-selection.js.map +1 -1
- package/dist/collection/components/revoGrid/revo-grid-style.css +4 -0
- package/dist/collection/components/revoGrid/revo-grid.js +31 -12
- package/dist/collection/components/revoGrid/revo-grid.js.map +1 -1
- package/dist/collection/components/revoGrid/viewport.service.js +9 -9
- package/dist/collection/components/revoGrid/viewport.service.js.map +1 -1
- package/dist/collection/components/scroll/revogr-viewport-scroll.js +1 -1
- package/dist/collection/components/scroll/revogr-viewport-scroll.js.map +1 -1
- package/dist/collection/components/scrollable/revogr-scroll-virtual.js +6 -4
- package/dist/collection/components/scrollable/revogr-scroll-virtual.js.map +1 -1
- package/dist/collection/services/column.data.provider.js +2 -2
- package/dist/collection/services/column.data.provider.js.map +1 -1
- package/dist/collection/services/data.provider.js.map +1 -1
- package/dist/collection/store/dataSource/data.store.js.map +1 -1
- package/dist/collection/store/vp/viewport.store.js +3 -1
- package/dist/collection/store/vp/viewport.store.js.map +1 -1
- package/dist/collection/types/interfaces.js.map +1 -1
- package/dist/collection/types/selection.js.map +1 -1
- package/dist/collection/types/viewport.interfaces.js.map +1 -1
- package/dist/esm/dimension.helpers-4ea92aec.js.map +1 -1
- package/dist/esm/index.js +3 -3
- package/dist/esm/revo-grid.entry.js +37 -21
- package/dist/esm/revo-grid.entry.js.map +1 -1
- package/dist/esm/revogr-attribution_7.entry.js +10 -8
- package/dist/esm/revogr-attribution_7.entry.js.map +1 -1
- package/dist/esm/revogr-clipboard_3.entry.js.map +1 -1
- package/dist/esm/revogr-data_4.entry.js +1 -1
- package/dist/esm/revogr-data_4.entry.js.map +1 -1
- package/dist/esm/{sorting.plugin-c930df58.js → sorting.plugin-883f0941.js} +2 -2
- package/dist/esm/{sorting.plugin-c930df58.js.map → sorting.plugin-883f0941.js.map} +1 -1
- package/dist/esm/text-editor-c799aad2.js.map +1 -1
- package/dist/esm/{viewport.store-73fe3883.js → viewport.store-a1fce772.js} +4 -2
- package/dist/esm/viewport.store-a1fce772.js.map +1 -0
- package/dist/revo-grid/dimension.helpers-4ea92aec.js.map +1 -1
- package/dist/revo-grid/index.esm.js +1 -1
- package/dist/revo-grid/revo-grid.entry.js +1 -1
- package/dist/revo-grid/revo-grid.entry.js.map +1 -1
- 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-clipboard_3.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/{sorting.plugin-c930df58.js → sorting.plugin-883f0941.js} +2 -2
- package/dist/revo-grid/text-editor-c799aad2.js.map +1 -1
- package/dist/revo-grid/viewport.store-a1fce772.js +5 -0
- package/dist/revo-grid/viewport.store-a1fce772.js.map +1 -0
- package/dist/types/components/editors/revogr-edit.d.ts +2 -2
- package/dist/types/components/editors/text-editor.d.ts +2 -3
- package/dist/types/components/overlay/revogr-overlay-selection.d.ts +1 -1
- package/dist/types/components/revoGrid/revo-grid.d.ts +8 -2
- package/dist/types/components/revoGrid/viewport.service.d.ts +1 -1
- package/dist/types/components/scroll/revogr-viewport-scroll.d.ts +1 -2
- package/dist/types/components/scrollable/revogr-scroll-virtual.d.ts +2 -3
- package/dist/types/components.d.ts +6 -5
- package/dist/types/services/column.data.provider.d.ts +2 -2
- package/dist/types/services/data.provider.d.ts +1 -1
- package/dist/types/store/dataSource/data.store.d.ts +1 -2
- package/dist/types/types/interfaces.d.ts +6 -0
- package/dist/types/types/selection.d.ts +4 -5
- package/dist/types/types/viewport.interfaces.d.ts +0 -2
- package/hydrate/index.js +48 -28
- package/hydrate/index.mjs +48 -28
- package/package.json +1 -1
- package/standalone/data.store.js.map +1 -1
- package/standalone/revo-grid.js +35 -19
- package/standalone/revo-grid.js.map +1 -1
- package/standalone/revogr-edit2.js.map +1 -1
- package/standalone/revogr-overlay-selection2.js +4 -4
- package/standalone/revogr-overlay-selection2.js.map +1 -1
- package/standalone/revogr-row-headers2.js +3 -1
- package/standalone/revogr-row-headers2.js.map +1 -1
- package/standalone/revogr-scroll-virtual2.js +5 -3
- package/standalone/revogr-scroll-virtual2.js.map +1 -1
- package/standalone/revogr-viewport-scroll2.js +1 -1
- package/standalone/revogr-viewport-scroll2.js.map +1 -1
- package/dist/cjs/viewport.store-14ff99b9.js.map +0 -1
- package/dist/esm/viewport.store-73fe3883.js.map +0 -1
- package/dist/revo-grid/viewport.store-73fe3883.js +0 -5
- package/dist/revo-grid/viewport.store-73fe3883.js.map +0 -1
- /package/dist/revo-grid/{sorting.plugin-c930df58.js.map → sorting.plugin-883f0941.js.map} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"revogr-viewport-scroll.js","sourceRoot":"","sources":["../../../src/components/scroll/revogr-viewport-scroll.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,KAAK,EAEL,CAAC,EACD,MAAM,EACN,OAAO,EACP,IAAI,EACJ,IAAI,EACJ,MAAM,GACP,MAAM,eAAe,CAAC;AAEvB,OAAO,iBAAiB,MAAM,qCAAqC,CAAC;AACpE,OAAO,kBAAkB,MAAM,qCAAqC,CAAC;AACrE,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AACrE,OAAO,EACL,YAAY,EACZ,WAAW,EACX,WAAW,GACZ,MAAM,8BAA8B,CAAC;AAStC;;;;;GAKG;AAKH,MAAM,OAAO,oBAAoB;;QA0CvB,YAAO,GAAG,IAAI,CAAC,aAAa,CAAC;QAC7B,YAAO,GAAG,IAAI,CAAC,YAAY,CAAC;;4BAlCb,CAAC;6BAIA,CAAC;;;IA+Cf,KAAK,CAAC,SAAS,CAAC,CAAsB;;QAC9C,IAAI,CAAC,gBAAgB,CAAC,kBAAkB,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;QACtD,MAAA,IAAI,CAAC,kBAAkB,0CAAE,SAAS,CAAC,CAAC,CAAC,CAAC;IACxC,CAAC;IAED;;;OAGG;IACO,KAAK,CAAC,YAAY,CAC1B,CAAsB,EACtB,MAAM,GAAG,KAAK;;QAEd,IAAI,MAAM,EAAE,CAAC;YACX,IAAI,CAAC,CAAC,UAAU,IAAI,IAAI,CAAC,cAAc,EAAE,CAAC;gBACxC,QAAQ,CAAC,CAAC,SAAS,EAAE,CAAC;oBACpB,2EAA2E;oBAC3E,KAAK,OAAO;wBACV,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,SAAS,GAAG,cAAc,CAAC,CAAC,GAAG,CAAC,CAAC,UAAU,KAAK,CAAC;wBAC3E,MAAM;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;;;;;;;;;;;CACF","sourcesContent":["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 { DimensionCols, DimensionType, ElementScroll } from '@type';\nimport { ScrollCoordinateEvent, ViewPortResizeEvent, ViewPortScrollEvent } 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 oldValY = this.contentHeight;\n private oldValX = this.contentWidth;\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 // scroll update if number of rows changed\n if (this.contentHeight < this.oldValY && this.verticalScroll) {\n this.verticalScroll.scrollTop += this.contentHeight - this.oldValY;\n }\n this.oldValY = this.contentHeight;\n\n // scroll update if number of cols changed\n if (this.contentWidth < this.oldValX) {\n this.horizontalScroll.scrollLeft += this.contentWidth - this.oldValX;\n }\n this.oldValX = this.contentWidth;\n\n this.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"]}
|
|
1
|
+
{"version":3,"file":"revogr-viewport-scroll.js","sourceRoot":"","sources":["../../../src/components/scroll/revogr-viewport-scroll.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,KAAK,EAEL,CAAC,EACD,MAAM,EACN,OAAO,EACP,IAAI,EACJ,IAAI,EACJ,MAAM,GACP,MAAM,eAAe,CAAC;AAEvB,OAAO,iBAAiB,MAAM,qCAAqC,CAAC;AACpE,OAAO,kBAAkB,MAAM,qCAAqC,CAAC;AACrE,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AACrE,OAAO,EACL,YAAY,EACZ,WAAW,EACX,WAAW,GACZ,MAAM,8BAA8B,CAAC;AAetC;;;;;GAKG;AAKH,MAAM,OAAO,oBAAoB;;QA0CvB,YAAO,GAAG,IAAI,CAAC,aAAa,CAAC;QAC7B,YAAO,GAAG,IAAI,CAAC,YAAY,CAAC;;4BAlCb,CAAC;6BAIA,CAAC;;;IA+Cf,KAAK,CAAC,SAAS,CAAC,CAAsB;;QAC9C,IAAI,CAAC,gBAAgB,CAAC,kBAAkB,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;QACtD,MAAA,IAAI,CAAC,k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KAAK,CAAC,CAAC,CAAC;QAChE,IAAI,CAAC,gBAAgB,CAAC,kBAAkB,CAAC,IAAI,CAAC,CAAC;IACjD,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["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 oldValY = this.contentHeight;\n private oldValX = this.contentWidth;\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 // scroll update if number of rows changed\n if (this.contentHeight < this.oldValY && this.verticalScroll) {\n this.verticalScroll.scrollTop += this.contentHeight - this.oldValY;\n }\n this.oldValY = this.contentHeight;\n\n // scroll update if number of cols changed\n if (this.contentWidth < this.oldValX) {\n this.horizontalScroll.scrollLeft += this.contentWidth - this.oldValX;\n }\n this.oldValX = this.contentWidth;\n\n this.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"]}
|
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { h, Host, } from "@stencil/core";
|
|
5
5
|
import LocalScrollService, { getContentSize } from "../../services/local.scroll.service";
|
|
6
|
-
import { getScrollbarSize } from "../../utils";
|
|
7
6
|
import { AutohideScrollPlugin } from "./autohide-scroll.plugin";
|
|
8
7
|
import { LocalScrollTimer } from "../../services/local.scroll.timer";
|
|
8
|
+
import { getScrollbarSize } from "../../utils";
|
|
9
9
|
/**
|
|
10
10
|
* Virtual scroll component
|
|
11
11
|
*/
|
|
@@ -92,7 +92,7 @@ export class RevogrScrollVirtual {
|
|
|
92
92
|
this.localScrollService.setParams({
|
|
93
93
|
contentSize: this.dimensionStore.get('realSize'),
|
|
94
94
|
clientSize: this.size,
|
|
95
|
-
virtualSize: this.viewportStore.get('
|
|
95
|
+
virtualSize: this.viewportStore.get('clientSize'),
|
|
96
96
|
}, this.dimension);
|
|
97
97
|
}
|
|
98
98
|
onScroll(e) {
|
|
@@ -112,8 +112,10 @@ export class RevogrScrollVirtual {
|
|
|
112
112
|
}
|
|
113
113
|
render() {
|
|
114
114
|
const sizeType = this.dimension === 'rgRow' ? 'height' : 'width';
|
|
115
|
-
|
|
116
|
-
|
|
115
|
+
const size = getContentSize(this.dimensionStore.get('realSize'), this.size, this.viewportStore.get('clientSize') // content viewport size
|
|
116
|
+
);
|
|
117
|
+
return (h(Host, { key: '2d11902403db45b805bde88b6fc40acff4b6b910', onScroll: (e) => this.onScroll(e) }, h("div", { key: '74978e90cbf66e3fb6dcc25bd5882346f1515c39', style: {
|
|
118
|
+
[sizeType]: `${size}px`,
|
|
117
119
|
} })));
|
|
118
120
|
}
|
|
119
121
|
static get is() { return "revogr-scroll-virtual"; }
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"revogr-scroll-virtual.js","sourceRoot":"","sources":["../../../src/components/scrollable/revogr-scroll-virtual.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,OAAO,IAAI,cAAc,EACzB,KAAK,EAEL,CAAC,EACD,IAAI,EACJ,MAAM,EACN,IAAI,GACL,MAAM,eAAe,CAAC;AACvB,OAAO,kBAAkB,EAAE,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAC;
|
|
1
|
+
{"version":3,"file":"revogr-scroll-virtual.js","sourceRoot":"","sources":["../../../src/components/scrollable/revogr-scroll-virtual.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,OAAO,IAAI,c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AAI,CAAC,SAAS,KAAK,OAAO,EAAE,CAAC;YAC/B,IAAI,GAAG,WAAW,CAAC;QACrB,CAAC;QACD,yBAAyB;QACzB,IAAI,IAAI,CAAC,gBAAgB,CAAC,OAAO,CAAC,IAAI,CAAC,SAAS,EAAE,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC;YACrE,MAAA,IAAI,CAAC,kBAAkB,0CAAE,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;QACrE,CAAC;IACH,CAAC;IAED,MAAM;QACJ,MAAM,QAAQ,GAAG,IAAI,CAAC,SAAS,KAAK,OAAO,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,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,CAAC,wBAAwB;SAC9D,CAAC;QACF,OAAO,CACL,EAAC,IAAI,qDAAC,QAAQ,EAAE,CAAC,CAAa,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC;YACjD,4DACE,KAAK,EAAE;oBACL,CAAC,QAAQ,CAAC,EAAE,GAAG,IAAI,IAAI;iBACxB,GACD,CACG,CACR,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["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"]}
|
|
@@ -27,8 +27,8 @@ export default class ColumnDataProvider {
|
|
|
27
27
|
return sources;
|
|
28
28
|
}, {});
|
|
29
29
|
}
|
|
30
|
-
column(c,
|
|
31
|
-
return this.getColumn(c,
|
|
30
|
+
column(c, type = 'rgCol') {
|
|
31
|
+
return this.getColumn(c, type);
|
|
32
32
|
}
|
|
33
33
|
getColumn(virtualIndex, type) {
|
|
34
34
|
return getSourceItem(this.dataSources[type].store, virtualIndex);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"column.data.provider.js","sourceRoot":"","sources":["../../src/services/column.data.provider.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,eAAe,CAAC;AACnC,OAAO,IAAI,MAAM,aAAa,CAAC;AAE/B,OAAO,EACL,WAAW,EACX,SAAS,EACT,aAAa,EACb,+BAA+B,EAE/B,wBAAwB,EACxB,uBAAuB,GACxB,MAAM,QAAQ,CAAC;AAOhB,OAAO,EAAoB,aAAa,EAAE,MAAM,uBAAuB,CAAC;AASxE,MAAM,CAAC,OAAO,OAAO,kBAAkB;IAKrC,IAAI,KAAK;QACP,MAAM,KAAK,GAAiB,EAAE,CAAC;QAC/B,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;QAC7B,IAAI,OAAO,EAAE,CAAC;YACZ,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;gBAClC,KAAK,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC;YACpC,CAAC,CAAC,CAAC;QACL,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC;IAED,IAAI,MAAM;QACR,OAAO,IAAI,CAAC,WAAW,CAAC;IAC1B,CAAC;IACD;QAjBA,YAAO,GAAmB,IAAI,CAAC;QAC/B,eAAU,GAA4B,IAAI,CAAC;QAiBzC,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC,MAAM,CACnC,CAAC,OAA0B,EAAE,CAAgB,EAAE,EAAE;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IAAmB,EAAE,EAAE;YACrC,MAAM,IAAI,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;YACxD,IAAI,CAAC,IAAI,EAAE,CAAC,CAAgB,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,KAAK,GAAG,SAAS,CAAC,CAAC,CAAC;YACxD,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC,GAAG,IAAI,CAAC,EAAE,CAAC,CAAC;QACxD,CAAC,CAAC,CAAC;QAEH,IAAI,CAAC,OAAO,GAAG,EAAE,CAAC;IACpB,CAAC;CACF","sourcesContent":["import reduce from 'lodash/reduce';\nimport each from 'lodash/each';\n\nimport {\n columnTypes,\n DataStore,\n getSourceItem,\n getSourceItemVirtualIndexByProp,\n Groups,\n setSourceByPhysicalIndex,\n setSourceByVirtualIndex,\n} from '@store';\nimport type {\n ColumnProp,\n ColumnRegular,\n DimensionCols,\n DimensionColPin,\n} from '@type';\nimport { ColumnCollection, getColumnType } from '../utils/column.utils';\n\nexport type ColumnDataSources = Record<\n DimensionCols,\n DataStore<ColumnRegular, DimensionCols>\n>;\ntype Sorting = Record<ColumnProp, ColumnRegular>;\ntype SortingOrder = Record<ColumnProp, 'asc' | 'desc' | undefined>;\n\nexport default class ColumnDataProvider {\n readonly dataSources: ColumnDataSources;\n sorting: Sorting | null = null;\n collection: ColumnCollection | null = null;\n\n get order() {\n const order: SortingOrder = {};\n const sorting = this.sorting;\n if (sorting) {\n Object.keys(sorting).forEach(prop => {\n order[prop] = sorting[prop].order;\n });\n }\n return order;\n }\n\n get stores() {\n return this.dataSources;\n }\n constructor() {\n this.dataSources = columnTypes.reduce(\n (sources: ColumnDataSources, k: DimensionCols) => {\n sources[k] = new DataStore(k);\n return sources;\n },\n {} as ColumnDataSources,\n );\n }\n\n column(c: number, pin?: DimensionColPin): ColumnRegular | undefined {\n return this.getColumn(c, pin || 'rgCol');\n }\n\n getColumn(\n virtualIndex: number,\n type: DimensionCols,\n ): ColumnRegular | undefined {\n return getSourceItem(this.dataSources[type].store, virtualIndex);\n }\n\n getRawColumns(): Record<DimensionCols, ColumnRegular[]> {\n return reduce(\n this.dataSources,\n (\n result: Record<DimensionCols, ColumnRegular[]>,\n item,\n type: DimensionCols,\n ) => {\n result[type] = item.store.get('source');\n return result;\n },\n {\n rgCol: [],\n colPinStart: [],\n colPinEnd: [],\n },\n );\n }\n\n getColumns(type: DimensionCols | 'all' = 'all'): ColumnRegular[] {\n const columnsByType = this.getRawColumns();\n if (type !== 'all') {\n return columnsByType[type];\n }\n return columnTypes.reduce((r: ColumnRegular[], t) => [...r, ...columnsByType[t]], []);\n }\n\n getColumnIndexByProp(prop: ColumnProp, type: DimensionCols): number {\n return getSourceItemVirtualIndexByProp(this.dataSources[type].store, prop);\n }\n\n getColumnByProp(prop: ColumnProp) {\n return this.collection?.columnByProp[prop];\n }\n\n refreshByType(type: DimensionCols) {\n this.dataSources[type].refresh();\n }\n\n /**\n * Main method to set columns\n */\n setColumns(data: ColumnCollection): ColumnCollection {\n columnTypes.forEach(k => {\n // set columns data\n this.dataSources[k].updateData(data.columns[k], {\n // max depth level\n depth: data.maxLevel,\n\n // groups\n groups: data.columnGrouping[k].reduce((res: Groups, g) => {\n if (!res[g.level]) {\n res[g.level] = [];\n }\n res[g.level].push(g);\n return res;\n }, {}),\n });\n });\n this.sorting = data.sort;\n this.collection = data;\n return data;\n }\n\n /**\n * Used in plugins\n * Modify columns in store\n */\n updateColumns(updatedColumns: ColumnRegular[]) {\n // collect column by type and propert\n const columnByKey = updatedColumns.reduce(\n (\n res: Partial<Record<DimensionCols, Record<ColumnProp, ColumnRegular>>>,\n c,\n ) => {\n const type = getColumnType(c);\n if (!res[type]) {\n res[type] = {};\n }\n res[type][c.prop] = c;\n return res;\n },\n {},\n );\n\n // find indexes in source\n const colByIndex: Partial<\n Record<DimensionCols, Record<number, ColumnRegular>>\n > = {};\n for (const t in columnByKey) {\n if (!columnByKey.hasOwnProperty(t)) {\n continue;\n }\n const type = t as DimensionCols;\n const colsToUpdate = columnByKey[type];\n const sourceItems = this.dataSources[type].store.get('source');\n colByIndex[type] = {};\n for (let i = 0; i < sourceItems.length; i++) {\n const column = sourceItems[i];\n const colToUpdateIfExists = colsToUpdate?.[column.prop];\n\n // update column if exists in source\n if (colToUpdateIfExists) {\n colByIndex[type][i] = colToUpdateIfExists;\n }\n }\n }\n for (const t in colByIndex) {\n if (!colByIndex.hasOwnProperty(t)) {\n continue;\n }\n const type = t as DimensionCols;\n setSourceByPhysicalIndex(\n this.dataSources[type].store,\n colByIndex[type] || {},\n );\n }\n }\n\n updateColumn(column: ColumnRegular, index: number) {\n const type = getColumnType(column);\n setSourceByVirtualIndex(this.dataSources[type].store, { [index]: column });\n }\n\n updateColumnSorting(\n column: ColumnRegular,\n index: number,\n sorting: 'asc' | 'desc' | undefined,\n additive: boolean,\n ): ColumnRegular {\n if (!additive) {\n this.clearSorting();\n }\n column.order = sorting;\n if (!this.sorting) {\n this.sorting = {};\n }\n this.sorting[column.prop] = column;\n this.updateColumn(column, index);\n return column;\n }\n\n clearSorting() {\n const types = reduce(\n this.sorting,\n (r: { [key in Partial<DimensionCols>]: boolean }, c: ColumnRegular) => {\n const k = getColumnType(c);\n r[k] = true;\n return r;\n },\n {} as { [key in Partial<DimensionCols>]: boolean },\n );\n each(types, (_, type: DimensionCols) => {\n const cols = this.dataSources[type].store.get('source');\n each(cols, (c: ColumnRegular) => (c.order = undefined));\n this.dataSources[type].setData({ source: [...cols] });\n });\n\n this.sorting = {};\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"column.data.provider.js","sourceRoot":"","sources":["../../src/services/column.data.provider.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,eAAe,CAAC;AACnC,OAAO,IAAI,MAAM,aAAa,CAAC;AAE/B,OAAO,EACL,WAAW,EACX,SAAS,EACT,aAA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'lodash/each';\n\nimport {\n columnTypes,\n DataStore,\n getSourceItem,\n getSourceItemVirtualIndexByProp,\n Groups,\n setSourceByPhysicalIndex,\n setSourceByVirtualIndex,\n} from '@store';\nimport type {\n ColumnProp,\n ColumnRegular,\n DimensionCols,\n} from '@type';\nimport { ColumnCollection, getColumnType } from '../utils/column.utils';\n\nexport type ColumnDataSources = Record<\n DimensionCols,\n DataStore<ColumnRegular, DimensionCols>\n>;\ntype Sorting = Record<ColumnProp, ColumnRegular>;\ntype SortingOrder = Record<ColumnProp, 'asc' | 'desc' | undefined>;\n\nexport default class ColumnDataProvider {\n readonly dataSources: ColumnDataSources;\n sorting: Sorting | null = null;\n collection: ColumnCollection | null = null;\n\n get order() {\n const order: SortingOrder = {};\n const sorting = this.sorting;\n if (sorting) {\n Object.keys(sorting).forEach(prop => {\n order[prop] = sorting[prop].order;\n });\n }\n return order;\n }\n\n get stores() {\n return this.dataSources;\n }\n constructor() {\n this.dataSources = columnTypes.reduce(\n (sources: ColumnDataSources, k: DimensionCols) => {\n sources[k] = new DataStore(k);\n return sources;\n },\n {} as ColumnDataSources,\n );\n }\n\n column(c: number, type: DimensionCols = 'rgCol'): ColumnRegular | undefined {\n return this.getColumn(c, type);\n }\n\n getColumn(\n virtualIndex: number,\n type: DimensionCols,\n ): ColumnRegular | undefined {\n return getSourceItem(this.dataSources[type].store, virtualIndex);\n }\n\n getRawColumns(): Record<DimensionCols, ColumnRegular[]> {\n return reduce(\n this.dataSources,\n (\n result: Record<DimensionCols, ColumnRegular[]>,\n item,\n type: DimensionCols,\n ) => {\n result[type] = item.store.get('source');\n return result;\n },\n {\n rgCol: [],\n colPinStart: [],\n colPinEnd: [],\n },\n );\n }\n\n getColumns(type: DimensionCols | 'all' = 'all'): ColumnRegular[] {\n const columnsByType = this.getRawColumns();\n if (type !== 'all') {\n return columnsByType[type];\n }\n return columnTypes.reduce((r: ColumnRegular[], t) => [...r, ...columnsByType[t]], []);\n }\n\n getColumnIndexByProp(prop: ColumnProp, type: DimensionCols): number {\n return getSourceItemVirtualIndexByProp(this.dataSources[type].store, prop);\n }\n\n getColumnByProp(prop: ColumnProp) {\n return this.collection?.columnByProp[prop];\n }\n\n refreshByType(type: DimensionCols) {\n this.dataSources[type].refresh();\n }\n\n /**\n * Main method to set columns\n */\n setColumns(data: ColumnCollection): ColumnCollection {\n columnTypes.forEach(k => {\n // set columns data\n this.dataSources[k].updateData(data.columns[k], {\n // max depth level\n depth: data.maxLevel,\n\n // groups\n groups: data.columnGrouping[k].reduce((res: Groups, g) => {\n if (!res[g.level]) {\n res[g.level] = [];\n }\n res[g.level].push(g);\n return res;\n }, {}),\n });\n });\n this.sorting = data.sort;\n this.collection = data;\n return data;\n }\n\n /**\n * Used in plugins\n * Modify columns in store\n */\n updateColumns(updatedColumns: ColumnRegular[]) {\n // collect column by type and propert\n const columnByKey = updatedColumns.reduce(\n (\n res: Partial<Record<DimensionCols, Record<ColumnProp, ColumnRegular>>>,\n c,\n ) => {\n const type = getColumnType(c);\n if (!res[type]) {\n res[type] = {};\n }\n res[type][c.prop] = c;\n return res;\n },\n {},\n );\n\n // find indexes in source\n const colByIndex: Partial<\n Record<DimensionCols, Record<number, ColumnRegular>>\n > = {};\n for (const t in columnByKey) {\n if (!columnByKey.hasOwnProperty(t)) {\n continue;\n }\n const type = t as DimensionCols;\n const colsToUpdate = columnByKey[type];\n const sourceItems = this.dataSources[type].store.get('source');\n colByIndex[type] = {};\n for (let i = 0; i < sourceItems.length; i++) {\n const column = sourceItems[i];\n const colToUpdateIfExists = colsToUpdate?.[column.prop];\n\n // update column if exists in source\n if (colToUpdateIfExists) {\n colByIndex[type][i] = colToUpdateIfExists;\n }\n }\n }\n for (const t in colByIndex) {\n if (!colByIndex.hasOwnProperty(t)) {\n continue;\n }\n const type = t as DimensionCols;\n setSourceByPhysicalIndex(\n this.dataSources[type].store,\n colByIndex[type] || {},\n );\n }\n }\n\n updateColumn(column: ColumnRegular, index: number) {\n const type = getColumnType(column);\n setSourceByVirtualIndex(this.dataSources[type].store, { [index]: column });\n }\n\n updateColumnSorting(\n column: ColumnRegular,\n index: number,\n sorting: 'asc' | 'desc' | undefined,\n additive: boolean,\n ): ColumnRegular {\n if (!additive) {\n this.clearSorting();\n }\n column.order = sorting;\n if (!this.sorting) {\n this.sorting = {};\n }\n this.sorting[column.prop] = column;\n this.updateColumn(column, index);\n return column;\n }\n\n clearSorting() {\n const types = reduce(\n this.sorting,\n (r: { [key in Partial<DimensionCols>]: boolean }, c: ColumnRegular) => {\n const k = getColumnType(c);\n r[k] = true;\n return r;\n },\n {} as { [key in Partial<DimensionCols>]: boolean },\n );\n each(types, (_, type: DimensionCols) => {\n const cols = this.dataSources[type].store.get('source');\n each(cols, (c: ColumnRegular) => (c.order = undefined));\n this.dataSources[type].setData({ source: [...cols] });\n });\n\n this.sorting = {};\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"data.provider.js","sourceRoot":"","sources":["../../src/services/data.provider.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,eAAe,CAAC;AAEnC,OAAO,EACL,SAAS,EACT,QAAQ,EACR,SAAS,EACT,aAAa,EACb,oBAAoB,GAGrB,MAAM,QAAQ,CAAC;AAchB;;GAEG;AAEH,MAAM,OAAO,YAAY;IAEvB,YAAoB,iBAAoC;QAApC,sBAAiB,GAAjB,iBAAiB,CAAmB;QACtD,IAAI,CAAC,MAAM,GAAG,MAAM,CAClB,QAAQ,EACR,CAAC,OAAgC,EAAE,CAAgB,EAAE,EAAE;YACrD,OAAO,CAAC,CAAC,CAAC,GAAG,IAAI,SAAS,CAAC,CAAC,CAAC,CAAC;YAC9B,OAAO,OAAO,CAAC;QACjB,CAAC,EACD,EAAE,CACe,CAAC;IACtB,CAAC;IAED,OAAO,CACL,IAAgB,EAChB,OAAsB,OAAO,EAC7B,kBAAkB,GAAG,KAAK,EAC1B,QAIC,EACD,MAAM,GAAG,KAAK;QAEd,iBAAiB;QACjB,IAAI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AC,CAAC;QACjD,IAAI,IAAI,KAAK,OAAO,EAAE,CAAC;YACrB,IAAI,CAAC,iBAAiB,CAAC,OAAO,CAC5B,oBAAoB,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,MAAM,EACxC,IAAI,CACL,CAAC;QACJ,CAAC;IACH,CAAC;CACF","sourcesContent":["import reduce from 'lodash/reduce';\n\nimport {\n isRowType,\n rowTypes,\n DataStore,\n getSourceItem,\n getVisibleSourceItem,\n Groups,\n Trimmed,\n} from '@store';\nimport DimensionProvider from './dimension.provider';\nimport type { GroupLabelTemplateFunc } from '../plugins/groupingRow/grouping.row.types';\nimport type {\n DataLookup,\n DimensionRows,\n DataType,\n BeforeSaveDataDetails,\n} from '@type';\n\nexport type RowDataSources = {\n [T in DimensionRows]: DataStore<DataType, DimensionRows>;\n};\n\n/**\n * Data source provider\n */\n\nexport class DataProvider {\n public readonly stores: RowDataSources;\n constructor(private dimensionProvider: DimensionProvider) {\n this.stores = reduce(\n rowTypes,\n (sources: Partial<RowDataSources>, k: DimensionRows) => {\n sources[k] = new DataStore(k);\n return sources;\n },\n {},\n ) as RowDataSources;\n }\n\n setData(\n data: DataType[],\n type: DimensionRows = 'rgRow',\n disableVirtualRows = false,\n grouping?: {\n depth: number;\n groups?: Groups;\n customRenderer?: GroupLabelTemplateFunc;\n },\n silent = false,\n ): DataType[] {\n // set rgRow data\n this.stores[type].updateData([...data], grouping, silent);\n\n // for pinned row no need virtual data\n const noVirtual = type !== 'rgRow' || disableVirtualRows;\n this.dimensionProvider.setData(data.length, type, noVirtual);\n return data;\n }\n\n getModel(virtualIndex: number, type: DimensionRows = 'rgRow') {\n const store = this.stores[type].store;\n return getSourceItem(store, virtualIndex);\n }\n\n changeOrder({ rowType = 'rgRow', from, to }: { rowType: DimensionRows, from: number; to: number }) {\n const service = this.stores[rowType];\n const items = [...service.store.get('items')];\n const prevItems = [...items];\n\n const toMove = items.splice(from, 1);\n items.splice(to, 0, ...toMove);\n this.dimensionProvider.updateSizesPositionByNewDataIndexes(rowType, items, prevItems);\n service.setData({ items });\n }\n\n setCellData(\n { type, rowIndex, prop, val }: Pick<BeforeSaveDataDetails, 'type' | 'rowIndex' | 'prop' | 'val'>, \n mutate = true,\n ) {\n const model = this.getModel(rowIndex, type);\n model[prop] = val;\n this.stores[type].setSourceData({ [rowIndex]: model }, mutate);\n }\n\n setRangeData(data: DataLookup, type: DimensionRows) {\n const items: Record<number, DataType> = {};\n for (let rowIndex in data) {\n const oldModel = (items[rowIndex] = getSourceItem(\n this.stores[type].store,\n parseInt(rowIndex, 10),\n ));\n if (!oldModel) {\n continue;\n }\n for (let prop in data[rowIndex]) {\n oldModel[prop] = data[rowIndex][prop];\n }\n }\n this.stores[type].setSourceData(items);\n }\n\n refresh(type: DimensionRows | 'all' = 'all') {\n if (isRowType(type)) {\n this.refreshItems(type);\n }\n rowTypes.forEach((t: DimensionRows) => this.refreshItems(t));\n }\n\n refreshItems(type: DimensionRows = 'rgRow') {\n const items = this.stores[type].store.get('items');\n this.stores[type].setData({ items: [...items] });\n }\n\n setGrouping({ depth }: { depth: number }, type: DimensionRows = 'rgRow') {\n this.stores[type].setData({ groupingDepth: depth });\n }\n\n setTrimmed(trimmed: Trimmed, type: DimensionRows = 'rgRow') {\n const store = this.stores[type];\n store.addTrimmed(trimmed);\n this.dimensionProvider.setTrimmed(trimmed, type);\n if (type === 'rgRow') {\n this.dimensionProvider.setData(\n getVisibleSourceItem(store.store).length,\n type,\n );\n }\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"data.store.js","sourceRoot":"","sources":["../../../src/store/dataSource/data.store.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,kBAAkB,CAAC;AACzC,OAAO,KAAK,MAAM,cAAc,CAAC;AACjC,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C,OAAO,EAAW,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAC1D,OAAO,EAAE,QAA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;AACH,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,wBAAwB,CACtC,KAAuC,EACvC,YAA+B,EAC/B,MAAM,GAAG,IAAI;IAEb,MAAM,MAAM,GAAG,KAAK,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IACnC,KAAK,IAAI,KAAK,IAAI,YAAY,EAAE,CAAC;QAC/B,MAAM,CAAC,KAAK,CAAC,GAAG,YAAY,CAAC,KAAK,CAAC,CAAC;IACtC,CAAC;IACD,IAAI,MAAM,EAAE,CAAC;QACX,KAAK,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC;IACnC,CAAC;AACH,CAAC;AAED,MAAM,UAAU,QAAQ,CACtB,KAAuC,EACvC,KAAe;IAEf,KAAK,CAAC,GAAG,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;AAC5B,CAAC;AAED,MAAM,UAAU,+BAA+B,CAC7C,KAAyC,EACzC,IAAgB;IAEhB,MAAM,KAAK,GAAG,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IACjC,MAAM,MAAM,GAAG,KAAK,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IACnC,MAAM,aAAa,GAAG,SAAS,CAAC,MAAM,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC;IAClD,OAAO,KAAK,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC;AACtC,CAAC","sourcesContent":["import findIndex from 'lodash/findIndex';\nimport range from 'lodash/range';\nimport { createStore } from '@stencil/store';\n\nimport { Trimmed, trimmedPlugin } from './trimmed.plugin';\nimport { setStore, Observable } from '../../utils';\nimport { proxyPlugin } from './data.proxy';\nimport { GroupLabelTemplateFunc } from '../../plugins/groupingRow/grouping.row.types';\nimport { DimensionRows, DimensionCols } from '@type';\nimport type {\n ColumnProperties,\n ColumnGrouping,\n ColumnRegular,\n DataType,\n DataSourceState,\n ColumnProp,\n} from '@type';\n\nexport interface Group extends ColumnProperties {\n name: string;\n children: (ColumnGrouping | ColumnRegular)[];\n // props/ids\n ids: (string | number)[];\n}\nexport type Groups = Record<any, any>;\nexport type GDataType = DataType | ColumnRegular;\nexport type GDimension = DimensionRows | DimensionCols;\nexport type DSourceState<\n T1 extends GDataType,\n T2 extends GDimension,\n> = DataSourceState<T1, T2> & {\n groupingCustomRenderer?: GroupLabelTemplateFunc | null;\n};\n\n/**\n * Data store\n * Manage the state of a data source and provide methods for updating, adding, and refreshing the data.\n */\nexport class DataStore<T extends GDataType, ST extends GDimension> {\n private readonly dataStore: Observable<DSourceState<T, ST>>;\n get store(): Observable<DSourceState<T, ST>> {\n return this.dataStore;\n }\n constructor(type: ST, storeData?: DSourceState<T, ST>) {\n const store = (this.dataStore = createStore<DSourceState<T, ST>>({\n items: [],\n proxyItems: [],\n source: [],\n groupingDepth: 0,\n groups: {},\n type,\n trimmed: {},\n groupingCustomRenderer: undefined,\n ...storeData,\n }));\n store.use(proxyPlugin(store));\n store.use(trimmedPlugin(store));\n }\n\n /**\n * full data source update\n * @param source - data column/rgRow source\n * @param grouping - grouping information if present\n */\n updateData(\n source: T[],\n grouping?: {\n depth: number;\n groups?: Groups;\n customRenderer?: GroupLabelTemplateFunc;\n },\n silent = false,\n ) {\n // during full update we do drop trim\n if (!silent) {\n this.store.set('trimmed', {});\n }\n // clear items\n this.store.set('items', []);\n const items = range(0, source?.length || 0);\n\n // set proxy first\n setStore(this.store, {\n source,\n proxyItems: [...items],\n });\n // update data items\n this.store.set('items', items);\n // apply grouping if present\n if (grouping) {\n setStore(this.store, {\n groupingDepth: grouping.depth,\n groups: grouping.groups,\n groupingCustomRenderer: grouping.customRenderer,\n });\n }\n }\n\n addTrimmed(some: Partial<Trimmed>) {\n let trimmed = this.store.get('trimmed');\n trimmed = { ...trimmed, ...some };\n setStore(this.store, { trimmed });\n }\n\n setSourceData(items: Record<number, any>, mutate = true) {\n setSourceByVirtualIndex(this.store, items, mutate);\n }\n\n // local data update\n setData(input: Partial<DSourceState<T, ST>>) {\n const data: Partial<DSourceState<T, ST>> = {\n ...input,\n };\n setStore(this.store, data);\n }\n\n refresh() {\n const source = this.store.get('source');\n this.store.set('source', [...source]);\n }\n}\n/**\n * get physical index by virtual\n * @param store - store to process\n */\nexport function getPhysical(\n store: Observable<DSourceState<any, any>>,\n virtualIndex: number,\n) {\n const items = store.get('items');\n return items[virtualIndex];\n}\n\n/**\n * get all visible items\n * @param store - store to process\n */\nexport function getVisibleSourceItem(\n store: Observable<DSourceState<any, any>>,\n) {\n const source = store.get('source');\n return store.get('items').map(v => source[v]);\n}\n\n/**\n * get mapped item from source\n * @param store - store to process\n * @param virtualIndex - virtual index to process\n */\nexport const getSourceItem = <T1 extends GDataType, T2 extends GDimension>(\n store: Observable<DSourceState<T1, T2>>,\n virtualIndex: number,\n) => {\n const source = store.get('source');\n return source[getSourcePhysicalIndex(store, virtualIndex)];\n};\n/**\n * Get physical index from virtual index\n */\nexport const getSourcePhysicalIndex = <T1 extends GDataType, T2 extends GDimension>(\n store: Observable<DSourceState<T1, T2>>,\n virtualIndex: number,\n) => {\n const items = store.get('items');\n return items[virtualIndex];\n};\n\n/**\n * Apply silently item/model/row value to data source\n * @param store - data source with changes\n * @param modelByIndex - collection of rows/values with virtual indexes to setup/replace in store/data source\n * @param mutate - if true, store will be mutated and whole viewport will be re-rendered\n */\nexport function setSourceByVirtualIndex<T extends GDataType>(\n store: Observable<DSourceState<T, any>>,\n modelByIndex: Record<number, T | undefined>,\n mutate = true,\n) {\n const items = store.get('items');\n const source = store.get('source');\n\n for (let virtualIndex in modelByIndex) {\n const realIndex = items[virtualIndex];\n const item = modelByIndex[virtualIndex];\n source[realIndex] = item as T;\n }\n if (mutate) {\n store.set('source', [...source]);\n }\n}\n\n/**\n * set item to source\n * @param store - store to process\n * @param modelByIndex - collection of rows with physical indexes to setup\n * @param mutate - if true, store will be mutated and whole viewport will be re-rendered\n */\nexport function setSourceByPhysicalIndex<T extends GDataType>(\n store: Observable<DSourceState<T, any>>,\n modelByIndex: Record<number, T>,\n mutate = true,\n) {\n const source = store.get('source');\n for (let index in modelByIndex) {\n source[index] = modelByIndex[index];\n }\n if (mutate) {\n store.set('source', [...source]);\n }\n}\n\nexport function setItems<T extends GDataType>(\n store: Observable<DSourceState<T, any>>,\n items: number[],\n) {\n store.set('items', items);\n}\n\nexport function getSourceItemVirtualIndexByProp(\n store: Observable<DSourceState<any, any>>,\n prop: ColumnProp,\n) {\n const items = store.get('items');\n const source = store.get('source');\n const physicalIndex = findIndex(source, { prop });\n return items.indexOf(physicalIndex);\n}\n"]}
|
|
1
|
+
{"version":3,"file":"data.store.js","sourceRoot":"","sources":["../../../src/store/dataSource/data.store.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,kBAAkB,CAAC;AACzC,OAAO,KAAK,MAAM,cAAc,CAAC;AACjC,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C,OAAO,EAAW,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAC1D,OAAO,EAAE,QAAQ,EAAc,MAAM,aAAa,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AA6B3C;;;GAGG;AACH,MAAM,OAAO,SAAS;IAEpB,IAAI,KAAK;QACP,OAAO,IAAI,CAAC,SAAS,CAAC;IACxB,CAAC;IACD,YAAY,IAAQ,EAAE,SAA+B;QACnD,MAAM,KAAK,GAAG,CAAC,IAAI,CAAC,SAAS,GAAG,WAAW,iBACzC,KAAK,EAAE,EAAE,EACT,UAAU,EAAE,EAAE,EACd,MAAM,EAAE,EAAE,EACV,aAAa,EAAE,CAAC,EAChB,MAAM,EAAE,EAAE,EACV,IAAI,EACJ,OAAO,EAAE,EAAE,EACX,sBAAsB,EAAE,SAAS,IAC9B,SAAS,EACZ,CAAC,CAAC;QACJ,KAAK,CAAC,GAAG,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC;QAC9B,KAAK,CAAC,GAAG,CAAC,aAAa,CAAC,KAAK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,IAAgB;IAEhB,MAAM,KAAK,GAAG,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IACjC,MAAM,MAAM,GAAG,KAAK,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IACnC,MAAM,aAAa,GAAG,SAAS,CAAC,MAAM,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC;IAClD,OAAO,KAAK,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC;AACtC,CAAC","sourcesContent":["import findIndex from 'lodash/findIndex';\nimport range from 'lodash/range';\nimport { createStore } from '@stencil/store';\n\nimport { Trimmed, trimmedPlugin } from './trimmed.plugin';\nimport { setStore, Observable } from '../../utils';\nimport { proxyPlugin } from './data.proxy';\nimport { GroupLabelTemplateFunc } from '../../plugins/groupingRow/grouping.row.types';\nimport type {\n DimensionRows,\n DimensionCols,\n ColumnProperties,\n ColumnGrouping,\n ColumnRegular,\n DataType,\n DataSourceState,\n ColumnProp,\n} from '@type';\n\nexport interface Group extends ColumnProperties {\n name: string;\n children: (ColumnGrouping | ColumnRegular)[];\n // props/ids\n ids: (string | number)[];\n}\nexport type Groups = Record<any, any>;\nexport type GDataType = DataType | ColumnRegular;\nexport type GDimension = DimensionRows | DimensionCols;\nexport type DSourceState<\n T1 extends GDataType,\n T2 extends GDimension,\n> = DataSourceState<T1, T2> & {\n groupingCustomRenderer?: GroupLabelTemplateFunc | null;\n};\n\n/**\n * Data store\n * Manage the state of a data source and provide methods for updating, adding, and refreshing the data.\n */\nexport class DataStore<T extends GDataType, ST extends GDimension> {\n private readonly dataStore: Observable<DSourceState<T, ST>>;\n get store(): Observable<DSourceState<T, ST>> {\n return this.dataStore;\n }\n constructor(type: ST, storeData?: DSourceState<T, ST>) {\n const store = (this.dataStore = createStore<DSourceState<T, ST>>({\n items: [],\n proxyItems: [],\n source: [],\n groupingDepth: 0,\n groups: {},\n type,\n trimmed: {},\n groupingCustomRenderer: undefined,\n ...storeData,\n }));\n store.use(proxyPlugin(store));\n store.use(trimmedPlugin(store));\n }\n\n /**\n * full data source update\n * @param source - data column/rgRow source\n * @param grouping - grouping information if present\n */\n updateData(\n source: T[],\n grouping?: {\n depth: number;\n groups?: Groups;\n customRenderer?: GroupLabelTemplateFunc;\n },\n silent = false,\n ) {\n // during full update we do drop trim\n if (!silent) {\n this.store.set('trimmed', {});\n }\n // clear items\n this.store.set('items', []);\n const items = range(0, source?.length || 0);\n\n // set proxy first\n setStore(this.store, {\n source,\n proxyItems: [...items],\n });\n // update data items\n this.store.set('items', items);\n // apply grouping if present\n if (grouping) {\n setStore(this.store, {\n groupingDepth: grouping.depth,\n groups: grouping.groups,\n groupingCustomRenderer: grouping.customRenderer,\n });\n }\n }\n\n addTrimmed(some: Partial<Trimmed>) {\n let trimmed = this.store.get('trimmed');\n trimmed = { ...trimmed, ...some };\n setStore(this.store, { trimmed });\n }\n\n setSourceData(items: Record<number, any>, mutate = true) {\n setSourceByVirtualIndex(this.store, items, mutate);\n }\n\n // local data update\n setData(input: Partial<DSourceState<T, ST>>) {\n const data: Partial<DSourceState<T, ST>> = {\n ...input,\n };\n setStore(this.store, data);\n }\n\n refresh() {\n const source = this.store.get('source');\n this.store.set('source', [...source]);\n }\n}\n/**\n * get physical index by virtual\n * @param store - store to process\n */\nexport function getPhysical(\n store: Observable<DSourceState<any, any>>,\n virtualIndex: number,\n) {\n const items = store.get('items');\n return items[virtualIndex];\n}\n\n/**\n * get all visible items\n * @param store - store to process\n */\nexport function getVisibleSourceItem(\n store: Observable<DSourceState<any, any>>,\n) {\n const source = store.get('source');\n return store.get('items').map(v => source[v]);\n}\n\n/**\n * get mapped item from source\n * @param store - store to process\n * @param virtualIndex - virtual index to process\n */\nexport const getSourceItem = <T1 extends GDataType, T2 extends GDimension>(\n store: Observable<DSourceState<T1, T2>>,\n virtualIndex: number,\n) => {\n const source = store.get('source');\n return source[getSourcePhysicalIndex(store, virtualIndex)];\n};\n/**\n * Get physical index from virtual index\n */\nexport const getSourcePhysicalIndex = <T1 extends GDataType, T2 extends GDimension>(\n store: Observable<DSourceState<T1, T2>>,\n virtualIndex: number,\n) => {\n const items = store.get('items');\n return items[virtualIndex];\n};\n\n/**\n * Apply silently item/model/row value to data source\n * @param store - data source with changes\n * @param modelByIndex - collection of rows/values with virtual indexes to setup/replace in store/data source\n * @param mutate - if true, store will be mutated and whole viewport will be re-rendered\n */\nexport function setSourceByVirtualIndex<T extends GDataType>(\n store: Observable<DSourceState<T, any>>,\n modelByIndex: Record<number, T | undefined>,\n mutate = true,\n) {\n const items = store.get('items');\n const source = store.get('source');\n\n for (let virtualIndex in modelByIndex) {\n const realIndex = items[virtualIndex];\n const item = modelByIndex[virtualIndex];\n source[realIndex] = item as T;\n }\n if (mutate) {\n store.set('source', [...source]);\n }\n}\n\n/**\n * set item to source\n * @param store - store to process\n * @param modelByIndex - collection of rows with physical indexes to setup\n * @param mutate - if true, store will be mutated and whole viewport will be re-rendered\n */\nexport function setSourceByPhysicalIndex<T extends GDataType>(\n store: Observable<DSourceState<T, any>>,\n modelByIndex: Record<number, T>,\n mutate = true,\n) {\n const source = store.get('source');\n for (let index in modelByIndex) {\n source[index] = modelByIndex[index];\n }\n if (mutate) {\n store.set('source', [...source]);\n }\n}\n\nexport function setItems<T extends GDataType>(\n store: Observable<DSourceState<T, any>>,\n items: number[],\n) {\n store.set('items', items);\n}\n\nexport function getSourceItemVirtualIndexByProp(\n store: Observable<DSourceState<any, any>>,\n prop: ColumnProp,\n) {\n const items = store.get('items');\n const source = store.get('source');\n const physicalIndex = findIndex(source, { prop });\n return items.indexOf(physicalIndex);\n}\n"]}
|
|
@@ -16,10 +16,12 @@ function initialState() {
|
|
|
16
16
|
// virtual dom item order to render
|
|
17
17
|
start: 0,
|
|
18
18
|
end: 0,
|
|
19
|
-
// size of viewport in px
|
|
19
|
+
// size of virtual viewport in px
|
|
20
20
|
virtualSize: 0,
|
|
21
21
|
// total number of items
|
|
22
22
|
realCount: 0,
|
|
23
|
+
// size of viewport in px
|
|
24
|
+
clientSize: 0,
|
|
23
25
|
};
|
|
24
26
|
}
|
|
25
27
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"viewport.store.js","sourceRoot":"","sources":["../../../src/store/vp/viewport.store.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,eAAe,EACf,YAAY,EACZ,WAAW,EACX,yBAAyB,EACzB,aAAa,EACb,YAAY,EACZ,qBAAqB,EACrB,4BAA4B,GAE7B,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAmB,QAAQ,EAAE,MAAM,aAAa,CAAC;AAOxD;;;;GAIG;AACH,SAAS,YAAY;IACnB,OAAO;QACL,6CAA6C;QAC7C,KAAK,EAAE,EAAE;QACT,mCAAmC;QACnC,KAAK,EAAE,CAAC;QACR,GAAG,EAAE,CAAC;QAEN,
|
|
1
|
+
{"version":3,"file":"viewport.store.js","sourceRoot":"","sources":["../../../src/store/vp/viewport.store.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,eAAe,EACf,YAAY,EACZ,WAAW,EACX,yBAAyB,EACzB,aAAa,EACb,YAAY,EACZ,qBAAqB,EACrB,4BAA4B,GAE7B,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAmB,QAAQ,EAAE,MAAM,aAAa,CAAC;AAOxD;;;;GAIG;AACH,SAAS,YAAY;IACnB,OAAO;QACL,6CAA6C;QAC7C,KAAK,EAAE,EAAE;QACT,mCAAmC;QACnC,KAAK,EAAE,CAAC;QACR,GAAG,EAAE,CAAC;QAEN,iCAAiC;QACjC,WAAW,EAAE,CAAC;QAEd,wBAAwB;QACxB,SAAS,EAAE,CAAC;QAEZ,yBAAyB;QACzB,UAAU,EAAE,CAAC;KACd,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,OAAO,aAAa;IAMxB,IAAI,cAAc;QAChB,OAAO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AAC,GAAG,CAAC,OAAO,CAAC;YAC9B,GAAG,EAAE,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC;SAC3B,CAAC;IACJ,CAAC;IAED,WAAW,CAAC,IAA4B;QACtC,4DAA4D;QAC5D,yDAAyD;QACzD,IAAI,OAAO,IAAI,CAAC,SAAS,KAAK,QAAQ,IAAI,OAAO,IAAI,CAAC,WAAW,KAAK,QAAQ,EAAE,CAAC;YAC/E,IAAI,mCAAQ,IAAI,KAAE,KAAK,EAAE,IAAI,CAAC,KAAK,IAAI,EAAE,GAAE,CAAC;QAC9C,CAAC;QACD,QAAQ,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;IAC7B,CAAC;CACF","sourcesContent":["import {\n DimensionDataViewport,\n addMissingItems,\n getFirstItem,\n getLastItem,\n getUpdatedItemsByPosition,\n isActiveRange,\n setItemSizes,\n updateMissingAndRange,\n isActiveRangeOutsideLastItem,\n ItemsToUpdate,\n} from './viewport.helpers';\nimport { createStore } from '@stencil/store';\nimport { type Observable, setStore } from '../../utils';\nimport type {\n VirtualPositionItem,\n ViewportState,\n MultiDimensionType,\n} from '@type';\n\n/**\n * Viewport store\n * Used for virtualization (process of rendering only visible part of data)\n * Redraws viewport based on position and dimension\n */\nfunction initialState(): ViewportState {\n return {\n // virtual item information per rendered item\n items: [],\n // virtual dom item order to render\n start: 0,\n end: 0,\n\n // size of virtual viewport in px\n virtualSize: 0,\n\n // total number of items\n realCount: 0,\n\n // size of viewport in px\n clientSize: 0,\n };\n}\n\n/**\n * Viewport store class\n */\nexport class ViewportStore {\n readonly store: Observable<ViewportState>;\n\n // last coordinate for store position restore\n private lastKnownScroll = 0;\n\n get lastCoordinate() {\n return this.lastKnownScroll;\n }\n set lastCoordinate(value: number) {\n this.lastKnownScroll = value;\n }\n constructor(readonly type: MultiDimensionType) {\n this.store = createStore(initialState());\n }\n\n /**\n * Render viewport based on coordinate\n * It's the main method for draw\n * Use force if you want to re-render viewport\n */\n setViewPortCoordinate(\n position: number,\n dimension: DimensionDataViewport,\n force = false,\n ) {\n const viewportSize = this.store.get('virtualSize');\n // no visible data to calculate\n if (!viewportSize) {\n return;\n }\n\n const frameOffset = 1;\n const singleOffsetInPx = dimension.originItemSize * frameOffset;\n // add offset to virtual size from both sides\n const outsize = singleOffsetInPx * 2;\n // math virtual size is based on visible area + 2 items outside of visible area\n const virtualSize = viewportSize + outsize;\n\n // expected no scroll if real size less than virtual size, position is 0\n let maxCoordinate = 0;\n // if there is nodes outside of viewport, max coordinate has to be adjusted\n if (dimension.realSize > viewportSize) {\n // max coordinate is real size minus virtual/rendered space\n maxCoordinate = dimension.realSize - viewportSize - singleOffsetInPx;\n }\n\n let pos = position;\n // limit position to max and min coordinates\n if (pos < 0) {\n pos = 0;\n } else if (pos > maxCoordinate) {\n pos = maxCoordinate;\n }\n\n // store last coordinate for further restore on redraw\n this.lastCoordinate = pos;\n\n // actual position is less than first item start based on offset\n pos -= singleOffsetInPx;\n pos = pos < 0 ? 0 : pos < maxCoordinate ? pos : maxCoordinate;\n\n let allItems: ItemsToUpdate;\n // if force clear all items and start from 0\n if (force) {\n allItems = {\n items: [],\n start: 0,\n end: 0,\n };\n } else {\n allItems = this.getItems();\n }\n\n const firstItem: VirtualPositionItem | undefined = getFirstItem(allItems);\n const lastItem: VirtualPositionItem | undefined = getLastItem(allItems);\n\n let toUpdate: Partial<ViewportState> = {};\n\n // left position changed\n // verify if new position is in range of previously rendered first item\n if (!isActiveRange(pos, dimension.realSize, firstItem, lastItem)) {\n toUpdate = {\n ...toUpdate,\n ...getUpdatedItemsByPosition(\n pos,\n allItems,\n this.store.get('realCount'),\n virtualSize,\n dimension,\n ),\n };\n this.setViewport({ ...toUpdate });\n // verify is render area is outside of last item\n } else if (\n isActiveRangeOutsideLastItem(pos, virtualSize, firstItem, lastItem)\n ) {\n const items = [...allItems.items];\n // check is any item missing for fulfill content\n const missing = addMissingItems(\n firstItem,\n this.store.get('realCount'),\n virtualSize + pos - firstItem.start,\n allItems,\n {\n sizes: dimension.sizes,\n originItemSize: dimension.originItemSize,\n },\n );\n\n // update missing items\n if (missing.length) {\n const range = {\n start: this.store.get('start'),\n end: this.store.get('end'),\n };\n updateMissingAndRange(items, missing, range);\n toUpdate = {\n ...toUpdate,\n items: [...items],\n ...range,\n };\n this.setViewport({ ...toUpdate });\n }\n }\n }\n\n /**\n * Set sizes for existing items\n */\n setOriginalSizes(size: number) {\n const items = this.store.get('items');\n const count = items.length;\n // viewport not inited\n if (!count) {\n return;\n }\n\n setStore(this.store, {\n items: setItemSizes(\n items,\n this.store.get('start'),\n size,\n this.lastCoordinate,\n ),\n });\n }\n\n getItems(): ItemsToUpdate {\n return {\n items: this.store.get('items'),\n start: this.store.get('start'),\n end: this.store.get('end'),\n };\n }\n\n setViewport(data: Partial<ViewportState>) {\n // drop items on virtual size change, require a new item set\n // drop items on real size change, require a new item set\n if (typeof data.realCount === 'number' || typeof data.virtualSize === 'number') {\n data = { ...data, items: data.items || [] };\n }\n setStore(this.store, data);\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../src/types/interfaces.ts"],"names":[],"mappings":"AAgY4D,CAAC","sourcesContent":["import type { VNode } from '@stencil/core';\n\nimport type {\n DimensionCols,\n DimensionRows,\n DimensionColPin,\n DimensionType,\n MultiDimensionType,\n} from './dimension';\nimport type {\n Cell,\n EditorCtr,\n FocusedCells,\n OldNewRangeMapping,\n RangeArea,\n SelectionStoreState,\n} from './selection';\nimport type { Observable } from '../utils';\nimport type { JSXBase } from '@stencil/core/internal';\n\nexport type Nullable<T> = {\n [P in keyof T]: T[P] | null;\n};\n\n/**\n * Advanced column data schema model.\n * Used for transpassing data to cell renderer and editor.\n */\nexport type ColumnDataSchemaModel = {\n /**\n * Column prop used for mapping value to cell from data source model/row\n */\n prop: ColumnProp;\n /**\n * Row data object\n */\n model: DataType;\n /**\n * Column data object\n */\n column: ColumnRegular;\n /**\n * Index of the row in the viewport\n */\n rowIndex: number;\n /**\n * Index of the column in the viewport\n */\n colIndex: number;\n /**\n * Column type based on viewport\n */\n colType: DimensionCols;\n /**\n * Row type based on viewport\n */\n type: DimensionRows;\n /**\n * Row models based on viewport\n */\n data: DataType[];\n /**\n * Current cell data value\n * Mapped from model through column property like model['prop']\n */\n value?: any;\n};\n/**\n * Template property for each cell, extends the column data schema model.\n * Additionally, it provides access to the providers injected into the template.\n */\nexport interface CellTemplateProp extends ColumnDataSchemaModel {\n /**\n * Providers injected into the template\n */\n providers: Providers;\n}\n/**\n * The ReadOnlyFormat type is a boolean value or a function that takes ColumnDataSchemaModel\n * as a parameter and returns a boolean value.\n *\n * If it is a boolean value, it represents whether the cell in question is read-only.\n * If it is a function, it returns whether the cell in question is read-only based on the provided\n * ColumnDataSchemaModel.\n */\nexport type ReadOnlyFormat =\n | boolean\n | ((params: ColumnDataSchemaModel) => boolean);\nexport type RowDrag =\n | boolean\n | {\n (params: ColumnDataSchemaModel): boolean;\n };\n/**\n * `ColumnGrouping` type is used to define a grouping in a column.\n */\nexport type ColumnGrouping<T = any> = {\n /**\n * An array of objects that represent the children of the grouping.\n */\n children: (ColumnGrouping<T> | ColumnRegular)[];\n /**\n * A `DataFormat` object that represents the name of the grouping.\n */\n name: DataFormat<T>;\n};\n/**\n * Configuration for header inner template properties\n */\nexport interface ColumnProperties {\n /**\n * Header inner template\n * Function/component to render custom header content\n */\n columnTemplate?: ColumnTemplateFunc;\n /**\n * Header Cell properties\n * Custom function/component to render header properties\n */\n columnProperties?: ColPropertiesFunc;\n}\n/**\n * Type that represents a collection of column types.\n * The keys are the names of the column types and the values are the corresponding column type objects.\n */\nexport type ColumnTypes = {\n /**\n * The name of the column type.\n */\n [name: string]: ColumnType;\n};\n\n/**\n * Interface for custom cell renderer.\n */\nexport interface CellTemplate {\n // TODO: Add Promise support for template and all custom function so user will be able to use async render on the light speed\n (\n createElement: HyperFunc<VNode>,\n props: CellTemplateProp,\n additionalData?: any,\n ): any;\n}\n/**\n * Interface for regular column definition.\n * Regular column can be any column that is not a grouping column.\n */\nexport interface ColumnType extends ColumnProperties {\n /**\n * Represents whether the column or cell is read-only.\n * Can be a boolean or a function that returns a boolean.\n * The function receives column data as a parameter.\n */\n readonly?: ReadOnlyFormat;\n /**\n * Represents the default column size.\n */\n size?: number;\n /**\n * Represents the minimal column size.\n * This property cannot be less than cell padding\n * in order to keep performance on top and minimize DOM elements number.\n */\n minSize?: number;\n /**\n * Represents the maximum column size.\n */\n maxSize?: number;\n /**\n * Represents a custom editor defined in editors property.\n * Can be a string or an editor constructor function.\n */\n editor?: string | EditorCtr;\n /**\n * Represents cell properties for custom styling, classes, and events.\n */\n cellProperties?: PropertiesFunc;\n /**\n * Represents the cell template for custom rendering.\n */\n cellTemplate?: CellTemplate;\n /**\n * Represents the cell compare function for custom sorting.\n */\n cellCompare?: CellCompareFunc;\n\n /**\n * Represents the cell value parse function for custom parsing.\n * Currently only used for filtering.\n */\n cellParser?: (model: DataType, column: ColumnRegular) => any;\n}\nexport type Order = 'asc' | 'desc' | undefined;\n/**\n * Interface for regular column definition.\n * Regular column can be any column that is not a grouping column.\n *\n */\n/**\n * ColumnRegular interface represents regular column definition.\n * Regular column can be any column that is not a grouping column.\n */\nexport interface ColumnRegular extends ColumnType {\n /**\n * Column prop used for mapping value to cell from data source model/row, used for indexing.\n */\n prop: ColumnProp;\n /**\n * Column pin 'colPinStart'|'colPinEnd'.\n */\n pin?: DimensionColPin;\n /**\n * Column header text.\n */\n name?: any;\n /**\n * Column size would be changed based on space left.\n */\n autoSize?: boolean;\n /**\n * Filter. Require filter plugin to be installed and activated through grid config filter.\n */\n filter?: boolean | string | string[];\n /**\n * Is column can be sorted, check cellCompare function for custom sorting.\n */\n sortable?: boolean;\n /**\n * Sort order.\n */\n order?: Order;\n /**\n * Is cell in column or individual can be dragged.\n */\n rowDrag?: RowDrag;\n /**\n * Represents type defined in columnTypes property through grid config.\n */\n columnType?: string;\n /**\n * Function called before column applied to the store.\n */\n beforeSetup?(rgCol: ColumnRegular): void;\n /**\n * Additional properties can be added to the column definition.\n */\n [key: string]: any;\n}\n\nexport type ColumnData = (ColumnGrouping | ColumnRegular)[];\n/**\n * Column template property.\n * Contains extended properties for column.\n */\nexport interface ColumnTemplateProp extends ColumnRegular {\n /**\n * Providers injected into the template.\n */\n providers: Providers<DimensionCols | 'rowHeaders'>;\n /**\n * Index of the column, used for mapping value to cell from data source model/row.\n */\n index: number;\n}\n\nexport type ColumnPropProp = ColumnGrouping | ColumnTemplateProp;\n// Column prop used for mapping value to cell from data source model/row, used for indexing.\nexport type ColumnProp = string | number;\n\nexport type DataFormat<T = any> = T;\n\n/**\n * Additional properties applied to the cell.\n * Contains properties for custom cell rendering.\n */\nexport type CellProps = JSXBase.HTMLAttributes<HTMLDivElement> & {\n className?: JSXBase.HTMLAttributes<HTMLDivElement>['class'];\n // Additional properties for custom cell rendering\n [attr: string]: string | number | object | boolean | undefined;\n};\n\n\n/**\n * Providers for grid which are going to be injected into each cell template\n */\nexport type Providers<T = DimensionRows> = {\n /**\n * Dimension type (e.g. row or column)\n */\n type: T;\n /**\n * Flag indicating if grid is in readonly mode\n */\n readonly: boolean;\n /**\n * Data source store\n */\n data: Observable<DataSourceState<any, any>> | ColumnRegular[];\n /**\n * Viewport store\n */\n viewport: Observable<ViewportState>;\n /**\n * Dimension store\n */\n dimension: Observable<DimensionSettingsState>;\n /**\n * Selection store\n */\n selection: Observable<SelectionStoreState>;\n};\n/**\n * `HyperFunc` is a function that takes an HTML tag or component, and returns a\n * JSX element. This function is used to create JSX elements in a context where\n * JSX is not valid.\n */\nexport interface HyperFunc<T> {\n // (tag: any): T;\n (tag: any): T;\n}\n\n/**\n * `HyperFunc` is a function that takes an HTML tag or component, and returns a\n * JSX element. This function is used to create JSX elements in a context where\n * JSX is not valid.\n */\nexport type VNodeResponse = (VNode | string | number) | (VNode | string | number)[] | null | undefined;\n\n/**\n * `HyperFunc` is a function that takes an HTML tag or component, and returns a\n * JSX element. This function is used to create JSX elements in a context where\n * JSX is not valid.\n */\nexport interface HyperFunc<T> {\n (tag: any, data: any): T;\n}\n/**\n * `HyperFunc` is a function that takes an HTML tag or component, and returns a\n * JSX element. This function is used to create JSX elements in a context where\n * JSX is not valid.\n */\nexport interface HyperFunc<T> {\n (tag: any, text: string): T;\n}\n\n/**\n * `HyperFunc` is a function that takes an HTML tag or component, and returns a\n * JSX element. This function is used to create JSX elements in a context where\n * JSX is not valid.\n */\nexport interface HyperFunc<T> {\n (sel: any, children: Array<T | undefined | null>): T;\n}\n\n/**\n * `HyperFunc` is a function that takes an HTML tag or component, and returns a\n * JSX element. This function is used to create JSX elements in a context where\n * JSX is not valid.\n */\nexport interface HyperFunc<T> {\n (sel: any, data: any, text: string): T;\n}\n\n/**\n * `HyperFunc` is a function that takes an HTML tag or component, and returns a\n * JSX element. This function is used to create JSX elements in a context where\n * JSX is not valid.\n */\nexport interface HyperFunc<T> {\n (sel: any, data: any, children: Array<T | undefined | null>): T;\n}\n\n/**\n * `HyperFunc` is a function that takes an HTML tag or component, and returns a\n * JSX element. This function is used to create JSX elements in a context where\n * JSX is not valid.\n */\nexport interface HyperFunc<T> {\n (sel: any, data: any, children: T): T;\n}\n\n/**\n * `ExtraNodeFuncConfig` is a configuration object for `External nodes rendered in grid in HTMLRevogrExtraElement`.\n */\nexport interface ExtraNodeFuncConfig { refresh: () => void };\n\n/**\n * `FocusTemplateFunc` is a function that takes an HTML tag or component, and\n * returns a JSX element. This function is used to create JSX elements in a\n * context where JSX is not valid.\n */\nexport type FocusTemplateFunc = (\n createElement: HyperFunc<VNode>,\n detail: FocusRenderEvent,\n) => any;\n\n/**\n * `CellCompareFunc` is a function that takes the column property to compare,\n * the data of the first cell, and the data of the second cell. It returns a\n * number indicating the relative order of the two cells.\n */\nexport type CellCompareFunc = (\n // The column property to compare.\n prop: ColumnProp,\n // The data of the first cell.\n a: DataType,\n // The data of the second cell.\n b: DataType,\n) => number;\nexport type ColumnTemplateFunc = (\n createElement: HyperFunc<VNode>,\n props: ColumnTemplateProp,\n additionalData?: any,\n) => any;\nexport type PropertiesFunc = (\n props: CellTemplateProp,\n) => CellProps | void | undefined;\nexport type ColPropertiesFunc = (\n props: ColumnPropProp,\n) => CellProps | void | undefined;\nexport type DataType<D = any> = {\n [T in ColumnProp]: DataFormat<D>;\n};\n\nexport type DataLookup<T = any> = {\n [rowIndex: number]: DataType<T>;\n};\n/**\n * `RowDefinition` is a type that represents a row definition in the\n * viewport.\n */\nexport type RowDefinition = {\n /**\n * The type of the row.\n */\n type: DimensionRows;\n /**\n * The size of the row.\n */\n size: number;\n /**\n * The index of the row.\n */\n index: number;\n};\nexport interface RowHeaders extends ColumnRegular {}\n/**\n * `ViewPortResizeEvent` is an object that contains information about a resize\n * event in the viewport.\n */\nexport type ViewPortResizeEvent = {\n /* The dimension of the viewport being resized. */\n dimension: DimensionType;\n /* The new size of the viewport. */\n size: number;\n /* Indicates whether the resize event is for a row header. */\n rowHeader?: boolean;\n};\n\n/**\n * `ViewPortScrollEvent` is an object that contains information about a scroll\n * event in the viewport.\n */\nexport type ViewPortScrollEvent = {\n /**\n * The dimension of the viewport being scrolled.\n */\n dimension: DimensionType;\n /**\n * The coordinate of the scroll event.\n */\n coordinate: number;\n /**\n * The change in coordinate between scroll events.\n */\n delta?: number;\n /**\n * Indicates whether the scroll event occurred outside the viewport.\n */\n outside?: boolean;\n};\n\n/**\n * `InitialHeaderClick` represents the information needed to handle a click\n * event on the initial column header.\n */\nexport type InitialHeaderClick = {\n /**\n * The index of the column header that was clicked.\n */\n index: number;\n /**\n * The original mouse event that triggered the click.\n */\n originalEvent: MouseEvent;\n /**\n * The column that was clicked.\n */\n column: ColumnRegular;\n providers: Providers<DimensionCols | 'rowHeaders'>;\n};\n\n/**\n * `Range` is an object that represents a range of values.\n */\nexport type Range = {\n /**\n * The start of the range.\n */\n start: number;\n /**\n * The end of the range.\n */\n end: number;\n};\n\n/**\n * `ViewportStateItems` is an object that represents the items in a viewport\n * along with their corresponding range.\n */\nexport type ViewportStateItems = {\n /**\n * The items in the viewport.\n */\n items: VirtualPositionItem[];\n} & Range;\n\n/**\n * `ViewportState` is an object that represents the state of a viewport.\n */\nexport interface ViewportState extends ViewportStateItems {\n /**\n * The number of real items in the viewport.\n */\n realCount: number;\n /**\n * The virtual size of the viewport.\n */\n virtualSize: number;\n}\n\n/**\n * `ViewSettingSizeProp` is a record that maps column or row indexes to their\n * corresponding sizes.\n */\nexport type ViewSettingSizeProp = Record<string, number>;\n\n/**\n * `VirtualPositionItem` is an object that represents a virtual position item\n * in the viewport.\n */\nexport interface VirtualPositionItem extends PositionItem {\n /**\n * The size of the virtual position item.\n */\n size: number;\n}\nexport type DataSourceState<\n T extends DataType | ColumnRegular,\n ST extends DimensionRows | DimensionCols,\n> = {\n // items - index based array for mapping to source tree\n items: number[];\n // stores items even if they trimmed in items[] there will be a sorted list here\n proxyItems: number[];\n // original data source\n source: T[];\n // grouping\n groupingDepth: number;\n groups: Record<any, any>;\n // data source type\n type: ST;\n // trim data, to hide entities from visible data source\n trimmed: Record<any, any>;\n};\nexport interface PositionItem {\n itemIndex: number;\n start: number;\n end: number;\n}\n/**\n * Object containing information about calculated dimensions.\n * Used for both columns and rows.\n */\nexport interface DimensionCalc {\n /**\n * Array of indexes of visible items.\n */\n indexes: number[];\n\n /**\n * Count of visible items.\n */\n count: number;\n\n /**\n * Array of indexes of visible items.\n * Used for mapping items to their position in DOM.\n */\n positionIndexes: number[];\n\n /**\n * Mapping of position to item.\n * Used for mapping position in DOM to item.\n */\n positionIndexToItem: {\n /**\n * Position in DOM.\n */\n [position: number]: PositionItem;\n };\n\n /**\n * Mapping of index to item.\n * Used for mapping index in data source to item.\n */\n indexToItem: {\n /**\n * Index in data source.\n */\n [index: number]: PositionItem;\n };\n\n /**\n * Object containing information about trimmed data.\n * Used for hiding entities from visible data source.\n */\n trimmed: { [index: number]: number} | null;\n\n /**\n * Object containing size for each visible item.\n * provider stores only changed sizes, not all of them\n * same as indexes but for sizes and positions\n * virtual item index to size\n */\n sizes: ViewSettingSizeProp;\n}\n/**\n * Represents the settings state of a dimension.\n * It extends the calculation properties of a dimension.\n * It also includes the real size and origin item size of the dimension.\n */\nexport interface DimensionSettingsState extends DimensionCalc {\n /**\n * Represents the real size of the dimension.\n */\n realSize: number;\n\n /**\n * Represents the origin item size of the dimension.\n */\n originItemSize: number;\n}\n\n/**\n * Represents the mapping of dimension types to their corresponding observable stores.\n */\nexport type DimensionStores = {\n [T in MultiDimensionType]: Observable<DimensionSettingsState>;\n};\n\n/**\n * Represents the mapping of dimension types to their corresponding observable stores for the viewport.\n */\nexport type ViewportStores = {\n [T in MultiDimensionType]: Observable<ViewportState>;\n};\n\n/**\n * Represents the event object that is emitted when the drag operation starts.\n */\nexport interface DragStartEvent {\n /**\n * Represents the original mouse event that triggered the drag operation.\n */\n originalEvent: MouseEvent;\n\n /**\n * Represents the model of the column being dragged.\n */\n model: ColumnDataSchemaModel;\n}\n\n/**\n * Represents the event object that is emitted before cell rendering.\n * It includes information about the dimension type, column, row, and model.\n */\nexport interface BeforeCellRenderEvent<T = any> extends AllDimensionType {\n /**\n * Represents the column being rendered.\n */\n column: VirtualPositionItem;\n\n /**\n * Represents the row being rendered.\n */\n row: VirtualPositionItem;\n\n /**\n * Represents the model being rendered.\n */\n model: T;\n}\n\n/**\n * Represents the event object that is emitted before row rendering.\n * It includes information about the dimension type, data item, item, and node.\n */\nexport interface BeforeRowRenderEvent<T = any> extends AllDimensionType {\n /**\n * Represents the data item being rendered.\n */\n model: T;\n\n /**\n * Represents the item being rendered.\n */\n item: VirtualPositionItem;\n\n /**\n * Represents the node being rendered.\n */\n node: VNode;\n}\n\n/**\n * Represents the event object that is emitted after rendering.\n * It includes information about the dimension type.\n */\nexport type AfterRendererEvent = {\n /**\n * Represents the type of dimension being rendered.\n */\n type: DimensionType;\n};\n\n/**\n * Represents the mapping of dimension types to their corresponding dimension types.\n */\nexport interface AllDimensionType {\n /**\n * Represents the dimension type for rows.\n */\n rowType: DimensionRows;\n\n /**\n * Represents the dimension type for columns.\n */\n colType: DimensionCols;\n}\n\n/**\n * Represents the event object that is emitted when applying focus.\n * It includes information about the dimension type and focused cells.\n */\nexport interface ApplyFocusEvent extends AllDimensionType, FocusedCells {}\n\n/**\n * Represents the event object that is emitted before focus rendering.\n * It includes information about the dimension type and range area.\n */\nexport interface FocusRenderEvent extends AllDimensionType {\n /**\n * Represents the range area of the focus.\n */\n range: RangeArea;\n\n rowDimension: DimensionSettingsState;\n\n colDimension: DimensionSettingsState;\n\n /**\n * Changes for the next cell to focus. @example { y: -1 }\n */\n next?: Partial<Cell>;\n}\n\nexport interface FocusAfterRenderEvent extends AllDimensionType {\n model?: any;\n column?: ColumnRegular;\n /**\n * Index of the row in the viewport\n */\n rowIndex: number;\n /**\n * Index of the column in the viewport\n */\n colIndex: number;\n}\n/**\n * Represents the event object that is emitted when scrolling occurs.\n * The `type` property indicates the type of dimension (row or column) being scrolled.\n * The `coordinate` property represents the current scroll position in that dimension.\n */\nexport type ScrollCoordinateEvent = {\n /**\n * Represents the type of dimension being scrolled.\n * Possible values are 'rgRow' and 'rgCol'.\n */\n type: DimensionType;\n\n /**\n * Represents the current scroll position in the specified dimension.\n * The value is a number representing the coordinate in pixels.\n */\n coordinate: number;\n};\n\n/** Range paste. */\nexport type RangeClipboardPasteEvent = {\n data: DataLookup;\n models: Partial<DataLookup>;\n range: RangeArea | null;\n} & AllDimensionType;\n\n/** Range copy. */\nexport type RangeClipboardCopyEventProps<T = any> = {\n data: DataFormat<T>[][];\n range: RangeArea;\n mapping: OldNewRangeMapping;\n} & AllDimensionType;\n"]}
|
|
1
|
+
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../src/types/interfaces.ts"],"names":[],"mappings":"AAgY4D,CAAC","sourcesContent":["import type { VNode } from '@stencil/core';\n\nimport type {\n DimensionCols,\n DimensionRows,\n DimensionColPin,\n DimensionType,\n MultiDimensionType,\n} from './dimension';\nimport type {\n Cell,\n EditorCtr,\n FocusedCells,\n OldNewRangeMapping,\n RangeArea,\n SelectionStoreState,\n} from './selection';\nimport type { Observable } from '../utils';\nimport type { JSXBase } from '@stencil/core/internal';\n\nexport type Nullable<T> = {\n [P in keyof T]: T[P] | null;\n};\n\n/**\n * Advanced column data schema model.\n * Used for transpassing data to cell renderer and editor.\n */\nexport type ColumnDataSchemaModel = {\n /**\n * Column prop used for mapping value to cell from data source model/row\n */\n prop: ColumnProp;\n /**\n * Row data object\n */\n model: DataType;\n /**\n * Column data object\n */\n column: ColumnRegular;\n /**\n * Index of the row in the viewport\n */\n rowIndex: number;\n /**\n * Index of the column in the viewport\n */\n colIndex: number;\n /**\n * Column type based on viewport\n */\n colType: DimensionCols;\n /**\n * Row type based on viewport\n */\n type: DimensionRows;\n /**\n * Row models based on viewport\n */\n data: DataType[];\n /**\n * Current cell data value\n * Mapped from model through column property like model['prop']\n */\n value?: any;\n};\n/**\n * Template property for each cell, extends the column data schema model.\n * Additionally, it provides access to the providers injected into the template.\n */\nexport interface CellTemplateProp extends ColumnDataSchemaModel {\n /**\n * Providers injected into the template\n */\n providers: Providers;\n}\n/**\n * The ReadOnlyFormat type is a boolean value or a function that takes ColumnDataSchemaModel\n * as a parameter and returns a boolean value.\n *\n * If it is a boolean value, it represents whether the cell in question is read-only.\n * If it is a function, it returns whether the cell in question is read-only based on the provided\n * ColumnDataSchemaModel.\n */\nexport type ReadOnlyFormat =\n | boolean\n | ((params: ColumnDataSchemaModel) => boolean);\nexport type RowDrag =\n | boolean\n | {\n (params: ColumnDataSchemaModel): boolean;\n };\n/**\n * `ColumnGrouping` type is used to define a grouping in a column.\n */\nexport type ColumnGrouping<T = any> = {\n /**\n * An array of objects that represent the children of the grouping.\n */\n children: (ColumnGrouping<T> | ColumnRegular)[];\n /**\n * A `DataFormat` object that represents the name of the grouping.\n */\n name: DataFormat<T>;\n};\n/**\n * Configuration for header inner template properties\n */\nexport interface ColumnProperties {\n /**\n * Header inner template\n * Function/component to render custom header content\n */\n columnTemplate?: ColumnTemplateFunc;\n /**\n * Header Cell properties\n * Custom function/component to render header properties\n */\n columnProperties?: ColPropertiesFunc;\n}\n/**\n * Type that represents a collection of column types.\n * The keys are the names of the column types and the values are the corresponding column type objects.\n */\nexport type ColumnTypes = {\n /**\n * The name of the column type.\n */\n [name: string]: ColumnType;\n};\n\n/**\n * Interface for custom cell renderer.\n */\nexport interface CellTemplate {\n // TODO: Add Promise support for template and all custom function so user will be able to use async render on the light speed\n (\n createElement: HyperFunc<VNode>,\n props: CellTemplateProp,\n additionalData?: any,\n ): any;\n}\n/**\n * Interface for regular column definition.\n * Regular column can be any column that is not a grouping column.\n */\nexport interface ColumnType extends ColumnProperties {\n /**\n * Represents whether the column or cell is read-only.\n * Can be a boolean or a function that returns a boolean.\n * The function receives column data as a parameter.\n */\n readonly?: ReadOnlyFormat;\n /**\n * Represents the default column size.\n */\n size?: number;\n /**\n * Represents the minimal column size.\n * This property cannot be less than cell padding\n * in order to keep performance on top and minimize DOM elements number.\n */\n minSize?: number;\n /**\n * Represents the maximum column size.\n */\n maxSize?: number;\n /**\n * Represents a custom editor defined in editors property.\n * Can be a string or an editor constructor function.\n */\n editor?: string | EditorCtr;\n /**\n * Represents cell properties for custom styling, classes, and events.\n */\n cellProperties?: PropertiesFunc;\n /**\n * Represents the cell template for custom rendering.\n */\n cellTemplate?: CellTemplate;\n /**\n * Represents the cell compare function for custom sorting.\n */\n cellCompare?: CellCompareFunc;\n\n /**\n * Represents the cell value parse function for custom parsing.\n * Currently only used for filtering.\n */\n cellParser?: (model: DataType, column: ColumnRegular) => any;\n}\nexport type Order = 'asc' | 'desc' | undefined;\n/**\n * Interface for regular column definition.\n * Regular column can be any column that is not a grouping column.\n *\n */\n/**\n * ColumnRegular interface represents regular column definition.\n * Regular column can be any column that is not a grouping column.\n */\nexport interface ColumnRegular extends ColumnType {\n /**\n * Column prop used for mapping value to cell from data source model/row, used for indexing.\n */\n prop: ColumnProp;\n /**\n * Column pin 'colPinStart'|'colPinEnd'.\n */\n pin?: DimensionColPin;\n /**\n * Column header text.\n */\n name?: any;\n /**\n * Column size would be changed based on space left.\n */\n autoSize?: boolean;\n /**\n * Filter. Require filter plugin to be installed and activated through grid config filter.\n */\n filter?: boolean | string | string[];\n /**\n * Is column can be sorted, check cellCompare function for custom sorting.\n */\n sortable?: boolean;\n /**\n * Sort order.\n */\n order?: Order;\n /**\n * Is cell in column or individual can be dragged.\n */\n rowDrag?: RowDrag;\n /**\n * Represents type defined in columnTypes property through grid config.\n */\n columnType?: string;\n /**\n * Function called before column applied to the store.\n */\n beforeSetup?(rgCol: ColumnRegular): void;\n /**\n * Additional properties can be added to the column definition.\n */\n [key: string]: any;\n}\n\nexport type ColumnData = (ColumnGrouping | ColumnRegular)[];\n/**\n * Column template property.\n * Contains extended properties for column.\n */\nexport interface ColumnTemplateProp extends ColumnRegular {\n /**\n * Providers injected into the template.\n */\n providers: Providers<DimensionCols | 'rowHeaders'>;\n /**\n * Index of the column, used for mapping value to cell from data source model/row.\n */\n index: number;\n}\n\nexport type ColumnPropProp = ColumnGrouping | ColumnTemplateProp;\n// Column prop used for mapping value to cell from data source model/row, used for indexing.\nexport type ColumnProp = string | number;\n\nexport type DataFormat<T = any> = T;\n\n/**\n * Additional properties applied to the cell.\n * Contains properties for custom cell rendering.\n */\nexport type CellProps = JSXBase.HTMLAttributes<HTMLDivElement> & {\n className?: JSXBase.HTMLAttributes<HTMLDivElement>['class'];\n // Additional properties for custom cell rendering\n [attr: string]: string | number | object | boolean | undefined;\n};\n\n\n/**\n * Providers for grid which are going to be injected into each cell template\n */\nexport type Providers<T = DimensionRows> = {\n /**\n * Dimension type (e.g. row or column)\n */\n type: T;\n /**\n * Flag indicating if grid is in readonly mode\n */\n readonly: boolean;\n /**\n * Data source store\n */\n data: Observable<DataSourceState<any, any>> | ColumnRegular[];\n /**\n * Viewport store\n */\n viewport: Observable<ViewportState>;\n /**\n * Dimension store\n */\n dimension: Observable<DimensionSettingsState>;\n /**\n * Selection store\n */\n selection: Observable<SelectionStoreState>;\n};\n/**\n * `HyperFunc` is a function that takes an HTML tag or component, and returns a\n * JSX element. This function is used to create JSX elements in a context where\n * JSX is not valid.\n */\nexport interface HyperFunc<T> {\n // (tag: any): T;\n (tag: any): T;\n}\n\n/**\n * `HyperFunc` is a function that takes an HTML tag or component, and returns a\n * JSX element. This function is used to create JSX elements in a context where\n * JSX is not valid.\n */\nexport type VNodeResponse = (VNode | string | number) | (VNode | string | number)[] | null | undefined;\n\n/**\n * `HyperFunc` is a function that takes an HTML tag or component, and returns a\n * JSX element. This function is used to create JSX elements in a context where\n * JSX is not valid.\n */\nexport interface HyperFunc<T> {\n (tag: any, data: any): T;\n}\n/**\n * `HyperFunc` is a function that takes an HTML tag or component, and returns a\n * JSX element. This function is used to create JSX elements in a context where\n * JSX is not valid.\n */\nexport interface HyperFunc<T> {\n (tag: any, text: string): T;\n}\n\n/**\n * `HyperFunc` is a function that takes an HTML tag or component, and returns a\n * JSX element. This function is used to create JSX elements in a context where\n * JSX is not valid.\n */\nexport interface HyperFunc<T> {\n (sel: any, children: Array<T | undefined | null>): T;\n}\n\n/**\n * `HyperFunc` is a function that takes an HTML tag or component, and returns a\n * JSX element. This function is used to create JSX elements in a context where\n * JSX is not valid.\n */\nexport interface HyperFunc<T> {\n (sel: any, data: any, text: string): T;\n}\n\n/**\n * `HyperFunc` is a function that takes an HTML tag or component, and returns a\n * JSX element. This function is used to create JSX elements in a context where\n * JSX is not valid.\n */\nexport interface HyperFunc<T> {\n (sel: any, data: any, children: Array<T | undefined | null>): T;\n}\n\n/**\n * `HyperFunc` is a function that takes an HTML tag or component, and returns a\n * JSX element. This function is used to create JSX elements in a context where\n * JSX is not valid.\n */\nexport interface HyperFunc<T> {\n (sel: any, data: any, children: T): T;\n}\n\n/**\n * `ExtraNodeFuncConfig` is a configuration object for `External nodes rendered in grid in HTMLRevogrExtraElement`.\n */\nexport interface ExtraNodeFuncConfig { refresh: () => void };\n\n/**\n * `FocusTemplateFunc` is a function that takes an HTML tag or component, and\n * returns a JSX element. This function is used to create JSX elements in a\n * context where JSX is not valid.\n */\nexport type FocusTemplateFunc = (\n createElement: HyperFunc<VNode>,\n detail: FocusRenderEvent,\n) => any;\n\n/**\n * `CellCompareFunc` is a function that takes the column property to compare,\n * the data of the first cell, and the data of the second cell. It returns a\n * number indicating the relative order of the two cells.\n */\nexport type CellCompareFunc = (\n // The column property to compare.\n prop: ColumnProp,\n // The data of the first cell.\n a: DataType,\n // The data of the second cell.\n b: DataType,\n) => number;\nexport type ColumnTemplateFunc = (\n createElement: HyperFunc<VNode>,\n props: ColumnTemplateProp,\n additionalData?: any,\n) => any;\nexport type PropertiesFunc = (\n props: CellTemplateProp,\n) => CellProps | void | undefined;\nexport type ColPropertiesFunc = (\n props: ColumnPropProp,\n) => CellProps | void | undefined;\nexport type DataType<D = any> = {\n [T in ColumnProp]: DataFormat<D>;\n};\n\nexport type DataLookup<T = any> = {\n [rowIndex: number]: DataType<T>;\n};\n/**\n * `RowDefinition` is a type that represents a row definition in the\n * viewport.\n */\nexport type RowDefinition = {\n /**\n * The type of the row.\n */\n type: DimensionRows;\n /**\n * The size of the row.\n */\n size: number;\n /**\n * The index of the row.\n */\n index: number;\n};\nexport interface RowHeaders extends ColumnRegular {}\n/**\n * `ViewPortResizeEvent` is an object that contains information about a resize\n * event in the viewport.\n */\nexport type ViewPortResizeEvent = {\n /* The dimension of the viewport being resized. */\n dimension: DimensionType;\n /* The new size of the viewport. */\n size: number;\n /* Indicates whether the resize event is for a row header. */\n rowHeader?: boolean;\n};\n\n/**\n * `ViewPortScrollEvent` is an object that contains information about a scroll\n * event in the viewport.\n */\nexport type ViewPortScrollEvent = {\n /**\n * The dimension of the viewport being scrolled.\n */\n dimension: DimensionType;\n /**\n * The coordinate of the scroll event.\n */\n coordinate: number;\n /**\n * The change in coordinate between scroll events.\n */\n delta?: number;\n /**\n * Indicates whether the scroll event occurred outside the viewport.\n */\n outside?: boolean;\n};\n\n/**\n * `InitialHeaderClick` represents the information needed to handle a click\n * event on the initial column header.\n */\nexport type InitialHeaderClick = {\n /**\n * The index of the column header that was clicked.\n */\n index: number;\n /**\n * The original mouse event that triggered the click.\n */\n originalEvent: MouseEvent;\n /**\n * The column that was clicked.\n */\n column: ColumnRegular;\n providers: Providers<DimensionCols | 'rowHeaders'>;\n};\n\n/**\n * `Range` is an object that represents a range of values.\n */\nexport type Range = {\n /**\n * The start of the range.\n */\n start: number;\n /**\n * The end of the range.\n */\n end: number;\n};\n\n/**\n * `ViewportStateItems` is an object that represents the items in a viewport\n * along with their corresponding range.\n */\nexport type ViewportStateItems = {\n /**\n * The items in the viewport.\n */\n items: VirtualPositionItem[];\n} & Range;\n\n/**\n * `ViewportState` is an object that represents the state of a viewport.\n */\nexport interface ViewportState extends ViewportStateItems {\n /**\n * The number of real items in the viewport.\n */\n realCount: number;\n /**\n * The virtual size of the viewport.\n */\n virtualSize: number;\n\n /**\n * The client size of the viewport.\n * Usually it's same as virtual size.\n * Until virtualization is not disabled.\n */\n clientSize: number;\n}\n\n/**\n * `ViewSettingSizeProp` is a record that maps column or row indexes to their\n * corresponding sizes.\n */\nexport type ViewSettingSizeProp = Record<string, number>;\n\n/**\n * `VirtualPositionItem` is an object that represents a virtual position item\n * in the viewport.\n */\nexport interface VirtualPositionItem extends PositionItem {\n /**\n * The size of the virtual position item.\n */\n size: number;\n}\nexport type DataSourceState<\n T extends DataType | ColumnRegular,\n ST extends DimensionRows | DimensionCols,\n> = {\n // items - index based array for mapping to source tree\n items: number[];\n // stores items even if they trimmed in items[] there will be a sorted list here\n proxyItems: number[];\n // original data source\n source: T[];\n // grouping\n groupingDepth: number;\n groups: Record<any, any>;\n // data source type\n type: ST;\n // trim data, to hide entities from visible data source\n trimmed: Record<any, any>;\n};\nexport interface PositionItem {\n itemIndex: number;\n start: number;\n end: number;\n}\n/**\n * Object containing information about calculated dimensions.\n * Used for both columns and rows.\n */\nexport interface DimensionCalc {\n /**\n * Array of indexes of visible items.\n */\n indexes: number[];\n\n /**\n * Count of visible items.\n */\n count: number;\n\n /**\n * Array of indexes of visible items.\n * Used for mapping items to their position in DOM.\n */\n positionIndexes: number[];\n\n /**\n * Mapping of position to item.\n * Used for mapping position in DOM to item.\n */\n positionIndexToItem: {\n /**\n * Position in DOM.\n */\n [position: number]: PositionItem;\n };\n\n /**\n * Mapping of index to item.\n * Used for mapping index in data source to item.\n */\n indexToItem: {\n /**\n * Index in data source.\n */\n [index: number]: PositionItem;\n };\n\n /**\n * Object containing information about trimmed data.\n * Used for hiding entities from visible data source.\n */\n trimmed: { [index: number]: number} | null;\n\n /**\n * Object containing size for each visible item.\n * provider stores only changed sizes, not all of them\n * same as indexes but for sizes and positions\n * virtual item index to size\n */\n sizes: ViewSettingSizeProp;\n}\n/**\n * Represents the settings state of a dimension.\n * It extends the calculation properties of a dimension.\n * It also includes the real size and origin item size of the dimension.\n */\nexport interface DimensionSettingsState extends DimensionCalc {\n /**\n * Represents the real size of the dimension.\n */\n realSize: number;\n\n /**\n * Represents the origin item size of the dimension.\n */\n originItemSize: number;\n}\n\n/**\n * Represents the mapping of dimension types to their corresponding observable stores.\n */\nexport type DimensionStores = {\n [T in MultiDimensionType]: Observable<DimensionSettingsState>;\n};\n\n/**\n * Represents the mapping of dimension types to their corresponding observable stores for the viewport.\n */\nexport type ViewportStores = {\n [T in MultiDimensionType]: Observable<ViewportState>;\n};\n\n/**\n * Represents the event object that is emitted when the drag operation starts.\n */\nexport interface DragStartEvent {\n /**\n * Represents the original mouse event that triggered the drag operation.\n */\n originalEvent: MouseEvent;\n\n /**\n * Represents the model of the column being dragged.\n */\n model: ColumnDataSchemaModel;\n}\n\n/**\n * Represents the event object that is emitted before cell rendering.\n * It includes information about the dimension type, column, row, and model.\n */\nexport interface BeforeCellRenderEvent<T = any> extends AllDimensionType {\n /**\n * Represents the column being rendered.\n */\n column: VirtualPositionItem;\n\n /**\n * Represents the row being rendered.\n */\n row: VirtualPositionItem;\n\n /**\n * Represents the model being rendered.\n */\n model: T;\n}\n\n/**\n * Represents the event object that is emitted before row rendering.\n * It includes information about the dimension type, data item, item, and node.\n */\nexport interface BeforeRowRenderEvent<T = any> extends AllDimensionType {\n /**\n * Represents the data item being rendered.\n */\n model: T;\n\n /**\n * Represents the item being rendered.\n */\n item: VirtualPositionItem;\n\n /**\n * Represents the node being rendered.\n */\n node: VNode;\n}\n\n/**\n * Represents the event object that is emitted after rendering.\n * It includes information about the dimension type.\n */\nexport type AfterRendererEvent = {\n /**\n * Represents the type of dimension being rendered.\n */\n type: DimensionType;\n};\n\n/**\n * Represents the mapping of dimension types to their corresponding dimension types.\n */\nexport interface AllDimensionType {\n /**\n * Represents the dimension type for rows.\n */\n rowType: DimensionRows;\n\n /**\n * Represents the dimension type for columns.\n */\n colType: DimensionCols;\n}\n\n/**\n * Represents the event object that is emitted when applying focus.\n * It includes information about the dimension type and focused cells.\n */\nexport interface ApplyFocusEvent extends AllDimensionType, FocusedCells {}\n\n/**\n * Represents the event object that is emitted before focus rendering.\n * It includes information about the dimension type and range area.\n */\nexport interface FocusRenderEvent extends AllDimensionType {\n /**\n * Represents the range area of the focus.\n */\n range: RangeArea;\n\n rowDimension: DimensionSettingsState;\n\n colDimension: DimensionSettingsState;\n\n /**\n * Changes for the next cell to focus. @example { y: -1 }\n */\n next?: Partial<Cell>;\n}\n\nexport interface FocusAfterRenderEvent extends AllDimensionType {\n model?: any;\n column?: ColumnRegular;\n /**\n * Index of the row in the viewport\n */\n rowIndex: number;\n /**\n * Index of the column in the viewport\n */\n colIndex: number;\n}\n/**\n * Represents the event object that is emitted when scrolling occurs.\n * The `type` property indicates the type of dimension (row or column) being scrolled.\n * The `coordinate` property represents the current scroll position in that dimension.\n */\nexport type ScrollCoordinateEvent = {\n /**\n * Represents the type of dimension being scrolled.\n * Possible values are 'rgRow' and 'rgCol'.\n */\n type: DimensionType;\n\n /**\n * Represents the current scroll position in the specified dimension.\n * The value is a number representing the coordinate in pixels.\n */\n coordinate: number;\n};\n\n/** Range paste. */\nexport type RangeClipboardPasteEvent = {\n data: DataLookup;\n models: Partial<DataLookup>;\n range: RangeArea | null;\n} & AllDimensionType;\n\n/** Range copy. */\nexport type RangeClipboardCopyEventProps<T = any> = {\n data: DataFormat<T>[][];\n range: RangeArea;\n mapping: OldNewRangeMapping;\n} & AllDimensionType;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"selection.js","sourceRoot":"","sources":["../../src/types/selection.ts"],"names":[],"mappings":"","sourcesContent":["import { type VNode } from '@stencil/core';\nimport type { DimensionRows, DimensionCols } from './dimension';\nimport type {\n ColumnProp,\n DataType,\n DataLookup,\n HyperFunc,\n ColumnDataSchemaModel,\n} from './interfaces';\n\nexport type RowIndex = number;\nexport type ColIndex = number;\n\n/**\n * Represents the state of the selection store.\n * It contains information about the selection range, temporary range,\n * focused cell, editing cell, last focused cell, and next cell to focus.\n */\nexport type SelectionStoreState = {\n range: RangeArea | null;\n /**\n * Temporary range selection area\n */\n tempRange: RangeArea | null;\n /**\n * Type of the temporary range selection\n */\n tempRangeType: string | null;\n /**\n * Focused cell coordinate\n */\n focus: Cell | null;\n /**\n * Editing cell store\n */\n edit: EditCellStore | null;\n /**\n * Last cell which was focused\n */\n lastCell: Cell | null;\n /**\n * Next cell to focus\n */\n nextFocus: Cell | null;\n};\nexport type RangeArea = {\n x: ColIndex;\n y: RowIndex;\n x1: ColIndex;\n y1: RowIndex;\n};\nexport type TempRange = {\n type: string;\n area: RangeArea;\n};\nexport type OldNewRangeMapping = {\n [rowIndex: number]: {\n [T in ColumnProp]: {\n rowIndex: number;\n colIndex: number;\n colProp: ColumnProp;\n };\n };\n};\nexport type ChangedRange = {\n type: DimensionRows;\n colType: DimensionCols;\n newRange: RangeArea; // new range to apply\n oldRange: RangeArea; // range to copy from\n mapping: OldNewRangeMapping;\n newData: {\n [key: number]: DataType;\n };\n};\n\n/**\n * Cell coordinates\n */\nexport interface Cell {\n x: ColIndex;\n y: RowIndex;\n}\nexport type FocusedCells = {\n focus: Cell;\n end: Cell;\n};\nexport type RangeAreaCss = {\n left: string;\n top: string;\n width: string;\n height: string;\n};\n\nexport type
|
|
1
|
+
{"version":3,"file":"selection.js","sourceRoot":"","sources":["../../src/types/selection.ts"],"names":[],"mappings":"","sourcesContent":["import { type VNode } from '@stencil/core';\nimport type { DimensionRows, DimensionCols } from './dimension';\nimport type {\n ColumnProp,\n DataType,\n DataLookup,\n HyperFunc,\n ColumnDataSchemaModel,\n} from './interfaces';\n\nexport type RowIndex = number;\nexport type ColIndex = number;\n\n/**\n * Represents the state of the selection store.\n * It contains information about the selection range, temporary range,\n * focused cell, editing cell, last focused cell, and next cell to focus.\n */\nexport type SelectionStoreState = {\n range: RangeArea | null;\n /**\n * Temporary range selection area\n */\n tempRange: RangeArea | null;\n /**\n * Type of the temporary range selection\n */\n tempRangeType: string | null;\n /**\n * Focused cell coordinate\n */\n focus: Cell | null;\n /**\n * Editing cell store\n */\n edit: EditCellStore | null;\n /**\n * Last cell which was focused\n */\n lastCell: Cell | null;\n /**\n * Next cell to focus\n */\n nextFocus: Cell | null;\n};\nexport type RangeArea = {\n x: ColIndex;\n y: RowIndex;\n x1: ColIndex;\n y1: RowIndex;\n};\nexport type TempRange = {\n type: string;\n area: RangeArea;\n};\nexport type OldNewRangeMapping = {\n [rowIndex: number]: {\n [T in ColumnProp]: {\n rowIndex: number;\n colIndex: number;\n colProp: ColumnProp;\n };\n };\n};\nexport type ChangedRange = {\n type: DimensionRows;\n colType: DimensionCols;\n newRange: RangeArea; // new range to apply\n oldRange: RangeArea; // range to copy from\n mapping: OldNewRangeMapping;\n newData: {\n [key: number]: DataType;\n };\n};\n\n/**\n * Cell coordinates\n */\nexport interface Cell {\n x: ColIndex;\n y: RowIndex;\n}\nexport type FocusedCells = {\n focus: Cell;\n end: Cell;\n};\nexport type RangeAreaCss = {\n left: string;\n top: string;\n width: string;\n height: string;\n};\n\nexport type SaveDataDetails = {\n rgRow: RowIndex;\n rgCol: ColIndex;\n type: DimensionRows;\n prop: ColumnProp;\n val: any;\n preventFocus?: boolean;\n};\n\nexport type BeforeEdit = BeforeSaveDataDetails;\n\nexport interface BeforeSaveDataDetails extends ColumnDataSchemaModel {\n /**\n * Value from editor to save, not part of the model value yet\n */\n val?: any;\n}\n\nexport type BeforeRangeSaveDataDetails = {\n data: DataLookup;\n models: Partial<DataLookup>;\n type: DimensionRows;\n};\n\nexport type AfterEditEvent = BeforeRangeSaveDataDetails | BeforeSaveDataDetails;\n\n/**\n * Edit cell info for store\n */\nexport interface EditCellStore extends Cell {\n val?: any;\n}\n/**\n * Edit cell info for editor\n */\nexport type EditCell = EditCellStore & BeforeSaveDataDetails;\n\n/**\n * Available editors in grid\n */\nexport type Editors = {\n [name: string]: EditorCtr;\n};\n\n/**\n * Editor component\n */\nexport type EditorCtr = EditorCtrCallable | EditorCtrConstructible;\n\n\n/**\n * Editor component callable function\n */\nexport type EditorCtrCallable = {\n (\n column: ColumnDataSchemaModel,\n save: (value?: any, preventFocus?: boolean) => void,\n close: (focusNext?: boolean) => void,\n ): EditorBase;\n}\n/**\n * Editor component constructible class\n */\nexport interface EditorCtrConstructible {\n new (\n column: ColumnDataSchemaModel,\n save: (value: any, preventFocus?: boolean) => void,\n close: (focusNext?: boolean) => void,\n ): EditorBase;\n}\n\n/**\n * Editor interface\n */\nexport interface EditorBase {\n element?: Element | null;\n editCell?: EditCell;\n /**\n * Autosave usage when you want to return value for models.\n */\n getValue?(): any;\n /**\n * For Editor plugin internal usage.\n * Prevents Editor save. Manual save usage required.\n */\n beforeAutoSave?(val?: any): boolean;\n beforeUpdate?(): void;\n /**\n * Before editor got disconnected.\n * Can be triggered multiple times before actual disconnect.\n */\n beforeDisconnect?(): void;\n componentDidRender?(): void;\n disconnectedCallback?(): void;\n render(\n createElement: HyperFunc<VNode>,\n additionalData?: any,\n ): VNode | VNode[] | string | void;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"viewport.interfaces.js","sourceRoot":"","sources":["../../src/types/viewport.interfaces.ts"],"names":[],"mappings":"","sourcesContent":["import type { JSXBase } from '@stencil/core/internal';\nimport type {\n DimensionCols,\n ColumnRegular,\n ViewPortScrollEvent,\n ViewportState,\n Cell,\n SelectionStoreState,\n} from '@type';\nimport type {\n DimensionStoreCollection,\n ViewportStoreCollection,\n DSourceState,\n} from '@store';\nimport type { Observable } from '../utils';\nimport type { RowDataSources } from '../services/data.provider';\nimport type { JSX } from '..';\n\nexport type SlotType = 'content' | 'header' | 'footer';\n\nexport interface ElementScroll {\n changeScroll?(\n e: ViewPortScrollEvent,\n silent?: boolean,\n ): Promise<ViewPortScrollEvent | undefined>;\n setScroll?(e: ViewPortScrollEvent): Promise<void>;\n}\nexport type ElementsScroll = { [key: string]: ElementScroll[] };\n\nexport type HeaderProperties = JSX.RevogrHeader;\n\nexport type ViewportProperties = JSX.RevogrViewportScroll &\n JSXBase.HTMLAttributes<HTMLRevogrViewportScrollElement>;\n\nexport type ViewportColumn = {\n colType: DimensionCols;\n position: Cell;\n\n fixWidth?: boolean;\n\n viewports: ViewportStoreCollection;\n dimensions: DimensionStoreCollection;\n\n rowStores: RowDataSources;\n colStore: Observable<DSourceState<ColumnRegular, DimensionCols>>;\n} & Partial<JSX.RevogrViewportScroll> &\n Partial<JSX.RevogrHeader>;\n\nexport type ViewportData = {\n /**
|
|
1
|
+
{"version":3,"file":"viewport.interfaces.js","sourceRoot":"","sources":["../../src/types/viewport.interfaces.ts"],"names":[],"mappings":"","sourcesContent":["import type { JSXBase } from '@stencil/core/internal';\nimport type {\n DimensionCols,\n ColumnRegular,\n ViewPortScrollEvent,\n ViewportState,\n Cell,\n SelectionStoreState,\n} from '@type';\nimport type {\n DimensionStoreCollection,\n ViewportStoreCollection,\n DSourceState,\n} from '@store';\nimport type { Observable } from '../utils';\nimport type { RowDataSources } from '../services/data.provider';\nimport type { JSX } from '..';\n\nexport type SlotType = 'content' | 'header' | 'footer';\n\nexport interface ElementScroll {\n changeScroll?(\n e: ViewPortScrollEvent,\n silent?: boolean,\n ): Promise<ViewPortScrollEvent | undefined>;\n setScroll?(e: ViewPortScrollEvent): Promise<void>;\n}\nexport type ElementsScroll = { [key: string]: ElementScroll[] };\n\nexport type HeaderProperties = JSX.RevogrHeader;\n\nexport type ViewportProperties = JSX.RevogrViewportScroll &\n JSXBase.HTMLAttributes<HTMLRevogrViewportScrollElement>;\n\nexport type ViewportColumn = {\n colType: DimensionCols;\n position: Cell;\n\n fixWidth?: boolean;\n\n viewports: ViewportStoreCollection;\n dimensions: DimensionStoreCollection;\n\n rowStores: RowDataSources;\n colStore: Observable<DSourceState<ColumnRegular, DimensionCols>>;\n} & Partial<JSX.RevogrViewportScroll> &\n Partial<JSX.RevogrHeader>;\n\nexport type ViewportData = {\n /** Slot to put data */\n slot: SlotType;\n style?: { [key: string]: string };\n} & JSX.RevogrOverlaySelection &\n (Pick<JSXBase.HTMLAttributes<HTMLRevogrOverlaySelectionElement>, 'ref'> &\n Pick<JSXBase.HTMLAttributes<HTMLRevogrDataElement>, 'ref'>) &\n JSX.RevogrData;\n\nexport type ViewportProps = {\n prop: JSX.RevogrViewportScroll &\n JSXBase.HTMLAttributes<HTMLRevogrViewportScrollElement>;\n position: Cell;\n type: DimensionCols;\n /** Cols dataset */\n viewportCol: Observable<ViewportState>;\n\n /** header container props */\n headerProp: HeaderProperties;\n\n /** parent selector link */\n // parent: string;\n\n /** viewport rows */\n dataPorts: ViewportData[];\n\n columnSelectionStore: Observable<SelectionStoreState>;\n};\n"]}
|