@dolphinweex/weex-harmony 0.1.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.
Files changed (48) hide show
  1. package/README.md +13 -0
  2. package/index.js +2 -0
  3. package/package.json +37 -0
  4. package/src/components/baseSameLayer.vue +101 -0
  5. package/src/components/drag-vertical-list-view.vue +86 -0
  6. package/src/components/hl-button-base.vue +66 -0
  7. package/src/components/hl-button.vue +115 -0
  8. package/src/components/hl-image-base.vue +53 -0
  9. package/src/components/hl-image.vue +151 -0
  10. package/src/components/hl-lottie-base.vue +151 -0
  11. package/src/components/hl-lottie.vue +214 -0
  12. package/src/components/hl-richtext-base.vue +40 -0
  13. package/src/components/hl-richtext.vue +118 -0
  14. package/src/components/hl-slider-base.vue +75 -0
  15. package/src/components/hl-slider.vue +126 -0
  16. package/src/components/hl-textarea-base.vue +40 -0
  17. package/src/components/hl-textarea.vue +118 -0
  18. package/src/components/hl-video-base.vue +65 -0
  19. package/src/components/hl-video.vue +148 -0
  20. package/src/components/hl-web-base.vue +85 -0
  21. package/src/components/mdiea-arc-slider.vue +75 -0
  22. package/src/components/midea-apng-view-base.vue +111 -0
  23. package/src/components/midea-barchart-view.vue +56 -0
  24. package/src/components/midea-blur-view.vue +57 -0
  25. package/src/components/midea-calendar-pave.vue +64 -0
  26. package/src/components/midea-camera-view.vue +91 -0
  27. package/src/components/midea-circle-progress.vue +56 -0
  28. package/src/components/midea-combinechart-view.vue +56 -0
  29. package/src/components/midea-common-weex-view.vue +55 -0
  30. package/src/components/midea-drag-list-view.vue +89 -0
  31. package/src/components/midea-drag-slider-base.vue +66 -0
  32. package/src/components/midea-dragging-linechart-view.vue +56 -0
  33. package/src/components/midea-gesture-password-base.vue +63 -0
  34. package/src/components/midea-ijkplayer-view.vue +93 -0
  35. package/src/components/midea-linechart-view.vue +56 -0
  36. package/src/components/midea-lottie-view.vue +69 -0
  37. package/src/components/midea-map-view.vue +74 -0
  38. package/src/components/midea-pdf-view-base.vue +75 -0
  39. package/src/components/midea-picker.vue +58 -0
  40. package/src/components/midea-piechart-view.vue +56 -0
  41. package/src/components/midea-progresscycle-view.vue +56 -0
  42. package/src/components/midea-seek-bar-base.vue +136 -0
  43. package/src/components/midea-time-pave.vue +58 -0
  44. package/src/components/midea-video.vue +91 -0
  45. package/src/components/midea-vslider-bar-base.vue +89 -0
  46. package/src/components/pick-pallet.vue +66 -0
  47. package/src/index.js +180 -0
  48. package/src/transform-loader.js +249 -0
@@ -0,0 +1,40 @@
1
+ <template>
2
+ <BaseSameLayer
3
+ :hosSameLayerArgs="hosSameLayerArgs"
4
+ embedType="native/textarea"
5
+ :defaultWidth="300"
6
+ :defaultHeight="120"
7
+ ></BaseSameLayer>
8
+ </template>
9
+
10
+ <script>
11
+ import BaseSameLayer from "./baseSameLayer.vue";
12
+
13
+ export default {
14
+ name: "HlTextarea",
15
+ components: {
16
+ BaseSameLayer,
17
+ },
18
+ props: {
19
+ hosUniqueProps: {
20
+ type: Object,
21
+ required: true,
22
+ },
23
+ placeholder: {
24
+ type: String,
25
+ required: true,
26
+ },
27
+ },
28
+ computed: {
29
+ hosSameLayerArgs() {
30
+ return {
31
+ ...this.hosUniqueProps, // 鸿蒙原生组件独有属性
32
+ placeholder: this.placeholder, // 多端支持公共属性
33
+ };
34
+ },
35
+ },
36
+ methods: {
37
+ // 自定义拓展其它逻辑
38
+ },
39
+ };
40
+ </script>
@@ -0,0 +1,118 @@
1
+ <template>
2
+ <div>
3
+ <embed
4
+ :id="embedId"
5
+ type="native/textarea"
6
+ :width="width"
7
+ :height="height"
8
+ src=""
9
+ />
10
+ </div>
11
+ </template>
12
+
13
+ <script>
14
+ const weexModule = weex.requireModule("weexModule");
15
+
16
+ export default {
17
+ name: "HlTextareaTest",
18
+ props: {
19
+ placeholder: {
20
+ type: String,
21
+ required: true,
22
+ },
23
+ width: {
24
+ type: Number,
25
+ required: false,
26
+ default: 300,
27
+ },
28
+ height: {
29
+ type: Number,
30
+ required: false,
31
+ default: 120,
32
+ },
33
+ backgroundColor: {
34
+ type: String,
35
+ required: false,
36
+ }
37
+ },
38
+ data() {
39
+ return {
40
+ embedId: `textarea_${this._uid}`, // 使用Vue实例的唯一ID来生成embed元素的唯一ID
41
+ isTransferScheduled: false, // 添加一个标志来检查是否已经安排了transferPropsAndListeners的调用
42
+ };
43
+ },
44
+ created() {
45
+ console.log("[weex] hl-textarea created!");
46
+ this.transferPropsAndListeners(); // 组件创建时调用
47
+ },
48
+ mounted() {
49
+ this.addTouchEvent();
50
+ },
51
+ beforeDestroy() {
52
+ this.removeTouchEvent();
53
+ },
54
+ methods: {
55
+ transferPropsAndListeners() {
56
+ // 构建一个包含所需信息的对象
57
+ const args = {
58
+ componentId: this.embedId,
59
+ width: this.width,
60
+ height: this.height,
61
+ placeholder: this.placeholder,
62
+ backgroundColor: this.backgroundColor,
63
+ onChange: this.handleonInput,
64
+ };
65
+ // 调用JSbridge方法,传递属性和监听方法到原生组件
66
+ weexModule.callNative("transferSameLayerArgs", args);
67
+ },
68
+ // 必须给embed元素添加touchstart事件监听,addEventListener的第二个参数监听事件对象置空即可(同层渲染事件处理需要)
69
+ addTouchEvent() {
70
+ const embedElement = document.getElementById(this.embedId);
71
+ if (embedElement) {
72
+ console.log("[weex] hl-textarea-embed addEventListener");
73
+ embedElement.addEventListener('touchstart', {});
74
+ }
75
+ },
76
+ removeTouchEvent() {
77
+ const embedElement = document.getElementById(this.embedId);
78
+ if (embedElement) {
79
+ console.log("[weex] hl-textarea-embed removeEventListener");
80
+ embedElement.removeEventListener('touchstart', {});
81
+ }
82
+ },
83
+ scheduleTransfer() {
84
+ if (!this.isTransferScheduled) {
85
+ this.isTransferScheduled = true;
86
+ this.$nextTick(() => {
87
+ this.transferPropsAndListeners();
88
+ this.isTransferScheduled = false;
89
+ });
90
+ }
91
+ },
92
+ handleonInput(res) {
93
+ console.log("[weex] handleonInput ", res);
94
+ this.$emit("nativeOnInput", res);
95
+ }
96
+ },
97
+ watch: {
98
+ text(newText, oldText) {
99
+ if (newText !== oldText) {
100
+ this.scheduleTransfer(); // 当text属性变化时重新调用
101
+ }
102
+ },
103
+ width(newWidth, oldWidth) {
104
+ if (newWidth !== oldWidth) {
105
+ this.scheduleTransfer(); // 当width属性变化时重新调用
106
+ }
107
+ },
108
+ height(newHeight, oldHeight) {
109
+ if (newHeight !== oldHeight) {
110
+ this.scheduleTransfer(); // 当width属性变化时重新调用
111
+ }
112
+ },
113
+ },
114
+ };
115
+ </script>
116
+
117
+ <style scoped>
118
+ </style>
@@ -0,0 +1,65 @@
1
+ <template>
2
+ <BaseSameLayer
3
+ :hosSameLayerArgs="hosSameLayerArgs"
4
+ embedType="native/video"
5
+ :defaultWidth="300"
6
+ :defaultHeight="250"
7
+ ></BaseSameLayer>
8
+ </template>
9
+
10
+ <script>
11
+ import BaseSameLayer from "./baseSameLayer.vue";
12
+
13
+ export default {
14
+ name: "HlVideo",
15
+ components: {
16
+ BaseSameLayer,
17
+ },
18
+ props: {
19
+ hosUniqueProps: {
20
+ type: Object,
21
+ required: true,
22
+ },
23
+ src: {
24
+ type: String,
25
+ required: true,
26
+ },
27
+ controls: {
28
+ type: Boolean,
29
+ required: false,
30
+ },
31
+ autoPlay: {
32
+ type: Boolean,
33
+ required: false,
34
+ },
35
+ muted: {
36
+ type: Boolean,
37
+ required: false,
38
+ },
39
+ loop: {
40
+ type: Boolean,
41
+ required: false,
42
+ },
43
+ },
44
+ computed: {
45
+ hosSameLayerArgs() {
46
+ // 对象中的键值和原生自定义组件支持的属性和方法保持一致
47
+ return {
48
+ ...this.hosUniqueProps, // 鸿蒙原生组件独有属性和方法示例
49
+ src: this.src, // 多端支持公共属性示例
50
+ controls: this.controls,
51
+ autoPlay: this.autoPlay,
52
+ muted: this.muted,
53
+ loop: this.loop,
54
+ onPlay: this.handleOnPlay, // 多端支持公共监听方法示例
55
+ };
56
+ },
57
+ },
58
+ methods: {
59
+ handleOnPlay(res) {
60
+ this.$emit("onPlay", res);
61
+ },
62
+ // 自定义拓展其它逻辑
63
+ },
64
+ };
65
+ </script>
@@ -0,0 +1,148 @@
1
+ <template>
2
+ <div>
3
+ <embed
4
+ :id="embedId"
5
+ type="native/video"
6
+ :width="width"
7
+ :height="height"
8
+ src=""
9
+ />
10
+ </div>
11
+ </template>
12
+
13
+ <script>
14
+ const weexModule = weex.requireModule("weexModule");
15
+
16
+ export default {
17
+ name: "HlVideoTest",
18
+ props: {
19
+ width: {
20
+ type: Number,
21
+ required: false,
22
+ default: 300,
23
+ },
24
+ height: {
25
+ type: Number,
26
+ required: false,
27
+ default: 250,
28
+ },
29
+ src: {
30
+ type: String,
31
+ required: true,
32
+ },
33
+ controls: {
34
+ type: Boolean,
35
+ required: false,
36
+ },
37
+ autoPlay: {
38
+ type: Boolean,
39
+ required: false,
40
+ },
41
+ muted: {
42
+ type: Boolean,
43
+ required: false,
44
+ },
45
+ loop: {
46
+ type: Boolean,
47
+ required: false,
48
+ },
49
+ },
50
+ data() {
51
+ return {
52
+ embedId: `video_${this._uid}`, // 使用Vue实例的唯一ID来生成embed元素的唯一ID
53
+ isTransferScheduled: false, // 添加一个标志来检查是否已经安排了transferPropsAndListeners的调用
54
+ };
55
+ },
56
+ created() {
57
+ console.log("[weex] hl-video created!");
58
+ this.transferPropsAndListeners(); // 组件创建时调用
59
+ },
60
+ mounted() {
61
+ console.log("[weex] hl-video mounted!");
62
+ this.addTouchEvent();
63
+ },
64
+ beforeDestroy() {
65
+ console.log("[weex] hl-video beforeDestroy!");
66
+ this.removeTouchEvent();
67
+ },
68
+ methods: {
69
+ transferPropsAndListeners() {
70
+ // 构建一个包含所需信息的对象
71
+ const args = {
72
+ componentId: this.embedId,
73
+ width: this.width,
74
+ height: this.height,
75
+ src: this.src, // 要播放视频的资源地址
76
+ controls: this.controls, // 是否显示播放控件
77
+ muted: this.muted, // 是否静音
78
+ loop: this.loop,
79
+ autoPlay: this.autoPlay,
80
+ onPlay: this.handleOnPlay,
81
+ onPause: this.handleOnPause,
82
+ };
83
+ // 调用JSbridge方法,传递属性和监听方法到原生组件
84
+ weexModule.callNative("transferSameLayerArgs", args);
85
+ },
86
+ // 必须给embed元素添加touchstart事件监听,addEventListener的第二个参数监听事件对象置空即可(同层渲染事件处理需要)
87
+ addTouchEvent() {
88
+ const embedElement = document.getElementById(this.embedId);
89
+ if (embedElement) {
90
+ console.log("[weex] hl-video-embed addEventListener");
91
+ embedElement.addEventListener("touchstart", {});
92
+ }
93
+ },
94
+ removeTouchEvent() {
95
+ const embedElement = document.getElementById(this.embedId);
96
+ if (embedElement) {
97
+ console.log("[weex] hl-video-embed removeEventListener");
98
+ embedElement.removeEventListener("touchstart", {});
99
+ }
100
+ },
101
+ scheduleTransfer() {
102
+ if (!this.isTransferScheduled) {
103
+ this.isTransferScheduled = true;
104
+ this.$nextTick(() => {
105
+ this.transferPropsAndListeners();
106
+ this.isTransferScheduled = false;
107
+ });
108
+ }
109
+ },
110
+ handleOnPlay(res) {
111
+ this.$emit("onPlay", res);
112
+ },
113
+ handleOnPause(res) {
114
+ this.$emit("onPause", res);
115
+ },
116
+ },
117
+ watch: {
118
+ src(newSrc, oldSrc) {
119
+ if (newSrc !== oldSrc) {
120
+ this.scheduleTransfer(); // 当src属性变化时重新调用
121
+ }
122
+ },
123
+ muted(newMuted, oldMuted) {
124
+ if (newMuted !== oldMuted) {
125
+ this.scheduleTransfer(); // 当muted属性变化时重新调用
126
+ }
127
+ },
128
+ controls(newControls, oldControls) {
129
+ if (newControls !== oldControls) {
130
+ this.scheduleTransfer(); // 当controls属性变化时重新调用
131
+ }
132
+ },
133
+ width(newWidth, oldWidth) {
134
+ if (newWidth !== oldWidth) {
135
+ this.scheduleTransfer(); // 当width属性变化时重新调用
136
+ }
137
+ },
138
+ height(newHeight, oldHeight) {
139
+ if (newHeight !== oldHeight) {
140
+ this.scheduleTransfer(); // 当width属性变化时重新调用
141
+ }
142
+ },
143
+ },
144
+ };
145
+ </script>
146
+
147
+ <style scoped>
148
+ </style>
@@ -0,0 +1,85 @@
1
+ <template>
2
+ <BaseSameLayer
3
+ :hosSameLayerArgs="hosSameLayerArgs"
4
+ embedType="native/web"
5
+ :defaultWidth="300"
6
+ :defaultHeight="120"
7
+ ></BaseSameLayer>
8
+ </template>
9
+
10
+ <script>
11
+ import BaseSameLayer from "./baseSameLayer.vue";
12
+
13
+ export default {
14
+ name: "HlWeb",
15
+ data() {
16
+ return {
17
+ width: 0,
18
+ height: 0
19
+ }
20
+ },
21
+ components: {
22
+ BaseSameLayer,
23
+ },
24
+ props: {
25
+ hosUniqueProps: {
26
+ type: Object,
27
+ default() {
28
+ return {};
29
+ },
30
+ },
31
+ src: {
32
+ type: String,
33
+ required: true,
34
+ }
35
+ },
36
+
37
+ computed: {
38
+ hosSameLayerArgs() {
39
+ return {
40
+ ...this.hosUniqueProps, // 鸿蒙原生组件独有属性
41
+ src: this.src,
42
+ width: this.width,
43
+ height: this.height,
44
+ pagefinish: this.onPageFinish,
45
+ pagestart: this.onPageStart,
46
+ error: this.onError,
47
+ receivedtitle: this.onReceivedTitle
48
+ }
49
+ }
50
+ },
51
+ mounted() {
52
+ this.width = this.$el.clientWidth;
53
+ this.height = this.$el.clientHeight;
54
+ },
55
+ methods: {
56
+ // 自定义拓展其它逻辑
57
+ onPageFinish(res) {
58
+ console.log("[web] pagefinish ", res);
59
+ this.$emit("pagefinish", res);
60
+ },
61
+ onPageStart(res) {
62
+ console.log("[web] pagestart ", res);
63
+ this.$emit("pagestart", res);
64
+ },
65
+ onError(res) {
66
+ console.log("[web] onError ", res);
67
+ this.$emit("error", res);
68
+ },
69
+ onReceivedTitle(res) {
70
+ console.log("[web] onReceivedTitle ", res);
71
+ this.$emit("receivedtitle", res);
72
+ }
73
+ },
74
+ watch: {
75
+ loading(newText, oldText) {
76
+ if (newText !== oldText) {
77
+ this.scheduleTransfer(); // 当loading属性变化时重新调用
78
+ }
79
+ },
80
+ },
81
+ };
82
+ </script>
83
+
84
+ <style scoped>
85
+ </style>
@@ -0,0 +1,75 @@
1
+ <template>
2
+ <BaseSameLayer
3
+ :hosSameLayerArgs="hosSameLayerArgs"
4
+ embedType="native/mdiea-arc-slider"
5
+ :defaultWidth="300"
6
+ :defaultHeight="300"
7
+ >
8
+ </BaseSameLayer>
9
+ </template>
10
+
11
+ <script>
12
+ import BaseSameLayer from "./baseSameLayer.vue";
13
+
14
+ export default {
15
+ data() {
16
+ return {
17
+ width: 0,
18
+ height: 0,
19
+ };
20
+ },
21
+ name: "MdieaArcSlider",
22
+ components: {
23
+ BaseSameLayer,
24
+ },
25
+ props: {
26
+ hosUniqueProps: {
27
+ type: Object,
28
+ default() {
29
+ return {};
30
+ },
31
+ },
32
+ data: {
33
+ type: Object,
34
+ default() {
35
+ return {};
36
+ },
37
+ },
38
+ progressCounter: {
39
+ type: Number,
40
+ default: 0,
41
+ },
42
+ },
43
+ computed: {
44
+ hosSameLayerArgs() {
45
+ return {
46
+ ...this.hosUniqueProps, // 鸿蒙原生组件独有属性
47
+ width: this.width,
48
+ height: this.height,
49
+ data: this.data,
50
+ progressCounter: this.progressCounter,
51
+ handleOnProgress: this.handleOnProgress,
52
+ };
53
+ },
54
+ },
55
+ mounted() {
56
+ this.width = this.$el.clientWidth;
57
+ this.height = this.$el.clientHeight;
58
+ },
59
+
60
+ methods: {
61
+ // 自定义拓展其它逻辑
62
+ handleOnChange(res) {
63
+ if (res.mode == 1) {
64
+ //停止滑动
65
+ this.$emit("slideEnd", res);
66
+ } else {
67
+ this.$emit("slideChange", res);
68
+ }
69
+ },
70
+ handleOnProgress(res) {
71
+ this.$emit("onProgress", res);
72
+ },
73
+ },
74
+ };
75
+ </script>
@@ -0,0 +1,111 @@
1
+ <template>
2
+ <BaseSameLayer
3
+ ref="apng"
4
+ :hosSameLayerArgs="hosSameLayerArgs"
5
+ embedType="native/midea-apng-view"
6
+ :defaultWidth="750"
7
+ :defaultHeight="300"
8
+ ></BaseSameLayer>
9
+ </template>
10
+
11
+ <script>
12
+ import BaseSameLayer from "./baseSameLayer.vue";
13
+ const weexModule = weex.requireModule("weexModule");
14
+
15
+ export default {
16
+ data() {
17
+ return {
18
+ width: 0,
19
+ height: 0
20
+ }
21
+ },
22
+ name: "MideaApngView",
23
+ components: {
24
+ BaseSameLayer,
25
+ },
26
+ props: {
27
+ hosUniqueProps: {
28
+ type: Object,
29
+ default() {
30
+ return {};
31
+ },
32
+ },
33
+ src: {
34
+ type: String,
35
+ require: true,
36
+ },
37
+ loop: {
38
+ type: Boolean,
39
+ require: false,
40
+ default: false,
41
+ },
42
+ auto: {
43
+ type: Boolean,
44
+ require: false,
45
+ default: true,
46
+ },
47
+ },
48
+ computed: {
49
+ hosSameLayerArgs() {
50
+ return {
51
+ ...this.hosUniqueProps, // 鸿蒙原生组件独有属性
52
+ width: this.width,
53
+ height: this.height,
54
+ src: this.src,
55
+ loop: this.loop,
56
+ auto: this.auto,
57
+ };
58
+ },
59
+ },
60
+ mounted() {
61
+ this.width = this.$el.clientWidth;
62
+ this.height = this.$el.clientHeight;
63
+ },
64
+
65
+ methods: {
66
+ // 自定义拓展其它逻辑
67
+ play(params, callback, callbackFail) {
68
+ weexModule.callNative('apngHandle', {
69
+ method: 'play',
70
+ name: this.$refs.apng.embedId,
71
+ params,
72
+ }, undefined, callback, callbackFail)
73
+ },
74
+ stop(params, callback, callbackFail) {
75
+ weexModule.callNative('apngHandle', {
76
+ method: 'stop',
77
+ name: this.$refs.apng.embedId,
78
+ params,
79
+ }, undefined, callback, callbackFail)
80
+ },
81
+ resume(params, callback, callbackFail) {
82
+ weexModule.callNative('apngHandle', {
83
+ method: 'resume',
84
+ name: this.$refs.apng.embedId,
85
+ params,
86
+ }, undefined, callback, callbackFail)
87
+ },
88
+ pause(params, callback, callbackFail) {
89
+ weexModule.callNative('apngHandle', {
90
+ method: 'pause',
91
+ name: this.$refs.apng.embedId,
92
+ params,
93
+ }, undefined, callback, callbackFail)
94
+ },
95
+ goTo(params, callback, callbackFail) {
96
+ weexModule.callNative('apngHandle', {
97
+ method: 'goTo',
98
+ name: this.$refs.apng.embedId,
99
+ params,
100
+ }, undefined, callback, callbackFail)
101
+ },
102
+ run(params, callback, callbackFail) {
103
+ weexModule.callNative('apngHandle', {
104
+ method: 'run',
105
+ name: this.$refs.apng.embedId,
106
+ params,
107
+ }, undefined, callback, callbackFail)
108
+ },
109
+ },
110
+ };
111
+ </script>
@@ -0,0 +1,56 @@
1
+ <template>
2
+ <BaseSameLayer
3
+ :hosSameLayerArgs="hosSameLayerArgs"
4
+ embedType="native/midea-barchart-view"
5
+ :defaultWidth="300"
6
+ :defaultHeight="300"
7
+ ></BaseSameLayer>
8
+ </template>
9
+
10
+ <script>
11
+ import BaseSameLayer from "./baseSameLayer.vue";
12
+
13
+ export default {
14
+ name: "MideaBarchartView",
15
+ data() {
16
+ return {
17
+ width: 0,
18
+ height: 0
19
+ }
20
+ },
21
+ components: {
22
+ BaseSameLayer,
23
+ },
24
+ props: {
25
+ hosUniqueProps: {
26
+ type: Object,
27
+ default() {
28
+ return {};
29
+ },
30
+ },
31
+ data: {
32
+ type: Object,
33
+ default() {
34
+ return {};
35
+ },
36
+ },
37
+ },
38
+ computed: {
39
+ hosSameLayerArgs() {
40
+ return {
41
+ ...this.hosUniqueProps, // 鸿蒙原生组件独有属性
42
+ width: this.width,
43
+ height: this.height,
44
+ data: this.data,
45
+ };
46
+ },
47
+ },
48
+ mounted() {
49
+ this.width = this.$el.clientWidth;
50
+ this.height = this.$el.clientHeight;
51
+ },
52
+
53
+ methods: {
54
+ },
55
+ };
56
+ </script>