@shijiu/jsview-vue 2.0.1021 → 2.0.1073

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 (33) hide show
  1. package/package.json +4 -3
  2. package/utils/JsViewEngineWidget/CheckType.js +82 -0
  3. package/utils/JsViewEngineWidget/MetroWidget/AnimationManager.ts +72 -0
  4. package/utils/JsViewEngineWidget/MetroWidget/Const.ts +24 -0
  5. package/utils/JsViewEngineWidget/MetroWidget/ListWidget.vue +295 -0
  6. package/utils/JsViewEngineWidget/MetroWidget/MetroWidget.vue +110 -1651
  7. package/utils/JsViewEngineWidget/MetroWidget/MetroWidgetSetup.js +1867 -0
  8. package/utils/JsViewEngineWidget/MetroWidget/PageUpdater.ts +111 -0
  9. package/utils/JsViewEngineWidget/MetroWidget/RenderItem.ts +153 -0
  10. package/utils/JsViewEngineWidget/MetroWidget/VisibleInfo.ts +43 -0
  11. package/utils/JsViewEngineWidget/MetroWidget/WidgetRectInfo.ts +49 -0
  12. package/utils/JsViewEngineWidget/TemplateParser/CommonMetroTemplate.ts +1424 -0
  13. package/utils/JsViewEngineWidget/TemplateParser/Fence.ts +135 -0
  14. package/utils/JsViewEngineWidget/TemplateParser/ListMetroTemplate.ts +177 -0
  15. package/utils/JsViewEngineWidget/TemplateParser/MetroTemplate.ts +334 -0
  16. package/utils/JsViewEngineWidget/TemplateParser/TemplateItemAdder.ts +147 -0
  17. package/utils/JsViewEngineWidget/TemplateParser/index.ts +4 -0
  18. package/utils/JsViewEngineWidget/{WidgetCommon.js → WidgetCommon.ts} +64 -71
  19. package/utils/JsViewEngineWidget/index.js +2 -1
  20. package/utils/JsViewPlugin/JsvAudio/AudioProxy.js +26 -1
  21. package/utils/JsViewPlugin/JsvAudio/JsvAudio.vue +120 -133
  22. package/utils/JsViewPlugin/JsvAudio/JsvAudioBrowser.vue +11 -7
  23. package/utils/JsViewPlugin/JsvPlayer/GetVersion.js +1 -1
  24. package/utils/JsViewPlugin/JsvPlayer/JsvPlayerBrowser.vue +379 -41
  25. package/utils/JsViewPlugin/JsvPlayer/version.mjs +5 -5
  26. package/utils/JsViewVueTools/JsvHashHistory.js +2 -1
  27. package/utils/JsViewVueWidget/JsvRadarChart.vue +220 -0
  28. package/utils/JsViewVueWidget/JsvSystemAudio.vue +76 -44
  29. package/utils/JsViewVueWidget/index.js +1 -0
  30. package/utils/JsViewEngineWidget/MetroWidget/Const.js +0 -11
  31. package/utils/JsViewEngineWidget/MetroWidget/PageUpdater.js +0 -136
  32. package/utils/JsViewEngineWidget/MetroWidget/ToolFunctions.js +0 -18
  33. package/utils/JsViewEngineWidget/TemplateParser.js +0 -2004
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shijiu/jsview-vue",
3
- "version": "2.0.1021",
3
+ "version": "2.0.1073",
4
4
  "license": "MIT",
5
5
  "repository": "system/jsview-framework",
6
6
  "author": "mengxk",
@@ -11,10 +11,11 @@
11
11
  "jsview-vue"
12
12
  ],
13
13
  "dependencies": {
14
- "qr.js": "0.0.0",
14
+ "qr.js": "0.0.0"
15
+ },
16
+ "devDependencies": {
15
17
  "vite-plugin-full-reload": "1.0.5"
16
18
  },
17
- "devDependencies": {},
18
19
  "engines": {
19
20
  "node": ">=16.0.0"
20
21
  }
@@ -0,0 +1,82 @@
1
+ /*
2
+ * @Author: ChenChanghua
3
+ * @Date: 2023-02-23 10:40:16
4
+ * @Description: file content
5
+ */
6
+
7
+ const isArray = Array.isArray;
8
+ const isMap = (val) => Object.prototype.toString.call(val) === '[object Map]';
9
+ const isSet = (val) => Object.prototype.toString.call(val) === '[object Set]';
10
+ const isDate = (val) => Object.prototype.toString.call(val) === '[object Date]';
11
+ const isFunction = (val) => typeof val === 'function';
12
+ const isString = (val) => typeof val === 'string';
13
+ const isSymbol = (val) => typeof val === 'symbol';
14
+ const isObject = (val) => val !== null && typeof val === 'object';
15
+
16
+ function getTypeName(ctor) {
17
+ const match = ctor && ctor.toString().match(/^\s*function (\w+)/);
18
+ return match ? match[1] : ctor === null ? 'null' : '';
19
+ }
20
+
21
+ const objectToString = Object.prototype.toString;
22
+
23
+ const toTypeString = (value) => objectToString.call(value);
24
+
25
+ const toRawType = (value) => {
26
+ // extract "RawType" from strings like "[object RawType]"
27
+ return toTypeString(value).slice(8, -1);
28
+ };
29
+
30
+ function makeMap(str, expectsLowerCase) {
31
+ const map = Object.create(null);
32
+ const list = str.split(',');
33
+ for (let i = 0; i < list.length; i++) {
34
+ map[list[i]] = true;
35
+ }
36
+ return expectsLowerCase ? val => !!map[val.toLowerCase()] : val => !!map[val];
37
+ }
38
+
39
+ const isSimpleType = /*#__PURE__*/ makeMap('String,Number,Boolean,Function,Symbol,BigInt');
40
+
41
+ function checkType(value, type) {
42
+ if (typeof type === "undefined" || type === null) { return true; }
43
+ const check = (v, t) => {
44
+ let valid;
45
+ const expectedType = getTypeName(t);
46
+ if (isSimpleType(expectedType)) {
47
+ const t = typeof v;
48
+ valid = t === expectedType.toLowerCase();
49
+ // for primitive wrapper objects
50
+ if (!valid && t === 'object') {
51
+ valid = v instanceof t;
52
+ }
53
+ }
54
+ else if (expectedType === 'Object') {
55
+ valid = isObject(v);
56
+ }
57
+ else if (expectedType === 'Array') {
58
+ valid = isArray(v);
59
+ }
60
+ else if (expectedType === 'null') {
61
+ valid = v === null;
62
+ }
63
+ else {
64
+ valid = v instanceof t;
65
+ }
66
+ return valid;
67
+ }
68
+ if (toRawType(type) == "Array") {
69
+ //多个类型
70
+ let result = false;
71
+ for (let t of type) {
72
+ if (check(value, t)) {
73
+ return true;
74
+ }
75
+ }
76
+ return false;
77
+ } else {
78
+ return check(value, type);
79
+ }
80
+ }
81
+
82
+ export { checkType, toRawType, getTypeName }
@@ -0,0 +1,72 @@
1
+ import { Forge } from "@shijiu/jsview/dom/jsv-forge-define";
2
+
3
+ export class AnimationManager {
4
+ private animList: Set<AnimationNode> = new Set();
5
+ private frameCount: number = 0;
6
+
7
+ public tryStartAnim(count: number, anim: AnimationNode, index: number) {
8
+ if (count > this.frameCount) {
9
+ for (let a of this.animList) {
10
+ a.stop();
11
+ }
12
+ this.animList.clear();
13
+ this.frameCount = count;
14
+ this.animList.add(anim);
15
+ anim.start();
16
+ } else if (count == this.frameCount) {
17
+ this.animList.add(anim);
18
+ anim.start();
19
+ } else {
20
+ // console.log("anim expired")
21
+ }
22
+ }
23
+ }
24
+
25
+ export class AnimationTools {
26
+ public static getDivSlideAnim(div: any, fromX: number, fromY: number, toX: number, toY: number, animInfo: any): AnimationNode {
27
+ if (animInfo) {
28
+ let duration: number;
29
+ if (typeof animInfo.duration == "number") {
30
+ duration = animInfo.duration;
31
+ } else if (typeof animInfo.speed == "number") {
32
+ const deltaX = Math.abs(fromX - toX);
33
+ const deltaY = Math.abs(fromY - toY);
34
+ duration = Math.round(deltaX === 0 ? deltaY / animInfo.speed : deltaX / animInfo.speed);
35
+ } else {
36
+ throw new Error("animation duration not set.")
37
+ }
38
+
39
+ let slideAnimation = new Forge.TranslateAnimation(
40
+ fromX,
41
+ toX,
42
+ fromY,
43
+ toY,
44
+ duration,
45
+ animInfo.easing
46
+ );
47
+ slideAnimation.SetAnimationListener(
48
+ new Forge.AnimationListener(animInfo.onStart, animInfo.onEnd, null)
49
+ );
50
+ return new AnimationNode(div, slideAnimation);
51
+ } else {
52
+ throw new Error("animInfo is null.")
53
+ }
54
+ }
55
+ }
56
+
57
+ class AnimationNode {
58
+ private mDiv: any;
59
+ private mAnimation: any;
60
+ constructor(div: any, anim: any) {
61
+ this.mDiv = div;
62
+ this.mAnimation = anim;
63
+ }
64
+
65
+ public start() {
66
+ this.mDiv.jsvGetProxyView(true).StartAnimation(this.mAnimation);
67
+ }
68
+
69
+ public stop() {
70
+ this.mDiv.jsvGetProxyView(true).StopAnimation();
71
+ }
72
+ }
@@ -0,0 +1,24 @@
1
+ /*
2
+ * @Author: ChenChanghua
3
+ * @Date: 2022-09-21 10:09:15
4
+ * @LastEditors: ChenChanghua
5
+ * @LastEditTime: 2022-09-21 10:15:34
6
+ * @Description: file content
7
+ */
8
+ const METRO_WIDGET = {
9
+ SLIDE: 0x1,
10
+ CHILD_SLIDE_EVENT: 0x1 << 1,
11
+ ON_KEY_DOWN: 0x1 << 2,
12
+
13
+ //resize locate const
14
+ ITEM_RESIZE: {
15
+ ANCHOR: 1,
16
+ WIDGET_SET: 2,
17
+ CUSTOMER_SET: 3
18
+ }
19
+ };
20
+
21
+ export {
22
+ METRO_WIDGET,
23
+ METRO_WIDGET as METRO_WIDGET_CONST,
24
+ }
@@ -0,0 +1,295 @@
1
+ <!--
2
+ 只显示单列/行的MetroWidget
3
+ -->
4
+ <script setup>
5
+ import { ref, shallowRef, computed } from "vue";
6
+ import { setup, RENDER_ITEM_BREAK_KEY } from "./MetroWidgetSetup";
7
+ import {
8
+ VERTICAL,
9
+ HORIZONTAL,
10
+ SlideSetting,
11
+ SeamlessSlide,
12
+ } from "../WidgetCommon";
13
+
14
+ const props = defineProps({
15
+ padding: {
16
+ type: Object,
17
+ default() {
18
+ return {
19
+ top: 0,
20
+ left: 0,
21
+ right: 0,
22
+ bottom: 0,
23
+ };
24
+ },
25
+ },
26
+ direction: {
27
+ type: Symbol,
28
+ default: HORIZONTAL,
29
+ },
30
+ height: {
31
+ type: Number,
32
+ required: true,
33
+ },
34
+ width: {
35
+ type: Number,
36
+ required: true,
37
+ },
38
+ loopFocus: {
39
+ type: Boolean,
40
+ default: false,
41
+ },
42
+ onEdge: {
43
+ type: Function,
44
+ default: null,
45
+ },
46
+ onFocus: {
47
+ type: Function,
48
+ default: null,
49
+ },
50
+ onBlur: {
51
+ type: Function,
52
+ default: null,
53
+ },
54
+ loadAll: {
55
+ type: Boolean,
56
+ default: false,
57
+ },
58
+ enableTouch: {
59
+ type: Boolean,
60
+ default: false,
61
+ },
62
+ flingPageWidth: {
63
+ type: Number,
64
+ default: -1,
65
+ },
66
+ flingPageEdge: {
67
+ type: Number,
68
+ default: 1 / 4,
69
+ },
70
+ dispatcher: {
71
+ type: Object,
72
+ },
73
+ measures: {
74
+ type: Function,
75
+ required: true,
76
+ },
77
+ initFocusId: {
78
+ type: Number,
79
+ default: 0,
80
+ },
81
+ data: {
82
+ type: Array,
83
+ },
84
+ left: {
85
+ type: Number,
86
+ default: 0,
87
+ },
88
+ top: {
89
+ type: Number,
90
+ default: 0,
91
+ },
92
+ name: {
93
+ type: String,
94
+ },
95
+ supportHistoryPath: {
96
+ type: Boolean,
97
+ default: true,
98
+ },
99
+ itemConfig: {
100
+ type: Function,
101
+ },
102
+ onFocusChange: {
103
+ type: Function,
104
+ },
105
+ slideSetting: {
106
+ type: SlideSetting,
107
+ default() {
108
+ return new SeamlessSlide({ startPercent: 0.2, endPercent: 0.8 });
109
+ },
110
+ },
111
+ layoutType: {
112
+ type: String,
113
+ default: "relative",
114
+ },
115
+ enableItemRenderBreak: {
116
+ type: Boolean,
117
+ default: false,
118
+ },
119
+ provideData: {
120
+ type: Function,
121
+ },
122
+ placeHolderSetting: {
123
+ type: Object,
124
+ default() {
125
+ return {
126
+ backgroundColor: "rgba(255,255,255,0.5)",
127
+ };
128
+ },
129
+ },
130
+ sendFocusRectEvent: {
131
+ type: Boolean,
132
+ default: false,
133
+ },
134
+ keepTraceRange: {
135
+ type: Number,
136
+ default: 0,
137
+ },
138
+ onScroll: {
139
+ type: Function,
140
+ },
141
+ focusMoveType: {
142
+ type: Number,
143
+ default: 0,
144
+ },
145
+ disableClip: {
146
+ type: Boolean,
147
+ default: false,
148
+ },
149
+ });
150
+
151
+ const renderBreakKey = props.enableItemRenderBreak ? RENDER_ITEM_BREAK_KEY : "";
152
+ const touchContainerW = ref(0);
153
+ const touchContainerH = ref(0);
154
+ const itemRender = ref(!props.enableItemRenderBreak);
155
+ const locateDiv = shallowRef(null);
156
+ const renderData = shallowRef([]);
157
+ const slideDiv = shallowRef(null);
158
+ const slideDivLeft = ref(0);
159
+ const slideDivTop = ref(0);
160
+ const itemResizeSlideDiv = shallowRef(null);
161
+ const itemResizeSlideLeft = ref(0);
162
+ const itemResizeSlideTop = ref(0);
163
+ const focusNode = shallowRef(null);
164
+ const pageUpdateToken = ref(0);
165
+
166
+ const {
167
+ widgetRectInfo,
168
+ focusBlockOnFocus,
169
+ focusBlockOnBlur,
170
+ focusBlockOnKeyDown,
171
+ focusBlockOnCustomerEvent,
172
+ _onFocusableItemEdge,
173
+ exportObject,
174
+ } = setup(
175
+ props,
176
+ touchContainerW,
177
+ touchContainerH,
178
+ itemRender,
179
+ locateDiv,
180
+ renderData,
181
+ slideDiv,
182
+ slideDivLeft,
183
+ slideDivTop,
184
+ itemResizeSlideDiv,
185
+ itemResizeSlideLeft,
186
+ itemResizeSlideTop,
187
+ focusNode,
188
+ pageUpdateToken,
189
+ "list"
190
+ );
191
+
192
+ defineExpose(exportObject);
193
+ </script>
194
+
195
+ <template>
196
+ <div
197
+ :style="{
198
+ left: left,
199
+ top: top,
200
+ width: width,
201
+ height: height,
202
+ overflow: disableClip ? null : 'hidden',
203
+ }"
204
+ >
205
+ <div
206
+ :style="{
207
+ left: widgetRectInfo.padding.left,
208
+ top: widgetRectInfo.padding.top,
209
+ }"
210
+ >
211
+ <div
212
+ id="slideDiv"
213
+ key="touchcontainer"
214
+ ref="slideDiv"
215
+ :style="{
216
+ left: slideDivLeft,
217
+ top: slideDivTop,
218
+ width: touchContainerW,
219
+ height: touchContainerH,
220
+ }"
221
+ >
222
+ <div>
223
+ <slot name="background"></slot>
224
+ </div>
225
+ <div ref="locateDiv">
226
+ <jsv-focus-block
227
+ ref="focusNode"
228
+ :name="name"
229
+ :onAction="{
230
+ onFocus: focusBlockOnFocus,
231
+ onBlur: focusBlockOnBlur,
232
+ onKeyDown: focusBlockOnKeyDown,
233
+ onCustomerEvent: focusBlockOnCustomerEvent,
234
+ }"
235
+ >
236
+ <div
237
+ id="itemResizeSlide"
238
+ key="itemResizeSlide"
239
+ ref="itemResizeSlideDiv"
240
+ :style="{
241
+ left: itemResizeSlideLeft,
242
+ top: itemResizeSlideTop,
243
+ }"
244
+ >
245
+ <div
246
+ v-for="item in renderData"
247
+ :key="pageUpdateToken + '_' + item.index"
248
+ :ref="item.divRef"
249
+ :style="{
250
+ ...item.renderStyle,
251
+ }"
252
+ >
253
+ <div
254
+ v-if="!enableItemRenderBreak || item.mounted || itemRender"
255
+ :key="renderBreakKey"
256
+ :ref="item.slotRef"
257
+ >
258
+ <slot
259
+ name="renderItem"
260
+ :key="renderBreakKey"
261
+ :data="item.customerData"
262
+ :onEdge="_onFocusableItemEdge"
263
+ :onAction="item.registerObj"
264
+ :query="item.query"
265
+ :onItemEdge="_onFocusableItemEdge"
266
+ ></slot>
267
+ </div>
268
+ <div
269
+ v-if="
270
+ enableItemRenderBreak &&
271
+ placeHolderSetting &&
272
+ !item.mounted.value
273
+ "
274
+ :style="{
275
+ width:
276
+ item.renderStyle.width -
277
+ (placeHolderSetting.gap ? placeHolderSetting.gap : 0),
278
+ height:
279
+ item.renderStyle.height -
280
+ (placeHolderSetting.gap ? placeHolderSetting.gap : 0),
281
+ backgroundColor: placeHolderSetting.backgroundColor,
282
+ borderRadius: placeHolderSetting.borderRadius,
283
+ }"
284
+ ></div>
285
+ </div>
286
+ </div>
287
+ </jsv-focus-block>
288
+ </div>
289
+ <div>
290
+ <slot name="foreground"></slot>
291
+ </div>
292
+ </div>
293
+ </div>
294
+ </div>
295
+ </template>