@shijiu/jsview-vue-samples 2.0.1073 → 2.0.1106

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 (90) hide show
  1. package/Basic/components/div/DivBackground.vue +13 -25
  2. package/Basic/components/img/ImageGroup.vue +14 -20
  3. package/Basic/components/img/ImgLayout.vue +59 -68
  4. package/BasicFocusControl/components/BaseBlock.vue +11 -17
  5. package/BasicFocusControl/components/MainAreaLeftBlock.vue +2 -2
  6. package/BasicFocusControl/components/MainAreaRightBlock.vue +2 -2
  7. package/BasicFocusControl/components/SideBarBlock.vue +2 -2
  8. package/CssPreprocessor/App.vue +40 -51
  9. package/CssPreprocessor/Less/App.vue +6 -14
  10. package/CssPreprocessor/Scss/App.vue +6 -14
  11. package/CssPreprocessor/Scss/components/scss-group1/ScssOperations.vue +0 -1
  12. package/CssPreprocessor/Stylus/App.vue +6 -14
  13. package/CssPreprocessor/utils/ContentBlock.vue +30 -12
  14. package/CssPreprocessor/utils/ContentList.vue +23 -14
  15. package/CssPreprocessor/utils/Panel.vue +34 -23
  16. package/CssPreprocessor/utils/TitleBar.vue +7 -9
  17. package/DemoHomepage/components/BodyFrame.vue +54 -78
  18. package/DemoHomepage/components/Dialog.vue +38 -43
  19. package/DemoHomepage/components/Item.vue +52 -55
  20. package/DemoHomepage/components/TabFrame.vue +43 -72
  21. package/DemoHomepage/router.js +1 -1
  22. package/GiftRain/App.vue +10 -4
  23. package/GridDemo/App.vue +5 -5
  24. package/GridDemo/FocusItem.vue +3 -5
  25. package/GridDemo/Item.vue +4 -24
  26. package/HashHistory/App.vue +0 -10
  27. package/HashHistory/views/MainPage.vue +0 -1
  28. package/ImpactStop/App.vue +0 -1
  29. package/Input/App.vue +106 -150
  30. package/Input/FullKeyboard.vue +18 -28
  31. package/Input/InputPanel.vue +87 -109
  32. package/Input/KeyboardItem.vue +35 -45
  33. package/JsvRadarChart/App.vue +16 -19
  34. package/LongImage/Button.vue +2 -3
  35. package/LongText/App.vue +0 -3
  36. package/LongText/Button.vue +0 -1
  37. package/LongText/LongTextScroll.vue +0 -4
  38. package/Marquee/App.vue +1 -0
  39. package/MetroWidgetDemos/PerformanceTest/App.vue +2 -3
  40. package/MetroWidgetDemos/PerformanceTest/Item.vue +52 -55
  41. package/MetroWidgetDemos/PerformanceTest/components/ContentItem.vue +26 -26
  42. package/MetroWidgetDemos/PerformanceTest/components/MyTab.vue +86 -95
  43. package/MetroWidgetDemos/PingPong/App.vue +56 -89
  44. package/MetroWidgetDemos/PingPong/AppPage.vue +3 -3
  45. package/MetroWidgetDemos/PingPong/Item.vue +1 -1
  46. package/MetroWidgetDemos/PingPong/TabItem.vue +3 -3
  47. package/MetroWidgetDemos/PingPong/WidgetItem.vue +1 -1
  48. package/MetroWidgetDemos/SkeletonDiagram/App.vue +2 -4
  49. package/MetroWidgetDemos/basic/Item.vue +1 -1
  50. package/MetroWidgetDemos/direction/App.vue +0 -2
  51. package/MetroWidgetDemos/direction/Item.vue +1 -1
  52. package/MetroWidgetDemos/focusableItemBasic/App.vue +1 -1
  53. package/MetroWidgetDemos/focusableItemBasic/ButtonItem.vue +1 -1
  54. package/MetroWidgetDemos/focusableItemMetroWidget/App.vue +1 -1
  55. package/MetroWidgetDemos/focusableItemMetroWidget/Item.vue +1 -1
  56. package/MetroWidgetDemos/focusableItemMetroWidget/WidgetItem.vue +1 -1
  57. package/MetroWidgetDemos/focusableItemMix/App.vue +1 -1
  58. package/MetroWidgetDemos/focusableItemMix/ButtonItem.vue +1 -1
  59. package/MetroWidgetDemos/focusableItemMix/Item.vue +1 -1
  60. package/MetroWidgetDemos/itemSizeUpdate/backward/Item.vue +23 -25
  61. package/MetroWidgetDemos/layoutType/App.vue +0 -2
  62. package/MetroWidgetDemos/layoutType/Item.vue +1 -1
  63. package/MetroWidgetDemos/ninePatchFocusPage/App.vue +0 -1
  64. package/MetroWidgetDemos/ninePatchFocusPage/PageRow.vue +1 -1
  65. package/MetroWidgetDemos/padding/App.vue +0 -2
  66. package/MetroWidgetDemos/padding/Item.vue +1 -1
  67. package/MetroWidgetDemos/slideSetting/Item.vue +1 -1
  68. package/MockjsDemo/App.vue +26 -11
  69. package/MockjsDemo/mock/index.js +9 -1
  70. package/QrcodeDemo/App.vue +0 -1
  71. package/SoundPool/App.vue +1 -2
  72. package/SpriteImage/App.vue +89 -125
  73. package/Swiper/App.vue +1 -3
  74. package/TestNativeSharedView/App.vue +104 -48
  75. package/TextBox/RenderCenter.vue +89 -113
  76. package/TextBox/RenderLeft.vue +89 -113
  77. package/TextBox/RenderOneLine.vue +7 -10
  78. package/TextBox/RenderRight.vue +8 -11
  79. package/TextShadowDemo/App.vue +54 -75
  80. package/TextureAnimation/App.vue +175 -287
  81. package/TextureAnimation/App2.vue +1 -5
  82. package/ThrowMoveDemo/AccelerateDemo.vue +40 -71
  83. package/ThrowMoveDemo/App.vue +13 -23
  84. package/ThrowMoveDemo/TargetDemo.vue +24 -53
  85. package/ThrowMoveDemo/UDParabolicDemo.vue +31 -60
  86. package/VideoDemo/App.vue +71 -116
  87. package/package.json +1 -1
  88. package/VideoDemo/components/Button.vue +0 -58
  89. package/VideoDemo/components/Controllor.vue +0 -197
  90. package/VideoDemo/components/VideoFrame.vue +0 -140
package/GiftRain/App.vue CHANGED
@@ -178,6 +178,10 @@ const _onImpactTracer = (rain) => {
178
178
  }
179
179
  }
180
180
  }
181
+ //定义边缘变量,到边缘时不允许触发相应方向的按键事件。
182
+ let leftEdge = shallowRef(false)
183
+ let rightEgde = shallowRef(false)
184
+
181
185
  //键盘松开时应该暂停动作
182
186
  const onKeyUp = (ev) => {
183
187
  console.log("onKeyUp in : ", ev);
@@ -196,17 +200,19 @@ const router = useRouter();
196
200
  const onKeyDown = (ev) => {
197
201
  if (ev.keyCode == 8 || ev.keyCode == 27 || ev.keyCode == 10000) {
198
202
  router.go(-1)
199
- } else if (ev.keyCode === 37) {
203
+ } else if (ev.keyCode === 37 && !leftEdge.value) {
200
204
  console.log(" ev.keyCode === 37 ");
201
205
  if (!_IsRunning) {
202
- _TranslateControl.moveToX(0, 400 * 1.5, null);
206
+ _TranslateControl.moveToX(0, 400 * 1.5, () => leftEdge.value = true);
203
207
  _IsRunning = true;
208
+ rightEgde.value = false
204
209
  }
205
- } else if (ev.keyCode === 39) {
210
+ } else if (ev.keyCode === 39 && !rightEgde.value) {
206
211
  console.log(" ev.keyCode === 39");
207
212
  if (!_IsRunning) {
208
- _TranslateControl.moveToX((1280 - 220 - 194) * 1.5, 400 * 1.5, null);
213
+ _TranslateControl.moveToX((1280 - 220 - 194) * 1.5, 400 * 1.5, () => rightEgde.value = true);
209
214
  _IsRunning = true;
215
+ leftEdge.value = false
210
216
  }
211
217
  }
212
218
  return true;
package/GridDemo/App.vue CHANGED
@@ -1,13 +1,13 @@
1
1
  <!--
2
2
  * @Author: ChenChanghua
3
3
  * @Date: 2022-05-06 19:32:53
4
- * @LastEditors: ChenChanghua
5
- * @LastEditTime: 2022-07-08 11:39:09
4
+ * @LastEditors: ZhengYi
5
+ * @LastEditTime: 2023-05-04
6
6
  * @Description: file content
7
7
  -->
8
8
  <script setup>
9
9
  import { jJsvRuntimeBridge, JsvGrid, LineType, EdgeDirection } from "jsview";
10
- import { reactive, ref, shallowRef, onMounted } from "vue";
10
+ import { shallowRef, onMounted } from "vue";
11
11
  import { useRouter } from "vue-router";
12
12
  import ItemVue from "./Item.vue";
13
13
  import FocusItem from "./FocusItem.vue";
@@ -203,13 +203,13 @@ onMounted(() => {
203
203
  <div
204
204
  :style="{
205
205
  left: 100,
206
- top: 300,
206
+ top: 0,
207
207
  width: 300,
208
208
  height: 50,
209
209
  fontSize: 30,
210
210
  }"
211
211
  >
212
- 空数据
212
+ 空数据展示
213
213
  </div>
214
214
  </div>
215
215
  </jsv-focus-block>
@@ -1,21 +1,19 @@
1
1
  <!--
2
2
  * @Author: ChenChanghua
3
3
  * @Date: 2022-05-10 15:21:24
4
- * @LastEditors: ChenChanghua
5
- * @LastEditTime: 2022-07-08 11:50:58
4
+ * @LastEditors: ZhengYi
5
+ * @LastEditTime: 2022-05-04
6
6
  * @Description: file content
7
7
  -->
8
8
  <script setup>
9
9
  import ButtonBlock from "./ButtonBlock.vue";
10
- import { ref, shallowRef } from "vue";
10
+ import { shallowRef } from "vue";
11
11
 
12
12
  const props = defineProps({
13
13
  userData: Object,
14
14
  widgetData: Object,
15
15
  onAction: Object,
16
16
  });
17
- const focused = ref(false);
18
- const divNumber = new Array(50);
19
17
  const button = shallowRef(null);
20
18
  const onFocus = () => {
21
19
  button.value
package/GridDemo/Item.vue CHANGED
@@ -1,39 +1,25 @@
1
1
  <!--
2
2
  * @Author: ChenChanghua
3
3
  * @Date: 2022-05-10 15:21:24
4
- * @LastEditors: Please set LastEditors
5
- * @LastEditTime: 2023-02-16 16:25:06
4
+ * @LastEditors: ZhengYi
5
+ * @LastEditTime: 2023-05-04
6
6
  * @Description: file content
7
7
  -->
8
8
  <script setup>
9
- import { ref, onUpdated, onMounted } from "vue";
9
+ import { ref } from "vue";
10
10
 
11
11
  const props = defineProps({
12
12
  userData: Object,
13
13
  widgetData: Object,
14
14
  onAction: Object,
15
15
  });
16
- const randomColor = () => {
17
- let randomColor = Math.round(Math.random() * 2 ** 24).toString(16);
18
- return (
19
- "#" + new Array(6 - randomColor.length).fill("0").join("") + randomColor
20
- );
21
- };
16
+
22
17
  const focused = ref(false);
23
18
  const divNumber = new Array(50);
24
- const blurAction = false;
25
-
26
19
  const onFocus = () => {
27
- // console.log("item onfocus", props.userData);
28
20
  focused.value = true;
29
21
  };
30
22
  const onBlur = () => {
31
- // console.log(
32
- // "item onblur",
33
- // props.userData,
34
- // props.widgetData.getCurrentFocusId(),
35
- // props.widgetData.dataIndex
36
- // );
37
23
  focused.value = false;
38
24
  };
39
25
  const onClick = () => {
@@ -44,12 +30,6 @@ props.onAction.register("onFocus", onFocus);
44
30
  props.onAction.register("onBlur", onBlur);
45
31
  props.onAction.register("onClick", onClick);
46
32
 
47
- onUpdated(() => {
48
- // console.log("item updated", props.userData, props.widgetData);
49
- });
50
- onMounted(() => {
51
- // console.log("item mounted", props.userData, props.widgetData);
52
- });
53
33
  </script>
54
34
 
55
35
  <template>
@@ -46,16 +46,6 @@ const onRequestFocus = (branchName) => {
46
46
  topRef.value.findBlockByname(branchName)?.requestFocus();
47
47
  };
48
48
 
49
- const watchRouterChanged = (route) => {
50
- route.afterEach(() => {
51
- displayUrl.value = window.location.href;
52
- });
53
- };
54
-
55
- const onKeyDown = (event) => {
56
- return routePage.value.onKeyDown(event);
57
- };
58
-
59
49
  onMounted(() => {
60
50
  jJsvRuntimeBridge.notifyPageLoaded();
61
51
  });
@@ -2,7 +2,6 @@
2
2
  import { useRouter } from "vue-router";
3
3
  import HorizontalButtonList from "../components/HorizontalButtonList.vue";
4
4
 
5
- const branchName = "./MainPage.ButtonList";
6
5
  const router = useRouter();
7
6
 
8
7
  const buttonListConfig = [
@@ -45,7 +45,6 @@ const actorState = {
45
45
  const showPrecisionGuild = shallowRef(true);
46
46
  const direction = shallowRef(1);
47
47
  const bodyState = shallowRef(0);
48
- const isJsView = Boolean(window.JsView);
49
48
 
50
49
  const actorColor = computed(() => {
51
50
  switch (bodyState.value) {
package/Input/App.vue CHANGED
@@ -1,164 +1,120 @@
1
1
  <!--
2
2
  * @Author: ChenChanghua
3
3
  * @Date: 2022-01-20 16:09:31
4
- * @LastEditors: ChenChanghua
5
- * @LastEditTime: 2022-09-01 17:34:30
4
+ * @LastEditors: ZhengYi
5
+ * @LastEditTime: 2023-04-28
6
6
  * @Description: file content
7
7
  -->
8
- <script>
8
+ <script setup>
9
9
  import { InputType, EdgeDirection, useFocusHub } from "jsview";
10
10
  import InputPanel from "./InputPanel.vue";
11
+ import { useRouter } from "vue-router";
12
+ import { shallowRef } from "vue"
13
+ const router = useRouter();
14
+ let focusNode = shallowRef(null)
15
+ const name = "/input"
16
+ const focusHub = useFocusHub()
17
+
18
+ const _onKeyDown = (ev) => {
19
+ if (ev.keyCode == 8 || ev.keyCode == 27 || ev.keyCode == 10000) {
20
+ router?.go(-1); // 有router时,是从DemoHomepage进入,回退
21
+ }
22
+ return true;
23
+ }
24
+ const _onFocus = () => {
25
+ focusHub.setFocus(name + "/normal");
26
+ }
27
+ const _panel1OnEdge = (edgeInfo) => {
28
+ if (edgeInfo.direction == EdgeDirection.right) {
29
+ focusHub.setFocus(name + "/password");
30
+ }
31
+ }
32
+ const _panel2OnEdge = (edgeInfo) => {
33
+ if (edgeInfo.direction == EdgeDirection.left) {
34
+ focusHub.setFocus(name + "/normal");
35
+ } else if (edgeInfo.direction == EdgeDirection.right) {
36
+ focusHub.setFocus(name + "/number");
37
+ }
38
+ }
39
+ const _panel3OnEdge = (edgeInfo) => {
40
+ if (edgeInfo.direction == EdgeDirection.left) {
41
+ focusHub.setFocus(name + "/password");
42
+ }
43
+ }
44
+
11
45
 
12
- export default {
13
- components: {
14
- InputPanel,
15
- },
16
- setup() {
17
- return {
18
- name: "/input",
19
- InputType,
20
- focusHub: useFocusHub(),
21
- };
22
- },
23
- methods: {
24
- _onKeyDown(ev) {
25
- if (ev.keyCode == 8 || ev.keyCode == 27 || ev.keyCode == 10000) {
26
- this.$router?.go(-1); // 有router时,是从DemoHomepage进入,回退
27
- }
28
- return true;
29
- },
30
- _onFocus() {
31
- this.focusHub.setFocus(this.name + "/normal");
32
- },
33
- _panel1OnEdge(edgeInfo) {
34
- if (edgeInfo.direction == EdgeDirection.right) {
35
- this.focusHub.setFocus(this.name + "/password");
36
- }
37
- },
38
- _panel2OnEdge(edgeInfo) {
39
- if (edgeInfo.direction == EdgeDirection.left) {
40
- this.focusHub.setFocus(this.name + "/normal");
41
- } else if (edgeInfo.direction == EdgeDirection.right) {
42
- this.focusHub.setFocus(this.name + "/number");
43
- }
44
- },
45
- _panel3OnEdge(edgeInfo) {
46
- if (edgeInfo.direction == EdgeDirection.left) {
47
- this.focusHub.setFocus(this.name + "/password");
48
- }
49
- },
50
- },
51
- };
52
46
  </script>
53
47
 
54
48
  <template>
55
- <jsv-focus-block
56
- ref="focusNode"
57
- autoFocus
58
- :onAction="{
59
- onKeyDown: _onKeyDown,
60
- onFocus: _onFocus,
61
- }"
62
- :style="{
63
- width: 1920,
64
- height: 1080,
65
- backgroundColor: '#007788',
66
- }"
67
- >
68
- <div
69
- :style="{
70
- top: 100,
71
- left: 100,
72
- }"
73
- >
74
- <div
75
- :style="{
76
- width: 300,
77
- height: 50,
78
- lineHeight: 50,
79
- textAlign: 'center',
80
- fontSize: 30,
81
- }"
82
- >
83
- 文字输入-左对齐
84
- </div>
85
- <div
86
- :style="{
87
- top: 100,
88
- }"
89
- >
90
- <input-panel
91
- :name="name + '/normal'"
92
- :type="InputType.TEXT"
93
- textAlign="left"
94
- placeholder="请输入"
95
- :onEdge="_panel1OnEdge"
96
- />
97
- </div>
98
- </div>
49
+ <jsv-focus-block ref="focusNode" autoFocus :onAction="{
50
+ onKeyDown: _onKeyDown,
51
+ onFocus: _onFocus,
52
+ }" :style="{
53
+ width: 1920,
54
+ height: 1080,
55
+ backgroundColor: '#007788',
56
+ }">
57
+ <div :style="{
58
+ top: 100,
59
+ left: 100,
60
+ }">
61
+ <div :style="{
62
+ width: 300,
63
+ height: 50,
64
+ lineHeight: 50,
65
+ textAlign: 'center',
66
+ fontSize: 30,
67
+ }">
68
+ 文字输入-左对齐
69
+ </div>
70
+ <div :style="{
71
+ top: 100,
72
+ }">
73
+ <input-panel :name="name + '/normal'" :type="InputType.TEXT" textAlign="left" placeholder="请输入"
74
+ :onEdge="_panel1OnEdge" />
75
+ </div>
76
+ </div>
99
77
 
100
- <div
101
- :style="{
102
- top: 100,
103
- left: 500,
104
- }"
105
- >
106
- <div
107
- :style="{
108
- width: 300,
109
- height: 50,
110
- lineHeight: 50,
111
- textAlign: 'center',
112
- fontSize: 30,
113
- }"
114
- >
115
- 密码输入-右对齐
116
- </div>
117
- <div
118
- :style="{
119
- top: 100,
120
- }"
121
- >
122
- <input-panel
123
- :name="name + '/password'"
124
- :type="InputType.PASSWORD"
125
- textAlign="right"
126
- placeholder="请输入"
127
- :onEdge="_panel2OnEdge"
128
- />
129
- </div>
130
- </div>
78
+ <div :style="{
79
+ top: 100,
80
+ left: 500,
81
+ }">
82
+ <div :style="{
83
+ width: 300,
84
+ height: 50,
85
+ lineHeight: 50,
86
+ textAlign: 'center',
87
+ fontSize: 30,
88
+ }">
89
+ 密码输入-右对齐
90
+ </div>
91
+ <div :style="{
92
+ top: 100,
93
+ }">
94
+ <input-panel :name="name + '/password'" :type="InputType.PASSWORD" textAlign="right" placeholder="请输入"
95
+ :onEdge="_panel2OnEdge" />
96
+ </div>
97
+ </div>
131
98
 
132
- <div
133
- :style="{
134
- top: 100,
135
- left: 900,
136
- }"
137
- >
138
- <div
139
- :style="{
140
- width: 300,
141
- height: 50,
142
- lineHeight: 50,
143
- textAlign: 'center',
144
- fontSize: 30,
145
- }"
146
- >
147
- 数字输入-右对齐
148
- </div>
149
- <div
150
- :style="{
151
- top: 100,
152
- }"
153
- >
154
- <input-panel
155
- :name="name + '/number'"
156
- :type="InputType.NUMBER"
157
- textAlign="right"
158
- placeholder="请输入"
159
- :onEdge="_panel3OnEdge"
160
- />
161
- </div>
162
- </div>
163
- </jsv-focus-block>
99
+ <div :style="{
100
+ top: 100,
101
+ left: 900,
102
+ }">
103
+ <div :style="{
104
+ width: 300,
105
+ height: 50,
106
+ lineHeight: 50,
107
+ textAlign: 'center',
108
+ fontSize: 30,
109
+ }">
110
+ 数字输入-右对齐
111
+ </div>
112
+ <div :style="{
113
+ top: 100,
114
+ }">
115
+ <input-panel :name="name + '/number'" :type="InputType.NUMBER" textAlign="right" placeholder="请输入"
116
+ :onEdge="_panel3OnEdge" />
117
+ </div>
118
+ </div>
119
+ </jsv-focus-block>
164
120
  </template>
@@ -1,15 +1,20 @@
1
1
  <!--
2
2
  * @Author: ChenChanghua
3
3
  * @Date: 2022-01-25 10:27:17
4
- * @LastEditors: ChenChanghua
5
- * @LastEditTime: 2022-07-08 13:37:59
4
+ * @LastEditors: ZhengYi
5
+ * @LastEditTime: 2023-04-28
6
6
  * @Description: file content
7
7
  -->
8
- <script>
8
+ <script setup>
9
9
  import { VERTICAL, SimpleWidget } from "jsview";
10
10
  import KeyboardItem from "./KeyboardItem.vue";
11
11
 
12
- function _initData() {
12
+ const props=defineProps({
13
+ name: String,
14
+ onClick: Function,
15
+ onEdge: Function,
16
+ })
17
+ const _initData=()=>{
13
18
  const result = [];
14
19
  result.push({
15
20
  width: 120,
@@ -35,44 +40,29 @@ function _initData() {
35
40
  return result;
36
41
  }
37
42
 
38
- export default {
39
- components: {
40
- SimpleWidget,
41
- KeyboardItem,
42
- },
43
- props: {
44
- name: String,
45
- onClick: Function,
46
- onEdge: Function,
47
- },
48
- setup() {
49
- return {
50
- direction: VERTICAL,
51
- data: _initData(),
52
- };
53
- },
54
- methods: {
55
- _measures(item) {
43
+
44
+ const direction=VERTICAL
45
+ const data=_initData()
46
+
47
+ const _measures=(item)=> {
56
48
  return {
57
49
  width: item.width,
58
50
  height: item.height,
59
51
  };
60
- },
61
- },
62
- };
52
+ }
63
53
  </script>
64
54
 
65
55
  <template>
66
56
  <simple-widget
67
57
  ref="sw"
68
- :name="name"
58
+ :name="props.name"
69
59
  :data="data"
70
60
  :width="260"
71
61
  :height="300"
72
62
  :padding="{ left: 10, right: 10, top: 10, bottom: 10 }"
73
63
  :direction="direction"
74
64
  :measures="_measures"
75
- :onEdge="onEdge"
65
+ :onEdge="props.onEdge"
76
66
  >
77
67
  <template #renderItem="{ data, query, onEdge, onAction }">
78
68
  <keyboard-item
@@ -80,7 +70,7 @@ export default {
80
70
  :query="query"
81
71
  :onEdge="onEdge"
82
72
  :onAction="onAction"
83
- :onClick="onClick"
73
+ :onClick="props.onClick"
84
74
  />
85
75
  </template>
86
76
  </simple-widget>