mali-applet-ui 1.1.5 → 1.1.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.
- package/lib/components/ml-amount-input/ml-amount-input.vue +1 -0
- package/lib/components/ml-amount-text/ml-amount-text.vue +3 -0
- package/lib/components/ml-button/ml-button.vue +8 -0
- package/lib/components/ml-calendar/ml-calendar.vue +3 -0
- package/lib/components/ml-chunk-group/ml-chunk-group.vue +6 -0
- package/lib/components/ml-dict-type/ml-dict-type.vue +7 -0
- package/lib/components/ml-echarts/ml-echarts.vue +3 -3
- package/lib/components/ml-editor/html-parser.js +354 -0
- package/lib/components/ml-editor/ml-editor.vue +73 -0
- package/lib/components/ml-header-filter-form/ml-header-filter-form.vue +0 -6
- package/lib/components/ml-hint/ml-hint.vue +3 -0
- package/lib/components/ml-icon/ml-icon.vue +3 -0
- package/lib/components/ml-list-item-title/ml-list-item-title.vue +8 -4
- package/lib/components/ml-list-menu-item/ml-list-menu-item.vue +3 -0
- package/lib/components/ml-rich-text/ml-rich-text.vue +1 -1
- package/lib/components/ml-row/ml-row.vue +3 -0
- package/lib/components/ml-status-tag/ml-status-tag.vue +4 -0
- package/lib/components/ml-switch/ml-switch.vue +1 -5
- package/lib/components/ml-tab-container-navs/ml-tab-container-navs.vue +3 -0
- package/lib/components/ml-tabs/ml-tabs.vue +3 -0
- package/lib/components/ml-text/ml-text.vue +3 -0
- package/lib/components/ml-tree-box/ml-tree-box.vue +1 -1
- package/lib/components/ml-upload/ml-upload.vue +5 -5
- package/modal/modal.js +13 -15
- package/modal/toast.js +19 -6
- package/package.json +3 -3
- package/style/variable.scss +1 -0
- package/types/index.d.ts +9 -6
- package/types/loading.d.ts +6 -0
- package/types/modal.d.ts +13 -0
- package/types/toast.d.ts +10 -0
- package/types/utils/index.d.ts +25 -0
- package/utils/file.js +19 -13
|
@@ -133,6 +133,9 @@ export default {
|
|
|
133
133
|
&.ss-pink {
|
|
134
134
|
color: $ml-pink-color;
|
|
135
135
|
}
|
|
136
|
+
&.ss-red {
|
|
137
|
+
color: $ml-red-color;
|
|
138
|
+
}
|
|
136
139
|
&.ss-orange {
|
|
137
140
|
color: $ml-orange-color;
|
|
138
141
|
}
|
|
@@ -215,6 +218,11 @@ export default {
|
|
|
215
218
|
background: $ml-pink-color;
|
|
216
219
|
border-color: $ml-pink-color;
|
|
217
220
|
}
|
|
221
|
+
&.ss-red {
|
|
222
|
+
color: #ffffff;
|
|
223
|
+
background: $ml-red-color;
|
|
224
|
+
border-color: $ml-red-color;
|
|
225
|
+
}
|
|
218
226
|
&.ss-orange {
|
|
219
227
|
color: #ffffff;
|
|
220
228
|
background: $ml-orange-color;
|
|
@@ -117,6 +117,10 @@ export default {
|
|
|
117
117
|
color: $ml-pink-color;
|
|
118
118
|
border: 1px solid $ml-pink-color;
|
|
119
119
|
}
|
|
120
|
+
&.ss-red {
|
|
121
|
+
color: $ml-red-color;
|
|
122
|
+
border: 1px solid $ml-red-color;
|
|
123
|
+
}
|
|
120
124
|
&.ss-orange {
|
|
121
125
|
color: $ml-orange-color;
|
|
122
126
|
border: 1px solid $ml-orange-color;
|
|
@@ -201,6 +205,9 @@ export default {
|
|
|
201
205
|
&.ss-pink {
|
|
202
206
|
color: $ml-pink-color;
|
|
203
207
|
}
|
|
208
|
+
&.ss-red {
|
|
209
|
+
color: $ml-red-color;
|
|
210
|
+
}
|
|
204
211
|
&.ss-orange {
|
|
205
212
|
color: $ml-orange-color;
|
|
206
213
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<view class="ml-
|
|
3
|
-
<canvas ref="canvasRef" class="ml-
|
|
2
|
+
<view class="ml-charts" :class="className" :style="{height: height || '400rpx', width: width || '100%'}">
|
|
3
|
+
<canvas ref="canvasRef" class="ml-charts-canvas" :type="platformEnv.isZFBMP ? '' : '2d'" :id="canvasId" :canvas-id="canvasId" :width="cvsWidth" :height="cvsHeight" @touchstart="touchStart" @touchmove="touchMove" @touchend="touchEnd"></canvas>
|
|
4
4
|
</view>
|
|
5
5
|
</template>
|
|
6
6
|
|
|
@@ -251,7 +251,7 @@ export default {
|
|
|
251
251
|
</script>
|
|
252
252
|
|
|
253
253
|
<style lang="scss">
|
|
254
|
-
.ml-
|
|
254
|
+
.ml-charts-canvas {
|
|
255
255
|
width: 100%;
|
|
256
256
|
height: 100%;
|
|
257
257
|
}
|
|
@@ -0,0 +1,354 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* HTML5 Parser By Sam Blowes
|
|
3
|
+
*
|
|
4
|
+
* Designed for HTML5 documents
|
|
5
|
+
*
|
|
6
|
+
* Original code by John Resig (ejohn.org)
|
|
7
|
+
* http://ejohn.org/blog/pure-javascript-html-parser/
|
|
8
|
+
* Original code by Erik Arvidsson, Mozilla Public License
|
|
9
|
+
* http://erik.eae.net/simplehtmlparser/simplehtmlparser.js
|
|
10
|
+
*
|
|
11
|
+
* ----------------------------------------------------------------------------
|
|
12
|
+
* License
|
|
13
|
+
* ----------------------------------------------------------------------------
|
|
14
|
+
*
|
|
15
|
+
* This code is triple licensed using Apache Software License 2.0,
|
|
16
|
+
* Mozilla Public License or GNU Public License
|
|
17
|
+
*
|
|
18
|
+
* ////////////////////////////////////////////////////////////////////////////
|
|
19
|
+
*
|
|
20
|
+
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
|
21
|
+
* use this file except in compliance with the License. You may obtain a copy
|
|
22
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
23
|
+
*
|
|
24
|
+
* ////////////////////////////////////////////////////////////////////////////
|
|
25
|
+
*
|
|
26
|
+
* The contents of this file are subject to the Mozilla Public License
|
|
27
|
+
* Version 1.1 (the "License"); you may not use this file except in
|
|
28
|
+
* compliance with the License. You may obtain a copy of the License at
|
|
29
|
+
* http://www.mozilla.org/MPL/
|
|
30
|
+
*
|
|
31
|
+
* Software distributed under the License is distributed on an "AS IS"
|
|
32
|
+
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
|
|
33
|
+
* License for the specific language governing rights and limitations
|
|
34
|
+
* under the License.
|
|
35
|
+
*
|
|
36
|
+
* The Original Code is Simple HTML Parser.
|
|
37
|
+
*
|
|
38
|
+
* The Initial Developer of the Original Code is Erik Arvidsson.
|
|
39
|
+
* Portions created by Erik Arvidssson are Copyright (C) 2004. All Rights
|
|
40
|
+
* Reserved.
|
|
41
|
+
*
|
|
42
|
+
* ////////////////////////////////////////////////////////////////////////////
|
|
43
|
+
*
|
|
44
|
+
* This program is free software; you can redistribute it and/or
|
|
45
|
+
* modify it under the terms of the GNU General Public License
|
|
46
|
+
* as published by the Free Software Foundation; either version 2
|
|
47
|
+
* of the License, or (at your option) any later version.
|
|
48
|
+
*
|
|
49
|
+
* This program is distributed in the hope that it will be useful,
|
|
50
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
51
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
52
|
+
* GNU General Public License for more details.
|
|
53
|
+
*
|
|
54
|
+
* You should have received a copy of the GNU General Public License
|
|
55
|
+
* along with this program; if not, write to the Free Software
|
|
56
|
+
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
57
|
+
*
|
|
58
|
+
* ----------------------------------------------------------------------------
|
|
59
|
+
* Usage
|
|
60
|
+
* ----------------------------------------------------------------------------
|
|
61
|
+
*
|
|
62
|
+
* // Use like so:
|
|
63
|
+
* HTMLParser(htmlString, {
|
|
64
|
+
* start: function(tag, attrs, unary) {},
|
|
65
|
+
* end: function(tag) {},
|
|
66
|
+
* chars: function(text) {},
|
|
67
|
+
* comment: function(text) {}
|
|
68
|
+
* });
|
|
69
|
+
*
|
|
70
|
+
* // or to get an XML string:
|
|
71
|
+
* HTMLtoXML(htmlString);
|
|
72
|
+
*
|
|
73
|
+
* // or to get an XML DOM Document
|
|
74
|
+
* HTMLtoDOM(htmlString);
|
|
75
|
+
*
|
|
76
|
+
* // or to inject into an existing document/DOM node
|
|
77
|
+
* HTMLtoDOM(htmlString, document);
|
|
78
|
+
* HTMLtoDOM(htmlString, document.body);
|
|
79
|
+
*
|
|
80
|
+
*/
|
|
81
|
+
|
|
82
|
+
/* eslint-disable */
|
|
83
|
+
// Regular Expressions for parsing tags and attributes
|
|
84
|
+
var startTag = /^<([-A-Za-z0-9_]+)((?:\s+[a-zA-Z_:][-a-zA-Z0-9_:.]*(?:\s*=\s*(?:(?:"[^"]*")|(?:'[^']*')|[^>\s]+))?)*)\s*(\/?)>/;
|
|
85
|
+
var endTag = /^<\/([-A-Za-z0-9_]+)[^>]*>/;
|
|
86
|
+
var attr = /([a-zA-Z_:][-a-zA-Z0-9_:.]*)(?:\s*=\s*(?:(?:"((?:\\.|[^"])*)")|(?:'((?:\\.|[^'])*)')|([^>\s]+)))?/g; // Empty Elements - HTML 5
|
|
87
|
+
|
|
88
|
+
var empty = makeMap('area,base,basefont,br,col,frame,hr,img,input,link,meta,param,embed,command,keygen,source,track,wbr'); // Block Elements - HTML 5
|
|
89
|
+
// fixed by xxx 将 ins 标签从块级名单中移除
|
|
90
|
+
|
|
91
|
+
var block = makeMap('a,address,article,applet,aside,audio,blockquote,button,canvas,center,dd,del,dir,div,dl,dt,fieldset,figcaption,figure,footer,form,frameset,h1,h2,h3,h4,h5,h6,header,hgroup,hr,iframe,isindex,li,map,menu,noframes,noscript,object,ol,output,p,pre,section,script,table,tbody,td,tfoot,th,thead,tr,ul,video'); // Inline Elements - HTML 5
|
|
92
|
+
|
|
93
|
+
var inline = makeMap('abbr,acronym,applet,b,basefont,bdo,big,br,button,cite,code,del,dfn,em,font,i,iframe,img,input,ins,kbd,label,map,object,q,s,samp,script,select,small,span,strike,strong,sub,sup,textarea,tt,u,var'); // Elements that you can, intentionally, leave open
|
|
94
|
+
// (and which close themselves)
|
|
95
|
+
|
|
96
|
+
var closeSelf = makeMap('colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr'); // Attributes that have their values filled in disabled="disabled"
|
|
97
|
+
|
|
98
|
+
var fillAttrs = makeMap('checked,compact,declare,defer,disabled,ismap,multiple,nohref,noresize,noshade,nowrap,readonly,selected'); // Special Elements (can contain anything)
|
|
99
|
+
|
|
100
|
+
var special = makeMap('script,style');
|
|
101
|
+
function HTMLParser(html, handler) {
|
|
102
|
+
var index;
|
|
103
|
+
var chars;
|
|
104
|
+
var match;
|
|
105
|
+
var stack = [];
|
|
106
|
+
var last = html;
|
|
107
|
+
|
|
108
|
+
stack.last = function () {
|
|
109
|
+
return this[this.length - 1];
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
while (html) {
|
|
113
|
+
chars = true; // Make sure we're not in a script or style element
|
|
114
|
+
|
|
115
|
+
if (!stack.last() || !special[stack.last()]) {
|
|
116
|
+
// Comment
|
|
117
|
+
if (html.indexOf('<!--') == 0) {
|
|
118
|
+
index = html.indexOf('-->');
|
|
119
|
+
|
|
120
|
+
if (index >= 0) {
|
|
121
|
+
if (handler.comment) {
|
|
122
|
+
handler.comment(html.substring(4, index));
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
html = html.substring(index + 3);
|
|
126
|
+
chars = false;
|
|
127
|
+
} // end tag
|
|
128
|
+
|
|
129
|
+
} else if (html.indexOf('</') == 0) {
|
|
130
|
+
match = html.match(endTag);
|
|
131
|
+
|
|
132
|
+
if (match) {
|
|
133
|
+
html = html.substring(match[0].length);
|
|
134
|
+
match[0].replace(endTag, parseEndTag);
|
|
135
|
+
chars = false;
|
|
136
|
+
} // start tag
|
|
137
|
+
|
|
138
|
+
} else if (html.indexOf('<') == 0) {
|
|
139
|
+
match = html.match(startTag);
|
|
140
|
+
|
|
141
|
+
if (match) {
|
|
142
|
+
html = html.substring(match[0].length);
|
|
143
|
+
match[0].replace(startTag, parseStartTag);
|
|
144
|
+
chars = false;
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
if (chars) {
|
|
149
|
+
index = html.indexOf('<');
|
|
150
|
+
var text = index < 0 ? html : html.substring(0, index);
|
|
151
|
+
html = index < 0 ? '' : html.substring(index);
|
|
152
|
+
|
|
153
|
+
if (handler.chars) {
|
|
154
|
+
handler.chars(text);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
} else {
|
|
158
|
+
html = html.replace(new RegExp('([\\s\\S]*?)<\/' + stack.last() + '[^>]*>'), function (all, text) {
|
|
159
|
+
text = text.replace(/<!--([\s\S]*?)-->|<!\[CDATA\[([\s\S]*?)]]>/g, '$1$2');
|
|
160
|
+
|
|
161
|
+
if (handler.chars) {
|
|
162
|
+
handler.chars(text);
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
return '';
|
|
166
|
+
});
|
|
167
|
+
parseEndTag('', stack.last());
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
if (html == last) {
|
|
171
|
+
throw 'Parse Error: ' + html;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
last = html;
|
|
175
|
+
} // Clean up any remaining tags
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
parseEndTag();
|
|
179
|
+
|
|
180
|
+
function parseStartTag(tag, tagName, rest, unary) {
|
|
181
|
+
tagName = tagName.toLowerCase();
|
|
182
|
+
|
|
183
|
+
if (block[tagName]) {
|
|
184
|
+
while (stack.last() && inline[stack.last()]) {
|
|
185
|
+
parseEndTag('', stack.last());
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
if (closeSelf[tagName] && stack.last() == tagName) {
|
|
190
|
+
parseEndTag('', tagName);
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
unary = empty[tagName] || !!unary;
|
|
194
|
+
|
|
195
|
+
if (!unary) {
|
|
196
|
+
stack.push(tagName);
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
if (handler.start) {
|
|
200
|
+
var attrs = [];
|
|
201
|
+
rest.replace(attr, function (match, name) {
|
|
202
|
+
var value = arguments[2] ? arguments[2] : arguments[3] ? arguments[3] : arguments[4] ? arguments[4] : fillAttrs[name] ? name : '';
|
|
203
|
+
attrs.push({
|
|
204
|
+
name: name,
|
|
205
|
+
value: value,
|
|
206
|
+
escaped: value.replace(/(^|[^\\])"/g, '$1\\\"') // "
|
|
207
|
+
|
|
208
|
+
});
|
|
209
|
+
});
|
|
210
|
+
|
|
211
|
+
if (handler.start) {
|
|
212
|
+
handler.start(tagName, attrs, unary);
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
function parseEndTag(tag, tagName) {
|
|
218
|
+
// If no tag name is provided, clean shop
|
|
219
|
+
if (!tagName) {
|
|
220
|
+
var pos = 0;
|
|
221
|
+
} // Find the closest opened tag of the same type
|
|
222
|
+
else {
|
|
223
|
+
for (var pos = stack.length - 1; pos >= 0; pos--) {
|
|
224
|
+
if (stack[pos] == tagName) {
|
|
225
|
+
break;
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
if (pos >= 0) {
|
|
231
|
+
// Close all the open elements, up the stack
|
|
232
|
+
for (var i = stack.length - 1; i >= pos; i--) {
|
|
233
|
+
if (handler.end) {
|
|
234
|
+
handler.end(stack[i]);
|
|
235
|
+
}
|
|
236
|
+
} // Remove the open elements from the stack
|
|
237
|
+
|
|
238
|
+
|
|
239
|
+
stack.length = pos;
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
function makeMap(str) {
|
|
245
|
+
var obj = {};
|
|
246
|
+
var items = str.split(',');
|
|
247
|
+
|
|
248
|
+
for (var i = 0; i < items.length; i++) {
|
|
249
|
+
obj[items[i]] = true;
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
return obj;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
function removeDOCTYPE(html) {
|
|
256
|
+
return html.replace(/<\?xml.*\?>\n/, '').replace(/<!doctype.*>\n/, '').replace(/<!DOCTYPE.*>\n/, '');
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
function parseAttrs(attrs) {
|
|
260
|
+
return attrs.reduce(function (pre, attr) {
|
|
261
|
+
var value = attr.value;
|
|
262
|
+
var name = attr.name;
|
|
263
|
+
|
|
264
|
+
if (pre[name]) {
|
|
265
|
+
pre[name] = pre[name] + " " + value;
|
|
266
|
+
} else {
|
|
267
|
+
pre[name] = value;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
return pre;
|
|
271
|
+
}, {});
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
function parseHtml(html) {
|
|
275
|
+
html = removeDOCTYPE(html);
|
|
276
|
+
var stacks = [];
|
|
277
|
+
var results = {
|
|
278
|
+
node: 'root',
|
|
279
|
+
children: []
|
|
280
|
+
};
|
|
281
|
+
HTMLParser(html, {
|
|
282
|
+
start: function start(tag, attrs, unary) {
|
|
283
|
+
var node = {
|
|
284
|
+
name: tag
|
|
285
|
+
};
|
|
286
|
+
|
|
287
|
+
if (attrs.length !== 0) {
|
|
288
|
+
node.attrs = parseAttrs(attrs);
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
if (unary) {
|
|
292
|
+
var parent = stacks[0] || results;
|
|
293
|
+
|
|
294
|
+
if (!parent.children) {
|
|
295
|
+
parent.children = [];
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
parent.children.push(node);
|
|
299
|
+
} else {
|
|
300
|
+
stacks.unshift(node);
|
|
301
|
+
}
|
|
302
|
+
},
|
|
303
|
+
end: function end(tag) {
|
|
304
|
+
var node = stacks.shift();
|
|
305
|
+
if (node.name !== tag) console.error('invalid state: mismatch end tag');
|
|
306
|
+
|
|
307
|
+
if (stacks.length === 0) {
|
|
308
|
+
results.children.push(node);
|
|
309
|
+
} else {
|
|
310
|
+
var parent = stacks[0];
|
|
311
|
+
|
|
312
|
+
if (!parent.children) {
|
|
313
|
+
parent.children = [];
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
parent.children.push(node);
|
|
317
|
+
}
|
|
318
|
+
},
|
|
319
|
+
chars: function chars(text) {
|
|
320
|
+
var node = {
|
|
321
|
+
type: 'text',
|
|
322
|
+
text: text
|
|
323
|
+
};
|
|
324
|
+
|
|
325
|
+
if (stacks.length === 0) {
|
|
326
|
+
results.children.push(node);
|
|
327
|
+
} else {
|
|
328
|
+
var parent = stacks[0];
|
|
329
|
+
|
|
330
|
+
if (!parent.children) {
|
|
331
|
+
parent.children = [];
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
parent.children.push(node);
|
|
335
|
+
}
|
|
336
|
+
},
|
|
337
|
+
comment: function comment(text) {
|
|
338
|
+
var node = {
|
|
339
|
+
node: 'comment',
|
|
340
|
+
text: text
|
|
341
|
+
};
|
|
342
|
+
var parent = stacks[0];
|
|
343
|
+
|
|
344
|
+
if (!parent.children) {
|
|
345
|
+
parent.children = [];
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
parent.children.push(node);
|
|
349
|
+
}
|
|
350
|
+
});
|
|
351
|
+
return results.children;
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
export default parseHtml;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view class="ml-editor">
|
|
3
|
+
<rich-text v-if="isFromReadonly" :nodes="nodes" :selectable="selectable"></rich-text>
|
|
4
|
+
<rich-text v-else-if="isFormDisabled" :nodes="nodes" :selectable="selectable"></rich-text>
|
|
5
|
+
<view v-else></view>
|
|
6
|
+
</view>
|
|
7
|
+
</template>
|
|
8
|
+
|
|
9
|
+
<script>
|
|
10
|
+
import parseHtml from './html-parser'
|
|
11
|
+
|
|
12
|
+
export default {
|
|
13
|
+
name: 'MlEditor',
|
|
14
|
+
props: {
|
|
15
|
+
value: String,
|
|
16
|
+
readonly: Boolean,
|
|
17
|
+
disabled: Boolean,
|
|
18
|
+
selectable: {
|
|
19
|
+
type: Boolean,
|
|
20
|
+
default: true
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
inject: {
|
|
24
|
+
form: {
|
|
25
|
+
from: 'mlForm',
|
|
26
|
+
default: null
|
|
27
|
+
},
|
|
28
|
+
formItem: {
|
|
29
|
+
from: 'mlFormItem',
|
|
30
|
+
default: null
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
data () {
|
|
34
|
+
return {
|
|
35
|
+
nodes: []
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
computed: {
|
|
39
|
+
isFromReadonly () {
|
|
40
|
+
if (this.readonly) {
|
|
41
|
+
return true
|
|
42
|
+
}
|
|
43
|
+
return this.form ? this.form.readonly : false
|
|
44
|
+
},
|
|
45
|
+
isFormDisabled () {
|
|
46
|
+
if (this.disabled) {
|
|
47
|
+
return true
|
|
48
|
+
}
|
|
49
|
+
return this.formItem ? this.formItem.isFormDisabled : false
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
watch: {
|
|
53
|
+
value () {
|
|
54
|
+
this.load()
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
mounted () {
|
|
58
|
+
this.load()
|
|
59
|
+
},
|
|
60
|
+
methods: {
|
|
61
|
+
load () {
|
|
62
|
+
this.nodes = this.value ? parseHtml(this.value) : []
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
</script>
|
|
67
|
+
|
|
68
|
+
<style lang="scss">
|
|
69
|
+
.ml-editor {
|
|
70
|
+
display: block;
|
|
71
|
+
word-break: break-word;
|
|
72
|
+
}
|
|
73
|
+
</style>
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<view class="ml-list-item-title" @tap="tapEvent">
|
|
3
3
|
<view class="ml-list-item-title-left">
|
|
4
|
-
<
|
|
5
|
-
<
|
|
4
|
+
<view v-if="showSeq" class="ml-list-item-title-seq">{{ itemIndex + 1 }}</view>
|
|
5
|
+
<view v-if="icon" class="ml-list-item-title-icon">
|
|
6
6
|
<ml-icon :name="icon" status="primary" />
|
|
7
|
-
</
|
|
8
|
-
<
|
|
7
|
+
</view>
|
|
8
|
+
<view class="ml-list-item-title-content">
|
|
9
|
+
<slot>
|
|
10
|
+
<view>{{ currTitle }}</view>
|
|
11
|
+
</slot>
|
|
12
|
+
</view>
|
|
9
13
|
</view>
|
|
10
14
|
<view class="ml-list-item-title-right">
|
|
11
15
|
<slot name="extra"></slot>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<view class="ml-switch" :class="[isChecked ? 'is--on' : 'is--off', {'is--disabled': disabled,'is--animat':
|
|
2
|
+
<view class="ml-switch" :class="[isChecked ? 'is--on' : 'is--off', {'is--disabled': disabled,'is--animat': hasAnimat}]">
|
|
3
3
|
<view class="ml-switch--button" @tap="clickEvent">
|
|
4
4
|
<view class="ml-switch--label ml-switch--label-on">{{ onShowLabel }}</view>
|
|
5
5
|
<view class="ml-switch--label ml-switch--label-off">{{ offShowLabel }}</view>
|
|
@@ -54,10 +54,6 @@ export default {
|
|
|
54
54
|
this.hasAnimat = true
|
|
55
55
|
this.$emit('input', value)
|
|
56
56
|
this.$emit('change', { value })
|
|
57
|
-
// 自动更新校验状态
|
|
58
|
-
if (this.$xeform && this.$xeformiteminfo) {
|
|
59
|
-
this.$xeform.triggerItemEvent(evnt, this.$xeformiteminfo.itemConfig.field, value)
|
|
60
|
-
}
|
|
61
57
|
this.activeTimeout = setTimeout(() => {
|
|
62
58
|
this.hasAnimat = false
|
|
63
59
|
}, 400)
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
:info="getPrefixIcon(item)"
|
|
46
46
|
/>
|
|
47
47
|
<view class="ml-tree-node__title" :class="{ 'hasExplain': item[useProps.explain] }" @tap.stop="handleIntoChildren(item)">
|
|
48
|
-
<view class="nowrap">{{ item[useProps.label] || '' }}
|
|
48
|
+
<view class="nowrap">{{ item[useProps.label] || '' }}<ml-text v-if="item.notEnabled" :status="item.notEnabledStatus || 'orange'">(未启用)</ml-text></view>
|
|
49
49
|
<view class="ml-tree-node__explain" v-if="item[useProps.explain]">{{ item[useProps.explain] }}</view>
|
|
50
50
|
</view>
|
|
51
51
|
<view class="ml-tree-node__extra">
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
<!-- 上传图片 -->
|
|
4
4
|
<view v-if="mediatype === 'image' || platformEnv.isDDMP" class="ml-upload-image-list">
|
|
5
5
|
<view class="ml-upload-image-item" v-for="(item, index) in fileList" :key="index">
|
|
6
|
-
<image class="ml-upload-image-img" mode="aspectFill" :src="
|
|
6
|
+
<image class="ml-upload-image-img" mode="aspectFill" :src="getThumbnailUrl(item)" @tap="previewImageEvent(item, index)"></image>
|
|
7
7
|
<view v-if="!isFromReadonly" class="ml-upload-image-del-btn" @tap="removeEvent(item)">
|
|
8
8
|
<ml-icon name="close" />
|
|
9
9
|
</view>
|
|
@@ -205,7 +205,7 @@ export default {
|
|
|
205
205
|
default: () => ['album', 'camera']
|
|
206
206
|
},
|
|
207
207
|
getFileUrl: Function,
|
|
208
|
-
|
|
208
|
+
getThumbnailFileUrl: Function,
|
|
209
209
|
uploadFile: Function,
|
|
210
210
|
removeFile: Function,
|
|
211
211
|
downloadFile: Function
|
|
@@ -274,7 +274,7 @@ export default {
|
|
|
274
274
|
},
|
|
275
275
|
methods: {
|
|
276
276
|
getFileIcon (item) {
|
|
277
|
-
switch (item[
|
|
277
|
+
switch (item[this.typeField]) {
|
|
278
278
|
case 'png':
|
|
279
279
|
case 'jpg':
|
|
280
280
|
return 'file-image'
|
|
@@ -345,8 +345,8 @@ export default {
|
|
|
345
345
|
this.isModelUpdate = true
|
|
346
346
|
this.updateModel()
|
|
347
347
|
},
|
|
348
|
-
|
|
349
|
-
const getThumbnailMethod = this.
|
|
348
|
+
getThumbnailUrl (item) {
|
|
349
|
+
const getThumbnailMethod = this.getThumbnailFileUrl ? this.getThumbnailFileUrl : (globalStore.upload ? globalStore.upload.getThumbnailFileUrl : null)
|
|
350
350
|
if (getThumbnailMethod) {
|
|
351
351
|
return getThumbnailMethod.call(this.currVM, {
|
|
352
352
|
item,
|
package/modal/modal.js
CHANGED
|
@@ -1,29 +1,30 @@
|
|
|
1
|
+
import XEUtils from 'xe-utils'
|
|
2
|
+
|
|
1
3
|
const MaliModal = {
|
|
2
|
-
alert (option
|
|
4
|
+
alert (option) {
|
|
5
|
+
const opts = XEUtils.isString(option) ? { content: option } : (option || {})
|
|
3
6
|
return new Promise(resolve => {
|
|
4
7
|
uni.showModal({
|
|
5
|
-
title:
|
|
6
|
-
content:
|
|
8
|
+
title: opts.title || '系统提示',
|
|
9
|
+
content: opts.content || '',
|
|
7
10
|
showCancel: false,
|
|
8
|
-
confirmText:
|
|
11
|
+
confirmText: opts.confirmButtonText || '确认',
|
|
9
12
|
success () {
|
|
10
13
|
const type = 'confirm'
|
|
11
|
-
if (option.callback) {
|
|
12
|
-
option.callback(type)
|
|
13
|
-
}
|
|
14
14
|
resolve(type)
|
|
15
15
|
}
|
|
16
16
|
})
|
|
17
17
|
})
|
|
18
18
|
},
|
|
19
|
-
confirm (option
|
|
19
|
+
confirm (option) {
|
|
20
|
+
const opts = XEUtils.isString(option) ? { content: option } : (option || {})
|
|
20
21
|
return new Promise(resolve => {
|
|
21
22
|
uni.showModal({
|
|
22
|
-
title:
|
|
23
|
-
content:
|
|
23
|
+
title: opts.title || '系统提示',
|
|
24
|
+
content: opts.content || '',
|
|
24
25
|
showCancel: true,
|
|
25
|
-
confirmText:
|
|
26
|
-
cancelText:
|
|
26
|
+
confirmText: opts.confirmButtonText || '确认',
|
|
27
|
+
cancelText: opts.cancelButtonText || '取消',
|
|
27
28
|
success (res) {
|
|
28
29
|
let type
|
|
29
30
|
if (res.confirm) {
|
|
@@ -31,9 +32,6 @@ const MaliModal = {
|
|
|
31
32
|
} else if (res.cancel) {
|
|
32
33
|
type = 'cancel'
|
|
33
34
|
}
|
|
34
|
-
if (option.callback) {
|
|
35
|
-
option.callback(type)
|
|
36
|
-
}
|
|
37
35
|
resolve(type)
|
|
38
36
|
}
|
|
39
37
|
})
|
package/modal/toast.js
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
|
+
import XEUtils from 'xe-utils'
|
|
2
|
+
|
|
1
3
|
const MaliToast = {
|
|
2
|
-
success (option
|
|
4
|
+
success (option) {
|
|
5
|
+
const opts = XEUtils.isString(option) ? { content: option } : (option || {})
|
|
3
6
|
return new Promise(resolve => {
|
|
4
7
|
uni.showToast({
|
|
5
|
-
title:
|
|
8
|
+
title: opts.content || '操作成功',
|
|
6
9
|
icon: 'success',
|
|
7
10
|
success () {
|
|
8
11
|
setTimeout(resolve, 2000)
|
|
@@ -10,10 +13,11 @@ const MaliToast = {
|
|
|
10
13
|
})
|
|
11
14
|
})
|
|
12
15
|
},
|
|
13
|
-
error (option
|
|
16
|
+
error (option) {
|
|
17
|
+
const opts = XEUtils.isString(option) ? { content: option } : (option || {})
|
|
14
18
|
return new Promise(resolve => {
|
|
15
19
|
uni.showToast({
|
|
16
|
-
title:
|
|
20
|
+
title: opts.content || '操作失败',
|
|
17
21
|
icon: 'error',
|
|
18
22
|
success () {
|
|
19
23
|
setTimeout(resolve, 2000)
|
|
@@ -21,14 +25,23 @@ const MaliToast = {
|
|
|
21
25
|
})
|
|
22
26
|
})
|
|
23
27
|
},
|
|
24
|
-
|
|
28
|
+
warning (option) {
|
|
29
|
+
const opts = XEUtils.isString(option) ? { content: option } : (option || {})
|
|
25
30
|
return new Promise(resolve => {
|
|
26
|
-
uni.
|
|
31
|
+
uni.showToast({
|
|
32
|
+
title: opts.content || '操作失败',
|
|
33
|
+
icon: 'error',
|
|
27
34
|
success () {
|
|
28
35
|
setTimeout(resolve, 2000)
|
|
29
36
|
}
|
|
30
37
|
})
|
|
31
38
|
})
|
|
39
|
+
},
|
|
40
|
+
hide () {
|
|
41
|
+
return new Promise(resolve => {
|
|
42
|
+
uni.hideLoading()
|
|
43
|
+
setTimeout(resolve, 1500)
|
|
44
|
+
})
|
|
32
45
|
}
|
|
33
46
|
}
|
|
34
47
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mali-applet-ui",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.7",
|
|
4
4
|
"description": "vue2 码里云小程序组件库",
|
|
5
5
|
"files": [
|
|
6
6
|
"lib",
|
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
"theme.scss"
|
|
16
16
|
],
|
|
17
17
|
"main": "index.js",
|
|
18
|
+
"typings": "types/index.d.ts",
|
|
18
19
|
"scripts": {
|
|
19
20
|
"lib": "gulp build_components",
|
|
20
21
|
"release": "node script/release.js && npm run lib && npm publish",
|
|
@@ -31,7 +32,7 @@
|
|
|
31
32
|
"run-before": "node script/run-before.js"
|
|
32
33
|
},
|
|
33
34
|
"dependencies": {
|
|
34
|
-
"xe-utils": "^3.5.
|
|
35
|
+
"xe-utils": "^3.5.10"
|
|
35
36
|
},
|
|
36
37
|
"devDependencies": {
|
|
37
38
|
"@dcloudio/uni-app-plus": "^2.0.1-36420220922003",
|
|
@@ -58,7 +59,6 @@
|
|
|
58
59
|
"regenerator-runtime": "^0.12.1",
|
|
59
60
|
"vue": "^2.6.12",
|
|
60
61
|
"vuex": "^3.2.0",
|
|
61
|
-
"xe-utils": "3.5.7",
|
|
62
62
|
"@babel/eslint-parser": "^7.12.16",
|
|
63
63
|
"@babel/runtime": "~7.17.9",
|
|
64
64
|
"@dcloudio/types": "^3.0.4",
|
package/style/variable.scss
CHANGED
|
@@ -27,6 +27,7 @@ $ml-gray-color: #F0F2F5 !default;
|
|
|
27
27
|
$ml-blue-color: #246BFD !default;
|
|
28
28
|
$ml-green-color: #00D35C !default;
|
|
29
29
|
$ml-pink-color: #FF5064 !default;
|
|
30
|
+
$ml-red-color: #FF5064 !default;
|
|
30
31
|
$ml-orange-color: #FF9C00 !default;
|
|
31
32
|
$ml-purple-color: #9747FF !default;
|
|
32
33
|
$ml-dark-blue-color: #5e7092 !default;
|
package/types/index.d.ts
CHANGED
|
@@ -2,23 +2,26 @@
|
|
|
2
2
|
// import Vue from 'vue'
|
|
3
3
|
import { MaliUtils, MlUtilsCore } from './utils'
|
|
4
4
|
import { MaliStorage, MlStorageCore } from './storage'
|
|
5
|
+
import { MaliModal } from './modal'
|
|
6
|
+
import { MaliToast } from './toast'
|
|
7
|
+
import { MaliLoading } from './loading'
|
|
5
8
|
|
|
6
9
|
export const MaliUI: {
|
|
7
10
|
version: string
|
|
8
11
|
// config(options: ConfigOptions): any
|
|
9
12
|
// install(app: Vue): void
|
|
10
13
|
MaliUtils: MlUtilsCore
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
+
MaliToast: typeof MaliToast
|
|
15
|
+
MaliModal: typeof MaliModal
|
|
16
|
+
MaliLoading: typeof MaliLoading
|
|
14
17
|
MaliStorage: MlStorageCore
|
|
15
18
|
}
|
|
16
19
|
|
|
17
20
|
export {
|
|
18
21
|
MaliUtils,
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
+
MaliToast,
|
|
23
|
+
MaliModal,
|
|
24
|
+
MaliLoading,
|
|
22
25
|
MaliStorage
|
|
23
26
|
}
|
|
24
27
|
|
package/types/modal.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export const MaliModal: {
|
|
2
|
+
alert(options: string | {
|
|
3
|
+
title?: string
|
|
4
|
+
content?: string
|
|
5
|
+
confirmButtonText?: string
|
|
6
|
+
}): Promise<'confirm' | 'cancel'>
|
|
7
|
+
confirm(options: string | {
|
|
8
|
+
title?: string
|
|
9
|
+
content?: string
|
|
10
|
+
confirmButtonText?: string
|
|
11
|
+
cancelButtonText?: string
|
|
12
|
+
}): Promise<'confirm' | 'cancel'>
|
|
13
|
+
}
|
package/types/toast.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export interface MlToastOptions {
|
|
2
|
+
content?: string
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
export const MaliToast: {
|
|
6
|
+
success(options?: string | MlToastOptions): Promise<void>
|
|
7
|
+
error(options?: string | MlToastOptions): Promise<void>
|
|
8
|
+
warning(options?: string | MlToastOptions): Promise<void>
|
|
9
|
+
hide(): Promise<void>
|
|
10
|
+
}
|
package/types/utils/index.d.ts
CHANGED
|
@@ -2,6 +2,31 @@ import 'xe-utils'
|
|
|
2
2
|
import { XEUtilsMethods } from 'xe-utils/ctor'
|
|
3
3
|
|
|
4
4
|
export interface MlUtilsCore extends XEUtilsMethods {
|
|
5
|
+
toDateString (date: any, format?: string): string
|
|
6
|
+
toStringDate (value: any): Date
|
|
7
|
+
|
|
8
|
+
checkForUpdate(): void
|
|
9
|
+
getPlatformEnv(): {
|
|
10
|
+
isH5: boolean
|
|
11
|
+
isWXMP: boolean
|
|
12
|
+
isQWMP: boolean
|
|
13
|
+
isDDMP: boolean
|
|
14
|
+
isZFBMP: boolean
|
|
15
|
+
}
|
|
16
|
+
getAppId(): string | null
|
|
17
|
+
getAppVersion(): string
|
|
18
|
+
getAppDpr(): number
|
|
19
|
+
|
|
20
|
+
getFileSuffix(filename: string): string
|
|
21
|
+
getFileName(filename: string): string
|
|
22
|
+
saveFileByUrl (url: string, name?: string): any
|
|
23
|
+
|
|
24
|
+
toNumMoneyToChinese (money: any): string
|
|
25
|
+
toAmountString (value: any, fixed?: number): string
|
|
26
|
+
toWanAmountString (value: any, fixed?: number): string
|
|
27
|
+
|
|
28
|
+
uniq<C = any>(list: any, iterate?: string | number | ((this: C, item: any, index: number, obj: any) => string | number), context?: C): any[];
|
|
29
|
+
|
|
5
30
|
[key: string]: any
|
|
6
31
|
}
|
|
7
32
|
|
package/utils/file.js
CHANGED
|
@@ -20,18 +20,24 @@ export function getFileName (url) {
|
|
|
20
20
|
* @param {*} name
|
|
21
21
|
*/
|
|
22
22
|
export function saveFileByUrl (url, name) {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
23
|
+
return new PromiseRejectionEvent((resolve, reject) => {
|
|
24
|
+
uni.downloadFile({
|
|
25
|
+
url,
|
|
26
|
+
success: (downRes) => {
|
|
27
|
+
uni.saveFile({
|
|
28
|
+
tempFilePath: downRes.tempFilePath,
|
|
29
|
+
success (res) {
|
|
30
|
+
uni.showModal({
|
|
31
|
+
title: '保存成功',
|
|
32
|
+
content: '路径:' + res.savedFilePath
|
|
33
|
+
})
|
|
34
|
+
resolve()
|
|
35
|
+
}
|
|
36
|
+
})
|
|
37
|
+
},
|
|
38
|
+
fail (e) {
|
|
39
|
+
reject(e)
|
|
40
|
+
}
|
|
41
|
+
})
|
|
36
42
|
})
|
|
37
43
|
}
|