(core) Extending widget

Summary:
- Adding new option 'strictType' to widget mapping
- Refreshing mappings when widget options are changed

Test Plan: Updated

Reviewers: JakubSerafin

Reviewed By: JakubSerafin

Differential Revision: https://phab.getgrist.com/D4061
This commit is contained in:
Jarosław Sadziński
2023-10-09 11:00:40 +02:00
parent 572279916e
commit a8e0f96813
7 changed files with 146 additions and 7 deletions

View File

@@ -39,5 +39,10 @@
<button onclick="mappings()">mappings</button>
<button onclick="configure()">configure</button>
<button onclick="clearOptions()">clearOptions</button>
<button onclick="clearLog()">clearLog</button>
<div>meta columns:</div>
<textarea id="log"></textarea>
</body>
</html>

View File

@@ -26,6 +26,12 @@ function setup() {
document.getElementById('onRecords').innerHTML = JSON.stringify(data);
document.getElementById('onRecordsMappings').innerHTML = JSON.stringify(mappings);
});
grist.on('message', event => {
const existing = document.getElementById('log').textContent || '';
const newContent = `${existing}\n${JSON.stringify(event)}`.trim();
document.getElementById('log').innerHTML = newContent;
});
}
async function run(handler) {
@@ -67,6 +73,11 @@ async function configure() {
return run((options) => grist.sectionApi.configure(...options));
}
// eslint-disable-next-line no-unused-vars
async function clearLog() {
return run(() => document.getElementById('log').textContent = '');
}
window.onload = () => {
setup();
document.getElementById('ready').innerText = 'ready';