xframelib 1.1.1 → 1.1.2
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/README.md +181 -189
- package/README_zh.md +204 -0
- package/dist/assets/worker-iconv-KS7y7NCM.js +5405 -0
- package/dist/assets/worker-webcache-DX6bhBzy.js +956 -0
- package/dist/assets/worker-xmath-CbuRtVJ1.js +450 -0
- package/dist/index.css +1 -408
- package/dist/index.js +1 -12
- package/dist/{controls → src/controls}/ADivider.vue.d.ts +8 -12
- package/dist/src/controls/ScaleContainer/index.vue.d.ts +13 -0
- package/dist/src/controls/ScrollSnapContainer/index.vue.d.ts +25 -0
- package/dist/src/controls/index.d.ts +6 -0
- package/dist/{controls → src/controls}/layoutcontainer/LayoutManager.d.ts +8 -2
- package/dist/{controls → src/controls}/layoutcontainer/layout.vue.d.ts +22 -35
- package/dist/src/controls/popover/index.vue.d.ts +33 -0
- package/dist/src/controls/routertransition/RouterTransition.vue.d.ts +3 -0
- package/dist/src/controls/routertransition/RouterTransitionAnimate.vue.d.ts +10 -0
- package/dist/{controls → src/controls}/routertransition/SuspenseWithError.vue.d.ts +3 -2
- package/dist/{controls → src/controls}/splitpanes/pane.vue.d.ts +3 -2
- package/dist/{controls → src/controls}/splitpanes/splitpanes.vue.d.ts +3 -2
- package/dist/{controls → src/controls}/xwindow/XWindow.vue.d.ts +10 -19
- package/dist/{controls → src/controls}/xwindow/XWindowManager.d.ts +3 -3
- package/dist/src/controls/xwindow/index.d.ts +3 -0
- package/dist/src/directives/dbClickDirective.d.ts +5 -0
- package/dist/src/directives/index.d.ts +7 -0
- package/dist/src/directives/mediaDirective.d.ts +7 -0
- package/dist/{utils → src/utils}/H5Tool.d.ts +18 -7
- package/dist/{utils → src/utils}/IsTool.d.ts +4 -0
- package/dist/src/utils/Screen.d.ts +30 -0
- package/dist/{utils → src/utils}/WebCacheTool.d.ts +1 -1
- package/dist/{utils → src/utils}/index.d.ts +1 -0
- package/dist/src/workers/index.d.ts +13 -0
- package/package.json +25 -23
- package/dist/assets/worker-iconv-BsNle8M5.js +0 -22
- package/dist/assets/worker-webcache-CkCFZE0-.js +0 -6
- package/dist/assets/worker-xmath-AxRk6MsK.js +0 -6
- package/dist/controls/index.d.ts +0 -3
- package/dist/controls/routertransition/RouterTransition.vue.d.ts +0 -2
- package/dist/controls/routertransition/RouterTransitionAnimate.vue.d.ts +0 -9
- package/dist/controls/xwindow/index.d.ts +0 -3
- package/dist/directives/index.d.ts +0 -4
- package/dist/workers/index.d.ts +0 -19
- /package/dist/{api → src/api}/Token.d.ts +0 -0
- /package/dist/{api → src/api}/User.d.ts +0 -0
- /package/dist/{api → src/api}/index.d.ts +0 -0
- /package/dist/{controls → src/controls}/layoutcontainer/index.d.ts +0 -0
- /package/dist/{controls → src/controls}/routertransition/index.d.ts +0 -0
- /package/dist/{controls → src/controls}/splitpanes/index.d.ts +0 -0
- /package/dist/{core → src/core}/Global.d.ts +0 -0
- /package/dist/{core → src/core}/IModel.d.ts +0 -0
- /package/dist/{core → src/core}/Init.d.ts +0 -0
- /package/dist/{core → src/core}/MsgHelper.d.ts +0 -0
- /package/dist/{core → src/core}/SysEvents.d.ts +0 -0
- /package/dist/{core → src/core}/index.d.ts +0 -0
- /package/dist/{directives → src/directives}/dragDirective.d.ts +0 -0
- /package/dist/{directives/repeatClick.d.ts → src/directives/repeatClickDirective.d.ts} +0 -0
- /package/dist/{directives → src/directives}/wowDirective.d.ts +0 -0
- /package/dist/{hprose → src/hprose}/HproseClient.d.ts +0 -0
- /package/dist/{hprose → src/hprose}/HproseIO.d.ts +0 -0
- /package/dist/{hprose → src/hprose}/ProxyClient.d.ts +0 -0
- /package/dist/{hprose → src/hprose}/index.d.ts +0 -0
- /package/dist/{index.d.ts → src/index.d.ts} +0 -0
- /package/dist/{mitt → src/mitt}/index.d.ts +0 -0
- /package/dist/{model → src/model}/Config.d.ts +0 -0
- /package/dist/{model → src/model}/Constants.d.ts +0 -0
- /package/dist/{model → src/model}/IModalModels.d.ts +0 -0
- /package/dist/{model → src/model}/IRole.d.ts +0 -0
- /package/dist/{model → src/model}/ITypes.d.ts +0 -0
- /package/dist/{model → src/model}/IUserModel.d.ts +0 -0
- /package/dist/{model → src/model}/IWidgetMenu.d.ts +0 -0
- /package/dist/{model → src/model}/Layout.d.ts +0 -0
- /package/dist/{model → src/model}/index.d.ts +0 -0
- /package/dist/{permission → src/permission}/RoleSysRightHelper.d.ts +0 -0
- /package/dist/{permission → src/permission}/filter.d.ts +0 -0
- /package/dist/{permission → src/permission}/index.d.ts +0 -0
- /package/dist/{permission → src/permission}/register.d.ts +0 -0
- /package/dist/{permission → src/permission}/right.d.ts +0 -0
- /package/dist/{plugins → src/plugins}/NavigatorPlugin.d.ts +0 -0
- /package/dist/{plugins → src/plugins}/index.d.ts +0 -0
- /package/dist/{utils → src/utils}/AutoUpdate.d.ts +0 -0
- /package/dist/{utils → src/utils}/AxiosHelper.d.ts +0 -0
- /package/dist/{utils → src/utils}/BigFileDownload.d.ts +0 -0
- /package/dist/{utils → src/utils}/CodeHelper.d.ts +0 -0
- /package/dist/{utils → src/utils}/Color.d.ts +0 -0
- /package/dist/{utils → src/utils}/CommonTool.d.ts +0 -0
- /package/dist/{utils → src/utils}/DayjsTool.d.ts +0 -0
- /package/dist/{utils → src/utils}/FetchHelper.d.ts +0 -0
- /package/dist/{utils → src/utils}/FileDownload.d.ts +0 -0
- /package/dist/{utils → src/utils}/FileUpload.d.ts +0 -0
- /package/dist/{utils → src/utils}/FileUpload_/346/227/247.d.ts" +0 -0
- /package/dist/{utils → src/utils}/FilenameUtils.d.ts +0 -0
- /package/dist/{utils → src/utils}/GzipTool.d.ts +0 -0
- /package/dist/{utils → src/utils}/JQuery.d.ts +0 -0
- /package/dist/{utils → src/utils}/LocalForageHelper.d.ts +0 -0
- /package/dist/{utils → src/utils}/LockHelper.d.ts +0 -0
- /package/dist/{utils → src/utils}/RouterURLTool.d.ts +0 -0
- /package/dist/{utils → src/utils}/SignalrClient.d.ts +0 -0
- /package/dist/{utils → src/utils}/Storage.d.ts +0 -0
- /package/dist/{utils → src/utils}/StringUtils.d.ts +0 -0
- /package/dist/{utils → src/utils}/Time.d.ts +0 -0
- /package/dist/{utils → src/utils}/TokenHelper.d.ts +0 -0
- /package/dist/{utils → src/utils}/ValidateTool.d.ts +0 -0
- /package/dist/{utils → src/utils}/WarGridTool.d.ts +0 -0
- /package/dist/{utils → src/utils}/WaterMark.d.ts +0 -0
- /package/dist/{utils → src/utils}/WidgetsTool.d.ts +0 -0
- /package/dist/{utils → src/utils}/XXTEA.d.ts +0 -0
- /package/dist/{utils → src/utils}/ZipTool.d.ts +0 -0
- /package/dist/{utils → src/utils}/uuid.d.ts +0 -0
- /package/dist/{workers → src/workers}/worker-iconv.d.ts +0 -0
- /package/dist/{workers → src/workers}/worker-webcache.d.ts +0 -0
- /package/dist/{workers → src/workers}/worker-xmath.d.ts +0 -0
- /package/dist/{workerservice → src/workerservice}/frontWorker.d.ts +0 -0
- /package/dist/{workerservice → src/workerservice}/index.d.ts +0 -0
package/README.md
CHANGED
|
@@ -2,153 +2,112 @@
|
|
|
2
2
|
|
|
3
3
|
<p>
|
|
4
4
|
<a href="https://www.npmjs.com/package/xframelib" target="_blank">
|
|
5
|
-
|
|
5
|
+
<img src="https://img.shields.io/npm/v/xframelib?color=orange&logo=npm" />
|
|
6
6
|
</a>
|
|
7
7
|
<a href="https://www.npmjs.com/package/xframelib" target="_blank">
|
|
8
|
-
|
|
8
|
+
<img src="https://img.shields.io/npm/dt/xframelib?logo=npm" />
|
|
9
9
|
</a>
|
|
10
10
|
</p>
|
|
11
11
|
|
|
12
|
-
## XFramelib
|
|
13
|
-
|
|
14
|
-
>
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
-
|
|
21
|
-
|
|
22
|
-
-
|
|
23
|
-
|
|
24
|
-
-
|
|
25
|
-
|
|
26
|
-
-
|
|
27
|
-
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
-
|
|
32
|
-
|
|
33
|
-
-
|
|
34
|
-
|
|
35
|
-
-
|
|
36
|
-
|
|
37
|
-
-
|
|
38
|
-
|
|
39
|
-
-
|
|
40
|
-
-
|
|
41
|
-
|
|
42
|
-
-
|
|
43
|
-
|
|
44
|
-
-
|
|
45
|
-
-
|
|
46
|
-
|
|
47
|
-
-
|
|
48
|
-
|
|
49
|
-
-
|
|
50
|
-
|
|
51
|
-
-
|
|
52
|
-
|
|
53
|
-
-
|
|
54
|
-
|
|
55
|
-
-
|
|
56
|
-
|
|
57
|
-
-
|
|
58
|
-
|
|
59
|
-
-
|
|
60
|
-
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
-
|
|
65
|
-
|
|
66
|
-
-
|
|
67
|
-
|
|
68
|
-
-
|
|
69
|
-
|
|
70
|
-
-
|
|
71
|
-
-
|
|
72
|
-
|
|
73
|
-
-
|
|
74
|
-
|
|
75
|
-
-
|
|
76
|
-
|
|
77
|
-
-
|
|
78
|
-
-
|
|
79
|
-
|
|
80
|
-
-
|
|
81
|
-
|
|
82
|
-
-
|
|
83
|
-
|
|
84
|
-
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
- v0.3.8 取消 init 方法传入 axios 对象(改为内部自带 Global.Axios);完善 AxiosHelper 工具类;增加大文件分片/断点续传下载类 BigFileDownload;
|
|
88
|
-
- v0.3.7 增加 LockHelper 长时间操作退出登录,增加 SystemConfig.UI.LockTime 可选配置和接口 onLockListener、 unLockListener、getLockState;
|
|
89
|
-
- v0.3.6 H5Tool 增加基于 SparkMD5 的 MD5 计算;解决 TokenHelper 与 Global 循环引用问题;增加模仿 JQuery 的 HTML 元素 Style 类名操作 hasClass、addClass、removeClass、toggleClass;完善 getProxyClient 支持 Map 缓存 HproseProxy 对象
|
|
90
|
-
- v0.3.5 增加大文件切片上传 FileUpload;增加 newGuid 方法;
|
|
91
|
-
修改 requestPost 使用 FormData 方式提交数据,增加 requestPostBody 使用 JSON 方式提交;
|
|
92
|
-
移除 UserCookies 和 JS-js-cookie 依赖;
|
|
93
|
-
H5Tool 增加 getFileShortMD5 获取文件 MD5 值,增加 getObjectURL 获取 File 对象的路径;
|
|
94
|
-
- v0.3.4 增加统一用户登录和 Token 支持;解决类循环引用问题;增加系统配置参数为具体接口
|
|
95
|
-
- v0.3.3 解决 支持 Hprose 旧版本不支持 useServiceAsync 的问题
|
|
96
|
-
- v0.3.2 解决 0.3.1 版本更新错误(导致 HproseClient 无法实例化的问题)
|
|
97
|
-
- v0.3.1 修改系统 DefaultProxyClient 初始化弹框报错问题(DefaultHproseAPI 配置项可为空或不设置);增加 getProxyClient 和 initDefaultProxyClient 全局方法。
|
|
98
|
-
- v0.3.0 修改 UserCookies 支持自定义 KEY;修改 H5Tool 增强全屏操作功能方法;升级依赖的基础库
|
|
99
|
-
- v0.2.9 删除 uuid 的 NPM 包,增加 uuid 工具类,解决类型问题
|
|
100
|
-
- v0.2.8 删除对 axios 的依赖(因 axios 使用了 process 对象,vue 中报错)
|
|
101
|
-
- v0.2.7 增加 VUE WINDOW,FileDownload 等,打包入 axios(出现问题)
|
|
102
|
-
- v0.2.6 新建前端 xframelib,支持 VUE 组件打包基于 ESbuild
|
|
103
|
-
- v0.2.5 减小发布包大小,外部依赖 hprose
|
|
104
|
-
- v0.2.4 正式应用于项目中,提供.d.ts 声明文件。
|
|
105
|
-
|
|
106
|
-
## 主要功能:
|
|
107
|
-
|
|
108
|
-
- 网站系统配置Sysconfig.js对应的Global.Config
|
|
109
|
-
- 公共事件总线Global.EventBus
|
|
110
|
-
- Layout布局容器和Widget机制实现
|
|
111
|
-
- Axios的Http请求封装实现Global.Axios、AxiosHelper{get, post, requestPost, requestGet, getData, requestPostBody}
|
|
112
|
-
- Hprose Proxy方式调用后台Hprose服务实现
|
|
113
|
-
- 与用户系统后台服务适配的Token验证/刷新和角色权限过滤
|
|
114
|
-
- 大文件下载BigFileDownload
|
|
115
|
-
- 普通文件下载FileDownload封装{ Download, SaveAs, JsonDownload, HttpDownload, DownloadByUrl }
|
|
116
|
-
- 大文件上传FileUpload
|
|
117
|
-
- H5Tool常用小功能
|
|
118
|
-
- SignalrClient
|
|
119
|
-
- JQuery工具 (hasClass 、addClass、removeClass、toggleClass、setCssProperty)
|
|
120
|
-
- StorageHelper 本地缓存对象
|
|
121
|
-
- IsTool类型判断工具(数字、字符串、对象、数组、函数等)
|
|
122
|
-
- ValidateTool验证工具(身份证、手机号、IP地址、邮箱、密码强度判断、URL、车牌号等)
|
|
123
|
-
- 与后端配合使用的加密解密算法XXTEA
|
|
124
|
-
- 前端缓存功能(WebCacheTool和webCacheWorker)
|
|
125
|
-
- maplibre加载大图展示(使用bigImageWorker)
|
|
126
|
-
|
|
127
|
-
## 使用
|
|
12
|
+
## XFramelib Front-End Basic Library
|
|
13
|
+
|
|
14
|
+
> The core implementation is an enterprise-level micro-front-end architecture based on a Widget mechanism. It accumulates basic functions and components independent of UI interface libraries, improves the stability and high reusability of the basic code, and adheres to the philosophy of originating from and serving projects.
|
|
15
|
+
|
|
16
|
+
[README中文.md](./README_zh.md) | [更新日志-中文](https://share.note.youdao.com/s/MrahKIVA)
|
|
17
|
+
|
|
18
|
+
## Main Functions:
|
|
19
|
+
|
|
20
|
+
- System configuration Sysconfig.js, corresponding Global.Config object
|
|
21
|
+
|
|
22
|
+
- LayoutManager: Implements the Widget scheduling mechanism
|
|
23
|
+
|
|
24
|
+
- Global.EventBus: Public event bus
|
|
25
|
+
|
|
26
|
+
- UI Components:
|
|
27
|
+
- LayoutContainer (Layout container)
|
|
28
|
+
|
|
29
|
+
- ScaleContainer (Scale container)
|
|
30
|
+
|
|
31
|
+
- XWindow (Window-like component)
|
|
32
|
+
|
|
33
|
+
- SplitPanes (Page area splitting panel)
|
|
34
|
+
|
|
35
|
+
- Popover (Floating panel)
|
|
36
|
+
|
|
37
|
+
- RouterTransition related components
|
|
38
|
+
|
|
39
|
+
- Backend Service Calls:
|
|
40
|
+
- HTTP Web Requests: Axios encapsulation implementation Global.Axios, AxiosHelper{get, post, requestPost, requestGet, getData, requestPostBody}
|
|
41
|
+
|
|
42
|
+
- Hprose Service: Hprose Proxy method to call the backend hprose service
|
|
43
|
+
|
|
44
|
+
- Common Basic Functions:
|
|
45
|
+
- H5Tool :General functions
|
|
46
|
+
|
|
47
|
+
- IsTool :type detection tool (number, string, object, array, function, etc.)
|
|
48
|
+
|
|
49
|
+
- ValidateTool: verification tool (ID card, mobile phone number, IP address, email, password strength judgment, URL, license plate number, etc.)
|
|
50
|
+
|
|
51
|
+
- jQuery:jquery tools (hasClass, addClass, removeClass, toggleClass, setCssProperty)
|
|
52
|
+
|
|
53
|
+
- Compression and decompression tools: ZipTool and GzipTool
|
|
54
|
+
|
|
55
|
+
- Caching functions: StorageHelper for operating local cache objects, WebCacheTool for front-end caching
|
|
56
|
+
|
|
57
|
+
- XXTEA encryption and decryption algorithm
|
|
58
|
+
|
|
59
|
+
- Commands: (Register and load commands using setupDirectives)
|
|
60
|
+
- v-wow tiled scrolling display
|
|
61
|
+
|
|
62
|
+
- v-media adaptive style
|
|
63
|
+
|
|
64
|
+
- v-drag draggable
|
|
65
|
+
|
|
66
|
+
- v-repeatClick to avoid repeated clicks
|
|
67
|
+
|
|
68
|
+
- v-dc double-click command
|
|
69
|
+
|
|
70
|
+
- File upload and download:
|
|
71
|
+
- BigFileDownload: large file download
|
|
72
|
+
|
|
73
|
+
- FileUpload: large file upload
|
|
74
|
+
|
|
75
|
+
- FileDownload Encapsulated for regular file downloads, including { Download, SaveAs, JsonDownload, HttpDownload, DownloadByUrl }
|
|
76
|
+
|
|
77
|
+
- WebWorkers:
|
|
78
|
+
- iconvWorker: Text encoding/decoding
|
|
79
|
+
|
|
80
|
+
- webCacheWorker: Front-end caching layer
|
|
81
|
+
|
|
82
|
+
- xmathWorker: General mathematical calculations, large front-end images, tiled loading
|
|
83
|
+
|
|
84
|
+
- NavigatorPlugin :Browser plugin(provides general browser global method encapsulation)
|
|
85
|
+
|
|
86
|
+
## Usage
|
|
128
87
|
|
|
129
88
|
`pnpm add xframelib`
|
|
130
89
|
|
|
131
90
|
or
|
|
132
|
-
|
|
133
91
|
`npm i xframelib`
|
|
134
92
|
|
|
135
|
-
|
|
93
|
+
Globally import library styles:
|
|
136
94
|
|
|
137
95
|
import 'xframelib/dist/index.css';
|
|
138
96
|
|
|
139
|
-
-
|
|
97
|
+
- Open source application example: **Front-end development template vue-widget-template**
|
|
140
98
|
|
|
141
99
|
https://github.com/zorrowm/vue-widget-template
|
|
142
100
|
|
|
143
|
-
|
|
101
|
+
A development template fully based on XFramelib and Widget concepts
|
|
144
102
|
|
|
145
|
-
- **main.ts
|
|
146
|
-
In Typescript:
|
|
103
|
+
- **main.ts file**
|
|
147
104
|
|
|
148
|
-
|
|
105
|
+
In Typescript:
|
|
106
|
+
|
|
107
|
+
```ts
|
|
149
108
|
import { createApp } from 'vue';
|
|
150
109
|
import App from './App.vue';
|
|
151
|
-
|
|
110
|
+
//added by template
|
|
152
111
|
import { setupRouter } from './router/index';
|
|
153
112
|
import {setupGlobDirectives} from './directives/index';
|
|
154
113
|
import { init, Global } from 'xframelib';
|
|
@@ -157,101 +116,134 @@ import { getSystemPKG, getSystemID } from '@/utils/sysTool';
|
|
|
157
116
|
import { createPinia } from 'pinia';
|
|
158
117
|
import { message } from 'ant-design-vue';
|
|
159
118
|
import {Icon} from '@iconify/vue';
|
|
160
|
-
//dev
|
|
119
|
+
//dev phase opens, build logs out
|
|
161
120
|
import 'ant-design-vue/dist/antd.css';
|
|
162
121
|
|
|
163
122
|
|
|
164
|
-
message.config({
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
123
|
+
message.config({
|
|
124
|
+
top: `100px`,
|
|
125
|
+
duration: 1, maxCount: 3
|
|
126
|
+
|
|
168
127
|
});
|
|
169
|
-
|
|
170
|
-
|
|
128
|
+
// Bind messages and initialize xframe
|
|
129
|
+
|
|
130
|
+
// System ID, unique identifier
|
|
131
|
+
|
|
171
132
|
const sysID = getSystemID();
|
|
172
|
-
|
|
133
|
+
|
|
134
|
+
// Group name, project name
|
|
135
|
+
|
|
173
136
|
const sysGroup = getSystemPKG().name;
|
|
137
|
+
|
|
174
138
|
init(message, sysID, sysGroup);
|
|
175
139
|
|
|
176
|
-
//
|
|
140
|
+
// Create a pinia instance
|
|
141
|
+
|
|
177
142
|
const pinia = createPinia();
|
|
143
|
+
|
|
178
144
|
const app = createApp(App);
|
|
179
|
-
|
|
145
|
+
|
|
146
|
+
// Mount to the Vue root instance
|
|
147
|
+
|
|
180
148
|
app.use(pinia);
|
|
181
|
-
|
|
149
|
+
|
|
150
|
+
// Define v-drag commands
|
|
151
|
+
|
|
182
152
|
setupGlobDirectives(app);
|
|
153
|
+
|
|
183
154
|
setupRouter(app);
|
|
184
|
-
//注册全局组件
|
|
185
|
-
app.component('Icon',Icon);
|
|
186
155
|
|
|
187
|
-
|
|
156
|
+
// Register global components
|
|
157
|
+
|
|
158
|
+
app.component('Icon', Icon);
|
|
188
159
|
|
|
160
|
+
app.mount('#app');
|
|
189
161
|
```
|
|
190
162
|
|
|
191
|
-
- **Quasar boot
|
|
163
|
+
- **Quasar boot usage example**
|
|
192
164
|
|
|
193
|
-
```
|
|
165
|
+
```ts
|
|
194
166
|
import { boot } from 'quasar/wrappers';
|
|
195
167
|
import { addAPIProvider, Icon } from '@iconify/vue';
|
|
196
168
|
import { Dropdown } from 'floating-vue';
|
|
197
169
|
import { EmitLoadingInfo } from 'src/events/index';
|
|
198
170
|
import { autoRefresh } from 'src/utils/autoUpdate';
|
|
199
171
|
import { message } from 'src/utils/MessageNotify';
|
|
200
|
-
|
|
172
|
+
|
|
173
|
+
// Encapsulated message notification
|
|
174
|
+
|
|
201
175
|
import { getSystemID, getSystemPKG } from 'src/utils/sysTool';
|
|
176
|
+
|
|
202
177
|
import { Global, init } from 'xframelib';
|
|
178
|
+
|
|
203
179
|
function preInit() {
|
|
204
180
|
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
181
|
+
// System ID, unique identifier
|
|
182
|
+
|
|
183
|
+
const sysID = getSystemID();
|
|
184
|
+
|
|
185
|
+
// Group name, project name
|
|
186
|
+
|
|
187
|
+
const sysGroup = getSystemPKG().name;
|
|
188
|
+
|
|
189
|
+
init(message, sysID, sysGroup);
|
|
190
|
+
|
|
191
|
+
// Mounting progress notification method
|
|
192
|
+
|
|
193
|
+
Global.Loading = EmitLoadingInfo;
|
|
194
|
+
|
|
195
|
+
// Register your own IconAPIProvider
|
|
196
|
+
|
|
197
|
+
if (Global.Config?.ServiceURL.IconServiceURL)
|
|
198
|
+
|
|
199
|
+
addAPIProvider('', {
|
|
200
|
+
|
|
201
|
+
resources: [Global.Config?.ServiceURL.IconServiceURL]
|
|
202
|
+
|
|
203
|
+
});
|
|
204
|
+
|
|
205
|
+
else {
|
|
206
|
+
|
|
207
|
+
//Offline icon usage: Enabled, IconServiceURL configuration is empty
|
|
208
|
+
|
|
209
|
+
import('../components/IconOffline').then((it) => {
|
|
210
|
+
|
|
211
|
+
it.default();
|
|
212
|
+
|
|
213
|
+
});
|
|
214
|
+
|
|
215
|
+
}
|
|
223
216
|
}
|
|
224
217
|
export default boot(({ app }) => {
|
|
225
|
-
EmitLoadingInfo('XFramelib库');
|
|
226
|
-
//初始化Xframelib
|
|
227
|
-
preInit();
|
|
228
|
-
//启动热更新监测
|
|
229
|
-
if (import.meta.env.DEV) autoRefresh();
|
|
230
|
-
// 创建pinia 实例——20240221这里不需要了,在src/stores/index.ts里挂接的
|
|
231
|
-
// const pinia = createPinia();
|
|
232
|
-
// app.use(pinia);
|
|
233
|
-
//注册全局组件
|
|
234
|
-
app.component('Icon', Icon);
|
|
235
|
-
app.component('VDropdown', Dropdown);
|
|
236
|
-
// app.component('VTooltip', Tooltip);
|
|
237
|
-
// app.component('VMenu', Menu);
|
|
238
|
-
|
|
239
|
-
//开发时,全局注册tiny组件
|
|
240
|
-
// if (import.meta.env.DEV) {
|
|
241
|
-
// // import('@opentiny/vue').then((it) => {
|
|
242
|
-
// // const TinyVue = it.default;
|
|
243
|
-
// // app.use(TinyVue);
|
|
244
|
-
// // });
|
|
245
|
-
// }
|
|
246
|
-
console.log('环境变量',process.env);
|
|
247
|
-
//保存网站根地址
|
|
248
|
-
app.config.globalProperties.$AppURL=process.env.APP_URL;
|
|
249
|
-
});
|
|
250
218
|
|
|
219
|
+
EmitLoadingInfo('XFramelib library');
|
|
220
|
+
|
|
221
|
+
//Initialize Xframelib
|
|
222
|
+
|
|
223
|
+
preInit();
|
|
224
|
+
|
|
225
|
+
//Start hot update monitoring
|
|
226
|
+
|
|
227
|
+
if (import.meta.env.DEV) autoRefresh();
|
|
228
|
+
|
|
229
|
+
// Create pinia instance — 20240221 is not needed here, it is attached in src/stores/index.ts
|
|
230
|
+
|
|
231
|
+
// Register global component
|
|
232
|
+
app.component('Icon', Icon); app.component('VDropdown', Dropdown);
|
|
233
|
+
// app.component('VTooltip', Tooltip);
|
|
234
|
+
// app.component('VMenu', Menu);
|
|
235
|
+
|
|
236
|
+
console.log('Environment Variables',process.env);
|
|
237
|
+
// Save the website root address
|
|
238
|
+
app.config.globalProperties.$AppURL=process.env.APP_URL;
|
|
239
|
+
|
|
240
|
+
});
|
|
251
241
|
```
|
|
252
242
|
|
|
253
|
-
## 应用示例
|
|
254
243
|
|
|
255
|
-

|
|
256
244
|
|
|
257
|
-
|
|
245
|
+
## Application Examples
|
|
246
|
+
|
|
247
|
+

|
|
248
|
+
|
|
249
|
+

|
package/README_zh.md
ADDED
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
# xframelib
|
|
2
|
+
|
|
3
|
+
<p>
|
|
4
|
+
<a href="https://www.npmjs.com/package/xframelib" target="_blank">
|
|
5
|
+
<img src="https://img.shields.io/npm/v/xframelib?color=orange&logo=npm" />
|
|
6
|
+
</a>
|
|
7
|
+
<a href="https://www.npmjs.com/package/xframelib" target="_blank">
|
|
8
|
+
<img src="https://img.shields.io/npm/dt/xframelib?logo=npm"/>
|
|
9
|
+
</a>
|
|
10
|
+
</p>
|
|
11
|
+
|
|
12
|
+
## XFramelib前端基础库
|
|
13
|
+
|
|
14
|
+
> 核心实现一套 Widget机制的企业级微前端架构,积累与UI界面库无关的基础功能和组件,提升基础代码稳定性和高复用度,秉持来源于项目和服务于项目理念。
|
|
15
|
+
|
|
16
|
+
[README中文.md](./README_zh.md) | [更新日志](https://share.note.youdao.com/s/MrahKIVA)
|
|
17
|
+
|
|
18
|
+
## 主要功能:
|
|
19
|
+
|
|
20
|
+
- Global.Config:对应public下的系统配置Sysconfig.js
|
|
21
|
+
|
|
22
|
+
- LayoutManager: 实现Widget调度机制
|
|
23
|
+
|
|
24
|
+
- Global.EventBus:公共事件总线
|
|
25
|
+
|
|
26
|
+
- UI组件:
|
|
27
|
+
|
|
28
|
+
- LayoutContainer (Layout布局容器)
|
|
29
|
+
- ScaleContainer(等比例整体缩放容器)
|
|
30
|
+
- XWindow (仿window窗体组件)
|
|
31
|
+
- SplitPanes( 页面区域分割面板)
|
|
32
|
+
- Popover(浮动面板)
|
|
33
|
+
- RouterTransition相关组件
|
|
34
|
+
|
|
35
|
+
- 后端服务调用:
|
|
36
|
+
|
|
37
|
+
- Http Web请求:Axios的封装实现Global.Axios、AxiosHelper{get, post, requestPost, requestGet, getData, requestPostBody}
|
|
38
|
+
- Hprose服务:Hprose Proxy方式调用后台hprose服务
|
|
39
|
+
|
|
40
|
+
- 常用基础功能:
|
|
41
|
+
|
|
42
|
+
- H5Tool通用基础功能
|
|
43
|
+
- IsTool类型判断工具(数字、字符串、对象、数组、函数等)
|
|
44
|
+
- ValidateTool验证工具(身份证、手机号、IP地址、邮箱、密码强度判断、URL、车牌号等)
|
|
45
|
+
- JQuery工具 (hasClass 、addClass、removeClass、toggleClass、setCssProperty)
|
|
46
|
+
- 压缩解压工具类:ZipTool和GzipTool
|
|
47
|
+
- 缓存功能:StorageHelper 操作本地缓存对象、WebCacheTool前端缓存功能
|
|
48
|
+
- XXTEA加密解密算法
|
|
49
|
+
|
|
50
|
+
- 指令:(使用setupDirectives进行注册加载指令)
|
|
51
|
+
|
|
52
|
+
- v-wow 分块滚动显示
|
|
53
|
+
- v-media 自适应样式
|
|
54
|
+
- v-drag 可拖拽
|
|
55
|
+
- v-repeatClick 避免重复点击
|
|
56
|
+
- v-dc 双击指令
|
|
57
|
+
|
|
58
|
+
- 文件上传下载
|
|
59
|
+
|
|
60
|
+
- BigFileDownload 大文件下载
|
|
61
|
+
- FileUpload 大文件上传
|
|
62
|
+
- FileDownload 普通文件下载封装,包括{ Download, SaveAs, JsonDownload, HttpDownload, DownloadByUrl }
|
|
63
|
+
|
|
64
|
+
- WebWorkers:
|
|
65
|
+
|
|
66
|
+
- iconvWorker 文本编码/解码
|
|
67
|
+
- webCacheWorker 前端缓存层
|
|
68
|
+
- xmathWorker 通用数学计算,前端大图片,瓦片化加载
|
|
69
|
+
|
|
70
|
+
- NavigatorPlugin浏览器插件(提供通用浏览器全局方法封装)
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
## 使用
|
|
75
|
+
|
|
76
|
+
`pnpm add xframelib`
|
|
77
|
+
|
|
78
|
+
or
|
|
79
|
+
|
|
80
|
+
`npm i xframelib`
|
|
81
|
+
|
|
82
|
+
全局引入库样式:
|
|
83
|
+
|
|
84
|
+
import 'xframelib/dist/index.css';
|
|
85
|
+
|
|
86
|
+
- 应用案例开源:**前端开发模板 vue-widget-template**
|
|
87
|
+
|
|
88
|
+
https://github.com/zorrowm/vue-widget-template
|
|
89
|
+
|
|
90
|
+
全面基于XFramelib和Widget思想的开发模板
|
|
91
|
+
|
|
92
|
+
- **main.ts 文件**
|
|
93
|
+
In Typescript:
|
|
94
|
+
|
|
95
|
+
```js
|
|
96
|
+
import { createApp } from 'vue';
|
|
97
|
+
import App from './App.vue';
|
|
98
|
+
//模板添加的
|
|
99
|
+
import { setupRouter } from './router/index';
|
|
100
|
+
import {setupGlobDirectives} from './directives/index';
|
|
101
|
+
import { init, Global } from 'xframelib';
|
|
102
|
+
import 'xframelib/dist/index.css';
|
|
103
|
+
import { getSystemPKG, getSystemID } from '@/utils/sysTool';
|
|
104
|
+
import { createPinia } from 'pinia';
|
|
105
|
+
import { message } from 'ant-design-vue';
|
|
106
|
+
import {Icon} from '@iconify/vue';
|
|
107
|
+
//dev阶段打开,build注销
|
|
108
|
+
import 'ant-design-vue/dist/antd.css';
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
message.config({
|
|
112
|
+
top: `100px`,
|
|
113
|
+
duration: 1,
|
|
114
|
+
maxCount: 3
|
|
115
|
+
});
|
|
116
|
+
//绑定消息和初始化xframe
|
|
117
|
+
//系统ID,唯一标识
|
|
118
|
+
const sysID = getSystemID();
|
|
119
|
+
//分组名,工程名
|
|
120
|
+
const sysGroup = getSystemPKG().name;
|
|
121
|
+
init(message, sysID, sysGroup);
|
|
122
|
+
|
|
123
|
+
// 创建pinia 实例
|
|
124
|
+
const pinia = createPinia();
|
|
125
|
+
const app = createApp(App);
|
|
126
|
+
// 挂载到 Vue 根实例上
|
|
127
|
+
app.use(pinia);
|
|
128
|
+
//定义v-drag命令
|
|
129
|
+
setupGlobDirectives(app);
|
|
130
|
+
setupRouter(app);
|
|
131
|
+
//注册全局组件
|
|
132
|
+
app.component('Icon',Icon);
|
|
133
|
+
|
|
134
|
+
app.mount('#app');
|
|
135
|
+
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
- **Quasar boot 使用示例**
|
|
139
|
+
|
|
140
|
+
```vue
|
|
141
|
+
import { boot } from 'quasar/wrappers';
|
|
142
|
+
import { addAPIProvider, Icon } from '@iconify/vue';
|
|
143
|
+
import { Dropdown } from 'floating-vue';
|
|
144
|
+
import { EmitLoadingInfo } from 'src/events/index';
|
|
145
|
+
import { autoRefresh } from 'src/utils/autoUpdate';
|
|
146
|
+
import { message } from 'src/utils/MessageNotify';
|
|
147
|
+
//封装的消息提示
|
|
148
|
+
import { getSystemID, getSystemPKG } from 'src/utils/sysTool';
|
|
149
|
+
import { Global, init } from 'xframelib';
|
|
150
|
+
function preInit() {
|
|
151
|
+
|
|
152
|
+
//系统ID,唯一标识
|
|
153
|
+
const sysID = getSystemID();
|
|
154
|
+
//分组名,工程名
|
|
155
|
+
const sysGroup = getSystemPKG().name;
|
|
156
|
+
init(message, sysID, sysGroup);
|
|
157
|
+
//挂载进度通知方法
|
|
158
|
+
Global.Loading = EmitLoadingInfo;
|
|
159
|
+
//注册自己的IconAPIProvider
|
|
160
|
+
if (Global.Config?.ServiceURL.IconServiceURL)
|
|
161
|
+
addAPIProvider('', {
|
|
162
|
+
resources: [Global.Config?.ServiceURL.IconServiceURL]
|
|
163
|
+
});
|
|
164
|
+
else {
|
|
165
|
+
//离线使用图标:生效,IconServiceURL配置为空
|
|
166
|
+
import('../components/IconOffline').then((it) => {
|
|
167
|
+
it.default();
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
export default boot(({ app }) => {
|
|
172
|
+
EmitLoadingInfo('XFramelib库');
|
|
173
|
+
//初始化Xframelib
|
|
174
|
+
preInit();
|
|
175
|
+
//启动热更新监测
|
|
176
|
+
if (import.meta.env.DEV) autoRefresh();
|
|
177
|
+
// 创建pinia 实例——20240221这里不需要了,在src/stores/index.ts里挂接的
|
|
178
|
+
// const pinia = createPinia();
|
|
179
|
+
// app.use(pinia);
|
|
180
|
+
//注册全局组件
|
|
181
|
+
app.component('Icon', Icon);
|
|
182
|
+
app.component('VDropdown', Dropdown);
|
|
183
|
+
// app.component('VTooltip', Tooltip);
|
|
184
|
+
// app.component('VMenu', Menu);
|
|
185
|
+
|
|
186
|
+
//开发时,全局注册tiny组件
|
|
187
|
+
// if (import.meta.env.DEV) {
|
|
188
|
+
// // import('@opentiny/vue').then((it) => {
|
|
189
|
+
// // const TinyVue = it.default;
|
|
190
|
+
// // app.use(TinyVue);
|
|
191
|
+
// // });
|
|
192
|
+
// }
|
|
193
|
+
console.log('环境变量',process.env);
|
|
194
|
+
//保存网站根地址
|
|
195
|
+
app.config.globalProperties.$AppURL=process.env.APP_URL;
|
|
196
|
+
});
|
|
197
|
+
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
## 应用示例
|
|
201
|
+
|
|
202
|
+

|
|
203
|
+
|
|
204
|
+

|