bri-components 1.2.2 → 1.2.4

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.
Files changed (40) hide show
  1. package/lib/0.bri-components.min.js +1 -1
  2. package/lib/1.bri-components.min.js +1 -1
  3. package/lib/2.bri-components.min.js +1 -1
  4. package/lib/3.bri-components.min.js +1 -1
  5. package/lib/4.bri-components.min.js +1 -1
  6. package/lib/5.bri-components.min.js +1 -1
  7. package/lib/6.bri-components.min.js +1 -1
  8. package/lib/7.bri-components.min.js +1 -1
  9. package/lib/8.bri-components.min.js +1 -1
  10. package/lib/9.bri-components.min.js +1 -1
  11. package/lib/bri-components.min.js +6 -6
  12. package/package.json +1 -1
  13. package/src/abolish/DshCascaders.vue +3 -0
  14. package/src/abolish/DshTexts.vue +3 -0
  15. package/src/components/controls/base/BriUpload/BriUploadImage.vue +1 -1
  16. package/src/components/controls/base/BriUpload/uploadMixin.js +16 -3
  17. package/src/components/controls/base/DshCascader/DshCascader.vue +24 -12
  18. package/src/components/controls/base/DshCheckbox.vue +5 -8
  19. package/src/components/controls/base/DshCoordinates.vue +6 -6
  20. package/src/components/controls/base/DshDaterange.vue +2 -2
  21. package/src/components/controls/controlMixin.js +9 -0
  22. package/src/components/controls/senior/BriLabels.vue +99 -94
  23. package/src/components/controls/senior/selectDepartments.vue +18 -12
  24. package/src/components/controls/senior/selectUsers/selectUsers.vue +32 -43
  25. package/src/components/list/BriTreeItem.vue +2 -2
  26. package/src/components/list/DshBox/DshPanel.vue +6 -6
  27. package/src/components/small/BriDrawer.vue +1 -1
  28. package/src/components/small/DshDropdown.vue +1 -0
  29. package/src/components/small/DshModal.vue +1 -1
  30. package/src/components/small/DshTags.vue +28 -26
  31. package/src/styles/common/control.less +23 -19
  32. package/src/styles/components/controls/base/DshCascader/DshCascader.less +5 -8
  33. package/src/styles/components/controls/base/DshCheckbox.less +16 -25
  34. package/src/styles/components/controls/senior/BriLabels.less +1 -1
  35. package/src/styles/components/controls/senior/selectDepartments.less +1 -1
  36. package/src/styles/components/controls/senior/selectUsers/selectUsers.less +1 -1
  37. package/src/styles/components/list/DshBox/DshPanel.less +2 -2
  38. package/src/styles/components/small/DshDropdown.less +6 -5
  39. package/src/styles/components/small/DshTags.less +1 -1
  40. package/src/styles/variables.less +2 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bri-components",
3
- "version": "1.2.2",
3
+ "version": "1.2.4",
4
4
  "author": "dengshanghui",
5
5
  "description": "a component lib for vue project",
6
6
  "main": "src/index.js",
@@ -22,6 +22,9 @@
22
22
  <dsh-tags
23
23
  class="dsh-margin-top5"
24
24
  :list="tags"
25
+ :propsObj="{
26
+ closable: true
27
+ }"
25
28
  @delete="$dispatchEvent(operationMap.deleteTag, arguments)"
26
29
  ></dsh-tags>
27
30
  </div>
@@ -19,6 +19,9 @@
19
19
  <dsh-tags
20
20
  class="dsh-margin-top5"
21
21
  :list="value[propsObj._key]"
22
+ :propsObj="{
23
+ closable: true
24
+ }"
22
25
  @delete="$dispatchEvent(operationMap.deleteTag, arguments)"
23
26
  ></dsh-tags>
24
27
  </div>
@@ -140,7 +140,7 @@
140
140
  computed: {
141
141
  modalPropsObj () {
142
142
  return {
143
- title: this.propsObj._name,
143
+ title: this.propsObj._name || "修改头像",
144
144
  class: "bri-modal",
145
145
  width: 450
146
146
  };
@@ -64,7 +64,7 @@ export default {
64
64
  callback: res => {
65
65
  this.inputType = "file";
66
66
  if (res.ossType === "ali-oss") {
67
- // 上传到阿里云
67
+ // 上传到阿里云res
68
68
  this[this.computedOssType](file, res, callback);
69
69
  } else if (res.ossType === "local") {
70
70
  this.localUpload(file, res, callback);
@@ -259,7 +259,6 @@ export default {
259
259
  binaryMultipartUpload (file, res, callback) {
260
260
  let type = "jpg";
261
261
  let remoteName = `${this.randomTimeStampFn()}.${type}`;
262
-
263
262
  // 上传成功的回调参数
264
263
  let callbackBody = {
265
264
  name: remoteName,
@@ -278,7 +277,21 @@ export default {
278
277
  callbackBody: this.transferCallBody(callbackBody)
279
278
  };
280
279
 
281
- new this.$aliOss(res.ossConfig).multipartUpload(remoteName, file, {
280
+ let newOss = {
281
+ ...res.ossConfig,
282
+ refreshSTSToken: async () => {
283
+ // 向您搭建的STS服务获取临时访问凭证。
284
+ return {
285
+ accessKeyId: res.ossConfig.accessKeyId, // 自己账户的accessKeyId或临时秘钥
286
+ accessKeySecret: res.ossConfig.accessKeySecret, // 自己账户的accessKeySecret或临时秘钥
287
+ stsToken: res.ossConfig.stsToken // 从STS服务获取的安全令牌(SecurityToken)。
288
+ };
289
+ },
290
+ // 刷新临时访问凭证的时间间隔,单位为毫秒。
291
+ refreshSTSTokenInterval: 3600 * 1000
292
+ };
293
+
294
+ new this.$aliOss(newOss).multipartUpload(remoteName, file, {
282
295
  progress: (percentage) => {
283
296
  this.inProgress(Number((percentage * 100).toFixed(0)));
284
297
  this.handleProgress && this.handleProgress(percentage, file);
@@ -25,6 +25,8 @@
25
25
  'DshCascader-edit-multiple-edit': true,
26
26
  'DshCascader-row-edit': isMultipleRow,
27
27
  }"
28
+ @mouseenter="isHover = true"
29
+ @mouseleave="isHover = false"
28
30
  @click="clickInput"
29
31
  >
30
32
  <!-- 有值 -->
@@ -33,21 +35,31 @@
33
35
  class="overflow"
34
36
  :list="curValNameList"
35
37
  :propsObj="{
36
- disabled: !finalCanEdit
38
+ disabled: !finalCanEdit,
39
+ closable: true
37
40
  }"
38
41
  @delete="deleteItem"
39
42
  ></dsh-tags>
40
-
41
- <Icon
42
- class="icon-default"
43
- type="ios-arrow-down"
44
- />
45
43
  </template>
46
-
47
44
  <!-- 无值 -->
48
45
  <template v-else>
49
46
  {{ emptyShowVal }}
50
47
  </template>
48
+
49
+ <!-- 图标 -->
50
+ <template>
51
+ <Icon
52
+ v-if="!$isEmptyData(curValList) && selfPropsObj._clearable && isHover"
53
+ class="icon-close"
54
+ type="ios-close-circle"
55
+ @click.stop="clickClear"
56
+ />
57
+ <Icon
58
+ v-else
59
+ class="icon-default"
60
+ :type="inputIcon"
61
+ />
62
+ </template>
51
63
  </div>
52
64
  </Cascader>
53
65
  </template>
@@ -74,7 +86,7 @@
74
86
  <Icon
75
87
  v-if="selfPropsObj._clearable && isHover"
76
88
  class="icon-close"
77
- type="md-close"
89
+ type="ios-close-circle"
78
90
  @click.stop="clickClear"
79
91
  />
80
92
  <Icon
@@ -139,9 +151,6 @@
139
151
  v-if="!$isEmptyData(curValList)"
140
152
  class="text"
141
153
  :list="curValNameList"
142
- :propsObj="{
143
- closable: false
144
- }"
145
154
  ></dsh-tags>
146
155
 
147
156
  <!-- 无值 -->
@@ -229,7 +238,7 @@
229
238
  return {
230
239
  _filterable: true,
231
240
  _showMode: false,
232
- _transfer: false,
241
+ _transfer: true,
233
242
  ...this.propsObj,
234
243
  ...this.commonDealPropsObj
235
244
  };
@@ -268,6 +277,9 @@
268
277
  showMode () {
269
278
  return this.selfPropsObj._showMode;
270
279
  },
280
+ inputIcon () {
281
+ return this.isVisible ? "ios-arrow-up" : "ios-arrow-down";
282
+ },
271
283
 
272
284
  // 多选用 名字组成的列表
273
285
  curValNameList () {
@@ -8,11 +8,11 @@
8
8
  <template v-if="showType === 'flat'">
9
9
  <CheckboxGroup
10
10
  :class="{
11
- 'DshCheckbox-group': true,
12
- 'DshCheckbox-group-color': useColor,
13
- 'DshCheckbox-group-disabled': !canEdit,
14
- 'DshCheckbox-group-scroll': selfPropsObj._span < 24 && !selfPropsObj._br,
15
- }"
11
+ 'DshCheckbox-group': true,
12
+ 'DshCheckbox-group-color': useColor,
13
+ 'DshCheckbox-group-disabled': !canEdit,
14
+ 'DshCheckbox-group-scroll': selfPropsObj._span < 24 && !selfPropsObj._br,
15
+ }"
16
16
  v-model="curValList"
17
17
  >
18
18
  <!-- 有选项 -->
@@ -95,9 +95,6 @@
95
95
  v-if="!$isEmptyData(curValList)"
96
96
  class="text"
97
97
  :list="curValObjList"
98
- :propsObj="{
99
- closable: false
100
- }"
101
98
  ></dsh-tags>
102
99
 
103
100
  <!-- 无值 -->
@@ -11,7 +11,7 @@
11
11
  ...commonClass,
12
12
  'DshCoordinates-edit': true
13
13
  }"
14
- @click.stop="clickOpenModal"
14
+ @click.stop="clickOpenModal"
15
15
  >
16
16
  <div class="text">
17
17
  {{ showText }}
@@ -20,8 +20,8 @@
20
20
  <Icon
21
21
  v-if="finalCanEdit && selfPropsObj._clearable"
22
22
  class="icon-close"
23
- type="md-close"
24
- @click.stop="clickDelete"
23
+ type="ios-close-circle"
24
+ @click.stop="clickClear"
25
25
  />
26
26
  </div>
27
27
  </bri-tooltip>
@@ -81,7 +81,7 @@
81
81
  :value="curVal.name"
82
82
  :readonly="true"
83
83
  :clearable="true"
84
- @on-clear="clickClear"
84
+ @on-clear="clickModalClear"
85
85
  @click.native="clickMapFitView"
86
86
  />
87
87
  </Col>
@@ -238,7 +238,7 @@
238
238
  this.curVal = this.cloneValue;
239
239
  },
240
240
  // 点击删除
241
- clickDelete () {
241
+ clickClear () {
242
242
  this.curVal = {
243
243
  name: "",
244
244
  lnglat: []
@@ -246,7 +246,7 @@
246
246
  this.$emit("change", []);
247
247
  },
248
248
  // 清除已选内容
249
- clickClear () {
249
+ clickModalClear () {
250
250
  this.curVal = {
251
251
  name: "",
252
252
  lnglat: []
@@ -40,7 +40,7 @@
40
40
  <span class="DshDaterange-item-icon">
41
41
  <Icon
42
42
  v-show="val0"
43
- type="md-close"
43
+ type="ios-close-circle"
44
44
  @click.stop="clickClear('', 0)"
45
45
  />
46
46
  <Icon
@@ -77,7 +77,7 @@
77
77
  <span class="DshDaterange-item-icon">
78
78
  <Icon
79
79
  v-show="val1"
80
- type="md-close"
80
+ type="ios-close-circle"
81
81
  @click.stop="clickClear('', 1)"
82
82
  />
83
83
  <Icon
@@ -70,6 +70,12 @@ export default {
70
70
  controlKey () {
71
71
  return this.propsObj._key;
72
72
  },
73
+ // 字段的真实key
74
+ fieldKey () {
75
+ return this.controlKey === "_default"
76
+ ? this.value._key
77
+ : (this.propsObj.__realKey__ || this.controlKey);
78
+ },
73
79
  controlType () {
74
80
  return this.propsObj._type;
75
81
  },
@@ -111,6 +117,9 @@ export default {
111
117
  },
112
118
 
113
119
  // 部分控件或部分条件下 才使用的属性
120
+ isCore () {
121
+ return !!this.propsObj.isCore;
122
+ },
114
123
  inTable () {
115
124
  return !!this.propsObj.inTable;
116
125
  },
@@ -7,7 +7,7 @@
7
7
  class="BriLabels-dropdown"
8
8
  trigger="custom"
9
9
  placement="bottom-start"
10
- :visible="listVisible"
10
+ :visible="isVisible"
11
11
  transfer
12
12
  @on-clickoutside="clickInput"
13
13
  >
@@ -17,59 +17,69 @@
17
17
  ...commonClass,
18
18
  'BriLabels-edit': true
19
19
  }"
20
+ @mouseenter="isHover = true"
21
+ @mouseleave="isHover = false"
20
22
  @click="clickInput"
21
23
  >
22
- <template v-if="!$isEmptyData(val)">
24
+ <!-- 有值 -->
25
+ <template v-if="!$isEmptyData(curValList)">
23
26
  <dsh-tags
24
27
  class="overflow"
25
- :list="val"
28
+ :list="curValList"
26
29
  :propsObj="{
27
- disabled: !finalCanEdit
30
+ disabled: !finalCanEdit,
31
+ closable: true
28
32
  }"
29
33
  :autoEllipsis="true"
30
34
  @delete="clickDeleteItem"
31
- >
32
- <span slot-scope="{ tagItem }">
33
- {{ tagItem.name }}
34
- </span>
35
- </dsh-tags>
35
+ ></dsh-tags>
36
+ </template>
37
+ <!-- 无值 -->
38
+ <template v-else>
39
+ {{ emptyShowVal }}
40
+ </template>
36
41
 
42
+ <!-- 图标 -->
43
+ <template>
44
+ <Icon
45
+ v-if="!$isEmptyData(curValList) && selfPropsObj._clearable && isHover"
46
+ class="icon-close"
47
+ type="ios-close-circle"
48
+ @click.stop="clickClear"
49
+ />
37
50
  <Icon
51
+ v-else
38
52
  class="icon-default"
39
53
  :type="inputIcon"
40
54
  />
41
55
  </template>
42
-
43
- <template v-else>
44
- {{ emptyShowVal }}
45
- </template>
46
56
  </div>
47
57
 
48
58
  <template #list>
49
59
  <DropdownMenu class="BriLabels-dropdown-menu">
50
60
  <DropdownItem
51
- v-for="item in listData"
52
- :key="item._key"
61
+ v-for="listItem in listData"
62
+ :key="listItem._key"
53
63
  :class="{
54
64
  'item': true,
55
- 'item-active': !!val.find(i=>i._key == item._key)
65
+ 'item-active': !!curValList.find(item => item._key === listItem._key)
56
66
  }"
57
- @click.native="clickItem(item)"
67
+ @click.native="clickItem(listItem)"
58
68
  >
59
69
 
60
70
  <div
61
- v-if="item.isEdit"
71
+ v-if="listItem.isEdit"
62
72
  class="item-edit"
63
73
  >
64
74
  <Input
65
- v-model="item.name"
75
+ v-model="listItem.name"
66
76
  @click.native="clickEditInput($event)"
67
77
  >
68
78
  <template #suffix>
69
79
  <Icon
70
80
  color="#3DB8C5"
71
81
  custom="bri bri-duigou"
72
- @click.native.stop="clickConfirm(item)"
82
+ @click.native.stop="clickConfirm(listItem)"
73
83
  />
74
84
  </template>
75
85
  </Input>
@@ -79,13 +89,13 @@
79
89
  v-else
80
90
  class="item-show"
81
91
  >
82
- {{ item.name }}
92
+ {{ listItem.name }}
83
93
  <span class="item-show-icons">
84
94
  <Icon
85
- v-if="!item.coreLabel"
95
+ v-if="!listItem.coreLabel"
86
96
  class="item-show-icons-edit"
87
97
  custom="bri bri-bianji"
88
- @click.stop="clickEditIcon(item)"
98
+ @click.stop="clickEditIcon(listItem)"
89
99
  />
90
100
  <!-- 暂时不需要删除 -->
91
101
  <!-- <Icon
@@ -97,7 +107,7 @@
97
107
  </DropdownItem>
98
108
 
99
109
  <div
100
- v-if="!selfPropsObj._onlySelect"
110
+ v-if="!onlySelect"
101
111
  class="btns"
102
112
  >
103
113
  <bri-button
@@ -117,7 +127,7 @@
117
127
  <!-- 查看 -->
118
128
  <template v-else>
119
129
  <bri-tooltip
120
- :content="showValStr"
130
+ :content="showVal"
121
131
  maxWidth="200"
122
132
  :transfer="true"
123
133
  >
@@ -126,17 +136,10 @@
126
136
  'BriLabels-show': true
127
137
  }">
128
138
  <dsh-tags
129
- v-if="!$isEmptyData(val)"
139
+ v-if="!$isEmptyData(curValList)"
130
140
  class="text"
131
- :list="val"
132
- :propsObj="{
133
- closable: false
134
- }"
135
- >
136
- <span slot-scope="{ tagItem }">
137
- {{ tagItem.name }}
138
- </span>
139
- </dsh-tags>
141
+ :list="curValList"
142
+ ></dsh-tags>
140
143
 
141
144
  <template v-else>
142
145
  {{ emptyShowVal }}
@@ -157,97 +160,99 @@
157
160
  ],
158
161
  data () {
159
162
  return {
163
+ isHover: false,
164
+
160
165
  listData: [],
161
- listVisible: false,
162
- inputIcon: "ios-arrow-down",
166
+ isVisible: false,
163
167
  renderList: false
164
168
  };
165
169
  },
166
170
  computed: {
167
171
  selfPropsObj () {
168
172
  return {
173
+ _labelType: "entity",
174
+ _onlySelect: false,
175
+ _originLabels: [],
176
+
169
177
  ...this.propsObj,
170
178
  ...this.commonDealPropsObj
171
179
  };
172
180
  },
173
- val: {
174
- get () {
175
- return this.value[this.controlKey] || [];
176
- },
177
- set (val) {
178
- this.value[this.controlKey] = val;
179
- }
180
- },
181
181
 
182
- isCore () {
183
- return this.selfPropsObj.isCore;
182
+ labelType () {
183
+ return this.selfPropsObj._labelType;
184
+ },
185
+ onlySelect () {
186
+ return this.selfPropsObj._onlySelect;
184
187
  },
185
- showValStr () {
186
- let valArr = this.val && this.val.map(item => item.name);
187
- return valArr && valArr.join("、");
188
+ originLabels () {
189
+ return this.selfPropsObj._originLabels;
190
+ },
191
+ inputIcon () {
192
+ return this.isVisible ? "ios-arrow-up" : "ios-arrow-down";
193
+ },
194
+
195
+ showVal () {
196
+ return this.$isEmptyData(this.curValList)
197
+ ? this.emptyShowVal
198
+ : this.curValList.map(item => item.name).join("、");
188
199
  }
189
200
  },
190
201
  created () {},
191
202
  methods: {
192
- init () {
193
- if (this.isCore) {
194
- this.listData = this.selfPropsObj._originLabels.map(item => {
195
- return {
196
- ...item,
197
- isEdit: false
198
- };
199
- });
200
- } else {
201
- this.getListData();
202
- }
203
- },
204
-
205
203
  clickInput () {
206
- if (!this.finalCanEdit) return;
207
- if (!this.renderList) {
208
- this.init();
209
- }
210
- this.renderList = true;
211
- this.listVisible = !this.listVisible;
212
- if (this.listVisible) {
213
- this.inputIcon = "ios-arrow-up";
214
- } else {
215
- this.inputIcon = "ios-arrow-down";
204
+ if (this.finalCanEdit) {
205
+ if (!this.renderList) {
206
+ if (this.isCore) {
207
+ this.listData = this.originLabels.map(item => {
208
+ return {
209
+ ...item,
210
+ isEdit: false
211
+ };
212
+ });
213
+ } else {
214
+ this.getListData();
215
+ }
216
+ }
217
+ this.renderList = true;
218
+ this.isVisible = !this.isVisible;
216
219
  }
217
220
  },
218
221
  clickEditInput (e) {
219
222
  e.stopPropagation();
220
223
  },
221
- clickEditIcon (item) {
222
- item.isEdit = true;
224
+ clickEditIcon (listItem) {
225
+ listItem.isEdit = true;
223
226
  this.$forceUpdate();
224
227
  },
225
- clickConfirm (item) {
226
- if (item.name == "") return;
227
- item.isEdit = false;
228
- this.$forceUpdate();
229
- this.change();
228
+ clickConfirm (listItem) {
229
+ if (listItem.name) {
230
+ listItem.isEdit = false;
231
+ this.$forceUpdate();
232
+ };
230
233
  },
231
234
 
232
- clickItem (item) {
233
- if (this.val.findIndex(i => i._key == item._key) > -1) {
234
- this.val = this.val.filter(i => i._key != item._key);
235
+ clickItem (listItem) {
236
+ if (this.curValList.some(item => item._key === listItem._key)) {
237
+ this.curValList = this.curValList.filter(item => item._key !== listItem._key);
235
238
  } else {
236
- this.val.push(item);
239
+ this.curValList = [...this.curValList, listItem];
237
240
  }
238
- this.change();
239
- },
240
- clickDeleteItem (item) {
241
- this.change();
242
241
  },
243
242
  clickAddItem () {
244
243
  this.listData.push({
245
244
  _key: this.$randomB36("Labels"),
246
245
  isEdit: true,
247
246
  name: "",
248
- labelType: this.selfPropsObj._labelType
247
+ labelType: this.labelType
249
248
  });
250
- this.change();
249
+ },
250
+ clickDeleteItem (deleteItem) {
251
+ this.curValList = this.curValList.filter(item => item._key !== deleteItem._key);
252
+ },
253
+ // 点击清除选择项
254
+ clickClear () {
255
+ this.curValList = [];
251
256
  },
252
257
 
253
258
  // 接口 -获取列表数据
@@ -259,10 +264,10 @@
259
264
  },
260
265
  params: {
261
266
  search: {
262
- entityKey: this.entityKey, // 当前工作表关联的数据表Key
263
- fieldKey: this.selfPropsObj._key === "_default" ? this.value._key : (this.selfPropsObj.__realKey__ || this.selfPropsObj._key), // 当前字段Key
264
- labelType: this.selfPropsObj._labelType,
265
- modKey: this.modKey
267
+ entityKey: this.entityKey,
268
+ modKey: this.modKey,
269
+ fieldKey: this.fieldKey, // 当前字段Key
270
+ labelType: this.labelType
266
271
  },
267
272
  pagination: {
268
273
  page: 1,