efront 3.3.7 → 3.4.2
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 +30 -0
- package/apps/pivot/auth/login.less +11 -0
- package/apps/pivot/home/short.html +1 -0
- package/apps/pivot/home/short.js +5 -0
- package/apps/pivot/home/short.less +1 -0
- package/apps/pivot/home/welcome.html +14 -0
- package/apps/pivot/home/welcome.js +24 -0
- package/apps/pivot/home/welcome.less +8 -0
- package/apps/pivot/index.html +41 -0
- package/apps/pivot/main.js +18 -0
- package/apps/pivot/menu.yml +3 -0
- package/apps/zimoli/book/main.js +1 -1
- package/apps/zimoli/broadcast/main.js +1 -1
- package/apps/zimoli/index.html +1 -0
- package/apps/zimoli/main.js +1 -1
- package/apps/zimoli/nearby/main.js +1 -1
- package/apps/zimoli/yuanfen/main.js +1 -1
- package/coms/basic/crypt.js +1 -1
- package/coms/basic/loader.js +1 -1
- package/coms/basic/refilm_decode.js +13 -2
- package/coms/basic/valid.js +10 -0
- package/coms/compile/common.js +451 -0
- package/coms/compile/scanner2.js +8 -405
- package/coms/crypt/encode62.js +23 -33
- package/coms/crypt/encode62_test.js +2 -1
- package/coms/frame/left.html +11 -6
- package/coms/frame/left.js +6 -3
- package/coms/frame/left.less +38 -36
- package/coms/frame/main.js +1 -1
- package/coms/frame/route.js +52 -4
- package/coms/frame/top.less +12 -13
- package/coms/kugou/buildList.js +1 -0
- package/coms/kugou/player.js +3 -0
- package/coms/layer/glance.less +4 -2
- package/coms/zimoli/alert.js +8 -4
- package/coms/zimoli/avatar.js +0 -1
- package/coms/zimoli/checker.html +1 -1
- package/coms/zimoli/checker.less +8 -13
- 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/menu.js +11 -1
- package/coms/zimoli/menu.less +1 -1
- package/coms/zimoli/menuItem.js +4 -1
- package/coms/zimoli/model.js +1 -0
- package/coms/zimoli/radio.html +1 -3
- package/coms/zimoli/radio.less +10 -22
- 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/coms/zimoli/zimoli.js +11 -9
- package/data/mime.json +3 -0
- 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/frame/left.less
CHANGED
|
@@ -1,43 +1,45 @@
|
|
|
1
1
|
& {
|
|
2
|
-
padding
|
|
2
|
+
padding: 50px 0 0 0;
|
|
3
3
|
position: relative;
|
|
4
4
|
}
|
|
5
5
|
|
|
6
6
|
.navbar-header {
|
|
7
|
-
height
|
|
8
|
-
padding
|
|
9
|
-
font-size
|
|
10
|
-
line-height
|
|
7
|
+
height: 50px;
|
|
8
|
+
padding: 10px 15px 10px 25px;
|
|
9
|
+
font-size: 25px;
|
|
10
|
+
line-height: 25px;
|
|
11
11
|
text-transform: uppercase;
|
|
12
|
-
color
|
|
13
|
-
margin-top
|
|
12
|
+
color: #b8c7ce;
|
|
13
|
+
margin-top: -50px;
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
.dashboard_text {
|
|
17
|
-
font-size
|
|
17
|
+
font-size: 12px;
|
|
18
18
|
text-transform: capitalize;
|
|
19
|
-
display
|
|
19
|
+
display: block;
|
|
20
20
|
letter-spacing: 1px;
|
|
21
|
-
padding-left
|
|
22
|
-
display
|
|
21
|
+
padding-left: 35px;
|
|
22
|
+
display: none;
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
ylist {
|
|
26
|
+
width: 100%;
|
|
27
|
+
}
|
|
26
28
|
|
|
27
29
|
.sidebar-menu {
|
|
28
|
-
height
|
|
30
|
+
height: 100%;
|
|
29
31
|
box-shadow: none;
|
|
30
32
|
}
|
|
31
33
|
|
|
32
34
|
.label {
|
|
33
35
|
border-radius: 4px;
|
|
34
|
-
height
|
|
35
|
-
line-height
|
|
36
|
-
margin
|
|
37
|
-
float
|
|
38
|
-
top
|
|
39
|
-
padding
|
|
40
|
-
color
|
|
36
|
+
height: 18px;
|
|
37
|
+
line-height: 18px;
|
|
38
|
+
margin: 12px 2px;
|
|
39
|
+
float: right;
|
|
40
|
+
top: 50%;
|
|
41
|
+
padding: 0 8px;
|
|
42
|
+
color: #fff;
|
|
41
43
|
|
|
42
44
|
&.label-primary {
|
|
43
45
|
background-color: #cd3213;
|
|
@@ -57,9 +59,9 @@
|
|
|
57
59
|
}
|
|
58
60
|
|
|
59
61
|
.fa-angle-left {
|
|
60
|
-
width
|
|
61
|
-
height
|
|
62
|
-
padding
|
|
62
|
+
width: auto;
|
|
63
|
+
height: auto;
|
|
64
|
+
padding: 0;
|
|
63
65
|
line-height: inherit;
|
|
64
66
|
}
|
|
65
67
|
|
|
@@ -72,10 +74,10 @@
|
|
|
72
74
|
}
|
|
73
75
|
|
|
74
76
|
.tab1.header {
|
|
75
|
-
font-size
|
|
76
|
-
color
|
|
77
|
-
background
|
|
78
|
-
height
|
|
77
|
+
font-size: 12px;
|
|
78
|
+
color: #4b646f;
|
|
79
|
+
background: #1a2226;
|
|
80
|
+
height: 32px;
|
|
79
81
|
line-height: 32px;
|
|
80
82
|
|
|
81
83
|
&:hover {
|
|
@@ -84,18 +86,18 @@
|
|
|
84
86
|
}
|
|
85
87
|
|
|
86
88
|
&>.setting {
|
|
87
|
-
position
|
|
88
|
-
bottom
|
|
89
|
-
right
|
|
90
|
-
left
|
|
91
|
-
background
|
|
92
|
-
text-align
|
|
89
|
+
position: absolute;
|
|
90
|
+
bottom: 0;
|
|
91
|
+
right: 0;
|
|
92
|
+
left: 0;
|
|
93
|
+
background: transparent;
|
|
94
|
+
text-align: left;
|
|
93
95
|
line-height: 40px;
|
|
94
|
-
height
|
|
96
|
+
height: 40px;
|
|
95
97
|
|
|
96
98
|
i {
|
|
97
|
-
height
|
|
98
|
-
opacity
|
|
99
|
+
height: 40px;
|
|
100
|
+
opacity: .9;
|
|
99
101
|
margin-right: 10px;
|
|
100
102
|
line-height: inherit;
|
|
101
103
|
}
|
package/coms/frame/main.js
CHANGED
package/coms/frame/route.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(document.body.hasAttribute("config-path") ? data.fromURL(document.body.getAttribute('config-path') || '
|
|
1
|
+
(document.body.hasAttribute('menu-path') || document.body.hasAttribute("menu") || document.body.hasAttribute("config-path") ? data.fromURL(document.body.getAttribute('menu-path') || document.body.getAttribute('menu') || document.body.getAttribute('config-path') || 'menu.yml').loading_promise : Promise.resolve([])).then(function (items) {
|
|
2
2
|
var result = [];
|
|
3
3
|
var menuid = 0;
|
|
4
4
|
var savedChildren = Object.create(null);
|
|
@@ -10,6 +10,9 @@
|
|
|
10
10
|
if (!savedMenus[menu.id]) {
|
|
11
11
|
savedMenus[menu.id] = menu;
|
|
12
12
|
}
|
|
13
|
+
if (!menu.name) {
|
|
14
|
+
menu.name = Object.keys(menu)[0];
|
|
15
|
+
}
|
|
13
16
|
if (!(menu.id in savedChildren)) {
|
|
14
17
|
savedChildren[menu.id] = menu.children;
|
|
15
18
|
if (menu.children instanceof Array) {
|
|
@@ -28,8 +31,46 @@
|
|
|
28
31
|
}
|
|
29
32
|
}
|
|
30
33
|
};
|
|
31
|
-
items
|
|
32
|
-
|
|
34
|
+
var parseMenuList = function (items) {
|
|
35
|
+
if (items instanceof Array) {
|
|
36
|
+
console.log(items)
|
|
37
|
+
return items;
|
|
38
|
+
}
|
|
39
|
+
if (items instanceof Object) {
|
|
40
|
+
var keys = Object.keys(items);
|
|
41
|
+
items = keys.map(k => {
|
|
42
|
+
var c = items[k];
|
|
43
|
+
var item = {};
|
|
44
|
+
if (c instanceof Object) {
|
|
45
|
+
item.children = parseMenuList(c);
|
|
46
|
+
}
|
|
47
|
+
else if (typeof c === 'string') {
|
|
48
|
+
var [path, data] = c.split(/\?/);
|
|
49
|
+
}
|
|
50
|
+
var [icon] = k.split(/\s+/);
|
|
51
|
+
if (icon.length < k.length) {
|
|
52
|
+
item.icon = icon;
|
|
53
|
+
var name = k.slice(icon.length).trim();
|
|
54
|
+
} else name = k;
|
|
55
|
+
if (/,/.test(name)) {
|
|
56
|
+
var [name, ...roles] = name.split(',');
|
|
57
|
+
}
|
|
58
|
+
item.name = name;
|
|
59
|
+
if (roles) item.roles = roles;
|
|
60
|
+
if (path) item.path = path;
|
|
61
|
+
if (data) item.params = parseKV(data);
|
|
62
|
+
if (/,/.test(name)) {
|
|
63
|
+
|
|
64
|
+
}
|
|
65
|
+
return item;
|
|
66
|
+
});
|
|
67
|
+
return items;
|
|
68
|
+
}
|
|
69
|
+
return [];
|
|
70
|
+
};
|
|
71
|
+
result.update = function (items) {
|
|
72
|
+
items = parseMenuList(items);
|
|
73
|
+
items.map(getChildren);
|
|
33
74
|
var opened = data.getInstance("menu-opened");
|
|
34
75
|
var historys = zimoli.getCurrentHistory();
|
|
35
76
|
var map = {}, mmap = {};
|
|
@@ -62,6 +103,7 @@
|
|
|
62
103
|
result.open(result[0]);
|
|
63
104
|
}
|
|
64
105
|
}
|
|
106
|
+
return result;
|
|
65
107
|
};
|
|
66
108
|
var setActive = function (p, active) {
|
|
67
109
|
while (p) {
|
|
@@ -71,6 +113,7 @@
|
|
|
71
113
|
};
|
|
72
114
|
result.load = function (menu) {
|
|
73
115
|
zimoli.go(menu);
|
|
116
|
+
return result;
|
|
74
117
|
};
|
|
75
118
|
on("zimoli")(window, function (event) {
|
|
76
119
|
var { zimoli } = event;
|
|
@@ -127,8 +170,13 @@
|
|
|
127
170
|
};
|
|
128
171
|
result.reload = function () {
|
|
129
172
|
result.load(result.active);
|
|
173
|
+
return result;
|
|
174
|
+
};
|
|
175
|
+
result.fetch = function (url) {
|
|
176
|
+
data.from(url).loading_promise.then(result.update);
|
|
177
|
+
return result;
|
|
130
178
|
};
|
|
131
|
-
result.update();
|
|
179
|
+
if (items.length) result.update(items);
|
|
132
180
|
|
|
133
181
|
return result;
|
|
134
182
|
});
|
package/coms/frame/top.less
CHANGED
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
@import "../config.less";
|
|
2
|
-
|
|
3
1
|
& {
|
|
4
2
|
// background-color : #fff;
|
|
5
3
|
user-select: none;
|
|
6
4
|
position: relative;
|
|
7
5
|
z-index: 1;
|
|
8
|
-
|
|
9
|
-
height:
|
|
6
|
+
padding: 4px 0;
|
|
7
|
+
line-height: 0;
|
|
10
8
|
-webkit-backdrop-filter: saturate(180%) blur(20px);
|
|
11
9
|
backdrop-filter: saturate(180%) blur(20px);
|
|
12
10
|
background: rgba(255, 255, 255, .7);
|
|
@@ -87,6 +85,7 @@
|
|
|
87
85
|
line-height: 24px;
|
|
88
86
|
text-align: center;
|
|
89
87
|
color: #666;
|
|
88
|
+
z-index: 2;
|
|
90
89
|
|
|
91
90
|
&:hover {
|
|
92
91
|
color: #f24;
|
|
@@ -102,17 +101,17 @@
|
|
|
102
101
|
border-radius: 10px;
|
|
103
102
|
}
|
|
104
103
|
|
|
105
|
-
&:nth-child(2)>span {
|
|
106
|
-
|
|
107
|
-
}
|
|
104
|
+
// &:nth-child(2)>span {
|
|
105
|
+
// background-color: @primary-dot-color;
|
|
106
|
+
// }
|
|
108
107
|
|
|
109
|
-
&:nth-child(3)>span {
|
|
110
|
-
|
|
111
|
-
}
|
|
108
|
+
// &:nth-child(3)>span {
|
|
109
|
+
// background-color: @extra-dot-color1;
|
|
110
|
+
// }
|
|
112
111
|
|
|
113
|
-
&:nth-child(4)>span {
|
|
114
|
-
|
|
115
|
-
}
|
|
112
|
+
// &:nth-child(4)>span {
|
|
113
|
+
// background-color: @extra-dot-color2;
|
|
114
|
+
// }
|
|
116
115
|
}
|
|
117
116
|
|
|
118
117
|
.option-items {
|
package/coms/kugou/buildList.js
CHANGED
package/coms/kugou/player.js
CHANGED
package/coms/layer/glance.less
CHANGED
|
@@ -3,14 +3,12 @@
|
|
|
3
3
|
width: 100%;
|
|
4
4
|
height: 100%;
|
|
5
5
|
max-width: 100%;
|
|
6
|
-
// margin : 0 auto;
|
|
7
6
|
position: relative;
|
|
8
7
|
border-radius: 3px;
|
|
9
8
|
overflow: hidden;
|
|
10
9
|
border-left: @left-width solid transparent;
|
|
11
10
|
box-sizing: border-box;
|
|
12
11
|
overflow: visible;
|
|
13
|
-
border-top: 44px solid transparent;
|
|
14
12
|
transition: border-left-width 0.2s ease-out, margin-left .2s ease-out, left .2s ease-out;
|
|
15
13
|
}
|
|
16
14
|
|
|
@@ -36,6 +34,10 @@
|
|
|
36
34
|
border-bottom: 1px solid rgba(0, 0, 0, .16);
|
|
37
35
|
}
|
|
38
36
|
|
|
37
|
+
>:not([layer]) {
|
|
38
|
+
padding: 50px 10px 20px 10px;
|
|
39
|
+
}
|
|
40
|
+
|
|
39
41
|
&.close {
|
|
40
42
|
border-left-width: 0 !important;
|
|
41
43
|
}
|
package/coms/zimoli/alert.js
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
var styles = {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
blue: "#2a53cd",
|
|
3
|
+
green: "#228B22",
|
|
4
|
+
orange: "#dd6a16",
|
|
5
|
+
red: "#dc352e"
|
|
6
6
|
};
|
|
7
|
+
styles.success = styles.pass = styles.green;
|
|
8
|
+
styles.info = styles.blue;
|
|
9
|
+
styles.error = styles.danger = styles.red;
|
|
10
|
+
styles.warn = styles.orange;
|
|
7
11
|
var alerts = [];
|
|
8
12
|
var clean = Cleanup(alerts);
|
|
9
13
|
var build = function () {
|
package/coms/zimoli/avatar.js
CHANGED
package/coms/zimoli/checker.html
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
▢<s>✓</s>
|
package/coms/zimoli/checker.less
CHANGED
|
@@ -1,32 +1,27 @@
|
|
|
1
1
|
& {
|
|
2
|
-
display: inline-block;
|
|
3
2
|
height: 1em;
|
|
4
3
|
width: 1em;
|
|
5
|
-
border-radius: 2px;
|
|
6
|
-
border: .1em solid;
|
|
7
4
|
position: relative;
|
|
8
|
-
vertical-align: middle;
|
|
9
5
|
margin-right: 4px;
|
|
6
|
+
font-family: sans-serif;
|
|
7
|
+
display: inline-block;
|
|
8
|
+
line-height: 1;
|
|
9
|
+
text-align: center;
|
|
10
10
|
|
|
11
11
|
>s {
|
|
12
12
|
display: none;
|
|
13
|
-
border-radius: 50%;
|
|
14
|
-
width: 1em;
|
|
15
|
-
height: 1em;
|
|
16
|
-
line-height: 1;
|
|
17
13
|
text-decoration: none;
|
|
18
|
-
text-align: center;
|
|
19
14
|
position: absolute;
|
|
20
|
-
margin: -.5em;
|
|
21
15
|
font-weight: bold;
|
|
22
|
-
|
|
23
|
-
|
|
16
|
+
left: 0;
|
|
17
|
+
right: 0;
|
|
18
|
+
top: -.15em;
|
|
24
19
|
}
|
|
25
20
|
}
|
|
26
21
|
|
|
27
22
|
|
|
28
23
|
&.checked {
|
|
29
24
|
>s {
|
|
30
|
-
display:
|
|
25
|
+
display: inline;
|
|
31
26
|
}
|
|
32
27
|
}
|
package/coms/zimoli/cross.js
CHANGED
|
@@ -323,7 +323,7 @@ function addDirect(a) {
|
|
|
323
323
|
if (typeof a === 'string' || a instanceof RegExp) cors_hosts.push(a);
|
|
324
324
|
}
|
|
325
325
|
function notCross(domain) {
|
|
326
|
-
if (location_host === domain.slice(0, location_host.length)) return true;
|
|
326
|
+
if (location_host === domain.slice(0, location_host.length) || !/^https?\:\/\/|^s?\/\//.test(domain)) return true;
|
|
327
327
|
for (var cx = 0, dx = cors_hosts.length; cx < dx; cx++) {
|
|
328
328
|
var host = cors_hosts[cx];
|
|
329
329
|
if (host instanceof RegExp) {
|
package/coms/zimoli/css.js
CHANGED
|
@@ -166,6 +166,7 @@ function cssTargetStyleSheet(stylesheet, innerCss) {
|
|
|
166
166
|
* @param {|string} oValue
|
|
167
167
|
*/
|
|
168
168
|
var css = function (target, oStyle, oValue) {
|
|
169
|
+
if (!oStyle) return;
|
|
169
170
|
if (isElement(target)) {
|
|
170
171
|
if (/^style$/i.test(target.tagName)) {
|
|
171
172
|
cssTargetStyleSheet(target, oStyle, oValue);
|
package/coms/zimoli/data.js
CHANGED
|
@@ -269,9 +269,9 @@ function parseConfig(api) {
|
|
|
269
269
|
});
|
|
270
270
|
return '';
|
|
271
271
|
});
|
|
272
|
-
url.replace(/[\?\#][\s\S]*$/, '').replace(
|
|
272
|
+
url.replace(/[\?\#][\s\S]*$/, '').replace(/([\:\\]\:|\:\w+)/g, function (p) {
|
|
273
273
|
p = p.slice(1);
|
|
274
|
-
if (!required[p]) {
|
|
274
|
+
if (!required[p] && p !== ':') {
|
|
275
275
|
required.push(p);
|
|
276
276
|
required[p] = p;
|
|
277
277
|
}
|
|
@@ -495,8 +495,9 @@ var privates = {
|
|
|
495
495
|
var coinmethod = method.slice(0, spliterIndex).toLowerCase();
|
|
496
496
|
var realmethod = coinmethod.replace(/\W+$/g, '');
|
|
497
497
|
var rest = [];
|
|
498
|
-
var uri = url.replace(/#[\s\S]*$/, "").replace(
|
|
498
|
+
var uri = url.replace(/#[\s\S]*$/, "").replace(/[\\\:]\:|\:[a-z\_][\w]*/gi, function (d) {
|
|
499
499
|
d = d.slice(1);
|
|
500
|
+
if (d === ":") return d;
|
|
500
501
|
rest.push(d);
|
|
501
502
|
return seekResponse(params, d) || '';
|
|
502
503
|
});
|
|
@@ -912,6 +913,10 @@ var data = {
|
|
|
912
913
|
localStorage.setItem(sourceDataId, JSAM.stringify(dataSourceMap));
|
|
913
914
|
}
|
|
914
915
|
},
|
|
916
|
+
getSource(sourceid) {
|
|
917
|
+
if (sourceid) return dataSourceMap[sourceid];
|
|
918
|
+
return dataSourceMap;
|
|
919
|
+
},
|
|
915
920
|
clearSource() {
|
|
916
921
|
localStorage.removeItem(sourceDataId);
|
|
917
922
|
sessionStorage.removeItem(sourceDataId);
|
package/coms/zimoli/encode62.js
CHANGED
|
@@ -5,6 +5,19 @@ var encode62 = {
|
|
|
5
5
|
src,
|
|
6
6
|
map,
|
|
7
7
|
time_delta: parseInt("zzzzz", 36),
|
|
8
|
+
geta(string) {
|
|
9
|
+
string = String(string)
|
|
10
|
+
string = string.length + string + "2017-08-19";
|
|
11
|
+
var buff = src.split('');
|
|
12
|
+
for (var cx = 0, dx = buff.length + src.length, sl = string.length, cl = buff.length; cx < dx; cx++) {
|
|
13
|
+
var s1 = string.charCodeAt(cx % sl) % cl;
|
|
14
|
+
var s2 = cx % cl;
|
|
15
|
+
var btemp = buff[s1];
|
|
16
|
+
buff[s1] = buff[s2];
|
|
17
|
+
buff[s2] = btemp;
|
|
18
|
+
}
|
|
19
|
+
return buff.join('');
|
|
20
|
+
},
|
|
8
21
|
timedecode(string) {
|
|
9
22
|
var { time_delta } = this;
|
|
10
23
|
var time_rest = string.slice(string.length - time_delta.toString(36).length, string.length);
|
package/coms/zimoli/field.html
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
<div class="head">
|
|
2
2
|
<span ng-bind=field.name></span>
|
|
3
|
+
<span class="required" ng-if="field.required">*</span>
|
|
3
4
|
</div>
|
|
4
5
|
<div class="body">
|
|
5
6
|
<model _data=data _field=field></model>
|
|
7
|
+
<span class="error" ng-bind="error"></span>
|
|
6
8
|
</div>
|
|
7
9
|
<div class="foot" ng-if="field.msg">
|
|
8
10
|
<span ng-bind=field.msg></span>
|
package/coms/zimoli/field.js
CHANGED
|
@@ -1,19 +1,43 @@
|
|
|
1
1
|
function main(elem) {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
|
|
2
|
+
elem = option.apply(null, arguments);
|
|
3
|
+
var scope = {};
|
|
4
|
+
care(elem, function (p) {
|
|
5
|
+
if (elem.childNodes.length) return;
|
|
6
|
+
var [f, data] = p;
|
|
7
|
+
elem.innerHTML = field;
|
|
8
|
+
render(elem, scope = {
|
|
9
|
+
model,
|
|
10
|
+
data,
|
|
11
|
+
error: null,
|
|
12
|
+
field: f
|
|
13
|
+
});
|
|
14
|
+
elem.oldValue = data[f.key];
|
|
15
|
+
elem.setAttribute("field", f.key);
|
|
16
|
+
}, false);
|
|
17
|
+
elem.setAttribute("field", '');
|
|
18
|
+
elem.renders = [function () {
|
|
19
|
+
if (!this.src) return;
|
|
20
|
+
var [f, data] = this.src;
|
|
21
|
+
if (!f || !data) return;
|
|
22
|
+
var v = data[f.key];
|
|
23
|
+
if (!this.checked) if (v === this.oldValue || isEmpty(this.oldValue) && isEmpty(v)) return;
|
|
24
|
+
this.checked = false;
|
|
25
|
+
this.setAttribute("dirty", '');
|
|
26
|
+
var error = valid(f, data);
|
|
27
|
+
if (error) {
|
|
28
|
+
this.setAttribute("error", error);
|
|
29
|
+
switch (error) {
|
|
30
|
+
case "empty":
|
|
31
|
+
scope.error = `${f.name}是必填字段!`;
|
|
32
|
+
break;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
else {
|
|
36
|
+
this.removeAttribute('error');
|
|
37
|
+
scope.error = null;
|
|
38
|
+
}
|
|
39
|
+
this.oldValue = data[f.key];
|
|
40
|
+
}]
|
|
41
|
+
elem.removeAttribute("tabindex");
|
|
42
|
+
return elem;
|
|
19
43
|
}
|
package/coms/zimoli/field.less
CHANGED
|
@@ -32,4 +32,23 @@
|
|
|
32
32
|
|
|
33
33
|
.input {
|
|
34
34
|
width: 100%;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.required {
|
|
38
|
+
color: #c24;
|
|
39
|
+
display: inline-block;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
&.error,
|
|
43
|
+
&[error] {
|
|
44
|
+
background: #f322;
|
|
45
|
+
|
|
46
|
+
model>* {
|
|
47
|
+
background: #f322;
|
|
48
|
+
border-color: #f32;
|
|
49
|
+
outline: 1px solid #f32;
|
|
50
|
+
}
|
|
51
|
+
.error{
|
|
52
|
+
color:#c32;
|
|
53
|
+
}
|
|
35
54
|
}
|
package/coms/zimoli/form.js
CHANGED
|
@@ -2,5 +2,13 @@ function form(elem) {
|
|
|
2
2
|
if (!elem) {
|
|
3
3
|
elem = document.createElement("form");
|
|
4
4
|
}
|
|
5
|
+
if (/form/i.test(elem.tagName)) {
|
|
6
|
+
on("submit")(elem, function (event) {
|
|
7
|
+
event.preventDefault();
|
|
8
|
+
var fields = elem.querySelectorAll(".field");
|
|
9
|
+
for (var f of fields) f.checked = true;
|
|
10
|
+
render.refresh();
|
|
11
|
+
});
|
|
12
|
+
}
|
|
5
13
|
return elem;
|
|
6
14
|
}
|
package/coms/zimoli/menu.js
CHANGED
|
@@ -101,6 +101,14 @@ function main(elem, mode) {
|
|
|
101
101
|
// }
|
|
102
102
|
// elem.setAttribute('browser', os);
|
|
103
103
|
var mode = elem.getAttribute('mode') || elem.getAttribute('type');
|
|
104
|
+
if (!mode) {
|
|
105
|
+
if (/^[xyhvtci]/i.test(elem.tagName)) {
|
|
106
|
+
mode = elem.tagName.slice(0, 1);
|
|
107
|
+
}
|
|
108
|
+
else if (/[xyhvtci]$/i.test(elem.tagName)) {
|
|
109
|
+
mode = elem.tagName.slice(0, 1);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
104
112
|
mode = mode ? mode.toLowerCase() : "horizonal";
|
|
105
113
|
var src = elem.getAttribute("src") || elem.getAttribute("ng-src") || elem.getAttribute("v-src");
|
|
106
114
|
if (src) {
|
|
@@ -133,12 +141,14 @@ function main(elem, mode) {
|
|
|
133
141
|
});
|
|
134
142
|
elem.renders.push(function () {
|
|
135
143
|
var src = this.src;
|
|
144
|
+
var hasIcon = false;
|
|
136
145
|
for (var cx = 0, dx = src; cx < dx; cx++) {
|
|
137
146
|
if (src[cx].icon) {
|
|
147
|
+
hasIcon = true;
|
|
138
148
|
break;
|
|
139
149
|
}
|
|
140
150
|
}
|
|
141
|
-
elem.useIcon =
|
|
151
|
+
elem.useIcon = hasIcon;
|
|
142
152
|
});
|
|
143
153
|
} else {
|
|
144
154
|
var nodes = getTreeNodes(elem);
|
package/coms/zimoli/menu.less
CHANGED
package/coms/zimoli/menuItem.js
CHANGED
|
@@ -2,7 +2,10 @@ function main(elem, scope, hasIcon) {
|
|
|
2
2
|
var item = elem || document.createElement('menu-item');
|
|
3
3
|
item.innerHTML = menuItem;
|
|
4
4
|
if (isObject(scope) && scope !== elem.$scope) {
|
|
5
|
-
render(item, { menu: scope, useIcon: hasIcon })
|
|
5
|
+
render(item, { menu: scope, useIcon: hasIcon, hasIcon })
|
|
6
|
+
}
|
|
7
|
+
else {
|
|
8
|
+
extendIfNeeded(elem.$scope, { useIcon: false, hasIcon: false })
|
|
6
9
|
}
|
|
7
10
|
return item;
|
|
8
11
|
}
|
package/coms/zimoli/model.js
CHANGED