backend-management-ui 1.7.6 → 1.7.8

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 (2) hide show
  1. package/index.common.js +51 -50
  2. package/package.json +1 -1
package/index.common.js CHANGED
@@ -28,6 +28,7 @@ var _startsWithInstanceProperty = require('@babel/runtime-corejs3/core-js-stable
28
28
  var _endsWithInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/ends-with');
29
29
  var _toConsumableArray = require('@babel/runtime-corejs3/helpers/esm/toConsumableArray');
30
30
  var _concatInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/concat');
31
+ var _JSON$stringify = require('@babel/runtime-corejs3/core-js-stable/json/stringify');
31
32
  var _findIndexInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/find-index');
32
33
  var _spliceInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/splice');
33
34
  var VueVirtualScrollList = require('vue-virtual-scroll-list');
@@ -60,6 +61,7 @@ var _startsWithInstanceProperty__default = /*#__PURE__*/_interopDefaultLegacy(_s
60
61
  var _endsWithInstanceProperty__default = /*#__PURE__*/_interopDefaultLegacy(_endsWithInstanceProperty);
61
62
  var _toConsumableArray__default = /*#__PURE__*/_interopDefaultLegacy(_toConsumableArray);
62
63
  var _concatInstanceProperty__default = /*#__PURE__*/_interopDefaultLegacy(_concatInstanceProperty);
64
+ var _JSON$stringify__default = /*#__PURE__*/_interopDefaultLegacy(_JSON$stringify);
63
65
  var _findIndexInstanceProperty__default = /*#__PURE__*/_interopDefaultLegacy(_findIndexInstanceProperty);
64
66
  var _spliceInstanceProperty__default = /*#__PURE__*/_interopDefaultLegacy(_spliceInstanceProperty);
65
67
  var VueVirtualScrollList__default = /*#__PURE__*/_interopDefaultLegacy(VueVirtualScrollList);
@@ -172,23 +174,21 @@ var script$6 = {
172
174
  };
173
175
  var placeholder = "";
174
176
  var componentName = this.getComponentName(item.component);
175
- if (_includesInstanceProperty__default["default"](_context = ["el-select", "select", "el-date-picker", "el-virtual-select"]).call(_context, componentName)) {
176
- placeholder = "\u8BF7\u9009\u62E9".concat(item.label);
177
- }
178
- if (_includesInstanceProperty__default["default"](_context2 = ["el-input", "input"]).call(_context2, componentName)) {
179
- placeholder = "\u8BF7\u8F93\u5165".concat(item.label);
180
- }
177
+ var isSelectLike = _includesInstanceProperty__default["default"](_context = ["el-select", "select", "el-date-picker", "ui-virtual-select"]).call(_context, componentName);
178
+ var isInputLike = _includesInstanceProperty__default["default"](_context2 = ["el-input", "input"]).call(_context2, componentName);
179
+ placeholder = isSelectLike ? "\u8BF7\u9009\u62E9".concat(item.label) : isInputLike ? "\u8BF7\u8F93\u5165".concat(item.label) : "";
181
180
  var baseAttrs = _objectSpread$1({
182
181
  style: style,
183
182
  placeholder: placeholder,
184
183
  clearable: true
185
184
  }, item.attrs || {});
186
- if (componentName === "el-virtual-select") {
187
- console.log(_objectSpread$1(_objectSpread$1({}, baseAttrs), {}, {
188
- options: item.options || []
189
- }), '虚拟滚动');
185
+ if (componentName === "ui-virtual-select") {
190
186
  return _objectSpread$1(_objectSpread$1({}, baseAttrs), {}, {
191
- options: item.options || []
187
+ options: item.options || [],
188
+ fields: item.fields || {
189
+ label: 'label',
190
+ value: 'value'
191
+ }
192
192
  });
193
193
  }
194
194
  return baseAttrs;
@@ -201,7 +201,7 @@ var script$6 = {
201
201
  return this.getComponentName(componentName) === "el-radio-group";
202
202
  },
203
203
  isVirtualSelectComponent: function isVirtualSelectComponent(componentName) {
204
- return this.getComponentName(componentName) === "el-virtual-select";
204
+ return this.getComponentName(componentName) === "ui-virtual-select";
205
205
  },
206
206
  initOptions: function initOptions() {
207
207
  var _this = this;
@@ -1271,8 +1271,6 @@ var __vue_component__$2 = /*#__PURE__*/normalizeComponent({
1271
1271
  //
1272
1272
  //
1273
1273
  //
1274
- //
1275
- //
1276
1274
 
1277
1275
  var script$1 = {
1278
1276
  name: 'UiVirtualSelectItem',
@@ -1314,35 +1312,34 @@ var __vue_render__$1 = function __vue_render__() {
1314
1312
  var _vm = this;
1315
1313
  var _h = _vm.$createElement;
1316
1314
  var _c = _vm._self._c || _h;
1317
- return _c('div', {
1315
+ return _c('el-option', {
1318
1316
  staticClass: "item",
1319
- on: {
1320
- "click": _vm.handleItemClick
1321
- }
1322
- }, [_c('el-option', {
1323
1317
  attrs: {
1324
1318
  "label": _vm.source[_vm.label],
1325
1319
  "value": _vm.source[_vm.value]
1320
+ },
1321
+ on: {
1322
+ "click": _vm.handleItemClick
1326
1323
  }
1327
1324
  }, [_c('span', {
1328
1325
  staticClass: "left-text"
1329
1326
  }, [_vm._v(_vm._s(_vm.source[_vm.label]))]), _vm._v(" "), _vm.rightLabel ? _c('span', {
1330
1327
  staticClass: "right-text"
1331
- }, [_vm._v(_vm._s(_vm.source[_vm.rightLabel]))]) : _vm._e()])], 1);
1328
+ }, [_vm._v(_vm._s(_vm.source[_vm.rightLabel]))]) : _vm._e()]);
1332
1329
  };
1333
1330
  var __vue_staticRenderFns__$1 = [];
1334
1331
 
1335
1332
  /* style */
1336
1333
  var __vue_inject_styles__$1 = function __vue_inject_styles__(inject) {
1337
1334
  if (!inject) return;
1338
- inject("data-v-9d565dc6_0", {
1339
- source: ".item[data-v-9d565dc6]{width:100%;padding:0 20px;box-sizing:border-box;white-space:nowrap;font-size:14px;cursor:pointer}.left-text[data-v-9d565dc6]{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.right-text[data-v-9d565dc6]{margin-left:10px;color:#939393;white-space:nowrap}[data-v-9d565dc6]:deep(.el-option){width:100%!important;padding:0!important;cursor:pointer}",
1335
+ inject("data-v-d0b52dea_0", {
1336
+ source: ".left-text[data-v-d0b52dea]{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.right-text[data-v-d0b52dea]{margin-left:10px;color:#939393;white-space:nowrap}",
1340
1337
  map: undefined,
1341
1338
  media: undefined
1342
1339
  });
1343
1340
  };
1344
1341
  /* scoped */
1345
- var __vue_scope_id__$1 = "data-v-9d565dc6";
1342
+ var __vue_scope_id__$1 = "data-v-d0b52dea";
1346
1343
  /* module identifier */
1347
1344
  var __vue_module_identifier__$1 = undefined;
1348
1345
  /* functional template */
@@ -1408,7 +1405,6 @@ var script = {
1408
1405
  immediate: true,
1409
1406
  handler: function handler(newVal) {
1410
1407
  this.innerValue = this.normalizeValue(newVal);
1411
- console.log('this.innerValue', this.innerValue, this);
1412
1408
  }
1413
1409
  },
1414
1410
  options: {
@@ -1416,7 +1412,6 @@ var script = {
1416
1412
  immediate: true,
1417
1413
  handler: function handler(val) {
1418
1414
  this.filteredData = _toConsumableArray__default["default"](val);
1419
- console.log('this.filteredData: ', this.filteredData, val);
1420
1415
  this.calcMaxItemWidth();
1421
1416
  }
1422
1417
  }
@@ -1462,32 +1457,37 @@ var script = {
1462
1457
  this.setPopperWidth();
1463
1458
  },
1464
1459
  setPopperWidth: function setPopperWidth() {
1465
- var popper = document.querySelector('.virtual-select-popper');
1466
- if (popper) {
1467
- popper.style.width = "".concat(this.maxItemWidth, "px");
1468
- popper.style.minWidth = 'unset';
1469
- popper.style.maxWidth = 'unset';
1470
- }
1460
+ var _this2 = this;
1461
+ this.$nextTick(function () {
1462
+ var _this2$$refs$elSelect;
1463
+ // 通过 el-select 的 popper 关联,而非全局类名
1464
+ var popper = (_this2$$refs$elSelect = _this2.$refs.elSelectRef) === null || _this2$$refs$elSelect === void 0 ? void 0 : _this2$$refs$elSelect.popperElm;
1465
+ if (popper) {
1466
+ popper.style.width = "".concat(_this2.maxItemWidth, "px");
1467
+ popper.style.minWidth = 'unset';
1468
+ popper.style.maxWidth = 'unset';
1469
+ }
1470
+ });
1471
1471
  },
1472
1472
  filterMethod: function filterMethod(query) {
1473
1473
  var _context3,
1474
- _this2 = this;
1475
- this.filteredData = query ? _filterInstanceProperty__default["default"](_context3 = this.options).call(_context3, function (item) {
1476
- var _context4, _context5;
1477
- var labelMatch = _includesInstanceProperty__default["default"](_context4 = item[_this2.fields.label].toLowerCase()).call(_context4, query.toLowerCase());
1478
- var rightLabelMatch = _this2.fields.rightLabel ? _includesInstanceProperty__default["default"](_context5 = item[_this2.fields.rightLabel].toLowerCase()).call(_context5, query.toLowerCase()) : false;
1479
- return labelMatch || rightLabelMatch;
1480
- }) : _toConsumableArray__default["default"](this.options);
1474
+ _this3 = this;
1475
+ var lowerQuery = (query === null || query === void 0 ? void 0 : query.toLowerCase()) || '';
1476
+ this.filteredData = lowerQuery ? _filterInstanceProperty__default["default"](_context3 = this.options).call(_context3, function (item) {
1477
+ var label = (item[_this3.fields.label] || '').toLowerCase();
1478
+ var rightLabel = _this3.fields.rightLabel ? (item[_this3.fields.rightLabel] || '').toLowerCase() : '';
1479
+ return _includesInstanceProperty__default["default"](label).call(label, lowerQuery) || _includesInstanceProperty__default["default"](rightLabel).call(rightLabel, lowerQuery);
1480
+ }) : JSON.parse(_JSON$stringify__default["default"](this.options)); // 深拷贝避免引用污染
1481
1481
  this.$nextTick(function () {
1482
- var _this2$$refs$virtualL;
1483
- return (_this2$$refs$virtualL = _this2.$refs.virtualList) === null || _this2$$refs$virtualL === void 0 ? void 0 : _this2$$refs$virtualL.scrollToIndex(0);
1482
+ var _this3$$refs$virtualL;
1483
+ return (_this3$$refs$virtualL = _this3.$refs.virtualList) === null || _this3$$refs$virtualL === void 0 ? void 0 : _this3$$refs$virtualL.scrollToIndex(0);
1484
1484
  });
1485
1485
  },
1486
1486
  handleVisibleChange: function handleVisibleChange(visible) {
1487
- var _this3 = this;
1487
+ var _this4 = this;
1488
1488
  if (visible) {
1489
1489
  this.$nextTick(function () {
1490
- _this3.setPopperWidth();
1490
+ _this4.setPopperWidth();
1491
1491
  });
1492
1492
  } else {
1493
1493
  var _this$$refs$virtualLi;
@@ -1500,21 +1500,21 @@ var script = {
1500
1500
  var isMultiple = (_this$$attrs2 = this.$attrs) === null || _this$$attrs2 === void 0 ? void 0 : _this$$attrs2.multiple; // 判断是否为多选模式
1501
1501
  var normalizedValue = this.normalizeValue(selectedValue);
1502
1502
  if (isMultiple) {
1503
- var _context6;
1503
+ var _context4;
1504
1504
  // 多选:切换选中状态(存在则移除,不存在则添加)
1505
- var valueIndex = _findIndexInstanceProperty__default["default"](_context6 = this.innerValue).call(_context6, function (val) {
1505
+ var valueIndex = _findIndexInstanceProperty__default["default"](_context4 = this.innerValue).call(_context4, function (val) {
1506
1506
  return val === selectedValue;
1507
1507
  });
1508
1508
  if (valueIndex > -1) {
1509
- var _context7;
1510
- _spliceInstanceProperty__default["default"](_context7 = this.innerValue).call(_context7, valueIndex, 1);
1509
+ var _context5;
1510
+ _spliceInstanceProperty__default["default"](_context5 = this.innerValue).call(_context5, valueIndex, 1);
1511
1511
  } else {
1512
1512
  this.innerValue.push(selectedValue);
1513
1513
  }
1514
1514
  var newVal = _toConsumableArray__default["default"](this.innerValue);
1515
1515
  this.$refs.elSelectRef.$emit('change', newVal);
1516
1516
  } else {
1517
- his.innerValue = normalizedValue;
1517
+ this.innerValue = normalizedValue;
1518
1518
  this.$refs.elSelectRef.visible = false; // 手动关闭下拉
1519
1519
  this.$refs.elSelectRef.$emit('change', normalizedValue);
1520
1520
  }
@@ -1543,6 +1543,7 @@ var __vue_render__ = function __vue_render__() {
1543
1543
  staticClass: "select-wrap"
1544
1544
  }, [_c('el-select', _vm._b({
1545
1545
  ref: "elSelectRef",
1546
+ staticClass: "bm-select",
1546
1547
  attrs: {
1547
1548
  "value": _vm.innerValue,
1548
1549
  "popper-class": "virtual-select-popper",
@@ -1579,14 +1580,14 @@ var __vue_staticRenderFns__ = [];
1579
1580
  /* style */
1580
1581
  var __vue_inject_styles__ = function __vue_inject_styles__(inject) {
1581
1582
  if (!inject) return;
1582
- inject("data-v-b8b86322_0", {
1583
- source: ".select-wrap[data-v-b8b86322]{position:relative}.select-wrap[data-v-b8b86322] :deep(.el-select){width:100%}.virtual-select-popper[data-v-b8b86322]{padding:0!important;border:1px solid #e4e7ed!important;border-radius:4px!important}.virtual-list[data-v-b8b86322]{max-height:245px;overflow-y:auto;overflow-x:hidden!important;scrollbar-width:thin;scrollbar-color:#e4e7ed #f5f7fa}.virtual-list[data-v-b8b86322]::-webkit-scrollbar{width:6px!important;display:block!important}.virtual-list[data-v-b8b86322]::-webkit-scrollbar-thumb{background-color:#e4e7ed;border-radius:3px}.virtual-list[data-v-b8b86322]::-webkit-scrollbar-track{background-color:#f5f7fa}[data-v-b8b86322]:deep(.el-scrollbar__bar.is-vertical){display:none!important}",
1583
+ inject("data-v-9f7aa2de_0", {
1584
+ source: ".select-wrap[data-v-9f7aa2de]{position:relative}.select-wrap .bm-select[data-v-9f7aa2de]{width:100%}.virtual-select-popper[data-v-9f7aa2de]{padding:0!important;border:1px solid #e4e7ed!important;border-radius:4px!important}.virtual-list[data-v-9f7aa2de]{max-height:245px;overflow-y:auto;overflow-x:hidden!important;scrollbar-width:thin;scrollbar-color:#e4e7ed #f5f7fa}.virtual-list[data-v-9f7aa2de]::-webkit-scrollbar{width:6px!important;display:block!important}.virtual-list[data-v-9f7aa2de]::-webkit-scrollbar-thumb{background-color:#e4e7ed;border-radius:3px}.virtual-list[data-v-9f7aa2de]::-webkit-scrollbar-track{background-color:#f5f7fa}[data-v-9f7aa2de]:deep(.el-scrollbar__bar.is-vertical){display:none!important}",
1584
1585
  map: undefined,
1585
1586
  media: undefined
1586
1587
  });
1587
1588
  };
1588
1589
  /* scoped */
1589
- var __vue_scope_id__ = "data-v-b8b86322";
1590
+ var __vue_scope_id__ = "data-v-9f7aa2de";
1590
1591
  /* module identifier */
1591
1592
  var __vue_module_identifier__ = undefined;
1592
1593
  /* functional template */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "backend-management-ui",
3
- "version": "1.7.6",
3
+ "version": "1.7.8",
4
4
  "description": "一个基于Vue+ElementUI封装的后台管理仓库,包含表格、表单、弹窗、按钮组、虚拟下拉框等常用组件",
5
5
  "author": {
6
6
  "name": "adolf3",