From 3f5d884cd2fc9fadd916e49182dec80f4a40e20a Mon Sep 17 00:00:00 2001 From: Laurent Vetterhoeffer Date: Wed, 19 Jul 2017 11:55:52 +0200 Subject: [PATCH] [Prepublish] CSS changes to get the black alert style + included #44 changes (update) --- dist/SAlert.js | 5 +++++ dist/s-alert-parts/s-alert-store.js | 17 +++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/dist/SAlert.js b/dist/SAlert.js index f045c4e..c595dfd 100644 --- a/dist/SAlert.js +++ b/dist/SAlert.js @@ -266,6 +266,11 @@ value: function success(msg, data) { return insertFunc(msg, data, 'success'); } + }, { + key: 'update', + value: function update(id, customFields) { + _sAlertStore2.default.dispatch({ type: 'UPDATE', data: { id: id, customFields: customFields } }); + } }, { key: 'close', value: function close(id) { diff --git a/dist/s-alert-parts/s-alert-store.js b/dist/s-alert-parts/s-alert-store.js index 23d31e2..c868f9a 100644 --- a/dist/s-alert-parts/s-alert-store.js +++ b/dist/s-alert-parts/s-alert-store.js @@ -61,6 +61,21 @@ return [].concat(_toConsumableArray(state), [action.data]); }; + var update = function update(state, action) { + var elemToUpdateArray = state.slice().filter(function (item) { + return item.id === action.data.id; + }); + if (Array.isArray(elemToUpdateArray)) { + var elemToUpdateIndex = state.indexOf(elemToUpdateArray[0]); + if (elemToUpdateIndex > -1) { + state[elemToUpdateIndex].customFields = action.data.customFields; + return [].concat(_toConsumableArray(state)); + } + return state; + } + return state; + }; + var remove = function remove(state, action) { var elemToRemoveArray = state.slice().filter(function (item) { return item.id === action.data.id; @@ -79,6 +94,8 @@ switch (action.type) { case 'INSERT': return insert(state, action); + case 'UPDATE': + return update(state, action); case 'REMOVE': return remove(state, action); case 'REMOVEALL':