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