@ningboyz/types 1.1.168 → 1.1.169
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/package.json
CHANGED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import _ from "lodash";
|
|
2
|
+
import { IConfigProperty } from "./IConfigProperty";
|
|
3
|
+
|
|
4
|
+
class DConfigManager {
|
|
5
|
+
private static map = new Map<string, IConfigProperty[]>();
|
|
6
|
+
|
|
7
|
+
public static set(key: string, cnfg: IConfigProperty) {
|
|
8
|
+
let listCnfg = this.map.get(key);
|
|
9
|
+
if (_.isNil(listCnfg)) {
|
|
10
|
+
listCnfg = [cnfg];
|
|
11
|
+
} else {
|
|
12
|
+
listCnfg.push(cnfg);
|
|
13
|
+
}
|
|
14
|
+
this.map.set(key, listCnfg);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
public static get(key: string) {
|
|
18
|
+
const cnfg = this.map.get(key);
|
|
19
|
+
return !_.isNil(cnfg) ? cnfg : [];
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export { DConfigManager };
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import _ from "lodash";
|
|
2
2
|
import { IConfigProperty } from "./IConfigProperty";
|
|
3
|
+
import {DConfigManager} from "./DConfigManager";
|
|
3
4
|
|
|
4
|
-
export function DConfigProperty(
|
|
5
|
-
|
|
6
|
-
return function (
|
|
7
|
-
|
|
8
|
-
};
|
|
5
|
+
export function DConfigProperty(configProperty: IConfigProperty) {
|
|
6
|
+
DConfigManager.set(configProperty.cnfgId, configProperty);
|
|
7
|
+
return function (_target: any, _propertyKey: string) {};
|
|
9
8
|
}
|
package/src/decorators/index.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import { DConfigProperty } from "./DConfigProperty";
|
|
2
2
|
import { IConfigProperty, DFormType, IConfigDataSource } from "./IConfigProperty";
|
|
3
|
-
|
|
3
|
+
import { DConfigManager } from "./DConfigManager";
|
|
4
|
+
export { DConfigProperty, type IConfigProperty, DFormType, type IConfigDataSource, DConfigManager };
|
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
import _ from "lodash";
|
|
2
2
|
import { DConfigProperty, DFormType, IConfigProperty } from "../decorators";
|
|
3
|
+
import { DConfigManager } from "../decorators/DConfigManager";
|
|
3
4
|
|
|
4
5
|
export interface IYzpzTypeResponseConf {
|
|
5
6
|
usesManualMode: number;
|
|
6
7
|
}
|
|
7
8
|
|
|
8
9
|
export class TYzpzTypeResponseConf implements IYzpzTypeResponseConf {
|
|
9
|
-
|
|
10
|
-
constructor(
|
|
11
|
-
const instance = TYzpzTypeResponseConf.map.get(id);
|
|
12
|
-
if (_.isNil(instance)) {
|
|
13
|
-
TYzpzTypeResponseConf.map.set(id, []);
|
|
14
|
-
}
|
|
10
|
+
listCnfg: IConfigProperty[] = [];
|
|
11
|
+
constructor(typePara?: string) {
|
|
15
12
|
if (!_.isNil(typePara) && !_.isEmpty(typePara)) {
|
|
16
13
|
try {
|
|
17
14
|
const obj = JSON.parse(typePara) as TYzpzTypeResponseConf;
|
|
18
15
|
Object.assign(this, obj);
|
|
19
16
|
} catch (e) {}
|
|
20
17
|
}
|
|
18
|
+
const listCnfg = DConfigManager.get(TYzpzTypeResponseConf.name);
|
|
19
|
+
this.listCnfg = listCnfg;
|
|
21
20
|
}
|
|
22
21
|
|
|
23
22
|
@DConfigProperty({
|
|
23
|
+
cnfgId: TYzpzTypeResponseConf.name,
|
|
24
24
|
cnfgName: "开启手动模式",
|
|
25
25
|
cnfgField: "usesManualMode",
|
|
26
26
|
formType: DFormType.select,
|