@sooloer/pages 0.0.1
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/LICENSE +21 -0
- package/README.md +40 -0
- package/dist/button-group/demo/authcode.d.ts +3 -0
- package/dist/button-group/demo/authcode.js +78 -0
- package/dist/button-group/demo/basic.d.ts +3 -0
- package/dist/button-group/demo/basic.js +67 -0
- package/dist/button-group/demo/custom.d.ts +3 -0
- package/dist/button-group/demo/custom.js +50 -0
- package/dist/button-group/demo/link.d.ts +3 -0
- package/dist/button-group/demo/link.js +65 -0
- package/dist/button-group/index.d.ts +4 -0
- package/dist/button-group/index.js +59 -0
- package/dist/button-group/style.d.ts +5 -0
- package/dist/button-group/style.js +11 -0
- package/dist/button-group/typing.d.ts +35 -0
- package/dist/button-group/typing.js +1 -0
- package/dist/filter/components/checkbox/index.d.ts +3 -0
- package/dist/filter/components/checkbox/index.js +32 -0
- package/dist/filter/components/ellipsis-text/index.d.ts +6 -0
- package/dist/filter/components/ellipsis-text/index.js +78 -0
- package/dist/filter/components/field/index.d.ts +7 -0
- package/dist/filter/components/field/index.js +143 -0
- package/dist/filter/components/input-range/index.d.ts +4 -0
- package/dist/filter/components/input-range/index.js +44 -0
- package/dist/filter/components/input-range/type.d.ts +22 -0
- package/dist/filter/components/input-range/type.js +1 -0
- package/dist/filter/components/text-area/index.d.ts +3 -0
- package/dist/filter/components/text-area/index.js +72 -0
- package/dist/filter/components/text-area/index.less +0 -0
- package/dist/filter/demo/basic.d.ts +3 -0
- package/dist/filter/demo/basic.js +35 -0
- package/dist/filter/demo/change-label-width.d.ts +3 -0
- package/dist/filter/demo/change-label-width.js +59 -0
- package/dist/filter/demo/checkbox.d.ts +3 -0
- package/dist/filter/demo/checkbox.js +69 -0
- package/dist/filter/demo/col-span.d.ts +3 -0
- package/dist/filter/demo/col-span.js +52 -0
- package/dist/filter/demo/custom.d.ts +3 -0
- package/dist/filter/demo/custom.js +53 -0
- package/dist/filter/demo/datePicker.d.ts +3 -0
- package/dist/filter/demo/datePicker.js +72 -0
- package/dist/filter/demo/ellipsis.d.ts +3 -0
- package/dist/filter/demo/ellipsis.js +58 -0
- package/dist/filter/demo/expand.d.ts +3 -0
- package/dist/filter/demo/expand.js +79 -0
- package/dist/filter/demo/form-controlled.d.ts +3 -0
- package/dist/filter/demo/form-controlled.js +63 -0
- package/dist/filter/demo/grid-columns.d.ts +3 -0
- package/dist/filter/demo/grid-columns.js +59 -0
- package/dist/filter/demo/hide-action.d.ts +3 -0
- package/dist/filter/demo/hide-action.js +41 -0
- package/dist/filter/demo/initial-value.d.ts +3 -0
- package/dist/filter/demo/initial-value.js +56 -0
- package/dist/filter/demo/input-range.d.ts +3 -0
- package/dist/filter/demo/input-range.js +24 -0
- package/dist/filter/demo/mask.d.ts +3 -0
- package/dist/filter/demo/mask.js +77 -0
- package/dist/filter/demo/radio.d.ts +3 -0
- package/dist/filter/demo/radio.js +69 -0
- package/dist/filter/demo/rangePicker.d.ts +3 -0
- package/dist/filter/demo/rangePicker.js +80 -0
- package/dist/filter/demo/required.d.ts +3 -0
- package/dist/filter/demo/required.js +36 -0
- package/dist/filter/demo/search-advanced.d.ts +3 -0
- package/dist/filter/demo/search-advanced.js +45 -0
- package/dist/filter/demo/search.d.ts +3 -0
- package/dist/filter/demo/search.js +45 -0
- package/dist/filter/demo/set-field.d.ts +3 -0
- package/dist/filter/demo/set-field.js +64 -0
- package/dist/filter/demo/textarea.d.ts +3 -0
- package/dist/filter/demo/textarea.js +42 -0
- package/dist/filter/demo/tooltip.d.ts +3 -0
- package/dist/filter/demo/tooltip.js +36 -0
- package/dist/filter/index.d.ts +5 -0
- package/dist/filter/index.js +406 -0
- package/dist/filter/index.less +84 -0
- package/dist/filter/typing.d.ts +148 -0
- package/dist/filter/typing.js +1 -0
- package/dist/footer/demo/basic.d.ts +3 -0
- package/dist/footer/demo/basic.js +44 -0
- package/dist/footer/demo/right-render.d.ts +3 -0
- package/dist/footer/demo/right-render.js +8 -0
- package/dist/footer/index.d.ts +6 -0
- package/dist/footer/index.js +26 -0
- package/dist/footer/index.less +11 -0
- package/dist/footer/typing.d.ts +17 -0
- package/dist/footer/typing.js +1 -0
- package/dist/index.d.ts +17 -0
- package/dist/index.js +9 -0
- package/dist/page/demo/basic.d.ts +3 -0
- package/dist/page/demo/basic.js +215 -0
- package/dist/page/demo/data.d.ts +16 -0
- package/dist/page/demo/data.js +121 -0
- package/dist/page/demo/renderTable.d.ts +3 -0
- package/dist/page/demo/renderTable.js +209 -0
- package/dist/page/demo/selection.d.ts +3 -0
- package/dist/page/demo/selection.js +229 -0
- package/dist/page/index.d.ts +5 -0
- package/dist/page/index.js +120 -0
- package/dist/page/index.less +35 -0
- package/dist/page/typing.d.ts +68 -0
- package/dist/page/typing.js +1 -0
- package/dist/search-condition/demo/basic.d.ts +3 -0
- package/dist/search-condition/demo/basic.js +35 -0
- package/dist/search-condition/demo/custom.d.ts +3 -0
- package/dist/search-condition/demo/custom.js +35 -0
- package/dist/search-condition/demo/ellipsis.d.ts +3 -0
- package/dist/search-condition/demo/ellipsis.js +30 -0
- package/dist/search-condition/demo/expand.d.ts +3 -0
- package/dist/search-condition/demo/expand.js +46 -0
- package/dist/search-condition/demo/removeable.d.ts +3 -0
- package/dist/search-condition/demo/removeable.js +39 -0
- package/dist/search-condition/index.d.ts +5 -0
- package/dist/search-condition/index.js +226 -0
- package/dist/search-condition/index.less +65 -0
- package/dist/search-condition/typing.d.ts +39 -0
- package/dist/search-condition/typing.js +1 -0
- package/dist/tab/demo/basic.d.ts +3 -0
- package/dist/tab/demo/basic.js +36 -0
- package/dist/tab/demo/count.d.ts +3 -0
- package/dist/tab/demo/count.js +63 -0
- package/dist/tab/demo/extra.d.ts +3 -0
- package/dist/tab/demo/extra.js +70 -0
- package/dist/tab/demo/icon.d.ts +3 -0
- package/dist/tab/demo/icon.js +36 -0
- package/dist/tab/demo/overflowCount.d.ts +3 -0
- package/dist/tab/demo/overflowCount.js +50 -0
- package/dist/tab/demo/settingRef.d.ts +3 -0
- package/dist/tab/demo/settingRef.js +77 -0
- package/dist/tab/demo/slide.d.ts +3 -0
- package/dist/tab/demo/slide.js +98 -0
- package/dist/tab/index.d.ts +5 -0
- package/dist/tab/index.js +51 -0
- package/dist/tab/index.less +11 -0
- package/dist/tab/typing.d.ts +51 -0
- package/dist/tab/typing.js +1 -0
- package/dist/table/demo/basic.d.ts +3 -0
- package/dist/table/demo/basic.js +65 -0
- package/dist/table/demo/checkbox.d.ts +3 -0
- package/dist/table/demo/checkbox.js +75 -0
- package/dist/table/demo/data.d.ts +16 -0
- package/dist/table/demo/data.js +120 -0
- package/dist/table/demo/global-checkbox.d.ts +3 -0
- package/dist/table/demo/global-checkbox.js +83 -0
- package/dist/table/demo/setting.d.ts +3 -0
- package/dist/table/demo/setting.js +78 -0
- package/dist/table/index.d.ts +4 -0
- package/dist/table/index.js +173 -0
- package/dist/table/setting/components/height.d.ts +8 -0
- package/dist/table/setting/components/height.js +45 -0
- package/dist/table/setting/components/reload.d.ts +7 -0
- package/dist/table/setting/components/reload.js +19 -0
- package/dist/table/setting/components/sort-group.d.ts +10 -0
- package/dist/table/setting/components/sort-group.js +103 -0
- package/dist/table/setting/components/sort-item.d.ts +3 -0
- package/dist/table/setting/components/sort-item.js +20 -0
- package/dist/table/setting/components/sort.d.ts +9 -0
- package/dist/table/setting/components/sort.js +105 -0
- package/dist/table/setting/index.d.ts +18 -0
- package/dist/table/setting/index.js +41 -0
- package/dist/table/setting/index.less +33 -0
- package/dist/table/table/index.d.ts +5 -0
- package/dist/table/table/index.js +170 -0
- package/dist/table/table/index.less +35 -0
- package/dist/table/typing.d.ts +92 -0
- package/dist/table/typing.js +1 -0
- package/dist/title/demo/basic.d.ts +3 -0
- package/dist/title/demo/basic.js +35 -0
- package/dist/title/demo/custom.d.ts +3 -0
- package/dist/title/demo/custom.js +15 -0
- package/dist/title/index.d.ts +5 -0
- package/dist/title/index.js +32 -0
- package/dist/title/index.less +39 -0
- package/dist/title/typing.d.ts +22 -0
- package/dist/title/typing.js +10 -0
- package/package.json +86 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) menghan.zhu@outlook.com
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# @sooloer/pages
|
|
2
|
+
|
|
3
|
+
[](https://npmjs.org/package/@sooloer/pages)
|
|
4
|
+
[](https://npmjs.org/package/@sooloer/pages)
|
|
5
|
+
|
|
6
|
+
A react library developed with dumi
|
|
7
|
+
|
|
8
|
+
## Usage
|
|
9
|
+
|
|
10
|
+
TODO
|
|
11
|
+
|
|
12
|
+
## Options
|
|
13
|
+
|
|
14
|
+
TODO
|
|
15
|
+
|
|
16
|
+
## Development
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
# install dependencies
|
|
20
|
+
$ yarn install
|
|
21
|
+
|
|
22
|
+
# develop library by docs demo
|
|
23
|
+
$ yarn start
|
|
24
|
+
|
|
25
|
+
# build library source code
|
|
26
|
+
$ yarn run build
|
|
27
|
+
|
|
28
|
+
# build library source code in watch mode
|
|
29
|
+
$ yarn run build:watch
|
|
30
|
+
|
|
31
|
+
# build docs
|
|
32
|
+
$ yarn run docs:build
|
|
33
|
+
|
|
34
|
+
# check your project for potential problems
|
|
35
|
+
$ yarn run doctor
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## LICENSE
|
|
39
|
+
|
|
40
|
+
MIT
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
2
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
3
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
4
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
5
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
6
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
7
|
+
import { ProButton } from "../..";
|
|
8
|
+
import React from 'react';
|
|
9
|
+
export default (function () {
|
|
10
|
+
var RESOURCE_CODES = ['test-001', 'test-03', 'test-04'];
|
|
11
|
+
var BUTTONS = {
|
|
12
|
+
ADD: {
|
|
13
|
+
code: 'test-01',
|
|
14
|
+
button: {
|
|
15
|
+
buttonProps: {
|
|
16
|
+
type: 'primary',
|
|
17
|
+
onClick: function onClick() {
|
|
18
|
+
console.log('新增');
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
fixed: true,
|
|
22
|
+
text: '新增'
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
EDIT: {
|
|
26
|
+
code: 'test-02',
|
|
27
|
+
button: {
|
|
28
|
+
buttonProps: {
|
|
29
|
+
type: 'primary',
|
|
30
|
+
onClick: function onClick() {
|
|
31
|
+
console.log('修改');
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
fixed: true,
|
|
35
|
+
text: '修改'
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
DELETE: {
|
|
39
|
+
code: 'test-03',
|
|
40
|
+
button: {
|
|
41
|
+
buttonProps: {
|
|
42
|
+
type: 'danger',
|
|
43
|
+
onClick: function onClick() {
|
|
44
|
+
console.log('删除');
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
fixed: true,
|
|
48
|
+
text: '删除'
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
UPLOAD: {
|
|
52
|
+
code: 'test-04',
|
|
53
|
+
button: {
|
|
54
|
+
buttonProps: {
|
|
55
|
+
onClick: function onClick() {
|
|
56
|
+
console.log('上传');
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
fixed: true,
|
|
60
|
+
text: '上传'
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
var buttonRender = function buttonRender() {
|
|
65
|
+
return Object.keys(BUTTONS)
|
|
66
|
+
// @ts-ignore
|
|
67
|
+
.map(function (key) {
|
|
68
|
+
return BUTTONS[key];
|
|
69
|
+
}).filter(function (item) {
|
|
70
|
+
return RESOURCE_CODES.includes(item.code);
|
|
71
|
+
}).map(function (item) {
|
|
72
|
+
return item.button;
|
|
73
|
+
});
|
|
74
|
+
};
|
|
75
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(ProButton, {
|
|
76
|
+
buttons: _toConsumableArray(buttonRender())
|
|
77
|
+
}));
|
|
78
|
+
});
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { ProButton } from "../..";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
export default (function () {
|
|
4
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(ProButton, {
|
|
5
|
+
buttons: [{
|
|
6
|
+
buttonProps: {
|
|
7
|
+
onClick: function onClick() {
|
|
8
|
+
console.log('上传');
|
|
9
|
+
}
|
|
10
|
+
},
|
|
11
|
+
fixed: true,
|
|
12
|
+
text: '上传'
|
|
13
|
+
}, {
|
|
14
|
+
buttonProps: {
|
|
15
|
+
type: 'primary',
|
|
16
|
+
onClick: function onClick() {
|
|
17
|
+
console.log('修改');
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
fixed: true,
|
|
21
|
+
text: '修改'
|
|
22
|
+
}, {
|
|
23
|
+
buttonProps: {
|
|
24
|
+
type: 'primary',
|
|
25
|
+
danger: true,
|
|
26
|
+
onClick: function onClick() {
|
|
27
|
+
console.log('删除');
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
fixed: true,
|
|
31
|
+
text: '删除'
|
|
32
|
+
}]
|
|
33
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
34
|
+
style: {
|
|
35
|
+
marginTop: '24px'
|
|
36
|
+
}
|
|
37
|
+
}), /*#__PURE__*/React.createElement(ProButton, {
|
|
38
|
+
type: "link",
|
|
39
|
+
buttons: [{
|
|
40
|
+
buttonProps: {
|
|
41
|
+
onClick: function onClick() {
|
|
42
|
+
console.log('上传');
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
fixed: true,
|
|
46
|
+
text: '上传'
|
|
47
|
+
}, {
|
|
48
|
+
buttonProps: {
|
|
49
|
+
onClick: function onClick() {
|
|
50
|
+
console.log('修改');
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
fixed: true,
|
|
54
|
+
text: '修改'
|
|
55
|
+
}, {
|
|
56
|
+
buttonProps: {
|
|
57
|
+
type: 'text',
|
|
58
|
+
danger: true,
|
|
59
|
+
onClick: function onClick() {
|
|
60
|
+
console.log('删除');
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
fixed: true,
|
|
64
|
+
text: '删除'
|
|
65
|
+
}]
|
|
66
|
+
}));
|
|
67
|
+
});
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { ProButton } from "../..";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
export default (function () {
|
|
4
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(ProButton, {
|
|
5
|
+
buttons: [{
|
|
6
|
+
buttonProps: {
|
|
7
|
+
type: 'primary',
|
|
8
|
+
onClick: function onClick() {
|
|
9
|
+
console.log('修改');
|
|
10
|
+
}
|
|
11
|
+
},
|
|
12
|
+
fixed: true,
|
|
13
|
+
text: '修改'
|
|
14
|
+
}, {
|
|
15
|
+
fixed: true,
|
|
16
|
+
render: /*#__PURE__*/React.createElement("span", null, "\u81EA\u5B9A\u4E49\u6309\u94AE\u4E00")
|
|
17
|
+
}, {
|
|
18
|
+
fixed: true,
|
|
19
|
+
render: /*#__PURE__*/React.createElement("span", null, "\u81EA\u5B9A\u4E49\u6309\u94AE\u4E8C")
|
|
20
|
+
}, {
|
|
21
|
+
render: /*#__PURE__*/React.createElement("span", null, "\u81EA\u5B9A\u4E49\u6309\u94AE\u4E09")
|
|
22
|
+
}]
|
|
23
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
24
|
+
style: {
|
|
25
|
+
marginTop: '24px'
|
|
26
|
+
}
|
|
27
|
+
}), /*#__PURE__*/React.createElement(ProButton, {
|
|
28
|
+
type: "link",
|
|
29
|
+
buttons: [{
|
|
30
|
+
fixed: true,
|
|
31
|
+
text: '查看详情'
|
|
32
|
+
}, {
|
|
33
|
+
fixed: true,
|
|
34
|
+
render: /*#__PURE__*/React.createElement("span", null, "\u81EA\u5B9A\u4E49\u6309\u94AE\u4E00")
|
|
35
|
+
}, {
|
|
36
|
+
fixed: true,
|
|
37
|
+
render: /*#__PURE__*/React.createElement("span", {
|
|
38
|
+
onClick: function onClick() {
|
|
39
|
+
console.log('自定义按钮二');
|
|
40
|
+
}
|
|
41
|
+
}, "\u81EA\u5B9A\u4E49\u6309\u94AE\u4E8C")
|
|
42
|
+
}, {
|
|
43
|
+
render: /*#__PURE__*/React.createElement("span", {
|
|
44
|
+
onClick: function onClick() {
|
|
45
|
+
console.log('自定义按钮三');
|
|
46
|
+
}
|
|
47
|
+
}, "\u81EA\u5B9A\u4E49\u6309\u94AE\u4E09")
|
|
48
|
+
}]
|
|
49
|
+
}));
|
|
50
|
+
});
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { ProButton } from "../..";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
export default (function () {
|
|
4
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(ProButton, {
|
|
5
|
+
buttons: [{
|
|
6
|
+
buttonProps: {
|
|
7
|
+
type: 'primary',
|
|
8
|
+
onClick: function onClick() {
|
|
9
|
+
console.log('修改');
|
|
10
|
+
}
|
|
11
|
+
},
|
|
12
|
+
fixed: true,
|
|
13
|
+
text: '修改'
|
|
14
|
+
}, {
|
|
15
|
+
buttonProps: {
|
|
16
|
+
type: 'primary',
|
|
17
|
+
danger: true,
|
|
18
|
+
onClick: function onClick() {
|
|
19
|
+
console.log('删除');
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
fixed: true,
|
|
23
|
+
text: '删除'
|
|
24
|
+
}, {
|
|
25
|
+
buttonProps: {
|
|
26
|
+
onClick: function onClick() {
|
|
27
|
+
console.log('上传');
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
text: '上传'
|
|
31
|
+
}]
|
|
32
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
33
|
+
style: {
|
|
34
|
+
marginTop: '24px'
|
|
35
|
+
}
|
|
36
|
+
}), /*#__PURE__*/React.createElement(ProButton, {
|
|
37
|
+
type: "link",
|
|
38
|
+
buttons: [{
|
|
39
|
+
buttonProps: {
|
|
40
|
+
onClick: function onClick() {
|
|
41
|
+
console.log('修改');
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
fixed: true,
|
|
45
|
+
text: '修改'
|
|
46
|
+
}, {
|
|
47
|
+
buttonProps: {
|
|
48
|
+
type: 'text',
|
|
49
|
+
danger: true,
|
|
50
|
+
onClick: function onClick() {
|
|
51
|
+
console.log('删除');
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
fixed: true,
|
|
55
|
+
text: '删除'
|
|
56
|
+
}, {
|
|
57
|
+
buttonProps: {
|
|
58
|
+
onClick: function onClick() {
|
|
59
|
+
console.log('上传');
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
text: '上传'
|
|
63
|
+
}]
|
|
64
|
+
}));
|
|
65
|
+
});
|
|
@@ -0,0 +1,59 @@
|
|
|
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
|
+
import { EllipsisOutlined } from '@ant-design/icons';
|
|
3
|
+
import { Button, ConfigProvider, Dropdown, Menu, Space } from 'antd';
|
|
4
|
+
import React, { useContext, useMemo } from 'react';
|
|
5
|
+
import Style from "./style";
|
|
6
|
+
var ProButton = function ProButton(props) {
|
|
7
|
+
var type = props.type,
|
|
8
|
+
_props$buttons = props.buttons,
|
|
9
|
+
buttons = _props$buttons === void 0 ? [] : _props$buttons;
|
|
10
|
+
var context = useContext(ConfigProvider.ConfigContext);
|
|
11
|
+
var _useMemo = useMemo(function () {
|
|
12
|
+
var fixeds = [];
|
|
13
|
+
var mores = [];
|
|
14
|
+
buttons.forEach(function (item) {
|
|
15
|
+
if (item !== null && item !== void 0 && item.fixed) {
|
|
16
|
+
fixeds.push(item);
|
|
17
|
+
} else {
|
|
18
|
+
mores.push(item);
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
return {
|
|
22
|
+
fixedSource: [].concat(fixeds),
|
|
23
|
+
moreSource: [].concat(mores)
|
|
24
|
+
};
|
|
25
|
+
}, [buttons]),
|
|
26
|
+
fixedSource = _useMemo.fixedSource,
|
|
27
|
+
moreSource = _useMemo.moreSource;
|
|
28
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Style, {
|
|
29
|
+
prefix: context.getPrefixCls()
|
|
30
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
31
|
+
className: "sooloer-button-group"
|
|
32
|
+
}, /*#__PURE__*/React.createElement(Space, {
|
|
33
|
+
size: 8
|
|
34
|
+
}, fixedSource.map(function (button, index) {
|
|
35
|
+
var _button$render;
|
|
36
|
+
return (_button$render = button.render) !== null && _button$render !== void 0 ? _button$render : /*#__PURE__*/React.createElement(Button, _extends({
|
|
37
|
+
key: index,
|
|
38
|
+
type: type || 'default'
|
|
39
|
+
}, button.buttonProps), button === null || button === void 0 ? void 0 : button.text);
|
|
40
|
+
}), moreSource.length > 0 && /*#__PURE__*/React.createElement(Dropdown, {
|
|
41
|
+
overlay: /*#__PURE__*/React.createElement(Menu, null, moreSource.map(function (button, index) {
|
|
42
|
+
var _button$render2;
|
|
43
|
+
return /*#__PURE__*/React.createElement(Menu.Item, {
|
|
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
|
+
})),
|
|
51
|
+
placement: "bottom",
|
|
52
|
+
overlayClassName: "sooloer-button-group__dropdown"
|
|
53
|
+
}, /*#__PURE__*/React.createElement(Button, {
|
|
54
|
+
className: "sooloer-button-group-ellipsis",
|
|
55
|
+
type: type || 'default',
|
|
56
|
+
size: type === 'link' ? 'small' : 'middle'
|
|
57
|
+
}, /*#__PURE__*/React.createElement(EllipsisOutlined, null))))));
|
|
58
|
+
};
|
|
59
|
+
export default ProButton;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { createGlobalStyle } from 'styled-components';
|
|
2
|
+
var Style = createGlobalStyle([".sooloer-button-group{display:inline-block;.ellipsis{cursor:pointer;}.", "-space-item{.", "-btn-link,.", "-btn-text{padding-left:0;padding-right:0;&:hover,&:active{background:transparent;}}}&__dropdown{.", "-dropdown-menu-title-content{min-width:80px;text-align:center;}button{width:100%;padding:0;height:auto;line-height:initial;background:0 0 !important;border-color:transparent !important;box-shadow:none !important;}}}"], function (props) {
|
|
3
|
+
return props.prefix;
|
|
4
|
+
}, function (props) {
|
|
5
|
+
return props.prefix;
|
|
6
|
+
}, function (props) {
|
|
7
|
+
return props.prefix;
|
|
8
|
+
}, function (props) {
|
|
9
|
+
return props.prefix;
|
|
10
|
+
});
|
|
11
|
+
export default Style;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type React from 'react';
|
|
2
|
+
export type ProButtonItemProps = {
|
|
3
|
+
/**
|
|
4
|
+
* @description button 组件相关扩展属性
|
|
5
|
+
*/
|
|
6
|
+
buttonProps?: Record<string, unknown>;
|
|
7
|
+
/**
|
|
8
|
+
* 是否固定展示
|
|
9
|
+
* @default: false
|
|
10
|
+
*/
|
|
11
|
+
fixed?: boolean;
|
|
12
|
+
/**
|
|
13
|
+
* button 按钮文案
|
|
14
|
+
*/
|
|
15
|
+
text?: string;
|
|
16
|
+
/**
|
|
17
|
+
* 自定义按钮,buttonProps text 属性失效
|
|
18
|
+
*/
|
|
19
|
+
render?: React.ReactNode;
|
|
20
|
+
};
|
|
21
|
+
export type ProButtonsProps = {
|
|
22
|
+
/**
|
|
23
|
+
* @description 按钮类型
|
|
24
|
+
* @default ''
|
|
25
|
+
*/
|
|
26
|
+
type?: 'link' | '';
|
|
27
|
+
/**
|
|
28
|
+
* @description button 集合
|
|
29
|
+
*/
|
|
30
|
+
buttons?: ProButtonItemProps[];
|
|
31
|
+
/**
|
|
32
|
+
* @description 定义主题
|
|
33
|
+
*/
|
|
34
|
+
theme?: Record<string, unknown>;
|
|
35
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { Checkbox } from 'antd';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
var ProCheckbox = function ProCheckbox(props) {
|
|
4
|
+
var onChange = props.onChange,
|
|
5
|
+
_props$options = props.options,
|
|
6
|
+
options = _props$options === void 0 ? [] : _props$options,
|
|
7
|
+
optionRender = props.optionRender;
|
|
8
|
+
var value = Array.isArray(props.value) ? props.value : [];
|
|
9
|
+
var handleChange = function handleChange(e) {
|
|
10
|
+
var checked = e.target.checked;
|
|
11
|
+
onChange === null || onChange === void 0 || onChange(checked ? options.map(function (item) {
|
|
12
|
+
return item.value;
|
|
13
|
+
}) : []);
|
|
14
|
+
};
|
|
15
|
+
var handleGroupChange = function handleGroupChange(checkedValues) {
|
|
16
|
+
onChange === null || onChange === void 0 || onChange(checkedValues);
|
|
17
|
+
};
|
|
18
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Checkbox, {
|
|
19
|
+
onChange: handleChange,
|
|
20
|
+
checked: value.length === options.length,
|
|
21
|
+
indeterminate: !!value.length && value.length !== options.length
|
|
22
|
+
}, "\u5168\u90E8"), /*#__PURE__*/React.createElement(Checkbox.Group, {
|
|
23
|
+
value: value,
|
|
24
|
+
onChange: handleGroupChange
|
|
25
|
+
}, options.map(function (item) {
|
|
26
|
+
return optionRender ? optionRender(item) : /*#__PURE__*/React.createElement(Checkbox, {
|
|
27
|
+
key: item.value,
|
|
28
|
+
value: item.value
|
|
29
|
+
}, item.label);
|
|
30
|
+
})));
|
|
31
|
+
};
|
|
32
|
+
export default ProCheckbox;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
2
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
3
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
4
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
5
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
6
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
7
|
+
import { Tooltip } from 'antd';
|
|
8
|
+
import classnames from 'classnames';
|
|
9
|
+
import React, { useEffect, useRef, useState } from 'react';
|
|
10
|
+
import styled from 'styled-components';
|
|
11
|
+
var StyledWrapper = styled.div.withConfig({
|
|
12
|
+
displayName: "StyledWrapper",
|
|
13
|
+
componentId: "pages-6b5d__sc-1hxw96s-0"
|
|
14
|
+
})(["position:relative;display:block;box-sizing:border-box;width:100%;color:inherit;font-size:14px;.is-cursor{cursor:pointer;}"]);
|
|
15
|
+
var StyledContent = styled.div.withConfig({
|
|
16
|
+
displayName: "StyledContent",
|
|
17
|
+
componentId: "pages-6b5d__sc-1hxw96s-1"
|
|
18
|
+
})(["overflow:hidden;white-space:nowrap;text-overflow:ellipsis;"]);
|
|
19
|
+
var StyledHiddenLabel = styled.div.withConfig({
|
|
20
|
+
displayName: "StyledHiddenLabel",
|
|
21
|
+
componentId: "pages-6b5d__sc-1hxw96s-2"
|
|
22
|
+
})(["position:absolute;top:0;left:0;z-index:-1;width:100%;height:100%;visibility:hidden;opacity:0;.label-ellipsis__hidden-inner{display:inline-block;}"]);
|
|
23
|
+
var EllipsisText = function EllipsisText(props) {
|
|
24
|
+
var content = props.content,
|
|
25
|
+
width = props.width;
|
|
26
|
+
var _useState = useState(false),
|
|
27
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
28
|
+
visible = _useState2[0],
|
|
29
|
+
setVisible = _useState2[1];
|
|
30
|
+
var _useState3 = useState(false),
|
|
31
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
32
|
+
hasEllipsis = _useState4[0],
|
|
33
|
+
setEllipsis = _useState4[1];
|
|
34
|
+
var hiddenTextRef = useRef(null);
|
|
35
|
+
useEffect(function () {
|
|
36
|
+
setTimeout(function () {
|
|
37
|
+
if (content) {
|
|
38
|
+
var _ref = hiddenTextRef.current || {
|
|
39
|
+
clientWidth: 0
|
|
40
|
+
},
|
|
41
|
+
clientWidth = _ref.clientWidth;
|
|
42
|
+
console.log('clientWidth', clientWidth, width, clientWidth - width);
|
|
43
|
+
setEllipsis(clientWidth > width);
|
|
44
|
+
}
|
|
45
|
+
}, 0);
|
|
46
|
+
}, [content, width]);
|
|
47
|
+
var handleVisibleChange = function handleVisibleChange(visible) {
|
|
48
|
+
if (hasEllipsis) {
|
|
49
|
+
setVisible(visible);
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
return /*#__PURE__*/React.createElement(StyledWrapper, {
|
|
53
|
+
className: "label-ellipsis",
|
|
54
|
+
style: {
|
|
55
|
+
maxWidth: width
|
|
56
|
+
}
|
|
57
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
58
|
+
className: "label-ellipsis__content"
|
|
59
|
+
}, /*#__PURE__*/React.createElement(Tooltip, {
|
|
60
|
+
arrowContent: true,
|
|
61
|
+
title: content,
|
|
62
|
+
open: visible,
|
|
63
|
+
onOpenChange: handleVisibleChange
|
|
64
|
+
}, /*#__PURE__*/React.createElement(StyledContent, {
|
|
65
|
+
className: classnames('is-ellipsis', {
|
|
66
|
+
'is-cursor': hasEllipsis
|
|
67
|
+
}),
|
|
68
|
+
style: {
|
|
69
|
+
width: hasEllipsis ? width : 'auto'
|
|
70
|
+
}
|
|
71
|
+
}, content))), /*#__PURE__*/React.createElement(StyledHiddenLabel, {
|
|
72
|
+
className: "label-ellipsis__hidden"
|
|
73
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
74
|
+
className: "label-ellipsis__hidden-inner",
|
|
75
|
+
ref: hiddenTextRef
|
|
76
|
+
}, content)));
|
|
77
|
+
};
|
|
78
|
+
export default EllipsisText;
|