vxe-table 4.17.0-beta.8 → 4.17.0-beta.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.
@@ -1,30 +1,8 @@
1
1
  import XEUtils from 'xe-utils';
2
2
  import { VxeUI } from '../../../ui';
3
3
  import { getRefElem } from '../../src/util';
4
- import { hasClass, getAbsolutePos, addClass, removeClass, hasControlKey } from '../../../ui/src/dom';
4
+ import { getAbsolutePos, addClass, removeClass, hasControlKey } from '../../../ui/src/dom';
5
5
  const { hooks } = VxeUI;
6
- const browseObj = XEUtils.browse();
7
- function getTargetOffset(target, container) {
8
- let offsetTop = 0;
9
- let offsetLeft = 0;
10
- const triggerCheckboxLabel = !browseObj.firefox && hasClass(target, 'vxe-checkbox--label');
11
- if (triggerCheckboxLabel) {
12
- const checkboxLabelStyle = getComputedStyle(target);
13
- offsetTop -= XEUtils.toNumber(checkboxLabelStyle.paddingTop);
14
- offsetLeft -= XEUtils.toNumber(checkboxLabelStyle.paddingLeft);
15
- }
16
- while (target && target !== container) {
17
- offsetTop += target.offsetTop;
18
- offsetLeft += target.offsetLeft;
19
- target = target.offsetParent;
20
- if (triggerCheckboxLabel) {
21
- const checkboxStyle = getComputedStyle(target);
22
- offsetTop -= XEUtils.toNumber(checkboxStyle.paddingTop);
23
- offsetLeft -= XEUtils.toNumber(checkboxStyle.paddingLeft);
24
- }
25
- }
26
- return { offsetTop, offsetLeft };
27
- }
28
6
  hooks.add('tableKeyboardModule', {
29
7
  setupTable($xeTable) {
30
8
  const { props, reactData, internalData } = $xeTable;
@@ -117,6 +95,7 @@ hooks.add('tableKeyboardModule', {
117
95
  if (!bodyWrapperElem) {
118
96
  return;
119
97
  }
98
+ const bodyRect = bodyWrapperElem.getBoundingClientRect();
120
99
  const el = refElem.value;
121
100
  const disX = evnt.clientX;
122
101
  const disY = evnt.clientY;
@@ -125,9 +104,8 @@ hooks.add('tableKeyboardModule', {
125
104
  const selectRecords = $xeTable.getCheckboxRecords();
126
105
  let lastRangeRows = [];
127
106
  const marginSize = 1;
128
- const offsetRest = getTargetOffset(evnt.target, bodyWrapperElem);
129
- const startTop = offsetRest.offsetTop + evnt.offsetY;
130
- const startLeft = offsetRest.offsetLeft + evnt.offsetX;
107
+ const startTop = evnt.clientY - bodyRect.y + bodyWrapperElem.scrollTop;
108
+ const startLeft = evnt.clientX - bodyRect.x + bodyWrapperElem.scrollLeft;
131
109
  const startScrollTop = bodyWrapperElem.scrollTop;
132
110
  const rowHeight = trElem.offsetHeight;
133
111
  const trRect = trElem.getBoundingClientRect();
package/es/ui/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { VxeUI } from '@vxe-ui/core';
2
2
  import { getFuncText } from './src/utils';
3
- export const version = "4.17.0-beta.8";
3
+ export const version = "4.17.0-beta.9";
4
4
  VxeUI.version = version;
5
5
  VxeUI.tableVersion = version;
6
6
  VxeUI.setConfig({
package/es/ui/src/log.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { VxeUI } from '@vxe-ui/core';
2
2
  const { log } = VxeUI;
3
- const version = `table v${"4.17.0-beta.8"}`;
3
+ const version = `table v${"4.17.0-beta.9"}`;
4
4
  export const warnLog = log.create('warn', version);
5
5
  export const errLog = log.create('error', version);
@@ -1,6 +1,7 @@
1
1
  import XEUtils from 'xe-utils';
2
2
  import { VxeUI } from '@vxe-ui/core';
3
3
  import DomZIndex from 'dom-zindex';
4
+ const { getConfig } = VxeUI;
4
5
  export function isEnableConf(conf) {
5
6
  return conf && conf.enabled !== false;
6
7
  }
@@ -24,14 +25,14 @@ export function hasChildrenList(item) {
24
25
  return item && item.children && item.children.length > 0;
25
26
  }
26
27
  export function getFuncText(content, args) {
27
- if (content) {
28
- const translate = VxeUI.getConfig().translate;
29
- return XEUtils.toValueString(translate ? translate('' + content, args) : content);
28
+ if (XEUtils.eqNull(content)) {
29
+ return '';
30
30
  }
31
- return '';
31
+ const translate = getConfig().translate;
32
+ return `${translate ? translate('' + content, args) : content}`;
32
33
  }
33
34
  export function formatText(value, placeholder) {
34
- return '' + (isEmptyValue(value) ? (placeholder ? VxeUI.getConfig().emptyCell : '') : value);
35
+ return '' + (isEmptyValue(value) ? (placeholder ? getConfig().emptyCell : '') : value);
35
36
  }
36
37
  /**
37
38
  * 判断值为:'' | null | undefined 时都属于空值
package/lib/index.umd.js CHANGED
@@ -2830,7 +2830,7 @@ __webpack_require__.d(__webpack_exports__, {
2830
2830
  config: function() { return /* reexport */ config; },
2831
2831
  "default": function() { return /* binding */ entry_lib; },
2832
2832
  formats: function() { return /* reexport */ formats; },
2833
- getConfig: function() { return /* reexport */ getConfig; },
2833
+ getConfig: function() { return /* reexport */ ui_getConfig; },
2834
2834
  getI18n: function() { return /* reexport */ getI18n; },
2835
2835
  getIcon: function() { return /* reexport */ getIcon; },
2836
2836
  getTheme: function() { return /* reexport */ getTheme; },
@@ -2879,7 +2879,7 @@ __webpack_require__.d(components_namespaceObject, {
2879
2879
  commands: function() { return commands; },
2880
2880
  config: function() { return config; },
2881
2881
  formats: function() { return formats; },
2882
- getConfig: function() { return getConfig; },
2882
+ getConfig: function() { return ui_getConfig; },
2883
2883
  getI18n: function() { return getI18n; },
2884
2884
  getIcon: function() { return getIcon; },
2885
2885
  getTheme: function() { return getTheme; },
@@ -3094,6 +3094,9 @@ updateVar();
3094
3094
 
3095
3095
 
3096
3096
 
3097
+ const {
3098
+ getConfig
3099
+ } = core_.VxeUI;
3097
3100
  function isEnableConf(conf) {
3098
3101
  return conf && conf.enabled !== false;
3099
3102
  }
@@ -3120,14 +3123,14 @@ function hasChildrenList(item) {
3120
3123
  return item && item.children && item.children.length > 0;
3121
3124
  }
3122
3125
  function getFuncText(content, args) {
3123
- if (content) {
3124
- const translate = core_.VxeUI.getConfig().translate;
3125
- return external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toValueString(translate ? translate('' + content, args) : content);
3126
+ if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eqNull(content)) {
3127
+ return '';
3126
3128
  }
3127
- return '';
3129
+ const translate = getConfig().translate;
3130
+ return `${translate ? translate('' + content, args) : content}`;
3128
3131
  }
3129
3132
  function formatText(value, placeholder) {
3130
- return '' + (isEmptyValue(value) ? placeholder ? core_.VxeUI.getConfig().emptyCell : '' : value);
3133
+ return '' + (isEmptyValue(value) ? placeholder ? getConfig().emptyCell : '' : value);
3131
3134
  }
3132
3135
  /**
3133
3136
  * 判断值为:'' | null | undefined 时都属于空值
@@ -3138,7 +3141,7 @@ function eqEmptyValue(cellValue) {
3138
3141
  ;// ./packages/ui/index.ts
3139
3142
 
3140
3143
 
3141
- const version = "4.17.0-beta.8";
3144
+ const version = "4.17.0-beta.9";
3142
3145
  core_.VxeUI.version = version;
3143
3146
  core_.VxeUI.tableVersion = version;
3144
3147
  core_.VxeUI.setConfig({
@@ -3499,7 +3502,7 @@ core_.VxeUI.setIcon({
3499
3502
  const setTheme = core_.VxeUI.setTheme;
3500
3503
  const getTheme = core_.VxeUI.getTheme;
3501
3504
  const setConfig = core_.VxeUI.setConfig;
3502
- const getConfig = core_.VxeUI.getConfig;
3505
+ const ui_getConfig = core_.VxeUI.getConfig;
3503
3506
  const setIcon = core_.VxeUI.setIcon;
3504
3507
  const getIcon = core_.VxeUI.getIcon;
3505
3508
  const setLanguage = core_.VxeUI.setLanguage;
@@ -3650,7 +3653,7 @@ var esnext_iterator_some = __webpack_require__(7550);
3650
3653
  const {
3651
3654
  log: log_log
3652
3655
  } = core_.VxeUI;
3653
- const log_version = `table v${"4.17.0-beta.8"}`;
3656
+ const log_version = `table v${"4.17.0-beta.9"}`;
3654
3657
  const warnLog = log_log.create('warn', log_version);
3655
3658
  const errLog = log_log.create('error', log_version);
3656
3659
  ;// ./packages/table/src/columnInfo.ts
@@ -15784,31 +15787,6 @@ export_hook_hooks.add('tableExportModule', {
15784
15787
  const {
15785
15788
  hooks: keyboard_hook_hooks
15786
15789
  } = core_.VxeUI;
15787
- const browseObj = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().browse();
15788
- function getTargetOffset(target, container) {
15789
- let offsetTop = 0;
15790
- let offsetLeft = 0;
15791
- const triggerCheckboxLabel = !browseObj.firefox && hasClass(target, 'vxe-checkbox--label');
15792
- if (triggerCheckboxLabel) {
15793
- const checkboxLabelStyle = getComputedStyle(target);
15794
- offsetTop -= external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toNumber(checkboxLabelStyle.paddingTop);
15795
- offsetLeft -= external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toNumber(checkboxLabelStyle.paddingLeft);
15796
- }
15797
- while (target && target !== container) {
15798
- offsetTop += target.offsetTop;
15799
- offsetLeft += target.offsetLeft;
15800
- target = target.offsetParent;
15801
- if (triggerCheckboxLabel) {
15802
- const checkboxStyle = getComputedStyle(target);
15803
- offsetTop -= external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toNumber(checkboxStyle.paddingTop);
15804
- offsetLeft -= external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toNumber(checkboxStyle.paddingLeft);
15805
- }
15806
- }
15807
- return {
15808
- offsetTop,
15809
- offsetLeft
15810
- };
15811
- }
15812
15790
  keyboard_hook_hooks.add('tableKeyboardModule', {
15813
15791
  setupTable($xeTable) {
15814
15792
  const {
@@ -15928,6 +15906,7 @@ keyboard_hook_hooks.add('tableKeyboardModule', {
15928
15906
  if (!bodyWrapperElem) {
15929
15907
  return;
15930
15908
  }
15909
+ const bodyRect = bodyWrapperElem.getBoundingClientRect();
15931
15910
  const el = refElem.value;
15932
15911
  const disX = evnt.clientX;
15933
15912
  const disY = evnt.clientY;
@@ -15936,9 +15915,8 @@ keyboard_hook_hooks.add('tableKeyboardModule', {
15936
15915
  const selectRecords = $xeTable.getCheckboxRecords();
15937
15916
  let lastRangeRows = [];
15938
15917
  const marginSize = 1;
15939
- const offsetRest = getTargetOffset(evnt.target, bodyWrapperElem);
15940
- const startTop = offsetRest.offsetTop + evnt.offsetY;
15941
- const startLeft = offsetRest.offsetLeft + evnt.offsetX;
15918
+ const startTop = evnt.clientY - bodyRect.y + bodyWrapperElem.scrollTop;
15919
+ const startLeft = evnt.clientX - bodyRect.x + bodyWrapperElem.scrollLeft;
15942
15920
  const startScrollTop = bodyWrapperElem.scrollTop;
15943
15921
  const rowHeight = trElem.offsetHeight;
15944
15922
  const trRect = trElem.getBoundingClientRect();