targetj 1.0.205 → 1.0.206

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/build/$Dom.js CHANGED
@@ -428,6 +428,11 @@ var $Dom = exports.$Dom = /*#__PURE__*/function () {
428
428
  value: function query(selector) {
429
429
  return selector[0] === '#' ? $Dom.findById(selector) : selector[0] === '.' ? $Dom.findFirstByClass(selector) : $Dom.findFirstByTag(selector);
430
430
  }
431
+ }, {
432
+ key: "querySelector",
433
+ value: function querySelector(selector) {
434
+ return document.querySelector(selector);
435
+ }
431
436
  }, {
432
437
  key: "findById",
433
438
  value: function findById(id) {
@@ -797,7 +797,7 @@ var BaseModel = exports.BaseModel = /*#__PURE__*/function () {
797
797
  if (!targetValue) {
798
798
  return;
799
799
  }
800
- var stepInterval = interval || 7;
800
+ var stepInterval = interval || 8;
801
801
  var elapsed = now - lastUpdate;
802
802
  var stepIncrement = Math.max(1, Math.floor(elapsed / stepInterval));
803
803
  targetValue.step = Math.min(steps, targetValue.step + stepIncrement);
package/build/TModel.js CHANGED
@@ -629,7 +629,18 @@ var TModel = exports.TModel = /*#__PURE__*/function (_BaseModel) {
629
629
  }, {
630
630
  key: "hasBaseElementChanged",
631
631
  value: function hasBaseElementChanged() {
632
- return this.getBaseElement() !== this.$dom.getTagName();
632
+ return this.hasDom() ? this.getBaseElement() !== this.$dom.getTagName() : false;
633
+ }
634
+ }, {
635
+ key: "mount",
636
+ value: function mount(target) {
637
+ if (target !== undefined) {
638
+ var domHolder = _TModelUtil.TModelUtil.normalizeDomHolder(target);
639
+ if (domHolder) {
640
+ this.val('domHolder', domHolder);
641
+ }
642
+ }
643
+ (0, _App.tRoot)().addChild(this);
633
644
  }
634
645
  }, {
635
646
  key: "hasDom",
@@ -389,5 +389,20 @@ var TModelUtil = exports.TModelUtil = /*#__PURE__*/function () {
389
389
  tmodel.markLayoutDirty('islandAbsXY');
390
390
  }
391
391
  }
392
+ }, {
393
+ key: "normalizeDomHolder",
394
+ value: function normalizeDomHolder(holder) {
395
+ if (holder instanceof _$Dom.$Dom) {
396
+ return holder;
397
+ }
398
+ if (holder instanceof Element) {
399
+ return new _$Dom.$Dom(holder);
400
+ }
401
+ if (typeof holder === 'string') {
402
+ var el = _$Dom.$Dom.querySelector(holder);
403
+ return el ? new _$Dom.$Dom(el) : null;
404
+ }
405
+ return null;
406
+ }
392
407
  }]);
393
408
  }();