bri-components 1.4.7 → 1.4.9
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/README.md
CHANGED
|
@@ -28,3 +28,57 @@ npm test
|
|
|
28
28
|
```
|
|
29
29
|
|
|
30
30
|
For a detailed explanation on how things work, check out the [guide](http://vuejs-templates.github.io/webpack/) and [docs for vue-loader](http://vuejs.github.io/vue-loader).
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
保证npm登录状态
|
|
47
|
+
npm login
|
|
48
|
+
|
|
49
|
+
~前端正常npm包发布流程~
|
|
50
|
+
bri-components:(此包简单,不用压缩)
|
|
51
|
+
npm version patch
|
|
52
|
+
npm publish
|
|
53
|
+
|
|
54
|
+
bri-datas和bri-utils:
|
|
55
|
+
第一次操作的,先准备以下(之后发包不用重复操作)
|
|
56
|
+
-package.json里改成"main": "lib/bri-datas.min.js"(指向压缩文件)
|
|
57
|
+
-git stash save
|
|
58
|
+
发包步骤
|
|
59
|
+
npm version patch
|
|
60
|
+
git stash apply
|
|
61
|
+
npm run lib:prod
|
|
62
|
+
npm publish
|
|
63
|
+
git push
|
|
64
|
+
git reset origin/dev --hard
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
~前端项目应急npm包发布流程~(尽量避免发应急包)
|
|
68
|
+
需发布npm预发布号的包:
|
|
69
|
+
找到项目包使用包的version
|
|
70
|
+
git checkout -b <branch name> <version name>(eg: git checkout -b dsh v1.4.7)
|
|
71
|
+
git push --set-upstream origin <branch name>
|
|
72
|
+
修改 => commit
|
|
73
|
+
发包(此时用npm version release)
|
|
74
|
+
git checkout dev
|
|
75
|
+
git merge <branch name>
|
|
76
|
+
git branch <branch name> -d
|
|
77
|
+
git push origin <branch name> -d
|
|
78
|
+
git checkout dev
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
除外需将所有tag推向remote(偶尔操作一下即可)
|
|
82
|
+
git push --tags
|
|
83
|
+
|
|
84
|
+
另:修改npm包前最好先git pull(频繁发包,这种习惯log记录清晰)
|
package/package.json
CHANGED
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
<!-- 表格展示模式 -->
|
|
51
51
|
<template v-else>
|
|
52
52
|
<bri-table
|
|
53
|
-
v-show="showListData.length"
|
|
53
|
+
v-show="showListData.length && !isSearching"
|
|
54
54
|
ref="briTable"
|
|
55
55
|
class="DshFlatTable-main"
|
|
56
56
|
:columns="showColumns"
|
|
@@ -60,6 +60,17 @@
|
|
|
60
60
|
@changeSelect="changeSelect"
|
|
61
61
|
@selectAll="changeSelect"
|
|
62
62
|
></bri-table>
|
|
63
|
+
<bri-table
|
|
64
|
+
v-show="showListData.length && isSearching"
|
|
65
|
+
ref="briTable"
|
|
66
|
+
class="DshFlatTable-main"
|
|
67
|
+
:columns="showColumns"
|
|
68
|
+
:data="showListData"
|
|
69
|
+
:footer-data="footerData"
|
|
70
|
+
:propsObj="tablePropsObj"
|
|
71
|
+
@changeSelect="changeSelect"
|
|
72
|
+
@selectAll="changeSelect"
|
|
73
|
+
></bri-table>
|
|
63
74
|
<bri-table
|
|
64
75
|
v-show="!showListData.length"
|
|
65
76
|
class="DshFlatTable-main"
|
|
@@ -169,26 +169,24 @@ export default {
|
|
|
169
169
|
// 非底部按钮添加时
|
|
170
170
|
if (row) {
|
|
171
171
|
// 寻找对应的行数据 -当前列是合并列会寻找,普通列不用找(就是row)
|
|
172
|
-
if (this.mergeRowColKeys.includes(curColKey)) {
|
|
173
|
-
const newList = this.allListData.slice(rowIndex); //
|
|
174
|
-
const nextRowIndex = this
|
|
175
|
-
|
|
176
|
-
: newList.findIndex(rowItem => !this.isCompareSame(column, row, rowItem)); // 寻找该单元格值开始不一样的行(特殊情况是最后一行,nextRowIndex为-1)
|
|
172
|
+
if (this.mergeRowColKeys.includes(curColKey) && this.rowspanMap[this.getMixKey(row, column)] > 1) {
|
|
173
|
+
const newList = this.allListData.slice(rowIndex + 1); // 从下一行开始截取
|
|
174
|
+
const nextRowIndex = newList.findIndex(rowItem => this.rowspanMap[this.getMixKey(rowItem, column)] > 0); // 寻找该单元格值开始不一样的行
|
|
175
|
+
// nextRowIndex为-1,代表最后一行
|
|
177
176
|
row = nextRowIndex < 0
|
|
178
177
|
? newList[newList.length - 1]
|
|
179
|
-
: newList[nextRowIndex - 1];
|
|
178
|
+
: newList[nextRowIndex - 1];
|
|
179
|
+
rowIndex = list.findIndex(dataItem => dataItem._id === row._id);
|
|
180
180
|
}
|
|
181
181
|
|
|
182
182
|
// 寻找要复制值的列
|
|
183
183
|
// 当前列:一级合并列,不复制值;
|
|
184
184
|
if (this.firstMergeRowColKeys.includes(curColKey)) {
|
|
185
|
-
// 新增的行做rowspan记录
|
|
186
185
|
this.mergeRowColKeys.forEach(colKey => {
|
|
187
|
-
this.rowspanMap[this.getMixKey(newRow, { _key: colKey })] = 1;
|
|
186
|
+
this.rowspanMap[this.getMixKey(newRow, { _key: colKey })] = 1;
|
|
188
187
|
});
|
|
189
188
|
}
|
|
190
|
-
// 当前列:普通合并列(非一级合并列)
|
|
191
|
-
// 当前列:非合并列 -全部复制值给新的行
|
|
189
|
+
// 当前列:普通合并列(非一级合并列)-该列之前的合并列和一级合并列复制值给新的行;非合并列-全部复制值给新的行
|
|
192
190
|
else {
|
|
193
191
|
const notFirstCopyColKeys = this.notFirstMergeRowColKeys.includes(curColKey)
|
|
194
192
|
? this.notFirstMergeRowColKeys.filter((colKey, colIndex, list) => colIndex < list.findIndex(colKey => colKey === curColKey))
|
|
@@ -205,21 +203,26 @@ export default {
|
|
|
205
203
|
});
|
|
206
204
|
}, newRow);
|
|
207
205
|
|
|
208
|
-
//
|
|
206
|
+
// rowspan记录
|
|
209
207
|
copyColKeys.forEach(colKey => {
|
|
210
|
-
|
|
211
|
-
this.rowspanMap[this.getMixKey(
|
|
212
|
-
|
|
208
|
+
// 合并的单元格更新rowspan记录
|
|
209
|
+
const fistMergeRow = this.rowspanMap[this.getMixKey(row, { _key: colKey })] === 0
|
|
210
|
+
? list.slice(0, rowIndex).findLast(rowItem => this.rowspanMap[this.getMixKey(rowItem, { _key: colKey })] > 1)
|
|
211
|
+
: row;
|
|
212
|
+
this.rowspanMap[this.getMixKey(fistMergeRow, { _key: colKey })] = this.rowspanMap[this.getMixKey(fistMergeRow, { _key: colKey })] + 1;
|
|
213
|
+
|
|
214
|
+
// 新增的单元格做rowspan记录
|
|
215
|
+
this.rowspanMap[this.getMixKey(newRow, { _key: colKey })] = 0;
|
|
216
|
+
});
|
|
213
217
|
noCopyColKeys.forEach(colKey => {
|
|
214
|
-
this.rowspanMap[this.getMixKey(newRow, { _key: colKey })] = 1;
|
|
218
|
+
this.rowspanMap[this.getMixKey(newRow, { _key: colKey })] = 1;
|
|
215
219
|
});
|
|
216
220
|
}
|
|
217
221
|
}
|
|
218
222
|
// 底部按钮添加时
|
|
219
223
|
else {
|
|
220
|
-
// 新增的行做rowspan记录
|
|
221
224
|
this.mergeRowColKeys.forEach(colKey => {
|
|
222
|
-
this.rowspanMap[this.getMixKey(newRow, { _key: colKey })] = 1;
|
|
225
|
+
this.rowspanMap[this.getMixKey(newRow, { _key: colKey })] = 1;
|
|
223
226
|
});
|
|
224
227
|
}
|
|
225
228
|
}
|
|
@@ -237,13 +240,35 @@ export default {
|
|
|
237
240
|
title: "提示",
|
|
238
241
|
content: "确定删除吗?",
|
|
239
242
|
onOk: () => {
|
|
243
|
+
const list = this.data;
|
|
244
|
+
|
|
240
245
|
// 处理单元格合并相关
|
|
241
246
|
if (this.mergeRowColKeys.length) {
|
|
242
247
|
this.mergeRowColKeys.forEach(colKey => {
|
|
243
|
-
|
|
248
|
+
const column = { _key: colKey };
|
|
249
|
+
const rowIndex = list.findIndex(dataItem => dataItem._id === row._id);
|
|
250
|
+
|
|
251
|
+
// 当前单元格合并了下面的 -把合并数减去1给下一单元格
|
|
252
|
+
if (this.rowspanMap[this.getMixKey(row, column)] > 1) {
|
|
253
|
+
const nextRow = list[rowIndex + 1];
|
|
254
|
+
this.rowspanMap[this.getMixKey(nextRow, column)] = this.rowspanMap[this.getMixKey(row, column)] - 1;
|
|
255
|
+
}
|
|
256
|
+
// 当前单元格被上面的合并了 -最上面的合并单元格合并数减去1
|
|
257
|
+
else if (this.rowspanMap[this.getMixKey(row, column)] === 0) {
|
|
258
|
+
const fistMergeRow = list.slice(0, rowIndex).findLast(rowItem => this.rowspanMap[this.getMixKey(rowItem, column)] > 1);
|
|
259
|
+
this.rowspanMap[this.getMixKey(fistMergeRow, column)] = this.rowspanMap[this.getMixKey(fistMergeRow, column)] - 1;
|
|
260
|
+
}
|
|
261
|
+
// 当前单元格单独存在(无合并)
|
|
262
|
+
else if (this.rowspanMap[this.getMixKey(row, column)] === 1) {
|
|
263
|
+
// 无处理
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
// 清除被删除单元格的rowspan记录
|
|
267
|
+
delete this.rowspanMap[this.getMixKey(row, column)];
|
|
244
268
|
});
|
|
245
269
|
}
|
|
246
|
-
|
|
270
|
+
|
|
271
|
+
list.splice(rowIndex, 1);
|
|
247
272
|
|
|
248
273
|
this.change("deleteRow", row, rowIndex, null);
|
|
249
274
|
}
|
|
@@ -296,61 +321,24 @@ export default {
|
|
|
296
321
|
let rowspan = 1;
|
|
297
322
|
rowIndex = list.findIndex(dataItem => dataItem._id === row._id);
|
|
298
323
|
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
rowIndex
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
324
|
+
// 合并单元格的列走这
|
|
325
|
+
if (this.mergeRowColKeys.includes(column._key)) {
|
|
326
|
+
rowIndex = list.findIndex(dataItem => dataItem._id === row._id);
|
|
327
|
+
|
|
328
|
+
// 代表显示出来的行
|
|
329
|
+
if (rowIndex > -1) {
|
|
330
|
+
if (rowIndex !== 0 && this.isCompareSame(column, row, list[rowIndex - 1])) {
|
|
331
|
+
rowspan = 0;
|
|
332
|
+
} else {
|
|
333
|
+
const newList = list.slice(rowIndex + 1);
|
|
334
|
+
const newIndex = newList.findIndex(rowItem => !this.isCompareSame(column, row, rowItem));
|
|
335
|
+
rowspan = 1 + (newIndex === -1 ? newList.length : newIndex);
|
|
336
|
+
}
|
|
309
337
|
}
|
|
310
338
|
}
|
|
311
339
|
|
|
312
340
|
return rowspan;
|
|
313
341
|
},
|
|
314
|
-
// 添加一行后 处理合并单元格的rowspan
|
|
315
|
-
createMergeUnitRowspan ({ row, rowIndex, column }, list = this.allListData) {
|
|
316
|
-
rowIndex = list.findIndex(dataItem => dataItem._id === row._id);
|
|
317
|
-
|
|
318
|
-
if (rowIndex > -1) {
|
|
319
|
-
let fistMergeRow = this.rowspanMap[this.getMixKey(row, column)] === 0
|
|
320
|
-
? list.slice(0, rowIndex).findLast(rowItem => this.rowspanMap[this.getMixKey(rowItem, column)] > 1)
|
|
321
|
-
: row;
|
|
322
|
-
|
|
323
|
-
this.rowspanMap[this.getMixKey(fistMergeRow, column)] = this.rowspanMap[this.getMixKey(fistMergeRow, column)] + 1;
|
|
324
|
-
}
|
|
325
|
-
else {
|
|
326
|
-
this.rowspanMap[this.getMixKey(row, column)] = 1;
|
|
327
|
-
}
|
|
328
|
-
},
|
|
329
|
-
// 删除一行后 处理合并单元格的rowspan
|
|
330
|
-
deleteMergeUnitRowspan ({ row, rowIndex, column }, list = this.allListData) {
|
|
331
|
-
rowIndex = list.findIndex(dataItem => dataItem._id === row._id);
|
|
332
|
-
let fistMergeRow = this.rowspanMap[this.getMixKey(row, column)] === 0
|
|
333
|
-
? list.slice(0, rowIndex).findLast(rowItem => this.rowspanMap[this.getMixKey(rowItem, column)] > 1)
|
|
334
|
-
: row;
|
|
335
|
-
|
|
336
|
-
// 当前单元格合并了下面的 -把合并数减去1给下一单元格
|
|
337
|
-
if (this.rowspanMap[this.getMixKey(row, column)] > 1) {
|
|
338
|
-
nextRow = list[rowIndex + 1];
|
|
339
|
-
this.rowspanMap[this.getMixKey(nextRow, column)] = this.rowspanMap[this.getMixKey(row, column)] - 1;
|
|
340
|
-
}
|
|
341
|
-
// 当前单元格被上面的合并了 -最上面的合并单元格合并数减去1
|
|
342
|
-
else if (this.rowspanMap[this.getMixKey(row, column)] === 0) {
|
|
343
|
-
this.rowspanMap[this.getMixKey(fistMergeRow, column)] = this.rowspanMap[this.getMixKey(fistMergeRow, column)] - 1;
|
|
344
|
-
}
|
|
345
|
-
// 当前单元格单独存在(无合并)
|
|
346
|
-
else if (this.rowspanMap[this.getMixKey(row, column)] === 1) {
|
|
347
|
-
// 无处理
|
|
348
|
-
}
|
|
349
|
-
|
|
350
|
-
// 清除被删除单元格的rowspan记录
|
|
351
|
-
delete this.rowspanMap[this.getMixKey(row, column)];
|
|
352
|
-
},
|
|
353
|
-
|
|
354
342
|
// 合并单元格的行,某列的值全部跟着修改
|
|
355
343
|
dealSameRowsVal ({ row, rowIndex, column }, list = this.allListData) {
|
|
356
344
|
if (this.mergeRowColKeys.includes(column._key) && this.rowspanMap[this.getMixKey(row, column)] > 1) {
|