bri-components 1.2.58 → 1.2.60

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.58",
3
+ "version": "1.2.60",
4
4
  "author": "dengshanghui",
5
5
  "description": "a component lib for vue project",
6
6
  "main": "src/index.js",
@@ -138,7 +138,7 @@
138
138
  selfPropsObj () {
139
139
  return {
140
140
  _fileType: "file",
141
- _showType: this.isFullRow && !this.isInTable ? "old" : "inline", // 宽度为100%、且不在级联表格或内部表格里的 显示老版
141
+ _showType: this.isHeightAuto ? "old" : "inline", // 宽度为100%、且不在级联表格或内部表格里的 显示老版
142
142
  // _multiple: true,
143
143
  _useType: "drag",
144
144
  _maxSize: 1024 * 1024,
@@ -26,17 +26,18 @@
26
26
  <!-- 单选模式 查看 -->
27
27
  <div
28
28
  v-else-if="!multipleMode && !canEdit"
29
- class="DshCascader"
29
+ class="DshCascader-show"
30
30
  >
31
31
  <!-- 有值 -->
32
32
  <bri-tooltip
33
33
  v-if="!$isEmptyData(curValList)"
34
34
  :content="showVal"
35
- placement="top"
36
- maxWidth="200"
37
35
  :transfer="true"
38
36
  >
39
- <div :class="commonClass">
37
+ <div :class="{
38
+ commonClass,
39
+ 'DshCascader-show-ellipsis': true
40
+ }">
40
41
  {{ showVal }}
41
42
  </div>
42
43
  </bri-tooltip>
@@ -83,19 +84,15 @@
83
84
  <bri-tooltip
84
85
  v-if="!$isEmptyData(curValList)"
85
86
  :content="showMulVal"
86
- placement="top"
87
- maxWidth="200"
88
87
  :transfer="true"
89
88
  >
90
- <div :class="{
91
- ...commonClass,
92
- 'DshCascader-show-row': isFullRow && !isUnitShow
93
- }">
94
- <dsh-tags
95
- class="text"
96
- :list="curValNameList"
97
- ></dsh-tags>
98
- </div>
89
+ <dsh-tags
90
+ :class="{
91
+ ...commonClass,
92
+ 'DshCascaders-show-ellipsis': !(isDetailShow && isHeightAuto)
93
+ }"
94
+ :list="curValNameList"
95
+ ></dsh-tags>
99
96
  </bri-tooltip>
100
97
 
101
98
  <!-- 无值 -->
@@ -139,7 +136,7 @@
139
136
  computed: {
140
137
  selfPropsObj () {
141
138
  return {
142
- _showMode: "default", // 只有单选模式有效,值为"default", "custom", "simple"
139
+ _showMode: "default", // 值为"default", "custom", "simple"
143
140
  _transfer: true,
144
141
  _transferClassName: "",
145
142
 
@@ -165,23 +162,18 @@
165
162
 
166
163
  <style lang="less">
167
164
  .DshCascader {
168
-
165
+ &-show {
166
+ &-ellipsis {
167
+ .dsh-ellipsis();
168
+ }
169
+ }
169
170
  }
170
171
 
171
172
  // 多选
172
173
  .DshCascaders {
173
174
  &-show {
174
- height: auto;
175
-
176
- &-row {
177
- .text,
178
- .overflow {
179
- .bri-scrollbar3();
180
- width: 100%;
181
- height: 100%;
182
- white-space: normal;
183
- overflow: auto;
184
- }
175
+ &-ellipsis {
176
+ .dsh-ellipsis();
185
177
  }
186
178
  }
187
179
  }
@@ -1,111 +1,100 @@
1
1
  <template>
2
- <div class="DshCheckbox">
3
- <!-- 编辑 -->
4
- <template v-if="canEdit">
5
- <!-- 有选项 -->
6
- <template v-if="listData.length">
7
- <!-- flat方式 -->
8
- <template v-if="showType === 'flat'">
9
- <CheckboxGroup
10
- :class="{
2
+ <!-- 编辑 -->
3
+ <div
4
+ v-if="canEdit"
5
+ class="DshCheckbox"
6
+ >
7
+ <!-- 有选项 -->
8
+ <template v-if="listData.length">
9
+ <!-- flat方式 -->
10
+ <template v-if="showType === 'flat'">
11
+ <CheckboxGroup
12
+ :class="{
11
13
  'DshCheckbox-flat': true,
12
14
  'DshCheckbox-flat-color': useColor,
13
- 'DshCheckbox-flat-disabled': !canEdit,
14
- 'DshCheckbox-flat-scroll': selfPropsObj._span < 24 && !selfPropsObj._br,
15
+ 'DshCheckbox-flat-scroll': !isHeightAuto,
15
16
  }"
16
- v-model="curValList"
17
+ v-model="curValList"
18
+ >
19
+ <Checkbox
20
+ v-for="(item, index) in listData"
21
+ :key="item._key"
22
+ :class="getItemClass(item)"
23
+ :style="getItemColorStyle(item)"
24
+ :label="item._key"
25
+ :disabled="getCheckItemDisabled(item, index)"
26
+ :border="useColor"
17
27
  >
18
- <Checkbox
19
- v-for="(item, index) in listData"
20
- :key="index"
21
- :class="[
22
- 'DshCheckbox-item',
23
- getItemColorClass(item),
24
- selfPropsObj.class,
25
- item.class
26
- ]"
27
- :style="getItemStyle(item)"
28
- :label="item._key"
29
- :disabled="getItemDisabled(item)"
30
- :border="useColor"
31
- @click.native="clickOpenTip(item)"
32
- >
33
- <slot :item="item"></slot>
34
-
35
- <span>{{ item.name || item._name }}</span>
36
- </Checkbox>
37
-
38
- <!-- tip项弹框提示 -->
39
- <dsh-render :render="tipModalRender"></dsh-render>
40
- </CheckboxGroup>
41
- </template>
28
+ <span>{{ item.name || item._name }}</span>
29
+ </Checkbox>
30
+ </CheckboxGroup>
31
+ </template>
42
32
 
43
- <!-- dropdown模式 -->
44
- <template v-else>
45
- <Select
46
- v-model="value[controlKey]"
47
- :multiple="true"
48
- :placeholder="selfPropsObj._placeholder"
49
- :disabled="!finalCanEdit"
50
- :filterable="selfPropsObj._filterable"
51
- :transfer="selfPropsObj._transfer"
52
- :transfer-class-name="selfPropsObj._transferClassName"
53
- :max-tag-count="selfPropsObj._maxTagCount"
54
- @on-select="changeSelect"
33
+ <!-- dropdown模式 -->
34
+ <template v-else>
35
+ <Select
36
+ class="DshCheckbox-dropdown"
37
+ :value="curValList"
38
+ :multiple="true"
39
+ :placeholder="selfPropsObj._placeholder"
40
+ :disabled="selfPropsObj._disabled"
41
+ :filterable="selfPropsObj._filterable"
42
+ :transfer="selfPropsObj._transfer"
43
+ :transfer-class-name="selfPropsObj._transferClassName"
44
+ :max-tag-count="selfPropsObj._maxTagCount"
45
+ @on-select="changeCheckValue"
46
+ >
47
+ <Option
48
+ v-for="(item, index) in listData"
49
+ :key="item._key"
50
+ :value="item._key"
51
+ :label="item.name || item._name"
52
+ :disabled="getCheckItemDisabled(item, index)"
55
53
  >
56
- <Option
57
- v-for="(item, index) in listData"
58
- :key="index"
59
- :value="item._key"
60
- :label="item.name || item._name"
61
- :disabled="getItemDisabled(item)"
62
- >
63
- <Checkbox :value="getItemSelectStatus(item)"></Checkbox>
54
+ <Checkbox :value="curValList.includes(item._key)"></Checkbox>
64
55
 
65
- <slot :item="item"></slot>
56
+ <slot :item="item"></slot>
66
57
 
67
- <span>{{ item.name || item._name }}</span>
68
- <span style="float:right; padding-right:20px">
69
- {{ item.rightName }}
70
- </span>
71
- </Option>
72
- </Select>
73
- </template>
58
+ <span>{{ item.name || item._name }}</span>
59
+ </Option>
60
+ </Select>
74
61
  </template>
75
-
76
- <!-- 无选项 -->
77
- <div
78
- v-else
79
- class="dsh-subtip"
80
- >-- 无选择项 --</div>
81
62
  </template>
82
63
 
83
- <!-- 查看 -->
84
- <template v-else>
85
- <bri-tooltip
86
- :content="showMulVal"
87
- placement="top"
88
- maxWidth="200"
89
- :transfer="true"
90
- >
91
- <div :class="{
92
- ...commonClass,
93
- 'DshCheckbox-show': true
94
- }">
95
- <!-- 有值 -->
96
- <dsh-tags
97
- v-if="!$isEmptyData(curValList)"
98
- class="text"
99
- :list="curValObjList"
100
- ></dsh-tags>
64
+ <!-- 无选项 -->
65
+ <div
66
+ v-else
67
+ class="dsh-subtip"
68
+ >-- 无选择项 --</div>
69
+ </div>
101
70
 
102
- <!-- 无值 -->
103
- <template v-else>
104
- {{ emptyShowVal }}
105
- </template>
106
- </div>
107
- </bri-tooltip>
108
- </template>
71
+ <!-- 查看 -->
72
+ <div
73
+ v-else
74
+ class="DshCheckbox-show"
75
+ >
76
+ <!-- 有值 -->
77
+ <bri-tooltip
78
+ v-if="!$isEmptyData(curValList)"
79
+ :content="showMulVal"
80
+ :transfer="true"
81
+ >
82
+ <dsh-tags
83
+ :class="{
84
+ ...commonClass,
85
+ 'DshCheckbox-show-ellipsis': !(isDetailShow && isHeightAuto)
86
+ }"
87
+ :list="curValObjList"
88
+ ></dsh-tags>
89
+ </bri-tooltip>
90
+
91
+ <!-- 无值 -->
92
+ <div
93
+ v-else
94
+ :class="commonClass"
95
+ >
96
+ {{ emptyShowVal }}
97
+ </div>
109
98
  </div>
110
99
  </template>
111
100
 
@@ -125,156 +114,31 @@
125
114
  computed: {
126
115
  selfPropsObj () {
127
116
  return {
117
+ _max: 100000000,
128
118
  _transfer: true,
129
- ...this.selectPropsObj
119
+ _transferClassName: "",
120
+
121
+ ...this.basePropsObj
130
122
  };
131
123
  }
132
124
  },
133
125
  created () {},
134
126
  methods: {
135
- // 下拉框的change (下拉方式时用v-model触发change有问题,组件进来如果值不为空的,就会v-model返值一次)
136
- changeSelect (item) {
137
- if (this.curValList.includes(item.value)) {
138
- let itemIndex = this.curValList.findIndex(valItem => valItem === item.value);
139
- this.curValList.splice(itemIndex, 1);
140
- } else {
141
- this.curValList.push(item.value);
142
- }
143
-
144
- this.curValList = [...this.curValList];
145
- },
146
-
147
- getItemColorClass (item) {
148
- return this.colorMap[item.color] ? item.color : "color-1";
149
- },
150
- getItemStyle (item) {
151
- const color = this.colorMap[item.color] || this.colorMap["color-1"];
152
- return {
153
- background: this.useColor ? this.$getColor(color, 0.1) : undefined,
154
- color: this.useColor ? color : undefined
155
- };
156
- },
157
- // 获取某项的置灰状态
158
- getItemDisabled (item) {
159
- return !!(
160
- !this.finalCanEdit ||
161
- item._disabled ||
162
- this.curValList.length >= this.selfPropsObj._max && !this.getItemSelectStatus(item)
163
- );
164
- },
165
- // 获取某项的选中状态
166
- getItemSelectStatus (item) {
167
- return this.curValList.includes(item._key);
127
+ // 多选模式 值改变 (pc端下拉方式时,用v-model触发change有问题,组件进来如果值不为空的,就会v-model返值一次)
128
+ changeCheckValue (item) {
129
+ this.clickCheckItem({
130
+ ...item,
131
+ _key: item.value
132
+ });
168
133
  }
169
134
  }
170
135
  };
171
136
  </script>
172
137
 
173
138
  <style lang="less">
174
- .DshCheckbox {
175
- width: 100%;
176
-
177
- &-flat {
178
- width: 100%;
179
-
180
- // 选中时背景为白色
181
- .ivu-checkbox-checked .ivu-checkbox-inner {
182
- background-color: @themeColor;
183
- }
184
-
185
- &-item {}
186
-
187
- &-color {
188
- .ivu-checkbox-border {
189
- margin-right: 16px;
190
- height: 32px;
191
- border: none;
192
- border-radius: 4px;
193
- line-height: 32px;
194
- color: #FFF;
195
- }
196
-
197
- .ivu-checkbox {
198
- .ivu-checkbox-inner {
199
- border: 2px solid @themeColor;
200
- background-color: transparent;
201
- }
202
-
203
- .ivu-checkbox-focus {
204
- box-shadow: 0 0 0 0;
205
- }
206
- }
139
+ @import url("../../control.less");
207
140
 
208
- .ivu-checkbox-disabled+span {
209
- color: inherit;
210
- }
211
-
212
- each(@resourceColor, {
213
- .color-@{index} {
214
- .ivu-checkbox {
215
- .ivu-checkbox-inner {
216
- border-color: @value;
217
- }
218
- }
219
-
220
- .ivu-checkbox-checked {
221
- .ivu-checkbox-inner {
222
- background-color: @value;
223
- }
224
- }
225
- }
226
- });
227
- }
228
-
229
- &-disabled {
230
- .ivu-checkbox-disabled+span {
231
- color: #515a6e;
232
- }
233
- }
234
-
235
- &-scroll {
236
- overflow: auto;
237
- white-space: nowrap;
238
-
239
- .bri-scrollbar3();
240
- }
241
- }
242
-
243
- &-show {}
244
-
245
- .ivu-select-multiple {
246
- .ivu-select-selection {
247
- height: 32px;
248
- .dsh-flex-row-between-center();
249
-
250
- & > div {
251
- width: 100%;
252
- height: 100%;
253
- word-break: keep-all;
254
- white-space: nowrap;
255
- overflow: auto;
256
- .bri-scrollbar3();
257
-
258
- .ivu-tag {
259
- margin: 2px 4px 0px 0px;
260
- background-color: @borderColor;
261
- }
262
- }
263
- }
264
-
265
- &.ivu-select-disabled {
266
- .ivu-select-selection {
267
- & > div {
268
- .ivu-tag {
269
- background-color: @border-disabled;
270
- }
271
- }
272
- }
273
- }
274
-
275
- .ivu-select-item-selected:after {
276
- content: none;
277
- }
278
- }
141
+ .DshCheckbox {
142
+ #control-select(checkbox);
279
143
  }
280
144
  </style>