@revolist/revogrid 4.0.11 → 4.0.12

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 (104) hide show
  1. package/dist/cjs/{column.service-e83d9809.js → column.service-bc269420.js} +23 -9
  2. package/dist/cjs/column.service-bc269420.js.map +1 -0
  3. package/dist/cjs/{events-7ccd6894.js → events-f8893bba.js} +15 -5
  4. package/dist/cjs/events-f8893bba.js.map +1 -0
  5. package/dist/cjs/{header-cell-renderer-8ba9b56d.js → header-cell-renderer-57acd2f7.js} +2 -2
  6. package/dist/cjs/{header-cell-renderer-8ba9b56d.js.map → header-cell-renderer-57acd2f7.js.map} +1 -1
  7. package/dist/cjs/revo-grid.cjs.entry.js +29 -13
  8. package/dist/cjs/revo-grid.cjs.entry.js.map +1 -1
  9. package/dist/cjs/revogr-attribution_6.cjs.entry.js +176 -126
  10. package/dist/cjs/revogr-attribution_6.cjs.entry.js.map +1 -1
  11. package/dist/cjs/revogr-clipboard_3.cjs.entry.js.map +1 -1
  12. package/dist/cjs/revogr-data_4.cjs.entry.js +2 -2
  13. package/dist/collection/components/data/column.service.js.map +1 -1
  14. package/dist/collection/components/data/revogr-data.js +1 -1
  15. package/dist/collection/components/editors/revogr-edit.js +1 -1
  16. package/dist/collection/components/order/revogr-order-editor.js +4 -1
  17. package/dist/collection/components/order/revogr-order-editor.js.map +1 -1
  18. package/dist/collection/components/overlay/autofill.service.js +36 -24
  19. package/dist/collection/components/overlay/autofill.service.js.map +1 -1
  20. package/dist/collection/components/overlay/keyboard.service.js +7 -7
  21. package/dist/collection/components/overlay/keyboard.service.js.map +1 -1
  22. package/dist/collection/components/overlay/revogr-overlay-selection.js +107 -59
  23. package/dist/collection/components/overlay/revogr-overlay-selection.js.map +1 -1
  24. package/dist/collection/components/overlay/selection.utils.js +37 -9
  25. package/dist/collection/components/overlay/selection.utils.js.map +1 -1
  26. package/dist/collection/components/revoGrid/revo-grid-style.css +8 -3
  27. package/dist/collection/components/revoGrid/revo-grid.js +26 -11
  28. package/dist/collection/components/revoGrid/revo-grid.js.map +1 -1
  29. package/dist/collection/components/revoGrid/viewport.helpers.js +22 -8
  30. package/dist/collection/components/revoGrid/viewport.helpers.js.map +1 -1
  31. package/dist/collection/components/revoGrid/viewport.service.js +1 -0
  32. package/dist/collection/components/revoGrid/viewport.service.js.map +1 -1
  33. package/dist/collection/serve/controller.js +86 -18
  34. package/dist/collection/store/selection/index.js +0 -1
  35. package/dist/collection/store/selection/index.js.map +1 -1
  36. package/dist/collection/types/interfaces.js +4 -0
  37. package/dist/collection/types/interfaces.js.map +1 -1
  38. package/dist/collection/utils/events.js +11 -1
  39. package/dist/collection/utils/events.js.map +1 -1
  40. package/dist/collection/utils/row-header-utils.js +2 -2
  41. package/dist/collection/utils/row-header-utils.js.map +1 -1
  42. package/dist/esm/{column.service-f4922a8d.js → column.service-195345ab.js} +23 -9
  43. package/dist/esm/column.service-195345ab.js.map +1 -0
  44. package/dist/esm/{events-3dd8ee7c.js → events-3e39de50.js} +15 -5
  45. package/dist/esm/events-3e39de50.js.map +1 -0
  46. package/dist/esm/{header-cell-renderer-ac962570.js → header-cell-renderer-7c76465d.js} +2 -2
  47. package/dist/esm/{header-cell-renderer-ac962570.js.map → header-cell-renderer-7c76465d.js.map} +1 -1
  48. package/dist/esm/revo-grid.entry.js +29 -13
  49. package/dist/esm/revo-grid.entry.js.map +1 -1
  50. package/dist/esm/revogr-attribution_6.entry.js +176 -126
  51. package/dist/esm/revogr-attribution_6.entry.js.map +1 -1
  52. package/dist/esm/revogr-clipboard_3.entry.js.map +1 -1
  53. package/dist/esm/revogr-data_4.entry.js +2 -2
  54. package/dist/revo-grid/column.service-195345ab.js +5 -0
  55. package/dist/revo-grid/column.service-195345ab.js.map +1 -0
  56. package/dist/revo-grid/{events-3dd8ee7c.js → events-3e39de50.js} +2 -2
  57. package/dist/revo-grid/events-3e39de50.js.map +1 -0
  58. package/dist/revo-grid/{header-cell-renderer-ac962570.js → header-cell-renderer-7c76465d.js} +2 -2
  59. package/dist/revo-grid/revo-grid.entry.js +1 -1
  60. package/dist/revo-grid/revo-grid.entry.js.map +1 -1
  61. package/dist/revo-grid/revogr-attribution_6.entry.js +1 -1
  62. package/dist/revo-grid/revogr-attribution_6.entry.js.map +1 -1
  63. package/dist/revo-grid/revogr-clipboard_3.entry.js.map +1 -1
  64. package/dist/revo-grid/revogr-data_4.entry.js +1 -1
  65. package/dist/types/components/data/column.service.d.ts +2 -2
  66. package/dist/types/components/order/revogr-order-editor.d.ts +3 -0
  67. package/dist/types/components/overlay/autofill.service.d.ts +9 -6
  68. package/dist/types/components/overlay/keyboard.service.d.ts +2 -3
  69. package/dist/types/components/overlay/revogr-overlay-selection.d.ts +38 -15
  70. package/dist/types/components/overlay/selection.utils.d.ts +12 -4
  71. package/dist/types/components/revoGrid/revo-grid.d.ts +4 -1
  72. package/dist/types/components/revoGrid/viewport.helpers.d.ts +11 -2
  73. package/dist/types/components.d.ts +26 -2
  74. package/dist/types/store/selection/index.d.ts +0 -1
  75. package/dist/types/types/interfaces.d.ts +444 -23
  76. package/dist/types/utils/events.d.ts +4 -1
  77. package/dist/types/utils/row-header-utils.d.ts +1 -1
  78. package/hydrate/index.js +265 -169
  79. package/package.json +5 -6
  80. package/standalone/column.service.js.map +1 -1
  81. package/standalone/revo-grid.js +28 -11
  82. package/standalone/revo-grid.js.map +1 -1
  83. package/standalone/revogr-focus2.js +1 -1
  84. package/standalone/revogr-order-editor2.js.map +1 -1
  85. package/standalone/revogr-overlay-selection2.js +140 -143
  86. package/standalone/revogr-overlay-selection2.js.map +1 -1
  87. package/standalone/revogr-row-headers2.js +2 -2
  88. package/standalone/revogr-row-headers2.js.map +1 -1
  89. package/standalone/revogr-temp-range2.js +1 -1
  90. package/standalone/revogr-viewport-scroll2.js +22 -8
  91. package/standalone/revogr-viewport-scroll2.js.map +1 -1
  92. package/standalone/selection.utils.js +72 -9
  93. package/standalone/selection.utils.js.map +1 -1
  94. package/dist/cjs/column.service-e83d9809.js.map +0 -1
  95. package/dist/cjs/events-7ccd6894.js.map +0 -1
  96. package/dist/collection/store/selection/selection.store.service.js +0 -39
  97. package/dist/collection/store/selection/selection.store.service.js.map +0 -1
  98. package/dist/esm/column.service-f4922a8d.js.map +0 -1
  99. package/dist/esm/events-3dd8ee7c.js.map +0 -1
  100. package/dist/revo-grid/column.service-f4922a8d.js +0 -5
  101. package/dist/revo-grid/column.service-f4922a8d.js.map +0 -1
  102. package/dist/revo-grid/events-3dd8ee7c.js.map +0 -1
  103. package/dist/types/store/selection/selection.store.service.d.ts +0 -17
  104. /package/dist/revo-grid/{header-cell-renderer-ac962570.js.map → header-cell-renderer-7c76465d.js.map} +0 -0
@@ -1,16 +1,30 @@
1
1
  /*!
2
2
  * Built by Revolist OU ❤️
3
3
  */
4
- /** Collect data for pinned columns in required @ViewportProps format */
5
- export const HEADER_SLOT = 'header';
6
- export const FOOTER_SLOT = 'footer';
7
- export const CONTENT_SLOT = 'content';
8
- export const DATA_SLOT = 'data';
9
- /** Receive last visible in viewport by required type */
4
+ /**
5
+ * Collects data for pinned columns in the required @ViewportProps format.
6
+ */
7
+ /**
8
+ * Represents the slot names for the viewport slots.
9
+ */
10
+ export const HEADER_SLOT = 'header'; // Slot name for the header slot
11
+ export const FOOTER_SLOT = 'footer'; // Slot name for the footer slot
12
+ export const CONTENT_SLOT = 'content'; // Slot name for the content slot
13
+ export const DATA_SLOT = 'data'; // Slot name for the data slot
14
+ /**
15
+ * Returns the last visible cell in the viewport for a given row type.
16
+ * Coordinates are not zero-based and are relative to the viewport.
17
+ * If needed to be zero-based they can be adjusted by subtracting 1.
18
+ */
10
19
  export function getLastCell(data, rowType) {
20
+ // Get the last visible column count from the viewport column data.
21
+ const lastVisibleColumnCount = data.viewports[data.colType].store.get('realCount');
22
+ // Get the last visible row count for the given row type from the viewport column data.
23
+ const lastVisibleRowCount = data.viewports[rowType].store.get('realCount');
24
+ // Return the last visible cell with the last visible column count and row count.
11
25
  return {
12
- x: data.viewports[data.colType].store.get('realCount'),
13
- y: data.viewports[rowType].store.get('realCount'),
26
+ x: lastVisibleColumnCount,
27
+ y: lastVisibleRowCount,
14
28
  };
15
29
  }
16
30
  //# sourceMappingURL=viewport.helpers.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"viewport.helpers.js","sourceRoot":"","sources":["../../../src/components/revoGrid/viewport.helpers.ts"],"names":[],"mappings":"AAAA,wEAAwE;AAMxE,MAAM,CAAC,MAAM,WAAW,GAAG,QAAQ,CAAC;AACpC,MAAM,CAAC,MAAM,WAAW,GAAG,QAAQ,CAAC;AACpC,MAAM,CAAC,MAAM,YAAY,GAAG,SAAS,CAAC;AACtC,MAAM,CAAC,MAAM,SAAS,GAAG,MAAM,CAAC;AAEhC,wDAAwD;AACxD,MAAM,UAAU,WAAW,CACzB,IAAoB,EACpB,OAA2B;IAE3B,OAAO;QACL,CAAC,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,WAAW,CAAC;QACtD,CAAC,EAAE,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,WAAW,CAAC;KAClD,CAAC;AACJ,CAAC","sourcesContent":["/** Collect data for pinned columns in required @ViewportProps format */\n\nimport { MultiDimensionType } from '../..';\nimport { Cell } from '../..';\nimport { ViewportColumn } from '../../types/viewport.interfaces';\n\nexport const HEADER_SLOT = 'header';\nexport const FOOTER_SLOT = 'footer';\nexport const CONTENT_SLOT = 'content';\nexport const DATA_SLOT = 'data';\n\n/** Receive last visible in viewport by required type */\nexport function getLastCell(\n data: ViewportColumn,\n rowType: MultiDimensionType,\n): Cell {\n return {\n x: data.viewports[data.colType].store.get('realCount'),\n y: data.viewports[rowType].store.get('realCount'),\n };\n}\n"]}
1
+ {"version":3,"file":"viewport.helpers.js","sourceRoot":"","sources":["../../../src/components/revoGrid/viewport.helpers.ts"],"names":[],"mappings":"AAAA;;GAEG;AAMH;;GAEG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,QAAQ,CAAC,CAAC,gCAAgC;AACrE,MAAM,CAAC,MAAM,WAAW,GAAG,QAAQ,CAAC,CAAC,gCAAgC;AACrE,MAAM,CAAC,MAAM,YAAY,GAAG,SAAS,CAAC,CAAC,iCAAiC;AACxE,MAAM,CAAC,MAAM,SAAS,GAAG,MAAM,CAAC,CAAC,8BAA8B;AAE/D;;;;GAIG;AACH,MAAM,UAAU,WAAW,CACzB,IAAoB,EACpB,OAA2B;IAE3B,mEAAmE;IACnE,MAAM,sBAAsB,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;IAEnF,uFAAuF;IACvF,MAAM,mBAAmB,GAAG,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;IAE3E,iFAAiF;IACjF,OAAO;QACL,CAAC,EAAE,sBAAsB;QACzB,CAAC,EAAE,mBAAmB;KACvB,CAAC;AACJ,CAAC","sourcesContent":["/**\n * Collects data for pinned columns in the required @ViewportProps format.\n */\n\nimport { MultiDimensionType } from '../..';\nimport { Cell } from '../..';\nimport { ViewportColumn } from '../../types/viewport.interfaces';\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"]}
@@ -157,6 +157,7 @@ export default class ViewportService {
157
157
  colData: data.colStore,
158
158
  viewportCol: data.viewports[data.colType].store,
159
159
  viewportRow: data.viewports[type].store,
160
+ // lastCell is the last real coordinate + 1
160
161
  lastCell: getLastCell(data, type),
161
162
  slot,
162
163
  type,
@@ -1 +1 @@
1
- {"version":3,"file":"viewport.service.js","sourceRoot":"","sources":["../../../src/components/revoGrid/viewport.service.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,eAAe,CAAC;AAGnC,OAAgC,EAC9B,WAAW,GACZ,MAAM,0CAA0C,CAAC;AAElD,OAAO,EAEL,aAAa,EACb,oBAAoB,GACrB,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAG/D,OAAO,EACL,YAAY,EACZ,WAAW,EACX,WAAW,EACX,WAAW,GACZ,MAAM,oBAAoB,CAAC;AA6C5B,0BAA0B;AAC1B,SAAS,gBAAgB,CAAC,IAAoB;IAC5C,MAAM,YAAY,GAAG,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,KAAK,CAAC;IACzD,MAAM,SAAS,GAAG,YAAY,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;IAG/C,MAAM,IAAI,GAAuB;QAC/B,YAAY,EAAE,SAAS;QACvB,KAAK,EAAE,IAAI,CAAC,OAAO;QACnB,aAAa,EAAE,IAAI,CAAC,aAAa;QACjC,GAAG,EAAE,IAAI,CAAC,OAAO;QACjB,OAAO,EAAE,IAAI,CAAC,OAAO;QACrB,gBAAgB,EAAE,IAAI,CAAC,gBAAgB;QACvC,iCAAiC;QACjC,KAAK,EAAE,IAAI,CAAC,QAAQ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,uBAAuB,0CAAE,aAAa,CAChD,IAAI,CAAC,wBAAwB,CAAC,OAAO,EAAE,OAAO,CAAC,EAC/C,EAAE,CAAC,EAAE,QAAQ,EAAE,CAAC,EAAE,QAAQ,EAAE,CAC7B,CAAC;IACJ,CAAC;CACF","sourcesContent":["import reduce from 'lodash/reduce';\n\nimport DimensionProvider from '../../services/dimension.provider';\nimport SelectionStoreConnector, {\n EMPTY_INDEX,\n} from '../../services/selection.store.connector';\nimport ViewportProvider from '../../services/viewport.provider';\nimport {\n DSourceState,\n getSourceItem,\n getVisibleSourceItem,\n} from '../../store/dataSource/data.store';\nimport { columnTypes, rowTypes } from '../../store/storeTypes';\nimport { OrdererService } from '../order/order-renderer';\nimport GridScrollingService from './viewport.scrolling.service';\nimport {\n CONTENT_SLOT,\n FOOTER_SLOT,\n getLastCell,\n HEADER_SLOT,\n} from './viewport.helpers';\n\nimport ColumnDataProvider from '../../services/column.data.provider';\nimport { DataProvider } from '../../services/data.provider';\nimport {\n ColumnRegular,\n Observable,\n ViewPortResizeEvent,\n ViewSettingSizeProp,\n} from '../..';\nimport { DimensionCols, DimensionRows } from '../..';\nimport {\n HeaderProperties,\n SlotType,\n ViewportColumn,\n ViewportData,\n ViewportProperties,\n ViewportProps,\n} from '../../types/viewport.interfaces';\nimport { Cell, RangeArea } from '../..';\n\nexport type ResizeDetails = { [index: number]: ColumnRegular };\ntype Config = {\n columnProvider: ColumnDataProvider;\n dataProvider: DataProvider;\n dimensionProvider: DimensionProvider;\n viewportProvider: ViewportProvider;\n scrollingService: GridScrollingService;\n orderService: OrdererService;\n selectionStoreConnector: SelectionStoreConnector;\n\n disableVirtualX?: boolean;\n disableVirtualY?: boolean;\n\n resize(r: ResizeDetails): void;\n};\n\nexport type FocusedData = {\n model: any;\n cell: Cell;\n colType: DimensionCols;\n rowType: DimensionRows;\n column?: ColumnRegular;\n};\n\n/** Collect Column data */\nfunction gatherColumnData(data: ViewportColumn) {\n const colDimension = data.dimensions[data.colType].store;\n const realWidth = colDimension.get('realSize');\n\n\n const prop: ViewportProperties = {\n contentWidth: realWidth,\n class: data.colType,\n contentHeight: data.contentHeight,\n key: data.colType,\n colType: data.colType,\n onResizeviewport: data.onResizeviewport,\n // set viewport size to real size\n style: data.fixWidth ? { minWidth: `${realWidth}px` } : undefined,\n };\n\n const headerProp: HeaderProperties = {\n colData: getVisibleSourceItem(data.colStore),\n dimensionCol: colDimension,\n type: data.colType,\n groups: data.colStore.get('groups'),\n groupingDepth: data.colStore.get('groupingDepth'),\n resizeHandler: data.colType === 'colPinEnd' ? ['l'] : undefined,\n onHeaderresize: data.onHeaderresize,\n };\n\n return {\n prop,\n type: data.colType,\n position: data.position,\n headerProp,\n viewportCol: data.viewports[data.colType].store,\n };\n}\n\nexport default class ViewportService {\n readonly columns: ViewportProps[];\n constructor(\n private config: Config,\n contentHeight: number,\n ) {\n this.config.selectionStoreConnector?.beforeUpdate();\n\n // ----------- Handle columns ----------- //\n\n // Transform data from stores and apply it to different components\n const columns: ViewportProps[] = [];\n let x = 0; // we increase x only if column present\n columnTypes.forEach(val => {\n const colStore = config.columnProvider.stores[val].store;\n // only columns that have data show\n if (!colStore.get('items').length) {\n return;\n }\n const column: ViewportColumn = {\n colType: val,\n position: { x, y: 1 },\n\n contentHeight,\n // only central column has dynamic width\n fixWidth: val !== 'rgCol',\n\n viewports: config.viewportProvider.stores,\n dimensions: config.dimensionProvider.stores,\n rowStores: config.dataProvider.stores,\n\n colStore,\n onHeaderresize: e => this.onColumnResize(val, e, colStore),\n };\n if (val === 'rgCol') {\n column.onResizeviewport = (e: CustomEvent<ViewPortResizeEvent>) => {\n if (config.disableVirtualY && e.detail.dimension === 'rgRow') {\n return;\n } else if (config.disableVirtualX && e.detail.dimension === 'rgCol') {\n return;\n }\n config.viewportProvider?.setViewport(e.detail.dimension, {\n virtualSize: e.detail.size,\n });\n };\n }\n const colData = gatherColumnData(column);\n const columnSelectionStore = this.registerCol(colData.position.x, val);\n\n // render per each column data collections vertically\n const dataPorts = this.dataViewPort(column).reduce<ViewportData[]>(\n (r, rgRow) => {\n // register selection store for Segment\n const segmentSelection = this.registerSegment(rgRow.position);\n segmentSelection.setLastCell(rgRow.lastCell);\n\n // register selection store for Row\n const rowSelectionStore = this.registerRow(\n rgRow.position.y,\n rgRow.type,\n );\n const rowDef: ViewportData = {\n ...rgRow,\n rowSelectionStore,\n segmentSelectionStore: segmentSelection.store,\n ref: (e: Element) =>\n config.selectionStoreConnector.registerSection(e),\n onSetrange: e => {\n segmentSelection.setRangeArea(e.detail);\n },\n onSettemprange: e => {\n segmentSelection.setTempArea(e.detail);\n },\n onFocuscell: e => {\n // todo: multi focus\n segmentSelection.clearFocus();\n config.selectionStoreConnector.focus(segmentSelection, e.detail);\n },\n };\n r.push(rowDef);\n return r;\n },\n [],\n );\n columns.push({\n ...colData,\n columnSelectionStore,\n dataPorts,\n });\n x++;\n });\n this.columns = columns;\n // ----------- Handle columns end ----------- //\n\n this.config.scrollingService?.unregister();\n }\n\n private onColumnResize(\n type: DimensionCols,\n { detail }: CustomEvent<ViewSettingSizeProp>,\n store: Observable<DSourceState<ColumnRegular, DimensionCols>>,\n ) {\n this.config.dimensionProvider?.setCustomSizes(type, detail, true);\n const changedItems = reduce(\n detail || {},\n (r: ResizeDetails, size, i) => {\n const index = parseInt(i, 10);\n const item = getSourceItem(store, index);\n if (item) {\n r[index] = { ...item, size };\n }\n return r;\n },\n {},\n );\n this.config.resize(changedItems);\n }\n\n /** register selection store for Segment */\n private registerSegment(position: Cell) {\n return this.config.selectionStoreConnector.register(position);\n }\n\n /** register selection store for Row */\n private registerRow(y: number, type: DimensionRows) {\n return this.config.selectionStoreConnector.registerRow(y, type).store;\n }\n\n /** register selection store for Column */\n private registerCol(x: number, type: DimensionCols) {\n return this.config.selectionStoreConnector.registerColumn(x, type).store;\n }\n\n /** Collect Row data */\n private dataViewPort(data: ViewportColumn) {\n const slots: { [key in DimensionRows]: SlotType } = {\n rowPinStart: HEADER_SLOT,\n rgRow: CONTENT_SLOT,\n rowPinEnd: FOOTER_SLOT,\n };\n\n // y position for selection\n let y = 0;\n return rowTypes.reduce((r, type) => {\n // filter out empty sources, we still need to return source to keep slot working\n const isPresent =\n data.viewports[type].store.get('realCount') || type === 'rgRow';\n const rgCol = {\n ...data,\n position: { ...data.position, y: isPresent ? y : EMPTY_INDEX },\n };\n r.push(\n this.dataPartition(\n rgCol,\n type,\n slots[type],\n type !== 'rgRow', // is fixed\n ),\n );\n if (isPresent) {\n y++;\n }\n return r;\n }, []);\n }\n\n private dataPartition(\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: 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\n scrollToCell(cell: Partial<Cell>) {\n for (let key in cell) {\n const coordinate = cell[key as keyof Cell];\n this.config.scrollingService.proxyScroll({\n dimension: key === 'x' ? 'rgCol' : 'rgRow',\n coordinate,\n });\n }\n }\n\n /**\n * Clear current grid focus\n */\n clearFocused() {\n this.config.selectionStoreConnector.clearAll();\n }\n\n clearEdit() {\n this.config.selectionStoreConnector.setEdit(false);\n }\n\n /**\n * Collect focused element data\n */\n getFocused(): FocusedData | null {\n const focused = this.config.selectionStoreConnector.focusedStore;\n if (!focused) {\n return null;\n }\n // get column data\n const colType =\n this.config.selectionStoreConnector.storesXToType[focused.position.x];\n const column = this.config.columnProvider.getColumn(\n focused.cell.x,\n colType,\n );\n\n // get row data\n const rowType =\n this.config.selectionStoreConnector.storesYToType[focused.position.y];\n const model = this.config.dataProvider.getModel(focused.cell.y, rowType);\n return {\n column,\n model,\n cell: focused.cell,\n colType,\n rowType,\n };\n }\n\n getStoreCoordinateByType(colType: DimensionCols, rowType: DimensionRows) {\n const stores = this.config.selectionStoreConnector.storesByType;\n const storeCoordinate = {\n x: stores[colType],\n y: stores[rowType],\n };\n return storeCoordinate;\n }\n\n setFocus(colType: string, rowType: string, start: Cell, end: Cell) {\n this.config.selectionStoreConnector?.focusByCell(\n this.getStoreCoordinateByType(\n colType as DimensionCols,\n rowType as DimensionRows,\n ),\n start,\n end,\n );\n }\n\n getSelectedRange(): RangeArea | null {\n return this.config.selectionStoreConnector.selectedRange;\n }\n\n setEdit(\n rowIndex: number,\n colIndex: number,\n colType: DimensionCols,\n rowType: DimensionRows,\n ) {\n this.config.selectionStoreConnector?.setEditByCell(\n this.getStoreCoordinateByType(colType, rowType),\n { x: colIndex, y: rowIndex },\n );\n }\n}\n"]}
1
+ {"version":3,"file":"viewport.service.js","sourceRoot":"","sources":["../../../src/components/revoGrid/viewport.service.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,eAAe,CAAC;AAGnC,OAAgC,EAC9B,WAAW,GACZ,MAAM,0CAA0C,CAAC;AAElD,OAAO,EAEL,aAAa,EACb,oBAAoB,GACrB,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAG/D,OAAO,EACL,YAAY,EACZ,WAAW,EACX,WAAW,EACX,WAAW,GACZ,MAAM,oBAAoB,CAAC;AA6C5B,0BAA0B;AAC1B,SAAS,gBAAgB,CAAC,IAAoB;IAC5C,MAAM,YAAY,GAAG,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,KAAK,CAAC;IACzD,MAAM,SAAS,GAAG,YAAY,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;IAG/C,MAAM,IAAI,GAAuB;QAC/B,YAAY,EAAE,SAAS;QACvB,KAAK,EAAE,IAAI,CAAC,OAAO;QACnB,aAAa,EAAE,IAAI,CAAC,aAAa;QACjC,GAAG,EAA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IAAI,CAAC,MAAM,CAAC,uBAAuB,CAAC,aAAa,CAAC;IAC3D,CAAC;IAED,OAAO,CACL,QAAgB,EAChB,QAAgB,EAChB,OAAsB,EACtB,OAAsB;;QAEtB,MAAA,IAAI,CAAC,MAAM,CAAC,uBAAuB,0CAAE,aAAa,CAChD,IAAI,CAAC,wBAAwB,CAAC,OAAO,EAAE,OAAO,CAAC,EAC/C,EAAE,CAAC,EAAE,QAAQ,EAAE,CAAC,EAAE,QAAQ,EAAE,CAC7B,CAAC;IACJ,CAAC;CACF","sourcesContent":["import reduce from 'lodash/reduce';\n\nimport DimensionProvider from '../../services/dimension.provider';\nimport SelectionStoreConnector, {\n EMPTY_INDEX,\n} from '../../services/selection.store.connector';\nimport ViewportProvider from '../../services/viewport.provider';\nimport {\n DSourceState,\n getSourceItem,\n getVisibleSourceItem,\n} from '../../store/dataSource/data.store';\nimport { columnTypes, rowTypes } from '../../store/storeTypes';\nimport { OrdererService } from '../order/order-renderer';\nimport GridScrollingService from './viewport.scrolling.service';\nimport {\n CONTENT_SLOT,\n FOOTER_SLOT,\n getLastCell,\n HEADER_SLOT,\n} from './viewport.helpers';\n\nimport ColumnDataProvider from '../../services/column.data.provider';\nimport { DataProvider } from '../../services/data.provider';\nimport {\n ColumnRegular,\n Observable,\n ViewPortResizeEvent,\n ViewSettingSizeProp,\n} from '../..';\nimport { DimensionCols, DimensionRows } from '../..';\nimport {\n HeaderProperties,\n SlotType,\n ViewportColumn,\n ViewportData,\n ViewportProperties,\n ViewportProps,\n} from '../../types/viewport.interfaces';\nimport { Cell, RangeArea } from '../..';\n\nexport type ResizeDetails = { [index: number]: ColumnRegular };\ntype Config = {\n columnProvider: ColumnDataProvider;\n dataProvider: DataProvider;\n dimensionProvider: DimensionProvider;\n viewportProvider: ViewportProvider;\n scrollingService: GridScrollingService;\n orderService: OrdererService;\n selectionStoreConnector: SelectionStoreConnector;\n\n disableVirtualX?: boolean;\n disableVirtualY?: boolean;\n\n resize(r: ResizeDetails): void;\n};\n\nexport type FocusedData = {\n model: any;\n cell: Cell;\n colType: DimensionCols;\n rowType: DimensionRows;\n column?: ColumnRegular;\n};\n\n/** Collect Column data */\nfunction gatherColumnData(data: ViewportColumn) {\n const colDimension = data.dimensions[data.colType].store;\n const realWidth = colDimension.get('realSize');\n\n\n const prop: ViewportProperties = {\n contentWidth: realWidth,\n class: data.colType,\n contentHeight: data.contentHeight,\n key: data.colType,\n colType: data.colType,\n onResizeviewport: data.onResizeviewport,\n // set viewport size to real size\n style: data.fixWidth ? { minWidth: `${realWidth}px` } : undefined,\n };\n\n const headerProp: HeaderProperties = {\n colData: getVisibleSourceItem(data.colStore),\n dimensionCol: colDimension,\n type: data.colType,\n groups: data.colStore.get('groups'),\n groupingDepth: data.colStore.get('groupingDepth'),\n resizeHandler: data.colType === 'colPinEnd' ? ['l'] : undefined,\n onHeaderresize: data.onHeaderresize,\n };\n\n return {\n prop,\n type: data.colType,\n position: data.position,\n headerProp,\n viewportCol: data.viewports[data.colType].store,\n };\n}\n\nexport default class ViewportService {\n readonly columns: ViewportProps[];\n constructor(\n private config: Config,\n contentHeight: number,\n ) {\n this.config.selectionStoreConnector?.beforeUpdate();\n\n // ----------- Handle columns ----------- //\n\n // Transform data from stores and apply it to different components\n const columns: ViewportProps[] = [];\n let x = 0; // we increase x only if column present\n columnTypes.forEach(val => {\n const colStore = config.columnProvider.stores[val].store;\n // only columns that have data show\n if (!colStore.get('items').length) {\n return;\n }\n const column: ViewportColumn = {\n colType: val,\n position: { x, y: 1 },\n\n contentHeight,\n // only central column has dynamic width\n fixWidth: val !== 'rgCol',\n\n viewports: config.viewportProvider.stores,\n dimensions: config.dimensionProvider.stores,\n rowStores: config.dataProvider.stores,\n\n colStore,\n onHeaderresize: e => this.onColumnResize(val, e, colStore),\n };\n if (val === 'rgCol') {\n column.onResizeviewport = (e: CustomEvent<ViewPortResizeEvent>) => {\n if (config.disableVirtualY && e.detail.dimension === 'rgRow') {\n return;\n } else if (config.disableVirtualX && e.detail.dimension === 'rgCol') {\n return;\n }\n config.viewportProvider?.setViewport(e.detail.dimension, {\n virtualSize: e.detail.size,\n });\n };\n }\n const colData = gatherColumnData(column);\n const columnSelectionStore = this.registerCol(colData.position.x, val);\n\n // render per each column data collections vertically\n const dataPorts = this.dataViewPort(column).reduce<ViewportData[]>(\n (r, rgRow) => {\n // register selection store for Segment\n const segmentSelection = this.registerSegment(rgRow.position);\n segmentSelection.setLastCell(rgRow.lastCell);\n\n // register selection store for Row\n const rowSelectionStore = this.registerRow(\n rgRow.position.y,\n rgRow.type,\n );\n const rowDef: ViewportData = {\n ...rgRow,\n rowSelectionStore,\n segmentSelectionStore: segmentSelection.store,\n ref: (e: Element) =>\n config.selectionStoreConnector.registerSection(e),\n onSetrange: e => {\n segmentSelection.setRangeArea(e.detail);\n },\n onSettemprange: e => {\n segmentSelection.setTempArea(e.detail);\n },\n onFocuscell: e => {\n // todo: multi focus\n segmentSelection.clearFocus();\n config.selectionStoreConnector.focus(segmentSelection, e.detail);\n },\n };\n r.push(rowDef);\n return r;\n },\n [],\n );\n columns.push({\n ...colData,\n columnSelectionStore,\n dataPorts,\n });\n x++;\n });\n this.columns = columns;\n // ----------- Handle columns end ----------- //\n\n this.config.scrollingService?.unregister();\n }\n\n private onColumnResize(\n type: DimensionCols,\n { detail }: CustomEvent<ViewSettingSizeProp>,\n store: Observable<DSourceState<ColumnRegular, DimensionCols>>,\n ) {\n this.config.dimensionProvider?.setCustomSizes(type, detail, true);\n const changedItems = reduce(\n detail || {},\n (r: ResizeDetails, size, i) => {\n const index = parseInt(i, 10);\n const item = getSourceItem(store, index);\n if (item) {\n r[index] = { ...item, size };\n }\n return r;\n },\n {},\n );\n this.config.resize(changedItems);\n }\n\n /** register selection store for Segment */\n private registerSegment(position: Cell) {\n return this.config.selectionStoreConnector.register(position);\n }\n\n /** register selection store for Row */\n private registerRow(y: number, type: DimensionRows) {\n return this.config.selectionStoreConnector.registerRow(y, type).store;\n }\n\n /** register selection store for Column */\n private registerCol(x: number, type: DimensionCols) {\n return this.config.selectionStoreConnector.registerColumn(x, type).store;\n }\n\n /** Collect Row data */\n private dataViewPort(data: ViewportColumn) {\n const slots: { [key in DimensionRows]: SlotType } = {\n rowPinStart: HEADER_SLOT,\n rgRow: CONTENT_SLOT,\n rowPinEnd: FOOTER_SLOT,\n };\n\n // y position for selection\n let y = 0;\n return rowTypes.reduce((r, type) => {\n // filter out empty sources, we still need to return source to keep slot working\n const isPresent =\n data.viewports[type].store.get('realCount') || type === 'rgRow';\n const rgCol = {\n ...data,\n position: { ...data.position, y: isPresent ? y : EMPTY_INDEX },\n };\n r.push(\n this.dataPartition(\n rgCol,\n type,\n slots[type],\n type !== 'rgRow', // is fixed\n ),\n );\n if (isPresent) {\n y++;\n }\n return r;\n }, []);\n }\n\n private dataPartition(\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\n scrollToCell(cell: Partial<Cell>) {\n for (let key in cell) {\n const coordinate = cell[key as keyof Cell];\n this.config.scrollingService.proxyScroll({\n dimension: key === 'x' ? 'rgCol' : 'rgRow',\n coordinate,\n });\n }\n }\n\n /**\n * Clear current grid focus\n */\n clearFocused() {\n this.config.selectionStoreConnector.clearAll();\n }\n\n clearEdit() {\n this.config.selectionStoreConnector.setEdit(false);\n }\n\n /**\n * Collect focused element data\n */\n getFocused(): FocusedData | null {\n const focused = this.config.selectionStoreConnector.focusedStore;\n if (!focused) {\n return null;\n }\n // get column data\n const colType =\n this.config.selectionStoreConnector.storesXToType[focused.position.x];\n const column = this.config.columnProvider.getColumn(\n focused.cell.x,\n colType,\n );\n\n // get row data\n const rowType =\n this.config.selectionStoreConnector.storesYToType[focused.position.y];\n const model = this.config.dataProvider.getModel(focused.cell.y, rowType);\n return {\n column,\n model,\n cell: focused.cell,\n colType,\n rowType,\n };\n }\n\n getStoreCoordinateByType(colType: DimensionCols, rowType: DimensionRows) {\n const stores = this.config.selectionStoreConnector.storesByType;\n const storeCoordinate = {\n x: stores[colType],\n y: stores[rowType],\n };\n return storeCoordinate;\n }\n\n setFocus(colType: string, rowType: string, start: Cell, end: Cell) {\n this.config.selectionStoreConnector?.focusByCell(\n this.getStoreCoordinateByType(\n colType as DimensionCols,\n rowType as DimensionRows,\n ),\n start,\n end,\n );\n }\n\n getSelectedRange(): RangeArea | null {\n return this.config.selectionStoreConnector.selectedRange;\n }\n\n setEdit(\n rowIndex: number,\n colIndex: number,\n colType: DimensionCols,\n rowType: DimensionRows,\n ) {\n this.config.selectionStoreConnector?.setEditByCell(\n this.getStoreCoordinateByType(colType, rowType),\n { x: colIndex, y: rowIndex },\n );\n }\n}\n"]}
@@ -1,44 +1,84 @@
1
1
  import { generateFakeDataObject } from './data.js';
2
2
 
3
+ /**
4
+ * Map of prevented events
5
+ */
3
6
  window.eventsPrevented = {};
7
+
8
+ /**
9
+ * Toggle row headers visibility
10
+ * @param {boolean} isShow - Show row headers if true, hide otherwise
11
+ */
4
12
  window.showRowHeaders = function (isShow) {
5
13
  const grid = document.querySelector('revo-grid');
6
14
  grid.rowHeaders = isShow;
7
15
  };
16
+
17
+ /**
18
+ * Toggle column grouping visibility
19
+ * @param {boolean} isShow - Show column grouping if true, hide otherwise
20
+ */
8
21
  window.showColGrouping = function (isShow) {
9
22
  setData({
10
23
  groupedHeader: isShow,
11
24
  });
12
25
  };
26
+
27
+ /**
28
+ * Set row size
29
+ * @param {number} s - Row size
30
+ */
13
31
  window.setRowSize = function (s) {
14
32
  const grid = document.querySelector('revo-grid');
15
33
  grid.rowSize = s;
16
34
  };
35
+
36
+ /**
37
+ * Start editing cell
38
+ * @param {number} rgRow - Row index
39
+ * @param {string} prop - Column property
40
+ */
17
41
  window.setEdit = function (rgRow, prop) {
18
42
  const grid = document.querySelector('revo-grid');
19
43
  grid.setCellEdit(rgRow, prop);
20
44
  };
45
+
46
+ /**
47
+ * Scroll to column
48
+ * @param {number} [x=30] - Column index
49
+ */
21
50
  window.scrollToCol = function (x = 30) {
22
51
  const grid = document.querySelector('revo-grid');
23
52
  grid.scrollToColumnProp(x);
24
53
  };
54
+
55
+ /**
56
+ * Clear grouping
57
+ */
25
58
  window.clearGrouping = function () {
26
59
  const grid = document.querySelector('revo-grid');
27
60
  grid.grouping = {};
28
61
  };
29
62
 
30
- // Row group
31
- window.setGrouping = function (
32
- props = [],
33
- expandedAll = false,
34
- ) {
63
+ /**
64
+ * Set row grouping
65
+ * @param {Array} props - Array of properties to group by
66
+ * @param {boolean} expandedAll - Expand all groups if true, collapse otherwise
67
+ */
68
+ window.setGrouping = function (props = [], expandedAll = false) {
35
69
  const grid = document.querySelector('revo-grid');
36
70
  grid.grouping = {
37
71
  props,
38
72
  expandedAll,
39
- groupLabelTemplate: (createElement, { name, depth }) => createElement('span', null, ` ${props[depth]}: ${name}`),
73
+ groupLabelTemplate: (createElement, { name, depth }) =>
74
+ createElement('span', null, ` ${props[depth]}: ${name}`),
40
75
  };
41
76
  };
77
+
78
+ /**
79
+ * Set trimmed rows
80
+ * @param {Array} rows - Array of row indexes to trim
81
+ */
42
82
  window.setTrimmed = function (rows = []) {
43
83
  const grid = document.querySelector('revo-grid');
44
84
  grid.trimmedRows = rows.reduce((r, v) => {
@@ -47,6 +87,10 @@ window.setTrimmed = function (rows = []) {
47
87
  }, {});
48
88
  };
49
89
 
90
+ /**
91
+ * Export grid
92
+ * @param {string} [filename='new file'] - File name
93
+ */
50
94
  window.exportGrid = function (filename = 'new file') {
51
95
  const grid = document.querySelector('revo-grid');
52
96
  grid.getPlugins().then(plugins => {
@@ -66,9 +110,12 @@ let defaultData = {
66
110
  bottomPinned: [],
67
111
  colPinEnd: [],
68
112
  colPinStart: [],
69
- // groupedHeader: true,
70
- // order: 5
71
113
  };
114
+
115
+ /**
116
+ * Set data
117
+ * @param {Object} [config={}] - Data configuration
118
+ */
72
119
  window.setData = function (config = {}) {
73
120
  defaultData = { ...defaultData, ...config };
74
121
  const $loader = document.querySelector('.loader');
@@ -85,6 +132,12 @@ window.setData = function (config = {}) {
85
132
  $loader.style.display = 'none';
86
133
  }, 0);
87
134
  };
135
+
136
+ /**
137
+ * Set pinned rows/columns
138
+ * @param {string} type - Type of pinned rows/columns
139
+ * @param {boolean} checked - True if rows/columns are pinned, false otherwise
140
+ */
88
141
  window.setPinned = function (type, checked) {
89
142
  const val = [];
90
143
  if (checked) {
@@ -108,12 +161,22 @@ window.setPinned = function (type, checked) {
108
161
  });
109
162
  };
110
163
 
111
- // prevent event debug
164
+ /**
165
+ * Prevent event debug
166
+ * @param {string} name - Event name
167
+ * @param {boolean} checked - True if event should be prevented, false otherwise
168
+ */
112
169
  window.preventEvent = function (name, checked) {
113
170
  eventsPrevented[name] = checked;
114
171
  };
172
+
115
173
  let keys = 2;
116
174
  let attrs = {};
175
+
176
+ /**
177
+ * Toggle visibility of grid
178
+ * @param {boolean} checked - True if grid is visible, false otherwise
179
+ */
117
180
  window.toggleVisibility = function (checked) {
118
181
  if (!checked) {
119
182
  const grid = document.querySelector('revo-grid');
@@ -141,6 +204,12 @@ window.toggleVisibility = function (checked) {
141
204
  };
142
205
 
143
206
  let timerUpdateInterval;
207
+
208
+ /**
209
+ * Toggle timer update
210
+ * @param {boolean} checked - True if timer should be updated, false otherwise
211
+ * @param {number} [inteval=3] - Update interval in seconds
212
+ */
144
213
  window.timerUpdate = function (checked, inteval = 3) {
145
214
  clearInterval(timerUpdateInterval);
146
215
  if (checked) {
@@ -151,6 +220,10 @@ window.timerUpdate = function (checked, inteval = 3) {
151
220
  }
152
221
  };
153
222
 
223
+ /**
224
+ * Set theme
225
+ * @param {string} theme - Theme name
226
+ */
154
227
  window.theme = function (theme) {
155
228
  const grid = document.querySelector('revo-grid');
156
229
  if (theme && theme.indexOf('dark') > -1) {
@@ -163,6 +236,9 @@ window.theme = function (theme) {
163
236
 
164
237
  window.onload = onLoad;
165
238
 
239
+ /**
240
+ * On load function
241
+ */
166
242
  function onLoad() {
167
243
  const grid = document.querySelector('revo-grid');
168
244
 
@@ -199,21 +275,13 @@ function onLoad() {
199
275
  grid.filter = true;
200
276
  grid.exporting = true;
201
277
  grid.rowHeaders = true;
202
- grid.rowDefinitions = [
203
- {
204
- type: 'rgRow',
205
- index: 1,
206
- size: 100,
207
- },
208
- ];
209
- grid.rowClass = 'row-style';
210
278
  // grid.stretch = true;
211
279
  /*
212
280
  grid.autoSizeColumn = {
213
281
  mode: 'autoSizeAll',
214
282
  };*/
215
283
  // default
216
- setData({ rows: 1000, cols: 1000 });
284
+ setData({ rows: 100, cols: 2 });
217
285
 
218
286
  // events testing
219
287
  // 'beforerange', 'setRange', 'beforefocuslost', 'beforecellfocus', 'afterfocus', 'beforeedit', 'aftercolumnresize'
@@ -3,5 +3,4 @@
3
3
  */
4
4
  export * from './selection.store';
5
5
  export * from './selection.helpers';
6
- export * from './selection.store.service';
7
6
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/store/selection/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,2BAA2B,CAAC","sourcesContent":["export * from './selection.store';\nexport * from './selection.helpers';\nexport * from './selection.store.service';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/store/selection/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC","sourcesContent":["export * from './selection.store';\nexport * from './selection.helpers';\n\n"]}
@@ -1,2 +1,6 @@
1
+ /*!
2
+ * Built by Revolist OU ❤️
3
+ */
4
+ ;
1
5
  export {};
2
6
  //# sourceMappingURL=interfaces.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../src/types/interfaces.ts"],"names":[],"mappings":"","sourcesContent":["/* eslint-disable */\n/* tslint:disable */\n// @ts-ignore\nimport { VNode } from '@stencil/core';\n// @ts-ignore\nimport { ObservableMap, Subscription } from '@stencil/store';\n\nimport {\n DimensionCols,\n DimensionRows,\n DimensionColPin,\n DimensionType,\n MultiDimensionType,\n} from './dimension';\nimport {\n Cell,\n EditorCtr,\n FocusedCells,\n RangeArea,\n SelectionStoreState,\n} from './selection';\n\nexport type Observable<T> = ObservableMap<T>;\nexport type PluginSubscribe<T> = Subscription<T>;\n\nexport type ColumnDataSchemaModel = {\n // Column prop used for mapping value to cell from data source model/row\n prop: ColumnProp;\n // Row data object\n model: DataType;\n // Column data object\n column: ColumnRegular;\n rowIndex: number;\n colIndex: number;\n // Column type based on viewport\n colType: DimensionCols;\n // Row type based on viewport\n type: DimensionRows;\n // Row models based on viewport\n data: DataSource;\n // Current cell data\n value: any;\n};\nexport type CellTemplateProp = {\n providers: Providers;\n} & ColumnDataSchemaModel;\nexport type ReadOnlyFormat =\n | boolean\n | ((params: ColumnDataSchemaModel) => boolean);\nexport type RowDrag =\n | boolean\n | {\n (params: ColumnDataSchemaModel): boolean;\n };\nexport interface ColumnGrouping {\n children: ColumnDataSchema[];\n name: DataFormat;\n}\nexport interface ColumnProperties {\n /** column inner template */\n columnTemplate?: ColumnTemplateFunc;\n /** cell properties */\n columnProperties?: ColPropertiesFunc;\n}\nexport type ColumnTypes = {\n [name: string]: ColumnType;\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}\nexport interface ColumnType extends ColumnProperties {\n /** is column or cell readonly */\n readonly?: ReadOnlyFormat;\n /** default column size */\n size?: number;\n /**\n * minimal column size\n * this property can not be less than cell padding\n * in order to keep performance on top and minimize dom elements number\n */\n minSize?: number;\n /** max column size */\n maxSize?: number;\n /** represents custom editor defined in @editors property */\n editor?: string | EditorCtr;\n /** cell properties */\n cellProperties?: PropertiesFunc;\n /** cell inner template, now template is async */\n cellTemplate?: CellTemplate;\n /** cell compare function */\n cellCompare?: CellCompareFunc;\n}\nexport type Order = 'asc' | 'desc' | undefined;\nexport interface ColumnRegular extends ColumnType {\n // mapping to data, it's object keys/props, @required used for indexing\n prop: ColumnProp;\n // column pin 'colPinStart'|'colPinEnd'\n pin?: DimensionColPin;\n // column header\n name?: DataFormat;\n // column size would be changed based on content size\n autoSize?: boolean;\n // filter\n filter?: boolean | string | string[];\n // is column can be sorted, check @cellCompare function for custom sorting\n sortable?: boolean;\n // sort order\n order?: Order;\n // is cell in column or individual can be dragged\n rowDrag?: RowDrag;\n // represents type defined in @columnTypes property\n columnType?: string;\n // called before column applied to the store\n beforeSetup?(rgCol: ColumnRegular): void;\n // other keys\n [key: string]: any;\n}\nexport type ColumnDataSchema = ColumnGrouping | ColumnRegular;\nexport type ColumnData = ColumnDataSchema[];\nexport type ColumnTemplateProp = ColumnRegular & {\n providers: Providers<DimensionCols | 'rowHeaders'>;\n index: number;\n};\nexport type ColumnPropProp = ColumnGrouping | ColumnTemplateProp;\n// Regularly all column are indexed by prop\nexport type ColumnProp = string | number;\nexport type DataFormat = any;\nexport type CellProp = string | number | object | boolean | undefined;\nexport type CellProps = {\n style?: {\n [key: string]: string | undefined;\n };\n class?:\n | {\n [key: string]: boolean;\n }\n | string;\n [attr: string]: CellProp;\n};\n/**\n * Providers for grid which are going to be injected into each cell template\n */\nexport type Providers<T = DimensionRows> = {\n // dimension type\n type: T;\n // is grid in readonly mode\n readonly: boolean;\n // data source store\n data: Observable<DataSourceState<any, any>> | ColumnRegular[];\n // viewport store\n viewport: Observable<ViewportState>;\n // dimension store\n dimension: Observable<DimensionSettingsState>;\n // selection store\n selection: Observable<SelectionStoreState>;\n};\nexport interface HyperFunc<T> {\n (tag: any): T;\n}\nexport interface HyperFunc<T> {\n (tag: any, data: any): T;\n}\nexport interface HyperFunc<T> {\n (tag: any, text: string): T;\n}\nexport interface HyperFunc<T> {\n (sel: any, children: Array<T | undefined | null>): T;\n}\nexport interface HyperFunc<T> {\n (sel: any, data: any, text: string): T;\n}\nexport interface HyperFunc<T> {\n (sel: any, data: any, children: Array<T | undefined | null>): T;\n}\nexport interface HyperFunc<T> {\n (sel: any, data: any, children: T): T;\n}\nexport type FocusTemplateFunc = (\n createElement: HyperFunc<VNode>,\n detail: FocusRenderEvent,\n) => any;\nexport type CellCompareFunc = (\n prop: ColumnProp,\n a: DataType,\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 = {\n [T in ColumnProp]: DataFormat;\n};\nexport type DataSource = DataType[];\nexport type DataLookup = {\n [rowIndex: number]: DataType;\n};\nexport type RowDefinition = {\n type: DimensionRows;\n size: number;\n index: number;\n};\nexport interface RowHeaders extends ColumnRegular {}\nexport type ViewPortResizeEvent = {\n dimension: DimensionType;\n size: number;\n rowHeader?: boolean;\n};\nexport type ViewPortScrollEvent = {\n dimension: DimensionType;\n coordinate: number;\n delta?: number;\n outside?: boolean;\n};\nexport type InitialHeaderClick = {\n index: number;\n originalEvent: MouseEvent;\n column: ColumnRegular;\n};\nexport type Range = {\n start: number;\n end: number;\n};\nexport type ViewportStateItems = {\n items: VirtualPositionItem[];\n} & Range;\nexport interface ViewportState extends ViewportStateItems {\n realCount: number;\n virtualSize: number;\n}\nexport type ViewSettingSizeProp = Record<string, number>;\nexport interface VirtualPositionItem extends PositionItem {\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}\nexport interface DimensionCalc {\n indexes: number[];\n count: number;\n positionIndexes: number[];\n positionIndexToItem: {\n [position: number]: PositionItem;\n };\n indexToItem: {\n [index: number]: PositionItem;\n };\n trimmed: Record<any, any>;\n sizes: ViewSettingSizeProp;\n}\nexport interface DimensionSettingsState extends DimensionCalc {\n realSize: number;\n originItemSize: number;\n}\n\nexport type DimensionStores = {\n [T in MultiDimensionType]: Observable<DimensionSettingsState>;\n};\n\nexport type ViewportStores = {\n [T in MultiDimensionType]: Observable<ViewportState>;\n};\n\nexport type DragStartEvent = {\n originalEvent: MouseEvent;\n model: ColumnDataSchemaModel;\n};\n\nexport interface BeforeCellRenderEvent<T = any> extends AllDimensionType {\n column: VirtualPositionItem;\n row: VirtualPositionItem;\n model: T;\n}\n\nexport interface BeforeRowRenderEvent<T = any> extends AllDimensionType {\n dataItem: T;\n item: VirtualPositionItem;\n node: VNode;\n}\n\nexport type AfterRendererEvent = {\n type: DimensionType;\n};\n\nexport interface AllDimensionType {\n rowType: DimensionRows;\n colType: DimensionCols;\n}\n\nexport type ApplyFocusEvent = AllDimensionType & FocusedCells;\nexport interface FocusRenderEvent extends AllDimensionType {\n range: RangeArea;\n next?: Partial<Cell>;\n}\nexport type ScrollCoordinateEvent = {\n type: DimensionType;\n coordinate: number;\n};\n"]}
1
+ {"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../src/types/interfaces.ts"],"names":[],"mappings":"AA2PC,CAAC","sourcesContent":["/* eslint-disable */\n/* tslint:disable */\n// @ts-ignore\nimport { VNode } from '@stencil/core';\n// @ts-ignore\nimport { ObservableMap, Subscription } from '@stencil/store';\n\nimport {\n DimensionCols,\n DimensionRows,\n DimensionColPin,\n DimensionType,\n MultiDimensionType,\n} from './dimension';\nimport {\n Cell,\n EditorCtr,\n FocusedCells,\n RangeArea,\n SelectionStoreState,\n} from './selection';\n\nexport type Observable<T> = ObservableMap<T>;\nexport type PluginSubscribe<T> = Subscription<T>;\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 = {\n /**\n * An array of `ColumnDataSchema` objects that represent the children of the grouping.\n */\n children: ColumnDataSchema[];\n /**\n * A `DataFormat` object that represents the name of the grouping.\n */\n name: DataFormat;\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};\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?: DataFormat;\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 ColumnDataSchema = ColumnGrouping | ColumnRegular;\n\nexport type ColumnData = ColumnDataSchema[];\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 = any;\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 = {\n [T in ColumnProp]: DataFormat;\n};\n\nexport type DataLookup = {\n [rowIndex: number]: DataType;\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};\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 dataItem: 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 * Represents the next cell to focus.\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"]}
@@ -12,18 +12,28 @@ export function verifyTouchTarget(touchEvent, focusClass) {
12
12
  }
13
13
  return true;
14
14
  }
15
- export function getFromEvent(e, prop, focusClass // for touch events
15
+ /**
16
+ * Function to get the value of a specific property from a MouseEvent or TouchEvent object.
17
+ */
18
+ export function getPropertyFromEvent(e, prop, focusClass // for touch events
16
19
  ) {
20
+ // Check if the event is a touch event
17
21
  if (isTouch(e)) {
22
+ // If the event has touches, get the first touch
18
23
  if (e.touches.length > 0) {
19
24
  const touchEvent = e.touches[0];
25
+ // Check if the target of the touch event is the specified element
20
26
  if (!verifyTouchTarget(touchEvent, focusClass)) {
27
+ // If not, return null
21
28
  return null;
22
29
  }
30
+ // Get the value of the specified property from the touch event and return it
23
31
  return touchEvent[prop] || 0;
24
32
  }
33
+ // If there are no touches, return null
25
34
  return null;
26
35
  }
36
+ // If the event is not a touch event, get the value of the specified property from the event and return it
27
37
  return e[prop] || 0;
28
38
  }
29
39
  //# sourceMappingURL=events.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"events.js","sourceRoot":"","sources":["../../src/utils/events.ts"],"names":[],"mappings":"AAAA,SAAS,OAAO,CAAC,CAA0B;IACzC,OAAO,CAAC,CAAE,CAAgB,CAAC,OAAO,CAAC;AACrC,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,UAAkB,EAAE,UAAmB;IACvE,IAAI,UAAU,IAAI,UAAU,EAAE,CAAC;QAC7B,IAAI,CAAC,CAAC,UAAU,CAAC,MAAM,YAAY,OAAO,IAAI,UAAU,CAAC,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC,EAAE,CAAC;YAChG,OAAO,KAAK,CAAC;QACf,CAAC;IACH,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAGD,MAAM,UAAU,YAAY,CAC1B,CAA0B,EAC1B,IAAsE,EACtE,UAAmB,CAAC,mBAAmB;;IAEvC,IAAI,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC;QACf,IAAI,CAAC,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACzB,MAAM,UAAU,GAAG,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;YAChC,IAAI,CAAC,iBAAiB,CAAC,UAAU,EAAE,UAAU,CAAC,EAAE,CAAC;gBAC/C,OAAO,IAAI,CAAC;YACd,CAAC;YACD,OAAQ,UAAU,CAAC,IAAI,CAAY,IAAI,CAAC,CAAC;QAC3C,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IACD,OAAO,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACtB,CAAC","sourcesContent":["function isTouch(e: MouseEvent | TouchEvent): e is TouchEvent {\n return !!(e as TouchEvent).touches;\n}\n\nexport function verifyTouchTarget(touchEvent?: Touch, focusClass?: string) {\n if (focusClass && touchEvent) {\n if (!(touchEvent.target instanceof Element && touchEvent.target.classList.contains(focusClass))) { \n return false;\n }\n }\n return true;\n}\n\n\nexport function getFromEvent(\n e: MouseEvent | TouchEvent,\n prop: keyof Pick<Touch, 'clientX' | 'clientY' | 'screenX' | 'screenY'>,\n focusClass?: string // for touch events\n): number | null {\n if (isTouch(e)) {\n if (e.touches.length > 0) {\n const touchEvent = e.touches[0];\n if (!verifyTouchTarget(touchEvent, focusClass)) {\n return null;\n }\n return (touchEvent[prop] as number) || 0;\n }\n return null;\n }\n return e[prop] || 0;\n}\n"]}
1
+ {"version":3,"file":"events.js","sourceRoot":"","sources":["../../src/utils/events.ts"],"names":[],"mappings":"AAAA,SAAS,OAAO,CAAC,CAA0B;IACzC,OAAO,CAAC,CAAE,CAAgB,CAAC,OAAO,CAAC;AACrC,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,UAAkB,EAAE,UAAmB;IACvE,IAAI,UAAU,IAAI,UAAU,EAAE,CAAC;QAC7B,IAAI,CAAC,CAAC,UAAU,CAAC,MAAM,YAAY,OAAO,IAAI,UAAU,CAAC,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC,EAAE,CAAC;YAChG,OAAO,KAAK,CAAC;QACf,CAAC;IACH,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAGD;;GAEG;AACH,MAAM,UAAU,oBAAoB,CAClC,CAA0B,EAC1B,IAAsE,EACtE,UAAmB,CAAC,mBAAmB;;IAEvC,sCAAsC;IACtC,IAAI,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC;QACf,gDAAgD;QAChD,IAAI,CAAC,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACzB,MAAM,UAAU,GAAG,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;YAChC,kEAAkE;YAClE,IAAI,CAAC,iBAAiB,CAAC,UAAU,EAAE,UAAU,CAAC,EAAE,CAAC;gBAC/C,sBAAsB;gBACtB,OAAO,IAAI,CAAC;YACd,CAAC;YACD,6EAA6E;YAC7E,OAAQ,UAAU,CAAC,IAAI,CAAY,IAAI,CAAC,CAAC;QAC3C,CAAC;QACD,uCAAuC;QACvC,OAAO,IAAI,CAAC;IACd,CAAC;IACD,0GAA0G;IAC1G,OAAO,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACtB,CAAC","sourcesContent":["function isTouch(e: MouseEvent | TouchEvent): e is TouchEvent {\n return !!(e as TouchEvent).touches;\n}\n\nexport function verifyTouchTarget(touchEvent?: Touch, focusClass?: string) {\n if (focusClass && touchEvent) {\n if (!(touchEvent.target instanceof Element && touchEvent.target.classList.contains(focusClass))) { \n return false;\n }\n }\n return true;\n}\n\n\n/**\n * Function to get the value of a specific property from a MouseEvent or TouchEvent object.\n */\nexport function getPropertyFromEvent(\n e: MouseEvent | TouchEvent,\n prop: keyof Pick<Touch, 'clientX' | 'clientY' | 'screenX' | 'screenY'>,\n focusClass?: string // for touch events\n): number | null {\n // Check if the event is a touch event\n if (isTouch(e)) {\n // If the event has touches, get the first touch\n if (e.touches.length > 0) {\n const touchEvent = e.touches[0];\n // Check if the target of the touch event is the specified element\n if (!verifyTouchTarget(touchEvent, focusClass)) {\n // If not, return null\n return null;\n }\n // Get the value of the specified property from the touch event and return it\n return (touchEvent[prop] as number) || 0;\n }\n // If there are no touches, return null\n return null;\n }\n // If the event is not a touch event, get the value of the specified property from the event and return it\n return e[prop] || 0;\n}\n"]}
@@ -2,8 +2,8 @@
2
2
  * Built by Revolist OU ❤️
3
3
  */
4
4
  const LETTER_BLOCK_SIZE = 10;
5
- export const calculateRowHeaderSize = (itemsLength, rowHeaderColumn) => {
5
+ export const calculateRowHeaderSize = (itemsLength, rowHeaderColumn, minWidth = 50) => {
6
6
  return ((rowHeaderColumn === null || rowHeaderColumn === void 0 ? void 0 : rowHeaderColumn.size) ||
7
- (itemsLength.toString().length + 1) * LETTER_BLOCK_SIZE);
7
+ Math.max((itemsLength.toString().length + 1) * LETTER_BLOCK_SIZE, minWidth));
8
8
  };
9
9
  //# sourceMappingURL=row-header-utils.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"row-header-utils.js","sourceRoot":"","sources":["../../src/utils/row-header-utils.ts"],"names":[],"mappings":"AAEA,MAAM,iBAAiB,GAAG,EAAE,CAAC;AAC7B,MAAM,CAAC,MAAM,sBAAsB,GAAG,CACpC,WAAmB,EACnB,eAA4B,EAC5B,EAAE;IACF,OAAO,CACL,CAAA,eAAe,aAAf,eAAe,uBAAf,eAAe,CAAE,IAAI;QACrB,CAAC,WAAW,CAAC,QAAQ,EAAE,CAAC,MAAM,GAAG,CAAC,CAAC,GAAG,iBAAiB,CACxD,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import { RowHeaders } from '..';\n\nconst LETTER_BLOCK_SIZE = 10;\nexport const calculateRowHeaderSize = (\n itemsLength: number,\n rowHeaderColumn?: RowHeaders,\n) => {\n return (\n rowHeaderColumn?.size ||\n (itemsLength.toString().length + 1) * LETTER_BLOCK_SIZE\n );\n};\n"]}
1
+ {"version":3,"file":"row-header-utils.js","sourceRoot":"","sources":["../../src/utils/row-header-utils.ts"],"names":[],"mappings":"AAEA,MAAM,iBAAiB,GAAG,EAAE,CAAC;AAC7B,MAAM,CAAC,MAAM,sBAAsB,GAAG,CACpC,WAAmB,EACnB,eAA4B,EAC5B,QAAQ,GAAG,EAAE,EACb,EAAE;IACF,OAAO,CACL,CAAA,eAAe,aAAf,eAAe,uBAAf,eAAe,CAAE,IAAI;QACrB,IAAI,CAAC,GAAG,CAAC,CAAC,WAAW,CAAC,QAAQ,EAAE,CAAC,MAAM,GAAG,CAAC,CAAC,GAAG,iBAAiB,EAAE,QAAQ,CAAC,CAC5E,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import { RowHeaders } from '..';\n\nconst LETTER_BLOCK_SIZE = 10;\nexport const calculateRowHeaderSize = (\n itemsLength: number,\n rowHeaderColumn?: RowHeaders,\n minWidth = 50,\n) => {\n return (\n rowHeaderColumn?.size ||\n Math.max((itemsLength.toString().length + 1) * LETTER_BLOCK_SIZE, minWidth)\n );\n};\n"]}
@@ -137,16 +137,30 @@ function isSameGroup(currentGroup, currentModel, nextModel) {
137
137
  return currentModel[GROUP_DEPTH] < depth;
138
138
  }
139
139
 
140
- /** Collect data for pinned columns in required @ViewportProps format */
141
- const HEADER_SLOT = 'header';
142
- const FOOTER_SLOT = 'footer';
143
- const CONTENT_SLOT = 'content';
144
- const DATA_SLOT = 'data';
145
- /** Receive last visible in viewport by required type */
140
+ /**
141
+ * Collects data for pinned columns in the required @ViewportProps format.
142
+ */
143
+ /**
144
+ * Represents the slot names for the viewport slots.
145
+ */
146
+ const HEADER_SLOT = 'header'; // Slot name for the header slot
147
+ const FOOTER_SLOT = 'footer'; // Slot name for the footer slot
148
+ const CONTENT_SLOT = 'content'; // Slot name for the content slot
149
+ const DATA_SLOT = 'data'; // Slot name for the data slot
150
+ /**
151
+ * Returns the last visible cell in the viewport for a given row type.
152
+ * Coordinates are not zero-based and are relative to the viewport.
153
+ * If needed to be zero-based they can be adjusted by subtracting 1.
154
+ */
146
155
  function getLastCell(data, rowType) {
156
+ // Get the last visible column count from the viewport column data.
157
+ const lastVisibleColumnCount = data.viewports[data.colType].store.get('realCount');
158
+ // Get the last visible row count for the given row type from the viewport column data.
159
+ const lastVisibleRowCount = data.viewports[rowType].store.get('realCount');
160
+ // Return the last visible cell with the last visible column count and row count.
147
161
  return {
148
- x: data.viewports[data.colType].store.get('realCount'),
149
- y: data.viewports[rowType].store.get('realCount'),
162
+ x: lastVisibleColumnCount,
163
+ y: lastVisibleRowCount,
150
164
  };
151
165
  }
152
166
 
@@ -523,4 +537,4 @@ function doPropMerge(existing, extra) {
523
537
 
524
538
  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, getLastCell as l, doPropMerge as m, ColumnService as n, GROUP_EXPAND_BTN as o, PSEUDO_GROUP_ITEM as p, isRowDragService as q, getCellData as r };
525
539
 
526
- //# sourceMappingURL=column.service-f4922a8d.js.map
540
+ //# sourceMappingURL=column.service-195345ab.js.map