efront 3.16.1 → 3.17.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.
@@ -142,6 +142,7 @@ function resize(elem, initialEvent) {
142
142
  }
143
143
  moveupon(window, handle);
144
144
 
145
+
145
146
  resize.on = function (elem, dragHandle) {
146
147
  if (elem) {
147
148
  elem.dragHandle = dragHandle;
@@ -150,6 +151,23 @@ resize.on = function (elem, dragHandle) {
150
151
  var off = onmousemove(window, getResizer);
151
152
  onremove(elem, off);
152
153
  });
154
+ var computed = getComputedStyle(elem);
155
+ var resizeh = function () {
156
+ var elem = this;
157
+ if (elem.scrollWidth > elem.clientWidth) {
158
+ css(elem, { width: elem.offsetWidth });
159
+ dispatch(elem, 'resize');
160
+ }
161
+ if (elem.scrollHeight > elem.clientHeight) {
162
+ css(elem, { height: elem.offsetHeight });
163
+ dispatch(elem, 'resize');
164
+ }
165
+ if (unbind && parseInt(computed.height) && parseInt(computed.width)) {
166
+ unbind();
167
+ unbind = null;
168
+ };
169
+ }
170
+ if (!parseInt(computed.height) || !parseInt(computed.width)) var unbind = bind('render')(elem, resizeh);
153
171
  if (!~resizingElements.indexOf(elem)) {
154
172
  resizingElements.push(elem);
155
173
  once('remove')(elem, function () {
@@ -2,7 +2,7 @@ var scrollbary = function () {
2
2
  var reshape = function (scrollHeight, offsetHeight) {
3
3
  var target = this.target;
4
4
  if (target) {
5
- this.style.height = target.offsetHeight + "px";
5
+ css(this, { height: target.offsetHeight });
6
6
  }
7
7
  var scrollbarHeight = this.offsetHeight;
8
8
  var ratio = offsetHeight / scrollHeight;
@@ -10,11 +10,14 @@ var scrollbary = function () {
10
10
  if (thumbHeight < 14) thumbHeight = 14;
11
11
  if (thumbHeight < 0) thumbHeight = 0;
12
12
  this.restHeight = scrollHeight - offsetHeight;
13
- this.thumb.style.height = thumbHeight + "px";
13
+ css(this.thumb, {
14
+ height: thumbHeight
15
+ });
14
16
  if (thumbHeight >= this.clientHeight) {
15
17
  this.style.opacity = 0;
16
18
  } else {
17
19
  this.style.opacity = 1;
20
+ this.autoshow();
18
21
  }
19
22
  };
20
23
  var getTop = function () {
@@ -59,7 +62,7 @@ var scrollbary = function () {
59
62
  deltaY = targetY - thumbTop;
60
63
  moving.y += deltaY;
61
64
  if (targetY !== thumbTop) {
62
- thumb.style.top = targetY + "px";
65
+ css(thumb, { top: targetY });
63
66
  dispatch(target, "change");
64
67
  }
65
68
  };
@@ -138,7 +141,7 @@ var scrollbary = function () {
138
141
  return { Height, height };
139
142
  };
140
143
 
141
- function bindTarget(_container) {
144
+ function bindTarget(_container, followResize = _container) {
142
145
  var _scrollbar = this;
143
146
  _container.with = _scrollbar;
144
147
  onappend(_container, _scrollbar.reshape);
@@ -146,24 +149,33 @@ var scrollbary = function () {
146
149
  on("scroll")(_container, function () {
147
150
  var top = getTargetTop(_container);
148
151
  _scrollbar.scrollTo(top);
152
+ _scrollbar.autoshow();
149
153
  });
150
154
  on("change")(_scrollbar, function () {
151
155
  var top = _scrollbar.Top();
152
156
  setTargetTop(_container, top);
153
157
  });
154
- _scrollbar.reshape();
158
+ if (followResize) on("resize")(followResize, _scrollbar.reshape);
155
159
  }
156
- function scrollbar() {
157
- var _scrollbar = div();
160
+ function scrollbar(elem) {
161
+ var _scrollbar = elem || document.createElement("scrollbar");
158
162
  _scrollbar.reshape = function () {
159
163
  var _container = _scrollbar.target;
160
164
  var { Height, height } = getTargetHeight(_container);
161
165
  reshape.call(_scrollbar, Height, height);
162
166
  };
163
167
  _scrollbar.scrollTo = scrollTo;
164
- var _handler = div();
168
+ var _handler = document.createElement("scrollbar-thumb");
165
169
  _handler.className = "thumb";
166
170
  _scrollbar.Top = getTop;
171
+ _scrollbar.autohide = lazy(function () {
172
+ this.thumb.style.opacity = 0;
173
+ }, 600);
174
+ _scrollbar.autoshow = function () {
175
+ this.autohide();
176
+ this.thumb.style.opacity = 1;
177
+ };
178
+
167
179
  moveupon(_handler, {
168
180
  start: mousedown,
169
181
  move: mousemove,
@@ -1,10 +1,31 @@
1
1
  & {
2
2
  position: absolute;
3
- width: 14px;
3
+ width: 6px;
4
4
  background-color: rgba(0, 0, 0, .1);
5
5
  border-radius: 7px;
6
6
  height: 100px;
7
+ border-left: 3px solid transparent;
8
+
9
+ &:hover {
10
+ >.thumb {
11
+ opacity: 1 !important;
12
+ overflow: visible;
13
+ }
14
+ }
15
+
7
16
  >.thumb {
17
+ &:after {
18
+ position: absolute;
19
+ top: 0;
20
+ bottom: 0;
21
+ left: -4px;
22
+ right: -4px;
23
+ width: auto;
24
+ display: block;
25
+ content: "";
26
+ }
27
+
28
+ transition: opacity .2s;
8
29
  position: absolute;
9
30
  border-radius: 7px;
10
31
  height: 100%;
@@ -84,7 +84,7 @@ function ybox(generator) {
84
84
  var stop = _box.stopY;
85
85
  var stop2 = lazy(function () {
86
86
  scrollY.smooth(stop);
87
- }, 310);
87
+ }, 60);
88
88
  var decrease = function () {
89
89
  var res = _decrease(increaser_t) + _decrease(increaser_b);
90
90
  if (!res) {
@@ -126,7 +126,12 @@ function ybox(generator) {
126
126
  // ie
127
127
  addClass(_box, "trident");
128
128
  } else {
129
+ var wheelTime = 0;
129
130
  onmousewheel(_box, function (event) {
131
+ if (event.timeStamp - wheelTime > 60 && Math.abs(event.deltaY) < 12) {
132
+ wheelTime = event.timeStamp;
133
+ return;
134
+ }
130
135
  var deltay = -event.deltaY;
131
136
  if (event.moveLocked) return;
132
137
  event.moveLocked = true;
@@ -137,7 +142,6 @@ function ybox(generator) {
137
142
  box = getTargetIn(e => e === _box || /^(?:auto|scroll)$/i.test(getComputedStyle(e).overflowY) && e.scrollHeight - e.scrollTop > e.clientHeight, event.target);
138
143
  }
139
144
  if (box === _box) {
140
- event.preventDefault();
141
145
  scrollY.call(_box, -deltay, false);
142
146
  stop2();
143
147
  }
@@ -169,7 +173,7 @@ function ybox(generator) {
169
173
  temp = temp.parentNode;
170
174
  }
171
175
  this.YScrollBoxId = +scrollId + 1;
172
- }
176
+ };
173
177
  if (isMounted(_box)) initScrollId.call(_box);
174
178
  on("append")(_box, initScrollId);
175
179
  on("remove")(_box, scrollY.reset);
@@ -145,7 +145,7 @@ function go(pagepath, args, history_name, oldpagepath) {
145
145
  history_name.activate = pagepath;
146
146
  history_name.activateNode = _page;
147
147
  }
148
- if (isString(pagepath)) {
148
+ else if (isString(pagepath)) {
149
149
  if (fullfill_is_dispatched > 0) return;
150
150
  fullfill_is_dispatched = 1;
151
151
  var event = createEvent("zimoli");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "efront",
3
- "version": "3.16.1",
3
+ "version": "3.17.1",
4
4
  "description": "一个开发工具,开放源代码,自带组件库和编译环境,可以用来开发web组件,web应用或nodejs模块,或做为已有代码的加密工具,也可以做为静态页面服务器或跨域中转服务器使用",
5
5
  "main": "public/efront.js",
6
6
  "directories": {