@ningboyz/types 1.1.167 → 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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ningboyz/types",
3
- "version": "1.1.167",
3
+ "version": "1.1.169",
4
4
  "private": false,
5
5
  "description": "宁波甬政类型库",
6
6
  "author": "nbyt-syq",
@@ -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,14 +1,8 @@
1
1
  import _ from "lodash";
2
2
  import { IConfigProperty } from "./IConfigProperty";
3
+ import {DConfigManager} from "./DConfigManager";
3
4
 
4
- export function DConfigProperty(cnfg: IConfigProperty) {
5
- return function (target: any, _propertyKey: string) {
6
- const listCnfg = Reflect.get(target, "listCnfg") as IConfigProperty[];
7
- if (_.isNil(listCnfg)) {
8
- Reflect.set(target, "listCnfg", [cnfg]);
9
- } else {
10
- listCnfg.push(cnfg);
11
- Reflect.set(target, "listCnfg", listCnfg);
12
- }
13
- };
5
+ export function DConfigProperty(configProperty: IConfigProperty) {
6
+ DConfigManager.set(configProperty.cnfgId, configProperty);
7
+ return function (_target: any, _propertyKey: string) {};
14
8
  }
@@ -11,6 +11,7 @@ export interface IConfigDataSource {
11
11
  }
12
12
 
13
13
  export interface IConfigProperty {
14
+ cnfgId: string;
14
15
  //配置名称
15
16
  cnfgName: string;
16
17
  //配置字段
@@ -1,3 +1,4 @@
1
1
  import { DConfigProperty } from "./DConfigProperty";
2
2
  import { IConfigProperty, DFormType, IConfigDataSource } from "./IConfigProperty";
3
- export { DConfigProperty, type IConfigProperty, DFormType, type IConfigDataSource };
3
+ import { DConfigManager } from "./DConfigManager";
4
+ export { DConfigProperty, type IConfigProperty, DFormType, type IConfigDataSource, DConfigManager };
@@ -1,11 +1,13 @@
1
1
  import _ from "lodash";
2
- import { DConfigProperty, DFormType } from "../decorators";
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 {
10
+ listCnfg: IConfigProperty[] = [];
9
11
  constructor(typePara?: string) {
10
12
  if (!_.isNil(typePara) && !_.isEmpty(typePara)) {
11
13
  try {
@@ -13,9 +15,12 @@ export class TYzpzTypeResponseConf implements IYzpzTypeResponseConf {
13
15
  Object.assign(this, obj);
14
16
  } catch (e) {}
15
17
  }
18
+ const listCnfg = DConfigManager.get(TYzpzTypeResponseConf.name);
19
+ this.listCnfg = listCnfg;
16
20
  }
17
21
 
18
22
  @DConfigProperty({
23
+ cnfgId: TYzpzTypeResponseConf.name,
19
24
  cnfgName: "开启手动模式",
20
25
  cnfgField: "usesManualMode",
21
26
  formType: DFormType.select,