xianniu-ui 0.3.34 → 0.4.1

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": "xianniu-ui",
3
- "version": "0.3.34",
3
+ "version": "0.4.1",
4
4
  "private": false,
5
5
  "main": "lib/xianniu-ui.umd.min.js",
6
6
  "scripts": {
@@ -13,7 +13,7 @@
13
13
  <slot />
14
14
  <span slot="footer">
15
15
  <slot name="footer">
16
- <el-button @click="onClose">取消</el-button>
16
+ <el-button @click="onClose" v-if="$attrs['show-cancel'] !== false">取消</el-button>
17
17
  <el-button
18
18
  v-if="$attrs['show-confirm'] !== false"
19
19
  type="primary"
@@ -1,9 +1,18 @@
1
1
  @import './theme/theme.scss';
2
+ @import './theme/variables.scss';
2
3
  .text-primary{color: $--color-primary!important;}
3
4
  .text-success{color: $--color-success!important;}
4
5
  .text-danger{color: $--color-danger!important;}
5
6
  .text-warning{color: $--color-warning!important;}
6
7
 
8
+ .text-blue{color: $blue !important;}
9
+ .text-red{color: $red !important;}
10
+ .text-yellow{color: $yellow !important;}
11
+ .text-green{color: $green !important;}
12
+ .text-grey{color: $grey !important;}
13
+ .text-orange{color: $orange !important;}
14
+
15
+
7
16
  .fw-1{font-weight: 100 !important;}
8
17
  .fw-2{font-weight: 200 !important;}
9
18
  .fw-3{font-weight: 300 !important;}
@@ -10,6 +10,7 @@
10
10
  @import './basic.scss';
11
11
  @import './flex.scss';
12
12
  @import './footer.scss';
13
+ @import './tag.scss';
13
14
 
14
15
 
15
16
 
@@ -0,0 +1,35 @@
1
+ @import "./theme/variables.scss";
2
+ .xn-tag {
3
+ &--color {
4
+ &__blue {
5
+ color: $blue;
6
+ border: 1px solid $blue;
7
+ background-color: rgba($color: $blue, $alpha: 0.2);
8
+ }
9
+ &__grey {
10
+ color: $grey;
11
+ border: 1px solid $grey;
12
+ background-color: rgba($color: $grey, $alpha: 0.2);
13
+ }
14
+ &__green {
15
+ color: $green;
16
+ border: 1px solid $green;
17
+ background-color: rgba($color: $green, $alpha: 0.2);
18
+ }
19
+ &__red {
20
+ color: $red;
21
+ border: 1px solid $red;
22
+ background-color: rgba($color: $red, $alpha: 0.2);
23
+ }
24
+ &__orange {
25
+ color: $orange;
26
+ border: 1px solid $orange;
27
+ background-color: rgba($color: $orange, $alpha: 0.2);
28
+ }
29
+ &__yellow {
30
+ color: $yellow;
31
+ border: 1px solid $yellow;
32
+ background-color: rgba($color: $yellow, $alpha: 0.2);
33
+ }
34
+ }
35
+ }
@@ -1,4 +1,5 @@
1
- $--color-primary: #FF745C;
2
- $--color-success: #52C41A;
3
- $--color-warning: #FAAD14;
4
- $--color-danger: #FF4D4F;
1
+ $--color-primary: #ff745c;
2
+ $--color-success: #52c41a;
3
+ $--color-warning: #faad14;
4
+ $--color-danger: #ff4d4f;
5
+
@@ -1,11 +1,7 @@
1
1
  // base color
2
- $blue:#324157;
3
2
  $light-blue:#3A71A8;
4
- $red:#C03639;
3
+
5
4
  $pink: #E65D6E;
6
- $green: #30B08F;
7
- $tiffany: #4AB7BD;
8
- $yellow:#FEC171;
9
5
  $panGreen: #30B08F;
10
6
 
11
7
  // sidebar
@@ -22,6 +18,15 @@ $subMenuHover:#FFEDEA;
22
18
 
23
19
  $sideBarWidth: 200px;
24
20
 
21
+
22
+
23
+ $grey: #c1c1c9;
24
+ $blue: #5e9dff;
25
+ $red: #ff4d4f;
26
+ $green: #52c41a;
27
+ $yellow: #ffb500;
28
+ $orange: #ff8c00;
29
+
25
30
  // the :export directive is the magic sauce for webpack
26
31
  // https://www.bluematador.com/blog/how-to-share-variables-between-js-and-sass
27
32
  :export {
@@ -0,0 +1,7 @@
1
+ import XnTag from './main.vue'
2
+
3
+ XnTag.install = function (Vue) {
4
+ Vue.component(XnTag.name, XnTag)
5
+ }
6
+
7
+ export default XnTag
@@ -0,0 +1,102 @@
1
+ <script>
2
+ import { Tag } from "element-ui";
3
+ export default {
4
+ name: "XnTag",
5
+ extends: Tag,
6
+ props: {
7
+ ...Tag.props,
8
+ icon: { type: String },
9
+ className: { type: String },
10
+ defaultColor: {
11
+ type: String,
12
+ validator: (val) => {
13
+ return (
14
+ ["grey", "blue", "green", "red", "yellow", "orange"].indexOf(val) !==
15
+ -1
16
+ );
17
+ },
18
+ },
19
+ },
20
+ computed: {
21
+ getColor() {
22
+ return function (hex, opacity) {
23
+ if (!hex) hex = "#ededed";
24
+
25
+ if (hex.length === 4) {
26
+ var sColorNew = "#";
27
+ for (var i = 1; i < 4; i += 1) {
28
+ sColorNew += hex.slice(i, i + 1).concat(hex.slice(i, i + 1));
29
+ }
30
+ hex = sColorNew;
31
+ }
32
+ let rgba =
33
+ "rgba(" +
34
+ parseInt("0x" + hex.slice(1, 3)) +
35
+ "," +
36
+ parseInt("0x" + hex.slice(3, 5)) +
37
+ "," +
38
+ parseInt("0x" + hex.slice(5, 7)) +
39
+ "," +
40
+ (opacity || "1") +
41
+ ")";
42
+ return rgba;
43
+ };
44
+ },
45
+ },
46
+ render() {
47
+ const { tagSize, hit, effect, icon, className, color, type, defaultColor } =
48
+ this;
49
+ const classes = [
50
+ "el-tag",
51
+ "xn-tag",
52
+ defaultColor ? `xn-tag--color__${defaultColor}` : "",
53
+ type && !color ? `el-tag--${type}` : "",
54
+ tagSize ? `el-tag--${tagSize}` : "",
55
+ effect ? `el-tag--${effect}` : "",
56
+ hit && "is-hit",
57
+ className,
58
+ ];
59
+
60
+ const _color = (color, effect) => {
61
+ let c = {};
62
+ if (!color) return null;
63
+ switch (effect) {
64
+ case "dark":
65
+ c = {
66
+ border: `1px solid ${color}`,
67
+ backgroundColor: `${color}`,
68
+ };
69
+ break;
70
+ case "light":
71
+ c = {
72
+ border: `1px solid ${color}`,
73
+ color,
74
+ backgroundColor: `${this.getColor(color, 0.2)}`,
75
+ };
76
+ break;
77
+ case "plain":
78
+ c = {
79
+ border: `1px solid ${color}`,
80
+ color,
81
+ backgroundColor: `none`,
82
+ };
83
+ break;
84
+ }
85
+ return c;
86
+ };
87
+
88
+ const isIcon = this.$slots.icon || (icon && <i class={icon}></i>);
89
+ const tagEl = (
90
+ <span style={{ ..._color(color, effect) }} class={classes}>
91
+ {isIcon} {this.$slots.default}
92
+ </span>
93
+ );
94
+
95
+ return tagEl;
96
+ },
97
+ };
98
+ </script>
99
+
100
+ <style lang="scss" scoped>
101
+
102
+ </style>
package/src/index.js CHANGED
@@ -13,6 +13,7 @@ import XnImport from '../packages/import/index'
13
13
  import XnExport from '../packages/export/index'
14
14
  import XnFooter from '../packages/footer/index'
15
15
  import XnEmpty from '../packages/empty/index'
16
+ import XnTag from '../packages/tag/index'
16
17
 
17
18
  import Utils from 'xn-ui/src/utils/index'
18
19
  const doc = 'http://lzwr.gitee.io/xn-ui/#/'
@@ -30,7 +31,8 @@ const components = [
30
31
  XnImport,
31
32
  XnExport,
32
33
  XnFooter,
33
- XnEmpty
34
+ XnEmpty,
35
+ XnTag
34
36
  ]
35
37
  const version = require('../package.json').version
36
38
  const install = function (Vue) {