590 lines
14 KiB
JavaScript
Raw Normal View History

2025-04-28 12:25:20 +08:00
/**
* 样式模块
* @type {module}
*/
/**
* 获取组件的CSS样式
* @returns {string} 组件的CSS样式字符串
*/
export function getStyles() {
return `
:host {
display: block;
height: 100%;
overflow: auto;
padding: 16px;
box-sizing: border-box;
}
.config-container {
background-color: white;
border-radius: 8px;
box-shadow: 0 2px 8px rgba(0,0,0,0.1);
padding: 16px;
height: 100%;
box-sizing: border-box;
display: flex;
flex-direction: column;
}
.config-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 20px;
padding-bottom: 10px;
border-bottom: 1px solid #e0e0e0;
}
.file-selector-header {
flex-grow: 1;
margin-right: 16px;
display: flex;
align-items: center;
}
.file-selector-label {
font-size: 18px;
font-weight: bold;
color: #333;
margin-right: 10px;
white-space: nowrap;
}
.file-selector-header select {
flex-grow: 1;
padding: 6px;
border-radius: 4px;
border: 1px solid #e0e0e0;
appearance: none;
padding-right: 30px;
background-image: url('assets/icons/png/chevron-down_b.png');
background-repeat: no-repeat;
background-position: right 8px center;
background-size: 14px;
}
.refresh-button {
width: 28px;
height: 28px;
cursor: pointer;
margin-left: 8px;
border: none;
background-color: transparent;
background-size: contain;
background-repeat: no-repeat;
background-position: center;
background-image: url('assets/icons/png/refresh_b.png');
transition: transform 0.3s ease;
opacity: 0.7;
}
.refresh-button:hover {
opacity: 1;
}
.refresh-button.refreshing {
animation: spin 1s linear infinite;
}
@keyframes spin {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
}
.action-buttons {
display: flex;
gap: 8px;
}
.action-button {
background-color: #7986E7;
color: white;
border: none;
border-radius: 4px;
padding: 6px 12px;
cursor: pointer;
font-size: 14px;
transition: background-color 0.3s;
}
.action-button.save-button.modified {
background-color: #E77979;
}
.action-button.save-button.modified:hover {
background-color: #D66868;
}
.action-button:hover {
background-color: #6875D6;
}
.action-button.secondary {
background-color: #f0f0f0;
color: #333;
}
.action-button.secondary:hover {
background-color: #e0e0e0;
}
.config-content {
padding: 0;
flex-grow: 1;
display: flex;
flex-direction: column;
overflow: auto;
}
.editor-container {
height: 100%;
display: flex;
flex-direction: column;
}
.editor-panel {
flex: 1;
height: 100%;
overflow: auto;
border: 1px solid #e0e0e0;
border-radius: 4px;
padding: 12px;
background-color: #f9f9f9;
}
.editor-panel.active {
display: block;
}
.section {
margin-bottom: 20px;
border: 1px solid #e0e0e0;
border-radius: 4px;
padding: 10px;
background-color: white;
}
.section-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 10px;
padding-bottom: 5px;
border-bottom: 1px solid #e0e0e0;
}
.section-title {
font-weight: bold;
color: #555;
}
.property-table {
width: 100%;
border-collapse: collapse;
}
.property-table th, .property-table td {
text-align: left;
padding: 8px;
border-bottom: 1px solid #e0e0e0;
}
.property-table th {
background-color: #f5f5f5;
}
.button-sm {
padding: 2px 8px;
font-size: 12px;
}
.modal {
display: none;
position: fixed;
z-index: 1000;
left: 0;
top: 0;
width: 100%;
height: 100%;
overflow: auto;
background-color: rgba(0,0,0,0.4);
}
.modal-content {
background-color: #fefefe;
margin: 10% auto;
padding: 20px;
border: 1px solid #888;
width: 50%;
max-width: 500px;
border-radius: 5px;
box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}
.modal-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 15px;
}
.modal-title {
font-weight: bold;
font-size: 18px;
}
.close {
color: #aaa;
font-size: 28px;
font-weight: bold;
cursor: pointer;
}
.close:hover {
color: black;
}
.modal-footer {
display: flex;
justify-content: flex-end;
gap: 10px;
margin-top: 15px;
}
.form-group {
margin-bottom: 15px;
}
.form-group label {
display: block;
margin-bottom: 5px;
}
.form-control {
width: 100%;
padding: 8px;
box-sizing: border-box;
border: 1px solid #ccc;
border-radius: 4px;
}
.error-message {
color: #d32f2f;
background-color: #ffebee;
padding: 10px;
border-radius: 4px;
margin-bottom: 15px;
}
.no-file-selected {
color: #888;
font-style: italic;
text-align: center;
margin-top: 80px;
}
/* 命令表格相关样式 */
.command-table-container {
margin-top: 10px;
width: 100%;
overflow-x: auto;
}
.command-table {
width: 100%;
border-collapse: collapse;
font-size: 14px;
}
.command-table th,
.command-table td {
padding: 8px;
text-align: left;
border: 1px solid #ddd;
}
.command-table th {
background-color: #f5f5f5;
font-weight: 600;
}
.command-table tr:nth-child(even) {
background-color: #f9f9f9;
}
.command-table tr:hover {
background-color: #f1f1f1;
}
/* 命令表格单元格和行样式 */
.command-cell {
padding: 8px;
text-align: left;
border: 1px solid #ddd;
vertical-align: middle;
word-break: break-word;
}
.command-row {
transition: background-color 0.2s;
}
.action-cell {
text-align: center;
white-space: nowrap;
}
.command-actions {
display: flex;
gap: 5px;
justify-content: center;
}
.command-action-button {
padding: 3px 8px;
font-size: 12px;
border: none;
border-radius: 3px;
cursor: pointer;
transition: background-color 0.2s;
color: white;
}
.edit-button {
background-color: #7986E7;
}
.edit-button:hover {
background-color: #6875D6;
}
.delete-button {
background-color: #E77979;
}
.delete-button:hover {
background-color: #D66868;
}
/* 输入容器样式 */
.input-container {
display: flex;
align-items: center;
}
/* 图标按钮样式 */
.icon-button {
background-color: transparent;
border: none;
cursor: pointer;
padding: 0;
width: 28px;
height: 28px;
margin-left: 8px;
background-size: contain;
background-repeat: no-repeat;
background-position: center;
opacity: 0.7;
transition: opacity 0.2s;
}
.icon-button:hover {
opacity: 1;
}
.calendar-button {
background-image: url('assets/icons/png/calendar_b.png');
width: 24px;
height: 24px;
background-size: 16px;
}
.refresh-button-sm {
background-image: url('assets/icons/png/refresh_b.png');
width: 24px;
height: 24px;
background-size: 16px;
}
.calendar-day.selected {
background-color: #7986E7;
color: white;
}
/* 其它设置部分样式 */
.other-settings-container {
margin-top: 15px;
}
.element-row {
display: flex;
margin-bottom: 8px;
align-items: flex-start;
}
.element-box {
display: flex;
align-items: center;
flex-wrap: wrap;
background-color: #f9f9f9;
border: 1px solid #ddd;
border-radius: 4px;
padding: 8px;
width: 100%;
}
.toggle-button {
background: none;
border: none;
cursor: pointer;
padding: 0;
margin-right: 5px;
font-size: 14px;
color: #666;
width: 20px;
display: flex;
justify-content: center;
}
.toggle-spacer {
width: 20px;
}
.element-name {
font-weight: 500;
margin-right: 15px;
padding: 5px 0;
color: #333;
min-width: 100px;
}
.element-value-container {
flex: 1;
display: flex;
}
.element-value-input {
flex: 1;
padding: 5px 10px;
border: 1px solid #ddd;
border-radius: 4px;
font-size: 14px;
}
.element-actions {
display: flex;
gap: 5px;
margin-left: auto;
}
.element-action-button {
padding: 3px 8px;
font-size: 12px;
border: none;
border-radius: 3px;
background-color: #7986E7;
color: white;
cursor: pointer;
}
.element-action-button:hover {
background-color: #6875D6;
}
.form-info {
margin-top: 15px;
padding: 10px;
background-color: #f5f5f5;
border-radius: 4px;
}
.form-info-text {
color: #666;
margin: 0;
font-size: 14px;
}
/* 视觉编辑器相关样式 */
.visual-editor {
padding: 10px;
}
.section-title {
font-size: 18px;
font-weight: bold;
margin-bottom: 10px;
color: #333;
border-bottom: 1px solid #e0e0e0;
padding-bottom: 8px;
}
.section {
margin-bottom: 20px;
background-color: white;
border: 1px solid #e0e0e0;
border-radius: 4px;
padding: 16px;
}
.property-row {
display: flex;
margin-bottom: 12px;
align-items: center;
}
.property-label {
width: 150px;
font-weight: 500;
color: #555;
}
.property-input {
flex: 1;
padding: 8px 10px;
border: 1px solid #ddd;
border-radius: 4px;
font-size: 14px;
}
.property-input:focus {
border-color: #7986E7;
outline: none;
box-shadow: 0 0 0 2px rgba(121, 134, 231, 0.2);
}
.section-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 15px;
}
.section-title-text {
font-size: 18px;
font-weight: bold;
color: #333;
}
.section-buttons {
display: flex;
gap: 8px;
}
.section-button {
background-color: #7986E7;
color: white;
border: none;
border-radius: 4px;
padding: 6px 12px;
cursor: pointer;
font-size: 14px;
transition: background-color 0.3s;
}
.section-button:hover {
background-color: #6875D6;
}
`;
}