targetj 1.0.93 → 1.0.95

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/Export.js CHANGED
@@ -3,8 +3,8 @@ export * from "./build/TModel.js"
3
3
  export * from "./build/Moves.js"
4
4
  export * from "./build/SearchUtil.js"
5
5
  export * from "./build/TargetUtil.js"
6
+ export * from "./build/TModelUtil.js"
6
7
  export * from "./build/TUtil.js"
7
- export * from "./build/ColorUtil.js"
8
8
  export * from "./build/$Dom.js"
9
9
  export * from "./build/Bracket.js"
10
10
  export * from "./build/BracketGenerator.js"
package/README.md CHANGED
@@ -350,46 +350,44 @@ This example demonstrates how to handle scroll events and develop a simple infin
350
350
  ```bash
351
351
  import { App, TModel, getEvents, getScreenHeight, getScreenWidth, } from "targetj";
352
352
 
353
- App(
354
- new TModel("scroller", {
355
- canHandleEvents: "scrollTop",
353
+ App(new TModel("scroller", {
354
+ canHandleEvents: 'scrollTop',
356
355
  innerXEast: 0,
357
- addChildren: {
358
- loop() {
359
- return this.inFlowVisibles.length * 32 < this.getHeight();
360
- },
361
- value() {
362
- const childrenCount = this.getChildren().length;
363
- for (let i = 0; i < 10; i++) {
364
- this.addChild(
365
- new TModel("scrollItem", {
366
- width: 300,
367
- background: "brown",
368
- height: 30,
369
- lineHeight: 30,
370
- color: "#fff",
371
- style: { textAlign: "center" },
372
- bottomMargin: 2,
373
- x() { return (this.getParentValue("width") - this.getWidth()) / 2; },
374
- html: childrenCount + i + 1,
375
- })
376
- );
377
- }
378
- },
379
- enabledOn() {
380
- return this.inFlowVisibles.length * 32 < this.getHeight();
381
- },
382
- },
383
- scrollTop(cycle, lastValue) {
384
- return Math.max(0, lastValue + getEvents().deltaY());
356
+ children: {
357
+ value() {
358
+ const childrenCount = this.getChildren().length;
359
+ return Array.from({ length: 5 }, (_, i) =>
360
+ new TModel('scrollItem', {
361
+ width: 300,
362
+ background: 'brown',
363
+ height: 30,
364
+ color: '#fff',
365
+ style: {
366
+ textAlign: 'center',
367
+ lineHeight: '30px'
368
+ },
369
+ bottomMargin: 2,
370
+ x() { return (this.getParentValue('width') - this.getWidth()) / 2; },
371
+ html: childrenCount + i,
372
+ domParent() {
373
+ return this.getParent();
374
+ }
375
+ })
376
+ );
377
+ },
378
+ enabledOn() {
379
+ return this.visibleChildren.length * 32 < this.getHeight();
380
+ }
385
381
  },
386
- width: getScreenWidth,
387
- height: getScreenHeight,
388
- onResize: ["width", "height"],
389
- onScrollEvent: ["scrollTop", "addChildren"],
390
- })
391
- );
392
-
382
+ scrollTop(cycle, lastValue) {
383
+ return Math.max(0, lastValue + getEvents().deltaY());
384
+ },
385
+ width() { return getScreenWidth(); },
386
+ height() { return getScreenHeight(); },
387
+ onResize: [ 'width', 'height' ],
388
+ onScrollEvent: [ 'scrollTop', 'children' ],
389
+ onVisibleChildrenChange: [ 'children' ]
390
+ }));
393
391
  ```
394
392
 
395
393
  ## Simple Single Page App Example
package/build/$Dom.js CHANGED
@@ -57,6 +57,11 @@ var $Dom = exports.$Dom = /*#__PURE__*/function () {
57
57
  value: function focus() {
58
58
  this.element.focus();
59
59
  }
60
+ }, {
61
+ key: "blur",
62
+ value: function blur() {
63
+ this.element.blur();
64
+ }
60
65
  }, {
61
66
  key: "attr",
62
67
  value: function attr(name, value) {
package/build/App.js CHANGED
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.tRoot = exports.tApp = exports.isRunning = exports.getScreenWidth = exports.getScreenHeight = exports.getRunScheduler = exports.getPager = exports.getManager = exports.getLocationManager = exports.getLoader = exports.getEvents = exports.getBrowser = exports.App = void 0;
6
+ exports.tRoot = exports.tApp = exports.isRunning = exports.getVisibles = exports.getScreenWidth = exports.getScreenHeight = exports.getRunScheduler = exports.getPager = exports.getManager = exports.getLocationManager = exports.getLoader = exports.getEvents = exports.getBrowser = exports.App = void 0;
7
7
  var _$Dom = require("./$Dom.js");
8
8
  var _TModel = require("./TModel.js");
9
9
  var _Browser = require("./Browser.js");
@@ -149,28 +149,28 @@ var isRunning = exports.isRunning = function isRunning() {
149
149
  return tApp ? tApp.runningFlag : false;
150
150
  };
151
151
  var tRoot = exports.tRoot = function tRoot() {
152
- return tApp ? tApp.tRoot : null;
152
+ return tApp ? tApp.tRoot : undefined;
153
153
  };
154
154
  var getEvents = exports.getEvents = function getEvents() {
155
- return tApp ? tApp.events : null;
155
+ return tApp ? tApp.events : undefined;
156
156
  };
157
157
  var getPager = exports.getPager = function getPager() {
158
- return tApp ? tApp.pager : null;
158
+ return tApp ? tApp.pager : undefined;
159
159
  };
160
160
  var getLoader = exports.getLoader = function getLoader() {
161
- return tApp ? tApp.loader : null;
161
+ return tApp ? tApp.loader : undefined;
162
162
  };
163
163
  var getManager = exports.getManager = function getManager() {
164
- return tApp ? tApp.manager : null;
164
+ return tApp ? tApp.manager : undefined;
165
165
  };
166
166
  var getRunScheduler = exports.getRunScheduler = function getRunScheduler() {
167
- return tApp ? tApp.runScheduler : null;
167
+ return tApp ? tApp.runScheduler : undefined;
168
168
  };
169
169
  var getLocationManager = exports.getLocationManager = function getLocationManager() {
170
- return tApp ? tApp.locationManager : null;
170
+ return tApp ? tApp.locationManager : undefined;
171
171
  };
172
172
  var getBrowser = exports.getBrowser = function getBrowser() {
173
- return tApp ? tApp.browser : null;
173
+ return tApp ? tApp.browser : undefined;
174
174
  };
175
175
  var getScreenWidth = exports.getScreenWidth = function getScreenWidth() {
176
176
  return tApp ? tApp.browser.screen.width : 0;
@@ -178,4 +178,7 @@ var getScreenWidth = exports.getScreenWidth = function getScreenWidth() {
178
178
  var getScreenHeight = exports.getScreenHeight = function getScreenHeight() {
179
179
  return tApp ? tApp.browser.screen.height : 0;
180
180
  };
181
+ var getVisibles = exports.getVisibles = function getVisibles() {
182
+ return tApp ? tApp.manager.lists.visible : undefined;
183
+ };
181
184
  window.t = window.t || _SearchUtil.SearchUtil.find;
@@ -6,27 +6,26 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.BaseModel = void 0;
7
7
  var _App = require("./App.js");
8
8
  var _TargetExecutor = require("./TargetExecutor.js");
9
- var _Viewport = require("./Viewport.js");
10
9
  var _TUtil = require("./TUtil.js");
11
- var _SearchUtil = require("./SearchUtil.js");
12
10
  var _TModelUtil = require("./TModelUtil.js");
13
- function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
14
- function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
15
- function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
16
- function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
11
+ var _TargetUtil = require("./TargetUtil.js");
17
12
  function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; }
18
13
  function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
19
14
  function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
15
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
20
16
  function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
21
17
  function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
22
18
  function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
23
19
  function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
24
20
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
25
21
  function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
22
+ /**
23
+ * It provides the target state and associated logic to the TModel.
24
+ */
26
25
  var BaseModel = exports.BaseModel = /*#__PURE__*/function () {
27
26
  function BaseModel(type, targets) {
28
27
  _classCallCheck(this, BaseModel);
29
- if (arguments.length === 1 && _typeof(type) === 'object') {
28
+ if (_typeof(type) === 'object' && typeof targets === 'undefined') {
30
29
  targets = type;
31
30
  type = "";
32
31
  }
@@ -36,6 +35,7 @@ var BaseModel = exports.BaseModel = /*#__PURE__*/function () {
36
35
  this.oid = uniqueId.oid;
37
36
  this.oidNum = uniqueId.num;
38
37
  this.targetValues = {};
38
+ this.actualValues = {};
39
39
  this.activeTargetList = [];
40
40
  this.activeTargetMap = {};
41
41
  this.updatingTargetList = [];
@@ -44,29 +44,10 @@ var BaseModel = exports.BaseModel = /*#__PURE__*/function () {
44
44
  this.updatingTargetMap = {};
45
45
  this.updatingChildrenList = [];
46
46
  this.updatingChildrenMap = {};
47
- this.addedChildren = {
48
- count: 0,
49
- list: []
50
- };
51
- this.deletedChildren = [];
52
- this.lastChildrenUpdate = {
53
- additions: [],
54
- deletions: []
55
- };
56
- this.allChildren = [];
57
- this.x = 0;
58
- this.y = 0;
59
- this.absX = 0;
60
- this.absY = 0;
47
+ this.eventTargets = [];
48
+ this.styleTargetList = [];
49
+ this.styleTargetMap = {};
61
50
  this.parent = null;
62
- this.visibilityStatus = {
63
- top: false,
64
- right: false,
65
- bottom: false,
66
- left: false
67
- };
68
- this.visible = false;
69
- this.inFlowVisibles = [];
70
51
  this.targetMethodMap = {};
71
52
  }
72
53
  return _createClass(BaseModel, [{
@@ -79,6 +60,72 @@ var BaseModel = exports.BaseModel = /*#__PURE__*/function () {
79
60
  value: function getRealParent() {
80
61
  return this.parent;
81
62
  }
63
+ }, {
64
+ key: "initTargets",
65
+ value: function initTargets() {
66
+ var _this = this;
67
+ this.actualValues = _TModelUtil.TModelUtil.initializeActualValues();
68
+ this.targetValues = {};
69
+ this.activeTargetMap = {};
70
+ this.activeTargetList = [];
71
+ Object.keys(this.targets).forEach(function (key) {
72
+ _this.processNewTarget(key);
73
+ });
74
+ }
75
+ }, {
76
+ key: "processNewTarget",
77
+ value: function processNewTarget(key) {
78
+ if (!_TUtil.TUtil.isDefined(this.targets[key])) {
79
+ delete this.actualValues[key];
80
+ return;
81
+ }
82
+ _TargetUtil.TargetUtil.bindTargetName(this.targets, key);
83
+ if (_TUtil.TUtil.isDefined(this.targets[key].initialValue)) {
84
+ this.actualValues[key] = this.targets[key].initialValue;
85
+ this.addToStyleTargetList(key);
86
+ }
87
+ if (_TargetUtil.TargetUtil.targetConditionMap[key] && this.eventTargets.indexOf(key === -1)) {
88
+ this.eventTargets.push(key);
89
+ }
90
+ if (this.targets[key].active !== false) {
91
+ this.addToActiveTargets(key);
92
+ }
93
+ }
94
+ }, {
95
+ key: "addToStyleTargetList",
96
+ value: function addToStyleTargetList(key) {
97
+ if (!_TargetUtil.TargetUtil.styleTargetMap[key]) {
98
+ return;
99
+ }
100
+ if (!this.styleTargetMap[key]) {
101
+ this.styleTargetList.push(key);
102
+ this.styleTargetMap[key] = true;
103
+ }
104
+ }
105
+ }, {
106
+ key: "removeTarget",
107
+ value: function removeTarget(key) {
108
+ delete this.targets[key];
109
+ this.removeFromActiveTargets(key);
110
+ this.removeFromUpdatingTargets(key);
111
+ delete this.targetValues[key];
112
+ }
113
+ }, {
114
+ key: "addTarget",
115
+ value: function addTarget(key, target) {
116
+ this.addTargets(_defineProperty({}, key, target));
117
+ }
118
+ }, {
119
+ key: "addTargets",
120
+ value: function addTargets(targets) {
121
+ var _this2 = this;
122
+ Object.keys(targets).forEach(function (key) {
123
+ _this2.targets[key] = targets[key];
124
+ _this2.removeFromUpdatingTargets(key);
125
+ _this2.processNewTarget(key);
126
+ });
127
+ (0, _App.getRunScheduler)().schedule(10, 'addTargets-' + this.oid);
128
+ }
82
129
  }, {
83
130
  key: "getTargetStepPercent",
84
131
  value: function getTargetStepPercent(key, step) {
@@ -217,9 +264,6 @@ var BaseModel = exports.BaseModel = /*#__PURE__*/function () {
217
264
  }, {
218
265
  key: "isTargetEnabled",
219
266
  value: function isTargetEnabled(key) {
220
- if (this.isTargetImperative(key)) {
221
- return true;
222
- }
223
267
  var target = this.targets[key];
224
268
  if (!_TUtil.TUtil.isDefined(target)) {
225
269
  return false;
@@ -360,7 +404,7 @@ var BaseModel = exports.BaseModel = /*#__PURE__*/function () {
360
404
  }, {
361
405
  key: "addToActiveTargets",
362
406
  value: function addToActiveTargets(key) {
363
- var _this = this;
407
+ var _this3 = this;
364
408
  if (!this.activeTargetMap[key]) {
365
409
  this.activeTargetMap[key] = true;
366
410
  var priorityOrder = ['y', 'x', 'height', 'width', 'start'];
@@ -370,8 +414,8 @@ var BaseModel = exports.BaseModel = /*#__PURE__*/function () {
370
414
  return !priorityOrder.includes(item);
371
415
  });
372
416
  priorityOrder.forEach(function (priorityKey) {
373
- if (_this.activeTargetMap[priorityKey]) {
374
- _this.activeTargetList.unshift(priorityKey);
417
+ if (_this3.activeTargetMap[priorityKey]) {
418
+ _this3.activeTargetList.unshift(priorityKey);
375
419
  }
376
420
  });
377
421
  } else {
@@ -434,6 +478,30 @@ var BaseModel = exports.BaseModel = /*#__PURE__*/function () {
434
478
  }
435
479
  return false;
436
480
  }
481
+ }, {
482
+ key: "addToUpdatingChildren",
483
+ value: function addToUpdatingChildren(child) {
484
+ if (!this.updatingChildrenMap[child.oid]) {
485
+ this.updatingChildrenMap[child.oid] = true;
486
+ this.updatingChildrenList.push(child.oid);
487
+ }
488
+ }
489
+ }, {
490
+ key: "removeFromUpdatingChildren",
491
+ value: function removeFromUpdatingChildren(child) {
492
+ if (this.updatingChildrenMap[child.oid]) {
493
+ delete this.updatingChildrenMap[child.oid];
494
+ var index = this.updatingChildrenList.indexOf(child.oid);
495
+ if (index >= 0) {
496
+ this.updatingChildrenList.splice(index, 1);
497
+ }
498
+ }
499
+ }
500
+ }, {
501
+ key: "hasUpdatingChildren",
502
+ value: function hasUpdatingChildren() {
503
+ return this.updatingChildrenList.length > 0;
504
+ }
437
505
  }, {
438
506
  key: "deleteTargetValue",
439
507
  value: function deleteTargetValue(key) {
@@ -466,17 +534,17 @@ var BaseModel = exports.BaseModel = /*#__PURE__*/function () {
466
534
  }, {
467
535
  key: "activateTargets",
468
536
  value: function activateTargets(keys) {
469
- var _this2 = this;
537
+ var _this4 = this;
470
538
  keys.forEach(function (key) {
471
- var targetValue = _this2.targetValues[key];
539
+ var targetValue = _this4.targetValues[key];
472
540
  if (targetValue) {
473
541
  targetValue.executionFlag = false;
474
542
  targetValue.scheduleTimeStamp = undefined;
475
543
  targetValue.step = 0;
476
544
  targetValue.cycle = 0;
477
- _this2.updateTargetStatus(key);
545
+ _this4.updateTargetStatus(key);
478
546
  } else {
479
- _this2.addToActiveTargets(key);
547
+ _this4.addToActiveTargets(key);
480
548
  }
481
549
  });
482
550
  (0, _App.getRunScheduler)().schedule(10, 'activateTargets-' + this.oid);
@@ -492,181 +560,5 @@ var BaseModel = exports.BaseModel = /*#__PURE__*/function () {
492
560
  this.targetMethodMap[targetName].push(methodName);
493
561
  }
494
562
  }
495
- }, {
496
- key: "addToUpdatingChildren",
497
- value: function addToUpdatingChildren(child) {
498
- if (!this.updatingChildrenMap[child.oid]) {
499
- this.updatingChildrenMap[child.oid] = true;
500
- this.updatingChildrenList.push(child.oid);
501
- }
502
- }
503
- }, {
504
- key: "removeFromUpdatingChildren",
505
- value: function removeFromUpdatingChildren(child) {
506
- if (this.updatingChildrenMap[child.oid]) {
507
- delete this.updatingChildrenMap[child.oid];
508
- var index = this.updatingChildrenList.indexOf(child.oid);
509
- if (index >= 0) {
510
- this.updatingChildrenList.splice(index, 1);
511
- }
512
- }
513
- }
514
- }, {
515
- key: "hasUpdatingChildren",
516
- value: function hasUpdatingChildren() {
517
- return this.updatingChildrenList.length > 0;
518
- }
519
- }, {
520
- key: "addChild",
521
- value: function addChild(child) {
522
- var index = this.addedChildren.count + this.allChildren.length;
523
- this.addedChildren.count++;
524
- _TModelUtil.TModelUtil.addItem(this.addedChildren.list, child, index);
525
- (0, _App.getRunScheduler)().schedule(10, 'addChild-' + this.oid + "-" + child.oid);
526
- return this;
527
- }
528
- }, {
529
- key: "removeChild",
530
- value: function removeChild(child) {
531
- this.deletedChildren.push(child);
532
- this.removeFromUpdatingChildren(child);
533
- (0, _App.getRunScheduler)().schedule(10, 'removeChild-' + this.oid + "-" + child.oid);
534
- return this;
535
- }
536
- }, {
537
- key: "removeAllChildren",
538
- value: function removeAllChildren() {
539
- this.allChildren.length = 0;
540
- this.updatingChildrenList.length = 0;
541
- this.updatingChildrenMap = {};
542
- (0, _App.getRunScheduler)().schedule(10, 'removeAllChildren-' + this.oid);
543
- return this;
544
- }
545
- }, {
546
- key: "addToParentVisibleList",
547
- value: function addToParentVisibleList() {
548
- if (this.isVisible() && this.isInFlow() && this.getParent()) {
549
- this.getParent().inFlowVisibles.push(this);
550
- }
551
- }
552
- }, {
553
- key: "shouldCalculateChildren",
554
- value: function shouldCalculateChildren() {
555
- if (_TUtil.TUtil.isDefined(this.actualValues.calculateChildren)) {
556
- return this.actualValues.calculateChildren;
557
- }
558
- return this.isVisible() && this.isIncluded() && (this.hasChildren() || this.addedChildren.count > 0 || this.getContentHeight() > 0);
559
- }
560
- }, {
561
- key: "createViewport",
562
- value: function createViewport() {
563
- this.viewport = this.viewport ? this.viewport.reset() : new _Viewport.Viewport(this);
564
- return this.viewport;
565
- }
566
- }, {
567
- key: "setLocation",
568
- value: function setLocation(viewport) {
569
- this.x = viewport.getXNext();
570
- this.y = viewport.getYNext();
571
- }
572
- }, {
573
- key: "calculateAbsolutePosition",
574
- value: function calculateAbsolutePosition(x, y) {
575
- var rect = this.getBoundingRect();
576
- this.absX = rect.left + x;
577
- this.absY = rect.top + y;
578
- }
579
- }, {
580
- key: "getBoundingRect",
581
- value: function getBoundingRect() {
582
- return _TUtil.TUtil.getBoundingRect(this);
583
- }
584
- }, {
585
- key: "getFirstChild",
586
- value: function getFirstChild() {
587
- return this.hasChildren() ? this.getChildren()[0] : undefined;
588
- }
589
- }, {
590
- key: "hasChildren",
591
- value: function hasChildren() {
592
- return this.getChildren().length > 0;
593
- }
594
- }, {
595
- key: "getChildren",
596
- value: function getChildren() {
597
- var _this3 = this;
598
- if (this.addedChildren.count > 0) {
599
- this.addedChildren.list.forEach(function (_ref) {
600
- var index = _ref.index,
601
- segment = _ref.segment;
602
- segment.forEach(function (t) {
603
- return t.parent = _this3;
604
- });
605
- if (index >= _this3.allChildren.length) {
606
- var _this3$allChildren;
607
- (_this3$allChildren = _this3.allChildren).push.apply(_this3$allChildren, _toConsumableArray(segment));
608
- } else {
609
- var _this3$allChildren2;
610
- (_this3$allChildren2 = _this3.allChildren).splice.apply(_this3$allChildren2, [index, 0].concat(_toConsumableArray(segment)));
611
- }
612
- });
613
- this.lastChildrenUpdate.additions = this.lastChildrenUpdate.additions.concat(this.addedChildren.list);
614
- this.addedChildren.list.length = 0;
615
- this.addedChildren.count = 0;
616
- }
617
- if (this.deletedChildren.length > 0) {
618
- this.deletedChildren.forEach(function (child) {
619
- var index = _this3.allChildren.indexOf(child);
620
- _this3.lastChildrenUpdate.deletions.push(index);
621
- if (index >= 0) {
622
- _this3.allChildren.splice(index, 1);
623
- }
624
- });
625
- this.deletedChildren.length = 0;
626
- }
627
- return this.allChildren;
628
- }
629
- }, {
630
- key: "getLastChild",
631
- value: function getLastChild() {
632
- return this.hasChildren() ? this.getChildren()[this.getChildren().length - 1] : undefined;
633
- }
634
- }, {
635
- key: "getChild",
636
- value: function getChild(index) {
637
- return this.hasChildren() ? this.getChildren()[index] : undefined;
638
- }
639
- }, {
640
- key: "getChildIndex",
641
- value: function getChildIndex(child) {
642
- return this.getChildren().indexOf(child);
643
- }
644
- }, {
645
- key: "getChildrenOids",
646
- value: function getChildrenOids() {
647
- return this.getChildren().map(function (o) {
648
- return o.oid;
649
- }).join(" ");
650
- }
651
- }, {
652
- key: "findChild",
653
- value: function findChild(type) {
654
- return this.getChildren().find(function (child) {
655
- return typeof type === 'function' ? type.call(child) : child.type === type;
656
- });
657
- }
658
- }, {
659
- key: "findLastChild",
660
- value: function findLastChild(type) {
661
- return this.getChildren().findLast(function (child) {
662
- return typeof type === 'function' ? type.call(child) : child.type === type;
663
- });
664
- }
665
- }, {
666
- key: "getParentValue",
667
- value: function getParentValue(targetName) {
668
- var parent = _SearchUtil.SearchUtil.findParentByTarget(this, targetName);
669
- return parent ? parent.val(targetName) : undefined;
670
- }
671
563
  }]);
672
564
  }();
package/build/Bracket.js CHANGED
@@ -98,6 +98,9 @@ var Bracket = exports.Bracket = /*#__PURE__*/function (_TModel) {
98
98
  value: function addToUpdatingChildren(child) {
99
99
  this.getRealParent().addToUpdatingChildren(child);
100
100
  }
101
+ }, {
102
+ key: "addToParentVisibleChildren",
103
+ value: function addToParentVisibleChildren() {}
101
104
  }, {
102
105
  key: "createViewport",
103
106
  value: function createViewport() {
@@ -51,8 +51,8 @@ var EventListener = exports.EventListener = /*#__PURE__*/function () {
51
51
  enterEvent: null,
52
52
  leaveEvent: null,
53
53
  focus: null,
54
- focusIn: null,
55
- focusOut: null
54
+ justFocused: null,
55
+ blur: null
56
56
  };
57
57
  this.eventQueue = [];
58
58
  this.eventMap = {
@@ -255,8 +255,8 @@ var EventListener = exports.EventListener = /*#__PURE__*/function () {
255
255
  key: "findEventHandlers",
256
256
  value: function findEventHandlers(tmodel) {
257
257
  var touchHandler = _SearchUtil.SearchUtil.findFirstTouchHandler(tmodel);
258
- var scrollLeftHandler = this.end0 ? this.currentHandlers.scrollLeft : _SearchUtil.SearchUtil.findFirstScrollLeftHandler(tmodel);
259
- var scrollTopHandler = this.end0 ? this.currentHandlers.scrollTop : _SearchUtil.SearchUtil.findFirstScrollTopHandler(tmodel);
258
+ var scrollLeftHandler = _SearchUtil.SearchUtil.findFirstScrollLeftHandler(tmodel);
259
+ var scrollTopHandler = _SearchUtil.SearchUtil.findFirstScrollTopHandler(tmodel);
260
260
  var pinchHandler = _SearchUtil.SearchUtil.findFirstPinchHandler(tmodel);
261
261
  var focusHandler = _$Dom.$Dom.hasFocus(tmodel) ? tmodel : this.currentHandlers.focus;
262
262
  if (this.currentHandlers.scrollLeft !== scrollLeftHandler || this.currentHandlers.scrollTop !== scrollTopHandler) {
@@ -264,15 +264,15 @@ var EventListener = exports.EventListener = /*#__PURE__*/function () {
264
264
  }
265
265
  this.currentHandlers.enterEvent = null;
266
266
  this.currentHandlers.leaveEvent = null;
267
- this.currentHandlers.focusIn = null;
268
- this.currentHandlers.focusOut = null;
267
+ this.currentHandlers.justFocused = null;
268
+ this.currentHandlers.blur = null;
269
269
  if (this.currentHandlers.touch !== touchHandler) {
270
270
  this.currentHandlers.enterEvent = touchHandler;
271
271
  this.currentHandlers.leaveEvent = this.currentHandlers.touch;
272
272
  }
273
273
  if (this.currentHandlers.focus !== focusHandler) {
274
- this.currentHandlers.focusIn = focusHandler;
275
- this.currentHandlers.focusOut = this.currentHandlers.focus;
274
+ this.currentHandlers.justFocused = focusHandler;
275
+ this.currentHandlers.blur = this.currentHandlers.focus;
276
276
  this.eventQueue.push({
277
277
  eventName: 'focus',
278
278
  eventType: 'focus',
@@ -592,12 +592,12 @@ var EventListener = exports.EventListener = /*#__PURE__*/function () {
592
592
  }, {
593
593
  key: "onFocus",
594
594
  value: function onFocus(handler) {
595
- return this.currentHandlers.focusIn === handler;
595
+ return this.currentHandlers.justFocused === handler;
596
596
  }
597
597
  }, {
598
- key: "onFocusOut",
599
- value: function onFocusOut(handler) {
600
- return this.currentHandlers.focusOut === handler;
598
+ key: "onBlur",
599
+ value: function onBlur(handler) {
600
+ return this.currentHandlers.blur === handler;
601
601
  }
602
602
  }, {
603
603
  key: "hasFocus",