snail.view 2.0.2 → 2.0.3
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/dist/snail.view.js +11 -54
- package/dist/snail.view.umd.js +11 -54
- package/dist/styles/app.less +10 -7
- package/package.json +2 -2
package/dist/snail.view.js
CHANGED
|
@@ -33,60 +33,17 @@ function useCSS() {
|
|
|
33
33
|
}
|
|
34
34
|
function buildStyle(options) {
|
|
35
35
|
const style = Object.create(null);
|
|
36
|
-
if (
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
options.flexBasis != void 0 && (style.flexBasis = options.flexBasis);
|
|
48
|
-
options.flexGrow > 0 != void 0 && (style.flexGrow = String(options.flexGrow));
|
|
49
|
-
options.flexShrink > 0 != void 0 && (style.flexShrink = String(options.flexShrink));
|
|
50
|
-
options.order > 0 != void 0 && (style.order = String(options.order));
|
|
51
|
-
options.alignSelf != void 0 && (style.alignSelf = options.alignSelf);
|
|
52
|
-
options.left != void 0 && (style.left = options.left);
|
|
53
|
-
options.right != void 0 && (style.right = options.right);
|
|
54
|
-
options.top != void 0 && (style.top = options.top);
|
|
55
|
-
options.bottom != void 0 && (style.bottom = options.bottom);
|
|
56
|
-
options.overflow != void 0 && (style.overflow = options.overflow);
|
|
57
|
-
options.overflowX != void 0 && (style.overflowX = options.overflowX);
|
|
58
|
-
options.overflowY != void 0 && (style.overflowY = options.overflowY);
|
|
59
|
-
}
|
|
60
|
-
{
|
|
61
|
-
options.width != void 0 && (style.width = options.width);
|
|
62
|
-
options.minWidth != void 0 && (style.minWidth = options.minWidth);
|
|
63
|
-
options.maxWidth != void 0 && (style.maxWidth = options.maxWidth);
|
|
64
|
-
options.height != void 0 && (style.height = options.height);
|
|
65
|
-
options.minHeight != void 0 && (style.minHeight = options.minHeight);
|
|
66
|
-
options.maxHeight != void 0 && (style.maxHeight = options.maxHeight);
|
|
67
|
-
options.margin != void 0 && (style.margin = options.margin);
|
|
68
|
-
options.marginTop != void 0 && (style.marginTop = options.marginTop);
|
|
69
|
-
options.marginRight != void 0 && (style.marginRight = options.marginRight);
|
|
70
|
-
options.marginBottom != void 0 && (style.marginBottom = options.marginBottom);
|
|
71
|
-
options.marginLeft != void 0 && (style.marginLeft = options.marginLeft);
|
|
72
|
-
options.borderRadius != void 0 && (style.borderRadius = options.borderRadius);
|
|
73
|
-
options.border != void 0 && (style.border = options.border);
|
|
74
|
-
options.borderTop != void 0 && (style.borderTop = options.borderTop);
|
|
75
|
-
options.borderRight != void 0 && (style.borderRight = options.borderRight);
|
|
76
|
-
options.borderBottom != void 0 && (style.borderBottom = options.borderBottom);
|
|
77
|
-
options.borderLeft != void 0 && (style.borderLeft = options.borderLeft);
|
|
78
|
-
options.padding != void 0 && (style.padding = options.padding);
|
|
79
|
-
options.paddingTop != void 0 && (style.paddingTop = options.paddingTop);
|
|
80
|
-
options.paddingRight != void 0 && (style.paddingRight = options.paddingRight);
|
|
81
|
-
options.paddingBottom != void 0 && (style.paddingBottom = options.paddingBottom);
|
|
82
|
-
options.paddingLeft != void 0 && (style.paddingLeft = options.paddingLeft);
|
|
83
|
-
}
|
|
84
|
-
{
|
|
85
|
-
options.transition != void 0 && (style.transition = options.transition);
|
|
86
|
-
options.transitionProperty != void 0 && (style.transitionProperty = options.transitionProperty);
|
|
87
|
-
options.transitionDuration != void 0 && (style.transitionDuration = options.transitionDuration);
|
|
88
|
-
options.transitionDelay != void 0 && (style.transitionDelay = options.transitionDelay);
|
|
89
|
-
options.transitionTimingFunction != void 0 && (style.transitionTimingFunction = options.transitionTimingFunction);
|
|
36
|
+
if (!!options) {
|
|
37
|
+
const tmpFunc = key => options[key] != void 0 && (style[key] = String(options[key]));
|
|
38
|
+
["color", "backgroundColor", "textAlign", "textAlign", "verticalAlign"].forEach(tmpFunc);
|
|
39
|
+
["justifyContent", "alignItems", "flex", "flexBasis", "flexGrow", "flexShrink", "order", "alignSelf"].forEach(tmpFunc);
|
|
40
|
+
["left", "right", "top", "bottom"].forEach(tmpFunc);
|
|
41
|
+
["overflow", "overflowX", "overflowY"].forEach(tmpFunc);
|
|
42
|
+
["width", "minWidth", "maxWidth", "height", "minHeight", "maxHeight"].forEach(tmpFunc);
|
|
43
|
+
["margin", "marginTop", "marginRight", "marginBottom", "marginLeft"].forEach(tmpFunc);
|
|
44
|
+
["borderRadius", "border", "borderTop", "borderRight", "borderBottom", "borderLeft"].forEach(tmpFunc);
|
|
45
|
+
["padding", "paddingTop", "paddingRight", "paddingBottom", "paddingLeft"].forEach(tmpFunc);
|
|
46
|
+
["transition", "transitionProperty", "transitionDuration", "transitionDelay", "transitionTimingFunction"].forEach(tmpFunc);
|
|
90
47
|
}
|
|
91
48
|
return style;
|
|
92
49
|
}
|
package/dist/snail.view.umd.js
CHANGED
|
@@ -37,60 +37,17 @@
|
|
|
37
37
|
}
|
|
38
38
|
function buildStyle(options) {
|
|
39
39
|
const style = Object.create(null);
|
|
40
|
-
if (
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
options.flexBasis != void 0 && (style.flexBasis = options.flexBasis);
|
|
52
|
-
options.flexGrow > 0 != void 0 && (style.flexGrow = String(options.flexGrow));
|
|
53
|
-
options.flexShrink > 0 != void 0 && (style.flexShrink = String(options.flexShrink));
|
|
54
|
-
options.order > 0 != void 0 && (style.order = String(options.order));
|
|
55
|
-
options.alignSelf != void 0 && (style.alignSelf = options.alignSelf);
|
|
56
|
-
options.left != void 0 && (style.left = options.left);
|
|
57
|
-
options.right != void 0 && (style.right = options.right);
|
|
58
|
-
options.top != void 0 && (style.top = options.top);
|
|
59
|
-
options.bottom != void 0 && (style.bottom = options.bottom);
|
|
60
|
-
options.overflow != void 0 && (style.overflow = options.overflow);
|
|
61
|
-
options.overflowX != void 0 && (style.overflowX = options.overflowX);
|
|
62
|
-
options.overflowY != void 0 && (style.overflowY = options.overflowY);
|
|
63
|
-
}
|
|
64
|
-
{
|
|
65
|
-
options.width != void 0 && (style.width = options.width);
|
|
66
|
-
options.minWidth != void 0 && (style.minWidth = options.minWidth);
|
|
67
|
-
options.maxWidth != void 0 && (style.maxWidth = options.maxWidth);
|
|
68
|
-
options.height != void 0 && (style.height = options.height);
|
|
69
|
-
options.minHeight != void 0 && (style.minHeight = options.minHeight);
|
|
70
|
-
options.maxHeight != void 0 && (style.maxHeight = options.maxHeight);
|
|
71
|
-
options.margin != void 0 && (style.margin = options.margin);
|
|
72
|
-
options.marginTop != void 0 && (style.marginTop = options.marginTop);
|
|
73
|
-
options.marginRight != void 0 && (style.marginRight = options.marginRight);
|
|
74
|
-
options.marginBottom != void 0 && (style.marginBottom = options.marginBottom);
|
|
75
|
-
options.marginLeft != void 0 && (style.marginLeft = options.marginLeft);
|
|
76
|
-
options.borderRadius != void 0 && (style.borderRadius = options.borderRadius);
|
|
77
|
-
options.border != void 0 && (style.border = options.border);
|
|
78
|
-
options.borderTop != void 0 && (style.borderTop = options.borderTop);
|
|
79
|
-
options.borderRight != void 0 && (style.borderRight = options.borderRight);
|
|
80
|
-
options.borderBottom != void 0 && (style.borderBottom = options.borderBottom);
|
|
81
|
-
options.borderLeft != void 0 && (style.borderLeft = options.borderLeft);
|
|
82
|
-
options.padding != void 0 && (style.padding = options.padding);
|
|
83
|
-
options.paddingTop != void 0 && (style.paddingTop = options.paddingTop);
|
|
84
|
-
options.paddingRight != void 0 && (style.paddingRight = options.paddingRight);
|
|
85
|
-
options.paddingBottom != void 0 && (style.paddingBottom = options.paddingBottom);
|
|
86
|
-
options.paddingLeft != void 0 && (style.paddingLeft = options.paddingLeft);
|
|
87
|
-
}
|
|
88
|
-
{
|
|
89
|
-
options.transition != void 0 && (style.transition = options.transition);
|
|
90
|
-
options.transitionProperty != void 0 && (style.transitionProperty = options.transitionProperty);
|
|
91
|
-
options.transitionDuration != void 0 && (style.transitionDuration = options.transitionDuration);
|
|
92
|
-
options.transitionDelay != void 0 && (style.transitionDelay = options.transitionDelay);
|
|
93
|
-
options.transitionTimingFunction != void 0 && (style.transitionTimingFunction = options.transitionTimingFunction);
|
|
40
|
+
if (!!options) {
|
|
41
|
+
const tmpFunc = key => options[key] != void 0 && (style[key] = String(options[key]));
|
|
42
|
+
["color", "backgroundColor", "textAlign", "textAlign", "verticalAlign"].forEach(tmpFunc);
|
|
43
|
+
["justifyContent", "alignItems", "flex", "flexBasis", "flexGrow", "flexShrink", "order", "alignSelf"].forEach(tmpFunc);
|
|
44
|
+
["left", "right", "top", "bottom"].forEach(tmpFunc);
|
|
45
|
+
["overflow", "overflowX", "overflowY"].forEach(tmpFunc);
|
|
46
|
+
["width", "minWidth", "maxWidth", "height", "minHeight", "maxHeight"].forEach(tmpFunc);
|
|
47
|
+
["margin", "marginTop", "marginRight", "marginBottom", "marginLeft"].forEach(tmpFunc);
|
|
48
|
+
["borderRadius", "border", "borderTop", "borderRight", "borderBottom", "borderLeft"].forEach(tmpFunc);
|
|
49
|
+
["padding", "paddingTop", "paddingRight", "paddingBottom", "paddingLeft"].forEach(tmpFunc);
|
|
50
|
+
["transition", "transitionProperty", "transitionDuration", "transitionDelay", "transitionTimingFunction"].forEach(tmpFunc);
|
|
94
51
|
}
|
|
95
52
|
return style;
|
|
96
53
|
}
|
package/dist/styles/app.less
CHANGED
|
@@ -124,13 +124,14 @@
|
|
|
124
124
|
// ***************************************** 👉 文本输入渲染 *****************************************
|
|
125
125
|
.snail-app {
|
|
126
126
|
|
|
127
|
-
//
|
|
127
|
+
// 输入框等,去掉默认的外边框;仅针对输入类型的,后续逐步扩充。checkbox、radio等先忽略
|
|
128
128
|
input[type="search"],
|
|
129
129
|
input[type="text"],
|
|
130
130
|
input[type="url"],
|
|
131
131
|
input[type="email"],
|
|
132
132
|
input[type="password"],
|
|
133
|
-
input[type="number"]
|
|
133
|
+
input[type="number"],
|
|
134
|
+
textarea {
|
|
134
135
|
outline: 0 !important;
|
|
135
136
|
appearance: none !important;
|
|
136
137
|
// 给个最小宽度,避免走默认导致部分宽度不够时撑开外部容器的情况
|
|
@@ -161,7 +162,12 @@
|
|
|
161
162
|
}
|
|
162
163
|
}
|
|
163
164
|
|
|
164
|
-
|
|
165
|
+
textarea {
|
|
166
|
+
padding-top: 4px;
|
|
167
|
+
padding-bottom: 4px;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
// 选项类:取消边距等
|
|
165
171
|
input[type="radio"],
|
|
166
172
|
input[type="checkbox"] {
|
|
167
173
|
margin: 0;
|
|
@@ -187,11 +193,8 @@
|
|
|
187
193
|
}
|
|
188
194
|
|
|
189
195
|
// 文本提示文字颜色
|
|
190
|
-
textarea::placeholder {
|
|
191
|
-
color: #8a9099;
|
|
192
|
-
}
|
|
193
|
-
|
|
194
196
|
input::placeholder,
|
|
197
|
+
textarea::placeholder,
|
|
195
198
|
.placeholder {
|
|
196
199
|
.ellipsis();
|
|
197
200
|
color: #8a9099;
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"description": "对视图界面做的一些封装。如样式计算助手方法,常用样式less混入、变量等;dom相关助手类",
|
|
4
4
|
"author": "snail_dev@163.com",
|
|
5
5
|
"license": "MIT",
|
|
6
|
-
"version": "2.0.
|
|
6
|
+
"version": "2.0.3",
|
|
7
7
|
"type": "module",
|
|
8
8
|
"main": "dist/snail.view.js",
|
|
9
9
|
"module": "dist/snail.view.js",
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"types": "tsc -p ./tsconfig.dts.json --declarationDir ./dist/_types"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"snail.core": ">=2.0.
|
|
17
|
+
"snail.core": ">=2.0.18"
|
|
18
18
|
},
|
|
19
19
|
"devDependencies": {
|
|
20
20
|
"rollup": ">=4.39.0",
|