@zhongguo168a/yxeditor-common 0.0.54 → 0.0.55

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.d.ts CHANGED
@@ -1010,6 +1010,136 @@ declare class Route {
1010
1010
  declare class RouteList extends List<Route> {
1011
1011
  }
1012
1012
 
1013
+ declare class MapObject extends Dictionary<string, MapValue> {
1014
+ object: {};
1015
+ constructor(object: {});
1016
+ getValue(key: string): MapValue;
1017
+ }
1018
+ declare class MapValue {
1019
+ obj: {};
1020
+ key: any;
1021
+ constructor(obj: {}, key: any);
1022
+ isUndefined(): boolean;
1023
+ toNumber(): number;
1024
+ toString(): string;
1025
+ toBoolean(): boolean;
1026
+ toAny(): any;
1027
+ }
1028
+ declare class MapUtil {
1029
+ /**
1030
+ * 获取所欲的值
1031
+ */
1032
+ values<T = any>(m: {
1033
+ [key: string]: T;
1034
+ }): T[];
1035
+ /**
1036
+ * 获取所有的键
1037
+ */
1038
+ keys(m: {
1039
+ [key: string]: any;
1040
+ }): string[];
1041
+ /**
1042
+ * 以字符串数字作为键值的map,转化成数组
1043
+ */
1044
+ toList<T = any>(m: {
1045
+ [key: string]: T;
1046
+ }): T[];
1047
+ /**
1048
+ * 以字符串数字作为键值的map,转化成数组
1049
+ */
1050
+ listToMap(list: any[]): any;
1051
+ /**
1052
+ * 转换成数字, 如果原值无效, 返回0
1053
+ * @constructor
1054
+ */
1055
+ has(m: any, key: string): boolean;
1056
+ /**
1057
+ * 转换成数字, 如果原值无效, 返回0
1058
+ * @constructor
1059
+ */
1060
+ number(m: any, key: string, dflt?: number): number;
1061
+ /**
1062
+ * 转换成字符串, 如果原值无效, 返回""
1063
+ * @constructor
1064
+ */
1065
+ string(m: any, key: string, dflt?: string): string;
1066
+ /**
1067
+ * 转换成布尔值, 如果原值无效, 返回false
1068
+ * @constructor
1069
+ */
1070
+ boolean(m: any, key: string, dflt?: boolean): boolean;
1071
+ /**
1072
+ * 转换成{}, 如果原值无效, 返回{}
1073
+ * @constructor
1074
+ */
1075
+ map(m: any, key: string, dflt?: boolean | Object): any;
1076
+ /**
1077
+ * 转换成[], 如果原值无效, 返回[]
1078
+ * @constructor
1079
+ */
1080
+ array(m: any, key: string, dflt?: boolean | Array<any>): any[];
1081
+ /**
1082
+ * 返回第一个符合条件的key
1083
+ * @param m
1084
+ * @param conf
1085
+ */
1086
+ keyOfConf(m: any, conf: (key: string, item: any) => boolean): string;
1087
+ /**
1088
+ * 比较对象,并返回包含差异的对象
1089
+ * 如果返回 undefined 表示没有差异
1090
+ * @param obj
1091
+ * @param parent
1092
+ * @param removeDefault
1093
+ */
1094
+ diff(obj: any, parent: any, removeDefault?: boolean): any;
1095
+ /**
1096
+ * 克隆对象
1097
+ * @param obj
1098
+ */
1099
+ clone(obj: any): any;
1100
+ /**
1101
+ * 通过path设置属性,创建不存在的路径对象
1102
+ * @param obj
1103
+ * @param path "/key1/key2"
1104
+ * @param data
1105
+ */
1106
+ setByPath(obj: any, path: string, data: any): void;
1107
+ /**
1108
+ * 通过path删除
1109
+ * @param obj
1110
+ * @param path "/key1/key2"
1111
+ */
1112
+ removeByPath(obj: any, path: string): void;
1113
+ /**
1114
+ * 通过path获取属性
1115
+ * @param obj
1116
+ * @param path
1117
+ */
1118
+ getByPath(obj: any, path: string): any;
1119
+ flat(obj: any, split?: string): any;
1120
+ _flat(obj: any, result: any, path: string, split?: string): any;
1121
+ /**
1122
+ * 比较两个对象,包括基础类型
1123
+ * @param a
1124
+ * @param b
1125
+ */
1126
+ compare(a: any, b: any): boolean;
1127
+ /**
1128
+ * 从[from]对象复制到 [to]对象
1129
+ * 如果from字段为object并且等于null,则设置to字段为null
1130
+ * 如果from字段为undefined, 则不覆盖
1131
+ * @param from
1132
+ * @param to
1133
+ * @param tokey 如果[to]存在key才进行拷贝
1134
+ */
1135
+ copy(from: any, to: any, tokey?: boolean): void;
1136
+ /**
1137
+ * 去掉兼职
1138
+ */
1139
+ flatString(target: any): string;
1140
+ }
1141
+ declare const maputil: MapUtil;
1142
+
1013
1143
  declare enum ViewState {
1014
1144
  /**
1015
1145
  * 关闭
@@ -1071,8 +1201,8 @@ declare class RouteView extends EventDispatcher {
1071
1201
  onStop(value: (ctx: this) => void): this;
1072
1202
  get reason(): LinkError;
1073
1203
  node: Node;
1074
- datas: {};
1075
- tags: {};
1204
+ datas: MapObject;
1205
+ tags: MapObject;
1076
1206
  enableHistory: boolean;
1077
1207
  layer: string;
1078
1208
  state: ViewState;
@@ -1690,121 +1820,6 @@ declare class IdentUtil {
1690
1820
  }
1691
1821
  declare const identutil: IdentUtil;
1692
1822
 
1693
- declare class MapUtil {
1694
- /**
1695
- * 获取所欲的值
1696
- */
1697
- values<T = any>(m: {
1698
- [key: string]: T;
1699
- }): T[];
1700
- /**
1701
- * 获取所有的键
1702
- */
1703
- keys(m: {
1704
- [key: string]: any;
1705
- }): string[];
1706
- /**
1707
- * 以字符串数字作为键值的map,转化成数组
1708
- */
1709
- toList<T = any>(m: {
1710
- [key: string]: T;
1711
- }): T[];
1712
- /**
1713
- * 以字符串数字作为键值的map,转化成数组
1714
- */
1715
- listToMap(list: any[]): any;
1716
- /**
1717
- * 转换成数字, 如果原值无效, 返回0
1718
- * @constructor
1719
- */
1720
- has(m: any, key: string): boolean;
1721
- /**
1722
- * 转换成数字, 如果原值无效, 返回0
1723
- * @constructor
1724
- */
1725
- number(m: any, key: string, dflt?: number): number;
1726
- /**
1727
- * 转换成字符串, 如果原值无效, 返回""
1728
- * @constructor
1729
- */
1730
- string(m: any, key: string, dflt?: string): string;
1731
- /**
1732
- * 转换成布尔值, 如果原值无效, 返回false
1733
- * @constructor
1734
- */
1735
- boolean(m: any, key: string, dflt?: boolean): boolean;
1736
- /**
1737
- * 转换成{}, 如果原值无效, 返回{}
1738
- * @constructor
1739
- */
1740
- map(m: any, key: string, dflt?: boolean | Object): any;
1741
- /**
1742
- * 转换成[], 如果原值无效, 返回[]
1743
- * @constructor
1744
- */
1745
- array(m: any, key: string, dflt?: boolean | Array<any>): any[];
1746
- /**
1747
- * 返回第一个符合条件的key
1748
- * @param m
1749
- * @param conf
1750
- */
1751
- keyOfConf(m: any, conf: (key: string, item: any) => boolean): string;
1752
- /**
1753
- * 比较对象,并返回包含差异的对象
1754
- * 如果返回 undefined 表示没有差异
1755
- * @param obj
1756
- * @param parent
1757
- * @param removeDefault
1758
- */
1759
- diff(obj: any, parent: any, removeDefault?: boolean): any;
1760
- /**
1761
- * 克隆对象
1762
- * @param obj
1763
- */
1764
- clone(obj: any): any;
1765
- /**
1766
- * 通过path设置属性,创建不存在的路径对象
1767
- * @param obj
1768
- * @param path "/key1/key2"
1769
- * @param data
1770
- */
1771
- setByPath(obj: any, path: string, data: any): void;
1772
- /**
1773
- * 通过path删除
1774
- * @param obj
1775
- * @param path "/key1/key2"
1776
- */
1777
- removeByPath(obj: any, path: string): void;
1778
- /**
1779
- * 通过path获取属性
1780
- * @param obj
1781
- * @param path
1782
- */
1783
- getByPath(obj: any, path: string): any;
1784
- flat(obj: any, split?: string): any;
1785
- _flat(obj: any, result: any, path: string, split?: string): any;
1786
- /**
1787
- * 比较两个对象,包括基础类型
1788
- * @param a
1789
- * @param b
1790
- */
1791
- compare(a: any, b: any): boolean;
1792
- /**
1793
- * 从[from]对象复制到 [to]对象
1794
- * 如果from字段为object并且等于null,则设置to字段为null
1795
- * 如果from字段为undefined, 则不覆盖
1796
- * @param from
1797
- * @param to
1798
- * @param tokey 如果[to]存在key才进行拷贝
1799
- */
1800
- copy(from: any, to: any, tokey?: boolean): void;
1801
- /**
1802
- * 去掉兼职
1803
- */
1804
- flatString(target: any): string;
1805
- }
1806
- declare const maputil: MapUtil;
1807
-
1808
1823
  declare class MathUtil {
1809
1824
  version: number;
1810
1825
  TempVec2: Vec2;
@@ -2047,5 +2062,5 @@ declare class WidgetUtil {
2047
2062
  }
2048
2063
  declare var widgetutil: WidgetUtil;
2049
2064
 
2050
- export { ArrayUtil, AssetLoader, AssetURI, BitUtil, CallbackList, CameraUtil, CanvasUtil, Controller, ControllerDict, ControllerRepo, ConvertUtil, DictIterator, DictNode, DictSource, Dictionary, Dispatcher, DocUtil, ErrorUtil, EventDispatcher, EventItem, EventUtil, Factory, FloatUtil, GeometryUtil, IdentUtil, LOGGER_EVENT, LinkError, List, ListIterator, ListNode, ListSource, Listener, LogLevel, LogManager, Logger, MapUtil, MathUtil, Model, NetUtil, PathUtil, Pool, RandUtil, Route, RouteController, RouteList, RouteView, SampleCallbackList, SamplePool, SamplePoolSet, ScaleUtil, SimpleModel, StringUtil, TimeUtil, Timer, TreeIterator, TreeNode, TreeNodePlugin, TreeRoot, TreeRootPlugin, TreeUtil, UIManager, UIObjectRepo, UIPoolConfig, UISingleConfig, UIUtil, ViewDict, ViewEvent, ViewHistory, ViewList, ViewRepo, ViewState, WidgetAlign, WidgetUtil, XAssetManager, XEvent, arrayutil, assetx, bitutil, camerautil, canvasutil, convertutil, ctrlrepo, docutil, errorutil, eventmgr, eventutil, floatutil, formatutil, geoutil, identutil, loadAtlas, logmgr, maputil, mathutil, netutil, parseAtlas, parsePlist, pathutil, randutil, resutil, scaleutil, stringutil, timer, timeutil, treeutil, uimgr, uirepo, uiutil, viewhistorys, viewrepo, widgetutil };
2065
+ export { ArrayUtil, AssetLoader, AssetURI, BitUtil, CallbackList, CameraUtil, CanvasUtil, Controller, ControllerDict, ControllerRepo, ConvertUtil, DictIterator, DictNode, DictSource, Dictionary, Dispatcher, DocUtil, ErrorUtil, EventDispatcher, EventItem, EventUtil, Factory, FloatUtil, GeometryUtil, IdentUtil, LOGGER_EVENT, LinkError, List, ListIterator, ListNode, ListSource, Listener, LogLevel, LogManager, Logger, MapObject, MapUtil, MapValue, MathUtil, Model, NetUtil, PathUtil, Pool, RandUtil, Route, RouteController, RouteList, RouteView, SampleCallbackList, SamplePool, SamplePoolSet, ScaleUtil, SimpleModel, StringUtil, TimeUtil, Timer, TreeIterator, TreeNode, TreeNodePlugin, TreeRoot, TreeRootPlugin, TreeUtil, UIManager, UIObjectRepo, UIPoolConfig, UISingleConfig, UIUtil, ViewDict, ViewEvent, ViewHistory, ViewList, ViewRepo, ViewState, WidgetAlign, WidgetUtil, XAssetManager, XEvent, arrayutil, assetx, bitutil, camerautil, canvasutil, convertutil, ctrlrepo, docutil, errorutil, eventmgr, eventutil, floatutil, formatutil, geoutil, identutil, loadAtlas, logmgr, maputil, mathutil, netutil, parseAtlas, parsePlist, pathutil, randutil, resutil, scaleutil, stringutil, timer, timeutil, treeutil, uimgr, uirepo, uiutil, viewhistorys, viewrepo, widgetutil };
2051
2066
  export type { CreatorFunction, DisposeFunction, IController, IError, IEventDispatcher, IExtend, IListItem, IModel, IModule, ITreeListItem, RecycleFunction };
package/dist/index.esm.js CHANGED
@@ -1121,6 +1121,41 @@ class ConvertUtil {
1121
1121
  }
1122
1122
  const convertutil = new ConvertUtil();
1123
1123
 
1124
+ class MapObject extends Dictionary {
1125
+ constructor(object) {
1126
+ super();
1127
+ this.object = object;
1128
+ }
1129
+ getValue(key) {
1130
+ let value = this.get(key);
1131
+ if (!value) {
1132
+ value = new MapValue(this, key);
1133
+ this.set(key, value);
1134
+ }
1135
+ return value;
1136
+ }
1137
+ }
1138
+ class MapValue {
1139
+ constructor(obj, key) {
1140
+ this.obj = obj;
1141
+ this.key = key;
1142
+ }
1143
+ isUndefined() {
1144
+ return this.obj[this.key] == undefined;
1145
+ }
1146
+ toNumber() {
1147
+ return maputil.number(this.obj, this.key);
1148
+ }
1149
+ toString() {
1150
+ return maputil.string(this.obj, this.key);
1151
+ }
1152
+ toBoolean() {
1153
+ return maputil.boolean(this.obj, this.key);
1154
+ }
1155
+ toAny() {
1156
+ return this.obj[this.key];
1157
+ }
1158
+ }
1124
1159
  class MapUtil {
1125
1160
  /**
1126
1161
  * 获取所欲的值
@@ -3855,8 +3890,8 @@ class RouteView extends EventDispatcher {
3855
3890
  super();
3856
3891
  this._waitOpenComplete = false;
3857
3892
  this._waitCloseComplete = false;
3858
- this.datas = {};
3859
- this.tags = {};
3893
+ this.datas = new MapObject({});
3894
+ this.tags = new MapObject({});
3860
3895
  this.enableHistory = false;
3861
3896
  this.state = 0;
3862
3897
  this._onStop = (ctx) => {
@@ -6353,5 +6388,5 @@ class WidgetUtil {
6353
6388
  }
6354
6389
  var widgetutil = new WidgetUtil();
6355
6390
 
6356
- export { ArrayUtil, AssetLoader, AssetURI, BitUtil, CallbackList, CameraUtil, CanvasUtil, Controller, ControllerDict, ControllerRepo, ConvertUtil, DictIterator, DictNode, DictSource, Dictionary, Dispatcher, DocUtil, ErrorUtil, EventDispatcher, EventItem, EventUtil, Factory, FloatUtil, GeometryUtil, IdentUtil, LOGGER_EVENT, LinkError, List, ListIterator, ListNode, ListSource, Listener, LogLevel, LogManager, Logger, MapUtil, MathUtil, Model, NetUtil, PathUtil, Pool, RandUtil, Route, RouteController, RouteList, RouteView, SampleCallbackList, SamplePool, SamplePoolSet, ScaleUtil, SimpleModel, StringUtil, TimeUtil, Timer, TreeIterator, TreeNode, TreeNodePlugin, TreeRoot, TreeRootPlugin, TreeUtil, UIManager, UIObjectRepo, UIPoolConfig, UISingleConfig, UIUtil, ViewDict, ViewEvent, ViewHistory, ViewList, ViewRepo, ViewState, WidgetAlign, WidgetUtil, XAssetManager, XEvent, arrayutil, assetx, bitutil, camerautil, canvasutil, convertutil, ctrlrepo, docutil, errorutil, eventmgr, eventutil, floatutil, formatutil, geoutil, identutil, loadAtlas, logmgr, maputil, mathutil, netutil, parseAtlas, parsePlist, pathutil, randutil, resutil, scaleutil, stringutil, timer, timeutil, treeutil, uimgr, uirepo, uiutil, viewhistorys, viewrepo, widgetutil };
6391
+ export { ArrayUtil, AssetLoader, AssetURI, BitUtil, CallbackList, CameraUtil, CanvasUtil, Controller, ControllerDict, ControllerRepo, ConvertUtil, DictIterator, DictNode, DictSource, Dictionary, Dispatcher, DocUtil, ErrorUtil, EventDispatcher, EventItem, EventUtil, Factory, FloatUtil, GeometryUtil, IdentUtil, LOGGER_EVENT, LinkError, List, ListIterator, ListNode, ListSource, Listener, LogLevel, LogManager, Logger, MapObject, MapUtil, MapValue, MathUtil, Model, NetUtil, PathUtil, Pool, RandUtil, Route, RouteController, RouteList, RouteView, SampleCallbackList, SamplePool, SamplePoolSet, ScaleUtil, SimpleModel, StringUtil, TimeUtil, Timer, TreeIterator, TreeNode, TreeNodePlugin, TreeRoot, TreeRootPlugin, TreeUtil, UIManager, UIObjectRepo, UIPoolConfig, UISingleConfig, UIUtil, ViewDict, ViewEvent, ViewHistory, ViewList, ViewRepo, ViewState, WidgetAlign, WidgetUtil, XAssetManager, XEvent, arrayutil, assetx, bitutil, camerautil, canvasutil, convertutil, ctrlrepo, docutil, errorutil, eventmgr, eventutil, floatutil, formatutil, geoutil, identutil, loadAtlas, logmgr, maputil, mathutil, netutil, parseAtlas, parsePlist, pathutil, randutil, resutil, scaleutil, stringutil, timer, timeutil, treeutil, uimgr, uirepo, uiutil, viewhistorys, viewrepo, widgetutil };
6357
6392
  //# sourceMappingURL=index.esm.js.map