simple-boot-front
Advanced tools
Comparing version 1.0.112 to 1.0.113
@@ -10,3 +10,4 @@ import { ConstructorType, GenericClassDecorator } from 'simple-boot-core/types/Types'; | ||
export declare const ComponentMetadataKey: unique symbol; | ||
export declare const Component: (config?: ComponentConfig | undefined) => GenericClassDecorator<ConstructorType<any>>; | ||
export declare function Component(target: ConstructorType<any>): void; | ||
export declare function Component(config: ComponentConfig): GenericClassDecorator<ConstructorType<any>>; | ||
export declare const getComponent: (target: ConstructorType<any> | Function | any) => ComponentConfig | undefined; |
@@ -7,14 +7,19 @@ "use strict"; | ||
exports.ComponentMetadataKey = Symbol('Component'); | ||
var Component = function (config) { | ||
return function (target) { | ||
if (!config) { | ||
config = {}; | ||
} | ||
if (!config.selector) { | ||
config.selector = target.name; | ||
} | ||
ReflectUtils_1.ReflectUtils.defineMetadata(exports.ComponentMetadataKey, config, target); | ||
exports.componentSelectors.set(config.selector.toLowerCase(), target); | ||
}; | ||
var componentProcess = function (config, target) { | ||
if (!config.selector) { | ||
config.selector = target.name.toLowerCase(); | ||
} | ||
ReflectUtils_1.ReflectUtils.defineMetadata(exports.ComponentMetadataKey, config, target); | ||
exports.componentSelectors.set(config.selector.toLowerCase(), target); | ||
}; | ||
function Component(configOrTarget) { | ||
if (typeof configOrTarget === 'function') { | ||
componentProcess({}, configOrTarget); | ||
} | ||
else { | ||
return function (target) { | ||
componentProcess(configOrTarget, target); | ||
}; | ||
} | ||
} | ||
exports.Component = Component; | ||
@@ -21,0 +26,0 @@ var getComponent = function (target) { |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.InjectFrontSituationType = void 0; | ||
var InjectFrontSituationType; | ||
(function (InjectFrontSituationType) { | ||
InjectFrontSituationType["OPENER"] = "SIMPLE_BOOT_FRONT://OPENER"; | ||
})(InjectFrontSituationType = exports.InjectFrontSituationType || (exports.InjectFrontSituationType = {})); |
{ | ||
"name": "simple-boot-front", | ||
"version": "1.0.112", | ||
"version": "1.0.113", | ||
"main": "SimpleApplication.js", | ||
@@ -75,5 +75,5 @@ "license": "MIT", | ||
"dependencies": { | ||
"dom-render": "^1.0.89", | ||
"simple-boot-core": "^1.0.34" | ||
"dom-render": "^1.0.90", | ||
"simple-boot-core": "^1.0.35" | ||
} | ||
} |
@@ -77,7 +77,4 @@ "use strict"; | ||
var RouterManager_1 = require("simple-boot-core/route/RouterManager"); | ||
var ScriptUtils_1 = require("dom-render/utils/script/ScriptUtils"); | ||
var RawSet_1 = require("dom-render/rawsets/RawSet"); | ||
var RawSetType_1 = require("dom-render/rawsets/RawSetType"); | ||
var Types_1 = require("dom-render/types/Types"); | ||
var InjectFrontSituationType_1 = require("./decorators/inject/InjectFrontSituationType"); | ||
var SimpleBootFront = (function (_super) { | ||
@@ -98,35 +95,4 @@ __extends(SimpleBootFront, _super); | ||
onElementInit: function (name, obj, rawSet, targetElement) { | ||
var _a, _b, _c; | ||
var target = (_a = targetElement === null || targetElement === void 0 ? void 0 : targetElement.__render) === null || _a === void 0 ? void 0 : _a.component; | ||
var targetKey = 'onInit'; | ||
var firstCheckMaker = [function (ownerObj, type, idx, saveInjectionConfig) { | ||
if (InjectFrontSituationType_1.InjectFrontSituationType.OPENER === (saveInjectionConfig === null || saveInjectionConfig === void 0 ? void 0 : saveInjectionConfig.config.situationType) && rawSet.point.thisVariableName) { | ||
return new Proxy(ScriptUtils_1.ScriptUtils.evalReturn(rawSet.point.thisVariableName, obj), new Types_1.DomRenderFinalProxy()); | ||
} | ||
}]; | ||
if (rawSet.point.thisVariableName) { | ||
(_b = target === null || target === void 0 ? void 0 : target.onInit) === null || _b === void 0 ? void 0 : _b.call.apply(_b, __spreadArray([target], _this.simstanceManager.getParameterSim({ target: target, targetKey: targetKey, firstCheckMaker: firstCheckMaker }), false)); | ||
} | ||
else { | ||
(_c = target === null || target === void 0 ? void 0 : target.onInit) === null || _c === void 0 ? void 0 : _c.call.apply(_c, __spreadArray([target], _this.simstanceManager.getParameterSim({ target: target, targetKey: targetKey, firstCheckMaker: firstCheckMaker }), false)); | ||
} | ||
}, | ||
onAttrInit: function (attrName, attrValue, obj, rawSet) { | ||
var _a, _b; | ||
if (attrName === 'component') { | ||
var target_1 = ScriptUtils_1.ScriptUtils.evalReturn(attrValue, obj); | ||
var targetKey = 'onInit'; | ||
var firstCheckMaker = [function (obj, type, idx, saveInjectionConfig) { | ||
var _a, _b; | ||
if (InjectFrontSituationType_1.InjectFrontSituationType.OPENER === (saveInjectionConfig === null || saveInjectionConfig === void 0 ? void 0 : saveInjectionConfig.config.situationType) && ((_a = target_1 === null || target_1 === void 0 ? void 0 : target_1.__domrender_component_new) === null || _a === void 0 ? void 0 : _a.creator)) { | ||
return (_b = target_1 === null || target_1 === void 0 ? void 0 : target_1.__domrender_component_new) === null || _b === void 0 ? void 0 : _b.creator; | ||
} | ||
}]; | ||
if (rawSet.point.thisVariableName) { | ||
(_a = target_1 === null || target_1 === void 0 ? void 0 : target_1.onInit) === null || _a === void 0 ? void 0 : _a.call.apply(_a, __spreadArray([target_1], _this.simstanceManager.getParameterSim({ target: target_1, targetKey: targetKey, firstCheckMaker: firstCheckMaker }), false)); | ||
} | ||
else { | ||
(_b = target_1 === null || target_1 === void 0 ? void 0 : target_1.onInit) === null || _b === void 0 ? void 0 : _b.call.apply(_b, __spreadArray([target_1], _this.simstanceManager.getParameterSim({ target: target_1, targetKey: targetKey, firstCheckMaker: firstCheckMaker }), false)); | ||
} | ||
} | ||
}, | ||
@@ -146,16 +112,2 @@ scripts: { application: _this }, | ||
_this.option.window.__dirname = 'simple-boot-front__dirname'; | ||
var targetAttribute = RawSet_1.RawSet.createComponentTargetAttribute('component', function (element, attrValue, obj, rawSet) { | ||
return ScriptUtils_1.ScriptUtils.eval("return ".concat(attrValue), obj); | ||
}, function (element, attrValue, obj, rawSet) { | ||
if (attrValue) { | ||
var targetObj = ScriptUtils_1.ScriptUtils.eval("return ".concat(attrValue), obj); | ||
var n = element.cloneNode(true); | ||
var innerHTML = _this.getComponentInnerHtml(targetObj, rawSet.uuid); | ||
n.innerHTML = innerHTML; | ||
return RawSet_1.RawSet.drThisCreate(rawSet, n, attrValue, '', true, obj, _this.option); | ||
} | ||
var fag = _this.option.window.document.createDocumentFragment(); | ||
return fag; | ||
}); | ||
_this.domRenderTargetAttrs.push(targetAttribute); | ||
option.proxy = { | ||
@@ -329,4 +281,10 @@ onProxy: function (it) { return _this.createDomRender(it); } | ||
var component = (0, Component_1.getComponent)(val); | ||
var items = RawSet_1.RawSet.createComponentTargetElement(name, function (e, obj, r) { | ||
var newSim = _this.simstanceManager.newSim(val); | ||
var items = RawSet_1.RawSet.createComponentTargetElement(name, function (e, obj, r, counstructorParam) { | ||
var newSim; | ||
if (counstructorParam === null || counstructorParam === void 0 ? void 0 : counstructorParam.length) { | ||
newSim = new (val.bind.apply(val, __spreadArray([void 0], counstructorParam, false)))(); | ||
} | ||
else { | ||
newSim = _this.simstanceManager.newSim(val); | ||
} | ||
return newSim; | ||
@@ -333,0 +291,0 @@ }, component === null || component === void 0 ? void 0 : component.template, component === null || component === void 0 ? void 0 : component.styles); |
50
64534
1192
Updateddom-render@^1.0.90
Updatedsimple-boot-core@^1.0.35