@lemon-fe/components 0.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.
Files changed (91) hide show
  1. package/README.md +11 -0
  2. package/es/Actions/index.d.ts +25 -0
  3. package/es/Actions/index.js +164 -0
  4. package/es/Actions/index.less +82 -0
  5. package/es/BaseTable/BaseTableContext.d.ts +6 -0
  6. package/es/BaseTable/BaseTableContext.js +6 -0
  7. package/es/BaseTable/ResizeHeaderCell.d.ts +8 -0
  8. package/es/BaseTable/ResizeHeaderCell.js +115 -0
  9. package/es/BaseTable/Sort.d.ts +10 -0
  10. package/es/BaseTable/Sort.js +122 -0
  11. package/es/BaseTable/VirtualBody.d.ts +8 -0
  12. package/es/BaseTable/VirtualBody.js +165 -0
  13. package/es/BaseTable/index.d.ts +7 -0
  14. package/es/BaseTable/index.js +371 -0
  15. package/es/BaseTable/index.less +103 -0
  16. package/es/BaseTable/typings.d.ts +32 -0
  17. package/es/BaseTable/utils.d.ts +4 -0
  18. package/es/BaseTable/utils.js +26 -0
  19. package/es/DurationPicker/index.d.ts +26 -0
  20. package/es/DurationPicker/index.js +234 -0
  21. package/es/DurationPicker/index.less +63 -0
  22. package/es/EditableTable/EditableCell.d.ts +11 -0
  23. package/es/EditableTable/EditableCell.js +37 -0
  24. package/es/EditableTable/EditableTableFormItem.d.ts +6 -0
  25. package/es/EditableTable/EditableTableFormItem.js +49 -0
  26. package/es/EditableTable/Table.d.ts +7 -0
  27. package/es/EditableTable/Table.js +363 -0
  28. package/es/EditableTable/index.d.ts +9 -0
  29. package/es/EditableTable/index.js +8 -0
  30. package/es/EditableTable/index.less +19 -0
  31. package/es/EditableTable/typings.d.ts +86 -0
  32. package/es/EditableTable/util.d.ts +25 -0
  33. package/es/EditableTable/util.js +387 -0
  34. package/es/Filter/index.d.ts +7 -0
  35. package/es/Filter/index.js +469 -0
  36. package/es/Filter/index.less +77 -0
  37. package/es/Filter/typings.d.ts +27 -0
  38. package/es/FormLayout/index.d.ts +32 -0
  39. package/es/FormLayout/index.js +41 -0
  40. package/es/FormLayout/index.less +89 -0
  41. package/es/Icons/DarkSearch.d.ts +5 -0
  42. package/es/Icons/DarkSearch.js +38 -0
  43. package/es/Icons/Down.d.ts +5 -0
  44. package/es/Icons/Down.js +30 -0
  45. package/es/Icons/Empty.d.ts +2 -0
  46. package/es/Icons/Empty.js +267 -0
  47. package/es/Icons/Search.d.ts +5 -0
  48. package/es/Icons/Search.js +39 -0
  49. package/es/Icons/Tip.d.ts +6 -0
  50. package/es/Icons/Tip.js +169 -0
  51. package/es/Icons/index.d.ts +12 -0
  52. package/es/Icons/index.js +13 -0
  53. package/es/InputMaxLength/index.d.ts +14 -0
  54. package/es/InputMaxLength/index.js +92 -0
  55. package/es/InputMaxLength/index.less +8 -0
  56. package/es/Layout/index.d.ts +21 -0
  57. package/es/Layout/index.js +35 -0
  58. package/es/Layout/index.less +92 -0
  59. package/es/PageLoading/index.d.ts +5 -0
  60. package/es/PageLoading/index.js +15 -0
  61. package/es/PageLoading/index.less +10 -0
  62. package/es/Popup/index.d.ts +27 -0
  63. package/es/Popup/index.js +191 -0
  64. package/es/Popup/index.less +14 -0
  65. package/es/Section/index.d.ts +54 -0
  66. package/es/Section/index.js +111 -0
  67. package/es/Section/index.less +177 -0
  68. package/es/SiderTree/TreeNodeTitle.d.ts +9 -0
  69. package/es/SiderTree/TreeNodeTitle.js +124 -0
  70. package/es/SiderTree/index.d.ts +35 -0
  71. package/es/SiderTree/index.js +237 -0
  72. package/es/SiderTree/index.less +170 -0
  73. package/es/SiderTree/typings.d.ts +19 -0
  74. package/es/Table/index.d.ts +3 -0
  75. package/es/Table/index.js +224 -0
  76. package/es/Table/index.less +1 -0
  77. package/es/Table/typings.d.ts +26 -0
  78. package/es/Table/utils.d.ts +2 -0
  79. package/es/Table/utils.js +3 -0
  80. package/es/TipMark/index.d.ts +10 -0
  81. package/es/TipMark/index.js +45 -0
  82. package/es/TipMark/index.less +8 -0
  83. package/es/constants.d.ts +1 -0
  84. package/es/constants.js +1 -0
  85. package/es/index.d.ts +21 -0
  86. package/es/index.js +17 -0
  87. package/es/index.less +50 -0
  88. package/es/init.d.ts +3 -0
  89. package/es/init.js +100 -0
  90. package/es/theme.less +13 -0
  91. package/package.json +43 -0
@@ -0,0 +1,26 @@
1
+ import { PaginationProps } from 'antd';
2
+ import type { SortOrder } from 'antd/lib/table/interface';
3
+ import type { Key, RefObject } from 'react';
4
+ import type { BaseTableProps } from '../BaseTable/typings';
5
+
6
+ export interface TableRef<RecordType = any> {
7
+ fetch: (page?: number) => void;
8
+ refresh: () => void;
9
+ }
10
+
11
+ export interface SortType {
12
+ field: Key | readonly Key[];
13
+ order: SortOrder;
14
+ }
15
+
16
+ export interface TableProps<RecordType> extends BaseTableProps<RecordType> {
17
+ fetch?: (params: { current: number; pageSize: number; sort: SortType[] }) => Promise<{
18
+ data: RecordType[];
19
+ summary?: RecordType;
20
+ total: number;
21
+ }>;
22
+ autoLoad?: boolean;
23
+ actionRef?: RefObject<TableRef<RecordType>>;
24
+ onLoading?: (loading: boolean) => void;
25
+ pagination?: PaginationProps;
26
+ }
@@ -0,0 +1,2 @@
1
+ import { SortType } from './typings';
2
+ export declare function isSortValue(data: Partial<SortType>): data is SortType;
@@ -0,0 +1,3 @@
1
+ export function isSortValue(data) {
2
+ return data.order !== null && data.order !== undefined;
3
+ }
@@ -0,0 +1,10 @@
1
+ import type { ReactNode } from 'react';
2
+ import { TooltipProps, TooltipPlacement } from 'antd/lib/tooltip';
3
+ interface TipMarkProps extends Omit<TooltipProps, 'placement'> {
4
+ infoContent: string | ReactNode;
5
+ prefixCls?: string;
6
+ mode?: string;
7
+ placement?: TooltipPlacement;
8
+ }
9
+ declare const TipMark: ({ prefixCls, infoContent, mode, placement, ...props }: TipMarkProps) => JSX.Element;
10
+ export default TipMark;
@@ -0,0 +1,45 @@
1
+ var _excluded = ["prefixCls", "infoContent", "mode", "placement"];
2
+
3
+ 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; }
4
+
5
+ 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; }
6
+
7
+ 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; }
8
+
9
+ function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
10
+
11
+ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
12
+
13
+ import React from 'react';
14
+ import { QuestionCircleFilled } from '@ant-design/icons';
15
+ import { Tooltip, Popover } from 'antd';
16
+ import { PREFIX_CLS } from '../constants';
17
+
18
+ var TipMark = function TipMark(_ref) {
19
+ var _ref$prefixCls = _ref.prefixCls,
20
+ prefixCls = _ref$prefixCls === void 0 ? PREFIX_CLS : _ref$prefixCls,
21
+ infoContent = _ref.infoContent,
22
+ _ref$mode = _ref.mode,
23
+ mode = _ref$mode === void 0 ? 'toolTip' : _ref$mode,
24
+ _ref$placement = _ref.placement,
25
+ placement = _ref$placement === void 0 ? 'bottom' : _ref$placement,
26
+ props = _objectWithoutProperties(_ref, _excluded);
27
+
28
+ if (mode === 'toolTip') {
29
+ return /*#__PURE__*/React.createElement(Tooltip, _objectSpread({
30
+ title: infoContent,
31
+ placement: placement
32
+ }, props), /*#__PURE__*/React.createElement(QuestionCircleFilled, {
33
+ className: "".concat(prefixCls, "-tip-mark-questionIcon")
34
+ }));
35
+ }
36
+
37
+ return /*#__PURE__*/React.createElement(Popover, _objectSpread({
38
+ content: infoContent,
39
+ placement: placement
40
+ }, props), /*#__PURE__*/React.createElement(QuestionCircleFilled, {
41
+ className: "".concat(prefixCls, "-tip-mark-questionIcon")
42
+ }));
43
+ };
44
+
45
+ export default TipMark;
@@ -0,0 +1,8 @@
1
+ @import '../theme.less';
2
+
3
+ .@{prefixCls}-tip-mark-questionIcon {
4
+ margin-left: 4px;
5
+ color: rgb(192, 196, 204);
6
+ font-size: 14px;
7
+ cursor: pointer;
8
+ }
@@ -0,0 +1 @@
1
+ export declare const PREFIX_CLS = "lemon";
@@ -0,0 +1 @@
1
+ export var PREFIX_CLS = 'lemon';
package/es/index.d.ts ADDED
@@ -0,0 +1,21 @@
1
+ export { default as PageLoading } from './PageLoading';
2
+ export { default as Actions } from './Actions';
3
+ export { default as Filter } from './Filter';
4
+ export type { FilterItemType } from './Filter/typings';
5
+ export { default as BaseTable } from './BaseTable';
6
+ export type { BaseTableProps, ColumnType, ColumnsType } from './BaseTable/typings';
7
+ export { default as Section } from './Section';
8
+ export { default as Layout } from './Layout';
9
+ export { default as Table } from './Table';
10
+ export type { TableProps, TableRef } from './Table/typings';
11
+ export { default as DurationPicker } from './DurationPicker';
12
+ export { default as InputMaxLength } from './InputMaxLength';
13
+ export { default as TipMark } from './TipMark';
14
+ export { default as EditableTable } from './EditableTable';
15
+ export type { EditableTableProps, EditableTableColumnType, EditableCellFocusedType, EditableTableRef, EditableTableRule, } from './EditableTable/typings';
16
+ export { default as Popup } from './Popup';
17
+ export { default as SiderTree } from './SiderTree';
18
+ export { default as Icons } from './Icons';
19
+ export { default as FormLayout } from './FormLayout';
20
+ export { default as init } from './init';
21
+ export * from './constants';
package/es/index.js ADDED
@@ -0,0 +1,17 @@
1
+ export { default as PageLoading } from './PageLoading';
2
+ export { default as Actions } from './Actions';
3
+ export { default as Filter } from './Filter';
4
+ export { default as BaseTable } from './BaseTable';
5
+ export { default as Section } from './Section';
6
+ export { default as Layout } from './Layout';
7
+ export { default as Table } from './Table';
8
+ export { default as DurationPicker } from './DurationPicker';
9
+ export { default as InputMaxLength } from './InputMaxLength';
10
+ export { default as TipMark } from './TipMark';
11
+ export { default as EditableTable } from './EditableTable';
12
+ export { default as Popup } from './Popup';
13
+ export { default as SiderTree } from './SiderTree';
14
+ export { default as Icons } from './Icons';
15
+ export { default as FormLayout } from './FormLayout';
16
+ export { default as init } from './init';
17
+ export * from './constants';
package/es/index.less ADDED
@@ -0,0 +1,50 @@
1
+ @import './Actions/index.less';
2
+ @import './Layout/index.less';
3
+ @import './Section/index.less';
4
+ @import './BaseTable/index.less';
5
+ @import './Filter/index.less';
6
+ @import './Table/index.less';
7
+ @import './DurationPicker/index.less';
8
+ @import './InputMaxLength/index.less';
9
+ @import './TipMark/index.less';
10
+ @import './Popup/index.less';
11
+ @import './SiderTree/index.less';
12
+ @import './FormLayout/index.less';
13
+ @import './EditableTable/index.less';
14
+ @import './PageLoading/index.less';
15
+ @import '~antd/dist/antd.variable.less';
16
+
17
+ @blue-base: #2357df;
18
+
19
+ /** basic */
20
+
21
+ @height-base: 32px;
22
+ @border-color-base: #c0c0c0;
23
+ @label-color: #464646;
24
+
25
+ /** table */
26
+
27
+ @table-header-bg: #f0f0f0;
28
+ @table-header-color: rgba(51, 51, 51, 0.65);
29
+ @table-padding-vertical: 14px;
30
+ @table-border-color: rgba(0, 0, 0, 0.04);
31
+
32
+ .ant-modal-confirm-body-wrapper .ant-modal-confirm-body .ant-modal-confirm-content {
33
+ color: rgba(0, 0, 0, 0.65);
34
+ }
35
+
36
+ .ant-pagination-item-active {
37
+ background: @primary-color;
38
+
39
+ a {
40
+ color: #fff;
41
+ }
42
+
43
+ &:hover a {
44
+ color: #fff;
45
+ }
46
+ }
47
+
48
+ a[title='站长统计'] {
49
+ display: none;
50
+ }
package/es/init.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ export default function init(opts?: {
2
+ enableCNZZ?: boolean;
3
+ }): void;
package/es/init.js ADDED
@@ -0,0 +1,100 @@
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
+
3
+ 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; }
4
+
5
+ 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; }
6
+
7
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
8
+
9
+ import React from 'react';
10
+ import Icons from './Icons';
11
+ import { message, Modal, Empty, Select } from 'antd';
12
+ var Tip = Icons.Tip,
13
+ EmptyIcon = Icons.Empty,
14
+ Down = Icons.Down;
15
+ export default function init() {
16
+ var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
17
+
18
+ // 添加站长统计
19
+ if (opts.enableCNZZ) {
20
+ var node = document.createElement('script');
21
+ node.innerHTML = "\n var _czc = _czc || [];\n window._czc&&window._czc.push(['_setAutoPageview', false]);\n ";
22
+ document.body.appendChild(node);
23
+ node = document.createElement('script');
24
+ node.src = '//v1.cnzz.com/z_stat.php?id=1280732258&web_id=1280732258';
25
+ document.body.appendChild(node);
26
+ }
27
+
28
+ var types = ['success', 'error', 'warning', 'info'];
29
+ types.forEach(function (item) {
30
+ var msgAPI = message[item].bind(message);
31
+ var modalAPI = Modal[item].bind(Modal);
32
+
33
+ message[item] = function () {
34
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
35
+ args[_key] = arguments[_key];
36
+ }
37
+
38
+ var args0 = args[0],
39
+ args1 = args[1],
40
+ args2 = args[2];
41
+
42
+ if (args.length === 1 && _typeof(args0) === 'object' && ! /*#__PURE__*/React.isValidElement(args0)) {
43
+ return msgAPI(_objectSpread({
44
+ icon: /*#__PURE__*/React.createElement(Tip, {
45
+ type: item
46
+ })
47
+ }, args0));
48
+ }
49
+
50
+ return msgAPI({
51
+ content: args0,
52
+ duration: args1,
53
+ onClose: args2,
54
+ icon: /*#__PURE__*/React.createElement(Tip, {
55
+ type: item
56
+ })
57
+ });
58
+ };
59
+
60
+ Modal[item] = function () {
61
+ return modalAPI(_objectSpread({
62
+ icon: /*#__PURE__*/React.createElement(Tip, {
63
+ type: item,
64
+ style: {
65
+ fontSize: 20
66
+ }
67
+ })
68
+ }, arguments.length <= 0 ? undefined : arguments[0]));
69
+ };
70
+ });
71
+ var modalConfirm = Modal.confirm.bind(Modal);
72
+
73
+ Modal.confirm = function () {
74
+ return modalConfirm(_objectSpread({
75
+ icon: /*#__PURE__*/React.createElement(Tip, {
76
+ type: "warning",
77
+ style: {
78
+ fontSize: 20
79
+ }
80
+ })
81
+ }, arguments.length <= 0 ? undefined : arguments[0]));
82
+ }; //@ts-ignore
83
+
84
+
85
+ Select.defaultProps = {
86
+ suffixIcon: function suffixIcon() {
87
+ return /*#__PURE__*/React.createElement("div", {
88
+ style: {
89
+ margin: '-2px 0 0 -2px',
90
+ fontSize: 16,
91
+ color: '#BFBFBF'
92
+ }
93
+ }, /*#__PURE__*/React.createElement(Down, null));
94
+ }
95
+ };
96
+ Empty.PRESENTED_IMAGE_DEFAULT = /*#__PURE__*/React.createElement(EmptyIcon, null);
97
+ Empty.defaultProps = {
98
+ image: Empty.PRESENTED_IMAGE_DEFAULT
99
+ };
100
+ }
package/es/theme.less ADDED
@@ -0,0 +1,13 @@
1
+ /* stylelint-disable property-no-unknown */
2
+ @prefixCls: lemon;
3
+
4
+ html {
5
+ --lemon-primary-color: 35, 87, 223;
6
+ }
7
+
8
+ .primary(@alpha: 1) {
9
+ rgb: rgb(var(--lemon-primary-color));
10
+ rgba: rgba(var(--lemon-primary-color), @alpha);
11
+ }
12
+
13
+ @space: 16px;
package/package.json ADDED
@@ -0,0 +1,43 @@
1
+ {
2
+ "name": "@lemon-fe/components",
3
+ "version": "0.0.0",
4
+ "private": false,
5
+ "description": "> TODO: description",
6
+ "author": "鲁盛杰 <lusj@cnlemon.net>",
7
+ "homepage": "",
8
+ "license": "ISC",
9
+ "main": "es/index.js",
10
+ "files": [
11
+ "es"
12
+ ],
13
+ "publishConfig": {
14
+ "@lemon-fe:registry": "https://registry.npmjs.org"
15
+ },
16
+ "scripts": {
17
+ "test": "echo \"Error: run tests from root\" && exit 1"
18
+ },
19
+ "dependencies": {
20
+ "@lemon-fe/hooks": "^0.0.0",
21
+ "antd": "^4.17.0",
22
+ "classnames": "^2.2.6",
23
+ "lodash": "^4.17.21",
24
+ "react": "^17.0.2",
25
+ "react-dom": "^17.0.2",
26
+ "react-resizable": "^3.0.4"
27
+ },
28
+ "peerDependencies": {
29
+ "@ant-design/icons": ">=4.0.0",
30
+ "antd": ">=4.17.0-alpha.8",
31
+ "classnames": ">=2.2.6",
32
+ "color-string": ">=1.0.0",
33
+ "lodash": ">=4.17.0",
34
+ "rc-tree": ">=4.0.0",
35
+ "react": ">=16.9.0",
36
+ "react-dom": ">=16.9.0"
37
+ },
38
+ "devDependencies": {
39
+ "@types/color-string": "^1.5.2",
40
+ "@types/lodash": "^4.14.179",
41
+ "@types/react-resizable": "^1.7.4"
42
+ }
43
+ }