mm_os 2.7.5 → 2.7.7

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.
@@ -1,5 +1,5 @@
1
- <div class="mm_col ${' ' + @config.layout}">
2
- <div id="${config.id}" class="component_demo ${' ' + @config.class}">
1
+ <div class="mm_col ${' ' + config.layout}">
2
+ <div id="${config.id}" class="component_demo ${' ' + config.class}">
3
3
  <div class="title">${@config.options.xxx}</div>
4
4
  <div class="description">示例组件描述</div>
5
5
  </div>
@@ -12,7 +12,7 @@
12
12
  // 分组, 可以将特有的分一个组, 方便用户查询
13
13
  "group": "default",
14
14
  // 分类, 例如: 查询生活类、监测类、便民类
15
- "type": "监测",
15
+ "type": "默认",
16
16
  // 脚本文件, 非必传,可和渲染文件二选一传
17
17
  "func_file": "./component.js",
18
18
  // 渲染, 非必传,可和脚本文件二选一传
@@ -32,7 +32,7 @@ class Drive extends Item {
32
32
  // 分组, 可以将特有的分一个组, 方便用户查询
33
33
  "group": "default",
34
34
  // 分类, 例如: 查询生活类、监测类、便民类
35
- "type": "监测",
35
+ "type": "默认",
36
36
  // 脚本文件
37
37
  "func_file": "./component.js",
38
38
  // 渲染
@@ -112,24 +112,46 @@ Component.prototype.option_model = function(block) {
112
112
  }
113
113
 
114
114
  // 边距
115
- style +=
116
- `\n margin-top: ${o.margin_top || 0};`;
117
- style +=
118
- `\n margin-right: ${o.margin_right || 0};`;
119
- style +=
120
- `\n margin-bottom: ${o.margin_bottom || 0};`;
121
- style +=
122
- `\n margin-left: ${o.margin_left || 0};`;
115
+ if (o.margin_top) {
116
+ style += `\n margin-top: ${o.margin_top};`;
117
+ }
118
+ if (o.margin_right) {
119
+ style += `\n margin-right: ${o.margin_right};`;
120
+ }
121
+ if (o.margin_bottom) {
122
+ style += `\n margin-bottom: ${o.margin_bottom};`;
123
+ }
124
+ if (o.margin_left) {
125
+ style += `\n margin-left: ${o.margin_left};`;
126
+ }
123
127
 
124
128
  // 填充
125
- style +=
126
- `\n padding-top: ${o.padding_top || 0};`;
127
- style +=
128
- `\n padding-right: ${o.padding_right || 0};`;
129
- style +=
130
- `\n padding-bottom: ${o.padding_bottom || 0};`;
131
- style +=
132
- `\n padding-left: ${o.padding_left || 0};`;
129
+ if (o.padding_top) {
130
+ style += `\n padding-top: ${o.padding_top};`;
131
+ }
132
+ if (o.padding_right) {
133
+ style += `\n padding-right: ${o.padding_right};`;
134
+ }
135
+ if (o.padding_bottom) {
136
+ style += `\n padding-bottom: ${o.padding_bottom};`;
137
+ }
138
+ if (o.padding_left) {
139
+ style += `\n padding-left: ${o.padding_left};`;
140
+ }
141
+
142
+ // 圆角
143
+ if (o.radius_top_right) {
144
+ style += `\n border-top-right-radius: ${o.radius_top_right};`;
145
+ }
146
+ if (o.radius_top_left) {
147
+ style += `\n border-top-left-radius: ${o.radius_top_left};`;
148
+ }
149
+ if (o.radius_bottom_right) {
150
+ style += `\n border-bottom-right-radius: ${o.radius_bottom_right};`;
151
+ }
152
+ if (o.radius_bottom_left) {
153
+ style += `\n border-bottom-left-radius: ${o.radius_bottom_left};`;
154
+ }
133
155
 
134
156
  // 背景
135
157
  if (o.bg_url) {
@@ -157,8 +179,30 @@ Component.prototype.option_model = function(block) {
157
179
  } else {
158
180
  style = "";
159
181
  }
160
-
182
+
161
183
  var layout = "";
184
+ if (block.layout) {
185
+ var o = block.layout.toJson();
186
+ if (o.default) {
187
+ layout += " col-" + o.default;
188
+ }
189
+ if (o.pc) {
190
+ layout += " col-xxl-" + o.pc;
191
+ }
192
+ if (o.note) {
193
+ layout += " col-xl-" + o.note;
194
+ }
195
+ if (o.pad) {
196
+ layout += " col-lg-" + o.pad;
197
+ }
198
+ if (o.pad_mini) {
199
+ layout += " col-sm-" + o.pad_mini;
200
+ }
201
+ if (o.phone) {
202
+ layout += " col-xs-" + o.phone;
203
+ }
204
+ layout = layout.trim();
205
+ }
162
206
 
163
207
  var data = (block.data || '[]').toJson();
164
208
  var attr = (block.attr || '{}').toJson();
@@ -10,6 +10,9 @@ module.exports = {
10
10
  var model = {
11
11
  config
12
12
  };
13
+ if (config.diy) {
14
+ return db.tpl.render(config.diy, model);
15
+ }
13
16
  return db.tpl.view("./component.html".fullname(__dirname), model);
14
17
  }
15
18
  };
@@ -8,7 +8,7 @@
8
8
  // 插件描述,介绍改插件是做什么用的
9
9
  "description": "描述该插件是做什么用的",
10
10
  // 插件版本号,用于升级迭代
11
- "version": "1.0",
11
+ "version": "1.0.0",
12
12
  // 作者
13
13
  "author": "",
14
14
  // 官网
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mm_os",
3
- "version": "2.7.5",
3
+ "version": "2.7.7",
4
4
  "description": "这是超级美眉服务端框架,用于快速构建应用程序。",
5
5
  "main": "index.js",
6
6
  "scripts": {