2
0
mirror of https://github.com/esiur/iui.git synced 2025-06-27 01:13:12 +00:00
This commit is contained in:
2024-07-10 23:36:25 +03:00
parent e6b3023406
commit 4b2a3f3834
14 changed files with 188 additions and 169 deletions

View File

@ -185,7 +185,7 @@ var Binding = /*#__PURE__*/function () {
var proxy = new Proxy(map, detector);
try {
var d = this.func.apply(thisArg, [proxy, proxy, {}, true].concat(_toConsumableArray(this.scopeValues)));
var d = this.func.apply(thisArg, [proxy, proxy, null, {}, true].concat(_toConsumableArray(this.scopeValues)));
this.map = map;
return d;
} catch (ex) {
@ -196,7 +196,7 @@ var Binding = /*#__PURE__*/function () {
}, {
key: "_execute",
value: function () {
var _execute2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(thisArg, data) {
var _execute2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(thisArg, data, radix) {
var context, rt;
return regeneratorRuntime.wrap(function _callee2$(_context2) {
while (1) {
@ -204,7 +204,7 @@ var Binding = /*#__PURE__*/function () {
case 0:
if (!this.checked) this._findMap(thisArg);
context = {};
rt = this.func.apply(thisArg, [data, data, context, false].concat(_toConsumableArray(this.scopeValues)));
rt = this.func.apply(thisArg, [data, data, radix, context, false].concat(_toConsumableArray(this.scopeValues)));
if (!(rt instanceof Promise)) {
_context2.next = 6;
@ -273,7 +273,7 @@ var Binding = /*#__PURE__*/function () {
}, _callee2, this, [[17, 23]]);
}));
function _execute(_x, _x2) {
function _execute(_x, _x2, _x3) {
return _execute2.apply(this, arguments);
}
@ -316,7 +316,7 @@ var Binding = /*#__PURE__*/function () {
}, {
key: "render",
value: function () {
var _render = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee3(data) {
var _render = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee3(data, radix) {
var d, _d, _window, _window$app, targetElement, _d2, _targetElement$__i_bi, _targetElement$__i_bi2, _targetElement$__i_bi3, _targetElement$__i_bi4, _d3, _d4, _d5, _d6, _d7;
return regeneratorRuntime.wrap(function _callee3$(_context3) {
@ -333,7 +333,7 @@ var Binding = /*#__PURE__*/function () {
}
_context3.next = 5;
return this._execute(this.target, data);
return this._execute(this.target, data, radix);
case 5:
d = _context3.sent;
@ -352,7 +352,7 @@ var Binding = /*#__PURE__*/function () {
_context3.prev = 11;
_context3.next = 14;
return this._execute(this.target.parentElement, data);
return this._execute(this.target.parentElement, data, radix);
case 14:
_d = _context3.sent;
@ -392,7 +392,7 @@ var Binding = /*#__PURE__*/function () {
targetElement = this.target.ownerElement;
_context3.next = 30;
return this._execute(targetElement, data);
return this._execute(targetElement, data, radix);
case 30:
_d2 = _context3.sent;
@ -438,7 +438,7 @@ var Binding = /*#__PURE__*/function () {
}
_context3.next = 48;
return this._execute(this.target.ownerElement, data);
return this._execute(this.target.ownerElement, data, radix);
case 48:
_d3 = _context3.sent;
@ -453,7 +453,7 @@ var Binding = /*#__PURE__*/function () {
}
_context3.next = 55;
return this._execute(this.target.ownerElement, data);
return this._execute(this.target.ownerElement, data, radix);
case 55:
_d4 = _context3.sent;
@ -476,7 +476,7 @@ var Binding = /*#__PURE__*/function () {
}
_context3.next = 63;
return this._execute(this.target.ownerElement, data);
return this._execute(this.target.ownerElement, data, radix);
case 63:
_d5 = _context3.sent;
@ -506,12 +506,12 @@ var Binding = /*#__PURE__*/function () {
}
_context3.next = 73;
return this._execute(this.target.ownerElement, data);
return this._execute(this.target.ownerElement, data, radix);
case 73:
_d6 = _context3.sent;
_context3.next = 76;
return this.target.ownerElement.setData(_d6);
return this.target.ownerElement.setData(_d6, data);
case 76:
_context3.next = 85;
@ -524,7 +524,7 @@ var Binding = /*#__PURE__*/function () {
}
_context3.next = 81;
return this._execute(this.target.ownerElement, data);
return this._execute(this.target.ownerElement, data, radix);
case 81:
_d7 = _context3.sent;
@ -555,7 +555,7 @@ var Binding = /*#__PURE__*/function () {
}, _callee3, this, [[1, 88], [11, 21]]);
}));
function render(_x3) {
function render(_x4, _x5) {
return _render.apply(this, arguments);
}
@ -622,7 +622,7 @@ var Binding = /*#__PURE__*/function () {
var scopeValues = Object.values(scope);
try {
var args = ["data", "d", "context", "_test"].concat(_toConsumableArray(scopeKeys));
var args = ["data", "d", "radix", "context", "_test"].concat(_toConsumableArray(scopeKeys));
if (isAsync) func = _construct(AsyncFunction, _toConsumableArray(args).concat([code]));else func = _construct(Function, _toConsumableArray(args).concat([code]));
} catch (ex) {
console.log("Test failed: " + ex, code);
@ -1156,6 +1156,7 @@ var IUI = /*#__PURE__*/function () {
value: function () {
var _render = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee4(element, data) {
var textNodesOnly,
radix,
bindings,
i,
el,
@ -1165,132 +1166,133 @@ var IUI = /*#__PURE__*/function () {
switch (_context4.prev = _context4.next) {
case 0:
textNodesOnly = _args4.length > 2 && _args4[2] !== undefined ? _args4[2] : false;
radix = _args4.length > 3 && _args4[3] !== undefined ? _args4[3] : null;
if (element.__i_bindings) {
_context4.next = 3;
_context4.next = 4;
break;
}
return _context4.abrupt("return");
case 3:
case 4:
bindings = element.__i_bindings;
if (!textNodesOnly) {
_context4.next = 15;
_context4.next = 16;
break;
}
i = 0;
case 6:
case 7:
if (!(i < bindings.length)) {
_context4.next = 13;
_context4.next = 14;
break;
}
if (!(bindings[i].type == _Binding.BindingType.TextNode)) {
_context4.next = 10;
_context4.next = 11;
break;
}
_context4.next = 10;
return bindings[i].render(data);
_context4.next = 11;
return bindings[i].render(data, radix);
case 10:
case 11:
i++;
_context4.next = 6;
_context4.next = 7;
break;
case 13:
_context4.next = 22;
case 14:
_context4.next = 23;
break;
case 15:
i = 0;
case 16:
i = 0;
case 17:
if (!(i < bindings.length)) {
_context4.next = 22;
_context4.next = 23;
break;
}
_context4.next = 19;
return bindings[i].render(data);
_context4.next = 20;
return bindings[i].render(data, radix);
case 19:
case 20:
i++;
_context4.next = 16;
_context4.next = 17;
break;
case 22:
case 23:
i = 0;
case 23:
case 24:
if (!(i < element.children.length)) {
_context4.next = 47;
_context4.next = 48;
break;
}
el = element.children[i];
if (!(el instanceof _IUIElement["default"])) {
_context4.next = 36;
_context4.next = 37;
break;
}
if (!(el.dataMap != null)) {
_context4.next = 32;
_context4.next = 33;
break;
}
_context4.next = 29;
return el.dataMap.render(data);
case 29:
if (_context4.sent) {
_context4.next = 30;
break;
}
_context4.next = 30;
return el.dataMap.render(data, radix);
case 30:
_context4.next = 34;
break;
case 32:
_context4.next = 34;
return el.setData(data);
case 34:
_context4.next = 44;
break;
case 36:
if (!(el.dataMap != null)) {
_context4.next = 41;
if (_context4.sent) {
_context4.next = 31;
break;
}
_context4.next = 39;
return el.dataMap.render(data);
case 39:
_context4.next = 42;
case 31:
_context4.next = 35;
break;
case 41:
el.data = data;
case 33:
_context4.next = 35;
return el.setData(data);
case 35:
_context4.next = 45;
break;
case 37:
if (!(el.dataMap != null)) {
_context4.next = 42;
break;
}
_context4.next = 40;
return el.dataMap.render(data, radix);
case 40:
_context4.next = 43;
break;
case 42:
_context4.next = 44;
return IUI.render(el, el.data);
el.data = data;
case 44:
case 43:
_context4.next = 45;
return IUI.render(el, el.data, textNodesOnly, data);
case 45:
i++;
_context4.next = 23;
_context4.next = 24;
break;
case 47:
case 48:
case "end":
return _context4.stop();
}
@ -1631,7 +1633,7 @@ var IUIElement = /*#__PURE__*/function (_HTMLElement) {
}, {
key: "setData",
value: function () {
var _setData = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(value) {
var _setData = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(value, radix) {
return regeneratorRuntime.wrap(function _callee2$(_context2) {
while (1) {
switch (_context2.prev = _context2.next) {
@ -1643,7 +1645,7 @@ var IUIElement = /*#__PURE__*/function (_HTMLElement) {
});
_context2.next = 4;
return _IUI.IUI.render(this, value);
return _IUI.IUI.render(this, value, false, radix);
case 4:
_context2.next = 6;
@ -1657,7 +1659,7 @@ var IUIElement = /*#__PURE__*/function (_HTMLElement) {
}, _callee2, this);
}));
function setData(_x) {
function setData(_x, _x2) {
return _setData.apply(this, arguments);
}
@ -1805,7 +1807,7 @@ var IUIElement = /*#__PURE__*/function (_HTMLElement) {
}, _callee5, this);
}));
function update(_x2) {
function update(_x3) {
return _update.apply(this, arguments);
}
@ -2188,14 +2190,14 @@ var _default = _IUI.IUI.module( /*#__PURE__*/function (_IUIElement) {
}, {
key: "setData",
value: function () {
var _setData = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(value) {
var _setData = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(value, radix) {
return regeneratorRuntime.wrap(function _callee2$(_context2) {
while (1) {
switch (_context2.prev = _context2.next) {
case 0:
this.original = value;
_get(_getPrototypeOf(Form.prototype), "setData", this).call(this, new _Modifiable["default"](this.original, true));
_get(_getPrototypeOf(Form.prototype), "setData", this).call(this, new _Modifiable["default"](this.original, true), radix);
case 2:
case "end":
@ -2205,7 +2207,7 @@ var _default = _IUI.IUI.module( /*#__PURE__*/function (_IUIElement) {
}, _callee2, this);
}));
function setData(_x) {
function setData(_x, _x2) {
return _setData.apply(this, arguments);
}
@ -2910,8 +2912,19 @@ var _default = _IUI.IUI.module( /*#__PURE__*/function (_IUIElement) {
if (this.children.length > 0) this._repeatNode = this.children[0].cloneNode(true);else {
this._repeatNode = document.createElement("div");
if (this.childNodes.length > 0 && this.childNodes[0].data.trim() != "") this._repeatNode.innerHTML = this.childNodes[0].data.trim();
} // keep script
var toBeRemoved = [];
for (var i = 0; i < this.childNodes.length; i++) {
if (this.childNodes[i].tagName != "SCRIPT") toBeRemoved.push(this.childNodes[i]);
}
this.innerHTML = "";
for (var _i = 0; _i < toBeRemoved.length; _i++) {
this.removeChild(toBeRemoved[_i]);
} //this.innerHTML = "";
this._container = this;
} // var newElements = this.querySelectorAll("*");
// for (var i = 0; i < newElements.length; i++)
@ -2965,7 +2978,7 @@ var _default = _IUI.IUI.module( /*#__PURE__*/function (_IUIElement) {
}, {
key: "setData",
value: function () {
var _setData = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(value) {
var _setData = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(value, radix) {
var _value;
var i, _this$__i_bindings2, _this$__i_bindings2$s, _this$__i_bindings2$s2, el, _this$__i_bindings;
@ -2989,7 +3002,7 @@ var _default = _IUI.IUI.module( /*#__PURE__*/function (_IUIElement) {
if (((_value = value) === null || _value === void 0 ? void 0 : _value.toArray) instanceof Function) value = value.toArray();else if (value == null || !(value instanceof Array || value instanceof Int32Array)) value = []; //debugger;
_context.next = 8;
return _get(_getPrototypeOf(Repeat.prototype), "setData", this).call(this, value);
return _get(_getPrototypeOf(Repeat.prototype), "setData", this).call(this, value, radix);
case 8:
i = 0;
@ -3040,7 +3053,7 @@ var _default = _IUI.IUI.module( /*#__PURE__*/function (_IUIElement) {
}
_context.next = 29;
return el.dataMap.render(value[i]);
return el.dataMap.render(value[i], radix);
case 29:
if (_context.sent) {
@ -3054,7 +3067,7 @@ var _default = _IUI.IUI.module( /*#__PURE__*/function (_IUIElement) {
case 32:
_context.next = 34;
return el.setData(value[i]);
return el.setData(value[i], radix);
case 34:
_context.next = 44;
@ -3067,7 +3080,7 @@ var _default = _IUI.IUI.module( /*#__PURE__*/function (_IUIElement) {
}
_context.next = 39;
return el.dataMap.render(value[i]);
return el.dataMap.render(value[i], radix);
case 39:
_context.next = 42;
@ -3078,7 +3091,7 @@ var _default = _IUI.IUI.module( /*#__PURE__*/function (_IUIElement) {
case 42:
_context.next = 44;
return _IUI.IUI.render(el, el.data, false);
return _IUI.IUI.render(el, el.data, false, value[i]);
case 44:
i++;
@ -3102,7 +3115,7 @@ var _default = _IUI.IUI.module( /*#__PURE__*/function (_IUIElement) {
}, _callee, this, [[12, 18]]);
}));
function setData(_x) {
function setData(_x, _x2) {
return _setData.apply(this, arguments);
}
@ -3365,14 +3378,14 @@ var _default = _IUI.IUI.module( /*#__PURE__*/function (_IUIElement) {
_createClass(Route, [{
key: "setData",
value: function () {
var _setData = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(value) {
var _setData = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(value, radix) {
return regeneratorRuntime.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
if (this.hasAttribute("debug")) debugger;
_context.next = 3;
return _get(_getPrototypeOf(Route.prototype), "setData", this).call(this, value);
return _get(_getPrototypeOf(Route.prototype), "setData", this).call(this, value, radix);
case 3:
return _context.abrupt("return", _context.sent);
@ -3385,7 +3398,7 @@ var _default = _IUI.IUI.module( /*#__PURE__*/function (_IUIElement) {
}, _callee, this);
}));
function setData(_x) {
function setData(_x, _x2) {
return _setData.apply(this, arguments);
}
@ -4494,13 +4507,13 @@ var _default = _IUI.IUI.module( /*#__PURE__*/function (_IUIElement) {
}, {
key: "setData",
value: function () {
var _setData = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(value) {
var _setData = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(value, radix) {
return regeneratorRuntime.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
_context.next = 2;
return _get(_getPrototypeOf(Check.prototype), "setData", this).call(this, value);
return _get(_getPrototypeOf(Check.prototype), "setData", this).call(this, value, radix);
case 2:
if (value != null && this.field != null) this.value = value[this.field];else if (this.field != null) this.value = null;
@ -4513,7 +4526,7 @@ var _default = _IUI.IUI.module( /*#__PURE__*/function (_IUIElement) {
}, _callee, this);
}));
function setData(_x) {
function setData(_x, _x2) {
return _setData.apply(this, arguments);
}
@ -5072,19 +5085,15 @@ var _default = _IUI.IUI.module( /*#__PURE__*/function (_IUIElement) {
}, {
key: "setData",
value: function () {
var _setData = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(value) {
var _setData = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(value, radix) {
return regeneratorRuntime.wrap(function _callee2$(_context2) {
while (1) {
switch (_context2.prev = _context2.next) {
case 0:
_context2.next = 2;
return _get(_getPrototypeOf(DateTimePicker.prototype), "setData", this).call(this, value);
return _get(_getPrototypeOf(DateTimePicker.prototype), "setData", this).call(this, value, radix);
case 2:
this.value = value;
if (this.isAuto) this.revert();
case 4:
case "end":
return _context2.stop();
}
@ -5092,7 +5101,7 @@ var _default = _IUI.IUI.module( /*#__PURE__*/function (_IUIElement) {
}, _callee2, this);
}));
function setData(_x) {
function setData(_x, _x2) {
return _setData.apply(this, arguments);
}
@ -5601,17 +5610,17 @@ var _default = _IUI.IUI.module( /*#__PURE__*/function (_IUIElement) {
}, {
key: "setData",
value: function () {
var _setData = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(value) {
var _setData = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(value, radix) {
return regeneratorRuntime.wrap(function _callee2$(_context2) {
while (1) {
switch (_context2.prev = _context2.next) {
case 0:
_context2.next = 2;
return _get(_getPrototypeOf(DropDown.prototype), "setData", this).call(this, value);
return _get(_getPrototypeOf(DropDown.prototype), "setData", this).call(this, value, radix);
case 2:
_context2.next = 4;
return this.menu.setData(value);
return this.menu.setData(value, radix);
case 4:
case "end":
@ -5621,7 +5630,7 @@ var _default = _IUI.IUI.module( /*#__PURE__*/function (_IUIElement) {
}, _callee2, this);
}));
function setData(_x) {
function setData(_x, _x2) {
return _setData.apply(this, arguments);
}
@ -6146,13 +6155,13 @@ var _default = _IUI.IUI.module( /*#__PURE__*/function (_IUIElement) {
}, {
key: "setData",
value: function () {
var _setData = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(value) {
var _setData = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(value, radix) {
return regeneratorRuntime.wrap(function _callee2$(_context2) {
while (1) {
switch (_context2.prev = _context2.next) {
case 0:
_context2.next = 2;
return _get(_getPrototypeOf(Input.prototype), "setData", this).call(this, value);
return _get(_getPrototypeOf(Input.prototype), "setData", this).call(this, value, radix);
case 2:
if (this.type == "checkbox") this._input.checked = value;else if (this.type == "date") {
@ -6178,7 +6187,7 @@ var _default = _IUI.IUI.module( /*#__PURE__*/function (_IUIElement) {
}, _callee2, this);
}));
function setData(_x3) {
function setData(_x3, _x4) {
return _setData.apply(this, arguments);
}
@ -7578,13 +7587,13 @@ var _default = _IUI.IUI.module( /*#__PURE__*/function (_IUIElement) {
}, {
key: "setData",
value: function () {
var _setData = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee4(value) {
var _setData = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee4(value, radix) {
return regeneratorRuntime.wrap(function _callee4$(_context4) {
while (1) {
switch (_context4.prev = _context4.next) {
case 0:
_context4.next = 2;
return _get(_getPrototypeOf(Select.prototype), "setData", this).call(this, value);
return _get(_getPrototypeOf(Select.prototype), "setData", this).call(this, value, radix);
case 2:
try {
@ -7611,7 +7620,7 @@ var _default = _IUI.IUI.module( /*#__PURE__*/function (_IUIElement) {
}, _callee4, this);
}));
function setData(_x2) {
function setData(_x2, _x3) {
return _setData.apply(this, arguments);
}
@ -8952,14 +8961,14 @@ var _default = _IUI.IUI.module( /*#__PURE__*/function (_IUIElement) {
}, {
key: "setData",
value: function () {
var _setData = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(value) {
var _setData = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(value, radix) {
var self, loadFunction, i;
return regeneratorRuntime.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
_context.next = 2;
return _get(_getPrototypeOf(Table.prototype), "setData", this).call(this, value);
return _get(_getPrototypeOf(Table.prototype), "setData", this).call(this, value, radix);
case 2:
this.clear();
@ -8999,7 +9008,7 @@ var _default = _IUI.IUI.module( /*#__PURE__*/function (_IUIElement) {
}, _callee, this);
}));
function setData(_x) {
function setData(_x, _x2) {
return _setData.apply(this, arguments);
}