mirror of
https://github.com/gristlabs/grist-core.git
synced 2026-03-02 04:09:24 +00:00
(core) Custom Widget column mapping feature.
Summary: Exposing new API in CustomSectionAPI for column mapping. The custom widget can call configure method (or use a ready method) with additional parameter "columns". This parameter is a list of column names that should be mapped by the user. Mapping configuration is exposed through an additional method in the CustomSectionAPI "mappings". It is also available through the onRecord(s) event. This DIFF is connected with PR for grist-widgets repository https://github.com/gristlabs/grist-widget/pull/15 Design document and discussion: https://grist.quip.com/Y2waA8h8Zuzu/Custom-Widget-field-mapping Test Plan: browser tests Reviewers: paulfitz Reviewed By: paulfitz Differential Revision: https://phab.getgrist.com/D3241
This commit is contained in:
@@ -270,12 +270,22 @@ export class VisibleFieldsConfig extends Disposable {
|
||||
}
|
||||
|
||||
public async removeField(field: IField) {
|
||||
const id = field.id.peek();
|
||||
const existing = this._section.viewFields.peek().peek()
|
||||
.find((f) => f.column.peek().getRowId() === field.origCol.peek().id.peek());
|
||||
if (!existing) {
|
||||
return;
|
||||
}
|
||||
const id = existing.id.peek();
|
||||
const action = ['RemoveRecord', id];
|
||||
await this._gristDoc.docModel.viewFields.sendTableAction(action);
|
||||
}
|
||||
|
||||
public async addField(column: IField, nextField: ViewFieldRec|null = null) {
|
||||
const exists = this._section.viewFields.peek().peek()
|
||||
.findIndex((f) => f.column.peek().getRowId() === column.id.peek());
|
||||
if (exists !== -1) {
|
||||
return;
|
||||
}
|
||||
const parentPos = getFieldNewPosition(this._section.viewFields.peek(), column, nextField);
|
||||
const colInfo = {
|
||||
parentId: this._section.id.peek(),
|
||||
@@ -430,7 +440,7 @@ function unselectDeletedFields(selection: Set<number>, event: {deleted: IField[]
|
||||
}
|
||||
}
|
||||
|
||||
const cssDragRow = styled('div', `
|
||||
export const cssDragRow = styled('div', `
|
||||
display: flex !important;
|
||||
align-items: center;
|
||||
margin: 0 16px 0px 0px;
|
||||
|
||||
Reference in New Issue
Block a user