ai.touchui-vue 1.35.2 → 1.36.0
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/ai.touchui-vue.common.js +146 -58
- package/lib/checkbox.js +2 -3
- package/lib/date-picker.js +9 -6
- package/lib/index.js +1 -1
- package/lib/input.js +3 -3
- package/lib/select.js +16 -3
- package/lib/table.js +82 -9
- package/lib/upload.js +3 -3
- package/package.json +4 -3
- package/packages/checkbox/src/checkbox.vue +0 -1
- package/packages/date-picker/src/date-picker.vue +15 -12
- package/packages/dialog/.DS_Store +0 -0
- package/packages/form/.DS_Store +0 -0
- package/packages/input/src/input.vue +1 -1
- package/packages/select/src/select.vue +6 -3
- package/packages/table/src/table.vue +53 -7
- package/packages/upload/src/upload.vue +1 -1
- package/src/index.js +1 -1
package/lib/input.js
CHANGED
|
@@ -206,7 +206,7 @@ module.exports = require("ai.touchui-vue/lib/mixins/locale");
|
|
|
206
206
|
// ESM COMPAT FLAG
|
|
207
207
|
__webpack_require__.r(__webpack_exports__);
|
|
208
208
|
|
|
209
|
-
// CONCATENATED MODULE: ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./packages/input/src/input.vue?vue&type=template&id=
|
|
209
|
+
// CONCATENATED MODULE: ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./packages/input/src/input.vue?vue&type=template&id=d10b5358
|
|
210
210
|
var render = function () {
|
|
211
211
|
var _vm = this
|
|
212
212
|
var _h = _vm.$createElement
|
|
@@ -613,7 +613,7 @@ var staticRenderFns = []
|
|
|
613
613
|
render._withStripped = true
|
|
614
614
|
|
|
615
615
|
|
|
616
|
-
// CONCATENATED MODULE: ./packages/input/src/input.vue?vue&type=template&id=
|
|
616
|
+
// CONCATENATED MODULE: ./packages/input/src/input.vue?vue&type=template&id=d10b5358
|
|
617
617
|
|
|
618
618
|
// CONCATENATED MODULE: ./src/utils/string.js
|
|
619
619
|
function filter(chars, from) {
|
|
@@ -1059,7 +1059,7 @@ var tip_default = /*#__PURE__*/__webpack_require__.n(tip_);
|
|
|
1059
1059
|
this.disabled = val;
|
|
1060
1060
|
},
|
|
1061
1061
|
type: function type(val) {
|
|
1062
|
-
if (val === 'password') {
|
|
1062
|
+
if (val === 'password' || val === 'number') {
|
|
1063
1063
|
this.itype = val;
|
|
1064
1064
|
} else {
|
|
1065
1065
|
this.itype = 'text';
|
package/lib/select.js
CHANGED
|
@@ -252,7 +252,7 @@ module.exports = require("ai.touchui-vue/lib/locale");
|
|
|
252
252
|
// ESM COMPAT FLAG
|
|
253
253
|
__webpack_require__.r(__webpack_exports__);
|
|
254
254
|
|
|
255
|
-
// CONCATENATED MODULE: ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./packages/select/src/select.vue?vue&type=template&id=
|
|
255
|
+
// CONCATENATED MODULE: ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./packages/select/src/select.vue?vue&type=template&id=f54e334e
|
|
256
256
|
var render = function () {
|
|
257
257
|
var _vm = this
|
|
258
258
|
var _h = _vm.$createElement
|
|
@@ -1102,6 +1102,11 @@ var render = function () {
|
|
|
1102
1102
|
placeholder:
|
|
1103
1103
|
_vm.placeholder,
|
|
1104
1104
|
},
|
|
1105
|
+
on: {
|
|
1106
|
+
focus: _vm.inputFocus,
|
|
1107
|
+
keyup: _vm.inputInput,
|
|
1108
|
+
blur: _vm.inputBlur,
|
|
1109
|
+
},
|
|
1105
1110
|
model: {
|
|
1106
1111
|
value: _vm.inputValue,
|
|
1107
1112
|
callback: function (
|
|
@@ -1124,6 +1129,11 @@ var render = function () {
|
|
|
1124
1129
|
on: {
|
|
1125
1130
|
clear:
|
|
1126
1131
|
_vm.filterClear,
|
|
1132
|
+
focus:
|
|
1133
|
+
_vm.filterFocus,
|
|
1134
|
+
keyup:
|
|
1135
|
+
_vm.filterInput,
|
|
1136
|
+
blur: _vm.filterBlur,
|
|
1127
1137
|
},
|
|
1128
1138
|
model: {
|
|
1129
1139
|
value:
|
|
@@ -1894,7 +1904,7 @@ var staticRenderFns = []
|
|
|
1894
1904
|
render._withStripped = true
|
|
1895
1905
|
|
|
1896
1906
|
|
|
1897
|
-
// CONCATENATED MODULE: ./packages/select/src/select.vue?vue&type=template&id=
|
|
1907
|
+
// CONCATENATED MODULE: ./packages/select/src/select.vue?vue&type=template&id=f54e334e
|
|
1898
1908
|
|
|
1899
1909
|
// EXTERNAL MODULE: external "ai.touchui-vue/lib/utils/ajax"
|
|
1900
1910
|
var ajax_ = __webpack_require__(15);
|
|
@@ -2432,6 +2442,7 @@ var lib_locale_ = __webpack_require__(3);
|
|
|
2432
2442
|
focused: false,
|
|
2433
2443
|
blurByLayer: false,
|
|
2434
2444
|
options: [],
|
|
2445
|
+
s_options: [],
|
|
2435
2446
|
anotherOptions: [], // 只作用于手机端
|
|
2436
2447
|
layerSlide: false,
|
|
2437
2448
|
layerPosition: 'auto',
|
|
@@ -2963,6 +2974,7 @@ var lib_locale_ = __webpack_require__(3);
|
|
|
2963
2974
|
arr.push(obj);
|
|
2964
2975
|
}
|
|
2965
2976
|
if (this.$phone && this.filterable) {
|
|
2977
|
+
this.s_options = arr.slice(0, 100);
|
|
2966
2978
|
this.options = arr.slice(0, 100);
|
|
2967
2979
|
this.anotherOptions = arr.slice(100);
|
|
2968
2980
|
} else {
|
|
@@ -2971,6 +2983,7 @@ var lib_locale_ = __webpack_require__(3);
|
|
|
2971
2983
|
} else {
|
|
2972
2984
|
// 如果是手机端,则先取前 100 项,再拼接后面的
|
|
2973
2985
|
if (this.$phone && this.filterable) {
|
|
2986
|
+
this.s_options = this.data.slice(0, 100);
|
|
2974
2987
|
this.options = this.data.slice(0, 100);
|
|
2975
2988
|
this.anotherOptions = this.data.slice(100);
|
|
2976
2989
|
} else {
|
|
@@ -3171,7 +3184,7 @@ var lib_locale_ = __webpack_require__(3);
|
|
|
3171
3184
|
_this15.$refs.popupFilter.focus();
|
|
3172
3185
|
}
|
|
3173
3186
|
_this15.$nextTick(function () {
|
|
3174
|
-
_this15.options = _this15.
|
|
3187
|
+
_this15.options = _this15.s_options.concat(_this15.anotherOptions);
|
|
3175
3188
|
});
|
|
3176
3189
|
}, 500);
|
|
3177
3190
|
}
|
package/lib/table.js
CHANGED
|
@@ -245,7 +245,7 @@ module.exports = require("ai.touchui-vue/lib/locale");
|
|
|
245
245
|
// ESM COMPAT FLAG
|
|
246
246
|
__webpack_require__.r(__webpack_exports__);
|
|
247
247
|
|
|
248
|
-
// CONCATENATED MODULE: ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./packages/table/src/table.vue?vue&type=template&id=
|
|
248
|
+
// CONCATENATED MODULE: ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./packages/table/src/table.vue?vue&type=template&id=a7feb1e0
|
|
249
249
|
var render = function () {
|
|
250
250
|
var _vm = this
|
|
251
251
|
var _h = _vm.$createElement
|
|
@@ -1064,7 +1064,7 @@ var staticRenderFns = []
|
|
|
1064
1064
|
render._withStripped = true
|
|
1065
1065
|
|
|
1066
1066
|
|
|
1067
|
-
// CONCATENATED MODULE: ./packages/table/src/table.vue?vue&type=template&id=
|
|
1067
|
+
// CONCATENATED MODULE: ./packages/table/src/table.vue?vue&type=template&id=a7feb1e0
|
|
1068
1068
|
|
|
1069
1069
|
// EXTERNAL MODULE: external "vue"
|
|
1070
1070
|
var external_vue_ = __webpack_require__(4);
|
|
@@ -3579,6 +3579,11 @@ function db(fn) {
|
|
|
3579
3579
|
default: function _default() {
|
|
3580
3580
|
return this.height && !this.fixTop ? '0r' : '1r';
|
|
3581
3581
|
}
|
|
3582
|
+
},
|
|
3583
|
+
// selectionChange 事件时是否需要将扁平数据转换为层级树形结构输出
|
|
3584
|
+
selectionValueType: {
|
|
3585
|
+
type: String,
|
|
3586
|
+
default: 'flat' // flat | tree
|
|
3582
3587
|
}
|
|
3583
3588
|
},
|
|
3584
3589
|
data: function data() {
|
|
@@ -3700,9 +3705,7 @@ function db(fn) {
|
|
|
3700
3705
|
this.iData.map(function (item) {
|
|
3701
3706
|
if (item._checked) {
|
|
3702
3707
|
var obj = JSON.parse(JSON.stringify(item));
|
|
3703
|
-
delete obj._index;
|
|
3704
3708
|
delete obj._checked;
|
|
3705
|
-
delete obj._level;
|
|
3706
3709
|
delete obj._show;
|
|
3707
3710
|
delete obj._hover;
|
|
3708
3711
|
delete obj._active;
|
|
@@ -4134,7 +4137,7 @@ function db(fn) {
|
|
|
4134
4137
|
if (leftThs.length > 0) {
|
|
4135
4138
|
for (var _j2 = 0; _j2 < leftThs.length; _j2++) {
|
|
4136
4139
|
var _th3 = _ths3[_j2];
|
|
4137
|
-
var leftTh = leftThs[
|
|
4140
|
+
var leftTh = leftThs[_j2];
|
|
4138
4141
|
leftTh.style.width = _th3.getBoundingClientRect().width + 'px';
|
|
4139
4142
|
leftTh.style.height = _th3.getBoundingClientRect().height + 'px';
|
|
4140
4143
|
}
|
|
@@ -4276,8 +4279,8 @@ function db(fn) {
|
|
|
4276
4279
|
}
|
|
4277
4280
|
});
|
|
4278
4281
|
this.$emit('change', this.checked, checked);
|
|
4279
|
-
this.$emit('selectionChange', this.checked);
|
|
4280
|
-
this.$emit('selection-change', this.checked);
|
|
4282
|
+
this.$emit('selectionChange', this.selectionValueType === 'tree' ? this.buildHierarchyTree(this.checked) : this.checked);
|
|
4283
|
+
this.$emit('selection-change', this.selectionValueType === 'tree' ? this.buildHierarchyTree(this.checked) : this.checked);
|
|
4281
4284
|
},
|
|
4282
4285
|
|
|
4283
4286
|
// 根据 checkbox 计算是否全选
|
|
@@ -4299,8 +4302,8 @@ function db(fn) {
|
|
|
4299
4302
|
}
|
|
4300
4303
|
this.setSelectAll();
|
|
4301
4304
|
this.$emit('change', this.checked, checked, current);
|
|
4302
|
-
this.$emit('selectionChange', this.checked, current);
|
|
4303
|
-
this.$emit('selection-change', this.checked, current);
|
|
4305
|
+
this.$emit('selectionChange', this.selectionValueType === 'tree' ? this.buildHierarchyTree(this.checked) : this.checked, current);
|
|
4306
|
+
this.$emit('selection-change', this.selectionValueType === 'tree' ? this.buildHierarchyTree(this.checked) : this.checked, current);
|
|
4304
4307
|
},
|
|
4305
4308
|
|
|
4306
4309
|
// 从记录中移除
|
|
@@ -4829,6 +4832,76 @@ function db(fn) {
|
|
|
4829
4832
|
this.collapseAll();
|
|
4830
4833
|
}
|
|
4831
4834
|
this.expandFlag = !this.expandFlag;
|
|
4835
|
+
},
|
|
4836
|
+
|
|
4837
|
+
// 将扁平数据转换为层级树形结构
|
|
4838
|
+
buildHierarchyTree: function buildHierarchyTree(flatData) {
|
|
4839
|
+
var result = [];
|
|
4840
|
+
var levelStack = [];
|
|
4841
|
+
|
|
4842
|
+
for (var _iterator = flatData, _isArray = Array.isArray(_iterator), _i7 = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {
|
|
4843
|
+
var _ref5;
|
|
4844
|
+
|
|
4845
|
+
if (_isArray) {
|
|
4846
|
+
if (_i7 >= _iterator.length) break;
|
|
4847
|
+
_ref5 = _iterator[_i7++];
|
|
4848
|
+
} else {
|
|
4849
|
+
_i7 = _iterator.next();
|
|
4850
|
+
if (_i7.done) break;
|
|
4851
|
+
_ref5 = _i7.value;
|
|
4852
|
+
}
|
|
4853
|
+
|
|
4854
|
+
var item = _ref5;
|
|
4855
|
+
|
|
4856
|
+
var currentNode = Object.assign({}, item);
|
|
4857
|
+
currentNode.children = [];
|
|
4858
|
+
|
|
4859
|
+
var level = currentNode._level;
|
|
4860
|
+
|
|
4861
|
+
// 清除高于当前level的节点
|
|
4862
|
+
while (levelStack.length && levelStack[levelStack.length - 1]._level >= level) {
|
|
4863
|
+
levelStack.pop();
|
|
4864
|
+
}
|
|
4865
|
+
|
|
4866
|
+
if (levelStack.length === 0) {
|
|
4867
|
+
// 当前是顶级节点
|
|
4868
|
+
result.push(currentNode);
|
|
4869
|
+
} else {
|
|
4870
|
+
// 插入到上一层级的 children 中
|
|
4871
|
+
var parent = levelStack[levelStack.length - 1];
|
|
4872
|
+
parent.children.push(currentNode);
|
|
4873
|
+
}
|
|
4874
|
+
|
|
4875
|
+
// 当前节点入栈
|
|
4876
|
+
levelStack.push(currentNode);
|
|
4877
|
+
}
|
|
4878
|
+
|
|
4879
|
+
// 清理空 children
|
|
4880
|
+
var cleanEmptyChildren = function cleanEmptyChildren(nodeList) {
|
|
4881
|
+
for (var _iterator2 = nodeList, _isArray2 = Array.isArray(_iterator2), _i8 = 0, _iterator2 = _isArray2 ? _iterator2 : _iterator2[Symbol.iterator]();;) {
|
|
4882
|
+
var _ref6;
|
|
4883
|
+
|
|
4884
|
+
if (_isArray2) {
|
|
4885
|
+
if (_i8 >= _iterator2.length) break;
|
|
4886
|
+
_ref6 = _iterator2[_i8++];
|
|
4887
|
+
} else {
|
|
4888
|
+
_i8 = _iterator2.next();
|
|
4889
|
+
if (_i8.done) break;
|
|
4890
|
+
_ref6 = _i8.value;
|
|
4891
|
+
}
|
|
4892
|
+
|
|
4893
|
+
var node = _ref6;
|
|
4894
|
+
|
|
4895
|
+
if (node.children.length === 0) {
|
|
4896
|
+
delete node.children;
|
|
4897
|
+
} else {
|
|
4898
|
+
cleanEmptyChildren(node.children);
|
|
4899
|
+
}
|
|
4900
|
+
}
|
|
4901
|
+
};
|
|
4902
|
+
|
|
4903
|
+
cleanEmptyChildren(result);
|
|
4904
|
+
return result;
|
|
4832
4905
|
}
|
|
4833
4906
|
}
|
|
4834
4907
|
});
|
package/lib/upload.js
CHANGED
|
@@ -825,7 +825,7 @@ module.exports = require("ai.touchui-vue/lib/locale");
|
|
|
825
825
|
// ESM COMPAT FLAG
|
|
826
826
|
__webpack_require__.r(__webpack_exports__);
|
|
827
827
|
|
|
828
|
-
// CONCATENATED MODULE: ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./packages/upload/src/upload.vue?vue&type=template&id=
|
|
828
|
+
// CONCATENATED MODULE: ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./packages/upload/src/upload.vue?vue&type=template&id=7e861ecf
|
|
829
829
|
var render = function () {
|
|
830
830
|
var _vm = this
|
|
831
831
|
var _h = _vm.$createElement
|
|
@@ -1571,7 +1571,7 @@ var staticRenderFns = []
|
|
|
1571
1571
|
render._withStripped = true
|
|
1572
1572
|
|
|
1573
1573
|
|
|
1574
|
-
// CONCATENATED MODULE: ./packages/upload/src/upload.vue?vue&type=template&id=
|
|
1574
|
+
// CONCATENATED MODULE: ./packages/upload/src/upload.vue?vue&type=template&id=7e861ecf
|
|
1575
1575
|
|
|
1576
1576
|
// EXTERNAL MODULE: external "ai.touchui-vue/lib/mixins/locale"
|
|
1577
1577
|
var locale_ = __webpack_require__(2);
|
|
@@ -2411,7 +2411,7 @@ var ICON = {
|
|
|
2411
2411
|
|
|
2412
2412
|
this.updateTipFileInfo();
|
|
2413
2413
|
|
|
2414
|
-
this.$emit('clear', this.iFiles
|
|
2414
|
+
this.$emit('clear', this.iFiles);
|
|
2415
2415
|
},
|
|
2416
2416
|
_transferStart: function _transferStart(file) {
|
|
2417
2417
|
if (!file.guid) return;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ai.touchui-vue",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.36.0",
|
|
4
4
|
"description": "TouchUI Component Library for Vue.js.",
|
|
5
5
|
"main": "lib/ai.touchui-vue.common.js",
|
|
6
6
|
"files": [
|
|
@@ -57,13 +57,15 @@
|
|
|
57
57
|
"vuedraggable": "2.24.3"
|
|
58
58
|
},
|
|
59
59
|
"devDependencies": {
|
|
60
|
+
"ssh2-sftp-client": "^12.0.0",
|
|
61
|
+
"ssh2": "1.14.0",
|
|
62
|
+
"archiver": "5.3.1",
|
|
60
63
|
"@typescript-eslint/eslint-plugin": "5.8.0",
|
|
61
64
|
"@vue/component-compiler-utils": "2.6.0",
|
|
62
65
|
"ai.touchui-chat": "^1.9.0",
|
|
63
66
|
"ai.touchui-desk": "0.0.43",
|
|
64
67
|
"ai.touchui-plugin": "^1.0.60",
|
|
65
68
|
"algoliasearch": "3.35.1",
|
|
66
|
-
"archiver": "5.3.1",
|
|
67
69
|
"babel-cli": "6.26.0",
|
|
68
70
|
"babel-core": "6.26.3",
|
|
69
71
|
"babel-loader": "7.1.5",
|
|
@@ -131,7 +133,6 @@
|
|
|
131
133
|
"select-version-cli": "0.0.2",
|
|
132
134
|
"sinon": "7.5.0",
|
|
133
135
|
"sinon-chai": "3.7.0",
|
|
134
|
-
"ssh2": "1.14.0",
|
|
135
136
|
"style-loader": "^1.0.0",
|
|
136
137
|
"transliteration": "1.6.6",
|
|
137
138
|
"uglifyjs-webpack-plugin": "2.2.0",
|
|
@@ -221,7 +221,7 @@ export default {
|
|
|
221
221
|
} else {
|
|
222
222
|
newValue = this.getDateFromValue(newValue, this.valueFormat)
|
|
223
223
|
this.date = newValue
|
|
224
|
-
this.datedisplay = this.formatDate(newValue, this.displayFormat,val)
|
|
224
|
+
this.datedisplay = this.formatDate(newValue, this.displayFormat, val)
|
|
225
225
|
}
|
|
226
226
|
}
|
|
227
227
|
},
|
|
@@ -259,28 +259,28 @@ export default {
|
|
|
259
259
|
handleDisplayBlur() {
|
|
260
260
|
setTimeout(() => {
|
|
261
261
|
if (isNaN(new Date(this.datedisplay))) {
|
|
262
|
-
if(this.datedisplay) {
|
|
262
|
+
if (this.datedisplay) {
|
|
263
263
|
this.$emit('errTime')
|
|
264
264
|
}
|
|
265
265
|
this.datedisplay = ''
|
|
266
|
-
this.changeValue('','')
|
|
266
|
+
this.changeValue('', '')
|
|
267
267
|
} else {
|
|
268
268
|
this.$emit('beforeChange', this.datedisplay)
|
|
269
269
|
if (!this.displayFormatRegExp.test(this.datedisplay)) {
|
|
270
|
-
this.datedisplay = this.formatDate(new Date(this.datedisplay), this.displayFormat,this.datedisplay)
|
|
271
|
-
this.iValue = this.formatDate(new Date(this.datedisplay), this.displayFormat,this.datedisplay)
|
|
270
|
+
this.datedisplay = this.formatDate(new Date(this.datedisplay), this.displayFormat, this.datedisplay)
|
|
271
|
+
this.iValue = this.formatDate(new Date(this.datedisplay), this.displayFormat, this.datedisplay)
|
|
272
272
|
this.$emit('change', this.iValue)
|
|
273
273
|
} else {
|
|
274
|
-
this.changeValue(this.getDateFromValue(this.datedisplay, this.displayFormat),this.datedisplay)
|
|
274
|
+
this.changeValue(this.getDateFromValue(this.datedisplay, this.displayFormat), this.datedisplay)
|
|
275
275
|
}
|
|
276
276
|
}
|
|
277
277
|
}, 100);
|
|
278
278
|
},
|
|
279
279
|
select(value) {
|
|
280
|
-
this.changeValue(value,'')
|
|
280
|
+
this.changeValue(value, '')
|
|
281
281
|
this.$refs.layer.close()
|
|
282
282
|
},
|
|
283
|
-
changeValue(value,oldVal) {
|
|
283
|
+
changeValue(value, oldVal) {
|
|
284
284
|
this.$emit('beforeChange', value)
|
|
285
285
|
if (!value) {
|
|
286
286
|
this.clear()
|
|
@@ -289,7 +289,7 @@ export default {
|
|
|
289
289
|
this.datedisplay = value.split(' ').length > 1 ? value.split(' ')[1] : value
|
|
290
290
|
this.iValue = value.split(' ').length > 1 ? value.split(' ')[1] : value
|
|
291
291
|
} else {
|
|
292
|
-
value = this.formatDate(new Date(value), 'yyyy-MM-dd HH:mm:ss',value)
|
|
292
|
+
value = this.formatDate(new Date(value), 'yyyy-MM-dd HH:mm:ss', value)
|
|
293
293
|
const flag = isNaN(new Date(value).getTime()) // 判断是否可以使用 2022-05 如果不可用,则替换为 2022/05
|
|
294
294
|
if (flag) {
|
|
295
295
|
value = value.replace(/-/g, '/')
|
|
@@ -303,8 +303,8 @@ export default {
|
|
|
303
303
|
if (flag) {
|
|
304
304
|
value = value.replace(/-/g, '/')
|
|
305
305
|
}
|
|
306
|
-
this.datedisplay = this.formatDate(new Date(value), this.displayFormat,oldVal)
|
|
307
|
-
this.iValue = this.formatDate(new Date(value), this.valueFormat,oldVal)
|
|
306
|
+
this.datedisplay = this.formatDate(new Date(value), this.displayFormat, oldVal)
|
|
307
|
+
this.iValue = this.formatDate(new Date(value), this.valueFormat, oldVal)
|
|
308
308
|
this.$emit('change', this.iValue)
|
|
309
309
|
}
|
|
310
310
|
},
|
|
@@ -395,7 +395,7 @@ export default {
|
|
|
395
395
|
if (!yMatch) return
|
|
396
396
|
return value.substr(yMatch.index, yMatch[0].length)
|
|
397
397
|
},
|
|
398
|
-
formatDate(date, fmt,value) {
|
|
398
|
+
formatDate(date, fmt, value) {
|
|
399
399
|
if (date) {
|
|
400
400
|
// 如果 this.type 不是 'datetime' 或 'time',检查 date 是否为有效的日期格式
|
|
401
401
|
if (this.type !== 'datetime' && this.type !== 'time' && value) {
|
|
@@ -446,6 +446,9 @@ export default {
|
|
|
446
446
|
},
|
|
447
447
|
setDisabled(f) {
|
|
448
448
|
this.disabled = f
|
|
449
|
+
},
|
|
450
|
+
focus() {
|
|
451
|
+
this.$refs.inputBox.focus()
|
|
449
452
|
}
|
|
450
453
|
}
|
|
451
454
|
};
|
|
Binary file
|
|
Binary file
|
|
@@ -124,8 +124,8 @@
|
|
|
124
124
|
<to-input v-else ref="popupFilter" v-model="multipleFilterValue" :sp-chars="false" width="full" prevent-focus :placeholder="selected.filter(item => !item.hide).length > 0 ? '' : placeholder "></to-input>
|
|
125
125
|
</template>
|
|
126
126
|
<template v-else>
|
|
127
|
-
<to-input v-if="inputable" ref="popupInput" v-model="inputValue" :sp-chars="spChars" prevent-focus width="full" :placeholder="placeholder"></to-input>
|
|
128
|
-
<to-input v-else ref="popupFilter" v-model="filterValue" :sp-chars="false" prevent-focus width="full" placeholder="筛选" @clear="filterClear"></to-input>
|
|
127
|
+
<to-input v-if="inputable" ref="popupInput" v-model="inputValue" :sp-chars="spChars" prevent-focus width="full" :placeholder="placeholder" @focus="inputFocus" @keyup="inputInput" @blur="inputBlur"></to-input>
|
|
128
|
+
<to-input v-else ref="popupFilter" v-model="filterValue" :sp-chars="false" prevent-focus width="full" placeholder="筛选" @clear="filterClear" @focus="filterFocus" @keyup="filterInput" @blur="filterBlur"></to-input>
|
|
129
129
|
</template>
|
|
130
130
|
</to-padding>
|
|
131
131
|
</to-grid-item>
|
|
@@ -505,6 +505,7 @@ export default {
|
|
|
505
505
|
focused: false,
|
|
506
506
|
blurByLayer: false,
|
|
507
507
|
options: [],
|
|
508
|
+
s_options: [],
|
|
508
509
|
anotherOptions: [], // 只作用于手机端
|
|
509
510
|
layerSlide: false,
|
|
510
511
|
layerPosition: 'auto',
|
|
@@ -1002,6 +1003,7 @@ export default {
|
|
|
1002
1003
|
arr.push(obj)
|
|
1003
1004
|
}
|
|
1004
1005
|
if (this.$phone && this.filterable) {
|
|
1006
|
+
this.s_options = arr.slice(0, 100)
|
|
1005
1007
|
this.options = arr.slice(0, 100)
|
|
1006
1008
|
this.anotherOptions = arr.slice(100)
|
|
1007
1009
|
} else {
|
|
@@ -1010,6 +1012,7 @@ export default {
|
|
|
1010
1012
|
} else {
|
|
1011
1013
|
// 如果是手机端,则先取前 100 项,再拼接后面的
|
|
1012
1014
|
if (this.$phone && this.filterable) {
|
|
1015
|
+
this.s_options = this.data.slice(0, 100)
|
|
1013
1016
|
this.options = this.data.slice(0, 100)
|
|
1014
1017
|
this.anotherOptions = this.data.slice(100)
|
|
1015
1018
|
} else {
|
|
@@ -1200,7 +1203,7 @@ export default {
|
|
|
1200
1203
|
this.$refs.popupFilter.focus()
|
|
1201
1204
|
}
|
|
1202
1205
|
this.$nextTick(() => {
|
|
1203
|
-
this.options = this.
|
|
1206
|
+
this.options = this.s_options.concat(this.anotherOptions)
|
|
1204
1207
|
})
|
|
1205
1208
|
}, 500);
|
|
1206
1209
|
}
|
|
@@ -344,6 +344,11 @@ export default {
|
|
|
344
344
|
default: function _default() {
|
|
345
345
|
return this.height && !this.fixTop ? '0r' : '1r'
|
|
346
346
|
}
|
|
347
|
+
},
|
|
348
|
+
// selectionChange 事件时是否需要将扁平数据转换为层级树形结构输出
|
|
349
|
+
selectionValueType: {
|
|
350
|
+
type: String,
|
|
351
|
+
default: 'flat' // flat | tree
|
|
347
352
|
}
|
|
348
353
|
},
|
|
349
354
|
data() {
|
|
@@ -456,9 +461,7 @@ export default {
|
|
|
456
461
|
this.iData.map(item => {
|
|
457
462
|
if (item._checked) {
|
|
458
463
|
const obj = JSON.parse(JSON.stringify(item))
|
|
459
|
-
delete obj._index
|
|
460
464
|
delete obj._checked
|
|
461
|
-
delete obj._level
|
|
462
465
|
delete obj._show
|
|
463
466
|
delete obj._hover
|
|
464
467
|
delete obj._active
|
|
@@ -867,7 +870,7 @@ export default {
|
|
|
867
870
|
if (leftThs.length > 0) {
|
|
868
871
|
for (let j = 0; j < leftThs.length; j++) {
|
|
869
872
|
const th = ths[j]
|
|
870
|
-
const leftTh = leftThs[
|
|
873
|
+
const leftTh = leftThs[j]
|
|
871
874
|
leftTh.style.width = th.getBoundingClientRect().width + 'px'
|
|
872
875
|
leftTh.style.height = th.getBoundingClientRect().height + 'px'
|
|
873
876
|
}
|
|
@@ -999,8 +1002,8 @@ export default {
|
|
|
999
1002
|
}
|
|
1000
1003
|
})
|
|
1001
1004
|
this.$emit('change', this.checked, checked)
|
|
1002
|
-
this.$emit('selectionChange', this.checked)
|
|
1003
|
-
this.$emit('selection-change', this.checked)
|
|
1005
|
+
this.$emit('selectionChange', this.selectionValueType === 'tree' ? this.buildHierarchyTree(this.checked) : this.checked)
|
|
1006
|
+
this.$emit('selection-change', this.selectionValueType === 'tree' ? this.buildHierarchyTree(this.checked) : this.checked)
|
|
1004
1007
|
},
|
|
1005
1008
|
// 根据 checkbox 计算是否全选
|
|
1006
1009
|
setSelectAll() {
|
|
@@ -1020,8 +1023,8 @@ export default {
|
|
|
1020
1023
|
}
|
|
1021
1024
|
this.setSelectAll()
|
|
1022
1025
|
this.$emit('change', this.checked, checked, current)
|
|
1023
|
-
this.$emit('selectionChange', this.checked, current)
|
|
1024
|
-
this.$emit('selection-change', this.checked, current)
|
|
1026
|
+
this.$emit('selectionChange', this.selectionValueType === 'tree' ? this.buildHierarchyTree(this.checked) : this.checked, current)
|
|
1027
|
+
this.$emit('selection-change', this.selectionValueType === 'tree' ? this.buildHierarchyTree(this.checked) : this.checked, current)
|
|
1025
1028
|
},
|
|
1026
1029
|
// 从记录中移除
|
|
1027
1030
|
removeFromCache(rowData) {
|
|
@@ -1488,6 +1491,49 @@ export default {
|
|
|
1488
1491
|
this.collapseAll()
|
|
1489
1492
|
}
|
|
1490
1493
|
this.expandFlag = !this.expandFlag
|
|
1494
|
+
},
|
|
1495
|
+
// 将扁平数据转换为层级树形结构
|
|
1496
|
+
buildHierarchyTree(flatData) {
|
|
1497
|
+
const result = [];
|
|
1498
|
+
const levelStack = [];
|
|
1499
|
+
|
|
1500
|
+
for (const item of flatData) {
|
|
1501
|
+
const currentNode = Object.assign({}, item);
|
|
1502
|
+
currentNode.children = [];
|
|
1503
|
+
|
|
1504
|
+
const level = currentNode._level;
|
|
1505
|
+
|
|
1506
|
+
// 清除高于当前level的节点
|
|
1507
|
+
while (levelStack.length && levelStack[levelStack.length - 1]._level >= level) {
|
|
1508
|
+
levelStack.pop();
|
|
1509
|
+
}
|
|
1510
|
+
|
|
1511
|
+
if (levelStack.length === 0) {
|
|
1512
|
+
// 当前是顶级节点
|
|
1513
|
+
result.push(currentNode);
|
|
1514
|
+
} else {
|
|
1515
|
+
// 插入到上一层级的 children 中
|
|
1516
|
+
const parent = levelStack[levelStack.length - 1];
|
|
1517
|
+
parent.children.push(currentNode);
|
|
1518
|
+
}
|
|
1519
|
+
|
|
1520
|
+
// 当前节点入栈
|
|
1521
|
+
levelStack.push(currentNode);
|
|
1522
|
+
}
|
|
1523
|
+
|
|
1524
|
+
// 清理空 children
|
|
1525
|
+
const cleanEmptyChildren = (nodeList) => {
|
|
1526
|
+
for (const node of nodeList) {
|
|
1527
|
+
if (node.children.length === 0) {
|
|
1528
|
+
delete node.children;
|
|
1529
|
+
} else {
|
|
1530
|
+
cleanEmptyChildren(node.children);
|
|
1531
|
+
}
|
|
1532
|
+
}
|
|
1533
|
+
};
|
|
1534
|
+
|
|
1535
|
+
cleanEmptyChildren(result);
|
|
1536
|
+
return result;
|
|
1491
1537
|
}
|
|
1492
1538
|
}
|
|
1493
1539
|
}
|