@whitesev/utils 2.4.5 → 2.4.6
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 +45 -17
- package/dist/index.amd.js.map +1 -1
- package/dist/index.cjs.js +45 -17
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +45 -17
- package/dist/index.esm.js.map +1 -1
- package/dist/index.iife.js +45 -17
- package/dist/index.iife.js.map +1 -1
- package/dist/index.system.js +45 -17
- package/dist/index.system.js.map +1 -1
- package/dist/index.umd.js +45 -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 +9 -0
- package/dist/types/src/UtilsGMMenu.d.ts +16 -2
- package/dist/types/src/types/UtilsGMMenu.d.ts +1 -1
- package/package.json +1 -1
- package/src/Utils.ts +10 -1
- package/src/UtilsGMMenu.ts +34 -16
- package/src/types/UtilsGMMenu.d.ts +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -1238,43 +1238,61 @@ class GMMenu {
|
|
|
1238
1238
|
}
|
|
1239
1239
|
/**
|
|
1240
1240
|
* 新增菜单数据
|
|
1241
|
-
* @param
|
|
1241
|
+
* @param menuOption
|
|
1242
1242
|
*/
|
|
1243
|
-
|
|
1244
|
-
if (Array.isArray(
|
|
1245
|
-
for (
|
|
1246
|
-
|
|
1243
|
+
__add(menuOption) {
|
|
1244
|
+
if (Array.isArray(menuOption)) {
|
|
1245
|
+
for (let index = 0; index < menuOption.length; index++) {
|
|
1246
|
+
const option = menuOption[index];
|
|
1247
1247
|
this.MenuHandle.$data.data.push({
|
|
1248
|
-
data:
|
|
1248
|
+
data: option,
|
|
1249
1249
|
id: void 0,
|
|
1250
1250
|
});
|
|
1251
1251
|
}
|
|
1252
1252
|
}
|
|
1253
1253
|
else {
|
|
1254
|
-
// @ts-ignore
|
|
1255
1254
|
this.MenuHandle.$data.data.push({
|
|
1256
|
-
data:
|
|
1255
|
+
data: menuOption,
|
|
1257
1256
|
id: void 0,
|
|
1258
1257
|
});
|
|
1259
1258
|
}
|
|
1259
|
+
}
|
|
1260
|
+
/**
|
|
1261
|
+
* 新增菜单数据
|
|
1262
|
+
*
|
|
1263
|
+
* 自动调用.update()
|
|
1264
|
+
* @param menuOption
|
|
1265
|
+
*/
|
|
1266
|
+
add(menuOption) {
|
|
1267
|
+
this.__add(menuOption);
|
|
1260
1268
|
this.update();
|
|
1261
1269
|
}
|
|
1262
1270
|
/**
|
|
1263
1271
|
* 更新菜单数据
|
|
1272
|
+
*
|
|
1273
|
+
* 实现方式:先取消注册所有已注册的菜单、再依次注册所有菜单项
|
|
1274
|
+
*
|
|
1275
|
+
* 如果菜单不存在,新增菜单项
|
|
1276
|
+
*
|
|
1277
|
+
* 如果菜单已存在,新菜单项覆盖旧的菜单项
|
|
1264
1278
|
* @param options 数据
|
|
1265
1279
|
*/
|
|
1266
1280
|
update(options) {
|
|
1267
|
-
let
|
|
1281
|
+
let menuOptionList = [];
|
|
1268
1282
|
if (Array.isArray(options)) {
|
|
1269
|
-
|
|
1283
|
+
menuOptionList = [...menuOptionList, ...options];
|
|
1270
1284
|
}
|
|
1271
1285
|
else if (options != null) {
|
|
1272
|
-
|
|
1286
|
+
menuOptionList = [...menuOptionList, options];
|
|
1273
1287
|
}
|
|
1274
|
-
|
|
1275
|
-
let
|
|
1276
|
-
if (
|
|
1277
|
-
|
|
1288
|
+
menuOptionList.forEach((menuOption) => {
|
|
1289
|
+
let oldMenuOption = this.MenuHandle.getMenuOption(menuOption.key);
|
|
1290
|
+
if (oldMenuOption) {
|
|
1291
|
+
// 覆盖
|
|
1292
|
+
Object.assign(oldMenuOption, menuOption);
|
|
1293
|
+
}
|
|
1294
|
+
else {
|
|
1295
|
+
this.__add(menuOption);
|
|
1278
1296
|
}
|
|
1279
1297
|
});
|
|
1280
1298
|
this.MenuHandle.$data.data.forEach((value) => {
|
|
@@ -1295,6 +1313,7 @@ class GMMenu {
|
|
|
1295
1313
|
/**
|
|
1296
1314
|
* 根据键值获取enable值
|
|
1297
1315
|
* @param menuKey 菜单-键key
|
|
1316
|
+
* @deprecated
|
|
1298
1317
|
*/
|
|
1299
1318
|
get(menuKey) {
|
|
1300
1319
|
return this.getEnable(menuKey);
|
|
@@ -1318,7 +1337,7 @@ class GMMenu {
|
|
|
1318
1337
|
* @param menuKey 菜单-键key
|
|
1319
1338
|
*/
|
|
1320
1339
|
getShowTextValue(menuKey) {
|
|
1321
|
-
return this.MenuHandle.getMenuHandledOption(menuKey).showText(this.getText(menuKey), this.
|
|
1340
|
+
return this.MenuHandle.getMenuHandledOption(menuKey).showText(this.getText(menuKey), this.getEnable(menuKey));
|
|
1322
1341
|
}
|
|
1323
1342
|
/**
|
|
1324
1343
|
* 获取当前已注册菜单的id
|
|
@@ -4072,7 +4091,7 @@ class Utils {
|
|
|
4072
4091
|
this.windowApi = new WindowApi(option);
|
|
4073
4092
|
}
|
|
4074
4093
|
/** 版本号 */
|
|
4075
|
-
version = "2024.11.
|
|
4094
|
+
version = "2024.11.5";
|
|
4076
4095
|
addStyle(cssText) {
|
|
4077
4096
|
if (typeof cssText !== "string") {
|
|
4078
4097
|
throw new Error("Utils.addStyle 参数cssText 必须为String类型");
|
|
@@ -7183,6 +7202,15 @@ class Utils {
|
|
|
7183
7202
|
generateUUID = GenerateUUID;
|
|
7184
7203
|
/**
|
|
7185
7204
|
* 自定义的动态响应对象
|
|
7205
|
+
* @example
|
|
7206
|
+
* let vue = new Utils.Vue();
|
|
7207
|
+
* let reactive = new vue.reactive({});
|
|
7208
|
+
* vue.watch(()=>reactive["name"], (newValue, oldValue)=>{
|
|
7209
|
+
* console.log("newValue ==> " + newValue);
|
|
7210
|
+
* console.log("oldValue ==> " + oldValue);
|
|
7211
|
+
* })
|
|
7212
|
+
* vue["name"] = "测试";
|
|
7213
|
+
* > "测试"
|
|
7186
7214
|
*/
|
|
7187
7215
|
Vue = Vue;
|
|
7188
7216
|
}
|