bri-components 1.2.1 → 1.2.3

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 (43) 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/5.bri-components.min.js +1 -1
  5. package/lib/bri-components.min.js +5 -5
  6. package/package.json +1 -1
  7. package/src/abolish/DshCascaders.vue +3 -0
  8. package/src/abolish/DshTexts.vue +3 -0
  9. package/src/components/controls/base/BriUpload/BriUploadImage.vue +45 -32
  10. package/src/components/controls/base/BriUpload/uploadMixin.js +7 -5
  11. package/src/components/controls/base/DshCascader/DshCascader.vue +25 -17
  12. package/src/components/controls/base/DshCheckbox.vue +127 -137
  13. package/src/components/controls/base/DshCoordinates.vue +121 -147
  14. package/src/components/controls/base/DshDaterange.vue +3 -3
  15. package/src/components/controls/base/DshEditor.vue +2 -1
  16. package/src/components/controls/base/DshSelect.vue +3 -13
  17. package/src/components/controls/base/DshSwitch.vue +13 -20
  18. package/src/components/controls/controlMixin.js +19 -1
  19. package/src/components/controls/senior/BriLabels.vue +98 -93
  20. package/src/components/controls/senior/selectDepartments.vue +16 -11
  21. package/src/components/controls/senior/selectUsers/DepartmentMenu.vue +2 -2
  22. package/src/components/controls/senior/selectUsers/selectUsers.vue +18 -15
  23. package/src/components/small/BriDrawer.vue +1 -1
  24. package/src/components/small/DshDropdown.vue +1 -0
  25. package/src/components/small/DshModal.vue +1 -1
  26. package/src/components/small/DshTags.vue +135 -8
  27. package/src/styles/common/control.less +19 -15
  28. package/src/styles/components/controls/.DS_Store +0 -0
  29. package/src/styles/components/controls/base/BriUpload/BriUpload.less +1 -1
  30. package/src/styles/components/controls/base/BriUpload/BriUploadImage.less +6 -0
  31. package/src/styles/components/controls/base/DshCascader/DshCascader.less +13 -11
  32. package/src/styles/components/controls/base/DshCheckbox.less +39 -75
  33. package/src/styles/components/controls/base/DshCoordinates.less +1 -35
  34. package/src/styles/components/controls/base/DshSelect.less +16 -1
  35. package/src/styles/components/controls/base/DshSwitch.less +1 -31
  36. package/src/styles/components/controls/senior/.DS_Store +0 -0
  37. package/src/styles/components/controls/senior/BriLabels.less +1 -1
  38. package/src/styles/components/list/BriFlatTable.less +1 -1
  39. package/src/styles/components/small/DshDropdown.less +6 -5
  40. package/src/styles/components/small/DshModal.less +20 -42
  41. package/src/styles/components/small/DshTags.less +32 -14
  42. package/src/styles/components/unit/DshFormItem.less +3 -25
  43. 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.1",
3
+ "version": "1.2.3",
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>
@@ -53,10 +53,7 @@
53
53
 
54
54
  </div>
55
55
  <div class="wrap">
56
- <Button
57
- type="default"
58
- class="btn-cancel-outline z-default"
59
- >点击上传</Button>
56
+ <Button type="default">点击上传</Button>
60
57
  <input
61
58
  id="fileupload"
62
59
  class="file"
@@ -67,36 +64,26 @@
67
64
  </div>
68
65
 
69
66
  <!-- 修改头像模态框 -->
70
- <Modal
71
- :title="propsObj._title || '修改头像'"
67
+ <dsh-modal
72
68
  v-model="avatarModal"
73
- class="bri-modal"
74
- width="500"
75
- :mask-closable="false"
76
- :footer-hide="true"
69
+ mode="custom"
70
+ :propsObj="modalPropsObj"
77
71
  @on-visible-change="visibleChange"
78
72
  >
79
- <div
80
- class="avatar-modal"
81
- style="width:400px;margin: 0 auto;"
82
- >
83
- <dsh-cropper
84
- style="width: 400px;height: 400px;"
85
- ref="cropper"
86
- :src="imgSrc"
87
- alt="Source Image"
88
- :cropmove="cropImage"
89
- >
90
- </dsh-cropper>
91
- <div class="avatar-modal-footer bri-footer">
92
- <Button @click="cancelAvatarModal()">取消</Button>
93
- <Button
94
- type="primary"
95
- @click="photoSubmit()"
96
- >保存</Button>
97
- </div>
98
- </div>
99
- </Modal>
73
+ <dsh-cropper
74
+ class="BriUploadImage-cropper"
75
+ ref="cropper"
76
+ :src="imgSrc"
77
+ alt="Source Image"
78
+ :cropmove="cropImage"
79
+ ></dsh-cropper>
80
+
81
+ <dsh-buttons
82
+ class="bri-modal-footer"
83
+ :list="$getOperationList(['cancel', 'confirm'])"
84
+ @click="$dispatchEvent($event)"
85
+ ></dsh-buttons>
86
+ </dsh-modal>
100
87
  </div>
101
88
  </template>
102
89
 
@@ -120,10 +107,29 @@
120
107
  isAvatar: {
121
108
  type: Boolean,
122
109
  default: false
110
+ },
111
+ // 阿里云上传方式
112
+ ossType: {
113
+ type: String,
114
+ default: "binaryMultipartUpload"
123
115
  }
124
116
  },
125
117
  data () {
126
118
  return {
119
+ operationMap: {
120
+ cancel: {
121
+ name: "取消",
122
+ type: "cancel",
123
+ btnType: "cancel",
124
+ event: "cancelAvatarModal"
125
+ },
126
+ confirm: {
127
+ name: "确认",
128
+ type: "confirm",
129
+ btnType: "primary",
130
+ event: "photoSubmit"
131
+ }
132
+ },
127
133
  // 头像
128
134
  avatarModal: false,
129
135
  inputType: "file",
@@ -132,6 +138,13 @@
132
138
  };
133
139
  },
134
140
  computed: {
141
+ modalPropsObj () {
142
+ return {
143
+ title: this.propsObj._name || "修改头像",
144
+ class: "bri-modal",
145
+ width: 450
146
+ };
147
+ },
135
148
  imageResizeConfig () {
136
149
  return this.propsObj._imageResizeConfig || {
137
150
  m: "fixed",
@@ -170,7 +183,7 @@
170
183
  }
171
184
  if (typeof FileReader === "function") {
172
185
  const reader = new FileReader();
173
- if (this.propsObj._kind == "uploadImage") {
186
+ if (this.propsObj._kind == "uploadImage" && !this.propsObj.cropper) {
174
187
  reader.onload = (event) => {
175
188
  let data = event.target.result;
176
189
  this.inputType = "text";
@@ -64,7 +64,8 @@ export default {
64
64
  callback: res => {
65
65
  this.inputType = "file";
66
66
  if (res.ossType === "ali-oss") {
67
- // 上传到阿里云
67
+ console.log(this.computedOssType, res);
68
+ // 上传到阿里云res
68
69
  this[this.computedOssType](file, res, callback);
69
70
  } else if (res.ossType === "local") {
70
71
  this.localUpload(file, res, callback);
@@ -255,10 +256,11 @@ export default {
255
256
  };
256
257
  };
257
258
  },
258
- putUpload (file, res, callback) {
259
+ // bri-upload-image 用的是这种方式
260
+ binaryMultipartUpload (file, res, callback) {
259
261
  let type = "jpg";
260
262
  let remoteName = `${this.randomTimeStampFn()}.${type}`;
261
-
263
+ console.log("调binaryMultipartUpload");
262
264
  // 上传成功的回调参数
263
265
  let callbackBody = {
264
266
  name: remoteName,
@@ -276,8 +278,8 @@ export default {
276
278
  callbackBodyType: "application/json",
277
279
  callbackBody: this.transferCallBody(callbackBody)
278
280
  };
279
-
280
- new this.$aliOss(res.ossConfig).put(remoteName, file, {
281
+ console.log("调binaryMultipartUpload22");
282
+ new this.$aliOss(res.ossConfig).multipartUpload(remoteName, file, {
281
283
  progress: (percentage) => {
282
284
  this.inProgress(Number((percentage * 100).toFixed(0)));
283
285
  this.handleProgress && this.handleProgress(percentage, file);
@@ -23,8 +23,10 @@
23
23
  :class="{
24
24
  ...commonClass,
25
25
  'DshCascader-edit-multiple-edit': true,
26
- 'DshCascader-row': isMultipleRow,
26
+ 'DshCascader-row-edit': isMultipleRow,
27
27
  }"
28
+ @mouseenter="isHover = true"
29
+ @mouseleave="isHover = false"
28
30
  @click="clickInput"
29
31
  >
30
32
  <!-- 有值 -->
@@ -37,17 +39,26 @@
37
39
  }"
38
40
  @delete="deleteItem"
39
41
  ></dsh-tags>
40
-
41
- <Icon
42
- class="icon-default"
43
- type="ios-arrow-down"
44
- />
45
42
  </template>
46
-
47
43
  <!-- 无值 -->
48
44
  <template v-else>
49
45
  {{ emptyShowVal }}
50
46
  </template>
47
+
48
+ <!-- 图标 -->
49
+ <template>
50
+ <Icon
51
+ v-if="!$isEmptyData(curValList) && selfPropsObj._clearable && isHover"
52
+ class="icon-close"
53
+ type="ios-close-circle"
54
+ @click.stop="clickClear"
55
+ />
56
+ <Icon
57
+ v-else
58
+ class="icon-default"
59
+ :type="inputIcon"
60
+ />
61
+ </template>
51
62
  </div>
52
63
  </Cascader>
53
64
  </template>
@@ -74,7 +85,7 @@
74
85
  <Icon
75
86
  v-if="selfPropsObj._clearable && isHover"
76
87
  class="icon-close"
77
- type="md-close"
88
+ type="ios-close-circle"
78
89
  @click.stop="clickClear"
79
90
  />
80
91
  <Icon
@@ -132,19 +143,13 @@
132
143
  <div :class="{
133
144
  ...commonClass,
134
145
  'DshCascader-show-multiple': true,
135
- 'DshCascader-row': isMultipleRow,
146
+ 'DshCascader-row-show': isMultipleRow && !isUnitShow,
136
147
  }">
137
148
  <!-- 有值 -->
138
149
  <dsh-tags
139
150
  v-if="!$isEmptyData(curValList)"
140
- :class="{
141
- overflow: true,
142
- 'overflow-unit': isUnitShow
143
- }"
151
+ class="text"
144
152
  :list="curValNameList"
145
- :propsObj="{
146
- closable: false
147
- }"
148
153
  ></dsh-tags>
149
154
 
150
155
  <!-- 无值 -->
@@ -232,7 +237,7 @@
232
237
  return {
233
238
  _filterable: true,
234
239
  _showMode: false,
235
- _transfer: false,
240
+ _transfer: true,
236
241
  ...this.propsObj,
237
242
  ...this.commonDealPropsObj
238
243
  };
@@ -271,6 +276,9 @@
271
276
  showMode () {
272
277
  return this.selfPropsObj._showMode;
273
278
  },
279
+ inputIcon () {
280
+ return this.isVisible ? "ios-arrow-up" : "ios-arrow-down";
281
+ },
274
282
 
275
283
  // 多选用 名字组成的列表
276
284
  curValNameList () {
@@ -5,110 +5,105 @@
5
5
  >
6
6
  <template v-if="canEdit">
7
7
  <!-- 平铺 -->
8
- <CheckboxGroup
9
- v-if="showType === 'flat'"
10
- :class="{
8
+ <template v-if="showType === 'flat'">
9
+ <CheckboxGroup
10
+ :class="{
11
11
  'DshCheckbox-group': true,
12
- 'DshCheckbox-group-disabled': !canEdit && selfPropsObj._useColor,
13
- 'DshCheckbox-group-color': selfPropsObj._useColor,
14
- 'DshCheckbox-group-disabled-color': !canEdit && !selfPropsObj._useColor,
12
+ 'DshCheckbox-group-color': useColor,
13
+ 'DshCheckbox-group-disabled': !canEdit,
15
14
  'DshCheckbox-group-scroll': selfPropsObj._span < 24 && !selfPropsObj._br,
16
15
  }"
17
- v-model="value[controlKey]"
18
- @on-change="change"
19
- >
20
- <template v-if="listData.length">
21
- <Checkbox
16
+ v-model="curValList"
17
+ >
18
+ <!-- 有选项 -->
19
+ <template v-if="listData.length">
20
+ <Checkbox
21
+ v-for="(item, index) in listData"
22
+ :key="index"
23
+ :class="[
24
+ 'DshCheckbox-item',
25
+ getItemColorClass(item.color),
26
+ selfPropsObj.class,
27
+ item.class
28
+ ]"
29
+ :style="getItemStyle(item)"
30
+ :label="item._key"
31
+ :border="useColor"
32
+ :disabled="getItemDisabled(item)"
33
+ @click.native="clickOpenTip(item)"
34
+ >
35
+ <slot :item="item"></slot>
36
+ <span>{{ item.name || item._name }}</span>
37
+ </Checkbox>
38
+ </template>
39
+
40
+ <!-- 无选项 -->
41
+ <div
42
+ v-else
43
+ class="dsh-subtip"
44
+ style="backgroundColor: #f3f3f3;"
45
+ >-- 无选择项 --</div>
46
+ </CheckboxGroup>
47
+ </template>
48
+
49
+ <!-- 下拉 -->
50
+ <template v-else>
51
+ <Select
52
+ v-model="curValList"
53
+ :multiple="true"
54
+ :placeholder="selfPropsObj._placeholder"
55
+ :disabled="!finalCanEdit"
56
+ :filterable="selfPropsObj._filterable"
57
+ :transfer="selfPropsObj._transfer"
58
+ :transfer-class-name="selfPropsObj._transferClassName"
59
+ :max-tag-count="selfPropsObj._maxTagCount"
60
+ >
61
+ <Option
22
62
  v-for="(item, index) in listData"
23
63
  :key="index"
24
- :class="[
25
- 'myChecked ',
26
- selfPropsObj.class,
27
- item.class,
28
- getColorClass(item.color)
29
- ]"
30
- :style="{
31
- backgroundColor: selfPropsObj._useColor ? getBgColor(item.color) : '',
32
- color:selfPropsObj._useColor ? getColor(item.color) : undefined
33
- }"
34
- :label="item._key"
35
- :border="selfPropsObj._useColor"
36
- :disabled="isDisabled(item)"
37
- @click.native="clickOpenTip(item)"
64
+ :value="item._key"
65
+ :label="item.name || item._name"
66
+ :disabled="getItemDisabled(item)"
38
67
  >
39
- <slot :item="item"></slot>
40
- <span>{{ item.name || item._name }}</span>
41
- </Checkbox>
42
- </template>
68
+ <Checkbox :value="curValList.includes(item._key)"></Checkbox>
43
69
 
44
- <div
45
- v-else
46
- class="dsh-subtip"
47
- style="backgroundColor: #f3f3f3;"
48
- >-- 无选择项 --</div>
49
- </CheckboxGroup>
70
+ <slot :item="item"></slot>
50
71
 
51
- <!-- 下拉 -->
52
- <Select
53
- v-else
54
- v-model="value[controlKey]"
55
- :multiple="true"
56
- :placeholder="selfPropsObj._placeholder"
57
- :disabled="!finalCanEdit"
58
- :filterable="selfPropsObj._filterable"
59
- :transfer="selfPropsObj._transfer"
60
- :transfer-class-name="selfPropsObj._transferClassName"
61
- :max-tag-count="selfPropsObj._maxTagCount"
62
- @on-select="select"
63
- >
64
- <Option
65
- v-for="(item, index) in listData"
66
- :key="index"
67
- :value="item._key"
68
- :label="item.name || item._name"
69
- :disabled="isDisabled(item)"
70
- >
71
- <Checkbox :value="!!value[controlKey] && value[controlKey].includes(item._key)">
72
- </Checkbox>
73
- <slot :item="item"></slot>
74
- <span>{{ item.name || item._name }}</span>
75
- <span style="float:right;paddingRight:20px">{{ item.rightName }}</span>
76
- </Option>
77
- </Select>
72
+ <span>{{ item.name || item._name }}</span>
73
+ <span style="float:right;paddingRight:20px">
74
+ {{ item.rightName }}
75
+ </span>
76
+ </Option>
77
+ </Select>
78
+ </template>
78
79
  </template>
79
80
 
80
- <bri-tooltip
81
- v-else
82
- placement="top"
83
- :transfer="true"
84
- maxWidth="200"
85
- :content="showVal"
86
- >
87
- <div
88
- v-if="showVal"
89
- class="DshCheckbox-value-wrapper"
90
- :style="{
91
- justifyContent: flatShowAlign
92
- }"
81
+ <!-- 查看 -->
82
+ <template v-else>
83
+ <bri-tooltip
84
+ :content="showMultipleVal"
85
+ placement="top"
86
+ maxWidth="200"
87
+ :transfer="true"
93
88
  >
94
- <span
95
- v-for="col in colData"
96
- :key="col._id || col._key"
97
- class="DshCheckbox-value dsh-ellipsis"
98
- :style="{
99
- background: selfPropsObj._useColor ? getBgColor(col.color) : '',
100
- color: selfPropsObj._useColor ? getColor(col.color) : ''
101
- }"
102
- >{{ col.name }}</span>
103
- </div>
89
+ <div :class="{
90
+ ...commonClass,
91
+ 'DshCheckbox-show': true
92
+ }">
93
+ <!-- 有值 -->
94
+ <dsh-tags
95
+ v-if="!$isEmptyData(curValList)"
96
+ class="text"
97
+ :list="curValObjList"
98
+ ></dsh-tags>
104
99
 
105
- <div
106
- v-else
107
- class="bri-control-nodata dsh-ellipsis"
108
- >
109
- {{ emptyShowVal }}
110
- </div>
111
- </bri-tooltip>
100
+ <!-- 无值 -->
101
+ <template v-else>
102
+ {{ emptyShowVal }}
103
+ </template>
104
+ </div>
105
+ </bri-tooltip>
106
+ </template>
112
107
 
113
108
  <!-- tip项弹框提示 -->
114
109
  <dsh-render :render="tipModalRender"></dsh-render>
@@ -116,9 +111,9 @@
116
111
  </template>
117
112
 
118
113
  <script>
119
- import { resourceData } from "bri-datas";
120
114
  import controlMixin from "../controlMixin.js";
121
115
  import selectMixin from "./selectMixin.js";
116
+ import { resourceData } from "bri-datas";
122
117
 
123
118
  // optionKind值 'flat'、'dropdown'
124
119
  export default {
@@ -129,18 +124,7 @@
129
124
  ],
130
125
  props: {},
131
126
  data () {
132
- return {
133
- getBgColor: color => {
134
- let curColor = this.colorMap[color] || this.colorMap["color-1"];
135
- return this.$getColor(curColor, 0.1);
136
- },
137
- getColor: color => {
138
- return this.colorMap[color] || this.colorMap["color-1"];
139
- },
140
- getColorClass: color => {
141
- return this.colorMap[color] ? color : "color-1";
142
- }
143
- };
127
+ return {};
144
128
  },
145
129
  computed: {
146
130
  selfPropsObj () {
@@ -150,55 +134,61 @@
150
134
  _data: [],
151
135
 
152
136
  ...this.propsObj,
153
- ...this.commonDealPropsObj,
154
- _maxTagCount: this.propsObj._maxTagCount || undefined
137
+ ...this.commonDealPropsObj
155
138
  };
156
139
  },
157
- colorMap () {
158
- return this.selfPropsObj.colorMap || resourceData.colorMap;
140
+ listData () {
141
+ return (this.selfPropsObj._data || []).concat(this.initListData);
159
142
  },
143
+
160
144
  showType () {
161
145
  return this.selfPropsObj._optionKind;
162
146
  },
163
-
164
- listData () {
165
- return (this.selfPropsObj._data || []).concat(this.initListData);
147
+ useColor () {
148
+ return this.selfPropsObj._useColor;
166
149
  },
167
- showVal () {
168
- return this.colData.map(col => col.name).join("、");
150
+ colorMap () {
151
+ return this.selfPropsObj.colorMap || resourceData.colorMap;
169
152
  },
170
- // 选项数据
171
- colData () {
172
- return this.listData.filter(item => (this.curVal || []).includes(item._key));
153
+
154
+ // 已选择项的对象列表
155
+ curValObjList () {
156
+ return this.listData
157
+ .filter(item => this.curValList.includes(item._key))
158
+ .map(item => {
159
+ return {
160
+ ...item,
161
+ style: this.getItemStyle(item),
162
+ color: undefined
163
+ };
164
+ });
173
165
  },
174
- flatShowAlign () {
175
- return !this.propsObj._align || this.propsObj._align == "left" || !this.isUnitShow
176
- ? "flex-start"
177
- : this.propsObj._align == "right"
178
- ? "flex-end"
179
- : "center";
166
+ showMultipleVal () {
167
+ return this.curValObjList.map(item => item.name).join("");
180
168
  }
181
169
  },
182
170
  created () {},
183
171
  methods: {
184
- // 下拉框的选择
185
- select (item) {
186
- let val = this.curVal;
187
- if (val.includes(item.value)) {
188
- let itemIndex = val.findIndex(valItem => valItem === item.value);
189
- val.splice(itemIndex, 1);
190
- } else {
191
- val.push(item.value);
192
- }
193
-
194
- this.$emit("change", val);
172
+ getItemColorClass (color) {
173
+ return this.colorMap[color] ? color : "color-1";
195
174
  },
196
-
197
- isDisabled (item) {
175
+ getItemStyle (item) {
176
+ const getColor = (color) => {
177
+ return this.colorMap[color] || this.colorMap["color-1"];
178
+ };
179
+ const getBgColor = (color) => {
180
+ return this.$getColor(getColor(color), 0.1);
181
+ };
182
+ return {
183
+ background: this.useColor ? getBgColor(item.color) : undefined,
184
+ color: this.useColor ? getColor(item.color) : undefined
185
+ };
186
+ },
187
+ getItemDisabled (item) {
198
188
  return !!(
199
189
  !this.finalCanEdit ||
200
190
  item._disabled ||
201
- this.curVal && this.curVal.length >= this.selfPropsObj._max && !this.curVal.includes(item._key)
191
+ this.curValList.length >= this.selfPropsObj._max && !this.curValList.includes(item._key)
202
192
  );
203
193
  }
204
194
  }