efront 3.3.8 → 3.4.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.
- package/apps/pivot/api.yml +3 -0
- package/apps/pivot/auth/login.html +9 -0
- package/apps/pivot/auth/login.js +29 -0
- package/apps/pivot/auth/login.less +11 -0
- package/apps/pivot/home/main.html +13 -0
- package/apps/pivot/home/main.js +22 -0
- package/apps/pivot/home/main.less +8 -0
- package/apps/pivot/index.html +41 -0
- package/apps/pivot/main.js +13 -0
- package/coms/basic/refilm_decode.js +13 -2
- package/coms/basic/valid.js +10 -0
- package/coms/compile/common.js +12 -0
- package/coms/crypt/encode62.js +23 -33
- package/coms/crypt/encode62_test.js +2 -1
- package/coms/zimoli/alert.js +8 -4
- package/coms/zimoli/cross.js +1 -1
- package/coms/zimoli/css.js +1 -0
- package/coms/zimoli/data.js +8 -3
- package/coms/zimoli/encode62.js +13 -0
- package/coms/zimoli/field.html +2 -0
- package/coms/zimoli/field.js +41 -17
- package/coms/zimoli/field.less +19 -0
- package/coms/zimoli/form.js +8 -0
- package/coms/zimoli/model.js +1 -0
- package/coms/zimoli/render.js +34 -63
- package/coms/zimoli/renderDefaults.js +1 -0
- package/coms/zimoli/submit.js +41 -0
- package/coms/zimoli/view.js +0 -5
- package/coms/zimoli/view.less +17 -11
- package/package.json +1 -1
- package/public/efront.js +1 -1
- package/coms/zimoli/beian.html +0 -1
- package/coms/zimoli/beian.js +0 -5
- package/coms/zimoli/beian.less +0 -13
package/coms/zimoli/render.js
CHANGED
|
@@ -71,7 +71,7 @@ var createGetter = function (search, isprop = true) {
|
|
|
71
71
|
});
|
|
72
72
|
}
|
|
73
73
|
if (isprop) {
|
|
74
|
-
return new Function('event',
|
|
74
|
+
return new Function('event', `${withContext}with(this.$scope){${ret}${searchContext}}`);
|
|
75
75
|
}
|
|
76
76
|
return new Function("event", `${withContext}with(this.$scope){${/([\=\(\+\-])/.test(searchContext) ? ret + searchContext : `${ret}${searchContext}.call(this.$scope,event)`}}`);
|
|
77
77
|
};
|
|
@@ -346,13 +346,42 @@ var structures = {
|
|
|
346
346
|
};
|
|
347
347
|
structures["else-if"] = structures.elseif = structures.else;
|
|
348
348
|
structures["for-each"] = structures.foreach = structures.for = structures.each = structures.repeat;
|
|
349
|
-
var
|
|
350
|
-
|
|
351
|
-
|
|
349
|
+
var createBinder = function (binder) {
|
|
350
|
+
return function (search) {
|
|
351
|
+
var getter = createGetter(search).bind(this);
|
|
352
|
+
var oldValue;
|
|
353
|
+
this.renders.push(function () {
|
|
354
|
+
var value = getter();
|
|
355
|
+
if (deepEqual.shallow(value, oldValue)) return;
|
|
356
|
+
oldValue = value;
|
|
357
|
+
if (isNode(value) || isArray(value)) {
|
|
358
|
+
if (value !== this.firstChild) {
|
|
359
|
+
remove(this.childNodes);
|
|
360
|
+
appendChild(this, value);
|
|
361
|
+
}
|
|
362
|
+
} else {
|
|
363
|
+
if (isEmpty(value)) value = '';
|
|
364
|
+
if (binder(this) !== value) binder(this, value);
|
|
365
|
+
}
|
|
366
|
+
});
|
|
367
|
+
|
|
368
|
+
}
|
|
369
|
+
}
|
|
352
370
|
var directives = {
|
|
371
|
+
bind: createBinder(text),
|
|
372
|
+
html: createBinder(html),
|
|
373
|
+
hide: createBinder(function (elem, value) {
|
|
374
|
+
if (arguments.length === 1) return elem.style.display === 'none';
|
|
375
|
+
elem.style.display = value ? 'none' : '';
|
|
376
|
+
}),
|
|
377
|
+
show: createBinder(function (elem, value) {
|
|
378
|
+
if (arguments.length === 1) return elem.style.display !== 'none';
|
|
379
|
+
elem.style.display = value ? '' : 'none';
|
|
380
|
+
}),
|
|
381
|
+
style: createBinder(css),
|
|
353
382
|
src(search) {
|
|
354
383
|
var getter = createGetter(search).bind(this);
|
|
355
|
-
var savedValue,
|
|
384
|
+
var savedValue, pending;
|
|
356
385
|
var refresh = function () {
|
|
357
386
|
that.src = savedValue;
|
|
358
387
|
removeClass(that, "pending");
|
|
@@ -372,10 +401,8 @@ var directives = {
|
|
|
372
401
|
}
|
|
373
402
|
var changes = getChanges(temp, savedValue);
|
|
374
403
|
if (!changes) return;
|
|
375
|
-
savedOrigin = origin;
|
|
376
404
|
savedValue = temp;
|
|
377
405
|
if (/^img$/i.test(this.tagName)) {
|
|
378
|
-
// this.setAttribute("src", "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=");
|
|
379
406
|
if (!isString(origin)) {
|
|
380
407
|
return;
|
|
381
408
|
}
|
|
@@ -394,23 +421,6 @@ var directives = {
|
|
|
394
421
|
}
|
|
395
422
|
});
|
|
396
423
|
},
|
|
397
|
-
bind(search) {
|
|
398
|
-
var getter = createGetter(search).bind(this);
|
|
399
|
-
var oldValue;
|
|
400
|
-
this.renders.push(function () {
|
|
401
|
-
var value = getter();
|
|
402
|
-
if (deepEqual(value, oldValue)) return;
|
|
403
|
-
oldValue = value;
|
|
404
|
-
if (isNode(value) || isArray(value)) {
|
|
405
|
-
if (value !== this.firstChild) {
|
|
406
|
-
remove(this.childNodes);
|
|
407
|
-
appendChild(this, value);
|
|
408
|
-
}
|
|
409
|
-
} else {
|
|
410
|
-
if (text(this) !== value) text(this, value);
|
|
411
|
-
}
|
|
412
|
-
});
|
|
413
|
-
},
|
|
414
424
|
model(search) {
|
|
415
425
|
var getter = createGetter(search).bind(this);
|
|
416
426
|
var oldValue;
|
|
@@ -462,35 +472,6 @@ var directives = {
|
|
|
462
472
|
}
|
|
463
473
|
var onchange = change;
|
|
464
474
|
eventsHandlers.map(on => on(this, onchange));
|
|
465
|
-
eventsHandlers.map(on => on(this, changed));
|
|
466
|
-
},
|
|
467
|
-
hide(search) {
|
|
468
|
-
var getter = createGetter(search).bind(this);
|
|
469
|
-
var oldValue;
|
|
470
|
-
this.renders.push(function () {
|
|
471
|
-
var value = !!getter();
|
|
472
|
-
if (deepEqual(oldValue, value)) return;
|
|
473
|
-
oldValue = value;
|
|
474
|
-
if (value) {
|
|
475
|
-
this.style.display = "none";
|
|
476
|
-
} else {
|
|
477
|
-
this.style.display = "";
|
|
478
|
-
}
|
|
479
|
-
});
|
|
480
|
-
},
|
|
481
|
-
show(search) {
|
|
482
|
-
var getter = createGetter(search).bind(this);
|
|
483
|
-
var oldValue;
|
|
484
|
-
this.renders.push(function () {
|
|
485
|
-
var value = !!getter();
|
|
486
|
-
if (deepEqual(oldValue, value)) return;
|
|
487
|
-
oldValue = value;
|
|
488
|
-
if (value) {
|
|
489
|
-
this.style.display = "";
|
|
490
|
-
} else {
|
|
491
|
-
this.style.display = "none";
|
|
492
|
-
}
|
|
493
|
-
});
|
|
494
475
|
},
|
|
495
476
|
|
|
496
477
|
"class"(search) {
|
|
@@ -528,16 +509,6 @@ var directives = {
|
|
|
528
509
|
}
|
|
529
510
|
});
|
|
530
511
|
},
|
|
531
|
-
style(search) {
|
|
532
|
-
var getter = createGetter(search).bind(this);
|
|
533
|
-
var oldValue;
|
|
534
|
-
this.renders.push(function () {
|
|
535
|
-
var stylesheet = getter();
|
|
536
|
-
if (deepEqual(oldValue, stylesheet)) return;
|
|
537
|
-
oldValue = stylesheet;
|
|
538
|
-
css(this, stylesheet);
|
|
539
|
-
});
|
|
540
|
-
}
|
|
541
512
|
};
|
|
542
513
|
// property binder
|
|
543
514
|
var binders = {
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
function submit(fields, data) {
|
|
2
|
+
var params = {};
|
|
3
|
+
var inputs = [];
|
|
4
|
+
var select = [];
|
|
5
|
+
var checks = [];
|
|
6
|
+
var id = 0;
|
|
7
|
+
for (var f of fields) {
|
|
8
|
+
var error = valid(f, data);
|
|
9
|
+
if (error === "empty") {
|
|
10
|
+
if (f.options || /date|time|range|switch|swap|radio/i.test(f.type)) {
|
|
11
|
+
if (!select.id) select.id = ++id;
|
|
12
|
+
select.push(f);
|
|
13
|
+
}
|
|
14
|
+
else {
|
|
15
|
+
if (!inputs.id) inputs.id = ++id;
|
|
16
|
+
inputs.push(f);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
else if (error) {
|
|
20
|
+
checks.push(f);
|
|
21
|
+
}
|
|
22
|
+
else {
|
|
23
|
+
params[f.key] = data[f.key];
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
if (checks.length + select.length + inputs.length) {
|
|
27
|
+
var errors = [];
|
|
28
|
+
if (inputs.length) errors.push("请输入" + inputs.map(f => f.name).join("、"));
|
|
29
|
+
if (select.length) errors.push("请选择" + select.map(f => f.name).join("、"));
|
|
30
|
+
if (select.id < inputs.id) {
|
|
31
|
+
errors = errors.reverse();
|
|
32
|
+
}
|
|
33
|
+
if (checks.length) {
|
|
34
|
+
errors.push(checks.map(f => f.name).join("、") + "格式错误");
|
|
35
|
+
}
|
|
36
|
+
errors = errors.join(",") + "!";
|
|
37
|
+
alert(errors, 'error');
|
|
38
|
+
throw new Error(errors);
|
|
39
|
+
}
|
|
40
|
+
return params;
|
|
41
|
+
}
|
package/coms/zimoli/view.js
CHANGED
|
@@ -94,11 +94,6 @@ var init = function () {
|
|
|
94
94
|
function view(element) {
|
|
95
95
|
var window = isNode(element) ? element : document.createElement("form");
|
|
96
96
|
init();
|
|
97
|
-
if (/form/i.test(window.tagName)) {
|
|
98
|
-
on("submit")(window, function (event) {
|
|
99
|
-
event.preventDefault();
|
|
100
|
-
});
|
|
101
|
-
}
|
|
102
97
|
extend(window, prototype);
|
|
103
98
|
if (window !== element) {
|
|
104
99
|
extend(window, element);
|
package/coms/zimoli/view.less
CHANGED
|
@@ -13,13 +13,15 @@ body>& {
|
|
|
13
13
|
-ms-user-select: none;
|
|
14
14
|
-moz-user-select: none;
|
|
15
15
|
-webkit-user-select: none;
|
|
16
|
+
border: 1px solid #0006;
|
|
16
17
|
}
|
|
17
18
|
|
|
18
19
|
&[dragable] {
|
|
19
20
|
position: absolute;
|
|
20
21
|
}
|
|
21
22
|
|
|
22
|
-
&>.body
|
|
23
|
+
&>.body,
|
|
24
|
+
>[body] {
|
|
23
25
|
padding: 6px 0;
|
|
24
26
|
background: #f2f4f6;
|
|
25
27
|
display: block;
|
|
@@ -42,7 +44,8 @@ body>& {
|
|
|
42
44
|
}
|
|
43
45
|
|
|
44
46
|
|
|
45
|
-
&>.head
|
|
47
|
+
&>.head,
|
|
48
|
+
>[head] {
|
|
46
49
|
z-index: 2;
|
|
47
50
|
background: #fffc;
|
|
48
51
|
position: relative;
|
|
@@ -83,12 +86,14 @@ body>& {
|
|
|
83
86
|
}
|
|
84
87
|
}
|
|
85
88
|
|
|
86
|
-
&>.foot
|
|
89
|
+
&>.foot,
|
|
90
|
+
>[foot] {
|
|
87
91
|
white-space: nowrap;
|
|
88
92
|
overflow: auto;
|
|
89
93
|
}
|
|
90
94
|
|
|
91
|
-
&>.foot
|
|
95
|
+
&>.foot,
|
|
96
|
+
>[foot] {
|
|
92
97
|
z-index: 1;
|
|
93
98
|
text-align: right;
|
|
94
99
|
line-height: 1;
|
|
@@ -101,13 +106,14 @@ body>& {
|
|
|
101
106
|
bottom: 0;
|
|
102
107
|
margin-top: -42px;
|
|
103
108
|
|
|
104
|
-
|
|
105
|
-
padding: 0 20px;
|
|
106
|
-
min-width: 60px;
|
|
107
|
-
vertical-align: middle;
|
|
109
|
+
}
|
|
108
110
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
111
|
+
.button {
|
|
112
|
+
padding: 0 20px;
|
|
113
|
+
min-width: 60px;
|
|
114
|
+
vertical-align: middle;
|
|
115
|
+
|
|
116
|
+
&+.button {
|
|
117
|
+
margin-left: 10px;
|
|
112
118
|
}
|
|
113
119
|
}
|