@hailin-zheng/editor-core 2.0.20 → 2.0.22

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/index-cjs.js CHANGED
@@ -4358,7 +4358,7 @@ class TableCellElement extends BlockContainerElement {
4358
4358
  const cellRender = new TableCellRenderObject(this);
4359
4359
  cellRender.rect.width = cellWidth;
4360
4360
  //cellRender.rect.maxWidth = cellWidth;
4361
- cellRender.padding = new PaddingProps(0, 0, 5, 5);
4361
+ cellRender.padding = new PaddingProps(0, 0, 0, 0);
4362
4362
  cellRender.rect.x = cellOffset;
4363
4363
  return cellRender;
4364
4364
  }
@@ -13613,8 +13613,10 @@ class DocumentContext {
13613
13613
  const dataEle = this.getControlById(id);
13614
13614
  if (dataEle) {
13615
13615
  dataEle.setValue(value);
13616
+ if (dataEle.isFocused) {
13617
+ this.ss.clear();
13618
+ }
13616
13619
  }
13617
- this.ss.clear();
13618
13620
  }
13619
13621
  setControlValueByName(name, val) {
13620
13622
  const dataEle = this.getControlByName(name);
@@ -17927,6 +17929,23 @@ class DocumentEvent {
17927
17929
  }
17928
17930
  }
17929
17931
  }
17932
+ /**
17933
+ * 移动光标到下一个数据元素上
17934
+ */
17935
+ moveFocusToNextDataElement() {
17936
+ if (this.viewOptions.docMode !== exports.DocMode.FormEdit) {
17937
+ return;
17938
+ }
17939
+ const currDataEle = this.getCurrentDataElement();
17940
+ if (currDataEle) {
17941
+ if (currDataEle instanceof DataElementLeaf) {
17942
+ this.moveCursorToRightHandle(currDataEle, 1);
17943
+ }
17944
+ else {
17945
+ this.moveCursorToRightHandle(currDataEle.endDecorate, 1);
17946
+ }
17947
+ }
17948
+ }
17930
17949
  /**
17931
17950
  * 向右移动光标
17932
17951
  */
@@ -18182,6 +18201,30 @@ class DocumentEvent {
18182
18201
  this.clicks = 0;
18183
18202
  }
18184
18203
  }
18204
+ /**
18205
+ * 获取当前光标所在的数据元
18206
+ * @returns
18207
+ */
18208
+ getCurrentDataElement() {
18209
+ const selectionState = this.selectionState;
18210
+ const { startControl, startOffset, collapsed, ancestorCommonControl } = selectionState;
18211
+ if (startControl && collapsed) {
18212
+ if (!ElementUtil.verifyHitable(startControl)) {
18213
+ return null;
18214
+ }
18215
+ const dataEle = ElementUtil.getParent(startControl, validateDataEle);
18216
+ if (dataEle instanceof DataElementLeaf || IsInSideDataElement(startControl, startOffset)) {
18217
+ return dataEle;
18218
+ }
18219
+ else {
18220
+ return null;
18221
+ }
18222
+ }
18223
+ else if (!collapsed && ancestorCommonControl) {
18224
+ return ElementUtil.getParent(ancestorCommonControl, validateDataEle);
18225
+ }
18226
+ return null;
18227
+ }
18185
18228
  }
18186
18229
 
18187
18230
  /**
@@ -27264,24 +27307,13 @@ class DocEditor {
27264
27307
  * @returns
27265
27308
  */
27266
27309
  getCurrentDataElement() {
27267
- const selectionState = this.documentSelection.selectionState;
27268
- const { startControl, startOffset, collapsed, ancestorCommonControl } = selectionState;
27269
- if (startControl && collapsed) {
27270
- if (!ElementUtil.verifyHitable(startControl)) {
27271
- return null;
27272
- }
27273
- const dataEle = ElementUtil.getParent(startControl, validateDataEle);
27274
- if (dataEle instanceof DataElementLeaf || IsInSideDataElement(startControl, startOffset)) {
27275
- return dataEle;
27276
- }
27277
- else {
27278
- return null;
27279
- }
27280
- }
27281
- else if (!collapsed && ancestorCommonControl) {
27282
- return ElementUtil.getParent(ancestorCommonControl, validateDataEle);
27283
- }
27284
- return null;
27310
+ return this.documentEvent.getCurrentDataElement();
27311
+ }
27312
+ /**
27313
+ * 移动光标到下一个数据元素上
27314
+ */
27315
+ moveFocusToNextDataElement() {
27316
+ this.documentEvent.moveFocusToNextDataElement();
27285
27317
  }
27286
27318
  /**
27287
27319
  * 设置当前光标所在的数据元的值