@epxing/core 5.3.0-beta.2 → 5.3.0-beta.3
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/API.md +26 -25
- package/README.md +3 -1
- package/dist/.cache/route-chart-release/frontend/frame/public/js/ecStat.min.js +4 -0
- package/dist/.cache/route-chart-release/frontend/frame/public/js/echarts-wordcloud.min.js +4 -0
- package/dist/.cache/route-chart-release/frontend/frame/public/js/echarts.min.js +4 -0
- package/dist/_virtual/_plugin-vue_export-helper.js +10 -0
- package/dist/_virtual/jsencrypt.min.js +1 -1
- package/dist/assets/ecStat.min-BrTYPOXX.js +1 -0
- package/dist/assets/echarts-wordcloud.min-nWR4Hzny.js +3 -0
- package/dist/assets/echarts.min-DROS9E5X.js +45 -0
- package/dist/assets/role_select-DTqRlFNz.webp +0 -0
- package/dist/{_vendor → frontend/frame/_vendor}/.pnpm/jsencrypt@3.5.4/_vendor/jsencrypt/bin/jsencrypt.min.js +1 -1
- package/dist/src/RootApp.js +54 -0
- package/dist/src/api/createHttp.js +6 -0
- package/dist/src/app-ui-settings.js +49 -0
- package/dist/src/axios.js +10 -15
- package/dist/src/chart-runtime-assets.js +9 -0
- package/dist/src/create-app.js +3 -6
- package/dist/src/index.js +2 -0
- package/dist/src/loadComponent.js +2 -2
- package/dist/src/menu-route.js +11 -0
- package/dist/src/mixins/component.js +3 -0
- package/dist/src/navigation-context.js +47 -0
- package/dist/src/navigation.js +43 -12
- package/dist/src/package-install.js +3 -2
- package/dist/src/plugins/element-plus.js +8 -8
- package/dist/src/public-api.js +4 -2
- package/dist/src/route-components.js +9 -0
- package/dist/src/router/config.js +7 -8
- package/dist/src/runtime-services.js +1 -1
- package/dist/src/runtime-utils/meta.js +3 -0
- package/dist/src/runtime-utils/pdf.viewer.js +31 -15
- package/dist/src/runtime-utils/util.js +29 -5
- package/dist/src/shared-packages.js +1 -3
- package/dist/src/store/modules/list.js +25 -3
- package/dist/src/store/modules/meta.js +49 -7
- package/dist/src/style-presets.js +4 -4
- package/dist/src/ui-settings.js +90 -18
- package/dist/src/views/App.js +48 -0
- package/dist/src/views/AppRoleSelect.js +233 -0
- package/dist/src/views/Error.js +210 -0
- package/dist/src/views/Module.js +173 -0
- package/dist/style.css +251 -0
- package/package.json +4 -4
- package/src/RootApp.vue +75 -0
- package/src/api/createHttp.js +7 -0
- package/src/api/index.js +47 -47
- package/src/app-ui-settings.js +31 -0
- package/src/axios.js +311 -318
- package/src/chart-runtime-assets.js +7 -0
- package/src/create-app.js +3 -7
- package/src/index.js +28 -28
- package/src/install.js +157 -157
- package/src/loadComponent.js +187 -187
- package/src/loadLibrary.js +99 -99
- package/src/menu-route.js +12 -1
- package/src/mixins/component.js +1464 -1461
- package/src/navigation-context.js +49 -0
- package/src/navigation.js +208 -176
- package/src/package-install.js +2 -1
- package/src/plugins/element-plus.js +302 -302
- package/src/plugins/frame.js +178 -178
- package/src/public-api.js +1 -0
- package/src/route-components.js +7 -0
- package/src/router/config.js +861 -864
- package/src/router/public.js +1 -1
- package/src/runtime-services.js +1 -1
- package/src/runtime-utils/fieldFactory.js +179 -179
- package/src/runtime-utils/meta.js +399 -378
- package/src/runtime-utils/pdf.viewer.js +672 -644
- package/src/runtime-utils/util.js +1357 -1330
- package/src/shared-packages.js +1 -3
- package/src/store/modules/config.js +351 -351
- package/src/store/modules/list.js +30 -3
- package/src/store/modules/locale.js +236 -236
- package/src/store/modules/meta.js +314 -265
- package/src/style-presets.js +4 -4
- package/src/ui-settings.js +84 -23
- package/src/views/App.vue +53 -0
- package/src/views/AppRoleSelect.vue +334 -0
- package/src/views/Error.vue +63 -0
- package/src/views/Module.vue +210 -0
- package/src/xss.js +26 -26
- package/types/app.d.ts +10 -10
- package/types/axios.d.ts +1 -1
- package/types/component-mixin.d.ts +1 -1
- package/types/field-factory.d.ts +1 -1
- package/types/global-mixin.d.ts +1 -1
- package/types/http.d.ts +1 -1
- package/types/index.d.ts +3 -0
- package/types/meta.d.ts +1 -1
- package/types/navigation.d.ts +21 -21
- package/types/pdf-viewer.d.ts +1 -1
- package/types/runtime.d.ts +13 -13
- package/types/store.d.ts +1 -1
- package/types/util.d.ts +2 -2
- /package/dist/{build → .cache/route-chart-release/frontend/frame/build}/stubs/empty-components.js +0 -0
- /package/dist/{src → .cache/route-chart-release/frontend/frame/src}/element-icons.names.js +0 -0
- /package/dist/{src → .cache/route-chart-release/frontend/frame/src}/element-plus.lazy.js +0 -0
- /package/dist/{_vendor → frontend/frame/_vendor}/.pnpm/element-plus@2.14.3_vue@3.5.39_typescript@5.9.3_/_vendor/element-plus/dist/locale/en.js +0 -0
- /package/dist/{_vendor → frontend/frame/_vendor}/.pnpm/element-plus@2.14.3_vue@3.5.39_typescript@5.9.3_/_vendor/element-plus/dist/locale/zh-cn.js +0 -0
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
// 独立包构建把已有脚本作为资源随包发布,使用时才下载和执行。
|
|
2
|
+
import echartsUrl from '../../../public/js/echarts.min.js?url&no-inline'
|
|
3
|
+
import ecStatUrl from '../../../public/js/ecStat.min.js?url&no-inline'
|
|
4
|
+
import wordcloudUrl from '../../../public/js/echarts-wordcloud.min.js?url&no-inline'
|
|
5
|
+
|
|
6
|
+
export { wordcloudUrl }
|
|
7
|
+
export default [echartsUrl, ecStatUrl]
|
package/src/create-app.js
CHANGED
|
@@ -1,13 +1,9 @@
|
|
|
1
|
-
import { createApp as createVueApp
|
|
2
|
-
import { createRouter, createWebHashHistory
|
|
1
|
+
import { createApp as createVueApp } from 'vue'
|
|
2
|
+
import { createRouter, createWebHashHistory } from 'vue-router'
|
|
3
3
|
import { createFrameStore } from './store/create-store'
|
|
4
|
+
import Root from './RootApp.vue'
|
|
4
5
|
|
|
5
6
|
// 只组装 core 运行时;业务页面和路由由产品插件安装,不反向依赖平台壳。
|
|
6
|
-
const Root = {
|
|
7
|
-
name: 'EpxCoreApp',
|
|
8
|
-
render: () => h('div', { class: 'epx-app-root' }, [h(RouterView)])
|
|
9
|
-
}
|
|
10
|
-
|
|
11
7
|
export default function createCoreApp (options, corePlugin) {
|
|
12
8
|
const {
|
|
13
9
|
rootComponent = Root,
|
package/src/index.js
CHANGED
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
import * as api from './public-api'
|
|
2
|
-
import * as utils from '@epxing/utils/src/public'
|
|
3
|
-
import * as Vue from 'vue'
|
|
4
|
-
import * as Vuex from 'vuex'
|
|
5
|
-
import { publishSharedPackage } from './shared-packages'
|
|
6
|
-
import createCoreApp from './create-app'
|
|
7
|
-
export * from './public-api'
|
|
8
|
-
|
|
9
|
-
export function publishCoreRuntime () {
|
|
10
|
-
publishSharedPackage('@epxing/core', { ...api, installCore, createCore, createApp, publishCoreRuntime, default: EpxCore })
|
|
11
|
-
publishSharedPackage('@epxing/utils', utils)
|
|
12
|
-
publishSharedPackage('vue', Vue)
|
|
13
|
-
publishSharedPackage('vuex', Vuex)
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export function createCore (options = {}) {
|
|
17
|
-
return { install: (app, overrides = {}) => EpxCore.install(app, { ...options, ...overrides }) }
|
|
18
|
-
}
|
|
19
|
-
export function installCore (app, options) {
|
|
20
|
-
const context = api.installCore(app, options)
|
|
21
|
-
publishCoreRuntime()
|
|
22
|
-
return context
|
|
23
|
-
}
|
|
24
|
-
export function createApp (options = {}) {
|
|
25
|
-
return createCoreApp(options, EpxCore)
|
|
26
|
-
}
|
|
27
|
-
const EpxCore = { ...api, install: installCore, installCore, createCore, createApp, publishCoreRuntime }
|
|
28
|
-
export default EpxCore
|
|
1
|
+
import * as api from './public-api'
|
|
2
|
+
import * as utils from '@epxing/utils/src/public'
|
|
3
|
+
import * as Vue from 'vue'
|
|
4
|
+
import * as Vuex from 'vuex'
|
|
5
|
+
import { publishSharedPackage } from './shared-packages'
|
|
6
|
+
import createCoreApp from './create-app'
|
|
7
|
+
export * from './public-api'
|
|
8
|
+
|
|
9
|
+
export function publishCoreRuntime () {
|
|
10
|
+
publishSharedPackage('@epxing/core', { ...api, installCore, createCore, createApp, publishCoreRuntime, default: EpxCore })
|
|
11
|
+
publishSharedPackage('@epxing/utils', utils)
|
|
12
|
+
publishSharedPackage('vue', Vue)
|
|
13
|
+
publishSharedPackage('vuex', Vuex)
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export function createCore (options = {}) {
|
|
17
|
+
return { install: (app, overrides = {}) => EpxCore.install(app, { ...options, ...overrides }) }
|
|
18
|
+
}
|
|
19
|
+
export function installCore (app, options) {
|
|
20
|
+
const context = api.installCore(app, options)
|
|
21
|
+
publishCoreRuntime()
|
|
22
|
+
return context
|
|
23
|
+
}
|
|
24
|
+
export function createApp (options = {}) {
|
|
25
|
+
return createCoreApp(options, EpxCore)
|
|
26
|
+
}
|
|
27
|
+
const EpxCore = { ...api, install: installCore, installCore, createCore, createApp, publishCoreRuntime }
|
|
28
|
+
export default EpxCore
|
package/src/install.js
CHANGED
|
@@ -1,157 +1,157 @@
|
|
|
1
|
-
import { publishCoreRuntime } from './index'
|
|
2
|
-
// 平台入口(main.js)与库工厂入口(createApp.js)共享的框架安装逻辑。
|
|
3
|
-
//
|
|
4
|
-
// T06:抽出本文件统一两个入口,消除"漂移"。此前 createApp.js(lib 入口)相比 main.js 缺:
|
|
5
|
-
// - Vue.prototype.xss → lib 模式下 115 处 v-html 因 `xss is undefined` 全炸 🔴
|
|
6
|
-
// - import 'default-passive-events' → 移动端 passive 事件警告 🔴
|
|
7
|
-
// - $_ 的 set / get / camelCase / mergeWith → 调用处 undefined 🔴
|
|
8
|
-
// 现在两个入口都走本文件,行为以 main.js(生产验证过)为准,上述漂移自动修复。
|
|
9
|
-
// 详见 docs/migration/analysis/entry-points-audit.md
|
|
10
|
-
//
|
|
11
|
-
// 注:FieldFactory 经 @/utils barrel(→ ./fieldFactory,小写)引入,
|
|
12
|
-
// 避免 createApp 旧写法 '@/utils/FieldFactory'(大写)在区分大小写的 Linux/CI 上解析失败。
|
|
13
|
-
|
|
14
|
-
import { newXss } from './xss'
|
|
15
|
-
import axios from '@epxing/core/src/axios'
|
|
16
|
-
import http from '@epxing/core/src/api'
|
|
17
|
-
import { FieldFactory, util, PdfViewer, pdfViewer } from '@epxing/utils/src/legacy'
|
|
18
|
-
import {
|
|
19
|
-
isEmpty, isObject, isNil, cloneDeep, isEqual, isMatch,
|
|
20
|
-
debounce, throttle, assignWith, mergeWith, findLastIndex,
|
|
21
|
-
set, get, camelCase
|
|
22
|
-
} from 'lodash-es'
|
|
23
|
-
import cookie from '@epxing/utils/src/storage' // Web Storage 兼容层(js-cookie 同形 API,不读写浏览器 Cookie)
|
|
24
|
-
// $moment 现在是基于 dayjs 的兼容层(locale 在该模块内部设置,这里不用再管)。
|
|
25
|
-
import moment from '@epxing/utils/src/moment-compat'
|
|
26
|
-
import bus from '@epxing/core/src/vue.bus'
|
|
27
|
-
import '@epxing/core/src/plugins'
|
|
28
|
-
import { installFrameComponents } from '@epxing/core/src/plugins/frame'
|
|
29
|
-
import '@epxing/theme/src/index.scss'
|
|
30
|
-
// EP 官方暗黑色板(变量挂 html.dark;主题应用处在 data-theme=dark 时同步该 class)
|
|
31
|
-
import 'element-plus/theme-chalk/dark/css-vars.css'
|
|
32
|
-
import I18n from '@epxing/core/src/plugins/i18n'
|
|
33
|
-
import installElementPlus from '@epxing/core/src/plugins/element-plus'
|
|
34
|
-
import { setApp } from '@epxing/core/src/app'
|
|
35
|
-
import PopupInstall from '@epxing/business/src/popup.js'
|
|
36
|
-
import directive from '@epxing/core/src/directives/global'
|
|
37
|
-
import loadComponentFactory from '@epxing/core/src/loadComponent'
|
|
38
|
-
import 'default-passive-events'
|
|
39
|
-
// 优化后的全局混入:将方法挂载到原型,只混入响应式数据
|
|
40
|
-
import { installGlobalMethods } from '@epxing/core/src/mixins/methods-to-prototype'
|
|
41
|
-
import nav from '@epxing/core/src/navigation'
|
|
42
|
-
import optimizedGlobalMixin from '@epxing/core/src/mixins/optimized-global'
|
|
43
|
-
|
|
44
|
-
// lodash 子集:同时用于 Vue.prototype.$_ 与对外 export(含 set/get/camelCase/mergeWith)
|
|
45
|
-
export const lodash = {
|
|
46
|
-
isEmpty,
|
|
47
|
-
isObject,
|
|
48
|
-
isNil,
|
|
49
|
-
isEqual,
|
|
50
|
-
isMatch,
|
|
51
|
-
cloneDeep,
|
|
52
|
-
debounce,
|
|
53
|
-
throttle,
|
|
54
|
-
assignWith,
|
|
55
|
-
mergeWith,
|
|
56
|
-
findLastIndex,
|
|
57
|
-
set,
|
|
58
|
-
get,
|
|
59
|
-
camelCase
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
export { newXss } from './xss'
|
|
63
|
-
|
|
64
|
-
export { axios, http, util, moment, cookie, PdfViewer, pdfViewer }
|
|
65
|
-
|
|
66
|
-
// T30b app 化后按 app 幂等(原 boolean 是 Vue 全局单次;现每个 app 各装一次,
|
|
67
|
-
// 同一 app 重复调用仍只装一次——lib 工厂多次 createApp() 时各 app 都能拿到框架)
|
|
68
|
-
const installedApps = new WeakSet()
|
|
69
|
-
|
|
70
|
-
// 把框架安装到 app(注入 globalProperties / 指令 / 全局方法 / 混入)。幂等:仅执行一次。
|
|
71
|
-
// T30b GLOBAL_PROTOTYPE app 化:接 app 实例,`Vue.prototype.X`→`app.config.globalProperties.X`、
|
|
72
|
-
// `Vue.use`→`app.use`、`Vue.mixin`→`app.mixin`(Vue3 全局 API 移到 app,摘 compat GLOBAL_PROTOTYPE/
|
|
73
|
-
// GLOBAL_MIXIN 桥)。注:module-level 的 plugins/frame/popup(element/vant/$popup)仍在 compat Vue
|
|
74
|
-
// 全局注册(随后续/EP 处理),与本 app 化并存(compat 桥接到同一 app)。
|
|
75
|
-
export default function installFrame (app) {
|
|
76
|
-
if (installedApps.has(app)) return
|
|
77
|
-
installedApps.add(app)
|
|
78
|
-
|
|
79
|
-
// T33:登记 app 单例。Vue3 没有全局 Vue.component/Vue.use,而页面配置驱动的动态组件查询、
|
|
80
|
-
// 远端 library 的运行时注册都需要「在任意位置拿到 app」。见 @epxing/core/src/app。
|
|
81
|
-
setApp(app)
|
|
82
|
-
|
|
83
|
-
const gp = app.config.globalProperties
|
|
84
|
-
gp.xss = newXss
|
|
85
|
-
gp.$http = http
|
|
86
|
-
gp.$axios = axios
|
|
87
|
-
gp.$FieldFactory = FieldFactory
|
|
88
|
-
gp.$PdfViewer = PdfViewer
|
|
89
|
-
gp.$pdfViewer = pdfViewer
|
|
90
|
-
gp.$util = util
|
|
91
|
-
gp.$_ = lodash
|
|
92
|
-
gp.$cookie = cookie
|
|
93
|
-
gp.$moment = moment
|
|
94
|
-
gp.$loadComponent = loadComponentFactory(app)
|
|
95
|
-
|
|
96
|
-
// T32:数据库存量页面脚本(FM_PAGE_CONFIG.CONTENT 里的 compileJS,component.js 里 eval 后作为
|
|
97
|
-
// pageEvents 挂在页面实例上)用了 287 处 `$set`(60 个页面)。Vue3 无 $set/$delete。
|
|
98
|
-
// 实现照抄 @vue/compat 的语义(`target[key] = val` / `delete target[key]`,不对数组做 splice)。
|
|
99
|
-
//
|
|
100
|
-
// 注意:**compat 在时这两个是休眠的** —— @vue/compat 把 $set/$delete 放进 publicPropertiesMap,
|
|
101
|
-
// 而实例代理的 get 先查 publicPropertiesMap、再落到 globalProperties。所以只有摘掉 `vue: '@vue/compat'`
|
|
102
|
-
// 别名之后它们才接管(也因此单独关 INSTANCE_SET 开关没用:compat 的 getter 会直接 assert 抛错,
|
|
103
|
-
// 不会回退到这里)。审计工具见 .claude/recon/audit-pageconfig-js.mjs。
|
|
104
|
-
gp.$set = (target, key, val) => {
|
|
105
|
-
target[key] = val
|
|
106
|
-
return target[key]
|
|
107
|
-
}
|
|
108
|
-
gp.$delete = (target, key) => {
|
|
109
|
-
delete target[key]
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
// T33(关 compat):Vue2 的 `$attrs` **不含 class / style**,Vue3 的**含**。
|
|
113
|
-
// 本仓有 43 个容器组件把 `$attrs` 级联转发给子组件(`<epx-component v-bind="$forwardAttrs($attrs)" v-for=...>`
|
|
114
|
-
// 这类)——转发给子组件的 attrs 本来就不该带 class/style,否则容器自己根上的 class 会被
|
|
115
|
-
// **复制到它的每个子组件**上。compat 在时 $attrs 不含 class 才没暴露。
|
|
116
|
-
// 用法:`v-bind="$forwardAttrs($attrs)"`(模板)/ `{...this.$forwardAttrs(this.$attrs)}`(JSX)。
|
|
117
|
-
//
|
|
118
|
-
// 例外:**透明代理**组件(epx-component、designer 的 widget-preview)职责就是把父级的 class
|
|
119
|
-
// 送到它渲染的那个叶子组件根上,必须保留原始 `$attrs`。
|
|
120
|
-
gp.$forwardAttrs = (attrs) => {
|
|
121
|
-
if (!attrs) return attrs
|
|
122
|
-
// eslint-disable-next-line no-unused-vars
|
|
123
|
-
const { class: _class, style: _style, ...rest } = attrs
|
|
124
|
-
return rest
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
// 全局指令 + 事件总线(app.use 调 plugin.install(app))
|
|
128
|
-
// T29:Element Plus(取代 element-ui)。必须走 app.use —— EP 的 install 签名是 install(app),
|
|
129
|
-
// 接不上 plugins/index.js 那条 compat 的 module-level `Vue.use` 链。
|
|
130
|
-
installElementPlus(app)
|
|
131
|
-
// Vant 已整体移除(P2c):113 个组件的移动端形态改由 packages/components/src/mobile/
|
|
132
|
-
// 下的自建原子件 + Element Plus 承担,不再有第三方移动组件库。
|
|
133
|
-
// T33:113 个 epx 组件的注册。原为 frame.js 里的 module-level `Vue.use(Frame)`(import 期执行,
|
|
134
|
-
// 那时 app 还没建)→ 改成显式调用。必须在 setApp(app) 之后。
|
|
135
|
-
installFrameComponents(app)
|
|
136
|
-
|
|
137
|
-
app.use(directive)
|
|
138
|
-
app.use(bus)
|
|
139
|
-
|
|
140
|
-
// 安装全局方法到 app.config.globalProperties(共享,不占用每个实例内存)
|
|
141
|
-
installGlobalMethods(app)
|
|
142
|
-
|
|
143
|
-
// 平台导航服务:菜单直达(toMenu/menuUrl/currentMenuKey)+ 角色持久化(role.get/set)。
|
|
144
|
-
// 只依赖 store/router 单例,组件外也可 import { nav } from '@epxing/core/src/navigation'
|
|
145
|
-
app.config.globalProperties.$nav = nav
|
|
146
|
-
|
|
147
|
-
// 只混入必要的响应式数据(props, computed, data, inject)
|
|
148
|
-
app.mixin(optimizedGlobalMixin)
|
|
149
|
-
|
|
150
|
-
// T30b:i18n app 化——先建实例(供 mixin beforeCreate 回退读取),再 app.use 装 mixin/$i18n
|
|
151
|
-
globalThis.i18n = new I18n({})
|
|
152
|
-
app.use(I18n)
|
|
153
|
-
|
|
154
|
-
// T30b:popup app 化($popup 走 globalProperties,弹窗经 createVNode+appContext 共享主 app 上下文)
|
|
155
|
-
app.use(PopupInstall)
|
|
156
|
-
publishCoreRuntime()
|
|
157
|
-
}
|
|
1
|
+
import { publishCoreRuntime } from './index'
|
|
2
|
+
// 平台入口(main.js)与库工厂入口(createApp.js)共享的框架安装逻辑。
|
|
3
|
+
//
|
|
4
|
+
// T06:抽出本文件统一两个入口,消除"漂移"。此前 createApp.js(lib 入口)相比 main.js 缺:
|
|
5
|
+
// - Vue.prototype.xss → lib 模式下 115 处 v-html 因 `xss is undefined` 全炸 🔴
|
|
6
|
+
// - import 'default-passive-events' → 移动端 passive 事件警告 🔴
|
|
7
|
+
// - $_ 的 set / get / camelCase / mergeWith → 调用处 undefined 🔴
|
|
8
|
+
// 现在两个入口都走本文件,行为以 main.js(生产验证过)为准,上述漂移自动修复。
|
|
9
|
+
// 详见 docs/migration/analysis/entry-points-audit.md
|
|
10
|
+
//
|
|
11
|
+
// 注:FieldFactory 经 @/utils barrel(→ ./fieldFactory,小写)引入,
|
|
12
|
+
// 避免 createApp 旧写法 '@/utils/FieldFactory'(大写)在区分大小写的 Linux/CI 上解析失败。
|
|
13
|
+
|
|
14
|
+
import { newXss } from './xss'
|
|
15
|
+
import axios from '@epxing/core/src/axios'
|
|
16
|
+
import http from '@epxing/core/src/api'
|
|
17
|
+
import { FieldFactory, util, PdfViewer, pdfViewer } from '@epxing/utils/src/legacy'
|
|
18
|
+
import {
|
|
19
|
+
isEmpty, isObject, isNil, cloneDeep, isEqual, isMatch,
|
|
20
|
+
debounce, throttle, assignWith, mergeWith, findLastIndex,
|
|
21
|
+
set, get, camelCase
|
|
22
|
+
} from 'lodash-es'
|
|
23
|
+
import cookie from '@epxing/utils/src/storage' // Web Storage 兼容层(js-cookie 同形 API,不读写浏览器 Cookie)
|
|
24
|
+
// $moment 现在是基于 dayjs 的兼容层(locale 在该模块内部设置,这里不用再管)。
|
|
25
|
+
import moment from '@epxing/utils/src/moment-compat'
|
|
26
|
+
import bus from '@epxing/core/src/vue.bus'
|
|
27
|
+
import '@epxing/core/src/plugins'
|
|
28
|
+
import { installFrameComponents } from '@epxing/core/src/plugins/frame'
|
|
29
|
+
import '@epxing/theme/src/index.scss'
|
|
30
|
+
// EP 官方暗黑色板(变量挂 html.dark;主题应用处在 data-theme=dark 时同步该 class)
|
|
31
|
+
import 'element-plus/theme-chalk/dark/css-vars.css'
|
|
32
|
+
import I18n from '@epxing/core/src/plugins/i18n'
|
|
33
|
+
import installElementPlus from '@epxing/core/src/plugins/element-plus'
|
|
34
|
+
import { setApp } from '@epxing/core/src/app'
|
|
35
|
+
import PopupInstall from '@epxing/business/src/popup.js'
|
|
36
|
+
import directive from '@epxing/core/src/directives/global'
|
|
37
|
+
import loadComponentFactory from '@epxing/core/src/loadComponent'
|
|
38
|
+
import 'default-passive-events'
|
|
39
|
+
// 优化后的全局混入:将方法挂载到原型,只混入响应式数据
|
|
40
|
+
import { installGlobalMethods } from '@epxing/core/src/mixins/methods-to-prototype'
|
|
41
|
+
import nav from '@epxing/core/src/navigation'
|
|
42
|
+
import optimizedGlobalMixin from '@epxing/core/src/mixins/optimized-global'
|
|
43
|
+
|
|
44
|
+
// lodash 子集:同时用于 Vue.prototype.$_ 与对外 export(含 set/get/camelCase/mergeWith)
|
|
45
|
+
export const lodash = {
|
|
46
|
+
isEmpty,
|
|
47
|
+
isObject,
|
|
48
|
+
isNil,
|
|
49
|
+
isEqual,
|
|
50
|
+
isMatch,
|
|
51
|
+
cloneDeep,
|
|
52
|
+
debounce,
|
|
53
|
+
throttle,
|
|
54
|
+
assignWith,
|
|
55
|
+
mergeWith,
|
|
56
|
+
findLastIndex,
|
|
57
|
+
set,
|
|
58
|
+
get,
|
|
59
|
+
camelCase
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export { newXss } from './xss'
|
|
63
|
+
|
|
64
|
+
export { axios, http, util, moment, cookie, PdfViewer, pdfViewer }
|
|
65
|
+
|
|
66
|
+
// T30b app 化后按 app 幂等(原 boolean 是 Vue 全局单次;现每个 app 各装一次,
|
|
67
|
+
// 同一 app 重复调用仍只装一次——lib 工厂多次 createApp() 时各 app 都能拿到框架)
|
|
68
|
+
const installedApps = new WeakSet()
|
|
69
|
+
|
|
70
|
+
// 把框架安装到 app(注入 globalProperties / 指令 / 全局方法 / 混入)。幂等:仅执行一次。
|
|
71
|
+
// T30b GLOBAL_PROTOTYPE app 化:接 app 实例,`Vue.prototype.X`→`app.config.globalProperties.X`、
|
|
72
|
+
// `Vue.use`→`app.use`、`Vue.mixin`→`app.mixin`(Vue3 全局 API 移到 app,摘 compat GLOBAL_PROTOTYPE/
|
|
73
|
+
// GLOBAL_MIXIN 桥)。注:module-level 的 plugins/frame/popup(element/vant/$popup)仍在 compat Vue
|
|
74
|
+
// 全局注册(随后续/EP 处理),与本 app 化并存(compat 桥接到同一 app)。
|
|
75
|
+
export default function installFrame (app) {
|
|
76
|
+
if (installedApps.has(app)) return
|
|
77
|
+
installedApps.add(app)
|
|
78
|
+
|
|
79
|
+
// T33:登记 app 单例。Vue3 没有全局 Vue.component/Vue.use,而页面配置驱动的动态组件查询、
|
|
80
|
+
// 远端 library 的运行时注册都需要「在任意位置拿到 app」。见 @epxing/core/src/app。
|
|
81
|
+
setApp(app)
|
|
82
|
+
|
|
83
|
+
const gp = app.config.globalProperties
|
|
84
|
+
gp.xss = newXss
|
|
85
|
+
gp.$http = http
|
|
86
|
+
gp.$axios = axios
|
|
87
|
+
gp.$FieldFactory = FieldFactory
|
|
88
|
+
gp.$PdfViewer = PdfViewer
|
|
89
|
+
gp.$pdfViewer = pdfViewer
|
|
90
|
+
gp.$util = util
|
|
91
|
+
gp.$_ = lodash
|
|
92
|
+
gp.$cookie = cookie
|
|
93
|
+
gp.$moment = moment
|
|
94
|
+
gp.$loadComponent = loadComponentFactory(app)
|
|
95
|
+
|
|
96
|
+
// T32:数据库存量页面脚本(FM_PAGE_CONFIG.CONTENT 里的 compileJS,component.js 里 eval 后作为
|
|
97
|
+
// pageEvents 挂在页面实例上)用了 287 处 `$set`(60 个页面)。Vue3 无 $set/$delete。
|
|
98
|
+
// 实现照抄 @vue/compat 的语义(`target[key] = val` / `delete target[key]`,不对数组做 splice)。
|
|
99
|
+
//
|
|
100
|
+
// 注意:**compat 在时这两个是休眠的** —— @vue/compat 把 $set/$delete 放进 publicPropertiesMap,
|
|
101
|
+
// 而实例代理的 get 先查 publicPropertiesMap、再落到 globalProperties。所以只有摘掉 `vue: '@vue/compat'`
|
|
102
|
+
// 别名之后它们才接管(也因此单独关 INSTANCE_SET 开关没用:compat 的 getter 会直接 assert 抛错,
|
|
103
|
+
// 不会回退到这里)。审计工具见 .claude/recon/audit-pageconfig-js.mjs。
|
|
104
|
+
gp.$set = (target, key, val) => {
|
|
105
|
+
target[key] = val
|
|
106
|
+
return target[key]
|
|
107
|
+
}
|
|
108
|
+
gp.$delete = (target, key) => {
|
|
109
|
+
delete target[key]
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
// T33(关 compat):Vue2 的 `$attrs` **不含 class / style**,Vue3 的**含**。
|
|
113
|
+
// 本仓有 43 个容器组件把 `$attrs` 级联转发给子组件(`<epx-component v-bind="$forwardAttrs($attrs)" v-for=...>`
|
|
114
|
+
// 这类)——转发给子组件的 attrs 本来就不该带 class/style,否则容器自己根上的 class 会被
|
|
115
|
+
// **复制到它的每个子组件**上。compat 在时 $attrs 不含 class 才没暴露。
|
|
116
|
+
// 用法:`v-bind="$forwardAttrs($attrs)"`(模板)/ `{...this.$forwardAttrs(this.$attrs)}`(JSX)。
|
|
117
|
+
//
|
|
118
|
+
// 例外:**透明代理**组件(epx-component、designer 的 widget-preview)职责就是把父级的 class
|
|
119
|
+
// 送到它渲染的那个叶子组件根上,必须保留原始 `$attrs`。
|
|
120
|
+
gp.$forwardAttrs = (attrs) => {
|
|
121
|
+
if (!attrs) return attrs
|
|
122
|
+
// eslint-disable-next-line no-unused-vars
|
|
123
|
+
const { class: _class, style: _style, ...rest } = attrs
|
|
124
|
+
return rest
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
// 全局指令 + 事件总线(app.use 调 plugin.install(app))
|
|
128
|
+
// T29:Element Plus(取代 element-ui)。必须走 app.use —— EP 的 install 签名是 install(app),
|
|
129
|
+
// 接不上 plugins/index.js 那条 compat 的 module-level `Vue.use` 链。
|
|
130
|
+
installElementPlus(app)
|
|
131
|
+
// Vant 已整体移除(P2c):113 个组件的移动端形态改由 packages/components/src/mobile/
|
|
132
|
+
// 下的自建原子件 + Element Plus 承担,不再有第三方移动组件库。
|
|
133
|
+
// T33:113 个 epx 组件的注册。原为 frame.js 里的 module-level `Vue.use(Frame)`(import 期执行,
|
|
134
|
+
// 那时 app 还没建)→ 改成显式调用。必须在 setApp(app) 之后。
|
|
135
|
+
installFrameComponents(app)
|
|
136
|
+
|
|
137
|
+
app.use(directive)
|
|
138
|
+
app.use(bus)
|
|
139
|
+
|
|
140
|
+
// 安装全局方法到 app.config.globalProperties(共享,不占用每个实例内存)
|
|
141
|
+
installGlobalMethods(app)
|
|
142
|
+
|
|
143
|
+
// 平台导航服务:菜单直达(toMenu/menuUrl/currentMenuKey)+ 角色持久化(role.get/set)。
|
|
144
|
+
// 只依赖 store/router 单例,组件外也可 import { nav } from '@epxing/core/src/navigation'
|
|
145
|
+
app.config.globalProperties.$nav = nav
|
|
146
|
+
|
|
147
|
+
// 只混入必要的响应式数据(props, computed, data, inject)
|
|
148
|
+
app.mixin(optimizedGlobalMixin)
|
|
149
|
+
|
|
150
|
+
// T30b:i18n app 化——先建实例(供 mixin beforeCreate 回退读取),再 app.use 装 mixin/$i18n
|
|
151
|
+
globalThis.i18n = new I18n({})
|
|
152
|
+
app.use(I18n)
|
|
153
|
+
|
|
154
|
+
// T30b:popup app 化($popup 走 globalProperties,弹窗经 createVNode+appContext 共享主 app 上下文)
|
|
155
|
+
app.use(PopupInstall)
|
|
156
|
+
publishCoreRuntime()
|
|
157
|
+
}
|