mirror of
https://github.com/esiur/iui.git
synced 2025-05-06 06:42:58 +00:00
includeThisElement
This commit is contained in:
parent
8070c96095
commit
e6b3023406
72
build/iui.js
72
build/iui.js
@ -830,39 +830,53 @@ var IUI = /*#__PURE__*/function () {
|
|||||||
key: "created",
|
key: "created",
|
||||||
value: function () {
|
value: function () {
|
||||||
var _created = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(element) {
|
var _created = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(element) {
|
||||||
var i, e;
|
var includeThisElement,
|
||||||
|
i,
|
||||||
|
e,
|
||||||
|
_args2 = arguments;
|
||||||
return regeneratorRuntime.wrap(function _callee2$(_context2) {
|
return regeneratorRuntime.wrap(function _callee2$(_context2) {
|
||||||
while (1) {
|
while (1) {
|
||||||
switch (_context2.prev = _context2.next) {
|
switch (_context2.prev = _context2.next) {
|
||||||
case 0:
|
case 0:
|
||||||
|
includeThisElement = _args2.length > 1 && _args2[1] !== undefined ? _args2[1] : false;
|
||||||
|
|
||||||
|
if (!(includeThisElement && element instanceof _IUIElement["default"])) {
|
||||||
|
_context2.next = 4;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
_context2.next = 4;
|
||||||
|
return element.created();
|
||||||
|
|
||||||
|
case 4:
|
||||||
i = 0;
|
i = 0;
|
||||||
|
|
||||||
case 1:
|
case 5:
|
||||||
if (!(i < element.children.length)) {
|
if (!(i < element.children.length)) {
|
||||||
_context2.next = 11;
|
_context2.next = 15;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
e = element.children[i];
|
e = element.children[i];
|
||||||
|
|
||||||
if (!(e instanceof _IUIElement["default"])) {
|
if (!(e instanceof _IUIElement["default"])) {
|
||||||
_context2.next = 6;
|
_context2.next = 10;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
_context2.next = 6;
|
_context2.next = 10;
|
||||||
return e.created();
|
return e.created();
|
||||||
|
|
||||||
case 6:
|
case 10:
|
||||||
_context2.next = 8;
|
_context2.next = 12;
|
||||||
return IUI.created(e);
|
return IUI.created(e);
|
||||||
|
|
||||||
case 8:
|
case 12:
|
||||||
i++;
|
i++;
|
||||||
_context2.next = 1;
|
_context2.next = 5;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 11:
|
case 15:
|
||||||
case "end":
|
case "end":
|
||||||
return _context2.stop();
|
return _context2.stop();
|
||||||
}
|
}
|
||||||
@ -880,39 +894,53 @@ var IUI = /*#__PURE__*/function () {
|
|||||||
key: "create",
|
key: "create",
|
||||||
value: function () {
|
value: function () {
|
||||||
var _create = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee3(element) {
|
var _create = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee3(element) {
|
||||||
var i, e;
|
var includeThisElement,
|
||||||
|
i,
|
||||||
|
e,
|
||||||
|
_args3 = arguments;
|
||||||
return regeneratorRuntime.wrap(function _callee3$(_context3) {
|
return regeneratorRuntime.wrap(function _callee3$(_context3) {
|
||||||
while (1) {
|
while (1) {
|
||||||
switch (_context3.prev = _context3.next) {
|
switch (_context3.prev = _context3.next) {
|
||||||
case 0:
|
case 0:
|
||||||
|
includeThisElement = _args3.length > 1 && _args3[1] !== undefined ? _args3[1] : false;
|
||||||
|
|
||||||
|
if (!(includeThisElement && element instanceof _IUIElement["default"])) {
|
||||||
|
_context3.next = 4;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
_context3.next = 4;
|
||||||
|
return element.create();
|
||||||
|
|
||||||
|
case 4:
|
||||||
i = 0;
|
i = 0;
|
||||||
|
|
||||||
case 1:
|
case 5:
|
||||||
if (!(i < element.children.length)) {
|
if (!(i < element.children.length)) {
|
||||||
_context3.next = 11;
|
_context3.next = 15;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
e = element.children[i];
|
e = element.children[i];
|
||||||
|
|
||||||
if (!(e instanceof _IUIElement["default"])) {
|
if (!(e instanceof _IUIElement["default"])) {
|
||||||
_context3.next = 6;
|
_context3.next = 10;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
_context3.next = 6;
|
_context3.next = 10;
|
||||||
return e.create();
|
return e.create();
|
||||||
|
|
||||||
case 6:
|
case 10:
|
||||||
_context3.next = 8;
|
_context3.next = 12;
|
||||||
return IUI.create(e);
|
return IUI.create(e);
|
||||||
|
|
||||||
case 8:
|
case 12:
|
||||||
i++;
|
i++;
|
||||||
_context3.next = 1;
|
_context3.next = 5;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 11:
|
case 15:
|
||||||
case "end":
|
case "end":
|
||||||
return _context3.stop();
|
return _context3.stop();
|
||||||
}
|
}
|
||||||
@ -2976,7 +3004,7 @@ var _default = _IUI.IUI.module( /*#__PURE__*/function (_IUIElement) {
|
|||||||
this.list.push(el);
|
this.list.push(el);
|
||||||
_context.prev = 12;
|
_context.prev = 12;
|
||||||
_context.next = 15;
|
_context.next = 15;
|
||||||
return _IUI.IUI.create(el);
|
return _IUI.IUI.create(el, true);
|
||||||
|
|
||||||
case 15:
|
case 15:
|
||||||
_IUI.IUI.bind(el, false, "repeat", _IUI.IUI.extend((_this$__i_bindings = this.__i_bindings) === null || _this$__i_bindings === void 0 ? void 0 : _this$__i_bindings.scope, {
|
_IUI.IUI.bind(el, false, "repeat", _IUI.IUI.extend((_this$__i_bindings = this.__i_bindings) === null || _this$__i_bindings === void 0 ? void 0 : _this$__i_bindings.scope, {
|
||||||
@ -2998,7 +3026,7 @@ var _default = _IUI.IUI.module( /*#__PURE__*/function (_IUIElement) {
|
|||||||
|
|
||||||
(_this$__i_bindings2 = this.__i_bindings) === null || _this$__i_bindings2 === void 0 ? void 0 : (_this$__i_bindings2$s = _this$__i_bindings2.scope) === null || _this$__i_bindings2$s === void 0 ? void 0 : (_this$__i_bindings2$s2 = _this$__i_bindings2$s.refs) === null || _this$__i_bindings2$s2 === void 0 ? void 0 : _this$__i_bindings2$s2._build();
|
(_this$__i_bindings2 = this.__i_bindings) === null || _this$__i_bindings2 === void 0 ? void 0 : (_this$__i_bindings2$s = _this$__i_bindings2.scope) === null || _this$__i_bindings2$s === void 0 ? void 0 : (_this$__i_bindings2$s2 = _this$__i_bindings2$s.refs) === null || _this$__i_bindings2$s2 === void 0 ? void 0 : _this$__i_bindings2$s2._build();
|
||||||
_context.next = 25;
|
_context.next = 25;
|
||||||
return _IUI.IUI.created(el);
|
return _IUI.IUI.created(el, true);
|
||||||
|
|
||||||
case 25:
|
case 25:
|
||||||
if (!(el instanceof _IUIElement2["default"])) {
|
if (!(el instanceof _IUIElement2["default"])) {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@esiur/iui",
|
"name": "@esiur/iui",
|
||||||
"version": "1.2.3",
|
"version": "1.2.4",
|
||||||
"description": "Interactive User Interface",
|
"description": "Interactive User Interface",
|
||||||
"main": "iui.js",
|
"main": "iui.js",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
|
@ -44,7 +44,12 @@ export class IUI {
|
|||||||
}, { threshold: [0] });
|
}, { threshold: [0] });
|
||||||
|
|
||||||
|
|
||||||
static async created (element) {
|
static async created(element, includeThisElement = false) {
|
||||||
|
|
||||||
|
// @TODO: this should grow from root to leef
|
||||||
|
if (includeThisElement && element instanceof IUIElement) {
|
||||||
|
await element.created();
|
||||||
|
}
|
||||||
|
|
||||||
for (var i = 0; i < element.children.length; i++) {
|
for (var i = 0; i < element.children.length; i++) {
|
||||||
let e = element.children[i];
|
let e = element.children[i];
|
||||||
@ -52,11 +57,16 @@ export class IUI {
|
|||||||
await e.created();
|
await e.created();
|
||||||
await IUI.created(e);
|
await IUI.created(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static async create(element)
|
static async create(element, includeThisElement = false)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
if (includeThisElement && element instanceof IUIElement) {
|
||||||
|
await element.create();
|
||||||
|
}
|
||||||
|
|
||||||
for (let i = 0; i < element.children.length; i++) {
|
for (let i = 0; i < element.children.length; i++) {
|
||||||
let e = element.children[i];
|
let e = element.children[i];
|
||||||
if (e instanceof IUIElement) {
|
if (e instanceof IUIElement) {
|
||||||
|
@ -145,7 +145,7 @@ export default IUI.module(class Repeat extends IUIElement
|
|||||||
this.list.push(el);
|
this.list.push(el);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await IUI.create(el);
|
await IUI.create(el, true);
|
||||||
|
|
||||||
IUI.bind(el, false, "repeat",
|
IUI.bind(el, false, "repeat",
|
||||||
IUI.extend(this.__i_bindings?.scope,
|
IUI.extend(this.__i_bindings?.scope,
|
||||||
@ -160,7 +160,7 @@ export default IUI.module(class Repeat extends IUIElement
|
|||||||
// update referencing
|
// update referencing
|
||||||
this.__i_bindings?.scope?.refs?._build();
|
this.__i_bindings?.scope?.refs?._build();
|
||||||
|
|
||||||
await IUI.created(el);
|
await IUI.created(el, true);
|
||||||
|
|
||||||
if (el instanceof IUIElement){
|
if (el instanceof IUIElement){
|
||||||
// @TODO should check if the element depends on parent or not
|
// @TODO should check if the element depends on parent or not
|
||||||
|
Loading…
x
Reference in New Issue
Block a user