dfish-widget 1.0.34 → 1.0.36
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/index.esm.js +81 -53
- package/lib/index.esm.js.map +1 -1
- package/package.json +1 -1
package/lib/index.esm.js
CHANGED
|
@@ -2,7 +2,7 @@ import lodash from 'lodash';
|
|
|
2
2
|
import jquery from 'jquery';
|
|
3
3
|
import http from 'axios';
|
|
4
4
|
import Qs from 'qs';
|
|
5
|
-
import { h, mergeProps, toRaw, resolveComponent, openBlock, createElementBlock, createStaticVNode, createElementVNode, createBlock, withCtx, Fragment, createVNode, renderList, toDisplayString, createTextVNode, createCommentVNode, Teleport, computed, resolveDirective, withDirectives, unref, renderSlot, TransitionGroup, normalizeClass, getCurrentInstance, ref, onMounted, watch, createSlots, resolveDynamicComponent, normalizeStyle, withModifiers } from 'vue';
|
|
5
|
+
import { nextTick, h, mergeProps, toRaw, resolveComponent, openBlock, createElementBlock, createStaticVNode, createElementVNode, createBlock, withCtx, Fragment, createVNode, renderList, toDisplayString, createTextVNode, createCommentVNode, Teleport, computed, resolveDirective, withDirectives, unref, renderSlot, TransitionGroup, normalizeClass, getCurrentInstance, ref, onMounted, watch, createSlots, resolveDynamicComponent, normalizeStyle, withModifiers } from 'vue';
|
|
6
6
|
import ResizeObserver$1 from 'resize-observer-polyfill';
|
|
7
7
|
|
|
8
8
|
let u = navigator.userAgent.toLowerCase();
|
|
@@ -1417,8 +1417,12 @@ $$1.download = function(a, b) {
|
|
|
1417
1417
|
};
|
|
1418
1418
|
|
|
1419
1419
|
|
|
1420
|
-
$$1.wifiConfirm =
|
|
1421
|
-
|
|
1420
|
+
$$1.wifiConfirm = (a, b) => {
|
|
1421
|
+
if ($$1.x.wifiConfirm && plus.networkinfo.getCurrentType() != 3) {
|
|
1422
|
+
plus.nativeUI.confirm($$1.loc.connection_not_wifi, function(e){e.index === 0 && a.call(b);}, {buttons:[$$1.loc.confirm, $$1.loc.cancel]});
|
|
1423
|
+
} else {
|
|
1424
|
+
a.call(b);
|
|
1425
|
+
}
|
|
1422
1426
|
};
|
|
1423
1427
|
|
|
1424
1428
|
$$1.vm = $$1.view = (a) => {
|
|
@@ -1587,39 +1591,25 @@ const queryEncode = function(data, config) {
|
|
|
1587
1591
|
return contentType == 'application/x-www-form-urlencoded' ? Qs.stringify(data, {arrayFormat: 'repeat'}) : data
|
|
1588
1592
|
};
|
|
1589
1593
|
|
|
1590
|
-
$$1.ajax = function(cmd, args) {
|
|
1594
|
+
$$1.ajax = async function(cmd, args) {
|
|
1591
1595
|
let src = args ? $$1.urlFormat(cmd.src, args) : cmd.src;
|
|
1592
1596
|
if (!src && !cmd.request) {
|
|
1593
1597
|
return Promise.reject('$.ajax(): The first parameter must be an object, and the property(src) of the object is required.')
|
|
1594
1598
|
}
|
|
1595
|
-
let ctx = cmd.context || $$1.docView;
|
|
1596
|
-
let lock = ctx.ajaxLock;
|
|
1597
1599
|
let config = $$1.lodash.pick(cmd, ['headers', 'responseType']);
|
|
1598
1600
|
if (cmd.download) {
|
|
1599
1601
|
$$1.extend(config, {responseType: 'blob'});
|
|
1600
1602
|
}
|
|
1601
|
-
lock && lock();
|
|
1602
|
-
cmd.loading && ctx.pop('w-loading', cmd.loading);
|
|
1603
1603
|
if (cmd.request) {
|
|
1604
|
-
return cmd.request(cmd.data)
|
|
1605
|
-
lock && lock(false);
|
|
1606
|
-
cmd.loading && ctx.pop('w-loading', false);
|
|
1607
|
-
return res
|
|
1608
|
-
}).catch(ex => {
|
|
1609
|
-
lock && lock(false);
|
|
1610
|
-
cmd.loading && ctx.pop('w-loading', false);
|
|
1611
|
-
return Promise.reject(ex)
|
|
1612
|
-
})
|
|
1604
|
+
return cmd.request(cmd.data)
|
|
1613
1605
|
} else {
|
|
1614
1606
|
let method = (cmd.method || (cmd.data ? 'post' : 'get')).toLowerCase();
|
|
1615
1607
|
return (method === 'post' || method === 'put' || method === 'patch' ? $$1.http[method](src, queryEncode(cmd.data, config), config) : $$1.http[method](src, config))
|
|
1616
1608
|
.then(res => {
|
|
1617
|
-
lock && lock(false);
|
|
1618
1609
|
let data = res.data;
|
|
1619
|
-
if (cmd.filter) data = cmd.filter(res
|
|
1620
|
-
if (cmd.success) cmd.success(data
|
|
1621
|
-
if (cmd.complete) cmd.complete(res
|
|
1622
|
-
cmd.loading && ctx.pop('w-loading', false);
|
|
1610
|
+
if (cmd.filter) data = cmd.filter(res);
|
|
1611
|
+
if (cmd.success) cmd.success(data);
|
|
1612
|
+
if (cmd.complete) cmd.complete(res);
|
|
1623
1613
|
if (cmd.download) {
|
|
1624
1614
|
let disposition = res.headers['content-disposition'];
|
|
1625
1615
|
if (disposition) {
|
|
@@ -1636,10 +1626,8 @@ $$1.ajax = function(cmd, args) {
|
|
|
1636
1626
|
}
|
|
1637
1627
|
return data
|
|
1638
1628
|
}).catch(ex => {
|
|
1639
|
-
|
|
1640
|
-
if (cmd.
|
|
1641
|
-
if (cmd.complete) cmd.complete(ex.response, ctx, ex);
|
|
1642
|
-
cmd.loading && ctx.pop('w-loading', false);
|
|
1629
|
+
if (cmd.error) cmd.error(ex);
|
|
1630
|
+
if (cmd.complete) cmd.complete(ex.response, ex);
|
|
1643
1631
|
return Promise.reject(ex)
|
|
1644
1632
|
})
|
|
1645
1633
|
}
|
|
@@ -1710,6 +1698,16 @@ $$1.config = function(opt) {
|
|
|
1710
1698
|
}
|
|
1711
1699
|
};
|
|
1712
1700
|
|
|
1701
|
+
$$1.pop = (template, props, options = {}) => {
|
|
1702
|
+
const commander = $$1(options.target) || $$1.vm();
|
|
1703
|
+
return $$1.vm(commander).createPop(commander, template, props, options)
|
|
1704
|
+
};
|
|
1705
|
+
|
|
1706
|
+
$$1.submit = (request, options = {}) => {
|
|
1707
|
+
const commander = $$1(options.target) || $$1.vm();
|
|
1708
|
+
return commander.submit(request, options)
|
|
1709
|
+
};
|
|
1710
|
+
|
|
1713
1711
|
window.addEventListener('unhandledrejection', (event) => {
|
|
1714
1712
|
if ($$1.x.catchReject) {
|
|
1715
1713
|
$$1.x.catchReject(event);
|
|
@@ -1870,8 +1868,11 @@ const bindCache = {};
|
|
|
1870
1868
|
}
|
|
1871
1869
|
},
|
|
1872
1870
|
ajax(cmd) {
|
|
1873
|
-
|
|
1874
|
-
return $$1.ajax(cmd)
|
|
1871
|
+
this.ajaxLock && this.ajaxLock();
|
|
1872
|
+
return $$1.ajax(cmd).then((res) => {
|
|
1873
|
+
this.ajaxLock && this.ajaxLock(false);
|
|
1874
|
+
return res
|
|
1875
|
+
})
|
|
1875
1876
|
},
|
|
1876
1877
|
submit(request, cmd) {
|
|
1877
1878
|
if (typeof request === 'object') {
|
|
@@ -1884,17 +1885,22 @@ const bindCache = {};
|
|
|
1884
1885
|
if (request) {
|
|
1885
1886
|
cmd.request = request;
|
|
1886
1887
|
}
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
1888
|
+
return new Promise(async (resolve) => {
|
|
1889
|
+
await nextTick();
|
|
1890
|
+
const vm = $$1.vm(this);
|
|
1891
|
+
let d = cmd.validate || false;
|
|
1892
|
+
let f = vm.getFormList(d.range || cmd.range);
|
|
1893
|
+
let g = d.range && d.range != cmd.range ? vm.getFormList(cmd.range) : f;
|
|
1894
|
+
this.ajaxLock && this.ajaxLock();
|
|
1895
|
+
let isValid = await vm.valid(f, d.group);
|
|
1896
|
+
if (isValid) {
|
|
1897
|
+
let post = vm.getPostData(g);
|
|
1898
|
+
cmd.data = cmd.data ? $$1.extend(cmd.data, post) : post;
|
|
1899
|
+
resolve(this.ajax(cmd));
|
|
1900
|
+
} else {
|
|
1901
|
+
this.ajaxLock && this.ajaxLock(false);
|
|
1902
|
+
}
|
|
1903
|
+
})
|
|
1898
1904
|
},
|
|
1899
1905
|
pop(template, props, options) {
|
|
1900
1906
|
return $$1.vm(this).createPop(this, template, props, options)
|
|
@@ -2202,10 +2208,10 @@ var script$1g = {
|
|
|
2202
2208
|
return r
|
|
2203
2209
|
},
|
|
2204
2210
|
// 表单验证。如果检测到错误,将返回一个包含错误信息的数组 /@r -> range, n -> validate group name
|
|
2205
|
-
getValidError(range) {
|
|
2211
|
+
async getValidError(range) {
|
|
2206
2212
|
let e, q = this.getFormList(range);
|
|
2207
2213
|
for (let i = 0, l = q.length, c, v; i < l; i++) {
|
|
2208
|
-
if ((c = $$1(q[i])) && c.isFormWidget && (v = c.getValidError())) {
|
|
2214
|
+
if ((c = $$1(q[i])) && c.isFormWidget && (v = await c.getValidError())) {
|
|
2209
2215
|
if (!e) e = [];
|
|
2210
2216
|
if (!e.find(n => n.wid == v.wid)) e.push(v);
|
|
2211
2217
|
}
|
|
@@ -2213,14 +2219,14 @@ var script$1g = {
|
|
|
2213
2219
|
return e
|
|
2214
2220
|
},
|
|
2215
2221
|
// 表单验证。验证通过返回true /@ range -> validaterange
|
|
2216
|
-
valid(range) {
|
|
2222
|
+
async valid(range) {
|
|
2217
2223
|
if (this._err_ns) {
|
|
2218
2224
|
this._err_ns.forEach(v => {
|
|
2219
2225
|
let n = $$1.vueMap.get(v.wid);
|
|
2220
2226
|
n && n.warn(false);
|
|
2221
2227
|
});
|
|
2222
2228
|
}
|
|
2223
|
-
let e = this.getValidError(range);
|
|
2229
|
+
let e = await this.getValidError(range);
|
|
2224
2230
|
if (e) {
|
|
2225
2231
|
e.forEach(v => $$1.vueMap.get(v.wid).warn());
|
|
2226
2232
|
$$1.vueMap.get(e[0].wid).showErrorTip(e[0].text);
|
|
@@ -3650,7 +3656,7 @@ const O = {},
|
|
|
3650
3656
|
} else
|
|
3651
3657
|
hvOver();
|
|
3652
3658
|
});
|
|
3653
|
-
[o, this.el()].forEach(v => v[n]('mouseenter', hvOver));
|
|
3659
|
+
[o, this.el()].forEach(v => v && v[n]('mouseenter', hvOver));
|
|
3654
3660
|
document[n]('mousemove', hvMove);
|
|
3655
3661
|
}
|
|
3656
3662
|
},
|
|
@@ -5595,7 +5601,8 @@ var script$I = {
|
|
|
5595
5601
|
this.el().removeAttribute('w-tabbar-fixed-quickclosebutton');
|
|
5596
5602
|
this.resizeObserver++;
|
|
5597
5603
|
}
|
|
5598
|
-
|
|
5604
|
+
const b = $$1(e);
|
|
5605
|
+
b && b.vis && b.vis();
|
|
5599
5606
|
},
|
|
5600
5607
|
onBeforeLeave(e) {
|
|
5601
5608
|
if (!e.nextElementSibling) {
|
|
@@ -5975,11 +5982,13 @@ var script$A = {
|
|
|
5975
5982
|
isFocus: false,
|
|
5976
5983
|
hasBorder: false,
|
|
5977
5984
|
isPlural: false,
|
|
5985
|
+
loading: false,
|
|
5978
5986
|
warnClass: '',
|
|
5979
5987
|
labelVertical: false,
|
|
5980
5988
|
modifiedValue: mv,
|
|
5981
5989
|
defaultValue: mv,
|
|
5982
5990
|
placeholder_type: '',
|
|
5991
|
+
validIndex: 0,
|
|
5983
5992
|
}
|
|
5984
5993
|
},
|
|
5985
5994
|
methods: {
|
|
@@ -6016,15 +6025,30 @@ var script$A = {
|
|
|
6016
6025
|
return r && r.value ? r.value : r
|
|
6017
6026
|
}
|
|
6018
6027
|
},
|
|
6019
|
-
valid(trigger) {
|
|
6020
|
-
let error = this.getValidError(trigger);
|
|
6028
|
+
async valid(trigger) {
|
|
6029
|
+
let error = await this.getValidError(trigger);
|
|
6021
6030
|
if (error) {
|
|
6022
6031
|
this.warn();
|
|
6023
6032
|
this.showErrorTip(error.text);
|
|
6024
6033
|
}
|
|
6025
6034
|
return !error
|
|
6026
6035
|
},
|
|
6027
|
-
getValidError(trigger, val) {
|
|
6036
|
+
async getValidError(trigger, val) {
|
|
6037
|
+
let ques = trigger ? this.validTriggers[trigger] : this.validQueues;
|
|
6038
|
+
if (ques && (this.isNormal || (this.isReadonly && this.x.readonlyValidate))) {
|
|
6039
|
+
let v = val !== undefined ? val : this.isPlural ? this.groupFormVal() : this.formVal();
|
|
6040
|
+
if (typeof v !== 'string')
|
|
6041
|
+
v = Array.isArray(v) ? v.join(',') : v == null ? '' : ('' + v);
|
|
6042
|
+
v = v.trim();
|
|
6043
|
+
let hs = this.validHooks;
|
|
6044
|
+
for (let q of ques) {
|
|
6045
|
+
let rv = typeof q.rule !== 'object' ? q.rule : q.rule.value !== undefined ? q.rule.value : q.rule;
|
|
6046
|
+
let e = await hs[q.type](v, rv, q);
|
|
6047
|
+
if (e) return e
|
|
6048
|
+
}
|
|
6049
|
+
}
|
|
6050
|
+
},
|
|
6051
|
+
getValidErrorSync(trigger, val) {
|
|
6028
6052
|
let ques = trigger ? this.validTriggers[trigger] : this.validQueues;
|
|
6029
6053
|
if (ques && (this.isNormal || (this.isReadonly && this.x.readonlyValidate))) {
|
|
6030
6054
|
let v = val !== undefined ? val : this.isPlural ? this.groupFormVal() : this.formVal();
|
|
@@ -6226,10 +6250,13 @@ var script$A = {
|
|
|
6226
6250
|
if (v && (typeof rule === 'string' ? !$$1.eval(`${rule}.test(v)`, {rule, v}) : !rule.test(v)))
|
|
6227
6251
|
return this.formErr(que)
|
|
6228
6252
|
},
|
|
6229
|
-
validateHandler: (v, rule) => {
|
|
6230
|
-
let
|
|
6231
|
-
if (
|
|
6232
|
-
|
|
6253
|
+
validateHandler: async(v, rule, que) => {
|
|
6254
|
+
let rs = rule && rule(v);
|
|
6255
|
+
if (rs) {
|
|
6256
|
+
let text = await rs;
|
|
6257
|
+
if (text) {
|
|
6258
|
+
return this.formErr({type: 'validateHandler', rule: {text}})
|
|
6259
|
+
}
|
|
6233
6260
|
}
|
|
6234
6261
|
}
|
|
6235
6262
|
}
|
|
@@ -9859,8 +9886,9 @@ var script$b = {
|
|
|
9859
9886
|
}
|
|
9860
9887
|
this.x.format && this.doFormat();
|
|
9861
9888
|
},
|
|
9889
|
+
// #fixme: 暂时用getValidErrorSync
|
|
9862
9890
|
isUsableVal(v) {
|
|
9863
|
-
return !this.
|
|
9891
|
+
return !this.getValidErrorSync(null, v)
|
|
9864
9892
|
},
|
|
9865
9893
|
isFocusTarget(el) { // implement
|
|
9866
9894
|
return (this.$refs.buttonMinus && this.$refs.buttonMinus.contains(el)) || (this.$refs.buttonPlus && this.$refs.buttonPlus.contains(el))
|