n20-common-lib 3.2.30 → 3.2.32

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": "n20-common-lib",
3
- "version": "3.2.30",
3
+ "version": "3.2.32",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "serve": "vue-cli-service serve",
@@ -824,7 +824,15 @@ export default {
824
824
  showClose: true
825
825
  })
826
826
  }
827
- this.$emit('delete-rows', this.selectionList)
827
+ this.$msgboxPor({
828
+ title: $lc('确认删除所选附件吗?'),
829
+ message: $lc('删除后数据不可恢复'),
830
+ type: 'error',
831
+ confirmButtonText: $lc('确认'),
832
+ cancelButtonText: $lc('取消')
833
+ }).then(() => {
834
+ this.$emit('delete-rows', this.selectionList)
835
+ }).catch(() => undefined)
828
836
  },
829
837
 
830
838
  async getFileInfo(row, type) {
@@ -0,0 +1,38 @@
1
+ const INTERACTIVE_CELL_TARGET_SELECTOR = [
2
+ 'button',
3
+ '.el-button',
4
+ '.n20-button',
5
+ '[class*="button"]',
6
+ '.el-link',
7
+ '[class*="el-link--inner"]',
8
+ 'a[href]',
9
+ 'input',
10
+ 'textarea',
11
+ 'select',
12
+ 'label',
13
+ '[contenteditable="true"]',
14
+ '.el-input',
15
+ '.el-textarea',
16
+ '.el-select',
17
+ '.el-input-number',
18
+ '.el-date-editor',
19
+ '.el-cascader',
20
+ '.el-switch',
21
+ '.el-radio',
22
+ '.el-checkbox',
23
+ '.el-slider',
24
+ '.el-rate',
25
+ '.el-upload',
26
+ '.n20-num-w',
27
+ '.n20-numberRange',
28
+ '.n20-date-select',
29
+ '.n20-input-search'
30
+ ].join(',')
31
+
32
+ export function isTableCellInteractiveTarget(target) {
33
+ const element = target && target.nodeType === 1 ? target : target && target.parentElement
34
+ if (!element || typeof element.closest !== 'function') {
35
+ return false
36
+ }
37
+ return !!element.closest(INTERACTIVE_CELL_TARGET_SELECTOR)
38
+ }
@@ -137,6 +137,7 @@ import empty from '../Empty'
137
137
  import tableSetSize from '../TableSetSize/index.vue'
138
138
  import { $lc } from '../../utils/i18n/index.js'
139
139
  import XEUtils from 'xe-utils'
140
+ import { isTableCellInteractiveTarget } from './cellClick'
140
141
  const DEFAULT_SCROLL_Y = {
141
142
  enabled: true,
142
143
  gt: 30,
@@ -369,33 +370,11 @@ export default {
369
370
  return
370
371
  }
371
372
 
372
- // 检查点击的目标元素是否是按钮或链接
373
- // 需要检测多种按钮类型:
374
- // - button: 原生按钮标签
375
- // - .el-button: Element UI 按钮组件
376
- // - .n20-button: n20 项目按钮组件
377
- // - [class*="button"]: 包含 button 类名的元素
378
- // - [class*="el-link--inner"]: Element UI 链接组件内部元素
379
- // - a[href]: 链接标签
380
- const target = $event.target
381
- const clickedButton = target.closest(
382
- 'button, .el-button, .n20-button, [class*="button"], [class*="el-link--inner"], a[href]'
383
- )
384
-
385
- // 如果点击的是按钮或链接,不触发行勾选
386
- if (clickedButton) {
373
+ // 点击输入框、下拉框、按钮等交互控件时,不触发行勾选
374
+ if (isTableCellInteractiveTarget($event.target)) {
387
375
  return
388
376
  }
389
377
 
390
- // 如果 closest 没找到,检查父元素的类名是否包含操作相关的关键词
391
- if (!clickedButton && target.parentElement) {
392
- const parentClass = target.parentElement.className || ''
393
- // 检测父元素是否包含:operate(操作)、btn(按钮)、button(按钮) 等关键词
394
- if (parentClass.includes('operate') || parentClass.includes('btn') || parentClass.includes('button')) {
395
- return
396
- }
397
- }
398
-
399
378
  // 检查该行是否可以被勾选
400
379
  let canCheck = true
401
380
  if (typeof this.forbidSelect === 'function') {
@@ -453,6 +453,7 @@ import tableShowColumn from '../../ShowColumn/index.vue'
453
453
  import { saveTransform } from '../../ShowColumn/index.vue'
454
454
  import tableOperate from '../../TableOperate/index.vue'
455
455
  import OperateBtns from '../../TableProOperateColumn/OperateBtns.vue'
456
+ import { isTableCellInteractiveTarget } from '../../TablePro/cellClick'
456
457
 
457
458
  const renderer = {
458
459
  name: 'renderer',
@@ -1154,33 +1155,11 @@ export default {
1154
1155
  return
1155
1156
  }
1156
1157
 
1157
- // 检查点击的目标元素是否是按钮或链接
1158
- // 需要检测多种按钮类型:
1159
- // - button: 原生按钮标签
1160
- // - .el-button: Element UI 按钮组件
1161
- // - .n20-button: n20 项目按钮组件
1162
- // - [class*="button"]: 包含 button 类名的元素
1163
- // - [class*="el-link--inner"]: Element UI 链接组件内部元素
1164
- // - a[href]: 链接标签
1165
- const target = $event.target
1166
- const clickedButton = target.closest(
1167
- 'button, .el-button, .n20-button, [class*="button"], [class*="el-link--inner"], a[href]'
1168
- )
1169
-
1170
- // 如果点击的是按钮或链接,不触发行勾选
1171
- if (clickedButton) {
1158
+ // 点击输入框、下拉框、按钮等交互控件时,不触发行勾选
1159
+ if (isTableCellInteractiveTarget($event.target)) {
1172
1160
  return
1173
1161
  }
1174
1162
 
1175
- // 如果 closest 没找到,检查父元素的类名是否包含操作相关的关键词
1176
- if (!clickedButton && target.parentElement) {
1177
- const parentClass = target.parentElement.className || ''
1178
- // 检测父元素是否包含:operate(操作)、btn(按钮)、button(按钮) 等关键词
1179
- if (parentClass.includes('operate') || parentClass.includes('btn') || parentClass.includes('button')) {
1180
- return
1181
- }
1182
- }
1183
-
1184
1163
  // 检查该行是否可以被勾选
1185
1164
  let canCheck = true
1186
1165
  if (typeof this.forbidSelect === 'function') {
@@ -611,9 +611,17 @@ export default {
611
611
  * @returns {void}
612
612
  */
613
613
  deleteSingleRow(row) {
614
- const index = this.tableData.findIndex((item) => item === row)
615
- if (index > -1) this.tableData.splice(index, 1)
616
- this.$emit('delete-rows', [row])
614
+ this.$msgboxPor({
615
+ title: $lc('确认删除所选附件吗?'),
616
+ message: $lc('删除后数据不可恢复'),
617
+ type: 'error',
618
+ confirmButtonText: $lc('确认'),
619
+ cancelButtonText: $lc('取消')
620
+ }).then(() => {
621
+ const index = this.tableData.findIndex((item) => item === row)
622
+ if (index > -1) this.tableData.splice(index, 1)
623
+ this.$emit('delete-rows', [row])
624
+ }).catch(() => undefined)
617
625
  },
618
626
  /**
619
627
  * 切换展开/收起未上传类型。