Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
e350966
Keyboard shortcuts popup window fixed to disappear. You can use comma…
seven-of-eleven Feb 22, 2025
56a73d0
Updated formatting of the file.
seven-of-eleven Feb 24, 2025
37b79d9
Put back the #grist-logo-wrapper code I had unintentionally removed,…
seven-of-eleven Feb 26, 2025
aa20b5c
Added a checkbox to Grid Options to hide field icons in tables. The i…
seven-of-eleven Feb 27, 2025
9c9f809
Added new line to end of domUtils.ts file. Changed import to absolute…
seven-of-eleven Feb 27, 2025
27bf0db
Additional line on domUtils.ts file didn't stick. Added again.
seven-of-eleven Feb 28, 2025
05d2f29
Additional line on domUtils.ts file again but without the other code …
seven-of-eleven Feb 28, 2025
ad2b051
Merge branch 'gristlabs:main' into main
seven-of-eleven Feb 28, 2025
71edb43
Merge branch 'gristlabs:main' into main
seven-of-eleven Mar 3, 2025
5b7f3fd
Updated the CSS to fix icon issues in Record widget and formula editing
seven-of-eleven Mar 6, 2025
a18aa8d
Updated the CSS to ensure proper colors and transitions when editing …
seven-of-eleven Mar 7, 2025
d9d18dd
Updated a couple of comments for clarity.
seven-of-eleven Mar 7, 2025
8134961
Merge branch 'gristlabs:main' into main
seven-of-eleven Mar 7, 2025
66944da
Merge branch 'gristlabs:main' into main
seven-of-eleven Mar 10, 2025
c90094c
Merge branch 'main' into gridIcons
seven-of-eleven Mar 10, 2025
7b40eed
Took a crack at updating the test for GridOptions.ntest.js.
seven-of-eleven Mar 10, 2025
62b45b4
Removed trailing space from line 1564.
seven-of-eleven Mar 10, 2025
a394938
Update GridOptions.ntest.js file. The test was passing on my laptop s…
seven-of-eleven Mar 11, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions app/client/components/GridView.js
Original file line number Diff line number Diff line change
Expand Up @@ -1150,6 +1150,7 @@ GridView.prototype.buildDom = function() {
let vHorizontalGridlines = v.optionsObj.prop('horizontalGridlines');
let vVerticalGridlines = v.optionsObj.prop('verticalGridlines');
let vZebraStripes = v.optionsObj.prop('zebraStripes');
let vFormulaIcon = v.optionsObj.prop('formulaIcon');

var renameCommands = {
nextField: function() {
Expand Down Expand Up @@ -1559,8 +1560,12 @@ GridView.prototype.buildDom = function() {
//a cell in that row becomes larger
kd.style('borderRightWidth', v.borderWidthPx),
kd.toggleClass('selected', isSelected),
// Optional icon. Currently only use to show formula icon.
dom('div.field-icon'),
// The field-icon is presently only used for "=" in formula fields.
// The record-icon class isolates the "=" being applied to the formula fields.
// Allowing additional field icons to be added as field-icon class if desired.
dom('div.field-icon',
kd.toggleClass('record-icon', vFormulaIcon), // Also grabbed from v.optionsObj at start of GridView buildDom
),
fieldBuilder.buildDomWithCursor(row, isCellActive, isCellSelected),
dom('div.selection'),
);
Expand Down
1 change: 1 addition & 0 deletions app/client/models/entities/ViewSectionRec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,7 @@ export function createViewSectionRec(this: ViewSectionRec, docModel: DocModel):
const defaultOptions = {
verticalGridlines: true,
horizontalGridlines: true,
formulaIcon: true, // formula icons are enable by default consistent with the default app behaviour
zebraStripes: false,
customView: '',
numFrozen: 0
Expand Down
6 changes: 6 additions & 0 deletions app/client/ui/GridOptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ export class GridOptions extends Disposable {
testId('h-grid-button')
),

cssRow(
checkbox(setSaveValueFromKo(this, section.optionsObj.prop('formulaIcon'))),
t("Formula Icons"),
testId('formula-icon-button'),
),

cssRow(
checkbox(setSaveValueFromKo(this, section.optionsObj.prop('zebraStripes'))),
t("Zebra Stripes"),
Expand Down
12 changes: 9 additions & 3 deletions app/client/widgets/TextBox.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,19 @@
}

@media not print {
.formula_field, .formula_field_edit {
.formula_field:has(.record-icon),
.formula_field_edit:has(> .record-icon),
.g_record_detail_value.formula_field:has(> .field-icon) {
padding-left: 18px;
}
.formula_field_edit {
color: #D0D0D0;
}

.formula_field .field-icon,
.formula_field_edit::before,
.formula_field .record-icon,
.g_record_detail_value.formula_field .field-icon,
.formula_field_edit:has(> .record-icon)::before,
.formula_editor.formula_field_edit::before,
.formula_field_sidepane::before {
/* based on standard icon styles */
content: "";
Expand All @@ -30,9 +34,11 @@
cursor: pointer;
}

.g_record_detail_value.formula_field .field-icon,
.formula_field .field-icon, .formula_field_edit::before {
background-color: #D0D0D0;
}
.transform_field.formula_field > .field-icon,
.formula_field_edit:not(.readonly)::before {
background-color: var(--grist-color-cursor);
}
Expand Down
26 changes: 17 additions & 9 deletions test/nbrowser/GridOptions.ntest.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ describe("GridOptions.ntest", function() {

/* Test that styles on the given section match the specified flags
* sec: index into secNames
* hor/vert/zebra: boolean flags
* hor/vert/icon/zebra: boolean flags
*/
async function assertHVZ(sec, hor, vert, zebra) {
async function assertHVCZ(sec, hor, vert, icon, zebra) {
let testClasses =
['record-hlines', 'record-vlines', 'record-zebra'];
let flags = [hor, vert, zebra];
Expand All @@ -33,6 +33,11 @@ describe("GridOptions.ntest", function() {
if(flags[i]) { assert.include(rowClasses, cls);}
else { assert.notInclude(rowClasses, cls); }
});
// Check for the presence of 'record-icon' class on the div.field-icon element
const fieldIcon = await row.find('.field-icon');
const iconClasses = await fieldIcon.classList();
if (icon) { assert.include(iconClasses, 'record-icon'); }
else { assert.notInclude(iconClasses, 'record-icon'); }
}


Expand Down Expand Up @@ -84,10 +89,11 @@ describe("GridOptions.ntest", function() {
// get handles on elements
let h = ".test-h-grid-button input";
let v = ".test-v-grid-button input";
let c = ".test-formula-icon-button input";
let z = ".test-zebra-stripe-button input";

// should start with v+h gridlines, no zebra
await assertHVZ(0, true, true, false);
await assertHVCZ(0, true, true, true, false);

// change values on all the sections
await switchTo(0);
Expand All @@ -96,24 +102,26 @@ describe("GridOptions.ntest", function() {
await switchTo(1);
await $(h).click();
await $(v).click();
await $(c).click();

await switchTo(2);
await $(h).click(); // turn off
await $(c).click(); // turn off
await $(z).click(); // turn on
await gu.waitForServer();

await assertHVZ(0, true, true, true); // all on
await assertHVZ(1, false, false, false); // all off
await assertHVZ(2, false, true, true); // -h +v +z
await assertHVCZ(0, true, true, true, true); // all on
await assertHVCZ(1, false, false, false, false); // all off
await assertHVCZ(2, false, true, false, true); // -h +v -c +z

// ensure that values persist after reload
await driver.navigate().refresh();
//await $.injectIntoPage();
await gu.waitForDocToLoad();
await gu.hideBanners();
await assertHVZ(0, true, true, true); // all on
await assertHVZ(1, false, false, false); // all off
await assertHVZ(2, false, true, true); // -h +v +z
await assertHVCZ(0, true, true, true, true); // all on
await assertHVCZ(1, false, false, false, false); // all off
await assertHVCZ(2, false, true, false, true); // -h +v -c +z
});


Expand Down