@evo/prom-cms-smart-item-selector
v0.5.1
Published
SmartItemSelector component for prom merchant cms
Downloads
266
Maintainers
Keywords
Readme
SmartItemSelector
Компонент для вывода дерева элементов с возможностью выбора в кабинете продавца на prom.
Usage
// import { SmartItemSelectorModel, reducer, SmartItemSelector, ...} from '@evo/prom-cms-smart-item-selector'
import {
eCheckedMode,
eSelectMode,
eInitialCollapsedMode,
} from '../constants';
import { PRODUCT_GROUPS, PRODUCT_GROUPS_DISABLED, PRODUCT_GROUPS_SELECTED } from '../../styleguide-src/constants'
import { SmartItemSelectorModel } from '../model'
import { reducer } from '../reducer'
const [model, dispatch] = React.useReducer(
reducer,
new SmartItemSelectorModel({
selectMode: eSelectMode.ITEMS,
checkedMode: eCheckedMode.ITEMS,
selectedItemsMap: PRODUCT_GROUPS_SELECTED,
disabledItems: PRODUCT_GROUPS_DISABLED,
itemDisabledMessage: 'Группа выбрана в другой форме',
initialUrls: {
initialStartListUrl: 'https://my.trunk.uaprom/cms/category/list',
initialGetListUrl: 'https://my.trunk.uaprom/cms/category/list',
initialSearchUrl: 'https://my.trunk.uaprom/cms/category/search',
},
}),
);
return (
<SmartItemSelector
{...model}
dispatch={dispatch}
/>
)
Dependencies
В проекте, который будет использовать данный компонент, должны быть установлены следующие зависимости:
"peerDependencies": {
"react": ">=15.6.1",
"react-dom": ">=15.6.1",
"classnames": ">=2.1.3",
"prop-types": ">=15.5.10",
"@evo/fetch-io": ">=0.0.1",
"@evo/user-info": "^3.0.1",
"@evo/tooltip": ">=0.0.1",
"@evo/prom-cms-button": ">=0.0.4",
"@evo/prom-cms-checkbox": ">=0.0.1",
"@evo/prom-cms-radiobutton": ">=0.0.1",
"@evo/prom-cms-highlight-text": ">=0.0.1",
"@evo/prom-cms-lazy-load": ">=0.0.1",
"@evo/prom-cms-spinner": ">=0.0.1",
"@prom-ui/hooks": ">=0.0.1",
"ttag": ">=0.0.1"
},