@tarojs/plugin-platform-harmony-ets 4.0.0-beta.35 → 4.0.0-beta.37
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/dist/apis/index.ts +2 -1
- package/dist/components-harmony-ets/button.ets +30 -32
- package/dist/components-harmony-ets/checkbox.ets +52 -56
- package/dist/components-harmony-ets/form.ets +25 -27
- package/dist/components-harmony-ets/icon.ets +17 -19
- package/dist/components-harmony-ets/image.ets +10 -12
- package/dist/components-harmony-ets/input.ets +36 -38
- package/dist/components-harmony-ets/label.ets +36 -38
- package/dist/components-harmony-ets/movableArea.ets +55 -57
- package/dist/components-harmony-ets/movableView.ets +44 -46
- package/dist/components-harmony-ets/picker.ets +15 -17
- package/dist/components-harmony-ets/progress.ets +22 -24
- package/dist/components-harmony-ets/radio.ets +54 -58
- package/dist/components-harmony-ets/richText.ets +7 -9
- package/dist/components-harmony-ets/scrollView.ets +47 -49
- package/dist/components-harmony-ets/slider.ets +8 -10
- package/dist/components-harmony-ets/style.ets +103 -4
- package/dist/components-harmony-ets/swiper.ets +17 -19
- package/dist/components-harmony-ets/switch.ets +24 -26
- package/dist/components-harmony-ets/text.ets +80 -43
- package/dist/components-harmony-ets/textArea.ets +28 -30
- package/dist/components-harmony-ets/video.ets +19 -21
- package/dist/components-harmony-ets/view.ets +31 -33
- package/dist/components-harmony-ets/webView.ets +30 -32
- package/dist/runtime-ets/dom/document.ts +2 -0
- package/dist/runtime-ets/dom/element/element.ts +45 -1
- package/dist/runtime-ets/dom/element/index.ts +5 -2
- package/dist/runtime-ets/dom/element/normal.ts +4 -0
- package/dist/runtime-ets/dom/node.ts +11 -7
- package/dist/runtime-ets/dom/stylesheet/type.ts +1 -0
- package/dist/runtime-utils.js +5 -46
- package/dist/runtime-utils.js.map +1 -1
- package/dist/runtime.js +5 -46
- package/dist/runtime.js.map +1 -1
- package/package.json +9 -9
package/dist/runtime.js
CHANGED
|
@@ -32,7 +32,7 @@ import dataPreferences from '@ohos.data.preferences';
|
|
|
32
32
|
import hilog from '@ohos.hilog';
|
|
33
33
|
import matrix4 from '@ohos.matrix4';
|
|
34
34
|
import prompt from '@ohos.prompt';
|
|
35
|
-
import { pxTransformHelper
|
|
35
|
+
import { pxTransformHelper } from '@tarojs/taro';
|
|
36
36
|
|
|
37
37
|
class MethodHandler {
|
|
38
38
|
constructor({ name, success, fail, complete }) {
|
|
@@ -3880,7 +3880,7 @@ const pageScrollTo = (options) => {
|
|
|
3880
3880
|
scroller = getPageScrollerOrNode(scroller, page);
|
|
3881
3881
|
const { yOffset } = scroller.currentOffset();
|
|
3882
3882
|
if (areaInfo) {
|
|
3883
|
-
scrollValue = areaInfo.globalPosition.y + yOffset + pxTransformHelper
|
|
3883
|
+
scrollValue = areaInfo.globalPosition.y + yOffset + pxTransformHelper(offsetTop, 'px', true);
|
|
3884
3884
|
}
|
|
3885
3885
|
}
|
|
3886
3886
|
const { xOffset } = scroller.currentOffset();
|
|
@@ -4880,49 +4880,7 @@ function initPxTransform({ designWidth = defaultDesignWidth, deviceRatio = defau
|
|
|
4880
4880
|
}
|
|
4881
4881
|
}
|
|
4882
4882
|
const display = _display.getDefaultDisplaySync();
|
|
4883
|
-
|
|
4884
|
-
let ratioCache = false;
|
|
4885
|
-
let designWidthFunc;
|
|
4886
|
-
let designWidth = defaultDesignWidth;
|
|
4887
|
-
let deviceRatio = defaultDesignRatio;
|
|
4888
|
-
function getRatio(value) {
|
|
4889
|
-
var _a;
|
|
4890
|
-
// Note: 提前调用 display 可能无法获取正确值
|
|
4891
|
-
if (ratioCache === false || displayWidth !== display.width) {
|
|
4892
|
-
const config = ((_a = Current.taro) === null || _a === void 0 ? void 0 : _a.config) || {};
|
|
4893
|
-
if (!isFunction(designWidthFunc)) {
|
|
4894
|
-
designWidthFunc = isFunction(config.designWidth)
|
|
4895
|
-
? config.designWidth
|
|
4896
|
-
: () => config.designWidth;
|
|
4897
|
-
designWidth = designWidthFunc(value) || defaultDesignWidth;
|
|
4898
|
-
deviceRatio = config.deviceRatio || defaultDesignRatio;
|
|
4899
|
-
if (!(designWidth in deviceRatio)) {
|
|
4900
|
-
throw new Error(`deviceRatio 配置中不存在 ${designWidth} 的设置!`);
|
|
4901
|
-
}
|
|
4902
|
-
}
|
|
4903
|
-
displayWidth = display.width;
|
|
4904
|
-
ratioCache = Math.min(display.width, display.height) / designWidth / deviceRatio[designWidth];
|
|
4905
|
-
}
|
|
4906
|
-
return ratioCache;
|
|
4907
|
-
}
|
|
4908
|
-
// Note: 设置为 style 单位时会自动完成设计稿转换,设计开发者调用 API 时也许抹平差异,例如 pageScrollTo[option.offsetTop]
|
|
4909
|
-
function pxTransformHelper(size, unit, isNumber = false) {
|
|
4910
|
-
var _a;
|
|
4911
|
-
const config = ((_a = Current.taro) === null || _a === void 0 ? void 0 : _a.config) || {};
|
|
4912
|
-
const targetUnit = unit || config.targetUnit || defaultTargetUnit;
|
|
4913
|
-
if (targetUnit === 'PX') {
|
|
4914
|
-
return px2vp(size * display.scaledDensity) + 'vp';
|
|
4915
|
-
}
|
|
4916
|
-
const ratio = getRatio(size);
|
|
4917
|
-
let val = size * ratio;
|
|
4918
|
-
switch (targetUnit) {
|
|
4919
|
-
case 'vp':
|
|
4920
|
-
// Note: 在应用创建前调用无效
|
|
4921
|
-
val = px2vp(val);
|
|
4922
|
-
break;
|
|
4923
|
-
}
|
|
4924
|
-
return isNumber ? val : val + targetUnit;
|
|
4925
|
-
}
|
|
4883
|
+
display.width;
|
|
4926
4884
|
function pxTransform(size) {
|
|
4927
4885
|
var _a;
|
|
4928
4886
|
const config = ((_a = Current.taro) === null || _a === void 0 ? void 0 : _a.config) || {};
|
|
@@ -4930,7 +4888,8 @@ function pxTransform(size) {
|
|
|
4930
4888
|
const val = size;
|
|
4931
4889
|
switch (targetUnit) {
|
|
4932
4890
|
case 'vp':
|
|
4933
|
-
return pxTransformHelper(size, 'px')
|
|
4891
|
+
// return pxTransformHelper(size, 'px')
|
|
4892
|
+
return `${size}lpx`;
|
|
4934
4893
|
// NOTE: 鸿蒙环境下 style 会自动完成设计稿转换,无需在方法内二次调整
|
|
4935
4894
|
}
|
|
4936
4895
|
return val + targetUnit;
|