bri-components 1.3.12 → 1.3.13

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bri-components",
3
- "version": "1.3.12",
3
+ "version": "1.3.13",
4
4
  "author": "dengshanghui",
5
5
  "description": "a component lib for vue project",
6
6
  "main": "src/index.js",
@@ -9,6 +9,7 @@
9
9
  style="display:flex"
10
10
  >
11
11
  <input
12
+ style="flex: 1; min-width: 0px;"
12
13
  :id="elementId"
13
14
  :class="inputClasses"
14
15
  :disabled="itemDisabled"
@@ -156,6 +156,7 @@
156
156
  &-edit {
157
157
  &-suffix {
158
158
  min-width: 32px;
159
+ padding: 0px 6px;
159
160
  border-left: 1px solid @borderColor;
160
161
  background-color: #F0F0F0;
161
162
  text-align: center;
@@ -22,14 +22,14 @@
22
22
  >
23
23
  <Checkbox
24
24
  v-for="(item, index) in listData"
25
- :key="item._key"
25
+ :key="item[saveKey]"
26
26
  :class="getItemClass(item)"
27
27
  :style="getItemColorStyle(item)"
28
- :label="item._key"
28
+ :label="item[saveKey]"
29
29
  :disabled="getCheckItemDisabled(item, index)"
30
30
  :border="useColor"
31
31
  >
32
- <span>{{ item.name || item._name }}</span>
32
+ <span>{{ item[nameKey] || item.name || item._name }}</span>
33
33
  </Checkbox>
34
34
  </CheckboxGroup>
35
35
  </template>
@@ -61,16 +61,16 @@
61
61
  >
62
62
  <Option
63
63
  v-for="(item, index) in listData"
64
- :key="item._key"
65
- :value="item._key"
66
- :label="item.name || item._name"
64
+ :key="item[saveKey]"
65
+ :value="item[saveKey]"
66
+ :label="item[nameKey] || item.name || item._name"
67
67
  :disabled="getCheckItemDisabled(item, index)"
68
68
  >
69
69
  <Checkbox :value="getItemCheckStatus(item)"></Checkbox>
70
70
 
71
71
  <slot :item="item"></slot>
72
72
 
73
- <span>{{ item.name || item._name }}</span>
73
+ <span>{{ item[nameKey] || item.name || item._name }}</span>
74
74
  </Option>
75
75
  </Select>
76
76
  </template>
@@ -150,7 +150,7 @@
150
150
  changeCheckValue (item) {
151
151
  this.clickCheckItem({
152
152
  ...item,
153
- _key: item.value
153
+ [this.saveKey]: item.value
154
154
  });
155
155
  }
156
156
  }
@@ -23,16 +23,16 @@
23
23
  >
24
24
  <Radio
25
25
  v-for="(item, index) in listData"
26
- :key="item._key"
26
+ :key="item[saveKey]"
27
27
  :class="getItemClass(item)"
28
28
  :style="getItemColorStyle(item)"
29
- :value="curVal === item._key"
30
- :label="item._key"
29
+ :value="curVal === item[saveKey]"
30
+ :label="item[saveKey]"
31
31
  :disabled="getRadioItemDisabled(item, index)"
32
32
  :border="useColor"
33
33
  @click.native.stop="cancelRadioItemSelect(item, index)"
34
34
  >
35
- <span @click.stop="0">{{ item.name || item._name }}</span>
35
+ <span @click.stop="0">{{ item[nameKey] || item.name || item._name }}</span>
36
36
  </Radio>
37
37
  </RadioGroup>
38
38
  </template>
@@ -61,9 +61,9 @@
61
61
  <!-- </Option>必须和输出内容在一行,否则出现空格导致_filterable出bug -->
62
62
  <Option
63
63
  v-for="(item, index) in listData"
64
- :key="item._key"
65
- :value="item._key"
66
- :label="item.name || item._name"
64
+ :key="item[saveKey]"
65
+ :value="item[saveKey]"
66
+ :label="item[nameKey] || item.name || item._name"
67
67
  :disabled="getRadioItemDisabled(item, index)"
68
68
  >
69
69
  <Icon
@@ -76,7 +76,7 @@
76
76
 
77
77
  <slot :item="item"></slot>
78
78
 
79
- <span>{{ item.name || item._name }}</span>
79
+ <span>{{ item[nameKey] || item.name || item._name }}</span>
80
80
  </Option>
81
81
  </Select>
82
82
  </template>
@@ -15,6 +15,8 @@ export default {
15
15
  computed: {
16
16
  basePropsObj () {
17
17
  return {
18
+ _saveKey: "_key",
19
+ _nameKey: "name",
18
20
  _optionKind: "dropdown", // "flat"、"dropdown"
19
21
  colorMap: resourceData.colorMap,
20
22
  _useColor: false,
@@ -28,6 +30,12 @@ export default {
28
30
  ...this.commonDealPropsObj
29
31
  };
30
32
  },
33
+ saveKey () {
34
+ return this.selfPropsObj._saveKey;
35
+ },
36
+ nameKey () {
37
+ return this.selfPropsObj._nameKey;
38
+ },
31
39
  showType () {
32
40
  return this.selfPropsObj._optionKind;
33
41
  },
@@ -49,8 +57,8 @@ export default {
49
57
  if (this.selectFilterVals.length) {
50
58
  listData = listData.filter(item =>
51
59
  this.reverseFilter
52
- ? !this.selectFilterVals.includes(item._key)
53
- : this.selectFilterVals.includes(item._key)
60
+ ? !this.selectFilterVals.includes(item[this.saveKey])
61
+ : this.selectFilterVals.includes(item[this.saveKey])
54
62
  );
55
63
  }
56
64
 
@@ -64,7 +72,7 @@ export default {
64
72
  curValName: {
65
73
  get () {
66
74
  return this.curValObj
67
- ? this.curValObj.name || this.curValObj._name
75
+ ? this.curValObj[this.nameKey] || this.curValObj.name || this.curValObj._name
68
76
  : "";
69
77
  },
70
78
  set (val) {
@@ -83,7 +91,7 @@ export default {
83
91
  return this.curValList.map(key => this.getItemObj(key));
84
92
  },
85
93
  curValNameList () {
86
- return this.curValObjList.map(item => item.name || item._name);
94
+ return this.curValObjList.map(item => item[this.nameKey] || item.name || item._name);
87
95
  },
88
96
  showMulVal () {
89
97
  return this.$isEmptyData(this.curValList)
@@ -106,18 +114,18 @@ export default {
106
114
  // 单选模式 点击选项
107
115
  clickRadioItem (item, index) {
108
116
  if (!this.getRadioItemDisabled(item)) {
109
- if (this.curVal === item._key) {
117
+ if (this.curVal === item[this.saveKey]) {
110
118
  if (this.clearable) {
111
119
  this.curVal = "";
112
120
  }
113
121
  } else {
114
- this.curVal = item._key;
122
+ this.curVal = item[this.saveKey];
115
123
  }
116
124
  }
117
125
  },
118
126
  // 单选模式 取消选择项
119
127
  cancelRadioItemSelect (item, index) {
120
- if (this.curVal === item._key) {
128
+ if (this.curVal === item[this.saveKey]) {
121
129
  this.clickRadioItem(item, index);
122
130
  }
123
131
  },
@@ -125,21 +133,22 @@ export default {
125
133
  clickCheckItem (item, index) {
126
134
  if (!this.getCheckItemDisabled(item)) {
127
135
  this.curValList = this.getItemCheckStatus(item)
128
- ? this.curValList.filter(key => key !== item._key)
129
- : [...this.curValList, item._key];
136
+ ? this.curValList.filter(key => key !== item[this.saveKey])
137
+ : [...this.curValList, item[this.saveKey]];
130
138
  }
131
139
  },
132
140
 
133
141
  /* ------- 方法 ------- */
134
142
  // 获取某项的对象数据
135
143
  getItemObj (val) {
136
- const obj = this.listData.find(item => item._key === val) || {
137
- _key: val,
138
- name: `提示:选项${val}已不存在`
144
+ const obj = this.listData.find(item => item[this.saveKey] === val) || {
145
+ [this.saveKey]: val,
146
+ [this.nameKey]: `提示:选项${val}已不存在`
139
147
  };
140
148
 
141
149
  return !this.$isEmptyData(val)
142
150
  ? {
151
+ name: obj[this.nameKey],
143
152
  ...obj,
144
153
  // 查看状态时tag用
145
154
  style: {
@@ -152,7 +161,7 @@ export default {
152
161
  },
153
162
  // 获取某项的选中状态
154
163
  getItemCheckStatus (item) {
155
- return this.curValList.includes(item._key);
164
+ return this.curValList.includes(item[this.saveKey]);
156
165
  },
157
166
  // 获取某项的class集合 --flat方式在用
158
167
  getItemClass (item) {
@@ -199,8 +208,8 @@ export default {
199
208
  this.initListData = [
200
209
  ...this.initListData,
201
210
  ...data.list.map(dataItem => ({
202
- _key: dataItem._key,
203
- name: dataItem.name
211
+ [this.saveKey]: dataItem[this.saveKey],
212
+ [this.nameKey]: dataItem[this.nameKey]
204
213
  }))
205
214
  ];
206
215
  }
@@ -235,7 +235,8 @@
235
235
  formData: row,
236
236
  formItem: this.resetCol(item),
237
237
  rowIndex: rowIndex,
238
- parentData: this.listData
238
+ parentData: this.listData,
239
+ allFormList: this.columns
239
240
  },
240
241
  on: {
241
242
  blur: () => this.controlBlur(null, column, row, arguments),
@@ -250,7 +251,8 @@
250
251
  formData: row,
251
252
  formItem: this.resetCol(item),
252
253
  rowIndex: rowIndex,
253
- parentData: this.listData
254
+ parentData: this.listData,
255
+ allFormList: this.columns
254
256
  },
255
257
  on: {
256
258
  blur: () => this.controlBlur(null, column, row, arguments),
@@ -153,6 +153,7 @@
153
153
  ...col,
154
154
  _heightAuto: heightAuto
155
155
  }"
156
+ :allFormList="subColumns"
156
157
  @blur="controlBlur(null, col, row[col.nodeKey], arguments)"
157
158
  @change="$dispatchEvent(operationMap.changeVal, col, row[col.nodeKey], arguments)"
158
159
  ></dsh-list-unit>
@@ -98,12 +98,6 @@
98
98
  unitMixin
99
99
  ],
100
100
  props: {
101
- allFormList: {
102
- type: Array,
103
- default () {
104
- return [];
105
- }
106
- },
107
101
  changedFields: {
108
102
  type: Array,
109
103
  default () {
@@ -23,6 +23,7 @@
23
23
  size: 'default',
24
24
  inTable: true
25
25
  }"
26
+ :allFormList="allFormList"
26
27
  :rowIndex="rowIndex"
27
28
  :parentData="parentData"
28
29
  @blur="blur"
@@ -18,6 +18,12 @@ export default {
18
18
  default () {
19
19
  return {};
20
20
  }
21
+ },
22
+ allFormList: {
23
+ type: Array,
24
+ default () {
25
+ return [];
26
+ }
21
27
  }
22
28
  },
23
29
  data () {
@@ -64,7 +64,7 @@ const transformToColumns = function (form, {
64
64
  showRequired = false,
65
65
  showDescription = false,
66
66
  headHeightAuto = false
67
- } = {}) {
67
+ }, allFormList = []) {
68
68
  return form
69
69
  .map(col => {
70
70
  const typeData = this.$modFieldMap[col._type] || {};
@@ -150,7 +150,8 @@ const transformToColumns = function (form, {
150
150
  canEdit: false,
151
151
  rowIndex: rowIndex,
152
152
  formData: row,
153
- formItem: col
153
+ formItem: col,
154
+ allFormList: allFormList
154
155
  }
155
156
  });
156
157
  }