2023-10-02 10:46:09 +00:00
|
|
|
import BaseStyle from 'primevue/base/style';
|
|
|
|
|
2024-05-01 08:26:48 +00:00
|
|
|
const theme = ({ dt }) => `
|
|
|
|
.p-organizationchart-table {
|
|
|
|
border-spacing: 0;
|
|
|
|
border-collapse: separate;
|
|
|
|
margin: 0 auto;
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-organizationchart-table > tbody > tr > td {
|
|
|
|
text-align: center;
|
|
|
|
vertical-align: top;
|
2024-05-11 23:38:12 +00:00
|
|
|
padding: 0 ${dt('organizationchart.gutter')};
|
2024-05-01 08:26:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.p-organizationchart-node {
|
|
|
|
display: inline-block;
|
|
|
|
position: relative;
|
|
|
|
border: 1px solid ${dt('organizationchart.node.border.color')};
|
|
|
|
background: ${dt('organizationchart.node.background')};
|
|
|
|
color: ${dt('organizationchart.node.color')};
|
2024-05-11 23:38:12 +00:00
|
|
|
padding: ${dt('organizationchart.node.padding')};
|
|
|
|
border-radius: ${dt('organizationchart.node.border.radius')};
|
2024-05-25 08:18:55 +00:00
|
|
|
transition: background ${dt('organizationchart.transition.duration')}, border-color ${dt('organizationchart.transition.duration')}, color ${dt('organizationchart.transition.duration')}, box-shadow ${dt('organizationchart.transition.duration')};
|
2024-05-01 08:26:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.p-organizationchart-node:has(.p-organizationchart-node-toggle-button) {
|
2024-05-11 23:38:12 +00:00
|
|
|
padding: ${dt('organizationchart.node.toggleable.padding')};
|
2024-05-01 08:26:48 +00:00
|
|
|
}
|
|
|
|
|
2024-05-11 23:38:12 +00:00
|
|
|
.p-organizationchart-node.p-organizationchart-node-selectable:not(.p-organizationchart-node-selected):hover {
|
2024-05-01 08:26:48 +00:00
|
|
|
background: ${dt('organizationchart.node.hover.background')};
|
|
|
|
color: ${dt('organizationchart.node.hover.color')};
|
|
|
|
}
|
|
|
|
|
2024-05-11 23:38:12 +00:00
|
|
|
.p-organizationchart-node-selected {
|
|
|
|
background: ${dt('organizationchart.node.selected.background')};
|
|
|
|
color: ${dt('organizationchart.node.selected.color')};
|
2024-05-01 08:26:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.p-organizationchart-node-toggle-button {
|
|
|
|
position: absolute;
|
2024-05-11 23:38:12 +00:00
|
|
|
bottom: calc(-1 * calc(${dt('organizationchart.node.toggle.button.size')} / 2));
|
|
|
|
margin-left: calc(-1 * calc(${dt('organizationchart.node.toggle.button.size')} / 2));
|
2024-05-01 08:26:48 +00:00
|
|
|
z-index: 2;
|
|
|
|
left: 50%;
|
|
|
|
user-select: none;
|
|
|
|
cursor: pointer;
|
2024-05-11 23:38:12 +00:00
|
|
|
width: ${dt('organizationchart.node.toggle.button.size')};
|
|
|
|
height: ${dt('organizationchart.node.toggle.button.size')};
|
2024-05-01 08:26:48 +00:00
|
|
|
text-decoration: none;
|
2024-05-04 21:57:50 +00:00
|
|
|
background: ${dt('organizationchart.node.toggle.button.background')};
|
|
|
|
color: ${dt('organizationchart.node.toggle.button.color')};
|
2024-05-11 23:38:12 +00:00
|
|
|
border-radius: ${dt('organizationchart.node.toggle.button.border.radius')};
|
2024-05-04 21:57:50 +00:00
|
|
|
border: 1px solid ${dt('organizationchart.node.toggle.button.border.color')};
|
2024-05-01 08:26:48 +00:00
|
|
|
display: inline-flex;
|
|
|
|
justify-content: center;
|
|
|
|
align-items: center;
|
|
|
|
outline-color: transparent;
|
2024-05-25 08:18:55 +00:00
|
|
|
transition: background ${dt('organizationchart.transition.duration')}, color ${dt('organizationchart.transition.duration')}, border-color ${dt('organizationchart.transition.duration')}, outline-color ${dt('organizationchart.transition.duration')}, box-shadow ${dt('organizationchart.transition.duration')};
|
2024-05-11 23:38:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.p-organizationchart-node-toggle-button:hover {
|
|
|
|
background: ${dt('organizationchart.node.toggle.button.hover.background')};
|
|
|
|
color: ${dt('organizationchart.node.toggle.button.hover.color')};
|
2024-05-01 08:26:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.p-organizationchart-node-toggle-button:focus-visible {
|
2024-05-11 23:38:12 +00:00
|
|
|
box-shadow: ${dt('breadcrumb.item.focus.ring.shadow')};
|
|
|
|
outline: ${dt('breadcrumb.item.focus.ring.width')} ${dt('breadcrumb.item.focus.ring.style')} ${dt('breadcrumb.item.focus.ring.color')};
|
|
|
|
outline-offset: ${dt('breadcrumb.item.focus.ring.offset')};
|
2024-05-01 08:26:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.p-organizationchart-node-toggle-button-icon {
|
|
|
|
position: relative;
|
|
|
|
top: 1px;
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-organizationchart-connector-down {
|
|
|
|
margin: 0 auto;
|
2024-05-11 23:38:12 +00:00
|
|
|
height: ${dt('organizationchart.connector.height')};
|
2024-05-01 08:26:48 +00:00
|
|
|
width: 1px;
|
|
|
|
background: ${dt('organizationchart.connector.color')};
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-organizationchart-connector-right {
|
|
|
|
border-radius: 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-organizationchart-connector-left {
|
|
|
|
border-radius: 0;
|
|
|
|
border-right: 1px solid ${dt('organizationchart.connector.color')};
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-organizationchart-connector-top {
|
|
|
|
border-top: 1px solid ${dt('organizationchart.connector.color')};
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-organizationchart-node-selectable {
|
|
|
|
cursor: pointer;
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-organizationchart-connectors :nth-child(1 of .p-organizationchart-connector-left) {
|
|
|
|
border-right: 0 none;
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-organizationchart-connectors :nth-last-child(1 of .p-organizationchart-connector-left) {
|
2024-05-11 23:38:12 +00:00
|
|
|
border-top-right-radius: ${dt('organizationchart.connector.border.radius')};
|
2024-05-01 08:26:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.p-organizationchart-connectors :nth-child(1 of .p-organizationchart-connector-right) {
|
|
|
|
border-left: 1px solid ${dt('organizationchart.connector.color')};
|
2024-05-11 23:38:12 +00:00
|
|
|
border-top-left-radius: ${dt('organizationchart.connector.border.radius')};
|
2024-05-01 08:26:48 +00:00
|
|
|
}
|
|
|
|
`;
|
|
|
|
|
2023-10-02 10:46:09 +00:00
|
|
|
const classes = {
|
|
|
|
root: 'p-organizationchart p-component',
|
|
|
|
table: 'p-organizationchart-table',
|
2024-05-11 23:38:12 +00:00
|
|
|
node: ({ instance }) => ['p-organizationchart-node', { 'p-organizationchart-node-selectable': instance.selectable, 'p-organizationchart-node-selected': instance.selected }],
|
2024-05-02 06:27:51 +00:00
|
|
|
nodeToggleButton: 'p-organizationchart-node-toggle-button',
|
|
|
|
nodeToggleButtonIcon: 'p-organizationchart-node-toggle-button-icon',
|
|
|
|
connectors: 'p-organizationchart-connectors',
|
|
|
|
connectorDown: 'p-organizationchart-connector-down',
|
|
|
|
connectorLeft: ({ index }) => ['p-organizationchart-connector-left', { 'p-organizationchart-connector-top': !(index === 0) }],
|
|
|
|
connectorRight: ({ props, index }) => ['p-organizationchart-connector-right', { 'p-organizationchart-connector-top': !(index === props.node.children.length - 1) }],
|
|
|
|
nodeChildren: 'p-organizationchart-node-children'
|
2023-10-02 10:46:09 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
export default BaseStyle.extend({
|
|
|
|
name: 'organizationchart',
|
2024-05-01 08:26:48 +00:00
|
|
|
theme,
|
2023-10-02 10:46:09 +00:00
|
|
|
classes
|
|
|
|
});
|