@shijiu/jsview-vue 0.9.426 → 0.9.502

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 (63) hide show
  1. package/dom/bin/jsview-browser-debug-dom.min.js +1 -1
  2. package/dom/bin/jsview-dom.min.js +1 -1
  3. package/dom/jsv-browser-debug-dom.js_1 +8 -0
  4. package/dom/jsv-dom.js_1 +6 -0
  5. package/dom/jsv-forge-define.js_1 +6 -0
  6. package/dom/target_core_revision.js +3 -3
  7. package/package.json +1 -1
  8. package/patches/node_modules/@vue/cli-service/lib/config/assets.js +1 -1
  9. package/patches/node_modules/@vue/runtime-core/dist/runtime-core.esm-bundler.js +4 -1
  10. package/samples/ColorSpace/App.vue +4 -4
  11. package/samples/DemoHomepage/router.js +17 -2
  12. package/samples/FilterDemo/App.vue +121 -0
  13. package/samples/GridDemo/App.vue +183 -0
  14. package/samples/GridDemo/ButtonBlock.vue +111 -0
  15. package/samples/GridDemo/FocusItem.vue +56 -0
  16. package/samples/GridDemo/Item.vue +101 -0
  17. package/samples/NinePatchDemo/App.vue +146 -0
  18. package/samples/NinePatchDemo/Item.vue +70 -0
  19. package/samples/NinePatchDemo/assets/border.png +0 -0
  20. package/samples/TouchSample/App.vue +137 -0
  21. package/samples/TouchSample/Item.vue +101 -0
  22. package/samples/TouchSample/MetroWidgetHorizontal.vue +144 -0
  23. package/samples/TouchSample/MetroWidgetVertical.vue +144 -0
  24. package/samples/TouchSample/TouchContainerHorizontal.vue +159 -0
  25. package/samples/TouchSample/TouchContainerVertical.vue +159 -0
  26. package/samples/TouchSample/data.js +81 -0
  27. package/samples/{ColorSpace → assets}/bmpDemo.bmp +0 -0
  28. package/samples/{ColorSpace → assets}/jpegDemo.jpeg +0 -0
  29. package/samples/{ColorSpace → assets}/pngDemo.png +0 -0
  30. package/samples/{ColorSpace → assets}/pngNoAlphaDemo.png +0 -0
  31. package/samples/assets/webpDemo.webp +0 -0
  32. package/scripts/jsview-jsmap-serve.js +63 -0
  33. package/scripts/jsview-post-build.js +50 -3
  34. package/scripts/jsview-post-install.js +22 -0
  35. package/utils/JsViewEngineWidget/JsvFocusBlock.vue +7 -5
  36. package/utils/JsViewEngineWidget/JsvFocusManager.js +5 -0
  37. package/utils/JsViewEngineWidget/MetroWidget/ItemView.vue +7 -14
  38. package/utils/JsViewEngineWidget/MetroWidget/MetroWidget.vue +214 -89
  39. package/utils/JsViewEngineWidget/MetroWidget/RootView.vue +4 -3
  40. package/utils/JsViewEngineWidget/SimpleWidget/SimpleWidget.vue +2 -0
  41. package/utils/JsViewEngineWidget/TemplateParser.js +8 -6
  42. package/utils/JsViewPlugin/JsvPlayer/GetVersion.js +20 -0
  43. package/utils/JsViewPlugin/JsvPlayer/JsvMedia.js +220 -85
  44. package/utils/JsViewPlugin/JsvPlayer/JsvPlayer.vue +43 -14
  45. package/utils/JsViewPlugin/JsvPlayer/JsvPlayerBrowser.vue +25 -12
  46. package/utils/JsViewPlugin/JsvPlayer/index.js +4 -0
  47. package/utils/JsViewPlugin/JsvPlayer/version.js +19 -0
  48. package/utils/JsViewVueTools/DebugTool.js +24 -0
  49. package/utils/JsViewVueTools/NinePatchHelper.js +44 -0
  50. package/utils/JsViewVueTools/TypeCheckAndSet.js +27 -0
  51. package/utils/JsViewVueWidget/BrowserDebugWidget/BrowserQrcode.vue +19 -8
  52. package/utils/JsViewVueWidget/BrowserDebugWidget/JsvApic/BrowserApic.vue +1 -1
  53. package/utils/JsViewVueWidget/JsvApic/JsvApic.vue +2 -2
  54. package/utils/JsViewVueWidget/JsvFilterView.vue +73 -0
  55. package/utils/JsViewVueWidget/JsvGrid.vue +573 -0
  56. package/utils/JsViewVueWidget/JsvInput/JsvInput.vue +7 -0
  57. package/utils/JsViewVueWidget/JsvNinePatch.vue +2 -2
  58. package/utils/JsViewVueWidget/JsvQrcode/JsvQrcode.vue +12 -3
  59. package/utils/JsViewVueWidget/JsvSpray/JsvSpray.vue +1 -1
  60. package/utils/JsViewVueWidget/JsvTextureAnim/CommonType.js +8 -0
  61. package/utils/JsViewVueWidget/JsvTextureAnim/JsvTextureAnim.vue +171 -38
  62. package/utils/JsViewVueWidget/JsvTextureAnim/index.js +3 -2
  63. package/utils/JsViewVueWidget/JsvTouchContainer.vue +184 -0
@@ -0,0 +1,183 @@
1
+ <!--
2
+ * @Author: ChenChanghua
3
+ * @Date: 2022-05-06 19:32:53
4
+ * @LastEditors: ChenChanghua
5
+ * @LastEditTime: 2022-05-17 11:15:43
6
+ * @Description: file content
7
+ -->
8
+ <script>
9
+ import { jJsvRuntimeBridge } from "jsview/utils/JsViewVueTools/JsvRuntimeBridge";
10
+ import { reactive, ref } from "vue";
11
+ import JsvGrid, { LineType } from "jsview/utils/JsViewVueWidget/JsvGrid.vue";
12
+ import Item from "./Item.vue";
13
+ import FocusItem from "./FocusItem.vue";
14
+ import { EdgeDirection } from "jsview/utils/JsViewEngineWidget";
15
+ export default {
16
+ components: {
17
+ JsvGrid,
18
+ Item,
19
+ FocusItem,
20
+ },
21
+ setup() {
22
+ return {
23
+ lineType: new LineType(1, 3),
24
+ name1: "updatePage1",
25
+ name2: "updatePage2",
26
+ };
27
+ },
28
+ methods: {
29
+ _provideData1() {
30
+ let data = [];
31
+ for (let i = 0; i < 113; i++) {
32
+ data.push({
33
+ content: i + "_CCCCCCCCCCCCCCCCCCCCCCC",
34
+ });
35
+ }
36
+ return data;
37
+ },
38
+ _provideData2() {
39
+ let data2 = [];
40
+ for (let i = 0; i < 113; i++) {
41
+ data2.push({
42
+ name: i + "_D",
43
+ baseColor: i,
44
+ });
45
+ }
46
+ return data2;
47
+ },
48
+
49
+ _onEdge1(info) {
50
+ if (info.direction == EdgeDirection.right) {
51
+ this.$refs.widget2
52
+ .getFocusBlockRef()
53
+ .findBlockByName(this.name2)
54
+ .requestFocus();
55
+ }
56
+ },
57
+ _onEdge2(info) {
58
+ if (info.direction == EdgeDirection.left) {
59
+ this.$refs.widget1
60
+ .getFocusBlockRef()
61
+ .findBlockByName(this.name1)
62
+ .requestFocus();
63
+ }
64
+ },
65
+ _onKeyDown(ev) {
66
+ console.log("app onkeydown");
67
+ if (ev.keyCode == 8 || ev.keyCode == 27 || ev.keyCode == 10000) {
68
+ this.$router?.go(-1); // 有router时,是从DemoHomepage进入,回退
69
+ }
70
+ return true;
71
+ },
72
+ },
73
+ mounted() {
74
+ jJsvRuntimeBridge.notifyPageLoaded();
75
+ this.$refs.widget1
76
+ .getFocusBlockRef()
77
+ ?.findBlockByName(this.name1)
78
+ .requestFocus();
79
+ },
80
+ };
81
+ </script>
82
+
83
+ <template>
84
+ <jsv-focus-block
85
+ autoFocus
86
+ :onAction="{
87
+ onKeyDown: _onKeyDown,
88
+ }"
89
+ :style="{
90
+ width: 1920,
91
+ height: 1080,
92
+ backgroundColor: '#FFFFFF',
93
+ }"
94
+ ><jsv-grid
95
+ ref="widget1"
96
+ :name="name1"
97
+ :left="50"
98
+ :top="50"
99
+ :provideData="_provideData1"
100
+ :row="4"
101
+ :column="5"
102
+ :itemSize="{
103
+ width: 100,
104
+ height: 50,
105
+ }"
106
+ :gapInfo="{
107
+ row: 10,
108
+ column: 10,
109
+ }"
110
+ :verticalUpdate="true"
111
+ :columnFirst="true"
112
+ :onEdge="_onEdge1"
113
+ :initFocusId="21"
114
+ >
115
+ <template #renderItem="{ userData, widgetData, onAction, query }">
116
+ <item
117
+ :userData="userData"
118
+ :widgetData="widgetData"
119
+ :onAction="onAction"
120
+ :query="query"
121
+ />
122
+ </template>
123
+ </jsv-grid>
124
+ <div
125
+ :style="{
126
+ left: 100,
127
+ top: 300,
128
+ width: 300,
129
+ height: 50,
130
+ fontSize: 30,
131
+ }"
132
+ >
133
+ 纵向排布, 翻页模式
134
+ </div>
135
+ <div
136
+ :style="{
137
+ left: 700,
138
+ }"
139
+ >
140
+ <jsv-grid
141
+ ref="widget2"
142
+ :name="name2"
143
+ :left="50"
144
+ :top="50"
145
+ :provideData="_provideData2"
146
+ :row="4"
147
+ :column="5"
148
+ :itemSize="{
149
+ width: 100,
150
+ height: 50,
151
+ }"
152
+ :gapInfo="{
153
+ row: 10,
154
+ column: 10,
155
+ }"
156
+ :verticalUpdate="false"
157
+ :columnFirst="true"
158
+ :onEdge="_onEdge2"
159
+ :updateType="lineType"
160
+ :initFocusId="43"
161
+ >
162
+ <template #renderItem="{ userData, widgetData, onAction }">
163
+ <focus-item
164
+ :userData="userData"
165
+ :widgetData="widgetData"
166
+ :onAction="onAction"
167
+ />
168
+ </template>
169
+ </jsv-grid>
170
+ <div
171
+ :style="{
172
+ left: 100,
173
+ top: 300,
174
+ width: 300,
175
+ height: 50,
176
+ fontSize: 30,
177
+ }"
178
+ >
179
+ 横向排布, 逐行刷新
180
+ </div>
181
+ </div></jsv-focus-block
182
+ >
183
+ </template>
@@ -0,0 +1,111 @@
1
+ <!--
2
+ * @Author: ChenChanghua
3
+ * @Date: 2022-05-10 15:21:24
4
+ * @LastEditors: ChenChanghua
5
+ * @LastEditTime: 2022-05-12 21:34:15
6
+ * @Description: file content
7
+ -->
8
+ <!--
9
+ * @Author: ChenChanghua
10
+ * @Date: 2022-05-07 10:22:33
11
+ * @LastEditors: ChenChanghua
12
+ * @LastEditTime: 2022-05-09 09:19:43
13
+ * @Description: file content
14
+ -->
15
+ <script>
16
+ import { ref } from "vue";
17
+ export default {
18
+ props: ["userData", "name"],
19
+ setup() {
20
+ return {
21
+ focusIndex: ref(0),
22
+ focused: ref(false),
23
+ divNumber: new Array(25),
24
+ };
25
+ },
26
+ methods: {
27
+ _onFocus() {
28
+ console.log("button onfocus", this.userData);
29
+ this.focused = true;
30
+ },
31
+ _onBlur() {
32
+ this.focused = false;
33
+ this.focusIndex = 0;
34
+ },
35
+ _onKeyDown(ev) {
36
+ console.log("button onkeydown");
37
+ if (ev.keyCode == 37 && this.focusIndex == 1) {
38
+ this.focusIndex = 0;
39
+ return true;
40
+ } else if (ev.keyCode == 39 && this.focusIndex == 0) {
41
+ this.focusIndex = 1;
42
+ return true;
43
+ } else if (ev.keyCode == 13) {
44
+ console.log("button click", this.userData);
45
+ return true;
46
+ }
47
+ return false;
48
+ },
49
+ getFocusBlock() {
50
+ return this.$refs.focusBlock;
51
+ },
52
+ _MapColor(color_num) {
53
+ return ((color_num < 10 || color_num >= 100) ? '0' + color_num % 10 : '' + color_num % 100);
54
+ }
55
+ },
56
+ };
57
+ </script>
58
+
59
+ <template>
60
+ <jsv-focus-block
61
+ ref="focusBlock"
62
+ :name="name"
63
+ :onAction="{
64
+ onFocus: _onFocus,
65
+ onBlur: _onBlur,
66
+ onKeyDown: _onKeyDown,
67
+ }"
68
+ >
69
+ <div
70
+ v-for="(item, index) in divNumber"
71
+ :key="index + '_l'"
72
+ :style="{
73
+ left: 2 * index,
74
+ width: 2,
75
+ height: 50,
76
+ backgroundColor: '#77' + _MapColor(index) + _MapColor(index),
77
+ }"
78
+ ></div>
79
+ <div
80
+ :style="{
81
+ width: 50,
82
+ height: 50,
83
+ fontSize: 20,
84
+ color: '#FFFFFF',
85
+ }"
86
+ >
87
+ {{ userData.name }}
88
+ </div>
89
+
90
+ <div
91
+ v-for="(item, index) in divNumber"
92
+ :key="index + '_r'"
93
+ :style="{
94
+ left: 2 * index + 50,
95
+ width: 2,
96
+ height: 50,
97
+ backgroundColor: '#' + _MapColor(userData.baseColor) + _MapColor(index) + _MapColor(index),
98
+ }"
99
+ ></div>
100
+
101
+ <div
102
+ :style="{
103
+ visibility: this.focused ? 'visible' : 'hidden',
104
+ left: 50 * focusIndex,
105
+ width: 10,
106
+ height: 10,
107
+ backgroundColor: '#FF0000',
108
+ }"
109
+ ></div>
110
+ </jsv-focus-block>
111
+ </template>
@@ -0,0 +1,56 @@
1
+ <!--
2
+ * @Author: ChenChanghua
3
+ * @Date: 2022-05-10 15:21:24
4
+ * @LastEditors: ChenChanghua
5
+ * @LastEditTime: 2022-05-12 21:26:00
6
+ * @Description: file content
7
+ -->
8
+ <!--
9
+ * @Author: ChenChanghua
10
+ * @Date: 2022-05-07 10:22:33
11
+ * @LastEditors: ChenChanghua
12
+ * @LastEditTime: 2022-05-09 09:19:43
13
+ * @Description: file content
14
+ -->
15
+ <script>
16
+ import ButtonBlock from "./ButtonBlock.vue";
17
+ import { ref } from "vue";
18
+ export default {
19
+ components: { ButtonBlock },
20
+ props: ["userData", "widgetData", "onAction"],
21
+ setup() {
22
+ return {
23
+ focused: ref(false),
24
+ divNumber: new Array(50),
25
+ };
26
+ },
27
+ methods: {
28
+ onFocus() {
29
+ this.$refs.button
30
+ .getFocusBlock()
31
+ .findBlockByName(this.widgetData.gridIndex + "_item")
32
+ .requestFocus();
33
+ },
34
+ onBlur() {
35
+
36
+ },
37
+ },
38
+ created() {
39
+ if (this.onAction) {
40
+ this.onAction.register("onFocus", this.onFocus);
41
+ this.onAction.register("onBlur", this.onBlur);
42
+ }
43
+ },
44
+ mounted() {
45
+ // console.log("item mounted", this.userData, this.widgetData);
46
+ },
47
+ };
48
+ </script>
49
+
50
+ <template>
51
+ <button-block
52
+ ref="button"
53
+ :name="widgetData.gridIndex + '_item'"
54
+ :userData="userData"
55
+ ></button-block>
56
+ </template>
@@ -0,0 +1,101 @@
1
+ <!--
2
+ * @Author: ChenChanghua
3
+ * @Date: 2022-05-10 15:21:24
4
+ * @LastEditors: ChenChanghua
5
+ * @LastEditTime: 2022-05-17 11:13:07
6
+ * @Description: file content
7
+ -->
8
+ <!--
9
+ * @Author: ChenChanghua
10
+ * @Date: 2022-05-07 10:22:33
11
+ * @LastEditors: ChenChanghua
12
+ * @LastEditTime: 2022-05-09 09:19:43
13
+ * @Description: file content
14
+ -->
15
+ <script>
16
+ import { ref } from "vue";
17
+ export default {
18
+ props: ["userData", "widgetData", "onAction", "query"],
19
+ setup() {
20
+ function randomColor() {
21
+ let randomColor = Math.round(Math.random() * 2 ** 24).toString(16);
22
+ return (
23
+ "#" + new Array(6 - randomColor.length).fill("0").join("") + randomColor
24
+ );
25
+ }
26
+ return {
27
+ focused: ref(false),
28
+ randomColor,
29
+ divNumber: new Array(50),
30
+ blurAction: false,
31
+ };
32
+ },
33
+ methods: {
34
+ onFocus() {
35
+ console.log("item onfocus", this.userData);
36
+ this.focused = true;
37
+ this.blurAction = false;
38
+ },
39
+ onBlur() {
40
+ console.log("item onblur", this.userData, this.widgetData.getCurrentFocusId(), this.widgetData.dataIndex);
41
+ this.focused = false;
42
+ if (this.widgetData.getCurrentFocusId() == this.widgetData.dataIndex) {
43
+ this.blurAction = true;
44
+ }
45
+ },
46
+ onClick() {
47
+ console.log("item onclick ", this.userData);
48
+ },
49
+ },
50
+ created() {
51
+ if (this.onAction) {
52
+ this.onAction.register("onFocus", this.onFocus);
53
+ this.onAction.register("onBlur", this.onBlur);
54
+ this.onAction.register("onClick", this.onClick);
55
+ }
56
+ },
57
+ mounted() {
58
+ // console.log("item mounted", this.userData, this.widgetData);
59
+ },
60
+ };
61
+ </script>
62
+
63
+ <template>
64
+ <div
65
+ v-for="(item, index) in divNumber"
66
+ :key="index"
67
+ :style="{
68
+ left: 2 * index,
69
+ width: 2,
70
+ height: 50,
71
+ backgroundColor: '#007788',
72
+ }"
73
+ ></div>
74
+ <div
75
+ :style="{
76
+ width: 100,
77
+ height: 50,
78
+ fontSize: '30px',
79
+ color: '#FFFFFF',
80
+ }"
81
+ >
82
+ {{ userData.content }}
83
+ </div>
84
+ <div
85
+ :style="{
86
+ visibility: focused ? 'visible' : 'hidden',
87
+ width: 20,
88
+ height: 20,
89
+ backgroundColor: '#FF0000',
90
+ }"
91
+ ></div>
92
+ <div
93
+ :style="{
94
+ visibility: blurAction ? 'visible' : 'hidden',
95
+ left: 50,
96
+ width: 20,
97
+ height: 20,
98
+ backgroundColor: '#00FF00',
99
+ }"
100
+ ></div>
101
+ </template>
@@ -0,0 +1,146 @@
1
+ <template>
2
+ <div :style="{ width: 1280, height: 720, backgroundColor: '#FFFFFF' }">
3
+ <jsv-focus-block ref="focusNode" :onKeyDown="_onKeyDown">
4
+ <div :style="{
5
+ textAlign: 'center',
6
+ fontSize: 30,
7
+ lineHeight: 50,
8
+ color: '#ffffff',
9
+ left: 140,
10
+ top: 20,
11
+ width: 1000,
12
+ height: 50,
13
+ backgroundColor: 'rgba(27,38,151,0.8)'}"
14
+ >NinePatch展示,框的四个角的方形中心和项目的四个顶点严格对齐</div>
15
+ <metro-widget
16
+ ref="myFocusWidget"
17
+ :top="100"
18
+ :left="250"
19
+ :width="1000"
20
+ :height="400"
21
+ :direction="direction"
22
+ :data="data"
23
+ :measures="_measures"
24
+ :padding="{ left: 50, right: 50, top: 50, height: 50 }">
25
+ <template #renderItem="{ data, query, onEdge, onAction }">
26
+ <item
27
+ :data="data"
28
+ :query="query"
29
+ :onEdge="onEdge"
30
+ :onAction="onAction"
31
+ :frameChanged="_onFramePositionChanged"
32
+ />
33
+ </template>
34
+ </metro-widget>
35
+ <div :style="{top:150, left:300}">
36
+ <jsv-nine-patch
37
+ :style="{
38
+ width: framePosition.width,
39
+ height: framePosition.height,
40
+ top: framePosition.y,
41
+ left: framePosition.x,
42
+ }"
43
+ :imageUrl="imageUrl"
44
+ :imageWidth="81"
45
+ :centerWidth="25"
46
+ :borderOutset="14"
47
+ :imageDspWidth="81"
48
+ :animTime="0.2"
49
+ ></jsv-nine-patch>
50
+ </div>
51
+ </jsv-focus-block>
52
+ </div>
53
+ </template>
54
+ <script setup>
55
+ import { jJsvRuntimeBridge } from "jsview/utils/JsViewVueTools/JsvRuntimeBridge";
56
+ import {
57
+ HORIZONTAL,
58
+ MetroWidget,
59
+ } from "jsview/utils/JsViewEngineWidget";
60
+ import JsvNinePatch from "jsview/utils/JsViewVueWidget/JsvNinePatch.vue";
61
+ import Item from "./Item.vue";
62
+ import borderImageUrl from "./assets/border.png"
63
+ import { ref, onMounted } from 'vue'
64
+ import { useRouter, useRoute } from 'vue-router'
65
+
66
+
67
+ const router = useRouter();
68
+
69
+ const data = [
70
+ {
71
+ blocks: {
72
+ w: 160,
73
+ h: 160
74
+ },
75
+ color: "#FF9900",
76
+ content: 0
77
+ },
78
+ {
79
+ blocks: {
80
+ w: 300,
81
+ h: 300
82
+ },
83
+ color: "#0099FF",
84
+ content: 1
85
+ },
86
+ {
87
+ blocks: {
88
+ w: 160,
89
+ h: 160
90
+ },
91
+ color: "#FF9900",
92
+ content: 2
93
+ },
94
+ ];
95
+
96
+ const framePosition = ref({
97
+ x: 0,
98
+ y: 0,
99
+ width: 50,
100
+ height: 50
101
+ });
102
+
103
+ const direction = HORIZONTAL;
104
+
105
+ const imageUrl = borderImageUrl;
106
+
107
+ const _onFramePositionChanged = (new_x, new_y, new_width, new_height) => {
108
+ console.log(`new x=${new_x} y=${new_y} width=${new_width} height=${new_height}`);
109
+
110
+ framePosition.value = {
111
+ x: new_x,
112
+ y: new_y,
113
+ width: new_width,
114
+ height: new_height
115
+ };
116
+ };
117
+
118
+ const _measures = (item)=>{
119
+ return {
120
+ width: item.blocks.w,
121
+ height: item.blocks.h,
122
+ marginRight: 10,
123
+ marginTop: 10,
124
+ };
125
+ };
126
+
127
+ const _onKeyDown = (ev) => {
128
+ // 8:Backspace, 27:Escape, 10000:盒子返回键
129
+ if (ev.keyCode == 8 || ev.keyCode == 27 || ev.keyCode == 10000) {
130
+ router?.go(-1); // 有router时,是从DemoHomepage进入,回退
131
+ return true;
132
+ }
133
+ return false;
134
+ };
135
+
136
+ const myFocusWidget = ref(null);
137
+
138
+ onMounted(()=>{
139
+ myFocusWidget.value.getFocusBlockRef().requestFocus();
140
+ jJsvRuntimeBridge.notifyPageLoaded();
141
+ });
142
+
143
+ </script>
144
+ <style scoped>
145
+
146
+ </style>
@@ -0,0 +1,70 @@
1
+ <script setup>
2
+ import { ref, computed } from 'vue'
3
+
4
+ const props = defineProps({
5
+ data: Object,
6
+ query: Object,
7
+ onEdge: Function,
8
+ onAction: Object,
9
+ frameChanged: Function,
10
+ });
11
+
12
+ let focused = ref(false);
13
+
14
+ let styleValue = computed(()=>{
15
+ return {
16
+ width: props.data.blocks.w,
17
+ height: props.data.blocks.h,
18
+ color: "#FFFFFF",
19
+ backgroundColor: props.data.color,
20
+ };
21
+ });
22
+
23
+ const onFocus = ()=>{
24
+ focused.value = true;
25
+ if (props.frameChanged) {
26
+ let pos = props.query.position(props.query.id);
27
+
28
+ // 焦点时套在放大的item外缘,所以要计算按照中心放大后的焦点框x,y,width,height
29
+ const new_x = pos.left + (pos.width - pos.width * 1.05) / 2;
30
+ const new_y = pos.top + (pos.height - pos.height * 1.05) / 2;
31
+ const new_width = pos.width * 1.05;
32
+ const new_height = pos.height * 1.05;
33
+
34
+ props.frameChanged(new_x, new_y, new_width, new_height);
35
+ }
36
+ }
37
+
38
+ const onBlur = ()=>{
39
+ focused.value = false;
40
+ };
41
+
42
+ const onClicked = ()=>{
43
+ onsole.log(`item ${props.query.id} clicked`);
44
+ };
45
+
46
+ props.onAction.register("onFocus", onFocus);
47
+ props.onAction.register("onBlur", onBlur);
48
+ props.onAction.register("onClick", onClicked);
49
+
50
+ </script>
51
+
52
+ <template>
53
+ <div :class="focused ? 'focus' : 'blur'" :style="styleValue">
54
+ {{ '' + props.data.content + (testData != null ? testData.MyName : "") }}
55
+ </div>
56
+ </template>
57
+
58
+ <style scoped>
59
+ .focus {
60
+ transform: scale3d(1.05, 1.05, 1);
61
+ transition: transform 0.25s linear;
62
+ font-size: 30px;
63
+ }
64
+
65
+ .blur {
66
+ transform: scale3d(1, 1, 1);
67
+ transition: transform 0.25s linear;
68
+ font-size: 30px;
69
+ }
70
+ </style>