efront 3.22.2 → 3.22.5

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.
@@ -7,12 +7,11 @@
7
7
 
8
8
  >th,
9
9
  >td {
10
- box-shadow: 1px 0 0 0 #00000033, -1px 0 0 0 #00000033;
10
+ &:not(.y-ing) {
11
+ box-shadow: 1px 0 0 0 #00000033, -1px 0 0 0 #00000033;
12
+ }
11
13
  }
12
14
 
13
- &:insert {
14
- background: #999;
15
- }
16
15
  }
17
16
  }
18
17
 
@@ -32,12 +31,22 @@ table,
32
31
  vertical-align: top;
33
32
  }
34
33
 
35
- & {
36
- outline: 1px solid #0006;
34
+
35
+ tr {
36
+ position: relative;
37
+ white-space: nowrap;
38
+ width: 100%;
37
39
  }
38
40
 
41
+ th,
42
+ td {
43
+ white-space: normal;
44
+ height: 100%;
45
+ padding: 2px 10px;
46
+ }
39
47
 
40
- .y-ing {
48
+ .y-ing,
49
+ .x-ing {
41
50
  &:before {
42
51
  content: "";
43
52
  position: absolute;
@@ -45,7 +54,7 @@ table,
45
54
  top: 0;
46
55
  bottom: 0;
47
56
  right: 0;
48
- background-color: rgba(0, 0, 0, .06);
57
+ background-color: rgba(0, 60, 69, .06);
49
58
  }
50
59
 
51
60
  >* {
@@ -53,28 +62,70 @@ table,
53
62
  }
54
63
  }
55
64
 
56
- @cell-padding: 0 10px;
57
65
 
58
66
  & {
59
67
  // text-align: center;
68
+ outline: 1px solid #0006;
69
+ max-width: 100%;
60
70
  border-collapse: collapse;
61
71
  table-layout: fixed;
62
72
  white-space: nowrap;
73
+ height: auto;
74
+ border-radius: 3px;
75
+ }
76
+
77
+ [row-index] {
78
+ user-select: none;
79
+ width: 56px;
80
+ padding-right: 10px;
81
+ text-align: right;
82
+ }
83
+
84
+ >tbody {
85
+ [row-index] {
86
+ background: #fff;
87
+ }
88
+ }
89
+
90
+ [fixed] {
91
+ z-index: 2;
92
+ border-left: 1px solid transparent;
93
+ border-right: 1px solid transparent;
94
+ }
95
+
96
+ >tfoot {
97
+ width: 100%;
98
+ display: block;
99
+ position: relative;
100
+ color: #bbb;
101
+
102
+ >tr {
103
+ width: 100%;
104
+ display: block;
105
+
106
+ >td {
107
+ display: block;
108
+ width: 100%;
109
+ }
110
+ }
63
111
 
112
+ pagination {
113
+ width: 100%;
114
+ }
64
115
  }
65
116
 
66
117
  >thead {
67
118
  user-select: none;
68
119
  line-height: 36px;
120
+ min-width: 100%;
69
121
 
70
122
  >tr {
71
123
 
72
124
  >td,
73
125
  >th {
74
- padding: @cell-padding;
75
126
  position: relative;
76
127
  color: #fff;
77
- background-color: #999;
128
+ background-color: #395268;
78
129
  }
79
130
  }
80
131
  }
@@ -83,40 +134,36 @@ table,
83
134
  line-height: 32px;
84
135
  height: 100%;
85
136
  min-height: 30px;
86
- border-top: 4px solid #6669;
87
-
88
-
89
-
90
137
  user-select: auto;
91
138
 
92
139
  >tr {
93
140
 
94
141
  >td,
95
142
  >th {
96
- padding: @cell-padding;
97
143
  position: relative;
98
144
  overflow: hidden;
99
145
  }
100
146
 
101
147
  &:nth-of-type(odd) {
102
- background-color: #eee;
103
- }
104
148
 
105
- &:nth-of-type(even) {
106
- background-color: #fff;
149
+ >td,
150
+ >th {
151
+ background-color: #fff;
152
+ }
107
153
  }
108
154
 
109
-
110
- &:hover {
155
+ &:nth-of-type(even) {
111
156
 
112
157
  >td,
113
- >th {
114
- background: #dddddd;
158
+ th {
159
+ background-color: #f8fbfd;
115
160
  }
116
161
  }
162
+
163
+
117
164
  }
118
165
 
119
- >tr[insert] {
166
+ >tr[thead] {
120
167
  position: sticky;
121
168
  top: 0;
122
169
  z-index: 1;
@@ -131,18 +178,13 @@ table,
131
178
  }
132
179
 
133
180
 
134
- tr {
181
+ [inline-block] {
135
182
 
136
183
  >th,
137
184
  >td {
138
- background: inherit;
139
-
140
- &[row-index] {
141
- user-select: none;
142
- // pointer-events: none;
143
- background: #fff;
144
- text-align: right;
145
- }
185
+ white-space: nowrap;
186
+ overflow: hidden;
187
+ display: inline-block;
146
188
  }
147
189
  }
148
190
 
@@ -0,0 +1,32 @@
1
+ <thead>
2
+ <tr>
3
+ <td colspan=2><span>1</span></td>
4
+ <td rowspan=2><span>th1</span></td>
5
+ <td>th3</td>
6
+ <td>th4</td>
7
+ </tr>
8
+ <tr>
9
+ <td>th3</td>
10
+ <td>th4</td>
11
+ </tr>
12
+ </thead>
13
+ <tbody>
14
+ <tr>
15
+ <td rowspan=2>td1</td>
16
+ <td>td2</td>
17
+ <td>td3</td>
18
+ <td>td4</td>
19
+ </tr>
20
+ <tr>
21
+ <td>td2</td>
22
+ <td>td3</td>
23
+ <td>td4</td>
24
+ </tr>
25
+ <tr>
26
+ <td rowspan=2>td1</td>
27
+ <td>td2</td>
28
+ </tr>
29
+ <tr>
30
+ <td>&nbsp;</td>
31
+ </tr>
32
+ </tbody>
@@ -1,12 +1,5 @@
1
1
  function table_test() {
2
- var data = new Array(100).fill(0).map(function () {
3
- return {
4
- name: random(random$name),
5
- tel: random(random$phone)
6
- };
7
- });
8
2
  var datatable = table();
9
- datatable.innerHTML = `<thead><tr><td colspan=2><span>1</span></td><td rowspan=2><span>th1</span></td><td>th3</td><td>th4</td></tr><tr><td>th3</td><td>th4</td></tr></thead><tbody><tr><td rowspan=2>td1</td><td>td2</td><td>td3</td><td>td4</td></tr><tr><td rowspan=2>td1</td><td>td2</td></tr></tbody>`;
10
- console.log(datatable);
3
+ datatable.innerHTML = template;
11
4
  return datatable;
12
5
  }
@@ -6,17 +6,21 @@ function ybox(generator) {
6
6
  } else {
7
7
  _box = createElement(div);
8
8
  }
9
- _box.height = function () {
9
+ var _tmp = isFunction(generator) && generator(_box);
10
+ if (isNode(_tmp)) _box = _tmp;
11
+ var _box_height = _box.$height || _box.height;
12
+ var _box_Height = _box.$Height || _box.Height;
13
+ var _box_Top = _box.$Top || _box.Top;
14
+ if (!isFunction(_box_height)) _box_height = function () {
10
15
  return _box.clientHeight;
11
16
  };
12
- isFunction(generator) && generator(_box);
13
17
  // totalHeight
14
- _box.Height = _box.Height || function () {
18
+ if (!isFunction(_box_Height)) _box_Height = function () {
15
19
  return _box.scrollHeight;
16
20
  };
17
21
  // currentTop
18
22
  var _scrolledTop = _box.scrollTop;
19
- _box.Top = _box.Top || function (top) {
23
+ if (!isFunction(_box_Top)) _box_Top = function (top) {
20
24
  if (isNumber(top)) {
21
25
  if (_box.scrollTop !== top) {
22
26
  _box.scrollTop = top;
@@ -25,17 +29,20 @@ function ybox(generator) {
25
29
  }
26
30
  return _box.scrollTop;
27
31
  };
28
- _box.scrollY = function (deltay, useIncrease = true) {
29
- var _Top = _box.Top();
32
+ if (_box.$Height !== _box_Height) _box.$Height = _box_Height;
33
+ if (_box.$height !== _box_height) _box.$height = _box_height;
34
+ if (_box.$Top !== _box_Top) _box.$Top = _box_Top;
35
+ _box.$scrollY = function (deltay, useIncrease = _box.useIncrease !== false) {
36
+ var _Top = _box.$Top();
30
37
  var top = _Top + deltay;
31
- var height = _box.height();
32
- var scrollHeight = _box.Height();
38
+ var height = _box.$height();
39
+ var scrollHeight = _box.$Height();
33
40
  var r = true;
34
41
  if (top < 0) {
35
42
  if (useIncrease && _Top <= 0) {
36
43
  r = increase(top);
37
44
  }
38
- _box.Top(0);
45
+ _box.$Top(0);
39
46
  } else if (top + height >= scrollHeight) {
40
47
  if (top + height - scrollHeight > increase_height) {
41
48
  top = increase_height + scrollHeight - height;
@@ -43,9 +50,9 @@ function ybox(generator) {
43
50
  if (useIncrease && top + height >= scrollHeight) {
44
51
  r = increase(top + height - scrollHeight);
45
52
  }
46
- _box.Top(top);
53
+ _box.$Top(top);
47
54
  } else {
48
- r = top !== _box.Top(top);
55
+ r = top !== _box.$Top(top);
49
56
  increase(deltay, true);
50
57
  }
51
58
  return r;
@@ -57,14 +64,14 @@ function ybox(generator) {
57
64
  var _decrease = function (increaser) {
58
65
  var height = parseInt(increaser.height);
59
66
  if (height > 1) {
60
- var scrollTop = _box.Top();
67
+ var scrollTop = _box.$Top();
61
68
  if (scrollTop > 0 && increaser_t === increaser) {
62
69
  var deltaY = scrollTop > height ? height : scrollTop;
63
70
  height -= deltaY;
64
- _box.Top(scrollTop - deltaY);
71
+ _box.$Top(scrollTop - deltaY);
65
72
  }
66
- var tH = _box.Height();
67
- var bH = _box.height();
73
+ var tH = _box.$Height();
74
+ var bH = _box.$height();
68
75
  if (scrollTop + bH < tH && increaser_b === increaser) {
69
76
  var deltaY = tH - bH - scrollTop > height ? height : tH - bH - scrollTop;
70
77
  height -= deltaY;
@@ -81,7 +88,7 @@ function ybox(generator) {
81
88
  remove(increaser);
82
89
  return 0;
83
90
  };
84
- var stop = _box.stopY;
91
+ var stop = _box.$stopY || _box.stopY;
85
92
  var stop2 = lazy(function () {
86
93
  scrollY.smooth(stop);
87
94
  }, 40);
@@ -128,6 +135,7 @@ function ybox(generator) {
128
135
  } else {
129
136
  var wheelTime = 0;
130
137
  onmousewheel(_box, function (event) {
138
+ event.preventDefault();
131
139
  if (event.timeStamp - wheelTime > 40 && Math.abs(event.deltaY) < 12) {
132
140
  wheelTime = event.timeStamp;
133
141
  return;
@@ -151,7 +159,7 @@ function ybox(generator) {
151
159
  scrollY.reset();
152
160
  },
153
161
  move(scrolled) {
154
- var y = -this.Top();
162
+ var y = -_box.$Top();
155
163
  if (scrolled) {
156
164
  var { deltay } = scrolled;
157
165
  scrollY.call(this, -deltay);
@@ -1,22 +1,22 @@
1
1
  var scroll = function () {
2
2
  var scrollY = function (deltay, useIncrease) {
3
3
  deltay = scrollOutside.call(this, deltay);
4
- if (isFunction(this.scrollY)) return this.scrollY(deltay, useIncrease);
4
+ if (isFunction(this.$scrollY)) return this.$scrollY(deltay, useIncrease);
5
5
  var scrollTop = this.scrollTop;
6
6
  this.scrollTop += deltay;
7
7
  if (this.scrollTop === scrollTop) return false;
8
8
  };
9
9
 
10
10
  var Height = function () {
11
- if (isFunction(this.Height)) return this.Height();
11
+ if (isFunction(this.$Height)) return this.$Height();
12
12
  return this.scrollHeight;
13
13
  };
14
14
  var Top = function () {
15
- if (isFunction(this.Top)) return this.Top();
15
+ if (isFunction(this.$Top)) return this.$Top();
16
16
  return this.scrollTop;
17
17
  };
18
18
  var height = function () {
19
- if (isFunction(this.height)) return this.height();
19
+ if (isFunction(this.height)) return this.$height();
20
20
  return this.clientHeight;
21
21
  };
22
22
  var { max, min } = Math;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "efront",
3
- "version": "3.22.2",
3
+ "version": "3.22.5",
4
4
  "description": "一个开发工具,开放源代码,自带组件库和编译环境,可以用来开发web组件,web应用或nodejs模块,或做为已有代码的加密工具,也可以做为静态页面服务器或跨域中转服务器使用",
5
5
  "main": "public/efront.js",
6
6
  "directories": {