import { createContainerModule } from 'redux-with-domain' ; import datasetDomain , { DatasetItem , Field } from '../../../domain/dataset' ; /**
 * {page-module}
 */ export default createContainerModule ( 'workbook/datasetFields' , { initialState : { filter : '' } , selectors : { getDatasetFields : ( state , { pageSelectors } = { } ) : Field [ ] => { const selectedDatasetId = pageSelectors . getSelectedDatasetId ( ) ; const dataset = datasetDomain . entities . datasetList . get ( selectedDatasetId ) ; const fields = dataset ? dataset . fields : [ ] ; if ( state . filter . length > 0 ) { return fields . filter ( field => field . name . includes ( state . filter ) ) ; } return fields ; } } , reducers : { updateFilter : ( state , { payload } ) => { return { ... state , filter : payload || '' } ; } } , effects : ( ) => { } } ) ;