From 5f9c3075fa1d705a283ab649b7614a9bd38f0b06 Mon Sep 17 00:00:00 2001 From: guidone Date: Wed, 12 Jun 2024 14:44:15 +0200 Subject: [PATCH] hidden field --- CHANGELOG.md | 3 ++- common/hidden/index.js | 13 +++++++++++++ generator/index.js | 3 ++- react-antd/index.js | 3 +++ react-bootstrap/index.js | 3 +++ react-mantine/index.js | 3 +++ react-material-ui/index.js | 3 +++ react-rsuite5/index.js | 3 +++ react/index.js | 3 +++ 9 files changed, 35 insertions(+), 2 deletions(-) create mode 100644 common/hidden/index.js diff --git a/CHANGELOG.md b/CHANGELOG.md index b80133b8..740c0e4f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,11 +1,12 @@ # LetsForm Changelog -## Next +## 0.7.19 - fixed RSuite radio-group missing required icon - fixed RSuite fullWidth / Width params in select - added time component for MUI, RSuite, Mantine - fixed required icon for MUI for all components - cleanup and more properties for MUI Date and MUI Datime +- Hidden field for all frameworks ## v0.7.18 - added React Upload component diff --git a/common/hidden/index.js b/common/hidden/index.js new file mode 100644 index 00000000..5d451afe --- /dev/null +++ b/common/hidden/index.js @@ -0,0 +1,13 @@ +import React from 'react'; + +import { lfLog } from '../../helpers/lf-log'; + +const Hidden = ({ name }) => ( +
Hidden field: {name}
+); +lfLog('Loaded RSuite5.Hidden'); + +export default Hidden; diff --git a/generator/index.js b/generator/index.js index 87ffd4d1..766e7784 100644 --- a/generator/index.js +++ b/generator/index.js @@ -50,7 +50,8 @@ const GenerateGenerator = ({ Forms, Fields }) => { prependView }) => { const renderedFields = (fields || []) - .filter(field => Wrapper || field.hidden !== true) + .filter(field => Wrapper || field.component !== 'hidden') // skip hidden type field (not in design mode) + .filter(field => Wrapper || field.hidden !== true) // skip fields with "hidden" attribute (not in design mode) .map((field, index) => { let Component; if (Components[field.component] && Components[field.component][framework]) { diff --git a/react-antd/index.js b/react-antd/index.js index a606d483..93400bf2 100644 --- a/react-antd/index.js +++ b/react-antd/index.js @@ -81,6 +81,9 @@ const Fields = { }, 'steps': { 'react-antd': lazy(() => import('./steps')) + }, + 'hidden': { + 'react-antd': lazy(() => import('./../common/hidden')) } }; diff --git a/react-bootstrap/index.js b/react-bootstrap/index.js index 756e8e2b..7167bf18 100644 --- a/react-bootstrap/index.js +++ b/react-bootstrap/index.js @@ -66,6 +66,9 @@ const Fields = { }, 'button': { 'react-bootstrap': lazy(() => import('./button')) + }, + 'hidden': { + 'react-bootstrap': lazy(() => import('./../common/hidden')) } }; diff --git a/react-mantine/index.js b/react-mantine/index.js index 59aa4e0c..30906e1f 100644 --- a/react-mantine/index.js +++ b/react-mantine/index.js @@ -81,6 +81,9 @@ const Fields = { }, 'time': { 'react-mantine': lazy(() => import('./time')) + }, + 'hidden': { + 'react-mantine': lazy(() => import('./../common/hidden')) } }; diff --git a/react-material-ui/index.js b/react-material-ui/index.js index 644962e2..bbd564f6 100644 --- a/react-material-ui/index.js +++ b/react-material-ui/index.js @@ -78,6 +78,9 @@ const Fields = { }, 'time': { 'react-material-ui': lazy(() => import('./time')) + }, + 'hidden': { + 'react-material-ui': lazy(() => import('./../common/hidden')) } }; diff --git a/react-rsuite5/index.js b/react-rsuite5/index.js index f7575e66..12b6b831 100644 --- a/react-rsuite5/index.js +++ b/react-rsuite5/index.js @@ -102,6 +102,9 @@ const Fields = { }, 'time': { 'react-rsuite5': lazy(() => import('./time')) + }, + 'hidden': { + 'react-rsuite5': lazy(() => import('./../common/hidden')) } }; diff --git a/react/index.js b/react/index.js index efc3016e..d429cf5c 100644 --- a/react/index.js +++ b/react/index.js @@ -57,6 +57,9 @@ const Fields = { }, 'upload': { 'react': lazy(() => import('./upload')) + }, + 'hidden': { + 'react': lazy(() => import('./../common/hidden')) } // Removed, doesn't work /*'toggle': {