@cc-component/cc-ex-component 1.9.6 → 1.9.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.
@@ -60,8 +60,12 @@ interface ICollectViewEvents {
60
60
  itemSize?: ((this: any, indexPath: YXIndexPath, layout: YXFlowLayout, collectionView: YXCollectionView) => math.Size),
61
61
  onTouchCellAt?: (this: any, indexPath: YXIndexPath) => void
62
62
  numberOfItems?: ((this: any, section: number, collectionView: YXCollectionView) => number);
63
+
64
+ onCellDisplay?: (this: any, indexPath: YXIndexPath, cell: Node) => void
65
+ onCellEndDisplay?: (this: any, indexPath: YXIndexPath, cell: Node) => void
63
66
  }
64
67
 
68
+
65
69
  // 全局存储绑定关系: { className -> { uiProp: dataPath } }
66
70
  const bindingMap = new Map<any, Map<string, IBindingData>>();
67
71
  const bindingMapFunc = new Map<any, Map<string, string>>();
@@ -199,9 +203,13 @@ export function BindCollect<T extends Component>(dataPath: string, param?: IColl
199
203
  numberOfItems: param.numberOfItems as any,
200
204
  itemSize: param.itemSize as any,
201
205
  onTouchCellAt: param.onTouchCellAt,
206
+ onCellDisplay: param.onCellDisplay,
207
+ onCellEndDisplay: param.onCellEndDisplay
202
208
  }
203
209
  if (!bindingMap.has(className)) { bindingMap.set(className, new Map()); }
204
210
  bindingMap.get(className)!.set(propertyKey, data);
211
+
212
+
205
213
  };
206
214
  }
207
215
  /**
@@ -805,8 +813,12 @@ function updateStatus(data: IBindingData, com: Component, value: any, self: any)
805
813
  //const cell = collectionView.getVisibleCellNode(indexPath)
806
814
  data.onTouchCellAt?.call(self, indexPath)
807
815
  }
808
- table_collection.onCellDisplay = (cell, indexPath) => { }
809
- table_collection.onCellEndDisplay = (cell, indexPath) => { }
816
+ table_collection.onCellDisplay = (cell, indexPath) => {
817
+ data.onCellDisplay?.call(self, indexPath, cell) // 返回这个节点给列表显示
818
+ }
819
+ table_collection.onCellEndDisplay = (cell, indexPath) => {
820
+ data.onCellEndDisplay?.call(self, indexPath, cell) // 返回这个节点给列表显示
821
+ }
810
822
  }
811
823
  table_collection.reloadData()
812
824
  }
@@ -1,6 +1,7 @@
1
1
  import { UITransform, Tween, sp, director, Slider, ProgressBar, tween, Sprite, view, v3, Button, Label, Color, EventTouch, TransformBit, UISkew, Component, Widget, TweenSystem, TweenAction, misc, Node, Animation } from "cc";
2
2
  import { EDITOR_NOT_IN_PREVIEW, JSB } from "cc/env";
3
3
  import { TweenManager } from "./ExTween";
4
+ import { RichText } from "cc";
4
5
 
5
6
 
6
7
  declare global {
@@ -187,6 +188,11 @@ declare module 'cc' {
187
188
  enable(enable: boolean, time?: number): void;
188
189
  }
189
190
 
191
+ interface RichText {
192
+ /** 更新文本后,立即刷新布局*/
193
+ updateRichText(): void;
194
+ }
195
+
190
196
  interface Animation {
191
197
  /**
192
198
  * 修改动画播放的速度 (注意调用时机,应当在组件onLoad完成后调用)
@@ -674,6 +680,11 @@ Button.prototype.enable = function (this: Button, enable: boolean, time?: number
674
680
  }
675
681
  }
676
682
  };
683
+ RichText.prototype.updateRichText = function (this: RichText): void {
684
+ if (this.isValid) {
685
+ this._updateRichTextStatus()
686
+ }
687
+ };
677
688
 
678
689
  Node.prototype.touchStartAnim = function (this: Node, scale?: number, time?: number): void {
679
690
  if (this.isValid) {
@@ -1,3 +1,4 @@
1
+ import { Vec2 } from 'cc';
1
2
  import { _decorator, Component, Enum, Event, EventMouse, EventTouch, instantiate, Mask, math, Node, NodeEventType, NodePool, Prefab, ScrollView, UIOpacity, UITransform } from 'cc';
2
3
  const { ccclass, property, executionOrder, disallowMultiple, help } = _decorator;
3
4
 
@@ -1432,7 +1433,13 @@ export class YXCollectionView extends Component {
1432
1433
  private onScrollBegan() {
1433
1434
  }
1434
1435
 
1435
- private onScrolling() {
1436
+ private onScrolling(sv: ScrollView) {
1437
+ let maxOffset = sv.getMaxScrollOffset()
1438
+ let minOffset = Vec2.ZERO
1439
+ let curOffset = sv.getScrollOffset()
1440
+ if (math.Vec2.distance(maxOffset, curOffset) < 0.01 || math.Vec2.distance(minOffset, curOffset) < 0.01)
1441
+ sv.stopAutoScroll()
1442
+
1436
1443
  // 在滚动过程中仅仅是标记更新状态,具体更新业务统一到 update 里面处理,但是 layout 设置了实时更新的情况时例外
1437
1444
  if (this.layout.shouldUpdateAttributesForBoundsChange()) {
1438
1445
  this.reloadVisibleElements()
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cc-component/cc-ex-component",
3
- "version": "1.9.6",
3
+ "version": "1.9.8",
4
4
  "engine": ">=3.8.6",
5
5
  "description": "系统组件添加常用扩展方法",
6
6
  "main": "index.ts",