bri-components 1.3.81 → 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.81",
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.clickCreateChild(this.operationMap.canCreate, row, rowIndex);
232
+ this.$dispatchEvent(this.operationMap.canCreateChild, row, rowIndex);
192
233
  }
193
234
  }
194
235
  })
@@ -221,13 +262,35 @@ export default {
221
262
 
222
263
  // 点击 -添加一行
223
264
  clickCreate (operationItem, row, rowIndex) {
265
+ const newRow = {
266
+ ...this.$deepCopy(this.selfRowDefault),
267
+ _id: this.$ObjectID().str,
268
+ level: row ? row.level : 1,
269
+ isLeaf: true,
270
+ children: [],
271
+ // __old__: false,
272
+ __isExpand__: false,
273
+ __isRendered__: true,
274
+ __isShow__: true,
275
+ __isTmpShow__: false,
276
+ __isSearchShow__: false
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);
224
285
 
286
+ this.change("createRow", null, newRow, newRowIndex);
225
287
  },
226
288
  // 点击 -添加子行
227
289
  clickCreateChild (operationItem, row, rowIndex) {
228
290
  const newRow = {
229
291
  ...this.$deepCopy(this.selfRowDefault),
230
292
  _id: this.$ObjectID().str,
293
+ level: row.level + 1,
231
294
  isLeaf: true,
232
295
  children: [],
233
296
  // __old__: false,
@@ -237,21 +300,8 @@ export default {
237
300
  __isTmpShow__: false,
238
301
  __isSearchShow__: false
239
302
  };
240
-
241
- // !row代表最上级节点
242
- if (!row) {
243
- this.data.push({
244
- ...newRow,
245
- level: 1
246
- });
247
- } else {
248
- row.children.push({
249
- ...newRow,
250
- level: row.level + 1
251
- });
252
-
253
- this.toggleExpand(row, true);
254
- }
303
+ row.children.push(newRow);
304
+ this.toggleExpand(row, true);
255
305
 
256
306
  this.change("createRow", null, newRow, row.children.length);
257
307
  },
@@ -142,6 +142,15 @@ export default {
142
142
  disabled: false,
143
143
  event: "clickCreate"
144
144
  },
145
+ canCreateChild: {
146
+ name: "添加子行",
147
+ type: "canCreateChild",
148
+ btnType: "default",
149
+ size: "default",
150
+ long: true,
151
+ disabled: false,
152
+ event: "clickCreateChild"
153
+ },
145
154
  canDelete: {
146
155
  name: "删除",
147
156
  type: "canDelete",
@@ -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 {