@truenewx/tnxvue3 3.0.0-alpha.34 → 3.0.0-alpha.36

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": "@truenewx/tnxvue3",
3
- "version": "3.0.0-alpha.34",
3
+ "version": "3.0.0-alpha.36",
4
4
  "description": "互联网技术解决方案:Vue3扩展支持",
5
5
  "private": false,
6
6
  "publishConfig": {
@@ -24,7 +24,7 @@
24
24
  "vue-router": "~4.4.0"
25
25
  },
26
26
  "dependencies": {
27
- "@truenewx/tnxcore": "3.0.0-alpha.20",
27
+ "@truenewx/tnxcore": "3.0.0-alpha.22",
28
28
  "@element-plus/icons-vue": "2.3.1",
29
29
  "async-validator": "4.2.5",
30
30
  "mitt": "3.0.1"
@@ -30,6 +30,7 @@
30
30
  :loading="loading"
31
31
  :plain="plain"
32
32
  :link="link"
33
+ :text="text"
33
34
  :bg="bg"
34
35
  :autofocus="autofocus"
35
36
  :round="round"
@@ -75,6 +76,7 @@ export default {
75
76
  loading: Boolean,
76
77
  plain: Boolean,
77
78
  link: Boolean,
79
+ text: Boolean,
78
80
  bg: Boolean,
79
81
  autofocus: Boolean,
80
82
  round: Boolean,
@@ -42,7 +42,10 @@ export default {
42
42
  'tnxel-dialog-content': DialogContent,
43
43
  },
44
44
  props: {
45
- id: window.tnx.util.string.uuid32(),
45
+ id: {
46
+ type: String,
47
+ default: () => window.tnx.util.string.uuid32(),
48
+ },
46
49
  modelValue: Boolean,
47
50
  container: String,
48
51
  title: String,
@@ -153,7 +156,7 @@ export default {
153
156
  }
154
157
  }
155
158
  if (!$dialog || !$dialog.length) {
156
- $dialog = $('.el-dialog__wrapper[data-v-id="' + this.id + '"] .el-dialog:last');
159
+ $dialog = $('.tnxel-dialog[data-v-id="' + this.id + '"]');
157
160
  }
158
161
  if ($dialog.length) {
159
162
  let top = window.tnx.util.dom.getTopVerticallyCenteredOnPage($dialog[0]);
@@ -146,7 +146,7 @@ export default {
146
146
  return this.rowKey ? row[this.rowKey] : (rowIndex + '');
147
147
  },
148
148
  initElements() {
149
- this.focusRowFirstInput(this.tableDataList[0]);
149
+ this.focusRowFirstInput(this.tableDataList[0], 0);
150
150
  // 为富文本输入框添加默认title
151
151
  let table = this.$refs.table.$el;
152
152
  let textareas = table.getElementsByTagName('textarea');
@@ -305,10 +305,10 @@ export default {
305
305
  }
306
306
  },
307
307
  tableRowClassName(data) {
308
- let classNames = [this.getRowClassName(data.row, data.$index)];
308
+ let classNames = [this.getRowClassName(data.row, data.rowIndex)];
309
309
  if (typeof this.rowClassName === 'function') {
310
310
  classNames.push(this.rowClassName(data));
311
- } else {
311
+ } else if (this.rowClassName) {
312
312
  classNames.push(this.rowClassName);
313
313
  }
314
314
  return classNames.join(' ');
@@ -317,10 +317,10 @@ export default {
317
317
  let index = this.indexes[this.getRowKey(row, rowIndex)];
318
318
  return 'tnxel-edit-table__row--' + (Array.isArray(index) ? index.join('_') : index);
319
319
  },
320
- focusRowFirstInput(row) {
321
- if (row) {
320
+ focusRowFirstInput(row, rowIndex) {
321
+ if (row && this.$refs.table) {
322
322
  let table = this.$refs.table.$el;
323
- let rowClassName = this.getRowClassName(row);
323
+ let rowClassName = this.getRowClassName(row, rowIndex);
324
324
  let rowDoms = table.getElementsByClassName(rowClassName);
325
325
  if (rowDoms.length) {
326
326
  let rowDom = rowDoms[0];
@@ -353,7 +353,7 @@ export default {
353
353
  this.$nextTick(() => {
354
354
  setTimeout(() => {
355
355
  this.bindElementRules();
356
- this.focusRowFirstInput(row);
356
+ this.focusRowFirstInput(row, rowIndex);
357
357
  });
358
358
  });
359
359
  }
@@ -376,8 +376,13 @@ export default {
376
376
  this.$emit('removed', row, rowIndex);
377
377
  this.$nextTick(() => {
378
378
  setTimeout(() => {
379
- let next = dataList[index] || dataList[index - 1];
380
- this.focusRowFirstInput(next);
379
+ let next = dataList[index];
380
+ let nextIndex = rowIndex;
381
+ if (!next) {
382
+ next = dataList[index - 1];
383
+ nextIndex = rowIndex - 1;
384
+ }
385
+ this.focusRowFirstInput(next, nextIndex);
381
386
  });
382
387
  });
383
388
  });
@@ -466,6 +471,10 @@ export default {
466
471
  padding: 0 16px;
467
472
  }
468
473
 
474
+ .tnxel-edit-table-container .el-table.padding-none .el-table__body-wrapper .el-button {
475
+ border-radius: 0;
476
+ }
477
+
469
478
  .tnxel-edit-table-container .el-table.padding-none .el-table__body-wrapper .el-input--small .el-input__wrapper,
470
479
  .tnxel-edit-table-container .el-table.padding-none .el-table__body-wrapper .el-input--small .el-select__wrapper {
471
480
  height: 24px;
@@ -38,9 +38,11 @@
38
38
  <Management v-else-if="value === 'Management'"/>
39
39
  <Memo v-else-if="value === 'Memo'"/>
40
40
  <Minus v-else-if="value === 'Minus'"/>
41
+ <More v-else-if="value === 'More'"/>
41
42
  <MoreFilled v-else-if="value === 'MoreFilled'"/>
42
43
  <Notebook v-else-if="value === 'Notebook'"/>
43
44
  <OfficeBuilding v-else-if="value === 'OfficeBuilding'"/>
45
+ <Operation v-else-if="value === 'Operation'"/>
44
46
  <Picture v-else-if="value === 'Picture'"/>
45
47
  <PictureFilled v-else-if="value === 'PictureFilled'"/>
46
48
  <Plus v-else-if="value === 'Plus'"/>
@@ -105,9 +107,11 @@ import {
105
107
  Management,
106
108
  Memo,
107
109
  Minus,
110
+ More,
108
111
  MoreFilled,
109
112
  Notebook,
110
113
  OfficeBuilding,
114
+ Operation,
111
115
  Picture,
112
116
  PictureFilled,
113
117
  Plus,
@@ -169,10 +173,12 @@ const components = {
169
173
  Management,
170
174
  Memo,
171
175
  Minus,
176
+ More,
172
177
  MoreFilled,
173
178
  Notebook,
174
179
  Loading,
175
180
  OfficeBuilding,
181
+ Operation,
176
182
  Picture,
177
183
  PictureFilled,
178
184
  Plus,
@@ -124,7 +124,7 @@ export default {
124
124
  }
125
125
 
126
126
  .tnxel-input-number .el-input__inner {
127
- min-width: 50px;
127
+ min-width: 20px;
128
128
  }
129
129
 
130
130
  .tnxel-input-number .el-input-number.text-start .el-input__inner {
@@ -350,9 +350,14 @@ export default build('tnxel', () => {
350
350
  text: message,
351
351
  });
352
352
  this._closeMessage();
353
- window.tnx.loadingInstance = ElLoading.service(options);
354
- this._handleZIndex('.el-loading-mask');
355
- this.app.eventBus.emit('tnx.showLoading', options);
353
+ try {
354
+ window.tnx.loadingInstance = ElLoading.service(options);
355
+ this._handleZIndex('.el-loading-mask');
356
+ this.app.eventBus.emit('tnx.showLoading', options);
357
+ } catch (e) {
358
+ window.tnx.loadingInstance = null;
359
+ console.error(e);
360
+ }
356
361
  return window.tnx.loadingInstance;
357
362
  },
358
363
  closeLoading() {
package/src/tnxvue.js CHANGED
@@ -45,11 +45,22 @@ export default build('tnxvue', () => {
45
45
  * @param handler 处理函数
46
46
  */
47
47
  deepWatch(vm, target, handler) {
48
- vm.$watch(() => JSON.stringify(target), (newValue, oldValue) => {
49
- if (newValue !== oldValue) {
50
- const newObject = JSON.parse(newValue);
51
- const oldObject = JSON.parse(oldValue);
52
- this.deepCompare(newObject, oldObject, '', handler);
48
+ vm.$watch(() => {
49
+ try {
50
+ return JSON.stringify(target);
51
+ } catch (e) {
52
+ console.error(e);
53
+ }
54
+ return undefined;
55
+ }, (newValue, oldValue) => {
56
+ try {
57
+ if (newValue !== oldValue) {
58
+ const newObject = JSON.parse(newValue);
59
+ const oldObject = JSON.parse(oldValue);
60
+ this.deepCompare(newObject, oldObject, '', handler);
61
+ }
62
+ } catch (e) {
63
+ console.error(e);
53
64
  }
54
65
  }, {deep: true});
55
66
  },
@@ -85,7 +96,7 @@ export default build('tnxvue', () => {
85
96
  vm.config.globalProperties.$router = window.tnx.router.instance;
86
97
  }
87
98
  // vm.config.unwrapInjectedRef = true;
88
- window.tnx.app.eventBus = mitt();
99
+ window.tnx.app.eventBus = window.tnx.app.eventBus || mitt();
89
100
  window.tnx.app.eventBus.once = function (name, handler) {
90
101
  this.all.set(name, [handler]);
91
102
  }