simple-boot-front 1.0.110 → 1.0.113

Sign up to get free protection for your applications and to get access to all the features.
@@ -15,7 +15,7 @@ export declare class SimpleBootFront extends SimpleApplication {
15
15
  rootRouter: ConstructorType<any>;
16
16
  option: SimFrontOption;
17
17
  navigation: Navigation;
18
- domRendoerExcludeProxy: (typeof SimFrontOption | typeof SimstanceManager | typeof IntentManager | typeof RouterManager | typeof SimpleApplication | typeof Navigation | typeof HttpService)[];
18
+ domRendoerExcludeProxy: (typeof SimFrontOption | typeof SimstanceManager | typeof IntentManager | typeof RouterManager | typeof Navigation | typeof HttpService)[];
19
19
  domRenderTargetElements: TargetElement[];
20
20
  domRenderTargetAttrs: TargetAttr[];
21
21
  domRenderConfig: Config;
@@ -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
  };
@@ -210,6 +162,7 @@ var SimpleBootFront = (function (_super) {
210
162
  if (target && routerAtomic.value) {
211
163
  var id = 'root-router';
212
164
  var startEndPoint = RawSet_1.RawSet.createStartEndPoint(id, RawSetType_1.RawSetType.TARGET_ELEMENT, this.domRenderConfig);
165
+ target.innerHTML = '';
213
166
  target.appendChild(startEndPoint.start);
214
167
  target.insertAdjacentHTML('beforeend', this.getComponentInnerHtml(this.rootRouter, id));
215
168
  target.appendChild(startEndPoint.end);
@@ -322,8 +275,14 @@ var SimpleBootFront = (function (_super) {
322
275
  var selectors = Component_1.componentSelectors;
323
276
  selectors.forEach(function (val, name) {
324
277
  var component = (0, Component_1.getComponent)(val);
325
- var items = RawSet_1.RawSet.createComponentTargetElement(name, function (e, obj, r) {
326
- var newSim = _this.simstanceManager.newSim(val);
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
+ }
327
286
  return newSim;
328
287
  }, component === null || component === void 0 ? void 0 : component.template, component === null || component === void 0 ? void 0 : component.styles);
329
288
  _this.domRenderTargetElements.push(items);
@@ -0,0 +1,4 @@
1
+ import { ComponentSet as DomRenderComponentSet } from 'dom-render/components/ComponentSet';
2
+ export declare class ComponentSet extends DomRenderComponentSet {
3
+ constructor(obj: any);
4
+ }
@@ -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 const Component: (config?: ComponentConfig | undefined) => GenericClassDecorator<ConstructorType<any>>;
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;
@@ -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 Component = function (config) {
8
- return function (target) {
9
- if (!config) {
10
- config = {};
11
- }
12
- if (!config.selector) {
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,3 +0,0 @@
1
- export declare enum InjectFrontSituationType {
2
- OPENER = "SIMPLE_BOOT_FRONT://OPENER"
3
- }
@@ -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.110",
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.88",
76
- "simple-boot-core": "^1.0.32"
75
+ "dom-render": "^1.0.90",
76
+ "simple-boot-core": "^1.0.35"
77
77
  }
78
78
  }
@@ -46,7 +46,7 @@ var CookieService = (function () {
46
46
  this.option.window.document.cookie = name + '=; expires=Thu, 01 Jan 1999 00:00:10 GMT;' + " path=".concat(path);
47
47
  };
48
48
  CookieService = __decorate([
49
- (0, SimDecorator_1.Sim)(),
49
+ SimDecorator_1.Sim,
50
50
  __metadata("design:paramtypes", [SimFrontOption_1.SimFrontOption])
51
51
  ], CookieService);
52
52
  return CookieService;
@@ -15,7 +15,7 @@ var HttpService = (function () {
15
15
  function HttpService() {
16
16
  }
17
17
  HttpService = __decorate([
18
- (0, SimDecorator_1.Sim)(),
18
+ SimDecorator_1.Sim,
19
19
  __metadata("design:paramtypes", [])
20
20
  ], HttpService);
21
21
  return HttpService;
@@ -44,7 +44,7 @@ var MetaTagService = (function () {
44
44
  return meta;
45
45
  };
46
46
  MetaTagService = __decorate([
47
- (0, SimDecorator_1.Sim)(),
47
+ SimDecorator_1.Sim,
48
48
  __metadata("design:paramtypes", [SimFrontOption_1.SimFrontOption])
49
49
  ], MetaTagService);
50
50
  return MetaTagService;
@@ -109,7 +109,7 @@ var Navigation = (function () {
109
109
  return this.option.window.history.state;
110
110
  };
111
111
  Navigation = __decorate([
112
- (0, SimDecorator_1.Sim)(),
112
+ SimDecorator_1.Sim,
113
113
  __metadata("design:paramtypes", [SimFrontOption_1.SimFrontOption])
114
114
  ], Navigation);
115
115
  return Navigation;
@@ -31,7 +31,7 @@ var ScriptService = (function () {
31
31
  return obj;
32
32
  };
33
33
  ScriptService = __decorate([
34
- (0, SimDecorator_1.Sim)(),
34
+ SimDecorator_1.Sim,
35
35
  __metadata("design:paramtypes", [SimstanceManager_1.SimstanceManager])
36
36
  ], ScriptService);
37
37
  return ScriptService;
@@ -59,7 +59,7 @@ var StorageService = (function () {
59
59
  window.localStorage.clear();
60
60
  };
61
61
  StorageService = __decorate([
62
- (0, SimDecorator_1.Sim)(),
62
+ SimDecorator_1.Sim,
63
63
  __metadata("design:paramtypes", [SimFrontOption_1.SimFrontOption])
64
64
  ], StorageService);
65
65
  return StorageService;
@@ -38,7 +38,7 @@ var ViewService = (function () {
38
38
  return (_a = this.e(".".concat(selector))) !== null && _a !== void 0 ? _a : undefined;
39
39
  };
40
40
  ViewService = __decorate([
41
- (0, SimDecorator_1.Sim)(),
41
+ SimDecorator_1.Sim,
42
42
  __metadata("design:paramtypes", [])
43
43
  ], ViewService);
44
44
  return ViewService;