simple-boot-front
Advanced tools
Comparing version 1.0.77 to 1.0.78
@@ -24,5 +24,9 @@ "use strict"; | ||
return function (target) { | ||
if (config === null || config === void 0 ? void 0 : config.selector) { | ||
exports.componentSelectors.set(config === null || config === void 0 ? void 0 : config.selector, target); | ||
if (!config) { | ||
config = {}; | ||
} | ||
if (!config.selector) { | ||
config.selector = target.name; | ||
} | ||
exports.componentSelectors.set(config.selector.toLowerCase(), target); | ||
ReflectUtils_1.ReflectUtils.defineMetadata(exports.ComponentMetadataKey, config, target); | ||
@@ -29,0 +33,0 @@ return (function (_super) { |
{ | ||
"name": "simple-boot-front", | ||
"version": "1.0.77", | ||
"version": "1.0.78", | ||
"main": "SimpleApplication.js", | ||
@@ -78,6 +78,6 @@ "license": "MIT", | ||
"dependencies": { | ||
"dom-render": "^1.0.40", | ||
"dom-render": "^1.0.42", | ||
"reflect-metadata": "^0.1.13", | ||
"simple-boot-core": "^1.0.20" | ||
"simple-boot-core": "^1.0.21" | ||
} | ||
} |
@@ -29,7 +29,3 @@ ![Single Page Application Framworks](assets/banner.png) | ||
## [😃 examples project](./examples) | ||
* #### [parcel-bundler](./examples/parcel-bundler) | ||
* #### [parcel-bundler-js](./examples/parcel-bundler-js) (js version) | ||
* #### [webpack](./examples/parcel-bundler) | ||
* Here is a quick teaser of a complete simple-boot-front application in typescript | ||
@@ -36,0 +32,0 @@ * index.ts |
@@ -9,3 +9,3 @@ import { SimFrontOption } from './option/SimFrontOption'; | ||
import { RouterManager } from 'simple-boot-core/route/RouterManager'; | ||
import { TargetElement, TargetAttr } from 'dom-render/Config'; | ||
import { Config, TargetElement, TargetAttr } from 'dom-render/Config'; | ||
export declare class SimpleBootFront extends SimpleApplication { | ||
@@ -18,2 +18,3 @@ rootRouter: ConstructorType<any>; | ||
domRenderTargetAttrs: TargetAttr[]; | ||
domRenderConfig: Config; | ||
constructor(rootRouter: ConstructorType<any>, option: SimFrontOption); | ||
@@ -24,2 +25,3 @@ getComponentInnerHtml(targetObj: any): string; | ||
private afterSetting; | ||
resetDomrenderScripts(): void; | ||
} |
@@ -57,2 +57,3 @@ "use strict"; | ||
var Component_1 = require("./decorators/Component"); | ||
var Script_1 = require("./decorators/Script"); | ||
var DomRender_1 = require("dom-render/DomRender"); | ||
@@ -80,2 +81,23 @@ var SimAtomic_1 = require("simple-boot-core/simstance/SimAtomic"); | ||
_this.domRenderTargetAttrs = []; | ||
_this.domRenderConfig = { | ||
targetElements: _this.domRenderTargetElements, | ||
targetAttrs: _this.domRenderTargetAttrs, | ||
onAttrInit: function (attrName, attrValue, obj) { | ||
var _a, _b; | ||
if (attrName === 'component') { | ||
var bindObj = ScriptUtils_1.ScriptUtils.evalReturn(attrValue, obj); | ||
(_b = (_a = bindObj) === null || _a === void 0 ? void 0 : _a.onInit) === null || _b === void 0 ? void 0 : _b.call(_a); | ||
} | ||
}, | ||
scripts: { 'application': _this }, | ||
applyEvents: [{ | ||
attrName: 'router-link', callBack: function (elements, attrValue, obj) { | ||
elements.addEventListener('click', function (event) { | ||
var _a; | ||
(_a = (0, SimGlobal_1.SimGlobal)().application.simstanceManager.getOrNewSim(Navigation_1.Navigation)) === null || _a === void 0 ? void 0 : _a.go(attrValue); | ||
}); | ||
} | ||
}], | ||
proxyExcludeTyps: _this.domRendoerExcludeProxy | ||
}; | ||
window.__dirname = 'simple-boot-front__dirname'; | ||
@@ -141,22 +163,3 @@ var selectors = Component_1.componentSelectors; | ||
if (component && typeof obj === 'object') { | ||
return DomRender_1.DomRender.run(obj, undefined, { | ||
targetElements: this.domRenderTargetElements, | ||
targetAttrs: this.domRenderTargetAttrs, | ||
onAttrInit: function (attrName, attrValue, obj) { | ||
var _a, _b; | ||
if (attrName === 'component') { | ||
var bindObj = ScriptUtils_1.ScriptUtils.evalReturn(attrValue, obj); | ||
(_b = (_a = bindObj) === null || _a === void 0 ? void 0 : _a.onInit) === null || _b === void 0 ? void 0 : _b.call(_a); | ||
} | ||
}, | ||
applyEvents: [{ | ||
attrName: 'router-link', callBack: function (elements, attrValue, obj) { | ||
elements.addEventListener('click', function (event) { | ||
var _a; | ||
(_a = (0, SimGlobal_1.SimGlobal)().application.simstanceManager.getOrNewSim(Navigation_1.Navigation)) === null || _a === void 0 ? void 0 : _a.go(attrValue); | ||
}); | ||
} | ||
}], | ||
proxyExcludeTyps: this.domRendoerExcludeProxy | ||
}); | ||
return DomRender_1.DomRender.run(obj, undefined, this.domRenderConfig); | ||
} | ||
@@ -169,2 +172,3 @@ return obj; | ||
_super.prototype.run.call(this); | ||
this.resetDomrenderScripts(); | ||
this.navigation = this.simstanceManager.getOrNewSim(Navigation_1.Navigation); | ||
@@ -232,4 +236,29 @@ var routerAtomic = new SimAtomic_1.SimAtomic(this.rootRouter); | ||
}; | ||
SimpleBootFront.prototype.resetDomrenderScripts = function () { | ||
var _this = this; | ||
var simstanceManager = this.simstanceManager; | ||
Script_1.scripts.forEach(function (val, name) { | ||
_this.domRenderConfig.scripts[name] = function () { | ||
var args = []; | ||
for (var _i = 0; _i < arguments.length; _i++) { | ||
args[_i] = arguments[_i]; | ||
} | ||
console.log(simstanceManager); | ||
var obj = undefined; | ||
try { | ||
obj = simstanceManager.getOrNewSim(val); | ||
} | ||
catch (e) { | ||
console.log('eee'); | ||
obj = simstanceManager.newSim(val); | ||
} | ||
var render = this.__render; | ||
var scriptRunnable = obj; | ||
scriptRunnable.rawSets.set(render.rawset, this); | ||
return scriptRunnable.run.apply(scriptRunnable, args); | ||
}; | ||
}); | ||
}; | ||
return SimpleBootFront; | ||
}(SimpleApplication_1.SimpleApplication)); | ||
exports.SimpleBootFront = SimpleBootFront; |
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
53411
38
979
249
Updateddom-render@^1.0.42
Updatedsimple-boot-core@^1.0.21