@visactor/vtable 0.16.4-alpha.0 → 0.16.4-alpha.2
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/cjs/core/BaseTable.d.ts +1 -0
- package/cjs/core/BaseTable.js +12 -2
- package/cjs/core/BaseTable.js.map +1 -1
- package/cjs/data/DataSource.js +2 -1
- package/cjs/data/DataSource.js.map +1 -1
- package/cjs/dataset/dataset.js +21 -22
- package/cjs/dataset/dataset.js.map +1 -1
- package/cjs/index.d.ts +1 -1
- package/cjs/index.js +1 -1
- package/cjs/index.js.map +1 -1
- package/cjs/layout/pivot-layout-helper.d.ts +1 -0
- package/cjs/layout/pivot-layout-helper.js +5 -2
- package/cjs/layout/pivot-layout-helper.js.map +1 -1
- package/cjs/tools/diff-cell.d.ts +1 -1
- package/cjs/tools/diff-cell.js +32 -2
- package/cjs/tools/diff-cell.js.map +1 -1
- package/cjs/ts-types/base-table.d.ts +1 -0
- package/cjs/ts-types/base-table.js.map +1 -1
- package/cjs/ts-types/new-data-set.d.ts +8 -2
- package/cjs/ts-types/new-data-set.js.map +1 -1
- package/cjs/ts-types/style-define.d.ts +3 -0
- package/cjs/ts-types/style-define.js.map +1 -1
- package/dist/vtable.js +98 -64
- package/dist/vtable.min.js +2 -2
- package/es/core/BaseTable.d.ts +1 -0
- package/es/core/BaseTable.js +12 -2
- package/es/core/BaseTable.js.map +1 -1
- package/es/data/DataSource.js +3 -2
- package/es/data/DataSource.js.map +1 -1
- package/es/dataset/dataset.js +21 -22
- package/es/dataset/dataset.js.map +1 -1
- package/es/index.d.ts +1 -1
- package/es/index.js +1 -1
- package/es/index.js.map +1 -1
- package/es/layout/pivot-layout-helper.d.ts +1 -0
- package/es/layout/pivot-layout-helper.js +5 -2
- package/es/layout/pivot-layout-helper.js.map +1 -1
- package/es/tools/diff-cell.d.ts +1 -1
- package/es/tools/diff-cell.js +31 -1
- package/es/tools/diff-cell.js.map +1 -1
- package/es/ts-types/base-table.d.ts +1 -0
- package/es/ts-types/base-table.js.map +1 -1
- package/es/ts-types/new-data-set.d.ts +8 -2
- package/es/ts-types/new-data-set.js.map +1 -1
- package/es/ts-types/style-define.d.ts +3 -0
- package/es/ts-types/style-define.js.map +1 -1
- package/package.json +4 -4
package/cjs/data/DataSource.js
CHANGED
|
@@ -186,7 +186,8 @@ class DataSource extends EventTarget_1.EventTarget {
|
|
|
186
186
|
computeChildrenNodeLength(indexed, state, data), this.currentIndexedData.splice(this.currentIndexedData.indexOf(indexed) + 1, childrenLength),
|
|
187
187
|
this.treeDataHierarchyState.set(Array.isArray(indexed) ? indexed.join(",") : indexed, ts_types_1.HierarchyState.collapse);
|
|
188
188
|
}
|
|
189
|
-
|
|
189
|
+
this.updatePagerData();
|
|
190
|
+
return (0, diff_cell_1.calculateArrayDiff)(oldIndexedData, this.currentIndexedData);
|
|
190
191
|
}
|
|
191
192
|
pushChildrenNode(indexKey, hierarchyState, nodeData) {
|
|
192
193
|
if (!hierarchyState || hierarchyState === ts_types_1.HierarchyState.collapse || hierarchyState === ts_types_1.HierarchyState.none) return 0;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/data/DataSource.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,oDAAsC;AAYtC,0CAA6C;AAC7C,4CAAsF;AACtF,sDAAmD;AACnD,wCAA4D;AAC5D,kDAAqD;AACrD,6CAAsD;AAStD,SAAS,eAAe,CAAC,KAAsC;IAC7D,IAAI,YAAG,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE;QACvB,MAAM,CAAC,GAAG,KAAsB,CAAC;QACjC,IAAI,IAAA,gBAAO,EAAC,CAAC,CAAC,GAAG,CAAC,IAAI,IAAA,gBAAO,EAAC,CAAC,CAAC,GAAG,CAAC,EAAE;YACpC,OAAO,IAAI,CAAC;SACb;KACF;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AACD,MAAM,UAAU,GAAG;IACjB,oBA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,KAAK,CAAC;SACd;QACD,IAAI,OAAO,KAAK,KAAK,UAAU,EAAE;YAC/B,OAAO,IAAI,CAAC;SACb;QACD,MAAM,MAAM,GAAG,IAAI,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAC;QAC7C,OAAO,OAAO,CAAC,MAAM,IAAK,KAAa,IAAK,MAAc,CAAC,CAAC;IAC9D,CAAC;IAES,oBAAoB,CAC5B,MAAyB,EACzB,MAAuC,EACvC,MAA+B;IAGjC,CAAC;IACS,qBAAqB,CAAC,MAAyB,EAAE,OAAgC;IAE3F,CAAC;;AAxrBH,gCAgsBC;AANQ,gBAAK,GAAG,IAAI,UAAU,CAAC;IAC5B,GAAG;IAEH,CAAC;IACD,MAAM,EAAE,CAAC;CACV,CAAC,CAAC","file":"DataSource.js","sourcesContent":["import * as sort from '../tools/sort';\nimport type {\n DataSourceAPI,\n FieldAssessor,\n FieldData,\n FieldDef,\n FieldFormat,\n IPagination,\n MaybePromiseOrCallOrUndefined,\n MaybePromiseOrUndefined,\n SortOrder\n} from '../ts-types';\nimport { HierarchyState } from '../ts-types';\nimport { applyChainSafe, getOrApply, obj, isPromise, emptyFn } from '../tools/helper';\nimport { EventTarget } from '../event/EventTarget';\nimport { getValueByPath, isAllDigits } from '../tools/util';\nimport { diffCellIndices } from '../tools/diff-cell';\nimport { cloneDeep, isValid } from '@visactor/vutils';\nimport type { BaseTableAPI } from '../ts-types/base-table';\nimport { TABLE_EVENT_TYPE } from '../core/TABLE_EVENT_TYPE';\n\n/**\n * 判断字段数据是否为访问器的格式\n * @param field\n * @returns boolean\n */\nfunction isFieldAssessor(field: FieldDef | FieldFormat | number): field is FieldAssessor {\n if (obj.isObject(field)) {\n const a = field as FieldAssessor;\n if (isValid(a.get) && isValid(a.set)) {\n return true;\n }\n }\n return false;\n}\nconst EVENT_TYPE = {\n SOURCE_LENGTH_UPDATE: 'source_length_update',\n CHANGE_ORDER: 'change_order'\n} as const;\ntype PromiseBack = (value: MaybePromiseOrUndefined) => void;\n\n/**\n * 获取到的某个filed的值 处理可能为promise的情况\n * @param value\n * @param promiseCallBack\n * @returns\n */\nfunction getValue(value: MaybePromiseOrCallOrUndefined, promiseCallBack: PromiseBack): MaybePromiseOrUndefined {\n const maybePromiseOrValue = getOrApply(value);\n if (isPromise(maybePromiseOrValue)) {\n const promiseValue = maybePromiseOrValue.then((r: any) => {\n promiseCallBack(r);\n return r;\n });\n\n promiseCallBack(promiseValue);\n return promiseValue;\n }\n return maybePromiseOrValue;\n}\n/**\n * 根据field获取数据源record对应的值 获取到的可能是个异步Promise 需要设置回调处理逻辑\n * @param record\n * @param field\n * @param promiseCallBack\n * @returns\n */\nexport function getField(\n record: MaybePromiseOrUndefined,\n field: FieldDef | FieldFormat | number,\n col: number,\n row: number,\n table: BaseTableAPI,\n promiseCallBack: PromiseBack\n): FieldData {\n if (record === null || record === undefined) {\n return undefined;\n }\n if (isPromise(record)) {\n return record.then((r: any) => getField(r, field, col, row, table, promiseCallBack));\n }\n const fieldGet: any = isFieldAssessor(field) ? field.get : field;\n if (fieldGet in (record as any)) {\n const fieldResult = (record as any)[fieldGet];\n\n return getValue(fieldResult, promiseCallBack);\n }\n if (typeof fieldGet === 'function') {\n const fieldResult = fieldGet(record, col, row, table);\n return getValue(fieldResult, promiseCallBack);\n }\n if (Array.isArray(fieldGet)) {\n const fieldResult = getValueByPath(record, [...fieldGet]);\n return getValue(fieldResult, promiseCallBack);\n }\n const fieldArray = `${fieldGet}`.split('.');\n if (fieldArray.length <= 1) {\n const fieldResult = (record as any)[fieldGet];\n return getValue(fieldResult, promiseCallBack);\n }\n const fieldResult = applyChainSafe(\n record,\n (val, name) => getField(val, name, col, row, table, emptyFn as any),\n ...fieldArray\n );\n return getValue(fieldResult, promiseCallBack);\n}\n\nfunction _getIndex(sortedIndexMap: null | (number | number[])[], index: number): number | number[] {\n if (!sortedIndexMap) {\n return index;\n }\n const mapIndex = sortedIndexMap[index];\n return isValid(mapIndex) ? mapIndex : index;\n}\n\nexport interface DataSourceParam {\n get: (index: number) => any;\n length: number;\n source?: any;\n}\nexport interface ISortedMapItem {\n asc?: (number | number[])[];\n desc?: (number | number[])[];\n normal?: (number | number[])[];\n}\n\nexport class DataSource extends EventTarget implements DataSourceAPI {\n private _get: (index: number | number[]) => any;\n /** 数据条目数 如果是树形结构的数据 则是第一层父节点的数量 */\n private _sourceLength: number;\n\n private readonly _source: any;\n /**\n * 缓存按字段进行排序的结果\n */\n protected sortedIndexMap: Map<FieldDef, ISortedMapItem>;\n /**\n * 记录最近一次排序规则 当展开树形结构的节点时需要用到\n */\n private lastOrder: SortOrder;\n private lastOrderFn: (a: any, b: any, order: string) => number;\n private lastOrderField: FieldDef;\n /** 每一行对应源数据的索引 */\n protected currentIndexedData: (number | number[])[] | null = [];\n protected userPagination: IPagination;\n protected pagination: IPagination;\n /** 当前页每一行对应源数据的索引 */\n protected _currentPagerIndexedData: (number | number[])[];\n // 当前是否为层级的树形结构 排序时判断该值确实是否继续进行子节点排序\n enableHierarchyState = false;\n static get EVENT_TYPE(): typeof EVENT_TYPE {\n return EVENT_TYPE;\n }\n protected treeDataHierarchyState: Map<number | string, HierarchyState> = new Map();\n beforeChangedRecordsMap: Record<number, any>[] = [];\n constructor(obj?: DataSourceParam | DataSource, pagination?: IPagination, hierarchyExpandLevel?: number) {\n super();\n\n this._get = obj?.get.bind(obj) || (undefined as any);\n this._sourceLength = obj?.length || 0;\n this._source = obj?.source ?? obj;\n this.sortedIndexMap = new Map<string, ISortedMapItem>();\n\n this._currentPagerIndexedData = [];\n this.userPagination = pagination;\n this.pagination = pagination || {\n totalCount: this._sourceLength,\n perPageCount: this._sourceLength,\n currentPage: 0\n };\n if (hierarchyExpandLevel >= 1) {\n this.enableHierarchyState = true;\n }\n // 初始化currentIndexedData 正常未排序。设置其状态\n this.currentIndexedData = Array.from({ length: this._sourceLength }, (_, i) => i);\n if (this.enableHierarchyState) {\n for (let i = 0; i < this._sourceLength; i++) {\n //expandLevel为有效值即需要按tree分析展示数据\n const nodeData = this.getOriginalRecord(i);\n (nodeData as any).children && this.treeDataHierarchyState.set(i, HierarchyState.collapse);\n }\n }\n if (hierarchyExpandLevel > 1) {\n let nodeLength = this._sourceLength;\n for (let i = 0; i < nodeLength; i++) {\n const indexKey = this.currentIndexedData[i];\n const nodeData = this.getOriginalRecord(indexKey);\n if ((nodeData as any).children?.length > 0) {\n this.treeDataHierarchyState.set(\n Array.isArray(indexKey) ? indexKey.join(',') : indexKey,\n HierarchyState.expand\n );\n const childrenLength = this.initChildrenNodeHierarchy(indexKey, hierarchyExpandLevel, 2, nodeData);\n i += childrenLength;\n nodeLength += childrenLength;\n }\n }\n }\n this.updatePagerData();\n }\n /**\n * 初始化子节点的层次信息\n * @param indexKey 父节点的indexKey 即currentLevel-1的节点\n * @param hierarchyExpandLevel 需要展开层级数\n * @param currentLevel 当前要展开的是第几层\n * @param nodeData 父节点数据 即currentLevel-1的节点\n * @returns\n */\n initChildrenNodeHierarchy(\n indexKey: number | number[],\n // subNodeIndex:number,\n hierarchyExpandLevel: number,\n currentLevel: number,\n nodeData: any\n ): number {\n if (currentLevel > hierarchyExpandLevel) {\n return 0;\n }\n let childTotalLength = 0;\n const nodeLength = nodeData.children?.length ?? 0;\n for (let j = 0; j < nodeLength; j++) {\n childTotalLength += 1;\n const childNodeData = nodeData.children[j];\n const childIndexKey = Array.isArray(indexKey) ? indexKey.concat(j) : [indexKey, j];\n this.currentIndexedData.splice(\n this.currentIndexedData.indexOf(indexKey) + childTotalLength,\n // childTotalLength,\n 0,\n childIndexKey\n );\n if (childNodeData.children?.length > 0) {\n if (currentLevel < hierarchyExpandLevel) {\n this.treeDataHierarchyState.set(\n Array.isArray(childIndexKey) ? childIndexKey.join(',') : childIndexKey,\n HierarchyState.expand\n );\n } else {\n this.treeDataHierarchyState.set(\n Array.isArray(childIndexKey) ? childIndexKey.join(',') : childIndexKey,\n HierarchyState.collapse\n );\n }\n }\n\n childTotalLength += this.initChildrenNodeHierarchy(\n childIndexKey,\n hierarchyExpandLevel,\n currentLevel + 1,\n childNodeData\n );\n }\n return childTotalLength;\n }\n updatePagination(pagination?: IPagination): void {\n this.pagination = pagination || {\n totalCount: this._sourceLength,\n perPageCount: this._sourceLength,\n currentPage: 0\n };\n this.updatePagerData();\n }\n protected updatePagerData(): void {\n const { currentIndexedData } = this;\n const { perPageCount, currentPage } = this.pagination;\n const startIndex = perPageCount * (currentPage || 0);\n const endIndex = startIndex + perPageCount;\n this._currentPagerIndexedData.length = 0;\n if (currentIndexedData && currentIndexedData.length > 0) {\n // this._currentPagerIndexedData = currentIndexedData.slice(startIndex, endIndex);\n let firstLevelIndex = -1;\n for (let i = 0; i < currentIndexedData.length; i++) {\n //计算第一层父级节点数量\n if (\n (Array.isArray(currentIndexedData[i]) && (currentIndexedData[i] as Array<number>).length === 1) ||\n !Array.isArray(currentIndexedData[i])\n ) {\n firstLevelIndex++;\n }\n if (firstLevelIndex >= startIndex && firstLevelIndex < endIndex) {\n this._currentPagerIndexedData.push(currentIndexedData[i]);\n } else if (firstLevelIndex >= endIndex) {\n break;\n }\n }\n } else if (this._sourceLength > 0) {\n throw new Error(`currentIndexedData should has values!`);\n }\n }\n\n get source(): any {\n return this._source;\n }\n get(index: number): MaybePromiseOrUndefined {\n return this.getOriginalRecord(_getIndex(this.currentPagerIndexedData, index));\n }\n getRaw(index: number): MaybePromiseOrUndefined {\n return this.getRawRecord(_getIndex(this.currentPagerIndexedData, index) as number);\n }\n getIndexKey(index: number): number | number[] {\n return _getIndex(this.currentPagerIndexedData, index);\n }\n getTableIndex(colOrRow: number): number {\n return this.currentPagerIndexedData.findIndex(value => value === colOrRow);\n }\n /** 获取数据源中第index位置的field字段数据。传入col row是因为后面的format函数参数使用*/\n getField(\n index: number,\n field: FieldDef | FieldFormat | number,\n col: number,\n row: number,\n table: BaseTableAPI\n ): FieldData {\n return this.getOriginalField(_getIndex(this.currentPagerIndexedData, index), field, col, row, table);\n }\n\n getRawField(\n index: number,\n field: FieldDef | FieldFormat | number,\n col: number,\n row: number,\n table: BaseTableAPI\n ): FieldData {\n return this.getRawFieldData(_getIndex(this.currentPagerIndexedData, index) as number, field, col, row, table);\n }\n\n hasField(index: number, field: FieldDef): boolean {\n return this.hasOriginalField(_getIndex(this.currentPagerIndexedData, index), field);\n }\n /**\n * 获取第index条数据的展示收起状态\n * @param index\n * @returns\n */\n getHierarchyState(index: number): HierarchyState {\n const indexed = this.getIndexKey(index);\n return this.treeDataHierarchyState.get(Array.isArray(indexed) ? indexed.join(',') : indexed) ?? null;\n }\n /**\n * 展开或者收起数据index\n * @param index\n */\n toggleHierarchyState(index: number) {\n const oldIndexedData = this.currentIndexedData.slice(0);\n const indexed = this.getIndexKey(index);\n const state = this.getHierarchyState(index);\n const data = this.getOriginalRecord(indexed);\n\n this.clearSortedIndexMap();\n if (state === HierarchyState.collapse) {\n // 将节点状态置为expand\n this.treeDataHierarchyState.set(Array.isArray(indexed) ? indexed.join(',') : indexed, HierarchyState.expand);\n this.pushChildrenNode(indexed, HierarchyState.expand, data);\n } else if (state === HierarchyState.expand) {\n // 记录状态变化影响的子节点行数\n let childrenLength = 0;\n /**\n * 当某个节点由展开变为折叠,需要计算出影响的节点数量 使用childrenLength来标记。同样需递归\n * @param indexKey\n * @param hierarchyState\n * @param nodeData\n * @returns\n */\n const computeChildrenNodeLength = (\n indexKey: number | number[],\n hierarchyState: HierarchyState,\n nodeData: any\n ) => {\n if (!hierarchyState || hierarchyState === HierarchyState.collapse || hierarchyState === HierarchyState.none) {\n return;\n }\n if (nodeData.children) {\n for (let i = 0; i < nodeData.children.length; i++) {\n childrenLength += 1;\n const childIndex = Array.isArray(indexKey) ? indexKey.concat([i]) : [indexKey, i];\n\n computeChildrenNodeLength(\n childIndex,\n this.treeDataHierarchyState.get(childIndex.join(',')),\n nodeData.children[i]\n );\n }\n }\n };\n computeChildrenNodeLength(indexed, state, data);\n\n this.currentIndexedData.splice(this.currentIndexedData.indexOf(indexed) + 1, childrenLength);\n this.treeDataHierarchyState.set(Array.isArray(indexed) ? indexed.join(',') : indexed, HierarchyState.collapse);\n }\n // 变更了pagerConfig所以需要更新分页数据 TODO待定 因为只关注根节点的数量的话 可能不会影响到\n this.updatePagerData();\n\n return diffCellIndices(oldIndexedData, this.currentIndexedData);\n }\n /**\n * 某个节点状态由折叠变为展开,往this.currentIndexedData中插入展开后的新增节点,注意需要递归,因为展开节点下面的子节点也能是展开状态\n * @param recordRowIndex 要计算节点的行号(从body部分开始计算)\n * @param indexKey 需要判断节点的index\n * @param hierarchyState 当前节点状态\n * @param nodeData 当前节点数据 取children时用\n * @returns\n */\n pushChildrenNode(indexKey: number | number[], hierarchyState: HierarchyState, nodeData: any): number {\n if (!hierarchyState || hierarchyState === HierarchyState.collapse || hierarchyState === HierarchyState.none) {\n return 0;\n }\n let childrenLength = 0;\n if (nodeData.children) {\n const subNodeSortedIndexArray: Array<number> = Array.from({ length: nodeData.children.length }, (_, i) => i);\n this.lastOrder &&\n this.lastOrder !== 'normal' &&\n this.lastOrderField &&\n sort.sort(\n index =>\n isValid(subNodeSortedIndexArray[index])\n ? subNodeSortedIndexArray[index]\n : (subNodeSortedIndexArray[index] = index),\n (index, rel) => {\n subNodeSortedIndexArray[index] = rel;\n },\n nodeData.children.length,\n this.lastOrderFn,\n this.lastOrder,\n index =>\n this.getOriginalField(\n Array.isArray(indexKey) ? indexKey.concat([index]) : [indexKey, index],\n this.lastOrderField\n )\n );\n for (let i = 0; i < subNodeSortedIndexArray.length; i++) {\n childrenLength += 1;\n const childIndex = Array.isArray(indexKey)\n ? indexKey.concat([subNodeSortedIndexArray[i]])\n : [indexKey, subNodeSortedIndexArray[i]];\n this.currentIndexedData.splice(\n this.currentIndexedData.indexOf(indexKey) + childrenLength,\n // this.pagination.currentPage * this.pagination.perPageCount +\n // recordRowIndex +\n // childrenLength,\n 0,\n childIndex\n );\n const preChildState = this.treeDataHierarchyState.get(childIndex.join(','));\n const childData = this.getOriginalRecord(childIndex);\n if (!preChildState && (childData as any).children) {\n this.treeDataHierarchyState.set(childIndex.join(','), HierarchyState.collapse);\n }\n childrenLength += this.pushChildrenNode(\n childIndex,\n this.treeDataHierarchyState.get(childIndex.join(',')),\n nodeData.children[subNodeSortedIndexArray[i]]\n );\n }\n }\n return childrenLength;\n }\n changeFieldValue(\n value: FieldData,\n index: number,\n field: FieldDef,\n col?: number,\n row?: number,\n table?: BaseTableAPI\n ): FieldData {\n if (field === null) {\n return undefined;\n }\n if (index >= 0) {\n const dataIndex = this.getIndexKey(index) as number;\n\n if (!this.beforeChangedRecordsMap[dataIndex]) {\n const originRecord = this.getOriginalRecord(dataIndex);\n this.beforeChangedRecordsMap[dataIndex] = cloneDeep(originRecord);\n }\n if (typeof field === 'string' || typeof field === 'number') {\n const beforeChangedValue = this.beforeChangedRecordsMap[dataIndex][field]; // this.getOriginalField(index, field, col, row, table);\n const record = this.getOriginalRecord(dataIndex);\n if (typeof beforeChangedValue === 'number' && isAllDigits(value)) {\n record[field] = parseFloat(value);\n } else {\n record[field] = value;\n }\n }\n }\n // return getField(record, field);\n }\n /**\n * 将数据record 替换到index位置处\n * @param record\n * @param index\n */\n setRecord(record: any, index: number) {\n const indexed = this.getIndexKey(index);\n if (!Array.isArray(indexed)) {\n this.source.splice(indexed, 1, record);\n } else {\n const c_node_index = (indexed as Array<any>)[indexed.length - 1];\n const p_node = this.getOriginalRecord(indexed.slice(0, indexed.length - 1));\n (p_node as any).children.splice(c_node_index, 1, record);\n }\n }\n /**\n * 将单条数据record 添加到index位置处\n * @param record 被添加的单条数据\n * @param index 代表的数据源中的index\n */\n addRecord(record: any, index: number) {\n this.source.splice(index, 0, record);\n this.currentIndexedData.push(this.currentIndexedData.length);\n this._sourceLength += 1;\n\n if (this.userPagination) {\n //如果用户配置了分页\n this.pagination.totalCount = this._sourceLength;\n const { perPageCount, currentPage } = this.pagination;\n const startIndex = perPageCount * (currentPage || 0);\n const endIndex = startIndex + perPageCount;\n if (index < endIndex) {\n this.updatePagerData();\n }\n } else {\n this.pagination.perPageCount = this._sourceLength;\n this.pagination.totalCount = this._sourceLength;\n this.updatePagerData();\n }\n }\n /**\n * 将多条数据recordArr 依次添加到index位置处\n * @param recordArr\n * @param index 代表的数据源中的index\n */\n addRecords(recordArr: any, index: number) {\n if (Array.isArray(recordArr)) {\n this.source.splice(index, 0, ...recordArr);\n for (let i = 0; i < recordArr.length; i++) {\n this.currentIndexedData.push(this.currentIndexedData.length);\n }\n this._sourceLength += recordArr.length;\n }\n\n if (this.userPagination) {\n //如果用户配置了分页\n this.pagination.totalCount = this._sourceLength;\n const { perPageCount, currentPage } = this.pagination;\n const startIndex = perPageCount * (currentPage || 0);\n const endIndex = startIndex + perPageCount;\n if (index < endIndex) {\n this.updatePagerData();\n }\n } else {\n this.pagination.perPageCount = this._sourceLength;\n this.pagination.totalCount = this._sourceLength;\n this.updatePagerData();\n }\n }\n\n /**\n * 将单条数据record 添加到index位置处\n * @param record 被添加的单条数据\n * @param index 代表的数据源中的index\n */\n addRecordForSorted(record: any) {\n this.source.push(record);\n this.currentIndexedData.push(this.currentIndexedData.length);\n this._sourceLength += 1;\n this.sortedIndexMap.clear();\n if (!this.userPagination) {\n this.pagination.perPageCount = this._sourceLength;\n this.pagination.totalCount = this._sourceLength;\n }\n }\n /**\n * 将多条数据recordArr 依次添加到index位置处\n * @param recordArr\n * @param index 代表的数据源中的index\n */\n addRecordsForSorted(recordArr: any) {\n if (Array.isArray(recordArr)) {\n this.source.push(...recordArr);\n for (let i = 0; i < recordArr.length; i++) {\n this.currentIndexedData.push(this.currentIndexedData.length);\n }\n this._sourceLength += recordArr.length;\n this.sortedIndexMap.clear();\n }\n if (!this.userPagination) {\n this.pagination.perPageCount = this._sourceLength;\n this.pagination.totalCount = this._sourceLength;\n }\n }\n /**\n * 删除多条数据recordIndexs\n */\n deleteRecordsForSorted(recordIndexs: number[]) {\n const recordIndexsMaxToMin = recordIndexs.sort((a, b) => b - a);\n for (let index = 0; index < recordIndexsMaxToMin.length; index++) {\n const recordIndex = recordIndexsMaxToMin[index];\n if (recordIndex >= this._sourceLength || recordIndex < 0) {\n continue;\n }\n const rawIndex = this.currentIndexedData[recordIndex];\n this.source.splice(rawIndex, 1);\n this._sourceLength -= 1;\n }\n this.sortedIndexMap.clear();\n if (!this.userPagination) {\n this.pagination.perPageCount = this._sourceLength;\n this.pagination.totalCount = this._sourceLength;\n }\n }\n\n /**\n * 删除多条数据recordIndexs\n */\n deleteRecords(recordIndexs: number[]) {\n const realDeletedRecordIndexs = [];\n const recordIndexsMaxToMin = recordIndexs.sort((a, b) => b - a);\n for (let index = 0; index < recordIndexsMaxToMin.length; index++) {\n const recordIndex = recordIndexsMaxToMin[index];\n if (recordIndex >= this._sourceLength || recordIndex < 0) {\n continue;\n }\n realDeletedRecordIndexs.push(recordIndex);\n this.source.splice(recordIndex, 1);\n this.currentIndexedData.pop();\n this._sourceLength -= 1;\n }\n if (this.userPagination) {\n // 如果用户配置了分页\n this.updatePagerData();\n } else {\n this.pagination.perPageCount = this._sourceLength;\n this.pagination.totalCount = this._sourceLength;\n this.updatePagerData();\n }\n return realDeletedRecordIndexs;\n }\n\n sort(\n field: FieldDef,\n order: SortOrder,\n orderFn: (v1: any, v2: any, order: SortOrder) => -1 | 0 | 1 = order !== 'desc'\n ? (v1: any, v2: any): -1 | 0 | 1 => (v1 === v2 ? 0 : v1 > v2 ? 1 : -1)\n : (v1: any, v2: any): -1 | 0 | 1 => (v1 === v2 ? 0 : v1 < v2 ? 1 : -1)\n ): void {\n this.lastOrderField = field;\n this.lastOrder = order;\n this.lastOrderFn = orderFn;\n let filedMap = this.sortedIndexMap.get(field);\n let orderedData;\n\n if (filedMap) {\n orderedData = filedMap[order];\n if (orderedData && orderedData.length > 0) {\n this.currentIndexedData = orderedData;\n this.updatePagerData();\n this.fireListeners(EVENT_TYPE.CHANGE_ORDER, null);\n return;\n }\n }\n const sortedIndexArray = [] as number[];\n if (order === 'normal') {\n for (let i = 0; i < this._sourceLength; i++) {\n sortedIndexArray[i] = i;\n }\n } else {\n sort.sort(\n index => (isValid(sortedIndexArray[index]) ? sortedIndexArray[index] : (sortedIndexArray[index] = index)),\n (index, rel) => {\n sortedIndexArray[index] = rel;\n },\n this._sourceLength,\n orderFn,\n order,\n index => this.getOriginalField(index, field)\n );\n }\n this.currentIndexedData = sortedIndexArray;\n if (this.enableHierarchyState) {\n let nodeLength = sortedIndexArray.length;\n const t0 = window.performance.now();\n for (let i = 0; i < nodeLength; i++) {\n const subNodeLength = this.pushChildrenNode(\n sortedIndexArray[i],\n this.treeDataHierarchyState.get(sortedIndexArray[i]),\n this.getOriginalRecord(sortedIndexArray[i]) // ?sortedIndexArray 在这个过程中不是变化了吗 通过i取id还是对的吗? 对哦!因为i和nodeLength都+subNodeLength 来动态调整过了!\n );\n nodeLength += subNodeLength;\n i += subNodeLength;\n }\n }\n if (!filedMap) {\n filedMap = { asc: [], desc: [], normal: [] };\n this.sortedIndexMap.set(field, filedMap);\n }\n filedMap[order] = sortedIndexArray;\n this.updatePagerData();\n this.fireListeners(EVENT_TYPE.CHANGE_ORDER, null);\n }\n /**\n * 当节点折叠或者展开时 将排序缓存清空(非当前排序规则的缓存)\n */\n clearSortedIndexMap() {\n if (this.lastOrderField && this.lastOrder) {\n this.sortedIndexMap.forEach((sortMap, key) => {\n if (key !== this.lastOrderField) {\n this.sortedIndexMap.delete(key);\n } else if (this.lastOrder === 'asc') {\n sortMap.desc = [];\n sortMap.normal = [];\n } else if (this.lastOrder === 'desc') {\n sortMap.asc = [];\n sortMap.normal = [];\n } else {\n sortMap.desc = [];\n sortMap.asc = [];\n }\n });\n }\n }\n get sourceLength(): number {\n return this._sourceLength;\n }\n set sourceLength(sourceLen: number) {\n if (this._sourceLength === sourceLen) {\n return;\n }\n this._sourceLength = sourceLen;\n this.fireListeners(EVENT_TYPE.SOURCE_LENGTH_UPDATE, this._sourceLength);\n }\n get length(): number {\n return this.currentPagerIndexedData.length;\n }\n get dataSource(): DataSource {\n return this;\n }\n get currentPagerIndexedData(): (number | number[])[] {\n if (this._currentPagerIndexedData.length > 0) {\n return this._currentPagerIndexedData;\n }\n return []; //this.currentIndexedData || [];\n }\n release(): void {\n super.release?.();\n }\n clearSortedMap() {\n this.currentIndexedData && (this.currentIndexedData.length = 0);\n this.currentIndexedData = null;\n this.sortedIndexMap.forEach(item => {\n item.asc && (item.asc.length = 0);\n item.desc && (item.desc.length = 0);\n });\n this.sortedIndexMap.clear();\n }\n clearCurrentIndexedData(): void {\n this.currentIndexedData = null;\n this.currentPagerIndexedData.length = 0;\n }\n protected getOriginalRecord(dataIndex: number | number[]): MaybePromiseOrUndefined {\n return getValue(this._get(dataIndex), (val: MaybePromiseOrUndefined) => {\n this.recordPromiseCallBack(dataIndex, val);\n });\n }\n protected getRawRecord(dataIndex: number): MaybePromiseOrUndefined {\n if (this.beforeChangedRecordsMap?.[dataIndex as number]) {\n return this.beforeChangedRecordsMap[dataIndex as number];\n }\n return getValue(this._get(dataIndex), (val: MaybePromiseOrUndefined) => {\n this.recordPromiseCallBack(dataIndex, val);\n });\n }\n protected getOriginalField(\n index: number | number[],\n field: FieldDef | FieldFormat | number,\n col?: number,\n row?: number,\n table?: BaseTableAPI\n ): FieldData {\n if (field === null) {\n return undefined;\n }\n const record = this.getOriginalRecord(index);\n // return getField(record, field);\n return getField(record, field, col, row, table, (val: any) => {\n this.fieldPromiseCallBack(index, field, val);\n });\n }\n protected getRawFieldData(\n index: number,\n field: FieldDef | FieldFormat | number,\n col?: number,\n row?: number,\n table?: BaseTableAPI\n ): FieldData {\n if (field === null) {\n return undefined;\n }\n const record = this.getRawRecord(index);\n // return getField(record, field);\n return getField(record, field, col, row, table, (val: any) => {\n this.fieldPromiseCallBack(index, field, val);\n });\n }\n protected hasOriginalField(index: number | number[], field: FieldDef): boolean {\n if (field === null) {\n return false;\n }\n if (typeof field === 'function') {\n return true;\n }\n const record = this.getOriginalRecord(index);\n return Boolean(record && (field as any) in (record as any));\n }\n\n protected fieldPromiseCallBack(\n _index: number | number[],\n _field: FieldDef | FieldFormat | number,\n _value: MaybePromiseOrUndefined\n ): void {\n //\n }\n protected recordPromiseCallBack(_index: number | number[], _record: MaybePromiseOrUndefined): void {\n //\n }\n /** 静态变量 代表数据为空 */\n static EMPTY = new DataSource({\n get() {\n /* noop */\n },\n length: 0\n });\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/data/DataSource.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,oDAAsC;AAYtC,0CAA6C;AAC7C,4CAAsF;AACtF,sDAAmD;AACnD,wCAA4D;AAC5D,kDAAwD;AACxD,6CAAsD;AAStD,SAAS,eAAe,CAAC,KAAsC;IAC7D,IAAI,YAAG,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE;QACvB,MAAM,CAAC,GAAG,KAAsB,CAAC;QACjC,IAAI,IAAA,gBAAO,EAAC,CAAC,CAAC,GAAG,CAAC,IAAI,IAAA,gBAAO,EAAC,CAAC,CAAC,GAAG,CAAC,EAAE;YACpC,OAAO,IAAI,CAAC;SACb;KACF;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AACD,MAAM,UAAU,GAAG;IACjB,oBAAoB,EAAE,sBAAsB;IAC5C,YAAY,EAAE,cAAc;CACpB,CAAC;AASX,SAAS,QAAQ,CAAC,KAAoC,EAAE,eAA4B;IAClF,MAAM,mBAAmB,GAAG,IAAA,mBAAU,EAAC,KAAK,CAAC,CAAC;IAC9C,IAAI,IAAA,kBAAS,EAAC,mBAAmB,CAAC,EAAE;QAClC,MAAM,YAAY,GAAG,mBAAmB,CAAC,IAAI,CAAC,CAAC,CAAM,EAAE,EAAE;YACvD,eAAe,CAAC,CAAC,CAAC,CAAC;YACnB,OAAO,CAAC,CAAC;QACX,CAAC,CAAC,CAAC;QAEH,eAAe,CAAC,YAAY,CAAC,CAAC;QAC9B,OAAO,YAAY,CAAC;KACrB;IACD,OAAO,mBAAmB,CAAC;AAC7B,CAAC;AAQD,SAAgB,QAAQ,CACtB,MAA+B,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","file":"DataSource.js","sourcesContent":["import * as sort from '../tools/sort';\nimport type {\n DataSourceAPI,\n FieldAssessor,\n FieldData,\n FieldDef,\n FieldFormat,\n IPagination,\n MaybePromiseOrCallOrUndefined,\n MaybePromiseOrUndefined,\n SortOrder\n} from '../ts-types';\nimport { HierarchyState } from '../ts-types';\nimport { applyChainSafe, getOrApply, obj, isPromise, emptyFn } from '../tools/helper';\nimport { EventTarget } from '../event/EventTarget';\nimport { getValueByPath, isAllDigits } from '../tools/util';\nimport { calculateArrayDiff } from '../tools/diff-cell';\nimport { cloneDeep, isValid } from '@visactor/vutils';\nimport type { BaseTableAPI } from '../ts-types/base-table';\nimport { TABLE_EVENT_TYPE } from '../core/TABLE_EVENT_TYPE';\n\n/**\n * 判断字段数据是否为访问器的格式\n * @param field\n * @returns boolean\n */\nfunction isFieldAssessor(field: FieldDef | FieldFormat | number): field is FieldAssessor {\n if (obj.isObject(field)) {\n const a = field as FieldAssessor;\n if (isValid(a.get) && isValid(a.set)) {\n return true;\n }\n }\n return false;\n}\nconst EVENT_TYPE = {\n SOURCE_LENGTH_UPDATE: 'source_length_update',\n CHANGE_ORDER: 'change_order'\n} as const;\ntype PromiseBack = (value: MaybePromiseOrUndefined) => void;\n\n/**\n * 获取到的某个filed的值 处理可能为promise的情况\n * @param value\n * @param promiseCallBack\n * @returns\n */\nfunction getValue(value: MaybePromiseOrCallOrUndefined, promiseCallBack: PromiseBack): MaybePromiseOrUndefined {\n const maybePromiseOrValue = getOrApply(value);\n if (isPromise(maybePromiseOrValue)) {\n const promiseValue = maybePromiseOrValue.then((r: any) => {\n promiseCallBack(r);\n return r;\n });\n\n promiseCallBack(promiseValue);\n return promiseValue;\n }\n return maybePromiseOrValue;\n}\n/**\n * 根据field获取数据源record对应的值 获取到的可能是个异步Promise 需要设置回调处理逻辑\n * @param record\n * @param field\n * @param promiseCallBack\n * @returns\n */\nexport function getField(\n record: MaybePromiseOrUndefined,\n field: FieldDef | FieldFormat | number,\n col: number,\n row: number,\n table: BaseTableAPI,\n promiseCallBack: PromiseBack\n): FieldData {\n if (record === null || record === undefined) {\n return undefined;\n }\n if (isPromise(record)) {\n return record.then((r: any) => getField(r, field, col, row, table, promiseCallBack));\n }\n const fieldGet: any = isFieldAssessor(field) ? field.get : field;\n if (fieldGet in (record as any)) {\n const fieldResult = (record as any)[fieldGet];\n\n return getValue(fieldResult, promiseCallBack);\n }\n if (typeof fieldGet === 'function') {\n const fieldResult = fieldGet(record, col, row, table);\n return getValue(fieldResult, promiseCallBack);\n }\n if (Array.isArray(fieldGet)) {\n const fieldResult = getValueByPath(record, [...fieldGet]);\n return getValue(fieldResult, promiseCallBack);\n }\n const fieldArray = `${fieldGet}`.split('.');\n if (fieldArray.length <= 1) {\n const fieldResult = (record as any)[fieldGet];\n return getValue(fieldResult, promiseCallBack);\n }\n const fieldResult = applyChainSafe(\n record,\n (val, name) => getField(val, name, col, row, table, emptyFn as any),\n ...fieldArray\n );\n return getValue(fieldResult, promiseCallBack);\n}\n\nfunction _getIndex(sortedIndexMap: null | (number | number[])[], index: number): number | number[] {\n if (!sortedIndexMap) {\n return index;\n }\n const mapIndex = sortedIndexMap[index];\n return isValid(mapIndex) ? mapIndex : index;\n}\n\nexport interface DataSourceParam {\n get: (index: number) => any;\n length: number;\n source?: any;\n}\nexport interface ISortedMapItem {\n asc?: (number | number[])[];\n desc?: (number | number[])[];\n normal?: (number | number[])[];\n}\n\nexport class DataSource extends EventTarget implements DataSourceAPI {\n private _get: (index: number | number[]) => any;\n /** 数据条目数 如果是树形结构的数据 则是第一层父节点的数量 */\n private _sourceLength: number;\n\n private readonly _source: any;\n /**\n * 缓存按字段进行排序的结果\n */\n protected sortedIndexMap: Map<FieldDef, ISortedMapItem>;\n /**\n * 记录最近一次排序规则 当展开树形结构的节点时需要用到\n */\n private lastOrder: SortOrder;\n private lastOrderFn: (a: any, b: any, order: string) => number;\n private lastOrderField: FieldDef;\n /** 每一行对应源数据的索引 */\n protected currentIndexedData: (number | number[])[] | null = [];\n protected userPagination: IPagination;\n protected pagination: IPagination;\n /** 当前页每一行对应源数据的索引 */\n protected _currentPagerIndexedData: (number | number[])[];\n // 当前是否为层级的树形结构 排序时判断该值确实是否继续进行子节点排序\n enableHierarchyState = false;\n static get EVENT_TYPE(): typeof EVENT_TYPE {\n return EVENT_TYPE;\n }\n protected treeDataHierarchyState: Map<number | string, HierarchyState> = new Map();\n beforeChangedRecordsMap: Record<number, any>[] = [];\n constructor(obj?: DataSourceParam | DataSource, pagination?: IPagination, hierarchyExpandLevel?: number) {\n super();\n\n this._get = obj?.get.bind(obj) || (undefined as any);\n this._sourceLength = obj?.length || 0;\n this._source = obj?.source ?? obj;\n this.sortedIndexMap = new Map<string, ISortedMapItem>();\n\n this._currentPagerIndexedData = [];\n this.userPagination = pagination;\n this.pagination = pagination || {\n totalCount: this._sourceLength,\n perPageCount: this._sourceLength,\n currentPage: 0\n };\n if (hierarchyExpandLevel >= 1) {\n this.enableHierarchyState = true;\n }\n // 初始化currentIndexedData 正常未排序。设置其状态\n this.currentIndexedData = Array.from({ length: this._sourceLength }, (_, i) => i);\n if (this.enableHierarchyState) {\n for (let i = 0; i < this._sourceLength; i++) {\n //expandLevel为有效值即需要按tree分析展示数据\n const nodeData = this.getOriginalRecord(i);\n (nodeData as any).children && this.treeDataHierarchyState.set(i, HierarchyState.collapse);\n }\n }\n if (hierarchyExpandLevel > 1) {\n let nodeLength = this._sourceLength;\n for (let i = 0; i < nodeLength; i++) {\n const indexKey = this.currentIndexedData[i];\n const nodeData = this.getOriginalRecord(indexKey);\n if ((nodeData as any).children?.length > 0) {\n this.treeDataHierarchyState.set(\n Array.isArray(indexKey) ? indexKey.join(',') : indexKey,\n HierarchyState.expand\n );\n const childrenLength = this.initChildrenNodeHierarchy(indexKey, hierarchyExpandLevel, 2, nodeData);\n i += childrenLength;\n nodeLength += childrenLength;\n }\n }\n }\n this.updatePagerData();\n }\n /**\n * 初始化子节点的层次信息\n * @param indexKey 父节点的indexKey 即currentLevel-1的节点\n * @param hierarchyExpandLevel 需要展开层级数\n * @param currentLevel 当前要展开的是第几层\n * @param nodeData 父节点数据 即currentLevel-1的节点\n * @returns\n */\n initChildrenNodeHierarchy(\n indexKey: number | number[],\n // subNodeIndex:number,\n hierarchyExpandLevel: number,\n currentLevel: number,\n nodeData: any\n ): number {\n if (currentLevel > hierarchyExpandLevel) {\n return 0;\n }\n let childTotalLength = 0;\n const nodeLength = nodeData.children?.length ?? 0;\n for (let j = 0; j < nodeLength; j++) {\n childTotalLength += 1;\n const childNodeData = nodeData.children[j];\n const childIndexKey = Array.isArray(indexKey) ? indexKey.concat(j) : [indexKey, j];\n this.currentIndexedData.splice(\n this.currentIndexedData.indexOf(indexKey) + childTotalLength,\n // childTotalLength,\n 0,\n childIndexKey\n );\n if (childNodeData.children?.length > 0) {\n if (currentLevel < hierarchyExpandLevel) {\n this.treeDataHierarchyState.set(\n Array.isArray(childIndexKey) ? childIndexKey.join(',') : childIndexKey,\n HierarchyState.expand\n );\n } else {\n this.treeDataHierarchyState.set(\n Array.isArray(childIndexKey) ? childIndexKey.join(',') : childIndexKey,\n HierarchyState.collapse\n );\n }\n }\n\n childTotalLength += this.initChildrenNodeHierarchy(\n childIndexKey,\n hierarchyExpandLevel,\n currentLevel + 1,\n childNodeData\n );\n }\n return childTotalLength;\n }\n updatePagination(pagination?: IPagination): void {\n this.pagination = pagination || {\n totalCount: this._sourceLength,\n perPageCount: this._sourceLength,\n currentPage: 0\n };\n this.updatePagerData();\n }\n protected updatePagerData(): void {\n const { currentIndexedData } = this;\n const { perPageCount, currentPage } = this.pagination;\n const startIndex = perPageCount * (currentPage || 0);\n const endIndex = startIndex + perPageCount;\n this._currentPagerIndexedData.length = 0;\n if (currentIndexedData && currentIndexedData.length > 0) {\n // this._currentPagerIndexedData = currentIndexedData.slice(startIndex, endIndex);\n let firstLevelIndex = -1;\n for (let i = 0; i < currentIndexedData.length; i++) {\n //计算第一层父级节点数量\n if (\n (Array.isArray(currentIndexedData[i]) && (currentIndexedData[i] as Array<number>).length === 1) ||\n !Array.isArray(currentIndexedData[i])\n ) {\n firstLevelIndex++;\n }\n if (firstLevelIndex >= startIndex && firstLevelIndex < endIndex) {\n this._currentPagerIndexedData.push(currentIndexedData[i]);\n } else if (firstLevelIndex >= endIndex) {\n break;\n }\n }\n } else if (this._sourceLength > 0) {\n throw new Error(`currentIndexedData should has values!`);\n }\n }\n\n get source(): any {\n return this._source;\n }\n get(index: number): MaybePromiseOrUndefined {\n return this.getOriginalRecord(_getIndex(this.currentPagerIndexedData, index));\n }\n getRaw(index: number): MaybePromiseOrUndefined {\n return this.getRawRecord(_getIndex(this.currentPagerIndexedData, index) as number);\n }\n getIndexKey(index: number): number | number[] {\n return _getIndex(this.currentPagerIndexedData, index);\n }\n getTableIndex(colOrRow: number): number {\n return this.currentPagerIndexedData.findIndex(value => value === colOrRow);\n }\n /** 获取数据源中第index位置的field字段数据。传入col row是因为后面的format函数参数使用*/\n getField(\n index: number,\n field: FieldDef | FieldFormat | number,\n col: number,\n row: number,\n table: BaseTableAPI\n ): FieldData {\n return this.getOriginalField(_getIndex(this.currentPagerIndexedData, index), field, col, row, table);\n }\n\n getRawField(\n index: number,\n field: FieldDef | FieldFormat | number,\n col: number,\n row: number,\n table: BaseTableAPI\n ): FieldData {\n return this.getRawFieldData(_getIndex(this.currentPagerIndexedData, index) as number, field, col, row, table);\n }\n\n hasField(index: number, field: FieldDef): boolean {\n return this.hasOriginalField(_getIndex(this.currentPagerIndexedData, index), field);\n }\n /**\n * 获取第index条数据的展示收起状态\n * @param index\n * @returns\n */\n getHierarchyState(index: number): HierarchyState {\n const indexed = this.getIndexKey(index);\n return this.treeDataHierarchyState.get(Array.isArray(indexed) ? indexed.join(',') : indexed) ?? null;\n }\n /**\n * 展开或者收起数据index\n * @param index\n */\n toggleHierarchyState(index: number) {\n const oldIndexedData = this.currentIndexedData.slice(0);\n const indexed = this.getIndexKey(index);\n const state = this.getHierarchyState(index);\n const data = this.getOriginalRecord(indexed);\n\n this.clearSortedIndexMap();\n if (state === HierarchyState.collapse) {\n // 将节点状态置为expand\n this.treeDataHierarchyState.set(Array.isArray(indexed) ? indexed.join(',') : indexed, HierarchyState.expand);\n this.pushChildrenNode(indexed, HierarchyState.expand, data);\n } else if (state === HierarchyState.expand) {\n // 记录状态变化影响的子节点行数\n let childrenLength = 0;\n /**\n * 当某个节点由展开变为折叠,需要计算出影响的节点数量 使用childrenLength来标记。同样需递归\n * @param indexKey\n * @param hierarchyState\n * @param nodeData\n * @returns\n */\n const computeChildrenNodeLength = (\n indexKey: number | number[],\n hierarchyState: HierarchyState,\n nodeData: any\n ) => {\n if (!hierarchyState || hierarchyState === HierarchyState.collapse || hierarchyState === HierarchyState.none) {\n return;\n }\n if (nodeData.children) {\n for (let i = 0; i < nodeData.children.length; i++) {\n childrenLength += 1;\n const childIndex = Array.isArray(indexKey) ? indexKey.concat([i]) : [indexKey, i];\n\n computeChildrenNodeLength(\n childIndex,\n this.treeDataHierarchyState.get(childIndex.join(',')),\n nodeData.children[i]\n );\n }\n }\n };\n computeChildrenNodeLength(indexed, state, data);\n\n this.currentIndexedData.splice(this.currentIndexedData.indexOf(indexed) + 1, childrenLength);\n this.treeDataHierarchyState.set(Array.isArray(indexed) ? indexed.join(',') : indexed, HierarchyState.collapse);\n }\n // 变更了pagerConfig所以需要更新分页数据 TODO待定 因为只关注根节点的数量的话 可能不会影响到\n this.updatePagerData();\n\n const newDiff = calculateArrayDiff(oldIndexedData, this.currentIndexedData);\n // const oldDiff = diffCellIndices(oldIndexedData, this.currentIndexedData);\n\n // return oldDiff;\n return newDiff;\n }\n /**\n * 某个节点状态由折叠变为展开,往this.currentIndexedData中插入展开后的新增节点,注意需要递归,因为展开节点下面的子节点也能是展开状态\n * @param recordRowIndex 要计算节点的行号(从body部分开始计算)\n * @param indexKey 需要判断节点的index\n * @param hierarchyState 当前节点状态\n * @param nodeData 当前节点数据 取children时用\n * @returns\n */\n pushChildrenNode(indexKey: number | number[], hierarchyState: HierarchyState, nodeData: any): number {\n if (!hierarchyState || hierarchyState === HierarchyState.collapse || hierarchyState === HierarchyState.none) {\n return 0;\n }\n let childrenLength = 0;\n if (nodeData.children) {\n const subNodeSortedIndexArray: Array<number> = Array.from({ length: nodeData.children.length }, (_, i) => i);\n this.lastOrder &&\n this.lastOrder !== 'normal' &&\n this.lastOrderField &&\n sort.sort(\n index =>\n isValid(subNodeSortedIndexArray[index])\n ? subNodeSortedIndexArray[index]\n : (subNodeSortedIndexArray[index] = index),\n (index, rel) => {\n subNodeSortedIndexArray[index] = rel;\n },\n nodeData.children.length,\n this.lastOrderFn,\n this.lastOrder,\n index =>\n this.getOriginalField(\n Array.isArray(indexKey) ? indexKey.concat([index]) : [indexKey, index],\n this.lastOrderField\n )\n );\n for (let i = 0; i < subNodeSortedIndexArray.length; i++) {\n childrenLength += 1;\n const childIndex = Array.isArray(indexKey)\n ? indexKey.concat([subNodeSortedIndexArray[i]])\n : [indexKey, subNodeSortedIndexArray[i]];\n this.currentIndexedData.splice(\n this.currentIndexedData.indexOf(indexKey) + childrenLength,\n // this.pagination.currentPage * this.pagination.perPageCount +\n // recordRowIndex +\n // childrenLength,\n 0,\n childIndex\n );\n const preChildState = this.treeDataHierarchyState.get(childIndex.join(','));\n const childData = this.getOriginalRecord(childIndex);\n if (!preChildState && (childData as any).children) {\n this.treeDataHierarchyState.set(childIndex.join(','), HierarchyState.collapse);\n }\n childrenLength += this.pushChildrenNode(\n childIndex,\n this.treeDataHierarchyState.get(childIndex.join(',')),\n nodeData.children[subNodeSortedIndexArray[i]]\n );\n }\n }\n return childrenLength;\n }\n changeFieldValue(\n value: FieldData,\n index: number,\n field: FieldDef,\n col?: number,\n row?: number,\n table?: BaseTableAPI\n ): FieldData {\n if (field === null) {\n return undefined;\n }\n if (index >= 0) {\n const dataIndex = this.getIndexKey(index) as number;\n\n if (!this.beforeChangedRecordsMap[dataIndex]) {\n const originRecord = this.getOriginalRecord(dataIndex);\n this.beforeChangedRecordsMap[dataIndex] = cloneDeep(originRecord);\n }\n if (typeof field === 'string' || typeof field === 'number') {\n const beforeChangedValue = this.beforeChangedRecordsMap[dataIndex][field]; // this.getOriginalField(index, field, col, row, table);\n const record = this.getOriginalRecord(dataIndex);\n if (typeof beforeChangedValue === 'number' && isAllDigits(value)) {\n record[field] = parseFloat(value);\n } else {\n record[field] = value;\n }\n }\n }\n // return getField(record, field);\n }\n /**\n * 将数据record 替换到index位置处\n * @param record\n * @param index\n */\n setRecord(record: any, index: number) {\n const indexed = this.getIndexKey(index);\n if (!Array.isArray(indexed)) {\n this.source.splice(indexed, 1, record);\n } else {\n const c_node_index = (indexed as Array<any>)[indexed.length - 1];\n const p_node = this.getOriginalRecord(indexed.slice(0, indexed.length - 1));\n (p_node as any).children.splice(c_node_index, 1, record);\n }\n }\n /**\n * 将单条数据record 添加到index位置处\n * @param record 被添加的单条数据\n * @param index 代表的数据源中的index\n */\n addRecord(record: any, index: number) {\n this.source.splice(index, 0, record);\n this.currentIndexedData.push(this.currentIndexedData.length);\n this._sourceLength += 1;\n\n if (this.userPagination) {\n //如果用户配置了分页\n this.pagination.totalCount = this._sourceLength;\n const { perPageCount, currentPage } = this.pagination;\n const startIndex = perPageCount * (currentPage || 0);\n const endIndex = startIndex + perPageCount;\n if (index < endIndex) {\n this.updatePagerData();\n }\n } else {\n this.pagination.perPageCount = this._sourceLength;\n this.pagination.totalCount = this._sourceLength;\n this.updatePagerData();\n }\n }\n /**\n * 将多条数据recordArr 依次添加到index位置处\n * @param recordArr\n * @param index 代表的数据源中的index\n */\n addRecords(recordArr: any, index: number) {\n if (Array.isArray(recordArr)) {\n this.source.splice(index, 0, ...recordArr);\n for (let i = 0; i < recordArr.length; i++) {\n this.currentIndexedData.push(this.currentIndexedData.length);\n }\n this._sourceLength += recordArr.length;\n }\n\n if (this.userPagination) {\n //如果用户配置了分页\n this.pagination.totalCount = this._sourceLength;\n const { perPageCount, currentPage } = this.pagination;\n const startIndex = perPageCount * (currentPage || 0);\n const endIndex = startIndex + perPageCount;\n if (index < endIndex) {\n this.updatePagerData();\n }\n } else {\n this.pagination.perPageCount = this._sourceLength;\n this.pagination.totalCount = this._sourceLength;\n this.updatePagerData();\n }\n }\n\n /**\n * 将单条数据record 添加到index位置处\n * @param record 被添加的单条数据\n * @param index 代表的数据源中的index\n */\n addRecordForSorted(record: any) {\n this.source.push(record);\n this.currentIndexedData.push(this.currentIndexedData.length);\n this._sourceLength += 1;\n this.sortedIndexMap.clear();\n if (!this.userPagination) {\n this.pagination.perPageCount = this._sourceLength;\n this.pagination.totalCount = this._sourceLength;\n }\n }\n /**\n * 将多条数据recordArr 依次添加到index位置处\n * @param recordArr\n * @param index 代表的数据源中的index\n */\n addRecordsForSorted(recordArr: any) {\n if (Array.isArray(recordArr)) {\n this.source.push(...recordArr);\n for (let i = 0; i < recordArr.length; i++) {\n this.currentIndexedData.push(this.currentIndexedData.length);\n }\n this._sourceLength += recordArr.length;\n this.sortedIndexMap.clear();\n }\n if (!this.userPagination) {\n this.pagination.perPageCount = this._sourceLength;\n this.pagination.totalCount = this._sourceLength;\n }\n }\n /**\n * 删除多条数据recordIndexs\n */\n deleteRecordsForSorted(recordIndexs: number[]) {\n const recordIndexsMaxToMin = recordIndexs.sort((a, b) => b - a);\n for (let index = 0; index < recordIndexsMaxToMin.length; index++) {\n const recordIndex = recordIndexsMaxToMin[index];\n if (recordIndex >= this._sourceLength || recordIndex < 0) {\n continue;\n }\n const rawIndex = this.currentIndexedData[recordIndex];\n this.source.splice(rawIndex, 1);\n this._sourceLength -= 1;\n }\n this.sortedIndexMap.clear();\n if (!this.userPagination) {\n this.pagination.perPageCount = this._sourceLength;\n this.pagination.totalCount = this._sourceLength;\n }\n }\n\n /**\n * 删除多条数据recordIndexs\n */\n deleteRecords(recordIndexs: number[]) {\n const realDeletedRecordIndexs = [];\n const recordIndexsMaxToMin = recordIndexs.sort((a, b) => b - a);\n for (let index = 0; index < recordIndexsMaxToMin.length; index++) {\n const recordIndex = recordIndexsMaxToMin[index];\n if (recordIndex >= this._sourceLength || recordIndex < 0) {\n continue;\n }\n realDeletedRecordIndexs.push(recordIndex);\n this.source.splice(recordIndex, 1);\n this.currentIndexedData.pop();\n this._sourceLength -= 1;\n }\n if (this.userPagination) {\n // 如果用户配置了分页\n this.updatePagerData();\n } else {\n this.pagination.perPageCount = this._sourceLength;\n this.pagination.totalCount = this._sourceLength;\n this.updatePagerData();\n }\n return realDeletedRecordIndexs;\n }\n\n sort(\n field: FieldDef,\n order: SortOrder,\n orderFn: (v1: any, v2: any, order: SortOrder) => -1 | 0 | 1 = order !== 'desc'\n ? (v1: any, v2: any): -1 | 0 | 1 => (v1 === v2 ? 0 : v1 > v2 ? 1 : -1)\n : (v1: any, v2: any): -1 | 0 | 1 => (v1 === v2 ? 0 : v1 < v2 ? 1 : -1)\n ): void {\n this.lastOrderField = field;\n this.lastOrder = order;\n this.lastOrderFn = orderFn;\n let filedMap = this.sortedIndexMap.get(field);\n let orderedData;\n\n if (filedMap) {\n orderedData = filedMap[order];\n if (orderedData && orderedData.length > 0) {\n this.currentIndexedData = orderedData;\n this.updatePagerData();\n this.fireListeners(EVENT_TYPE.CHANGE_ORDER, null);\n return;\n }\n }\n const sortedIndexArray = [] as number[];\n if (order === 'normal') {\n for (let i = 0; i < this._sourceLength; i++) {\n sortedIndexArray[i] = i;\n }\n } else {\n sort.sort(\n index => (isValid(sortedIndexArray[index]) ? sortedIndexArray[index] : (sortedIndexArray[index] = index)),\n (index, rel) => {\n sortedIndexArray[index] = rel;\n },\n this._sourceLength,\n orderFn,\n order,\n index => this.getOriginalField(index, field)\n );\n }\n this.currentIndexedData = sortedIndexArray;\n if (this.enableHierarchyState) {\n let nodeLength = sortedIndexArray.length;\n const t0 = window.performance.now();\n for (let i = 0; i < nodeLength; i++) {\n const subNodeLength = this.pushChildrenNode(\n sortedIndexArray[i],\n this.treeDataHierarchyState.get(sortedIndexArray[i]),\n this.getOriginalRecord(sortedIndexArray[i]) // ?sortedIndexArray 在这个过程中不是变化了吗 通过i取id还是对的吗? 对哦!因为i和nodeLength都+subNodeLength 来动态调整过了!\n );\n nodeLength += subNodeLength;\n i += subNodeLength;\n }\n }\n if (!filedMap) {\n filedMap = { asc: [], desc: [], normal: [] };\n this.sortedIndexMap.set(field, filedMap);\n }\n filedMap[order] = sortedIndexArray;\n this.updatePagerData();\n this.fireListeners(EVENT_TYPE.CHANGE_ORDER, null);\n }\n /**\n * 当节点折叠或者展开时 将排序缓存清空(非当前排序规则的缓存)\n */\n clearSortedIndexMap() {\n if (this.lastOrderField && this.lastOrder) {\n this.sortedIndexMap.forEach((sortMap, key) => {\n if (key !== this.lastOrderField) {\n this.sortedIndexMap.delete(key);\n } else if (this.lastOrder === 'asc') {\n sortMap.desc = [];\n sortMap.normal = [];\n } else if (this.lastOrder === 'desc') {\n sortMap.asc = [];\n sortMap.normal = [];\n } else {\n sortMap.desc = [];\n sortMap.asc = [];\n }\n });\n }\n }\n get sourceLength(): number {\n return this._sourceLength;\n }\n set sourceLength(sourceLen: number) {\n if (this._sourceLength === sourceLen) {\n return;\n }\n this._sourceLength = sourceLen;\n this.fireListeners(EVENT_TYPE.SOURCE_LENGTH_UPDATE, this._sourceLength);\n }\n get length(): number {\n return this.currentPagerIndexedData.length;\n }\n get dataSource(): DataSource {\n return this;\n }\n get currentPagerIndexedData(): (number | number[])[] {\n if (this._currentPagerIndexedData.length > 0) {\n return this._currentPagerIndexedData;\n }\n return []; //this.currentIndexedData || [];\n }\n release(): void {\n super.release?.();\n }\n clearSortedMap() {\n this.currentIndexedData && (this.currentIndexedData.length = 0);\n this.currentIndexedData = null;\n this.sortedIndexMap.forEach(item => {\n item.asc && (item.asc.length = 0);\n item.desc && (item.desc.length = 0);\n });\n this.sortedIndexMap.clear();\n }\n clearCurrentIndexedData(): void {\n this.currentIndexedData = null;\n this.currentPagerIndexedData.length = 0;\n }\n protected getOriginalRecord(dataIndex: number | number[]): MaybePromiseOrUndefined {\n return getValue(this._get(dataIndex), (val: MaybePromiseOrUndefined) => {\n this.recordPromiseCallBack(dataIndex, val);\n });\n }\n protected getRawRecord(dataIndex: number): MaybePromiseOrUndefined {\n if (this.beforeChangedRecordsMap?.[dataIndex as number]) {\n return this.beforeChangedRecordsMap[dataIndex as number];\n }\n return getValue(this._get(dataIndex), (val: MaybePromiseOrUndefined) => {\n this.recordPromiseCallBack(dataIndex, val);\n });\n }\n protected getOriginalField(\n index: number | number[],\n field: FieldDef | FieldFormat | number,\n col?: number,\n row?: number,\n table?: BaseTableAPI\n ): FieldData {\n if (field === null) {\n return undefined;\n }\n const record = this.getOriginalRecord(index);\n // return getField(record, field);\n return getField(record, field, col, row, table, (val: any) => {\n this.fieldPromiseCallBack(index, field, val);\n });\n }\n protected getRawFieldData(\n index: number,\n field: FieldDef | FieldFormat | number,\n col?: number,\n row?: number,\n table?: BaseTableAPI\n ): FieldData {\n if (field === null) {\n return undefined;\n }\n const record = this.getRawRecord(index);\n // return getField(record, field);\n return getField(record, field, col, row, table, (val: any) => {\n this.fieldPromiseCallBack(index, field, val);\n });\n }\n protected hasOriginalField(index: number | number[], field: FieldDef): boolean {\n if (field === null) {\n return false;\n }\n if (typeof field === 'function') {\n return true;\n }\n const record = this.getOriginalRecord(index);\n return Boolean(record && (field as any) in (record as any));\n }\n\n protected fieldPromiseCallBack(\n _index: number | number[],\n _field: FieldDef | FieldFormat | number,\n _value: MaybePromiseOrUndefined\n ): void {\n //\n }\n protected recordPromiseCallBack(_index: number | number[], _record: MaybePromiseOrUndefined): void {\n //\n }\n /** 静态变量 代表数据为空 */\n static EMPTY = new DataSource({\n get() {\n /* noop */\n },\n length: 0\n });\n}\n"]}
|
package/cjs/dataset/dataset.js
CHANGED
|
@@ -40,7 +40,7 @@ class Dataset {
|
|
|
40
40
|
this.setRecords(records);
|
|
41
41
|
}
|
|
42
42
|
setRecords(records) {
|
|
43
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
43
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
|
|
44
44
|
if (this.records = records, this.collectedValues = {}, this.cacheCollectedValues = {},
|
|
45
45
|
this.totalRecordsTree = {}, this.tree = {}, this.colFlatKeys = {}, this.rowFlatKeys = {},
|
|
46
46
|
this.colKeys = [], this.rowKeys = [], records) {
|
|
@@ -54,11 +54,11 @@ class Dataset {
|
|
|
54
54
|
this.sortKeys();
|
|
55
55
|
"undefined" != typeof window && window.performance.now(), "undefined" != typeof window && window.performance.now();
|
|
56
56
|
this.customRowTree ? (this.indicatorsAsCol || (this.customRowTree = this._adjustCustomTree(this.customRowTree)),
|
|
57
|
-
this.rowHeaderTree = this.customRowTree) : "tree" === this.rowHierarchyType ? this.rowHeaderTree = this.ArrToTree1(this.rowKeys, this.rows, this.indicatorsAsCol ? void 0 : this.indicators, (null === (_b = null === (_a =
|
|
57
|
+
this.rowHeaderTree = this.customRowTree) : "tree" === this.rowHierarchyType ? this.rowHeaderTree = this.ArrToTree1(this.rowKeys, this.rows, this.indicatorsAsCol ? void 0 : this.indicators, (null === (_b = null === (_a = this.totals) || void 0 === _a ? void 0 : _a.row) || void 0 === _b ? void 0 : _b.showGrandTotals) || !this.indicatorsAsCol && 0 === this.columns.length || this.indicatorsAsCol && 0 === this.rows.length, this.rowGrandTotalLabel) : this.rowHeaderTree = this.ArrToTree(this.rowKeys, this.rows, this.indicatorsAsCol ? void 0 : this.indicators, this.rowsIsTotal, (null === (_d = null === (_c = this.totals) || void 0 === _c ? void 0 : _c.row) || void 0 === _d ? void 0 : _d.showGrandTotals) || this.indicatorsAsCol && 0 === this.rows.length, this.rowGrandTotalLabel, this.rowSubTotalLabel, null !== (_g = null === (_f = null === (_e = this.totals) || void 0 === _e ? void 0 : _e.row) || void 0 === _f ? void 0 : _f.showGrandTotalsOnTop) && void 0 !== _g && _g, null !== (_k = null === (_j = null === (_h = this.totals) || void 0 === _h ? void 0 : _h.row) || void 0 === _j ? void 0 : _j.showSubTotalsOnTop) && void 0 !== _k && _k),
|
|
58
58
|
this.customColTree ? (this.indicatorsAsCol && (this.customColTree = this._adjustCustomTree(this.customColTree)),
|
|
59
|
-
this.colHeaderTree = this.customColTree) : this.colHeaderTree = this.ArrToTree(this.colKeys, this.columns, this.indicatorsAsCol ? this.indicators : void 0, this.colsIsTotal, (null === (
|
|
59
|
+
this.colHeaderTree = this.customColTree) : this.colHeaderTree = this.ArrToTree(this.colKeys, this.columns, this.indicatorsAsCol ? this.indicators : void 0, this.colsIsTotal, (null === (_m = null === (_l = this.totals) || void 0 === _l ? void 0 : _l.column) || void 0 === _m ? void 0 : _m.showGrandTotals) || !this.indicatorsAsCol && 0 === this.columns.length, this.colGrandTotalLabel, this.colSubTotalLabel, null !== (_q = null === (_p = null === (_o = this.totals) || void 0 === _o ? void 0 : _o.column) || void 0 === _p ? void 0 : _p.showGrandTotalsOnLeft) && void 0 !== _q && _q, null !== (_t = null === (_s = null === (_r = this.totals) || void 0 === _r ? void 0 : _r.column) || void 0 === _s ? void 0 : _s.showSubTotalsOnLeft) && void 0 !== _t && _t);
|
|
60
60
|
"undefined" != typeof window && window.performance.now();
|
|
61
|
-
(null === (
|
|
61
|
+
(null === (_u = this.dataConfig) || void 0 === _u ? void 0 : _u.isPivotChart) && this.cacheDeminsionCollectedValues();
|
|
62
62
|
}
|
|
63
63
|
}
|
|
64
64
|
registerAggregator(type, aggregator) {
|
|
@@ -464,7 +464,7 @@ class Dataset {
|
|
|
464
464
|
return arr.forEach((item => addList(item))), isGrandTotal && addList([ grandTotalLabel ]),
|
|
465
465
|
result;
|
|
466
466
|
}
|
|
467
|
-
ArrToTree(arr, rows, indicators, subTotalFlags, isGrandTotal, grandTotalLabel, subTotalLabel) {
|
|
467
|
+
ArrToTree(arr, rows, indicators, subTotalFlags, isGrandTotal, grandTotalLabel, subTotalLabel, showGrandTotalsOnTop, showSubTotalsOnTop) {
|
|
468
468
|
var _a;
|
|
469
469
|
let result = [];
|
|
470
470
|
const concatStr = this.stringJoinChar, map = new Map;
|
|
@@ -488,22 +488,21 @@ class Dataset {
|
|
|
488
488
|
})) : []
|
|
489
489
|
}, subTotalFlags[index]) {
|
|
490
490
|
let curChild = item.children;
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
}
|
|
491
|
+
const totalChild = {
|
|
492
|
+
value: subTotalLabel,
|
|
493
|
+
dimensionKey: rows[index + 1],
|
|
494
|
+
levelSpan: subTotalFlags.length - index - 1,
|
|
495
|
+
children: (null == indicators ? void 0 : indicators.length) >= 1 ? null == indicators ? void 0 : indicators.map((indicator => "string" == typeof indicator ? {
|
|
496
|
+
indicatorKey: indicator,
|
|
497
|
+
value: indicator
|
|
498
|
+
} : {
|
|
499
|
+
indicatorKey: indicator.indicatorKey,
|
|
500
|
+
value: indicator.title
|
|
501
|
+
})) : []
|
|
502
|
+
};
|
|
503
|
+
curChild.push(totalChild), curChild = totalChild.children;
|
|
505
504
|
}
|
|
506
|
-
map.set(flatKey, item), node ? subTotalFlags[index - 1] ? node.children.splice(node.children.length - 1, 0, item) : node.children.push(item) : result.push(item);
|
|
505
|
+
map.set(flatKey, item), node ? subTotalFlags[index - 1] && !showSubTotalsOnTop ? node.children.splice(node.children.length - 1, 0, item) : node.children.push(item) : result.push(item);
|
|
507
506
|
}
|
|
508
507
|
node = item;
|
|
509
508
|
}));
|
|
@@ -517,7 +516,7 @@ class Dataset {
|
|
|
517
516
|
const node = {
|
|
518
517
|
value: grandTotalLabel,
|
|
519
518
|
dimensionKey: rows[0],
|
|
520
|
-
|
|
519
|
+
levelSpan: subTotalFlags.length,
|
|
521
520
|
children: null !== (_a = null == indicators ? void 0 : indicators.map((indicator => "string" == typeof indicator ? {
|
|
522
521
|
indicatorKey: indicator,
|
|
523
522
|
value: indicator
|
|
@@ -526,7 +525,7 @@ class Dataset {
|
|
|
526
525
|
value: indicator.title
|
|
527
526
|
}))) && void 0 !== _a ? _a : []
|
|
528
527
|
};
|
|
529
|
-
result.push(node);
|
|
528
|
+
showGrandTotalsOnTop ? result.unshift(node) : result.push(node);
|
|
530
529
|
}
|
|
531
530
|
return result;
|
|
532
531
|
}
|