digirati-annotation-redux
Advanced tools
Comparing version 0.2.20-alpha.5892bb78 to 0.2.20-alpha.8fb426d4
@@ -1,2 +0,3 @@ | ||
import { addSelectorToDraft } from './drafts'; | ||
import _extends from 'babel-runtime/helpers/extends'; | ||
import { addSelectorToDraft, addSelectorToDraftField } from './drafts'; | ||
@@ -7,2 +8,3 @@ export var SELECTOR_SET_AVAILABLE = 'SELECTOR_SET_AVAILABLE'; | ||
export var SELECTOR_COMMIT_TO_DRAFT = 'SELECTOR_COMMIT_TO_DRAFT'; | ||
export var SELECTOR_COMMIT_TO_DRAFT_FIELD = 'SELECTOR_COMMIT_TO_DRAFT_FIELD'; | ||
@@ -17,2 +19,6 @@ export function setAvailableSelectors(selectors) { | ||
export function chooseSecondarySelector(type, defaults) { | ||
return { type: SELECTOR_CHOOSE, payload: { type: type, defaults: _extends({}, defaults, { secondary: true }) } }; | ||
} | ||
export function updateSelector(data) { | ||
@@ -22,2 +28,9 @@ return { type: SELECTOR_UPDATE, payload: { data: data } }; | ||
export function commitToCurrentDraftField(fieldId) { | ||
return function (dispatch, getState) { | ||
dispatch(addSelectorToDraftField(getState().drafts.currentDraft, getState().selector.currentSelector, fieldId)); | ||
dispatch({ type: SELECTOR_COMMIT_TO_DRAFT_FIELD }); | ||
}; | ||
} | ||
export function commitToCurrentDraft() { | ||
@@ -24,0 +37,0 @@ return function (dispatch, getState) { |
@@ -11,3 +11,3 @@ import { connect } from 'react-redux'; | ||
import { setViewer, withViewer } from './actions/viewer'; | ||
import { isSelecting, currentSelectorIsSecondary } from './query/selectorQuery'; | ||
export default connect(function (state) { | ||
@@ -18,2 +18,5 @@ var annotationList = richAnnotationList(state); | ||
state: state, | ||
isSelecting: isSelecting(state), | ||
isSelectingPrimary: isSelecting(state) && currentSelectorIsSecondary(state) === false, | ||
isSelectingSecondary: isSelecting(state) && currentSelectorIsSecondary(state) === true, | ||
currentSelector: state.selector && state.selector.currentSelector ? state.selector.currentSelector : null, | ||
@@ -20,0 +23,0 @@ currentDraft: getCurrentDraft(state), |
import _extends from 'babel-runtime/helpers/extends'; | ||
import { SELECTOR_CHOOSE, SELECTOR_COMMIT_TO_DRAFT, SELECTOR_SET_AVAILABLE, SELECTOR_UPDATE } from '../actions/selectors'; | ||
import { SELECTOR_CHOOSE, SELECTOR_COMMIT_TO_DRAFT, SELECTOR_SET_AVAILABLE, SELECTOR_UPDATE, SELECTOR_COMMIT_TO_DRAFT_FIELD } from '../actions/selectors'; | ||
import update from 'immutability-helper'; | ||
@@ -36,2 +36,3 @@ | ||
case SELECTOR_COMMIT_TO_DRAFT: | ||
case SELECTOR_COMMIT_TO_DRAFT_FIELD: | ||
return update(state, { | ||
@@ -38,0 +39,0 @@ currentSelector: { $set: {} } |
'use strict'; | ||
exports.__esModule = true; | ||
exports.SELECTOR_COMMIT_TO_DRAFT = exports.SELECTOR_UPDATE = exports.SELECTOR_CHOOSE = exports.SELECTOR_SET_AVAILABLE = undefined; | ||
exports.SELECTOR_COMMIT_TO_DRAFT_FIELD = exports.SELECTOR_COMMIT_TO_DRAFT = exports.SELECTOR_UPDATE = exports.SELECTOR_CHOOSE = exports.SELECTOR_SET_AVAILABLE = undefined; | ||
var _extends2 = require('babel-runtime/helpers/extends'); | ||
var _extends3 = _interopRequireDefault(_extends2); | ||
exports.setAvailableSelectors = setAvailableSelectors; | ||
exports.chooseSelector = chooseSelector; | ||
exports.chooseSecondarySelector = chooseSecondarySelector; | ||
exports.updateSelector = updateSelector; | ||
exports.commitToCurrentDraftField = commitToCurrentDraftField; | ||
exports.commitToCurrentDraft = commitToCurrentDraft; | ||
@@ -12,2 +19,4 @@ | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
var SELECTOR_SET_AVAILABLE = exports.SELECTOR_SET_AVAILABLE = 'SELECTOR_SET_AVAILABLE'; | ||
@@ -17,2 +26,3 @@ var SELECTOR_CHOOSE = exports.SELECTOR_CHOOSE = 'SELECTOR_CHOOSE'; | ||
var SELECTOR_COMMIT_TO_DRAFT = exports.SELECTOR_COMMIT_TO_DRAFT = 'SELECTOR_COMMIT_TO_DRAFT'; | ||
var SELECTOR_COMMIT_TO_DRAFT_FIELD = exports.SELECTOR_COMMIT_TO_DRAFT_FIELD = 'SELECTOR_COMMIT_TO_DRAFT_FIELD'; | ||
@@ -27,2 +37,6 @@ function setAvailableSelectors(selectors) { | ||
function chooseSecondarySelector(type, defaults) { | ||
return { type: SELECTOR_CHOOSE, payload: { type: type, defaults: (0, _extends3.default)({}, defaults, { secondary: true }) } }; | ||
} | ||
function updateSelector(data) { | ||
@@ -32,2 +46,9 @@ return { type: SELECTOR_UPDATE, payload: { data: data } }; | ||
function commitToCurrentDraftField(fieldId) { | ||
return function (dispatch, getState) { | ||
dispatch((0, _drafts.addSelectorToDraftField)(getState().drafts.currentDraft, getState().selector.currentSelector, fieldId)); | ||
dispatch({ type: SELECTOR_COMMIT_TO_DRAFT_FIELD }); | ||
}; | ||
} | ||
function commitToCurrentDraft() { | ||
@@ -34,0 +55,0 @@ return function (dispatch, getState) { |
@@ -25,2 +25,4 @@ 'use strict'; | ||
var _selectorQuery = require('./query/selectorQuery'); | ||
exports.default = (0, _reactRedux.connect)(function (state) { | ||
@@ -31,2 +33,5 @@ var annotationList = (0, _elucidateQuery.richAnnotationList)(state); | ||
state: state, | ||
isSelecting: (0, _selectorQuery.isSelecting)(state), | ||
isSelectingPrimary: (0, _selectorQuery.isSelecting)(state) && (0, _selectorQuery.currentSelectorIsSecondary)(state) === false, | ||
isSelectingSecondary: (0, _selectorQuery.isSelecting)(state) && (0, _selectorQuery.currentSelectorIsSecondary)(state) === true, | ||
currentSelector: state.selector && state.selector.currentSelector ? state.selector.currentSelector : null, | ||
@@ -33,0 +38,0 @@ currentDraft: (0, _draftQuery.getCurrentDraft)(state), |
@@ -50,2 +50,3 @@ 'use strict'; | ||
case _selectors.SELECTOR_COMMIT_TO_DRAFT: | ||
case _selectors.SELECTOR_COMMIT_TO_DRAFT_FIELD: | ||
return (0, _immutabilityHelper2.default)(state, { | ||
@@ -52,0 +53,0 @@ currentSelector: { $set: {} } |
{ | ||
"name": "digirati-annotation-redux", | ||
"version": "0.2.20-alpha.5892bb78", | ||
"version": "0.2.20-alpha.8fb426d4", | ||
"description": "Describe annotation-redux here", | ||
@@ -5,0 +5,0 @@ "main": "es/index.js", |
99671
60
2558