From 653ff9219890561a6f392f2e385c4c18882282c9 Mon Sep 17 00:00:00 2001 From: golbahsg Date: Wed, 30 Aug 2023 19:00:50 +0300 Subject: [PATCH] feat(ObjectBase): add inline variant --- .../Inputs/ObjectBase/ObjectBase.scss | 19 +++++++ .../Inputs/ObjectBase/ObjectBase.tsx | 48 ++++++++++++++--- src/lib/kit/constants/config.tsx | 2 + src/stories/Inline.stories.tsx | 51 +++++++++++++++++++ 4 files changed, 112 insertions(+), 8 deletions(-) create mode 100644 src/lib/kit/components/Inputs/ObjectBase/ObjectBase.scss create mode 100644 src/stories/Inline.stories.tsx diff --git a/src/lib/kit/components/Inputs/ObjectBase/ObjectBase.scss b/src/lib/kit/components/Inputs/ObjectBase/ObjectBase.scss new file mode 100644 index 00000000..561d4e96 --- /dev/null +++ b/src/lib/kit/components/Inputs/ObjectBase/ObjectBase.scss @@ -0,0 +1,19 @@ +@import '../../../styles/variables.scss'; + +.#{$ns}objectbase { + &__content { + &_inline { + display: flex; + + > .#{$ns}use-search { + flex: auto; + margin-bottom: 0; + margin-right: 8px; + + &:last-child { + margin-right: 0; + } + } + } + } +} diff --git a/src/lib/kit/components/Inputs/ObjectBase/ObjectBase.tsx b/src/lib/kit/components/Inputs/ObjectBase/ObjectBase.tsx index 3f0d6a83..b60c73e3 100644 --- a/src/lib/kit/components/Inputs/ObjectBase/ObjectBase.tsx +++ b/src/lib/kit/components/Inputs/ObjectBase/ObjectBase.tsx @@ -9,13 +9,30 @@ import { FieldObjectValue, FieldValue, ObjectIndependentInput, + ObjectIndependentInputProps, ObjectValue, - Spec, ValidateError, + isNumberSpec, + isStringSpec, transformArrIn, } from '../../../../core'; +import {block} from '../../../utils'; -export const ObjectBase: ObjectIndependentInput = ({spec, name, Layout, ...restProps}) => { +import './ObjectBase.scss'; + +const b = block('objectbase'); + +export interface ObjectBaseProps extends ObjectIndependentInputProps { + inline?: boolean; +} + +export const ObjectBase: React.FC = ({ + inline, + spec, + name, + Layout, + ...restProps +}) => { const addBtn = React.useMemo( () => (