simple-boot-front 1.0.71 → 1.0.75
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 +12 -60
- package/SimpleBootFront.js +10 -4
- package/package.json +2 -2
- package/service/CookieService.d.ts +8 -0
- package/service/CookieService.js +42 -0
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
|
|
@@ -169,9 +170,9 @@ npm install simple-boot-front
|
|
169
170
|
console.log('poo->', testService)
|
170
171
|
}
|
171
172
|
}
|
172
|
-
|
173
173
|
```
|
174
|
-
|
174
|
+
|
175
|
+
* @After, @Before (AOP)
|
175
176
|
```typescript
|
176
177
|
fire($event: MouseEvent, view: View<Element>) {
|
177
178
|
console.log('fire method')
|
@@ -200,9 +201,10 @@ npm install simple-boot-front
|
|
200
201
|
```typescript
|
201
202
|
click() {
|
202
203
|
intentManager.publish(new Intent('layout://info/data?a=wow&aa=zzz', Math.floor(RandomUtils.random(0, 100))));
|
203
|
-
//
|
204
|
-
//
|
205
|
-
//
|
204
|
+
// const data = new CustomEvent('intent', {detail: {uri: 'index://showStore', data: {id: ${it.ID}}}}); window.dispatchEvent(data);
|
205
|
+
//intentManager(new Intent('layout://info/datas', Math.floor(RandomUtils.random(0, 100))));
|
206
|
+
//intentManager(new Intent('layout://', Math.floor(RandomUtils.random(0, 100)))); // default callback method -> subscribe(i: Intent)
|
207
|
+
//intentManager(new Intent('://info/datas', Math.floor(RandomUtils.random(0, 100))));
|
206
208
|
}
|
207
209
|
```
|
208
210
|
|
@@ -228,73 +230,23 @@ export class AppInfo {
|
|
228
230
|
## Reserved key word
|
229
231
|
* html
|
230
232
|
- attribute
|
231
|
-
- **[router-outlet]**: child module space
|
232
|
-
- **module-event-click**: click event
|
233
|
-
- value: method name, parameter($event, View)
|
234
|
-
```html
|
235
|
-
<button dr-event-click="changeData">change</button>
|
236
|
-
```
|
237
|
-
- **module-event-change**: change event
|
238
|
-
- value: method name, parameter($event, View)
|
239
|
-
```html
|
240
|
-
<input dr-event-change="changeData">
|
241
|
-
```
|
242
|
-
- **module-event-keyup**: keyup event
|
243
|
-
- value: method name, parameter($event, View)
|
244
|
-
```html
|
245
|
-
<input dr-event-keyup="changeData">
|
246
|
-
```
|
247
|
-
- **module-event-keydown**: keydown event
|
248
|
-
- value: method name, parameter($event, View)
|
249
|
-
```html
|
250
|
-
<input dr-event-keydown="changeData">
|
251
|
-
```
|
252
|
-
- **module-event-input**: input event
|
253
|
-
- value: method name, parameter($event, View)
|
254
|
-
```html
|
255
|
-
<input dr-event-input="changeData">
|
256
|
-
```
|
257
|
-
- **module-value-link**: link event (value change <-> input)
|
258
|
-
- value: variable name
|
259
|
-
```html
|
260
|
-
<input dr-value-link="value">
|
261
|
-
```
|
262
|
-
- **module-value**: value injection
|
263
|
-
- value: variable name
|
264
|
-
```html
|
265
|
-
<input dr-value="value">
|
266
|
-
```
|
267
|
-
- **module-change-attr**: change value setAttribute
|
268
|
-
- value: script
|
269
|
-
```html
|
270
|
-
<img src="https://cdn.imweb.me/thumbnail/20190912/460132b4e4fce.jpg" module-change-attr="return {height: this.size, width: this.size}">
|
271
|
-
```
|
272
|
-
- **module-change-style**: change value set Style
|
273
|
-
- value: script
|
274
|
-
```html
|
275
|
-
<div module-change-style="return {fontSize: `${this.size}px`, color: this.randomColor()}">hello</div>
|
276
|
-
```
|
277
233
|
- **router-active-class**: url === href attribute => class add
|
278
234
|
- value: add and remove class name
|
279
235
|
```html
|
280
|
-
<a router-link="ajax" router-active-class="
|
236
|
+
<a router-link="ajax" router-active-class="active">Ajax</a>
|
281
237
|
```
|
282
238
|
- **router-link**:
|
283
239
|
- value: router link
|
284
240
|
```html
|
285
241
|
<a router-link="ajax">Ajax</a>
|
286
242
|
```
|
287
|
-
-
|
243
|
+
- intent
|
288
244
|
```typescript
|
289
|
-
|
245
|
+
showStore(i: Intent) {
|
290
246
|
this.datas = i.data + '->' + i.params.aa
|
291
247
|
}
|
292
|
-
|
293
|
-
|
294
|
-
}
|
295
|
-
```
|
296
|
-
|
297
|
-
|
248
|
+
call -> const data = new CustomEvent('intent', {detail: {uri: 'index://showStore', data: {id: ${it.ID}}}}); window.dispatchEvent(data);
|
249
|
+
```
|
298
250
|
## License
|
299
251
|
* MIT
|
300
252
|
* visualkhh@gmail.com
|
package/SimpleBootFront.js
CHANGED
@@ -83,11 +83,17 @@ var SimpleBootFront = (function (_super) {
|
|
83
83
|
callBack: function (element, obj, rawSet) {
|
84
84
|
var componentObj = _this.simstanceManager.newSim(val);
|
85
85
|
var set = element.getAttribute('dr-set');
|
86
|
+
var any;
|
86
87
|
if (set) {
|
87
|
-
var
|
88
|
-
|
89
|
-
|
90
|
-
|
88
|
+
var comEvalTargetObj_1 = { '$attribute': any = {} };
|
89
|
+
element.getAttributeNames().forEach(function (it) {
|
90
|
+
comEvalTargetObj_1['$attribute'][it] = element.getAttribute(it);
|
91
|
+
});
|
92
|
+
comEvalTargetObj_1['$innerHTML'] = element.innerHTML;
|
93
|
+
comEvalTargetObj_1['$element'] = element;
|
94
|
+
comEvalTargetObj_1[name] = componentObj;
|
95
|
+
var script = "var " + name + " = this['" + name + "']; var $element = this['$element']; var $innerHTML = this['$innerHTML']; var $attribute = this['$attribute']; " + set + " ";
|
96
|
+
ScriptUtils_1.ScriptUtils.eval(script, Object.assign(comEvalTargetObj_1, obj));
|
91
97
|
}
|
92
98
|
var componentOption = (0, Component_1.getComponent)(componentObj);
|
93
99
|
var fag = _this.option.window.document.createDocumentFragment();
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "simple-boot-front",
|
3
|
-
"version": "1.0.
|
3
|
+
"version": "1.0.75",
|
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.
|
76
|
+
"dom-render": "^1.0.37",
|
77
77
|
"reflect-metadata": "^0.1.13",
|
78
78
|
"simple-boot-core": "^1.0.20"
|
79
79
|
}
|
@@ -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;
|