@cc-component/cc-ex-component 1.5.6 → 1.5.8

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.
@@ -83,6 +83,7 @@ export class ReferenceComponent extends Component {
83
83
  comList = ["EditBox", "Toggle", "ToggleContainer", "Slider", "Button", "ProgressBar", "YXCollectionView", "TableView"]
84
84
  comList2 = ["YXCollectionView", "TableView"]
85
85
  comList_base = ["EditBox", "Toggle", "ToggleContainer", "Slider", "Button", "ProgressBar"]
86
+ comListAll = ["EditBox", "Toggle", "ToggleContainer", "Slider", "Button", "ProgressBar", "ScrollView", "PageView", "Animation", 'Sprite', 'Label', 'RichText', 'ParticleSystem2D', 'Skeleton']
86
87
 
87
88
  /** 生成代码基础窗口名称 */
88
89
  public baseWindowName = "BaseWindow"
@@ -257,7 +258,7 @@ export class ReferenceComponent extends Component {
257
258
 
258
259
 
259
260
  let bind = `${bind_pix}("${name}"${this.comList2.includes(type) ? event : ""})`
260
- if (this.skipList.includes(type)) {
261
+ if (this.skipList.includes(type) || !this.comListAll.includes(type)) {
261
262
  bind = `${bind_pix}()`
262
263
  }
263
264
 
@@ -303,7 +304,7 @@ export class ReferenceComponent extends Component {
303
304
  let key = data.key;
304
305
  let name = key[0].toLowerCase() + key.substring(1);
305
306
  const type = this.getPropertyType(data.com)
306
- if (!this.skipList.includes(type)) {
307
+ if ((this.comListAll.includes(type) && !this.skipList.includes(type))) {
307
308
  //@ts-ignore
308
309
  let line = ` ${name}: ${this.getDataTypeByComponentType(type)};`//`private get ${name}() { return this.rc.get("${key}", ${this.getPropertyType(data.node)}); }`;
309
310
  sx += line + "" + (index < this.nodes.length - 1 ? "\n" : "");
@@ -419,8 +420,8 @@ export class ${className}Window extends ViewModel(${this.baseWindowName}) {${sx.
419
420
  if (node.getComponent("cc.RichText")) return "RichText";
420
421
  if (node.getComponent("cc.ParticleSystem2D")) return "ParticleSystem2D";
421
422
  if (node.getComponent("sp.Skeleton")) return "sp.Skeleton";
422
-
423
- return "Node";
423
+ const com = node.getComponentsInChildren(Component).pop()
424
+ return js.getClassName(com).replace('cc.', '');
424
425
  }
425
426
 
426
427
  getDataTypeByComponentType(compType: string) {
@@ -217,6 +217,7 @@ export function ViewModel<T extends new (...args: any[]) => Component>(Base: T)
217
217
  is_load_sub?: boolean;
218
218
  /**是否记录-不记录可重复打开窗口 */
219
219
  is_record?: boolean;
220
+ name_ui: string;
220
221
  };
221
222
  // 创建响应式数据
222
223
  _makeReactive<T extends object>(obj: T, pathPrefix: string): T {
@@ -295,7 +296,7 @@ export function ViewModel<T extends new (...args: any[]) => Component>(Base: T)
295
296
 
296
297
 
297
298
  managerData() {
298
- ExComponentModule.EmitUIWindow(this.config)
299
+ ExComponentModule.EmitUIWindow(this.config, this.viewModel)
299
300
  }
300
301
 
301
302
 
@@ -697,7 +698,8 @@ function updateStatus(data: IBindingData, com: Component, value: any, self: any)
697
698
  }
698
699
  break;
699
700
  default: {
700
- if (com) console.error(`请检查类型: ${data.type}`);
701
+ // if (com) console.error(`请检查类型: ${data.type}`);
702
+ break
701
703
  }
702
704
  }
703
705
 
@@ -15,7 +15,7 @@ export class ExComponentModule {
15
15
  param: { click: (comp: Button) => void }
16
16
  paramSprite: { loadSprite: (param: { bundle: string, path: string }) => Promise<SpriteFrame>, getSprite: (param: { bundle: string, path: string }) => SpriteFrame }
17
17
  paramSpine: { loadSpine: (param: { bundle: string, path: string }) => Promise<sp.SkeletonData>, getSpine: (param: { bundle: string, path: string }) => sp.SkeletonData }
18
- paramUIWindow: { onLoad: (config: any) => void }
18
+ paramUIWindow: { onLoad: (config: any, viewModel: any) => void }
19
19
 
20
20
  ResetBaseWindow: string = "BaseWindow";
21
21
  static Init() {
@@ -31,7 +31,7 @@ export class ExComponentModule {
31
31
  if (!isGet) ExComponentModule.Ins.ResetBaseWindow = name
32
32
  return ExComponentModule.Ins.ResetBaseWindow
33
33
  }
34
- static OnVMManager(param: { onLoad: (config: any) => void }) {
34
+ static OnVMManager(param: { onLoad: (config: any, viewModel: any) => void }) {
35
35
  ExComponentModule.Ins.paramUIWindow = param
36
36
  }
37
37
 
@@ -61,8 +61,8 @@ export class ExComponentModule {
61
61
  return ExComponentModule.Ins.paramSpine?.getSpine?.(param)
62
62
  }
63
63
 
64
- static EmitUIWindow(this: any, param: any) {
65
- return ExComponentModule.Ins.paramUIWindow?.onLoad?.call(this, param)
64
+ static EmitUIWindow(param: any, viewModel: any) {
65
+ return ExComponentModule.Ins.paramUIWindow?.onLoad?.(param, viewModel)
66
66
  }
67
67
  }
68
68
  window.ExComponentModule = ExComponentModule;
@@ -25,7 +25,7 @@ declare global {
25
25
  is_load_sub?: boolean,
26
26
  /**是否记录-不记录可重复打开窗口 */
27
27
  is_record?: boolean,
28
- }) => void
28
+ }, viewModel: any) => void
29
29
  });
30
30
  /**组件:内部使用方法 */
31
31
  function Emit(btn: Button);
@@ -34,16 +34,17 @@ declare global {
34
34
  function EmitGetSprite(param: any): SpriteFrame;
35
35
  function EmitLoadSpine(param: any): Promise<sp.SkeletonData>;
36
36
  function EmitGetSpine(param: any): sp.SkeletonData;
37
- function EmitUIWindow(this: any, param: {
37
+ function EmitUIWindow(param: {
38
38
  module: string,
39
39
  layer: string,
40
40
  path: string,
41
41
  bundle: string,
42
42
  name?: string,/**窗口名称 */
43
+ name_ui?: string,/**窗口名称 */
43
44
  index?: number,
44
45
  is_load_sub?: boolean,
45
46
  /**是否记录-不记录可重复打开窗口 */
46
47
  is_record?: boolean,
47
- });
48
+ }, viewModel: any);
48
49
  }
49
50
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cc-component/cc-ex-component",
3
- "version": "1.5.6",
3
+ "version": "1.5.8",
4
4
  "engine": ">=3.8.6",
5
5
  "description": "系统组件添加常用扩展方法",
6
6
  "main": "index.ts",