simple-boot-front 1.0.72 → 1.0.76

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/README.MD CHANGED
@@ -13,6 +13,7 @@ Single Page Application Framworks for Web
13
13
  ```shell
14
14
  npm init simple-boot-front projectname
15
15
  cd projectname
16
+ npm run bundle
16
17
  npm run serve
17
18
  ```
18
19
 
@@ -12,8 +12,8 @@ export declare class SimpleBootFront extends SimpleApplication {
12
12
  option: SimFrontOption;
13
13
  navigation: Navigation;
14
14
  domRendoerExcludeProxy: (typeof SimFrontOption | typeof SimstanceManager | typeof SimpleApplication | typeof Navigation | typeof HttpService | typeof IntentManager | typeof RouterManager)[];
15
- targetElements: TargetElement[];
16
- targetAttrs: TargetAttr[];
15
+ domRenderTargetElements: TargetElement[];
16
+ domRenderTargetAttrs: TargetAttr[];
17
17
  constructor(rootRouter: ConstructorType<any>, option: SimFrontOption);
18
18
  getComponentInnerHtml(targetObj: any): string;
19
19
  createDomRender<T extends object>(obj: T): T;
@@ -73,21 +73,28 @@ var SimpleBootFront = (function (_super) {
73
73
  var _this = _super.call(this, rootRouter, option) || this;
74
74
  _this.rootRouter = rootRouter;
75
75
  _this.option = option;
76
- _this.domRendoerExcludeProxy = [SimpleApplication_1.SimpleApplication, IntentManager_1.IntentManager, RouterManager_1.RouterManager, SimstanceManager_1.SimstanceManager, SimFrontOption_1.SimFrontOption, Navigation_1.Navigation, ViewService_1.ViewService, HttpService_1.HttpService];
76
+ _this.domRendoerExcludeProxy = [SimpleApplication_1.SimpleApplication, IntentManager_1.IntentManager, RouterManager_1.RouterManager, SimstanceManager_1.SimstanceManager, SimFrontOption_1.SimFrontOption, Navigation_1.Navigation, ViewService_1.ViewService, HttpService_1.HttpService, HTMLElement];
77
+ _this.domRenderTargetElements = [];
78
+ _this.domRenderTargetAttrs = [];
77
79
  window.__dirname = 'simple-boot-front__dirname';
78
- _this.targetElements = [];
79
80
  var selectors = Component_1.componentSelectors;
80
81
  selectors.forEach(function (val, name) {
81
- _this.targetElements.push({
82
+ _this.domRenderTargetElements.push({
82
83
  name: name,
83
84
  callBack: function (element, obj, rawSet) {
84
85
  var componentObj = _this.simstanceManager.newSim(val);
85
86
  var set = element.getAttribute('dr-set');
87
+ var any;
86
88
  if (set) {
87
- var comEvalTargetObj = {};
88
- comEvalTargetObj[name] = componentObj;
89
- var script = "var " + name + " = this['" + name + "']; " + set + " ";
90
- ScriptUtils_1.ScriptUtils.eval(script, Object.assign(comEvalTargetObj, obj));
89
+ var comEvalTargetObj_1 = { '$attribute': any = {} };
90
+ element.getAttributeNames().forEach(function (it) {
91
+ comEvalTargetObj_1['$attribute'][it] = element.getAttribute(it);
92
+ });
93
+ comEvalTargetObj_1['$innerHTML'] = element.innerHTML;
94
+ comEvalTargetObj_1['$element'] = element;
95
+ comEvalTargetObj_1[name] = componentObj;
96
+ var script = "var " + name + " = this['" + name + "']; var $element = this['$element']; var $innerHTML = this['$innerHTML']; var $attribute = this['$attribute']; " + set + " ";
97
+ ScriptUtils_1.ScriptUtils.eval(script, Object.assign(comEvalTargetObj_1, obj));
91
98
  }
92
99
  var componentOption = (0, Component_1.getComponent)(componentObj);
93
100
  var fag = _this.option.window.document.createDocumentFragment();
@@ -101,19 +108,19 @@ var SimpleBootFront = (function (_super) {
101
108
  }
102
109
  });
103
110
  });
104
- _this.targetAttrs = [{
105
- name: 'component', callBack: function (element, attrValue, obj, rawSet) {
106
- var fag = _this.option.window.document.createDocumentFragment();
107
- if (attrValue) {
108
- var targetObj = ScriptUtils_1.ScriptUtils.eval("return " + attrValue, obj);
109
- var n = element.cloneNode(true);
110
- var innerHTML = _this.getComponentInnerHtml(targetObj);
111
- n.innerHTML = innerHTML;
112
- fag.append(RawSet_1.RawSet.drThisCreate(n, attrValue, '', true, obj));
113
- }
114
- return fag;
111
+ _this.domRenderTargetAttrs.push({
112
+ name: 'component', callBack: function (element, attrValue, obj, rawSet) {
113
+ var fag = _this.option.window.document.createDocumentFragment();
114
+ if (attrValue) {
115
+ var targetObj = ScriptUtils_1.ScriptUtils.eval("return " + attrValue, obj);
116
+ var n = element.cloneNode(true);
117
+ var innerHTML = _this.getComponentInnerHtml(targetObj);
118
+ n.innerHTML = innerHTML;
119
+ fag.append(RawSet_1.RawSet.drThisCreate(n, attrValue, '', true, obj));
115
120
  }
116
- }];
121
+ return fag;
122
+ }
123
+ });
117
124
  option.proxy = {
118
125
  onProxy: function (it) { return _this.createDomRender(it); }
119
126
  };
@@ -130,8 +137,8 @@ var SimpleBootFront = (function (_super) {
130
137
  var component = (0, Component_1.getComponent)(obj);
131
138
  if (component && typeof obj === 'object') {
132
139
  return DomRender_1.DomRender.run(obj, undefined, {
133
- targetElements: this.targetElements,
134
- targetAttrs: this.targetAttrs,
140
+ targetElements: this.domRenderTargetElements,
141
+ targetAttrs: this.domRenderTargetAttrs,
135
142
  onAttrInit: function (attrName, attrValue, obj) {
136
143
  var _a, _b;
137
144
  if (attrName === 'component') {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "simple-boot-front",
3
- "version": "1.0.72",
3
+ "version": "1.0.76",
4
4
  "main": "SimpleApplication.js",
5
5
  "license": "MIT",
6
6
  "description": "front end SPA frameworks",
@@ -73,7 +73,7 @@
73
73
  "typescript": "^4.3.5"
74
74
  },
75
75
  "dependencies": {
76
- "dom-render": "^1.0.33",
76
+ "dom-render": "^1.0.38",
77
77
  "reflect-metadata": "^0.1.13",
78
78
  "simple-boot-core": "^1.0.20"
79
79
  }
@@ -0,0 +1,8 @@
1
+ export declare class CookieService {
2
+ get(key: string): string | undefined;
3
+ getAll(): {
4
+ [k: string]: string;
5
+ };
6
+ set(name: string, value: string, exp: number): void;
7
+ delete(name: string): void;
8
+ }
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.CookieService = void 0;
10
+ var SimDecorator_1 = require("simple-boot-core/decorators/SimDecorator");
11
+ var CookieService = (function () {
12
+ function CookieService() {
13
+ }
14
+ CookieService.prototype.get = function (key) {
15
+ return this.getAll()[key];
16
+ };
17
+ CookieService.prototype.getAll = function () {
18
+ var _a;
19
+ var all = {};
20
+ var strings = (_a = document.cookie.split(';')) !== null && _a !== void 0 ? _a : [];
21
+ strings.forEach(function (it) {
22
+ var set = it.split('=');
23
+ if (set[0] && set[1] && set[0].trim().length > 0 && set[1].trim().length > 0) {
24
+ all[set[0].trim()] = set[1].trim();
25
+ }
26
+ });
27
+ return all;
28
+ };
29
+ CookieService.prototype.set = function (name, value, exp) {
30
+ var date = new Date();
31
+ date.setTime(date.getTime() + exp);
32
+ document.cookie = name + '=' + value + ';expires=' + date.toUTCString() + ';path=/';
33
+ };
34
+ CookieService.prototype.delete = function (name) {
35
+ document.cookie = name + '=; expires=Thu, 01 Jan 1999 00:00:10 GMT;';
36
+ };
37
+ CookieService = __decorate([
38
+ (0, SimDecorator_1.Sim)()
39
+ ], CookieService);
40
+ return CookieService;
41
+ }());
42
+ exports.CookieService = CookieService;