hoeditor-web 3.1.218 → 3.1.219
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/lib/hoeditor.umd.js +144 -11
- package/lib/hoeditor.umd.min.js +2 -2
- package/package.json +1 -1
package/lib/hoeditor.umd.js
CHANGED
|
@@ -104403,7 +104403,7 @@ const textParams = {
|
|
|
104403
104403
|
/***/ (function(__unused_webpack_module, __webpack_exports__) {
|
|
104404
104404
|
|
|
104405
104405
|
"use strict";
|
|
104406
|
-
/* harmony default export */ __webpack_exports__.A = ('3.1.
|
|
104406
|
+
/* harmony default export */ __webpack_exports__.A = ('3.1.219');
|
|
104407
104407
|
|
|
104408
104408
|
/***/ }),
|
|
104409
104409
|
|
|
@@ -128541,6 +128541,8 @@ class TableFormula extends _ControlNode__WEBPACK_IMPORTED_MODULE_27__/* .Control
|
|
|
128541
128541
|
/* harmony import */ var _HOEditorFactorys__WEBPACK_IMPORTED_MODULE_25__ = __webpack_require__(57703);
|
|
128542
128542
|
/* harmony import */ var _editor_draw_drawTree_DrawTree__WEBPACK_IMPORTED_MODULE_26__ = __webpack_require__(58382);
|
|
128543
128543
|
/* harmony import */ var _editor_draw_drawNode_DrawPageTable__WEBPACK_IMPORTED_MODULE_27__ = __webpack_require__(87523);
|
|
128544
|
+
/* harmony import */ var _TextNode__WEBPACK_IMPORTED_MODULE_28__ = __webpack_require__(32083);
|
|
128545
|
+
|
|
128544
128546
|
|
|
128545
128547
|
|
|
128546
128548
|
|
|
@@ -128941,7 +128943,7 @@ class TableNode extends _RectNode__WEBPACK_IMPORTED_MODULE_17__/* .RectNode */ .
|
|
|
128941
128943
|
* @param count 插入的行数
|
|
128942
128944
|
* @param copyIndex 插入时复制行的一些信息
|
|
128943
128945
|
*/
|
|
128944
|
-
insertRows(r, count, copyIndex) {
|
|
128946
|
+
insertRows(r, count, copyIndex, copyColIndex) {
|
|
128945
128947
|
if (r < 0 || r > this._rowCount || copyIndex < 0 || copyIndex > this._rowCount - 1) {
|
|
128946
128948
|
throw new Error(`错误的插入位置或者错误的拷贝行`);
|
|
128947
128949
|
}
|
|
@@ -129018,6 +129020,14 @@ class TableNode extends _RectNode__WEBPACK_IMPORTED_MODULE_17__/* .RectNode */ .
|
|
|
129018
129020
|
newCell.initBlankDoc();
|
|
129019
129021
|
newCell.childNodes[0].styleIndex = cell.childNodes[0].styleIndex;
|
|
129020
129022
|
newCell.childNodes[0].paraNo = cell.childNodes[0].paraNo;
|
|
129023
|
+
if (copyColIndex !== undefined && copyColIndex >= 0 && copyColIndex < this._rowCount && c <= copyColIndex) {
|
|
129024
|
+
const copyCellNode = this._rows[mr][mc];
|
|
129025
|
+
if (copyCellNode) {
|
|
129026
|
+
const newText = copyCellNode.getCellText();
|
|
129027
|
+
const textNode = new _TextNode__WEBPACK_IMPORTED_MODULE_28__/* .TextNode */ .E(this._hoEditorFactoryID, this.rootNodes, newCell, _BaseNode__WEBPACK_IMPORTED_MODULE_15__/* .NodeType */ .Z6.ntText, newText, copyCellNode.childNodes[0].styleIndex);
|
|
129028
|
+
newCell.childNodes.push(textNode);
|
|
129029
|
+
}
|
|
129030
|
+
}
|
|
129021
129031
|
newCell.drawCell.needUpdate = true;
|
|
129022
129032
|
} else {
|
|
129023
129033
|
const bcell = row[c];
|
|
@@ -222253,6 +222263,7 @@ const entry_lib_initLanguage = async (lang, languageList) => {
|
|
|
222253
222263
|
|
|
222254
222264
|
|
|
222255
222265
|
|
|
222266
|
+
|
|
222256
222267
|
|
|
222257
222268
|
|
|
222258
222269
|
// import pd from '@/plugins/pretty-data';
|
|
@@ -230668,21 +230679,38 @@ class entry_lib_VueController {
|
|
|
230668
230679
|
backFillTableData(index, data) {
|
|
230669
230680
|
const hoEditorFactory = entry_lib_HOEditorFactorys/* HOEditorFactorys */.O.instance().getFactory(this._hoEditorFactoryID);
|
|
230670
230681
|
let table = null;
|
|
230671
|
-
|
|
230672
|
-
|
|
230673
|
-
const
|
|
230674
|
-
|
|
230675
|
-
|
|
230676
|
-
|
|
230677
|
-
|
|
230678
|
-
|
|
230682
|
+
if (index === -1) {
|
|
230683
|
+
const hoEditorFactory = entry_lib_HOEditorFactorys/* HOEditorFactorys */.O.instance().getFactory(this._hoEditorFactoryID);
|
|
230684
|
+
const [isInTable, tableNode] = hoEditorFactory.vueController.getDomRange().inSameTable();
|
|
230685
|
+
table = tableNode;
|
|
230686
|
+
} else {
|
|
230687
|
+
let i = 0;
|
|
230688
|
+
for (let k = 0; k < hoEditorFactory.docTree.mainNodes.length; k++) {
|
|
230689
|
+
const node = hoEditorFactory.docTree.mainNodes[k];
|
|
230690
|
+
if (node instanceof entry_lib_TableNode/* TableNode */.HA) {
|
|
230691
|
+
i++;
|
|
230692
|
+
if (i === index) {
|
|
230693
|
+
table = node;
|
|
230694
|
+
break;
|
|
230695
|
+
}
|
|
230679
230696
|
}
|
|
230680
230697
|
}
|
|
230681
230698
|
}
|
|
230682
230699
|
if (table) {
|
|
230683
230700
|
let rowIndex = this.getTableTitleMaxRowIndex(table);
|
|
230701
|
+
const cellInfo = {
|
|
230702
|
+
rowNo: [],
|
|
230703
|
+
colNo: []
|
|
230704
|
+
};
|
|
230705
|
+
table.childNodes.forEach(cell => {
|
|
230706
|
+
if (table && cell && cell instanceof entry_lib_CellNode/* CellNode */.H && cell.cellProperty.notAllowEdit) {
|
|
230707
|
+
cellInfo.rowNo.push(table.rows.indexOf(cell.row));
|
|
230708
|
+
cellInfo.colNo.push(cell.row.indexOf(cell));
|
|
230709
|
+
}
|
|
230710
|
+
});
|
|
230711
|
+
const maxRowNo = Math.max(...cellInfo.rowNo);
|
|
230684
230712
|
if (rowIndex === -1) {
|
|
230685
|
-
rowIndex = 0;
|
|
230713
|
+
rowIndex = maxRowNo || 0;
|
|
230686
230714
|
}
|
|
230687
230715
|
let rowCellNum = 0;
|
|
230688
230716
|
for (let r = 0; r <= rowIndex; r++) {
|
|
@@ -230735,6 +230763,111 @@ class entry_lib_VueController {
|
|
|
230735
230763
|
table.update();
|
|
230736
230764
|
}
|
|
230737
230765
|
}
|
|
230766
|
+
/**
|
|
230767
|
+
* 回填表格数据
|
|
230768
|
+
* @param index 第几个表格
|
|
230769
|
+
* @param data 回填的数据
|
|
230770
|
+
*/
|
|
230771
|
+
backFillTableDataV2(data, direction) {
|
|
230772
|
+
const hoEditorFactory = entry_lib_HOEditorFactorys/* HOEditorFactorys */.O.instance().getFactory(this._hoEditorFactoryID);
|
|
230773
|
+
const [isInTable, tableNode] = hoEditorFactory.vueController.getDomRange().inSameTable();
|
|
230774
|
+
if (data.length == 0) return false;
|
|
230775
|
+
let maxCount = data[0].length; // 一组的最大数 行或者列
|
|
230776
|
+
if (isInTable && tableNode) {
|
|
230777
|
+
const cellInfo = {
|
|
230778
|
+
rowNo: [],
|
|
230779
|
+
colNo: []
|
|
230780
|
+
};
|
|
230781
|
+
tableNode.childNodes.forEach(cell => {
|
|
230782
|
+
if (cell && cell instanceof entry_lib_CellNode/* CellNode */.H && cell.cellProperty.notAllowEdit) {
|
|
230783
|
+
cellInfo.rowNo.push(tableNode.rows.indexOf(cell.row));
|
|
230784
|
+
cellInfo.colNo.push(cell.row.indexOf(cell));
|
|
230785
|
+
}
|
|
230786
|
+
});
|
|
230787
|
+
const maxRowNo = Math.max(...cellInfo.rowNo);
|
|
230788
|
+
const maxColNo = Math.max(...cellInfo.colNo);
|
|
230789
|
+
let hasTextColIndex = 0; // 找出最后一列不能回填的
|
|
230790
|
+
let hasTextRowIndex = 0;
|
|
230791
|
+
if (direction == "L") {
|
|
230792
|
+
// 横向显示 查找标题行或者不可编辑的单元格行
|
|
230793
|
+
let rowIndex = this.getTableTitleMaxRowIndex(tableNode);
|
|
230794
|
+
rowIndex = Math.max(maxRowNo, rowIndex) + 1; // 标题行和包含不可编辑的单元格行对比取出最大的行号当做标题行的结束行
|
|
230795
|
+
for (let r = rowIndex; r < tableNode.rowCount; r++) {
|
|
230796
|
+
for (let c = 0; c < tableNode.colCount; c++) {
|
|
230797
|
+
const cell = tableNode.rows[r][c];
|
|
230798
|
+
if (cell && cell.getCellText()) {
|
|
230799
|
+
hasTextColIndex = c;
|
|
230800
|
+
hasTextRowIndex = r;
|
|
230801
|
+
}
|
|
230802
|
+
}
|
|
230803
|
+
}
|
|
230804
|
+
hasTextRowIndex++;
|
|
230805
|
+
if (hasTextRowIndex != rowIndex) {
|
|
230806
|
+
// 类标题行行号 不等于 有内容行行号时候 差值补空方便从正文行正常回填
|
|
230807
|
+
for (let e = 0; e < hasTextRowIndex - rowIndex; e++) {
|
|
230808
|
+
data.unshift(' '.repeat(maxCount - 1).split(" "));
|
|
230809
|
+
if (e == hasTextRowIndex - rowIndex - 1 && hasTextColIndex > maxCount) {
|
|
230810
|
+
data.unshift(' '.repeat(maxCount - 1).split(" "));
|
|
230811
|
+
}
|
|
230812
|
+
}
|
|
230813
|
+
}
|
|
230814
|
+
// 处理
|
|
230815
|
+
this.backFillTableData(-1, data.flat());
|
|
230816
|
+
} else if (direction == "V") {
|
|
230817
|
+
// 纵向显示 查找不可编辑的单元格列
|
|
230818
|
+
for (let r = 0; r < tableNode.rowCount; r++) {
|
|
230819
|
+
for (let c = maxColNo + 1; c < tableNode.colCount; c++) {
|
|
230820
|
+
const cell = tableNode.rows[r][c];
|
|
230821
|
+
if (cell && cell.getCellText()) {
|
|
230822
|
+
hasTextColIndex = c;
|
|
230823
|
+
hasTextRowIndex = r;
|
|
230824
|
+
}
|
|
230825
|
+
}
|
|
230826
|
+
}
|
|
230827
|
+
hasTextColIndex++;
|
|
230828
|
+
let colIndex = maxColNo + 1; // 包含不可编辑的单元格列当做标题列的结束列 -- 由于不存在标题列属性设置,以不可编辑单元格所在列当作标题列处理
|
|
230829
|
+
if (hasTextColIndex != colIndex) {
|
|
230830
|
+
// 类标题列行号 不等于 有内容列行号时候 差值补空方便从正文行正常回填
|
|
230831
|
+
for (let e = 0; e < hasTextColIndex - colIndex; e++) {
|
|
230832
|
+
data.unshift(' '.repeat(maxCount - 1).split(" "));
|
|
230833
|
+
}
|
|
230834
|
+
}
|
|
230835
|
+
const diffCount = Math.ceil((data.length - (tableNode.colCount - colIndex) * tableNode.rowCount / maxCount) / (tableNode.colCount - colIndex));
|
|
230836
|
+
for (let d = 0; d < diffCount; d++) {
|
|
230837
|
+
for (let k = 0; k < maxCount; k++) {
|
|
230838
|
+
tableNode.insertRows(tableNode.rowCount, 1, k, maxColNo);
|
|
230839
|
+
}
|
|
230840
|
+
}
|
|
230841
|
+
// 判断起始行是否从第几组开始 回填内容多组
|
|
230842
|
+
let startRowIndex = Math.floor(hasTextRowIndex / maxCount) * maxCount;
|
|
230843
|
+
for (let k = 0; k < data.length; k++) {
|
|
230844
|
+
let group = Math.floor(k / (tableNode.colCount - colIndex));
|
|
230845
|
+
for (let y = 0; y < maxCount; y++) {
|
|
230846
|
+
let rowNo = 0;
|
|
230847
|
+
let colNo = 0;
|
|
230848
|
+
rowNo = startRowIndex + group * maxCount + y;
|
|
230849
|
+
colNo = colIndex + k % (tableNode.colCount - colIndex);
|
|
230850
|
+
const newText = data[k][y];
|
|
230851
|
+
if (newText && rowNo < tableNode.rowCount && colNo < tableNode.colCount) {
|
|
230852
|
+
const cell = tableNode.rows[rowNo][colNo];
|
|
230853
|
+
if (cell) {
|
|
230854
|
+
cell.childNodes.splice(1, cell.childNodes.length);
|
|
230855
|
+
const textNode = new entry_lib_TextNode/* TextNode */.E(this._hoEditorFactoryID, tableNode.rootNodes, cell, entry_lib_BaseNode/* NodeType */.Z6.ntText, newText, cell.childNodes[0].styleIndex);
|
|
230856
|
+
cell.drawCell.needUpdate = true;
|
|
230857
|
+
cell.childNodes.push(textNode);
|
|
230858
|
+
}
|
|
230859
|
+
} else {
|
|
230860
|
+
// console.log(rowNo, colNo);
|
|
230861
|
+
}
|
|
230862
|
+
}
|
|
230863
|
+
}
|
|
230864
|
+
tableNode.update();
|
|
230865
|
+
}
|
|
230866
|
+
return true;
|
|
230867
|
+
} else {
|
|
230868
|
+
return false;
|
|
230869
|
+
}
|
|
230870
|
+
}
|
|
230738
230871
|
clacFormula(cell, formulaStr) {
|
|
230739
230872
|
const hoEditorFactory = entry_lib_HOEditorFactorys/* HOEditorFactorys */.O.instance().getFactory(this._hoEditorFactoryID);
|
|
230740
230873
|
let strRet = '';
|