@kdcloudjs/table 1.2.2-canary.13 → 1.2.2-canary.15
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/dist/@kdcloudjs/table.css +1 -1
- package/dist/@kdcloudjs/table.js +540 -333
- package/dist/@kdcloudjs/table.js.map +1 -1
- package/dist/@kdcloudjs/table.min.css +1 -1
- package/dist/@kdcloudjs/table.min.js +4 -4
- package/dist/@kdcloudjs/table.min.js.map +1 -1
- package/es/table/base/styles.js +8 -4
- package/es/table/base/table.d.ts +1 -0
- package/es/table/base/table.js +5 -3
- package/es/table/pipeline/features/columnDrag.js +220 -242
- package/es/table/pipeline/features/columnResizeWidth.js +40 -5
- package/es/table/pipeline/features/rowDrag.js +169 -80
- package/es/table/pipeline/features/utils/touchEventUtils.d.ts +15 -0
- package/es/table/pipeline/features/utils/touchEventUtils.js +65 -0
- package/lib/table/base/styles.js +8 -4
- package/lib/table/base/table.d.ts +1 -0
- package/lib/table/base/table.js +5 -3
- package/lib/table/pipeline/features/columnDrag.js +220 -242
- package/lib/table/pipeline/features/columnResizeWidth.js +40 -5
- package/lib/table/pipeline/features/rowDrag.js +169 -80
- package/lib/table/pipeline/features/utils/touchEventUtils.d.ts +15 -0
- package/lib/table/pipeline/features/utils/touchEventUtils.js +76 -0
- package/package.json +1 -1
package/lib/table/base/styles.js
CHANGED
|
@@ -8,8 +8,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
8
8
|
value: true
|
|
9
9
|
});
|
|
10
10
|
exports.variableConst = exports.defaultCSSVariables = exports.StyledArtTableWrapper = exports.MenuClasses = exports.LOCK_SHADOW_PADDING = exports.GlobalStyle = exports.Classes = exports.ButtonCSS = void 0;
|
|
11
|
-
var _keys = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/object/keys"));
|
|
12
11
|
var _concat = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/concat"));
|
|
12
|
+
var _keys = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/object/keys"));
|
|
13
13
|
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/taggedTemplateLiteral"));
|
|
14
14
|
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
15
15
|
var _utils = require("./utils");
|
|
@@ -174,7 +174,11 @@ var variableConst = getCssVariableText(defaultCSSVariables);
|
|
|
174
174
|
exports.variableConst = variableConst;
|
|
175
175
|
var notBorderedStyleMixin = (0, _styledComponents.css)(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2.default)(["\n --cell-border-vertical: none;\n --header-cell-border-vertical: none;\n"])));
|
|
176
176
|
var borderedStyleMixin = (0, _styledComponents.css)(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2.default)(["\n //th\u9690\u85CF\u5217\u5BBD\u62D6\u62FD\u7684\u80CC\u666F\u8272\uFF0C\u4F7F\u7528th\u7684\u53F3\u8FB9\u6846\u4EE3\u66FF\n .", "::after{\n background-color: inherit;\n }\n"])), Classes.tableHeaderCellResize);
|
|
177
|
-
var StyledArtTableWrapper = _styledComponents.default.div(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2.default)(["\n :root {\n ", "\n }\n ", "\n\n box-sizing: border-box;\n * {\n box-sizing: border-box;\n }\n cursor: default;\n color: var(--color);\n font-size: var(--font-size);\n line-height: var(--line-height);\n position: relative;\n\n // \u8868\u683C\u5916\u8FB9\u6846\u7531 art-table-wrapper \u63D0\u4F9B\uFF0C\u800C\u4E0D\u662F\u7531\u5355\u5143\u683C\u63D0\u4F9B\n &.use-outer-border {\n ", ";\n }\n\n // \u8868\u683C\u4E0D\u542F\u7528\u8FB9\u6846\u7EBF\uFF0C\u9690\u85CFth\u3001td\u7684\u5355\u5143\u683C\u5DE6\u53F3\u8FB9\u6846\u7EBF\n &:not(.", ") {\n ", "\n }\n &.", "{\n ", "\n }\n\n .no-scrollbar {\n ::-webkit-scrollbar {\n display: none;\n }\n }\n\n .", " {\n overflow: auto;\n flex-shrink: 1;\n flex-grow: 1;\n display: flex;\n flex-direction: column;\n }\n\n .", " {\n overflow: hidden;\n background: var(--header-bgcolor);\n display: flex;\n flex-shrink: 0;\n border-bottom: var(--header-cell-border-horizontal);\n }\n\n .", " {\n display: flex;\n // justify-content: flex-start;\n align-items: center;\n height: inherit;\n }\n\n .", " {\n overflow-x:auto;\n flex-shrink: 0;\n flex-grow: 0;\n scrollbar-width: none; // \u517C\u5BB9\u706B\u72D0\n & {\n ::-webkit-scrollbar {\n display:none;\n }\n }\n }\n\n .", " {\n display: flex;\n flex: none;\n }\n .", "{\n flex-grow:1;\n }\n .", ", .", " {\n background: var(--bgcolor);\n overflow: auto;\n overflow-x: hidden;\n overflow-anchor: none;\n position:relative;\n &.empty {\n position: relative;\n }\n }\n\n .", " {\n position: relative;\n }\n .", ", .", " {\n .", "{\n background-color: #e6effb !important;\n }\n .", "{\n border-top: 1px solid #0E5FD8 !important;\n }\n .", "{\n border-", ": 1px solid #0E5FD8 !important;\n }\n .", "{\n border-bottom: 1px solid #0E5FD8 !important;\n }\n .", "{\n border-", ": 1px solid #0E5FD8 !important;\n }\n }\n\n .", " {\n user-select:none;\n }\n\n .", " {\n user-select:none;\n // .", " .", " >td{\n // cursor:move;\n // }\n\n // .", " .", " >td{\n // cursor:no-drop;\n // }\n \n }\n\n .", "{\n opacity: 0.5;\n }\n .", "{\n border: 1px solid var(--primary-color)\n }\n\n .", " td{\n border-top: 1px solid var(--primary-color) !important;\n border-bottom: 1px solid var(--primary-color) !important;\n \n }\n .", " td:first-child{\n border-", ": 1px solid var(--primary-color) !important;\n \n }\n .", " td:last-child{\n border-", ": 1px solid var(--primary-color) !important;\n \n }\n\n\n // .", " td{\n // border-top: 1px solid var(--primary-color) !important;\n // }\n\n .", " td{\n border-top: 1px solid var(--primary-color) !important;\n border-bottom: 1px solid var(--primary-color) !important;\n }\n\n .", " td:first-child{\n border-", ": 1px solid var(--primary-color) !important;\n }\n\n .", " td:last-child{\n border-", ": 1px solid var(--primary-color) !important;\n }\n\n // .", " td{\n // border-bottom: 1px solid var(--primary-color) !important;\n // }\n\n .", " {\n cursor:pointer;\n }\n\n\n &.sticky-header .", " {\n position: sticky;\n top: 0;\n z-index: ", ";\n }\n\n &.sticky-footer .", " {\n position: sticky;\n bottom: 0;\n z-index: ", ";\n }\n\n table {\n width: 0;\n table-layout: fixed;\n border-collapse: separate;\n border-spacing: 0;\n display: table;\n margin: 0;\n padding: 0;\n flex-shrink: 0;\n flex-grow: 0;\n position:relative;\n }\n\n // \u5728 tr \u4E0A\u8BBE\u7F6E .no-hover \u53EF\u4EE5\u7981\u7528\u9F20\u6807\u60AC\u505C\u6548\u679C\n tr:not(.no-hover):hover > td {\n background: var(--hover-bgcolor);\n }\n // \u4F7F\u7528 js \u6DFB\u52A0\u60AC\u6D6E\u6548\u679C\n tr:not(.no-hover).row-hover > td {\n background: var(--hover-bgcolor);\n }\n // \u5728 tr \u8BBE\u7F6E highlight \u53EF\u4EE5\u4E3A\u5E95\u4E0B\u7684 td \u8BBE\u7F6E\u4E3A\u9AD8\u4EAE\u8272\n // \u800C\u8BBE\u7F6E .no-highlight \u7684\u8BDD\u5219\u53EF\u4EE5\u7981\u7528\u9AD8\u4EAE\u6548\u679C\uFF1B\n tr:not(.no-highlight).highlight > td {\n background: var(--highlight-bgcolor);\n }\n\n th {\n font-weight: normal;\n text-align: ", ";\n padding: var(--cell-padding);\n height: var(--header-row-height);\n color: var(--header-color);\n background: var(--header-bgcolor);\n border:1px solid transparent;\n border-", ": var(--header-cell-border-vertical);\n border-bottom: var(--header-cell-border-horizontal);\n position: relative;\n }\n\n th.resizeable{\n border-", ": var(--header-cell-border-vertical)\n }\n\n th.", " {\n border-", ": var(--header-cell-border-vertical);\n border-bottom: none;\n }\n\n tr.", " th {\n border-top: var(--header-cell-border-horizontal);\n }\n th.", " {\n border-", ": var(--header-cell-border-vertical);\n }\n\n td {\n padding: var(--cell-padding);\n background: var(--bgcolor);\n height: var(--row-height);\n border:1px solid transparent;\n border-", ": var(--cell-border-vertical);\n border-bottom: var(--cell-border-horizontal);\n word-break: break-all;\n }\n td.", " {\n border-", ": var(--cell-border-vertical);\n }\n tr.", " td {\n border-top: var(--cell-border-horizontal);\n }\n &.has-header tbody tr.", " td {\n border-top: none;\n }\n &.has-footer tbody tr.", " td {\n border-bottom: none;\n }\n\n .", ",\n .", " {\n z-index: ", ";\n }\n\n //#region \u9501\u5217\u9634\u5F71\n .", " {\n position: absolute;\n top: 0;\n bottom: 0;\n z-index: ", ";\n pointer-events: none;\n overflow: hidden;\n\n .", " {\n height: 100%;\n }\n\n .", " {\n margin-", ": ", "px;\n \n box-shadow: none;\n\n &.show-shadow {\n box-shadow: var(--lock-shadow);\n border-", ": var(--cell-border-vertical);\n }\n }\n\n .", " {\n margin-", ": ", "px;\n box-shadow: none;\n\n &.show-shadow {\n box-shadow: var(--lock-shadow);\n border-", ": var(--cell-border-vertical);\n }\n }\n }\n //#endregion\n\n //#region \u7A7A\u8868\u683C\u5C55\u73B0\n .", " {\n pointer-events: none;\n color: #99a3b3;\n font-size: 12px;\n text-align: center;\n position: absolute;\n left: 50%;\n top: 50%;\n transform: translate(-50%, -50%);\n\n .empty-image {\n width: 50px;\n height: 50px;\n }\n\n .empty-tips {\n margin-top: 16px;\n line-height: 1.5;\n }\n }\n //#endregion\n\n //#region sticky\u517C\u5BB9\n &.sticky-polyfill-wrapper{\n //\u9501\u5B9A\u5217\u517C\u5BB9 \u4EC5\u5728\u9501\u5B9A\u5217\u7684\u60C5\u51B5\u4E0B\u751F\u6548\n .", " {\n overflow-x: hidden;\n }\n .", ", .", " {\n position:relative;\n }\n .", " {\n overflow: hidden;\n display: flex;\n }\n .", " {\n position: relative;\n }\n\n .", " {\n display: flex;\n overflow: auto;\n overflow-x: hidden;\n overflow-anchor: none;\n }\n\n .", ", .", "{\n position: absolute;\n z-index: ", ";\n top: 0;\n }\n .", "{\n ", ":0;\n }\n .", "{\n rig", "ht:0;\n }\n\n .", "{\n .", "{\n position: absolute;\n top: 0;\n width: 100%;\n z-index: ", ";\n }\n }\n\n tr:not(.no-hover).row-hover > td {\n background: var(--hover-bgcolor);\n }\n }\n //#endregion sticky\u517C\u5BB9\n\n //#region \u7C98\u6027\u6EDA\u52A8\u6761\n .", "{\n display:flex;\n background: var(--bgcolor);\n }\n .", "{\n height: 1px;\n flex-shrink: 0;\n border-top: 1px solid var(--border-color);\n }\n\n .", "{\n height: 1px;\n flex-shrink: 0;\n border-top: 1px solid var(--border-color);\n }\n .", " {\n overflow-y: hidden;\n overflow-x: auto;\n z-index: ", ";\n flex-shrink: 1;\n flex-grow: 0;\n border-top: 1px solid var(--border-color);\n }\n\n .", " {\n // \u5FC5\u987B\u6709\u9AD8\u5EA6\u624D\u80FD\u51FA\u73B0\u6EDA\u52A8\u6761\n height: 1px;\n visibility: hidden;\n }\n //#endregion\n\n //#region \u52A0\u8F7D\u6837\u5F0F\n .", " {\n position: relative;\n width: 100%;\n height: 100%;\n overflow: auto;\n\n .", " {\n filter: none;\n width: 100%;\n height: 100%;\n overflow: hidden;//\u5217\u5168\u90E8\u56FA\u5B9A\u65F6\uFF0C\u5B58\u5728\u53CC\u6A2A\u5411\u6EDA\u52A8\u6761\n display: flex;\n position: relative;\n flex-direction: column;\n }\n\n .", " {\n position: absolute;\n left: 0;\n right: 0;\n top: 0;\n bottom: 0;\n pointer-events: none;\n }\n\n .", " {\n position: sticky;\n z-index: ", ";\n transform: translateY(-50%);\n }\n }\n //#endregion\n\n //#region \u8868\u683C\u8FC7\u6EE4\n .", " {\n color:var(--icon-color);\n &.active{\n color:var(--primary-color);\n }\n padding: 6px 4px;\n &:hover{\n background-color: #e5e5e5;\n }\n &:focus {\n outline: none\n }\n }\n //#endregion\n\n //#region \u8868\u683C\u6392\u5E8F\n .", " {\n color:var(--icon-color);\n &.active{\n color:var(--primary-color);\n }\n }\n .", " {\n color:var(--icon-color);\n &.active{\n color:var(--primary-color);\n }\n }\n //#endregion\n\n //#region \u6EDA\u52A8\u6761\u5360\u4F4D\n .", " {\n // visibility: hidden;\n background: var(--header-bgcolor);\n position:sticky;\n z-index:5;\n ", ":0px;\n flex-shrink: 0;\n }\n .", " .", " {\n border-top: var(--cell-border-horizontal);\n }\n //#endregion\n\n //#region \u62D6\u62FD\u5217\u5BBD\u5927\u5C0F\n .", "::after{\n background-color: var(--border-color);\n }\n //\u89E3\u51B3\u90E8\u5206\u6D4F\u89C8\u5668(chrome109)\u6700\u540E\u4E00\u4E2A\u5355\u5143\u683C\u7684\u5217\u5BBD\u62D6\u62FD\u533A\u57DF\u7EDD\u5BF9\u5B9A\u4F4D\u8D85\u51FA\u8868\u683C\uFF0C\u5BFC\u81F4\u8868\u683C\u7AD6\u5206\u5272\u7EBF\u65E0\u6CD5\u5BF9\u9F50\n .", " th.", " .", "{\n ", ": 0;\n width: 5px;\n &::after{\n ", ": 4px;\n }\n }\n"])), variableConst, variableConst, outerBorderStyleMixin, Classes.artTableBordered, notBorderedStyleMixin, Classes.artTableBordered, borderedStyleMixin, Classes.artTable, Classes.tableHeader, Classes.tableHeaderCellContent, Classes.virtual, Classes.tableFooter, Classes.tableBody, Classes.tableBody, Classes.tableFooter, Classes.tableRow, Classes.tableBody, Classes.tableFooter, Classes.tableCellRangeSelected, Classes.tableCellRangeTop, Classes.tableCellRangeLeft, function (props) {
|
|
177
|
+
var StyledArtTableWrapper = _styledComponents.default.div(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2.default)(["\n ", "\n box-sizing: border-box;\n * {\n box-sizing: border-box;\n }\n cursor: default;\n color: var(--color);\n font-size: var(--font-size);\n line-height: var(--line-height);\n position: relative;\n\n // \u8868\u683C\u5916\u8FB9\u6846\u7531 art-table-wrapper \u63D0\u4F9B\uFF0C\u800C\u4E0D\u662F\u7531\u5355\u5143\u683C\u63D0\u4F9B\n &.use-outer-border {\n ", ";\n }\n\n // \u8868\u683C\u4E0D\u542F\u7528\u8FB9\u6846\u7EBF\uFF0C\u9690\u85CFth\u3001td\u7684\u5355\u5143\u683C\u5DE6\u53F3\u8FB9\u6846\u7EBF\n &:not(.", ") {\n ", "\n }\n &.", "{\n ", "\n }\n\n .no-scrollbar {\n ::-webkit-scrollbar {\n display: none;\n }\n }\n\n .", " {\n overflow: auto;\n flex-shrink: 1;\n flex-grow: 1;\n display: flex;\n flex-direction: column;\n }\n\n .", " {\n overflow: hidden;\n background: var(--header-bgcolor);\n display: flex;\n flex-shrink: 0;\n border-bottom: var(--header-cell-border-horizontal);\n }\n\n .", " {\n display: flex;\n // justify-content: flex-start;\n align-items: center;\n height: inherit;\n }\n\n .", " {\n overflow-x:auto;\n flex-shrink: 0;\n flex-grow: 0;\n scrollbar-width: none; // \u517C\u5BB9\u706B\u72D0\n & {\n ::-webkit-scrollbar {\n display:none;\n }\n }\n }\n\n .", " {\n display: flex;\n flex: none;\n }\n .", "{\n flex-grow:1;\n }\n .", ", .", " {\n background: var(--bgcolor);\n overflow: auto;\n overflow-x: hidden;\n overflow-anchor: none;\n position:relative;\n &.empty {\n position: relative;\n }\n }\n\n .", " {\n position: relative;\n }\n .", ", .", " {\n .", "{\n background-color: #e6effb !important;\n }\n .", "{\n border-top: 1px solid #0E5FD8 !important;\n }\n .", "{\n border-", ": 1px solid #0E5FD8 !important;\n }\n .", "{\n border-bottom: 1px solid #0E5FD8 !important;\n }\n .", "{\n border-", ": 1px solid #0E5FD8 !important;\n }\n }\n\n .", " {\n user-select:none;\n }\n\n .", " {\n user-select:none;\n // .", " .", " >td{\n // cursor:move;\n // }\n\n // .", " .", " >td{\n // cursor:no-drop;\n // }\n \n }\n\n .", "{\n opacity: 0.5;\n }\n .", "{\n border: 1px solid var(--primary-color)\n }\n\n .", " td{\n border-top: 1px solid var(--primary-color) !important;\n border-bottom: 1px solid var(--primary-color) !important;\n \n }\n .", " td:first-child{\n border-", ": 1px solid var(--primary-color) !important;\n \n }\n .", " td:last-child{\n border-", ": 1px solid var(--primary-color) !important;\n \n }\n\n\n // .", " td{\n // border-top: 1px solid var(--primary-color) !important;\n // }\n\n .", " td{\n border-top: 1px solid var(--primary-color) !important;\n border-bottom: 1px solid var(--primary-color) !important;\n }\n\n .", " td:first-child{\n border-", ": 1px solid var(--primary-color) !important;\n }\n\n .", " td:last-child{\n border-", ": 1px solid var(--primary-color) !important;\n }\n\n // .", " td{\n // border-bottom: 1px solid var(--primary-color) !important;\n // }\n\n .", " {\n cursor:pointer;\n }\n\n\n &.sticky-header .", " {\n position: sticky;\n top: 0;\n z-index: ", ";\n }\n\n &.sticky-footer .", " {\n position: sticky;\n bottom: 0;\n z-index: ", ";\n }\n\n table {\n width: 0;\n table-layout: fixed;\n border-collapse: separate;\n border-spacing: 0;\n display: table;\n margin: 0;\n padding: 0;\n flex-shrink: 0;\n flex-grow: 0;\n position:relative;\n }\n\n // \u5728 tr \u4E0A\u8BBE\u7F6E .no-hover \u53EF\u4EE5\u7981\u7528\u9F20\u6807\u60AC\u505C\u6548\u679C\n tr:not(.no-hover):hover > td {\n background: var(--hover-bgcolor);\n }\n // \u4F7F\u7528 js \u6DFB\u52A0\u60AC\u6D6E\u6548\u679C\n tr:not(.no-hover).row-hover > td {\n background: var(--hover-bgcolor);\n }\n // \u5728 tr \u8BBE\u7F6E highlight \u53EF\u4EE5\u4E3A\u5E95\u4E0B\u7684 td \u8BBE\u7F6E\u4E3A\u9AD8\u4EAE\u8272\n // \u800C\u8BBE\u7F6E .no-highlight \u7684\u8BDD\u5219\u53EF\u4EE5\u7981\u7528\u9AD8\u4EAE\u6548\u679C\uFF1B\n tr:not(.no-highlight).highlight > td {\n background: var(--highlight-bgcolor);\n }\n\n th {\n font-weight: normal;\n text-align: ", ";\n padding: var(--cell-padding);\n height: var(--header-row-height);\n color: var(--header-color);\n background: var(--header-bgcolor);\n border:1px solid transparent;\n border-", ": var(--header-cell-border-vertical);\n border-bottom: var(--header-cell-border-horizontal);\n position: relative;\n }\n\n th.resizeable{\n border-", ": var(--header-cell-border-vertical)\n }\n\n th.", " {\n border-", ": var(--header-cell-border-vertical);\n border-bottom: none;\n }\n\n tr.", " th {\n border-top: var(--header-cell-border-horizontal);\n }\n th.", " {\n border-", ": var(--header-cell-border-vertical);\n }\n\n td {\n padding: var(--cell-padding);\n background: var(--bgcolor);\n height: var(--row-height);\n border:1px solid transparent;\n border-", ": var(--cell-border-vertical);\n border-bottom: var(--cell-border-horizontal);\n word-break: break-all;\n }\n td.", " {\n border-", ": var(--cell-border-vertical);\n }\n tr.", " td {\n border-top: var(--cell-border-horizontal);\n }\n &.has-header tbody tr.", " td {\n border-top: none;\n }\n &.has-footer tbody tr.", " td {\n border-bottom: none;\n }\n\n .", ",\n .", " {\n z-index: ", ";\n }\n\n //#region \u9501\u5217\u9634\u5F71\n .", " {\n position: absolute;\n top: 0;\n bottom: 0;\n z-index: ", ";\n pointer-events: none;\n overflow: hidden;\n\n .", " {\n height: 100%;\n }\n\n .", " {\n margin-", ": ", "px;\n \n box-shadow: none;\n\n &.show-shadow {\n box-shadow: var(--lock-shadow);\n border-", ": var(--cell-border-vertical);\n }\n }\n\n .", " {\n margin-", ": ", "px;\n box-shadow: none;\n\n &.show-shadow {\n box-shadow: var(--lock-shadow);\n border-", ": var(--cell-border-vertical);\n }\n }\n }\n //#endregion\n\n //#region \u7A7A\u8868\u683C\u5C55\u73B0\n .", " {\n pointer-events: none;\n color: #99a3b3;\n font-size: 12px;\n text-align: center;\n position: absolute;\n left: 50%;\n top: 50%;\n transform: translate(-50%, -50%);\n\n .empty-image {\n width: 50px;\n height: 50px;\n }\n\n .empty-tips {\n margin-top: 16px;\n line-height: 1.5;\n }\n }\n //#endregion\n\n //#region sticky\u517C\u5BB9\n &.sticky-polyfill-wrapper{\n //\u9501\u5B9A\u5217\u517C\u5BB9 \u4EC5\u5728\u9501\u5B9A\u5217\u7684\u60C5\u51B5\u4E0B\u751F\u6548\n .", " {\n overflow-x: hidden;\n }\n .", ", .", " {\n position:relative;\n }\n .", " {\n overflow: hidden;\n display: flex;\n }\n .", " {\n position: relative;\n }\n\n .", " {\n display: flex;\n overflow: auto;\n overflow-x: hidden;\n overflow-anchor: none;\n }\n\n .", ", .", "{\n position: absolute;\n z-index: ", ";\n top: 0;\n }\n .", "{\n ", ":0;\n }\n .", "{\n rig", "ht:0;\n }\n\n .", "{\n .", "{\n position: absolute;\n top: 0;\n width: 100%;\n z-index: ", ";\n }\n }\n\n tr:not(.no-hover).row-hover > td {\n background: var(--hover-bgcolor);\n }\n }\n //#endregion sticky\u517C\u5BB9\n\n //#region \u7C98\u6027\u6EDA\u52A8\u6761\n .", "{\n display:flex;\n background: var(--bgcolor);\n }\n .", "{\n height: 1px;\n flex-shrink: 0;\n border-top: 1px solid var(--border-color);\n }\n\n .", "{\n height: 1px;\n flex-shrink: 0;\n border-top: 1px solid var(--border-color);\n }\n .", " {\n overflow-y: hidden;\n overflow-x: auto;\n z-index: ", ";\n flex-shrink: 1;\n flex-grow: 0;\n border-top: 1px solid var(--border-color);\n }\n\n .", " {\n // \u5FC5\u987B\u6709\u9AD8\u5EA6\u624D\u80FD\u51FA\u73B0\u6EDA\u52A8\u6761\n height: 1px;\n visibility: hidden;\n }\n //#endregion\n\n //#region \u52A0\u8F7D\u6837\u5F0F\n .", " {\n position: relative;\n width: 100%;\n height: 100%;\n overflow: auto;\n\n .", " {\n filter: none;\n width: 100%;\n height: 100%;\n overflow: hidden;//\u5217\u5168\u90E8\u56FA\u5B9A\u65F6\uFF0C\u5B58\u5728\u53CC\u6A2A\u5411\u6EDA\u52A8\u6761\n display: flex;\n position: relative;\n flex-direction: column;\n }\n\n .", " {\n position: absolute;\n left: 0;\n right: 0;\n top: 0;\n bottom: 0;\n pointer-events: none;\n }\n\n .", " {\n position: sticky;\n z-index: ", ";\n transform: translateY(-50%);\n }\n }\n //#endregion\n\n //#region \u8868\u683C\u8FC7\u6EE4\n .", " {\n color:var(--icon-color);\n &.active{\n color:var(--primary-color);\n }\n padding: 6px 4px;\n &:hover{\n background-color: #e5e5e5;\n }\n &:focus {\n outline: none\n }\n }\n //#endregion\n\n //#region \u8868\u683C\u6392\u5E8F\n .", " {\n color:var(--icon-color);\n &.active{\n color:var(--primary-color);\n }\n }\n .", " {\n color:var(--icon-color);\n &.active{\n color:var(--primary-color);\n }\n }\n //#endregion\n\n //#region \u6EDA\u52A8\u6761\u5360\u4F4D\n .", " {\n // visibility: hidden;\n background: var(--header-bgcolor);\n position:sticky;\n z-index:5;\n ", ":0px;\n flex-shrink: 0;\n }\n .", " .", " {\n border-top: var(--cell-border-horizontal);\n }\n //#endregion\n\n //#region \u62D6\u62FD\u5217\u5BBD\u5927\u5C0F\n .", "::after{\n background-color: var(--border-color);\n }\n //\u89E3\u51B3\u90E8\u5206\u6D4F\u89C8\u5668(chrome109)\u6700\u540E\u4E00\u4E2A\u5355\u5143\u683C\u7684\u5217\u5BBD\u62D6\u62FD\u533A\u57DF\u7EDD\u5BF9\u5B9A\u4F4D\u8D85\u51FA\u8868\u683C\uFF0C\u5BFC\u81F4\u8868\u683C\u7AD6\u5206\u5272\u7EBF\u65E0\u6CD5\u5BF9\u9F50\n .", " th.", " .", "{\n ", ": 0;\n width: 5px;\n &::after{\n ", ": 4px;\n }\n }\n"])), function (_ref) {
|
|
178
|
+
var _context, _context2, _context3;
|
|
179
|
+
var prefixCls = _ref.prefixCls;
|
|
180
|
+
return prefixCls ? (0, _concat.default)(_context = (0, _concat.default)(_context2 = "&.".concat(prefixCls, "-table {:root {")).call(_context2, variableConst, "} ")).call(_context, variableConst, "}") : (0, _concat.default)(_context3 = ":root {".concat(variableConst, "} ")).call(_context3, variableConst);
|
|
181
|
+
}, outerBorderStyleMixin, Classes.artTableBordered, notBorderedStyleMixin, Classes.artTableBordered, borderedStyleMixin, Classes.artTable, Classes.tableHeader, Classes.tableHeaderCellContent, Classes.virtual, Classes.tableFooter, Classes.tableBody, Classes.tableBody, Classes.tableFooter, Classes.tableRow, Classes.tableBody, Classes.tableFooter, Classes.tableCellRangeSelected, Classes.tableCellRangeTop, Classes.tableCellRangeLeft, function (props) {
|
|
178
182
|
return (0, _utils.swapRTLDirection)(props.direction, 'left');
|
|
179
183
|
}, Classes.tableCellRangeBottom, Classes.tableCellRangeRight, function (props) {
|
|
180
184
|
return (0, _utils.swapRTLDirection)(props.direction, 'right');
|
|
@@ -224,8 +228,8 @@ var ButtonCSS = (0, _styledComponents.css)(_templateObject6 || (_templateObject6
|
|
|
224
228
|
exports.ButtonCSS = ButtonCSS;
|
|
225
229
|
function getCssVariableText(obj) {
|
|
226
230
|
return (0, _keys.default)(obj).reduce(function (acc, key) {
|
|
227
|
-
var
|
|
228
|
-
acc += (0, _concat.default)(
|
|
231
|
+
var _context4;
|
|
232
|
+
acc += (0, _concat.default)(_context4 = "".concat(key, ":")).call(_context4, obj[key], ";");
|
|
229
233
|
return acc;
|
|
230
234
|
}, '');
|
|
231
235
|
}
|
package/lib/table/base/table.js
CHANGED
|
@@ -502,7 +502,8 @@ var BaseTable = /*#__PURE__*/function (_React$Component) {
|
|
|
502
502
|
footerDataSource = _this$props8.footerDataSource,
|
|
503
503
|
components = _this$props8.components,
|
|
504
504
|
bordered = _this$props8.bordered,
|
|
505
|
-
direction = _this$props8.direction
|
|
505
|
+
direction = _this$props8.direction,
|
|
506
|
+
prefixCls = _this$props8.prefixCls;
|
|
506
507
|
info.direction = direction;
|
|
507
508
|
var artTableWrapperClassName = (0, _classnames.default)(_styles.Classes.artTableWrapper, (_cx = {
|
|
508
509
|
'use-outer-border': useOuterBorder,
|
|
@@ -512,7 +513,7 @@ var BaseTable = /*#__PURE__*/function (_React$Component) {
|
|
|
512
513
|
'sticky-header': isStickyHeader !== null && isStickyHeader !== void 0 ? isStickyHeader : isStickyHead,
|
|
513
514
|
'has-footer': footerDataSource.length > 0,
|
|
514
515
|
'sticky-footer': isStickyFooter
|
|
515
|
-
}, (0, _defineProperty2.default)(_cx, _styles.Classes.artTableBordered, bordered), (0, _defineProperty2.default)(_cx, 'ie-polyfill-wrapper', _utils2.browserType.isIE), (0, _defineProperty2.default)(_cx, 'sticky-polyfill-wrapper', (0, _utils2.isStickyUIDegrade)()), _cx), className);
|
|
516
|
+
}, (0, _defineProperty2.default)(_cx, _styles.Classes.artTableBordered, bordered), (0, _defineProperty2.default)(_cx, 'ie-polyfill-wrapper', _utils2.browserType.isIE), (0, _defineProperty2.default)(_cx, 'sticky-polyfill-wrapper', (0, _utils2.isStickyUIDegrade)()), (0, _defineProperty2.default)(_cx, "".concat(prefixCls, "-table"), prefixCls), _cx), className);
|
|
516
517
|
var artTableWrapperProps = (0, _defineProperty2.default)({
|
|
517
518
|
className: artTableWrapperClassName,
|
|
518
519
|
style: (0, _extends2.default)((0, _extends2.default)({}, style), {
|
|
@@ -523,7 +524,8 @@ var BaseTable = /*#__PURE__*/function (_React$Component) {
|
|
|
523
524
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_globalStyleComponent.default, {
|
|
524
525
|
direction: info.direction
|
|
525
526
|
}), /*#__PURE__*/_react.default.createElement(_styles.StyledArtTableWrapper, (0, _extends2.default)({}, artTableWrapperProps, {
|
|
526
|
-
direction: info.direction
|
|
527
|
+
direction: info.direction,
|
|
528
|
+
prefixCls: this.props.prefixCls
|
|
527
529
|
}), /*#__PURE__*/_react.default.createElement(_loading.default, {
|
|
528
530
|
visible: isLoading,
|
|
529
531
|
LoadingIcon: components.LoadingIcon,
|
|
@@ -11,6 +11,7 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/e
|
|
|
11
11
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/toConsumableArray"));
|
|
12
12
|
var _utils = require("../../utils");
|
|
13
13
|
var _autoFill = require("./autoFill");
|
|
14
|
+
var _touchEventUtils = require("./utils/touchEventUtils");
|
|
14
15
|
var stateKey = 'columnDrag';
|
|
15
16
|
var SCROLL_SIZE = 30;
|
|
16
17
|
function disableSelect(event) {
|
|
@@ -68,251 +69,237 @@ function columnDrag() {
|
|
|
68
69
|
style: style
|
|
69
70
|
});
|
|
70
71
|
},
|
|
71
|
-
headerCellProps: (0, _utils.mergeCellProps)(col.headerCellProps, {
|
|
72
|
-
onMouseDown:
|
|
72
|
+
headerCellProps: (0, _utils.mergeCellProps)(col.headerCellProps, (0, _extends2.default)((0, _extends2.default)({}, isLeaf && path.length === 1 ? {
|
|
73
|
+
onMouseDown: function onMouseDown(e) {
|
|
73
74
|
if (e.button !== 0 || !e.currentTarget.contains(e.target)) {
|
|
74
75
|
return;
|
|
75
76
|
}
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
//
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
if (
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
lock: lock
|
|
183
|
-
})) {
|
|
184
|
-
cloumnsTranslateData[code] += _adjustTranslation(optionColumn.width);
|
|
185
|
-
if ((0, _utils.isLeafNode)(columns[index])) {
|
|
186
|
-
cloumnsTranslateData[optionColumn.code] -= _adjustTranslation(width);
|
|
187
|
-
} else {
|
|
188
|
-
cloumnsTranslateData[optionColumn.code] -= _adjustTranslation(getColumnWidth(columns[index]));
|
|
189
|
-
moveAllChildren(children, cloumnsTranslateData, _adjustTranslation(optionColumn.width));
|
|
190
|
-
}
|
|
191
|
-
columnMoved = true;
|
|
192
|
-
}
|
|
193
|
-
index++;
|
|
194
|
-
}
|
|
195
|
-
} else if (startIndex < replaceIndex) {
|
|
196
|
-
// 右移
|
|
197
|
-
while (startIndex < index) {
|
|
198
|
-
var _columns$index2 = columns[index],
|
|
199
|
-
_code = _columns$index2.code,
|
|
200
|
-
_lock = _columns$index2.lock,
|
|
201
|
-
_width = _columns$index2.width,
|
|
202
|
-
_children = _columns$index2.children;
|
|
203
|
-
if (enableMove({
|
|
204
|
-
code: _code,
|
|
205
|
-
lock: _lock
|
|
206
|
-
})) {
|
|
207
|
-
cloumnsTranslateData[_code] -= _adjustTranslation(optionColumn.width);
|
|
208
|
-
if ((0, _utils.isLeafNode)(columns[index])) {
|
|
209
|
-
cloumnsTranslateData[optionColumn.code] += _adjustTranslation(_width);
|
|
210
|
-
} else {
|
|
211
|
-
cloumnsTranslateData[optionColumn.code] += _adjustTranslation(getColumnWidth(columns[index]));
|
|
212
|
-
moveAllChildren(_children, cloumnsTranslateData, _adjustTranslation(optionColumn.width), true);
|
|
213
|
-
}
|
|
214
|
-
columnMoved = true;
|
|
215
|
-
}
|
|
216
|
-
index--;
|
|
77
|
+
handlePointerDown(e.nativeEvent, false, e.currentTarget);
|
|
78
|
+
},
|
|
79
|
+
onTouchStart: function onTouchStart(e) {
|
|
80
|
+
// 阻止触摸事件的默认行为
|
|
81
|
+
if (e.cancelable) {
|
|
82
|
+
e.preventDefault();
|
|
83
|
+
}
|
|
84
|
+
handlePointerDown(e.nativeEvent, true, e.currentTarget);
|
|
85
|
+
}
|
|
86
|
+
} : {}), {
|
|
87
|
+
style: style
|
|
88
|
+
}))
|
|
89
|
+
});
|
|
90
|
+
// 统一的拖拽处理函数
|
|
91
|
+
function handlePointerDown(startEvent, isTouch, currentTarget) {
|
|
92
|
+
var _a;
|
|
93
|
+
window.addEventListener('selectstart', disableSelect);
|
|
94
|
+
var columnMoved = false;
|
|
95
|
+
var columns = pipeline.getColumns();
|
|
96
|
+
var _pipeline$getStateAtK2 = pipeline.getStateAtKey(stateKey, {}),
|
|
97
|
+
cloumnsTranslateData = _pipeline$getStateAtK2.cloumnsTranslateData;
|
|
98
|
+
var cloumnsSortData = {};
|
|
99
|
+
columns.forEach(function (item, index) {
|
|
100
|
+
cloumnsSortData[item.code] = index;
|
|
101
|
+
});
|
|
102
|
+
var rect = (_a = currentTarget.parentElement) === null || _a === void 0 ? void 0 : _a.getClientRects()[0];
|
|
103
|
+
if (!rect) return;
|
|
104
|
+
var startX = direction === 'rtl' ? rect.right : rect.left;
|
|
105
|
+
var startCoordinates = (0, _touchEventUtils.getEventCoordinates)(startEvent);
|
|
106
|
+
var mouseDownClientX = startCoordinates.clientX;
|
|
107
|
+
var mouseDownClientY = startCoordinates.clientY;
|
|
108
|
+
var moveData = [];
|
|
109
|
+
var allColumns = (0, _utils.collectNodes)(columns);
|
|
110
|
+
var tableBodyClientRect = tableBody.getBoundingClientRect();
|
|
111
|
+
var startScrollLeft = pipeline.ref.current.domHelper.virtual.scrollLeft;
|
|
112
|
+
var updateScrollPosition = function updateScrollPosition(client) {
|
|
113
|
+
var clientX = client.clientX;
|
|
114
|
+
var left = tableBodyClientRect.left,
|
|
115
|
+
width = tableBodyClientRect.width;
|
|
116
|
+
if (clientX + SCROLL_SIZE >= left + width) {
|
|
117
|
+
pipeline.ref.current.domHelper.virtual.scrollLeft += SCROLL_SIZE;
|
|
118
|
+
}
|
|
119
|
+
if (clientX - SCROLL_SIZE <= left) {
|
|
120
|
+
pipeline.ref.current.domHelper.virtual.scrollLeft -= SCROLL_SIZE;
|
|
121
|
+
}
|
|
122
|
+
};
|
|
123
|
+
function handlePointerMove(e) {
|
|
124
|
+
// 触摸事件需要阻止默认行为,防止页面滚动
|
|
125
|
+
if (isTouch && e.cancelable) {
|
|
126
|
+
e.preventDefault();
|
|
127
|
+
}
|
|
128
|
+
var coordinates = (0, _touchEventUtils.getEventCoordinates)(e);
|
|
129
|
+
var client = {
|
|
130
|
+
clientX: coordinates.clientX,
|
|
131
|
+
clientY: coordinates.clientY
|
|
132
|
+
};
|
|
133
|
+
var scrollDistance = pipeline.ref.current.domHelper.virtual.scrollLeft - startScrollLeft;
|
|
134
|
+
var startPosition = startX - scrollDistance; // 表头最左边起点
|
|
135
|
+
var offsetDistance = direction === 'rtl' ? startPosition - coordinates.clientX : coordinates.clientX - startPosition;
|
|
136
|
+
updateScrollPosition(client);
|
|
137
|
+
if (offsetDistance < 20) {
|
|
138
|
+
return;
|
|
139
|
+
} else {
|
|
140
|
+
e.stopPropagation();
|
|
141
|
+
}
|
|
142
|
+
document.body.style.userSelect = 'none';
|
|
143
|
+
currentTarget.style.cursor = 'move';
|
|
144
|
+
// 重置位置信息
|
|
145
|
+
cloumnsTranslateData = {};
|
|
146
|
+
allColumns.forEach(function (item) {
|
|
147
|
+
cloumnsTranslateData[item.code] = 0;
|
|
148
|
+
});
|
|
149
|
+
// 计算平移位置
|
|
150
|
+
var replaceIndex = 0;
|
|
151
|
+
var totalWitdth = getColumnWidth(columns[replaceIndex]);
|
|
152
|
+
while (totalWitdth < offsetDistance && replaceIndex < columns.length - 1) {
|
|
153
|
+
replaceIndex++;
|
|
154
|
+
totalWitdth += getColumnWidth(columns[replaceIndex]);
|
|
155
|
+
}
|
|
156
|
+
// 需要取最新startIndex, 不能直接用makeRecursiveMapper提供的startIndex(因为map时还没添加选择列、充满列等后面use添加的列)
|
|
157
|
+
var startIndex;
|
|
158
|
+
columns.forEach(function (column, index) {
|
|
159
|
+
if (column.code === col.code) {
|
|
160
|
+
startIndex = index;
|
|
161
|
+
}
|
|
162
|
+
});
|
|
163
|
+
var optionColumn = columns[startIndex];
|
|
164
|
+
var index = replaceIndex;
|
|
165
|
+
if (startIndex > replaceIndex) {
|
|
166
|
+
// 左移
|
|
167
|
+
while (index < startIndex) {
|
|
168
|
+
var _columns$index = columns[index],
|
|
169
|
+
code = _columns$index.code,
|
|
170
|
+
lock = _columns$index.lock,
|
|
171
|
+
width = _columns$index.width,
|
|
172
|
+
children = _columns$index.children;
|
|
173
|
+
if (enableMove({
|
|
174
|
+
code: code,
|
|
175
|
+
lock: lock
|
|
176
|
+
})) {
|
|
177
|
+
cloumnsTranslateData[code] += _adjustTranslation(optionColumn.width);
|
|
178
|
+
if ((0, _utils.isLeafNode)(columns[index])) {
|
|
179
|
+
cloumnsTranslateData[optionColumn.code] -= _adjustTranslation(width);
|
|
180
|
+
} else {
|
|
181
|
+
cloumnsTranslateData[optionColumn.code] -= _adjustTranslation(getColumnWidth(columns[index]));
|
|
182
|
+
moveAllChildren(children, cloumnsTranslateData, _adjustTranslation(optionColumn.width));
|
|
217
183
|
}
|
|
184
|
+
columnMoved = true;
|
|
218
185
|
}
|
|
219
|
-
|
|
220
|
-
pipeline.setStateAtKey(stateKey, {
|
|
221
|
-
cloumnsTranslateData: cloumnsTranslateData
|
|
222
|
-
});
|
|
223
|
-
moveData = [startIndex, replaceIndex];
|
|
224
|
-
});
|
|
186
|
+
index++;
|
|
225
187
|
}
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
188
|
+
} else if (startIndex < replaceIndex) {
|
|
189
|
+
// 右移
|
|
190
|
+
while (startIndex < index) {
|
|
191
|
+
var _columns$index2 = columns[index],
|
|
192
|
+
_code = _columns$index2.code,
|
|
193
|
+
_lock = _columns$index2.lock,
|
|
194
|
+
_width = _columns$index2.width,
|
|
195
|
+
_children = _columns$index2.children;
|
|
196
|
+
if (enableMove({
|
|
197
|
+
code: _code,
|
|
198
|
+
lock: _lock
|
|
199
|
+
})) {
|
|
200
|
+
cloumnsTranslateData[_code] -= _adjustTranslation(optionColumn.width);
|
|
201
|
+
if ((0, _utils.isLeafNode)(columns[index])) {
|
|
202
|
+
cloumnsTranslateData[optionColumn.code] += _adjustTranslation(_width);
|
|
203
|
+
} else {
|
|
204
|
+
cloumnsTranslateData[optionColumn.code] += _adjustTranslation(getColumnWidth(columns[index]));
|
|
205
|
+
moveAllChildren(_children, cloumnsTranslateData, _adjustTranslation(optionColumn.width), true);
|
|
206
|
+
}
|
|
207
|
+
columnMoved = true;
|
|
233
208
|
}
|
|
209
|
+
index--;
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
window.requestAnimationFrame(function () {
|
|
213
|
+
pipeline.setStateAtKey(stateKey, {
|
|
214
|
+
cloumnsTranslateData: cloumnsTranslateData
|
|
215
|
+
});
|
|
216
|
+
moveData = [startIndex, replaceIndex];
|
|
217
|
+
});
|
|
218
|
+
}
|
|
219
|
+
function handlePointerUp(e) {
|
|
220
|
+
(0, _touchEventUtils.removePointerEventListeners)(document.body, {
|
|
221
|
+
onPointerMove: handlePointerMove,
|
|
222
|
+
onPointerUp: handlePointerUp
|
|
223
|
+
}, isTouch);
|
|
224
|
+
window.removeEventListener('selectstart', disableSelect);
|
|
225
|
+
var endCoordinates = (0, _touchEventUtils.getEventCoordinates)(e);
|
|
226
|
+
if ((0, _touchEventUtils.hasMovedEnough)(mouseDownClientX, mouseDownClientY, endCoordinates.clientX, endCoordinates.clientY)) {
|
|
227
|
+
e.stopPropagation(); // 存在移动就阻止冒泡
|
|
228
|
+
currentTarget.addEventListener('click', stopClickPropagation); // 阻止列头点击事件,防止拖动后触发列头过滤事件
|
|
229
|
+
}
|
|
234
230
|
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
lock = _columns$index3.lock;
|
|
259
|
-
if (enableMove({
|
|
260
|
-
code: code,
|
|
261
|
-
lock: lock
|
|
262
|
-
})) {
|
|
263
|
-
cloumnsSortData[code] += 1;
|
|
264
|
-
cloumnsSortData[optionColumn.code] -= 1;
|
|
265
|
-
columnMoved = true;
|
|
266
|
-
}
|
|
267
|
-
index++;
|
|
268
|
-
}
|
|
269
|
-
} else if (startIndex < replaceIndex) {
|
|
270
|
-
// 右移
|
|
271
|
-
while (index > startIndex) {
|
|
272
|
-
var _columns$index4 = columns[index],
|
|
273
|
-
_code2 = _columns$index4.code,
|
|
274
|
-
_lock2 = _columns$index4.lock;
|
|
275
|
-
if (enableMove({
|
|
276
|
-
code: _code2,
|
|
277
|
-
lock: _lock2
|
|
278
|
-
})) {
|
|
279
|
-
cloumnsSortData[_code2] -= 1;
|
|
280
|
-
cloumnsSortData[optionColumn.code] += 1;
|
|
281
|
-
columnMoved = true;
|
|
282
|
-
}
|
|
283
|
-
index--;
|
|
284
|
-
}
|
|
231
|
+
window.requestAnimationFrame(function () {
|
|
232
|
+
// 取消阻止列头点击事件
|
|
233
|
+
currentTarget.removeEventListener('click', stopClickPropagation);
|
|
234
|
+
currentTarget = null;
|
|
235
|
+
var _moveData = moveData,
|
|
236
|
+
_moveData2 = (0, _slicedToArray2.default)(_moveData, 2),
|
|
237
|
+
startIndex = _moveData2[0],
|
|
238
|
+
replaceIndex = _moveData2[1];
|
|
239
|
+
var optionColumn = columns[startIndex];
|
|
240
|
+
var index = replaceIndex;
|
|
241
|
+
if (startIndex > replaceIndex) {
|
|
242
|
+
// 左移
|
|
243
|
+
while (index < startIndex) {
|
|
244
|
+
var _columns$index3 = columns[index],
|
|
245
|
+
code = _columns$index3.code,
|
|
246
|
+
lock = _columns$index3.lock;
|
|
247
|
+
if (enableMove({
|
|
248
|
+
code: code,
|
|
249
|
+
lock: lock
|
|
250
|
+
})) {
|
|
251
|
+
cloumnsSortData[code] += 1;
|
|
252
|
+
cloumnsSortData[optionColumn.code] -= 1;
|
|
253
|
+
columnMoved = true;
|
|
285
254
|
}
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
255
|
+
index++;
|
|
256
|
+
}
|
|
257
|
+
} else if (startIndex < replaceIndex) {
|
|
258
|
+
// 右移
|
|
259
|
+
while (index > startIndex) {
|
|
260
|
+
var _columns$index4 = columns[index],
|
|
261
|
+
_code2 = _columns$index4.code,
|
|
262
|
+
_lock2 = _columns$index4.lock;
|
|
263
|
+
if (enableMove({
|
|
264
|
+
code: _code2,
|
|
265
|
+
lock: _lock2
|
|
266
|
+
})) {
|
|
267
|
+
cloumnsSortData[_code2] -= 1;
|
|
268
|
+
cloumnsSortData[optionColumn.code] += 1;
|
|
269
|
+
columnMoved = true;
|
|
299
270
|
}
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
271
|
+
index--;
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
var onColumnDragStopped = opts.onColumnDragStopped;
|
|
275
|
+
// 拖拽结束返回列顺序
|
|
276
|
+
if (onColumnDragStopped) {
|
|
277
|
+
var _context;
|
|
278
|
+
var isRowDragColumn = function isRowDragColumn(code) {
|
|
279
|
+
var rowDragColumnKey = pipeline.getFeatureOptions('rowDragColumnKey');
|
|
280
|
+
return code === rowDragColumnKey;
|
|
281
|
+
};
|
|
282
|
+
var newColumns = (0, _filter.default)(_context = sortColumns(columns, cloumnsSortData)).call(_context, function (column) {
|
|
283
|
+
return column.code !== _autoFill.FILL_COLUMN_CODE && !isRowDragColumn(column.code) && !(0, _utils.isSelectColumn)(column);
|
|
303
284
|
});
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
currentTarget.style.cursor = '';
|
|
285
|
+
// TODO drag需要在resize之后use,否则这里返回的列对应的宽度不是拖拽后的
|
|
286
|
+
onColumnDragStopped(columnMoved, newColumns);
|
|
307
287
|
}
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
style
|
|
314
|
-
|
|
315
|
-
|
|
288
|
+
pipeline.setStateAtKey(stateKey, {
|
|
289
|
+
cloumnsTranslateData: null
|
|
290
|
+
});
|
|
291
|
+
});
|
|
292
|
+
document.body.style.userSelect = '';
|
|
293
|
+
currentTarget.style.opacity = '';
|
|
294
|
+
currentTarget.style.cursor = '';
|
|
295
|
+
}
|
|
296
|
+
var onColumnDragStart = opts.onColumnDragStart;
|
|
297
|
+
onColumnDragStart && onColumnDragStart(col);
|
|
298
|
+
(0, _touchEventUtils.addPointerEventListeners)(document.body, {
|
|
299
|
+
onPointerMove: handlePointerMove,
|
|
300
|
+
onPointerUp: handlePointerUp
|
|
301
|
+
}, isTouch);
|
|
302
|
+
}
|
|
316
303
|
}));
|
|
317
304
|
};
|
|
318
305
|
}
|
|
@@ -340,13 +327,4 @@ function moveAllChildren(cols, cloumnsTranslateData, width, isMinus) {
|
|
|
340
327
|
moveAllChildren(children, cloumnsTranslateData, width);
|
|
341
328
|
}
|
|
342
329
|
});
|
|
343
|
-
}
|
|
344
|
-
function _isMoveWhenClicking(mouseDownClientX, mouseDownClientY, mouseUpClientX, mouseUpClientY) {
|
|
345
|
-
var xDiff = mouseUpClientX - mouseDownClientX;
|
|
346
|
-
var yDiff = mouseUpClientY - mouseDownClientY;
|
|
347
|
-
// 鼠标点按和松开的偏移量大于5px,认为存在移动
|
|
348
|
-
if (Math.sqrt(xDiff * xDiff + yDiff * yDiff) > 5) {
|
|
349
|
-
return true;
|
|
350
|
-
}
|
|
351
|
-
return false;
|
|
352
330
|
}
|