jamespot-front-business 1.1.9 → 1.1.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs.js +248 -175
- package/dist/cjs.js.map +1 -1
- package/dist/esm.js +248 -175
- package/dist/esm.js.map +1 -1
- package/dist/types.d.ts +50 -29
- package/package.json +2 -2
package/dist/cjs.js
CHANGED
|
@@ -273,7 +273,7 @@ const addBookmark = toolkit.createAsyncThunk('bookmarkList/addBookmark', (bookma
|
|
|
273
273
|
catch (errorThrown) {
|
|
274
274
|
const toastLabel = (_a = errorThrown.errorMsg) !== null && _a !== void 0 ? _a : 'GLOBAL_Technical_Error';
|
|
275
275
|
dispatch(Toast.actions.error({ label: toastLabel }));
|
|
276
|
-
return rejectWithValue({ error: 1, errorMsg: 'Error saving
|
|
276
|
+
return rejectWithValue({ error: 1, errorMsg: 'Error saving bookmark' });
|
|
277
277
|
}
|
|
278
278
|
}));
|
|
279
279
|
const moveBookmark = toolkit.createAsyncThunk('bookmarkList/moveBookmark', ({ bookmark, bookmarkReference, position }, { extra, rejectWithValue, dispatch }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
@@ -283,7 +283,7 @@ const moveBookmark = toolkit.createAsyncThunk('bookmarkList/moveBookmark', ({ bo
|
|
|
283
283
|
}
|
|
284
284
|
catch (_) {
|
|
285
285
|
dispatch(Toast.actions.error({ label: 'GLOBAL_Technical_Error' }));
|
|
286
|
-
return rejectWithValue({ error: 1, errorMsg: 'Error moving
|
|
286
|
+
return rejectWithValue({ error: 1, errorMsg: 'Error moving bookmark' });
|
|
287
287
|
}
|
|
288
288
|
}));
|
|
289
289
|
const deleteBookmark = toolkit.createAsyncThunk('bookmarkList/deleteBookmark', (bookmark, { extra, rejectWithValue, dispatch }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
@@ -293,7 +293,7 @@ const deleteBookmark = toolkit.createAsyncThunk('bookmarkList/deleteBookmark', (
|
|
|
293
293
|
}
|
|
294
294
|
catch (_) {
|
|
295
295
|
dispatch(Toast.actions.error({ label: 'GLOBAL_Technical_Error' }));
|
|
296
|
-
return rejectWithValue({ error: 1, errorMsg: 'Error
|
|
296
|
+
return rejectWithValue({ error: 1, errorMsg: 'Error deleting bookmark' });
|
|
297
297
|
}
|
|
298
298
|
}));
|
|
299
299
|
const BookmarkListSlice = toolkit.createSlice({
|
|
@@ -922,6 +922,125 @@ const UserCurrent = {
|
|
|
922
922
|
utils: { isAdmin },
|
|
923
923
|
};
|
|
924
924
|
|
|
925
|
+
const widgetArticleAttachmentDefinition = {
|
|
926
|
+
label: 'WIDGET_Article_Attachment',
|
|
927
|
+
description: 'WIDGET_Article_Attachment_Description',
|
|
928
|
+
name: 'widget-article-attachment',
|
|
929
|
+
img: '/img/fast-intranet/widget-file.png',
|
|
930
|
+
available: true,
|
|
931
|
+
panel: {
|
|
932
|
+
useWrapper: true,
|
|
933
|
+
useEditor: true,
|
|
934
|
+
useWidgets: false
|
|
935
|
+
},
|
|
936
|
+
};
|
|
937
|
+
const widgetArticleAttachmentContent = {
|
|
938
|
+
files: [],
|
|
939
|
+
};
|
|
940
|
+
|
|
941
|
+
const widgetArticleGalleryDefinition = {
|
|
942
|
+
label: 'WIDGET_Article_Gallery',
|
|
943
|
+
description: 'WIDGET_Article_Gallery_Description',
|
|
944
|
+
name: 'widget-article-gallery',
|
|
945
|
+
img: '/img/fast-intranet/widget-slider.png',
|
|
946
|
+
available: true,
|
|
947
|
+
panel: {
|
|
948
|
+
useWrapper: false,
|
|
949
|
+
useEditor: true,
|
|
950
|
+
useWidgets: false
|
|
951
|
+
},
|
|
952
|
+
};
|
|
953
|
+
const widgetArticleGalleryContent = {
|
|
954
|
+
files: [],
|
|
955
|
+
gap: '4',
|
|
956
|
+
columnCount: '3',
|
|
957
|
+
galleryDisplay: 'landscape',
|
|
958
|
+
heightMode: 'auto',
|
|
959
|
+
heightModeValue: '200',
|
|
960
|
+
};
|
|
961
|
+
|
|
962
|
+
const widgetArticleImageDefinition = {
|
|
963
|
+
label: 'WIDGET_Article_Image',
|
|
964
|
+
description: 'WIDGET_Article_Image_Description',
|
|
965
|
+
name: 'widget-article-image',
|
|
966
|
+
img: '/img/fast-intranet/widget-image.png',
|
|
967
|
+
available: true,
|
|
968
|
+
panel: {
|
|
969
|
+
useWrapper: false,
|
|
970
|
+
useEditor: true,
|
|
971
|
+
useWidgets: false
|
|
972
|
+
},
|
|
973
|
+
};
|
|
974
|
+
const widgetArticleImageContent = {
|
|
975
|
+
displayAs: 'image',
|
|
976
|
+
backgroundPosition: 'center',
|
|
977
|
+
backgroundSize: 'cover',
|
|
978
|
+
borderRadius: '8'
|
|
979
|
+
};
|
|
980
|
+
|
|
981
|
+
const widgetArticleButtonDefinition = {
|
|
982
|
+
label: 'WIDGET_Button',
|
|
983
|
+
description: 'WIDGET_Button_Description',
|
|
984
|
+
name: 'widget-article-button',
|
|
985
|
+
img: '/img/fast-intranet/widget-button.png',
|
|
986
|
+
available: true,
|
|
987
|
+
panel: {
|
|
988
|
+
useWrapper: false,
|
|
989
|
+
useEditor: true,
|
|
990
|
+
useWidgets: false
|
|
991
|
+
},
|
|
992
|
+
};
|
|
993
|
+
const widgetArticleButtonContent = {
|
|
994
|
+
text: 'This is a button',
|
|
995
|
+
openingType: 'link',
|
|
996
|
+
openingTypeLink: {
|
|
997
|
+
url: '',
|
|
998
|
+
target: '_blank'
|
|
999
|
+
},
|
|
1000
|
+
variant: 'contained',
|
|
1001
|
+
fontSize: '14',
|
|
1002
|
+
color: '#fff',
|
|
1003
|
+
backgroundColor: '#4dbf96',
|
|
1004
|
+
buttonSize: 'lg',
|
|
1005
|
+
borderRadius: '4',
|
|
1006
|
+
};
|
|
1007
|
+
|
|
1008
|
+
const widgetArticleTextDefinition = {
|
|
1009
|
+
label: 'WIDGET_Text',
|
|
1010
|
+
description: 'WIDGET_Text_Description',
|
|
1011
|
+
name: 'widget-article-text',
|
|
1012
|
+
img: '/img/fast-intranet/widget-text.png',
|
|
1013
|
+
available: true,
|
|
1014
|
+
panel: {
|
|
1015
|
+
useWrapper: false,
|
|
1016
|
+
useEditor: true,
|
|
1017
|
+
useWidgets: false
|
|
1018
|
+
},
|
|
1019
|
+
};
|
|
1020
|
+
const widgetArticleTextContent = {
|
|
1021
|
+
fontSize: '18',
|
|
1022
|
+
lineHeight: '1.6',
|
|
1023
|
+
text: ''
|
|
1024
|
+
};
|
|
1025
|
+
|
|
1026
|
+
const widgetArticleTitleDefinition = {
|
|
1027
|
+
label: 'WIDGET_Title',
|
|
1028
|
+
description: 'WIDGET_Title_Description',
|
|
1029
|
+
name: 'widget-article-title',
|
|
1030
|
+
img: '/img/fast-intranet/widget-text.png',
|
|
1031
|
+
available: true,
|
|
1032
|
+
panel: {
|
|
1033
|
+
useWrapper: false,
|
|
1034
|
+
useEditor: true,
|
|
1035
|
+
useWidgets: false
|
|
1036
|
+
},
|
|
1037
|
+
};
|
|
1038
|
+
const widgetArticleTitleContent = {
|
|
1039
|
+
text: '',
|
|
1040
|
+
heading: 'h1',
|
|
1041
|
+
backgroundColor: 'transparent'
|
|
1042
|
+
};
|
|
1043
|
+
|
|
925
1044
|
function uniqid() {
|
|
926
1045
|
let id = '';
|
|
927
1046
|
for (let index = 0; index < 16; index++) {
|
|
@@ -930,6 +1049,37 @@ function uniqid() {
|
|
|
930
1049
|
return id;
|
|
931
1050
|
}
|
|
932
1051
|
|
|
1052
|
+
function widgetFactory(name) {
|
|
1053
|
+
return {
|
|
1054
|
+
title: '',
|
|
1055
|
+
widget: widget(name),
|
|
1056
|
+
};
|
|
1057
|
+
}
|
|
1058
|
+
function widget(name) {
|
|
1059
|
+
return {
|
|
1060
|
+
uniqid: uniqid(),
|
|
1061
|
+
name,
|
|
1062
|
+
content: content(name)
|
|
1063
|
+
};
|
|
1064
|
+
}
|
|
1065
|
+
function content(name) {
|
|
1066
|
+
switch (name) {
|
|
1067
|
+
default:
|
|
1068
|
+
case 'widget-article-attachment':
|
|
1069
|
+
return Object.assign({}, widgetArticleAttachmentContent);
|
|
1070
|
+
case 'widget-article-gallery':
|
|
1071
|
+
return Object.assign({}, widgetArticleGalleryContent);
|
|
1072
|
+
case 'widget-article-button':
|
|
1073
|
+
return Object.assign({}, widgetArticleButtonContent);
|
|
1074
|
+
case 'widget-article-title':
|
|
1075
|
+
return Object.assign({}, widgetArticleTitleContent);
|
|
1076
|
+
case 'widget-article-image':
|
|
1077
|
+
return Object.assign({}, widgetArticleImageContent);
|
|
1078
|
+
case 'widget-article-text':
|
|
1079
|
+
return Object.assign({}, widgetArticleTextContent);
|
|
1080
|
+
}
|
|
1081
|
+
}
|
|
1082
|
+
|
|
933
1083
|
const WIDGET_ARTICLE_TITLE = 'widget-article-title';
|
|
934
1084
|
const WIDGET_ARTICLE_TEXT = 'widget-article-text';
|
|
935
1085
|
const WIDGET_ARTICLE_IMAGE = 'widget-article-image';
|
|
@@ -947,155 +1097,22 @@ var WIDGETS = /*#__PURE__*/Object.freeze({
|
|
|
947
1097
|
WIDGET_ARTICLE_ATTACHMENT: WIDGET_ARTICLE_ATTACHMENT
|
|
948
1098
|
});
|
|
949
1099
|
|
|
950
|
-
function widgetFactory(name, widgetWrapperExtraParams) {
|
|
951
|
-
const widgetWrapper = {
|
|
952
|
-
title: '',
|
|
953
|
-
widget: {
|
|
954
|
-
name,
|
|
955
|
-
uniqid: uniqid(),
|
|
956
|
-
content: {}
|
|
957
|
-
},
|
|
958
|
-
position: { x: 0, y: 0 }
|
|
959
|
-
};
|
|
960
|
-
switch (name) {
|
|
961
|
-
default:
|
|
962
|
-
case WIDGET_ARTICLE_ATTACHMENT:
|
|
963
|
-
return Object.assign(Object.assign(Object.assign({}, widgetWrapper), widgetWrapperExtraParams), { widget: Object.assign(Object.assign({}, widgetWrapper.widget), { content: {
|
|
964
|
-
files: []
|
|
965
|
-
} }) });
|
|
966
|
-
case WIDGET_ARTICLE_GALLERY:
|
|
967
|
-
return Object.assign(Object.assign(Object.assign({}, widgetWrapper), widgetWrapperExtraParams), { widget: Object.assign(Object.assign({}, widgetWrapper.widget), { content: {
|
|
968
|
-
widgets: [],
|
|
969
|
-
gap: '4',
|
|
970
|
-
horizontalNumber: '3',
|
|
971
|
-
galleryDisplay: 'landscape'
|
|
972
|
-
} }) });
|
|
973
|
-
case WIDGET_ARTICLE_IMAGE:
|
|
974
|
-
return Object.assign(Object.assign(Object.assign({}, widgetWrapper), widgetWrapperExtraParams), { widget: Object.assign(Object.assign({}, widgetWrapper.widget), { content: {
|
|
975
|
-
widgets: [],
|
|
976
|
-
displayAs: 'image',
|
|
977
|
-
backgroundPosition: 'center',
|
|
978
|
-
backgroundSize: 'cover',
|
|
979
|
-
borderRadius: 8
|
|
980
|
-
} }) });
|
|
981
|
-
case WIDGET_ARTICLE_BUTTON:
|
|
982
|
-
return Object.assign(Object.assign(Object.assign({}, widgetWrapper), widgetWrapperExtraParams), { widget: Object.assign(Object.assign({}, widgetWrapper.widget), { content: {
|
|
983
|
-
text: 'This is a button',
|
|
984
|
-
variant: 'contained',
|
|
985
|
-
fontSize: '14',
|
|
986
|
-
color: '#fff',
|
|
987
|
-
backgroundColor: '#4dbf96',
|
|
988
|
-
buttonSize: 'lg',
|
|
989
|
-
borderRadius: '4'
|
|
990
|
-
} }) });
|
|
991
|
-
case WIDGET_ARTICLE_TITLE:
|
|
992
|
-
return Object.assign(Object.assign(Object.assign({}, widgetWrapper), widgetWrapperExtraParams), { widget: Object.assign(Object.assign({}, widgetWrapper.widget), { content: {
|
|
993
|
-
text: 'Ceci est un titre',
|
|
994
|
-
heading: 'h1',
|
|
995
|
-
backgroundColor: 'transparent'
|
|
996
|
-
} }) });
|
|
997
|
-
case WIDGET_ARTICLE_TEXT:
|
|
998
|
-
return Object.assign(Object.assign(Object.assign({}, widgetWrapper), widgetWrapperExtraParams), { widget: Object.assign(Object.assign({}, widgetWrapper.widget), { content: {
|
|
999
|
-
fontSize: '18',
|
|
1000
|
-
lineHeight: '1.6',
|
|
1001
|
-
text: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.'
|
|
1002
|
-
} }) });
|
|
1003
|
-
}
|
|
1004
|
-
}
|
|
1005
|
-
|
|
1006
1100
|
function widgetDefinition(name) {
|
|
1007
1101
|
switch (name) {
|
|
1008
1102
|
default:
|
|
1009
|
-
return
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
return {
|
|
1023
|
-
label: 'WIDGET_Article_Gallery',
|
|
1024
|
-
description: 'WIDGET_Article_Gallery_Description',
|
|
1025
|
-
name,
|
|
1026
|
-
img: '/img/fast-intranet/widget-slider.png',
|
|
1027
|
-
available: true,
|
|
1028
|
-
panel: {
|
|
1029
|
-
useWrapper: false,
|
|
1030
|
-
useEditor: true,
|
|
1031
|
-
useWidgets: false
|
|
1032
|
-
},
|
|
1033
|
-
};
|
|
1034
|
-
case WIDGET_ARTICLE_ATTACHMENT:
|
|
1035
|
-
return {
|
|
1036
|
-
label: 'WIDGET_Article_Attachment',
|
|
1037
|
-
description: 'WIDGET_Article_Attachment_Description',
|
|
1038
|
-
name,
|
|
1039
|
-
img: '/img/fast-intranet/widget-file.png',
|
|
1040
|
-
available: true,
|
|
1041
|
-
panel: {
|
|
1042
|
-
useWrapper: true,
|
|
1043
|
-
useEditor: true,
|
|
1044
|
-
useWidgets: false
|
|
1045
|
-
},
|
|
1046
|
-
};
|
|
1047
|
-
case WIDGET_ARTICLE_TEXT:
|
|
1048
|
-
return {
|
|
1049
|
-
label: 'WIDGET_Text',
|
|
1050
|
-
description: 'WIDGET_Text_Description',
|
|
1051
|
-
name,
|
|
1052
|
-
img: '/img/fast-intranet/widget-text.png',
|
|
1053
|
-
available: true,
|
|
1054
|
-
panel: {
|
|
1055
|
-
useWrapper: false,
|
|
1056
|
-
useEditor: true,
|
|
1057
|
-
useWidgets: false
|
|
1058
|
-
},
|
|
1059
|
-
};
|
|
1060
|
-
case WIDGET_ARTICLE_TITLE:
|
|
1061
|
-
return {
|
|
1062
|
-
label: 'WIDGET_Title',
|
|
1063
|
-
description: 'WIDGET_Title_Description',
|
|
1064
|
-
name,
|
|
1065
|
-
img: '/img/fast-intranet/widget-text.png',
|
|
1066
|
-
available: true,
|
|
1067
|
-
panel: {
|
|
1068
|
-
useWrapper: false,
|
|
1069
|
-
useEditor: true,
|
|
1070
|
-
useWidgets: false
|
|
1071
|
-
},
|
|
1072
|
-
};
|
|
1073
|
-
case WIDGET_ARTICLE_IMAGE:
|
|
1074
|
-
return {
|
|
1075
|
-
label: 'WIDGET_Article_Image',
|
|
1076
|
-
description: 'WIDGET_Article_Image_Description',
|
|
1077
|
-
name,
|
|
1078
|
-
img: '/img/fast-intranet/widget-image.png',
|
|
1079
|
-
available: true,
|
|
1080
|
-
panel: {
|
|
1081
|
-
useWrapper: false,
|
|
1082
|
-
useEditor: true,
|
|
1083
|
-
useWidgets: false
|
|
1084
|
-
},
|
|
1085
|
-
};
|
|
1086
|
-
case WIDGET_ARTICLE_BUTTON:
|
|
1087
|
-
return {
|
|
1088
|
-
label: 'WIDGET_Button',
|
|
1089
|
-
description: 'WIDGET_Button_Description',
|
|
1090
|
-
name,
|
|
1091
|
-
img: '/img/fast-intranet/widget-button.png',
|
|
1092
|
-
available: true,
|
|
1093
|
-
panel: {
|
|
1094
|
-
useWrapper: false,
|
|
1095
|
-
useEditor: true,
|
|
1096
|
-
useWidgets: false
|
|
1097
|
-
},
|
|
1098
|
-
};
|
|
1103
|
+
return widgetArticleGalleryDefinition;
|
|
1104
|
+
case 'widget-article-gallery':
|
|
1105
|
+
return widgetArticleGalleryDefinition;
|
|
1106
|
+
case 'widget-article-attachment':
|
|
1107
|
+
return widgetArticleAttachmentDefinition;
|
|
1108
|
+
case 'widget-article-text':
|
|
1109
|
+
return widgetArticleTextDefinition;
|
|
1110
|
+
case 'widget-article-title':
|
|
1111
|
+
return widgetArticleTitleDefinition;
|
|
1112
|
+
case 'widget-article-image':
|
|
1113
|
+
return widgetArticleImageDefinition;
|
|
1114
|
+
case 'widget-article-button':
|
|
1115
|
+
return widgetArticleButtonDefinition;
|
|
1099
1116
|
}
|
|
1100
1117
|
}
|
|
1101
1118
|
|
|
@@ -1104,8 +1121,12 @@ const MODE_VIEW = 'view';
|
|
|
1104
1121
|
const initialState$1 = {
|
|
1105
1122
|
token: undefined,
|
|
1106
1123
|
ids: {},
|
|
1124
|
+
layers: {},
|
|
1107
1125
|
states: {},
|
|
1108
1126
|
modal: undefined,
|
|
1127
|
+
editableMap: {},
|
|
1128
|
+
currentEditableIndex: -1,
|
|
1129
|
+
currentEditableWidgetId: undefined,
|
|
1109
1130
|
};
|
|
1110
1131
|
const widgetsSlice = toolkit.createSlice({
|
|
1111
1132
|
name: 'widgets',
|
|
@@ -1114,14 +1135,15 @@ const widgetsSlice = toolkit.createSlice({
|
|
|
1114
1135
|
registerWidget: (state, action) => {
|
|
1115
1136
|
const { uniqid, widget } = action.payload;
|
|
1116
1137
|
state.ids[uniqid] = widget;
|
|
1117
|
-
state.states[uniqid] = { busy: false, initialized: false, loading: false, mounted: false };
|
|
1138
|
+
state.states[uniqid] = { busy: false, initialized: false, loading: false, mounted: false, hover: false };
|
|
1118
1139
|
},
|
|
1119
1140
|
updateWidget: (state, action) => {
|
|
1120
|
-
|
|
1121
|
-
const { uniqid, content } = action.payload;
|
|
1141
|
+
const { uniqid } = action.payload;
|
|
1122
1142
|
const wrapper = Object.assign({}, state.ids[uniqid]);
|
|
1123
|
-
if (
|
|
1124
|
-
state.ids[uniqid] = Object.assign(Object.assign({},
|
|
1143
|
+
if (state.ids[uniqid] && wrapper && wrapper.widget) {
|
|
1144
|
+
state.ids[uniqid] = Object.assign(Object.assign(Object.assign({}, state.ids[uniqid]), { widget: Object.assign(Object.assign({}, wrapper.widget), { content: action.payload.override
|
|
1145
|
+
? action.payload.content
|
|
1146
|
+
: Object.assign(Object.assign(Object.assign({}, wrapper.widget.content), action.payload.content)) }) }));
|
|
1125
1147
|
}
|
|
1126
1148
|
},
|
|
1127
1149
|
flushWidget: (state, action) => {
|
|
@@ -1129,34 +1151,90 @@ const widgetsSlice = toolkit.createSlice({
|
|
|
1129
1151
|
delete state.ids[uniqid];
|
|
1130
1152
|
delete state.states[uniqid];
|
|
1131
1153
|
},
|
|
1154
|
+
flushAllWidget: (state) => {
|
|
1155
|
+
state.ids = {};
|
|
1156
|
+
state.states = {};
|
|
1157
|
+
},
|
|
1132
1158
|
updateWidgetWrapper: (state, action) => {
|
|
1133
|
-
const { uniqid
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1159
|
+
const { uniqid } = action.payload;
|
|
1160
|
+
if (state.ids && state.ids[uniqid]) {
|
|
1161
|
+
state.ids[uniqid] = Object.assign(Object.assign(Object.assign({}, state.ids[uniqid]), action.payload));
|
|
1162
|
+
}
|
|
1163
|
+
},
|
|
1164
|
+
registerLayer: (state, action) => {
|
|
1165
|
+
const layerId = uniqid();
|
|
1166
|
+
const wrapper = Object.assign({}, state.ids[action.payload.uniqid]);
|
|
1167
|
+
if (wrapper && wrapper.widget) {
|
|
1168
|
+
if (state.ids[action.payload.uniqid] && wrapper.widget.layers) {
|
|
1169
|
+
state.ids[action.payload.uniqid] = Object.assign(Object.assign(Object.assign({}, state.ids[action.payload.uniqid]), { widget: Object.assign(Object.assign({}, wrapper.widget), { layers: [...wrapper.widget.layers, layerId] }) }));
|
|
1138
1170
|
}
|
|
1139
1171
|
else {
|
|
1140
|
-
state.ids[uniqid] = Object.assign(Object.assign({},
|
|
1172
|
+
state.ids[action.payload.uniqid] = Object.assign(Object.assign(Object.assign({}, state.ids[action.payload.uniqid]), { widget: Object.assign(Object.assign({}, wrapper.widget), { layers: [layerId] }) }));
|
|
1141
1173
|
}
|
|
1174
|
+
state.ids[action.payload.widget.widget.uniqid] = action.payload.widget;
|
|
1175
|
+
state.states[action.payload.widget.widget.uniqid] = {
|
|
1176
|
+
busy: false,
|
|
1177
|
+
initialized: false,
|
|
1178
|
+
loading: false,
|
|
1179
|
+
mounted: false,
|
|
1180
|
+
hover: false,
|
|
1181
|
+
};
|
|
1182
|
+
state.layers[layerId] = {
|
|
1183
|
+
uniqid: layerId,
|
|
1184
|
+
widgets: [action.payload.widget],
|
|
1185
|
+
title: `Layer ${layerId}`,
|
|
1186
|
+
visible: true,
|
|
1187
|
+
locked: false,
|
|
1188
|
+
position: { x: 0, y: 0 },
|
|
1189
|
+
};
|
|
1190
|
+
}
|
|
1191
|
+
},
|
|
1192
|
+
updateLayer: (state, action) => {
|
|
1193
|
+
if (state.layers[action.payload.uniqid]) {
|
|
1194
|
+
state.layers[action.payload.uniqid] = Object.assign(Object.assign(Object.assign({}, state.layers[action.payload.uniqid]), action.payload.props));
|
|
1142
1195
|
}
|
|
1143
1196
|
},
|
|
1197
|
+
flushLayer: (state, action) => {
|
|
1198
|
+
const wrapper = Object.assign({}, state.ids[action.payload.uniqid]);
|
|
1199
|
+
if (wrapper && wrapper.widget && wrapper.widget.layers) {
|
|
1200
|
+
state.ids[action.payload.uniqid] = Object.assign(Object.assign(Object.assign({}, state.ids[action.payload.uniqid]), { widget: Object.assign(Object.assign({}, wrapper.widget), { layers: [
|
|
1201
|
+
...wrapper.widget.layers.filter((layerId) => layerId !== action.payload.layerId),
|
|
1202
|
+
] }) }));
|
|
1203
|
+
delete state.layers[action.payload.layerId];
|
|
1204
|
+
}
|
|
1205
|
+
},
|
|
1206
|
+
prevEditableIndex: (state) => {
|
|
1207
|
+
const count = Object.keys(state.ids).length;
|
|
1208
|
+
state.currentEditableIndex = state.currentEditableIndex === 0 ? count - 1 : state.currentEditableIndex - 1;
|
|
1209
|
+
},
|
|
1210
|
+
nextEditableIndex: (state) => {
|
|
1211
|
+
const count = Object.keys(state.ids).length;
|
|
1212
|
+
state.currentEditableIndex = state.currentEditableIndex < count - 1 ? state.currentEditableIndex + 1 : 0;
|
|
1213
|
+
},
|
|
1214
|
+
setEditableIndex: (state, action) => {
|
|
1215
|
+
state.currentEditableIndex = action.payload.index;
|
|
1216
|
+
},
|
|
1217
|
+
setEditableWidgetId: (state, action) => {
|
|
1218
|
+
state.currentEditableWidgetId = action.payload.uniqid;
|
|
1219
|
+
},
|
|
1220
|
+
registerEditableWidget: (state, action) => {
|
|
1221
|
+
state.editableMap[action.payload.uniqid] = action.payload;
|
|
1222
|
+
},
|
|
1144
1223
|
setToken: (state, action) => {
|
|
1145
1224
|
state.token = action.payload.token;
|
|
1146
1225
|
},
|
|
1147
|
-
|
|
1226
|
+
setWidgetState: (state, action) => {
|
|
1148
1227
|
const { uniqid } = action.payload;
|
|
1149
1228
|
const widgetState = Object.assign({}, state.states[uniqid]);
|
|
1150
1229
|
if (widgetState !== undefined) {
|
|
1151
1230
|
state.states[uniqid] = Object.assign(Object.assign({}, state.states[uniqid]), action.payload);
|
|
1152
1231
|
}
|
|
1153
1232
|
},
|
|
1154
|
-
|
|
1155
|
-
const { busy, initialized, loading, mounted } = action.payload;
|
|
1233
|
+
setAllWidgetStates: (state, action) => {
|
|
1156
1234
|
Object.keys(state.states).map((key) => {
|
|
1157
1235
|
const widgetState = Object.assign({}, state.states[key]);
|
|
1158
1236
|
if (widgetState !== undefined) {
|
|
1159
|
-
state.states[key] = Object.assign(Object.assign({}, state.states[key]),
|
|
1237
|
+
state.states[key] = Object.assign(Object.assign({}, state.states[key]), action.payload);
|
|
1160
1238
|
}
|
|
1161
1239
|
});
|
|
1162
1240
|
},
|
|
@@ -1171,7 +1249,7 @@ const widgetsSlice = toolkit.createSlice({
|
|
|
1171
1249
|
const selectToken = (state) => state.widgets.token;
|
|
1172
1250
|
const selectModal = (state) => state.widgets.modal;
|
|
1173
1251
|
const selectWidgets = (state) => state.widgets.ids;
|
|
1174
|
-
const selectWidgetContent = (state, uniqid) => { var _a
|
|
1252
|
+
const selectWidgetContent = (state, uniqid) => { var _a; return (_a = state.widgets.ids[uniqid]) === null || _a === void 0 ? void 0 : _a.widget.content; };
|
|
1175
1253
|
const selectWidgetState = (state, uniqid) => { var _a; return (_a = state.widgets.states[uniqid]) !== null && _a !== void 0 ? _a : undefined; };
|
|
1176
1254
|
const selectWidget = (state, uniqid) => { var _a; return (_a = state.widgets.ids[uniqid]) !== null && _a !== void 0 ? _a : undefined; };
|
|
1177
1255
|
const Widget = {
|
|
@@ -1179,7 +1257,7 @@ const Widget = {
|
|
|
1179
1257
|
factory: widgetFactory,
|
|
1180
1258
|
definition: widgetDefinition,
|
|
1181
1259
|
utils: {
|
|
1182
|
-
uniqid
|
|
1260
|
+
uniqid,
|
|
1183
1261
|
},
|
|
1184
1262
|
slice: widgetsSlice,
|
|
1185
1263
|
selectors: {
|
|
@@ -1189,7 +1267,7 @@ const Widget = {
|
|
|
1189
1267
|
selectWidgetState,
|
|
1190
1268
|
selectWidgetContent,
|
|
1191
1269
|
selectModal,
|
|
1192
|
-
}
|
|
1270
|
+
},
|
|
1193
1271
|
};
|
|
1194
1272
|
|
|
1195
1273
|
const initialState = {
|
|
@@ -1228,18 +1306,13 @@ const editorsSlice = toolkit.createSlice({
|
|
|
1228
1306
|
}),
|
|
1229
1307
|
];
|
|
1230
1308
|
},
|
|
1231
|
-
updateEditor: (state, action) => {
|
|
1232
|
-
const { uniqid, content } = action.payload;
|
|
1233
|
-
state.editors = [
|
|
1234
|
-
...state.editors.map((ed) => {
|
|
1235
|
-
return ed.uniqid === uniqid ? Object.assign(Object.assign({}, ed), { content }) : ed;
|
|
1236
|
-
}),
|
|
1237
|
-
];
|
|
1238
|
-
},
|
|
1239
1309
|
flushEditor: (state, action) => {
|
|
1240
1310
|
const { uniqid } = action.payload;
|
|
1241
1311
|
state.editors = [...state.editors.filter((ed) => ed.uniqid !== uniqid)];
|
|
1242
1312
|
},
|
|
1313
|
+
flushAllEditor: (state) => {
|
|
1314
|
+
state.editors.length = 0;
|
|
1315
|
+
},
|
|
1243
1316
|
},
|
|
1244
1317
|
});
|
|
1245
1318
|
const selectEditors = (state) => state.editors.editors;
|