@revolist/revogrid 4.0.36 → 4.0.39
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/revo-grid.cjs.entry.js +56 -35
- package/dist/cjs/revo-grid.cjs.entry.js.map +1 -1
- package/dist/collection/components/revoGrid/revo-grid.js +56 -35
- package/dist/collection/components/revoGrid/revo-grid.js.map +1 -1
- package/dist/esm/revo-grid.entry.js +56 -35
- package/dist/esm/revo-grid.entry.js.map +1 -1
- package/dist/revo-grid/revo-grid.entry.js +1 -1
- package/dist/revo-grid/revo-grid.entry.js.map +1 -1
- package/dist/types/components/revoGrid/revo-grid.d.ts +12 -2
- package/hydrate/index.js +56 -35
- package/hydrate/index.mjs +56 -35
- package/package.json +5 -1
- package/standalone/revo-grid.js +56 -35
- package/standalone/revo-grid.js.map +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"file":"revo-grid.entry.cjs.js","mappings":";;;;;;;;;;;;;;;;;;;;;MAEqB,YAAY;IAAjC;QACE,mBAAc,GAAG,EAAE,CAAC;KACrB;;;MCFoB,YAAY;IAAjC;QACE,mBAAc,GAAG,EAAE,CAAC;KACrB;;;MCFoB,aAAa;IAAlC;QACE,mBAAc,GAAG,EAAE,CAAC;KACrB;;;ACCM,MAAM,aAAa,GAAG,SAAS,CAAC;AAEhC,MAAM,aAAa,GAAY;IACpC,aAAa;IACb,UAAU;IACV,SAAS;IACT,cAAc;IACd,aAAa;CACd,CAAC;MACmB,YAAY;IAI/B,IAAI,KAAK;QACP,OAAO,IAAI,CAAC,YAAY,CAAC;KAC1B;IAED,IAAI,OAAO;QACT,OAAO,IAAI,CAAC,aAAa,IAAI,IAAI,CAAC,YAAY,CAAC,cAAc,CAAC;KAC/D;IAED,IAAI,OAAO,CAAC,IAAY;QACtB,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC;KAC3B;IAED,YAAY,GAAgB;QAdpB,kBAAa,GAAG,CAAC,CAAC;QAexB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SAAS,CAAC,OAAO,CAAC,CAAC,KAAK,EACvC,cAAc,EAAE,UAAU,CAAC,OAAO,CAAC,CAAC,KAAK,EACzC,GAAG,EAAE,EAAE,IAAI,IAAI,CAAC,gBAAgB,CAAC,eAAe,CAAC,EAAE,EAAE,WAAW,CAAC,EACjE,eAAe,EAAE,CAAC,IAAI,IAAI,CAAC,gBAAgB,CAAC,WAAW,CAAC,CAAC,CAAC,MAAM,CAAC,GACjE,EACD,IAAI,CAAC,aAAa,CACd,EACP;KACH;;;;;;;;;;;;;;;;;;;;;;;;;","names":["baseIteratee","require$$0","isArrayLike","require$$1","require$$2","createFind","baseMap","isArray","require$$3","BasePlugin","map","reduce","columnTypes","DataStore","getSourceItem","getSourceItemVirtualIndexByProp","find","each","setSourceByVirtualIndex","rowTypes","isRowType","getVisibleSourceItem","debounce","RESIZE_INTERVAL","DimensionStore","gatherTrimmedItems","getItemByIndex","ViewportStore","gt","FILTER_PROP","h","isFilterBtn","isString","asciiSize","rsAstralRange","rsComboMarksRange","reComboHalfMarksRange","rsComboSymbolsRange","rsComboRange","rsVarRange","rsZWJ","hasUnicode","unicodeSize","stringSize","require$$4","size","range","setStore","baseClamp","toInteger","toLength","baseFill","isGrouping","getGroupingName","timeout","fill","PSEUDO_GROUP_ITEM_VALUE","GROUP_EXPANDED","getParsedGroup","PSEUDO_GROUP_ITEM_ID","isSameGroup","GROUP_DEPTH","GROUPING_ROW_TYPE","getPhysical","setItems","PSEUDO_GROUP_COLUMN","GROUP_EXPAND_EVENT","gatherGrouping","isGroupingColumn","HEADER_SLOT","CONTENT_SLOT","FOOTER_SLOT","EMPTY_INDEX","getLastCell","getScrollbarSize","calculateRowHeaderSize","ON_COLUMN_CLICK","dispatch","getItemByPosition","getPropertyFromEvent","UUID","SelectionStoreConnector","AutoSize","DATA_SLOT","Host"],"sources":["src/themeManager/theme.compact.ts","src/themeManager/theme.default.ts","src/themeManager/theme.material.ts","src/themeManager/theme.service.ts","node_modules/lodash/_createFind.js","node_modules/lodash/find.js","node_modules/lodash/_baseMap.js","node_modules/lodash/map.js","src/plugins/groupingColumn/grouping.col.plugin.ts","src/services/column.data.provider.ts","src/services/data.provider.ts","src/services/dimension.provider.ts","src/services/viewport.provider.ts","src/plugins/column.auto-size.plugin.ts","src/plugins/filter/conditions/equal.ts","src/plugins/filter/conditions/number/greaterThan.ts","src/plugins/filter/conditions/number/greaterThanOrEqual.ts","src/plugins/filter/conditions/number/lessThan.ts","src/plugins/filter/conditions/number/lessThanOrEqual.ts","src/plugins/filter/conditions/set.ts","src/plugins/filter/conditions/string/beginswith.ts","src/plugins/filter/conditions/string/contains.ts","src/plugins/filter/filter.service.ts","src/plugins/filter/filter.plugin.tsx","node_modules/lodash/isString.js","node_modules/lodash/_asciiSize.js","node_modules/lodash/_hasUnicode.js","node_modules/lodash/_unicodeSize.js","node_modules/lodash/_stringSize.js","node_modules/lodash/size.js","src/plugins/sorting/sorting.plugin.ts","node_modules/lodash/_baseClamp.js","node_modules/lodash/toLength.js","node_modules/lodash/_baseFill.js","node_modules/lodash/fill.js","src/plugins/export/csv.ts","src/plugins/export/export.plugin.ts","src/plugins/groupingRow/grouping.row.expand.service.ts","src/plugins/groupingRow/grouping.trimmed.service.ts","src/plugins/groupingRow/grouping.row.plugin.ts","src/components/revoGrid/viewport.service.ts","src/components/revoGrid/viewport.scrolling.service.ts","src/components/order/order-renderer.tsx","src/plugins/column.stretch.plugin.ts","src/components/revoGrid/grid.helpers.ts","src/plugins/moveColumn/order-column.handler.tsx","src/plugins/moveColumn/column.drag.plugin.ts","src/utils/mobile.ts","src/components/revoGrid/revo-grid-style.scss?tag=revo-grid","src/components/revoGrid/revo-grid.tsx"],"sourcesContent":["import { ThemePackage } from '../types/theme';\n\nexport default class ThemeCompact implements ThemePackage {\n defaultRowSize = 32;\n}\n","import { ThemePackage } from '../types/theme';\n\nexport default class ThemeDefault implements ThemePackage {\n defaultRowSize = 27;\n}\n","import { ThemePackage } from '../types/theme';\n\nexport default class ThemeMaterial implements ThemePackage {\n defaultRowSize = 42;\n}\n","import { Theme, ThemeConfig, ThemePackage } from '../types/theme';\nimport ThemeCompact from './theme.compact';\nimport ThemeDefault from './theme.default';\nimport ThemeMaterial from './theme.material';\n\nexport const DEFAULT_THEME = 'default';\n\nexport const allowedThemes: Theme[] = [\n DEFAULT_THEME,\n 'material',\n 'compact',\n 'darkMaterial',\n 'darkCompact',\n];\nexport default class ThemeService {\n private currentTheme: ThemePackage;\n private customRowSize = 0;\n\n get theme() {\n return this.currentTheme;\n }\n\n get rowSize(): number {\n return this.customRowSize || this.currentTheme.defaultRowSize;\n }\n\n set rowSize(size: number) {\n this.customRowSize = size;\n }\n\n constructor(cfg: ThemeConfig) {\n this.customRowSize = cfg.rowSize;\n this.register('default');\n }\n\n register(theme: Theme) {\n const parsedTheme = ThemeService.getTheme(theme);\n switch (parsedTheme) {\n case 'material':\n case 'darkMaterial':\n this.currentTheme = new ThemeMaterial();\n break;\n case 'compact':\n case 'darkCompact':\n this.currentTheme = new ThemeCompact();\n break;\n default:\n this.currentTheme = new ThemeDefault();\n break;\n }\n }\n\n static getTheme(theme: string): Theme {\n if (allowedThemes.indexOf(theme as Theme) > -1) {\n return theme as Theme;\n }\n return DEFAULT_THEME;\n }\n}\n","var baseIteratee = require('./_baseIteratee'),\n isArrayLike = require('./isArrayLike'),\n keys = require('./keys');\n\n/**\n * Creates a `_.find` or `_.findLast` function.\n *\n * @private\n * @param {Function} findIndexFunc The function to find the collection index.\n * @returns {Function} Returns the new find function.\n */\nfunction createFind(findIndexFunc) {\n return function(collection, predicate, fromIndex) {\n var iterable = Object(collection);\n if (!isArrayLike(collection)) {\n var iteratee = baseIteratee(predicate, 3);\n collection = keys(collection);\n predicate = function(key) { return iteratee(iterable[key], key, iterable); };\n }\n var index = findIndexFunc(collection, predicate, fromIndex);\n return index > -1 ? iterable[iteratee ? collection[index] : index] : undefined;\n };\n}\n\nmodule.exports = createFind;\n","var createFind = require('./_createFind'),\n findIndex = require('./findIndex');\n\n/**\n * Iterates over elements of `collection`, returning the first element\n * `predicate` returns truthy for. The predicate is invoked with three\n * arguments: (value, index|key, collection).\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Collection\n * @param {Array|Object} collection The collection to inspect.\n * @param {Function} [predicate=_.identity] The function invoked per iteration.\n * @param {number} [fromIndex=0] The index to search from.\n * @returns {*} Returns the matched element, else `undefined`.\n * @example\n *\n * var users = [\n * { 'user': 'barney', 'age': 36, 'active': true },\n * { 'user': 'fred', 'age': 40, 'active': false },\n * { 'user': 'pebbles', 'age': 1, 'active': true }\n * ];\n *\n * _.find(users, function(o) { return o.age < 40; });\n * // => object for 'barney'\n *\n * // The `_.matches` iteratee shorthand.\n * _.find(users, { 'age': 1, 'active': true });\n * // => object for 'pebbles'\n *\n * // The `_.matchesProperty` iteratee shorthand.\n * _.find(users, ['active', false]);\n * // => object for 'fred'\n *\n * // The `_.property` iteratee shorthand.\n * _.find(users, 'active');\n * // => object for 'barney'\n */\nvar find = createFind(findIndex);\n\nmodule.exports = find;\n","var baseEach = require('./_baseEach'),\n isArrayLike = require('./isArrayLike');\n\n/**\n * The base implementation of `_.map` without support for iteratee shorthands.\n *\n * @private\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Array} Returns the new mapped array.\n */\nfunction baseMap(collection, iteratee) {\n var index = -1,\n result = isArrayLike(collection) ? Array(collection.length) : [];\n\n baseEach(collection, function(value, key, collection) {\n result[++index] = iteratee(value, key, collection);\n });\n return result;\n}\n\nmodule.exports = baseMap;\n","var arrayMap = require('./_arrayMap'),\n baseIteratee = require('./_baseIteratee'),\n baseMap = require('./_baseMap'),\n isArray = require('./isArray');\n\n/**\n * Creates an array of values by running each element in `collection` thru\n * `iteratee`. The iteratee is invoked with three arguments:\n * (value, index|key, collection).\n *\n * Many lodash methods are guarded to work as iteratees for methods like\n * `_.every`, `_.filter`, `_.map`, `_.mapValues`, `_.reject`, and `_.some`.\n *\n * The guarded methods are:\n * `ary`, `chunk`, `curry`, `curryRight`, `drop`, `dropRight`, `every`,\n * `fill`, `invert`, `parseInt`, `random`, `range`, `rangeRight`, `repeat`,\n * `sampleSize`, `slice`, `some`, `sortBy`, `split`, `take`, `takeRight`,\n * `template`, `trim`, `trimEnd`, `trimStart`, and `words`\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Collection\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} [iteratee=_.identity] The function invoked per iteration.\n * @returns {Array} Returns the new mapped array.\n * @example\n *\n * function square(n) {\n * return n * n;\n * }\n *\n * _.map([4, 8], square);\n * // => [16, 64]\n *\n * _.map({ 'a': 4, 'b': 8 }, square);\n * // => [16, 64] (iteration order is not guaranteed)\n *\n * var users = [\n * { 'user': 'barney' },\n * { 'user': 'fred' }\n * ];\n *\n * // The `_.property` iteratee shorthand.\n * _.map(users, 'user');\n * // => ['barney', 'fred']\n */\nfunction map(collection, iteratee) {\n var func = isArray(collection) ? arrayMap : baseMap;\n return func(collection, baseIteratee(iteratee, 3));\n}\n\nmodule.exports = map;\n","import isArray from 'lodash/isArray';\nimport map from 'lodash/map';\nimport { ColumnCollection } from '../../services/column.data.provider';\nimport { ColumnItems } from '../../services/dimension.provider';\nimport { Group as StoreGroup } from '@store';\nimport { BasePlugin } from '../base.plugin';\nimport { DimensionCols } from '@type';\nimport { ColumnGrouping, ColumnRegular } from '@type';\ninterface Group extends StoreGroup {\n level: number;\n}\nexport type ColumnGroupingCollection = Record<DimensionCols, Group[]>;\n\nexport default class GroupingColumnPlugin extends BasePlugin {\n static gatherGroup<T extends ColumnCollection>(res: T, colData: ColumnGrouping, collection: T, level = 0): T {\n // group template\n const group: Group = {\n ...colData,\n level,\n ids: [],\n };\n\n // check columns for update\n for (let k in collection.columns) {\n const key = k as keyof ColumnItems;\n const resultItem = res.columns[key];\n const collectionItem = collection.columns[key];\n\n // if column data\n if (isArray(resultItem) && isArray(collectionItem)) {\n // fill columns\n resultItem.push(...collectionItem);\n\n // fill grouping\n if (collectionItem.length) {\n res.columnGrouping[key].push({\n ...group,\n ids: map(collectionItem, 'prop'),\n });\n }\n }\n }\n // merge column groupings\n for (let k in collection.columnGrouping) {\n const key = k as DimensionCols;\n const collectionItem = collection.columnGrouping[key];\n res.columnGrouping[key].push(...collectionItem);\n }\n res.maxLevel = Math.max(res.maxLevel, collection.maxLevel);\n res.sort = { ...res.sort, ...collection.sort };\n return res;\n }\n}\n\n/**\n * Check if column is grouping column\n */\nexport function isColGrouping(colData: ColumnGrouping | ColumnRegular): colData is ColumnGrouping {\n return !!(colData as ColumnGrouping).children;\n}\n","import reduce from 'lodash/reduce';\nimport each from 'lodash/each';\nimport find from 'lodash/find';\n\nimport {\n columnTypes,\n DataStore,\n getSourceItem,\n getSourceItemVirtualIndexByProp,\n Groups,\n setSourceByVirtualIndex,\n} from '@store';\nimport GroupingColumnPlugin, {\n ColumnGroupingCollection,\n isColGrouping,\n} from '../plugins/groupingColumn/grouping.col.plugin';\nimport {\n ColumnData,\n ColumnDataSchema,\n ColumnProp,\n ColumnRegular,\n ColumnTypes,\n ViewSettingSizeProp,\n DimensionCols,\n DimensionColPin,\n} from '@type';\n\nexport type ColumnCollection = {\n columns: Record<DimensionCols, ColumnRegular[]>;\n columnByProp: Record<ColumnProp, ColumnRegular[]>;\n columnGrouping: ColumnGroupingCollection;\n maxLevel: number;\n sort: Record<ColumnProp, ColumnRegular>;\n};\n\nexport type ColumnDataSources = Record<\n DimensionCols,\n DataStore<ColumnRegular, DimensionCols>\n>;\ntype Sorting = Record<ColumnProp, ColumnRegular>;\ntype SortingOrder = Record<ColumnProp, 'asc' | 'desc'>;\n\nexport default class ColumnDataProvider {\n readonly dataSources: ColumnDataSources;\n sorting: Sorting | null = null;\n\n get order() {\n return reduce(\n this.sorting,\n (r: SortingOrder, c, prop) => {\n r[prop] = c.order;\n return r;\n },\n {},\n );\n }\n\n get stores() {\n return this.dataSources;\n }\n constructor() {\n this.dataSources = reduce(\n columnTypes,\n (sources: Partial<ColumnDataSources>, k: DimensionCols) => {\n sources[k] = new DataStore(k);\n return sources;\n },\n {},\n ) as ColumnDataSources;\n }\n\n column(c: number, pin?: DimensionColPin): ColumnRegular | undefined {\n return this.getColumn(c, pin || 'rgCol');\n }\n\n getColumn(\n virtualIndex: number,\n type: DimensionCols,\n ): ColumnRegular | undefined {\n return getSourceItem(this.dataSources[type].store, virtualIndex);\n }\n\n getRawColumns() {\n return reduce(\n this.dataSources,\n (\n result: Record<DimensionCols, ColumnRegular[]>,\n item,\n type: DimensionCols,\n ) => {\n result[type] = item.store.get('source');\n return result;\n },\n {\n rgCol: [],\n colPinStart: [],\n colPinEnd: [],\n },\n );\n }\n\n getColumns(type: DimensionCols | 'all' = 'all'): ColumnRegular[] {\n if (type !== 'all') {\n return this.dataSources[type].store.get('source');\n }\n return columnTypes.reduce((r: ColumnRegular[], t) => {\n r.push(...this.dataSources[t].store.get('source'));\n return r;\n }, []);\n }\n\n getColumnIndexByProp(prop: ColumnProp, type: DimensionCols): number {\n return getSourceItemVirtualIndexByProp(this.dataSources[type].store, prop);\n }\n\n getColumnByProp(\n prop: ColumnProp,\n type: DimensionCols,\n ): ColumnRegular | undefined {\n const items = this.dataSources[type].store.get('source');\n return find(items, { prop });\n }\n\n refreshByType(type: DimensionCols) {\n this.dataSources[type].refresh();\n }\n\n setColumns(data: ColumnCollection): ColumnCollection {\n columnTypes.forEach(k => {\n // set columns data\n this.dataSources[k].updateData(data.columns[k], {\n // max depth level\n depth: data.maxLevel,\n\n // groups\n groups: data.columnGrouping[k].reduce((res: Groups, g) => {\n if (!res[g.level]) {\n res[g.level] = [];\n }\n res[g.level].push(g);\n return res;\n }, {}),\n });\n });\n this.sorting = data.sort;\n return data;\n }\n\n updateColumns(cols: ColumnRegular[]) {\n // collect column by type and propert\n const columnByKey: Partial<\n Record<DimensionCols, Record<ColumnProp, ColumnRegular>>\n > = cols.reduce(\n (\n res: Partial<Record<DimensionCols, Record<ColumnProp, ColumnRegular>>>,\n c,\n ) => {\n const type = ColumnDataProvider.getColumnType(c);\n if (!res[type]) {\n res[type] = {};\n }\n res[type][c.prop] = c;\n return res;\n },\n {},\n );\n\n // find indexes in source\n const colByIndex: Partial<\n Record<DimensionCols, Record<number, ColumnRegular>>\n > = {};\n each(columnByKey, (colsToUpdate, type: DimensionCols) => {\n const items = this.dataSources[type].store.get('source');\n colByIndex[type] = items.reduce(\n (result: Record<number, ColumnRegular>, rgCol, index) => {\n const colToUpdateIfExists = colsToUpdate[rgCol.prop];\n if (colToUpdateIfExists) {\n result[index] = colToUpdateIfExists;\n }\n return result;\n },\n {},\n );\n });\n each(colByIndex, (colsToUpdate, type: DimensionCols) =>\n setSourceByVirtualIndex(this.dataSources[type].store, colsToUpdate),\n );\n }\n\n updateColumn(column: ColumnRegular, index: number) {\n const type = ColumnDataProvider.getColumnType(column);\n setSourceByVirtualIndex(this.dataSources[type].store, { [index]: column });\n }\n\n updateColumnSorting(\n column: ColumnRegular,\n index: number,\n sorting: 'asc' | 'desc',\n additive: boolean,\n ): ColumnRegular {\n if (!additive) {\n this.clearSorting();\n }\n column.order = sorting;\n this.sorting[column.prop] = column;\n this.updateColumn(column, index);\n return column;\n }\n\n clearSorting() {\n const types = reduce(\n this.sorting,\n (r: { [key in Partial<DimensionCols>]: boolean }, c: ColumnRegular) => {\n const k = ColumnDataProvider.getColumnType(c);\n r[k] = true;\n return r;\n },\n {} as { [key in Partial<DimensionCols>]: boolean },\n );\n each(types, (_, type: DimensionCols) => {\n const cols = this.dataSources[type].store.get('source');\n each(cols, (c: ColumnRegular) => (c.order = undefined));\n this.dataSources[type].setData({ source: [...cols] });\n });\n\n this.sorting = {};\n }\n\n static getSizes(cols: ColumnRegular[]): ViewSettingSizeProp {\n return reduce(\n cols,\n (res: ViewSettingSizeProp, c: ColumnRegular, i: number) => {\n if (c.size) {\n res[i] = c.size;\n }\n return res;\n },\n {},\n );\n }\n\n static getColumnByProp(\n columns: ColumnData,\n prop: ColumnProp,\n ): ColumnRegular | undefined {\n return find(columns, c => {\n if (isColGrouping(c)) {\n return ColumnDataProvider.getColumnByProp(c.children, prop);\n }\n return c.prop === prop;\n }) as ColumnRegular | undefined;\n }\n\n // columns processing\n static getColumns(\n columns: ColumnData,\n level = 0,\n types?: ColumnTypes,\n ): ColumnCollection {\n const collection: ColumnCollection = {\n // columns as they are in stores per type\n columns: {\n rgCol: [],\n colPinStart: [],\n colPinEnd: [],\n },\n // columns grouped by prop for quick access\n columnByProp: {},\n // column grouping\n columnGrouping: {\n rgCol: [],\n colPinStart: [],\n colPinEnd: [],\n },\n // max depth level for column grouping\n maxLevel: level,\n // sorting\n sort: {},\n };\n\n return reduce(\n columns,\n (res: ColumnCollection, colData: ColumnDataSchema) => {\n // Grouped column\n if (isColGrouping(colData)) {\n return GroupingColumnPlugin.gatherGroup(\n res,\n colData,\n ColumnDataProvider.getColumns(colData.children, level + 1, types),\n level,\n );\n }\n // Regular column\n const regularColumn = {\n ...(colData.columnType && types && types[colData.columnType]),\n ...colData,\n };\n // Regular column, no Pin\n if (!regularColumn.pin) {\n res.columns.rgCol.push(regularColumn);\n // Pin\n } else {\n res.columns[regularColumn.pin].push(regularColumn);\n }\n if (regularColumn.order) {\n res.sort[regularColumn.prop] = regularColumn;\n }\n // technically it's possible that some columns have same prop, but better to avoid it\n if (!res.columnByProp[regularColumn.prop]) {\n res.columnByProp[regularColumn.prop] = [];\n }\n res.columnByProp[regularColumn.prop].push(regularColumn);\n\n // trigger setup hook if present\n regularColumn.beforeSetup && regularColumn.beforeSetup(regularColumn);\n return res;\n },\n collection,\n );\n }\n\n static getColumnType(rgCol: ColumnRegular): DimensionCols {\n if (rgCol.pin) {\n return rgCol.pin;\n }\n return 'rgCol';\n }\n}\n","import reduce from 'lodash/reduce';\n\nimport {\n isRowType,\n rowTypes,\n DataStore,\n getSourceItem,\n getVisibleSourceItem,\n Groups,\n setSourceByVirtualIndex,\n Trimmed,\n} from '@store';\nimport DimensionProvider from './dimension.provider';\nimport { GroupLabelTemplateFunc } from '../plugins/groupingRow/grouping.row.types';\nimport {\n DataLookup,\n DimensionRows,\n DataType,\n BeforeSaveDataDetails,\n} from '@type';\n\nexport type RowDataSources = {\n [T in DimensionRows]: DataStore<DataType, DimensionRows>;\n};\n\n/**\n * Data source provider\n */\n\nexport class DataProvider {\n public readonly stores: RowDataSources;\n constructor(private dimensionProvider: DimensionProvider) {\n this.stores = reduce(\n rowTypes,\n (sources: Partial<RowDataSources>, k: DimensionRows) => {\n sources[k] = new DataStore(k);\n return sources;\n },\n {},\n ) as RowDataSources;\n }\n\n setData(\n data: DataType[],\n type: DimensionRows = 'rgRow',\n disableVirtualRows = false,\n grouping?: {\n depth: number;\n groups?: Groups;\n customRenderer?: GroupLabelTemplateFunc;\n },\n silent = false,\n ): DataType[] {\n // set rgRow data\n this.stores[type].updateData([...data], grouping, silent);\n\n // for pinned row no need virtual data\n const noVirtual = type !== 'rgRow' || disableVirtualRows;\n this.dimensionProvider.setData(data.length, type, noVirtual);\n return data;\n }\n\n getModel(virtualIndex: number, type: DimensionRows = 'rgRow') {\n const store = this.stores[type].store;\n return getSourceItem(store, virtualIndex);\n }\n\n setCellData(\n { type, rowIndex, prop, val }: BeforeSaveDataDetails,\n mutate = true,\n ) {\n const model = this.getModel(rowIndex, type);\n model[prop] = val;\n // apply data to source\n setSourceByVirtualIndex(\n this.stores[type].store,\n { [rowIndex]: model },\n mutate,\n );\n }\n\n setRangeData(data: DataLookup, type: DimensionRows) {\n const items: Record<number, DataType> = {};\n for (let rowIndex in data) {\n const oldModel = (items[rowIndex] = getSourceItem(\n this.stores[type].store,\n parseInt(rowIndex, 10),\n ));\n if (!oldModel) {\n continue;\n }\n for (let prop in data[rowIndex]) {\n oldModel[prop] = data[rowIndex][prop];\n }\n }\n // apply data to source\n setSourceByVirtualIndex(this.stores[type].store, items);\n }\n\n refresh(type: DimensionRows | 'all' = 'all') {\n if (isRowType(type)) {\n this.refreshItems(type);\n }\n rowTypes.forEach((t: DimensionRows) => this.refreshItems(t));\n }\n\n refreshItems(type: DimensionRows = 'rgRow') {\n const items = this.stores[type].store.get('items');\n this.stores[type].setData({ items: [...items] });\n }\n\n setGrouping({ depth }: { depth: number }, type: DimensionRows = 'rgRow') {\n this.stores[type].setData({ groupingDepth: depth });\n }\n\n setTrimmed(trimmed: Partial<Trimmed>, type: DimensionRows = 'rgRow') {\n const store = this.stores[type];\n store.addTrimmed(trimmed);\n this.dimensionProvider.setTrimmed(trimmed, type);\n if (type === 'rgRow') {\n this.dimensionProvider.setData(\n getVisibleSourceItem(store.store).length,\n type,\n );\n }\n }\n}\n","import reduce from 'lodash/reduce';\nimport debounce from 'lodash/debounce';\nimport ColumnDataProvider from '../services/column.data.provider';\nimport ViewportProvider from './viewport.provider';\nimport {\n columnTypes,\n rowTypes,\n DimensionStore,\n DimensionStoreCollection,\n gatherTrimmedItems,\n Trimmed,\n} from '@store';\nimport { RESIZE_INTERVAL } from '../utils/consts';\nimport {\n DimensionCols,\n DimensionType,\n MultiDimensionType,\n ColumnRegular,\n DimensionSettingsState,\n ViewPortScrollEvent,\n ViewSettingSizeProp,\n ViewportState,\n} from '@type';\nimport { getItemByIndex } from '../store/dimension/dimension.helpers';\nexport type ColumnItems = Record<DimensionCols, ColumnRegular[]>;\n\nexport type DimensionConfig = {\n realSizeChanged(k: MultiDimensionType): void;\n};\n/**\n * Dimension provider\n * Stores dimension information and custom sizes\n */\nexport default class DimensionProvider {\n readonly stores: DimensionStoreCollection;\n constructor(\n private viewports: ViewportProvider,\n config: DimensionConfig,\n ) {\n const sizeChanged = debounce(\n (k: MultiDimensionType) => config.realSizeChanged(k),\n RESIZE_INTERVAL,\n );\n this.stores = reduce(\n [...rowTypes, ...columnTypes],\n (sources: Partial<DimensionStoreCollection>, k: MultiDimensionType) => {\n sources[k] = new DimensionStore();\n sources[k].store.onChange('realSize', () => sizeChanged(k));\n return sources;\n },\n {},\n ) as DimensionStoreCollection;\n }\n\n /**\n * Clear old sizes from dimension and viewports\n * @param type - dimension type\n * @param count - count of items\n */\n clearSize(t: MultiDimensionType, count: number) {\n this.stores[t].drop();\n // after we done with drop trigger viewport recalculaction\n this.viewports.stores[t].setOriginalSizes(\n this.stores[t].store.get('originItemSize'),\n );\n this.setItemCount(count, t);\n }\n\n /**\n * Apply new custom sizes to dimension and view port\n * @param type - dimension type\n * @param sizes - new custom sizes\n * @param keepOld - keep old sizes merge new with old\n */\n setCustomSizes(\n type: MultiDimensionType,\n sizes: ViewSettingSizeProp,\n keepOld = false,\n ) {\n let newSizes = sizes;\n if (keepOld) {\n const oldSizes = this.stores[type].store.get('sizes');\n newSizes = {\n ...oldSizes,\n ...sizes,\n };\n }\n this.stores[type].setDimensionSize(newSizes);\n this.viewports.stores[type].setViewPortDimensionSizes(\n newSizes,\n !keepOld ? this.stores[type].store.get('originItemSize') : undefined,\n );\n }\n\n setItemCount(realCount: number, type: MultiDimensionType) {\n this.viewports.stores[type].setViewport({ realCount });\n this.stores[type].setStore({ count: realCount });\n }\n\n /**\n * Apply trimmed items\n * @param trimmed - trimmed items\n * @param type\n */\n setTrimmed(trimmed: Partial<Trimmed>, type: MultiDimensionType) {\n const allTrimmed = gatherTrimmedItems(trimmed);\n const dimStoreType = this.stores[type];\n dimStoreType.setStore({ trimmed: allTrimmed });\n this.viewports.stores[type].setViewPortDimensionSizes(\n dimStoreType.store.get('sizes'),\n );\n }\n\n /**\n * Sets dimension data and view port coordinate\n * @param items - data/column items\n * @param type - dimension type\n */\n setData(itemCount: number, type: MultiDimensionType, noVirtual = false) {\n this.setItemCount(itemCount, type);\n\n // Virtualization will get disabled\n if (noVirtual) {\n const dimension = this.stores[type].getCurrentState();\n this.viewports.stores[type].setViewport({\n virtualSize: dimension.realSize,\n });\n }\n this.updateViewport(type);\n }\n\n applyNewColumns(\n columns: Record<DimensionCols, ColumnRegular[]>,\n disableVirtualX: boolean,\n ) {\n for (let type of columnTypes) {\n // clear existing data\n this.stores[type].drop();\n\n const items = columns[type];\n\n // for pinned col no need virtual data\n const noVirtual = type !== 'rgCol' || disableVirtualX;\n\n // setItemCount\n this.stores[type].setStore({ count: items.length });\n\n // setCustomSizes\n const newSizes = ColumnDataProvider.getSizes(items);\n this.stores[type].setDimensionSize(newSizes);\n\n const vpUpdate: Partial<ViewportState> = {\n // this triggers drop on realCount change\n realCount: items.length,\n };\n\n // Virtualization will get disabled\n if (noVirtual) {\n vpUpdate.virtualSize = this.stores[type].getCurrentState().realSize;\n }\n\n this.viewports.stores[type].setViewport(vpUpdate);\n this.setViewPortCoordinate({\n coordinate: this.viewports.stores[type].lastCoordinate,\n type,\n });\n }\n }\n\n getFullSize(): { x: number; y: number } {\n let x = 0;\n let y = 0;\n for (let type of columnTypes) {\n x += this.stores[type]?.store.get('realSize') || 0;\n }\n for (let type of rowTypes) {\n y += this.stores[type]?.store.get('realSize') || 0;\n }\n return { y, x };\n }\n\n updateViewport(type: MultiDimensionType) {\n this.setViewPortCoordinate({\n coordinate: this.viewports.stores[type].lastCoordinate,\n type,\n });\n }\n\n setViewPortCoordinate({\n coordinate,\n type,\n }: {\n coordinate: number;\n type: MultiDimensionType;\n }) {\n const dimension = this.stores[type].getCurrentState();\n this.viewports.stores[type].setViewPortCoordinate(coordinate, dimension);\n }\n\n getViewPortPos(e: ViewPortScrollEvent): number {\n const dimension = this.stores[e.dimension].getCurrentState();\n const item = getItemByIndex(dimension, e.coordinate);\n\n return item.start;\n }\n\n setSettings(\n data: Partial<DimensionSettingsState>,\n dimensionType: DimensionType,\n ) {\n let stores: MultiDimensionType[] = [];\n switch (dimensionType) {\n case 'rgCol':\n stores = columnTypes;\n break;\n case 'rgRow':\n stores = rowTypes;\n break;\n }\n for (let s of stores) {\n this.stores[s].setStore(data);\n }\n }\n}\n","import reduce from 'lodash/reduce';\nimport { columnTypes, rowTypes, type ViewportStoreCollection, ViewportStore } from '@store';\nimport type { MultiDimensionType } from '@type';\nimport type { ViewportState } from '@type';\n\n\nexport default class ViewportProvider {\n readonly stores: ViewportStoreCollection;\n constructor() {\n this.stores = reduce(\n [...rowTypes, ...columnTypes],\n (sources: Partial<ViewportStoreCollection>, k: MultiDimensionType) => {\n sources[k] = new ViewportStore(k);\n return sources;\n },\n {},\n ) as ViewportStoreCollection;\n }\n\n setViewport(type: MultiDimensionType, data: Partial<ViewportState>) {\n this.stores[type].setViewport(data);\n }\n}\n","/**\n * Plugin module for revo-grid grid system\n * Add support for automatic column resize\n */\nimport each from 'lodash/each';\nimport reduce from 'lodash/reduce';\n\nimport { BasePlugin } from './base.plugin';\nimport ColumnDataProvider, {\n ColumnCollection,\n} from '../services/column.data.provider';\nimport { ColumnItems } from '../services/dimension.provider';\nimport { getSourceItem, columnTypes } from '@store';\nimport {\n DimensionCols,\n DimensionRows,\n ColumnRegular,\n DataType,\n InitialHeaderClick,\n ViewSettingSizeProp,\n BeforeSaveDataDetails,\n BeforeRangeSaveDataDetails,\n} from '@type';\nimport { PluginProviders } from '../';\n\ninterface Column extends ColumnRegular {\n index: number;\n}\n\ntype AutoSizeColumns = Record<DimensionCols, ColumnRecords>;\ntype ColumnRecords = Record<any, Column>;\ntype SourceSetEvent = { type: DimensionRows; source: DataType[] };\ntype EditEvent = BeforeSaveDataDetails | BeforeRangeSaveDataDetails;\ntype Resolve = (cols: Partial<AutoSizeColumns>) => void;\ntype Reject = () => void;\n\nexport type AutoSizeColumnConfig = {\n // ui behavior mode\n mode?: ColumnAutoSizeMode;\n /**\n * autoSize for all columns\n * if allColumnes true all columns treated as autoSize, worse for performance\n * false by default\n */\n allColumns?: boolean;\n /**\n * assumption per characted size\n * by default defined as 8, can be changed in this config\n */\n letterBlockSize?: number;\n /** make size calculation exact\n * by default it based on assumption each character takes some space defined in letterBlockSize */\n preciseSize?: boolean;\n};\n\nconst LETTER_BLOCK_SIZE = 7;\n\nenum ColumnAutoSizeMode {\n // increases column width on header click according the largest text value\n headerClickAutosize = 'headerClickAutoSize',\n // increases column width on data set and text edit, decreases performance\n autoSizeOnTextOverlap = 'autoSizeOnTextOverlap',\n // increases and decreases column width based on all items sizes, worst for performance\n autoSizeAll = 'autoSizeAll',\n}\n\nexport default class AutoSizeColumnPlugin extends BasePlugin {\n private autoSizeColumns: Partial<AutoSizeColumns> | null = null;\n private readonly letterBlockSize: number;\n\n /** for config option when @preciseSize enabled */\n private readonly precsizeCalculationArea: HTMLElement;\n\n /** for edge case when no columns defined before data */\n private dataResolve: Resolve | null = null;\n private dataReject: Reject | null = null;\n\n constructor(\n revogrid: HTMLRevoGridElement,\n protected providers: PluginProviders,\n private config?: AutoSizeColumnConfig,\n ) {\n super(revogrid, providers);\n this.letterBlockSize = config?.letterBlockSize || LETTER_BLOCK_SIZE;\n\n // create test container to check text width\n if (config?.preciseSize) {\n this.precsizeCalculationArea = this.initiatePresizeElement();\n revogrid.appendChild(this.precsizeCalculationArea);\n }\n\n const aftersourceset = ({\n detail: { source },\n }: CustomEvent<SourceSetEvent>) => {\n this.setSource(source);\n };\n const afteredit = ({ detail }: CustomEvent<EditEvent>) => {\n this.afteredit(detail);\n };\n const afterEditAll = ({ detail }: CustomEvent<EditEvent>) => {\n this.afterEditAll(detail);\n };\n const beforecolumnsset = ({\n detail: { columns },\n }: CustomEvent<ColumnCollection>) => {\n this.columnSet(columns);\n };\n const headerDblClick = ({ detail }: CustomEvent<InitialHeaderClick>) => {\n const type = ColumnDataProvider.getColumnType(detail.column);\n const size = this.getColumnSize(detail.index, type);\n if (size) {\n this.providers.dimension.setCustomSizes(\n type,\n {\n [detail.index]: size,\n },\n true,\n );\n }\n };\n this.addEventListener('beforecolumnsset', beforecolumnsset);\n switch (config?.mode) {\n case ColumnAutoSizeMode.autoSizeOnTextOverlap:\n this.addEventListener('aftersourceset', aftersourceset);\n this.addEventListener('afteredit', afteredit);\n break;\n case ColumnAutoSizeMode.autoSizeAll:\n this.addEventListener('aftersourceset', aftersourceset);\n this.addEventListener('afteredit', afterEditAll);\n break;\n default:\n this.addEventListener('headerdblclick', headerDblClick);\n break;\n }\n }\n\n private async setSource(source: DataType[]): Promise<void> {\n let autoSize = this.autoSizeColumns;\n if (this.dataReject) {\n this.dataReject();\n this.clearPromise();\n }\n\n /** If data set first and no column provided await until get one */\n if (!autoSize) {\n const request = new Promise((resolve: Resolve, reject: Reject) => {\n this.dataResolve = resolve;\n this.dataReject = reject;\n });\n try {\n autoSize = await request;\n } catch (e) {\n return;\n }\n }\n\n // calculate sizes\n each(autoSize, (_v, type: DimensionCols) => {\n const sizes: ViewSettingSizeProp = {};\n each(autoSize[type], rgCol => {\n // calculate size\n rgCol.size = sizes[rgCol.index] = source.reduce(\n (prev, rgRow) => Math.max(prev, this.getLength(rgRow[rgCol.prop])),\n this.getLength(rgCol.name || ''),\n );\n });\n this.providers.dimension.setCustomSizes(type, sizes, true);\n });\n }\n\n private getLength(len?: any): number {\n const padding = 15;\n if (!len) {\n return 0;\n }\n try {\n const str = len.toString();\n\n /**if exact calculation required proxy with html element, slow operation */\n if (this.config?.preciseSize) {\n this.precsizeCalculationArea.innerText = str;\n return this.precsizeCalculationArea.scrollWidth + padding * 2;\n }\n return str.length * this.letterBlockSize + padding * 2;\n } catch (e) {\n return 0;\n }\n }\n\n private afteredit(e: EditEvent) {\n let data: Record<string, DataType>;\n if (this.isRangeEdit(e)) {\n data = e.data;\n } else {\n data = { 0: { [e.prop]: e.val } };\n }\n each(this.autoSizeColumns, (columns, type: DimensionCols) => {\n const sizes: ViewSettingSizeProp = {};\n\n each(columns, rgCol => {\n // calculate size\n const size = reduce(\n data,\n (prev: number | undefined, rgRow) => {\n if (typeof rgRow[rgCol.prop] === 'undefined') {\n return prev;\n }\n return Math.max(prev || 0, this.getLength(rgRow[rgCol.prop]));\n },\n undefined,\n );\n\n if (size && rgCol.size < size) {\n rgCol.size = sizes[rgCol.index] = size;\n }\n });\n\n this.providers.dimension.setCustomSizes(type, sizes, true);\n });\n }\n\n private afterEditAll(e: EditEvent) {\n const props: Record<any, true> = {};\n if (this.isRangeEdit(e)) {\n each(e.data, r => each(r, (_v, p) => (props[p] = true)));\n } else {\n props[e.prop] = true;\n }\n each(this.autoSizeColumns, (columns, type: DimensionCols) => {\n const sizes: ViewSettingSizeProp = {};\n\n each(columns, rgCol => {\n if (props[rgCol.prop]) {\n const size = this.getColumnSize(rgCol.index, type);\n if (size) {\n sizes[rgCol.index] = size;\n }\n }\n });\n this.providers.dimension.setCustomSizes(type, sizes, true);\n });\n }\n\n private getColumnSize(index: number, type: DimensionCols): number {\n const rgCol = this.autoSizeColumns[type][index];\n if (!rgCol) {\n return 0;\n }\n return reduce(\n this.providers.data.stores,\n (r, s) => {\n const perStore = reduce(\n s.store.get('items'),\n (prev, _row, i) => {\n const item = getSourceItem(s.store, i);\n return Math.max(prev || 0, this.getLength(item[rgCol.prop]));\n },\n 0,\n );\n return Math.max(r, perStore);\n },\n rgCol.size || 0,\n );\n }\n\n private columnSet(columns: ColumnItems) {\n for (let t of columnTypes) {\n const type = t as DimensionCols;\n const cols = columns[type];\n\n for (let i in cols) {\n if (cols[i].autoSize || this.config?.allColumns) {\n if (!this.autoSizeColumns) {\n this.autoSizeColumns = {};\n }\n if (!this.autoSizeColumns[type]) {\n this.autoSizeColumns[type] = {};\n }\n this.autoSizeColumns[type][i] = {\n ...cols[i],\n index: parseInt(i, 10),\n };\n }\n }\n }\n\n if (this.dataResolve) {\n this.dataResolve(this.autoSizeColumns);\n this.clearPromise();\n }\n }\n\n private clearPromise() {\n this.dataResolve = null;\n this.dataReject = null;\n }\n\n private isRangeEdit(e: EditEvent): e is BeforeRangeSaveDataDetails {\n return !!(e as BeforeRangeSaveDataDetails).data;\n }\n\n private initiatePresizeElement(): HTMLElement {\n const styleForFontTest: Partial<CSSStyleDeclaration> = {\n position: 'absolute',\n fontSize: '14px',\n height: '0',\n width: '0',\n whiteSpace: 'nowrap',\n top: '0',\n overflowX: 'scroll',\n };\n\n const el = document.createElement('div');\n for (let s in styleForFontTest) {\n el.style[s] = styleForFontTest[s];\n }\n el.classList.add('revo-test-container');\n return el;\n }\n\n destroy() {\n super.destroy();\n this.precsizeCalculationArea?.remove();\n }\n}\n","import { LogicFunction, LogicFunctionExtraParam, LogicFunctionParam, ExtraField } from '../filter.types';\n\nconst eq: LogicFunction = (value: LogicFunctionParam, extra?: LogicFunctionExtraParam) => {\n if (typeof value === 'undefined' || (value === null && !extra)) {\n return true;\n }\n if (typeof value !== 'string') {\n value = JSON.stringify(value);\n }\n\n const filterVal = extra.toString().toLocaleLowerCase();\n if (filterVal.length === 0) {\n return true;\n }\n \n return value.toLocaleLowerCase() === filterVal;\n};\n\nexport const notEq: LogicFunction = (value: LogicFunctionParam, extra?: LogicFunctionExtraParam) => !eq(value, extra);\nnotEq.extra = 'input' as ExtraField;\neq.extra = 'input' as ExtraField;\nexport default eq;\n","import { LogicFunction, LogicFunctionExtraParam, LogicFunctionParam } from '../../filter.types';\n\nconst gtThan: LogicFunction = function (value: LogicFunctionParam, extra?: LogicFunctionExtraParam) {\n let conditionValue: number;\n\n if (typeof value === 'number') {\n conditionValue = parseFloat(extra?.toString());\n return value > conditionValue;\n }\n return false;\n};\n\ngtThan.extra = 'input';\nexport default gtThan;\n","import { LogicFunction, LogicFunctionExtraParam, LogicFunctionParam } from '../../filter.types';\nimport eq from '../equal';\nimport gt from './greaterThan';\n\nconst gtThanEq: LogicFunction = function (value: LogicFunctionParam, extra?: LogicFunctionExtraParam) {\n return eq(value, extra) || gt(value, extra);\n};\n\ngtThanEq.extra = 'input';\nexport default gtThanEq;\n","import { LogicFunction, LogicFunctionExtraParam, LogicFunctionParam } from '../../filter.types';\n\nconst lt: LogicFunction = function (value: LogicFunctionParam, extra?: LogicFunctionExtraParam) {\n let conditionValue: number;\n if (typeof value === 'number') {\n conditionValue = parseFloat(extra?.toString());\n return value < conditionValue;\n } else {\n return false;\n }\n};\n\nlt.extra = 'input';\nexport default lt;\n","import { LogicFunction, LogicFunctionExtraParam, LogicFunctionParam } from '../../filter.types';\nimport eq from '../equal';\nimport lt from './lessThan';\n\nconst lsEq: LogicFunction = function (value: LogicFunctionParam, extra?: LogicFunctionExtraParam) {\n return eq(value, extra) || lt(value, extra);\n};\n\nlsEq.extra = 'input';\nexport default lsEq;\n","import { LogicFunction, LogicFunctionParam } from '../filter.types';\n\nconst set: LogicFunction = (value: LogicFunctionParam) => !(value === '' || value === null || value === void 0);\nexport const notSet: LogicFunction = (value: LogicFunctionParam) => !set(value);\nexport default set;\n","import { LogicFunction, LogicFunctionExtraParam, LogicFunctionParam } from '../../filter.types';\n\nconst beginsWith: LogicFunction = (value: LogicFunctionParam, extra?: LogicFunctionExtraParam) => {\n if (!value) {\n return false;\n }\n if (!extra) {\n return true;\n }\n if (typeof value !== 'string') {\n value = JSON.stringify(value);\n }\n if (typeof extra !== 'string') {\n extra = JSON.stringify(extra);\n }\n return value.toLocaleLowerCase().indexOf(extra.toLocaleLowerCase()) === 0;\n};\n\nbeginsWith.extra = 'input';\nexport default beginsWith;\n","import { LogicFunction, LogicFunctionExtraParam, LogicFunctionParam } from '../../filter.types';\n\nconst contains: LogicFunction = (value: LogicFunctionParam, extra?: LogicFunctionExtraParam) => {\n if (!extra) {\n return true;\n }\n if (!value) {\n return false;\n }\n if (extra) {\n if (typeof value !== 'string') {\n value = JSON.stringify(value);\n }\n return value.toLocaleLowerCase().indexOf(extra.toString().toLowerCase()) > -1;\n }\n return true;\n};\n\nexport const notContains: LogicFunction = (value: LogicFunctionParam, extra?: LogicFunctionExtraParam) => {\n return !contains(value, extra);\n};\nnotContains.extra = 'input';\ncontains.extra = 'input';\nexport default contains;\n","import eq, { notEq } from './conditions/equal';\nimport gtThan from './conditions/number/greaterThan';\nimport gtThanEq from './conditions/number/greaterThanOrEqual';\nimport lt from './conditions/number/lessThan';\nimport lsEq from './conditions/number/lessThanOrEqual';\nimport set, { notSet } from './conditions/set';\nimport beginsWith from './conditions/string/beginswith';\nimport contains, { notContains } from './conditions/string/contains';\nimport { LogicFunction } from './filter.types';\n\nexport const filterNames = {\n none: 'None',\n empty: 'Not set',\n notEmpty: 'Set',\n\n eq: 'Equal',\n notEq: 'Not equal',\n begins: 'Begins with',\n contains: 'Contains',\n notContains: 'Does not contain',\n\n eqN: '=',\n neqN: '!=',\n gt: '>',\n gte: '>=',\n lt: '<',\n lte: '<=',\n};\n\nexport type FilterType = keyof typeof filterNames;\n\nexport const filterEntities: Record<FilterType, LogicFunction> = {\n none: () => true,\n empty: notSet,\n notEmpty: set,\n eq: eq,\n notEq: notEq,\n begins: beginsWith,\n contains: contains,\n notContains: notContains,\n\n eqN: eq,\n neqN: notEq,\n gt: gtThan,\n gte: gtThanEq,\n lt: lt,\n lte: lsEq,\n};\n\nexport const filterTypes: Record<string, FilterType[]> = {\n string: ['notEmpty', 'empty', 'eq', 'notEq', 'begins', 'contains', 'notContains'],\n number: ['notEmpty', 'empty', 'eqN', 'neqN', 'gt', 'gte', 'lt', 'lte'],\n};\n","import { h } from '@stencil/core';\nimport reduce from 'lodash/reduce';\n\nimport { BasePlugin } from '../base.plugin';\nimport { FILTER_PROP, isFilterBtn } from './filter.button';\nimport { MultiFilterItem } from './filter.pop';\nimport {\n filterEntities,\n filterNames,\n FilterType,\n filterTypes,\n} from './filter.service';\nimport { LogicFunction } from './filter.types';\nimport { ColumnProp, ColumnRegular, DataType } from '@type';\nimport { PluginProviders } from '@type';\n\ntype CustomFilter = {\n columnFilterType: string; // property defined in column filter: string/number/abstract/enum...etc\n name: string;\n func: LogicFunction;\n};\n\nexport type FilterCaptions = {\n title: string;\n save: string;\n reset: string;\n cancel: string;\n};\n\nexport type FilterLocalization = {\n captions: FilterCaptions;\n filterNames: Record<FilterType, string>;\n};\n\n/**\n * @typedef ColumnFilterConfig\n * @type {object}\n * @property {FilterCollection|undefined} collection - preserved filter data\n * @property {string[]|undefined} include - filters to be included, if defined everything else out of scope will be ignored\n * @property {Record<string, CustomFilter>|undefined} customFilters - hash map of {FilterType:CustomFilter}.\n * @property {FilterLocalization|undefined} localization - translation for filter popup captions.\n * @property {MultiFilterItem|undefined} multiFilterItems - data for multi filtering.\n * @property {boolean|undefined} disableDynamicFiltering - disables dynamic filtering.\n * A way to define your own filter types per column\n */\n/**\n * @internal\n */\nexport type ColumnFilterConfig = {\n collection?: FilterCollection;\n include?: string[];\n customFilters?: Record<string, CustomFilter>;\n filterProp?: string;\n localization?: FilterLocalization;\n multiFilterItems?: MultiFilterItem;\n disableDynamicFiltering?: boolean;\n};\ntype HeaderEvent = CustomEvent<ColumnRegular>;\ntype FilterCollectionItem = {\n filter: LogicFunction;\n type: FilterType;\n value?: any;\n};\n\nexport type FilterCollection = Record<ColumnProp, FilterCollectionItem>;\n\nexport const FILTER_TRIMMED_TYPE = 'filter';\nexport const FILTER_CONFIG_CHANGED_EVENT = 'filterconfigchanged';\n\nexport class FilterPlugin extends BasePlugin {\n private pop: HTMLRevogrFilterPanelElement;\n private filterCollection: FilterCollection = {};\n private multiFilterItems: MultiFilterItem = {};\n private possibleFilters: Record<string, string[]> = { ...filterTypes };\n private possibleFilterNames: Record<string, string> = { ...filterNames };\n private possibleFilterEntities: Record<string, LogicFunction> = {\n ...filterEntities,\n };\n private filterProp = FILTER_PROP;\n\n constructor(\n protected revogrid: HTMLRevoGridElement,\n providers: PluginProviders,\n uiid: string,\n config?: ColumnFilterConfig,\n ) {\n super(revogrid, providers);\n if (config) {\n this.initConfig(config);\n }\n\n const headerclick = (e: HeaderEvent) => this.headerclick(e);\n\n const aftersourceset = async () => {\n const filterCollectionProps = Object.keys(this.filterCollection);\n if (filterCollectionProps.length > 0) {\n // handle old way of filtering by reworking FilterCollection to new MultiFilterItem\n filterCollectionProps.forEach((prop, index) => {\n if (!this.multiFilterItems[prop]) {\n this.multiFilterItems[prop] = [\n {\n id: index,\n type: this.filterCollection[prop].type,\n value: this.filterCollection[prop].value,\n relation: 'and',\n },\n ];\n }\n });\n }\n await this.runFiltering();\n };\n this.addEventListener('headerclick', headerclick);\n this.addEventListener(\n FILTER_CONFIG_CHANGED_EVENT,\n ({ detail }: CustomEvent<ColumnFilterConfig | boolean>) => {\n if (!detail) {\n this.clearFiltering();\n return;\n }\n if (typeof detail === 'object') {\n this.initConfig(detail);\n }\n aftersourceset();\n },\n );\n this.addEventListener('aftersourceset', aftersourceset);\n this.addEventListener('filter', ({ detail }: CustomEvent) =>\n this.onFilterChange(detail),\n );\n\n const existingNodes = this.revogrid.registerVNode.filter((n) => n.$tag$ !== 'revogr-filter-panel');\n this.revogrid.registerVNode = [\n ...existingNodes,\n <revogr-filter-panel\n uuid={`filter-${uiid}`}\n filterItems={this.multiFilterItems}\n filterNames={this.possibleFilterNames}\n filterEntities={this.possibleFilterEntities}\n filterCaptions={config?.localization?.captions}\n onFilterChange={e => this.onFilterChange(e.detail)}\n disableDynamicFiltering={config?.disableDynamicFiltering}\n ref={e => (this.pop = e)}\n />,\n ];\n }\n\n private initConfig(config: ColumnFilterConfig) {\n if (config.multiFilterItems) {\n this.multiFilterItems = { ...config.multiFilterItems };\n }\n if (config.customFilters) {\n for (let cType in config.customFilters) {\n const cFilter = config.customFilters[cType];\n if (!this.possibleFilters[cFilter.columnFilterType]) {\n this.possibleFilters[cFilter.columnFilterType] = [];\n }\n this.possibleFilters[cFilter.columnFilterType].push(cType);\n this.possibleFilterEntities[cType] = cFilter.func;\n this.possibleFilterNames[cType] = cFilter.name;\n }\n }\n\n if (config.filterProp) {\n this.filterProp = config.filterProp;\n }\n\n /**\n * which filters has to be included/excluded\n * convinient way to exclude system filters\n */\n if (config.include) {\n const filters: Record<string, string[]> = {};\n\n for (let t in this.possibleFilters) {\n // validate filters, if appropriate function present\n const newTypes = this.possibleFilters[t].filter(\n f => config.include.indexOf(f) > -1,\n );\n if (newTypes.length) {\n filters[t] = newTypes;\n }\n }\n // if any valid filters provided show them\n if (Object.keys(filters).length > 0) {\n this.possibleFilters = filters;\n }\n }\n if (config.collection) {\n this.filterCollection = reduce(\n config.collection,\n (result: FilterCollection, item, prop) => {\n if (this.possibleFilterEntities[item.type]) {\n result[prop] = item;\n } else {\n console.warn(`${item.type} type is not found.`);\n }\n return result;\n },\n {},\n );\n }\n\n if (config.localization) {\n if (config.localization.filterNames) {\n Object.entries(config.localization.filterNames).forEach(([k, v]) => {\n if (this.possibleFilterNames[k] != void 0) {\n this.possibleFilterNames[k] = v;\n }\n });\n }\n }\n }\n\n private async headerclick(e: HeaderEvent) {\n const el = e.detail.originalEvent?.target as HTMLElement;\n if (!isFilterBtn(el)) {\n return;\n }\n e.preventDefault();\n\n // close if same\n const changes = await this.pop.getChanges();\n if (changes && changes?.prop === e.detail.prop) {\n this.pop.show();\n return;\n }\n\n // filter button clicked, open filter dialog\n const gridPos = this.revogrid.getBoundingClientRect();\n const buttonPos = el.getBoundingClientRect();\n const prop = e.detail.prop;\n this.pop.filterTypes = this.getColumnFilter(e.detail.filter);\n this.pop.show({\n ...this.filterCollection[prop],\n x: buttonPos.x - gridPos.x,\n y: buttonPos.y - gridPos.y + buttonPos.height,\n prop,\n });\n }\n\n private getColumnFilter(\n type?: boolean | string | string[],\n ): Record<string, string[]> {\n let filterType = 'string';\n if (!type) {\n return { [filterType]: this.possibleFilters[filterType] };\n }\n\n // if custom column filter\n if (this.isValidType(type)) {\n filterType = type;\n\n // if multiple filters applied\n } else if (typeof type === 'object' && type.length) {\n return type.reduce((r: Record<string, string[]>, multiType) => {\n if (this.isValidType(multiType)) {\n r[multiType] = this.possibleFilters[multiType];\n }\n return r;\n }, {});\n }\n return { [filterType]: this.possibleFilters[filterType] };\n }\n\n private isValidType(type: any): type is string {\n return !!(typeof type === 'string' && this.possibleFilters[type]);\n }\n\n // called on internal component change\n private async onFilterChange(filterItems: MultiFilterItem) {\n this.multiFilterItems = filterItems;\n this.runFiltering();\n }\n\n /**\n * Triggers grid filtering\n */\n async doFiltering(\n collection: FilterCollection,\n items: DataType[],\n columns: ColumnRegular[],\n filterItems: MultiFilterItem,\n ) {\n const columnsToUpdate: ColumnRegular[] = [];\n\n columns.forEach(rgCol => {\n const column = { ...rgCol };\n const hasFilter = filterItems[column.prop];\n if (column[this.filterProp] && !hasFilter) {\n delete column[this.filterProp];\n columnsToUpdate.push(column);\n }\n if (!column[this.filterProp] && hasFilter) {\n columnsToUpdate.push(column);\n column[this.filterProp] = true;\n }\n });\n const itemsToFilter = this.getRowFilter(items, filterItems);\n // check is filter event prevented\n const { defaultPrevented, detail } = this.emit('beforefiltertrimmed', {\n collection,\n itemsToFilter,\n source: items,\n filterItems,\n });\n if (defaultPrevented) {\n return;\n }\n\n // check is trimmed event prevented\n const isAddedEvent = await this.revogrid.addTrimmed(\n detail.itemsToFilter,\n FILTER_TRIMMED_TYPE,\n );\n if (isAddedEvent.defaultPrevented) {\n return;\n }\n\n // applies the hasFilter to the columns to show filter icon\n await this.revogrid.updateColumns(columnsToUpdate);\n this.emit('afterFilterApply');\n }\n\n async clearFiltering() {\n this.multiFilterItems = {};\n await this.runFiltering();\n }\n\n private async runFiltering() {\n const collection: FilterCollection = {};\n\n // handle old filterCollection to return the first filter only (if any) from multiFilterItems\n const filterProps = Object.keys(this.multiFilterItems);\n\n for (const prop of filterProps) {\n // check if we have any filter for a column\n if (this.multiFilterItems[prop].length > 0) {\n const firstFilterItem = this.multiFilterItems[prop][0];\n collection[prop] = {\n filter: filterEntities[firstFilterItem.type],\n type: firstFilterItem.type,\n value: firstFilterItem.value,\n };\n }\n }\n\n this.filterCollection = collection;\n\n const { source, columns } = await this.getData();\n const { defaultPrevented, detail } = this.emit('beforefilterapply', {\n collection: this.filterCollection,\n source,\n columns,\n filterItems: this.multiFilterItems,\n });\n if (defaultPrevented) {\n return;\n }\n this.doFiltering(\n detail.collection,\n detail.source,\n detail.columns,\n detail.filterItems,\n );\n }\n\n private async getData() {\n return {\n source: await this.revogrid.getSource(),\n columns: await this.revogrid.getColumns(),\n };\n }\n\n private getRowFilter(rows: DataType[], filterItems: MultiFilterItem) {\n const propKeys = Object.keys(filterItems);\n\n const trimmed: Record<number, boolean> = {};\n let propFilterSatisfiedCount = 0;\n let lastFilterResults: boolean[] = [];\n\n // each rows\n rows.forEach((model, rowIndex) => {\n // working on all props\n for (const prop of propKeys) {\n const propFilters = filterItems[prop];\n\n propFilterSatisfiedCount = 0;\n lastFilterResults = [];\n\n // testing each filter for a prop\n for (const [filterIndex, filterData] of propFilters.entries()) {\n // the filter LogicFunction based on the type\n const filter = this.possibleFilterEntities[filterData.type];\n\n // THE MAGIC OF FILTERING IS HERE\n if (filterData.relation === 'or') {\n lastFilterResults = [];\n if (filter(model[prop], filterData.value)) {\n continue;\n }\n propFilterSatisfiedCount++;\n } else {\n // 'and' relation will need to know the next filter\n // so we save this current filter to include it in the next filter\n lastFilterResults.push(!filter(model[prop], filterData.value));\n\n // check first if we have a filter on the next index to pair it with this current filter\n const nextFilterData = propFilters[filterIndex + 1];\n // stop the sequence if there is no next filter or if the next filter is not an 'and' relation\n if (!nextFilterData || nextFilterData.relation !== 'and') {\n // let's just continue since for sure propFilterSatisfiedCount cannot be satisfied\n if (lastFilterResults.indexOf(true) === -1) {\n lastFilterResults = [];\n continue;\n }\n\n // we need to add all of the lastFilterResults since we need to satisfy all\n propFilterSatisfiedCount += lastFilterResults.length;\n lastFilterResults = [];\n }\n }\n } // end of propFilters forEach\n\n // add to the list of removed/trimmed rows of filter condition is satisfied\n if (propFilterSatisfiedCount === propFilters.length)\n trimmed[rowIndex] = true;\n } // end of for-of propKeys\n });\n return trimmed;\n }\n}\n","var baseGetTag = require('./_baseGetTag'),\n isArray = require('./isArray'),\n isObjectLike = require('./isObjectLike');\n\n/** `Object#toString` result references. */\nvar stringTag = '[object String]';\n\n/**\n * Checks if `value` is classified as a `String` primitive or object.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a string, else `false`.\n * @example\n *\n * _.isString('abc');\n * // => true\n *\n * _.isString(1);\n * // => false\n */\nfunction isString(value) {\n return typeof value == 'string' ||\n (!isArray(value) && isObjectLike(value) && baseGetTag(value) == stringTag);\n}\n\nmodule.exports = isString;\n","var baseProperty = require('./_baseProperty');\n\n/**\n * Gets the size of an ASCII `string`.\n *\n * @private\n * @param {string} string The string inspect.\n * @returns {number} Returns the string size.\n */\nvar asciiSize = baseProperty('length');\n\nmodule.exports = asciiSize;\n","/** Used to compose unicode character classes. */\nvar rsAstralRange = '\\\\ud800-\\\\udfff',\n rsComboMarksRange = '\\\\u0300-\\\\u036f',\n reComboHalfMarksRange = '\\\\ufe20-\\\\ufe2f',\n rsComboSymbolsRange = '\\\\u20d0-\\\\u20ff',\n rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange,\n rsVarRange = '\\\\ufe0e\\\\ufe0f';\n\n/** Used to compose unicode capture groups. */\nvar rsZWJ = '\\\\u200d';\n\n/** Used to detect strings with [zero-width joiners or code points from the astral planes](http://eev.ee/blog/2015/09/12/dark-corners-of-unicode/). */\nvar reHasUnicode = RegExp('[' + rsZWJ + rsAstralRange + rsComboRange + rsVarRange + ']');\n\n/**\n * Checks if `string` contains Unicode symbols.\n *\n * @private\n * @param {string} string The string to inspect.\n * @returns {boolean} Returns `true` if a symbol is found, else `false`.\n */\nfunction hasUnicode(string) {\n return reHasUnicode.test(string);\n}\n\nmodule.exports = hasUnicode;\n","/** Used to compose unicode character classes. */\nvar rsAstralRange = '\\\\ud800-\\\\udfff',\n rsComboMarksRange = '\\\\u0300-\\\\u036f',\n reComboHalfMarksRange = '\\\\ufe20-\\\\ufe2f',\n rsComboSymbolsRange = '\\\\u20d0-\\\\u20ff',\n rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange,\n rsVarRange = '\\\\ufe0e\\\\ufe0f';\n\n/** Used to compose unicode capture groups. */\nvar rsAstral = '[' + rsAstralRange + ']',\n rsCombo = '[' + rsComboRange + ']',\n rsFitz = '\\\\ud83c[\\\\udffb-\\\\udfff]',\n rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')',\n rsNonAstral = '[^' + rsAstralRange + ']',\n rsRegional = '(?:\\\\ud83c[\\\\udde6-\\\\uddff]){2}',\n rsSurrPair = '[\\\\ud800-\\\\udbff][\\\\udc00-\\\\udfff]',\n rsZWJ = '\\\\u200d';\n\n/** Used to compose unicode regexes. */\nvar reOptMod = rsModifier + '?',\n rsOptVar = '[' + rsVarRange + ']?',\n rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*',\n rsSeq = rsOptVar + reOptMod + rsOptJoin,\n rsSymbol = '(?:' + [rsNonAstral + rsCombo + '?', rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') + ')';\n\n/** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */\nvar reUnicode = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g');\n\n/**\n * Gets the size of a Unicode `string`.\n *\n * @private\n * @param {string} string The string inspect.\n * @returns {number} Returns the string size.\n */\nfunction unicodeSize(string) {\n var result = reUnicode.lastIndex = 0;\n while (reUnicode.test(string)) {\n ++result;\n }\n return result;\n}\n\nmodule.exports = unicodeSize;\n","var asciiSize = require('./_asciiSize'),\n hasUnicode = require('./_hasUnicode'),\n unicodeSize = require('./_unicodeSize');\n\n/**\n * Gets the number of symbols in `string`.\n *\n * @private\n * @param {string} string The string to inspect.\n * @returns {number} Returns the string size.\n */\nfunction stringSize(string) {\n return hasUnicode(string)\n ? unicodeSize(string)\n : asciiSize(string);\n}\n\nmodule.exports = stringSize;\n","var baseKeys = require('./_baseKeys'),\n getTag = require('./_getTag'),\n isArrayLike = require('./isArrayLike'),\n isString = require('./isString'),\n stringSize = require('./_stringSize');\n\n/** `Object#toString` result references. */\nvar mapTag = '[object Map]',\n setTag = '[object Set]';\n\n/**\n * Gets the size of `collection` by returning its length for array-like\n * values or the number of own enumerable string keyed properties for objects.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Collection\n * @param {Array|Object|string} collection The collection to inspect.\n * @returns {number} Returns the collection size.\n * @example\n *\n * _.size([1, 2, 3]);\n * // => 3\n *\n * _.size({ 'a': 1, 'b': 2 });\n * // => 2\n *\n * _.size('pebbles');\n * // => 7\n */\nfunction size(collection) {\n if (collection == null) {\n return 0;\n }\n if (isArrayLike(collection)) {\n return isString(collection) ? stringSize(collection) : collection.length;\n }\n var tag = getTag(collection);\n if (tag == mapTag || tag == setTag) {\n return collection.size;\n }\n return baseKeys(collection).length;\n}\n\nmodule.exports = size;\n","import size from 'lodash/size';\nimport debounce from 'lodash/debounce';\nimport range from 'lodash/range';\n\nimport { setStore } from '../../utils/store.utils';\nimport ColumnDataProvider from '../../services/column.data.provider';\nimport { BasePlugin } from '../base.plugin';\nimport {\n ColumnProp,\n Order,\n CellCompareFunc,\n ColumnRegular,\n InitialHeaderClick,\n DataType,\n DimensionRows,\n PluginProviders,\n} from '@type';\n\nexport type SortingOrder = Record<ColumnProp, Order>;\ntype SortingOrderFunction = Record<ColumnProp, CellCompareFunc | undefined>;\ntype ColumnSetEvent = {\n order: SortingOrder;\n};\n\n/**\n * Lifecycle\n * 1. @event `beforesorting` - Triggered when sorting just starts. Nothing has happened yet. This can be triggered from a column or from the source. If the type is from rows, the column will be undefined.\n * 2. @method `updateColumnSorting` - Updates the column sorting icon on the grid and the column itself, but the data remains untouched.\n * 3. @event `beforesortingapply` - Triggered before the sorting data is applied to the data source. You can prevent this event, and the data will not be sorted. This event is only called from a column sorting click.\n * 4. @event `aftersortingapply` - Triggered after sorting has been applied and completed. This event occurs for both row and column sorting.\n *\n * Note: If you prevent an event, it will not proceed to the subsequent steps.\n */\n\nexport default class SortingPlugin extends BasePlugin {\n // sorting order per column\n private sorting: SortingOrder | null = null;\n\n // sorting function per column, multiple columns sorting supported\n private sortingFunc: SortingOrderFunction | null = null;\n private sortingPromise: (() => void) | null = null;\n private postponeSort = debounce(\n async (order: SortingOrder, comparison: SortingOrderFunction) =>\n this.runSorting(order, comparison),\n 50,\n );\n\n private async runSorting(\n order: SortingOrder,\n comparison: SortingOrderFunction,\n ) {\n await this.sort(order, comparison);\n this.sortingPromise?.();\n this.sortingPromise = null;\n }\n\n constructor(\n protected revogrid: HTMLRevoGridElement,\n providers: PluginProviders,\n ) {\n super(revogrid, providers);\n\n const beforeanysource = async ({\n detail: { type },\n }: CustomEvent<{\n type: DimensionRows;\n source: any[];\n }>) => {\n // if sorting was provided - sort data\n if (!!this.sorting && this.sortingFunc) {\n const beforeEvent = this.emit('beforesorting', { type });\n if (beforeEvent.defaultPrevented) {\n return;\n }\n this.startSorting(this.sorting, this.sortingFunc);\n }\n };\n const aftercolumnsset = async ({\n detail: { order },\n }: CustomEvent<ColumnSetEvent>) => {\n const columns = await this.revogrid.getColumns();\n const sortingFunc: SortingOrderFunction = {};\n\n for (let prop in order) {\n const cmp = this.getComparer(\n ColumnDataProvider.getColumnByProp(columns, prop),\n order[prop],\n );\n sortingFunc[prop] = cmp;\n }\n this.runSorting(order, sortingFunc);\n };\n const headerclick = async (e: CustomEvent<InitialHeaderClick>) => {\n if (e.defaultPrevented) {\n return;\n }\n\n if (!e.detail.column.sortable) {\n return;\n }\n\n this.headerclick(\n e.detail.column,\n e.detail.index,\n e.detail?.originalEvent?.shiftKey,\n );\n };\n\n this.addEventListener('beforeanysource', beforeanysource);\n this.addEventListener('aftercolumnsset', aftercolumnsset);\n this.addEventListener('beforeheaderclick', headerclick);\n }\n\n private startSorting(order: SortingOrder, sortingFunc: SortingOrderFunction) {\n if (!this.sortingPromise) {\n this.revogrid.jobsBeforeRender.push(\n new Promise<void>(resolve => {\n this.sortingPromise = resolve;\n }),\n );\n }\n this.postponeSort(order, sortingFunc);\n }\n\n private getComparer(column: ColumnRegular, order: Order): CellCompareFunc {\n const cellCmp: CellCompareFunc =\n column?.cellCompare?.bind({ order }) || this.defaultCellCompare;\n if (order == 'asc') {\n return cellCmp;\n }\n if (order == 'desc') {\n return this.descCellCompare(cellCmp);\n }\n return undefined;\n }\n\n /**\n * Apply sorting to data on header click\n * If additive - add to existing sorting, multiple columns can be sorted\n */\n async headerclick(column: ColumnRegular, index: number, additive: boolean) {\n let order: Order = this.getNextOrder(column.order);\n const beforeEvent = this.emit('beforesorting', { column, order, additive });\n if (beforeEvent.defaultPrevented) {\n return;\n }\n order = beforeEvent.detail.order;\n const newCol = await this.revogrid.updateColumnSorting(\n beforeEvent.detail.column,\n index,\n order,\n additive,\n );\n\n // apply sort data\n const beforeApplyEvent = this.emit('beforesortingapply', {\n column: newCol,\n order,\n additive,\n });\n if (beforeApplyEvent.defaultPrevented) {\n return;\n }\n order = beforeApplyEvent.detail.order;\n const cmp = this.getComparer(column, order);\n\n if (additive && this.sorting) {\n const sorting: SortingOrder = {};\n const sortingFunc: SortingOrderFunction = {};\n\n this.sorting = {\n ...this.sorting,\n ...sorting,\n };\n // extend sorting function with new sorting for multiple columns sorting\n this.sortingFunc = {\n ...this.sortingFunc,\n ...sortingFunc,\n };\n\n if (column.prop in sorting && size(sorting) > 1 && order === undefined) {\n delete sorting[column.prop];\n delete sortingFunc[column.prop];\n } else {\n sorting[column.prop] = order;\n sortingFunc[column.prop] = cmp;\n }\n } else {\n if (order) {\n // reset sorting\n this.sorting = { [column.prop]: order };\n this.sortingFunc = { [column.prop]: cmp };\n } else {\n delete this.sorting[column.prop];\n delete this.sortingFunc[column.prop];\n }\n }\n\n this.startSorting(this.sorting, this.sortingFunc);\n }\n\n /**\n * Sort items by sorting function\n * @requires proxyItems applied to row store\n * @requires source applied to row store\n *\n * @param sorting - per column sorting\n * @param data - this.stores['rgRow'].store.get('source')\n */\n async sort(\n sorting: SortingOrder,\n sortingFunc: SortingOrderFunction,\n types: DimensionRows[] = ['rgRow', 'rowPinStart', 'rowPinEnd'],\n ) {\n // if no sorting - reset\n if (!size(sorting)) {\n this.sorting = null;\n this.sortingFunc = null;\n\n for (let type of types) {\n const store = await this.revogrid.getSourceStore(type);\n // row data\n const source = store.get('source');\n // row indexes\n const proxyItems = range(0, source.length);\n setStore(store, {\n proxyItems,\n source: [...source],\n });\n }\n } else {\n // set sorting\n this.sorting = sorting;\n this.sortingFunc = sortingFunc;\n\n // by default it'll sort by rgRow store\n // todo: support multiple stores\n for (let type of types) {\n const store = await this.revogrid.getSourceStore(type);\n // row data\n const source = store.get('source');\n // row indexes\n const proxyItems = store.get('proxyItems');\n const data = this.sortIndexByItems(\n [...proxyItems],\n source,\n sortingFunc,\n );\n setStore(store, {\n proxyItems: data,\n source: [...source],\n });\n }\n }\n this.emit('aftersortingapply');\n }\n\n defaultCellCompare(prop: ColumnProp, a: DataType, b: DataType) {\n const av = a[prop]?.toString().toLowerCase();\n const bv = b[prop]?.toString().toLowerCase();\n\n return av == bv ? 0 : av > bv ? 1 : -1;\n }\n\n descCellCompare(cmp: CellCompareFunc) {\n return (prop: ColumnProp, a: DataType, b: DataType): number => {\n return -1 * cmp(prop, a, b);\n };\n }\n\n sortIndexByItems(\n indexes: number[],\n source: DataType[],\n sortingFunc: SortingOrderFunction,\n ): number[] {\n // if no sorting - return unsorted indexes\n if (Object.entries(sortingFunc).length === 0) {\n // Unsort indexes\n return [...Array(indexes.length).keys()];\n }\n //\n /**\n * go through all indexes and align in new order\n * performs a multi-level sorting by applying multiple comparison functions to determine the order of the items based on different properties.\n */\n return indexes.sort((a, b) => {\n for (const [prop, cmp] of Object.entries(sortingFunc)) {\n const itemA = source[a];\n const itemB = source[b];\n\n /**\n * If the comparison function returns a non-zero value (sorted), it means that the items should be sorted based on the given property. In such a case, the function immediately returns the sorted value, indicating the order in which the items should be arranged.\n * If none of the comparison functions result in a non-zero value, indicating that the items are equal or should remain in the same order, the function eventually returns 0.\n */\n const sorted = cmp(prop, itemA, itemB);\n if (sorted) {\n return sorted;\n }\n }\n return 0;\n });\n }\n\n getNextOrder(currentOrder: Order): Order {\n switch (currentOrder) {\n case undefined:\n return 'asc';\n case 'asc':\n return 'desc';\n case 'desc':\n return undefined;\n }\n }\n}\n","/**\n * The base implementation of `_.clamp` which doesn't coerce arguments.\n *\n * @private\n * @param {number} number The number to clamp.\n * @param {number} [lower] The lower bound.\n * @param {number} upper The upper bound.\n * @returns {number} Returns the clamped number.\n */\nfunction baseClamp(number, lower, upper) {\n if (number === number) {\n if (upper !== undefined) {\n number = number <= upper ? number : upper;\n }\n if (lower !== undefined) {\n number = number >= lower ? number : lower;\n }\n }\n return number;\n}\n\nmodule.exports = baseClamp;\n","var baseClamp = require('./_baseClamp'),\n toInteger = require('./toInteger');\n\n/** Used as references for the maximum length and index of an array. */\nvar MAX_ARRAY_LENGTH = 4294967295;\n\n/**\n * Converts `value` to an integer suitable for use as the length of an\n * array-like object.\n *\n * **Note:** This method is based on\n * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to convert.\n * @returns {number} Returns the converted integer.\n * @example\n *\n * _.toLength(3.2);\n * // => 3\n *\n * _.toLength(Number.MIN_VALUE);\n * // => 0\n *\n * _.toLength(Infinity);\n * // => 4294967295\n *\n * _.toLength('3.2');\n * // => 3\n */\nfunction toLength(value) {\n return value ? baseClamp(toInteger(value), 0, MAX_ARRAY_LENGTH) : 0;\n}\n\nmodule.exports = toLength;\n","var toInteger = require('./toInteger'),\n toLength = require('./toLength');\n\n/**\n * The base implementation of `_.fill` without an iteratee call guard.\n *\n * @private\n * @param {Array} array The array to fill.\n * @param {*} value The value to fill `array` with.\n * @param {number} [start=0] The start position.\n * @param {number} [end=array.length] The end position.\n * @returns {Array} Returns `array`.\n */\nfunction baseFill(array, value, start, end) {\n var length = array.length;\n\n start = toInteger(start);\n if (start < 0) {\n start = -start > length ? 0 : (length + start);\n }\n end = (end === undefined || end > length) ? length : toInteger(end);\n if (end < 0) {\n end += length;\n }\n end = start > end ? 0 : toLength(end);\n while (start < end) {\n array[start++] = value;\n }\n return array;\n}\n\nmodule.exports = baseFill;\n","var baseFill = require('./_baseFill'),\n isIterateeCall = require('./_isIterateeCall');\n\n/**\n * Fills elements of `array` with `value` from `start` up to, but not\n * including, `end`.\n *\n * **Note:** This method mutates `array`.\n *\n * @static\n * @memberOf _\n * @since 3.2.0\n * @category Array\n * @param {Array} array The array to fill.\n * @param {*} value The value to fill `array` with.\n * @param {number} [start=0] The start position.\n * @param {number} [end=array.length] The end position.\n * @returns {Array} Returns `array`.\n * @example\n *\n * var array = [1, 2, 3];\n *\n * _.fill(array, 'a');\n * console.log(array);\n * // => ['a', 'a', 'a']\n *\n * _.fill(Array(3), 2);\n * // => [2, 2, 2]\n *\n * _.fill([4, 6, 8, 10], '*', 1, 3);\n * // => [4, '*', '*', 10]\n */\nfunction fill(array, value, start, end) {\n var length = array == null ? 0 : array.length;\n if (!length) {\n return [];\n }\n if (start && typeof start != 'number' && isIterateeCall(array, value, start)) {\n start = 0;\n end = length;\n }\n return baseFill(array, value, start, end);\n}\n\nmodule.exports = fill;\n","import { getGroupingName, isGrouping } from '../groupingRow/grouping.service';\nimport { CSVFormat, DataInput, Formatter } from './types';\n\nconst INITIAL: CSVFormat = {\n mime: 'text/csv',\n fileKind: 'csv',\n // BOM signature\n bom: true,\n columnDelimiter: ',',\n rowDelimiter: '\\r\\n',\n encoding: '',\n};\n\nexport type CSVFormatter = (options: Partial<CSVFormat>, data: DataInput) => string;\n\n// The ASCII character code 13 is called a Carriage Return or CR.\nconst CARRIAGE_RETURN = String.fromCharCode(13);\n// Chr(13) followed by a Chr(10) that compose a proper CRLF.\nconst LINE_FEED = String.fromCharCode(10);\nconst DOUBLE_QT = String.fromCharCode(34);\nconst NO_BREAK_SPACE = String.fromCharCode(0xfeff);\nconst escapeRegex = new RegExp('\"', 'g');\n\nexport default class ExportCsv implements Formatter {\n readonly options: Readonly<CSVFormat>;\n constructor(options: Partial<CSVFormat> = {}) {\n this.options = { ...INITIAL, ...options };\n }\n\n doExport({ data, headers, props }: DataInput) {\n let result = this.options.bom ? NO_BREAK_SPACE : '';\n\n // any header\n if (headers?.length > 0) {\n headers.forEach(header => {\n // ignore empty\n if (!header.length) {\n return;\n }\n result += this.prepareHeader(header, this.options.columnDelimiter);\n result += this.options.rowDelimiter;\n });\n }\n\n data.forEach((rgRow, index) => {\n if (index > 0) {\n result += this.options.rowDelimiter;\n }\n // support grouping\n if (isGrouping(rgRow)) {\n result += this.parseCell(getGroupingName(rgRow), this.options.columnDelimiter);\n return;\n }\n result += props.map(p => this.parseCell(rgRow[p], this.options.columnDelimiter)).join(this.options.columnDelimiter);\n });\n\n return result;\n }\n\n private prepareHeader(columnHeaders: string[], columnDelimiter: string) {\n let result = '';\n const newColumnHeaders = columnHeaders.map(v => this.parseCell(v, columnDelimiter, true));\n result += newColumnHeaders.join(columnDelimiter);\n return result;\n }\n\n private parseCell(value: any, columnDelimiter: string, force = false) {\n let escape = value;\n if (typeof value !== 'string') {\n escape = JSON.stringify(value);\n }\n const toEscape = [CARRIAGE_RETURN, DOUBLE_QT, LINE_FEED, columnDelimiter];\n if (typeof escape === 'undefined') {\n return '';\n }\n if (escape !== '' && (force || toEscape.some(i => escape.indexOf(i) >= 0))) {\n return `\"${escape.replace(escapeRegex, '\"\"')}\"`;\n }\n\n return escape;\n }\n}\n","import fill from 'lodash/fill';\nimport { columnTypes, rowTypes, Group, Groups } from '@store';\n\nimport { timeout } from '../../utils';\nimport { BasePlugin } from '../base.plugin';\nimport ExportCsv from './csv';\nimport { ColSource, CSVFormat, DataInput, Formatter } from './types';\nimport { DimensionCols, ColumnProp, DataType } from '@type';\n\nenum ExportTypes {\n csv = 'csv',\n}\n\nexport type ExportFormat = Partial<CSVFormat>;\n\nexport default class ExportFilePlugin extends BasePlugin {\n /** Exports string */\n async exportString(options: ExportFormat = {}, t: ExportTypes = ExportTypes.csv) {\n const data = await this.beforeexport();\n if (!data) {\n return null;\n }\n return this.formatter(t, options).doExport(data);\n }\n\n /** Exports Blob */\n async exportBlob(options: ExportFormat = {}, t: ExportTypes = ExportTypes.csv) {\n return await this.getBlob(this.formatter(t, options));\n }\n\n /** Export file */\n async exportFile(options: ExportFormat = {}, t: ExportTypes = ExportTypes.csv) {\n const formatter = this.formatter(t, options);\n const blob = await this.getBlob(formatter);\n\n // url\n const URL = window.URL || window.webkitURL;\n\n const a = document.createElement('a');\n const { filename, fileKind } = formatter.options;\n const name = `${filename}.${fileKind}`;\n const url = URL.createObjectURL(blob);\n\n a.style.display = 'none';\n a.setAttribute('href', url);\n a.setAttribute('download', name);\n this.revogrid.appendChild(a);\n a.dispatchEvent(new MouseEvent('click'));\n this.revogrid.removeChild(a);\n\n // delay for revoke, correct for some browsers\n await timeout(120);\n URL.revokeObjectURL(url);\n }\n\n /** Blob object */\n async getBlob(formatter: Formatter) {\n const type = `${formatter.options.mime};charset=${formatter.options.encoding}`;\n if (typeof Blob !== 'undefined') {\n const data = await this.beforeexport();\n if (!data) {\n return null;\n }\n return new Blob([formatter.doExport(data)], { type });\n }\n return null;\n }\n\n // before event\n private async beforeexport() {\n let data = await this.getData();\n const event: CustomEvent<{ data: DataInput }> = this.emit('beforeexport', { data });\n if (event.defaultPrevented) {\n return null;\n }\n return event.detail.data;\n }\n\n private async getData(): Promise<DataInput> {\n const data = await this.getSource();\n const colSource: ColSource[] = [];\n const colPromises: Promise<ColSource>[] = [];\n columnTypes.forEach((t, i) => {\n colPromises.push(this.getColPerSource(t).then(s => (colSource[i] = s)));\n });\n await Promise.all(colPromises);\n const columns: ColSource = {\n headers: [],\n props: [],\n };\n for (let source of colSource) {\n source.headers.forEach((h, i) => {\n if (!columns.headers[i]) {\n columns.headers[i] = [];\n }\n columns.headers[i].push(...h);\n });\n columns.props.push(...source.props);\n }\n return {\n data,\n ...columns,\n };\n }\n\n private async getColPerSource(t: DimensionCols) {\n const store = await this.revogrid.getColumnStore(t);\n const source = store.get('source');\n const virtualIndexes = store.get('items');\n const depth = store.get('groupingDepth');\n const groups = store.get('groups');\n const colNames: string[] = [];\n const colProps: ColumnProp[] = [];\n const visibleItems = virtualIndexes.reduce((r: Record<string, number>, v: number, virtualIndex: number) => {\n const prop = source[v].prop;\n colNames.push(source[v].name || '');\n colProps.push(prop);\n r[prop] = virtualIndex;\n return r;\n }, {});\n const rows: string[][] = this.getGroupHeaders(depth, groups, virtualIndexes, visibleItems);\n rows.push(colNames);\n return {\n headers: rows,\n props: colProps,\n };\n }\n\n private getGroupHeaders(depth: number, groups: Groups, items: number[], visibleItems: Record<string, number>) {\n const rows: string[][] = [];\n const template = fill(new Array(items.length), '');\n for (let d = 0; d < depth; d++) {\n const rgRow = [...template];\n rows.push(rgRow);\n if (!groups[d]) {\n continue;\n }\n const levelGroups = groups[d];\n\n // add names of groups\n levelGroups.forEach((group: Group) => {\n const minIndex = this.findGroupStartIndex(group.ids, visibleItems);\n if (typeof minIndex === 'number') {\n rgRow[minIndex] = group.name;\n }\n });\n }\n return rows;\n }\n\n private findGroupStartIndex(ids: (string | number)[], visibleItems: Record<string, number>): number | undefined {\n let min: number | undefined;\n ids.forEach(id => {\n const current = visibleItems[id];\n if (typeof current === 'number') {\n if (typeof min !== 'number' || min > current) {\n min = current;\n }\n }\n });\n return min;\n }\n\n private async getSource() {\n const data: DataType[][] = [];\n const promisesData: Promise<number>[] = [];\n rowTypes.forEach(t => {\n const dataPart: DataType[] = [];\n data.push(dataPart);\n const promise = this.revogrid.getVisibleSource(t).then((d: DataType[]) => dataPart.push(...d));\n promisesData.push(promise);\n });\n await Promise.all(promisesData);\n return data.reduce((r, v) => {\n r.push(...v);\n return r;\n }, []);\n }\n\n // get correct class for future multiple types support\n private formatter(type: ExportTypes, options: ExportFormat = {}) {\n switch (type) {\n case ExportTypes.csv:\n return new ExportCsv(options);\n default:\n throw new Error('Unknown format');\n }\n }\n}\n","import { DataType } from '@type';\nimport { PSEUDO_GROUP_ITEM_ID, PSEUDO_GROUP_ITEM_VALUE, GROUP_EXPANDED, GROUP_DEPTH } from './grouping.const';\nimport { isGrouping, getParsedGroup, isSameGroup } from './grouping.service';\n\n// provide collapse data\nexport function doCollapse(pIndex: number, source: DataType[]) {\n const model = source[pIndex];\n const collapseValue = model[PSEUDO_GROUP_ITEM_VALUE];\n const trimmed: Record<number, boolean> = {};\n let i = pIndex + 1;\n const total = source.length;\n while (i < total) {\n const currentModel = source[i];\n if (isGrouping(currentModel)) {\n const currentValue = currentModel[PSEUDO_GROUP_ITEM_VALUE];\n if (!currentValue.length || !currentValue.startsWith(collapseValue + ',')) {\n break;\n }\n currentModel[GROUP_EXPANDED] = false;\n }\n trimmed[i++] = true;\n }\n model[GROUP_EXPANDED] = false;\n return { trimmed };\n}\n\n/**\n *\n * @param pIndex - physical index\n * @param vIndex - virtual index, need to update item collection\n * @param source - data source\n * @param rowItemsIndexes - rgRow indexes\n */\nexport function doExpand(vIndex: number, source: DataType[], rowItemsIndexes: number[]) {\n const physicalIndex = rowItemsIndexes[vIndex];\n const model = source[physicalIndex];\n const currentGroup = getParsedGroup(model[PSEUDO_GROUP_ITEM_ID]);\n const trimmed: Record<number, boolean> = {};\n\n // no group found\n if (!currentGroup) {\n return { trimmed };\n }\n\n const groupItems: number[] = [];\n model[GROUP_EXPANDED] = true;\n let i = physicalIndex + 1;\n const total = source.length;\n let groupLevelOnly = 0;\n\n // go through all rows\n while (i < total) {\n const currentModel = source[i];\n const isGroup = isGrouping(currentModel);\n // group found\n if (isGroup) {\n if (!isSameGroup(currentGroup, model, currentModel)) {\n break;\n } else if (!groupLevelOnly) {\n // if get group first it's group only level\n groupLevelOnly = currentModel[GROUP_DEPTH];\n }\n }\n // level 0 or same depth\n if (!groupLevelOnly || (isGroup && groupLevelOnly === currentModel[GROUP_DEPTH])) {\n trimmed[i] = false;\n groupItems.push(i);\n }\n i++;\n }\n const result: {\n trimmed: Record<number, boolean>;\n items?: number[];\n } = {\n trimmed,\n };\n if (groupItems.length) {\n const items = [...rowItemsIndexes];\n items.splice(vIndex + 1, 0, ...groupItems);\n result.items = items;\n }\n return result;\n}\n","import { gatherTrimmedItems, Trimmed, TrimmedEntity } from '@store';\n\nexport const TRIMMED_GROUPING = 'grouping';\n\n/**\n * Prepare trimming updated indexes for grouping\n * @param initiallyTrimed\n * @param firstLevelMap\n * @param secondLevelMap\n */\nexport function processDoubleConversionTrimmed(initiallyTrimed: Trimmed, firstLevelMap: Record<number, number>, secondLevelMap?: Record<number, number>) {\n const trimemedOptionsToUpgrade: Trimmed = {};\n /**\n * go through all groups except grouping\n */\n for (let type in initiallyTrimed) {\n if (type === TRIMMED_GROUPING) {\n continue;\n }\n const items = initiallyTrimed[type];\n const newItems: TrimmedEntity = {};\n\n for (let initialIndex in items) {\n /**\n * if item exists we find it in collection\n * we support 2 level of conversions\n */\n let newConversionIndex = firstLevelMap[initialIndex];\n if (secondLevelMap) {\n newConversionIndex = secondLevelMap[newConversionIndex];\n }\n\n /**\n * if item was trimmed previously\n * trimming makes sense to apply\n */\n if (items[initialIndex]) {\n newItems[newConversionIndex] = true;\n /**\n * If changes present apply changes to new source\n */\n if (newConversionIndex !== parseInt(initialIndex, 10)) {\n trimemedOptionsToUpgrade[type] = newItems;\n }\n }\n }\n }\n return trimemedOptionsToUpgrade;\n}\n\nexport function filterOutEmptyGroups(allTrimmedGroups: Trimmed, childrenByGroup: Record<number, number[]> = {}) {\n const trimmedGroup: TrimmedEntity = {};\n const allTrimmed = gatherTrimmedItems(allTrimmedGroups);\n // find is groups are filled\n for (let groupIndex in childrenByGroup) {\n const hasChidlren = childrenByGroup[groupIndex].filter(childIndex => !allTrimmed[childIndex]).length > 0;\n if (!hasChidlren) {\n trimmedGroup[groupIndex] = true;\n }\n }\n return trimmedGroup;\n}\n","import { ColumnCollection } from '../../services/column.data.provider';\nimport { getPhysical, setItems, columnTypes, TrimmedEntity, DSourceState } from '@store';\nimport { BasePlugin } from '../base.plugin';\nimport { FILTER_TRIMMED_TYPE } from '../filter/filter.plugin';\nimport {\n GROUPING_ROW_TYPE,\n GROUP_EXPANDED,\n GROUP_EXPAND_EVENT,\n PSEUDO_GROUP_COLUMN,\n PSEUDO_GROUP_ITEM_VALUE,\n} from './grouping.const';\nimport { doExpand, doCollapse } from './grouping.row.expand.service';\nimport {\n BeforeSourceSetEvent,\n GroupingOptions,\n OnExpandEvent,\n SourceGather,\n} from './grouping.row.types';\nimport {\n ExpandedOptions,\n gatherGrouping,\n isGrouping,\n isGroupingColumn,\n} from './grouping.service';\nimport {\n processDoubleConversionTrimmed,\n TRIMMED_GROUPING,\n} from './grouping.trimmed.service';\nimport { BeforeSaveDataDetails, ColumnRegular, DataType, DimensionRows, PluginProviders } from '@type';\nimport { Observable } from '../../utils/store.utils';\n\nexport default class GroupingRowPlugin extends BasePlugin {\n private options: GroupingOptions | undefined;\n\n get hasProps() {\n return this.options?.props && this.options?.props?.length;\n }\n\n get store(): Observable<DSourceState<DataType, DimensionRows>> {\n return this.providers.data.stores[GROUPING_ROW_TYPE].store;\n }\n\n // proxy for items get\n get rowItems() {\n return this.store.get('items');\n }\n\n get trimmed() {\n return this.store.get('trimmed');\n }\n\n constructor(\n protected revogrid: HTMLRevoGridElement,\n protected providers: PluginProviders,\n ) {\n super(revogrid, providers);\n }\n\n // befoce cell focus\n private onFocus(e: CustomEvent<BeforeSaveDataDetails>) {\n if (isGrouping(e.detail.model)) {\n e.preventDefault();\n }\n }\n\n // expand event triggered\n private onExpand({ virtualIndex }: OnExpandEvent) {\n const { source } = this.getSource();\n let newTrimmed = this.trimmed[TRIMMED_GROUPING];\n\n let i = getPhysical(this.store, virtualIndex);\n const model = source[i];\n const prevExpanded = model[GROUP_EXPANDED];\n if (!prevExpanded) {\n const { trimmed, items } = doExpand(virtualIndex, source, this.rowItems);\n newTrimmed = { ...newTrimmed, ...trimmed };\n if (items) {\n setItems(this.store, items);\n }\n } else {\n const { trimmed } = doCollapse(i, source);\n newTrimmed = { ...newTrimmed, ...trimmed };\n this.revogrid.clearFocus();\n }\n\n this.store.set('source', source);\n this.revogrid.addTrimmed(newTrimmed, TRIMMED_GROUPING);\n }\n\n // get source based on proxy item collection to preserve rgRow order\n private getSource(withoutGrouping = false) {\n const source = this.store.get('source');\n const items = this.store.get('proxyItems');\n let index = 0;\n // order important here, expected parent is first, then others\n return items.reduce(\n (result: SourceGather, i) => {\n const model = source[i];\n if (!withoutGrouping) {\n result.source.push(model);\n return result;\n }\n\n // grouping filter\n if (!isGrouping(model)) {\n result.source.push(model);\n result.oldNewIndexes[i] = index;\n index++;\n } else {\n if (model[GROUP_EXPANDED]) {\n result.prevExpanded[model[PSEUDO_GROUP_ITEM_VALUE]] = true;\n }\n }\n return result;\n },\n {\n source: [],\n prevExpanded: {},\n oldNewIndexes: {},\n },\n );\n }\n\n private setColumnGrouping(cols?: ColumnRegular[]) {\n // if 0 column as holder\n if (cols?.length) {\n cols[0][PSEUDO_GROUP_COLUMN] = true;\n return true;\n }\n return false;\n }\n\n private setColumns({ columns }: ColumnCollection) {\n for (let type of columnTypes) {\n if (this.setColumnGrouping(columns[type])) {\n break;\n }\n }\n }\n\n // evaluate drag between groups\n private onDrag(e: CustomEvent<{ from: number; to: number }>) {\n const { from, to } = e.detail;\n const isDown = to - from >= 0;\n const { source } = this.getSource();\n const items = this.rowItems;\n let i = isDown ? from : to;\n const end = isDown ? to : from;\n for (; i < end; i++) {\n const model = source[items[i]];\n const isGroup = isGrouping(model);\n if (isGroup) {\n e.preventDefault();\n return;\n }\n }\n }\n\n private beforeTrimmedApply(trimmed: Record<number, boolean>, type: string) {\n /** Before filter apply remove grouping filtering */\n if (type === FILTER_TRIMMED_TYPE) {\n const source = this.store.get('source');\n for (let index in trimmed) {\n if (trimmed[index] && isGrouping(source[index])) {\n trimmed[index] = false;\n }\n }\n }\n }\n\n // subscribe to grid events to process them accordingly\n private subscribe() {\n /** if grouping present and new data source arrived */\n this.addEventListener(\n 'beforesourceset',\n ({ detail }: CustomEvent<BeforeSourceSetEvent>) => this.onDataSet(detail),\n );\n this.addEventListener(\n 'beforecolumnsset',\n ({ detail }: CustomEvent<ColumnCollection>) => this.setColumns(detail),\n );\n\n /**\n * filter applied need to clear grouping and apply again\n * based on new results can be new grouping\n */\n this.addEventListener(\n 'beforetrimmed',\n ({ detail: { trimmed, trimmedType } }) =>\n this.beforeTrimmedApply(trimmed, trimmedType),\n );\n /**\n * sorting applied need to clear grouping and apply again\n * based on new results whole grouping order will changed\n */\n this.addEventListener('aftersortingapply', () =>\n this.doSourceUpdate({ ...this.options }),\n );\n\n /**\n * Apply logic for focus inside of grouping\n * We can't focus on grouping rows, navigation only inside of groups for now\n */\n this.addEventListener('beforecellfocus', e => this.onFocus(e));\n /**\n * Prevent rgRow drag outside the group\n */\n this.addEventListener('roworderchanged', e => this.onDrag(e));\n\n /**\n * When grouping expand icon was clicked\n */\n this.addEventListener(\n GROUP_EXPAND_EVENT,\n ({ detail }: CustomEvent<OnExpandEvent>) => this.onExpand(detail),\n );\n }\n\n /**\n * Starts global source update with group clearing and applying new one\n * Initiated when need to reapply grouping\n */\n private doSourceUpdate(options?: ExpandedOptions) {\n if (!this.hasProps) {\n return;\n }\n /**\n * Get source without grouping\n * @param newOldIndexMap - provides us mapping with new indexes vs old indexes, we would use it for trimmed mapping\n */\n const { source, prevExpanded, oldNewIndexes } = this.getSource(true);\n /**\n * Group again\n * @param oldNewIndexMap - provides us mapping with new indexes vs old indexes\n */\n const {\n sourceWithGroups,\n depth,\n trimmed,\n oldNewIndexMap,\n childrenByGroup,\n } = gatherGrouping(source, this.options?.props || [], {\n prevExpanded,\n ...options,\n });\n\n // setup source\n this.providers.data.setData(\n sourceWithGroups,\n GROUPING_ROW_TYPE,\n this.revogrid.disableVirtualY,\n { depth, customRenderer: options?.groupLabelTemplate },\n true,\n );\n this.updateTrimmed(trimmed, childrenByGroup, oldNewIndexes, oldNewIndexMap);\n }\n\n /**\n * Apply grouping on data set\n * Clear grouping from source\n * If source came from other plugin\n */\n private onDataSet(data: BeforeSourceSetEvent) {\n if (!this.hasProps || !data?.source || !data.source.length) {\n return;\n }\n const source = data.source.filter(s => !isGrouping(s));\n const expanded = this.revogrid.grouping || {};\n const {\n sourceWithGroups,\n depth,\n trimmed,\n oldNewIndexMap,\n childrenByGroup,\n } = gatherGrouping(source, this.options?.props || [], {\n ...(expanded || {}),\n });\n data.source = sourceWithGroups;\n this.providers.data.setGrouping({ depth });\n this.updateTrimmed(trimmed, childrenByGroup, oldNewIndexMap);\n }\n\n // apply grouping\n setGrouping(options: GroupingOptions) {\n // unsubscribe from all events when group applied\n this.clearSubscriptions();\n this.options = options;\n // clear props, no grouping exists\n if (!options.props || !Object.keys(options.props).length) {\n this.clearGrouping();\n return;\n }\n // props exist and source inited\n const { source } = this.getSource();\n if (source.length) {\n this.doSourceUpdate({ ...options });\n }\n // props exist and columns inited\n for (let t of columnTypes) {\n if (this.setColumnGrouping(this.providers.column.getColumns(t))) {\n this.providers.column.refreshByType(t);\n break;\n }\n }\n\n // if has any grouping subscribe to events again\n this.subscribe();\n }\n\n // clear grouping\n clearGrouping() {\n // clear columns\n columnTypes.forEach(t => {\n const cols = this.providers.column.getColumns(t);\n let deleted = false;\n cols.forEach(c => {\n if (isGroupingColumn(c)) {\n delete c[PSEUDO_GROUP_COLUMN];\n deleted = true;\n }\n });\n // if column store had grouping clear and refresh\n if (deleted) {\n this.providers.column.refreshByType(t);\n }\n });\n // clear rows\n const { source, oldNewIndexes } = this.getSource(true);\n this.providers.data.setData(\n source,\n GROUPING_ROW_TYPE,\n this.revogrid.disableVirtualY,\n undefined,\n true,\n );\n this.updateTrimmed(undefined, undefined, oldNewIndexes);\n }\n\n private updateTrimmed(\n trimmedGroup: TrimmedEntity = {},\n _childrenByGroup: Record<number, number[]> = {},\n firstLevelMap: Record<number, number>,\n secondLevelMap?: Record<number, number>,\n ) {\n // map previously trimmed data\n const trimemedOptionsToUpgrade = processDoubleConversionTrimmed(\n this.trimmed,\n firstLevelMap,\n secondLevelMap,\n );\n for (let type in trimemedOptionsToUpgrade) {\n this.revogrid.addTrimmed(trimemedOptionsToUpgrade[type], type);\n }\n\n // const emptyGroups = this.filterOutEmptyGroups(trimemedOptionsToUpgrade, childrenByGroup);\n\n // setup trimmed data for grouping\n this.revogrid.addTrimmed({ ...trimmedGroup }, TRIMMED_GROUPING);\n }\n}\n","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 columnTypes,\n rowTypes,\n} from '@store';\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 ViewPortResizeEvent,\n ViewSettingSizeProp,\n DimensionCols,\n DimensionRows,\n HeaderProperties,\n SlotType,\n ViewportColumn,\n ViewportData,\n ViewportProperties,\n ViewportProps,\n Cell,\n RangeArea,\n} from '@type';\nimport { Observable } from '../../utils/store.utils';\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 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","import { columnTypes } from '@store';\nimport {\n DimensionColPin,\n ViewPortScrollEvent,\n ElementsScroll,\n ElementScroll,\n} from '@type';\n\nexport default class GridScrollingService {\n private elements: ElementsScroll = {};\n constructor(private setViewport: (e: ViewPortScrollEvent) => void) {}\n\n async proxyScroll(e: ViewPortScrollEvent, key?: DimensionColPin | string) {\n let newEvent: Promise<ViewPortScrollEvent>;\n let event = e;\n for (let elKey in this.elements) {\n // skip\n if (e.dimension === 'rgCol' && elKey === 'headerRow') {\n continue;\n // pinned column only\n } else if (this.isPinnedColumn(key) && e.dimension === 'rgCol') {\n if (elKey === key || !e.delta) {\n continue;\n }\n for (let el of this.elements[elKey]) {\n if (el.changeScroll) {\n newEvent = el.changeScroll(e);\n }\n }\n } else {\n for (let el of this.elements[elKey]) {\n await el.setScroll?.(e);\n }\n }\n }\n if (newEvent) {\n event = await newEvent;\n }\n this.setViewport(event);\n }\n\n /**\n * Silent scroll update for mobile devices when we have negative scroll top\n */\n async scrollSilentService(\n e: ViewPortScrollEvent,\n key?: DimensionColPin | string,\n ) {\n for (let elKey in this.elements) {\n // skip same element update\n if (elKey === key) {\n continue;\n }\n if (\n columnTypes.includes(key as DimensionColPin) &&\n (elKey === 'headerRow' ||\n columnTypes.includes(elKey as DimensionColPin))\n ) {\n for (let el of this.elements[elKey]) {\n await el.changeScroll?.(e, true);\n }\n continue;\n }\n }\n }\n\n private isPinnedColumn(\n key?: DimensionColPin | string,\n ): key is DimensionColPin {\n return ['colPinStart', 'colPinEnd'].indexOf(key) > -1;\n }\n\n registerElements(els: ElementsScroll) {\n this.elements = els;\n }\n\n /**\n * Register new element for farther scroll support\n * @param el - can be null if holder removed\n * @param key - element key\n */\n registerElement(el: ElementScroll | null, key: string) {\n if (!this.elements[key]) {\n this.elements[key] = [];\n }\n // new element added\n if (el) {\n this.elements[key].push(el);\n } else if (this.elements[key]) {\n // element removed\n delete this.elements[key];\n }\n }\n\n unregister() {\n delete this.elements;\n this.elements = {};\n }\n}\n","import { h, VNode } from '@stencil/core';\nimport { PositionItem } from '@type';\nimport { Cell } from '@type';\n\ntype Props = { ref: { (e: OrdererService): void } };\n\n/**\n * Draw drag\n */\nexport class OrdererService {\n private parentY = 0;\n el!: HTMLElement;\n rgRow!: HTMLElement;\n text!: HTMLElement;\n draggable!: HTMLElement;\n\n start(parent: HTMLElement, { pos, text, event }: { pos: PositionItem; text: string; event: MouseEvent }) {\n const { top } = parent.getBoundingClientRect();\n this.parentY = top;\n if (this.text) {\n this.text.innerText = text;\n }\n this.move(pos);\n this.moveTip({ x: event.x, y: event.y });\n this.el?.classList.remove('hidden');\n }\n end() {\n this.el?.classList.add('hidden');\n }\n move(pos: PositionItem) {\n this.moveElement(pos.end - this.parentY);\n }\n moveTip({ x, y }: Cell) {\n if (!this.draggable) {\n return;\n }\n this.draggable.style.left = `${x}px`;\n this.draggable.style.top = `${y}px`;\n }\n\n private moveElement(y: number) {\n if (!this.rgRow) {\n return;\n }\n this.rgRow.style.transform = `translateY(${y}px)`;\n }\n}\n\nconst OrderRenderer = ({ ref }: Props): VNode[] => {\n const service = new OrdererService();\n ref(service);\n return (\n <div class=\"draggable-wrapper hidden\" ref={e => (service.el = e)}>\n <div class=\"draggable\" ref={el => (service.draggable = el)}>\n <span class=\"revo-alt-icon\" />\n <span ref={e => (service.text = e)} />\n </div>\n <div class=\"drag-position\" ref={e => (service.rgRow = e)} />\n </div>\n );\n};\nexport default OrderRenderer;\n","import each from 'lodash/each';\nimport { calculateRowHeaderSize } from '../utils/row-header-utils';\nimport { ColumnCollection } from '../services/column.data.provider';\nimport { ColumnItems } from '../services/dimension.provider';\nimport { getScrollbarSize } from '../utils';\nimport { BasePlugin } from './base.plugin';\nimport { DimensionCols, DimensionType } from '..';\nimport { PluginBaseComponent } from '../';\nimport { PluginProviders } from '../';\n\n/**\n * This plugin serves to recalculate columns initially\n * Base on empty space if there is any\n * Currently plugin supports only increasing last column\n */\ntype ScrollChange = {\n type: DimensionType;\n hasScroll: boolean;\n};\ntype StretchedData = {\n initialSize: number;\n size: number;\n index: number;\n};\n\nexport default class StretchColumn extends BasePlugin {\n private stretchedColumn: StretchedData | null = null;\n private readonly scrollSize;\n constructor(\n revogrid: HTMLRevoGridElement,\n protected providers: PluginProviders,\n ) {\n super(revogrid, providers);\n\n // calculate scroll bar size for current user session\n this.scrollSize = getScrollbarSize(document);\n\n // subscribe to column changes\n const beforecolumnapplied = ({\n detail: { columns },\n }: CustomEvent<ColumnCollection>) => this.applyStretch(columns);\n this.addEventListener('beforecolumnapplied', beforecolumnapplied);\n }\n\n private setScroll({ type, hasScroll }: ScrollChange) {\n if (\n type === 'rgRow' &&\n this.stretchedColumn &&\n this.stretchedColumn?.initialSize === this.stretchedColumn.size\n ) {\n if (hasScroll) {\n this.stretchedColumn.size -= this.scrollSize;\n this.apply();\n this.dropChanges();\n }\n }\n }\n\n private activateChanges() {\n const setScroll = ({ detail }: CustomEvent<ScrollChange>) =>\n this.setScroll(detail);\n this.addEventListener('scrollchange', setScroll);\n }\n\n private dropChanges() {\n this.stretchedColumn = null;\n this.removeEventListener('scrollchange');\n }\n\n private apply() {\n if (!this.stretchedColumn) {\n return;\n }\n const type: DimensionCols = 'rgCol';\n const sizes = this.providers.dimension.stores[type].store.get('sizes');\n this.providers.dimension.setCustomSizes(\n type,\n {\n ...sizes,\n [this.stretchedColumn.index]: this.stretchedColumn.size,\n },\n true,\n );\n }\n\n /**\n * Apply stretch changes\n */\n applyStretch(columns: ColumnItems) {\n // unsubscribe from all events\n this.dropChanges();\n // calculate grid size\n let sizeDifference = this.revogrid.clientWidth - 1;\n each(columns, (_, type: DimensionCols) => {\n const realSize =\n this.providers.dimension.stores[type].store.get('realSize');\n sizeDifference -= realSize;\n });\n if (this.revogrid.rowHeaders) {\n const itemsLength =\n this.providers.data.stores.rgRow.store.get('source').length;\n const header = this.revogrid.rowHeaders;\n const rowHeaderSize = calculateRowHeaderSize(\n itemsLength,\n typeof header === 'object' ? header : undefined,\n );\n if (rowHeaderSize) {\n sizeDifference -= rowHeaderSize;\n }\n }\n if (sizeDifference > 0) {\n // currently plugin accepts last column only\n const index = columns.rgCol.length - 1;\n const last = columns.rgCol[index];\n /**\n * has column\n * no auto size applied\n * size for column shouldn't be defined\n */\n const colSize = last?.size || this.revogrid.colSize || 0;\n const size = sizeDifference + colSize - 1;\n\n if (last && !last.autoSize && colSize < size) {\n this.stretchedColumn = {\n initialSize: size,\n index,\n size,\n };\n this.apply();\n this.activateChanges();\n }\n }\n }\n}\n\n/**\n * Check plugin type is Stretch\n */\nexport function isStretchPlugin(\n plugin: PluginBaseComponent | StretchColumn,\n): plugin is StretchColumn {\n return !!(plugin as StretchColumn).applyStretch;\n}\n","import reduce from 'lodash/reduce';\nimport { RowDefinition, DimensionRows } from '@type';\n\ntype Result = Partial<{\n [T in DimensionRows]: { sizes?: Record<number, number>; };\n}>;\ntype RemoveResult = Partial<{\n [T in DimensionRows]: number[];\n}>;\nexport const rowDefinitionByType = (newVal: RowDefinition[] = []) => {\n return reduce(newVal, (r: Result, v) => {\n if (!r[v.type]) {\n r[v.type] = {};\n }\n if (v.size) {\n if (!r[v.type].sizes) {\n r[v.type].sizes = {};\n }\n r[v.type].sizes[v.index] = v.size;\n }\n return r;\n },\n {},\n );\n};\n\nexport const rowDefinitionRemoveByType = (oldVal: RowDefinition[] = []) => {\n return reduce(oldVal, (r: RemoveResult, v) => {\n if (!r[v.type]) {\n r[v.type] = [];\n }\n if (v.size) {\n r[v.type].push(v.index);\n }\n return r;\n },\n {},\n );\n};\n","const COLUMN_DRAG_CLASS = 'column-drag-start';\n\nexport class ColumnOrderHandler {\n private element?: HTMLDivElement;\n private autoscrollEl?: HTMLElement;\n private offset = 0;\n\n renderAutoscroll(_: MouseEvent, parent: HTMLElement | null) {\n if (!parent) {\n return;\n }\n this.autoscrollEl = document.createElement('div');\n this.autoscrollEl.classList.add('drag-auto-scroll-y');\n parent.appendChild(this.autoscrollEl);\n }\n\n autoscroll(pos: number, dataContainerSize: number, direction = 'translateX') {\n if (!this.autoscrollEl) {\n return;\n }\n const helperOffset = 10;\n // calculate current y position inside of the grid active holder\n // 3 - size of element + border\n const maxScroll = Math.min(pos + helperOffset, dataContainerSize - 3);\n\n this.autoscrollEl.style.transform = `${direction}(${maxScroll}px)`;\n this.autoscrollEl.scrollIntoView({\n block: 'nearest',\n inline: 'nearest',\n });\n }\n\n start(e: MouseEvent, { dataEl, gridRect, scrollEl, gridEl }: {\n dataEl: HTMLElement;\n gridRect: DOMRect;\n scrollEl: Element;\n gridEl: Element;\n }, dir: 'top' | 'left' = 'left') {\n gridEl.classList.add(COLUMN_DRAG_CLASS);\n const scrollContainerRect = scrollEl.getBoundingClientRect();\n if (scrollContainerRect) {\n this.offset = scrollContainerRect[dir] - gridRect[dir];\n }\n this.renderAutoscroll(e, dataEl);\n }\n\n stop(gridEl: Element) {\n gridEl.classList.remove(COLUMN_DRAG_CLASS);\n if (this.element) {\n this.element.hidden = true;\n }\n this.offset = 0;\n this.autoscrollEl?.remove();\n this.autoscrollEl = undefined;\n }\n\n showHandler(pos: number, size: number, direction = 'translateX') {\n if (!this.element) {\n return;\n }\n // do not allow overcross top of the scrollable area, header excluded\n if (this.offset) {\n pos = Math.max(pos, this.offset);\n }\n // can not be bigger then grid end\n pos = Math.min(pos, size);\n this.element.style.transform = `${direction}(${pos}px)`;\n this.element.hidden = false;\n }\n\n render() {\n const el = this.element = document.createElement('div');\n el.classList.add('drag-position-y');\n el.hidden = true;\n return el;\n }\n}\n","/**\n * Plugin for column manual move\n */\nimport debounce from 'lodash/debounce';\nimport each from 'lodash/each';\nimport ColumnDataProvider from '../../services/column.data.provider';\nimport { DataProvider } from '../../services/data.provider';\nimport DimensionProvider from '../../services/dimension.provider';\nimport SelectionStoreConnector from '../../services/selection.store.connector';\nimport ViewportProvider from '../../services/viewport.provider';\nimport { getItemByPosition } from '@store';\nimport { BasePlugin } from '../base.plugin';\nimport { ColumnOrderHandler } from './order-column.handler';\nimport { dispatch } from '../dispatcher';\nimport { isColGrouping } from '../groupingColumn/grouping.col.plugin';\nimport { ColumnPropProp, ColumnRegular, DimensionSettingsState, PositionItem, DimensionCols, MultiDimensionType, PluginProviders } from '@type';\nimport { ON_COLUMN_CLICK } from '../../components/header/header-cell-renderer';\n\nconst COLUMN_CLICK = ON_COLUMN_CLICK;\nconst MOVE = 'columndragmousemove';\nconst DRAG_END = 'columndragend';\nconst BEFORE_DRAG_END = 'beforecolumndragend';\n\n// use this event subscription to drop D&D for particular columns\nconst DRAG_START = 'columndragstart';\n\nexport type DragStartEventDetails = {\n event: MouseEvent;\n data: ColumnPropProp;\n};\n\nexport type Providers = {\n data: DataProvider;\n dimension: DimensionProvider;\n selection: SelectionStoreConnector;\n column: ColumnDataProvider;\n viewport: ViewportProvider;\n};\ntype StaticData = {\n startPos: number;\n startItem: PositionItem;\n data: ColumnRegular;\n dataEl: HTMLElement;\n scrollEl: Element;\n gridEl: HTMLElement;\n cols: DimensionSettingsState;\n};\n\ntype LocalSubscriptions = Record<string, LocalSubscription>;\ntype LocalSubscription = {\n target: Element | Document;\n callback(...params: any[]): void;\n};\nexport type EventData = {\n elRect: DOMRect;\n gridRect: DOMRect;\n scrollOffset: number;\n type: DimensionCols;\n};\nexport default class ColumnPlugin extends BasePlugin {\n private moveFunc = debounce((e: MouseEvent) => this.doMove(e), 5);\n private staticDragData: StaticData | null = null;\n private dragData: EventData | null = null;\n private readonly orderUi: ColumnOrderHandler;\n protected readonly localSubscriptions: LocalSubscriptions = {};\n constructor(protected revogrid: HTMLRevoGridElement, protected providers: PluginProviders) {\n super(revogrid, providers);\n this.orderUi = new ColumnOrderHandler();\n revogrid.appendChild(this.orderUi.render());\n revogrid.classList.add('column-draggable');\n\n // Register events\n this.localSubscriptions['mouseleave'] = {\n target: document,\n callback: (e: MouseEvent) => this.onMouseOut(e),\n };\n this.localSubscriptions['mouseup'] = {\n target: document,\n callback: (e: MouseEvent) => this.onMouseUp(e),\n };\n\n this.localSubscriptions['mousemove'] = {\n target: document,\n callback: (e: MouseEvent) => this.move(e),\n };\n\n this.addEventListener(COLUMN_CLICK, ({ detail }) => this.dragStart(detail));\n }\n\n dragStart({ event, data }: DragStartEventDetails) {\n if (event.defaultPrevented) {\n return;\n }\n const { defaultPrevented } = dispatch(this.revogrid, DRAG_START, data);\n // check if allowed to drag particulat column\n if (defaultPrevented) {\n return;\n }\n this.clearOrder();\n const { mouseleave, mouseup, mousemove } = this.localSubscriptions;\n mouseleave.target.addEventListener('mouseleave', mouseleave.callback);\n mouseup.target.addEventListener('mouseup', mouseup.callback);\n\n const dataEl = (event.target as HTMLElement).closest('revogr-header');\n const scrollEl = (event.target as HTMLElement).closest('revogr-viewport-scroll');\n if (!dataEl || !scrollEl) {\n return;\n }\n\n // no grouping drag and no row header column drag\n if (isColGrouping(data) || data.providers.type === 'rowHeaders') {\n return;\n }\n\n const cols = this.getDimension(data.pin || 'rgCol');\n const gridRect = this.revogrid.getBoundingClientRect();\n const elRect = dataEl.getBoundingClientRect();\n const startItem = getItemByPosition(\n cols,\n getLeftRelative(event.x, gridRect.left, elRect.left - gridRect.left));\n \n this.staticDragData = {\n startPos: event.x,\n startItem,\n data,\n dataEl,\n scrollEl,\n gridEl: this.revogrid,\n cols,\n };\n this.dragData = this.getData(this.staticDragData);\n mousemove.target.addEventListener('mousemove', mousemove.callback);\n this.orderUi.start(event, {\n ...this.dragData,\n ...this.staticDragData,\n });\n }\n\n doMove(e: MouseEvent) {\n if (!this.staticDragData) {\n return;\n }\n\n const dragData = (this.dragData = this.getData(this.staticDragData));\n if (!dragData) {\n return;\n }\n const start = this.staticDragData.startPos;\n if (Math.abs(start - e.x) > 10) {\n const x = getLeftRelative(e.x, this.dragData.gridRect.left, this.dragData.scrollOffset);\n const rgCol = getItemByPosition(this.staticDragData.cols, x);\n this.orderUi.autoscroll(x, dragData.elRect.width);\n this.orderUi.showHandler(\n rgCol.end + dragData.scrollOffset,\n dragData.gridRect.width\n );\n }\n }\n\n move(e: MouseEvent) {\n dispatch(this.revogrid, MOVE, e);\n // then do move\n this.moveFunc(e);\n }\n onMouseOut(_: MouseEvent) {\n this.clearOrder();\n }\n onMouseUp(e: MouseEvent) {\n // apply new positions\n if (this.dragData) {\n let relativePos = getLeftRelative(e.x, this.dragData.gridRect.left, this.dragData.scrollOffset);\n if (relativePos < 0) {\n relativePos = 0;\n }\n const newPosition = getItemByPosition(this.staticDragData.cols, relativePos);\n\n const store = this.providers.column.stores[this.dragData.type].store;\n const items = [...store.get('items')];\n\n // prevent position change if needed\n const { defaultPrevented: stopDrag } = dispatch(this.revogrid, BEFORE_DRAG_END, {\n ...this.staticDragData,\n startPosition: this.staticDragData.startItem,\n newPosition,\n newItem: store.get('source')[items[this.staticDragData.startItem.itemIndex]]\n });\n if (!stopDrag) {\n // todo: if move item out of group remove item from group\n const toMove = items.splice(this.staticDragData.startItem.itemIndex, 1);\n items.splice(newPosition.itemIndex, 0, ...toMove);\n store.set('items', items);\n }\n dispatch(this.revogrid, DRAG_END, this.dragData);\n }\n this.clearOrder();\n }\n\n private clearLocalSubscriptions() {\n each(this.localSubscriptions, ({ target, callback }, key) => target.removeEventListener(key, callback));\n }\n\n clearOrder() {\n this.staticDragData = null;\n this.dragData = null;\n this.clearLocalSubscriptions();\n this.orderUi.stop(this.revogrid);\n }\n /**\n * Clearing subscription\n */\n protected clearSubscriptions() {\n super.clearSubscriptions();\n this.clearLocalSubscriptions();\n }\n\n private getData({\n gridEl,\n dataEl,\n data,\n }: StaticData): EventData {\n const gridRect = gridEl.getBoundingClientRect();\n const elRect = dataEl.getBoundingClientRect();\n const scrollOffset = elRect.left - gridRect.left;\n return {\n elRect,\n gridRect,\n type: data.pin || 'rgCol',\n scrollOffset,\n };\n }\n private getDimension(type: MultiDimensionType) {\n return this.providers.dimension.stores[type].getCurrentState();\n }\n}\n\nexport function getLeftRelative(\n absoluteX: number,\n gridPos: number,\n offset: number\n): number {\n return absoluteX - gridPos - offset;\n}\n","export function isMobileDevice() {\n return /Mobi/i.test(navigator.userAgent) || /Android/i.test(navigator.userAgent) || navigator.maxTouchPoints > 0;\n}\n","@import './styles/revo-grid.mixin.scss';\n@import './styles/revo-grid.default.scss';\n@import './styles/revo-grid.material.scss';\n@import './styles/revo-grid.dark.material.scss';\n@import './styles/revo-grid.dark.compact.scss';\n@import './styles/revo-grid.compact.scss';\n\nrevo-grid {\n display: block;\n height: 100%;\n /**\n * In some cases the min-height is not enough for safari\n * so setting up the grid height works\n */\n min-height: 300px;\n font-family: Helvetica, Arial, Sans-Serif, serif;\n font-size: 14px;\n position: relative;\n\n @include noSelect;\n\n .attribution {\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n z-index: 100;\n width: 0;\n height: 0;\n border-left: 6px solid #0049cf;\n border-top: 6px solid #0049cf;\n border-bottom: 6px solid transparent;\n border-right: 6px solid transparent;\n cursor: pointer;\n\n .value {\n position: absolute;\n top: 0;\n left: 0;\n background-color: rgba(255, 255, 255, 0.9);\n padding: 4px;\n border-radius: 4px;\n box-shadow: 0 1px 10px rgba(0, 0, 0, 0.2);\n white-space: nowrap;\n text-decoration: none;\n color: black;\n letter-spacing: 0.3px;\n font-size: 11px;\n opacity: 0;\n width: 6px;\n overflow: hidden;\n transition: opacity 0.5s ease-in-out, width 0.3s ease-in-out;\n }\n\n &:hover {\n .value {\n width: 63px;\n opacity: 1;\n }\n }\n }\n\n &.column-draggable.column-drag-start {\n &, * {\n &:hover {\n cursor: grabbing;\n }\n }\n }\n\n .footer-wrapper,\n .header-wrapper {\n width: 100%;\n\n revogr-data {\n z-index: 3;\n }\n }\n\n revo-dropdown {\n width: 100%;\n\n .rv-dr-root {\n max-height: 100%;\n }\n &.shrink label {\n opacity: 0;\n }\n }\n\n .viewports {\n // max-height: 100%; // for safari\n max-width: 100%;\n display: flex;\n flex-direction: row;\n align-items: flex-start;\n flex-grow: 1;\n }\n\n display: flex;\n flex-direction: column;\n width: 100%;\n height: 100%;\n\n .main-viewport {\n flex-grow: 1;\n height: 0;\n display: flex;\n justify-content: space-between;\n flex-direction: row;\n }\n\n .draggable {\n $s: 30px;\n position: fixed;\n height: $s;\n line-height: $s;\n background: #fff;\n border-radius: 3px;\n display: block;\n z-index: 100;\n margin-top: 5px;\n margin-right: -20px;\n box-shadow: 0 4px 20px 0 rgba(black, 0.15);\n padding-left: 20px;\n padding-right: 5px;\n\n &.hidden {\n display: none;\n }\n\n .revo-alt-icon {\n $alt-icon-color: black;\n background-color: $alt-icon-color;\n position: absolute;\n left: 5px;\n top: 10px;\n }\n }\n\n .draggable-wrapper {\n &.hidden {\n display: none;\n }\n }\n\n .drag-position {\n position: absolute;\n left: 0;\n right: 0;\n height: 1px;\n z-index: 2;\n background: gray;\n pointer-events: none;\n }\n\n .drag-position-y {\n position: absolute;\n top: 0;\n left: 0;\n bottom: 0;\n width: 1px;\n z-index: 2;\n background: gray;\n pointer-events: none;\n }\n\n .drag-auto-scroll-y {\n pointer-events: none;\n position: absolute;\n left: 0;\n top: 0;\n height: 50px;\n width: 1px;\n }\n\n .clipboard {\n position: absolute;\n left: 0;\n top: 0;\n }\n\n revogr-scroll-virtual {\n position: relative;\n &.vertical,\n &.horizontal {\n z-index: 3;\n }\n }\n}\n","import {\n Component,\n Prop,\n h,\n Watch,\n Element,\n Listen,\n Event,\n EventEmitter,\n Method,\n VNode,\n Host,\n} from '@stencil/core';\nimport each from 'lodash/each';\n\nimport ColumnDataProvider, {\n ColumnCollection,\n} from '../../services/column.data.provider';\nimport { DataProvider } from '../../services/data.provider';\nimport { DSourceState, getVisibleSourceItem } from '@store';\nimport DimensionProvider from '../../services/dimension.provider';\nimport ViewportProvider from '../../services/viewport.provider';\nimport ThemeService from '../../themeManager/theme.service';\nimport { timeout } from '../../utils';\nimport AutoSize, {\n AutoSizeColumnConfig,\n} from '../../plugins/column.auto-size.plugin';\n\nimport {\n FilterPlugin,\n ColumnFilterConfig,\n FilterCollection,\n} from '../../plugins/filter/filter.plugin';\nimport SortingPlugin from '../../plugins/sorting/sorting.plugin';\nimport ExportFilePlugin from '../../plugins/export/export.plugin';\nimport { DataInput } from '../../plugins/export/types';\nimport GroupingRowPlugin from '../../plugins/groupingRow/grouping.row.plugin';\nimport { GroupingOptions } from '../../plugins/groupingRow/grouping.row.types';\nimport ViewportService, { FocusedData } from './viewport.service';\nimport { DATA_SLOT, HEADER_SLOT } from './viewport.helpers';\nimport GridScrollingService from './viewport.scrolling.service';\nimport { UUID } from '../../utils/consts';\nimport SelectionStoreConnector from '../../services/selection.store.connector';\nimport OrderRenderer, { OrdererService } from '../order/order-renderer';\nimport StretchColumn, {\n isStretchPlugin,\n} from '../../plugins/column.stretch.plugin';\nimport { rowDefinitionByType, rowDefinitionRemoveByType } from './grid.helpers';\nimport ColumnPlugin from '../../plugins/moveColumn/column.drag.plugin';\nimport { getPropertyFromEvent } from '../../utils/events';\nimport { isMobileDevice } from '../../utils/mobile';\nimport {\n MultiDimensionType,\n DimensionRows,\n DimensionCols,\n DimensionType,\n DimensionTypeCol,\n RowHeaders,\n ColumnRegular,\n ColumnGrouping,\n DataType,\n RowDefinition,\n ColumnType,\n FocusTemplateFunc,\n PositionItem,\n ColumnProp,\n ViewPortScrollEvent,\n InitialHeaderClick,\n ColumnDataSchema,\n AllDimensionType,\n Editors,\n BeforeSaveDataDetails,\n BeforeRangeSaveDataDetails,\n Cell,\n ChangedRange,\n RangeArea,\n AfterEditEvent,\n Theme,\n PluginBaseComponent,\n PluginExternalConstructor,\n HeaderProperties,\n PluginProviders,\n} from '@type';\nimport { Observable } from '../../utils/store.utils';\n\n/**\n * Revogrid - High-performance, customizable grid library for managing large datasets.\n *\n * :::tip\n * Read [type definition file](https://github.com/revolist/revogrid/blob/master/src/interfaces.d.ts) for the full interface information.\n * All complex property types such as `ColumnRegular`, `ColumnProp`, `ColumnDataSchemaModel` can be found there.\n * :::\n *\n * :::tip\n * For a comprehensive events guide, check the [dependency tree](#Dependencies).\n * All events propagate to the root level of the grid.\n * :::\n *\n * @slot data-{column-type}-{row-type}. @example data-rgCol-rgRow - main data slot. Applies extra elements in <revogr-data />.\n * @slot focus-{column-type}-{row-type}. @example focus-rgCol-rgRow - focus layer for main data. Applies extra elements in <revogr-focus />.\n */\n@Component({\n tag: 'revo-grid',\n styleUrl: 'revo-grid-style.scss',\n})\nexport class RevoGridComponent {\n // #region Properties\n /** Excel like functionality.\n * Show row numbers.\n * Also can be used for custom row header render if object provided.\n */\n @Prop() rowHeaders: RowHeaders | boolean;\n\n /**\n * Defines how many rows/columns should be rendered outside visible area.\n */\n @Prop() frameSize = 1;\n\n /**\n * Indicates default rgRow size.\n * By default 0, means theme package size will be applied\n *\n * Alternatively you can use `rowSize` to reset viewport\n */\n @Prop() rowSize = 0;\n\n /** Indicates default column size. */\n @Prop() colSize = 100;\n\n /** When true, user can range selection. */\n @Prop() range = false;\n\n /** When true, grid in read only mode. */\n @Prop() readonly = false;\n\n /** When true, columns are resizable. */\n @Prop() resize = false;\n\n /** When true cell focus appear. */\n @Prop() canFocus = true;\n\n /** When true enable clipboard. */\n @Prop() useClipboard = true;\n\n /**\n * Columns - defines an array of grid columns.\n * Can be column or grouped column.\n */\n @Prop() columns: (ColumnRegular | ColumnGrouping)[] = [];\n /**\n * Source - defines main data source.\n * Can be an Object or 2 dimensional array([][]);\n * Keys/indexes referenced from columns Prop.\n */\n @Prop() source: DataType[] = [];\n\n /** Pinned top Source: {[T in ColumnProp]: any} - defines pinned top rows data source. */\n @Prop() pinnedTopSource: DataType[] = [];\n\n /** Pinned bottom Source: {[T in ColumnProp]: any} - defines pinned bottom rows data source. */\n @Prop() pinnedBottomSource: DataType[] = [];\n\n /** Custom row properies to be applied. See `RowDefinition` for more info. */\n @Prop() rowDefinitions: RowDefinition[] = [];\n\n /** Custom editors register. */\n @Prop() editors: Editors = {};\n\n /**\n * Apply changes in editor when closed except 'Escape' cases.\n * If custom editor in use method getValue required.\n * Check interfaces.d.ts `EditorBase` for more info.\n */\n @Prop() applyOnClose = false;\n\n /**\n * Custom grid plugins.\n * Has to be predefined during first grid init.\n * Every plugin should be inherited from BasePlugin.\n */\n @Prop() plugins: PluginExternalConstructor[];\n\n /**\n * Column Types Format.\n * Every type represent multiple column properties.\n * Types will be merged but can be replaced with column properties.\n * Types were made as separate objects to be reusable per multiple columns.\n */\n @Prop() columnTypes: { [name: string]: ColumnType } = {};\n\n /** Theme name. */\n @Prop({ reflect: true, mutable: true }) theme: Theme = 'default';\n\n /**\n * Row class property mapping.\n * Map custom classes to rows from row object data.\n * Define this property in rgRow object and this will be mapped as rgRow class.\n */\n @Prop({ reflect: true }) rowClass = '';\n\n /**\n * Autosize config.\n * Enables columns autoSize.\n * For more details check `autoSizeColumn` plugin.\n * By default disabled, hence operation is not performance efficient.\n * `true` to enable with default params (double header separator click for autosize).\n * Or define config. See `AutoSizeColumnConfig` for more details.\n */\n @Prop() autoSizeColumn: boolean | AutoSizeColumnConfig = false;\n\n /**\n * Enables filter plugin.\n * Can be boolean.\n * Or can be filter collection See `FilterCollection` for more info.\n */\n @Prop() filter: boolean | ColumnFilterConfig = false;\n\n /**\n * Apply changes typed in editor on editor close except Escape cases.\n * If custom editor in use method `getValue` required.\n * Check `interfaces.d.ts` `EditorBase` for more info.\n */\n @Prop() focusTemplate: FocusTemplateFunc;\n\n /**\n * Enable column move plugin.\n */\n @Prop() canMoveColumns = false;\n /**\n * Trimmed rows.\n * Functionality which allows to hide rows from main data set.\n * `trimmedRows` are physical `rgRow` indexes to hide.\n */\n @Prop() trimmedRows: Record<number, boolean> = {};\n\n /**\n * Enable export plugin.\n */\n @Prop() exporting = false;\n\n /**\n * Group rows based on this property.\n * Define properties to be groped by grouping plugin See `GroupingOptions`.\n */\n @Prop() grouping: GroupingOptions;\n\n /**\n * Stretch strategy for columns by `StretchColumn` plugin.\n * For example if there are more space on the right last column size would be increased.\n */\n @Prop() stretch: boolean | string = true;\n\n /**\n * Additional data to be passed to plugins, renders or editors.\n * For example if you need to pass Vue component instance.\n */\n @Prop() additionalData: any = {};\n\n /**\n * Disable lazy rendering mode for the `X axis`.\n * Use when not many columns present and you don't need rerenader cells during scroll.\n * Can be used for initial rendering performance improvement.\n */\n @Prop() disableVirtualX = false;\n /**\n * Disable lazy rendering mode for the `Y axis`.\n * Use when not many rows present and you don't need rerenader cells during scroll.\n * Can be used for initial rendering performance improvement.\n */\n @Prop() disableVirtualY = false;\n\n /**\n * Please only hide the attribution if you are subscribed to Pro version\n */\n @Prop() hideAttribution = false;\n\n /**\n * Prevent rendering until job is done.\n * Can be used for initial rendering performance improvement.\n * When several plugins require initial rendering this will prevent double initial rendering.\n */\n @Prop() jobsBeforeRender: Promise<any>[] = [];\n\n /**\n * Register new virtual node inside of grid.\n * Used for additional items creation such as plugin elements.\n * Should be set before grid render inside of plugins.\n */\n @Prop() registerVNode: VNode[] = [];\n\n // #endregion\n\n // #region Events\n /**\n * New content size has been applied. The size excludes the header.\n * Currently, the event responsible for applying the new content size does not provide the actual size.\n * To retrieve the actual content size, you can utilize the `getContentSize` function after the event has been triggered.\n */\n @Event() contentsizechanged: EventEmitter<MultiDimensionType>;\n\n /**\n * This event is triggered before the data is edited.\n * To prevent the default behavior of editing data and use your own implementation, call `e.preventDefault()`.\n * To override the edit result with your own value, set the `e.val` property to your desired value.\n */\n @Event() beforeedit: EventEmitter<BeforeSaveDataDetails>;\n\n /**\n * This event is triggered before applying range data, specifically when a range selection occurs.\n * To customize the data and prevent the default edit data from being set, you can call `e.preventDefault()`.\n */\n @Event() beforerangeedit: EventEmitter<BeforeRangeSaveDataDetails>;\n\n /**\n * Triggered after data applied or range changed.\n */\n @Event() afteredit: EventEmitter<AfterEditEvent>;\n\n /**\n * This event is triggered before autofill is applied.\n * To prevent the default behavior of applying the edit data, you can call `e.preventDefault()`.\n */\n @Event() beforeautofill: EventEmitter<ChangedRange>;\n\n /**\n * Triggered before range applied.\n * Use e.preventDefault() to prevent range.\n */\n @Event() beforeange: EventEmitter<ChangedRange>;\n\n /**\n * Triggered after focus render finished.\n * Can be used to access a focus element through `event.target`\n */\n @Event() afterfocus: EventEmitter<{\n model: any;\n column: ColumnRegular;\n }>;\n\n /**\n * This event is triggered before the order of `rgRow` is applied.\n * To prevent the default behavior of changing the order of `rgRow`, you can call `e.preventDefault()`.\n */\n @Event() roworderchanged: EventEmitter<{ from: number; to: number }>;\n\n /**\n * Triggered by sorting.plugin.ts\n * Before sorting apply.\n * Use e.preventDefault() to prevent sorting data change.\n */\n @Event() beforesortingapply: EventEmitter<{\n column: ColumnRegular;\n order: 'desc' | 'asc';\n additive: boolean;\n }>;\n\n /**\n * Triggered by sorting.plugin.ts\n * Before sorting event.\n * Initial sorting triggered, if this event stops no other event called.\n * Use e.preventDefault() to prevent sorting.\n */\n @Event() beforesorting: EventEmitter<{\n column: ColumnRegular;\n order: 'desc' | 'asc';\n additive: boolean;\n }>;\n\n /**\n * This event is triggered when the row order change is started.\n * To prevent the default behavior of changing the row order, you can call `e.preventDefault()`.\n * To change the item name at the start of the row order change, you can set `e.text` to the desired new name.\n */\n @Event() rowdragstart: EventEmitter<{\n pos: PositionItem;\n text: string;\n }>;\n\n /**\n * On header click.\n */\n @Event() headerclick: EventEmitter<ColumnRegular>;\n\n /**\n * This event is triggered before the cell focus is changed.\n * To prevent the default behavior of changing the cell focus, you can call `e.preventDefault()`.\n */\n @Event() beforecellfocus: EventEmitter<BeforeSaveDataDetails>;\n\n /**\n * This event is triggered before the grid focus is lost.\n * To prevent the default behavior of changing the cell focus, you can call `e.preventDefault()`.\n */\n @Event() beforefocuslost: EventEmitter<FocusedData | null>;\n\n /**\n * Before main source/rows data apply.\n * You can override data source here\n */\n @Event() beforesourceset: EventEmitter<{\n type: DimensionRows;\n source: DataType[];\n }>;\n\n /**\n * Before data apply on any source type. Can be source from pinned and main viewport.\n * You can override data source here\n */\n @Event() beforeanysource: EventEmitter<{\n type: DimensionRows;\n source: DataType[];\n }>;\n\n /**\n * After main source/rows updated\n */\n @Event() aftersourceset: EventEmitter<{\n type: DimensionRows;\n source: DataType[];\n }>;\n\n /**\n * Emitted after each source update, whether from the pinned or main viewport.\n * Useful for tracking all changes originating from sources in both the pinned and main viewports.\n */\n @Event() afteranysource: EventEmitter<{\n type: DimensionRows;\n source: DataType[];\n }>;\n\n /**\n * Emitted before a column update is applied.\n * Listeners can use this event to perform any necessary actions or modifications before the column update is finalized.\n */\n @Event() beforecolumnsset: EventEmitter<ColumnCollection>;\n\n /**\n * Emitted before a column update is applied, after the column set is gathered and the viewport is updated.\n * Useful for performing actions or modifications before the final application of the column update.\n */\n @Event() beforecolumnapplied: EventEmitter<ColumnCollection>;\n\n /** Column updated */\n @Event() aftercolumnsset: EventEmitter<{\n columns: ColumnCollection;\n order: Record<ColumnProp, 'asc' | 'desc'>;\n }>;\n\n /**\n * Emitted before applying a filter to the data source.\n * Use e.preventDefault() to prevent cell focus change.\n * Modify the @collection if you need to change filters.\n */\n @Event() beforefilterapply: EventEmitter<{ collection: FilterCollection }>;\n\n /**\n * Emitted before applying a filter to the data source.\n * Use e.preventDefault() to prevent the default behavior of trimming values and applying the filter.\n * Modify the `collection` property if you want to change the filters.\n * Modify the `itemsToFilter` property if you want to filter the indexes for trimming.\n */\n @Event() beforefiltertrimmed: EventEmitter<{\n collection: FilterCollection;\n itemsToFilter: Record<number, boolean>;\n }>;\n\n /**\n * Emitted before trimming values.\n * Use e.preventDefault() to prevent the default behavior of trimming values.\n * Modify the `trimmed` property if you want to filter the indexes for trimming.\n */\n @Event() beforetrimmed: EventEmitter<{\n trimmed: Record<number, boolean>;\n trimmedType: string;\n type: string;\n }>;\n\n /**\n * Emitted after trimmed values have been applied.\n * Useful for notifying when trimming of values has taken place.\n */\n @Event() aftertrimmed: EventEmitter;\n\n /**\n * Emitted when the viewport is scrolled.\n * Useful for tracking viewport scrolling events.\n */\n @Event() viewportscroll: EventEmitter<ViewPortScrollEvent>;\n\n /**\n * Before export\n * Use e.preventDefault() to prevent export\n * Replace data in Event in case you want to modify it in export\n */\n @Event() beforeexport: EventEmitter<DataInput>;\n\n /**\n * Emitted before editing starts.\n * Use e.preventDefault() to prevent the default edit behavior.\n */\n @Event() beforeeditstart: EventEmitter<BeforeSaveDataDetails>;\n\n /**\n * Emitted after column resizing.\n * Useful for retrieving the resized columns.\n */\n @Event() aftercolumnresize: EventEmitter<{\n [index: number]: ColumnRegular;\n }>;\n\n /**\n * Emitted before the row definition is applied.\n * Useful for modifying or preventing the default row definition behavior.\n */\n @Event() beforerowdefinition: EventEmitter<{ vals: any; oldVals: any }>;\n\n /**\n * Emitted when the filter configuration is changed\n */\n @Event() filterconfigchanged: EventEmitter;\n\n /**\n * Emmited when the row headers are changed.\n */\n @Event() rowheaderschanged: EventEmitter;\n\n /**\n * Emmited before the grid is rendered.\n */\n @Event() beforegridrender: EventEmitter;\n\n /**\n * Emmited after the grid is initialized. Connected to the DOM.\n */\n @Event() aftergridinit: EventEmitter;\n\n // #endregion\n\n // #region Methods\n /**\n * Refreshes data viewport.\n * Can be specific part as rgRow or pinned rgRow or 'all' by default.\n */\n @Method() async refresh(type: DimensionRows | 'all' = 'all') {\n this.dataProvider.refresh(type);\n }\n\n /**\n * Sets data at specified cell.\n * Useful for performance optimization.\n * No viewport update will be triggered.\n */\n @Method() async setDataAt(\n data: {\n row: number;\n col: number;\n } & AllDimensionType,\n ) {\n const dataElement: HTMLRevogrDataElement | null =\n this.element.querySelector(\n `revogr-data[type=\"${data.rowType}\"][col-type=\"${data.colType}\"]`,\n );\n return dataElement?.updateCell({\n row: data.row,\n col: data.col,\n });\n }\n\n /**\n * Scrolls viewport to specified row by index.\n */\n @Method() async scrollToRow(coordinate = 0) {\n const y = this.dimensionProvider.getViewPortPos({\n coordinate,\n dimension: 'rgRow',\n });\n await this.scrollToCoordinate({ y });\n }\n\n /**\n * Scrolls viewport to specified column by index.\n */\n @Method() async scrollToColumnIndex(coordinate = 0) {\n const x = this.dimensionProvider.getViewPortPos({\n coordinate,\n dimension: 'rgCol',\n });\n await this.scrollToCoordinate({ x });\n }\n\n /**\n * Scrolls viewport to specified column by prop\n */\n @Method() async scrollToColumnProp(\n prop: ColumnProp,\n dimension: DimensionTypeCol = 'rgCol',\n ) {\n const coordinate = this.columnProvider.getColumnIndexByProp(\n prop,\n dimension,\n );\n if (coordinate < 0) {\n // already on the screen\n return;\n }\n const x = this.dimensionProvider.getViewPortPos({\n coordinate,\n dimension,\n });\n await this.scrollToCoordinate({ x });\n }\n\n /** Update columns */\n @Method() async updateColumns(cols: ColumnRegular[]) {\n this.columnProvider.updateColumns(cols);\n }\n\n /** Add trimmed by type */\n @Method() async addTrimmed(\n trimmed: Record<number, boolean>,\n trimmedType = 'external',\n type: DimensionRows = 'rgRow',\n ) {\n const event = this.beforetrimmed.emit({\n trimmed,\n trimmedType,\n type,\n });\n if (event.defaultPrevented) {\n return event;\n }\n this.dataProvider.setTrimmed({ [trimmedType]: event.detail.trimmed }, type);\n this.aftertrimmed.emit();\n return event;\n }\n\n /** Scrolls view port to coordinate */\n @Method() async scrollToCoordinate(cell: Partial<Cell>) {\n this.viewport?.scrollToCell(cell);\n }\n\n /** Open editor for cell. */\n @Method() async setCellEdit(\n rgRow: number,\n prop: ColumnProp,\n rowSource: DimensionRows = 'rgRow',\n ) {\n const rgCol = ColumnDataProvider.getColumnByProp(this.columns, prop);\n if (!rgCol) {\n return;\n }\n await timeout();\n const colGroup = rgCol.pin || 'rgCol';\n this.viewport?.setEdit(\n rgRow,\n this.columnProvider.getColumnIndexByProp(prop, colGroup),\n colGroup,\n rowSource,\n );\n }\n\n /** Set focus range. */\n @Method() async setCellsFocus(\n cellStart: Cell = { x: 0, y: 0 },\n cellEnd: Cell = { x: 0, y: 0 },\n colType = 'rgCol',\n rowType = 'rgRow',\n ) {\n this.viewport?.setFocus(colType, rowType, cellStart, cellEnd);\n }\n\n /** Get data from source */\n @Method() async getSource(type: DimensionRows = 'rgRow') {\n return this.dataProvider.stores[type].store.get('source');\n }\n\n /**\n * Get data from visible part of source\n * Trimmed/filtered rows will be excluded\n * @param type - type of source\n */\n @Method() async getVisibleSource(type: DimensionRows = 'rgRow') {\n return getVisibleSourceItem(this.dataProvider.stores[type].store);\n }\n\n /**\n * Provides access to rows internal store observer\n * Can be used for plugin support\n * @param type - type of source\n */\n @Method() async getSourceStore(\n type: DimensionRows = 'rgRow',\n ): Promise<Observable<DSourceState<DataType, DimensionRows>>> {\n return this.dataProvider.stores[type].store;\n }\n /**\n * Provides access to column internal store observer\n * Can be used for plugin support\n * @param type - type of column\n */\n @Method() async getColumnStore(\n type: DimensionCols = 'rgCol',\n ): Promise<Observable<DSourceState<ColumnRegular, DimensionCols>>> {\n return this.columnProvider.stores[type].store;\n }\n\n /**\n * Update column sorting\n * @param column - full column details to update\n * @param index - virtual column index\n * @param order - order to apply\n */\n @Method() async updateColumnSorting(\n column: ColumnRegular,\n index: number,\n order: 'asc' | 'desc',\n additive: boolean,\n ) {\n return this.columnProvider.updateColumnSorting(\n column,\n index,\n order,\n additive,\n );\n }\n\n /**\n * Clears column sorting\n */\n @Method() async clearSorting() {\n this.columnProvider.clearSorting();\n }\n\n /**\n * Receive all columns in data source\n */\n @Method() async getColumns(): Promise<ColumnRegular[]> {\n return this.columnProvider.getColumns();\n }\n\n /**\n * Clear current grid focus. Grid has no longer focus on it.\n */\n @Method() async clearFocus() {\n const focused = this.viewport?.getFocused();\n const event = this.beforefocuslost.emit(focused);\n if (event.defaultPrevented) {\n return;\n }\n this.selectionStoreConnector.clearAll();\n }\n\n /**\n * Get all active plugins instances\n */\n @Method() async getPlugins(): Promise<PluginBaseComponent[]> {\n return [...this.internalPlugins];\n }\n\n /**\n * Get the currently focused cell.\n */\n @Method() async getFocused(): Promise<FocusedData | null> {\n return this.viewport?.getFocused();\n }\n\n /**\n * Get size of content\n * Including all pinned data\n */\n @Method() async getContentSize(): Promise<Cell> {\n return this.dimensionProvider?.getFullSize();\n }\n /**\n * Get the currently selected Range.\n */\n @Method() async getSelectedRange(): Promise<RangeArea | null> {\n return this.viewport?.getSelectedRange();\n }\n\n // #endregion\n\n // #region Listeners outside scope\n private clickTrackForFocusClear: number | null = null;\n @Listen('touchstart', { target: 'document' })\n @Listen('mousedown', { target: 'document' })\n mousedownHandle(event: MouseEvent | TouchEvent) {\n const screenX = getPropertyFromEvent(event, 'screenX');\n const screenY = getPropertyFromEvent(event, 'screenY');\n if (screenX === null || screenY === null) {\n return;\n }\n\n this.clickTrackForFocusClear = screenX + screenY;\n }\n /**\n * To keep your elements from losing focus use mouseup/touchend e.preventDefault();\n */\n @Listen('touchend', { target: 'document' })\n @Listen('mouseup', { target: 'document' })\n mouseupHandle(event: MouseEvent | TouchEvent) {\n const screenX = getPropertyFromEvent(event, 'screenX');\n const screenY = getPropertyFromEvent(event, 'screenY');\n if (screenX === null || screenY === null) {\n return;\n }\n\n if (event.defaultPrevented) {\n return;\n }\n const target = event.target as HTMLElement | null;\n const pos = screenX + screenY;\n // detect if mousemove then do nothing\n if (Math.abs(this.clickTrackForFocusClear - pos) > 10) {\n return;\n }\n\n // check if action finished inside of the document\n // clear data which is outside of grid\n // if event prevented or it is current table don't clear focus\n if (target?.closest(`[${UUID}=\"${this.uuid}\"]`)) {\n return;\n }\n this.clearFocus();\n }\n // #endregion\n\n // #region Listeners\n /** Drag events */\n @Listen('rowdragstartinit') onRowDragStarted(\n e: CustomEvent<{\n pos: PositionItem;\n text: string;\n event: MouseEvent;\n }>,\n ) {\n const dragStart = this.rowdragstart.emit(e.detail);\n if (dragStart.defaultPrevented) {\n e.preventDefault();\n return;\n }\n this.orderService?.start(this.element, {\n ...e.detail,\n ...dragStart.detail,\n });\n }\n\n @Listen('rowdragendinit') onRowDragEnd() {\n this.orderService?.end();\n }\n\n @Listen('rowdragmoveinit') onRowDrag({ detail }: CustomEvent<PositionItem>) {\n this.orderService?.move(detail);\n }\n\n @Listen('rowdragmousemove') onRowMouseMove(e: CustomEvent<Cell>) {\n this.orderService?.moveTip(e.detail);\n }\n\n @Listen('celleditapply') async onCellEdit(\n e: CustomEvent<BeforeSaveDataDetails>,\n ) {\n const { defaultPrevented, detail } = this.beforeedit.emit(e.detail);\n await timeout();\n // apply data\n if (!defaultPrevented) {\n this.dataProvider.setCellData(detail);\n\n // @feature: incrimental update for cells\n // this.dataProvider.setCellData(detail, false);\n // await this.setDataAt({\n // row: detail.rowIndex,\n // col: detail.colIndex,\n // rowType: detail.type,\n // colType: detail.colType,\n // });\n this.afteredit.emit(detail);\n }\n }\n\n @Listen('rangeeditapply') onRangeEdit(\n e: CustomEvent<BeforeRangeSaveDataDetails>,\n ) {\n const { defaultPrevented, detail } = this.beforerangeedit.emit(e.detail);\n if (defaultPrevented) {\n e.preventDefault();\n return;\n }\n this.dataProvider.setRangeData(detail.data, detail.type);\n this.afteredit.emit(detail);\n }\n\n @Listen('selectionchangeinit') onRangeChanged(e: CustomEvent<ChangedRange>) {\n const beforeange = this.beforeange.emit(e.detail);\n if (beforeange.defaultPrevented) {\n e.preventDefault();\n }\n const beforeFill = this.beforeautofill.emit(beforeange.detail);\n if (beforeFill.defaultPrevented) {\n e.preventDefault();\n }\n }\n\n @Listen('rowdropinit') onRowDropped(\n e: CustomEvent<{ from: number; to: number }>,\n ) {\n // e.cancelBubble = true;\n const { defaultPrevented } = this.roworderchanged.emit(e.detail);\n if (defaultPrevented) {\n e.preventDefault();\n }\n }\n\n @Listen('beforeheaderclick') onHeaderClick(\n e: CustomEvent<InitialHeaderClick>,\n ) {\n const { defaultPrevented } = this.headerclick.emit({\n ...e.detail.column,\n originalEvent: e.detail.originalEvent,\n });\n if (defaultPrevented) {\n e.preventDefault();\n }\n }\n\n @Listen('beforecellfocusinit') onCellFocus(\n e: CustomEvent<BeforeSaveDataDetails>,\n ) {\n const { defaultPrevented } = this.beforecellfocus.emit(e.detail);\n if (!this.canFocus || defaultPrevented) {\n e.preventDefault();\n }\n }\n\n // #endregion\n\n // #region Private Properties\n @Element() element: HTMLRevoGridElement;\n private extraElements: VNode[] = [];\n\n // UUID required to support multiple grids in one page and avoid collision\n uuid: string | null = null;\n columnProvider: ColumnDataProvider;\n dataProvider: DataProvider;\n dimensionProvider: DimensionProvider;\n viewportProvider: ViewportProvider;\n private themeService: ThemeService;\n private viewport: ViewportService | null = null;\n\n private orderService: OrdererService;\n private selectionStoreConnector: SelectionStoreConnector;\n private scrollingService: GridScrollingService;\n\n /**\n * Plugins\n * Define plugins collection\n */\n private internalPlugins: PluginBaseComponent[] = [];\n // #endregion\n\n // #region Watchers\n @Watch('columnTypes') columnTypesChanged() {\n // Column format change will trigger column structure update\n this.columnChanged(this.columns);\n }\n @Watch('columns') columnChanged(newVal: ColumnDataSchema[] = []) {\n const columnGather = ColumnDataProvider.getColumns(\n newVal,\n 0,\n this.columnTypes,\n );\n this.beforecolumnsset.emit(columnGather);\n this.dimensionProvider.applyNewColumns(\n columnGather.columns,\n this.disableVirtualX,\n );\n this.beforecolumnapplied.emit(columnGather);\n const columns = this.columnProvider.setColumns(columnGather);\n this.aftercolumnsset.emit({\n columns,\n order: this.columnProvider.order,\n });\n }\n\n @Watch('disableVirtualX') disableVirtualXChanged(\n newVal = false,\n prevVal = false,\n ) {\n if (newVal === prevVal) {\n return;\n }\n this.columnChanged(this.columns);\n }\n\n @Watch('rowSize') rowSizeChanged(s: number) {\n // clear existing data\n this.dimensionProvider.setSettings({ originItemSize: s }, 'rgRow');\n this.rowDefChanged(this.rowDefinitions, this.rowDefinitions);\n }\n\n @Watch('theme') themeChanged(\n t: Theme,\n _?: Theme,\n __ = 'theme',\n init = false,\n ) {\n this.themeService.register(t);\n this.dimensionProvider.setSettings(\n { originItemSize: this.themeService.rowSize },\n 'rgRow',\n );\n this.dimensionProvider.setSettings(\n { originItemSize: this.colSize },\n 'rgCol',\n );\n // if theme change we need to reapply row size and reset viewport\n if (!init) {\n // clear existing data\n this.dimensionProvider.setSettings(\n { originItemSize: this.themeService.rowSize },\n 'rgRow',\n );\n this.rowDefChanged(\n // for cases when some custom size present and not\n this.rowDefinitions.length\n ? this.rowDefinitions\n : [\n {\n type: 'rgRow',\n size: this.themeService.rowSize,\n index: 0,\n },\n ],\n this.rowDefinitions,\n );\n }\n }\n\n @Watch('source')\n @Watch('pinnedBottomSource')\n @Watch('pinnedTopSource')\n dataSourceChanged<T extends DataType>(\n newVal: T[] = [],\n _: T[] | undefined,\n watchName: string,\n ) {\n let type: DimensionRows = 'rgRow';\n switch (watchName) {\n case 'pinnedBottomSource':\n type = 'rowPinEnd';\n break;\n case 'pinnedTopSource':\n type = 'rowPinStart';\n break;\n case 'source':\n type = 'rgRow';\n /** applied for source only for cross compatability between plugins */\n const beforesourceset = this.beforesourceset.emit({\n type,\n source: newVal,\n });\n newVal = beforesourceset.detail.source as T[];\n break;\n }\n const beforesourceset = this.beforeanysource.emit({\n type,\n source: newVal,\n });\n const newSource = [...beforesourceset.detail.source];\n this.dataProvider.setData(newSource, type, this.disableVirtualY);\n\n /** applied for source only for cross compatability between plugins */\n if (watchName === 'source') {\n this.aftersourceset.emit({\n type,\n source: newVal,\n });\n }\n this.afteranysource.emit({\n type,\n source: newVal,\n });\n }\n\n @Watch('disableVirtualY') disableVirtualYChanged(\n newVal = false,\n prevVal = false,\n ) {\n if (newVal === prevVal) {\n return;\n }\n this.dataSourceChanged(this.source, this.source, 'source');\n }\n\n @Watch('rowDefinitions') rowDefChanged(\n after: RowDefinition[],\n before?: RowDefinition[],\n ) {\n const {\n detail: { vals: newVal, oldVals: oldVal },\n } = this.beforerowdefinition.emit({\n vals: after,\n oldVals: before,\n });\n // apply new vals\n const newRows = rowDefinitionByType(newVal);\n // clear current defs\n if (oldVal) {\n const remove = rowDefinitionRemoveByType(oldVal);\n // clear all old data and drop sizes\n each(remove, (_, t: DimensionRows) => {\n this.dimensionProvider.clearSize(\n t,\n this.dataProvider.stores[t].store.get('source').length,\n );\n });\n }\n if (!newVal.length) {\n return;\n }\n each(newRows, (r, k: DimensionRows) =>\n this.dimensionProvider.setCustomSizes(k, r.sizes || {}),\n );\n }\n\n @Watch('trimmedRows') trimmedRowsChanged(\n newVal: Record<number, boolean> = {},\n ) {\n this.addTrimmed(newVal);\n }\n /**\n * Grouping\n */\n @Watch('grouping') groupingChanged(newVal: GroupingOptions = {}) {\n let grPlugin: GroupingRowPlugin | undefined;\n for (let p of this.internalPlugins) {\n const isGrouping = p as unknown as GroupingRowPlugin;\n if (isGrouping.setGrouping) {\n grPlugin = isGrouping;\n break;\n }\n }\n if (!grPlugin) {\n return;\n }\n grPlugin.setGrouping(newVal || {});\n }\n /**\n * Stretch Plugin Apply\n */\n @Watch('stretch') applyStretch(isStretch: boolean | string) {\n if (isStretch === 'false') {\n isStretch = false;\n }\n let stretch = this.internalPlugins.filter(p => isStretchPlugin(p))[0];\n if ((typeof isStretch === 'boolean' && isStretch) || isStretch === 'true') {\n if (!stretch) {\n const pluginData: PluginProviders = {\n data: this.dataProvider,\n column: this.columnProvider,\n dimension: this.dimensionProvider,\n viewport: this.viewportProvider,\n selection: this.selectionStoreConnector,\n };\n this.internalPlugins.push(new StretchColumn(this.element, pluginData));\n } else if (isStretchPlugin(stretch)) {\n stretch.applyStretch(this.columnProvider.getRawColumns());\n }\n } else if (stretch) {\n const index = this.internalPlugins.indexOf(stretch);\n this.internalPlugins.splice(index, 1);\n }\n }\n\n @Watch('filter') applyFilter(cfg: boolean | ColumnFilterConfig) {\n this.filterconfigchanged.emit(cfg);\n }\n\n @Watch('rowHeaders') rowHeadersChange(rowHeaders?: RowHeaders | boolean) {\n this.rowheaderschanged.emit(rowHeaders);\n }\n\n /**\n * Register external VNodes\n */\n @Watch('registerVNode') registerOutsideVNodes(elements: VNode[] = []) {\n this.extraElements = [...this.extraElements, ...elements];\n }\n // #endregion\n\n componentWillRender() {\n const event = this.beforegridrender.emit();\n if (event.defaultPrevented) {\n return false;\n }\n return Promise.all(this.jobsBeforeRender);\n }\n\n connectedCallback() {\n // #region Setup Providers\n this.viewportProvider = new ViewportProvider();\n this.themeService = new ThemeService({\n rowSize: this.rowSize,\n });\n this.dimensionProvider = new DimensionProvider(this.viewportProvider, {\n realSizeChanged: (k: MultiDimensionType) =>\n this.contentsizechanged.emit(k),\n });\n this.columnProvider = new ColumnDataProvider();\n this.selectionStoreConnector = new SelectionStoreConnector();\n this.dataProvider = new DataProvider(this.dimensionProvider);\n // #endregion\n\n // generate uuid for this grid\n this.uuid = `${new Date().getTime()}-rvgrid`;\n\n this.registerOutsideVNodes(this.registerVNode);\n\n // #region Plugins\n // pass data provider to plugins\n const pluginData: PluginProviders = {\n data: this.dataProvider,\n column: this.columnProvider,\n dimension: this.dimensionProvider,\n viewport: this.viewportProvider,\n selection: this.selectionStoreConnector,\n };\n\n // register auto size plugin\n if (this.autoSizeColumn) {\n this.internalPlugins.push(\n new AutoSize(\n this.element,\n pluginData,\n typeof this.autoSizeColumn === 'object'\n ? this.autoSizeColumn\n : undefined,\n ),\n );\n }\n\n // register filter plugin\n if (this.filter) {\n this.internalPlugins.push(\n new FilterPlugin(\n this.element,\n pluginData,\n this.uuid,\n typeof this.filter === 'object' ? this.filter : undefined,\n ),\n );\n }\n\n // register export plugin\n if (this.exporting) {\n this.internalPlugins.push(new ExportFilePlugin(this.element, pluginData));\n }\n\n // register sorting plugin\n this.internalPlugins.push(new SortingPlugin(this.element, pluginData));\n\n // register grouping plugin\n this.internalPlugins.push(new GroupingRowPlugin(this.element, pluginData));\n if (this.canMoveColumns) {\n this.internalPlugins.push(new ColumnPlugin(this.element, pluginData));\n }\n\n // register user plugins\n if (this.plugins) {\n this.plugins.forEach(p => {\n this.internalPlugins.push(new p(this.element, pluginData));\n });\n }\n // #endregion\n\n // set data\n this.applyStretch(this.stretch);\n this.themeChanged(this.theme, undefined, undefined, true);\n this.columnChanged(this.columns);\n this.dataSourceChanged(this.source, undefined, 'source');\n this.dataSourceChanged(this.pinnedTopSource, undefined, 'pinnedTopSource');\n this.dataSourceChanged(\n this.pinnedBottomSource,\n undefined,\n 'pinnedBottomSource',\n );\n this.trimmedRowsChanged(this.trimmedRows);\n this.rowDefChanged(this.rowDefinitions);\n this.groupingChanged(this.grouping);\n\n // init scrolling service\n this.scrollingService = new GridScrollingService(\n (e: ViewPortScrollEvent) => {\n this.dimensionProvider.setViewPortCoordinate({\n coordinate: e.coordinate,\n type: e.dimension,\n });\n this.viewportscroll.emit(e);\n },\n );\n\n this.aftergridinit.emit();\n }\n\n disconnectedCallback() {\n // destroy plugins on element disconnect\n this.internalPlugins.forEach(p => p.destroy());\n this.internalPlugins = [];\n }\n\n render() {\n const contentHeight =\n this.dimensionProvider.stores['rgRow'].store.get('realSize');\n\n // init viewport service helpers\n this.viewport = new ViewportService(\n {\n columnProvider: this.columnProvider,\n dataProvider: this.dataProvider,\n dimensionProvider: this.dimensionProvider,\n viewportProvider: this.viewportProvider,\n scrollingService: this.scrollingService,\n orderService: this.orderService,\n selectionStoreConnector: this.selectionStoreConnector,\n disableVirtualX: this.disableVirtualX,\n disableVirtualY: this.disableVirtualY,\n resize: c => this.aftercolumnresize.emit(c),\n },\n contentHeight,\n );\n\n // #region ViewportSections\n /**\n * The code renders a viewport divided into sections.\n * It starts by rendering the pinned start, data, and pinned end sections.\n * Within each section, it renders columns along with their headers, pinned top, center data, and pinned bottom.\n * The code iterates over the columns and their data to generate the view port's HTML structure.\n */\n\n const viewportSections: (VNode | VNode[])[] = [];\n\n // Row headers setting\n if (this.rowHeaders && this.viewport.columns.length) {\n const anyView = this.viewport.columns[0];\n viewportSections.push(\n <revogr-row-headers\n additionalData={this.additionalData}\n height={contentHeight}\n rowClass={this.rowClass}\n resize={this.resize}\n dataPorts={anyView.dataPorts}\n headerProp={anyView.headerProp}\n jobsBeforeRender={this.jobsBeforeRender}\n rowHeaderColumn={\n typeof this.rowHeaders === 'object' ? this.rowHeaders : undefined\n }\n onScrollview={({ detail: e }: CustomEvent) =>\n this.scrollingService.proxyScroll(e, 'headerRow')\n }\n onRef={({ detail: e }: CustomEvent) =>\n this.scrollingService.registerElement(e, 'headerRow')\n }\n />,\n );\n }\n\n // Viewport section render\n const isMobile = isMobileDevice();\n const viewPortHtml: VNode[] = [];\n\n // Render viewports column(horizontal sections)\n for (let view of this.viewport.columns) {\n const headerProperties: HeaderProperties = {\n ...view.headerProp,\n type: view.type,\n additionalData: this.additionalData,\n viewportCol: view.viewportCol,\n selectionStore: view.columnSelectionStore,\n canResize: this.resize,\n readonly: this.readonly,\n columnFilter: !!this.filter,\n };\n // Column headers\n const dataViews: VNode[] = [\n <revogr-header {...headerProperties} slot={HEADER_SLOT} />,\n ];\n\n // Render viewport data (vertical sections)\n view.dataPorts.forEach(data => {\n const key = `${data.type}_${view.type}`;\n const dataView = (\n <revogr-overlay-selection\n {...data}\n isMobileDevice={isMobile}\n selectionStore={data.segmentSelectionStore}\n onSelectall={() => this.selectionStoreConnector.selectAll()}\n editors={this.editors}\n readonly={this.readonly}\n range={this.range}\n useClipboard={this.useClipboard}\n applyChangesOnClose={this.applyOnClose}\n additionalData={this.additionalData}\n slot={data.slot}\n onCanceledit={() => this.selectionStoreConnector.setEdit(false)}\n onSetedit={({ detail }) => {\n const event = this.beforeeditstart.emit(detail);\n if (!event.defaultPrevented) {\n this.selectionStoreConnector.setEdit(detail.val);\n }\n }}\n >\n <revogr-data\n {...data}\n colType={view.type}\n key={key}\n readonly={this.readonly}\n range={this.range}\n rowClass={this.rowClass}\n rowSelectionStore={data.rowSelectionStore}\n additionalData={this.additionalData}\n jobsBeforeRender={this.jobsBeforeRender}\n slot={DATA_SLOT}\n >\n <slot name={`data-${view.type}-${data.type}`} />\n </revogr-data>\n <revogr-temp-range\n selectionStore={data.segmentSelectionStore}\n dimensionRow={data.dimensionRow}\n dimensionCol={data.dimensionCol}\n />\n <revogr-focus\n colData={data.colData}\n dataStore={data.dataStore}\n focusTemplate={this.focusTemplate}\n rowType={data.type}\n colType={view.type}\n selectionStore={data.segmentSelectionStore}\n dimensionRow={data.dimensionRow}\n dimensionCol={data.dimensionCol}\n >\n <slot name={`focus-${view.type}-${data.type}`} />\n </revogr-focus>\n </revogr-overlay-selection>\n );\n\n dataViews.push(dataView);\n });\n\n // Add viewport scroll in the end\n viewPortHtml.push(\n <revogr-viewport-scroll\n {...view.prop}\n ref={el =>\n this.scrollingService.registerElement(el, `${view.prop.key}`)\n }\n onScrollviewport={e =>\n this.scrollingService.proxyScroll(e.detail, `${view.prop.key}`)\n }\n onScrollviewportsilent={e =>\n this.scrollingService.scrollSilentService(\n e.detail,\n `${view.prop.key}`,\n )\n }\n >\n {dataViews}\n </revogr-viewport-scroll>,\n );\n }\n\n viewportSections.push(viewPortHtml);\n // #endregion\n\n const typeRow: DimensionType = 'rgRow';\n const typeCol: DimensionType = 'rgCol';\n\n const viewports = this.viewportProvider.stores;\n const dimensions = this.dimensionProvider.stores;\n\n return (\n <Host {...{ [`${UUID}`]: this.uuid }}>\n {this.hideAttribution ? null : (\n <revogr-attribution class=\"attribution\" />\n )}\n <div\n class=\"main-viewport\"\n onClick={(e: MouseEvent) => {\n if (e.currentTarget === e.target) {\n this.viewport.clearEdit();\n }\n }}\n >\n <div class=\"viewports\">\n <slot name=\"viewport\" />\n {viewportSections}\n <revogr-scroll-virtual\n class=\"vertical\"\n dimension={typeRow}\n viewportStore={viewports[typeRow].store}\n dimensionStore={dimensions[typeRow].store}\n ref={el => this.scrollingService.registerElement(el, 'rowScroll')}\n onScrollvirtual={e => this.scrollingService.proxyScroll(e.detail)}\n />\n <OrderRenderer ref={e => (this.orderService = e)} />\n </div>\n </div>\n <revogr-scroll-virtual\n class=\"horizontal\"\n dimension={typeCol}\n viewportStore={viewports[typeCol].store}\n dimensionStore={dimensions[typeCol].store}\n ref={el => this.scrollingService.registerElement(el, 'colScroll')}\n onScrollvirtual={e => this.scrollingService.proxyScroll(e.detail)}\n />\n {this.extraElements}\n </Host>\n );\n }\n}\n"],"version":3}
|
|
1
|
+
{"file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,CAAC,MAAM,CAAC,GACjE,EACD,IAAI,CAAC,aAAa,CACd,EACP;KACH;IAED,oBAAoB;;QAElB,IAAI,CAAC,aAAa,EAAE,CAAC;KACtB;;;;;;;;;;;;;;;;;;;;;;;;;","names":["baseIteratee","require$$0","isArrayLike","require$$1","require$$2","createFind","baseMap","isArray","require$$3","BasePlugin","map","reduce","columnTypes","DataStore","getSourceItem","getSourceItemVirtualIndexByProp","find","each","setSourceByVirtualIndex","rowTypes","isRowType","getVisibleSourceItem","debounce","RESIZE_INTERVAL","DimensionStore","gatherTrimmedItems","getItemByIndex","ViewportStore","gt","FILTER_PROP","h","isFilterBtn","isString","asciiSize","rsAstralRange","rsComboMarksRange","reComboHalfMarksRange","rsComboSymbolsRange","rsComboRange","rsVarRange","rsZWJ","hasUnicode","unicodeSize","stringSize","require$$4","size","range","setStore","baseClamp","toInteger","toLength","baseFill","isGrouping","getGroupingName","timeout","fill","PSEUDO_GROUP_ITEM_VALUE","GROUP_EXPANDED","getParsedGroup","PSEUDO_GROUP_ITEM_ID","isSameGroup","GROUP_DEPTH","GROUPING_ROW_TYPE","getPhysical","setItems","PSEUDO_GROUP_COLUMN","GROUP_EXPAND_EVENT","gatherGrouping","isGroupingColumn","HEADER_SLOT","CONTENT_SLOT","FOOTER_SLOT","EMPTY_INDEX","getLastCell","getScrollbarSize","calculateRowHeaderSize","ON_COLUMN_CLICK","dispatch","getItemByPosition","getPropertyFromEvent","UUID","AutoSize","SelectionStoreConnector","DATA_SLOT","Host"],"sources":["src/themeManager/theme.compact.ts","src/themeManager/theme.default.ts","src/themeManager/theme.material.ts","src/themeManager/theme.service.ts","node_modules/lodash/_createFind.js","node_modules/lodash/find.js","node_modules/lodash/_baseMap.js","node_modules/lodash/map.js","src/plugins/groupingColumn/grouping.col.plugin.ts","src/services/column.data.provider.ts","src/services/data.provider.ts","src/services/dimension.provider.ts","src/services/viewport.provider.ts","src/plugins/column.auto-size.plugin.ts","src/plugins/filter/conditions/equal.ts","src/plugins/filter/conditions/number/greaterThan.ts","src/plugins/filter/conditions/number/greaterThanOrEqual.ts","src/plugins/filter/conditions/number/lessThan.ts","src/plugins/filter/conditions/number/lessThanOrEqual.ts","src/plugins/filter/conditions/set.ts","src/plugins/filter/conditions/string/beginswith.ts","src/plugins/filter/conditions/string/contains.ts","src/plugins/filter/filter.service.ts","src/plugins/filter/filter.plugin.tsx","node_modules/lodash/isString.js","node_modules/lodash/_asciiSize.js","node_modules/lodash/_hasUnicode.js","node_modules/lodash/_unicodeSize.js","node_modules/lodash/_stringSize.js","node_modules/lodash/size.js","src/plugins/sorting/sorting.plugin.ts","node_modules/lodash/_baseClamp.js","node_modules/lodash/toLength.js","node_modules/lodash/_baseFill.js","node_modules/lodash/fill.js","src/plugins/export/csv.ts","src/plugins/export/export.plugin.ts","src/plugins/groupingRow/grouping.row.expand.service.ts","src/plugins/groupingRow/grouping.trimmed.service.ts","src/plugins/groupingRow/grouping.row.plugin.ts","src/components/revoGrid/viewport.service.ts","src/components/revoGrid/viewport.scrolling.service.ts","src/components/order/order-renderer.tsx","src/plugins/column.stretch.plugin.ts","src/components/revoGrid/grid.helpers.ts","src/plugins/moveColumn/order-column.handler.tsx","src/plugins/moveColumn/column.drag.plugin.ts","src/utils/mobile.ts","src/components/revoGrid/revo-grid-style.scss?tag=revo-grid","src/components/revoGrid/revo-grid.tsx"],"sourcesContent":["import { ThemePackage } from '../types/theme';\n\nexport default class ThemeCompact implements ThemePackage {\n defaultRowSize = 32;\n}\n","import { ThemePackage } from '../types/theme';\n\nexport default class ThemeDefault implements ThemePackage {\n defaultRowSize = 27;\n}\n","import { ThemePackage } from '../types/theme';\n\nexport default class ThemeMaterial implements ThemePackage {\n defaultRowSize = 42;\n}\n","import { Theme, ThemeConfig, ThemePackage } from '../types/theme';\nimport ThemeCompact from './theme.compact';\nimport ThemeDefault from './theme.default';\nimport ThemeMaterial from './theme.material';\n\nexport const DEFAULT_THEME = 'default';\n\nexport const allowedThemes: Theme[] = [\n DEFAULT_THEME,\n 'material',\n 'compact',\n 'darkMaterial',\n 'darkCompact',\n];\nexport default class ThemeService {\n private currentTheme: ThemePackage;\n private customRowSize = 0;\n\n get theme() {\n return this.currentTheme;\n }\n\n get rowSize(): number {\n return this.customRowSize || this.currentTheme.defaultRowSize;\n }\n\n set rowSize(size: number) {\n this.customRowSize = size;\n }\n\n constructor(cfg: ThemeConfig) {\n this.customRowSize = cfg.rowSize;\n this.register('default');\n }\n\n register(theme: Theme) {\n const parsedTheme = ThemeService.getTheme(theme);\n switch (parsedTheme) {\n case 'material':\n case 'darkMaterial':\n this.currentTheme = new ThemeMaterial();\n break;\n case 'compact':\n case 'darkCompact':\n this.currentTheme = new ThemeCompact();\n break;\n default:\n this.currentTheme = new ThemeDefault();\n break;\n }\n }\n\n static getTheme(theme: string): Theme {\n if (allowedThemes.indexOf(theme as Theme) > -1) {\n return theme as Theme;\n }\n return DEFAULT_THEME;\n }\n}\n","var baseIteratee = require('./_baseIteratee'),\n isArrayLike = require('./isArrayLike'),\n keys = require('./keys');\n\n/**\n * Creates a `_.find` or `_.findLast` function.\n *\n * @private\n * @param {Function} findIndexFunc The function to find the collection index.\n * @returns {Function} Returns the new find function.\n */\nfunction createFind(findIndexFunc) {\n return function(collection, predicate, fromIndex) {\n var iterable = Object(collection);\n if (!isArrayLike(collection)) {\n var iteratee = baseIteratee(predicate, 3);\n collection = keys(collection);\n predicate = function(key) { return iteratee(iterable[key], key, iterable); };\n }\n var index = findIndexFunc(collection, predicate, fromIndex);\n return index > -1 ? iterable[iteratee ? collection[index] : index] : undefined;\n };\n}\n\nmodule.exports = createFind;\n","var createFind = require('./_createFind'),\n findIndex = require('./findIndex');\n\n/**\n * Iterates over elements of `collection`, returning the first element\n * `predicate` returns truthy for. The predicate is invoked with three\n * arguments: (value, index|key, collection).\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Collection\n * @param {Array|Object} collection The collection to inspect.\n * @param {Function} [predicate=_.identity] The function invoked per iteration.\n * @param {number} [fromIndex=0] The index to search from.\n * @returns {*} Returns the matched element, else `undefined`.\n * @example\n *\n * var users = [\n * { 'user': 'barney', 'age': 36, 'active': true },\n * { 'user': 'fred', 'age': 40, 'active': false },\n * { 'user': 'pebbles', 'age': 1, 'active': true }\n * ];\n *\n * _.find(users, function(o) { return o.age < 40; });\n * // => object for 'barney'\n *\n * // The `_.matches` iteratee shorthand.\n * _.find(users, { 'age': 1, 'active': true });\n * // => object for 'pebbles'\n *\n * // The `_.matchesProperty` iteratee shorthand.\n * _.find(users, ['active', false]);\n * // => object for 'fred'\n *\n * // The `_.property` iteratee shorthand.\n * _.find(users, 'active');\n * // => object for 'barney'\n */\nvar find = createFind(findIndex);\n\nmodule.exports = find;\n","var baseEach = require('./_baseEach'),\n isArrayLike = require('./isArrayLike');\n\n/**\n * The base implementation of `_.map` without support for iteratee shorthands.\n *\n * @private\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Array} Returns the new mapped array.\n */\nfunction baseMap(collection, iteratee) {\n var index = -1,\n result = isArrayLike(collection) ? Array(collection.length) : [];\n\n baseEach(collection, function(value, key, collection) {\n result[++index] = iteratee(value, key, collection);\n });\n return result;\n}\n\nmodule.exports = baseMap;\n","var arrayMap = require('./_arrayMap'),\n baseIteratee = require('./_baseIteratee'),\n baseMap = require('./_baseMap'),\n isArray = require('./isArray');\n\n/**\n * Creates an array of values by running each element in `collection` thru\n * `iteratee`. The iteratee is invoked with three arguments:\n * (value, index|key, collection).\n *\n * Many lodash methods are guarded to work as iteratees for methods like\n * `_.every`, `_.filter`, `_.map`, `_.mapValues`, `_.reject`, and `_.some`.\n *\n * The guarded methods are:\n * `ary`, `chunk`, `curry`, `curryRight`, `drop`, `dropRight`, `every`,\n * `fill`, `invert`, `parseInt`, `random`, `range`, `rangeRight`, `repeat`,\n * `sampleSize`, `slice`, `some`, `sortBy`, `split`, `take`, `takeRight`,\n * `template`, `trim`, `trimEnd`, `trimStart`, and `words`\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Collection\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} [iteratee=_.identity] The function invoked per iteration.\n * @returns {Array} Returns the new mapped array.\n * @example\n *\n * function square(n) {\n * return n * n;\n * }\n *\n * _.map([4, 8], square);\n * // => [16, 64]\n *\n * _.map({ 'a': 4, 'b': 8 }, square);\n * // => [16, 64] (iteration order is not guaranteed)\n *\n * var users = [\n * { 'user': 'barney' },\n * { 'user': 'fred' }\n * ];\n *\n * // The `_.property` iteratee shorthand.\n * _.map(users, 'user');\n * // => ['barney', 'fred']\n */\nfunction map(collection, iteratee) {\n var func = isArray(collection) ? arrayMap : baseMap;\n return func(collection, baseIteratee(iteratee, 3));\n}\n\nmodule.exports = map;\n","import isArray from 'lodash/isArray';\nimport map from 'lodash/map';\nimport { ColumnCollection } from '../../services/column.data.provider';\nimport { ColumnItems } from '../../services/dimension.provider';\nimport { Group as StoreGroup } from '@store';\nimport { BasePlugin } from '../base.plugin';\nimport { DimensionCols } from '@type';\nimport { ColumnGrouping, ColumnRegular } from '@type';\ninterface Group extends StoreGroup {\n level: number;\n}\nexport type ColumnGroupingCollection = Record<DimensionCols, Group[]>;\n\nexport default class GroupingColumnPlugin extends BasePlugin {\n static gatherGroup<T extends ColumnCollection>(res: T, colData: ColumnGrouping, collection: T, level = 0): T {\n // group template\n const group: Group = {\n ...colData,\n level,\n ids: [],\n };\n\n // check columns for update\n for (let k in collection.columns) {\n const key = k as keyof ColumnItems;\n const resultItem = res.columns[key];\n const collectionItem = collection.columns[key];\n\n // if column data\n if (isArray(resultItem) && isArray(collectionItem)) {\n // fill columns\n resultItem.push(...collectionItem);\n\n // fill grouping\n if (collectionItem.length) {\n res.columnGrouping[key].push({\n ...group,\n ids: map(collectionItem, 'prop'),\n });\n }\n }\n }\n // merge column groupings\n for (let k in collection.columnGrouping) {\n const key = k as DimensionCols;\n const collectionItem = collection.columnGrouping[key];\n res.columnGrouping[key].push(...collectionItem);\n }\n res.maxLevel = Math.max(res.maxLevel, collection.maxLevel);\n res.sort = { ...res.sort, ...collection.sort };\n return res;\n }\n}\n\n/**\n * Check if column is grouping column\n */\nexport function isColGrouping(colData: ColumnGrouping | ColumnRegular): colData is ColumnGrouping {\n return !!(colData as ColumnGrouping).children;\n}\n","import reduce from 'lodash/reduce';\nimport each from 'lodash/each';\nimport find from 'lodash/find';\n\nimport {\n columnTypes,\n DataStore,\n getSourceItem,\n getSourceItemVirtualIndexByProp,\n Groups,\n setSourceByVirtualIndex,\n} from '@store';\nimport GroupingColumnPlugin, {\n ColumnGroupingCollection,\n isColGrouping,\n} from '../plugins/groupingColumn/grouping.col.plugin';\nimport {\n ColumnData,\n ColumnDataSchema,\n ColumnProp,\n ColumnRegular,\n ColumnTypes,\n ViewSettingSizeProp,\n DimensionCols,\n DimensionColPin,\n} from '@type';\n\nexport type ColumnCollection = {\n columns: Record<DimensionCols, ColumnRegular[]>;\n columnByProp: Record<ColumnProp, ColumnRegular[]>;\n columnGrouping: ColumnGroupingCollection;\n maxLevel: number;\n sort: Record<ColumnProp, ColumnRegular>;\n};\n\nexport type ColumnDataSources = Record<\n DimensionCols,\n DataStore<ColumnRegular, DimensionCols>\n>;\ntype Sorting = Record<ColumnProp, ColumnRegular>;\ntype SortingOrder = Record<ColumnProp, 'asc' | 'desc'>;\n\nexport default class ColumnDataProvider {\n readonly dataSources: ColumnDataSources;\n sorting: Sorting | null = null;\n\n get order() {\n return reduce(\n this.sorting,\n (r: SortingOrder, c, prop) => {\n r[prop] = c.order;\n return r;\n },\n {},\n );\n }\n\n get stores() {\n return this.dataSources;\n }\n constructor() {\n this.dataSources = reduce(\n columnTypes,\n (sources: Partial<ColumnDataSources>, k: DimensionCols) => {\n sources[k] = new DataStore(k);\n return sources;\n },\n {},\n ) as ColumnDataSources;\n }\n\n column(c: number, pin?: DimensionColPin): ColumnRegular | undefined {\n return this.getColumn(c, pin || 'rgCol');\n }\n\n getColumn(\n virtualIndex: number,\n type: DimensionCols,\n ): ColumnRegular | undefined {\n return getSourceItem(this.dataSources[type].store, virtualIndex);\n }\n\n getRawColumns() {\n return reduce(\n this.dataSources,\n (\n result: Record<DimensionCols, ColumnRegular[]>,\n item,\n type: DimensionCols,\n ) => {\n result[type] = item.store.get('source');\n return result;\n },\n {\n rgCol: [],\n colPinStart: [],\n colPinEnd: [],\n },\n );\n }\n\n getColumns(type: DimensionCols | 'all' = 'all'): ColumnRegular[] {\n if (type !== 'all') {\n return this.dataSources[type].store.get('source');\n }\n return columnTypes.reduce((r: ColumnRegular[], t) => {\n r.push(...this.dataSources[t].store.get('source'));\n return r;\n }, []);\n }\n\n getColumnIndexByProp(prop: ColumnProp, type: DimensionCols): number {\n return getSourceItemVirtualIndexByProp(this.dataSources[type].store, prop);\n }\n\n getColumnByProp(\n prop: ColumnProp,\n type: DimensionCols,\n ): ColumnRegular | undefined {\n const items = this.dataSources[type].store.get('source');\n return find(items, { prop });\n }\n\n refreshByType(type: DimensionCols) {\n this.dataSources[type].refresh();\n }\n\n setColumns(data: ColumnCollection): ColumnCollection {\n columnTypes.forEach(k => {\n // set columns data\n this.dataSources[k].updateData(data.columns[k], {\n // max depth level\n depth: data.maxLevel,\n\n // groups\n groups: data.columnGrouping[k].reduce((res: Groups, g) => {\n if (!res[g.level]) {\n res[g.level] = [];\n }\n res[g.level].push(g);\n return res;\n }, {}),\n });\n });\n this.sorting = data.sort;\n return data;\n }\n\n updateColumns(cols: ColumnRegular[]) {\n // collect column by type and propert\n const columnByKey: Partial<\n Record<DimensionCols, Record<ColumnProp, ColumnRegular>>\n > = cols.reduce(\n (\n res: Partial<Record<DimensionCols, Record<ColumnProp, ColumnRegular>>>,\n c,\n ) => {\n const type = ColumnDataProvider.getColumnType(c);\n if (!res[type]) {\n res[type] = {};\n }\n res[type][c.prop] = c;\n return res;\n },\n {},\n );\n\n // find indexes in source\n const colByIndex: Partial<\n Record<DimensionCols, Record<number, ColumnRegular>>\n > = {};\n each(columnByKey, (colsToUpdate, type: DimensionCols) => {\n const items = this.dataSources[type].store.get('source');\n colByIndex[type] = items.reduce(\n (result: Record<number, ColumnRegular>, rgCol, index) => {\n const colToUpdateIfExists = colsToUpdate[rgCol.prop];\n if (colToUpdateIfExists) {\n result[index] = colToUpdateIfExists;\n }\n return result;\n },\n {},\n );\n });\n each(colByIndex, (colsToUpdate, type: DimensionCols) =>\n setSourceByVirtualIndex(this.dataSources[type].store, colsToUpdate),\n );\n }\n\n updateColumn(column: ColumnRegular, index: number) {\n const type = ColumnDataProvider.getColumnType(column);\n setSourceByVirtualIndex(this.dataSources[type].store, { [index]: column });\n }\n\n updateColumnSorting(\n column: ColumnRegular,\n index: number,\n sorting: 'asc' | 'desc',\n additive: boolean,\n ): ColumnRegular {\n if (!additive) {\n this.clearSorting();\n }\n column.order = sorting;\n this.sorting[column.prop] = column;\n this.updateColumn(column, index);\n return column;\n }\n\n clearSorting() {\n const types = reduce(\n this.sorting,\n (r: { [key in Partial<DimensionCols>]: boolean }, c: ColumnRegular) => {\n const k = ColumnDataProvider.getColumnType(c);\n r[k] = true;\n return r;\n },\n {} as { [key in Partial<DimensionCols>]: boolean },\n );\n each(types, (_, type: DimensionCols) => {\n const cols = this.dataSources[type].store.get('source');\n each(cols, (c: ColumnRegular) => (c.order = undefined));\n this.dataSources[type].setData({ source: [...cols] });\n });\n\n this.sorting = {};\n }\n\n static getSizes(cols: ColumnRegular[]): ViewSettingSizeProp {\n return reduce(\n cols,\n (res: ViewSettingSizeProp, c: ColumnRegular, i: number) => {\n if (c.size) {\n res[i] = c.size;\n }\n return res;\n },\n {},\n );\n }\n\n static getColumnByProp(\n columns: ColumnData,\n prop: ColumnProp,\n ): ColumnRegular | undefined {\n return find(columns, c => {\n if (isColGrouping(c)) {\n return ColumnDataProvider.getColumnByProp(c.children, prop);\n }\n return c.prop === prop;\n }) as ColumnRegular | undefined;\n }\n\n // columns processing\n static getColumns(\n columns: ColumnData,\n level = 0,\n types?: ColumnTypes,\n ): ColumnCollection {\n const collection: ColumnCollection = {\n // columns as they are in stores per type\n columns: {\n rgCol: [],\n colPinStart: [],\n colPinEnd: [],\n },\n // columns grouped by prop for quick access\n columnByProp: {},\n // column grouping\n columnGrouping: {\n rgCol: [],\n colPinStart: [],\n colPinEnd: [],\n },\n // max depth level for column grouping\n maxLevel: level,\n // sorting\n sort: {},\n };\n\n return reduce(\n columns,\n (res: ColumnCollection, colData: ColumnDataSchema) => {\n // Grouped column\n if (isColGrouping(colData)) {\n return GroupingColumnPlugin.gatherGroup(\n res,\n colData,\n ColumnDataProvider.getColumns(colData.children, level + 1, types),\n level,\n );\n }\n // Regular column\n const regularColumn = {\n ...(colData.columnType && types && types[colData.columnType]),\n ...colData,\n };\n // Regular column, no Pin\n if (!regularColumn.pin) {\n res.columns.rgCol.push(regularColumn);\n // Pin\n } else {\n res.columns[regularColumn.pin].push(regularColumn);\n }\n if (regularColumn.order) {\n res.sort[regularColumn.prop] = regularColumn;\n }\n // technically it's possible that some columns have same prop, but better to avoid it\n if (!res.columnByProp[regularColumn.prop]) {\n res.columnByProp[regularColumn.prop] = [];\n }\n res.columnByProp[regularColumn.prop].push(regularColumn);\n\n // trigger setup hook if present\n regularColumn.beforeSetup && regularColumn.beforeSetup(regularColumn);\n return res;\n },\n collection,\n );\n }\n\n static getColumnType(rgCol: ColumnRegular): DimensionCols {\n if (rgCol.pin) {\n return rgCol.pin;\n }\n return 'rgCol';\n }\n}\n","import reduce from 'lodash/reduce';\n\nimport {\n isRowType,\n rowTypes,\n DataStore,\n getSourceItem,\n getVisibleSourceItem,\n Groups,\n setSourceByVirtualIndex,\n Trimmed,\n} from '@store';\nimport DimensionProvider from './dimension.provider';\nimport { GroupLabelTemplateFunc } from '../plugins/groupingRow/grouping.row.types';\nimport {\n DataLookup,\n DimensionRows,\n DataType,\n BeforeSaveDataDetails,\n} from '@type';\n\nexport type RowDataSources = {\n [T in DimensionRows]: DataStore<DataType, DimensionRows>;\n};\n\n/**\n * Data source provider\n */\n\nexport class DataProvider {\n public readonly stores: RowDataSources;\n constructor(private dimensionProvider: DimensionProvider) {\n this.stores = reduce(\n rowTypes,\n (sources: Partial<RowDataSources>, k: DimensionRows) => {\n sources[k] = new DataStore(k);\n return sources;\n },\n {},\n ) as RowDataSources;\n }\n\n setData(\n data: DataType[],\n type: DimensionRows = 'rgRow',\n disableVirtualRows = false,\n grouping?: {\n depth: number;\n groups?: Groups;\n customRenderer?: GroupLabelTemplateFunc;\n },\n silent = false,\n ): DataType[] {\n // set rgRow data\n this.stores[type].updateData([...data], grouping, silent);\n\n // for pinned row no need virtual data\n const noVirtual = type !== 'rgRow' || disableVirtualRows;\n this.dimensionProvider.setData(data.length, type, noVirtual);\n return data;\n }\n\n getModel(virtualIndex: number, type: DimensionRows = 'rgRow') {\n const store = this.stores[type].store;\n return getSourceItem(store, virtualIndex);\n }\n\n setCellData(\n { type, rowIndex, prop, val }: BeforeSaveDataDetails,\n mutate = true,\n ) {\n const model = this.getModel(rowIndex, type);\n model[prop] = val;\n // apply data to source\n setSourceByVirtualIndex(\n this.stores[type].store,\n { [rowIndex]: model },\n mutate,\n );\n }\n\n setRangeData(data: DataLookup, type: DimensionRows) {\n const items: Record<number, DataType> = {};\n for (let rowIndex in data) {\n const oldModel = (items[rowIndex] = getSourceItem(\n this.stores[type].store,\n parseInt(rowIndex, 10),\n ));\n if (!oldModel) {\n continue;\n }\n for (let prop in data[rowIndex]) {\n oldModel[prop] = data[rowIndex][prop];\n }\n }\n // apply data to source\n setSourceByVirtualIndex(this.stores[type].store, items);\n }\n\n refresh(type: DimensionRows | 'all' = 'all') {\n if (isRowType(type)) {\n this.refreshItems(type);\n }\n rowTypes.forEach((t: DimensionRows) => this.refreshItems(t));\n }\n\n refreshItems(type: DimensionRows = 'rgRow') {\n const items = this.stores[type].store.get('items');\n this.stores[type].setData({ items: [...items] });\n }\n\n setGrouping({ depth }: { depth: number }, type: DimensionRows = 'rgRow') {\n this.stores[type].setData({ groupingDepth: depth });\n }\n\n setTrimmed(trimmed: Partial<Trimmed>, type: DimensionRows = 'rgRow') {\n const store = this.stores[type];\n store.addTrimmed(trimmed);\n this.dimensionProvider.setTrimmed(trimmed, type);\n if (type === 'rgRow') {\n this.dimensionProvider.setData(\n getVisibleSourceItem(store.store).length,\n type,\n );\n }\n }\n}\n","import reduce from 'lodash/reduce';\nimport debounce from 'lodash/debounce';\nimport ColumnDataProvider from '../services/column.data.provider';\nimport ViewportProvider from './viewport.provider';\nimport {\n columnTypes,\n rowTypes,\n DimensionStore,\n DimensionStoreCollection,\n gatherTrimmedItems,\n Trimmed,\n} from '@store';\nimport { RESIZE_INTERVAL } from '../utils/consts';\nimport {\n DimensionCols,\n DimensionType,\n MultiDimensionType,\n ColumnRegular,\n DimensionSettingsState,\n ViewPortScrollEvent,\n ViewSettingSizeProp,\n ViewportState,\n} from '@type';\nimport { getItemByIndex } from '../store/dimension/dimension.helpers';\nexport type ColumnItems = Record<DimensionCols, ColumnRegular[]>;\n\nexport type DimensionConfig = {\n realSizeChanged(k: MultiDimensionType): void;\n};\n/**\n * Dimension provider\n * Stores dimension information and custom sizes\n */\nexport default class DimensionProvider {\n readonly stores: DimensionStoreCollection;\n constructor(\n private viewports: ViewportProvider,\n config: DimensionConfig,\n ) {\n const sizeChanged = debounce(\n (k: MultiDimensionType) => config.realSizeChanged(k),\n RESIZE_INTERVAL,\n );\n this.stores = reduce(\n [...rowTypes, ...columnTypes],\n (sources: Partial<DimensionStoreCollection>, k: MultiDimensionType) => {\n sources[k] = new DimensionStore();\n sources[k].store.onChange('realSize', () => sizeChanged(k));\n return sources;\n },\n {},\n ) as DimensionStoreCollection;\n }\n\n /**\n * Clear old sizes from dimension and viewports\n * @param type - dimension type\n * @param count - count of items\n */\n clearSize(t: MultiDimensionType, count: number) {\n this.stores[t].drop();\n // after we done with drop trigger viewport recalculaction\n this.viewports.stores[t].setOriginalSizes(\n this.stores[t].store.get('originItemSize'),\n );\n this.setItemCount(count, t);\n }\n\n /**\n * Apply new custom sizes to dimension and view port\n * @param type - dimension type\n * @param sizes - new custom sizes\n * @param keepOld - keep old sizes merge new with old\n */\n setCustomSizes(\n type: MultiDimensionType,\n sizes: ViewSettingSizeProp,\n keepOld = false,\n ) {\n let newSizes = sizes;\n if (keepOld) {\n const oldSizes = this.stores[type].store.get('sizes');\n newSizes = {\n ...oldSizes,\n ...sizes,\n };\n }\n this.stores[type].setDimensionSize(newSizes);\n this.viewports.stores[type].setViewPortDimensionSizes(\n newSizes,\n !keepOld ? this.stores[type].store.get('originItemSize') : undefined,\n );\n }\n\n setItemCount(realCount: number, type: MultiDimensionType) {\n this.viewports.stores[type].setViewport({ realCount });\n this.stores[type].setStore({ count: realCount });\n }\n\n /**\n * Apply trimmed items\n * @param trimmed - trimmed items\n * @param type\n */\n setTrimmed(trimmed: Partial<Trimmed>, type: MultiDimensionType) {\n const allTrimmed = gatherTrimmedItems(trimmed);\n const dimStoreType = this.stores[type];\n dimStoreType.setStore({ trimmed: allTrimmed });\n this.viewports.stores[type].setViewPortDimensionSizes(\n dimStoreType.store.get('sizes'),\n );\n }\n\n /**\n * Sets dimension data and view port coordinate\n * @param items - data/column items\n * @param type - dimension type\n */\n setData(itemCount: number, type: MultiDimensionType, noVirtual = false) {\n this.setItemCount(itemCount, type);\n\n // Virtualization will get disabled\n if (noVirtual) {\n const dimension = this.stores[type].getCurrentState();\n this.viewports.stores[type].setViewport({\n virtualSize: dimension.realSize,\n });\n }\n this.updateViewport(type);\n }\n\n applyNewColumns(\n columns: Record<DimensionCols, ColumnRegular[]>,\n disableVirtualX: boolean,\n ) {\n for (let type of columnTypes) {\n // clear existing data\n this.stores[type].drop();\n\n const items = columns[type];\n\n // for pinned col no need virtual data\n const noVirtual = type !== 'rgCol' || disableVirtualX;\n\n // setItemCount\n this.stores[type].setStore({ count: items.length });\n\n // setCustomSizes\n const newSizes = ColumnDataProvider.getSizes(items);\n this.stores[type].setDimensionSize(newSizes);\n\n const vpUpdate: Partial<ViewportState> = {\n // this triggers drop on realCount change\n realCount: items.length,\n };\n\n // Virtualization will get disabled\n if (noVirtual) {\n vpUpdate.virtualSize = this.stores[type].getCurrentState().realSize;\n }\n\n this.viewports.stores[type].setViewport(vpUpdate);\n this.setViewPortCoordinate({\n coordinate: this.viewports.stores[type].lastCoordinate,\n type,\n });\n }\n }\n\n getFullSize(): { x: number; y: number } {\n let x = 0;\n let y = 0;\n for (let type of columnTypes) {\n x += this.stores[type]?.store.get('realSize') || 0;\n }\n for (let type of rowTypes) {\n y += this.stores[type]?.store.get('realSize') || 0;\n }\n return { y, x };\n }\n\n updateViewport(type: MultiDimensionType) {\n this.setViewPortCoordinate({\n coordinate: this.viewports.stores[type].lastCoordinate,\n type,\n });\n }\n\n setViewPortCoordinate({\n coordinate,\n type,\n }: {\n coordinate: number;\n type: MultiDimensionType;\n }) {\n const dimension = this.stores[type].getCurrentState();\n this.viewports.stores[type].setViewPortCoordinate(coordinate, dimension);\n }\n\n getViewPortPos(e: ViewPortScrollEvent): number {\n const dimension = this.stores[e.dimension].getCurrentState();\n const item = getItemByIndex(dimension, e.coordinate);\n\n return item.start;\n }\n\n setSettings(\n data: Partial<DimensionSettingsState>,\n dimensionType: DimensionType,\n ) {\n let stores: MultiDimensionType[] = [];\n switch (dimensionType) {\n case 'rgCol':\n stores = columnTypes;\n break;\n case 'rgRow':\n stores = rowTypes;\n break;\n }\n for (let s of stores) {\n this.stores[s].setStore(data);\n }\n }\n}\n","import reduce from 'lodash/reduce';\nimport { columnTypes, rowTypes, type ViewportStoreCollection, ViewportStore } from '@store';\nimport type { MultiDimensionType } from '@type';\nimport type { ViewportState } from '@type';\n\n\nexport default class ViewportProvider {\n readonly stores: ViewportStoreCollection;\n constructor() {\n this.stores = reduce(\n [...rowTypes, ...columnTypes],\n (sources: Partial<ViewportStoreCollection>, k: MultiDimensionType) => {\n sources[k] = new ViewportStore(k);\n return sources;\n },\n {},\n ) as ViewportStoreCollection;\n }\n\n setViewport(type: MultiDimensionType, data: Partial<ViewportState>) {\n this.stores[type].setViewport(data);\n }\n}\n","/**\n * Plugin module for revo-grid grid system\n * Add support for automatic column resize\n */\nimport each from 'lodash/each';\nimport reduce from 'lodash/reduce';\n\nimport { BasePlugin } from './base.plugin';\nimport ColumnDataProvider, {\n ColumnCollection,\n} from '../services/column.data.provider';\nimport { ColumnItems } from '../services/dimension.provider';\nimport { getSourceItem, columnTypes } from '@store';\nimport {\n DimensionCols,\n DimensionRows,\n ColumnRegular,\n DataType,\n InitialHeaderClick,\n ViewSettingSizeProp,\n BeforeSaveDataDetails,\n BeforeRangeSaveDataDetails,\n} from '@type';\nimport { PluginProviders } from '../';\n\ninterface Column extends ColumnRegular {\n index: number;\n}\n\ntype AutoSizeColumns = Record<DimensionCols, ColumnRecords>;\ntype ColumnRecords = Record<any, Column>;\ntype SourceSetEvent = { type: DimensionRows; source: DataType[] };\ntype EditEvent = BeforeSaveDataDetails | BeforeRangeSaveDataDetails;\ntype Resolve = (cols: Partial<AutoSizeColumns>) => void;\ntype Reject = () => void;\n\nexport type AutoSizeColumnConfig = {\n // ui behavior mode\n mode?: ColumnAutoSizeMode;\n /**\n * autoSize for all columns\n * if allColumnes true all columns treated as autoSize, worse for performance\n * false by default\n */\n allColumns?: boolean;\n /**\n * assumption per characted size\n * by default defined as 8, can be changed in this config\n */\n letterBlockSize?: number;\n /** make size calculation exact\n * by default it based on assumption each character takes some space defined in letterBlockSize */\n preciseSize?: boolean;\n};\n\nconst LETTER_BLOCK_SIZE = 7;\n\nenum ColumnAutoSizeMode {\n // increases column width on header click according the largest text value\n headerClickAutosize = 'headerClickAutoSize',\n // increases column width on data set and text edit, decreases performance\n autoSizeOnTextOverlap = 'autoSizeOnTextOverlap',\n // increases and decreases column width based on all items sizes, worst for performance\n autoSizeAll = 'autoSizeAll',\n}\n\nexport default class AutoSizeColumnPlugin extends BasePlugin {\n private autoSizeColumns: Partial<AutoSizeColumns> | null = null;\n private readonly letterBlockSize: number;\n\n /** for config option when @preciseSize enabled */\n private readonly precsizeCalculationArea: HTMLElement;\n\n /** for edge case when no columns defined before data */\n private dataResolve: Resolve | null = null;\n private dataReject: Reject | null = null;\n\n constructor(\n revogrid: HTMLRevoGridElement,\n protected providers: PluginProviders,\n private config?: AutoSizeColumnConfig,\n ) {\n super(revogrid, providers);\n this.letterBlockSize = config?.letterBlockSize || LETTER_BLOCK_SIZE;\n\n // create test container to check text width\n if (config?.preciseSize) {\n this.precsizeCalculationArea = this.initiatePresizeElement();\n revogrid.appendChild(this.precsizeCalculationArea);\n }\n\n const aftersourceset = ({\n detail: { source },\n }: CustomEvent<SourceSetEvent>) => {\n this.setSource(source);\n };\n const afteredit = ({ detail }: CustomEvent<EditEvent>) => {\n this.afteredit(detail);\n };\n const afterEditAll = ({ detail }: CustomEvent<EditEvent>) => {\n this.afterEditAll(detail);\n };\n const beforecolumnsset = ({\n detail: { columns },\n }: CustomEvent<ColumnCollection>) => {\n this.columnSet(columns);\n };\n const headerDblClick = ({ detail }: CustomEvent<InitialHeaderClick>) => {\n const type = ColumnDataProvider.getColumnType(detail.column);\n const size = this.getColumnSize(detail.index, type);\n if (size) {\n this.providers.dimension.setCustomSizes(\n type,\n {\n [detail.index]: size,\n },\n true,\n );\n }\n };\n this.addEventListener('beforecolumnsset', beforecolumnsset);\n switch (config?.mode) {\n case ColumnAutoSizeMode.autoSizeOnTextOverlap:\n this.addEventListener('aftersourceset', aftersourceset);\n this.addEventListener('afteredit', afteredit);\n break;\n case ColumnAutoSizeMode.autoSizeAll:\n this.addEventListener('aftersourceset', aftersourceset);\n this.addEventListener('afteredit', afterEditAll);\n break;\n default:\n this.addEventListener('headerdblclick', headerDblClick);\n break;\n }\n }\n\n private async setSource(source: DataType[]): Promise<void> {\n let autoSize = this.autoSizeColumns;\n if (this.dataReject) {\n this.dataReject();\n this.clearPromise();\n }\n\n /** If data set first and no column provided await until get one */\n if (!autoSize) {\n const request = new Promise((resolve: Resolve, reject: Reject) => {\n this.dataResolve = resolve;\n this.dataReject = reject;\n });\n try {\n autoSize = await request;\n } catch (e) {\n return;\n }\n }\n\n // calculate sizes\n each(autoSize, (_v, type: DimensionCols) => {\n const sizes: ViewSettingSizeProp = {};\n each(autoSize[type], rgCol => {\n // calculate size\n rgCol.size = sizes[rgCol.index] = source.reduce(\n (prev, rgRow) => Math.max(prev, this.getLength(rgRow[rgCol.prop])),\n this.getLength(rgCol.name || ''),\n );\n });\n this.providers.dimension.setCustomSizes(type, sizes, true);\n });\n }\n\n private getLength(len?: any): number {\n const padding = 15;\n if (!len) {\n return 0;\n }\n try {\n const str = len.toString();\n\n /**if exact calculation required proxy with html element, slow operation */\n if (this.config?.preciseSize) {\n this.precsizeCalculationArea.innerText = str;\n return this.precsizeCalculationArea.scrollWidth + padding * 2;\n }\n return str.length * this.letterBlockSize + padding * 2;\n } catch (e) {\n return 0;\n }\n }\n\n private afteredit(e: EditEvent) {\n let data: Record<string, DataType>;\n if (this.isRangeEdit(e)) {\n data = e.data;\n } else {\n data = { 0: { [e.prop]: e.val } };\n }\n each(this.autoSizeColumns, (columns, type: DimensionCols) => {\n const sizes: ViewSettingSizeProp = {};\n\n each(columns, rgCol => {\n // calculate size\n const size = reduce(\n data,\n (prev: number | undefined, rgRow) => {\n if (typeof rgRow[rgCol.prop] === 'undefined') {\n return prev;\n }\n return Math.max(prev || 0, this.getLength(rgRow[rgCol.prop]));\n },\n undefined,\n );\n\n if (size && rgCol.size < size) {\n rgCol.size = sizes[rgCol.index] = size;\n }\n });\n\n this.providers.dimension.setCustomSizes(type, sizes, true);\n });\n }\n\n private afterEditAll(e: EditEvent) {\n const props: Record<any, true> = {};\n if (this.isRangeEdit(e)) {\n each(e.data, r => each(r, (_v, p) => (props[p] = true)));\n } else {\n props[e.prop] = true;\n }\n each(this.autoSizeColumns, (columns, type: DimensionCols) => {\n const sizes: ViewSettingSizeProp = {};\n\n each(columns, rgCol => {\n if (props[rgCol.prop]) {\n const size = this.getColumnSize(rgCol.index, type);\n if (size) {\n sizes[rgCol.index] = size;\n }\n }\n });\n this.providers.dimension.setCustomSizes(type, sizes, true);\n });\n }\n\n private getColumnSize(index: number, type: DimensionCols): number {\n const rgCol = this.autoSizeColumns[type][index];\n if (!rgCol) {\n return 0;\n }\n return reduce(\n this.providers.data.stores,\n (r, s) => {\n const perStore = reduce(\n s.store.get('items'),\n (prev, _row, i) => {\n const item = getSourceItem(s.store, i);\n return Math.max(prev || 0, this.getLength(item[rgCol.prop]));\n },\n 0,\n );\n return Math.max(r, perStore);\n },\n rgCol.size || 0,\n );\n }\n\n private columnSet(columns: ColumnItems) {\n for (let t of columnTypes) {\n const type = t as DimensionCols;\n const cols = columns[type];\n\n for (let i in cols) {\n if (cols[i].autoSize || this.config?.allColumns) {\n if (!this.autoSizeColumns) {\n this.autoSizeColumns = {};\n }\n if (!this.autoSizeColumns[type]) {\n this.autoSizeColumns[type] = {};\n }\n this.autoSizeColumns[type][i] = {\n ...cols[i],\n index: parseInt(i, 10),\n };\n }\n }\n }\n\n if (this.dataResolve) {\n this.dataResolve(this.autoSizeColumns);\n this.clearPromise();\n }\n }\n\n private clearPromise() {\n this.dataResolve = null;\n this.dataReject = null;\n }\n\n private isRangeEdit(e: EditEvent): e is BeforeRangeSaveDataDetails {\n return !!(e as BeforeRangeSaveDataDetails).data;\n }\n\n private initiatePresizeElement(): HTMLElement {\n const styleForFontTest: Partial<CSSStyleDeclaration> = {\n position: 'absolute',\n fontSize: '14px',\n height: '0',\n width: '0',\n whiteSpace: 'nowrap',\n top: '0',\n overflowX: 'scroll',\n };\n\n const el = document.createElement('div');\n for (let s in styleForFontTest) {\n el.style[s] = styleForFontTest[s];\n }\n el.classList.add('revo-test-container');\n return el;\n }\n\n destroy() {\n super.destroy();\n this.precsizeCalculationArea?.remove();\n }\n}\n","import { LogicFunction, LogicFunctionExtraParam, LogicFunctionParam, ExtraField } from '../filter.types';\n\nconst eq: LogicFunction = (value: LogicFunctionParam, extra?: LogicFunctionExtraParam) => {\n if (typeof value === 'undefined' || (value === null && !extra)) {\n return true;\n }\n if (typeof value !== 'string') {\n value = JSON.stringify(value);\n }\n\n const filterVal = extra.toString().toLocaleLowerCase();\n if (filterVal.length === 0) {\n return true;\n }\n \n return value.toLocaleLowerCase() === filterVal;\n};\n\nexport const notEq: LogicFunction = (value: LogicFunctionParam, extra?: LogicFunctionExtraParam) => !eq(value, extra);\nnotEq.extra = 'input' as ExtraField;\neq.extra = 'input' as ExtraField;\nexport default eq;\n","import { LogicFunction, LogicFunctionExtraParam, LogicFunctionParam } from '../../filter.types';\n\nconst gtThan: LogicFunction = function (value: LogicFunctionParam, extra?: LogicFunctionExtraParam) {\n let conditionValue: number;\n\n if (typeof value === 'number') {\n conditionValue = parseFloat(extra?.toString());\n return value > conditionValue;\n }\n return false;\n};\n\ngtThan.extra = 'input';\nexport default gtThan;\n","import { LogicFunction, LogicFunctionExtraParam, LogicFunctionParam } from '../../filter.types';\nimport eq from '../equal';\nimport gt from './greaterThan';\n\nconst gtThanEq: LogicFunction = function (value: LogicFunctionParam, extra?: LogicFunctionExtraParam) {\n return eq(value, extra) || gt(value, extra);\n};\n\ngtThanEq.extra = 'input';\nexport default gtThanEq;\n","import { LogicFunction, LogicFunctionExtraParam, LogicFunctionParam } from '../../filter.types';\n\nconst lt: LogicFunction = function (value: LogicFunctionParam, extra?: LogicFunctionExtraParam) {\n let conditionValue: number;\n if (typeof value === 'number') {\n conditionValue = parseFloat(extra?.toString());\n return value < conditionValue;\n } else {\n return false;\n }\n};\n\nlt.extra = 'input';\nexport default lt;\n","import { LogicFunction, LogicFunctionExtraParam, LogicFunctionParam } from '../../filter.types';\nimport eq from '../equal';\nimport lt from './lessThan';\n\nconst lsEq: LogicFunction = function (value: LogicFunctionParam, extra?: LogicFunctionExtraParam) {\n return eq(value, extra) || lt(value, extra);\n};\n\nlsEq.extra = 'input';\nexport default lsEq;\n","import { LogicFunction, LogicFunctionParam } from '../filter.types';\n\nconst set: LogicFunction = (value: LogicFunctionParam) => !(value === '' || value === null || value === void 0);\nexport const notSet: LogicFunction = (value: LogicFunctionParam) => !set(value);\nexport default set;\n","import { LogicFunction, LogicFunctionExtraParam, LogicFunctionParam } from '../../filter.types';\n\nconst beginsWith: LogicFunction = (value: LogicFunctionParam, extra?: LogicFunctionExtraParam) => {\n if (!value) {\n return false;\n }\n if (!extra) {\n return true;\n }\n if (typeof value !== 'string') {\n value = JSON.stringify(value);\n }\n if (typeof extra !== 'string') {\n extra = JSON.stringify(extra);\n }\n return value.toLocaleLowerCase().indexOf(extra.toLocaleLowerCase()) === 0;\n};\n\nbeginsWith.extra = 'input';\nexport default beginsWith;\n","import { LogicFunction, LogicFunctionExtraParam, LogicFunctionParam } from '../../filter.types';\n\nconst contains: LogicFunction = (value: LogicFunctionParam, extra?: LogicFunctionExtraParam) => {\n if (!extra) {\n return true;\n }\n if (!value) {\n return false;\n }\n if (extra) {\n if (typeof value !== 'string') {\n value = JSON.stringify(value);\n }\n return value.toLocaleLowerCase().indexOf(extra.toString().toLowerCase()) > -1;\n }\n return true;\n};\n\nexport const notContains: LogicFunction = (value: LogicFunctionParam, extra?: LogicFunctionExtraParam) => {\n return !contains(value, extra);\n};\nnotContains.extra = 'input';\ncontains.extra = 'input';\nexport default contains;\n","import eq, { notEq } from './conditions/equal';\nimport gtThan from './conditions/number/greaterThan';\nimport gtThanEq from './conditions/number/greaterThanOrEqual';\nimport lt from './conditions/number/lessThan';\nimport lsEq from './conditions/number/lessThanOrEqual';\nimport set, { notSet } from './conditions/set';\nimport beginsWith from './conditions/string/beginswith';\nimport contains, { notContains } from './conditions/string/contains';\nimport { LogicFunction } from './filter.types';\n\nexport const filterNames = {\n none: 'None',\n empty: 'Not set',\n notEmpty: 'Set',\n\n eq: 'Equal',\n notEq: 'Not equal',\n begins: 'Begins with',\n contains: 'Contains',\n notContains: 'Does not contain',\n\n eqN: '=',\n neqN: '!=',\n gt: '>',\n gte: '>=',\n lt: '<',\n lte: '<=',\n};\n\nexport type FilterType = keyof typeof filterNames;\n\nexport const filterEntities: Record<FilterType, LogicFunction> = {\n none: () => true,\n empty: notSet,\n notEmpty: set,\n eq: eq,\n notEq: notEq,\n begins: beginsWith,\n contains: contains,\n notContains: notContains,\n\n eqN: eq,\n neqN: notEq,\n gt: gtThan,\n gte: gtThanEq,\n lt: lt,\n lte: lsEq,\n};\n\nexport const filterTypes: Record<string, FilterType[]> = {\n string: ['notEmpty', 'empty', 'eq', 'notEq', 'begins', 'contains', 'notContains'],\n number: ['notEmpty', 'empty', 'eqN', 'neqN', 'gt', 'gte', 'lt', 'lte'],\n};\n","import { h } from '@stencil/core';\nimport reduce from 'lodash/reduce';\n\nimport { BasePlugin } from '../base.plugin';\nimport { FILTER_PROP, isFilterBtn } from './filter.button';\nimport { MultiFilterItem } from './filter.pop';\nimport {\n filterEntities,\n filterNames,\n FilterType,\n filterTypes,\n} from './filter.service';\nimport { LogicFunction } from './filter.types';\nimport { ColumnProp, ColumnRegular, DataType } from '@type';\nimport { PluginProviders } from '@type';\n\ntype CustomFilter = {\n columnFilterType: string; // property defined in column filter: string/number/abstract/enum...etc\n name: string;\n func: LogicFunction;\n};\n\nexport type FilterCaptions = {\n title: string;\n save: string;\n reset: string;\n cancel: string;\n};\n\nexport type FilterLocalization = {\n captions: FilterCaptions;\n filterNames: Record<FilterType, string>;\n};\n\n/**\n * @typedef ColumnFilterConfig\n * @type {object}\n * @property {FilterCollection|undefined} collection - preserved filter data\n * @property {string[]|undefined} include - filters to be included, if defined everything else out of scope will be ignored\n * @property {Record<string, CustomFilter>|undefined} customFilters - hash map of {FilterType:CustomFilter}.\n * @property {FilterLocalization|undefined} localization - translation for filter popup captions.\n * @property {MultiFilterItem|undefined} multiFilterItems - data for multi filtering.\n * @property {boolean|undefined} disableDynamicFiltering - disables dynamic filtering.\n * A way to define your own filter types per column\n */\n/**\n * @internal\n */\nexport type ColumnFilterConfig = {\n collection?: FilterCollection;\n include?: string[];\n customFilters?: Record<string, CustomFilter>;\n filterProp?: string;\n localization?: FilterLocalization;\n multiFilterItems?: MultiFilterItem;\n disableDynamicFiltering?: boolean;\n};\ntype HeaderEvent = CustomEvent<ColumnRegular>;\ntype FilterCollectionItem = {\n filter: LogicFunction;\n type: FilterType;\n value?: any;\n};\n\nexport type FilterCollection = Record<ColumnProp, FilterCollectionItem>;\n\nexport const FILTER_TRIMMED_TYPE = 'filter';\nexport const FILTER_CONFIG_CHANGED_EVENT = 'filterconfigchanged';\n\nexport class FilterPlugin extends BasePlugin {\n private pop: HTMLRevogrFilterPanelElement;\n private filterCollection: FilterCollection = {};\n private multiFilterItems: MultiFilterItem = {};\n private possibleFilters: Record<string, string[]> = { ...filterTypes };\n private possibleFilterNames: Record<string, string> = { ...filterNames };\n private possibleFilterEntities: Record<string, LogicFunction> = {\n ...filterEntities,\n };\n private filterProp = FILTER_PROP;\n\n constructor(\n protected revogrid: HTMLRevoGridElement,\n providers: PluginProviders,\n uiid: string,\n config?: ColumnFilterConfig,\n ) {\n super(revogrid, providers);\n if (config) {\n this.initConfig(config);\n }\n\n const headerclick = (e: HeaderEvent) => this.headerclick(e);\n\n const aftersourceset = async () => {\n const filterCollectionProps = Object.keys(this.filterCollection);\n if (filterCollectionProps.length > 0) {\n // handle old way of filtering by reworking FilterCollection to new MultiFilterItem\n filterCollectionProps.forEach((prop, index) => {\n if (!this.multiFilterItems[prop]) {\n this.multiFilterItems[prop] = [\n {\n id: index,\n type: this.filterCollection[prop].type,\n value: this.filterCollection[prop].value,\n relation: 'and',\n },\n ];\n }\n });\n }\n await this.runFiltering();\n };\n this.addEventListener('headerclick', headerclick);\n this.addEventListener(\n FILTER_CONFIG_CHANGED_EVENT,\n ({ detail }: CustomEvent<ColumnFilterConfig | boolean>) => {\n if (!detail) {\n this.clearFiltering();\n return;\n }\n if (typeof detail === 'object') {\n this.initConfig(detail);\n }\n aftersourceset();\n },\n );\n this.addEventListener('aftersourceset', aftersourceset);\n this.addEventListener('filter', ({ detail }: CustomEvent) =>\n this.onFilterChange(detail),\n );\n\n const existingNodes = this.revogrid.registerVNode.filter((n) => n.$tag$ !== 'revogr-filter-panel');\n this.revogrid.registerVNode = [\n ...existingNodes,\n <revogr-filter-panel\n uuid={`filter-${uiid}`}\n filterItems={this.multiFilterItems}\n filterNames={this.possibleFilterNames}\n filterEntities={this.possibleFilterEntities}\n filterCaptions={config?.localization?.captions}\n onFilterChange={e => this.onFilterChange(e.detail)}\n disableDynamicFiltering={config?.disableDynamicFiltering}\n ref={e => (this.pop = e)}\n />,\n ];\n }\n\n private initConfig(config: ColumnFilterConfig) {\n if (config.multiFilterItems) {\n this.multiFilterItems = { ...config.multiFilterItems };\n }\n if (config.customFilters) {\n for (let cType in config.customFilters) {\n const cFilter = config.customFilters[cType];\n if (!this.possibleFilters[cFilter.columnFilterType]) {\n this.possibleFilters[cFilter.columnFilterType] = [];\n }\n this.possibleFilters[cFilter.columnFilterType].push(cType);\n this.possibleFilterEntities[cType] = cFilter.func;\n this.possibleFilterNames[cType] = cFilter.name;\n }\n }\n\n if (config.filterProp) {\n this.filterProp = config.filterProp;\n }\n\n /**\n * which filters has to be included/excluded\n * convinient way to exclude system filters\n */\n if (config.include) {\n const filters: Record<string, string[]> = {};\n\n for (let t in this.possibleFilters) {\n // validate filters, if appropriate function present\n const newTypes = this.possibleFilters[t].filter(\n f => config.include.indexOf(f) > -1,\n );\n if (newTypes.length) {\n filters[t] = newTypes;\n }\n }\n // if any valid filters provided show them\n if (Object.keys(filters).length > 0) {\n this.possibleFilters = filters;\n }\n }\n if (config.collection) {\n this.filterCollection = reduce(\n config.collection,\n (result: FilterCollection, item, prop) => {\n if (this.possibleFilterEntities[item.type]) {\n result[prop] = item;\n } else {\n console.warn(`${item.type} type is not found.`);\n }\n return result;\n },\n {},\n );\n }\n\n if (config.localization) {\n if (config.localization.filterNames) {\n Object.entries(config.localization.filterNames).forEach(([k, v]) => {\n if (this.possibleFilterNames[k] != void 0) {\n this.possibleFilterNames[k] = v;\n }\n });\n }\n }\n }\n\n private async headerclick(e: HeaderEvent) {\n const el = e.detail.originalEvent?.target as HTMLElement;\n if (!isFilterBtn(el)) {\n return;\n }\n e.preventDefault();\n\n // close if same\n const changes = await this.pop.getChanges();\n if (changes && changes?.prop === e.detail.prop) {\n this.pop.show();\n return;\n }\n\n // filter button clicked, open filter dialog\n const gridPos = this.revogrid.getBoundingClientRect();\n const buttonPos = el.getBoundingClientRect();\n const prop = e.detail.prop;\n this.pop.filterTypes = this.getColumnFilter(e.detail.filter);\n this.pop.show({\n ...this.filterCollection[prop],\n x: buttonPos.x - gridPos.x,\n y: buttonPos.y - gridPos.y + buttonPos.height,\n prop,\n });\n }\n\n private getColumnFilter(\n type?: boolean | string | string[],\n ): Record<string, string[]> {\n let filterType = 'string';\n if (!type) {\n return { [filterType]: this.possibleFilters[filterType] };\n }\n\n // if custom column filter\n if (this.isValidType(type)) {\n filterType = type;\n\n // if multiple filters applied\n } else if (typeof type === 'object' && type.length) {\n return type.reduce((r: Record<string, string[]>, multiType) => {\n if (this.isValidType(multiType)) {\n r[multiType] = this.possibleFilters[multiType];\n }\n return r;\n }, {});\n }\n return { [filterType]: this.possibleFilters[filterType] };\n }\n\n private isValidType(type: any): type is string {\n return !!(typeof type === 'string' && this.possibleFilters[type]);\n }\n\n // called on internal component change\n private async onFilterChange(filterItems: MultiFilterItem) {\n this.multiFilterItems = filterItems;\n this.runFiltering();\n }\n\n /**\n * Triggers grid filtering\n */\n async doFiltering(\n collection: FilterCollection,\n items: DataType[],\n columns: ColumnRegular[],\n filterItems: MultiFilterItem,\n ) {\n const columnsToUpdate: ColumnRegular[] = [];\n\n columns.forEach(rgCol => {\n const column = { ...rgCol };\n const hasFilter = filterItems[column.prop];\n if (column[this.filterProp] && !hasFilter) {\n delete column[this.filterProp];\n columnsToUpdate.push(column);\n }\n if (!column[this.filterProp] && hasFilter) {\n columnsToUpdate.push(column);\n column[this.filterProp] = true;\n }\n });\n const itemsToFilter = this.getRowFilter(items, filterItems);\n // check is filter event prevented\n const { defaultPrevented, detail } = this.emit('beforefiltertrimmed', {\n collection,\n itemsToFilter,\n source: items,\n filterItems,\n });\n if (defaultPrevented) {\n return;\n }\n\n // check is trimmed event prevented\n const isAddedEvent = await this.revogrid.addTrimmed(\n detail.itemsToFilter,\n FILTER_TRIMMED_TYPE,\n );\n if (isAddedEvent.defaultPrevented) {\n return;\n }\n\n // applies the hasFilter to the columns to show filter icon\n await this.revogrid.updateColumns(columnsToUpdate);\n this.emit('afterFilterApply');\n }\n\n async clearFiltering() {\n this.multiFilterItems = {};\n await this.runFiltering();\n }\n\n private async runFiltering() {\n const collection: FilterCollection = {};\n\n // handle old filterCollection to return the first filter only (if any) from multiFilterItems\n const filterProps = Object.keys(this.multiFilterItems);\n\n for (const prop of filterProps) {\n // check if we have any filter for a column\n if (this.multiFilterItems[prop].length > 0) {\n const firstFilterItem = this.multiFilterItems[prop][0];\n collection[prop] = {\n filter: filterEntities[firstFilterItem.type],\n type: firstFilterItem.type,\n value: firstFilterItem.value,\n };\n }\n }\n\n this.filterCollection = collection;\n\n const { source, columns } = await this.getData();\n const { defaultPrevented, detail } = this.emit('beforefilterapply', {\n collection: this.filterCollection,\n source,\n columns,\n filterItems: this.multiFilterItems,\n });\n if (defaultPrevented) {\n return;\n }\n this.doFiltering(\n detail.collection,\n detail.source,\n detail.columns,\n detail.filterItems,\n );\n }\n\n private async getData() {\n return {\n source: await this.revogrid.getSource(),\n columns: await this.revogrid.getColumns(),\n };\n }\n\n private getRowFilter(rows: DataType[], filterItems: MultiFilterItem) {\n const propKeys = Object.keys(filterItems);\n\n const trimmed: Record<number, boolean> = {};\n let propFilterSatisfiedCount = 0;\n let lastFilterResults: boolean[] = [];\n\n // each rows\n rows.forEach((model, rowIndex) => {\n // working on all props\n for (const prop of propKeys) {\n const propFilters = filterItems[prop];\n\n propFilterSatisfiedCount = 0;\n lastFilterResults = [];\n\n // testing each filter for a prop\n for (const [filterIndex, filterData] of propFilters.entries()) {\n // the filter LogicFunction based on the type\n const filter = this.possibleFilterEntities[filterData.type];\n\n // THE MAGIC OF FILTERING IS HERE\n if (filterData.relation === 'or') {\n lastFilterResults = [];\n if (filter(model[prop], filterData.value)) {\n continue;\n }\n propFilterSatisfiedCount++;\n } else {\n // 'and' relation will need to know the next filter\n // so we save this current filter to include it in the next filter\n lastFilterResults.push(!filter(model[prop], filterData.value));\n\n // check first if we have a filter on the next index to pair it with this current filter\n const nextFilterData = propFilters[filterIndex + 1];\n // stop the sequence if there is no next filter or if the next filter is not an 'and' relation\n if (!nextFilterData || nextFilterData.relation !== 'and') {\n // let's just continue since for sure propFilterSatisfiedCount cannot be satisfied\n if (lastFilterResults.indexOf(true) === -1) {\n lastFilterResults = [];\n continue;\n }\n\n // we need to add all of the lastFilterResults since we need to satisfy all\n propFilterSatisfiedCount += lastFilterResults.length;\n lastFilterResults = [];\n }\n }\n } // end of propFilters forEach\n\n // add to the list of removed/trimmed rows of filter condition is satisfied\n if (propFilterSatisfiedCount === propFilters.length)\n trimmed[rowIndex] = true;\n } // end of for-of propKeys\n });\n return trimmed;\n }\n}\n","var baseGetTag = require('./_baseGetTag'),\n isArray = require('./isArray'),\n isObjectLike = require('./isObjectLike');\n\n/** `Object#toString` result references. */\nvar stringTag = '[object String]';\n\n/**\n * Checks if `value` is classified as a `String` primitive or object.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a string, else `false`.\n * @example\n *\n * _.isString('abc');\n * // => true\n *\n * _.isString(1);\n * // => false\n */\nfunction isString(value) {\n return typeof value == 'string' ||\n (!isArray(value) && isObjectLike(value) && baseGetTag(value) == stringTag);\n}\n\nmodule.exports = isString;\n","var baseProperty = require('./_baseProperty');\n\n/**\n * Gets the size of an ASCII `string`.\n *\n * @private\n * @param {string} string The string inspect.\n * @returns {number} Returns the string size.\n */\nvar asciiSize = baseProperty('length');\n\nmodule.exports = asciiSize;\n","/** Used to compose unicode character classes. */\nvar rsAstralRange = '\\\\ud800-\\\\udfff',\n rsComboMarksRange = '\\\\u0300-\\\\u036f',\n reComboHalfMarksRange = '\\\\ufe20-\\\\ufe2f',\n rsComboSymbolsRange = '\\\\u20d0-\\\\u20ff',\n rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange,\n rsVarRange = '\\\\ufe0e\\\\ufe0f';\n\n/** Used to compose unicode capture groups. */\nvar rsZWJ = '\\\\u200d';\n\n/** Used to detect strings with [zero-width joiners or code points from the astral planes](http://eev.ee/blog/2015/09/12/dark-corners-of-unicode/). */\nvar reHasUnicode = RegExp('[' + rsZWJ + rsAstralRange + rsComboRange + rsVarRange + ']');\n\n/**\n * Checks if `string` contains Unicode symbols.\n *\n * @private\n * @param {string} string The string to inspect.\n * @returns {boolean} Returns `true` if a symbol is found, else `false`.\n */\nfunction hasUnicode(string) {\n return reHasUnicode.test(string);\n}\n\nmodule.exports = hasUnicode;\n","/** Used to compose unicode character classes. */\nvar rsAstralRange = '\\\\ud800-\\\\udfff',\n rsComboMarksRange = '\\\\u0300-\\\\u036f',\n reComboHalfMarksRange = '\\\\ufe20-\\\\ufe2f',\n rsComboSymbolsRange = '\\\\u20d0-\\\\u20ff',\n rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange,\n rsVarRange = '\\\\ufe0e\\\\ufe0f';\n\n/** Used to compose unicode capture groups. */\nvar rsAstral = '[' + rsAstralRange + ']',\n rsCombo = '[' + rsComboRange + ']',\n rsFitz = '\\\\ud83c[\\\\udffb-\\\\udfff]',\n rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')',\n rsNonAstral = '[^' + rsAstralRange + ']',\n rsRegional = '(?:\\\\ud83c[\\\\udde6-\\\\uddff]){2}',\n rsSurrPair = '[\\\\ud800-\\\\udbff][\\\\udc00-\\\\udfff]',\n rsZWJ = '\\\\u200d';\n\n/** Used to compose unicode regexes. */\nvar reOptMod = rsModifier + '?',\n rsOptVar = '[' + rsVarRange + ']?',\n rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*',\n rsSeq = rsOptVar + reOptMod + rsOptJoin,\n rsSymbol = '(?:' + [rsNonAstral + rsCombo + '?', rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') + ')';\n\n/** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */\nvar reUnicode = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g');\n\n/**\n * Gets the size of a Unicode `string`.\n *\n * @private\n * @param {string} string The string inspect.\n * @returns {number} Returns the string size.\n */\nfunction unicodeSize(string) {\n var result = reUnicode.lastIndex = 0;\n while (reUnicode.test(string)) {\n ++result;\n }\n return result;\n}\n\nmodule.exports = unicodeSize;\n","var asciiSize = require('./_asciiSize'),\n hasUnicode = require('./_hasUnicode'),\n unicodeSize = require('./_unicodeSize');\n\n/**\n * Gets the number of symbols in `string`.\n *\n * @private\n * @param {string} string The string to inspect.\n * @returns {number} Returns the string size.\n */\nfunction stringSize(string) {\n return hasUnicode(string)\n ? unicodeSize(string)\n : asciiSize(string);\n}\n\nmodule.exports = stringSize;\n","var baseKeys = require('./_baseKeys'),\n getTag = require('./_getTag'),\n isArrayLike = require('./isArrayLike'),\n isString = require('./isString'),\n stringSize = require('./_stringSize');\n\n/** `Object#toString` result references. */\nvar mapTag = '[object Map]',\n setTag = '[object Set]';\n\n/**\n * Gets the size of `collection` by returning its length for array-like\n * values or the number of own enumerable string keyed properties for objects.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Collection\n * @param {Array|Object|string} collection The collection to inspect.\n * @returns {number} Returns the collection size.\n * @example\n *\n * _.size([1, 2, 3]);\n * // => 3\n *\n * _.size({ 'a': 1, 'b': 2 });\n * // => 2\n *\n * _.size('pebbles');\n * // => 7\n */\nfunction size(collection) {\n if (collection == null) {\n return 0;\n }\n if (isArrayLike(collection)) {\n return isString(collection) ? stringSize(collection) : collection.length;\n }\n var tag = getTag(collection);\n if (tag == mapTag || tag == setTag) {\n return collection.size;\n }\n return baseKeys(collection).length;\n}\n\nmodule.exports = size;\n","import size from 'lodash/size';\nimport debounce from 'lodash/debounce';\nimport range from 'lodash/range';\n\nimport { setStore } from '../../utils/store.utils';\nimport ColumnDataProvider from '../../services/column.data.provider';\nimport { BasePlugin } from '../base.plugin';\nimport {\n ColumnProp,\n Order,\n CellCompareFunc,\n ColumnRegular,\n InitialHeaderClick,\n DataType,\n DimensionRows,\n PluginProviders,\n} from '@type';\n\nexport type SortingOrder = Record<ColumnProp, Order>;\ntype SortingOrderFunction = Record<ColumnProp, CellCompareFunc | undefined>;\ntype ColumnSetEvent = {\n order: SortingOrder;\n};\n\n/**\n * Lifecycle\n * 1. @event `beforesorting` - Triggered when sorting just starts. Nothing has happened yet. This can be triggered from a column or from the source. If the type is from rows, the column will be undefined.\n * 2. @method `updateColumnSorting` - Updates the column sorting icon on the grid and the column itself, but the data remains untouched.\n * 3. @event `beforesortingapply` - Triggered before the sorting data is applied to the data source. You can prevent this event, and the data will not be sorted. This event is only called from a column sorting click.\n * 4. @event `aftersortingapply` - Triggered after sorting has been applied and completed. This event occurs for both row and column sorting.\n *\n * Note: If you prevent an event, it will not proceed to the subsequent steps.\n */\n\nexport default class SortingPlugin extends BasePlugin {\n // sorting order per column\n private sorting: SortingOrder | null = null;\n\n // sorting function per column, multiple columns sorting supported\n private sortingFunc: SortingOrderFunction | null = null;\n private sortingPromise: (() => void) | null = null;\n private postponeSort = debounce(\n async (order: SortingOrder, comparison: SortingOrderFunction) =>\n this.runSorting(order, comparison),\n 50,\n );\n\n private async runSorting(\n order: SortingOrder,\n comparison: SortingOrderFunction,\n ) {\n await this.sort(order, comparison);\n this.sortingPromise?.();\n this.sortingPromise = null;\n }\n\n constructor(\n protected revogrid: HTMLRevoGridElement,\n providers: PluginProviders,\n ) {\n super(revogrid, providers);\n\n const beforeanysource = async ({\n detail: { type },\n }: CustomEvent<{\n type: DimensionRows;\n source: any[];\n }>) => {\n // if sorting was provided - sort data\n if (!!this.sorting && this.sortingFunc) {\n const beforeEvent = this.emit('beforesorting', { type });\n if (beforeEvent.defaultPrevented) {\n return;\n }\n this.startSorting(this.sorting, this.sortingFunc);\n }\n };\n const aftercolumnsset = async ({\n detail: { order },\n }: CustomEvent<ColumnSetEvent>) => {\n const columns = await this.revogrid.getColumns();\n const sortingFunc: SortingOrderFunction = {};\n\n for (let prop in order) {\n const cmp = this.getComparer(\n ColumnDataProvider.getColumnByProp(columns, prop),\n order[prop],\n );\n sortingFunc[prop] = cmp;\n }\n this.runSorting(order, sortingFunc);\n };\n const headerclick = async (e: CustomEvent<InitialHeaderClick>) => {\n if (e.defaultPrevented) {\n return;\n }\n\n if (!e.detail.column.sortable) {\n return;\n }\n\n this.headerclick(\n e.detail.column,\n e.detail.index,\n e.detail?.originalEvent?.shiftKey,\n );\n };\n\n this.addEventListener('beforeanysource', beforeanysource);\n this.addEventListener('aftercolumnsset', aftercolumnsset);\n this.addEventListener('beforeheaderclick', headerclick);\n }\n\n private startSorting(order: SortingOrder, sortingFunc: SortingOrderFunction) {\n if (!this.sortingPromise) {\n this.revogrid.jobsBeforeRender.push(\n new Promise<void>(resolve => {\n this.sortingPromise = resolve;\n }),\n );\n }\n this.postponeSort(order, sortingFunc);\n }\n\n private getComparer(column: ColumnRegular, order: Order): CellCompareFunc {\n const cellCmp: CellCompareFunc =\n column?.cellCompare?.bind({ order }) || this.defaultCellCompare;\n if (order == 'asc') {\n return cellCmp;\n }\n if (order == 'desc') {\n return this.descCellCompare(cellCmp);\n }\n return undefined;\n }\n\n /**\n * Apply sorting to data on header click\n * If additive - add to existing sorting, multiple columns can be sorted\n */\n async headerclick(column: ColumnRegular, index: number, additive: boolean) {\n let order: Order = this.getNextOrder(column.order);\n const beforeEvent = this.emit('beforesorting', { column, order, additive });\n if (beforeEvent.defaultPrevented) {\n return;\n }\n order = beforeEvent.detail.order;\n const newCol = await this.revogrid.updateColumnSorting(\n beforeEvent.detail.column,\n index,\n order,\n additive,\n );\n\n // apply sort data\n const beforeApplyEvent = this.emit('beforesortingapply', {\n column: newCol,\n order,\n additive,\n });\n if (beforeApplyEvent.defaultPrevented) {\n return;\n }\n order = beforeApplyEvent.detail.order;\n const cmp = this.getComparer(column, order);\n\n if (additive && this.sorting) {\n const sorting: SortingOrder = {};\n const sortingFunc: SortingOrderFunction = {};\n\n this.sorting = {\n ...this.sorting,\n ...sorting,\n };\n // extend sorting function with new sorting for multiple columns sorting\n this.sortingFunc = {\n ...this.sortingFunc,\n ...sortingFunc,\n };\n\n if (column.prop in sorting && size(sorting) > 1 && order === undefined) {\n delete sorting[column.prop];\n delete sortingFunc[column.prop];\n } else {\n sorting[column.prop] = order;\n sortingFunc[column.prop] = cmp;\n }\n } else {\n if (order) {\n // reset sorting\n this.sorting = { [column.prop]: order };\n this.sortingFunc = { [column.prop]: cmp };\n } else {\n delete this.sorting[column.prop];\n delete this.sortingFunc[column.prop];\n }\n }\n\n this.startSorting(this.sorting, this.sortingFunc);\n }\n\n /**\n * Sort items by sorting function\n * @requires proxyItems applied to row store\n * @requires source applied to row store\n *\n * @param sorting - per column sorting\n * @param data - this.stores['rgRow'].store.get('source')\n */\n async sort(\n sorting: SortingOrder,\n sortingFunc: SortingOrderFunction,\n types: DimensionRows[] = ['rgRow', 'rowPinStart', 'rowPinEnd'],\n ) {\n // if no sorting - reset\n if (!size(sorting)) {\n this.sorting = null;\n this.sortingFunc = null;\n\n for (let type of types) {\n const store = await this.revogrid.getSourceStore(type);\n // row data\n const source = store.get('source');\n // row indexes\n const proxyItems = range(0, source.length);\n setStore(store, {\n proxyItems,\n source: [...source],\n });\n }\n } else {\n // set sorting\n this.sorting = sorting;\n this.sortingFunc = sortingFunc;\n\n // by default it'll sort by rgRow store\n // todo: support multiple stores\n for (let type of types) {\n const store = await this.revogrid.getSourceStore(type);\n // row data\n const source = store.get('source');\n // row indexes\n const proxyItems = store.get('proxyItems');\n const data = this.sortIndexByItems(\n [...proxyItems],\n source,\n sortingFunc,\n );\n setStore(store, {\n proxyItems: data,\n source: [...source],\n });\n }\n }\n this.emit('aftersortingapply');\n }\n\n defaultCellCompare(prop: ColumnProp, a: DataType, b: DataType) {\n const av = a[prop]?.toString().toLowerCase();\n const bv = b[prop]?.toString().toLowerCase();\n\n return av == bv ? 0 : av > bv ? 1 : -1;\n }\n\n descCellCompare(cmp: CellCompareFunc) {\n return (prop: ColumnProp, a: DataType, b: DataType): number => {\n return -1 * cmp(prop, a, b);\n };\n }\n\n sortIndexByItems(\n indexes: number[],\n source: DataType[],\n sortingFunc: SortingOrderFunction,\n ): number[] {\n // if no sorting - return unsorted indexes\n if (Object.entries(sortingFunc).length === 0) {\n // Unsort indexes\n return [...Array(indexes.length).keys()];\n }\n //\n /**\n * go through all indexes and align in new order\n * performs a multi-level sorting by applying multiple comparison functions to determine the order of the items based on different properties.\n */\n return indexes.sort((a, b) => {\n for (const [prop, cmp] of Object.entries(sortingFunc)) {\n const itemA = source[a];\n const itemB = source[b];\n\n /**\n * If the comparison function returns a non-zero value (sorted), it means that the items should be sorted based on the given property. In such a case, the function immediately returns the sorted value, indicating the order in which the items should be arranged.\n * If none of the comparison functions result in a non-zero value, indicating that the items are equal or should remain in the same order, the function eventually returns 0.\n */\n const sorted = cmp(prop, itemA, itemB);\n if (sorted) {\n return sorted;\n }\n }\n return 0;\n });\n }\n\n getNextOrder(currentOrder: Order): Order {\n switch (currentOrder) {\n case undefined:\n return 'asc';\n case 'asc':\n return 'desc';\n case 'desc':\n return undefined;\n }\n }\n}\n","/**\n * The base implementation of `_.clamp` which doesn't coerce arguments.\n *\n * @private\n * @param {number} number The number to clamp.\n * @param {number} [lower] The lower bound.\n * @param {number} upper The upper bound.\n * @returns {number} Returns the clamped number.\n */\nfunction baseClamp(number, lower, upper) {\n if (number === number) {\n if (upper !== undefined) {\n number = number <= upper ? number : upper;\n }\n if (lower !== undefined) {\n number = number >= lower ? number : lower;\n }\n }\n return number;\n}\n\nmodule.exports = baseClamp;\n","var baseClamp = require('./_baseClamp'),\n toInteger = require('./toInteger');\n\n/** Used as references for the maximum length and index of an array. */\nvar MAX_ARRAY_LENGTH = 4294967295;\n\n/**\n * Converts `value` to an integer suitable for use as the length of an\n * array-like object.\n *\n * **Note:** This method is based on\n * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to convert.\n * @returns {number} Returns the converted integer.\n * @example\n *\n * _.toLength(3.2);\n * // => 3\n *\n * _.toLength(Number.MIN_VALUE);\n * // => 0\n *\n * _.toLength(Infinity);\n * // => 4294967295\n *\n * _.toLength('3.2');\n * // => 3\n */\nfunction toLength(value) {\n return value ? baseClamp(toInteger(value), 0, MAX_ARRAY_LENGTH) : 0;\n}\n\nmodule.exports = toLength;\n","var toInteger = require('./toInteger'),\n toLength = require('./toLength');\n\n/**\n * The base implementation of `_.fill` without an iteratee call guard.\n *\n * @private\n * @param {Array} array The array to fill.\n * @param {*} value The value to fill `array` with.\n * @param {number} [start=0] The start position.\n * @param {number} [end=array.length] The end position.\n * @returns {Array} Returns `array`.\n */\nfunction baseFill(array, value, start, end) {\n var length = array.length;\n\n start = toInteger(start);\n if (start < 0) {\n start = -start > length ? 0 : (length + start);\n }\n end = (end === undefined || end > length) ? length : toInteger(end);\n if (end < 0) {\n end += length;\n }\n end = start > end ? 0 : toLength(end);\n while (start < end) {\n array[start++] = value;\n }\n return array;\n}\n\nmodule.exports = baseFill;\n","var baseFill = require('./_baseFill'),\n isIterateeCall = require('./_isIterateeCall');\n\n/**\n * Fills elements of `array` with `value` from `start` up to, but not\n * including, `end`.\n *\n * **Note:** This method mutates `array`.\n *\n * @static\n * @memberOf _\n * @since 3.2.0\n * @category Array\n * @param {Array} array The array to fill.\n * @param {*} value The value to fill `array` with.\n * @param {number} [start=0] The start position.\n * @param {number} [end=array.length] The end position.\n * @returns {Array} Returns `array`.\n * @example\n *\n * var array = [1, 2, 3];\n *\n * _.fill(array, 'a');\n * console.log(array);\n * // => ['a', 'a', 'a']\n *\n * _.fill(Array(3), 2);\n * // => [2, 2, 2]\n *\n * _.fill([4, 6, 8, 10], '*', 1, 3);\n * // => [4, '*', '*', 10]\n */\nfunction fill(array, value, start, end) {\n var length = array == null ? 0 : array.length;\n if (!length) {\n return [];\n }\n if (start && typeof start != 'number' && isIterateeCall(array, value, start)) {\n start = 0;\n end = length;\n }\n return baseFill(array, value, start, end);\n}\n\nmodule.exports = fill;\n","import { getGroupingName, isGrouping } from '../groupingRow/grouping.service';\nimport { CSVFormat, DataInput, Formatter } from './types';\n\nconst INITIAL: CSVFormat = {\n mime: 'text/csv',\n fileKind: 'csv',\n // BOM signature\n bom: true,\n columnDelimiter: ',',\n rowDelimiter: '\\r\\n',\n encoding: '',\n};\n\nexport type CSVFormatter = (options: Partial<CSVFormat>, data: DataInput) => string;\n\n// The ASCII character code 13 is called a Carriage Return or CR.\nconst CARRIAGE_RETURN = String.fromCharCode(13);\n// Chr(13) followed by a Chr(10) that compose a proper CRLF.\nconst LINE_FEED = String.fromCharCode(10);\nconst DOUBLE_QT = String.fromCharCode(34);\nconst NO_BREAK_SPACE = String.fromCharCode(0xfeff);\nconst escapeRegex = new RegExp('\"', 'g');\n\nexport default class ExportCsv implements Formatter {\n readonly options: Readonly<CSVFormat>;\n constructor(options: Partial<CSVFormat> = {}) {\n this.options = { ...INITIAL, ...options };\n }\n\n doExport({ data, headers, props }: DataInput) {\n let result = this.options.bom ? NO_BREAK_SPACE : '';\n\n // any header\n if (headers?.length > 0) {\n headers.forEach(header => {\n // ignore empty\n if (!header.length) {\n return;\n }\n result += this.prepareHeader(header, this.options.columnDelimiter);\n result += this.options.rowDelimiter;\n });\n }\n\n data.forEach((rgRow, index) => {\n if (index > 0) {\n result += this.options.rowDelimiter;\n }\n // support grouping\n if (isGrouping(rgRow)) {\n result += this.parseCell(getGroupingName(rgRow), this.options.columnDelimiter);\n return;\n }\n result += props.map(p => this.parseCell(rgRow[p], this.options.columnDelimiter)).join(this.options.columnDelimiter);\n });\n\n return result;\n }\n\n private prepareHeader(columnHeaders: string[], columnDelimiter: string) {\n let result = '';\n const newColumnHeaders = columnHeaders.map(v => this.parseCell(v, columnDelimiter, true));\n result += newColumnHeaders.join(columnDelimiter);\n return result;\n }\n\n private parseCell(value: any, columnDelimiter: string, force = false) {\n let escape = value;\n if (typeof value !== 'string') {\n escape = JSON.stringify(value);\n }\n const toEscape = [CARRIAGE_RETURN, DOUBLE_QT, LINE_FEED, columnDelimiter];\n if (typeof escape === 'undefined') {\n return '';\n }\n if (escape !== '' && (force || toEscape.some(i => escape.indexOf(i) >= 0))) {\n return `\"${escape.replace(escapeRegex, '\"\"')}\"`;\n }\n\n return escape;\n }\n}\n","import fill from 'lodash/fill';\nimport { columnTypes, rowTypes, Group, Groups } from '@store';\n\nimport { timeout } from '../../utils';\nimport { BasePlugin } from '../base.plugin';\nimport ExportCsv from './csv';\nimport { ColSource, CSVFormat, DataInput, Formatter } from './types';\nimport { DimensionCols, ColumnProp, DataType } from '@type';\n\nenum ExportTypes {\n csv = 'csv',\n}\n\nexport type ExportFormat = Partial<CSVFormat>;\n\nexport default class ExportFilePlugin extends BasePlugin {\n /** Exports string */\n async exportString(options: ExportFormat = {}, t: ExportTypes = ExportTypes.csv) {\n const data = await this.beforeexport();\n if (!data) {\n return null;\n }\n return this.formatter(t, options).doExport(data);\n }\n\n /** Exports Blob */\n async exportBlob(options: ExportFormat = {}, t: ExportTypes = ExportTypes.csv) {\n return await this.getBlob(this.formatter(t, options));\n }\n\n /** Export file */\n async exportFile(options: ExportFormat = {}, t: ExportTypes = ExportTypes.csv) {\n const formatter = this.formatter(t, options);\n const blob = await this.getBlob(formatter);\n\n // url\n const URL = window.URL || window.webkitURL;\n\n const a = document.createElement('a');\n const { filename, fileKind } = formatter.options;\n const name = `${filename}.${fileKind}`;\n const url = URL.createObjectURL(blob);\n\n a.style.display = 'none';\n a.setAttribute('href', url);\n a.setAttribute('download', name);\n this.revogrid.appendChild(a);\n a.dispatchEvent(new MouseEvent('click'));\n this.revogrid.removeChild(a);\n\n // delay for revoke, correct for some browsers\n await timeout(120);\n URL.revokeObjectURL(url);\n }\n\n /** Blob object */\n async getBlob(formatter: Formatter) {\n const type = `${formatter.options.mime};charset=${formatter.options.encoding}`;\n if (typeof Blob !== 'undefined') {\n const data = await this.beforeexport();\n if (!data) {\n return null;\n }\n return new Blob([formatter.doExport(data)], { type });\n }\n return null;\n }\n\n // before event\n private async beforeexport() {\n let data = await this.getData();\n const event: CustomEvent<{ data: DataInput }> = this.emit('beforeexport', { data });\n if (event.defaultPrevented) {\n return null;\n }\n return event.detail.data;\n }\n\n private async getData(): Promise<DataInput> {\n const data = await this.getSource();\n const colSource: ColSource[] = [];\n const colPromises: Promise<ColSource>[] = [];\n columnTypes.forEach((t, i) => {\n colPromises.push(this.getColPerSource(t).then(s => (colSource[i] = s)));\n });\n await Promise.all(colPromises);\n const columns: ColSource = {\n headers: [],\n props: [],\n };\n for (let source of colSource) {\n source.headers.forEach((h, i) => {\n if (!columns.headers[i]) {\n columns.headers[i] = [];\n }\n columns.headers[i].push(...h);\n });\n columns.props.push(...source.props);\n }\n return {\n data,\n ...columns,\n };\n }\n\n private async getColPerSource(t: DimensionCols) {\n const store = await this.revogrid.getColumnStore(t);\n const source = store.get('source');\n const virtualIndexes = store.get('items');\n const depth = store.get('groupingDepth');\n const groups = store.get('groups');\n const colNames: string[] = [];\n const colProps: ColumnProp[] = [];\n const visibleItems = virtualIndexes.reduce((r: Record<string, number>, v: number, virtualIndex: number) => {\n const prop = source[v].prop;\n colNames.push(source[v].name || '');\n colProps.push(prop);\n r[prop] = virtualIndex;\n return r;\n }, {});\n const rows: string[][] = this.getGroupHeaders(depth, groups, virtualIndexes, visibleItems);\n rows.push(colNames);\n return {\n headers: rows,\n props: colProps,\n };\n }\n\n private getGroupHeaders(depth: number, groups: Groups, items: number[], visibleItems: Record<string, number>) {\n const rows: string[][] = [];\n const template = fill(new Array(items.length), '');\n for (let d = 0; d < depth; d++) {\n const rgRow = [...template];\n rows.push(rgRow);\n if (!groups[d]) {\n continue;\n }\n const levelGroups = groups[d];\n\n // add names of groups\n levelGroups.forEach((group: Group) => {\n const minIndex = this.findGroupStartIndex(group.ids, visibleItems);\n if (typeof minIndex === 'number') {\n rgRow[minIndex] = group.name;\n }\n });\n }\n return rows;\n }\n\n private findGroupStartIndex(ids: (string | number)[], visibleItems: Record<string, number>): number | undefined {\n let min: number | undefined;\n ids.forEach(id => {\n const current = visibleItems[id];\n if (typeof current === 'number') {\n if (typeof min !== 'number' || min > current) {\n min = current;\n }\n }\n });\n return min;\n }\n\n private async getSource() {\n const data: DataType[][] = [];\n const promisesData: Promise<number>[] = [];\n rowTypes.forEach(t => {\n const dataPart: DataType[] = [];\n data.push(dataPart);\n const promise = this.revogrid.getVisibleSource(t).then((d: DataType[]) => dataPart.push(...d));\n promisesData.push(promise);\n });\n await Promise.all(promisesData);\n return data.reduce((r, v) => {\n r.push(...v);\n return r;\n }, []);\n }\n\n // get correct class for future multiple types support\n private formatter(type: ExportTypes, options: ExportFormat = {}) {\n switch (type) {\n case ExportTypes.csv:\n return new ExportCsv(options);\n default:\n throw new Error('Unknown format');\n }\n }\n}\n","import { DataType } from '@type';\nimport { PSEUDO_GROUP_ITEM_ID, PSEUDO_GROUP_ITEM_VALUE, GROUP_EXPANDED, GROUP_DEPTH } from './grouping.const';\nimport { isGrouping, getParsedGroup, isSameGroup } from './grouping.service';\n\n// provide collapse data\nexport function doCollapse(pIndex: number, source: DataType[]) {\n const model = source[pIndex];\n const collapseValue = model[PSEUDO_GROUP_ITEM_VALUE];\n const trimmed: Record<number, boolean> = {};\n let i = pIndex + 1;\n const total = source.length;\n while (i < total) {\n const currentModel = source[i];\n if (isGrouping(currentModel)) {\n const currentValue = currentModel[PSEUDO_GROUP_ITEM_VALUE];\n if (!currentValue.length || !currentValue.startsWith(collapseValue + ',')) {\n break;\n }\n currentModel[GROUP_EXPANDED] = false;\n }\n trimmed[i++] = true;\n }\n model[GROUP_EXPANDED] = false;\n return { trimmed };\n}\n\n/**\n *\n * @param pIndex - physical index\n * @param vIndex - virtual index, need to update item collection\n * @param source - data source\n * @param rowItemsIndexes - rgRow indexes\n */\nexport function doExpand(vIndex: number, source: DataType[], rowItemsIndexes: number[]) {\n const physicalIndex = rowItemsIndexes[vIndex];\n const model = source[physicalIndex];\n const currentGroup = getParsedGroup(model[PSEUDO_GROUP_ITEM_ID]);\n const trimmed: Record<number, boolean> = {};\n\n // no group found\n if (!currentGroup) {\n return { trimmed };\n }\n\n const groupItems: number[] = [];\n model[GROUP_EXPANDED] = true;\n let i = physicalIndex + 1;\n const total = source.length;\n let groupLevelOnly = 0;\n\n // go through all rows\n while (i < total) {\n const currentModel = source[i];\n const isGroup = isGrouping(currentModel);\n // group found\n if (isGroup) {\n if (!isSameGroup(currentGroup, model, currentModel)) {\n break;\n } else if (!groupLevelOnly) {\n // if get group first it's group only level\n groupLevelOnly = currentModel[GROUP_DEPTH];\n }\n }\n // level 0 or same depth\n if (!groupLevelOnly || (isGroup && groupLevelOnly === currentModel[GROUP_DEPTH])) {\n trimmed[i] = false;\n groupItems.push(i);\n }\n i++;\n }\n const result: {\n trimmed: Record<number, boolean>;\n items?: number[];\n } = {\n trimmed,\n };\n if (groupItems.length) {\n const items = [...rowItemsIndexes];\n items.splice(vIndex + 1, 0, ...groupItems);\n result.items = items;\n }\n return result;\n}\n","import { gatherTrimmedItems, Trimmed, TrimmedEntity } from '@store';\n\nexport const TRIMMED_GROUPING = 'grouping';\n\n/**\n * Prepare trimming updated indexes for grouping\n * @param initiallyTrimed\n * @param firstLevelMap\n * @param secondLevelMap\n */\nexport function processDoubleConversionTrimmed(initiallyTrimed: Trimmed, firstLevelMap: Record<number, number>, secondLevelMap?: Record<number, number>) {\n const trimemedOptionsToUpgrade: Trimmed = {};\n /**\n * go through all groups except grouping\n */\n for (let type in initiallyTrimed) {\n if (type === TRIMMED_GROUPING) {\n continue;\n }\n const items = initiallyTrimed[type];\n const newItems: TrimmedEntity = {};\n\n for (let initialIndex in items) {\n /**\n * if item exists we find it in collection\n * we support 2 level of conversions\n */\n let newConversionIndex = firstLevelMap[initialIndex];\n if (secondLevelMap) {\n newConversionIndex = secondLevelMap[newConversionIndex];\n }\n\n /**\n * if item was trimmed previously\n * trimming makes sense to apply\n */\n if (items[initialIndex]) {\n newItems[newConversionIndex] = true;\n /**\n * If changes present apply changes to new source\n */\n if (newConversionIndex !== parseInt(initialIndex, 10)) {\n trimemedOptionsToUpgrade[type] = newItems;\n }\n }\n }\n }\n return trimemedOptionsToUpgrade;\n}\n\nexport function filterOutEmptyGroups(allTrimmedGroups: Trimmed, childrenByGroup: Record<number, number[]> = {}) {\n const trimmedGroup: TrimmedEntity = {};\n const allTrimmed = gatherTrimmedItems(allTrimmedGroups);\n // find is groups are filled\n for (let groupIndex in childrenByGroup) {\n const hasChidlren = childrenByGroup[groupIndex].filter(childIndex => !allTrimmed[childIndex]).length > 0;\n if (!hasChidlren) {\n trimmedGroup[groupIndex] = true;\n }\n }\n return trimmedGroup;\n}\n","import { ColumnCollection } from '../../services/column.data.provider';\nimport { getPhysical, setItems, columnTypes, TrimmedEntity, DSourceState } from '@store';\nimport { BasePlugin } from '../base.plugin';\nimport { FILTER_TRIMMED_TYPE } from '../filter/filter.plugin';\nimport {\n GROUPING_ROW_TYPE,\n GROUP_EXPANDED,\n GROUP_EXPAND_EVENT,\n PSEUDO_GROUP_COLUMN,\n PSEUDO_GROUP_ITEM_VALUE,\n} from './grouping.const';\nimport { doExpand, doCollapse } from './grouping.row.expand.service';\nimport {\n BeforeSourceSetEvent,\n GroupingOptions,\n OnExpandEvent,\n SourceGather,\n} from './grouping.row.types';\nimport {\n ExpandedOptions,\n gatherGrouping,\n isGrouping,\n isGroupingColumn,\n} from './grouping.service';\nimport {\n processDoubleConversionTrimmed,\n TRIMMED_GROUPING,\n} from './grouping.trimmed.service';\nimport { BeforeSaveDataDetails, ColumnRegular, DataType, DimensionRows, PluginProviders } from '@type';\nimport { Observable } from '../../utils/store.utils';\n\nexport default class GroupingRowPlugin extends BasePlugin {\n private options: GroupingOptions | undefined;\n\n get hasProps() {\n return this.options?.props && this.options?.props?.length;\n }\n\n get store(): Observable<DSourceState<DataType, DimensionRows>> {\n return this.providers.data.stores[GROUPING_ROW_TYPE].store;\n }\n\n // proxy for items get\n get rowItems() {\n return this.store.get('items');\n }\n\n get trimmed() {\n return this.store.get('trimmed');\n }\n\n constructor(\n protected revogrid: HTMLRevoGridElement,\n protected providers: PluginProviders,\n ) {\n super(revogrid, providers);\n }\n\n // befoce cell focus\n private onFocus(e: CustomEvent<BeforeSaveDataDetails>) {\n if (isGrouping(e.detail.model)) {\n e.preventDefault();\n }\n }\n\n // expand event triggered\n private onExpand({ virtualIndex }: OnExpandEvent) {\n const { source } = this.getSource();\n let newTrimmed = this.trimmed[TRIMMED_GROUPING];\n\n let i = getPhysical(this.store, virtualIndex);\n const model = source[i];\n const prevExpanded = model[GROUP_EXPANDED];\n if (!prevExpanded) {\n const { trimmed, items } = doExpand(virtualIndex, source, this.rowItems);\n newTrimmed = { ...newTrimmed, ...trimmed };\n if (items) {\n setItems(this.store, items);\n }\n } else {\n const { trimmed } = doCollapse(i, source);\n newTrimmed = { ...newTrimmed, ...trimmed };\n this.revogrid.clearFocus();\n }\n\n this.store.set('source', source);\n this.revogrid.addTrimmed(newTrimmed, TRIMMED_GROUPING);\n }\n\n // get source based on proxy item collection to preserve rgRow order\n private getSource(withoutGrouping = false) {\n const source = this.store.get('source');\n const items = this.store.get('proxyItems');\n let index = 0;\n // order important here, expected parent is first, then others\n return items.reduce(\n (result: SourceGather, i) => {\n const model = source[i];\n if (!withoutGrouping) {\n result.source.push(model);\n return result;\n }\n\n // grouping filter\n if (!isGrouping(model)) {\n result.source.push(model);\n result.oldNewIndexes[i] = index;\n index++;\n } else {\n if (model[GROUP_EXPANDED]) {\n result.prevExpanded[model[PSEUDO_GROUP_ITEM_VALUE]] = true;\n }\n }\n return result;\n },\n {\n source: [],\n prevExpanded: {},\n oldNewIndexes: {},\n },\n );\n }\n\n private setColumnGrouping(cols?: ColumnRegular[]) {\n // if 0 column as holder\n if (cols?.length) {\n cols[0][PSEUDO_GROUP_COLUMN] = true;\n return true;\n }\n return false;\n }\n\n private setColumns({ columns }: ColumnCollection) {\n for (let type of columnTypes) {\n if (this.setColumnGrouping(columns[type])) {\n break;\n }\n }\n }\n\n // evaluate drag between groups\n private onDrag(e: CustomEvent<{ from: number; to: number }>) {\n const { from, to } = e.detail;\n const isDown = to - from >= 0;\n const { source } = this.getSource();\n const items = this.rowItems;\n let i = isDown ? from : to;\n const end = isDown ? to : from;\n for (; i < end; i++) {\n const model = source[items[i]];\n const isGroup = isGrouping(model);\n if (isGroup) {\n e.preventDefault();\n return;\n }\n }\n }\n\n private beforeTrimmedApply(trimmed: Record<number, boolean>, type: string) {\n /** Before filter apply remove grouping filtering */\n if (type === FILTER_TRIMMED_TYPE) {\n const source = this.store.get('source');\n for (let index in trimmed) {\n if (trimmed[index] && isGrouping(source[index])) {\n trimmed[index] = false;\n }\n }\n }\n }\n\n // subscribe to grid events to process them accordingly\n private subscribe() {\n /** if grouping present and new data source arrived */\n this.addEventListener(\n 'beforesourceset',\n ({ detail }: CustomEvent<BeforeSourceSetEvent>) => this.onDataSet(detail),\n );\n this.addEventListener(\n 'beforecolumnsset',\n ({ detail }: CustomEvent<ColumnCollection>) => this.setColumns(detail),\n );\n\n /**\n * filter applied need to clear grouping and apply again\n * based on new results can be new grouping\n */\n this.addEventListener(\n 'beforetrimmed',\n ({ detail: { trimmed, trimmedType } }) =>\n this.beforeTrimmedApply(trimmed, trimmedType),\n );\n /**\n * sorting applied need to clear grouping and apply again\n * based on new results whole grouping order will changed\n */\n this.addEventListener('aftersortingapply', () =>\n this.doSourceUpdate({ ...this.options }),\n );\n\n /**\n * Apply logic for focus inside of grouping\n * We can't focus on grouping rows, navigation only inside of groups for now\n */\n this.addEventListener('beforecellfocus', e => this.onFocus(e));\n /**\n * Prevent rgRow drag outside the group\n */\n this.addEventListener('roworderchanged', e => this.onDrag(e));\n\n /**\n * When grouping expand icon was clicked\n */\n this.addEventListener(\n GROUP_EXPAND_EVENT,\n ({ detail }: CustomEvent<OnExpandEvent>) => this.onExpand(detail),\n );\n }\n\n /**\n * Starts global source update with group clearing and applying new one\n * Initiated when need to reapply grouping\n */\n private doSourceUpdate(options?: ExpandedOptions) {\n if (!this.hasProps) {\n return;\n }\n /**\n * Get source without grouping\n * @param newOldIndexMap - provides us mapping with new indexes vs old indexes, we would use it for trimmed mapping\n */\n const { source, prevExpanded, oldNewIndexes } = this.getSource(true);\n /**\n * Group again\n * @param oldNewIndexMap - provides us mapping with new indexes vs old indexes\n */\n const {\n sourceWithGroups,\n depth,\n trimmed,\n oldNewIndexMap,\n childrenByGroup,\n } = gatherGrouping(source, this.options?.props || [], {\n prevExpanded,\n ...options,\n });\n\n // setup source\n this.providers.data.setData(\n sourceWithGroups,\n GROUPING_ROW_TYPE,\n this.revogrid.disableVirtualY,\n { depth, customRenderer: options?.groupLabelTemplate },\n true,\n );\n this.updateTrimmed(trimmed, childrenByGroup, oldNewIndexes, oldNewIndexMap);\n }\n\n /**\n * Apply grouping on data set\n * Clear grouping from source\n * If source came from other plugin\n */\n private onDataSet(data: BeforeSourceSetEvent) {\n if (!this.hasProps || !data?.source || !data.source.length) {\n return;\n }\n const source = data.source.filter(s => !isGrouping(s));\n const expanded = this.revogrid.grouping || {};\n const {\n sourceWithGroups,\n depth,\n trimmed,\n oldNewIndexMap,\n childrenByGroup,\n } = gatherGrouping(source, this.options?.props || [], {\n ...(expanded || {}),\n });\n data.source = sourceWithGroups;\n this.providers.data.setGrouping({ depth });\n this.updateTrimmed(trimmed, childrenByGroup, oldNewIndexMap);\n }\n\n // apply grouping\n setGrouping(options: GroupingOptions) {\n // unsubscribe from all events when group applied\n this.clearSubscriptions();\n this.options = options;\n // clear props, no grouping exists\n if (!options.props || !Object.keys(options.props).length) {\n this.clearGrouping();\n return;\n }\n // props exist and source inited\n const { source } = this.getSource();\n if (source.length) {\n this.doSourceUpdate({ ...options });\n }\n // props exist and columns inited\n for (let t of columnTypes) {\n if (this.setColumnGrouping(this.providers.column.getColumns(t))) {\n this.providers.column.refreshByType(t);\n break;\n }\n }\n\n // if has any grouping subscribe to events again\n this.subscribe();\n }\n\n // clear grouping\n clearGrouping() {\n // clear columns\n columnTypes.forEach(t => {\n const cols = this.providers.column.getColumns(t);\n let deleted = false;\n cols.forEach(c => {\n if (isGroupingColumn(c)) {\n delete c[PSEUDO_GROUP_COLUMN];\n deleted = true;\n }\n });\n // if column store had grouping clear and refresh\n if (deleted) {\n this.providers.column.refreshByType(t);\n }\n });\n // clear rows\n const { source, oldNewIndexes } = this.getSource(true);\n this.providers.data.setData(\n source,\n GROUPING_ROW_TYPE,\n this.revogrid.disableVirtualY,\n undefined,\n true,\n );\n this.updateTrimmed(undefined, undefined, oldNewIndexes);\n }\n\n private updateTrimmed(\n trimmedGroup: TrimmedEntity = {},\n _childrenByGroup: Record<number, number[]> = {},\n firstLevelMap: Record<number, number>,\n secondLevelMap?: Record<number, number>,\n ) {\n // map previously trimmed data\n const trimemedOptionsToUpgrade = processDoubleConversionTrimmed(\n this.trimmed,\n firstLevelMap,\n secondLevelMap,\n );\n for (let type in trimemedOptionsToUpgrade) {\n this.revogrid.addTrimmed(trimemedOptionsToUpgrade[type], type);\n }\n\n // const emptyGroups = this.filterOutEmptyGroups(trimemedOptionsToUpgrade, childrenByGroup);\n\n // setup trimmed data for grouping\n this.revogrid.addTrimmed({ ...trimmedGroup }, TRIMMED_GROUPING);\n }\n}\n","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 columnTypes,\n rowTypes,\n} from '@store';\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 ViewPortResizeEvent,\n ViewSettingSizeProp,\n DimensionCols,\n DimensionRows,\n HeaderProperties,\n SlotType,\n ViewportColumn,\n ViewportData,\n ViewportProperties,\n ViewportProps,\n Cell,\n RangeArea,\n} from '@type';\nimport { Observable } from '../../utils/store.utils';\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 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","import { columnTypes } from '@store';\nimport {\n DimensionColPin,\n ViewPortScrollEvent,\n ElementsScroll,\n ElementScroll,\n} from '@type';\n\nexport default class GridScrollingService {\n private elements: ElementsScroll = {};\n constructor(private setViewport: (e: ViewPortScrollEvent) => void) {}\n\n async proxyScroll(e: ViewPortScrollEvent, key?: DimensionColPin | string) {\n let newEvent: Promise<ViewPortScrollEvent>;\n let event = e;\n for (let elKey in this.elements) {\n // skip\n if (e.dimension === 'rgCol' && elKey === 'headerRow') {\n continue;\n // pinned column only\n } else if (this.isPinnedColumn(key) && e.dimension === 'rgCol') {\n if (elKey === key || !e.delta) {\n continue;\n }\n for (let el of this.elements[elKey]) {\n if (el.changeScroll) {\n newEvent = el.changeScroll(e);\n }\n }\n } else {\n for (let el of this.elements[elKey]) {\n await el.setScroll?.(e);\n }\n }\n }\n if (newEvent) {\n event = await newEvent;\n }\n this.setViewport(event);\n }\n\n /**\n * Silent scroll update for mobile devices when we have negative scroll top\n */\n async scrollSilentService(\n e: ViewPortScrollEvent,\n key?: DimensionColPin | string,\n ) {\n for (let elKey in this.elements) {\n // skip same element update\n if (elKey === key) {\n continue;\n }\n if (\n columnTypes.includes(key as DimensionColPin) &&\n (elKey === 'headerRow' ||\n columnTypes.includes(elKey as DimensionColPin))\n ) {\n for (let el of this.elements[elKey]) {\n await el.changeScroll?.(e, true);\n }\n continue;\n }\n }\n }\n\n private isPinnedColumn(\n key?: DimensionColPin | string,\n ): key is DimensionColPin {\n return ['colPinStart', 'colPinEnd'].indexOf(key) > -1;\n }\n\n registerElements(els: ElementsScroll) {\n this.elements = els;\n }\n\n /**\n * Register new element for farther scroll support\n * @param el - can be null if holder removed\n * @param key - element key\n */\n registerElement(el: ElementScroll | null, key: string) {\n if (!this.elements[key]) {\n this.elements[key] = [];\n }\n // new element added\n if (el) {\n this.elements[key].push(el);\n } else if (this.elements[key]) {\n // element removed\n delete this.elements[key];\n }\n }\n\n unregister() {\n delete this.elements;\n this.elements = {};\n }\n}\n","import { h, VNode } from '@stencil/core';\nimport { PositionItem } from '@type';\nimport { Cell } from '@type';\n\ntype Props = { ref: { (e: OrdererService): void } };\n\n/**\n * Draw drag\n */\nexport class OrdererService {\n private parentY = 0;\n el!: HTMLElement;\n rgRow!: HTMLElement;\n text!: HTMLElement;\n draggable!: HTMLElement;\n\n start(parent: HTMLElement, { pos, text, event }: { pos: PositionItem; text: string; event: MouseEvent }) {\n const { top } = parent.getBoundingClientRect();\n this.parentY = top;\n if (this.text) {\n this.text.innerText = text;\n }\n this.move(pos);\n this.moveTip({ x: event.x, y: event.y });\n this.el?.classList.remove('hidden');\n }\n end() {\n this.el?.classList.add('hidden');\n }\n move(pos: PositionItem) {\n this.moveElement(pos.end - this.parentY);\n }\n moveTip({ x, y }: Cell) {\n if (!this.draggable) {\n return;\n }\n this.draggable.style.left = `${x}px`;\n this.draggable.style.top = `${y}px`;\n }\n\n private moveElement(y: number) {\n if (!this.rgRow) {\n return;\n }\n this.rgRow.style.transform = `translateY(${y}px)`;\n }\n}\n\nconst OrderRenderer = ({ ref }: Props): VNode[] => {\n const service = new OrdererService();\n ref(service);\n return (\n <div class=\"draggable-wrapper hidden\" ref={e => (service.el = e)}>\n <div class=\"draggable\" ref={el => (service.draggable = el)}>\n <span class=\"revo-alt-icon\" />\n <span ref={e => (service.text = e)} />\n </div>\n <div class=\"drag-position\" ref={e => (service.rgRow = e)} />\n </div>\n );\n};\nexport default OrderRenderer;\n","import each from 'lodash/each';\nimport { calculateRowHeaderSize } from '../utils/row-header-utils';\nimport { ColumnCollection } from '../services/column.data.provider';\nimport { ColumnItems } from '../services/dimension.provider';\nimport { getScrollbarSize } from '../utils';\nimport { BasePlugin } from './base.plugin';\nimport { DimensionCols, DimensionType } from '..';\nimport { PluginBaseComponent } from '../';\nimport { PluginProviders } from '../';\n\n/**\n * This plugin serves to recalculate columns initially\n * Base on empty space if there is any\n * Currently plugin supports only increasing last column\n */\ntype ScrollChange = {\n type: DimensionType;\n hasScroll: boolean;\n};\ntype StretchedData = {\n initialSize: number;\n size: number;\n index: number;\n};\n\nexport default class StretchColumn extends BasePlugin {\n private stretchedColumn: StretchedData | null = null;\n private readonly scrollSize;\n constructor(\n revogrid: HTMLRevoGridElement,\n protected providers: PluginProviders,\n ) {\n super(revogrid, providers);\n\n // calculate scroll bar size for current user session\n this.scrollSize = getScrollbarSize(document);\n\n // subscribe to column changes\n const beforecolumnapplied = ({\n detail: { columns },\n }: CustomEvent<ColumnCollection>) => this.applyStretch(columns);\n this.addEventListener('beforecolumnapplied', beforecolumnapplied);\n }\n\n private setScroll({ type, hasScroll }: ScrollChange) {\n if (\n type === 'rgRow' &&\n this.stretchedColumn &&\n this.stretchedColumn?.initialSize === this.stretchedColumn.size\n ) {\n if (hasScroll) {\n this.stretchedColumn.size -= this.scrollSize;\n this.apply();\n this.dropChanges();\n }\n }\n }\n\n private activateChanges() {\n const setScroll = ({ detail }: CustomEvent<ScrollChange>) =>\n this.setScroll(detail);\n this.addEventListener('scrollchange', setScroll);\n }\n\n private dropChanges() {\n this.stretchedColumn = null;\n this.removeEventListener('scrollchange');\n }\n\n private apply() {\n if (!this.stretchedColumn) {\n return;\n }\n const type: DimensionCols = 'rgCol';\n const sizes = this.providers.dimension.stores[type].store.get('sizes');\n this.providers.dimension.setCustomSizes(\n type,\n {\n ...sizes,\n [this.stretchedColumn.index]: this.stretchedColumn.size,\n },\n true,\n );\n }\n\n /**\n * Apply stretch changes\n */\n applyStretch(columns: ColumnItems) {\n // unsubscribe from all events\n this.dropChanges();\n // calculate grid size\n let sizeDifference = this.revogrid.clientWidth - 1;\n each(columns, (_, type: DimensionCols) => {\n const realSize =\n this.providers.dimension.stores[type].store.get('realSize');\n sizeDifference -= realSize;\n });\n if (this.revogrid.rowHeaders) {\n const itemsLength =\n this.providers.data.stores.rgRow.store.get('source').length;\n const header = this.revogrid.rowHeaders;\n const rowHeaderSize = calculateRowHeaderSize(\n itemsLength,\n typeof header === 'object' ? header : undefined,\n );\n if (rowHeaderSize) {\n sizeDifference -= rowHeaderSize;\n }\n }\n if (sizeDifference > 0) {\n // currently plugin accepts last column only\n const index = columns.rgCol.length - 1;\n const last = columns.rgCol[index];\n /**\n * has column\n * no auto size applied\n * size for column shouldn't be defined\n */\n const colSize = last?.size || this.revogrid.colSize || 0;\n const size = sizeDifference + colSize - 1;\n\n if (last && !last.autoSize && colSize < size) {\n this.stretchedColumn = {\n initialSize: size,\n index,\n size,\n };\n this.apply();\n this.activateChanges();\n }\n }\n }\n}\n\n/**\n * Check plugin type is Stretch\n */\nexport function isStretchPlugin(\n plugin: PluginBaseComponent | StretchColumn,\n): plugin is StretchColumn {\n return !!(plugin as StretchColumn).applyStretch;\n}\n","import reduce from 'lodash/reduce';\nimport { RowDefinition, DimensionRows } from '@type';\n\ntype Result = Partial<{\n [T in DimensionRows]: { sizes?: Record<number, number>; };\n}>;\ntype RemoveResult = Partial<{\n [T in DimensionRows]: number[];\n}>;\nexport const rowDefinitionByType = (newVal: RowDefinition[] = []) => {\n return reduce(newVal, (r: Result, v) => {\n if (!r[v.type]) {\n r[v.type] = {};\n }\n if (v.size) {\n if (!r[v.type].sizes) {\n r[v.type].sizes = {};\n }\n r[v.type].sizes[v.index] = v.size;\n }\n return r;\n },\n {},\n );\n};\n\nexport const rowDefinitionRemoveByType = (oldVal: RowDefinition[] = []) => {\n return reduce(oldVal, (r: RemoveResult, v) => {\n if (!r[v.type]) {\n r[v.type] = [];\n }\n if (v.size) {\n r[v.type].push(v.index);\n }\n return r;\n },\n {},\n );\n};\n","const COLUMN_DRAG_CLASS = 'column-drag-start';\n\nexport class ColumnOrderHandler {\n private element?: HTMLDivElement;\n private autoscrollEl?: HTMLElement;\n private offset = 0;\n\n renderAutoscroll(_: MouseEvent, parent: HTMLElement | null) {\n if (!parent) {\n return;\n }\n this.autoscrollEl = document.createElement('div');\n this.autoscrollEl.classList.add('drag-auto-scroll-y');\n parent.appendChild(this.autoscrollEl);\n }\n\n autoscroll(pos: number, dataContainerSize: number, direction = 'translateX') {\n if (!this.autoscrollEl) {\n return;\n }\n const helperOffset = 10;\n // calculate current y position inside of the grid active holder\n // 3 - size of element + border\n const maxScroll = Math.min(pos + helperOffset, dataContainerSize - 3);\n\n this.autoscrollEl.style.transform = `${direction}(${maxScroll}px)`;\n this.autoscrollEl.scrollIntoView({\n block: 'nearest',\n inline: 'nearest',\n });\n }\n\n start(e: MouseEvent, { dataEl, gridRect, scrollEl, gridEl }: {\n dataEl: HTMLElement;\n gridRect: DOMRect;\n scrollEl: Element;\n gridEl: Element;\n }, dir: 'top' | 'left' = 'left') {\n gridEl.classList.add(COLUMN_DRAG_CLASS);\n const scrollContainerRect = scrollEl.getBoundingClientRect();\n if (scrollContainerRect) {\n this.offset = scrollContainerRect[dir] - gridRect[dir];\n }\n this.renderAutoscroll(e, dataEl);\n }\n\n stop(gridEl: Element) {\n gridEl.classList.remove(COLUMN_DRAG_CLASS);\n if (this.element) {\n this.element.hidden = true;\n }\n this.offset = 0;\n this.autoscrollEl?.remove();\n this.autoscrollEl = undefined;\n }\n\n showHandler(pos: number, size: number, direction = 'translateX') {\n if (!this.element) {\n return;\n }\n // do not allow overcross top of the scrollable area, header excluded\n if (this.offset) {\n pos = Math.max(pos, this.offset);\n }\n // can not be bigger then grid end\n pos = Math.min(pos, size);\n this.element.style.transform = `${direction}(${pos}px)`;\n this.element.hidden = false;\n }\n\n render() {\n const el = this.element = document.createElement('div');\n el.classList.add('drag-position-y');\n el.hidden = true;\n return el;\n }\n}\n","/**\n * Plugin for column manual move\n */\nimport debounce from 'lodash/debounce';\nimport each from 'lodash/each';\nimport ColumnDataProvider from '../../services/column.data.provider';\nimport { DataProvider } from '../../services/data.provider';\nimport DimensionProvider from '../../services/dimension.provider';\nimport SelectionStoreConnector from '../../services/selection.store.connector';\nimport ViewportProvider from '../../services/viewport.provider';\nimport { getItemByPosition } from '@store';\nimport { BasePlugin } from '../base.plugin';\nimport { ColumnOrderHandler } from './order-column.handler';\nimport { dispatch } from '../dispatcher';\nimport { isColGrouping } from '../groupingColumn/grouping.col.plugin';\nimport { ColumnPropProp, ColumnRegular, DimensionSettingsState, PositionItem, DimensionCols, MultiDimensionType, PluginProviders } from '@type';\nimport { ON_COLUMN_CLICK } from '../../components/header/header-cell-renderer';\n\nconst COLUMN_CLICK = ON_COLUMN_CLICK;\nconst MOVE = 'columndragmousemove';\nconst DRAG_END = 'columndragend';\nconst BEFORE_DRAG_END = 'beforecolumndragend';\n\n// use this event subscription to drop D&D for particular columns\nconst DRAG_START = 'columndragstart';\n\nexport type DragStartEventDetails = {\n event: MouseEvent;\n data: ColumnPropProp;\n};\n\nexport type Providers = {\n data: DataProvider;\n dimension: DimensionProvider;\n selection: SelectionStoreConnector;\n column: ColumnDataProvider;\n viewport: ViewportProvider;\n};\ntype StaticData = {\n startPos: number;\n startItem: PositionItem;\n data: ColumnRegular;\n dataEl: HTMLElement;\n scrollEl: Element;\n gridEl: HTMLElement;\n cols: DimensionSettingsState;\n};\n\ntype LocalSubscriptions = Record<string, LocalSubscription>;\ntype LocalSubscription = {\n target: Element | Document;\n callback(...params: any[]): void;\n};\nexport type EventData = {\n elRect: DOMRect;\n gridRect: DOMRect;\n scrollOffset: number;\n type: DimensionCols;\n};\nexport default class ColumnPlugin extends BasePlugin {\n private moveFunc = debounce((e: MouseEvent) => this.doMove(e), 5);\n private staticDragData: StaticData | null = null;\n private dragData: EventData | null = null;\n private readonly orderUi: ColumnOrderHandler;\n protected readonly localSubscriptions: LocalSubscriptions = {};\n constructor(protected revogrid: HTMLRevoGridElement, protected providers: PluginProviders) {\n super(revogrid, providers);\n this.orderUi = new ColumnOrderHandler();\n revogrid.appendChild(this.orderUi.render());\n revogrid.classList.add('column-draggable');\n\n // Register events\n this.localSubscriptions['mouseleave'] = {\n target: document,\n callback: (e: MouseEvent) => this.onMouseOut(e),\n };\n this.localSubscriptions['mouseup'] = {\n target: document,\n callback: (e: MouseEvent) => this.onMouseUp(e),\n };\n\n this.localSubscriptions['mousemove'] = {\n target: document,\n callback: (e: MouseEvent) => this.move(e),\n };\n\n this.addEventListener(COLUMN_CLICK, ({ detail }) => this.dragStart(detail));\n }\n\n dragStart({ event, data }: DragStartEventDetails) {\n if (event.defaultPrevented) {\n return;\n }\n const { defaultPrevented } = dispatch(this.revogrid, DRAG_START, data);\n // check if allowed to drag particulat column\n if (defaultPrevented) {\n return;\n }\n this.clearOrder();\n const { mouseleave, mouseup, mousemove } = this.localSubscriptions;\n mouseleave.target.addEventListener('mouseleave', mouseleave.callback);\n mouseup.target.addEventListener('mouseup', mouseup.callback);\n\n const dataEl = (event.target as HTMLElement).closest('revogr-header');\n const scrollEl = (event.target as HTMLElement).closest('revogr-viewport-scroll');\n if (!dataEl || !scrollEl) {\n return;\n }\n\n // no grouping drag and no row header column drag\n if (isColGrouping(data) || data.providers.type === 'rowHeaders') {\n return;\n }\n\n const cols = this.getDimension(data.pin || 'rgCol');\n const gridRect = this.revogrid.getBoundingClientRect();\n const elRect = dataEl.getBoundingClientRect();\n const startItem = getItemByPosition(\n cols,\n getLeftRelative(event.x, gridRect.left, elRect.left - gridRect.left));\n \n this.staticDragData = {\n startPos: event.x,\n startItem,\n data,\n dataEl,\n scrollEl,\n gridEl: this.revogrid,\n cols,\n };\n this.dragData = this.getData(this.staticDragData);\n mousemove.target.addEventListener('mousemove', mousemove.callback);\n this.orderUi.start(event, {\n ...this.dragData,\n ...this.staticDragData,\n });\n }\n\n doMove(e: MouseEvent) {\n if (!this.staticDragData) {\n return;\n }\n\n const dragData = (this.dragData = this.getData(this.staticDragData));\n if (!dragData) {\n return;\n }\n const start = this.staticDragData.startPos;\n if (Math.abs(start - e.x) > 10) {\n const x = getLeftRelative(e.x, this.dragData.gridRect.left, this.dragData.scrollOffset);\n const rgCol = getItemByPosition(this.staticDragData.cols, x);\n this.orderUi.autoscroll(x, dragData.elRect.width);\n this.orderUi.showHandler(\n rgCol.end + dragData.scrollOffset,\n dragData.gridRect.width\n );\n }\n }\n\n move(e: MouseEvent) {\n dispatch(this.revogrid, MOVE, e);\n // then do move\n this.moveFunc(e);\n }\n onMouseOut(_: MouseEvent) {\n this.clearOrder();\n }\n onMouseUp(e: MouseEvent) {\n // apply new positions\n if (this.dragData) {\n let relativePos = getLeftRelative(e.x, this.dragData.gridRect.left, this.dragData.scrollOffset);\n if (relativePos < 0) {\n relativePos = 0;\n }\n const newPosition = getItemByPosition(this.staticDragData.cols, relativePos);\n\n const store = this.providers.column.stores[this.dragData.type].store;\n const items = [...store.get('items')];\n\n // prevent position change if needed\n const { defaultPrevented: stopDrag } = dispatch(this.revogrid, BEFORE_DRAG_END, {\n ...this.staticDragData,\n startPosition: this.staticDragData.startItem,\n newPosition,\n newItem: store.get('source')[items[this.staticDragData.startItem.itemIndex]]\n });\n if (!stopDrag) {\n // todo: if move item out of group remove item from group\n const toMove = items.splice(this.staticDragData.startItem.itemIndex, 1);\n items.splice(newPosition.itemIndex, 0, ...toMove);\n store.set('items', items);\n }\n dispatch(this.revogrid, DRAG_END, this.dragData);\n }\n this.clearOrder();\n }\n\n private clearLocalSubscriptions() {\n each(this.localSubscriptions, ({ target, callback }, key) => target.removeEventListener(key, callback));\n }\n\n clearOrder() {\n this.staticDragData = null;\n this.dragData = null;\n this.clearLocalSubscriptions();\n this.orderUi.stop(this.revogrid);\n }\n /**\n * Clearing subscription\n */\n protected clearSubscriptions() {\n super.clearSubscriptions();\n this.clearLocalSubscriptions();\n }\n\n private getData({\n gridEl,\n dataEl,\n data,\n }: StaticData): EventData {\n const gridRect = gridEl.getBoundingClientRect();\n const elRect = dataEl.getBoundingClientRect();\n const scrollOffset = elRect.left - gridRect.left;\n return {\n elRect,\n gridRect,\n type: data.pin || 'rgCol',\n scrollOffset,\n };\n }\n private getDimension(type: MultiDimensionType) {\n return this.providers.dimension.stores[type].getCurrentState();\n }\n}\n\nexport function getLeftRelative(\n absoluteX: number,\n gridPos: number,\n offset: number\n): number {\n return absoluteX - gridPos - offset;\n}\n","export function isMobileDevice() {\n return /Mobi/i.test(navigator.userAgent) || /Android/i.test(navigator.userAgent) || navigator.maxTouchPoints > 0;\n}\n","@import './styles/revo-grid.mixin.scss';\n@import './styles/revo-grid.default.scss';\n@import './styles/revo-grid.material.scss';\n@import './styles/revo-grid.dark.material.scss';\n@import './styles/revo-grid.dark.compact.scss';\n@import './styles/revo-grid.compact.scss';\n\nrevo-grid {\n display: block;\n height: 100%;\n /**\n * In some cases the min-height is not enough for safari\n * so setting up the grid height works\n */\n min-height: 300px;\n font-family: Helvetica, Arial, Sans-Serif, serif;\n font-size: 14px;\n position: relative;\n\n @include noSelect;\n\n .attribution {\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n z-index: 100;\n width: 0;\n height: 0;\n border-left: 6px solid #0049cf;\n border-top: 6px solid #0049cf;\n border-bottom: 6px solid transparent;\n border-right: 6px solid transparent;\n cursor: pointer;\n\n .value {\n position: absolute;\n top: 0;\n left: 0;\n background-color: rgba(255, 255, 255, 0.9);\n padding: 4px;\n border-radius: 4px;\n box-shadow: 0 1px 10px rgba(0, 0, 0, 0.2);\n white-space: nowrap;\n text-decoration: none;\n color: black;\n letter-spacing: 0.3px;\n font-size: 11px;\n opacity: 0;\n width: 6px;\n overflow: hidden;\n transition: opacity 0.5s ease-in-out, width 0.3s ease-in-out;\n }\n\n &:hover {\n .value {\n width: 63px;\n opacity: 1;\n }\n }\n }\n\n &.column-draggable.column-drag-start {\n &, * {\n &:hover {\n cursor: grabbing;\n }\n }\n }\n\n .footer-wrapper,\n .header-wrapper {\n width: 100%;\n\n revogr-data {\n z-index: 3;\n }\n }\n\n revo-dropdown {\n width: 100%;\n\n .rv-dr-root {\n max-height: 100%;\n }\n &.shrink label {\n opacity: 0;\n }\n }\n\n .viewports {\n // max-height: 100%; // for safari\n max-width: 100%;\n display: flex;\n flex-direction: row;\n align-items: flex-start;\n flex-grow: 1;\n }\n\n display: flex;\n flex-direction: column;\n width: 100%;\n height: 100%;\n\n .main-viewport {\n flex-grow: 1;\n height: 0;\n display: flex;\n justify-content: space-between;\n flex-direction: row;\n }\n\n .draggable {\n $s: 30px;\n position: fixed;\n height: $s;\n line-height: $s;\n background: #fff;\n border-radius: 3px;\n display: block;\n z-index: 100;\n margin-top: 5px;\n margin-right: -20px;\n box-shadow: 0 4px 20px 0 rgba(black, 0.15);\n padding-left: 20px;\n padding-right: 5px;\n\n &.hidden {\n display: none;\n }\n\n .revo-alt-icon {\n $alt-icon-color: black;\n background-color: $alt-icon-color;\n position: absolute;\n left: 5px;\n top: 10px;\n }\n }\n\n .draggable-wrapper {\n &.hidden {\n display: none;\n }\n }\n\n .drag-position {\n position: absolute;\n left: 0;\n right: 0;\n height: 1px;\n z-index: 2;\n background: gray;\n pointer-events: none;\n }\n\n .drag-position-y {\n position: absolute;\n top: 0;\n left: 0;\n bottom: 0;\n width: 1px;\n z-index: 2;\n background: gray;\n pointer-events: none;\n }\n\n .drag-auto-scroll-y {\n pointer-events: none;\n position: absolute;\n left: 0;\n top: 0;\n height: 50px;\n width: 1px;\n }\n\n .clipboard {\n position: absolute;\n left: 0;\n top: 0;\n }\n\n revogr-scroll-virtual {\n position: relative;\n &.vertical,\n &.horizontal {\n z-index: 3;\n }\n }\n}\n","import {\n Component,\n Prop,\n h,\n Watch,\n Element,\n Listen,\n Event,\n EventEmitter,\n Method,\n VNode,\n Host,\n} from '@stencil/core';\nimport each from 'lodash/each';\n\nimport ColumnDataProvider, {\n ColumnCollection,\n} from '../../services/column.data.provider';\nimport { DataProvider } from '../../services/data.provider';\nimport { DSourceState, getVisibleSourceItem } from '@store';\nimport DimensionProvider from '../../services/dimension.provider';\nimport ViewportProvider from '../../services/viewport.provider';\nimport ThemeService from '../../themeManager/theme.service';\nimport { timeout } from '../../utils';\nimport AutoSize, {\n AutoSizeColumnConfig,\n} from '../../plugins/column.auto-size.plugin';\n\nimport {\n FilterPlugin,\n ColumnFilterConfig,\n FilterCollection,\n} from '../../plugins/filter/filter.plugin';\nimport SortingPlugin from '../../plugins/sorting/sorting.plugin';\nimport ExportFilePlugin from '../../plugins/export/export.plugin';\nimport { DataInput } from '../../plugins/export/types';\nimport GroupingRowPlugin from '../../plugins/groupingRow/grouping.row.plugin';\nimport { GroupingOptions } from '../../plugins/groupingRow/grouping.row.types';\nimport ViewportService, { FocusedData } from './viewport.service';\nimport { DATA_SLOT, HEADER_SLOT } from './viewport.helpers';\nimport GridScrollingService from './viewport.scrolling.service';\nimport { UUID } from '../../utils/consts';\nimport SelectionStoreConnector from '../../services/selection.store.connector';\nimport OrderRenderer, { OrdererService } from '../order/order-renderer';\nimport StretchColumn, {\n isStretchPlugin,\n} from '../../plugins/column.stretch.plugin';\nimport { rowDefinitionByType, rowDefinitionRemoveByType } from './grid.helpers';\nimport ColumnPlugin from '../../plugins/moveColumn/column.drag.plugin';\nimport { getPropertyFromEvent } from '../../utils/events';\nimport { isMobileDevice } from '../../utils/mobile';\nimport {\n MultiDimensionType,\n DimensionRows,\n DimensionCols,\n DimensionType,\n DimensionTypeCol,\n RowHeaders,\n ColumnRegular,\n ColumnGrouping,\n DataType,\n RowDefinition,\n ColumnType,\n FocusTemplateFunc,\n PositionItem,\n ColumnProp,\n ViewPortScrollEvent,\n InitialHeaderClick,\n ColumnDataSchema,\n AllDimensionType,\n Editors,\n BeforeSaveDataDetails,\n BeforeRangeSaveDataDetails,\n Cell,\n ChangedRange,\n RangeArea,\n AfterEditEvent,\n Theme,\n PluginBaseComponent,\n PluginExternalConstructor,\n HeaderProperties,\n PluginProviders,\n} from '@type';\nimport { Observable } from '../../utils/store.utils';\n\n/**\n * Revogrid - High-performance, customizable grid library for managing large datasets.\n *\n * :::tip\n * Read [type definition file](https://github.com/revolist/revogrid/blob/master/src/interfaces.d.ts) for the full interface information.\n * All complex property types such as `ColumnRegular`, `ColumnProp`, `ColumnDataSchemaModel` can be found there.\n * :::\n *\n * :::tip\n * For a comprehensive events guide, check the [dependency tree](#Dependencies).\n * All events propagate to the root level of the grid.\n * :::\n *\n * @slot data-{column-type}-{row-type}. @example data-rgCol-rgRow - main data slot. Applies extra elements in <revogr-data />.\n * @slot focus-{column-type}-{row-type}. @example focus-rgCol-rgRow - focus layer for main data. Applies extra elements in <revogr-focus />.\n */\n@Component({\n tag: 'revo-grid',\n styleUrl: 'revo-grid-style.scss',\n})\nexport class RevoGridComponent {\n // #region Properties\n /** Excel like functionality.\n * Show row numbers.\n * Also can be used for custom row header render if object provided.\n */\n @Prop() rowHeaders: RowHeaders | boolean;\n\n /**\n * Defines how many rows/columns should be rendered outside visible area.\n */\n @Prop() frameSize = 1;\n\n /**\n * Indicates default rgRow size.\n * By default 0, means theme package size will be applied\n *\n * Alternatively you can use `rowSize` to reset viewport\n */\n @Prop() rowSize = 0;\n\n /** Indicates default column size. */\n @Prop() colSize = 100;\n\n /** When true, user can range selection. */\n @Prop() range = false;\n\n /** When true, grid in read only mode. */\n @Prop() readonly = false;\n\n /** When true, columns are resizable. */\n @Prop() resize = false;\n\n /** When true cell focus appear. */\n @Prop() canFocus = true;\n\n /** When true enable clipboard. */\n @Prop() useClipboard = true;\n\n /**\n * Columns - defines an array of grid columns.\n * Can be column or grouped column.\n */\n @Prop() columns: (ColumnRegular | ColumnGrouping)[] = [];\n /**\n * Source - defines main data source.\n * Can be an Object or 2 dimensional array([][]);\n * Keys/indexes referenced from columns Prop.\n */\n @Prop() source: DataType[] = [];\n\n /** Pinned top Source: {[T in ColumnProp]: any} - defines pinned top rows data source. */\n @Prop() pinnedTopSource: DataType[] = [];\n\n /** Pinned bottom Source: {[T in ColumnProp]: any} - defines pinned bottom rows data source. */\n @Prop() pinnedBottomSource: DataType[] = [];\n\n /** Custom row properies to be applied. See `RowDefinition` for more info. */\n @Prop() rowDefinitions: RowDefinition[] = [];\n\n /** Custom editors register. */\n @Prop() editors: Editors = {};\n\n /**\n * Apply changes in editor when closed except 'Escape' cases.\n * If custom editor in use method getValue required.\n * Check interfaces.d.ts `EditorBase` for more info.\n */\n @Prop() applyOnClose = false;\n\n /**\n * Custom grid plugins.\n * Has to be predefined during first grid init.\n * Every plugin should be inherited from BasePlugin.\n */\n @Prop() plugins: PluginExternalConstructor[];\n\n /**\n * Column Types Format.\n * Every type represent multiple column properties.\n * Types will be merged but can be replaced with column properties.\n * Types were made as separate objects to be reusable per multiple columns.\n */\n @Prop() columnTypes: { [name: string]: ColumnType } = {};\n\n /** Theme name. */\n @Prop({ reflect: true, mutable: true }) theme: Theme = 'default';\n\n /**\n * Row class property mapping.\n * Map custom classes to rows from row object data.\n * Define this property in rgRow object and this will be mapped as rgRow class.\n */\n @Prop({ reflect: true }) rowClass = '';\n\n /**\n * Autosize config.\n * Enables columns autoSize.\n * For more details check `autoSizeColumn` plugin.\n * By default disabled, hence operation is not performance efficient.\n * `true` to enable with default params (double header separator click for autosize).\n * Or define config. See `AutoSizeColumnConfig` for more details.\n */\n @Prop() autoSizeColumn: boolean | AutoSizeColumnConfig = false;\n\n /**\n * Enables filter plugin.\n * Can be boolean.\n * Or can be filter collection See `FilterCollection` for more info.\n */\n @Prop() filter: boolean | ColumnFilterConfig = false;\n\n /**\n * Apply changes typed in editor on editor close except Escape cases.\n * If custom editor in use method `getValue` required.\n * Check `interfaces.d.ts` `EditorBase` for more info.\n */\n @Prop() focusTemplate: FocusTemplateFunc;\n\n /**\n * Enable column move plugin.\n */\n @Prop() canMoveColumns = false;\n /**\n * Trimmed rows.\n * Functionality which allows to hide rows from main data set.\n * `trimmedRows` are physical `rgRow` indexes to hide.\n */\n @Prop() trimmedRows: Record<number, boolean> = {};\n\n /**\n * Enable export plugin.\n */\n @Prop() exporting = false;\n\n /**\n * Group rows based on this property.\n * Define properties to be groped by grouping plugin See `GroupingOptions`.\n */\n @Prop() grouping: GroupingOptions;\n\n /**\n * Stretch strategy for columns by `StretchColumn` plugin.\n * For example if there are more space on the right last column size would be increased.\n */\n @Prop() stretch: boolean | string = true;\n\n /**\n * Additional data to be passed to plugins, renders or editors.\n * For example if you need to pass Vue component instance.\n */\n @Prop() additionalData: any = {};\n\n /**\n * Disable lazy rendering mode for the `X axis`.\n * Use when not many columns present and you don't need rerenader cells during scroll.\n * Can be used for initial rendering performance improvement.\n */\n @Prop() disableVirtualX = false;\n /**\n * Disable lazy rendering mode for the `Y axis`.\n * Use when not many rows present and you don't need rerenader cells during scroll.\n * Can be used for initial rendering performance improvement.\n */\n @Prop() disableVirtualY = false;\n\n /**\n * Please only hide the attribution if you are subscribed to Pro version\n */\n @Prop() hideAttribution = false;\n\n /**\n * Prevent rendering until job is done.\n * Can be used for initial rendering performance improvement.\n * When several plugins require initial rendering this will prevent double initial rendering.\n */\n @Prop() jobsBeforeRender: Promise<any>[] = [];\n\n /**\n * Register new virtual node inside of grid.\n * Used for additional items creation such as plugin elements.\n * Should be set before grid render inside of plugins.\n */\n @Prop() registerVNode: VNode[] = [];\n\n // #endregion\n\n // #region Events\n /**\n * New content size has been applied. The size excludes the header.\n * Currently, the event responsible for applying the new content size does not provide the actual size.\n * To retrieve the actual content size, you can utilize the `getContentSize` function after the event has been triggered.\n */\n @Event() contentsizechanged: EventEmitter<MultiDimensionType>;\n\n /**\n * This event is triggered before the data is edited.\n * To prevent the default behavior of editing data and use your own implementation, call `e.preventDefault()`.\n * To override the edit result with your own value, set the `e.val` property to your desired value.\n */\n @Event() beforeedit: EventEmitter<BeforeSaveDataDetails>;\n\n /**\n * This event is triggered before applying range data, specifically when a range selection occurs.\n * To customize the data and prevent the default edit data from being set, you can call `e.preventDefault()`.\n */\n @Event() beforerangeedit: EventEmitter<BeforeRangeSaveDataDetails>;\n\n /**\n * Triggered after data applied or range changed.\n */\n @Event() afteredit: EventEmitter<AfterEditEvent>;\n\n /**\n * This event is triggered before autofill is applied.\n * To prevent the default behavior of applying the edit data, you can call `e.preventDefault()`.\n */\n @Event() beforeautofill: EventEmitter<ChangedRange>;\n\n /**\n * Triggered before range applied.\n * Use e.preventDefault() to prevent range.\n */\n @Event() beforeange: EventEmitter<ChangedRange>;\n\n /**\n * Triggered after focus render finished.\n * Can be used to access a focus element through `event.target`\n */\n @Event() afterfocus: EventEmitter<{\n model: any;\n column: ColumnRegular;\n }>;\n\n /**\n * This event is triggered before the order of `rgRow` is applied.\n * To prevent the default behavior of changing the order of `rgRow`, you can call `e.preventDefault()`.\n */\n @Event() roworderchanged: EventEmitter<{ from: number; to: number }>;\n\n /**\n * Triggered by sorting.plugin.ts\n * Before sorting apply.\n * Use e.preventDefault() to prevent sorting data change.\n */\n @Event() beforesortingapply: EventEmitter<{\n column: ColumnRegular;\n order: 'desc' | 'asc';\n additive: boolean;\n }>;\n\n /**\n * Triggered by sorting.plugin.ts\n * Before sorting event.\n * Initial sorting triggered, if this event stops no other event called.\n * Use e.preventDefault() to prevent sorting.\n */\n @Event() beforesorting: EventEmitter<{\n column: ColumnRegular;\n order: 'desc' | 'asc';\n additive: boolean;\n }>;\n\n /**\n * This event is triggered when the row order change is started.\n * To prevent the default behavior of changing the row order, you can call `e.preventDefault()`.\n * To change the item name at the start of the row order change, you can set `e.text` to the desired new name.\n */\n @Event() rowdragstart: EventEmitter<{\n pos: PositionItem;\n text: string;\n }>;\n\n /**\n * On header click.\n */\n @Event() headerclick: EventEmitter<ColumnRegular>;\n\n /**\n * This event is triggered before the cell focus is changed.\n * To prevent the default behavior of changing the cell focus, you can call `e.preventDefault()`.\n */\n @Event() beforecellfocus: EventEmitter<BeforeSaveDataDetails>;\n\n /**\n * This event is triggered before the grid focus is lost.\n * To prevent the default behavior of changing the cell focus, you can call `e.preventDefault()`.\n */\n @Event() beforefocuslost: EventEmitter<FocusedData | null>;\n\n /**\n * Before main source/rows data apply.\n * You can override data source here\n */\n @Event() beforesourceset: EventEmitter<{\n type: DimensionRows;\n source: DataType[];\n }>;\n\n /**\n * Before data apply on any source type. Can be source from pinned and main viewport.\n * You can override data source here\n */\n @Event() beforeanysource: EventEmitter<{\n type: DimensionRows;\n source: DataType[];\n }>;\n\n /**\n * After main source/rows updated\n */\n @Event() aftersourceset: EventEmitter<{\n type: DimensionRows;\n source: DataType[];\n }>;\n\n /**\n * Emitted after each source update, whether from the pinned or main viewport.\n * Useful for tracking all changes originating from sources in both the pinned and main viewports.\n */\n @Event() afteranysource: EventEmitter<{\n type: DimensionRows;\n source: DataType[];\n }>;\n\n /**\n * Emitted before a column update is applied.\n * Listeners can use this event to perform any necessary actions or modifications before the column update is finalized.\n */\n @Event() beforecolumnsset: EventEmitter<ColumnCollection>;\n\n /**\n * Emitted before a column update is applied, after the column set is gathered and the viewport is updated.\n * Useful for performing actions or modifications before the final application of the column update.\n */\n @Event() beforecolumnapplied: EventEmitter<ColumnCollection>;\n\n /** Column updated */\n @Event() aftercolumnsset: EventEmitter<{\n columns: ColumnCollection;\n order: Record<ColumnProp, 'asc' | 'desc'>;\n }>;\n\n /**\n * Emitted before applying a filter to the data source.\n * Use e.preventDefault() to prevent cell focus change.\n * Modify the @collection if you need to change filters.\n */\n @Event() beforefilterapply: EventEmitter<{ collection: FilterCollection }>;\n\n /**\n * Emitted before applying a filter to the data source.\n * Use e.preventDefault() to prevent the default behavior of trimming values and applying the filter.\n * Modify the `collection` property if you want to change the filters.\n * Modify the `itemsToFilter` property if you want to filter the indexes for trimming.\n */\n @Event() beforefiltertrimmed: EventEmitter<{\n collection: FilterCollection;\n itemsToFilter: Record<number, boolean>;\n }>;\n\n /**\n * Emitted before trimming values.\n * Use e.preventDefault() to prevent the default behavior of trimming values.\n * Modify the `trimmed` property if you want to filter the indexes for trimming.\n */\n @Event() beforetrimmed: EventEmitter<{\n trimmed: Record<number, boolean>;\n trimmedType: string;\n type: string;\n }>;\n\n /**\n * Emitted after trimmed values have been applied.\n * Useful for notifying when trimming of values has taken place.\n */\n @Event() aftertrimmed: EventEmitter;\n\n /**\n * Emitted when the viewport is scrolled.\n * Useful for tracking viewport scrolling events.\n */\n @Event() viewportscroll: EventEmitter<ViewPortScrollEvent>;\n\n /**\n * Before export\n * Use e.preventDefault() to prevent export\n * Replace data in Event in case you want to modify it in export\n */\n @Event() beforeexport: EventEmitter<DataInput>;\n\n /**\n * Emitted before editing starts.\n * Use e.preventDefault() to prevent the default edit behavior.\n */\n @Event() beforeeditstart: EventEmitter<BeforeSaveDataDetails>;\n\n /**\n * Emitted after column resizing.\n * Useful for retrieving the resized columns.\n */\n @Event() aftercolumnresize: EventEmitter<{\n [index: number]: ColumnRegular;\n }>;\n\n /**\n * Emitted before the row definition is applied.\n * Useful for modifying or preventing the default row definition behavior.\n */\n @Event() beforerowdefinition: EventEmitter<{ vals: any; oldVals: any }>;\n\n /**\n * Emitted when the filter configuration is changed\n */\n @Event() filterconfigchanged: EventEmitter;\n\n /**\n * Emmited when the row headers are changed.\n */\n @Event() rowheaderschanged: EventEmitter;\n\n /**\n * Emmited before the grid is rendered.\n */\n @Event() beforegridrender: EventEmitter;\n\n /**\n * Emmited after the grid is initialized. Connected to the DOM.\n */\n @Event() aftergridinit: EventEmitter;\n\n // #endregion\n\n // #region Methods\n /**\n * Refreshes data viewport.\n * Can be specific part as rgRow or pinned rgRow or 'all' by default.\n */\n @Method() async refresh(type: DimensionRows | 'all' = 'all') {\n this.dataProvider.refresh(type);\n }\n\n /**\n * Sets data at specified cell.\n * Useful for performance optimization.\n * No viewport update will be triggered.\n */\n @Method() async setDataAt(\n data: {\n row: number;\n col: number;\n } & AllDimensionType,\n ) {\n const dataElement: HTMLRevogrDataElement | null =\n this.element.querySelector(\n `revogr-data[type=\"${data.rowType}\"][col-type=\"${data.colType}\"]`,\n );\n return dataElement?.updateCell({\n row: data.row,\n col: data.col,\n });\n }\n\n /**\n * Scrolls viewport to specified row by index.\n */\n @Method() async scrollToRow(coordinate = 0) {\n const y = this.dimensionProvider.getViewPortPos({\n coordinate,\n dimension: 'rgRow',\n });\n await this.scrollToCoordinate({ y });\n }\n\n /**\n * Scrolls viewport to specified column by index.\n */\n @Method() async scrollToColumnIndex(coordinate = 0) {\n const x = this.dimensionProvider.getViewPortPos({\n coordinate,\n dimension: 'rgCol',\n });\n await this.scrollToCoordinate({ x });\n }\n\n /**\n * Scrolls viewport to specified column by prop\n */\n @Method() async scrollToColumnProp(\n prop: ColumnProp,\n dimension: DimensionTypeCol = 'rgCol',\n ) {\n const coordinate = this.columnProvider.getColumnIndexByProp(\n prop,\n dimension,\n );\n if (coordinate < 0) {\n // already on the screen\n return;\n }\n const x = this.dimensionProvider.getViewPortPos({\n coordinate,\n dimension,\n });\n await this.scrollToCoordinate({ x });\n }\n\n /** Update columns */\n @Method() async updateColumns(cols: ColumnRegular[]) {\n this.columnProvider.updateColumns(cols);\n }\n\n /** Add trimmed by type */\n @Method() async addTrimmed(\n trimmed: Record<number, boolean>,\n trimmedType = 'external',\n type: DimensionRows = 'rgRow',\n ) {\n const event = this.beforetrimmed.emit({\n trimmed,\n trimmedType,\n type,\n });\n if (event.defaultPrevented) {\n return event;\n }\n this.dataProvider.setTrimmed({ [trimmedType]: event.detail.trimmed }, type);\n this.aftertrimmed.emit();\n return event;\n }\n\n /** Scrolls view port to coordinate */\n @Method() async scrollToCoordinate(cell: Partial<Cell>) {\n this.viewport?.scrollToCell(cell);\n }\n\n /** Open editor for cell. */\n @Method() async setCellEdit(\n rgRow: number,\n prop: ColumnProp,\n rowSource: DimensionRows = 'rgRow',\n ) {\n const rgCol = ColumnDataProvider.getColumnByProp(this.columns, prop);\n if (!rgCol) {\n return;\n }\n await timeout();\n const colGroup = rgCol.pin || 'rgCol';\n this.viewport?.setEdit(\n rgRow,\n this.columnProvider.getColumnIndexByProp(prop, colGroup),\n colGroup,\n rowSource,\n );\n }\n\n /** Set focus range. */\n @Method() async setCellsFocus(\n cellStart: Cell = { x: 0, y: 0 },\n cellEnd: Cell = { x: 0, y: 0 },\n colType = 'rgCol',\n rowType = 'rgRow',\n ) {\n this.viewport?.setFocus(colType, rowType, cellStart, cellEnd);\n }\n\n /** Get data from source */\n @Method() async getSource(type: DimensionRows = 'rgRow') {\n return this.dataProvider.stores[type].store.get('source');\n }\n\n /**\n * Get data from visible part of source\n * Trimmed/filtered rows will be excluded\n * @param type - type of source\n */\n @Method() async getVisibleSource(type: DimensionRows = 'rgRow') {\n return getVisibleSourceItem(this.dataProvider.stores[type].store);\n }\n\n /**\n * Provides access to rows internal store observer\n * Can be used for plugin support\n * @param type - type of source\n */\n @Method() async getSourceStore(\n type: DimensionRows = 'rgRow',\n ): Promise<Observable<DSourceState<DataType, DimensionRows>>> {\n return this.dataProvider.stores[type].store;\n }\n /**\n * Provides access to column internal store observer\n * Can be used for plugin support\n * @param type - type of column\n */\n @Method() async getColumnStore(\n type: DimensionCols = 'rgCol',\n ): Promise<Observable<DSourceState<ColumnRegular, DimensionCols>>> {\n return this.columnProvider.stores[type].store;\n }\n\n /**\n * Update column sorting\n * @param column - full column details to update\n * @param index - virtual column index\n * @param order - order to apply\n */\n @Method() async updateColumnSorting(\n column: ColumnRegular,\n index: number,\n order: 'asc' | 'desc',\n additive: boolean,\n ) {\n return this.columnProvider.updateColumnSorting(\n column,\n index,\n order,\n additive,\n );\n }\n\n /**\n * Clears column sorting\n */\n @Method() async clearSorting() {\n this.columnProvider.clearSorting();\n }\n\n /**\n * Receive all columns in data source\n */\n @Method() async getColumns(): Promise<ColumnRegular[]> {\n return this.columnProvider.getColumns();\n }\n\n /**\n * Clear current grid focus. Grid has no longer focus on it.\n */\n @Method() async clearFocus() {\n const focused = this.viewport?.getFocused();\n const event = this.beforefocuslost.emit(focused);\n if (event.defaultPrevented) {\n return;\n }\n this.selectionStoreConnector.clearAll();\n }\n\n /**\n * Get all active plugins instances\n */\n @Method() async getPlugins(): Promise<PluginBaseComponent[]> {\n return [...this.internalPlugins];\n }\n\n /**\n * Get the currently focused cell.\n */\n @Method() async getFocused(): Promise<FocusedData | null> {\n return this.viewport?.getFocused();\n }\n\n /**\n * Get size of content\n * Including all pinned data\n */\n @Method() async getContentSize(): Promise<Cell> {\n return this.dimensionProvider?.getFullSize();\n }\n /**\n * Get the currently selected Range.\n */\n @Method() async getSelectedRange(): Promise<RangeArea | null> {\n return this.viewport?.getSelectedRange();\n }\n\n // #endregion\n\n // #region Listeners outside scope\n private clickTrackForFocusClear: number | null = null;\n @Listen('touchstart', { target: 'document' })\n @Listen('mousedown', { target: 'document' })\n mousedownHandle(event: MouseEvent | TouchEvent) {\n const screenX = getPropertyFromEvent(event, 'screenX');\n const screenY = getPropertyFromEvent(event, 'screenY');\n if (screenX === null || screenY === null) {\n return;\n }\n\n this.clickTrackForFocusClear = screenX + screenY;\n }\n /**\n * To keep your elements from losing focus use mouseup/touchend e.preventDefault();\n */\n @Listen('touchend', { target: 'document' })\n @Listen('mouseup', { target: 'document' })\n mouseupHandle(event: MouseEvent | TouchEvent) {\n const screenX = getPropertyFromEvent(event, 'screenX');\n const screenY = getPropertyFromEvent(event, 'screenY');\n if (screenX === null || screenY === null) {\n return;\n }\n\n if (event.defaultPrevented) {\n return;\n }\n const target = event.target as HTMLElement | null;\n const pos = screenX + screenY;\n // detect if mousemove then do nothing\n if (Math.abs(this.clickTrackForFocusClear - pos) > 10) {\n return;\n }\n\n // check if action finished inside of the document\n // clear data which is outside of grid\n // if event prevented or it is current table don't clear focus\n if (target?.closest(`[${UUID}=\"${this.uuid}\"]`)) {\n return;\n }\n this.clearFocus();\n }\n // #endregion\n\n // #region Listeners\n /** Drag events */\n @Listen('rowdragstartinit') onRowDragStarted(\n e: CustomEvent<{\n pos: PositionItem;\n text: string;\n event: MouseEvent;\n }>,\n ) {\n const dragStart = this.rowdragstart.emit(e.detail);\n if (dragStart.defaultPrevented) {\n e.preventDefault();\n return;\n }\n this.orderService?.start(this.element, {\n ...e.detail,\n ...dragStart.detail,\n });\n }\n\n @Listen('rowdragendinit') onRowDragEnd() {\n this.orderService?.end();\n }\n\n @Listen('rowdragmoveinit') onRowDrag({ detail }: CustomEvent<PositionItem>) {\n this.orderService?.move(detail);\n }\n\n @Listen('rowdragmousemove') onRowMouseMove(e: CustomEvent<Cell>) {\n this.orderService?.moveTip(e.detail);\n }\n\n @Listen('celleditapply') async onCellEdit(\n e: CustomEvent<BeforeSaveDataDetails>,\n ) {\n const { defaultPrevented, detail } = this.beforeedit.emit(e.detail);\n await timeout();\n // apply data\n if (!defaultPrevented) {\n this.dataProvider.setCellData(detail);\n\n // @feature: incrimental update for cells\n // this.dataProvider.setCellData(detail, false);\n // await this.setDataAt({\n // row: detail.rowIndex,\n // col: detail.colIndex,\n // rowType: detail.type,\n // colType: detail.colType,\n // });\n this.afteredit.emit(detail);\n }\n }\n\n @Listen('rangeeditapply') onRangeEdit(\n e: CustomEvent<BeforeRangeSaveDataDetails>,\n ) {\n const { defaultPrevented, detail } = this.beforerangeedit.emit(e.detail);\n if (defaultPrevented) {\n e.preventDefault();\n return;\n }\n this.dataProvider.setRangeData(detail.data, detail.type);\n this.afteredit.emit(detail);\n }\n\n @Listen('selectionchangeinit') onRangeChanged(e: CustomEvent<ChangedRange>) {\n const beforeange = this.beforeange.emit(e.detail);\n if (beforeange.defaultPrevented) {\n e.preventDefault();\n }\n const beforeFill = this.beforeautofill.emit(beforeange.detail);\n if (beforeFill.defaultPrevented) {\n e.preventDefault();\n }\n }\n\n @Listen('rowdropinit') onRowDropped(\n e: CustomEvent<{ from: number; to: number }>,\n ) {\n // e.cancelBubble = true;\n const { defaultPrevented } = this.roworderchanged.emit(e.detail);\n if (defaultPrevented) {\n e.preventDefault();\n }\n }\n\n @Listen('beforeheaderclick') onHeaderClick(\n e: CustomEvent<InitialHeaderClick>,\n ) {\n const { defaultPrevented } = this.headerclick.emit({\n ...e.detail.column,\n originalEvent: e.detail.originalEvent,\n });\n if (defaultPrevented) {\n e.preventDefault();\n }\n }\n\n @Listen('beforecellfocusinit') onCellFocus(\n e: CustomEvent<BeforeSaveDataDetails>,\n ) {\n const { defaultPrevented } = this.beforecellfocus.emit(e.detail);\n if (!this.canFocus || defaultPrevented) {\n e.preventDefault();\n }\n }\n\n // #endregion\n\n // #region Private Properties\n @Element() element: HTMLRevoGridElement;\n private extraElements: VNode[] = [];\n\n // UUID required to support multiple grids in one page and avoid collision\n uuid: string | null = null;\n columnProvider: ColumnDataProvider;\n dataProvider: DataProvider;\n dimensionProvider: DimensionProvider;\n viewportProvider: ViewportProvider;\n private themeService: ThemeService;\n private viewport: ViewportService | null = null;\n private isInited = false;\n\n private orderService: OrdererService;\n private selectionStoreConnector: SelectionStoreConnector;\n private scrollingService: GridScrollingService;\n\n /**\n * Plugins\n * Define plugins collection\n */\n private internalPlugins: PluginBaseComponent[] = [];\n // #endregion\n\n // #region Watchers\n @Watch('columnTypes') columnTypesChanged() {\n // Column format change will trigger column structure update\n this.columnChanged(this.columns);\n }\n @Watch('columns') columnChanged(newVal: ColumnDataSchema[] = []) {\n const columnGather = ColumnDataProvider.getColumns(\n newVal,\n 0,\n this.columnTypes,\n );\n this.beforecolumnsset.emit(columnGather);\n this.dimensionProvider.applyNewColumns(\n columnGather.columns,\n this.disableVirtualX,\n );\n this.beforecolumnapplied.emit(columnGather);\n const columns = this.columnProvider.setColumns(columnGather);\n this.aftercolumnsset.emit({\n columns,\n order: this.columnProvider.order,\n });\n }\n\n @Watch('disableVirtualX') disableVirtualXChanged(\n newVal = false,\n prevVal = false,\n ) {\n if (newVal === prevVal) {\n return;\n }\n this.columnChanged(this.columns);\n }\n\n @Watch('rowSize') rowSizeChanged(s: number) {\n // clear existing data\n this.dimensionProvider.setSettings({ originItemSize: s }, 'rgRow');\n this.rowDefChanged(this.rowDefinitions, this.rowDefinitions);\n }\n\n @Watch('theme') themeChanged(\n t: Theme,\n _?: Theme,\n __ = 'theme',\n init = false,\n ) {\n this.themeService.register(t);\n this.dimensionProvider.setSettings(\n { originItemSize: this.themeService.rowSize },\n 'rgRow',\n );\n this.dimensionProvider.setSettings(\n { originItemSize: this.colSize },\n 'rgCol',\n );\n // if theme change we need to reapply row size and reset viewport\n if (!init) {\n // clear existing data\n this.dimensionProvider.setSettings(\n { originItemSize: this.themeService.rowSize },\n 'rgRow',\n );\n this.rowDefChanged(\n // for cases when some custom size present and not\n this.rowDefinitions.length\n ? this.rowDefinitions\n : [\n {\n type: 'rgRow',\n size: this.themeService.rowSize,\n index: 0,\n },\n ],\n this.rowDefinitions,\n );\n }\n }\n\n @Watch('source')\n @Watch('pinnedBottomSource')\n @Watch('pinnedTopSource')\n dataSourceChanged<T extends DataType>(\n newVal: T[] = [],\n _: T[] | undefined,\n watchName: string,\n ) {\n let type: DimensionRows = 'rgRow';\n switch (watchName) {\n case 'pinnedBottomSource':\n type = 'rowPinEnd';\n break;\n case 'pinnedTopSource':\n type = 'rowPinStart';\n break;\n case 'source':\n type = 'rgRow';\n /** applied for source only for cross compatability between plugins */\n const beforesourceset = this.beforesourceset.emit({\n type,\n source: newVal,\n });\n newVal = beforesourceset.detail.source as T[];\n break;\n }\n const beforesourceset = this.beforeanysource.emit({\n type,\n source: newVal,\n });\n const newSource = [...beforesourceset.detail.source];\n this.dataProvider.setData(newSource, type, this.disableVirtualY);\n\n /** applied for source only for cross compatability between plugins */\n if (watchName === 'source') {\n this.aftersourceset.emit({\n type,\n source: newVal,\n });\n }\n this.afteranysource.emit({\n type,\n source: newVal,\n });\n }\n\n @Watch('disableVirtualY') disableVirtualYChanged(\n newVal = false,\n prevVal = false,\n ) {\n if (newVal === prevVal) {\n return;\n }\n this.dataSourceChanged(this.source, this.source, 'source');\n }\n\n @Watch('rowDefinitions') rowDefChanged(\n after: RowDefinition[],\n before?: RowDefinition[],\n ) {\n const {\n detail: { vals: newVal, oldVals: oldVal },\n } = this.beforerowdefinition.emit({\n vals: after,\n oldVals: before,\n });\n // apply new vals\n const newRows = rowDefinitionByType(newVal);\n // clear current defs\n if (oldVal) {\n const remove = rowDefinitionRemoveByType(oldVal);\n // clear all old data and drop sizes\n each(remove, (_, t: DimensionRows) => {\n this.dimensionProvider.clearSize(\n t,\n this.dataProvider.stores[t].store.get('source').length,\n );\n });\n }\n if (!newVal.length) {\n return;\n }\n each(newRows, (r, k: DimensionRows) =>\n this.dimensionProvider.setCustomSizes(k, r.sizes || {}),\n );\n }\n\n @Watch('trimmedRows') trimmedRowsChanged(\n newVal: Record<number, boolean> = {},\n ) {\n this.addTrimmed(newVal);\n }\n /**\n * Grouping\n */\n @Watch('grouping') groupingChanged(newVal: GroupingOptions = {}) {\n let grPlugin: GroupingRowPlugin | undefined;\n for (let p of this.internalPlugins) {\n const isGrouping = p as unknown as GroupingRowPlugin;\n if (isGrouping.setGrouping) {\n grPlugin = isGrouping;\n break;\n }\n }\n if (!grPlugin) {\n return;\n }\n grPlugin.setGrouping(newVal || {});\n }\n /**\n * Stretch Plugin Apply\n */\n @Watch('stretch') applyStretch(isStretch: boolean | string) {\n if (isStretch === 'false') {\n isStretch = false;\n }\n let stretch = this.internalPlugins.filter(p => isStretchPlugin(p))[0];\n if ((typeof isStretch === 'boolean' && isStretch) || isStretch === 'true') {\n if (!stretch) {\n const pluginData: PluginProviders = {\n data: this.dataProvider,\n column: this.columnProvider,\n dimension: this.dimensionProvider,\n viewport: this.viewportProvider,\n selection: this.selectionStoreConnector,\n };\n this.internalPlugins.push(new StretchColumn(this.element, pluginData));\n } else if (isStretchPlugin(stretch)) {\n stretch.applyStretch(this.columnProvider.getRawColumns());\n }\n } else if (stretch) {\n const index = this.internalPlugins.indexOf(stretch);\n this.internalPlugins.splice(index, 1);\n }\n }\n\n @Watch('filter') applyFilter(cfg: boolean | ColumnFilterConfig) {\n this.filterconfigchanged.emit(cfg);\n }\n\n @Watch('rowHeaders') rowHeadersChange(rowHeaders?: RowHeaders | boolean) {\n this.rowheaderschanged.emit(rowHeaders);\n }\n\n /**\n * Register external VNodes\n */\n @Watch('registerVNode') registerOutsideVNodes(elements: VNode[] = []) {\n this.extraElements = [...this.extraElements, ...elements];\n }\n // #endregion\n\n // #region Plugins\n private setPlugins() {\n // remove old plugins if any\n this.removePlugins();\n\n // pass data provider to plugins\n const pluginData: PluginProviders = {\n data: this.dataProvider,\n column: this.columnProvider,\n dimension: this.dimensionProvider,\n viewport: this.viewportProvider,\n selection: this.selectionStoreConnector,\n };\n\n // register auto size plugin\n if (this.autoSizeColumn) {\n this.internalPlugins.push(\n new AutoSize(\n this.element,\n pluginData,\n typeof this.autoSizeColumn === 'object'\n ? this.autoSizeColumn\n : undefined,\n ),\n );\n }\n\n // register filter plugin\n if (this.filter) {\n this.internalPlugins.push(\n new FilterPlugin(\n this.element,\n pluginData,\n this.uuid,\n typeof this.filter === 'object' ? this.filter : undefined,\n ),\n );\n }\n\n // register export plugin\n if (this.exporting) {\n this.internalPlugins.push(new ExportFilePlugin(this.element, pluginData));\n }\n\n // register sorting plugin\n this.internalPlugins.push(new SortingPlugin(this.element, pluginData));\n\n // register grouping plugin\n this.internalPlugins.push(new GroupingRowPlugin(this.element, pluginData));\n if (this.canMoveColumns) {\n this.internalPlugins.push(new ColumnPlugin(this.element, pluginData));\n }\n\n // register user plugins\n this.plugins?.forEach(p => this.internalPlugins.push(new p(this.element, pluginData)));\n }\n\n private removePlugins() {\n this.internalPlugins.forEach(p => p.destroy());\n this.internalPlugins = [];\n }\n // #endregion\n\n\n // if reconnect to dom we need to set up plugins\n connectedCallback() {\n if (this.isInited) {\n this.setPlugins();\n }\n }\n\n /**\n * Called once just after the component is first connected to the DOM.\n * Since this method is only called once, it's a good place to load data asynchronously and to setup the state\n * without triggering extra re-renders.\n * A promise can be returned, that can be used to wait for the first render().\n */\n componentWillLoad() {\n // #region Setup Providers\n this.viewportProvider = new ViewportProvider();\n this.themeService = new ThemeService({\n rowSize: this.rowSize,\n });\n this.dimensionProvider = new DimensionProvider(this.viewportProvider, {\n realSizeChanged: (k: MultiDimensionType) =>\n this.contentsizechanged.emit(k),\n });\n this.columnProvider = new ColumnDataProvider();\n this.selectionStoreConnector = new SelectionStoreConnector();\n this.dataProvider = new DataProvider(this.dimensionProvider);\n // #endregion\n\n // generate uuid for this grid\n this.uuid = `rv--${Math.random().toString(36).slice(2, 6)}-${Date.now()}`;\n\n this.registerOutsideVNodes(this.registerVNode);\n\n // init plugins\n this.setPlugins();\n\n // set data\n this.applyStretch(this.stretch);\n this.themeChanged(this.theme, undefined, undefined, true);\n this.columnChanged(this.columns);\n this.dataSourceChanged(this.source, undefined, 'source');\n this.dataSourceChanged(this.pinnedTopSource, undefined, 'pinnedTopSource');\n this.dataSourceChanged(\n this.pinnedBottomSource,\n undefined,\n 'pinnedBottomSource',\n );\n this.trimmedRowsChanged(this.trimmedRows);\n this.rowDefChanged(this.rowDefinitions);\n this.groupingChanged(this.grouping);\n\n // init scrolling service\n this.scrollingService = new GridScrollingService(\n (e: ViewPortScrollEvent) => {\n this.dimensionProvider.setViewPortCoordinate({\n coordinate: e.coordinate,\n type: e.dimension,\n });\n this.viewportscroll.emit(e);\n },\n );\n\n this.aftergridinit.emit();\n // set inited flag for connectedCallback\n this.isInited = true;\n }\n\n componentWillRender() {\n const event = this.beforegridrender.emit();\n if (event.defaultPrevented) {\n return false;\n }\n return Promise.all(this.jobsBeforeRender);\n }\n\n render() {\n const contentHeight =\n this.dimensionProvider.stores['rgRow'].store.get('realSize');\n\n // init viewport service helpers\n this.viewport = new ViewportService(\n {\n columnProvider: this.columnProvider,\n dataProvider: this.dataProvider,\n dimensionProvider: this.dimensionProvider,\n viewportProvider: this.viewportProvider,\n scrollingService: this.scrollingService,\n orderService: this.orderService,\n selectionStoreConnector: this.selectionStoreConnector,\n disableVirtualX: this.disableVirtualX,\n disableVirtualY: this.disableVirtualY,\n resize: c => this.aftercolumnresize.emit(c),\n },\n contentHeight,\n );\n\n // #region ViewportSections\n /**\n * The code renders a viewport divided into sections.\n * It starts by rendering the pinned start, data, and pinned end sections.\n * Within each section, it renders columns along with their headers, pinned top, center data, and pinned bottom.\n * The code iterates over the columns and their data to generate the view port's HTML structure.\n */\n\n const viewportSections: (VNode | VNode[])[] = [];\n\n // Row headers setting\n if (this.rowHeaders && this.viewport.columns.length) {\n const anyView = this.viewport.columns[0];\n viewportSections.push(\n <revogr-row-headers\n additionalData={this.additionalData}\n height={contentHeight}\n rowClass={this.rowClass}\n resize={this.resize}\n dataPorts={anyView.dataPorts}\n headerProp={anyView.headerProp}\n jobsBeforeRender={this.jobsBeforeRender}\n rowHeaderColumn={\n typeof this.rowHeaders === 'object' ? this.rowHeaders : undefined\n }\n onScrollview={({ detail: e }: CustomEvent) =>\n this.scrollingService.proxyScroll(e, 'headerRow')\n }\n onRef={({ detail: e }: CustomEvent) =>\n this.scrollingService.registerElement(e, 'headerRow')\n }\n />,\n );\n }\n\n // Viewport section render\n const isMobile = isMobileDevice();\n const viewPortHtml: VNode[] = [];\n\n // Render viewports column(horizontal sections)\n for (let view of this.viewport.columns) {\n const headerProperties: HeaderProperties = {\n ...view.headerProp,\n type: view.type,\n additionalData: this.additionalData,\n viewportCol: view.viewportCol,\n selectionStore: view.columnSelectionStore,\n canResize: this.resize,\n readonly: this.readonly,\n columnFilter: !!this.filter,\n };\n // Column headers\n const dataViews: VNode[] = [\n <revogr-header {...headerProperties} slot={HEADER_SLOT} />,\n ];\n\n // Render viewport data (vertical sections)\n view.dataPorts.forEach(data => {\n const key = `${data.type}_${view.type}`;\n const dataView = (\n <revogr-overlay-selection\n {...data}\n isMobileDevice={isMobile}\n selectionStore={data.segmentSelectionStore}\n onSelectall={() => this.selectionStoreConnector.selectAll()}\n editors={this.editors}\n readonly={this.readonly}\n range={this.range}\n useClipboard={this.useClipboard}\n applyChangesOnClose={this.applyOnClose}\n additionalData={this.additionalData}\n slot={data.slot}\n onCanceledit={() => this.selectionStoreConnector.setEdit(false)}\n onSetedit={({ detail }) => {\n const event = this.beforeeditstart.emit(detail);\n if (!event.defaultPrevented) {\n this.selectionStoreConnector.setEdit(detail.val);\n }\n }}\n >\n <revogr-data\n {...data}\n colType={view.type}\n key={key}\n readonly={this.readonly}\n range={this.range}\n rowClass={this.rowClass}\n rowSelectionStore={data.rowSelectionStore}\n additionalData={this.additionalData}\n jobsBeforeRender={this.jobsBeforeRender}\n slot={DATA_SLOT}\n >\n <slot name={`data-${view.type}-${data.type}`} />\n </revogr-data>\n <revogr-temp-range\n selectionStore={data.segmentSelectionStore}\n dimensionRow={data.dimensionRow}\n dimensionCol={data.dimensionCol}\n />\n <revogr-focus\n colData={data.colData}\n dataStore={data.dataStore}\n focusTemplate={this.focusTemplate}\n rowType={data.type}\n colType={view.type}\n selectionStore={data.segmentSelectionStore}\n dimensionRow={data.dimensionRow}\n dimensionCol={data.dimensionCol}\n >\n <slot name={`focus-${view.type}-${data.type}`} />\n </revogr-focus>\n </revogr-overlay-selection>\n );\n\n dataViews.push(dataView);\n });\n\n // Add viewport scroll in the end\n viewPortHtml.push(\n <revogr-viewport-scroll\n {...view.prop}\n ref={el =>\n this.scrollingService.registerElement(el, `${view.prop.key}`)\n }\n onScrollviewport={e =>\n this.scrollingService.proxyScroll(e.detail, `${view.prop.key}`)\n }\n onScrollviewportsilent={e =>\n this.scrollingService.scrollSilentService(\n e.detail,\n `${view.prop.key}`,\n )\n }\n >\n {dataViews}\n </revogr-viewport-scroll>,\n );\n }\n\n viewportSections.push(viewPortHtml);\n // #endregion\n\n const typeRow: DimensionType = 'rgRow';\n const typeCol: DimensionType = 'rgCol';\n\n const viewports = this.viewportProvider.stores;\n const dimensions = this.dimensionProvider.stores;\n\n return (\n <Host {...{ [`${UUID}`]: this.uuid }}>\n {this.hideAttribution ? null : (\n <revogr-attribution class=\"attribution\" />\n )}\n <div\n class=\"main-viewport\"\n onClick={(e: MouseEvent) => {\n if (e.currentTarget === e.target) {\n this.viewport.clearEdit();\n }\n }}\n >\n <div class=\"viewports\">\n <slot name=\"viewport\" />\n {viewportSections}\n <revogr-scroll-virtual\n class=\"vertical\"\n dimension={typeRow}\n viewportStore={viewports[typeRow].store}\n dimensionStore={dimensions[typeRow].store}\n ref={el => this.scrollingService.registerElement(el, 'rowScroll')}\n onScrollvirtual={e => this.scrollingService.proxyScroll(e.detail)}\n />\n <OrderRenderer ref={e => (this.orderService = e)} />\n </div>\n </div>\n <revogr-scroll-virtual\n class=\"horizontal\"\n dimension={typeCol}\n viewportStore={viewports[typeCol].store}\n dimensionStore={dimensions[typeCol].store}\n ref={el => this.scrollingService.registerElement(el, 'colScroll')}\n onScrollvirtual={e => this.scrollingService.proxyScroll(e.detail)}\n />\n {this.extraElements}\n </Host>\n );\n }\n\n disconnectedCallback() {\n // Remove all plugins, to avoid memory leaks and unexpected behaviour when the component is removed\n this.removePlugins();\n }\n}\n"],"version":3}
|