@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.
- package/package.json +4 -3
- package/utils/JsViewEngineWidget/CheckType.js +82 -0
- package/utils/JsViewEngineWidget/MetroWidget/AnimationManager.ts +72 -0
- package/utils/JsViewEngineWidget/MetroWidget/Const.ts +24 -0
- package/utils/JsViewEngineWidget/MetroWidget/ListWidget.vue +295 -0
- package/utils/JsViewEngineWidget/MetroWidget/MetroWidget.vue +110 -1651
- package/utils/JsViewEngineWidget/MetroWidget/MetroWidgetSetup.js +1867 -0
- package/utils/JsViewEngineWidget/MetroWidget/PageUpdater.ts +111 -0
- package/utils/JsViewEngineWidget/MetroWidget/RenderItem.ts +153 -0
- package/utils/JsViewEngineWidget/MetroWidget/VisibleInfo.ts +43 -0
- package/utils/JsViewEngineWidget/MetroWidget/WidgetRectInfo.ts +49 -0
- package/utils/JsViewEngineWidget/TemplateParser/CommonMetroTemplate.ts +1424 -0
- package/utils/JsViewEngineWidget/TemplateParser/Fence.ts +135 -0
- package/utils/JsViewEngineWidget/TemplateParser/ListMetroTemplate.ts +177 -0
- package/utils/JsViewEngineWidget/TemplateParser/MetroTemplate.ts +334 -0
- package/utils/JsViewEngineWidget/TemplateParser/TemplateItemAdder.ts +147 -0
- package/utils/JsViewEngineWidget/TemplateParser/index.ts +4 -0
- package/utils/JsViewEngineWidget/{WidgetCommon.js → WidgetCommon.ts} +64 -71
- package/utils/JsViewEngineWidget/index.js +2 -1
- package/utils/JsViewPlugin/JsvAudio/AudioProxy.js +26 -1
- package/utils/JsViewPlugin/JsvAudio/JsvAudio.vue +120 -133
- package/utils/JsViewPlugin/JsvAudio/JsvAudioBrowser.vue +11 -7
- package/utils/JsViewPlugin/JsvPlayer/GetVersion.js +1 -1
- package/utils/JsViewPlugin/JsvPlayer/JsvPlayerBrowser.vue +379 -41
- package/utils/JsViewPlugin/JsvPlayer/version.mjs +5 -5
- package/utils/JsViewVueTools/JsvHashHistory.js +2 -1
- package/utils/JsViewVueWidget/JsvRadarChart.vue +220 -0
- package/utils/JsViewVueWidget/JsvSystemAudio.vue +76 -44
- package/utils/JsViewVueWidget/index.js +1 -0
- package/utils/JsViewEngineWidget/MetroWidget/Const.js +0 -11
- package/utils/JsViewEngineWidget/MetroWidget/PageUpdater.js +0 -136
- package/utils/JsViewEngineWidget/MetroWidget/ToolFunctions.js +0 -18
- package/utils/JsViewEngineWidget/TemplateParser.js +0 -2004
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @Author: ChenChanghua
|
|
3
|
+
* @Date: 2022-06-10 10:17:35
|
|
4
|
+
* @LastEditors: ChenChanghua
|
|
5
|
+
* @LastEditTime: 2022-06-10 10:17:36
|
|
6
|
+
* @Description: file content
|
|
7
|
+
*/
|
|
8
|
+
import { MetroTemplate } from "../TemplateParser/MetroTemplate";
|
|
9
|
+
|
|
10
|
+
export interface PermanentItemInfo {
|
|
11
|
+
index: number,
|
|
12
|
+
alreadyShow: boolean,
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export class PageUpdater {
|
|
16
|
+
private tmpRangeSet: Set<number>;
|
|
17
|
+
private rangeSet: Set<number>;
|
|
18
|
+
private updateFunc: (renderSet: Set<number>) => void;
|
|
19
|
+
private count: number = 1;
|
|
20
|
+
|
|
21
|
+
constructor(updateFunc: (renderSet: Set<number>) => void) {
|
|
22
|
+
this.tmpRangeSet = new Set<number>();
|
|
23
|
+
this.rangeSet = new Set<number>();;
|
|
24
|
+
this.updateFunc = updateFunc;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
update(
|
|
28
|
+
template: MetroTemplate,
|
|
29
|
+
start: number,
|
|
30
|
+
end: number,
|
|
31
|
+
anchorId: number,
|
|
32
|
+
mergeTmp: boolean,
|
|
33
|
+
permanentList: Array<PermanentItemInfo> | null,
|
|
34
|
+
extensionRange: number = 0
|
|
35
|
+
) {
|
|
36
|
+
if (!template || template.size === 0) return;
|
|
37
|
+
this.count++;
|
|
38
|
+
const [visibleStart, visibleEnd] = template.getVisibleItemList(
|
|
39
|
+
start - extensionRange,
|
|
40
|
+
end + extensionRange,
|
|
41
|
+
anchorId
|
|
42
|
+
);
|
|
43
|
+
const preTmpRangeSet = this.tmpRangeSet;
|
|
44
|
+
const preRangeSet = this.rangeSet;
|
|
45
|
+
|
|
46
|
+
this.rangeSet = new Set();
|
|
47
|
+
this.tmpRangeSet = new Set();
|
|
48
|
+
if (visibleStart >= 0 && visibleEnd >= 0) {
|
|
49
|
+
for (let i = visibleStart; i <= visibleEnd; ++i) {
|
|
50
|
+
this.rangeSet.add(i);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
if (permanentList) {
|
|
55
|
+
const permanentShowList = permanentList.filter((item: PermanentItemInfo) => {
|
|
56
|
+
let result = false;
|
|
57
|
+
if (item.alreadyShow || item.index <= visibleEnd) {
|
|
58
|
+
item.alreadyShow = true;
|
|
59
|
+
result = true;
|
|
60
|
+
}
|
|
61
|
+
return result;
|
|
62
|
+
});
|
|
63
|
+
for (let pItem of permanentShowList) {
|
|
64
|
+
this.rangeSet.add(pItem.index);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
if (preRangeSet.size > 0) {
|
|
68
|
+
this.tmpRangeSet = new Set([...this.rangeSet, ...preRangeSet]);
|
|
69
|
+
}
|
|
70
|
+
if (mergeTmp) {
|
|
71
|
+
this.tmpRangeSet = new Set([...this.tmpRangeSet, ...preTmpRangeSet]);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
const c = this.count;
|
|
75
|
+
return {
|
|
76
|
+
apply: () => {
|
|
77
|
+
if (c == this.count) {
|
|
78
|
+
this.apply();
|
|
79
|
+
} else {
|
|
80
|
+
// console.log("apply expired data")
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
applyTmp: () => {
|
|
84
|
+
if (c == this.count) {
|
|
85
|
+
this.applyTmp()
|
|
86
|
+
} else {
|
|
87
|
+
// console.log("apply tmp expired data")
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
private apply(): void {
|
|
94
|
+
this.tmpRangeSet.clear();
|
|
95
|
+
this.updateFunc(this.rangeSet);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
private applyTmp(): void {
|
|
99
|
+
if (this.tmpRangeSet.size > 0) {
|
|
100
|
+
this.updateFunc(this.tmpRangeSet);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
public getRange(): Set<number> {
|
|
105
|
+
return this.rangeSet;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
public getTmpRange(): Set<number> {
|
|
109
|
+
return this.tmpRangeSet;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import { ref } from "vue";
|
|
2
|
+
import type { Ref } from "vue";
|
|
3
|
+
import { TemplateItem } from "../TemplateParser/MetroTemplate"
|
|
4
|
+
|
|
5
|
+
interface RenderItemStyle {
|
|
6
|
+
zIndex: number,
|
|
7
|
+
left: number,
|
|
8
|
+
top: number,
|
|
9
|
+
width: number,
|
|
10
|
+
height: number,
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
interface ItemConfig {
|
|
14
|
+
takeOverSlide: boolean,
|
|
15
|
+
focusZIndex: number,
|
|
16
|
+
normalZIndex: number,
|
|
17
|
+
doSlide: boolean,
|
|
18
|
+
permanent: boolean,
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
interface CustomerCallbackMap {
|
|
22
|
+
onFocus?: (rect: object) => void,
|
|
23
|
+
onBlur?: () => void,
|
|
24
|
+
onClick?: () => void,
|
|
25
|
+
onWidgetEdge?: (rect: object) => void,
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export class RenderItem {
|
|
29
|
+
private divMountedCallback: Array<(div: HTMLDivElement) => void> = [];
|
|
30
|
+
|
|
31
|
+
public customerData: object;
|
|
32
|
+
public templateInfo: TemplateItem;
|
|
33
|
+
public renderStyle: RenderItemStyle;
|
|
34
|
+
public itemConfig: ItemConfig;
|
|
35
|
+
|
|
36
|
+
public mounted: Ref<boolean> = ref(false);
|
|
37
|
+
public touchInit: boolean = false;
|
|
38
|
+
public rootDiv: HTMLDivElement | null = null;
|
|
39
|
+
|
|
40
|
+
private customerCallbackMap: CustomerCallbackMap = {};
|
|
41
|
+
private onRef: (() => void) | null;
|
|
42
|
+
public readonly registerObj: object;
|
|
43
|
+
public readonly query: object;
|
|
44
|
+
|
|
45
|
+
constructor(
|
|
46
|
+
templateInfo: TemplateItem,
|
|
47
|
+
customerData: object,
|
|
48
|
+
renderStyle: RenderItemStyle,
|
|
49
|
+
itemConfig: ItemConfig,
|
|
50
|
+
onRef: () => void,
|
|
51
|
+
query: object) {
|
|
52
|
+
this.templateInfo = templateInfo;
|
|
53
|
+
this.customerData = customerData;
|
|
54
|
+
this.renderStyle = renderStyle;
|
|
55
|
+
this.itemConfig = itemConfig;
|
|
56
|
+
this.onRef = onRef;
|
|
57
|
+
const register = this.register.bind(this);
|
|
58
|
+
const unregister = this.unregister.bind(this);
|
|
59
|
+
this.registerObj = { register, unregister };
|
|
60
|
+
this.query = query;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
get id() {
|
|
64
|
+
return this.templateInfo.id;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
get index() {
|
|
68
|
+
return this.templateInfo.index;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
//TODO item的div ref 会调用多次, 待调查
|
|
72
|
+
public divRef = (ele: HTMLDivElement | null) => {
|
|
73
|
+
this.rootDiv = ele;
|
|
74
|
+
if (ele) {
|
|
75
|
+
this.onDivMounted();
|
|
76
|
+
} else {
|
|
77
|
+
this.onDivUnmounted();
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
public slotRef = (ele: object | null) => {
|
|
82
|
+
if (!this.mounted.value && ele) {
|
|
83
|
+
this.mounted.value = true;
|
|
84
|
+
this.onRef?.();
|
|
85
|
+
} else if (!ele && this.mounted.value) {
|
|
86
|
+
this.mounted.value = false;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
public register(name: string, callback: Function) {
|
|
91
|
+
this.customerCallbackMap[name] = callback;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
public unregister(name: string) {
|
|
95
|
+
delete this.customerCallbackMap[name];
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
public onFocus(rect: object): boolean {
|
|
99
|
+
if (this.mounted.value) {
|
|
100
|
+
this.customerCallbackMap.onFocus?.(rect);
|
|
101
|
+
return true;
|
|
102
|
+
} else {
|
|
103
|
+
return false;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
public onBlur(): boolean {
|
|
108
|
+
if (this.mounted.value) {
|
|
109
|
+
this.customerCallbackMap.onBlur?.();
|
|
110
|
+
return true;
|
|
111
|
+
} else {
|
|
112
|
+
return false;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
public onClick(): boolean {
|
|
117
|
+
if (this.mounted.value) {
|
|
118
|
+
this.customerCallbackMap.onClick?.();
|
|
119
|
+
return true;
|
|
120
|
+
} else {
|
|
121
|
+
return false;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
public onWidgetEdge(rect: object): boolean {
|
|
126
|
+
if (this.mounted.value) {
|
|
127
|
+
this.customerCallbackMap.onWidgetEdge?.(rect);
|
|
128
|
+
return true;
|
|
129
|
+
} else {
|
|
130
|
+
return false;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
public addDivMountedListener(cbk: (div: HTMLDivElement) => void) {
|
|
135
|
+
this.divMountedCallback.push(cbk);;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
private onDivMounted(): void {
|
|
139
|
+
if (this.divMountedCallback.length > 0) {
|
|
140
|
+
this.divMountedCallback.forEach((cbk: (ele: HTMLDivElement) => void) => {
|
|
141
|
+
if (this.rootDiv) {
|
|
142
|
+
cbk(this.rootDiv);
|
|
143
|
+
}
|
|
144
|
+
})
|
|
145
|
+
}
|
|
146
|
+
this.divMountedCallback = [];
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
private onDivUnmounted(): void {
|
|
150
|
+
this.touchInit = false;
|
|
151
|
+
this.divMountedCallback = [];
|
|
152
|
+
}
|
|
153
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
export class VisibleInfo {
|
|
2
|
+
private _start: number = 0;
|
|
3
|
+
public range: number = 0;
|
|
4
|
+
public padding: {
|
|
5
|
+
start: 0,
|
|
6
|
+
end: 0,
|
|
7
|
+
};
|
|
8
|
+
private _startMax: number = 0;
|
|
9
|
+
|
|
10
|
+
set start(value) {
|
|
11
|
+
this._start = value;
|
|
12
|
+
this._startMax = Math.max(this._start, this._startMax);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
get start() {
|
|
16
|
+
return this._start;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
get end() {
|
|
20
|
+
return this._start + this.range - 1;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
get startMax() {
|
|
24
|
+
return this._startMax;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
get startWithPadding() {
|
|
28
|
+
return this._start - this.padding.start;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
get endWithPadding() {
|
|
32
|
+
return this._start + this.range + this.padding.end - 1;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
public copy(): VisibleInfo {
|
|
36
|
+
const obj = new VisibleInfo();
|
|
37
|
+
obj._start = this._start;
|
|
38
|
+
obj.padding = { ...this.padding };
|
|
39
|
+
obj._startMax = this._startMax;
|
|
40
|
+
obj.range = this.range;
|
|
41
|
+
return obj
|
|
42
|
+
}
|
|
43
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
export interface Padding {
|
|
2
|
+
left: number,
|
|
3
|
+
top: number,
|
|
4
|
+
right: number,
|
|
5
|
+
bottom: number,
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export class WidgetRectInfo {
|
|
9
|
+
private mWidth: number;
|
|
10
|
+
private mHeight: number;
|
|
11
|
+
private mPadding: Padding = {
|
|
12
|
+
left: 0,
|
|
13
|
+
top: 0,
|
|
14
|
+
right: 0,
|
|
15
|
+
bottom: 0
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
constructor(w: number, h: number, padding: any) {
|
|
19
|
+
this.mWidth = w;
|
|
20
|
+
this.mHeight = h;
|
|
21
|
+
this.mPadding.left = padding?.left ?? 0;
|
|
22
|
+
this.mPadding.top = padding?.top ?? 0;
|
|
23
|
+
this.mPadding.right = padding?.right ?? 0;
|
|
24
|
+
this.mPadding.bottom = padding?.bottom ?? 0;
|
|
25
|
+
if (this.contentWidth <= 0 || this.contentHeight <= 0) {
|
|
26
|
+
throw new Error("padding size is large than widget size.");
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
get width() {
|
|
31
|
+
return this.mWidth;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
get height() {
|
|
35
|
+
return this.mHeight;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
get contentWidth() {
|
|
39
|
+
return this.mWidth - this.mPadding.left - this.mPadding.right;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
get contentHeight() {
|
|
43
|
+
return this.mHeight - this.mPadding.top - this.mPadding.bottom;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
get padding() {
|
|
47
|
+
return this.mPadding;
|
|
48
|
+
}
|
|
49
|
+
}
|