Repository URL to install this package:
|
Version:
3.12.20 ▾
|
var _VIEW_COMPONENTS, _VIEW_OPTIONS, _URL_PARAM_VIEW;
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
import { PERMISSIONS, VIEW_IDS, FMAW_URL_QUERY_PARAMS } from '@filerobot/utils/lib/constants';
import { Assets, Collections, Heart, Label, Folders, Products } from '@scaleflex/icons';
import AssetsView from '../AssetsView';
import FoldersView from '../FoldersView';
import CollectionsView from '../CollectionsView';
import LabelsView from '../LabelsView';
import FavoritesView from '../FavoritesView';
import ProductsView from '../ProductsView';
import { activateFoldersView, toggleFoldersTree } from '../../slices/folders.slice';
import { activateCollectionsView, applyDefaultCollection, toggleCollectionsTree } from '../../slices/collections.slice';
import { activateLabelsView, applyDefaultLabel, toggleLabelsTree } from '../../slices/labels.slice';
import { activateFavoritesView } from '../../thunks/favorites.thunks';
import { activateProductsView, toggleProductsTree } from '../../slices/products.slice';
import { activateAssetsView } from '../AssetsView/AssetsView.thunks';
import ShareboxView from '../ShareboxView';
import { activateShareboxView } from '../../slices/sharebox.slice';
// VIEW_IDS not in this file but inside @filerobot/utils/lib/constants
// so it's easier to be imported from external project to be re-used in opts.
export var VIEW_COMPONENTS = (_VIEW_COMPONENTS = {}, _defineProperty(_VIEW_COMPONENTS, VIEW_IDS.ASSETS, AssetsView), _defineProperty(_VIEW_COMPONENTS, VIEW_IDS.FOLDERS, FoldersView), _defineProperty(_VIEW_COMPONENTS, VIEW_IDS.COLLECTIONS, CollectionsView), _defineProperty(_VIEW_COMPONENTS, VIEW_IDS.LABELS, LabelsView), _defineProperty(_VIEW_COMPONENTS, VIEW_IDS.FAVORITES, FavoritesView), _defineProperty(_VIEW_COMPONENTS, VIEW_IDS.PRODUCTS, ProductsView), _defineProperty(_VIEW_COMPONENTS, VIEW_IDS.SHAREBOX, ShareboxView), _VIEW_COMPONENTS);
export var VIEW_OPTIONS = (_VIEW_OPTIONS = {}, _defineProperty(_VIEW_OPTIONS, VIEW_IDS.ASSETS, {
id: VIEW_IDS.ASSETS,
i18nKey: 'viewModeAllAssetsLabel',
icon: Assets,
activateAction: activateAssetsView
}), _defineProperty(_VIEW_OPTIONS, VIEW_IDS.FOLDERS, {
id: VIEW_IDS.FOLDERS,
i18nKey: 'viewModeFoldersLabel',
icon: Folders,
activateAction: activateFoldersView,
toggleTreeAction: toggleFoldersTree
}), _defineProperty(_VIEW_OPTIONS, VIEW_IDS.COLLECTIONS, {
id: VIEW_IDS.COLLECTIONS,
i18nKey: 'viewModeCollectionsLabel',
icon: Collections,
activateAction: activateCollectionsView,
toggleTreeAction: toggleCollectionsTree,
checkVisibility: function checkVisibility(_ref) {
var checkUserPermissions = _ref.checkUserPermissions;
return checkUserPermissions([PERMISSIONS.COLLECTIONS_MANAGE]);
}
}), _defineProperty(_VIEW_OPTIONS, VIEW_IDS.LABELS, {
id: VIEW_IDS.LABELS,
i18nKey: 'viewModeLabels',
icon: Label,
activateAction: activateLabelsView,
toggleTreeAction: toggleLabelsTree,
checkVisibility: function checkVisibility(_ref2) {
var checkUserPermissions = _ref2.checkUserPermissions;
return checkUserPermissions([PERMISSIONS.LABELS_LIST]);
}
}), _defineProperty(_VIEW_OPTIONS, VIEW_IDS.FAVORITES, {
id: VIEW_IDS.FAVORITES,
i18nKey: 'mutualizedMyFavoritesLabel',
icon: Heart,
activateAction: activateFavoritesView
}), _defineProperty(_VIEW_OPTIONS, VIEW_IDS.PRODUCTS, {
id: VIEW_IDS.PRODUCTS,
i18nKey: 'productsTreeLabel',
icon: Products,
activateAction: activateProductsView,
toggleTreeAction: toggleProductsTree
}), _defineProperty(_VIEW_OPTIONS, VIEW_IDS.SHAREBOX, {
id: VIEW_IDS.SHAREBOX,
i18nKey: 'shareboxTitle',
activateAction: activateShareboxView,
checkVisibility: function checkVisibility() {
return false;
} // We don't need to show the sharebox in the side navbar
}), _VIEW_OPTIONS);
export var URL_PARAM_VIEW = (_URL_PARAM_VIEW = {}, _defineProperty(_URL_PARAM_VIEW, FMAW_URL_QUERY_PARAMS.FOLDER, {
viewId: VIEW_IDS.FOLDERS,
activateAction: function activateAction(_ref3) {
var dispatch = _ref3.dispatch;
return dispatch(VIEW_OPTIONS[VIEW_IDS.FOLDERS].activateAction());
}
}), _defineProperty(_URL_PARAM_VIEW, FMAW_URL_QUERY_PARAMS.LABEL, {
viewId: VIEW_IDS.LABELS,
activateAction: function activateAction(_ref4) {
var dispatch = _ref4.dispatch,
paramValue = _ref4.paramValue;
return dispatch(applyDefaultLabel({
uuid: paramValue
}));
}
}), _defineProperty(_URL_PARAM_VIEW, FMAW_URL_QUERY_PARAMS.COLLECTION, {
viewId: VIEW_IDS.COLLECTIONS,
activateAction: function activateAction(_ref5) {
var dispatch = _ref5.dispatch,
paramValue = _ref5.paramValue;
return dispatch(applyDefaultCollection({
uuid: paramValue
}));
}
}), _URL_PARAM_VIEW);