targetj 1.0.99 → 1.0.101
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 +16 -43
- package/build/$Dom.js +7 -2
- package/build/App.js +24 -24
- package/build/LoadingManager.js +43 -50
- package/build/RunScheduler.js +2 -2
- package/build/TModel.js +5 -0
- package/build/TModelManager.js +8 -11
- package/build/TModelUtil.js +16 -0
- package/build/TargetUtil.js +6 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -184,40 +184,34 @@ In the example below, we define a target named 'load' that attempts to fetch a s
|
|
|
184
184
|
|
|
185
185
|
The target will remain active using the loop function, with value() continuing to return undefined while polling the system every 50ms (as specified in the interval property) until the loader retrieves the API result. When the API result arrives, it triggers onValueChange, which creates a user object based on the retrieved data. Additionally, we define two targets to handle scenarios for both fast and slow connections. The slow target is enabled if polling exceeds 100 times, while the fast target is enabled if the API result is retrieved in less than 600ms. The fast target will reactivate the load target till it fetches 10 users.
|
|
186
186
|
|
|
187
|
-

|
|
188
188
|
|
|
189
189
|
```bash
|
|
190
190
|
import { App, TModel, getLoader, getScreenHeight, getScreenWidth, Moves } from "targetj";
|
|
191
191
|
|
|
192
|
-
App(
|
|
193
|
-
|
|
192
|
+
App(
|
|
193
|
+
new TModel("apiCall", {
|
|
194
194
|
width: getScreenWidth,
|
|
195
195
|
height: getScreenHeight,
|
|
196
196
|
load: {
|
|
197
|
-
interval:
|
|
198
|
-
|
|
199
|
-
value() {
|
|
200
|
-
|
|
201
|
-
getLoader().initSingleLoad(fetchId, {
|
|
202
|
-
url: "https://targetj.io/api/randomUser",
|
|
203
|
-
data: { id: fetchId }
|
|
204
|
-
});
|
|
205
|
-
return getLoader().fetchResult(fetchId);
|
|
197
|
+
interval: 1000,
|
|
198
|
+
cycles: 9,
|
|
199
|
+
value: function (cycle) {
|
|
200
|
+
return getLoader().fetch(this, "https://targetj.io/api/randomUser", { id: `user${cycle}` });
|
|
206
201
|
},
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
const user = newValue.result;
|
|
210
|
-
this.addChild(
|
|
211
|
-
new TModel("user", {
|
|
202
|
+
onSuccess(res) {
|
|
203
|
+
this.addChild(new TModel("user", {
|
|
212
204
|
bounce: {
|
|
213
205
|
value() {
|
|
214
|
-
this.setTarget("move",
|
|
206
|
+
this.setTarget("move",
|
|
207
|
+
Moves.bounceSimple(this, {
|
|
215
208
|
xStart: this.getX() || Math.random() * 300,
|
|
216
|
-
yStart:
|
|
217
|
-
|
|
209
|
+
yStart: 200,
|
|
210
|
+
from: 0,
|
|
211
|
+
to: 200,
|
|
218
212
|
widthStart: 50,
|
|
219
213
|
heightStart: 50,
|
|
220
|
-
}),
|
|
214
|
+
}), 20);
|
|
221
215
|
},
|
|
222
216
|
onImperativeEnd() {
|
|
223
217
|
if (!this.hasUpdatingTargets(this)) {
|
|
@@ -227,33 +221,12 @@ App(new TModel("apiCall", {
|
|
|
227
221
|
},
|
|
228
222
|
lineHeight: 50,
|
|
229
223
|
textAlign: "center",
|
|
230
|
-
html:
|
|
224
|
+
html: res.result.name,
|
|
231
225
|
background: "yellow",
|
|
232
226
|
})
|
|
233
227
|
);
|
|
234
228
|
},
|
|
235
229
|
},
|
|
236
|
-
slowLoad: {
|
|
237
|
-
value() {
|
|
238
|
-
console.log("Connection issue: please try again later.");
|
|
239
|
-
},
|
|
240
|
-
enabledOn() {
|
|
241
|
-
return this.getTargetExecutionCount("load") > 30;
|
|
242
|
-
},
|
|
243
|
-
},
|
|
244
|
-
fastLoad: {
|
|
245
|
-
loop() { return this.users < 9; },
|
|
246
|
-
value() {
|
|
247
|
-
//Loading is fast: We can load additional details about the user or more users.
|
|
248
|
-
this.users++;
|
|
249
|
-
this.activateTarget("load");
|
|
250
|
-
},
|
|
251
|
-
enabledOn() {
|
|
252
|
-
return (
|
|
253
|
-
this.isTargetComplete("load") && this.val("load").loadingTime < 600
|
|
254
|
-
);
|
|
255
|
-
}
|
|
256
|
-
}
|
|
257
230
|
})
|
|
258
231
|
);
|
|
259
232
|
```
|
package/build/$Dom.js
CHANGED
|
@@ -39,8 +39,13 @@ var $Dom = exports.$Dom = /*#__PURE__*/function () {
|
|
|
39
39
|
}
|
|
40
40
|
}, {
|
|
41
41
|
key: "create",
|
|
42
|
-
value: function create(
|
|
43
|
-
this.element = document.createElement(
|
|
42
|
+
value: function create(tagName) {
|
|
43
|
+
this.element = document.createElement(tagName);
|
|
44
|
+
}
|
|
45
|
+
}, {
|
|
46
|
+
key: "getTagName",
|
|
47
|
+
value: function getTagName() {
|
|
48
|
+
return this.element.tagName.toLowerCase();
|
|
44
49
|
}
|
|
45
50
|
}, {
|
|
46
51
|
key: "setSelector",
|
package/build/App.js
CHANGED
|
@@ -157,8 +157,8 @@ var App = exports.App = function App(tmodel) {
|
|
|
157
157
|
};
|
|
158
158
|
App.oids = {};
|
|
159
159
|
App.getOid = function (type) {
|
|
160
|
-
var
|
|
161
|
-
var oids =
|
|
160
|
+
var _App$tRoot;
|
|
161
|
+
var oids = type === 'Bracket' ? App.oids : (App === null || App === void 0 || (_App$tRoot = App.tRoot) === null || _App$tRoot === void 0 ? void 0 : _App$tRoot.oids) || App.oids;
|
|
162
162
|
if (!_TUtil.TUtil.isDefined(oids[type])) {
|
|
163
163
|
oids[type] = 0;
|
|
164
164
|
}
|
|
@@ -172,47 +172,47 @@ var isRunning = exports.isRunning = function isRunning() {
|
|
|
172
172
|
return tApp ? tApp.runningFlag : false;
|
|
173
173
|
};
|
|
174
174
|
var tRoot = exports.tRoot = function tRoot() {
|
|
175
|
-
var
|
|
176
|
-
return (
|
|
175
|
+
var _tApp;
|
|
176
|
+
return (_tApp = tApp) === null || _tApp === void 0 ? void 0 : _tApp.tRoot;
|
|
177
177
|
};
|
|
178
178
|
var getEvents = exports.getEvents = function getEvents() {
|
|
179
|
-
var
|
|
180
|
-
return (
|
|
179
|
+
var _tApp2;
|
|
180
|
+
return (_tApp2 = tApp) === null || _tApp2 === void 0 ? void 0 : _tApp2.events;
|
|
181
181
|
};
|
|
182
182
|
var getPager = exports.getPager = function getPager() {
|
|
183
|
-
var
|
|
184
|
-
return (
|
|
183
|
+
var _tApp3;
|
|
184
|
+
return (_tApp3 = tApp) === null || _tApp3 === void 0 ? void 0 : _tApp3.pager;
|
|
185
185
|
};
|
|
186
186
|
var getLoader = exports.getLoader = function getLoader() {
|
|
187
|
-
var
|
|
188
|
-
return (
|
|
187
|
+
var _tApp4;
|
|
188
|
+
return (_tApp4 = tApp) === null || _tApp4 === void 0 ? void 0 : _tApp4.loader;
|
|
189
189
|
};
|
|
190
190
|
var getManager = exports.getManager = function getManager() {
|
|
191
|
-
var
|
|
192
|
-
return (
|
|
191
|
+
var _tApp5;
|
|
192
|
+
return (_tApp5 = tApp) === null || _tApp5 === void 0 ? void 0 : _tApp5.manager;
|
|
193
193
|
};
|
|
194
194
|
var getRunScheduler = exports.getRunScheduler = function getRunScheduler() {
|
|
195
|
-
var
|
|
196
|
-
return (
|
|
195
|
+
var _tApp6;
|
|
196
|
+
return (_tApp6 = tApp) === null || _tApp6 === void 0 ? void 0 : _tApp6.runScheduler;
|
|
197
197
|
};
|
|
198
198
|
var getLocationManager = exports.getLocationManager = function getLocationManager() {
|
|
199
|
-
var
|
|
200
|
-
return (
|
|
199
|
+
var _tApp7;
|
|
200
|
+
return (_tApp7 = tApp) === null || _tApp7 === void 0 ? void 0 : _tApp7.locationManager;
|
|
201
201
|
};
|
|
202
202
|
var getBrowser = exports.getBrowser = function getBrowser() {
|
|
203
|
-
var
|
|
204
|
-
return (
|
|
203
|
+
var _tApp8;
|
|
204
|
+
return (_tApp8 = tApp) === null || _tApp8 === void 0 ? void 0 : _tApp8.browser;
|
|
205
205
|
};
|
|
206
206
|
var getScreenWidth = exports.getScreenWidth = function getScreenWidth() {
|
|
207
|
-
var _tApp$tRoot$getWidth,
|
|
208
|
-
return (_tApp$tRoot$getWidth = (
|
|
207
|
+
var _tApp$tRoot$getWidth, _tApp9;
|
|
208
|
+
return (_tApp$tRoot$getWidth = (_tApp9 = tApp) === null || _tApp9 === void 0 || (_tApp9 = _tApp9.tRoot) === null || _tApp9 === void 0 ? void 0 : _tApp9.getWidth()) !== null && _tApp$tRoot$getWidth !== void 0 ? _tApp$tRoot$getWidth : 0;
|
|
209
209
|
};
|
|
210
210
|
var getScreenHeight = exports.getScreenHeight = function getScreenHeight() {
|
|
211
|
-
var _tApp$tRoot$getHeight,
|
|
212
|
-
return (_tApp$tRoot$getHeight = (
|
|
211
|
+
var _tApp$tRoot$getHeight, _tApp10;
|
|
212
|
+
return (_tApp$tRoot$getHeight = (_tApp10 = tApp) === null || _tApp10 === void 0 || (_tApp10 = _tApp10.tRoot) === null || _tApp10 === void 0 ? void 0 : _tApp10.getHeight()) !== null && _tApp$tRoot$getHeight !== void 0 ? _tApp$tRoot$getHeight : 0;
|
|
213
213
|
};
|
|
214
214
|
var getVisibles = exports.getVisibles = function getVisibles() {
|
|
215
|
-
var
|
|
216
|
-
return (
|
|
215
|
+
var _tApp11;
|
|
216
|
+
return (_tApp11 = tApp) === null || _tApp11 === void 0 || (_tApp11 = _tApp11.manager) === null || _tApp11 === void 0 ? void 0 : _tApp11.lists.visible;
|
|
217
217
|
};
|
|
218
218
|
window.t = window.t || _SearchUtil.SearchUtil.find;
|
package/build/LoadingManager.js
CHANGED
|
@@ -22,17 +22,19 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
|
|
|
22
22
|
var LoadingManager = exports.LoadingManager = /*#__PURE__*/function () {
|
|
23
23
|
function LoadingManager() {
|
|
24
24
|
_classCallCheck(this, LoadingManager);
|
|
25
|
-
this.
|
|
25
|
+
this.cacheMap = {};
|
|
26
26
|
this.fetchingAPIMap = {};
|
|
27
27
|
this.fetchingImageMap = {};
|
|
28
28
|
}
|
|
29
29
|
return _createClass(LoadingManager, [{
|
|
30
30
|
key: "fetchCommon",
|
|
31
|
-
value: function fetchCommon(fetchId, tmodel, fetchMap, fetchFn) {
|
|
32
|
-
if (this.isFetched(
|
|
31
|
+
value: function fetchCommon(fetchId, cacheId, tmodel, fetchMap, fetchFn) {
|
|
32
|
+
if (cacheId && this.isFetched(cacheId)) {
|
|
33
33
|
var _tmodel$targets$tmode;
|
|
34
34
|
if (typeof ((_tmodel$targets$tmode = tmodel.targets[tmodel.key]) === null || _tmodel$targets$tmode === void 0 ? void 0 : _tmodel$targets$tmode.onSuccess) === 'function' && tmodel.isTargetEnabled(tmodel.key)) {
|
|
35
|
-
tmodel.targets[tmodel.key].onSuccess.call(tmodel, this.
|
|
35
|
+
tmodel.targets[tmodel.key].onSuccess.call(tmodel, _objectSpread(_objectSpread({}, this.cacheMap[cacheId]), {}, {
|
|
36
|
+
fetchingPeriod: 0
|
|
37
|
+
}));
|
|
36
38
|
}
|
|
37
39
|
} else if (fetchMap[fetchId]) {
|
|
38
40
|
fetchMap[fetchId].targets.push({
|
|
@@ -42,9 +44,9 @@ var LoadingManager = exports.LoadingManager = /*#__PURE__*/function () {
|
|
|
42
44
|
} else {
|
|
43
45
|
fetchMap[fetchId] = {
|
|
44
46
|
fetchId: fetchId,
|
|
47
|
+
cacheId: cacheId,
|
|
45
48
|
fetchingFlag: true,
|
|
46
49
|
startTime: _TUtil.TUtil.now(),
|
|
47
|
-
fetchTime: undefined,
|
|
48
50
|
targets: [{
|
|
49
51
|
tmodel: tmodel,
|
|
50
52
|
targetName: tmodel.key
|
|
@@ -53,23 +55,23 @@ var LoadingManager = exports.LoadingManager = /*#__PURE__*/function () {
|
|
|
53
55
|
};
|
|
54
56
|
fetchFn();
|
|
55
57
|
}
|
|
56
|
-
return
|
|
58
|
+
return fetchId;
|
|
57
59
|
}
|
|
58
60
|
}, {
|
|
59
61
|
key: "fetch",
|
|
60
|
-
value: function fetch(tmodel, url, query,
|
|
62
|
+
value: function fetch(tmodel, url, query, cacheId) {
|
|
61
63
|
var _this = this;
|
|
62
|
-
fetchId =
|
|
63
|
-
return this.fetchCommon(fetchId, tmodel, this.fetchingAPIMap, function () {
|
|
64
|
+
var fetchId = "".concat(tmodel.oid, "_").concat(url, "_").concat(JSON.stringify(query));
|
|
65
|
+
return this.fetchCommon(fetchId, cacheId, tmodel, this.fetchingAPIMap, function () {
|
|
64
66
|
_this.ajaxAPI(url, query, _this.fetchingAPIMap[fetchId]);
|
|
65
67
|
});
|
|
66
68
|
}
|
|
67
69
|
}, {
|
|
68
70
|
key: "fetchImage",
|
|
69
|
-
value: function fetchImage(tmodel, src,
|
|
71
|
+
value: function fetchImage(tmodel, src, cacheId) {
|
|
70
72
|
var _this2 = this;
|
|
71
|
-
fetchId =
|
|
72
|
-
return this.fetchCommon(fetchId, tmodel, this.fetchingImageMap, function () {
|
|
73
|
+
var fetchId = "".concat(tmodel.oid, "_").concat(src);
|
|
74
|
+
return this.fetchCommon(fetchId, cacheId, tmodel, this.fetchingImageMap, function () {
|
|
73
75
|
_this2.loadImage(src, _this2.fetchingImageMap[fetchId]);
|
|
74
76
|
});
|
|
75
77
|
}
|
|
@@ -81,43 +83,30 @@ var LoadingManager = exports.LoadingManager = /*#__PURE__*/function () {
|
|
|
81
83
|
}
|
|
82
84
|
}, {
|
|
83
85
|
key: "isFetched",
|
|
84
|
-
value: function isFetched(
|
|
85
|
-
var _this$
|
|
86
|
-
return (_this$
|
|
86
|
+
value: function isFetched(cacheId) {
|
|
87
|
+
var _this$cacheMap$cacheI, _this$cacheMap$cacheI2;
|
|
88
|
+
return (_this$cacheMap$cacheI = (_this$cacheMap$cacheI2 = this.cacheMap[cacheId]) === null || _this$cacheMap$cacheI2 === void 0 ? void 0 : _this$cacheMap$cacheI2.success) !== null && _this$cacheMap$cacheI !== void 0 ? _this$cacheMap$cacheI : false;
|
|
87
89
|
}
|
|
88
90
|
}, {
|
|
89
91
|
key: "getFetchingPeriod",
|
|
90
92
|
value: function getFetchingPeriod(fetchId) {
|
|
91
|
-
|
|
92
|
-
var _this$fetchingAPIMap$3 = this.fetchingAPIMap[fetchId],
|
|
93
|
-
startTime = _this$fetchingAPIMap$3.startTime,
|
|
94
|
-
fetchTime = _this$fetchingAPIMap$3.fetchTime;
|
|
95
|
-
return fetchTime === undefined ? _TUtil.TUtil.now() - startTime : fetchTime - startTime;
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
}, {
|
|
99
|
-
key: "fetchResult",
|
|
100
|
-
value: function fetchResult(fetchId) {
|
|
101
|
-
return this.resultMap[fetchId];
|
|
93
|
+
return this.fetchingAPIMap[fetchId] ? _TUtil.TUtil.now() - this.fetchingAPIMap[fetchId].startTime : undefined;
|
|
102
94
|
}
|
|
103
95
|
}, {
|
|
104
|
-
key: "
|
|
105
|
-
value: function
|
|
106
|
-
|
|
107
|
-
return (_this$resultMap$fetch3 = this.resultMap[fetchId]) === null || _this$resultMap$fetch3 === void 0 || (_this$resultMap$fetch3 = _this$resultMap$fetch3.result) === null || _this$resultMap$fetch3 === void 0 ? void 0 : _this$resultMap$fetch3.errors;
|
|
96
|
+
key: "fetchCache",
|
|
97
|
+
value: function fetchCache(cacheId) {
|
|
98
|
+
return this.cacheMap[cacheId];
|
|
108
99
|
}
|
|
109
100
|
}, {
|
|
110
101
|
key: "handleSuccess",
|
|
111
102
|
value: function handleSuccess(fetchStatus, result) {
|
|
112
|
-
var
|
|
113
|
-
fetchStatus.fetchingFlag = false;
|
|
114
|
-
fetchStatus.fetchTime = fetchStatus.fetchTime || _TUtil.TUtil.now();
|
|
103
|
+
var fetchTime = _TUtil.TUtil.now();
|
|
115
104
|
var fetchId = fetchStatus.fetchId,
|
|
116
|
-
|
|
105
|
+
cacheId = fetchStatus.cacheId,
|
|
117
106
|
startTime = fetchStatus.startTime,
|
|
118
107
|
targets = fetchStatus.targets,
|
|
119
108
|
fetchMap = fetchStatus.fetchMap;
|
|
120
|
-
|
|
109
|
+
var res = {
|
|
121
110
|
fetchingPeriod: fetchTime - startTime,
|
|
122
111
|
success: true,
|
|
123
112
|
result: result
|
|
@@ -127,24 +116,25 @@ var LoadingManager = exports.LoadingManager = /*#__PURE__*/function () {
|
|
|
127
116
|
var tmodel = _ref.tmodel,
|
|
128
117
|
targetName = _ref.targetName;
|
|
129
118
|
if (typeof ((_tmodel$targets$targe = tmodel.targets[targetName]) === null || _tmodel$targets$targe === void 0 ? void 0 : _tmodel$targets$targe.onSuccess) === 'function' && tmodel.isTargetEnabled(targetName)) {
|
|
130
|
-
tmodel.targets[targetName].onSuccess.call(tmodel,
|
|
119
|
+
tmodel.targets[targetName].onSuccess.call(tmodel, res);
|
|
131
120
|
}
|
|
132
121
|
});
|
|
133
|
-
delete fetchMap
|
|
122
|
+
delete fetchMap[fetchId];
|
|
123
|
+
if (cacheId) {
|
|
124
|
+
this.cacheMap[cacheId] = res;
|
|
125
|
+
}
|
|
134
126
|
(0, _App.getRunScheduler)().schedule(0, "api_success_".concat(fetchId));
|
|
135
127
|
}
|
|
136
128
|
}, {
|
|
137
129
|
key: "handleError",
|
|
138
130
|
value: function handleError(fetchStatus, error) {
|
|
139
|
-
var
|
|
140
|
-
fetchStatus.fetchingFlag = false;
|
|
141
|
-
fetchStatus.fetchTime = fetchStatus.fetchTime || _TUtil.TUtil.now();
|
|
131
|
+
var fetchTime = _TUtil.TUtil.now();
|
|
142
132
|
var fetchId = fetchStatus.fetchId,
|
|
143
|
-
|
|
133
|
+
cacheId = fetchStatus.cacheId,
|
|
144
134
|
startTime = fetchStatus.startTime,
|
|
145
135
|
targets = fetchStatus.targets,
|
|
146
136
|
fetchMap = fetchStatus.fetchMap;
|
|
147
|
-
|
|
137
|
+
var res = {
|
|
148
138
|
fetchingPeriod: fetchTime - startTime,
|
|
149
139
|
success: false,
|
|
150
140
|
error: error
|
|
@@ -154,24 +144,27 @@ var LoadingManager = exports.LoadingManager = /*#__PURE__*/function () {
|
|
|
154
144
|
var tmodel = _ref2.tmodel,
|
|
155
145
|
targetName = _ref2.targetName;
|
|
156
146
|
if (typeof ((_tmodel$targets$targe2 = tmodel.targets[targetName]) === null || _tmodel$targets$targe2 === void 0 ? void 0 : _tmodel$targets$targe2.onError) === 'function') {
|
|
157
|
-
tmodel.targets[targetName].onError.call(tmodel,
|
|
147
|
+
tmodel.targets[targetName].onError.call(tmodel, res);
|
|
158
148
|
}
|
|
159
149
|
});
|
|
160
|
-
delete fetchMap
|
|
150
|
+
delete fetchMap[fetchId];
|
|
151
|
+
if (cacheId) {
|
|
152
|
+
this.cacheMap[cacheId] = res;
|
|
153
|
+
}
|
|
161
154
|
(0, _App.getRunScheduler)().schedule(0, "api_error_".concat(fetchId));
|
|
162
155
|
}
|
|
163
156
|
}, {
|
|
164
157
|
key: "ajaxAPI",
|
|
165
158
|
value: function ajaxAPI(url, query, fetchStatus) {
|
|
166
|
-
var
|
|
159
|
+
var _this3 = this;
|
|
167
160
|
var defaultQuery = {
|
|
168
161
|
dataType: "json",
|
|
169
162
|
type: "GET",
|
|
170
163
|
success: function success(dataList) {
|
|
171
|
-
return
|
|
164
|
+
return _this3.handleSuccess(fetchStatus, dataList);
|
|
172
165
|
},
|
|
173
166
|
error: function error(textStatus) {
|
|
174
|
-
return
|
|
167
|
+
return _this3.handleError(fetchStatus, textStatus);
|
|
175
168
|
}
|
|
176
169
|
};
|
|
177
170
|
_$Dom.$Dom.ajax(_objectSpread(_objectSpread({}, defaultQuery), {}, {
|
|
@@ -183,7 +176,7 @@ var LoadingManager = exports.LoadingManager = /*#__PURE__*/function () {
|
|
|
183
176
|
}, {
|
|
184
177
|
key: "loadImage",
|
|
185
178
|
value: function loadImage(src, fetchStatus) {
|
|
186
|
-
var
|
|
179
|
+
var _this4 = this;
|
|
187
180
|
var image = new Image();
|
|
188
181
|
image.src = src;
|
|
189
182
|
image.onload = function () {
|
|
@@ -192,10 +185,10 @@ var LoadingManager = exports.LoadingManager = /*#__PURE__*/function () {
|
|
|
192
185
|
height: image.height,
|
|
193
186
|
src: image.src
|
|
194
187
|
};
|
|
195
|
-
|
|
188
|
+
_this4.handleSuccess(fetchStatus, result);
|
|
196
189
|
};
|
|
197
190
|
image.onerror = image.onerror = function () {
|
|
198
|
-
|
|
191
|
+
_this4.handleError(fetchStatus, "not found");
|
|
199
192
|
};
|
|
200
193
|
}
|
|
201
194
|
}]);
|
package/build/RunScheduler.js
CHANGED
|
@@ -149,10 +149,10 @@ var RunScheduler = exports.RunScheduler = /*#__PURE__*/function () {
|
|
|
149
149
|
_App.tApp.manager.createDoms();
|
|
150
150
|
break;
|
|
151
151
|
case 3:
|
|
152
|
-
_App.tApp.manager.
|
|
152
|
+
_App.tApp.manager.reattachTModels();
|
|
153
153
|
break;
|
|
154
154
|
case 4:
|
|
155
|
-
_App.tApp.manager.
|
|
155
|
+
_App.tApp.manager.renderTModels();
|
|
156
156
|
break;
|
|
157
157
|
case 5:
|
|
158
158
|
_App.tApp.manager.fixStyles();
|
package/build/TModel.js
CHANGED
|
@@ -314,6 +314,11 @@ var TModel = exports.TModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
314
314
|
value: function hasDomHolderChanged() {
|
|
315
315
|
return this.getDomHolder() && this.getDomHolder().exists() && this.$dom.parent().getAttribute("id") !== this.getDomHolder().attr("id");
|
|
316
316
|
}
|
|
317
|
+
}, {
|
|
318
|
+
key: "hasDomChanged",
|
|
319
|
+
value: function hasDomChanged() {
|
|
320
|
+
return this.getBaseElement() !== this.$dom.getTagName();
|
|
321
|
+
}
|
|
317
322
|
}, {
|
|
318
323
|
key: "hasDom",
|
|
319
324
|
value: function hasDom() {
|
package/build/TModelManager.js
CHANGED
|
@@ -134,6 +134,8 @@ var TModelManager = exports.TModelManager = /*#__PURE__*/function () {
|
|
|
134
134
|
value: function needsRestyle(tmodel) {
|
|
135
135
|
if (tmodel.hasDom() && tmodel.styleTargetList.length > 0) {
|
|
136
136
|
this.lists.restyle.push(tmodel);
|
|
137
|
+
tmodel.domHeight = undefined;
|
|
138
|
+
tmodel.domWidth = undefined;
|
|
137
139
|
return true;
|
|
138
140
|
}
|
|
139
141
|
return false;
|
|
@@ -141,7 +143,7 @@ var TModelManager = exports.TModelManager = /*#__PURE__*/function () {
|
|
|
141
143
|
}, {
|
|
142
144
|
key: "needsReattach",
|
|
143
145
|
value: function needsReattach(tmodel) {
|
|
144
|
-
if (tmodel.hasDom() && tmodel.hasDomHolderChanged()) {
|
|
146
|
+
if (tmodel.hasDom() && (tmodel.hasDomHolderChanged() || tmodel.hasDomChanged())) {
|
|
145
147
|
this.lists.reattach.push(tmodel);
|
|
146
148
|
return true;
|
|
147
149
|
}
|
|
@@ -175,6 +177,10 @@ var TModelManager = exports.TModelManager = /*#__PURE__*/function () {
|
|
|
175
177
|
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
|
176
178
|
var tmodel = _step3.value;
|
|
177
179
|
tmodel.$dom.detach();
|
|
180
|
+
if (tmodel.hasDomChanged()) {
|
|
181
|
+
_TModelUtil.TModelUtil.createDom(tmodel);
|
|
182
|
+
this.fixStyle(tmodel);
|
|
183
|
+
}
|
|
178
184
|
tmodel.getDomHolder().appendTModel$Dom(tmodel);
|
|
179
185
|
}
|
|
180
186
|
} catch (err) {
|
|
@@ -351,16 +357,7 @@ var TModelManager = exports.TModelManager = /*#__PURE__*/function () {
|
|
|
351
357
|
var _loop2 = function _loop2() {
|
|
352
358
|
var tmodel = _needsDom[_i];
|
|
353
359
|
tmodel.$dom = new _$Dom.$Dom();
|
|
354
|
-
|
|
355
|
-
tmodel.$dom.setSelector("#".concat(tmodel.oid));
|
|
356
|
-
tmodel.$dom.setId(tmodel.oid);
|
|
357
|
-
tmodel.transformMap = {};
|
|
358
|
-
tmodel.styleMap = {};
|
|
359
|
-
tmodel.allStyleTargetList.forEach(function (key) {
|
|
360
|
-
if (_TUtil.TUtil.isDefined(tmodel.val(key))) {
|
|
361
|
-
tmodel.addToStyleTargetList(key);
|
|
362
|
-
}
|
|
363
|
-
});
|
|
360
|
+
_TModelUtil.TModelUtil.createDom(tmodel);
|
|
364
361
|
_this.fixStyle(tmodel);
|
|
365
362
|
var contentItem = contentList.find(function (item) {
|
|
366
363
|
return item.domHolder === tmodel.getDomHolder();
|
package/build/TModelUtil.js
CHANGED
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.TModelUtil = void 0;
|
|
7
7
|
var _TUtil = require("./TUtil.js");
|
|
8
|
+
var _$Dom = require("./$Dom.js");
|
|
8
9
|
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); }
|
|
9
10
|
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
|
10
11
|
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); } }
|
|
@@ -102,6 +103,21 @@ var TModelUtil = exports.TModelUtil = /*#__PURE__*/function () {
|
|
|
102
103
|
css: ''
|
|
103
104
|
};
|
|
104
105
|
}
|
|
106
|
+
}, {
|
|
107
|
+
key: "createDom",
|
|
108
|
+
value: function createDom(tmodel) {
|
|
109
|
+
tmodel.$dom = new _$Dom.$Dom();
|
|
110
|
+
tmodel.$dom.create(tmodel.getBaseElement());
|
|
111
|
+
tmodel.$dom.setSelector("#".concat(tmodel.oid));
|
|
112
|
+
tmodel.$dom.setId(tmodel.oid);
|
|
113
|
+
tmodel.transformMap = {};
|
|
114
|
+
tmodel.styleMap = {};
|
|
115
|
+
tmodel.allStyleTargetList.forEach(function (key) {
|
|
116
|
+
if (_TUtil.TUtil.isDefined(tmodel.val(key))) {
|
|
117
|
+
tmodel.addToStyleTargetList(key);
|
|
118
|
+
}
|
|
119
|
+
});
|
|
120
|
+
}
|
|
105
121
|
}, {
|
|
106
122
|
key: "getTransformString",
|
|
107
123
|
value: function getTransformString(tmodel) {
|
package/build/TargetUtil.js
CHANGED
|
@@ -223,8 +223,9 @@ var TargetUtil = exports.TargetUtil = /*#__PURE__*/function () {
|
|
|
223
223
|
}, {
|
|
224
224
|
key: "setWidthFromDom",
|
|
225
225
|
value: function setWidthFromDom(child) {
|
|
226
|
-
var
|
|
227
|
-
var
|
|
226
|
+
var _child$domWidth, _child$domWidth2;
|
|
227
|
+
var height = (_child$domWidth = child.domWidth) === null || _child$domWidth === void 0 ? void 0 : _child$domWidth.height;
|
|
228
|
+
var width = (_child$domWidth2 = child.domWidth) === null || _child$domWidth2 === void 0 ? void 0 : _child$domWidth2.width;
|
|
228
229
|
var domParent = child.getDomParent();
|
|
229
230
|
var rerender = false;
|
|
230
231
|
if ((0, _App.getManager)().needsRerender(child)) {
|
|
@@ -246,8 +247,9 @@ var TargetUtil = exports.TargetUtil = /*#__PURE__*/function () {
|
|
|
246
247
|
}, {
|
|
247
248
|
key: "setHeightFromDom",
|
|
248
249
|
value: function setHeightFromDom(child) {
|
|
249
|
-
var
|
|
250
|
-
var
|
|
250
|
+
var _child$domHeight, _child$domHeight2;
|
|
251
|
+
var height = (_child$domHeight = child.domHeight) === null || _child$domHeight === void 0 ? void 0 : _child$domHeight.height;
|
|
252
|
+
var width = (_child$domHeight2 = child.domHeight) === null || _child$domHeight2 === void 0 ? void 0 : _child$domHeight2.width;
|
|
251
253
|
var domParent = child.getDomParent();
|
|
252
254
|
var rerender = false;
|
|
253
255
|
if ((0, _App.getManager)().needsRerender(child)) {
|