bri-components 1.4.68 → 1.4.70

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.4.68",
3
+ "version": "1.4.70",
4
4
  "author": "dengshanghui",
5
5
  "description": "a component lib for vue project",
6
6
  "main": "src/index.js",
@@ -149,7 +149,7 @@
149
149
  ...operationItem,
150
150
  ...(
151
151
  operationItem.operationFunc
152
- ? operationItem.operationFunc(operationItem, params.row, params.index)
152
+ ? operationItem.operationFunc(operationItem, params.row, params.index, this.selfOperationList)
153
153
  : {}
154
154
  )
155
155
  };
@@ -160,7 +160,7 @@
160
160
  class: "bri-table-td-operation",
161
161
  props: {
162
162
  list: totalOperationList,
163
- maxFlatNum: this.maxBtnNum - 1,
163
+ maxFlatNum: this.selfOperationList.length > this.maxBtnNum ? this.maxBtnNum - 1 : this.selfOperationList.length,
164
164
  itemClass: "bri-table-td-operation-btn"
165
165
  },
166
166
  on: {
@@ -527,7 +527,7 @@
527
527
  endKey: getDate((step - 1) * 24 + 23.9999),
528
528
  name: "今天",
529
529
  colspan: 1,
530
- fullName: this.dateFormat(getDate(0), "yyyy-MM-dd"),
530
+ fullName: this.$dateFormat(getDate(0), "yyyy-MM-dd"),
531
531
  style: { color: this.simpleDataColor, fontWeight: 500 },
532
532
  now: true
533
533
  }
@@ -541,8 +541,8 @@
541
541
  key: key,
542
542
  endKey: getDate((i + step - 1) * 24 + 23.9999),
543
543
  name: this.getDayName(key, stepKind),
544
- fullName: this.dateFormat(key, "yyyy-MM-dd"),
545
- style: this.dateFormat(key, "d") == "1" && { fontWeight: 500 }
544
+ fullName: this.$dateFormat(key, "yyyy-MM-dd"),
545
+ style: this.$dateFormat(key, "d") == "1" && { fontWeight: 500 }
546
546
  });
547
547
  }
548
548
  // 大于今天
@@ -553,8 +553,8 @@
553
553
  key: key,
554
554
  endKey: getDate((i + step - 1) * 24 + 23.9999),
555
555
  name: this.getDayName(key, stepKind),
556
- fullName: this.dateFormat(key, "yyyy-MM-dd"),
557
- style: this.dateFormat(key, "d") == "1" && { fontWeight: 500 }
556
+ fullName: this.$dateFormat(key, "yyyy-MM-dd"),
557
+ style: this.$dateFormat(key, "d") == "1" && { fontWeight: 500 }
558
558
  });
559
559
  }
560
560
  return data;
@@ -574,11 +574,11 @@
574
574
  for (let i = startTime; i <= endTime; i++) {
575
575
  let key = getDate(i * 24);
576
576
  data.push({
577
- now: this.dateFormat(key, "yyyy-MM-dd") === this.dateFormat(new Date(), "yyyy-MM-dd"),
577
+ now: this.$dateFormat(key, "yyyy-MM-dd") === this.$dateFormat(new Date(), "yyyy-MM-dd"),
578
578
  key: key,
579
579
  endKey: getDate(i * 24 + 23.9999),
580
580
  name: this.getDayName(key, stepKind),
581
- fullName: this.dateFormat(key, "yyyy-MM-dd")
581
+ fullName: this.$dateFormat(key, "yyyy-MM-dd")
582
582
  });
583
583
  }
584
584
  return data;
@@ -680,14 +680,14 @@
680
680
  },
681
681
  // 获得日期显示格式
682
682
  getDayName (key, stepKind) {
683
- let name = this.dateFormat(key, "M月d日");
683
+ let name = this.$dateFormat(key, "M月d日");
684
684
  if (name === "1日") {
685
- name = this.dateFormat(key, "M月d日");
685
+ name = this.$dateFormat(key, "M月d日");
686
686
  }
687
687
  if (stepKind === "month") {
688
- name = this.dateFormat(key, "M月");
688
+ name = this.$dateFormat(key, "M月");
689
689
  if (name === "1月") {
690
- name = `${this.dateFormat(key, "yyyy年M月")}`;
690
+ name = `${this.$dateFormat(key, "yyyy年M月")}`;
691
691
  }
692
692
  }
693
693
  return name;
@@ -704,28 +704,6 @@
704
704
  // 重新渲染
705
705
  refresh () {
706
706
 
707
- },
708
- dateFormat (date, fmt) {
709
- let time = new Date(date);
710
- let o = {
711
- "M+": time.getMonth() + 1, // 月份
712
- "d+": time.getDate(), // 日
713
- "h+": time.getHours(), // 小时
714
- "m+": time.getMinutes(), // 分
715
- "s+": time.getSeconds(), // 秒
716
- "q+": Math.floor((time.getMonth() + 3) / 3), // 季度
717
- "S": time.getMilliseconds() // 毫秒
718
- };
719
- if (/(y+)/.test(fmt)) {
720
- fmt = fmt.replace(RegExp.$1, (time.getFullYear() + "").substr(4 - RegExp.$1.length));
721
- }
722
- for (let k in o) {
723
- if (new RegExp("(" + k + ")").test(fmt)) {
724
- fmt = fmt.replace(
725
- RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
726
- }
727
- }
728
- return fmt;
729
707
  },
730
708
  // 绑定同步滚动
731
709
  handleScroll (el, scrollList) {
@@ -9,20 +9,47 @@
9
9
  >
10
10
  <!-- 左侧按钮 -->
11
11
  <div class="DshButtons-flex-left">
12
- <bri-button
13
- v-for="(operationItem, index) in leftFlatList"
14
- :key="operationItem._key || operationItem.type"
15
- :style="operationItem.style"
16
- :class="[
17
- index ? 'dsh-margin-left8' : undefined,
18
- !operationItem.loading && !operationItem.customIcon && !operationItem.icon ? 'DshButtons-item' : undefined,
19
- itemClass,
20
- ]"
21
- :propsObj="operationItem"
22
- @click="emit(operationItem)"
23
- >
24
- {{ operationItem.name }}
25
- </bri-button>
12
+ <template v-for="(operationItem, index) in leftFlatList">
13
+ <Poptip
14
+ v-if="operationItem.tipContent"
15
+ :key="(operationItem._key || operationItem.type) + 'poptip'"
16
+ trigger="hover"
17
+ :title="operationItem.tipTitle"
18
+ :content="operationItem.tipContent"
19
+ word-wrap
20
+ width="220"
21
+ :transfer="true"
22
+ >
23
+ <bri-button
24
+ :key="operationItem._key || operationItem.type"
25
+ :style="operationItem.style"
26
+ :class="[
27
+ index ? 'dsh-margin-left8' : undefined,
28
+ !operationItem.loading && !operationItem.customIcon && !operationItem.icon ? 'DshButtons-item' : undefined,
29
+ itemClass,
30
+ ]"
31
+ :propsObj="operationItem"
32
+ @click="emit(operationItem)"
33
+ >
34
+ {{ operationItem.name }}
35
+ </bri-button>
36
+ </Poptip>
37
+
38
+ <bri-button
39
+ v-else
40
+ :key="operationItem._key || operationItem.type"
41
+ :style="operationItem.style"
42
+ :class="[
43
+ index ? 'dsh-margin-left8' : undefined,
44
+ !operationItem.loading && !operationItem.customIcon && !operationItem.icon ? 'DshButtons-item' : undefined,
45
+ itemClass,
46
+ ]"
47
+ :propsObj="operationItem"
48
+ @click="emit(operationItem)"
49
+ >
50
+ {{ operationItem.name }}
51
+ </bri-button>
52
+ </template>
26
53
 
27
54
  <!-- 更多的 下拉按钮-->
28
55
  <dsh-dropdown
@@ -49,40 +76,96 @@
49
76
  <div class="DshButtons-flex-right">
50
77
  <slot></slot>
51
78
 
79
+ <template v-for="(operationItem, index) in rightList">
80
+ <Poptip
81
+ v-if="operationItem.tipContent"
82
+ :key="(operationItem._key || operationItem.type) + 'poptip'"
83
+ trigger="hover"
84
+ :title="operationItem.tipTitle"
85
+ :content="operationItem.tipContent"
86
+ word-wrap
87
+ width="220"
88
+ :transfer="true"
89
+ >
90
+ <bri-button
91
+ :key="operationItem._key || operationItem.type"
92
+ :style="operationItem.style"
93
+ :class="[
94
+ index ? 'dsh-margin-left8' : undefined,
95
+ !operationItem.loading && !operationItem.customIcon && !operationItem.icon ? 'DshButtons-item' : undefined,
96
+ itemClass,
97
+ ]"
98
+ :propsObj="operationItem"
99
+ @click="emit(operationItem)"
100
+ >
101
+ {{ operationItem.name }}
102
+ </bri-button>
103
+ </Poptip>
104
+
105
+ <bri-button
106
+ v-else
107
+ :key="operationItem._key || operationItem.type"
108
+ :style="operationItem.style"
109
+ :class="[
110
+ index ? 'dsh-margin-left8' : undefined,
111
+ !operationItem.loading && !operationItem.customIcon && !operationItem.icon ? 'DshButtons-item' : undefined,
112
+ itemClass,
113
+ ]"
114
+ :propsObj="operationItem"
115
+ @click="emit(operationItem)"
116
+ >
117
+ {{ operationItem.name }}
118
+ </bri-button>
119
+ </template>
120
+ </div>
121
+ </div>
122
+
123
+ <template v-else>
124
+ <template v-for="(operationItem, index) in flatList">
125
+ <Poptip
126
+ v-if="operationItem.tipContent"
127
+ :key="(operationItem._key || operationItem.type) + 'poptip'"
128
+ trigger="hover"
129
+ :title="operationItem.tipTitle"
130
+ :content="operationItem.tipContent"
131
+ word-wrap
132
+ width="220"
133
+ popper-class="DshButtons-poptip"
134
+ :transfer="true"
135
+ >
136
+ <bri-button
137
+ :key="operationItem._key || operationItem.type"
138
+ :style="operationItem.style"
139
+ :class="[
140
+ index ? 'dsh-margin-left8' : undefined,
141
+ !operationItem.loading && !operationItem.customIcon && !operationItem.icon ? 'DshButtons-item' : undefined,
142
+ itemClass,
143
+ ]"
144
+ :propsObj="operationItem"
145
+ @click="emit(operationItem)"
146
+ >
147
+ {{ operationItem.name }}
148
+ </bri-button>
149
+ </Poptip>
150
+
52
151
  <bri-button
53
- v-for="(operationItem, index) in rightList"
152
+ v-else
54
153
  :key="operationItem._key || operationItem.type"
55
154
  :style="operationItem.style"
56
155
  :class="[
57
156
  index ? 'dsh-margin-left8' : undefined,
58
157
  !operationItem.loading && !operationItem.customIcon && !operationItem.icon ? 'DshButtons-item' : undefined,
59
158
  itemClass,
159
+ ...(Array.isArray(operationItem.class) ? operationItem.class : [operationItem.class])
60
160
  ]"
61
161
  :propsObj="operationItem"
62
162
  @click="emit(operationItem)"
63
163
  >
64
164
  {{ operationItem.name }}
65
165
  </bri-button>
66
- </div>
67
- </div>
68
-
69
- <template v-else>
70
- <bri-button
71
- v-for="(operationItem, index) in flatList"
72
- :key="operationItem._key || operationItem.type"
73
- :style="operationItem.style"
74
- :class="[
75
- index ? 'dsh-margin-left8' : undefined,
76
- !operationItem.loading && !operationItem.customIcon && !operationItem.icon ? 'DshButtons-item' : undefined,
77
- itemClass,
78
- ...(Array.isArray(operationItem.class) ? operationItem.class : [operationItem.class])
79
- ]"
80
- :propsObj="operationItem"
81
- @click="emit(operationItem)"
82
- >
83
- {{ operationItem.name }}
84
- </bri-button>
166
+ </template>
85
167
 
168
+ <!-- 更多 -->
86
169
  <dsh-dropdown
87
170
  v-if="moreList.length"
88
171
  class="DshButtons-dropdown"
@@ -208,3 +291,28 @@
208
291
  }
209
292
  }
210
293
  </style>
294
+ <style lang="less">
295
+ .DshButtons {
296
+ &-poptip {
297
+ .ivu-poptip-content {
298
+ .ivu-poptip-arrow {
299
+ &:after {
300
+ border-top-color: @textColor;
301
+ }
302
+ }
303
+
304
+ .ivu-poptip-inner {
305
+ background-color: @textColor;
306
+
307
+ .ivu-poptip-body {
308
+ &-content {
309
+ &-inner {
310
+ color: @textWhColor;
311
+ }
312
+ }
313
+ }
314
+ }
315
+ }
316
+ }
317
+ }
318
+ </style>