@cloudbase/framework-plugin-low-code 1.0.3-beta.8 → 1.0.4
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/lib/builder/mp/lowcode.d.ts.map +1 -1
- package/lib/builder/mp/lowcode.js +3 -7
- package/lib/builder/service/builder/generate.d.ts.map +1 -1
- package/lib/builder/service/builder/generate.js +3 -0
- package/lib/generator/core/generate.d.ts.map +1 -1
- package/lib/generator/core/generate.js +11 -17
- package/lib/utils/dataSource.d.ts +4 -0
- package/lib/utils/dataSource.d.ts.map +1 -1
- package/lib/utils/dataSource.js +27 -12
- package/lib/weapps-core/utils/file.d.ts +1 -1
- package/package.json +3 -3
- package/template/src/app/common.js +0 -13
- package/template/src/app/global-api.js +0 -132
- package/template/src/app/handlers.js +0 -13
- package/template/src/app/material-actions.js +0 -16
- package/template/src/app/mountAppApis.js +0 -25
- package/template/src/app/mountMpApis.js +0 -4
- package/template/src/datasources/config.js.tpl +0 -27
- package/template/src/datasources/dataset-profiles.js.tpl +0 -5
- package/template/src/datasources/datasource-profiles.js.tpl +0 -4
- package/template/src/datasources/index.js.tpl +0 -27
- package/template/src/handlers/FieldMiddleware/renderer.jsx +0 -536
- package/template/src/handlers/HotAreas.js +0 -36
- package/template/src/handlers/PositionHandler.jsx +0 -8
- package/template/src/handlers/actionHandler/utils.js +0 -154
- package/template/src/handlers/componentEventActionEmitter.js +0 -29
- package/template/src/handlers/componentNodeMap.js +0 -24
- package/template/src/handlers/controller.js +0 -5
- package/template/src/handlers/emitComponentEvent.js +0 -8
- package/template/src/handlers/eventListener/componentEventListener.js +0 -15
- package/template/src/handlers/eventListener/hotAreaEventListener.js +0 -32
- package/template/src/handlers/eventListener/index.js +0 -29
- package/template/src/handlers/eventListener/pageEventListener.js +0 -11
- package/template/src/handlers/eventListener/types.js +0 -32
- package/template/src/handlers/hooks/index.js +0 -15
- package/template/src/handlers/initWebEnv.js +0 -4
- package/template/src/handlers/injectStyle.js +0 -14
- package/template/src/handlers/instanceMap.js +0 -39
- package/template/src/handlers/lifecycle.js +0 -222
- package/template/src/handlers/render.jsx +0 -170
- package/template/src/handlers/utils/common.js +0 -298
- package/template/src/handlers/utils/eventProxy.js +0 -64
- package/template/src/handlers/utils/events.js +0 -8
- package/template/src/handlers/utils/index.js +0 -4
- package/template/src/handlers/utils/widgets.js +0 -307
- package/template/src/index.jsx +0 -185
- package/template/src/index.less +0 -119
- package/template/src/libraries/default-lib/wx_yypt_report_v2.js +0 -441
- package/template/src/pages/app.tpl +0 -200
- package/template/src/pages/composite.tpl +0 -171
- package/template/src/router/index.tpl +0 -29
- package/template/src/store/computed.js +0 -11
- package/template/src/store/index.js +0 -40
- package/template/src/utils/formatEnum.js +0 -42
- package/template/src/utils/history.js +0 -66
- package/template/src/utils/index.js +0 -82
- package/template/src/utils/kbone.js +0 -18
- package/template/src/utils/monitor-jssdk.min.js +0 -763
- package/template/src/utils/request.js +0 -5
|
@@ -1,171 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
import { observer } from "mobx-react-lite";
|
|
3
|
-
import { observable } from "mobx";
|
|
4
|
-
import { get } from 'lodash'
|
|
5
|
-
|
|
6
|
-
import { AppRender } from "handlers/render";
|
|
7
|
-
import { createComputed } from "../../../../utils";
|
|
8
|
-
import { createWidgets, retryDataBinds, WidgetsContext, resolveComponentProps } from 'handlers/utils'
|
|
9
|
-
import getStateFn from "./lowcode/state.js";
|
|
10
|
-
import computed from "./lowcode/computed.js";
|
|
11
|
-
import lifecycle from "./lowcode/lifecycle.js";
|
|
12
|
-
import { app, $page } from '../../../../app/global-api'
|
|
13
|
-
|
|
14
|
-
<% handlersImports.forEach(handler => { %>
|
|
15
|
-
import handler$<%= handler.name %> from "./lowcode/handler/<%= handler.name %>.js";
|
|
16
|
-
<% }) %>
|
|
17
|
-
|
|
18
|
-
// Import Components
|
|
19
|
-
<% var componentsMap = {}; useComponents.forEach(compItem => {%>
|
|
20
|
-
<% if(compItem.entries && compItem.entries.components){ %>
|
|
21
|
-
import { <%= compItem.name %> as <%= compItem.var %> } from "libraries/<%= compItem.moduleName %>@<%= compItem.version %>/<%= compItem.entries.components %>";
|
|
22
|
-
<% } else if(compItem.entries && compItem.entries.entry){ %><% if(!componentsMap[compItem.moduleName]){ componentsMap[compItem.moduleName] = true %>
|
|
23
|
-
import <%= compItem.moduleNameVar %> from "libraries/<%= compItem.moduleName %>@<%= compItem.version %>/<%= compItem.entries.entry %>";
|
|
24
|
-
<% } %>const { <%= compItem.name %>: <%= compItem.var %> } = <%= compItem.moduleNameVar %>.components
|
|
25
|
-
<% } else { %>import <%= compItem.var %> from "libraries/<%= compItem.moduleName %>@<%= compItem.version %>/components/<%= compItem.name %>";<% } %>
|
|
26
|
-
<%}) %>
|
|
27
|
-
|
|
28
|
-
import * as constObj from '../../libCommonRes/const'
|
|
29
|
-
import * as toolsObj from '../../libCommonRes/tools'
|
|
30
|
-
|
|
31
|
-
import "./lowcode/style.less";
|
|
32
|
-
|
|
33
|
-
const pluginInstances = [];
|
|
34
|
-
|
|
35
|
-
class CompositeCompWrapper extends React.Component {
|
|
36
|
-
|
|
37
|
-
$WEAPPS_COMP = {}
|
|
38
|
-
|
|
39
|
-
componentDidUpdate() {
|
|
40
|
-
const { data } = this.props
|
|
41
|
-
for(let prop in data) {
|
|
42
|
-
// 更新 propsData
|
|
43
|
-
this.propsData[prop] = data[prop]
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
constructor(props) {
|
|
49
|
-
super(props);
|
|
50
|
-
|
|
51
|
-
this.compConfig = <%= JSON.stringify(compConfig, null, 2) %>
|
|
52
|
-
this.virtualFields = Object.assign({}, props.pageVirtualFields || {}, {
|
|
53
|
-
<% useComponents.forEach(compItem => {%>
|
|
54
|
-
"<%= compItem.key %>": React.forwardRef((props,ref) => <<%= compItem.var %> {...resolveComponentProps(props, <%= compItem.isPlainProps? 1:0 %>)} ref={ref}/>),
|
|
55
|
-
<%}) %>
|
|
56
|
-
});
|
|
57
|
-
this.events = (<%= emitEvents %>).reduce((obj, trigger) => {
|
|
58
|
-
obj[trigger] = (event) => {
|
|
59
|
-
this.props.emit(trigger, event)
|
|
60
|
-
};
|
|
61
|
-
return obj
|
|
62
|
-
}, {});
|
|
63
|
-
this.handler = this.$WEAPPS_COMP.handler = {
|
|
64
|
-
<% handlersImports.forEach(handler => { %>
|
|
65
|
-
<%= handler.name %>: handler$<%= handler.name %>.bind(this),
|
|
66
|
-
<% }) %>
|
|
67
|
-
};
|
|
68
|
-
this.componentSchema = <%= componentSchema %>;
|
|
69
|
-
const widgetContext = <%= widgets %>
|
|
70
|
-
const dataBinds = <%= dataBinds %>
|
|
71
|
-
const defaultProps = <%= JSON.stringify(defaultProps, null, 2) %>
|
|
72
|
-
this.propsData = observable(Object.assign({}, defaultProps, this.props.data || {}))
|
|
73
|
-
this.$WEAPPS_COMP.lib = { const: constObj, tools: toolsObj }
|
|
74
|
-
this.$WEAPPS_COMP.props = { ...this.props, events: this.events, data: this.propsData }
|
|
75
|
-
this.state = this.$WEAPPS_COMP.state = observable(getStateFn.bind(this)())
|
|
76
|
-
this.computed = this.$WEAPPS_COMP.computed = createComputed(computed, this)
|
|
77
|
-
this.node = this.$WEAPPS_COMP.node = this.createWidgetNode(this) || {}
|
|
78
|
-
this.widgets = createWidgets(widgetContext, dataBinds, {})
|
|
79
|
-
// widgets 内的 dataBinds 可能需要关联 widgets,需要重新执行 dataBinds
|
|
80
|
-
retryDataBinds()
|
|
81
|
-
Object.keys(this.widgets || {}).forEach(widgetId => {
|
|
82
|
-
// 将实例 ownerWidget 挂到内部组件上。内部组件就可以通过 $comp.node.ownerWidget 获取到所在的组件实例
|
|
83
|
-
this.widgets[widgetId].ownerWidget = this.node
|
|
84
|
-
})
|
|
85
|
-
this.pageListenerInstances = [];
|
|
86
|
-
this.createCompAPI(this)
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
createWidgetNode(compThis) {
|
|
90
|
-
// 当为数组时,需要判断自己属于 widgets 的哪一项
|
|
91
|
-
const {
|
|
92
|
-
compositeParent,
|
|
93
|
-
forIndexes,
|
|
94
|
-
id
|
|
95
|
-
} = compThis.props
|
|
96
|
-
let widgetData = compositeParent
|
|
97
|
-
? compositeParent.$WEAPPS_COMP.widgets[id]
|
|
98
|
-
: $page.widgets[id]
|
|
99
|
-
if(Array.isArray(widgetData)) {
|
|
100
|
-
widgetData = widgetData.length > 0 ? get(widgetData, forIndexes) : {}
|
|
101
|
-
}
|
|
102
|
-
widgetData = widgetData || {}
|
|
103
|
-
widgetData.getOwnerWidget = () => compThis.node.ownerWidget
|
|
104
|
-
widgetData.getConfig = () => compThis.compConfig
|
|
105
|
-
|
|
106
|
-
return widgetData
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
createCompAPI(compThis) {
|
|
110
|
-
const { forwardRef, ...restProps } = compThis.props || {};
|
|
111
|
-
compThis.$WEAPPS_COMP = {
|
|
112
|
-
compConfig: compThis.compConfig,
|
|
113
|
-
widgets: compThis.widgets,
|
|
114
|
-
node: compThis.node,
|
|
115
|
-
handler: compThis.handler,
|
|
116
|
-
lib: { const: constObj, tools: toolsObj },
|
|
117
|
-
get props() {
|
|
118
|
-
return {...restProps, events: compThis.events, data: compThis.propsData }
|
|
119
|
-
},
|
|
120
|
-
get state() {
|
|
121
|
-
return compThis.state
|
|
122
|
-
},
|
|
123
|
-
get computed() {
|
|
124
|
-
return compThis.computed
|
|
125
|
-
},
|
|
126
|
-
get _instanceRef() {
|
|
127
|
-
return forwardRef
|
|
128
|
-
},
|
|
129
|
-
get methods() {
|
|
130
|
-
return forwardRef.current?.methods
|
|
131
|
-
},
|
|
132
|
-
set methods(value) {
|
|
133
|
-
if(!forwardRef.current) {
|
|
134
|
-
forwardRef.current = {}
|
|
135
|
-
}
|
|
136
|
-
forwardRef.current.methods = value
|
|
137
|
-
return value
|
|
138
|
-
}
|
|
139
|
-
};
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
componentDidMount() {
|
|
143
|
-
const onAttached = lifecycle.onAttached && lifecycle.onAttached.bind(this)
|
|
144
|
-
Promise.resolve(onAttached()).then(()=>{
|
|
145
|
-
lifecycle.onReady && lifecycle.onReady.bind(this)()
|
|
146
|
-
})
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
componentWillUnmount() {
|
|
150
|
-
lifecycle.onDetached && lifecycle.onDetached.bind(this)()
|
|
151
|
-
this.$WEAPPS_COMP._instanceRef.current = undefined
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
render() {
|
|
155
|
-
return (
|
|
156
|
-
<WidgetsContext.Provider value={{ parent: this }}>
|
|
157
|
-
<AppRender
|
|
158
|
-
className={this.props.className}
|
|
159
|
-
virtualFields={this.virtualFields}
|
|
160
|
-
componentSchema={this.componentSchema}
|
|
161
|
-
codeContext={this}
|
|
162
|
-
/>
|
|
163
|
-
</WidgetsContext.Provider>
|
|
164
|
-
);
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
export default observer((props, _ref) => (
|
|
169
|
-
<CompositeCompWrapper {...props} forwardRef={_ref}></CompositeCompWrapper>
|
|
170
|
-
), { forwardRef: true });
|
|
171
|
-
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { BrowserRouter, Router, Route, Redirect, Switch, HashRouter } from 'react-router-dom';
|
|
3
|
-
import { history, generateBrowserHistory, generateHashHistory } from 'utils/history';
|
|
4
|
-
|
|
5
|
-
<%= mountApis %>
|
|
6
|
-
<%= routerImports %>
|
|
7
|
-
|
|
8
|
-
export default () => {
|
|
9
|
-
// 显式声明HASH 或 app 的 路由使用 hash router,而其他web应用使用 BrowserRouter
|
|
10
|
-
if (process.env.isApp || process.env.isAdminPortal || process.env.historyType === 'HASH') {
|
|
11
|
-
return (
|
|
12
|
-
<Router history={process.env.isAdminPortal? generateHashHistory({basename: "<%= basename %>"}) : history }>
|
|
13
|
-
<Switch>
|
|
14
|
-
<%= routerRenders %>
|
|
15
|
-
{process.env.isAdminPortal && false && <Route children={() => <Redirect to={'/404'} />} />}
|
|
16
|
-
</Switch>
|
|
17
|
-
</Router>
|
|
18
|
-
)
|
|
19
|
-
} else {
|
|
20
|
-
return (
|
|
21
|
-
<Router history={generateBrowserHistory({basename: "<%= basename %>"})}>
|
|
22
|
-
<Switch>
|
|
23
|
-
<%= routerRenders %>
|
|
24
|
-
</Switch>
|
|
25
|
-
</Router>
|
|
26
|
-
);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
// import all state of all pages & global
|
|
2
|
-
import globalComputed from '../lowcode/computed'
|
|
3
|
-
<% pageIds.forEach(function(pageId) { %>import <%= pageId %>Computed from '../lowcode/<%= pageId%>/computed';
|
|
4
|
-
<% }); %>
|
|
5
|
-
|
|
6
|
-
const computed = {
|
|
7
|
-
global: globalComputed,<% pageIds.forEach(function(pageId) { %>
|
|
8
|
-
<%= pageId %>: <%= pageId %>Computed,<% }); %>
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
export default computed;
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { observable, toJS } from 'mobx'
|
|
2
|
-
import initState from '../lowcode/state'
|
|
3
|
-
|
|
4
|
-
export const subPackageName = '<%= rootPath %>'
|
|
5
|
-
const appId = '<%= appId %>'
|
|
6
|
-
const stateKey = `_weappsGlobalState-` + appId + subPackageName
|
|
7
|
-
|
|
8
|
-
const globalState = observable(initState)
|
|
9
|
-
export default globalState
|
|
10
|
-
|
|
11
|
-
if (process.env.isMiniprogram) {
|
|
12
|
-
restoreGlobalState()
|
|
13
|
-
|
|
14
|
-
window.addEventListener('wxshow', restoreGlobalState)
|
|
15
|
-
window.addEventListener('wxhide', saveGlobalState)
|
|
16
|
-
window.addEventListener('wxunload', saveGlobalState)
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Save global state as plain object on wx.getApp()
|
|
21
|
-
*/
|
|
22
|
-
function saveGlobalState() {
|
|
23
|
-
if (getApp()[stateKey]) {
|
|
24
|
-
// 返回了多层页面时,中间页面也会执行unload,但不能保存state
|
|
25
|
-
return
|
|
26
|
-
}
|
|
27
|
-
getApp()[stateKey] = toJS(globalState)
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* Restore global state from wx.getApp()
|
|
32
|
-
*/
|
|
33
|
-
function restoreGlobalState() {
|
|
34
|
-
const savedState = getApp()[stateKey]
|
|
35
|
-
if (savedState) {
|
|
36
|
-
Object.assign(globalState, savedState)
|
|
37
|
-
// TODO delete extra props
|
|
38
|
-
getApp()[stateKey] = null
|
|
39
|
-
}
|
|
40
|
-
}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { observable } from 'mobx';
|
|
2
|
-
let loading = {};
|
|
3
|
-
export let enumOptions = observable({});
|
|
4
|
-
export function formatEnum(path, optionname) {
|
|
5
|
-
// 判断是单选还是多选
|
|
6
|
-
let isSingle = Array.isArray(path);
|
|
7
|
-
// 获取到options
|
|
8
|
-
let parseOptions = getEnumOptions(optionname);
|
|
9
|
-
if (parseOptions === '') {
|
|
10
|
-
return !isSingle ? path : path.join(',');
|
|
11
|
-
}
|
|
12
|
-
let multiTmp = [];
|
|
13
|
-
let value = !isSingle
|
|
14
|
-
? JSON.parse(parseOptions)?.find((item) => item?.key === path)?.value
|
|
15
|
-
: JSON.parse(parseOptions)
|
|
16
|
-
?.filter((item) => path.some((pathValue) => item?.key === pathValue))
|
|
17
|
-
.map((item) => multiTmp.push(item?.value));
|
|
18
|
-
// 对多选或者单选有不同处理
|
|
19
|
-
return !isSingle ? value : multiTmp?.join(',');
|
|
20
|
-
}
|
|
21
|
-
function getEnumOptions(optionName) {
|
|
22
|
-
if (enumOptions[optionName]) {
|
|
23
|
-
return enumOptions[optionName];
|
|
24
|
-
}
|
|
25
|
-
if (!loading[optionName]) {
|
|
26
|
-
loading[optionName] = true;
|
|
27
|
-
getGeneralOptions(optionName).then((data) => {
|
|
28
|
-
enumOptions[optionName] = data?.Items[0]?.Config;
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
|
-
return '';
|
|
32
|
-
}
|
|
33
|
-
async function getGeneralOptions(optionName) {
|
|
34
|
-
return app.cloud.callWedaApi({
|
|
35
|
-
action: 'DescribeGeneralOptionsDetailList',
|
|
36
|
-
data: {
|
|
37
|
-
PageSize: 1,
|
|
38
|
-
PageIndex: 1,
|
|
39
|
-
LikeNameOrTitle: optionName,
|
|
40
|
-
},
|
|
41
|
-
});
|
|
42
|
-
}
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import { createHashHistory, createBrowserHistory } from 'history';
|
|
2
|
-
|
|
3
|
-
// if (!process.env.isMiniprogram) {
|
|
4
|
-
const createHistory =
|
|
5
|
-
process.env.isApp ||
|
|
6
|
-
process.env.isAdminPortal ||
|
|
7
|
-
process.env.historyType === 'HASH'
|
|
8
|
-
? createHashHistory
|
|
9
|
-
: createBrowserHistory;
|
|
10
|
-
|
|
11
|
-
let history = createHistory({
|
|
12
|
-
basename: '', // The base URL of the app (see below)
|
|
13
|
-
forceRefresh: false, // Set true to force full page refreshes
|
|
14
|
-
keyLength: 6, // The length of location.key
|
|
15
|
-
});
|
|
16
|
-
window._WEAPPS_HISTORY = history;
|
|
17
|
-
|
|
18
|
-
// } else {
|
|
19
|
-
// history = {
|
|
20
|
-
// push(path) {
|
|
21
|
-
// wx.navigateTo({
|
|
22
|
-
// url: '/pages/' + removeS(path) + '/index',
|
|
23
|
-
// });
|
|
24
|
-
// },
|
|
25
|
-
// replace(path) {
|
|
26
|
-
// wx.redirectTo({
|
|
27
|
-
// url: '/pages/' + removeS(path) + '/index',
|
|
28
|
-
// });
|
|
29
|
-
// },
|
|
30
|
-
// reLaunch(path) {
|
|
31
|
-
// wx.reLaunch({
|
|
32
|
-
// url: '/pages/' + removeS(path) + '/index',
|
|
33
|
-
// });
|
|
34
|
-
// },
|
|
35
|
-
// navigateBack(delta = 1) {
|
|
36
|
-
// wx.navigateBack({
|
|
37
|
-
// delta,
|
|
38
|
-
// });
|
|
39
|
-
// },
|
|
40
|
-
// };
|
|
41
|
-
// }
|
|
42
|
-
|
|
43
|
-
function generateBrowserHistory(param) {
|
|
44
|
-
history = createBrowserHistory(param);
|
|
45
|
-
window._WEAPPS_HISTORY = history;
|
|
46
|
-
return history;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
function generateHashHistory(param) {
|
|
50
|
-
history = createHashHistory(param);
|
|
51
|
-
window._WEAPPS_HISTORY = history;
|
|
52
|
-
return history;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
// const createHistory = (basename) => {
|
|
56
|
-
// if (process.env.isApp) {
|
|
57
|
-
// return createHashHistory({
|
|
58
|
-
// basename: '', // The base URL of the app (see below)
|
|
59
|
-
// });
|
|
60
|
-
// }
|
|
61
|
-
// return createBrowserHistory({
|
|
62
|
-
// basename,
|
|
63
|
-
// });
|
|
64
|
-
// };
|
|
65
|
-
|
|
66
|
-
export { history, createHistory, generateBrowserHistory, generateHashHistory };
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
import { get as lodashGet, set as lodashSet } from 'lodash';
|
|
2
|
-
|
|
3
|
-
const componentsInfoMap = <%= componentsInfoMap %>;
|
|
4
|
-
|
|
5
|
-
export function createComputed(funcs, bindContext = null) {
|
|
6
|
-
const obj = {};
|
|
7
|
-
for (const name in funcs) {
|
|
8
|
-
Object.defineProperty(obj, name, {
|
|
9
|
-
get: bindContext ? funcs[name].bind(bindContext) : funcs[name],
|
|
10
|
-
});
|
|
11
|
-
}
|
|
12
|
-
return obj;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export function checkVisible({ _visible }) {
|
|
16
|
-
return _visible !== false && _visible !== '';
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
const SCOPE_SLOT_COMPONENT_LIB = ['tea_basis', 'tea_shop', 'crm_basis'];
|
|
20
|
-
|
|
21
|
-
const SCOPE_SLOT_MAP = SCOPE_SLOT_COMPONENT_LIB.reduce((map, lib) => {
|
|
22
|
-
map[`${lib}:TableMatching`] = {
|
|
23
|
-
headerSlot: true,
|
|
24
|
-
recordSlot: true,
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
map[`${lib}:TableExpanded`] = {
|
|
28
|
-
headerSlot: true,
|
|
29
|
-
recordSlot: true,
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
map[`${lib}:TabsTable`] = {
|
|
33
|
-
headerSlot: true,
|
|
34
|
-
recordSlot: true,
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
map[`${lib}:Table`] = {
|
|
38
|
-
headerSlot: true,
|
|
39
|
-
recordSlot: true,
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
return map;
|
|
43
|
-
}, {});
|
|
44
|
-
|
|
45
|
-
export function isScopeSlot(comp, slot, context={componentsInfoMap}) {
|
|
46
|
-
const { 'x-props': xProps } = comp;
|
|
47
|
-
const sourceKey = xProps && xProps.sourceKey;
|
|
48
|
-
|
|
49
|
-
let hasXslotScope = false;
|
|
50
|
-
try {
|
|
51
|
-
const component = context?.componentsInfoMap?.[sourceKey];
|
|
52
|
-
const dataForm = component?.dataForm || component?.data?.properties;
|
|
53
|
-
if (typeof dataForm === 'object') {
|
|
54
|
-
hasXslotScope = Object.keys(dataForm).some(
|
|
55
|
-
(prop) =>
|
|
56
|
-
slot.startsWith(`${prop}_`) && dataForm[prop]?.['x-slot-scope']
|
|
57
|
-
);
|
|
58
|
-
}
|
|
59
|
-
} catch (e) {}
|
|
60
|
-
|
|
61
|
-
const map = SCOPE_SLOT_MAP[sourceKey];
|
|
62
|
-
return hasXslotScope || (map && map[slot]);
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
export function _isMobile() {
|
|
66
|
-
if (window.matchMedia) {
|
|
67
|
-
return Boolean(window.matchMedia('(max-width: 1024px)')?.matches);
|
|
68
|
-
}
|
|
69
|
-
let check = false;
|
|
70
|
-
(function (a) {
|
|
71
|
-
if (
|
|
72
|
-
/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i.test(
|
|
73
|
-
a
|
|
74
|
-
) ||
|
|
75
|
-
/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(
|
|
76
|
-
a.substr(0, 4)
|
|
77
|
-
)
|
|
78
|
-
)
|
|
79
|
-
check = true;
|
|
80
|
-
})(navigator.userAgent || navigator.vendor || window.opera);
|
|
81
|
-
return check;
|
|
82
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Be default, variables on window of kbone are not shared across pages.
|
|
3
|
-
* Define vars to be shared across pages, Refer https://wechat-miniprogram.github.io/kbone/docs/domextend/#window-global
|
|
4
|
-
*/
|
|
5
|
-
function shareVarsCrossPage(vars) {
|
|
6
|
-
vars.forEach(name => {
|
|
7
|
-
Object.defineProperty(window, name, {
|
|
8
|
-
get: () => window.$$global[name],
|
|
9
|
-
set(v) {
|
|
10
|
-
window.$$global[name] = v
|
|
11
|
-
},
|
|
12
|
-
})
|
|
13
|
-
})
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
if (process.env.isMiniprogram) {
|
|
17
|
-
shareVarsCrossPage(['__mobxGlobals', '__mobxInstanceCount'])
|
|
18
|
-
}
|