arisu.js 1.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/src/js/main.js ADDED
@@ -0,0 +1,587 @@
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
+ function messageInit(type, classes, theme) {
153
+ // 弹框样式,需要导入对应CSS
154
+ if (theme === 1) {
155
+ theme = "flat";
156
+ } else if (theme === 2) {
157
+ theme = "future";
158
+ } else if (theme === 3) {
159
+ theme = "block";
160
+ } else if (theme === 4) {
161
+ theme = "air";
162
+ } else if (theme === 5) {
163
+ theme = "ice";
164
+ } else {
165
+ theme = "ice";
166
+ }
167
+ let options = b.extend({ type: type, classes: classes, theme: theme }, { type: "info", classes: 3, theme: "ice" });
168
+
169
+ // 弹框弹出位置
170
+ let extraClasses;
171
+ if (options.classes === 1) {
172
+ extraClasses = "messenger-fixed messenger-theme-" + options.theme + " messenger-on-top messenger-on-left";
173
+ } else if (options.classes === 2) {
174
+ extraClasses = "messenger-fixed messenger-theme-" + options.theme + " messenger-on-top";
175
+ } else if (options.classes === 3) {
176
+ extraClasses = "messenger-fixed messenger-theme-" + options.theme + " messenger-on-top messenger-on-right";
177
+ } else if (options.classes === 4) {
178
+ extraClasses = "messenger-fixed messenger-theme-" + options.theme + " messenger-on-bottom messenger-on-right";
179
+ } else if (options.classes === 5) {
180
+ extraClasses = "messenger-fixed messenger-theme-" + options.theme + " messenger-on-bottom";
181
+ } else if (options.classes === 6) {
182
+ extraClasses = "messenger-fixed messenger-theme-" + options.theme + " messenger-on-bottom messenger-on-left";
183
+ } else {
184
+ extraClasses = "messenger-fixed messenger-theme-" + options.theme + " messenger-on-top";
185
+ }
186
+
187
+ // 初始化设置
188
+ Messenger.options = {
189
+ extraClasses: extraClasses,
190
+ theme: options.theme
191
+ }
192
+ }
193
+
194
+ /**
195
+ * 6. 消息弹框:npm i messenger-hubspot@1.5.0-b2
196
+ * @param message 消息
197
+ * @param type info / error / success
198
+ * @param classes 消息位置(2:顶部 / 6:左下下) ,按顺时针显示
199
+ * @param theme 样式(2:黑色)
200
+ <pre>
201
+ import 'messenger-hubspot/build/css/messenger.css';
202
+ import 'messenger-hubspot/build/css/messenger-spinner.css';
203
+ import 'messenger-hubspot/build/css/messenger-theme-flat.css';
204
+ import 'messenger-hubspot/build/css/messenger-theme-future.css';
205
+ import 'messenger-hubspot/build/css/messenger-theme-block.css';
206
+ import 'messenger-hubspot/build/css/messenger-theme-air.css';
207
+ import 'messenger-hubspot/build/css/messenger-theme-ice.css';
208
+
209
+ import 'messenger-hubspot/build/js/messenger.min.js';
210
+ import 'messenger-hubspot/build/js/messenger-theme-flat.js';
211
+
212
+ b.al("你好,世界", 'success', 3, 4);
213
+ </pre>
214
+ **/
215
+ function al(message, type, classes, theme) {
216
+ messageInit(type, classes, theme);
217
+ Messenger().post({
218
+ message: message,
219
+ type: type,
220
+ hideAfter: 5,
221
+ showCloseButton: true
222
+ });
223
+ }
224
+ b['al'] = al;
225
+
226
+ /**
227
+ * 7. message插件方法封装 - 确定框
228
+ * @param message 消息
229
+ * @param label 按钮文字
230
+ * @param fun 回调方法
231
+ * @param classes 消息位置(2:顶部 / 6:左下下) ,按顺时针显示
232
+ * @param theme 样式(2:黑色)
233
+ <pre>
234
+ b.cf("是否确定删除该记录!", "删除", () => {
235
+ b.al("删除成功!", "success");
236
+ }, 2, "ice");
237
+ </pre>
238
+ */
239
+ function cf(message, label, fun, classes, theme) {
240
+ Messenger().hideAll();
241
+
242
+ messageInit('info', classes, theme);
243
+ Messenger().post({
244
+ message: message,
245
+ actions: {
246
+ retry: {
247
+ label: label,
248
+ phrase: "",
249
+ auto: false,
250
+ delay: 10,
251
+ action: function() {
252
+ Messenger().hideAll();
253
+ fun();
254
+ }
255
+ },
256
+ cancel: {
257
+ label: "取消",
258
+ action: function() {
259
+ Messenger().hideAll();
260
+ return false;
261
+ }
262
+ }
263
+ }
264
+ });
265
+ }
266
+ b['cf'] = cf;
267
+
268
+ /**
269
+ * 8. meanmenu导出菜单,npm安装版本有BUG,只能用本地的:...\WebTemplate\WebRoot\WEB\js\meanMenu,依赖jQuery
270
+ * @param $target jQuery选择器
271
+ * @param options 参数
272
+ <pre>
273
+ <div class="collapse navbar-collapse mean-menu">
274
+ <ul class="navbar-nav m-auto">
275
+ <li class="nav-item">
276
+ <a href="index.html" class="nav-link ce-a">首页</a>
277
+ </li>
278
+ <li class="nav-item">
279
+ <a href="#" class="nav-link ce-a">关于我们</a>
280
+ <ul class="dropdown-menu">
281
+ <li class="nav-item">
282
+ <a href="about1info.html" class="nav-link">公司简介</a>
283
+ </li>
284
+ <li class="nav-item">
285
+ <a href="about2system.html" class="nav-link">组织架构</a>
286
+ </li>
287
+ <li class="nav-item">
288
+ <a href="about3team.html" class="nav-link">管理团队</a>
289
+ </li>
290
+ </ul>
291
+ </li>
292
+ </ul>
293
+ </div>
294
+
295
+ import './plugin/meanMenu/meanmenu.min.css'
296
+ import './plugin/meanMenu/meanmenu.min'
297
+
298
+ b.meanmenu($('.mean-menu'));
299
+ </pre>
300
+ */
301
+ function meanmenu($target, options) {
302
+ options = b.extend(options, { meanScreenWidth: "991" })
303
+ $target.meanmenu(options);
304
+ }
305
+ b['meanmenu'] = meanmenu;
306
+
307
+ /**
308
+ * 9. textillate文字特效,依赖animate.v4.css:npm i textillate@0.4.1,依赖jQuery
309
+ * @param $target jQuery选择器
310
+ * @param options 参数
311
+ <pre>
312
+ import '../css/animate.v4.css'
313
+ import 'textillate/assets/jquery.fittext.js'
314
+ import 'textillate/assets/jquery.lettering.js'
315
+ import 'textillate/jquery.textillate.js'
316
+
317
+ b.textillate(".ix-cd-1",{
318
+ in: {effect: "animate__animated animate__fadeInLeftBig", sequence: false, sync: false, shuffle: false, reverse: true}
319
+ });
320
+ or
321
+ b.textillate(".ix-cd-1, .ix-cd-2, .ix-cd-3, .ix-cd-4, .ix-cd-5", ".owl-item:eq(" + e.item.index +")", {"start"});
322
+
323
+ </pre>
324
+ */
325
+ function textillate($target, options) {
326
+ // options = b.extend(options, { meanScreenWidth: "991" })
327
+ $target.textillate(options);
328
+ }
329
+ b['textillate'] = textillate;
330
+
331
+ /**
332
+ * 10. jquery.form表单提交工具:npm i jquery-form@4.3.0,可能有点问题还要用 npm i jquery-form@3.50.0,依赖jQuery
333
+ * @param $target jQuery选择器
334
+ * @param options 参数
335
+ <pre>
336
+ <form id="myForm" action="./springmvc/news/findNews.action">
337
+ <input name="page" type="text" value="1" />
338
+ <input name="rp" type="text" value="15" />
339
+ <input name="sortname" type="text" value="a.id" />
340
+ <input name="sortorder" type="text" value="desc" />
341
+ <input name="query" type="text" value="" />
342
+ <input name="qtype" type="text" value="project" />
343
+ <button type="submit" value="submit">submit</button>
344
+ <button type="reset" value="reset">reset</button>
345
+ </form>
346
+
347
+ const $target = $("#myForm");
348
+ b.formSubmit($target, {
349
+ //formData:页面表单数据
350
+ //jqForm: 表单jquery dom信息
351
+ //options:参数
352
+ beforeSubmit: function(formData, jqForm, options) {
353
+ //调用前
354
+ let result = false;
355
+ if ($target.is(jqForm)) {
356
+ // let isSuccessed = $target.validationEngine("validate");
357
+ // if (isSuccessed) {}
358
+ formData.push({
359
+ name: "title",
360
+ required: false,
361
+ type: "text",
362
+ value: "美国"
363
+ });
364
+ result = true;
365
+ }
366
+ return result;
367
+ },
368
+ //responseText:请求需要数据
369
+ //statusText: 状态码文本
370
+ //xhr:xhr信息
371
+ //$form: 表单jquery dom信息
372
+ success: function(responseText, statusText, xhr, $form) {
373
+ if (responseText.result === "200") {
374
+ b.al(responseText.message, "info", 3);
375
+ // window.location.href = "../manage#/news";
376
+ } else {
377
+ b.al(responseText.message, "error", 3);
378
+ }
379
+ },
380
+ error: () => {}
381
+ })
382
+ </pre>
383
+ **/
384
+ function formSubmit($target, options) {
385
+ options = b.extend(options, {
386
+ clearForm: false, //是否清空表单
387
+ resetForm: false, //是否重置表单
388
+ type: "post",
389
+ dataType: "json",
390
+ timeout: 30000,
391
+ });
392
+ $target.submit(() => {
393
+ try {
394
+ $target.ajaxSubmit(options);
395
+ } catch (e) { console.log(e); }
396
+ return false;
397
+ });
398
+ }
399
+ b['formSubmit'] = formSubmit;
400
+
401
+ /**
402
+ * 11. air-datepicker时间控件,不依赖其他框架:npm i air-datepicker@3.5.3
403
+ * @param AirDatepicker import AirDatepicker的日期组件
404
+ * @param localeZh import localeZh的中文支持
405
+ * @param options 参数
406
+ <pre>
407
+ <input id="airDatepicker" type="text" placeholder="时间">
408
+ <button id="airDatepickerBth" class="btn btn-danger">获取时间</button>
409
+
410
+ import AirDatepicker from 'glib/air-datepicker'
411
+ import localeZh from 'glib/air-datepicker/locale/zh';
412
+ import 'glib/air-datepicker/air-datepicker.css'
413
+ import 'istyle/src/css/form/fm-datepicker.css'
414
+
415
+ const ad = b.datepicker(AirDatepicker, localeZh)
416
+ b("#airDatepickerBth").click(() => {
417
+ b.l(ad.selectedDates[0].format("yyyy-MM-dd hh:mm:ss"))
418
+ })
419
+ </pre>
420
+ **/
421
+ function datepicker(AirDatepicker, localeZh, options) {
422
+ options = b.extend(options, {
423
+ target: '#airDatepicker',
424
+ classes: 'fm-datepicker',
425
+ autoClose: true,
426
+ inline: false,
427
+ timepicker: true,
428
+ buttons: ['today', 'clear'],
429
+ locale: localeZh,
430
+ dateFormat(date) {
431
+ return date.format("yyyy年MM月dd日 hh:mm:ss")
432
+ }
433
+ });
434
+ return new AirDatepicker(options.target, options);
435
+ }
436
+ b['datepicker'] = datepicker;
437
+
438
+ /**
439
+ * 12. niceScroll滚动条, npm i jquery.nicescroll,依赖jQuery
440
+ * @param $target jQuery选择器
441
+ * @param options 参数
442
+ <pre>
443
+ //最好不用在body和html上设置,设置的标签要有高度,且内部元素高度超出它,在线安装可能有问题
444
+ import './plugin/jquery.nicescroll/jquery.nicescroll.min'
445
+ b.niceScroll($('.container'));
446
+ </pre>
447
+ **/
448
+ function niceScroll($target, options) {
449
+ options = b.extend(options, {
450
+ styler : "fb",
451
+ cursorcolor : "#999",
452
+ cursorwidth : "6",
453
+ cursorborderradius : "0px",
454
+ background : "#fff",
455
+ spacebarenabled : false,
456
+ cursorborder : "",
457
+ smoothscroll: true, // ease动画滚动
458
+ scrollspeed: 100,
459
+ mousescrollstep: 100, //滚轮滚动速度
460
+ zindex : "1000"
461
+ });
462
+ $target.niceScroll(options);
463
+
464
+ window.addEventListener('resize', () => {
465
+ $target.getNiceScroll().resize();
466
+ });
467
+ }
468
+ b['niceScroll'] = niceScroll;
469
+
470
+
471
+ /**
472
+ * 13. validationEngine表单验证,高版本jQuery需要把jquery.validationEngine.js里面的size()方法换成length,依赖jQuery
473
+ 官网:https://github.com/posabsolute/jQuery-Validation-Engine
474
+ * @param $target jQuery选择器
475
+ * @param options 参数
476
+ <pre>
477
+ <form id="form-1" method="post" action="javascript:">
478
+ <ul class="list-unstyled">
479
+ <li>
480
+ <div class="login">异步验证: </div>
481
+ <input class="validate[ajax[validate]]" data-tag="1001" type="text" id="email" value="mikoarisu@gmail.com" />
482
+ </li>
483
+ </ul>
484
+ </form>
485
+
486
+ <form id="form-2" method="post" action="#">
487
+ <ul class="">
488
+ <li>
489
+ <div class="login">必须为5 - 20之间的数字: </div>
490
+ <input type="text" value="123a" class="validate[required,custom[number],min[5],max[20]]"/>
491
+ </li>
492
+ <li>
493
+ <div class="login">[日期必须介于2009-01-01,2009-12-31之间]: </div>
494
+ <input type="text" id="birthday" value="2029-01-01"
495
+ class="validate[required,custom[date],future[2009-01-01],past[2009-12-31]]"/>
496
+ </li>
497
+ <li>
498
+ <div class="login">必须选择两项 : </div>
499
+ <input class="validate[minCheckbox[2]]" type="checkbox" name="group1" id="maxcheck1" value="5"/>a
500
+ <input class="validate[minCheckbox[2]]" type="checkbox" name="group1" id="maxcheck2" value="3"/>b
501
+ <input class="validate[minCheckbox[2]]" type="checkbox" name="group1" id="maxcheck3" value="9"/>c
502
+ </li>
503
+ <li>
504
+ <div class="login">输入框长度在5 - 20: </div>
505
+ <input type="text" class="validate[minSize[5], maxSize[20]]" value="3"/>
506
+ </li>
507
+ <li>
508
+ <div class="login">url验证: </div>
509
+ <input type="text" class="validate[custom[url]]" value="aa"/>
510
+ </li>
511
+ <li>
512
+ <div class="login">不能为特殊字符: </div>
513
+ <input type="text" class="validate[custom[unSp]]" value="#"/>
514
+ </li>
515
+ <li>
516
+ <div class="login">密码: </div>
517
+ <input id="psw" type="text" value="cc"/>
518
+ </li>
519
+ <li>
520
+ <div class="login">密码再输入一次验证:validate[equals[psw]]其中psw为上一个密码ID</div>
521
+ <input type="password" class="validate[equals[psw]]" value="cc3"/>
522
+ </li>
523
+ <li>
524
+ <div class="login">ipv4验证: </div>
525
+ <input type="text" class="validate[custom[ipv4]]" value="cc3"/>
526
+ </li>
527
+ <li>
528
+ <div class="login">不能纯数字: </div>
529
+ <input type="text" class="validate[validate[custom[noOnlyNum]]]" value="111"/>
530
+ </li>
531
+ <li class="padding-top-20">
532
+ <button id="ve-1" type="button" class="btn btn-danger">表单验证</button>
533
+ </li>
534
+ </ul>
535
+ </form>
536
+
537
+ // input中常用class
538
+ validate[required, maxSize[50]] 最大50个字符
539
+ validate[required, max[150]] 最大值为150
540
+ validate[required,custom[onlyLetterNumber]]
541
+ validate[required,ajax[checkWordContent]]
542
+ validate[required, custom[url]]
543
+ validate[custom[onlyLetterNumber2]]
544
+ validate[required,custom[email]]
545
+ validate[required, custom[number], min[3], max[150]]
546
+
547
+ import './plugin/validationEngine/css/validationEngine.jquery.css'
548
+ import 'istyle/src/css/form/fm-validation.css';
549
+ import './plugin/validationEngine/js/jquery.validationEngine'
550
+ import './plugin/validationEngine/js/languages/jquery.validationEngine-zh_CN'
551
+ b.validationEngine($("#form-1, #form-2"));
552
+ b("#validate-btn-1").click(() => {
553
+ const isSuccessed = b.validate($("#form-1"), 'validate');
554
+ b.l(isSuccessed)
555
+ })
556
+ b("#validate-btn-2").click(() => {
557
+ const isSuccessed = b.validate($("#form-2"), 'validate');
558
+ b.l(isSuccessed)
559
+ })
560
+ </pre>
561
+ **/
562
+ function validationEngine($target, options) {
563
+ options = b.extend(options, {
564
+ focusFirstField : false,
565
+ promptPosition: "topRight"
566
+ });
567
+ $target.validationEngine(options);
568
+ }
569
+ b['validationEngine'] = validationEngine;
570
+
571
+ /**
572
+ * 14. validationEngine表单验证,确认是否验证通过
573
+ * @param $target jQuery选择器
574
+ * @param command 字符串方法名
575
+ <pre>
576
+ const isSuccessed = b.validate($("#form-2"));
577
+ </pre>
578
+ **/
579
+ function validate($target, command) {
580
+ const options = b.extend( { command: command }, { command: "validate" });
581
+ return $target.validationEngine(options.command);
582
+ }
583
+ b['validate'] = validate;
584
+
585
+
586
+ export { b, u, Main as m };
587
+ export default b;