bkui-vue 2.0.1-beta.24 → 2.0.1-beta.25

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/lib/index.js CHANGED
@@ -4,5 +4,5 @@ export { default } from './preset';
4
4
  export * from './config-provider';
5
5
  export * from './directives';
6
6
  export * as plugins from './plugins';
7
- export const version = "2.0.1-beta.24";
7
+ export const version = "2.0.1-beta.25";
8
8
  window.__bkui_vue_version__ = version;
@@ -1,14 +1,14 @@
1
- import { Column, TablePropTypes } from '../props';
2
1
  import { SetupContext } from 'vue';
3
- import { UseMultiShiftKey } from './use-shift-key';
4
- import { UseRows } from './use-rows';
2
+ import { Column, TablePropTypes } from '../props';
5
3
  import { UseColumns } from './use-columns';
4
+ import { UseRows } from './use-rows';
5
+ import { UseMultiShiftKey } from './use-shift-key';
6
6
  type CellRenderArgsType = {
7
7
  props: TablePropTypes;
8
8
  rows: UseRows;
9
9
  ctx: SetupContext;
10
10
  columns: UseColumns;
11
- row: any;
11
+ row: Record<string, object>;
12
12
  index: number;
13
13
  column: Column;
14
14
  isChild: boolean;
@@ -18,6 +18,6 @@ declare const _default: ({ props, ctx, columns, rows, pagination, settings }: Re
18
18
  [key: string]: any;
19
19
  }>[] | JSX.Element;
20
20
  renderTFoot: () => JSX.Element;
21
- setDragEvents: (events: Record<string, Function>) => void;
21
+ setDragEvents: (events: Record<string, () => void>) => void;
22
22
  };
23
23
  export default _default;
@@ -17,9 +17,9 @@ import "../exception/exception.less";
17
17
  import * as __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_directives_45d4776f__ from "../directives";
18
18
  import * as __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_checkbox_13b1cb4a__ from "../checkbox";
19
19
  import "../checkbox/checkbox.less";
20
+ import * as __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_icon_a97c79c3__ from "../icon";
20
21
  import * as __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_button_a2ea7c9a__ from "../button";
21
22
  import "../button/button.less";
22
- import * as __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_icon_a97c79c3__ from "../icon";
23
23
  import * as __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_input_d525237e__ from "../input";
24
24
  import "../input/input.less";
25
25
  import * as __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_popover_9b03f19d__ from "../popover";
@@ -18457,18 +18457,21 @@ function v4(options, buf, offset) {
18457
18457
  if (typeof node === 'function') {
18458
18458
  return node();
18459
18459
  }
18460
+ // if (Array.isArray(node?.subTree)) {
18461
+ // node.subTree.forEach(resolveChildNode);
18462
+ // }
18460
18463
  return;
18461
18464
  };
18462
18465
  var resolveColumns = function resolveColumns(children) {
18463
18466
  columns.length = 0;
18464
18467
  columnIndex = 0;
18465
- var GhostBody = children.find(function (node) {
18468
+ var ghostBody = children.find(function (node) {
18466
18469
  var _node$type3;
18467
18470
  return ((_node$type3 = node.type) === null || _node$type3 === void 0 ? void 0 : _node$type3.name) === 'GhostBody';
18468
18471
  });
18469
- if (GhostBody) {
18470
- var _GhostBody$children$d, _GhostBody$children, _GhostBody$children$d2;
18471
- ((_GhostBody$children$d = (_GhostBody$children = GhostBody.children) === null || _GhostBody$children === void 0 || (_GhostBody$children$d2 = _GhostBody$children["default"]) === null || _GhostBody$children$d2 === void 0 ? void 0 : _GhostBody$children$d2.call(_GhostBody$children)) !== null && _GhostBody$children$d !== void 0 ? _GhostBody$children$d : []).forEach(resolveChildNode);
18472
+ if (ghostBody) {
18473
+ var _ghostBody$children$d, _ghostBody$children, _ghostBody$children$d2;
18474
+ ((_ghostBody$children$d = (_ghostBody$children = ghostBody.children) === null || _ghostBody$children === void 0 || (_ghostBody$children$d2 = _ghostBody$children["default"]) === null || _ghostBody$children$d2 === void 0 ? void 0 : _ghostBody$children$d2.call(_ghostBody$children)) !== null && _ghostBody$children$d !== void 0 ? _ghostBody$children$d : []).forEach(resolveChildNode);
18472
18475
  }
18473
18476
  columns.sort(function (col1, col2) {
18474
18477
  return col1.index - col2.index;
@@ -21768,6 +21771,254 @@ const checkbox_namespaceObject = checkbox_x({ ["BkCheckboxGroup"]: () => __WEBPA
21768
21771
  var checkbox_less_x = y => { var x = {}; __webpack_require__.d(x, y); return x; }
21769
21772
  var checkbox_less_y = x => () => x
21770
21773
  const checkbox_less_namespaceObject = checkbox_less_x({ });
21774
+ ;// CONCATENATED MODULE: external "../icon"
21775
+ var icon_x = y => { var x = {}; __webpack_require__.d(x, y); return x; }
21776
+ var icon_y = x => () => x
21777
+ const icon_namespaceObject = icon_x({ ["DownShape"]: () => __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_icon_a97c79c3__.DownShape, ["Funnel"]: () => __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_icon_a97c79c3__.Funnel, ["GragFill"]: () => __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_icon_a97c79c3__.GragFill, ["RightShape"]: () => __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_icon_a97c79c3__.RightShape });
21778
+ ;// CONCATENATED MODULE: ../../packages/table/src/hooks/use-cell.tsx
21779
+
21780
+
21781
+ /*
21782
+ * Tencent is pleased to support the open source community by making
21783
+ * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) available.
21784
+ *
21785
+ * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
21786
+ *
21787
+ * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) is licensed under the MIT License.
21788
+ *
21789
+ * License for 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition):
21790
+ *
21791
+ * ---------------------------------------------------
21792
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
21793
+ * documentation files (the "Software"), to deal in the Software without restriction, including without limitation
21794
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
21795
+ * to permit persons to whom the Software is furnished to do so, subject to the following conditions:
21796
+ *
21797
+ * The above copyright notice and this permission notice shall be included in all copies or substantial portions of
21798
+ * the Software.
21799
+ *
21800
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
21801
+ * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21802
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
21803
+ * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
21804
+ * IN THE SOFTWARE.
21805
+ */
21806
+
21807
+
21808
+
21809
+
21810
+
21811
+
21812
+
21813
+ /* harmony default export */ const use_cell = (function (_ref) {
21814
+ var props = _ref.props,
21815
+ rows = _ref.rows,
21816
+ ctx = _ref.ctx,
21817
+ columns = _ref.columns,
21818
+ row = _ref.row,
21819
+ index = _ref.index,
21820
+ column = _ref.column,
21821
+ _ref$isChild = _ref.isChild,
21822
+ isChild = _ref$isChild === void 0 ? false : _ref$isChild,
21823
+ multiShiftKey = _ref.multiShiftKey;
21824
+ var isShiftKeyDown = multiShiftKey.isShiftKeyDown,
21825
+ getStore = multiShiftKey.getStore,
21826
+ setStore = multiShiftKey.setStore,
21827
+ setStoreStart = multiShiftKey.setStoreStart,
21828
+ clearStoreStart = multiShiftKey.clearStoreStart;
21829
+ var renderCheckboxColumn = function renderCheckboxColumn() {
21830
+ var handleChecked = function handleChecked(value, event) {
21831
+ event.stopImmediatePropagation();
21832
+ event.preventDefault();
21833
+ event.stopPropagation();
21834
+ if (!isShiftKeyDown.value) {
21835
+ if (value) {
21836
+ setStoreStart(row, index);
21837
+ } else {
21838
+ clearStoreStart();
21839
+ }
21840
+ }
21841
+ rows.setRowSelection(row, value);
21842
+ columns.setColumnAttribute(column, COLUMN_ATTRIBUTE.SELECTION_INDETERMINATE, rows.getRowIndeterminate());
21843
+ columns.setColumnAttribute(column, COLUMN_ATTRIBUTE.SELECTION_VAL, rows.getRowCheckedAllValue());
21844
+ ctx.emit(EMIT_EVENTS.ROW_SELECT, {
21845
+ row: row,
21846
+ index: index,
21847
+ checked: value,
21848
+ data: props.data
21849
+ });
21850
+ ctx.emit(EMIT_EVENTS.ROW_SELECT_CHANGE, {
21851
+ row: row,
21852
+ index: index,
21853
+ checked: value,
21854
+ data: props.data
21855
+ });
21856
+ };
21857
+ var beforeRowChange = function beforeRowChange() {
21858
+ if (isShiftKeyDown.value) {
21859
+ var result = setStore(row, index);
21860
+ if (result) {
21861
+ var _rows$pageRowList$sli;
21862
+ var _getStore = getStore(),
21863
+ start = _getStore.start,
21864
+ end = _getStore.end;
21865
+ var startIndex = start.index < end.index ? start.index : end.index;
21866
+ var endIndex = start.index < end.index ? end.index : start.index;
21867
+ ((_rows$pageRowList$sli = rows.pageRowList.slice(startIndex, endIndex + 1)) !== null && _rows$pageRowList$sli !== void 0 ? _rows$pageRowList$sli : []).forEach(function (item) {
21868
+ var isRowEnabled = isRowSelectEnable(props, {
21869
+ row: row,
21870
+ index: index,
21871
+ isCheckAll: false
21872
+ });
21873
+ isRowEnabled && rows.setRowSelection(item, true);
21874
+ });
21875
+ }
21876
+ ctx.emit(EMIT_EVENTS.ROW_SELECT, {
21877
+ row: row,
21878
+ index: index,
21879
+ checked: true,
21880
+ data: props.data,
21881
+ isShiftKeyDown: true
21882
+ });
21883
+ ctx.emit(EMIT_EVENTS.ROW_SELECT_CHANGE, {
21884
+ row: row,
21885
+ index: index,
21886
+ checked: true,
21887
+ data: props.data,
21888
+ isShiftKeyDown: true
21889
+ });
21890
+ return Promise.resolve(!result);
21891
+ }
21892
+ return Promise.resolve(true);
21893
+ };
21894
+ var indeterminate = rows.getRowAttribute(row, TABLE_ROW_ATTRIBUTE.ROW_SELECTION_INDETERMINATE);
21895
+ var isChecked = rows.getRowAttribute(row, TABLE_ROW_ATTRIBUTE.ROW_SELECTION);
21896
+ var isEnable = isRowSelectEnable(props, {
21897
+ row: row,
21898
+ index: index,
21899
+ isCheckAll: false
21900
+ });
21901
+ return (0,external_vue_namespaceObject.createVNode)(checkbox_namespaceObject["default"], {
21902
+ "beforeChange": beforeRowChange,
21903
+ "disabled": !isEnable,
21904
+ "indeterminate": indeterminate,
21905
+ "modelValue": isChecked,
21906
+ "onChange": handleChecked
21907
+ }, null);
21908
+ };
21909
+ /**
21910
+ * 渲染表格Cell内容
21911
+ * @param row 当前行
21912
+ * @param column 当前列
21913
+ * @param index 当前列
21914
+ * @param rows 当前列
21915
+ * @returns
21916
+ */
21917
+ var renderCell = function renderCell() {
21918
+ var _renderFn$column$type, _renderFn$column$type2;
21919
+ var defaultFn = function defaultFn() {
21920
+ var type = resolvePropVal(column, 'type', [column, row]);
21921
+ if (type === 'index') {
21922
+ return rows.getRowAttribute(row, TABLE_ROW_ATTRIBUTE.ROW_INDEX);
21923
+ }
21924
+ var key = resolvePropVal(column, 'field', [column, row]);
21925
+ var cell = getRowText(row, key);
21926
+ if (typeof column.render === 'function') {
21927
+ return renderCellCallbackFn();
21928
+ }
21929
+ if (typeof cell === 'boolean') {
21930
+ return String(cell);
21931
+ }
21932
+ if (!cell && typeof cell !== 'number') {
21933
+ var emptyCellText = props.emptyCellText;
21934
+ if (emptyCellText) {
21935
+ if (typeof emptyCellText === 'function') {
21936
+ return emptyCellText(row, column, index, rows.tableRowList.value);
21937
+ }
21938
+ return emptyCellText;
21939
+ }
21940
+ }
21941
+ if (typeof_typeof(cell) === 'object') {
21942
+ return JSON.stringify((0,external_vue_namespaceObject.unref)(cell));
21943
+ }
21944
+ return cell;
21945
+ };
21946
+ var renderFn = {
21947
+ expand: function expand() {
21948
+ return isChild ? '' : renderExpandColumn();
21949
+ },
21950
+ selection: function selection() {
21951
+ return renderCheckboxColumn();
21952
+ },
21953
+ drag: renderDraggableCell
21954
+ };
21955
+ return (_renderFn$column$type = (_renderFn$column$type2 = renderFn[column.type]) === null || _renderFn$column$type2 === void 0 ? void 0 : _renderFn$column$type2.call(renderFn, row, column, index, rows)) !== null && _renderFn$column$type !== void 0 ? _renderFn$column$type : defaultFn();
21956
+ };
21957
+ var renderCellCallbackFn = function renderCellCallbackFn() {
21958
+ var cell = getRowText(row, resolvePropVal(column, 'field', [column, row]));
21959
+ var data = row;
21960
+ return column.render({
21961
+ cell: cell,
21962
+ data: data,
21963
+ row: row,
21964
+ column: column,
21965
+ index: index,
21966
+ rows: rows.tableRowList.value
21967
+ });
21968
+ };
21969
+ var getExpandCell = function getExpandCell() {
21970
+ var _ctx$slots$expandCont, _ctx$slots$expandCont2, _ctx$slots;
21971
+ var isExpand = rows.getRowAttribute(row, TABLE_ROW_ATTRIBUTE.ROW_EXPAND);
21972
+ var icon = isExpand ? (0,external_vue_namespaceObject.createVNode)(icon_namespaceObject.DownShape, null, null) : (0,external_vue_namespaceObject.createVNode)(icon_namespaceObject.RightShape, null, null);
21973
+ return (0,external_vue_namespaceObject.createVNode)("span", null, [[icon, (_ctx$slots$expandCont = (_ctx$slots$expandCont2 = (_ctx$slots = ctx.slots).expandContent) === null || _ctx$slots$expandCont2 === void 0 ? void 0 : _ctx$slots$expandCont2.call(_ctx$slots, row)) !== null && _ctx$slots$expandCont !== void 0 ? _ctx$slots$expandCont : '']]);
21974
+ };
21975
+ var handleRowExpandClick = function handleRowExpandClick(e) {
21976
+ rows.setRowExpand(row, !rows.getRowAttribute(row, TABLE_ROW_ATTRIBUTE.ROW_EXPAND));
21977
+ ctx.emit(EMIT_EVENTS.ROW_EXPAND_CLICK, {
21978
+ row: row,
21979
+ column: column,
21980
+ index: index,
21981
+ rows: rows.tableRowList.value,
21982
+ e: e
21983
+ });
21984
+ };
21985
+ var renderExpandColumn = function renderExpandColumn() {
21986
+ var renderExpandSlot = function renderExpandSlot() {
21987
+ var _ctx$slots$expandCell, _ctx$slots$expandCell2, _ctx$slots2;
21988
+ if (typeof column.render === 'function') {
21989
+ return renderCellCallbackFn();
21990
+ }
21991
+ return (_ctx$slots$expandCell = (_ctx$slots$expandCell2 = (_ctx$slots2 = ctx.slots).expandCell) === null || _ctx$slots$expandCell2 === void 0 ? void 0 : _ctx$slots$expandCell2.call(_ctx$slots2, {
21992
+ row: row,
21993
+ column: column,
21994
+ index: index,
21995
+ rows: rows
21996
+ })) !== null && _ctx$slots$expandCell !== void 0 ? _ctx$slots$expandCell : getExpandCell();
21997
+ };
21998
+ return (0,external_vue_namespaceObject.createVNode)("span", {
21999
+ "class": "expand-btn-action",
22000
+ "onClick": function onClick(e) {
22001
+ return handleRowExpandClick(e);
22002
+ }
22003
+ }, [renderExpandSlot()]);
22004
+ };
22005
+ var renderDraggableCell = function renderDraggableCell() {
22006
+ var _props$rowDraggable$r, _props$rowDraggable, _props$rowDraggable$f, _props$rowDraggable2, _props$rowDraggable$i, _props$rowDraggable3;
22007
+ var renderFn = (_props$rowDraggable$r = (_props$rowDraggable = props.rowDraggable) === null || _props$rowDraggable === void 0 ? void 0 : _props$rowDraggable.render) !== null && _props$rowDraggable$r !== void 0 ? _props$rowDraggable$r : props.rowDraggable;
22008
+ if (typeof renderFn === 'function') {
22009
+ return renderFn(row, column, index, rows.tableRowList.value);
22010
+ }
22011
+ var fontSize = (_props$rowDraggable$f = (_props$rowDraggable2 = props.rowDraggable) === null || _props$rowDraggable2 === void 0 ? void 0 : _props$rowDraggable2.fontSize) !== null && _props$rowDraggable$f !== void 0 ? _props$rowDraggable$f : '14px';
22012
+ var fontIcon = (_props$rowDraggable$i = (_props$rowDraggable3 = props.rowDraggable) === null || _props$rowDraggable3 === void 0 ? void 0 : _props$rowDraggable3.icon) !== null && _props$rowDraggable$i !== void 0 ? _props$rowDraggable$i : (0,external_vue_namespaceObject.createVNode)(icon_namespaceObject.GragFill, {
22013
+ "style": "'--font-size: ".concat(fontSize, ";'"),
22014
+ "class": "drag-cell"
22015
+ }, null);
22016
+ return fontIcon;
22017
+ };
22018
+ return {
22019
+ renderCell: renderCell
22020
+ };
22021
+ });
21771
22022
  ;// CONCATENATED MODULE: external "../button"
21772
22023
  var button_x = y => { var x = {}; __webpack_require__.d(x, y); return x; }
21773
22024
  var button_y = x => () => x
@@ -21776,10 +22027,6 @@ const button_namespaceObject = button_x({ ["default"]: () => __WEBPACK_EXTERNAL_
21776
22027
  var button_less_x = y => { var x = {}; __webpack_require__.d(x, y); return x; }
21777
22028
  var button_less_y = x => () => x
21778
22029
  const button_less_namespaceObject = button_less_x({ });
21779
- ;// CONCATENATED MODULE: external "../icon"
21780
- var icon_x = y => { var x = {}; __webpack_require__.d(x, y); return x; }
21781
- var icon_y = x => () => x
21782
- const icon_namespaceObject = icon_x({ ["DownShape"]: () => __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_icon_a97c79c3__.DownShape, ["Funnel"]: () => __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_icon_a97c79c3__.Funnel, ["GragFill"]: () => __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_icon_a97c79c3__.GragFill, ["RightShape"]: () => __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_icon_a97c79c3__.RightShape });
21783
22030
  ;// CONCATENATED MODULE: external "../input"
21784
22031
  var input_x = y => { var x = {}; __webpack_require__.d(x, y); return x; }
21785
22032
  var input_y = x => () => x
@@ -22474,250 +22721,6 @@ function use_head_isSlot(s) {
22474
22721
  getTH: getTH
22475
22722
  };
22476
22723
  });
22477
- ;// CONCATENATED MODULE: ../../packages/table/src/hooks/use-cell.tsx
22478
-
22479
-
22480
- /*
22481
- * Tencent is pleased to support the open source community by making
22482
- * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) available.
22483
- *
22484
- * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
22485
- *
22486
- * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) is licensed under the MIT License.
22487
- *
22488
- * License for 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition):
22489
- *
22490
- * ---------------------------------------------------
22491
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
22492
- * documentation files (the "Software"), to deal in the Software without restriction, including without limitation
22493
- * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
22494
- * to permit persons to whom the Software is furnished to do so, subject to the following conditions:
22495
- *
22496
- * The above copyright notice and this permission notice shall be included in all copies or substantial portions of
22497
- * the Software.
22498
- *
22499
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
22500
- * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22501
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
22502
- * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
22503
- * IN THE SOFTWARE.
22504
- */
22505
-
22506
-
22507
-
22508
-
22509
-
22510
-
22511
-
22512
- /* harmony default export */ const use_cell = (function (_ref) {
22513
- var props = _ref.props,
22514
- rows = _ref.rows,
22515
- ctx = _ref.ctx,
22516
- columns = _ref.columns,
22517
- row = _ref.row,
22518
- index = _ref.index,
22519
- column = _ref.column,
22520
- _ref$isChild = _ref.isChild,
22521
- isChild = _ref$isChild === void 0 ? false : _ref$isChild,
22522
- multiShiftKey = _ref.multiShiftKey;
22523
- var isShiftKeyDown = multiShiftKey.isShiftKeyDown,
22524
- getStore = multiShiftKey.getStore,
22525
- setStore = multiShiftKey.setStore,
22526
- setStoreStart = multiShiftKey.setStoreStart,
22527
- clearStoreStart = multiShiftKey.clearStoreStart;
22528
- var renderCheckboxColumn = function renderCheckboxColumn() {
22529
- var handleChecked = function handleChecked(value, event) {
22530
- event.stopImmediatePropagation();
22531
- event.preventDefault();
22532
- event.stopPropagation();
22533
- if (!isShiftKeyDown.value) {
22534
- if (value) {
22535
- setStoreStart(row, index);
22536
- } else {
22537
- clearStoreStart();
22538
- }
22539
- }
22540
- rows.setRowSelection(row, value);
22541
- columns.setColumnAttribute(column, COLUMN_ATTRIBUTE.SELECTION_INDETERMINATE, rows.getRowIndeterminate());
22542
- columns.setColumnAttribute(column, COLUMN_ATTRIBUTE.SELECTION_VAL, rows.getRowCheckedAllValue());
22543
- ctx.emit(EMIT_EVENTS.ROW_SELECT, {
22544
- row: row,
22545
- index: index,
22546
- checked: value,
22547
- data: props.data
22548
- });
22549
- ctx.emit(EMIT_EVENTS.ROW_SELECT_CHANGE, {
22550
- row: row,
22551
- index: index,
22552
- checked: value,
22553
- data: props.data
22554
- });
22555
- };
22556
- var beforeRowChange = function beforeRowChange() {
22557
- if (isShiftKeyDown.value) {
22558
- var result = setStore(row, index);
22559
- if (result) {
22560
- var _rows$pageRowList$sli;
22561
- var _getStore = getStore(),
22562
- start = _getStore.start,
22563
- end = _getStore.end;
22564
- var startIndex = start.index < end.index ? start.index : end.index;
22565
- var endIndex = start.index < end.index ? end.index : start.index;
22566
- ((_rows$pageRowList$sli = rows.pageRowList.slice(startIndex, endIndex + 1)) !== null && _rows$pageRowList$sli !== void 0 ? _rows$pageRowList$sli : []).forEach(function (item) {
22567
- var isRowEnabled = isRowSelectEnable(props, {
22568
- row: row,
22569
- index: index,
22570
- isCheckAll: false
22571
- });
22572
- isRowEnabled && rows.setRowSelection(item, true);
22573
- });
22574
- }
22575
- ctx.emit(EMIT_EVENTS.ROW_SELECT, {
22576
- row: row,
22577
- index: index,
22578
- checked: true,
22579
- data: props.data,
22580
- isShiftKeyDown: true
22581
- });
22582
- ctx.emit(EMIT_EVENTS.ROW_SELECT_CHANGE, {
22583
- row: row,
22584
- index: index,
22585
- checked: true,
22586
- data: props.data,
22587
- isShiftKeyDown: true
22588
- });
22589
- return Promise.resolve(!result);
22590
- }
22591
- return Promise.resolve(true);
22592
- };
22593
- var indeterminate = rows.getRowAttribute(row, TABLE_ROW_ATTRIBUTE.ROW_SELECTION_INDETERMINATE);
22594
- var isChecked = rows.getRowAttribute(row, TABLE_ROW_ATTRIBUTE.ROW_SELECTION);
22595
- var isEnable = isRowSelectEnable(props, {
22596
- row: row,
22597
- index: index,
22598
- isCheckAll: false
22599
- });
22600
- return (0,external_vue_namespaceObject.createVNode)(checkbox_namespaceObject["default"], {
22601
- "beforeChange": beforeRowChange,
22602
- "disabled": !isEnable,
22603
- "indeterminate": indeterminate,
22604
- "modelValue": isChecked,
22605
- "onChange": handleChecked
22606
- }, null);
22607
- };
22608
- /**
22609
- * 渲染表格Cell内容
22610
- * @param row 当前行
22611
- * @param column 当前列
22612
- * @param index 当前列
22613
- * @param rows 当前列
22614
- * @returns
22615
- */
22616
- var renderCell = function renderCell() {
22617
- var _renderFn$column$type, _renderFn$column$type2;
22618
- var defaultFn = function defaultFn() {
22619
- var type = resolvePropVal(column, 'type', [column, row]);
22620
- if (type === 'index') {
22621
- return rows.getRowAttribute(row, TABLE_ROW_ATTRIBUTE.ROW_INDEX);
22622
- }
22623
- var key = resolvePropVal(column, 'field', [column, row]);
22624
- var cell = getRowText(row, key);
22625
- if (typeof column.render === 'function') {
22626
- return renderCellCallbackFn();
22627
- }
22628
- if (typeof cell === 'boolean') {
22629
- return String(cell);
22630
- }
22631
- if (!cell && typeof cell !== 'number') {
22632
- var emptyCellText = props.emptyCellText;
22633
- if (emptyCellText) {
22634
- if (typeof emptyCellText === 'function') {
22635
- return emptyCellText(row, column, index, rows.tableRowList.value);
22636
- }
22637
- return emptyCellText;
22638
- }
22639
- }
22640
- if (typeof_typeof(cell) === 'object') {
22641
- return JSON.stringify((0,external_vue_namespaceObject.unref)(cell));
22642
- }
22643
- return cell;
22644
- };
22645
- var renderFn = {
22646
- expand: function expand() {
22647
- return isChild ? '' : renderExpandColumn();
22648
- },
22649
- selection: function selection() {
22650
- return renderCheckboxColumn();
22651
- },
22652
- drag: renderDraggableCell
22653
- };
22654
- return (_renderFn$column$type = (_renderFn$column$type2 = renderFn[column.type]) === null || _renderFn$column$type2 === void 0 ? void 0 : _renderFn$column$type2.call(renderFn, row, column, index, rows)) !== null && _renderFn$column$type !== void 0 ? _renderFn$column$type : defaultFn();
22655
- };
22656
- var renderCellCallbackFn = function renderCellCallbackFn() {
22657
- var cell = getRowText(row, resolvePropVal(column, 'field', [column, row]));
22658
- var data = row;
22659
- return column.render({
22660
- cell: cell,
22661
- data: data,
22662
- row: row,
22663
- column: column,
22664
- index: index,
22665
- rows: rows.tableRowList.value
22666
- });
22667
- };
22668
- var getExpandCell = function getExpandCell() {
22669
- var _ctx$slots$expandCont, _ctx$slots$expandCont2, _ctx$slots;
22670
- var isExpand = rows.getRowAttribute(row, TABLE_ROW_ATTRIBUTE.ROW_EXPAND);
22671
- var icon = isExpand ? (0,external_vue_namespaceObject.createVNode)(icon_namespaceObject.DownShape, null, null) : (0,external_vue_namespaceObject.createVNode)(icon_namespaceObject.RightShape, null, null);
22672
- return (0,external_vue_namespaceObject.createVNode)("span", null, [[icon, (_ctx$slots$expandCont = (_ctx$slots$expandCont2 = (_ctx$slots = ctx.slots).expandContent) === null || _ctx$slots$expandCont2 === void 0 ? void 0 : _ctx$slots$expandCont2.call(_ctx$slots, row)) !== null && _ctx$slots$expandCont !== void 0 ? _ctx$slots$expandCont : '']]);
22673
- };
22674
- var handleRowExpandClick = function handleRowExpandClick(e) {
22675
- rows.setRowExpand(row, !rows.getRowAttribute(row, TABLE_ROW_ATTRIBUTE.ROW_EXPAND));
22676
- ctx.emit(EMIT_EVENTS.ROW_EXPAND_CLICK, {
22677
- row: row,
22678
- column: column,
22679
- index: index,
22680
- rows: rows.tableRowList.value,
22681
- e: e
22682
- });
22683
- };
22684
- var renderExpandColumn = function renderExpandColumn() {
22685
- var renderExpandSlot = function renderExpandSlot() {
22686
- var _ctx$slots$expandCell, _ctx$slots$expandCell2, _ctx$slots2;
22687
- if (typeof column.render === 'function') {
22688
- return renderCellCallbackFn();
22689
- }
22690
- return (_ctx$slots$expandCell = (_ctx$slots$expandCell2 = (_ctx$slots2 = ctx.slots).expandCell) === null || _ctx$slots$expandCell2 === void 0 ? void 0 : _ctx$slots$expandCell2.call(_ctx$slots2, {
22691
- row: row,
22692
- column: column,
22693
- index: index,
22694
- rows: rows
22695
- })) !== null && _ctx$slots$expandCell !== void 0 ? _ctx$slots$expandCell : getExpandCell();
22696
- };
22697
- return (0,external_vue_namespaceObject.createVNode)("span", {
22698
- "class": "expand-btn-action",
22699
- "onClick": function onClick(e) {
22700
- return handleRowExpandClick(e);
22701
- }
22702
- }, [renderExpandSlot()]);
22703
- };
22704
- var renderDraggableCell = function renderDraggableCell() {
22705
- var _props$rowDraggable$r, _props$rowDraggable, _props$rowDraggable$f, _props$rowDraggable2, _props$rowDraggable$i, _props$rowDraggable3;
22706
- var renderFn = (_props$rowDraggable$r = (_props$rowDraggable = props.rowDraggable) === null || _props$rowDraggable === void 0 ? void 0 : _props$rowDraggable.render) !== null && _props$rowDraggable$r !== void 0 ? _props$rowDraggable$r : props.rowDraggable;
22707
- if (typeof renderFn === 'function') {
22708
- return renderFn(row, column, index, rows.tableRowList.value);
22709
- }
22710
- var fontSize = (_props$rowDraggable$f = (_props$rowDraggable2 = props.rowDraggable) === null || _props$rowDraggable2 === void 0 ? void 0 : _props$rowDraggable2.fontSize) !== null && _props$rowDraggable$f !== void 0 ? _props$rowDraggable$f : '14px';
22711
- var fontIcon = (_props$rowDraggable$i = (_props$rowDraggable3 = props.rowDraggable) === null || _props$rowDraggable3 === void 0 ? void 0 : _props$rowDraggable3.icon) !== null && _props$rowDraggable$i !== void 0 ? _props$rowDraggable$i : (0,external_vue_namespaceObject.createVNode)(icon_namespaceObject.GragFill, {
22712
- "style": "'--font-size: ".concat(fontSize, ";'"),
22713
- "class": "drag-cell"
22714
- }, null);
22715
- return fontIcon;
22716
- };
22717
- return {
22718
- renderCell: renderCell
22719
- };
22720
- });
22721
22724
  ;// CONCATENATED MODULE: ../../packages/table/src/hooks/use-shift-key.tsx
22722
22725
  /*
22723
22726
  * Tencent is pleased to support the open source community by making
@@ -23101,7 +23104,7 @@ function use_render_isSlot(s) {
23101
23104
  ctx: ctx,
23102
23105
  columns: columns,
23103
23106
  row: row,
23104
- index: index,
23107
+ index: rowIndex,
23105
23108
  column: column,
23106
23109
  isChild: isChild,
23107
23110
  multiShiftKey: multiShiftKey
@@ -23127,8 +23130,8 @@ function use_render_isSlot(s) {
23127
23130
  "style": cellStyle,
23128
23131
  "class": cellClass,
23129
23132
  "colspan": colspan,
23130
- "rowspan": rowspan,
23131
23133
  "data-id": columnKey,
23134
+ "rowspan": rowspan,
23132
23135
  "onClick": function onClick(event) {
23133
23136
  return handleEmit(event, EMIT_EVENTS.CELL_CLICK);
23134
23137
  },
@@ -23137,9 +23140,9 @@ function use_render_isSlot(s) {
23137
23140
  }
23138
23141
  }, [(0,external_vue_namespaceObject.createVNode)(table_cell, {
23139
23142
  "key": cellKey,
23140
- "data-id": cellKey,
23141
23143
  "class": tdCtxClass,
23142
23144
  "column": column,
23145
+ "data-id": cellKey,
23143
23146
  "observerResize": props.observerResize,
23144
23147
  "parentSetting": props.showOverflowTooltip,
23145
23148
  "row": row
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bkui-vue",
3
- "version": "2.0.1-beta.24",
3
+ "version": "2.0.1-beta.25",
4
4
  "workspaces": [
5
5
  "packages/**",
6
6
  "scripts/cli",