@revolist/revogrid 4.12.4 → 4.12.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/revogr-attribution_7.cjs.entry.js +23 -8
- package/dist/cjs/revogr-attribution_7.cjs.entry.js.map +1 -1
- package/dist/cjs/revogr-data_4.cjs.entry.js +58 -36
- package/dist/cjs/revogr-data_4.cjs.entry.js.map +1 -1
- package/dist/cjs/revogr-filter-panel.cjs.entry.js.map +1 -1
- package/dist/cjs/{throttle-08957661.js → throttle-5674040a.js} +4 -1
- package/dist/cjs/throttle-5674040a.js.map +1 -0
- package/dist/collection/components/overlay/revogr-overlay-selection.js +2 -2
- package/dist/collection/components/revoGrid/revo-grid.js +2 -2
- package/dist/collection/components/revoGrid/viewport.resize.service.js +19 -4
- package/dist/collection/components/revoGrid/viewport.resize.service.js.map +1 -1
- package/dist/collection/components/scroll/revogr-viewport-scroll.js +38 -31
- package/dist/collection/components/scroll/revogr-viewport-scroll.js.map +1 -1
- package/dist/collection/components/scrollable/revogr-scroll-virtual.js +23 -8
- package/dist/collection/components/scrollable/revogr-scroll-virtual.js.map +1 -1
- package/dist/collection/plugins/filter/filter.panel.js +8 -4
- package/dist/collection/plugins/filter/filter.panel.js.map +1 -1
- package/dist/collection/plugins/filter/filter.types.js +7 -0
- package/dist/collection/plugins/filter/filter.types.js.map +1 -1
- package/dist/collection/services/local.scroll.service.js +3 -0
- package/dist/collection/services/local.scroll.service.js.map +1 -1
- package/dist/collection/types/interfaces.js.map +1 -1
- package/dist/esm/revogr-attribution_7.entry.js +23 -8
- package/dist/esm/revogr-attribution_7.entry.js.map +1 -1
- package/dist/esm/revogr-data_4.entry.js +58 -36
- package/dist/esm/revogr-data_4.entry.js.map +1 -1
- package/dist/esm/revogr-filter-panel.entry.js.map +1 -1
- package/dist/esm/{throttle-05489451.js → throttle-dec28f5b.js} +4 -1
- package/dist/esm/throttle-dec28f5b.js.map +1 -0
- package/dist/revo-grid/revogr-attribution_7.entry.js +1 -1
- package/dist/revo-grid/revogr-attribution_7.entry.js.map +1 -1
- package/dist/revo-grid/revogr-data_4.entry.js +1 -1
- package/dist/revo-grid/revogr-data_4.entry.js.map +1 -1
- package/dist/revo-grid/revogr-filter-panel.entry.js.map +1 -1
- package/dist/revo-grid/throttle-dec28f5b.js +5 -0
- package/dist/revo-grid/throttle-dec28f5b.js.map +1 -0
- package/dist/types/components/revoGrid/viewport.resize.service.d.ts +8 -6
- package/dist/types/components/scroll/revogr-viewport-scroll.d.ts +2 -2
- package/dist/types/components.d.ts +2 -2
- package/dist/types/plugins/filter/filter.panel.d.ts +1 -1
- package/dist/types/plugins/filter/filter.types.d.ts +19 -19
- package/dist/types/types/interfaces.d.ts +6 -6
- package/hydrate/index.js +82 -42
- package/hydrate/index.mjs +82 -42
- package/package.json +1 -1
- package/standalone/local.scroll.timer.js +3 -0
- package/standalone/local.scroll.timer.js.map +1 -1
- package/standalone/revogr-filter-panel.js.map +1 -1
- package/standalone/revogr-scroll-virtual2.js +22 -7
- package/standalone/revogr-scroll-virtual2.js.map +1 -1
- package/standalone/revogr-viewport-scroll2.js +57 -35
- package/standalone/revogr-viewport-scroll2.js.map +1 -1
- package/dist/cjs/throttle-08957661.js.map +0 -1
- package/dist/esm/throttle-05489451.js.map +0 -1
- package/dist/revo-grid/throttle-05489451.js +0 -5
- package/dist/revo-grid/throttle-05489451.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"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;AAOzF,OAAO,EAAE,oBAAoB,EAA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C,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"]}
|
|
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,I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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, {\n getContentSize,\n} from '../../services/local.scroll.service';\nimport type {\n DimensionType,\n ViewportState,\n DimensionSettingsState,\n ViewPortScrollEvent,\n} from '@type';\nimport { AutohideScrollPlugin } from './autohide-scroll.plugin';\nimport { LocalScrollTimer } from '../../services/local.scroll.timer';\nimport { type Observable, getScrollbarSize } from '../../utils';\n\n/**\n * Virtual scroll component\n */\n@Component({\n tag: 'revogr-scroll-virtual',\n styleUrl: 'revogr-scroll-style.scss',\n})\nexport class RevogrScrollVirtual {\n /**\n * Scroll dimension (`X` - `rgCol` or `Y` - `rgRow`)\n */\n @Prop() dimension: DimensionType = 'rgRow';\n\n /**\n * Viewport\n */\n @Prop() viewportStore!: Observable<ViewportState>;\n /**\n * Dimensions\n */\n @Prop() dimensionStore!: Observable<DimensionSettingsState>;\n\n /**\n * Scroll event\n */\n @Event({ eventName: 'scrollvirtual' })\n scrollVirtual: EventEmitter<ViewPortScrollEvent>;\n\n @StencilElement() element: HTMLElement;\n private autohideScrollPlugin: AutohideScrollPlugin;\n private scrollSize = 0;\n private localScrollService: LocalScrollService;\n private localScrollTimer: LocalScrollTimer;\n\n @Method()\n async setScroll(e: ViewPortScrollEvent): Promise<void> {\n if (this.dimension !== e.dimension) {\n return;\n }\n this.localScrollTimer.latestScrollUpdate(e.dimension);\n this.localScrollService?.setScroll(e);\n if (e.coordinate) {\n this.autohideScrollPlugin.checkScroll({\n scrollSize: this.scrollSize,\n contentSize: this.dimensionStore.get('realSize'),\n virtualSize: this.viewportStore.get('virtualSize'),\n });\n }\n }\n\n /**\n * Update if `delta` exists in case we don't know current position or if it's external change\n */\n @Method()\n async changeScroll(e: ViewPortScrollEvent): Promise<ViewPortScrollEvent> {\n if (e.delta) {\n switch (e.dimension) {\n case 'rgCol':\n e.coordinate = this.element.scrollLeft + e.delta;\n break;\n case 'rgRow':\n e.coordinate = this.element.scrollTop + e.delta;\n break;\n }\n this.setScroll(e);\n }\n return e;\n }\n\n set size(s: number) {\n this.autohideScrollPlugin.setScrollSize(s);\n if (this.dimension === 'rgRow') {\n this.element.style.minWidth = `${s}px`;\n return;\n }\n this.element.style.minHeight = `${s}px`;\n }\n\n get size(): number {\n if (this.dimension === 'rgRow') {\n return this.element.clientHeight;\n }\n return this.element.clientWidth;\n }\n\n connectedCallback() {\n this.autohideScrollPlugin = new AutohideScrollPlugin(this.element);\n this.localScrollTimer = new LocalScrollTimer(\n 'ontouchstart' in document.documentElement ? 0 : 10,\n );\n this.localScrollService = new LocalScrollService({\n runScroll: e => this.scrollVirtual.emit(e),\n applyScroll: e => {\n this.localScrollTimer.setCoordinate(e);\n const type = e.dimension === 'rgRow' ? 'scrollTop' : 'scrollLeft';\n // this will trigger on scroll event\n this.element[type] = e.coordinate;\n },\n });\n }\n\n disconnectedCallback() {\n this.autohideScrollPlugin.clear();\n }\n\n componentWillLoad() {\n this.scrollSize = getScrollbarSize(document);\n }\n\n componentDidRender() {\n const type = this.dimension === 'rgRow' ? 'scrollHeight' : 'scrollWidth';\n // Get scrollbar size once during component initialization\n const scrollbarSize = this.scrollSize;\n // Calculate if content exceeds viewport size\n // Add scrollbar size to the comparison to account for other dimension's scrollbar\n const hasScroll = this.element[type] > this.size + scrollbarSize;\n // Set scroll size based on whether scroll is needed\n this.size = hasScroll ? this.scrollSize : 0;\n\n let additionalScrollbarSize = 0;\n if (this.dimension === 'rgRow') {\n additionalScrollbarSize =\n this.element.scrollWidth > this.element.clientWidth\n ? scrollbarSize\n : 0;\n } else {\n additionalScrollbarSize =\n this.element.scrollHeight > this.element.clientHeight\n ? scrollbarSize\n : 0;\n }\n\n const clientSize = this.size + additionalScrollbarSize;\n\n this.localScrollService.setParams(\n {\n contentSize: this.dimensionStore.get('realSize'),\n // Add scrollbar size to clientSize if other dimension has scroll\n clientSize,\n virtualSize: this.viewportStore.get('clientSize'),\n },\n this.dimension,\n );\n }\n\n onScroll(e: MouseEvent) {\n if (!(e.target instanceof Element)) {\n return;\n }\n const target = e.target;\n let type: 'scrollLeft' | 'scrollTop' = 'scrollLeft';\n if (this.dimension === 'rgRow') {\n type = 'scrollTop';\n }\n // apply after throttling\n if (this.localScrollTimer.isReady(this.dimension, target[type] || 0)) {\n this.localScrollService?.scroll(target[type] || 0, this.dimension);\n }\n }\n\n render() {\n const sizeType = this.dimension === 'rgRow' ? 'height' : 'width';\n const size = getContentSize(\n this.dimensionStore.get('realSize'),\n this.size,\n this.viewportStore.get('clientSize'), // content viewport size\n );\n return (\n <Host onScroll={(e: MouseEvent) => this.onScroll(e)}>\n <div\n style={{\n [sizeType]: `${size}px`,\n }}\n />\n </Host>\n );\n }\n}\n"]}
|
|
@@ -358,7 +358,7 @@ export class FilterPanel {
|
|
|
358
358
|
"mutable": false,
|
|
359
359
|
"complexType": {
|
|
360
360
|
"original": "Record<string, LogicFunction>",
|
|
361
|
-
"resolved": "{ [x: string]: LogicFunction
|
|
361
|
+
"resolved": "{ [x: string]: LogicFunction<any, LogicFunctionExtraParam>; }",
|
|
362
362
|
"references": {
|
|
363
363
|
"Record": {
|
|
364
364
|
"location": "global",
|
|
@@ -385,9 +385,13 @@ export class FilterPanel {
|
|
|
385
385
|
"type": "unknown",
|
|
386
386
|
"mutable": false,
|
|
387
387
|
"complexType": {
|
|
388
|
-
"original": "FilterCaptions | undefined",
|
|
389
|
-
"resolved": "undefined | { title
|
|
388
|
+
"original": "Partial<FilterCaptions> | undefined",
|
|
389
|
+
"resolved": "undefined | { title?: string | undefined; save?: string | undefined; reset?: string | undefined; ok?: string | undefined; cancel?: string | undefined; add?: string | undefined; placeholder?: string | undefined; and?: string | undefined; or?: string | undefined; }",
|
|
390
390
|
"references": {
|
|
391
|
+
"Partial": {
|
|
392
|
+
"location": "global",
|
|
393
|
+
"id": "global::Partial"
|
|
394
|
+
},
|
|
391
395
|
"FilterCaptions": {
|
|
392
396
|
"location": "import",
|
|
393
397
|
"path": "./filter.types",
|
|
@@ -449,7 +453,7 @@ export class FilterPanel {
|
|
|
449
453
|
},
|
|
450
454
|
"complexType": {
|
|
451
455
|
"original": "MultiFilterItem",
|
|
452
|
-
"resolved": "
|
|
456
|
+
"resolved": "MultiFilterItem",
|
|
453
457
|
"references": {
|
|
454
458
|
"MultiFilterItem": {
|
|
455
459
|
"location": "import",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"filter.panel.js","sourceRoot":"","sources":["../../../src/plugins/filter/filter.panel.tsx"],"names":[],"mappings":"AAAA,mBAAmB;AAEnB,OAAO,EACL,CAAC,EACD,SAAS,EACT,KAAK,EAEL,IAAI,EACJ,MAAM,EACN,MAAM,EACN,IAAI,EACJ,KAAK,EAEL,OAAO,GACR,MAAM,eAAe,CAAC;AACvB,OAAO,QAAQ,MAAM,iBAAiB,CAAC;AAEvC,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AACxE,OAAO,8BAA8B,CAAC;AAUtC,MAAM,WAAW,GAAe,MAAM,CAAC;AAEvC,MAAM,iBAAiB,GAAG,mBAAmB,CAAC;AAC9C,MAAM,wBAAwB,GAAG,0BAA0B,CAAC;AAC5D,MAAM,SAAS,GAAG,YAAY,CAAC;AAE/B;;GAEG;AACH;;GAEG;AAKH,MAAM,OAAO,WAAW;;QACd,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I,CAAC,QAAQ,EAAE,IAE7B,KAAK,CAAC,MAAM,CACN;iBACV;gBACA,CAAC,IAAI,CAAC,uBAAuB,IAAI;oBAChC,cACE,EAAE,EAAC,gBAAgB,gBACR,IAAI,EACf,KAAK,EAAC,mBAAmB,EACzB,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,QAAQ,EAAE,IAE7B,KAAK,CAAC,EAAE,CACF;oBAET,cACE,EAAE,EAAC,mBAAmB,gBACX,OAAO,EAClB,KAAK,EAAC,qBAAqB,EAC3B,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,OAAO,EAAE,IAE5B,KAAK,CAAC,KAAK,CACL;iBACV,CACG;YACN,YAAM,IAAI,EAAC,QAAQ,GAAG,CACjB,CACR,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["// filter.panel.tsx\n\nimport {\n h,\n Component,\n Event,\n EventEmitter,\n Host,\n Listen,\n Method,\n Prop,\n State,\n type VNode,\n Element,\n} from '@stencil/core';\nimport debounce from 'lodash/debounce';\n\nimport { AndOrButton, isFilterBtn, TrashButton } from './filter.button';\nimport '../../utils/closest.polifill';\nimport {\n FilterCaptions,\n LogicFunction,\n MultiFilterItem,\n ShowData,\n} from './filter.types';\nimport type { ColumnProp } from '@type';\nimport { FilterType } from './filter.indexed';\n\nconst defaultType: FilterType = 'none';\n\nconst FILTER_LIST_CLASS = 'multi-filter-list';\nconst FILTER_LIST_CLASS_ACTION = 'multi-filter-list-action';\nconst FILTER_ID = 'add-filter';\n\n/**\n * Filter panel for editing filters\n */\n/**\n * @internal\n */\n@Component({\n tag: 'revogr-filter-panel',\n styleUrl: 'filter.style.scss',\n})\nexport class FilterPanel {\n private filterCaptionsInternal: FilterCaptions = {\n title: 'Filter by',\n ok: 'Ok',\n save: 'Save',\n // drops the filter\n reset: 'Reset',\n cancel: 'Cancel',\n add: 'Add condition',\n placeholder: 'Enter value...',\n and: 'and',\n or: 'or',\n };\n\n @Element() element!: HTMLElement;\n @State() isFilterIdSet = false;\n @State() filterId = 0;\n @State() currentFilterId = -1;\n @State() currentFilterType: FilterType = defaultType;\n @State() changes: ShowData | undefined;\n @State() filterItems: MultiFilterItem = {};\n @Prop() filterNames: Record<string, string> = {};\n @Prop() filterEntities: Record<string, LogicFunction> = {};\n @Prop() filterCaptions: FilterCaptions | undefined;\n /**\n * Disables dynamic filtering. A way to apply filters on Save only\n */\n @Prop() disableDynamicFiltering = false;\n @Event() filterChange: EventEmitter<MultiFilterItem>;\n @Event() resetChange: EventEmitter<ColumnProp>;\n\n @Listen('mousedown', { target: 'document' }) onMouseDown(e: MouseEvent) {\n // click on anything then select drops values to default\n if (!this.changes || e.defaultPrevented) {\n return;\n }\n const path = e.composedPath();\n const select = document.getElementById(FILTER_ID);\n if (select instanceof HTMLSelectElement) {\n // click on select should be skipped\n if (path.includes(select)) {\n return;\n }\n select.value = defaultType;\n }\n this.currentFilterType = defaultType;\n if (this.changes) {\n this.changes.type = defaultType;\n }\n this.currentFilterId = -1;\n\n const isOutside = !path.includes(this.element);\n\n if (\n e.target instanceof HTMLElement &&\n isOutside &&\n !isFilterBtn(e.target)\n ) {\n this.changes = undefined;\n }\n }\n\n @Method() async show(newEntity?: ShowData) {\n this.changes = newEntity;\n this.filterItems = newEntity?.filterItems || {};\n if (this.changes) {\n this.changes.type = this.changes.type || defaultType;\n }\n }\n\n @Method() async getChanges() {\n return this.changes;\n }\n\n componentWillRender() {\n if (!this.isFilterIdSet) {\n this.isFilterIdSet = true;\n const filterItems = Object.keys(this.filterItems);\n for (const prop of filterItems) {\n // we set the proper filterId so there won't be any conflict when removing filters\n this.filterId += this.filterItems[prop].length;\n }\n }\n }\n\n getFilterItemsList() {\n const prop = this.changes?.prop;\n if (typeof prop === 'undefined') return '';\n\n const propFilters = this.filterItems[prop] ?? [];\n const capts = Object.assign(\n this.filterCaptionsInternal,\n this.filterCaptions,\n );\n return (\n <div key={this.filterId}>\n {propFilters.map((filter, index) => {\n let andOrButton;\n if (filter.hidden) {\n return;\n }\n\n // hide toggle button if there is only one filter and the last one\n if (index !== this.filterItems[prop].length - 1) {\n andOrButton = (\n <div onClick={() => this.toggleFilterAndOr(filter.id)}>\n <AndOrButton\n text={filter.relation === 'and' ? capts.and : capts.or}\n />\n </div>\n );\n }\n\n return (\n <div key={filter.id} class={FILTER_LIST_CLASS}>\n <div class={{ 'select-input': true }}>\n <select\n class=\"select-css select-filter\"\n onChange={e => this.onFilterTypeChange(e, prop, index)}\n >\n {this.renderSelectOptions(\n this.filterItems[prop][index].type,\n true,\n )}\n </select>\n <div class={FILTER_LIST_CLASS_ACTION}>{andOrButton}</div>\n <div onClick={() => this.onRemoveFilter(filter.id)}>\n <TrashButton />\n </div>\n </div>\n <div>{this.renderExtra(prop, index)}</div>\n </div>\n );\n })}\n\n {propFilters.filter(f => !f.hidden).length > 0 ? <div class=\"add-filter-divider\" /> : ''}\n </div>\n );\n }\n\n private autoCorrect(el?: HTMLElement | null) {\n if (!el) {\n return;\n }\n const pos = el.getBoundingClientRect();\n const maxLeft = window.innerWidth - pos.width;\n\n if (pos.left > maxLeft && el.offsetLeft) {\n el.style.left = `${maxLeft - (el.parentElement?.getBoundingClientRect().left ?? 0)}px`;\n }\n }\n\n private onFilterTypeChange(e: Event, prop: ColumnProp, index: number) {\n if (!(e.target instanceof HTMLSelectElement)) {\n return;\n }\n this.filterItems[prop][index].type = e.target.value as FilterType;\n\n // this re-renders the input to know if we need extra input\n this.filterId++;\n\n // adding setTimeout will wait for the next tick DOM update then focus on input\n setTimeout(() => {\n const input = document.getElementById(\n 'filter-input-' + this.filterItems[prop][index].id,\n );\n if (input instanceof HTMLInputElement) {\n input.focus();\n }\n }, 0);\n\n if (!this.disableDynamicFiltering) {\n this.debouncedApplyFilter();\n }\n }\n\n private debouncedApplyFilter = debounce(() => {\n this.filterChange.emit(this.filterItems);\n }, 400);\n\n private onAddNewFilter(e: Event) {\n const el = e.target as HTMLSelectElement;\n this.currentFilterType = el.value as FilterType;\n this.addNewFilterToProp();\n\n // reset value after adding new filter\n const select = document.getElementById('add-filter') as HTMLSelectElement;\n if (select) {\n select.value = defaultType;\n this.currentFilterType = defaultType;\n }\n\n if (!this.disableDynamicFiltering) {\n this.debouncedApplyFilter();\n }\n }\n\n private addNewFilterToProp() {\n const prop = this.changes?.prop;\n if (!(prop || prop === 0)) return;\n\n if (!this.filterItems[prop]) {\n this.filterItems[prop] = [];\n }\n\n if (this.currentFilterType === 'none') return;\n\n this.filterId++;\n this.currentFilterId = this.filterId;\n\n this.filterItems[prop].push({\n id: this.currentFilterId,\n type: this.currentFilterType,\n value: '',\n relation: 'and',\n });\n\n // adding setTimeout will wait for the next tick DOM update then focus on input\n setTimeout(() => {\n const input = document.getElementById(\n 'filter-input-' + this.currentFilterId,\n ) as HTMLInputElement;\n if (input) input.focus();\n }, 0);\n }\n\n private onUserInput(index: number, prop: ColumnProp, event: Event) {\n // update the value of the filter item\n this.filterItems[prop][index].value = (\n event.target as HTMLInputElement\n ).value;\n\n if (!this.disableDynamicFiltering) {\n this.debouncedApplyFilter();\n }\n }\n\n private onKeyDown(e: KeyboardEvent) {\n if (e.key.toLowerCase() === 'enter') {\n const select = document.getElementById('add-filter') as HTMLSelectElement;\n if (select) {\n select.value = defaultType;\n this.currentFilterType = defaultType;\n this.addNewFilterToProp();\n select.focus();\n }\n return;\n }\n // keep event local, don't escalate farther to dom\n e.stopPropagation();\n }\n\n private onSave() {\n this.filterChange.emit(this.filterItems);\n }\n\n private onCancel() {\n this.changes = undefined;\n }\n\n private onReset() {\n this.assertChanges();\n\n this.resetChange.emit(this.changes?.prop);\n\n // this updates the DOM which is used by getFilterItemsList() key\n this.filterId++;\n }\n\n private onRemoveFilter(id: number) {\n this.assertChanges();\n\n // this is for reactivity issues for getFilterItemsList()\n this.filterId++;\n\n const prop = this.changes?.prop;\n\n const items = this.filterItems[prop ?? ''];\n if (!items) return;\n\n const index = items.findIndex(d => d.id === id);\n if (index === -1) return;\n items.splice(index, 1);\n\n // let's remove the prop if no more filters so the filter icon will be removed\n if (items.length === 0) delete this.filterItems[prop ?? ''];\n\n if (!this.disableDynamicFiltering) {\n this.debouncedApplyFilter();\n }\n }\n\n private toggleFilterAndOr(id: number) {\n this.assertChanges();\n\n // this is for reactivity issues for getFilterItemsList()\n this.filterId++;\n\n const prop = this.changes?.prop;\n\n const items = this.filterItems[prop ?? ''];\n if (!items) return;\n\n const index = items.findIndex(d => d.id === id);\n if (index === -1) return;\n\n items[index].relation = items[index].relation === 'and' ? 'or' : 'and';\n if (!this.disableDynamicFiltering) {\n this.debouncedApplyFilter();\n }\n }\n\n private assertChanges() {\n if (!this.changes) {\n throw new Error('Changes required per edit');\n }\n }\n\n renderSelectOptions(type: FilterType, isDefaultTypeRemoved = false) {\n if (!this.changes) {\n return;\n }\n const options: VNode[] = [];\n const prop = this.changes.prop;\n\n const hidden = new Set<string>();\n Object.entries(this.filterItems).forEach(([_, values]) => {\n values.forEach((filter) => {\n if (filter.hidden) {\n hidden.add(filter.type);\n }\n })\n });\n\n if (!isDefaultTypeRemoved) {\n const capts = Object.assign(\n this.filterCaptionsInternal,\n this.filterCaptions,\n );\n\n options.push(\n <option\n selected={this.currentFilterType === defaultType}\n value={defaultType}\n >\n {prop && this.filterItems[prop] && this.filterItems[prop].length > 0\n ? capts.add\n : this.filterNames[defaultType]}\n </option>,\n );\n }\n\n for (let gIndex in this.changes.filterTypes) {\n const group = this.changes.filterTypes[gIndex].filter(k => !hidden.has(k));\n if (group.length) {\n options.push(\n ...group.map(k => (\n <option value={k} selected={type === k}>\n {this.filterNames[k]}\n </option>\n )),\n );\n options.push(<option disabled></option>);\n }\n }\n return options;\n }\n\n renderExtra(prop: ColumnProp, index: number) {\n const currentFilter = this.filterItems[prop];\n\n if (!currentFilter) return '';\n\n if (this.filterEntities[currentFilter[index].type].extra !== 'input')\n return '';\n\n const capts = Object.assign(\n this.filterCaptionsInternal,\n this.filterCaptions,\n );\n\n return (\n <input\n id={`filter-input-${currentFilter[index].id}`}\n placeholder={capts.placeholder}\n type=\"text\"\n value={currentFilter[index].value}\n onInput={this.onUserInput.bind(this, index, prop)}\n onKeyDown={e => this.onKeyDown(e)}\n />\n );\n }\n\n render() {\n if (!this.changes) {\n return <Host style={{ display: 'none' }}></Host>;\n }\n const style = {\n display: 'block',\n left: `${this.changes.x}px`,\n top: `${this.changes.y}px`,\n };\n\n const capts = Object.assign(\n this.filterCaptionsInternal,\n this.filterCaptions,\n );\n\n return (\n <Host\n style={style}\n ref={el => {\n this.changes?.autoCorrect && this.autoCorrect(el);\n }}\n >\n <slot slot=\"header\" />\n { this.changes.extraContent?.(this.changes) || '' }\n\n { this.changes?.hideDefaultFilters !== true && (\n [\n <label>{capts.title}</label>,\n <div class=\"filter-holder\">{this.getFilterItemsList()}</div>,\n <div class=\"add-filter\">\n <select\n id={FILTER_ID}\n class=\"select-css\"\n onChange={e => this.onAddNewFilter(e)}\n >\n {this.renderSelectOptions(this.currentFilterType)}\n </select>\n </div>\n ]\n )}\n\n <slot />\n <div class=\"filter-actions\">\n {this.disableDynamicFiltering && [\n <button\n id=\"revo-button-save\"\n aria-label=\"save\"\n class=\"revo-button green\"\n onClick={() => this.onSave()}\n >\n {capts.save}\n </button>,\n <button\n id=\"revo-button-ok\"\n aria-label=\"ok\"\n class=\"revo-button green\"\n onClick={() => this.onCancel()}\n >\n {capts.cancel}\n </button>,\n ]}\n {!this.disableDynamicFiltering && [\n <button\n id=\"revo-button-ok\"\n aria-label=\"ok\"\n class=\"revo-button green\"\n onClick={() => this.onCancel()}\n >\n {capts.ok}\n </button>,\n\n <button\n id=\"revo-button-reset\"\n aria-label=\"reset\"\n class=\"revo-button outline\"\n onClick={() => this.onReset()}\n >\n {capts.reset}\n </button>,\n ]}\n </div>\n <slot slot=\"footer\" />\n </Host>\n );\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"filter.panel.js","sourceRoot":"","sources":["../../../src/plugins/filter/filter.panel.tsx"],"names":[],"mappings":"AAAA,mBAAmB;AAEnB,OAAO,EACL,CAAC,EACD,SAAS,EACT,KAAK,EAEL,IAAI,EACJ,MAAM,EACN,MAAM,EACN,IAAI,EACJ,KAAK,EAEL,OAAO,GACR,MAAM,eAAe,CAAC;AACvB,OAAO,QAAQ,MAAM,iBAAiB,CAAC;AAEvC,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AACxE,OAAO,8BAA8B,CAAC;AAUtC,MAAM,WAAW,GAAe,MAAM,CAAC;AAEvC,MAAM,iBAAiB,GAAG,mBAAmB,CAAC;AAC9C,MAAM,wBAAwB,GAAG,0BAA0B,CAAC;AAC5D,MAAM,SAAS,GAAG,YAAY,CAAC;AAE/B;;GAEG;AACH;;GAEG;AAKH,MAAM,OAAO,WAAW;;QACd,2BAAsB,GAAmB;YAC/C,KAAK,EAAE,WAAW;YAClB,EAAE,EAAE,IAAI;YACR,IAAI,EAAE,MAAM;YACZ,mBAAmB;YACnB,KAAK,EAAE,OAAO;YACd,MAAM,EAAE,QAAQ;YAChB,GAAG,EAAE,eAAe;YACpB,WAAW,EAAE,gBAAgB;YAC7B,GAAG,EAAE,KAAK;YACV,EAAE,EAAE,IAAI;SACT,CAAC;QAoKM,yBAAoB,GAAG,QAAQ,CAAC,GAAG,EAAE;YAC3C,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;QAC3C,CAAC,EAAE,GAAG,CAAC,CAAC;6BAnKiB,KAAK;wBACV,CAAC;+BACM,CAAC,CAAC;iCACY,WAAW;;2BAEZ,EAAE;2BAC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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["// filter.panel.tsx\n\nimport {\n h,\n Component,\n Event,\n EventEmitter,\n Host,\n Listen,\n Method,\n Prop,\n State,\n type VNode,\n Element,\n} from '@stencil/core';\nimport debounce from 'lodash/debounce';\n\nimport { AndOrButton, isFilterBtn, TrashButton } from './filter.button';\nimport '../../utils/closest.polifill';\nimport {\n FilterCaptions,\n LogicFunction,\n MultiFilterItem,\n ShowData,\n} from './filter.types';\nimport type { ColumnProp } from '@type';\nimport { FilterType } from './filter.indexed';\n\nconst defaultType: FilterType = 'none';\n\nconst FILTER_LIST_CLASS = 'multi-filter-list';\nconst FILTER_LIST_CLASS_ACTION = 'multi-filter-list-action';\nconst FILTER_ID = 'add-filter';\n\n/**\n * Filter panel for editing filters\n */\n/**\n * @internal\n */\n@Component({\n tag: 'revogr-filter-panel',\n styleUrl: 'filter.style.scss',\n})\nexport class FilterPanel {\n private filterCaptionsInternal: FilterCaptions = {\n title: 'Filter by',\n ok: 'Ok',\n save: 'Save',\n // drops the filter\n reset: 'Reset',\n cancel: 'Cancel',\n add: 'Add condition',\n placeholder: 'Enter value...',\n and: 'and',\n or: 'or',\n };\n\n @Element() element!: HTMLElement;\n @State() isFilterIdSet = false;\n @State() filterId = 0;\n @State() currentFilterId = -1;\n @State() currentFilterType: FilterType = defaultType;\n @State() changes: ShowData | undefined;\n @State() filterItems: MultiFilterItem = {};\n @Prop() filterNames: Record<string, string> = {};\n @Prop() filterEntities: Record<string, LogicFunction> = {};\n @Prop() filterCaptions: Partial<FilterCaptions> | undefined;\n /**\n * Disables dynamic filtering. A way to apply filters on Save only\n */\n @Prop() disableDynamicFiltering = false;\n @Event() filterChange: EventEmitter<MultiFilterItem>;\n @Event() resetChange: EventEmitter<ColumnProp>;\n\n @Listen('mousedown', { target: 'document' }) onMouseDown(e: MouseEvent) {\n // click on anything then select drops values to default\n if (!this.changes || e.defaultPrevented) {\n return;\n }\n const path = e.composedPath();\n const select = document.getElementById(FILTER_ID);\n if (select instanceof HTMLSelectElement) {\n // click on select should be skipped\n if (path.includes(select)) {\n return;\n }\n select.value = defaultType;\n }\n this.currentFilterType = defaultType;\n if (this.changes) {\n this.changes.type = defaultType;\n }\n this.currentFilterId = -1;\n\n const isOutside = !path.includes(this.element);\n\n if (\n e.target instanceof HTMLElement &&\n isOutside &&\n !isFilterBtn(e.target)\n ) {\n this.changes = undefined;\n }\n }\n\n @Method() async show(newEntity?: ShowData) {\n this.changes = newEntity;\n this.filterItems = newEntity?.filterItems || {};\n if (this.changes) {\n this.changes.type = this.changes.type || defaultType;\n }\n }\n\n @Method() async getChanges() {\n return this.changes;\n }\n\n componentWillRender() {\n if (!this.isFilterIdSet) {\n this.isFilterIdSet = true;\n const filterItems = Object.keys(this.filterItems);\n for (const prop of filterItems) {\n // we set the proper filterId so there won't be any conflict when removing filters\n this.filterId += this.filterItems[prop].length;\n }\n }\n }\n\n getFilterItemsList() {\n const prop = this.changes?.prop;\n if (typeof prop === 'undefined') return '';\n\n const propFilters = this.filterItems[prop] ?? [];\n const capts = Object.assign(\n this.filterCaptionsInternal,\n this.filterCaptions,\n );\n return (\n <div key={this.filterId}>\n {propFilters.map((filter, index) => {\n let andOrButton;\n if (filter.hidden) {\n return;\n }\n\n // hide toggle button if there is only one filter and the last one\n if (index !== this.filterItems[prop].length - 1) {\n andOrButton = (\n <div onClick={() => this.toggleFilterAndOr(filter.id)}>\n <AndOrButton\n text={filter.relation === 'and' ? capts.and : capts.or}\n />\n </div>\n );\n }\n\n return (\n <div key={filter.id} class={FILTER_LIST_CLASS}>\n <div class={{ 'select-input': true }}>\n <select\n class=\"select-css select-filter\"\n onChange={e => this.onFilterTypeChange(e, prop, index)}\n >\n {this.renderSelectOptions(\n this.filterItems[prop][index].type,\n true,\n )}\n </select>\n <div class={FILTER_LIST_CLASS_ACTION}>{andOrButton}</div>\n <div onClick={() => this.onRemoveFilter(filter.id)}>\n <TrashButton />\n </div>\n </div>\n <div>{this.renderExtra(prop, index)}</div>\n </div>\n );\n })}\n\n {propFilters.filter(f => !f.hidden).length > 0 ? <div class=\"add-filter-divider\" /> : ''}\n </div>\n );\n }\n\n private autoCorrect(el?: HTMLElement | null) {\n if (!el) {\n return;\n }\n const pos = el.getBoundingClientRect();\n const maxLeft = window.innerWidth - pos.width;\n\n if (pos.left > maxLeft && el.offsetLeft) {\n el.style.left = `${maxLeft - (el.parentElement?.getBoundingClientRect().left ?? 0)}px`;\n }\n }\n\n private onFilterTypeChange(e: Event, prop: ColumnProp, index: number) {\n if (!(e.target instanceof HTMLSelectElement)) {\n return;\n }\n this.filterItems[prop][index].type = e.target.value as FilterType;\n\n // this re-renders the input to know if we need extra input\n this.filterId++;\n\n // adding setTimeout will wait for the next tick DOM update then focus on input\n setTimeout(() => {\n const input = document.getElementById(\n 'filter-input-' + this.filterItems[prop][index].id,\n );\n if (input instanceof HTMLInputElement) {\n input.focus();\n }\n }, 0);\n\n if (!this.disableDynamicFiltering) {\n this.debouncedApplyFilter();\n }\n }\n\n private debouncedApplyFilter = debounce(() => {\n this.filterChange.emit(this.filterItems);\n }, 400);\n\n private onAddNewFilter(e: Event) {\n const el = e.target as HTMLSelectElement;\n this.currentFilterType = el.value as FilterType;\n this.addNewFilterToProp();\n\n // reset value after adding new filter\n const select = document.getElementById('add-filter') as HTMLSelectElement;\n if (select) {\n select.value = defaultType;\n this.currentFilterType = defaultType;\n }\n\n if (!this.disableDynamicFiltering) {\n this.debouncedApplyFilter();\n }\n }\n\n private addNewFilterToProp() {\n const prop = this.changes?.prop;\n if (!(prop || prop === 0)) return;\n\n if (!this.filterItems[prop]) {\n this.filterItems[prop] = [];\n }\n\n if (this.currentFilterType === 'none') return;\n\n this.filterId++;\n this.currentFilterId = this.filterId;\n\n this.filterItems[prop].push({\n id: this.currentFilterId,\n type: this.currentFilterType,\n value: '',\n relation: 'and',\n });\n\n // adding setTimeout will wait for the next tick DOM update then focus on input\n setTimeout(() => {\n const input = document.getElementById(\n 'filter-input-' + this.currentFilterId,\n ) as HTMLInputElement;\n if (input) input.focus();\n }, 0);\n }\n\n private onUserInput(index: number, prop: ColumnProp, event: Event) {\n // update the value of the filter item\n this.filterItems[prop][index].value = (\n event.target as HTMLInputElement\n ).value;\n\n if (!this.disableDynamicFiltering) {\n this.debouncedApplyFilter();\n }\n }\n\n private onKeyDown(e: KeyboardEvent) {\n if (e.key.toLowerCase() === 'enter') {\n const select = document.getElementById('add-filter') as HTMLSelectElement;\n if (select) {\n select.value = defaultType;\n this.currentFilterType = defaultType;\n this.addNewFilterToProp();\n select.focus();\n }\n return;\n }\n // keep event local, don't escalate farther to dom\n e.stopPropagation();\n }\n\n private onSave() {\n this.filterChange.emit(this.filterItems);\n }\n\n private onCancel() {\n this.changes = undefined;\n }\n\n private onReset() {\n this.assertChanges();\n\n this.resetChange.emit(this.changes?.prop);\n\n // this updates the DOM which is used by getFilterItemsList() key\n this.filterId++;\n }\n\n private onRemoveFilter(id: number) {\n this.assertChanges();\n\n // this is for reactivity issues for getFilterItemsList()\n this.filterId++;\n\n const prop = this.changes?.prop;\n\n const items = this.filterItems[prop ?? ''];\n if (!items) return;\n\n const index = items.findIndex(d => d.id === id);\n if (index === -1) return;\n items.splice(index, 1);\n\n // let's remove the prop if no more filters so the filter icon will be removed\n if (items.length === 0) delete this.filterItems[prop ?? ''];\n\n if (!this.disableDynamicFiltering) {\n this.debouncedApplyFilter();\n }\n }\n\n private toggleFilterAndOr(id: number) {\n this.assertChanges();\n\n // this is for reactivity issues for getFilterItemsList()\n this.filterId++;\n\n const prop = this.changes?.prop;\n\n const items = this.filterItems[prop ?? ''];\n if (!items) return;\n\n const index = items.findIndex(d => d.id === id);\n if (index === -1) return;\n\n items[index].relation = items[index].relation === 'and' ? 'or' : 'and';\n if (!this.disableDynamicFiltering) {\n this.debouncedApplyFilter();\n }\n }\n\n private assertChanges() {\n if (!this.changes) {\n throw new Error('Changes required per edit');\n }\n }\n\n renderSelectOptions(type: FilterType, isDefaultTypeRemoved = false) {\n if (!this.changes) {\n return;\n }\n const options: VNode[] = [];\n const prop = this.changes.prop;\n\n const hidden = new Set<string>();\n Object.entries(this.filterItems).forEach(([_, values]) => {\n values.forEach((filter) => {\n if (filter.hidden) {\n hidden.add(filter.type);\n }\n })\n });\n\n if (!isDefaultTypeRemoved) {\n const capts = Object.assign(\n this.filterCaptionsInternal,\n this.filterCaptions,\n );\n\n options.push(\n <option\n selected={this.currentFilterType === defaultType}\n value={defaultType}\n >\n {prop && this.filterItems[prop] && this.filterItems[prop].length > 0\n ? capts.add\n : this.filterNames[defaultType]}\n </option>,\n );\n }\n\n for (let gIndex in this.changes.filterTypes) {\n const group = this.changes.filterTypes[gIndex].filter(k => !hidden.has(k));\n if (group.length) {\n options.push(\n ...group.map(k => (\n <option value={k} selected={type === k}>\n {this.filterNames[k]}\n </option>\n )),\n );\n options.push(<option disabled></option>);\n }\n }\n return options;\n }\n\n renderExtra(prop: ColumnProp, index: number) {\n const currentFilter = this.filterItems[prop];\n\n if (!currentFilter) return '';\n\n if (this.filterEntities[currentFilter[index].type].extra !== 'input')\n return '';\n\n const capts = Object.assign(\n this.filterCaptionsInternal,\n this.filterCaptions,\n );\n\n return (\n <input\n id={`filter-input-${currentFilter[index].id}`}\n placeholder={capts.placeholder}\n type=\"text\"\n value={currentFilter[index].value}\n onInput={this.onUserInput.bind(this, index, prop)}\n onKeyDown={e => this.onKeyDown(e)}\n />\n );\n }\n\n render() {\n if (!this.changes) {\n return <Host style={{ display: 'none' }}></Host>;\n }\n const style = {\n display: 'block',\n left: `${this.changes.x}px`,\n top: `${this.changes.y}px`,\n };\n\n const capts = Object.assign(\n this.filterCaptionsInternal,\n this.filterCaptions,\n );\n\n return (\n <Host\n style={style}\n ref={el => {\n this.changes?.autoCorrect && this.autoCorrect(el);\n }}\n >\n <slot slot=\"header\" />\n { this.changes.extraContent?.(this.changes) || '' }\n\n { this.changes?.hideDefaultFilters !== true && (\n [\n <label>{capts.title}</label>,\n <div class=\"filter-holder\">{this.getFilterItemsList()}</div>,\n <div class=\"add-filter\">\n <select\n id={FILTER_ID}\n class=\"select-css\"\n onChange={e => this.onAddNewFilter(e)}\n >\n {this.renderSelectOptions(this.currentFilterType)}\n </select>\n </div>\n ]\n )}\n\n <slot />\n <div class=\"filter-actions\">\n {this.disableDynamicFiltering && [\n <button\n id=\"revo-button-save\"\n aria-label=\"save\"\n class=\"revo-button green\"\n onClick={() => this.onSave()}\n >\n {capts.save}\n </button>,\n <button\n id=\"revo-button-ok\"\n aria-label=\"ok\"\n class=\"revo-button green\"\n onClick={() => this.onCancel()}\n >\n {capts.cancel}\n </button>,\n ]}\n {!this.disableDynamicFiltering && [\n <button\n id=\"revo-button-ok\"\n aria-label=\"ok\"\n class=\"revo-button green\"\n onClick={() => this.onCancel()}\n >\n {capts.ok}\n </button>,\n\n <button\n id=\"revo-button-reset\"\n aria-label=\"reset\"\n class=\"revo-button outline\"\n onClick={() => this.onReset()}\n >\n {capts.reset}\n </button>,\n ]}\n </div>\n <slot slot=\"footer\" />\n </Host>\n );\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"filter.types.js","sourceRoot":"","sources":["../../../src/plugins/filter/filter.types.ts"],"names":[],"mappings":"AAAA,kBAAkB","sourcesContent":["// filter.types.ts\n\nimport type { ColumnProp, ColumnRegular } from '@type';\nimport type { FilterType } from './filter.indexed';\n\nexport type DateEnum =\n | 'today'\n | 'yesterday'\n | 'tomorrow'\n | 'thisweek'\n | 'lastweek'\n | 'nextweek'\n | 'thismonth'\n | 'lastmonth'\n | 'nextmonth'\n | 'thisyear'\n | 'lastyear'\n | 'nextyear';\n\nexport type ExtraField = 'input' | 'select' | 'multi' | 'datepicker';\n\nexport type LogicFunctionParam = any;\nexport type LogicFunctionExtraParam =\n | 'select'\n | 'input'\n | 'multi'\n | 'datepicker'\n | number\n | Date\n | DateEnum\n | null\n | undefined\n | string\n | string[]\n | number[];\nexport
|
|
1
|
+
{"version":3,"file":"filter.types.js","sourceRoot":"","sources":["../../../src/plugins/filter/filter.types.ts"],"names":[],"mappings":"AAAA,kBAAkB;AAqDjB,CAAC;AAYD,CAAC;AA0ED,CAAC","sourcesContent":["// filter.types.ts\n\nimport type { ColumnProp, ColumnRegular } from '@type';\nimport type { FilterType } from './filter.indexed';\n\nexport type DateEnum =\n | 'today'\n | 'yesterday'\n | 'tomorrow'\n | 'thisweek'\n | 'lastweek'\n | 'nextweek'\n | 'thismonth'\n | 'lastmonth'\n | 'nextmonth'\n | 'thisyear'\n | 'lastyear'\n | 'nextyear';\n\nexport type ExtraField = 'input' | 'select' | 'multi' | 'datepicker';\n\nexport type LogicFunctionParam = any;\nexport type LogicFunctionExtraParam =\n | 'select'\n | 'input'\n | 'multi'\n | 'datepicker'\n | number\n | Date\n | DateEnum\n | null\n | undefined\n | string\n | string[]\n | number[];\nexport interface LogicFunction<T1 = LogicFunctionParam, T2 = LogicFunctionExtraParam> {\n (value: T1, extra?: T2): boolean;\n extra?: ExtraField;\n}\n\nexport interface CustomFilter<T1 = LogicFunctionParam, T2 = LogicFunctionExtraParam> {\n /**\n * Property defined in column { filter: string/number/abstract/enum...etc }\n */\n columnFilterType: string;\n /**\n * Filter name\n */\n name: string;\n /**\n * Function to apply the filter\n */\n func: LogicFunction<T1, T2>;\n};\n\nexport interface FilterCaptions {\n title: string;\n save: string;\n reset: string;\n ok: string;\n cancel: string;\n add: string;\n placeholder: string;\n and: string;\n or: string;\n};\n\nexport interface FilterLocalization {\n captions: Partial<FilterCaptions>;\n filterNames: Record<FilterType, string>;\n}\n/**\n * Filter configuration for a column. This is the type of the `filter` property on a column.\n */\nexport interface ColumnFilterConfig {\n /**\n * The collection of filters to be applied to the column.\n */\n collection?: Record<ColumnProp, FilterCollectionItem>;\n /**\n * The names of the filters to be included in the filter dropdown.\n */\n include?: string[];\n /**\n * A mapping of custom filter names to custom filter functions.\n */\n customFilters?: Record<string, CustomFilter>;\n /**\n * The property on the column idintifying which has the filter is applied.\n */\n filterProp?: string;\n /**\n * The localization for the filter dropdown.\n */\n localization?: FilterLocalization;\n /**\n * Information about the multi-filter items.\n */\n multiFilterItems?: MultiFilterItem;\n /**\n * Whether or not to disable dynamic filtering. If set to true, the filter will only be applied\n * when the user clicks on the filter button.\n */\n disableDynamicFiltering?: boolean;\n}\n\nexport type FilterCollectionItem = {\n type: FilterType;\n value?: any;\n};\n\n\nexport interface FilterItem {\n // column id\n prop?: ColumnProp;\n // filter type definition\n type?: FilterType;\n // value for additional filtering, text value or some id\n value?: any;\n}\n\nexport interface FilterData {\n id: number;\n /**\n * Filter type\n */\n type: FilterType;\n /**\n * Filter value\n */\n value?: any;\n /**\n * Filter invisible in filter panel\n */\n hidden?: boolean;\n /**\n * Filter relation\n */\n relation?: 'and' | 'or';\n};\n\nexport interface MultiFilterItem {\n [prop: string]: FilterData[];\n}\n\nexport interface ShowData extends FilterItem, Omit<ColumnRegular, 'filter'> {\n x: number;\n y: number;\n /**\n * Auto correct position if it is out of document bounds\n */\n autoCorrect?: boolean;\n filterTypes?: Record<string, string[]>;\n filterItems?: MultiFilterItem;\n // hide default filters\n hideDefaultFilters?: boolean;\n // pass vnodes from plugins\n extraContent?: (data: ShowData) => any;\n}\n"]}
|
|
@@ -14,6 +14,9 @@ const NO_COORDINATE = -1;
|
|
|
14
14
|
* return full size
|
|
15
15
|
*/
|
|
16
16
|
export function getContentSize(contentSize, clientSize, virtualSize = 0) {
|
|
17
|
+
if (virtualSize > contentSize) {
|
|
18
|
+
return 0;
|
|
19
|
+
}
|
|
17
20
|
return contentSize + (virtualSize ? clientSize - virtualSize : 0);
|
|
18
21
|
}
|
|
19
22
|
export default class LocalScrollService {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"local.scroll.service.js","sourceRoot":"","sources":["../../src/services/local.scroll.service.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAoBtC,MAAM,aAAa,GAAW;IAC5B,WAAW,EAAE,CAAC;IACd,UAAU,EAAE,CAAC;IACb,WAAW,EAAE,CAAC;IACd,OAAO,EAAE,CAAC;CACX,CAAC;AACF,MAAM,aAAa,GAAG,CAAC,CAAC,CAAC;AAEzB;;;GAGG;AACH,MAAM,UAAU,cAAc,CAC5B,WAAmB,EACnB,UAAkB,EAClB,WAAW,GAAG,CAAC;IAEf,OAAO,WAAW,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC,UAAU,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACpE,CAAC;AAED,MAAM,CAAC,OAAO,OAAO,kBAAkB;IAerC,YAAoB,GAAW;QAAX,QAAG,GAAH,GAAG,CAAQ;QAdvB,4BAAuB,GAA+C;YAC5E,KAAK,EAAE,IAAI;YACX,KAAK,EAAE,IAAI;SACZ,CAAC;QACF,6BAA6B;QACrB,mBAAc,GAAkC;YACtD,KAAK,EAAE,aAAa;YACpB,KAAK,EAAE,aAAa;SACrB,CAAC;QACM,WAAM,GAAkC;YAC9C,KAAK,oBAAO,aAAa,CAAE;YAC3B,KAAK,oBAAO,aAAa,CAAE;SAC5B,CAAC;IAEgC,CAAC;IAEnC,SAAS,CAAC,MAAc,EAAE,SAAwB;QAChD,MAAM,kBAAkB,GAAG,cAAc,CACvC,MAAM,CAAC,WAAW,EAClB,MAAM,CAAC,UAAU,EACjB,MAAM,CAAC,WAAW,CACnB,CAAC;QACF,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,mCACjB,MAAM,KACT,OAAO,EAAE,kBAAkB,GAAG,MAAM,CAAC,UAAU,EAC/C,kBAAkB,GACnB,CAAC;IACJ,CAA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AAI,CAAC,uBAAuB,EAAC,SAAS,CAAC,kDAAI,CAAC;QAC5C,IAAI,CAAC,uBAAuB,CAAC,SAAS,CAAC,GAAG,IAAI,CAAC;IACjD,CAAC;IAED,mDAAmD;IAC3C,OAAO,CAAC,GAAW,EAAE,KAAa,EAAE,MAAM,GAAG,IAAI;;QACvD,MAAM,QAAQ,GAAG,KAAK,CAAC,UAAU,CAAC;QAClC,MAAM,IAAI,GAAqB,CAAC,CAAC,EAAE,CAAC,MAAA,KAAK,CAAC,kBAAkB,mCAAI,QAAQ,CAAC,GAAG,QAAQ,CAAC,CAAC;QACtF,MAAM,EAAE,GAAqB,CAAC,CAAC,EAAE,KAAK,CAAC,WAAW,GAAG,KAAK,CAAC,WAAW,CAAC,CAAC;QACxE,IAAI,MAAM,EAAE,CAAC;YACX,OAAO,UAAU,CAAC,GAAG,EAAE,IAAI,EAAE,EAAE,CAAC,CAAC;QACnC,CAAC;QACD,OAAO,UAAU,CAAC,GAAG,EAAE,EAAE,EAAE,IAAI,CAAC,CAAC;IACnC,CAAC;CACF","sourcesContent":["import type { DimensionType, ViewPortScrollEvent } from '@type';\nimport { scaleValue } from '../utils';\n\ninterface Config {\n skipAnimationFrame?: boolean;\n // scroll event inited and direction cached\n // scrollingService.proxyScroll get tiggered\n // setScroll event called from scrollingService\n runScroll(e: ViewPortScrollEvent): void;\n // all operation finished, apply scroll values\n applyScroll(e: ViewPortScrollEvent): void;\n}\n\ntype Params = {\n contentSize: number;\n virtualContentSize?: number;\n clientSize: number;\n virtualSize: number;\n maxSize?: number;\n};\n\nconst initialParams: Params = {\n contentSize: 0,\n clientSize: 0,\n virtualSize: 0,\n maxSize: 0,\n};\nconst NO_COORDINATE = -1;\n\n/**\n * Based on content size, client size and virtual size\n * return full size\n */\nexport function getContentSize(\n contentSize: number,\n clientSize: number,\n virtualSize = 0,\n): number {\n return contentSize + (virtualSize ? clientSize - virtualSize : 0);\n}\n\nexport default class LocalScrollService {\n private preventArtificialScroll: Record<DimensionType, (() => void) | null> = {\n rgRow: null,\n rgCol: null,\n };\n // to check if scroll changed\n private previousScroll: Record<DimensionType, number> = {\n rgRow: NO_COORDINATE,\n rgCol: NO_COORDINATE,\n };\n private params: Record<DimensionType, Params> = {\n rgRow: { ...initialParams },\n rgCol: { ...initialParams },\n };\n\n constructor(private cfg: Config) {}\n\n setParams(params: Params, dimension: DimensionType) {\n const virtualContentSize = getContentSize(\n params.contentSize,\n params.clientSize,\n params.virtualSize,\n );\n this.params[dimension] = {\n ...params,\n maxSize: virtualContentSize - params.clientSize,\n virtualContentSize,\n };\n }\n\n // apply scroll values after scroll done\n async setScroll(e: ViewPortScrollEvent) {\n this.cancelScroll(e.dimension);\n\n // start frame animation\n const frameAnimation = new Promise<void>((resolve, reject) => {\n // for example safari desktop has issues with animation frame\n if (this.cfg.skipAnimationFrame) {\n return resolve();\n }\n const animationId = window.requestAnimationFrame(() => {\n resolve();\n });\n this.preventArtificialScroll[e.dimension] = reject.bind(\n null,\n animationId,\n );\n });\n\n try {\n await frameAnimation;\n const params = this.getParams(e.dimension);\n e.coordinate = Math.ceil(e.coordinate);\n this.previousScroll[e.dimension] = this.wrapCoordinate(\n e.coordinate,\n params,\n );\n this.preventArtificialScroll[e.dimension] = null;\n this.cfg.applyScroll({\n ...e,\n coordinate: params.virtualSize\n ? this.convert(e.coordinate, params, false)\n : e.coordinate,\n });\n } catch (id) {\n window.cancelAnimationFrame(id);\n }\n }\n\n /**\n * On scroll event started\n */\n scroll(\n coordinate: number,\n dimension: DimensionType,\n force = false,\n delta?: number,\n outside = false,\n ) {\n // cancel all previous scrolls for same dimension\n this.cancelScroll(dimension);\n\n // drop if no change\n if (!force && this.previousScroll[dimension] === coordinate) {\n this.previousScroll[dimension] = NO_COORDINATE;\n return;\n }\n\n const param = this.getParams(dimension);\n // let component know about scroll event started\n this.cfg.runScroll({\n dimension: dimension,\n coordinate: param.virtualSize\n ? this.convert(coordinate, param)\n : coordinate,\n delta,\n outside,\n });\n }\n\n private getParams(dimension: DimensionType): Params {\n return this.params[dimension];\n }\n\n // check if scroll outside of region to avoid looping\n private wrapCoordinate(c: number, param: Params): number {\n if (c < 0) {\n return NO_COORDINATE;\n }\n\n if (typeof param.maxSize === 'number' && c > param.maxSize) {\n return param.maxSize;\n }\n return c;\n }\n\n // prevent already started scroll, performance optimization\n private cancelScroll(dimension: DimensionType) {\n this.preventArtificialScroll[dimension]?.();\n this.preventArtificialScroll[dimension] = null;\n }\n\n /* convert virtual to real and back, scale range */\n private convert(pos: number, param: Params, toReal = true): number {\n const minRange = param.clientSize;\n const from: [number, number] = [0, (param.virtualContentSize ?? minRange) - minRange];\n const to: [number, number] = [0, param.contentSize - param.virtualSize];\n if (toReal) {\n return scaleValue(pos, from, to);\n }\n return scaleValue(pos, to, from);\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"local.scroll.service.js","sourceRoot":"","sources":["../../src/services/local.scroll.service.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAoBtC,MAAM,aAAa,GAAW;IAC5B,WAAW,EAAE,CAAC;IACd,UAAU,EAAE,CAAC;IACb,WAAW,EAAE,CAAC;IACd,OAAO,EAAE,CAAC;CACX,CAAC;AACF,MAAM,aAAa,GAAG,CAAC,CAAC,CAAC;AAEzB;;;GAGG;AACH,MAAM,UAAU,cAAc,CAC5B,WAAmB,EACnB,UAAkB,EAClB,WAAW,GAAG,CAAC;IAEf,IAAI,WAAW,GAAG,WAAW,EAAE,CAAC;QAC9B,OAAO,CAAC,CAAC;IACX,CAAC;IACD,OAAO,WAAW,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC,UAAU,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACpE,CAAC;AAED,MAAM,CAAC,OAAO,OAAO,kBAAkB;IAerC,YAAoB,GAAW;QAAX,QAAG,GAAH,GAAG,CAAQ;QAdvB,4BAAuB,GAA+C;YAC5E,KAAK,EAAE,IAAI;YACX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nimport { scaleValue } from '../utils';\n\ninterface Config {\n skipAnimationFrame?: boolean;\n // scroll event inited and direction cached\n // scrollingService.proxyScroll get tiggered\n // setScroll event called from scrollingService\n runScroll(e: ViewPortScrollEvent): void;\n // all operation finished, apply scroll values\n applyScroll(e: ViewPortScrollEvent): void;\n}\n\ntype Params = {\n contentSize: number;\n virtualContentSize?: number;\n clientSize: number;\n virtualSize: number;\n maxSize?: number;\n};\n\nconst initialParams: Params = {\n contentSize: 0,\n clientSize: 0,\n virtualSize: 0,\n maxSize: 0,\n};\nconst NO_COORDINATE = -1;\n\n/**\n * Based on content size, client size and virtual size\n * return full size\n */\nexport function getContentSize(\n contentSize: number,\n clientSize: number,\n virtualSize = 0,\n): number {\n if (virtualSize > contentSize) {\n return 0;\n }\n return contentSize + (virtualSize ? clientSize - virtualSize : 0);\n}\n\nexport default class LocalScrollService {\n private preventArtificialScroll: Record<DimensionType, (() => void) | null> = {\n rgRow: null,\n rgCol: null,\n };\n // to check if scroll changed\n private previousScroll: Record<DimensionType, number> = {\n rgRow: NO_COORDINATE,\n rgCol: NO_COORDINATE,\n };\n private params: Record<DimensionType, Params> = {\n rgRow: { ...initialParams },\n rgCol: { ...initialParams },\n };\n\n constructor(private cfg: Config) {}\n\n setParams(params: Params, dimension: DimensionType) {\n const virtualContentSize = getContentSize(\n params.contentSize,\n params.clientSize,\n params.virtualSize,\n );\n this.params[dimension] = {\n ...params,\n maxSize: virtualContentSize - params.clientSize,\n virtualContentSize,\n };\n }\n\n // apply scroll values after scroll done\n async setScroll(e: ViewPortScrollEvent) {\n this.cancelScroll(e.dimension);\n\n // start frame animation\n const frameAnimation = new Promise<void>((resolve, reject) => {\n // for example safari desktop has issues with animation frame\n if (this.cfg.skipAnimationFrame) {\n return resolve();\n }\n const animationId = window.requestAnimationFrame(() => {\n resolve();\n });\n this.preventArtificialScroll[e.dimension] = reject.bind(\n null,\n animationId,\n );\n });\n\n try {\n await frameAnimation;\n const params = this.getParams(e.dimension);\n e.coordinate = Math.ceil(e.coordinate);\n this.previousScroll[e.dimension] = this.wrapCoordinate(\n e.coordinate,\n params,\n );\n this.preventArtificialScroll[e.dimension] = null;\n this.cfg.applyScroll({\n ...e,\n coordinate: params.virtualSize\n ? this.convert(e.coordinate, params, false)\n : e.coordinate,\n });\n } catch (id) {\n window.cancelAnimationFrame(id);\n }\n }\n\n /**\n * On scroll event started\n */\n scroll(\n coordinate: number,\n dimension: DimensionType,\n force = false,\n delta?: number,\n outside = false,\n ) {\n // cancel all previous scrolls for same dimension\n this.cancelScroll(dimension);\n\n // drop if no change\n if (!force && this.previousScroll[dimension] === coordinate) {\n this.previousScroll[dimension] = NO_COORDINATE;\n return;\n }\n\n const param = this.getParams(dimension);\n // let component know about scroll event started\n this.cfg.runScroll({\n dimension: dimension,\n coordinate: param.virtualSize\n ? this.convert(coordinate, param)\n : coordinate,\n delta,\n outside,\n });\n }\n\n private getParams(dimension: DimensionType): Params {\n return this.params[dimension];\n }\n\n // check if scroll outside of region to avoid looping\n private wrapCoordinate(c: number, param: Params): number {\n if (c < 0) {\n return NO_COORDINATE;\n }\n\n if (typeof param.maxSize === 'number' && c > param.maxSize) {\n return param.maxSize;\n }\n return c;\n }\n\n // prevent already started scroll, performance optimization\n private cancelScroll(dimension: DimensionType) {\n this.preventArtificialScroll[dimension]?.();\n this.preventArtificialScroll[dimension] = null;\n }\n\n /* convert virtual to real and back, scale range */\n private convert(pos: number, param: Params, toReal = true): number {\n const minRange = param.clientSize;\n const from: [number, number] = [0, (param.virtualContentSize ?? minRange) - minRange];\n const to: [number, number] = [0, param.contentSize - param.virtualSize];\n if (toReal) {\n return scaleValue(pos, from, to);\n }\n return scaleValue(pos, to, from);\n }\n}\n"]}
|
|
@@ -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 interface 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 /**\n * List of indices for visible items in the grid\n */\n items: number[];\n /**\n * List of indices for visible items in the grid, even if they are trimmed\n * Update this collection if you want to change items order\n */\n proxyItems: number[];\n /**\n * Actual data array\n */\n source: T[];\n /**\n * Grouping information\n */\n groupingDepth: number;\n groups: Record<any, any>;\n /**\n * Dimension type, can be rows or columns depending on context\n */\n type: ST;\n /**\n * Info for trimming or filtering the data, to hide entities from visible data source\n */\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 interface 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 interface 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 /**\n * List of indices for visible items in the grid\n */\n items: number[];\n /**\n * List of indices for visible items in the grid, even if they are trimmed\n * Update this collection if you want to change items order\n */\n proxyItems: number[];\n /**\n * Actual data array\n */\n source: T[];\n /**\n * Grouping information\n */\n groupingDepth: number;\n groups: Record<any, any>;\n /**\n * Dimension type, can be rows or columns depending on context\n */\n type: ST;\n /**\n * Info for trimming or filtering the data, to hide entities from visible data source\n */\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 interface RangeClipboardPasteEvent extends AllDimensionType {\n data: DataLookup;\n models: Partial<DataLookup>;\n range: RangeArea | null;\n}\n\n/** Range copy. */\nexport interface RangeClipboardCopyEventProps<T = any> extends AllDimensionType {\n data: DataFormat<T>[][];\n range: RangeArea;\n mapping: OldNewRangeMapping;\n}\n"]}
|
|
@@ -10,7 +10,7 @@ import { c as isClear, d as isTab, f as isEnterKeyValue, h as isCopy, g as isCut
|
|
|
10
10
|
import { d as debounce } from './debounce-b3166f78.js';
|
|
11
11
|
import { V as ViewportStore, f as calculateRowHeaderSize } from './viewport.store-c18a25a6.js';
|
|
12
12
|
import { H as HEADER_SLOT } from './viewport.helpers-7e7f9dad.js';
|
|
13
|
-
import { L as LocalScrollTimer, a as LocalScrollService, g as getContentSize, t as throttle } from './throttle-
|
|
13
|
+
import { L as LocalScrollTimer, a as LocalScrollService, g as getContentSize, t as throttle } from './throttle-dec28f5b.js';
|
|
14
14
|
|
|
15
15
|
const Attribution = class {
|
|
16
16
|
constructor(hostRef) {
|
|
@@ -1324,15 +1324,31 @@ const RevogrScrollVirtual = class {
|
|
|
1324
1324
|
}
|
|
1325
1325
|
componentDidRender() {
|
|
1326
1326
|
const type = this.dimension === 'rgRow' ? 'scrollHeight' : 'scrollWidth';
|
|
1327
|
-
|
|
1328
|
-
|
|
1327
|
+
// Get scrollbar size once during component initialization
|
|
1328
|
+
const scrollbarSize = this.scrollSize;
|
|
1329
|
+
// Calculate if content exceeds viewport size
|
|
1330
|
+
// Add scrollbar size to the comparison to account for other dimension's scrollbar
|
|
1331
|
+
const hasScroll = this.element[type] > this.size + scrollbarSize;
|
|
1332
|
+
// Set scroll size based on whether scroll is needed
|
|
1333
|
+
this.size = hasScroll ? this.scrollSize : 0;
|
|
1334
|
+
let additionalScrollbarSize = 0;
|
|
1335
|
+
if (this.dimension === 'rgRow') {
|
|
1336
|
+
additionalScrollbarSize =
|
|
1337
|
+
this.element.scrollWidth > this.element.clientWidth
|
|
1338
|
+
? scrollbarSize
|
|
1339
|
+
: 0;
|
|
1329
1340
|
}
|
|
1330
1341
|
else {
|
|
1331
|
-
|
|
1342
|
+
additionalScrollbarSize =
|
|
1343
|
+
this.element.scrollHeight > this.element.clientHeight
|
|
1344
|
+
? scrollbarSize
|
|
1345
|
+
: 0;
|
|
1332
1346
|
}
|
|
1347
|
+
const clientSize = this.size + additionalScrollbarSize;
|
|
1333
1348
|
this.localScrollService.setParams({
|
|
1334
1349
|
contentSize: this.dimensionStore.get('realSize'),
|
|
1335
|
-
clientSize
|
|
1350
|
+
// Add scrollbar size to clientSize if other dimension has scroll
|
|
1351
|
+
clientSize,
|
|
1336
1352
|
virtualSize: this.viewportStore.get('clientSize'),
|
|
1337
1353
|
}, this.dimension);
|
|
1338
1354
|
}
|
|
@@ -1353,9 +1369,8 @@ const RevogrScrollVirtual = class {
|
|
|
1353
1369
|
}
|
|
1354
1370
|
render() {
|
|
1355
1371
|
const sizeType = this.dimension === 'rgRow' ? 'height' : 'width';
|
|
1356
|
-
const size = getContentSize(this.dimensionStore.get('realSize'), this.size, this.viewportStore.get('clientSize')
|
|
1357
|
-
)
|
|
1358
|
-
return (h(Host, { key: '2d11902403db45b805bde88b6fc40acff4b6b910', onScroll: (e) => this.onScroll(e) }, h("div", { key: '74978e90cbf66e3fb6dcc25bd5882346f1515c39', style: {
|
|
1372
|
+
const size = getContentSize(this.dimensionStore.get('realSize'), this.size, this.viewportStore.get('clientSize'));
|
|
1373
|
+
return (h(Host, { key: '7789bd408d3e154836bcd2aed4ebaa1663e7f968', onScroll: (e) => this.onScroll(e) }, h("div", { key: '40549da97df3a580ad2ddef13fe7b4dbe6df54bc', style: {
|
|
1359
1374
|
[sizeType]: `${size}px`,
|
|
1360
1375
|
} })));
|
|
1361
1376
|
}
|