@kdcloudjs/kdesign 1.6.33 → 1.6.34

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/kdesign.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /*!
2
2
  *
3
- * @kdcloudjs/kdesign v1.6.32
3
+ * @kdcloudjs/kdesign v1.6.33
4
4
  *
5
5
  * Copyright 2020-present, Kingdee, Inc.
6
6
  * All rights reserved.
@@ -33070,6 +33070,187 @@ Switch.displayName = 'Switch';
33070
33070
 
33071
33071
  /***/ }),
33072
33072
 
33073
+ /***/ "./components/table/api.tsx":
33074
+ /*!**********************************!*\
33075
+ !*** ./components/table/api.tsx ***!
33076
+ \**********************************/
33077
+ /*! exports provided: default */
33078
+ /***/ (function(module, __webpack_exports__, __webpack_require__) {
33079
+
33080
+ "use strict";
33081
+ __webpack_require__.r(__webpack_exports__);
33082
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return getApi; });
33083
+ /* harmony import */ var core_js_modules_es_array_find_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! core-js/modules/es.array.find.js */ "./node_modules/core-js/modules/es.array.find.js");
33084
+ /* harmony import */ var core_js_modules_es_array_find_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_array_find_js__WEBPACK_IMPORTED_MODULE_0__);
33085
+ /* harmony import */ var core_js_modules_es_object_to_string_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! core-js/modules/es.object.to-string.js */ "./node_modules/core-js/modules/es.object.to-string.js");
33086
+ /* harmony import */ var core_js_modules_es_object_to_string_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_object_to_string_js__WEBPACK_IMPORTED_MODULE_1__);
33087
+ /* harmony import */ var core_js_modules_es_array_find_index_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! core-js/modules/es.array.find-index.js */ "./node_modules/core-js/modules/es.array.find-index.js");
33088
+ /* harmony import */ var core_js_modules_es_array_find_index_js__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_array_find_index_js__WEBPACK_IMPORTED_MODULE_2__);
33089
+ /* harmony import */ var core_js_modules_es_array_slice_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! core-js/modules/es.array.slice.js */ "./node_modules/core-js/modules/es.array.slice.js");
33090
+ /* harmony import */ var core_js_modules_es_array_slice_js__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_array_slice_js__WEBPACK_IMPORTED_MODULE_3__);
33091
+ /* harmony import */ var _kdcloudjs_table_es_table_utils__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @kdcloudjs/table/es/table/utils */ "./node_modules/@kdcloudjs/table/es/table/utils/index.js");
33092
+ /* harmony import */ var _kdcloudjs_table_es_table_pipeline_features_rangeSelection__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @kdcloudjs/table/es/table/pipeline/features/rangeSelection */ "./node_modules/@kdcloudjs/table/es/table/pipeline/features/rangeSelection.js");
33093
+
33094
+
33095
+
33096
+
33097
+
33098
+
33099
+ function getApi(pipelineRef) {
33100
+ function getColumns() {
33101
+ var _pipelineRef$current$;
33102
+
33103
+ return (_pipelineRef$current$ = pipelineRef.current.getColumns) === null || _pipelineRef$current$ === void 0 ? void 0 : _pipelineRef$current$.bind(pipelineRef.current)();
33104
+ }
33105
+
33106
+ function getDataSource() {
33107
+ var _pipelineRef$current$2;
33108
+
33109
+ return (_pipelineRef$current$2 = pipelineRef.current.getDataSource) === null || _pipelineRef$current$2 === void 0 ? void 0 : _pipelineRef$current$2.bind(pipelineRef.current)();
33110
+ }
33111
+
33112
+ function getFooterDataSource() {
33113
+ var _pipelineRef$current$3;
33114
+
33115
+ return (_pipelineRef$current$3 = pipelineRef.current.getFooterDataSource) === null || _pipelineRef$current$3 === void 0 ? void 0 : _pipelineRef$current$3.bind(pipelineRef.current)();
33116
+ }
33117
+ /**
33118
+ * 清除范围选中内容
33119
+ */
33120
+
33121
+
33122
+ function clearRangeSelection() {
33123
+ var pipeline = pipelineRef.current;
33124
+ pipeline.setStateAtKey(_kdcloudjs_table_es_table_pipeline_features_rangeSelection__WEBPACK_IMPORTED_MODULE_5__["rangeSelectionKey"], null);
33125
+ }
33126
+ /**
33127
+ * 将目标行滚动到可视位置
33128
+ * @param rowIndex 行索引
33129
+ * @param position 目标行滚动到的位置,不传则根据目标行相对视口的位置滚动到底部或顶部,可取值为'top' | 'middle' | 'bottom'
33130
+ * @returns
33131
+ */
33132
+
33133
+
33134
+ function ensureRowIndexVisible(rowIndex, position) {
33135
+ var _pipeline$ref, _pipeline$ref2;
33136
+
33137
+ var pipeline = pipelineRef.current;
33138
+
33139
+ var _pipeline$ref$current = (_pipeline$ref = pipeline.ref) === null || _pipeline$ref === void 0 ? void 0 : _pipeline$ref.current.rowHeightManager,
33140
+ cache = _pipeline$ref$current.cache;
33141
+
33142
+ if (typeof rowIndex !== 'number' || rowIndex < 0 || rowIndex >= cache.length) {
33143
+ console.warn('invalid row index for ensureIndexVisible: ' + rowIndex);
33144
+ return;
33145
+ }
33146
+
33147
+ var tableBodyContainer = (_pipeline$ref2 = pipeline.ref) === null || _pipeline$ref2 === void 0 ? void 0 : _pipeline$ref2.current.domHelper.tableBody;
33148
+ if (!tableBodyContainer) return;
33149
+ var rowTopPixel = 0;
33150
+
33151
+ for (var i = 0; i < rowIndex; i++) {
33152
+ rowTopPixel += cache[i];
33153
+ }
33154
+
33155
+ var rowBottomPixel = rowTopPixel + cache[rowIndex];
33156
+ var viewportHeight = tableBodyContainer.clientHeight;
33157
+ var vScrollTop = tableBodyContainer.scrollTop;
33158
+ var vScrollBottom = vScrollTop + viewportHeight;
33159
+ var pxTop = rowTopPixel;
33160
+ var pxBottom = rowBottomPixel - viewportHeight;
33161
+ var pxMiddle = Math.min((pxTop + pxBottom) / 2, rowTopPixel);
33162
+ var rowBelowViewport = vScrollTop > rowTopPixel;
33163
+ var rowAboveViewport = vScrollBottom < rowBottomPixel;
33164
+ var newScrollPosition = null;
33165
+
33166
+ if (position === 'top') {
33167
+ newScrollPosition = pxTop;
33168
+ } else if (position === 'bottom') {
33169
+ newScrollPosition = pxBottom;
33170
+ } else if (position === 'middle') {
33171
+ newScrollPosition = pxMiddle;
33172
+ } else if (rowBelowViewport) {
33173
+ // 目标行在视口之上,则向上滚动到顶部
33174
+ newScrollPosition = pxTop;
33175
+ } else if (rowAboveViewport) {
33176
+ // 目标行在视口之下,则向下滚动到底部
33177
+ newScrollPosition = pxBottom;
33178
+ }
33179
+
33180
+ if (newScrollPosition !== null) {
33181
+ tableBodyContainer.scrollTop = newScrollPosition;
33182
+ }
33183
+ }
33184
+ /**
33185
+ * 将目标列滚动到可视位置
33186
+ * @param code 列标识
33187
+ * @returns
33188
+ */
33189
+
33190
+
33191
+ function ensureColumnVisible(code) {
33192
+ var _pipeline$ref3, _pipeline$ref4;
33193
+
33194
+ var pipeline = pipelineRef.current;
33195
+ var tableBodyContainer = (_pipeline$ref3 = pipeline.ref) === null || _pipeline$ref3 === void 0 ? void 0 : _pipeline$ref3.current.domHelper.tableBody;
33196
+ var tableScroll = (_pipeline$ref4 = pipeline.ref) === null || _pipeline$ref4 === void 0 ? void 0 : _pipeline$ref4.current.domHelper.stickyScroll;
33197
+ var columnNodes = Object(_kdcloudjs_table_es_table_utils__WEBPACK_IMPORTED_MODULE_4__["collectNodes"])(pipeline.getColumns(), 'leaf-only');
33198
+ var column = columnNodes.find(function (col) {
33199
+ return col.code === code;
33200
+ });
33201
+ var index = columnNodes.findIndex(function (col) {
33202
+ return col.code === code;
33203
+ }); // 固定列也不需要重置滚动条
33204
+
33205
+ if (!column || !tableBodyContainer || column !== null && column !== void 0 && column.lock) return;
33206
+ var colLeft = columnNodes.slice(0, index).reduce(function (acc, col) {
33207
+ return acc + col.width;
33208
+ }, 0);
33209
+ var colLeftPixel = colLeft; // 目标列前面列宽总和
33210
+
33211
+ var colRightPixel = colLeftPixel + column.width;
33212
+ var viewportWidth = tableBodyContainer.clientWidth; // 表体容器的宽度
33213
+
33214
+ var scrollPosition = tableScroll.scrollLeft; // 滚动条滚动的距离
33215
+
33216
+ var vScrollLeft = scrollPosition;
33217
+ var vScrollRight = scrollPosition + viewportWidth;
33218
+ var pxLeft = colLeftPixel;
33219
+ var pxRight = colRightPixel - viewportWidth;
33220
+ var colBeforeViewport = vScrollLeft > colLeftPixel; // 滚动距离大于目标列前面列宽总和,说明目标列在视口之前
33221
+
33222
+ var colPastViewport = vScrollRight < colRightPixel; // 目标列是视口之后
33223
+
33224
+ var colToSmallForViewport = viewportWidth < column.width;
33225
+ var alignColToLeft = colBeforeViewport || colToSmallForViewport;
33226
+ var alignColToRight = colPastViewport;
33227
+
33228
+ if (alignColToLeft || alignColToRight) {
33229
+ var newScrollPosition = alignColToLeft ? pxLeft : pxRight;
33230
+ tableScroll.scrollLeft = newScrollPosition;
33231
+ }
33232
+ }
33233
+
33234
+ function getHeightCache() {
33235
+ var _pipeline$ref5;
33236
+
33237
+ var pipeline = pipelineRef.current;
33238
+ return (_pipeline$ref5 = pipeline.ref) === null || _pipeline$ref5 === void 0 ? void 0 : _pipeline$ref5.current.rowHeightManager.cache;
33239
+ }
33240
+
33241
+ return {
33242
+ getColumns: getColumns,
33243
+ getDataSource: getDataSource,
33244
+ getFooterDataSource: getFooterDataSource,
33245
+ clearRangeSelection: clearRangeSelection,
33246
+ ensureRowIndexVisible: ensureRowIndexVisible,
33247
+ ensureColumnVisible: ensureColumnVisible,
33248
+ getHeightCache: getHeightCache
33249
+ };
33250
+ }
33251
+
33252
+ /***/ }),
33253
+
33073
33254
  /***/ "./components/table/feature/autoRowSpan.ts":
33074
33255
  /*!*************************************************!*\
33075
33256
  !*** ./components/table/feature/autoRowSpan.ts ***!
@@ -33659,6 +33840,8 @@ __webpack_require__.r(__webpack_exports__);
33659
33840
  /* harmony import */ var _utils_devwarning__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(/*! ../_utils/devwarning */ "./components/_utils/devwarning.ts");
33660
33841
  /* harmony import */ var _feature_useFooterDataSource__WEBPACK_IMPORTED_MODULE_23__ = __webpack_require__(/*! ./feature/useFooterDataSource */ "./components/table/feature/useFooterDataSource.ts");
33661
33842
  /* harmony import */ var _feature_colGroupExtendable__WEBPACK_IMPORTED_MODULE_24__ = __webpack_require__(/*! ./feature/colGroupExtendable */ "./components/table/feature/colGroupExtendable.ts");
33843
+ /* harmony import */ var _api__WEBPACK_IMPORTED_MODULE_25__ = __webpack_require__(/*! ./api */ "./components/table/api.tsx");
33844
+
33662
33845
 
33663
33846
 
33664
33847
 
@@ -33742,15 +33925,8 @@ var Table = /*#__PURE__*/Object(react__WEBPACK_IMPORTED_MODULE_4__["forwardRef"]
33742
33925
  // }
33743
33926
 
33744
33927
  Object(react__WEBPACK_IMPORTED_MODULE_4__["useImperativeHandle"])(ref, function () {
33745
- var _pipelineRef$current$, _pipelineRef$current$2, _pipelineRef$current$3, _pipelineRef$current$4;
33746
-
33747
33928
  return {
33748
- api: {
33749
- getColumns: (_pipelineRef$current$ = pipelineRef.current.getColumns) === null || _pipelineRef$current$ === void 0 ? void 0 : _pipelineRef$current$.bind(pipelineRef.current),
33750
- getDataSource: (_pipelineRef$current$2 = pipelineRef.current.getDataSource) === null || _pipelineRef$current$2 === void 0 ? void 0 : _pipelineRef$current$2.bind(pipelineRef.current),
33751
- getFooterDataSource: (_pipelineRef$current$3 = pipelineRef.current.getFooterDataSource) === null || _pipelineRef$current$3 === void 0 ? void 0 : _pipelineRef$current$3.bind(pipelineRef.current),
33752
- clearRangeSelection: (_pipelineRef$current$4 = pipelineRef.current.clearRangeSelection) === null || _pipelineRef$current$4 === void 0 ? void 0 : _pipelineRef$current$4.bind(pipelineRef.current)
33753
- }
33929
+ api: Object(_api__WEBPACK_IMPORTED_MODULE_25__["default"])(pipelineRef)
33754
33930
  };
33755
33931
  });
33756
33932
  /* -------------------------------------------------------------------------- */
@@ -40930,7 +41106,7 @@ req.keys().forEach(function (mod) {
40930
41106
  var match = mod.match(/^\.\/([^_][\w-]+)\/index\.tsx?$/);
40931
41107
 
40932
41108
  if (match && match[1]) {
40933
- if (['message', 'notification', 'virtual-list'].includes(match[1])) {
41109
+ if (['message', 'notification'].includes(match[1])) {
40934
41110
  // need nextUI modify
40935
41111
  // message & notification should not be capitalized
40936
41112
  exports[match[1]] = v;
@@ -46101,7 +46277,7 @@ __webpack_require__.r(__webpack_exports__);
46101
46277
 
46102
46278
 
46103
46279
 
46104
- function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof _babel_runtime_corejs3_core_js_stable_symbol__WEBPACK_IMPORTED_MODULE_2___default.a !== "undefined" && _babel_runtime_corejs3_core_js_get_iterator_method__WEBPACK_IMPORTED_MODULE_3___default()(o) || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
46280
+ function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof _babel_runtime_corejs3_core_js_stable_symbol__WEBPACK_IMPORTED_MODULE_2___default.a !== "undefined" && _babel_runtime_corejs3_core_js_get_iterator_method__WEBPACK_IMPORTED_MODULE_3___default()(o) || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e2) { throw _e2; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e3) { didErr = true; err = _e3; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
46105
46281
 
46106
46282
  function _unsupportedIterableToArray(o, minLen) { var _context2; if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = _babel_runtime_corejs3_core_js_stable_instance_slice__WEBPACK_IMPORTED_MODULE_12___default()(_context2 = Object.prototype.toString.call(o)).call(_context2, 8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return _babel_runtime_corejs3_core_js_stable_array_from__WEBPACK_IMPORTED_MODULE_1___default()(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
46107
46283
 
@@ -46586,7 +46762,7 @@ var BaseTable = /*#__PURE__*/function (_React$Component) {
46586
46762
  }, {
46587
46763
  key: "componentDidMount",
46588
46764
  value: function componentDidMount() {
46589
- var _a, _b, _c, _d; // console.log('did mount start')
46765
+ var _a, _b, _c, _d, _e, _f; // console.log('did mount start')
46590
46766
  // console.log('update dom helper start')
46591
46767
 
46592
46768
 
@@ -46607,6 +46783,7 @@ var BaseTable = /*#__PURE__*/function (_React$Component) {
46607
46783
  });
46608
46784
  (_b = (_a = this.props).setTableWidth) === null || _b === void 0 ? void 0 : _b.call(_a, this.domHelper.tableBody.clientWidth);
46609
46785
  (_d = (_c = this.props).setTableDomHelper) === null || _d === void 0 ? void 0 : _d.call(_c, this.domHelper);
46786
+ (_f = (_e = this.props).setRowHeightManager) === null || _f === void 0 ? void 0 : _f.call(_e, this.rowHeightManager);
46610
46787
  }
46611
46788
  }, {
46612
46789
  key: "componentDidUpdate",
@@ -52425,8 +52602,6 @@ __webpack_require__.r(__webpack_exports__);
52425
52602
  /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_7__);
52426
52603
  /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../utils */ "./node_modules/@kdcloudjs/table/es/table/utils/index.js");
52427
52604
  /* harmony import */ var _features_autoFill__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./features/autoFill */ "./node_modules/@kdcloudjs/table/es/table/pipeline/features/autoFill.js");
52428
- /* harmony import */ var _features_rangeSelection__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./features/rangeSelection */ "./node_modules/@kdcloudjs/table/es/table/pipeline/features/rangeSelection.js");
52429
-
52430
52605
 
52431
52606
 
52432
52607
 
@@ -52707,16 +52882,11 @@ var TablePipeline = /*#__PURE__*/function () {
52707
52882
  _this2.ref.current.domHelper = domHelper;
52708
52883
  };
52709
52884
 
52710
- return result;
52711
- }
52712
- /**
52713
- * 清除范围选中内容
52714
- */
52885
+ result.setRowHeightManager = function (rowHeightManager) {
52886
+ _this2.ref.current.rowHeightManager = rowHeightManager;
52887
+ };
52715
52888
 
52716
- }, {
52717
- key: "clearRangeSelection",
52718
- value: function clearRangeSelection() {
52719
- this.setStateAtKey(_features_rangeSelection__WEBPACK_IMPORTED_MODULE_10__["rangeSelectionKey"], null);
52889
+ return result;
52720
52890
  }
52721
52891
  }]);
52722
52892