@shijiu/jsview-vue-samples 2.1.25 → 2.1.200

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 (62) hide show
  1. package/Basic/components/div/DivBackground.vue +53 -24
  2. package/BreakRender/App.vue +69 -0
  3. package/BreakRender/Item.vue +77 -0
  4. package/BreakRender/assets/imageList.json +237 -0
  5. package/BreakRender/data.js +18 -0
  6. package/ClassDynamicSwitching/App.vue +83 -0
  7. package/ClassDynamicSwitching/components/ClassItem.vue +257 -0
  8. package/ClassDynamicSwitching/components/ClassShow.vue +78 -0
  9. package/ClassDynamicSwitching/components/StyleItem.vue +165 -0
  10. package/ClassDynamicSwitching/components/StyleShow.vue +68 -0
  11. package/DemoHomepage/router.js +67 -13
  12. package/DemoHomepage/views/Homepage.vue +13 -2
  13. package/DynamicClass/App.vue +115 -0
  14. package/DynamicClass/components/FloorItem.vue +55 -0
  15. package/DynamicClass/components/FloorList.vue +210 -0
  16. package/DynamicClass/style1.json +163 -0
  17. package/DynamicClass/style2.json +164 -0
  18. package/FilterDemo/App.vue +1 -1
  19. package/FocusMoveStyle/App.vue +10 -2
  20. package/FreeMove/App.vue +291 -0
  21. package/GetBoundingClientRect/App.vue +177 -0
  22. package/GiftRain/App.vue +3 -3
  23. package/JsvLine/App.vue +116 -0
  24. package/JsvLine/bgimage.jpg +0 -0
  25. package/JsvPreDownloader/App.vue +17 -10
  26. package/LatexDemo/App.vue +66 -0
  27. package/LatexFormula/App.vue +65 -0
  28. package/Marquee/App.vue +711 -183
  29. package/MetroWidgetDemos/PingPong/App.vue +0 -9
  30. package/MetroWidgetDemos/PingPong/AppPage.vue +2 -1
  31. package/MetroWidgetDemos/PingPong/WidgetItem.vue +0 -5
  32. package/MetroWidgetDemos/SkeletonDiagram/App.vue +3 -1
  33. package/MetroWidgetDemos/SkeletonDiagram/Item.vue +5 -0
  34. package/MetroWidgetDemos/itemSizeUpdate/App.vue +11 -4
  35. package/MetroWidgetDemos/itemSizeUpdate/backward/Backward.vue +6 -4
  36. package/MetroWidgetDemos/itemSizeUpdate/backward/Item.vue +2 -25
  37. package/MetroWidgetDemos/itemSizeUpdate/center/Center.vue +6 -6
  38. package/MetroWidgetDemos/itemSizeUpdate/center/Item.vue +38 -49
  39. package/MetroWidgetDemos/itemSizeUpdate/stretch/App.vue +122 -0
  40. package/MetroWidgetDemos/itemSizeUpdate/stretch/Item.vue +105 -0
  41. package/MindMap/App.vue +61 -0
  42. package/MindMap/Item.vue +40 -0
  43. package/MindMap/data.js +86 -0
  44. package/Preload/App.vue +25 -18
  45. package/Preload/Item.vue +1 -1
  46. package/Preload/data.js +12 -12
  47. package/Preload/images/bg_btn.png +0 -0
  48. package/Preload/images/bg_btn_focus.png +0 -0
  49. package/Preload/images/btn_cancle.png +0 -0
  50. package/Preload/images/btn_ok.png +0 -0
  51. package/Preload/images/tease.png +0 -0
  52. package/Preload/images/tease_lock.png +0 -0
  53. package/SecTorTest/App.vue +106 -0
  54. package/TextureStoreTest/App.vue +168 -0
  55. package/VisibleSensorDemo/App.vue +38 -18
  56. package/package.json +1 -1
  57. package/Preload/images/rank.png +0 -0
  58. package/Preload/images/rank_focus.png +0 -0
  59. package/Preload/images/rule.png +0 -0
  60. package/Preload/images/rule_focus.png +0 -0
  61. package/Preload/images/start.png +0 -0
  62. package/Preload/images/start_focus.png +0 -0
@@ -1,5 +1,5 @@
1
1
  <script setup>
2
- import { computed, shallowRef, onActivated } from "vue";
2
+ import { computed, shallowRef, onActivated, onDeactivated } from "vue";
3
3
  import { jJsvRuntimeBridge, EdgeDirection, useFocusHub } from "jsview";
4
4
  import { useRouter } from "vue-router";
5
5
  import TabFrame from "../components/TabFrame.vue";
@@ -119,10 +119,21 @@ let onDialogAction = (msg) => {
119
119
  }
120
120
  };
121
121
 
122
+ // focusHub.enableFocusTrace(true);
123
+
122
124
  // keep-alive后 router 返回本页面时要激活一下focus
125
+ let focusNameOfDeactive = null;
123
126
  onActivated(() => {
124
- onFocus();
127
+ if (focusNameOfDeactive) {
128
+ focusHub.setFocus(focusNameOfDeactive);
129
+ focusNameOfDeactive = null;
130
+ }
125
131
  });
132
+
133
+ onDeactivated(() => {
134
+ focusNameOfDeactive = focusHub.getDeactivedPageFocus();
135
+ });
136
+
126
137
  </script>
127
138
 
128
139
  <template>
@@ -0,0 +1,115 @@
1
+ <template>
2
+ <div class="direction">
3
+ {{
4
+ "操作指南:按 [1] 切换json文件,按 [2] 删除第二个背景色class。可通过方向键移动。 当前json: " +
5
+ styleText
6
+ }}
7
+ </div>
8
+ <div class="myEffect">{{ "当前效果: " + effectText + " " + deletText }}</div>
9
+ <FloorList name="FloorList" :focusHub="focusHub" :changeStyle="changeStyle" :getStyleClass="getStyleClass"
10
+ :deleteStyleClass="deleteStyleClass" :changeDeletText="changeDeletText" :changeCount="changeCount" :key="count">
11
+ </FloorList>
12
+ </template>
13
+
14
+ <script setup>
15
+ import { shallowRef, provide, reactive, onBeforeUnmount } from "vue";
16
+ import { useFocusHub, JsvStyleSheetsDeclarer } from "jsview";
17
+ import FloorList from "./components/FloorList.vue";
18
+ import style1 from "./style1.json";
19
+ import style2 from "./style2.json";
20
+
21
+ let style = shallowRef(style1);
22
+ let styleText = shallowRef("style1.json");
23
+ let deletText = shallowRef("未删除第二个class背景色");
24
+ let effectArray = [
25
+ "整体字体更大,标题颜色变化,聚焦颜色:土黄色以及绿色。",
26
+ "整体文字变小,标题颜色变化,聚焦颜色:粉色以及荧光绿色。",
27
+ ];
28
+ let sureDelete = shallowRef(false)
29
+ provide('sureDelete', sureDelete)
30
+ let effectText = shallowRef(effectArray[0]);
31
+ const focusHub = useFocusHub();
32
+ let count = shallowRef(0)
33
+ const changeCount = () => {
34
+ count.value += 1;
35
+ };
36
+
37
+ const changeStyle = () => {
38
+ style.value = style.value == style1 ? style2 : style1;
39
+ styleText.value = style.value == style1 ? "style1.json" : "style2.json";
40
+ effectText.value = style.value == style1 ? effectArray[0] : effectArray[1];
41
+ };
42
+ const changeDeletText = () => {
43
+ console.log('sureDelete.value', sureDelete.value);
44
+ if (sureDelete.value == true) {
45
+ deletText.value = "已删除第二个class背景色";
46
+ } else {
47
+ deletText.value = "未删除第二个class背景色";
48
+ }
49
+ };
50
+ const getStyleClass = () => {
51
+ for (let className in style.value) {
52
+ const styleProperties = style.value[className];
53
+ JsvStyleSheetsDeclarer.DeclareClass(className, styleProperties);
54
+ }
55
+ };
56
+ getStyleClass();
57
+
58
+ const deleteStyleClass = () => {
59
+ for (let className in style.value) {
60
+ JsvStyleSheetsDeclarer.UndeclareClass(`${className}`);
61
+ }
62
+ };
63
+
64
+ let data1 = reactive([]);
65
+ let data2 = reactive([]);
66
+ let data3 = reactive([]);
67
+ const dataShow = (dataNum, data, length) => {
68
+ dataNum.splice(0, dataNum.length);
69
+ for (let i = 0; i < length; i++) {
70
+ const item = {
71
+ index: i,
72
+ ...data,
73
+ title: `我是标题${i}`,
74
+ text: `我是跑马灯简介我是跑马灯简介我是跑马灯简介${i}`,
75
+ };
76
+ dataNum.push(item);
77
+ }
78
+ };
79
+ dataShow(data1, style.value.floor1Metro.data, 5);
80
+ dataShow(data2, style.value.floor2Metro.data, 2);
81
+ dataShow(data3, style.value.floor3Metro.data, 8);
82
+
83
+ provide("data1", data1);
84
+ provide("data2", data2);
85
+ provide("data3", data3);
86
+ provide("style", style);
87
+ focusHub.enableFocusTrace(true)
88
+ onBeforeUnmount(() => {
89
+ deleteStyleClass();
90
+ });
91
+ </script>
92
+
93
+ <style lang="scss" scoped>
94
+ .direction {
95
+ top: 10;
96
+ left: 0;
97
+ width: 1280;
98
+ height: 36;
99
+ font-size: 26;
100
+ line-height: 36;
101
+ z-index: 999;
102
+ color: #0000ff;
103
+ }
104
+
105
+ .myEffect {
106
+ top: 50;
107
+ left: 0;
108
+ width: 1280;
109
+ height: 30;
110
+ line-height: 30;
111
+ font-size: 26;
112
+ z-index: 999;
113
+ color: #ff0000;
114
+ }
115
+ </style>
@@ -0,0 +1,55 @@
1
+ <template>
2
+ <div :class="[changePoster,changeBg,changeSize]">
3
+ <!-- 主标题 -->
4
+ <div :class="changeTitle">
5
+ {{ props.data.title }}
6
+ </div>
7
+ <!-- 简介 -->
8
+ <JsvMarquee
9
+ :style="props.data.marqueeData"
10
+ :text="props.data.text"
11
+ :slideSpeed="100"
12
+ :forceSlide="true"
13
+ />
14
+ </div>
15
+ </template>
16
+
17
+ <script setup>
18
+ import { shallowRef,onMounted } from "vue";
19
+ import { JsvMarquee,useFocusHub} from "jsview"
20
+ const props = defineProps({
21
+ data: Object,
22
+ query: Object,
23
+ onEdge: Function,
24
+ onAction: Object,
25
+ getStyleClass: Function,
26
+ num: Number,
27
+ });
28
+ const focusHub = useFocusHub();
29
+ let changeBg = shallowRef('')
30
+ let changeSize=shallowRef('')
31
+ let changePoster = shallowRef('')
32
+ let changeTitle =shallowRef('')
33
+
34
+
35
+ changePoster.value = `poster${props.num}`
36
+ changeTitle.value = `title${props.num}`
37
+ const onFocus = () => {
38
+ changeBg.value =`focusBg${props.num}`
39
+ changeSize.value='grow'
40
+ };
41
+
42
+ const onBlur = () => {
43
+ changeBg.value =`blurBg1${props.num}`
44
+ changeSize.value = ""
45
+ };
46
+
47
+ props.onAction.register("onFocus", onFocus);
48
+ props.onAction.register("onBlur", onBlur);
49
+ props.onAction.register("onEdge", props.onEdge);
50
+ onMounted(()=>{
51
+ focusHub.setFocus('floor1')
52
+ })
53
+ </script>
54
+
55
+ <style lang="scss" scoped></style>
@@ -0,0 +1,210 @@
1
+ <template>
2
+ <jsv-focus-block autoFocus :onAction="actionDefines">
3
+ <div :class="[bg, bg1]">
4
+ <metro-widget
5
+ name="floor"
6
+ :width="style.bg.width"
7
+ :height="style.bg.height"
8
+ :data="data"
9
+ :direction="VERTICAL"
10
+ :measures="measures"
11
+ :onEdge="onEdge1"
12
+ :sendFocusRectEvent="true"
13
+ :slideSetting="slideSetting"
14
+ :on-focus="onFocus"
15
+ layout-type="absolute"
16
+ >
17
+ <template #renderItem="{ data, query, onEdge, onAction }">
18
+ <!-- 楼层1 -->
19
+ <div :class="floor1Bg">
20
+ <metro-widget
21
+ name="floor1"
22
+ :width="style.floor1Metro.width"
23
+ :height="style.floor1Metro.height + 20"
24
+ :data="data1"
25
+ :direction="HORIZONTAL"
26
+ :measures="measures"
27
+ :onEdge="onEdge1"
28
+ :padding="style.floor1Metro.padding"
29
+ :sendFocusRectEvent="true"
30
+ >
31
+ <template #renderItem="{ data, query, onEdge, onAction }">
32
+ <FloorItem
33
+ :data="data"
34
+ :query="query"
35
+ :onEdge="onEdge"
36
+ :onAction="onAction"
37
+ :num="1"
38
+ />
39
+ </template>
40
+ </metro-widget>
41
+ </div>
42
+ <!-- 楼层2 -->
43
+ <div :class="floor2Bg">
44
+ <metro-widget
45
+ name="floor2"
46
+ :width="style.floor2Metro.width"
47
+ :height="style.floor2Metro.height + 20"
48
+ :data="data2"
49
+ :direction="HORIZONTAL"
50
+ :measures="measures"
51
+ :onEdge="onEdge2"
52
+ :padding="style.floor2Metro.padding"
53
+ :sendFocusRectEvent="true"
54
+ >
55
+ <template #renderItem="{ data, query, onEdge, onAction }">
56
+ <FloorItem
57
+ :data="data"
58
+ :query="query"
59
+ :onEdge="onEdge"
60
+ :onAction="onAction"
61
+ :num="2"
62
+ />
63
+ </template>
64
+ </metro-widget>
65
+ </div>
66
+ <!-- 楼层3 -->
67
+ <div :class="floor3Bg">
68
+ <metro-widget
69
+ name="floor3"
70
+ :width="style.floor3Metro.width"
71
+ :height="style.floor3Metro.height + 20"
72
+ :data="data3"
73
+ :direction="HORIZONTAL"
74
+ :measures="measures1"
75
+ :onEdge="onEdge3"
76
+ :padding="style.floor3Metro.padding"
77
+ :sendFocusRectEvent="true"
78
+ >
79
+ <template #renderItem="{ data, query, onEdge, onAction }">
80
+ <FloorItem
81
+ :data="data"
82
+ :query="query"
83
+ :onEdge="onEdge"
84
+ :onAction="onAction"
85
+ :num="3"
86
+ />
87
+ </template>
88
+ </metro-widget>
89
+ </div>
90
+ </template>
91
+ </metro-widget>
92
+ </div>
93
+ </jsv-focus-block>
94
+ </template>
95
+ <script setup>
96
+ /* eslint-disable */
97
+ import {
98
+ MetroWidget,
99
+ VERTICAL,
100
+ HORIZONTAL,
101
+ EdgeDirection,
102
+ METRO_WIDGET_CONST,
103
+ SeamlessSlide,
104
+ } from "jsview";
105
+ import {
106
+ onMounted,
107
+ ref,
108
+ inject,
109
+ } from "vue";
110
+ import FloorItem from "./FloorItem.vue";
111
+
112
+ const props = defineProps({
113
+ changeCount: Function,
114
+ focusHub: Object,
115
+ changeStyle: Function,
116
+ getStyleClass: Function,
117
+ deleteStyleClass: Function,
118
+ changeDeletText: Function,
119
+ });
120
+ const slideSetting = new SeamlessSlide({ startPercent: 0.2, endPercent: 0.8 });
121
+
122
+ let bg = ref("");
123
+ let bg1 = ref("");
124
+ let floor1Bg = ref("");
125
+ let floor2Bg = ref("");
126
+ let floor3Bg = ref("");
127
+ let style = inject("style");
128
+ let sureDelete = inject("sureDelete");
129
+ const data = [
130
+ {
131
+ width: 1280,
132
+ height: 1350,
133
+ top: 0,
134
+ left: 0,
135
+ },
136
+ ];
137
+ let data1 = inject("data1");
138
+ let data2 = inject("data2");
139
+ let data3 = inject("data3");
140
+
141
+ const measures = (item) => {
142
+ return {
143
+ ...item,
144
+ focusable: true,
145
+ itemSlide: METRO_WIDGET_CONST.ITEM_SLIDE.ACT_FOCUS_RECT_EVENT,
146
+ };
147
+ };
148
+ const measures1 = (item) => {
149
+ return {
150
+ ...item,
151
+ focusable: true,
152
+ itemSlide: METRO_WIDGET_CONST.ITEM_SLIDE.ACT_ITEM_FOCUS,
153
+ };
154
+ };
155
+
156
+ const onEdge1 = (edgeInfo) => {
157
+ if (edgeInfo.direction == EdgeDirection.bottom) {
158
+ props.focusHub.setFocus("floor2");
159
+ }
160
+ };
161
+ const onEdge2 = (edgeInfo) => {
162
+ if (edgeInfo.direction == EdgeDirection.bottom) {
163
+ props.focusHub.setFocus("floor3");
164
+ } else if (edgeInfo.direction == EdgeDirection.top) {
165
+ props.focusHub.setFocus("floor1");
166
+ }
167
+ };
168
+
169
+ const onEdge3 = (edgeInfo) => {
170
+ if (edgeInfo.direction == EdgeDirection.top) {
171
+ props.focusHub.setFocus("floor2");
172
+ }
173
+ };
174
+
175
+ const onKeyDown = (ev) => {
176
+ switch (ev.keyCode) {
177
+ case 49:
178
+ sureDelete.value = false;
179
+ props.changeDeletText();
180
+ props.changeStyle();
181
+ props.getStyleClass();
182
+ props.changeCount();
183
+ break;
184
+ case 50:
185
+ bg1.value = "";
186
+ sureDelete.value = true;
187
+ props.changeDeletText();
188
+ break;
189
+ default:
190
+ break;
191
+ }
192
+ };
193
+ const actionDefines = {
194
+ onKeyDown,
195
+ };
196
+ const onFocus = () => {
197
+ props.focusHub.setFocus("floor1");
198
+ };
199
+
200
+ bg.value = "bg";
201
+ floor1Bg.value = "floor1-bg";
202
+ floor2Bg.value = "floor2-bg";
203
+ floor3Bg.value = "floor3-bg";
204
+ bg1.value = "bg1";
205
+
206
+ onMounted(() => {
207
+ props.focusHub.setFocus("floor1");
208
+ });
209
+ </script>
210
+ <style></style>
@@ -0,0 +1,163 @@
1
+ {
2
+ "bg": {
3
+ "width": 1280,
4
+ "height": 720,
5
+ "top": 0,
6
+ "left": 0,
7
+ "backgroundColor": "#000000"
8
+ },
9
+ "bg1": {
10
+ "width": 1280,
11
+ "height": 720,
12
+ "top": 0,
13
+ "left": 0,
14
+ "backgroundColor": "#FFFFAA"
15
+ },
16
+ "floor1-bg": {
17
+ "width": 1280,
18
+ "height": 300,
19
+ "top": 100,
20
+ "left": 0,
21
+ "fontSize": 28,
22
+ "lineHeight": 30,
23
+ "color": "#FF2312"
24
+ },
25
+ "floor1Metro": {
26
+ "width": 1280,
27
+ "height": 300,
28
+ "top": 0,
29
+ "left": 0,
30
+ "padding": { "left": 28 },
31
+ "data": {
32
+ "width": 200,
33
+ "height": 300,
34
+ "marginRight": 56,
35
+ "marqueeData": {
36
+ "width": 200,
37
+ "height": 30,
38
+ "fontSize": 22,
39
+ "lineHeight": 30,
40
+ "direction": "ltr",
41
+ "top": 270
42
+ }
43
+ }
44
+ },
45
+ "poster1": {
46
+ "width": 200,
47
+ "height": 300,
48
+ "backgroundColor": "#BBBBAA",
49
+ "textAlign": "center"
50
+ },
51
+ "title1": {
52
+ "width": 200,
53
+ "height": 30,
54
+ "left": 0,
55
+ "top": 240,
56
+ "backgroundColor": "#FFFFFF"
57
+ },
58
+ "focusBg1": {
59
+ "backgroundColor": "#DD8800"
60
+ },
61
+ "blurBg1": {
62
+ "backgroundColor": "#BBBBAA"
63
+ },
64
+ "floor2-bg": {
65
+ "width": 1280,
66
+ "height": 400,
67
+ "top": 500,
68
+ "left": 0,
69
+ "fontSize": 48,
70
+ "lineHeight": 50,
71
+ "color": "#FFFFFF"
72
+ },
73
+ "floor2Metro": {
74
+ "width": 1280,
75
+ "height": 400,
76
+ "top": 0,
77
+ "left": 0,
78
+ "padding": { "left": 0 },
79
+ "data": {
80
+ "width": 620,
81
+ "height": 400,
82
+ "marginRight": 40,
83
+ "marqueeData": {
84
+ "width": 620,
85
+ "height": 40,
86
+ "fontSize": 38,
87
+ "lineHeight": 40,
88
+ "direction": "ltr",
89
+ "top": 360
90
+ }
91
+ }
92
+ },
93
+ "poster2": {
94
+ "width": 620,
95
+ "height": 400,
96
+ "backgroundColor": "#BBAAAA",
97
+ "textAlign": "center"
98
+ },
99
+ "title2": {
100
+ "width": 620,
101
+ "height": 50,
102
+ "left": 0,
103
+ "top": 310,
104
+ "backgroundColor": "#FFF221"
105
+ },
106
+ "focusBg2": {
107
+ "backgroundColor": "#00FF00"
108
+ },
109
+ "blurBg2": {
110
+ "backgroundColor": "#BBAAAA"
111
+ },
112
+ "floor3-bg": {
113
+ "width": 1280,
114
+ "height": 300,
115
+ "top": 980,
116
+ "left": 0,
117
+ "fontSize": 28,
118
+ "lineHeight": 30,
119
+ "color": "#FDD312"
120
+ },
121
+ "floor3Metro": {
122
+ "width": 1280,
123
+ "height": 300,
124
+ "top": 0,
125
+ "left": 0,
126
+ "padding": { "left": 5 },
127
+ "data": {
128
+ "width": 150,
129
+ "height": 300,
130
+ "marginRight": 30,
131
+ "marqueeData": {
132
+ "width": 150,
133
+ "height": 30,
134
+ "fontSize": 22,
135
+ "lineHeight": 30,
136
+ "direction": "ltr",
137
+ "top": 270
138
+ }
139
+ }
140
+ },
141
+ "poster3": {
142
+ "width": 150,
143
+ "height": 300,
144
+ "backgroundColor": "#BBBBBB",
145
+ "textAlign": "center"
146
+ },
147
+ "title3": {
148
+ "width": 150,
149
+ "height": 30,
150
+ "left": 0,
151
+ "top": 240,
152
+ "backgroundColor": "#FFFFFF"
153
+ },
154
+ "focusBg3": {
155
+ "backgroundColor": "#DD8800"
156
+ },
157
+ "blurBg3": {
158
+ "backgroundColor": "#BBBBBB"
159
+ },
160
+ "grow": {
161
+ "transform": "scale3d(1,1.1,1)"
162
+ }
163
+ }