simple-boot-front 1.0.112 → 1.0.113
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/SimpleBootFront.js +8 -50
- package/components/ComponentSet.d.ts +4 -0
- package/components/ComponentSet.js +36 -0
- package/decorators/Component.d.ts +2 -1
- package/decorators/Component.js +16 -11
- package/decorators/inject/InjectFrontSituationType.d.ts +0 -3
- package/decorators/inject/InjectFrontSituationType.js +0 -6
- package/package.json +3 -3
package/SimpleBootFront.js
CHANGED
@@ -74,11 +74,8 @@ var HttpService_1 = require("./service/HttpService");
|
|
74
74
|
var SimstanceManager_1 = require("simple-boot-core/simstance/SimstanceManager");
|
75
75
|
var IntentManager_1 = require("simple-boot-core/intent/IntentManager");
|
76
76
|
var RouterManager_1 = require("simple-boot-core/route/RouterManager");
|
77
|
-
var ScriptUtils_1 = require("dom-render/utils/script/ScriptUtils");
|
78
77
|
var RawSet_1 = require("dom-render/rawsets/RawSet");
|
79
78
|
var RawSetType_1 = require("dom-render/rawsets/RawSetType");
|
80
|
-
var Types_1 = require("dom-render/types/Types");
|
81
|
-
var InjectFrontSituationType_1 = require("./decorators/inject/InjectFrontSituationType");
|
82
79
|
var SimpleBootFront = (function (_super) {
|
83
80
|
__extends(SimpleBootFront, _super);
|
84
81
|
function SimpleBootFront(rootRouter, option) {
|
@@ -94,39 +91,8 @@ var SimpleBootFront = (function (_super) {
|
|
94
91
|
targetElements: _this.domRenderTargetElements,
|
95
92
|
targetAttrs: _this.domRenderTargetAttrs,
|
96
93
|
onElementInit: function (name, obj, rawSet, targetElement) {
|
97
|
-
var _a, _b, _c;
|
98
|
-
var target = (_a = targetElement === null || targetElement === void 0 ? void 0 : targetElement.__render) === null || _a === void 0 ? void 0 : _a.component;
|
99
|
-
var targetKey = 'onInit';
|
100
|
-
var firstCheckMaker = [function (ownerObj, type, idx, saveInjectionConfig) {
|
101
|
-
if (InjectFrontSituationType_1.InjectFrontSituationType.OPENER === (saveInjectionConfig === null || saveInjectionConfig === void 0 ? void 0 : saveInjectionConfig.config.situationType) && rawSet.point.thisVariableName) {
|
102
|
-
return new Proxy(ScriptUtils_1.ScriptUtils.evalReturn(rawSet.point.thisVariableName, obj), new Types_1.DomRenderFinalProxy());
|
103
|
-
}
|
104
|
-
}];
|
105
|
-
if (rawSet.point.thisVariableName) {
|
106
|
-
(_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));
|
107
|
-
}
|
108
|
-
else {
|
109
|
-
(_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));
|
110
|
-
}
|
111
94
|
},
|
112
95
|
onAttrInit: function (attrName, attrValue, obj, rawSet) {
|
113
|
-
var _a, _b;
|
114
|
-
if (attrName === 'component') {
|
115
|
-
var target_1 = ScriptUtils_1.ScriptUtils.evalReturn(attrValue, obj);
|
116
|
-
var targetKey = 'onInit';
|
117
|
-
var firstCheckMaker = [function (obj, type, idx, saveInjectionConfig) {
|
118
|
-
var _a, _b;
|
119
|
-
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)) {
|
120
|
-
return (_b = target_1 === null || target_1 === void 0 ? void 0 : target_1.__domrender_component_new) === null || _b === void 0 ? void 0 : _b.creator;
|
121
|
-
}
|
122
|
-
}];
|
123
|
-
if (rawSet.point.thisVariableName) {
|
124
|
-
(_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));
|
125
|
-
}
|
126
|
-
else {
|
127
|
-
(_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));
|
128
|
-
}
|
129
|
-
}
|
130
96
|
},
|
131
97
|
scripts: { application: _this },
|
132
98
|
applyEvents: [{
|
@@ -141,20 +107,6 @@ var SimpleBootFront = (function (_super) {
|
|
141
107
|
proxyExcludeTyps: _this.domRendoerExcludeProxy
|
142
108
|
};
|
143
109
|
_this.option.window.__dirname = 'simple-boot-front__dirname';
|
144
|
-
var targetAttribute = RawSet_1.RawSet.createComponentTargetAttribute('component', function (element, attrValue, obj, rawSet) {
|
145
|
-
return ScriptUtils_1.ScriptUtils.eval("return ".concat(attrValue), obj);
|
146
|
-
}, function (element, attrValue, obj, rawSet) {
|
147
|
-
if (attrValue) {
|
148
|
-
var targetObj = ScriptUtils_1.ScriptUtils.eval("return ".concat(attrValue), obj);
|
149
|
-
var n = element.cloneNode(true);
|
150
|
-
var innerHTML = _this.getComponentInnerHtml(targetObj, rawSet.uuid);
|
151
|
-
n.innerHTML = innerHTML;
|
152
|
-
return RawSet_1.RawSet.drThisCreate(rawSet, n, attrValue, '', true, obj, _this.option);
|
153
|
-
}
|
154
|
-
var fag = _this.option.window.document.createDocumentFragment();
|
155
|
-
return fag;
|
156
|
-
});
|
157
|
-
_this.domRenderTargetAttrs.push(targetAttribute);
|
158
110
|
option.proxy = {
|
159
111
|
onProxy: function (it) { return _this.createDomRender(it); }
|
160
112
|
};
|
@@ -323,8 +275,14 @@ var SimpleBootFront = (function (_super) {
|
|
323
275
|
var selectors = Component_1.componentSelectors;
|
324
276
|
selectors.forEach(function (val, name) {
|
325
277
|
var component = (0, Component_1.getComponent)(val);
|
326
|
-
var items = RawSet_1.RawSet.createComponentTargetElement(name, function (e, obj, r) {
|
327
|
-
var newSim
|
278
|
+
var items = RawSet_1.RawSet.createComponentTargetElement(name, function (e, obj, r, counstructorParam) {
|
279
|
+
var newSim;
|
280
|
+
if (counstructorParam === null || counstructorParam === void 0 ? void 0 : counstructorParam.length) {
|
281
|
+
newSim = new (val.bind.apply(val, __spreadArray([void 0], counstructorParam, false)))();
|
282
|
+
}
|
283
|
+
else {
|
284
|
+
newSim = _this.simstanceManager.newSim(val);
|
285
|
+
}
|
328
286
|
return newSim;
|
329
287
|
}, component === null || component === void 0 ? void 0 : component.template, component === null || component === void 0 ? void 0 : component.styles);
|
330
288
|
_this.domRenderTargetElements.push(items);
|
@@ -0,0 +1,36 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __extends = (this && this.__extends) || (function () {
|
3
|
+
var extendStatics = function (d, b) {
|
4
|
+
extendStatics = Object.setPrototypeOf ||
|
5
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
6
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
7
|
+
return extendStatics(d, b);
|
8
|
+
};
|
9
|
+
return function (d, b) {
|
10
|
+
if (typeof b !== "function" && b !== null)
|
11
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
12
|
+
extendStatics(d, b);
|
13
|
+
function __() { this.constructor = d; }
|
14
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
15
|
+
};
|
16
|
+
})();
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
18
|
+
exports.ComponentSet = void 0;
|
19
|
+
var ComponentSet_1 = require("dom-render/components/ComponentSet");
|
20
|
+
var Component_1 = require("../decorators/Component");
|
21
|
+
var ComponentSet = (function (_super) {
|
22
|
+
__extends(ComponentSet, _super);
|
23
|
+
function ComponentSet(obj) {
|
24
|
+
var _this = this;
|
25
|
+
var _a, _b;
|
26
|
+
_this = _super.call(this, obj) || this;
|
27
|
+
var component = (0, Component_1.getComponent)(obj);
|
28
|
+
if (component) {
|
29
|
+
_this.styles = (_a = component === null || component === void 0 ? void 0 : component.styles) !== null && _a !== void 0 ? _a : [];
|
30
|
+
_this.template = (_b = component === null || component === void 0 ? void 0 : component.template) !== null && _b !== void 0 ? _b : '';
|
31
|
+
}
|
32
|
+
return _this;
|
33
|
+
}
|
34
|
+
return ComponentSet;
|
35
|
+
}(ComponentSet_1.ComponentSet));
|
36
|
+
exports.ComponentSet = ComponentSet;
|
@@ -7,5 +7,6 @@ export interface ComponentConfig {
|
|
7
7
|
using?: (ConstructorType<any>)[];
|
8
8
|
}
|
9
9
|
export declare const ComponentMetadataKey: unique symbol;
|
10
|
-
export declare
|
10
|
+
export declare function Component(target: ConstructorType<any>): void;
|
11
|
+
export declare function Component(config: ComponentConfig): GenericClassDecorator<ConstructorType<any>>;
|
11
12
|
export declare const getComponent: (target: ConstructorType<any> | Function | any) => ComponentConfig | undefined;
|
package/decorators/Component.js
CHANGED
@@ -4,18 +4,23 @@ exports.getComponent = exports.Component = exports.ComponentMetadataKey = export
|
|
4
4
|
var ReflectUtils_1 = require("simple-boot-core/utils/reflect/ReflectUtils");
|
5
5
|
exports.componentSelectors = new Map();
|
6
6
|
exports.ComponentMetadataKey = Symbol('Component');
|
7
|
-
var
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
config.selector = target.name;
|
14
|
-
}
|
15
|
-
ReflectUtils_1.ReflectUtils.defineMetadata(exports.ComponentMetadataKey, config, target);
|
16
|
-
exports.componentSelectors.set(config.selector.toLowerCase(), target);
|
17
|
-
};
|
7
|
+
var componentProcess = function (config, target) {
|
8
|
+
if (!config.selector) {
|
9
|
+
config.selector = target.name.toLowerCase();
|
10
|
+
}
|
11
|
+
ReflectUtils_1.ReflectUtils.defineMetadata(exports.ComponentMetadataKey, config, target);
|
12
|
+
exports.componentSelectors.set(config.selector.toLowerCase(), target);
|
18
13
|
};
|
14
|
+
function Component(configOrTarget) {
|
15
|
+
if (typeof configOrTarget === 'function') {
|
16
|
+
componentProcess({}, configOrTarget);
|
17
|
+
}
|
18
|
+
else {
|
19
|
+
return function (target) {
|
20
|
+
componentProcess(configOrTarget, target);
|
21
|
+
};
|
22
|
+
}
|
23
|
+
}
|
19
24
|
exports.Component = Component;
|
20
25
|
var getComponent = function (target) {
|
21
26
|
if (target && typeof target === 'object') {
|
@@ -1,7 +1 @@
|
|
1
1
|
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.InjectFrontSituationType = void 0;
|
4
|
-
var InjectFrontSituationType;
|
5
|
-
(function (InjectFrontSituationType) {
|
6
|
-
InjectFrontSituationType["OPENER"] = "SIMPLE_BOOT_FRONT://OPENER";
|
7
|
-
})(InjectFrontSituationType = exports.InjectFrontSituationType || (exports.InjectFrontSituationType = {}));
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "simple-boot-front",
|
3
|
-
"version": "1.0.
|
3
|
+
"version": "1.0.113",
|
4
4
|
"main": "SimpleApplication.js",
|
5
5
|
"license": "MIT",
|
6
6
|
"description": "front end SPA frameworks",
|
@@ -72,7 +72,7 @@
|
|
72
72
|
"typescript": "^4.4.3"
|
73
73
|
},
|
74
74
|
"dependencies": {
|
75
|
-
"dom-render": "^1.0.
|
76
|
-
"simple-boot-core": "^1.0.
|
75
|
+
"dom-render": "^1.0.90",
|
76
|
+
"simple-boot-core": "^1.0.35"
|
77
77
|
}
|
78
78
|
}
|