gristlabs_grist-core/app/client/lib/domUtils.ts
Jarosław Sadziński a424450cbe (core) Forms feature
Summary:
A new widget type Forms. For now hidden behind GRIST_EXPERIMENTAL_PLUGINS().
This diff contains all the core moving parts as a serves as a base to extend this functionality
further.

Test Plan: New test added

Reviewers: georgegevoian

Reviewed By: georgegevoian

Subscribers: paulfitz

Differential Revision: https://phab.getgrist.com/D4130
2023-12-20 13:23:12 +01:00

17 lines
471 B
TypeScript

import {useBindable} from 'app/common/gutil';
import {BindableValue, dom} from 'grainjs';
/**
* Version of makeTestId that can be appended conditionally.
*/
export function makeTestId(prefix: string) {
return (id: BindableValue<string>, obs?: BindableValue<boolean>) => {
return dom.cls(use => {
if (obs !== undefined && !useBindable(use, obs)) {
return '';
}
return `${useBindable(use, prefix)}${useBindable(use, id)}`;
});
};
}