2018-07-24 17:13:48 -04:00
import React from 'react' ;
2017-12-07 15:37:42 -05:00
import PropTypes from 'prop-types' ;
2017-08-14 09:00:47 -04:00
import ImmutablePropTypes from 'react-immutable-proptypes' ;
2019-03-15 10:19:57 -04:00
import styled from '@emotion/styled' ;
2019-12-16 12:17:37 -05:00
import { css , ClassNames } from '@emotion/core' ;
2019-07-11 20:40:34 +01:00
import { List , Map , fromJS } from 'immutable' ;
2021-07-14 20:13:50 +05:30
import { partial , isEmpty , uniqueId } from 'lodash' ;
2019-12-16 12:17:37 -05:00
import uuid from 'uuid/v4' ;
2017-10-16 18:16:03 -07:00
import { SortableContainer , SortableElement , SortableHandle } from 'react-sortable-hoc' ;
2019-03-27 13:47:28 -07:00
import NetlifyCmsWidgetObject from 'netlify-cms-widget-object' ;
2021-07-14 20:13:50 +05:30
import {
ListItemTopBar ,
ObjectWidgetTopBar ,
colors ,
lengths ,
FieldLabel ,
} from 'netlify-cms-ui-default' ;
2021-05-31 16:46:41 +02:00
import { stringTemplate , validations } from 'netlify-cms-lib-widgets' ;
2018-12-27 06:51:35 +02:00
import {
TYPES _KEY ,
getTypedFieldForValue ,
resolveFieldKeyType ,
getErrorMessageForTypedFieldAndValue ,
} from './typedListHelpers' ;
2016-10-30 16:01:10 -07:00
2019-03-27 13:47:28 -07:00
const ObjectControl = NetlifyCmsWidgetObject . controlComponent ;
2018-07-24 17:13:48 -04:00
const ListItem = styled . div ( ) ;
2017-10-16 18:16:03 -07:00
const SortableListItem = SortableElement ( ListItem ) ;
WIP - Global UI (#785)
* update top bar and collections sidebar UI
* update collection entries UI
* improve global layout
* merge search page into collection page
* enable new entry button
* search fixup
* wip -initial editor update
* update editor scrolling and markdown toolbar position
* wip
* editor toolbar progress
* editor toolbar wip
* finished basic editor toolbar
* add standalone toggle component
* improve markdown toolbar spacing
* add user avatar placeholder
* finish markdown toggle styling
* refactor icon setup, add new icons
* add new icons to markdown editor toolbar
* remove extra app container
* add markdown active mark style
* relation and text widget styling
* widget design updates, basic list/object design update
* widget style updates, image widget improvements
* refactor widget directory, fix file removal
* widget focus styles
* finish editor widget focus styles
* migrate media library modal to react-modal
* wip - migrate editor component form to modal
* wip - move editor component form to modal
* wip - embed plugin forms in the editor
* inline shortcode forms working
* disable react hot loading, its breaking things
* improve shortcode form styles
* make shortcode form collapsible, improve styling
* add close functionality to shortcode blocks
* improve base media library styling
* fix shortcode label
* migrate unstyled workflow to new UI
* wip - reorganizing everything
* more work moving everything
* finish more moving and eliminating stuff
* restructure, remove react-toolbox
* wip - removing old stuff, more restructure
* finish restructure
* wip - css arch
* switch back to test repo
* update react-datetime to ^2.11.0
* remove leftover react-toolbox button
* more restructuring clean-up
* fix UI component directory case
* wip -css editor control style
* wip - consolidate widget styles
* wip - use a single control renderer
* fixed object values breaking
* wip - editor control active styles
* pass control wrapper to widgets
* ensure branch name is trimmed
* wip - improve widget authoring support
* import Map to Widget component
* refactor toolbar buttons
* wip - more widget active styles
* break out editor toggle component
* add local scroll sync back
* update editor toggle icons
* limit editor control pane content width
* fix editor control spacing
* migrate markdown toolbar stickiness to css
* fix markdown toolbar border radius
* temporarily use test backend
* stop markdown toolbar from going to bottom
* restore disabled markdown toolbar buttons for raw
* test markdown widget without focus styles
* more widget updates
* remove card visuals from editor
* disable dragging editor split off screen
* use editorControl component for shortcode fields
* make header site link configurable
* add configurable collection descriptions
* temporarily add example assets
* add basic list view
* remove outdated css mixins
* add and implement search icon
* activate quick add menu
* visualize usable space in editor view
* fix entry close, other improvements
* wip - editorial workflow updates
* some dropshadow and other CSS tweaks
* workflow ui updates
* add worfklow card buttons
* fix workflow card button handlers
* some dropshadow and other CSS tweaks
* make workflow board wider
* center workflow and collection views
* add basic responsiveness
* a bunch of fun UI fixes! a BUNCH! (#875)
* give `.nc-entryEditor-toolbar-mainSection` left and right child divs
* a bunch of fun UI fixes! a BUNCH!
* remove obscure --buttonShadow
* revert to test repo
* fix not found page styling
* allow workflow publishing from any column
* disallow publishing from all columns, with feedback
* fix new entry button
* fix markdown state persisting across entries
* enable simple workflow save and new from editor
* update slug in address bar when saving new entry
* wip - workflow updates, deletion working
* add status change functionality to editor
* wip - improving status change from editor
* editor toolbar back button improvements, loading improvements, cleanup
* progress on the media library UI cleanup
* remove font smothing css
* a quick fix for these buttons
* tweaks
* progress on media library modal— broken FYI
* fix media library functionality, finish migrating footer
* remove media library footer files
* remove leftover css import
* fix media library
* editor publishing functionality complete (unstyled)
* remove leftover loader var from media library
* wip - editor publishing styles
* add status dropdown styling
* editor toolbar style updates
* editor toolbar state improvements
* progress on the media library UI cleanup, style improvements
* finish editorial workflow editor styling
* finish media library styling
* fix config
* add what-input to optimize focus styling
* fix button
* fix navigation blocking for simple workflow
* improve simple workflow publishing
* add avatar dropdown to editor top bar
* style github and test-repo auth pages
* add git gateway auth page styles
* improve editor error styling
2017-12-07 12:37:10 -05:00
2018-07-24 17:13:48 -04:00
const StyledListItemTopBar = styled ( ListItemTopBar ) `
background - color : $ { colors . textFieldBorder } ;
2018-08-07 14:46:54 -06:00
` ;
2018-07-24 17:13:48 -04:00
const NestedObjectLabel = styled . div `
2018-08-07 14:46:54 -06:00
display : $ { props => ( props . collapsed ? 'block' : 'none' ) } ;
2018-07-24 17:13:48 -04:00
border - top : 0 ;
2018-12-27 06:51:35 +02:00
color : $ { props => ( props . error ? colors . errorText : 'inherit' ) } ;
2018-07-24 17:13:48 -04:00
background - color : $ { colors . textFieldBorder } ;
padding : 13 px ;
border - radius : 0 0 $ { lengths . borderRadius } $ { lengths . borderRadius } ;
2018-08-07 14:46:54 -06:00
` ;
2018-07-24 17:13:48 -04:00
2019-03-15 10:19:57 -04:00
const styleStrings = {
collapsedObjectControl : `
2018-07-24 17:13:48 -04:00
display : none ;
` ,
2019-03-15 10:19:57 -04:00
objectWidgetTopBarContainer : `
padding : $ { lengths . objectWidgetTopBarContainerPadding } ;
` ,
} ;
const styles = {
2018-07-24 17:13:48 -04:00
listControlItem : css `
margin - top : 18 px ;
& : first - of - type {
margin - top : 26 px ;
2018-03-15 16:16:32 -04:00
}
2018-07-24 17:13:48 -04:00
` ,
listControlItemCollapsed : css `
padding - bottom : 0 ;
` ,
} ;
WIP - Global UI (#785)
* update top bar and collections sidebar UI
* update collection entries UI
* improve global layout
* merge search page into collection page
* enable new entry button
* search fixup
* wip -initial editor update
* update editor scrolling and markdown toolbar position
* wip
* editor toolbar progress
* editor toolbar wip
* finished basic editor toolbar
* add standalone toggle component
* improve markdown toolbar spacing
* add user avatar placeholder
* finish markdown toggle styling
* refactor icon setup, add new icons
* add new icons to markdown editor toolbar
* remove extra app container
* add markdown active mark style
* relation and text widget styling
* widget design updates, basic list/object design update
* widget style updates, image widget improvements
* refactor widget directory, fix file removal
* widget focus styles
* finish editor widget focus styles
* migrate media library modal to react-modal
* wip - migrate editor component form to modal
* wip - move editor component form to modal
* wip - embed plugin forms in the editor
* inline shortcode forms working
* disable react hot loading, its breaking things
* improve shortcode form styles
* make shortcode form collapsible, improve styling
* add close functionality to shortcode blocks
* improve base media library styling
* fix shortcode label
* migrate unstyled workflow to new UI
* wip - reorganizing everything
* more work moving everything
* finish more moving and eliminating stuff
* restructure, remove react-toolbox
* wip - removing old stuff, more restructure
* finish restructure
* wip - css arch
* switch back to test repo
* update react-datetime to ^2.11.0
* remove leftover react-toolbox button
* more restructuring clean-up
* fix UI component directory case
* wip -css editor control style
* wip - consolidate widget styles
* wip - use a single control renderer
* fixed object values breaking
* wip - editor control active styles
* pass control wrapper to widgets
* ensure branch name is trimmed
* wip - improve widget authoring support
* import Map to Widget component
* refactor toolbar buttons
* wip - more widget active styles
* break out editor toggle component
* add local scroll sync back
* update editor toggle icons
* limit editor control pane content width
* fix editor control spacing
* migrate markdown toolbar stickiness to css
* fix markdown toolbar border radius
* temporarily use test backend
* stop markdown toolbar from going to bottom
* restore disabled markdown toolbar buttons for raw
* test markdown widget without focus styles
* more widget updates
* remove card visuals from editor
* disable dragging editor split off screen
* use editorControl component for shortcode fields
* make header site link configurable
* add configurable collection descriptions
* temporarily add example assets
* add basic list view
* remove outdated css mixins
* add and implement search icon
* activate quick add menu
* visualize usable space in editor view
* fix entry close, other improvements
* wip - editorial workflow updates
* some dropshadow and other CSS tweaks
* workflow ui updates
* add worfklow card buttons
* fix workflow card button handlers
* some dropshadow and other CSS tweaks
* make workflow board wider
* center workflow and collection views
* add basic responsiveness
* a bunch of fun UI fixes! a BUNCH! (#875)
* give `.nc-entryEditor-toolbar-mainSection` left and right child divs
* a bunch of fun UI fixes! a BUNCH!
* remove obscure --buttonShadow
* revert to test repo
* fix not found page styling
* allow workflow publishing from any column
* disallow publishing from all columns, with feedback
* fix new entry button
* fix markdown state persisting across entries
* enable simple workflow save and new from editor
* update slug in address bar when saving new entry
* wip - workflow updates, deletion working
* add status change functionality to editor
* wip - improving status change from editor
* editor toolbar back button improvements, loading improvements, cleanup
* progress on the media library UI cleanup
* remove font smothing css
* a quick fix for these buttons
* tweaks
* progress on media library modal— broken FYI
* fix media library functionality, finish migrating footer
* remove media library footer files
* remove leftover css import
* fix media library
* editor publishing functionality complete (unstyled)
* remove leftover loader var from media library
* wip - editor publishing styles
* add status dropdown styling
* editor toolbar style updates
* editor toolbar state improvements
* progress on the media library UI cleanup, style improvements
* finish editorial workflow editor styling
* finish media library styling
* fix config
* add what-input to optimize focus styling
* fix button
* fix navigation blocking for simple workflow
* improve simple workflow publishing
* add avatar dropdown to editor top bar
* style github and test-repo auth pages
* add git gateway auth page styles
* improve editor error styling
2017-12-07 12:37:10 -05:00
const SortableList = SortableContainer ( ( { items , renderItem } ) => {
return < div > { items . map ( renderItem ) } < / d i v > ;
} ) ;
2016-10-30 16:01:10 -07:00
2016-11-29 20:18:01 -02:00
const valueTypes = {
SINGLE : 'SINGLE' ,
MULTIPLE : 'MULTIPLE' ,
2018-12-27 06:51:35 +02:00
MIXED : 'MIXED' ,
2016-11-29 20:18:01 -02:00
} ;
2021-02-08 20:01:21 +02:00
function handleSummary ( summary , entry , label , item ) {
2020-05-11 22:30:29 +09:00
const data = stringTemplate . addFileTemplateFields (
entry . get ( 'path' ) ,
item . set ( 'fields.label' , label ) ,
) ;
return stringTemplate . compileStringTemplate ( summary , null , '' , data ) ;
2021-02-08 20:01:21 +02:00
}
2020-05-11 22:30:29 +09:00
2021-04-05 08:54:07 -07:00
function validateItem ( field , item ) {
if ( ! Map . isMap ( item ) ) {
console . warn (
` ' ${ field . get ( 'name' ) } ' field item value value should be a map but is a ' ${ typeof item } ' ` ,
) ;
return false ;
}
return true ;
}
2021-07-14 20:13:50 +05:30
function LabelComponent ( { field , isActive , hasErrors , uniqueFieldId , isFieldOptional , t } ) {
const label = ` ${ field . get ( 'label' , field . get ( 'name' ) ) } ` ;
return (
< FieldLabel isActive = { isActive } hasErrors = { hasErrors } htmlFor = { uniqueFieldId } >
{ label } { ` ${ isFieldOptional ? ` ( ${ t ( 'editor.editorControl.field.optional' ) } ) ` : '' } ` }
< / F i e l d L a b e l >
) ;
}
2021-04-05 08:54:07 -07:00
2018-07-24 17:13:48 -04:00
export default class ListControl extends React . Component {
2019-02-05 23:27:34 +01:00
validations = [ ] ;
2016-10-21 20:42:14 -02:00
static propTypes = {
2018-08-27 10:23:21 -06:00
metadata : ImmutablePropTypes . map ,
2016-10-21 20:42:14 -02:00
onChange : PropTypes . func . isRequired ,
WIP - Global UI (#785)
* update top bar and collections sidebar UI
* update collection entries UI
* improve global layout
* merge search page into collection page
* enable new entry button
* search fixup
* wip -initial editor update
* update editor scrolling and markdown toolbar position
* wip
* editor toolbar progress
* editor toolbar wip
* finished basic editor toolbar
* add standalone toggle component
* improve markdown toolbar spacing
* add user avatar placeholder
* finish markdown toggle styling
* refactor icon setup, add new icons
* add new icons to markdown editor toolbar
* remove extra app container
* add markdown active mark style
* relation and text widget styling
* widget design updates, basic list/object design update
* widget style updates, image widget improvements
* refactor widget directory, fix file removal
* widget focus styles
* finish editor widget focus styles
* migrate media library modal to react-modal
* wip - migrate editor component form to modal
* wip - move editor component form to modal
* wip - embed plugin forms in the editor
* inline shortcode forms working
* disable react hot loading, its breaking things
* improve shortcode form styles
* make shortcode form collapsible, improve styling
* add close functionality to shortcode blocks
* improve base media library styling
* fix shortcode label
* migrate unstyled workflow to new UI
* wip - reorganizing everything
* more work moving everything
* finish more moving and eliminating stuff
* restructure, remove react-toolbox
* wip - removing old stuff, more restructure
* finish restructure
* wip - css arch
* switch back to test repo
* update react-datetime to ^2.11.0
* remove leftover react-toolbox button
* more restructuring clean-up
* fix UI component directory case
* wip -css editor control style
* wip - consolidate widget styles
* wip - use a single control renderer
* fixed object values breaking
* wip - editor control active styles
* pass control wrapper to widgets
* ensure branch name is trimmed
* wip - improve widget authoring support
* import Map to Widget component
* refactor toolbar buttons
* wip - more widget active styles
* break out editor toggle component
* add local scroll sync back
* update editor toggle icons
* limit editor control pane content width
* fix editor control spacing
* migrate markdown toolbar stickiness to css
* fix markdown toolbar border radius
* temporarily use test backend
* stop markdown toolbar from going to bottom
* restore disabled markdown toolbar buttons for raw
* test markdown widget without focus styles
* more widget updates
* remove card visuals from editor
* disable dragging editor split off screen
* use editorControl component for shortcode fields
* make header site link configurable
* add configurable collection descriptions
* temporarily add example assets
* add basic list view
* remove outdated css mixins
* add and implement search icon
* activate quick add menu
* visualize usable space in editor view
* fix entry close, other improvements
* wip - editorial workflow updates
* some dropshadow and other CSS tweaks
* workflow ui updates
* add worfklow card buttons
* fix workflow card button handlers
* some dropshadow and other CSS tweaks
* make workflow board wider
* center workflow and collection views
* add basic responsiveness
* a bunch of fun UI fixes! a BUNCH! (#875)
* give `.nc-entryEditor-toolbar-mainSection` left and right child divs
* a bunch of fun UI fixes! a BUNCH!
* remove obscure --buttonShadow
* revert to test repo
* fix not found page styling
* allow workflow publishing from any column
* disallow publishing from all columns, with feedback
* fix new entry button
* fix markdown state persisting across entries
* enable simple workflow save and new from editor
* update slug in address bar when saving new entry
* wip - workflow updates, deletion working
* add status change functionality to editor
* wip - improving status change from editor
* editor toolbar back button improvements, loading improvements, cleanup
* progress on the media library UI cleanup
* remove font smothing css
* a quick fix for these buttons
* tweaks
* progress on media library modal— broken FYI
* fix media library functionality, finish migrating footer
* remove media library footer files
* remove leftover css import
* fix media library
* editor publishing functionality complete (unstyled)
* remove leftover loader var from media library
* wip - editor publishing styles
* add status dropdown styling
* editor toolbar style updates
* editor toolbar state improvements
* progress on the media library UI cleanup, style improvements
* finish editorial workflow editor styling
* finish media library styling
* fix config
* add what-input to optimize focus styling
* fix button
* fix navigation blocking for simple workflow
* improve simple workflow publishing
* add avatar dropdown to editor top bar
* style github and test-repo auth pages
* add git gateway auth page styles
* improve editor error styling
2017-12-07 12:37:10 -05:00
onChangeObject : PropTypes . func . isRequired ,
2019-02-05 23:27:34 +01:00
onValidateObject : PropTypes . func . isRequired ,
2019-12-25 09:48:47 +01:00
validate : PropTypes . func . isRequired ,
2017-12-22 22:30:05 +01:00
value : ImmutablePropTypes . list ,
field : PropTypes . object ,
2017-06-04 17:20:40 +02:00
forID : PropTypes . string ,
2019-02-05 23:27:34 +01:00
controlRef : PropTypes . func ,
2017-08-14 09:00:47 -04:00
mediaPaths : ImmutablePropTypes . map . isRequired ,
2017-01-10 22:23:22 -02:00
getAsset : PropTypes . func . isRequired ,
2017-08-14 09:00:47 -04:00
onOpenMediaLibrary : PropTypes . func . isRequired ,
2017-01-10 22:23:22 -02:00
onAddAsset : PropTypes . func . isRequired ,
WIP - Global UI (#785)
* update top bar and collections sidebar UI
* update collection entries UI
* improve global layout
* merge search page into collection page
* enable new entry button
* search fixup
* wip -initial editor update
* update editor scrolling and markdown toolbar position
* wip
* editor toolbar progress
* editor toolbar wip
* finished basic editor toolbar
* add standalone toggle component
* improve markdown toolbar spacing
* add user avatar placeholder
* finish markdown toggle styling
* refactor icon setup, add new icons
* add new icons to markdown editor toolbar
* remove extra app container
* add markdown active mark style
* relation and text widget styling
* widget design updates, basic list/object design update
* widget style updates, image widget improvements
* refactor widget directory, fix file removal
* widget focus styles
* finish editor widget focus styles
* migrate media library modal to react-modal
* wip - migrate editor component form to modal
* wip - move editor component form to modal
* wip - embed plugin forms in the editor
* inline shortcode forms working
* disable react hot loading, its breaking things
* improve shortcode form styles
* make shortcode form collapsible, improve styling
* add close functionality to shortcode blocks
* improve base media library styling
* fix shortcode label
* migrate unstyled workflow to new UI
* wip - reorganizing everything
* more work moving everything
* finish more moving and eliminating stuff
* restructure, remove react-toolbox
* wip - removing old stuff, more restructure
* finish restructure
* wip - css arch
* switch back to test repo
* update react-datetime to ^2.11.0
* remove leftover react-toolbox button
* more restructuring clean-up
* fix UI component directory case
* wip -css editor control style
* wip - consolidate widget styles
* wip - use a single control renderer
* fixed object values breaking
* wip - editor control active styles
* pass control wrapper to widgets
* ensure branch name is trimmed
* wip - improve widget authoring support
* import Map to Widget component
* refactor toolbar buttons
* wip - more widget active styles
* break out editor toggle component
* add local scroll sync back
* update editor toggle icons
* limit editor control pane content width
* fix editor control spacing
* migrate markdown toolbar stickiness to css
* fix markdown toolbar border radius
* temporarily use test backend
* stop markdown toolbar from going to bottom
* restore disabled markdown toolbar buttons for raw
* test markdown widget without focus styles
* more widget updates
* remove card visuals from editor
* disable dragging editor split off screen
* use editorControl component for shortcode fields
* make header site link configurable
* add configurable collection descriptions
* temporarily add example assets
* add basic list view
* remove outdated css mixins
* add and implement search icon
* activate quick add menu
* visualize usable space in editor view
* fix entry close, other improvements
* wip - editorial workflow updates
* some dropshadow and other CSS tweaks
* workflow ui updates
* add worfklow card buttons
* fix workflow card button handlers
* some dropshadow and other CSS tweaks
* make workflow board wider
* center workflow and collection views
* add basic responsiveness
* a bunch of fun UI fixes! a BUNCH! (#875)
* give `.nc-entryEditor-toolbar-mainSection` left and right child divs
* a bunch of fun UI fixes! a BUNCH!
* remove obscure --buttonShadow
* revert to test repo
* fix not found page styling
* allow workflow publishing from any column
* disallow publishing from all columns, with feedback
* fix new entry button
* fix markdown state persisting across entries
* enable simple workflow save and new from editor
* update slug in address bar when saving new entry
* wip - workflow updates, deletion working
* add status change functionality to editor
* wip - improving status change from editor
* editor toolbar back button improvements, loading improvements, cleanup
* progress on the media library UI cleanup
* remove font smothing css
* a quick fix for these buttons
* tweaks
* progress on media library modal— broken FYI
* fix media library functionality, finish migrating footer
* remove media library footer files
* remove leftover css import
* fix media library
* editor publishing functionality complete (unstyled)
* remove leftover loader var from media library
* wip - editor publishing styles
* add status dropdown styling
* editor toolbar style updates
* editor toolbar state improvements
* progress on the media library UI cleanup, style improvements
* finish editorial workflow editor styling
* finish media library styling
* fix config
* add what-input to optimize focus styling
* fix button
* fix navigation blocking for simple workflow
* improve simple workflow publishing
* add avatar dropdown to editor top bar
* style github and test-repo auth pages
* add git gateway auth page styles
* improve editor error styling
2017-12-07 12:37:10 -05:00
onRemoveInsertedMedia : PropTypes . func . isRequired ,
classNameWrapper : PropTypes . string . isRequired ,
setActiveStyle : PropTypes . func . isRequired ,
setInactiveStyle : PropTypes . func . isRequired ,
2020-07-15 14:21:08 +03:00
editorControl : PropTypes . elementType . isRequired ,
2018-08-27 10:23:21 -06:00
resolveWidget : PropTypes . func . isRequired ,
2019-02-05 23:27:34 +01:00
clearFieldErrors : PropTypes . func . isRequired ,
fieldsErrors : ImmutablePropTypes . map . isRequired ,
2020-05-11 22:30:29 +09:00
entry : ImmutablePropTypes . map . isRequired ,
2021-08-04 13:56:38 +02:00
t : PropTypes . func . isRequired ,
2016-10-21 20:42:14 -02:00
} ;
2016-10-28 19:13:26 +02:00
2017-12-22 22:30:05 +01:00
static defaultProps = {
value : List ( ) ,
2020-05-25 01:42:54 -05:00
parentIds : [ ] ,
2017-12-22 22:30:05 +01:00
} ;
2016-10-28 19:13:26 +02:00
constructor ( props ) {
super ( props ) ;
2017-12-22 22:30:05 +01:00
const { field , value } = props ;
2020-05-17 15:47:07 +02:00
const listCollapsed = field . get ( 'collapsed' , true ) ;
const itemsCollapsed = ( value && Array ( value . size ) . fill ( listCollapsed ) ) || [ ] ;
const keys = ( value && Array . from ( { length : value . size } , ( ) => uuid ( ) ) ) || [ ] ;
2017-12-22 22:30:05 +01:00
WIP - Global UI (#785)
* update top bar and collections sidebar UI
* update collection entries UI
* improve global layout
* merge search page into collection page
* enable new entry button
* search fixup
* wip -initial editor update
* update editor scrolling and markdown toolbar position
* wip
* editor toolbar progress
* editor toolbar wip
* finished basic editor toolbar
* add standalone toggle component
* improve markdown toolbar spacing
* add user avatar placeholder
* finish markdown toggle styling
* refactor icon setup, add new icons
* add new icons to markdown editor toolbar
* remove extra app container
* add markdown active mark style
* relation and text widget styling
* widget design updates, basic list/object design update
* widget style updates, image widget improvements
* refactor widget directory, fix file removal
* widget focus styles
* finish editor widget focus styles
* migrate media library modal to react-modal
* wip - migrate editor component form to modal
* wip - move editor component form to modal
* wip - embed plugin forms in the editor
* inline shortcode forms working
* disable react hot loading, its breaking things
* improve shortcode form styles
* make shortcode form collapsible, improve styling
* add close functionality to shortcode blocks
* improve base media library styling
* fix shortcode label
* migrate unstyled workflow to new UI
* wip - reorganizing everything
* more work moving everything
* finish more moving and eliminating stuff
* restructure, remove react-toolbox
* wip - removing old stuff, more restructure
* finish restructure
* wip - css arch
* switch back to test repo
* update react-datetime to ^2.11.0
* remove leftover react-toolbox button
* more restructuring clean-up
* fix UI component directory case
* wip -css editor control style
* wip - consolidate widget styles
* wip - use a single control renderer
* fixed object values breaking
* wip - editor control active styles
* pass control wrapper to widgets
* ensure branch name is trimmed
* wip - improve widget authoring support
* import Map to Widget component
* refactor toolbar buttons
* wip - more widget active styles
* break out editor toggle component
* add local scroll sync back
* update editor toggle icons
* limit editor control pane content width
* fix editor control spacing
* migrate markdown toolbar stickiness to css
* fix markdown toolbar border radius
* temporarily use test backend
* stop markdown toolbar from going to bottom
* restore disabled markdown toolbar buttons for raw
* test markdown widget without focus styles
* more widget updates
* remove card visuals from editor
* disable dragging editor split off screen
* use editorControl component for shortcode fields
* make header site link configurable
* add configurable collection descriptions
* temporarily add example assets
* add basic list view
* remove outdated css mixins
* add and implement search icon
* activate quick add menu
* visualize usable space in editor view
* fix entry close, other improvements
* wip - editorial workflow updates
* some dropshadow and other CSS tweaks
* workflow ui updates
* add worfklow card buttons
* fix workflow card button handlers
* some dropshadow and other CSS tweaks
* make workflow board wider
* center workflow and collection views
* add basic responsiveness
* a bunch of fun UI fixes! a BUNCH! (#875)
* give `.nc-entryEditor-toolbar-mainSection` left and right child divs
* a bunch of fun UI fixes! a BUNCH!
* remove obscure --buttonShadow
* revert to test repo
* fix not found page styling
* allow workflow publishing from any column
* disallow publishing from all columns, with feedback
* fix new entry button
* fix markdown state persisting across entries
* enable simple workflow save and new from editor
* update slug in address bar when saving new entry
* wip - workflow updates, deletion working
* add status change functionality to editor
* wip - improving status change from editor
* editor toolbar back button improvements, loading improvements, cleanup
* progress on the media library UI cleanup
* remove font smothing css
* a quick fix for these buttons
* tweaks
* progress on media library modal— broken FYI
* fix media library functionality, finish migrating footer
* remove media library footer files
* remove leftover css import
* fix media library
* editor publishing functionality complete (unstyled)
* remove leftover loader var from media library
* wip - editor publishing styles
* add status dropdown styling
* editor toolbar style updates
* editor toolbar state improvements
* progress on the media library UI cleanup, style improvements
* finish editorial workflow editor styling
* finish media library styling
* fix config
* add what-input to optimize focus styling
* fix button
* fix navigation blocking for simple workflow
* improve simple workflow publishing
* add avatar dropdown to editor top bar
* style github and test-repo auth pages
* add git gateway auth page styles
* improve editor error styling
2017-12-07 12:37:10 -05:00
this . state = {
2020-05-17 15:47:07 +02:00
listCollapsed ,
itemsCollapsed ,
2021-07-07 14:09:11 +02:00
value : this . valueToString ( value ) ,
2020-05-17 15:47:07 +02:00
keys ,
WIP - Global UI (#785)
* update top bar and collections sidebar UI
* update collection entries UI
* improve global layout
* merge search page into collection page
* enable new entry button
* search fixup
* wip -initial editor update
* update editor scrolling and markdown toolbar position
* wip
* editor toolbar progress
* editor toolbar wip
* finished basic editor toolbar
* add standalone toggle component
* improve markdown toolbar spacing
* add user avatar placeholder
* finish markdown toggle styling
* refactor icon setup, add new icons
* add new icons to markdown editor toolbar
* remove extra app container
* add markdown active mark style
* relation and text widget styling
* widget design updates, basic list/object design update
* widget style updates, image widget improvements
* refactor widget directory, fix file removal
* widget focus styles
* finish editor widget focus styles
* migrate media library modal to react-modal
* wip - migrate editor component form to modal
* wip - move editor component form to modal
* wip - embed plugin forms in the editor
* inline shortcode forms working
* disable react hot loading, its breaking things
* improve shortcode form styles
* make shortcode form collapsible, improve styling
* add close functionality to shortcode blocks
* improve base media library styling
* fix shortcode label
* migrate unstyled workflow to new UI
* wip - reorganizing everything
* more work moving everything
* finish more moving and eliminating stuff
* restructure, remove react-toolbox
* wip - removing old stuff, more restructure
* finish restructure
* wip - css arch
* switch back to test repo
* update react-datetime to ^2.11.0
* remove leftover react-toolbox button
* more restructuring clean-up
* fix UI component directory case
* wip -css editor control style
* wip - consolidate widget styles
* wip - use a single control renderer
* fixed object values breaking
* wip - editor control active styles
* pass control wrapper to widgets
* ensure branch name is trimmed
* wip - improve widget authoring support
* import Map to Widget component
* refactor toolbar buttons
* wip - more widget active styles
* break out editor toggle component
* add local scroll sync back
* update editor toggle icons
* limit editor control pane content width
* fix editor control spacing
* migrate markdown toolbar stickiness to css
* fix markdown toolbar border radius
* temporarily use test backend
* stop markdown toolbar from going to bottom
* restore disabled markdown toolbar buttons for raw
* test markdown widget without focus styles
* more widget updates
* remove card visuals from editor
* disable dragging editor split off screen
* use editorControl component for shortcode fields
* make header site link configurable
* add configurable collection descriptions
* temporarily add example assets
* add basic list view
* remove outdated css mixins
* add and implement search icon
* activate quick add menu
* visualize usable space in editor view
* fix entry close, other improvements
* wip - editorial workflow updates
* some dropshadow and other CSS tweaks
* workflow ui updates
* add worfklow card buttons
* fix workflow card button handlers
* some dropshadow and other CSS tweaks
* make workflow board wider
* center workflow and collection views
* add basic responsiveness
* a bunch of fun UI fixes! a BUNCH! (#875)
* give `.nc-entryEditor-toolbar-mainSection` left and right child divs
* a bunch of fun UI fixes! a BUNCH!
* remove obscure --buttonShadow
* revert to test repo
* fix not found page styling
* allow workflow publishing from any column
* disallow publishing from all columns, with feedback
* fix new entry button
* fix markdown state persisting across entries
* enable simple workflow save and new from editor
* update slug in address bar when saving new entry
* wip - workflow updates, deletion working
* add status change functionality to editor
* wip - improving status change from editor
* editor toolbar back button improvements, loading improvements, cleanup
* progress on the media library UI cleanup
* remove font smothing css
* a quick fix for these buttons
* tweaks
* progress on media library modal— broken FYI
* fix media library functionality, finish migrating footer
* remove media library footer files
* remove leftover css import
* fix media library
* editor publishing functionality complete (unstyled)
* remove leftover loader var from media library
* wip - editor publishing styles
* add status dropdown styling
* editor toolbar style updates
* editor toolbar state improvements
* progress on the media library UI cleanup, style improvements
* finish editorial workflow editor styling
* finish media library styling
* fix config
* add what-input to optimize focus styling
* fix button
* fix navigation blocking for simple workflow
* improve simple workflow publishing
* add avatar dropdown to editor top bar
* style github and test-repo auth pages
* add git gateway auth page styles
* improve editor error styling
2017-12-07 12:37:10 -05:00
} ;
2018-07-31 14:59:22 -06:00
}
2017-12-22 22:30:05 +01:00
2021-07-07 14:09:11 +02:00
valueToString = value => {
let stringValue ;
if ( List . isList ( value ) || Array . isArray ( value ) ) {
stringValue = value . join ( ',' ) ;
} else {
console . warn (
` Expected List value to be an array but received ' ${ value } ' with type of ' ${ typeof value } '. Please check the value provided to the ' ${ this . props . field . get (
'name' ,
) } ' field ` ,
) ;
stringValue = String ( value ) ;
}
return stringValue . replace ( /,([^\s]|$)/g , ', $1' ) ;
} ;
2018-07-31 14:59:22 -06:00
getValueType = ( ) => {
const { field } = this . props ;
if ( field . get ( 'fields' ) ) {
return valueTypes . MULTIPLE ;
} else if ( field . get ( 'field' ) ) {
return valueTypes . SINGLE ;
2018-12-27 06:51:35 +02:00
} else if ( field . get ( TYPES _KEY ) ) {
return valueTypes . MIXED ;
2018-07-31 14:59:22 -06:00
} else {
return null ;
}
2018-08-07 14:46:54 -06:00
} ;
2016-11-29 20:18:01 -02:00
2021-07-14 20:13:50 +05:30
uniqueFieldId = uniqueId ( ` ${ this . props . field . get ( 'name' ) } -field- ` ) ;
2017-08-14 09:00:47 -04:00
/ * *
* Always update so that each nested widget has the option to update . This is
* required because ControlHOC provides a default ` shouldComponentUpdate `
* which only updates if the value changes , but every widget must be allowed
* to override this .
* /
shouldComponentUpdate ( ) {
return true ;
}
2018-08-07 14:46:54 -06:00
handleChange = e => {
2017-01-16 16:52:24 -02:00
const { onChange } = this . props ;
2016-11-17 04:08:37 -08:00
const oldValue = this . state . value ;
2020-10-25 17:37:34 +00:00
const newValue = e . target . value . trim ( ) ;
const listValue = newValue ? newValue . split ( ',' ) : [ ] ;
2016-11-17 04:08:37 -08:00
if ( newValue . match ( /,$/ ) && oldValue . match ( /, $/ ) ) {
listValue . pop ( ) ;
}
WIP - Global UI (#785)
* update top bar and collections sidebar UI
* update collection entries UI
* improve global layout
* merge search page into collection page
* enable new entry button
* search fixup
* wip -initial editor update
* update editor scrolling and markdown toolbar position
* wip
* editor toolbar progress
* editor toolbar wip
* finished basic editor toolbar
* add standalone toggle component
* improve markdown toolbar spacing
* add user avatar placeholder
* finish markdown toggle styling
* refactor icon setup, add new icons
* add new icons to markdown editor toolbar
* remove extra app container
* add markdown active mark style
* relation and text widget styling
* widget design updates, basic list/object design update
* widget style updates, image widget improvements
* refactor widget directory, fix file removal
* widget focus styles
* finish editor widget focus styles
* migrate media library modal to react-modal
* wip - migrate editor component form to modal
* wip - move editor component form to modal
* wip - embed plugin forms in the editor
* inline shortcode forms working
* disable react hot loading, its breaking things
* improve shortcode form styles
* make shortcode form collapsible, improve styling
* add close functionality to shortcode blocks
* improve base media library styling
* fix shortcode label
* migrate unstyled workflow to new UI
* wip - reorganizing everything
* more work moving everything
* finish more moving and eliminating stuff
* restructure, remove react-toolbox
* wip - removing old stuff, more restructure
* finish restructure
* wip - css arch
* switch back to test repo
* update react-datetime to ^2.11.0
* remove leftover react-toolbox button
* more restructuring clean-up
* fix UI component directory case
* wip -css editor control style
* wip - consolidate widget styles
* wip - use a single control renderer
* fixed object values breaking
* wip - editor control active styles
* pass control wrapper to widgets
* ensure branch name is trimmed
* wip - improve widget authoring support
* import Map to Widget component
* refactor toolbar buttons
* wip - more widget active styles
* break out editor toggle component
* add local scroll sync back
* update editor toggle icons
* limit editor control pane content width
* fix editor control spacing
* migrate markdown toolbar stickiness to css
* fix markdown toolbar border radius
* temporarily use test backend
* stop markdown toolbar from going to bottom
* restore disabled markdown toolbar buttons for raw
* test markdown widget without focus styles
* more widget updates
* remove card visuals from editor
* disable dragging editor split off screen
* use editorControl component for shortcode fields
* make header site link configurable
* add configurable collection descriptions
* temporarily add example assets
* add basic list view
* remove outdated css mixins
* add and implement search icon
* activate quick add menu
* visualize usable space in editor view
* fix entry close, other improvements
* wip - editorial workflow updates
* some dropshadow and other CSS tweaks
* workflow ui updates
* add worfklow card buttons
* fix workflow card button handlers
* some dropshadow and other CSS tweaks
* make workflow board wider
* center workflow and collection views
* add basic responsiveness
* a bunch of fun UI fixes! a BUNCH! (#875)
* give `.nc-entryEditor-toolbar-mainSection` left and right child divs
* a bunch of fun UI fixes! a BUNCH!
* remove obscure --buttonShadow
* revert to test repo
* fix not found page styling
* allow workflow publishing from any column
* disallow publishing from all columns, with feedback
* fix new entry button
* fix markdown state persisting across entries
* enable simple workflow save and new from editor
* update slug in address bar when saving new entry
* wip - workflow updates, deletion working
* add status change functionality to editor
* wip - improving status change from editor
* editor toolbar back button improvements, loading improvements, cleanup
* progress on the media library UI cleanup
* remove font smothing css
* a quick fix for these buttons
* tweaks
* progress on media library modal— broken FYI
* fix media library functionality, finish migrating footer
* remove media library footer files
* remove leftover css import
* fix media library
* editor publishing functionality complete (unstyled)
* remove leftover loader var from media library
* wip - editor publishing styles
* add status dropdown styling
* editor toolbar style updates
* editor toolbar state improvements
* progress on the media library UI cleanup, style improvements
* finish editorial workflow editor styling
* finish media library styling
* fix config
* add what-input to optimize focus styling
* fix button
* fix navigation blocking for simple workflow
* improve simple workflow publishing
* add avatar dropdown to editor top bar
* style github and test-repo auth pages
* add git gateway auth page styles
* improve editor error styling
2017-12-07 12:37:10 -05:00
2021-07-07 14:09:11 +02:00
const parsedValue = this . valueToString ( listValue ) ;
2017-01-16 16:52:24 -02:00
this . setState ( { value : parsedValue } ) ;
2019-09-05 01:40:59 +03:00
onChange ( List ( listValue . map ( val => val . trim ( ) ) ) ) ;
2016-11-17 04:08:37 -08:00
} ;
WIP - Global UI (#785)
* update top bar and collections sidebar UI
* update collection entries UI
* improve global layout
* merge search page into collection page
* enable new entry button
* search fixup
* wip -initial editor update
* update editor scrolling and markdown toolbar position
* wip
* editor toolbar progress
* editor toolbar wip
* finished basic editor toolbar
* add standalone toggle component
* improve markdown toolbar spacing
* add user avatar placeholder
* finish markdown toggle styling
* refactor icon setup, add new icons
* add new icons to markdown editor toolbar
* remove extra app container
* add markdown active mark style
* relation and text widget styling
* widget design updates, basic list/object design update
* widget style updates, image widget improvements
* refactor widget directory, fix file removal
* widget focus styles
* finish editor widget focus styles
* migrate media library modal to react-modal
* wip - migrate editor component form to modal
* wip - move editor component form to modal
* wip - embed plugin forms in the editor
* inline shortcode forms working
* disable react hot loading, its breaking things
* improve shortcode form styles
* make shortcode form collapsible, improve styling
* add close functionality to shortcode blocks
* improve base media library styling
* fix shortcode label
* migrate unstyled workflow to new UI
* wip - reorganizing everything
* more work moving everything
* finish more moving and eliminating stuff
* restructure, remove react-toolbox
* wip - removing old stuff, more restructure
* finish restructure
* wip - css arch
* switch back to test repo
* update react-datetime to ^2.11.0
* remove leftover react-toolbox button
* more restructuring clean-up
* fix UI component directory case
* wip -css editor control style
* wip - consolidate widget styles
* wip - use a single control renderer
* fixed object values breaking
* wip - editor control active styles
* pass control wrapper to widgets
* ensure branch name is trimmed
* wip - improve widget authoring support
* import Map to Widget component
* refactor toolbar buttons
* wip - more widget active styles
* break out editor toggle component
* add local scroll sync back
* update editor toggle icons
* limit editor control pane content width
* fix editor control spacing
* migrate markdown toolbar stickiness to css
* fix markdown toolbar border radius
* temporarily use test backend
* stop markdown toolbar from going to bottom
* restore disabled markdown toolbar buttons for raw
* test markdown widget without focus styles
* more widget updates
* remove card visuals from editor
* disable dragging editor split off screen
* use editorControl component for shortcode fields
* make header site link configurable
* add configurable collection descriptions
* temporarily add example assets
* add basic list view
* remove outdated css mixins
* add and implement search icon
* activate quick add menu
* visualize usable space in editor view
* fix entry close, other improvements
* wip - editorial workflow updates
* some dropshadow and other CSS tweaks
* workflow ui updates
* add worfklow card buttons
* fix workflow card button handlers
* some dropshadow and other CSS tweaks
* make workflow board wider
* center workflow and collection views
* add basic responsiveness
* a bunch of fun UI fixes! a BUNCH! (#875)
* give `.nc-entryEditor-toolbar-mainSection` left and right child divs
* a bunch of fun UI fixes! a BUNCH!
* remove obscure --buttonShadow
* revert to test repo
* fix not found page styling
* allow workflow publishing from any column
* disallow publishing from all columns, with feedback
* fix new entry button
* fix markdown state persisting across entries
* enable simple workflow save and new from editor
* update slug in address bar when saving new entry
* wip - workflow updates, deletion working
* add status change functionality to editor
* wip - improving status change from editor
* editor toolbar back button improvements, loading improvements, cleanup
* progress on the media library UI cleanup
* remove font smothing css
* a quick fix for these buttons
* tweaks
* progress on media library modal— broken FYI
* fix media library functionality, finish migrating footer
* remove media library footer files
* remove leftover css import
* fix media library
* editor publishing functionality complete (unstyled)
* remove leftover loader var from media library
* wip - editor publishing styles
* add status dropdown styling
* editor toolbar style updates
* editor toolbar state improvements
* progress on the media library UI cleanup, style improvements
* finish editorial workflow editor styling
* finish media library styling
* fix config
* add what-input to optimize focus styling
* fix button
* fix navigation blocking for simple workflow
* improve simple workflow publishing
* add avatar dropdown to editor top bar
* style github and test-repo auth pages
* add git gateway auth page styles
* improve editor error styling
2017-12-07 12:37:10 -05:00
handleFocus = ( ) => {
this . props . setActiveStyle ( ) ;
2018-08-07 14:46:54 -06:00
} ;
WIP - Global UI (#785)
* update top bar and collections sidebar UI
* update collection entries UI
* improve global layout
* merge search page into collection page
* enable new entry button
* search fixup
* wip -initial editor update
* update editor scrolling and markdown toolbar position
* wip
* editor toolbar progress
* editor toolbar wip
* finished basic editor toolbar
* add standalone toggle component
* improve markdown toolbar spacing
* add user avatar placeholder
* finish markdown toggle styling
* refactor icon setup, add new icons
* add new icons to markdown editor toolbar
* remove extra app container
* add markdown active mark style
* relation and text widget styling
* widget design updates, basic list/object design update
* widget style updates, image widget improvements
* refactor widget directory, fix file removal
* widget focus styles
* finish editor widget focus styles
* migrate media library modal to react-modal
* wip - migrate editor component form to modal
* wip - move editor component form to modal
* wip - embed plugin forms in the editor
* inline shortcode forms working
* disable react hot loading, its breaking things
* improve shortcode form styles
* make shortcode form collapsible, improve styling
* add close functionality to shortcode blocks
* improve base media library styling
* fix shortcode label
* migrate unstyled workflow to new UI
* wip - reorganizing everything
* more work moving everything
* finish more moving and eliminating stuff
* restructure, remove react-toolbox
* wip - removing old stuff, more restructure
* finish restructure
* wip - css arch
* switch back to test repo
* update react-datetime to ^2.11.0
* remove leftover react-toolbox button
* more restructuring clean-up
* fix UI component directory case
* wip -css editor control style
* wip - consolidate widget styles
* wip - use a single control renderer
* fixed object values breaking
* wip - editor control active styles
* pass control wrapper to widgets
* ensure branch name is trimmed
* wip - improve widget authoring support
* import Map to Widget component
* refactor toolbar buttons
* wip - more widget active styles
* break out editor toggle component
* add local scroll sync back
* update editor toggle icons
* limit editor control pane content width
* fix editor control spacing
* migrate markdown toolbar stickiness to css
* fix markdown toolbar border radius
* temporarily use test backend
* stop markdown toolbar from going to bottom
* restore disabled markdown toolbar buttons for raw
* test markdown widget without focus styles
* more widget updates
* remove card visuals from editor
* disable dragging editor split off screen
* use editorControl component for shortcode fields
* make header site link configurable
* add configurable collection descriptions
* temporarily add example assets
* add basic list view
* remove outdated css mixins
* add and implement search icon
* activate quick add menu
* visualize usable space in editor view
* fix entry close, other improvements
* wip - editorial workflow updates
* some dropshadow and other CSS tweaks
* workflow ui updates
* add worfklow card buttons
* fix workflow card button handlers
* some dropshadow and other CSS tweaks
* make workflow board wider
* center workflow and collection views
* add basic responsiveness
* a bunch of fun UI fixes! a BUNCH! (#875)
* give `.nc-entryEditor-toolbar-mainSection` left and right child divs
* a bunch of fun UI fixes! a BUNCH!
* remove obscure --buttonShadow
* revert to test repo
* fix not found page styling
* allow workflow publishing from any column
* disallow publishing from all columns, with feedback
* fix new entry button
* fix markdown state persisting across entries
* enable simple workflow save and new from editor
* update slug in address bar when saving new entry
* wip - workflow updates, deletion working
* add status change functionality to editor
* wip - improving status change from editor
* editor toolbar back button improvements, loading improvements, cleanup
* progress on the media library UI cleanup
* remove font smothing css
* a quick fix for these buttons
* tweaks
* progress on media library modal— broken FYI
* fix media library functionality, finish migrating footer
* remove media library footer files
* remove leftover css import
* fix media library
* editor publishing functionality complete (unstyled)
* remove leftover loader var from media library
* wip - editor publishing styles
* add status dropdown styling
* editor toolbar style updates
* editor toolbar state improvements
* progress on the media library UI cleanup, style improvements
* finish editorial workflow editor styling
* finish media library styling
* fix config
* add what-input to optimize focus styling
* fix button
* fix navigation blocking for simple workflow
* improve simple workflow publishing
* add avatar dropdown to editor top bar
* style github and test-repo auth pages
* add git gateway auth page styles
* improve editor error styling
2017-12-07 12:37:10 -05:00
2018-08-07 14:46:54 -06:00
handleBlur = e => {
const listValue = e . target . value
. split ( ',' )
. map ( el => el . trim ( ) )
. filter ( el => el ) ;
2021-07-07 14:09:11 +02:00
this . setState ( { value : this . valueToString ( listValue ) } ) ;
WIP - Global UI (#785)
* update top bar and collections sidebar UI
* update collection entries UI
* improve global layout
* merge search page into collection page
* enable new entry button
* search fixup
* wip -initial editor update
* update editor scrolling and markdown toolbar position
* wip
* editor toolbar progress
* editor toolbar wip
* finished basic editor toolbar
* add standalone toggle component
* improve markdown toolbar spacing
* add user avatar placeholder
* finish markdown toggle styling
* refactor icon setup, add new icons
* add new icons to markdown editor toolbar
* remove extra app container
* add markdown active mark style
* relation and text widget styling
* widget design updates, basic list/object design update
* widget style updates, image widget improvements
* refactor widget directory, fix file removal
* widget focus styles
* finish editor widget focus styles
* migrate media library modal to react-modal
* wip - migrate editor component form to modal
* wip - move editor component form to modal
* wip - embed plugin forms in the editor
* inline shortcode forms working
* disable react hot loading, its breaking things
* improve shortcode form styles
* make shortcode form collapsible, improve styling
* add close functionality to shortcode blocks
* improve base media library styling
* fix shortcode label
* migrate unstyled workflow to new UI
* wip - reorganizing everything
* more work moving everything
* finish more moving and eliminating stuff
* restructure, remove react-toolbox
* wip - removing old stuff, more restructure
* finish restructure
* wip - css arch
* switch back to test repo
* update react-datetime to ^2.11.0
* remove leftover react-toolbox button
* more restructuring clean-up
* fix UI component directory case
* wip -css editor control style
* wip - consolidate widget styles
* wip - use a single control renderer
* fixed object values breaking
* wip - editor control active styles
* pass control wrapper to widgets
* ensure branch name is trimmed
* wip - improve widget authoring support
* import Map to Widget component
* refactor toolbar buttons
* wip - more widget active styles
* break out editor toggle component
* add local scroll sync back
* update editor toggle icons
* limit editor control pane content width
* fix editor control spacing
* migrate markdown toolbar stickiness to css
* fix markdown toolbar border radius
* temporarily use test backend
* stop markdown toolbar from going to bottom
* restore disabled markdown toolbar buttons for raw
* test markdown widget without focus styles
* more widget updates
* remove card visuals from editor
* disable dragging editor split off screen
* use editorControl component for shortcode fields
* make header site link configurable
* add configurable collection descriptions
* temporarily add example assets
* add basic list view
* remove outdated css mixins
* add and implement search icon
* activate quick add menu
* visualize usable space in editor view
* fix entry close, other improvements
* wip - editorial workflow updates
* some dropshadow and other CSS tweaks
* workflow ui updates
* add worfklow card buttons
* fix workflow card button handlers
* some dropshadow and other CSS tweaks
* make workflow board wider
* center workflow and collection views
* add basic responsiveness
* a bunch of fun UI fixes! a BUNCH! (#875)
* give `.nc-entryEditor-toolbar-mainSection` left and right child divs
* a bunch of fun UI fixes! a BUNCH!
* remove obscure --buttonShadow
* revert to test repo
* fix not found page styling
* allow workflow publishing from any column
* disallow publishing from all columns, with feedback
* fix new entry button
* fix markdown state persisting across entries
* enable simple workflow save and new from editor
* update slug in address bar when saving new entry
* wip - workflow updates, deletion working
* add status change functionality to editor
* wip - improving status change from editor
* editor toolbar back button improvements, loading improvements, cleanup
* progress on the media library UI cleanup
* remove font smothing css
* a quick fix for these buttons
* tweaks
* progress on media library modal— broken FYI
* fix media library functionality, finish migrating footer
* remove media library footer files
* remove leftover css import
* fix media library
* editor publishing functionality complete (unstyled)
* remove leftover loader var from media library
* wip - editor publishing styles
* add status dropdown styling
* editor toolbar style updates
* editor toolbar state improvements
* progress on the media library UI cleanup, style improvements
* finish editorial workflow editor styling
* finish media library styling
* fix config
* add what-input to optimize focus styling
* fix button
* fix navigation blocking for simple workflow
* improve simple workflow publishing
* add avatar dropdown to editor top bar
* style github and test-repo auth pages
* add git gateway auth page styles
* improve editor error styling
2017-12-07 12:37:10 -05:00
this . props . setInactiveStyle ( ) ;
2018-08-07 14:46:54 -06:00
} ;
2016-10-21 20:42:14 -02:00
2018-08-07 14:46:54 -06:00
handleAdd = e => {
2016-10-28 19:13:26 +02:00
e . preventDefault ( ) ;
2020-10-25 12:32:00 -07:00
const { field } = this . props ;
2019-07-11 20:40:34 +01:00
const parsedValue =
this . getValueType ( ) === valueTypes . SINGLE
? this . singleDefault ( )
: fromJS ( this . multipleDefault ( field . get ( 'fields' ) ) ) ;
2020-10-25 12:32:00 -07:00
this . addItem ( parsedValue ) ;
2018-08-07 14:46:54 -06:00
} ;
2016-10-28 19:13:26 +02:00
2019-07-11 20:40:34 +01:00
singleDefault = ( ) => {
return this . props . field . getIn ( [ 'field' , 'default' ] , null ) ;
} ;
multipleDefault = fields => {
return this . getFieldsDefault ( fields ) ;
} ;
2018-12-27 06:51:35 +02:00
handleAddType = ( type , typeKey ) => {
2020-02-13 02:12:36 +02:00
const parsedValue = fromJS ( this . mixedDefault ( typeKey , type ) ) ;
2020-10-25 12:32:00 -07:00
this . addItem ( parsedValue ) ;
2018-12-27 06:51:35 +02:00
} ;
2019-07-11 20:40:34 +01:00
mixedDefault = ( typeKey , type ) => {
const selectedType = this . props . field . get ( TYPES _KEY ) . find ( f => f . get ( 'name' ) === type ) ;
const fields = selectedType . get ( 'fields' ) || [ selectedType . get ( 'field' ) ] ;
return this . getFieldsDefault ( fields , { [ typeKey ] : type } ) ;
} ;
getFieldsDefault = ( fields , initialValue = { } ) => {
return fields . reduce ( ( acc , item ) => {
const subfields = item . get ( 'field' ) || item . get ( 'fields' ) ;
const object = item . get ( 'widget' ) == 'object' ;
const name = item . get ( 'name' ) ;
const defaultValue = item . get ( 'default' , null ) ;
if ( List . isList ( subfields ) && object ) {
const subDefaultValue = this . getFieldsDefault ( subfields ) ;
! isEmpty ( subDefaultValue ) && ( acc [ name ] = subDefaultValue ) ;
return acc ;
}
if ( Map . isMap ( subfields ) && object ) {
const subDefaultValue = this . getFieldsDefault ( [ subfields ] ) ;
! isEmpty ( subDefaultValue ) && ( acc [ name ] = subDefaultValue ) ;
return acc ;
}
if ( defaultValue !== null ) {
acc [ name ] = defaultValue ;
}
return acc ;
} , initialValue ) ;
} ;
2020-10-25 12:32:00 -07:00
addItem = parsedValue => {
const { value , onChange , field } = this . props ;
const addToTop = field . get ( 'add_to_top' , false ) ;
const itemKey = uuid ( ) ;
this . setState ( {
itemsCollapsed : addToTop
? [ false , ... this . state . itemsCollapsed ]
: [ ... this . state . itemsCollapsed , false ] ,
keys : addToTop ? [ itemKey , ... this . state . keys ] : [ ... this . state . keys , itemKey ] ,
} ) ;
const listValue = value || List ( ) ;
if ( addToTop ) {
onChange ( listValue . unshift ( parsedValue ) ) ;
} else {
onChange ( listValue . push ( parsedValue ) ) ;
}
} ;
2019-02-05 23:27:34 +01:00
processControlRef = ref => {
if ( ! ref ) return ;
2020-04-19 09:46:26 +01:00
const {
validate ,
props : { validationKey : key } ,
} = ref ;
this . validations . push ( { key , validate } ) ;
2019-02-05 23:27:34 +01:00
} ;
validate = ( ) => {
2019-12-25 09:48:47 +01:00
if ( this . getValueType ( ) ) {
2020-04-19 09:46:26 +01:00
this . validations . forEach ( item => {
item . validate ( ) ;
2019-12-25 09:48:47 +01:00
} ) ;
} else {
this . props . validate ( ) ;
}
2020-10-15 19:27:23 +02:00
this . props . onValidateObject ( this . props . forID , this . validateSize ( ) ) ;
} ;
validateSize = ( ) => {
const { field , value , t } = this . props ;
const min = field . get ( 'min' ) ;
const max = field . get ( 'max' ) ;
const required = field . get ( 'required' , true ) ;
if ( ! required && ! value ? . size ) {
return [ ] ;
}
const error = validations . validateMinMax (
t ,
field . get ( 'label' , field . get ( 'name' ) ) ,
value ,
min ,
max ,
) ;
return error ? [ error ] : [ ] ;
2019-02-05 23:27:34 +01:00
} ;
WIP - Global UI (#785)
* update top bar and collections sidebar UI
* update collection entries UI
* improve global layout
* merge search page into collection page
* enable new entry button
* search fixup
* wip -initial editor update
* update editor scrolling and markdown toolbar position
* wip
* editor toolbar progress
* editor toolbar wip
* finished basic editor toolbar
* add standalone toggle component
* improve markdown toolbar spacing
* add user avatar placeholder
* finish markdown toggle styling
* refactor icon setup, add new icons
* add new icons to markdown editor toolbar
* remove extra app container
* add markdown active mark style
* relation and text widget styling
* widget design updates, basic list/object design update
* widget style updates, image widget improvements
* refactor widget directory, fix file removal
* widget focus styles
* finish editor widget focus styles
* migrate media library modal to react-modal
* wip - migrate editor component form to modal
* wip - move editor component form to modal
* wip - embed plugin forms in the editor
* inline shortcode forms working
* disable react hot loading, its breaking things
* improve shortcode form styles
* make shortcode form collapsible, improve styling
* add close functionality to shortcode blocks
* improve base media library styling
* fix shortcode label
* migrate unstyled workflow to new UI
* wip - reorganizing everything
* more work moving everything
* finish more moving and eliminating stuff
* restructure, remove react-toolbox
* wip - removing old stuff, more restructure
* finish restructure
* wip - css arch
* switch back to test repo
* update react-datetime to ^2.11.0
* remove leftover react-toolbox button
* more restructuring clean-up
* fix UI component directory case
* wip -css editor control style
* wip - consolidate widget styles
* wip - use a single control renderer
* fixed object values breaking
* wip - editor control active styles
* pass control wrapper to widgets
* ensure branch name is trimmed
* wip - improve widget authoring support
* import Map to Widget component
* refactor toolbar buttons
* wip - more widget active styles
* break out editor toggle component
* add local scroll sync back
* update editor toggle icons
* limit editor control pane content width
* fix editor control spacing
* migrate markdown toolbar stickiness to css
* fix markdown toolbar border radius
* temporarily use test backend
* stop markdown toolbar from going to bottom
* restore disabled markdown toolbar buttons for raw
* test markdown widget without focus styles
* more widget updates
* remove card visuals from editor
* disable dragging editor split off screen
* use editorControl component for shortcode fields
* make header site link configurable
* add configurable collection descriptions
* temporarily add example assets
* add basic list view
* remove outdated css mixins
* add and implement search icon
* activate quick add menu
* visualize usable space in editor view
* fix entry close, other improvements
* wip - editorial workflow updates
* some dropshadow and other CSS tweaks
* workflow ui updates
* add worfklow card buttons
* fix workflow card button handlers
* some dropshadow and other CSS tweaks
* make workflow board wider
* center workflow and collection views
* add basic responsiveness
* a bunch of fun UI fixes! a BUNCH! (#875)
* give `.nc-entryEditor-toolbar-mainSection` left and right child divs
* a bunch of fun UI fixes! a BUNCH!
* remove obscure --buttonShadow
* revert to test repo
* fix not found page styling
* allow workflow publishing from any column
* disallow publishing from all columns, with feedback
* fix new entry button
* fix markdown state persisting across entries
* enable simple workflow save and new from editor
* update slug in address bar when saving new entry
* wip - workflow updates, deletion working
* add status change functionality to editor
* wip - improving status change from editor
* editor toolbar back button improvements, loading improvements, cleanup
* progress on the media library UI cleanup
* remove font smothing css
* a quick fix for these buttons
* tweaks
* progress on media library modal— broken FYI
* fix media library functionality, finish migrating footer
* remove media library footer files
* remove leftover css import
* fix media library
* editor publishing functionality complete (unstyled)
* remove leftover loader var from media library
* wip - editor publishing styles
* add status dropdown styling
* editor toolbar style updates
* editor toolbar state improvements
* progress on the media library UI cleanup, style improvements
* finish editorial workflow editor styling
* finish media library styling
* fix config
* add what-input to optimize focus styling
* fix button
* fix navigation blocking for simple workflow
* improve simple workflow publishing
* add avatar dropdown to editor top bar
* style github and test-repo auth pages
* add git gateway auth page styles
* improve editor error styling
2017-12-07 12:37:10 -05:00
/ * *
* In case the ` onChangeObject ` function is frozen by a child widget implementation ,
* e . g . when debounced , always get the latest object value instead of using
* ` this.props.value ` directly .
* /
getObjectValue = idx => this . props . value . get ( idx ) || Map ( ) ;
2016-10-28 19:13:26 +02:00
handleChangeFor ( index ) {
2020-06-18 10:11:37 +03:00
return ( f , newValue , newMetadata ) => {
2018-03-27 12:07:38 +01:00
const { value , metadata , onChange , field } = this . props ;
const collectionName = field . get ( 'name' ) ;
2019-11-07 20:33:40 +01:00
const listFieldObjectWidget = field . getIn ( [ 'field' , 'widget' ] ) === 'object' ;
const withNameKey =
this . getValueType ( ) !== valueTypes . SINGLE ||
( this . getValueType ( ) === valueTypes . SINGLE && listFieldObjectWidget ) ;
const newObjectValue = withNameKey
2020-06-18 10:11:37 +03:00
? this . getObjectValue ( index ) . set ( f . get ( 'name' ) , newValue )
2019-11-07 20:33:40 +01:00
: newValue ;
2017-04-13 11:02:06 +01:00
const parsedMetadata = {
2019-02-08 20:55:03 +01:00
[ collectionName ] : Object . assign ( metadata ? metadata . toJS ( ) : { } , newMetadata || { } ) ,
2017-04-13 11:02:06 +01:00
} ;
2018-08-24 17:39:35 -04:00
onChange ( value . set ( index , newObjectValue ) , parsedMetadata ) ;
2016-10-28 19:13:26 +02:00
} ;
}
2020-11-26 13:54:41 +01:00
handleRemove = ( index , event ) => {
WIP - Global UI (#785)
* update top bar and collections sidebar UI
* update collection entries UI
* improve global layout
* merge search page into collection page
* enable new entry button
* search fixup
* wip -initial editor update
* update editor scrolling and markdown toolbar position
* wip
* editor toolbar progress
* editor toolbar wip
* finished basic editor toolbar
* add standalone toggle component
* improve markdown toolbar spacing
* add user avatar placeholder
* finish markdown toggle styling
* refactor icon setup, add new icons
* add new icons to markdown editor toolbar
* remove extra app container
* add markdown active mark style
* relation and text widget styling
* widget design updates, basic list/object design update
* widget style updates, image widget improvements
* refactor widget directory, fix file removal
* widget focus styles
* finish editor widget focus styles
* migrate media library modal to react-modal
* wip - migrate editor component form to modal
* wip - move editor component form to modal
* wip - embed plugin forms in the editor
* inline shortcode forms working
* disable react hot loading, its breaking things
* improve shortcode form styles
* make shortcode form collapsible, improve styling
* add close functionality to shortcode blocks
* improve base media library styling
* fix shortcode label
* migrate unstyled workflow to new UI
* wip - reorganizing everything
* more work moving everything
* finish more moving and eliminating stuff
* restructure, remove react-toolbox
* wip - removing old stuff, more restructure
* finish restructure
* wip - css arch
* switch back to test repo
* update react-datetime to ^2.11.0
* remove leftover react-toolbox button
* more restructuring clean-up
* fix UI component directory case
* wip -css editor control style
* wip - consolidate widget styles
* wip - use a single control renderer
* fixed object values breaking
* wip - editor control active styles
* pass control wrapper to widgets
* ensure branch name is trimmed
* wip - improve widget authoring support
* import Map to Widget component
* refactor toolbar buttons
* wip - more widget active styles
* break out editor toggle component
* add local scroll sync back
* update editor toggle icons
* limit editor control pane content width
* fix editor control spacing
* migrate markdown toolbar stickiness to css
* fix markdown toolbar border radius
* temporarily use test backend
* stop markdown toolbar from going to bottom
* restore disabled markdown toolbar buttons for raw
* test markdown widget without focus styles
* more widget updates
* remove card visuals from editor
* disable dragging editor split off screen
* use editorControl component for shortcode fields
* make header site link configurable
* add configurable collection descriptions
* temporarily add example assets
* add basic list view
* remove outdated css mixins
* add and implement search icon
* activate quick add menu
* visualize usable space in editor view
* fix entry close, other improvements
* wip - editorial workflow updates
* some dropshadow and other CSS tweaks
* workflow ui updates
* add worfklow card buttons
* fix workflow card button handlers
* some dropshadow and other CSS tweaks
* make workflow board wider
* center workflow and collection views
* add basic responsiveness
* a bunch of fun UI fixes! a BUNCH! (#875)
* give `.nc-entryEditor-toolbar-mainSection` left and right child divs
* a bunch of fun UI fixes! a BUNCH!
* remove obscure --buttonShadow
* revert to test repo
* fix not found page styling
* allow workflow publishing from any column
* disallow publishing from all columns, with feedback
* fix new entry button
* fix markdown state persisting across entries
* enable simple workflow save and new from editor
* update slug in address bar when saving new entry
* wip - workflow updates, deletion working
* add status change functionality to editor
* wip - improving status change from editor
* editor toolbar back button improvements, loading improvements, cleanup
* progress on the media library UI cleanup
* remove font smothing css
* a quick fix for these buttons
* tweaks
* progress on media library modal— broken FYI
* fix media library functionality, finish migrating footer
* remove media library footer files
* remove leftover css import
* fix media library
* editor publishing functionality complete (unstyled)
* remove leftover loader var from media library
* wip - editor publishing styles
* add status dropdown styling
* editor toolbar style updates
* editor toolbar state improvements
* progress on the media library UI cleanup, style improvements
* finish editorial workflow editor styling
* finish media library styling
* fix config
* add what-input to optimize focus styling
* fix button
* fix navigation blocking for simple workflow
* improve simple workflow publishing
* add avatar dropdown to editor top bar
* style github and test-repo auth pages
* add git gateway auth page styles
* improve editor error styling
2017-12-07 12:37:10 -05:00
event . preventDefault ( ) ;
2020-11-26 13:54:41 +01:00
const { itemsCollapsed } = this . state ;
2019-02-05 23:27:34 +01:00
const { value , metadata , onChange , field , clearFieldErrors } = this . props ;
2018-03-27 12:07:38 +01:00
const collectionName = field . get ( 'name' ) ;
2018-10-26 20:42:23 +01:00
const isSingleField = this . getValueType ( ) === valueTypes . SINGLE ;
2018-08-24 17:39:35 -04:00
const metadataRemovePath = isSingleField ? value . get ( index ) : value . get ( index ) . valueSeq ( ) ;
2020-02-13 10:59:38 +01:00
const parsedMetadata =
metadata && ! metadata . isEmpty ( )
? { [ collectionName ] : metadata . removeIn ( metadataRemovePath ) }
: metadata ;
2016-10-28 19:13:26 +02:00
2020-05-17 15:47:07 +02:00
itemsCollapsed . splice ( index , 1 ) ;
2020-11-26 13:54:41 +01:00
// clear validations
this . validations = [ ] ;
2020-05-17 15:47:07 +02:00
2020-11-26 13:54:41 +01:00
this . setState ( {
itemsCollapsed : [ ... itemsCollapsed ] ,
keys : Array . from ( { length : value . size - 1 } , ( ) => uuid ( ) ) ,
} ) ;
2017-12-22 22:30:05 +01:00
onChange ( value . remove ( index ) , parsedMetadata ) ;
2019-02-05 23:27:34 +01:00
clearFieldErrors ( ) ;
2018-03-15 16:16:32 -04:00
} ;
WIP - Global UI (#785)
* update top bar and collections sidebar UI
* update collection entries UI
* improve global layout
* merge search page into collection page
* enable new entry button
* search fixup
* wip -initial editor update
* update editor scrolling and markdown toolbar position
* wip
* editor toolbar progress
* editor toolbar wip
* finished basic editor toolbar
* add standalone toggle component
* improve markdown toolbar spacing
* add user avatar placeholder
* finish markdown toggle styling
* refactor icon setup, add new icons
* add new icons to markdown editor toolbar
* remove extra app container
* add markdown active mark style
* relation and text widget styling
* widget design updates, basic list/object design update
* widget style updates, image widget improvements
* refactor widget directory, fix file removal
* widget focus styles
* finish editor widget focus styles
* migrate media library modal to react-modal
* wip - migrate editor component form to modal
* wip - move editor component form to modal
* wip - embed plugin forms in the editor
* inline shortcode forms working
* disable react hot loading, its breaking things
* improve shortcode form styles
* make shortcode form collapsible, improve styling
* add close functionality to shortcode blocks
* improve base media library styling
* fix shortcode label
* migrate unstyled workflow to new UI
* wip - reorganizing everything
* more work moving everything
* finish more moving and eliminating stuff
* restructure, remove react-toolbox
* wip - removing old stuff, more restructure
* finish restructure
* wip - css arch
* switch back to test repo
* update react-datetime to ^2.11.0
* remove leftover react-toolbox button
* more restructuring clean-up
* fix UI component directory case
* wip -css editor control style
* wip - consolidate widget styles
* wip - use a single control renderer
* fixed object values breaking
* wip - editor control active styles
* pass control wrapper to widgets
* ensure branch name is trimmed
* wip - improve widget authoring support
* import Map to Widget component
* refactor toolbar buttons
* wip - more widget active styles
* break out editor toggle component
* add local scroll sync back
* update editor toggle icons
* limit editor control pane content width
* fix editor control spacing
* migrate markdown toolbar stickiness to css
* fix markdown toolbar border radius
* temporarily use test backend
* stop markdown toolbar from going to bottom
* restore disabled markdown toolbar buttons for raw
* test markdown widget without focus styles
* more widget updates
* remove card visuals from editor
* disable dragging editor split off screen
* use editorControl component for shortcode fields
* make header site link configurable
* add configurable collection descriptions
* temporarily add example assets
* add basic list view
* remove outdated css mixins
* add and implement search icon
* activate quick add menu
* visualize usable space in editor view
* fix entry close, other improvements
* wip - editorial workflow updates
* some dropshadow and other CSS tweaks
* workflow ui updates
* add worfklow card buttons
* fix workflow card button handlers
* some dropshadow and other CSS tweaks
* make workflow board wider
* center workflow and collection views
* add basic responsiveness
* a bunch of fun UI fixes! a BUNCH! (#875)
* give `.nc-entryEditor-toolbar-mainSection` left and right child divs
* a bunch of fun UI fixes! a BUNCH!
* remove obscure --buttonShadow
* revert to test repo
* fix not found page styling
* allow workflow publishing from any column
* disallow publishing from all columns, with feedback
* fix new entry button
* fix markdown state persisting across entries
* enable simple workflow save and new from editor
* update slug in address bar when saving new entry
* wip - workflow updates, deletion working
* add status change functionality to editor
* wip - improving status change from editor
* editor toolbar back button improvements, loading improvements, cleanup
* progress on the media library UI cleanup
* remove font smothing css
* a quick fix for these buttons
* tweaks
* progress on media library modal— broken FYI
* fix media library functionality, finish migrating footer
* remove media library footer files
* remove leftover css import
* fix media library
* editor publishing functionality complete (unstyled)
* remove leftover loader var from media library
* wip - editor publishing styles
* add status dropdown styling
* editor toolbar style updates
* editor toolbar state improvements
* progress on the media library UI cleanup, style improvements
* finish editorial workflow editor styling
* finish media library styling
* fix config
* add what-input to optimize focus styling
* fix button
* fix navigation blocking for simple workflow
* improve simple workflow publishing
* add avatar dropdown to editor top bar
* style github and test-repo auth pages
* add git gateway auth page styles
* improve editor error styling
2017-12-07 12:37:10 -05:00
handleItemCollapseToggle = ( index , event ) => {
event . preventDefault ( ) ;
const { itemsCollapsed } = this . state ;
2020-05-17 15:47:07 +02:00
const newItemsCollapsed = itemsCollapsed . map ( ( collapsed , itemIndex ) => {
if ( index === itemIndex ) {
return ! collapsed ;
}
return collapsed ;
} ) ;
this . setState ( {
itemsCollapsed : newItemsCollapsed ,
} ) ;
2018-03-15 16:16:32 -04:00
} ;
2017-12-22 22:30:05 +01:00
2018-08-07 14:46:54 -06:00
handleCollapseAllToggle = e => {
2017-12-22 22:30:05 +01:00
e . preventDefault ( ) ;
2020-05-17 15:47:07 +02:00
const { value , field } = this . props ;
const { itemsCollapsed , listCollapsed } = this . state ;
const minimizeCollapsedItems = field . get ( 'minimize_collapsed' , false ) ;
const listCollapsedByDefault = field . get ( 'collapsed' , true ) ;
2017-12-22 22:30:05 +01:00
const allItemsCollapsed = itemsCollapsed . every ( val => val === true ) ;
2020-05-17 15:47:07 +02:00
if ( minimizeCollapsedItems ) {
let updatedItemsCollapsed = itemsCollapsed ;
// Only allow collapsing all items in this mode but not opening all at once
if ( ! listCollapsed || ! listCollapsedByDefault ) {
updatedItemsCollapsed = Array ( value . size ) . fill ( ! listCollapsed ) ;
}
this . setState ( { listCollapsed : ! listCollapsed , itemsCollapsed : updatedItemsCollapsed } ) ;
} else {
this . setState ( { itemsCollapsed : Array ( value . size ) . fill ( ! allItemsCollapsed ) } ) ;
}
2018-03-15 16:16:32 -04:00
} ;
2016-10-28 19:13:26 +02:00
objectLabel ( item ) {
2020-05-11 22:30:29 +09:00
const { field , entry } = this . props ;
const valueType = this . getValueType ( ) ;
switch ( valueType ) {
case valueTypes . MIXED : {
2021-04-05 08:54:07 -07:00
if ( ! validateItem ( field , item ) ) {
return ;
}
2020-05-11 22:30:29 +09:00
const itemType = getTypedFieldForValue ( field , item ) ;
const label = itemType . get ( 'label' , itemType . get ( 'name' ) ) ;
// each type can have its own summary, but default to the list summary if exists
const summary = itemType . get ( 'summary' , field . get ( 'summary' ) ) ;
const labelReturn = summary ? handleSummary ( summary , entry , label , item ) : label ;
return labelReturn ;
}
case valueTypes . SINGLE : {
const singleField = field . get ( 'field' ) ;
const label = singleField . get ( 'label' , singleField . get ( 'name' ) ) ;
const summary = field . get ( 'summary' ) ;
const data = fromJS ( { [ singleField . get ( 'name' ) ] : item } ) ;
const labelReturn = summary ? handleSummary ( summary , entry , label , data ) : label ;
return labelReturn ;
}
case valueTypes . MULTIPLE : {
2021-04-05 08:54:07 -07:00
if ( ! validateItem ( field , item ) ) {
return ;
}
2020-05-11 22:30:29 +09:00
const multiFields = field . get ( 'fields' ) ;
const labelField = multiFields && multiFields . first ( ) ;
const value = item . get ( labelField . get ( 'name' ) ) ;
const summary = field . get ( 'summary' ) ;
const labelReturn = summary ? handleSummary ( summary , entry , value , item ) : value ;
return ( labelReturn || ` No ${ labelField . get ( 'name' ) } ` ) . toString ( ) ;
}
2018-12-27 06:51:35 +02:00
}
2020-05-11 22:30:29 +09:00
return '' ;
2016-10-28 19:13:26 +02:00
}
2017-10-16 18:16:03 -07:00
onSortEnd = ( { oldIndex , newIndex } ) => {
2020-04-19 09:46:26 +01:00
const { value , clearFieldErrors } = this . props ;
2019-12-16 12:17:37 -05:00
const { itemsCollapsed , keys } = this . state ;
2017-10-20 14:45:41 -07:00
// Update value
2017-10-16 18:16:03 -07:00
const item = value . get ( oldIndex ) ;
const newValue = value . delete ( oldIndex ) . insert ( newIndex , item ) ;
this . props . onChange ( newValue ) ;
2017-10-20 14:45:41 -07:00
// Update collapsing
2020-05-17 15:47:07 +02:00
const collapsed = itemsCollapsed [ oldIndex ] ;
itemsCollapsed . splice ( oldIndex , 1 ) ;
const updatedItemsCollapsed = [ ... itemsCollapsed ] ;
updatedItemsCollapsed . splice ( newIndex , 0 , collapsed ) ;
2019-12-16 12:17:37 -05:00
// Reset item to ensure updated state
2020-05-17 15:47:07 +02:00
const updatedKeys = keys . map ( ( key , keyIndex ) => {
if ( keyIndex === oldIndex || keyIndex === newIndex ) {
return uuid ( ) ;
}
return key ;
} ) ;
2019-12-16 12:17:37 -05:00
this . setState ( { itemsCollapsed : updatedItemsCollapsed , keys : updatedKeys } ) ;
2020-04-19 09:46:26 +01:00
//clear error fields and remove old validations
clearFieldErrors ( ) ;
this . validations = this . validations . filter ( item => updatedKeys . includes ( item . key ) ) ;
2016-10-30 16:01:10 -07:00
} ;
2020-05-25 01:42:54 -05:00
hasError = index => {
const { fieldsErrors } = this . props ;
if ( fieldsErrors && fieldsErrors . size > 0 ) {
return Object . values ( fieldsErrors . toJS ( ) ) . some ( arr =>
arr . some ( err => err . parentIds && err . parentIds . includes ( this . state . keys [ index ] ) ) ,
) ;
}
} ;
2019-03-15 10:19:57 -04:00
// eslint-disable-next-line react/display-name
2017-10-16 18:16:03 -07:00
renderItem = ( item , index ) => {
2019-02-05 23:27:34 +01:00
const {
classNameWrapper ,
editorControl ,
onValidateObject ,
2019-02-08 20:55:03 +01:00
metadata ,
2019-02-05 23:27:34 +01:00
clearFieldErrors ,
fieldsErrors ,
controlRef ,
resolveWidget ,
2020-05-25 01:42:54 -05:00
parentIds ,
forID ,
2021-07-14 20:13:50 +05:30
t ,
2019-02-05 23:27:34 +01:00
} = this . props ;
2019-12-16 12:17:37 -05:00
const { itemsCollapsed , keys } = this . state ;
2020-05-17 15:47:07 +02:00
const collapsed = itemsCollapsed [ index ] ;
const key = keys [ index ] ;
2018-12-27 06:51:35 +02:00
let field = this . props . field ;
2020-05-25 01:42:54 -05:00
const hasError = this . hasError ( index ) ;
2021-07-14 20:13:50 +05:30
const isVariableTypesList = this . getValueType ( ) === valueTypes . MIXED ;
if ( isVariableTypesList ) {
2018-12-27 06:51:35 +02:00
field = getTypedFieldForValue ( field , item ) ;
if ( ! field ) {
return this . renderErroneousTypedItem ( index , item ) ;
}
}
2018-07-24 17:13:48 -04:00
return (
< SortableListItem
2019-03-15 10:19:57 -04:00
css = { [ styles . listControlItem , collapsed && styles . listControlItemCollapsed ] }
2018-07-24 17:13:48 -04:00
index = { index }
2019-12-16 12:17:37 -05:00
key = { key }
2018-07-24 17:13:48 -04:00
>
2021-07-14 20:13:50 +05:30
{ isVariableTypesList && (
< LabelComponent
field = { field }
isActive = { false }
hasErrors = { hasError }
uniqueFieldId = { this . uniqueFieldId }
isFieldOptional = { field . get ( 'required' ) === false }
t = { t }
/ >
) }
2018-07-24 17:13:48 -04:00
< StyledListItemTopBar
collapsed = { collapsed }
onCollapseToggle = { partial ( this . handleItemCollapseToggle , index ) }
2020-11-26 13:54:41 +01:00
onRemove = { partial ( this . handleRemove , index ) }
2018-07-24 17:13:48 -04:00
dragHandleHOC = { SortableHandle }
2020-05-04 15:17:19 +03:00
data - testid = { ` styled-list-item-top-bar- ${ key } ` }
2018-07-24 17:13:48 -04:00
/ >
2020-05-25 01:42:54 -05:00
< NestedObjectLabel collapsed = { collapsed } error = { hasError } >
{ this . objectLabel ( item ) }
< / N e s t e d O b j e c t L a b e l >
2019-03-15 10:19:57 -04:00
< ClassNames >
{ ( { css , cx } ) => (
< ObjectControl
classNameWrapper = { cx ( classNameWrapper , {
[ css `
$ { styleStrings . collapsedObjectControl } ;
` ]: collapsed,
} ) }
value = { item }
field = { field }
onChangeObject = { this . handleChangeFor ( index ) }
editorControl = { editorControl }
resolveWidget = { resolveWidget }
metadata = { metadata }
forList
onValidateObject = { onValidateObject }
clearFieldErrors = { clearFieldErrors }
fieldsErrors = { fieldsErrors }
ref = { this . processControlRef }
controlRef = { controlRef }
2020-04-19 09:46:26 +01:00
validationKey = { key }
2020-04-19 15:46:09 +01:00
collapsed = { collapsed }
2020-05-04 15:17:19 +03:00
data - testid = { ` object-control- ${ key } ` }
2020-05-25 01:42:54 -05:00
hasError = { hasError }
parentIds = { [ ... parentIds , forID , key ] }
2019-03-15 10:19:57 -04:00
/ >
) }
< / C l a s s N a m e s >
2018-07-24 17:13:48 -04:00
< / S o r t a b l e L i s t I t e m >
) ;
2017-10-16 18:16:03 -07:00
} ;
2016-10-28 19:13:26 +02:00
2018-12-27 06:51:35 +02:00
renderErroneousTypedItem ( index , item ) {
const field = this . props . field ;
const errorMessage = getErrorMessageForTypedFieldAndValue ( field , item ) ;
2020-04-19 09:46:26 +01:00
const key = ` item- ${ index } ` ;
2018-12-27 06:51:35 +02:00
return (
< SortableListItem
2019-03-15 10:19:57 -04:00
css = { [ styles . listControlItem , styles . listControlItemCollapsed ] }
2018-12-27 06:51:35 +02:00
index = { index }
2020-04-19 09:46:26 +01:00
key = { key }
2018-12-27 06:51:35 +02:00
>
< StyledListItemTopBar
onCollapseToggle = { null }
2020-04-19 09:46:26 +01:00
onRemove = { partial ( this . handleRemove , index , key ) }
2018-12-27 06:51:35 +02:00
dragHandleHOC = { SortableHandle }
/ >
< NestedObjectLabel collapsed = { true } error = { true } >
{ errorMessage }
< / N e s t e d O b j e c t L a b e l >
< / S o r t a b l e L i s t I t e m >
) ;
}
2016-10-28 19:13:26 +02:00
renderListControl ( ) {
2021-08-04 13:56:38 +02:00
const { value , forID , field , classNameWrapper , t } = this . props ;
2020-05-17 15:47:07 +02:00
const { itemsCollapsed , listCollapsed } = this . state ;
WIP - Global UI (#785)
* update top bar and collections sidebar UI
* update collection entries UI
* improve global layout
* merge search page into collection page
* enable new entry button
* search fixup
* wip -initial editor update
* update editor scrolling and markdown toolbar position
* wip
* editor toolbar progress
* editor toolbar wip
* finished basic editor toolbar
* add standalone toggle component
* improve markdown toolbar spacing
* add user avatar placeholder
* finish markdown toggle styling
* refactor icon setup, add new icons
* add new icons to markdown editor toolbar
* remove extra app container
* add markdown active mark style
* relation and text widget styling
* widget design updates, basic list/object design update
* widget style updates, image widget improvements
* refactor widget directory, fix file removal
* widget focus styles
* finish editor widget focus styles
* migrate media library modal to react-modal
* wip - migrate editor component form to modal
* wip - move editor component form to modal
* wip - embed plugin forms in the editor
* inline shortcode forms working
* disable react hot loading, its breaking things
* improve shortcode form styles
* make shortcode form collapsible, improve styling
* add close functionality to shortcode blocks
* improve base media library styling
* fix shortcode label
* migrate unstyled workflow to new UI
* wip - reorganizing everything
* more work moving everything
* finish more moving and eliminating stuff
* restructure, remove react-toolbox
* wip - removing old stuff, more restructure
* finish restructure
* wip - css arch
* switch back to test repo
* update react-datetime to ^2.11.0
* remove leftover react-toolbox button
* more restructuring clean-up
* fix UI component directory case
* wip -css editor control style
* wip - consolidate widget styles
* wip - use a single control renderer
* fixed object values breaking
* wip - editor control active styles
* pass control wrapper to widgets
* ensure branch name is trimmed
* wip - improve widget authoring support
* import Map to Widget component
* refactor toolbar buttons
* wip - more widget active styles
* break out editor toggle component
* add local scroll sync back
* update editor toggle icons
* limit editor control pane content width
* fix editor control spacing
* migrate markdown toolbar stickiness to css
* fix markdown toolbar border radius
* temporarily use test backend
* stop markdown toolbar from going to bottom
* restore disabled markdown toolbar buttons for raw
* test markdown widget without focus styles
* more widget updates
* remove card visuals from editor
* disable dragging editor split off screen
* use editorControl component for shortcode fields
* make header site link configurable
* add configurable collection descriptions
* temporarily add example assets
* add basic list view
* remove outdated css mixins
* add and implement search icon
* activate quick add menu
* visualize usable space in editor view
* fix entry close, other improvements
* wip - editorial workflow updates
* some dropshadow and other CSS tweaks
* workflow ui updates
* add worfklow card buttons
* fix workflow card button handlers
* some dropshadow and other CSS tweaks
* make workflow board wider
* center workflow and collection views
* add basic responsiveness
* a bunch of fun UI fixes! a BUNCH! (#875)
* give `.nc-entryEditor-toolbar-mainSection` left and right child divs
* a bunch of fun UI fixes! a BUNCH!
* remove obscure --buttonShadow
* revert to test repo
* fix not found page styling
* allow workflow publishing from any column
* disallow publishing from all columns, with feedback
* fix new entry button
* fix markdown state persisting across entries
* enable simple workflow save and new from editor
* update slug in address bar when saving new entry
* wip - workflow updates, deletion working
* add status change functionality to editor
* wip - improving status change from editor
* editor toolbar back button improvements, loading improvements, cleanup
* progress on the media library UI cleanup
* remove font smothing css
* a quick fix for these buttons
* tweaks
* progress on media library modal— broken FYI
* fix media library functionality, finish migrating footer
* remove media library footer files
* remove leftover css import
* fix media library
* editor publishing functionality complete (unstyled)
* remove leftover loader var from media library
* wip - editor publishing styles
* add status dropdown styling
* editor toolbar style updates
* editor toolbar state improvements
* progress on the media library UI cleanup, style improvements
* finish editorial workflow editor styling
* finish media library styling
* fix config
* add what-input to optimize focus styling
* fix button
* fix navigation blocking for simple workflow
* improve simple workflow publishing
* add avatar dropdown to editor top bar
* style github and test-repo auth pages
* add git gateway auth page styles
* improve editor error styling
2017-12-07 12:37:10 -05:00
const items = value || List ( ) ;
2018-11-02 12:22:16 -05:00
const label = field . get ( 'label' , field . get ( 'name' ) ) ;
const labelSingular = field . get ( 'label_singular' ) || field . get ( 'label' , field . get ( 'name' ) ) ;
2018-07-24 17:13:48 -04:00
const listLabel = items . size === 1 ? labelSingular . toLowerCase ( ) : label . toLowerCase ( ) ;
2020-05-17 15:47:07 +02:00
const minimizeCollapsedItems = field . get ( 'minimize_collapsed' , false ) ;
const allItemsCollapsed = itemsCollapsed . every ( val => val === true ) ;
const selfCollapsed = allItemsCollapsed && ( listCollapsed || ! minimizeCollapsedItems ) ;
WIP - Global UI (#785)
* update top bar and collections sidebar UI
* update collection entries UI
* improve global layout
* merge search page into collection page
* enable new entry button
* search fixup
* wip -initial editor update
* update editor scrolling and markdown toolbar position
* wip
* editor toolbar progress
* editor toolbar wip
* finished basic editor toolbar
* add standalone toggle component
* improve markdown toolbar spacing
* add user avatar placeholder
* finish markdown toggle styling
* refactor icon setup, add new icons
* add new icons to markdown editor toolbar
* remove extra app container
* add markdown active mark style
* relation and text widget styling
* widget design updates, basic list/object design update
* widget style updates, image widget improvements
* refactor widget directory, fix file removal
* widget focus styles
* finish editor widget focus styles
* migrate media library modal to react-modal
* wip - migrate editor component form to modal
* wip - move editor component form to modal
* wip - embed plugin forms in the editor
* inline shortcode forms working
* disable react hot loading, its breaking things
* improve shortcode form styles
* make shortcode form collapsible, improve styling
* add close functionality to shortcode blocks
* improve base media library styling
* fix shortcode label
* migrate unstyled workflow to new UI
* wip - reorganizing everything
* more work moving everything
* finish more moving and eliminating stuff
* restructure, remove react-toolbox
* wip - removing old stuff, more restructure
* finish restructure
* wip - css arch
* switch back to test repo
* update react-datetime to ^2.11.0
* remove leftover react-toolbox button
* more restructuring clean-up
* fix UI component directory case
* wip -css editor control style
* wip - consolidate widget styles
* wip - use a single control renderer
* fixed object values breaking
* wip - editor control active styles
* pass control wrapper to widgets
* ensure branch name is trimmed
* wip - improve widget authoring support
* import Map to Widget component
* refactor toolbar buttons
* wip - more widget active styles
* break out editor toggle component
* add local scroll sync back
* update editor toggle icons
* limit editor control pane content width
* fix editor control spacing
* migrate markdown toolbar stickiness to css
* fix markdown toolbar border radius
* temporarily use test backend
* stop markdown toolbar from going to bottom
* restore disabled markdown toolbar buttons for raw
* test markdown widget without focus styles
* more widget updates
* remove card visuals from editor
* disable dragging editor split off screen
* use editorControl component for shortcode fields
* make header site link configurable
* add configurable collection descriptions
* temporarily add example assets
* add basic list view
* remove outdated css mixins
* add and implement search icon
* activate quick add menu
* visualize usable space in editor view
* fix entry close, other improvements
* wip - editorial workflow updates
* some dropshadow and other CSS tweaks
* workflow ui updates
* add worfklow card buttons
* fix workflow card button handlers
* some dropshadow and other CSS tweaks
* make workflow board wider
* center workflow and collection views
* add basic responsiveness
* a bunch of fun UI fixes! a BUNCH! (#875)
* give `.nc-entryEditor-toolbar-mainSection` left and right child divs
* a bunch of fun UI fixes! a BUNCH!
* remove obscure --buttonShadow
* revert to test repo
* fix not found page styling
* allow workflow publishing from any column
* disallow publishing from all columns, with feedback
* fix new entry button
* fix markdown state persisting across entries
* enable simple workflow save and new from editor
* update slug in address bar when saving new entry
* wip - workflow updates, deletion working
* add status change functionality to editor
* wip - improving status change from editor
* editor toolbar back button improvements, loading improvements, cleanup
* progress on the media library UI cleanup
* remove font smothing css
* a quick fix for these buttons
* tweaks
* progress on media library modal— broken FYI
* fix media library functionality, finish migrating footer
* remove media library footer files
* remove leftover css import
* fix media library
* editor publishing functionality complete (unstyled)
* remove leftover loader var from media library
* wip - editor publishing styles
* add status dropdown styling
* editor toolbar style updates
* editor toolbar state improvements
* progress on the media library UI cleanup, style improvements
* finish editorial workflow editor styling
* finish media library styling
* fix config
* add what-input to optimize focus styling
* fix button
* fix navigation blocking for simple workflow
* improve simple workflow publishing
* add avatar dropdown to editor top bar
* style github and test-repo auth pages
* add git gateway auth page styles
* improve editor error styling
2017-12-07 12:37:10 -05:00
return (
2019-03-15 10:19:57 -04:00
< ClassNames >
{ ( { cx , css } ) => (
< div
id = { forID }
className = { cx (
classNameWrapper ,
css `
$ { styleStrings . objectWidgetTopBarContainer }
` ,
) }
>
< ObjectWidgetTopBar
allowAdd = { field . get ( 'allow_add' , true ) }
onAdd = { this . handleAdd }
types = { field . get ( TYPES _KEY , null ) }
onAddType = { type => this . handleAddType ( type , resolveFieldKeyType ( field ) ) }
heading = { ` ${ items . size } ${ listLabel } ` }
label = { labelSingular . toLowerCase ( ) }
onCollapseToggle = { this . handleCollapseAllToggle }
2020-05-17 15:47:07 +02:00
collapsed = { selfCollapsed }
2021-08-04 13:56:38 +02:00
t = { t }
2019-03-15 10:19:57 -04:00
/ >
2020-05-17 15:47:07 +02:00
{ ( ! selfCollapsed || ! minimizeCollapsedItems ) && (
< SortableList
items = { items }
renderItem = { this . renderItem }
onSortEnd = { this . onSortEnd }
useDragHandle
lockAxis = "y"
/ >
) }
2019-03-15 10:19:57 -04:00
< / d i v >
) }
< / C l a s s N a m e s >
WIP - Global UI (#785)
* update top bar and collections sidebar UI
* update collection entries UI
* improve global layout
* merge search page into collection page
* enable new entry button
* search fixup
* wip -initial editor update
* update editor scrolling and markdown toolbar position
* wip
* editor toolbar progress
* editor toolbar wip
* finished basic editor toolbar
* add standalone toggle component
* improve markdown toolbar spacing
* add user avatar placeholder
* finish markdown toggle styling
* refactor icon setup, add new icons
* add new icons to markdown editor toolbar
* remove extra app container
* add markdown active mark style
* relation and text widget styling
* widget design updates, basic list/object design update
* widget style updates, image widget improvements
* refactor widget directory, fix file removal
* widget focus styles
* finish editor widget focus styles
* migrate media library modal to react-modal
* wip - migrate editor component form to modal
* wip - move editor component form to modal
* wip - embed plugin forms in the editor
* inline shortcode forms working
* disable react hot loading, its breaking things
* improve shortcode form styles
* make shortcode form collapsible, improve styling
* add close functionality to shortcode blocks
* improve base media library styling
* fix shortcode label
* migrate unstyled workflow to new UI
* wip - reorganizing everything
* more work moving everything
* finish more moving and eliminating stuff
* restructure, remove react-toolbox
* wip - removing old stuff, more restructure
* finish restructure
* wip - css arch
* switch back to test repo
* update react-datetime to ^2.11.0
* remove leftover react-toolbox button
* more restructuring clean-up
* fix UI component directory case
* wip -css editor control style
* wip - consolidate widget styles
* wip - use a single control renderer
* fixed object values breaking
* wip - editor control active styles
* pass control wrapper to widgets
* ensure branch name is trimmed
* wip - improve widget authoring support
* import Map to Widget component
* refactor toolbar buttons
* wip - more widget active styles
* break out editor toggle component
* add local scroll sync back
* update editor toggle icons
* limit editor control pane content width
* fix editor control spacing
* migrate markdown toolbar stickiness to css
* fix markdown toolbar border radius
* temporarily use test backend
* stop markdown toolbar from going to bottom
* restore disabled markdown toolbar buttons for raw
* test markdown widget without focus styles
* more widget updates
* remove card visuals from editor
* disable dragging editor split off screen
* use editorControl component for shortcode fields
* make header site link configurable
* add configurable collection descriptions
* temporarily add example assets
* add basic list view
* remove outdated css mixins
* add and implement search icon
* activate quick add menu
* visualize usable space in editor view
* fix entry close, other improvements
* wip - editorial workflow updates
* some dropshadow and other CSS tweaks
* workflow ui updates
* add worfklow card buttons
* fix workflow card button handlers
* some dropshadow and other CSS tweaks
* make workflow board wider
* center workflow and collection views
* add basic responsiveness
* a bunch of fun UI fixes! a BUNCH! (#875)
* give `.nc-entryEditor-toolbar-mainSection` left and right child divs
* a bunch of fun UI fixes! a BUNCH!
* remove obscure --buttonShadow
* revert to test repo
* fix not found page styling
* allow workflow publishing from any column
* disallow publishing from all columns, with feedback
* fix new entry button
* fix markdown state persisting across entries
* enable simple workflow save and new from editor
* update slug in address bar when saving new entry
* wip - workflow updates, deletion working
* add status change functionality to editor
* wip - improving status change from editor
* editor toolbar back button improvements, loading improvements, cleanup
* progress on the media library UI cleanup
* remove font smothing css
* a quick fix for these buttons
* tweaks
* progress on media library modal— broken FYI
* fix media library functionality, finish migrating footer
* remove media library footer files
* remove leftover css import
* fix media library
* editor publishing functionality complete (unstyled)
* remove leftover loader var from media library
* wip - editor publishing styles
* add status dropdown styling
* editor toolbar style updates
* editor toolbar state improvements
* progress on the media library UI cleanup, style improvements
* finish editorial workflow editor styling
* finish media library styling
* fix config
* add what-input to optimize focus styling
* fix button
* fix navigation blocking for simple workflow
* improve simple workflow publishing
* add avatar dropdown to editor top bar
* style github and test-repo auth pages
* add git gateway auth page styles
* improve editor error styling
2017-12-07 12:37:10 -05:00
) ;
2016-10-28 19:13:26 +02:00
}
2018-12-27 06:51:35 +02:00
renderInput ( ) {
const { forID , classNameWrapper } = this . props ;
2016-11-17 04:08:37 -08:00
const { value } = this . state ;
2016-10-28 19:13:26 +02:00
2018-08-07 14:46:54 -06:00
return (
< input
type = "text"
id = { forID }
value = { value }
onChange = { this . handleChange }
onFocus = { this . handleFocus }
onBlur = { this . handleBlur }
className = { classNameWrapper }
/ >
) ;
2016-10-21 20:42:14 -02:00
}
2018-12-27 06:51:35 +02:00
render ( ) {
if ( this . getValueType ( ) !== null ) {
return this . renderListControl ( ) ;
} else {
return this . renderInput ( ) ;
}
}
2018-07-31 15:03:46 -06:00
}