@shijiu/jsview-vue-samples 2.1.482-test.0 → 2.2.128

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 (39) hide show
  1. package/BakeViewDemo/AnimatePic.vue +93 -0
  2. package/BakeViewDemo/App.vue +109 -0
  3. package/ClickDivDemo/App.vue +150 -0
  4. package/DemoHomepage/components/Dialog.vue +37 -11
  5. package/DemoHomepage/components/TabFrame.vue +8 -1
  6. package/DemoHomepage/router.js +76 -34
  7. package/DemoHomepage/views/Homepage.vue +30 -13
  8. package/FocusMoveStyle/App.vue +21 -4
  9. package/FocusMoveStyle/FoldableItem.vue +39 -12
  10. package/FreeMoveChildAttract/App.vue +105 -0
  11. package/FreeMoveLink/App.vue +55 -0
  12. package/FreeMoveResize/App.vue +102 -0
  13. package/LongText/App.vue +1 -3
  14. package/LongText/LongTextScroll.vue +124 -67
  15. package/LongTextLatex/App.vue +93 -0
  16. package/LongTextLatex/Button.vue +50 -0
  17. package/LongTextLatex/ButtonItem.vue +44 -0
  18. package/LongTextLatex/LongTextScroll.vue +189 -0
  19. package/LongTextLatex/Scroll.vue +14 -0
  20. package/Marquee/longText.js +1 -1
  21. package/MetroWidgetDemos/MassiveItems/App.vue +87 -0
  22. package/MetroWidgetDemos/MassiveItems/ContentItem.vue +388 -0
  23. package/MetroWidgetDemos/MassiveItems/Item.vue +203 -0
  24. package/MetroWidgetDemos/MassiveItems/WidgetItem.vue +101 -0
  25. package/MetroWidgetDemos/MassiveItems/data.js +17 -0
  26. package/MetroWidgetDemos/PingPong/AppPage.vue +19 -9
  27. package/MetroWidgetDemos/SeamlessSlide/App.vue +156 -0
  28. package/MetroWidgetDemos/SeamlessSlide/ControlItem.vue +45 -0
  29. package/MetroWidgetDemos/SeamlessSlide/Controller.vue +110 -0
  30. package/MetroWidgetDemos/SeamlessSlide/Item.vue +43 -0
  31. package/MetroWidgetDemos/routeList.js +12 -0
  32. package/SceneTransition/App.vue +10 -2
  33. package/ScrollBoxTest/App.vue +160 -0
  34. package/TestNativeSharedView/App.vue +166 -73
  35. package/TextureAnimation/App2.vue +52 -7
  36. package/TombSweepingDayTest/App.vue +11 -0
  37. package/TombSweepingDayTest/Raining/Rain.vue +69 -0
  38. package/TombSweepingDayTest/Raining/RainScene.vue +131 -0
  39. package/package.json +1 -1
@@ -6,7 +6,12 @@
6
6
  * @Description: file content
7
7
  -->
8
8
  <script setup>
9
- import { VERTICAL, MetroWidget, METRO_WIDGET_CONST, SeamlessSlide } from "jsview";
9
+ import {
10
+ VERTICAL,
11
+ MetroWidget,
12
+ METRO_WIDGET_CONST,
13
+ SeamlessSlide,
14
+ } from "jsview";
10
15
  import WidgetItem from "./WidgetItem.vue";
11
16
  import { shallowRef, watch, onBeforeUnmount } from "vue";
12
17
 
@@ -26,11 +31,17 @@ const props = defineProps({
26
31
 
27
32
  const widgetRef = shallowRef(null);
28
33
 
29
- const slideSetting = props.data.tabIndex == 0 ? new SeamlessSlide({
30
- startPercent: 0.5,
31
- endPercent: 0.5,
32
- fixFirstPage: true,
33
- }) : new SeamlessSlide();
34
+ const slideSetting =
35
+ props.data.tabIndex == 0
36
+ ? new SeamlessSlide({
37
+ startPercent: 0.5,
38
+ endPercent: 0.5,
39
+ fixFirstPage: true,
40
+ })
41
+ : new SeamlessSlide({
42
+ startPercent: 0.5,
43
+ endPercent: 0.5,
44
+ });
34
45
 
35
46
  const provideData = () => {
36
47
  return props.data.data;
@@ -52,8 +63,7 @@ const watcher = watch(
52
63
 
53
64
  onBeforeUnmount(() => {
54
65
  watcher();
55
- })
56
-
66
+ });
57
67
  </script>
58
68
 
59
69
  <template>
@@ -77,4 +87,4 @@ onBeforeUnmount(() => {
77
87
  ></widget-item>
78
88
  </template>
79
89
  </metro-widget>
80
- </template>
90
+ </template>
@@ -0,0 +1,156 @@
1
+ <!--
2
+ * @Author: ChenChanghua
3
+ * @Date: 2023-03-08 14:52:08
4
+ * @Description: file content
5
+ -->
6
+ <script setup>
7
+ import {
8
+ MetroWidget,
9
+ HORIZONTAL,
10
+ useFocusHub,
11
+ SeamlessSlide,
12
+ WholePageSlide,
13
+ EdgeDirection,
14
+ SlideSetting,
15
+ } from "jsview";
16
+ import Item from "./Item.vue";
17
+ import Controller from "./Controller.vue";
18
+ import { onMounted, ref } from "vue";
19
+
20
+ const controller = ref(null);
21
+ const widget = ref(null);
22
+ const handler = {
23
+ widget,
24
+ };
25
+ window.testWidget = widget;
26
+
27
+ const slideObj = {
28
+ headRange: 0.5,
29
+ tailRange: 0.5,
30
+ };
31
+ const defaultSlide = new SeamlessSlide(slideObj);
32
+
33
+ const slide1 = new SeamlessSlide({
34
+ ...slideObj,
35
+ boundaryProtect: SlideSetting.START_PROTECT,
36
+ });
37
+
38
+ const focusHub = useFocusHub();
39
+
40
+ const randomColor = () => {
41
+ let randomColor = Math.round(Math.random() * 2 ** 24).toString(16);
42
+ return (
43
+ "#" + new Array(6 - randomColor.length).fill("0").join("") + randomColor
44
+ );
45
+ };
46
+
47
+ const dataNumber = 35;
48
+ const provideData = () => {
49
+ const data = [];
50
+
51
+ for (let i = 0; i < dataNumber; i++) {
52
+ data.push({
53
+ width: 90,
54
+ height: 50,
55
+ marginRight: 10,
56
+ color: randomColor(),
57
+ content: i,
58
+ });
59
+ }
60
+ return data;
61
+ };
62
+
63
+ const measures = (data) => {
64
+ return {
65
+ width: data.width,
66
+ height: data.height,
67
+ marginRight: data.marginRight,
68
+ marginBottom: data.marginBottom,
69
+ };
70
+ };
71
+
72
+ // callbacks
73
+ const onEdge = (edgeInfo) => {
74
+ if (edgeInfo.direction == EdgeDirection.bottom) {
75
+ controller.value?.setFocusId(widget.value?.getCurrentFocusIndex());
76
+ focusHub.setFocus("myController");
77
+ }
78
+ };
79
+
80
+ const onBlur = () => {
81
+ widget.value?.setSlideSetting(slide1);
82
+ };
83
+
84
+ const onFocus = () => {
85
+ widget.value?.setSlideSetting(null);
86
+ };
87
+
88
+ const widgetLayout = {
89
+ left: 50,
90
+ top: 100,
91
+ width: 1000,
92
+ height: 50,
93
+ };
94
+
95
+ onMounted(() => {
96
+ //组件mount后设置焦点
97
+ focusHub.setFocus("mainMw");
98
+ });
99
+ </script>
100
+
101
+ <template>
102
+ <div
103
+ :style="{
104
+ width: 1920,
105
+ height: 1080,
106
+ backgroundColor: '#007788',
107
+ }"
108
+ />
109
+ <div
110
+ :style="{
111
+ top: 20,
112
+ left: widgetLayout.left,
113
+ width: widgetLayout.width * slideObj.headRange,
114
+ height: 50,
115
+ backgroundColor: '#FF0000AA',
116
+ fontSize: 25,
117
+ color: '#ffffff',
118
+ }"
119
+ >
120
+ 左键滚动区域
121
+ </div>
122
+ <div
123
+ :style="{
124
+ top: 20,
125
+ left: widgetLayout.left + widgetLayout.width * slideObj.tailRange,
126
+ width: widgetLayout.width * (1 - slideObj.tailRange),
127
+ height: 50,
128
+ backgroundColor: '#00FF00AA',
129
+ fontSize: 25,
130
+ color: '#ffffff',
131
+ }"
132
+ >
133
+ 右键滚动区域
134
+ </div>
135
+ <metro-widget
136
+ ref="widget"
137
+ name="mainMw"
138
+ :left="widgetLayout.left"
139
+ :top="widgetLayout.top"
140
+ :width="widgetLayout.width"
141
+ :height="widgetLayout.height"
142
+ :provideData="provideData"
143
+ :direction="HORIZONTAL"
144
+ :measures="measures"
145
+ :onEdge="onEdge"
146
+ :onBlur="onBlur"
147
+ :onFocus="onFocus"
148
+ :slideSetting="defaultSlide"
149
+ >
150
+ <template #renderItem="{ data, onAction }">
151
+ <item :data="data" :onAction="onAction" />
152
+ </template>
153
+ </metro-widget>
154
+
155
+ <controller ref="controller" :number="dataNumber" :widgetHandler="handler" />
156
+ </template>
@@ -0,0 +1,45 @@
1
+ <!--
2
+ * @Author: ChenChanghua
3
+ * @Date: 2023-03-08 14:52:17
4
+ * @Description: file content
5
+ -->
6
+ <script setup>
7
+ import { ref } from "vue";
8
+
9
+ const props = defineProps({
10
+ data: Object,
11
+ onAction: Object,
12
+ controlCallback: Function,
13
+ });
14
+
15
+ const focused = ref(false);
16
+
17
+ // 注册回调
18
+ const onFocus = () => {
19
+ focused.value = true;
20
+ props.controlCallback(props.data);
21
+ };
22
+ const onBlur = () => {
23
+ focused.value = false;
24
+ };
25
+ const onClick = () => {
26
+ console.log("item onclick ", props.data);
27
+ };
28
+ props.onAction.register("onFocus", onFocus);
29
+ props.onAction.register("onBlur", onBlur);
30
+ props.onAction.register("onClick", onClick);
31
+ </script>
32
+
33
+ <template>
34
+ <div
35
+ :style="{
36
+ width: data.width,
37
+ height: data.height,
38
+ fontSize: 30,
39
+ color: focused ? '#FF0000' : '#FFFFFF',
40
+ backgroundColor: data.color,
41
+ }"
42
+ >
43
+ {{ data.content }}
44
+ </div>
45
+ </template>
@@ -0,0 +1,110 @@
1
+ <!--
2
+ * @Author: ChenChanghua
3
+ * @Date: 2023-03-08 14:52:08
4
+ * @Description: file content
5
+ -->
6
+ <script setup>
7
+ import { MetroWidget, HORIZONTAL, useFocusHub, EdgeDirection } from "jsview";
8
+ import ControlItem from "./ControlItem.vue";
9
+ import { ref } from "vue";
10
+
11
+ const widget = ref();
12
+ const props = defineProps({
13
+ number: Number,
14
+ widgetHandler: Object,
15
+ });
16
+
17
+ const focusHub = useFocusHub();
18
+
19
+ const randomColor = () => {
20
+ let randomColor = Math.round(Math.random() * 2 ** 24).toString(16);
21
+ return (
22
+ "#" + new Array(6 - randomColor.length).fill("0").join("") + randomColor
23
+ );
24
+ };
25
+
26
+ const provideData = () => {
27
+ const data = [];
28
+ const c = Math.ceil(props.number / 10);
29
+ for (let i = 0; i < c; ++i) {
30
+ data.push({
31
+ width: 200,
32
+ height: 50,
33
+ marginRight: 10,
34
+ color: randomColor(),
35
+ content: i * 10 + "-" + Math.min((i + 1) * 10 - 1, props.number -1),
36
+ start: i * 10,
37
+ end: Math.min((i + 1) * 10 - 1, props.number - 1),
38
+ });
39
+ }
40
+ return data;
41
+ };
42
+
43
+ const measures = (data) => {
44
+ return {
45
+ width: data.width,
46
+ height: data.height,
47
+ marginRight: data.marginRight,
48
+ marginBottom: data.marginBottom,
49
+ };
50
+ };
51
+
52
+ // callbacks
53
+ const onEdge = (edgeInfo) => {
54
+ if (edgeInfo.direction == EdgeDirection.top) {
55
+ focusHub.setFocus("mainMw");
56
+ }
57
+ };
58
+
59
+ const onBlur = () => {
60
+ if (!firstLock) {
61
+ props.widgetHandler.widget.value?.setFocusId(targetFocus, false, false);
62
+ }
63
+ firstLock = false;
64
+ };
65
+
66
+ let targetFocus = 0;
67
+ const controlCallback = (data) => {
68
+ if (firstLock) {
69
+ firstLock = false;
70
+ return;
71
+ }
72
+ props.widgetHandler.widget.value?.slideTo(data.start * 100);
73
+ targetFocus = data.start;
74
+ };
75
+
76
+ let firstLock = false;
77
+ const setFocusId = (id) => {
78
+ targetFocus = id;
79
+ firstLock = true;
80
+ widget.value.setEnterFocusId(Math.floor(id / 10));
81
+ };
82
+
83
+ defineExpose({
84
+ setFocusId,
85
+ });
86
+ </script>
87
+
88
+ <template>
89
+ <metro-widget
90
+ ref="widget"
91
+ name="myController"
92
+ :left="50"
93
+ :top="200"
94
+ :width="1000"
95
+ :height="50"
96
+ :provideData="provideData"
97
+ :direction="HORIZONTAL"
98
+ :measures="measures"
99
+ :onEdge="onEdge"
100
+ :onBlur="onBlur"
101
+ >
102
+ <template #renderItem="{ data, onAction }">
103
+ <control-item
104
+ :data="data"
105
+ :onAction="onAction"
106
+ :controlCallback="controlCallback"
107
+ />
108
+ </template>
109
+ </metro-widget>
110
+ </template>
@@ -0,0 +1,43 @@
1
+ <!--
2
+ * @Author: ChenChanghua
3
+ * @Date: 2023-03-08 14:52:17
4
+ * @Description: file content
5
+ -->
6
+ <script setup>
7
+ import { ref } from "vue";
8
+
9
+ const props = defineProps({
10
+ data: Object,
11
+ onAction: Object,
12
+ });
13
+
14
+ const focused = ref(false);
15
+
16
+ // 注册回调
17
+ const onFocus = () => {
18
+ focused.value = true;
19
+ };
20
+ const onBlur = () => {
21
+ focused.value = false;
22
+ };
23
+ const onClick = () => {
24
+ console.log("item onclick ", props.data);
25
+ };
26
+ props.onAction.register("onFocus", onFocus);
27
+ props.onAction.register("onBlur", onBlur);
28
+ props.onAction.register("onClick", onClick);
29
+ </script>
30
+
31
+ <template>
32
+ <div
33
+ :style="{
34
+ width: data.width,
35
+ height: data.height,
36
+ fontSize: 30,
37
+ color: focused ? '#FF0000' : '#FFFFFF',
38
+ backgroundColor: data.color,
39
+ }"
40
+ >
41
+ {{ data.content }}
42
+ </div>
43
+ </template>
@@ -86,4 +86,16 @@ export default [
86
86
  component: () =>
87
87
  import("jsview-vue-samples/MetroWidgetDemos/RefreshDemo/App.vue"),
88
88
  },
89
+ {
90
+ name: "剧集翻页",
91
+ path: "/metroWidget/SeamlessSlide",
92
+ component: () =>
93
+ import("jsview-vue-samples/MetroWidgetDemos/SeamlessSlide/App.vue"),
94
+ },
95
+ {
96
+ name: "多item分段显示",
97
+ path: "/metroWidget/MassiveItems",
98
+ component: () =>
99
+ import("jsview-vue-samples/MetroWidgetDemos/MassiveItems/App.vue"),
100
+ },
89
101
  ]
@@ -17,8 +17,8 @@
17
17
  ></JsvSceneTransition>
18
18
  </div>
19
19
  <!-- 文字说明 -->
20
- <div class="text" :style="{ left: 20, top: 20 }">
21
- {{ "操作说明:按【OK】键进行随机遮罩层碎片过渡效果。" }}
20
+ <div class="textLong" :style="{ left: 20, top: 20 }">
21
+ {{ "操作说明:按【下】键进行随机碎片下落过渡效果。按【上】键进行过渡还原。" }}
22
22
  </div>
23
23
  <div class="text" :style="{ left: 810, top: 20 }">{{ "素材展示" }}</div>
24
24
  <div class="text" :style="{ left: 400, top: 500 }">
@@ -165,6 +165,14 @@ onBeforeUnmount(() => {
165
165
  line-height: 26;
166
166
  font-size: 24;
167
167
  }
168
+ .textLong {
169
+ width: 560;
170
+ height: 80;
171
+ color: #ffffff;
172
+ font-weight: bold;
173
+ line-height: 26;
174
+ font-size: 24;
175
+ }
168
176
  .bgStyle {
169
177
  width: 1280;
170
178
  height: 720;
@@ -0,0 +1,160 @@
1
+ <template>
2
+ <jsv-focus-block autoFocus :onKeyDown="procKeyDown">
3
+ <div class="bgSty">
4
+ <!-- 提示 -->
5
+ <div class="text" :style="{ left: 210, top: 20 }">
6
+ {{
7
+ "操作提示:\n触控进行左右拖拽\n点击进度条空白处游标直接跳过去\n按 返回 键退出"
8
+ }}
9
+ </div>
10
+ <div
11
+ class="logo-bg"
12
+ :style="{
13
+ left: 210,
14
+ top: 200,
15
+ }"
16
+ >
17
+ <!-- 三个背景色块 -->
18
+ <div class="bg1" />
19
+ <div class="bg2" />
20
+ <div class="bg3" />
21
+ <!-- 进度条 -->
22
+ <div :style="{ top: 80, left: 0 }">
23
+ <JsvScrollBox
24
+ ref="rJsvScrollBox"
25
+ :style="{
26
+ width: 800,
27
+ height: 84,
28
+ }"
29
+ :direction="HORIZONTAL"
30
+ :sliderSize="{
31
+ width: 84,
32
+ }"
33
+ >
34
+ <template #FixedBox="{ boxWidth, boxHeight }">
35
+ <div
36
+ :style="{
37
+ width: boxWidth,
38
+ height: boxHeight,
39
+ lineHeight: boxHeight,
40
+ backgroundColor: 'rgba(255,255,255,0.3)',
41
+ borderRadius: Math.floor(boxHeight / 2),
42
+ fontSize: Math.floor(boxHeight * 0.5),
43
+ textAlign: 'center',
44
+ color: 'rgba(0,0,0,1)',
45
+ }"
46
+ >
47
+ {{ `进度:${rPercentDisp}` }}
48
+ </div>
49
+ </template>
50
+ <template #SliderBox="{ boxWidth, boxHeight }">
51
+ <div
52
+ :style="{
53
+ top: -15,
54
+ left: -15,
55
+ width: boxWidth + 30,
56
+ height: boxHeight + 30,
57
+ backgroundColor: 'rgba(255, 0,0,0.8)',
58
+ borderRadius: Math.floor((boxHeight + 30) / 2),
59
+ }"
60
+ @click="fncOnClick"
61
+ />
62
+ </template>
63
+ </JsvScrollBox>
64
+ </div>
65
+ <!-- 图1说明 -->
66
+ <div :style="{ left: 0, top: 26 }" class="text">
67
+ {{ "pin模式下拖拽(拖动点尺寸略大于进度条)" }}
68
+ </div>
69
+ </div>
70
+ </div>
71
+ </jsv-focus-block>
72
+ </template>
73
+
74
+ <script setup>
75
+ import { shallowRef, onMounted } from "vue";
76
+ import { JsvScrollBox, HORIZONTAL } from "jsview";
77
+
78
+ //进度百分比
79
+ let myProgress = shallowRef(20);
80
+ //按键事件 控制进度条的width
81
+ const procKeyDown = (ev) => {
82
+ switch (ev.keyCode) {
83
+ case 37:
84
+ myProgress.value -= 5;
85
+ if (myProgress.value <= 0) {
86
+ myProgress.value = 0;
87
+ }
88
+ break;
89
+ case 39:
90
+ myProgress.value += 5;
91
+ if (myProgress.value >= 100) {
92
+ myProgress.value = 100;
93
+ }
94
+ break;
95
+ case 13:
96
+ myProgress.value = 0;
97
+ break;
98
+ default:
99
+ break;
100
+ }
101
+ };
102
+
103
+ let fncOnClick = () => {};
104
+
105
+ let rJsvScrollBox = shallowRef(null);
106
+ let rPercentDisp = shallowRef(0);
107
+
108
+ onMounted(() => {
109
+ rJsvScrollBox.value.setSensor((percent, x, y) => {
110
+ rPercentDisp.value = Math.floor(percent * 100) / 100;
111
+ console.log(
112
+ `onProgress dragged percent=${percent} \
113
+ x=${Math.floor(x)} \
114
+ y=${Math.floor(y)}`
115
+ );
116
+ }, 15);
117
+ });
118
+ </script>
119
+
120
+ <style scoped>
121
+ .bgSty {
122
+ background-color: #5490d1;
123
+ width: 1280;
124
+ height: 720;
125
+ }
126
+ .logo-bg {
127
+ width: 800;
128
+ height: 400;
129
+ }
130
+ .text {
131
+ width: 800;
132
+ height: 200;
133
+ font-size: 24;
134
+ font-weight: bold;
135
+ line-height: 32;
136
+ color: #ffffff;
137
+ text-align: center;
138
+ }
139
+ .bg1 {
140
+ left: 0;
141
+ top: 0;
142
+ height: 400;
143
+ width: 267;
144
+ background-color: #007f00;
145
+ }
146
+ .bg2 {
147
+ left: 267;
148
+ top: 0;
149
+ height: 400;
150
+ width: 267;
151
+ background-color: #3049b8;
152
+ }
153
+ .bg3 {
154
+ left: 534;
155
+ top: 0;
156
+ height: 400;
157
+ width: 266;
158
+ background-color: #d12b8c;
159
+ }
160
+ </style>