@revolist/revogrid 4.12.2 → 4.12.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/{app-globals-66b5e3d1.js → app-globals-f72a6199.js} +2 -2
- package/dist/cjs/{app-globals-66b5e3d1.js.map → app-globals-f72a6199.js.map} +1 -1
- package/dist/cjs/{column.drag.plugin-2c24c512.js → column.drag.plugin-c4e46169.js} +181 -187
- package/dist/cjs/column.drag.plugin-c4e46169.js.map +1 -0
- package/dist/cjs/{column.service-cb3d757e.js → column.service-4339fa5d.js} +73 -57
- package/dist/cjs/column.service-4339fa5d.js.map +1 -0
- package/dist/cjs/{dimension.helpers-4527475f.js → dimension.helpers-5b822a09.js} +3 -2
- package/dist/cjs/dimension.helpers-5b822a09.js.map +1 -0
- package/dist/cjs/{edit.utils-787a9e1d.js → edit.utils-32d4c9e4.js} +2 -2
- package/dist/cjs/{edit.utils-787a9e1d.js.map → edit.utils-32d4c9e4.js.map} +1 -1
- package/dist/cjs/{filter.button-48acc2db.js → filter.button-2708e602.js} +2 -2
- package/dist/cjs/{filter.button-48acc2db.js.map → filter.button-2708e602.js.map} +1 -1
- package/dist/cjs/{header-cell-renderer-9d81a1fe.js → header-cell-renderer-aa96a9bd.js} +3 -3
- package/dist/cjs/{header-cell-renderer-9d81a1fe.js.map → header-cell-renderer-aa96a9bd.js.map} +1 -1
- package/dist/cjs/{index-bdea2cb6.js → index-8006d065.js} +8 -1
- package/dist/cjs/index-8006d065.js.map +1 -0
- package/dist/cjs/index.cjs.js +15 -10
- package/dist/cjs/index.cjs.js.map +1 -1
- package/dist/cjs/{key.utils-fcd0dda2.js → key.utils-05f14738.js} +2 -2
- package/dist/cjs/{key.utils-fcd0dda2.js.map → key.utils-05f14738.js.map} +1 -1
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/revo-grid.cjs.entry.js +7 -7
- package/dist/cjs/revo-grid.cjs.js +2 -2
- package/dist/cjs/revogr-attribution_7.cjs.entry.js +7 -7
- package/dist/cjs/revogr-clipboard_3.cjs.entry.js +5 -5
- package/dist/cjs/revogr-data_4.cjs.entry.js +15 -51
- package/dist/cjs/revogr-data_4.cjs.entry.js.map +1 -1
- package/dist/cjs/revogr-filter-panel.cjs.entry.js +2 -2
- package/dist/cjs/sorting.sign-b22d3d68.js +72 -0
- package/dist/cjs/sorting.sign-b22d3d68.js.map +1 -0
- package/dist/cjs/{text-editor-9f64bd5e.js → text-editor-82f53111.js} +3 -3
- package/dist/cjs/{text-editor-9f64bd5e.js.map → text-editor-82f53111.js.map} +1 -1
- package/dist/cjs/{throttle-6a2a8510.js → throttle-08957661.js} +2 -2
- package/dist/cjs/{throttle-6a2a8510.js.map → throttle-08957661.js.map} +1 -1
- package/dist/cjs/{viewport.store-0c68c932.js → viewport.store-4dbfeaa3.js} +2 -2
- package/dist/cjs/{viewport.store-0c68c932.js.map → viewport.store-4dbfeaa3.js.map} +1 -1
- package/dist/collection/components/data/cell-renderer.js +1 -1
- package/dist/collection/components/data/cell-renderer.js.map +1 -1
- package/dist/collection/components/data/revogr-data.js +2 -1
- package/dist/collection/components/data/revogr-data.js.map +1 -1
- package/dist/collection/plugins/filter/filter.plugin.js +1 -5
- package/dist/collection/plugins/filter/filter.plugin.js.map +1 -1
- package/dist/collection/plugins/groupingRow/grouping.row.plugin.js +57 -57
- package/dist/collection/plugins/groupingRow/grouping.row.plugin.js.map +1 -1
- package/dist/collection/plugins/groupingRow/grouping.row.renderer.js +16 -6
- package/dist/collection/plugins/groupingRow/grouping.row.renderer.js.map +1 -1
- package/dist/collection/plugins/groupingRow/grouping.row.types.js.map +1 -1
- package/dist/collection/plugins/groupingRow/grouping.service.js +70 -54
- package/dist/collection/plugins/groupingRow/grouping.service.js.map +1 -1
- package/dist/collection/plugins/index.js +0 -1
- package/dist/collection/plugins/index.js.map +1 -1
- package/dist/collection/serve/data.js +5 -0
- package/dist/collection/store/dataSource/trimmed.plugin.js +1 -0
- package/dist/collection/store/dataSource/trimmed.plugin.js.map +1 -1
- package/dist/collection/types/interfaces.js.map +1 -1
- package/dist/esm/{app-globals-60fd3b54.js → app-globals-6b929fd8.js} +2 -2
- package/dist/esm/{app-globals-60fd3b54.js.map → app-globals-6b929fd8.js.map} +1 -1
- package/dist/esm/{column.drag.plugin-6a84d7b0.js → column.drag.plugin-94964d01.js} +180 -188
- package/dist/esm/column.drag.plugin-94964d01.js.map +1 -0
- package/dist/esm/{column.service-ff8f75de.js → column.service-c0d404a6.js} +74 -58
- package/dist/esm/column.service-c0d404a6.js.map +1 -0
- package/dist/esm/{dimension.helpers-a4dd4f76.js → dimension.helpers-5567e424.js} +3 -2
- package/dist/esm/dimension.helpers-5567e424.js.map +1 -0
- package/dist/esm/{edit.utils-dd8b5cd7.js → edit.utils-b59306be.js} +2 -2
- package/dist/esm/{edit.utils-dd8b5cd7.js.map → edit.utils-b59306be.js.map} +1 -1
- package/dist/esm/{filter.button-d9b783c1.js → filter.button-84396156.js} +2 -2
- package/dist/esm/{filter.button-d9b783c1.js.map → filter.button-84396156.js.map} +1 -1
- package/dist/esm/{header-cell-renderer-4508273a.js → header-cell-renderer-0f5bd4a9.js} +3 -3
- package/dist/esm/{header-cell-renderer-4508273a.js.map → header-cell-renderer-0f5bd4a9.js.map} +1 -1
- package/dist/esm/{index-b5695870.js → index-f6fae858.js} +8 -2
- package/dist/esm/index-f6fae858.js.map +1 -0
- package/dist/esm/index.js +11 -11
- package/dist/esm/{key.utils-38b263fb.js → key.utils-3632161b.js} +2 -2
- package/dist/esm/{key.utils-38b263fb.js.map → key.utils-3632161b.js.map} +1 -1
- package/dist/esm/loader.js +3 -3
- package/dist/esm/revo-grid.entry.js +7 -7
- package/dist/esm/revo-grid.js +3 -3
- package/dist/esm/revogr-attribution_7.entry.js +7 -7
- package/dist/esm/revogr-clipboard_3.entry.js +5 -5
- package/dist/esm/revogr-data_4.entry.js +13 -49
- package/dist/esm/revogr-data_4.entry.js.map +1 -1
- package/dist/esm/revogr-filter-panel.entry.js +2 -2
- package/dist/esm/sorting.sign-a92ff239.js +65 -0
- package/dist/esm/sorting.sign-a92ff239.js.map +1 -0
- package/dist/esm/{text-editor-7fbbcea7.js → text-editor-e47e56c3.js} +3 -3
- package/dist/esm/{text-editor-7fbbcea7.js.map → text-editor-e47e56c3.js.map} +1 -1
- package/dist/esm/{throttle-61be638a.js → throttle-05489451.js} +2 -2
- package/dist/esm/{throttle-61be638a.js.map → throttle-05489451.js.map} +1 -1
- package/dist/esm/{viewport.store-e66c1a9b.js → viewport.store-c18a25a6.js} +2 -2
- package/dist/esm/{viewport.store-e66c1a9b.js.map → viewport.store-c18a25a6.js.map} +1 -1
- package/dist/revo-grid/app-globals-6b929fd8.js +5 -0
- package/dist/revo-grid/{column.drag.plugin-6a84d7b0.js → column.drag.plugin-94964d01.js} +2 -2
- package/dist/revo-grid/column.drag.plugin-94964d01.js.map +1 -0
- package/dist/revo-grid/column.service-c0d404a6.js +5 -0
- package/dist/revo-grid/column.service-c0d404a6.js.map +1 -0
- package/dist/revo-grid/{dimension.helpers-a4dd4f76.js → dimension.helpers-5567e424.js} +2 -2
- package/dist/revo-grid/{dimension.helpers-a4dd4f76.js.map → dimension.helpers-5567e424.js.map} +1 -1
- package/dist/revo-grid/edit.utils-b59306be.js +5 -0
- package/dist/revo-grid/{filter.button-d9b783c1.js → filter.button-84396156.js} +2 -2
- package/dist/revo-grid/{header-cell-renderer-4508273a.js → header-cell-renderer-0f5bd4a9.js} +2 -2
- package/dist/revo-grid/index-f6fae858.js +6 -0
- package/dist/revo-grid/index-f6fae858.js.map +1 -0
- package/dist/revo-grid/index.esm.js +1 -1
- package/dist/revo-grid/index.esm.js.map +1 -1
- package/dist/revo-grid/key.utils-3632161b.js +5 -0
- package/dist/revo-grid/revo-grid.entry.js +1 -1
- package/dist/revo-grid/revo-grid.esm.js +1 -1
- package/dist/revo-grid/revogr-attribution_7.entry.js +1 -1
- package/dist/revo-grid/revogr-clipboard_3.entry.js +1 -1
- package/dist/revo-grid/revogr-data_4.entry.js +1 -1
- package/dist/revo-grid/revogr-data_4.entry.js.map +1 -1
- package/dist/revo-grid/revogr-filter-panel.entry.js +1 -1
- package/dist/revo-grid/sorting.sign-a92ff239.js +5 -0
- package/dist/revo-grid/sorting.sign-a92ff239.js.map +1 -0
- package/dist/revo-grid/text-editor-e47e56c3.js +5 -0
- package/dist/revo-grid/{throttle-61be638a.js → throttle-05489451.js} +2 -2
- package/dist/revo-grid/{viewport.store-e66c1a9b.js → viewport.store-c18a25a6.js} +2 -2
- package/dist/types/plugins/filter/filter.plugin.d.ts +2 -1
- package/dist/types/plugins/groupingRow/grouping.row.plugin.d.ts +7 -4
- package/dist/types/plugins/groupingRow/grouping.row.renderer.d.ts +6 -3
- package/dist/types/plugins/groupingRow/grouping.row.types.d.ts +6 -3
- package/dist/types/plugins/groupingRow/grouping.service.d.ts +0 -1
- package/dist/types/plugins/index.d.ts +0 -1
- package/dist/types/store/dataSource/trimmed.plugin.d.ts +3 -1
- package/dist/types/types/interfaces.d.ts +19 -0
- package/hydrate/index.js +186 -157
- package/hydrate/index.mjs +186 -157
- package/package.json +1 -1
- package/standalone/column.service.js +70 -54
- package/standalone/column.service.js.map +1 -1
- package/standalone/data.store.js +1 -0
- package/standalone/data.store.js.map +1 -1
- package/standalone/index.js +2 -1
- package/standalone/index.js.map +1 -1
- package/standalone/revo-grid.js +174 -182
- package/standalone/revo-grid.js.map +1 -1
- package/standalone/revogr-data2.js +18 -8
- package/standalone/revogr-data2.js.map +1 -1
- package/dist/cjs/column.drag.plugin-2c24c512.js.map +0 -1
- package/dist/cjs/column.service-cb3d757e.js.map +0 -1
- package/dist/cjs/dimension.helpers-4527475f.js.map +0 -1
- package/dist/cjs/index-bdea2cb6.js.map +0 -1
- package/dist/cjs/sorting.sign-83d75503.js +0 -15
- package/dist/cjs/sorting.sign-83d75503.js.map +0 -1
- package/dist/esm/column.drag.plugin-6a84d7b0.js.map +0 -1
- package/dist/esm/column.service-ff8f75de.js.map +0 -1
- package/dist/esm/dimension.helpers-a4dd4f76.js.map +0 -1
- package/dist/esm/index-b5695870.js.map +0 -1
- package/dist/esm/sorting.sign-e096163a.js +0 -13
- package/dist/esm/sorting.sign-e096163a.js.map +0 -1
- package/dist/revo-grid/app-globals-60fd3b54.js +0 -5
- package/dist/revo-grid/column.drag.plugin-6a84d7b0.js.map +0 -1
- package/dist/revo-grid/column.service-ff8f75de.js +0 -5
- package/dist/revo-grid/column.service-ff8f75de.js.map +0 -1
- package/dist/revo-grid/edit.utils-dd8b5cd7.js +0 -5
- package/dist/revo-grid/index-b5695870.js +0 -6
- package/dist/revo-grid/index-b5695870.js.map +0 -1
- package/dist/revo-grid/key.utils-38b263fb.js +0 -5
- package/dist/revo-grid/sorting.sign-e096163a.js +0 -5
- package/dist/revo-grid/sorting.sign-e096163a.js.map +0 -1
- package/dist/revo-grid/text-editor-7fbbcea7.js +0 -5
- /package/dist/revo-grid/{app-globals-60fd3b54.js.map → app-globals-6b929fd8.js.map} +0 -0
- /package/dist/revo-grid/{edit.utils-dd8b5cd7.js.map → edit.utils-b59306be.js.map} +0 -0
- /package/dist/revo-grid/{filter.button-d9b783c1.js.map → filter.button-84396156.js.map} +0 -0
- /package/dist/revo-grid/{header-cell-renderer-4508273a.js.map → header-cell-renderer-0f5bd4a9.js.map} +0 -0
- /package/dist/revo-grid/{key.utils-38b263fb.js.map → key.utils-3632161b.js.map} +0 -0
- /package/dist/revo-grid/{text-editor-7fbbcea7.js.map → text-editor-e47e56c3.js.map} +0 -0
- /package/dist/revo-grid/{throttle-61be638a.js.map → throttle-05489451.js.map} +0 -0
- /package/dist/revo-grid/{viewport.store-e66c1a9b.js.map → viewport.store-c18a25a6.js.map} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"trimmed.plugin.js","sourceRoot":"","sources":["../../../src/store/dataSource/trimmed.plugin.ts"],"names":[],"mappings":"AAMA;;;GAGG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,CAC3B,KAAuC,EACA,EAAE,CAAC,CAAC;IAC3C,GAAG,CAAC,CAAC,EAAE,MAAM;QACX,QAAQ,CAAC,EAAE,CAAC;YACV,KAAK,SAAS,CAAC,CAAC,CAAC;gBACf,yBAAyB;gBACzB,MAAM,KAAK,GAAG,KAAK,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;gBACtC,MAAM,OAAO,GAAG,kBAAkB,CAAC,MAAiB,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"trimmed.plugin.js","sourceRoot":"","sources":["../../../src/store/dataSource/trimmed.plugin.ts"],"names":[],"mappings":"AAMA;;;GAGG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,CAC3B,KAAuC,EACA,EAAE,CAAC,CAAC;IAC3C,GAAG,CAAC,CAAC,EAAE,MAAM;QACX,QAAQ,CAAC,EAAE,CAAC;YACV,KAAK,SAAS,CAAC,CAAC,CAAC;gBACf,yBAAyB;gBACzB,MAAM,KAAK,GAAG,KAAK,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;gBACtC,MAAM,OAAO,GAAG,kBAAkB,CAAC,MAAiB,CAAC,CAAC;gBAEtD,oDAAoD;gBACpD,MAAM,QAAQ,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;gBAEhD,6BAA6B;gBAC7B,KAAK,CAAC,GAAG,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;gBAC7B,MAAM;YACR,CAAC;QACH,CAAC;IACH,CAAC;CACF,CAAC,CAAC;AAEH,MAAM,UAAU,kBAAkB,CAAC,YAAqB;IACtD,MAAM,OAAO,GAAkB,EAAE,CAAC;IAElC,KAAK,IAAI,UAAU,IAAI,YAAY,EAAE,CAAC;QACpC,iCAAiC;QACjC,KAAK,IAAI,CAAC,IAAI,YAAY,CAAC,UAAU,CAAC,EAAE,CAAC;YACvC,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,IAAI,YAAY,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC;QACzD,CAAC;IACH,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC","sourcesContent":["import { Observable, PluginSubscribe } from '../../utils';\nimport { DSourceState, GDataType } from './data.store';\n\nexport type TrimmedEntity = { [physicalIndexInSource: number]: boolean };\nexport type Trimmed = Record<string, TrimmedEntity>;\n\n/**\n * Hide items from main collection\n * But keep them in store\n */\nexport const trimmedPlugin = <T extends GDataType>(\n store: Observable<DSourceState<T, any>>,\n): PluginSubscribe<DSourceState<T, any>> => ({\n set(k, newVal) {\n switch (k) {\n case 'trimmed': {\n // full sorted items list\n const proxy = store.get('proxyItems');\n const trimmed = gatherTrimmedItems(newVal as Trimmed);\n\n // filter our physical indexes which are not trimmed\n const newItems = proxy.filter(v => !trimmed[v]);\n\n // set trimmed items in store\n store.set('items', newItems);\n break;\n }\n }\n },\n});\n\nexport function gatherTrimmedItems(trimmedItems: Trimmed) {\n const trimmed: TrimmedEntity = {};\n\n for (let trimmedKey in trimmedItems) {\n // trimmed overweight not trimmed\n for (let t in trimmedItems[trimmedKey]) {\n trimmed[t] = trimmed[t] || trimmedItems[trimmedKey][t];\n }\n }\n return trimmed;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../src/types/interfaces.ts"],"names":[],"mappings":"AAgY4D,CAAC","sourcesContent":["import type { VNode } from '@stencil/core';\n\nimport type {\n DimensionCols,\n DimensionRows,\n DimensionColPin,\n DimensionType,\n MultiDimensionType,\n} from './dimension';\nimport type {\n Cell,\n EditorCtr,\n FocusedCells,\n OldNewRangeMapping,\n RangeArea,\n SelectionStoreState,\n} from './selection';\nimport type { Observable } from '../utils';\nimport type { JSXBase } from '@stencil/core/internal';\n\nexport type Nullable<T> = {\n [P in keyof T]: T[P] | null;\n};\n\n/**\n * Advanced column data schema model.\n * Used for transpassing data to cell renderer and editor.\n */\nexport interface ColumnDataSchemaModel {\n /**\n * Column prop used for mapping value to cell from data source model/row\n */\n prop: ColumnProp;\n /**\n * Row data object\n */\n model: DataType;\n /**\n * Column data object\n */\n column: ColumnRegular;\n /**\n * Index of the row in the viewport\n */\n rowIndex: number;\n /**\n * Index of the column in the viewport\n */\n colIndex: number;\n /**\n * Column type based on viewport\n */\n colType: DimensionCols;\n /**\n * Row type based on viewport\n */\n type: DimensionRows;\n /**\n * Row models based on viewport\n */\n data: DataType[];\n /**\n * Current cell data value\n * Mapped from model through column property like model['prop']\n */\n value?: any;\n}\n/**\n * Template property for each cell, extends the column data schema model.\n * Additionally, it provides access to the providers injected into the template.\n */\nexport interface CellTemplateProp extends ColumnDataSchemaModel {\n /**\n * Providers injected into the template\n */\n providers: Providers;\n}\n/**\n * The ReadOnlyFormat type is a boolean value or a function that takes ColumnDataSchemaModel\n * as a parameter and returns a boolean value.\n *\n * If it is a boolean value, it represents whether the cell in question is read-only.\n * If it is a function, it returns whether the cell in question is read-only based on the provided\n * ColumnDataSchemaModel.\n */\nexport type ReadOnlyFormat =\n | boolean\n | ((params: ColumnDataSchemaModel) => boolean);\nexport type RowDrag =\n | boolean\n | {\n (params: ColumnDataSchemaModel): boolean;\n };\n/**\n * `ColumnGrouping` type is used to define a grouping in a column.\n */\nexport type ColumnGrouping<T = any> = {\n /**\n * An array of objects that represent the children of the grouping.\n */\n children: (ColumnGrouping<T> | ColumnRegular)[];\n /**\n * A `DataFormat` object that represents the name of the grouping.\n */\n name: DataFormat<T>;\n};\n/**\n * Configuration for header inner template properties\n */\nexport interface ColumnProperties {\n /**\n * Header inner template\n * Function/component to render custom header content\n */\n columnTemplate?: ColumnTemplateFunc;\n /**\n * Header Cell properties\n * Custom function/component to render header properties\n */\n columnProperties?: ColPropertiesFunc;\n}\n/**\n * Type that represents a collection of column types.\n * The keys are the names of the column types and the values are the corresponding column type objects.\n */\nexport type ColumnTypes = {\n /**\n * The name of the column type.\n */\n [name: string]: ColumnType;\n};\n\n/**\n * Interface for custom cell renderer.\n */\nexport interface CellTemplate {\n // TODO: Add Promise support for template and all custom function so user will be able to use async render on the light speed\n (\n createElement: HyperFunc<VNode>,\n props: CellTemplateProp,\n additionalData?: any,\n ): any;\n}\n/**\n * Interface for regular column definition.\n * Regular column can be any column that is not a grouping column.\n */\nexport interface ColumnType extends ColumnProperties {\n /**\n * Represents whether the column or cell is read-only.\n * Can be a boolean or a function that returns a boolean.\n * The function receives column data as a parameter.\n */\n readonly?: ReadOnlyFormat;\n /**\n * Represents the default column size.\n */\n size?: number;\n /**\n * Represents the minimal column size.\n * This property cannot be less than cell padding\n * in order to keep performance on top and minimize DOM elements number.\n */\n minSize?: number;\n /**\n * Represents the maximum column size.\n */\n maxSize?: number;\n /**\n * Represents a custom editor defined in editors property.\n * Can be a string or an editor constructor function.\n */\n editor?: string | EditorCtr;\n /**\n * Represents cell properties for custom styling, classes, and events.\n */\n cellProperties?: PropertiesFunc;\n /**\n * Represents the cell template for custom rendering.\n */\n cellTemplate?: CellTemplate;\n /**\n * Represents the cell compare function for custom sorting.\n */\n cellCompare?: CellCompareFunc;\n\n /**\n * Represents the cell value parse function for custom parsing.\n * Currently only used for filtering.\n */\n cellParser?: (model: DataType, column: ColumnRegular) => any;\n}\nexport type Order = 'asc' | 'desc' | undefined;\n/**\n * Interface for regular column definition.\n * Regular column can be any column that is not a grouping column.\n *\n */\n/**\n * ColumnRegular interface represents regular column definition.\n * Regular column can be any column that is not a grouping column.\n */\nexport interface ColumnRegular extends ColumnType {\n /**\n * Column prop used for mapping value to cell from data source model/row, used for indexing.\n */\n prop: ColumnProp;\n /**\n * Column pin 'colPinStart'|'colPinEnd'.\n */\n pin?: DimensionColPin;\n /**\n * Column header text.\n */\n name?: any;\n /**\n * Column size would be changed based on space left.\n */\n autoSize?: boolean;\n /**\n * Filter. Require filter plugin to be installed and activated through grid config filter.\n */\n filter?: boolean | string | string[];\n /**\n * Is column can be sorted, check cellCompare function for custom sorting.\n */\n sortable?: boolean;\n /**\n * Sort order.\n */\n order?: Order;\n /**\n * Is cell in column or individual can be dragged.\n */\n rowDrag?: RowDrag;\n /**\n * Represents type defined in columnTypes property through grid config.\n */\n columnType?: string;\n /**\n * Function called before column applied to the store.\n */\n beforeSetup?(rgCol: ColumnRegular): void;\n /**\n * Additional properties can be added to the column definition.\n */\n [key: string]: any;\n}\n\nexport type ColumnData = (ColumnGrouping | ColumnRegular)[];\n/**\n * Column template property.\n * Contains extended properties for column.\n */\nexport interface ColumnTemplateProp extends ColumnRegular {\n /**\n * Providers injected into the template.\n */\n providers: Providers<DimensionCols | 'rowHeaders'>;\n /**\n * Index of the column, used for mapping value to cell from data source model/row.\n */\n index: number;\n}\n\nexport type ColumnPropProp = ColumnGrouping | ColumnTemplateProp;\n// Column prop used for mapping value to cell from data source model/row, used for indexing.\nexport type ColumnProp = string | number;\n\nexport type DataFormat<T = any> = T;\n\n/**\n * Additional properties applied to the cell.\n * Contains properties for custom cell rendering.\n */\nexport type CellProps = JSXBase.HTMLAttributes<HTMLDivElement> & {\n className?: JSXBase.HTMLAttributes<HTMLDivElement>['class'];\n // Additional properties for custom cell rendering\n [attr: string]: string | number | object | boolean | undefined;\n};\n\n\n/**\n * Providers for grid which are going to be injected into each cell template\n */\nexport type Providers<T = DimensionRows> = {\n /**\n * Dimension type (e.g. row or column)\n */\n type: T;\n /**\n * Flag indicating if grid is in readonly mode\n */\n readonly: boolean;\n /**\n * Data source store\n */\n data: Observable<DataSourceState<any, any>> | ColumnRegular[];\n /**\n * Viewport store\n */\n viewport: Observable<ViewportState>;\n /**\n * Dimension store\n */\n dimension: Observable<DimensionSettingsState>;\n /**\n * Selection store\n */\n selection: Observable<SelectionStoreState>;\n};\n/**\n * `HyperFunc` is a function that takes an HTML tag or component, and returns a\n * JSX element. This function is used to create JSX elements in a context where\n * JSX is not valid.\n */\nexport interface HyperFunc<T> {\n // (tag: any): T;\n (tag: any): T;\n}\n\n/**\n * `HyperFunc` is a function that takes an HTML tag or component, and returns a\n * JSX element. This function is used to create JSX elements in a context where\n * JSX is not valid.\n */\nexport type VNodeResponse = (VNode | string | number) | (VNode | string | number)[] | null | undefined;\n\n/**\n * `HyperFunc` is a function that takes an HTML tag or component, and returns a\n * JSX element. This function is used to create JSX elements in a context where\n * JSX is not valid.\n */\nexport interface HyperFunc<T> {\n (tag: any, data: any): T;\n}\n/**\n * `HyperFunc` is a function that takes an HTML tag or component, and returns a\n * JSX element. This function is used to create JSX elements in a context where\n * JSX is not valid.\n */\nexport interface HyperFunc<T> {\n (tag: any, text: string): T;\n}\n\n/**\n * `HyperFunc` is a function that takes an HTML tag or component, and returns a\n * JSX element. This function is used to create JSX elements in a context where\n * JSX is not valid.\n */\nexport interface HyperFunc<T> {\n (sel: any, children: Array<T | undefined | null>): T;\n}\n\n/**\n * `HyperFunc` is a function that takes an HTML tag or component, and returns a\n * JSX element. This function is used to create JSX elements in a context where\n * JSX is not valid.\n */\nexport interface HyperFunc<T> {\n (sel: any, data: any, text: string): T;\n}\n\n/**\n * `HyperFunc` is a function that takes an HTML tag or component, and returns a\n * JSX element. This function is used to create JSX elements in a context where\n * JSX is not valid.\n */\nexport interface HyperFunc<T> {\n (sel: any, data: any, children: Array<T | undefined | null>): T;\n}\n\n/**\n * `HyperFunc` is a function that takes an HTML tag or component, and returns a\n * JSX element. This function is used to create JSX elements in a context where\n * JSX is not valid.\n */\nexport interface HyperFunc<T> {\n (sel: any, data: any, children: T): T;\n}\n\n/**\n * `ExtraNodeFuncConfig` is a configuration object for `External nodes rendered in grid in HTMLRevogrExtraElement`.\n */\nexport interface ExtraNodeFuncConfig { refresh: () => void };\n\n/**\n * `FocusTemplateFunc` is a function that takes an HTML tag or component, and\n * returns a JSX element. This function is used to create JSX elements in a\n * context where JSX is not valid.\n */\nexport type FocusTemplateFunc = (\n createElement: HyperFunc<VNode>,\n detail: FocusRenderEvent,\n) => any;\n\n/**\n * `CellCompareFunc` is a function that takes the column property to compare,\n * the data of the first cell, and the data of the second cell. It returns a\n * number indicating the relative order of the two cells.\n */\nexport type CellCompareFunc = (\n // The column property to compare.\n prop: ColumnProp,\n // The data of the first cell.\n a: DataType,\n // The data of the second cell.\n b: DataType,\n) => number;\nexport type ColumnTemplateFunc = (\n createElement: HyperFunc<VNode>,\n props: ColumnTemplateProp,\n additionalData?: any,\n) => any;\nexport type PropertiesFunc = (\n props: CellTemplateProp,\n) => CellProps | void | undefined;\nexport type ColPropertiesFunc = (\n props: ColumnPropProp,\n) => CellProps | void | undefined;\nexport type DataType<D = any> = {\n [T in ColumnProp]: DataFormat<D>;\n};\n\nexport type DataLookup<T = any> = {\n [rowIndex: number]: DataType<T>;\n};\n/**\n * `RowDefinition` is a type that represents a row definition in the\n * viewport.\n */\nexport type RowDefinition = {\n /**\n * The type of the row.\n */\n type: DimensionRows;\n /**\n * The size of the row.\n */\n size: number;\n /**\n * The index of the row.\n */\n index: number;\n};\nexport interface RowHeaders extends ColumnRegular {}\n/**\n * `ViewPortResizeEvent` is an object that contains information about a resize\n * event in the viewport.\n */\nexport type ViewPortResizeEvent = {\n /* The dimension of the viewport being resized. */\n dimension: DimensionType;\n /* The new size of the viewport. */\n size: number;\n /* Indicates whether the resize event is for a row header. */\n rowHeader?: boolean;\n};\n\n/**\n * `ViewPortScrollEvent` is an object that contains information about a scroll\n * event in the viewport.\n */\nexport type ViewPortScrollEvent = {\n /**\n * The dimension of the viewport being scrolled.\n */\n dimension: DimensionType;\n /**\n * The coordinate of the scroll event.\n */\n coordinate: number;\n /**\n * The change in coordinate between scroll events.\n */\n delta?: number;\n /**\n * Indicates whether the scroll event occurred outside the viewport.\n */\n outside?: boolean;\n};\n\n/**\n * `InitialHeaderClick` represents the information needed to handle a click\n * event on the initial column header.\n */\nexport type InitialHeaderClick = {\n /**\n * The index of the column header that was clicked.\n */\n index: number;\n /**\n * The original mouse event that triggered the click.\n */\n originalEvent: MouseEvent;\n /**\n * The column that was clicked.\n */\n column: ColumnRegular;\n providers: Providers<DimensionCols | 'rowHeaders'>;\n};\n\n/**\n * `Range` is an object that represents a range of values.\n */\nexport type Range = {\n /**\n * The start of the range.\n */\n start: number;\n /**\n * The end of the range.\n */\n end: number;\n};\n\n/**\n * `ViewportStateItems` is an object that represents the items in a viewport\n * along with their corresponding range.\n */\nexport type ViewportStateItems = {\n /**\n * The items in the viewport.\n */\n items: VirtualPositionItem[];\n} & Range;\n\n/**\n * `ViewportState` is an object that represents the state of a viewport.\n */\nexport interface ViewportState extends ViewportStateItems {\n /**\n * The number of real items in the viewport.\n */\n realCount: number;\n /**\n * The virtual size of the viewport.\n */\n virtualSize: number;\n\n /**\n * The client size of the viewport.\n * Usually it's same as virtual size.\n * Until virtualization is not disabled.\n */\n clientSize: number;\n}\n\n/**\n * `ViewSettingSizeProp` is a record that maps column or row indexes to their\n * corresponding sizes.\n */\nexport type ViewSettingSizeProp = Record<string, number>;\n\n/**\n * `VirtualPositionItem` is an object that represents a virtual position item\n * in the viewport.\n */\nexport interface VirtualPositionItem extends PositionItem {\n /**\n * The size of the virtual position item.\n */\n size: number;\n}\nexport type DataSourceState<\n T extends DataType | ColumnRegular,\n ST extends DimensionRows | DimensionCols,\n> = {\n // items - index based array for mapping to source tree\n items: number[];\n // stores items even if they trimmed in items[] there will be a sorted list here\n proxyItems: number[];\n // original data source\n source: T[];\n // grouping\n groupingDepth: number;\n groups: Record<any, any>;\n // data source type\n type: ST;\n // trim data, to hide entities from visible data source\n trimmed: Record<any, any>;\n};\nexport interface PositionItem {\n itemIndex: number;\n start: number;\n end: number;\n}\n/**\n * Object containing information about calculated dimensions.\n * Used for both columns and rows.\n */\nexport interface DimensionCalc {\n /**\n * Array of indexes of visible items.\n */\n indexes: number[];\n\n /**\n * Count of visible items.\n */\n count: number;\n\n /**\n * Array of indexes of visible items.\n * Used for mapping items to their position in DOM.\n */\n positionIndexes: number[];\n\n /**\n * Mapping of position to item.\n * Used for mapping position in DOM to item.\n */\n positionIndexToItem: {\n /**\n * Position in DOM.\n */\n [position: number]: PositionItem;\n };\n\n /**\n * Mapping of index to item.\n * Used for mapping index in data source to item.\n */\n indexToItem: {\n /**\n * Index in data source.\n */\n [index: number]: PositionItem;\n };\n\n /**\n * Object containing information about trimmed data.\n * Used for hiding entities from visible data source.\n */\n trimmed: { [index: number]: number} | null;\n\n /**\n * Object containing size for each visible item.\n * provider stores only changed sizes, not all of them\n * same as indexes but for sizes and positions\n * virtual item index to size\n */\n sizes: ViewSettingSizeProp;\n}\n/**\n * Represents the settings state of a dimension.\n * It extends the calculation properties of a dimension.\n * It also includes the real size and origin item size of the dimension.\n */\nexport interface DimensionSettingsState extends DimensionCalc {\n /**\n * Represents the real size of the dimension.\n */\n realSize: number;\n\n /**\n * Represents the origin item size of the dimension.\n */\n originItemSize: number;\n}\n\n/**\n * Represents the mapping of dimension types to their corresponding observable stores.\n */\nexport type DimensionStores = {\n [T in MultiDimensionType]: Observable<DimensionSettingsState>;\n};\n\n/**\n * Represents the mapping of dimension types to their corresponding observable stores for the viewport.\n */\nexport type ViewportStores = {\n [T in MultiDimensionType]: Observable<ViewportState>;\n};\n\n/**\n * Represents the event object that is emitted when the drag operation starts.\n */\nexport interface DragStartEvent {\n /**\n * Represents the original mouse event that triggered the drag operation.\n */\n originalEvent: MouseEvent;\n\n /**\n * Represents the model of the column being dragged.\n */\n model: ColumnDataSchemaModel;\n}\n\n/**\n * Represents the event object that is emitted before cell rendering.\n * It includes information about the dimension type, column, row, and model.\n */\nexport interface BeforeCellRenderEvent<T = any> extends AllDimensionType {\n /**\n * Represents the column being rendered.\n */\n column: VirtualPositionItem;\n\n /**\n * Represents the row being rendered.\n */\n row: VirtualPositionItem;\n\n /**\n * Represents the model being rendered.\n */\n model: T;\n}\n\n/**\n * Represents the event object that is emitted before row rendering.\n * It includes information about the dimension type, data item, item, and node.\n */\nexport interface BeforeRowRenderEvent<T = any> extends AllDimensionType {\n /**\n * Represents the data item being rendered.\n */\n model: T;\n\n /**\n * Represents the item being rendered.\n */\n item: VirtualPositionItem;\n\n /**\n * Represents the node being rendered.\n */\n node: VNode;\n}\n\n/**\n * Represents the event object that is emitted after rendering.\n * It includes information about the dimension type.\n */\nexport type AfterRendererEvent = {\n /**\n * Represents the type of dimension being rendered.\n */\n type: DimensionType;\n};\n\n/**\n * Represents the mapping of dimension types to their corresponding dimension types.\n */\nexport interface AllDimensionType {\n /**\n * Represents the dimension type for rows.\n */\n rowType: DimensionRows;\n\n /**\n * Represents the dimension type for columns.\n */\n colType: DimensionCols;\n}\n\n/**\n * Represents the event object that is emitted when applying focus.\n * It includes information about the dimension type and focused cells.\n */\nexport interface ApplyFocusEvent extends AllDimensionType, FocusedCells {}\n\n/**\n * Represents the event object that is emitted before focus rendering.\n * It includes information about the dimension type and range area.\n */\nexport interface FocusRenderEvent extends AllDimensionType {\n /**\n * Represents the range area of the focus.\n */\n range: RangeArea;\n\n rowDimension: DimensionSettingsState;\n\n colDimension: DimensionSettingsState;\n\n /**\n * Changes for the next cell to focus. @example { y: -1 }\n */\n next?: Partial<Cell>;\n}\n\nexport interface FocusAfterRenderEvent extends AllDimensionType {\n model?: any;\n column?: ColumnRegular;\n /**\n * Index of the row in the viewport\n */\n rowIndex: number;\n /**\n * Index of the column in the viewport\n */\n colIndex: number;\n}\n/**\n * Represents the event object that is emitted when scrolling occurs.\n * The `type` property indicates the type of dimension (row or column) being scrolled.\n * The `coordinate` property represents the current scroll position in that dimension.\n */\nexport type ScrollCoordinateEvent = {\n /**\n * Represents the type of dimension being scrolled.\n * Possible values are 'rgRow' and 'rgCol'.\n */\n type: DimensionType;\n\n /**\n * Represents the current scroll position in the specified dimension.\n * The value is a number representing the coordinate in pixels.\n */\n coordinate: number;\n};\n\n/** Range paste. */\nexport type RangeClipboardPasteEvent = {\n data: DataLookup;\n models: Partial<DataLookup>;\n range: RangeArea | null;\n} & AllDimensionType;\n\n/** Range copy. */\nexport type RangeClipboardCopyEventProps<T = any> = {\n data: DataFormat<T>[][];\n range: RangeArea;\n mapping: OldNewRangeMapping;\n} & AllDimensionType;\n"]}
|
|
1
|
+
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../src/types/interfaces.ts"],"names":[],"mappings":"AAgY4D,CAAC","sourcesContent":["import type { VNode } from '@stencil/core';\n\nimport type {\n DimensionCols,\n DimensionRows,\n DimensionColPin,\n DimensionType,\n MultiDimensionType,\n} from './dimension';\nimport type {\n Cell,\n EditorCtr,\n FocusedCells,\n OldNewRangeMapping,\n RangeArea,\n SelectionStoreState,\n} from './selection';\nimport type { Observable } from '../utils';\nimport type { JSXBase } from '@stencil/core/internal';\n\nexport type Nullable<T> = {\n [P in keyof T]: T[P] | null;\n};\n\n/**\n * Advanced column data schema model.\n * Used for transpassing data to cell renderer and editor.\n */\nexport interface ColumnDataSchemaModel {\n /**\n * Column prop used for mapping value to cell from data source model/row\n */\n prop: ColumnProp;\n /**\n * Row data object\n */\n model: DataType;\n /**\n * Column data object\n */\n column: ColumnRegular;\n /**\n * Index of the row in the viewport\n */\n rowIndex: number;\n /**\n * Index of the column in the viewport\n */\n colIndex: number;\n /**\n * Column type based on viewport\n */\n colType: DimensionCols;\n /**\n * Row type based on viewport\n */\n type: DimensionRows;\n /**\n * Row models based on viewport\n */\n data: DataType[];\n /**\n * Current cell data value\n * Mapped from model through column property like model['prop']\n */\n value?: any;\n}\n/**\n * Template property for each cell, extends the column data schema model.\n * Additionally, it provides access to the providers injected into the template.\n */\nexport interface CellTemplateProp extends ColumnDataSchemaModel {\n /**\n * Providers injected into the template\n */\n providers: Providers;\n}\n/**\n * The ReadOnlyFormat type is a boolean value or a function that takes ColumnDataSchemaModel\n * as a parameter and returns a boolean value.\n *\n * If it is a boolean value, it represents whether the cell in question is read-only.\n * If it is a function, it returns whether the cell in question is read-only based on the provided\n * ColumnDataSchemaModel.\n */\nexport type ReadOnlyFormat =\n | boolean\n | ((params: ColumnDataSchemaModel) => boolean);\nexport type RowDrag =\n | boolean\n | {\n (params: ColumnDataSchemaModel): boolean;\n };\n/**\n * `ColumnGrouping` type is used to define a grouping in a column.\n */\nexport type ColumnGrouping<T = any> = {\n /**\n * An array of objects that represent the children of the grouping.\n */\n children: (ColumnGrouping<T> | ColumnRegular)[];\n /**\n * A `DataFormat` object that represents the name of the grouping.\n */\n name: DataFormat<T>;\n};\n/**\n * Configuration for header inner template properties\n */\nexport interface ColumnProperties {\n /**\n * Header inner template\n * Function/component to render custom header content\n */\n columnTemplate?: ColumnTemplateFunc;\n /**\n * Header Cell properties\n * Custom function/component to render header properties\n */\n columnProperties?: ColPropertiesFunc;\n}\n/**\n * Type that represents a collection of column types.\n * The keys are the names of the column types and the values are the corresponding column type objects.\n */\nexport type ColumnTypes = {\n /**\n * The name of the column type.\n */\n [name: string]: ColumnType;\n};\n\n/**\n * Interface for custom cell renderer.\n */\nexport interface CellTemplate {\n // TODO: Add Promise support for template and all custom function so user will be able to use async render on the light speed\n (\n createElement: HyperFunc<VNode>,\n props: CellTemplateProp,\n additionalData?: any,\n ): any;\n}\n/**\n * Interface for regular column definition.\n * Regular column can be any column that is not a grouping column.\n */\nexport interface ColumnType extends ColumnProperties {\n /**\n * Represents whether the column or cell is read-only.\n * Can be a boolean or a function that returns a boolean.\n * The function receives column data as a parameter.\n */\n readonly?: ReadOnlyFormat;\n /**\n * Represents the default column size.\n */\n size?: number;\n /**\n * Represents the minimal column size.\n * This property cannot be less than cell padding\n * in order to keep performance on top and minimize DOM elements number.\n */\n minSize?: number;\n /**\n * Represents the maximum column size.\n */\n maxSize?: number;\n /**\n * Represents a custom editor defined in editors property.\n * Can be a string or an editor constructor function.\n */\n editor?: string | EditorCtr;\n /**\n * Represents cell properties for custom styling, classes, and events.\n */\n cellProperties?: PropertiesFunc;\n /**\n * Represents the cell template for custom rendering.\n */\n cellTemplate?: CellTemplate;\n /**\n * Represents the cell compare function for custom sorting.\n */\n cellCompare?: CellCompareFunc;\n\n /**\n * Represents the cell value parse function for custom parsing.\n * Currently only used for filtering.\n */\n cellParser?: (model: DataType, column: ColumnRegular) => any;\n}\nexport type Order = 'asc' | 'desc' | undefined;\n/**\n * Interface for regular column definition.\n * Regular column can be any column that is not a grouping column.\n *\n */\n/**\n * ColumnRegular interface represents regular column definition.\n * Regular column can be any column that is not a grouping column.\n */\nexport interface ColumnRegular extends ColumnType {\n /**\n * Column prop used for mapping value to cell from data source model/row, used for indexing.\n */\n prop: ColumnProp;\n /**\n * Column pin 'colPinStart'|'colPinEnd'.\n */\n pin?: DimensionColPin;\n /**\n * Column header text.\n */\n name?: any;\n /**\n * Column size would be changed based on space left.\n */\n autoSize?: boolean;\n /**\n * Filter. Require filter plugin to be installed and activated through grid config filter.\n */\n filter?: boolean | string | string[];\n /**\n * Is column can be sorted, check cellCompare function for custom sorting.\n */\n sortable?: boolean;\n /**\n * Sort order.\n */\n order?: Order;\n /**\n * Is cell in column or individual can be dragged.\n */\n rowDrag?: RowDrag;\n /**\n * Represents type defined in columnTypes property through grid config.\n */\n columnType?: string;\n /**\n * Function called before column applied to the store.\n */\n beforeSetup?(rgCol: ColumnRegular): void;\n /**\n * Additional properties can be added to the column definition.\n */\n [key: string]: any;\n}\n\nexport type ColumnData = (ColumnGrouping | ColumnRegular)[];\n/**\n * Column template property.\n * Contains extended properties for column.\n */\nexport interface ColumnTemplateProp extends ColumnRegular {\n /**\n * Providers injected into the template.\n */\n providers: Providers<DimensionCols | 'rowHeaders'>;\n /**\n * Index of the column, used for mapping value to cell from data source model/row.\n */\n index: number;\n}\n\nexport type ColumnPropProp = ColumnGrouping | ColumnTemplateProp;\n// Column prop used for mapping value to cell from data source model/row, used for indexing.\nexport type ColumnProp = string | number;\n\nexport type DataFormat<T = any> = T;\n\n/**\n * Additional properties applied to the cell.\n * Contains properties for custom cell rendering.\n */\nexport type CellProps = JSXBase.HTMLAttributes<HTMLDivElement> & {\n className?: JSXBase.HTMLAttributes<HTMLDivElement>['class'];\n // Additional properties for custom cell rendering\n [attr: string]: string | number | object | boolean | undefined;\n};\n\n\n/**\n * Providers for grid which are going to be injected into each cell template\n */\nexport type Providers<T = DimensionRows> = {\n /**\n * Dimension type (e.g. row or column)\n */\n type: T;\n /**\n * Flag indicating if grid is in readonly mode\n */\n readonly: boolean;\n /**\n * Data source store\n */\n data: Observable<DataSourceState<any, any>> | ColumnRegular[];\n /**\n * Viewport store\n */\n viewport: Observable<ViewportState>;\n /**\n * Dimension store\n */\n dimension: Observable<DimensionSettingsState>;\n /**\n * Selection store\n */\n selection: Observable<SelectionStoreState>;\n};\n/**\n * `HyperFunc` is a function that takes an HTML tag or component, and returns a\n * JSX element. This function is used to create JSX elements in a context where\n * JSX is not valid.\n */\nexport interface HyperFunc<T> {\n // (tag: any): T;\n (tag: any): T;\n}\n\n/**\n * `HyperFunc` is a function that takes an HTML tag or component, and returns a\n * JSX element. This function is used to create JSX elements in a context where\n * JSX is not valid.\n */\nexport type VNodeResponse = (VNode | string | number) | (VNode | string | number)[] | null | undefined;\n\n/**\n * `HyperFunc` is a function that takes an HTML tag or component, and returns a\n * JSX element. This function is used to create JSX elements in a context where\n * JSX is not valid.\n */\nexport interface HyperFunc<T> {\n (tag: any, data: any): T;\n}\n/**\n * `HyperFunc` is a function that takes an HTML tag or component, and returns a\n * JSX element. This function is used to create JSX elements in a context where\n * JSX is not valid.\n */\nexport interface HyperFunc<T> {\n (tag: any, text: string): T;\n}\n\n/**\n * `HyperFunc` is a function that takes an HTML tag or component, and returns a\n * JSX element. This function is used to create JSX elements in a context where\n * JSX is not valid.\n */\nexport interface HyperFunc<T> {\n (sel: any, children: Array<T | undefined | null>): T;\n}\n\n/**\n * `HyperFunc` is a function that takes an HTML tag or component, and returns a\n * JSX element. This function is used to create JSX elements in a context where\n * JSX is not valid.\n */\nexport interface HyperFunc<T> {\n (sel: any, data: any, text: string): T;\n}\n\n/**\n * `HyperFunc` is a function that takes an HTML tag or component, and returns a\n * JSX element. This function is used to create JSX elements in a context where\n * JSX is not valid.\n */\nexport interface HyperFunc<T> {\n (sel: any, data: any, children: Array<T | undefined | null>): T;\n}\n\n/**\n * `HyperFunc` is a function that takes an HTML tag or component, and returns a\n * JSX element. This function is used to create JSX elements in a context where\n * JSX is not valid.\n */\nexport interface HyperFunc<T> {\n (sel: any, data: any, children: T): T;\n}\n\n/**\n * `ExtraNodeFuncConfig` is a configuration object for `External nodes rendered in grid in HTMLRevogrExtraElement`.\n */\nexport interface ExtraNodeFuncConfig { refresh: () => void };\n\n/**\n * `FocusTemplateFunc` is a function that takes an HTML tag or component, and\n * returns a JSX element. This function is used to create JSX elements in a\n * context where JSX is not valid.\n */\nexport type FocusTemplateFunc = (\n createElement: HyperFunc<VNode>,\n detail: FocusRenderEvent,\n) => any;\n\n/**\n * `CellCompareFunc` is a function that takes the column property to compare,\n * the data of the first cell, and the data of the second cell. It returns a\n * number indicating the relative order of the two cells.\n */\nexport type CellCompareFunc = (\n // The column property to compare.\n prop: ColumnProp,\n // The data of the first cell.\n a: DataType,\n // The data of the second cell.\n b: DataType,\n) => number;\nexport type ColumnTemplateFunc = (\n createElement: HyperFunc<VNode>,\n props: ColumnTemplateProp,\n additionalData?: any,\n) => any;\nexport type PropertiesFunc = (\n props: CellTemplateProp,\n) => CellProps | void | undefined;\nexport type ColPropertiesFunc = (\n props: ColumnPropProp,\n) => CellProps | void | undefined;\nexport type DataType<D = any> = {\n [T in ColumnProp]: DataFormat<D>;\n};\n\nexport type DataLookup<T = any> = {\n [rowIndex: number]: DataType<T>;\n};\n/**\n * `RowDefinition` is a type that represents a row definition in the\n * viewport.\n */\nexport type RowDefinition = {\n /**\n * The type of the row.\n */\n type: DimensionRows;\n /**\n * The size of the row.\n */\n size: number;\n /**\n * The index of the row.\n */\n index: number;\n};\nexport interface RowHeaders extends ColumnRegular {}\n/**\n * `ViewPortResizeEvent` is an object that contains information about a resize\n * event in the viewport.\n */\nexport type ViewPortResizeEvent = {\n /* The dimension of the viewport being resized. */\n dimension: DimensionType;\n /* The new size of the viewport. */\n size: number;\n /* Indicates whether the resize event is for a row header. */\n rowHeader?: boolean;\n};\n\n/**\n * `ViewPortScrollEvent` is an object that contains information about a scroll\n * event in the viewport.\n */\nexport type ViewPortScrollEvent = {\n /**\n * The dimension of the viewport being scrolled.\n */\n dimension: DimensionType;\n /**\n * The coordinate of the scroll event.\n */\n coordinate: number;\n /**\n * The change in coordinate between scroll events.\n */\n delta?: number;\n /**\n * Indicates whether the scroll event occurred outside the viewport.\n */\n outside?: boolean;\n};\n\n/**\n * `InitialHeaderClick` represents the information needed to handle a click\n * event on the initial column header.\n */\nexport type InitialHeaderClick = {\n /**\n * The index of the column header that was clicked.\n */\n index: number;\n /**\n * The original mouse event that triggered the click.\n */\n originalEvent: MouseEvent;\n /**\n * The column that was clicked.\n */\n column: ColumnRegular;\n providers: Providers<DimensionCols | 'rowHeaders'>;\n};\n\n/**\n * `Range` is an object that represents a range of values.\n */\nexport type Range = {\n /**\n * The start of the range.\n */\n start: number;\n /**\n * The end of the range.\n */\n end: number;\n};\n\n/**\n * `ViewportStateItems` is an object that represents the items in a viewport\n * along with their corresponding range.\n */\nexport type ViewportStateItems = {\n /**\n * The items in the viewport.\n */\n items: VirtualPositionItem[];\n} & Range;\n\n/**\n * `ViewportState` is an object that represents the state of a viewport.\n */\nexport interface ViewportState extends ViewportStateItems {\n /**\n * The number of real items in the viewport.\n */\n realCount: number;\n /**\n * The virtual size of the viewport.\n */\n virtualSize: number;\n\n /**\n * The client size of the viewport.\n * Usually it's same as virtual size.\n * Until virtualization is not disabled.\n */\n clientSize: number;\n}\n\n/**\n * `ViewSettingSizeProp` is a record that maps column or row indexes to their\n * corresponding sizes.\n */\nexport type ViewSettingSizeProp = Record<string, number>;\n\n/**\n * `VirtualPositionItem` is an object that represents a virtual position item\n * in the viewport.\n */\nexport interface VirtualPositionItem extends PositionItem {\n /**\n * The size of the virtual position item.\n */\n size: number;\n}\nexport type DataSourceState<\n T extends DataType | ColumnRegular,\n ST extends DimensionRows | DimensionCols,\n> = {\n /**\n * List of indices for visible items in the grid\n */\n items: number[];\n /**\n * List of indices for visible items in the grid, even if they are trimmed\n * Update this collection if you want to change items order\n */\n proxyItems: number[];\n /**\n * Actual data array\n */\n source: T[];\n /**\n * Grouping information\n */\n groupingDepth: number;\n groups: Record<any, any>;\n /**\n * Dimension type, can be rows or columns depending on context\n */\n type: ST;\n /**\n * Info for trimming or filtering the data, to hide entities from visible data source\n */\n trimmed: Record<any, any>;\n};\nexport interface PositionItem {\n itemIndex: number;\n start: number;\n end: number;\n}\n/**\n * Object containing information about calculated dimensions.\n * Used for both columns and rows.\n */\nexport interface DimensionCalc {\n /**\n * Array of indexes of visible items.\n */\n indexes: number[];\n\n /**\n * Count of visible items.\n */\n count: number;\n\n /**\n * Array of indexes of visible items.\n * Used for mapping items to their position in DOM.\n */\n positionIndexes: number[];\n\n /**\n * Mapping of position to item.\n * Used for mapping position in DOM to item.\n */\n positionIndexToItem: {\n /**\n * Position in DOM.\n */\n [position: number]: PositionItem;\n };\n\n /**\n * Mapping of index to item.\n * Used for mapping index in data source to item.\n */\n indexToItem: {\n /**\n * Index in data source.\n */\n [index: number]: PositionItem;\n };\n\n /**\n * Object containing information about trimmed data.\n * Used for hiding entities from visible data source.\n */\n trimmed: { [index: number]: number} | null;\n\n /**\n * Object containing size for each visible item.\n * provider stores only changed sizes, not all of them\n * same as indexes but for sizes and positions\n * virtual item index to size\n */\n sizes: ViewSettingSizeProp;\n}\n/**\n * Represents the settings state of a dimension.\n * It extends the calculation properties of a dimension.\n * It also includes the real size and origin item size of the dimension.\n */\nexport interface DimensionSettingsState extends DimensionCalc {\n /**\n * Represents the real size of the dimension.\n */\n realSize: number;\n\n /**\n * Represents the origin item size of the dimension.\n */\n originItemSize: number;\n}\n\n/**\n * Represents the mapping of dimension types to their corresponding observable stores.\n */\nexport type DimensionStores = {\n [T in MultiDimensionType]: Observable<DimensionSettingsState>;\n};\n\n/**\n * Represents the mapping of dimension types to their corresponding observable stores for the viewport.\n */\nexport type ViewportStores = {\n [T in MultiDimensionType]: Observable<ViewportState>;\n};\n\n/**\n * Represents the event object that is emitted when the drag operation starts.\n */\nexport interface DragStartEvent {\n /**\n * Represents the original mouse event that triggered the drag operation.\n */\n originalEvent: MouseEvent;\n\n /**\n * Represents the model of the column being dragged.\n */\n model: ColumnDataSchemaModel;\n}\n\n/**\n * Represents the event object that is emitted before cell rendering.\n * It includes information about the dimension type, column, row, and model.\n */\nexport interface BeforeCellRenderEvent<T = any> extends AllDimensionType {\n /**\n * Represents the column being rendered.\n */\n column: VirtualPositionItem;\n\n /**\n * Represents the row being rendered.\n */\n row: VirtualPositionItem;\n\n /**\n * Represents the model being rendered.\n */\n model: T;\n}\n\n/**\n * Represents the event object that is emitted before row rendering.\n * It includes information about the dimension type, data item, item, and node.\n */\nexport interface BeforeRowRenderEvent<T = any> extends AllDimensionType {\n /**\n * Represents the data item being rendered.\n */\n model: T;\n\n /**\n * Represents the item being rendered.\n */\n item: VirtualPositionItem;\n\n /**\n * Represents the node being rendered.\n */\n node: VNode;\n}\n\n/**\n * Represents the event object that is emitted after rendering.\n * It includes information about the dimension type.\n */\nexport type AfterRendererEvent = {\n /**\n * Represents the type of dimension being rendered.\n */\n type: DimensionType;\n};\n\n/**\n * Represents the mapping of dimension types to their corresponding dimension types.\n */\nexport interface AllDimensionType {\n /**\n * Represents the dimension type for rows.\n */\n rowType: DimensionRows;\n\n /**\n * Represents the dimension type for columns.\n */\n colType: DimensionCols;\n}\n\n/**\n * Represents the event object that is emitted when applying focus.\n * It includes information about the dimension type and focused cells.\n */\nexport interface ApplyFocusEvent extends AllDimensionType, FocusedCells {}\n\n/**\n * Represents the event object that is emitted before focus rendering.\n * It includes information about the dimension type and range area.\n */\nexport interface FocusRenderEvent extends AllDimensionType {\n /**\n * Represents the range area of the focus.\n */\n range: RangeArea;\n\n rowDimension: DimensionSettingsState;\n\n colDimension: DimensionSettingsState;\n\n /**\n * Changes for the next cell to focus. @example { y: -1 }\n */\n next?: Partial<Cell>;\n}\n\nexport interface FocusAfterRenderEvent extends AllDimensionType {\n model?: any;\n column?: ColumnRegular;\n /**\n * Index of the row in the viewport\n */\n rowIndex: number;\n /**\n * Index of the column in the viewport\n */\n colIndex: number;\n}\n/**\n * Represents the event object that is emitted when scrolling occurs.\n * The `type` property indicates the type of dimension (row or column) being scrolled.\n * The `coordinate` property represents the current scroll position in that dimension.\n */\nexport type ScrollCoordinateEvent = {\n /**\n * Represents the type of dimension being scrolled.\n * Possible values are 'rgRow' and 'rgCol'.\n */\n type: DimensionType;\n\n /**\n * Represents the current scroll position in the specified dimension.\n * The value is a number representing the coordinate in pixels.\n */\n coordinate: number;\n};\n\n/** Range paste. */\nexport type RangeClipboardPasteEvent = {\n data: DataLookup;\n models: Partial<DataLookup>;\n range: RangeArea | null;\n} & AllDimensionType;\n\n/** Range copy. */\nexport type RangeClipboardCopyEventProps<T = any> = {\n data: DataFormat<T>[][];\n range: RangeArea;\n mapping: OldNewRangeMapping;\n} & AllDimensionType;\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Built by Revolist OU ❤️
|
|
3
3
|
*/
|
|
4
|
-
import './index-
|
|
4
|
+
import './index-f6fae858.js';
|
|
5
5
|
|
|
6
6
|
const globalFn = () => { };
|
|
7
7
|
|
|
@@ -9,4 +9,4 @@ const globalScripts = globalFn;
|
|
|
9
9
|
|
|
10
10
|
export { globalScripts as g };
|
|
11
11
|
|
|
12
|
-
//# sourceMappingURL=app-globals-
|
|
12
|
+
//# sourceMappingURL=app-globals-6b929fd8.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"file":"app-globals-
|
|
1
|
+
{"file":"app-globals-6b929fd8.js","mappings":";;;;;;;AACY,MAAC,aAAa,GAAGA;;;;","names":["appGlobalScript"],"sources":["@stencil/core/internal/app-globals"],"sourcesContent":["import appGlobalScript from '/home/runner/work/revogrid/revogrid/src/global/global.ts';\nexport const globalScripts = appGlobalScript;\n"],"version":3}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Built by Revolist OU ❤️
|
|
3
3
|
*/
|
|
4
|
-
import { x as reduce, y as baseEach, r as getColumnType, h as isGrouping, f as getGroupingName, q as getCellDataParsed, G as GROUP_EXPANDED, k as getParsedGroup, P as PSEUDO_GROUP_ITEM_ID, l as isSameGroup, z as GROUP_DEPTH, A as PSEUDO_GROUP_ITEM_VALUE,
|
|
5
|
-
import { W as createStore, w as setStore, i as calculateDimensionData, X as identity, Y as isArray, b as getSourceItem, o as getScrollbarSize, Z as toInteger, _ as isIterateeCall, u as timeout, $ as baseProperty, a0 as isArrayLike, a1 as getTag, a2 as baseKeys, g as getPhysical, e as setItems, j as getItemByPosition } from './dimension.helpers-
|
|
6
|
-
import { f as calculateRowHeaderSize } from './viewport.store-
|
|
7
|
-
import { h } from './index-
|
|
8
|
-
import { b as FILTER_PROP, i as isFilterBtn } from './filter.button-
|
|
4
|
+
import { x as reduce, y as baseEach, r as getColumnType, h as isGrouping, f as getGroupingName, q as getCellDataParsed, w as getColumnByProp, p as getCellRaw, G as GROUP_EXPANDED, k as getParsedGroup, P as PSEUDO_GROUP_ITEM_ID, l as isSameGroup, z as GROUP_DEPTH, A as PSEUDO_GROUP_ITEM_VALUE, B as GROUPING_ROW_TYPE, b as getSource, C as PSEUDO_GROUP_COLUMN, e as gatherGrouping, j as isGroupingColumn, d as getExpanded, t as isColGrouping } from './column.service-c0d404a6.js';
|
|
5
|
+
import { W as createStore, w as setStore, i as calculateDimensionData, X as identity, Y as isArray, b as getSourceItem, o as getScrollbarSize, Z as toInteger, _ as isIterateeCall, u as timeout, $ as baseProperty, a0 as isArrayLike, a1 as getTag, a2 as baseKeys, g as getPhysical, e as setItems, j as getItemByPosition } from './dimension.helpers-5567e424.js';
|
|
6
|
+
import { f as calculateRowHeaderSize } from './viewport.store-c18a25a6.js';
|
|
7
|
+
import { h } from './index-f6fae858.js';
|
|
8
|
+
import { b as FILTER_PROP, i as isFilterBtn } from './filter.button-84396156.js';
|
|
9
9
|
import { i as isObjectLike, b as baseGetTag, d as debounce } from './debounce-b3166f78.js';
|
|
10
|
-
import { d as dispatch, O as ON_COLUMN_CLICK } from './header-cell-renderer-
|
|
10
|
+
import { d as dispatch, O as ON_COLUMN_CLICK } from './header-cell-renderer-0f5bd4a9.js';
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* Plugin which recalculates realSize on changes of sizes, originItemSize and count
|
|
@@ -1412,11 +1412,7 @@ class FilterPlugin extends BasePlugin {
|
|
|
1412
1412
|
if (defaultPrevented) {
|
|
1413
1413
|
return;
|
|
1414
1414
|
}
|
|
1415
|
-
|
|
1416
|
-
const isAddedEvent = await this.revogrid.addTrimmed(detail.itemsToFilter, FILTER_TRIMMED_TYPE);
|
|
1417
|
-
if (isAddedEvent.defaultPrevented) {
|
|
1418
|
-
return;
|
|
1419
|
-
}
|
|
1415
|
+
this.providers.data.setTrimmed({ [FILTER_TRIMMED_TYPE]: detail.itemsToFilter });
|
|
1420
1416
|
// applies the hasFilter to the columns to show filter icon
|
|
1421
1417
|
this.providers.column.updateColumns(columnsToUpdate);
|
|
1422
1418
|
this.emit('afterfilterapply', {
|
|
@@ -1542,125 +1538,6 @@ function allAndConditionsSatisfied(pendingResults) {
|
|
|
1542
1538
|
return !pendingResults.includes(true);
|
|
1543
1539
|
}
|
|
1544
1540
|
|
|
1545
|
-
// provide collapse data
|
|
1546
|
-
function doCollapse(pIndex, source) {
|
|
1547
|
-
const model = source[pIndex];
|
|
1548
|
-
const collapseValue = model[PSEUDO_GROUP_ITEM_VALUE];
|
|
1549
|
-
const trimmed = {};
|
|
1550
|
-
let i = pIndex + 1;
|
|
1551
|
-
const total = source.length;
|
|
1552
|
-
while (i < total) {
|
|
1553
|
-
const currentModel = source[i];
|
|
1554
|
-
if (isGrouping(currentModel)) {
|
|
1555
|
-
const currentValue = currentModel[PSEUDO_GROUP_ITEM_VALUE];
|
|
1556
|
-
if (!currentValue.length || !currentValue.startsWith(collapseValue + ',')) {
|
|
1557
|
-
break;
|
|
1558
|
-
}
|
|
1559
|
-
currentModel[GROUP_EXPANDED] = false;
|
|
1560
|
-
}
|
|
1561
|
-
trimmed[i++] = true;
|
|
1562
|
-
}
|
|
1563
|
-
model[GROUP_EXPANDED] = false;
|
|
1564
|
-
return { trimmed };
|
|
1565
|
-
}
|
|
1566
|
-
/**
|
|
1567
|
-
*
|
|
1568
|
-
* @param pIndex - physical index
|
|
1569
|
-
* @param vIndex - virtual index, need to update item collection
|
|
1570
|
-
* @param source - data source
|
|
1571
|
-
* @param rowItemsIndexes - rgRow indexes
|
|
1572
|
-
*/
|
|
1573
|
-
function doExpand(vIndex, source, rowItemsIndexes) {
|
|
1574
|
-
const physicalIndex = rowItemsIndexes[vIndex];
|
|
1575
|
-
const model = source[physicalIndex];
|
|
1576
|
-
const currentGroup = getParsedGroup(model[PSEUDO_GROUP_ITEM_ID]);
|
|
1577
|
-
const trimmed = {};
|
|
1578
|
-
// no group found
|
|
1579
|
-
if (!currentGroup) {
|
|
1580
|
-
return { trimmed };
|
|
1581
|
-
}
|
|
1582
|
-
const groupItems = [];
|
|
1583
|
-
model[GROUP_EXPANDED] = true;
|
|
1584
|
-
let i = physicalIndex + 1;
|
|
1585
|
-
const total = source.length;
|
|
1586
|
-
let groupLevelOnly = 0;
|
|
1587
|
-
// go through all rows
|
|
1588
|
-
while (i < total) {
|
|
1589
|
-
const currentModel = source[i];
|
|
1590
|
-
const isGroup = isGrouping(currentModel);
|
|
1591
|
-
// group found
|
|
1592
|
-
if (isGroup) {
|
|
1593
|
-
if (!isSameGroup(currentGroup, model, currentModel)) {
|
|
1594
|
-
break;
|
|
1595
|
-
}
|
|
1596
|
-
else if (!groupLevelOnly) {
|
|
1597
|
-
// if get group first it's group only level
|
|
1598
|
-
groupLevelOnly = currentModel[GROUP_DEPTH];
|
|
1599
|
-
}
|
|
1600
|
-
}
|
|
1601
|
-
// level 0 or same depth
|
|
1602
|
-
if (!groupLevelOnly || (isGroup && groupLevelOnly === currentModel[GROUP_DEPTH])) {
|
|
1603
|
-
trimmed[i] = false;
|
|
1604
|
-
groupItems.push(i);
|
|
1605
|
-
}
|
|
1606
|
-
i++;
|
|
1607
|
-
}
|
|
1608
|
-
const result = {
|
|
1609
|
-
trimmed,
|
|
1610
|
-
};
|
|
1611
|
-
if (groupItems.length) {
|
|
1612
|
-
const items = [...rowItemsIndexes];
|
|
1613
|
-
items.splice(vIndex + 1, 0, ...groupItems);
|
|
1614
|
-
result.items = items;
|
|
1615
|
-
}
|
|
1616
|
-
return result;
|
|
1617
|
-
}
|
|
1618
|
-
|
|
1619
|
-
const TRIMMED_GROUPING = 'grouping';
|
|
1620
|
-
/**
|
|
1621
|
-
* Prepare trimming updated indexes for grouping
|
|
1622
|
-
* @param initiallyTrimed
|
|
1623
|
-
* @param firstLevelMap
|
|
1624
|
-
* @param secondLevelMap
|
|
1625
|
-
*/
|
|
1626
|
-
function processDoubleConversionTrimmed(initiallyTrimed, firstLevelMap, secondLevelMap) {
|
|
1627
|
-
const trimemedOptionsToUpgrade = {};
|
|
1628
|
-
/**
|
|
1629
|
-
* go through all groups except grouping
|
|
1630
|
-
*/
|
|
1631
|
-
for (let type in initiallyTrimed) {
|
|
1632
|
-
if (type === TRIMMED_GROUPING) {
|
|
1633
|
-
continue;
|
|
1634
|
-
}
|
|
1635
|
-
const items = initiallyTrimed[type];
|
|
1636
|
-
const newItems = {};
|
|
1637
|
-
for (let initialIndex in items) {
|
|
1638
|
-
/**
|
|
1639
|
-
* if item exists we find it in collection
|
|
1640
|
-
* we support 2 level of conversions
|
|
1641
|
-
*/
|
|
1642
|
-
let newConversionIndex = firstLevelMap[initialIndex];
|
|
1643
|
-
if (secondLevelMap) {
|
|
1644
|
-
newConversionIndex = secondLevelMap[newConversionIndex];
|
|
1645
|
-
}
|
|
1646
|
-
/**
|
|
1647
|
-
* if item was trimmed previously
|
|
1648
|
-
* trimming makes sense to apply
|
|
1649
|
-
*/
|
|
1650
|
-
if (items[initialIndex]) {
|
|
1651
|
-
newItems[newConversionIndex] = true;
|
|
1652
|
-
/**
|
|
1653
|
-
* If changes present apply changes to new source
|
|
1654
|
-
*/
|
|
1655
|
-
if (newConversionIndex !== parseInt(initialIndex, 10)) {
|
|
1656
|
-
trimemedOptionsToUpgrade[type] = newItems;
|
|
1657
|
-
}
|
|
1658
|
-
}
|
|
1659
|
-
}
|
|
1660
|
-
}
|
|
1661
|
-
return trimemedOptionsToUpgrade;
|
|
1662
|
-
}
|
|
1663
|
-
|
|
1664
1541
|
/** `Object#toString` result references. */
|
|
1665
1542
|
var stringTag = '[object String]';
|
|
1666
1543
|
|
|
@@ -2075,6 +1952,125 @@ class SortingPlugin extends BasePlugin {
|
|
|
2075
1952
|
}
|
|
2076
1953
|
}
|
|
2077
1954
|
|
|
1955
|
+
// provide collapse data
|
|
1956
|
+
function doCollapse(pIndex, source) {
|
|
1957
|
+
const model = source[pIndex];
|
|
1958
|
+
const collapseValue = model[PSEUDO_GROUP_ITEM_VALUE];
|
|
1959
|
+
const trimmed = {};
|
|
1960
|
+
let i = pIndex + 1;
|
|
1961
|
+
const total = source.length;
|
|
1962
|
+
while (i < total) {
|
|
1963
|
+
const currentModel = source[i];
|
|
1964
|
+
if (isGrouping(currentModel)) {
|
|
1965
|
+
const currentValue = currentModel[PSEUDO_GROUP_ITEM_VALUE];
|
|
1966
|
+
if (!currentValue.length || !currentValue.startsWith(collapseValue + ',')) {
|
|
1967
|
+
break;
|
|
1968
|
+
}
|
|
1969
|
+
currentModel[GROUP_EXPANDED] = false;
|
|
1970
|
+
}
|
|
1971
|
+
trimmed[i++] = true;
|
|
1972
|
+
}
|
|
1973
|
+
model[GROUP_EXPANDED] = false;
|
|
1974
|
+
return { trimmed };
|
|
1975
|
+
}
|
|
1976
|
+
/**
|
|
1977
|
+
*
|
|
1978
|
+
* @param pIndex - physical index
|
|
1979
|
+
* @param vIndex - virtual index, need to update item collection
|
|
1980
|
+
* @param source - data source
|
|
1981
|
+
* @param rowItemsIndexes - rgRow indexes
|
|
1982
|
+
*/
|
|
1983
|
+
function doExpand(vIndex, source, rowItemsIndexes) {
|
|
1984
|
+
const physicalIndex = rowItemsIndexes[vIndex];
|
|
1985
|
+
const model = source[physicalIndex];
|
|
1986
|
+
const currentGroup = getParsedGroup(model[PSEUDO_GROUP_ITEM_ID]);
|
|
1987
|
+
const trimmed = {};
|
|
1988
|
+
// no group found
|
|
1989
|
+
if (!currentGroup) {
|
|
1990
|
+
return { trimmed };
|
|
1991
|
+
}
|
|
1992
|
+
const groupItems = [];
|
|
1993
|
+
model[GROUP_EXPANDED] = true;
|
|
1994
|
+
let i = physicalIndex + 1;
|
|
1995
|
+
const total = source.length;
|
|
1996
|
+
let groupLevelOnly = 0;
|
|
1997
|
+
// go through all rows
|
|
1998
|
+
while (i < total) {
|
|
1999
|
+
const currentModel = source[i];
|
|
2000
|
+
const isGroup = isGrouping(currentModel);
|
|
2001
|
+
// group found
|
|
2002
|
+
if (isGroup) {
|
|
2003
|
+
if (!isSameGroup(currentGroup, model, currentModel)) {
|
|
2004
|
+
break;
|
|
2005
|
+
}
|
|
2006
|
+
else if (!groupLevelOnly) {
|
|
2007
|
+
// if get group first it's group only level
|
|
2008
|
+
groupLevelOnly = currentModel[GROUP_DEPTH];
|
|
2009
|
+
}
|
|
2010
|
+
}
|
|
2011
|
+
// level 0 or same depth
|
|
2012
|
+
if (!groupLevelOnly || (isGroup && groupLevelOnly === currentModel[GROUP_DEPTH])) {
|
|
2013
|
+
trimmed[i] = false;
|
|
2014
|
+
groupItems.push(i);
|
|
2015
|
+
}
|
|
2016
|
+
i++;
|
|
2017
|
+
}
|
|
2018
|
+
const result = {
|
|
2019
|
+
trimmed,
|
|
2020
|
+
};
|
|
2021
|
+
if (groupItems.length) {
|
|
2022
|
+
const items = [...rowItemsIndexes];
|
|
2023
|
+
items.splice(vIndex + 1, 0, ...groupItems);
|
|
2024
|
+
result.items = items;
|
|
2025
|
+
}
|
|
2026
|
+
return result;
|
|
2027
|
+
}
|
|
2028
|
+
|
|
2029
|
+
const TRIMMED_GROUPING = 'grouping';
|
|
2030
|
+
/**
|
|
2031
|
+
* Prepare trimming updated indexes for grouping
|
|
2032
|
+
* @param initiallyTrimed
|
|
2033
|
+
* @param firstLevelMap
|
|
2034
|
+
* @param secondLevelMap
|
|
2035
|
+
*/
|
|
2036
|
+
function processDoubleConversionTrimmed(initiallyTrimed, firstLevelMap, secondLevelMap) {
|
|
2037
|
+
const trimemedOptionsToUpgrade = {};
|
|
2038
|
+
/**
|
|
2039
|
+
* go through all groups except grouping
|
|
2040
|
+
*/
|
|
2041
|
+
for (let type in initiallyTrimed) {
|
|
2042
|
+
if (type === TRIMMED_GROUPING) {
|
|
2043
|
+
continue;
|
|
2044
|
+
}
|
|
2045
|
+
const items = initiallyTrimed[type];
|
|
2046
|
+
const newItems = {};
|
|
2047
|
+
for (let initialIndex in items) {
|
|
2048
|
+
/**
|
|
2049
|
+
* if item exists we find it in collection
|
|
2050
|
+
* we support 2 level of conversions
|
|
2051
|
+
*/
|
|
2052
|
+
let newConversionIndex = firstLevelMap[initialIndex];
|
|
2053
|
+
if (secondLevelMap) {
|
|
2054
|
+
newConversionIndex = secondLevelMap[newConversionIndex];
|
|
2055
|
+
}
|
|
2056
|
+
/**
|
|
2057
|
+
* if item was trimmed previously
|
|
2058
|
+
* trimming makes sense to apply
|
|
2059
|
+
*/
|
|
2060
|
+
if (items[initialIndex]) {
|
|
2061
|
+
newItems[newConversionIndex] = true;
|
|
2062
|
+
/**
|
|
2063
|
+
* If changes present apply changes to new source
|
|
2064
|
+
*/
|
|
2065
|
+
if (newConversionIndex !== parseInt(initialIndex, 10)) {
|
|
2066
|
+
trimemedOptionsToUpgrade[type] = newItems;
|
|
2067
|
+
}
|
|
2068
|
+
}
|
|
2069
|
+
}
|
|
2070
|
+
}
|
|
2071
|
+
return trimemedOptionsToUpgrade;
|
|
2072
|
+
}
|
|
2073
|
+
|
|
2078
2074
|
class GroupingRowPlugin extends BasePlugin {
|
|
2079
2075
|
getStore(type = GROUPING_ROW_TYPE) {
|
|
2080
2076
|
return this.providers.data.stores[type].store;
|
|
@@ -2158,53 +2154,6 @@ class GroupingRowPlugin extends BasePlugin {
|
|
|
2158
2154
|
const sortingPlugin = this.providers.plugins.getByClass(SortingPlugin);
|
|
2159
2155
|
return !!(sortingPlugin === null || sortingPlugin === void 0 ? void 0 : sortingPlugin.sortingPromise);
|
|
2160
2156
|
}
|
|
2161
|
-
// subscribe to grid events to process them accordingly
|
|
2162
|
-
subscribe() {
|
|
2163
|
-
/** if grouping present and new data source arrived */
|
|
2164
|
-
this.addEventListener('beforesourceset', ({ detail }) => {
|
|
2165
|
-
var _a, _b, _c;
|
|
2166
|
-
if (!(((_b = (_a = this.options) === null || _a === void 0 ? void 0 : _a.props) === null || _b === void 0 ? void 0 : _b.length) && ((_c = detail === null || detail === void 0 ? void 0 : detail.source) === null || _c === void 0 ? void 0 : _c.length))) {
|
|
2167
|
-
return;
|
|
2168
|
-
}
|
|
2169
|
-
// if sorting is running don't apply grouping, wait for sorting, then it'll apply in @aftersortingapply
|
|
2170
|
-
if (this.isSortingRunning()) {
|
|
2171
|
-
return;
|
|
2172
|
-
}
|
|
2173
|
-
this.onDataSet(detail);
|
|
2174
|
-
});
|
|
2175
|
-
this.addEventListener('beforecolumnsset', ({ detail }) => {
|
|
2176
|
-
this.setColumns(detail);
|
|
2177
|
-
});
|
|
2178
|
-
/**
|
|
2179
|
-
* filter applied need to clear grouping and apply again
|
|
2180
|
-
* based on new results can be new grouping
|
|
2181
|
-
*/
|
|
2182
|
-
this.addEventListener('beforetrimmed', ({ detail: { trimmed, trimmedType } }) => this.beforeTrimmedApply(trimmed, trimmedType));
|
|
2183
|
-
/**
|
|
2184
|
-
* sorting applied need to clear grouping and apply again
|
|
2185
|
-
* based on new results whole grouping order will changed
|
|
2186
|
-
*/
|
|
2187
|
-
this.addEventListener('aftersortingapply', () => {
|
|
2188
|
-
var _a, _b;
|
|
2189
|
-
if (!((_b = (_a = this.options) === null || _a === void 0 ? void 0 : _a.props) === null || _b === void 0 ? void 0 : _b.length)) {
|
|
2190
|
-
return;
|
|
2191
|
-
}
|
|
2192
|
-
this.doSourceUpdate(Object.assign({}, this.options));
|
|
2193
|
-
});
|
|
2194
|
-
/**
|
|
2195
|
-
* Apply logic for focus inside of grouping
|
|
2196
|
-
* We can't focus on grouping rows, navigation only inside of groups for now
|
|
2197
|
-
*/
|
|
2198
|
-
this.addEventListener('beforecellfocus', e => this.onFocus(e));
|
|
2199
|
-
/**
|
|
2200
|
-
* Prevent rgRow drag outside the group
|
|
2201
|
-
*/
|
|
2202
|
-
this.addEventListener('roworderchanged', e => this.onDrag(e));
|
|
2203
|
-
/**
|
|
2204
|
-
* When grouping expand icon was clicked
|
|
2205
|
-
*/
|
|
2206
|
-
this.addEventListener('groupexpandclick', e => this.onExpand(e.detail));
|
|
2207
|
-
}
|
|
2208
2157
|
/**
|
|
2209
2158
|
* Starts global source update with group clearing and applying new one
|
|
2210
2159
|
* Initiated when need to reapply grouping
|
|
@@ -2221,11 +2170,11 @@ class GroupingRowPlugin extends BasePlugin {
|
|
|
2221
2170
|
* Group again
|
|
2222
2171
|
* @param oldNewIndexMap - provides us mapping with new indexes vs old indexes
|
|
2223
2172
|
*/
|
|
2224
|
-
const { sourceWithGroups, depth, trimmed, oldNewIndexMap,
|
|
2173
|
+
const { sourceWithGroups, depth, trimmed, oldNewIndexMap, } = gatherGrouping(source, ((_a = this.options) === null || _a === void 0 ? void 0 : _a.props) || [], expanded);
|
|
2225
2174
|
const customRenderer = options === null || options === void 0 ? void 0 : options.groupLabelTemplate;
|
|
2226
2175
|
// setup source
|
|
2227
2176
|
this.providers.data.setData(sourceWithGroups, GROUPING_ROW_TYPE, this.revogrid.disableVirtualY, { depth, customRenderer }, true);
|
|
2228
|
-
this.updateTrimmed(trimmed,
|
|
2177
|
+
this.updateTrimmed(trimmed, oldNewIndexes !== null && oldNewIndexes !== void 0 ? oldNewIndexes : {}, oldNewIndexMap);
|
|
2229
2178
|
}
|
|
2230
2179
|
/**
|
|
2231
2180
|
* Apply grouping on data set
|
|
@@ -2241,13 +2190,13 @@ class GroupingRowPlugin extends BasePlugin {
|
|
|
2241
2190
|
}
|
|
2242
2191
|
const source = data.source.filter(s => !isGrouping(s));
|
|
2243
2192
|
const options = Object.assign(Object.assign({}, (this.revogrid.grouping || {})), { prevExpanded: preservedExpanded });
|
|
2244
|
-
const { sourceWithGroups, depth, trimmed, oldNewIndexMap,
|
|
2193
|
+
const { sourceWithGroups, depth, trimmed, oldNewIndexMap, } = gatherGrouping(source, ((_b = this.options) === null || _b === void 0 ? void 0 : _b.props) || [], options);
|
|
2245
2194
|
data.source = sourceWithGroups;
|
|
2246
2195
|
this.providers.data.setGrouping({ depth });
|
|
2247
|
-
this.updateTrimmed(trimmed,
|
|
2196
|
+
this.updateTrimmed(trimmed, oldNewIndexMap);
|
|
2248
2197
|
}
|
|
2249
2198
|
/**
|
|
2250
|
-
*
|
|
2199
|
+
* External call to apply grouping. Called by revogrid when prop changed.
|
|
2251
2200
|
*/
|
|
2252
2201
|
setGrouping(options) {
|
|
2253
2202
|
var _a, _b;
|
|
@@ -2259,12 +2208,12 @@ class GroupingRowPlugin extends BasePlugin {
|
|
|
2259
2208
|
this.clearGrouping();
|
|
2260
2209
|
return;
|
|
2261
2210
|
}
|
|
2262
|
-
// props exist and source
|
|
2211
|
+
// props exist and source initd
|
|
2263
2212
|
const { source } = getSource(this.getStore().get('source'), this.getStore().get('proxyItems'));
|
|
2264
2213
|
if (source.length) {
|
|
2265
2214
|
this.doSourceUpdate(Object.assign({}, options));
|
|
2266
2215
|
}
|
|
2267
|
-
// props exist and columns
|
|
2216
|
+
// props exist and columns initd
|
|
2268
2217
|
for (let t of columnTypes) {
|
|
2269
2218
|
if (this.setColumnGrouping(this.providers.column.getColumns(t))) {
|
|
2270
2219
|
this.providers.column.refreshByType(t);
|
|
@@ -2272,7 +2221,50 @@ class GroupingRowPlugin extends BasePlugin {
|
|
|
2272
2221
|
}
|
|
2273
2222
|
}
|
|
2274
2223
|
// if has any grouping subscribe to events again
|
|
2275
|
-
|
|
2224
|
+
/** if grouping present and new data source arrived */
|
|
2225
|
+
this.addEventListener('beforesourceset', ({ detail }) => {
|
|
2226
|
+
var _a, _b, _c;
|
|
2227
|
+
if (!(((_b = (_a = this.options) === null || _a === void 0 ? void 0 : _a.props) === null || _b === void 0 ? void 0 : _b.length) && ((_c = detail === null || detail === void 0 ? void 0 : detail.source) === null || _c === void 0 ? void 0 : _c.length))) {
|
|
2228
|
+
return;
|
|
2229
|
+
}
|
|
2230
|
+
// if sorting is running don't apply grouping, wait for sorting, then it'll apply in @aftersortingapply
|
|
2231
|
+
if (this.isSortingRunning()) {
|
|
2232
|
+
return;
|
|
2233
|
+
}
|
|
2234
|
+
this.onDataSet(detail);
|
|
2235
|
+
});
|
|
2236
|
+
this.addEventListener('beforecolumnsset', ({ detail }) => {
|
|
2237
|
+
this.setColumns(detail);
|
|
2238
|
+
});
|
|
2239
|
+
/**
|
|
2240
|
+
* filter applied need to clear grouping and apply again
|
|
2241
|
+
* based on new results can be new grouping
|
|
2242
|
+
*/
|
|
2243
|
+
this.addEventListener('beforetrimmed', ({ detail: { trimmed, trimmedType } }) => this.beforeTrimmedApply(trimmed, trimmedType));
|
|
2244
|
+
/**
|
|
2245
|
+
* sorting applied need to clear grouping and apply again
|
|
2246
|
+
* based on new results whole grouping order will changed
|
|
2247
|
+
*/
|
|
2248
|
+
this.addEventListener('aftersortingapply', () => {
|
|
2249
|
+
var _a, _b;
|
|
2250
|
+
if (!((_b = (_a = this.options) === null || _a === void 0 ? void 0 : _a.props) === null || _b === void 0 ? void 0 : _b.length)) {
|
|
2251
|
+
return;
|
|
2252
|
+
}
|
|
2253
|
+
this.doSourceUpdate(Object.assign({}, this.options));
|
|
2254
|
+
});
|
|
2255
|
+
/**
|
|
2256
|
+
* Apply logic for focus inside of grouping
|
|
2257
|
+
* We can't focus on grouping rows, navigation only inside of groups for now
|
|
2258
|
+
*/
|
|
2259
|
+
this.addEventListener('beforecellfocus', e => this.onFocus(e));
|
|
2260
|
+
/**
|
|
2261
|
+
* Prevent rgRow drag outside the group
|
|
2262
|
+
*/
|
|
2263
|
+
this.addEventListener('roworderchanged', e => this.onDrag(e));
|
|
2264
|
+
/**
|
|
2265
|
+
* When grouping expand icon was clicked
|
|
2266
|
+
*/
|
|
2267
|
+
this.addEventListener('groupexpandclick', e => this.onExpand(e.detail));
|
|
2276
2268
|
}
|
|
2277
2269
|
// clear grouping
|
|
2278
2270
|
clearGrouping() {
|
|
@@ -2296,7 +2288,7 @@ class GroupingRowPlugin extends BasePlugin {
|
|
|
2296
2288
|
this.providers.data.setData(source, GROUPING_ROW_TYPE, this.revogrid.disableVirtualY, undefined, true);
|
|
2297
2289
|
this.updateTrimmed(undefined, undefined, oldNewIndexes);
|
|
2298
2290
|
}
|
|
2299
|
-
updateTrimmed(trimmedGroup = {},
|
|
2291
|
+
updateTrimmed(trimmedGroup = {}, firstLevelMap = {}, secondLevelMap) {
|
|
2300
2292
|
// map previously trimmed data
|
|
2301
2293
|
const trimemedOptionsToUpgrade = processDoubleConversionTrimmed(this.getStore().get('trimmed'), firstLevelMap, secondLevelMap);
|
|
2302
2294
|
for (let type in trimemedOptionsToUpgrade) {
|
|
@@ -2536,6 +2528,6 @@ function getLeftRelative(absoluteX, gridPos, offset) {
|
|
|
2536
2528
|
return absoluteX - gridPos - offset;
|
|
2537
2529
|
}
|
|
2538
2530
|
|
|
2539
|
-
export { AutoSizeColumnPlugin as A, BasePlugin as B, ColumnMovePlugin as C, DimensionStore as D, ExportFilePlugin as E, FILTER_TRIMMED_TYPE as F, GroupingRowPlugin as G, StretchColumn as S, isStretchPlugin as a, ExportCsv as b, columnTypes as c, FILTER_CONFIG_CHANGED_EVENT as d, FILTE_PANEL as e, FilterPlugin as f, filterCoreFunctionsIndexedByType as g, filterTypes as h, isRowType as i, filterNames as j,
|
|
2531
|
+
export { AutoSizeColumnPlugin as A, BasePlugin as B, ColumnMovePlugin as C, DimensionStore as D, ExportFilePlugin as E, FILTER_TRIMMED_TYPE as F, GroupingRowPlugin as G, StretchColumn as S, isStretchPlugin as a, ExportCsv as b, columnTypes as c, FILTER_CONFIG_CHANGED_EVENT as d, FILTE_PANEL as e, FilterPlugin as f, filterCoreFunctionsIndexedByType as g, filterTypes as h, isRowType as i, filterNames as j, doCollapse as k, doExpand as l, getLeftRelative as m, SortingPlugin as n, forEach as o, rowTypes as r };
|
|
2540
2532
|
|
|
2541
|
-
//# sourceMappingURL=column.drag.plugin-
|
|
2533
|
+
//# sourceMappingURL=column.drag.plugin-94964d01.js.map
|