linkmore-design 1.0.35 → 1.0.38
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/CardTable/utils.d.ts +1 -1
- package/dist/Cascader/demos/basic.d.ts +2 -0
- package/dist/Cascader/index.d.ts +4 -0
- package/dist/Cascader/style/index.d.ts +1 -0
- package/dist/Form/demos/basic.d.ts +2 -0
- package/dist/Form/demos/drawer1152-triple.d.ts +3 -0
- package/dist/Form/demos/drawer440-double.d.ts +3 -0
- package/dist/Form/demos/drawer440.d.ts +3 -0
- package/dist/Form/demos/drawer720-double.d.ts +3 -0
- package/dist/Form/demos/modal416.d.ts +3 -0
- package/dist/Form/demos/modal552-double.d.ts +3 -0
- package/dist/Form/index.d.ts +24 -0
- package/dist/Form/style/index.d.ts +1 -0
- package/dist/Input/demos/after.d.ts +1 -1
- package/dist/Input/demos/base.d.ts +1 -1
- package/dist/Input/demos/basic.d.ts +1 -1
- package/dist/Input/demos/color.d.ts +1 -1
- package/dist/Input/demos/combination.d.ts +1 -1
- package/dist/Input/demos/import.d.ts +1 -1
- package/dist/Input/demos/line.d.ts +1 -1
- package/dist/Input/demos/password.d.ts +1 -1
- package/dist/Input/demos/size.d.ts +1 -1
- package/dist/Input/index.d.ts +10 -2
- package/dist/LmSelect/GhostSelect.d.ts +2 -0
- package/dist/LmSelect/NormalSelect.d.ts +11 -0
- package/dist/LmSelect/demos/basic.d.ts +2 -0
- package/dist/LmSelect/demos/checkbox.d.ts +2 -0
- package/dist/LmSelect/demos/ghost.d.ts +2 -0
- package/dist/LmSelect/index.d.ts +14 -0
- package/dist/LmSelect/style/index.d.ts +1 -0
- package/dist/LmSelect/useCheckboxOptions.d.ts +1 -0
- package/dist/LmSelect/utils.d.ts +10 -0
- package/dist/LmTable/demos/getData.d.ts +2 -0
- package/dist/VirtualList/index.d.ts +1 -1
- package/dist/hooks/index.d.ts +2 -0
- package/dist/hooks/useEvent/index.d.ts +2 -0
- package/dist/hooks/useFullscreen/demos/basic.d.ts +2 -0
- package/dist/hooks/useFullscreen/index.d.ts +15 -0
- package/dist/index.d.ts +4 -1
- package/dist/index.umd.js +1359 -271
- package/dist/index.umd.min.js +7 -7
- package/es/Cascader/index.d.ts +4 -0
- package/es/Cascader/index.js +37 -0
- package/es/Cascader/style/index.css +520 -0
- package/es/Cascader/style/index.d.ts +1 -0
- package/es/Cascader/style/index.js +1 -0
- package/es/CustomTableOption/columnsSort.js +42 -11
- package/es/CustomTableOption/filterSort.js +34 -4
- package/es/CustomTableOption/index.js +25 -8
- package/es/CustomTableOption/style/index.css +29 -0
- package/es/EditTable/EditTable.js +25 -3
- package/es/Form/index.d.ts +24 -0
- package/es/Form/index.js +56 -0
- package/es/Form/style/index.css +531 -0
- package/es/Form/style/index.d.ts +1 -0
- package/es/Form/style/index.js +1 -0
- package/es/Input/index.d.ts +11 -0
- package/es/Input/index.js +31 -37
- package/es/LmSelect/GhostSelect.d.ts +2 -0
- package/es/LmSelect/GhostSelect.js +523 -0
- package/es/LmSelect/NormalSelect.d.ts +11 -0
- package/es/LmSelect/NormalSelect.js +97 -0
- package/es/LmSelect/icon_placeholder.png +0 -0
- package/es/LmSelect/index.d.ts +14 -0
- package/es/LmSelect/index.js +34 -0
- package/es/LmSelect/style/index.css +751 -0
- package/es/LmSelect/style/index.d.ts +1 -0
- package/es/LmSelect/style/index.js +1 -0
- package/es/LmSelect/useCheckboxOptions.d.ts +1 -0
- package/es/LmSelect/useCheckboxOptions.js +120 -0
- package/es/LmSelect/utils.d.ts +10 -0
- package/es/LmSelect/utils.js +66 -0
- package/es/LmTable/Table.js +29 -26
- package/es/Radio/index.js +3 -2
- package/es/Radio/style/style.css +4 -0
- package/es/VirtualList/index.js +2 -1
- package/es/hooks/index.d.ts +2 -0
- package/es/hooks/index.js +2 -0
- package/es/hooks/useEvent/index.d.ts +2 -0
- package/es/hooks/useEvent/index.js +16 -0
- package/es/hooks/useFullscreen/index.d.ts +15 -0
- package/es/hooks/useFullscreen/index.js +99 -0
- package/es/index.d.ts +4 -1
- package/es/index.js +4 -1
- package/lib/Cascader/index.d.ts +4 -0
- package/lib/Cascader/index.js +50 -0
- package/lib/Cascader/style/index.css +520 -0
- package/lib/Cascader/style/index.d.ts +1 -0
- package/lib/Cascader/style/index.js +3 -0
- package/lib/CustomTableOption/columnsSort.js +42 -10
- package/lib/CustomTableOption/filterSort.js +33 -3
- package/lib/CustomTableOption/index.js +24 -7
- package/lib/CustomTableOption/style/index.css +29 -0
- package/lib/EditTable/EditTable.js +25 -3
- package/lib/Form/index.d.ts +24 -0
- package/lib/Form/index.js +75 -0
- package/lib/Form/style/index.css +531 -0
- package/lib/Form/style/index.d.ts +1 -0
- package/lib/Form/style/index.js +3 -0
- package/lib/Input/index.d.ts +11 -0
- package/lib/Input/index.js +24 -15
- package/lib/LmSelect/GhostSelect.d.ts +2 -0
- package/lib/LmSelect/GhostSelect.js +545 -0
- package/lib/LmSelect/NormalSelect.d.ts +11 -0
- package/lib/LmSelect/NormalSelect.js +116 -0
- package/lib/LmSelect/icon_placeholder.png +0 -0
- package/lib/LmSelect/index.d.ts +14 -0
- package/lib/LmSelect/index.js +50 -0
- package/lib/LmSelect/style/index.css +751 -0
- package/lib/LmSelect/style/index.d.ts +1 -0
- package/lib/LmSelect/style/index.js +3 -0
- package/lib/LmSelect/useCheckboxOptions.d.ts +1 -0
- package/lib/LmSelect/useCheckboxOptions.js +139 -0
- package/lib/LmSelect/utils.d.ts +10 -0
- package/lib/LmSelect/utils.js +103 -0
- package/lib/LmTable/Table.js +29 -26
- package/lib/Radio/index.js +3 -2
- package/lib/Radio/style/style.css +4 -0
- package/lib/VirtualList/index.js +2 -1
- package/lib/hooks/index.d.ts +2 -0
- package/lib/hooks/index.js +23 -0
- package/lib/hooks/useEvent/index.d.ts +2 -0
- package/lib/hooks/useEvent/index.js +25 -0
- package/lib/hooks/useFullscreen/index.d.ts +15 -0
- package/lib/hooks/useFullscreen/index.js +113 -0
- package/lib/index.d.ts +4 -1
- package/lib/index.js +25 -1
- package/package.json +5 -4
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import './index.less';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "./index.css";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const useCheckboxOptions: (options: any, controllable: any, filter?: string) => JSX.Element;
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
2
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
3
|
+
|
|
4
|
+
var __rest = this && this.__rest || function (s, e) {
|
|
5
|
+
var t = {};
|
|
6
|
+
|
|
7
|
+
for (var p in s) {
|
|
8
|
+
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
12
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
13
|
+
}
|
|
14
|
+
return t;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
import { useEvent } from '../hooks';
|
|
18
|
+
import { useControllableValue } from 'ahooks';
|
|
19
|
+
import classNames from 'classnames';
|
|
20
|
+
import { Checkbox, VirtualList } from 'linkmore-design';
|
|
21
|
+
import React, { useMemo } from 'react';
|
|
22
|
+
import { onStringSearch } from './utils';
|
|
23
|
+
|
|
24
|
+
var imgEmpty = require('./icon_placeholder.png');
|
|
25
|
+
|
|
26
|
+
var FilterEmpty = function FilterEmpty() {
|
|
27
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
28
|
+
className: "filter_empty"
|
|
29
|
+
}, /*#__PURE__*/React.createElement("img", {
|
|
30
|
+
src: imgEmpty,
|
|
31
|
+
alt: "empty",
|
|
32
|
+
width: 81
|
|
33
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
34
|
+
className: "filter_empty_text"
|
|
35
|
+
}, "\u6682\u65E0\u6570\u636E"));
|
|
36
|
+
}; // todo 抽取出来, 后续做统一处理, 项目中多处用到类似的功能
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
export var useCheckboxOptions = function useCheckboxOptions(options, controllable) {
|
|
40
|
+
var filter = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
|
|
41
|
+
|
|
42
|
+
// 将value和onChange改为受控,和父组件共享
|
|
43
|
+
var _useControllableValue = useControllableValue(controllable),
|
|
44
|
+
_useControllableValue2 = _slicedToArray(_useControllableValue, 2),
|
|
45
|
+
checkedValues = _useControllableValue2[0],
|
|
46
|
+
setCheckedValues = _useControllableValue2[1];
|
|
47
|
+
|
|
48
|
+
var renderOptions = useMemo(function () {
|
|
49
|
+
return options.filter(function (v) {
|
|
50
|
+
return onStringSearch(filter, v.label);
|
|
51
|
+
});
|
|
52
|
+
}, [options, filter]); // 是否全选: 选中的数据大于等于筛选后的数据 && 筛选后的数据全部存在于选中的数据中
|
|
53
|
+
|
|
54
|
+
var checkAll = useMemo(function () {
|
|
55
|
+
var isLen = checkedValues.length >= renderOptions.length;
|
|
56
|
+
return isLen && renderOptions.every(function (_ref) {
|
|
57
|
+
var value = _ref.value;
|
|
58
|
+
return checkedValues.includes(value);
|
|
59
|
+
});
|
|
60
|
+
}, [checkedValues.length, renderOptions]); // 是否半选: 存在选中的数据 && 未全选
|
|
61
|
+
|
|
62
|
+
var indeterminate = useMemo(function () {
|
|
63
|
+
return checkedValues.length && !checkAll;
|
|
64
|
+
}, [checkedValues.length, checkAll]); // 全选事件
|
|
65
|
+
|
|
66
|
+
var onCheckAllChange = useEvent(function () {
|
|
67
|
+
var nValue = checkAll ? checkedValues.filter(function (v) {
|
|
68
|
+
return !renderOptions.some(function (_ref2) {
|
|
69
|
+
var value = _ref2.value;
|
|
70
|
+
return v === value;
|
|
71
|
+
});
|
|
72
|
+
}) : Array.from(new Set([].concat(_toConsumableArray(checkedValues), _toConsumableArray(renderOptions.map(function (v) {
|
|
73
|
+
return v.value;
|
|
74
|
+
})))));
|
|
75
|
+
setCheckedValues(nValue);
|
|
76
|
+
});
|
|
77
|
+
var onChange = useEvent(function (e, item) {
|
|
78
|
+
e.preventDefault();
|
|
79
|
+
e.stopPropagation();
|
|
80
|
+
var arr = checkedValues.includes(item.value) ? checkedValues.filter(function (v) {
|
|
81
|
+
return v !== item.value;
|
|
82
|
+
}) : [].concat(_toConsumableArray(checkedValues), [item.value]);
|
|
83
|
+
setCheckedValues(arr || undefined);
|
|
84
|
+
});
|
|
85
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
86
|
+
className: "select_dropdown"
|
|
87
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
88
|
+
className: "filter_header"
|
|
89
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
90
|
+
className: "filter_header_operate"
|
|
91
|
+
}, /*#__PURE__*/React.createElement(Checkbox, {
|
|
92
|
+
indeterminate: indeterminate,
|
|
93
|
+
onChange: onCheckAllChange,
|
|
94
|
+
checked: checkAll,
|
|
95
|
+
className: "filter_tip"
|
|
96
|
+
}, "\u5168\u90E8"), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("span", {
|
|
97
|
+
className: "filter_tip"
|
|
98
|
+
}, "\u5DF2\u9009: ", checkedValues.length)))), /*#__PURE__*/React.createElement(Checkbox.Group, {
|
|
99
|
+
value: checkedValues,
|
|
100
|
+
className: "filter_body"
|
|
101
|
+
}, /*#__PURE__*/React.createElement(VirtualList, {
|
|
102
|
+
options: renderOptions,
|
|
103
|
+
className: "filter_list"
|
|
104
|
+
}, function (_a) {
|
|
105
|
+
var item = _a.item,
|
|
106
|
+
resetProps = __rest(_a, ["item"]);
|
|
107
|
+
|
|
108
|
+
return /*#__PURE__*/React.createElement("div", Object.assign({}, resetProps, {
|
|
109
|
+
className: classNames('filter_item', {
|
|
110
|
+
checked: checkedValues.includes(item.value)
|
|
111
|
+
}),
|
|
112
|
+
onClick: function onClick(e) {
|
|
113
|
+
return onChange(e, item);
|
|
114
|
+
}
|
|
115
|
+
}), /*#__PURE__*/React.createElement(Checkbox, {
|
|
116
|
+
value: item.value,
|
|
117
|
+
className: "filter_item-content"
|
|
118
|
+
}, item.label));
|
|
119
|
+
}), !renderOptions.length && /*#__PURE__*/React.createElement(FilterEmpty, null)));
|
|
120
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare function getArray(val: any): any[];
|
|
2
|
+
export declare const isOptions: (key: any) => boolean;
|
|
3
|
+
export declare const onStringSearch: (key?: string, str?: string) => boolean;
|
|
4
|
+
export declare function getOptions(children: any): any[];
|
|
5
|
+
export declare function getIsHas(val: any): boolean;
|
|
6
|
+
export declare function isClassComponent(component: any): any;
|
|
7
|
+
export declare function isExoticComponent(component: any): boolean;
|
|
8
|
+
export declare function isReactComponent(component: any): any;
|
|
9
|
+
export declare const render: (Comp: any, props?: {}) => any;
|
|
10
|
+
export declare const useSearch: (showSearch: any, renderOptions: any) => any;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import _typeof from "@babel/runtime/helpers/esm/typeof";
|
|
2
|
+
import React, { useMemo } from 'react'; // 获取数组
|
|
3
|
+
|
|
4
|
+
export function getArray(val) {
|
|
5
|
+
if (!val) return [];
|
|
6
|
+
return Array.isArray(val) ? val : [val];
|
|
7
|
+
} // 判断是否符合options格式
|
|
8
|
+
|
|
9
|
+
export var isOptions = function isOptions(key) {
|
|
10
|
+
return ['label', 'value'].includes(key);
|
|
11
|
+
}; // 查询搜索, 都转成小写用于匹配
|
|
12
|
+
|
|
13
|
+
export var onStringSearch = function onStringSearch() {
|
|
14
|
+
var key = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
15
|
+
var str = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
|
16
|
+
return str.toLowerCase().includes(key.toLowerCase());
|
|
17
|
+
}; // 将options和children都转成options
|
|
18
|
+
|
|
19
|
+
export function getOptions(children) {
|
|
20
|
+
var array = getArray(children);
|
|
21
|
+
return array.map(function (item) {
|
|
22
|
+
if (Object.keys(item).every(isOptions)) return item;
|
|
23
|
+
return {
|
|
24
|
+
label: item.props.children,
|
|
25
|
+
value: item.props.value,
|
|
26
|
+
disabled: !!item.props.disabled
|
|
27
|
+
};
|
|
28
|
+
});
|
|
29
|
+
} // 检查是否存在内容
|
|
30
|
+
|
|
31
|
+
export function getIsHas(val) {
|
|
32
|
+
var _a; // 检查是否数字类型, 是否布尔类型
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
var flag = !!val || typeof val === 'number' || typeof val === 'boolean'; // 检查空对象和空数组
|
|
36
|
+
|
|
37
|
+
if (!!val && _typeof(val) === 'object') {
|
|
38
|
+
flag = Array.isArray(val) ? !!val.length : !!((_a = Object.keys(val)) === null || _a === void 0 ? void 0 : _a.length);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
return flag;
|
|
42
|
+
} // 检查是否类组件
|
|
43
|
+
|
|
44
|
+
export function isClassComponent(component) {
|
|
45
|
+
return typeof component === 'function' && function () {
|
|
46
|
+
var proto = Object.getPrototypeOf(component);
|
|
47
|
+
return proto.prototype && proto.prototype.isReactComponent;
|
|
48
|
+
}();
|
|
49
|
+
} // 检查是否自定义组件
|
|
50
|
+
|
|
51
|
+
export function isExoticComponent(component) {
|
|
52
|
+
return _typeof(component) === 'object' && _typeof(component.$$typeof) === 'symbol' && ['react.memo', 'react.forward_ref'].includes(component.$$typeof.description);
|
|
53
|
+
} // 检查是否React组件
|
|
54
|
+
|
|
55
|
+
export function isReactComponent(component) {
|
|
56
|
+
return isClassComponent(component) || typeof component === 'function' || isExoticComponent(component);
|
|
57
|
+
}
|
|
58
|
+
export var render = function render(Comp) {
|
|
59
|
+
var props = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
60
|
+
return !Comp ? null : isReactComponent(Comp) ? /*#__PURE__*/React.createElement(Comp, Object.assign({}, props)) : Comp;
|
|
61
|
+
};
|
|
62
|
+
export var useSearch = function useSearch(showSearch, renderOptions) {
|
|
63
|
+
return useMemo(function () {
|
|
64
|
+
return showSearch || renderOptions.length > 8;
|
|
65
|
+
}, [renderOptions.length, showSearch]);
|
|
66
|
+
};
|
package/es/LmTable/Table.js
CHANGED
|
@@ -291,7 +291,8 @@ var ResetTable = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
291
291
|
selectedRows: value
|
|
292
292
|
});
|
|
293
293
|
rowClick === null || rowClick === void 0 ? void 0 : rowClick(value);
|
|
294
|
-
}
|
|
294
|
+
},
|
|
295
|
+
checkboxRecords: useSelectedRows.selectedRows
|
|
295
296
|
};
|
|
296
297
|
}); // loading触发清空选中状态
|
|
297
298
|
|
|
@@ -337,6 +338,18 @@ var ResizeSize = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
337
338
|
var _props$autoSizer = props.autoSizer,
|
|
338
339
|
autoSizer = _props$autoSizer === void 0 ? false : _props$autoSizer;
|
|
339
340
|
|
|
341
|
+
var _useState9 = (0, _react.useState)({
|
|
342
|
+
width: '100%',
|
|
343
|
+
height: '100%'
|
|
344
|
+
}),
|
|
345
|
+
_useState10 = (0, _slicedToArray2.default)(_useState9, 2),
|
|
346
|
+
tableSize = _useState10[0],
|
|
347
|
+
setTableSize = _useState10[1];
|
|
348
|
+
|
|
349
|
+
var defaultRef = ref || (0, _react.useRef)(null);
|
|
350
|
+
var tableWarpRef = (0, _react.useRef)(null);
|
|
351
|
+
var resizeRef = (0, _react.useRef)(null);
|
|
352
|
+
|
|
340
353
|
if (!autoSizer) {
|
|
341
354
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
342
355
|
ref: tableWarpRef,
|
|
@@ -355,17 +368,6 @@ var ResizeSize = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
355
368
|
})));
|
|
356
369
|
}
|
|
357
370
|
|
|
358
|
-
var _useState9 = (0, _react.useState)({
|
|
359
|
-
width: '100%',
|
|
360
|
-
height: '100%'
|
|
361
|
-
}),
|
|
362
|
-
_useState10 = (0, _slicedToArray2.default)(_useState9, 2),
|
|
363
|
-
tableSize = _useState10[0],
|
|
364
|
-
setTableSize = _useState10[1];
|
|
365
|
-
|
|
366
|
-
var defaultRef = ref || (0, _react.useRef)(null);
|
|
367
|
-
var tableWarpRef = (0, _react.useRef)(null);
|
|
368
|
-
var resizeRef = (0, _react.useRef)(null);
|
|
369
371
|
var resetHeight = (0, _react.useMemo)(function () {
|
|
370
372
|
var height = tableSize.height;
|
|
371
373
|
var h = height - 32;
|
|
@@ -414,24 +416,25 @@ var ResizeSize = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
414
416
|
|
|
415
417
|
var handResize = (0, _lodash.throttle)(changeSize, 600);
|
|
416
418
|
(0, _react.useEffect)(function () {
|
|
417
|
-
var _tableWarpRef$current8;
|
|
418
|
-
|
|
419
419
|
var hiddenPage = props.hiddenPage,
|
|
420
420
|
customCheck = props.customCheck,
|
|
421
421
|
summary = props.summary;
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
422
|
+
setTimeout(function () {
|
|
423
|
+
var _tableWarpRef$current8;
|
|
424
|
+
|
|
425
|
+
var _tableWarpRef$current5 = (_tableWarpRef$current8 = tableWarpRef.current) === null || _tableWarpRef$current8 === void 0 ? void 0 : _tableWarpRef$current8.getBoundingClientRect(),
|
|
426
|
+
_tableWarpRef$current6 = _tableWarpRef$current5.width,
|
|
427
|
+
width = _tableWarpRef$current6 === void 0 ? '100%' : _tableWarpRef$current6,
|
|
428
|
+
_tableWarpRef$current7 = _tableWarpRef$current5.height,
|
|
429
|
+
height = _tableWarpRef$current7 === void 0 ? '100%' : _tableWarpRef$current7;
|
|
430
|
+
|
|
431
|
+
var value = summary ? 48 : 0;
|
|
432
|
+
setTableSize({
|
|
433
|
+
width: width,
|
|
434
|
+
height: typeof height === 'string' ? "calc(".concat(height, " - ").concat(value, "px)") : height - value
|
|
435
|
+
});
|
|
436
|
+
}, 100);
|
|
430
437
|
resizeRef.current = window.addEventListener('resize', handResize);
|
|
431
|
-
setTableSize({
|
|
432
|
-
width: width,
|
|
433
|
-
height: typeof height === 'string' ? "calc(".concat(height, " - ").concat(value, "px)") : height - value
|
|
434
|
-
});
|
|
435
438
|
return function () {
|
|
436
439
|
window.removeEventListener('resize', handResize);
|
|
437
440
|
};
|
package/es/Radio/index.js
CHANGED
|
@@ -20,7 +20,7 @@ var _classnames = _interopRequireDefault(require("classnames"));
|
|
|
20
20
|
var _react = _interopRequireDefault(require("react"));
|
|
21
21
|
|
|
22
22
|
var _excluded = ["children"],
|
|
23
|
-
_excluded2 = ["children", "size", "buttonStyle", "direction"];
|
|
23
|
+
_excluded2 = ["children", "size", "buttonStyle", "direction", "className"];
|
|
24
24
|
|
|
25
25
|
var LMRadio = function LMRadio(props) {
|
|
26
26
|
var children = props.children,
|
|
@@ -37,10 +37,11 @@ LMRadio.Group = function (props) {
|
|
|
37
37
|
buttonStyle = props.buttonStyle,
|
|
38
38
|
_props$direction = props.direction,
|
|
39
39
|
direction = _props$direction === void 0 ? 'row' : _props$direction,
|
|
40
|
+
className = props.className,
|
|
40
41
|
restProps = (0, _objectWithoutProperties2.default)(props, _excluded2);
|
|
41
42
|
console.log(children, 'rrr');
|
|
42
43
|
return /*#__PURE__*/_react.default.createElement(_radio.default.Group, (0, _extends2.default)({
|
|
43
|
-
className: (0, _classnames.default)('lm-radio-group', "lm-radio-group-".concat(direction)),
|
|
44
|
+
className: (0, _classnames.default)(className, 'lm-radio-group', "lm-radio-group-".concat(direction)),
|
|
44
45
|
size: size
|
|
45
46
|
}, restProps), children);
|
|
46
47
|
};
|
package/es/Radio/style/style.css
CHANGED
|
@@ -119,6 +119,10 @@
|
|
|
119
119
|
.lm-radio-group .ant-radio-button-wrapper-disabled:hover {
|
|
120
120
|
color: var(--disabled-font-color);
|
|
121
121
|
}
|
|
122
|
+
.lm-radio-group.lm-radio-group-row {
|
|
123
|
+
display: flex;
|
|
124
|
+
flex-direction: row;
|
|
125
|
+
}
|
|
122
126
|
.lm-radio-group.lm-radio-group-column {
|
|
123
127
|
display: flex;
|
|
124
128
|
flex-direction: column;
|
package/es/VirtualList/index.js
CHANGED
|
@@ -17,7 +17,8 @@ var VirList = function VirList(_ref) {
|
|
|
17
17
|
children = _ref.children,
|
|
18
18
|
_ref$size = _ref.size,
|
|
19
19
|
size = _ref$size === void 0 ? 32 : _ref$size,
|
|
20
|
-
parentRef = _ref.parentRef,
|
|
20
|
+
_ref$parentRef = _ref.parentRef,
|
|
21
|
+
parentRef = _ref$parentRef === void 0 ? null : _ref$parentRef,
|
|
21
22
|
className = _ref.className,
|
|
22
23
|
_ref$maxHeight = _ref.maxHeight,
|
|
23
24
|
maxHeight = _ref$maxHeight === void 0 ? 224 : _ref$maxHeight;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { useCallback, useLayoutEffect, useRef } from 'react'; // * 解决useCallback的依赖传导问题,存储事件
|
|
2
|
+
|
|
3
|
+
function useEvent(handler) {
|
|
4
|
+
var handlerRef = useRef(null); // 同步,运行时间在布局前
|
|
5
|
+
|
|
6
|
+
useLayoutEffect(function () {
|
|
7
|
+
handlerRef.current = handler;
|
|
8
|
+
}); // 存储方法函数
|
|
9
|
+
|
|
10
|
+
return useCallback(function () {
|
|
11
|
+
var fn = handlerRef.current;
|
|
12
|
+
return fn.apply(void 0, arguments);
|
|
13
|
+
}, []);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export default useEvent;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { MutableRefObject } from 'react';
|
|
2
|
+
declare type TargetValue<T> = T | undefined | null;
|
|
3
|
+
declare type TargetType = HTMLElement | Element | Window | Document;
|
|
4
|
+
declare type BasicTarget<T extends TargetType = Element> = (() => TargetValue<T>) | TargetValue<T> | MutableRefObject<TargetValue<T>>;
|
|
5
|
+
interface Options {
|
|
6
|
+
onExit?: () => void;
|
|
7
|
+
onEnter?: () => void;
|
|
8
|
+
}
|
|
9
|
+
declare const useFullscreen: (target: BasicTarget, options?: Options) => {
|
|
10
|
+
isFullscreen: boolean;
|
|
11
|
+
enterFullscreen: () => void;
|
|
12
|
+
exitFullscreen: () => void;
|
|
13
|
+
toggleFullscreen: () => void;
|
|
14
|
+
};
|
|
15
|
+
export default useFullscreen;
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
2
|
+
import { useState, useRef, useEffect } from 'react';
|
|
3
|
+
import { message } from '../../index';
|
|
4
|
+
var isBrowser = !!(typeof window !== 'undefined' && window.document && window.document.createElement);
|
|
5
|
+
|
|
6
|
+
var isFunction = function isFunction(value) {
|
|
7
|
+
return typeof value === 'function';
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
var getTargetElement = function getTargetElement(target, defaultElement) {
|
|
11
|
+
if (!isBrowser) {
|
|
12
|
+
return undefined;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
if (!target) {
|
|
16
|
+
return defaultElement;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
var targetElement;
|
|
20
|
+
|
|
21
|
+
if (isFunction(target)) {
|
|
22
|
+
targetElement = target();
|
|
23
|
+
} else if ('current' in target) {
|
|
24
|
+
targetElement = target.current;
|
|
25
|
+
} else {
|
|
26
|
+
targetElement = target;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
return targetElement;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
var fullScreenCssText = 'position: fixed;width: 100%;height:100%;top:0;left:0;z-index:1009;background-color: #abcdef;';
|
|
33
|
+
|
|
34
|
+
var useFullscreen = function useFullscreen(target, options) {
|
|
35
|
+
var _ref = options || {},
|
|
36
|
+
onExit = _ref.onExit,
|
|
37
|
+
onEnter = _ref.onEnter;
|
|
38
|
+
|
|
39
|
+
var _useState = useState(false),
|
|
40
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
41
|
+
isFullscreen = _useState2[0],
|
|
42
|
+
setIsFullscreen = _useState2[1];
|
|
43
|
+
|
|
44
|
+
var originCssTextRef = useRef('');
|
|
45
|
+
var eleRef = useRef(null);
|
|
46
|
+
|
|
47
|
+
var enterFullscreen = function enterFullscreen() {
|
|
48
|
+
onEnter === null || onEnter === void 0 ? void 0 : onEnter();
|
|
49
|
+
setIsFullscreen(true);
|
|
50
|
+
var el = getTargetElement(target);
|
|
51
|
+
|
|
52
|
+
if (!eleRef.current) {
|
|
53
|
+
eleRef.current = el;
|
|
54
|
+
var originCssText = el.style.cssText;
|
|
55
|
+
originCssTextRef.current = originCssText;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
eleRef.current.style.cssText = "".concat(originCssTextRef.current).concat(fullScreenCssText);
|
|
59
|
+
message.info({
|
|
60
|
+
content: '使用 Esc 键可退出全屏模式',
|
|
61
|
+
key: 'tip'
|
|
62
|
+
});
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
var exitFullscreen = function exitFullscreen() {
|
|
66
|
+
onExit === null || onExit === void 0 ? void 0 : onExit();
|
|
67
|
+
setIsFullscreen(false);
|
|
68
|
+
eleRef.current.style.cssText = "".concat(originCssTextRef.current);
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
var toggleFullscreen = function toggleFullscreen() {
|
|
72
|
+
if (isFullscreen) {
|
|
73
|
+
exitFullscreen();
|
|
74
|
+
} else {
|
|
75
|
+
enterFullscreen();
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
useEffect(function () {
|
|
80
|
+
var fn = function fn(event) {
|
|
81
|
+
if (event.keyCode === 27) {
|
|
82
|
+
exitFullscreen();
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
window.addEventListener('keydown', fn);
|
|
87
|
+
return function () {
|
|
88
|
+
window.removeEventListener('keydown', fn);
|
|
89
|
+
};
|
|
90
|
+
}, []);
|
|
91
|
+
return {
|
|
92
|
+
isFullscreen: isFullscreen,
|
|
93
|
+
enterFullscreen: enterFullscreen,
|
|
94
|
+
exitFullscreen: exitFullscreen,
|
|
95
|
+
toggleFullscreen: toggleFullscreen
|
|
96
|
+
};
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
export default useFullscreen;
|
package/es/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export { default as Button } from './Button';
|
|
2
2
|
export { default as ButtonTags } from './ButtonTags';
|
|
3
3
|
export { default as Card } from './Card';
|
|
4
|
+
export { default as Cascader } from './Cascader';
|
|
4
5
|
export { default as Checkbox } from './Checkbox';
|
|
5
6
|
export { default as CkFilter } from './CkFilter';
|
|
6
7
|
export { default as CustomerService } from './CustomerService';
|
|
@@ -17,6 +18,7 @@ export { default as Input } from './Input';
|
|
|
17
18
|
export { default as InputNumber } from './InputNumber';
|
|
18
19
|
export { default as LeftTable } from './LeftTable';
|
|
19
20
|
export { default as LmTable } from './LmTable';
|
|
21
|
+
export { default as LmSelect } from './LmSelect';
|
|
20
22
|
export { default as LoadingPage } from './LoadingPage';
|
|
21
23
|
export { default as Menu } from './Menu';
|
|
22
24
|
export { default as Modal } from './Modal';
|
|
@@ -40,5 +42,6 @@ export { default as Switch } from './Switch';
|
|
|
40
42
|
export { default as Image } from './Image';
|
|
41
43
|
export { default as CustomTableOption } from './CustomTableOption';
|
|
42
44
|
export { default as Upload } from './Upload';
|
|
43
|
-
export type { UploadProps, UploadFile } from './Upload';
|
|
45
|
+
export type { UploadProps, UploadFile, RcFile } from './Upload';
|
|
44
46
|
export { default as Tooltip } from './Tooltip';
|
|
47
|
+
export { default as Form } from './Form';
|
package/es/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export { default as Button } from './Button';
|
|
2
2
|
export { default as ButtonTags } from './ButtonTags';
|
|
3
3
|
export { default as Card } from './Card';
|
|
4
|
+
export { default as Cascader } from './Cascader';
|
|
4
5
|
export { default as Checkbox } from './Checkbox';
|
|
5
6
|
export { default as CkFilter } from './CkFilter';
|
|
6
7
|
export { default as CustomerService } from './CustomerService';
|
|
@@ -17,6 +18,7 @@ export { default as Input } from './Input';
|
|
|
17
18
|
export { default as InputNumber } from './InputNumber';
|
|
18
19
|
export { default as LeftTable } from './LeftTable';
|
|
19
20
|
export { default as LmTable } from './LmTable';
|
|
21
|
+
export { default as LmSelect } from './LmSelect';
|
|
20
22
|
export { default as LoadingPage } from './LoadingPage';
|
|
21
23
|
export { default as Menu } from './Menu';
|
|
22
24
|
export { default as Modal } from './Modal';
|
|
@@ -40,4 +42,5 @@ export { default as Switch } from './Switch';
|
|
|
40
42
|
export { default as Image } from './Image';
|
|
41
43
|
export { default as CustomTableOption } from './CustomTableOption';
|
|
42
44
|
export { default as Upload } from './Upload';
|
|
43
|
-
export { default as Tooltip } from './Tooltip';
|
|
45
|
+
export { default as Tooltip } from './Tooltip';
|
|
46
|
+
export { default as Form } from './Form';
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.default = void 0;
|
|
9
|
+
|
|
10
|
+
require("antd/es/cascader/style");
|
|
11
|
+
|
|
12
|
+
var _cascader = _interopRequireDefault(require("antd/es/cascader"));
|
|
13
|
+
|
|
14
|
+
var _react = _interopRequireDefault(require("react"));
|
|
15
|
+
|
|
16
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
17
|
+
|
|
18
|
+
var __rest = void 0 && (void 0).__rest || function (s, e) {
|
|
19
|
+
var t = {};
|
|
20
|
+
|
|
21
|
+
for (var p in s) {
|
|
22
|
+
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
26
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
27
|
+
}
|
|
28
|
+
return t;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
var prefixCls = 'lm_cascader';
|
|
32
|
+
var prefixDropdownCls = 'lm_cascader_dropdown';
|
|
33
|
+
|
|
34
|
+
var LMCascader = function LMCascader(props) {
|
|
35
|
+
var children = props.children,
|
|
36
|
+
className = props.className,
|
|
37
|
+
dropdownClassName = props.dropdownClassName,
|
|
38
|
+
_props$placeholder = props.placeholder,
|
|
39
|
+
placeholder = _props$placeholder === void 0 ? '请选择' : _props$placeholder,
|
|
40
|
+
others = __rest(props, ["children", "className", "dropdownClassName", "placeholder"]);
|
|
41
|
+
|
|
42
|
+
return /*#__PURE__*/_react.default.createElement(_cascader.default, Object.assign({
|
|
43
|
+
placeholder: placeholder,
|
|
44
|
+
className: (0, _classnames.default)(prefixCls, className),
|
|
45
|
+
dropdownClassName: (0, _classnames.default)(prefixDropdownCls, dropdownClassName)
|
|
46
|
+
}, others));
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
var _default = LMCascader;
|
|
50
|
+
exports.default = _default;
|