@lemon-fe/components 0.1.123 → 0.1.124
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.
|
@@ -22,7 +22,8 @@ export default function VirtualList(props) {
|
|
|
22
22
|
var _useContext = useContext(BaseTableContext),
|
|
23
23
|
scrollY = _useContext.scrollY,
|
|
24
24
|
_useContext$rowHeight = _useContext.rowHeight,
|
|
25
|
-
rowHeight = _useContext$rowHeight === void 0 ? 37 : _useContext$rowHeight
|
|
25
|
+
rowHeight = _useContext$rowHeight === void 0 ? 37 : _useContext$rowHeight,
|
|
26
|
+
antPrefixCls = _useContext.antPrefixCls;
|
|
26
27
|
var _useState = useState(null),
|
|
27
28
|
_useState2 = _slicedToArray(_useState, 2),
|
|
28
29
|
range = _useState2[0],
|
|
@@ -36,7 +37,7 @@ export default function VirtualList(props) {
|
|
|
36
37
|
if (body === null) {
|
|
37
38
|
return null;
|
|
38
39
|
}
|
|
39
|
-
var scroller = body.closest(
|
|
40
|
+
var scroller = body.closest(".".concat(antPrefixCls, "-body"));
|
|
40
41
|
if (scroller === null) {
|
|
41
42
|
return null;
|
|
42
43
|
}
|
|
@@ -99,7 +100,7 @@ export default function VirtualList(props) {
|
|
|
99
100
|
if (ref.current === null) {
|
|
100
101
|
return;
|
|
101
102
|
}
|
|
102
|
-
var tableBody = (_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.closest(
|
|
103
|
+
var tableBody = (_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.closest(".".concat(antPrefixCls, "-body"));
|
|
103
104
|
if (tableBody === null) {
|
|
104
105
|
return;
|
|
105
106
|
}
|
package/es/BaseTable/index.js
CHANGED
|
@@ -17,8 +17,8 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
|
17
17
|
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; }
|
|
18
18
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
19
19
|
/// <reference path="../../typings.d.ts" />
|
|
20
|
-
import React, { useMemo, useState, useEffect, useRef, forwardRef } from 'react';
|
|
21
|
-
import { Table as AntdTable } from 'antd';
|
|
20
|
+
import React, { useMemo, useState, useEffect, useRef, forwardRef, useContext } from 'react';
|
|
21
|
+
import { Table as AntdTable, ConfigProvider } from 'antd';
|
|
22
22
|
import classNames from 'classnames';
|
|
23
23
|
import { get } from 'lodash';
|
|
24
24
|
import ResizeObserver from 'rc-resize-observer';
|
|
@@ -52,13 +52,15 @@ function Th(props) {
|
|
|
52
52
|
children = props.children,
|
|
53
53
|
className = props.className,
|
|
54
54
|
restProps = _objectWithoutProperties(props, _excluded);
|
|
55
|
-
var
|
|
55
|
+
var _useContext = useContext(BaseTableContext),
|
|
56
|
+
antPrefixCls = _useContext.antPrefixCls;
|
|
57
|
+
var reg = new RegExp("\\b".concat(antPrefixCls, "-cell-ellipsis\\b"));
|
|
56
58
|
var content = children;
|
|
57
59
|
var mClassName = className;
|
|
58
60
|
if (mClassName && reg.test(mClassName)) {
|
|
59
61
|
mClassName = mClassName.replace(reg, '');
|
|
60
62
|
content = /*#__PURE__*/React.createElement("div", {
|
|
61
|
-
className: "
|
|
63
|
+
className: "".concat(antPrefixCls, "-cell-ellipsis")
|
|
62
64
|
}, content);
|
|
63
65
|
}
|
|
64
66
|
if (!width || !onWidthChange) {
|
|
@@ -99,6 +101,7 @@ function BaseTable(props, _ref) {
|
|
|
99
101
|
className = props.className,
|
|
100
102
|
localeProp = props.locale,
|
|
101
103
|
restProps = _objectWithoutProperties(props, _excluded2);
|
|
104
|
+
var antPrefixCls = useContext(ConfigProvider.ConfigContext).getPrefixCls('table');
|
|
102
105
|
var fullTableRef = useRef(null);
|
|
103
106
|
var _useState = useState(new Map()),
|
|
104
107
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -116,8 +119,8 @@ function BaseTable(props, _ref) {
|
|
|
116
119
|
if (wrapper === null) {
|
|
117
120
|
return null;
|
|
118
121
|
}
|
|
119
|
-
var table = wrapper.querySelector(
|
|
120
|
-
var tableBody = wrapper.querySelector(
|
|
122
|
+
var table = wrapper.querySelector(".".concat(antPrefixCls));
|
|
123
|
+
var tableBody = wrapper.querySelector(".".concat(antPrefixCls, "-body"));
|
|
121
124
|
if (tableBody === null || table === null) {
|
|
122
125
|
return null;
|
|
123
126
|
}
|
|
@@ -170,7 +173,7 @@ function BaseTable(props, _ref) {
|
|
|
170
173
|
}, [scrollYProp]);
|
|
171
174
|
useEffect(function () {
|
|
172
175
|
if (scrollY !== undefined && fullTableRef.current !== null) {
|
|
173
|
-
var body = fullTableRef.current.querySelector(
|
|
176
|
+
var body = fullTableRef.current.querySelector(".".concat(antPrefixCls, "-body"));
|
|
174
177
|
if (body !== null) {
|
|
175
178
|
var dataType = _typeof(scrollY);
|
|
176
179
|
switch (dataType) {
|
|
@@ -327,9 +330,10 @@ function BaseTable(props, _ref) {
|
|
|
327
330
|
var ctx = useMemo(function () {
|
|
328
331
|
return {
|
|
329
332
|
scrollY: scrollY,
|
|
330
|
-
rowHeight: rowHeight
|
|
333
|
+
rowHeight: rowHeight,
|
|
334
|
+
antPrefixCls: antPrefixCls
|
|
331
335
|
};
|
|
332
|
-
}, [scrollY, rowHeight]);
|
|
336
|
+
}, [scrollY, rowHeight, antPrefixCls]);
|
|
333
337
|
var tableNode = /*#__PURE__*/React.createElement(AntdTable, _objectSpread(_objectSpread({
|
|
334
338
|
size: "small",
|
|
335
339
|
ref: function ref(elm) {
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
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; }
|
|
2
2
|
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; }
|
|
3
3
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
4
|
-
import React from 'react';
|
|
5
|
-
import { message } from 'antd';
|
|
4
|
+
import React, { useContext } from 'react';
|
|
5
|
+
import { ConfigProvider, message } from 'antd';
|
|
6
6
|
import classNames from 'classnames';
|
|
7
7
|
import { get } from 'lodash';
|
|
8
8
|
import { PREFIX_CLS } from '../constants';
|
|
9
9
|
import Icons from '../Icons';
|
|
10
10
|
export default function EditableCell(props) {
|
|
11
|
+
var _classNames;
|
|
11
12
|
var focused = props.focused,
|
|
12
13
|
onFocus = props.onFocus,
|
|
13
14
|
children = props.children,
|
|
@@ -19,15 +20,12 @@ export default function EditableCell(props) {
|
|
|
19
20
|
_props$noStyle = props.noStyle,
|
|
20
21
|
noStyle = _props$noStyle === void 0 ? false : _props$noStyle;
|
|
21
22
|
var disabled = get(children, 'props.disabled');
|
|
23
|
+
var inputPrefixCls = useContext(ConfigProvider.ConfigContext).getPrefixCls('input');
|
|
22
24
|
var mainProps = {
|
|
23
25
|
onFocus: onFocus,
|
|
24
26
|
'data-up-down': disableUpDown ? '0' : '1',
|
|
25
27
|
'data-left-right': disableLeftRight ? '0' : '1',
|
|
26
|
-
className: noStyle ? "".concat(PREFIX_CLS, "-form-item-no-style") : classNames("".concat(PREFIX_CLS, "-form-item"), {
|
|
27
|
-
'ant-input': focused >= 1 && bordered,
|
|
28
|
-
'ant-input-focused': focused >= 2 && bordered,
|
|
29
|
-
'ant-input-disabled': disabled
|
|
30
|
-
})
|
|
28
|
+
className: noStyle ? "".concat(PREFIX_CLS, "-form-item-no-style") : classNames("".concat(PREFIX_CLS, "-form-item"), (_classNames = {}, _defineProperty(_classNames, inputPrefixCls, focused >= 1 && bordered), _defineProperty(_classNames, "".concat(inputPrefixCls, "-focused"), focused >= 2 && bordered), _defineProperty(_classNames, "".concat(inputPrefixCls, "-disabled"), disabled), _classNames))
|
|
31
29
|
};
|
|
32
30
|
return /*#__PURE__*/React.createElement("div", _objectSpread({}, mainProps), children, errors !== undefined ? /*#__PURE__*/React.createElement("div", {
|
|
33
31
|
className: "".concat(PREFIX_CLS, "-form-item-error"),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lemon-fe/components",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.124",
|
|
4
4
|
"description": "> TODO: description",
|
|
5
5
|
"author": "鲁盛杰 <lusj@cnlemon.net>",
|
|
6
6
|
"homepage": "",
|
|
@@ -39,5 +39,5 @@
|
|
|
39
39
|
"react": "^17.0.2",
|
|
40
40
|
"react-dom": "^17.0.2"
|
|
41
41
|
},
|
|
42
|
-
"gitHead": "
|
|
42
|
+
"gitHead": "aa14d0c951acdc5db1bd2246dfb4bf6200bf845d"
|
|
43
43
|
}
|