bri-components 1.1.3 → 1.1.4
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/0.bri-components.min.js +1 -1
- package/lib/1.bri-components.min.js +1 -1
- package/lib/2.bri-components.min.js +1 -1
- package/lib/3.bri-components.min.js +1 -1
- package/lib/4.bri-components.min.js +1 -1
- package/lib/5.bri-components.min.js +1 -1
- package/lib/6.bri-components.min.js +1 -1
- package/lib/7.bri-components.min.js +1 -1
- package/lib/bri-components.min.js +6 -6
- package/lib/styles/bri-components.css +1 -1
- package/package.json +1 -1
- package/src/abolish/DshCascaders.less +11 -0
- package/src/{components/controls/base/DshCascaderMultiple.vue → abolish/DshCascaders.vue} +4 -23
- package/src/{components/list → abolish}/DshFlatTable.vue +1 -1
- package/src/abolish/DshTexts.less +13 -0
- package/src/{components/controls/base/textMultiple/DshTextMultiple.vue → abolish/DshTexts.vue} +4 -20
- package/src/components/controls/base/{textMultiple/MultipleInput.vue → BriInputs.vue} +13 -12
- package/src/components/controls/base/{ZUpload/YUploadImage.vue → BriUpload/BriUploadImage.vue} +56 -15
- package/src/components/controls/base/{ZUpload → BriUpload}/index.vue +11 -12
- package/src/components/controls/base/{ZUpload → BriUpload}/uploadMixin.js +2 -2
- package/src/components/controls/base/{DshCascader.vue → DshCascader/DshCascader.vue} +20 -16
- package/src/components/controls/base/DshCheckbox.vue +1 -1
- package/src/components/controls/base/DshCoordinates.vue +117 -109
- package/src/components/controls/base/DshEditor.vue +1 -1
- package/src/components/controls/base/DshInput.vue +9 -4
- package/src/components/controls/base/DshNumber/DshNumber.vue +2 -0
- package/src/components/controls/base/DshSelect.vue +1 -1
- package/src/components/controls/controlMap.js +6 -7
- package/src/components/controls/controlMixin.js +6 -5
- package/src/components/list/DshBox/DshBox.vue +7 -24
- package/src/components/list/DshBox/DshCard.vue +13 -72
- package/src/components/list/DshBox/DshList.vue +8 -136
- package/src/components/list/DshBox/DshPanel.vue +0 -110
- package/src/components/list/DshBox/DshTable.vue +1 -4
- package/src/components/list/ZTree.vue +0 -58
- package/src/components/other/ZIframe.vue +5 -0
- package/src/components/small/DshControlDefine.vue +5 -1
- package/src/components/small/DshPage.vue +1 -0
- package/src/index.js +11 -23
- package/src/styles/common/control.less +16 -17
- package/src/styles/components/controls/{MultipleInput.less → BriInputs.less} +1 -1
- package/src/styles/components/controls/{ZUpload.less → BriUpload.less} +4 -4
- package/src/styles/components/controls/DshCoordinates.less +53 -43
- package/src/styles/components/controls/DshNumber.less +18 -0
- package/src/styles/components/index.less +22 -16
- package/src/styles/components/list/DshBox/DshBox.less +20 -0
- package/src/styles/components/list/DshBox/DshCard.less +59 -0
- package/src/styles/components/list/DshBox/DshList.less +142 -0
- package/src/styles/components/list/DshBox/DshPanel.less +107 -0
- package/src/styles/components/list/DshBox/DshTable.less +4 -0
- package/src/styles/components/list/ZTree.less +52 -0
- package/src/styles/components/small/DshModal.less +1 -1
- package/src/styles/variables.less +1 -0
- package/src/utils/table.js +3 -2
- package/src/components/controls/base/YSerialNumber.vue +0 -43
- package/src/components/list/easyTable/index.js +0 -23
- package/src/components/list/easyTable/src/directives/clickoutside.js +0 -32
- package/src/components/list/easyTable/src/mixins/layerAdjustment.js +0 -62
- package/src/components/list/easyTable/src/settings/settings.js +0 -11
- package/src/components/list/easyTable/src/utils/deepClone.js +0 -256
- package/src/components/list/easyTable/src/utils/dom.js +0 -41
- package/src/components/list/easyTable/src/utils/utils.js +0 -190
- package/src/components/list/easyTable/v-checkbox/index.js +0 -7
- package/src/components/list/easyTable/v-checkbox/src/checkbox.vue +0 -127
- package/src/components/list/easyTable/v-checkbox-group/index.js +0 -7
- package/src/components/list/easyTable/v-checkbox-group/src/checkbox-group.vue +0 -68
- package/src/components/list/easyTable/v-dropdown/index.js +0 -7
- package/src/components/list/easyTable/v-dropdown/src/dropdown.vue +0 -337
- package/src/components/list/easyTable/v-table/index.js +0 -7
- package/src/components/list/easyTable/v-table/src/body-cell-merge-mixin.js +0 -141
- package/src/components/list/easyTable/v-table/src/cell-edit-mixin.js +0 -102
- package/src/components/list/easyTable/v-table/src/checkbox-selection-mixin.js +0 -189
- package/src/components/list/easyTable/v-table/src/classes-mixin.js +0 -56
- package/src/components/list/easyTable/v-table/src/drag-width-mixin.js +0 -202
- package/src/components/list/easyTable/v-table/src/export-csv.js +0 -74
- package/src/components/list/easyTable/v-table/src/frozen-columns-mixin.js +0 -134
- package/src/components/list/easyTable/v-table/src/loading.vue +0 -49
- package/src/components/list/easyTable/v-table/src/scroll-bar-control-mixin.js +0 -21
- package/src/components/list/easyTable/v-table/src/scroll-control-mixin.js +0 -92
- package/src/components/list/easyTable/v-table/src/sort-control-mixin.js +0 -108
- package/src/components/list/easyTable/v-table/src/table-empty-mixin.js +0 -73
- package/src/components/list/easyTable/v-table/src/table-empty.vue +0 -66
- package/src/components/list/easyTable/v-table/src/table-filters-mixin.js +0 -126
- package/src/components/list/easyTable/v-table/src/table-footer-mixin.js +0 -122
- package/src/components/list/easyTable/v-table/src/table-resize-mixin.js +0 -279
- package/src/components/list/easyTable/v-table/src/table-row-mouse-events-mixin.js +0 -123
- package/src/components/list/easyTable/v-table/src/table.vue +0 -1565
- package/src/components/list/easyTable/v-table/src/title-cell-merge-mixin.js +0 -115
- package/src/components/list/evTable/EvTable.vue +0 -321
- package/src/components/list/evTable/EvTableMixin.js +0 -26
- package/src/styles/components/list/evTable.less +0 -79
- package/src/styles/components/list/evtable/animation.less +0 -141
- package/src/styles/components/list/evtable/font/fontello.eot +0 -0
- package/src/styles/components/list/evtable/font/fontello.svg +0 -32
- package/src/styles/components/list/evtable/font/fontello.ttf +0 -0
- package/src/styles/components/list/evtable/font/fontello.woff +0 -0
- package/src/styles/components/list/evtable/font/fontello.woff2 +0 -0
- package/src/styles/components/list/evtable/fontello.less +0 -68
- package/src/styles/components/list/evtable/index.less +0 -5
- package/src/styles/components/list/evtable/v-checkbox.less +0 -167
- package/src/styles/components/list/evtable/v-dropdown.less +0 -235
- package/src/styles/components/list/evtable/v-table.less +0 -334
- package/src/styles/components/list/ivu_reset.less +0 -49
- /package/src/{styles/components/list → abolish}/DshFlatTable.less +0 -0
- /package/src/components/{pages/Error → Error}/Error403.vue +0 -0
- /package/src/components/{pages/Error → Error}/Error404.vue +0 -0
- /package/src/components/{pages/Error → Error}/Error500.vue +0 -0
- /package/src/components/{pages/Error → Error}/error.less +0 -0
- /package/src/components/{pages/Error → Error}/errorBack.vue +0 -0
- /package/src/components/controls/base/{ZUpload → BriUpload}/upload-list.vue +0 -0
- /package/src/components/controls/base/{ZUpload → BriUpload}/upload-listItem.vue +0 -0
- /package/src/components/{other → controls/base/DshCascader}/InfoCascader.vue +0 -0
- /package/src/styles/components/{other → controls}/InfoCascader.less +0 -0
- /package/src/styles/components/list/{DshCrossTable.less → DshBox/DshCrossTable.less} +0 -0
- /package/src/styles/components/list/{DshSingleData.less → DshBox/DshSingleData.less} +0 -0
|
@@ -1,337 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<dl :class="['v-dropdown',sizeClass]" v-click-outside="clickOutside">
|
|
3
|
-
<dt class="v-dropdown-dt">
|
|
4
|
-
<a :class="[isSelect ? 'v-dropdown-selected' :'']" @click.stop.prevent="toggleItems()" :style="{'width':width+'px'}">
|
|
5
|
-
<slot></slot>
|
|
6
|
-
</a>
|
|
7
|
-
</dt>
|
|
8
|
-
<dd v-show="visible" class="v-dropdown-dd">
|
|
9
|
-
<ul class="v-dropdown-items" :style="{'min-width':width+'px','max-width':getMaxWidth+'px'}">
|
|
10
|
-
|
|
11
|
-
<template v-if="isMultiple">
|
|
12
|
-
<v-checkbox-group is-vertical-show
|
|
13
|
-
:min="min"
|
|
14
|
-
:max="max"
|
|
15
|
-
@change="checkboxGroupChange"
|
|
16
|
-
v-model="checkboxGroupList"
|
|
17
|
-
>
|
|
18
|
-
<li v-for="(item, idx) in internalOptions" :key="idx"
|
|
19
|
-
:class="['v-dropdown-items-multiple',getTextAlignClass()]"
|
|
20
|
-
>
|
|
21
|
-
<v-checkbox :key="item.label" :label="item.label"
|
|
22
|
-
:showLine="item.showLine"></v-checkbox>
|
|
23
|
-
</li>
|
|
24
|
-
</v-checkbox-group>
|
|
25
|
-
</template>
|
|
26
|
-
<template v-else>
|
|
27
|
-
<li v-for="(item, idx) in internalOptions" :key="idx" @click.stop="selectOptionClick(item)"
|
|
28
|
-
:class="['v-dropdown-items-li',item.selected ? 'active' : '']">
|
|
29
|
-
<a :class="['v-dropdown-items-li-a',getTextAlignClass()]" href="javascript:void(0);">{{item.label}}</a>
|
|
30
|
-
</li>
|
|
31
|
-
</template>
|
|
32
|
-
|
|
33
|
-
<li v-if="showOperation" class="v-dropdown-operation">
|
|
34
|
-
<a @click.stop="confirm" class="v-dropdown-operation-item" href="javascript:void(0)">确认</a>
|
|
35
|
-
<a @click.stop="rest" class="v-dropdown-operation-item" href="javascript:void(0)">重置</a>
|
|
36
|
-
</li>
|
|
37
|
-
</ul>
|
|
38
|
-
</dd>
|
|
39
|
-
</dl>
|
|
40
|
-
</template>
|
|
41
|
-
|
|
42
|
-
<script>
|
|
43
|
-
import settings from "../../src/settings/settings.js";
|
|
44
|
-
import clickoutside from "../../src/directives/clickoutside.js";
|
|
45
|
-
|
|
46
|
-
import VCheckboxGroup from "../../v-checkbox-group/index";
|
|
47
|
-
import VCheckbox from "../../v-checkbox/index";
|
|
48
|
-
|
|
49
|
-
import layerAdjustment from "../../src/mixins/layerAdjustment.js";
|
|
50
|
-
|
|
51
|
-
export default {
|
|
52
|
-
name: "v-dropdown",
|
|
53
|
-
components: {
|
|
54
|
-
VCheckboxGroup, VCheckbox
|
|
55
|
-
},
|
|
56
|
-
mixins: [layerAdjustment],
|
|
57
|
-
directives: {
|
|
58
|
-
"click-outside": clickoutside
|
|
59
|
-
},
|
|
60
|
-
data () {
|
|
61
|
-
return {
|
|
62
|
-
|
|
63
|
-
visible: false,
|
|
64
|
-
|
|
65
|
-
internalOptions: [],
|
|
66
|
-
|
|
67
|
-
// checkboxGroup 选中的项
|
|
68
|
-
checkboxGroupList: [],
|
|
69
|
-
|
|
70
|
-
// 样式前缀
|
|
71
|
-
textAlignPrefix: "v-dropdown-items-li-a-",
|
|
72
|
-
|
|
73
|
-
inputValue: "",
|
|
74
|
-
|
|
75
|
-
// 是否有选项被改变(初始值为null 为了区分首次internalOptions 赋值的问题)
|
|
76
|
-
isOperationChange: null
|
|
77
|
-
};
|
|
78
|
-
},
|
|
79
|
-
props: {
|
|
80
|
-
// 如果是select 组件将特殊处理
|
|
81
|
-
isSelect: {
|
|
82
|
-
type: Boolean,
|
|
83
|
-
default: false
|
|
84
|
-
},
|
|
85
|
-
showOperation: {
|
|
86
|
-
type: Boolean,
|
|
87
|
-
default: false
|
|
88
|
-
},
|
|
89
|
-
size: {
|
|
90
|
-
type: String
|
|
91
|
-
},
|
|
92
|
-
|
|
93
|
-
width: {
|
|
94
|
-
type: Number,
|
|
95
|
-
default: 90
|
|
96
|
-
|
|
97
|
-
},
|
|
98
|
-
|
|
99
|
-
// select的最大宽度(超出隐藏)
|
|
100
|
-
maxWidth: {
|
|
101
|
-
type: Number
|
|
102
|
-
},
|
|
103
|
-
|
|
104
|
-
// 如果为true 会包含 checkbox
|
|
105
|
-
isMultiple: {
|
|
106
|
-
type: Boolean,
|
|
107
|
-
default: false
|
|
108
|
-
},
|
|
109
|
-
|
|
110
|
-
// 用户传入v-model 的值 [{value/label/selected}]
|
|
111
|
-
value: [Object, Array],
|
|
112
|
-
|
|
113
|
-
// 占位符
|
|
114
|
-
placeholder: {
|
|
115
|
-
type: String,
|
|
116
|
-
default: "请选择",
|
|
117
|
-
validator: function (value) {
|
|
118
|
-
return value.length > 0;
|
|
119
|
-
}
|
|
120
|
-
},
|
|
121
|
-
|
|
122
|
-
// 文本居中方式 left|center|right
|
|
123
|
-
textAlign: {
|
|
124
|
-
type: String,
|
|
125
|
-
default: "left"
|
|
126
|
-
},
|
|
127
|
-
|
|
128
|
-
// 最小选中数量
|
|
129
|
-
min: {
|
|
130
|
-
type: Number,
|
|
131
|
-
default: 0
|
|
132
|
-
},
|
|
133
|
-
|
|
134
|
-
// 最大选中数量
|
|
135
|
-
max: {
|
|
136
|
-
type: Number,
|
|
137
|
-
default: 999
|
|
138
|
-
},
|
|
139
|
-
|
|
140
|
-
// 是否支持输入input
|
|
141
|
-
isInput: {
|
|
142
|
-
type: Boolean,
|
|
143
|
-
default: false
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
},
|
|
147
|
-
computed: {
|
|
148
|
-
|
|
149
|
-
sizeClass () {
|
|
150
|
-
let size = settings.sizeMaps[this.size] || settings.sizeMapDefault;
|
|
151
|
-
return size === settings.sizeMaps["large"] ? " v-dropdown--large" : (size === settings.sizeMaps["middle"] ? " v-dropdown--middle" : " v-dropdown--small");
|
|
152
|
-
},
|
|
153
|
-
|
|
154
|
-
// 获取最大宽度(不设置则是无穷大)
|
|
155
|
-
getMaxWidth () {
|
|
156
|
-
let result = Infinity;
|
|
157
|
-
let maxWidth = this.maxWidth;
|
|
158
|
-
let width = this.width;
|
|
159
|
-
|
|
160
|
-
if (maxWidth && maxWidth > 0 && maxWidth > width) {
|
|
161
|
-
|
|
162
|
-
result = maxWidth;
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
return result;
|
|
166
|
-
}
|
|
167
|
-
},
|
|
168
|
-
methods: {
|
|
169
|
-
|
|
170
|
-
// 初始化
|
|
171
|
-
init () {
|
|
172
|
-
this.internalOptions = Object.assign([], this.value);
|
|
173
|
-
|
|
174
|
-
this.checkboxGroupList = this.selectedLabels();
|
|
175
|
-
|
|
176
|
-
if (this.isInput) {
|
|
177
|
-
this.setInputValue();
|
|
178
|
-
}
|
|
179
|
-
},
|
|
180
|
-
|
|
181
|
-
// operation filter confirm
|
|
182
|
-
confirm () {
|
|
183
|
-
if (this.isOperationChange) {
|
|
184
|
-
|
|
185
|
-
this.$emit("on-filter-method", this.internalOptions);
|
|
186
|
-
this.isOperationChange = false;
|
|
187
|
-
}
|
|
188
|
-
this.hideDropDown();
|
|
189
|
-
},
|
|
190
|
-
|
|
191
|
-
// operation filter reset
|
|
192
|
-
rest () {
|
|
193
|
-
if (this.internalOptions.some(x => x.selected)) {
|
|
194
|
-
this.internalOptions.map(x => {
|
|
195
|
-
if (x.selected) {
|
|
196
|
-
x.selected = false;
|
|
197
|
-
}
|
|
198
|
-
return x;
|
|
199
|
-
});
|
|
200
|
-
this.checkboxGroupList = [];
|
|
201
|
-
// 使用户传入的v-model 生效
|
|
202
|
-
this.$emit("input", this.internalOptions);
|
|
203
|
-
this.$emit("change");
|
|
204
|
-
// 修复执行两次的bug
|
|
205
|
-
/* this.$emit('on-filter-method',this.internalOptions);
|
|
206
|
-
this.isOperationChange = false; */
|
|
207
|
-
}
|
|
208
|
-
setTimeout(x => {
|
|
209
|
-
this.hideDropDown();
|
|
210
|
-
}, 50);
|
|
211
|
-
},
|
|
212
|
-
|
|
213
|
-
hideDropDown () {
|
|
214
|
-
if (this.showOperation && this.isOperationChange) {
|
|
215
|
-
this.$emit("on-filter-method", this.internalOptions);
|
|
216
|
-
this.isOperationChange = false;
|
|
217
|
-
}
|
|
218
|
-
this.visible = false;
|
|
219
|
-
},
|
|
220
|
-
|
|
221
|
-
showDropDown () {
|
|
222
|
-
this.visible = true;
|
|
223
|
-
},
|
|
224
|
-
|
|
225
|
-
// 设置文本框的值
|
|
226
|
-
setInputValue () {
|
|
227
|
-
let result;
|
|
228
|
-
let labels;
|
|
229
|
-
labels = this.selectedLabels();
|
|
230
|
-
if (Array.isArray(labels) && labels.length > 0) {
|
|
231
|
-
result = labels.join();
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
this.inputValue = result;
|
|
235
|
-
},
|
|
236
|
-
// checkbox 选中改变事件
|
|
237
|
-
checkboxGroupChange () {
|
|
238
|
-
|
|
239
|
-
this.selectOptionClick();
|
|
240
|
-
},
|
|
241
|
-
toggleItems () {
|
|
242
|
-
// this.visible = !this.visible;
|
|
243
|
-
if (this.visible) {
|
|
244
|
-
this.hideDropDown();
|
|
245
|
-
} else {
|
|
246
|
-
this.showDropDown();
|
|
247
|
-
this.$nextTick(x => {
|
|
248
|
-
this.dropDownClick();
|
|
249
|
-
});
|
|
250
|
-
}
|
|
251
|
-
},
|
|
252
|
-
selectOptionClick (item) {
|
|
253
|
-
if (!this.isMultiple) {
|
|
254
|
-
this.internalOptions.map((x) => {
|
|
255
|
-
if (item.label === x.label) {
|
|
256
|
-
x.selected = true;
|
|
257
|
-
} else {
|
|
258
|
-
x.selected = false;
|
|
259
|
-
}
|
|
260
|
-
return x;
|
|
261
|
-
});
|
|
262
|
-
} else { // 多选
|
|
263
|
-
this.internalOptions.map((x) => {
|
|
264
|
-
if (this.checkboxGroupList.includes(x.label)) {
|
|
265
|
-
x.selected = true;
|
|
266
|
-
} else {
|
|
267
|
-
x.selected = false;
|
|
268
|
-
}
|
|
269
|
-
return x;
|
|
270
|
-
});
|
|
271
|
-
}
|
|
272
|
-
|
|
273
|
-
if (!this.isMultiple) {
|
|
274
|
-
this.toggleItems();
|
|
275
|
-
}
|
|
276
|
-
|
|
277
|
-
if (this.isInput) {
|
|
278
|
-
this.setInputValue();
|
|
279
|
-
}
|
|
280
|
-
// 使用户传入的v-model 生效
|
|
281
|
-
this.$emit("input", this.internalOptions);
|
|
282
|
-
this.$emit("change");
|
|
283
|
-
},
|
|
284
|
-
|
|
285
|
-
// 获取样式名称
|
|
286
|
-
getTextAlignClass () {
|
|
287
|
-
return this.textAlignPrefix + this.textAlign;
|
|
288
|
-
},
|
|
289
|
-
|
|
290
|
-
// 当前选中项的label
|
|
291
|
-
selectedLabels () {
|
|
292
|
-
return this.internalOptions.filter(x => x.selected).map(x => {
|
|
293
|
-
if (x.selected) {
|
|
294
|
-
return x.label;
|
|
295
|
-
}
|
|
296
|
-
});
|
|
297
|
-
},
|
|
298
|
-
|
|
299
|
-
clickOutside () {
|
|
300
|
-
this.hideDropDown();
|
|
301
|
-
// this.visible = false
|
|
302
|
-
},
|
|
303
|
-
|
|
304
|
-
// 下拉点击显示
|
|
305
|
-
dropDownClick () {
|
|
306
|
-
let dtEle = this.$el.querySelector(".v-dropdown-dt");
|
|
307
|
-
let ddItem = this.$el.querySelector(".v-dropdown-items");
|
|
308
|
-
this.layerAdjustmentOnce(ddItem, dtEle, 2);
|
|
309
|
-
return false;
|
|
310
|
-
},
|
|
311
|
-
|
|
312
|
-
// 确定下拉框的位置
|
|
313
|
-
dropdownAdjust () {
|
|
314
|
-
let dtEle = this.$el.querySelector(".v-dropdown-dt");
|
|
315
|
-
let ddItem = this.$el.querySelector(".v-dropdown-items");
|
|
316
|
-
this.layerAdjustmentBind(ddItem, dtEle, 2);
|
|
317
|
-
}
|
|
318
|
-
|
|
319
|
-
},
|
|
320
|
-
|
|
321
|
-
created () {
|
|
322
|
-
this.init();
|
|
323
|
-
},
|
|
324
|
-
mounted () {
|
|
325
|
-
this.dropdownAdjust();
|
|
326
|
-
|
|
327
|
-
},
|
|
328
|
-
watch: {
|
|
329
|
-
"value": function (val) {
|
|
330
|
-
this.init();
|
|
331
|
-
},
|
|
332
|
-
"internalOptions": function (val) {
|
|
333
|
-
this.isOperationChange = !!((this.showOperation && this.isOperationChange !== null));
|
|
334
|
-
}
|
|
335
|
-
}
|
|
336
|
-
};
|
|
337
|
-
</script>
|
|
@@ -1,141 +0,0 @@
|
|
|
1
|
-
export default {
|
|
2
|
-
data () {
|
|
3
|
-
return {
|
|
4
|
-
// 跳过渲染的列集合
|
|
5
|
-
skipRenderCells: []
|
|
6
|
-
};
|
|
7
|
-
},
|
|
8
|
-
methods: {
|
|
9
|
-
/*
|
|
10
|
-
* isFrozenColumns:是否是固定列
|
|
11
|
-
* */
|
|
12
|
-
cellMergeInit (rowIndex, field, rowData, isFrozenColumns) {
|
|
13
|
-
// 包含在 skipRenderCells 内,则不渲染
|
|
14
|
-
if (this.skipRenderCells.indexOf(rowIndex + "-" + field) !== -1) {
|
|
15
|
-
return false;
|
|
16
|
-
}
|
|
17
|
-
let setting = this.cellMerge && this.cellMerge(rowIndex, rowData, field);
|
|
18
|
-
if (setting && ((setting.colSpan && setting.colSpan > 1) || (setting.rowSpan && setting.rowSpan > 1))) {
|
|
19
|
-
this.setSkipRenderCells(setting.colSpan, setting.rowSpan, rowIndex, field, isFrozenColumns);
|
|
20
|
-
}
|
|
21
|
-
return true;
|
|
22
|
-
},
|
|
23
|
-
|
|
24
|
-
// 设置不渲染的列
|
|
25
|
-
setSkipRenderCells (colSpan, rowSpan, rowIndex, field, isFrozenColumns) {
|
|
26
|
-
|
|
27
|
-
let columnsFields = isFrozenColumns ? this.getFrozenColumnsFields : this.getNoFrozenColumnsFields;
|
|
28
|
-
let skipCell = "";
|
|
29
|
-
let startPosX, endPosX, startPosY, endPosY;
|
|
30
|
-
|
|
31
|
-
endPosX = startPosX = columnsFields.indexOf(field);
|
|
32
|
-
if (colSpan && colSpan > 1) {
|
|
33
|
-
endPosX = startPosX + colSpan - 1;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
endPosY = startPosY = rowIndex;
|
|
37
|
-
if (rowSpan && rowSpan > 1) {
|
|
38
|
-
|
|
39
|
-
endPosY = rowIndex + rowSpan - 1;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
for (let posX = startPosX; posX <= endPosX; posX++) {
|
|
43
|
-
|
|
44
|
-
for (let posY = startPosY; posY <= endPosY; posY++) {
|
|
45
|
-
|
|
46
|
-
if (posX == startPosX && posY == startPosY) {
|
|
47
|
-
continue;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
skipCell = posY + "-" + columnsFields[posX];
|
|
51
|
-
|
|
52
|
-
// 避免状态改变重新渲染的情况
|
|
53
|
-
if (this.skipRenderCells.indexOf(skipCell) === -1) {
|
|
54
|
-
|
|
55
|
-
this.skipRenderCells.push(skipCell);
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
},
|
|
60
|
-
|
|
61
|
-
// 设置 colSpan
|
|
62
|
-
setColRowSpan (rowIndex, field, rowData) {
|
|
63
|
-
let result = {
|
|
64
|
-
colSpan: "",
|
|
65
|
-
rowSpan: ""
|
|
66
|
-
};
|
|
67
|
-
let setting = this.cellMerge && this.cellMerge(rowIndex, rowData, field);
|
|
68
|
-
if (setting) {
|
|
69
|
-
result = {
|
|
70
|
-
colSpan: setting.colSpan ? setting.colSpan : "",
|
|
71
|
-
rowSpan: setting.rowSpan ? setting.rowSpan : ""
|
|
72
|
-
};
|
|
73
|
-
}
|
|
74
|
-
return result;
|
|
75
|
-
},
|
|
76
|
-
|
|
77
|
-
/*
|
|
78
|
-
* 并检测不合法的设置,如果设置不合法则不会合并行和列
|
|
79
|
-
* */
|
|
80
|
-
isCellMergeRender (rowIndex, field, rowData) {
|
|
81
|
-
let setting = this.cellMerge && this.cellMerge(rowIndex, rowData, field);
|
|
82
|
-
if (setting && ((setting.colSpan && setting.colSpan > 0) || (setting.rowSpan && setting.rowSpan > 0))) {
|
|
83
|
-
return true;
|
|
84
|
-
}
|
|
85
|
-
return false;
|
|
86
|
-
},
|
|
87
|
-
|
|
88
|
-
// 获取行高
|
|
89
|
-
getRowHeightByRowSpan (rowIndex, field, rowData) {
|
|
90
|
-
let setting = this.cellMerge && this.cellMerge(rowIndex, rowData, field);
|
|
91
|
-
if (setting && (setting.rowSpan && setting.rowSpan > 1)) {
|
|
92
|
-
return this.rowHeight * setting.rowSpan;
|
|
93
|
-
}
|
|
94
|
-
return this.rowHeight;
|
|
95
|
-
},
|
|
96
|
-
|
|
97
|
-
/*
|
|
98
|
-
* 获取单元格宽度
|
|
99
|
-
* isFrozenColumns:是否是固定列
|
|
100
|
-
* */
|
|
101
|
-
getRowWidthByColSpan (rowIndex, field, rowData) {
|
|
102
|
-
let endPosX;
|
|
103
|
-
let startPosX;
|
|
104
|
-
let columnsFields = this.getColumnsFields;
|
|
105
|
-
let setting = this.cellMerge && this.cellMerge(rowIndex, rowData, field);
|
|
106
|
-
let colSpan = setting.colSpan;
|
|
107
|
-
let totalWidth = 0;
|
|
108
|
-
|
|
109
|
-
if (setting && (colSpan && colSpan >= 1)) {
|
|
110
|
-
startPosX = columnsFields.indexOf(field);
|
|
111
|
-
endPosX = startPosX + colSpan - 1;
|
|
112
|
-
for (let i = startPosX; i <= endPosX; i++) {
|
|
113
|
-
this.internalColumns.forEach(x => {
|
|
114
|
-
if (columnsFields[i] === x.field) {
|
|
115
|
-
totalWidth += x.width;
|
|
116
|
-
}
|
|
117
|
-
});
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
return totalWidth;
|
|
121
|
-
},
|
|
122
|
-
|
|
123
|
-
// 合并的单元格渲染的内容类型
|
|
124
|
-
cellMergeContentType (rowIndex, field, rowData) {
|
|
125
|
-
let result = {
|
|
126
|
-
isComponent: false,
|
|
127
|
-
isContent: false
|
|
128
|
-
};
|
|
129
|
-
let setting = this.cellMerge && this.cellMerge(rowIndex, rowData, field);
|
|
130
|
-
if (setting) {
|
|
131
|
-
if (setting.componentName && typeof setting.componentName === "string" && setting.componentName.length > 0) {
|
|
132
|
-
result.isComponent = true;
|
|
133
|
-
} else if (setting.content && setting.content.length > 0) {
|
|
134
|
-
result.isContent = true;
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
return result;
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
};
|
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
import utils from "../../src/utils/utils.js";
|
|
2
|
-
import {hasClass, addClass, removeClass} from "../../src/utils/dom.js";
|
|
3
|
-
|
|
4
|
-
export default {
|
|
5
|
-
|
|
6
|
-
methods: {
|
|
7
|
-
// cell edit
|
|
8
|
-
cellEdit (e, callback, rowIndex, rowData, field) {
|
|
9
|
-
|
|
10
|
-
let target = e.target;
|
|
11
|
-
let oldVal;
|
|
12
|
-
let editInput;
|
|
13
|
-
let editInputLen;
|
|
14
|
-
let actionFun;
|
|
15
|
-
let textAlign;
|
|
16
|
-
let childTarget;
|
|
17
|
-
|
|
18
|
-
while ((target.className && target.className.indexOf("v-table-body-cell") === -1) || !target.className) {
|
|
19
|
-
target = target.parentNode;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
// 子节点(span节点)
|
|
23
|
-
childTarget = target.children[0];
|
|
24
|
-
|
|
25
|
-
// 把子节点影藏掉
|
|
26
|
-
childTarget.style.display = "none";
|
|
27
|
-
|
|
28
|
-
if (hasClass(target, "cell-editing")) {
|
|
29
|
-
return false;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
addClass(target, "cell-editing");
|
|
33
|
-
|
|
34
|
-
oldVal = childTarget.innerText.trim();
|
|
35
|
-
|
|
36
|
-
if (target.style.textAlign) {
|
|
37
|
-
|
|
38
|
-
textAlign = target.style.textAlign;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
editInput = document.createElement("input");
|
|
42
|
-
editInput.value = oldVal;
|
|
43
|
-
editInput.className = "cell-edit-input";
|
|
44
|
-
editInput.style.textAlign = textAlign;
|
|
45
|
-
editInput.style.width = "100%";
|
|
46
|
-
editInput.style.height = "100%";
|
|
47
|
-
// editInput.style = `width:100%;height: 100%;text-align: ${textAlign};`;
|
|
48
|
-
|
|
49
|
-
target.appendChild(editInput);
|
|
50
|
-
|
|
51
|
-
editInput.focus();
|
|
52
|
-
|
|
53
|
-
editInputLen = editInput.value.length;
|
|
54
|
-
if (document.selection) {
|
|
55
|
-
let ctr = editInput.createTextRange();
|
|
56
|
-
ctr.moveStart("character", editInputLen);
|
|
57
|
-
ctr.collapse();
|
|
58
|
-
ctr.select();
|
|
59
|
-
} else if (typeof editInput.selectionStart == "number" && typeof editInput.selectionEnd == "number") {
|
|
60
|
-
editInput.selectionStart = editInput.selectionEnd = editInputLen;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
actionFun = function (e) {
|
|
64
|
-
|
|
65
|
-
if (typeof e.keyCode === "undefined" || e.keyCode === 0 || e.keyCode == 13) {
|
|
66
|
-
|
|
67
|
-
if (hasClass(target, "cell-editing")) {
|
|
68
|
-
|
|
69
|
-
removeClass(target, "cell-editing");
|
|
70
|
-
} else {
|
|
71
|
-
return false;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
childTarget.style.display = "";
|
|
75
|
-
|
|
76
|
-
// fixed this.value bug in IE9
|
|
77
|
-
callback(editInput.value, oldVal);
|
|
78
|
-
|
|
79
|
-
utils.unbind(editInput, "blur", actionFun);
|
|
80
|
-
utils.unbind(editInput, "keydown", actionFun);
|
|
81
|
-
|
|
82
|
-
target.removeChild(editInput);
|
|
83
|
-
}
|
|
84
|
-
};
|
|
85
|
-
|
|
86
|
-
utils.bind(editInput, "blur", actionFun);
|
|
87
|
-
utils.bind(editInput, "keydown", actionFun);
|
|
88
|
-
},
|
|
89
|
-
|
|
90
|
-
// 单元格点击
|
|
91
|
-
cellEditClick (e, isEdit, rowData, field, rowIndex) {
|
|
92
|
-
if (isEdit) {
|
|
93
|
-
let self = this;
|
|
94
|
-
// 单元格内容变化后的回调
|
|
95
|
-
let onCellEditCallBack = function (newValue, oldVal) {
|
|
96
|
-
self.cellEditDone && self.cellEditDone(newValue, oldVal, rowIndex, rowData, field);
|
|
97
|
-
};
|
|
98
|
-
this.cellEdit(e, onCellEditCallBack, rowIndex, rowData, field);
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
};
|