@rivtn/noseur 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/LICENSE +21 -0
- package/README.md +2 -0
- package/dist/esm/Template.d.ts +7 -0
- package/dist/esm/Template.js +13 -0
- package/dist/esm/compose/Composed.css +437 -0
- package/dist/esm/compose/exotic/ColorPicker.d.ts +41 -0
- package/dist/esm/compose/exotic/ColorPicker.js +85 -0
- package/dist/esm/compose/exotic/ColorSlider.d.ts +30 -0
- package/dist/esm/compose/exotic/ColorSlider.js +99 -0
- package/dist/esm/compose/form/ComposedPassword.d.ts +25 -0
- package/dist/esm/compose/form/ComposedPassword.js +103 -0
- package/dist/esm/compose/form/DateTimeInput.d.ts +28 -0
- package/dist/esm/compose/form/DateTimeInput.js +154 -0
- package/dist/esm/compose/form/DateTimePicker.d.ts +341 -0
- package/dist/esm/compose/form/DateTimePicker.js +1265 -0
- package/dist/esm/compose/form/FormControl.d.ts +33 -0
- package/dist/esm/compose/form/FormControl.js +163 -0
- package/dist/esm/compose/form/FormGroup.d.ts +14 -0
- package/dist/esm/compose/form/FormGroup.js +58 -0
- package/dist/esm/compose/overlay/Alert.d.ts +56 -0
- package/dist/esm/compose/overlay/Alert.js +267 -0
- package/dist/esm/constants/Alignment.d.ts +17 -0
- package/dist/esm/constants/Alignment.js +18 -0
- package/dist/esm/constants/Direction.d.ts +26 -0
- package/dist/esm/constants/Direction.js +22 -0
- package/dist/esm/constants/Orientation.d.ts +8 -0
- package/dist/esm/constants/Orientation.js +9 -0
- package/dist/esm/constants/Scheme.d.ts +39 -0
- package/dist/esm/constants/Scheme.js +43 -0
- package/dist/esm/constants/Transition.d.ts +81 -0
- package/dist/esm/constants/Transition.js +85 -0
- package/dist/esm/constants/Types.d.ts +74 -0
- package/dist/esm/constants/Types.js +14 -0
- package/dist/esm/core/ComponentBaseProps.d.ts +53 -0
- package/dist/esm/core/ComponentBaseProps.js +33 -0
- package/dist/esm/core/noseur.css +2390 -0
- package/dist/esm/data/Column.d.ts +235 -0
- package/dist/esm/data/Column.js +98 -0
- package/dist/esm/data/Data.css +213 -0
- package/dist/esm/data/Data.d.ts +98 -0
- package/dist/esm/data/Data.js +142 -0
- package/dist/esm/data/List.d.ts +14 -0
- package/dist/esm/data/List.js +117 -0
- package/dist/esm/data/Table.d.ts +22 -0
- package/dist/esm/data/Table.js +236 -0
- package/dist/esm/form/Button.d.ts +35 -0
- package/dist/esm/form/Button.js +131 -0
- package/dist/esm/form/Calendar.d.ts +20 -0
- package/dist/esm/form/Calendar.js +46 -0
- package/dist/esm/form/Checkbox.d.ts +20 -0
- package/dist/esm/form/Checkbox.js +155 -0
- package/dist/esm/form/ColorMap.d.ts +22 -0
- package/dist/esm/form/ColorMap.js +43 -0
- package/dist/esm/form/ColorPalette.d.ts +28 -0
- package/dist/esm/form/ColorPalette.js +87 -0
- package/dist/esm/form/Dropdown.d.ts +78 -0
- package/dist/esm/form/Dropdown.js +360 -0
- package/dist/esm/form/FileInput.d.ts +134 -0
- package/dist/esm/form/FileInput.js +523 -0
- package/dist/esm/form/Form.css +467 -0
- package/dist/esm/form/Input.d.ts +45 -0
- package/dist/esm/form/Input.js +186 -0
- package/dist/esm/form/RadioButton.d.ts +21 -0
- package/dist/esm/form/RadioButton.js +178 -0
- package/dist/esm/form/Slider.d.ts +21 -0
- package/dist/esm/form/Slider.js +163 -0
- package/dist/esm/hooks/useSearchParams.d.ts +15 -0
- package/dist/esm/hooks/useSearchParams.js +50 -0
- package/dist/esm/hooks/useSubscription.d.ts +9 -0
- package/dist/esm/hooks/useSubscription.js +26 -0
- package/dist/esm/index.d.ts +60 -0
- package/dist/esm/index.js +73 -0
- package/dist/esm/layout/GridView.d.ts +23 -0
- package/dist/esm/layout/GridView.js +34 -0
- package/dist/esm/layout/Layout.css +5 -0
- package/dist/esm/misc/Misc.css +164 -0
- package/dist/esm/misc/ProgressBar.d.ts +22 -0
- package/dist/esm/misc/ProgressBar.js +86 -0
- package/dist/esm/overlay/Dialog.d.ts +46 -0
- package/dist/esm/overlay/Dialog.js +290 -0
- package/dist/esm/overlay/Message.d.ts +35 -0
- package/dist/esm/overlay/Message.js +187 -0
- package/dist/esm/overlay/Overlay.css +382 -0
- package/dist/esm/overlay/Popover.d.ts +30 -0
- package/dist/esm/overlay/Popover.js +245 -0
- package/dist/esm/overlay/Portal.d.ts +11 -0
- package/dist/esm/overlay/Portal.js +29 -0
- package/dist/esm/overlay/Toast.d.ts +49 -0
- package/dist/esm/overlay/Toast.js +341 -0
- package/dist/esm/panel/Accordion.d.ts +26 -0
- package/dist/esm/panel/Accordion.js +127 -0
- package/dist/esm/panel/Panel.css +317 -0
- package/dist/esm/panel/Panel.d.ts +43 -0
- package/dist/esm/panel/Panel.js +125 -0
- package/dist/esm/panel/ScrollPanel.d.ts +27 -0
- package/dist/esm/panel/ScrollPanel.js +43 -0
- package/dist/esm/panel/TabPane.d.ts +82 -0
- package/dist/esm/panel/TabPane.js +237 -0
- package/dist/esm/presentation/Chart.d.ts +49 -0
- package/dist/esm/presentation/Chart.js +62 -0
- package/dist/esm/presentation/Paginator.d.ts +90 -0
- package/dist/esm/presentation/Paginator.js +331 -0
- package/dist/esm/presentation/Presentation.css +23 -0
- package/dist/esm/sensor/DragSensor.d.ts +50 -0
- package/dist/esm/sensor/DragSensor.js +156 -0
- package/dist/esm/sensor/ViewportSensor.d.ts +18 -0
- package/dist/esm/sensor/ViewportSensor.js +85 -0
- package/dist/esm/utils/BoolHelper.d.ts +13 -0
- package/dist/esm/utils/BoolHelper.js +105 -0
- package/dist/esm/utils/Classname.d.ts +9 -0
- package/dist/esm/utils/Classname.js +20 -0
- package/dist/esm/utils/ColorHelper.d.ts +127 -0
- package/dist/esm/utils/ColorHelper.js +198 -0
- package/dist/esm/utils/DOMUtils.d.ts +142 -0
- package/dist/esm/utils/DOMUtils.js +759 -0
- package/dist/esm/utils/DateHelper.d.ts +115 -0
- package/dist/esm/utils/DateHelper.js +338 -0
- package/dist/esm/utils/Debugger.d.ts +12 -0
- package/dist/esm/utils/Debugger.js +30 -0
- package/dist/esm/utils/FileHelper.d.ts +8 -0
- package/dist/esm/utils/FileHelper.js +65 -0
- package/dist/esm/utils/FunctionStackManager.d.ts +13 -0
- package/dist/esm/utils/FunctionStackManager.js +59 -0
- package/dist/esm/utils/InputHelper.d.ts +37 -0
- package/dist/esm/utils/InputHelper.js +70 -0
- package/dist/esm/utils/MicroBuilder.d.ts +24 -0
- package/dist/esm/utils/MicroBuilder.js +61 -0
- package/dist/esm/utils/ObjectHelper.d.ts +51 -0
- package/dist/esm/utils/ObjectHelper.js +334 -0
- package/dist/esm/utils/StringHelper.d.ts +10 -0
- package/dist/esm/utils/StringHelper.js +54 -0
- package/dist/esm/utils/Subscriber.d.ts +14 -0
- package/dist/esm/utils/Subscriber.js +27 -0
- package/dist/esm/utils/Timer.d.ts +32 -0
- package/dist/esm/utils/Timer.js +68 -0
- package/dist/esm/utils/TypeChecker.d.ts +12 -0
- package/dist/esm/utils/TypeChecker.js +38 -0
- package/package.json +63 -0
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { PanelProps } from "./Panel";
|
|
3
|
+
import { ComponentBaseProps } from "../core/ComponentBaseProps";
|
|
4
|
+
export interface AccordionTabProps extends Partial<PanelProps> {
|
|
5
|
+
}
|
|
6
|
+
export type AccordionEventHandler = (index: number) => void;
|
|
7
|
+
export type AccordionChangeEventHandler = (opened: number[], closed: number[]) => void;
|
|
8
|
+
export interface AccordionManageRef {
|
|
9
|
+
expandAll: () => void;
|
|
10
|
+
collapseAll: () => void;
|
|
11
|
+
expand: (indexes: number[]) => void;
|
|
12
|
+
collapse: (indexes: number[]) => void;
|
|
13
|
+
}
|
|
14
|
+
export interface AccordionProps extends ComponentBaseProps<HTMLDivElement, AccordionManageRef> {
|
|
15
|
+
outlined: boolean;
|
|
16
|
+
multiple: boolean;
|
|
17
|
+
seperated: boolean;
|
|
18
|
+
borderless: boolean;
|
|
19
|
+
activeIndexes: number[];
|
|
20
|
+
children: React.ReactElement<AccordionTabProps> | React.ReactElement<AccordionTabProps>[];
|
|
21
|
+
onTabExpand: AccordionEventHandler;
|
|
22
|
+
onTabCollapse: AccordionEventHandler;
|
|
23
|
+
onTabChange: AccordionChangeEventHandler;
|
|
24
|
+
}
|
|
25
|
+
export declare const AccordionTab: ({ ref, ...props }: Partial<AccordionTabProps>) => React.JSX.Element;
|
|
26
|
+
export declare const Accordion: ({ ref, ...props }: Partial<AccordionProps>) => React.JSX.Element;
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Panel } from "./Panel";
|
|
3
|
+
import { Classname } from "../utils/Classname";
|
|
4
|
+
import { ObjectHelper } from "../utils/ObjectHelper";
|
|
5
|
+
import { MicroBuilder } from "../utils/MicroBuilder";
|
|
6
|
+
class AccordionTabComponent extends React.Component {
|
|
7
|
+
static defaultProps = {
|
|
8
|
+
collapsibleIcons: {
|
|
9
|
+
expand: "fa fa-angle-right",
|
|
10
|
+
collapse: "fa fa-angle-down",
|
|
11
|
+
},
|
|
12
|
+
};
|
|
13
|
+
render() {
|
|
14
|
+
const className = Classname.build('noseur-accordion-tab', { "noseur-disabled": this.props.disabled }, this.props.className);
|
|
15
|
+
const toggleElement = MicroBuilder.buildIcon((this.props.collapsed ? this.props.collapsibleIcons?.expand : this.props.collapsibleIcons?.collapse), { scheme: this.props.scheme, className: "noseur-accordion-tab-title-toggler" });
|
|
16
|
+
const title = (React.createElement("div", { className: "noseur-accordion-tab-title" },
|
|
17
|
+
toggleElement,
|
|
18
|
+
this.props.title));
|
|
19
|
+
return (React.createElement(Panel, { ...this.props, className: className, title: title, ref: this.props.forwardRef }));
|
|
20
|
+
}
|
|
21
|
+
;
|
|
22
|
+
}
|
|
23
|
+
class AccordionComponent extends React.Component {
|
|
24
|
+
static defaultProps = {
|
|
25
|
+
activeIndexes: [],
|
|
26
|
+
};
|
|
27
|
+
state = {
|
|
28
|
+
activeIndexes: this.props.activeIndexes ?? [],
|
|
29
|
+
childrenCount: this.props.children?.length ?? 0,
|
|
30
|
+
};
|
|
31
|
+
constructor(props) {
|
|
32
|
+
super(props);
|
|
33
|
+
this.expandCollapse = this.expandCollapse.bind(this);
|
|
34
|
+
}
|
|
35
|
+
componentDidMount() {
|
|
36
|
+
ObjectHelper.resolveManageRef(this, {
|
|
37
|
+
expandAll: () => this.expandCollapse("expand"),
|
|
38
|
+
collapseAll: () => this.expandCollapse("collapse"),
|
|
39
|
+
expand: (indexes) => this.expandCollapse("expand", indexes),
|
|
40
|
+
collapse: (indexes) => this.expandCollapse("collapse", indexes),
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
componentDidUpdate(_, prevState) {
|
|
44
|
+
const activeIndexes = this.state.activeIndexes;
|
|
45
|
+
const previousIndexes = prevState.activeIndexes;
|
|
46
|
+
const opened = activeIndexes.filter((i) => !previousIndexes.includes(i));
|
|
47
|
+
const closed = previousIndexes.filter((i) => !activeIndexes.includes(i));
|
|
48
|
+
this.props.onTabChange && this.props.onTabChange(opened, closed);
|
|
49
|
+
if (this.props.onTabCollapse && closed.length)
|
|
50
|
+
this.props.onTabCollapse(closed[0]);
|
|
51
|
+
if (this.props.onTabExpand && opened.length)
|
|
52
|
+
this.props.onTabExpand(opened[0]);
|
|
53
|
+
}
|
|
54
|
+
expandCollapse(type, indexes) {
|
|
55
|
+
if (this.props.disabled)
|
|
56
|
+
return;
|
|
57
|
+
let activeIndexes = ObjectHelper.clone(this.state.activeIndexes);
|
|
58
|
+
if (!indexes) {
|
|
59
|
+
activeIndexes = (type === "expand") ? [...Array(this.state.childrenCount).keys()] : [];
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
62
|
+
if (!indexes.length)
|
|
63
|
+
return;
|
|
64
|
+
if (!this.props.multiple) {
|
|
65
|
+
if (type === "expand")
|
|
66
|
+
activeIndexes = [];
|
|
67
|
+
indexes = [indexes[0]];
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
if (indexes)
|
|
71
|
+
indexes.forEach(index => {
|
|
72
|
+
const indexOfIndexLol = activeIndexes.indexOf(index);
|
|
73
|
+
if (type === "expand" && indexOfIndexLol === -1)
|
|
74
|
+
activeIndexes.push(index);
|
|
75
|
+
if (type === "collapse" && indexOfIndexLol > -1)
|
|
76
|
+
activeIndexes.splice(indexOfIndexLol, 1);
|
|
77
|
+
});
|
|
78
|
+
this.setState({ activeIndexes });
|
|
79
|
+
}
|
|
80
|
+
renderAccordionTab(panel, index) {
|
|
81
|
+
let activeIndexes = ObjectHelper.clone(this.state.activeIndexes);
|
|
82
|
+
const props = ObjectHelper.clone(panel.props);
|
|
83
|
+
const cachedOnHeaderClicked = props.onHeaderClick;
|
|
84
|
+
props.key = props.key ?? index;
|
|
85
|
+
props.collapsed = !activeIndexes.includes(index);
|
|
86
|
+
props.active = !props.collapsed;
|
|
87
|
+
props.scheme = props.scheme ?? this.props.scheme;
|
|
88
|
+
props.outlined = props.outlined ?? this.props.outlined;
|
|
89
|
+
props.disabled = props.disabled ?? this.props.disabled;
|
|
90
|
+
props.onHeaderClick = () => {
|
|
91
|
+
if (cachedOnHeaderClicked)
|
|
92
|
+
cachedOnHeaderClicked();
|
|
93
|
+
if (props.collapsed) {
|
|
94
|
+
if (this.props.multiple)
|
|
95
|
+
activeIndexes.push(index);
|
|
96
|
+
else
|
|
97
|
+
activeIndexes = [index];
|
|
98
|
+
}
|
|
99
|
+
else {
|
|
100
|
+
activeIndexes.splice(activeIndexes.indexOf(index), 1);
|
|
101
|
+
}
|
|
102
|
+
this.setState({
|
|
103
|
+
activeIndexes
|
|
104
|
+
});
|
|
105
|
+
};
|
|
106
|
+
return React.cloneElement(panel, props);
|
|
107
|
+
}
|
|
108
|
+
renderAccordionTabs() {
|
|
109
|
+
return React.Children.map(this.props.children, (panel, index) => {
|
|
110
|
+
if (panel.type !== AccordionTab) {
|
|
111
|
+
throw new Error("noseur.Accordion: Invalid child of Accordion component expecting AccordionTab only, found '" + panel.type + "'");
|
|
112
|
+
}
|
|
113
|
+
return this.renderAccordionTab(panel, index);
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
render() {
|
|
117
|
+
const panels = this.renderAccordionTabs();
|
|
118
|
+
const className = Classname.build("noseur-accordion", {
|
|
119
|
+
"noseur-accordion-seperated": this.props.seperated,
|
|
120
|
+
"noseur-accordion-bordered": !this.props.borderless && !this.props.seperated
|
|
121
|
+
}, (this.props.scheme ? `${this.props.scheme}-vars` : null), (this.props.scheme && this.props.outlined ? `${this.props.scheme}-vars-outlined` : null), this.props.className);
|
|
122
|
+
return (React.createElement("div", { className: className, ref: this.props.forwardRef, id: this.props.id, style: this.props.style }, panels));
|
|
123
|
+
}
|
|
124
|
+
;
|
|
125
|
+
}
|
|
126
|
+
export const AccordionTab = ({ ref, ...props }) => (React.createElement(AccordionTabComponent, { ...props, forwardRef: ref }));
|
|
127
|
+
export const Accordion = ({ ref, ...props }) => (React.createElement(AccordionComponent, { ...props, forwardRef: ref }));
|
|
@@ -0,0 +1,317 @@
|
|
|
1
|
+
/* Panel */
|
|
2
|
+
.noseur-panel {
|
|
3
|
+
display: flex;
|
|
4
|
+
border-radius: 5px;
|
|
5
|
+
flex-direction: column;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.noseur-panel-bordered {
|
|
9
|
+
border: var(--borderWidth, 1px) solid var(--noseurSchemeBorderColor, #E5E7EB);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.noseur-panel-header {
|
|
13
|
+
display: flex;
|
|
14
|
+
padding: 10px 15px;
|
|
15
|
+
border-top-left-radius: 5px;
|
|
16
|
+
border-top-right-radius: 5px;
|
|
17
|
+
justify-content: space-between;
|
|
18
|
+
color: var(--noseurSchemeAccentColor, inherit);
|
|
19
|
+
background-color: var(--noseurSchemeFixtureBackgroundColor, #f5f8fa);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.noseur-panel-header:hover {
|
|
23
|
+
filter: brightness(97%);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.noseur-panel-header-bordered {
|
|
27
|
+
border-bottom: var(--borderWidth, 1px) solid var(--noseurSchemeBorderColor, #E5E7EB);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.noseur-panel-header-only {
|
|
31
|
+
border-bottom-left-radius: 5px;
|
|
32
|
+
border-bottom-right-radius: 5px;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.noseur-panel-footer {
|
|
36
|
+
padding: 10px 15px;
|
|
37
|
+
border-bottom-left-radius: 5px;
|
|
38
|
+
border-bottom-right-radius: 5px;
|
|
39
|
+
color: var(--noseurSchemeAccentColor, inherit);
|
|
40
|
+
background-color: var(--noseurSchemeFixtureBackgroundColor, #f5f8fa);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.noseur-panel-footer-bordered {
|
|
44
|
+
border-top: var(--borderWidth, 1px) solid var(--noseurSchemeBorderColor, #E5E7EB);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.noseur-panel-footer-only {
|
|
48
|
+
border-top-left-radius: 5px;
|
|
49
|
+
border-top-right-radius: 5px;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/* Accordion */
|
|
53
|
+
.noseur-accordion {
|
|
54
|
+
display: flex;
|
|
55
|
+
border-radius: 5px;
|
|
56
|
+
flex-direction: column;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.noseur-accordion:not(.noseur-accordion-seperated) > .noseur-accordion-tab:not(:first-child):not(:last-child) {
|
|
60
|
+
border-radius: 0px;
|
|
61
|
+
}
|
|
62
|
+
.noseur-accordion:not(.noseur-accordion-seperated) > .noseur-accordion-tab:not(:first-child):not(:last-child) > .noseur-panel-header {
|
|
63
|
+
border-radius: 0px;
|
|
64
|
+
}
|
|
65
|
+
.noseur-accordion:not(.noseur-accordion-seperated) > .noseur-accordion-tab:first-child {
|
|
66
|
+
border-bottom-left-radius: 0px;
|
|
67
|
+
border-bottom-right-radius: 0px;
|
|
68
|
+
}
|
|
69
|
+
.noseur-accordion:not(.noseur-accordion-seperated) > .noseur-accordion-tab:first-child > .noseur-panel-header {
|
|
70
|
+
border-bottom-left-radius: 0px;
|
|
71
|
+
border-bottom-right-radius: 0px;
|
|
72
|
+
}
|
|
73
|
+
.noseur-accordion:not(.noseur-accordion-seperated) > .noseur-accordion-tab:last-child {
|
|
74
|
+
border-top-left-radius: 0px;
|
|
75
|
+
border-top-right-radius: 0px;
|
|
76
|
+
}
|
|
77
|
+
.noseur-accordion:not(.noseur-accordion-seperated) > .noseur-accordion-tab:last-child > .noseur-panel-header {
|
|
78
|
+
border-top-left-radius: 0px;
|
|
79
|
+
border-top-right-radius: 0px;
|
|
80
|
+
}
|
|
81
|
+
.noseur-accordion:not(.noseur-accordion-seperated) > .noseur-accordion-tab.noseur-panel-bordered:not(:last-child) {
|
|
82
|
+
border-bottom: 0px;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.noseur-accordion.noseur-accordion-seperated > .noseur-accordion-tab {
|
|
86
|
+
border-radius: 5px;
|
|
87
|
+
}
|
|
88
|
+
.noseur-accordion.noseur-accordion-seperated > .noseur-accordion-tab:not(:last-child) {
|
|
89
|
+
margin-bottom: var(--accordionSeperation, 5px);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.noseur-accordion-bordered {
|
|
93
|
+
border: var(--borderWidth, 1px) solid var(--noseurSchemeBorderColor, #E5E7EB);
|
|
94
|
+
}
|
|
95
|
+
.noseur-accordion-bordered > .noseur-panel-bordered {
|
|
96
|
+
border-left: none;
|
|
97
|
+
border-right: none;
|
|
98
|
+
}
|
|
99
|
+
.noseur-accordion-bordered > .noseur-panel-bordered:first-child {
|
|
100
|
+
border-top: none;
|
|
101
|
+
}
|
|
102
|
+
.noseur-accordion-bordered > .noseur-panel-bordered:last-child {
|
|
103
|
+
border-bottom: none;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
.noseur-accordion-tab > .noseur-panel-header {
|
|
107
|
+
cursor: pointer;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
.noseur-accordion-tab-title {
|
|
111
|
+
display: flex;
|
|
112
|
+
align-items: center;
|
|
113
|
+
justify-content: center;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
.noseur-accordion-tab-title > .noseur-accordion-tab-title-toggler {
|
|
117
|
+
width: 15px;
|
|
118
|
+
margin-right: 10px;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
/* TabPane */
|
|
122
|
+
.noseur-tabpane {
|
|
123
|
+
display: flex;
|
|
124
|
+
flex-direction: column;
|
|
125
|
+
}
|
|
126
|
+
.noseur-tabpane.noseur-tabpane-row {
|
|
127
|
+
flex-direction: row;
|
|
128
|
+
}
|
|
129
|
+
.noseur-tabpane {
|
|
130
|
+
/*&.noseur-tabpane-row>.noseur-tabpane-navigator>*,
|
|
131
|
+
&.noseur-tabpane-scrollable>.noseur-tabpane-navigator>* {
|
|
132
|
+
min-width: max-content;
|
|
133
|
+
}*/
|
|
134
|
+
}
|
|
135
|
+
.noseur-tabpane.noseur-tabpane-scrollable > .noseur-tabpane-navigator, .noseur-tabpane.noseur-tabpane-scrollable > .noseur-tabpane-navigator > .noseur-tabpane-headers {
|
|
136
|
+
position: relative;
|
|
137
|
+
}
|
|
138
|
+
.noseur-tabpane.noseur-tabpane-scrollable > .noseur-tabpane-navigator::-webkit-scrollbar, .noseur-tabpane.noseur-tabpane-scrollable > .noseur-tabpane-navigator::-webkit-scrollbar, .noseur-tabpane.noseur-tabpane-scrollable > .noseur-tabpane-navigator > .noseur-tabpane-headers::-webkit-scrollbar, .noseur-tabpane.noseur-tabpane-scrollable > .noseur-tabpane-navigator > .noseur-tabpane-headers::-webkit-scrollbar {
|
|
139
|
+
width: 0px;
|
|
140
|
+
height: 0px;
|
|
141
|
+
background: transparent;
|
|
142
|
+
}
|
|
143
|
+
.noseur-tabpane.noseur-tabpane-scrollable > .noseur-tabpane-navigator:not(.noseur-tabpane-navigator-left):not(.noseur-tabpane-navigator-right) > .noseur-tabpane-headers {
|
|
144
|
+
margin-left: var(--tabpaneNavigatorControlWidth, 3rem);
|
|
145
|
+
margin-right: var(--tabpaneNavigatorControlWidth, 3rem);
|
|
146
|
+
}
|
|
147
|
+
.noseur-tabpane.noseur-tabpane-scrollable > .noseur-tabpane-navigator.noseur-tabpane-navigator-left > .noseur-tabpane-headers, .noseur-tabpane.noseur-tabpane-scrollable > .noseur-tabpane-navigator.noseur-tabpane-navigator-right > .noseur-tabpane-headers {
|
|
148
|
+
margin-top: var(--tabpaneNavigatorControlWidth, 3rem);
|
|
149
|
+
margin-bottom: var(--tabpaneNavigatorControlWidth, 3rem);
|
|
150
|
+
}
|
|
151
|
+
.noseur-tabpane.noseur-tabpane-scrollable > .noseur-tabpane-navigator.noseur-tabpane-navigator-left > .noseur-tabpane-headers {
|
|
152
|
+
align-items: flex-end;
|
|
153
|
+
}
|
|
154
|
+
.noseur-tabpane.noseur-tabpane-scrollable > .noseur-tabpane-navigator.noseur-tabpane-navigator-right > .noseur-tabpane-headers {
|
|
155
|
+
align-items: flex-start;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
.noseur-tabpane-navigator {
|
|
159
|
+
display: flex;
|
|
160
|
+
overflow: auto;
|
|
161
|
+
}
|
|
162
|
+
.noseur-tabpane-navigator.noseur-tabpane-navigator-left > .noseur-tabpane-headers, .noseur-tabpane-navigator.noseur-tabpane-navigator-right > .noseur-tabpane-headers {
|
|
163
|
+
overflow: unset;
|
|
164
|
+
flex-direction: column;
|
|
165
|
+
}
|
|
166
|
+
.noseur-tabpane-navigator.noseur-tabpane-navigator-left > .noseur-tabpane-headers, .noseur-tabpane-navigator.noseur-tabpane-navigator-right > .noseur-tabpane-headers, .noseur-tabpane-navigator.noseur-tabpane-navigator-bottom-left > .noseur-tabpane-headers, .noseur-tabpane-navigator.noseur-tabpane-navigator-bottom-right > .noseur-tabpane-headers, .noseur-tabpane-navigator.noseur-tabpane-navigator-bottom-center > .noseur-tabpane-headers {
|
|
167
|
+
border-bottom: none;
|
|
168
|
+
}
|
|
169
|
+
.noseur-tabpane-navigator.noseur-tabpane-navigator-left.noseur-tabpane-navigator-bottom-left > .noseur-tabpane-headers, .noseur-tabpane-navigator.noseur-tabpane-navigator-left.noseur-tabpane-navigator-bottom-right > .noseur-tabpane-headers, .noseur-tabpane-navigator.noseur-tabpane-navigator-left.noseur-tabpane-navigator-bottom-center > .noseur-tabpane-headers, .noseur-tabpane-navigator.noseur-tabpane-navigator-right.noseur-tabpane-navigator-bottom-left > .noseur-tabpane-headers, .noseur-tabpane-navigator.noseur-tabpane-navigator-right.noseur-tabpane-navigator-bottom-right > .noseur-tabpane-headers, .noseur-tabpane-navigator.noseur-tabpane-navigator-right.noseur-tabpane-navigator-bottom-center > .noseur-tabpane-headers, .noseur-tabpane-navigator.noseur-tabpane-navigator-bottom-left.noseur-tabpane-navigator-bottom-left > .noseur-tabpane-headers, .noseur-tabpane-navigator.noseur-tabpane-navigator-bottom-left.noseur-tabpane-navigator-bottom-right > .noseur-tabpane-headers, .noseur-tabpane-navigator.noseur-tabpane-navigator-bottom-left.noseur-tabpane-navigator-bottom-center > .noseur-tabpane-headers, .noseur-tabpane-navigator.noseur-tabpane-navigator-bottom-right.noseur-tabpane-navigator-bottom-left > .noseur-tabpane-headers, .noseur-tabpane-navigator.noseur-tabpane-navigator-bottom-right.noseur-tabpane-navigator-bottom-right > .noseur-tabpane-headers, .noseur-tabpane-navigator.noseur-tabpane-navigator-bottom-right.noseur-tabpane-navigator-bottom-center > .noseur-tabpane-headers, .noseur-tabpane-navigator.noseur-tabpane-navigator-bottom-center.noseur-tabpane-navigator-bottom-left > .noseur-tabpane-headers, .noseur-tabpane-navigator.noseur-tabpane-navigator-bottom-center.noseur-tabpane-navigator-bottom-right > .noseur-tabpane-headers, .noseur-tabpane-navigator.noseur-tabpane-navigator-bottom-center.noseur-tabpane-navigator-bottom-center > .noseur-tabpane-headers {
|
|
170
|
+
border-top: var(--borderWidth, 1px) solid var(--noseurSchemeBorderColor, #EEF0F8);
|
|
171
|
+
}
|
|
172
|
+
.noseur-tabpane-navigator.noseur-tabpane-navigator-left.noseur-tabpane-navigator-bottom-left > .noseur-tabpane-control, .noseur-tabpane-navigator.noseur-tabpane-navigator-left.noseur-tabpane-navigator-bottom-right > .noseur-tabpane-control, .noseur-tabpane-navigator.noseur-tabpane-navigator-left.noseur-tabpane-navigator-bottom-center > .noseur-tabpane-control, .noseur-tabpane-navigator.noseur-tabpane-navigator-right.noseur-tabpane-navigator-bottom-left > .noseur-tabpane-control, .noseur-tabpane-navigator.noseur-tabpane-navigator-right.noseur-tabpane-navigator-bottom-right > .noseur-tabpane-control, .noseur-tabpane-navigator.noseur-tabpane-navigator-right.noseur-tabpane-navigator-bottom-center > .noseur-tabpane-control, .noseur-tabpane-navigator.noseur-tabpane-navigator-bottom-left.noseur-tabpane-navigator-bottom-left > .noseur-tabpane-control, .noseur-tabpane-navigator.noseur-tabpane-navigator-bottom-left.noseur-tabpane-navigator-bottom-right > .noseur-tabpane-control, .noseur-tabpane-navigator.noseur-tabpane-navigator-bottom-left.noseur-tabpane-navigator-bottom-center > .noseur-tabpane-control, .noseur-tabpane-navigator.noseur-tabpane-navigator-bottom-right.noseur-tabpane-navigator-bottom-left > .noseur-tabpane-control, .noseur-tabpane-navigator.noseur-tabpane-navigator-bottom-right.noseur-tabpane-navigator-bottom-right > .noseur-tabpane-control, .noseur-tabpane-navigator.noseur-tabpane-navigator-bottom-right.noseur-tabpane-navigator-bottom-center > .noseur-tabpane-control, .noseur-tabpane-navigator.noseur-tabpane-navigator-bottom-center.noseur-tabpane-navigator-bottom-left > .noseur-tabpane-control, .noseur-tabpane-navigator.noseur-tabpane-navigator-bottom-center.noseur-tabpane-navigator-bottom-right > .noseur-tabpane-control, .noseur-tabpane-navigator.noseur-tabpane-navigator-bottom-center.noseur-tabpane-navigator-bottom-center > .noseur-tabpane-control {
|
|
173
|
+
border-bottom: var(--borderWidth, 1px) solid var(--noseurSchemeBorderColor, #EEF0F8);
|
|
174
|
+
}
|
|
175
|
+
.noseur-tabpane-navigator.noseur-tabpane-navigator-left.noseur-tabpane-navigator-left > .noseur-tabpane-headers, .noseur-tabpane-navigator.noseur-tabpane-navigator-right.noseur-tabpane-navigator-left > .noseur-tabpane-headers, .noseur-tabpane-navigator.noseur-tabpane-navigator-bottom-left.noseur-tabpane-navigator-left > .noseur-tabpane-headers, .noseur-tabpane-navigator.noseur-tabpane-navigator-bottom-right.noseur-tabpane-navigator-left > .noseur-tabpane-headers, .noseur-tabpane-navigator.noseur-tabpane-navigator-bottom-center.noseur-tabpane-navigator-left > .noseur-tabpane-headers {
|
|
176
|
+
border-right: var(--borderWidth, 1px) solid var(--noseurSchemeBorderColor, #EEF0F8);
|
|
177
|
+
}
|
|
178
|
+
.noseur-tabpane-navigator.noseur-tabpane-navigator-left.noseur-tabpane-navigator-right > .noseur-tabpane-headers, .noseur-tabpane-navigator.noseur-tabpane-navigator-right.noseur-tabpane-navigator-right > .noseur-tabpane-headers, .noseur-tabpane-navigator.noseur-tabpane-navigator-bottom-left.noseur-tabpane-navigator-right > .noseur-tabpane-headers, .noseur-tabpane-navigator.noseur-tabpane-navigator-bottom-right.noseur-tabpane-navigator-right > .noseur-tabpane-headers, .noseur-tabpane-navigator.noseur-tabpane-navigator-bottom-center.noseur-tabpane-navigator-right > .noseur-tabpane-headers {
|
|
179
|
+
border-left: var(--borderWidth, 1px) solid var(--noseurSchemeBorderColor, #EEF0F8);
|
|
180
|
+
}
|
|
181
|
+
.noseur-tabpane-navigator.noseur-tabpane-navigator-top-left > .noseur-tabpane-control, .noseur-tabpane-navigator.noseur-tabpane-navigator-top-right > .noseur-tabpane-control, .noseur-tabpane-navigator.noseur-tabpane-navigator-top-center > .noseur-tabpane-control {
|
|
182
|
+
border-top: var(--borderWidth, 1px) solid var(--noseurSchemeBorderColor, #EEF0F8);
|
|
183
|
+
}
|
|
184
|
+
.noseur-tabpane-navigator.noseur-tabpane-navigator-top-right > .noseur-tabpane-headers, .noseur-tabpane-navigator.noseur-tabpane-navigator-bottom-right > .noseur-tabpane-headers {
|
|
185
|
+
justify-content: flex-end;
|
|
186
|
+
}
|
|
187
|
+
.noseur-tabpane-navigator.noseur-tabpane-navigator-top-center > .noseur-tabpane-headers, .noseur-tabpane-navigator.noseur-tabpane-navigator-bottom-center > .noseur-tabpane-headers {
|
|
188
|
+
justify-content: center;
|
|
189
|
+
}
|
|
190
|
+
.noseur-tabpane-navigator.noseur-tabpane-navigator-left > .noseur-tabpane-control, .noseur-tabpane-navigator.noseur-tabpane-navigator-right > .noseur-tabpane-control {
|
|
191
|
+
width: calc(100% - var(--borderWidth, 1px));
|
|
192
|
+
height: var(--tabpaneNavigatorControlWidth, 3rem);
|
|
193
|
+
}
|
|
194
|
+
.noseur-tabpane-navigator.noseur-tabpane-navigator-left > .noseur-tabpane-control.noseur-tabpane-control-l, .noseur-tabpane-navigator.noseur-tabpane-navigator-right > .noseur-tabpane-control.noseur-tabpane-control-l {
|
|
195
|
+
border-right: unset;
|
|
196
|
+
border-left: var(--borderWidth, 1px) solid var(--noseurSchemeBorderColor, #EEF0F8);
|
|
197
|
+
border-bottom: var(--borderWidth, 1px) solid var(--noseurSchemeBorderColor, #EEF0F8);
|
|
198
|
+
}
|
|
199
|
+
.noseur-tabpane-navigator.noseur-tabpane-navigator-left > .noseur-tabpane-control.noseur-tabpane-control-r, .noseur-tabpane-navigator.noseur-tabpane-navigator-right > .noseur-tabpane-control.noseur-tabpane-control-r {
|
|
200
|
+
left: 0;
|
|
201
|
+
bottom: 0;
|
|
202
|
+
top: unset;
|
|
203
|
+
border-top: var(--borderWidth, 1px) solid var(--noseurSchemeBorderColor, #EEF0F8);
|
|
204
|
+
}
|
|
205
|
+
.noseur-tabpane-navigator.noseur-tabpane-navigator-left > .noseur-tabpane-control-l, .noseur-tabpane-navigator.noseur-tabpane-navigator-left > .noseur-tabpane-control-r {
|
|
206
|
+
border-left: var(--borderWidth, 1px) solid var(--noseurSchemeBorderColor, #EEF0F8);
|
|
207
|
+
}
|
|
208
|
+
.noseur-tabpane-navigator.noseur-tabpane-navigator-right > .noseur-tabpane-control-l, .noseur-tabpane-navigator.noseur-tabpane-navigator-right > .noseur-tabpane-control-r {
|
|
209
|
+
width: calc(100% - 2px);
|
|
210
|
+
border-left: unset !important;
|
|
211
|
+
border-right: var(--borderWidth, 1px) solid var(--noseurSchemeBorderColor, #EEF0F8) !important;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
.noseur-tabpane-control {
|
|
215
|
+
top: 0;
|
|
216
|
+
z-index: 1;
|
|
217
|
+
cursor: pointer;
|
|
218
|
+
position: absolute;
|
|
219
|
+
align-items: center;
|
|
220
|
+
justify-content: center;
|
|
221
|
+
display: flex !important;
|
|
222
|
+
height: calc(100% - var(--borderWidth, 1px));
|
|
223
|
+
width: var(--tabpaneNavigatorControlWidth, 3rem);
|
|
224
|
+
background-color: var(--tabpaneNavigatorBackgroundColor, inherit);
|
|
225
|
+
}
|
|
226
|
+
.noseur-tabpane-control.noseur-tabpane-control-l {
|
|
227
|
+
border-right: var(--borderWidth, 1px) solid var(--noseurSchemeBorderColor, #EEF0F8);
|
|
228
|
+
}
|
|
229
|
+
.noseur-tabpane-control.noseur-tabpane-control-r {
|
|
230
|
+
right: 0;
|
|
231
|
+
border-left: var(--borderWidth, 1px) solid var(--noseurSchemeBorderColor, #EEF0F8);
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
.noseur-tabpane-control:hover {
|
|
235
|
+
filter: brightness(97%);
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
.noseur-tabpane-headers {
|
|
239
|
+
flex: 1;
|
|
240
|
+
display: flex;
|
|
241
|
+
overflow: auto;
|
|
242
|
+
scroll-behavior: smooth;
|
|
243
|
+
overscroll-behavior: contain auto;
|
|
244
|
+
border-bottom: var(--borderWidth, 1px) solid var(--noseurSchemeBorderColor, #EEF0F8);
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
.noseur-tabpanel-header {
|
|
248
|
+
border: none;
|
|
249
|
+
border-radius: 0px;
|
|
250
|
+
align-items: flex-end;
|
|
251
|
+
min-width: fit-content;
|
|
252
|
+
outline: none !important;
|
|
253
|
+
box-shadow: none !important;
|
|
254
|
+
}
|
|
255
|
+
.noseur-tabpanel-header:hover, .noseur-tabpanel-header.noseur-active {
|
|
256
|
+
font-weight: 450;
|
|
257
|
+
}
|
|
258
|
+
.noseur-tabpanel-header.noseur-active:not(.noseur-tabpanel-noline), .noseur-tabpanel-header:not(.noseur-active):not(.noseur-tabpanel-noline):hover {
|
|
259
|
+
border-bottom: 2px solid var(--noseurSchemeMainColor, #EEF0F8);
|
|
260
|
+
}
|
|
261
|
+
.noseur-tabpanel-header.noseur-skeleton {
|
|
262
|
+
margin: 0px 2px;
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
.noseur-tabpane-content {
|
|
266
|
+
flex: 1;
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
/* ScrollPanel */
|
|
270
|
+
.noseur-scrollpanel {
|
|
271
|
+
overflow: auto;
|
|
272
|
+
box-sizing: border-box;
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
.noseur-scrollpanel::-webkit-scrollbar {
|
|
276
|
+
height: 10px;
|
|
277
|
+
cursor: pointer;
|
|
278
|
+
width: var(--scrollTrackWidth, 10px);
|
|
279
|
+
background-color: rgba(0, 0, 0, 0.1);
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
.noseur-scrollpanel::-webkit-scrollbar-track {
|
|
283
|
+
cursor: pointer;
|
|
284
|
+
background-color: var(--scrollTrackBg, transparent);
|
|
285
|
+
border-radius: var(--scrollTrackBorderRadius, 10px);
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
.noseur-scrollpanel::-webkit-scrollbar-thumb {
|
|
289
|
+
cursor: pointer;
|
|
290
|
+
border-radius: var(--scrollThumbBorderRadius, 10px);
|
|
291
|
+
background-color: var(--scrollThumbBg, var(--noseurSchemeMainColor, rgb(193, 193, 193)));
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
.noseur-scrollpanel::-webkit-scrollbar-corner {
|
|
295
|
+
cursor: pointer;
|
|
296
|
+
background-color: transparent;
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
.noseur-scrollpanel-hidden-scrollbar-x::-webkit-scrollbar {
|
|
300
|
+
height: 0;
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
.noseur-scrollpanel-hidden-scrollbar-y::-webkit-scrollbar {
|
|
304
|
+
width: 0;
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
.noseur-scrollpanel-always-show-scrollbars {
|
|
308
|
+
overflow: scroll;
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
.noseur-scrollpanel-always-show-scrollbar-x {
|
|
312
|
+
overflow-x: scroll;
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
.noseur-scrollpanel-always-show-scrollbar-y {
|
|
316
|
+
overflow-x: scroll;
|
|
317
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import "./Panel.css";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { NoseurElement, NoseurLabel } from "../constants/Types";
|
|
4
|
+
import { ComponentBaseProps, ComponentElementBasicAttributes, TransitionProps } from "../core/ComponentBaseProps";
|
|
5
|
+
export interface PanelFixtureOptions {
|
|
6
|
+
className: string;
|
|
7
|
+
props: PanelProps;
|
|
8
|
+
collapsed: boolean;
|
|
9
|
+
titleElement: NoseurElement;
|
|
10
|
+
toggleElement: NoseurElement;
|
|
11
|
+
onClick: PanelFixtureEventHandler;
|
|
12
|
+
onToggle: (collapsed?: boolean) => void;
|
|
13
|
+
attrRelays: ComponentElementBasicAttributes;
|
|
14
|
+
}
|
|
15
|
+
export type PanelFixtureTemplate = (options?: PanelFixtureOptions) => NoseurElement;
|
|
16
|
+
export type PanelFixtureEventHandler = (manageRef?: PanelManageRef) => boolean | void | undefined;
|
|
17
|
+
export type PannelAttributesRelays = {
|
|
18
|
+
header?: ComponentElementBasicAttributes;
|
|
19
|
+
footer?: ComponentElementBasicAttributes;
|
|
20
|
+
content?: ComponentElementBasicAttributes & Partial<TransitionProps>;
|
|
21
|
+
};
|
|
22
|
+
export interface PanelManageRef {
|
|
23
|
+
expand: () => void;
|
|
24
|
+
collapse: () => void;
|
|
25
|
+
toggle: (collapsed?: boolean) => void;
|
|
26
|
+
}
|
|
27
|
+
export interface PanelProps extends ComponentBaseProps<HTMLDivElement, PanelManageRef, PannelAttributesRelays> {
|
|
28
|
+
active: boolean;
|
|
29
|
+
outlined: boolean;
|
|
30
|
+
title: NoseurLabel;
|
|
31
|
+
collapsed: boolean;
|
|
32
|
+
borderless: boolean;
|
|
33
|
+
collapsible: boolean;
|
|
34
|
+
collapsibleIcons: {
|
|
35
|
+
expand: NoseurElement;
|
|
36
|
+
collapse: NoseurElement;
|
|
37
|
+
};
|
|
38
|
+
header: PanelFixtureTemplate;
|
|
39
|
+
footer: PanelFixtureTemplate;
|
|
40
|
+
onHeaderClick: PanelFixtureEventHandler;
|
|
41
|
+
onFooterClick: PanelFixtureEventHandler;
|
|
42
|
+
}
|
|
43
|
+
export declare const Panel: ({ ref, ...props }: Partial<PanelProps>) => React.JSX.Element;
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import "./Panel.css";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { Scheme } from "../constants/Scheme";
|
|
4
|
+
import { Classname } from "../utils/Classname";
|
|
5
|
+
import { BoolHelper } from "../utils/BoolHelper";
|
|
6
|
+
import { MicroBuilder } from "../utils/MicroBuilder";
|
|
7
|
+
import { Transition } from "../constants/Transition";
|
|
8
|
+
import { ObjectHelper } from "../utils/ObjectHelper";
|
|
9
|
+
import { CSSTransition } from 'react-transition-group';
|
|
10
|
+
class PanelComponent extends React.Component {
|
|
11
|
+
static defaultProps = {
|
|
12
|
+
collapsibleIcons: {
|
|
13
|
+
expand: "fa fa-plus",
|
|
14
|
+
collapse: "fa fa-minus",
|
|
15
|
+
},
|
|
16
|
+
attrsRelay: {
|
|
17
|
+
content: {
|
|
18
|
+
transition: Transition.CURTAIN
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
state = {
|
|
23
|
+
collapsed: this.props.collapsed,
|
|
24
|
+
};
|
|
25
|
+
manageRef;
|
|
26
|
+
transitionNodeRef;
|
|
27
|
+
constructor(props) {
|
|
28
|
+
super(props);
|
|
29
|
+
this.onToggle = this.onToggle.bind(this);
|
|
30
|
+
this.isCollapsed = this.isCollapsed.bind(this);
|
|
31
|
+
this.transitionNodeRef = React.createRef();
|
|
32
|
+
}
|
|
33
|
+
componentDidMount() {
|
|
34
|
+
this.manageRef = {
|
|
35
|
+
toggle: this.onToggle,
|
|
36
|
+
expand: () => this.onToggle(false),
|
|
37
|
+
collapse: () => this.onToggle(true),
|
|
38
|
+
};
|
|
39
|
+
ObjectHelper.resolveManageRef(this, this.manageRef);
|
|
40
|
+
}
|
|
41
|
+
componentDidUpdate(prevProps, _) {
|
|
42
|
+
if (prevProps.collapsed !== this.props.collapsed) {
|
|
43
|
+
this.setState({ collapsed: this.props.collapsed });
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
componentWillUnmount() {
|
|
47
|
+
if (!this.manageRef)
|
|
48
|
+
return;
|
|
49
|
+
this.manageRef = undefined;
|
|
50
|
+
}
|
|
51
|
+
onToggle(collapsed) {
|
|
52
|
+
collapsed = collapsed ?? !this.state.collapsed;
|
|
53
|
+
this.setState({ collapsed });
|
|
54
|
+
}
|
|
55
|
+
isCollapsed() {
|
|
56
|
+
return this.state.collapsed;
|
|
57
|
+
}
|
|
58
|
+
renderFixture(type, collapsed, fixtureTemplate) {
|
|
59
|
+
if (!fixtureTemplate && ((type === "header" && !(this.props.title || this.props.collapsible)) || type === "footer"))
|
|
60
|
+
return null;
|
|
61
|
+
const buildFixtureComponents = !!fixtureTemplate || type === "header";
|
|
62
|
+
const onClick = type === "header" ? this.props.onHeaderClick : this.props.onFooterClick;
|
|
63
|
+
const attrRelays = (this.props.attrsRelay && type in this.props.attrsRelay) ? this.props.attrsRelay[type] : null;
|
|
64
|
+
const scheme = attrRelays?.scheme ?? this.props.scheme;
|
|
65
|
+
const titleElement = buildFixtureComponents ? MicroBuilder.buildLabel(this.props.title) : null;
|
|
66
|
+
const toggleElement = buildFixtureComponents ? MicroBuilder.buildIcon((collapsed ? this.props.collapsibleIcons.expand : this.props.collapsibleIcons.collapse), { scheme, className: "noseur-cursor-pointer" }, { onClick: () => this.onToggle() }) : null;
|
|
67
|
+
const className = Classname.build(`noseur-panel-${type}`, {
|
|
68
|
+
'active': this.props.active,
|
|
69
|
+
'noseur-skeleton': scheme === Scheme.SKELETON,
|
|
70
|
+
'noseur-panel-header-only': type === "header" && collapsed && !this.props.footer,
|
|
71
|
+
'noseur-panel-footer-only': type === "footer" && collapsed && !this.props.header,
|
|
72
|
+
'noseur-panel-footer-bordered': type === "footer" && !this.props.borderless && !collapsed,
|
|
73
|
+
'noseur-panel-header-bordered': type === "header" && !this.props.borderless && (!collapsed || (collapsed && this.props.footer)),
|
|
74
|
+
}, attrRelays?.className);
|
|
75
|
+
if (fixtureTemplate)
|
|
76
|
+
return fixtureTemplate({
|
|
77
|
+
onClick,
|
|
78
|
+
className,
|
|
79
|
+
collapsed,
|
|
80
|
+
attrRelays,
|
|
81
|
+
titleElement,
|
|
82
|
+
toggleElement,
|
|
83
|
+
props: this.props,
|
|
84
|
+
onToggle: this.onToggle,
|
|
85
|
+
});
|
|
86
|
+
return (React.createElement("div", { key: `noseur-panel-${type}`, className: className, style: attrRelays?.style, id: attrRelays?.id, onClick: onClick ? () => {
|
|
87
|
+
const result = onClick(this.manageRef);
|
|
88
|
+
if (result === true || result === false)
|
|
89
|
+
this.onToggle(result);
|
|
90
|
+
} : undefined },
|
|
91
|
+
titleElement,
|
|
92
|
+
this.props.collapsible ? toggleElement : null));
|
|
93
|
+
}
|
|
94
|
+
renderContent(collapsed) {
|
|
95
|
+
const attrRelays = this.props.attrsRelay?.content;
|
|
96
|
+
const transitionTimeout = attrRelays?.transitionTimeout ?? 500;
|
|
97
|
+
const className = Classname.build("noseur-panel-content", attrRelays?.className);
|
|
98
|
+
const children = !this.props.children || this.props.scheme != Scheme.SKELETON ? this.props.children : React.Children.map(this.props.children, (child) => {
|
|
99
|
+
if (!React.isValidElement(child) || child === null || child === undefined)
|
|
100
|
+
return child;
|
|
101
|
+
const childProps = ObjectHelper.clone(child.props);
|
|
102
|
+
const isPanelComponent = BoolHelper.equalsAny(child.type, [Panel /*, TabPane, Checkbox*/]);
|
|
103
|
+
childProps.scheme = Scheme.SKELETON;
|
|
104
|
+
childProps.className = Classname.build(childProps.className, !isPanelComponent ? "noseur-skeleton" : null);
|
|
105
|
+
return React.cloneElement(child, childProps);
|
|
106
|
+
});
|
|
107
|
+
return (React.createElement(CSSTransition, { nodeRef: this.transitionNodeRef, classNames: attrRelays?.transition, timeout: transitionTimeout, options: attrRelays?.transitionOptions, in: !collapsed, unmountOnExit: true },
|
|
108
|
+
React.createElement("div", { className: className, id: attrRelays?.id, style: attrRelays?.style, ref: this.transitionNodeRef }, children)));
|
|
109
|
+
}
|
|
110
|
+
render() {
|
|
111
|
+
const collapsed = this.isCollapsed();
|
|
112
|
+
const content = this.renderContent(collapsed);
|
|
113
|
+
const className = Classname.build("noseur-panel", {
|
|
114
|
+
"noseur-panel-bordered": !this.props.borderless
|
|
115
|
+
}, (this.props.scheme && this.props.outlined ? `${this.props.scheme}-vars-outlined` : null), (this.props.scheme ? `${this.props.scheme}-vars` : null), this.props.className);
|
|
116
|
+
const header = this.renderFixture("header", collapsed, this.props.header);
|
|
117
|
+
const footer = this.renderFixture("footer", collapsed, this.props.footer);
|
|
118
|
+
return (React.createElement("div", { className: className, ref: this.props.forwardRef, id: this.props.id, style: this.props.style },
|
|
119
|
+
header,
|
|
120
|
+
content,
|
|
121
|
+
footer));
|
|
122
|
+
}
|
|
123
|
+
;
|
|
124
|
+
}
|
|
125
|
+
export const Panel = ({ ref, ...props }) => (React.createElement(PanelComponent, { ...props, forwardRef: ref }));
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { ComponentBaseProps } from "../core/ComponentBaseProps";
|
|
3
|
+
export type ScrollPanelOnSubmitEventHandler = (event?: any) => void;
|
|
4
|
+
export interface ScrollPanelManageRef {
|
|
5
|
+
scrollUp: () => void;
|
|
6
|
+
scrollLeft: () => void;
|
|
7
|
+
scrollDown: () => void;
|
|
8
|
+
scrollRight: () => void;
|
|
9
|
+
}
|
|
10
|
+
export interface ScrollPanelProps extends ComponentBaseProps<HTMLDivElement, ScrollPanelManageRef> {
|
|
11
|
+
isForm: boolean;
|
|
12
|
+
alwaysScroll: boolean;
|
|
13
|
+
alwaysScrollX: boolean;
|
|
14
|
+
alwaysScrollY: boolean;
|
|
15
|
+
hideScrollBars: boolean;
|
|
16
|
+
hideScrollBarX: boolean;
|
|
17
|
+
hideScrollBarY: boolean;
|
|
18
|
+
scroller: Partial<{
|
|
19
|
+
trackBg: string;
|
|
20
|
+
thumbBg: string;
|
|
21
|
+
trackWidth: number;
|
|
22
|
+
trackBorderRadius: number;
|
|
23
|
+
thumbBorderRadius: number;
|
|
24
|
+
}>;
|
|
25
|
+
onSubmit: ScrollPanelOnSubmitEventHandler;
|
|
26
|
+
}
|
|
27
|
+
export declare const ScrollPanel: ({ ref, ...props }: Partial<ScrollPanelProps>) => React.JSX.Element;
|