@sooloer/pages 0.1.22 → 1.0.0
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/button-group/index.js +19 -15
- package/dist/page/demo/basic.js +57 -0
- package/dist/tab/demo/settingRef.js +18 -6
- package/dist/table/demo/checkbox.js +1 -0
- package/dist/table/index.js +3 -2
- package/dist/table/table/index.js +46 -24
- package/package.json +5 -5
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
2
|
import { EllipsisOutlined } from '@ant-design/icons';
|
|
3
|
-
import { Button, ConfigProvider, Dropdown,
|
|
3
|
+
import { Button, ConfigProvider, Dropdown, Space } from 'antd';
|
|
4
4
|
import React, { useContext, useMemo } from 'react';
|
|
5
5
|
import Style from "./style";
|
|
6
6
|
var ProButton = function ProButton(props) {
|
|
@@ -25,29 +25,33 @@ var ProButton = function ProButton(props) {
|
|
|
25
25
|
}, [buttons]),
|
|
26
26
|
fixedSource = _useMemo.fixedSource,
|
|
27
27
|
moreSource = _useMemo.moreSource;
|
|
28
|
+
var moreMenuItems = useMemo(function () {
|
|
29
|
+
return moreSource.map(function (button) {
|
|
30
|
+
var _ref, _key, _button$buttonProps, _button$buttonProps2, _button$render;
|
|
31
|
+
return {
|
|
32
|
+
key: String((_ref = (_key = (_button$buttonProps = button.buttonProps) === null || _button$buttonProps === void 0 ? void 0 : _button$buttonProps.key) !== null && _key !== void 0 ? _key : (_button$buttonProps2 = button.buttonProps) === null || _button$buttonProps2 === void 0 ? void 0 : _button$buttonProps2.id) !== null && _ref !== void 0 ? _ref : button === null || button === void 0 ? void 0 : button.text),
|
|
33
|
+
label: (_button$render = button.render) !== null && _button$render !== void 0 ? _button$render : /*#__PURE__*/React.createElement(Button, _extends({}, button.buttonProps, {
|
|
34
|
+
type: "link"
|
|
35
|
+
}), button === null || button === void 0 ? void 0 : button.text)
|
|
36
|
+
};
|
|
37
|
+
});
|
|
38
|
+
}, [moreSource]);
|
|
28
39
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Style, {
|
|
29
40
|
prefix: context.getPrefixCls()
|
|
30
41
|
}), /*#__PURE__*/React.createElement("div", {
|
|
31
42
|
className: "sooloer-button-group"
|
|
32
43
|
}, /*#__PURE__*/React.createElement(Space, {
|
|
33
44
|
size: 8
|
|
34
|
-
}, fixedSource.map(function (button
|
|
35
|
-
var _button$
|
|
36
|
-
return (_button$
|
|
37
|
-
key:
|
|
45
|
+
}, fixedSource.map(function (button) {
|
|
46
|
+
var _button$render2, _ref2, _key2, _button$buttonProps3, _button$buttonProps4;
|
|
47
|
+
return (_button$render2 = button.render) !== null && _button$render2 !== void 0 ? _button$render2 : /*#__PURE__*/React.createElement(Button, _extends({
|
|
48
|
+
key: String((_ref2 = (_key2 = (_button$buttonProps3 = button.buttonProps) === null || _button$buttonProps3 === void 0 ? void 0 : _button$buttonProps3.key) !== null && _key2 !== void 0 ? _key2 : (_button$buttonProps4 = button.buttonProps) === null || _button$buttonProps4 === void 0 ? void 0 : _button$buttonProps4.id) !== null && _ref2 !== void 0 ? _ref2 : button === null || button === void 0 ? void 0 : button.text),
|
|
38
49
|
type: type || 'default'
|
|
39
50
|
}, button.buttonProps), button === null || button === void 0 ? void 0 : button.text);
|
|
40
51
|
}), moreSource.length > 0 && /*#__PURE__*/React.createElement(Dropdown, {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
key: index
|
|
45
|
-
}, (_button$render2 = button.render) !== null && _button$render2 !== void 0 ? _button$render2 : /*#__PURE__*/React.createElement(Button, _extends({
|
|
46
|
-
key: index
|
|
47
|
-
}, button.buttonProps, {
|
|
48
|
-
type: "link"
|
|
49
|
-
}), button === null || button === void 0 ? void 0 : button.text));
|
|
50
|
-
})),
|
|
52
|
+
menu: {
|
|
53
|
+
items: moreMenuItems
|
|
54
|
+
},
|
|
51
55
|
placement: "bottom",
|
|
52
56
|
overlayClassName: "sooloer-button-group__dropdown"
|
|
53
57
|
}, /*#__PURE__*/React.createElement(Button, {
|
package/dist/page/demo/basic.js
CHANGED
|
@@ -19,6 +19,55 @@ import { ConfigProvider } from 'antd';
|
|
|
19
19
|
import zhCN from 'antd/lib/locale/zh_CN';
|
|
20
20
|
import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
21
21
|
import { columns, fetchData, total } from "./data";
|
|
22
|
+
var GRADE_SOURCE = [{
|
|
23
|
+
label: '小学',
|
|
24
|
+
options: [{
|
|
25
|
+
label: '一年级',
|
|
26
|
+
value: '1-1'
|
|
27
|
+
}, {
|
|
28
|
+
label: '二年级',
|
|
29
|
+
value: '1-2'
|
|
30
|
+
}, {
|
|
31
|
+
label: '三年级',
|
|
32
|
+
value: '1-3'
|
|
33
|
+
}, {
|
|
34
|
+
label: '四年级',
|
|
35
|
+
value: '1-4'
|
|
36
|
+
}, {
|
|
37
|
+
label: '五年级',
|
|
38
|
+
value: '1-5'
|
|
39
|
+
}, {
|
|
40
|
+
label: '六年级',
|
|
41
|
+
value: '1-6'
|
|
42
|
+
}]
|
|
43
|
+
}, {
|
|
44
|
+
label: '初中',
|
|
45
|
+
options: [{
|
|
46
|
+
label: '五四制六年级',
|
|
47
|
+
value: '2-0'
|
|
48
|
+
}, {
|
|
49
|
+
label: '七年级',
|
|
50
|
+
value: '2-1'
|
|
51
|
+
}, {
|
|
52
|
+
label: '八年级',
|
|
53
|
+
value: '2-2'
|
|
54
|
+
}, {
|
|
55
|
+
label: '九年级',
|
|
56
|
+
value: '2-3'
|
|
57
|
+
}]
|
|
58
|
+
}, {
|
|
59
|
+
label: '高中',
|
|
60
|
+
options: [{
|
|
61
|
+
label: '高一',
|
|
62
|
+
value: '3-1'
|
|
63
|
+
}, {
|
|
64
|
+
label: '高二',
|
|
65
|
+
value: '3-2'
|
|
66
|
+
}, {
|
|
67
|
+
label: '高三',
|
|
68
|
+
value: '3-3'
|
|
69
|
+
}]
|
|
70
|
+
}];
|
|
22
71
|
var initialValues = {
|
|
23
72
|
invoiceNo: '001',
|
|
24
73
|
invoiceCode: '002'
|
|
@@ -45,6 +94,14 @@ var fields = [{
|
|
|
45
94
|
value: 's'
|
|
46
95
|
}]
|
|
47
96
|
}
|
|
97
|
+
}, {
|
|
98
|
+
label: '年级',
|
|
99
|
+
name: 'grad',
|
|
100
|
+
type: 'select',
|
|
101
|
+
widgetProps: {
|
|
102
|
+
allowClear: true,
|
|
103
|
+
options: GRADE_SOURCE
|
|
104
|
+
}
|
|
48
105
|
}];
|
|
49
106
|
var tabs = [{
|
|
50
107
|
key: '1',
|
|
@@ -7,20 +7,32 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
|
7
7
|
import { SettingOutlined } from '@ant-design/icons';
|
|
8
8
|
import { ProTabs } from "../..";
|
|
9
9
|
import React, { useEffect, useRef, useState } from 'react';
|
|
10
|
-
import {
|
|
10
|
+
import { createRoot } from 'react-dom/client';
|
|
11
11
|
export default (function () {
|
|
12
12
|
var _useState = useState('1'),
|
|
13
13
|
_useState2 = _slicedToArray(_useState, 2),
|
|
14
14
|
activeKey = _useState2[0],
|
|
15
15
|
setActiveKey = _useState2[1];
|
|
16
16
|
var nodeRef = useRef(null);
|
|
17
|
-
var
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
var iconRootRef = useRef(null);
|
|
18
|
+
var handleChange = function handleChange(key) {
|
|
19
|
+
console.log(key);
|
|
20
|
+
setActiveKey(key);
|
|
20
21
|
};
|
|
21
22
|
useEffect(function () {
|
|
22
|
-
|
|
23
|
-
|
|
23
|
+
if (!nodeRef.current) {
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
if (!iconRootRef.current) {
|
|
27
|
+
iconRootRef.current = createRoot(nodeRef.current);
|
|
28
|
+
}
|
|
29
|
+
iconRootRef.current.render( /*#__PURE__*/React.createElement(SettingOutlined, null));
|
|
30
|
+
return function () {
|
|
31
|
+
var _iconRootRef$current;
|
|
32
|
+
(_iconRootRef$current = iconRootRef.current) === null || _iconRootRef$current === void 0 || _iconRootRef$current.unmount();
|
|
33
|
+
iconRootRef.current = null;
|
|
34
|
+
};
|
|
35
|
+
}, []);
|
|
24
36
|
var buttonSource = [{
|
|
25
37
|
buttonProps: {
|
|
26
38
|
onClick: function onClick() {
|
package/dist/table/index.js
CHANGED
|
@@ -143,8 +143,9 @@ var ProTable = function ProTable(_ref) {
|
|
|
143
143
|
otherProps.fixed = expandable ? false : otherProps.fixed;
|
|
144
144
|
}
|
|
145
145
|
return {
|
|
146
|
-
rowSelection: _objectSpread(_objectSpread({
|
|
147
|
-
columnWidth: 40
|
|
146
|
+
rowSelection: _objectSpread(_objectSpread({
|
|
147
|
+
columnWidth: 40
|
|
148
|
+
}, otherProps), {}, {
|
|
148
149
|
onSelect: handleSelect,
|
|
149
150
|
selectedRowKeys: _toConsumableArray(keys),
|
|
150
151
|
onSelectAll: handleSelectAll,
|
|
@@ -22,8 +22,8 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
|
|
|
22
22
|
import { sum } from '@tmaito/utils';
|
|
23
23
|
import { Checkbox, Col, ConfigProvider, Row, Table } from 'antd';
|
|
24
24
|
import classnames from 'classnames';
|
|
25
|
-
import React, { useContext, useEffect, useLayoutEffect, useMemo, useState } from 'react';
|
|
26
|
-
import {
|
|
25
|
+
import React, { useContext, useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react';
|
|
26
|
+
import { createRoot } from 'react-dom/client';
|
|
27
27
|
import Setting from "../setting";
|
|
28
28
|
import Style from "./style";
|
|
29
29
|
var ElTable = function ElTable(_ref) {
|
|
@@ -63,6 +63,8 @@ var ElTable = function ElTable(_ref) {
|
|
|
63
63
|
_useState8 = _slicedToArray(_useState7, 2),
|
|
64
64
|
tableHeaderHeight = _useState8[0],
|
|
65
65
|
setTableHeaderHeight = _useState8[1];
|
|
66
|
+
var settingRootRef = useRef(null);
|
|
67
|
+
var settingContainerRef = useRef(null);
|
|
66
68
|
var _useContext = useContext(ConfigProvider.ConfigContext),
|
|
67
69
|
getPrefixCls = _useContext.getPrefixCls;
|
|
68
70
|
useEffect(function () {
|
|
@@ -119,30 +121,50 @@ var ElTable = function ElTable(_ref) {
|
|
|
119
121
|
|
|
120
122
|
// table config 初始化挂载
|
|
121
123
|
useLayoutEffect(function () {
|
|
122
|
-
if (setting) {
|
|
123
|
-
|
|
124
|
-
_args = _objectWithoutProperties(setting, _excluded2);
|
|
125
|
-
var prefixCls = getPrefixCls();
|
|
126
|
-
var node = typeof getContainer === 'string' ? document.querySelector(getContainer) : getContainer;
|
|
127
|
-
if (getContainer) {
|
|
128
|
-
render(
|
|
129
|
-
/*#__PURE__*/
|
|
130
|
-
// @ts-ignore
|
|
131
|
-
React.createElement(Setting, _extends({}, _args, {
|
|
132
|
-
size: size,
|
|
133
|
-
loading: typeof loading === 'boolean' ? loading : loading === null || loading === void 0 ? void 0 : loading.spinning,
|
|
134
|
-
prefixCls: prefixCls,
|
|
135
|
-
columns: sortColumns,
|
|
136
|
-
onReload: function onReload() {
|
|
137
|
-
var _setting$onReload;
|
|
138
|
-
return setting === null || setting === void 0 || (_setting$onReload = setting.onReload) === null || _setting$onReload === void 0 ? void 0 : _setting$onReload.call(setting);
|
|
139
|
-
},
|
|
140
|
-
onSizeChange: setSize,
|
|
141
|
-
onColumnSortChange: handleColumnSortChange
|
|
142
|
-
})), node);
|
|
143
|
-
}
|
|
124
|
+
if (!setting) {
|
|
125
|
+
return;
|
|
144
126
|
}
|
|
127
|
+
var getContainer = setting.getContainer,
|
|
128
|
+
settingArgs = _objectWithoutProperties(setting, _excluded2);
|
|
129
|
+
if (!getContainer) {
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
var node = typeof getContainer === 'string' ? document.querySelector(getContainer) : getContainer;
|
|
133
|
+
if (!node || !(node instanceof Element) && !(node instanceof DocumentFragment)) {
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
136
|
+
var prefixCls = getPrefixCls();
|
|
137
|
+
if (!settingRootRef.current || settingContainerRef.current !== node) {
|
|
138
|
+
var _settingRootRef$curre;
|
|
139
|
+
(_settingRootRef$curre = settingRootRef.current) === null || _settingRootRef$curre === void 0 || _settingRootRef$curre.unmount();
|
|
140
|
+
settingRootRef.current = createRoot(node);
|
|
141
|
+
settingContainerRef.current = node;
|
|
142
|
+
}
|
|
143
|
+
settingRootRef.current.render(
|
|
144
|
+
/*#__PURE__*/
|
|
145
|
+
// @ts-ignore
|
|
146
|
+
React.createElement(Setting, _extends({}, settingArgs, {
|
|
147
|
+
size: size,
|
|
148
|
+
loading: typeof loading === 'boolean' ? loading : loading === null || loading === void 0 ? void 0 : loading.spinning,
|
|
149
|
+
prefixCls: prefixCls,
|
|
150
|
+
columns: sortColumns,
|
|
151
|
+
onReload: function onReload() {
|
|
152
|
+
var _setting$onReload;
|
|
153
|
+
return setting === null || setting === void 0 || (_setting$onReload = setting.onReload) === null || _setting$onReload === void 0 ? void 0 : _setting$onReload.call(setting);
|
|
154
|
+
},
|
|
155
|
+
onSizeChange: setSize,
|
|
156
|
+
onColumnSortChange: handleColumnSortChange
|
|
157
|
+
})));
|
|
158
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
145
159
|
}, [size, sortColumns, setting, getPrefixCls]);
|
|
160
|
+
useEffect(function () {
|
|
161
|
+
return function () {
|
|
162
|
+
var _settingRootRef$curre2;
|
|
163
|
+
(_settingRootRef$curre2 = settingRootRef.current) === null || _settingRootRef$curre2 === void 0 || _settingRootRef$curre2.unmount();
|
|
164
|
+
settingRootRef.current = null;
|
|
165
|
+
settingContainerRef.current = null;
|
|
166
|
+
};
|
|
167
|
+
}, []);
|
|
146
168
|
|
|
147
169
|
// scroll 滚动
|
|
148
170
|
var resetScrollProps = function resetScrollProps() {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sooloer/pages",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"description": "A react library developed with dumi",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"@ant-design/cssinjs": "^1.18.4",
|
|
48
48
|
"@ant-design/icons": "^5.3.0",
|
|
49
49
|
"@tmaito/utils": "^0.4.14",
|
|
50
|
-
"antd": "^
|
|
50
|
+
"antd": "^6.3.1",
|
|
51
51
|
"dayjs": "^1.11.10",
|
|
52
52
|
"mockjs": "^1.1.0",
|
|
53
53
|
"react-sortable-hoc": "^2.0.0",
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
"@types/react-dom": "^18.0.0",
|
|
63
63
|
"@umijs/fabric": "^4.0.1",
|
|
64
64
|
"@umijs/lint": "^4.0.0",
|
|
65
|
-
"dumi": "^2.
|
|
65
|
+
"dumi": "^2.4.23",
|
|
66
66
|
"eslint": "^8.23.0",
|
|
67
67
|
"father": "^4.1.0",
|
|
68
68
|
"husky": "^8.0.1",
|
|
@@ -70,8 +70,8 @@
|
|
|
70
70
|
"prettier": "^2.7.1",
|
|
71
71
|
"prettier-plugin-organize-imports": "^3.0.0",
|
|
72
72
|
"prettier-plugin-packagejson": "^2.2.18",
|
|
73
|
-
"react": "^
|
|
74
|
-
"react-dom": "^
|
|
73
|
+
"react": "^19.1.0",
|
|
74
|
+
"react-dom": "^19.1.0",
|
|
75
75
|
"stylelint": "^14.9.1"
|
|
76
76
|
},
|
|
77
77
|
"peerDependencies": {
|