@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.iife.js
CHANGED
|
@@ -1241,43 +1241,61 @@ var Utils = (function () {
|
|
|
1241
1241
|
}
|
|
1242
1242
|
/**
|
|
1243
1243
|
* 新增菜单数据
|
|
1244
|
-
* @param
|
|
1244
|
+
* @param menuOption
|
|
1245
1245
|
*/
|
|
1246
|
-
|
|
1247
|
-
if (Array.isArray(
|
|
1248
|
-
for (
|
|
1249
|
-
|
|
1246
|
+
__add(menuOption) {
|
|
1247
|
+
if (Array.isArray(menuOption)) {
|
|
1248
|
+
for (let index = 0; index < menuOption.length; index++) {
|
|
1249
|
+
const option = menuOption[index];
|
|
1250
1250
|
this.MenuHandle.$data.data.push({
|
|
1251
|
-
data:
|
|
1251
|
+
data: option,
|
|
1252
1252
|
id: void 0,
|
|
1253
1253
|
});
|
|
1254
1254
|
}
|
|
1255
1255
|
}
|
|
1256
1256
|
else {
|
|
1257
|
-
// @ts-ignore
|
|
1258
1257
|
this.MenuHandle.$data.data.push({
|
|
1259
|
-
data:
|
|
1258
|
+
data: menuOption,
|
|
1260
1259
|
id: void 0,
|
|
1261
1260
|
});
|
|
1262
1261
|
}
|
|
1262
|
+
}
|
|
1263
|
+
/**
|
|
1264
|
+
* 新增菜单数据
|
|
1265
|
+
*
|
|
1266
|
+
* 自动调用.update()
|
|
1267
|
+
* @param menuOption
|
|
1268
|
+
*/
|
|
1269
|
+
add(menuOption) {
|
|
1270
|
+
this.__add(menuOption);
|
|
1263
1271
|
this.update();
|
|
1264
1272
|
}
|
|
1265
1273
|
/**
|
|
1266
1274
|
* 更新菜单数据
|
|
1275
|
+
*
|
|
1276
|
+
* 实现方式:先取消注册所有已注册的菜单、再依次注册所有菜单项
|
|
1277
|
+
*
|
|
1278
|
+
* 如果菜单不存在,新增菜单项
|
|
1279
|
+
*
|
|
1280
|
+
* 如果菜单已存在,新菜单项覆盖旧的菜单项
|
|
1267
1281
|
* @param options 数据
|
|
1268
1282
|
*/
|
|
1269
1283
|
update(options) {
|
|
1270
|
-
let
|
|
1284
|
+
let menuOptionList = [];
|
|
1271
1285
|
if (Array.isArray(options)) {
|
|
1272
|
-
|
|
1286
|
+
menuOptionList = [...menuOptionList, ...options];
|
|
1273
1287
|
}
|
|
1274
1288
|
else if (options != null) {
|
|
1275
|
-
|
|
1289
|
+
menuOptionList = [...menuOptionList, options];
|
|
1276
1290
|
}
|
|
1277
|
-
|
|
1278
|
-
let
|
|
1279
|
-
if (
|
|
1280
|
-
|
|
1291
|
+
menuOptionList.forEach((menuOption) => {
|
|
1292
|
+
let oldMenuOption = this.MenuHandle.getMenuOption(menuOption.key);
|
|
1293
|
+
if (oldMenuOption) {
|
|
1294
|
+
// 覆盖
|
|
1295
|
+
Object.assign(oldMenuOption, menuOption);
|
|
1296
|
+
}
|
|
1297
|
+
else {
|
|
1298
|
+
this.__add(menuOption);
|
|
1281
1299
|
}
|
|
1282
1300
|
});
|
|
1283
1301
|
this.MenuHandle.$data.data.forEach((value) => {
|
|
@@ -1298,6 +1316,7 @@ var Utils = (function () {
|
|
|
1298
1316
|
/**
|
|
1299
1317
|
* 根据键值获取enable值
|
|
1300
1318
|
* @param menuKey 菜单-键key
|
|
1319
|
+
* @deprecated
|
|
1301
1320
|
*/
|
|
1302
1321
|
get(menuKey) {
|
|
1303
1322
|
return this.getEnable(menuKey);
|
|
@@ -1321,7 +1340,7 @@ var Utils = (function () {
|
|
|
1321
1340
|
* @param menuKey 菜单-键key
|
|
1322
1341
|
*/
|
|
1323
1342
|
getShowTextValue(menuKey) {
|
|
1324
|
-
return this.MenuHandle.getMenuHandledOption(menuKey).showText(this.getText(menuKey), this.
|
|
1343
|
+
return this.MenuHandle.getMenuHandledOption(menuKey).showText(this.getText(menuKey), this.getEnable(menuKey));
|
|
1325
1344
|
}
|
|
1326
1345
|
/**
|
|
1327
1346
|
* 获取当前已注册菜单的id
|
|
@@ -4075,7 +4094,7 @@ var Utils = (function () {
|
|
|
4075
4094
|
this.windowApi = new WindowApi(option);
|
|
4076
4095
|
}
|
|
4077
4096
|
/** 版本号 */
|
|
4078
|
-
version = "2024.11.
|
|
4097
|
+
version = "2024.11.5";
|
|
4079
4098
|
addStyle(cssText) {
|
|
4080
4099
|
if (typeof cssText !== "string") {
|
|
4081
4100
|
throw new Error("Utils.addStyle 参数cssText 必须为String类型");
|
|
@@ -7186,6 +7205,15 @@ var Utils = (function () {
|
|
|
7186
7205
|
generateUUID = GenerateUUID;
|
|
7187
7206
|
/**
|
|
7188
7207
|
* 自定义的动态响应对象
|
|
7208
|
+
* @example
|
|
7209
|
+
* let vue = new Utils.Vue();
|
|
7210
|
+
* let reactive = new vue.reactive({});
|
|
7211
|
+
* vue.watch(()=>reactive["name"], (newValue, oldValue)=>{
|
|
7212
|
+
* console.log("newValue ==> " + newValue);
|
|
7213
|
+
* console.log("oldValue ==> " + oldValue);
|
|
7214
|
+
* })
|
|
7215
|
+
* vue["name"] = "测试";
|
|
7216
|
+
* > "测试"
|
|
7189
7217
|
*/
|
|
7190
7218
|
Vue = Vue;
|
|
7191
7219
|
}
|