@qn-pandora/pandora-component 4.0.1 → 4.0.3
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/CHANGELOG.json +40 -0
- package/CHANGELOG.md +17 -1
- package/es/components/AutoComplete/index.js +21 -1
- package/es/components/DateTimePicker/transform.d.ts +4 -1
- package/es/components/DateTimePicker/transform.js +2 -2
- package/es/components/Drawer/index.d.ts +30 -2
- package/es/components/Drawer/index.js +165 -5
- package/es/components/Drawer/style.css +18 -1
- package/es/components/Drawer/style.less +23 -1
- package/es/components/Selector/SelectorWidthChildren.d.ts +15 -0
- package/es/components/Selector/SelectorWidthChildren.js +59 -0
- package/es/components/Selector/index.d.ts +2 -0
- package/es/components/Selector/index.js +17 -3
- package/es/components/TreeSelector/index.js +1 -1
- package/es/index.css +4414 -4397
- package/es/index.d.ts +1 -0
- package/es/index.js +1 -0
- package/es/index.less +15 -15
- package/lib/components/AutoComplete/index.js +21 -1
- package/lib/components/DateTimePicker/transform.d.ts +4 -1
- package/lib/components/DateTimePicker/transform.js +2 -0
- package/lib/components/Drawer/index.d.ts +30 -2
- package/lib/components/Drawer/index.js +164 -12
- package/lib/components/Drawer/style.css +18 -1
- package/lib/components/Drawer/style.less +23 -1
- package/lib/components/Selector/SelectorWidthChildren.d.ts +15 -0
- package/lib/components/Selector/SelectorWidthChildren.js +72 -0
- package/lib/components/Selector/index.d.ts +2 -0
- package/lib/components/Selector/index.js +16 -2
- package/lib/components/TreeSelector/index.js +1 -1
- package/lib/index.css +2675 -2658
- package/lib/index.d.ts +1 -0
- package/lib/index.js +2 -0
- package/lib/index.less +12 -12
- package/package.json +3 -3
package/es/index.d.ts
CHANGED
@@ -7,6 +7,7 @@ export { default as ConfigProvider } from './components/ConfigProvider';
|
|
7
7
|
export { default as NameLimiter, INameLimiterProps } from './components/NameLimiter';
|
8
8
|
export { default as Input, TInputProps } from './components/Input';
|
9
9
|
export { default as Selector, ISelectorProps, IGroupOption as ISelectorGroupOption, IOptions as ISelectorOptions, SelectValue as ISelectValue } from './components/Selector';
|
10
|
+
export { default as SelectorWidthChildren } from './components/Selector/SelectorWidthChildren';
|
10
11
|
export { default as Table, ITableProps, IOptionItem as ITableOptionItem } from './components/Table';
|
11
12
|
export { default as Steps } from './components/Steps';
|
12
13
|
export { default as DateTimePicker, Time, EButtonType, IDateTimePickerProps } from './components/DateTimePicker';
|
package/es/index.js
CHANGED
@@ -7,6 +7,7 @@ export { default as ConfigProvider } from './components/ConfigProvider';
|
|
7
7
|
export { default as NameLimiter } from './components/NameLimiter';
|
8
8
|
export { default as Input } from './components/Input';
|
9
9
|
export { default as Selector } from './components/Selector';
|
10
|
+
export { default as SelectorWidthChildren } from './components/Selector/SelectorWidthChildren';
|
10
11
|
export { default as Table } from './components/Table';
|
11
12
|
export { default as Steps } from './components/Steps';
|
12
13
|
export { default as DateTimePicker, Time, EButtonType } from './components/DateTimePicker';
|
package/es/index.less
CHANGED
@@ -2,48 +2,48 @@
|
|
2
2
|
@import './style\theme.less';
|
3
3
|
@import './components\AutoComplete\style.less';
|
4
4
|
@import './components\Breadcrumb\style.less';
|
5
|
-
@import './components\Button\style.less';
|
6
5
|
@import './components\Card\style.less';
|
6
|
+
@import './components\Button\style.less';
|
7
7
|
@import './components\Checkbox\style.less';
|
8
8
|
@import './components\CheckTransformList\style.less';
|
9
9
|
@import './components\CheckboxList\style.less';
|
10
10
|
@import './components\Collapse\style.less';
|
11
11
|
@import './components\CollapsiblePanel\style.less';
|
12
|
-
@import './components\Input\style.less';
|
13
12
|
@import './components\Drawer\style.less';
|
14
13
|
@import './components\DateTimePicker\style.less';
|
14
|
+
@import './components\Input\style.less';
|
15
15
|
@import './components\KeyValuePair\style.less';
|
16
|
-
@import './components\Modal\style.less';
|
17
16
|
@import './components\Menu\style.less';
|
18
|
-
@import './components\
|
17
|
+
@import './components\Modal\style.less';
|
19
18
|
@import './components\NameExplainTooltip\style.less';
|
20
19
|
@import './components\NameLimiter\style.less';
|
21
|
-
@import './components\RadioGroup\style.less';
|
22
20
|
@import './components\RangeInput\style.less';
|
23
|
-
@import './components\
|
21
|
+
@import './components\RadioGroup\style.less';
|
22
|
+
@import './components\OptionList\style.less';
|
24
23
|
@import './components\RemarkName\style.less';
|
25
|
-
@import './components\
|
24
|
+
@import './components\Selector\style.less';
|
26
25
|
@import './components\Spin\style.less';
|
27
|
-
@import './components\
|
26
|
+
@import './components\Steps\style.less';
|
28
27
|
@import './components\Table\style.less';
|
29
|
-
@import './components\Timeline\style.less';
|
30
28
|
@import './components\TagList\style.less';
|
31
|
-
@import './components\
|
29
|
+
@import './components\Tabs\style.less';
|
32
30
|
@import './components\Transfer\style.less';
|
31
|
+
@import './components\Timeline\style.less';
|
32
|
+
@import './components\TreeSelector\style.less';
|
33
33
|
@import './components\Card\RowExtra\style.less';
|
34
34
|
@import './components\Card\SearchInput\style.less';
|
35
|
-
@import './components\DateTimePicker\Base\style.less';
|
36
35
|
@import './components\DateTimePicker\BaseMobile\style.less';
|
36
|
+
@import './components\DateTimePicker\Base\style.less';
|
37
37
|
@import './components\DateTimePicker\DisplayInput\style.less';
|
38
|
+
@import './components\OptionList\OptionItem\style.less';
|
38
39
|
@import './components\OptionList\InlineOptionList\style.less';
|
39
40
|
@import './components\OptionList\PopoverOptionList\style.less';
|
40
|
-
@import './components\OptionList\OptionItem\style.less';
|
41
41
|
@import './components\Steps\ControlButton\style.less';
|
42
42
|
@import './components\Table\ColumnTag\style.less';
|
43
|
-
@import './components\TagList\Tag\style.less';
|
44
|
-
@import './components\Timeline\TimelineItem\style.less';
|
45
43
|
@import './components\TagList\TagSwitch\style.less';
|
46
|
-
@import './components\
|
44
|
+
@import './components\TagList\Tag\style.less';
|
47
45
|
@import './components\Transfer\ListBody\style.less';
|
46
|
+
@import './components\Transfer\List\style.less';
|
47
|
+
@import './components\Timeline\TimelineItem\style.less';
|
48
48
|
@import './components\DateTimePicker\BaseMobile\Absolute\style.less';
|
49
49
|
@import './components\DateTimePicker\Collapse\Panel\style.less';
|
@@ -34,13 +34,33 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
34
34
|
Object.defineProperty(exports, "__esModule", { value: true });
|
35
35
|
var React = __importStar(require("react"));
|
36
36
|
var classnames_1 = __importDefault(require("classnames"));
|
37
|
+
var lodash_1 = require("lodash");
|
37
38
|
var antd_1 = require("antd");
|
38
39
|
var style_1 = require("../../constants/style");
|
39
40
|
var debounce_1 = __importDefault(require("../../hoc/debounce"));
|
40
41
|
function AutoComplete(props) {
|
41
42
|
var _a;
|
42
43
|
var className = props.className, dropdownClassName = props.dropdownClassName, ellipsis = props.ellipsis, other = __rest(props, ["className", "dropdownClassName", "ellipsis"]);
|
43
|
-
|
44
|
+
var filterOption = React.useCallback(function (inputValue, option) {
|
45
|
+
var prefix = (inputValue === null || inputValue === void 0 ? void 0 : inputValue.toLowerCase()) || '';
|
46
|
+
var _a = option || {}, value = _a.value, title = _a.title, children = _a.children, label = _a.label;
|
47
|
+
return children
|
48
|
+
? lodash_1.isString(children)
|
49
|
+
? lodash_1.includes(children.toLowerCase(), prefix)
|
50
|
+
: true
|
51
|
+
: label
|
52
|
+
? lodash_1.isString(label)
|
53
|
+
? lodash_1.includes(label.toLowerCase(), prefix)
|
54
|
+
: true
|
55
|
+
: title
|
56
|
+
? lodash_1.isString(title)
|
57
|
+
? lodash_1.includes(title.toLowerCase(), prefix)
|
58
|
+
: true
|
59
|
+
: lodash_1.isString(value)
|
60
|
+
? lodash_1.includes(value.toLowerCase(), prefix)
|
61
|
+
: true;
|
62
|
+
}, []);
|
63
|
+
return (React.createElement(antd_1.AutoComplete, __assign({ className: classnames_1.default(className, style_1.SDK_PREFIX + "-auto-complete", style_1.SDK_PREFIX + "-selector"), dropdownClassName: classnames_1.default(style_1.SDK_PREFIX + "-selector-dropdown", (_a = {}, _a[style_1.SDK_PREFIX + "-selector-no-ellipsis"] = !ellipsis, _a), dropdownClassName), filterOption: filterOption, showSearch: true }, other)));
|
44
64
|
}
|
45
65
|
exports.AutoComplete = AutoComplete;
|
46
66
|
exports.default = debounce_1.default(AutoComplete);
|
@@ -1,6 +1,9 @@
|
|
1
|
-
import
|
1
|
+
import moment from 'moment';
|
2
|
+
import { ITimeRange, ITime, TimeShiftUnit } from './constants';
|
2
3
|
export declare function transformToTime(time: ITimeRange): ITime;
|
3
4
|
export declare function transformToTimeRange(time: ITime): ITimeRange;
|
5
|
+
export declare function getTimeShiftUnit(time: string): TimeShiftUnit.Second | TimeShiftUnit;
|
6
|
+
export declare function getRelativeTime(timeShift: string, time: moment.Moment): moment.Moment | undefined;
|
4
7
|
export declare function calcFullTime(time?: ITimeRange): {
|
5
8
|
start: number | undefined;
|
6
9
|
end: number | undefined;
|
@@ -59,6 +59,7 @@ function getTimeShiftUnit(time) {
|
|
59
59
|
}
|
60
60
|
return constants_1.TimeShiftUnit.Second;
|
61
61
|
}
|
62
|
+
exports.getTimeShiftUnit = getTimeShiftUnit;
|
62
63
|
function getRelativeTime(timeShift, time) {
|
63
64
|
var timeShiftValue = parseFloat(timeShift) || 0;
|
64
65
|
var timeShiftUnit = getTimeShiftUnit(timeShift);
|
@@ -66,6 +67,7 @@ function getRelativeTime(timeShift, time) {
|
|
66
67
|
return moment_1.default(time).subtract(timeShiftValue, timeShiftUnit);
|
67
68
|
}
|
68
69
|
}
|
70
|
+
exports.getRelativeTime = getRelativeTime;
|
69
71
|
function calcFullTime(time) {
|
70
72
|
if (!time) {
|
71
73
|
return;
|
@@ -1,4 +1,5 @@
|
|
1
|
-
|
1
|
+
/// <reference types="lodash" />
|
2
|
+
import React from 'react';
|
2
3
|
import { DrawerProps } from 'antd/es/drawer';
|
3
4
|
import { Overwrite } from '../../models';
|
4
5
|
declare type EventType = React.KeyboardEvent<HTMLDivElement> | React.MouseEvent<HTMLDivElement | HTMLButtonElement>;
|
@@ -52,8 +53,28 @@ export declare type IDrawerProps = Overwrite<DrawerProps, {
|
|
52
53
|
getContainer?: string | HTMLElement | getContainerFunc | false;
|
53
54
|
onClose?: (e: EventType) => void;
|
54
55
|
afterVisibleChange?: (visible: boolean) => void;
|
56
|
+
/**
|
57
|
+
* 是否允许拖拽
|
58
|
+
*/
|
59
|
+
canDrag?: boolean;
|
60
|
+
closeIconPlacement?: 'left' | 'right';
|
55
61
|
}>;
|
56
|
-
export declare
|
62
|
+
export declare class Drawer extends React.Component<React.PropsWithChildren<IDrawerProps>, any> {
|
63
|
+
isResizing: boolean;
|
64
|
+
realWidth: string | number | undefined;
|
65
|
+
throttleMouseMove: import("lodash").DebouncedFunc<(e: any) => void>;
|
66
|
+
get closable(): boolean | undefined;
|
67
|
+
get extra(): {} | null | undefined;
|
68
|
+
setIsResizing(isResizing?: boolean): void;
|
69
|
+
setRealWidth(realWidth: string | number): void;
|
70
|
+
onMouseDown(): void;
|
71
|
+
onMouseUp(): void;
|
72
|
+
onMouseMove(e: any): void;
|
73
|
+
componentDidMount(): void;
|
74
|
+
UNSAFE_componentWillUpdate(nextProps: Readonly<React.PropsWithChildren<IDrawerProps>>): void;
|
75
|
+
componentWillUnmount(): void;
|
76
|
+
render(): JSX.Element;
|
77
|
+
}
|
57
78
|
declare const _default: (props: {
|
58
79
|
className?: string | undefined;
|
59
80
|
/**
|
@@ -103,7 +124,14 @@ declare const _default: (props: {
|
|
103
124
|
getContainer?: string | false | HTMLElement | getContainerFunc | undefined;
|
104
125
|
onClose?: ((e: EventType) => void) | undefined;
|
105
126
|
afterVisibleChange?: ((visible: boolean) => void) | undefined;
|
127
|
+
/**
|
128
|
+
* 是否允许拖拽
|
129
|
+
*/
|
130
|
+
canDrag?: boolean | undefined;
|
131
|
+
closeIconPlacement?: import("antd/es/collapse/Collapse").ExpandIconPosition;
|
106
132
|
} & Pick<DrawerProps, "style" | "autoFocus" | "size" | "prefixCls" | "footer" | "extra" | "bodyStyle" | "forceRender" | "keyboard" | "destroyOnClose" | "closeIcon" | "drawerStyle" | "headerStyle" | "contentWrapperStyle" | "push" | "handler" | "footerStyle" | "level" | "levelMove"> & {
|
133
|
+
children?: React.ReactNode;
|
134
|
+
} & {
|
107
135
|
bodyStyle?: React.CSSProperties | undefined;
|
108
136
|
children: React.ReactNode;
|
109
137
|
}) => JSX.Element;
|
@@ -1,4 +1,17 @@
|
|
1
1
|
"use strict";
|
2
|
+
var __extends = (this && this.__extends) || (function () {
|
3
|
+
var extendStatics = function (d, b) {
|
4
|
+
extendStatics = Object.setPrototypeOf ||
|
5
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
6
|
+
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
7
|
+
return extendStatics(d, b);
|
8
|
+
};
|
9
|
+
return function (d, b) {
|
10
|
+
extendStatics(d, b);
|
11
|
+
function __() { this.constructor = d; }
|
12
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
13
|
+
};
|
14
|
+
})();
|
2
15
|
var __assign = (this && this.__assign) || function () {
|
3
16
|
__assign = Object.assign || function(t) {
|
4
17
|
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
@@ -10,6 +23,15 @@ var __assign = (this && this.__assign) || function () {
|
|
10
23
|
};
|
11
24
|
return __assign.apply(this, arguments);
|
12
25
|
};
|
26
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
27
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
28
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
29
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
30
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
31
|
+
};
|
32
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
33
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
34
|
+
};
|
13
35
|
var __rest = (this && this.__rest) || function (s, e) {
|
14
36
|
var t = {};
|
15
37
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
@@ -21,25 +43,155 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
21
43
|
}
|
22
44
|
return t;
|
23
45
|
};
|
24
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
25
|
-
if (mod && mod.__esModule) return mod;
|
26
|
-
var result = {};
|
27
|
-
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
28
|
-
result["default"] = mod;
|
29
|
-
return result;
|
30
|
-
};
|
31
46
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
32
47
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
33
48
|
};
|
34
49
|
Object.defineProperty(exports, "__esModule", { value: true });
|
35
|
-
var
|
50
|
+
var react_1 = __importDefault(require("react"));
|
36
51
|
var classnames_1 = __importDefault(require("classnames"));
|
52
|
+
var lodash_1 = require("lodash");
|
53
|
+
var mobx_react_1 = require("mobx-react");
|
54
|
+
var mobx_1 = require("mobx");
|
37
55
|
var antd_1 = require("antd");
|
56
|
+
var icons_1 = require("@ant-design/icons");
|
38
57
|
var style_1 = require("../../constants/style");
|
39
58
|
var popContainer_1 = __importDefault(require("../../hoc/popContainer"));
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
59
|
+
var bind_1 = __importDefault(require("../../utils/bind"));
|
60
|
+
var MAX_WIDTH = 6000;
|
61
|
+
var MIN_WIDTH = 300;
|
62
|
+
var Drawer = /** @class */ (function (_super) {
|
63
|
+
__extends(Drawer, _super);
|
64
|
+
function Drawer() {
|
65
|
+
var _this = _super !== null && _super.apply(this, arguments) || this;
|
66
|
+
_this.isResizing = false;
|
67
|
+
_this.realWidth = _this.props.width;
|
68
|
+
_this.throttleMouseMove = lodash_1.throttle(function (e) { return _this.onMouseMove(e); }, 100);
|
69
|
+
return _this;
|
70
|
+
}
|
71
|
+
Object.defineProperty(Drawer.prototype, "closable", {
|
72
|
+
get: function () {
|
73
|
+
if (this.props.closable &&
|
74
|
+
this.props.closeIconPlacement &&
|
75
|
+
this.props.closeIconPlacement === 'right') {
|
76
|
+
return false;
|
77
|
+
}
|
78
|
+
return this.props.closable;
|
79
|
+
},
|
80
|
+
enumerable: true,
|
81
|
+
configurable: true
|
82
|
+
});
|
83
|
+
Object.defineProperty(Drawer.prototype, "extra", {
|
84
|
+
get: function () {
|
85
|
+
if (this.props.closable && this.props.closeIconPlacement === 'right') {
|
86
|
+
return (react_1.default.createElement(react_1.default.Fragment, null,
|
87
|
+
this.props.extra,
|
88
|
+
react_1.default.createElement(icons_1.CloseOutlined, { onClick: this.props.onClose, className: style_1.SDK_PREFIX + "-drawer-right-close-icon" })));
|
89
|
+
}
|
90
|
+
return this.props.extra;
|
91
|
+
},
|
92
|
+
enumerable: true,
|
93
|
+
configurable: true
|
94
|
+
});
|
95
|
+
Drawer.prototype.setIsResizing = function (isResizing) {
|
96
|
+
if (isResizing === void 0) { isResizing = false; }
|
97
|
+
this.isResizing = isResizing;
|
98
|
+
};
|
99
|
+
Drawer.prototype.setRealWidth = function (realWidth) {
|
100
|
+
this.realWidth = realWidth;
|
101
|
+
};
|
102
|
+
Drawer.prototype.onMouseDown = function () {
|
103
|
+
this.setIsResizing(true);
|
104
|
+
};
|
105
|
+
Drawer.prototype.onMouseUp = function () {
|
106
|
+
this.setIsResizing(false);
|
107
|
+
};
|
108
|
+
Drawer.prototype.onMouseMove = function (e) {
|
109
|
+
if (this.isResizing) {
|
110
|
+
var offsetRight = document.body.offsetWidth - (e.clientX - document.body.offsetLeft);
|
111
|
+
if (offsetRight > MIN_WIDTH && offsetRight < MAX_WIDTH) {
|
112
|
+
this.setRealWidth(offsetRight);
|
113
|
+
}
|
114
|
+
}
|
115
|
+
};
|
116
|
+
Drawer.prototype.componentDidMount = function () {
|
117
|
+
if (this.props.canDrag) {
|
118
|
+
document.addEventListener('mousemove', this.throttleMouseMove);
|
119
|
+
document.addEventListener('mouseup', this.onMouseUp);
|
120
|
+
}
|
121
|
+
};
|
122
|
+
Drawer.prototype.UNSAFE_componentWillUpdate = function (nextProps) {
|
123
|
+
if (nextProps.canDrag && !this.props.canDrag) {
|
124
|
+
document.addEventListener('mousemove', this.throttleMouseMove);
|
125
|
+
document.addEventListener('mouseup', this.onMouseUp);
|
126
|
+
}
|
127
|
+
};
|
128
|
+
Drawer.prototype.componentWillUnmount = function () {
|
129
|
+
document.removeEventListener('mousemove', this.throttleMouseMove);
|
130
|
+
document.removeEventListener('mouseup', this.onMouseUp);
|
131
|
+
};
|
132
|
+
Drawer.prototype.render = function () {
|
133
|
+
var _a;
|
134
|
+
var _b = this.props, width = _b.width, className = _b.className, children = _b.children, canDrag = _b.canDrag, visible = _b.visible, closable = _b.closable, extra = _b.extra, other = __rest(_b, ["width", "className", "children", "canDrag", "visible", "closable", "extra"]);
|
135
|
+
return (react_1.default.createElement(antd_1.Drawer, __assign({ className: classnames_1.default(style_1.SDK_PREFIX + "-drawer", className, (_a = {},
|
136
|
+
_a[style_1.SDK_PREFIX + "-drawer-no-mask"] = this.props.mask === false,
|
137
|
+
_a)), width: this.realWidth || 'auto', zIndex: 1200, visible: visible, closable: this.closable, extra: this.extra }, other),
|
138
|
+
canDrag && (react_1.default.createElement("div", { className: style_1.SDK_PREFIX + "-scroll-handler", onMouseDown: this.onMouseDown })),
|
139
|
+
children));
|
140
|
+
};
|
141
|
+
__decorate([
|
142
|
+
mobx_1.observable,
|
143
|
+
__metadata("design:type", Object)
|
144
|
+
], Drawer.prototype, "isResizing", void 0);
|
145
|
+
__decorate([
|
146
|
+
mobx_1.observable,
|
147
|
+
__metadata("design:type", Object)
|
148
|
+
], Drawer.prototype, "realWidth", void 0);
|
149
|
+
__decorate([
|
150
|
+
mobx_1.computed,
|
151
|
+
__metadata("design:type", Object),
|
152
|
+
__metadata("design:paramtypes", [])
|
153
|
+
], Drawer.prototype, "closable", null);
|
154
|
+
__decorate([
|
155
|
+
mobx_1.computed,
|
156
|
+
__metadata("design:type", Object),
|
157
|
+
__metadata("design:paramtypes", [])
|
158
|
+
], Drawer.prototype, "extra", null);
|
159
|
+
__decorate([
|
160
|
+
bind_1.default,
|
161
|
+
mobx_1.action,
|
162
|
+
__metadata("design:type", Function),
|
163
|
+
__metadata("design:paramtypes", [Object]),
|
164
|
+
__metadata("design:returntype", void 0)
|
165
|
+
], Drawer.prototype, "setIsResizing", null);
|
166
|
+
__decorate([
|
167
|
+
bind_1.default,
|
168
|
+
mobx_1.action,
|
169
|
+
__metadata("design:type", Function),
|
170
|
+
__metadata("design:paramtypes", [Object]),
|
171
|
+
__metadata("design:returntype", void 0)
|
172
|
+
], Drawer.prototype, "setRealWidth", null);
|
173
|
+
__decorate([
|
174
|
+
bind_1.default,
|
175
|
+
__metadata("design:type", Function),
|
176
|
+
__metadata("design:paramtypes", []),
|
177
|
+
__metadata("design:returntype", void 0)
|
178
|
+
], Drawer.prototype, "onMouseDown", null);
|
179
|
+
__decorate([
|
180
|
+
bind_1.default,
|
181
|
+
__metadata("design:type", Function),
|
182
|
+
__metadata("design:paramtypes", []),
|
183
|
+
__metadata("design:returntype", void 0)
|
184
|
+
], Drawer.prototype, "onMouseUp", null);
|
185
|
+
__decorate([
|
186
|
+
bind_1.default,
|
187
|
+
__metadata("design:type", Function),
|
188
|
+
__metadata("design:paramtypes", [Object]),
|
189
|
+
__metadata("design:returntype", void 0)
|
190
|
+
], Drawer.prototype, "onMouseMove", null);
|
191
|
+
Drawer = __decorate([
|
192
|
+
mobx_react_1.observer
|
193
|
+
], Drawer);
|
194
|
+
return Drawer;
|
195
|
+
}(react_1.default.Component));
|
44
196
|
exports.Drawer = Drawer;
|
45
197
|
exports.default = popContainer_1.default(Drawer);
|
@@ -259,7 +259,7 @@
|
|
259
259
|
}
|
260
260
|
.pandora-sdk-drawer .ant-drawer-content-wrapper {
|
261
261
|
width: 50%;
|
262
|
-
min-width:
|
262
|
+
min-width: 300px;
|
263
263
|
}
|
264
264
|
.pandora-sdk-drawer .ant-drawer-content > div {
|
265
265
|
position: relative;
|
@@ -269,3 +269,20 @@
|
|
269
269
|
height: 60px;
|
270
270
|
line-height: 60px;
|
271
271
|
}
|
272
|
+
.pandora-sdk-drawer-no-mask .ant-drawer-content-wrapper {
|
273
|
+
width: 100%;
|
274
|
+
}
|
275
|
+
.pandora-sdk-scroll-handler {
|
276
|
+
position: absolute;
|
277
|
+
width: 5px;
|
278
|
+
padding: 4px 0 0;
|
279
|
+
top: 0;
|
280
|
+
left: 0;
|
281
|
+
bottom: 0;
|
282
|
+
z-index: 100;
|
283
|
+
cursor: ew-resize;
|
284
|
+
}
|
285
|
+
.pandora-sdk-drawer-right-close-icon {
|
286
|
+
margin-left: 8px;
|
287
|
+
font-size: 16px;
|
288
|
+
}
|
@@ -4,7 +4,7 @@
|
|
4
4
|
.@{sdk-prefix}-drawer {
|
5
5
|
.@{ant-prefix}-drawer-content-wrapper {
|
6
6
|
width: 50%;
|
7
|
-
min-width:
|
7
|
+
min-width: 300px;
|
8
8
|
}
|
9
9
|
.@{ant-prefix}-drawer-content > div {
|
10
10
|
position: relative;
|
@@ -15,3 +15,25 @@
|
|
15
15
|
line-height: 60px;
|
16
16
|
}
|
17
17
|
}
|
18
|
+
|
19
|
+
.@{sdk-prefix}-drawer-no-mask {
|
20
|
+
.@{ant-prefix}-drawer-content-wrapper {
|
21
|
+
width: 100%;
|
22
|
+
}
|
23
|
+
}
|
24
|
+
|
25
|
+
.@{sdk-prefix}-scroll-handler {
|
26
|
+
position: absolute;
|
27
|
+
width: 5px;
|
28
|
+
padding: 4px 0 0;
|
29
|
+
top: 0;
|
30
|
+
left: 0;
|
31
|
+
bottom: 0;
|
32
|
+
z-index: 100;
|
33
|
+
cursor: ew-resize;
|
34
|
+
}
|
35
|
+
|
36
|
+
.@{sdk-prefix}-drawer-right-close-icon {
|
37
|
+
margin-left: 8px;
|
38
|
+
font-size: 16px;
|
39
|
+
}
|
@@ -0,0 +1,15 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import { ISelectorProps, SelectValue } from './index';
|
3
|
+
declare type IValue = string | number;
|
4
|
+
export interface ISelectorOption {
|
5
|
+
key?: string;
|
6
|
+
text: string | React.ReactNode;
|
7
|
+
value: IValue;
|
8
|
+
disabled?: boolean;
|
9
|
+
filterText?: string;
|
10
|
+
}
|
11
|
+
export interface ISelectorWidthChildrenProps<VT> extends ISelectorProps<VT> {
|
12
|
+
options?: ISelectorOption[];
|
13
|
+
}
|
14
|
+
export default function SelectorWidthChildren<VT extends SelectValue>(props: ISelectorWidthChildrenProps<VT>): JSX.Element;
|
15
|
+
export {};
|
@@ -0,0 +1,72 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
3
|
+
__assign = Object.assign || function(t) {
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
5
|
+
s = arguments[i];
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
7
|
+
t[p] = s[p];
|
8
|
+
}
|
9
|
+
return t;
|
10
|
+
};
|
11
|
+
return __assign.apply(this, arguments);
|
12
|
+
};
|
13
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
14
|
+
var t = {};
|
15
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
16
|
+
t[p] = s[p];
|
17
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
18
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
19
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
20
|
+
t[p[i]] = s[p[i]];
|
21
|
+
}
|
22
|
+
return t;
|
23
|
+
};
|
24
|
+
var __read = (this && this.__read) || function (o, n) {
|
25
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
26
|
+
if (!m) return o;
|
27
|
+
var i = m.call(o), r, ar = [], e;
|
28
|
+
try {
|
29
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
30
|
+
}
|
31
|
+
catch (error) { e = { error: error }; }
|
32
|
+
finally {
|
33
|
+
try {
|
34
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
35
|
+
}
|
36
|
+
finally { if (e) throw e.error; }
|
37
|
+
}
|
38
|
+
return ar;
|
39
|
+
};
|
40
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
41
|
+
if (mod && mod.__esModule) return mod;
|
42
|
+
var result = {};
|
43
|
+
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
44
|
+
result["default"] = mod;
|
45
|
+
return result;
|
46
|
+
};
|
47
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
48
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
49
|
+
};
|
50
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
51
|
+
var react_1 = __importStar(require("react"));
|
52
|
+
var lodash_1 = require("lodash");
|
53
|
+
var index_1 = __importDefault(require("./index"));
|
54
|
+
// 下拉选项的是element时用于筛选过滤options
|
55
|
+
function SelectorWidthChildren(props) {
|
56
|
+
var _a = __read(react_1.useState(''), 2), prefix = _a[0], setPrefix = _a[1];
|
57
|
+
var options = props.options, rest = __rest(props, ["options"]);
|
58
|
+
react_1.useEffect(function () {
|
59
|
+
setPrefix('');
|
60
|
+
}, []);
|
61
|
+
var filterOptions = react_1.useMemo(function () {
|
62
|
+
var search = prefix.toLowerCase();
|
63
|
+
return prefix && options
|
64
|
+
? options.filter(function (option) {
|
65
|
+
return option.filterText &&
|
66
|
+
lodash_1.includes(option.filterText.toLowerCase(), search);
|
67
|
+
})
|
68
|
+
: options;
|
69
|
+
}, [prefix, options]);
|
70
|
+
return (react_1.default.createElement(index_1.default, __assign({}, rest, { onSearch: setPrefix, searchValue: prefix, options: filterOptions, isCustomFilter: true })));
|
71
|
+
}
|
72
|
+
exports.default = SelectorWidthChildren;
|
@@ -52,6 +52,7 @@ export interface ISelectorProps<VT> extends Omit<SelectProps<VT>, 'options'> {
|
|
52
52
|
* 下拉选项超出时用 '...' 来表示,默认 true
|
53
53
|
*/
|
54
54
|
ellipsis?: boolean;
|
55
|
+
isCustomFilter?: boolean;
|
55
56
|
}
|
56
57
|
/**
|
57
58
|
* 下拉选择组件封装
|
@@ -64,5 +65,6 @@ export default class Selector<VT extends SelectValue> extends React.Component<IS
|
|
64
65
|
ellipsis: boolean;
|
65
66
|
};
|
66
67
|
handleCreateClick(e: any): void;
|
68
|
+
handleFilter(inputValue: string, option: any): boolean;
|
67
69
|
render(): JSX.Element;
|
68
70
|
}
|
@@ -129,10 +129,18 @@ var Selector = /** @class */ (function (_super) {
|
|
129
129
|
createOptionClick();
|
130
130
|
}
|
131
131
|
};
|
132
|
+
Selector.prototype.handleFilter = function (inputValue, option) {
|
133
|
+
if (this.props.isCustomFilter) {
|
134
|
+
return true;
|
135
|
+
}
|
136
|
+
return lodash_1.isString(option === null || option === void 0 ? void 0 : option.children)
|
137
|
+
? (option === null || option === void 0 ? void 0 : option.children.toLowerCase().indexOf(inputValue.toLowerCase())) >= 0
|
138
|
+
: true;
|
139
|
+
};
|
132
140
|
Selector.prototype.render = function () {
|
133
141
|
var _a;
|
134
|
-
var _b = this.props, options = _b.options, groupOptions = _b.groupOptions, createOptionText = _b.createOptionText, selectAllOptionText = _b.selectAllOptionText, className = _b.className, dropdownClassName = _b.dropdownClassName, getPopupContainer = _b.getPopupContainer, ellipsis = _b.ellipsis, _c = _b.showArrow, showArrow = _c === void 0 ? true : _c, otherProps = __rest(_b, ["options", "groupOptions", "createOptionText", "selectAllOptionText", "className", "dropdownClassName", "getPopupContainer", "ellipsis", "showArrow"]);
|
135
|
-
return (React.createElement(antd_1.Select, __assign({ className: classnames_1.default(style_1.SDK_PREFIX + "-selector", className), dropdownClassName: classnames_1.default(style_1.SDK_PREFIX + "-selector-dropdown", (_a = {}, _a[style_1.SDK_PREFIX + "-selector-no-ellipsis"] = !ellipsis, _a), dropdownClassName), getPopupContainer: getPopupContainer || this.context.getPopupContainer }, otherProps, { removeIcon: React.createElement(compatible_1.Icon, { type: "close-circle", theme: "filled", className: style_1.SDK_PREFIX + "-close-icon" }), showArrow: showArrow }),
|
142
|
+
var _b = this.props, options = _b.options, groupOptions = _b.groupOptions, createOptionText = _b.createOptionText, selectAllOptionText = _b.selectAllOptionText, className = _b.className, dropdownClassName = _b.dropdownClassName, getPopupContainer = _b.getPopupContainer, ellipsis = _b.ellipsis, _c = _b.showArrow, showArrow = _c === void 0 ? true : _c, isCustomFilter = _b.isCustomFilter, otherProps = __rest(_b, ["options", "groupOptions", "createOptionText", "selectAllOptionText", "className", "dropdownClassName", "getPopupContainer", "ellipsis", "showArrow", "isCustomFilter"]);
|
143
|
+
return (React.createElement(antd_1.Select, __assign({ className: classnames_1.default(style_1.SDK_PREFIX + "-selector", className), dropdownClassName: classnames_1.default(style_1.SDK_PREFIX + "-selector-dropdown", (_a = {}, _a[style_1.SDK_PREFIX + "-selector-no-ellipsis"] = !ellipsis, _a), dropdownClassName), getPopupContainer: getPopupContainer || this.context.getPopupContainer, filterOption: this.handleFilter }, otherProps, { removeIcon: React.createElement(compatible_1.Icon, { type: "close-circle", theme: "filled", className: style_1.SDK_PREFIX + "-close-icon" }), showArrow: showArrow, showSearch: true }),
|
136
144
|
createOptionText && (React.createElement(antd_1.Select.Option, __assign({}, { className: style_1.SDK_PREFIX + "-selector-create-option" }, { key: "selector_create", disabled: true }, noneValueOption),
|
137
145
|
React.createElement("a", { className: style_1.SDK_PREFIX + "-selector-create-lint", onClick: this.handleCreateClick }, createOptionText))),
|
138
146
|
selectAllOptionText && (React.createElement(antd_1.Select.Option, __assign({}, { className: style_1.SDK_PREFIX + "-selector-create-option" }, { key: "selector_select_all", disabled: true }, noneValueOption),
|
@@ -151,6 +159,12 @@ var Selector = /** @class */ (function (_super) {
|
|
151
159
|
__metadata("design:paramtypes", [Object]),
|
152
160
|
__metadata("design:returntype", void 0)
|
153
161
|
], Selector.prototype, "handleCreateClick", null);
|
162
|
+
__decorate([
|
163
|
+
bind_1.default,
|
164
|
+
__metadata("design:type", Function),
|
165
|
+
__metadata("design:paramtypes", [String, Object]),
|
166
|
+
__metadata("design:returntype", void 0)
|
167
|
+
], Selector.prototype, "handleFilter", null);
|
154
168
|
return Selector;
|
155
169
|
}(React.Component));
|
156
170
|
exports.default = Selector;
|
@@ -38,7 +38,7 @@ var antd_1 = require("antd");
|
|
38
38
|
var style_1 = require("../../constants/style");
|
39
39
|
function TreeSelector(props) {
|
40
40
|
var className = props.className, dropdownClassName = props.dropdownClassName, restProps = __rest(props, ["className", "dropdownClassName"]);
|
41
|
-
return (React.createElement(antd_1.TreeSelect, __assign({ className: classnames_1.default(style_1.SDK_PREFIX + "-tree-select", className), dropdownClassName: classnames_1.default(style_1.SDK_PREFIX + "-tree-select-dropdown", dropdownClassName) }, restProps)));
|
41
|
+
return (React.createElement(antd_1.TreeSelect, __assign({ className: classnames_1.default(style_1.SDK_PREFIX + "-tree-select", className), dropdownClassName: classnames_1.default(style_1.SDK_PREFIX + "-tree-select-dropdown", dropdownClassName), showSearch: true, treeNodeFilterProp: "title" }, restProps)));
|
42
42
|
}
|
43
43
|
exports.TreeSelector = TreeSelector;
|
44
44
|
exports.default = TreeSelector;
|