bri-components 1.2.62 → 1.2.63

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.2.62",
3
+ "version": "1.2.63",
4
4
  "author": "dengshanghui",
5
5
  "description": "a component lib for vue project",
6
6
  "main": "src/index.js",
@@ -29,18 +29,31 @@
29
29
  class="DshCascader-show"
30
30
  >
31
31
  <!-- 有值 -->
32
- <bri-tooltip
33
- v-if="!$isEmptyData(curValList)"
34
- :content="showVal"
35
- :transfer="true"
36
- >
37
- <div :class="{
38
- commonClass,
39
- 'DshCascader-show-ellipsis': true
40
- }">
32
+ <template v-if="!$isEmptyData(curValList)">
33
+ <!-- 详情页查看 且单独占一行高度自由时 -->
34
+ <div
35
+ v-if="isDetailShow && isHeightAuto"
36
+ :class="{
37
+ ...commonClass,
38
+ 'DshCascader-show-auto': true
39
+ }"
40
+ >
41
41
  {{ showVal }}
42
42
  </div>
43
- </bri-tooltip>
43
+
44
+ <bri-tooltip
45
+ v-else
46
+ :content="showVal"
47
+ :transfer="true"
48
+ >
49
+ <div :class="{
50
+ ...commonClass,
51
+ 'DshCascader-show-ellipsis': true
52
+ }">
53
+ {{ showVal }}
54
+ </div>
55
+ </bri-tooltip>
56
+ </template>
44
57
 
45
58
  <!-- 无值 -->
46
59
  <div
@@ -82,7 +95,7 @@
82
95
  >
83
96
  <!-- 有值 -->
84
97
  <template v-if="!$isEmptyData(curValList)">
85
- <!-- 详情查看页 且单独充满行的 -->
98
+ <!-- 详情页查看 且单独占一行高度自由时 -->
86
99
  <dsh-tags
87
100
  v-if="isDetailShow && isHeightAuto"
88
101
  :class="{
@@ -176,15 +189,18 @@
176
189
  @import url("../../control.less");
177
190
 
178
191
  .DshCascader {
192
+ #control-show();
193
+
179
194
  &-show {
195
+ &-auto,
180
196
  &-ellipsis {
181
- .dsh-ellipsis();
197
+ margin: 6px;
182
198
  }
183
199
  }
184
200
  }
185
201
 
186
202
  // 多选
187
203
  .DshCascaders {
188
- #control-select(cascader);
204
+ #control-show();
189
205
  }
190
206
  </style>
@@ -51,7 +51,7 @@
51
51
  :label="item.name || item._name"
52
52
  :disabled="getCheckItemDisabled(item, index)"
53
53
  >
54
- <Checkbox :value="curValList.includes(item._key)"></Checkbox>
54
+ <Checkbox :value="getItemCheckStatus(item)"></Checkbox>
55
55
 
56
56
  <slot :item="item"></slot>
57
57
 
@@ -75,7 +75,7 @@
75
75
  >
76
76
  <!-- 有值 -->
77
77
  <template v-if="!$isEmptyData(curValList)">
78
- <!-- 详情查看页 且单独充满行的 -->
78
+ <!-- 详情页查看 且单独占一行高度自由时 -->
79
79
  <dsh-tags
80
80
  v-if="isDetailShow && isHeightAuto"
81
81
  :class="{
@@ -93,11 +93,11 @@
93
93
  >
94
94
  <dsh-tags
95
95
  :class="{
96
- ...commonClass,
97
- 'DshCheckbox-show-ellipsis': true
98
- }"
96
+ ...commonClass,
97
+ 'DshCheckbox-show-ellipsis': true
98
+ }"
99
99
  :list="curValObjList"
100
- itemClass="DshCheckbox-show-tag"
100
+ itemClass="DshCheckbox-show-ellipsis-tag"
101
101
  ></dsh-tags>
102
102
  </bri-tooltip>
103
103
  </template>
@@ -153,6 +153,7 @@
153
153
  @import url("../../control.less");
154
154
 
155
155
  .DshCheckbox {
156
+ #control-show();
156
157
  #control-select(checkbox);
157
158
  }
158
159
  </style>
@@ -85,6 +85,7 @@
85
85
  >
86
86
  <!-- 有值 -->
87
87
  <template v-if="!$isEmptyData(curVal)">
88
+ <!-- 详情页查看 且单独占一行高度自由时 -->
88
89
  <dsh-tags
89
90
  v-if="isDetailShow && isHeightAuto"
90
91
  :class="{
@@ -167,6 +168,7 @@
167
168
  @import url("../../control.less");
168
169
 
169
170
  .DshSelect {
171
+ #control-show();
170
172
  #control-select(radio);
171
173
  }
172
174
  </style>
@@ -13,7 +13,6 @@
13
13
  :false-color="selfPropsObj._closeColor"
14
14
  :true-value="selfPropsObj._openValue"
15
15
  :false-value="selfPropsObj._closeValue"
16
- @on-change="change"
17
16
  >
18
17
  <span slot="open">
19
18
  {{ selfPropsObj._openText }}
@@ -31,6 +30,7 @@
31
30
  >
32
31
  <!-- 有值 -->
33
32
  <template v-if="!$isEmptyData(curVal)">
33
+ <!-- 详情页查看 且单独占一行高度自由时 -->
34
34
  <dsh-tags
35
35
  v-if="isDetailShow && isHeightAuto"
36
36
  :class="{
@@ -107,6 +107,6 @@
107
107
  @import url("../../control.less");
108
108
 
109
109
  .DshSwitch {
110
- #control-select(switch);
110
+ #control-show();
111
111
  }
112
112
  </style>
@@ -1,3 +1,24 @@
1
+ // 控件查看状态的样式
2
+ #control-show () {
3
+ &-show {
4
+ &-auto {
5
+ &-tag {
6
+ height: auto!important;
7
+ }
8
+ }
9
+
10
+ &-ellipsis {
11
+ margin: 2px 0px;
12
+ .dsh-ellipsis();
13
+
14
+ &-tag {
15
+ .dsh-ellipsis();
16
+ }
17
+ }
18
+ }
19
+ }
20
+
21
+ // 单选多选控件样式
1
22
  #control-select (@control-type) {
2
23
  &-flat {
3
24
  width: 100%;
@@ -184,22 +205,5 @@
184
205
  }
185
206
  }
186
207
  }
208
+ }
187
209
 
188
- // 查看
189
- &-show {
190
- &-auto {
191
- &-tag {
192
- height: auto!important;
193
- }
194
- }
195
-
196
- &-ellipsis {
197
- margin: 2px 0px;
198
- .dsh-ellipsis();
199
-
200
- &-tag {
201
- .dsh-ellipsis();
202
- }
203
- }
204
- }
205
- }
@@ -1,5 +1,5 @@
1
1
  import controlMixin from "./controlMixin.js";
2
- import { regionData, userIndustryData } from "bri-datas";
2
+ import { resourceData, regionData, userIndustryData } from "bri-datas";
3
3
 
4
4
  export default {
5
5
  mixins: [
@@ -15,6 +15,8 @@ export default {
15
15
  const _joinSymbol = this.propsObj._joinSymbol || "/";
16
16
  return {
17
17
  _showMode: "default",
18
+ colorMap: resourceData.colorMap,
19
+ _useColor: false,
18
20
  _saveKey: "_key",
19
21
  _valueKey: "code",
20
22
  _nameKey: "name",
@@ -34,6 +36,12 @@ export default {
34
36
  showType () {
35
37
  return this.selfPropsObj._showMode;
36
38
  },
39
+ colorMap () {
40
+ return this.selfPropsObj.colorMap;
41
+ },
42
+ useColor () {
43
+ return this.selfPropsObj._useColor;
44
+ },
37
45
  saveKey () {
38
46
  return this.selfPropsObj._saveKey;
39
47
  },
@@ -99,12 +107,17 @@ export default {
99
107
  return loop(this.originData, this.cascaderLevel, undefined, this.cascaderFilterVals, this.isMobile);
100
108
  },
101
109
 
110
+ curValObj () {
111
+ return this.getItemObj(this.curValList);
112
+ },
102
113
  curValName: {
103
114
  get () {
104
- return this.transformFullName(this.curValList);
115
+ return this.curValObj
116
+ ? this.curValObj[this.nameKey]
117
+ : "";
105
118
  },
106
- set (str) {
107
- if (!str) {
119
+ set (val) {
120
+ if (!val) {
108
121
  this.clickClear();
109
122
  }
110
123
  }
@@ -114,19 +127,12 @@ export default {
114
127
  ? this.emptyShowVal
115
128
  : this.curValName;
116
129
  },
130
+ // 已选择项的对象列表
117
131
  curValObjList () {
118
- return this.curValNameList.map((item, index) => {
119
- return {
120
- _key: index,
121
- name: item,
122
- style: {
123
- ...this.tagStyle
124
- }
125
- };
126
- });
132
+ return this.curValList.map(arrItem => this.getItemObj(arrItem));
127
133
  },
128
134
  curValNameList () {
129
- return this.curValList.map(item => this.transformFullName(item));
135
+ return this.curValObjList.map(item => item[this.nameKey]);
130
136
  },
131
137
  showMulVal () {
132
138
  return this.$isEmptyData(this.curValList)
@@ -164,9 +170,43 @@ export default {
164
170
  },
165
171
 
166
172
  /* --------- 工具类 -------- */
173
+ getItemObj (val) {
174
+ const objArr = this.$getTreeLinealDatas(val, this.cascaderData, undefined, this.saveKey);
175
+
176
+ return !this.$isEmptyData(val)
177
+ ? objArr.length
178
+ ? {
179
+ ...objArr.slice(-1)[0],
180
+ [this.nameKey]: this.transformFullName(val),
181
+ // 查看状态时tag用
182
+ style: {
183
+ ...this.tagStyle,
184
+ ...this.getItemColorStyle(objArr.slice(-1)[0])
185
+ },
186
+ color: undefined
187
+ }
188
+ : {
189
+ _key: val,
190
+ name: `提示:选项${val}已找不到`,
191
+ style: {
192
+ ...this.tagStyle
193
+ }
194
+ }
195
+ : undefined;
196
+ },
197
+ // 每项的颜色相关style --flat方式在用
198
+ getItemColorStyle (item) {
199
+ const color = this.colorMap[item.color] || this.colorMap["color-1"];
200
+ return this.useColor
201
+ ? {
202
+ backgroundColor: this.$getColor(color, 0.1),
203
+ color: color
204
+ }
205
+ : {};
206
+ },
167
207
  // 转化出级联全名
168
- transformFullName (value) {
169
- return this.renderFormat(this.$getTreeLinealDatas(value, this.cascaderData, this.nameKey, this.saveKey));
208
+ transformFullName (val) {
209
+ return this.renderFormat(this.$getTreeLinealDatas(val, this.cascaderData, this.nameKey, this.saveKey));
170
210
  }
171
211
  }
172
212
  };
@@ -188,6 +188,8 @@ export default {
188
188
  });
189
189
  }
190
190
  },
191
+
192
+ // 接口 -获得某个节点对应的描述内容
191
193
  getDescription (value = []) {
192
194
  if (value.length) {
193
195
  this.$https({
@@ -201,7 +203,7 @@ export default {
201
203
  },
202
204
  callback: data => {
203
205
  this.description = data;
204
- this.selectedObj.description = data;
206
+ // this.selectedObj.description = data;
205
207
  }
206
208
  });
207
209
  }
@@ -130,8 +130,8 @@ export default {
130
130
  return {
131
131
  "bri-control-edit": this.canEdit && this.finalCanEdit,
132
132
  "bri-control-disabled": this.canEdit && !this.finalCanEdit,
133
- "bri-control-unit": !this.canEdit && this.isInTable,
134
- "bri-control-show": !this.canEdit && !this.isInTable,
133
+ "bri-control-unit": this.isUnitShow,
134
+ "bri-control-show": this.isDetailShow,
135
135
 
136
136
  "dsh-ellipsis": this.isUnitShow,
137
137
  "bri-control-nodata": this.$isEmptyData(this.curVal)
@@ -15,8 +15,8 @@ export default {
15
15
  computed: {
16
16
  basePropsObj () {
17
17
  return {
18
- colorMap: resourceData.colorMap,
19
18
  _optionKind: "dropdown", // "flat"、"dropdown"
19
+ colorMap: resourceData.colorMap,
20
20
  _useColor: false,
21
21
  _filterable: true,
22
22
  _data: [],
@@ -29,12 +29,12 @@ export default {
29
29
  showType () {
30
30
  return this.selfPropsObj._optionKind;
31
31
  },
32
- useColor () {
33
- return this.selfPropsObj._useColor;
34
- },
35
32
  colorMap () {
36
33
  return this.selfPropsObj.colorMap;
37
34
  },
35
+ useColor () {
36
+ return this.selfPropsObj._useColor;
37
+ },
38
38
  listData () {
39
39
  const listData = this.selfPropsObj._data.concat(this.initListData);
40
40
 
@@ -54,7 +54,7 @@ export default {
54
54
  },
55
55
  set (val) {
56
56
  if (!val) {
57
- this.curVal = "";
57
+ this.clickClear();
58
58
  }
59
59
  }
60
60
  },
@@ -84,6 +84,10 @@ export default {
84
84
  this.getListData();
85
85
  },
86
86
 
87
+ // 点击清除
88
+ clickClear () {
89
+ this.curVal = "";
90
+ },
87
91
  // 单选模式 点击选项
88
92
  clickRadioItem (item, index) {
89
93
  if (!this.getRadioItemDisabled(item)) {
@@ -105,16 +109,37 @@ export default {
105
109
  // 多选模式 点击选项
106
110
  clickCheckItem (item, index) {
107
111
  if (!this.getCheckItemDisabled(item)) {
108
- if (this.curValList.includes(item._key)) {
109
- this.curValList = this.curValList.filter(key => key !== item._key);
110
- } else {
111
- this.curValList = [...this.curValList, item._key];
112
- }
112
+ this.curValList = this.getItemCheckStatus(item)
113
+ ? this.curValList.filter(key => key !== item._key)
114
+ : [...this.curValList, item._key];
113
115
  }
114
116
  },
115
117
 
116
118
  /* ------- 方法 ------- */
117
- // 每项的class集合 --flat方式在用
119
+ // 获取某项的对象数据
120
+ getItemObj (val) {
121
+ const obj = this.listData.find(item => item._key === val) || {
122
+ _key: val,
123
+ name: `提示:选项${val}已找不到`
124
+ };
125
+
126
+ return !this.$isEmptyData(val)
127
+ ? {
128
+ ...obj,
129
+ // 查看状态时tag用
130
+ style: {
131
+ ...this.tagStyle,
132
+ ...this.getItemColorStyle(obj)
133
+ },
134
+ color: undefined
135
+ }
136
+ : undefined;
137
+ },
138
+ // 获取某项的选中状态
139
+ getItemCheckStatus (item) {
140
+ return this.curValList.includes(item._key);
141
+ },
142
+ // 获取某项的class集合 --flat方式在用
118
143
  getItemClass (item) {
119
144
  return [
120
145
  this.useColor
@@ -123,7 +148,7 @@ export default {
123
148
  item.class
124
149
  ];
125
150
  },
126
- // 每项的颜色相关style --flat方式在用
151
+ // 获取某项的颜色相关style --flat方式在用
127
152
  getItemColorStyle (item) {
128
153
  const color = this.colorMap[item.color] || this.colorMap["color-1"];
129
154
  return this.useColor
@@ -133,13 +158,6 @@ export default {
133
158
  }
134
159
  : {};
135
160
  },
136
- // 每项的具体样式 -查看状态时用
137
- getItemShowStyle (item) {
138
- return {
139
- ...this.tagStyle,
140
- ...this.getItemColorStyle(item)
141
- };
142
- },
143
161
  // 获取单选项的置灰状态
144
162
  getRadioItemDisabled (item) {
145
163
  return !!(
@@ -152,23 +170,9 @@ export default {
152
170
  return !!(
153
171
  this.selfPropsObj._disabled ||
154
172
  item._disabled ||
155
- (this.curValList.length >= this.selfPropsObj._max && !this.curValList.includes(item._key))
173
+ (this.curValList.length >= this.selfPropsObj._max && !this.getItemCheckStatus(item))
156
174
  );
157
175
  },
158
- getItemObj (key) {
159
- const obj = this.listData.find(item => item._key === key) || {
160
- _key: key,
161
- name: `温馨提示:选项${key}已找不到`
162
- };
163
-
164
- return this.$isEmptyData(key)
165
- ? undefined
166
- : {
167
- ...obj,
168
- style: this.getItemShowStyle(obj),
169
- color: undefined
170
- };
171
- },
172
176
 
173
177
  // TODO:待删除 接口 -获取自定义的接口数据
174
178
  getListData () {
@@ -179,12 +183,10 @@ export default {
179
183
  callback: data => {
180
184
  this.initListData = [
181
185
  ...this.initListData,
182
- ...data.list.map(dataItem =>
183
- ({
184
- _key: dataItem._key,
185
- name: dataItem.name
186
- })
187
- )
186
+ ...data.list.map(dataItem => ({
187
+ _key: dataItem._key,
188
+ name: dataItem.name
189
+ }))
188
190
  ];
189
191
  }
190
192
  });
@@ -47,22 +47,19 @@ export default {
47
47
  ...this.propsObj
48
48
  };
49
49
  },
50
- showStyle () {
50
+
51
+ curValObj () {
51
52
  return !this.$isEmptyData(this.curVal)
52
53
  ? {
53
- ...this.tagStyle,
54
- backgroundColor: this.curVal === true ? "#d3f3dc" : "#FDEDED",
55
- color: this.curVal === true ? "#37C45E" : "#E83636"
54
+ _key: "1",
55
+ name: this.showVal,
56
+ style: {
57
+ ...this.tagStyle,
58
+ backgroundColor: this.curVal === true ? "#d3f3dc" : "#FDEDED",
59
+ color: this.curVal === true ? "#37C45E" : "#E83636"
60
+ }
56
61
  }
57
- : {};
58
- },
59
-
60
- curValObj () {
61
- return {
62
- _key: "1",
63
- name: this.showVal,
64
- style: this.showStyle
65
- };
62
+ : undefined;
66
63
  },
67
64
  showVal () {
68
65
  return this.$isEmptyData(this.curVal)
@@ -34,4 +34,8 @@
34
34
  &[disabled] {
35
35
  background-color: @border-disabled;
36
36
  }
37
+ }
38
+
39
+ .ivu-select-dropdown {
40
+ max-width: 800px;
37
41
  }