bri-components 1.3.80 → 1.3.82

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bri-components",
3
- "version": "1.3.80",
3
+ "version": "1.3.82",
4
4
  "author": "dengshanghui",
5
5
  "description": "a component lib for vue project",
6
6
  "main": "src/index.js",
@@ -76,8 +76,9 @@ export default {
76
76
  h("div", rowIndex + 1),
77
77
 
78
78
  // 添加符
79
- // this.operationMap.canCreate && !this.isSearching && rowIndex !== this.allListData.length - 1
80
- this.operationMap.canCreate && !this.isSearching
79
+ (this.operationMap.canCreate && this.operationMap.canCreate.disabled !== true) &&
80
+ !this.isSearching
81
+ // rowIndex !== this.allListData.length - 1
81
82
  ? h("div", {
82
83
  style: {
83
84
  position: "absolute",
@@ -86,7 +87,7 @@ export default {
86
87
  display: "inline-block",
87
88
  width: "16px",
88
89
  height: " 16px",
89
- border: "1px solid #dcdee2",
90
+ border: "1px solid #3DB8C5",
90
91
  backgroundColor: "#ffffff",
91
92
  lineHeight: "12px",
92
93
  cursor: "pointer",
@@ -96,7 +97,8 @@ export default {
96
97
  }, [
97
98
  h("Icon", {
98
99
  style: {
99
- fontWeight: "500"
100
+ fontWeight: "500",
101
+ color: "#3DB8C5"
100
102
  },
101
103
  props: {
102
104
  type: "md-add-circle", // "ios-add"
@@ -104,7 +106,7 @@ export default {
104
106
  },
105
107
  on: {
106
108
  click: () => {
107
- this.clickCreate(this.operationMap.canCreate, row, rowIndex);
109
+ this.$dispatchEvent(this.operationMap.canCreate, row, rowIndex);
108
110
  }
109
111
  }
110
112
  })
@@ -119,7 +121,6 @@ export default {
119
121
  methods: {
120
122
  // 点击 -添加行
121
123
  clickCreate (operationItem, row, rowIndex) {
122
- const list = this.allListData;
123
124
  const newRow = {
124
125
  ...this.$deepCopy(this.selfRowDefault),
125
126
  _id: this.$ObjectID().str,
@@ -128,9 +129,11 @@ export default {
128
129
  __isTmpShow__: true,
129
130
  __isSearchShow__: false
130
131
  };
131
- const newRowIndex = rowIndex == null ? list.length : rowIndex + 1;
132
+ const list = this.data;
133
+ const newRowIndex = row
134
+ ? list.findIndex(rowItem => rowItem._id === row._id) + 1
135
+ : list.length;
132
136
  list.splice(newRowIndex, 0, newRow);
133
- // this.$forceUpdate(); // 自定义页中点击添加一行没有更新页面
134
137
 
135
138
  this.change("createRow", null, newRow, newRowIndex);
136
139
  },
@@ -140,7 +143,7 @@ export default {
140
143
  title: "提示",
141
144
  content: "确定删除吗?",
142
145
  onOk: () => {
143
- this.allListData.splice(rowIndex, 1);
146
+ this.data.splice(rowIndex, 1);
144
147
 
145
148
  this.change("deleteRow", null, row, rowIndex);
146
149
  }
@@ -161,7 +161,47 @@ export default {
161
161
  }, row.__treeIndex__),
162
162
 
163
163
  // 添加符
164
- this.operationMap.canCreate && !this.isSearching && row.level < this.maxLevel
164
+ (this.operationMap.canCreate && this.operationMap.canCreate.disabled !== true) &&
165
+ !this.isSearching
166
+ // rowIndex !== this.allListData.length - 1
167
+ ? h("div", {
168
+ style: {
169
+ position: "absolute",
170
+ bottom: "0px",
171
+ right: row.level < this.maxLevel ? "17px" : "0px",
172
+ display: "inline-block",
173
+ width: "16px",
174
+ height: " 16px",
175
+ border: "1px solid #3DB8C5",
176
+ backgroundColor: "#ffffff",
177
+ lineHeight: "12px",
178
+ cursor: "pointer",
179
+ verticalAlign: "middle",
180
+ transition: "color .2s ease-in-out,border-color .2s ease-in-out"
181
+ }
182
+ }, [
183
+ h("Icon", {
184
+ style: {
185
+ fontWeight: "500",
186
+ color: "#3DB8C5"
187
+ },
188
+ props: {
189
+ type: "md-add-circle", // "ios-add"
190
+ size: "14"
191
+ },
192
+ on: {
193
+ click: () => {
194
+ this.$dispatchEvent(this.operationMap.canCreate, row, rowIndex);
195
+ }
196
+ }
197
+ })
198
+ ])
199
+ : h("span", ""),
200
+
201
+ // 下级添加符
202
+ (this.operationMap.canCreateChild && this.operationMap.canCreateChild.disabled !== true) &&
203
+ !this.isSearching &&
204
+ row.level < this.maxLevel
165
205
  ? h("div", {
166
206
  style: {
167
207
  position: "absolute",
@@ -170,7 +210,7 @@ export default {
170
210
  display: "inline-block",
171
211
  width: "16px",
172
212
  height: " 16px",
173
- border: "1px solid #dcdee2",
213
+ border: "1px solid #3DB8C5",
174
214
  backgroundColor: "#ffffff",
175
215
  lineHeight: "12px",
176
216
  cursor: "pointer",
@@ -180,7 +220,8 @@ export default {
180
220
  }, [
181
221
  h("Icon", {
182
222
  style: {
183
- fontWeight: "500"
223
+ fontWeight: "600",
224
+ color: "#3DB8C5"
184
225
  },
185
226
  props: {
186
227
  type: "ios-add", // "md-add-circle"
@@ -188,7 +229,7 @@ export default {
188
229
  },
189
230
  on: {
190
231
  click: () => {
191
- this.clickCreate(this.operationMap.canCreate, row, rowIndex);
232
+ this.$dispatchEvent(this.operationMap.canCreateChild, row, rowIndex);
192
233
  }
193
234
  }
194
235
  })
@@ -224,6 +265,7 @@ export default {
224
265
  const newRow = {
225
266
  ...this.$deepCopy(this.selfRowDefault),
226
267
  _id: this.$ObjectID().str,
268
+ level: row ? row.level : 1,
227
269
  isLeaf: true,
228
270
  children: [],
229
271
  // __old__: false,
@@ -233,21 +275,35 @@ export default {
233
275
  __isTmpShow__: false,
234
276
  __isSearchShow__: false
235
277
  };
278
+ const list = row
279
+ ? this.getParentNode(row, this.data).children
280
+ : this.data;
281
+ const newRowIndex = row
282
+ ? list.findIndex(rowItem => rowItem._id === row._id) + 1
283
+ : list.length;
284
+ list.splice(newRowIndex, 0, newRow);
236
285
 
237
- // !row代表最上级节点
238
- if (!row) {
239
- this.data.push({
240
- ...newRow,
241
- level: 1
242
- });
243
- } else {
244
- row.children.push({
245
- ...newRow,
246
- level: row.level + 1
247
- });
286
+ this.change("createRow", null, newRow, newRowIndex);
287
+ },
288
+ // 点击 -添加子行
289
+ clickCreateChild (operationItem, row, rowIndex) {
290
+ const newRow = {
291
+ ...this.$deepCopy(this.selfRowDefault),
292
+ _id: this.$ObjectID().str,
293
+ level: row.level + 1,
294
+ isLeaf: true,
295
+ children: [],
296
+ // __old__: false,
297
+ __isExpand__: false,
298
+ __isRendered__: true,
299
+ __isShow__: true,
300
+ __isTmpShow__: false,
301
+ __isSearchShow__: false
302
+ };
303
+ row.children.push(newRow);
304
+ this.toggleExpand(row, true);
248
305
 
249
- this.toggleExpand(row, true);
250
- }
306
+ this.change("createRow", null, newRow, row.children.length);
251
307
  },
252
308
  // 点击 -删除行
253
309
  clickDelete (operationItem, row, rowIndex) {
@@ -258,6 +314,8 @@ export default {
258
314
  const parentNode = this.getParentNode(row, this.data);
259
315
  const index = parentNode.children.findIndex(childNode => childNode._id === row._id);
260
316
  parentNode.children.splice(index, 1);
317
+
318
+ this.change("deleteRow", null, row, rowIndex);
261
319
  }
262
320
  });
263
321
  },
@@ -136,11 +136,20 @@ export default {
136
136
  canCreate: {
137
137
  name: "添加一行",
138
138
  type: "canCreate",
139
+ btnType: "default",
139
140
  size: "default",
140
141
  long: true,
141
142
  disabled: false,
142
- event: "clickCreate",
143
- btnType: "default"
143
+ event: "clickCreate"
144
+ },
145
+ canCreateChild: {
146
+ name: "添加子行",
147
+ type: "canCreateChild",
148
+ btnType: "default",
149
+ size: "default",
150
+ long: true,
151
+ disabled: false,
152
+ event: "clickCreateChild"
144
153
  },
145
154
  canDelete: {
146
155
  name: "删除",
@@ -193,7 +202,7 @@ export default {
193
202
  _useIndex: true, // 使用序号列
194
203
  _useSummary: false, // 使用汇总行
195
204
  _disabledBtns: false, // 禁用增删按钮
196
- _disabledCreateBtn: false, // 置灰新增按钮,目前只内部使用,comp_web数据表配置页那块
205
+ // _disabledCreateBtn: false, // 置灰新增按钮,目前只内部使用,comp_web数据表配置页那块
197
206
  _disabledOldDataRow: false, // 置灰老数据行包含删除
198
207
 
199
208
  _hideColKeys: [], // 隐藏/查看列字段的keys
@@ -223,9 +232,12 @@ export default {
223
232
  ...this.commonPropsObj
224
233
  };
225
234
  },
235
+ showMode () {
236
+ return this.selfPropsObj._showMode;
237
+ },
226
238
  inTableType () {
227
- return this.controlType === "cascaderTable" && ["treeTable"].includes(this.selfPropsObj._showMode)
228
- ? this.selfPropsObj._showMode
239
+ return this.controlType === "cascaderTable" && ["treeTable"].includes(this.showMode)
240
+ ? this.showMode
229
241
  : this.controlType;
230
242
  },
231
243
  // isShare () {
@@ -258,9 +270,9 @@ export default {
258
270
  disabledBtns () {
259
271
  return this.selfPropsObj._disabledBtns;
260
272
  },
261
- disabledCreateBtn () {
262
- return this.selfPropsObj._disabledCreateBtn;
263
- },
273
+ // disabledCreateBtn () {
274
+ // return this.selfPropsObj._disabledCreateBtn;
275
+ // },
264
276
  disabledOldDataRow () {
265
277
  return this.selfPropsObj._disabledOldDataRow;
266
278
  },
@@ -604,11 +616,15 @@ export default {
604
616
  canHideOrShow: {
605
617
  ...this.topOperationMap.canHideOrShow,
606
618
  name: this.hideStatus ? "显示字段" : "隐藏字段"
607
- },
608
- canCreate: {
609
- ...this.baseOperationMap.canCreate,
610
- disabled: !!this.disabledCreateBtn
611
619
  }
620
+ // canCreate: {
621
+ // ...this.baseOperationMap.canCreate,
622
+ // disabled: !!this.disabledCreateBtn
623
+ // },
624
+ // canCreateChild: {
625
+ // ...this.baseOperationMap.canCreateChild,
626
+ // disabled: !!this.disabledCreateBtn
627
+ // }
612
628
  };
613
629
  },
614
630
  operationMap () {
@@ -8,12 +8,12 @@ const getHeadRender = function (h, column, {
8
8
  return h("div", {
9
9
  style: {
10
10
  display: "inline-block",
11
- maxWidth: `calc(100% - ${column.sortBy || column.sortBy === "" || !!column.filter ? 10 : 0}px)`,
11
+ maxWidth: `calc(100% - ${column.sortBy || column.sortBy === "" || !!column.filter ? 4 : 0}px)`,
12
12
  paddingLeft: "8px",
13
- paddingRight: `${(column.sortBy || column.sortBy === "" || !!column.filter ? 0 : 8) + (column._description ? 18 : 0)}px`,
13
+ paddingRight: `${8 + (column._description ? 18 : 0)}px`,
14
14
  verticalAlign: "middle",
15
15
  position: "relative",
16
- marginRight: `${column.sortBy || column.sortBy === "" || !!column.filter ? 10 : 0}px`
16
+ marginRight: `${column.sortBy || column.sortBy === "" || !!column.filter ? 4 : 0}px`
17
17
  }
18
18
  }, [
19
19
  showRequired && column._required && h("i", {
@@ -161,7 +161,7 @@ const transformToColumns = function (form, {
161
161
 
162
162
  ...col
163
163
  };
164
- });
164
+ });
165
165
  };
166
166
 
167
167
  export default {