bri-components 1.2.1 → 1.2.2

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 (33) 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/5.bri-components.min.js +1 -1
  4. package/lib/bri-components.min.js +5 -5
  5. package/package.json +1 -1
  6. package/src/components/controls/base/BriUpload/BriUploadImage.vue +45 -32
  7. package/src/components/controls/base/BriUpload/uploadMixin.js +3 -2
  8. package/src/components/controls/base/DshCascader/DshCascader.vue +3 -6
  9. package/src/components/controls/base/DshCheckbox.vue +130 -137
  10. package/src/components/controls/base/DshCoordinates.vue +121 -147
  11. package/src/components/controls/base/DshDaterange.vue +1 -1
  12. package/src/components/controls/base/DshEditor.vue +2 -1
  13. package/src/components/controls/base/DshSelect.vue +3 -13
  14. package/src/components/controls/base/DshSwitch.vue +13 -20
  15. package/src/components/controls/controlMixin.js +10 -1
  16. package/src/components/controls/senior/BriLabels.vue +1 -0
  17. package/src/components/controls/senior/selectUsers/DepartmentMenu.vue +2 -2
  18. package/src/components/small/DshTags.vue +131 -8
  19. package/src/styles/common/control.less +4 -2
  20. package/src/styles/components/controls/.DS_Store +0 -0
  21. package/src/styles/components/controls/base/BriUpload/BriUpload.less +1 -1
  22. package/src/styles/components/controls/base/BriUpload/BriUploadImage.less +6 -0
  23. package/src/styles/components/controls/base/DshCascader/DshCascader.less +16 -11
  24. package/src/styles/components/controls/base/DshCheckbox.less +32 -59
  25. package/src/styles/components/controls/base/DshCoordinates.less +1 -35
  26. package/src/styles/components/controls/base/DshSelect.less +16 -1
  27. package/src/styles/components/controls/base/DshSwitch.less +1 -31
  28. package/src/styles/components/controls/senior/.DS_Store +0 -0
  29. package/src/styles/components/controls/senior/BriLabels.less +1 -1
  30. package/src/styles/components/list/BriFlatTable.less +1 -1
  31. package/src/styles/components/small/DshModal.less +20 -42
  32. package/src/styles/components/small/DshTags.less +32 -14
  33. package/src/styles/components/unit/DshFormItem.less +3 -25
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bri-components",
3
- "version": "1.2.1",
3
+ "version": "1.2.2",
4
4
  "author": "dengshanghui",
5
5
  "description": "a component lib for vue project",
6
6
  "main": "src/index.js",
@@ -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";
@@ -255,7 +255,8 @@ export default {
255
255
  };
256
256
  };
257
257
  },
258
- putUpload (file, res, callback) {
258
+ // bri-upload-image 用的是这种方式
259
+ binaryMultipartUpload (file, res, callback) {
259
260
  let type = "jpg";
260
261
  let remoteName = `${this.randomTimeStampFn()}.${type}`;
261
262
 
@@ -277,7 +278,7 @@ export default {
277
278
  callbackBody: this.transferCallBody(callbackBody)
278
279
  };
279
280
 
280
- new this.$aliOss(res.ossConfig).put(remoteName, file, {
281
+ new this.$aliOss(res.ossConfig).multipartUpload(remoteName, file, {
281
282
  progress: (percentage) => {
282
283
  this.inProgress(Number((percentage * 100).toFixed(0)));
283
284
  this.handleProgress && this.handleProgress(percentage, file);
@@ -23,7 +23,7 @@
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
28
  @click="clickInput"
29
29
  >
@@ -132,15 +132,12 @@
132
132
  <div :class="{
133
133
  ...commonClass,
134
134
  'DshCascader-show-multiple': true,
135
- 'DshCascader-row': isMultipleRow,
135
+ 'DshCascader-row-show': isMultipleRow && !isUnitShow,
136
136
  }">
137
137
  <!-- 有值 -->
138
138
  <dsh-tags
139
139
  v-if="!$isEmptyData(curValList)"
140
- :class="{
141
- overflow: true,
142
- 'overflow-unit': isUnitShow
143
- }"
140
+ class="text"
144
141
  :list="curValNameList"
145
142
  :propsObj="{
146
143
  closable: false
@@ -5,110 +5,108 @@
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
+ :propsObj="{
99
+ closable: false
100
+ }"
101
+ ></dsh-tags>
104
102
 
105
- <div
106
- v-else
107
- class="bri-control-nodata dsh-ellipsis"
108
- >
109
- {{ emptyShowVal }}
110
- </div>
111
- </bri-tooltip>
103
+ <!-- 无值 -->
104
+ <template v-else>
105
+ {{ emptyShowVal }}
106
+ </template>
107
+ </div>
108
+ </bri-tooltip>
109
+ </template>
112
110
 
113
111
  <!-- tip项弹框提示 -->
114
112
  <dsh-render :render="tipModalRender"></dsh-render>
@@ -116,9 +114,9 @@
116
114
  </template>
117
115
 
118
116
  <script>
119
- import { resourceData } from "bri-datas";
120
117
  import controlMixin from "../controlMixin.js";
121
118
  import selectMixin from "./selectMixin.js";
119
+ import { resourceData } from "bri-datas";
122
120
 
123
121
  // optionKind值 'flat'、'dropdown'
124
122
  export default {
@@ -129,18 +127,7 @@
129
127
  ],
130
128
  props: {},
131
129
  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
- };
130
+ return {};
144
131
  },
145
132
  computed: {
146
133
  selfPropsObj () {
@@ -150,55 +137,61 @@
150
137
  _data: [],
151
138
 
152
139
  ...this.propsObj,
153
- ...this.commonDealPropsObj,
154
- _maxTagCount: this.propsObj._maxTagCount || undefined
140
+ ...this.commonDealPropsObj
155
141
  };
156
142
  },
157
- colorMap () {
158
- return this.selfPropsObj.colorMap || resourceData.colorMap;
143
+ listData () {
144
+ return (this.selfPropsObj._data || []).concat(this.initListData);
159
145
  },
146
+
160
147
  showType () {
161
148
  return this.selfPropsObj._optionKind;
162
149
  },
163
-
164
- listData () {
165
- return (this.selfPropsObj._data || []).concat(this.initListData);
150
+ useColor () {
151
+ return this.selfPropsObj._useColor;
166
152
  },
167
- showVal () {
168
- return this.colData.map(col => col.name).join("、");
153
+ colorMap () {
154
+ return this.selfPropsObj.colorMap || resourceData.colorMap;
169
155
  },
170
- // 选项数据
171
- colData () {
172
- return this.listData.filter(item => (this.curVal || []).includes(item._key));
156
+
157
+ // 已选择项的对象列表
158
+ curValObjList () {
159
+ return this.listData
160
+ .filter(item => this.curValList.includes(item._key))
161
+ .map(item => {
162
+ return {
163
+ ...item,
164
+ style: this.getItemStyle(item),
165
+ color: undefined
166
+ };
167
+ });
173
168
  },
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";
169
+ showMultipleVal () {
170
+ return this.curValObjList.map(item => item.name).join("");
180
171
  }
181
172
  },
182
173
  created () {},
183
174
  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);
175
+ getItemColorClass (color) {
176
+ return this.colorMap[color] ? color : "color-1";
195
177
  },
196
-
197
- isDisabled (item) {
178
+ getItemStyle (item) {
179
+ const getColor = (color) => {
180
+ return this.colorMap[color] || this.colorMap["color-1"];
181
+ };
182
+ const getBgColor = (color) => {
183
+ return this.$getColor(getColor(color), 0.1);
184
+ };
185
+ return {
186
+ background: this.useColor ? getBgColor(item.color) : undefined,
187
+ color: this.useColor ? getColor(item.color) : undefined
188
+ };
189
+ },
190
+ getItemDisabled (item) {
198
191
  return !!(
199
192
  !this.finalCanEdit ||
200
193
  item._disabled ||
201
- this.curVal && this.curVal.length >= this.selfPropsObj._max && !this.curVal.includes(item._key)
194
+ this.curValList.length >= this.selfPropsObj._max && !this.curValList.includes(item._key)
202
195
  );
203
196
  }
204
197
  }