Skip to content

Commit

Permalink
build v2.6.10
Browse files Browse the repository at this point in the history
  • Loading branch information
smallweis committed Jul 3, 2020
1 parent de0f985 commit f2cf9f0
Show file tree
Hide file tree
Showing 10 changed files with 34 additions and 43 deletions.
4 changes: 2 additions & 2 deletions examples/element-ui/form/date.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

<body>
<div id="app">
{{form}}
<avue-form v-model="form" :option="option" @submit="submit">
<template slot-scope="{}" slot="daterangeLabel">
<span>姓名&nbsp;&nbsp;</span>
Expand Down Expand Up @@ -59,7 +60,7 @@
endPlaceholder: '日期结束范围自定义',
}, {
label: "时间范围",
value: 'timerange',
prop: 'timerange',
type: 'timerange',
startPlaceholder: '时间开始范围自定义',
endPlaceholder: '时间结束范围自定义',
Expand All @@ -70,7 +71,6 @@
minRows: 6,
}, {
label: "时间日期范围",
value: 'datetimerange',
span: 6,
type: 'datetimerange',
startPlaceholder: '时间日期开始范围自定义',
Expand Down
1 change: 0 additions & 1 deletion examples/element-ui/form/upload.html
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@
{
label: '字符串图片组',
prop: 'string',
dataType: 'string',
type: 'upload',
propsHttp: {
res: 'data.0'
Expand Down
32 changes: 14 additions & 18 deletions lib/avue.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* Avue.js v2.6.9
* Avue.js v2.6.10
* (c) 2017-2020 Smallwei
* Released under the MIT License.
*
Expand Down Expand Up @@ -281,7 +281,7 @@ exports.default = function () {
},
separator: {
type: String,
default: _variable.DIC_SPLIT
default: ','
},
formslot: {
type: Boolean,
Expand Down Expand Up @@ -474,7 +474,6 @@ exports.default = function () {

this.text = (0, _dataformat.initVal)({
type: this.type,
listType: this.listType,
multiple: this.multiple,
dataType: this.dataType,
value: this.value,
Expand Down Expand Up @@ -515,12 +514,9 @@ exports.default = function () {
result = value.target.value;
}
}
if (this.isString || this.isNumber || this.stringMode) {
if (this.isString || this.isNumber || this.stringMode || this.listType === "picture-img") {
if (Array.isArray(value)) result = value.join(',');
}
if (this.listType === "picture-img") {
result = value.join(',');
}
if (typeof this.change === 'function') {
this.change({ value: result, column: this.column });
}
Expand Down Expand Up @@ -1253,21 +1249,21 @@ var dateList = exports.dateList = ['dates', 'date', 'datetime', 'datetimerange',
* 初始化数据格式
*/
var initVal = exports.initVal = function initVal(_ref) {
var listType = _ref.listType,
type = _ref.type,
var type = _ref.type,
multiple = _ref.multiple,
dataType = _ref.dataType,
value = _ref.value,
callback = _ref.callback,
separator = _ref.separator;
_ref$separator = _ref.separator,
separator = _ref$separator === undefined ? ',' : _ref$separator;

var list = value;
if (['select', 'tree'].includes(type) && multiple || ['daterange', 'datetimerange', 'monthrange', 'datas', 'checkbox', 'cascader', 'dynamic', 'upload', 'img', 'array', 'map'].includes(type)) {
if (!Array.isArray(list)) {
if ((0, _validate.validatenull)(list)) {
list = [];
} else {
list = list.split(separator || ',') || [];
list = list.split(separator) || [];
callback && callback();
}
}
Expand Down Expand Up @@ -1582,14 +1578,14 @@ var loadCascaderDic = exports.loadCascaderDic = function loadCascaderDic(columnO
});
};
// 初始化方法
var loadDic = exports.loadDic = function loadDic(option) {
var loadDic = exports.loadDic = function loadDic(option, flag) {
var locationdic = {}; // 本地字典
var networkdic = {}; // 网络字典
var ajaxdic = []; // 发送ajax的字典
return new Promise(function (resolve, reject) {
var params = createdDic(option);
locationdic = Object.assign(cacheDic(option), params.locationdic);
ajaxdic = params.ajaxdic;
ajaxdic = flag ? [] : params.ajaxdic;
if ((0, _validate.validatenull)(locationdic) && (0, _validate.validatenull)(ajaxdic)) resolve();
if (!window.axios && !(0, _validate.validatenull)(ajaxdic)) {
_packages2.default.logs('axios');
Expand Down Expand Up @@ -11250,7 +11246,7 @@ exports.default = (0, _create2.default)({
var _this = this;

var list = [];
var flag = this.isArray || this.isString;
var flag = this.isArray || this.isString || this.stringMode;
(this.text || []).forEach(function (ele, index) {
if (ele) {
var name = void 0;
Expand Down Expand Up @@ -11284,7 +11280,7 @@ exports.default = (0, _create2.default)({
if (typeof this.change === "function") this.change({ value: this.text, column: this.column });
},
handleSuccess: function handleSuccess(file) {
if (this.isArray || this.isString) {
if (this.isArray || this.isString || this.stringMode) {
this.text.push(file[this.urlKey]);
} else if (this.isPictureImg) {
this.text.splice(0, 1, file[this.urlKey]);
Expand All @@ -11309,7 +11305,7 @@ exports.default = (0, _create2.default)({
delete: function _delete(file) {
var _this2 = this;

if (this.isArray || this.isString) {
if (this.isArray || this.isString || this.stringMode) {
(this.text || []).forEach(function (ele, index) {
if (ele === file.url) _this2.text.splice(index, 1);
});
Expand Down Expand Up @@ -22778,7 +22774,7 @@ Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_lib_selector_type_script_index_0_index_vue__ = __webpack_require__(66);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_lib_selector_type_script_index_0_index_vue___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_lib_selector_type_script_index_0_index_vue__);
/* harmony namespace reexport (unknown) */ for(var __WEBPACK_IMPORT_KEY__ in __WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_lib_selector_type_script_index_0_index_vue__) if(__WEBPACK_IMPORT_KEY__ !== 'default') (function(key) { __webpack_require__.d(__webpack_exports__, key, function() { return __WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_lib_selector_type_script_index_0_index_vue__[key]; }) }(__WEBPACK_IMPORT_KEY__));
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__node_modules_vue_loader_lib_template_compiler_index_id_data_v_72b1a2f5_hasScoped_false_preserveWhitespace_false_buble_transforms_node_modules_vue_loader_lib_selector_type_template_index_0_index_vue__ = __webpack_require__(222);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__node_modules_vue_loader_lib_template_compiler_index_id_data_v_516f30da_hasScoped_false_preserveWhitespace_false_buble_transforms_node_modules_vue_loader_lib_selector_type_template_index_0_index_vue__ = __webpack_require__(222);
var normalizeComponent = __webpack_require__(0)
/* script */

Expand All @@ -22795,7 +22791,7 @@ var __vue_scopeId__ = null
var __vue_module_identifier__ = null
var Component = normalizeComponent(
__WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_lib_selector_type_script_index_0_index_vue___default.a,
__WEBPACK_IMPORTED_MODULE_1__node_modules_vue_loader_lib_template_compiler_index_id_data_v_72b1a2f5_hasScoped_false_preserveWhitespace_false_buble_transforms_node_modules_vue_loader_lib_selector_type_template_index_0_index_vue__["a" /* default */],
__WEBPACK_IMPORTED_MODULE_1__node_modules_vue_loader_lib_template_compiler_index_id_data_v_516f30da_hasScoped_false_preserveWhitespace_false_buble_transforms_node_modules_vue_loader_lib_selector_type_template_index_0_index_vue__["a" /* default */],
__vue_template_functional__,
__vue_styles__,
__vue_scopeId__,
Expand Down
4 changes: 2 additions & 2 deletions lib/avue.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@smallwei/avue",
"version": "2.6.9",
"version": "2.6.10",
"description": "A Magic Configurable Web Framework",
"main": "lib/avue.min.js",
"unpkg": "lib/avue.min.js",
Expand Down
6 changes: 1 addition & 5 deletions packages/core/common/event.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ export default function () {
initVal () {
this.text = initVal({
type: this.type,
listType: this.listType,
multiple: this.multiple,
dataType: this.dataType,
value: this.value,
Expand Down Expand Up @@ -48,12 +47,9 @@ export default function () {
result = value.target.value;
}
}
if (this.isString || this.isNumber || this.stringMode) {
if (this.isString || this.isNumber || this.stringMode || this.listType === "picture-img") {
if (Array.isArray(value)) result = value.join(',')
}
if (this.listType === "picture-img") {
result = value.join(',')
}
if (typeof this.change === 'function') {
this.change({ value: result, column: this.column });
}
Expand Down
2 changes: 1 addition & 1 deletion packages/core/common/props.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export default function () {
},
separator: {
type: String,
default: DIC_SPLIT
default: ','
},
formslot: {
type: Boolean,
Expand Down
6 changes: 3 additions & 3 deletions packages/element-ui/upload/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ export default create({
},
fileList () {
let list = [];
const flag = this.isArray || this.isString;
const flag = this.isArray || this.isString || this.stringMode;
(this.text || []).forEach((ele, index) => {
if (ele) {
let name;
Expand Down Expand Up @@ -235,7 +235,7 @@ export default create({
this.change({ value: this.text, column: this.column });
},
handleSuccess (file) {
if (this.isArray || this.isString) {
if (this.isArray || this.isString || this.stringMode) {
this.text.push(file[this.urlKey]);
} else if (this.isPictureImg) {
this.text.splice(0, 1, file[this.urlKey])
Expand All @@ -258,7 +258,7 @@ export default create({
}
},
delete (file) {
if (this.isArray || this.isString) {
if (this.isArray || this.isString || this.stringMode) {
(this.text || []).forEach((ele, index) => {
if (ele === file.url) this.text.splice(index, 1);
});
Expand Down
6 changes: 3 additions & 3 deletions src/core/dataformat.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export const dateList = [
/**
* 初始化数据格式
*/
export const initVal = ({ listType, type, multiple, dataType, value, callback, separator }) => {
export const initVal = ({ type, multiple, dataType, value, callback, separator = ',' }) => {
let list = value;
if (
(['select', 'tree'].includes(type) && multiple) ||
Expand All @@ -69,7 +69,7 @@ export const initVal = ({ listType, type, multiple, dataType, value, callback, s
if (validatenull(list)) {
list = [];
} else {
list = list.split(separator || ',') || [];
list = list.split(separator) || [];
callback && callback();
}
}
Expand Down Expand Up @@ -218,7 +218,7 @@ export const formInitVal = (list = []) => {
};
};

export const getPlaceholder = function(column, type) {
export const getPlaceholder = function (column, type) {
const placeholder = column.placeholder;
const label = column.label;
if (type === 'search') {
Expand Down
14 changes: 7 additions & 7 deletions src/core/dic.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,14 @@ export const loadCascaderDic = (columnOption, list) => {
});
};
// 初始化方法
export const loadDic = (option, ) => {
export const loadDic = (option, flag) => {
let locationdic = {}; // 本地字典
let networkdic = {}; // 网络字典
let ajaxdic = []; // 发送ajax的字典
return new Promise((resolve, reject) => {
const params = createdDic(option);
locationdic = Object.assign(cacheDic(option), params.locationdic);
ajaxdic = params.ajaxdic;
ajaxdic = flag ? [] : params.ajaxdic;
if (validatenull(locationdic) && validatenull(ajaxdic)) resolve();
if (!window.axios && !validatenull(ajaxdic)) {
packages.logs('axios');
Expand All @@ -81,7 +81,7 @@ export const loadDic = (option, ) => {
});
};

function cacheDic (option) {
function cacheDic(option) {
let locationdic = {};
let alldic = option.dicData || {};
option.column.forEach(ele => {
Expand All @@ -93,7 +93,7 @@ function cacheDic (option) {
return locationdic;
}
// 创建字典区分本地字典和网络字典
function createdDic (option) {
function createdDic(option) {
let column = option.column || [];
let ajaxdic = [];
let locationdic = {};
Expand Down Expand Up @@ -128,7 +128,7 @@ function createdDic (option) {
}

// 循环处理字典
function handeDic (list) {
function handeDic(list) {
let networkdic = {};
let result = [];
return new Promise(resolve => {
Expand Down Expand Up @@ -182,15 +182,15 @@ export const sendDic = (params) => {
resolve([]);
}
if (method === 'post') {
window.axios.post(url, query).then(function (res) {
window.axios.post(url, query).then(function(res) {
callback(res);
}).catch(() => [
resolve([])
]);
} else {
window.axios.get(url, {
params: query
}).then(function (res) {
}).then(function(res) {
callback(res);
}).catch(() => [
resolve([])
Expand Down

0 comments on commit f2cf9f0

Please sign in to comment.