mirror of
https://github.com/gristlabs/grist-core.git
synced 2026-03-02 04:09:24 +00:00
(core) Forms Improvements
Summary: - Forms now have a reset button. - Choice and Reference fields in forms now have an improved select menu. - Formula and attachments column types are no longer mappable or visible in forms. - Fields in a form widget are now removed if their column is deleted. - The preview button in a published form widget has been replaced with a view button. It now opens the published form in a new tab. - A new share menu for published form widgets, with options to copy a link or embed code. - Forms can now have multiple sections. - Form widgets now indicate when publishing is unavailable (e.g. in forks or unsaved documents). - General improvements to form styling. Test Plan: Browser tests. Reviewers: jarek Reviewed By: jarek Subscribers: paulfitz Differential Revision: https://phab.getgrist.com/D4203
This commit is contained in:
@@ -1684,6 +1684,38 @@ export const TelemetryContracts: TelemetryContracts = {
|
||||
},
|
||||
},
|
||||
},
|
||||
submittedForm: {
|
||||
category: 'WidgetUsage',
|
||||
description: 'Triggered when a published form is submitted.',
|
||||
minimumTelemetryLevel: Level.full,
|
||||
retentionPeriod: 'indefinitely',
|
||||
metadataContracts: {
|
||||
docIdDigest: {
|
||||
description: 'A hash of the doc id.',
|
||||
dataType: 'string',
|
||||
},
|
||||
siteId: {
|
||||
description: 'The site id.',
|
||||
dataType: 'number',
|
||||
},
|
||||
siteType: {
|
||||
description: 'The site type.',
|
||||
dataType: 'string',
|
||||
},
|
||||
altSessionId: {
|
||||
description: 'A random, session-based identifier for the user that triggered this event.',
|
||||
dataType: 'string',
|
||||
},
|
||||
access: {
|
||||
description: 'The document access level of the user that triggered this event.',
|
||||
dataType: 'string',
|
||||
},
|
||||
userId: {
|
||||
description: 'The id of the user that triggered this event.',
|
||||
dataType: 'number',
|
||||
},
|
||||
},
|
||||
},
|
||||
changedAccessRules: {
|
||||
category: 'AccessRules',
|
||||
description: 'Triggered when a change to access rules is saved.',
|
||||
@@ -1776,6 +1808,7 @@ export const TelemetryEvents = StringUnion(
|
||||
'publishedForm',
|
||||
'unpublishedForm',
|
||||
'visitedForm',
|
||||
'submittedForm',
|
||||
'changedAccessRules',
|
||||
);
|
||||
export type TelemetryEvent = typeof TelemetryEvents.type;
|
||||
|
||||
@@ -169,6 +169,13 @@ export function isEmptyList(value: CellValue): boolean {
|
||||
return Array.isArray(value) && value.length === 1 && value[0] === GristObjCode.List;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether a value (as received in a DocAction) represents an empty reference list.
|
||||
*/
|
||||
export function isEmptyReferenceList(value: CellValue): boolean {
|
||||
return Array.isArray(value) && value.length === 1 && value[0] === GristObjCode.ReferenceList;
|
||||
}
|
||||
|
||||
function isNumber(v: CellValue) { return typeof v === 'number' || typeof v === 'boolean'; }
|
||||
function isNumberOrNull(v: CellValue) { return isNumber(v) || v === null; }
|
||||
function isBoolean(v: CellValue) { return typeof v === 'boolean' || v === 1 || v === 0; }
|
||||
@@ -344,6 +351,21 @@ export function isValidRuleValue(value: CellValue|undefined) {
|
||||
return value === null || typeof value === 'boolean';
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if `value` is blank.
|
||||
*
|
||||
* Blank values include `null`, (trimmed) empty string, and 0-length lists and
|
||||
* reference lists.
|
||||
*/
|
||||
export function isBlankValue(value: CellValue) {
|
||||
return (
|
||||
value === null ||
|
||||
(typeof value === 'string' && value.trim().length === 0) ||
|
||||
isEmptyList(value) ||
|
||||
isEmptyReferenceList(value)
|
||||
);
|
||||
}
|
||||
|
||||
export type RefListValue = [GristObjCode.List, ...number[]]|null;
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user