@deanwu/vue-component-library 1.2.24 → 1.2.26
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/vue-component-library.common.js +86 -128
- package/dist/vue-component-library.common.js.map +1 -1
- package/dist/vue-component-library.umd.js +86 -128
- package/dist/vue-component-library.umd.js.map +1 -1
- package/dist/vue-component-library.umd.min.js +1 -1
- package/dist/vue-component-library.umd.min.js.map +1 -1
- package/package.json +1 -1
|
@@ -106737,8 +106737,7 @@ var formvue_type_template_id_78333b22_staticRenderFns = [];
|
|
|
106737
106737
|
// CONCATENATED MODULE: ./src/assets/script/validate.js
|
|
106738
106738
|
|
|
106739
106739
|
|
|
106740
|
-
|
|
106741
|
-
const regexp = {
|
|
106740
|
+
const defauleRegexp = {
|
|
106742
106741
|
phone: /^T?1[0-9]{10}$/,
|
|
106743
106742
|
// 手机号
|
|
106744
106743
|
tel: /^(0[0-9]{2,3}\-?)?([2-9][0-9]{6,7})+(\-[0-9]{1,4})?$/,
|
|
@@ -106754,143 +106753,100 @@ const regexp = {
|
|
|
106754
106753
|
password: /^[\@A-Za-z0-9\!\#\$\%\^\&\*\.\~]{6,20}$/ // 密码,6-20位,包含字母、数字以及!、@、#、$、%、^、&、*、.、~
|
|
106755
106754
|
};
|
|
106756
106755
|
|
|
106757
|
-
|
|
106758
|
-
|
|
106759
|
-
|
|
106760
|
-
|
|
106761
|
-
if (rule.skip && rule.skip(value, data)) {
|
|
106762
|
-
return true;
|
|
106763
|
-
}
|
|
106764
|
-
switch (rule.type) {
|
|
106765
|
-
case 'empty':
|
|
106766
|
-
// 空值校验
|
|
106767
|
-
if (Array.isArray(value) && !value.length) return false;
|
|
106768
|
-
if (value === '' || value === undefined || value === null) return false;
|
|
106769
|
-
break;
|
|
106770
|
-
case 'regexp':
|
|
106771
|
-
// 正则校验
|
|
106772
|
-
var state = true;
|
|
106773
|
-
for (var i in rule.regexp) {
|
|
106774
|
-
var re = rule.regexp[i];
|
|
106775
|
-
if (!regexp[re] && !re.test) continue;
|
|
106776
|
-
if (regexp[re].test(value)) {
|
|
106777
|
-
state = true;
|
|
106778
|
-
if (rule.callback && rule.callback[re]) {
|
|
106779
|
-
rule.callback[re](value);
|
|
106780
|
-
}
|
|
106781
|
-
break;
|
|
106782
|
-
} else {
|
|
106783
|
-
state = false;
|
|
106784
|
-
}
|
|
106785
|
-
}
|
|
106786
|
-
return state;
|
|
106787
|
-
case 'function':
|
|
106788
|
-
// 自定义方法判断
|
|
106789
|
-
return rule.fun(value, data) || false;
|
|
106790
|
-
}
|
|
106791
|
-
return true;
|
|
106792
|
-
};
|
|
106793
|
-
var checkItem = function (opt, data, name, next) {
|
|
106794
|
-
var value = data[name],
|
|
106795
|
-
rule = opt.rule[name];
|
|
106796
|
-
if (typeof rule == 'string') {
|
|
106797
|
-
rule = [{
|
|
106798
|
-
type: 'empty',
|
|
106799
|
-
message: rule
|
|
106800
|
-
}];
|
|
106801
|
-
}
|
|
106802
|
-
if (typeof rule == 'function') {
|
|
106803
|
-
next && next(!!rule());
|
|
106804
|
-
return;
|
|
106805
|
-
}
|
|
106806
|
-
if (!rule || !rule.length) {
|
|
106807
|
-
next && next(true);
|
|
106808
|
-
return;
|
|
106809
|
-
}
|
|
106810
|
-
function loop(index) {
|
|
106811
|
-
var r = rule[index];
|
|
106812
|
-
if (r.type == 'async') {
|
|
106813
|
-
opt.SYS_AJAX({
|
|
106814
|
-
url: r.url,
|
|
106815
|
-
data: function () {
|
|
106816
|
-
var data = r.data || {};
|
|
106817
|
-
data[r.name] = value;
|
|
106818
|
-
return data;
|
|
106819
|
-
}(),
|
|
106820
|
-
success: function () {
|
|
106821
|
-
callback(index, true, r);
|
|
106822
|
-
}
|
|
106823
|
-
});
|
|
106824
|
-
} else {
|
|
106825
|
-
callback(index, checkRule(data, value, r), r);
|
|
106756
|
+
function checkRule(value, data, rule) {
|
|
106757
|
+
return new Promise(async resolve => {
|
|
106758
|
+
if (['regexp'].includes(rule.type) && (value === '' || value === undefined)) {
|
|
106759
|
+
resolve(true);
|
|
106826
106760
|
}
|
|
106827
|
-
|
|
106828
|
-
|
|
106829
|
-
if (state) {
|
|
106830
|
-
if (!r.pass || r.pass(name) !== false) {
|
|
106831
|
-
opt.pass && opt.pass(name, r.type);
|
|
106832
|
-
}
|
|
106833
|
-
} else {
|
|
106834
|
-
if (!r.fail || r.fail(name, r.message || '提交数据有误,请检查后重试') !== false) {
|
|
106835
|
-
r.message !== false && opt.fail && opt.fail(name, r.type, r.message || '提交数据有误,请检查后重试');
|
|
106836
|
-
}
|
|
106761
|
+
if (rule.skip && rule.skip(value, data)) {
|
|
106762
|
+
resolve(true);
|
|
106837
106763
|
}
|
|
106838
|
-
|
|
106839
|
-
|
|
106840
|
-
|
|
106841
|
-
|
|
106764
|
+
switch (rule.type) {
|
|
106765
|
+
case 'empty':
|
|
106766
|
+
// 空值校验
|
|
106767
|
+
if (Array.isArray(value) && !value.length) resolve(false);
|
|
106768
|
+
if (value === '' || value === undefined || value === null) resolve(false);
|
|
106769
|
+
break;
|
|
106770
|
+
case 'regexp':
|
|
106771
|
+
// 正则校验
|
|
106772
|
+
let regexp = Object.assign(defauleRegexp, external_commonjs_vue_commonjs2_vue_root_Vue_default.a.prototype.$compsConfig.validate.regexp);
|
|
106773
|
+
resolve(!!rule.regexp.find(item => {
|
|
106774
|
+
let re = typeof item == 'string' ? regexp[item] : item;
|
|
106775
|
+
return !re || re.test(value);
|
|
106776
|
+
}));
|
|
106777
|
+
break;
|
|
106778
|
+
case 'function':
|
|
106779
|
+
// 自定义方法判断
|
|
106780
|
+
resolve((await rule.fun(value, data)) || false);
|
|
106781
|
+
break;
|
|
106842
106782
|
}
|
|
106843
|
-
|
|
106844
|
-
|
|
106845
|
-
}
|
|
106846
|
-
|
|
106847
|
-
|
|
106848
|
-
|
|
106849
|
-
|
|
106850
|
-
|
|
106851
|
-
|
|
106852
|
-
|
|
106783
|
+
resolve(true);
|
|
106784
|
+
});
|
|
106785
|
+
}
|
|
106786
|
+
function checkItem(data, name, opt) {
|
|
106787
|
+
let rule = opt.rule[name];
|
|
106788
|
+
return new Promise(async resolve => {
|
|
106789
|
+
if (typeof rule == 'string') {
|
|
106790
|
+
rule = [{
|
|
106791
|
+
type: 'empty',
|
|
106792
|
+
message: rule
|
|
106793
|
+
}];
|
|
106794
|
+
}
|
|
106795
|
+
if (typeof rule == 'function') {
|
|
106796
|
+
resolve(!!rule(data));
|
|
106797
|
+
}
|
|
106798
|
+
if (!rule || !rule.length) {
|
|
106799
|
+
resolve(true);
|
|
106800
|
+
}
|
|
106801
|
+
for (let i in rule) {
|
|
106802
|
+
if (!(await checkRule(data[name], data, rule[i]))) {
|
|
106803
|
+
opt.fail(name, rule[i].type, rule[i].message || new external_commonjs_vue_commonjs2_vue_root_Vue_default.a({
|
|
106804
|
+
i18n: components_i18n
|
|
106805
|
+
}).$t('_t.validate.fail'));
|
|
106806
|
+
resolve(false);
|
|
106807
|
+
break;
|
|
106808
|
+
}
|
|
106809
|
+
;
|
|
106810
|
+
}
|
|
106811
|
+
resolve(true);
|
|
106812
|
+
});
|
|
106813
|
+
}
|
|
106814
|
+
;
|
|
106815
|
+
async function vaildate(data, opt, callback) {
|
|
106816
|
+
if (!Object.keys(opt.rule).length) {
|
|
106853
106817
|
callback(true);
|
|
106854
106818
|
return;
|
|
106855
106819
|
}
|
|
106856
|
-
|
|
106857
|
-
|
|
106858
|
-
if (
|
|
106859
|
-
|
|
106860
|
-
|
|
106861
|
-
checkItem(opt, data, name, itemCallback);
|
|
106862
|
-
}
|
|
106863
|
-
function itemCallback(s) {
|
|
106864
|
-
if (!s) {
|
|
106865
|
-
state = false;
|
|
106866
|
-
if (!opt.vaildAll) {
|
|
106867
|
-
callback && callback(false);
|
|
106868
|
-
return;
|
|
106869
|
-
}
|
|
106870
|
-
}
|
|
106871
|
-
if (index == arr.length - 1) {
|
|
106872
|
-
callback && callback(state);
|
|
106873
|
-
} else {
|
|
106874
|
-
loop(++index);
|
|
106875
|
-
}
|
|
106820
|
+
for (let name in opt.rule) {
|
|
106821
|
+
if (opt.skip[name] && opt.skip[name](data)) continue;
|
|
106822
|
+
if (!(await checkItem(data, name, opt))) {
|
|
106823
|
+
callback(false);
|
|
106824
|
+
return;
|
|
106876
106825
|
}
|
|
106877
|
-
|
|
106878
|
-
}
|
|
106879
|
-
|
|
106826
|
+
;
|
|
106827
|
+
}
|
|
106828
|
+
callback(true);
|
|
106829
|
+
}
|
|
106830
|
+
;
|
|
106831
|
+
/* harmony default export */ var validate = (function (data, opt) {
|
|
106880
106832
|
opt = Object.assign({
|
|
106881
106833
|
rule: {},
|
|
106882
|
-
|
|
106883
|
-
|
|
106884
|
-
|
|
106834
|
+
skip: {},
|
|
106835
|
+
fail: (name, type, message) => {
|
|
106836
|
+
external_commonjs_vue_commonjs2_vue_root_Vue_default.a.prototype.$message({
|
|
106837
|
+
message
|
|
106885
106838
|
});
|
|
106886
106839
|
},
|
|
106887
106840
|
success: function () {}
|
|
106888
106841
|
}, opt);
|
|
106889
|
-
|
|
106890
|
-
|
|
106842
|
+
return new Promise(resolve => {
|
|
106843
|
+
vaildate(data, opt, function (state) {
|
|
106844
|
+
state && opt.success(data);
|
|
106845
|
+
resolve(state);
|
|
106846
|
+
});
|
|
106891
106847
|
});
|
|
106892
|
-
};
|
|
106893
|
-
|
|
106848
|
+
});
|
|
106849
|
+
;
|
|
106894
106850
|
// CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js??ref--13-0!./node_modules/babel-loader/lib!./node_modules/cache-loader/dist/cjs.js??ref--1-0!./node_modules/vue-loader/lib??vue-loader-options!./src/components/form/index.vue?vue&type=script&lang=js&
|
|
106895
106851
|
|
|
106896
106852
|
|
|
@@ -110829,7 +110785,7 @@ var message_component = normalizeComponent(
|
|
|
110829
110785
|
|
|
110830
110786
|
)
|
|
110831
110787
|
|
|
110832
|
-
/* harmony default export */ var
|
|
110788
|
+
/* harmony default export */ var popup_message = (message_component.exports);
|
|
110833
110789
|
// CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"c9e84250-vue-loader-template"}!./node_modules/cache-loader/dist/cjs.js??ref--13-0!./node_modules/babel-loader/lib!./node_modules/vue-loader/lib/loaders/templateLoader.js??ref--6!./node_modules/cache-loader/dist/cjs.js??ref--1-0!./node_modules/vue-loader/lib??vue-loader-options!./src/components/popup/notice.vue?vue&type=template&id=73f5d106&scoped=true&
|
|
110834
110790
|
var noticevue_type_template_id_73f5d106_scoped_true_render = function render() {
|
|
110835
110791
|
var _vm = this,
|
|
@@ -113815,7 +113771,9 @@ function global_install(Vue, config) {
|
|
|
113815
113771
|
opt.params = opt.data;
|
|
113816
113772
|
delete opt.data;
|
|
113817
113773
|
}
|
|
113818
|
-
opt.loading && this.$loading(
|
|
113774
|
+
opt.loading && this.$loading({
|
|
113775
|
+
timeout: config.request.timeout
|
|
113776
|
+
});
|
|
113819
113777
|
const source = axios_default.a.CancelToken.source();
|
|
113820
113778
|
axios_default.a.create({
|
|
113821
113779
|
baseURL: config.request.baseUrl,
|
|
@@ -114075,7 +114033,7 @@ const GLOBAL_COMPS = [upload, public_clipboard, dialog_min];
|
|
|
114075
114033
|
|
|
114076
114034
|
|
|
114077
114035
|
|
|
114078
|
-
const DYNAMIC_COMPS = [loading,
|
|
114036
|
+
const DYNAMIC_COMPS = [loading, popup_message, notice, popup_confirm, popup_preview];
|
|
114079
114037
|
|
|
114080
114038
|
|
|
114081
114039
|
|