(core) Rename popup for group by columns

Summary:
Showing rename popup on group by column with disabled label section. It only allows to set description.

Unrelated:
- Fixing HostedMetadataManager test

Test Plan: Updated tests

Reviewers: Spoffy

Reviewed By: Spoffy

Subscribers: Spoffy

Differential Revision: https://phab.getgrist.com/D4371
This commit is contained in:
Spoffy
2024-10-09 11:41:10 +02:00
committed by Jarosław Sadziński
parent 0bdc838975
commit 5d349e603b
7 changed files with 123 additions and 25 deletions

View File

@@ -1270,12 +1270,12 @@ GridView.prototype.buildDom = function() {
kd.style('minWidth', '100%'),
kd.style('borderLeftWidth', v.borderWidthPx),
kd.foreach(v.viewFields(), field => {
const canRename = ko.pureComputed(() => !field.column().disableEditData());
const isEditingLabel = koUtil.withKoUtils(ko.pureComputed({
read: () => {
const goodIndex = () => editIndex() === field._index();
const isReadonly = () => this.isReadonly || self.isPreview;
const isSummary = () => Boolean(field.column().disableEditData());
return goodIndex() && !isReadonly() && !isSummary();
return goodIndex() && !isReadonly();
},
write: val => {
if (val) {
@@ -1306,6 +1306,7 @@ GridView.prototype.buildDom = function() {
return dom(
'div.column_name.field',
dom.autoDispose(canRename),
dom.autoDispose(headerTextColor),
dom.autoDispose(headerFillColor),
dom.autoDispose(headerFontBold),
@@ -1355,7 +1356,8 @@ GridView.prototype.buildDom = function() {
buildRenameColumn({
field,
isEditing: isEditingLabel,
optCommands: renameCommands
optCommands: renameCommands,
canRename,
}),
),
self._showTooltipOnHover(field, isTooltip),