@revolist/revogrid 4.8.11 → 4.8.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (117) hide show
  1. package/dist/cjs/base.plugin-75fc9e81.js.map +1 -1
  2. package/dist/cjs/index.cjs.js +1 -0
  3. package/dist/cjs/index.cjs.js.map +1 -1
  4. package/dist/cjs/loader.cjs.js +1 -1
  5. package/dist/cjs/revo-grid.cjs.entry.js +12 -5
  6. package/dist/cjs/revo-grid.cjs.entry.js.map +1 -1
  7. package/dist/cjs/revo-grid.cjs.js +1 -1
  8. package/dist/cjs/revogr-attribution_6.cjs.entry.js +4 -4
  9. package/dist/cjs/revogr-attribution_6.cjs.entry.js.map +1 -1
  10. package/dist/cjs/revogr-clipboard_3.cjs.entry.js +1 -1
  11. package/dist/cjs/revogr-clipboard_3.cjs.entry.js.map +1 -1
  12. package/dist/cjs/revogr-data_4.cjs.entry.js +3 -3
  13. package/dist/cjs/revogr-data_4.cjs.entry.js.map +1 -1
  14. package/dist/cjs/revogr-filter-panel.cjs.entry.js +1 -1
  15. package/dist/cjs/revogr-filter-panel.cjs.entry.js.map +1 -1
  16. package/dist/collection/components/data/revogr-data-style.css +7 -1
  17. package/dist/collection/components/editors/revogr-edit-style.css +1 -0
  18. package/dist/collection/components/header/revogr-header-style.css +1 -0
  19. package/dist/collection/components/overlay/revogr-overlay-style.css +1 -0
  20. package/dist/collection/components/revoGrid/revo-grid-style.css +1 -24
  21. package/dist/collection/components/revoGrid/revo-grid.js +46 -3
  22. package/dist/collection/components/revoGrid/revo-grid.js.map +1 -1
  23. package/dist/collection/components/scroll/revogr-viewport-scroll-style.css +1 -0
  24. package/dist/collection/components/scrollable/revogr-scroll-style.css +1 -0
  25. package/dist/collection/components/selectionFocus/revogr-focus-style.css +1 -0
  26. package/dist/collection/components/selectionTempRange/revogr-temp-range-style.css +1 -0
  27. package/dist/collection/index.js +1 -0
  28. package/dist/collection/index.js.map +1 -1
  29. package/dist/collection/plugins/base.plugin.js.map +1 -1
  30. package/dist/collection/plugins/filter/filter.style.css +1 -0
  31. package/dist/collection/serve/controller.js +1 -0
  32. package/dist/collection/serve/data.js +7 -7
  33. package/dist/esm/{base.plugin-e6e2bac2.js → base.plugin-30463006.js} +2 -2
  34. package/dist/esm/{base.plugin-e6e2bac2.js.map → base.plugin-30463006.js.map} +1 -1
  35. package/dist/esm/{column.service-6aab6fac.js → column.service-521eb0d5.js} +3 -3
  36. package/dist/esm/{column.service-6aab6fac.js.map → column.service-521eb0d5.js.map} +1 -1
  37. package/dist/esm/{dimension.helpers-c0c2888f.js → dimension.helpers-7c71178f.js} +2 -2
  38. package/dist/esm/{dimension.helpers-c0c2888f.js.map → dimension.helpers-7c71178f.js.map} +1 -1
  39. package/dist/esm/{header-cell-renderer-b8663a21.js → header-cell-renderer-f65d0383.js} +2 -2
  40. package/dist/esm/{header-cell-renderer-b8663a21.js.map → header-cell-renderer-f65d0383.js.map} +1 -1
  41. package/dist/esm/index.js +4 -4
  42. package/dist/esm/{key.utils-c4a27968.js → key.utils-d4fdcf5b.js} +2 -2
  43. package/dist/esm/{key.utils-c4a27968.js.map → key.utils-d4fdcf5b.js.map} +1 -1
  44. package/dist/esm/loader.js +1 -1
  45. package/dist/esm/revo-grid.entry.js +18 -11
  46. package/dist/esm/revo-grid.entry.js.map +1 -1
  47. package/dist/esm/revo-grid.js +1 -1
  48. package/dist/esm/revogr-attribution_6.entry.js +9 -9
  49. package/dist/esm/revogr-attribution_6.entry.js.map +1 -1
  50. package/dist/esm/revogr-clipboard_3.entry.js +3 -3
  51. package/dist/esm/revogr-clipboard_3.entry.js.map +1 -1
  52. package/dist/esm/revogr-data_4.entry.js +7 -7
  53. package/dist/esm/revogr-data_4.entry.js.map +1 -1
  54. package/dist/esm/revogr-filter-panel.entry.js +1 -1
  55. package/dist/esm/revogr-filter-panel.entry.js.map +1 -1
  56. package/dist/esm/{selection.helpers-dbf69cc1.js → selection.helpers-74cbfb89.js} +2 -2
  57. package/dist/esm/{selection.helpers-dbf69cc1.js.map → selection.helpers-74cbfb89.js.map} +1 -1
  58. package/dist/esm/{viewport.store-2dc172be.js → viewport.store-122731a5.js} +2 -2
  59. package/dist/esm/{viewport.store-2dc172be.js.map → viewport.store-122731a5.js.map} +1 -1
  60. package/dist/revo-grid/{base.plugin-e6e2bac2.js → base.plugin-30463006.js} +2 -2
  61. package/dist/revo-grid/{base.plugin-e6e2bac2.js.map → base.plugin-30463006.js.map} +1 -1
  62. package/dist/revo-grid/{column.service-6aab6fac.js → column.service-521eb0d5.js} +2 -2
  63. package/dist/revo-grid/{dimension.helpers-c0c2888f.js → dimension.helpers-7c71178f.js} +2 -2
  64. package/dist/revo-grid/{header-cell-renderer-b8663a21.js → header-cell-renderer-f65d0383.js} +2 -2
  65. package/dist/revo-grid/index.esm.js +1 -1
  66. package/dist/revo-grid/{key.utils-c4a27968.js → key.utils-d4fdcf5b.js} +2 -2
  67. package/dist/revo-grid/revo-grid.entry.js +1 -1
  68. package/dist/revo-grid/revo-grid.entry.js.map +1 -1
  69. package/dist/revo-grid/revo-grid.esm.js +1 -1
  70. package/dist/revo-grid/revo-grid.esm.js.map +1 -1
  71. package/dist/revo-grid/revogr-attribution_6.entry.js +1 -1
  72. package/dist/revo-grid/revogr-attribution_6.entry.js.map +1 -1
  73. package/dist/revo-grid/revogr-clipboard_3.entry.js +1 -1
  74. package/dist/revo-grid/revogr-clipboard_3.entry.js.map +1 -1
  75. package/dist/revo-grid/revogr-data_4.entry.js +1 -1
  76. package/dist/revo-grid/revogr-data_4.entry.js.map +1 -1
  77. package/dist/revo-grid/revogr-filter-panel.entry.js +1 -1
  78. package/dist/revo-grid/revogr-filter-panel.entry.js.map +1 -1
  79. package/dist/revo-grid/{selection.helpers-dbf69cc1.js → selection.helpers-74cbfb89.js} +2 -2
  80. package/dist/revo-grid/{viewport.store-2dc172be.js → viewport.store-122731a5.js} +2 -2
  81. package/dist/types/components/revoGrid/revo-grid.d.ts +9 -0
  82. package/dist/types/components.d.ts +10 -0
  83. package/dist/types/index.d.ts +1 -0
  84. package/dist/types/plugins/base.plugin.d.ts +1 -1
  85. package/hydrate/index.js +21 -14
  86. package/hydrate/index.mjs +21 -14
  87. package/package.json +2 -2
  88. package/standalone/column.service.js +1 -1
  89. package/standalone/data.store.js +1 -1
  90. package/standalone/index.js +1 -1
  91. package/standalone/revo-grid.js +15 -7
  92. package/standalone/revo-grid.js.map +1 -1
  93. package/standalone/revogr-data2.js +1 -1
  94. package/standalone/revogr-data2.js.map +1 -1
  95. package/standalone/revogr-edit2.js +1 -1
  96. package/standalone/revogr-edit2.js.map +1 -1
  97. package/standalone/revogr-filter-panel.js +1 -1
  98. package/standalone/revogr-filter-panel.js.map +1 -1
  99. package/standalone/revogr-focus2.js +1 -1
  100. package/standalone/revogr-focus2.js.map +1 -1
  101. package/standalone/revogr-header2.js +1 -1
  102. package/standalone/revogr-header2.js.map +1 -1
  103. package/standalone/revogr-overlay-selection2.js +1 -1
  104. package/standalone/revogr-overlay-selection2.js.map +1 -1
  105. package/standalone/revogr-row-headers2.js +1 -1
  106. package/standalone/revogr-scroll-virtual2.js +1 -1
  107. package/standalone/revogr-scroll-virtual2.js.map +1 -1
  108. package/standalone/revogr-temp-range2.js +1 -1
  109. package/standalone/revogr-temp-range2.js.map +1 -1
  110. package/standalone/revogr-viewport-scroll2.js +1 -1
  111. package/standalone/revogr-viewport-scroll2.js.map +1 -1
  112. /package/dist/revo-grid/{column.service-6aab6fac.js.map → column.service-521eb0d5.js.map} +0 -0
  113. /package/dist/revo-grid/{dimension.helpers-c0c2888f.js.map → dimension.helpers-7c71178f.js.map} +0 -0
  114. /package/dist/revo-grid/{header-cell-renderer-b8663a21.js.map → header-cell-renderer-f65d0383.js.map} +0 -0
  115. /package/dist/revo-grid/{key.utils-c4a27968.js.map → key.utils-d4fdcf5b.js.map} +0 -0
  116. /package/dist/revo-grid/{selection.helpers-dbf69cc1.js.map → selection.helpers-74cbfb89.js.map} +0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?tag=revogr-filter-panel","src/plugins/filter/filter.pop.tsx"],"sourcesContent":["(function closest() {\n if (!Element.prototype.matches) {\n Element.prototype.matches =\n ((Element.prototype as unknown) as { msMatchesSelector: (selectors: string) => boolean }).msMatchesSelector || Element.prototype.webkitMatchesSelector;\n }\n\n if (!Element.prototype.closest) {\n Element.prototype.closest = function (s: string) {\n let el: HTMLElement | Element | (Node & ParentNode) = this;\n\n do {\n if (Element.prototype.matches.call(el, s)) {\n return el;\n }\n el = el.parentElement || el.parentNode;\n } while (el !== null && el.nodeType === 1);\n return null;\n };\n }\n})();\n","revogr-filter-panel {\n position: absolute;\n display: block;\n top: 0;\n left: 0;\n z-index: 100;\n\n opacity: 1;\n transform: none;\n background-color: #fff;\n transform-origin: 62px 0px;\n box-shadow: 0 5px 18px -2px rgba(black, 20%);\n padding: 10px;\n border-radius: 4px;\n\n min-width: 220px;\n text-align: left;\n\n .filter-holder > div {\n display: flex;\n flex-direction: column;\n }\n\n label {\n font-size: 13px;\n display: block;\n padding: 8px 0;\n }\n\n select {\n width: 100%;\n }\n\n input[type='text'] {\n border: 0;\n min-height: 34px;\n margin: 5px 0;\n background: #f3f3f3;\n border-radius: 5px;\n padding: 0 10px;\n box-sizing: border-box;\n width: 100%;\n }\n\n button {\n margin-top: 10px;\n margin-right: 5px;\n }\n\n .filter-actions {\n text-align: right;\n margin-right: -5px;\n }\n}\n\n.rgHeaderCell {\n &:hover .rv-filter {\n transition:\n opacity 267ms cubic-bezier(0.4, 0, 0.2, 1) 0ms,\n transform 178ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;\n }\n &:hover .rv-filter,\n .rv-filter.active {\n opacity: 1;\n }\n\n .rv-filter {\n $btn-size: 24px;\n height: $btn-size;\n width: $btn-size;\n background: none;\n border: 0;\n opacity: 0;\n visibility: visible;\n cursor: pointer;\n border-radius: 4px;\n\n &.active {\n color: #10224a;\n }\n\n .filter-img {\n $img-size: 11px;\n color: gray;\n width: $img-size;\n }\n }\n}\n\n.select-css {\n $gradient: 'data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%23007CB2%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E';\n $linearGradient: linear-gradient(to bottom, #ffffff 0%, #ffffff 100%);\n $borderColor: #f1f1f1;\n\n display: block;\n font-family: sans-serif;\n font-weight: 600;\n color: #444;\n line-height: 1.3;\n padding: 0.6em 1.4em 0.5em 0.8em;\n width: 100%;\n max-width: 100%; /* useful when width is set to anything other than 100% */\n box-sizing: border-box;\n margin: 0;\n border: 1px solid $borderColor;\n box-shadow: transparent;\n border-radius: 0.5em;\n appearance: none;\n background-color: #fff;\n background-image: url($gradient), $linearGradient;\n background-repeat: no-repeat, repeat;\n /* arrow icon position (1em from the right, 50% vertical) , then gradient position*/\n background-position:\n right 0.7em top 50%,\n 0 0;\n /* icon size, then gradient */\n background-size:\n 0.65em auto,\n 100%;\n\n /* Hide arrow icon in IE browsers */\n &::-ms-expand {\n display: none;\n }\n /* Hover style */\n &:hover {\n border-color: rgb(197, 197, 197);\n }\n /* Focus style */\n &:focus {\n border-color: $borderColor;\n box-shadow: 0 0 1px 3px rgba(59, 153, 252, 0.7);\n box-shadow: 0 0 0 3px -moz-mac-focusring;\n color: #222;\n outline: none;\n }\n\n /* Set options to normal weight */\n option {\n font-weight: normal;\n }\n\n /* Disabled styles */\n &:disabled,\n &[aria-disabled='true'] {\n color: gray;\n background-image: url('data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22graytext%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E'),\n linear-gradient(to bottom, #ffffff 0%, #ffffff 100%);\n }\n\n &:disabled:hover,\n &[aria-disabled='true'] {\n border-color: $borderColor;\n }\n}\n\n.multi-filter-list {\n margin-top: 5px;\n margin-bottom: 5px;\n\n div {\n white-space: nowrap;\n }\n\n .multi-filter-list-action {\n display: flex;\n\n justify-content: space-between;\n align-items: center;\n }\n\n .and-or-button {\n margin: 0 0 0 10px;\n min-width: 58px;\n cursor: pointer;\n }\n .trash-button {\n $btn-remove-size: 22px;\n margin: 0 0 -2px 6px;\n cursor: pointer;\n\n width: $btn-remove-size;\n height: 100%;\n font-size: 16px;\n\n .trash-img {\n width: 1em;\n }\n }\n}\n\n.add-filter-divider {\n display: block;\n margin: 0 -10px 10px -10px;\n\n border-bottom: 1px solid #d9d9d9;\n height: 10px;\n}\n\n.select-input {\n display: flex;\n justify-content: space-between;\n align-items: center;\n}\n","import { Component, Event, EventEmitter, h, Host, Listen, Method, Prop, State, VNode } from '@stencil/core';\nimport { FilterType } from './filter.service';\nimport { AndOrButton, isFilterBtn, TrashButton } from './filter.button';\nimport '../../utils/closest.polifill';\nimport { LogicFunction } from './filter.types';\nimport { FilterCaptions } from './filter.plugin';\nimport debounce from 'lodash/debounce';\nimport { ColumnProp } from '@type';\n\nexport type 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 type FilterData = {\n id: number;\n type: FilterType;\n value?: any;\n relation: 'and' | 'or';\n};\n\nexport type MultiFilterItem = {\n [prop: string]: FilterData[];\n};\n\nexport type ShowData = {\n x: number;\n y: number;\n /**\n * Auto correct position if it is out of document bounds\n */\n autoCorrect?: boolean;\n} & FilterItem;\n\nconst defaultType: FilterType = 'none';\n\nconst FILTER_LIST_CLASS = 'multi-filter-list';\nconst FILTER_LIST_CLASS_ACTION = 'multi-filter-list-action';\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 save: 'Save',\n // drops the filter\n reset: 'Cancel',\n cancel: 'Close',\n add: 'Add more condition...',\n placeholder: 'Enter value...',\n and: 'and',\n or: 'or',\n };\n @State() isFilterIdSet = false;\n @State() filterId = 0;\n @State() currentFilterId = -1;\n @State() currentFilterType: FilterType = defaultType;\n @State() changes: ShowData | undefined;\n @Prop({ mutable: true, reflect: true }) uuid: string;\n @Prop() filterItems: MultiFilterItem = {};\n @Prop() filterTypes: Record<string, string[]> = {};\n @Prop() filterNames: Record<string, string> = {};\n @Prop() filterEntities: Record<string, LogicFunction> = {};\n @Prop() filterCaptions: FilterCaptions | undefined;\n @Prop() disableDynamicFiltering = false;\n @Event() filterChange: EventEmitter<MultiFilterItem>;\n @Listen('mousedown', { target: 'document' }) onMouseDown(e: MouseEvent) {\n if (this.changes && !e.defaultPrevented) {\n const el = e.target as HTMLElement;\n if (this.isOutside(el) && !isFilterBtn(el)) {\n this.changes = undefined;\n }\n }\n }\n @Method() async show(newEntity?: ShowData) {\n this.changes = newEntity;\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 renderSelectOptions(type: FilterType, isDefaultTypeRemoved = false) {\n const options: VNode[] = [];\n const prop = this.changes?.prop;\n\n if (!isDefaultTypeRemoved) {\n const capts = Object.assign(this.filterCaptionsInternal, this.filterCaptions);\n\n options.push(\n <option selected={this.currentFilterType === defaultType} value={defaultType}>\n {prop && this.filterItems[prop] && this.filterItems[prop].length > 0 ? capts.add : this.filterNames[defaultType]}\n </option>,\n );\n }\n\n for (let gIndex in this.filterTypes) {\n options.push(\n ...this.filterTypes[gIndex].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 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') return '';\n\n const capts = Object.assign(this.filterCaptionsInternal, this.filterCaptions);\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 getFilterItemsList() {\n const prop = this.changes?.prop;\n if (!(prop || prop === 0)) return '';\n\n const propFilters = this.filterItems[prop] || [];\n const capts = Object.assign(this.filterCaptionsInternal, this.filterCaptions);\n return (\n <div key={this.filterId}>\n {propFilters.map((d, index) => {\n let andOrButton;\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(d.id)}>\n <AndOrButton text={d.relation === 'and' ? capts.and : capts.or} />\n </div>\n );\n }\n\n return (\n <div key={d.id} class={FILTER_LIST_CLASS}>\n <div class={{ 'select-input': true }}>\n <select class=\"select-css select-filter\" onChange={e => this.onFilterTypeChange(e, prop, index)}>\n {this.renderSelectOptions(this.filterItems[prop][index].type, true)}\n </select>\n <div class={FILTER_LIST_CLASS_ACTION}>{andOrButton}</div>\n <div onClick={() => this.onRemoveFilter(d.id)}>\n <TrashButton />\n </div>\n </div>\n <div>{this.renderExtra(prop, index)}</div>\n </div>\n );\n })}\n\n {propFilters.length > 0 ? <div class=\"add-filter-divider\"/> : ''}\n </div>\n );\n }\n\n private autoCorrect(el: HTMLElement) {\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}px`;\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(this.filterCaptionsInternal, this.filterCaptions);\n\n return (\n <Host style={style} ref={(el) => { this.changes.autoCorrect && this.autoCorrect(el) }}>\n <label>{capts.title}</label>\n <div class=\"filter-holder\">{this.getFilterItemsList()}</div>\n\n <div class=\"add-filter\">\n <select id=\"add-filter\" class=\"select-css\" onChange={e => this.onAddNewFilter(e)}>\n {this.renderSelectOptions(this.currentFilterType)}\n </select>\n </div>\n <div class=\"filter-actions\">\n {this.disableDynamicFiltering &&\n <button class=\"revo-button green save\" onClick={() => this.onSave()}>\n {capts.save}\n </button>\n }\n <button class=\"revo-button light reset\" onClick={() => this.onReset()}>\n {capts.reset}\n </button>\n <button class=\"revo-button light cancel\" onClick={() => this.onCancel()}>\n {capts.cancel}\n </button>\n </div>\n </Host>\n );\n }\n\n private onFilterTypeChange(e: Event, prop: ColumnProp, index: number) {\n const el = e.target as HTMLSelectElement;\n this.filterItems[prop][index].type = el.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('filter-input-' + this.filterItems[prop][index].id) as HTMLInputElement;\n if (input) input.focus();\n }, 0);\n\n if (!this.disableDynamicFiltering) this.debouncedApplyFilter();\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) this.debouncedApplyFilter();\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('filter-input-' + this.currentFilterId) 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 = (event.target as HTMLInputElement).value;\n\n if (!this.disableDynamicFiltering) this.debouncedApplyFilter();\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 delete this.filterItems[this.changes.prop];\n\n // this updates the DOM which is used by getFilterItemsList() key\n this.filterId++;\n\n this.filterChange.emit(this.filterItems);\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) this.debouncedApplyFilter();\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) this.debouncedApplyFilter();\n }\n\n private assertChanges() {\n if (!this.changes) {\n throw new Error('Changes required per edit');\n }\n }\n\n private isOutside(e: HTMLElement | null) {\n const select = document.getElementById('add-filter') as HTMLSelectElement;\n if (select) select.value = defaultType;\n\n this.currentFilterType = defaultType;\n this.changes.type = defaultType;\n this.currentFilterId = -1;\n if (e.classList.contains(`[uuid=\"${this.uuid}\"]`)) {\n return false;\n }\n return !e?.closest(`[uuid=\"${this.uuid}\"]`);\n }\n}\n"],"version":3}
1
+ {"file":"revogr-filter-panel.entry.js","mappings":";;;;;;;;AAAA,CAAC,SAAS,OAAO;IACf,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,OAAO,EAAE;QAC9B,OAAO,CAAC,SAAS,CAAC,OAAO;YACrB,OAAO,CAAC,SAA+E,CAAC,iBAAiB,IAAI,OAAO,CAAC,SAAS,CAAC,qBAAqB,CAAC;KAC1J;IAED,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,OAAO,EAAE;QAC9B,OAAO,CAAC,SAAS,CAAC,OAAO,GAAG,UAAU,CAAS;YAC7C,IAAI,EAAE,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AuB;YAAE,IAAI,CAAC,oBAAoB,EAAE,CAAC;KAChE;IAEO,aAAa;QACnB,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE;YACjB,MAAM,IAAI,KAAK,CAAC,2BAA2B,CAAC,CAAC;SAC9C;KACF;IAEO,SAAS,CAAC,CAAqB;QACrC,MAAM,MAAM,GAAG,QAAQ,CAAC,cAAc,CAAC,YAAY,CAAsB,CAAC;QAC1E,IAAI,MAAM;YAAE,MAAM,CAAC,KAAK,GAAG,WAAW,CAAC;QAEvC,IAAI,CAAC,iBAAiB,GAAG,WAAW,CAAC;QACrC,IAAI,CAAC,OAAO,CAAC,IAAI,GAAG,WAAW,CAAC;QAChC,IAAI,CAAC,eAAe,GAAG,CAAC,CAAC,CAAC;QAC1B,IAAI,CAAC,CAAC,SAAS,CAAC,QAAQ,CAAC,UAAU,IAAI,CAAC,IAAI,IAAI,CAAC,EAAE;YACjD,OAAO,KAAK,CAAC;SACd;QACD,OAAO,EAAC,CAAC,aAAD,CAAC,uBAAD,CAAC,CAAE,OAAO,CAAC,UAAU,IAAI,CAAC,IAAI,IAAI,CAAC,CAAA,CAAC;KAC7C;;;;;;","names":["debounce"],"sources":["src/utils/closest.polifill.ts","src/plugins/filter/filter.style.scss?tag=revogr-filter-panel","src/plugins/filter/filter.pop.tsx"],"sourcesContent":["(function closest() {\n if (!Element.prototype.matches) {\n Element.prototype.matches =\n ((Element.prototype as unknown) as { msMatchesSelector: (selectors: string) => boolean }).msMatchesSelector || Element.prototype.webkitMatchesSelector;\n }\n\n if (!Element.prototype.closest) {\n Element.prototype.closest = function (s: string) {\n let el: HTMLElement | Element | (Node & ParentNode) = this;\n\n do {\n if (Element.prototype.matches.call(el, s)) {\n return el;\n }\n el = el.parentElement || el.parentNode;\n } while (el !== null && el.nodeType === 1);\n return null;\n };\n }\n})();\n","revogr-filter-panel {\n position: absolute;\n display: block;\n top: 0;\n left: 0;\n z-index: 100;\n\n opacity: 1;\n transform: none;\n background-color: #fff;\n transform-origin: 62px 0px;\n box-shadow: 0 5px 18px -2px rgba(black, 20%);\n padding: 10px;\n border-radius: 4px;\n\n min-width: 220px;\n text-align: left;\n\n .filter-holder > div {\n display: flex;\n flex-direction: column;\n }\n\n label {\n font-size: 13px;\n display: block;\n padding: 8px 0;\n }\n\n select {\n width: 100%;\n }\n\n input[type='text'] {\n border: 0;\n min-height: 34px;\n margin: 5px 0;\n background: #f3f3f3;\n border-radius: 5px;\n padding: 0 10px;\n box-sizing: border-box;\n width: 100%;\n }\n\n button {\n margin-top: 10px;\n margin-right: 5px;\n }\n\n .filter-actions {\n text-align: right;\n margin-right: -5px;\n }\n}\n\n.rgHeaderCell {\n &:hover .rv-filter {\n transition:\n opacity 267ms cubic-bezier(0.4, 0, 0.2, 1) 0ms,\n transform 178ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;\n }\n &:hover .rv-filter,\n .rv-filter.active {\n opacity: 1;\n }\n\n .rv-filter {\n $btn-size: 24px;\n height: $btn-size;\n width: $btn-size;\n background: none;\n border: 0;\n opacity: 0;\n visibility: visible;\n cursor: pointer;\n border-radius: 4px;\n\n &.active {\n color: #10224a;\n }\n\n .filter-img {\n $img-size: 11px;\n color: gray;\n width: $img-size;\n }\n }\n}\n\n.select-css {\n $gradient: 'data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%23007CB2%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E';\n $linearGradient: linear-gradient(to bottom, #ffffff 0%, #ffffff 100%);\n $borderColor: #f1f1f1;\n\n display: block;\n font-family: sans-serif;\n font-weight: 600;\n color: #444;\n line-height: 1.3;\n padding: 0.6em 1.4em 0.5em 0.8em;\n width: 100%;\n max-width: 100%; /* useful when width is set to anything other than 100% */\n box-sizing: border-box;\n margin: 0;\n border: 1px solid $borderColor;\n box-shadow: transparent;\n border-radius: 0.5em;\n appearance: none;\n background-color: #fff;\n background-image: url($gradient), $linearGradient;\n background-repeat: no-repeat, repeat;\n /* arrow icon position (1em from the right, 50% vertical) , then gradient position*/\n background-position:\n right 0.7em top 50%,\n 0 0;\n /* icon size, then gradient */\n background-size:\n 0.65em auto,\n 100%;\n\n /* Hide arrow icon in IE browsers */\n &::-ms-expand {\n display: none;\n }\n /* Hover style */\n &:hover {\n border-color: rgb(197, 197, 197);\n }\n /* Focus style */\n &:focus {\n border-color: $borderColor;\n box-shadow: 0 0 1px 3px rgba(59, 153, 252, 0.7);\n box-shadow: 0 0 0 3px -moz-mac-focusring;\n color: #222;\n outline: none;\n }\n\n /* Set options to normal weight */\n option {\n font-weight: normal;\n }\n\n /* Disabled styles */\n &:disabled,\n &[aria-disabled='true'] {\n color: gray;\n background-image: url('data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22graytext%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E'),\n linear-gradient(to bottom, #ffffff 0%, #ffffff 100%);\n }\n\n &:disabled:hover,\n &[aria-disabled='true'] {\n border-color: $borderColor;\n }\n}\n\n.multi-filter-list {\n margin-top: 5px;\n margin-bottom: 5px;\n\n div {\n white-space: nowrap;\n }\n\n .multi-filter-list-action {\n display: flex;\n\n justify-content: space-between;\n align-items: center;\n }\n\n .and-or-button {\n margin: 0 0 0 10px;\n min-width: 58px;\n cursor: pointer;\n }\n .trash-button {\n $btn-remove-size: 22px;\n margin: 0 0 -2px 6px;\n cursor: pointer;\n\n width: $btn-remove-size;\n height: 100%;\n font-size: 16px;\n\n .trash-img {\n width: 1em;\n }\n }\n}\n\n.add-filter-divider {\n display: block;\n margin: 0 -10px 10px -10px;\n\n border-bottom: 1px solid #d9d9d9;\n height: 10px;\n}\n\n.select-input {\n display: flex;\n justify-content: space-between;\n align-items: center;\n}\n","import { Component, Event, EventEmitter, h, Host, Listen, Method, Prop, State, VNode } from '@stencil/core';\nimport { FilterType } from './filter.service';\nimport { AndOrButton, isFilterBtn, TrashButton } from './filter.button';\nimport '../../utils/closest.polifill';\nimport { LogicFunction } from './filter.types';\nimport { FilterCaptions } from './filter.plugin';\nimport debounce from 'lodash/debounce';\nimport { ColumnProp } from '@type';\n\nexport type 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 type FilterData = {\n id: number;\n type: FilterType;\n value?: any;\n relation: 'and' | 'or';\n};\n\nexport type MultiFilterItem = {\n [prop: string]: FilterData[];\n};\n\nexport type ShowData = {\n x: number;\n y: number;\n /**\n * Auto correct position if it is out of document bounds\n */\n autoCorrect?: boolean;\n} & FilterItem;\n\nconst defaultType: FilterType = 'none';\n\nconst FILTER_LIST_CLASS = 'multi-filter-list';\nconst FILTER_LIST_CLASS_ACTION = 'multi-filter-list-action';\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 save: 'Save',\n // drops the filter\n reset: 'Cancel',\n cancel: 'Close',\n add: 'Add more condition...',\n placeholder: 'Enter value...',\n and: 'and',\n or: 'or',\n };\n @State() isFilterIdSet = false;\n @State() filterId = 0;\n @State() currentFilterId = -1;\n @State() currentFilterType: FilterType = defaultType;\n @State() changes: ShowData | undefined;\n @Prop({ mutable: true, reflect: true }) uuid: string;\n @Prop() filterItems: MultiFilterItem = {};\n @Prop() filterTypes: Record<string, string[]> = {};\n @Prop() filterNames: Record<string, string> = {};\n @Prop() filterEntities: Record<string, LogicFunction> = {};\n @Prop() filterCaptions: FilterCaptions | undefined;\n @Prop() disableDynamicFiltering = false;\n @Event() filterChange: EventEmitter<MultiFilterItem>;\n @Listen('mousedown', { target: 'document' }) onMouseDown(e: MouseEvent) {\n if (this.changes && !e.defaultPrevented) {\n const el = e.target as HTMLElement;\n if (this.isOutside(el) && !isFilterBtn(el)) {\n this.changes = undefined;\n }\n }\n }\n @Method() async show(newEntity?: ShowData) {\n this.changes = newEntity;\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 renderSelectOptions(type: FilterType, isDefaultTypeRemoved = false) {\n const options: VNode[] = [];\n const prop = this.changes?.prop;\n\n if (!isDefaultTypeRemoved) {\n const capts = Object.assign(this.filterCaptionsInternal, this.filterCaptions);\n\n options.push(\n <option selected={this.currentFilterType === defaultType} value={defaultType}>\n {prop && this.filterItems[prop] && this.filterItems[prop].length > 0 ? capts.add : this.filterNames[defaultType]}\n </option>,\n );\n }\n\n for (let gIndex in this.filterTypes) {\n options.push(\n ...this.filterTypes[gIndex].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 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') return '';\n\n const capts = Object.assign(this.filterCaptionsInternal, this.filterCaptions);\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 getFilterItemsList() {\n const prop = this.changes?.prop;\n if (!(prop || prop === 0)) return '';\n\n const propFilters = this.filterItems[prop] || [];\n const capts = Object.assign(this.filterCaptionsInternal, this.filterCaptions);\n return (\n <div key={this.filterId}>\n {propFilters.map((d, index) => {\n let andOrButton;\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(d.id)}>\n <AndOrButton text={d.relation === 'and' ? capts.and : capts.or} />\n </div>\n );\n }\n\n return (\n <div key={d.id} class={FILTER_LIST_CLASS}>\n <div class={{ 'select-input': true }}>\n <select class=\"select-css select-filter\" onChange={e => this.onFilterTypeChange(e, prop, index)}>\n {this.renderSelectOptions(this.filterItems[prop][index].type, true)}\n </select>\n <div class={FILTER_LIST_CLASS_ACTION}>{andOrButton}</div>\n <div onClick={() => this.onRemoveFilter(d.id)}>\n <TrashButton />\n </div>\n </div>\n <div>{this.renderExtra(prop, index)}</div>\n </div>\n );\n })}\n\n {propFilters.length > 0 ? <div class=\"add-filter-divider\"/> : ''}\n </div>\n );\n }\n\n private autoCorrect(el: HTMLElement) {\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}px`;\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(this.filterCaptionsInternal, this.filterCaptions);\n\n return (\n <Host style={style} ref={(el) => { this.changes.autoCorrect && this.autoCorrect(el) }}>\n <label>{capts.title}</label>\n <div class=\"filter-holder\">{this.getFilterItemsList()}</div>\n\n <div class=\"add-filter\">\n <select id=\"add-filter\" class=\"select-css\" onChange={e => this.onAddNewFilter(e)}>\n {this.renderSelectOptions(this.currentFilterType)}\n </select>\n </div>\n <div class=\"filter-actions\">\n {this.disableDynamicFiltering &&\n <button class=\"revo-button green save\" onClick={() => this.onSave()}>\n {capts.save}\n </button>\n }\n <button class=\"revo-button light reset\" onClick={() => this.onReset()}>\n {capts.reset}\n </button>\n <button class=\"revo-button light cancel\" onClick={() => this.onCancel()}>\n {capts.cancel}\n </button>\n </div>\n </Host>\n );\n }\n\n private onFilterTypeChange(e: Event, prop: ColumnProp, index: number) {\n const el = e.target as HTMLSelectElement;\n this.filterItems[prop][index].type = el.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('filter-input-' + this.filterItems[prop][index].id) as HTMLInputElement;\n if (input) input.focus();\n }, 0);\n\n if (!this.disableDynamicFiltering) this.debouncedApplyFilter();\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) this.debouncedApplyFilter();\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('filter-input-' + this.currentFilterId) 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 = (event.target as HTMLInputElement).value;\n\n if (!this.disableDynamicFiltering) this.debouncedApplyFilter();\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 delete this.filterItems[this.changes.prop];\n\n // this updates the DOM which is used by getFilterItemsList() key\n this.filterId++;\n\n this.filterChange.emit(this.filterItems);\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) this.debouncedApplyFilter();\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) this.debouncedApplyFilter();\n }\n\n private assertChanges() {\n if (!this.changes) {\n throw new Error('Changes required per edit');\n }\n }\n\n private isOutside(e: HTMLElement | null) {\n const select = document.getElementById('add-filter') as HTMLSelectElement;\n if (select) select.value = defaultType;\n\n this.currentFilterType = defaultType;\n this.changes.type = defaultType;\n this.currentFilterId = -1;\n if (e.classList.contains(`[uuid=\"${this.uuid}\"]`)) {\n return false;\n }\n return !e?.closest(`[uuid=\"${this.uuid}\"]`);\n }\n}\n"],"version":3}
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * Built by Revolist OU ❤️
3
3
  */
4
- import { k as createStore, l as setStore } from './dimension.helpers-c0c2888f.js';
4
+ import { l as createStore, k as setStore } from './dimension.helpers-7c71178f.js';
5
5
  import './toNumber-8de324a7.js';
6
6
  import './index-e661aeb5.js';
7
7
 
@@ -437,4 +437,4 @@ function isRangeSingleCell(a) {
437
437
 
438
438
  export { EMPTY_INDEX as E, SelectionStore as S, isRangeSingleCell as a, SelectionStoreConnector as b, cropCellToMax as c, getRange as g, isHiddenStore as i, nextCell as n };
439
439
 
440
- //# sourceMappingURL=selection.helpers-dbf69cc1.js.map
440
+ //# sourceMappingURL=selection.helpers-74cbfb89.js.map
@@ -1 +1 @@
1
- {"file":"selection.helpers-dbf69cc1.js","mappings":";;;;;;;AAAA;;;AASA,SAAS,YAAY;IACnB,OAAO;QACL,KAAK,EAAE,IAAI;QACX,SAAS,EAAE,IAAI;QACf,aAAa,EAAE,IAAI;QACnB,KAAK,EAAE,IAAI;QACX,IAAI,EAAE,IAAI;QACV,QAAQ,EAAE,IAAI;QACd,SAAS,EAAE,IAAI;KAChB,CAAC;AACJ,CAAC;MAEY,cAAc;IAGzB;QADQ,gBAAW,GAAmB,EAAE,CAAC;QAEvC,IAAI,CAAC,KAAK,GAAG,WAAW,CAAC,YAAY,EAAE,CAA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AC,CAAC;YAC3B,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC;YAC3B,EAAE,EAAE,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC;YAC5B,EAAE,EAAE,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC;SAC7B;UACD,IAAI,CAAC;AACX,CAAC;SAEe,iBAAiB,CAAC,CAAY;IAC5C,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC;AACtC;;;;","names":[],"sources":["src/store/selection/selection.store.ts","src/services/selection.store.connector.ts","src/store/selection/selection.helpers.ts"],"sourcesContent":["/**\n * Selection store\n */\n\nimport { setStore, Observable } from '../../utils/store.utils';\nimport { getRange } from '@store';\nimport { SelectionStoreState, Cell, TempRange, RangeArea } from '@type';\nimport { createStore } from '@stencil/store';\n\nfunction defaultState(): SelectionStoreState {\n return {\n range: null,\n tempRange: null,\n tempRangeType: null,\n focus: null,\n edit: null,\n lastCell: null,\n nextFocus: null,\n };\n}\n\nexport class SelectionStore {\n readonly store: Observable<SelectionStoreState>;\n private unsubscribe: { (): void }[] = [];\n constructor() {\n this.store = createStore(defaultState());\n this.store.on('set', (key, newVal) => {\n if (key === 'tempRange' && !newVal) {\n this.store.set('tempRangeType', null);\n }\n });\n }\n\n onChange<Key extends keyof SelectionStoreState>(propName: Key, cb: (newValue: SelectionStoreState[Key]) => void) {\n this.unsubscribe.push(this.store.onChange(propName, cb));\n }\n\n clearFocus() {\n setStore(this.store, { focus: null, range: null, edit: null, tempRange: null });\n }\n\n setFocus(focus: Cell, end?: Cell) {\n if (!end) {\n setStore(this.store, { focus });\n } else {\n setStore(this.store, {\n focus,\n range: getRange(focus, end),\n edit: null,\n tempRange: null,\n });\n }\n }\n\n setNextFocus(focus: Cell) {\n setStore(this.store, { nextFocus: focus });\n }\n\n setTempArea(range: TempRange | null) {\n setStore(this.store, { tempRange: range?.area, tempRangeType: range?.type, edit: null });\n }\n\n clearTemp() {\n setStore(this.store, { tempRange: null });\n }\n\n /** Can be applied from selection change or from simple keyboard change clicks */\n setRangeArea(range: RangeArea) {\n setStore(this.store, { range, edit: null, tempRange: null });\n }\n setRange(start: Cell, end: Cell) {\n this.setRangeArea(getRange(start, end));\n }\n\n setLastCell(lastCell: Cell) {\n setStore(this.store, { lastCell });\n }\n\n setEdit(val: string | boolean) {\n const focus = this.store.get('focus');\n if (focus && typeof val === 'string') {\n setStore(this.store, {\n edit: { x: focus.x, y: focus.y, val },\n });\n return;\n }\n setStore(this.store, { edit: null });\n }\n\n dispose() {\n this.unsubscribe.forEach(f => f());\n this.store.dispose();\n }\n}\n","import { cropCellToMax, isHiddenStore, nextCell, SelectionStore } from '@store';\nimport type {\n MultiDimensionType,\n DimensionCols,\n DimensionRows,\n Cell,\n EditCellStore,\n RangeArea,\n} from '@type';\n\ntype StoreByDimension = Record<number, SelectionStore>;\ntype FocusedStore = {\n entity: SelectionStore;\n cell: Cell;\n position: Cell;\n};\n\ntype StoresMapping<T> = { [xOrY: number]: Partial<T> };\n\nexport const EMPTY_INDEX = -1;\n\nexport default class SelectionStoreConnector {\n // dirty flag required to cleanup whole store in case visibility of panels changed\n private dirty = false;\n readonly stores: { [y: number]: { [x: number]: SelectionStore } } = {};\n\n readonly columnStores: StoreByDimension = {};\n readonly rowStores: { [y: number]: SelectionStore } = {};\n\n /**\n * Helpers for data conversion\n */\n readonly storesByType: Partial<Record<MultiDimensionType, number>> = {};\n readonly storesXToType: StoresMapping<DimensionCols> = {};\n readonly storesYToType: StoresMapping<DimensionRows> = {};\n\n get focusedStore(): FocusedStore | null {\n for (let y in this.stores) {\n for (let x in this.stores[y]) {\n const focused = this.stores[y][x]?.store.get('focus');\n if (focused) {\n return {\n entity: this.stores[y][x],\n cell: focused,\n position: {\n x: parseInt(x, 10),\n y: parseInt(y, 10),\n },\n };\n }\n }\n }\n return null;\n }\n\n get edit(): EditCellStore | undefined {\n return this.focusedStore?.entity.store.get('edit');\n }\n\n get focused(): Cell | undefined {\n return this.focusedStore?.entity.store.get('focus');\n }\n\n get selectedRange(): RangeArea | undefined {\n return this.focusedStore?.entity.store.get('range');\n }\n\n private readonly sections: Element[] = [];\n\n registerSection(e?: Element) {\n if (!e) {\n this.sections.length = 0;\n // some elements removed, rebuild stores\n this.dirty = true;\n return;\n }\n if (this.sections.indexOf(e) === -1) {\n this.sections.push(e);\n }\n }\n\n // check if require to cleanup all stores\n beforeUpdate() {\n if (this.dirty) {\n for (let y in this.stores) {\n for (let x in this.stores[y]) {\n this.stores[y][x].dispose();\n }\n }\n this.dirty = false;\n }\n }\n\n registerColumn(x: number, type: DimensionCols): SelectionStore {\n // if hidden just create store but no operations needed\n if (isHiddenStore(x)) {\n return new SelectionStore();\n }\n if (this.columnStores[x]) {\n return this.columnStores[x];\n }\n this.columnStores[x] = new SelectionStore();\n // build cross linking type to position\n this.storesByType[type] = x;\n this.storesXToType[x] = type;\n return this.columnStores[x];\n }\n\n registerRow(y: number, type: DimensionRows): SelectionStore {\n // if hidden just create store\n if (isHiddenStore(y)) {\n return new SelectionStore();\n }\n if (this.rowStores[y]) {\n return this.rowStores[y];\n }\n this.rowStores[y] = new SelectionStore();\n // build cross linking type to position\n this.storesByType[type] = y;\n this.storesYToType[y] = type;\n return this.rowStores[y];\n }\n\n /**\n * Cross store proxy, based on multiple dimensions\n */\n register({ x, y }: Cell): SelectionStore {\n // if hidden just create store\n if (isHiddenStore(x) || isHiddenStore(y)) {\n return new SelectionStore();\n }\n if (!this.stores[y]) {\n this.stores[y] = {};\n }\n if (this.stores[y][x]) {\n // Store already registered. Do not register twice\n return this.stores[y][x];\n }\n this.stores[y][x] = new SelectionStore();\n // proxy update, column store trigger only range area\n this.stores[y][x]?.onChange('range', c => {\n this.columnStores[x].setRangeArea(c);\n this.rowStores[y].setRangeArea(c);\n });\n // clean up on remove\n this.stores[y][x]?.store.on('dispose', () => this.destroy(x, y));\n return this.stores[y][x];\n }\n\n private destroy(x: number, y: number) {\n this.columnStores[x]?.dispose();\n this.rowStores[y]?.dispose();\n\n delete this.rowStores[y];\n delete this.columnStores[x];\n // clear x cross link\n if (this.storesXToType[x]) {\n const type = this.storesXToType[x];\n delete this.storesXToType[x];\n delete this.storesByType[type];\n }\n // clear y cross link\n if (this.storesYToType[y]) {\n const type = this.storesYToType[y];\n delete this.storesYToType[y];\n delete this.storesByType[type];\n }\n if (this.stores[y]) {\n delete this.stores[y][x];\n }\n // clear empty rows\n if (!Object.keys(this.stores[y] || {}).length) {\n delete this.stores[y];\n }\n }\n\n setEditByCell<T extends Cell>(storePos: T, editCell: T) {\n this.focusByCell(storePos, editCell, editCell);\n this.setEdit('');\n }\n\n /**\n * Sets the next focus cell before the current one.\n * \n * @param focus - The cell to set as the next focus.\n */\n beforeNextFocusCell(focus: Cell) {\n // If there is no focused store, return early.\n if (!this.focusedStore) {\n return;\n }\n\n // Get the next store based on the current focus and the last cell.\n const next = this.getNextStore(focus, this.focusedStore.position, this.focusedStore.entity.store.get('lastCell') );\n\n // Set the next focus cell in the store.\n next.store?.setNextFocus({ ...focus, ...next.item });\n }\n\n focusByCell<T extends Cell>(storePos: T, start: T, end: T) {\n const store = this.stores[storePos.y][storePos.x];\n this.focus(store, { focus: start, end });\n }\n\n focus(store: SelectionStore, { focus, end }: { focus: Cell; end: Cell }) {\n const currentStorePointer = this.getCurrentStorePointer(store);\n if (!currentStorePointer) {\n return null;\n }\n\n // check for the focus in nearby store/viewport\n const lastCell = store.store.get('lastCell');\n const next = this.getNextStore(focus, currentStorePointer, lastCell);\n\n // if next store present - update\n if (next?.store) {\n const item = { ...focus, ...next.item };\n this.focus(next.store, { focus: item, end: item });\n return null;\n }\n\n focus = cropCellToMax(focus, lastCell);\n end = cropCellToMax(end, lastCell);\n\n store.setFocus(focus, end);\n return focus;\n }\n\n /**\n * Retrieves the current store pointer based on the active store.\n * Clears focus from all stores except the active one.\n */\n getCurrentStorePointer(store: SelectionStore): Cell {\n let currentStorePointer: Cell;\n\n // Iterate through all stores\n for (let y in this.stores) {\n for (let x in this.stores[y]) {\n const s = this.stores[y][x];\n\n // Clear focus from stores other than the active one\n if (s !== store) {\n s.clearFocus();\n } else {\n // Update the current store pointer with the active store coordinates\n currentStorePointer = { \n x: parseInt(x, 10), \n y: parseInt(y, 10) \n };\n }\n }\n }\n\n return currentStorePointer;\n }\n\n /**\n * Retrieves the next store based on the focus cell and current store pointer.\n * If the next store exists, returns an object with the next store and the item in the new store.\n * If the next store does not exist, returns null.\n */\n getNextStore(\n focus: Cell,\n currentStorePointer: Cell,\n lastCell: Cell,\n ) {\n // item in new store\n const nextItem: Partial<Cell> | null = nextCell(focus, lastCell);\n\n let nextStore: SelectionStore | null = null;\n if (nextItem) {\n for (let i in nextItem) {\n let type: keyof Cell = i as keyof Cell;\n let stores;\n switch (type) {\n case 'x':\n // Get the X stores for the current Y coordinate of the current store pointer\n stores = this.getXStores(currentStorePointer.y);\n break;\n case 'y':\n // Get the Y stores for the current X coordinate of the current store pointer\n stores = this.getYStores(currentStorePointer.x);\n stores = this.getYStores(currentStorePointer.x);\n break;\n }\n if (nextItem[type] >= 0) {\n nextStore = stores[++currentStorePointer[type]];\n } else {\n nextStore = stores[--currentStorePointer[type]];\n const nextLastCell = nextStore?.store.get('lastCell');\n if (nextLastCell) {\n nextItem[type] = nextLastCell[type] + nextItem[type];\n }\n }\n }\n }\n return {\n store: nextStore,\n item: nextItem,\n };\n }\n\n clearAll() {\n for (let y in this.stores) {\n for (let x in this.stores[y]) {\n this.stores[y][x]?.clearFocus();\n }\n }\n }\n\n setEdit(val: string | boolean) {\n if (!this.focusedStore) {\n return;\n }\n this.focusedStore.entity.setEdit(val);\n }\n\n /**\n * Select all cells across all stores\n */\n selectAll() {\n for (let y in this.stores) {\n for (let x in this.stores[y]) {\n const store = this.stores[y][x];\n if (!store) {\n continue;\n }\n const lastCell = store.store.get('lastCell');\n store.setRange(\n { x: 0, y: 0 },\n { x: lastCell.x - 1, y: lastCell.y - 1 },\n );\n }\n }\n }\n\n private getXStores(y: number) {\n return this.stores[y];\n }\n\n private getYStores(x: number) {\n const stores: { [p: number]: SelectionStore } = {};\n for (let i in this.stores) {\n stores[i] = this.stores[i][x];\n }\n return stores;\n }\n}\n","import { EMPTY_INDEX } from '../../services/selection.store.connector';\nimport { Cell, RangeArea } from '@type';\n\nexport function isHiddenStore(pos: number) {\n return pos === EMPTY_INDEX;\n}\n\nexport function nextCell(cell: Cell, lastCell: Cell): Partial<Cell> | null {\n const nextItem: Partial<Cell> = {};\n let types: (keyof Cell)[] = ['x', 'y'];\n\n // previous item check\n for (let t of types) {\n if (cell[t] < 0) {\n nextItem[t] = cell[t];\n return nextItem;\n }\n }\n // next item check\n for (let t of types) {\n if (cell[t] >= lastCell[t]) {\n nextItem[t] = cell[t] - lastCell[t];\n return nextItem;\n }\n }\n return null;\n}\n\nexport function cropCellToMax(cell: Cell, lastCell: Cell): Cell {\n const newCell: Cell = { ...cell };\n let types: (keyof Cell)[] = ['x', 'y'];\n // previous item check\n for (let t of types) {\n if (cell[t] < 0) {\n newCell[t] = 0;\n }\n }\n // next item check\n for (let t of types) {\n if (cell[t] >= lastCell[t]) {\n newCell[t] = lastCell[t] - 1;\n }\n }\n return newCell;\n}\n\nexport function getRange(start?: Cell, end?: Cell): RangeArea | null {\n return start && end\n ? {\n x: Math.min(start.x, end.x),\n y: Math.min(start.y, end.y),\n x1: Math.max(start.x, end.x),\n y1: Math.max(start.y, end.y),\n }\n : null;\n}\n\nexport function isRangeSingleCell(a: RangeArea): boolean {\n return a.x === a.x1 && a.y === a.y1;\n}\n"],"version":3}
1
+ {"file":"selection.helpers-74cbfb89.js","mappings":";;;;;;;AAAA;;;AASA,SAAS,YAAY;IACnB,OAAO;QACL,KAAK,EAAE,IAAI;QACX,SAAS,EA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CAAC,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;SAC9B;KACF;IACD,OAAO,OAAO,CAAC;AACjB,CAAC;SAEe,QAAQ,CAAC,KAAY,EAAE,GAAU;IAC/C,OAAO,KAAK,IAAI,GAAG;UACf;YACE,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC;YAC3B,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC;YAC3B,EAAE,EAAE,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC;YAC5B,EAAE,EAAE,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC;SAC7B;UACD,IAAI,CAAC;AACX,CAAC;SAEe,iBAAiB,CAAC,CAAY;IAC5C,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC;AACtC;;;;","names":[],"sources":["src/store/selection/selection.store.ts","src/services/selection.store.connector.ts","src/store/selection/selection.helpers.ts"],"sourcesContent":["/**\n * Selection store\n */\n\nimport { setStore, Observable } from '../../utils/store.utils';\nimport { getRange } from '@store';\nimport { SelectionStoreState, Cell, TempRange, RangeArea } from '@type';\nimport { createStore } from '@stencil/store';\n\nfunction defaultState(): SelectionStoreState {\n return {\n range: null,\n tempRange: null,\n tempRangeType: null,\n focus: null,\n edit: null,\n lastCell: null,\n nextFocus: null,\n };\n}\n\nexport class SelectionStore {\n readonly store: Observable<SelectionStoreState>;\n private unsubscribe: { (): void }[] = [];\n constructor() {\n this.store = createStore(defaultState());\n this.store.on('set', (key, newVal) => {\n if (key === 'tempRange' && !newVal) {\n this.store.set('tempRangeType', null);\n }\n });\n }\n\n onChange<Key extends keyof SelectionStoreState>(propName: Key, cb: (newValue: SelectionStoreState[Key]) => void) {\n this.unsubscribe.push(this.store.onChange(propName, cb));\n }\n\n clearFocus() {\n setStore(this.store, { focus: null, range: null, edit: null, tempRange: null });\n }\n\n setFocus(focus: Cell, end?: Cell) {\n if (!end) {\n setStore(this.store, { focus });\n } else {\n setStore(this.store, {\n focus,\n range: getRange(focus, end),\n edit: null,\n tempRange: null,\n });\n }\n }\n\n setNextFocus(focus: Cell) {\n setStore(this.store, { nextFocus: focus });\n }\n\n setTempArea(range: TempRange | null) {\n setStore(this.store, { tempRange: range?.area, tempRangeType: range?.type, edit: null });\n }\n\n clearTemp() {\n setStore(this.store, { tempRange: null });\n }\n\n /** Can be applied from selection change or from simple keyboard change clicks */\n setRangeArea(range: RangeArea) {\n setStore(this.store, { range, edit: null, tempRange: null });\n }\n setRange(start: Cell, end: Cell) {\n this.setRangeArea(getRange(start, end));\n }\n\n setLastCell(lastCell: Cell) {\n setStore(this.store, { lastCell });\n }\n\n setEdit(val: string | boolean) {\n const focus = this.store.get('focus');\n if (focus && typeof val === 'string') {\n setStore(this.store, {\n edit: { x: focus.x, y: focus.y, val },\n });\n return;\n }\n setStore(this.store, { edit: null });\n }\n\n dispose() {\n this.unsubscribe.forEach(f => f());\n this.store.dispose();\n }\n}\n","import { cropCellToMax, isHiddenStore, nextCell, SelectionStore } from '@store';\nimport type {\n MultiDimensionType,\n DimensionCols,\n DimensionRows,\n Cell,\n EditCellStore,\n RangeArea,\n} from '@type';\n\ntype StoreByDimension = Record<number, SelectionStore>;\ntype FocusedStore = {\n entity: SelectionStore;\n cell: Cell;\n position: Cell;\n};\n\ntype StoresMapping<T> = { [xOrY: number]: Partial<T> };\n\nexport const EMPTY_INDEX = -1;\n\nexport default class SelectionStoreConnector {\n // dirty flag required to cleanup whole store in case visibility of panels changed\n private dirty = false;\n readonly stores: { [y: number]: { [x: number]: SelectionStore } } = {};\n\n readonly columnStores: StoreByDimension = {};\n readonly rowStores: { [y: number]: SelectionStore } = {};\n\n /**\n * Helpers for data conversion\n */\n readonly storesByType: Partial<Record<MultiDimensionType, number>> = {};\n readonly storesXToType: StoresMapping<DimensionCols> = {};\n readonly storesYToType: StoresMapping<DimensionRows> = {};\n\n get focusedStore(): FocusedStore | null {\n for (let y in this.stores) {\n for (let x in this.stores[y]) {\n const focused = this.stores[y][x]?.store.get('focus');\n if (focused) {\n return {\n entity: this.stores[y][x],\n cell: focused,\n position: {\n x: parseInt(x, 10),\n y: parseInt(y, 10),\n },\n };\n }\n }\n }\n return null;\n }\n\n get edit(): EditCellStore | undefined {\n return this.focusedStore?.entity.store.get('edit');\n }\n\n get focused(): Cell | undefined {\n return this.focusedStore?.entity.store.get('focus');\n }\n\n get selectedRange(): RangeArea | undefined {\n return this.focusedStore?.entity.store.get('range');\n }\n\n private readonly sections: Element[] = [];\n\n registerSection(e?: Element) {\n if (!e) {\n this.sections.length = 0;\n // some elements removed, rebuild stores\n this.dirty = true;\n return;\n }\n if (this.sections.indexOf(e) === -1) {\n this.sections.push(e);\n }\n }\n\n // check if require to cleanup all stores\n beforeUpdate() {\n if (this.dirty) {\n for (let y in this.stores) {\n for (let x in this.stores[y]) {\n this.stores[y][x].dispose();\n }\n }\n this.dirty = false;\n }\n }\n\n registerColumn(x: number, type: DimensionCols): SelectionStore {\n // if hidden just create store but no operations needed\n if (isHiddenStore(x)) {\n return new SelectionStore();\n }\n if (this.columnStores[x]) {\n return this.columnStores[x];\n }\n this.columnStores[x] = new SelectionStore();\n // build cross linking type to position\n this.storesByType[type] = x;\n this.storesXToType[x] = type;\n return this.columnStores[x];\n }\n\n registerRow(y: number, type: DimensionRows): SelectionStore {\n // if hidden just create store\n if (isHiddenStore(y)) {\n return new SelectionStore();\n }\n if (this.rowStores[y]) {\n return this.rowStores[y];\n }\n this.rowStores[y] = new SelectionStore();\n // build cross linking type to position\n this.storesByType[type] = y;\n this.storesYToType[y] = type;\n return this.rowStores[y];\n }\n\n /**\n * Cross store proxy, based on multiple dimensions\n */\n register({ x, y }: Cell): SelectionStore {\n // if hidden just create store\n if (isHiddenStore(x) || isHiddenStore(y)) {\n return new SelectionStore();\n }\n if (!this.stores[y]) {\n this.stores[y] = {};\n }\n if (this.stores[y][x]) {\n // Store already registered. Do not register twice\n return this.stores[y][x];\n }\n this.stores[y][x] = new SelectionStore();\n // proxy update, column store trigger only range area\n this.stores[y][x]?.onChange('range', c => {\n this.columnStores[x].setRangeArea(c);\n this.rowStores[y].setRangeArea(c);\n });\n // clean up on remove\n this.stores[y][x]?.store.on('dispose', () => this.destroy(x, y));\n return this.stores[y][x];\n }\n\n private destroy(x: number, y: number) {\n this.columnStores[x]?.dispose();\n this.rowStores[y]?.dispose();\n\n delete this.rowStores[y];\n delete this.columnStores[x];\n // clear x cross link\n if (this.storesXToType[x]) {\n const type = this.storesXToType[x];\n delete this.storesXToType[x];\n delete this.storesByType[type];\n }\n // clear y cross link\n if (this.storesYToType[y]) {\n const type = this.storesYToType[y];\n delete this.storesYToType[y];\n delete this.storesByType[type];\n }\n if (this.stores[y]) {\n delete this.stores[y][x];\n }\n // clear empty rows\n if (!Object.keys(this.stores[y] || {}).length) {\n delete this.stores[y];\n }\n }\n\n setEditByCell<T extends Cell>(storePos: T, editCell: T) {\n this.focusByCell(storePos, editCell, editCell);\n this.setEdit('');\n }\n\n /**\n * Sets the next focus cell before the current one.\n * \n * @param focus - The cell to set as the next focus.\n */\n beforeNextFocusCell(focus: Cell) {\n // If there is no focused store, return early.\n if (!this.focusedStore) {\n return;\n }\n\n // Get the next store based on the current focus and the last cell.\n const next = this.getNextStore(focus, this.focusedStore.position, this.focusedStore.entity.store.get('lastCell') );\n\n // Set the next focus cell in the store.\n next.store?.setNextFocus({ ...focus, ...next.item });\n }\n\n focusByCell<T extends Cell>(storePos: T, start: T, end: T) {\n const store = this.stores[storePos.y][storePos.x];\n this.focus(store, { focus: start, end });\n }\n\n focus(store: SelectionStore, { focus, end }: { focus: Cell; end: Cell }) {\n const currentStorePointer = this.getCurrentStorePointer(store);\n if (!currentStorePointer) {\n return null;\n }\n\n // check for the focus in nearby store/viewport\n const lastCell = store.store.get('lastCell');\n const next = this.getNextStore(focus, currentStorePointer, lastCell);\n\n // if next store present - update\n if (next?.store) {\n const item = { ...focus, ...next.item };\n this.focus(next.store, { focus: item, end: item });\n return null;\n }\n\n focus = cropCellToMax(focus, lastCell);\n end = cropCellToMax(end, lastCell);\n\n store.setFocus(focus, end);\n return focus;\n }\n\n /**\n * Retrieves the current store pointer based on the active store.\n * Clears focus from all stores except the active one.\n */\n getCurrentStorePointer(store: SelectionStore): Cell {\n let currentStorePointer: Cell;\n\n // Iterate through all stores\n for (let y in this.stores) {\n for (let x in this.stores[y]) {\n const s = this.stores[y][x];\n\n // Clear focus from stores other than the active one\n if (s !== store) {\n s.clearFocus();\n } else {\n // Update the current store pointer with the active store coordinates\n currentStorePointer = { \n x: parseInt(x, 10), \n y: parseInt(y, 10) \n };\n }\n }\n }\n\n return currentStorePointer;\n }\n\n /**\n * Retrieves the next store based on the focus cell and current store pointer.\n * If the next store exists, returns an object with the next store and the item in the new store.\n * If the next store does not exist, returns null.\n */\n getNextStore(\n focus: Cell,\n currentStorePointer: Cell,\n lastCell: Cell,\n ) {\n // item in new store\n const nextItem: Partial<Cell> | null = nextCell(focus, lastCell);\n\n let nextStore: SelectionStore | null = null;\n if (nextItem) {\n for (let i in nextItem) {\n let type: keyof Cell = i as keyof Cell;\n let stores;\n switch (type) {\n case 'x':\n // Get the X stores for the current Y coordinate of the current store pointer\n stores = this.getXStores(currentStorePointer.y);\n break;\n case 'y':\n // Get the Y stores for the current X coordinate of the current store pointer\n stores = this.getYStores(currentStorePointer.x);\n stores = this.getYStores(currentStorePointer.x);\n break;\n }\n if (nextItem[type] >= 0) {\n nextStore = stores[++currentStorePointer[type]];\n } else {\n nextStore = stores[--currentStorePointer[type]];\n const nextLastCell = nextStore?.store.get('lastCell');\n if (nextLastCell) {\n nextItem[type] = nextLastCell[type] + nextItem[type];\n }\n }\n }\n }\n return {\n store: nextStore,\n item: nextItem,\n };\n }\n\n clearAll() {\n for (let y in this.stores) {\n for (let x in this.stores[y]) {\n this.stores[y][x]?.clearFocus();\n }\n }\n }\n\n setEdit(val: string | boolean) {\n if (!this.focusedStore) {\n return;\n }\n this.focusedStore.entity.setEdit(val);\n }\n\n /**\n * Select all cells across all stores\n */\n selectAll() {\n for (let y in this.stores) {\n for (let x in this.stores[y]) {\n const store = this.stores[y][x];\n if (!store) {\n continue;\n }\n const lastCell = store.store.get('lastCell');\n store.setRange(\n { x: 0, y: 0 },\n { x: lastCell.x - 1, y: lastCell.y - 1 },\n );\n }\n }\n }\n\n private getXStores(y: number) {\n return this.stores[y];\n }\n\n private getYStores(x: number) {\n const stores: { [p: number]: SelectionStore } = {};\n for (let i in this.stores) {\n stores[i] = this.stores[i][x];\n }\n return stores;\n }\n}\n","import { EMPTY_INDEX } from '../../services/selection.store.connector';\nimport { Cell, RangeArea } from '@type';\n\nexport function isHiddenStore(pos: number) {\n return pos === EMPTY_INDEX;\n}\n\nexport function nextCell(cell: Cell, lastCell: Cell): Partial<Cell> | null {\n const nextItem: Partial<Cell> = {};\n let types: (keyof Cell)[] = ['x', 'y'];\n\n // previous item check\n for (let t of types) {\n if (cell[t] < 0) {\n nextItem[t] = cell[t];\n return nextItem;\n }\n }\n // next item check\n for (let t of types) {\n if (cell[t] >= lastCell[t]) {\n nextItem[t] = cell[t] - lastCell[t];\n return nextItem;\n }\n }\n return null;\n}\n\nexport function cropCellToMax(cell: Cell, lastCell: Cell): Cell {\n const newCell: Cell = { ...cell };\n let types: (keyof Cell)[] = ['x', 'y'];\n // previous item check\n for (let t of types) {\n if (cell[t] < 0) {\n newCell[t] = 0;\n }\n }\n // next item check\n for (let t of types) {\n if (cell[t] >= lastCell[t]) {\n newCell[t] = lastCell[t] - 1;\n }\n }\n return newCell;\n}\n\nexport function getRange(start?: Cell, end?: Cell): RangeArea | null {\n return start && end\n ? {\n x: Math.min(start.x, end.x),\n y: Math.min(start.y, end.y),\n x1: Math.max(start.x, end.x),\n y1: Math.max(start.y, end.y),\n }\n : null;\n}\n\nexport function isRangeSingleCell(a: RangeArea): boolean {\n return a.x === a.x1 && a.y === a.y1;\n}\n"],"version":3}
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * Built by Revolist OU ❤️
3
3
  */
4
- import { i as getItemByPosition, k as createStore, l as setStore } from './dimension.helpers-c0c2888f.js';
4
+ import { i as getItemByPosition, l as createStore, k as setStore } from './dimension.helpers-7c71178f.js';
5
5
 
6
6
  /**
7
7
  * Update items based on new scroll position
@@ -432,4 +432,4 @@ class ViewportStore {
432
432
 
433
433
  export { ViewportStore as V, addMissingItems as a, getItems as b, isActiveRangeOutsideLastItem as c, getFirstItem as d, getLastItem as e, getUpdatedItemsByPosition as g, isActiveRange as i, recombineByOffset as r, setItemSizes as s, updateMissingAndRange as u };
434
434
 
435
- //# sourceMappingURL=viewport.store-2dc172be.js.map
435
+ //# sourceMappingURL=viewport.store-122731a5.js.map
@@ -1 +1 @@
1
- {"file":"viewport.store-2dc172be.js","mappings":";;;;;AAsBA;;;;;SAKgB,yBAAyB,CACvC,GAAW;AACX,KAAQ,EACR,SAAiB,EACjB,WAAmB,EACnB,SAAgC;IAEhC,MAAM,UAAU,GAAiB,iBAAiB,CAAC,SAAS,EAAE,GAAG,CAAC,CAAC;IACnE,MAAM,SAAS,GAAiB,YAAY,CAAC,KAAK,CAAC,CAAC;IACpD,IAAI,QAAuB,CAAC;;IAE5B,IAAI,SAAS,EAAE;QACb,IAAI,kBAAkB,GAAG,UAAU,CAAC,SAAS,IAAI,SAAS,CAAC,SAAS,IAAI,CAAC,CAAC,CAAC;;QAE3E,IAAI,kBAAkB,EAAE;;YAEtB,QAAQ,GAAG,iBAAiB,CAAC,IAAI,CAAC,GAAG,CAAC,kBAAkB,CAAC,gCACvD,iBAAiB,EAAE,kBAAkB,GAAG,CAAC,CAAC,IACvC,SAAS,GACT,KAAK,EACR,CAAC;SACJ;KACF;IA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AC;;aAE9B;;YAGD,KAAK,EAAE,CAAC;YACR,CAAC,EAAE,CAAC;;YAEJ,IAAI,KAAK,KAAK,KAAK,EAAE;gBACnB,KAAK,GAAG,CAAC,CAAC;aACX;SACF;QAED,IAAI,CAAC,WAAW,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,KAAK,CAAC,EAAE,CAAC,CAAC;KACzC;;;;IAKD,gBAAgB,CAAC,IAAY;QAC3B,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;QACtC,MAAM,KAAK,GAAG,KAAK,CAAC,MAAM,CAAC;;QAE3B,IAAI,CAAC,KAAK,EAAE;YACV,OAAO;SACR;QAED,QAAQ,CAAC,IAAI,CAAC,KAAK,EAAE;YACnB,KAAK,EAAE,YAAY,CACjB,KAAK,EACL,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,EACvB,IAAI,EACJ,IAAI,CAAC,cAAc,CACpB;SACF,CAAC,CAAC;KACJ;IAED,QAAQ;QACN,OAAO;YACL,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC;YAC9B,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC;YAC9B,GAAG,EAAE,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC;SAC3B,CAAC;KACH;IAED,WAAW,CAAC,IAA4B;QACtC,QAAQ,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;KAC5B;IAED,UAAU;QACR,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;KAC7B;;;;;","names":[],"sources":["src/store/vp/viewport.helpers.ts","src/store/vp/viewport.store.ts"],"sourcesContent":["import {\n DimensionSettingsState,\n PositionItem,\n ViewSettingSizeProp,\n ViewportStateItems,\n VirtualPositionItem,\n Range,\n} from '@type';\n\nimport { getItemByPosition } from '../dimension/dimension.helpers';\n\nexport type DimensionDataViewport = Pick<\n DimensionSettingsState,\n | 'indexes'\n | 'positionIndexes'\n | 'positionIndexToItem'\n | 'sizes'\n | 'originItemSize'\n | 'realSize'\n>;\n\ntype ItemsToUpdate = Pick<ViewportStateItems, 'items' | 'start' | 'end'>;\n/**\n * Update items based on new scroll position\n * If viewport wasn't changed fully simple recombination of positions\n * Otherwise rebuild viewport items\n */\nexport function getUpdatedItemsByPosition<T extends ItemsToUpdate>(\n pos: number, // coordinate\n items: T,\n realCount: number,\n virtualSize: number,\n dimension: DimensionDataViewport,\n): ItemsToUpdate {\n const activeItem: PositionItem = getItemByPosition(dimension, pos);\n const firstItem: PositionItem = getFirstItem(items);\n let toUpdate: ItemsToUpdate;\n // do simple position recombination if items already present in viewport\n if (firstItem) {\n let changedOffsetStart = activeItem.itemIndex - (firstItem.itemIndex || 0);\n // if item changed\n if (changedOffsetStart) {\n // simple recombination\n toUpdate = recombineByOffset(Math.abs(changedOffsetStart), {\n positiveDirection: changedOffsetStart > -1,\n ...dimension,\n ...items,\n });\n }\n }\n\n const maxSizeVirtualSize = getMaxVirtualSize(\n virtualSize,\n dimension.realSize,\n activeItem,\n );\n // if partial recombination add items if revo-viewport has some space left\n if (toUpdate) {\n const extra = addMissingItems(\n activeItem,\n realCount,\n maxSizeVirtualSize,\n toUpdate,\n dimension,\n );\n if (extra.length) {\n updateMissingAndRange(toUpdate.items, extra, toUpdate);\n }\n }\n\n // new collection if no items after replacement full replacement\n if (!toUpdate) {\n const items = getItems({\n firstItemStart: activeItem.start,\n firstItemIndex: activeItem.itemIndex,\n origSize: dimension.originItemSize,\n maxSize: maxSizeVirtualSize,\n maxCount: realCount,\n sizes: dimension.sizes,\n });\n\n // range now comes from 0 to length - 1\n toUpdate = {\n items,\n start: 0,\n end: items.length - 1,\n };\n }\n return toUpdate;\n}\n\n// virtual size can differ based on scroll position if some big items are present\n// scroll can be in the middle of item and virtual size will be larger\n// so we need to exclude this part from virtual size hence it's already passed\nfunction getMaxVirtualSize(\n virtualSize: number,\n realSize: number,\n activeItem: PositionItem,\n) {\n return Math.min(virtualSize + (activeItem.end - activeItem.start), realSize);\n}\n\nexport function updateMissingAndRange(\n items: VirtualPositionItem[],\n missing: VirtualPositionItem[],\n range: Range,\n) {\n items.splice(range.end + 1, 0, ...missing);\n // update range if start larger after recombination\n if (\n range.start >= range.end &&\n !(range.start === range.end && range.start === 0)\n ) {\n range.start += missing.length;\n }\n range.end += missing.length;\n}\n\n/**\n * If partial replacement\n * this function adds items if viewport has some space left\n */\nexport function addMissingItems<T extends ItemsToUpdate>(\n firstItem: PositionItem,\n realCount: number,\n virtualSize: number,\n existingCollection: T,\n dimension: Pick<DimensionSettingsState, 'sizes' | 'originItemSize'>,\n): VirtualPositionItem[] {\n const lastItem: VirtualPositionItem = getLastItem(existingCollection);\n const items = getItems({\n sizes: dimension.sizes,\n firstItemStart: lastItem.end,\n firstItemIndex: lastItem.itemIndex + 1,\n origSize: dimension.originItemSize,\n maxSize: virtualSize - (lastItem.end - firstItem.start),\n maxCount: realCount,\n });\n return items;\n}\n\n/**\n * Get wiewport items parameters\n * caching position and calculating items count in viewport\n */\nexport function getItems(\n opt: {\n firstItemIndex: number;\n firstItemStart: number;\n origSize: number;\n maxSize: number; // virtual size\n maxCount: number; // real item count, where the last item\n sizes?: ViewSettingSizeProp;\n },\n currentSize = 0,\n) {\n const items: VirtualPositionItem[] = [];\n\n let index = opt.firstItemIndex;\n let size = currentSize;\n\n // max size or max count\n while (size <= opt.maxSize && index < opt.maxCount) {\n const newSize = getItemSize(index, opt.sizes, opt.origSize);\n items.push({\n start: opt.firstItemStart + size,\n end: opt.firstItemStart + size + newSize,\n itemIndex: index,\n size: newSize,\n });\n size += newSize;\n index++;\n }\n return items;\n}\n\n/**\n * Do batch items recombination\n * If items not overlapped with existing viewport returns null\n */\ntype RecombindDimensionData = Pick<\n DimensionSettingsState,\n 'sizes' | 'realSize' | 'originItemSize'\n>;\ntype RecombineOffsetData = {\n positiveDirection: boolean;\n} & ItemsToUpdate &\n RecombindDimensionData;\nexport function recombineByOffset(\n offset: number,\n data: RecombineOffsetData,\n): ItemsToUpdate | null {\n const newItems = [...data.items];\n const itemsCount = newItems.length;\n let newRange = {\n start: data.start,\n end: data.end,\n };\n\n // if offset out of revo-viewport, makes sense whole redraw\n if (offset > itemsCount) {\n return null;\n }\n\n // is direction of scroll positive\n if (data.positiveDirection) {\n // push item to the end\n let lastItem: VirtualPositionItem = getLastItem(data);\n\n let i = newRange.start;\n const length = i + offset;\n for (; i < length; i++) {\n const newIndex = lastItem.itemIndex + 1;\n const size = getItemSize(\n newIndex,\n data.sizes,\n data.originItemSize,\n );\n\n // if item overlapped limit break a loop\n if (lastItem.end + size > data.realSize) {\n break;\n }\n\n // new item index to recombine\n let newEnd = i % itemsCount;\n\n // item should always present, we do not create new item, we recombine them\n if (!newItems[newEnd]) {\n throw new Error('incorrect index');\n }\n\n // do recombination\n newItems[newEnd] = lastItem = {\n start: lastItem.end,\n end: lastItem.end + size,\n itemIndex: newIndex,\n size: size,\n };\n // update range\n newRange.start++;\n newRange.end = newEnd;\n }\n\n // direction is negative\n } else {\n // push item to the start\n let firstItem: VirtualPositionItem = getFirstItem(data);\n\n const end = newRange.end;\n for (let i = 0; i < offset; i++) {\n const newIndex = firstItem.itemIndex - 1;\n const size = getItemSize(\n newIndex,\n data.sizes,\n data.originItemSize,\n );\n\n // new item index to recombine\n let newStart = end - i;\n newStart = (newStart < 0 ? itemsCount + newStart : newStart) % itemsCount;\n\n // item should always present, we do not create new item, we recombine them\n if (!newItems[newStart]) {\n throw new Error('incorrect index');\n }\n\n // do recombination\n newItems[newStart] = firstItem = {\n start: firstItem.start - size,\n end: firstItem.start,\n itemIndex: newIndex,\n size: size,\n };\n // update range\n newRange.start = newStart;\n newRange.end--;\n }\n }\n const range = {\n start:\n (newRange.start < 0 ? itemsCount + newRange.start : newRange.start) %\n itemsCount,\n end:\n (newRange.end < 0 ? itemsCount + newRange.end : newRange.end) %\n itemsCount,\n };\n return {\n items: newItems,\n ...range,\n };\n}\n\nfunction getItemSize(\n index: number,\n sizes?: ViewSettingSizeProp,\n origSize = 0,\n): number {\n if (sizes && sizes[index]) {\n return sizes[index];\n }\n return origSize;\n}\n\n/**\n * Verify if position is in range of the PositionItem, start and end are included\n */\nexport function isActiveRange(\n pos: number,\n realSize: number,\n first?: PositionItem,\n last?: PositionItem,\n): boolean {\n if (!first || !last) {\n return false;\n }\n // if position is in range of first item\n // or position is after first item and last item is the last item in real size\n return (\n (pos >= first.start && pos <= first.end) ||\n (pos > first.end && last.end === realSize)\n );\n}\n\nexport function isActiveRangeOutsideLastItem(\n pos: number,\n virtualSize: number,\n firstItem?: PositionItem,\n lastItem?: PositionItem,\n) {\n // if no first item, means no items in viewport\n if (!firstItem) {\n return false;\n }\n return virtualSize + pos > lastItem?.end;\n}\n\nexport function getFirstItem(\n s: ItemsToUpdate,\n): VirtualPositionItem | undefined {\n return s.items[s.start];\n}\n\nexport function getLastItem(s: ItemsToUpdate): VirtualPositionItem {\n return s.items[s.end];\n}\n\n/**\n * Set items sizes from start index to end\n * @param vpItems\n * @param start\n * @param size\n * @param lastCoordinate\n * @returns\n */\nexport function setItemSizes(\n vpItems: VirtualPositionItem[],\n initialIndex: number,\n size: number,\n lastCoordinate: number,\n) {\n const items = [...vpItems];\n const count = items.length;\n\n let pos = lastCoordinate;\n let i = 0;\n let start = initialIndex;\n\n // viewport not inited\n if (!count) {\n return [];\n }\n // loop through array from initial item after recombination\n while (i < count) {\n const item = items[start];\n item.start = pos;\n item.size = size;\n item.end = item.start + size;\n pos = item.end;\n // loop by start index\n start++;\n i++;\n\n // if start index out of array, reset it\n if (start === count) {\n start = 0;\n }\n }\n return items;\n}\n","import {\n DimensionDataViewport,\n addMissingItems,\n getFirstItem,\n getLastItem,\n getUpdatedItemsByPosition,\n isActiveRange,\n setItemSizes,\n updateMissingAndRange,\n isActiveRangeOutsideLastItem,\n} from './viewport.helpers';\nimport { createStore } from '@stencil/store';\nimport { type Observable, setStore } from '../../utils/store.utils';\nimport type {\n VirtualPositionItem,\n ViewportStateItems,\n ViewportState,\n ViewSettingSizeProp,\n MultiDimensionType,\n} from '@type';\n\n/**\n * Viewport store\n * Used for virtualization (process of rendering only visible part of data)\n * Redraws viewport based on position and dimension\n */\nfunction initialState(): ViewportState {\n return {\n // virtual item information per rendered item\n items: [],\n // virtual dom item order to render\n start: 0,\n end: 0,\n\n // size of viewport in px\n virtualSize: 0,\n\n // total number of items\n realCount: 0,\n };\n}\n\n/**\n * Viewport store class\n */\nexport class ViewportStore {\n readonly store: Observable<ViewportState>;\n\n // last coordinate for store position restore\n private lastKnownScroll = 0;\n\n get lastCoordinate() {\n return this.lastKnownScroll;\n }\n set lastCoordinate(value: number) {\n this.lastKnownScroll = value;\n }\n constructor(readonly type: MultiDimensionType) {\n this.store = createStore(initialState());\n // drop items on real size change, require a new item set\n this.store.onChange('realCount', () => this.clearItems());\n // drop items on virtual size change, require a new item set\n this.store.onChange('virtualSize', () => this.clearItems());\n }\n\n /**\n * Render viewport based on coordinate\n * It's the main method for draw\n */\n setViewPortCoordinate(position: number, dimension: DimensionDataViewport) {\n const viewportSize = this.store.get('virtualSize');\n // no visible data to calculate\n if (!viewportSize) {\n return;\n }\n\n const frameOffset = 1;\n const singleOffsetInPx = dimension.originItemSize * frameOffset;\n // add offset to virtual size from both sides\n const outsize = singleOffsetInPx * 2;\n // math virtual size is based on visible area + 2 items outside of visible area\n const virtualSize = viewportSize + outsize;\n\n // expected no scroll if real size less than virtual size, position is 0\n let maxCoordinate = 0;\n // if there is nodes outside of viewport, max coordinate has to be adjusted\n if (dimension.realSize > viewportSize) {\n // max coordinate is real size minus virtual/rendered space\n maxCoordinate = dimension.realSize - viewportSize - singleOffsetInPx;\n }\n\n let pos = position;\n // limit position to max and min coordinates\n if (pos < 0) {\n pos = 0;\n } else if (pos > maxCoordinate) {\n pos = maxCoordinate;\n }\n\n // store last coordinate for further restore on redraw\n this.lastCoordinate = pos;\n\n // actual position is less than first item start based on offset\n pos -= singleOffsetInPx;\n pos = pos < 0 ? 0 : pos < maxCoordinate ? pos : maxCoordinate;\n\n const allItems = this.getItems();\n const items = [...allItems.items];\n\n const firstItem: VirtualPositionItem | undefined = getFirstItem(allItems);\n const lastItem: VirtualPositionItem | undefined = getLastItem(allItems);\n\n let toUpdate: Partial<ViewportState> = {};\n\n // left position changed\n // verify if new position is in range of previously rendered first item\n if (!isActiveRange(pos, dimension.realSize, firstItem, lastItem)) {\n toUpdate = {\n ...toUpdate,\n ...getUpdatedItemsByPosition(\n pos,\n allItems,\n this.store.get('realCount'),\n virtualSize,\n dimension,\n ),\n };\n this.setViewport({ ...toUpdate });\n // verify is render area is outside of last item\n } else if (\n isActiveRangeOutsideLastItem(pos, virtualSize, firstItem, lastItem)\n ) {\n // check is any item missing for full fill content\n const missing = addMissingItems(\n firstItem,\n this.store.get('realCount'),\n virtualSize + pos - firstItem.start,\n allItems,\n {\n sizes: dimension.sizes,\n originItemSize: dimension.originItemSize,\n },\n );\n\n // update missing items\n if (missing.length) {\n const range = {\n start: this.store.get('start'),\n end: this.store.get('end'),\n };\n updateMissingAndRange(items, missing, range);\n toUpdate = {\n ...toUpdate,\n items: [...items],\n ...range,\n };\n this.setViewport({ ...toUpdate });\n }\n }\n }\n\n /**\n * Update viewport sizes for existing items\n * This method is generating new item positions based on custom sizes and original sizes\n * @param sizes - custom sizes for each item\n * @param dropToOriginalSize - drop to original size if requested\n */\n setViewPortDimensionSizes(\n sizes: ViewSettingSizeProp,\n dropToOriginalSize?: number,\n ) {\n let items = [...this.store.get('items')];\n const count = items.length;\n // viewport not inited\n if (!count) {\n return;\n }\n\n let changedCoordinate = 0;\n let i = 0;\n let start = this.store.get('start');\n\n // drop to original size if requested\n if (dropToOriginalSize) {\n const allItems = this.getItems();\n const firstItem: VirtualPositionItem | undefined = getFirstItem(allItems);\n items = setItemSizes(items, start, dropToOriginalSize, firstItem.start);\n }\n\n // loop through array from initial item after recombination\n // if size change present, change position for all items after\n while (i < count) {\n const item = items[start];\n // change pos if size change present before\n if (changedCoordinate) {\n item.start += changedCoordinate;\n item.end += changedCoordinate;\n }\n // check if size change present\n const size: number | undefined = sizes[item.itemIndex];\n // size found\n if (size) {\n const changedSize = size - item.size;\n changedCoordinate += changedSize;\n item.size = size;\n item.end = item.start + size;\n // size lost\n }\n\n // loop by start index\n start++;\n i++;\n // if start index out of array, reset it\n if (start === count) {\n start = 0;\n }\n }\n\n this.setViewport({ items: [...items] });\n }\n\n /**\n * Set sizes for existing items\n */\n setOriginalSizes(size: number) {\n const items = this.store.get('items');\n const count = items.length;\n // viewport not inited\n if (!count) {\n return;\n }\n\n setStore(this.store, {\n items: setItemSizes(\n items,\n this.store.get('start'),\n size,\n this.lastCoordinate,\n ),\n });\n }\n\n getItems(): Pick<ViewportStateItems, 'items' | 'start' | 'end'> {\n return {\n items: this.store.get('items'),\n start: this.store.get('start'),\n end: this.store.get('end'),\n };\n }\n\n setViewport(data: Partial<ViewportState>) {\n setStore(this.store, data);\n }\n\n clearItems() {\n this.store.set('items', []);\n }\n}\n"],"version":3}
1
+ {"file":"viewport.store-122731a5.js","mappings":";;;;;AAsBA;;;;;SAKgB,yBAAyB,CACvC,GAAW;AACX,KAAQ,EACR,SAAiB,EACjB,WAAmB,EACnB,SAAgC;IAEhC,MAAM,UAAU,GAAiB,iBAAiB,CAAC,SAAS,EAAE,GAAG,CAAC,CAAC;IACnE,MAAM,SAAS,GAAiB,YAAY,CAAC,KAAK,CAAC,CAAC;IACpD,IAAI,QAAuB,CAAC;;IAE5B,IAAI,SAAS,EAAE;QACb,IAAI,kBAAkB,GAAG,UAAU,CAAC,SAAS,IAAI,SAAS,CAAC,SAAS,IAAI,CAAC,CAAC,CAAC;;QAE3E,IAAI,kBAAkB,EAAE;;YAEtB,QAAQ,GAAG,iBAAiB,CAAC,IAAI,CAAC,GAAG,CAAC,kBAAkB,CAAC,gCACvD,iBAAiB,EAAE,kBAAkB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C;gBACjB,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;;aAE9B;;YAGD,KAAK,EAAE,CAAC;YACR,CAAC,EAAE,CAAC;;YAEJ,IAAI,KAAK,KAAK,KAAK,EAAE;gBACnB,KAAK,GAAG,CAAC,CAAC;aACX;SACF;QAED,IAAI,CAAC,WAAW,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,KAAK,CAAC,EAAE,CAAC,CAAC;KACzC;;;;IAKD,gBAAgB,CAAC,IAAY;QAC3B,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;QACtC,MAAM,KAAK,GAAG,KAAK,CAAC,MAAM,CAAC;;QAE3B,IAAI,CAAC,KAAK,EAAE;YACV,OAAO;SACR;QAED,QAAQ,CAAC,IAAI,CAAC,KAAK,EAAE;YACnB,KAAK,EAAE,YAAY,CACjB,KAAK,EACL,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,EACvB,IAAI,EACJ,IAAI,CAAC,cAAc,CACpB;SACF,CAAC,CAAC;KACJ;IAED,QAAQ;QACN,OAAO;YACL,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC;YAC9B,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC;YAC9B,GAAG,EAAE,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC;SAC3B,CAAC;KACH;IAED,WAAW,CAAC,IAA4B;QACtC,QAAQ,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;KAC5B;IAED,UAAU;QACR,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;KAC7B;;;;;","names":[],"sources":["src/store/vp/viewport.helpers.ts","src/store/vp/viewport.store.ts"],"sourcesContent":["import {\n DimensionSettingsState,\n PositionItem,\n ViewSettingSizeProp,\n ViewportStateItems,\n VirtualPositionItem,\n Range,\n} from '@type';\n\nimport { getItemByPosition } from '../dimension/dimension.helpers';\n\nexport type DimensionDataViewport = Pick<\n DimensionSettingsState,\n | 'indexes'\n | 'positionIndexes'\n | 'positionIndexToItem'\n | 'sizes'\n | 'originItemSize'\n | 'realSize'\n>;\n\ntype ItemsToUpdate = Pick<ViewportStateItems, 'items' | 'start' | 'end'>;\n/**\n * Update items based on new scroll position\n * If viewport wasn't changed fully simple recombination of positions\n * Otherwise rebuild viewport items\n */\nexport function getUpdatedItemsByPosition<T extends ItemsToUpdate>(\n pos: number, // coordinate\n items: T,\n realCount: number,\n virtualSize: number,\n dimension: DimensionDataViewport,\n): ItemsToUpdate {\n const activeItem: PositionItem = getItemByPosition(dimension, pos);\n const firstItem: PositionItem = getFirstItem(items);\n let toUpdate: ItemsToUpdate;\n // do simple position recombination if items already present in viewport\n if (firstItem) {\n let changedOffsetStart = activeItem.itemIndex - (firstItem.itemIndex || 0);\n // if item changed\n if (changedOffsetStart) {\n // simple recombination\n toUpdate = recombineByOffset(Math.abs(changedOffsetStart), {\n positiveDirection: changedOffsetStart > -1,\n ...dimension,\n ...items,\n });\n }\n }\n\n const maxSizeVirtualSize = getMaxVirtualSize(\n virtualSize,\n dimension.realSize,\n activeItem,\n );\n // if partial recombination add items if revo-viewport has some space left\n if (toUpdate) {\n const extra = addMissingItems(\n activeItem,\n realCount,\n maxSizeVirtualSize,\n toUpdate,\n dimension,\n );\n if (extra.length) {\n updateMissingAndRange(toUpdate.items, extra, toUpdate);\n }\n }\n\n // new collection if no items after replacement full replacement\n if (!toUpdate) {\n const items = getItems({\n firstItemStart: activeItem.start,\n firstItemIndex: activeItem.itemIndex,\n origSize: dimension.originItemSize,\n maxSize: maxSizeVirtualSize,\n maxCount: realCount,\n sizes: dimension.sizes,\n });\n\n // range now comes from 0 to length - 1\n toUpdate = {\n items,\n start: 0,\n end: items.length - 1,\n };\n }\n return toUpdate;\n}\n\n// virtual size can differ based on scroll position if some big items are present\n// scroll can be in the middle of item and virtual size will be larger\n// so we need to exclude this part from virtual size hence it's already passed\nfunction getMaxVirtualSize(\n virtualSize: number,\n realSize: number,\n activeItem: PositionItem,\n) {\n return Math.min(virtualSize + (activeItem.end - activeItem.start), realSize);\n}\n\nexport function updateMissingAndRange(\n items: VirtualPositionItem[],\n missing: VirtualPositionItem[],\n range: Range,\n) {\n items.splice(range.end + 1, 0, ...missing);\n // update range if start larger after recombination\n if (\n range.start >= range.end &&\n !(range.start === range.end && range.start === 0)\n ) {\n range.start += missing.length;\n }\n range.end += missing.length;\n}\n\n/**\n * If partial replacement\n * this function adds items if viewport has some space left\n */\nexport function addMissingItems<T extends ItemsToUpdate>(\n firstItem: PositionItem,\n realCount: number,\n virtualSize: number,\n existingCollection: T,\n dimension: Pick<DimensionSettingsState, 'sizes' | 'originItemSize'>,\n): VirtualPositionItem[] {\n const lastItem: VirtualPositionItem = getLastItem(existingCollection);\n const items = getItems({\n sizes: dimension.sizes,\n firstItemStart: lastItem.end,\n firstItemIndex: lastItem.itemIndex + 1,\n origSize: dimension.originItemSize,\n maxSize: virtualSize - (lastItem.end - firstItem.start),\n maxCount: realCount,\n });\n return items;\n}\n\n/**\n * Get wiewport items parameters\n * caching position and calculating items count in viewport\n */\nexport function getItems(\n opt: {\n firstItemIndex: number;\n firstItemStart: number;\n origSize: number;\n maxSize: number; // virtual size\n maxCount: number; // real item count, where the last item\n sizes?: ViewSettingSizeProp;\n },\n currentSize = 0,\n) {\n const items: VirtualPositionItem[] = [];\n\n let index = opt.firstItemIndex;\n let size = currentSize;\n\n // max size or max count\n while (size <= opt.maxSize && index < opt.maxCount) {\n const newSize = getItemSize(index, opt.sizes, opt.origSize);\n items.push({\n start: opt.firstItemStart + size,\n end: opt.firstItemStart + size + newSize,\n itemIndex: index,\n size: newSize,\n });\n size += newSize;\n index++;\n }\n return items;\n}\n\n/**\n * Do batch items recombination\n * If items not overlapped with existing viewport returns null\n */\ntype RecombindDimensionData = Pick<\n DimensionSettingsState,\n 'sizes' | 'realSize' | 'originItemSize'\n>;\ntype RecombineOffsetData = {\n positiveDirection: boolean;\n} & ItemsToUpdate &\n RecombindDimensionData;\nexport function recombineByOffset(\n offset: number,\n data: RecombineOffsetData,\n): ItemsToUpdate | null {\n const newItems = [...data.items];\n const itemsCount = newItems.length;\n let newRange = {\n start: data.start,\n end: data.end,\n };\n\n // if offset out of revo-viewport, makes sense whole redraw\n if (offset > itemsCount) {\n return null;\n }\n\n // is direction of scroll positive\n if (data.positiveDirection) {\n // push item to the end\n let lastItem: VirtualPositionItem = getLastItem(data);\n\n let i = newRange.start;\n const length = i + offset;\n for (; i < length; i++) {\n const newIndex = lastItem.itemIndex + 1;\n const size = getItemSize(\n newIndex,\n data.sizes,\n data.originItemSize,\n );\n\n // if item overlapped limit break a loop\n if (lastItem.end + size > data.realSize) {\n break;\n }\n\n // new item index to recombine\n let newEnd = i % itemsCount;\n\n // item should always present, we do not create new item, we recombine them\n if (!newItems[newEnd]) {\n throw new Error('incorrect index');\n }\n\n // do recombination\n newItems[newEnd] = lastItem = {\n start: lastItem.end,\n end: lastItem.end + size,\n itemIndex: newIndex,\n size: size,\n };\n // update range\n newRange.start++;\n newRange.end = newEnd;\n }\n\n // direction is negative\n } else {\n // push item to the start\n let firstItem: VirtualPositionItem = getFirstItem(data);\n\n const end = newRange.end;\n for (let i = 0; i < offset; i++) {\n const newIndex = firstItem.itemIndex - 1;\n const size = getItemSize(\n newIndex,\n data.sizes,\n data.originItemSize,\n );\n\n // new item index to recombine\n let newStart = end - i;\n newStart = (newStart < 0 ? itemsCount + newStart : newStart) % itemsCount;\n\n // item should always present, we do not create new item, we recombine them\n if (!newItems[newStart]) {\n throw new Error('incorrect index');\n }\n\n // do recombination\n newItems[newStart] = firstItem = {\n start: firstItem.start - size,\n end: firstItem.start,\n itemIndex: newIndex,\n size: size,\n };\n // update range\n newRange.start = newStart;\n newRange.end--;\n }\n }\n const range = {\n start:\n (newRange.start < 0 ? itemsCount + newRange.start : newRange.start) %\n itemsCount,\n end:\n (newRange.end < 0 ? itemsCount + newRange.end : newRange.end) %\n itemsCount,\n };\n return {\n items: newItems,\n ...range,\n };\n}\n\nfunction getItemSize(\n index: number,\n sizes?: ViewSettingSizeProp,\n origSize = 0,\n): number {\n if (sizes && sizes[index]) {\n return sizes[index];\n }\n return origSize;\n}\n\n/**\n * Verify if position is in range of the PositionItem, start and end are included\n */\nexport function isActiveRange(\n pos: number,\n realSize: number,\n first?: PositionItem,\n last?: PositionItem,\n): boolean {\n if (!first || !last) {\n return false;\n }\n // if position is in range of first item\n // or position is after first item and last item is the last item in real size\n return (\n (pos >= first.start && pos <= first.end) ||\n (pos > first.end && last.end === realSize)\n );\n}\n\nexport function isActiveRangeOutsideLastItem(\n pos: number,\n virtualSize: number,\n firstItem?: PositionItem,\n lastItem?: PositionItem,\n) {\n // if no first item, means no items in viewport\n if (!firstItem) {\n return false;\n }\n return virtualSize + pos > lastItem?.end;\n}\n\nexport function getFirstItem(\n s: ItemsToUpdate,\n): VirtualPositionItem | undefined {\n return s.items[s.start];\n}\n\nexport function getLastItem(s: ItemsToUpdate): VirtualPositionItem {\n return s.items[s.end];\n}\n\n/**\n * Set items sizes from start index to end\n * @param vpItems\n * @param start\n * @param size\n * @param lastCoordinate\n * @returns\n */\nexport function setItemSizes(\n vpItems: VirtualPositionItem[],\n initialIndex: number,\n size: number,\n lastCoordinate: number,\n) {\n const items = [...vpItems];\n const count = items.length;\n\n let pos = lastCoordinate;\n let i = 0;\n let start = initialIndex;\n\n // viewport not inited\n if (!count) {\n return [];\n }\n // loop through array from initial item after recombination\n while (i < count) {\n const item = items[start];\n item.start = pos;\n item.size = size;\n item.end = item.start + size;\n pos = item.end;\n // loop by start index\n start++;\n i++;\n\n // if start index out of array, reset it\n if (start === count) {\n start = 0;\n }\n }\n return items;\n}\n","import {\n DimensionDataViewport,\n addMissingItems,\n getFirstItem,\n getLastItem,\n getUpdatedItemsByPosition,\n isActiveRange,\n setItemSizes,\n updateMissingAndRange,\n isActiveRangeOutsideLastItem,\n} from './viewport.helpers';\nimport { createStore } from '@stencil/store';\nimport { type Observable, setStore } from '../../utils/store.utils';\nimport type {\n VirtualPositionItem,\n ViewportStateItems,\n ViewportState,\n ViewSettingSizeProp,\n MultiDimensionType,\n} from '@type';\n\n/**\n * Viewport store\n * Used for virtualization (process of rendering only visible part of data)\n * Redraws viewport based on position and dimension\n */\nfunction initialState(): ViewportState {\n return {\n // virtual item information per rendered item\n items: [],\n // virtual dom item order to render\n start: 0,\n end: 0,\n\n // size of viewport in px\n virtualSize: 0,\n\n // total number of items\n realCount: 0,\n };\n}\n\n/**\n * Viewport store class\n */\nexport class ViewportStore {\n readonly store: Observable<ViewportState>;\n\n // last coordinate for store position restore\n private lastKnownScroll = 0;\n\n get lastCoordinate() {\n return this.lastKnownScroll;\n }\n set lastCoordinate(value: number) {\n this.lastKnownScroll = value;\n }\n constructor(readonly type: MultiDimensionType) {\n this.store = createStore(initialState());\n // drop items on real size change, require a new item set\n this.store.onChange('realCount', () => this.clearItems());\n // drop items on virtual size change, require a new item set\n this.store.onChange('virtualSize', () => this.clearItems());\n }\n\n /**\n * Render viewport based on coordinate\n * It's the main method for draw\n */\n setViewPortCoordinate(position: number, dimension: DimensionDataViewport) {\n const viewportSize = this.store.get('virtualSize');\n // no visible data to calculate\n if (!viewportSize) {\n return;\n }\n\n const frameOffset = 1;\n const singleOffsetInPx = dimension.originItemSize * frameOffset;\n // add offset to virtual size from both sides\n const outsize = singleOffsetInPx * 2;\n // math virtual size is based on visible area + 2 items outside of visible area\n const virtualSize = viewportSize + outsize;\n\n // expected no scroll if real size less than virtual size, position is 0\n let maxCoordinate = 0;\n // if there is nodes outside of viewport, max coordinate has to be adjusted\n if (dimension.realSize > viewportSize) {\n // max coordinate is real size minus virtual/rendered space\n maxCoordinate = dimension.realSize - viewportSize - singleOffsetInPx;\n }\n\n let pos = position;\n // limit position to max and min coordinates\n if (pos < 0) {\n pos = 0;\n } else if (pos > maxCoordinate) {\n pos = maxCoordinate;\n }\n\n // store last coordinate for further restore on redraw\n this.lastCoordinate = pos;\n\n // actual position is less than first item start based on offset\n pos -= singleOffsetInPx;\n pos = pos < 0 ? 0 : pos < maxCoordinate ? pos : maxCoordinate;\n\n const allItems = this.getItems();\n const items = [...allItems.items];\n\n const firstItem: VirtualPositionItem | undefined = getFirstItem(allItems);\n const lastItem: VirtualPositionItem | undefined = getLastItem(allItems);\n\n let toUpdate: Partial<ViewportState> = {};\n\n // left position changed\n // verify if new position is in range of previously rendered first item\n if (!isActiveRange(pos, dimension.realSize, firstItem, lastItem)) {\n toUpdate = {\n ...toUpdate,\n ...getUpdatedItemsByPosition(\n pos,\n allItems,\n this.store.get('realCount'),\n virtualSize,\n dimension,\n ),\n };\n this.setViewport({ ...toUpdate });\n // verify is render area is outside of last item\n } else if (\n isActiveRangeOutsideLastItem(pos, virtualSize, firstItem, lastItem)\n ) {\n // check is any item missing for full fill content\n const missing = addMissingItems(\n firstItem,\n this.store.get('realCount'),\n virtualSize + pos - firstItem.start,\n allItems,\n {\n sizes: dimension.sizes,\n originItemSize: dimension.originItemSize,\n },\n );\n\n // update missing items\n if (missing.length) {\n const range = {\n start: this.store.get('start'),\n end: this.store.get('end'),\n };\n updateMissingAndRange(items, missing, range);\n toUpdate = {\n ...toUpdate,\n items: [...items],\n ...range,\n };\n this.setViewport({ ...toUpdate });\n }\n }\n }\n\n /**\n * Update viewport sizes for existing items\n * This method is generating new item positions based on custom sizes and original sizes\n * @param sizes - custom sizes for each item\n * @param dropToOriginalSize - drop to original size if requested\n */\n setViewPortDimensionSizes(\n sizes: ViewSettingSizeProp,\n dropToOriginalSize?: number,\n ) {\n let items = [...this.store.get('items')];\n const count = items.length;\n // viewport not inited\n if (!count) {\n return;\n }\n\n let changedCoordinate = 0;\n let i = 0;\n let start = this.store.get('start');\n\n // drop to original size if requested\n if (dropToOriginalSize) {\n const allItems = this.getItems();\n const firstItem: VirtualPositionItem | undefined = getFirstItem(allItems);\n items = setItemSizes(items, start, dropToOriginalSize, firstItem.start);\n }\n\n // loop through array from initial item after recombination\n // if size change present, change position for all items after\n while (i < count) {\n const item = items[start];\n // change pos if size change present before\n if (changedCoordinate) {\n item.start += changedCoordinate;\n item.end += changedCoordinate;\n }\n // check if size change present\n const size: number | undefined = sizes[item.itemIndex];\n // size found\n if (size) {\n const changedSize = size - item.size;\n changedCoordinate += changedSize;\n item.size = size;\n item.end = item.start + size;\n // size lost\n }\n\n // loop by start index\n start++;\n i++;\n // if start index out of array, reset it\n if (start === count) {\n start = 0;\n }\n }\n\n this.setViewport({ items: [...items] });\n }\n\n /**\n * Set sizes for existing items\n */\n setOriginalSizes(size: number) {\n const items = this.store.get('items');\n const count = items.length;\n // viewport not inited\n if (!count) {\n return;\n }\n\n setStore(this.store, {\n items: setItemSizes(\n items,\n this.store.get('start'),\n size,\n this.lastCoordinate,\n ),\n });\n }\n\n getItems(): Pick<ViewportStateItems, 'items' | 'start' | 'end'> {\n return {\n items: this.store.get('items'),\n start: this.store.get('start'),\n end: this.store.get('end'),\n };\n }\n\n setViewport(data: Partial<ViewportState>) {\n setStore(this.store, data);\n }\n\n clearItems() {\n this.store.set('items', []);\n }\n}\n"],"version":3}
@@ -1,5 +1,5 @@
1
1
  /*!
2
2
  * Built by Revolist OU ❤️
3
3
  */
4
- import{k as t,r as e,l as s,h as i,m as n}from"./dimension.helpers-c0c2888f.js";import"./toNumber-8de324a7.js";import"./index-e661aeb5.js";const o=t=>{let e={};const s=(s,i)=>{const o=Object.assign({},s);e={};n(i,((t,s)=>{if(t&&o[s]){e[s]=o[s];delete o[s]}}));t.setDimensionSize(o)};return{set(i,n){switch(i){case"trimmed":const i=n;const o=t.store.get("sizes");s(Object.assign(Object.assign({},o),e),i);break}}}};const r=t=>({set(e){switch(e){case"count":case"sizes":case"originItemSize":let e=0;const s=t.store.get("count");for(let i=0;i<s;i++){e+=t.store.get("sizes")[i]||t.store.get("originItemSize")}t.setStore({realSize:e})}}});function c(){return{indexes:[],count:0,trimmed:{},sizes:{},positionIndexToItem:{},indexToItem:{},positionIndexes:[]}}function a(){return Object.assign(Object.assign({},c()),{realSize:0,originItemSize:0})}class h{constructor(){this.store=t(a());this.store.use(o(this));this.store.use(r(this))}getCurrentState(){const t=a();const s=Object.keys(t);return e(s,((t,e)=>{const s=this.store.get(e);t[e]=s;return t}),t)}dispose(){s(this.store,a())}setStore(t){s(this.store,t)}drop(){s(this.store,c())}setDimensionSize(t){const e=i(this.store.get("originItemSize"),t);s(this.store,e)}}const d=["rowPinStart","rgRow","rowPinEnd"];const l=["colPinStart","rgCol","colPinEnd"];function u(t){return d.indexOf(t)>-1}class m{constructor(t,e){this.revogrid=t;this.providers=e;this.subscriptions={}}addEventListener(t,e){this.revogrid.addEventListener(t,e);this.subscriptions[t]=e}watch(t,e,{immediate:s}={immediate:false}){const i=Object.getOwnPropertyDescriptor(this.revogrid,t)||Object.getOwnPropertyDescriptor(this.revogrid.constructor.prototype,t);Object.defineProperty(this.revogrid,t,{set(t){var s;const n=e(t);if(n===false){return}return(s=i===null||i===void 0?void 0:i.set)===null||s===void 0?void 0:s.call(this,t)},get(){var t;return(t=i===null||i===void 0?void 0:i.get)===null||t===void 0?void 0:t.call(this)}});if(s){e(i===null||i===void 0?void 0:i.value)}}removeEventListener(t){this.revogrid.removeEventListener(t,this.subscriptions[t]);delete this.subscriptions[t]}emit(t,e){const s=new CustomEvent(t,{detail:e,cancelable:true});this.revogrid.dispatchEvent(s);return s}clearSubscriptions(){for(let t in this.subscriptions){this.removeEventListener(t)}}destroy(){this.clearSubscriptions()}}export{m as B,h as D,l as c,u as i,d as r};
5
- //# sourceMappingURL=base.plugin-e6e2bac2.js.map
4
+ import{l as t,r as e,k as s,h as i,m as n}from"./dimension.helpers-7c71178f.js";import"./toNumber-8de324a7.js";import"./index-e661aeb5.js";const o=t=>{let e={};const s=(s,i)=>{const o=Object.assign({},s);e={};n(i,((t,s)=>{if(t&&o[s]){e[s]=o[s];delete o[s]}}));t.setDimensionSize(o)};return{set(i,n){switch(i){case"trimmed":const i=n;const o=t.store.get("sizes");s(Object.assign(Object.assign({},o),e),i);break}}}};const r=t=>({set(e){switch(e){case"count":case"sizes":case"originItemSize":let e=0;const s=t.store.get("count");for(let i=0;i<s;i++){e+=t.store.get("sizes")[i]||t.store.get("originItemSize")}t.setStore({realSize:e})}}});function c(){return{indexes:[],count:0,trimmed:{},sizes:{},positionIndexToItem:{},indexToItem:{},positionIndexes:[]}}function a(){return Object.assign(Object.assign({},c()),{realSize:0,originItemSize:0})}class h{constructor(){this.store=t(a());this.store.use(o(this));this.store.use(r(this))}getCurrentState(){const t=a();const s=Object.keys(t);return e(s,((t,e)=>{const s=this.store.get(e);t[e]=s;return t}),t)}dispose(){s(this.store,a())}setStore(t){s(this.store,t)}drop(){s(this.store,c())}setDimensionSize(t){const e=i(this.store.get("originItemSize"),t);s(this.store,e)}}const d=["rowPinStart","rgRow","rowPinEnd"];const l=["colPinStart","rgCol","colPinEnd"];function u(t){return d.indexOf(t)>-1}class m{constructor(t,e){this.revogrid=t;this.providers=e;this.subscriptions={}}addEventListener(t,e){this.revogrid.addEventListener(t,e);this.subscriptions[t]=e}watch(t,e,{immediate:s}={immediate:false}){const i=Object.getOwnPropertyDescriptor(this.revogrid,t)||Object.getOwnPropertyDescriptor(this.revogrid.constructor.prototype,t);Object.defineProperty(this.revogrid,t,{set(t){var s;const n=e(t);if(n===false){return}return(s=i===null||i===void 0?void 0:i.set)===null||s===void 0?void 0:s.call(this,t)},get(){var t;return(t=i===null||i===void 0?void 0:i.get)===null||t===void 0?void 0:t.call(this)}});if(s){e(i===null||i===void 0?void 0:i.value)}}removeEventListener(t){this.revogrid.removeEventListener(t,this.subscriptions[t]);delete this.subscriptions[t]}emit(t,e){const s=new CustomEvent(t,{detail:e,cancelable:true});this.revogrid.dispatchEvent(s);return s}clearSubscriptions(){for(let t in this.subscriptions){this.removeEventListener(t)}}destroy(){this.clearSubscriptions()}}export{m as B,h as D,l as c,u as i,d as r};
5
+ //# sourceMappingURL=base.plugin-30463006.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["trimmedPlugin","store","trimmedSize","setTrimmed","sizes","trimmed","newSize","Object","assign","each","v","index","setDimensionSize","set","key","val","trim","get","realSizePlugin","k","realSize","count","i","setStore","initialBase","indexes","positionIndexToItem","indexToItem","positionIndexes","initialState","originItemSize","DimensionStore","constructor","this","createStore","use","getCurrentState","state","keys","reduce","r","data","dispose","drop","dimensionData","calculateDimensionData","rowTypes","columnTypes","isRowType","type","indexOf","BasePlugin","revogrid","providers","subscriptions","addEventListener","eventName","callback","watch","prop","immediate","nativeValueDesc","getOwnPropertyDescriptor","prototype","defineProperty","keepDefault","_a","call","value","removeEventListener","emit","detail","event","CustomEvent","cancelable","dispatchEvent","clearSubscriptions","destroy"],"sources":["src/store/dimension/dimension.store.ts","src/store/index.ts","src/plugins/base.plugin.ts"],"sourcesContent":["/**\n * Storing pre-calculated\n * Dimension information and sizes\n */\nimport reduce from 'lodash/reduce';\nimport { createStore } from '@stencil/store';\n\nimport { setStore, Observable, PluginSubscribe } from '../../utils/store.utils';\nimport { calculateDimensionData } from './dimension.helpers';\nimport each from 'lodash/each';\nimport {\n DimensionCalc,\n DimensionSettingsState,\n ViewSettingSizeProp,\n MultiDimensionType,\n} from '@type';\n\nexport type DimensionStoreCollection = {\n [T in MultiDimensionType]: DimensionStore;\n};\n\ntype Item = keyof DimensionSettingsState;\n\nconst trimmedPlugin = (\n store: DimensionStore,\n): PluginSubscribe<DimensionSettingsState> => {\n let trimmedSize: DimensionSettingsState['sizes'] = {};\n\n const setTrimmed = (\n sizes: DimensionSettingsState['sizes'],\n trimmed: DimensionSettingsState['trimmed'],\n ) => {\n const newSize = { ...sizes };\n trimmedSize = {};\n each(trimmed, (v, index) => {\n if (v && newSize[index]) {\n trimmedSize[index] = newSize[index];\n delete newSize[index];\n }\n });\n store.setDimensionSize(newSize);\n };\n return {\n set(key, val) {\n switch (key) {\n case 'trimmed':\n const trim = val as DimensionSettingsState['trimmed'];\n const sizes = store.store.get('sizes');\n // recover trimmed, apply new trim\n setTrimmed({ ...sizes, ...trimmedSize }, trim);\n break;\n }\n },\n };\n};\n\nconst realSizePlugin = (\n store: DimensionStore,\n): PluginSubscribe<DimensionSettingsState> => {\n return {\n set(k) {\n switch (k) {\n case 'count':\n case 'sizes':\n case 'originItemSize':\n let realSize = 0;\n const count = store.store.get('count');\n for (let i = 0; i < count; i++) {\n realSize +=\n store.store.get('sizes')[i] || store.store.get('originItemSize');\n }\n store.setStore({ realSize });\n }\n },\n };\n};\n\nfunction initialBase(): DimensionCalc {\n return {\n indexes: [],\n count: 0,\n\n // plugin support\n trimmed: {},\n\n // size operations, this provider stores only changed sizes, not all of them\n // same as indexes but for sizes and positions\n // item index to size\n sizes: {},\n // order in indexes[] to coordinate\n positionIndexToItem: {},\n // initial element to coordinate ^\n indexToItem: {},\n positionIndexes: [],\n };\n}\n\nfunction initialState(): DimensionSettingsState {\n return {\n ...initialBase(),\n // size which all items can take\n realSize: 0,\n\n // initial item size if it wasn't changed\n originItemSize: 0,\n };\n}\n\nexport class DimensionStore {\n readonly store: Observable<DimensionSettingsState>;\n constructor() {\n this.store = createStore(initialState());\n this.store.use(trimmedPlugin(this));\n this.store.use(realSizePlugin(this));\n }\n\n getCurrentState(): DimensionSettingsState {\n const state = initialState();\n const keys = Object.keys(state);\n return reduce(\n keys,\n (r: DimensionSettingsState, k: Item) => {\n const data = this.store.get(k);\n r[k] = data as never;\n return r;\n },\n state,\n );\n }\n\n dispose() {\n setStore(this.store, initialState());\n }\n\n setStore<T extends Record<string, any>>(data: Partial<T>) {\n setStore(this.store, data);\n }\n\n drop() {\n setStore(this.store, initialBase());\n }\n\n /**\n * Set custom dimension sizes and overwrite old\n * Generates new indexes based on sizes\n * @param sizes - sizes to set\n */\n setDimensionSize(sizes: ViewSettingSizeProp) {\n const dimensionData = calculateDimensionData(\n this.store.get('originItemSize'),\n sizes,\n );\n setStore(this.store, dimensionData);\n }\n}\n","import type { DimensionCols, DimensionRows } from '@type';\n\nexport * from './dataSource';\nexport * from './dimension';\nexport * from './selection';\nexport * from './vp';\n\nexport const rowTypes: DimensionRows[] = ['rowPinStart', 'rgRow', 'rowPinEnd'];\nexport const columnTypes: DimensionCols[] = [\n 'colPinStart',\n 'rgCol',\n 'colPinEnd',\n];\n\nexport function isRowType(type: DimensionRows | any): type is DimensionRows {\n return rowTypes.indexOf(type) > -1;\n}\n","import { PluginProviders, PluginBaseComponent } from '..';\n\ntype WatchConfig = { immediate: boolean };\n\n/**\n * Base layer for plugins\n * Provide minimal starting core for plugins to work\n * Extend this class to create plugin\n */\nexport class BasePlugin implements PluginBaseComponent {\n readonly subscriptions: Record<string, (...args: any[]) => void> = {};\n constructor(public revogrid: HTMLRevoGridElement, public providers: PluginProviders) {}\n /**\n *\n * @param eventName - event name to subscribe to in revo-grid component (e.g. 'beforeheaderclick')\n * @param callback - callback function for event\n */\n addEventListener(\n eventName: string,\n callback: (e: CustomEvent) => void,\n ) {\n this.revogrid.addEventListener(eventName, callback);\n this.subscriptions[eventName] = callback;\n }\n\n /**\n * Subscribe to property change in revo-grid component\n * You can return false in callback to prevent default value set\n *\n * @param prop - property name\n * @param callback - callback function\n * @param immediate - trigger callback immediately with current value\n */\n watch<T extends any>(\n prop: string,\n callback: (arg: T) => boolean | void,\n { immediate }: Partial<WatchConfig> = { immediate: false },\n ) {\n const nativeValueDesc =\n Object.getOwnPropertyDescriptor(this.revogrid, prop) ||\n Object.getOwnPropertyDescriptor(this.revogrid.constructor.prototype, prop);\n\n // Overwrite property descriptor for this instance\n Object.defineProperty(this.revogrid, prop, {\n set(val: T) {\n const keepDefault = callback(val);\n if (keepDefault === false) {\n return;\n }\n // Continue with native behavior\n return nativeValueDesc?.set?.call(this, val);\n },\n get() {\n // Continue with native behavior\n return nativeValueDesc?.get?.call(this);\n },\n });\n if (immediate) {\n callback(nativeValueDesc?.value);\n }\n }\n\n /**\n * Remove event listener\n * @param eventName\n */\n removeEventListener(eventName: string) {\n this.revogrid.removeEventListener(eventName, this.subscriptions[eventName]);\n delete this.subscriptions[eventName];\n }\n\n /**\n * Emit event from revo-grid component\n * Event can be cancelled by calling event.preventDefault() in callback\n */\n emit(eventName: string, detail?: any) {\n const event = new CustomEvent(eventName, { detail, cancelable: true });\n this.revogrid.dispatchEvent(event);\n return event;\n }\n\n /**\n * Clear all subscriptions\n */\n clearSubscriptions() {\n for (let type in this.subscriptions) {\n this.removeEventListener(type);\n }\n }\n\n /**\n * Destroy plugin and clear all subscriptions\n */\n destroy() {\n this.clearSubscriptions();\n }\n}\n"],"mappings":";;;2IAuBA,MAAMA,EACJC,IAEA,IAAIC,EAA+C,GAEnD,MAAMC,EAAa,CACjBC,EACAC,KAEA,MAAMC,EAAOC,OAAAC,OAAA,GAAQJ,GACrBF,EAAc,GACdO,EAAKJ,GAAS,CAACK,EAAGC,KAChB,GAAID,GAAKJ,EAAQK,GAAQ,CACvBT,EAAYS,GAASL,EAAQK,UACtBL,EAAQK,E,KAGnBV,EAAMW,iBAAiBN,EAAQ,EAEjC,MAAO,CACL,GAAAO,CAAIC,EAAKC,GACP,OAAQD,GACN,IAAK,UACH,MAAME,EAAOD,EACb,MAAMX,EAAQH,EAAMA,MAAMgB,IAAI,SAE9Bd,EAAUI,OAAAC,OAAAD,OAAAC,OAAA,GAAMJ,GAAUF,GAAec,GACzC,M,EAGP,EAGH,MAAME,EACJjB,IAEO,CACL,GAAAY,CAAIM,GACF,OAAQA,GACN,IAAK,QACL,IAAK,QACL,IAAK,iBACH,IAAIC,EAAW,EACf,MAAMC,EAAQpB,EAAMA,MAAMgB,IAAI,SAC9B,IAAK,IAAIK,EAAI,EAAGA,EAAID,EAAOC,IAAK,CAC9BF,GACEnB,EAAMA,MAAMgB,IAAI,SAASK,IAAMrB,EAAMA,MAAMgB,IAAI,iB,CAEnDhB,EAAMsB,SAAS,CAAEH,a,IAM3B,SAASI,IACP,MAAO,CACLC,QAAS,G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B7B,KAAKmB,SAAUO,IAC/CpD,OAAOuD,yBAAyB7B,KAAKmB,SAASpB,YAAY+B,UAAWJ,GAGvEpD,OAAOyD,eAAe/B,KAAKmB,SAAUO,EAAM,CACzC,GAAA9C,CAAIE,G,MACF,MAAMkD,EAAcR,EAAS1C,GAC7B,GAAIkD,IAAgB,MAAO,CACzB,M,CAGF,OAAOC,EAAAL,IAAe,MAAfA,SAAe,SAAfA,EAAiBhD,OAAG,MAAAqD,SAAA,SAAAA,EAAEC,KAAKlC,KAAMlB,E,EAE1C,GAAAE,G,MAEE,OAAOiD,EAAAL,IAAe,MAAfA,SAAe,SAAfA,EAAiB5C,OAAG,MAAAiD,SAAA,SAAAA,EAAEC,KAAKlC,K,IAGtC,GAAI2B,EAAW,CACbH,EAASI,IAAe,MAAfA,SAAe,SAAfA,EAAiBO,M,EAQ9B,mBAAAC,CAAoBb,GAClBvB,KAAKmB,SAASiB,oBAAoBb,EAAWvB,KAAKqB,cAAcE,WACzDvB,KAAKqB,cAAcE,E,CAO5B,IAAAc,CAAKd,EAAmBe,GACtB,MAAMC,EAAQ,IAAIC,YAAYjB,EAAW,CAAEe,SAAQG,WAAY,OAC/DzC,KAAKmB,SAASuB,cAAcH,GAC5B,OAAOA,C,CAMT,kBAAAI,GACE,IAAK,IAAI3B,KAAQhB,KAAKqB,cAAe,CACnCrB,KAAKoC,oBAAoBpB,E,EAO7B,OAAA4B,GACE5C,KAAK2C,oB","ignoreList":[]}
1
+ {"version":3,"names":["trimmedPlugin","store","trimmedSize","setTrimmed","sizes","trimmed","newSize","Object","assign","each","v","index","setDimensionSize","set","key","val","trim","get","realSizePlugin","k","realSize","count","i","setStore","initialBase","indexes","positionIndexToItem","indexToItem","positionIndexes","initialState","originItemSize","DimensionStore","constructor","this","createStore","use","getCurrentState","state","keys","reduce","r","data","dispose","drop","dimensionData","calculateDimensionData","rowTypes","columnTypes","isRowType","type","indexOf","BasePlugin","revogrid","providers","subscriptions","addEventListener","eventName","callback","watch","prop","immediate","nativeValueDesc","getOwnPropertyDescriptor","prototype","defineProperty","keepDefault","_a","call","value","removeEventListener","emit","detail","event","CustomEvent","cancelable","dispatchEvent","clearSubscriptions","destroy"],"sources":["src/store/dimension/dimension.store.ts","src/store/index.ts","src/plugins/base.plugin.ts"],"sourcesContent":["/**\n * Storing pre-calculated\n * Dimension information and sizes\n */\nimport reduce from 'lodash/reduce';\nimport { createStore } from '@stencil/store';\n\nimport { setStore, Observable, PluginSubscribe } from '../../utils/store.utils';\nimport { calculateDimensionData } from './dimension.helpers';\nimport each from 'lodash/each';\nimport {\n DimensionCalc,\n DimensionSettingsState,\n ViewSettingSizeProp,\n MultiDimensionType,\n} from '@type';\n\nexport type DimensionStoreCollection = {\n [T in MultiDimensionType]: DimensionStore;\n};\n\ntype Item = keyof DimensionSettingsState;\n\nconst trimmedPlugin = (\n store: DimensionStore,\n): PluginSubscribe<DimensionSettingsState> => {\n let trimmedSize: DimensionSettingsState['sizes'] = {};\n\n const setTrimmed = (\n sizes: DimensionSettingsState['sizes'],\n trimmed: DimensionSettingsState['trimmed'],\n ) => {\n const newSize = { ...sizes };\n trimmedSize = {};\n each(trimmed, (v, index) => {\n if (v && newSize[index]) {\n trimmedSize[index] = newSize[index];\n delete newSize[index];\n }\n });\n store.setDimensionSize(newSize);\n };\n return {\n set(key, val) {\n switch (key) {\n case 'trimmed':\n const trim = val as DimensionSettingsState['trimmed'];\n const sizes = store.store.get('sizes');\n // recover trimmed, apply new trim\n setTrimmed({ ...sizes, ...trimmedSize }, trim);\n break;\n }\n },\n };\n};\n\nconst realSizePlugin = (\n store: DimensionStore,\n): PluginSubscribe<DimensionSettingsState> => {\n return {\n set(k) {\n switch (k) {\n case 'count':\n case 'sizes':\n case 'originItemSize':\n let realSize = 0;\n const count = store.store.get('count');\n for (let i = 0; i < count; i++) {\n realSize +=\n store.store.get('sizes')[i] || store.store.get('originItemSize');\n }\n store.setStore({ realSize });\n }\n },\n };\n};\n\nfunction initialBase(): DimensionCalc {\n return {\n indexes: [],\n count: 0,\n\n // plugin support\n trimmed: {},\n\n // size operations, this provider stores only changed sizes, not all of them\n // same as indexes but for sizes and positions\n // item index to size\n sizes: {},\n // order in indexes[] to coordinate\n positionIndexToItem: {},\n // initial element to coordinate ^\n indexToItem: {},\n positionIndexes: [],\n };\n}\n\nfunction initialState(): DimensionSettingsState {\n return {\n ...initialBase(),\n // size which all items can take\n realSize: 0,\n\n // initial item size if it wasn't changed\n originItemSize: 0,\n };\n}\n\nexport class DimensionStore {\n readonly store: Observable<DimensionSettingsState>;\n constructor() {\n this.store = createStore(initialState());\n this.store.use(trimmedPlugin(this));\n this.store.use(realSizePlugin(this));\n }\n\n getCurrentState(): DimensionSettingsState {\n const state = initialState();\n const keys = Object.keys(state);\n return reduce(\n keys,\n (r: DimensionSettingsState, k: Item) => {\n const data = this.store.get(k);\n r[k] = data as never;\n return r;\n },\n state,\n );\n }\n\n dispose() {\n setStore(this.store, initialState());\n }\n\n setStore<T extends Record<string, any>>(data: Partial<T>) {\n setStore(this.store, data);\n }\n\n drop() {\n setStore(this.store, initialBase());\n }\n\n /**\n * Set custom dimension sizes and overwrite old\n * Generates new indexes based on sizes\n * @param sizes - sizes to set\n */\n setDimensionSize(sizes: ViewSettingSizeProp) {\n const dimensionData = calculateDimensionData(\n this.store.get('originItemSize'),\n sizes,\n );\n setStore(this.store, dimensionData);\n }\n}\n","import type { DimensionCols, DimensionRows } from '@type';\n\nexport * from './dataSource';\nexport * from './dimension';\nexport * from './selection';\nexport * from './vp';\n\nexport const rowTypes: DimensionRows[] = ['rowPinStart', 'rgRow', 'rowPinEnd'];\nexport const columnTypes: DimensionCols[] = [\n 'colPinStart',\n 'rgCol',\n 'colPinEnd',\n];\n\nexport function isRowType(type: DimensionRows | any): type is DimensionRows {\n return rowTypes.indexOf(type) > -1;\n}\n","import { PluginProviders, PluginBaseComponent } from '..';\n\ntype WatchConfig = { immediate: boolean };\n\n/**\n * Base layer for plugins\n * Provide minimal starting core for plugins to work\n * Extend this class to create plugin\n */\nexport class BasePlugin implements PluginBaseComponent {\n readonly subscriptions: Record<string, (...args: any[]) => void> = {};\n constructor(public revogrid: HTMLRevoGridElement, public providers: PluginProviders) {}\n /**\n *\n * @param eventName - event name to subscribe to in revo-grid component (e.g. 'beforeheaderclick')\n * @param callback - callback function for event\n */\n addEventListener(\n eventName: string,\n callback: (e: CustomEvent) => void,\n ) {\n this.revogrid.addEventListener(eventName, callback);\n this.subscriptions[eventName] = callback;\n }\n\n /**\n * Subscribe to property change in revo-grid component\n * You can return false in callback to prevent default value set\n *\n * @param prop - property name\n * @param callback - callback function\n * @param immediate - trigger callback immediately with current value\n */\n watch<T extends any>(\n prop: string,\n callback: (arg: T) => boolean | void,\n { immediate }: Partial<WatchConfig> = { immediate: false },\n ) {\n const nativeValueDesc =\n Object.getOwnPropertyDescriptor(this.revogrid, prop) ||\n Object.getOwnPropertyDescriptor(this.revogrid.constructor.prototype, prop);\n\n // Overwrite property descriptor for this instance\n Object.defineProperty(this.revogrid, prop, {\n set(val: T) {\n const keepDefault = callback(val);\n if (keepDefault === false) {\n return;\n }\n // Continue with native behavior\n return nativeValueDesc?.set?.call(this, val);\n },\n get() {\n // Continue with native behavior\n return nativeValueDesc?.get?.call(this);\n },\n });\n if (immediate) {\n callback(nativeValueDesc?.value);\n }\n }\n\n /**\n * Remove event listener\n * @param eventName\n */\n removeEventListener(eventName: string) {\n this.revogrid.removeEventListener(eventName, this.subscriptions[eventName]);\n delete this.subscriptions[eventName];\n }\n\n /**\n * Emit event from revo-grid component\n * Event can be cancelled by calling event.preventDefault() in callback\n */\n emit<T = any>(eventName: string, detail?: T) {\n const event = new CustomEvent<T>(eventName, { detail, cancelable: true });\n this.revogrid.dispatchEvent(event);\n return event;\n }\n\n /**\n * Clear all subscriptions\n */\n clearSubscriptions() {\n for (let type in this.subscriptions) {\n this.removeEventListener(type);\n }\n }\n\n /**\n * Destroy plugin and clear all subscriptions\n */\n destroy() {\n this.clearSubscriptions();\n }\n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e,SAAfA,EAAiB5C,OAAG,MAAAiD,SAAA,SAAAA,EAAEC,KAAKlC,K,IAGtC,GAAI2B,EAAW,CACbH,EAASI,IAAe,MAAfA,SAAe,SAAfA,EAAiBO,M,EAQ9B,mBAAAC,CAAoBb,GAClBvB,KAAKmB,SAASiB,oBAAoBb,EAAWvB,KAAKqB,cAAcE,WACzDvB,KAAKqB,cAAcE,E,CAO5B,IAAAc,CAAcd,EAAmBe,GAC/B,MAAMC,EAAQ,IAAIC,YAAejB,EAAW,CAAEe,SAAQG,WAAY,OAClEzC,KAAKmB,SAASuB,cAAcH,GAC5B,OAAOA,C,CAMT,kBAAAI,GACE,IAAK,IAAI3B,KAAQhB,KAAKqB,cAAe,CACnCrB,KAAKoC,oBAAoBpB,E,EAO7B,OAAA4B,GACE5C,KAAK2C,oB","ignoreList":[]}
@@ -1,5 +1,5 @@
1
1
  /*!
2
2
  * Built by Revolist OU ❤️
3
3
  */
4
- import{C as t,B as n,a as e,b as o}from"./dimension.helpers-c0c2888f.js";import"./toNumber-8de324a7.js";import"./index-e661aeb5.js";import{g as s}from"./selection.helpers-dbf69cc1.js";import{G as r,C as i,D as c}from"./index-5a722722.js";const a=`${r}-depth`;const u=`${r}-name`;const f=`${r}-id`;const l=`${r}-value`;const d=`${r}-column`;const p=`${r}-expanded`;const h=`${r}-original-index`;const y=`group-expand`;const v=`groupexpandclick`;const g="rgRow";function m(t,n){return t[n]||null}function x(t,n,{prevExpanded:e,expandedAll:o,getGroupValue:s=m}){const r=new Map;t.forEach(((t,e)=>{const o=n.map((n=>s(t,n)));const i=o.pop();let c=r;o.forEach((t=>{if(!c.has(t)){c.set(t,new Map)}c=c.get(t)}));if(!c.has(i)){c.set(i,[])}const a=c.get(i);a.push(Object.assign(Object.assign({},t),{[h]:e}))}));let i=-1;const c=n.length;const d={};const y={};const v={};const g=[];function x(t,n,s){const r=n.length;t.forEach(((t,c)=>{const m=[...n,c];const b=m.join(",");const j=s&&(!!o||!!(e===null||e===void 0?void 0:e[b]));g.push({[u]:c,[a]:r,[f]:JSON.stringify(m),[l]:b,[p]:j});i+=1;if(!j&&r){d[i]=true}if(Array.isArray(t)){t.forEach((t=>{i+=1;if(!j){d[i]=true}y[t[h]]=i;const n=m.map(((t,n)=>m.slice(0,n+1).join(",")));n.forEach((t=>{if(!v[t]){v[t]=[]}v[t].push(i)}))}));g.push(...t)}else{x(t,m,j)}}))}x(r,[],true);return{sourceWithGroups:g,depth:c,trimmed:d,oldNewIndexMap:y,childrenByGroup:v}}function b(t){return t&&t[u]}function j(t){return t&&typeof t[u]!=="undefined"}function O(t){return t&&typeof t[d]!=="undefined"}function w(t,n){const e=t.length;let o=0;for(;o<e;o++){if(t[o]!==n[o]){return o}}return o}function I(t){const n=JSON.parse(t);if(!Array.isArray(n)){return null}return n}function C(t,n,e){const o=I(e[f]);if(!o){return false}const s=w(t,o);return n[a]<s}const D="header";const R="footer";const T="content";const $="data";function A(t,n){const e=t.viewports[t.colType].store.get("realCount");const o=t.viewports[n].store.get("realCount");return{x:e,y:o}}function G(t,n,e){var o=-1,s=t.length;if(n<0){n=-n>s?0:s+n}e=e>s?s:e;if(e<0){e+=s}s=n>e?0:e-n>>>0;n>>>=0;var r=Array(s);while(++o<s){r[o]=t[o+n]}return r}var M=G;var N=M,P=t,S=n;function k(t,n,e){var o=t==null?0:t.length;if(!o){return[]}if(e&&typeof e!="number"&&P(t,n,e)){n=0;e=o}else{n=n==null?0:S(n);e=e===undefined?o:S(e)}return N(t,n,e)}var B=k;class E{get columns(){return e(this.source)}constructor(t,n){this.dataStore=t;this.source=n;this.unsubscribe=[];this.hasGrouping=false;this.unsubscribe.push(n.onChange("source",(t=>this.checkGrouping(t))));this.checkGrouping(n.get("source"));this.type=n.get("type")}checkGrouping(t){for(let n of t){if(O(n)){this.hasGrouping=true;return}this.hasGrouping=false}}isReadOnly(t,n){var e;const o=(e=this.columns[n])===null||e===void 0?void 0:e.readonly;if(typeof o==="function"){const e=this.rowDataModel(t,n);return o(e)}return o}mergeProperties(t,n,e,o,s){const r={[i]:true,[c]:this.isReadOnly(t,n)};let a=Object.assign(Object.assign({},e),{class:r});const u=s===null||s===void 0?void 0:s(o);if(!u){return a}return F(a,u)}getRowClass(t,n){const e=o(this.dataStore,t)||{};return e[n]||""}getCellData(t,n){const e=this.rowDataModel(t,n);return J(e.model[e.prop])}getSaveData(t,n,e){if(typeof e==="undefined"){e=this.getCellData(t,n)}const o=this.rowDataModel(t,n);return{prop:o.prop,rowIndex:t,colIndex:n,val:e,model:o.model,colType:this.type,type:this.dataStore.get("type")}}getCellEditor(t,n,e){var o;const s=(o=this.columns[n])===null||o===void 0?void 0:o.editor;if(!s){return undefined}if(typeof s==="string"){return e[s]}return s}rowDataModel(t,n){const e=this.columns[n];const s=e===null||e===void 0?void 0:e.prop;const r=o(this.dataStore,t)||{};const i=r[s];const c=this.dataStore.get("type");return{prop:s,model:r,data:this.dataStore.get("source"),column:e,rowIndex:t,colIndex:n,colType:this.type,type:c,value:i}}getRangeData(t,n){var e;const s={};const r=t.oldRange.x1-t.oldRange.x+1;const i=t.oldRange.y1-t.oldRange.y+1;const c={};for(let a=t.newRange.y,u=0;a<t.newRange.y1+1;a++,u++){const f=t.oldRange.y+u%i;const l=o(this.dataStore,f)||{};for(let o=t.newRange.x,i=0;o<t.newRange.x1+1;o++,i++){if(a>=t.oldRange.y&&a<=t.oldRange.y1&&o>=t.oldRange.x&&o<=t.oldRange.x1){continue}if(!this.columns[o]){continue}const u=(e=this.columns[o])===null||e===void 0?void 0:e.prop;const d=t.oldRange.x+i%r;const p=n[d].prop;if(!this.isReadOnly(a,o)){if(!s[a]){s[a]={}}s[a][u]=l[p];if(!c[a]){c[a]={}}c[a][u]={colIndex:d,colProp:p,rowIndex:f}}}}return{changed:s,mapping:c}}getTransformedDataToApply(t,n){const e={};const o=n.length;const r=this.columns.length;const i=this.dataStore.get("items").length;let c=t.y;let a=0;for(let s=0;c<i&&s<o;c++,s++){const i=n[s%o];const u=(i===null||i===void 0?void 0:i.length)||0;let f=t.x;for(let t=0;f<r&&t<u;f++,t++){const n=this.columns[f].prop;const o=t%r;if(!this.isReadOnly(c,f)){if(!e[c]){e[c]={}}e[c][n]=i[o]}}a=Math.max(a,f-1)}const u=s(t,{y:c-1,x:a});return{changed:e,range:u}}getRangeStaticData(t,n){const e={};for(let o=t.y,s=0;o<t.y1+1;o++,s++){for(let s=t.x,r=0;s<t.x1+1;s++,r++){if(!this.columns[s]){continue}const t=this.columns[s].prop;if(!this.isReadOnly(o,s)){if(!e[o]){e[o]={}}e[o][t]=n}}}return e}getRangeTransformedToProps(t,n){var e;const s=[];const r=this.dataStore.get("type");for(let i=t.y,c=0;i<t.y1+1;i++,c++){for(let c=t.x,a=0;c<t.x1+1;c++,a++){const t=(e=this.columns[c])===null||e===void 0?void 0:e.prop;s.push({prop:t,rowIndex:i,colIndex:c,model:o(n,i),type:r,colType:this.type})}}return s}copyRangeArray(t,n){const e=[...this.columns];const s=B(e,t.x,t.x1+1).map((t=>t.prop));const r=[];const i={};for(let e=t.y;e<=t.y1;e++){const t=[];i[e]={};for(let r of s){const s=o(n,e);if(!s){continue}const c=s[r];t.push(c);i[e][r]=c}r.push(t)}return{data:r,mapping:i}}destroy(){this.unsubscribe.forEach((t=>t()))}}function J(t){if(typeof t==="undefined"||t===null){return""}return t}function q(t,n){if(typeof t==="function"){return t(n)}return!!t}function F(t,n){let e=Object.assign(Object.assign({},n),t);if(n.class){if(typeof n.class==="object"&&typeof e.class==="object"){e.class=Object.assign(Object.assign({},n.class),e.class)}else if(typeof n.class==="string"&&typeof e.class==="object"){e.class[n.class]=true}else if(typeof e.class==="string"){e.class+=" "+n.class}}if(n.style){e.style=Object.assign(Object.assign({},n.style),e.style)}return e}export{T as C,$ as D,R as F,p as G,D as H,l as P,I as a,C as b,a as c,f as d,g as e,d as f,b as g,v as h,j as i,x as j,O as k,A as l,F as m,E as n,y as o,u as p,q,J as r};
5
- //# sourceMappingURL=column.service-6aab6fac.js.map
4
+ import{C as t,B as n,a as e,b as o}from"./dimension.helpers-7c71178f.js";import"./toNumber-8de324a7.js";import"./index-e661aeb5.js";import{g as s}from"./selection.helpers-74cbfb89.js";import{G as r,C as i,D as c}from"./index-5a722722.js";const a=`${r}-depth`;const u=`${r}-name`;const f=`${r}-id`;const l=`${r}-value`;const d=`${r}-column`;const p=`${r}-expanded`;const h=`${r}-original-index`;const y=`group-expand`;const v=`groupexpandclick`;const g="rgRow";function m(t,n){return t[n]||null}function b(t,n,{prevExpanded:e,expandedAll:o,getGroupValue:s=m}){const r=new Map;t.forEach(((t,e)=>{const o=n.map((n=>s(t,n)));const i=o.pop();let c=r;o.forEach((t=>{if(!c.has(t)){c.set(t,new Map)}c=c.get(t)}));if(!c.has(i)){c.set(i,[])}const a=c.get(i);a.push(Object.assign(Object.assign({},t),{[h]:e}))}));let i=-1;const c=n.length;const d={};const y={};const v={};const g=[];function b(t,n,s){const r=n.length;t.forEach(((t,c)=>{const m=[...n,c];const x=m.join(",");const j=s&&(!!o||!!(e===null||e===void 0?void 0:e[x]));g.push({[u]:c,[a]:r,[f]:JSON.stringify(m),[l]:x,[p]:j});i+=1;if(!j&&r){d[i]=true}if(Array.isArray(t)){t.forEach((t=>{i+=1;if(!j){d[i]=true}y[t[h]]=i;const n=m.map(((t,n)=>m.slice(0,n+1).join(",")));n.forEach((t=>{if(!v[t]){v[t]=[]}v[t].push(i)}))}));g.push(...t)}else{b(t,m,j)}}))}b(r,[],true);return{sourceWithGroups:g,depth:c,trimmed:d,oldNewIndexMap:y,childrenByGroup:v}}function x(t){return t&&t[u]}function j(t){return t&&typeof t[u]!=="undefined"}function O(t){return t&&typeof t[d]!=="undefined"}function w(t,n){const e=t.length;let o=0;for(;o<e;o++){if(t[o]!==n[o]){return o}}return o}function I(t){const n=JSON.parse(t);if(!Array.isArray(n)){return null}return n}function C(t,n,e){const o=I(e[f]);if(!o){return false}const s=w(t,o);return n[a]<s}const D="header";const R="footer";const T="content";const $="data";function A(t,n){const e=t.viewports[t.colType].store.get("realCount");const o=t.viewports[n].store.get("realCount");return{x:e,y:o}}function G(t,n,e){var o=-1,s=t.length;if(n<0){n=-n>s?0:s+n}e=e>s?s:e;if(e<0){e+=s}s=n>e?0:e-n>>>0;n>>>=0;var r=Array(s);while(++o<s){r[o]=t[o+n]}return r}var M=G;var N=M,P=t,S=n;function k(t,n,e){var o=t==null?0:t.length;if(!o){return[]}if(e&&typeof e!="number"&&P(t,n,e)){n=0;e=o}else{n=n==null?0:S(n);e=e===undefined?o:S(e)}return N(t,n,e)}var B=k;class E{get columns(){return e(this.source)}constructor(t,n){this.dataStore=t;this.source=n;this.unsubscribe=[];this.hasGrouping=false;this.unsubscribe.push(n.onChange("source",(t=>this.checkGrouping(t))));this.checkGrouping(n.get("source"));this.type=n.get("type")}checkGrouping(t){for(let n of t){if(O(n)){this.hasGrouping=true;return}this.hasGrouping=false}}isReadOnly(t,n){var e;const o=(e=this.columns[n])===null||e===void 0?void 0:e.readonly;if(typeof o==="function"){const e=this.rowDataModel(t,n);return o(e)}return o}mergeProperties(t,n,e,o,s){const r={[i]:true,[c]:this.isReadOnly(t,n)};let a=Object.assign(Object.assign({},e),{class:r});const u=s===null||s===void 0?void 0:s(o);if(!u){return a}return F(a,u)}getRowClass(t,n){const e=o(this.dataStore,t)||{};return e[n]||""}getCellData(t,n){const e=this.rowDataModel(t,n);return J(e.model[e.prop])}getSaveData(t,n,e){if(typeof e==="undefined"){e=this.getCellData(t,n)}const o=this.rowDataModel(t,n);return{prop:o.prop,rowIndex:t,colIndex:n,val:e,model:o.model,colType:this.type,type:this.dataStore.get("type")}}getCellEditor(t,n,e){var o;const s=(o=this.columns[n])===null||o===void 0?void 0:o.editor;if(!s){return undefined}if(typeof s==="string"){return e[s]}return s}rowDataModel(t,n){const e=this.columns[n];const s=e===null||e===void 0?void 0:e.prop;const r=o(this.dataStore,t)||{};const i=r[s];const c=this.dataStore.get("type");return{prop:s,model:r,data:this.dataStore.get("source"),column:e,rowIndex:t,colIndex:n,colType:this.type,type:c,value:i}}getRangeData(t,n){var e;const s={};const r=t.oldRange.x1-t.oldRange.x+1;const i=t.oldRange.y1-t.oldRange.y+1;const c={};for(let a=t.newRange.y,u=0;a<t.newRange.y1+1;a++,u++){const f=t.oldRange.y+u%i;const l=o(this.dataStore,f)||{};for(let o=t.newRange.x,i=0;o<t.newRange.x1+1;o++,i++){if(a>=t.oldRange.y&&a<=t.oldRange.y1&&o>=t.oldRange.x&&o<=t.oldRange.x1){continue}if(!this.columns[o]){continue}const u=(e=this.columns[o])===null||e===void 0?void 0:e.prop;const d=t.oldRange.x+i%r;const p=n[d].prop;if(!this.isReadOnly(a,o)){if(!s[a]){s[a]={}}s[a][u]=l[p];if(!c[a]){c[a]={}}c[a][u]={colIndex:d,colProp:p,rowIndex:f}}}}return{changed:s,mapping:c}}getTransformedDataToApply(t,n){const e={};const o=n.length;const r=this.columns.length;const i=this.dataStore.get("items").length;let c=t.y;let a=0;for(let s=0;c<i&&s<o;c++,s++){const i=n[s%o];const u=(i===null||i===void 0?void 0:i.length)||0;let f=t.x;for(let t=0;f<r&&t<u;f++,t++){const n=this.columns[f].prop;const o=t%r;if(!this.isReadOnly(c,f)){if(!e[c]){e[c]={}}e[c][n]=i[o]}}a=Math.max(a,f-1)}const u=s(t,{y:c-1,x:a});return{changed:e,range:u}}getRangeStaticData(t,n){const e={};for(let o=t.y,s=0;o<t.y1+1;o++,s++){for(let s=t.x,r=0;s<t.x1+1;s++,r++){if(!this.columns[s]){continue}const t=this.columns[s].prop;if(!this.isReadOnly(o,s)){if(!e[o]){e[o]={}}e[o][t]=n}}}return e}getRangeTransformedToProps(t,n){var e;const s=[];const r=this.dataStore.get("type");for(let i=t.y,c=0;i<t.y1+1;i++,c++){for(let c=t.x,a=0;c<t.x1+1;c++,a++){const t=(e=this.columns[c])===null||e===void 0?void 0:e.prop;s.push({prop:t,rowIndex:i,colIndex:c,model:o(n,i),type:r,colType:this.type})}}return s}copyRangeArray(t,n){const e=[...this.columns];const s=B(e,t.x,t.x1+1).map((t=>t.prop));const r=[];const i={};for(let e=t.y;e<=t.y1;e++){const t=[];i[e]={};for(let r of s){const s=o(n,e);if(!s){continue}const c=s[r];t.push(c);i[e][r]=c}r.push(t)}return{data:r,mapping:i}}destroy(){this.unsubscribe.forEach((t=>t()))}}function J(t){if(typeof t==="undefined"||t===null){return""}return t}function q(t,n){if(typeof t==="function"){return t(n)}return!!t}function F(t,n){let e=Object.assign(Object.assign({},n),t);if(n.class){if(typeof n.class==="object"&&typeof e.class==="object"){e.class=Object.assign(Object.assign({},n.class),e.class)}else if(typeof n.class==="string"&&typeof e.class==="object"){e.class[n.class]=true}else if(typeof e.class==="string"){e.class+=" "+n.class}}if(n.style){e.style=Object.assign(Object.assign({},n.style),e.style)}return e}export{T as C,$ as D,R as F,p as G,D as H,l as P,I as a,C as b,a as c,f as d,g as e,d as f,x as g,v as h,j as i,b as j,O as k,A as l,F as m,E as n,y as o,u as p,q,J as r};
5
+ //# sourceMappingURL=column.service-521eb0d5.js.map