@cocreate/local-storage 1.2.49 → 1.2.53
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/CHANGELOG.md +28 -0
- package/demo/index.html +8 -8
- package/docs/index.html +1 -1
- package/package.json +2 -2
- package/src/index.js +10 -10
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,31 @@
|
|
|
1
|
+
## [1.2.53](https://github.com/CoCreate-app/CoCreate-local-storage/compare/v1.2.52...v1.2.53) (2022-01-01)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* get-value attribute value now supports a selector added # to all values currently in get-value attributes ([d793164](https://github.com/CoCreate-app/CoCreate-local-storage/commit/d7931643e607bba6f630e492d8139b3a93a2bc68))
|
|
7
|
+
|
|
8
|
+
## [1.2.52](https://github.com/CoCreate-app/CoCreate-local-storage/compare/v1.2.51...v1.2.52) (2022-01-01)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* removed data- from attributes ([f618968](https://github.com/CoCreate-app/CoCreate-local-storage/commit/f6189689a6879387e900a4b35c2b0159497a8c8f))
|
|
14
|
+
|
|
15
|
+
## [1.2.51](https://github.com/CoCreate-app/CoCreate-local-storage/compare/v1.2.50...v1.2.51) (2021-12-15)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
### Bug Fixes
|
|
19
|
+
|
|
20
|
+
* update dependencies ([8beeff0](https://github.com/CoCreate-app/CoCreate-local-storage/commit/8beeff08c11d7a0a8ffc2bc5be4dac0933e033ef))
|
|
21
|
+
|
|
22
|
+
## [1.2.50](https://github.com/CoCreate-app/CoCreate-local-storage/compare/v1.2.49...v1.2.50) (2021-12-14)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
### Bug Fixes
|
|
26
|
+
|
|
27
|
+
* update dependencies ([e94bc24](https://github.com/CoCreate-app/CoCreate-local-storage/commit/e94bc24b8d272f24ba134a4f9d7d57794c8666f9))
|
|
28
|
+
|
|
1
29
|
## [1.2.49](https://github.com/CoCreate-app/CoCreate-local-storage/compare/v1.2.48...v1.2.49) (2021-11-27)
|
|
2
30
|
|
|
3
31
|
|
package/demo/index.html
CHANGED
|
@@ -7,24 +7,24 @@
|
|
|
7
7
|
</head>
|
|
8
8
|
<body>
|
|
9
9
|
<form>set
|
|
10
|
-
<input type="text"
|
|
10
|
+
<input type="text" localstorage-set="test" name="" placeholder="SET"/>
|
|
11
11
|
<!--<button type="submit" value="Submit" actions="localstorage">RUN</button>-->
|
|
12
12
|
<button type="button" class="outline red-white" actions="localStorage">RUN</button>
|
|
13
13
|
</form>
|
|
14
14
|
<form>set
|
|
15
|
-
<input type="text"
|
|
16
|
-
<input type="text"
|
|
17
|
-
<!--<input type="text"
|
|
15
|
+
<input type="text" localstorage-get="test" name="" placeholder="get"/>
|
|
16
|
+
<input type="text" localstorage-set="test2" name="" placeholder="SET"/>
|
|
17
|
+
<!--<input type="text" localstorage-remove="test" name="" placeholder="remove"/>-->
|
|
18
18
|
<button type="button" class="outline red-white" actions="localStorage">RUN</button>
|
|
19
19
|
</form>
|
|
20
20
|
<form>get
|
|
21
|
-
<input type="text"
|
|
22
|
-
<input type="text"
|
|
21
|
+
<input type="text" localstorage-get="test" name="" placeholder="get"/>
|
|
22
|
+
<input type="text" localstorage-get="test2" name="" placeholder="get"/>
|
|
23
23
|
<button type="button" class="outline red-white" actions="localStorage">RUN</button>
|
|
24
24
|
</form>
|
|
25
25
|
<form>remove
|
|
26
|
-
<input type="text"
|
|
27
|
-
<input type="text"
|
|
26
|
+
<input type="text" localstorage-remove="test" name="" placeholder="remove"/>
|
|
27
|
+
<input type="text" localstorage-remove="test2" name="" placeholder="remove"/>
|
|
28
28
|
<button type="button" class="outline red-white" actions="localStorage">RUN</button>
|
|
29
29
|
</form>
|
|
30
30
|
|
package/docs/index.html
CHANGED
|
@@ -114,7 +114,7 @@
|
|
|
114
114
|
<div class="svSplitter svHorizontal"> </div>
|
|
115
115
|
|
|
116
116
|
<div class="svPanel">
|
|
117
|
-
<iframe get-value="demo" frameBorder="0" height="100%" width="100%" class="min-width:300px"></iframe>
|
|
117
|
+
<iframe get-value="#demo" frameBorder="0" height="100%" width="100%" class="min-width:300px"></iframe>
|
|
118
118
|
</div>
|
|
119
119
|
|
|
120
120
|
</div>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cocreate/local-storage",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.53",
|
|
4
4
|
"description": "A Simple component similar to CoCreate-input & CoCreate-fetch which Save and fetch data for inputs, textarea, selects from localstorage. Easily configured using HTML5 attributes and/or JavaScript API",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"local-storage",
|
|
@@ -61,6 +61,6 @@
|
|
|
61
61
|
"webpack-log": "^3.0.1"
|
|
62
62
|
},
|
|
63
63
|
"dependencies": {
|
|
64
|
-
"@cocreate/docs": "^1.2.
|
|
64
|
+
"@cocreate/docs": "^1.2.62"
|
|
65
65
|
}
|
|
66
66
|
}
|
package/src/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
const CoCreateLocalStorage = {
|
|
3
3
|
|
|
4
4
|
init: function() {
|
|
5
|
-
var elements = document.querySelectorAll('[
|
|
5
|
+
var elements = document.querySelectorAll('[localstorage-set], [localstorage-get]');
|
|
6
6
|
this.initElements(elements)
|
|
7
7
|
},
|
|
8
8
|
|
|
@@ -21,7 +21,7 @@ const CoCreateLocalStorage = {
|
|
|
21
21
|
},
|
|
22
22
|
|
|
23
23
|
get: function(element) {
|
|
24
|
-
let key = element.getAttribute('
|
|
24
|
+
let key = element.getAttribute('localstorage-get');
|
|
25
25
|
if (!key) return;
|
|
26
26
|
let value = window.localStorage.getItem(key)
|
|
27
27
|
if(value != null){
|
|
@@ -30,7 +30,7 @@ const CoCreateLocalStorage = {
|
|
|
30
30
|
},
|
|
31
31
|
|
|
32
32
|
set: function(element) {
|
|
33
|
-
let key = element.getAttribute('
|
|
33
|
+
let key = element.getAttribute('localstorage-set');
|
|
34
34
|
if(element.value && key){
|
|
35
35
|
window.localStorage.setItem(key, element.value);
|
|
36
36
|
}
|
|
@@ -38,7 +38,7 @@ const CoCreateLocalStorage = {
|
|
|
38
38
|
|
|
39
39
|
remove: function(element) {
|
|
40
40
|
element.value = '';
|
|
41
|
-
let key = element.getAttribute('
|
|
41
|
+
let key = element.getAttribute('localstorage-remove');
|
|
42
42
|
if (key) {
|
|
43
43
|
window.localStorage.removeItem(key)
|
|
44
44
|
}
|
|
@@ -49,26 +49,26 @@ const CoCreateLocalStorage = {
|
|
|
49
49
|
let storage = window.localStorage;
|
|
50
50
|
if (!form) return;
|
|
51
51
|
|
|
52
|
-
let set_els = form.querySelectorAll('[
|
|
52
|
+
let set_els = form.querySelectorAll('[localstorage-set]')
|
|
53
53
|
set_els.forEach(input=>{
|
|
54
|
-
let key = input.getAttribute('
|
|
54
|
+
let key = input.getAttribute('localstorage-set');
|
|
55
55
|
if(input.value && key){
|
|
56
56
|
storage.setItem(key, input.value);
|
|
57
57
|
}
|
|
58
58
|
});
|
|
59
|
-
let get_els = form.querySelectorAll('[
|
|
59
|
+
let get_els = form.querySelectorAll('[localstorage-get]')
|
|
60
60
|
get_els.forEach(input=>{
|
|
61
|
-
let key = input.getAttribute('
|
|
61
|
+
let key = input.getAttribute('localstorage-get');
|
|
62
62
|
if (!key) return;
|
|
63
63
|
let value = storage.getItem(key)
|
|
64
64
|
if(value != null){
|
|
65
65
|
input.value = value;
|
|
66
66
|
}
|
|
67
67
|
});
|
|
68
|
-
let remove_els = form.querySelectorAll('[
|
|
68
|
+
let remove_els = form.querySelectorAll('[localstorage-remove]')
|
|
69
69
|
remove_els.forEach(input=>{
|
|
70
70
|
input.value = '';
|
|
71
|
-
let key = input.getAttribute('
|
|
71
|
+
let key = input.getAttribute('localstorage-remove');
|
|
72
72
|
if (key) {
|
|
73
73
|
storage.removeItem(key)
|
|
74
74
|
}
|