targetj 1.0.74 → 1.0.76

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.
Files changed (44) hide show
  1. package/babel.config.json +17 -0
  2. package/build/$Dom.js +424 -0
  3. package/build/App.js +187 -0
  4. package/build/Bracket.js +157 -0
  5. package/build/BracketGenerator.js +86 -0
  6. package/build/Browser.js +105 -0
  7. package/build/ColorUtil.js +182 -0
  8. package/build/Dim.js +31 -0
  9. package/build/Easing.js +59 -0
  10. package/build/EventListener.js +664 -0
  11. package/build/LoadingManager.js +366 -0
  12. package/build/LocationManager.js +211 -0
  13. package/build/Moves.js +71 -0
  14. package/build/PageManager.js +113 -0
  15. package/build/SearchUtil.js +196 -0
  16. package/build/TModel.js +1000 -0
  17. package/build/TModelManager.js +605 -0
  18. package/build/TUtil.js +188 -0
  19. package/build/TargetExecutor.js +117 -0
  20. package/build/TargetManager.js +197 -0
  21. package/build/TargetUtil.js +299 -0
  22. package/build/Viewport.js +163 -0
  23. package/package.json +11 -4
  24. package/webpack.config.js +14 -1
  25. package/src/$Dom.js +0 -380
  26. package/src/App.js +0 -224
  27. package/src/Bracket.js +0 -212
  28. package/src/Browser.js +0 -122
  29. package/src/ColorUtil.js +0 -166
  30. package/src/Dim.js +0 -21
  31. package/src/Easing.js +0 -41
  32. package/src/EventListener.js +0 -570
  33. package/src/LoadingManager.js +0 -368
  34. package/src/LocationManager.js +0 -236
  35. package/src/Moves.js +0 -59
  36. package/src/PageManager.js +0 -87
  37. package/src/SearchUtil.js +0 -210
  38. package/src/TModel.js +0 -937
  39. package/src/TModelManager.js +0 -575
  40. package/src/TUtil.js +0 -162
  41. package/src/TargetExecutor.js +0 -113
  42. package/src/TargetManager.js +0 -191
  43. package/src/TargetUtil.js +0 -307
  44. package/src/Viewport.js +0 -180
@@ -0,0 +1,1000 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.TModel = void 0;
7
+ var _App = require("./App.js");
8
+ var _Browser = require("./Browser.js");
9
+ var _SearchUtil = require("./SearchUtil.js");
10
+ var _TUtil = require("./TUtil.js");
11
+ var _TargetUtil = require("./TargetUtil.js");
12
+ var _TargetExecutor = require("./TargetExecutor.js");
13
+ var _Viewport = require("./Viewport.js");
14
+ 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; }
15
+ 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); }
16
+ function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
17
+ 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); } }
18
+ function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
19
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
20
+ 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); }
21
+ var TModel = exports.TModel = /*#__PURE__*/function () {
22
+ function TModel(type, targets) {
23
+ _classCallCheck(this, TModel);
24
+ if (arguments.length === 1 && _typeof(type) === 'object') {
25
+ targets = type;
26
+ type = "";
27
+ }
28
+ this.type = type || 'blank';
29
+ this.targets = Object.assign({}, targets);
30
+ this.activeTargetList = [];
31
+ this.activeTargetMap = {};
32
+ var uniqueId = _App.App.getOid(this.type);
33
+ this.oid = uniqueId.oid;
34
+ this.oidNum = uniqueId.num;
35
+ this.targetValues = {};
36
+ this.actualValues = {
37
+ x: 0,
38
+ y: 0,
39
+ width: 0,
40
+ height: 0,
41
+ leftMargin: 0,
42
+ rightMargin: 0,
43
+ topMargin: 0,
44
+ bottomMargin: 0,
45
+ innerWidth: undefined,
46
+ innerHeight: undefined,
47
+ opacity: 1,
48
+ zIndex: 1,
49
+ scale: 1,
50
+ rotate: 0,
51
+ scrollLeft: 0,
52
+ scrollTop: 0,
53
+ textOnly: true,
54
+ html: undefined,
55
+ css: '',
56
+ style: null,
57
+ borderRadius: 0,
58
+ children: [],
59
+ addedChildren: [],
60
+ allChildren: [],
61
+ isInFlow: true,
62
+ canHaveDom: true,
63
+ canHandleEvents: false,
64
+ widthFromDom: false,
65
+ heightFromDom: false,
66
+ keepEventDefault: false,
67
+ isIncluded: true,
68
+ canBeBracketed: true,
69
+ isDomDeletable: true,
70
+ calculateChildren: undefined,
71
+ isVisible: undefined
72
+ };
73
+ this.updatingTargetList = [];
74
+ this.updatingTargetMap = {};
75
+ this.styleTargetList = [];
76
+ this.styleTargetMap = {};
77
+ this.updatingChildrenList = [];
78
+ this.updatingChildrenMap = {};
79
+ this.targetMethodMap = {};
80
+ this.parent = null;
81
+ this.$dom = null;
82
+ this.visibilityStatus = {
83
+ top: false,
84
+ right: false,
85
+ bottom: false,
86
+ left: false
87
+ };
88
+ this.visible = false;
89
+ this.domHeight = undefined;
90
+ this.domWidth = undefined;
91
+ this.innerContentWidth = 0;
92
+ this.innerContentHeight = 0;
93
+ this.contentWidth = 0;
94
+ this.contentHeight = 0;
95
+ this.x = 0;
96
+ this.y = 0;
97
+ this.absX = 0;
98
+ this.absY = 0;
99
+ this.inFlowVisibles = [];
100
+ this.domValues = {};
101
+ this.initTargets();
102
+ }
103
+ return _createClass(TModel, [{
104
+ key: "getParent",
105
+ value: function getParent() {
106
+ return this.parent;
107
+ }
108
+ }, {
109
+ key: "getRealParent",
110
+ value: function getRealParent() {
111
+ return this.parent;
112
+ }
113
+ }, {
114
+ key: "getDomParent",
115
+ value: function getDomParent() {
116
+ return this.actualValues.domParent ? this.actualValues.domParent : null;
117
+ }
118
+ }, {
119
+ key: "getDomHolder",
120
+ value: function getDomHolder() {
121
+ return this.actualValues.domHolder ? this.actualValues.domHolder : this.getDomParent() ? this.getDomParent().$dom : _SearchUtil.SearchUtil.findParentByTarget(this, 'domHolder') ? _SearchUtil.SearchUtil.findParentByTarget(this, 'domHolder').$dom : null;
122
+ }
123
+ }, {
124
+ key: "addToStyleTargetList",
125
+ value: function addToStyleTargetList(key) {
126
+ if (!_TargetUtil.TargetUtil.styleTargetMap[key]) {
127
+ return;
128
+ }
129
+ key = _TargetUtil.TargetUtil.transformMap[key] ? 'transform' : _TargetUtil.TargetUtil.dimMap[key] ? 'dim' : key;
130
+ if (!this.styleTargetMap[key]) {
131
+ this.styleTargetList.push(key);
132
+ this.styleTargetMap[key] = true;
133
+ }
134
+ }
135
+ }, {
136
+ key: "bug",
137
+ value: function bug() {
138
+ return [{
139
+ visible: this.isVisible()
140
+ }, {
141
+ visibilityStatus: this.visibilityStatus
142
+ }, {
143
+ hasDom: this.hasDom()
144
+ }, {
145
+ x: this.getX()
146
+ }, {
147
+ y: this.getY()
148
+ }, {
149
+ width: this.getWidth()
150
+ }, {
151
+ height: this.getHeight()
152
+ }, {
153
+ activeTargetList: this.activeTargetList
154
+ }, {
155
+ updatingTargetList: this.updatingTargetList
156
+ }, {
157
+ styleTargetList: this.styleTargetList
158
+ }, {
159
+ children: this.getChildren()
160
+ }, {
161
+ targetValues: this.targetValues
162
+ }, {
163
+ actualValues: this.actualValues
164
+ }];
165
+ }
166
+ }, {
167
+ key: "initTargets",
168
+ value: function initTargets() {
169
+ var _this = this;
170
+ this.targetValues = {};
171
+ this.activeTargetMap = {};
172
+ this.activeTargetList = [];
173
+ Object.keys(this.targets).forEach(function (key) {
174
+ _this.processNewTarget(key);
175
+ });
176
+ }
177
+ }, {
178
+ key: "processNewTarget",
179
+ value: function processNewTarget(key) {
180
+ _TargetUtil.TargetUtil.bindTargetName(this.targets, key);
181
+ if (_TUtil.TUtil.isDefined(this.targets[key].initialValue)) {
182
+ this.actualValues[key] = this.targets[key].initialValue;
183
+ this.addToStyleTargetList(key);
184
+ }
185
+ if (this.targets[key].active !== false) {
186
+ this.addToActiveTargets(key);
187
+ }
188
+ }
189
+ }, {
190
+ key: "hasDomHolderChanged",
191
+ value: function hasDomHolderChanged() {
192
+ return this.getDomHolder() && this.getDomHolder().exists() && this.$dom.parent().getAttribute("id") !== this.getDomHolder().attr("id");
193
+ }
194
+ }, {
195
+ key: "hasDom",
196
+ value: function hasDom() {
197
+ return !!this.$dom && this.$dom.exists();
198
+ }
199
+ }, {
200
+ key: "hasChildren",
201
+ value: function hasChildren() {
202
+ return this.getChildren().length > 0;
203
+ }
204
+ }, {
205
+ key: "getChildren",
206
+ value: function getChildren() {
207
+ var _this2 = this;
208
+ var lastUpdateAllChildren = this.getActualValueLastUpdate('allChildren');
209
+ var lastUpdateChildren = this.getActualValueLastUpdate('children');
210
+ var lastUpdateAddedChildren = this.getActualValueLastUpdate('addedChildren');
211
+ if (!lastUpdateAllChildren || lastUpdateChildren >= lastUpdateAllChildren || lastUpdateAddedChildren >= lastUpdateAllChildren) {
212
+ var children = this.actualValues.children;
213
+ var addedChildren = this.actualValues.addedChildren;
214
+ this.actualValues.allChildren = [].concat(children, addedChildren);
215
+ if (children && children.length > 0) {
216
+ children.forEach(function (t) {
217
+ return t.parent = _this2;
218
+ });
219
+ this.actualValues.allChildren.sort(function (a, b) {
220
+ return !a.canBeBracketed() && b.canBeBracketed() ? -1 : 1;
221
+ });
222
+ }
223
+ if (this.targetValues['allChildren']) {
224
+ this.setActualValueLastUpdate('allChildren');
225
+ } else {
226
+ this.setTarget('allChildren', this.actualValues.allChildren);
227
+ }
228
+ }
229
+ return this.actualValues.allChildren;
230
+ }
231
+ }, {
232
+ key: "getLastChild",
233
+ value: function getLastChild() {
234
+ return this.hasChildren() ? this.getChildren()[this.getChildren().length - 1] : undefined;
235
+ }
236
+ }, {
237
+ key: "getFirstChild",
238
+ value: function getFirstChild() {
239
+ return this.hasChildren() ? this.getChildren()[0] : undefined;
240
+ }
241
+ }, {
242
+ key: "getChild",
243
+ value: function getChild(index) {
244
+ return this.hasChildren() ? this.getChildren()[index] : undefined;
245
+ }
246
+ }, {
247
+ key: "getChildIndex",
248
+ value: function getChildIndex(child) {
249
+ return this.getChildren().indexOf(child);
250
+ }
251
+ }, {
252
+ key: "getChildrenOids",
253
+ value: function getChildrenOids() {
254
+ return this.getChildren().oids();
255
+ }
256
+ }, {
257
+ key: "filterChildren",
258
+ value: function filterChildren(type) {
259
+ return this.getChildren().filter(function (tmodel) {
260
+ return Array.isArray(type) ? type.includes(tmodel.type) : typeof type === 'function' ? type.call(tmodel) : tmodel.type === type;
261
+ });
262
+ }
263
+ }, {
264
+ key: "findChild",
265
+ value: function findChild(type) {
266
+ return this.getChildren().find(function (child) {
267
+ return typeof type === 'function' ? type.call(child) : child.type === type;
268
+ });
269
+ }
270
+ }, {
271
+ key: "findLastChild",
272
+ value: function findLastChild(type) {
273
+ return this.getChildren().findLast(function (child) {
274
+ return typeof type === 'function' ? type.call(child) : child.type === type;
275
+ });
276
+ }
277
+ }, {
278
+ key: "getParentValue",
279
+ value: function getParentValue(targetName) {
280
+ var parent = _SearchUtil.SearchUtil.findParentByTarget(this, targetName);
281
+ return parent ? parent.val(targetName) : undefined;
282
+ }
283
+ }, {
284
+ key: "getContentHeight",
285
+ value: function getContentHeight() {
286
+ return this.contentHeight;
287
+ }
288
+ }, {
289
+ key: "getInnerContentHeight",
290
+ value: function getInnerContentHeight() {
291
+ return 0;
292
+ }
293
+ }, {
294
+ key: "getInnerHeight",
295
+ value: function getInnerHeight() {
296
+ return _TUtil.TUtil.isDefined(this.actualValues.innerHeight) ? this.actualValues.innerHeight : this.getHeight();
297
+ }
298
+ }, {
299
+ key: "getInnerWidth",
300
+ value: function getInnerWidth() {
301
+ return _TUtil.TUtil.isDefined(this.actualValues.innerWidth) ? this.actualValues.innerWidth : this.getWidth();
302
+ }
303
+ }, {
304
+ key: "getInnerXEast",
305
+ value: function getInnerXEast() {
306
+ return this.absX + this.getInnerWidth();
307
+ }
308
+ }, {
309
+ key: "getOuterXEast",
310
+ value: function getOuterXEast() {
311
+ return this.absX + this.getInnerWidth();
312
+ }
313
+ }, {
314
+ key: "getContentWidth",
315
+ value: function getContentWidth() {
316
+ return this.contentWidth;
317
+ }
318
+ }, {
319
+ key: "getUIDepth",
320
+ value: function getUIDepth() {
321
+ var depth = 0;
322
+ var node = this.parent;
323
+ while (node) {
324
+ depth++;
325
+ node = node.parent;
326
+ }
327
+ return depth;
328
+ }
329
+ }, {
330
+ key: "addToParentVisibleList",
331
+ value: function addToParentVisibleList() {
332
+ if (this.isVisible() && this.isInFlow() && this.getParent()) {
333
+ this.getParent().inFlowVisibles.push(this);
334
+ }
335
+ }
336
+ }, {
337
+ key: "isVisible",
338
+ value: function isVisible() {
339
+ return _TUtil.TUtil.isDefined(this.actualValues.isVisible) ? this.actualValues.isVisible : this.visible;
340
+ }
341
+ }, {
342
+ key: "shouldCalculateChildren",
343
+ value: function shouldCalculateChildren() {
344
+ return _TUtil.TUtil.isDefined(this.actualValues.calculateChildren) ? this.actualValues.calculateChildren : this.isVisible() && this.isIncluded() && (this.hasChildren() || this.getContentHeight() > 0);
345
+ }
346
+ }, {
347
+ key: "createViewport",
348
+ value: function createViewport() {
349
+ this.viewport = this.viewport ? this.viewport.reset() : new _Viewport.Viewport(this);
350
+ return this.viewport;
351
+ }
352
+ }, {
353
+ key: "setLocation",
354
+ value: function setLocation(viewport) {
355
+ this.x = viewport.getXNext();
356
+ this.y = viewport.getYNext();
357
+ }
358
+ }, {
359
+ key: "calculateAbsolutePosition",
360
+ value: function calculateAbsolutePosition(x, y) {
361
+ var rect = this.getBoundingRect();
362
+ this.absX = rect.left + x;
363
+ this.absY = rect.top + y;
364
+ }
365
+ }, {
366
+ key: "getBoundingRect",
367
+ value: function getBoundingRect() {
368
+ return _TUtil.TUtil.getBoundingRect(this);
369
+ }
370
+ }, {
371
+ key: "isMarkedDeleted",
372
+ value: function isMarkedDeleted() {
373
+ return this.val('tmodelDeletedFlag') === true;
374
+ }
375
+ }, {
376
+ key: "markAsDeleted",
377
+ value: function markAsDeleted() {
378
+ this.val('tmodelDeletedFlag', true);
379
+ this.getChildren().forEach(function (tmodel) {
380
+ return tmodel.markAsDeleted();
381
+ });
382
+ }
383
+ }, {
384
+ key: "isTextOnly",
385
+ value: function isTextOnly() {
386
+ return this.actualValues.textOnly;
387
+ }
388
+ }, {
389
+ key: "getHtml",
390
+ value: function getHtml() {
391
+ return this.actualValues.html;
392
+ }
393
+ }, {
394
+ key: "isInFlow",
395
+ value: function isInFlow() {
396
+ return this.actualValues.isInFlow;
397
+ }
398
+ }, {
399
+ key: "canHandleEvents",
400
+ value: function canHandleEvents(eventName) {
401
+ var events = this.actualValues.canHandleEvents;
402
+ return events === eventName || Array.isArray(events) && events.includes(eventName);
403
+ }
404
+ }, {
405
+ key: "keepEventDefault",
406
+ value: function keepEventDefault() {
407
+ return this.actualValues.keepEventDefault;
408
+ }
409
+ }, {
410
+ key: "canBeBracketed",
411
+ value: function canBeBracketed() {
412
+ return this.actualValues.canBeBracketed;
413
+ }
414
+ }, {
415
+ key: "isIncluded",
416
+ value: function isIncluded() {
417
+ return this.actualValues.isIncluded;
418
+ }
419
+ }, {
420
+ key: "canHaveDom",
421
+ value: function canHaveDom() {
422
+ return this.actualValues.canHaveDom;
423
+ }
424
+ }, {
425
+ key: "isDomDeletable",
426
+ value: function isDomDeletable() {
427
+ return this.actualValues.isDomDeletable;
428
+ }
429
+ }, {
430
+ key: "getOpacity",
431
+ value: function getOpacity() {
432
+ return this.actualValues.opacity;
433
+ }
434
+ }, {
435
+ key: "getX",
436
+ value: function getX() {
437
+ return this.actualValues.x;
438
+ }
439
+ }, {
440
+ key: "getY",
441
+ value: function getY() {
442
+ return this.actualValues.y;
443
+ }
444
+ }, {
445
+ key: "getZIndex",
446
+ value: function getZIndex() {
447
+ return this.actualValues.zIndex;
448
+ }
449
+ }, {
450
+ key: "getScale",
451
+ value: function getScale() {
452
+ return this.actualValues.scale;
453
+ }
454
+ }, {
455
+ key: "getMeasuringScale",
456
+ value: function getMeasuringScale() {
457
+ return this.actualValues.scale;
458
+ }
459
+ }, {
460
+ key: "getTopMargin",
461
+ value: function getTopMargin() {
462
+ return this.actualValues.topMargin;
463
+ }
464
+ }, {
465
+ key: "getLeftMargin",
466
+ value: function getLeftMargin() {
467
+ return this.actualValues.leftMargin;
468
+ }
469
+ }, {
470
+ key: "getRightMargin",
471
+ value: function getRightMargin() {
472
+ return this.actualValues.rightMargin;
473
+ }
474
+ }, {
475
+ key: "getBottomMargin",
476
+ value: function getBottomMargin() {
477
+ return this.actualValues.bottomMargin;
478
+ }
479
+ }, {
480
+ key: "getRotate",
481
+ value: function getRotate() {
482
+ return this.actualValues.rotate;
483
+ }
484
+ }, {
485
+ key: "getWidth",
486
+ value: function getWidth() {
487
+ return this.actualValues.width;
488
+ }
489
+ }, {
490
+ key: "getHeight",
491
+ value: function getHeight() {
492
+ return this.actualValues.height;
493
+ }
494
+ }, {
495
+ key: "getScrollTop",
496
+ value: function getScrollTop() {
497
+ return Math.floor(this.actualValues.scrollTop);
498
+ }
499
+ }, {
500
+ key: "getScrollLeft",
501
+ value: function getScrollLeft() {
502
+ return Math.floor(this.actualValues.scrollLeft);
503
+ }
504
+ }, {
505
+ key: "getCss",
506
+ value: function getCss() {
507
+ return this.actualValues.css.includes('tgt') ? this.actualValues.css : !this.actualValues.css ? 'tgt' : 'tgt ' + this.actualValues.css;
508
+ }
509
+ }, {
510
+ key: "getStyle",
511
+ value: function getStyle() {
512
+ return this.actualValues.style;
513
+ }
514
+ }, {
515
+ key: "getScaledWidth",
516
+ value: function getScaledWidth() {
517
+ return this.getWidth() * this.getScale();
518
+ }
519
+ }, {
520
+ key: "getScaledHeight",
521
+ value: function getScaledHeight() {
522
+ return this.getHeight() * this.getScale();
523
+ }
524
+ }, {
525
+ key: "getTargetStepPercent",
526
+ value: function getTargetStepPercent(key, step) {
527
+ var steps = this.getTargetSteps(key);
528
+ step = !_TUtil.TUtil.isDefined(step) ? this.getTargetStep(key) : step;
529
+ return steps ? step / steps : 1;
530
+ }
531
+ }, {
532
+ key: "resetTargetStep",
533
+ value: function resetTargetStep(key) {
534
+ if (this.targetValues[key]) {
535
+ this.targetValues[key].step = 0;
536
+ }
537
+ return this;
538
+ }
539
+ }, {
540
+ key: "resetTargetExecutionFlag",
541
+ value: function resetTargetExecutionFlag(key) {
542
+ if (this.targetValues[key]) {
543
+ this.targetValues[key].executionFlag = false;
544
+ }
545
+ return this;
546
+ }
547
+ }, {
548
+ key: "resetTargetCycle",
549
+ value: function resetTargetCycle(key) {
550
+ if (this.targetValues[key]) {
551
+ this.targetValues[key].cycle = 0;
552
+ }
553
+ return this;
554
+ }
555
+ }, {
556
+ key: "resetScheduleTimeStamp",
557
+ value: function resetScheduleTimeStamp(key) {
558
+ if (this.targetValues[key]) {
559
+ this.targetValues[key].scheduleTimeStamp = undefined;
560
+ }
561
+ return this;
562
+ }
563
+ }, {
564
+ key: "resetTargetInitialValue",
565
+ value: function resetTargetInitialValue(key) {
566
+ if (this.targetValues[key]) {
567
+ this.targetValues[key].initialValue = undefined;
568
+ }
569
+ return this;
570
+ }
571
+ }, {
572
+ key: "updateTargetStatus",
573
+ value: function updateTargetStatus(key) {
574
+ var targetValue = this.targetValues[key];
575
+ if (!targetValue) {
576
+ return;
577
+ }
578
+ var cycle = this.getTargetCycle(key);
579
+ var cycles = this.getTargetCycles(key);
580
+ var step = this.getTargetStep(key);
581
+ var steps = this.getTargetSteps(key);
582
+ if (this.isExecuted(key) && step < steps) {
583
+ this.targetValues[key].status = 'updating';
584
+ } else if (Array.isArray(targetValue.valueList) && cycle < targetValue.valueList.length - 1) {
585
+ this.targetValues[key].status = 'updating';
586
+ } else if (!this.isExecuted(key) || this.isTargetInLoop(key) || cycle < cycles) {
587
+ this.targetValues[key].status = 'active';
588
+ } else {
589
+ this.targetValues[key].status = 'done';
590
+ }
591
+ if (this.isTargetUpdating(key)) {
592
+ this.addToUpdatingTargets(key);
593
+ this.removeFromActiveTargets(key);
594
+ } else if (this.isTargetActive(key)) {
595
+ this.addToActiveTargets(key);
596
+ this.removeFromUpdatingTargets(key);
597
+ } else {
598
+ this.removeFromActiveTargets(key);
599
+ this.removeFromUpdatingTargets(key);
600
+ _App.tApp.manager.doneTargets.push({
601
+ tmodel: this,
602
+ key: key
603
+ });
604
+ }
605
+ return this.targetValues[key].status;
606
+ }
607
+ }, {
608
+ key: "getTargetStatus",
609
+ value: function getTargetStatus(key) {
610
+ return this.targetValues[key] ? this.targetValues[key].status : '';
611
+ }
612
+ }, {
613
+ key: "isTargetActive",
614
+ value: function isTargetActive(key) {
615
+ return this.targetValues[key] && this.targetValues[key].status === 'active';
616
+ }
617
+ }, {
618
+ key: "isTargetUpdating",
619
+ value: function isTargetUpdating(key) {
620
+ return this.targetValues[key] && this.targetValues[key].status === 'updating';
621
+ }
622
+ }, {
623
+ key: "isTargetDone",
624
+ value: function isTargetDone(key) {
625
+ return this.targetValues[key] && this.targetValues[key].status === 'done';
626
+ }
627
+ }, {
628
+ key: "isTargetComplete",
629
+ value: function isTargetComplete(key) {
630
+ return this.targetValues[key] && this.targetValues[key].status === 'complete';
631
+ }
632
+ }, {
633
+ key: "isExecuted",
634
+ value: function isExecuted(key) {
635
+ return this.targetValues[key] && this.targetValues[key].executionFlag;
636
+ }
637
+ }, {
638
+ key: "isTargetImperative",
639
+ value: function isTargetImperative(key) {
640
+ return this.targetValues[key] ? this.targetValues[key].isImperative : false;
641
+ }
642
+ }, {
643
+ key: "getTargetExecutionCount",
644
+ value: function getTargetExecutionCount(key) {
645
+ return this.targetValues[key] ? this.targetValues[key].executionCount : 0;
646
+ }
647
+ }, {
648
+ key: "setTargetComplete",
649
+ value: function setTargetComplete(key) {
650
+ if (this.targetValues[key]) {
651
+ this.targetValues[key].status = 'complete';
652
+ }
653
+ }
654
+ }, {
655
+ key: "isTargetEnabled",
656
+ value: function isTargetEnabled(key) {
657
+ if (this.isTargetImperative(key)) {
658
+ return true;
659
+ }
660
+ var target = this.targets[key];
661
+ if (!_TUtil.TUtil.isDefined(target)) {
662
+ return false;
663
+ }
664
+ return typeof target.enabledOn === 'function' ? target.enabledOn.call(this) : true;
665
+ }
666
+ }, {
667
+ key: "isTargetInLoop",
668
+ value: function isTargetInLoop(key) {
669
+ return this.targets[key] ? typeof this.targets[key].loop === 'function' ? this.targets[key].loop.call(this, key) : this.targets[key].loop : false;
670
+ }
671
+ }, {
672
+ key: "doesTargetEqualActual",
673
+ value: function doesTargetEqualActual(key) {
674
+ if (this.targetValues[key]) {
675
+ var deepEquality = this.targets[key] ? this.targets[key].deepEquality : false;
676
+ return deepEquality ? _TUtil.TUtil.areEqual(this.getTargetValue(key), this.val(key), deepEquality) : this.getTargetValue(key) === this.val(key);
677
+ }
678
+ return false;
679
+ }
680
+ }, {
681
+ key: "getTargetValue",
682
+ value: function getTargetValue(key) {
683
+ return this.targetValues[key] ? typeof this.targetValues[key].value === 'function' ? this.targetValues[key].value.call(this) : this.targetValues[key].value : undefined;
684
+ }
685
+ }, {
686
+ key: "getTargetSteps",
687
+ value: function getTargetSteps(key) {
688
+ return this.targetValues[key] ? this.targetValues[key].steps || 0 : 0;
689
+ }
690
+ }, {
691
+ key: "getTargetStep",
692
+ value: function getTargetStep(key) {
693
+ return this.targetValues[key] ? this.targetValues[key].step : 0;
694
+ }
695
+ }, {
696
+ key: "getScheduleTimeStamp",
697
+ value: function getScheduleTimeStamp(key) {
698
+ return this.targetValues[key] ? this.targetValues[key].scheduleTimeStamp : undefined;
699
+ }
700
+ }, {
701
+ key: "getTargetInitialValue",
702
+ value: function getTargetInitialValue(key) {
703
+ return this.targetValues[key] ? this.targetValues[key].initialValue : undefined;
704
+ }
705
+ }, {
706
+ key: "getActualValueLastUpdate",
707
+ value: function getActualValueLastUpdate(key) {
708
+ return this.targetValues[key] ? this.targetValues[key].actualValueLastUpdate : undefined;
709
+ }
710
+ }, {
711
+ key: "getTargetCreationTime",
712
+ value: function getTargetCreationTime(key) {
713
+ return this.targetValues[key] ? this.targetValues[key].creationTime : undefined;
714
+ }
715
+ }, {
716
+ key: "incrementTargetStep",
717
+ value: function incrementTargetStep(key) {
718
+ if (this.targetValues[key]) {
719
+ this.targetValues[key].step++;
720
+ }
721
+ return this.targetValues[key].step;
722
+ }
723
+ }, {
724
+ key: "getTargetCycles",
725
+ value: function getTargetCycles(key) {
726
+ return this.targetValues[key] ? this.targetValues[key].cycles || 0 : 0;
727
+ }
728
+ }, {
729
+ key: "getTargetCycle",
730
+ value: function getTargetCycle(key) {
731
+ return this.targetValues[key] ? this.targetValues[key].cycle : 0;
732
+ }
733
+ }, {
734
+ key: "incrementTargetCycle",
735
+ value: function incrementTargetCycle(key) {
736
+ if (this.targetValues[key]) {
737
+ this.targetValues[key].cycle++;
738
+ }
739
+ return this.targetValues[key].cycle;
740
+ }
741
+ }, {
742
+ key: "setTargetInterval",
743
+ value: function setTargetInterval(key, value) {
744
+ if (this.targetValues[key]) {
745
+ this.targetValues[key].interval = value;
746
+ }
747
+ return this.targetValues[key].interval;
748
+ }
749
+ }, {
750
+ key: "setScheduleTimeStamp",
751
+ value: function setScheduleTimeStamp(key, value) {
752
+ if (this.targetValues[key]) {
753
+ this.targetValues[key].scheduleTimeStamp = value;
754
+ }
755
+ }
756
+ }, {
757
+ key: "setTargetInitialValue",
758
+ value: function setTargetInitialValue(key, value) {
759
+ if (this.targetValues[key]) {
760
+ this.targetValues[key].initialValue = value;
761
+ }
762
+ }
763
+ }, {
764
+ key: "setActualValueLastUpdate",
765
+ value: function setActualValueLastUpdate(key) {
766
+ if (this.targetValues[key]) {
767
+ this.targetValues[key].actualValueLastUpdate = _Browser.browser.now();
768
+ }
769
+ }
770
+ }, {
771
+ key: "getTargetEasing",
772
+ value: function getTargetEasing(key) {
773
+ return typeof this.targetValues[key].easing === 'function' ? this.targetValues[key].easing : undefined;
774
+ }
775
+ }, {
776
+ key: "getTargetInterval",
777
+ value: function getTargetInterval(key) {
778
+ return this.targetValues[key] ? this.targetValues[key].interval : undefined;
779
+ }
780
+ }, {
781
+ key: "getTargetEventFunctions",
782
+ value: function getTargetEventFunctions(key) {
783
+ return this.targetValues[key] ? this.targetValues[key].events : undefined;
784
+ }
785
+ }, {
786
+ key: "setTarget",
787
+ value: function setTarget(key, value, steps, interval, easing, originalTargetName) {
788
+ originalTargetName = originalTargetName || this.key;
789
+ _TargetExecutor.TargetExecutor.executeImperativeTarget(this, key, value, steps, interval, easing, originalTargetName);
790
+ return this;
791
+ }
792
+ }, {
793
+ key: "val",
794
+ value: function val(key, value) {
795
+ if (arguments.length === 2) {
796
+ this.actualValues[key] = value;
797
+ return this;
798
+ }
799
+ return this.actualValues[key];
800
+ }
801
+ }, {
802
+ key: "addValue",
803
+ value: function addValue(key, value) {
804
+ this.actualValues[key] += value;
805
+ return this;
806
+ }
807
+ }, {
808
+ key: "multiplyValue",
809
+ value: function multiplyValue(key, value) {
810
+ this.actualValues[key] *= value;
811
+ return this;
812
+ }
813
+ }, {
814
+ key: "addChild",
815
+ value: function addChild(child, index) {
816
+ var addedChildren = this.actualValues.addedChildren;
817
+ index = _TUtil.TUtil.isDefined(index) ? index : addedChildren.length;
818
+ child.parent = this;
819
+ if (index >= addedChildren.length) {
820
+ addedChildren.push(child);
821
+ } else {
822
+ addedChildren.splice(index, 0, child);
823
+ }
824
+ this.setActualValueLastUpdate('children');
825
+ if (this.targetValues['addedChildren']) {
826
+ this.setActualValueLastUpdate('addedChildren');
827
+ } else {
828
+ this.setTarget('addedChildren', addedChildren);
829
+ }
830
+ _App.tApp.manager.scheduleRun(10, 'addChild-' + this.oid + "-" + child.oid);
831
+ return this;
832
+ }
833
+ }, {
834
+ key: "addToUpdatingChildren",
835
+ value: function addToUpdatingChildren(child) {
836
+ if (!this.updatingChildrenMap[child.oid]) {
837
+ this.updatingChildrenMap[child.oid] = true;
838
+ this.updatingChildrenList.push(child.oid);
839
+ }
840
+ }
841
+ }, {
842
+ key: "removeFromUpdatingChildren",
843
+ value: function removeFromUpdatingChildren(child) {
844
+ if (this.updatingChildrenMap[child.oid]) {
845
+ delete this.updatingChildrenMap[child.oid];
846
+ var index = this.updatingChildrenList.indexOf(child.oid);
847
+ if (index >= 0) {
848
+ this.updatingChildrenList.splice(index, 1);
849
+ }
850
+ }
851
+ }
852
+ }, {
853
+ key: "hasUpdatingChildren",
854
+ value: function hasUpdatingChildren() {
855
+ return this.updatingChildrenList.length > 0;
856
+ }
857
+ }, {
858
+ key: "hasTargetUpdates",
859
+ value: function hasTargetUpdates(key) {
860
+ return key ? this.updatingTargetMap[key] === true : this.updatingTargetList.length > 0;
861
+ }
862
+ }, {
863
+ key: "removeTarget",
864
+ value: function removeTarget(key) {
865
+ delete this.targets[key];
866
+ this.removeFromActiveTargets(key);
867
+ this.removeFromUpdatingTargets(key);
868
+ delete this.targetValues[key];
869
+ }
870
+ }, {
871
+ key: "addTarget",
872
+ value: function addTarget(key, target) {
873
+ this.addTargets(_defineProperty({}, key, target));
874
+ }
875
+ }, {
876
+ key: "addTargets",
877
+ value: function addTargets(targets) {
878
+ var _this3 = this;
879
+ Object.keys(targets).forEach(function (key) {
880
+ _this3.targets[key] = targets[key];
881
+ _this3.removeFromUpdatingTargets(key);
882
+ _this3.processNewTarget(key);
883
+ });
884
+ _App.tApp.manager.scheduleRun(10, 'addTargets-' + this.oid);
885
+ }
886
+ }, {
887
+ key: "addToActiveTargets",
888
+ value: function addToActiveTargets(key) {
889
+ if (!this.activeTargetMap[key]) {
890
+ this.activeTargetMap[key] = true;
891
+ if (key === 'start') {
892
+ this.activeTargetList.unshift('start');
893
+ } else if (key === 'width' || key === 'height') {
894
+ var startIndex = this.activeTargetList.indexOf('start');
895
+ if (startIndex !== -1) {
896
+ this.activeTargetList.splice(1, 0, key);
897
+ } else {
898
+ this.activeTargetList.unshift(key);
899
+ }
900
+ } else {
901
+ this.activeTargetList.push(key);
902
+ }
903
+ }
904
+ }
905
+ }, {
906
+ key: "removeFromActiveTargets",
907
+ value: function removeFromActiveTargets(key) {
908
+ if (this.activeTargetMap[key]) {
909
+ delete this.activeTargetMap[key];
910
+ var index = this.activeTargetList.indexOf(key);
911
+ if (index >= 0) {
912
+ this.activeTargetList.splice(index, 1);
913
+ }
914
+ }
915
+ }
916
+ }, {
917
+ key: "addToUpdatingTargets",
918
+ value: function addToUpdatingTargets(key) {
919
+ if (!this.updatingTargetMap[key]) {
920
+ this.updatingTargetMap[key] = true;
921
+ this.updatingTargetList.push(key);
922
+ if (this.getParent()) {
923
+ this.getParent().addToUpdatingChildren(this);
924
+ }
925
+ }
926
+ }
927
+ }, {
928
+ key: "removeFromUpdatingTargets",
929
+ value: function removeFromUpdatingTargets(key) {
930
+ if (this.updatingTargetMap[key]) {
931
+ delete this.updatingTargetMap[key];
932
+ var index = this.updatingTargetList.indexOf(key);
933
+ if (index >= 0) {
934
+ this.updatingTargetList.splice(index, 1);
935
+ }
936
+ if (this.updatingTargetList.length === 0 && this.getParent()) {
937
+ this.getParent().removeFromUpdatingChildren(this);
938
+ }
939
+ }
940
+ }
941
+ }, {
942
+ key: "deleteTargetValue",
943
+ value: function deleteTargetValue(key) {
944
+ delete this.targetValues[key];
945
+ this.addToActiveTargets(key);
946
+ this.removeFromUpdatingTargets(key);
947
+ _App.tApp.manager.scheduleRun(10, 'deleteTargetValue-' + this.oid + "-" + key);
948
+ }
949
+ }, {
950
+ key: "resetImperative",
951
+ value: function resetImperative(key) {
952
+ var targetValue = this.targetValues[key];
953
+ if (targetValue) {
954
+ targetValue.isImperative = false;
955
+ targetValue.executionFlag = false;
956
+ targetValue.scheduleTimeStamp = undefined;
957
+ targetValue.step = 0;
958
+ targetValue.cycle = 0;
959
+ targetValue.steps = 0;
960
+ targetValue.cycles = 0;
961
+ targetValue.interval = 0;
962
+ }
963
+ return this;
964
+ }
965
+ }, {
966
+ key: "activateTarget",
967
+ value: function activateTarget(key) {
968
+ return this.activateTargets([key]);
969
+ }
970
+ }, {
971
+ key: "activateTargets",
972
+ value: function activateTargets(keys) {
973
+ var _this4 = this;
974
+ keys.forEach(function (key) {
975
+ var targetValue = _this4.targetValues[key];
976
+ if (targetValue) {
977
+ targetValue.executionFlag = false;
978
+ targetValue.scheduleTimeStamp = undefined;
979
+ targetValue.step = 0;
980
+ targetValue.cycle = 0;
981
+ _this4.updateTargetStatus(key);
982
+ } else {
983
+ _this4.addToActiveTargets(key);
984
+ }
985
+ });
986
+ _App.tApp.manager.scheduleRun(10, 'activateTargets-' + this.oid);
987
+ return this;
988
+ }
989
+ }, {
990
+ key: "setTargetMethodName",
991
+ value: function setTargetMethodName(targetName, methodName) {
992
+ if (!this.targetMethodMap[targetName]) {
993
+ this.targetMethodMap[targetName] = [];
994
+ }
995
+ if (!this.targetMethodMap[targetName].includes(methodName)) {
996
+ this.targetMethodMap[targetName].push(methodName);
997
+ }
998
+ }
999
+ }]);
1000
+ }();