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:
@@ -1,14 +1,10 @@
|
||||
import { CellValue, CellVersions } from 'app/common/DocActions';
|
||||
import { GristObjCode } from 'app/plugin/GristData';
|
||||
import { GristObjCode, GristType } from 'app/plugin/GristData';
|
||||
import isString = require('lodash/isString');
|
||||
import { removePrefix } from "./gutil";
|
||||
|
||||
// tslint:disable:object-literal-key-quotes
|
||||
|
||||
export type GristType = 'Any' | 'Attachments' | 'Blob' | 'Bool' | 'Choice' | 'ChoiceList' |
|
||||
'Date' | 'DateTime' |
|
||||
'Id' | 'Int' | 'ManualSortPos' | 'Numeric' | 'PositionNumber' | 'Ref' | 'RefList' | 'Text';
|
||||
|
||||
export type GristTypeInfo =
|
||||
{type: 'DateTime', timezone: string} |
|
||||
{type: 'Ref', tableId: string} |
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import {delay} from 'app/common/delay';
|
||||
import {BindableValue, DomElementMethod, Listener, Observable, subscribeElem} from 'grainjs';
|
||||
import {BindableValue, DomElementMethod, ISubscribable, Listener, Observable, subscribeElem, UseCB} from 'grainjs';
|
||||
import {Observable as KoObservable} from 'knockout';
|
||||
import constant = require('lodash/constant');
|
||||
import identity = require('lodash/identity');
|
||||
@@ -905,3 +905,13 @@ export function isAffirmative(parameter: any): boolean {
|
||||
export function isObject<T>(value: T | null | undefined): value is T {
|
||||
return value !== null && value !== undefined;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the value of both grainjs and knockout observable without creating a dependency.
|
||||
*/
|
||||
export const unwrap: UseCB = (obs: ISubscribable) => {
|
||||
if ('_getDepItem' in obs) {
|
||||
return obs.get();
|
||||
}
|
||||
return (obs as ko.Observable).peek();
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user