@jx3box/jx3box-common-ui 7.2.7 → 7.3.0

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.
@@ -20,6 +20,12 @@ a{
20
20
  .none;
21
21
  }
22
22
  }
23
+ .c-main.expanding-right {
24
+ .mr(0) !important;
25
+ .c-sidebar-right{
26
+ .db;
27
+ }
28
+ }
23
29
  .c-main.without-left{
24
30
  .ml(0) !important;
25
31
  }
@@ -62,4 +68,4 @@ a{
62
68
  .mt(0);
63
69
  }
64
70
  }
65
- }
71
+ }
@@ -1,26 +1,35 @@
1
1
  .c-sidebar-right{
2
- // .pa;.lt(100%,0);
3
- .pf;.rt(0,@header-height + @bread-height);.z(400);
4
- bottom:0;
5
2
  .w(@aside-right);
6
- background-color:#fff;
7
- border-left:1px solid #eee;
8
- // height:100%;
9
3
  box-sizing: border-box;
4
+ padding: 10px;
5
+ .pf;
6
+ .z(600);
7
+ right: 0;
8
+ top: @header-height + @bread-height;
9
+ bottom: 0;
10
+ background-color: @bg-light;
11
+ border-left: 1px solid #eee;
12
+ }
10
13
 
14
+ .c-sidebar-right-inner {
15
+ .size(100%);
11
16
  overflow-y: auto;
17
+
12
18
  &::-webkit-scrollbar {
13
19
  width: 4px;
14
20
  }
21
+
15
22
  &::-webkit-scrollbar-track,
16
23
  &::-webkit-scrollbar-track-piece {
17
24
  background-color: #fafafa;
18
25
  border-radius: 6px;
19
26
  }
27
+
20
28
  &::-webkit-scrollbar-thumb {
21
29
  background-color: #eee;
22
30
  border-radius: 6px;
23
31
  }
32
+
24
33
  &::-webkit-scrollbar-button,
25
34
  &::-webkit-scrollbar-corner,
26
35
  &::-webkit-resizer {
@@ -81,6 +90,75 @@
81
90
  }
82
91
  }
83
92
 
93
+ // 折叠相关逻辑
94
+ .c-sidebar-right-toggle {
95
+ display: block;
96
+ .pa;
97
+ .lb(-21px, calc(50% - 20px));
98
+ width: 20px;
99
+ height: 40px;
100
+ line-height: 40px;
101
+ .pointer;
102
+ text-align: center;
103
+ background-color: @bg-light;
104
+ border-left: 1px solid #eee;
105
+ border-top: 1px solid #eee;
106
+ border-bottom: 1px solid #eee;
107
+ border-radius: 0px 2px 2px 0px;
108
+ font-size: 16px;
109
+ color: #999;
110
+
111
+ &:hover {
112
+ color: #222;
113
+ }
114
+
115
+ &.close-sidebar-right {
116
+ left: 0;
117
+ }
118
+
119
+ svg {
120
+ fill: @color;
121
+ }
122
+ }
123
+
124
+ .closeLeftSidebar() {
125
+ transition: 0.2s ease-in-out;
126
+ transform: translateX(100%);
127
+ }
128
+
129
+ .openLeftSidebar() {
130
+ transition: 0.2s ease-in-out;
131
+ transform: translateX(0);
132
+ }
133
+
134
+ .c-sidebar-right.is-close {
135
+ .closeLeftSidebar();
136
+
137
+ .c-sidebar-right-toggle {
138
+ transition: 0.2s ease-in-out;
139
+ transform: translateX(-100%);
140
+ }
141
+ }
142
+
143
+ .c-sidebar-right.is-open {
144
+ .openLeftSidebar();
145
+
146
+ .c-sidebar-right-toggle {
147
+ transition: 0.2s ease-in-out;
148
+ transform: translateX(0);
149
+ }
150
+ }
151
+
152
+ @media screen and (max-width: @ipad) {
153
+ .c-sidebar-right-toggle {
154
+ .none;
155
+ }
156
+
157
+ .c-sidebar-right.isopen {
158
+ box-shadow: 2px 0 3px rgba(0, 0, 0, 0.1);
159
+ }
160
+ }
161
+
84
162
  // 笔记本<1440 缩小双边栏
85
163
  // @media screen and (max-width:@notebook){
86
164
  // .c-sidebar-right{
@@ -88,7 +166,7 @@
88
166
  // }
89
167
  // }
90
168
 
91
- // // 平板横屏
169
+ // 平板横屏
92
170
  @media screen and (max-width:@smallpc){
93
171
  .c-sidebar-right{
94
172
  .ps;
@@ -99,4 +177,4 @@
99
177
 
100
178
  @media print{
101
179
  .c-sidebar-right{.none;}
102
- }
180
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jx3box/jx3box-common-ui",
3
- "version": "7.2.7",
3
+ "version": "7.3.0",
4
4
  "description": "JX3BOX UI",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -18,18 +18,8 @@
18
18
  @click="toggleLeftSide"
19
19
  :title="isOpen ? '收起侧边栏' : '打开侧边栏'"
20
20
  >
21
- <!-- <img
22
- v-show="isOpen"
23
- svg-inline
24
- src="../assets/img/leftsidebar/close.svg"
25
- /> -->
26
21
  <span v-show="isOpen"><i class="el-icon-arrow-left"></i></span>
27
22
  <span v-show="!isOpen"><i class="el-icon-arrow-right"></i></span>
28
- <!-- <img
29
- v-show="!isOpen"
30
- svg-inline
31
- src="../assets/img/leftsidebar/open.svg"
32
- /> -->
33
23
  </span>
34
24
  </aside>
35
25
  </template>
@@ -39,7 +29,6 @@ import Bus from "../service/bus";
39
29
  import { isApp } from "../assets/js/app.js";
40
30
  import { getDecoration } from "../service/cms";
41
31
  import { __imgPath } from "@jx3box/jx3box-common/data/jx3box.json";
42
- import User from "@jx3box/jx3box-common/js/user";
43
32
  const DECORATION_SIDEBAR = "decoration_sidebar";
44
33
  export default {
45
34
  name: "LeftSidebar",
package/src/Main.vue CHANGED
@@ -1,11 +1,11 @@
1
1
  <template>
2
2
  <main
3
3
  class="c-main"
4
- :class="{
5
- 'without-right': withoutRight,
6
- 'without-left': expanding,
7
- 'without-bread': withoutBread,
8
- }"
4
+ :class="[
5
+ withoutRight ? 'without-right' : expandingRight ? 'expanding-right' : '',
6
+ {'without-left': expanding},
7
+ {'without-bread': withoutBread},
8
+ ]"
9
9
  >
10
10
  <slot></slot>
11
11
  </main>
@@ -19,6 +19,7 @@ export default {
19
19
  data: function() {
20
20
  return {
21
21
  expanding: false,
22
+ expandingRight: false,
22
23
  };
23
24
  },
24
25
  computed: {
@@ -30,16 +31,24 @@ export default {
30
31
  withoutLeft: function(newval) {
31
32
  this.expanding = this.withoutLeft === undefined ? false : newval;
32
33
  },
34
+ withoutRight: function(newval) {
35
+ this.expandingRight = this.withoutRight === undefined ? false : newval;
36
+ },
33
37
  },
34
38
  methods: {},
35
39
  mounted: function() {
36
40
  Bus.$on("toggleLeftSide", (data) => {
37
41
  this.expanding = !data;
38
42
  });
43
+ Bus.$on("toggleRightSide", (data) => {
44
+ this.expandingRight = !data;
45
+ });
39
46
  },
40
47
  created: function() {
41
48
  this.expanding =
42
49
  this.withoutLeft === undefined ? false : !!this.withoutLeft;
50
+ this.expandingRight =
51
+ this.withoutRight === undefined ? false : !!this.withoutRight;
43
52
  },
44
53
  };
45
54
  </script>
@@ -1,10 +1,22 @@
1
1
  <template>
2
- <aside class="c-sidebar-right c-sidebar" v-if="!isApp">
3
- <slot></slot>
2
+ <aside class="c-sidebar-right c-sidebar" v-if="!isApp" :class="isOpen ? 'is-open' : 'is-close'">
3
+ <div class="c-sidebar-right-inner">
4
+ <slot></slot>
5
+ </div>
6
+ <span
7
+ class="c-sidebar-right-toggle"
8
+ :class="!isOpen && 'close-sidebar-right'"
9
+ @click="toggleRightSide"
10
+ :title="isOpen ? '收起侧边栏' : '打开侧边栏'"
11
+ >
12
+ <span v-show="!isOpen"><i class="el-icon-arrow-left"></i></span>
13
+ <span v-show="isOpen"><i class="el-icon-arrow-right"></i></span>
14
+ </span>
4
15
  </aside>
5
16
  </template>
6
17
 
7
18
  <script>
19
+ import Bus from "../service/bus";
8
20
  import { isApp } from "../assets/js/app.js";
9
21
  export default {
10
22
  name: "RightSidebar",
@@ -12,11 +24,28 @@ export default {
12
24
  data: function() {
13
25
  return {
14
26
  isApp: isApp(),
27
+ isOpen: true,
15
28
  };
16
29
  },
17
30
  computed: {},
18
- methods: {},
19
- mounted: function() {},
31
+ methods: {
32
+ toggleRightSide: function () {
33
+ Bus.$emit("toggleRightSide", !this.isOpen);
34
+ },
35
+ },
36
+ mounted: function() {
37
+ Bus.$on("toggleRightSide", (data) => {
38
+ this.isOpen = data;
39
+ });
40
+
41
+ if (window.innerWidth < 1024) {
42
+ this.isOpen = false;
43
+
44
+ document.addEventListener("click", function () {
45
+ Bus.$emit("toggleRightSide", false);
46
+ });
47
+ }
48
+ },
20
49
  };
21
50
  </script>
22
51
 
@@ -57,9 +57,12 @@ export default {
57
57
  },
58
58
  },
59
59
  watch : {
60
- postId : function (val){
61
- this.init();
62
- }
60
+ postId: {
61
+ handler: function (val) {
62
+ val && this.init();
63
+ },
64
+ immediate: true,
65
+ },
63
66
  }
64
67
  };
65
68
  </script>