@ibiz-template/model-helper 0.1.18 → 0.1.20
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.esm.js +58 -1
- package/dist/index.system.min.js +1 -1
- package/dist/index.system.min.js.map +1 -1
- package/out/model-helper.d.ts +9 -0
- package/out/model-helper.d.ts.map +1 -1
- package/out/model-helper.js +11 -0
- package/out/model-loader.d.ts +1 -0
- package/out/model-loader.d.ts.map +1 -1
- package/out/model-loader.js +3 -0
- package/out/model-util.d.ts +17 -0
- package/out/model-util.d.ts.map +1 -1
- package/out/model-util.js +47 -1
- package/package.json +3 -3
- package/src/model-helper.ts +12 -0
- package/src/model-loader.ts +4 -0
- package/src/model-util.ts +47 -1
package/dist/index.esm.js
CHANGED
|
@@ -14982,13 +14982,39 @@ var ModelUtil = class {
|
|
|
14982
14982
|
appPath = "/PSSYSAPP.hub.json";
|
|
14983
14983
|
}
|
|
14984
14984
|
if (this.permission === false) {
|
|
14985
|
-
appPath = "/PSSYSAPP.simple.json";
|
|
14985
|
+
appPath = "/simple/PSSYSAPP.simple.json";
|
|
14986
14986
|
}
|
|
14987
14987
|
this.appModel = await this.getModel(appPath);
|
|
14988
14988
|
this.appModel.id = this.appId;
|
|
14989
14989
|
}
|
|
14990
14990
|
return this.appModel;
|
|
14991
14991
|
}
|
|
14992
|
+
/**
|
|
14993
|
+
* 加载应用模型全局样式
|
|
14994
|
+
*
|
|
14995
|
+
* @author chitanda
|
|
14996
|
+
* @date 2023-09-06 10:09:11
|
|
14997
|
+
* @return {*} {(Promise<string | null>)}
|
|
14998
|
+
*/
|
|
14999
|
+
async getAppStyle() {
|
|
15000
|
+
let style = "";
|
|
15001
|
+
try {
|
|
15002
|
+
let stylePath = "/PSSYSAPP.json.css";
|
|
15003
|
+
if (this.hub && ibiz.env.hub) {
|
|
15004
|
+
stylePath = "/PSSYSAPP.hub.json.css";
|
|
15005
|
+
}
|
|
15006
|
+
if (this.permission === false) {
|
|
15007
|
+
stylePath = "/simple/PSSYSAPP.simple.json.css";
|
|
15008
|
+
}
|
|
15009
|
+
style = await this.getStyleModel(stylePath);
|
|
15010
|
+
if (style) {
|
|
15011
|
+
return style;
|
|
15012
|
+
}
|
|
15013
|
+
} catch (error) {
|
|
15014
|
+
ibiz.log.error(error);
|
|
15015
|
+
}
|
|
15016
|
+
return null;
|
|
15017
|
+
}
|
|
14992
15018
|
/**
|
|
14993
15019
|
* 根据应用实体 codeName 或者 id 获取应用实体模型
|
|
14994
15020
|
*
|
|
@@ -15068,6 +15094,23 @@ var ModelUtil = class {
|
|
|
15068
15094
|
}
|
|
15069
15095
|
return {};
|
|
15070
15096
|
}
|
|
15097
|
+
/**
|
|
15098
|
+
* 加载应用样式字符串
|
|
15099
|
+
*
|
|
15100
|
+
* @author chitanda
|
|
15101
|
+
* @date 2023-09-07 11:09:11
|
|
15102
|
+
* @param {string} modelPath
|
|
15103
|
+
* @return {*} {Promise<string>}
|
|
15104
|
+
*/
|
|
15105
|
+
getStyleModel(modelPath) {
|
|
15106
|
+
let url;
|
|
15107
|
+
if (this.hub) {
|
|
15108
|
+
url = this.calcAppPath(modelPath);
|
|
15109
|
+
} else {
|
|
15110
|
+
url = this.calcSubAppPath(modelPath);
|
|
15111
|
+
}
|
|
15112
|
+
return this.get(url);
|
|
15113
|
+
}
|
|
15071
15114
|
/**
|
|
15072
15115
|
* 获取模型
|
|
15073
15116
|
*
|
|
@@ -15160,6 +15203,9 @@ var ModelLoader = class {
|
|
|
15160
15203
|
getAppDataEntityByCodeName(appId, codeName) {
|
|
15161
15204
|
return this.helper.getAppDataEntityModel(codeName, appId, false);
|
|
15162
15205
|
}
|
|
15206
|
+
getAppStyle(appId) {
|
|
15207
|
+
return this.helper.getAppStyle(appId);
|
|
15208
|
+
}
|
|
15163
15209
|
};
|
|
15164
15210
|
|
|
15165
15211
|
// src/model-helper.ts
|
|
@@ -15262,6 +15308,17 @@ var ModelHelper = class {
|
|
|
15262
15308
|
const app = this.dsl.application(model);
|
|
15263
15309
|
return app;
|
|
15264
15310
|
}
|
|
15311
|
+
/**
|
|
15312
|
+
* 获取应用全局样式
|
|
15313
|
+
*
|
|
15314
|
+
* @author chitanda
|
|
15315
|
+
* @date 2023-09-06 10:09:48
|
|
15316
|
+
* @param {(string | IObject)} [appId]
|
|
15317
|
+
* @return {*} {(Promise<string | null>)}
|
|
15318
|
+
*/
|
|
15319
|
+
getAppStyle(appId) {
|
|
15320
|
+
return this.getModelUtil(appId).getAppStyle();
|
|
15321
|
+
}
|
|
15265
15322
|
/**
|
|
15266
15323
|
* 根据应用实体 codeName 获取应用实体模型
|
|
15267
15324
|
*
|