eoss-mobiles 0.2.38 → 0.2.40

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/lib/grid.js CHANGED
@@ -199,14 +199,21 @@ function normalizeComponent(
199
199
  // ESM COMPAT FLAG
200
200
  __webpack_require__.r(__webpack_exports__);
201
201
 
202
- // CONCATENATED MODULE: ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./packages/grid/src/main.vue?vue&type=template&id=74623ee7&
202
+ // CONCATENATED MODULE: ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./packages/grid/src/main.vue?vue&type=template&id=683d1686&
203
203
  var render = function () {
204
204
  var _vm = this
205
205
  var _h = _vm.$createElement
206
206
  var _c = _vm._self._c || _h
207
207
  return _c(
208
208
  "div",
209
- { staticClass: "em-grid" },
209
+ {
210
+ staticClass: "em-grid",
211
+ on: {
212
+ click: function ($event) {
213
+ _vm.showHide = false
214
+ },
215
+ },
216
+ },
210
217
  [
211
218
  _c(
212
219
  "van-grid",
@@ -220,7 +227,7 @@ var render = function () {
220
227
  _vm.$listeners
221
228
  ),
222
229
  [
223
- _vm._l(_vm.$attrs.data, function (item, index) {
230
+ _vm._l(_vm.newData, function (item, index) {
224
231
  return _c(
225
232
  "van-grid-item",
226
233
  _vm._b(
@@ -229,8 +236,8 @@ var render = function () {
229
236
  {
230
237
  name: "show",
231
238
  rawName: "v-show",
232
- value: _vm.$attrs.data && _vm.$attrs.data.length > 0,
233
- expression: "$attrs.data && $attrs.data.length > 0",
239
+ value: _vm.newData && _vm.newData.length > 0,
240
+ expression: "newData && newData.length > 0",
234
241
  },
235
242
  ],
236
243
  key: index,
@@ -238,6 +245,7 @@ var render = function () {
238
245
  style: "width:" + 100 / _vm.columnNum + "%;",
239
246
  on: {
240
247
  click: function ($event) {
248
+ $event.stopPropagation()
241
249
  _vm.goView($event, item)
242
250
  },
243
251
  },
@@ -245,13 +253,184 @@ var render = function () {
245
253
  "van-grid-item",
246
254
  item,
247
255
  false
248
- )
256
+ ),
257
+ [
258
+ _c(
259
+ "i",
260
+ {
261
+ staticClass: "van-icon van-grid-item__icon",
262
+ class:
263
+ item.icon.startsWith("http") &&
264
+ item.icon.indexOf("/") != -1
265
+ ? ""
266
+ : "van-icon-" + item.icon,
267
+ style: { size: item.iconSize ? item.iconSize : "" },
268
+ },
269
+ [
270
+ item.icon.startsWith("http") || item.icon.indexOf("/") != -1
271
+ ? _c("img", {
272
+ staticClass: "van-icon__image",
273
+ style: {
274
+ width: item.iconSize ? item.iconSize : "",
275
+ height: item.iconSize ? item.iconSize : "",
276
+ },
277
+ attrs: { src: item.icon },
278
+ })
279
+ : _vm._e(),
280
+ _c("div", {
281
+ directives: [
282
+ {
283
+ name: "show",
284
+ rawName: "v-show",
285
+ value: item.dot,
286
+ expression: "item.dot",
287
+ },
288
+ ],
289
+ staticClass: "van-info van-info--dot",
290
+ style: { background: item.dotColor || "" },
291
+ }),
292
+ _c(
293
+ "div",
294
+ {
295
+ directives: [
296
+ {
297
+ name: "show",
298
+ rawName: "v-show",
299
+ value: item.badge,
300
+ expression: "item.badge",
301
+ },
302
+ ],
303
+ staticClass: "van-info",
304
+ style: { background: _vm.badgeColor || "" },
305
+ },
306
+ [
307
+ _vm._v(
308
+ "\n " +
309
+ _vm._s(
310
+ _vm.maxBadge &&
311
+ !isNaN(item.badge) &&
312
+ Number(_vm.maxBadge) < Number(item.badge)
313
+ ? _vm.maxBadge + "+"
314
+ : item.badge
315
+ ) +
316
+ "\n "
317
+ ),
318
+ ]
319
+ ),
320
+ ]
321
+ ),
322
+ _c("span", { staticClass: "van-grid-item__text" }, [
323
+ _vm._v(_vm._s(item.text)),
324
+ ]),
325
+ _vm.showHide && item.menuType != "add"
326
+ ? _c("van-icon", {
327
+ staticClass: "em-grid-del",
328
+ attrs: { name: "clear", size: "20px" },
329
+ on: {
330
+ click: function ($event) {
331
+ $event.stopPropagation()
332
+ _vm.handleHide(item)
333
+ },
334
+ },
335
+ })
336
+ : _vm._e(),
337
+ item.showMenu
338
+ ? _c(
339
+ "div",
340
+ { staticClass: "em-grid-select-box" },
341
+ [
342
+ _c("van-icon", {
343
+ attrs: {
344
+ size: "30px",
345
+ color: "#fff",
346
+ name: "success",
347
+ },
348
+ }),
349
+ ],
350
+ 1
351
+ )
352
+ : _vm._e(),
353
+ ],
354
+ 1
249
355
  )
250
356
  }),
251
357
  _vm._t("default"),
252
358
  ],
253
359
  2
254
360
  ),
361
+ _vm.show
362
+ ? _c(
363
+ "em-popup",
364
+ {
365
+ staticStyle: { width: "80%", height: "50%" },
366
+ model: {
367
+ value: _vm.show,
368
+ callback: function ($$v) {
369
+ _vm.show = $$v
370
+ },
371
+ expression: "show",
372
+ },
373
+ },
374
+ [
375
+ _c(
376
+ "div",
377
+ { staticClass: "em-grid-popup" },
378
+ [
379
+ _c("p", { staticClass: "em-grid-popup-label" }, [
380
+ _vm._v("添加菜单"),
381
+ ]),
382
+ _c(
383
+ "em-grid",
384
+ _vm._b(
385
+ {
386
+ staticClass: "em-grid-popup-content",
387
+ attrs: {
388
+ data: _vm.hideMenuList,
389
+ border: false,
390
+ "column-num": _vm.$attrs.columnNum,
391
+ },
392
+ on: { click: _vm.selectMenu },
393
+ },
394
+ "em-grid",
395
+ _vm.$attrs,
396
+ false
397
+ )
398
+ ),
399
+ _c(
400
+ "div",
401
+ { staticClass: "em-grid-popup-button" },
402
+ [
403
+ _c(
404
+ "em-button",
405
+ {
406
+ staticStyle: { width: "49%" },
407
+ attrs: { round: "" },
408
+ on: {
409
+ click: function ($event) {
410
+ _vm.show = false
411
+ },
412
+ },
413
+ },
414
+ [_vm._v("取消")]
415
+ ),
416
+ _c(
417
+ "em-button",
418
+ {
419
+ staticStyle: { width: "49%" },
420
+ attrs: { round: "", type: "primary" },
421
+ on: { click: _vm.handleShowMenu },
422
+ },
423
+ [_vm._v("确认")]
424
+ ),
425
+ ],
426
+ 1
427
+ ),
428
+ ],
429
+ 1
430
+ ),
431
+ ]
432
+ )
433
+ : _vm._e(),
255
434
  ],
256
435
  1
257
436
  )
@@ -260,7 +439,7 @@ var staticRenderFns = []
260
439
  render._withStripped = true
261
440
 
262
441
 
263
- // CONCATENATED MODULE: ./packages/grid/src/main.vue?vue&type=template&id=74623ee7&
442
+ // CONCATENATED MODULE: ./packages/grid/src/main.vue?vue&type=template&id=683d1686&
264
443
 
265
444
  // CONCATENATED MODULE: ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./packages/grid/src/main.vue?vue&type=script&lang=js&
266
445
  //
@@ -280,11 +459,91 @@ render._withStripped = true
280
459
  //
281
460
  //
282
461
  //
462
+ //
463
+ //
464
+ //
465
+ //
466
+ //
467
+ //
468
+ //
469
+ //
470
+ //
471
+ //
472
+ //
473
+ //
474
+ //
475
+ //
476
+ //
477
+ //
478
+ //
479
+ //
480
+ //
481
+ //
482
+ //
483
+ //
484
+ //
485
+ //
486
+ //
487
+ //
488
+ //
489
+ //
490
+ //
491
+ //
492
+ //
493
+ //
494
+ //
495
+ //
496
+ //
497
+ //
498
+ //
499
+ //
500
+ //
501
+ //
502
+ //
503
+ //
504
+ //
505
+ //
506
+ //
507
+ //
508
+ //
509
+ //
510
+ //
511
+ //
512
+ //
513
+ //
514
+ //
515
+ //
516
+ //
517
+ //
518
+ //
519
+ //
520
+ //
521
+ //
522
+ //
523
+ //
524
+ //
525
+ //
526
+ //
527
+ //
528
+ //
529
+ //
530
+ //
531
+ //
532
+ //
533
+ //
534
+ //
535
+ //
283
536
 
284
537
  /* harmony default export */ var mainvue_type_script_lang_js_ = ({
285
538
  name: 'EmGrid',
286
539
  inheritAttrs: false,
287
540
  props: {
541
+ data: {
542
+ type: Array,
543
+ default: function _default() {
544
+ return [];
545
+ }
546
+ },
288
547
  columnNum: {
289
548
  type: [Number, String],
290
549
  default: 4
@@ -296,12 +555,187 @@ render._withStripped = true
296
555
  targetStop: {
297
556
  type: Boolean,
298
557
  default: true
558
+ },
559
+ badgeColor: {
560
+ type: String,
561
+ default: ''
562
+ },
563
+ maxBadge: {
564
+ type: String,
565
+ default: ''
566
+ },
567
+ isHideMenu: {
568
+ type: Boolean,
569
+ default: false
570
+ },
571
+ hideMenuKey: {
572
+ type: String,
573
+ default: 'id'
574
+ },
575
+ hideMenu: {
576
+ type: [String, Array],
577
+ default: function _default() {
578
+ return [];
579
+ }
580
+ },
581
+ addMenuIcon: {
582
+ type: String,
583
+ default: 'plus'
584
+ },
585
+ addMenuIconSize: {
586
+ type: String,
587
+ default: ''
588
+ }
589
+ },
590
+ data: function data() {
591
+ return {
592
+ lastTapTime: 0,
593
+ timer: null,
594
+ showHide: false,
595
+ newData: [],
596
+ show: false,
597
+ selectMenuArr: [],
598
+ hideMenuList: []
599
+ };
600
+ },
601
+
602
+ watch: {
603
+ hideMenu: {
604
+ handler: function handler(val) {
605
+ this.defaultHide(val);
606
+ },
607
+
608
+ deep: true,
609
+ immediate: true
610
+ },
611
+ data: {
612
+ handler: function handler(val) {
613
+ this.newData = JSON.parse(JSON.stringify(val));
614
+ this.defaultHide(this.hideMenu);
615
+ },
616
+
617
+ deep: true,
618
+ immediate: true
299
619
  }
300
620
  },
301
621
  methods: {
622
+ hideDelIcon: function hideDelIcon() {
623
+ this.showHide = false;
624
+ },
625
+ handleShowMenu: function handleShowMenu() {
626
+ var _this = this;
627
+
628
+ var str = this.selectMenuArr.join(',');
629
+ if (Array.isArray(this.hideMenu)) {
630
+ var hideArr = this.hideMenuList.filter(function (x) {
631
+ return str.indexOf(x[_this.hideMenuKey]) == -1;
632
+ });
633
+ this.$emit('hide', hideArr);
634
+ } else {
635
+ var hide = this.hideMenuList.filter(function (x) {
636
+ return str.indexOf(x[_this.hideMenuKey]) == -1;
637
+ });
638
+ hide = hide.map(function (x) {
639
+ return x[_this.hideMenuKey];
640
+ });
641
+ this.$emit('hide', hide.join(','));
642
+ }
643
+ this.selectMenuArr = [];
644
+ this.show = false;
645
+ },
646
+ selectMenu: function selectMenu(val) {
647
+ var _this2 = this;
648
+
649
+ if (val.showMenu) {
650
+ this.selectMenuArr = this.selectMenuArr.filter(function (x) {
651
+ return x != val[_this2.hideMenuKey];
652
+ });
653
+ } else {
654
+ this.selectMenuArr.push(val[this.hideMenuKey]);
655
+ }
656
+ this.$set(val, 'showMenu', !val.showMenu);
657
+ },
658
+ defaultHide: function defaultHide(val) {
659
+ var _this3 = this;
660
+
661
+ if (this.isHideMenu && val != undefined) {
662
+ if (Array.isArray(val)) {
663
+ var menuKey = val.map(function (x) {
664
+ return x.id;
665
+ }).join(',');
666
+ this.newData = this.data.filter(function (x) {
667
+ return menuKey.indexOf(x[_this3.hideMenuKey]) == -1;
668
+ });
669
+ this.hideMenuList = this.data.filter(function (x) {
670
+ return menuKey.indexOf(x[_this3.hideMenuKey]) != -1;
671
+ });
672
+ } else {
673
+ val = val + '';
674
+ this.newData = this.data.filter(function (x) {
675
+ return val.indexOf(x[_this3.hideMenuKey]) == -1;
676
+ });
677
+ this.hideMenuList = this.data.filter(function (x) {
678
+ return val.indexOf(x[_this3.hideMenuKey]) != -1;
679
+ });
680
+ }
681
+ }
682
+ if (this.isHideMenu != undefined && (this.newData.length > 0 && this.newData[this.newData.length - 1].menuType === 'add' ? this.newData.length - 1 < this.data.length : this.newData.length < this.data.length)) {
683
+ this.newData.push({
684
+ icon: this.addMenuIcon || 'plus',
685
+ iconSize: this.addMenuIconSize,
686
+ menuType: 'add'
687
+ });
688
+ }
689
+ },
690
+ handleHide: function handleHide(item) {
691
+ var _this4 = this;
692
+
693
+ this.$dialog.confirm({
694
+ message: '\u786E\u5B9A\u8981\u9690\u85CF<span style="color:red;font-weight:bold;margin:0px 5px">' + item.text + '</span>\u83DC\u5355\u5417\uFF1F'
695
+ }).then(function () {
696
+ if (Array.isArray(_this4.hideMenu)) {
697
+ var hideArr = [].concat(_this4.hideMenu, [item]);
698
+ _this4.$emit('hide', hideArr);
699
+ } else {
700
+ var hideStr = _this4.hideMenu ? _this4.hideMenu + ',' + item[_this4.hideMenuKey] : item[_this4.hideMenuKey];
701
+ _this4.$emit('hide', hideStr);
702
+ }
703
+ });
704
+ },
302
705
  goView: function goView(event, val) {
303
- this.$emit('click', val);
304
- this.targetStop && event.stopPropagation();
706
+ var _this5 = this;
707
+
708
+ if (val.menuType === 'add') {
709
+ this.show = true;
710
+ return;
711
+ }
712
+ var currentTime = new Date().getTime();
713
+ var tapLength = currentTime - this.lastTapTime;
714
+ this.lastTapTime = currentTime;
715
+ if (this.isHideMenu) {
716
+ if (tapLength < 500) {
717
+ this.handleDoubleClick(val);
718
+ clearTimeout(this.timer);
719
+ return;
720
+ }
721
+ if (this.showHide) {
722
+ this.showHide = false;
723
+ return;
724
+ }
725
+ this.timer = setTimeout(function () {
726
+ _this5.$emit('click', val, event);
727
+ _this5.targetStop && event.stopPropagation();
728
+ }, 500);
729
+ } else {
730
+ this.$emit('click', val, event);
731
+ this.targetStop && event.stopPropagation();
732
+ }
733
+ },
734
+ handleDoubleClick: function handleDoubleClick(val) {
735
+ if (this.isHideMenu) {
736
+ this.showHide = true;
737
+ }
738
+ this.$emit('dbclick', val);
305
739
  }
306
740
  }
307
741
  });