efront 2.46.0 → 2.47.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.
Files changed (39) hide show
  1. package/coms/basic/parseURL.js +2 -2
  2. package/coms/basic/parseURL_test.js +7 -0
  3. package/coms/basic/refilm_decode.js +32 -11
  4. package/coms/crypt/encode62.js +38 -29
  5. package/coms/crypt/encode62_test.js +2 -1
  6. package/coms/zimoli/action.js +1 -2
  7. package/coms/zimoli/autodragchildren.js +3 -3
  8. package/coms/zimoli/button.less +1 -2
  9. package/coms/zimoli/contextmenu.js +13 -8
  10. package/coms/zimoli/cross.js +3 -3
  11. package/coms/zimoli/data.js +19 -9
  12. package/coms/zimoli/dispatch.js +13 -6
  13. package/coms/zimoli/encode62.js +3 -2
  14. package/coms/zimoli/field.js +1 -1
  15. package/coms/zimoli/input.js +0 -6
  16. package/coms/zimoli/input.less +6 -6
  17. package/coms/zimoli/menuList.html +3 -2
  18. package/coms/zimoli/menuList.less +29 -25
  19. package/coms/zimoli/model.js +43 -6
  20. package/coms/zimoli/popup.js +15 -10
  21. package/coms/zimoli/prompt.js +40 -0
  22. package/coms/zimoli/render.js +23 -13
  23. package/coms/zimoli/rootElements.js +1 -0
  24. package/coms/zimoli/search.js +15 -0
  25. package/coms/zimoli/select.js +26 -12
  26. package/coms/zimoli/selectList.js +68 -8
  27. package/coms/zimoli/selectList.less +15 -2
  28. package/coms/zimoli/selectListEdit.html +15 -0
  29. package/coms/zimoli/selectListEdit.js +68 -0
  30. package/coms/zimoli/selectListEdit.less +21 -0
  31. package/coms/zimoli/swap.less +1 -1
  32. package/coms/zimoli/table.html +6 -4
  33. package/coms/zimoli/table.js +62 -10
  34. package/coms/zimoli/table.less +3 -1
  35. package/coms/zimoli/textarea.less +0 -1
  36. package/coms/zimoli/zimoli.js +34 -6
  37. package/debug.log +2 -0
  38. package/package.json +1 -1
  39. package/public/efront.js +1 -1
@@ -91,11 +91,11 @@ var adaptTarget = function (event) {
91
91
  }
92
92
  if (target) target = getFirstSingleColCell(this, target.colend);
93
93
  if (target) {
94
- if (position.right >= getSelection(this).right - 7) {
94
+ if (position.right >= getScreenPosition(this).right - 7) {
95
95
  target = this;
96
96
  return;
97
97
  }
98
- css(this, { 'cursor': 'e-resize' });
98
+ css(document.body, { 'cursor': 'col-resize' });
99
99
  result = {
100
100
  target,
101
101
  restX: event.clientX - target.offsetWidth
@@ -106,21 +106,70 @@ var adaptTarget = function (event) {
106
106
  }
107
107
  if (!result) {
108
108
  this.resizing = false;
109
- css(this, { 'cursor': 'default' });
109
+ css(document.body, { 'cursor': '' });
110
110
  }
111
111
  };
112
112
  var tdElementReg = /^t[hd]$/i;
113
113
  var trElementReg = /^tr$/i;
114
+ var id = 0;
115
+ function enrichField(f) {
116
+ if (!f.id) f.id = ++id;
117
+ if (f.width) return;
118
+ var width;
119
+ if (f.size) {
120
+ width = f.size;
121
+ if (width < 40) width = width * 16;
122
+ }
123
+ else switch (f.type) {
124
+ case "text":
125
+ width = 30;
126
+ break;
127
+ case "input":
128
+ width = 200;
129
+ break;
130
+ case "date":
131
+ width = 180;
132
+ case "datetime":
133
+ width = 200;
134
+ break;
135
+ case "time":
136
+ width = 120;
137
+ break;
138
+ default:
139
+ if (f.options) {
140
+ width = f.options.map(o => o.name instanceof Function ? o.name() : o.name).join(" ").length * 20;
141
+ } else {
142
+ width = String(f.name || f.key).length * 16;
143
+ }
144
+ }
145
+ if (width > 600) width = 600;
146
+ f.width = width + 60;
147
+ }
148
+
114
149
 
115
150
  function table(elem) {
116
151
  var tableElement = isElement(elem) ? elem : document.createElement("table");
117
152
  var activeCols = [];
118
- onmousemove(tableElement, adaptTarget);
153
+ var adaptCursor = adaptTarget.bind(tableElement);
154
+ var off;
155
+ tableElement.init = function () {
156
+ off = on("mousemove")(window, adaptCursor);
157
+ };
158
+ tableElement.dispose = tableElement.destroy = function () {
159
+ off();
160
+ };
161
+ on("append")(tableElement, tableElement.init);
162
+ on("remove")(tableElement, tableElement.destroy);
163
+ if (isMounted(tableElement)) tableElement.init();
164
+
119
165
  moveupon(tableElement, {
120
- start() { },
166
+ start(event) {
167
+ if (this.resizing) event.preventDefault();
168
+ },
121
169
  move: resizeTarget,
122
170
  });
123
171
  onmousemove(tableElement, function (event) {
172
+ if (!thead) [thead] = table.getElementsByTagName("thead");
124
173
  if (!getTargetIn(thead, event.target)) return;
125
174
  var tds = getTargetIn(cellMatchManager, event.target);
126
175
  if (!isArray(tds)) tds = [];
@@ -141,7 +190,7 @@ function table(elem) {
141
190
  removeClass(td, "y-ing");
142
191
  });
143
192
  });
144
- var table = tableElement.hasAttribute("ng-src") || tableElement.hasAttribute("src") ? list(tableElement) : tableElement;
193
+ var table = tableElement;
145
194
  var thead;
146
195
  var cellMatchManager = function (element) {
147
196
  if (!thead) [thead] = table.getElementsByTagName("thead");
@@ -159,20 +208,23 @@ function table(elem) {
159
208
  return thead;
160
209
  };
161
210
  care(table, function ([fields, data]) {
211
+ thead = null;
162
212
  this.innerHTML = template;
213
+ fields.forEach(enrichField);
163
214
  render(this, {
164
215
  fields,
165
216
  tbody: list,
166
217
  data,
218
+ model,
219
+ setWidth(target, f) {
220
+ css(target, { width: f.width });
221
+ },
167
222
  a: button,
168
223
  }, this.$parentScopes.concat(this.$scope));
169
224
  })
170
225
  autodragchildren(
171
226
  table,
172
- function (a) {
173
- console.log('match')
174
- return cellMatchManager.apply(this, arguments);
175
- },
227
+ cellMatchManager,
176
228
  function (src, dst, rel, append, parentNode) {
177
229
  if (table.src) {
178
230
  var [fields] = table.src;
@@ -1,4 +1,5 @@
1
1
  &[dragchildren] {
2
+
2
3
  >thead,
3
4
  >tbody,
4
5
  & {
@@ -74,8 +75,9 @@ table,
74
75
  line-height: 32px;
75
76
  height: 100%;
76
77
  min-height: 30px;
77
-
78
+ user-select: auto;
78
79
  display: table-row-group;
80
+ overflow: auto;
79
81
 
80
82
  >tr {
81
83
 
@@ -16,6 +16,5 @@
16
16
  model>& {
17
17
  width: 100% !important;
18
18
  display: block;
19
- margin: 10px 0;
20
19
  height: 120px;
21
20
  }
@@ -249,11 +249,33 @@ function prepare(pgpath, ok) {
249
249
  return _with_elements;
250
250
  };
251
251
  state.path = function (url) {
252
- if (isString(url) && /^[^\\\/]/.test(url)) {
252
+ if (/^\.+\//.test(url)) {
253
253
  url = pgpath.replace(/[^\/]*$/, url);
254
254
  }
255
+ if (isString(url) && /[\\\/\.]/.test(url)) {
256
+ url = url.replace(/^\.[\\\/]/, '');
257
+ var ps = url.split(/[\\\/]/);
258
+ var ds = [];
259
+ for (var p of ps) {
260
+ if (p === "..") {
261
+ ds.pop();
262
+ }
263
+ else if (p !== ".") {
264
+ ds.push(p);
265
+ }
266
+ }
267
+ url = "/" + ds.join('/').replace(/^\//, '');
268
+ }
255
269
  return url;
256
- }
270
+ };
271
+ state.popup = function (a) {
272
+ a = state.path(a);
273
+ return popup.apply(this, [a].concat([].slice.call(arguments, 1)));
274
+ };
275
+ state.init = function (a) {
276
+ a = state.path(a);
277
+ return init.apply(this, [a].concat([].slice.call(arguments, 1)));
278
+ };
257
279
  state.go = function (url, args, _history_name) {
258
280
  // if (arguments.length === 1 && isFinite(url)) return window_history.go(url | 0);
259
281
  var to = function (_url, args, _history_name) {
@@ -337,11 +359,17 @@ function prepare(pgpath, ok) {
337
359
  }, state);
338
360
  }
339
361
  function create(pagepath, args, from, needroles) {
340
- var page_object = isObject(pagepath) ? pagepath : page_generators[getpgpath(pagepath)];
341
- if (!page_object) {
342
- throw new Error(`调用create前请确保prepare执行完毕:${pagepath}`);
362
+ if (typeof pagepath === 'string') {
363
+ var page_object = isObject(pagepath) ? pagepath : page_generators[getpgpath(pagepath)];
364
+ if (!page_object) {
365
+ throw new Error(`调用create前请确保prepare执行完毕:${pagepath}`);
366
+ }
367
+ var { pg, "with": _with_elements, state, onback: _pageback_listener, roles } = page_object;
368
+ }
369
+ else if (isFunction(pagepath)) {
370
+ var pg = pagepath;
371
+ var { with: _with_elements, state = {}, onback: _pageback_listener, roles } = pg;
343
372
  }
344
- var { pg, "with": _with_elements, state, onback: _pageback_listener, roles } = page_object;
345
373
  if (!checkroles(user.roles, roles) || !checkroles(user.roles, needroles)) {
346
374
  // 检查权限
347
375
  if (!user.isLogin && user.loginPath) {
package/debug.log ADDED
@@ -0,0 +1,2 @@
1
+ [1106/041816.465:ERROR:registration_protocol_win.cc(102)] CreateFile: ϵͳ�Ҳ���ָ�����ļ��� (0x2)
2
+ [1114/175715.384:ERROR:registration_protocol_win.cc(102)] CreateFile: ϵͳ�Ҳ���ָ�����ļ��� (0x2)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "efront",
3
- "version": "2.46.0",
3
+ "version": "2.47.0",
4
4
  "description": "一个开发工具,开放源代码,自带组件库和编译环境,可以用来开发web组件,web应用或nodejs模块,或做为已有代码的加密工具,也可以做为静态页面服务器或跨域中转服务器使用",
5
5
  "main": "public/efront.js",
6
6
  "directories": {