eoss-mobiles 0.2.45 → 0.2.46

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
@@ -206,7 +206,7 @@ module.exports = require("vuedraggable");
206
206
  // ESM COMPAT FLAG
207
207
  __webpack_require__.r(__webpack_exports__);
208
208
 
209
- // 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=3fb10550&
209
+ // 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=1f9590ec&
210
210
  var render = function () {
211
211
  var _vm = this
212
212
  var _h = _vm.$createElement
@@ -255,7 +255,7 @@ var render = function () {
255
255
  staticClass: "menu-list-draggable-item",
256
256
  staticStyle: { width: "100%" },
257
257
  },
258
- _vm._l(_vm.newData, function (item, index) {
258
+ _vm._l(_vm.newData, function (item) {
259
259
  return _c(
260
260
  "div",
261
261
  {
@@ -266,9 +266,13 @@ var render = function () {
266
266
  100 / _vm.columnNum +
267
267
  "%",
268
268
  on: {
269
- click: function ($event) {
269
+ mousedown: function ($event) {
270
+ $event.stopPropagation()
271
+ _vm.onMouseDown(item)
272
+ },
273
+ mouseup: function ($event) {
270
274
  $event.stopPropagation()
271
- _vm.goView($event, item)
275
+ _vm.onMouseUp($event, item)
272
276
  },
273
277
  },
274
278
  },
@@ -296,14 +300,6 @@ var render = function () {
296
300
  _vm.$attrs["icon-size"]
297
301
  : "",
298
302
  },
299
- on: {
300
- touchstart: function ($event) {
301
- _vm.touchstart(item, index)
302
- },
303
- touchend: function ($event) {
304
- _vm.touchend(item, index)
305
- },
306
- },
307
303
  },
308
304
  [
309
305
  item.icon.startsWith("http") ||
@@ -357,7 +353,7 @@ var render = function () {
357
353
  },
358
354
  [
359
355
  _vm._v(
360
- "\n " +
356
+ "\n " +
361
357
  _vm._s(
362
358
  _vm.maxBadge &&
363
359
  !isNaN(item.badge) &&
@@ -366,12 +362,27 @@ var render = function () {
366
362
  ? _vm.maxBadge + "+"
367
363
  : item.badge
368
364
  ) +
369
- "\n "
365
+ "\n "
370
366
  ),
371
367
  ]
372
368
  ),
373
369
  ]
374
370
  ),
371
+ _c("em-popover", {
372
+ attrs: {
373
+ placement: _vm.placement,
374
+ theme: _vm.popoverTheme,
375
+ actions: _vm.popoverActions,
376
+ },
377
+ on: { select: _vm.popoverSelect },
378
+ model: {
379
+ value: item.showPopover,
380
+ callback: function ($$v) {
381
+ _vm.$set(item, "showPopover", $$v)
382
+ },
383
+ expression: "item.showPopover",
384
+ },
385
+ }),
375
386
  _c(
376
387
  "span",
377
388
  { staticClass: "van-grid-item__text" },
@@ -417,151 +428,172 @@ var render = function () {
417
428
  1
418
429
  )
419
430
  : _vm._e(),
420
- _vm._l(_vm.newData, function (item, index) {
431
+ _vm._l(_vm.newData, function (item) {
421
432
  return _c(
422
- "van-grid-item",
423
- _vm._b(
424
- {
425
- directives: [
426
- {
427
- name: "show",
428
- rawName: "v-show",
429
- value:
430
- _vm.newData && _vm.newData.length > 0 && !_vm.draggable,
431
- expression: "newData && newData.length > 0 && !draggable",
432
- },
433
- ],
434
- key: index,
435
- class: { "em-grid-ellipsis": _vm.textEllipsis },
436
- style: "width:" + 100 / _vm.columnNum + "%;",
437
- on: {
438
- click: function ($event) {
439
- $event.stopPropagation()
440
- _vm.goView($event, item)
441
- },
433
+ "div",
434
+ {
435
+ directives: [
436
+ {
437
+ name: "show",
438
+ rawName: "v-show",
439
+ value:
440
+ _vm.newData && _vm.newData.length > 0 && !_vm.draggable,
441
+ expression: "newData && newData.length > 0 && !draggable",
442
+ },
443
+ ],
444
+ key: item.id,
445
+ staticClass: "van-grid-item",
446
+ style:
447
+ "display: inline-block;width:" + 100 / _vm.columnNum + "%",
448
+ on: {
449
+ mousedown: function ($event) {
450
+ $event.stopPropagation()
451
+ _vm.onMouseDown(item)
452
+ },
453
+ mouseup: function ($event) {
454
+ $event.stopPropagation()
455
+ _vm.onMouseUp($event, item)
442
456
  },
443
457
  },
444
- "van-grid-item",
445
- item,
446
- false
447
- ),
458
+ },
448
459
  [
449
460
  _c(
450
- "i",
461
+ "div",
451
462
  {
452
- staticClass: "van-icon van-grid-item__icon",
453
- class:
454
- item.icon.startsWith("http") &&
455
- item.icon.indexOf("/") != -1
456
- ? ""
457
- : "van-icon-" + item.icon,
458
- style: {
459
- fontSize:
460
- item.iconSize || _vm.$attrs["icon-size"]
461
- ? item.iconSize || _vm.$attrs["icon-size"]
462
- : "",
463
- },
464
- on: {
465
- touchstart: function ($event) {
466
- _vm.touchstart(item, index)
467
- },
468
- touchend: function ($event) {
469
- _vm.touchend(item, index)
470
- },
471
- },
463
+ staticClass:
464
+ "van-grid-item__content van-grid-item__content--center van-hairline",
472
465
  },
473
466
  [
474
- item.icon.startsWith("http") || item.icon.indexOf("/") != -1
475
- ? _c("img", {
476
- staticClass: "van-icon__image",
477
- style: {
478
- width:
479
- item.iconSize || _vm.$attrs["icon-size"]
480
- ? item.iconSize || _vm.$attrs["icon-size"]
481
- : "",
482
- height:
483
- item.iconSize || _vm.$attrs["icon-size"]
484
- ? item.iconSize || _vm.$attrs["icon-size"]
485
- : "",
486
- },
487
- attrs: { src: item.icon },
488
- })
489
- : _vm._e(),
490
- _c("div", {
491
- directives: [
492
- {
493
- name: "show",
494
- rawName: "v-show",
495
- value: item.dot,
496
- expression: "item.dot",
497
- },
498
- ],
499
- staticClass: "van-info van-info--dot",
500
- style: { background: item.dotColor || "" },
501
- }),
502
467
  _c(
503
- "div",
468
+ "i",
504
469
  {
505
- directives: [
506
- {
507
- name: "show",
508
- rawName: "v-show",
509
- value: item.badge,
510
- expression: "item.badge",
511
- },
512
- ],
513
- staticClass: "van-info",
514
- style: { background: _vm.badgeColor || "" },
470
+ staticClass: "van-icon van-grid-item__icon",
471
+ class:
472
+ item.icon.startsWith("http") &&
473
+ item.icon.indexOf("/") != -1
474
+ ? ""
475
+ : "van-icon-" + item.icon,
476
+ style: {
477
+ fontSize:
478
+ item.iconSize || _vm.$attrs["icon-size"]
479
+ ? item.iconSize || _vm.$attrs["icon-size"]
480
+ : "",
481
+ },
515
482
  },
516
483
  [
517
- _vm._v(
518
- "\n " +
519
- _vm._s(
520
- _vm.maxBadge &&
521
- !isNaN(item.badge) &&
522
- Number(_vm.maxBadge) < Number(item.badge)
523
- ? _vm.maxBadge + "+"
524
- : item.badge
525
- ) +
526
- "\n "
484
+ item.icon.startsWith("http") ||
485
+ item.icon.indexOf("/") != -1
486
+ ? _c("img", {
487
+ staticClass: "van-icon__image",
488
+ style: {
489
+ width:
490
+ item.iconSize || _vm.$attrs["icon-size"]
491
+ ? item.iconSize || _vm.$attrs["icon-size"]
492
+ : "",
493
+ height:
494
+ item.iconSize || _vm.$attrs["icon-size"]
495
+ ? item.iconSize || _vm.$attrs["icon-size"]
496
+ : "",
497
+ },
498
+ attrs: { src: item.icon },
499
+ })
500
+ : _vm._e(),
501
+ _c("div", {
502
+ directives: [
503
+ {
504
+ name: "show",
505
+ rawName: "v-show",
506
+ value: item.dot,
507
+ expression: "item.dot",
508
+ },
509
+ ],
510
+ staticClass: "van-info van-info--dot",
511
+ style: { background: item.dotColor || "" },
512
+ }),
513
+ _c(
514
+ "div",
515
+ {
516
+ directives: [
517
+ {
518
+ name: "show",
519
+ rawName: "v-show",
520
+ value: item.badge,
521
+ expression: "item.badge",
522
+ },
523
+ ],
524
+ staticClass: "van-info",
525
+ style: { background: _vm.badgeColor || "" },
526
+ },
527
+ [
528
+ _vm._v(
529
+ "\n " +
530
+ _vm._s(
531
+ _vm.maxBadge &&
532
+ !isNaN(item.badge) &&
533
+ Number(_vm.maxBadge) < Number(item.badge)
534
+ ? _vm.maxBadge + "+"
535
+ : item.badge
536
+ ) +
537
+ "\n "
538
+ ),
539
+ ]
527
540
  ),
528
541
  ]
529
542
  ),
530
- ]
531
- ),
532
- _c("span", { staticClass: "van-grid-item__text" }, [
533
- _vm._v(_vm._s(item.text)),
534
- ]),
535
- _vm.showHide && item.menuType != "add"
536
- ? _c("van-icon", {
537
- staticClass: "em-grid-del",
538
- attrs: { name: "clear", size: "20px" },
543
+ _c("em-popover", {
544
+ attrs: {
545
+ placement: _vm.placement,
546
+ theme: _vm.popoverTheme,
547
+ actions: _vm.popoverActions,
548
+ },
539
549
  on: {
540
- click: function ($event) {
541
- $event.stopPropagation()
542
- _vm.handleHide(item)
550
+ select: function ($event) {
551
+ _vm.popoverSelect($event, item)
543
552
  },
544
553
  },
545
- })
546
- : _vm._e(),
547
- item.showMenu
548
- ? _c(
549
- "div",
550
- { staticClass: "em-grid-select-box" },
551
- [
552
- _c("van-icon", {
553
- attrs: {
554
- size: "30px",
555
- color: "#fff",
556
- name: "success",
554
+ model: {
555
+ value: item.showPopover,
556
+ callback: function ($$v) {
557
+ _vm.$set(item, "showPopover", $$v)
558
+ },
559
+ expression: "item.showPopover",
560
+ },
561
+ }),
562
+ _c("span", { staticClass: "van-grid-item__text" }, [
563
+ _vm._v(_vm._s(item.text)),
564
+ ]),
565
+ _vm.showHide && item.menuType != "add"
566
+ ? _c("van-icon", {
567
+ staticClass: "em-grid-del",
568
+ attrs: { name: "clear", size: "20px" },
569
+ on: {
570
+ click: function ($event) {
571
+ $event.stopPropagation()
572
+ _vm.handleHide(item)
573
+ },
557
574
  },
558
- }),
559
- ],
560
- 1
561
- )
562
- : _vm._e(),
563
- ],
564
- 1
575
+ })
576
+ : _vm._e(),
577
+ item.showMenu
578
+ ? _c(
579
+ "div",
580
+ { staticClass: "em-grid-select-box" },
581
+ [
582
+ _c("van-icon", {
583
+ attrs: {
584
+ size: "30px",
585
+ color: "#fff",
586
+ name: "success",
587
+ },
588
+ }),
589
+ ],
590
+ 1
591
+ )
592
+ : _vm._e(),
593
+ ],
594
+ 1
595
+ ),
596
+ ]
565
597
  )
566
598
  }),
567
599
  _vm._t("default"),
@@ -649,7 +681,7 @@ var staticRenderFns = []
649
681
  render._withStripped = true
650
682
 
651
683
 
652
- // CONCATENATED MODULE: ./packages/grid/src/main.vue?vue&type=template&id=3fb10550&
684
+ // CONCATENATED MODULE: ./packages/grid/src/main.vue?vue&type=template&id=1f9590ec&
653
685
 
654
686
  // EXTERNAL MODULE: external "vuedraggable"
655
687
  var external_vuedraggable_ = __webpack_require__(10);
@@ -810,6 +842,68 @@ var external_vuedraggable_default = /*#__PURE__*/__webpack_require__.n(external_
810
842
  //
811
843
  //
812
844
  //
845
+ //
846
+ //
847
+ //
848
+ //
849
+ //
850
+ //
851
+ //
852
+ //
853
+ //
854
+ //
855
+ //
856
+ //
857
+ //
858
+ //
859
+ //
860
+ //
861
+ //
862
+ //
863
+ //
864
+ //
865
+ //
866
+ //
867
+ //
868
+ //
869
+ //
870
+ //
871
+ //
872
+ //
873
+ //
874
+ //
875
+ //
876
+ //
877
+ //
878
+ //
879
+ //
880
+ //
881
+ //
882
+ //
883
+ //
884
+ //
885
+ //
886
+ //
887
+ //
888
+ //
889
+ //
890
+ //
891
+ //
892
+ //
893
+ //
894
+ //
895
+ //
896
+ //
897
+ //
898
+ //
899
+ //
900
+ //
901
+ //
902
+ //
903
+ //
904
+ //
905
+ //
906
+ //
813
907
 
814
908
 
815
909
  /* harmony default export */ var mainvue_type_script_lang_js_ = ({
@@ -868,15 +962,34 @@ var external_vuedraggable_default = /*#__PURE__*/__webpack_require__.n(external_
868
962
  draggable: {
869
963
  type: Boolean,
870
964
  default: false
965
+ },
966
+ popoverActions: {
967
+ type: Array,
968
+ default: function _default() {
969
+ return [{ text: '隐藏菜单', type: 'hideMenu' }];
970
+ }
971
+ },
972
+ isTouch: {
973
+ type: Boolean,
974
+ default: false
975
+ },
976
+ placement: {
977
+ type: String,
978
+ default: 'top'
979
+ },
980
+ popoverTheme: {
981
+ type: String,
982
+ default: 'dark'
871
983
  }
872
984
  },
873
985
  data: function data() {
874
986
  return {
875
- lastTapTime: 0,
876
987
  timer: null,
877
988
  showHide: false,
989
+ isLongPress: false,
878
990
  newData: [],
879
991
  show: false,
992
+ showPopover: false,
880
993
  selectMenuArr: [],
881
994
  hideMenuList: []
882
995
  };
@@ -902,31 +1015,56 @@ var external_vuedraggable_default = /*#__PURE__*/__webpack_require__.n(external_
902
1015
  }
903
1016
  },
904
1017
  methods: {
905
- touchstart: function touchstart(val, inexd) {
906
- console.log('点击了了');
1018
+ popoverSelect: function popoverSelect(val, item) {
1019
+ if (val.type == 'hideMenu') {
1020
+ this.handleHide(item);
1021
+ } else {
1022
+ this.$emit('touchSelect', { action: val, data: item });
1023
+ }
907
1024
  },
908
- touchend: function touchend(val, a) {
909
- console.log('松开了');
1025
+ onMouseDown: function onMouseDown(item) {
1026
+ var _this = this;
1027
+
1028
+ // this.showPopover = true
1029
+ if (this.draggable || !this.isTouch) return;
1030
+ this.isLongPress = false;
1031
+ this.timer = setTimeout(function () {
1032
+ if (_this.isLongPress === false) {
1033
+ _this.isLongPress = true;
1034
+ _this.lastTapTime = new Date().getTime();
1035
+ _this.$set(item, 'showPopover', true);
1036
+ }
1037
+ }, 500);
1038
+ },
1039
+ onMouseUp: function onMouseUp($event, item) {
1040
+ if (this.isLongPress === false) {
1041
+ this.lastTapTime = new Date().getTime();
1042
+ this.$set(item, 'showPopover', false);
1043
+ this.goView($event, item);
1044
+ // 执行相应的操作
1045
+ }
1046
+ this.isLongPress = false;
1047
+ clearTimeout(this.timer);
910
1048
  },
911
1049
  hideDelIcon: function hideDelIcon() {
912
1050
  this.showHide = false;
913
1051
  },
914
1052
  handleShowMenu: function handleShowMenu() {
915
- var _this = this;
1053
+ var _this2 = this;
916
1054
 
917
1055
  var str = this.selectMenuArr;
918
1056
  // let str = this.selectMenuArr.join(',');
919
1057
  if (Array.isArray(this.hideMenu)) {
920
1058
  var hideArr = this.hideMenuList.filter(function (x) {
921
- return str.indexOf(x[_this.hideMenuKey]) == -1;
1059
+ return str.indexOf(x[_this2.hideMenuKey]) == -1;
922
1060
  });
923
1061
  this.$emit('hide', hideArr);
924
1062
  } else {
925
1063
  var hide = this.hideMenuList.filter(function (x) {
926
- return str.indexOf(x[_this.hideMenuKey]) == -1;
1064
+ return str.indexOf(x[_this2.hideMenuKey]) == -1;
927
1065
  });
928
1066
  hide = hide.map(function (x) {
929
- return x[_this.hideMenuKey];
1067
+ return x[_this2.hideMenuKey];
930
1068
  });
931
1069
  this.$emit('hide', hide.join(','));
932
1070
  }
@@ -934,11 +1072,11 @@ var external_vuedraggable_default = /*#__PURE__*/__webpack_require__.n(external_
934
1072
  this.show = false;
935
1073
  },
936
1074
  selectMenu: function selectMenu(val) {
937
- var _this2 = this;
1075
+ var _this3 = this;
938
1076
 
939
1077
  if (val.showMenu) {
940
1078
  this.selectMenuArr = this.selectMenuArr.filter(function (x) {
941
- return x != val[_this2.hideMenuKey];
1079
+ return x != val[_this3.hideMenuKey];
942
1080
  });
943
1081
  } else {
944
1082
  this.selectMenuArr.push(val[this.hideMenuKey]);
@@ -946,7 +1084,7 @@ var external_vuedraggable_default = /*#__PURE__*/__webpack_require__.n(external_
946
1084
  this.$set(val, 'showMenu', !val.showMenu);
947
1085
  },
948
1086
  defaultHide: function defaultHide(val) {
949
- var _this3 = this;
1087
+ var _this4 = this;
950
1088
 
951
1089
  if (this.isHideMenu && val != undefined) {
952
1090
  if (Array.isArray(val)) {
@@ -955,18 +1093,18 @@ var external_vuedraggable_default = /*#__PURE__*/__webpack_require__.n(external_
955
1093
  });
956
1094
  // let menuKey = val.map(x => x.id).join(',');
957
1095
  this.newData = this.data.filter(function (x) {
958
- return menuKey.indexOf(x[_this3.hideMenuKey]) == -1;
1096
+ return menuKey.indexOf(x[_this4.hideMenuKey]) == -1;
959
1097
  });
960
1098
  this.hideMenuList = this.data.filter(function (x) {
961
- return menuKey.indexOf(x[_this3.hideMenuKey]) != -1;
1099
+ return menuKey.indexOf(x[_this4.hideMenuKey]) != -1;
962
1100
  });
963
1101
  } else {
964
1102
  val = val + '';
965
1103
  this.newData = this.data.filter(function (x) {
966
- return val.indexOf(x[_this3.hideMenuKey]) == -1;
1104
+ return val.indexOf(x[_this4.hideMenuKey]) == -1;
967
1105
  });
968
1106
  this.hideMenuList = this.data.filter(function (x) {
969
- return val.indexOf(x[_this3.hideMenuKey]) != -1;
1107
+ return val.indexOf(x[_this4.hideMenuKey]) != -1;
970
1108
  });
971
1109
  }
972
1110
  }
@@ -979,44 +1117,45 @@ var external_vuedraggable_default = /*#__PURE__*/__webpack_require__.n(external_
979
1117
  }
980
1118
  },
981
1119
  handleHide: function handleHide(item) {
982
- var _this4 = this;
1120
+ var _this5 = this;
983
1121
 
984
1122
  this.$dialog.confirm({
985
1123
  message: '\u786E\u5B9A\u8981\u9690\u85CF<span style="color:red;font-weight:bold;margin:0px 5px">' + item.text + '</span>\u83DC\u5355\u5417\uFF1F'
986
1124
  }).then(function () {
987
- if (Array.isArray(_this4.hideMenu)) {
988
- var hideArr = [].concat(_this4.hideMenu, [item]);
989
- _this4.$emit('hide', hideArr);
1125
+ if (Array.isArray(_this5.hideMenu)) {
1126
+ var hideArr = [].concat(_this5.hideMenu, [item]);
1127
+ _this5.$emit('hide', hideArr);
990
1128
  } else {
991
- var hideStr = _this4.hideMenu ? _this4.hideMenu + ',' + item[_this4.hideMenuKey] : item[_this4.hideMenuKey];
992
- _this4.$emit('hide', hideStr);
1129
+ var hideStr = _this5.hideMenu ? _this5.hideMenu + ',' + item[_this5.hideMenuKey] : item[_this5.hideMenuKey];
1130
+ _this5.$emit('hide', hideStr);
993
1131
  }
994
1132
  });
995
1133
  },
996
1134
  goView: function goView(event, val) {
997
- var _this5 = this;
998
-
999
1135
  if (val.menuType === 'add') {
1000
1136
  this.show = true;
1001
1137
  return;
1002
1138
  }
1003
- var currentTime = new Date().getTime();
1004
- var tapLength = currentTime - this.lastTapTime;
1005
- this.lastTapTime = currentTime;
1139
+ // const currentTime = new Date().getTime();
1140
+ // const tapLength = currentTime - this.lastTapTime;
1141
+ // this.lastTapTime = currentTime;
1142
+ // if (tapLength > 300) {
1143
+ // return;
1144
+ // }
1006
1145
  if (this.isHideMenu) {
1007
- if (tapLength < 300) {
1008
- this.handleDoubleClick(val);
1009
- clearTimeout(this.timer);
1010
- return;
1011
- }
1012
- if (this.showHide) {
1013
- this.showHide = false;
1014
- return;
1015
- }
1016
- this.timer = setTimeout(function () {
1017
- _this5.$emit('click', val, event);
1018
- _this5.targetStop && event.stopPropagation();
1019
- }, 300);
1146
+ // if (tapLength < 300) {
1147
+ // this.handleDoubleClick(val);
1148
+ // clearTimeout(this.timer);
1149
+ // return;
1150
+ // }
1151
+ // if (this.showHide) {
1152
+ // this.showHide = false;
1153
+ // return;
1154
+ // }
1155
+ // this.timer = setTimeout(() => {
1156
+ this.$emit('click', val, event);
1157
+ this.targetStop && event.stopPropagation();
1158
+ // }, 300);
1020
1159
  } else {
1021
1160
  this.$emit('click', val, event);
1022
1161
  this.targetStop && event.stopPropagation();