From 00d0099355d48b10df5b5b11c30885c91594730f Mon Sep 17 00:00:00 2001 From: Jos de Jong Date: Wed, 2 Sep 2020 10:25:29 +0200 Subject: [PATCH] Implement Transform modal (WIP) --- src/components/modals/TransformModal.scss | 35 +++++++++ src/components/modals/TransformModal.svelte | 81 ++++++++++++++++++++- src/components/treemode/TreeMode.svelte | 31 ++++++-- src/logic/selection.js | 26 +++++-- src/logic/selection.test.js | 37 +++++++--- 5 files changed, 183 insertions(+), 27 deletions(-) diff --git a/src/components/modals/TransformModal.scss b/src/components/modals/TransformModal.scss index d551557..3a37714 100644 --- a/src/components/modals/TransformModal.scss +++ b/src/components/modals/TransformModal.scss @@ -1,2 +1,37 @@ @import '../../styles.scss'; @import './Modal.scss'; + +.jsoneditor-modal.transform { + + .description { + padding-bottom: $padding; + } + + label { + font-weight: bold; + padding: $padding/2 0; + display: block; + } + + textarea.query, + textarea.preview { + border: 1px solid $border-gray; + border-radius: $border-radius; + outline: none; + width: 100%; + height: 100px; + resize: vertical; // prevent resizing horizontally + box-sizing: border-box; + padding: $padding / 2; + font-family: $font-family-mono; + font-size: $font-size-mono; + } + + textarea.preview { + height: 200px; + + &.error { + color: $red; + } + } +} diff --git a/src/components/modals/TransformModal.svelte b/src/components/modals/TransformModal.svelte index 70ba808..2b05055 100644 --- a/src/components/modals/TransformModal.svelte +++ b/src/components/modals/TransformModal.svelte @@ -2,15 +2,94 @@
- TODO... +
+ Enter a JavaScript function to filter, sort, or transform the data. +
+ + +