@shijiu/jsview-vue 0.9.287 → 0.9.295-alpha.0
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/dom/target_core_revision.js +3 -3
- package/package.json +1 -1
- package/samples/Basic/App.vue +1 -1
- package/utils/JsViewEngineWidget/ForgeDefine.js +7 -0
- package/utils/JsViewEngineWidget/JsvFocusBlock.vue +200 -0
- package/utils/JsViewEngineWidget/JsvFocusManager.js +91 -0
- package/utils/JsViewEngineWidget/MetroPage.js +2128 -0
- package/utils/JsViewEngineWidget/RangeModel.js +274 -0
- package/utils/JsViewEngineWidget/RectUtils.js +98 -0
- package/utils/JsViewEngineWidget/SimpleWidget/ContentView.vue +47 -0
- package/utils/JsViewEngineWidget/SimpleWidget/Dispatcher.js +18 -0
- package/utils/JsViewEngineWidget/SimpleWidget/ItemView.vue +119 -0
- package/utils/JsViewEngineWidget/SimpleWidget/RootView.vue +136 -0
- package/utils/JsViewEngineWidget/SimpleWidget/SimpleWidget.vue +1442 -0
- package/utils/JsViewEngineWidget/TemplateParser.js +1971 -0
- package/utils/JsViewEngineWidget/WidgetCommon.js +75 -0
- package/utils/JsViewEngineWidget/index.js +14 -6
- package/utils/JsViewVueWidget/JsvNativeSharedDiv.vue +14 -10
- package/utils/JsViewVueWidget/JsvPosterDiv.vue +19 -0
- package/utils/JsViewVueWidget/JsvPosterImage.vue +31 -0
- package/utils/JsViewVueWidget/JsvPreload/JsvPreload.vue +4 -4
- package/utils/JsViewVueWidget/JsvSwiper/JsvSwiper.vue +12 -2
- package/utils/JsViewEngineWidget/bin/index.js +0 -1
- package/utils/JsViewEngineWidget/bin/jsview-vue-widget.min.js +0 -1
- package/utils/JsViewEngineWidget/bin/package.json +0 -11
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
5
|
const TargetRevision = {
|
|
6
|
-
"CoreRevision":
|
|
7
|
-
"JseRevision": "1.0.
|
|
6
|
+
"CoreRevision": 810953,
|
|
7
|
+
"JseRevision": "1.0.774",
|
|
8
8
|
"JseUrl":
|
|
9
|
-
"http://cdn.release.qcast.cn/forge_js/master/
|
|
9
|
+
"http://cdn.release.qcast.cn/forge_js/master/JsViewES6_react_r774.jsv.dfae49bd.js"
|
|
10
10
|
};
|
|
11
11
|
|
|
12
12
|
// 不要用export default,update-env脚本不能解析
|
package/package.json
CHANGED
package/samples/Basic/App.vue
CHANGED
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
<script>
|
|
49
49
|
import { Options, Vue } from "vue-class-component";
|
|
50
50
|
import TitleBar from './components/TitleBar';
|
|
51
|
-
import DivGroup1 from './components/div/DivGroup1';
|
|
51
|
+
import DivGroup1 from './components/div/DivGroup1.vue';
|
|
52
52
|
import DivGroup2 from './components/div/DivGroup2';
|
|
53
53
|
import TextGroup from './components/text/TextGroup';
|
|
54
54
|
import AnimGroup from './components/anim/AnimGroup';
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
* onKeyUp: 按键抬起回调
|
|
3
|
+
* @params keyEvent
|
|
4
|
+
* @return 是否消耗 true: 已消耗,不再冒泡; false: 继续冒泡
|
|
5
|
+
* onKeyDown: 按键落下回调
|
|
6
|
+
* @params keyEvent
|
|
7
|
+
* @return 是否消耗 true: 已消耗,不再冒泡; false: 继续冒泡
|
|
8
|
+
* onFocus: 获得焦点回调
|
|
9
|
+
* onBlur: 失去焦点回调
|
|
10
|
+
* dispathchKeyDown: 分发按键落下事件回调
|
|
11
|
+
* @params keyEvent
|
|
12
|
+
* @return 是否消耗 true: 已消耗,不再分发; false: 继续分发
|
|
13
|
+
* dispathcKeyUp: 分发按键抬起事件回调
|
|
14
|
+
* @params keyEvent
|
|
15
|
+
* @return 是否消耗 true: 已消耗,不再分发; false: 继续分发
|
|
16
|
+
* fid/branchName: 用于设置焦点的id
|
|
17
|
+
* autoFocus: 当Mount后自动获得焦点, 设置为"exact",将把其子节点的焦点给抢过来
|
|
18
|
+
* asHub: true/false,设置后,此节点会创建二级hub,不同的hub之间fid可以重复(用于子场景由不同开发者开发后进行合并的场景)
|
|
19
|
+
-->
|
|
20
|
+
|
|
21
|
+
<script>
|
|
22
|
+
/* eslint-disable no-extra-boolean-cast */
|
|
23
|
+
/* eslint-disable no-prototype-builtins */
|
|
24
|
+
|
|
25
|
+
export default {
|
|
26
|
+
props: {
|
|
27
|
+
name: String,
|
|
28
|
+
namespace: String,
|
|
29
|
+
autoFocus: String,
|
|
30
|
+
onAction: Object,
|
|
31
|
+
onDispatchKeyUp: Function,
|
|
32
|
+
onDispatchKeyDown: Function,
|
|
33
|
+
onKeyUp: Function,
|
|
34
|
+
onKeyDown: Function,
|
|
35
|
+
onFocus: Function,
|
|
36
|
+
onBlur: Function,
|
|
37
|
+
},
|
|
38
|
+
|
|
39
|
+
setup(props) {
|
|
40
|
+
// 有效性检查
|
|
41
|
+
if (props.namespace && props.name) {
|
|
42
|
+
throw new Error(
|
|
43
|
+
"JsvFocusBlock Error: Either name or namespace can be set."
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
if (props.namespace === "") {
|
|
47
|
+
throw new Error("JsvFocusBlock Error: Invalid namespace of empty value.");
|
|
48
|
+
}
|
|
49
|
+
if (props.namespace && props.namespace.indexOf(".") >= 0) {
|
|
50
|
+
throw new Error(
|
|
51
|
+
'JsvFocusBlock Error: Invalid namespace of "' +
|
|
52
|
+
props.namespace +
|
|
53
|
+
'". namespace must not contains "."'
|
|
54
|
+
);
|
|
55
|
+
}
|
|
56
|
+
if (props.name && props.name.indexOf(".") >= 0) {
|
|
57
|
+
throw new Error(
|
|
58
|
+
'JsvFocusBlock Error: Invalid name of "' +
|
|
59
|
+
props.name +
|
|
60
|
+
'". name must not contains "."'
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
return {
|
|
65
|
+
actionCallback: {},
|
|
66
|
+
};
|
|
67
|
+
},
|
|
68
|
+
mounted() {
|
|
69
|
+
this.$_mountToFocusSystem();
|
|
70
|
+
|
|
71
|
+
if (!!this.$props.autoFocus || this.$props.autoFocus === "") {
|
|
72
|
+
this.requestFocus(this.$props.autoFocus !== "exact");
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
beforeUnmount() {
|
|
76
|
+
this.$el.FocusNodeRef.onUnMount();
|
|
77
|
+
},
|
|
78
|
+
|
|
79
|
+
methods: {
|
|
80
|
+
getName() {
|
|
81
|
+
return this.$el.FocusNodeRef.getName();
|
|
82
|
+
},
|
|
83
|
+
|
|
84
|
+
getNamespace() {
|
|
85
|
+
let focusNode = this.$el.FocusNodeRef;
|
|
86
|
+
if (focusNode?.AsHub) {
|
|
87
|
+
// hub的getHub返回的是自己
|
|
88
|
+
focusNode = this.$el.FocusNodeRef.GetParentPage();
|
|
89
|
+
}
|
|
90
|
+
const namespace = focusNode.getName();
|
|
91
|
+
return namespace !== ".__AppRoot__" ? namespace : "";
|
|
92
|
+
},
|
|
93
|
+
|
|
94
|
+
findBlockByName(name) {
|
|
95
|
+
const focusNode = this.$el.FocusNodeRef.getNodeByName(name);
|
|
96
|
+
return focusNode?.jsvVueComponent;
|
|
97
|
+
},
|
|
98
|
+
|
|
99
|
+
requestFocus(passToChild) {
|
|
100
|
+
this.$el.FocusNodeRef.requestFocus(passToChild);
|
|
101
|
+
},
|
|
102
|
+
|
|
103
|
+
debugPrintFocusChain() {
|
|
104
|
+
this.$el.FocusNodeRef.printFocusNodeList();
|
|
105
|
+
},
|
|
106
|
+
|
|
107
|
+
debugPrintLastFocus() {
|
|
108
|
+
this.$el.FocusNodeRef.printGlobalLastFocus();
|
|
109
|
+
},
|
|
110
|
+
|
|
111
|
+
$_mountToFocusSystem() {
|
|
112
|
+
const focusNode = this.$el.FocusNodeRef;
|
|
113
|
+
|
|
114
|
+
// 保存self,find用
|
|
115
|
+
focusNode.jsvVueComponent = this;
|
|
116
|
+
|
|
117
|
+
// 注册回调函数
|
|
118
|
+
this.actionCallback.onDispatchKeyDown =
|
|
119
|
+
this.$props.onDispatchKeyDown ||
|
|
120
|
+
this.$props.onAction?.onDispatchKeyDown;
|
|
121
|
+
if (this.actionCallback.onDispatchKeyDown) {
|
|
122
|
+
focusNode.setOnDispatchKeyDown(this.$_onDispatchKeyDown);
|
|
123
|
+
}
|
|
124
|
+
this.actionCallback.onDispatchKeyUp =
|
|
125
|
+
this.$props.onDispatchKeyUp || this.$props.onAction?.onDispatchKeyUp;
|
|
126
|
+
if (this.actionCallback.onDispatchKeyUp) {
|
|
127
|
+
focusNode.setOnDispatchKeyUp(this.$_onDispatchKeyUp);
|
|
128
|
+
}
|
|
129
|
+
this.actionCallback.onKeyDown =
|
|
130
|
+
this.$props.onKeyDown || this.$props.onAction?.onKeyDown;
|
|
131
|
+
if (this.actionCallback.onKeyDown) {
|
|
132
|
+
focusNode.setOnKeyDown(this.$_onKeyDown);
|
|
133
|
+
}
|
|
134
|
+
this.actionCallback.onKeyUp =
|
|
135
|
+
this.$props.onKeyUp || this.$props.onAction?.onKeyUp;
|
|
136
|
+
if (this.actionCallback.onKeyUp) {
|
|
137
|
+
focusNode.setOnKeyUp(this.$_onKeyUp);
|
|
138
|
+
}
|
|
139
|
+
this.actionCallback.onFocus =
|
|
140
|
+
this.$props.onFocus || this.$props.onAction?.onFocus;
|
|
141
|
+
if (this.actionCallback.onFocus) {
|
|
142
|
+
focusNode.setOnFocus(this.$_onFocus);
|
|
143
|
+
}
|
|
144
|
+
this.actionCallback.onBlur =
|
|
145
|
+
this.$props.onBlur || this.$props.onAction?.onBlur;
|
|
146
|
+
if (this.actionCallback.onBlur) {
|
|
147
|
+
focusNode.setOnBlur(this.$_onBlur);
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
// 建立父子关系链
|
|
151
|
+
let self = this.$el;
|
|
152
|
+
let parent = self.parentElement;
|
|
153
|
+
while (parent) {
|
|
154
|
+
if (self.FocusNodeRef.GetParentPage()) {
|
|
155
|
+
break;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
if (parent.tagName !== "FDIV") {
|
|
159
|
+
parent = parent.parentElement;
|
|
160
|
+
continue;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
self.FocusNodeRef.setParent(parent.FocusNodeRef);
|
|
164
|
+
|
|
165
|
+
self = parent;
|
|
166
|
+
parent = self.parentElement;
|
|
167
|
+
}
|
|
168
|
+
},
|
|
169
|
+
|
|
170
|
+
$_onDispatchKeyDown(ev) {
|
|
171
|
+
ev.ownerNode = this;
|
|
172
|
+
return this.actionCallback?.onDispatchKeyDown(ev) || false;
|
|
173
|
+
},
|
|
174
|
+
$_onDispatchKeyUp(ev) {
|
|
175
|
+
ev.ownerNode = this;
|
|
176
|
+
return this.actionCallback?.onDispatchKeyUp(ev) || false;
|
|
177
|
+
},
|
|
178
|
+
$_onKeyDown(ev) {
|
|
179
|
+
ev.ownerNode = this;
|
|
180
|
+
return this.actionCallback?.onKeyDown(ev) || false;
|
|
181
|
+
},
|
|
182
|
+
$_onKeyUp(ev) {
|
|
183
|
+
ev.ownerNode = this;
|
|
184
|
+
return this.actionCallback?.onKeyUp(ev) || false;
|
|
185
|
+
},
|
|
186
|
+
$_onFocus() {
|
|
187
|
+
this.actionCallback?.onFocus(this) || false;
|
|
188
|
+
},
|
|
189
|
+
$_onBlur() {
|
|
190
|
+
this.actionCallback?.onBlur(this) || false;
|
|
191
|
+
},
|
|
192
|
+
},
|
|
193
|
+
};
|
|
194
|
+
</script>
|
|
195
|
+
|
|
196
|
+
<template>
|
|
197
|
+
<fdiv :fname="$props.name" :new-namespace="$props.namespace">
|
|
198
|
+
<slot></slot>
|
|
199
|
+
</fdiv>
|
|
200
|
+
</template>
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/* eslint-disable no-prototype-builtins */
|
|
2
|
+
|
|
3
|
+
import JsvFocusBlock from './JsvFocusBlock.vue'
|
|
4
|
+
|
|
5
|
+
export class JsvFocusManager {
|
|
6
|
+
constructor() {
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
install(app, ...options) {
|
|
10
|
+
if(typeof options[0] !== 'string') {
|
|
11
|
+
throw new Error("JsvFocusManager Error: 2nd argument is required. Such as: app.use(FocusManager, '#app')")
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
// hook掉app原有的mount函数
|
|
15
|
+
const doAppMount = this.$_hookMount(app, options[0])
|
|
16
|
+
app.mount = doAppMount
|
|
17
|
+
|
|
18
|
+
// 注册全局jsv-focus-block组件
|
|
19
|
+
app.component('JsvFocusBlock', JsvFocusBlock)
|
|
20
|
+
|
|
21
|
+
// 注册全局$jsvFocusManager变量
|
|
22
|
+
app.config.globalProperties.$jsvFocusManager = this;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// declareAlias(alias, blockName) {
|
|
26
|
+
// if(typeof alias !== 'string') {
|
|
27
|
+
// throw new Error('JsvFocusManager Error: 1st argument must be a string as alias.')
|
|
28
|
+
// }
|
|
29
|
+
// if(typeof blockName !== 'string') {
|
|
30
|
+
// throw new Error('JsvFocusManager Error: 2nd argument must be a string as block name or namespace.')
|
|
31
|
+
// }
|
|
32
|
+
// if(this.#aliasMap.hasOwnProperty(alias)) {
|
|
33
|
+
// throw new Error('JsvFocusManager Error: "' + '" has been decleared.')
|
|
34
|
+
// }
|
|
35
|
+
|
|
36
|
+
// this.#aliasMap[alias] = blockName
|
|
37
|
+
// }
|
|
38
|
+
|
|
39
|
+
// changeFocusTo(nameOrSpace, name, exact) {
|
|
40
|
+
// if(this.#aliasMap.hasOwnProperty(nameOrSpace)) {
|
|
41
|
+
// nameOrSpace = this.#aliasMap[nameOrSpace]
|
|
42
|
+
// }
|
|
43
|
+
// if(name && this.#aliasMap.hasOwnProperty(name)) {
|
|
44
|
+
// name = this.#aliasMap[name]
|
|
45
|
+
// }
|
|
46
|
+
// if(name) {
|
|
47
|
+
// nameOrSpace += ("." + name)
|
|
48
|
+
// }
|
|
49
|
+
|
|
50
|
+
// if(!this.$_topFDiv) {
|
|
51
|
+
// console.warn("JsvFocusManager Warning: Failed to change focus to " + nameOrSpace)
|
|
52
|
+
// return
|
|
53
|
+
// }
|
|
54
|
+
|
|
55
|
+
// const rootNodeRef = this.$_topFDiv.getElement().FocusNodeRef;
|
|
56
|
+
// const focusNode = rootNodeRef.getNodeByName(nameOrSpace);
|
|
57
|
+
// if(!focusNode) {
|
|
58
|
+
// console.warn("JsvFocusManager Warning: Failed to find focus to " + nameOrSpace)
|
|
59
|
+
// return
|
|
60
|
+
// }
|
|
61
|
+
|
|
62
|
+
// focusNode.requestFocus(exact);
|
|
63
|
+
// }
|
|
64
|
+
|
|
65
|
+
$_hookMount(app, rootNodeId) {
|
|
66
|
+
rootNodeId = rootNodeId.replace('#', '')
|
|
67
|
+
this.$_topFDiv = document.jsvInitFDivRoot(rootNodeId)
|
|
68
|
+
this.$_appMount = app.mount.bind(app)
|
|
69
|
+
|
|
70
|
+
return this.$_doAppMount.bind(this)
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
$_doAppMount(rootContainer) {
|
|
74
|
+
// 调用app原有的mount函数
|
|
75
|
+
const rootComponent = this.$_appMount(rootContainer)
|
|
76
|
+
// console.log('FocusManager: do mount')
|
|
77
|
+
|
|
78
|
+
// 在app.mount后添加焦点控制调用
|
|
79
|
+
this.$_topFDiv.onMounted()
|
|
80
|
+
|
|
81
|
+
return rootComponent;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
// #aliasMap = {}
|
|
85
|
+
$_appMount = undefined;
|
|
86
|
+
$_topFDiv = undefined;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
export function jsvCreateFocusManager() {
|
|
90
|
+
return new JsvFocusManager()
|
|
91
|
+
}
|