@lvce-editor/renderer-process 15.1.0 → 15.3.0

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.
@@ -953,6 +953,11 @@ const render = (elements, eventMap = {}, newEventMap = {}) => {
953
953
  renderInternal($Root, elements, eventMap, newEventMap);
954
954
  return $Root;
955
955
  };
956
+ const focusElement = $Element => {
957
+ $Element.focus({
958
+ preventScroll: true
959
+ });
960
+ };
956
961
  const rememberFocus$1 = ($Viewlet, dom, eventMap, uid = 0) => {
957
962
  startIgnore();
958
963
  const oldLeft = $Viewlet.style.left;
@@ -1004,18 +1009,18 @@ const rememberFocus$1 = ($Viewlet, dom, eventMap, uid = 0) => {
1004
1009
  renderInto($Viewlet, dom, eventMap);
1005
1010
  }
1006
1011
  if (isRootTree) {
1007
- $Viewlet.focus();
1012
+ focusElement($Viewlet);
1008
1013
  } else if (isTreeFocused) {
1009
1014
  const $Tree = $Viewlet.querySelector('[role="tree"]');
1010
1015
  if ($Tree) {
1011
1016
  // @ts-ignore
1012
- $Tree.focus();
1017
+ focusElement($Tree);
1013
1018
  }
1014
1019
  } else if (focused) {
1015
1020
  const $Focused = $Viewlet.querySelector(`[name="${focused}"]`);
1016
1021
  if ($Focused) {
1017
1022
  // @ts-ignore
1018
- $Focused.focus();
1023
+ focusElement($Focused);
1019
1024
  }
1020
1025
  }
1021
1026
  $Viewlet.style.top = oldTop;
@@ -3284,7 +3289,7 @@ const hide = (restoreFocus = true) => {
3284
3289
  };
3285
3290
 
3286
3291
  const openUrl = url => {
3287
- open(url);
3292
+ window.open(url);
3288
3293
  };
3289
3294
 
3290
3295
  const isElectronUserAgentSpecificMemoryError = error => {
@@ -3645,7 +3650,7 @@ const toHaveAttribute$1 = (element, {
3645
3650
  const attribute = element.getAttribute(key);
3646
3651
  return attribute === value;
3647
3652
  };
3648
- const toHaveJSProperty = (element, {
3653
+ const toHaveJSProperty$1 = (element, {
3649
3654
  key,
3650
3655
  value
3651
3656
  }) => {
@@ -3686,7 +3691,7 @@ const SingleElementConditions = {
3686
3691
  toHaveClass: toHaveClass$1,
3687
3692
  toHaveCss: toHaveCss$1,
3688
3693
  toHaveId: toHaveId$1,
3689
- toHaveJSProperty,
3694
+ toHaveJSProperty: toHaveJSProperty$1,
3690
3695
  toHaveText: toHaveText$1,
3691
3696
  toHaveValue
3692
3697
  };
@@ -3798,6 +3803,22 @@ const toHaveCss = (locator, {
3798
3803
  actual
3799
3804
  };
3800
3805
  };
3806
+ const toHaveJSProperty = (locator, {
3807
+ key
3808
+ }) => {
3809
+ const [element] = querySelector(locator._selector);
3810
+ if (!element) {
3811
+ return {
3812
+ wasFound: false,
3813
+ actual: ''
3814
+ };
3815
+ }
3816
+ const actual = element[key];
3817
+ return {
3818
+ wasFound: true,
3819
+ actual
3820
+ };
3821
+ };
3801
3822
 
3802
3823
  const ConditionValues = {
3803
3824
  __proto__: null,
@@ -3807,6 +3828,7 @@ const ConditionValues = {
3807
3828
  toHaveCount,
3808
3829
  toHaveCss,
3809
3830
  toHaveId,
3831
+ toHaveJSProperty,
3810
3832
  toHaveText
3811
3833
  };
3812
3834
 
@@ -8910,6 +8932,14 @@ const setElementProperty = (viewletId, name, key, value) => {
8910
8932
  const setValueByName = (viewletId, name, value) => {
8911
8933
  setElementProperty(viewletId, name, 'value', value);
8912
8934
  };
8935
+ const setInputValues = (viewletId, items) => {
8936
+ for (const {
8937
+ name,
8938
+ value
8939
+ } of items) {
8940
+ setElementProperty(viewletId, name, 'value', value);
8941
+ }
8942
+ };
8913
8943
  const setCheckBoxValue = (viewletId, name, value) => {
8914
8944
  setElementProperty(viewletId, name, 'checked', value);
8915
8945
  };
@@ -9151,6 +9181,10 @@ const sendMultiple = commands => {
9151
9181
  // @ts-ignore
9152
9182
  setValueByName(viewletId, method, ...args);
9153
9183
  break;
9184
+ case 'Viewlet.setInputValues':
9185
+ // @ts-ignore
9186
+ setInputValues(viewletId, method, ...args);
9187
+ break;
9154
9188
  case 'Viewlet.setCheckBoxValue':
9155
9189
  // @ts-ignore
9156
9190
  setCheckBoxValue(viewletId, method, ...args);
@@ -9352,6 +9386,8 @@ const getFn = command => {
9352
9386
  return setDragData;
9353
9387
  case 'Viewlet.focusSelector':
9354
9388
  return focusSelector;
9389
+ case 'Viewlet.setInputValues':
9390
+ return setInputValues;
9355
9391
  case 'Viewlet.setProperty':
9356
9392
  return setProperty;
9357
9393
  case 'Css.addCssStyleSheet':
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/renderer-process",
3
- "version": "15.1.0",
3
+ "version": "15.3.0",
4
4
  "description": "",
5
5
  "keywords": [
6
6
  "lvce-editor",