@whitesev/utils 2.4.5 → 2.4.7
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/dist/index.amd.js +54 -17
- package/dist/index.amd.js.map +1 -1
- package/dist/index.cjs.js +54 -17
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +54 -17
- package/dist/index.esm.js.map +1 -1
- package/dist/index.iife.js +54 -17
- package/dist/index.iife.js.map +1 -1
- package/dist/index.system.js +54 -17
- package/dist/index.system.js.map +1 -1
- package/dist/index.umd.js +54 -17
- package/dist/index.umd.js.map +1 -1
- package/dist/types/src/Httpx.d.ts +1 -1
- package/dist/types/src/Utils.d.ts +12 -3
- package/dist/types/src/UtilsGMMenu.d.ts +16 -2
- package/dist/types/src/WindowApi.d.ts +2 -2
- package/dist/types/src/types/UtilsGMMenu.d.ts +1 -1
- package/dist/types/src/types/WindowApi.d.ts +3 -3
- package/package.json +1 -1
- package/src/Utils.ts +14 -5
- package/src/UtilsGMMenu.ts +34 -16
- package/src/WindowApi.ts +13 -4
- package/src/types/UtilsGMMenu.d.ts +1 -1
- package/src/types/WindowApi.d.ts +3 -3
package/dist/index.umd.js
CHANGED
|
@@ -1244,43 +1244,61 @@
|
|
|
1244
1244
|
}
|
|
1245
1245
|
/**
|
|
1246
1246
|
* 新增菜单数据
|
|
1247
|
-
* @param
|
|
1247
|
+
* @param menuOption
|
|
1248
1248
|
*/
|
|
1249
|
-
|
|
1250
|
-
if (Array.isArray(
|
|
1251
|
-
for (
|
|
1252
|
-
|
|
1249
|
+
__add(menuOption) {
|
|
1250
|
+
if (Array.isArray(menuOption)) {
|
|
1251
|
+
for (let index = 0; index < menuOption.length; index++) {
|
|
1252
|
+
const option = menuOption[index];
|
|
1253
1253
|
this.MenuHandle.$data.data.push({
|
|
1254
|
-
data:
|
|
1254
|
+
data: option,
|
|
1255
1255
|
id: void 0,
|
|
1256
1256
|
});
|
|
1257
1257
|
}
|
|
1258
1258
|
}
|
|
1259
1259
|
else {
|
|
1260
|
-
// @ts-ignore
|
|
1261
1260
|
this.MenuHandle.$data.data.push({
|
|
1262
|
-
data:
|
|
1261
|
+
data: menuOption,
|
|
1263
1262
|
id: void 0,
|
|
1264
1263
|
});
|
|
1265
1264
|
}
|
|
1265
|
+
}
|
|
1266
|
+
/**
|
|
1267
|
+
* 新增菜单数据
|
|
1268
|
+
*
|
|
1269
|
+
* 自动调用.update()
|
|
1270
|
+
* @param menuOption
|
|
1271
|
+
*/
|
|
1272
|
+
add(menuOption) {
|
|
1273
|
+
this.__add(menuOption);
|
|
1266
1274
|
this.update();
|
|
1267
1275
|
}
|
|
1268
1276
|
/**
|
|
1269
1277
|
* 更新菜单数据
|
|
1278
|
+
*
|
|
1279
|
+
* 实现方式:先取消注册所有已注册的菜单、再依次注册所有菜单项
|
|
1280
|
+
*
|
|
1281
|
+
* 如果菜单不存在,新增菜单项
|
|
1282
|
+
*
|
|
1283
|
+
* 如果菜单已存在,新菜单项覆盖旧的菜单项
|
|
1270
1284
|
* @param options 数据
|
|
1271
1285
|
*/
|
|
1272
1286
|
update(options) {
|
|
1273
|
-
let
|
|
1287
|
+
let menuOptionList = [];
|
|
1274
1288
|
if (Array.isArray(options)) {
|
|
1275
|
-
|
|
1289
|
+
menuOptionList = [...menuOptionList, ...options];
|
|
1276
1290
|
}
|
|
1277
1291
|
else if (options != null) {
|
|
1278
|
-
|
|
1292
|
+
menuOptionList = [...menuOptionList, options];
|
|
1279
1293
|
}
|
|
1280
|
-
|
|
1281
|
-
let
|
|
1282
|
-
if (
|
|
1283
|
-
|
|
1294
|
+
menuOptionList.forEach((menuOption) => {
|
|
1295
|
+
let oldMenuOption = this.MenuHandle.getMenuOption(menuOption.key);
|
|
1296
|
+
if (oldMenuOption) {
|
|
1297
|
+
// 覆盖
|
|
1298
|
+
Object.assign(oldMenuOption, menuOption);
|
|
1299
|
+
}
|
|
1300
|
+
else {
|
|
1301
|
+
this.__add(menuOption);
|
|
1284
1302
|
}
|
|
1285
1303
|
});
|
|
1286
1304
|
this.MenuHandle.$data.data.forEach((value) => {
|
|
@@ -1301,6 +1319,7 @@
|
|
|
1301
1319
|
/**
|
|
1302
1320
|
* 根据键值获取enable值
|
|
1303
1321
|
* @param menuKey 菜单-键key
|
|
1322
|
+
* @deprecated
|
|
1304
1323
|
*/
|
|
1305
1324
|
get(menuKey) {
|
|
1306
1325
|
return this.getEnable(menuKey);
|
|
@@ -1324,7 +1343,7 @@
|
|
|
1324
1343
|
* @param menuKey 菜单-键key
|
|
1325
1344
|
*/
|
|
1326
1345
|
getShowTextValue(menuKey) {
|
|
1327
|
-
return this.MenuHandle.getMenuHandledOption(menuKey).showText(this.getText(menuKey), this.
|
|
1346
|
+
return this.MenuHandle.getMenuHandledOption(menuKey).showText(this.getText(menuKey), this.getEnable(menuKey));
|
|
1328
1347
|
}
|
|
1329
1348
|
/**
|
|
1330
1349
|
* 获取当前已注册菜单的id
|
|
@@ -3811,9 +3830,18 @@
|
|
|
3811
3830
|
/** 使用的配置 */
|
|
3812
3831
|
api;
|
|
3813
3832
|
constructor(option) {
|
|
3833
|
+
if (option) {
|
|
3834
|
+
if (option.globalThis == null) {
|
|
3835
|
+
option.globalThis = option.window;
|
|
3836
|
+
}
|
|
3837
|
+
if (option.self == null) {
|
|
3838
|
+
option.self = option.window;
|
|
3839
|
+
}
|
|
3840
|
+
}
|
|
3814
3841
|
if (!option) {
|
|
3815
3842
|
option = Object.assign({}, this.defaultApi);
|
|
3816
3843
|
}
|
|
3844
|
+
// @ts-ignore
|
|
3817
3845
|
this.api = Object.assign({}, option);
|
|
3818
3846
|
}
|
|
3819
3847
|
get document() {
|
|
@@ -4078,7 +4106,7 @@
|
|
|
4078
4106
|
this.windowApi = new WindowApi(option);
|
|
4079
4107
|
}
|
|
4080
4108
|
/** 版本号 */
|
|
4081
|
-
version = "2024.11.
|
|
4109
|
+
version = "2024.11.6";
|
|
4082
4110
|
addStyle(cssText) {
|
|
4083
4111
|
if (typeof cssText !== "string") {
|
|
4084
4112
|
throw new Error("Utils.addStyle 参数cssText 必须为String类型");
|
|
@@ -7189,6 +7217,15 @@
|
|
|
7189
7217
|
generateUUID = GenerateUUID;
|
|
7190
7218
|
/**
|
|
7191
7219
|
* 自定义的动态响应对象
|
|
7220
|
+
* @example
|
|
7221
|
+
* let vue = new Utils.Vue();
|
|
7222
|
+
* let reactive = new vue.reactive({});
|
|
7223
|
+
* vue.watch(()=>reactive["name"], (newValue, oldValue)=>{
|
|
7224
|
+
* console.log("newValue ==> " + newValue);
|
|
7225
|
+
* console.log("oldValue ==> " + oldValue);
|
|
7226
|
+
* })
|
|
7227
|
+
* vue["name"] = "测试";
|
|
7228
|
+
* > "测试"
|
|
7192
7229
|
*/
|
|
7193
7230
|
Vue = Vue;
|
|
7194
7231
|
}
|