dom-render 1.0.79 → 1.0.80

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.
@@ -105,7 +105,8 @@ var EventManager = /** @class */ (function () {
105
105
  map.forEach(function (v, k) {
106
106
  var data = ScriptUtils_1.ScriptUtils.eval("const $element = this.element; return ".concat(v, " "), Object.assign(obj, {
107
107
  __render: Object.freeze({
108
- element: it
108
+ element: it,
109
+ attribute: DomUtils_1.DomUtils.getAttributeToObject(it)
109
110
  })
110
111
  }));
111
112
  it.setAttribute(k, data);
@@ -117,26 +118,6 @@ var EventManager = /** @class */ (function () {
117
118
  it.obj = obj;
118
119
  });
119
120
  });
120
- // on-init event
121
- this.procAttr(childNodes, EventManager.onInitAttrName, function (it, attribute) {
122
- var script = attribute;
123
- if (script) {
124
- script = 'return ' + script;
125
- }
126
- if (script) {
127
- ScriptUtils_1.ScriptUtils.eval("".concat(_this.bindScript, "; ").concat(script, " "), Object.assign(obj, {
128
- __render: Object.freeze({
129
- element: it
130
- })
131
- }));
132
- // console.log('onInit--->', obj, varName, it)
133
- // if (typeof this.getValue(obj, varName) === 'function') {
134
- // this.getValue(obj, varName)(it);
135
- // } else {
136
- // this.setValue(obj, varName, it);
137
- // }
138
- }
139
- });
140
121
  // value-link event
141
122
  this.procAttr(childNodes, EventManager.valueLinkAttrName, function (it, varName) {
142
123
  if (varName) {
@@ -185,6 +166,7 @@ var EventManager = /** @class */ (function () {
185
166
  __render: Object.freeze({
186
167
  event: event,
187
168
  element: it,
169
+ attribute: DomUtils_1.DomUtils.getAttributeToObject(it),
188
170
  target: event.target,
189
171
  range: Range_1.Range.range,
190
172
  scripts: EventManager.setBindProperty(config === null || config === void 0 ? void 0 : config.scripts, obj)
@@ -200,6 +182,27 @@ var EventManager = /** @class */ (function () {
200
182
  });
201
183
  }
202
184
  });
185
+ // on-init event
186
+ this.procAttr(childNodes, EventManager.onInitAttrName, function (it, attribute) {
187
+ var script = attribute;
188
+ if (script) {
189
+ script = 'return ' + script;
190
+ }
191
+ if (script) {
192
+ ScriptUtils_1.ScriptUtils.eval("".concat(_this.bindScript, "; ").concat(script, " "), Object.assign(obj, {
193
+ __render: Object.freeze({
194
+ element: it,
195
+ attribute: DomUtils_1.DomUtils.getAttributeToObject(it)
196
+ })
197
+ }));
198
+ // console.log('onInit--->', obj, varName, it)
199
+ // if (typeof this.getValue(obj, varName) === 'function') {
200
+ // this.getValue(obj, varName)(it);
201
+ // } else {
202
+ // this.setValue(obj, varName, it);
203
+ // }
204
+ }
205
+ });
203
206
  this.changeVar(obj, childNodes, undefined, config);
204
207
  // console.log('eventManager-applyEvent-->', config?.applyEvents)
205
208
  var elements = Array.from(childNodes).filter(function (it) { return it.nodeType === 1; }).map(function (it) { return it; });
@@ -247,7 +250,8 @@ var EventManager = /** @class */ (function () {
247
250
  if (EventManager.isUsingThisVar(script, varName) || varName === undefined) {
248
251
  var data = ScriptUtils_1.ScriptUtils.eval("const $element = this.__render.element; ".concat(script, " "), Object.assign(obj, {
249
252
  __render: Object.freeze({
250
- element: it
253
+ element: it,
254
+ attribute: DomUtils_1.DomUtils.getAttributeToObject(it)
251
255
  })
252
256
  }));
253
257
  if (typeof data === 'string') {
@@ -298,7 +302,8 @@ var EventManager = /** @class */ (function () {
298
302
  if (EventManager.isUsingThisVar(script, varName) || varName === undefined) {
299
303
  var data = ScriptUtils_1.ScriptUtils.eval("const $element = this.__render.element; ".concat(script, " "), Object.assign(obj, {
300
304
  __render: Object.freeze({
301
- element: it
305
+ element: it,
306
+ attribute: DomUtils_1.DomUtils.getAttributeToObject(it)
302
307
  })
303
308
  }));
304
309
  if (typeof data === 'string') {
@@ -326,7 +331,8 @@ var EventManager = /** @class */ (function () {
326
331
  if (EventManager.isUsingThisVar(script, varName) || varName === undefined) {
327
332
  var data = ScriptUtils_1.ScriptUtils.eval("const $element = this.element; ".concat(script, " "), Object.assign(obj, {
328
333
  __render: Object.freeze({
329
- element: it
334
+ element: it,
335
+ attribute: DomUtils_1.DomUtils.getAttributeToObject(it)
330
336
  })
331
337
  }));
332
338
  if (typeof data === 'string') {
@@ -360,7 +366,8 @@ var EventManager = /** @class */ (function () {
360
366
  if (isUsing) {
361
367
  var data = ScriptUtils_1.ScriptUtils.eval("const $element = this.element; return ".concat(v, " "), Object.assign(obj, {
362
368
  __render: Object.freeze({
363
- element: it
369
+ element: it,
370
+ attribute: DomUtils_1.DomUtils.getAttributeToObject(it)
364
371
  })
365
372
  }));
366
373
  it.setAttribute(k, data);
@@ -377,14 +384,13 @@ var EventManager = /** @class */ (function () {
377
384
  it.addEventListener(eventName, function (event) {
378
385
  var filter = true;
379
386
  var filterScript = it.getAttribute("".concat(attr, ":filter"));
380
- var attribute = DomUtils_1.DomUtils.getAttributeToObject(it);
381
387
  var thisTarget = Object.assign(obj, {
382
388
  __render: Object.freeze({
383
389
  event: event,
384
390
  element: it,
385
391
  target: event.target,
386
392
  range: Range_1.Range.range,
387
- attribute: attribute,
393
+ attribute: DomUtils_1.DomUtils.getAttributeToObject(it),
388
394
  router: config === null || config === void 0 ? void 0 : config.router,
389
395
  scripts: EventManager.setBindProperty(config === null || config === void 0 ? void 0 : config.scripts, obj)
390
396
  })
@@ -420,6 +426,7 @@ var EventManager = /** @class */ (function () {
420
426
  __render: Object.freeze({
421
427
  event: event,
422
428
  element: it,
429
+ attribute: DomUtils_1.DomUtils.getAttributeToObject(it),
423
430
  target: event.target,
424
431
  range: Range_1.Range.range,
425
432
  scripts: EventManager.setBindProperty(config === null || config === void 0 ? void 0 : config.scripts, obj),
package/operators/Dr.js CHANGED
@@ -50,7 +50,7 @@ var Dr = /** @class */ (function (_super) {
50
50
  var tempalte = this.source.config.window.document.createElement('template');
51
51
  tempalte.innerHTML = newTemp.innerHTML;
52
52
  this.returnContainer.fag.append(tempalte.content);
53
- var rr = RawSet_1.RawSet.checkPointCreates(this.returnContainer.fag, this.source.config);
53
+ var rr = RawSet_1.RawSet.checkPointCreates(this.returnContainer.fag, this.source.obj, this.source.config);
54
54
  (_c = this.elementSource.element.parentNode) === null || _c === void 0 ? void 0 : _c.replaceChild(this.returnContainer.fag, this.elementSource.element);
55
55
  (_a = this.returnContainer.raws).push.apply(_a, rr);
56
56
  return OperatorRender_1.ExecuteState.EXECUTE;
@@ -52,7 +52,7 @@ var DrAppender = /** @class */ (function (_super) {
52
52
  var tempalte = this.source.config.window.document.createElement('template');
53
53
  tempalte.innerHTML = newTemp.innerHTML;
54
54
  this.returnContainer.fag.append(tempalte.content);
55
- var rr = RawSet_1.RawSet.checkPointCreates(this.returnContainer.fag, this.source.config);
55
+ var rr = RawSet_1.RawSet.checkPointCreates(this.returnContainer.fag, this.source.obj, this.source.config);
56
56
  (_e = this.elementSource.element.parentNode) === null || _e === void 0 ? void 0 : _e.replaceChild(this.returnContainer.fag, this.elementSource.element);
57
57
  // const rrr = rr.flatMap(it => it.render(obj, config));// .flat();
58
58
  (_a = this.returnContainer.raws).push.apply(_a, rr);
@@ -50,7 +50,7 @@ var DrFor = /** @class */ (function (_super) {
50
50
  var tempalte = this.source.config.window.document.createElement('template');
51
51
  tempalte.innerHTML = newTemp.innerHTML;
52
52
  this.returnContainer.fag.append(tempalte.content);
53
- var rr = RawSet_1.RawSet.checkPointCreates(this.returnContainer.fag, this.source.config);
53
+ var rr = RawSet_1.RawSet.checkPointCreates(this.returnContainer.fag, this.source.obj, this.source.config);
54
54
  (_e = this.elementSource.element.parentNode) === null || _e === void 0 ? void 0 : _e.replaceChild(this.returnContainer.fag, this.elementSource.element);
55
55
  (_a = this.returnContainer.raws).push.apply(_a, rr);
56
56
  return OperatorRender_1.ExecuteState.EXECUTE;
@@ -52,7 +52,7 @@ var DrForOf = /** @class */ (function (_super) {
52
52
  var tempalte = this.source.config.window.document.createElement('template');
53
53
  tempalte.innerHTML = newTemp.innerHTML;
54
54
  this.returnContainer.fag.append(tempalte.content);
55
- var rr = RawSet_1.RawSet.checkPointCreates(this.returnContainer.fag, this.source.config);
55
+ var rr = RawSet_1.RawSet.checkPointCreates(this.returnContainer.fag, this.source.obj, this.source.config);
56
56
  (_e = this.elementSource.element.parentNode) === null || _e === void 0 ? void 0 : _e.replaceChild(this.returnContainer.fag, this.elementSource.element);
57
57
  // const rrr = rr.flatMap(it => it.render(obj, config));// .flat();
58
58
  (_a = this.returnContainer.raws).push.apply(_a, rr);
@@ -90,7 +90,7 @@ var DrForm = /** @class */ (function (_super) {
90
90
  }
91
91
  });
92
92
  RawSet_1.RawSet.drFormOtherMoveAttr(this.elementSource.element, 'temp-name', 'name', this.source.config);
93
- (_a = this.returnContainer.raws).push.apply(_a, RawSet_1.RawSet.checkPointCreates(this.elementSource.element, this.source.config));
93
+ (_a = this.returnContainer.raws).push.apply(_a, RawSet_1.RawSet.checkPointCreates(this.elementSource.element, this.source.obj, this.source.config));
94
94
  return OperatorRender_1.ExecuteState.EXECUTE;
95
95
  }
96
96
  return OperatorRender_1.ExecuteState.NO_EXECUTE;
package/operators/DrIf.js CHANGED
@@ -57,7 +57,7 @@ var DrIf = /** @class */ (function (_super) {
57
57
  tempalte.innerHTML = newTemp.innerHTML;
58
58
  // console.log(tempalte.innerHTML)
59
59
  this.returnContainer.fag.append(tempalte.content);
60
- var rr = RawSet_1.RawSet.checkPointCreates(this.returnContainer.fag, this.source.config);
60
+ var rr = RawSet_1.RawSet.checkPointCreates(this.returnContainer.fag, this.source.obj, this.source.config);
61
61
  (_e = this.elementSource.element.parentNode) === null || _e === void 0 ? void 0 : _e.replaceChild(this.returnContainer.fag, this.elementSource.element);
62
62
  (_a = this.returnContainer.raws).push.apply(_a, rr);
63
63
  // if (bypass) {
@@ -48,7 +48,7 @@ var DrInnerHTML = /** @class */ (function (_super) {
48
48
  var tempalte = this.source.config.window.document.createElement('template');
49
49
  tempalte.innerHTML = newTemp.innerHTML;
50
50
  this.returnContainer.fag.append(tempalte.content);
51
- var rr = RawSet_1.RawSet.checkPointCreates(this.returnContainer.fag, this.source.config);
51
+ var rr = RawSet_1.RawSet.checkPointCreates(this.returnContainer.fag, this.source.obj, this.source.config);
52
52
  (_d = this.elementSource.element.parentNode) === null || _d === void 0 ? void 0 : _d.replaceChild(this.returnContainer.fag, this.elementSource.element);
53
53
  (_a = this.returnContainer.raws).push.apply(_a, rr);
54
54
  return OperatorRender_1.ExecuteState.EXECUTE;
@@ -46,7 +46,7 @@ var DrInnerText = /** @class */ (function (_super) {
46
46
  var tempalte = this.source.config.window.document.createElement('template');
47
47
  tempalte.innerHTML = newTemp.innerHTML;
48
48
  this.returnContainer.fag.append(tempalte.content);
49
- var rr = RawSet_1.RawSet.checkPointCreates(this.returnContainer.fag, this.source.config);
49
+ var rr = RawSet_1.RawSet.checkPointCreates(this.returnContainer.fag, this.source.obj, this.source.config);
50
50
  (_d = this.elementSource.element.parentNode) === null || _d === void 0 ? void 0 : _d.replaceChild(this.returnContainer.fag, this.elementSource.element);
51
51
  (_a = this.returnContainer.raws).push.apply(_a, rr);
52
52
  return OperatorRender_1.ExecuteState.EXECUTE;
@@ -51,7 +51,7 @@ var DrRepeat = /** @class */ (function (_super) {
51
51
  var tempalte = this.source.config.window.document.createElement('template');
52
52
  tempalte.innerHTML = newTemp.innerHTML;
53
53
  this.returnContainer.fag.append(tempalte.content);
54
- var rr = RawSet_1.RawSet.checkPointCreates(this.returnContainer.fag, this.source.config);
54
+ var rr = RawSet_1.RawSet.checkPointCreates(this.returnContainer.fag, this.source.obj, this.source.config);
55
55
  (_e = this.elementSource.element.parentNode) === null || _e === void 0 ? void 0 : _e.replaceChild(this.returnContainer.fag, this.elementSource.element);
56
56
  (_a = this.returnContainer.raws).push.apply(_a, rr);
57
57
  return OperatorRender_1.ExecuteState.EXECUTE;
@@ -35,7 +35,7 @@ var DrTargetAttr = /** @class */ (function (_super) {
35
35
  if (attrValue && attrName && (!this.elementSource.attrs.drForOf && !this.elementSource.attrs.drFor && !this.elementSource.attrs.drRepeat)) {
36
36
  var documentFragment = targetAttr.callBack(this.elementSource.element, attrValue, this.source.obj, this.rawSet);
37
37
  if (documentFragment) {
38
- var rr = RawSet_1.RawSet.checkPointCreates(documentFragment, this.source.config);
38
+ var rr = RawSet_1.RawSet.checkPointCreates(documentFragment, this.source.obj, this.source.config);
39
39
  (_d = this.elementSource.element.parentNode) === null || _d === void 0 ? void 0 : _d.replaceChild(documentFragment, this.elementSource.element);
40
40
  (_a = this.returnContainer.raws).push.apply(_a, rr);
41
41
  this.afterCallBack.onAttrInitCallBacks.push({
@@ -71,7 +71,7 @@ var DrTargetElement = /** @class */ (function (_super) {
71
71
  };
72
72
  }
73
73
  // fag.append(documentFragment)
74
- var rr = RawSet_1.RawSet.checkPointCreates(documentFragment, this.source.config);
74
+ var rr = RawSet_1.RawSet.checkPointCreates(documentFragment, this.source.obj, this.source.config);
75
75
  (_d = this.elementSource.element.parentNode) === null || _d === void 0 ? void 0 : _d.replaceChild(documentFragment, this.elementSource.element);
76
76
  (_a = this.returnContainer.raws).push.apply(_a, rr);
77
77
  this.afterCallBack.onElementInitCallBacks.push({
@@ -43,7 +43,7 @@ var DrThis = /** @class */ (function (_super) {
43
43
  else {
44
44
  this.returnContainer.fag.append(RawSet_1.RawSet.drThisCreate(this.elementSource.element, this.elementSource.attrs.drThis, (_e = this.elementSource.attrs.drVarOption) !== null && _e !== void 0 ? _e : '', this.elementSource.attrs.drStripOption, this.source.obj, this.source.config));
45
45
  }
46
- var rr = RawSet_1.RawSet.checkPointCreates(this.returnContainer.fag, this.source.config);
46
+ var rr = RawSet_1.RawSet.checkPointCreates(this.returnContainer.fag, this.source.obj, this.source.config);
47
47
  (_f = this.elementSource.element.parentNode) === null || _f === void 0 ? void 0 : _f.replaceChild(this.returnContainer.fag, this.elementSource.element);
48
48
  (_a = this.returnContainer.raws).push.apply(_a, rr);
49
49
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dom-render",
3
- "version": "1.0.79",
3
+ "version": "1.0.80",
4
4
  "main": "DomRender.js",
5
5
  "license": "MIT",
6
6
  "description": "dom-render",