@zhenliang/sheet 0.1.29 → 0.1.31
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.
|
@@ -50,7 +50,7 @@ export var getNumberEditor = function getNumberEditor(extraProps, getExtraProps)
|
|
|
50
50
|
var _ref = getExtraProps ? getExtraProps(props) : extraProps !== null && extraProps !== void 0 ? extraProps : {},
|
|
51
51
|
precision = _ref.precision,
|
|
52
52
|
inputArgs = _objectWithoutProperties(_ref, _excluded);
|
|
53
|
-
var
|
|
53
|
+
var baseFormatter = useCallback(function (value) {
|
|
54
54
|
if (!value) {
|
|
55
55
|
return '';
|
|
56
56
|
}
|
|
@@ -63,10 +63,15 @@ export var getNumberEditor = function getNumberEditor(extraProps, getExtraProps)
|
|
|
63
63
|
}
|
|
64
64
|
return String(value);
|
|
65
65
|
}, []);
|
|
66
|
+
// 去掉多余的0
|
|
67
|
+
var valueFormatter = useCallback(function (value) {
|
|
68
|
+
var baseValue = baseFormatter(value);
|
|
69
|
+
return baseValue ? "".concat(parseFloat(baseValue)) : '';
|
|
70
|
+
}, []);
|
|
66
71
|
/**
|
|
67
72
|
* 重新声明,后面有需求可以改一下
|
|
68
73
|
*/
|
|
69
|
-
var valueParser =
|
|
74
|
+
var valueParser = baseFormatter;
|
|
70
75
|
var handleChange = useCallback(function (value) {
|
|
71
76
|
onChange && onChange(value ? value : null);
|
|
72
77
|
}, [onChange]);
|
|
@@ -63,7 +63,7 @@ export var getSelectEditor = function getSelectEditor(options) {
|
|
|
63
63
|
onChange: handleChange,
|
|
64
64
|
onKeyDown: handleKeyDown,
|
|
65
65
|
options: customOptions,
|
|
66
|
-
popupClassName:
|
|
66
|
+
popupClassName: "select-editor-dropdown",
|
|
67
67
|
dropdownRender: dropdown
|
|
68
68
|
}));
|
|
69
69
|
};
|
package/dist/core/table/index.js
CHANGED
|
@@ -16,7 +16,7 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
|
|
|
16
16
|
import { Sheet, useSetState } from "../..";
|
|
17
17
|
import { GroupContext } from "../../hooks/useGroupConfig";
|
|
18
18
|
import { WidthContext } from "../../hooks/useWidthConfig";
|
|
19
|
-
import { Button } from 'antd';
|
|
19
|
+
import { Button, ConfigProvider, Empty } from 'antd';
|
|
20
20
|
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
21
21
|
import { SheetEvent } from "../sheet/Event";
|
|
22
22
|
import { DraggableShell } from "../shell/draggableShell";
|
|
@@ -157,48 +157,55 @@ var Table = function Table(_ref) {
|
|
|
157
157
|
}
|
|
158
158
|
});
|
|
159
159
|
}, [columns.length, draggable, headSelection, hasChildren]);
|
|
160
|
-
return /*#__PURE__*/_jsx(
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
160
|
+
return /*#__PURE__*/_jsx(ConfigProvider, {
|
|
161
|
+
renderEmpty: function renderEmpty() {
|
|
162
|
+
return /*#__PURE__*/_jsx(Empty, {
|
|
163
|
+
image: Empty.PRESENTED_IMAGE_SIMPLE
|
|
164
|
+
});
|
|
164
165
|
},
|
|
165
|
-
children: /*#__PURE__*/_jsx(
|
|
166
|
+
children: /*#__PURE__*/_jsx(WidthContext.Provider, {
|
|
166
167
|
value: {
|
|
167
|
-
|
|
168
|
-
onChange:
|
|
168
|
+
widths: widths,
|
|
169
|
+
onChange: setWidth
|
|
169
170
|
},
|
|
170
|
-
children: /*#__PURE__*/
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
children:
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
onChange: handleRowSelect
|
|
179
|
-
}), /*#__PURE__*/_jsx(GroupEvent, {
|
|
180
|
-
hasChildren: hasChildren,
|
|
171
|
+
children: /*#__PURE__*/_jsx(GroupContext.Provider, {
|
|
172
|
+
value: {
|
|
173
|
+
config: rowGroupConfig,
|
|
174
|
+
onChange: setGroupConfig
|
|
175
|
+
},
|
|
176
|
+
children: /*#__PURE__*/_jsxs(Sheet, _objectSpread(_objectSpread({}, args), {}, {
|
|
177
|
+
sheetInstance: sheetInstance,
|
|
178
|
+
sheetRenderer: WrappedTableShell,
|
|
181
179
|
data: data,
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
180
|
+
onCellsChanged: handleChanges,
|
|
181
|
+
children: [/*#__PURE__*/_jsx(SelectionEvent, {
|
|
182
|
+
hasChildren: hasChildren,
|
|
183
|
+
rowSelection: rowSelection,
|
|
184
|
+
onChange: handleRowSelect
|
|
185
|
+
}), /*#__PURE__*/_jsx(GroupEvent, {
|
|
186
|
+
hasChildren: hasChildren,
|
|
187
|
+
data: data,
|
|
188
|
+
sheetInstance: sheetInstance.current,
|
|
189
|
+
onGridChange: setData
|
|
190
|
+
}), /*#__PURE__*/_jsx(SheetEvent, {
|
|
191
|
+
name: "reverse",
|
|
192
|
+
handler: handleReverse
|
|
193
|
+
}, "_reverse"), Object.keys(eventHandler || {}).map(function (key) {
|
|
194
|
+
return /*#__PURE__*/_jsx(SheetEvent, {
|
|
195
|
+
name: key,
|
|
196
|
+
handler: eventHandler === null || eventHandler === void 0 ? void 0 : eventHandler[key]
|
|
197
|
+
}, key);
|
|
198
|
+
}), handleAdd ? /*#__PURE__*/_jsx(Button, {
|
|
199
|
+
type: "dashed",
|
|
200
|
+
style: {
|
|
201
|
+
width: '100%',
|
|
202
|
+
height: 32
|
|
203
|
+
},
|
|
204
|
+
onClick: handleAdd,
|
|
205
|
+
children: "+ \u6DFB\u52A0"
|
|
206
|
+
}) : null]
|
|
207
|
+
}))
|
|
208
|
+
})
|
|
202
209
|
})
|
|
203
210
|
});
|
|
204
211
|
};
|