renusify 2.5.2 → 3.0.0
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/components/app/index.vue +74 -22
- package/components/app/toast/index.vue +76 -71
- package/components/app/toast/toast.vue +62 -44
- package/components/avatar/index.vue +208 -84
- package/components/button/buttonConfirm.vue +53 -26
- package/components/button/buttonGroup.js +0 -2
- package/components/button/buttonGroup.vue +310 -62
- package/components/button/index.vue +584 -100
- package/components/calendar/index.js +0 -2
- package/components/calendar/index.vue +326 -262
- package/components/calendar/month.vue +64 -55
- package/components/calendar/year.vue +30 -25
- package/components/card/index.vue +139 -59
- package/components/codeEditor/highlightCss.vue +38 -39
- package/components/codeEditor/highlightHtml.vue +64 -64
- package/components/codeEditor/highlightJs.vue +37 -38
- package/components/codeEditor/index.vue +129 -79
- package/components/codeEditor/run.vue +225 -39
- package/components/codeEditor/useCodeFormatter.js +150 -0
- package/components/confirm/index.vue +139 -80
- package/components/container/col.vue +5 -4
- package/components/container/divider.vue +28 -19
- package/components/container/index.vue +34 -15
- package/components/container/row.vue +26 -9
- package/components/container/spacer.vue +2 -4
- package/components/container/style.scss +3 -0
- package/components/content/index.vue +49 -32
- package/components/cropper/index.vue +401 -244
- package/components/float/index.vue +542 -415
- package/components/form/addressInput/index.vue +184 -109
- package/components/form/camInput/index.vue +370 -244
- package/components/form/checkInput/index.vue +138 -71
- package/components/form/checkboxInput/index.vue +87 -47
- package/components/form/colorInput/Alpha.vue +81 -83
- package/components/form/colorInput/Hue.vue +91 -68
- package/components/form/colorInput/Preview.vue +43 -47
- package/components/form/colorInput/Saturation.vue +101 -86
- package/components/form/colorInput/index.vue +71 -39
- package/components/form/colorInput/picker.vue +111 -106
- package/components/form/colorInput/useColor.js +153 -0
- package/components/form/dateInput/index.vue +691 -356
- package/components/form/dateInput/month.vue +63 -54
- package/components/form/dateInput/year.vue +35 -25
- package/components/form/fileInput/index.js +0 -1
- package/components/form/fileInput/index.vue +263 -106
- package/components/form/fileInput/single.vue +323 -164
- package/components/form/groupInput/index.vue +199 -101
- package/components/form/index.vue +189 -83
- package/components/form/input/index.vue +416 -377
- package/components/form/jsonInput/JsonView.vue +54 -56
- package/components/form/jsonInput/index.vue +247 -165
- package/components/form/maskInput/index.vue +252 -132
- package/components/form/numberInput/index.js +0 -1
- package/components/form/numberInput/index.vue +226 -117
- package/components/form/passwordInput/index.js +2 -1
- package/components/form/passwordInput/index.vue +269 -102
- package/components/form/radioInput/index.vue +143 -72
- package/components/form/rangeInput/index.vue +280 -167
- package/components/form/ratingInput/index.vue +57 -57
- package/components/form/selectInput/index.js +1 -3
- package/components/form/selectInput/index.vue +584 -296
- package/components/form/switchInput/index.vue +73 -59
- package/components/form/telInput/index.js +0 -1
- package/components/form/telInput/index.vue +238 -135
- package/components/form/textArea/index.vue +72 -35
- package/components/form/textEditor/index.vue +739 -0
- package/components/form/{text-editor → textEditor}/style.scss +8 -16
- package/components/form/textInput/index.vue +54 -32
- package/components/form/timeInput/index.vue +82 -55
- package/components/form/timeInput/range.vue +115 -94
- package/components/form/timeInput/timepicker.vue +382 -449
- package/components/form/uniqueInput/index.vue +105 -48
- package/components/form/unitInput/index.vue +139 -84
- package/components/formCreator/index.js +0 -1
- package/components/formCreator/index.vue +314 -148
- package/components/highlight/index.vue +41 -25
- package/components/highlight/style.scss +2 -2
- package/components/highlight/{mixin.js → useHighlight.js} +181 -160
- package/components/icon/index.vue +79 -33
- package/components/img/index.vue +249 -147
- package/components/img/preview.vue +180 -198
- package/components/img/svgImg.vue +42 -39
- package/components/index.js +5 -20
- package/components/infinite/index.js +1 -2
- package/components/infinite/index.vue +248 -66
- package/components/map/index.vue +428 -261
- package/components/map/route.vue +794 -487
- package/components/map/select.vue +118 -58
- package/components/menu/index.vue +201 -91
- package/components/meta/meta.js +26 -3
- package/components/modal/index.vue +382 -156
- package/components/notify/index.vue +204 -86
- package/components/notify/notification.vue +38 -55
- package/components/progress/circle.vue +189 -70
- package/components/progress/line.vue +266 -46
- package/components/searchBox/index.js +1 -3
- package/components/searchBox/index.vue +194 -101
- package/components/skeleton/index.vue +45 -20
- package/components/slider/index.vue +318 -156
- package/components/swiper/index.vue +254 -106
- package/components/table/crud/footer.vue +77 -53
- package/components/table/crud/header.vue +71 -72
- package/components/table/crud/index.vue +629 -399
- package/components/table/index.vue +721 -278
- package/components/timeAgo/index.vue +145 -96
- package/components/tour/index.vue +338 -235
- package/components/tree/index.vue +235 -89
- package/components/tree/tree-element.vue +106 -106
- package/directive/animate/index.js +77 -0
- package/directive/clickOutSide/index.js +98 -0
- package/directive/drag/index.js +153 -0
- package/directive/index.js +11 -13
- package/directive/intersect/index.js +263 -0
- package/directive/mask/index.js +67 -0
- package/directive/parallax/index.js +78 -0
- package/directive/ripple/index.js +14 -0
- package/directive/scroll/index.js +244 -0
- package/directive/sortable/index.js +274 -0
- package/directive/title/index.js +75 -0
- package/directive/touch/index.js +268 -0
- package/index.js +10 -8
- package/package.json +5 -2
- package/plugins/validation/Validate.js +88 -79
- package/scripts/generate-docs.mjs +226 -0
- package/scripts/menu.mjs +240 -0
- package/scripts/parser.mjs +1086 -0
- package/style/_index.scss +7 -0
- package/style/app.scss +13 -65
- package/style/colors.scss +5 -22
- package/style/functions/index.scss +8 -0
- package/style/mixins/index.scss +17 -5
- package/style/variables/base.scss +154 -175
- package/style/variables/color.scss +0 -12
- package/style/variables/utilities.scss +0 -180
- package/tools/helper.js +0 -8
- package/tools/icons.js +6 -1
- package/tools/root.js +71 -0
- package/components/app/style.scss +0 -41
- package/components/app/toast/style.scss +0 -20
- package/components/avatar/style.scss +0 -32
- package/components/bar/bottomNav.js +0 -1
- package/components/bar/bottomNav.vue +0 -28
- package/components/bar/bottomNavigationCircle.js +0 -2
- package/components/bar/bottomNavigationCircle.vue +0 -99
- package/components/bar/scss/bottomNav.scss +0 -67
- package/components/bar/scss/toolbar.scss +0 -174
- package/components/bar/toolbar/index.js +0 -8
- package/components/bar/toolbar/index.vue +0 -35
- package/components/bar/toolbar/laptop.vue +0 -33
- package/components/bar/toolbar/menuChilds.vue +0 -41
- package/components/bar/toolbar/menuLaptop.vue +0 -41
- package/components/bar/toolbar/menuMob.vue +0 -39
- package/components/bar/toolbar/mixin.js +0 -43
- package/components/bar/toolbar/mobile.vue +0 -34
- package/components/breadcrumb/bredcrumbItem.vue +0 -39
- package/components/breadcrumb/index.js +0 -3
- package/components/breadcrumb/index.vue +0 -71
- package/components/breadcrumb/style.scss +0 -51
- package/components/button/style.scss +0 -411
- package/components/card/style.scss +0 -86
- package/components/chart/chart.js +0 -1
- package/components/chart/chart.vue +0 -69
- package/components/chart/worldMap.js +0 -2
- package/components/chart/worldMap.vue +0 -1112
- package/components/chat/MessageList.vue +0 -163
- package/components/chat/chatInput.vue +0 -150
- package/components/chat/chatMsg.vue +0 -276
- package/components/chat/index.js +0 -11
- package/components/chat/index.vue +0 -113
- package/components/chip/index.js +0 -3
- package/components/chip/index.vue +0 -77
- package/components/chip/style.scss +0 -199
- package/components/codeEditor/mixin.js +0 -145
- package/components/countdown/index.js +0 -1
- package/components/countdown/index.vue +0 -105
- package/components/form/colorInput/mixin.js +0 -132
- package/components/form/fileInput/file.js +0 -148
- package/components/form/telInput/assets/flags.png +0 -0
- package/components/form/telInput/assets/flags@2x.png +0 -0
- package/components/form/text-editor/index.vue +0 -705
- package/components/icon/style.scss +0 -17
- package/components/infinite/div.js +0 -6
- package/components/infinite/div.vue +0 -193
- package/components/infinite/page.js +0 -3
- package/components/infinite/page.vue +0 -105
- package/components/list/index.js +0 -3
- package/components/list/index.vue +0 -122
- package/components/list/style.scss +0 -66
- package/components/message/index.js +0 -4
- package/components/message/index.vue +0 -40
- package/components/modal/style.scss +0 -146
- package/components/nestable/NestableItem.vue +0 -307
- package/components/nestable/editable.js +0 -44
- package/components/nestable/index.js +0 -1
- package/components/nestable/index.vue +0 -226
- package/components/nestable/methods.js +0 -416
- package/components/progress/style.scss +0 -229
- package/components/table/style.scss +0 -338
- package/components/tabs/index.js +0 -3
- package/components/tabs/index.vue +0 -151
- package/components/timeline/index.js +0 -6
- package/components/timeline/index.vue +0 -76
- package/directive/resize/index.js +0 -30
- package/directive/skeleton/index.js +0 -27
- package/directive/skeleton/style.scss +0 -37
- package/plugins/request/Request.js +0 -68
- package/style/animation.scss +0 -94
- package/style/style.scss +0 -8
- package/tools/rootable.js +0 -75
- /package/components/form/{text-editor → textEditor}/index.js +0 -0
- /package/components/form/{text-editor → textEditor}/preview.js +0 -0
- /package/components/form/{text-editor → textEditor}/preview.vue +0 -0
package/directive/touch/index.js
CHANGED
|
@@ -1,3 +1,271 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @example // v-touch usage
|
|
3
|
+
* <template>
|
|
4
|
+
* <div class="touch-container">
|
|
5
|
+
* <h1>Touch Gesture Directive</h1>
|
|
6
|
+
*
|
|
7
|
+
* <div class="gesture-areas">
|
|
8
|
+
* <div class="gesture-area">
|
|
9
|
+
* <h2>Swipe Detection</h2>
|
|
10
|
+
* <div
|
|
11
|
+
* v-touch="swipeHandlers"
|
|
12
|
+
* class="swipe-box"
|
|
13
|
+
* >
|
|
14
|
+
* <div class="gesture-info">
|
|
15
|
+
* <div class="info-item">
|
|
16
|
+
* <span>Direction:</span>
|
|
17
|
+
* <span class="value direction" :class="swipeDirection">
|
|
18
|
+
* {{ swipeDirection }}
|
|
19
|
+
* </span>
|
|
20
|
+
* </div>
|
|
21
|
+
* <div class="info-item">
|
|
22
|
+
* <span>Distance X:</span>
|
|
23
|
+
* <span class="value">{{ swipeDistanceX }}px</span>
|
|
24
|
+
* </div>
|
|
25
|
+
* <div class="info-item">
|
|
26
|
+
* <span>Distance Y:</span>
|
|
27
|
+
* <span class="value">{{ swipeDistanceY }}px</span>
|
|
28
|
+
* </div>
|
|
29
|
+
* <div class="info-item">
|
|
30
|
+
* <span>Swipe Count:</span>
|
|
31
|
+
* <span class="value counter">{{ swipeCount }}</span>
|
|
32
|
+
* </div>
|
|
33
|
+
* </div>
|
|
34
|
+
* <div class="instruction">
|
|
35
|
+
* Swipe in any direction
|
|
36
|
+
* </div>
|
|
37
|
+
* </div>
|
|
38
|
+
* </div>
|
|
39
|
+
*
|
|
40
|
+
* <div class="gesture-area">
|
|
41
|
+
* <h2>Touch Position</h2>
|
|
42
|
+
* <div
|
|
43
|
+
* v-touch="touchHandlers"
|
|
44
|
+
* class="position-box"
|
|
45
|
+
* >
|
|
46
|
+
* <div class="gesture-info">
|
|
47
|
+
* <div class="info-item">
|
|
48
|
+
* <span>Current X:</span>
|
|
49
|
+
* <span class="value">{{ currentX }}px</span>
|
|
50
|
+
* </div>
|
|
51
|
+
* <div class="info-item">
|
|
52
|
+
* <span>Current Y:</span>
|
|
53
|
+
* <span class="value">{{ currentY }}px</span>
|
|
54
|
+
* </div>
|
|
55
|
+
* <div class="info-item">
|
|
56
|
+
* <span>Move Count:</span>
|
|
57
|
+
* <span class="value counter">{{ moveCount }}</span>
|
|
58
|
+
* </div>
|
|
59
|
+
* </div>
|
|
60
|
+
* <div class="touch-indicator" :style="{ left: indicatorX + 'px', top: indicatorY + 'px' }"></div>
|
|
61
|
+
* <div class="instruction">
|
|
62
|
+
* Touch and move
|
|
63
|
+
* </div>
|
|
64
|
+
* </div>
|
|
65
|
+
* </div>
|
|
66
|
+
* </div>
|
|
67
|
+
* </div>
|
|
68
|
+
* </template>
|
|
69
|
+
*
|
|
70
|
+
* <script>
|
|
71
|
+
* import { ref } from 'vue'
|
|
72
|
+
*
|
|
73
|
+
* const swipeDirection = ref('none')
|
|
74
|
+
* const swipeDistanceX = ref(0)
|
|
75
|
+
* const swipeDistanceY = ref(0)
|
|
76
|
+
* const swipeCount = ref(0)
|
|
77
|
+
*
|
|
78
|
+
* const currentX = ref(0)
|
|
79
|
+
* const currentY = ref(0)
|
|
80
|
+
* const moveCount = ref(0)
|
|
81
|
+
*
|
|
82
|
+
* const indicatorX = ref(150)
|
|
83
|
+
* const indicatorY = ref(150)
|
|
84
|
+
*
|
|
85
|
+
* const swipeHandlers = ref({
|
|
86
|
+
* left: (wrapper) => {
|
|
87
|
+
* swipeDirection.value = 'left'
|
|
88
|
+
* swipeDistanceX.value = Math.abs(wrapper.goX)
|
|
89
|
+
* swipeDistanceY.value = Math.abs(wrapper.goY)
|
|
90
|
+
* swipeCount.value++
|
|
91
|
+
* },
|
|
92
|
+
* right: (wrapper) => {
|
|
93
|
+
* swipeDirection.value = 'right'
|
|
94
|
+
* swipeDistanceX.value = wrapper.goX
|
|
95
|
+
* swipeDistanceY.value = Math.abs(wrapper.goY)
|
|
96
|
+
* swipeCount.value++
|
|
97
|
+
* },
|
|
98
|
+
* up: (wrapper) => {
|
|
99
|
+
* swipeDirection.value = 'up'
|
|
100
|
+
* swipeDistanceX.value = Math.abs(wrapper.goX)
|
|
101
|
+
* swipeDistanceY.value = Math.abs(wrapper.goY)
|
|
102
|
+
* swipeCount.value++
|
|
103
|
+
* },
|
|
104
|
+
* down: (wrapper) => {
|
|
105
|
+
* swipeDirection.value = 'down'
|
|
106
|
+
* swipeDistanceX.value = Math.abs(wrapper.goX)
|
|
107
|
+
* swipeDistanceY.value = wrapper.goY
|
|
108
|
+
* swipeCount.value++
|
|
109
|
+
* }
|
|
110
|
+
* })
|
|
111
|
+
*
|
|
112
|
+
* const touchHandlers = ref({
|
|
113
|
+
* move: (wrapper) => {
|
|
114
|
+
* currentX.value = wrapper.current.x
|
|
115
|
+
* currentY.value = wrapper.current.y
|
|
116
|
+
* moveCount.value++
|
|
117
|
+
*
|
|
118
|
+
* indicatorX.value = wrapper.current.x
|
|
119
|
+
* indicatorY.value = wrapper.current.y
|
|
120
|
+
* }
|
|
121
|
+
* })
|
|
122
|
+
* <//script>
|
|
123
|
+
*
|
|
124
|
+
* <style>
|
|
125
|
+
* .touch-container {
|
|
126
|
+
* font-family: Arial, sans-serif;
|
|
127
|
+
* padding: 20px;
|
|
128
|
+
* max-width: 800px;
|
|
129
|
+
* margin: 0 auto;
|
|
130
|
+
* }
|
|
131
|
+
*
|
|
132
|
+
* h1 {
|
|
133
|
+
* text-align: center;
|
|
134
|
+
* color: #333;
|
|
135
|
+
* margin-bottom: 40px;
|
|
136
|
+
* font-size: 2rem;
|
|
137
|
+
* }
|
|
138
|
+
*
|
|
139
|
+
* .gesture-areas {
|
|
140
|
+
* display: grid;
|
|
141
|
+
* grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
|
|
142
|
+
* gap: 20px;
|
|
143
|
+
* }
|
|
144
|
+
*
|
|
145
|
+
* .gesture-area {
|
|
146
|
+
* background: white;
|
|
147
|
+
* border-radius: 8px;
|
|
148
|
+
* padding: 20px;
|
|
149
|
+
* box-shadow: 0 2px 8px rgba(0,0,0,0.1);
|
|
150
|
+
* }
|
|
151
|
+
*
|
|
152
|
+
* .gesture-area h2 {
|
|
153
|
+
* margin-top: 0;
|
|
154
|
+
* color: #667eea;
|
|
155
|
+
* font-size: 1.2rem;
|
|
156
|
+
* margin-bottom: 15px;
|
|
157
|
+
* text-align: center;
|
|
158
|
+
* }
|
|
159
|
+
*
|
|
160
|
+
* .swipe-box,
|
|
161
|
+
* .position-box {
|
|
162
|
+
* height: 250px;
|
|
163
|
+
* border: 2px solid #dee2e6;
|
|
164
|
+
* border-radius: 6px;
|
|
165
|
+
* padding: 15px;
|
|
166
|
+
* display: flex;
|
|
167
|
+
* flex-direction: column;
|
|
168
|
+
* position: relative;
|
|
169
|
+
* overflow: hidden;
|
|
170
|
+
* cursor: pointer;
|
|
171
|
+
* user-select: none;
|
|
172
|
+
* }
|
|
173
|
+
*
|
|
174
|
+
* .swipe-box {
|
|
175
|
+
* background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
|
|
176
|
+
* }
|
|
177
|
+
*
|
|
178
|
+
* .position-box {
|
|
179
|
+
* background: linear-gradient(135deg, #f0f4ff 0%, #e6e9ff 100%);
|
|
180
|
+
* }
|
|
181
|
+
*
|
|
182
|
+
* .gesture-info {
|
|
183
|
+
* background: white;
|
|
184
|
+
* border-radius: 4px;
|
|
185
|
+
* padding: 10px;
|
|
186
|
+
* margin-bottom: 15px;
|
|
187
|
+
* box-shadow: 0 1px 4px rgba(0,0,0,0.1);
|
|
188
|
+
* }
|
|
189
|
+
*
|
|
190
|
+
* .info-item {
|
|
191
|
+
* display: flex;
|
|
192
|
+
* justify-content: space-between;
|
|
193
|
+
* align-items: center;
|
|
194
|
+
* margin-bottom: 8px;
|
|
195
|
+
* padding: 6px 0;
|
|
196
|
+
* border-bottom: 1px solid #eee;
|
|
197
|
+
* }
|
|
198
|
+
*
|
|
199
|
+
* .info-item:last-child {
|
|
200
|
+
* margin-bottom: 0;
|
|
201
|
+
* border-bottom: none;
|
|
202
|
+
* }
|
|
203
|
+
*
|
|
204
|
+
* .info-item span:first-child {
|
|
205
|
+
* color: #555;
|
|
206
|
+
* font-weight: bold;
|
|
207
|
+
* font-size: 14px;
|
|
208
|
+
* }
|
|
209
|
+
*
|
|
210
|
+
* .value {
|
|
211
|
+
* font-family: monospace;
|
|
212
|
+
* font-weight: bold;
|
|
213
|
+
* padding: 3px 8px;
|
|
214
|
+
* border-radius: 3px;
|
|
215
|
+
* background: #f8f9fa;
|
|
216
|
+
* min-width: 60px;
|
|
217
|
+
* text-align: center;
|
|
218
|
+
* font-size: 13px;
|
|
219
|
+
* }
|
|
220
|
+
*
|
|
221
|
+
* .counter {
|
|
222
|
+
* background: #667eea;
|
|
223
|
+
* color: white;
|
|
224
|
+
* }
|
|
225
|
+
*
|
|
226
|
+
* .direction {
|
|
227
|
+
* background: #ff6b6b;
|
|
228
|
+
* color: white;
|
|
229
|
+
* }
|
|
230
|
+
*
|
|
231
|
+
* .direction.left {
|
|
232
|
+
* background: #4ecdc4;
|
|
233
|
+
* }
|
|
234
|
+
*
|
|
235
|
+
* .direction.right {
|
|
236
|
+
* background: #ffa726;
|
|
237
|
+
* }
|
|
238
|
+
*
|
|
239
|
+
* .direction.up {
|
|
240
|
+
* background: #43e97b;
|
|
241
|
+
* }
|
|
242
|
+
*
|
|
243
|
+
* .direction.down {
|
|
244
|
+
* background: #f093fb;
|
|
245
|
+
* }
|
|
246
|
+
*
|
|
247
|
+
* .instruction {
|
|
248
|
+
* text-align: center;
|
|
249
|
+
* color: #666;
|
|
250
|
+
* font-size: 1rem;
|
|
251
|
+
* margin-top: auto;
|
|
252
|
+
* padding: 15px;
|
|
253
|
+
* background: rgba(255,255,255,0.8);
|
|
254
|
+
* border-radius: 4px;
|
|
255
|
+
* }
|
|
256
|
+
*
|
|
257
|
+
* .touch-indicator {
|
|
258
|
+
* position: absolute;
|
|
259
|
+
* width: 20px;
|
|
260
|
+
* height: 20px;
|
|
261
|
+
* background: #667eea;
|
|
262
|
+
* border-radius: 50%;
|
|
263
|
+
* transform: translate(-50%, -50%);
|
|
264
|
+
* pointer-events: none;
|
|
265
|
+
* box-shadow: 0 0 6px rgba(102, 126, 234, 0.5);
|
|
266
|
+
* }
|
|
267
|
+
* </style>
|
|
268
|
+
* */
|
|
1
269
|
const handleGesture = wrapper => {
|
|
2
270
|
const {
|
|
3
271
|
startX,
|
package/index.js
CHANGED
|
@@ -19,10 +19,10 @@ function breakpoint() {
|
|
|
19
19
|
const height = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight;
|
|
20
20
|
const points = {
|
|
21
21
|
'xs': 0,
|
|
22
|
-
'sm':
|
|
23
|
-
'md':
|
|
24
|
-
'lg':
|
|
25
|
-
'xl':
|
|
22
|
+
'sm': 576,
|
|
23
|
+
'md': 768,
|
|
24
|
+
'lg': 1024,
|
|
25
|
+
'xl': 1440
|
|
26
26
|
}
|
|
27
27
|
let data = {
|
|
28
28
|
points: points,
|
|
@@ -61,7 +61,6 @@ export default {
|
|
|
61
61
|
app.config.globalProperties.$r = reactive(Object.assign({}, {
|
|
62
62
|
prefix: 'r-',
|
|
63
63
|
rtl: false,
|
|
64
|
-
inputs: {tile: false},
|
|
65
64
|
lang: 'en',
|
|
66
65
|
langs:
|
|
67
66
|
{
|
|
@@ -118,8 +117,7 @@ export default {
|
|
|
118
117
|
// renusify validation
|
|
119
118
|
const v = new valid(app.config.globalProperties.$t)
|
|
120
119
|
app.config.globalProperties.$v = (names) => v.checkType(names)
|
|
121
|
-
|
|
122
|
-
app.provide('renusify', {
|
|
120
|
+
let provide = {
|
|
123
121
|
$r: app.config.globalProperties.$r,
|
|
124
122
|
$toast: app.config.globalProperties.$toast,
|
|
125
123
|
$storage: app.config.globalProperties.$storage,
|
|
@@ -130,7 +128,11 @@ export default {
|
|
|
130
128
|
$d: app.config.globalProperties.$d,
|
|
131
129
|
$n: app.config.globalProperties.$n,
|
|
132
130
|
$v: app.config.globalProperties.$v,
|
|
133
|
-
}
|
|
131
|
+
}
|
|
132
|
+
if (app.config.globalProperties.$r.useNotify) {
|
|
133
|
+
provide.$notify = app.config.globalProperties.$notify
|
|
134
|
+
}
|
|
135
|
+
app.provide('renusify', provide)
|
|
134
136
|
|
|
135
137
|
// install components
|
|
136
138
|
let required_directive = _register(app, options['components'] || {});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "renusify",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0",
|
|
4
4
|
"description": "Vue3 Framework",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"vuejs",
|
|
@@ -23,5 +23,8 @@
|
|
|
23
23
|
"email": "ba.smko@gmail.com"
|
|
24
24
|
},
|
|
25
25
|
"license": "BSD",
|
|
26
|
-
"private": false
|
|
26
|
+
"private": false,
|
|
27
|
+
"scripts": {
|
|
28
|
+
"docs:generate": "node scripts/generate-docs.mjs"
|
|
29
|
+
}
|
|
27
30
|
}
|
|
@@ -4,8 +4,17 @@ export default class Validate {
|
|
|
4
4
|
}
|
|
5
5
|
|
|
6
6
|
required() {
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
const msg = this.$t('required_error', 'renusify');
|
|
8
|
+
|
|
9
|
+
return (v) => {
|
|
10
|
+
const isEmpty =
|
|
11
|
+
v == null ||
|
|
12
|
+
(typeof v === 'string' && v.trim() === '') ||
|
|
13
|
+
(Array.isArray(v) && v.length === 0) ||
|
|
14
|
+
(typeof v === 'object' && Object.keys(v).length === 0);
|
|
15
|
+
|
|
16
|
+
return !isEmpty || msg;
|
|
17
|
+
}
|
|
9
18
|
}
|
|
10
19
|
|
|
11
20
|
requiredArray() {
|
|
@@ -14,83 +23,83 @@ export default class Validate {
|
|
|
14
23
|
|
|
15
24
|
email() {
|
|
16
25
|
return (v) => (v && v.length > 0 ? /^\w+([.-]?\w+)*@\w+([.-]?\w+)*(\.\w{2,3})+$/.test(v) : true) || this.$t('validate_email', 'renusify');
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
url() {
|
|
29
|
+
return (v) => (v && v.length > 0 ? /^((https?|ftp|smtp):\/\/)?(www.)?[a-z0-9]+\.[a-z]+(\/[a-zA-Z0-9#]+\/?)*$/.test(v) : true) || this.$t('validate_url', 'renusify');
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
match(val) {
|
|
33
|
+
return (v) => {
|
|
34
|
+
if (v == val) {
|
|
35
|
+
return true
|
|
36
|
+
} else {
|
|
37
|
+
return this.$t(['validate_match', [val]], 'renusify');
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
phone() {
|
|
43
|
+
return (v) => (v && v.length > 0 ? /^[+]?[(]?[0-9]{3}[)]?[-\s.]?[0-9]{3}[-\s.]?[0-9]{4}$/.test(v) : true) || this.$t('validate_phone', 'renusify');
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
number() {
|
|
47
|
+
return (v) => (v && v.length > 0 ? /^([0-9.])*$/.test(v) : true) || this.$t('numeric_error', 'renusify');
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
english() {
|
|
51
|
+
return (v) => (v && v.length > 0 ? /^([0-9a-zA-Z])*$/.test(v) : true) || this.$t('english_error', 'renusify');
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
min_len(num) {
|
|
55
|
+
return v => (v && v.length > 0 ? v.length >= parseInt(num) ? true : this.$t(['min_len_error', [num, v.length]], 'renusify') : true)
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
max_len(num) {
|
|
59
|
+
return v => (v && v.length > 0 ? v.length <= parseInt(num) ? true : this.$t(['max_len_error', [num, v.length]], 'renusify') : true)
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
len(num) {
|
|
63
|
+
return v => (v && v.length > 0 ? v.length === parseInt(num) ? true : this.$t(['len_error', [num, v.length]], 'renusify') : true) || msg
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
min(num) {
|
|
67
|
+
return v => (v ? parseFloat(v) >= parseFloat(num) ? true : this.$t(['min_error', [num, parseFloat(v)]], 'renusify') : true)
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
max(num) {
|
|
71
|
+
return v => (v ? parseFloat(v) <= parseFloat(num) ? true : this.$t(['max_error', [num, parseFloat(v)]], 'renusify') : true)
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
eq(num) {
|
|
75
|
+
return v => (v ? parseFloat(v) === parseFloat(num) : true) || this.$t(['validate_eq', [num]], 'renusify');
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
notDefined(name) {
|
|
79
|
+
return v => this.$t(['validate_notDefined', [name]], 'renusify');
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
checkType(names) {
|
|
83
|
+
let filters = [];
|
|
84
|
+
if (Array.isArray(names)) {
|
|
85
|
+
names.forEach((name) => {
|
|
86
|
+
let res = name.split(':');
|
|
87
|
+
let par1 = res[1] ? res[1] : null;
|
|
88
|
+
let par2 = res[2] ? res[2] : null;
|
|
89
|
+
let par3 = res[3] ? res[3] : null;
|
|
90
|
+
if (this[res[0]]) {
|
|
91
|
+
if (par3 === null && par2 === null) {
|
|
92
|
+
filters.push(this[res[0]](par1))
|
|
93
|
+
} else if (par3 === null) {
|
|
94
|
+
filters.push(this[res[0]](par1, par2))
|
|
95
|
+
} else {
|
|
96
|
+
filters.push(this[res[0]](par1, par2, par3))
|
|
97
|
+
}
|
|
98
|
+
} else {
|
|
99
|
+
filters.push(this.notDefined(name))
|
|
100
|
+
}
|
|
101
|
+
})
|
|
91
102
|
}
|
|
92
|
-
|
|
103
|
+
return filters
|
|
93
104
|
}
|
|
94
|
-
return filters
|
|
95
|
-
}
|
|
96
105
|
}
|