@visactor/vtable 1.7.5-alpha.0 → 1.7.5
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/ListTable.d.ts +2 -2
- package/cjs/ListTable.js +34 -22
- package/cjs/ListTable.js.map +1 -1
- package/cjs/PivotTable.d.ts +1 -0
- package/cjs/PivotTable.js +4 -0
- package/cjs/PivotTable.js.map +1 -1
- package/cjs/body-helper/body-helper.js +2 -2
- package/cjs/body-helper/body-helper.js.map +1 -1
- package/cjs/components/axis/axis.d.ts +1 -0
- package/cjs/components/axis/axis.js +14 -10
- package/cjs/components/axis/axis.js.map +1 -1
- package/cjs/core/BaseTable.js +7 -5
- package/cjs/core/BaseTable.js.map +1 -1
- package/cjs/core/record-helper.js +9 -11
- package/cjs/core/record-helper.js.map +1 -1
- package/cjs/data/CachedDataSource.d.ts +1 -1
- package/cjs/data/CachedDataSource.js +4 -4
- package/cjs/data/CachedDataSource.js.map +1 -1
- package/cjs/data/DataSource.d.ts +3 -5
- package/cjs/data/DataSource.js +49 -30
- package/cjs/data/DataSource.js.map +1 -1
- package/cjs/dataset/dataset-pivot-table.d.ts +1 -1
- package/cjs/dataset/dataset-pivot-table.js +10 -45
- package/cjs/dataset/dataset-pivot-table.js.map +1 -1
- package/cjs/dataset/dataset.d.ts +1 -0
- package/cjs/dataset/dataset.js +15 -7
- package/cjs/dataset/dataset.js.map +1 -1
- package/cjs/dataset/statistics-helper.js +1 -1
- package/cjs/dataset/statistics-helper.js.map +1 -1
- package/cjs/event/EventHandler.js +1 -1
- package/cjs/event/EventHandler.js.map +1 -1
- package/cjs/event/listener/table-group.js +37 -25
- package/cjs/event/listener/table-group.js.map +1 -1
- package/cjs/event/scroll.js +2 -1
- package/cjs/event/scroll.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/chart-helper/get-axis-config.js +26 -13
- package/cjs/layout/chart-helper/get-axis-config.js.map +1 -1
- package/cjs/layout/chart-helper/get-chart-spec.js +1 -1
- package/cjs/layout/chart-helper/get-chart-spec.js.map +1 -1
- package/cjs/scenegraph/group-creater/cell-helper.js +14 -10
- package/cjs/scenegraph/group-creater/cell-helper.js.map +1 -1
- package/cjs/scenegraph/group-creater/cell-type/spark-line-cell.js +1 -1
- package/cjs/scenegraph/group-creater/cell-type/spark-line-cell.js.map +1 -1
- package/cjs/scenegraph/group-creater/column-helper.js +6 -5
- package/cjs/scenegraph/group-creater/column-helper.js.map +1 -1
- package/cjs/scenegraph/icon/icon-update.d.ts +10 -1
- package/cjs/scenegraph/icon/icon-update.js +4 -4
- package/cjs/scenegraph/icon/icon-update.js.map +1 -1
- package/cjs/scenegraph/layout/update-height.js +1 -1
- package/cjs/scenegraph/layout/update-height.js.map +1 -1
- package/cjs/scenegraph/layout/update-width.js +5 -5
- package/cjs/scenegraph/layout/update-width.js.map +1 -1
- package/cjs/scenegraph/refresh-node/update-chart.js +2 -1
- package/cjs/scenegraph/refresh-node/update-chart.js.map +1 -1
- package/cjs/scenegraph/scenegraph.d.ts +9 -1
- package/cjs/scenegraph/scenegraph.js +12 -2
- package/cjs/scenegraph/scenegraph.js.map +1 -1
- package/cjs/scenegraph/style/frame-border.js +1 -0
- package/cjs/scenegraph/style/frame-border.js.map +1 -1
- package/cjs/state/sort/index.js +17 -6
- package/cjs/state/sort/index.js.map +1 -1
- package/cjs/state/state.d.ts +4 -4
- package/cjs/state/state.js +87 -17
- package/cjs/state/state.js.map +1 -1
- package/cjs/tools/util.d.ts +1 -0
- package/cjs/tools/util.js +7 -2
- package/cjs/tools/util.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/table-engine.d.ts +3 -1
- package/cjs/ts-types/table-engine.js.map +1 -1
- package/cjs/vrender.js +1 -1
- package/cjs/vrender.js.map +1 -1
- package/dist/vtable.js +416 -214
- package/dist/vtable.min.js +2 -2
- package/es/ListTable.d.ts +2 -2
- package/es/ListTable.js +33 -20
- package/es/ListTable.js.map +1 -1
- package/es/PivotTable.d.ts +1 -0
- package/es/PivotTable.js +4 -0
- package/es/PivotTable.js.map +1 -1
- package/es/body-helper/body-helper.js +3 -1
- package/es/body-helper/body-helper.js.map +1 -1
- package/es/components/axis/axis.d.ts +1 -0
- package/es/components/axis/axis.js +14 -10
- package/es/components/axis/axis.js.map +1 -1
- package/es/core/BaseTable.js +7 -5
- package/es/core/BaseTable.js.map +1 -1
- package/es/core/record-helper.js +9 -11
- package/es/core/record-helper.js.map +1 -1
- package/es/data/CachedDataSource.d.ts +1 -1
- package/es/data/CachedDataSource.js +4 -4
- package/es/data/CachedDataSource.js.map +1 -1
- package/es/data/DataSource.d.ts +3 -5
- package/es/data/DataSource.js +49 -28
- package/es/data/DataSource.js.map +1 -1
- package/es/dataset/dataset-pivot-table.d.ts +1 -1
- package/es/dataset/dataset-pivot-table.js +9 -44
- package/es/dataset/dataset-pivot-table.js.map +1 -1
- package/es/dataset/dataset.d.ts +1 -0
- package/es/dataset/dataset.js +15 -7
- package/es/dataset/dataset.js.map +1 -1
- package/es/dataset/statistics-helper.js +1 -1
- package/es/dataset/statistics-helper.js.map +1 -1
- package/es/event/EventHandler.js +1 -1
- package/es/event/EventHandler.js.map +1 -1
- package/es/event/listener/table-group.js +38 -26
- package/es/event/listener/table-group.js.map +1 -1
- package/es/event/scroll.js +2 -1
- package/es/event/scroll.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/chart-helper/get-axis-config.js +23 -12
- package/es/layout/chart-helper/get-axis-config.js.map +1 -1
- package/es/layout/chart-helper/get-chart-spec.js +1 -1
- package/es/layout/chart-helper/get-chart-spec.js.map +1 -1
- package/es/scenegraph/group-creater/cell-helper.js +14 -9
- package/es/scenegraph/group-creater/cell-helper.js.map +1 -1
- package/es/scenegraph/group-creater/cell-type/spark-line-cell.js +1 -1
- package/es/scenegraph/group-creater/cell-type/spark-line-cell.js.map +1 -1
- package/es/scenegraph/group-creater/column-helper.js +6 -5
- package/es/scenegraph/group-creater/column-helper.js.map +1 -1
- package/es/scenegraph/icon/icon-update.d.ts +10 -1
- package/es/scenegraph/icon/icon-update.js +5 -3
- package/es/scenegraph/icon/icon-update.js.map +1 -1
- package/es/scenegraph/layout/update-height.js +1 -1
- package/es/scenegraph/layout/update-height.js.map +1 -1
- package/es/scenegraph/layout/update-width.js +5 -5
- package/es/scenegraph/layout/update-width.js.map +1 -1
- package/es/scenegraph/refresh-node/update-chart.js +2 -1
- package/es/scenegraph/refresh-node/update-chart.js.map +1 -1
- package/es/scenegraph/scenegraph.d.ts +9 -1
- package/es/scenegraph/scenegraph.js +12 -2
- package/es/scenegraph/scenegraph.js.map +1 -1
- package/es/scenegraph/style/frame-border.js +1 -0
- package/es/scenegraph/style/frame-border.js.map +1 -1
- package/es/state/sort/index.js +17 -6
- package/es/state/sort/index.js.map +1 -1
- package/es/state/state.d.ts +4 -4
- package/es/state/state.js +88 -16
- package/es/state/state.js.map +1 -1
- package/es/tools/util.d.ts +1 -0
- package/es/tools/util.js +4 -0
- package/es/tools/util.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/table-engine.d.ts +3 -1
- package/es/ts-types/table-engine.js.map +1 -1
- package/es/vrender.js +1 -1
- package/es/vrender.js.map +1 -1
- package/package.json +4 -4
package/es/core/record-helper.js
CHANGED
|
@@ -113,20 +113,18 @@ function getCellUpdateType(col, row, table, oldCellUpdateType) {
|
|
|
113
113
|
}
|
|
114
114
|
|
|
115
115
|
export function sortRecords(table) {
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
}
|
|
124
|
-
}
|
|
116
|
+
let sortState = table.sortState;
|
|
117
|
+
sortState = !sortState || Array.isArray(sortState) ? sortState : [ sortState ],
|
|
118
|
+
sortState && (sortState = sortState.map((item => {
|
|
119
|
+
var _a;
|
|
120
|
+
return item.orderFn = null !== (_a = table._getSortFuncFromHeaderOption(void 0, item.field)) && void 0 !== _a ? _a : defaultOrderFn,
|
|
121
|
+
item;
|
|
122
|
+
})), table.dataSource.sort(sortState));
|
|
125
123
|
}
|
|
126
124
|
|
|
127
125
|
export function listTableAddRecord(record, recordIndex, table) {
|
|
128
126
|
var _a, _b;
|
|
129
|
-
if (table.options.groupBy) null === (_b = (_a = table.dataSource).addRecordsForGroup) || void 0 === _b || _b.call(_a, [ record ]),
|
|
127
|
+
if (table.options.groupBy) null === (_b = (_a = table.dataSource).addRecordsForGroup) || void 0 === _b || _b.call(_a, [ record ], recordIndex),
|
|
130
128
|
table.refreshRowColCount(), table.internalProps.layoutMap.clearCellRangeMap(), table.scenegraph.clearCells(),
|
|
131
129
|
table.scenegraph.createSceneGraph(); else if (table.sortState) table.dataSource.addRecordForSorted(record),
|
|
132
130
|
sortRecords(table), table.refreshRowColCount(), table.scenegraph.clearCells(), table.scenegraph.createSceneGraph(); else {
|
|
@@ -180,7 +178,7 @@ export function listTableAddRecord(record, recordIndex, table) {
|
|
|
180
178
|
|
|
181
179
|
export function listTableAddRecords(records, recordIndex, table) {
|
|
182
180
|
var _a, _b;
|
|
183
|
-
if (table.options.groupBy) null === (_b = (_a = table.dataSource).addRecordsForGroup) || void 0 === _b || _b.call(_a, records),
|
|
181
|
+
if (table.options.groupBy) null === (_b = (_a = table.dataSource).addRecordsForGroup) || void 0 === _b || _b.call(_a, records, recordIndex),
|
|
184
182
|
table.refreshRowColCount(), table.internalProps.layoutMap.clearCellRangeMap(), table.scenegraph.clearCells(),
|
|
185
183
|
table.scenegraph.createSceneGraph(); else if (table.sortState) table.dataSource.addRecordsForSorted(records),
|
|
186
184
|
sortRecords(table), table.refreshRowColCount(), table.scenegraph.clearCells(), table.scenegraph.createSceneGraph(); else {
|
|
@@ -1 +1 @@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AG,oBAAoB,CAAC,KAAK,CAAC,CAAC;oBAChD,MAAM,MAAM,GAAG,WAAW,GAAG,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,mBAAmB,CAAC,CAAC,CAAC,KAAK,CAAC,sBAAsB,CAAC,CAAC;oBAC1G,IAAI,KAAK,CAAC,SAAS,EAAE;wBACnB,UAAU,CAAC,IAAI,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC,CAAC;qBAC1C;yBAAM;wBACL,UAAU,CAAC,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,CAAC,CAAC;qBAC1C;iBACF;gBACD,KAAK,CAAC,SAAS;oBACb,CAAC,CAAC,KAAK,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE,EAAE,EAAE,EAAE,UAAU,CAAC;oBAChD,CAAC,CAAC,KAAK,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE,EAAE,EAAE,EAAE,UAAU,CAAC,CAAC;aACpD;SACF;KAEF;AACH,CAAC","file":"record-helper.js","sourcesContent":["/* eslint-disable max-depth */\nimport type { ListTable } from '../ListTable';\nimport type { CachedDataSource } from '../data';\nimport { computeColWidth } from '../scenegraph/layout/compute-col-width';\nimport { computeRowHeight } from '../scenegraph/layout/compute-row-height';\nimport { defaultOrderFn } from '../tools/util';\nimport type { SortState } from '../ts-types';\nimport { TABLE_EVENT_TYPE } from './TABLE_EVENT_TYPE';\n\n/**\n * 更改单元格数据 会触发change_cell_value事件\n * @param col\n * @param row\n * @param value 更改后的值\n * @param workOnEditableCell 限制只能更改配置了编辑器的单元格值。快捷键paste这里配置的true,限制只能修改可编辑单元格值\n */\nexport function listTableChangeCellValue(\n col: number,\n row: number,\n value: string | number | null,\n workOnEditableCell: boolean,\n table: ListTable\n) {\n if ((workOnEditableCell && table.isHasEditorDefine(col, row)) || workOnEditableCell === false) {\n const recordIndex = table.getRecordShowIndexByCell(col, row);\n const { field } = table.internalProps.layoutMap.getBody(col, row);\n const beforeChangeValue = table.getCellRawValue(col, row);\n const oldValue = table.getCellOriginValue(col, row);\n if (table.isHeader(col, row)) {\n table.internalProps.layoutMap.updateColumnTitle(col, row, value as string);\n } else {\n table.dataSource.changeFieldValue(value, recordIndex, field, col, row, table);\n }\n const range = table.getCellRange(col, row);\n //改变单元格的值后 聚合值做重新计算\n const aggregators = table.internalProps.layoutMap.getAggregatorsByCell(col, row);\n if (aggregators) {\n if (Array.isArray(aggregators)) {\n for (let i = 0; i < aggregators?.length; i++) {\n aggregators[i].recalculate();\n }\n } else {\n aggregators.recalculate();\n }\n const aggregatorCells = table.internalProps.layoutMap.getAggregatorCellAddress(\n range.start.col,\n range.start.row,\n range.end.col,\n range.end.row\n );\n for (let i = 0; i < aggregatorCells.length; i++) {\n const range = table.getCellRange(aggregatorCells[i].col, aggregatorCells[i].row);\n for (let sCol = range.start.col; sCol <= range.end.col; sCol++) {\n for (let sRow = range.start.row; sRow <= range.end.row; sRow++) {\n table.scenegraph.updateCellContent(sCol, sRow);\n }\n }\n }\n }\n\n // const cell_value = table.getCellValue(col, row);\n\n for (let sCol = range.start.col; sCol <= range.end.col; sCol++) {\n for (let sRow = range.start.row; sRow <= range.end.row; sRow++) {\n table.scenegraph.updateCellContent(sCol, sRow);\n }\n }\n if (table.widthMode === 'adaptive' || (table.autoFillWidth && table.getAllColsWidth() <= table.tableNoFrameWidth)) {\n if (table.internalProps._widthResizedColMap.size === 0) {\n //如果没有手动调整过行高列宽 则重新计算一遍并重新分配\n table.scenegraph.recalculateColWidths();\n }\n } else if (!table.internalProps._widthResizedColMap.has(col)) {\n const oldWidth = table.getColWidth(col);\n const newWidth = computeColWidth(col, 0, table.rowCount - 1, table, false);\n if (newWidth !== oldWidth) {\n table.scenegraph.updateColWidth(col, newWidth - oldWidth);\n }\n }\n if (\n table.heightMode === 'adaptive' ||\n (table.autoFillHeight && table.getAllRowsHeight() <= table.tableNoFrameHeight)\n ) {\n if (table.internalProps._heightResizedRowMap.size === 0) {\n table.scenegraph.recalculateRowHeights();\n }\n } else if (table.heightMode === 'autoHeight' && !table.internalProps._heightResizedRowMap.has(row)) {\n const oldHeight = table.getRowHeight(row);\n const newHeight = computeRowHeight(row, 0, table.colCount - 1, table);\n table.scenegraph.updateRowHeight(row, newHeight - oldHeight);\n }\n table.fireListeners(TABLE_EVENT_TYPE.CHANGE_CELL_VALUE, {\n col,\n row,\n rawValue: beforeChangeValue,\n currentValue: oldValue,\n changedValue: table.getCellOriginValue(col, row)\n });\n table.scenegraph.updateNextFrame();\n }\n}\n/**\n * 批量更新多个单元格的数据\n * @param col 粘贴数据的起始列号\n * @param row 粘贴数据的起始行号\n * @param values 多个单元格的数据数组\n * @param workOnEditableCell 是否仅更改可编辑单元格\n */\nexport function listTableChangeCellValues(\n startCol: number,\n startRow: number,\n values: (string | number)[][],\n workOnEditableCell: boolean,\n table: ListTable\n) {\n let pasteColEnd = startCol;\n let pasteRowEnd = startRow;\n // const rowCount = values.length;\n //#region 提前组织好未更改前的数据\n const beforeChangeValues: (string | number)[][] = [];\n const oldValues: (string | number)[][] = [];\n let cellUpdateType: 'normal' | 'sort' | 'group';\n\n for (let i = 0; i < values.length; i++) {\n if (startRow + i > table.rowCount - 1) {\n break;\n }\n const rowValues = values[i];\n const rawRowValues: (string | number)[] = [];\n const oldRowValues: (string | number)[] = [];\n beforeChangeValues.push(rawRowValues);\n oldValues.push(oldRowValues);\n for (let j = 0; j < rowValues.length; j++) {\n if (startCol + j > table.colCount - 1) {\n break;\n }\n cellUpdateType = getCellUpdateType(startCol + j, startRow + i, table, cellUpdateType);\n const beforeChangeValue = table.getCellRawValue(startCol + j, startRow + i);\n rawRowValues.push(beforeChangeValue);\n const oldValue = table.getCellOriginValue(startCol + j, startRow + i);\n oldRowValues.push(oldValue);\n }\n }\n //#endregion\n for (let i = 0; i < values.length; i++) {\n if (startRow + i > table.rowCount - 1) {\n break;\n }\n pasteRowEnd = startRow + i;\n const rowValues = values[i];\n let thisRowPasteColEnd = startCol;\n for (let j = 0; j < rowValues.length; j++) {\n if (startCol + j > table.colCount - 1) {\n break;\n }\n thisRowPasteColEnd = startCol + j;\n if ((workOnEditableCell && table.isHasEditorDefine(startCol + j, startRow + i)) || workOnEditableCell === false) {\n const value = rowValues[j];\n const recordIndex = table.getRecordShowIndexByCell(startCol + j, startRow + i);\n const { field } = table.internalProps.layoutMap.getBody(startCol + j, startRow + i);\n // const beforeChangeValue = table.getCellRawValue(startCol + j, startRow + i);\n // const oldValue = table.getCellOriginValue(startCol + j, startRow + i);\n const beforeChangeValue = beforeChangeValues[i][j];\n const oldValue = oldValues[i][j];\n if (table.isHeader(startCol + j, startRow + i)) {\n table.internalProps.layoutMap.updateColumnTitle(startCol + j, startRow + i, value as string);\n } else {\n table.dataSource.changeFieldValue(value, recordIndex, field, startCol + j, startRow + i, table);\n }\n table.fireListeners(TABLE_EVENT_TYPE.CHANGE_CELL_VALUE, {\n col: startCol + j,\n row: startRow + i,\n rawValue: beforeChangeValue,\n currentValue: oldValue,\n changedValue: table.getCellOriginValue(startCol + j, startRow + i)\n });\n }\n }\n pasteColEnd = Math.max(pasteColEnd, thisRowPasteColEnd);\n }\n\n // const cell_value = table.getCellValue(col, row);\n const startRange = table.getCellRange(startCol, startRow);\n const range = table.getCellRange(pasteColEnd, pasteRowEnd);\n\n //改变单元格的值后 聚合值做重新计算\n const aggregators = table.internalProps.layoutMap.getAggregatorsByCellRange(\n startRange.start.col,\n startRange.start.row,\n range.end.col,\n range.end.row\n );\n\n if (aggregators) {\n for (let i = 0; i < aggregators?.length; i++) {\n aggregators[i].recalculate();\n }\n\n if (cellUpdateType === 'normal') {\n const aggregatorCells = table.internalProps.layoutMap.getAggregatorCellAddress(\n startRange.start.col,\n startRange.start.row,\n range.end.col,\n range.end.row\n );\n for (let i = 0; i < aggregatorCells.length; i++) {\n const range = table.getCellRange(aggregatorCells[i].col, aggregatorCells[i].row);\n for (let sCol = range.start.col; sCol <= range.end.col; sCol++) {\n for (let sRow = range.start.row; sRow <= range.end.row; sRow++) {\n table.scenegraph.updateCellContent(sCol, sRow);\n }\n }\n }\n }\n }\n\n if (cellUpdateType === 'group') {\n (table.dataSource as CachedDataSource).updateRecordsForGroup([], []);\n }\n\n if (cellUpdateType === 'sort' || cellUpdateType === 'group') {\n (table.dataSource as any).sortedIndexMap.clear();\n sortRecords(table);\n table.refreshRowColCount();\n table.internalProps.layoutMap.clearCellRangeMap();\n // 更新整个场景树\n table.scenegraph.clearCells();\n table.scenegraph.createSceneGraph();\n return;\n }\n\n for (let sCol = startRange.start.col; sCol <= range.end.col; sCol++) {\n for (let sRow = startRange.start.row; sRow <= range.end.row; sRow++) {\n table.scenegraph.updateCellContent(sCol, sRow);\n }\n }\n if (table.widthMode === 'adaptive' || (table.autoFillWidth && table.getAllColsWidth() <= table.tableNoFrameWidth)) {\n if (table.internalProps._widthResizedColMap.size === 0) {\n //如果没有手动调整过行高列宽 则重新计算一遍并重新分配\n table.scenegraph.recalculateColWidths();\n }\n } else {\n for (let sCol = startCol; sCol <= range.end.col; sCol++) {\n if (!table.internalProps._widthResizedColMap.has(sCol)) {\n const oldWidth = table.getColWidth(sCol);\n const newWidth = computeColWidth(sCol, 0, table.rowCount - 1, table, false);\n if (newWidth !== oldWidth) {\n table.scenegraph.updateColWidth(sCol, newWidth - oldWidth);\n }\n }\n }\n }\n if (\n table.heightMode === 'adaptive' ||\n (table.autoFillHeight && table.getAllRowsHeight() <= table.tableNoFrameHeight)\n ) {\n table.scenegraph.recalculateRowHeights();\n } else if (table.heightMode === 'autoHeight') {\n const rows: number[] = [];\n const deltaYs: number[] = [];\n for (let sRow = startRow; sRow <= range.end.row; sRow++) {\n if (table.rowHeightsMap.get(sRow)) {\n // 已经计算过行高的才走更新逻辑\n const oldHeight = table.getRowHeight(sRow);\n const newHeight = computeRowHeight(sRow, 0, table.colCount - 1, table);\n rows.push(sRow);\n deltaYs.push(newHeight - oldHeight);\n }\n }\n table.scenegraph.updateRowsHeight(rows, deltaYs);\n }\n\n table.scenegraph.updateNextFrame();\n}\n\ntype CellUpdateType = 'normal' | 'sort' | 'group';\nfunction getCellUpdateType(\n col: number,\n row: number,\n table: ListTable,\n oldCellUpdateType: CellUpdateType | undefined\n): CellUpdateType {\n if (oldCellUpdateType === 'group') {\n return oldCellUpdateType;\n }\n if (oldCellUpdateType === 'sort' && !table.options.groupBy) {\n return oldCellUpdateType;\n }\n let cellUpdateType: CellUpdateType = 'normal';\n if (table.options.groupBy) {\n cellUpdateType = 'group';\n } else if (!table.isHeader(col, row) && (table.dataSource as any).lastOrderField) {\n const field = table.getBodyField(col, row);\n if (field === (table.dataSource as any).lastOrderField) {\n cellUpdateType = 'sort';\n }\n }\n return cellUpdateType;\n}\n\nexport function sortRecords(table: ListTable) {\n if (table.sortState) {\n let order: any;\n let field: any;\n if (Array.isArray(table.sortState)) {\n if (table.sortState.length !== 0) {\n ({ order, field } = table.sortState?.[0]);\n }\n } else {\n ({ order, field } = table.sortState as SortState);\n }\n // 根据sort规则进行排序\n if (order && field && order !== 'normal') {\n const sortFunc = table._getSortFuncFromHeaderOption(undefined, field);\n // 如果sort传入的信息不能生成正确的sortFunc,直接更新表格,避免首次加载无法正常显示内容\n const hd = table.internalProps.layoutMap.headerObjects.find((col: any) => col && col.field === field);\n\n // hd?.define?.sort && //如果这里也判断 那想要利用sortState来排序 但不显示排序图标就实现不了\n hd && table.dataSource.sort(hd.field, order, sortFunc ?? defaultOrderFn);\n }\n }\n}\n\n/**\n * 添加数据 单条数据\n * @param record 数据\n * @param recordIndex 向数据源中要插入的位置,从0开始。不设置recordIndex的话 默认追加到最后。\n * 如果设置了排序规则recordIndex无效,会自动适应排序逻辑确定插入顺序。\n * recordIndex 可以通过接口getRecordShowIndexByCell获取\n */\nexport function listTableAddRecord(record: any, recordIndex: number, table: ListTable) {\n if (table.options.groupBy) {\n (table.dataSource as CachedDataSource).addRecordsForGroup?.([record]);\n table.refreshRowColCount();\n table.internalProps.layoutMap.clearCellRangeMap();\n // 更新整个场景树\n table.scenegraph.clearCells();\n table.scenegraph.createSceneGraph();\n } else if (table.sortState) {\n table.dataSource.addRecordForSorted(record);\n sortRecords(table);\n table.refreshRowColCount();\n // 更新整个场景树\n table.scenegraph.clearCells();\n table.scenegraph.createSceneGraph();\n } else {\n if (recordIndex === undefined || recordIndex > table.dataSource.sourceLength) {\n recordIndex = table.dataSource.sourceLength;\n }\n const headerCount = table.transpose ? table.rowHeaderLevelCount : table.columnHeaderLevelCount;\n table.dataSource.addRecord(record, recordIndex);\n const oldRowCount = table.rowCount;\n table.refreshRowColCount();\n if (table.scenegraph.proxy.totalActualBodyRowCount === 0) {\n table.scenegraph.clearCells();\n table.scenegraph.createSceneGraph();\n return;\n }\n const newRowCount = table.transpose ? table.colCount : table.rowCount;\n if (table.pagination) {\n const { perPageCount, currentPage } = table.pagination;\n const startIndex = perPageCount * (currentPage || 0);\n const endIndex = startIndex + perPageCount;\n if (recordIndex < endIndex) {\n //插入当前页或者前面的数据才需要更新 如果是插入的是当前页后面的数据不需要更新场景树\n if (recordIndex < endIndex - perPageCount) {\n // 如果是当页之前的数据 则整个场景树都更新\n table.scenegraph.clearCells();\n table.scenegraph.createSceneGraph();\n } else {\n //如果是插入当前页数据\n const rowNum = recordIndex - (endIndex - perPageCount) + headerCount;\n if (oldRowCount - headerCount === table.pagination.perPageCount) {\n //如果当页数据是满的 则更新插入的部分行\n const updateRows = [];\n for (let row = rowNum; row < newRowCount; row++) {\n if (table.transpose) {\n updateRows.push({ col: row, row: 0 });\n } else {\n updateRows.push({ col: 0, row });\n }\n }\n table.transpose\n ? table.scenegraph.updateCol([], [], updateRows)\n : table.scenegraph.updateRow([], [], updateRows);\n } else {\n //如果当页数据不是满的 则插入新数据\n const addRows = [];\n for (let row = rowNum; row < Math.min(newRowCount, rowNum + 1); row++) {\n if (table.transpose) {\n addRows.push({ col: row, row: 0 });\n } else {\n addRows.push({ col: 0, row });\n }\n }\n table.transpose ? table.scenegraph.updateCol([], addRows, []) : table.scenegraph.updateRow([], addRows, []);\n }\n }\n }\n } else {\n const addRows = [];\n for (let row = recordIndex + headerCount; row < recordIndex + headerCount + 1; row++) {\n if (table.transpose) {\n addRows.push({ col: row, row: 0 });\n } else {\n addRows.push({ col: 0, row });\n }\n }\n table.transpose ? table.scenegraph.updateCol([], addRows, []) : table.scenegraph.updateRow([], addRows, []);\n }\n }\n // table.fireListeners(TABLE_EVENT_TYPE.ADD_RECORD, { row });\n}\n\n/**\n * 添加数据 支持多条数据\n * @param records 多条数据\n * @param recordIndex 向数据源中要插入的位置,从0开始。不设置recordIndex的话 默认追加到最后。\n * 如果设置了排序规则recordIndex无效,会自动适应排序逻辑确定插入顺序。\n * recordIndex 可以通过接口getRecordShowIndexByCell获取\n */\nexport function listTableAddRecords(records: any[], recordIndex: number, table: ListTable) {\n if (table.options.groupBy) {\n (table.dataSource as CachedDataSource).addRecordsForGroup?.(records);\n table.refreshRowColCount();\n table.internalProps.layoutMap.clearCellRangeMap();\n // 更新整个场景树\n table.scenegraph.clearCells();\n table.scenegraph.createSceneGraph();\n } else if (table.sortState) {\n table.dataSource.addRecordsForSorted(records);\n sortRecords(table);\n table.refreshRowColCount();\n // 更新整个场景树\n table.scenegraph.clearCells();\n table.scenegraph.createSceneGraph();\n } else {\n if (recordIndex === undefined || recordIndex > table.dataSource.sourceLength) {\n recordIndex = table.dataSource.sourceLength;\n } else if (recordIndex < 0) {\n recordIndex = 0;\n }\n const headerCount = table.transpose ? table.rowHeaderLevelCount : table.columnHeaderLevelCount;\n table.dataSource.addRecords(records, recordIndex);\n const oldRowCount = table.transpose ? table.colCount : table.rowCount;\n table.refreshRowColCount();\n if (table.scenegraph.proxy.totalActualBodyRowCount === 0) {\n table.scenegraph.clearCells();\n table.scenegraph.createSceneGraph();\n return;\n }\n const newRowCount = table.transpose ? table.colCount : table.rowCount;\n if (table.pagination) {\n const { perPageCount, currentPage } = table.pagination;\n const startIndex = perPageCount * (currentPage || 0);\n const endIndex = startIndex + perPageCount;\n if (recordIndex < endIndex) {\n //插入当前页或者前面的数据才需要更新 如果是插入的是当前页后面的数据不需要更新场景树\n if (recordIndex < endIndex - perPageCount) {\n // 如果是当页之前的数据 则整个场景树都更新\n table.scenegraph.clearCells();\n table.scenegraph.createSceneGraph();\n } else {\n //如果是插入当前页数据\n\n const rowNum = recordIndex - (endIndex - perPageCount) + headerCount;\n if (oldRowCount - headerCount === table.pagination.perPageCount) {\n //如果当页数据是满的 则更新插入的部分行\n const updateRows = [];\n for (let row = rowNum; row < newRowCount; row++) {\n if (table.transpose) {\n updateRows.push({ col: row, row: 0 });\n } else {\n updateRows.push({ col: 0, row });\n }\n }\n table.transpose\n ? table.scenegraph.updateCol([], [], updateRows)\n : table.scenegraph.updateRow([], [], updateRows);\n } else {\n //如果当页数据不是满的 则插入新数据\n const addRows = [];\n for (\n let row = rowNum;\n row < Math.min(newRowCount, rowNum + (Array.isArray(records) ? records.length : 1));\n row++\n ) {\n if (table.transpose) {\n addRows.push({ col: row, row: 0 });\n } else {\n addRows.push({ col: 0, row });\n }\n }\n table.transpose ? table.scenegraph.updateCol([], addRows, []) : table.scenegraph.updateRow([], addRows, []);\n }\n }\n }\n } else {\n const addRows = [];\n for (\n let row = recordIndex + headerCount;\n row < recordIndex + headerCount + (Array.isArray(records) ? records.length : 1);\n row++\n ) {\n if (table.transpose) {\n addRows.push({ col: row, row: 0 });\n } else {\n addRows.push({ col: 0, row });\n }\n }\n table.transpose ? table.scenegraph.updateCol([], addRows, []) : table.scenegraph.updateRow([], addRows, []);\n }\n }\n // table.fireListeners(TABLE_EVENT_TYPE.ADD_RECORD, { row });\n}\n\n/**\n * 删除数据 支持多条数据\n * @param recordIndexs 要删除数据的索引(显示在body中的索引,即要修改的是body部分的第几行数据)\n */\nexport function listTableDeleteRecords(recordIndexs: number[], table: ListTable) {\n if (recordIndexs?.length > 0) {\n if (table.options.groupBy) {\n (table.dataSource as CachedDataSource).deleteRecordsForGroup?.(recordIndexs);\n table.refreshRowColCount();\n table.internalProps.layoutMap.clearCellRangeMap();\n // 更新整个场景树\n table.scenegraph.clearCells();\n table.scenegraph.createSceneGraph();\n } else if (table.sortState) {\n table.dataSource.deleteRecordsForSorted(recordIndexs);\n sortRecords(table);\n table.refreshRowColCount();\n // 更新整个场景树\n table.scenegraph.clearCells();\n table.scenegraph.createSceneGraph();\n } else {\n const deletedRecordIndexs = table.dataSource.deleteRecords(recordIndexs);\n if (deletedRecordIndexs.length === 0) {\n return;\n }\n const oldRowCount = table.transpose ? table.colCount : table.rowCount;\n table.refreshRowColCount();\n const newRowCount = table.transpose ? table.colCount : table.rowCount;\n const recordIndexsMinToMax = deletedRecordIndexs.sort((a, b) => a - b);\n const minRecordIndex = recordIndexsMinToMax[0];\n if (table.pagination) {\n const { perPageCount, currentPage } = table.pagination;\n const startIndex = perPageCount * (currentPage || 0);\n const endIndex = startIndex + perPageCount;\n if (minRecordIndex < endIndex) {\n //删除当前页或者前面的数据才需要更新 如果是删除的是当前页后面的数据不需要更新场景树\n if (minRecordIndex < endIndex - perPageCount) {\n // 如果删除包含当页之前的数据 则整个场景树都更新\n table.scenegraph.clearCells();\n table.scenegraph.createSceneGraph();\n } else {\n //如果是仅删除当前页数据\n const minRowNum =\n minRecordIndex -\n (endIndex - perPageCount) +\n (table.transpose ? table.rowHeaderLevelCount : table.columnHeaderLevelCount);\n //如果当页数据是满的 则更新影响的部分行\n const updateRows = [];\n const delRows = [];\n\n for (let row = minRowNum; row < newRowCount; row++) {\n if (table.transpose) {\n updateRows.push({ col: row, row: 0 });\n } else {\n updateRows.push({ col: 0, row });\n }\n }\n if (newRowCount < oldRowCount) {\n //如果如果删除后不满 需要有删除数据\n for (let row = newRowCount; row < oldRowCount; row++) {\n if (table.transpose) {\n delRows.push({ col: row, row: 0 });\n } else {\n delRows.push({ col: 0, row });\n }\n }\n }\n table.transpose\n ? table.scenegraph.updateCol(delRows, [], updateRows)\n : table.scenegraph.updateRow(delRows, [], updateRows);\n }\n }\n } else {\n const delRows = [];\n\n for (let index = 0; index < recordIndexsMinToMax.length; index++) {\n const recordIndex = recordIndexsMinToMax[index];\n const rowNum = recordIndex + (table.transpose ? table.rowHeaderLevelCount : table.columnHeaderLevelCount);\n if (table.transpose) {\n delRows.push({ col: rowNum, row: 0 });\n } else {\n delRows.push({ col: 0, row: rowNum });\n }\n }\n table.transpose ? table.scenegraph.updateCol(delRows, [], []) : table.scenegraph.updateRow(delRows, [], []);\n }\n }\n // table.fireListeners(TABLE_EVENT_TYPE.ADD_RECORD, { row });\n }\n}\n\n/**\n * 修改数据 支持多条数据\n * @param records 修改数据条目\n * @param recordIndexs 对应修改数据的索引(显示在body中的索引,即要修改的是body部分的第几行数据)\n */\nexport function listTableUpdateRecords(records: any[], recordIndexs: number[], table: ListTable) {\n if (recordIndexs?.length > 0) {\n if (table.options.groupBy) {\n (table.dataSource as CachedDataSource).updateRecordsForGroup?.(records, recordIndexs);\n table.refreshRowColCount();\n table.internalProps.layoutMap.clearCellRangeMap();\n // 更新整个场景树\n table.scenegraph.clearCells();\n table.scenegraph.createSceneGraph();\n } else if (table.sortState) {\n table.dataSource.updateRecordsForSorted(records, recordIndexs);\n sortRecords(table);\n table.refreshRowColCount();\n // 更新整个场景树\n table.scenegraph.clearCells();\n table.scenegraph.createSceneGraph();\n } else {\n const updateRecordIndexs = table.dataSource.updateRecords(records, recordIndexs);\n if (updateRecordIndexs.length === 0) {\n return;\n }\n\n const recordIndexsMinToMax = updateRecordIndexs.sort((a, b) => a - b);\n if (table.pagination) {\n const { perPageCount, currentPage } = table.pagination;\n const startIndex = perPageCount * (currentPage || 0);\n const endIndex = startIndex + perPageCount;\n const updateRows = [];\n for (let index = 0; index < recordIndexsMinToMax.length; index++) {\n const recordIndex = recordIndexsMinToMax[index];\n if (recordIndex < endIndex && recordIndex >= endIndex - perPageCount) {\n const rowNum =\n recordIndex -\n (endIndex - perPageCount) +\n (table.transpose ? table.rowHeaderLevelCount : table.columnHeaderLevelCount);\n updateRows.push(rowNum);\n }\n }\n if (updateRows.length >= 1) {\n const updateRowCells = [];\n for (let index = 0; index < updateRows.length; index++) {\n const updateRow = updateRows[index];\n if (table.transpose) {\n updateRowCells.push({ col: updateRow, row: 0 });\n } else {\n updateRowCells.push({ col: 0, row: updateRow });\n }\n }\n table.transpose\n ? table.scenegraph.updateCol([], [], updateRowCells)\n : table.scenegraph.updateRow([], [], updateRowCells);\n }\n } else {\n const updateRows = [];\n for (let index = 0; index < recordIndexsMinToMax.length; index++) {\n const recordIndex = recordIndexsMinToMax[index];\n const rowNum = recordIndex + (table.transpose ? table.rowHeaderLevelCount : table.columnHeaderLevelCount);\n if (table.transpose) {\n updateRows.push({ col: rowNum, row: 0 });\n } else {\n updateRows.push({ col: 0, row: rowNum });\n }\n }\n table.transpose\n ? table.scenegraph.updateCol([], [], updateRows)\n : table.scenegraph.updateRow([], [], updateRows);\n }\n }\n // table.fireListeners(TABLE_EVENT_TYPE.ADD_RECORD, { row });\n }\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/core/record-helper.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,eAAe,EAAE,MAAM,wCAAwC,CAAC;AACzE,OAAO,EAAE,gBAAgB,EAAE,MAAM,yCAAyC,CAAC;AAC3E,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAE/C,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAStD,MAAM,UAAU,wBAAwB,CACtC,GAAW,EACX,GAAW,EACX,KAA6B,EAC7B,kBAA2B,EAC3B,KAAgB;IAEhB,IAAI,CAAC,kBAAkB,IAAI,KAAK,CAAC,iBAAiB,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,IAAI,kBAAkB,KAAK,KAAK,EAAE;QAC7F,MAAM,WAAW,GAAG,KAAK,CAAC,wBAAwB,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;QAC7D,MAAM,EAAE,KAAK,EAAE,GAAG,KAAK,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AAC,CAAC,KAAK,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE,EAAE,EAAE,EAAE,cAAc,CAAC,CAAC;iBACxD;aACF;iBAAM;gBACL,MAAM,UAAU,GAAG,EAAE,CAAC;gBACtB,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,oBAAoB,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE;oBAChE,MAAM,WAAW,GAAG,oBAAoB,CAAC,KAAK,CAAC,CAAC;oBAChD,MAAM,MAAM,GAAG,WAAW,GAAG,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,mBAAmB,CAAC,CAAC,CAAC,KAAK,CAAC,sBAAsB,CAAC,CAAC;oBAC1G,IAAI,KAAK,CAAC,SAAS,EAAE;wBACnB,UAAU,CAAC,IAAI,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC,CAAC;qBAC1C;yBAAM;wBACL,UAAU,CAAC,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,CAAC,CAAC;qBAC1C;iBACF;gBACD,KAAK,CAAC,SAAS;oBACb,CAAC,CAAC,KAAK,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE,EAAE,EAAE,EAAE,UAAU,CAAC;oBAChD,CAAC,CAAC,KAAK,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE,EAAE,EAAE,EAAE,UAAU,CAAC,CAAC;aACpD;SACF;KAEF;AACH,CAAC","file":"record-helper.js","sourcesContent":["/* eslint-disable max-depth */\nimport type { ListTable } from '../ListTable';\nimport type { CachedDataSource } from '../data';\nimport { computeColWidth } from '../scenegraph/layout/compute-col-width';\nimport { computeRowHeight } from '../scenegraph/layout/compute-row-height';\nimport { defaultOrderFn } from '../tools/util';\nimport type { SortState } from '../ts-types';\nimport { TABLE_EVENT_TYPE } from './TABLE_EVENT_TYPE';\n\n/**\n * 更改单元格数据 会触发change_cell_value事件\n * @param col\n * @param row\n * @param value 更改后的值\n * @param workOnEditableCell 限制只能更改配置了编辑器的单元格值。快捷键paste这里配置的true,限制只能修改可编辑单元格值\n */\nexport function listTableChangeCellValue(\n col: number,\n row: number,\n value: string | number | null,\n workOnEditableCell: boolean,\n table: ListTable\n) {\n if ((workOnEditableCell && table.isHasEditorDefine(col, row)) || workOnEditableCell === false) {\n const recordIndex = table.getRecordShowIndexByCell(col, row);\n const { field } = table.internalProps.layoutMap.getBody(col, row);\n const beforeChangeValue = table.getCellRawValue(col, row);\n const oldValue = table.getCellOriginValue(col, row);\n if (table.isHeader(col, row)) {\n table.internalProps.layoutMap.updateColumnTitle(col, row, value as string);\n } else {\n table.dataSource.changeFieldValue(value, recordIndex, field, col, row, table);\n }\n const range = table.getCellRange(col, row);\n //改变单元格的值后 聚合值做重新计算\n const aggregators = table.internalProps.layoutMap.getAggregatorsByCell(col, row);\n if (aggregators) {\n if (Array.isArray(aggregators)) {\n for (let i = 0; i < aggregators?.length; i++) {\n aggregators[i].recalculate();\n }\n } else {\n aggregators.recalculate();\n }\n const aggregatorCells = table.internalProps.layoutMap.getAggregatorCellAddress(\n range.start.col,\n range.start.row,\n range.end.col,\n range.end.row\n );\n for (let i = 0; i < aggregatorCells.length; i++) {\n const range = table.getCellRange(aggregatorCells[i].col, aggregatorCells[i].row);\n for (let sCol = range.start.col; sCol <= range.end.col; sCol++) {\n for (let sRow = range.start.row; sRow <= range.end.row; sRow++) {\n table.scenegraph.updateCellContent(sCol, sRow);\n }\n }\n }\n }\n\n // const cell_value = table.getCellValue(col, row);\n\n for (let sCol = range.start.col; sCol <= range.end.col; sCol++) {\n for (let sRow = range.start.row; sRow <= range.end.row; sRow++) {\n table.scenegraph.updateCellContent(sCol, sRow);\n }\n }\n if (table.widthMode === 'adaptive' || (table.autoFillWidth && table.getAllColsWidth() <= table.tableNoFrameWidth)) {\n if (table.internalProps._widthResizedColMap.size === 0) {\n //如果没有手动调整过行高列宽 则重新计算一遍并重新分配\n table.scenegraph.recalculateColWidths();\n }\n } else if (!table.internalProps._widthResizedColMap.has(col)) {\n const oldWidth = table.getColWidth(col);\n const newWidth = computeColWidth(col, 0, table.rowCount - 1, table, false);\n if (newWidth !== oldWidth) {\n table.scenegraph.updateColWidth(col, newWidth - oldWidth);\n }\n }\n if (\n table.heightMode === 'adaptive' ||\n (table.autoFillHeight && table.getAllRowsHeight() <= table.tableNoFrameHeight)\n ) {\n if (table.internalProps._heightResizedRowMap.size === 0) {\n table.scenegraph.recalculateRowHeights();\n }\n } else if (table.heightMode === 'autoHeight' && !table.internalProps._heightResizedRowMap.has(row)) {\n const oldHeight = table.getRowHeight(row);\n const newHeight = computeRowHeight(row, 0, table.colCount - 1, table);\n table.scenegraph.updateRowHeight(row, newHeight - oldHeight);\n }\n table.fireListeners(TABLE_EVENT_TYPE.CHANGE_CELL_VALUE, {\n col,\n row,\n rawValue: beforeChangeValue,\n currentValue: oldValue,\n changedValue: table.getCellOriginValue(col, row)\n });\n table.scenegraph.updateNextFrame();\n }\n}\n/**\n * 批量更新多个单元格的数据\n * @param col 粘贴数据的起始列号\n * @param row 粘贴数据的起始行号\n * @param values 多个单元格的数据数组\n * @param workOnEditableCell 是否仅更改可编辑单元格\n */\nexport function listTableChangeCellValues(\n startCol: number,\n startRow: number,\n values: (string | number)[][],\n workOnEditableCell: boolean,\n table: ListTable\n) {\n let pasteColEnd = startCol;\n let pasteRowEnd = startRow;\n // const rowCount = values.length;\n //#region 提前组织好未更改前的数据\n const beforeChangeValues: (string | number)[][] = [];\n const oldValues: (string | number)[][] = [];\n let cellUpdateType: 'normal' | 'sort' | 'group';\n\n for (let i = 0; i < values.length; i++) {\n if (startRow + i > table.rowCount - 1) {\n break;\n }\n const rowValues = values[i];\n const rawRowValues: (string | number)[] = [];\n const oldRowValues: (string | number)[] = [];\n beforeChangeValues.push(rawRowValues);\n oldValues.push(oldRowValues);\n for (let j = 0; j < rowValues.length; j++) {\n if (startCol + j > table.colCount - 1) {\n break;\n }\n cellUpdateType = getCellUpdateType(startCol + j, startRow + i, table, cellUpdateType);\n const beforeChangeValue = table.getCellRawValue(startCol + j, startRow + i);\n rawRowValues.push(beforeChangeValue);\n const oldValue = table.getCellOriginValue(startCol + j, startRow + i);\n oldRowValues.push(oldValue);\n }\n }\n //#endregion\n for (let i = 0; i < values.length; i++) {\n if (startRow + i > table.rowCount - 1) {\n break;\n }\n pasteRowEnd = startRow + i;\n const rowValues = values[i];\n let thisRowPasteColEnd = startCol;\n for (let j = 0; j < rowValues.length; j++) {\n if (startCol + j > table.colCount - 1) {\n break;\n }\n thisRowPasteColEnd = startCol + j;\n if ((workOnEditableCell && table.isHasEditorDefine(startCol + j, startRow + i)) || workOnEditableCell === false) {\n const value = rowValues[j];\n const recordIndex = table.getRecordShowIndexByCell(startCol + j, startRow + i);\n const { field } = table.internalProps.layoutMap.getBody(startCol + j, startRow + i);\n // const beforeChangeValue = table.getCellRawValue(startCol + j, startRow + i);\n // const oldValue = table.getCellOriginValue(startCol + j, startRow + i);\n const beforeChangeValue = beforeChangeValues[i][j];\n const oldValue = oldValues[i][j];\n if (table.isHeader(startCol + j, startRow + i)) {\n table.internalProps.layoutMap.updateColumnTitle(startCol + j, startRow + i, value as string);\n } else {\n table.dataSource.changeFieldValue(value, recordIndex, field, startCol + j, startRow + i, table);\n }\n table.fireListeners(TABLE_EVENT_TYPE.CHANGE_CELL_VALUE, {\n col: startCol + j,\n row: startRow + i,\n rawValue: beforeChangeValue,\n currentValue: oldValue,\n changedValue: table.getCellOriginValue(startCol + j, startRow + i)\n });\n }\n }\n pasteColEnd = Math.max(pasteColEnd, thisRowPasteColEnd);\n }\n\n // const cell_value = table.getCellValue(col, row);\n const startRange = table.getCellRange(startCol, startRow);\n const range = table.getCellRange(pasteColEnd, pasteRowEnd);\n\n //改变单元格的值后 聚合值做重新计算\n const aggregators = table.internalProps.layoutMap.getAggregatorsByCellRange(\n startRange.start.col,\n startRange.start.row,\n range.end.col,\n range.end.row\n );\n\n if (aggregators) {\n for (let i = 0; i < aggregators?.length; i++) {\n aggregators[i].recalculate();\n }\n\n if (cellUpdateType === 'normal') {\n const aggregatorCells = table.internalProps.layoutMap.getAggregatorCellAddress(\n startRange.start.col,\n startRange.start.row,\n range.end.col,\n range.end.row\n );\n for (let i = 0; i < aggregatorCells.length; i++) {\n const range = table.getCellRange(aggregatorCells[i].col, aggregatorCells[i].row);\n for (let sCol = range.start.col; sCol <= range.end.col; sCol++) {\n for (let sRow = range.start.row; sRow <= range.end.row; sRow++) {\n table.scenegraph.updateCellContent(sCol, sRow);\n }\n }\n }\n }\n }\n\n if (cellUpdateType === 'group') {\n (table.dataSource as CachedDataSource).updateRecordsForGroup([], []);\n }\n\n if (cellUpdateType === 'sort' || cellUpdateType === 'group') {\n (table.dataSource as any).sortedIndexMap.clear();\n sortRecords(table);\n table.refreshRowColCount();\n table.internalProps.layoutMap.clearCellRangeMap();\n // 更新整个场景树\n table.scenegraph.clearCells();\n table.scenegraph.createSceneGraph();\n return;\n }\n\n for (let sCol = startRange.start.col; sCol <= range.end.col; sCol++) {\n for (let sRow = startRange.start.row; sRow <= range.end.row; sRow++) {\n table.scenegraph.updateCellContent(sCol, sRow);\n }\n }\n if (table.widthMode === 'adaptive' || (table.autoFillWidth && table.getAllColsWidth() <= table.tableNoFrameWidth)) {\n if (table.internalProps._widthResizedColMap.size === 0) {\n //如果没有手动调整过行高列宽 则重新计算一遍并重新分配\n table.scenegraph.recalculateColWidths();\n }\n } else {\n for (let sCol = startCol; sCol <= range.end.col; sCol++) {\n if (!table.internalProps._widthResizedColMap.has(sCol)) {\n const oldWidth = table.getColWidth(sCol);\n const newWidth = computeColWidth(sCol, 0, table.rowCount - 1, table, false);\n if (newWidth !== oldWidth) {\n table.scenegraph.updateColWidth(sCol, newWidth - oldWidth);\n }\n }\n }\n }\n if (\n table.heightMode === 'adaptive' ||\n (table.autoFillHeight && table.getAllRowsHeight() <= table.tableNoFrameHeight)\n ) {\n table.scenegraph.recalculateRowHeights();\n } else if (table.heightMode === 'autoHeight') {\n const rows: number[] = [];\n const deltaYs: number[] = [];\n for (let sRow = startRow; sRow <= range.end.row; sRow++) {\n if (table.rowHeightsMap.get(sRow)) {\n // 已经计算过行高的才走更新逻辑\n const oldHeight = table.getRowHeight(sRow);\n const newHeight = computeRowHeight(sRow, 0, table.colCount - 1, table);\n rows.push(sRow);\n deltaYs.push(newHeight - oldHeight);\n }\n }\n table.scenegraph.updateRowsHeight(rows, deltaYs);\n }\n\n table.scenegraph.updateNextFrame();\n}\n\ntype CellUpdateType = 'normal' | 'sort' | 'group';\nfunction getCellUpdateType(\n col: number,\n row: number,\n table: ListTable,\n oldCellUpdateType: CellUpdateType | undefined\n): CellUpdateType {\n if (oldCellUpdateType === 'group') {\n return oldCellUpdateType;\n }\n if (oldCellUpdateType === 'sort' && !table.options.groupBy) {\n return oldCellUpdateType;\n }\n let cellUpdateType: CellUpdateType = 'normal';\n if (table.options.groupBy) {\n cellUpdateType = 'group';\n } else if (!table.isHeader(col, row) && (table.dataSource as any).lastOrderField) {\n const field = table.getBodyField(col, row);\n if (field === (table.dataSource as any).lastOrderField) {\n cellUpdateType = 'sort';\n }\n }\n return cellUpdateType;\n}\n\nexport function sortRecords(table: ListTable) {\n let sortState = table.sortState;\n sortState = !sortState || Array.isArray(sortState) ? sortState : [sortState];\n\n if (sortState) {\n sortState = (sortState as SortState[]).map(item => {\n item.orderFn = table._getSortFuncFromHeaderOption(undefined, item.field) ?? defaultOrderFn;\n //const hd = table.internalProps.layoutMap.headerObjects.find((col: any) => col && col.field === item.field);\n return item;\n });\n \n table.dataSource.sort(sortState);\n }\n}\n\n/**\n * 添加数据 单条数据\n * @param record 数据\n * @param recordIndex 向数据源中要插入的位置,从0开始。不设置recordIndex的话 默认追加到最后。\n * 如果设置了排序规则recordIndex无效,会自动适应排序逻辑确定插入顺序。\n * recordIndex 可以通过接口getRecordShowIndexByCell获取\n */\nexport function listTableAddRecord(record: any, recordIndex: number, table: ListTable) {\n if (table.options.groupBy) {\n (table.dataSource as CachedDataSource).addRecordsForGroup?.([record], recordIndex);\n table.refreshRowColCount();\n table.internalProps.layoutMap.clearCellRangeMap();\n // 更新整个场景树\n table.scenegraph.clearCells();\n table.scenegraph.createSceneGraph();\n } else if (table.sortState) {\n table.dataSource.addRecordForSorted(record);\n sortRecords(table);\n table.refreshRowColCount();\n // 更新整个场景树\n table.scenegraph.clearCells();\n table.scenegraph.createSceneGraph();\n } else {\n if (recordIndex === undefined || recordIndex > table.dataSource.sourceLength) {\n recordIndex = table.dataSource.sourceLength;\n }\n const headerCount = table.transpose ? table.rowHeaderLevelCount : table.columnHeaderLevelCount;\n table.dataSource.addRecord(record, recordIndex);\n const oldRowCount = table.rowCount;\n table.refreshRowColCount();\n if (table.scenegraph.proxy.totalActualBodyRowCount === 0) {\n table.scenegraph.clearCells();\n table.scenegraph.createSceneGraph();\n return;\n }\n const newRowCount = table.transpose ? table.colCount : table.rowCount;\n if (table.pagination) {\n const { perPageCount, currentPage } = table.pagination;\n const startIndex = perPageCount * (currentPage || 0);\n const endIndex = startIndex + perPageCount;\n if (recordIndex < endIndex) {\n //插入当前页或者前面的数据才需要更新 如果是插入的是当前页后面的数据不需要更新场景树\n if (recordIndex < endIndex - perPageCount) {\n // 如果是当页之前的数据 则整个场景树都更新\n table.scenegraph.clearCells();\n table.scenegraph.createSceneGraph();\n } else {\n //如果是插入当前页数据\n const rowNum = recordIndex - (endIndex - perPageCount) + headerCount;\n if (oldRowCount - headerCount === table.pagination.perPageCount) {\n //如果当页数据是满的 则更新插入的部分行\n const updateRows = [];\n for (let row = rowNum; row < newRowCount; row++) {\n if (table.transpose) {\n updateRows.push({ col: row, row: 0 });\n } else {\n updateRows.push({ col: 0, row });\n }\n }\n table.transpose\n ? table.scenegraph.updateCol([], [], updateRows)\n : table.scenegraph.updateRow([], [], updateRows);\n } else {\n //如果当页数据不是满的 则插入新数据\n const addRows = [];\n for (let row = rowNum; row < Math.min(newRowCount, rowNum + 1); row++) {\n if (table.transpose) {\n addRows.push({ col: row, row: 0 });\n } else {\n addRows.push({ col: 0, row });\n }\n }\n table.transpose ? table.scenegraph.updateCol([], addRows, []) : table.scenegraph.updateRow([], addRows, []);\n }\n }\n }\n } else {\n const addRows = [];\n for (let row = recordIndex + headerCount; row < recordIndex + headerCount + 1; row++) {\n if (table.transpose) {\n addRows.push({ col: row, row: 0 });\n } else {\n addRows.push({ col: 0, row });\n }\n }\n table.transpose ? table.scenegraph.updateCol([], addRows, []) : table.scenegraph.updateRow([], addRows, []);\n }\n }\n // table.fireListeners(TABLE_EVENT_TYPE.ADD_RECORD, { row });\n}\n\n/**\n * 添加数据 支持多条数据\n * @param records 多条数据\n * @param recordIndex 向数据源中要插入的位置,从0开始。不设置recordIndex的话 默认追加到最后。\n * 如果设置了排序规则recordIndex无效,会自动适应排序逻辑确定插入顺序。\n * recordIndex 可以通过接口getRecordShowIndexByCell获取\n */\nexport function listTableAddRecords(records: any[], recordIndex: number, table: ListTable) {\n if (table.options.groupBy) {\n (table.dataSource as CachedDataSource).addRecordsForGroup?.(records, recordIndex);\n table.refreshRowColCount();\n table.internalProps.layoutMap.clearCellRangeMap();\n // 更新整个场景树\n table.scenegraph.clearCells();\n table.scenegraph.createSceneGraph();\n } else if (table.sortState) {\n table.dataSource.addRecordsForSorted(records);\n sortRecords(table);\n table.refreshRowColCount();\n // 更新整个场景树\n table.scenegraph.clearCells();\n table.scenegraph.createSceneGraph();\n } else {\n if (recordIndex === undefined || recordIndex > table.dataSource.sourceLength) {\n recordIndex = table.dataSource.sourceLength;\n } else if (recordIndex < 0) {\n recordIndex = 0;\n }\n const headerCount = table.transpose ? table.rowHeaderLevelCount : table.columnHeaderLevelCount;\n table.dataSource.addRecords(records, recordIndex);\n const oldRowCount = table.transpose ? table.colCount : table.rowCount;\n table.refreshRowColCount();\n if (table.scenegraph.proxy.totalActualBodyRowCount === 0) {\n table.scenegraph.clearCells();\n table.scenegraph.createSceneGraph();\n return;\n }\n const newRowCount = table.transpose ? table.colCount : table.rowCount;\n if (table.pagination) {\n const { perPageCount, currentPage } = table.pagination;\n const startIndex = perPageCount * (currentPage || 0);\n const endIndex = startIndex + perPageCount;\n if (recordIndex < endIndex) {\n //插入当前页或者前面的数据才需要更新 如果是插入的是当前页后面的数据不需要更新场景树\n if (recordIndex < endIndex - perPageCount) {\n // 如果是当页之前的数据 则整个场景树都更新\n table.scenegraph.clearCells();\n table.scenegraph.createSceneGraph();\n } else {\n //如果是插入当前页数据\n\n const rowNum = recordIndex - (endIndex - perPageCount) + headerCount;\n if (oldRowCount - headerCount === table.pagination.perPageCount) {\n //如果当页数据是满的 则更新插入的部分行\n const updateRows = [];\n for (let row = rowNum; row < newRowCount; row++) {\n if (table.transpose) {\n updateRows.push({ col: row, row: 0 });\n } else {\n updateRows.push({ col: 0, row });\n }\n }\n table.transpose\n ? table.scenegraph.updateCol([], [], updateRows)\n : table.scenegraph.updateRow([], [], updateRows);\n } else {\n //如果当页数据不是满的 则插入新数据\n const addRows = [];\n for (\n let row = rowNum;\n row < Math.min(newRowCount, rowNum + (Array.isArray(records) ? records.length : 1));\n row++\n ) {\n if (table.transpose) {\n addRows.push({ col: row, row: 0 });\n } else {\n addRows.push({ col: 0, row });\n }\n }\n table.transpose ? table.scenegraph.updateCol([], addRows, []) : table.scenegraph.updateRow([], addRows, []);\n }\n }\n }\n } else {\n const addRows = [];\n for (\n let row = recordIndex + headerCount;\n row < recordIndex + headerCount + (Array.isArray(records) ? records.length : 1);\n row++\n ) {\n if (table.transpose) {\n addRows.push({ col: row, row: 0 });\n } else {\n addRows.push({ col: 0, row });\n }\n }\n table.transpose ? table.scenegraph.updateCol([], addRows, []) : table.scenegraph.updateRow([], addRows, []);\n }\n }\n // table.fireListeners(TABLE_EVENT_TYPE.ADD_RECORD, { row });\n}\n\n/**\n * 删除数据 支持多条数据\n * @param recordIndexs 要删除数据的索引(显示在body中的索引,即要修改的是body部分的第几行数据)\n */\nexport function listTableDeleteRecords(recordIndexs: number[], table: ListTable) {\n if (recordIndexs?.length > 0) {\n if (table.options.groupBy) {\n (table.dataSource as CachedDataSource).deleteRecordsForGroup?.(recordIndexs);\n table.refreshRowColCount();\n table.internalProps.layoutMap.clearCellRangeMap();\n // 更新整个场景树\n table.scenegraph.clearCells();\n table.scenegraph.createSceneGraph();\n } else if (table.sortState) {\n table.dataSource.deleteRecordsForSorted(recordIndexs);\n sortRecords(table);\n table.refreshRowColCount();\n // 更新整个场景树\n table.scenegraph.clearCells();\n table.scenegraph.createSceneGraph();\n } else {\n const deletedRecordIndexs = table.dataSource.deleteRecords(recordIndexs);\n if (deletedRecordIndexs.length === 0) {\n return;\n }\n const oldRowCount = table.transpose ? table.colCount : table.rowCount;\n table.refreshRowColCount();\n const newRowCount = table.transpose ? table.colCount : table.rowCount;\n const recordIndexsMinToMax = deletedRecordIndexs.sort((a, b) => a - b);\n const minRecordIndex = recordIndexsMinToMax[0];\n if (table.pagination) {\n const { perPageCount, currentPage } = table.pagination;\n const startIndex = perPageCount * (currentPage || 0);\n const endIndex = startIndex + perPageCount;\n if (minRecordIndex < endIndex) {\n //删除当前页或者前面的数据才需要更新 如果是删除的是当前页后面的数据不需要更新场景树\n if (minRecordIndex < endIndex - perPageCount) {\n // 如果删除包含当页之前的数据 则整个场景树都更新\n table.scenegraph.clearCells();\n table.scenegraph.createSceneGraph();\n } else {\n //如果是仅删除当前页数据\n const minRowNum =\n minRecordIndex -\n (endIndex - perPageCount) +\n (table.transpose ? table.rowHeaderLevelCount : table.columnHeaderLevelCount);\n //如果当页数据是满的 则更新影响的部分行\n const updateRows = [];\n const delRows = [];\n\n for (let row = minRowNum; row < newRowCount; row++) {\n if (table.transpose) {\n updateRows.push({ col: row, row: 0 });\n } else {\n updateRows.push({ col: 0, row });\n }\n }\n if (newRowCount < oldRowCount) {\n //如果如果删除后不满 需要有删除数据\n for (let row = newRowCount; row < oldRowCount; row++) {\n if (table.transpose) {\n delRows.push({ col: row, row: 0 });\n } else {\n delRows.push({ col: 0, row });\n }\n }\n }\n table.transpose\n ? table.scenegraph.updateCol(delRows, [], updateRows)\n : table.scenegraph.updateRow(delRows, [], updateRows);\n }\n }\n } else {\n const delRows = [];\n\n for (let index = 0; index < recordIndexsMinToMax.length; index++) {\n const recordIndex = recordIndexsMinToMax[index];\n const rowNum = recordIndex + (table.transpose ? table.rowHeaderLevelCount : table.columnHeaderLevelCount);\n if (table.transpose) {\n delRows.push({ col: rowNum, row: 0 });\n } else {\n delRows.push({ col: 0, row: rowNum });\n }\n }\n table.transpose ? table.scenegraph.updateCol(delRows, [], []) : table.scenegraph.updateRow(delRows, [], []);\n }\n }\n // table.fireListeners(TABLE_EVENT_TYPE.ADD_RECORD, { row });\n }\n}\n\n/**\n * 修改数据 支持多条数据\n * @param records 修改数据条目\n * @param recordIndexs 对应修改数据的索引(显示在body中的索引,即要修改的是body部分的第几行数据)\n */\nexport function listTableUpdateRecords(records: any[], recordIndexs: number[], table: ListTable) {\n if (recordIndexs?.length > 0) {\n if (table.options.groupBy) {\n (table.dataSource as CachedDataSource).updateRecordsForGroup?.(records, recordIndexs);\n table.refreshRowColCount();\n table.internalProps.layoutMap.clearCellRangeMap();\n // 更新整个场景树\n table.scenegraph.clearCells();\n table.scenegraph.createSceneGraph();\n } else if (table.sortState) {\n table.dataSource.updateRecordsForSorted(records, recordIndexs);\n sortRecords(table);\n table.refreshRowColCount();\n // 更新整个场景树\n table.scenegraph.clearCells();\n table.scenegraph.createSceneGraph();\n } else {\n const updateRecordIndexs = table.dataSource.updateRecords(records, recordIndexs);\n if (updateRecordIndexs.length === 0) {\n return;\n }\n\n const recordIndexsMinToMax = updateRecordIndexs.sort((a, b) => a - b);\n if (table.pagination) {\n const { perPageCount, currentPage } = table.pagination;\n const startIndex = perPageCount * (currentPage || 0);\n const endIndex = startIndex + perPageCount;\n const updateRows = [];\n for (let index = 0; index < recordIndexsMinToMax.length; index++) {\n const recordIndex = recordIndexsMinToMax[index];\n if (recordIndex < endIndex && recordIndex >= endIndex - perPageCount) {\n const rowNum =\n recordIndex -\n (endIndex - perPageCount) +\n (table.transpose ? table.rowHeaderLevelCount : table.columnHeaderLevelCount);\n updateRows.push(rowNum);\n }\n }\n if (updateRows.length >= 1) {\n const updateRowCells = [];\n for (let index = 0; index < updateRows.length; index++) {\n const updateRow = updateRows[index];\n if (table.transpose) {\n updateRowCells.push({ col: updateRow, row: 0 });\n } else {\n updateRowCells.push({ col: 0, row: updateRow });\n }\n }\n table.transpose\n ? table.scenegraph.updateCol([], [], updateRowCells)\n : table.scenegraph.updateRow([], [], updateRowCells);\n }\n } else {\n const updateRows = [];\n for (let index = 0; index < recordIndexsMinToMax.length; index++) {\n const recordIndex = recordIndexsMinToMax[index];\n const rowNum = recordIndex + (table.transpose ? table.rowHeaderLevelCount : table.columnHeaderLevelCount);\n if (table.transpose) {\n updateRows.push({ col: rowNum, row: 0 });\n } else {\n updateRows.push({ col: 0, row: rowNum });\n }\n }\n table.transpose\n ? table.scenegraph.updateCol([], [], updateRows)\n : table.scenegraph.updateRow([], [], updateRows);\n }\n }\n // table.fireListeners(TABLE_EVENT_TYPE.ADD_RECORD, { row });\n }\n}\n"]}
|
|
@@ -22,7 +22,7 @@ export declare class CachedDataSource extends DataSource {
|
|
|
22
22
|
processRecords(records: any[]): any;
|
|
23
23
|
getGroupLength(): number;
|
|
24
24
|
updateGroup(): void;
|
|
25
|
-
addRecordsForGroup(recordArr: any): void;
|
|
25
|
+
addRecordsForGroup(recordArr: any[], recordIndex?: number): void;
|
|
26
26
|
deleteRecordsForGroup(recordIndexs: number[]): void;
|
|
27
27
|
updateRecordsForGroup(records: any[], recordIndexs: number[]): void;
|
|
28
28
|
}
|
|
@@ -46,7 +46,7 @@ export class CachedDataSource extends DataSource {
|
|
|
46
46
|
_setFieldCache(this._fieldCache, index, field, value);
|
|
47
47
|
}
|
|
48
48
|
recordPromiseCallBack(index, record) {
|
|
49
|
-
this._recordCache[index] = record;
|
|
49
|
+
this._recordCache && (this._recordCache[index] = record);
|
|
50
50
|
}
|
|
51
51
|
get records() {
|
|
52
52
|
return Array.isArray(this._recordCache) && this._recordCache.length > 0 ? this._recordCache : super.records;
|
|
@@ -92,9 +92,9 @@ export class CachedDataSource extends DataSource {
|
|
|
92
92
|
this.pagination.totalCount = this.sourceLength), this.initTreeHierarchyState(),
|
|
93
93
|
this.updatePagerData();
|
|
94
94
|
}
|
|
95
|
-
addRecordsForGroup(recordArr) {
|
|
96
|
-
isArray(recordArr) && 0 !== recordArr.length && (this.dataSourceObj.records.
|
|
97
|
-
this.updateGroup());
|
|
95
|
+
addRecordsForGroup(recordArr, recordIndex) {
|
|
96
|
+
isArray(recordArr) && 0 !== recordArr.length && ((void 0 === recordIndex || recordIndex > this.dataSourceObj.records) && (recordIndex = this.dataSourceObj.records),
|
|
97
|
+
this.dataSourceObj.records.splice(recordIndex, 0, ...recordArr), this.updateGroup());
|
|
98
98
|
}
|
|
99
99
|
deleteRecordsForGroup(recordIndexs) {
|
|
100
100
|
if (!isArray(recordIndexs) || 0 === recordIndexs.length) return;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/data/CachedDataSource.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EACL,eAAe,EAQhB,MAAM,aAAa,CAAC;AAIrB,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAG1C,SAAS,cAAc,CACrB,MAA+C,EAC/C,KAAa,EACb,KAAe,EAEf,KAAU;IAEV,MAAM,QAAQ,GAAG,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,IAAI,GAAG,EAAE,CAAC,CAAC;IAC9D,QAAQ,CAAC,GAAG,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;AAC7B,CAAC;AAOD,MAAM,OAAO,gBAAiB,SAAQ,UAAU;IAY9C,MAAM,KAAK,UAAU;QACnB,OAAO,U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IAAI,KAAK,CAAC;YACxB,SAAS,CAAC,GAAG,CAAC,IAAI,KAAK,CAAC,EACxB;YACA,sBAAsB,CAAC,SAAS,CAAC,QAAQ,EAAE,SAAS,CAAC,QAAQ,EAAE,SAAS,CAAC,GAAG,EAAE,SAAS,CAAC,GAAG,CAAC,CAAC;SAC9F;KACF;AACH,CAAC","file":"CachedDataSource.js","sourcesContent":["import { isArray, isValid } from '@visactor/vutils';\nimport {\n AggregationType,\n HierarchyState,\n type FieldData,\n type FieldDef,\n type IListTableDataConfig,\n type IPagination,\n type MaybePromise,\n type MaybePromiseOrUndefined\n} from '../ts-types';\nimport type { BaseTableAPI } from '../ts-types/base-table';\nimport type { ColumnData } from '../ts-types/list-table/layout-map/api';\nimport type { DataSourceParam } from './DataSource';\nimport { DataSource } from './DataSource';\n\n/** @private */\nfunction _setFieldCache(\n fCache: { [index: number]: Map<FieldDef, any> },\n index: number,\n field: FieldDef,\n\n value: any\n): void {\n const recCache = fCache[index] || (fCache[index] = new Map());\n recCache.set(field, value);\n}\n/**\n * table data source for caching Promise data\n *\n * @classdesc VTable.data.CachedDataSource\n * @memberof VTable.data\n */\nexport class CachedDataSource extends DataSource {\n /**\n * record cache 当用户定义的CachedDataSource.get为promise的时候 可以用rCache缓存已获取数据条目\n */\n private _recordCache: any[];\n /**\n * field cache 当用户定义field为promise的时候 可以用fCache缓存已获取值\n */\n private _fieldCache: { [index: number]: Map<FieldDef, any> };\n\n groupAggregator: any;\n\n static get EVENT_TYPE(): typeof DataSource.EVENT_TYPE {\n return DataSource.EVENT_TYPE;\n }\n static ofArray(\n array: any[],\n dataConfig?: IListTableDataConfig,\n pagination?: IPagination,\n columnObjs?: ColumnData[],\n rowHierarchyType?: 'grid' | 'tree',\n hierarchyExpandLevel?: number\n ): CachedDataSource {\n return new CachedDataSource(\n {\n get: (index: number): any => {\n // if (Array.isArray(index)) {\n // return getValueFromDeepArray(array, index);\n // }\n return array[index];\n },\n length: array.length,\n records: array\n },\n dataConfig,\n pagination,\n columnObjs,\n rowHierarchyType,\n hierarchyExpandLevel\n );\n }\n\n // _originalRecords: any[];\n constructor(\n opt?: DataSourceParam,\n dataConfig?: IListTableDataConfig,\n pagination?: IPagination,\n columnObjs?: ColumnData[],\n rowHierarchyType?: 'grid' | 'tree',\n hierarchyExpandLevel?: number\n ) {\n if (isArray(dataConfig?.groupByRules)) {\n rowHierarchyType = 'tree';\n }\n super(opt, dataConfig, pagination, columnObjs, rowHierarchyType, hierarchyExpandLevel);\n this._recordCache = [];\n this._fieldCache = {};\n }\n protected getOriginalRecord(index: number): MaybePromiseOrUndefined {\n if (this._recordCache && this._recordCache[index]) {\n return this._recordCache[index];\n }\n return super.getOriginalRecord(index);\n }\n protected getRawRecord(index: number): MaybePromiseOrUndefined {\n if (this.beforeChangedRecordsMap?.[index as number]) {\n return this.beforeChangedRecordsMap[index as number];\n }\n if (this._recordCache && this._recordCache[index]) {\n return this._recordCache[index];\n }\n return super.getRawRecord(index);\n }\n protected getOriginalField<F extends FieldDef>(\n index: number,\n field: F,\n col?: number,\n row?: number,\n table?: BaseTableAPI\n ): FieldData {\n const rowCache = this._fieldCache && this._fieldCache[index];\n if (rowCache) {\n const cache = rowCache.get(field);\n if (cache) {\n return cache;\n }\n }\n return super.getOriginalField(index, field, col, row, table);\n }\n\n clearCache(): void {\n if (this._recordCache) {\n this._recordCache = [];\n }\n if (this._fieldCache) {\n this._fieldCache = {};\n }\n }\n\n protected fieldPromiseCallBack<F extends FieldDef>(index: number, field: F, value: MaybePromiseOrUndefined): void {\n _setFieldCache(this._fieldCache, index, field, value);\n }\n protected recordPromiseCallBack(index: number, record: MaybePromiseOrUndefined): void {\n this._recordCache[index] = record;\n }\n get records(): any[] {\n return Array.isArray(this._recordCache) && this._recordCache.length > 0 ? this._recordCache : super.records;\n }\n\n release(): void {\n super.release?.();\n this._recordCache = null;\n this._fieldCache = null;\n }\n\n _generateFieldAggragations() {\n super._generateFieldAggragations();\n // groupby aggragations\n if (isArray(this.dataConfig?.groupByRules)) {\n // const groupByKey = this.dataConfig.groupByRules[0];\n const groupByKeys = this.dataConfig.groupByRules;\n this.groupAggregator = new this.registedAggregators[AggregationType.CUSTOM]({\n dimension: '',\n aggregationFun: (values: any, records: any, field: any) => {\n const groupMap = new Map();\n const groupResult = [] as any[];\n for (let i = 0; i < records.length; i++) {\n dealWithGroup(records[i], groupResult, groupMap, groupByKeys, 0);\n records[i].vtableOriginIndex = i;\n }\n return groupResult;\n }\n });\n this.fieldAggregators.push(this.groupAggregator);\n }\n }\n\n processRecords(records: any[]) {\n const result = super.processRecords(records);\n const groupResult = this.groupAggregator?.value();\n if (groupResult) {\n // this._originalRecords = result;\n return groupResult;\n }\n return result;\n }\n\n getGroupLength() {\n return this.dataConfig?.groupByRules?.length ?? 0;\n }\n\n updateGroup() {\n this.clearCache();\n\n const oldSource = this.source;\n (this as any)._source = this.processRecords(this.dataSourceObj?.records ?? this.dataSourceObj);\n if (oldSource) {\n syncGroupCollapseState(oldSource, this.source);\n }\n\n // syncGroupCollapseState(this.source, newSource.source);\n this.sourceLength = this.source?.length || 0;\n this.sortedIndexMap.clear();\n this.currentIndexedData = Array.from({ length: this.sourceLength }, (_, i) => i);\n if (!this.userPagination) {\n this.pagination.perPageCount = this.sourceLength;\n this.pagination.totalCount = this.sourceLength;\n }\n\n this.initTreeHierarchyState();\n this.updatePagerData();\n }\n\n addRecordsForGroup(recordArr: any) {\n if (!isArray(recordArr) || recordArr.length === 0) {\n return;\n }\n this.dataSourceObj.records.push(...recordArr);\n\n this.updateGroup();\n }\n\n deleteRecordsForGroup(recordIndexs: number[]) {\n if (!isArray(recordIndexs) || recordIndexs.length === 0) {\n return;\n }\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 delete this.beforeChangedRecordsMap[recordIndex];\n this.dataSourceObj.records.splice(recordIndex, 1);\n this.sourceLength -= 1;\n }\n\n this.updateGroup();\n }\n\n updateRecordsForGroup(records: any[], recordIndexs: number[]) {\n // const realDeletedRecordIndexs: number[] = [];\n for (let index = 0; index < recordIndexs.length; index++) {\n const recordIndex = recordIndexs[index];\n if (recordIndex >= this.sourceLength || recordIndex < 0) {\n continue;\n }\n delete this.beforeChangedRecordsMap[recordIndex];\n // realDeletedRecordIndexs.push(recordIndex);\n this.dataSourceObj.records[recordIndex] = records[index];\n }\n\n this.updateGroup();\n }\n}\n\nfunction dealWithGroup(record: any, children: any[], map: Map<number, any>, groupByKeys: string[], level: number): any {\n const groupByKey = groupByKeys[level];\n if (!isValid(groupByKey)) {\n children.push(record);\n return;\n }\n const value = record[groupByKey];\n if (value !== undefined) {\n if (map.has(value)) {\n const index = map.get(value);\n // children[index].children.push(record);\n return dealWithGroup(record, children[index].children, children[index].map, groupByKeys, level + 1);\n }\n map.set(value, children.length);\n children.push({\n vtableMerge: true,\n vtableMergeName: value,\n children: [] as any,\n map: new Map()\n });\n return dealWithGroup(\n record,\n children[children.length - 1].children,\n children[children.length - 1].map,\n groupByKeys,\n level + 1\n );\n }\n}\n\nfunction syncGroupCollapseState(\n oldSource: any,\n newSource: any,\n oldGroupMap?: Map<string, number>,\n newGroupMap?: Map<string, number>\n) {\n if (!oldGroupMap) {\n oldGroupMap = new Map();\n for (let i = 0; i < oldSource.length; i++) {\n const record = oldSource[i];\n if (record.vtableMerge) {\n oldGroupMap.set(record.vtableMergeName, i);\n }\n }\n }\n\n if (!newGroupMap) {\n newGroupMap = new Map();\n for (let i = 0; i < newSource.length; i++) {\n const record = newSource[i];\n if (record.vtableMerge) {\n newGroupMap.set(record.vtableMergeName, i);\n }\n }\n }\n\n for (let i = 0; i < oldSource.length; i++) {\n const oldRecord = oldSource[i];\n const newRecord = newSource[newGroupMap.get(oldRecord.vtableMergeName)];\n if (isValid(newRecord)) {\n newRecord.hierarchyState = oldSource[i].hierarchyState;\n }\n if (\n isArray(oldRecord.children) &&\n isArray(newRecord.children) &&\n oldRecord.map.size !== 0 &&\n newRecord.map.size !== 0\n ) {\n syncGroupCollapseState(oldRecord.children, newRecord.children, oldRecord.map, newRecord.map);\n }\n }\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/data/CachedDataSource.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EACL,eAAe,EAQhB,MAAM,aAAa,CAAC;AAIrB,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAG1C,SAAS,cAAc,CACrB,MAA+C,EAC/C,KAAa,EACb,KAAe,EAEf,KAAU;IAEV,MAAM,QAAQ,GAAG,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,IAAI,GAAG,EAAE,CAAC,CAAC;IAC9D,QAAQ,CAAC,GAAG,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;AAC7B,CAAC;AAOD,MAAM,OAAO,gBAAiB,SAAQ,UAAU;IAY9C,MAAM,KAAK,UAAU;QACnB,OAAO,UAAU,CAAC,UAAU,CAAC;IAC/B,CAAC;IACD,MAAM,CAAC,OAAO,CACZ,KAAY,EACZ,UAAiC,EACjC,UAAwB,EACxB,UAAyB,EACzB,gBAAkC,EAClC,oBAA6B;QAE7B,OAAO,IAAI,gBAAgB,CACzB;YACE,GAAG,EAAE,CAAC,KAAa,EAAO,EAAE;gBAI1B,OAAO,KAAK,CAAC,KAAK,CAAC,CAAC;YACtB,CAAC;YACD,MAAM,EAAE,KAAK,CAAC,MAAM;YACpB,OAAO,EAAE,KAAK;SACf,EACD,UAAU,EACV,UAAU,EACV,UAAU,EACV,gBAAgB,EAChB,oBAAoB,CACrB,CAAC;IACJ,CAAC;IAGD,YACE,GAAqB,EACrB,UAAiC,EACjC,UAAwB,EACxB,UAAyB,EACzB,gBAAkC,EAClC,oBAA6B;QAE7B,IAA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n type FieldData,\n type FieldDef,\n type IListTableDataConfig,\n type IPagination,\n type MaybePromise,\n type MaybePromiseOrUndefined\n} from '../ts-types';\nimport type { BaseTableAPI } from '../ts-types/base-table';\nimport type { ColumnData } from '../ts-types/list-table/layout-map/api';\nimport type { DataSourceParam } from './DataSource';\nimport { DataSource } from './DataSource';\n\n/** @private */\nfunction _setFieldCache(\n fCache: { [index: number]: Map<FieldDef, any> },\n index: number,\n field: FieldDef,\n\n value: any\n): void {\n const recCache = fCache[index] || (fCache[index] = new Map());\n recCache.set(field, value);\n}\n/**\n * table data source for caching Promise data\n *\n * @classdesc VTable.data.CachedDataSource\n * @memberof VTable.data\n */\nexport class CachedDataSource extends DataSource {\n /**\n * record cache 当用户定义的CachedDataSource.get为promise的时候 可以用rCache缓存已获取数据条目\n */\n private _recordCache: any[];\n /**\n * field cache 当用户定义field为promise的时候 可以用fCache缓存已获取值\n */\n private _fieldCache: { [index: number]: Map<FieldDef, any> };\n\n groupAggregator: any;\n\n static get EVENT_TYPE(): typeof DataSource.EVENT_TYPE {\n return DataSource.EVENT_TYPE;\n }\n static ofArray(\n array: any[],\n dataConfig?: IListTableDataConfig,\n pagination?: IPagination,\n columnObjs?: ColumnData[],\n rowHierarchyType?: 'grid' | 'tree',\n hierarchyExpandLevel?: number\n ): CachedDataSource {\n return new CachedDataSource(\n {\n get: (index: number): any => {\n // if (Array.isArray(index)) {\n // return getValueFromDeepArray(array, index);\n // }\n return array[index];\n },\n length: array.length,\n records: array\n },\n dataConfig,\n pagination,\n columnObjs,\n rowHierarchyType,\n hierarchyExpandLevel\n );\n }\n\n // _originalRecords: any[];\n constructor(\n opt?: DataSourceParam,\n dataConfig?: IListTableDataConfig,\n pagination?: IPagination,\n columnObjs?: ColumnData[],\n rowHierarchyType?: 'grid' | 'tree',\n hierarchyExpandLevel?: number\n ) {\n if (isArray(dataConfig?.groupByRules)) {\n rowHierarchyType = 'tree';\n }\n super(opt, dataConfig, pagination, columnObjs, rowHierarchyType, hierarchyExpandLevel);\n this._recordCache = [];\n this._fieldCache = {};\n }\n protected getOriginalRecord(index: number): MaybePromiseOrUndefined {\n if (this._recordCache && this._recordCache[index]) {\n return this._recordCache[index];\n }\n return super.getOriginalRecord(index);\n }\n protected getRawRecord(index: number): MaybePromiseOrUndefined {\n if (this.beforeChangedRecordsMap?.[index as number]) {\n return this.beforeChangedRecordsMap[index as number];\n }\n if (this._recordCache && this._recordCache[index]) {\n return this._recordCache[index];\n }\n return super.getRawRecord(index);\n }\n protected getOriginalField<F extends FieldDef>(\n index: number,\n field: F,\n col?: number,\n row?: number,\n table?: BaseTableAPI\n ): FieldData {\n const rowCache = this._fieldCache && this._fieldCache[index];\n if (rowCache) {\n const cache = rowCache.get(field);\n if (cache) {\n return cache;\n }\n }\n return super.getOriginalField(index, field, col, row, table);\n }\n\n clearCache(): void {\n if (this._recordCache) {\n this._recordCache = [];\n }\n if (this._fieldCache) {\n this._fieldCache = {};\n }\n }\n\n protected fieldPromiseCallBack<F extends FieldDef>(index: number, field: F, value: MaybePromiseOrUndefined): void {\n _setFieldCache(this._fieldCache, index, field, value);\n }\n protected recordPromiseCallBack(index: number, record: MaybePromiseOrUndefined): void {\n this._recordCache && (this._recordCache[index] = record);\n }\n get records(): any[] {\n return Array.isArray(this._recordCache) && this._recordCache.length > 0 ? this._recordCache : super.records;\n }\n\n release(): void {\n super.release?.();\n this._recordCache = null;\n this._fieldCache = null;\n }\n\n _generateFieldAggragations() {\n super._generateFieldAggragations();\n // groupby aggragations\n if (isArray(this.dataConfig?.groupByRules)) {\n // const groupByKey = this.dataConfig.groupByRules[0];\n const groupByKeys = this.dataConfig.groupByRules;\n this.groupAggregator = new this.registedAggregators[AggregationType.CUSTOM]({\n dimension: '',\n aggregationFun: (values: any, records: any, field: any) => {\n const groupMap = new Map();\n const groupResult = [] as any[];\n for (let i = 0; i < records.length; i++) {\n dealWithGroup(records[i], groupResult, groupMap, groupByKeys, 0);\n records[i].vtableOriginIndex = i;\n }\n return groupResult;\n }\n });\n this.fieldAggregators.push(this.groupAggregator);\n }\n }\n\n processRecords(records: any[]) {\n const result = super.processRecords(records);\n const groupResult = this.groupAggregator?.value();\n if (groupResult) {\n // this._originalRecords = result;\n return groupResult;\n }\n return result;\n }\n\n getGroupLength() {\n return this.dataConfig?.groupByRules?.length ?? 0;\n }\n\n updateGroup() {\n this.clearCache();\n\n const oldSource = this.source;\n (this as any)._source = this.processRecords(this.dataSourceObj?.records ?? this.dataSourceObj);\n if (oldSource) {\n syncGroupCollapseState(oldSource, this.source);\n }\n\n // syncGroupCollapseState(this.source, newSource.source);\n this.sourceLength = this.source?.length || 0;\n this.sortedIndexMap.clear();\n this.currentIndexedData = Array.from({ length: this.sourceLength }, (_, i) => i);\n if (!this.userPagination) {\n this.pagination.perPageCount = this.sourceLength;\n this.pagination.totalCount = this.sourceLength;\n }\n\n this.initTreeHierarchyState();\n this.updatePagerData();\n }\n\n addRecordsForGroup(recordArr: any[], recordIndex?: number) {\n if (!isArray(recordArr) || recordArr.length === 0) {\n return;\n }\n if (recordIndex === undefined || recordIndex > this.dataSourceObj.records) {\n recordIndex = this.dataSourceObj.records;\n }\n // this.dataSourceObj.records.push(...recordArr);\n this.dataSourceObj.records.splice(recordIndex, 0, ...recordArr);\n\n this.updateGroup();\n }\n\n deleteRecordsForGroup(recordIndexs: number[]) {\n if (!isArray(recordIndexs) || recordIndexs.length === 0) {\n return;\n }\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 delete this.beforeChangedRecordsMap[recordIndex];\n this.dataSourceObj.records.splice(recordIndex, 1);\n this.sourceLength -= 1;\n }\n\n this.updateGroup();\n }\n\n updateRecordsForGroup(records: any[], recordIndexs: number[]) {\n // const realDeletedRecordIndexs: number[] = [];\n for (let index = 0; index < recordIndexs.length; index++) {\n const recordIndex = recordIndexs[index];\n if (recordIndex >= this.sourceLength || recordIndex < 0) {\n continue;\n }\n delete this.beforeChangedRecordsMap[recordIndex];\n // realDeletedRecordIndexs.push(recordIndex);\n this.dataSourceObj.records[recordIndex] = records[index];\n }\n\n this.updateGroup();\n }\n}\n\nfunction dealWithGroup(record: any, children: any[], map: Map<number, any>, groupByKeys: string[], level: number): any {\n const groupByKey = groupByKeys[level];\n if (!isValid(groupByKey)) {\n children.push(record);\n return;\n }\n const value = record[groupByKey];\n if (value !== undefined) {\n if (map.has(value)) {\n const index = map.get(value);\n // children[index].children.push(record);\n return dealWithGroup(record, children[index].children, children[index].map, groupByKeys, level + 1);\n }\n map.set(value, children.length);\n children.push({\n vtableMerge: true,\n vtableMergeName: value,\n children: [] as any,\n map: new Map()\n });\n return dealWithGroup(\n record,\n children[children.length - 1].children,\n children[children.length - 1].map,\n groupByKeys,\n level + 1\n );\n }\n}\n\nfunction syncGroupCollapseState(\n oldSource: any,\n newSource: any,\n oldGroupMap?: Map<string, number>,\n newGroupMap?: Map<string, number>\n) {\n if (!oldGroupMap) {\n oldGroupMap = new Map();\n for (let i = 0; i < oldSource.length; i++) {\n const record = oldSource[i];\n if (record.vtableMerge) {\n oldGroupMap.set(record.vtableMergeName, i);\n }\n }\n }\n\n if (!newGroupMap) {\n newGroupMap = new Map();\n for (let i = 0; i < newSource.length; i++) {\n const record = newSource[i];\n if (record.vtableMerge) {\n newGroupMap.set(record.vtableMergeName, i);\n }\n }\n }\n\n for (let i = 0; i < oldSource.length; i++) {\n const oldRecord = oldSource[i];\n const newRecord = newSource[newGroupMap.get(oldRecord.vtableMergeName)];\n if (isValid(newRecord)) {\n newRecord.hierarchyState = oldSource[i].hierarchyState;\n }\n if (\n isArray(oldRecord.children) &&\n isArray(newRecord.children) &&\n oldRecord.map.size !== 0 &&\n newRecord.map.size !== 0\n ) {\n syncGroupCollapseState(oldRecord.children, newRecord.children, oldRecord.map, newRecord.map);\n }\n }\n}\n"]}
|
package/es/data/DataSource.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { DataSourceAPI, FieldData, FieldDef, FieldFormat, FilterRules, IListTableDataConfig, IPagination, MaybePromiseOrUndefined,
|
|
1
|
+
import type { DataSourceAPI, FieldData, FieldDef, FieldFormat, FilterRules, IListTableDataConfig, IPagination, MaybePromiseOrUndefined, SortState } from '../ts-types';
|
|
2
2
|
import { HierarchyState } from '../ts-types';
|
|
3
3
|
import { EventTarget } from '../event/EventTarget';
|
|
4
4
|
import type { BaseTableAPI } from '../ts-types/base-table';
|
|
@@ -29,9 +29,7 @@ export declare class DataSource extends EventTarget implements DataSourceAPI {
|
|
|
29
29
|
private _sourceLength;
|
|
30
30
|
private _source;
|
|
31
31
|
protected sortedIndexMap: Map<FieldDef, ISortedMapItem>;
|
|
32
|
-
private
|
|
33
|
-
private lastOrderFn;
|
|
34
|
-
private lastOrderField;
|
|
32
|
+
private lastSortStates;
|
|
35
33
|
currentIndexedData: (number | number[])[] | null;
|
|
36
34
|
protected userPagination: IPagination;
|
|
37
35
|
protected pagination: IPagination;
|
|
@@ -91,7 +89,7 @@ export declare class DataSource extends EventTarget implements DataSourceAPI {
|
|
|
91
89
|
deleteRecordsForSorted(recordIndexs: number[]): void;
|
|
92
90
|
updateRecords(records: any[], recordIndexs: number[]): number[];
|
|
93
91
|
updateRecordsForSorted(records: any[], recordIndexs: number[]): void;
|
|
94
|
-
sort(
|
|
92
|
+
sort(states: Array<SortState>): void;
|
|
95
93
|
setSortedIndexMap(field: FieldDef, filedMap: ISortedMapItem): void;
|
|
96
94
|
private clearFilteredChildren;
|
|
97
95
|
private filterRecord;
|
package/es/data/DataSource.js
CHANGED
|
@@ -255,7 +255,7 @@ export class DataSource extends EventTarget {
|
|
|
255
255
|
};
|
|
256
256
|
}
|
|
257
257
|
pushChildrenNode(indexKey, hierarchyState, nodeData) {
|
|
258
|
-
var _a;
|
|
258
|
+
var _a, _b;
|
|
259
259
|
if (!hierarchyState || hierarchyState === HierarchyState.collapse || hierarchyState === HierarchyState.none) return 0;
|
|
260
260
|
let childrenLength = 0;
|
|
261
261
|
const children = nodeData.filteredChildren ? nodeData.filteredChildren : nodeData.children;
|
|
@@ -263,15 +263,17 @@ export class DataSource extends EventTarget {
|
|
|
263
263
|
const subNodeSortedIndexArray = Array.from({
|
|
264
264
|
length: children.length
|
|
265
265
|
}, ((_, i) => i));
|
|
266
|
-
|
|
267
|
-
subNodeSortedIndexArray[index] = rel
|
|
268
|
-
|
|
266
|
+
null === (_a = this.lastSortStates) || void 0 === _a || _a.forEach((state => {
|
|
267
|
+
"normal" !== state.order && sort.sort((index => isValid(subNodeSortedIndexArray[index]) ? subNodeSortedIndexArray[index] : subNodeSortedIndexArray[index] = index), ((index, rel) => {
|
|
268
|
+
subNodeSortedIndexArray[index] = rel;
|
|
269
|
+
}), children.length, state.orderFn, state.order, (index => this.getOriginalField(Array.isArray(indexKey) ? indexKey.concat([ index ]) : [ indexKey, index ], state.field)));
|
|
270
|
+
}));
|
|
269
271
|
for (let i = 0; i < subNodeSortedIndexArray.length; i++) {
|
|
270
272
|
childrenLength += 1;
|
|
271
273
|
const childIndex = Array.isArray(indexKey) ? indexKey.concat([ subNodeSortedIndexArray[i] ]) : [ indexKey, subNodeSortedIndexArray[i] ];
|
|
272
274
|
this.currentIndexedData.splice(this.currentIndexedData.indexOf(indexKey) + childrenLength, 0, childIndex);
|
|
273
275
|
const childData = this.getOriginalRecord(childIndex);
|
|
274
|
-
!childData.hierarchyState && (null !== (
|
|
276
|
+
!childData.hierarchyState && (null !== (_b = childData.filteredChildren) && void 0 !== _b ? _b : childData.children) && (childData.hierarchyState = HierarchyState.collapse),
|
|
275
277
|
childrenLength += this.pushChildrenNode(childIndex, childData.hierarchyState, children[subNodeSortedIndexArray[i]]);
|
|
276
278
|
}
|
|
277
279
|
}
|
|
@@ -409,29 +411,47 @@ export class DataSource extends EventTarget {
|
|
|
409
411
|
}
|
|
410
412
|
this.sortedIndexMap.clear();
|
|
411
413
|
}
|
|
412
|
-
sort(
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
414
|
+
sort(states) {
|
|
415
|
+
states = (Array.isArray(states) ? states : [ states ]).filter((state => {
|
|
416
|
+
var _a;
|
|
417
|
+
let column = this.layoutColumnObjects.find((obj => obj.field == state.field));
|
|
418
|
+
return !1 !== (null === (_a = null == column ? void 0 : column.define) || void 0 === _a ? void 0 : _a.sort) && "normal" !== state.order;
|
|
419
|
+
})), this.lastSortStates = states;
|
|
420
|
+
let filedMapArray = states.map((state => this.sortedIndexMap.get(null == state ? void 0 : state.field) || {
|
|
421
|
+
asc: [],
|
|
422
|
+
desc: [],
|
|
423
|
+
normal: []
|
|
424
|
+
})), orderedData = null;
|
|
425
|
+
if (filedMapArray.length > 0 && (orderedData = states.reduce(((data, state, index) => {
|
|
426
|
+
var _a;
|
|
427
|
+
const currentData = null === (_a = filedMapArray[index]) || void 0 === _a ? void 0 : _a[state.order];
|
|
428
|
+
return currentData && currentData.length > 0 ? currentData : data;
|
|
429
|
+
}), null), orderedData && orderedData.length > 0)) return this.currentIndexedData = orderedData,
|
|
416
430
|
this.updatePagerData(), void this.fireListeners(EVENT_TYPE.CHANGE_ORDER, null);
|
|
417
|
-
const sortedIndexArray =
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
431
|
+
const sortedIndexArray = Array.from({
|
|
432
|
+
length: this._sourceLength
|
|
433
|
+
}, ((_, i) => i));
|
|
434
|
+
if (sortedIndexArray.sort(((indexA, indexB) => states.reduce(((result, state) => {
|
|
435
|
+
if (0 !== result) return result;
|
|
436
|
+
return (state.orderFn || ("desc" !== state.order ? (v1, v2) => v1 === v2 ? 0 : v1 > v2 ? 1 : -1 : (v1, v2) => v1 === v2 ? 0 : v1 < v2 ? 1 : -1))(this.getOriginalField(indexA, state.field), this.getOriginalField(indexB, state.field), state.order);
|
|
437
|
+
}), 0))), this.currentIndexedData = sortedIndexArray, this.hierarchyExpandLevel) {
|
|
422
438
|
let nodeLength = sortedIndexArray.length;
|
|
423
|
-
window.performance.now();
|
|
424
439
|
for (let i = 0; i < nodeLength; i++) {
|
|
425
440
|
const record = this.getOriginalRecord(sortedIndexArray[i]), subNodeLength = this.pushChildrenNode(sortedIndexArray[i], record.hierarchyState, this.getOriginalRecord(sortedIndexArray[i]));
|
|
426
441
|
nodeLength += subNodeLength, i += subNodeLength;
|
|
427
442
|
}
|
|
428
443
|
}
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
444
|
+
if (!filedMapArray.length) {
|
|
445
|
+
filedMapArray = states.map((() => ({
|
|
446
|
+
asc: [],
|
|
447
|
+
desc: [],
|
|
448
|
+
normal: []
|
|
449
|
+
})));
|
|
450
|
+
for (let index = 0; index < states.length; index++) this.sortedIndexMap.set(states[index].field, filedMapArray[index]);
|
|
451
|
+
}
|
|
452
|
+
states.forEach(((state, index) => {
|
|
453
|
+
filedMapArray[index][state.order] = sortedIndexArray.slice();
|
|
454
|
+
})), this.updatePagerData(), this.fireListeners(EVENT_TYPE.CHANGE_ORDER, null);
|
|
435
455
|
}
|
|
436
456
|
setSortedIndexMap(field, filedMap) {
|
|
437
457
|
this.sortedIndexMap.set(field, filedMap);
|
|
@@ -481,10 +501,11 @@ export class DataSource extends EventTarget {
|
|
|
481
501
|
this.updatePagerData();
|
|
482
502
|
}
|
|
483
503
|
clearSortedIndexMap() {
|
|
484
|
-
this.
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
504
|
+
this.lastSortStates && this.lastSortStates.length > 0 && this.sortedIndexMap.forEach(((sortMap, key) => {
|
|
505
|
+
this.lastSortStates.some((state => state.field === key)) ? this.lastSortStates.forEach((state => {
|
|
506
|
+
"asc" === state.order ? (sortMap.desc = [], sortMap.normal = []) : "desc" === state.order ? (sortMap.asc = [],
|
|
507
|
+
sortMap.normal = []) : (sortMap.asc = [], sortMap.desc = []);
|
|
508
|
+
})) : this.sortedIndexMap.delete(key);
|
|
488
509
|
}));
|
|
489
510
|
}
|
|
490
511
|
get sourceLength() {
|
|
@@ -570,8 +591,8 @@ export class DataSource extends EventTarget {
|
|
|
570
591
|
return !0;
|
|
571
592
|
}
|
|
572
593
|
reorderRecord(sourceIndex, targetIndex) {
|
|
573
|
-
var _a;
|
|
574
|
-
if ("asc"
|
|
594
|
+
var _a, _b;
|
|
595
|
+
if (!(null === (_a = this.lastSortStates) || void 0 === _a ? void 0 : _a.some((state => "asc" === state.order || "desc" === state.order))) && this.isCanExchangeOrder(sourceIndex, targetIndex)) if (this.hasHierarchyStateExpand) {
|
|
575
596
|
let sourceI, targetI, sourceIndexs = this.currentPagerIndexedData[sourceIndex], targetIndexs = this.currentPagerIndexedData[targetIndex];
|
|
576
597
|
if (sourceIndexs = Array.isArray(sourceIndexs) ? [ ...sourceIndexs ] : [ sourceIndexs ],
|
|
577
598
|
targetIndexs = Array.isArray(targetIndexs) ? [ ...targetIndexs ] : [ targetIndexs ],
|
|
@@ -584,7 +605,7 @@ export class DataSource extends EventTarget {
|
|
|
584
605
|
if (sourceI = sourceIndexs.splice(sourceIndexs.length - 1, 1)[0], targetI = targetIndexs.splice(targetIndexs.length - 1, 1)[0],
|
|
585
606
|
sourceIndexs.length >= 1) {
|
|
586
607
|
const parent = this.getOriginalRecord(sourceIndexs), sourceIds = parent.filteredChildren ? parent.filteredChildren.splice(sourceI, 1) : parent.children.splice(sourceI, 1);
|
|
587
|
-
sourceIds.unshift(targetI, 0), Array.prototype.splice.apply(null !== (
|
|
608
|
+
sourceIds.unshift(targetI, 0), Array.prototype.splice.apply(null !== (_b = parent.filteredChildren) && void 0 !== _b ? _b : parent.children, sourceIds);
|
|
588
609
|
} else {
|
|
589
610
|
const sourceIds = this.records.splice(sourceI, 1);
|
|
590
611
|
sourceIds.unshift(targetI, 0), Array.prototype.splice.apply(this.records, sourceIds);
|