pixuireactcomponents 1.5.39 → 1.5.40

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.
@@ -18,20 +18,20 @@ var MainLibImpl = /** @class */ (function () {
18
18
  function MainLibImpl() {
19
19
  }
20
20
  MainLibImpl.prototype.load = function () {
21
- console.log('loading openplatfrom');
21
+ console.log('component: loading openplatfrom');
22
22
  this.lib = loadlib.loadLib('openplatform');
23
23
  if (this.lib == undefined) {
24
- console.log('load failed');
24
+ console.log('component: load failed');
25
25
  }
26
26
  else {
27
- console.log('load success');
28
- console.log('function table start');
27
+ console.log('component: load success');
28
+ console.log('component: function table start');
29
29
  for (var k in this.lib) {
30
30
  if (k.startsWith('JS_')) {
31
31
  console.log("".concat(k));
32
32
  }
33
33
  }
34
- console.log('function table end');
34
+ console.log('component: function table end');
35
35
  }
36
36
  };
37
37
  MainLibImpl.prototype.isLoadSuccess = function () {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pixuireactcomponents",
3
- "version": "1.5.39",
3
+ "version": "1.5.40",
4
4
  "description": "pixui react components",
5
5
  "main": "index.js",
6
6
  "sideEffects": false,
@@ -69,10 +69,6 @@ interface VirtualListProps {
69
69
  touchBottomThreshold?: number;
70
70
  /** 加载更多数据的回调函数 */
71
71
  loadMore?: () => Promise<void>;
72
- /** 顶部区域组件 */
73
- TopArea?: h.JSX.Element;
74
- /** 顶部区域尺寸 */
75
- topAreaSize?: number;
76
72
  /** 滚动相关配置属性 */
77
73
  scrollProps?: VirtualListScrollProps;
78
74
  }
@@ -104,13 +100,12 @@ export declare class VirtualList extends Component<VirtualListProps, VirtualList
104
100
  protected isLoading: boolean;
105
101
  /** 视窗可见数量 */
106
102
  protected visibleCount: number;
107
- /** 顶部区域高度 */
108
- protected topHeight: number;
109
103
  constructor(props: VirtualListProps);
110
104
  componentDidMount(): void;
111
105
  shouldComponentUpdate(nextProps: Readonly<VirtualListProps>, nextState: Readonly<VirtualListState>, nextContext: any): boolean;
112
106
  componentWillReceiveProps(nextProps: Readonly<VirtualListProps>): void;
113
107
  onScroll: (e: Event) => void;
108
+ private HandleScrollProps;
114
109
  render(): h.JSX.Element;
115
110
  }
116
111
  export {};
@@ -104,8 +104,7 @@ var VirtualList = /** @class */ (function (_super) {
104
104
  height: props.itemSize,
105
105
  width: props.width,
106
106
  };
107
- _this.topHeight = _this.props.topAreaSize || 0;
108
- _this.listHeight = props.itemCount * props.itemSize + _this.topHeight;
107
+ _this.listHeight = props.itemCount * props.itemSize;
109
108
  _this.state = {
110
109
  start: 0,
111
110
  end: 0,
@@ -132,7 +131,7 @@ var VirtualList = /** @class */ (function (_super) {
132
131
  this.itemCount = this.visibleCount;
133
132
  for (var i = 0; i < this.itemCount + this.props.cacheSize * 2; i++) {
134
133
  var ref = createRef();
135
- var itemCrossSize = this.props.layout === 'horizontal' ? this.props.height : this.props.width;
134
+ var itemCrossSize = "100%";
136
135
  var item = {
137
136
  vNode: (h(VirtualListItem, { layout: this.props.layout, index: i, key: i, ref: ref, itemMainSize: this.props.itemSize, itemCrossSize: itemCrossSize, child: this.props.renderItemFunc(i) })),
138
137
  isValid: false,
@@ -153,18 +152,50 @@ var VirtualList = /** @class */ (function (_super) {
153
152
  this.setState({
154
153
  start: 0,
155
154
  end: Math.min(this.state.start + this.visibleCount, nextProps.itemCount),
156
- listHeight: nextProps.itemCount * nextProps.itemSize + this.topHeight,
155
+ listHeight: nextProps.itemCount * nextProps.itemSize,
157
156
  });
158
157
  this.ref.scrollTop = 0;
159
158
  this.forceUpdate();
160
159
  }
161
160
  if (nextProps.itemCount !== this.props.itemCount) {
162
161
  this.setState({
163
- listHeight: nextProps.itemCount * nextProps.itemSize + this.topHeight,
162
+ listHeight: nextProps.itemCount * nextProps.itemSize,
164
163
  });
165
164
  this.forceUpdate();
166
165
  }
167
166
  };
167
+ VirtualList.prototype.HandleScrollProps = function () {
168
+ var scrollProps = {
169
+ movementType: 'elastic',
170
+ scrollSensitivity: 1,
171
+ inertiaVersion: 2,
172
+ decelerationRate: 0.135,
173
+ staticVelocityDrag: 100,
174
+ frictionCoefficient: 2.0,
175
+ };
176
+ if (this.props.scrollProps) {
177
+ /* 兼容双问号 */
178
+ if (this.props.scrollProps.movementType !== null && this.props.scrollProps.movementType !== undefined) {
179
+ scrollProps.movementType = this.props.scrollProps.movementType;
180
+ }
181
+ if (this.props.scrollProps.scrollSensitivity !== null && this.props.scrollProps.scrollSensitivity !== undefined) {
182
+ scrollProps.scrollSensitivity = this.props.scrollProps.scrollSensitivity;
183
+ }
184
+ if (this.props.scrollProps.inertiaVersion !== null && this.props.scrollProps.inertiaVersion !== undefined) {
185
+ scrollProps.inertiaVersion = this.props.scrollProps.inertiaVersion;
186
+ }
187
+ if (this.props.scrollProps.decelerationRate !== null && this.props.scrollProps.decelerationRate !== undefined) {
188
+ scrollProps.decelerationRate = this.props.scrollProps.decelerationRate;
189
+ }
190
+ if (this.props.scrollProps.staticVelocityDrag !== null && this.props.scrollProps.staticVelocityDrag !== undefined) {
191
+ scrollProps.staticVelocityDrag = this.props.scrollProps.staticVelocityDrag;
192
+ }
193
+ if (this.props.scrollProps.frictionCoefficient !== null && this.props.scrollProps.frictionCoefficient !== undefined) {
194
+ scrollProps.frictionCoefficient = this.props.scrollProps.frictionCoefficient;
195
+ }
196
+ }
197
+ return scrollProps;
198
+ };
168
199
  VirtualList.prototype.render = function () {
169
200
  var _this = this;
170
201
  var start = Math.max(0, this.state.start - this.props.cacheSize);
@@ -217,33 +248,8 @@ var VirtualList = /** @class */ (function (_super) {
217
248
  height: "".concat(this.state.listHeight, "px"),
218
249
  };
219
250
  }
220
- /* 兼容双问号 */
221
- var movementType = 'elastic';
222
- if (this.props.scrollProps && this.props.scrollProps.movementType !== null && this.props.scrollProps.movementType !== undefined) {
223
- movementType = this.props.scrollProps.movementType;
224
- }
225
- var scrollSensitivity = 1;
226
- if (this.props.scrollProps && this.props.scrollProps.scrollSensitivity !== null && this.props.scrollProps.scrollSensitivity !== undefined) {
227
- scrollSensitivity = this.props.scrollProps.scrollSensitivity;
228
- }
229
- var inertiaVersion = 2;
230
- if (this.props.scrollProps && this.props.scrollProps.inertiaVersion !== null && this.props.scrollProps.inertiaVersion !== undefined) {
231
- inertiaVersion = this.props.scrollProps.inertiaVersion;
232
- }
233
- var decelerationRate = 0.135;
234
- if (this.props.scrollProps && this.props.scrollProps.decelerationRate !== null && this.props.scrollProps.decelerationRate !== undefined) {
235
- decelerationRate = this.props.scrollProps.decelerationRate;
236
- }
237
- var staticVelocityDrag = 100;
238
- if (this.props.scrollProps && this.props.scrollProps.staticVelocityDrag !== null && this.props.scrollProps.staticVelocityDrag !== undefined) {
239
- staticVelocityDrag = this.props.scrollProps.staticVelocityDrag;
240
- }
241
- var frictionCoefficient = 2.0;
242
- if (this.props.scrollProps && this.props.scrollProps.frictionCoefficient !== null && this.props.scrollProps.frictionCoefficient !== undefined) {
243
- frictionCoefficient = this.props.scrollProps.frictionCoefficient;
244
- }
245
- return (h("div", { key: "VirtualListRoot", id: 'VirtualListRoot', "movement-type": movementType, "scroll-sensitivity": scrollSensitivity, "inertia-version": inertiaVersion, "deceleration-rate": decelerationRate, "static-velocity-drag": staticVelocityDrag, "friction-coefficient": frictionCoefficient, ref: this.ref, onScroll: this.onScroll, style: __assign({ position: 'relative', overflow: 'scroll', flexDirection: this.props.layout === 'horizontal' ? 'row' : 'column', width: this.props.width, height: this.props.height }, this.props.style) },
246
- this.props.TopArea,
251
+ var scrollProps = this.HandleScrollProps();
252
+ return (h("div", { key: "VirtualListRoot", id: 'VirtualListRoot', className: 'VirtualListRoot', "movement-type": scrollProps.movementType, "scroll-sensitivity": scrollProps.scrollSensitivity, "inertia-version": scrollProps.inertiaVersion, "deceleration-rate": scrollProps.decelerationRate, "static-velocity-drag": scrollProps.staticVelocityDrag, "friction-coefficient": scrollProps.frictionCoefficient, ref: this.ref, onScroll: this.onScroll, style: __assign({ position: 'relative', overflow: 'scroll', flexDirection: this.props.layout === 'horizontal' ? 'row' : 'column', width: this.props.width, height: this.props.height }, this.props.style) },
247
253
  h("div", { key: "VirtualList", id: 'VirtualList', style: VirtualListStyle }, this.itemCache.map(function (item) { return item.vNode; }))));
248
254
  };
249
255
  return VirtualList;
@@ -37,8 +37,6 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
37
37
  import { sha1 } from './Sha1';
38
38
  import { LibMgr } from '../../../lib/loadlib/lib_mgr';
39
39
  var assetPrefix = 'cacheAsset';
40
- var OPLib = LibMgr.getInstance().getMainLib();
41
- console.log('new lib test');
42
40
  /**
43
41
  * 缓存资源到本地,仅jssdk环境可用
44
42
  */
@@ -54,8 +52,10 @@ export var assetCache;
54
52
  assetCache.cache = function (url, force, retryTimes) {
55
53
  if (retryTimes === void 0) { retryTimes = 3; }
56
54
  return __awaiter(_this, void 0, void 0, function () {
55
+ var OPLib;
57
56
  var _this = this;
58
57
  return __generator(this, function (_a) {
58
+ OPLib = LibMgr.getInstance().getMainLib();
59
59
  console.log('cacheAsset---', url);
60
60
  return [2 /*return*/, new Promise(function (resolve, reject) { return __awaiter(_this, void 0, void 0, function () {
61
61
  var urlWithoutParams, localPath, xhr;
@@ -139,6 +139,7 @@ export var assetCache;
139
139
  });
140
140
  };
141
141
  assetCache.getFileCachePath = function (url) {
142
+ var OPLib = LibMgr.getInstance().getMainLib();
142
143
  console.log('getCachePath', url);
143
144
  if (!OPLib.isLoadSuccess()) {
144
145
  console.log('非jssdk环境');
@@ -203,6 +204,7 @@ export var assetCache;
203
204
  });
204
205
  };
205
206
  var getLocalPath = function (url) {
207
+ var OPLib = LibMgr.getInstance().getMainLib();
206
208
  console.log('getLocalPath', url);
207
209
  var cachePath = OPLib.getCachePath();
208
210
  if (!cachePath) {