@panpanzhao/component-ui 1.0.2 → 1.24.813

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.
@@ -82,7 +82,7 @@ module.exports =
82
82
  /******/
83
83
  /******/
84
84
  /******/ // Load entry module and return exports
85
- /******/ return __webpack_require__(__webpack_require__.s = 75);
85
+ /******/ return __webpack_require__(__webpack_require__.s = 76);
86
86
  /******/ })
87
87
  /************************************************************************/
88
88
  /******/ ({
@@ -197,6 +197,13 @@ function normalizeComponent(
197
197
  }
198
198
 
199
199
 
200
+ /***/ }),
201
+
202
+ /***/ 12:
203
+ /***/ (function(module, exports) {
204
+
205
+ module.exports = require("element-ui/lib/message");
206
+
200
207
  /***/ }),
201
208
 
202
209
  /***/ 18:
@@ -213,7 +220,7 @@ module.exports = require("lodash");
213
220
 
214
221
  /***/ }),
215
222
 
216
- /***/ 20:
223
+ /***/ 22:
217
224
  /***/ (function(module, exports) {
218
225
 
219
226
  module.exports = require("element-ui/lib/table-column");
@@ -255,15 +262,15 @@ module.exports = require("element-ui/lib/pagination");
255
262
 
256
263
  /***/ }),
257
264
 
258
- /***/ 75:
265
+ /***/ 76:
259
266
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
260
267
 
261
268
  "use strict";
262
269
  // ESM COMPAT FLAG
263
270
  __webpack_require__.r(__webpack_exports__);
264
271
 
265
- // CONCATENATED MODULE: ./node_modules/.pnpm/vue-loader@15.11.1_css-loader@2.1.1_lodash@4.17.21_vue-template-compiler@2.7.16_webpack@4.47.0/node_modules/vue-loader/lib/loaders/templateLoader.js??ref--5!./node_modules/.pnpm/vue-loader@15.11.1_css-loader@2.1.1_lodash@4.17.21_vue-template-compiler@2.7.16_webpack@4.47.0/node_modules/vue-loader/lib??vue-loader-options!./src/components/table/src/table.vue?vue&type=template&id=1a5269fa
266
- var tablevue_type_template_id_1a5269fa_render = function render() {
272
+ // CONCATENATED MODULE: ./node_modules/.pnpm/vue-loader@15.11.1_css-loader@2.1.1_lodash@4.17.21_vue-template-compiler@2.7.16_webpack@4.47.0/node_modules/vue-loader/lib/loaders/templateLoader.js??ref--5!./node_modules/.pnpm/vue-loader@15.11.1_css-loader@2.1.1_lodash@4.17.21_vue-template-compiler@2.7.16_webpack@4.47.0/node_modules/vue-loader/lib??vue-loader-options!./src/components/table/src/table.vue?vue&type=template&id=31feda6c
273
+ var tablevue_type_template_id_31feda6c_render = function render() {
267
274
  var _vm = this,
268
275
  _c = _vm._self._c
269
276
  return _c("div", { staticClass: "table" }, [
@@ -324,28 +331,121 @@ var tablevue_type_template_id_1a5269fa_render = function render() {
324
331
  1
325
332
  ),
326
333
  _vm.pagination
327
- ? _c(
328
- "div",
329
- { staticClass: "table__pagination" },
330
- [
331
- _c(
332
- "el-pagination",
333
- _vm._g(
334
- _vm._b({}, "el-pagination", _vm.paginationProps, false),
335
- _vm.paginationListeners
334
+ ? _c("div", { staticClass: "table__pagination" }, [
335
+ _c(
336
+ "div",
337
+ [
338
+ _c(
339
+ "el-pagination",
340
+ _vm._g(
341
+ _vm._b({}, "el-pagination", _vm.paginationProps, false),
342
+ _vm.paginationListeners
343
+ )
344
+ ),
345
+ ],
346
+ 1
347
+ ),
348
+ _vm.columnsKey
349
+ ? _c(
350
+ "div",
351
+ [
352
+ _c("el-popover", { attrs: { placement: "top" } }, [
353
+ _c("div", { staticClass: "table-setting" }, [
354
+ _c(
355
+ "div",
356
+ { staticClass: "table-setting__title" },
357
+ [
358
+ _c("el-input", {
359
+ attrs: { size: "small", placeholder: "请输入列名" },
360
+ model: {
361
+ value: _vm.columnKey,
362
+ callback: function ($$v) {
363
+ _vm.columnKey = $$v
364
+ },
365
+ expression: "columnKey",
366
+ },
367
+ }),
368
+ ],
369
+ 1
370
+ ),
371
+ _c(
372
+ "div",
373
+ { staticClass: "table-setting__body" },
374
+ _vm._l(_vm.columnsSetting, function (item) {
375
+ return _c(
376
+ "div",
377
+ { key: item.prop, staticClass: "item" },
378
+ [
379
+ _c("el-switch", {
380
+ on: {
381
+ change: (value) =>
382
+ _vm.handleSetting(value, item),
383
+ },
384
+ model: {
385
+ value: item.disable,
386
+ callback: function ($$v) {
387
+ _vm.$set(item, "disable", $$v)
388
+ },
389
+ expression: "item.disable",
390
+ },
391
+ }),
392
+ _c("span", { staticClass: "item-label" }, [
393
+ _vm._v(_vm._s(item.label)),
394
+ ]),
395
+ ],
396
+ 1
397
+ )
398
+ }),
399
+ 0
400
+ ),
401
+ _c(
402
+ "div",
403
+ {
404
+ staticStyle: {
405
+ "text-align": "right",
406
+ "margin-top": "10px",
407
+ },
408
+ },
409
+ [
410
+ _c(
411
+ "el-button",
412
+ {
413
+ attrs: { size: "mini" },
414
+ on: { click: _vm.resetColumn },
415
+ },
416
+ [_vm._v("重置")]
417
+ ),
418
+ _c(
419
+ "el-button",
420
+ {
421
+ attrs: { type: "primary", size: "mini" },
422
+ on: { click: _vm.saveColumn },
423
+ },
424
+ [_vm._v("保存")]
425
+ ),
426
+ ],
427
+ 1
428
+ ),
429
+ ]),
430
+ _c(
431
+ "span",
432
+ { attrs: { slot: "reference" }, slot: "reference" },
433
+ [_c("i", { staticClass: "el-icon-s-grid" })]
434
+ ),
435
+ ]),
436
+ ],
437
+ 1
336
438
  )
337
- ),
338
- ],
339
- 1
340
- )
439
+ : _vm._e(),
440
+ ])
341
441
  : _vm._e(),
342
442
  ])
343
443
  }
344
444
  var staticRenderFns = []
345
- tablevue_type_template_id_1a5269fa_render._withStripped = true
445
+ tablevue_type_template_id_31feda6c_render._withStripped = true
346
446
 
347
447
 
348
- // CONCATENATED MODULE: ./src/components/table/src/table.vue?vue&type=template&id=1a5269fa
448
+ // CONCATENATED MODULE: ./src/components/table/src/table.vue?vue&type=template&id=31feda6c
349
449
 
350
450
  // EXTERNAL MODULE: external "@vue/babel-helper-vue-jsx-merge-props"
351
451
  var babel_helper_vue_jsx_merge_props_ = __webpack_require__(0);
@@ -360,7 +460,7 @@ var table_ = __webpack_require__(32);
360
460
  var table_default = /*#__PURE__*/__webpack_require__.n(table_);
361
461
 
362
462
  // EXTERNAL MODULE: external "element-ui/lib/table-column"
363
- var table_column_ = __webpack_require__(20);
463
+ var table_column_ = __webpack_require__(22);
364
464
  var table_column_default = /*#__PURE__*/__webpack_require__.n(table_column_);
365
465
 
366
466
  // EXTERNAL MODULE: external "element-ui/lib/pagination"
@@ -380,6 +480,10 @@ var index_ = __webpack_require__(18);
380
480
  // EXTERNAL MODULE: external "lodash"
381
481
  var external_lodash_ = __webpack_require__(2);
382
482
 
483
+ // EXTERNAL MODULE: external "element-ui/lib/message"
484
+ var message_ = __webpack_require__(12);
485
+ var message_default = /*#__PURE__*/__webpack_require__.n(message_);
486
+
383
487
  // CONCATENATED MODULE: ./node_modules/.pnpm/babel-loader@8.3.0_@babel+core@7.23.9_webpack@4.47.0/node_modules/babel-loader/lib!./node_modules/.pnpm/vue-loader@15.11.1_css-loader@2.1.1_lodash@4.17.21_vue-template-compiler@2.7.16_webpack@4.47.0/node_modules/vue-loader/lib??vue-loader-options!./src/components/table/src/table.vue?vue&type=script&lang=js
384
488
 
385
489
 
@@ -390,6 +494,7 @@ var external_lodash_ = __webpack_require__(2);
390
494
 
391
495
 
392
496
 
497
+
393
498
  /* harmony default export */ var tablevue_type_script_lang_js = ({
394
499
  name: "Table",
395
500
  componentName: "Table",
@@ -494,6 +599,7 @@ var external_lodash_ = __webpack_require__(2);
494
599
  }
495
600
  },
496
601
  dataSource: Object,
602
+ columnsKey: String,
497
603
  columns: {
498
604
  type: Array,
499
605
  default: function _default() {
@@ -532,7 +638,9 @@ var external_lodash_ = __webpack_require__(2);
532
638
  remoteData: null,
533
639
  currentPage: 1,
534
640
  pageSize: 10,
535
- total: 0
641
+ total: 0,
642
+ columnKey: null,
643
+ columnMap: {}
536
644
  };
537
645
  },
538
646
  watch: {
@@ -542,13 +650,34 @@ var external_lodash_ = __webpack_require__(2);
542
650
  }
543
651
  },
544
652
  computed: {
545
- filterColumns: function filterColumns() {
653
+ columnsSetting: function columnsSetting() {
546
654
  var _this2 = this;
655
+ var columns = this.columns.reduce(function (pre, cur) {
656
+ if (["Sequence", "Selection", "Operate"].indexOf(cur.control) > -1) {
657
+ return pre;
658
+ }
659
+ if (_this2.columnKey && cur.label && cur.label.indexOf(_this2.columnKey) === -1) {
660
+ return pre;
661
+ }
662
+ pre.push({
663
+ prop: cur.prop,
664
+ label: cur.label,
665
+ disable: _this2.columnMap[cur.prop] === false ? false : true
666
+ });
667
+ return pre;
668
+ }, []);
669
+ return columns;
670
+ },
671
+ filterColumns: function filterColumns() {
672
+ var _this3 = this;
547
673
  return this.columns.filter(function (item) {
674
+ if (_this3.columnMap[item.prop] === false) {
675
+ return false;
676
+ }
548
677
  if (item.show === false) {
549
678
  return false;
550
679
  }
551
- if (typeof item.show === "function" && !item.show.call(_this2, {
680
+ if (typeof item.show === "function" && !item.show.call(_this3, {
552
681
  item: item
553
682
  })) {
554
683
  return false;
@@ -582,32 +711,32 @@ var external_lodash_ = __webpack_require__(2);
582
711
  });
583
712
  },
584
713
  tableListeners: function tableListeners() {
585
- var _this3 = this;
714
+ var _this4 = this;
586
715
  return Object.assign({}, this.$listeners, this.on, {
587
716
  "row-click": function rowClick(row) {
588
- var selectColumns = _this3.columns.filter(function (item) {
717
+ var selectColumns = _this4.columns.filter(function (item) {
589
718
  return item.control === "Selection";
590
719
  });
591
720
  if (selectColumns && selectColumns.length > 0) {
592
721
  var selectColumn = selectColumns[0];
593
722
  if (selectColumn.type === "radio") {
594
- var key = selectColumn.prop || _this3.tableProps.rowKey;
595
- _this3.rowId = row[key];
596
- _this3.selection = [row];
723
+ var key = selectColumn.prop || _this4.tableProps.rowKey;
724
+ _this4.rowId = row[key];
725
+ _this4.selection = [row];
597
726
  } else {
598
- _this3.$refs.table.toggleRowSelection(row); // 点击选中
727
+ _this4.$refs.table.toggleRowSelection(row); // 点击选中
599
728
  }
600
729
  }
601
- _this3.$emit("row-click", row);
602
- if (typeof _this3.on["row-click"] === "function") {
603
- _this3.on["row-click"].call(_this3, row);
730
+ _this4.$emit("row-click", row);
731
+ if (typeof _this4.on["row-click"] === "function") {
732
+ _this4.on["row-click"].call(_this4, row);
604
733
  }
605
734
  },
606
735
  "selection-change": function selectionChange(selection) {
607
- _this3.selection = selection;
608
- _this3.$emit("selection-change", selection);
609
- if (typeof _this3.on["selection-change"] === "function") {
610
- _this3.on["selection-change"].call(_this3, selection);
736
+ _this4.selection = selection;
737
+ _this4.$emit("selection-change", selection);
738
+ if (typeof _this4.on["selection-change"] === "function") {
739
+ _this4.on["selection-change"].call(_this4, selection);
611
740
  }
612
741
  }
613
742
  });
@@ -626,27 +755,37 @@ var external_lodash_ = __webpack_require__(2);
626
755
  });
627
756
  },
628
757
  paginationListeners: function paginationListeners() {
629
- var _this4 = this;
758
+ var _this5 = this;
630
759
  return Object.assign({}, this.pagination.on, {
631
760
  "size-change": function sizeChange(pageSize) {
632
- _this4.$emit("size-change", pageSize);
633
- _this4.pageSize = pageSize;
634
- _this4.$emit("pageChange", _this4.paginationProps.currentPage, pageSize);
635
- _this4.search();
761
+ _this5.$emit("size-change", pageSize);
762
+ _this5.pageSize = pageSize;
763
+ _this5.$emit("pageChange", _this5.paginationProps.currentPage, pageSize);
764
+ _this5.search();
636
765
  },
637
766
  "current-change": function currentChange(currentPage) {
638
- _this4.$emit("current-change", currentPage);
639
- _this4.currentPage = currentPage;
640
- _this4.$emit("pageChange", currentPage, _this4.paginationProps.pageSize);
641
- _this4.search();
767
+ _this5.$emit("current-change", currentPage);
768
+ _this5.currentPage = currentPage;
769
+ _this5.$emit("pageChange", currentPage, _this5.paginationProps.pageSize);
770
+ _this5.search();
642
771
  }
643
772
  });
644
773
  }
645
774
  },
646
775
  created: function created() {
776
+ var _this6 = this;
647
777
  if (this.pagination && this.pagination.pageSize) {
648
778
  this.pageSize = this.pagination.pageSize;
649
779
  }
780
+ if (this.columnsKey) {
781
+ var columnStorage = JSON.parse(localStorage.getItem("component_columns") || "{}");
782
+ var columnList = columnStorage && columnStorage[this.columnsKey];
783
+ if (columnList) {
784
+ columnList.forEach(function (prop) {
785
+ _this6.$set(_this6.columnMap, prop, false);
786
+ });
787
+ }
788
+ }
650
789
  },
651
790
  mounted: function mounted() {
652
791
  if (this.hasInit) {
@@ -662,11 +801,11 @@ var external_lodash_ = __webpack_require__(2);
662
801
  this.search();
663
802
  },
664
803
  search: function search() {
665
- var _this5 = this;
804
+ var _this7 = this;
666
805
  if (!(this.requester && this.api.url)) {
667
806
  return false;
668
807
  }
669
- var reqData = Object.assign({}, this.api.data);
808
+ var reqData = Object.assign({}, this.api.body, this.api.data);
670
809
  if (this.pagination) {
671
810
  Object(external_lodash_["set"])(reqData, this.remoteDataProp.currentPage, this.currentPage);
672
811
  Object(external_lodash_["set"])(reqData, this.remoteDataProp.pageSize, this.pageSize);
@@ -684,26 +823,48 @@ var external_lodash_ = __webpack_require__(2);
684
823
  headers: this.api.headers,
685
824
  data: reqData
686
825
  }).then(function (res) {
687
- if (typeof _this5.api.after === "function") {
688
- res = _this5.api.after.call(_this5, res);
826
+ if (typeof _this7.api.after === "function") {
827
+ res = _this7.api.after.call(_this7, res);
689
828
  }
690
- _this5.remoteData = _this5.remoteDataProp.data ? Object(external_lodash_["get"])(res, _this5.remoteDataProp.data, []) : res;
691
- if (_this5.pagination) {
692
- _this5.total = Object(external_lodash_["get"])(res, _this5.remoteDataProp.total, 0);
829
+ _this7.remoteData = _this7.remoteDataProp.data ? Object(external_lodash_["get"])(res, _this7.remoteDataProp.data, []) : res;
830
+ if (_this7.pagination) {
831
+ _this7.total = Object(external_lodash_["get"])(res, _this7.remoteDataProp.total, 0);
693
832
  }
694
- _this5.$emit("success", {
695
- request: _this5.requester,
833
+ _this7.$emit("success", {
834
+ request: _this7.requester,
696
835
  reqData: reqData,
697
836
  resData: res
698
837
  });
699
838
  }).catch(function (error) {
700
- _this5.remoteData = [], _this5.total = 0;
701
- _this5.$emit("error", {
702
- request: _this5.requester,
839
+ _this7.remoteData = [], _this7.total = 0;
840
+ _this7.$emit("error", {
841
+ request: _this7.requester,
703
842
  reqData: reqData,
704
843
  resError: error
705
844
  });
706
845
  });
846
+ },
847
+ resetColumn: function resetColumn() {
848
+ this.columnMap = {};
849
+ },
850
+ saveColumn: function saveColumn() {
851
+ var _this8 = this;
852
+ var columnStorage = JSON.parse(localStorage.getItem("component_columns") || "{}");
853
+ columnStorage[this.columnsKey] = Object.keys(this.columnMap).filter(function (itemKey) {
854
+ if (_this8.columnMap[itemKey] === false) {
855
+ return true;
856
+ }
857
+ return false;
858
+ });
859
+ localStorage.setItem("component_columns", JSON.stringify(columnStorage));
860
+ message_default()({
861
+ showClose: true,
862
+ message: "设置成功",
863
+ type: "success"
864
+ });
865
+ },
866
+ handleSetting: function handleSetting(value, item) {
867
+ this.$set(this.columnMap, item.prop, value);
707
868
  }
708
869
  }
709
870
  });
@@ -722,7 +883,7 @@ var componentNormalizer = __webpack_require__(1);
722
883
 
723
884
  var component = Object(componentNormalizer["a" /* default */])(
724
885
  src_tablevue_type_script_lang_js,
725
- tablevue_type_template_id_1a5269fa_render,
886
+ tablevue_type_template_id_31feda6c_render,
726
887
  staticRenderFns,
727
888
  false,
728
889
  null,