renusify 1.0.3 → 1.0.4

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.
Files changed (36) hide show
  1. package/LICENSE +1 -1
  2. package/components/button/buttonGroup.vue +0 -4
  3. package/components/button/index.vue +0 -2
  4. package/components/card/index.vue +0 -2
  5. package/components/chat/MessageList.vue +0 -2
  6. package/components/chat/chatMsg.vue +4 -4
  7. package/components/form/colorPicker/Alpha.vue +26 -45
  8. package/components/form/colorPicker/Hue.vue +32 -51
  9. package/components/form/colorPicker/Preview.vue +21 -28
  10. package/components/form/colorPicker/Saturation.vue +49 -69
  11. package/components/form/colorPicker/index.vue +53 -38
  12. package/components/form/colorPicker/mixin.js +6 -1
  13. package/components/form/colorPicker/picker.vue +80 -39
  14. package/components/form/group-input.vue +122 -105
  15. package/components/form/inputTel/index.vue +8 -10
  16. package/components/form/json/JsonView.vue +15 -11
  17. package/components/form/json/index.vue +29 -10
  18. package/components/form/mask-input.vue +0 -5
  19. package/components/form/range.vue +0 -2
  20. package/components/form/select.vue +14 -14
  21. package/components/iframe/index.vue +60 -38
  22. package/components/index.js +91 -85
  23. package/components/infinite/div.vue +2 -3
  24. package/components/infinite/page.vue +2 -3
  25. package/components/list/index.vue +0 -2
  26. package/components/menu/index.vue +2 -5
  27. package/components/searchBox/index.vue +0 -4
  28. package/components/slider/index.vue +0 -4
  29. package/components/swiper/index.vue +0 -4
  30. package/components/table/index.vue +0 -4
  31. package/directive/index.js +18 -19
  32. package/directive/touch/index.js +31 -18
  33. package/index.js +9 -2
  34. package/package.json +1 -1
  35. package/tools/helper.js +23 -0
  36. package/components/form/colorPicker/Box.vue +0 -85
@@ -30,11 +30,12 @@ function touchstart(event, wrapper) {
30
30
  wrapper.startY = touch.clientY
31
31
  wrapper.moveX = touch.clientX
32
32
  wrapper.moveY = touch.clientY
33
+ wrapper.current = {x: touch.clientX - wrapper.clientRect['left'], y: touch.clientY - wrapper.clientRect['top']}
33
34
  event['touch'] = wrapper
34
35
  wrapper.start && wrapper.start(wrapper)
35
36
 
36
- document.ontouchmove= e => touchmove(e, wrapper)
37
- document.ontouchend= e => touchend( e, wrapper)
37
+ document.ontouchmove = e => touchmove(e, wrapper)
38
+ document.ontouchend = e => touchend(e, wrapper)
38
39
  }
39
40
 
40
41
  function mousestart(event, wrapper) {
@@ -44,10 +45,11 @@ function mousestart(event, wrapper) {
44
45
  wrapper.startY = touch.clientY
45
46
  wrapper.moveX = touch.clientX
46
47
  wrapper.moveY = touch.clientY
48
+ wrapper.current = {x: touch.clientX - wrapper.clientRect['left'], y: touch.clientY - wrapper.clientRect['top']}
47
49
  event['touch'] = wrapper
48
50
  wrapper.start && wrapper.start(wrapper)
49
- document.onmousemove= e => mousemove(e, wrapper)
50
- document.onmouseup= e => mouseend( e, wrapper)
51
+ document.onmousemove = e => mousemove(e, wrapper)
52
+ document.onmouseup = e => mouseend(e, wrapper)
51
53
  }
52
54
 
53
55
  function touchend(event, wrapper) {
@@ -55,6 +57,8 @@ function touchend(event, wrapper) {
55
57
  return null
56
58
  }
57
59
  wrapper.selected = false
60
+ const touch = event.changedTouches[0]
61
+ wrapper.current = {x: touch.clientX - wrapper.clientRect['left'], y: touch.clientY - wrapper.clientRect['top']}
58
62
  event['touch'] = wrapper
59
63
  wrapper.end && wrapper.end(wrapper)
60
64
  handleGesture(wrapper)
@@ -63,8 +67,8 @@ function touchend(event, wrapper) {
63
67
  wrapper.moveX = 0
64
68
  wrapper.moveY = 0
65
69
 
66
- document.ontouchmove=null
67
- document.ontouchend=null
70
+ document.ontouchmove = null
71
+ document.ontouchend = null
68
72
  }
69
73
 
70
74
  function mouseend(event, wrapper) {
@@ -73,6 +77,7 @@ function mouseend(event, wrapper) {
73
77
  }
74
78
 
75
79
  wrapper.selected = false
80
+ wrapper.current = {x: event.clientX - wrapper.clientRect['left'], y: event.clientY - wrapper.clientRect['top']}
76
81
  event['touch'] = wrapper
77
82
  wrapper.end && wrapper.end(wrapper)
78
83
  handleGesture(wrapper)
@@ -82,8 +87,8 @@ function mouseend(event, wrapper) {
82
87
  wrapper.moveX = 0
83
88
  wrapper.moveY = 0
84
89
 
85
- document.onmousemove=null
86
- document.onmouseup=null
90
+ document.onmousemove = null
91
+ document.onmouseup = null
87
92
  }
88
93
 
89
94
  function touchmove(event, wrapper) {
@@ -93,6 +98,7 @@ function touchmove(event, wrapper) {
93
98
  return null
94
99
  }
95
100
  const touch = event.changedTouches[0]
101
+ wrapper.current = {x: touch.clientX - wrapper.clientRect['left'], y: touch.clientY - wrapper.clientRect['top']}
96
102
  wrapper.moveX = touch.clientX
97
103
  wrapper.moveY = touch.clientY
98
104
  event['touch'] = wrapper
@@ -109,6 +115,7 @@ function mousemove(event, wrapper) {
109
115
  return null
110
116
  }
111
117
  const touch = event
118
+ wrapper.current = {x: event.clientX - wrapper.clientRect['left'], y: event.clientY - wrapper.clientRect['top']}
112
119
  wrapper.moveX = touch.clientX
113
120
  wrapper.moveY = touch.clientY
114
121
  event['touch'] = wrapper
@@ -121,6 +128,8 @@ function mousemove(event, wrapper) {
121
128
  function createHandlers(value) {
122
129
  const wrapper = {
123
130
  selected: false,
131
+ clientRect: value['clientRect'],
132
+ current: {x: 0, y: 0},
124
133
  startX: 0,
125
134
  startY: 0,
126
135
  goX: 0,
@@ -143,21 +152,25 @@ function createHandlers(value) {
143
152
 
144
153
  function mounted(el, binding) {
145
154
  const value = binding.value
155
+ el.timeout_touch = setTimeout(() => {
156
+ value['clientRect'] = el.getBoundingClientRect()
157
+ const options = value.options || {
158
+ passive: true
159
+ }
146
160
 
147
- const options = value.options || {
148
- passive: true
149
- }
161
+ el.eventsHandler = createHandlers(value)
162
+ keys(el.eventsHandler).forEach(eventName => {
163
+ el.addEventListener(eventName, el.eventsHandler[eventName], options)
164
+ })
165
+ }, 1000)
150
166
 
151
- el.eventsHandler= createHandlers(value)
152
- keys(el.eventsHandler).forEach(eventName => {
153
- el.addEventListener(eventName, el.eventsHandler[eventName], options)
154
- })
155
167
  }
156
168
 
157
169
  function unmounted(el, binding) {
158
- if (!el.eventsHandler){
159
- return
160
- }
170
+ clearTimeout(el.timeout_touch)
171
+ if (!el.eventsHandler) {
172
+ return
173
+ }
161
174
  keys(el.eventsHandler).forEach(eventName => {
162
175
  el.removeEventListener(eventName, el.eventsHandler[eventName])
163
176
  })
package/index.js CHANGED
@@ -114,10 +114,17 @@ export default {
114
114
  app.config.globalProperties.$v = (names) => valid.checkType(names)
115
115
 
116
116
  // install components
117
- register(app, options['components'] || []);
117
+ const required_directive = register(app, options['components'] || []);
118
118
 
119
+ if (options['directives']) {
120
+ options['directives'].forEach((i) => {
121
+ if (!required_directive.includes(i)) {
122
+ required_directive.push(i)
123
+ }
124
+ })
125
+ }
119
126
  // install directives
120
- registers(app, options['directives'] || []);
127
+ registers(app, required_directive);
121
128
 
122
129
  // renusify storage
123
130
  app.config.globalProperties.$storage = Storage
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "renusify",
3
- "version": "1.0.3",
3
+ "version": "1.0.4",
4
4
  "description": "Vue3 Framework",
5
5
  "keywords": [
6
6
  "vuejs",
package/tools/helper.js CHANGED
@@ -363,4 +363,27 @@ export function download(url, fileName = 'download') {
363
363
  tag.remove()
364
364
  };
365
365
  xhr.send();
366
+ }
367
+
368
+ export function setCookie(cname, cvalue, exsec) {
369
+ const d = new Date();
370
+ d.setTime(d.getTime() + (exsec * 1000));
371
+ let expires = "expires=" + d.toUTCString();
372
+ document.cookie = cname + "=" + cvalue + ";" + expires + ";path=/";
373
+ }
374
+
375
+ export function getCookie(cname) {
376
+ let name = cname + "=";
377
+ let decodedCookie = decodeURIComponent(document.cookie);
378
+ let ca = decodedCookie.split(';');
379
+ for (let i = 0; i < ca.length; i++) {
380
+ let c = ca[i];
381
+ while (c.charAt(0) === ' ') {
382
+ c = c.substring(1);
383
+ }
384
+ if (c.indexOf(name) === 0) {
385
+ return c.substring(name.length, c.length);
386
+ }
387
+ }
388
+ return "";
366
389
  }
@@ -1,85 +0,0 @@
1
- <template>
2
- <div class="color-type">
3
- <span class="name">
4
- {{ name }}
5
- </span>
6
- <input v-model="modelColor" class="value" />
7
- </div>
8
- </template>
9
-
10
- <script >
11
- import { computed } from 'vue'
12
-
13
- export default
14
- {
15
- props: {
16
- name: {
17
- type: String,
18
- default: '',
19
- },
20
- color: {
21
- type: String,
22
- default: '',
23
- },
24
- },
25
- emits: ['inputColor'],
26
- setup(props, { emit }) {
27
- const modelColor = computed({
28
- get() {
29
- return props.color || ''
30
- },
31
- set(val) {
32
- emit('inputColor', val)
33
- },
34
- })
35
- return {
36
- modelColor,
37
- }
38
- },
39
- }
40
- </script>
41
-
42
- <style lang="scss">
43
- @import "../../../style/include";
44
- .color-type {
45
- display: flex;
46
- margin-top: 8px;
47
- font-size: 12px;
48
- .name {
49
- width: 60px;
50
- height: 30px;
51
- float: left;
52
- display: flex;
53
- justify-content: center;
54
- align-items: center;
55
- }
56
- .value {
57
- flex: 1;
58
- height: 30px;
59
- min-width: 100px;
60
- padding: 0 12px;
61
- border: 0;
62
- box-sizing: border-box;
63
- }
64
- @include light(){
65
- .name {
66
- color: #999;
67
- background: #e7e8e9;
68
- }
69
- .value {
70
- color: #666;
71
- background: #eceef0;
72
- }
73
- }
74
- @include dark(){
75
- .name {
76
- color: #999;
77
- background: #252930;
78
- }
79
- .value {
80
- color: #fff;
81
- background: #2e333a;
82
- }
83
- }
84
- }
85
- </style>