(core) updates from grist-core

This commit is contained in:
Paul Fitzpatrick 2023-04-17 09:58:04 -04:00
commit f490854324
7 changed files with 30 additions and 19 deletions

View File

@ -260,7 +260,7 @@ GRIST_DEFAULT_PRODUCT | if set, this controls enabled features and limits of ne
GRIST_DEFAULT_LOCALE | Locale to use as fallback when Grist cannot honour the browser locale. GRIST_DEFAULT_LOCALE | Locale to use as fallback when Grist cannot honour the browser locale.
GRIST_DOMAIN | in hosted Grist, Grist is served from subdomains of this domain. Defaults to "getgrist.com". GRIST_DOMAIN | in hosted Grist, Grist is served from subdomains of this domain. Defaults to "getgrist.com".
GRIST_EXPERIMENTAL_PLUGINS | enables experimental plugins GRIST_EXPERIMENTAL_PLUGINS | enables experimental plugins
GRIST_HIDE_UI_ELEMENTS | comma-separated list of parts of the UI to hide. Allowed names of parts: `helpCenter,billing,templates,multiSite,multiAccounts` GRIST_HIDE_UI_ELEMENTS | comma-separated list of parts of the UI to hide. Allowed names of parts: `helpCenter,billing,templates,multiSite,multiAccounts,sendToDrive`
GRIST_HOME_INCLUDE_STATIC | if set, home server also serves static resources GRIST_HOME_INCLUDE_STATIC | if set, home server also serves static resources
GRIST_HOST | hostname to use when listening on a port. GRIST_HOST | hostname to use when listening on a port.
GRIST_ID_PREFIX | for subdomains of form o-*, expect or produce o-${GRIST_ID_PREFIX}*. GRIST_ID_PREFIX | for subdomains of form o-*, expect or produce o-${GRIST_ID_PREFIX}*.

View File

@ -11,6 +11,7 @@ import {TableData} from 'app/client/models/TableData';
import {FieldBuilder} from 'app/client/widgets/FieldBuilder'; import {FieldBuilder} from 'app/client/widgets/FieldBuilder';
import {UserAction} from 'app/common/DocActions'; import {UserAction} from 'app/common/DocActions';
import {Disposable, Observable} from 'grainjs'; import {Disposable, Observable} from 'grainjs';
import isPlainObject from 'lodash/isPlainObject';
import * as ko from 'knockout'; import * as ko from 'knockout';
import noop = require('lodash/noop'); import noop = require('lodash/noop');
@ -163,7 +164,10 @@ export class ColumnTransform extends Disposable {
protected async addTransformColumn(colType: string): Promise<number> { protected async addTransformColumn(colType: string): Promise<number> {
// Retrieve widget options on prepare (useful for type transforms) // Retrieve widget options on prepare (useful for type transforms)
const newColInfo = await this._tableData.sendTableAction(['AddColumn', "gristHelper_Transform", { const newColInfo = await this._tableData.sendTableAction(['AddColumn', "gristHelper_Transform", {
type: colType, isFormula: true, formula: this.getIdentityFormula(), type: colType,
isFormula: true,
formula: this.getIdentityFormula(),
...(this.origWidgetOptions ? {widgetOptions: JSON.stringify(this.origWidgetOptions)} : {}),
}]); }]);
return newColInfo.colRef; return newColInfo.colRef;
} }
@ -219,6 +223,9 @@ export class ColumnTransform extends Disposable {
* The user actions to send when actually executing the transform. * The user actions to send when actually executing the transform.
*/ */
protected executeActions(): UserAction[] { protected executeActions(): UserAction[] {
const newWidgetOptions = isPlainObject(this.origWidgetOptions) ?
{...this.origWidgetOptions as object, ...this._fieldBuilder.options.peek()} :
this._fieldBuilder.options.peek();
return [ return [
[ [
'CopyFromColumn', 'CopyFromColumn',
@ -229,7 +236,7 @@ export class ColumnTransform extends Disposable {
// Those options are supposed to be set by prepTransformColInfo(TypeTransform) and // Those options are supposed to be set by prepTransformColInfo(TypeTransform) and
// adjusted by client. // adjusted by client.
// TODO: is this really needed? Aren't those options already in the data-engine? // TODO: is this really needed? Aren't those options already in the data-engine?
JSON.stringify(this._fieldBuilder.options.peek()), JSON.stringify(newWidgetOptions),
], ],
]; ];
} }

View File

@ -11,7 +11,7 @@ import {primaryButton} from 'app/client/ui2018/buttons';
import {mediaXSmall, testId, theme} from 'app/client/ui2018/cssVars'; import {mediaXSmall, testId, theme} from 'app/client/ui2018/cssVars';
import {icon} from 'app/client/ui2018/icons'; import {icon} from 'app/client/ui2018/icons';
import {menu, menuAnnotate, menuDivider, menuIcon, menuItem, menuItemLink, menuText} from 'app/client/ui2018/menus'; import {menu, menuAnnotate, menuDivider, menuIcon, menuItem, menuItemLink, menuText} from 'app/client/ui2018/menus';
import {buildUrlId, parseUrlId} from 'app/common/gristUrls'; import {buildUrlId, parseUrlId, shouldHideUiElement} from 'app/common/gristUrls';
import * as roles from 'app/common/roles'; import * as roles from 'app/common/roles';
import {Document} from 'app/common/UserAPI'; import {Document} from 'app/common/UserAPI';
import {dom, DomContents, styled} from 'grainjs'; import {dom, DomContents, styled} from 'grainjs';
@ -244,8 +244,8 @@ function menuExports(doc: Document, pageModel: DocPageModel) {
href: pageModel.appModel.api.getDocAPI(doc.id).getDownloadXlsxUrl(), href: pageModel.appModel.api.getDocAPI(doc.id).getDownloadXlsxUrl(),
target: '_blank', download: '' target: '_blank', download: ''
}, menuIcon('Download'), t("Export XLSX"), testId('tb-share-option')), }, menuIcon('Download'), t("Export XLSX"), testId('tb-share-option')),
menuItem(() => sendToDrive(doc, pageModel), (shouldHideUiElement("sendToDrive") ? null : menuItem(() => sendToDrive(doc, pageModel),
menuIcon('Download'), t("Send to Google Drive"), testId('tb-share-option')), menuIcon('Download'), t("Send to Google Drive"), testId('tb-share-option'))),
]; ];
} }

View File

@ -615,7 +615,8 @@ export interface GristLoadConfig {
userLocale?: string; userLocale?: string;
} }
export const HideableUiElements = StringUnion("helpCenter", "billing", "templates", "multiSite", "multiAccounts"); export const HideableUiElements = StringUnion("helpCenter", "billing", "templates", "multiSite", "multiAccounts",
"sendToDrive");
export type IHideableUiElement = typeof HideableUiElements.type; export type IHideableUiElement = typeof HideableUiElements.type;
export function shouldHideUiElement(elem: IHideableUiElement): boolean { export function shouldHideUiElement(elem: IHideableUiElement): boolean {

View File

@ -372,7 +372,7 @@
"Insert column to the {{to}}": "Wstaw kolumnę do {{to}}", "Insert column to the {{to}}": "Wstaw kolumnę do {{to}}",
"More sort options ...": "Pozostałe opcje sortowania…", "More sort options ...": "Pozostałe opcje sortowania…",
"Rename column": "Zmień nazwę kolumny", "Rename column": "Zmień nazwę kolumny",
"Reset {{count}} columns_one": "Wyzerować kolumnę", "Reset {{count}} columns_one": "Resetuj kolumnę",
"Reset {{count}} columns_other": "Wyzeruj {{count}} kolumn", "Reset {{count}} columns_other": "Wyzeruj {{count}} kolumn",
"Reset {{count}} entire columns_one": "Zresetuj całą kolumnę", "Reset {{count}} entire columns_one": "Zresetuj całą kolumnę",
"Reset {{count}} entire columns_other": "Resetowanie {{count}} całych kolumn", "Reset {{count}} entire columns_other": "Resetowanie {{count}} całych kolumn",
@ -589,13 +589,13 @@
}, },
"TriggerFormulas": { "TriggerFormulas": {
"Apply on changes to:": "Zastosuj w przypadku zmian do:", "Apply on changes to:": "Zastosuj w przypadku zmian do:",
"Apply on record changes": "Zastosuj zmiany w rekordzie", "Apply on record changes": "Uruchom przy zmianach",
"Cancel": "Anuluj", "Cancel": "Anuluj",
"Any field": "Dowolne pole", "Any field": "Dowolne pole",
"Close": "Zamknij", "Close": "Zamknij",
"OK": "OK", "OK": "OK",
"Current field ": "Bieżące pole ", "Current field ": "Bieżące pole ",
"Apply to new records": "Zastosuj do nowych rekordów" "Apply to new records": "Uruchom przy dodawaniu"
}, },
"TypeTransformation": { "TypeTransformation": {
"Apply": "Zastosuj", "Apply": "Zastosuj",

View File

@ -460,7 +460,9 @@
"Welcome to {{orgName}}": "Добро пожаловать в {{orgName}}", "Welcome to {{orgName}}": "Добро пожаловать в {{orgName}}",
"personal site": "личный сайт", "personal site": "личный сайт",
"You have read-only access to this site. Currently there are no documents.": "Вы имеете доступ к этому сайту только для просмотра. В настоящее время документов нет.", "You have read-only access to this site. Currently there are no documents.": "Вы имеете доступ к этому сайту только для просмотра. В настоящее время документов нет.",
"{{signUp}} to save your work. ": "{{signUp}} сохранить свою работу. " "{{signUp}} to save your work. ": "{{signUp}} сохранить свою работу. ",
"Welcome to Grist, {{- name}}!": "Добро пожаловать в Grist, {{- name}}!",
"Welcome to {{- orgName}}": "Добро пожаловать в {{- orgName}}"
}, },
"HomeLeftPane": { "HomeLeftPane": {
"Import Document": "Импорт документа", "Import Document": "Импорт документа",
@ -470,12 +472,13 @@
"Access Details": "Детали доступа", "Access Details": "Детали доступа",
"Create Empty Document": "Создать пустой документ", "Create Empty Document": "Создать пустой документ",
"Delete": "Удалить", "Delete": "Удалить",
"Examples & Templates": "Примеры & Шаблоны", "Examples & Templates": "Шаблоны",
"Rename": "Переименовать", "Rename": "Переименовать",
"Delete {{workspace}} and all included documents?": "Удалить {{workspace}} и все прилагаемые документы?", "Delete {{workspace}} and all included documents?": "Удалить {{workspace}} и все прилагаемые документы?",
"Trash": "Корзина", "Trash": "Корзина",
"Workspaces": "Рабочие пространства", "Workspaces": "Рабочие пространства",
"Workspace will be moved to Trash.": "Рабочее пространство будет перемещено в корзину." "Workspace will be moved to Trash.": "Рабочее пространство будет перемещено в корзину.",
"Tutorial": "Руководство"
}, },
"GridViewMenus": { "GridViewMenus": {
"Add to sort": "Добавить в сортировку", "Add to sort": "Добавить в сортировку",
@ -961,7 +964,8 @@
"Add New": "Добавить новое", "Add New": "Добавить новое",
"Access rules give you the power to create nuanced rules to determine who can see or edit which parts of your document.": "Правила доступа дают вам возможность создавать детальные правила, определяющие, кто может просматривать или редактировать части вашего документа.", "Access rules give you the power to create nuanced rules to determine who can see or edit which parts of your document.": "Правила доступа дают вам возможность создавать детальные правила, определяющие, кто может просматривать или редактировать части вашего документа.",
"Use the 𝚺 icon to create summary (or pivot) tables, for totals or subtotals.": "Используйте 𝚺 значок для создания сводных таблиц для итогов или промежуточных итогов.", "Use the 𝚺 icon to create summary (or pivot) tables, for totals or subtotals.": "Используйте 𝚺 значок для создания сводных таблиц для итогов или промежуточных итогов.",
"relational": "реляционный" "relational": "реляционный",
"Anchor Links": "Якорные ссылки"
}, },
"DescriptionConfig": { "DescriptionConfig": {
"DESCRIPTION": "ОПИСАНИЕ" "DESCRIPTION": "ОПИСАНИЕ"

View File

@ -831,24 +831,23 @@ describe('ChoiceList', function() {
await gu.sendKeys(await gu.pasteKey()); await gu.sendKeys(await gu.pasteKey());
await gu.sendKeys(await gu.pasteKey()); await gu.sendKeys(await gu.pasteKey());
await gu.sendKeys(Key.ENTER); await gu.sendKeys(Key.ENTER);
await clickEntry('three');
await gu.sendKeys(await gu.copyKey());
await clickEntry('two'); await clickEntry('two');
await gu.sendKeys(await gu.copyKey());
await gu.sendKeys(Key.ARROW_RIGHT); await gu.sendKeys(Key.ARROW_RIGHT);
await gu.sendKeys(await gu.pasteKey()); await gu.sendKeys(await gu.pasteKey());
await gu.sendKeys(Key.ENTER); await gu.sendKeys(Key.ENTER);
assert.deepEqual(await getEditModeChoiceLabels(), ["foofoo", "three", "twothree"]); assert.deepEqual(await getEditModeChoiceLabels(), ["foofoo", "three", "twotwo"]);
await saveChoiceEntries(); await saveChoiceEntries();
assert.deepEqual(await gu.getVisibleGridCells({ rowNums: [1, 2, 3], cols: [columnName] }), [ assert.deepEqual(await gu.getVisibleGridCells({ rowNums: [1, 2, 3], cols: [columnName] }), [
"foofoo", "foofoo",
"three", "three",
"twothree", "twotwo",
]); ]);
// Rename to bar, four and eight and do the change. // Rename to bar, four and eight and do the change.
await editChoiceEntries(); await editChoiceEntries();
await renameEntry("foofoo", "bar"); await renameEntry("foofoo", "bar");
await renameEntry("twothree", "four"); await renameEntry("twotwo", "four");
await renameEntry("three", "eight"); await renameEntry("three", "eight");
await saveChoiceEntries(); await saveChoiceEntries();
assert.deepEqual(await gu.getVisibleGridCells({ rowNums: [1, 2, 3], cols: [columnName] }), [ assert.deepEqual(await gu.getVisibleGridCells({ rowNums: [1, 2, 3], cols: [columnName] }), [