iov-pro-components 0.0.21 → 0.0.23

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.
@@ -8378,7 +8378,9 @@ var script$j = {
8378
8378
  modelValue: {}
8379
8379
  },
8380
8380
  // 需要触发的钩子函数
8381
- hooks: _defineProperty$1(_defineProperty$1(_defineProperty$1(_defineProperty$1(_defineProperty$1({}, HOOKS.INIT, []), HOOKS.DO_LAYOUT, []), HOOKS.VALUE_CHANGE, []), HOOKS.OPTION_CHANGE, []), HOOKS.PROPS_CHANGE, [])
8381
+ hooks: _defineProperty$1(_defineProperty$1(_defineProperty$1(_defineProperty$1(_defineProperty$1({}, HOOKS.INIT, []), HOOKS.DO_LAYOUT, []), HOOKS.VALUE_CHANGE, []), HOOKS.OPTION_CHANGE, []), HOOKS.PROPS_CHANGE, []),
8382
+ // 当前所有的form-item集合
8383
+ formItems: []
8382
8384
  };
8383
8385
  },
8384
8386
  computed: {
@@ -8388,16 +8390,20 @@ var script$j = {
8388
8390
  */
8389
8391
  formProps: function formProps() {
8390
8392
  return this.normalizeFormProps();
8391
- },
8392
- /**
8393
- * 当前所有的form-item集合
8394
- * @time 2024-11-04 17:23:02
8395
- */
8396
- formItems: function formItems() {
8397
- return this.normalizeFormItems(this.items);
8398
8393
  }
8399
8394
  },
8400
8395
  watch: {
8396
+ /**
8397
+ * 监听items的变化,如果变化了,重新生成formItems
8398
+ * @time 2025-06-20 11:25:49
8399
+ */
8400
+ items: {
8401
+ handler: function handler() {
8402
+ this.formItems = this.normalizeFormItems(this.items);
8403
+ },
8404
+ deep: true,
8405
+ immediate: true
8406
+ },
8401
8407
  /**
8402
8408
  * 如果表单数据的变化,则v-model双向绑定外部数据
8403
8409
  * @time 2024-11-01 15:17:51
@@ -8465,31 +8471,36 @@ var script$j = {
8465
8471
  // 遍历当前传入的数据
8466
8472
  valueKeys.forEach(function (key) {
8467
8473
  // 取出当前表单项配置
8468
- var formItem = _this2.formItems.find(function (item) {
8474
+ var formItems = _this2.formItems.filter(function (item) {
8469
8475
  return Array.isArray(item.name) ? item.name.includes(key) : item.name === key;
8476
+ }).filter(function (item) {
8477
+ return _this2.vif(item);
8470
8478
  });
8471
8479
  // 如果当前是表单的字段
8472
- if (formItem) {
8473
- // 如果当前名称需要解构
8474
- if (Array.isArray(formItem.name)) {
8475
- var _this2$modelValue$for;
8476
- // 当前key在数组中索引
8477
- var nameIndex = formItem.name.indexOf(key);
8478
- // 值发生改变
8479
- if (!isEqual(_this2.value[key], (_this2$modelValue$for = _this2.modelValue[formItem.key]) === null || _this2$modelValue$for === void 0 ? void 0 : _this2$modelValue$for[nameIndex])) {
8480
- // 如果字段值不存在
8481
- if (isEmpty(_this2.modelValue[formItem.key])) {
8482
- _this2.$set(_this2.modelValue, formItem.key, []);
8480
+ if (formItems && formItems.length > 0) {
8481
+ // 遍历数据
8482
+ formItems.forEach(function (formItem) {
8483
+ // 如果当前名称需要解构
8484
+ if (Array.isArray(formItem.name)) {
8485
+ var _this2$modelValue$for;
8486
+ // 当前key在数组中索引
8487
+ var nameIndex = formItem.name.indexOf(key);
8488
+ // 值发生改变
8489
+ if (!isEqual(_this2.value[key], (_this2$modelValue$for = _this2.modelValue[formItem.key]) === null || _this2$modelValue$for === void 0 ? void 0 : _this2$modelValue$for[nameIndex])) {
8490
+ // 如果字段值不存在
8491
+ if (isEmpty(_this2.modelValue[formItem.key])) {
8492
+ _this2.$set(_this2.modelValue, formItem.key, []);
8493
+ }
8494
+ // 设置值
8495
+ _this2.$set(_this2.modelValue[formItem.key], nameIndex, _this2.value[key]);
8496
+ }
8497
+ } else {
8498
+ // 值发生改变
8499
+ if (!isEqual(_this2.value[key], _this2.modelValue[formItem.key])) {
8500
+ _this2.$set(_this2.modelValue, formItem.key, _this2.value[key]);
8483
8501
  }
8484
- // 设置值
8485
- _this2.$set(_this2.modelValue[formItem.key], nameIndex, _this2.value[key]);
8486
- }
8487
- } else {
8488
- // 值发生改变
8489
- if (!isEqual(_this2.value[key], _this2.modelValue[formItem.key])) {
8490
- _this2.$set(_this2.modelValue, formItem.key, _this2.value[key]);
8491
8502
  }
8492
- }
8503
+ });
8493
8504
  } else {
8494
8505
  // 值发生改变
8495
8506
  if (!isEqual(_this2.value[key], _this2.modelValue[key])) {
@@ -8523,7 +8534,7 @@ var script$j = {
8523
8534
  }
8524
8535
  } else {
8525
8536
  // 值被清空了
8526
- if (isNil(_this2.value[key])) {
8537
+ if (isNil(_this2.value[formItem.name])) {
8527
8538
  _this2.clearFieldValue(formItem);
8528
8539
  }
8529
8540
  }
@@ -11393,6 +11404,7 @@ var script$9 = {
11393
11404
  var _this$request = this.request,
11394
11405
  _api = _this$request.api,
11395
11406
  params = _this$request.params,
11407
+ hideLoading = _this$request.hideLoading,
11396
11408
  requiredFields = _this$request.requiredFields,
11397
11409
  reloadOnParamsChange = _this$request.reloadOnParamsChange,
11398
11410
  threshold = _this$request.threshold;
@@ -11425,6 +11437,7 @@ var script$9 = {
11425
11437
  },
11426
11438
  params: requestParams,
11427
11439
  requiredFields: requiredFields,
11440
+ hideLoading: hideLoading || false,
11428
11441
  reloadOnParamsChange: isNil$2(reloadOnParamsChange) ? true : reloadOnParamsChange,
11429
11442
  threshold: threshold || 10
11430
11443
  };
@@ -11709,8 +11722,18 @@ var script$9 = {
11709
11722
  * @time 2024-11-27 18:42:59
11710
11723
  */
11711
11724
  doLayout: function doLayout(columns) {
11725
+ var _this5 = this;
11712
11726
  // 记录当前隐藏的列
11713
- this.displayColumns = columns.filter(this.vif);
11727
+ this.displayColumns = columns.filter(this.vif).map(function (column) {
11728
+ // 处理后的数据
11729
+ var columnCopy = {};
11730
+ // 遍历字段的key
11731
+ Object.keys(column).forEach(function (fieldKey) {
11732
+ columnCopy[fieldKey] = isEvalFunction(column[fieldKey]) ? _this5.functionEval(column[fieldKey]) : column[fieldKey];
11733
+ });
11734
+ // 返回处理后的数据
11735
+ return columnCopy;
11736
+ });
11714
11737
  // 重新渲染
11715
11738
  this.tableKey = randomString(32);
11716
11739
  },
@@ -11738,7 +11761,7 @@ var script$9 = {
11738
11761
  }
11739
11762
  },
11740
11763
  render: function render() {
11741
- var _this5 = this;
11764
+ var _this6 = this;
11742
11765
  var h = arguments[0];
11743
11766
  var _getComponentNames = getComponentNames(['table', 'table-column', 'tag', 'link', 'pagination']),
11744
11767
  _getComponentNames2 = _slicedToArray(_getComponentNames, 5),
@@ -11771,24 +11794,24 @@ var script$9 = {
11771
11794
  "class": 'iov-pro-table'
11772
11795
  }, [h(Table, _mergeJSXProps([{
11773
11796
  "ref": 'table',
11774
- "key": _this5.tableKey
11797
+ "key": _this6.tableKey
11775
11798
  }, {
11776
11799
  "props": _objectSpread2({
11777
- data: data ? lodashGet(data, _this5.aliasMap.list) : []
11778
- }, _this5.tableConfig)
11800
+ data: data ? lodashGet(data, _this6.aliasMap.list) : []
11801
+ }, _this6.tableConfig)
11779
11802
  }, {
11780
11803
  "class": 'iov-pro-table__table'
11781
11804
  }, {
11782
- "on": _this5.bindEvent(TABLE_EVENTS)
11805
+ "on": _this6.bindEvent(TABLE_EVENTS)
11783
11806
  }]), [
11784
11807
  // 遍历配置项
11785
- _this5.displayColumns.map(function (column) {
11808
+ _this6.displayColumns.map(function (column) {
11786
11809
  // 当前属性
11787
- var props = _this5.getTableProps(column);
11810
+ var props = _this6.getTableProps(column);
11788
11811
  // slots
11789
11812
  var scopedSlots = {};
11790
11813
  // 插槽的执行方法
11791
- var scopedSlotsFunc = column.slotName ? _this5.$scopedSlots[column.slotName] : _this5.$scopedSlots[column.prop];
11814
+ var scopedSlotsFunc = column.slotName ? _this6.$scopedSlots[column.slotName] : _this6.$scopedSlots[column.prop];
11792
11815
  // 根据类型去设置props和scopedSlots
11793
11816
  switch (column.type) {
11794
11817
  case 'enum':
@@ -11916,17 +11939,17 @@ var script$9 = {
11916
11939
  "column": column
11917
11940
  },
11918
11941
  "on": {
11919
- "sort": _this5.onSortAdvance.bind(_this5, column),
11942
+ "sort": _this6.onSortAdvance.bind(_this6, column),
11920
11943
  "confirm": function confirm(val) {
11921
- return _this5.onConfirmAdvance(column, val);
11944
+ return _this6.onConfirmAdvance(column, val);
11922
11945
  },
11923
- "reset": _this5.onResetAdvance.bind(_this5, column)
11946
+ "reset": _this6.onResetAdvance.bind(_this6, column)
11924
11947
  }
11925
11948
  }));
11926
11949
  }
11927
11950
  });
11928
11951
  // 表头插槽
11929
- var scopedSlotsHeader = _this5.$scopedSlots["".concat(column.prop, ":header")];
11952
+ var scopedSlotsHeader = _this6.$scopedSlots["".concat(column.prop, ":header")];
11930
11953
  // 如果当前有搜索,排序等功能
11931
11954
  if (tableColumnHeader.length > 0) {
11932
11955
  scopedSlots.header = function () {
@@ -11954,23 +11977,23 @@ var script$9 = {
11954
11977
  }]));
11955
11978
  })]),
11956
11979
  // 如果有分页数量才展示
11957
- data && lodashGet(data, _this5.aliasMap.totalCount) > 0 && _this5.config.pagination !== false ? h(Pagination, _mergeJSXProps([{}, {
11958
- "props": _objectSpread2(_objectSpread2({}, _this5.paginationConfig), {}, {
11959
- currentPage: _this5.currPage,
11960
- pageSize: _this5.pageSize,
11961
- total: lodashGet(data, _this5.aliasMap.totalCount)
11980
+ data && lodashGet(data, _this6.aliasMap.totalCount) > 0 && _this6.config.pagination !== false ? h(Pagination, _mergeJSXProps([{}, {
11981
+ "props": _objectSpread2(_objectSpread2({}, _this6.paginationConfig), {}, {
11982
+ currentPage: _this6.currPage,
11983
+ pageSize: _this6.pageSize,
11984
+ total: lodashGet(data, _this6.aliasMap.totalCount)
11962
11985
  })
11963
11986
  }, {
11964
11987
  "class": 'iov-pro-table__pagination'
11965
11988
  }, {
11966
- "on": _this5.bindEvent(PAGINATION_EVENTS)
11989
+ "on": _this6.bindEvent(PAGINATION_EVENTS)
11967
11990
  }])) : null]);
11968
11991
  }
11969
11992
  }
11970
11993
  }, {
11971
11994
  "on": {
11972
11995
  loaded: function loaded(respData) {
11973
- return _this5.$emit('loaded', respData);
11996
+ return _this6.$emit('loaded', respData);
11974
11997
  }
11975
11998
  }
11976
11999
  }]));
@@ -19923,7 +19946,7 @@ var install = function install(Vue, componentConfig) {
19923
19946
  };
19924
19947
  var index = {
19925
19948
  install: install,
19926
- version: '0.0.21',
19949
+ version: '0.0.23',
19927
19950
  ColumnTooltip: __vue_component__$t,
19928
19951
  Description: __vue_component__$q,
19929
19952
  DialogSelect: __vue_component__$p,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "iov-pro-components",
3
- "version": "0.0.21",
3
+ "version": "0.0.23",
4
4
  "description": "IOV Pro Components for Vue.js",
5
5
  "main": "lib/iov-pro-components.min.js",
6
6
  "files": [