arisu.js 1.0.4 → 2.0.1-beta.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.
Files changed (48) hide show
  1. package/README.md +19 -14
  2. package/dist/arisu.commonjs.js +1 -0
  3. package/dist/arisu.esm.js +1 -0
  4. package/dist/arisu.umd.js +1 -0
  5. package/dist/types/index.d.ts +19 -0
  6. package/dist/types/index.d.ts.map +1 -0
  7. package/dist/types/js/base.d.ts +152 -0
  8. package/dist/types/js/base.d.ts.map +1 -0
  9. package/dist/types/js/main.d.ts +5 -0
  10. package/dist/types/js/main.d.ts.map +1 -0
  11. package/dist/types/js/utils/AeLoader.d.ts +10 -0
  12. package/dist/types/js/utils/AeLoader.d.ts.map +1 -0
  13. package/dist/types/js/utils/BtnEf.d.ts +9 -0
  14. package/dist/types/js/utils/BtnEf.d.ts.map +1 -0
  15. package/dist/types/js/utils/Flash.d.ts +34 -0
  16. package/dist/types/js/utils/Flash.d.ts.map +1 -0
  17. package/dist/types/js/utils/GoTop.d.ts +9 -0
  18. package/dist/types/js/utils/GoTop.d.ts.map +1 -0
  19. package/dist/types/js/utils/HoverDir.d.ts +29 -0
  20. package/dist/types/js/utils/HoverDir.d.ts.map +1 -0
  21. package/dist/types/js/utils/IAccordion.d.ts +17 -0
  22. package/dist/types/js/utils/IAccordion.d.ts.map +1 -0
  23. package/dist/types/js/utils/IList.d.ts +12 -0
  24. package/dist/types/js/utils/IList.d.ts.map +1 -0
  25. package/dist/types/js/utils/ILoader.d.ts +24 -0
  26. package/dist/types/js/utils/ILoader.d.ts.map +1 -0
  27. package/dist/types/js/utils/IPagination.d.ts +15 -0
  28. package/dist/types/js/utils/IPagination.d.ts.map +1 -0
  29. package/dist/types/js/utils/ItemCount.d.ts +11 -0
  30. package/dist/types/js/utils/ItemCount.d.ts.map +1 -0
  31. package/dist/types/js/utils/LineEffect.d.ts +43 -0
  32. package/dist/types/js/utils/LineEffect.d.ts.map +1 -0
  33. package/dist/types/js/utils/NiceSelect.d.ts +14 -0
  34. package/dist/types/js/utils/NiceSelect.d.ts.map +1 -0
  35. package/dist/types/js/utils/PopoverSearch.d.ts +16 -0
  36. package/dist/types/js/utils/PopoverSearch.d.ts.map +1 -0
  37. package/dist/types/js/utils/SubmitFlag.d.ts +12 -0
  38. package/dist/types/js/utils/SubmitFlag.d.ts.map +1 -0
  39. package/package.json +32 -6
  40. package/dist/arisu.commonjs.min.js +0 -1
  41. package/dist/arisu.js +0 -4985
  42. package/dist/arisu.min.js +0 -1
  43. package/dist/arisu.module.min.js +0 -1
  44. package/dist/arisu.window.min.js +0 -1
  45. package/src/js/base.js +0 -2000
  46. package/src/js/main.js +0 -594
  47. package/src/js/utils.js +0 -2304
  48. package/webpack.config.js +0 -137
package/src/js/main.js DELETED
@@ -1,594 +0,0 @@
1
- import b, * as u from "./utils";
2
-
3
- /* ========================================================================
4
- * 实际开发常用方法及模块插件扩展或初始化,需要依赖jQuery的插件建议本地安装jQuery,而不是引入全局
5
- * ========================================================================
6
- //使用范例
7
- import { b, u, m } from 'ilib/main'
8
-
9
- 1. Main类,用户常用登录登出token设置获取等操作
10
- 2. handlebars模板判断表达式支持,不依赖其他框架:b.handlebars(Handlebars);
11
- 3. bootstrap 文本提示框,依赖bootstrap
12
- <a href="#" class="me-1 js-detail"><i class="bi bi-search"></i></a>
13
- import { Tooltip } from 'glib/bootstrap';
14
- b.tip(Tooltip);
15
- 4. 全部隐藏bootstrap 文本提示框,依赖bootstrap
16
- 5. jquery滚屏插件owl.carousel默认参数调用,单图可直接使用https://arisu.cn/springmvc/api/5#bootstrap-carousel,依赖jQuery
17
- <div id="carousel-image" class="owl-carousel owl-theme">
18
- <div class="item thumbnail"><img src="//arisu.cn/file/images/res/anime/anime1470402086147.jpg"></img></div>
19
- <div class="item thumbnail">....
20
- b.owl($("#carousel-image"), {});
21
- 6. 消息弹框,依赖jQuery:b.al("你好,世界", 'success');
22
- 7. 确定框,依赖jQuery:
23
- b.cf("是否确定删除该记录!", "删除", () => {
24
- b.al("删除成功!", "success");
25
- }, 2, "ice");
26
- 8. meanmenu导出菜单,npm安装版本有BUG,只能用本地的,依赖jQuery
27
- 9. textillate文字特效,依赖jQuery
28
- 10. jquery.form表单提交工具,依赖jQuery
29
- 11. air-datepicker时间控件,不依赖其他框架
30
- 12. niceScroll滚动条,依赖jQuery
31
- 13. validationEngine表单验证,依赖jQuery
32
- 14. validate确认是否验证通过
33
-
34
- * ======================================================================== */
35
-
36
- // 1. Main类,用户常用登录登出token设置获取等操作
37
- class Main {
38
- // 用户登录
39
- login(userParam) {
40
- let user = { id: userParam.id, name: userParam.nickname, menus: userParam.menu };
41
- localStorage.setItem("user", JSON.stringify(user));
42
- localStorage.setItem("token", userParam.token);
43
- }
44
-
45
- // 用户注销登录
46
- logout() {
47
- return new Promise(( ) => {
48
- localStorage.removeItem("user");
49
- localStorage.removeItem("token");
50
- });
51
- }
52
-
53
- // 获取当前用户
54
- getUser() { return JSON.parse(localStorage.getItem("user")); }
55
-
56
- // 获取当前用户token
57
- getToken() { return localStorage.getItem("token"); }
58
-
59
- // 设置当前用户token
60
- setToken(token) { localStorage.setItem("token", token); }
61
- }
62
-
63
-
64
- // base类扩展
65
-
66
- // 2. handlebars模板判断表达式支持,不依赖jQuery等框架
67
- function handlebars(h) {
68
- if (typeof h !== 'undefined') {
69
- //等于
70
- h.registerHelper("if", function(v1, v2, options) {
71
- return (v1 === v2) ? options.fn(this) : options.inverse(this);
72
- });
73
- //小于
74
- h.registerHelper("lt", function(v1, v2, options) {
75
- return (v1 < v2) ? options.fn(this) : options.inverse(this);
76
- });
77
- //大于
78
- h.registerHelper("rt", function(v1, v2, options) {
79
- return (v1 > v2) ? options.fn(this) : options.inverse(this);
80
- });
81
- //小于等于
82
- h.registerHelper("lte", function(v1, v2, options) {
83
- return (v1 <= v2) ? options.fn(this) : options.inverse(this);
84
- });
85
- //大于等于
86
- h.registerHelper("rte", function(v1, v2, options) {
87
- return (v1 >= v2) ? options.fn(this) : options.inverse(this);
88
- });
89
- }
90
- }
91
- b['handlebars'] = handlebars;
92
-
93
- // 3. bootstrap 文本提示框,<a href="#" class="me-1 js-detail"><i class="bi bi-search"></i></a> import { Tooltip } from 'glib/bootstrap';
94
- // b.tip(Tooltip); //依赖bootstrap
95
- function tip(tooltip) {
96
- b(".be-detail").attr('data-bs-title', '详细页').attr('data-bs-toggle', 'tooltip').attr('data-bs-custom-class', 'be-tooltip');
97
- b(".be-edit").attr('data-bs-title', '编辑页').attr('data-bs-toggle', 'tooltip').attr('data-bs-custom-class', 'be-tooltip');
98
- b(".be-delete").attr('data-bs-title', '删除').attr('data-bs-toggle', 'tooltip').attr('data-bs-custom-class', 'be-tooltip');
99
- const tooltipTriggerList = document.querySelectorAll('[data-bs-toggle="tooltip"]');
100
- [...tooltipTriggerList].map(tooltipTriggerEl => new tooltip(tooltipTriggerEl));
101
- }
102
- b['tip'] = tip;
103
-
104
- // 4. 全部隐藏bootstrap 文本提示框,依赖bootstrap
105
- function tipHide() {
106
- b(".tooltip").removeClass("show");
107
- }
108
- b['tipHide'] = tipHide;
109
-
110
- // 5. jquery滚屏插件owl.carousel默认参数调用:npm i owl.carousel@2.3.4,依赖jQuery
111
- function owl($target, options) {
112
- options = b.extend(options, {
113
- loop: true,
114
- // animateOut: "animate__animated animate__slideOutDown",
115
- // animateIn: "animate__animated animate__fadeIn",
116
- margin: 0,
117
- nav: true,
118
- smartSpeed: 500,
119
- autoHeight: false,
120
- autoplay: true,
121
- dots: true,
122
- items: 4,
123
- autoplayTimeout: 7000,
124
- navText: [
125
- '<div class="mn-carousel-left"><i class="bi bi-chevron-left"></i></div>', '<div class="mn-carousel-right"><i class="bi bi-chevron-right"></i></div>'
126
- ],
127
- responsive: {
128
- 0: { items: 1 }, 600: { items: 1 }, 800: { items: 1 }, 1024: { items: 4 }, 1500: { items: 5 }, 1900: { items: 6 }
129
- },
130
- onInitialized: () => {
131
- // $(".ix-cd-1").textillate({
132
- // in: {effect: "animate__animated animate__fadeInLeftBig", sequence: false, sync: false, shuffle: false, reverse: true}
133
- // });
134
- // $(".ix-cd-2").textillate({in: {effect: "animate__animated animate__fadeInRightBig"}});
135
- // $(".ix-cd-3").textillate({in: {effect: "animate__animated animate__wobble"}});
136
- // $(".ix-cd-4").textillate({in: {effect: "animate__animated animate__fadeInUp"}});
137
- // $(".ix-cd-5").textillate({in: {effect: "animate__animated animate__fadeInDown"}});
138
- },
139
- onChanged: () => {
140
- // //debug($( ".owl-item:eq(" + this.currentItem +")"));
141
- // //alert($(".mn-cd-1", ".owl-item:eq(" + this.currentItem +")").html());
142
- // //$(".ix-cd-1, .ix-cd-2, .ix-cd-3, .ix-cd-4, .ix-cd-5", ".owl-item:eq(" + this.currentItem +")").textillate("start");
143
- // $(".ix-cd-1, .ix-cd-2, .ix-cd-3, .ix-cd-4, .ix-cd-5", ".owl-item:eq(" + e.item.index +")").textillate("start");
144
- }
145
- } );
146
- $target.owlCarousel(options);
147
- }
148
- b['owl'] = owl;
149
-
150
-
151
- /**
152
- * 消息框参数设置:messageInit('info', 1, 2)
153
- * @param type info / error / success
154
- * @param classes 消息位置(2:顶部 / 6:左下下) ,按顺时针显示
155
- * @param theme 样式(2:黑色), 1:flat、2:future、3:block、4:air、5:ice
156
- **/
157
- function messageInit(type, classes, theme) {
158
- // 弹框样式,需要导入对应CSS
159
- if (theme === 1) {
160
- theme = "flat";
161
- } else if (theme === 2) {
162
- theme = "future";
163
- } else if (theme === 3) {
164
- theme = "block";
165
- } else if (theme === 4) {
166
- theme = "air";
167
- } else if (theme === 5) {
168
- theme = "ice";
169
- } else {
170
- theme = "ice";
171
- }
172
- let options = b.extend({ type: type, classes: classes, theme: theme }, { type: "info", classes: 3, theme: "ice" });
173
-
174
- // 弹框弹出位置
175
- let extraClasses;
176
- if (options.classes === 1) {
177
- extraClasses = "messenger-fixed messenger-theme-" + options.theme + " messenger-on-top messenger-on-left";
178
- } else if (options.classes === 2) {
179
- extraClasses = "messenger-fixed messenger-theme-" + options.theme + " messenger-on-top";
180
- } else if (options.classes === 3) {
181
- extraClasses = "messenger-fixed messenger-theme-" + options.theme + " messenger-on-top messenger-on-right";
182
- } else if (options.classes === 4) {
183
- extraClasses = "messenger-fixed messenger-theme-" + options.theme + " messenger-on-bottom messenger-on-right";
184
- } else if (options.classes === 5) {
185
- extraClasses = "messenger-fixed messenger-theme-" + options.theme + " messenger-on-bottom";
186
- } else if (options.classes === 6) {
187
- extraClasses = "messenger-fixed messenger-theme-" + options.theme + " messenger-on-bottom messenger-on-left";
188
- } else {
189
- extraClasses = "messenger-fixed messenger-theme-" + options.theme + " messenger-on-top";
190
- }
191
-
192
- // 初始化设置
193
- Messenger.options = {
194
- extraClasses: extraClasses,
195
- theme: options.theme
196
- }
197
- }
198
-
199
- /**
200
- * 6. 消息弹框:npm i messenger-hubspot@1.5.0-b2
201
- * @param message 消息
202
- * @param type info / error / success
203
- * @param classes 消息位置(2:顶部 / 6:左下下) ,按顺时针显示
204
- * @param theme 样式(2:黑色)
205
- <pre>
206
- import 'messenger-hubspot/build/css/messenger.css';
207
- import 'messenger-hubspot/build/css/messenger-spinner.css';
208
- import 'messenger-hubspot/build/css/messenger-theme-flat.css';
209
- import 'messenger-hubspot/build/css/messenger-theme-future.css';
210
- import 'messenger-hubspot/build/css/messenger-theme-block.css';
211
- import 'messenger-hubspot/build/css/messenger-theme-air.css';
212
- import 'messenger-hubspot/build/css/messenger-theme-ice.css';
213
-
214
- import 'messenger-hubspot/build/js/messenger.min.js';
215
- import 'messenger-hubspot/build/js/messenger-theme-flat.js';
216
-
217
- b.al("你好,世界", 'success', 3, 4);
218
- </pre>
219
- **/
220
- function al(message, type, classes, theme) {
221
- messageInit(type, classes, theme);
222
- Messenger().post({
223
- message: message,
224
- type: type,
225
- hideAfter: 5,
226
- showCloseButton: true
227
- });
228
- }
229
- b['al'] = al;
230
-
231
- /**
232
- * 7. message插件方法封装 - 确定框
233
- * @param message 消息
234
- * @param label 按钮文字
235
- * @param fun 回调方法
236
- * @param classes 消息位置(2:顶部 / 6:左下下) ,按顺时针显示
237
- * @param theme 样式(2:黑色)
238
- <pre>
239
- b.cf("是否确定删除该记录!", "删除", () => {
240
- b.al("删除成功!", "success");
241
- }, 2, "ice");
242
- </pre>
243
- */
244
- function cf(message, label, fun, classes, theme) {
245
- Messenger().hideAll();
246
-
247
- messageInit('info', classes, theme);
248
- Messenger().post({
249
- message: message,
250
- actions: {
251
- retry: {
252
- label: label,
253
- phrase: "",
254
- auto: false,
255
- delay: 10,
256
- action: function() {
257
- Messenger().hideAll();
258
- fun();
259
- }
260
- },
261
- cancel: {
262
- label: "取消",
263
- action: function() {
264
- Messenger().hideAll();
265
- return false;
266
- }
267
- }
268
- }
269
- });
270
- }
271
- b['cf'] = cf;
272
-
273
- /**
274
- * 8. meanmenu导出菜单,npm安装版本有BUG,只能用本地的:...\WebTemplate\WebRoot\WEB\js\meanMenu,依赖jQuery
275
- * @param $target jQuery选择器
276
- * @param options 参数
277
- <pre>
278
- <div class="collapse navbar-collapse mean-menu">
279
- <ul class="navbar-nav m-auto">
280
- <li class="nav-item">
281
- <a href="index.html" class="nav-link ce-a">首页</a>
282
- </li>
283
- <li class="nav-item">
284
- <a href="#" class="nav-link ce-a">关于我们</a>
285
- <ul class="dropdown-menu">
286
- <li class="nav-item">
287
- <a href="about1info.html" class="nav-link">公司简介</a>
288
- </li>
289
- <li class="nav-item">
290
- <a href="about2system.html" class="nav-link">组织架构</a>
291
- </li>
292
- <li class="nav-item">
293
- <a href="about3team.html" class="nav-link">管理团队</a>
294
- </li>
295
- </ul>
296
- </li>
297
- </ul>
298
- </div>
299
-
300
- import './plugin/meanMenu/meanmenu.min.css'
301
- import './plugin/meanMenu/meanmenu.min'
302
-
303
- b.meanmenu($('.mean-menu'));
304
- </pre>
305
- */
306
- function meanmenu($target, options) {
307
- options = b.extend(options, { meanScreenWidth: "991" })
308
- $target.meanmenu(options);
309
- }
310
- b['meanmenu'] = meanmenu;
311
-
312
- /**
313
- * 9. textillate文字特效,依赖animate.v4.css:npm i textillate@0.4.1,依赖jQuery
314
- * @param $target jQuery选择器
315
- * @param options 参数
316
- <pre>
317
- import '../css/animate.v4.css'
318
- import 'textillate/assets/jquery.fittext.js'
319
- import 'textillate/assets/jquery.lettering.js'
320
- import 'textillate/jquery.textillate.js'
321
-
322
- b.textillate(".ix-cd-1",{
323
- in: {effect: "animate__animated animate__fadeInLeftBig", sequence: false, sync: false, shuffle: false, reverse: true}
324
- });
325
- or
326
- b.textillate(".ix-cd-1, .ix-cd-2, .ix-cd-3, .ix-cd-4, .ix-cd-5", ".owl-item:eq(" + e.item.index +")", {"start"});
327
-
328
- </pre>
329
- */
330
- function textillate($target, options) {
331
- // options = b.extend(options, { meanScreenWidth: "991" })
332
- $target.textillate(options);
333
- }
334
- b['textillate'] = textillate;
335
-
336
- /**
337
- * 10. jquery.form表单提交工具:npm i jquery-form@4.3.0,可能有点问题还要用 npm i jquery-form@3.50.0,依赖jQuery
338
- * @param $target jQuery选择器
339
- * @param options 参数
340
- <pre>
341
- <form id="myForm" action="./springmvc/news/findNews.action">
342
- <input name="page" type="text" value="1" />
343
- <input name="rp" type="text" value="15" />
344
- <input name="sortname" type="text" value="a.id" />
345
- <input name="sortorder" type="text" value="desc" />
346
- <input name="query" type="text" value="" />
347
- <input name="qtype" type="text" value="project" />
348
- <button type="submit" value="submit">submit</button>
349
- <button type="reset" value="reset">reset</button>
350
- </form>
351
-
352
- const $target = $("#myForm");
353
- b.formSubmit($target, {
354
- //formData:页面表单数据
355
- //jqForm: 表单jquery dom信息
356
- //options:参数
357
- beforeSubmit: function(formData, jqForm, options) {
358
- //调用前
359
- let result = false;
360
- if ($target.is(jqForm)) {
361
- // let isSuccessed = $target.validationEngine("validate");
362
- // if (isSuccessed) {}
363
- formData.push({
364
- name: "title",
365
- required: false,
366
- type: "text",
367
- value: "美国"
368
- });
369
- result = true;
370
- }
371
- return result;
372
- },
373
- //responseText:请求需要数据
374
- //statusText: 状态码文本
375
- //xhr:xhr信息
376
- //$form: 表单jquery dom信息
377
- success: function(responseText, statusText, xhr, $form) {
378
- if (responseText.result === "200") {
379
- b.al(responseText.message, "info", 3);
380
- // window.location.href = "../manage#/news";
381
- } else {
382
- b.al(responseText.message, "error", 3);
383
- }
384
- },
385
- error: () => {}
386
- })
387
- </pre>
388
- **/
389
- function formSubmit($target, options) {
390
- options = b.extend(options, {
391
- clearForm: false, //是否清空表单
392
- resetForm: false, //是否重置表单
393
- type: "post",
394
- dataType: "json",
395
- timeout: 30000,
396
- });
397
- $target.submit(() => {
398
- try {
399
- $target.ajaxSubmit(options);
400
- } catch (e) { console.log(e); }
401
- return false;
402
- });
403
- }
404
- b['formSubmit'] = formSubmit;
405
-
406
- /**
407
- * 11. air-datepicker时间控件,不依赖其他框架:npm i air-datepicker@3.5.3
408
- * @param AirDatepicker import AirDatepicker的日期组件
409
- * @param localeZh import localeZh的中文支持
410
- * @param options 参数
411
- <pre>
412
- <input id="airDatepicker" type="text" placeholder="时间">
413
- <button id="airDatepickerBth" class="btn btn-danger">获取时间</button>
414
-
415
- import AirDatepicker from 'glib/air-datepicker'
416
- import localeZh from 'glib/air-datepicker/locale/zh';
417
- import 'glib/air-datepicker/air-datepicker.css'
418
- import 'istyle/src/css/form/fm-datepicker.css'
419
-
420
- const ad = b.datepicker(AirDatepicker, localeZh)
421
- b("#airDatepickerBth").click(() => {
422
- b.l(ad.selectedDates[0].format("yyyy-MM-dd hh:mm:ss"))
423
- })
424
- </pre>
425
- **/
426
- function datepicker(AirDatepicker, localeZh, options) {
427
- options = b.extend(options, {
428
- target: '#airDatepicker',
429
- classes: 'fm-datepicker',
430
- autoClose: true,
431
- inline: false,
432
- timepicker: true,
433
- buttons: ['today', 'clear'],
434
- locale: localeZh,
435
- dateFormat(date) {
436
- return date.format("yyyy年MM月dd日 hh:mm:ss")
437
- }
438
- });
439
- return new AirDatepicker(options.target, options);
440
- }
441
- b['datepicker'] = datepicker;
442
-
443
- /**
444
- * 12. niceScroll滚动条, npm i jquery.nicescroll,依赖jQuery
445
- * @param $target jQuery选择器
446
- * @param options 参数
447
- <pre>
448
- //最好不用在body和html上设置,设置的标签要有高度,且内部元素高度超出它,在线安装可能有问题
449
- import './plugin/jquery.nicescroll/jquery.nicescroll.min'
450
- b.niceScroll($('.container'));
451
- </pre>
452
- **/
453
- function niceScroll($target, options) {
454
- options = b.extend(options, {
455
- styler : "fb",
456
- cursorcolor : "#999",
457
- cursorwidth : "6",
458
- cursorborderradius : "0px",
459
- background : "#fff",
460
- spacebarenabled : false,
461
- cursorborder : "",
462
- smoothscroll: true, // ease动画滚动
463
- scrollspeed: 100,
464
- mousescrollstep: 100, //滚轮滚动速度
465
- zindex : "1000"
466
- });
467
- $target.niceScroll(options);
468
-
469
- window.addEventListener('resize', () => {
470
- $target.getNiceScroll().resize();
471
- });
472
- }
473
- b['niceScroll'] = niceScroll;
474
-
475
-
476
- /**
477
- * 13. validationEngine表单验证,高版本jQuery需要把jquery.validationEngine.js里面的size()方法换成length,依赖jQuery
478
- 官网:https://github.com/posabsolute/jQuery-Validation-Engine
479
- * @param $target jQuery选择器
480
- * @param options 参数
481
- <pre>
482
- <form id="form-1" method="post" action="javascript:">
483
- <ul class="list-unstyled">
484
- <li>
485
- <div class="login">异步验证: </div>
486
- <input class="validate[ajax[validate]]" data-tag="1001" type="text" id="email" value="mikoarisu@gmail.com" />
487
- </li>
488
- </ul>
489
- </form>
490
-
491
- <form id="form-2" method="post" action="#">
492
- <ul class="">
493
- <li>
494
- <div class="login">必须为5 - 20之间的数字: </div>
495
- <input type="text" value="123a" class="validate[required,custom[number],min[5],max[20]]"/>
496
- </li>
497
- <li>
498
- <div class="login">[日期必须介于2009-01-01,2009-12-31之间]: </div>
499
- <input type="text" id="birthday" value="2029-01-01"
500
- class="validate[required,custom[date],future[2009-01-01],past[2009-12-31]]"/>
501
- </li>
502
- <li>
503
- <div class="login">必须选择两项 : </div>
504
- <input class="validate[minCheckbox[2]]" type="checkbox" name="group1" id="maxcheck1" value="5"/>a
505
- <input class="validate[minCheckbox[2]]" type="checkbox" name="group1" id="maxcheck2" value="3"/>b
506
- <input class="validate[minCheckbox[2]]" type="checkbox" name="group1" id="maxcheck3" value="9"/>c
507
- </li>
508
- <li>
509
- <div class="login">输入框长度在5 - 20: </div>
510
- <input type="text" class="validate[minSize[5], maxSize[20]]" value="3"/>
511
- </li>
512
- <li>
513
- <div class="login">url验证: </div>
514
- <input type="text" class="validate[custom[url]]" value="aa"/>
515
- </li>
516
- <li>
517
- <div class="login">不能为特殊字符: </div>
518
- <input type="text" class="validate[custom[unSp]]" value="#"/>
519
- </li>
520
- <li>
521
- <div class="login">密码: </div>
522
- <input id="psw" type="text" value="cc"/>
523
- </li>
524
- <li>
525
- <div class="login">密码再输入一次验证:validate[equals[psw]]其中psw为上一个密码ID</div>
526
- <input type="password" class="validate[equals[psw]]" value="cc3"/>
527
- </li>
528
- <li>
529
- <div class="login">ipv4验证: </div>
530
- <input type="text" class="validate[custom[ipv4]]" value="cc3"/>
531
- </li>
532
- <li>
533
- <div class="login">不能纯数字: </div>
534
- <input type="text" class="validate[validate[custom[noOnlyNum]]]" value="111"/>
535
- </li>
536
- <li class="padding-top-20">
537
- <button id="ve-1" type="button" class="btn btn-danger">表单验证</button>
538
- </li>
539
- </ul>
540
- </form>
541
-
542
- // input中常用class
543
- validate[required, maxSize[50]] 最大50个字符
544
- validate[required, max[150]] 最大值为150
545
- validate[required,custom[onlyLetterNumber]]
546
- validate[required,ajax[checkWordContent]]
547
- validate[required, custom[url]]
548
- validate[custom[onlyLetterNumber2]]
549
- validate[required,custom[email]]
550
- validate[required, custom[number], min[3], max[150]]
551
-
552
- import './plugin/validationEngine/css/validationEngine.jquery.css'
553
- import 'istyle/src/css/form/fm-validation.css';
554
- import './plugin/validationEngine/js/jquery.validationEngine'
555
- import './plugin/validationEngine/js/languages/jquery.validationEngine-zh_CN'
556
- b.validationEngine($("#form-1, #form-2"));
557
- b("#validate-btn-1").click(() => {
558
- const isSuccessed = b.validate($("#form-1"), 'validate');
559
- b.l(isSuccessed)
560
- })
561
- b("#validate-btn-2").click(() => {
562
- const isSuccessed = b.validate($("#form-2"), 'validate');
563
- b.l(isSuccessed)
564
- })
565
- </pre>
566
- **/
567
- function validationEngine($target, options) {
568
- options = b.extend(options, {
569
- focusFirstField : false,
570
- validationEventTrigger: "click",
571
- promptPosition: "topRight"
572
- });
573
- $target.validationEngine(options);
574
- }
575
- b['validationEngine'] = validationEngine;
576
-
577
- /**
578
- * 14. validationEngine表单验证,确认是否验证通过
579
- * @param $target jQuery选择器
580
- * @param command 字符串方法名
581
- * @param options 新参数
582
- <pre>
583
- const isSuccessed = b.validate($("#form-2"));
584
- </pre>
585
- **/
586
- function validate($target, command, options) {
587
- const os = b.extend( { command: command }, { command: "validate", options });
588
- return $target.validationEngine(os.command, os.options);
589
- }
590
- b['validate'] = validate;
591
-
592
-
593
- export { b, u, Main as m };
594
- export default b;