simple-boot-front 1.0.111 → 1.0.114

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.
@@ -74,11 +74,9 @@ 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");
79
+ var ComponentSet_1 = require("dom-render/components/ComponentSet");
82
80
  var SimpleBootFront = (function (_super) {
83
81
  __extends(SimpleBootFront, _super);
84
82
  function SimpleBootFront(rootRouter, option) {
@@ -94,39 +92,8 @@ var SimpleBootFront = (function (_super) {
94
92
  targetElements: _this.domRenderTargetElements,
95
93
  targetAttrs: _this.domRenderTargetAttrs,
96
94
  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
95
  },
112
96
  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
97
  },
131
98
  scripts: { application: _this },
132
99
  applyEvents: [{
@@ -138,23 +105,28 @@ var SimpleBootFront = (function (_super) {
138
105
  });
139
106
  }
140
107
  }],
141
- proxyExcludeTyps: _this.domRendoerExcludeProxy
108
+ proxyExcludeTyps: _this.domRendoerExcludeProxy,
109
+ operatorAround: {
110
+ drThis: {
111
+ before: function (data, operatorExecutor) {
112
+ var _a, _b;
113
+ if (data && !(data instanceof ComponentSet_1.ComponentSet) && operatorExecutor.elementSource.element.getAttribute("".concat(RawSet_1.RawSet.DR_THIS_NAME, ":type")) === 'outlet') {
114
+ var component = (0, Component_1.getComponent)(data);
115
+ if (component) {
116
+ var styles = (_a = component === null || component === void 0 ? void 0 : component.styles) !== null && _a !== void 0 ? _a : [];
117
+ var template = (_b = component === null || component === void 0 ? void 0 : component.template) !== null && _b !== void 0 ? _b : '';
118
+ return new ComponentSet_1.ComponentSet(operatorExecutor, template, styles, { objPath: null });
119
+ }
120
+ else {
121
+ return undefined;
122
+ }
123
+ }
124
+ return data;
125
+ }
126
+ }
127
+ }
142
128
  };
143
129
  _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
130
  option.proxy = {
159
131
  onProxy: function (it) { return _this.createDomRender(it); }
160
132
  };
@@ -323,8 +295,14 @@ var SimpleBootFront = (function (_super) {
323
295
  var selectors = Component_1.componentSelectors;
324
296
  selectors.forEach(function (val, name) {
325
297
  var component = (0, Component_1.getComponent)(val);
326
- var items = RawSet_1.RawSet.createComponentTargetElement(name, function (e, obj, r) {
327
- var newSim = _this.simstanceManager.newSim(val);
298
+ var items = RawSet_1.RawSet.createComponentTargetElement(name, function (e, obj, r, counstructorParam) {
299
+ var newSim;
300
+ if (counstructorParam === null || counstructorParam === void 0 ? void 0 : counstructorParam.length) {
301
+ newSim = new (val.bind.apply(val, __spreadArray([void 0], counstructorParam, false)))();
302
+ }
303
+ else {
304
+ newSim = _this.simstanceManager.newSim(val);
305
+ }
328
306
  return newSim;
329
307
  }, component === null || component === void 0 ? void 0 : component.template, component === null || component === void 0 ? void 0 : component.styles);
330
308
  _this.domRenderTargetElements.push(items);
@@ -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.111",
3
+ "version": "1.0.114",
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.89",
76
- "simple-boot-core": "^1.0.32"
75
+ "dom-render": "^1.0.91",
76
+ "simple-boot-core": "^1.0.35"
77
77
  }
78
78
  }