@revolist/revogrid 4.9.7 → 4.9.9

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 (146) hide show
  1. package/dist/cjs/{column.service-0615a373.js → column.service-bfaba0e0.js} +5 -5
  2. package/dist/cjs/column.service-bfaba0e0.js.map +1 -0
  3. package/dist/cjs/{column.utils-694677fa.js → column.utils-4a450d27.js} +2 -2
  4. package/dist/cjs/{column.utils-694677fa.js.map → column.utils-4a450d27.js.map} +1 -1
  5. package/dist/cjs/{edit.utils-2e1f4278.js → edit.utils-983f1a82.js} +2 -2
  6. package/dist/cjs/{edit.utils-2e1f4278.js.map → edit.utils-983f1a82.js.map} +1 -1
  7. package/dist/cjs/{header-cell-renderer-360528aa.js → header-cell-renderer-53e4fd75.js} +2 -2
  8. package/dist/cjs/{header-cell-renderer-360528aa.js.map → header-cell-renderer-53e4fd75.js.map} +1 -1
  9. package/dist/cjs/{index-2991afbb.js → index-464d1aaf.js} +3 -2
  10. package/dist/cjs/index-464d1aaf.js.map +1 -0
  11. package/dist/cjs/index.cjs.js +5 -5
  12. package/dist/cjs/{key.utils-b84b0eba.js → key.utils-12715159.js} +2 -2
  13. package/dist/cjs/{key.utils-b84b0eba.js.map → key.utils-12715159.js.map} +1 -1
  14. package/dist/cjs/loader.cjs.js +1 -1
  15. package/dist/cjs/revo-grid.cjs.entry.js +95 -16
  16. package/dist/cjs/revo-grid.cjs.entry.js.map +1 -1
  17. package/dist/cjs/revo-grid.cjs.js +1 -1
  18. package/dist/cjs/revogr-attribution_6.cjs.entry.js +25 -24
  19. package/dist/cjs/revogr-attribution_6.cjs.entry.js.map +1 -1
  20. package/dist/cjs/revogr-clipboard_3.cjs.entry.js +3 -3
  21. package/dist/cjs/revogr-data_4.cjs.entry.js +7 -7
  22. package/dist/cjs/revogr-data_4.cjs.entry.js.map +1 -1
  23. package/dist/cjs/{row-header-utils-b5266b12.js → row-header-utils-e71dc7bf.js} +2 -2
  24. package/dist/cjs/{row-header-utils-b5266b12.js.map → row-header-utils-e71dc7bf.js.map} +1 -1
  25. package/dist/cjs/{selection.helpers-4374518f.js → selection.helpers-2c90d546.js} +2 -2
  26. package/dist/cjs/{selection.helpers-4374518f.js.map → selection.helpers-2c90d546.js.map} +1 -1
  27. package/dist/cjs/{throttle-8885fd65.js → throttle-c893457e.js} +2 -2
  28. package/dist/cjs/{throttle-8885fd65.js.map → throttle-c893457e.js.map} +1 -1
  29. package/dist/collection/components/data/column.service.js.map +1 -1
  30. package/dist/collection/components/data/revogr-data-style.css +1 -0
  31. package/dist/collection/components/overlay/keyboard.service.js +2 -2
  32. package/dist/collection/components/overlay/keyboard.service.js.map +1 -1
  33. package/dist/collection/components/overlay/revogr-overlay-selection.js +2 -2
  34. package/dist/collection/components/overlay/revogr-overlay-selection.js.map +1 -1
  35. package/dist/collection/components/overlay/selection.utils.js.map +1 -1
  36. package/dist/collection/components/revoGrid/revo-grid.js +36 -10
  37. package/dist/collection/components/revoGrid/revo-grid.js.map +1 -1
  38. package/dist/collection/components/scroll/revogr-viewport-scroll-style.css +1 -0
  39. package/dist/collection/components/selectionFocus/revogr-focus.js +21 -20
  40. package/dist/collection/components/selectionFocus/revogr-focus.js.map +1 -1
  41. package/dist/collection/plugins/column.auto-size.plugin.js +1 -1
  42. package/dist/collection/plugins/column.auto-size.plugin.js.map +1 -1
  43. package/dist/collection/plugins/groupingRow/grouping.row.plugin.js +6 -6
  44. package/dist/collection/plugins/groupingRow/grouping.row.plugin.js.map +1 -1
  45. package/dist/collection/plugins/groupingRow/grouping.service.js +2 -2
  46. package/dist/collection/plugins/groupingRow/grouping.service.js.map +1 -1
  47. package/dist/collection/plugins/wcag/index.js +79 -0
  48. package/dist/collection/plugins/wcag/index.js.map +1 -0
  49. package/dist/collection/store/dataSource/data.store.js +2 -1
  50. package/dist/collection/store/dataSource/data.store.js.map +1 -1
  51. package/dist/collection/types/interfaces.js +0 -4
  52. package/dist/collection/types/interfaces.js.map +1 -1
  53. package/dist/collection/types/selection.js.map +1 -1
  54. package/dist/esm/{column.service-af0694c5.js → column.service-6f1faf2d.js} +5 -5
  55. package/dist/esm/column.service-6f1faf2d.js.map +1 -0
  56. package/dist/esm/{column.utils-78dd3ef2.js → column.utils-1a402ff9.js} +2 -2
  57. package/dist/esm/{column.utils-78dd3ef2.js.map → column.utils-1a402ff9.js.map} +1 -1
  58. package/dist/esm/{edit.utils-ca303802.js → edit.utils-c3f5c9f4.js} +2 -2
  59. package/dist/esm/{edit.utils-ca303802.js.map → edit.utils-c3f5c9f4.js.map} +1 -1
  60. package/dist/esm/{header-cell-renderer-261317c3.js → header-cell-renderer-66d01daa.js} +2 -2
  61. package/dist/esm/{header-cell-renderer-261317c3.js.map → header-cell-renderer-66d01daa.js.map} +1 -1
  62. package/dist/esm/{index-f65def08.js → index-c428acf6.js} +3 -2
  63. package/dist/esm/index-c428acf6.js.map +1 -0
  64. package/dist/esm/index.js +5 -5
  65. package/dist/esm/{key.utils-4b0093d5.js → key.utils-b1f93f7e.js} +2 -2
  66. package/dist/esm/{key.utils-4b0093d5.js.map → key.utils-b1f93f7e.js.map} +1 -1
  67. package/dist/esm/loader.js +1 -1
  68. package/dist/esm/revo-grid.entry.js +95 -16
  69. package/dist/esm/revo-grid.entry.js.map +1 -1
  70. package/dist/esm/revo-grid.js +1 -1
  71. package/dist/esm/revogr-attribution_6.entry.js +25 -24
  72. package/dist/esm/revogr-attribution_6.entry.js.map +1 -1
  73. package/dist/esm/revogr-clipboard_3.entry.js +3 -3
  74. package/dist/esm/revogr-data_4.entry.js +7 -7
  75. package/dist/esm/revogr-data_4.entry.js.map +1 -1
  76. package/dist/esm/{row-header-utils-6081260c.js → row-header-utils-3a6f6adc.js} +2 -2
  77. package/dist/esm/{row-header-utils-6081260c.js.map → row-header-utils-3a6f6adc.js.map} +1 -1
  78. package/dist/esm/{selection.helpers-d92697e1.js → selection.helpers-ac4368b0.js} +2 -2
  79. package/dist/esm/{selection.helpers-d92697e1.js.map → selection.helpers-ac4368b0.js.map} +1 -1
  80. package/dist/esm/{throttle-041ded8e.js → throttle-f9cda5b0.js} +2 -2
  81. package/dist/esm/{throttle-041ded8e.js.map → throttle-f9cda5b0.js.map} +1 -1
  82. package/dist/revo-grid/column.service-6f1faf2d.js +5 -0
  83. package/dist/revo-grid/column.service-6f1faf2d.js.map +1 -0
  84. package/dist/revo-grid/{column.utils-78dd3ef2.js → column.utils-1a402ff9.js} +2 -2
  85. package/dist/revo-grid/{edit.utils-ca303802.js → edit.utils-c3f5c9f4.js} +2 -2
  86. package/dist/revo-grid/{header-cell-renderer-261317c3.js → header-cell-renderer-66d01daa.js} +2 -2
  87. package/dist/revo-grid/{index-f65def08.js → index-c428acf6.js} +2 -2
  88. package/dist/revo-grid/{index-f65def08.js.map → index-c428acf6.js.map} +1 -1
  89. package/dist/revo-grid/index.esm.js +1 -1
  90. package/dist/revo-grid/key.utils-b1f93f7e.js +5 -0
  91. package/dist/revo-grid/revo-grid.entry.js +1 -1
  92. package/dist/revo-grid/revo-grid.entry.js.map +1 -1
  93. package/dist/revo-grid/revo-grid.esm.js +1 -1
  94. package/dist/revo-grid/revo-grid.esm.js.map +1 -1
  95. package/dist/revo-grid/revogr-attribution_6.entry.js +1 -1
  96. package/dist/revo-grid/revogr-attribution_6.entry.js.map +1 -1
  97. package/dist/revo-grid/revogr-clipboard_3.entry.js +1 -1
  98. package/dist/revo-grid/revogr-data_4.entry.js +1 -1
  99. package/dist/revo-grid/revogr-data_4.entry.js.map +1 -1
  100. package/dist/revo-grid/{row-header-utils-6081260c.js → row-header-utils-3a6f6adc.js} +2 -2
  101. package/dist/revo-grid/{selection.helpers-d92697e1.js → selection.helpers-ac4368b0.js} +2 -2
  102. package/dist/revo-grid/{throttle-041ded8e.js → throttle-f9cda5b0.js} +2 -2
  103. package/dist/types/components/data/column.service.d.ts +1 -1
  104. package/dist/types/components/overlay/selection.utils.d.ts +1 -1
  105. package/dist/types/components/revoGrid/revo-grid.d.ts +9 -6
  106. package/dist/types/components/selectionFocus/revogr-focus.d.ts +2 -6
  107. package/dist/types/components.d.ts +17 -19
  108. package/dist/types/plugins/groupingRow/grouping.service.d.ts +10 -2
  109. package/dist/types/plugins/wcag/index.d.ts +26 -0
  110. package/dist/types/services/data.provider.d.ts +1 -1
  111. package/dist/types/store/dataSource/data.store.d.ts +2 -2
  112. package/dist/types/types/interfaces.d.ts +13 -3
  113. package/dist/types/types/selection.d.ts +1 -3
  114. package/hydrate/index.js +114 -32
  115. package/hydrate/index.mjs +114 -32
  116. package/package.json +1 -1
  117. package/readme.md +12 -2
  118. package/standalone/column.service.js +2 -2
  119. package/standalone/column.service.js.map +1 -1
  120. package/standalone/data.store.js +2 -1
  121. package/standalone/data.store.js.map +1 -1
  122. package/standalone/revo-grid.js +92 -12
  123. package/standalone/revo-grid.js.map +1 -1
  124. package/standalone/revogr-data2.js +1 -1
  125. package/standalone/revogr-data2.js.map +1 -1
  126. package/standalone/revogr-focus2.js +17 -16
  127. package/standalone/revogr-focus2.js.map +1 -1
  128. package/standalone/revogr-overlay-selection2.js +2 -2
  129. package/standalone/revogr-overlay-selection2.js.map +1 -1
  130. package/standalone/revogr-viewport-scroll2.js +1 -1
  131. package/standalone/revogr-viewport-scroll2.js.map +1 -1
  132. package/standalone/selection.utils.js.map +1 -1
  133. package/dist/cjs/column.service-0615a373.js.map +0 -1
  134. package/dist/cjs/index-2991afbb.js.map +0 -1
  135. package/dist/esm/column.service-af0694c5.js.map +0 -1
  136. package/dist/esm/index-f65def08.js.map +0 -1
  137. package/dist/revo-grid/column.service-af0694c5.js +0 -5
  138. package/dist/revo-grid/column.service-af0694c5.js.map +0 -1
  139. package/dist/revo-grid/key.utils-4b0093d5.js +0 -5
  140. /package/dist/revo-grid/{column.utils-78dd3ef2.js.map → column.utils-1a402ff9.js.map} +0 -0
  141. /package/dist/revo-grid/{edit.utils-ca303802.js.map → edit.utils-c3f5c9f4.js.map} +0 -0
  142. /package/dist/revo-grid/{header-cell-renderer-261317c3.js.map → header-cell-renderer-66d01daa.js.map} +0 -0
  143. /package/dist/revo-grid/{key.utils-4b0093d5.js.map → key.utils-b1f93f7e.js.map} +0 -0
  144. /package/dist/revo-grid/{row-header-utils-6081260c.js.map → row-header-utils-3a6f6adc.js.map} +0 -0
  145. /package/dist/revo-grid/{selection.helpers-d92697e1.js.map → selection.helpers-ac4368b0.js.map} +0 -0
  146. /package/dist/revo-grid/{throttle-041ded8e.js.map → throttle-f9cda5b0.js.map} +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"grouping.row.plugin.js","sourceRoot":"","sources":["../../../src/plugins/groupingRow/grouping.row.plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,WAAW,EAA+B,MAAM,QAAQ,CAAC;AACzF,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EACL,iBAAiB,EACjB,cAAc,EACd,kBAAkB,EAClB,mBAAmB,EACnB,uBAAuB,GACxB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAOrE,OAAO,EAEL,cAAc,EACd,UAAU,EACV,gBAAgB,GACjB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,8BAA8B,EAC9B,gBAAgB,GACjB,MAAM,4BAA4B,CAAC;AAKpC,MAAM,CAAC,OAAO,OAAO,iBAAkB,SAAQ,UAAU;IAGvD,IAAI,QAAQ;;QACV,OAAO,CAAA,MAAA,IAAI,CAAC,OAAO,0CAAE,KAAK,MAAI,MAAA,MAAA,IAAI,CAAC,OAAO,0CAAE,KAAK,0CAAE,MAAM,CAAA,CAAC;IAC5D,CAAC;IAED,IAAI,KAAK;QACP,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC,iBAAiB,CAAC,CAAC,KAAK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C,SAAS,CAAC,IAAI,CAAC,OAAO,CACzB,MAAM,EACN,iBAAiB,EACjB,IAAI,CAAC,QAAQ,CAAC,eAAe,EAC7B,SAAS,EACT,IAAI,CACL,CAAC;QACF,IAAI,CAAC,aAAa,CAAC,SAAS,EAAE,SAAS,EAAE,aAAa,CAAC,CAAC;IAC1D,CAAC;IAEO,aAAa,CACnB,eAA8B,EAAE,EAChC,mBAA6C,EAAE,EAC/C,gBAAwC,EAAE,EAC1C,cAAuC;QAEvC,8BAA8B;QAC9B,MAAM,wBAAwB,GAAG,8BAA8B,CAC7D,IAAI,CAAC,OAAO,EACZ,aAAa,EACb,cAAc,CACf,CAAC;QACF,KAAK,IAAI,IAAI,IAAI,wBAAwB,EAAE,CAAC;YAC1C,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,wBAAwB,CAAC,IAAI,CAAC,EAAE,IAAI,CAAC,CAAC;QACjE,CAAC;QAED,4FAA4F;QAE5F,kCAAkC;QAClC,IAAI,CAAC,QAAQ,CAAC,UAAU,mBAAM,YAAY,GAAI,gBAAgB,CAAC,CAAC;IAClE,CAAC;CACF","sourcesContent":["import { getPhysical, setItems, columnTypes, TrimmedEntity, DSourceState } from '@store';\nimport { BasePlugin } from '../base.plugin';\nimport { FILTER_TRIMMED_TYPE } from '../filter/filter.plugin';\nimport {\n GROUPING_ROW_TYPE,\n GROUP_EXPANDED,\n GROUP_EXPAND_EVENT,\n PSEUDO_GROUP_COLUMN,\n PSEUDO_GROUP_ITEM_VALUE,\n} from './grouping.const';\nimport { doExpand, doCollapse } from './grouping.row.expand.service';\nimport {\n BeforeSourceSetEvent,\n GroupingOptions,\n OnExpandEvent,\n SourceGather,\n} from './grouping.row.types';\nimport {\n ExpandedOptions,\n gatherGrouping,\n isGrouping,\n isGroupingColumn,\n} from './grouping.service';\nimport {\n processDoubleConversionTrimmed,\n TRIMMED_GROUPING,\n} from './grouping.trimmed.service';\nimport { BeforeSaveDataDetails, ColumnRegular, DataType, DimensionRows, PluginProviders } from '@type';\nimport { Observable } from '../../utils/store.utils';\nimport { ColumnCollection } from '../../utils/column.utils';\n\nexport default class GroupingRowPlugin extends BasePlugin {\n private options: GroupingOptions | undefined;\n\n get hasProps() {\n return this.options?.props && this.options?.props?.length;\n }\n\n get store(): Observable<DSourceState<DataType, DimensionRows>> {\n return this.providers.data.stores[GROUPING_ROW_TYPE].store;\n }\n\n // proxy for items get\n get rowItems() {\n return this.store.get('items');\n }\n\n get trimmed() {\n return this.store.get('trimmed');\n }\n\n constructor(\n public revogrid: HTMLRevoGridElement,\n public providers: PluginProviders,\n ) {\n super(revogrid, providers);\n }\n\n // befoce cell focus\n private onFocus(e: CustomEvent<BeforeSaveDataDetails>) {\n if (isGrouping(e.detail.model)) {\n e.preventDefault();\n }\n }\n\n // expand event triggered\n private onExpand({ virtualIndex }: OnExpandEvent) {\n const { source } = this.getSource();\n let newTrimmed = this.trimmed[TRIMMED_GROUPING];\n\n let i = getPhysical(this.store, virtualIndex);\n const model = source[i];\n const prevExpanded = model[GROUP_EXPANDED];\n if (!prevExpanded) {\n const { trimmed, items } = doExpand(virtualIndex, source, this.rowItems);\n newTrimmed = { ...newTrimmed, ...trimmed };\n if (items) {\n setItems(this.store, items);\n }\n } else {\n const { trimmed } = doCollapse(i, source);\n newTrimmed = { ...newTrimmed, ...trimmed };\n this.revogrid.clearFocus();\n }\n\n this.store.set('source', source);\n this.revogrid.addTrimmed(newTrimmed, TRIMMED_GROUPING);\n }\n\n // get source based on proxy item collection to preserve rgRow order\n private getSource(withoutGrouping = false) {\n const source = this.store.get('source');\n const items = this.store.get('proxyItems');\n let index = 0;\n // order important here, expected parent is first, then others\n return items.reduce(\n (result: Required<SourceGather>, i) => {\n const model = source[i];\n if (!withoutGrouping) {\n result.source.push(model);\n return result;\n }\n\n // grouping filter\n if (!isGrouping(model)) {\n result.source.push(model);\n result.oldNewIndexes[i] = index;\n index++;\n } else {\n if (model[GROUP_EXPANDED]) {\n result.prevExpanded[model[PSEUDO_GROUP_ITEM_VALUE]] = true;\n }\n }\n return result;\n },\n {\n source: [],\n prevExpanded: {},\n oldNewIndexes: {},\n },\n );\n }\n\n private setColumnGrouping(cols?: ColumnRegular[]) {\n // if 0 column as holder\n if (cols?.length) {\n cols[0][PSEUDO_GROUP_COLUMN] = true;\n return true;\n }\n return false;\n }\n\n private setColumns({ columns }: ColumnCollection) {\n for (let type of columnTypes) {\n if (this.setColumnGrouping(columns[type])) {\n break;\n }\n }\n }\n\n // evaluate drag between groups\n private onDrag(e: CustomEvent<{ from: number; to: number }>) {\n const { from, to } = e.detail;\n const isDown = to - from >= 0;\n const { source } = this.getSource();\n const items = this.rowItems;\n let i = isDown ? from : to;\n const end = isDown ? to : from;\n for (; i < end; i++) {\n const model = source[items[i]];\n const isGroup = isGrouping(model);\n if (isGroup) {\n e.preventDefault();\n return;\n }\n }\n }\n\n private beforeTrimmedApply(trimmed: Record<number, boolean>, type: string) {\n /** Before filter apply remove grouping filtering */\n if (type === FILTER_TRIMMED_TYPE) {\n const source = this.store.get('source');\n for (let index in trimmed) {\n if (trimmed[index] && isGrouping(source[index])) {\n trimmed[index] = false;\n }\n }\n }\n }\n\n // subscribe to grid events to process them accordingly\n private subscribe() {\n /** if grouping present and new data source arrived */\n this.addEventListener(\n 'beforesourceset',\n ({ detail }: CustomEvent<BeforeSourceSetEvent>) => this.onDataSet(detail),\n );\n this.addEventListener(\n 'beforecolumnsset',\n ({ detail }: CustomEvent<ColumnCollection>) => this.setColumns(detail),\n );\n\n /**\n * filter applied need to clear grouping and apply again\n * based on new results can be new grouping\n */\n this.addEventListener(\n 'beforetrimmed',\n ({ detail: { trimmed, trimmedType } }) =>\n this.beforeTrimmedApply(trimmed, trimmedType),\n );\n /**\n * sorting applied need to clear grouping and apply again\n * based on new results whole grouping order will changed\n */\n this.addEventListener('aftersortingapply', () =>\n this.doSourceUpdate({ ...this.options }),\n );\n\n /**\n * Apply logic for focus inside of grouping\n * We can't focus on grouping rows, navigation only inside of groups for now\n */\n this.addEventListener('beforecellfocus', e => this.onFocus(e));\n /**\n * Prevent rgRow drag outside the group\n */\n this.addEventListener('roworderchanged', e => this.onDrag(e));\n\n /**\n * When grouping expand icon was clicked\n */\n this.addEventListener(\n GROUP_EXPAND_EVENT,\n ({ detail }: CustomEvent<OnExpandEvent>) => this.onExpand(detail),\n );\n }\n\n /**\n * Starts global source update with group clearing and applying new one\n * Initiated when need to reapply grouping\n */\n private doSourceUpdate(options?: ExpandedOptions) {\n if (!this.hasProps) {\n return;\n }\n /**\n * Get source without grouping\n * @param newOldIndexMap - provides us mapping with new indexes vs old indexes, we would use it for trimmed mapping\n */\n const { source, prevExpanded, oldNewIndexes } = this.getSource(true);\n /**\n * Group again\n * @param oldNewIndexMap - provides us mapping with new indexes vs old indexes\n */\n const {\n sourceWithGroups,\n depth,\n trimmed,\n oldNewIndexMap,\n childrenByGroup,\n } = gatherGrouping(source, this.options?.props || [], {\n prevExpanded,\n ...options,\n });\n\n // setup source\n this.providers.data.setData(\n sourceWithGroups,\n GROUPING_ROW_TYPE,\n this.revogrid.disableVirtualY,\n { depth, customRenderer: options?.groupLabelTemplate },\n true,\n );\n this.updateTrimmed(trimmed, childrenByGroup, oldNewIndexes ?? {}, oldNewIndexMap);\n }\n\n /**\n * Apply grouping on data set\n * Clear grouping from source\n * If source came from other plugin\n */\n private onDataSet(data: BeforeSourceSetEvent) {\n if (!this.hasProps || !data?.source || !data.source.length) {\n return;\n }\n const source = data.source.filter(s => !isGrouping(s));\n const expanded = this.revogrid.grouping || {};\n const {\n sourceWithGroups,\n depth,\n trimmed,\n oldNewIndexMap,\n childrenByGroup,\n } = gatherGrouping(source, this.options?.props || [], {\n ...(expanded || {}),\n });\n data.source = sourceWithGroups;\n this.providers.data.setGrouping({ depth });\n this.updateTrimmed(trimmed, childrenByGroup, oldNewIndexMap);\n }\n\n // apply grouping\n setGrouping(options: GroupingOptions) {\n // unsubscribe from all events when group applied\n this.clearSubscriptions();\n this.options = options;\n // clear props, no grouping exists\n if (!options.props || !Object.keys(options.props).length) {\n this.clearGrouping();\n return;\n }\n // props exist and source inited\n const { source } = this.getSource();\n if (source.length) {\n this.doSourceUpdate({ ...options });\n }\n // props exist and columns inited\n for (let t of columnTypes) {\n if (this.setColumnGrouping(this.providers.column.getColumns(t))) {\n this.providers.column.refreshByType(t);\n break;\n }\n }\n\n // if has any grouping subscribe to events again\n this.subscribe();\n }\n\n // clear grouping\n clearGrouping() {\n // clear columns\n columnTypes.forEach(t => {\n const cols = this.providers.column.getColumns(t);\n let deleted = false;\n cols.forEach(c => {\n if (isGroupingColumn(c)) {\n delete c[PSEUDO_GROUP_COLUMN];\n deleted = true;\n }\n });\n // if column store had grouping clear and refresh\n if (deleted) {\n this.providers.column.refreshByType(t);\n }\n });\n // clear rows\n const { source, oldNewIndexes } = this.getSource(true);\n this.providers.data.setData(\n source,\n GROUPING_ROW_TYPE,\n this.revogrid.disableVirtualY,\n undefined,\n true,\n );\n this.updateTrimmed(undefined, undefined, oldNewIndexes);\n }\n\n private updateTrimmed(\n trimmedGroup: TrimmedEntity = {},\n _childrenByGroup: Record<number, number[]> = {},\n firstLevelMap: Record<number, number> = {},\n secondLevelMap?: Record<number, number>,\n ) {\n // map previously trimmed data\n const trimemedOptionsToUpgrade = processDoubleConversionTrimmed(\n this.trimmed,\n firstLevelMap,\n secondLevelMap,\n );\n for (let type in trimemedOptionsToUpgrade) {\n this.revogrid.addTrimmed(trimemedOptionsToUpgrade[type], type);\n }\n\n // const emptyGroups = this.filterOutEmptyGroups(trimemedOptionsToUpgrade, childrenByGroup);\n\n // setup trimmed data for grouping\n this.revogrid.addTrimmed({ ...trimmedGroup }, TRIMMED_GROUPING);\n }\n}\n"]}
1
+ {"version":3,"file":"grouping.row.plugin.js","sourceRoot":"","sources":["../../../src/plugins/groupingRow/grouping.row.plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,WAAW,EAA+B,MAAM,QAAQ,CAAC;AACzF,OAA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AAwB,CAAC,IAAI,CAAC,EAAE,IAAI,CAAC,CAAC;QACjE,CAAC;QAED,4FAA4F;QAE5F,kCAAkC;QAClC,IAAI,CAAC,QAAQ,CAAC,UAAU,mBAAM,YAAY,GAAI,gBAAgB,CAAC,CAAC;IAClE,CAAC;CACF","sourcesContent":["import { getPhysical, setItems, columnTypes, TrimmedEntity, DSourceState } from '@store';\nimport { BasePlugin } from '../base.plugin';\nimport { FILTER_TRIMMED_TYPE } from '../filter/filter.plugin';\nimport {\n GROUPING_ROW_TYPE,\n GROUP_EXPANDED,\n GROUP_EXPAND_EVENT,\n PSEUDO_GROUP_COLUMN,\n PSEUDO_GROUP_ITEM_VALUE,\n} from './grouping.const';\nimport { doExpand, doCollapse } from './grouping.row.expand.service';\nimport {\n BeforeSourceSetEvent,\n GroupingOptions,\n OnExpandEvent,\n SourceGather,\n} from './grouping.row.types';\nimport {\n ExpandedOptions,\n gatherGrouping,\n isGrouping,\n isGroupingColumn,\n} from './grouping.service';\nimport {\n processDoubleConversionTrimmed,\n TRIMMED_GROUPING,\n} from './grouping.trimmed.service';\nimport { BeforeSaveDataDetails, ColumnRegular, DataType, DimensionRows, PluginProviders } from '@type';\nimport { Observable } from '../../utils/store.utils';\nimport { ColumnCollection } from '../../utils/column.utils';\n\nexport default class GroupingRowPlugin extends BasePlugin {\n private options: GroupingOptions | undefined;\n\n get hasProps() {\n return this.options?.props && this.options?.props?.length;\n }\n\n get store(): Observable<DSourceState<DataType, DimensionRows>> {\n return this.providers.data.stores[GROUPING_ROW_TYPE].store;\n }\n\n // proxy for items get\n get rowItems() {\n return this.store.get('items');\n }\n\n get trimmed() {\n return this.store.get('trimmed');\n }\n\n constructor(\n public revogrid: HTMLRevoGridElement,\n public providers: PluginProviders,\n ) {\n super(revogrid, providers);\n }\n\n // befoce cell focus\n private onFocus(e: CustomEvent<BeforeSaveDataDetails>) {\n if (isGrouping(e.detail.model)) {\n e.preventDefault();\n }\n }\n\n // expand event triggered\n private onExpand({ virtualIndex }: OnExpandEvent) {\n const { source } = this.getSource();\n let newTrimmed = this.trimmed[TRIMMED_GROUPING];\n\n let i = getPhysical(this.store, virtualIndex);\n const model = source[i];\n const prevExpanded = model[GROUP_EXPANDED];\n if (!prevExpanded) {\n const { trimmed, items } = doExpand(virtualIndex, source, this.rowItems);\n newTrimmed = { ...newTrimmed, ...trimmed };\n if (items) {\n setItems(this.store, items);\n }\n } else {\n const { trimmed } = doCollapse(i, source);\n newTrimmed = { ...newTrimmed, ...trimmed };\n this.revogrid.clearFocus();\n }\n\n this.store.set('source', source);\n this.revogrid.addTrimmed(newTrimmed, TRIMMED_GROUPING);\n }\n\n // get source based on proxy item collection to preserve rgRow order\n private getSource(withoutGrouping = false) {\n const source = this.store.get('source');\n const items = this.store.get('proxyItems');\n let index = 0;\n // order important here, expected parent is first, then others\n return items.reduce(\n (result: Required<SourceGather>, i) => {\n const model = source[i];\n if (!withoutGrouping) {\n result.source.push(model);\n return result;\n }\n\n // grouping filter\n if (isGrouping(model)) {\n if (model[GROUP_EXPANDED]) {\n result.prevExpanded[model[PSEUDO_GROUP_ITEM_VALUE]] = true;\n }\n } else {\n result.source.push(model);\n result.oldNewIndexes[i] = index;\n index++;\n }\n return result;\n },\n {\n source: [],\n prevExpanded: {},\n oldNewIndexes: {},\n },\n );\n }\n\n private setColumnGrouping(cols?: ColumnRegular[]) {\n // if 0 column as holder\n if (cols?.length) {\n cols[0][PSEUDO_GROUP_COLUMN] = true;\n return true;\n }\n return false;\n }\n\n private setColumns({ columns }: ColumnCollection) {\n for (let type of columnTypes) {\n if (this.setColumnGrouping(columns[type])) {\n break;\n }\n }\n }\n\n // evaluate drag between groups\n private onDrag(e: CustomEvent<{ from: number; to: number }>) {\n const { from, to } = e.detail;\n const isDown = to - from >= 0;\n const { source } = this.getSource();\n const items = this.rowItems;\n let i = isDown ? from : to;\n const end = isDown ? to : from;\n for (; i < end; i++) {\n const model = source[items[i]];\n const isGroup = isGrouping(model);\n if (isGroup) {\n e.preventDefault();\n return;\n }\n }\n }\n\n private beforeTrimmedApply(trimmed: Record<number, boolean>, type: string) {\n /** Before filter apply remove grouping filtering */\n if (type === FILTER_TRIMMED_TYPE) {\n const source = this.store.get('source');\n for (let index in trimmed) {\n if (trimmed[index] && isGrouping(source[index])) {\n trimmed[index] = false;\n }\n }\n }\n }\n\n // subscribe to grid events to process them accordingly\n private subscribe() {\n /** if grouping present and new data source arrived */\n this.addEventListener(\n 'beforesourceset',\n ({ detail }: CustomEvent<BeforeSourceSetEvent>) => this.onDataSet(detail),\n );\n this.addEventListener(\n 'beforecolumnsset',\n ({ detail }: CustomEvent<ColumnCollection>) => this.setColumns(detail),\n );\n\n /**\n * filter applied need to clear grouping and apply again\n * based on new results can be new grouping\n */\n this.addEventListener(\n 'beforetrimmed',\n ({ detail: { trimmed, trimmedType } }) =>\n this.beforeTrimmedApply(trimmed, trimmedType),\n );\n /**\n * sorting applied need to clear grouping and apply again\n * based on new results whole grouping order will changed\n */\n this.addEventListener('aftersortingapply', () =>\n this.doSourceUpdate({ ...this.options }),\n );\n\n /**\n * Apply logic for focus inside of grouping\n * We can't focus on grouping rows, navigation only inside of groups for now\n */\n this.addEventListener('beforecellfocus', e => this.onFocus(e));\n /**\n * Prevent rgRow drag outside the group\n */\n this.addEventListener('roworderchanged', e => this.onDrag(e));\n\n /**\n * When grouping expand icon was clicked\n */\n this.addEventListener(\n GROUP_EXPAND_EVENT,\n ({ detail }: CustomEvent<OnExpandEvent>) => this.onExpand(detail),\n );\n }\n\n /**\n * Starts global source update with group clearing and applying new one\n * Initiated when need to reapply grouping\n */\n private doSourceUpdate(options?: ExpandedOptions) {\n if (!this.hasProps) {\n return;\n }\n /**\n * Get source without grouping\n * @param newOldIndexMap - provides us mapping with new indexes vs old indexes, we would use it for trimmed mapping\n */\n const { source, prevExpanded, oldNewIndexes } = this.getSource(true);\n /**\n * Group again\n * @param oldNewIndexMap - provides us mapping with new indexes vs old indexes\n */\n const {\n sourceWithGroups,\n depth,\n trimmed,\n oldNewIndexMap,\n childrenByGroup,\n } = gatherGrouping(source, this.options?.props || [], {\n prevExpanded,\n ...options,\n });\n\n // setup source\n this.providers.data.setData(\n sourceWithGroups,\n GROUPING_ROW_TYPE,\n this.revogrid.disableVirtualY,\n { depth, customRenderer: options?.groupLabelTemplate },\n true,\n );\n this.updateTrimmed(trimmed, childrenByGroup, oldNewIndexes ?? {}, oldNewIndexMap);\n }\n\n /**\n * Apply grouping on data set\n * Clear grouping from source\n * If source came from other plugin\n */\n private onDataSet(data: BeforeSourceSetEvent) {\n if (!this.hasProps || !data?.source || !data.source.length) {\n return;\n }\n const source = data.source.filter(s => !isGrouping(s));\n const expanded = this.revogrid.grouping || {};\n const {\n sourceWithGroups,\n depth,\n trimmed,\n oldNewIndexMap,\n childrenByGroup,\n } = gatherGrouping(source, this.options?.props || [], {\n ...(expanded || {}),\n });\n data.source = sourceWithGroups;\n this.providers.data.setGrouping({ depth });\n this.updateTrimmed(trimmed, childrenByGroup, oldNewIndexMap);\n }\n\n // apply grouping\n setGrouping(options: GroupingOptions) {\n // unsubscribe from all events when group applied\n this.clearSubscriptions();\n this.options = options;\n // clear props, no grouping exists\n if (!options.props || !Object.keys(options.props).length) {\n this.clearGrouping();\n return;\n }\n // props exist and source inited\n const { source } = this.getSource();\n if (source.length) {\n this.doSourceUpdate({ ...options });\n }\n // props exist and columns inited\n for (let t of columnTypes) {\n if (this.setColumnGrouping(this.providers.column.getColumns(t))) {\n this.providers.column.refreshByType(t);\n break;\n }\n }\n\n // if has any grouping subscribe to events again\n this.subscribe();\n }\n\n // clear grouping\n clearGrouping() {\n // clear columns\n columnTypes.forEach(t => {\n const cols = this.providers.column.getColumns(t);\n let deleted = false;\n cols.forEach(c => {\n if (isGroupingColumn(c)) {\n delete c[PSEUDO_GROUP_COLUMN];\n deleted = true;\n }\n });\n // if column store had grouping clear and refresh\n if (deleted) {\n this.providers.column.refreshByType(t);\n }\n });\n // clear rows\n const { source, oldNewIndexes } = this.getSource(true);\n this.providers.data.setData(\n source,\n GROUPING_ROW_TYPE,\n this.revogrid.disableVirtualY,\n undefined,\n true,\n );\n this.updateTrimmed(undefined, undefined, oldNewIndexes);\n }\n\n private updateTrimmed(\n trimmedGroup: TrimmedEntity = {},\n _childrenByGroup: Record<number, number[]> = {},\n firstLevelMap: Record<number, number> = {},\n secondLevelMap?: Record<number, number>,\n ) {\n // map previously trimmed data\n const trimemedOptionsToUpgrade = processDoubleConversionTrimmed(\n this.trimmed,\n firstLevelMap,\n secondLevelMap,\n );\n for (let type in trimemedOptionsToUpgrade) {\n this.revogrid.addTrimmed(trimemedOptionsToUpgrade[type], type);\n }\n\n // const emptyGroups = this.filterOutEmptyGroups(trimemedOptionsToUpgrade, childrenByGroup);\n\n // setup trimmed data for grouping\n this.revogrid.addTrimmed({ ...trimmedGroup }, TRIMMED_GROUPING);\n }\n}\n"]}
@@ -11,7 +11,7 @@ function getGroupValueDefault(item, prop) {
11
11
  * @param groupIds - ids of groups
12
12
  * @param expanded - potentially expanded items if present
13
13
  */
14
- export function gatherGrouping(array, groupIds, { prevExpanded, expandedAll, getGroupValue = getGroupValueDefault }) {
14
+ export function gatherGrouping(array, groupIds, { prevExpanded, expandedAll, getGroupValue = getGroupValueDefault, }) {
15
15
  const groupedItems = new Map();
16
16
  array.forEach((item, originalIndex) => {
17
17
  const groupLevelValues = groupIds.map(groupId => getGroupValue(item, groupId));
@@ -90,7 +90,7 @@ export function getGroupingName(rgRow) {
90
90
  return rgRow && rgRow[PSEUDO_GROUP_ITEM];
91
91
  }
92
92
  export function isGrouping(rgRow) {
93
- return rgRow && typeof rgRow[PSEUDO_GROUP_ITEM] !== 'undefined';
93
+ return typeof (rgRow === null || rgRow === void 0 ? void 0 : rgRow[PSEUDO_GROUP_ITEM]) !== 'undefined';
94
94
  }
95
95
  export function isGroupingColumn(column) {
96
96
  return column && typeof column[PSEUDO_GROUP_COLUMN] !== 'undefined';
@@ -1 +1 @@
1
- {"version":3,"file":"grouping.service.js","sourceR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C,CAAC;IAClE,IAAI,CAAC,SAAS,EAAE,CAAC;QACf,OAAO,KAAK,CAAC;IACf,CAAC;IAED,MAAM,KAAK,GAAG,iBAAiB,CAAC,YAAY,EAAE,SAAS,CAAC,CAAC;IACzD,OAAO,YAAY,CAAC,WAAW,CAAC,GAAG,KAAK,CAAC;AAC3C,CAAC","sourcesContent":["import { DataType, ColumnProp, ColumnRegular } from '@type';\nimport {\n GROUP_DEPTH,\n GROUP_EXPANDED,\n PSEUDO_GROUP_COLUMN,\n PSEUDO_GROUP_ITEM,\n PSEUDO_GROUP_ITEM_ID,\n PSEUDO_GROUP_ITEM_VALUE,\n GROUP_ORIGINAL_INDEX,\n} from './grouping.const';\nimport { GroupLabelTemplateFunc } from './grouping.row.types';\n\nexport type ExpandedOptions = {\n prevExpanded?: Record<string, boolean>;\n expandedAll?: boolean; // skip trim\n\n getGroupValue?(item: DataType, prop: string | number): any;\n groupLabelTemplate?: GroupLabelTemplateFunc;\n};\n\ntype GroupedData = Map<string, GroupedData | DataType[]>;\n\nfunction getGroupValueDefault(item: DataType, prop: string | number) {\n return item[prop] || null;\n}\n\n\n/**\n * Gather data for grouping\n * @param array - flat data array\n * @param groupIds - ids of groups\n * @param expanded - potentially expanded items if present\n */\nexport function gatherGrouping(\n array: DataType[],\n groupIds: ColumnProp[],\n { prevExpanded, expandedAll, getGroupValue = getGroupValueDefault }: ExpandedOptions,\n) {\n const groupedItems: GroupedData = new Map();\n array.forEach((item, originalIndex) => {\n const groupLevelValues = groupIds.map(groupId => getGroupValue(item, groupId));\n const lastLevelValue = groupLevelValues.pop();\n let currentGroupLevel = groupedItems;\n groupLevelValues.forEach(value => {\n if (!currentGroupLevel.has(value)) {\n currentGroupLevel.set(value, new Map());\n }\n currentGroupLevel = currentGroupLevel.get(value) as GroupedData;\n });\n if (!currentGroupLevel.has(lastLevelValue)) {\n currentGroupLevel.set(lastLevelValue, []);\n }\n const lastLevelItems = currentGroupLevel.get(\n lastLevelValue,\n ) as DataType[];\n lastLevelItems.push({\n ...item,\n [GROUP_ORIGINAL_INDEX]: originalIndex,\n });\n });\n\n let itemIndex = -1;\n const groupingDepth = groupIds.length;\n // collapse all groups in the beginning\n const trimmed: Record<number, boolean> = {};\n // index mapping\n const oldNewIndexMap: Record<number, number> = {};\n // check if group header exists\n const pseudoGroupTest: Record<string, number[]> = {};\n const sourceWithGroups: DataType[] = [];\n function flattenGroupMaps(\n groupedValues: GroupedData,\n parentIds: string[],\n isExpanded: boolean,\n ) {\n const depth = parentIds.length;\n groupedValues.forEach((innerGroupedValues, groupId) => {\n const levelIds = [...parentIds, groupId];\n const mergedIds = levelIds.join(',');\n const isGroupExpanded =\n isExpanded && (!!expandedAll || !!prevExpanded?.[mergedIds]);\n sourceWithGroups.push({\n [PSEUDO_GROUP_ITEM]: groupId,\n [GROUP_DEPTH]: depth,\n [PSEUDO_GROUP_ITEM_ID]: JSON.stringify(levelIds),\n [PSEUDO_GROUP_ITEM_VALUE]: mergedIds,\n [GROUP_EXPANDED]: isGroupExpanded,\n });\n itemIndex += 1;\n if (!isGroupExpanded && depth) {\n trimmed[itemIndex] = true;\n }\n if (Array.isArray(innerGroupedValues)) {\n innerGroupedValues.forEach(value => {\n itemIndex += 1;\n if (!isGroupExpanded) {\n trimmed[itemIndex] = true;\n }\n oldNewIndexMap[value[GROUP_ORIGINAL_INDEX]] = itemIndex;\n const pseudoGroupTestIds = levelIds.map((_value, index) =>\n levelIds.slice(0, index + 1).join(','),\n );\n pseudoGroupTestIds.forEach(pseudoGroupTestId => {\n if (!pseudoGroupTest[pseudoGroupTestId]) {\n pseudoGroupTest[pseudoGroupTestId] = [];\n }\n pseudoGroupTest[pseudoGroupTestId].push(itemIndex);\n });\n });\n sourceWithGroups.push(...innerGroupedValues);\n } else {\n flattenGroupMaps(innerGroupedValues, levelIds, isGroupExpanded);\n }\n });\n }\n flattenGroupMaps(groupedItems, [], true);\n\n return {\n sourceWithGroups, // updates source mirror\n depth: groupingDepth, // largest depth for grouping\n trimmed, // used for expand/collapse grouping values\n oldNewIndexMap, // used for mapping old values to new\n childrenByGroup: pseudoGroupTest, // used to get child items in group\n };\n}\n\nexport function getGroupingName(rgRow?: DataType) {\n return rgRow && rgRow[PSEUDO_GROUP_ITEM];\n}\n\nexport function isGrouping(rgRow?: DataType) {\n return rgRow && typeof rgRow[PSEUDO_GROUP_ITEM] !== 'undefined';\n}\n\nexport function isGroupingColumn(column?: ColumnRegular) {\n return column && typeof column[PSEUDO_GROUP_COLUMN] !== 'undefined';\n}\n\nexport function measureEqualDepth<T>(groupA: T[], groupB: T[]) {\n const ln = groupA.length;\n let i = 0;\n for (; i < ln; i++) {\n if (groupA[i] !== groupB[i]) {\n return i;\n }\n }\n return i;\n}\n\nexport function getParsedGroup(id: string){\n const parseGroup = JSON.parse(id);\n // extra precaution and type safeguard\n if (!Array.isArray(parseGroup)) {\n return null;\n }\n return parseGroup;\n}\n\n// check if items is child of current clicked group\nexport function isSameGroup(\n currentGroup: any[],\n currentModel: DataType,\n nextModel: DataType,\n) {\n const nextGroup = getParsedGroup(nextModel[PSEUDO_GROUP_ITEM_ID]);\n if (!nextGroup) {\n return false;\n }\n\n const depth = measureEqualDepth(currentGroup, nextGroup);\n return currentModel[GROUP_DEPTH] < depth;\n}\n"]}
1
+ {"version":3,"file":"grouping.service.js","sourceRoot":"","sources":["../../../src/plugins/groupingRow/grouping.service.ts"],"names":[],"mappings":"AACA,OAAO,EACL,WAAW,EACX,cAAc,EACd,mBAAmB,EACnB,iBAAiB,EACjB,oBAAoB,EACpB,uBAAuB,EACvB,oBAAoB,GACrB,MAAM,kBAAkB,CAAC;AAa1B,SAAS,oBAAoB,CAAC,IAAc,EAAE,IAAqB;IACjE,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC;AAC5B,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,cAAc,CAC5B,KAAiB,EACjB,QAAsB,EACtB,EACE,YAAY,EACZ,WAAW,EACX,aAAa,GAAG,oBA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E,\n GROUP_ORIGINAL_INDEX,\n} from './grouping.const';\nimport { GroupLabelTemplateFunc } from './grouping.row.types';\n\nexport type ExpandedOptions = {\n prevExpanded?: Record<string, boolean>;\n expandedAll?: boolean; // skip trim\n\n getGroupValue?(item: DataType, prop: string | number): any;\n groupLabelTemplate?: GroupLabelTemplateFunc;\n};\n\ntype GroupedData = Map<string, GroupedData | DataType[]>;\n\nfunction getGroupValueDefault(item: DataType, prop: string | number) {\n return item[prop] || null;\n}\n\n/**\n * Gather data for grouping\n * @param array - flat data array\n * @param groupIds - ids of groups\n * @param expanded - potentially expanded items if present\n */\nexport function gatherGrouping(\n array: DataType[],\n groupIds: ColumnProp[],\n {\n prevExpanded,\n expandedAll,\n getGroupValue = getGroupValueDefault,\n }: ExpandedOptions,\n) {\n const groupedItems: GroupedData = new Map();\n array.forEach((item, originalIndex) => {\n const groupLevelValues = groupIds.map(groupId =>\n getGroupValue(item, groupId),\n );\n const lastLevelValue = groupLevelValues.pop();\n let currentGroupLevel = groupedItems;\n groupLevelValues.forEach(value => {\n if (!currentGroupLevel.has(value)) {\n currentGroupLevel.set(value, new Map());\n }\n currentGroupLevel = currentGroupLevel.get(value) as GroupedData;\n });\n if (!currentGroupLevel.has(lastLevelValue)) {\n currentGroupLevel.set(lastLevelValue, []);\n }\n const lastLevelItems = currentGroupLevel.get(lastLevelValue) as DataType[];\n lastLevelItems.push({\n ...item,\n [GROUP_ORIGINAL_INDEX]: originalIndex,\n });\n });\n\n let itemIndex = -1;\n const groupingDepth = groupIds.length;\n // collapse all groups in the beginning\n const trimmed: Record<number, boolean> = {};\n // index mapping\n const oldNewIndexMap: Record<number, number> = {};\n // check if group header exists\n const pseudoGroupTest: Record<string, number[]> = {};\n const sourceWithGroups: DataType[] = [];\n function flattenGroupMaps(\n groupedValues: GroupedData,\n parentIds: string[],\n isExpanded: boolean,\n ) {\n const depth = parentIds.length;\n groupedValues.forEach((innerGroupedValues, groupId) => {\n const levelIds = [...parentIds, groupId];\n const mergedIds = levelIds.join(',');\n const isGroupExpanded =\n isExpanded && (!!expandedAll || !!prevExpanded?.[mergedIds]);\n sourceWithGroups.push({\n [PSEUDO_GROUP_ITEM]: groupId,\n [GROUP_DEPTH]: depth,\n [PSEUDO_GROUP_ITEM_ID]: JSON.stringify(levelIds),\n [PSEUDO_GROUP_ITEM_VALUE]: mergedIds,\n [GROUP_EXPANDED]: isGroupExpanded,\n });\n itemIndex += 1;\n if (!isGroupExpanded && depth) {\n trimmed[itemIndex] = true;\n }\n if (Array.isArray(innerGroupedValues)) {\n innerGroupedValues.forEach(value => {\n itemIndex += 1;\n if (!isGroupExpanded) {\n trimmed[itemIndex] = true;\n }\n oldNewIndexMap[value[GROUP_ORIGINAL_INDEX]] = itemIndex;\n const pseudoGroupTestIds = levelIds.map((_value, index) =>\n levelIds.slice(0, index + 1).join(','),\n );\n pseudoGroupTestIds.forEach(pseudoGroupTestId => {\n if (!pseudoGroupTest[pseudoGroupTestId]) {\n pseudoGroupTest[pseudoGroupTestId] = [];\n }\n pseudoGroupTest[pseudoGroupTestId].push(itemIndex);\n });\n });\n sourceWithGroups.push(...innerGroupedValues);\n } else {\n flattenGroupMaps(innerGroupedValues, levelIds, isGroupExpanded);\n }\n });\n }\n flattenGroupMaps(groupedItems, [], true);\n\n return {\n sourceWithGroups, // updates source mirror\n depth: groupingDepth, // largest depth for grouping\n trimmed, // used for expand/collapse grouping values\n oldNewIndexMap, // used for mapping old values to new\n childrenByGroup: pseudoGroupTest, // used to get child items in group\n };\n}\n\nexport function getGroupingName(rgRow?: DataType) {\n return rgRow && rgRow[PSEUDO_GROUP_ITEM];\n}\n\ntype GroupingItem = {\n [PSEUDO_GROUP_ITEM]: string;\n [GROUP_EXPANDED]: boolean;\n [PSEUDO_GROUP_ITEM_VALUE]: string;\n [GROUP_DEPTH]: number;\n};\n\nexport function isGrouping(rgRow?: DataType): rgRow is GroupingItem {\n return typeof rgRow?.[PSEUDO_GROUP_ITEM] !== 'undefined';\n}\n\nexport function isGroupingColumn(column?: ColumnRegular) {\n return column && typeof column[PSEUDO_GROUP_COLUMN] !== 'undefined';\n}\n\nexport function measureEqualDepth<T>(groupA: T[], groupB: T[]) {\n const ln = groupA.length;\n let i = 0;\n for (; i < ln; i++) {\n if (groupA[i] !== groupB[i]) {\n return i;\n }\n }\n return i;\n}\n\nexport function getParsedGroup(id: string) {\n const parseGroup = JSON.parse(id);\n // extra precaution and type safeguard\n if (!Array.isArray(parseGroup)) {\n return null;\n }\n return parseGroup;\n}\n\n// check if items is child of current clicked group\nexport function isSameGroup(\n currentGroup: any[],\n currentModel: DataType,\n nextModel: DataType,\n) {\n const nextGroup = getParsedGroup(nextModel[PSEUDO_GROUP_ITEM_ID]);\n if (!nextGroup) {\n return false;\n }\n\n const depth = measureEqualDepth(currentGroup, nextGroup);\n return currentModel[GROUP_DEPTH] < depth;\n}\n"]}
@@ -0,0 +1,79 @@
1
+ /*!
2
+ * Built by Revolist OU ❤️
3
+ */
4
+ import { BasePlugin } from "../base.plugin";
5
+ /**
6
+ * WCAG Plugin is responsible for enhancing the accessibility features of the RevoGrid component.
7
+ * It ensures that the grid is fully compliant with Web Content Accessibility Guidelines (WCAG) 2.1.
8
+ * This plugin should be the last plugin you add, as it modifies the grid's default behavior.
9
+ *
10
+ * The WCAG Plugin performs the following tasks:
11
+ * - Sets the 'dir' attribute to 'ltr' for left-to-right text direction.
12
+ * - Sets the 'role' attribute to 'treegrid' for treelike hierarchical structure.
13
+ * - Sets the 'aria-keyshortcuts' attribute to 'Enter' and 'Esc' for keyboard shortcuts.
14
+ * - Adds event listeners for keyboard navigation and editing.
15
+ *
16
+ * By default, the plugin adds ARIA roles and properties to the grid elements, providing semantic information
17
+ * for assistive technologies. These roles include 'grid', 'row', and 'gridcell'. The plugin also sets
18
+ * ARIA attributes such as 'aria-rowindex', 'aria-colindex', and 'aria-selected'.
19
+ *
20
+ * The WCAG Plugin ensures that the grid is fully functional and usable for users with various disabilities,
21
+ * including visual impairments, deaf-blindness, and cognitive disabilities.
22
+ *
23
+ * Note: The WCAG Plugin should be added as the last plugin in the list of plugins, as it modifies the grid's
24
+ * default behavior and may conflict with other plugins if added earlier.
25
+ */
26
+ export class WCAGPlugin extends BasePlugin {
27
+ constructor(revogrid, providers) {
28
+ super(revogrid, providers);
29
+ revogrid.setAttribute('dir', 'ltr');
30
+ revogrid.setAttribute('role', 'treegrid');
31
+ revogrid.setAttribute('aria-keyshortcuts', 'Enter');
32
+ revogrid.setAttribute('aria-multiselectable', 'true');
33
+ revogrid.setAttribute('tabindex', '0');
34
+ /**
35
+ * Before Columns Set Event
36
+ */
37
+ this.addEventListener('beforecolumnsset', ({ detail }) => {
38
+ const columns = [
39
+ ...detail.columns.colPinStart,
40
+ ...detail.columns.rgCol,
41
+ ...detail.columns.colPinEnd,
42
+ ];
43
+ revogrid.setAttribute('aria-colcount', `${columns.length}`);
44
+ columns.forEach((column, index) => {
45
+ const { columnProperties, cellProperties } = column;
46
+ column.columnProperties = (...args) => {
47
+ const result = (columnProperties === null || columnProperties === void 0 ? void 0 : columnProperties(...args)) || {};
48
+ result.role = 'columnheader';
49
+ result['aria-colindex'] = index;
50
+ return result;
51
+ };
52
+ column.cellProperties = (...args) => {
53
+ const columnProps = (cellProperties === null || cellProperties === void 0 ? void 0 : cellProperties(...args)) || {};
54
+ return Object.assign({ role: 'gridcell', ['aria-colindex']: index, ['aria-rowindex']: args[0].rowIndex, ['tabindex']: -1 }, columnProps);
55
+ };
56
+ });
57
+ });
58
+ /**
59
+ * Before Row Set Event
60
+ */
61
+ this.addEventListener('beforesourceset', ({ detail, }) => {
62
+ revogrid.setAttribute('aria-rowcount', `${detail.source.length}`);
63
+ });
64
+ this.addEventListener('beforerowrender', ({ detail, }) => {
65
+ detail.node.$attrs$ = Object.assign(Object.assign({}, detail.node.$attrs$), { role: 'row', ['aria-rowindex']: detail.item.itemIndex });
66
+ });
67
+ // focuscell
68
+ this.addEventListener('afterfocus', async (e) => {
69
+ if (e.defaultPrevented) {
70
+ return;
71
+ }
72
+ const el = this.revogrid.querySelector(`revogr-data[type="${e.detail.rowType}"][col-type="${e.detail.colType}"] [data-rgrow="${e.detail.rowIndex}"][data-rgcol="${e.detail.colIndex}"]`);
73
+ if (el instanceof HTMLElement) {
74
+ el.focus();
75
+ }
76
+ });
77
+ }
78
+ }
79
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/plugins/wcag/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAG5C;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,OAAO,UAAW,SAAQ,UAAU;IACxC,YAAY,QAA6B,EAAE,SAA0B;QACnE,KAAK,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC;QAE3B,QAAQ,CAAC,YAAY,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;QACpC,QAAQ,CAAC,YAAY,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;QAC1C,QAAQ,CAAC,YAAY,CAAC,mBAAmB,EAAE,OAAO,CAAC,CAAC;QACpD,QAAQ,CAAC,YAAY,CAAC,sBAAsB,EAAE,MAAM,CAAC,CAAC;QACtD,QAAQ,CAAC,YAAY,CAAC,UAAU,EAAE,GAAG,CAAC,CAAC;QAEvC;;WAEG;QACH,IAAI,CAAC,gBAAgB,CACnB,kBAAkB,EAClB,CAAC,EAAE,MAAM,EAAiC,EAAE,EAAE;YAC5C,MAAM,OAAO,GAAG;gBACd,GAAG,MAAM,CAAC,OAAO,CAAC,WAAW;gBAC7B,GAAG,MAAM,CAAC,OAAO,CAAC,KAAK;gBACvB,GAAG,MAAM,CAAC,OAAO,CAAC,SAAS;aAC5B,CAAC;YAEF,QAAQ,CAAC,YAAY,CAAC,eAAe,EAAE,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;YAE5D,OAAO,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE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Ae,CAAC,EAAE,MAAM,CAAC,IAAI,CAAC,SAAS,GACzC,CAAC;QACJ,CAAC,CACF,CAAC;QAEF,YAAY;QACZ,IAAI,CAAC,gBAAgB,CACnB,YAAY,EACZ,KAAK,EACH,CAA4D,EAC5D,EAAE;YACF,IAAI,CAAC,CAAC,gBAAgB,EAAE,CAAC;gBACvB,OAAO;YACT,CAAC;YACD,MAAM,EAAE,GAAG,IAAI,CAAC,QAAQ,CAAC,aAAa,CACpC,qBAAqB,CAAC,CAAC,MAAM,CAAC,OAAO,gBAAgB,CAAC,CAAC,MAAM,CAAC,OAAO,mBAAmB,CAAC,CAAC,MAAM,CAAC,QAAQ,kBAAkB,CAAC,CAAC,MAAM,CAAC,QAAQ,IAAI,CACjJ,CAAC;YACF,IAAI,EAAE,YAAY,WAAW,EAAE,CAAC;gBAC9B,EAAE,CAAC,KAAK,EAAE,CAAC;YACb,CAAC;QACH,CAAC,CACF,CAAC;IACJ,CAAC;CACF","sourcesContent":["import { PluginProviders } from '@type';\nimport { BasePlugin } from '../base.plugin';\nimport { ColumnCollection } from 'src/utils';\n\n/**\n * WCAG Plugin is responsible for enhancing the accessibility features of the RevoGrid component.\n * It ensures that the grid is fully compliant with Web Content Accessibility Guidelines (WCAG) 2.1.\n * This plugin should be the last plugin you add, as it modifies the grid's default behavior.\n *\n * The WCAG Plugin performs the following tasks:\n * - Sets the 'dir' attribute to 'ltr' for left-to-right text direction.\n * - Sets the 'role' attribute to 'treegrid' for treelike hierarchical structure.\n * - Sets the 'aria-keyshortcuts' attribute to 'Enter' and 'Esc' for keyboard shortcuts.\n * - Adds event listeners for keyboard navigation and editing.\n *\n * By default, the plugin adds ARIA roles and properties to the grid elements, providing semantic information\n * for assistive technologies. These roles include 'grid', 'row', and 'gridcell'. The plugin also sets\n * ARIA attributes such as 'aria-rowindex', 'aria-colindex', and 'aria-selected'.\n *\n * The WCAG Plugin ensures that the grid is fully functional and usable for users with various disabilities,\n * including visual impairments, deaf-blindness, and cognitive disabilities.\n *\n * Note: The WCAG Plugin should be added as the last plugin in the list of plugins, as it modifies the grid's\n * default behavior and may conflict with other plugins if added earlier.\n */\nexport class WCAGPlugin extends BasePlugin {\n constructor(revogrid: HTMLRevoGridElement, providers: PluginProviders) {\n super(revogrid, providers);\n\n revogrid.setAttribute('dir', 'ltr');\n revogrid.setAttribute('role', 'treegrid');\n revogrid.setAttribute('aria-keyshortcuts', 'Enter');\n revogrid.setAttribute('aria-multiselectable', 'true');\n revogrid.setAttribute('tabindex', '0');\n\n /**\n * Before Columns Set Event\n */\n this.addEventListener(\n 'beforecolumnsset',\n ({ detail }: CustomEvent<ColumnCollection>) => {\n const columns = [\n ...detail.columns.colPinStart,\n ...detail.columns.rgCol,\n ...detail.columns.colPinEnd,\n ];\n\n revogrid.setAttribute('aria-colcount', `${columns.length}`);\n\n columns.forEach((column, index) => {\n const { columnProperties, cellProperties } = column;\n\n column.columnProperties = (...args) => {\n const result = columnProperties?.(...args) || {};\n\n result.role = 'columnheader';\n result['aria-colindex'] = index;\n\n return result;\n };\n\n column.cellProperties = (...args) => {\n const columnProps = cellProperties?.(...args) || {};\n\n return {\n role: 'gridcell',\n ['aria-colindex']: index,\n ['aria-rowindex']: args[0].rowIndex,\n ['tabindex']: -1,\n ...columnProps,\n };\n };\n });\n },\n );\n\n /**\n * Before Row Set Event\n */\n this.addEventListener(\n 'beforesourceset',\n ({\n detail,\n }: CustomEvent<HTMLRevoGridElementEventMap['beforesourceset']>) => {\n revogrid.setAttribute('aria-rowcount', `${detail.source.length}`);\n },\n );\n this.addEventListener(\n 'beforerowrender',\n ({\n detail,\n }: CustomEvent<HTMLRevogrDataElementEventMap['beforerowrender']>) => {\n detail.node.$attrs$ = {\n ...detail.node.$attrs$,\n role: 'row',\n ['aria-rowindex']: detail.item.itemIndex,\n };\n },\n );\n\n // focuscell\n this.addEventListener(\n 'afterfocus',\n async (\n e: CustomEvent<HTMLRevogrFocusElementEventMap['afterfocus']>,\n ) => {\n if (e.defaultPrevented) {\n return;\n }\n const el = this.revogrid.querySelector(\n `revogr-data[type=\"${e.detail.rowType}\"][col-type=\"${e.detail.colType}\"] [data-rgrow=\"${e.detail.rowIndex}\"][data-rgcol=\"${e.detail.colIndex}\"]`,\n );\n if (el instanceof HTMLElement) {\n el.focus();\n }\n },\n );\n }\n}\n"]}
@@ -101,7 +101,8 @@ export function setSourceByVirtualIndex(store, modelByIndex, mutate = true) {
101
101
  const source = store.get('source');
102
102
  for (let virtualIndex in modelByIndex) {
103
103
  const realIndex = items[virtualIndex];
104
- source[realIndex] = modelByIndex[virtualIndex];
104
+ const item = modelByIndex[virtualIndex];
105
+ source[realIndex] = item;
105
106
  }
106
107
  if (mutate) {
107
108
  store.set('source', [...source]);
@@ -1 +1 @@
1
- {"version":3,"file":"data.store.js","sourceRoot":"","sources":["../../../src/store/dataSource/data.store.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,kBAAkB,CAAC;AACzC,OAAO,KAAK,MAAM,cAAc,CAAC;AACjC,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C,OAAO,EAAW,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAC1D,OAAO,EAAE,QAAQ,EAAc,MAAM,yBAAyB,CAAC;AAC/D,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AA4B3C;;;GAGG;AACH,MAAM,OAAO,SAAS;IAEpB,IAAI,KAAK;QACP,OAAO,IAAI,CAAC,SAAS,CAAC;IACxB,CAAC;IACD,YAAY,IAAQ,EAAE,SAA+B;QACnD,MAAM,KAAK,GAAG,CAAC,IAAI,CAAC,SAAS,GAAG,WAAW,iBACzC,KAAK,EAAE,EAAE,EACT,UAAU,EAAE,EAAE,EACd,MAAM,EAAE,EAAE,EACV,aAAa,EAAE,CAAC,EAChB,MAAM,EAAE,EAAE,EACV,IAAI,EACJ,OAAO,EAAE,EAAE,EACX,sBAAsB,EAAE,SAAS,IAC9B,SAAS,EACZ,CAAC,CAAC;QACJ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ClD,OAAO,KAAK,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC;AACtC,CAAC","sourcesContent":["import findIndex from 'lodash/findIndex';\nimport range from 'lodash/range';\nimport { createStore } from '@stencil/store';\n\nimport { Trimmed, trimmedPlugin } from './trimmed.plugin';\nimport { setStore, Observable } from '../../utils/store.utils';\nimport { proxyPlugin } from './data.proxy';\nimport { GroupLabelTemplateFunc } from '../../plugins/groupingRow/grouping.row.types';\nimport { DimensionRows, DimensionCols } from '@type';\nimport type {\n ColumnProperties,\n ColumnGrouping,\n ColumnRegular,\n DataType,\n DataSourceState,\n ColumnProp,\n} from '@type';\n\nexport interface Group extends ColumnProperties {\n name: string;\n children: (ColumnGrouping | ColumnRegular)[];\n // props/ids\n ids: (string | number)[];\n}\nexport type Groups = Record<any, any>;\nexport type GDataType = DataType | ColumnRegular;\nexport type GDimension = DimensionRows | DimensionCols;\nexport type DSourceState<\n T1 extends GDataType,\n T2 extends GDimension,\n> = DataSourceState<T1, T2> & {\n groupingCustomRenderer?: GroupLabelTemplateFunc | null;\n};\n\n/**\n * Data store\n * Manage the state of a data source and provide methods for updating, adding, and refreshing the data.\n */\nexport class DataStore<T extends GDataType, ST extends GDimension> {\n private readonly dataStore: Observable<DSourceState<T, ST>>;\n get store(): Observable<DSourceState<T, ST>> {\n return this.dataStore;\n }\n constructor(type: ST, storeData?: DSourceState<T, ST>) {\n const store = (this.dataStore = createStore<DSourceState<T, ST>>({\n items: [],\n proxyItems: [],\n source: [],\n groupingDepth: 0,\n groups: {},\n type,\n trimmed: {},\n groupingCustomRenderer: undefined,\n ...storeData,\n }));\n store.use(proxyPlugin(store));\n store.use(trimmedPlugin(store));\n }\n\n /**\n * full data source update\n * @param source - data column/rgRow source\n * @param grouping - grouping information if present\n */\n updateData(\n source: T[],\n grouping?: {\n depth: number;\n groups?: Groups;\n customRenderer?: GroupLabelTemplateFunc;\n },\n silent = false,\n ) {\n // during full update we do drop trim\n if (!silent) {\n this.store.set('trimmed', {});\n }\n // clear items\n this.store.set('items', []);\n const items = range(0, source?.length || 0);\n\n // set proxy first\n setStore(this.store, {\n source,\n proxyItems: [...items],\n });\n // update data items\n this.store.set('items', items);\n // apply grouping if present\n if (grouping) {\n setStore(this.store, {\n groupingDepth: grouping.depth,\n groups: grouping.groups,\n groupingCustomRenderer: grouping.customRenderer,\n });\n }\n }\n\n addTrimmed(some: Partial<Trimmed>) {\n let trimmed = this.store.get('trimmed');\n trimmed = { ...trimmed, ...some };\n setStore(this.store, { trimmed });\n }\n\n // local data update\n setData(input: Partial<DSourceState<T, ST>>) {\n const data: Partial<DSourceState<T, ST>> = {\n ...input,\n };\n setStore(this.store, data);\n }\n\n refresh() {\n const source = this.store.get('source');\n this.store.set('source', [...source]);\n }\n}\n/**\n * get physical index by virtual\n * @param store - store to process\n */\nexport function getPhysical(\n store: Observable<DSourceState<any, any>>,\n virtualIndex: number,\n) {\n const items = store.get('items');\n return items[virtualIndex];\n}\n\n/**\n * get all visible items\n * @param store - store to process\n */\nexport function getVisibleSourceItem(\n store: Observable<DSourceState<any, any>>,\n) {\n const source = store.get('source');\n return store.get('items').map(v => source[v]);\n}\n\n/**\n * get mapped item from source\n * @param store - store to process\n * @param virtualIndex - virtual index to process\n */\nexport const getSourceItem = (\n store: Observable<DSourceState<any, any>>,\n virtualIndex: number,\n): any | undefined => {\n const items = store.get('items');\n const source = store.get('source');\n return source[items[virtualIndex]];\n};\n\n/**\n * Apple item/model/row value to data source\n * @param store - data source with changes\n * @param modelByIndex - collection of rows/values with virtual indexes to setup/replace in store/data source\n * @param mutate - if true, store will be mutated and whole viewport will be re-rendered\n */\nexport function setSourceByVirtualIndex<T extends GDataType>(\n store: Observable<DSourceState<T, any>>,\n modelByIndex: Record<number, T>,\n mutate = true,\n) {\n const items = store.get('items');\n const source = store.get('source');\n\n for (let virtualIndex in modelByIndex) {\n const realIndex = items[virtualIndex];\n source[realIndex] = modelByIndex[virtualIndex];\n }\n if (mutate) {\n store.set('source', [...source]);\n }\n}\n\n/**\n * set item to source\n * @param store - store to process\n * @param modelByIndex - collection of rows with physical indexes to setup\n * @param mutate - if true, store will be mutated and whole viewport will be re-rendered\n */\nexport function setSourceByPhysicalIndex<T extends GDataType>(\n store: Observable<DSourceState<T, any>>,\n modelByIndex: Record<number, T>,\n mutate = true,\n) {\n const source = store.get('source');\n for (let index in modelByIndex) {\n source[index] = modelByIndex[index];\n }\n if (mutate) {\n store.set('source', [...source]);\n }\n}\n\nexport function setItems<T extends GDataType>(\n store: Observable<DSourceState<T, any>>,\n items: number[],\n) {\n store.set('items', items);\n}\n\nexport function getSourceItemVirtualIndexByProp(\n store: Observable<DSourceState<any, any>>,\n prop: ColumnProp,\n) {\n const items = store.get('items');\n const source = store.get('source');\n const physicalIndex = findIndex(source, { prop });\n return items.indexOf(physicalIndex);\n}\n"]}
1
+ {"version":3,"file":"data.store.js","sourceRoot":"","sources":["../../../src/store/dataSource/data.store.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,kBAAkB,CAAC;AACzC,OAAO,KAAK,MAAM,cAAc,CAAC;AACjC,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C,OAAO,EAAW,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAC1D,OAAO,EAAE,QAAQ,EAAc,MAAM,yBAAyB,CAAC;AAC/D,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AA4B3C;;;GAGG;AACH,MAAM,OAAO,SAAS;IAEpB,IAAI,KAAK;QACP,OAAO,IAAI,CAAC,SAAS,CAAC;IACxB,CAAC;IACD,YAAY,IAAQ,EAAE,SAA+B;QACnD,MAAM,KAAK,GAAG,CAAC,IAAI,CAAC,SAAS,GAAG,WAAW,iBACzC,KAAK,EAAE,EAAE,EACT,UAAU,EAAE,EAAE,EACd,MAAM,EAAE,EAAE,EACV,aAAa,EAAE,CAAC,EAChB,MAAM,EAAE,EAAE,EACV,IAAI,EACJ,OAAO,EAAE,EAAE,EACX,sBAAsB,E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;IACnC,MAAM,aAAa,GAAG,SAAS,CAAC,MAAM,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC;IAClD,OAAO,KAAK,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC;AACtC,CAAC","sourcesContent":["import findIndex from 'lodash/findIndex';\nimport range from 'lodash/range';\nimport { createStore } from '@stencil/store';\n\nimport { Trimmed, trimmedPlugin } from './trimmed.plugin';\nimport { setStore, Observable } from '../../utils/store.utils';\nimport { proxyPlugin } from './data.proxy';\nimport { GroupLabelTemplateFunc } from '../../plugins/groupingRow/grouping.row.types';\nimport { DimensionRows, DimensionCols } from '@type';\nimport type {\n ColumnProperties,\n ColumnGrouping,\n ColumnRegular,\n DataType,\n DataSourceState,\n ColumnProp,\n} from '@type';\n\nexport interface Group extends ColumnProperties {\n name: string;\n children: (ColumnGrouping | ColumnRegular)[];\n // props/ids\n ids: (string | number)[];\n}\nexport type Groups = Record<any, any>;\nexport type GDataType = DataType | ColumnRegular;\nexport type GDimension = DimensionRows | DimensionCols;\nexport type DSourceState<\n T1 extends GDataType,\n T2 extends GDimension,\n> = DataSourceState<T1, T2> & {\n groupingCustomRenderer?: GroupLabelTemplateFunc | null;\n};\n\n/**\n * Data store\n * Manage the state of a data source and provide methods for updating, adding, and refreshing the data.\n */\nexport class DataStore<T extends GDataType, ST extends GDimension> {\n private readonly dataStore: Observable<DSourceState<T, ST>>;\n get store(): Observable<DSourceState<T, ST>> {\n return this.dataStore;\n }\n constructor(type: ST, storeData?: DSourceState<T, ST>) {\n const store = (this.dataStore = createStore<DSourceState<T, ST>>({\n items: [],\n proxyItems: [],\n source: [],\n groupingDepth: 0,\n groups: {},\n type,\n trimmed: {},\n groupingCustomRenderer: undefined,\n ...storeData,\n }));\n store.use(proxyPlugin(store));\n store.use(trimmedPlugin(store));\n }\n\n /**\n * full data source update\n * @param source - data column/rgRow source\n * @param grouping - grouping information if present\n */\n updateData(\n source: T[],\n grouping?: {\n depth: number;\n groups?: Groups;\n customRenderer?: GroupLabelTemplateFunc;\n },\n silent = false,\n ) {\n // during full update we do drop trim\n if (!silent) {\n this.store.set('trimmed', {});\n }\n // clear items\n this.store.set('items', []);\n const items = range(0, source?.length || 0);\n\n // set proxy first\n setStore(this.store, {\n source,\n proxyItems: [...items],\n });\n // update data items\n this.store.set('items', items);\n // apply grouping if present\n if (grouping) {\n setStore(this.store, {\n groupingDepth: grouping.depth,\n groups: grouping.groups,\n groupingCustomRenderer: grouping.customRenderer,\n });\n }\n }\n\n addTrimmed(some: Partial<Trimmed>) {\n let trimmed = this.store.get('trimmed');\n trimmed = { ...trimmed, ...some };\n setStore(this.store, { trimmed });\n }\n\n // local data update\n setData(input: Partial<DSourceState<T, ST>>) {\n const data: Partial<DSourceState<T, ST>> = {\n ...input,\n };\n setStore(this.store, data);\n }\n\n refresh() {\n const source = this.store.get('source');\n this.store.set('source', [...source]);\n }\n}\n/**\n * get physical index by virtual\n * @param store - store to process\n */\nexport function getPhysical(\n store: Observable<DSourceState<any, any>>,\n virtualIndex: number,\n) {\n const items = store.get('items');\n return items[virtualIndex];\n}\n\n/**\n * get all visible items\n * @param store - store to process\n */\nexport function getVisibleSourceItem(\n store: Observable<DSourceState<any, any>>,\n) {\n const source = store.get('source');\n return store.get('items').map(v => source[v]);\n}\n\n/**\n * get mapped item from source\n * @param store - store to process\n * @param virtualIndex - virtual index to process\n */\nexport const getSourceItem = <T1 extends GDataType, T2 extends GDimension>(\n store: Observable<DSourceState<T1, T2>>,\n virtualIndex: number,\n) => {\n const items = store.get('items');\n const source = store.get('source');\n return source[items[virtualIndex]];\n};\n\n/**\n * Apple item/model/row value to data source\n * @param store - data source with changes\n * @param modelByIndex - collection of rows/values with virtual indexes to setup/replace in store/data source\n * @param mutate - if true, store will be mutated and whole viewport will be re-rendered\n */\nexport function setSourceByVirtualIndex<T extends GDataType>(\n store: Observable<DSourceState<T, any>>,\n modelByIndex: Record<number, T | undefined>,\n mutate = true,\n) {\n const items = store.get('items');\n const source = store.get('source');\n\n for (let virtualIndex in modelByIndex) {\n const realIndex = items[virtualIndex];\n const item = modelByIndex[virtualIndex];\n source[realIndex] = item as T;\n }\n if (mutate) {\n store.set('source', [...source]);\n }\n}\n\n/**\n * set item to source\n * @param store - store to process\n * @param modelByIndex - collection of rows with physical indexes to setup\n * @param mutate - if true, store will be mutated and whole viewport will be re-rendered\n */\nexport function setSourceByPhysicalIndex<T extends GDataType>(\n store: Observable<DSourceState<T, any>>,\n modelByIndex: Record<number, T>,\n mutate = true,\n) {\n const source = store.get('source');\n for (let index in modelByIndex) {\n source[index] = modelByIndex[index];\n }\n if (mutate) {\n store.set('source', [...source]);\n }\n}\n\nexport function setItems<T extends GDataType>(\n store: Observable<DSourceState<T, any>>,\n items: number[],\n) {\n store.set('items', items);\n}\n\nexport function getSourceItemVirtualIndexByProp(\n store: Observable<DSourceState<any, any>>,\n prop: ColumnProp,\n) {\n const items = store.get('items');\n const source = store.get('source');\n const physicalIndex = findIndex(source, { prop });\n return items.indexOf(physicalIndex);\n}\n"]}
@@ -1,6 +1,2 @@
1
- /*!
2
- * Built by Revolist OU ❤️
3
- */
4
- ;
5
1
  export {};
6
2
  //# sourceMappingURL=interfaces.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../src/types/interfaces.ts"],"names":[],"mappings":"AA+PC,CAAC","sourcesContent":["import type { VNode } from '@stencil/core';\n\nimport {\n DimensionCols,\n DimensionRows,\n DimensionColPin,\n DimensionType,\n MultiDimensionType,\n} from './dimension';\nimport {\n Cell,\n EditorCtr,\n FocusedCells,\n OldNewRangeMapping,\n RangeArea,\n SelectionStoreState,\n} from './selection';\nimport type { Observable } from '../utils/store.utils';\n\nexport type Nullable<T> = {\n [P in keyof T]: T[P] | null;\n};\n\n/**\n * Advanced column data schema model.\n * Used for transpassing data to cell renderer and editor.\n */\nexport type ColumnDataSchemaModel = {\n /**\n * Column prop used for mapping value to cell from data source model/row\n */\n prop: ColumnProp;\n /**\n * Row data object\n */\n model: DataType;\n /**\n * Column data object\n */\n column: ColumnRegular;\n /**\n * Index of the row in the viewport\n */\n rowIndex: number;\n /**\n * Index of the column in the viewport\n */\n colIndex: number;\n /**\n * Column type based on viewport\n */\n colType: DimensionCols;\n /**\n * Row type based on viewport\n */\n type: DimensionRows;\n /**\n * Row models based on viewport\n */\n data: DataType[];\n /**\n * Current cell data\n */\n value: any;\n};\n/**\n * Template property for each cell, extends the column data schema model.\n * Additionally, it provides access to the providers injected into the template.\n */\nexport interface CellTemplateProp extends ColumnDataSchemaModel {\n /**\n * Providers injected into the template\n */\n providers: Providers;\n}\n/**\n * The ReadOnlyFormat type is a boolean value or a function that takes ColumnDataSchemaModel\n * as a parameter and returns a boolean value.\n *\n * If it is a boolean value, it represents whether the cell in question is read-only.\n * If it is a function, it returns whether the cell in question is read-only based on the provided\n * ColumnDataSchemaModel.\n */\nexport type ReadOnlyFormat =\n | boolean\n | ((params: ColumnDataSchemaModel) => boolean);\nexport type RowDrag =\n | boolean\n | {\n (params: ColumnDataSchemaModel): boolean;\n };\n/**\n * `ColumnGrouping` type is used to define a grouping in a column.\n */\nexport type ColumnGrouping<T = any> = {\n /**\n * An array of objects that represent the children of the grouping.\n */\n children: (ColumnGrouping<T> | ColumnRegular)[];\n /**\n * A `DataFormat` object that represents the name of the grouping.\n */\n name: DataFormat<T>;\n};\n/**\n * Configuration for header inner template properties\n */\nexport interface ColumnProperties {\n /**\n * Header inner template\n * Function/component to render custom header content\n */\n columnTemplate?: ColumnTemplateFunc;\n /**\n * Header Cell properties\n * Custom function/component to render header properties\n */\n columnProperties?: ColPropertiesFunc;\n}\n/**\n * Type that represents a collection of column types.\n * The keys are the names of the column types and the values are the corresponding column type objects.\n */\nexport type ColumnTypes = {\n /**\n * The name of the column type.\n */\n [name: string]: ColumnType;\n};\n\n/**\n * Interface for custom cell renderer.\n */\nexport interface CellTemplate {\n // TODO: Add Promise support for template and all custom function so user will be able to use async render on the light speed\n (\n createElement: HyperFunc<VNode>,\n props: CellTemplateProp,\n additionalData?: any,\n ): any;\n}\n/**\n * Interface for regular column definition.\n * Regular column can be any column that is not a grouping column.\n */\nexport interface ColumnType extends ColumnProperties {\n /**\n * Represents whether the column or cell is read-only.\n * Can be a boolean or a function that returns a boolean.\n * The function receives column data as a parameter.\n */\n readonly?: ReadOnlyFormat;\n /**\n * Represents the default column size.\n */\n size?: number;\n /**\n * Represents the minimal column size.\n * This property cannot be less than cell padding\n * in order to keep performance on top and minimize DOM elements number.\n */\n minSize?: number;\n /**\n * Represents the maximum column size.\n */\n maxSize?: number;\n /**\n * Represents a custom editor defined in @editors property.\n * Can be a string or an editor constructor function.\n */\n editor?: string | EditorCtr;\n /**\n * Represents cell properties for custom styling, classes, and events.\n */\n cellProperties?: PropertiesFunc;\n /**\n * Represents the cell template for custom rendering.\n */\n cellTemplate?: CellTemplate;\n /**\n * Represents the cell compare function for custom sorting.\n */\n cellCompare?: CellCompareFunc;\n}\nexport type Order = 'asc' | 'desc' | undefined;\n/**\n * Interface for regular column definition.\n * Regular column can be any column that is not a grouping column.\n * \n */\n/**\n * ColumnRegular interface represents regular column definition.\n * Regular column can be any column that is not a grouping column.\n */\nexport interface ColumnRegular extends ColumnType {\n /**\n * Column prop used for mapping value to cell from data source model/row, used for indexing.\n */\n prop: ColumnProp;\n /**\n * Column pin 'colPinStart'|'colPinEnd'.\n */\n pin?: DimensionColPin;\n /**\n * Column header text.\n */\n name?: any;\n /**\n * Column size would be changed based on space left.\n */\n autoSize?: boolean;\n /**\n * Filter. Require filter plugin to be installed and activated through grid config @filter.\n */\n filter?: boolean | string | string[];\n /**\n * Is column can be sorted, check @cellCompare function for custom sorting.\n */\n sortable?: boolean;\n /**\n * Sort order.\n */\n order?: Order;\n /**\n * Is cell in column or individual can be dragged.\n */\n rowDrag?: RowDrag;\n /**\n * Represents type defined in @columnTypes property through grid config.\n */\n columnType?: string;\n /**\n * Function called before column applied to the store.\n */\n beforeSetup?(rgCol: ColumnRegular): void;\n /**\n * Additional properties can be added to the column definition.\n */\n [key: string]: any;\n}\n\nexport type ColumnData = (ColumnGrouping | ColumnRegular)[];\n/**\n * Column template property.\n * Contains extended properties for column.\n */\nexport interface ColumnTemplateProp extends ColumnRegular {\n /**\n * Providers injected into the template.\n */\n providers: Providers<DimensionCols | 'rowHeaders'>;\n /**\n * Index of the column, used for mapping value to cell from data source model/row.\n */\n index: number;\n};\n\nexport type ColumnPropProp = ColumnGrouping | ColumnTemplateProp;\n// Column prop used for mapping value to cell from data source model/row, used for indexing.\nexport type ColumnProp = string | number;\n\nexport type DataFormat<T = any> = T;\n\nexport type CellProp = string | number | object | boolean | undefined;\n\n/**\n * Additional properties applied to the cell.\n * Contains style object where key is CSS property and value is CSS property value.\n * Contains class object where key is CSS class and value is boolean flag indicating if class should be applied.\n * Contains additional properties for custom cell rendering.\n */\nexport type CellProps = {\n // CSS styles applied to the cell\n style?: {\n [key: string]: string | undefined;\n };\n // CSS classes applied to the cell\n class?:\n | {\n // CSS class name\n [key: string]: boolean;\n }\n | string;\n // Additional properties for custom cell rendering\n [attr: string]: CellProp;\n};\n\n/**\n * Providers for grid which are going to be injected into each cell template\n */\nexport type Providers<T = DimensionRows> = {\n /**\n * Dimension type (e.g. row or column)\n */\n type: T;\n /**\n * Flag indicating if grid is in readonly mode\n */\n readonly: boolean;\n /**\n * Data source store\n */\n data: Observable<DataSourceState<any, any>> | ColumnRegular[];\n /**\n * Viewport store\n */\n viewport: Observable<ViewportState>;\n /**\n * Dimension store\n */\n dimension: Observable<DimensionSettingsState>;\n /**\n * Selection store\n */\n selection: Observable<SelectionStoreState>;\n};\n/**\n * `HyperFunc` is a function that takes an HTML tag or component, and returns a\n * JSX element. This function is used to create JSX elements in a context where\n * JSX is not valid.\n */\nexport interface HyperFunc<T> {\n // (tag: any): T;\n (tag: any): T;\n}\n/**\n * `HyperFunc` is a function that takes an HTML tag or component, and returns a\n * JSX element. This function is used to create JSX elements in a context where\n * JSX is not valid.\n */\nexport interface HyperFunc<T> {\n (tag: any, data: any): T;\n}\n/**\n * `HyperFunc` is a function that takes an HTML tag or component, and returns a\n * JSX element. This function is used to create JSX elements in a context where\n * JSX is not valid.\n */\nexport interface HyperFunc<T> {\n (tag: any, text: string): T;\n}\n\n/**\n * `HyperFunc` is a function that takes an HTML tag or component, and returns a\n * JSX element. This function is used to create JSX elements in a context where\n * JSX is not valid.\n */\nexport interface HyperFunc<T> {\n (sel: any, children: Array<T | undefined | null>): T;\n}\n\n/**\n * `HyperFunc` is a function that takes an HTML tag or component, and returns a\n * JSX element. This function is used to create JSX elements in a context where\n * JSX is not valid.\n */\nexport interface HyperFunc<T> {\n (sel: any, data: any, text: string): T;\n}\n\n/**\n * `HyperFunc` is a function that takes an HTML tag or component, and returns a\n * JSX element. This function is used to create JSX elements in a context where\n * JSX is not valid.\n */\nexport interface HyperFunc<T> {\n (sel: any, data: any, children: Array<T | undefined | null>): T;\n}\n\n/**\n * `HyperFunc` is a function that takes an HTML tag or component, and returns a\n * JSX element. This function is used to create JSX elements in a context where\n * JSX is not valid.\n */\nexport interface HyperFunc<T> {\n (sel: any, data: any, children: T): T;\n}\n/**\n * `FocusTemplateFunc` is a function that takes an HTML tag or component, and\n * returns a JSX element. This function is used to create JSX elements in a\n * context where JSX is not valid.\n */\nexport type FocusTemplateFunc = (\n createElement: HyperFunc<VNode>,\n detail: FocusRenderEvent,\n) => any;\n\n\n/**\n * `CellCompareFunc` is a function that takes the column property to compare,\n * the data of the first cell, and the data of the second cell. It returns a\n * number indicating the relative order of the two cells.\n */\nexport type CellCompareFunc = (\n // The column property to compare.\n prop: ColumnProp,\n // The data of the first cell.\n a: DataType,\n // The data of the second cell.\n b: DataType,\n) => number;\nexport type ColumnTemplateFunc = (\n createElement: HyperFunc<VNode>,\n props: ColumnTemplateProp,\n additionalData?: any,\n) => any;\nexport type PropertiesFunc = (\n props: ColumnDataSchemaModel,\n) => CellProps | void | undefined;\nexport type ColPropertiesFunc = (\n props: ColumnPropProp,\n) => CellProps | void | undefined;\nexport type DataType<D = any> = {\n [T in ColumnProp]: DataFormat<D>;\n};\n\nexport type DataLookup<T = any> = {\n [rowIndex: number]: DataType<T>;\n};\n/**\n * `RowDefinition` is a type that represents a row definition in the\n * viewport.\n */\nexport type RowDefinition = {\n /**\n * The type of the row.\n */\n type: DimensionRows;\n /**\n * The size of the row.\n */\n size: number;\n /**\n * The index of the row.\n */\n index: number;\n};\nexport interface RowHeaders extends ColumnRegular {}\n/**\n * `ViewPortResizeEvent` is an object that contains information about a resize\n * event in the viewport.\n */\nexport type ViewPortResizeEvent = {\n /* The dimension of the viewport being resized. */\n dimension: DimensionType;\n /* The new size of the viewport. */\n size: number;\n /* Indicates whether the resize event is for a row header. */\n rowHeader?: boolean;\n};\n\n/**\n * `ViewPortScrollEvent` is an object that contains information about a scroll\n * event in the viewport.\n */\nexport type ViewPortScrollEvent = {\n /**\n * The dimension of the viewport being scrolled.\n */\n dimension: DimensionType;\n /**\n * The coordinate of the scroll event.\n */\n coordinate: number;\n /**\n * The change in coordinate between scroll events.\n */\n delta?: number;\n /**\n * Indicates whether the scroll event occurred outside the viewport.\n */\n outside?: boolean;\n};\n\n/**\n * `InitialHeaderClick` represents the information needed to handle a click\n * event on the initial column header.\n */\nexport type InitialHeaderClick = {\n /**\n * The index of the column header that was clicked.\n */\n index: number;\n /**\n * The original mouse event that triggered the click.\n */\n originalEvent: MouseEvent;\n /**\n * The column that was clicked.\n */\n column: ColumnRegular;\n providers: Providers<DimensionCols | 'rowHeaders'>;\n};\n\n/**\n * `Range` is an object that represents a range of values.\n */\nexport type Range = {\n /**\n * The start of the range.\n */\n start: number;\n /**\n * The end of the range.\n */\n end: number;\n};\n\n/**\n * `ViewportStateItems` is an object that represents the items in a viewport\n * along with their corresponding range.\n */\nexport type ViewportStateItems = {\n /**\n * The items in the viewport.\n */\n items: VirtualPositionItem[];\n} & Range;\n\n/**\n * `ViewportState` is an object that represents the state of a viewport.\n */\nexport interface ViewportState extends ViewportStateItems {\n /**\n * The number of real items in the viewport.\n */\n realCount: number;\n /**\n * The virtual size of the viewport.\n */\n virtualSize: number;\n}\n\n/**\n * `ViewSettingSizeProp` is a record that maps column or row indexes to their\n * corresponding sizes.\n */\nexport type ViewSettingSizeProp = Record<string, number>;\n\n/**\n * `VirtualPositionItem` is an object that represents a virtual position item\n * in the viewport.\n */\nexport interface VirtualPositionItem extends PositionItem {\n /**\n * The size of the virtual position item.\n */\n size: number;\n}\nexport type DataSourceState<\n T extends DataType | ColumnRegular,\n ST extends DimensionRows | DimensionCols,\n> = {\n // items - index based array for mapping to source tree\n items: number[];\n // all items, used as proxy for sorting, trimming and others manipulations\n proxyItems: number[];\n // original data source\n source: T[];\n // grouping\n groupingDepth: number;\n groups: Record<any, any>;\n // data source type\n type: ST;\n // trim data, to hide entities from visible data source\n trimmed: Record<any, any>;\n};\nexport interface PositionItem {\n itemIndex: number;\n start: number;\n end: number;\n}\n/**\n * Object containing information about calculated dimensions.\n * Used for both columns and rows.\n */\nexport interface DimensionCalc {\n /**\n * Array of indexes of visible items.\n */\n indexes: number[];\n\n /**\n * Count of visible items.\n */\n count: number;\n\n /**\n * Array of indexes of visible items.\n * Used for mapping items to their position in DOM.\n */\n positionIndexes: number[];\n\n /**\n * Mapping of position to item.\n * Used for mapping position in DOM to item.\n */\n positionIndexToItem: {\n /**\n * Position in DOM.\n */\n [position: number]: PositionItem;\n };\n\n /**\n * Mapping of index to item.\n * Used for mapping index in data source to item.\n */\n indexToItem: {\n /**\n * Index in data source.\n */\n [index: number]: PositionItem;\n };\n\n /**\n * Object containing information about trimmed data.\n * Used for hiding entities from visible data source.\n */\n trimmed: Record<any, any>;\n\n /**\n * Object containing size for each visible item.\n */\n sizes: ViewSettingSizeProp;\n}\n/**\n * Represents the settings state of a dimension.\n * It extends the calculation properties of a dimension.\n * It also includes the real size and origin item size of the dimension.\n */\nexport interface DimensionSettingsState extends DimensionCalc {\n /**\n * Represents the real size of the dimension.\n */\n realSize: number;\n\n /**\n * Represents the origin item size of the dimension.\n */\n originItemSize: number;\n}\n\n/**\n * Represents the mapping of dimension types to their corresponding observable stores.\n */\nexport type DimensionStores = {\n [T in MultiDimensionType]: Observable<DimensionSettingsState>;\n};\n\n/**\n * Represents the mapping of dimension types to their corresponding observable stores for the viewport.\n */\nexport type ViewportStores = {\n [T in MultiDimensionType]: Observable<ViewportState>;\n};\n\n/**\n * Represents the event object that is emitted when the drag operation starts.\n */\nexport interface DragStartEvent {\n /**\n * Represents the original mouse event that triggered the drag operation.\n */\n originalEvent: MouseEvent;\n\n /**\n * Represents the model of the column being dragged.\n */\n model: ColumnDataSchemaModel;\n}\n\n/**\n * Represents the event object that is emitted before cell rendering.\n * It includes information about the dimension type, column, row, and model.\n */\nexport interface BeforeCellRenderEvent<T = any> extends AllDimensionType {\n /**\n * Represents the column being rendered.\n */\n column: VirtualPositionItem;\n\n /**\n * Represents the row being rendered.\n */\n row: VirtualPositionItem;\n\n /**\n * Represents the model being rendered.\n */\n model: T;\n}\n\n/**\n * Represents the event object that is emitted before row rendering.\n * It includes information about the dimension type, data item, item, and node.\n */\nexport interface BeforeRowRenderEvent<T = any> extends AllDimensionType {\n /**\n * Represents the data item being rendered.\n */\n model: T;\n\n /**\n * Represents the item being rendered.\n */\n item: VirtualPositionItem;\n\n /**\n * Represents the node being rendered.\n */\n node: VNode;\n}\n\n/**\n * Represents the event object that is emitted after rendering.\n * It includes information about the dimension type.\n */\nexport type AfterRendererEvent = {\n /**\n * Represents the type of dimension being rendered.\n */\n type: DimensionType;\n};\n\n/**\n * Represents the mapping of dimension types to their corresponding dimension types.\n */\nexport interface AllDimensionType {\n /**\n * Represents the dimension type for rows.\n */\n rowType: DimensionRows;\n\n /**\n * Represents the dimension type for columns.\n */\n colType: DimensionCols;\n}\n\n/**\n * Represents the event object that is emitted when applying focus.\n * It includes information about the dimension type and focused cells.\n */\nexport interface ApplyFocusEvent extends AllDimensionType, FocusedCells {}\n\n/**\n * Represents the event object that is emitted before focus rendering.\n * It includes information about the dimension type and range area.\n */\nexport interface FocusRenderEvent extends AllDimensionType {\n /**\n * Represents the range area of the focus.\n */\n range: RangeArea;\n\n /**\n * Changes for the next cell to focus. @example { y: -1 }\n */\n next?: Partial<Cell>;\n}\n/**\n * Represents the event object that is emitted when scrolling occurs.\n * The `type` property indicates the type of dimension (row or column) being scrolled.\n * The `coordinate` property represents the current scroll position in that dimension.\n */\nexport type ScrollCoordinateEvent = {\n /**\n * Represents the type of dimension being scrolled.\n * Possible values are 'rgRow' and 'rgCol'.\n */\n type: DimensionType;\n\n /**\n * Represents the current scroll position in the specified dimension.\n * The value is a number representing the coordinate in pixels.\n */\n coordinate: number;\n};\n\n\n/** Range paste. */\nexport type RangeClipboardPasteEvent = {\n data: DataLookup;\n models: {\n [rowIndex: number]: DataType;\n };\n range: RangeArea | null;\n} & AllDimensionType;\n\n/** Range copy. */\nexport type RangeClipboardCopyEventProps<T = any> = {\n data: DataFormat<T>[][];\n range: RangeArea;\n mapping: OldNewRangeMapping;\n} & AllDimensionType;"]}
1
+ {"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../src/types/interfaces.ts"],"names":[],"mappings":"","sourcesContent":["import type { VNode } from '@stencil/core';\n\nimport {\n DimensionCols,\n DimensionRows,\n DimensionColPin,\n DimensionType,\n MultiDimensionType,\n} from './dimension';\nimport {\n Cell,\n EditorCtr,\n FocusedCells,\n OldNewRangeMapping,\n RangeArea,\n SelectionStoreState,\n} from './selection';\nimport type { Observable } from '../utils/store.utils';\n\nexport type Nullable<T> = {\n [P in keyof T]: T[P] | null;\n};\n\n/**\n * Advanced column data schema model.\n * Used for transpassing data to cell renderer and editor.\n */\nexport type ColumnDataSchemaModel = {\n /**\n * Column prop used for mapping value to cell from data source model/row\n */\n prop: ColumnProp;\n /**\n * Row data object\n */\n model: DataType;\n /**\n * Column data object\n */\n column: ColumnRegular;\n /**\n * Index of the row in the viewport\n */\n rowIndex: number;\n /**\n * Index of the column in the viewport\n */\n colIndex: number;\n /**\n * Column type based on viewport\n */\n colType: DimensionCols;\n /**\n * Row type based on viewport\n */\n type: DimensionRows;\n /**\n * Row models based on viewport\n */\n data: DataType[];\n /**\n * Current cell data\n */\n value: any;\n};\n/**\n * Template property for each cell, extends the column data schema model.\n * Additionally, it provides access to the providers injected into the template.\n */\nexport interface CellTemplateProp extends ColumnDataSchemaModel {\n /**\n * Providers injected into the template\n */\n providers: Providers;\n}\n/**\n * The ReadOnlyFormat type is a boolean value or a function that takes ColumnDataSchemaModel\n * as a parameter and returns a boolean value.\n *\n * If it is a boolean value, it represents whether the cell in question is read-only.\n * If it is a function, it returns whether the cell in question is read-only based on the provided\n * ColumnDataSchemaModel.\n */\nexport type ReadOnlyFormat =\n | boolean\n | ((params: ColumnDataSchemaModel) => boolean);\nexport type RowDrag =\n | boolean\n | {\n (params: ColumnDataSchemaModel): boolean;\n };\n/**\n * `ColumnGrouping` type is used to define a grouping in a column.\n */\nexport type ColumnGrouping<T = any> = {\n /**\n * An array of objects that represent the children of the grouping.\n */\n children: (ColumnGrouping<T> | ColumnRegular)[];\n /**\n * A `DataFormat` object that represents the name of the grouping.\n */\n name: DataFormat<T>;\n};\n/**\n * Configuration for header inner template properties\n */\nexport interface ColumnProperties {\n /**\n * Header inner template\n * Function/component to render custom header content\n */\n columnTemplate?: ColumnTemplateFunc;\n /**\n * Header Cell properties\n * Custom function/component to render header properties\n */\n columnProperties?: ColPropertiesFunc;\n}\n/**\n * Type that represents a collection of column types.\n * The keys are the names of the column types and the values are the corresponding column type objects.\n */\nexport type ColumnTypes = {\n /**\n * The name of the column type.\n */\n [name: string]: ColumnType;\n};\n\n/**\n * Interface for custom cell renderer.\n */\nexport interface CellTemplate {\n // TODO: Add Promise support for template and all custom function so user will be able to use async render on the light speed\n (\n createElement: HyperFunc<VNode>,\n props: CellTemplateProp,\n additionalData?: any,\n ): any;\n}\n/**\n * Interface for regular column definition.\n * Regular column can be any column that is not a grouping column.\n */\nexport interface ColumnType extends ColumnProperties {\n /**\n * Represents whether the column or cell is read-only.\n * Can be a boolean or a function that returns a boolean.\n * The function receives column data as a parameter.\n */\n readonly?: ReadOnlyFormat;\n /**\n * Represents the default column size.\n */\n size?: number;\n /**\n * Represents the minimal column size.\n * This property cannot be less than cell padding\n * in order to keep performance on top and minimize DOM elements number.\n */\n minSize?: number;\n /**\n * Represents the maximum column size.\n */\n maxSize?: number;\n /**\n * Represents a custom editor defined in @editors property.\n * Can be a string or an editor constructor function.\n */\n editor?: string | EditorCtr;\n /**\n * Represents cell properties for custom styling, classes, and events.\n */\n cellProperties?: PropertiesFunc;\n /**\n * Represents the cell template for custom rendering.\n */\n cellTemplate?: CellTemplate;\n /**\n * Represents the cell compare function for custom sorting.\n */\n cellCompare?: CellCompareFunc;\n}\nexport type Order = 'asc' | 'desc' | undefined;\n/**\n * Interface for regular column definition.\n * Regular column can be any column that is not a grouping column.\n *\n */\n/**\n * ColumnRegular interface represents regular column definition.\n * Regular column can be any column that is not a grouping column.\n */\nexport interface ColumnRegular extends ColumnType {\n /**\n * Column prop used for mapping value to cell from data source model/row, used for indexing.\n */\n prop: ColumnProp;\n /**\n * Column pin 'colPinStart'|'colPinEnd'.\n */\n pin?: DimensionColPin;\n /**\n * Column header text.\n */\n name?: any;\n /**\n * Column size would be changed based on space left.\n */\n autoSize?: boolean;\n /**\n * Filter. Require filter plugin to be installed and activated through grid config @filter.\n */\n filter?: boolean | string | string[];\n /**\n * Is column can be sorted, check @cellCompare function for custom sorting.\n */\n sortable?: boolean;\n /**\n * Sort order.\n */\n order?: Order;\n /**\n * Is cell in column or individual can be dragged.\n */\n rowDrag?: RowDrag;\n /**\n * Represents type defined in @columnTypes property through grid config.\n */\n columnType?: string;\n /**\n * Function called before column applied to the store.\n */\n beforeSetup?(rgCol: ColumnRegular): void;\n /**\n * Additional properties can be added to the column definition.\n */\n [key: string]: any;\n}\n\nexport type ColumnData = (ColumnGrouping | ColumnRegular)[];\n/**\n * Column template property.\n * Contains extended properties for column.\n */\nexport interface ColumnTemplateProp extends ColumnRegular {\n /**\n * Providers injected into the template.\n */\n providers: Providers<DimensionCols | 'rowHeaders'>;\n /**\n * Index of the column, used for mapping value to cell from data source model/row.\n */\n index: number;\n}\n\nexport type ColumnPropProp = ColumnGrouping | ColumnTemplateProp;\n// Column prop used for mapping value to cell from data source model/row, used for indexing.\nexport type ColumnProp = string | number;\n\nexport type DataFormat<T = any> = T;\n\nexport type CellProp = string | number | object | boolean | undefined;\n\n/**\n * Additional properties applied to the cell.\n * Contains style object where key is CSS property and value is CSS property value.\n * Contains class object where key is CSS class and value is boolean flag indicating if class should be applied.\n * Contains additional properties for custom cell rendering.\n */\nexport type CellProps = {\n // CSS styles applied to the cell\n style?: {\n [key: string]: string | undefined;\n };\n // CSS classes applied to the cell\n class?:\n | {\n // CSS class name\n [key: string]: boolean;\n }\n | string;\n // Additional properties for custom cell rendering\n [attr: string]: CellProp;\n};\n\n/**\n * Providers for grid which are going to be injected into each cell template\n */\nexport type Providers<T = DimensionRows> = {\n /**\n * Dimension type (e.g. row or column)\n */\n type: T;\n /**\n * Flag indicating if grid is in readonly mode\n */\n readonly: boolean;\n /**\n * Data source store\n */\n data: Observable<DataSourceState<any, any>> | ColumnRegular[];\n /**\n * Viewport store\n */\n viewport: Observable<ViewportState>;\n /**\n * Dimension store\n */\n dimension: Observable<DimensionSettingsState>;\n /**\n * Selection store\n */\n selection: Observable<SelectionStoreState>;\n};\n/**\n * `HyperFunc` is a function that takes an HTML tag or component, and returns a\n * JSX element. This function is used to create JSX elements in a context where\n * JSX is not valid.\n */\nexport interface HyperFunc<T> {\n // (tag: any): T;\n (tag: any): T;\n}\n/**\n * `HyperFunc` is a function that takes an HTML tag or component, and returns a\n * JSX element. This function is used to create JSX elements in a context where\n * JSX is not valid.\n */\nexport interface HyperFunc<T> {\n (tag: any, data: any): T;\n}\n/**\n * `HyperFunc` is a function that takes an HTML tag or component, and returns a\n * JSX element. This function is used to create JSX elements in a context where\n * JSX is not valid.\n */\nexport interface HyperFunc<T> {\n (tag: any, text: string): T;\n}\n\n/**\n * `HyperFunc` is a function that takes an HTML tag or component, and returns a\n * JSX element. This function is used to create JSX elements in a context where\n * JSX is not valid.\n */\nexport interface HyperFunc<T> {\n (sel: any, children: Array<T | undefined | null>): T;\n}\n\n/**\n * `HyperFunc` is a function that takes an HTML tag or component, and returns a\n * JSX element. This function is used to create JSX elements in a context where\n * JSX is not valid.\n */\nexport interface HyperFunc<T> {\n (sel: any, data: any, text: string): T;\n}\n\n/**\n * `HyperFunc` is a function that takes an HTML tag or component, and returns a\n * JSX element. This function is used to create JSX elements in a context where\n * JSX is not valid.\n */\nexport interface HyperFunc<T> {\n (sel: any, data: any, children: Array<T | undefined | null>): T;\n}\n\n/**\n * `HyperFunc` is a function that takes an HTML tag or component, and returns a\n * JSX element. This function is used to create JSX elements in a context where\n * JSX is not valid.\n */\nexport interface HyperFunc<T> {\n (sel: any, data: any, children: T): T;\n}\n/**\n * `FocusTemplateFunc` is a function that takes an HTML tag or component, and\n * returns a JSX element. This function is used to create JSX elements in a\n * context where JSX is not valid.\n */\nexport type FocusTemplateFunc = (\n createElement: HyperFunc<VNode>,\n detail: FocusRenderEvent,\n) => any;\n\n/**\n * `CellCompareFunc` is a function that takes the column property to compare,\n * the data of the first cell, and the data of the second cell. It returns a\n * number indicating the relative order of the two cells.\n */\nexport type CellCompareFunc = (\n // The column property to compare.\n prop: ColumnProp,\n // The data of the first cell.\n a: DataType,\n // The data of the second cell.\n b: DataType,\n) => number;\nexport type ColumnTemplateFunc = (\n createElement: HyperFunc<VNode>,\n props: ColumnTemplateProp,\n additionalData?: any,\n) => any;\nexport type PropertiesFunc = (\n props: ColumnDataSchemaModel,\n) => CellProps | void | undefined;\nexport type ColPropertiesFunc = (\n props: ColumnPropProp,\n) => CellProps | void | undefined;\nexport type DataType<D = any> = {\n [T in ColumnProp]: DataFormat<D>;\n};\n\nexport type DataLookup<T = any> = {\n [rowIndex: number]: DataType<T>;\n};\n/**\n * `RowDefinition` is a type that represents a row definition in the\n * viewport.\n */\nexport type RowDefinition = {\n /**\n * The type of the row.\n */\n type: DimensionRows;\n /**\n * The size of the row.\n */\n size: number;\n /**\n * The index of the row.\n */\n index: number;\n};\nexport interface RowHeaders extends ColumnRegular {}\n/**\n * `ViewPortResizeEvent` is an object that contains information about a resize\n * event in the viewport.\n */\nexport type ViewPortResizeEvent = {\n /* The dimension of the viewport being resized. */\n dimension: DimensionType;\n /* The new size of the viewport. */\n size: number;\n /* Indicates whether the resize event is for a row header. */\n rowHeader?: boolean;\n};\n\n/**\n * `ViewPortScrollEvent` is an object that contains information about a scroll\n * event in the viewport.\n */\nexport type ViewPortScrollEvent = {\n /**\n * The dimension of the viewport being scrolled.\n */\n dimension: DimensionType;\n /**\n * The coordinate of the scroll event.\n */\n coordinate: number;\n /**\n * The change in coordinate between scroll events.\n */\n delta?: number;\n /**\n * Indicates whether the scroll event occurred outside the viewport.\n */\n outside?: boolean;\n};\n\n/**\n * `InitialHeaderClick` represents the information needed to handle a click\n * event on the initial column header.\n */\nexport type InitialHeaderClick = {\n /**\n * The index of the column header that was clicked.\n */\n index: number;\n /**\n * The original mouse event that triggered the click.\n */\n originalEvent: MouseEvent;\n /**\n * The column that was clicked.\n */\n column: ColumnRegular;\n providers: Providers<DimensionCols | 'rowHeaders'>;\n};\n\n/**\n * `Range` is an object that represents a range of values.\n */\nexport type Range = {\n /**\n * The start of the range.\n */\n start: number;\n /**\n * The end of the range.\n */\n end: number;\n};\n\n/**\n * `ViewportStateItems` is an object that represents the items in a viewport\n * along with their corresponding range.\n */\nexport type ViewportStateItems = {\n /**\n * The items in the viewport.\n */\n items: VirtualPositionItem[];\n} & Range;\n\n/**\n * `ViewportState` is an object that represents the state of a viewport.\n */\nexport interface ViewportState extends ViewportStateItems {\n /**\n * The number of real items in the viewport.\n */\n realCount: number;\n /**\n * The virtual size of the viewport.\n */\n virtualSize: number;\n}\n\n/**\n * `ViewSettingSizeProp` is a record that maps column or row indexes to their\n * corresponding sizes.\n */\nexport type ViewSettingSizeProp = Record<string, number>;\n\n/**\n * `VirtualPositionItem` is an object that represents a virtual position item\n * in the viewport.\n */\nexport interface VirtualPositionItem extends PositionItem {\n /**\n * The size of the virtual position item.\n */\n size: number;\n}\nexport type DataSourceState<\n T extends DataType | ColumnRegular,\n ST extends DimensionRows | DimensionCols,\n> = {\n // items - index based array for mapping to source tree\n items: number[];\n // all items, used as proxy for sorting, trimming and others manipulations\n proxyItems: number[];\n // original data source\n source: T[];\n // grouping\n groupingDepth: number;\n groups: Record<any, any>;\n // data source type\n type: ST;\n // trim data, to hide entities from visible data source\n trimmed: Record<any, any>;\n};\nexport interface PositionItem {\n itemIndex: number;\n start: number;\n end: number;\n}\n/**\n * Object containing information about calculated dimensions.\n * Used for both columns and rows.\n */\nexport interface DimensionCalc {\n /**\n * Array of indexes of visible items.\n */\n indexes: number[];\n\n /**\n * Count of visible items.\n */\n count: number;\n\n /**\n * Array of indexes of visible items.\n * Used for mapping items to their position in DOM.\n */\n positionIndexes: number[];\n\n /**\n * Mapping of position to item.\n * Used for mapping position in DOM to item.\n */\n positionIndexToItem: {\n /**\n * Position in DOM.\n */\n [position: number]: PositionItem;\n };\n\n /**\n * Mapping of index to item.\n * Used for mapping index in data source to item.\n */\n indexToItem: {\n /**\n * Index in data source.\n */\n [index: number]: PositionItem;\n };\n\n /**\n * Object containing information about trimmed data.\n * Used for hiding entities from visible data source.\n */\n trimmed: Record<any, any>;\n\n /**\n * Object containing size for each visible item.\n */\n sizes: ViewSettingSizeProp;\n}\n/**\n * Represents the settings state of a dimension.\n * It extends the calculation properties of a dimension.\n * It also includes the real size and origin item size of the dimension.\n */\nexport interface DimensionSettingsState extends DimensionCalc {\n /**\n * Represents the real size of the dimension.\n */\n realSize: number;\n\n /**\n * Represents the origin item size of the dimension.\n */\n originItemSize: number;\n}\n\n/**\n * Represents the mapping of dimension types to their corresponding observable stores.\n */\nexport type DimensionStores = {\n [T in MultiDimensionType]: Observable<DimensionSettingsState>;\n};\n\n/**\n * Represents the mapping of dimension types to their corresponding observable stores for the viewport.\n */\nexport type ViewportStores = {\n [T in MultiDimensionType]: Observable<ViewportState>;\n};\n\n/**\n * Represents the event object that is emitted when the drag operation starts.\n */\nexport interface DragStartEvent {\n /**\n * Represents the original mouse event that triggered the drag operation.\n */\n originalEvent: MouseEvent;\n\n /**\n * Represents the model of the column being dragged.\n */\n model: ColumnDataSchemaModel;\n}\n\n/**\n * Represents the event object that is emitted before cell rendering.\n * It includes information about the dimension type, column, row, and model.\n */\nexport interface BeforeCellRenderEvent<T = any> extends AllDimensionType {\n /**\n * Represents the column being rendered.\n */\n column: VirtualPositionItem;\n\n /**\n * Represents the row being rendered.\n */\n row: VirtualPositionItem;\n\n /**\n * Represents the model being rendered.\n */\n model: T;\n}\n\n/**\n * Represents the event object that is emitted before row rendering.\n * It includes information about the dimension type, data item, item, and node.\n */\nexport interface BeforeRowRenderEvent<T = any> extends AllDimensionType {\n /**\n * Represents the data item being rendered.\n */\n model: T;\n\n /**\n * Represents the item being rendered.\n */\n item: VirtualPositionItem;\n\n /**\n * Represents the node being rendered.\n */\n node: VNode;\n}\n\n/**\n * Represents the event object that is emitted after rendering.\n * It includes information about the dimension type.\n */\nexport type AfterRendererEvent = {\n /**\n * Represents the type of dimension being rendered.\n */\n type: DimensionType;\n};\n\n/**\n * Represents the mapping of dimension types to their corresponding dimension types.\n */\nexport interface AllDimensionType {\n /**\n * Represents the dimension type for rows.\n */\n rowType: DimensionRows;\n\n /**\n * Represents the dimension type for columns.\n */\n colType: DimensionCols;\n}\n\n/**\n * Represents the event object that is emitted when applying focus.\n * It includes information about the dimension type and focused cells.\n */\nexport interface ApplyFocusEvent extends AllDimensionType, FocusedCells {}\n\n/**\n * Represents the event object that is emitted before focus rendering.\n * It includes information about the dimension type and range area.\n */\nexport interface FocusRenderEvent extends AllDimensionType {\n /**\n * Represents the range area of the focus.\n */\n range: RangeArea;\n\n /**\n * Changes for the next cell to focus. @example { y: -1 }\n */\n next?: Partial<Cell>;\n}\n\nexport interface FocusAfterRenderEvent extends AllDimensionType {\n model?: any;\n column?: ColumnRegular;\n /**\n * Index of the row in the viewport\n */\n rowIndex: number;\n /**\n * Index of the column in the viewport\n */\n colIndex: number;\n}\n/**\n * Represents the event object that is emitted when scrolling occurs.\n * The `type` property indicates the type of dimension (row or column) being scrolled.\n * The `coordinate` property represents the current scroll position in that dimension.\n */\nexport type ScrollCoordinateEvent = {\n /**\n * Represents the type of dimension being scrolled.\n * Possible values are 'rgRow' and 'rgCol'.\n */\n type: DimensionType;\n\n /**\n * Represents the current scroll position in the specified dimension.\n * The value is a number representing the coordinate in pixels.\n */\n coordinate: number;\n};\n\n/** Range paste. */\nexport type RangeClipboardPasteEvent = {\n data: DataLookup;\n models: Partial<DataLookup>;\n range: RangeArea | null;\n} & AllDimensionType;\n\n/** Range copy. */\nexport type RangeClipboardCopyEventProps<T = any> = {\n data: DataFormat<T>[][];\n range: RangeArea;\n mapping: OldNewRangeMapping;\n} & AllDimensionType;\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"selection.js","sourceRoot":"","sources":["../../src/types/selection.ts"],"names":[],"mappings":"","sourcesContent":["import { VNode } from '@stencil/core';\nimport { DimensionRows, DimensionCols } from './dimension';\nimport {\n ColumnProp,\n DataType,\n DataLookup,\n HyperFunc,\n ColumnDataSchemaModel,\n} from './interfaces';\n\nexport type RowIndex = number;\nexport type ColIndex = number;\n\n/**\n * Represents the state of the selection store.\n * It contains information about the selection range, temporary range,\n * focused cell, editing cell, last focused cell, and next cell to focus.\n */\nexport type SelectionStoreState = {\n range: RangeArea | null;\n /**\n * Temporary range selection area\n */\n tempRange: RangeArea | null;\n /**\n * Type of the temporary range selection\n */\n tempRangeType: string | null;\n /**\n * Focused cell coordinate\n */\n focus: Cell | null;\n /**\n * Editing cell store\n */\n edit: EditCellStore | null;\n /**\n * Last cell which was focused\n */\n lastCell: Cell | null;\n /**\n * Next cell to focus\n */\n nextFocus: Cell | null;\n};\nexport type RangeArea = {\n x: ColIndex;\n y: RowIndex;\n x1: ColIndex;\n y1: RowIndex;\n};\nexport type TempRange = {\n type: string;\n area: RangeArea;\n};\nexport type OldNewRangeMapping = {\n [rowIndex: number]: {\n [T in ColumnProp]: {\n rowIndex: number;\n colIndex: number;\n colProp: ColumnProp;\n };\n };\n};\nexport type ChangedRange = {\n type: DimensionRows;\n colType: DimensionCols;\n newRange: RangeArea; // new range to apply\n oldRange: RangeArea; // range to copy from\n mapping: OldNewRangeMapping;\n newData: {\n [key: number]: DataType;\n };\n};\n\n/**\n * Cell coordinates\n */\nexport interface Cell {\n x: ColIndex;\n y: RowIndex;\n}\nexport type FocusedCells = {\n focus: Cell;\n end: Cell;\n};\nexport type RangeAreaCss = {\n left: string;\n top: string;\n width: string;\n height: string;\n};\n\nexport type SaveData = string;\nexport type SaveDataDetails = {\n rgRow: RowIndex;\n rgCol: ColIndex;\n type: DimensionRows;\n prop: ColumnProp;\n val: any;\n preventFocus?: boolean;\n};\n\nexport type BeforeEdit = BeforeSaveDataDetails;\n\nexport type BeforeSaveDataDetails = {\n prop: ColumnProp;\n model: DataType;\n val?: SaveData;\n rowIndex: number;\n colIndex: number;\n colType: DimensionCols;\n type: DimensionRows;\n};\nexport type BeforeRangeSaveDataDetails = {\n data: DataLookup;\n models: {\n [rowIndex: number]: DataType;\n };\n type: DimensionRows;\n};\n\nexport type AfterEditEvent = BeforeRangeSaveDataDetails | BeforeSaveDataDetails;\n\n/**\n * Edit cell info for store\n */\nexport interface EditCellStore extends Cell {\n val?: SaveData;\n}\n/**\n * Edit cell info for editor\n */\nexport type EditCell = EditCellStore & BeforeSaveDataDetails;\n\n/**\n * Available editors in grid\n */\nexport type Editors = {\n [name: string]: EditorCtr;\n};\n\n/**\n * Editor component\n */\nexport type EditorCtr = EditorCtrCallable | EditorCtrConstructible;\n\n\n/**\n * Editor component callable function\n */\nexport type EditorCtrCallable = {\n (\n column: ColumnDataSchemaModel,\n save: (value: SaveData, preventFocus?: boolean) => void,\n close: (focusNext?: boolean) => void,\n ): EditorBase;\n}\n/**\n * Editor component constructible class\n */\nexport interface EditorCtrConstructible {\n new (\n column: ColumnDataSchemaModel,\n save: (value: SaveData, preventFocus?: boolean) => void,\n close: (focusNext?: boolean) => void,\n ): EditorBase;\n}\n\n/**\n * Editor interface\n */\nexport interface EditorBase {\n element?: Element | null;\n editCell?: EditCell;\n /**\n * Autosave usage when you want to return value for models.\n */\n getValue?(): any;\n /**\n * For Editor plugin internal usage.\n * Prevents Editor save. Manual save usage required.\n */\n beforeAutoSave?(val?: any): boolean;\n beforeUpdate?(): void;\n /**\n * Before editor got disconnected.\n * Can be triggered multiple times before actual disconnect.\n */\n beforeDisconnect?(): void;\n componentDidRender?(): void;\n disconnectedCallback?(): void;\n render(\n createElement?: HyperFunc<VNode>,\n additionalData?: any,\n ): VNode | VNode[] | string | void;\n}\n"]}
1
+ {"version":3,"file":"selection.js","sourceRoot":"","sources":["../../src/types/selection.ts"],"names":[],"mappings":"","sourcesContent":["import { VNode } from '@stencil/core';\nimport { DimensionRows, DimensionCols } from './dimension';\nimport {\n ColumnProp,\n DataType,\n DataLookup,\n HyperFunc,\n ColumnDataSchemaModel,\n} from './interfaces';\n\nexport type RowIndex = number;\nexport type ColIndex = number;\n\n/**\n * Represents the state of the selection store.\n * It contains information about the selection range, temporary range,\n * focused cell, editing cell, last focused cell, and next cell to focus.\n */\nexport type SelectionStoreState = {\n range: RangeArea | null;\n /**\n * Temporary range selection area\n */\n tempRange: RangeArea | null;\n /**\n * Type of the temporary range selection\n */\n tempRangeType: string | null;\n /**\n * Focused cell coordinate\n */\n focus: Cell | null;\n /**\n * Editing cell store\n */\n edit: EditCellStore | null;\n /**\n * Last cell which was focused\n */\n lastCell: Cell | null;\n /**\n * Next cell to focus\n */\n nextFocus: Cell | null;\n};\nexport type RangeArea = {\n x: ColIndex;\n y: RowIndex;\n x1: ColIndex;\n y1: RowIndex;\n};\nexport type TempRange = {\n type: string;\n area: RangeArea;\n};\nexport type OldNewRangeMapping = {\n [rowIndex: number]: {\n [T in ColumnProp]: {\n rowIndex: number;\n colIndex: number;\n colProp: ColumnProp;\n };\n };\n};\nexport type ChangedRange = {\n type: DimensionRows;\n colType: DimensionCols;\n newRange: RangeArea; // new range to apply\n oldRange: RangeArea; // range to copy from\n mapping: OldNewRangeMapping;\n newData: {\n [key: number]: DataType;\n };\n};\n\n/**\n * Cell coordinates\n */\nexport interface Cell {\n x: ColIndex;\n y: RowIndex;\n}\nexport type FocusedCells = {\n focus: Cell;\n end: Cell;\n};\nexport type RangeAreaCss = {\n left: string;\n top: string;\n width: string;\n height: string;\n};\n\nexport type SaveData = string;\nexport type SaveDataDetails = {\n rgRow: RowIndex;\n rgCol: ColIndex;\n type: DimensionRows;\n prop: ColumnProp;\n val: any;\n preventFocus?: boolean;\n};\n\nexport type BeforeEdit = BeforeSaveDataDetails;\n\nexport type BeforeSaveDataDetails = {\n prop: ColumnProp;\n model: DataType;\n val?: SaveData;\n rowIndex: number;\n colIndex: number;\n colType: DimensionCols;\n type: DimensionRows;\n};\nexport type BeforeRangeSaveDataDetails = {\n data: DataLookup;\n models: Partial<DataLookup>;\n type: DimensionRows;\n};\n\nexport type AfterEditEvent = BeforeRangeSaveDataDetails | BeforeSaveDataDetails;\n\n/**\n * Edit cell info for store\n */\nexport interface EditCellStore extends Cell {\n val?: SaveData;\n}\n/**\n * Edit cell info for editor\n */\nexport type EditCell = EditCellStore & BeforeSaveDataDetails;\n\n/**\n * Available editors in grid\n */\nexport type Editors = {\n [name: string]: EditorCtr;\n};\n\n/**\n * Editor component\n */\nexport type EditorCtr = EditorCtrCallable | EditorCtrConstructible;\n\n\n/**\n * Editor component callable function\n */\nexport type EditorCtrCallable = {\n (\n column: ColumnDataSchemaModel,\n save: (value: SaveData, preventFocus?: boolean) => void,\n close: (focusNext?: boolean) => void,\n ): EditorBase;\n}\n/**\n * Editor component constructible class\n */\nexport interface EditorCtrConstructible {\n new (\n column: ColumnDataSchemaModel,\n save: (value: SaveData, preventFocus?: boolean) => void,\n close: (focusNext?: boolean) => void,\n ): EditorBase;\n}\n\n/**\n * Editor interface\n */\nexport interface EditorBase {\n element?: Element | null;\n editCell?: EditCell;\n /**\n * Autosave usage when you want to return value for models.\n */\n getValue?(): any;\n /**\n * For Editor plugin internal usage.\n * Prevents Editor save. Manual save usage required.\n */\n beforeAutoSave?(val?: any): boolean;\n beforeUpdate?(): void;\n /**\n * Before editor got disconnected.\n * Can be triggered multiple times before actual disconnect.\n */\n beforeDisconnect?(): void;\n componentDidRender?(): void;\n disconnectedCallback?(): void;\n render(\n createElement?: HyperFunc<VNode>,\n additionalData?: any,\n ): VNode | VNode[] | string | void;\n}\n"]}
@@ -1,10 +1,10 @@
1
1
  /*!
2
2
  * Built by Revolist OU ❤️
3
3
  */
4
- import { O as GRID_INTERNALS, a8 as _isIterateeCall, a7 as toInteger_1, a as getVisibleSourceItem, C as CELL_CLASS, y as DISABLED_CLASS, b as getSourceItem } from './index-f65def08.js';
4
+ import { O as GRID_INTERNALS, a8 as _isIterateeCall, a7 as toInteger_1, a as getVisibleSourceItem, C as CELL_CLASS, y as DISABLED_CLASS, b as getSourceItem } from './index-c428acf6.js';
5
5
  import './toNumber-8de324a7.js';
6
6
  import './index-a61f225b.js';
7
- import { g as getRange } from './selection.helpers-d92697e1.js';
7
+ import { g as getRange } from './selection.helpers-ac4368b0.js';
8
8
 
9
9
  const GROUP_DEPTH = `${GRID_INTERNALS}-depth`;
10
10
  const PSEUDO_GROUP_ITEM = `${GRID_INTERNALS}-name`;
@@ -26,7 +26,7 @@ function getGroupValueDefault(item, prop) {
26
26
  * @param groupIds - ids of groups
27
27
  * @param expanded - potentially expanded items if present
28
28
  */
29
- function gatherGrouping(array, groupIds, { prevExpanded, expandedAll, getGroupValue = getGroupValueDefault }) {
29
+ function gatherGrouping(array, groupIds, { prevExpanded, expandedAll, getGroupValue = getGroupValueDefault, }) {
30
30
  const groupedItems = new Map();
31
31
  array.forEach((item, originalIndex) => {
32
32
  const groupLevelValues = groupIds.map(groupId => getGroupValue(item, groupId));
@@ -105,7 +105,7 @@ function getGroupingName(rgRow) {
105
105
  return rgRow && rgRow[PSEUDO_GROUP_ITEM];
106
106
  }
107
107
  function isGrouping(rgRow) {
108
- return rgRow && typeof rgRow[PSEUDO_GROUP_ITEM] !== 'undefined';
108
+ return typeof (rgRow === null || rgRow === void 0 ? void 0 : rgRow[PSEUDO_GROUP_ITEM]) !== 'undefined';
109
109
  }
110
110
  function isGroupingColumn(column) {
111
111
  return column && typeof column[PSEUDO_GROUP_COLUMN] !== 'undefined';
@@ -557,4 +557,4 @@ function doPropMerge(existing, extra) {
557
557
 
558
558
  export { CONTENT_SLOT as C, DATA_SLOT as D, FOOTER_SLOT as F, GROUP_EXPANDED as G, HEADER_SLOT as H, PSEUDO_GROUP_ITEM_VALUE as P, getParsedGroup as a, isSameGroup as b, GROUP_DEPTH as c, PSEUDO_GROUP_ITEM_ID as d, GROUPING_ROW_TYPE as e, PSEUDO_GROUP_COLUMN as f, getGroupingName as g, GROUP_EXPAND_EVENT as h, isGrouping as i, gatherGrouping as j, isGroupingColumn as k, doPropMerge as l, ColumnService as m, GROUP_EXPAND_BTN as n, PSEUDO_GROUP_ITEM as o, isRowDragService as p, getCellData as q, viewportDataPartition as v };
559
559
 
560
- //# sourceMappingURL=column.service-af0694c5.js.map
560
+ //# sourceMappingURL=column.service-6f1faf2d.js.map
@@ -0,0 +1 @@
1
+ {"file":"column.service-6f1faf2d.js","mappings":";;;;;;;;MAEa,WAAW,GAAG,GAAG,cAAc,SAAS;MACxC,iBAAiB,GAAG,GAAG,cAAc,QAAQ;MAC7C,oBAAoB,GAAG,GAAG,cAAc,MAAM;MAC9C,uBAAuB,GAAG,GAAG,cAAc,SAAS;MACpD,mBAAmB,GAAG,GAAG,cAAc,UAAU;MACjD,cAAc,GAAG,GAAG,cAAc,YAAY;AACpD,MAAM,oBAAoB,GAAG,GAAG,cAAc,iBAAiB,CAAC;MAC1D,gBAAgB,GAAG,eAAe;MAClC,kBAAkB,GA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D;IACD,OAAO,KAAK,CAAC;AACf;;;;","names":["baseSlice","require$$0","require$$1","require$$2","slice"],"sources":["src/plugins/groupingRow/grouping.const.ts","src/plugins/groupingRow/grouping.service.ts","src/components/revoGrid/viewport.helpers.ts","node_modules/lodash/_baseSlice.js","node_modules/lodash/slice.js","src/components/data/column.service.ts"],"sourcesContent":["import { GRID_INTERNALS } from '../../utils/consts';\n\nexport const GROUP_DEPTH = `${GRID_INTERNALS}-depth`;\nexport const PSEUDO_GROUP_ITEM = `${GRID_INTERNALS}-name`;\nexport const PSEUDO_GROUP_ITEM_ID = `${GRID_INTERNALS}-id`;\nexport const PSEUDO_GROUP_ITEM_VALUE = `${GRID_INTERNALS}-value`;\nexport const PSEUDO_GROUP_COLUMN = `${GRID_INTERNALS}-column`;\nexport const GROUP_EXPANDED = `${GRID_INTERNALS}-expanded`;\nexport const GROUP_ORIGINAL_INDEX = `${GRID_INTERNALS}-original-index`;\nexport const GROUP_EXPAND_BTN = `group-expand`;\nexport const GROUP_EXPAND_EVENT = `groupexpandclick`;\nexport const GROUPING_ROW_TYPE = 'rgRow';\n","import { DataType, ColumnProp, ColumnRegular } from '@type';\nimport {\n GROUP_DEPTH,\n GROUP_EXPANDED,\n PSEUDO_GROUP_COLUMN,\n PSEUDO_GROUP_ITEM,\n PSEUDO_GROUP_ITEM_ID,\n PSEUDO_GROUP_ITEM_VALUE,\n GROUP_ORIGINAL_INDEX,\n} from './grouping.const';\nimport { GroupLabelTemplateFunc } from './grouping.row.types';\n\nexport type ExpandedOptions = {\n prevExpanded?: Record<string, boolean>;\n expandedAll?: boolean; // skip trim\n\n getGroupValue?(item: DataType, prop: string | number): any;\n groupLabelTemplate?: GroupLabelTemplateFunc;\n};\n\ntype GroupedData = Map<string, GroupedData | DataType[]>;\n\nfunction getGroupValueDefault(item: DataType, prop: string | number) {\n return item[prop] || null;\n}\n\n/**\n * Gather data for grouping\n * @param array - flat data array\n * @param groupIds - ids of groups\n * @param expanded - potentially expanded items if present\n */\nexport function gatherGrouping(\n array: DataType[],\n groupIds: ColumnProp[],\n {\n prevExpanded,\n expandedAll,\n getGroupValue = getGroupValueDefault,\n }: ExpandedOptions,\n) {\n const groupedItems: GroupedData = new Map();\n array.forEach((item, originalIndex) => {\n const groupLevelValues = groupIds.map(groupId =>\n getGroupValue(item, groupId),\n );\n const lastLevelValue = groupLevelValues.pop();\n let currentGroupLevel = groupedItems;\n groupLevelValues.forEach(value => {\n if (!currentGroupLevel.has(value)) {\n currentGroupLevel.set(value, new Map());\n }\n currentGroupLevel = currentGroupLevel.get(value) as GroupedData;\n });\n if (!currentGroupLevel.has(lastLevelValue)) {\n currentGroupLevel.set(lastLevelValue, []);\n }\n const lastLevelItems = currentGroupLevel.get(lastLevelValue) as DataType[];\n lastLevelItems.push({\n ...item,\n [GROUP_ORIGINAL_INDEX]: originalIndex,\n });\n });\n\n let itemIndex = -1;\n const groupingDepth = groupIds.length;\n // collapse all groups in the beginning\n const trimmed: Record<number, boolean> = {};\n // index mapping\n const oldNewIndexMap: Record<number, number> = {};\n // check if group header exists\n const pseudoGroupTest: Record<string, number[]> = {};\n const sourceWithGroups: DataType[] = [];\n function flattenGroupMaps(\n groupedValues: GroupedData,\n parentIds: string[],\n isExpanded: boolean,\n ) {\n const depth = parentIds.length;\n groupedValues.forEach((innerGroupedValues, groupId) => {\n const levelIds = [...parentIds, groupId];\n const mergedIds = levelIds.join(',');\n const isGroupExpanded =\n isExpanded && (!!expandedAll || !!prevExpanded?.[mergedIds]);\n sourceWithGroups.push({\n [PSEUDO_GROUP_ITEM]: groupId,\n [GROUP_DEPTH]: depth,\n [PSEUDO_GROUP_ITEM_ID]: JSON.stringify(levelIds),\n [PSEUDO_GROUP_ITEM_VALUE]: mergedIds,\n [GROUP_EXPANDED]: isGroupExpanded,\n });\n itemIndex += 1;\n if (!isGroupExpanded && depth) {\n trimmed[itemIndex] = true;\n }\n if (Array.isArray(innerGroupedValues)) {\n innerGroupedValues.forEach(value => {\n itemIndex += 1;\n if (!isGroupExpanded) {\n trimmed[itemIndex] = true;\n }\n oldNewIndexMap[value[GROUP_ORIGINAL_INDEX]] = itemIndex;\n const pseudoGroupTestIds = levelIds.map((_value, index) =>\n levelIds.slice(0, index + 1).join(','),\n );\n pseudoGroupTestIds.forEach(pseudoGroupTestId => {\n if (!pseudoGroupTest[pseudoGroupTestId]) {\n pseudoGroupTest[pseudoGroupTestId] = [];\n }\n pseudoGroupTest[pseudoGroupTestId].push(itemIndex);\n });\n });\n sourceWithGroups.push(...innerGroupedValues);\n } else {\n flattenGroupMaps(innerGroupedValues, levelIds, isGroupExpanded);\n }\n });\n }\n flattenGroupMaps(groupedItems, [], true);\n\n return {\n sourceWithGroups, // updates source mirror\n depth: groupingDepth, // largest depth for grouping\n trimmed, // used for expand/collapse grouping values\n oldNewIndexMap, // used for mapping old values to new\n childrenByGroup: pseudoGroupTest, // used to get child items in group\n };\n}\n\nexport function getGroupingName(rgRow?: DataType) {\n return rgRow && rgRow[PSEUDO_GROUP_ITEM];\n}\n\ntype GroupingItem = {\n [PSEUDO_GROUP_ITEM]: string;\n [GROUP_EXPANDED]: boolean;\n [PSEUDO_GROUP_ITEM_VALUE]: string;\n [GROUP_DEPTH]: number;\n};\n\nexport function isGrouping(rgRow?: DataType): rgRow is GroupingItem {\n return typeof rgRow?.[PSEUDO_GROUP_ITEM] !== 'undefined';\n}\n\nexport function isGroupingColumn(column?: ColumnRegular) {\n return column && typeof column[PSEUDO_GROUP_COLUMN] !== 'undefined';\n}\n\nexport function measureEqualDepth<T>(groupA: T[], groupB: T[]) {\n const ln = groupA.length;\n let i = 0;\n for (; i < ln; i++) {\n if (groupA[i] !== groupB[i]) {\n return i;\n }\n }\n return i;\n}\n\nexport function getParsedGroup(id: string) {\n const parseGroup = JSON.parse(id);\n // extra precaution and type safeguard\n if (!Array.isArray(parseGroup)) {\n return null;\n }\n return parseGroup;\n}\n\n// check if items is child of current clicked group\nexport function isSameGroup(\n currentGroup: any[],\n currentModel: DataType,\n nextModel: DataType,\n) {\n const nextGroup = getParsedGroup(nextModel[PSEUDO_GROUP_ITEM_ID]);\n if (!nextGroup) {\n return false;\n }\n\n const depth = measureEqualDepth(currentGroup, nextGroup);\n return currentModel[GROUP_DEPTH] < depth;\n}\n","/**\n * Collects data for pinned columns in the required @ViewportProps format.\n */\n\nimport { DimensionRows, MultiDimensionType, SlotType, Cell, ViewportColumn } from '@type';\n\n/**\n * Represents the slot names for the viewport slots.\n */\nexport const HEADER_SLOT = 'header'; // Slot name for the header slot\nexport const FOOTER_SLOT = 'footer'; // Slot name for the footer slot\nexport const CONTENT_SLOT = 'content'; // Slot name for the content slot\nexport const DATA_SLOT = 'data'; // Slot name for the data slot\n\n/**\n * Returns the last visible cell in the viewport for a given row type.\n * Coordinates are not zero-based and are relative to the viewport.\n * If needed to be zero-based they can be adjusted by subtracting 1.\n */\nexport function getLastCell(\n data: ViewportColumn,\n rowType: MultiDimensionType,\n): Cell {\n // Get the last visible column count from the viewport column data.\n const lastVisibleColumnCount = data.viewports[data.colType].store.get('realCount');\n\n // Get the last visible row count for the given row type from the viewport column data.\n const lastVisibleRowCount = data.viewports[rowType].store.get('realCount');\n\n // Return the last visible cell with the last visible column count and row count.\n return {\n x: lastVisibleColumnCount,\n y: lastVisibleRowCount,\n };\n}\n\n\nexport function viewportDataPartition(\n data: ViewportColumn,\n type: DimensionRows,\n slot: SlotType,\n fixed?: boolean,\n) {\n return {\n colData: data.colStore,\n viewportCol: data.viewports[data.colType].store,\n viewportRow: data.viewports[type].store,\n // lastCell is the last real coordinate + 1\n lastCell: getLastCell(data, type),\n slot,\n type,\n canDrag: !fixed,\n position: data.position,\n dataStore: data.rowStores[type].store,\n dimensionCol: data.dimensions[data.colType].store,\n dimensionRow: data.dimensions[type].store,\n style: fixed\n ? { height: `${data.dimensions[type].store.get('realSize')}px` }\n : undefined,\n };\n}\n\nexport type VPPartition = ReturnType<typeof viewportDataPartition>;","/**\n * The base implementation of `_.slice` without an iteratee call guard.\n *\n * @private\n * @param {Array} array The array to slice.\n * @param {number} [start=0] The start position.\n * @param {number} [end=array.length] The end position.\n * @returns {Array} Returns the slice of `array`.\n */\nfunction baseSlice(array, start, end) {\n var index = -1,\n length = array.length;\n\n if (start < 0) {\n start = -start > length ? 0 : (length + start);\n }\n end = end > length ? length : end;\n if (end < 0) {\n end += length;\n }\n length = start > end ? 0 : ((end - start) >>> 0);\n start >>>= 0;\n\n var result = Array(length);\n while (++index < length) {\n result[index] = array[index + start];\n }\n return result;\n}\n\nmodule.exports = baseSlice;\n","var baseSlice = require('./_baseSlice'),\n isIterateeCall = require('./_isIterateeCall'),\n toInteger = require('./toInteger');\n\n/**\n * Creates a slice of `array` from `start` up to, but not including, `end`.\n *\n * **Note:** This method is used instead of\n * [`Array#slice`](https://mdn.io/Array/slice) to ensure dense arrays are\n * returned.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Array\n * @param {Array} array The array to slice.\n * @param {number} [start=0] The start position.\n * @param {number} [end=array.length] The end position.\n * @returns {Array} Returns the slice of `array`.\n */\nfunction slice(array, start, end) {\n var length = array == null ? 0 : array.length;\n if (!length) {\n return [];\n }\n if (end && typeof end != 'number' && isIterateeCall(array, start, end)) {\n start = 0;\n end = length;\n }\n else {\n start = start == null ? 0 : toInteger(start);\n end = end === undefined ? length : toInteger(end);\n }\n return baseSlice(array, start, end);\n}\n\nmodule.exports = slice;\n","import { DSourceState, getSourceItem, getVisibleSourceItem } from '@store';\nimport { CELL_CLASS, DISABLED_CLASS } from '../../utils/consts';\nimport { getRange } from '@store';\n\nimport { isGroupingColumn } from '../../plugins/groupingRow/grouping.service';\nimport slice from 'lodash/slice';\nimport {\n DimensionCols,\n DimensionRows,\n RowDrag,\n ColumnRegular,\n DataType,\n CellProps,\n ColumnDataSchemaModel,\n ColumnProp,\n DataLookup,\n DataFormat,\n ChangedRange,\n OldNewRangeMapping,\n Cell,\n RangeArea,\n BeforeSaveDataDetails,\n EditorCtr,\n Editors,\n} from '@type';\nimport { Observable } from '../../utils/store.utils';\n\nexport type ColumnStores = {\n [T in DimensionCols]: Observable<DSourceState<ColumnRegular, DimensionCols>>;\n};\nexport type RowStores = {\n [T in DimensionRows]: Observable<DSourceState<DataType, DimensionRows>>;\n};\n\nexport default class ColumnService {\n private unsubscribe: { (): void }[] = [];\n get columns(): ColumnRegular[] {\n return getVisibleSourceItem(this.source);\n }\n\n hasGrouping = false;\n type: DimensionCols;\n\n constructor(\n private dataStore: Observable<DSourceState<DataType, DimensionRows>>,\n private source: Observable<DSourceState<ColumnRegular, DimensionCols>>,\n ) {\n this.unsubscribe.push(\n source.onChange('source', s => this.checkGrouping(s)),\n );\n this.checkGrouping(source.get('source'));\n this.type = source.get('type');\n }\n\n private checkGrouping(cols: ColumnRegular[]) {\n for (let rgCol of cols) {\n if (isGroupingColumn(rgCol)) {\n this.hasGrouping = true;\n return;\n }\n this.hasGrouping = false;\n }\n }\n\n isReadOnly(r: number, c: number) {\n const readOnly = this.columns[c]?.readonly;\n if (typeof readOnly === 'function') {\n const data = this.rowDataModel(r, c);\n return readOnly(data);\n }\n return !!readOnly;\n }\n\n mergeProperties(\n r: number,\n c: number,\n defaultProps: CellProps,\n model: ColumnDataSchemaModel,\n extraPropsFunc: ColumnRegular['cellProperties'],\n ): CellProps {\n const cellClass: { [key: string]: boolean } = {\n [CELL_CLASS]: true,\n [DISABLED_CLASS]: this.isReadOnly(r, c),\n };\n let props: CellProps = {\n ...defaultProps,\n class: cellClass,\n };\n const extra = extraPropsFunc?.(model);\n if (!extra) {\n return props;\n }\n return doPropMerge(props, extra);\n }\n\n getRowClass(r: number, prop: string): string {\n const model = getSourceItem(this.dataStore, r) || {};\n return model[prop] || '';\n }\n\n getCellData(r: number, c: number): string {\n const data = this.rowDataModel(r, c);\n return getCellData(data.model[data.prop as number]);\n }\n\n getSaveData(\n rowIndex: number,\n colIndex: number,\n val?: string,\n ): BeforeSaveDataDetails {\n if (typeof val === 'undefined') {\n val = this.getCellData(rowIndex, colIndex);\n }\n const data = this.rowDataModel(rowIndex, colIndex);\n return {\n prop: data.prop,\n rowIndex,\n colIndex,\n val,\n model: data.model,\n colType: this.type,\n type: this.dataStore.get('type'),\n };\n }\n\n getCellEditor(\n _r: number,\n c: number,\n editors: Editors,\n ): EditorCtr | undefined {\n const editor = this.columns[c]?.editor;\n if (!editor) {\n return undefined;\n }\n // reference\n if (typeof editor === 'string') {\n return editors[editor];\n }\n return editor;\n }\n\n /**\n * Get cell data model for given rowIndex and colIndex\n * Used to pass data to editor/renderer\n */\n rowDataModel(rowIndex: number, colIndex: number): ColumnDataSchemaModel {\n const column = this.columns[colIndex];\n const prop: ColumnProp | undefined = column?.prop;\n const model = getSourceItem(this.dataStore, rowIndex) || {};\n const value = model[prop];\n const type = this.dataStore.get('type');\n return {\n prop,\n model,\n data: this.dataStore.get('source'),\n column,\n rowIndex,\n colIndex,\n colType: this.type,\n type,\n value,\n };\n }\n\n getRangeData(\n d: ChangedRange,\n columns: ColumnRegular[],\n ): {\n changed: DataLookup;\n mapping: OldNewRangeMapping;\n } {\n const changed: DataLookup = {};\n\n // get original length sizes\n const copyColLength = d.oldRange.x1 - d.oldRange.x + 1;\n const copyRowLength = d.oldRange.y1 - d.oldRange.y + 1;\n const mapping: OldNewRangeMapping = {};\n\n // rows\n for (\n let rowIndex = d.newRange.y, i = 0;\n rowIndex < d.newRange.y1 + 1;\n rowIndex++, i++\n ) {\n // copy original data link\n const oldRowIndex = d.oldRange.y + (i % copyRowLength);\n const copyRow = getSourceItem(this.dataStore, oldRowIndex) || {};\n\n // columns\n for (\n let colIndex = d.newRange.x, j = 0;\n colIndex < d.newRange.x1 + 1;\n colIndex++, j++\n ) {\n // check if old range area\n if (\n rowIndex >= d.oldRange.y &&\n rowIndex <= d.oldRange.y1 &&\n colIndex >= d.oldRange.x &&\n colIndex <= d.oldRange.x1\n ) {\n continue;\n }\n\n // requested column beyond range\n if (!this.columns[colIndex]) {\n continue;\n }\n const prop = this.columns[colIndex]?.prop;\n const copyColIndex = d.oldRange.x + (j % copyColLength);\n const copyColumnProp = columns[copyColIndex].prop;\n\n /** if can write */\n if (!this.isReadOnly(rowIndex, colIndex)) {\n /** to show before save */\n if (!changed[rowIndex]) {\n changed[rowIndex] = {};\n }\n changed[rowIndex][prop] = copyRow[copyColumnProp];\n /** Generate mapping object */\n if (!mapping[rowIndex]) {\n mapping[rowIndex] = {};\n }\n mapping[rowIndex][prop] = {\n colIndex: copyColIndex,\n colProp: copyColumnProp,\n rowIndex: oldRowIndex,\n };\n }\n }\n }\n return {\n changed,\n mapping,\n };\n }\n\n getTransformedDataToApply(\n start: Cell,\n data: DataFormat[][],\n ): {\n changed: DataLookup;\n range: RangeArea | null;\n } {\n const changed: DataLookup = {};\n const copyRowLength = data.length;\n const colLength = this.columns.length;\n const rowLength = this.dataStore.get('items').length;\n // rows\n let rowIndex = start.y;\n let maxCol = 0;\n for (\n let i = 0;\n rowIndex < rowLength && i < copyRowLength;\n rowIndex++, i++\n ) {\n // copy original data link\n const copyRow = data[i % copyRowLength];\n const copyColLength = copyRow?.length || 0;\n // columns\n let colIndex = start.x;\n for (\n let j = 0;\n colIndex < colLength && j < copyColLength;\n colIndex++, j++\n ) {\n const p = this.columns[colIndex].prop;\n const currentCol = j % colLength;\n\n /** if can write */\n if (!this.isReadOnly(rowIndex, colIndex)) {\n /** to show before save */\n if (!changed[rowIndex]) {\n changed[rowIndex] = {};\n }\n changed[rowIndex][p] = copyRow[currentCol];\n }\n }\n maxCol = Math.max(maxCol, colIndex - 1);\n }\n const range = getRange(start, {\n y: rowIndex - 1,\n x: maxCol,\n });\n return {\n changed,\n range,\n };\n }\n\n getRangeStaticData(d: RangeArea, value: DataFormat): DataLookup {\n const changed: DataLookup = {};\n\n // rows\n for (let rowIndex = d.y, i = 0; rowIndex < d.y1 + 1; rowIndex++, i++) {\n // columns\n for (let colIndex = d.x, j = 0; colIndex < d.x1 + 1; colIndex++, j++) {\n // requested column beyond range\n if (!this.columns[colIndex]) {\n continue;\n }\n const p = this.columns[colIndex].prop;\n\n /** if can write */\n if (!this.isReadOnly(rowIndex, colIndex)) {\n /** to show before save */\n if (!changed[rowIndex]) {\n changed[rowIndex] = {};\n }\n changed[rowIndex][p] = value;\n }\n }\n }\n return changed;\n }\n\n getRangeTransformedToProps(\n d: RangeArea,\n store: Observable<DSourceState<DataType, DimensionRows>>,\n ) {\n const area: {\n prop: ColumnProp;\n rowIndex: number;\n colIndex: number;\n model?: DataType;\n colType: DimensionCols;\n type: DimensionRows;\n }[] = [];\n\n const type = this.dataStore.get('type');\n // rows\n for (let rowIndex = d.y, i = 0; rowIndex < d.y1 + 1; rowIndex++, i++) {\n // columns\n for (let colIndex = d.x, j = 0; colIndex < d.x1 + 1; colIndex++, j++) {\n const prop = this.columns[colIndex]?.prop;\n area.push({\n prop,\n rowIndex,\n colIndex,\n model: getSourceItem(store, rowIndex),\n type,\n colType: this.type,\n });\n }\n }\n return area;\n }\n\n copyRangeArray(\n range: RangeArea,\n store: Observable<DSourceState<DataType, DimensionRows>>,\n ) {\n const cols = [...this.columns];\n const props = slice(cols, range.x, range.x1 + 1).map(v => v.prop);\n const toCopy: DataFormat[][] = [];\n const mapping: { [rowIndex: number]: { [colProp: ColumnProp]: any } } = {};\n\n // rows indexes\n for (let i = range.y; i <= range.y1; i++) {\n const rgRow: DataFormat[] = [];\n mapping[i] = {};\n\n // columns indexes\n for (let prop of props) {\n const item = getSourceItem(store, i);\n\n // if no item - skip\n if (!item) {\n continue;\n }\n const val = item[prop];\n rgRow.push(val);\n mapping[i][prop] = val;\n }\n\n toCopy.push(rgRow);\n }\n return {\n data: toCopy,\n mapping,\n };\n }\n\n destroy() {\n this.unsubscribe.forEach(f => f());\n }\n}\n\nexport function getCellData(val?: any) {\n if (typeof val === 'undefined' || val === null) {\n return '';\n }\n return val;\n}\n\n/**\n * Checks if the given rowDrag is a service for dragging rows.\n */\nexport function isRowDragService(\n rowDrag: RowDrag,\n model: ColumnDataSchemaModel,\n): boolean {\n if (typeof rowDrag === 'function') {\n return rowDrag(model);\n }\n return !!rowDrag;\n}\nexport function doPropMerge(existing: CellProps, extra: CellProps) {\n let props: CellProps = { ...extra, ...existing };\n // extend existing props\n if (extra.class) {\n if (typeof extra.class === 'object' && typeof props.class === 'object') {\n props.class = { ...extra.class, ...props.class };\n } else if (\n typeof extra.class === 'string' &&\n typeof props.class === 'object'\n ) {\n props.class[extra.class] = true;\n } else if (typeof props.class === 'string') {\n props.class += ' ' + extra.class;\n }\n }\n if (extra.style) {\n props.style = { ...extra.style, ...props.style };\n }\n return props;\n}\n"],"version":3}