bri-components 1.3.84 → 1.3.86

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.3.84",
3
+ "version": "1.3.86",
4
4
  "author": "dengshanghui",
5
5
  "description": "a component lib for vue project",
6
6
  "main": "src/index.js",
@@ -9,8 +9,8 @@
9
9
  :disabled="selfPropsObj._disabled"
10
10
  :loading="selfPropsObj.loading"
11
11
  :size="selfPropsObj._size"
12
- :true-color="selfPropsObj._openColor"
13
- :false-color="selfPropsObj._closeColor"
12
+ :true-color="propsObj._openColor || $appData.themeColor"
13
+ :false-color="propsObj._closeColor || '#ccc'"
14
14
  :true-value="selfPropsObj._openValue"
15
15
  :false-value="selfPropsObj._closeValue"
16
16
  >
@@ -49,7 +49,9 @@
49
49
  <dsh-tags
50
50
  :class="{
51
51
  ...commonClass,
52
- 'DshSwitch-show-ellipsis': true
52
+ 'DshSwitch-show-ellipsis': true,
53
+ 'DshSwitch-open': this.curVal,
54
+ 'DshSwitch-close': !this.curVal
53
55
  }"
54
56
  :list="[curValObj]"
55
57
  itemClass="DshSwitch-show-ellipsis-tag"
@@ -38,11 +38,12 @@ const componentNameMap = {
38
38
  flatTable: "flatTable",
39
39
  cascaderTable: "cascaderTable",
40
40
 
41
- back: "DshBack",
42
- undefined: "DshUndeveloped",
43
-
44
41
  themeColor: "themeColor",
45
42
  themeIcon: "themeIcon",
43
+ color: "DshColor",
44
+
45
+ back: "DshBack",
46
+ undefined: "DshUndeveloped",
46
47
 
47
48
  ...controlConfig.componentNameMap
48
49
  };
@@ -70,13 +71,14 @@ const pathMap = {
70
71
  flatTable: "./senior/flatTable.vue",
71
72
  cascaderTable: "./senior/cascaderTable"
72
73
  },
74
+ extra: {
75
+ themeColor: "./extra/themeColor.vue",
76
+ themeIcon: "./extra/themeIcon.vue",
77
+ DshColor: "./extra/DshColor.vue"
78
+ },
73
79
  special: {
74
80
  DshBack: "./special/DshBack.vue",
75
81
  DshUndeveloped: "./special/DshUndeveloped.vue"
76
- },
77
- extra: {
78
- themeColor: "./extra/themeColor.vue",
79
- themeIcon: "./extra/themeIcon.vue"
80
82
  }
81
83
  };
82
84
 
@@ -0,0 +1,81 @@
1
+ <template>
2
+ <div class="DshColor">
3
+ <ColorPicker
4
+ class="DshColor-picker"
5
+ v-model="curVal"
6
+ :disabled="selfPropsObj._disabled"
7
+ :format="selfPropsObj._format"
8
+ :editable="selfPropsObj._editable"
9
+ :alpha="selfPropsObj._alpha"
10
+ :hue="selfPropsObj._hue"
11
+ :recommend="selfPropsObj._recommend"
12
+ :colors="colors"
13
+ :size="selfPropsObj._size"
14
+ :transfer="selfPropsObj._transfer"
15
+ @on-change="change"
16
+ @on-active-change="onActiveChange"
17
+ @on-open-change="onOpenChange"
18
+ />
19
+ </div>
20
+ </template>
21
+
22
+ <script>
23
+ import controlMixin from "../mixins/controlMixin.js";
24
+ import { resourceData } from "bri-datas";
25
+
26
+ export default {
27
+ name: "DshColor",
28
+ mixins: [
29
+ controlMixin
30
+ ],
31
+ components: {},
32
+ props: {},
33
+ data () {
34
+ return {};
35
+ },
36
+ computed: {
37
+ selfPropsObj () {
38
+ return {
39
+ _disabled: false,
40
+ _editable: true, // 是否可以输入色值
41
+ _alpha: false, // 是否支持透明度选择
42
+ _hue: true, // 是否支持色彩选择
43
+ _recommend: true, // 是否显示推荐的颜色预设
44
+ _colors: Object.values(resourceData.colorMap).slice(1), // 自定义颜色预设
45
+ _size: "default", // 尺寸,可选值为large、small、default或者不设置
46
+ _transfer: true,
47
+ ...this.propsObj,
48
+
49
+ _format: this.propsObj._format || (this.propsObj._alpha ? "rgb" : "hex") // 颜色的格式,可选值 hsl、hsv、hex、rgb;开启alpha时为rgb,其它为hex
50
+ };
51
+ },
52
+ colors () {
53
+ return this.selfPropsObj._colors;
54
+ }
55
+ },
56
+ created () {},
57
+ methods: {
58
+ // 面板中当前显示的颜色发生改变时触发
59
+ onActiveChange () {
60
+
61
+ },
62
+ // 下拉框展开或收起时触发
63
+ onOpenChange () {
64
+
65
+ }
66
+ }
67
+ };
68
+ </script>
69
+
70
+ <style lang="less" scoped>
71
+ .DshColor {
72
+ &-picker {
73
+ width: 100%;
74
+ }
75
+ }
76
+ </style>
77
+ <style lang="less">
78
+ .ivu-color-picker-transfer {
79
+ max-width: 360px;
80
+ }
81
+ </style>
@@ -139,7 +139,7 @@ export default {
139
139
  return ["users", "departments", "select", "checkbox", "regions", "cascaders", "switch", "labels", "refSelect"].includes(this.controlType);
140
140
  },
141
141
  commonDealPropsObj () {
142
- const selectControlTypes = ["date", "switch", "select", "checkbox", "file", "region", "regions", "cascader", "cascaders", "coordinates", "users", "departments"];
142
+ const selectControlTypes = ["coordinates", "date", "switch", "select", "checkbox", "file", "region", "regions", "cascader", "cascaders", "users", "departments", "reference"];
143
143
  return {
144
144
  // TODO: 此处的请输入可能还有请选择之类的,待处理
145
145
  _placeholder: this.canEdit && this.propsObj._enterType !== "calculate"
@@ -170,7 +170,7 @@ export default {
170
170
  // 获取某项的class集合 --flat方式在用
171
171
  getItemClass (item) {
172
172
  return [
173
- this.useColor
173
+ this.useColor && !(item.color || "").includes("#")
174
174
  ? this.colorMap[item.color] ? item.color : "color-default"
175
175
  : undefined,
176
176
  item.class
@@ -178,7 +178,9 @@ export default {
178
178
  },
179
179
  // 获取某项的颜色相关style --flat方式在用
180
180
  getItemColorStyle (item) {
181
- const color = this.colorMap[item.color] || this.colorMap["color-default"];
181
+ const color = (item.color || "").includes("#")
182
+ ? item.color
183
+ : this.colorMap[item.color] || this.colorMap["color-default"];
182
184
  return this.useColor
183
185
  ? {
184
186
  backgroundColor: this.$getColor(color, 0.1),
@@ -16,8 +16,6 @@ export default {
16
16
  basePropsObj () {
17
17
  return {
18
18
  loading: false, // 是否为加载状态
19
- _openColor: this.$appData.themeColor, // 打开时的背景色
20
- _closeColor: "#ccc", // 关闭时的背景色
21
19
  _openValue: true, // 打开时对应的值
22
20
  _closeValue: false, // 关闭时对应的值
23
21
 
@@ -25,22 +23,36 @@ export default {
25
23
  ...this.commonDealPropsObj,
26
24
 
27
25
  _openText: this.propsObj._openText || "是", // 此行放在 ...this.propsObj的下面目的是,处理_openText为空字符串的情况
28
- _closeText: this.propsObj._closeText || "否"
26
+ _closeText: this.propsObj._closeText || "否",
27
+ _openColor: this.propsObj._openColor || "#37C45E", // 打开时的背景色
28
+ _closeColor: this.propsObj._closeColor || "#E83636" // 关闭时的背景色
29
29
  };
30
30
  },
31
+ openText () {
32
+ return this.selfPropsObj._openText;
33
+ },
34
+ closeText () {
35
+ return this.selfPropsObj._closeText;
36
+ },
37
+ openColor () {
38
+ return this.selfPropsObj._openColor;
39
+ },
40
+ closeColor () {
41
+ return this.selfPropsObj._closeColor;
42
+ },
31
43
  mulPropsObj () {
32
44
  return {
33
45
  _optionKind: "flat",
34
46
  _data: [
35
47
  {
36
48
  _key: "true",
37
- name: this.selfPropsObj._openText,
38
- color: this.selfPropsObj._openColor
49
+ name: this.openText,
50
+ color: this.openColor
39
51
  },
40
52
  {
41
53
  _key: "false",
42
- name: this.selfPropsObj._closeText,
43
- color: this.selfPropsObj._closeColor
54
+ name: this.closeText,
55
+ color: this.closeColor
44
56
  }
45
57
  ],
46
58
 
@@ -49,14 +61,15 @@ export default {
49
61
  },
50
62
 
51
63
  curValObj () {
64
+ const color = this.curVal === true ? this.openColor : this.closeColor;
52
65
  return !this.$isEmptyData(this.curVal)
53
66
  ? {
54
67
  _key: "1",
55
68
  name: this.showVal,
56
69
  style: {
57
70
  ...this.tagStyle,
58
- backgroundColor: this.curVal === true ? "#d3f3dc" : "#FDEDED",
59
- color: this.curVal === true ? "#37C45E" : "#E83636"
71
+ backgroundColor: this.$getColor(color, 0.1),
72
+ color: color
60
73
  }
61
74
  }
62
75
  : undefined;
@@ -65,8 +78,8 @@ export default {
65
78
  return this.$isEmptyData(this.curVal)
66
79
  ? this.emptyShowVal
67
80
  : this.curVal === true
68
- ? this.selfPropsObj._openText
69
- : this.selfPropsObj._closeText;
81
+ ? this.openText
82
+ : this.closeText;
70
83
  }
71
84
  },
72
85
  created () { },
@@ -28,16 +28,16 @@ export default {
28
28
  ? []
29
29
  : this.useSummary && this.allListData.length
30
30
  ? [
31
- this.filterColumns.reduce((obj, col) => {
31
+ this.filterColumns.reduce((obj, column) => {
32
32
  return {
33
33
  ...obj,
34
- [col._key]: col._type === "number" && ![undefined, null, "", "no"].includes(col._summaryType)
34
+ [column._key]: column._type === "number" && column._summaryType
35
35
  ? this.$calNumList(
36
- this.allListData.map(item => item[col._key]),
37
- col._summaryType,
38
- { ...col, _defaultDigit: 2 }
36
+ this.allListData.map(item => item[column._key]),
37
+ column._summaryType,
38
+ { ...column, _defaultDigit: 2 }
39
39
  )
40
- : (obj[col._key] || "--")
40
+ : (obj[column._key] || "--")
41
41
  };
42
42
  }, {
43
43
  _id: this.$ObjectID().str,
@@ -57,7 +57,7 @@ export default {
57
57
  this.filterColumns.reduce((obj, column) => {
58
58
  return {
59
59
  ...obj,
60
- [column._key]: column._type === "number" && ![undefined, null, "", "no"].includes(column._summaryType)
60
+ [column._key]: column._type === "number" && column._summaryType
61
61
  ? this.$calNumList(
62
62
  this.allListData
63
63
  .filter(item => item.level === 1)
@@ -347,7 +347,7 @@ export default {
347
347
  // 递归到叶子节点前 从上往下执行 要处理的
348
348
  cols.reduce((newRow, column) => {
349
349
  if (["number", "date"].includes(column._type)) {
350
- if (![undefined, null, "", "no"].includes(column._summaryType)) {
350
+ if (column._summaryType) {
351
351
  // 不做处理,_summaryType和_writeSort互反,更安全的判断
352
352
  }
353
353
  else if (["upToDown"].includes(column._writeSort) && column._noLimitWrite !== true) {
@@ -370,7 +370,7 @@ export default {
370
370
  // 递归到叶子节点后到 从下往上执行 要处理的(非叶子节点)
371
371
  cols.reduce((newRow, column) => {
372
372
  if (["number", "date"].includes(column._type)) {
373
- if (![undefined, null, "", "no"].includes(column._summaryType)) {
373
+ if (column._summaryType) {
374
374
  const val = ["number"].includes(column._type)
375
375
  ? this.$calNumList(
376
376
  newRow.children.map(subRow => subRow[column._key]),
@@ -404,7 +404,7 @@ export default {
404
404
  // 递归到叶子节点后到 从下往上执行 要处理的(叶子节点)
405
405
  cols.reduce((newRow, column) => {
406
406
  if (["number", "date"].includes(column._type)) {
407
- if (![undefined, null, "", "no"].includes(column._summaryType)) {
407
+ if (column._summaryType) {
408
408
  this.$set(newRow, column._key, newRow[column._key]);
409
409
  }
410
410
  else if (["downToUp"].includes(column._writeSort) && column._noLimitWrite !== true) {
@@ -1058,7 +1058,7 @@ export default {
1058
1058
  getColCanEdit (col, row) {
1059
1059
  return (
1060
1060
  ["treeTable"].includes(this.inTableType) && ["number", "date"].includes(col._type)
1061
- ? ![undefined, null, "", "no"].includes(col._summaryType)
1061
+ ? col._summaryType
1062
1062
  ? row.isLeaf === true
1063
1063
  : ["downToUp", "upToDown"].includes(col._writeSort)
1064
1064
  ? col._noLimitWrite === true
package/src/index.js CHANGED
@@ -9,12 +9,12 @@ import CN from "vue-easytable/libs/locale/lang/zh-CN.js";
9
9
 
10
10
  // list
11
11
  import BriTable from "./components/list/BriTable.vue";
12
- import DshFlatTable from "./components/list/DshFlatTable.vue";
13
12
  import DshBox from "./components/list/DshBox/DshBox.vue";
14
13
  import DshList from "./components/list/DshBox/DshList.vue";
15
14
  import DshTable from "./components/list/DshBox/DshTable.vue";
16
15
  import DshPage from "./components/list/DshPage.vue";
17
16
  import DshCrossTable from "./components/list/DshBox/DshCrossTable.vue";
17
+ import DshFlatTable from "./components/list/DshFlatTable.vue";
18
18
  // import DshCascaderTable from "./components/list/DshCascaderTable.vue";
19
19
  // import DshTreeTable from "./components/list/DshTreeTable.vue";
20
20
 
@@ -84,6 +84,8 @@ import selectUsers from "./components/controls/senior/selectUsers/selectUsers.vu
84
84
  import departMenu from "./components/controls/senior/selectUsers/departMenu.vue";
85
85
  import selectDepartments from "./components/controls/senior/selectDepartments.vue";
86
86
 
87
+ import DshColor from "./components/controls/extra/DshColor.vue";
88
+
87
89
  // import DshBack from "./components/controls/special/DshBack.vue";
88
90
  // import DshUndeveloped from "./components/controls/special/DshUndeveloped.vue";
89
91
 
@@ -188,6 +190,9 @@ export {
188
190
  DshTable,
189
191
  DshPage,
190
192
  DshCrossTable,
193
+ DshFlatTable,
194
+ // DshCascaderTable,
195
+ // DshTreeTable,
191
196
 
192
197
  // form
193
198
  DshForm,
@@ -212,6 +217,8 @@ export {
212
217
  DshColorPanel,
213
218
 
214
219
  // small
220
+ DshRender,
221
+ DshListRender,
215
222
  BriButton,
216
223
  BriDrawer,
217
224
  BriTooltip,
@@ -223,18 +230,12 @@ export {
223
230
  DshTabsSet,
224
231
  DshTags,
225
232
  DshTitle,
226
- DshRender,
227
- DshListRender,
228
233
 
229
234
  /* 只局部导出的 */
230
235
  Error500,
231
236
  Error403,
232
237
  Error404,
233
238
 
234
- DshFlatTable,
235
- // DshCascaderTable,
236
- // DshTreeTable,
237
-
238
239
  BriCard,
239
240
  BriTree,
240
241
  BriTreeItem,
@@ -249,13 +250,17 @@ export {
249
250
  DshCoordinates,
250
251
  DshEditor,
251
252
  DshDivider,
253
+
252
254
  DshPackage,
253
- // DshBack,
254
- // DshUndeveloped,
255
255
  selectUsers,
256
256
  departMenu,
257
257
  selectDepartments,
258
258
 
259
+ DshColor,
260
+
261
+ // DshBack,
262
+ // DshUndeveloped,
263
+
259
264
  DshMenuNav,
260
265
  BriCode,
261
266
  BriCollapseTree,
@@ -20,8 +20,13 @@
20
20
  height: 100%;
21
21
 
22
22
  @keyframes spin {
23
- from { transform: rotate(0deg); }
24
- to { transform: rotate(360deg); }
23
+ from {
24
+ transform: rotate(0deg);
25
+ }
26
+
27
+ to {
28
+ transform: rotate(360deg);
29
+ }
25
30
  }
26
31
 
27
32
  .BriLoading-main {
@@ -31,16 +36,18 @@
31
36
 
32
37
  &-loading {
33
38
  border-radius: 50%;
34
- background: conic-gradient(#5EC4CF 50%, white);
39
+ background: conic-gradient(@themeColor 50%, white);
35
40
  --mask: radial-gradient(closest-side, transparent 70%, black 71%);
36
41
  -webkit-mask-image: var(--mask);
37
42
  mask-image: var(--mask);
38
43
  animation: spin 1s linear infinite;
39
44
  }
45
+
40
46
  &-loadingText {
41
47
  margin-top: 8px;
42
48
  color: @themeColor;
43
49
  }
50
+
44
51
  &-noText {
45
52
  color: @textColor;
46
53
  margin-top: 16px;