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