mirror of
https://github.com/gristlabs/grist-core.git
synced 2026-03-02 04:09:24 +00:00
(core) updates from grist-core
This commit is contained in:
@@ -830,6 +830,16 @@ export class GristDoc extends DisposableWithEvents {
|
||||
}
|
||||
|
||||
public getCsvLink() {
|
||||
const params = this._getDocApiDownloadParams();
|
||||
return this.docPageModel.appModel.api.getDocAPI(this.docId()).getDownloadCsvUrl(params);
|
||||
}
|
||||
|
||||
public getXlsxActiveViewLink() {
|
||||
const params = this._getDocApiDownloadParams();
|
||||
return this.docPageModel.appModel.api.getDocAPI(this.docId()).getDownloadXlsxUrl(params);
|
||||
}
|
||||
|
||||
private _getDocApiDownloadParams() {
|
||||
const filters = this.viewModel.activeSection.peek().activeFilters.get().map(filterInfo => ({
|
||||
colRef : filterInfo.fieldOrColumn.origCol().origColRef(),
|
||||
filter : filterInfo.filter()
|
||||
@@ -841,8 +851,7 @@ export class GristDoc extends DisposableWithEvents {
|
||||
activeSortSpec: JSON.stringify(this.viewModel.activeSection().activeSortSpec()),
|
||||
filters : JSON.stringify(filters),
|
||||
};
|
||||
|
||||
return this.docPageModel.appModel.api.getDocAPI(this.docId()).getDownloadCsvUrl(params);
|
||||
return params;
|
||||
}
|
||||
|
||||
public hasGranularAccessRules(): boolean {
|
||||
|
||||
@@ -50,7 +50,7 @@ export function buildNameConfig(owner: MultiHolder, origColumn: ColumnRec, curso
|
||||
),
|
||||
cssInput(editableColId,
|
||||
saveColId,
|
||||
dom.boolAttr('disabled', use => use(origColumn.disableModify) || !use(origColumn.untieColIdFromLabel)),
|
||||
dom.boolAttr(`readonly`, use => use(origColumn.disableModify) || !use(origColumn.untieColIdFromLabel)),
|
||||
cssCodeBlock.cls(''),
|
||||
{style: 'margin-top: 8px'},
|
||||
testId('field-col-id'),
|
||||
@@ -396,7 +396,7 @@ const cssInput = styled(textInput, `
|
||||
color: ${theme.inputPlaceholderFg};
|
||||
}
|
||||
|
||||
&:disabled {
|
||||
&[readonly] {
|
||||
background-color: ${theme.inputDisabledBg};
|
||||
color: ${theme.inputDisabledFg};
|
||||
}
|
||||
|
||||
@@ -41,6 +41,8 @@ export function makeViewLayoutMenu(viewSection: ViewSectionRec, isReadonly: bool
|
||||
menuItemCmd(allCommands.printSection, 'Print widget', testId('print-section')),
|
||||
menuItemLink({ href: gristDoc.getCsvLink(), target: '_blank', download: ''},
|
||||
'Download as CSV', testId('download-section')),
|
||||
menuItemLink({ href: gristDoc.getXlsxActiveViewLink(), target: '_blank', download: ''},
|
||||
'Download as XLSX', testId('download-section')),
|
||||
dom.maybe((use) => ['detail', 'single'].includes(use(viewSection.parentKey)), () =>
|
||||
menuItemCmd(allCommands.editLayout, 'Edit Card Layout',
|
||||
dom.cls('disabled', isReadonly))),
|
||||
|
||||
Reference in New Issue
Block a user