@zhenliang/sheet 0.1.2 → 0.1.4
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/core/editor/selectEditor/index.d.ts +2 -1
- package/dist/core/editor/selectEditor/index.js +9 -2
- package/dist/core/reducers/stateReducer.js +9 -5
- package/dist/core/sheet/index.js +1 -1
- package/dist/core/sheet/index.less +10 -1
- package/dist/core/shell/draggableShell/index.d.ts +0 -1
- package/dist/core/shell/tableShell.d.ts +0 -1
- package/dist/hooks/useEventBus.d.ts +0 -1
- package/dist/type/sheetTable.d.ts +2 -0
- package/package.json +1 -1
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { SheetType } from "../../../type";
|
|
2
|
+
import { SelectProps } from 'antd';
|
|
2
3
|
import 'antd/es/select/style/index.css';
|
|
3
4
|
import './index.less';
|
|
4
|
-
export declare const getSelectEditor: (options: SheetType.Options[], valueKey?: string, extra?: React.ReactNode) => SheetType.CellEditor;
|
|
5
|
+
export declare const getSelectEditor: (options: SheetType.Options[], valueKey?: string, extra?: React.ReactNode, selectProps?: Partial<SelectProps>) => SheetType.CellEditor;
|
|
5
6
|
export default getSelectEditor;
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
2
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
3
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
4
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
5
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
6
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
1
7
|
/* eslint-disable eqeqeq */
|
|
2
8
|
|
|
3
9
|
import { Select } from 'antd';
|
|
@@ -10,6 +16,7 @@ import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
10
16
|
export var getSelectEditor = function getSelectEditor(options) {
|
|
11
17
|
var valueKey = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'value';
|
|
12
18
|
var extra = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : /*#__PURE__*/_jsx(_Fragment, {});
|
|
19
|
+
var selectProps = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
|
|
13
20
|
var SelectEditor = function SelectEditor(props) {
|
|
14
21
|
var value = props.value,
|
|
15
22
|
onConfirm = props.onConfirm;
|
|
@@ -28,7 +35,7 @@ export var getSelectEditor = function getSelectEditor(options) {
|
|
|
28
35
|
children: [menu, extra]
|
|
29
36
|
});
|
|
30
37
|
};
|
|
31
|
-
return /*#__PURE__*/_jsx(Select, {
|
|
38
|
+
return /*#__PURE__*/_jsx(Select, _objectSpread(_objectSpread({}, selectProps), {}, {
|
|
32
39
|
autoFocus: true,
|
|
33
40
|
className: "select-editor",
|
|
34
41
|
defaultOpen: true,
|
|
@@ -43,7 +50,7 @@ export var getSelectEditor = function getSelectEditor(options) {
|
|
|
43
50
|
options: options,
|
|
44
51
|
popupClassName: 'excelTablePopupClassName',
|
|
45
52
|
dropdownRender: dropdown
|
|
46
|
-
});
|
|
53
|
+
}));
|
|
47
54
|
};
|
|
48
55
|
SelectEditor.checker = function (value) {
|
|
49
56
|
if (isNil(value)) return true;
|
|
@@ -106,14 +106,18 @@ export var stateReducer = {
|
|
|
106
106
|
});
|
|
107
107
|
},
|
|
108
108
|
selectRow: function selectRow(state, payload) {
|
|
109
|
-
var _state$data4, _state$data4$, _state$data5, _state$data5$, _state$data6, _state$data6$;
|
|
109
|
+
var _state$data4, _state$data4$, _state$data$0$length, _state$data5, _state$data5$, _state$data6, _state$data6$;
|
|
110
110
|
var startCol = ((_state$data4 = state.data) === null || _state$data4 === void 0 ? void 0 : (_state$data4$ = _state$data4[0]) === null || _state$data4$ === void 0 ? void 0 : _state$data4$.findIndex(function (item) {
|
|
111
111
|
return !item.fixed;
|
|
112
112
|
})) || 0;
|
|
113
|
-
var endCol = (((_state$data5 = state.data) === null || _state$data5 === void 0 ? void 0 : (_state$data5$ = _state$data5[0]) === null || _state$data5$ === void 0 ? void 0 : _state$data5$.
|
|
113
|
+
var endCol = ((_state$data$0$length = (_state$data5 = state.data) === null || _state$data5 === void 0 ? void 0 : (_state$data5$ = _state$data5[0]) === null || _state$data5$ === void 0 ? void 0 : _state$data5$.length) !== null && _state$data$0$length !== void 0 ? _state$data$0$length : 0) - 1;
|
|
114
|
+
var lastFixed = (_state$data6 = state.data) === null || _state$data6 === void 0 ? void 0 : (_state$data6$ = _state$data6[0]) === null || _state$data6$ === void 0 ? void 0 : _state$data6$.find(function (item) {
|
|
114
115
|
return item.fixed === SheetType.CellAlign.right;
|
|
115
|
-
})
|
|
116
|
-
|
|
116
|
+
});
|
|
117
|
+
if (lastFixed) {
|
|
118
|
+
var _state$data$0$indexOf, _state$data7;
|
|
119
|
+
endCol = (_state$data$0$indexOf = (_state$data7 = state.data) === null || _state$data7 === void 0 ? void 0 : _state$data7[0].indexOf(lastFixed)) !== null && _state$data$0$indexOf !== void 0 ? _state$data$0$indexOf : 0 - 1;
|
|
120
|
+
}
|
|
117
121
|
if (startCol >= 0 && endCol >= 0) {
|
|
118
122
|
return _objectSpread(_objectSpread({}, state), {}, {
|
|
119
123
|
start: {
|
|
@@ -130,7 +134,7 @@ export var stateReducer = {
|
|
|
130
134
|
}
|
|
131
135
|
});
|
|
132
136
|
}
|
|
133
|
-
return
|
|
137
|
+
return state;
|
|
134
138
|
},
|
|
135
139
|
clearSelect: function clearSelect(state) {
|
|
136
140
|
var start = state.start,
|
package/dist/core/sheet/index.js
CHANGED
|
@@ -202,7 +202,7 @@ var Sheet = function Sheet(props) {
|
|
|
202
202
|
paddingBottom: paddingTop,
|
|
203
203
|
display: 'block'
|
|
204
204
|
}
|
|
205
|
-
}), rowElements, /*#__PURE__*/_jsx("tr", {
|
|
205
|
+
}), rowElements, virtualized && paddingBottom > 0 && /*#__PURE__*/_jsx("tr", {
|
|
206
206
|
style: {
|
|
207
207
|
height: 0,
|
|
208
208
|
paddingBottom: paddingBottom,
|
|
@@ -27,13 +27,21 @@ span.harvest-sheet-container, span.harvest-sheet-container:focus {
|
|
|
27
27
|
tr{
|
|
28
28
|
height:var(--row-height);
|
|
29
29
|
|
|
30
|
-
th{
|
|
30
|
+
th.cell-title{
|
|
31
31
|
line-height: var(--row-height);
|
|
32
|
+
border-bottom: 1px solid transparent;
|
|
32
33
|
}
|
|
33
34
|
|
|
34
35
|
td{
|
|
35
36
|
line-height: var(--row-height);
|
|
36
37
|
}
|
|
38
|
+
|
|
39
|
+
&:last-of-type{
|
|
40
|
+
.td{
|
|
41
|
+
border-bottom: 1px solid transparent;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
}
|
|
37
45
|
}
|
|
38
46
|
|
|
39
47
|
}
|
|
@@ -239,6 +247,7 @@ span.harvest-sheet-container, span.harvest-sheet-container:focus {
|
|
|
239
247
|
display: block;
|
|
240
248
|
font-size: var(--cell-font-size);
|
|
241
249
|
line-height:var(--cell-inner-height) ;
|
|
250
|
+
height:var(--cell-inner-height) ;
|
|
242
251
|
padding:0
|
|
243
252
|
}
|
|
244
253
|
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import type { SheetType } from "../../type";
|
|
3
2
|
import './draggableShell/index.less';
|
|
4
3
|
export declare const TableShell: ({ columns, className, showGroup, showSelect, controlProps, controlWidth, }: SheetType.SheetShell) => import("react").FC<{
|
|
@@ -80,6 +80,8 @@ export declare type TableProps = {
|
|
|
80
80
|
backEditStyle?: Partial<CSSStyleDeclaration>;
|
|
81
81
|
rowSelection?: TableRowSelection;
|
|
82
82
|
groupConfig?: TableGroupConfig;
|
|
83
|
+
menuRenderer?: React.FC<SheetType.MenuRenderProps>;
|
|
84
|
+
onContextMenu?: (event: any) => void;
|
|
83
85
|
onChange: (changes: TableChange[], extChanges?: TableChange[]) => void;
|
|
84
86
|
handleAdd?: () => void;
|
|
85
87
|
eventHandler?: Record<'reverse' | 'btn-click' | 'cell-edit' | 'cell-switch' | string, undefined | EventHandler>;
|