Skip to content
This repository was archived by the owner on Jul 28, 2025. It is now read-only.

Commit b5063b4

Browse files
committed
footer style
1 parent 094e47e commit b5063b4

File tree

9 files changed

+76
-87
lines changed

9 files changed

+76
-87
lines changed

package-lock.json

Lines changed: 7 additions & 59 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
"@rollup/plugin-node-resolve": "15.0.1",
2525
"@rollup/plugin-replace": "5.0.1",
2626
"@rollup/plugin-typescript": "10.0.1",
27-
"@rollup/plugin-terser": "0.2.0",
27+
"@rollup/plugin-terser": "0.1.0",
2828
"@testing-library/jest-dom": "5.16.5",
2929
"@testing-library/react": "13.4.0",
3030
"@types/jest": "29.2.4",

src/components/DefaultFooter.tsx

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import Footer from "automations/Footer";
22
import { DatabaseHeaderProps, TableColumn } from "cdm/FolderModel";
3-
import { FooterType } from "helpers/Constants";
4-
import { c, getAlignmentClassname } from "helpers/StylesHelper";
3+
import { COLUMN_ALIGNMENT_OPTIONS, FooterType } from "helpers/Constants";
4+
import { c } from "helpers/StylesHelper";
55
import React, { MouseEventHandler, useState } from "react";
66
import { showFooterMenu } from "components/obsidianArq/commands";
77
import { Literal } from "obsidian-dataview";
@@ -44,10 +44,7 @@ export default function DefaultFooter(headerProps: DatabaseHeaderProps) {
4444

4545
return (
4646
<div
47-
key={`foot-th-cell-${header.id}`}
48-
className={`${c(
49-
getAlignmentClassname(config, configInfo.getLocalSettings())
50-
)}`}
47+
key={`default-footer-${header.id}`}
5148
onClick={handlerFooterOptions}
5249
style={{
5350
minHeight: "20px",

src/components/TableFooter.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import React from "react";
66
export default function TableFooter(tableFooterProps: TableFooterProps) {
77
const { header, headerIndex } = tableFooterProps;
88
return (
9-
<div key={`foot-th-${headerIndex}`} className={c("th footer")}>
9+
<div key={`table-footer-${headerIndex}`} className={c("th footer")}>
1010
{header.isPlaceholder
1111
? null
1212
: flexRender(header.column.columnDef.footer, header.getContext())}

src/components/index/Database.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export function Database(tableProps: TableDataType) {
1212
return (
1313
<StrictMode>
1414
{/** TRY CATCH REACT ERROR */}
15-
<DbErrorBoundary>
15+
<DbErrorBoundary key={"db-error-boundary"}>
1616
<Table {...tableProps} tableStore={tableStore} />
1717
</DbErrorBoundary>
1818
</StrictMode>

src/components/obsidianArq/commands.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,9 @@ export function showFileMenu(file: TFile, event: MouseEvent, row: Row<RowDataTyp
4848
.setTitle("Delete")
4949
.setIcon("trash")
5050
.onClick(handleDeleteRow));
51+
5152
fileMenu.addSeparator();
53+
5254
app.workspace.trigger("file-menu", fileMenu, file, null, app.workspace.getMostRecentLeaf());
5355
fileMenu.showAtMouseEvent(event);
5456
}
@@ -67,20 +69,20 @@ export async function showFooterMenu(
6769
columnActions.alterColumnConfig(tableColumn, {
6870
footer_type: type,
6971
footer_formula: formula || ""
70-
})
72+
});
7173
setFooterType(type);
7274
}
7375
};
7476

7577
const handleFOrmulaOption = async () => {
76-
7778
const prompt_filename = new PromptModal("Footer formula", tableColumn.config.footer_formula);
7879
await prompt_filename.openAndGetValue(
7980
(value) => {
8081
handleFooterOption(FooterType.FORMULA, value)();
8182
},
8283
() => { new Notice("Formula edition cancelled") });
8384
};
85+
8486
footerMenu.addItem((item) => item
8587
.setTitle(t("footer_menu_none"))
8688
.onClick(handleFooterOption(FooterType.NONE)));
@@ -97,7 +99,7 @@ export async function showFooterMenu(
9799
.setTitle(t("footer_menu_count_filled"))
98100
.onClick(handleFooterOption(FooterType.COUNT_FILLED)));
99101
footerMenu.addItem((item) => item
100-
.setTitle(t("footer_menu_percent_empty"))
102+
.setTitle(t("footer_menu_percent_filled"))
101103
.onClick(handleFooterOption(FooterType.PERCENT_FILLED)));
102104
footerMenu.addItem((item) => item
103105
.setTitle(t("footer_menu_formula"))

src/stateManagement/automations/AutomationStateActions.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,15 @@ import GetFormulaHandlerAction from "stateManagement/automations/handlers/GetFor
55
import LoadFormulasHandlerAction from "stateManagement/automations/handlers/LoadFormulasHandlerAction";
66
import RunFormulaHandlerAction from "stateManagement/automations/handlers/RunFormulaHandlerAction";
77
import DispatchRollupHandlerAction from "stateManagement/automations/handlers/DispatchRollupHandlerAction";
8+
import DispatchFooterHandlerAction from "stateManagement/automations/handlers/DispatchFooterHandlerAction";
89
class AutomationStateActions extends AbstractChain<TableActionResponse<AutomationState>> {
910
protected getHandlers(): AbstractHandler<TableActionResponse<AutomationState>>[] {
1011
return [
1112
new GetFormulaHandlerAction(),
1213
new LoadFormulasHandlerAction(),
1314
new RunFormulaHandlerAction(),
14-
new DispatchRollupHandlerAction()
15+
new DispatchRollupHandlerAction(),
16+
new DispatchFooterHandlerAction()
1517
];
1618
}
1719
}

src/stateManagement/automations/handlers/DispatchFooterHandlerAcgion.ts renamed to src/stateManagement/automations/handlers/DispatchFooterHandlerAction.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
import { Row } from "@tanstack/react-table";
2-
import Rollup from "automations/Rollup";
3-
import { ConfigColumn, RowDataType, TableColumn } from "cdm/FolderModel";
4-
import { LocalSettings } from "cdm/SettingsModel";
2+
import { RowDataType, TableColumn } from "cdm/FolderModel";
53
import { AutomationState, TableActionResponse } from "cdm/TableStateInterface";
6-
import { Link, Literal } from "obsidian-dataview";
7-
import { DataviewService } from "services/DataviewService";
4+
import { Literal } from "obsidian-dataview";
85
import { LOGGER } from "services/Logger";
96
import { AbstractTableAction } from "stateManagement/AbstractTableAction";
107

styles.css

Lines changed: 53 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ div.database-plugin__td.data-input:hover {
9797
.database-plugin__footer {
9898
border: 2px solid var(--background-modifier-accent);
9999
border-radius: 5px;
100+
text-align: center;
100101
}
101102
/******************************************************
102103
* Inputs of cells
@@ -426,7 +427,7 @@ div.database-plugin__checkbox {
426427

427428
.database-plugin__table {
428429
position: relative;
429-
border-spacing: 2px;
430+
border-spacing: 0.5px;
430431
border-bottom: 1px solid var(--background-modifier-border);
431432
display: table;
432433
height: 1px; /** Hack to prevent collapsing of table cells */
@@ -1061,7 +1062,9 @@ div.database-plugin__checkbox {
10611062
right: 2px;
10621063
}
10631064

1064-
.react-datepicker__navigation--next--with-time:not(.react-datepicker__navigation--next--with-today-button) {
1065+
.react-datepicker__navigation--next--with-time:not(
1066+
.react-datepicker__navigation--next--with-today-button
1067+
) {
10651068
right: 85px;
10661069
}
10671070

@@ -1462,21 +1465,61 @@ div.database-plugin__checkbox {
14621465
background-color: #1d5d90;
14631466
}
14641467

1465-
.react-datepicker__day--in-selecting-range:not(.react-datepicker__day--in-range, .react-datepicker__month-text--in-range, .react-datepicker__quarter-text--in-range, .react-datepicker__year-text--in-range),
1466-
.react-datepicker__month-text--in-selecting-range:not(.react-datepicker__day--in-range, .react-datepicker__month-text--in-range, .react-datepicker__quarter-text--in-range, .react-datepicker__year-text--in-range),
1467-
.react-datepicker__quarter-text--in-selecting-range:not(.react-datepicker__day--in-range, .react-datepicker__month-text--in-range, .react-datepicker__quarter-text--in-range, .react-datepicker__year-text--in-range),
1468-
.react-datepicker__year-text--in-selecting-range:not(.react-datepicker__day--in-range, .react-datepicker__month-text--in-range, .react-datepicker__quarter-text--in-range, .react-datepicker__year-text--in-range) {
1468+
.react-datepicker__day--in-selecting-range:not(
1469+
.react-datepicker__day--in-range,
1470+
.react-datepicker__month-text--in-range,
1471+
.react-datepicker__quarter-text--in-range,
1472+
.react-datepicker__year-text--in-range
1473+
),
1474+
.react-datepicker__month-text--in-selecting-range:not(
1475+
.react-datepicker__day--in-range,
1476+
.react-datepicker__month-text--in-range,
1477+
.react-datepicker__quarter-text--in-range,
1478+
.react-datepicker__year-text--in-range
1479+
),
1480+
.react-datepicker__quarter-text--in-selecting-range:not(
1481+
.react-datepicker__day--in-range,
1482+
.react-datepicker__month-text--in-range,
1483+
.react-datepicker__quarter-text--in-range,
1484+
.react-datepicker__year-text--in-range
1485+
),
1486+
.react-datepicker__year-text--in-selecting-range:not(
1487+
.react-datepicker__day--in-range,
1488+
.react-datepicker__month-text--in-range,
1489+
.react-datepicker__quarter-text--in-range,
1490+
.react-datepicker__year-text--in-range
1491+
) {
14691492
background-color: rgba(33, 107, 165, 0.5);
14701493
}
14711494

14721495
.react-datepicker__month--selecting-range
1473-
.react-datepicker__day--in-range:not(.react-datepicker__day--in-selecting-range, .react-datepicker__month-text--in-selecting-range, .react-datepicker__quarter-text--in-selecting-range, .react-datepicker__year-text--in-selecting-range),
1496+
.react-datepicker__day--in-range:not(
1497+
.react-datepicker__day--in-selecting-range,
1498+
.react-datepicker__month-text--in-selecting-range,
1499+
.react-datepicker__quarter-text--in-selecting-range,
1500+
.react-datepicker__year-text--in-selecting-range
1501+
),
14741502
.react-datepicker__month--selecting-range
1475-
.react-datepicker__month-text--in-range:not(.react-datepicker__day--in-selecting-range, .react-datepicker__month-text--in-selecting-range, .react-datepicker__quarter-text--in-selecting-range, .react-datepicker__year-text--in-selecting-range),
1503+
.react-datepicker__month-text--in-range:not(
1504+
.react-datepicker__day--in-selecting-range,
1505+
.react-datepicker__month-text--in-selecting-range,
1506+
.react-datepicker__quarter-text--in-selecting-range,
1507+
.react-datepicker__year-text--in-selecting-range
1508+
),
14761509
.react-datepicker__month--selecting-range
1477-
.react-datepicker__quarter-text--in-range:not(.react-datepicker__day--in-selecting-range, .react-datepicker__month-text--in-selecting-range, .react-datepicker__quarter-text--in-selecting-range, .react-datepicker__year-text--in-selecting-range),
1510+
.react-datepicker__quarter-text--in-range:not(
1511+
.react-datepicker__day--in-selecting-range,
1512+
.react-datepicker__month-text--in-selecting-range,
1513+
.react-datepicker__quarter-text--in-selecting-range,
1514+
.react-datepicker__year-text--in-selecting-range
1515+
),
14781516
.react-datepicker__month--selecting-range
1479-
.react-datepicker__year-text--in-range:not(.react-datepicker__day--in-selecting-range, .react-datepicker__month-text--in-selecting-range, .react-datepicker__quarter-text--in-selecting-range, .react-datepicker__year-text--in-selecting-range) {
1517+
.react-datepicker__year-text--in-range:not(
1518+
.react-datepicker__day--in-selecting-range,
1519+
.react-datepicker__month-text--in-selecting-range,
1520+
.react-datepicker__quarter-text--in-selecting-range,
1521+
.react-datepicker__year-text--in-selecting-range
1522+
) {
14801523
background-color: #f0f0f0;
14811524
color: var(--text-normal);
14821525
}

0 commit comments

Comments
 (0)