targetj 1.0.119 → 1.0.121

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/README.md CHANGED
@@ -83,7 +83,7 @@ This method is invoked only after the final step of updating the actual value is
83
83
  - Similar to `onImperativeStep`, but it is triggered when an imperative target completes. If multiple targets are expected to complete, you can use `on${targetName}End` instead. For example, `onWidthEnd` is called when the `width` target gets completed.
84
84
 
85
85
  12. **active**
86
- This is only property. It indicates that the target is in an inactive state and is not ready to be executed.
86
+ This is only property. It indicates that the target is in an inactive state and is not ready to be executed. You can also prefix the target name with '_' to achieve the same effect as setting active to false.
87
87
 
88
88
  13. **initialValue**
89
89
  This is only property. It defines the initial value of the actual value.
@@ -320,39 +320,37 @@ This example demonstrates how to handle scroll events and develop a simple infin
320
320
  import { App, TModel, getEvents, getScreenHeight, getScreenWidth, } from "targetj";
321
321
 
322
322
  App(new TModel("scroller", {
323
- canHandleEvents: "scrollTop",
323
+ domHolder: true,
324
+ overflow: 'hidden',
324
325
  containerOverflowMode: 'always',
325
- children: {
326
- value() {
326
+ children() {
327
327
  const childrenCount = this.getChildren().length;
328
- return Array.from({ length: 5 }, (_, i) =>
329
- new TModel("scrollItem", {
330
- width: 300,
331
- background: "#B388FF",
332
- height: 30,
333
- color: "#fff",
334
- textAlign: "center",
335
- lineHeight: 30,
336
- bottomMargin: 2,
337
- x() { return this.getCenterX(); },
338
- html: childrenCount + i,
328
+ return Array.from({ length: 10 }, (_, i) =>
329
+ new TModel('scrollItem', {
330
+ width: 300,
331
+ background: '#B388FF',
332
+ height: 32,
333
+ color: '#C2FC61',
334
+ textAlign: 'center',
335
+ lineHeight: 32,
336
+ bottomMargin: 2,
337
+ x() { return this.getCenterX(); },
338
+ html: childrenCount + i
339
339
  })
340
- );
341
- },
342
- enabledOn() {
343
- return (this.visibleChildren.length - 1) * 32 < this.getHeight();
344
- },
345
- },
346
- scrollTop(cycle, lastValue) {
347
- return Math.max(0, lastValue + getEvents().deltaY());
340
+ );
341
+ },
342
+ width() { return getScreenWidth(); },
343
+ height() { return getScreenHeight(); },
344
+ onResize: [ 'width', 'height' ],
345
+ onScrollEvent() {
346
+ this.setTarget('scrollTop', Math.max(0, this.getScrollTop() + getEvents().deltaY()));
348
347
  },
349
- width: getScreenWidth,
350
- height: getScreenHeight,
351
- onResize: [ "width", "height" ],
352
- onScrollEvent: "scrollTop",
353
- onVisibleChildrenChange: "children"
354
- })
355
- );
348
+ onVisibleChildrenChange() {
349
+ if (getEvents().dir() !== 'up' && this.visibleChildren.length * 34 < this.getHeight()) {
350
+ this.activateTarget('children');
351
+ }
352
+ }
353
+ }));
356
354
  ```
357
355
 
358
356
  ## Simple Single Page App Example
@@ -185,24 +185,27 @@ var BaseModel = exports.BaseModel = /*#__PURE__*/function () {
185
185
  this.asyncStyleTargetMap[key] = true;
186
186
  }
187
187
  } else if (this.isStyleTarget(key)) {
188
+ var styleFlag = true;
188
189
  if (_TargetUtil.TargetUtil.transformMap[key]) {
189
190
  if (this.getParent()) {
190
191
  this.calcAbsolutePosition(this.getX(), this.getY());
191
192
  }
192
193
  if (_TModelUtil.TModelUtil.getTransformValue(this, key) === this.transformMap[key]) {
193
- return;
194
+ styleFlag = false;
194
195
  }
195
196
  } else if (key === 'width' || key === 'height') {
196
197
  var dimension = Math.floor(key === 'width' ? this.getWidth() : this.getHeight());
197
198
  if (this.styleMap[key] === dimension) {
198
- return;
199
+ styleFlag = false;
199
200
  }
200
201
  } else if (_TUtil.TUtil.isDefined(this.val(key)) && this.styleMap[key] === this.val(key)) {
201
- return;
202
+ styleFlag = false;
202
203
  }
203
- this.styleTargetList.push(key);
204
- this.styleTargetMap[key] = true;
205
- } else if (this.useWindowFrame(key)) {
204
+ if (styleFlag && !this.styleTargetMap[key]) {
205
+ this.styleTargetList.push(key);
206
+ this.styleTargetMap[key] = true;
207
+ }
208
+ } else if (this.useWindowFrame(key) && !this.styleTargetMap[key]) {
206
209
  this.styleTargetList.push(key);
207
210
  this.styleTargetMap[key] = true;
208
211
  } else {
@@ -146,6 +146,11 @@ var RunScheduler = exports.RunScheduler = /*#__PURE__*/function () {
146
146
  this.processRerunQueue();
147
147
  }
148
148
  }
149
+ }, {
150
+ key: "doesExecuterNeedsRerun",
151
+ value: function doesExecuterNeedsRerun() {
152
+ return _TargetExecutor.TargetExecutor.needsRerun;
153
+ }
149
154
  }, {
150
155
  key: "processRerunQueue",
151
156
  value: function processRerunQueue() {
@@ -228,13 +233,14 @@ var RunScheduler = exports.RunScheduler = /*#__PURE__*/function () {
228
233
  }
229
234
  }, {
230
235
  key: "insertRun",
231
- value: function insertRun(runId, now, delay) {
236
+ value: function insertRun(newRunId, newInsertTime, newDelay) {
232
237
  var low = 0,
233
238
  high = this.nextRuns.length;
234
239
  while (low < high) {
235
240
  var mid = Math.floor((low + high) / 2);
236
- var nextRunDelay = this.nextRuns[mid].delay;
237
- var diff = nextRunDelay - delay;
241
+ var delay = this.nextRuns[mid].delay;
242
+ var insertTime = this.nextRuns[mid].insertTime;
243
+ var diff = insertTime + delay - (newInsertTime + newDelay);
238
244
  if (diff > 0) {
239
245
  high = mid;
240
246
  } else if (diff < 0) {
@@ -244,9 +250,9 @@ var RunScheduler = exports.RunScheduler = /*#__PURE__*/function () {
244
250
  }
245
251
  }
246
252
  this.nextRuns.splice(low, 0, {
247
- runId: runId,
248
- insertTime: now,
249
- delay: delay
253
+ runId: newRunId,
254
+ insertTime: newInsertTime,
255
+ delay: newDelay
250
256
  });
251
257
  }
252
258
  }]);
@@ -308,6 +308,7 @@ var TModelManager = exports.TModelManager = /*#__PURE__*/function () {
308
308
  tmodel.$dom = new _$Dom.$Dom();
309
309
  _TModelUtil.TModelUtil.createDom(tmodel);
310
310
  tmodel.getDomHolder(tmodel).appendTModel$Dom(tmodel);
311
+ tmodel.hasDomNow = true;
311
312
  }
312
313
  }
313
314
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "targetj",
3
- "version": "1.0.119",
3
+ "version": "1.0.121",
4
4
  "keywords": [
5
5
  "targetj"
6
6
  ],