text: import { Map, fromJS } from 'immutable'
  import { reducer as MetaReducer } from 'mk-meta-engine'
  import config from './config'
  
  class reducer {
      constructor(option) {
          this.metaReducer = option.metaReducer
      }
  
      init = (state, option) => {
          const data = {
              data: {
                  list: [],
                  pagination: { current: 1, total: 0, pageSize: 20 },
                  filter: {},
                  other: {}
              }
          }
          return this.metaReducer.init(state, data)
      }
  
      load = (state, response) => {
          state = this.metaReducer.sf(state, 'data.list', fromJS(response.list))
          state = this.metaReducer.sf(state, 'data.pagination', fromJS(response.pagination))
          state = this.metaReducer.sf(state, 'data.filter', fromJS(response.filter))
          return state
      }
  
      selectAll = (state, checked) => {
          var lst = this.metaReducer.gf(state, 'data.list')
  
          if (!lst || lst.size == 0)
              return state
  
          for (let i = 0; i < lst.size; i++) {
              state = this.metaReducer.sf(state, `data.list.${i}.selected`, checked)
          }
  
          return state
      }
  
      
  }
  
  export default function creator(option) {
      const metaReducer = new MetaReducer(option),
          o = new reducer({ ...option, metaReducer })
  
      return { ...metaReducer, ...o }
  }