efront 4.3.3 → 4.3.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.
@@ -547,9 +547,9 @@ var grid_prototype = {
547
547
  } else {
548
548
  var _div = point.target;
549
549
  if (!_div) {
550
- point.target = _div = document.createElement('cell');
550
+ // point.target = _div = document.createElement('cell');
551
551
  }
552
- if (_div.parentNode !== grid) appendChild(grid, _div);
552
+ if (_div && _div.parentNode !== grid) appendChild(grid, _div);
553
553
  var current_value;
554
554
  if (current_d === "x") {
555
555
  if (next_point) {
@@ -563,15 +563,17 @@ var grid_prototype = {
563
563
  point.top = current_t;
564
564
  point.bottom = current_b;
565
565
  if (point.origin !== point.value || current_t && current_t.origin !== current_t.value) {
566
- if (getComputedStyle(_div).position === 'absolute') {
567
- css(_div, {
568
- left: point.value / grid.width * 100 + "%",
569
- top: current_t ? current_t.value / grid.height * 100 + "%" : 0,
570
- width: current_value / grid.width * 100 + "%",
571
- height: (current_h / grid.height || 0) * 100 + "%"
572
- });
573
- } else {
574
- setRelativeDiv(_div, current_value, current_h, point.value, current_t ? current_t.value : 0);
566
+ if (_div) {
567
+ if (getComputedStyle(_div).position === 'absolute') {
568
+ css(_div, {
569
+ left: point.value / grid.width * 100 + "%",
570
+ top: current_t ? current_t.value / grid.height * 100 + "%" : 0,
571
+ width: current_value / grid.width * 100 + "%",
572
+ height: (current_h / grid.height || 0) * 100 + "%"
573
+ });
574
+ } else {
575
+ setRelativeDiv(_div, current_value, current_h, point.value, current_t ? current_t.value : 0);
576
+ }
575
577
  }
576
578
  point.width = current_value / grid.width;
577
579
  point.height = current_h / grid.height;
@@ -588,15 +590,17 @@ var grid_prototype = {
588
590
  point.left = current_l;
589
591
  point.right = current_r;
590
592
  if (point.origin !== point.value || current_l && current_l.origin !== current_l.value) {
591
- if (getComputedStyle(_div).position === 'absolute') {
592
- css(_div, {
593
- left: current_l ? current_l.value / grid.width * 100 + "%" : 0,
594
- top: point.value / grid.height * 100 + "%",
595
- width: (current_w / grid.width || 0) * 100 + "%",
596
- height: current_value / grid.height * 100 + "%"
597
- });
598
- } else {
599
- setRelativeDiv(_div, current_w, current_value, current_l ? current_l.value : 0, point.value);
593
+ if (_div) {
594
+ if (getComputedStyle(_div).position === 'absolute') {
595
+ css(_div, {
596
+ left: current_l ? current_l.value / grid.width * 100 + "%" : 0,
597
+ top: point.value / grid.height * 100 + "%",
598
+ width: (current_w / grid.width || 0) * 100 + "%",
599
+ height: current_value / grid.height * 100 + "%"
600
+ });
601
+ } else {
602
+ setRelativeDiv(_div, current_w, current_value, current_l ? current_l.value : 0, point.value);
603
+ }
600
604
  }
601
605
  point.width = current_w / grid.width;
602
606
  point.height = current_value / grid.height;
@@ -733,7 +737,14 @@ var createBoundsFromComputed = function (grid) {
733
737
  };
734
738
  var createPointsWithChildren = function () {
735
739
  var grid = this;
736
- if (!grid.children.length) return;
740
+ var children = [];
741
+ for (var c of grid.children) {
742
+ var s = getComputedStyle(c);
743
+ if (s.display === 'none' || /^(fixed|absolute)$/i.test(s.position)) continue;
744
+ children.push(c);
745
+ }
746
+ if (children.length < 2 || grid.adapted) return;
747
+ grid.adapted = true;
737
748
  var getRange = function (e) {
738
749
  var range = [0, 0, Infinity, Infinity];
739
750
  var computed = getComputedStyle(e);
@@ -747,7 +758,7 @@ var createPointsWithChildren = function () {
747
758
  range[3] = Math.floor(range[3]);
748
759
  return range;
749
760
  };
750
- var elements = Array.apply(null, grid.children).map(a => [a,
761
+ var elements = children.map(a => [a,
751
762
  +Math.max(0, a.offsetLeft * grid.width / grid.clientWidth).toFixed(0),
752
763
  +(Math.min(a.offsetLeft + a.offsetWidth, grid.clientWidth) * grid.width / grid.clientWidth).toFixed(0),
753
764
  +Math.max(0, a.offsetTop * grid.height / grid.clientHeight).toFixed(0),
@@ -764,6 +775,7 @@ var createPointsWithChildren = function () {
764
775
  function main(elem) {
765
776
  if (isElement(elem)) {
766
777
  elem = grid.call(elem);
778
+ elem.adapt = createPointsWithChildren;
767
779
  care(elem, elem.setData);
768
780
  care(elem, elem.reshape);
769
781
  } else {
@@ -154,7 +154,12 @@ body:active & {
154
154
  padding-bottom: 6px;
155
155
  line-height: 20px;
156
156
  font-size: 14px;
157
-
157
+ border-radius: 0;
158
+ /*
159
+ 狗物业弄了电子门禁还嫌不够,连人行道也弄个一人一杆。
160
+ 住在这里就像住在监狱,随时都可能被限制人身自由。
161
+ 狗日的共产党还和狗物业尿到一个壶里。
162
+ */
158
163
  >b {
159
164
  font-weight: normal;
160
165
  }
@@ -182,7 +182,8 @@ var readonly_types = {
182
182
  if (field.options) {
183
183
  if (!field.optionsMap) field.optionsMap = createOptionsMap(field.options);
184
184
  var o = field.optionsMap[v];
185
- if (o) return o.name;
185
+ if (isObject(o)) return o.name;
186
+ if (isHandled(o)) return o;
186
187
  }
187
188
  if (isEmpty(v)) v = '';
188
189
  return v;
@@ -190,13 +191,15 @@ var readonly_types = {
190
191
  };
191
192
  readonly_types.anchor = readonly_types.url;
192
193
  var createOptionsMap = function (options) {
194
+ if (!isObject(options[0])) return options;
193
195
  var map = Object.create(null);
194
196
  for (var o of options) {
195
- map[o.key] = o;
197
+ if (isHandled(o.key)) map[o.key] = o;
198
+ else if (isHandled(o.value)) map[o.value] = o;
196
199
  }
197
200
  return map;
198
201
  }
199
- readonly_types.select = readonly_types.swap;
202
+ readonly_types.radio = readonly_types.select = readonly_types.swap;
200
203
  var findReaderForElement = function (type, e) {
201
204
  var editor = render.getFromScopes(type, e.$scope, e.$parentScopes);
202
205
  if (isFunction(editor) && (editor.isreader || !editor.isediter) && editor.isreader !== false) return editor;
package/coms/zimoli/on.js CHANGED
@@ -498,6 +498,16 @@ var invoke = function (event, type, pointerType) {
498
498
  touchendFired = true;
499
499
  invoke(event, 'click');
500
500
  }, true);
501
+ var lasttime_dblclick = true;
502
+ window.addEventListener("dblclick", function (event) {
503
+ var saved_time = lasttime_dblclick;
504
+ lasttime_dblclick = event.timeStamp;
505
+ if (lasttime_dblclick - saved_time < 300) {
506
+ event.preventDefault();
507
+ event.stopPropagation();
508
+ return;
509
+ }
510
+ }, true);
501
511
  window.addEventListener("click", function (event) {
502
512
  if (!isClickWithPointer) return;
503
513
  var need = needFireClick;
@@ -511,6 +521,9 @@ var invoke = function (event, type, pointerType) {
511
521
  event.stopPropagation();
512
522
  return;
513
523
  }
524
+ if (lasttime_click - saved_time < 300) {
525
+ invoke(event, 'dblclick');
526
+ }
514
527
  }, true);
515
528
  }
516
529
 
package/docs/main.xht CHANGED
@@ -42,11 +42,14 @@
42
42
  content: "样";
43
43
  }
44
44
 
45
- :root>menu {
45
+ :root>menu[inline] {
46
+ height: 100%;
47
+ }
48
+
49
+ :root>menu[inline] {
46
50
  margin: 0;
47
51
  width: var(--leftwidth);
48
52
  margin-left: -var(--leftwidth);
49
- height: 100%;
50
53
  display: inline-block;
51
54
  min-width: 200px;
52
55
  max-width: 600px;
@@ -84,11 +87,80 @@
84
87
  color: #79a;
85
88
  margin-left: 12px;
86
89
  }
90
+
91
+ open {
92
+ display: none;
93
+ }
94
+
95
+ @media screen and (max-width:599px) {
96
+ form {
97
+ width: 100% !important;
98
+ height: 100% !important;
99
+ z-index: 0 !important;
100
+ }
101
+
102
+ :root>open:after {
103
+ content: "≡";
104
+ }
105
+
106
+ :root>open {
107
+
108
+ display: block;
109
+ position: absolute;
110
+ height: 42px;
111
+ width: 42px;
112
+ line-height: 42px;
113
+ text-align: center;
114
+ color: #fff;
115
+ background: #1e282c;
116
+ font-family: 'Times New Roman', Times, serif;
117
+ font-size: 26px;
118
+ z-index: 2147483647 !important;
119
+ right: 20px;
120
+ bottom: 20px;
121
+ border-radius: 50%;
122
+ }
123
+
124
+ :root>menu {
125
+
126
+ position: absolute;
127
+ z-index: -1;
128
+
129
+ &[open] {
130
+ left: 0 !important;
131
+ right: 0 !important;
132
+ top: 0 !important;
133
+ bottom: 0 !important;
134
+ width: 100% !important;
135
+ height: 100% !important;
136
+ margin: 0 !important;
137
+ z-index: 3;
138
+
139
+ ~open {
140
+ background-color: #fff;
141
+ color: #1e282c;
142
+
143
+ &:after {
144
+ content: "⨉";
145
+ vertical-align: top;
146
+ font-size: 18px;
147
+ }
148
+ }
149
+ }
150
+
151
+ }
152
+
153
+ :root {
154
+ padding: 0px !important;
155
+ }
156
+ }
87
157
  </style>
88
- <menu #mulu inline -src="m in menus" @active="openMenu(m)">
158
+
159
+ <menu #mulu open@="menued" inline -src="m in menus" @active="openMenu(m)">
89
160
  <div2></div2>
90
161
  </menu>
91
162
  <div1 #content></div1>
163
+ <open #switch @click="switchMenu()" insert></open>
92
164
  <script>
93
165
  var menus = [
94
166
  {
@@ -130,12 +202,12 @@
130
202
  }
131
203
  }
132
204
  ]);
133
- })
205
+ });
134
206
  var initVersionInfo = async function () {
135
207
  var xhr = await cross("get", "version");
136
208
  var version = xhr.response.split(",");
137
209
  menus[0].name += ` <v>${version[0]}</v>`;
138
- }
210
+ };
139
211
  var initCommandsDocs = async function () {
140
212
  var helps = await init("docs$helps");
141
213
  var m = {
@@ -204,7 +276,7 @@
204
276
  scope.menus = route.update(menus);
205
277
  zimoli();
206
278
  render.refresh();
207
- }
279
+ };
208
280
  var scope = {
209
281
  menus,
210
282
  div2(elem, scope) {
@@ -214,11 +286,17 @@
214
286
  },
215
287
  grid,
216
288
  menu,
289
+ menued: false,
290
+ switchMenu() {
291
+ scope.menued = !scope.menued;
292
+ },
217
293
  openMenu(m) {
218
294
  this.menus.open(m);
295
+ if (!m.children) this.menued = false;
219
296
  }
220
297
  };
221
298
  var page = document.createElement('grid');
299
+ page.adapted = screen.width < 720 && -1;
222
300
  page.innerHTML = template;
223
301
  if (window.require) {
224
302
  var title = document.createElement('titlebar');
@@ -239,11 +317,23 @@
239
317
  on("mounted")(page, initMenus);
240
318
  s.bindTarget(scope.content);
241
319
  page.with = s;
320
+ resizingList.set(page, function () {
321
+ if (page.adapted === true) return;
322
+ if (calcPixel(page.offsetWidth) < 720) return;
323
+ page.adapted = false;
324
+ page.adapt();
325
+ });
242
326
  bind("render")(page, function () {
243
327
  requestAnimationFrame(function () {
244
328
  s.reshape();
245
329
  })
246
330
  });
331
+ drag.on(scope.switch);
332
+ css(scope.switch, data.getInstance('switch-position'));
333
+ on('dragend')(scope.switch, function () {
334
+ var s = this.style;
335
+ data.setInstance('switch-position', { left: s.left, top: s.top, marginLeft: s.marginLeft, marginTop: s.marginTop }, true);
336
+ })
247
337
  function main() {
248
338
  return page;
249
339
  }
package/docs/mark.xht CHANGED
@@ -1,18 +1,19 @@
1
1
  <style>
2
- :scope {
3
- line-height: 1.8;
4
- display: block;
5
- font-family: Times, "宋体", sans-serif;
6
-
7
- @media screen and (max-width:830px) {
2
+ @media screen and (max-width: 830px) {
3
+ :scope {
8
4
  padding: 20px 40px;
9
5
  }
6
+ }
10
7
 
11
- @media screen and (min-width:1160px) {
8
+ @media screen and (min-width: 1160px) {
9
+ :scope {
12
10
  margin: 20px auto;
13
11
  }
12
+ }
13
+
14
+ @media screen and (min-width: 830px) {
15
+ :scope {
14
16
 
15
- @media screen and (min-width:830px) {
16
17
  max-width: 890px;
17
18
  border: 1px solid #000;
18
19
  padding: 60px 80px;
@@ -20,6 +21,12 @@
20
21
  }
21
22
  }
22
23
 
24
+ :scope {
25
+ line-height: 1.8;
26
+ display: block;
27
+ font-family: Times, "宋体", sans-serif;
28
+ }
29
+
23
30
  code {
24
31
  width: 100%;
25
32
  }
@@ -89,7 +89,7 @@
89
89
  fields: [
90
90
  { name: i18n`提示`, readonly: true, key: 'apply_info', type: 'text' },
91
91
  { name: i18n`appid及密钥申请地址`, readonly: true, key: 'apply_url', type: 'anchor' },
92
- { name: i18n`appid`, key: 'appid', type: 'input' },
92
+ { name: `appid`, key: 'appid', type: 'input' },
93
93
  { name: i18n`密钥`, key: 'sign', type: "input" },
94
94
  { name: i18n`目标语言`, type: 'checkbox', options: supports }
95
95
  ], data: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "efront",
3
- "version": "4.3.3",
3
+ "version": "4.3.5",
4
4
  "description": "简化前端开发,优化web性能",
5
5
  "main": "public/efront.js",
6
6
  "directories": {