'use strict';

var TABLE_REGISTER = 'TABLE_REGISTER';
var TABLE_LOAD_VIEW = 'TABLE_LOAD_VIEW';
var TABLE_PAGE_CHANGE = 'TABLE_PAGE_CHANGE';
var TABLE_FILTER_APPLY = 'TABLE_FILTER_APPLY';
var TABLE_FILTER_CLEAR = 'TABLE_FILTER_CLEAR';
var TABLE_TOOLBAR_TOGGLE = 'TABLE_TOOLBAR_TOGGLE';
var TABLE_ACTION_CANCEL = 'TABLE_ACTION_CANCEL';
var TABLE_ACTION_APPLY = 'TABLE_ACTION_APPLY';
var TABLE_ROW_ACTION_START = 'TABLE_ROW_ACTION_START';
var TABLE_ROW_ACTION_EDIT = 'TABLE_ROW_ACTION_EDIT';
var TABLE_ROW_ACTION_COMPLETE = 'TABLE_ROW_ACTION_COMPLETE';
var TABLE_ROW_ACTION_ERROR = 'TABLE_ROW_ACTION_ERROR';
var TABLE_COLUMN_SORT = 'TABLE_COLUMN_SORT';
var TABLE_COLUMN_ORDER = 'TABLE_COLUMN_ORDER';
var TABLE_COLUMN_RESIZE = 'TABLE_COLUMN_RESIZE';
var TABLE_ROW_SELECT = 'TABLE_ROW_SELECT';
var TABLE_ROW_SELECT_ALL = 'TABLE_ROW_SELECT_ALL';
var TABLE_ROW_CLICK = 'TABLE_ROW_CLICK';
var TABLE_ROW_EXPAND = 'TABLE_ROW_EXPAND';
var TABLE_SEARCH_APPLY = 'TABLE_SEARCH_APPLY';
var TABLE_EMPTY_STATE_ACTION = 'TABLE_EMPTY_STATE_ACTION';
var TABLE_LOADING_SET = 'TABLE_LOADING_SET';
var TABLE_ADVANCED_FILTER_CANCEL = 'TABLE_ADVACNED_FILTER_CANCEL';
var TABLE_ADVANCED_FILTER_CREATE = 'TABLE_ADVANCED_FILTER_CREATE';
var TABLE_ADVANCED_FILTER_REMOVE = 'TABLE_ADVANCED_FILTER_REMOVE';
var TABLE_ADVANCED_FILTER_CHANGE = 'TABLE_ADVANCED_FILTER_CHANGE';
var TABLE_ADVANCED_FILTER_TOGGLE = 'TABLE_ADVANCED_FILTER_TOGGLE';
var TABLE_ADVANCED_FILTER_APPLY = 'TABLE_ADVANCED_FILTER_APPLY';
var TABLE_TOGGLE_AGGREGATIONS = 'TABLE_TOGGLE_AGGREGATIONS';
var TABLE_MULTI_SORT_TOGGLE_MODAL = 'TABLE_MULTI_SORT_TOGGLE_MODAL';
var TABLE_MULTI_SORT_SAVE = 'TABLE_MULTI_SORT_SAVE';
var TABLE_MULTI_SORT_CANCEL = 'TABLE_MULTI_SORT_CANCEL';
var TABLE_MULTI_SORT_CLEAR = 'TABLE_MULTI_SORT_CLEAR';
var TABLE_MULTI_SORT_ADD_COLUMN = 'TABLE_MULTI_SORT_ADD_COLUMN';
var TABLE_MULTI_SORT_REMOVE_COLUMN = 'TABLE_MULTI_SORT_REMOVE_COLUMN';
var TABLE_ROW_LOAD_MORE = 'TABLE_ROW_LOAD_MORE';
var tableRegister = function tableRegister(_ref) {
  var data = _ref.data,
    isLoading = _ref.isLoading,
    view = _ref.view,
    totalItems = _ref.totalItems,
    hasUserViewManagement = _ref.hasUserViewManagement,
    hasRowSelection = _ref.hasRowSelection,
    _ref$instanceId = _ref.instanceId,
    instanceId = _ref$instanceId === void 0 ? null : _ref$instanceId;
  return {
    type: TABLE_REGISTER,
    payload: {
      data: data,
      view: view,
      isLoading: isLoading,
      totalItems: totalItems,
      hasUserViewManagement: hasUserViewManagement,
      hasRowSelection: hasRowSelection
    },
    instanceId: instanceId
  };
};
var tablePageChange = function tablePageChange(page) {
  var instanceId = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
  return {
    type: TABLE_PAGE_CHANGE,
    payload: page,
    instanceId: instanceId
  };
};
var tableToolbarToggle = function tableToolbarToggle(toolbar) {
  var instanceId = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
  return {
    type: TABLE_TOOLBAR_TOGGLE,
    payload: toolbar,
    instanceId: instanceId
  };
};

/** Apply filters */
var tableFilterApply = function tableFilterApply(filter) {
  var instanceId = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
  return {
    type: TABLE_FILTER_APPLY,
    payload: filter,
    instanceId: instanceId
  };
};
var tableFilterClear = function tableFilterClear() {
  var instanceId = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
  return {
    type: TABLE_FILTER_CLEAR,
    instanceId: instanceId
  };
};
var tableSearchApply = function tableSearchApply(search) {
  var instanceId = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
  return {
    type: TABLE_SEARCH_APPLY,
    payload: search,
    instanceId: instanceId
  };
};

/** Table Batch Actions */
var tableActionCancel = function tableActionCancel() {
  var instanceId = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
  return {
    type: TABLE_ACTION_CANCEL,
    instanceId: instanceId
  };
};
var tableActionApply = function tableActionApply(id) {
  var instanceId = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
  return {
    type: TABLE_ACTION_APPLY,
    payload: id,
    instanceId: instanceId
  };
};

/** Table column actions */
var tableColumnSort = function tableColumnSort(column, columns) {
  var instanceId = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
  return {
    type: TABLE_COLUMN_SORT,
    payload: column,
    columns: columns,
    instanceId: instanceId
  };
};
var tableColumnOrder = function tableColumnOrder(ordering) {
  var instanceId = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
  return {
    type: TABLE_COLUMN_ORDER,
    payload: ordering,
    instanceId: instanceId
  };
};
var tableColumnResize = function tableColumnResize(columns) {
  var instanceId = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
  return {
    type: TABLE_COLUMN_RESIZE,
    payload: columns,
    instanceId: instanceId
  };
};

/** Table empty state action */
var tableEmptyStateAction = function tableEmptyStateAction() {
  var instanceId = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
  return {
    type: TABLE_EMPTY_STATE_ACTION,
    instanceId: instanceId
  };
};

/** Table row actions */
var tableRowActionStart = function tableRowActionStart(rowId) {
  var instanceId = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
  return {
    type: TABLE_ROW_ACTION_START,
    payload: rowId,
    instanceId: instanceId
  };
};
var tableRowActionEdit = function tableRowActionEdit(rowId) {
  var instanceId = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
  return {
    type: TABLE_ROW_ACTION_EDIT,
    payload: rowId,
    instanceId: instanceId
  };
};
var tableRowActionComplete = function tableRowActionComplete(rowId) {
  var instanceId = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
  return {
    type: TABLE_ROW_ACTION_COMPLETE,
    payload: rowId,
    instanceId: instanceId
  };
};
var tableRowActionError = function tableRowActionError(rowId, error) {
  var instanceId = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
  return {
    type: TABLE_ROW_ACTION_ERROR,
    payload: rowId,
    error: error,
    instanceId: instanceId
  };
};

/** Select a row of the table */
var tableRowSelect = function tableRowSelect(selectedIds, hasRowSelection) {
  var instanceId = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
  return {
    type: TABLE_ROW_SELECT,
    payload: {
      selectedIds: selectedIds,
      hasRowSelection: hasRowSelection
    },
    instanceId: instanceId
  };
};

/** Select all the currently filtered rows of the table */
var tableRowSelectAll = function tableRowSelectAll(isSelected) {
  var instanceId = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
  return {
    type: TABLE_ROW_SELECT_ALL,
    payload: {
      isSelected: isSelected
    },
    instanceId: instanceId
  };
};
var tableRowClick = function tableRowClick(rowId) {
  var instanceId = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
  return {
    type: TABLE_ROW_CLICK,
    payload: {
      rowId: rowId
    },
    instanceId: instanceId
  };
};
var tableRowExpand = function tableRowExpand(rowId, isExpanded) {
  var instanceId = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
  var options = arguments.length > 3 ? arguments[3] : undefined;
  return {
    type: TABLE_ROW_EXPAND,
    payload: {
      rowId: rowId,
      isExpanded: isExpanded,
      options: options
    },
    instanceId: instanceId
  };
};

/**
 * rowCount: The number of rows currently being loaded
 */
var tableLoadingSet = function tableLoadingSet(isLoading, rowCount) {
  var instanceId = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
  return {
    type: TABLE_LOADING_SET,
    payload: {
      isLoading: isLoading,
      rowCount: rowCount
    },
    instanceId: instanceId
  };
};

/**
 * Advanced filters
 */
var tableAdvancedFiltersToggle = function tableAdvancedFiltersToggle() {
  return {
    type: TABLE_ADVANCED_FILTER_TOGGLE
  };
};
var tableAdvancedFiltersCancel = function tableAdvancedFiltersCancel() {
  return {
    type: TABLE_ADVANCED_FILTER_CANCEL
  };
};
var tableAdvancedFiltersCreate = function tableAdvancedFiltersCreate() {
  return {
    type: TABLE_ADVANCED_FILTER_CREATE
  };
};
var tableAdvancedFiltersRemove = function tableAdvancedFiltersRemove(filterId) {
  return {
    type: TABLE_ADVANCED_FILTER_REMOVE,
    payload: {
      filterId: filterId
    }
  };
};
var tableAdvancedFiltersChange = function tableAdvancedFiltersChange() {
  return {
    type: TABLE_ADVANCED_FILTER_CHANGE
  };
};
var tableAdvancedFiltersApply = function tableAdvancedFiltersApply(filterState) {
  return {
    type: TABLE_ADVANCED_FILTER_APPLY,
    payload: filterState
  };
};
var tableToggleAggregations = function tableToggleAggregations() {
  return {
    type: TABLE_TOGGLE_AGGREGATIONS
  };
};
var tableMultiSortToggleModal = function tableMultiSortToggleModal(meta) {
  return {
    type: TABLE_MULTI_SORT_TOGGLE_MODAL,
    payload: meta
  };
};
var tableSaveMultiSortColumns = function tableSaveMultiSortColumns(sortColumns) {
  return {
    type: TABLE_MULTI_SORT_SAVE,
    payload: sortColumns
  };
};
var tableCancelMultiSortColumns = function tableCancelMultiSortColumns() {
  return {
    type: TABLE_MULTI_SORT_CANCEL
  };
};
var tableClearMultiSortColumns = function tableClearMultiSortColumns() {
  return {
    type: TABLE_MULTI_SORT_CLEAR
  };
};
var tableAddMultiSortColumn = function tableAddMultiSortColumn(index) {
  return {
    type: TABLE_MULTI_SORT_ADD_COLUMN,
    payload: index
  };
};
var tableRemoveMultiSortColumn = function tableRemoveMultiSortColumn(index) {
  return {
    type: TABLE_MULTI_SORT_REMOVE_COLUMN,
    payload: index
  };
};
var tableRowLoadMore = function tableRowLoadMore(rowId) {
  return {
    type: TABLE_ROW_LOAD_MORE,
    payload: rowId
  };
};

exports.TABLE_ACTION_APPLY = TABLE_ACTION_APPLY;
exports.TABLE_ACTION_CANCEL = TABLE_ACTION_CANCEL;
exports.TABLE_ADVANCED_FILTER_APPLY = TABLE_ADVANCED_FILTER_APPLY;
exports.TABLE_ADVANCED_FILTER_CANCEL = TABLE_ADVANCED_FILTER_CANCEL;
exports.TABLE_ADVANCED_FILTER_CHANGE = TABLE_ADVANCED_FILTER_CHANGE;
exports.TABLE_ADVANCED_FILTER_CREATE = TABLE_ADVANCED_FILTER_CREATE;
exports.TABLE_ADVANCED_FILTER_REMOVE = TABLE_ADVANCED_FILTER_REMOVE;
exports.TABLE_ADVANCED_FILTER_TOGGLE = TABLE_ADVANCED_FILTER_TOGGLE;
exports.TABLE_COLUMN_ORDER = TABLE_COLUMN_ORDER;
exports.TABLE_COLUMN_RESIZE = TABLE_COLUMN_RESIZE;
exports.TABLE_COLUMN_SORT = TABLE_COLUMN_SORT;
exports.TABLE_EMPTY_STATE_ACTION = TABLE_EMPTY_STATE_ACTION;
exports.TABLE_FILTER_APPLY = TABLE_FILTER_APPLY;
exports.TABLE_FILTER_CLEAR = TABLE_FILTER_CLEAR;
exports.TABLE_LOADING_SET = TABLE_LOADING_SET;
exports.TABLE_LOAD_VIEW = TABLE_LOAD_VIEW;
exports.TABLE_MULTI_SORT_ADD_COLUMN = TABLE_MULTI_SORT_ADD_COLUMN;
exports.TABLE_MULTI_SORT_CANCEL = TABLE_MULTI_SORT_CANCEL;
exports.TABLE_MULTI_SORT_CLEAR = TABLE_MULTI_SORT_CLEAR;
exports.TABLE_MULTI_SORT_REMOVE_COLUMN = TABLE_MULTI_SORT_REMOVE_COLUMN;
exports.TABLE_MULTI_SORT_SAVE = TABLE_MULTI_SORT_SAVE;
exports.TABLE_MULTI_SORT_TOGGLE_MODAL = TABLE_MULTI_SORT_TOGGLE_MODAL;
exports.TABLE_PAGE_CHANGE = TABLE_PAGE_CHANGE;
exports.TABLE_REGISTER = TABLE_REGISTER;
exports.TABLE_ROW_ACTION_COMPLETE = TABLE_ROW_ACTION_COMPLETE;
exports.TABLE_ROW_ACTION_EDIT = TABLE_ROW_ACTION_EDIT;
exports.TABLE_ROW_ACTION_ERROR = TABLE_ROW_ACTION_ERROR;
exports.TABLE_ROW_ACTION_START = TABLE_ROW_ACTION_START;
exports.TABLE_ROW_CLICK = TABLE_ROW_CLICK;
exports.TABLE_ROW_EXPAND = TABLE_ROW_EXPAND;
exports.TABLE_ROW_LOAD_MORE = TABLE_ROW_LOAD_MORE;
exports.TABLE_ROW_SELECT = TABLE_ROW_SELECT;
exports.TABLE_ROW_SELECT_ALL = TABLE_ROW_SELECT_ALL;
exports.TABLE_SEARCH_APPLY = TABLE_SEARCH_APPLY;
exports.TABLE_TOGGLE_AGGREGATIONS = TABLE_TOGGLE_AGGREGATIONS;
exports.TABLE_TOOLBAR_TOGGLE = TABLE_TOOLBAR_TOGGLE;
exports.tableActionApply = tableActionApply;
exports.tableActionCancel = tableActionCancel;
exports.tableAddMultiSortColumn = tableAddMultiSortColumn;
exports.tableAdvancedFiltersApply = tableAdvancedFiltersApply;
exports.tableAdvancedFiltersCancel = tableAdvancedFiltersCancel;
exports.tableAdvancedFiltersChange = tableAdvancedFiltersChange;
exports.tableAdvancedFiltersCreate = tableAdvancedFiltersCreate;
exports.tableAdvancedFiltersRemove = tableAdvancedFiltersRemove;
exports.tableAdvancedFiltersToggle = tableAdvancedFiltersToggle;
exports.tableCancelMultiSortColumns = tableCancelMultiSortColumns;
exports.tableClearMultiSortColumns = tableClearMultiSortColumns;
exports.tableColumnOrder = tableColumnOrder;
exports.tableColumnResize = tableColumnResize;
exports.tableColumnSort = tableColumnSort;
exports.tableEmptyStateAction = tableEmptyStateAction;
exports.tableFilterApply = tableFilterApply;
exports.tableFilterClear = tableFilterClear;
exports.tableLoadingSet = tableLoadingSet;
exports.tableMultiSortToggleModal = tableMultiSortToggleModal;
exports.tablePageChange = tablePageChange;
exports.tableRegister = tableRegister;
exports.tableRemoveMultiSortColumn = tableRemoveMultiSortColumn;
exports.tableRowActionComplete = tableRowActionComplete;
exports.tableRowActionEdit = tableRowActionEdit;
exports.tableRowActionError = tableRowActionError;
exports.tableRowActionStart = tableRowActionStart;
exports.tableRowClick = tableRowClick;
exports.tableRowExpand = tableRowExpand;
exports.tableRowLoadMore = tableRowLoadMore;
exports.tableRowSelect = tableRowSelect;
exports.tableRowSelectAll = tableRowSelectAll;
exports.tableSaveMultiSortColumns = tableSaveMultiSortColumns;
exports.tableSearchApply = tableSearchApply;
exports.tableToggleAggregations = tableToggleAggregations;
exports.tableToolbarToggle = tableToolbarToggle;
