web-component-gallery 2.1.5 → 2.1.7

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.
@@ -57,16 +57,23 @@ export default {
57
57
  }
58
58
  return attr
59
59
  },
60
- filterSetting() {
60
+ dynamicFormRules() {
61
+ const formRules = {}
62
+ this.visibleFormItems
63
+ .forEach(node => {
64
+ if (!node.rules || node.rules.length === 0) return
65
+ formRules[node.model] = setFormItemRule.call(this, node)
66
+ })
67
+ return formRules
68
+ },
69
+ visibleFormItems() {
61
70
  return this.formSetting.filter(settingItem => !settingItem.hidden)
62
71
  }
63
72
  },
64
73
  watch: {
65
- formSetting: {
66
- handler(newVal, oldVal) {
67
- newVal.forEach(node =>
68
- this.$set(this.formRules, node.model, setFormItemRule.call(this, node))
69
- )
74
+ dynamicFormRules: {
75
+ handler(newRules) {
76
+ this.formRules = newRules
70
77
  },
71
78
  immediate: true
72
79
  }
@@ -161,7 +168,7 @@ export default {
161
168
  >
162
169
  {
163
170
  this.$slots.default ??
164
- this.filterSetting.map(props => setModelRender(h, props))
171
+ this.visibleFormItems.map(props => setModelRender(h, props))
165
172
  }
166
173
  </FormModel>
167
174
  )
@@ -10,7 +10,7 @@
10
10
  </Empty>
11
11
  </template>
12
12
 
13
- <script>
13
+ <script>
14
14
 
15
15
  import IconFont from '../icon-font'
16
16
  import { Empty } from 'ant-design-vue'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "web-component-gallery",
3
- "version": "2.1.5",
3
+ "version": "2.1.7",
4
4
  "description": "基础vue、antdvue、less实现的私有组件库",
5
5
  "main": "dist/index.umd.js",
6
6
  "files": [