dom-render
Advanced tools
Comparing version 1.0.63 to 1.0.64
import { ConstructorType } from './types/Types'; | ||
import { RawSet } from './RawSet'; | ||
import { RawSet, Render } from './RawSet'; | ||
export declare type TargetElement = { | ||
@@ -9,2 +9,3 @@ name: string; | ||
complete?: (target: Element, obj: any, rawSet: RawSet) => void; | ||
__render?: Render; | ||
}; | ||
@@ -19,3 +20,3 @@ export declare type TargetAttr = { | ||
targetAttrs?: TargetAttr[]; | ||
onElementInit?: (name: string, obj: any, rawSet: RawSet) => void; | ||
onElementInit?: (name: string, obj: any, rawSet: RawSet, targetElement: TargetElement) => void; | ||
onAttrInit?: (name: string, attrValue: string, obj: any, rawSet: RawSet) => void; | ||
@@ -22,0 +23,0 @@ proxyExcludeTyps?: ConstructorType<any>[]; |
import { ConstructorType } from './types/Types'; | ||
import { RawSet } from './RawSet'; | ||
import { RawSet, Render } from './RawSet'; | ||
export declare type TargetElement = { | ||
@@ -9,2 +9,3 @@ name: string; | ||
complete?: (target: Element, obj: any, rawSet: RawSet) => void; | ||
__render?: Render; | ||
}; | ||
@@ -19,3 +20,3 @@ export declare type TargetAttr = { | ||
targetAttrs?: TargetAttr[]; | ||
onElementInit?: (name: string, obj: any, rawSet: RawSet) => void; | ||
onElementInit?: (name: string, obj: any, rawSet: RawSet, targetElement: TargetElement) => void; | ||
onAttrInit?: (name: string, attrValue: string, obj: any, rawSet: RawSet) => void; | ||
@@ -22,0 +23,0 @@ proxyExcludeTyps?: ConstructorType<any>[]; |
@@ -66,3 +66,3 @@ import { Config, TargetElement } from './Config'; | ||
[n: string]: any; | ||
}): TargetElement; | ||
}, complete?: (element: Element, obj: any, rawSet: RawSet) => void): TargetElement; | ||
static exporesionGrouops(data: string): RegExpExecArray[]; | ||
@@ -69,0 +69,0 @@ } |
{ | ||
"name": "dom-render", | ||
"version": "1.0.63", | ||
"version": "1.0.64", | ||
"main": "DomRender.js", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
@@ -66,3 +66,3 @@ import { Config, TargetElement } from './Config'; | ||
[n: string]: any; | ||
}): TargetElement; | ||
}, complete?: (element: Element, obj: any, rawSet: RawSet) => void): TargetElement; | ||
static exporesionGrouops(data: string): RegExpExecArray[]; | ||
@@ -69,0 +69,0 @@ } |
@@ -316,3 +316,4 @@ var __assign = (this && this.__assign) || function () { | ||
name: name, | ||
obj: obj | ||
obj: obj, | ||
targetElement: it | ||
}); | ||
@@ -358,3 +359,3 @@ (_b = it === null || it === void 0 ? void 0 : it.complete) === null || _b === void 0 ? void 0 : _b.call(it, element_2, obj, _this); | ||
}); | ||
onElementInitCallBack.forEach(function (it) { var _a; return (_a = config === null || config === void 0 ? void 0 : config.onElementInit) === null || _a === void 0 ? void 0 : _a.call(config, it.name, obj, _this); }); | ||
onElementInitCallBack.forEach(function (it) { var _a; return (_a = config === null || config === void 0 ? void 0 : config.onElementInit) === null || _a === void 0 ? void 0 : _a.call(config, it.name, obj, _this, it.targetElement); }); | ||
onAttrInitCallBack.forEach(function (it) { var _a; return (_a = config === null || config === void 0 ? void 0 : config.onAttrInit) === null || _a === void 0 ? void 0 : _a.call(config, it.attrName, it.attrValue, obj, _this); }); | ||
@@ -595,3 +596,3 @@ return raws; | ||
}; | ||
RawSet.createComponentTargetElement = function (name, objFactory, template, styles, scripts) { | ||
RawSet.createComponentTargetElement = function (name, objFactory, template, styles, scripts, complete) { | ||
if (template === void 0) { template = ''; } | ||
@@ -613,18 +614,21 @@ if (styles === void 0) { styles = []; } | ||
var instance = domrenderComponents[componentKey]; | ||
var attribute = {}; | ||
element.getAttributeNames().forEach(function (it) { | ||
attribute[it] = element.getAttribute(it); | ||
}); | ||
var render = Object.freeze({ | ||
component: instance, | ||
element: element, | ||
innerHTML: element.innerHTML, | ||
attribute: attribute, | ||
rawset: rawSet, | ||
componentKey: componentKey, | ||
scripts: RawSet.setBindProperty(scripts, obj) | ||
}); | ||
this.__render = render; | ||
var oninit = element.getAttribute('dr-on-init'); | ||
if (oninit) { | ||
var attribute_1 = {}; | ||
element.getAttributeNames().forEach(function (it) { | ||
attribute_1[it] = element.getAttribute(it); | ||
}); | ||
var script = "var $component = this.__render.component; var $element = this.__render.$element; var $innerHTML = this.__render.$innerHTML; var $attribute = this.__render.$attribute; " + oninit + " "; | ||
ScriptUtils.eval(script, Object.assign(obj, { | ||
__render: Object.freeze({ | ||
component: instance, | ||
element: element, | ||
innerHTML: element.innerHTML, | ||
attribute: attribute_1, | ||
rawset: rawSet, | ||
scripts: RawSet.setBindProperty(scripts, obj) | ||
}) | ||
__render: render | ||
})); | ||
@@ -637,3 +641,4 @@ } | ||
return fag; | ||
} | ||
}, | ||
complete: complete | ||
}; | ||
@@ -640,0 +645,0 @@ return targetElement; |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
322371
5947