jamespot-front-business 1.1.10 → 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 +245 -172
- package/dist/cjs.js.map +1 -1
- package/dist/esm.js +245 -172
- package/dist/esm.js.map +1 -1
- package/dist/types.d.ts +50 -29
- package/package.json +2 -2
package/dist/esm.js
CHANGED
|
@@ -918,6 +918,125 @@ const UserCurrent = {
|
|
|
918
918
|
utils: { isAdmin },
|
|
919
919
|
};
|
|
920
920
|
|
|
921
|
+
const widgetArticleAttachmentDefinition = {
|
|
922
|
+
label: 'WIDGET_Article_Attachment',
|
|
923
|
+
description: 'WIDGET_Article_Attachment_Description',
|
|
924
|
+
name: 'widget-article-attachment',
|
|
925
|
+
img: '/img/fast-intranet/widget-file.png',
|
|
926
|
+
available: true,
|
|
927
|
+
panel: {
|
|
928
|
+
useWrapper: true,
|
|
929
|
+
useEditor: true,
|
|
930
|
+
useWidgets: false
|
|
931
|
+
},
|
|
932
|
+
};
|
|
933
|
+
const widgetArticleAttachmentContent = {
|
|
934
|
+
files: [],
|
|
935
|
+
};
|
|
936
|
+
|
|
937
|
+
const widgetArticleGalleryDefinition = {
|
|
938
|
+
label: 'WIDGET_Article_Gallery',
|
|
939
|
+
description: 'WIDGET_Article_Gallery_Description',
|
|
940
|
+
name: 'widget-article-gallery',
|
|
941
|
+
img: '/img/fast-intranet/widget-slider.png',
|
|
942
|
+
available: true,
|
|
943
|
+
panel: {
|
|
944
|
+
useWrapper: false,
|
|
945
|
+
useEditor: true,
|
|
946
|
+
useWidgets: false
|
|
947
|
+
},
|
|
948
|
+
};
|
|
949
|
+
const widgetArticleGalleryContent = {
|
|
950
|
+
files: [],
|
|
951
|
+
gap: '4',
|
|
952
|
+
columnCount: '3',
|
|
953
|
+
galleryDisplay: 'landscape',
|
|
954
|
+
heightMode: 'auto',
|
|
955
|
+
heightModeValue: '200',
|
|
956
|
+
};
|
|
957
|
+
|
|
958
|
+
const widgetArticleImageDefinition = {
|
|
959
|
+
label: 'WIDGET_Article_Image',
|
|
960
|
+
description: 'WIDGET_Article_Image_Description',
|
|
961
|
+
name: 'widget-article-image',
|
|
962
|
+
img: '/img/fast-intranet/widget-image.png',
|
|
963
|
+
available: true,
|
|
964
|
+
panel: {
|
|
965
|
+
useWrapper: false,
|
|
966
|
+
useEditor: true,
|
|
967
|
+
useWidgets: false
|
|
968
|
+
},
|
|
969
|
+
};
|
|
970
|
+
const widgetArticleImageContent = {
|
|
971
|
+
displayAs: 'image',
|
|
972
|
+
backgroundPosition: 'center',
|
|
973
|
+
backgroundSize: 'cover',
|
|
974
|
+
borderRadius: '8'
|
|
975
|
+
};
|
|
976
|
+
|
|
977
|
+
const widgetArticleButtonDefinition = {
|
|
978
|
+
label: 'WIDGET_Button',
|
|
979
|
+
description: 'WIDGET_Button_Description',
|
|
980
|
+
name: 'widget-article-button',
|
|
981
|
+
img: '/img/fast-intranet/widget-button.png',
|
|
982
|
+
available: true,
|
|
983
|
+
panel: {
|
|
984
|
+
useWrapper: false,
|
|
985
|
+
useEditor: true,
|
|
986
|
+
useWidgets: false
|
|
987
|
+
},
|
|
988
|
+
};
|
|
989
|
+
const widgetArticleButtonContent = {
|
|
990
|
+
text: 'This is a button',
|
|
991
|
+
openingType: 'link',
|
|
992
|
+
openingTypeLink: {
|
|
993
|
+
url: '',
|
|
994
|
+
target: '_blank'
|
|
995
|
+
},
|
|
996
|
+
variant: 'contained',
|
|
997
|
+
fontSize: '14',
|
|
998
|
+
color: '#fff',
|
|
999
|
+
backgroundColor: '#4dbf96',
|
|
1000
|
+
buttonSize: 'lg',
|
|
1001
|
+
borderRadius: '4',
|
|
1002
|
+
};
|
|
1003
|
+
|
|
1004
|
+
const widgetArticleTextDefinition = {
|
|
1005
|
+
label: 'WIDGET_Text',
|
|
1006
|
+
description: 'WIDGET_Text_Description',
|
|
1007
|
+
name: 'widget-article-text',
|
|
1008
|
+
img: '/img/fast-intranet/widget-text.png',
|
|
1009
|
+
available: true,
|
|
1010
|
+
panel: {
|
|
1011
|
+
useWrapper: false,
|
|
1012
|
+
useEditor: true,
|
|
1013
|
+
useWidgets: false
|
|
1014
|
+
},
|
|
1015
|
+
};
|
|
1016
|
+
const widgetArticleTextContent = {
|
|
1017
|
+
fontSize: '18',
|
|
1018
|
+
lineHeight: '1.6',
|
|
1019
|
+
text: ''
|
|
1020
|
+
};
|
|
1021
|
+
|
|
1022
|
+
const widgetArticleTitleDefinition = {
|
|
1023
|
+
label: 'WIDGET_Title',
|
|
1024
|
+
description: 'WIDGET_Title_Description',
|
|
1025
|
+
name: 'widget-article-title',
|
|
1026
|
+
img: '/img/fast-intranet/widget-text.png',
|
|
1027
|
+
available: true,
|
|
1028
|
+
panel: {
|
|
1029
|
+
useWrapper: false,
|
|
1030
|
+
useEditor: true,
|
|
1031
|
+
useWidgets: false
|
|
1032
|
+
},
|
|
1033
|
+
};
|
|
1034
|
+
const widgetArticleTitleContent = {
|
|
1035
|
+
text: '',
|
|
1036
|
+
heading: 'h1',
|
|
1037
|
+
backgroundColor: 'transparent'
|
|
1038
|
+
};
|
|
1039
|
+
|
|
921
1040
|
function uniqid() {
|
|
922
1041
|
let id = '';
|
|
923
1042
|
for (let index = 0; index < 16; index++) {
|
|
@@ -926,6 +1045,37 @@ function uniqid() {
|
|
|
926
1045
|
return id;
|
|
927
1046
|
}
|
|
928
1047
|
|
|
1048
|
+
function widgetFactory(name) {
|
|
1049
|
+
return {
|
|
1050
|
+
title: '',
|
|
1051
|
+
widget: widget(name),
|
|
1052
|
+
};
|
|
1053
|
+
}
|
|
1054
|
+
function widget(name) {
|
|
1055
|
+
return {
|
|
1056
|
+
uniqid: uniqid(),
|
|
1057
|
+
name,
|
|
1058
|
+
content: content(name)
|
|
1059
|
+
};
|
|
1060
|
+
}
|
|
1061
|
+
function content(name) {
|
|
1062
|
+
switch (name) {
|
|
1063
|
+
default:
|
|
1064
|
+
case 'widget-article-attachment':
|
|
1065
|
+
return Object.assign({}, widgetArticleAttachmentContent);
|
|
1066
|
+
case 'widget-article-gallery':
|
|
1067
|
+
return Object.assign({}, widgetArticleGalleryContent);
|
|
1068
|
+
case 'widget-article-button':
|
|
1069
|
+
return Object.assign({}, widgetArticleButtonContent);
|
|
1070
|
+
case 'widget-article-title':
|
|
1071
|
+
return Object.assign({}, widgetArticleTitleContent);
|
|
1072
|
+
case 'widget-article-image':
|
|
1073
|
+
return Object.assign({}, widgetArticleImageContent);
|
|
1074
|
+
case 'widget-article-text':
|
|
1075
|
+
return Object.assign({}, widgetArticleTextContent);
|
|
1076
|
+
}
|
|
1077
|
+
}
|
|
1078
|
+
|
|
929
1079
|
const WIDGET_ARTICLE_TITLE = 'widget-article-title';
|
|
930
1080
|
const WIDGET_ARTICLE_TEXT = 'widget-article-text';
|
|
931
1081
|
const WIDGET_ARTICLE_IMAGE = 'widget-article-image';
|
|
@@ -943,155 +1093,22 @@ var WIDGETS = /*#__PURE__*/Object.freeze({
|
|
|
943
1093
|
WIDGET_ARTICLE_ATTACHMENT: WIDGET_ARTICLE_ATTACHMENT
|
|
944
1094
|
});
|
|
945
1095
|
|
|
946
|
-
function widgetFactory(name, widgetWrapperExtraParams) {
|
|
947
|
-
const widgetWrapper = {
|
|
948
|
-
title: '',
|
|
949
|
-
widget: {
|
|
950
|
-
name,
|
|
951
|
-
uniqid: uniqid(),
|
|
952
|
-
content: {}
|
|
953
|
-
},
|
|
954
|
-
position: { x: 0, y: 0 }
|
|
955
|
-
};
|
|
956
|
-
switch (name) {
|
|
957
|
-
default:
|
|
958
|
-
case WIDGET_ARTICLE_ATTACHMENT:
|
|
959
|
-
return Object.assign(Object.assign(Object.assign({}, widgetWrapper), widgetWrapperExtraParams), { widget: Object.assign(Object.assign({}, widgetWrapper.widget), { content: {
|
|
960
|
-
files: []
|
|
961
|
-
} }) });
|
|
962
|
-
case WIDGET_ARTICLE_GALLERY:
|
|
963
|
-
return Object.assign(Object.assign(Object.assign({}, widgetWrapper), widgetWrapperExtraParams), { widget: Object.assign(Object.assign({}, widgetWrapper.widget), { content: {
|
|
964
|
-
widgets: [],
|
|
965
|
-
gap: '4',
|
|
966
|
-
horizontalNumber: '3',
|
|
967
|
-
galleryDisplay: 'landscape'
|
|
968
|
-
} }) });
|
|
969
|
-
case WIDGET_ARTICLE_IMAGE:
|
|
970
|
-
return Object.assign(Object.assign(Object.assign({}, widgetWrapper), widgetWrapperExtraParams), { widget: Object.assign(Object.assign({}, widgetWrapper.widget), { content: {
|
|
971
|
-
widgets: [],
|
|
972
|
-
displayAs: 'image',
|
|
973
|
-
backgroundPosition: 'center',
|
|
974
|
-
backgroundSize: 'cover',
|
|
975
|
-
borderRadius: 8
|
|
976
|
-
} }) });
|
|
977
|
-
case WIDGET_ARTICLE_BUTTON:
|
|
978
|
-
return Object.assign(Object.assign(Object.assign({}, widgetWrapper), widgetWrapperExtraParams), { widget: Object.assign(Object.assign({}, widgetWrapper.widget), { content: {
|
|
979
|
-
text: 'This is a button',
|
|
980
|
-
variant: 'contained',
|
|
981
|
-
fontSize: '14',
|
|
982
|
-
color: '#fff',
|
|
983
|
-
backgroundColor: '#4dbf96',
|
|
984
|
-
buttonSize: 'lg',
|
|
985
|
-
borderRadius: '4'
|
|
986
|
-
} }) });
|
|
987
|
-
case WIDGET_ARTICLE_TITLE:
|
|
988
|
-
return Object.assign(Object.assign(Object.assign({}, widgetWrapper), widgetWrapperExtraParams), { widget: Object.assign(Object.assign({}, widgetWrapper.widget), { content: {
|
|
989
|
-
text: 'Ceci est un titre',
|
|
990
|
-
heading: 'h1',
|
|
991
|
-
backgroundColor: 'transparent'
|
|
992
|
-
} }) });
|
|
993
|
-
case WIDGET_ARTICLE_TEXT:
|
|
994
|
-
return Object.assign(Object.assign(Object.assign({}, widgetWrapper), widgetWrapperExtraParams), { widget: Object.assign(Object.assign({}, widgetWrapper.widget), { content: {
|
|
995
|
-
fontSize: '18',
|
|
996
|
-
lineHeight: '1.6',
|
|
997
|
-
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.'
|
|
998
|
-
} }) });
|
|
999
|
-
}
|
|
1000
|
-
}
|
|
1001
|
-
|
|
1002
1096
|
function widgetDefinition(name) {
|
|
1003
1097
|
switch (name) {
|
|
1004
1098
|
default:
|
|
1005
|
-
return
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
return {
|
|
1019
|
-
label: 'WIDGET_Article_Gallery',
|
|
1020
|
-
description: 'WIDGET_Article_Gallery_Description',
|
|
1021
|
-
name,
|
|
1022
|
-
img: '/img/fast-intranet/widget-slider.png',
|
|
1023
|
-
available: true,
|
|
1024
|
-
panel: {
|
|
1025
|
-
useWrapper: false,
|
|
1026
|
-
useEditor: true,
|
|
1027
|
-
useWidgets: false
|
|
1028
|
-
},
|
|
1029
|
-
};
|
|
1030
|
-
case WIDGET_ARTICLE_ATTACHMENT:
|
|
1031
|
-
return {
|
|
1032
|
-
label: 'WIDGET_Article_Attachment',
|
|
1033
|
-
description: 'WIDGET_Article_Attachment_Description',
|
|
1034
|
-
name,
|
|
1035
|
-
img: '/img/fast-intranet/widget-file.png',
|
|
1036
|
-
available: true,
|
|
1037
|
-
panel: {
|
|
1038
|
-
useWrapper: true,
|
|
1039
|
-
useEditor: true,
|
|
1040
|
-
useWidgets: false
|
|
1041
|
-
},
|
|
1042
|
-
};
|
|
1043
|
-
case WIDGET_ARTICLE_TEXT:
|
|
1044
|
-
return {
|
|
1045
|
-
label: 'WIDGET_Text',
|
|
1046
|
-
description: 'WIDGET_Text_Description',
|
|
1047
|
-
name,
|
|
1048
|
-
img: '/img/fast-intranet/widget-text.png',
|
|
1049
|
-
available: true,
|
|
1050
|
-
panel: {
|
|
1051
|
-
useWrapper: false,
|
|
1052
|
-
useEditor: true,
|
|
1053
|
-
useWidgets: false
|
|
1054
|
-
},
|
|
1055
|
-
};
|
|
1056
|
-
case WIDGET_ARTICLE_TITLE:
|
|
1057
|
-
return {
|
|
1058
|
-
label: 'WIDGET_Title',
|
|
1059
|
-
description: 'WIDGET_Title_Description',
|
|
1060
|
-
name,
|
|
1061
|
-
img: '/img/fast-intranet/widget-text.png',
|
|
1062
|
-
available: true,
|
|
1063
|
-
panel: {
|
|
1064
|
-
useWrapper: false,
|
|
1065
|
-
useEditor: true,
|
|
1066
|
-
useWidgets: false
|
|
1067
|
-
},
|
|
1068
|
-
};
|
|
1069
|
-
case WIDGET_ARTICLE_IMAGE:
|
|
1070
|
-
return {
|
|
1071
|
-
label: 'WIDGET_Article_Image',
|
|
1072
|
-
description: 'WIDGET_Article_Image_Description',
|
|
1073
|
-
name,
|
|
1074
|
-
img: '/img/fast-intranet/widget-image.png',
|
|
1075
|
-
available: true,
|
|
1076
|
-
panel: {
|
|
1077
|
-
useWrapper: false,
|
|
1078
|
-
useEditor: true,
|
|
1079
|
-
useWidgets: false
|
|
1080
|
-
},
|
|
1081
|
-
};
|
|
1082
|
-
case WIDGET_ARTICLE_BUTTON:
|
|
1083
|
-
return {
|
|
1084
|
-
label: 'WIDGET_Button',
|
|
1085
|
-
description: 'WIDGET_Button_Description',
|
|
1086
|
-
name,
|
|
1087
|
-
img: '/img/fast-intranet/widget-button.png',
|
|
1088
|
-
available: true,
|
|
1089
|
-
panel: {
|
|
1090
|
-
useWrapper: false,
|
|
1091
|
-
useEditor: true,
|
|
1092
|
-
useWidgets: false
|
|
1093
|
-
},
|
|
1094
|
-
};
|
|
1099
|
+
return widgetArticleGalleryDefinition;
|
|
1100
|
+
case 'widget-article-gallery':
|
|
1101
|
+
return widgetArticleGalleryDefinition;
|
|
1102
|
+
case 'widget-article-attachment':
|
|
1103
|
+
return widgetArticleAttachmentDefinition;
|
|
1104
|
+
case 'widget-article-text':
|
|
1105
|
+
return widgetArticleTextDefinition;
|
|
1106
|
+
case 'widget-article-title':
|
|
1107
|
+
return widgetArticleTitleDefinition;
|
|
1108
|
+
case 'widget-article-image':
|
|
1109
|
+
return widgetArticleImageDefinition;
|
|
1110
|
+
case 'widget-article-button':
|
|
1111
|
+
return widgetArticleButtonDefinition;
|
|
1095
1112
|
}
|
|
1096
1113
|
}
|
|
1097
1114
|
|
|
@@ -1100,8 +1117,12 @@ const MODE_VIEW = 'view';
|
|
|
1100
1117
|
const initialState$1 = {
|
|
1101
1118
|
token: undefined,
|
|
1102
1119
|
ids: {},
|
|
1120
|
+
layers: {},
|
|
1103
1121
|
states: {},
|
|
1104
1122
|
modal: undefined,
|
|
1123
|
+
editableMap: {},
|
|
1124
|
+
currentEditableIndex: -1,
|
|
1125
|
+
currentEditableWidgetId: undefined,
|
|
1105
1126
|
};
|
|
1106
1127
|
const widgetsSlice = createSlice({
|
|
1107
1128
|
name: 'widgets',
|
|
@@ -1110,14 +1131,15 @@ const widgetsSlice = createSlice({
|
|
|
1110
1131
|
registerWidget: (state, action) => {
|
|
1111
1132
|
const { uniqid, widget } = action.payload;
|
|
1112
1133
|
state.ids[uniqid] = widget;
|
|
1113
|
-
state.states[uniqid] = { busy: false, initialized: false, loading: false, mounted: false };
|
|
1134
|
+
state.states[uniqid] = { busy: false, initialized: false, loading: false, mounted: false, hover: false };
|
|
1114
1135
|
},
|
|
1115
1136
|
updateWidget: (state, action) => {
|
|
1116
|
-
|
|
1117
|
-
const { uniqid, content } = action.payload;
|
|
1137
|
+
const { uniqid } = action.payload;
|
|
1118
1138
|
const wrapper = Object.assign({}, state.ids[uniqid]);
|
|
1119
|
-
if (
|
|
1120
|
-
state.ids[uniqid] = Object.assign(Object.assign({},
|
|
1139
|
+
if (state.ids[uniqid] && wrapper && wrapper.widget) {
|
|
1140
|
+
state.ids[uniqid] = Object.assign(Object.assign(Object.assign({}, state.ids[uniqid]), { widget: Object.assign(Object.assign({}, wrapper.widget), { content: action.payload.override
|
|
1141
|
+
? action.payload.content
|
|
1142
|
+
: Object.assign(Object.assign(Object.assign({}, wrapper.widget.content), action.payload.content)) }) }));
|
|
1121
1143
|
}
|
|
1122
1144
|
},
|
|
1123
1145
|
flushWidget: (state, action) => {
|
|
@@ -1125,34 +1147,90 @@ const widgetsSlice = createSlice({
|
|
|
1125
1147
|
delete state.ids[uniqid];
|
|
1126
1148
|
delete state.states[uniqid];
|
|
1127
1149
|
},
|
|
1150
|
+
flushAllWidget: (state) => {
|
|
1151
|
+
state.ids = {};
|
|
1152
|
+
state.states = {};
|
|
1153
|
+
},
|
|
1128
1154
|
updateWidgetWrapper: (state, action) => {
|
|
1129
|
-
const { uniqid
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1155
|
+
const { uniqid } = action.payload;
|
|
1156
|
+
if (state.ids && state.ids[uniqid]) {
|
|
1157
|
+
state.ids[uniqid] = Object.assign(Object.assign(Object.assign({}, state.ids[uniqid]), action.payload));
|
|
1158
|
+
}
|
|
1159
|
+
},
|
|
1160
|
+
registerLayer: (state, action) => {
|
|
1161
|
+
const layerId = uniqid();
|
|
1162
|
+
const wrapper = Object.assign({}, state.ids[action.payload.uniqid]);
|
|
1163
|
+
if (wrapper && wrapper.widget) {
|
|
1164
|
+
if (state.ids[action.payload.uniqid] && wrapper.widget.layers) {
|
|
1165
|
+
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] }) }));
|
|
1134
1166
|
}
|
|
1135
1167
|
else {
|
|
1136
|
-
state.ids[uniqid] = Object.assign(Object.assign({},
|
|
1168
|
+
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] }) }));
|
|
1137
1169
|
}
|
|
1170
|
+
state.ids[action.payload.widget.widget.uniqid] = action.payload.widget;
|
|
1171
|
+
state.states[action.payload.widget.widget.uniqid] = {
|
|
1172
|
+
busy: false,
|
|
1173
|
+
initialized: false,
|
|
1174
|
+
loading: false,
|
|
1175
|
+
mounted: false,
|
|
1176
|
+
hover: false,
|
|
1177
|
+
};
|
|
1178
|
+
state.layers[layerId] = {
|
|
1179
|
+
uniqid: layerId,
|
|
1180
|
+
widgets: [action.payload.widget],
|
|
1181
|
+
title: `Layer ${layerId}`,
|
|
1182
|
+
visible: true,
|
|
1183
|
+
locked: false,
|
|
1184
|
+
position: { x: 0, y: 0 },
|
|
1185
|
+
};
|
|
1186
|
+
}
|
|
1187
|
+
},
|
|
1188
|
+
updateLayer: (state, action) => {
|
|
1189
|
+
if (state.layers[action.payload.uniqid]) {
|
|
1190
|
+
state.layers[action.payload.uniqid] = Object.assign(Object.assign(Object.assign({}, state.layers[action.payload.uniqid]), action.payload.props));
|
|
1138
1191
|
}
|
|
1139
1192
|
},
|
|
1193
|
+
flushLayer: (state, action) => {
|
|
1194
|
+
const wrapper = Object.assign({}, state.ids[action.payload.uniqid]);
|
|
1195
|
+
if (wrapper && wrapper.widget && wrapper.widget.layers) {
|
|
1196
|
+
state.ids[action.payload.uniqid] = Object.assign(Object.assign(Object.assign({}, state.ids[action.payload.uniqid]), { widget: Object.assign(Object.assign({}, wrapper.widget), { layers: [
|
|
1197
|
+
...wrapper.widget.layers.filter((layerId) => layerId !== action.payload.layerId),
|
|
1198
|
+
] }) }));
|
|
1199
|
+
delete state.layers[action.payload.layerId];
|
|
1200
|
+
}
|
|
1201
|
+
},
|
|
1202
|
+
prevEditableIndex: (state) => {
|
|
1203
|
+
const count = Object.keys(state.ids).length;
|
|
1204
|
+
state.currentEditableIndex = state.currentEditableIndex === 0 ? count - 1 : state.currentEditableIndex - 1;
|
|
1205
|
+
},
|
|
1206
|
+
nextEditableIndex: (state) => {
|
|
1207
|
+
const count = Object.keys(state.ids).length;
|
|
1208
|
+
state.currentEditableIndex = state.currentEditableIndex < count - 1 ? state.currentEditableIndex + 1 : 0;
|
|
1209
|
+
},
|
|
1210
|
+
setEditableIndex: (state, action) => {
|
|
1211
|
+
state.currentEditableIndex = action.payload.index;
|
|
1212
|
+
},
|
|
1213
|
+
setEditableWidgetId: (state, action) => {
|
|
1214
|
+
state.currentEditableWidgetId = action.payload.uniqid;
|
|
1215
|
+
},
|
|
1216
|
+
registerEditableWidget: (state, action) => {
|
|
1217
|
+
state.editableMap[action.payload.uniqid] = action.payload;
|
|
1218
|
+
},
|
|
1140
1219
|
setToken: (state, action) => {
|
|
1141
1220
|
state.token = action.payload.token;
|
|
1142
1221
|
},
|
|
1143
|
-
|
|
1222
|
+
setWidgetState: (state, action) => {
|
|
1144
1223
|
const { uniqid } = action.payload;
|
|
1145
1224
|
const widgetState = Object.assign({}, state.states[uniqid]);
|
|
1146
1225
|
if (widgetState !== undefined) {
|
|
1147
1226
|
state.states[uniqid] = Object.assign(Object.assign({}, state.states[uniqid]), action.payload);
|
|
1148
1227
|
}
|
|
1149
1228
|
},
|
|
1150
|
-
|
|
1151
|
-
const { busy, initialized, loading, mounted } = action.payload;
|
|
1229
|
+
setAllWidgetStates: (state, action) => {
|
|
1152
1230
|
Object.keys(state.states).map((key) => {
|
|
1153
1231
|
const widgetState = Object.assign({}, state.states[key]);
|
|
1154
1232
|
if (widgetState !== undefined) {
|
|
1155
|
-
state.states[key] = Object.assign(Object.assign({}, state.states[key]),
|
|
1233
|
+
state.states[key] = Object.assign(Object.assign({}, state.states[key]), action.payload);
|
|
1156
1234
|
}
|
|
1157
1235
|
});
|
|
1158
1236
|
},
|
|
@@ -1167,7 +1245,7 @@ const widgetsSlice = createSlice({
|
|
|
1167
1245
|
const selectToken = (state) => state.widgets.token;
|
|
1168
1246
|
const selectModal = (state) => state.widgets.modal;
|
|
1169
1247
|
const selectWidgets = (state) => state.widgets.ids;
|
|
1170
|
-
const selectWidgetContent = (state, uniqid) => { var _a
|
|
1248
|
+
const selectWidgetContent = (state, uniqid) => { var _a; return (_a = state.widgets.ids[uniqid]) === null || _a === void 0 ? void 0 : _a.widget.content; };
|
|
1171
1249
|
const selectWidgetState = (state, uniqid) => { var _a; return (_a = state.widgets.states[uniqid]) !== null && _a !== void 0 ? _a : undefined; };
|
|
1172
1250
|
const selectWidget = (state, uniqid) => { var _a; return (_a = state.widgets.ids[uniqid]) !== null && _a !== void 0 ? _a : undefined; };
|
|
1173
1251
|
const Widget = {
|
|
@@ -1175,7 +1253,7 @@ const Widget = {
|
|
|
1175
1253
|
factory: widgetFactory,
|
|
1176
1254
|
definition: widgetDefinition,
|
|
1177
1255
|
utils: {
|
|
1178
|
-
uniqid
|
|
1256
|
+
uniqid,
|
|
1179
1257
|
},
|
|
1180
1258
|
slice: widgetsSlice,
|
|
1181
1259
|
selectors: {
|
|
@@ -1185,7 +1263,7 @@ const Widget = {
|
|
|
1185
1263
|
selectWidgetState,
|
|
1186
1264
|
selectWidgetContent,
|
|
1187
1265
|
selectModal,
|
|
1188
|
-
}
|
|
1266
|
+
},
|
|
1189
1267
|
};
|
|
1190
1268
|
|
|
1191
1269
|
const initialState = {
|
|
@@ -1224,18 +1302,13 @@ const editorsSlice = createSlice({
|
|
|
1224
1302
|
}),
|
|
1225
1303
|
];
|
|
1226
1304
|
},
|
|
1227
|
-
updateEditor: (state, action) => {
|
|
1228
|
-
const { uniqid, content } = action.payload;
|
|
1229
|
-
state.editors = [
|
|
1230
|
-
...state.editors.map((ed) => {
|
|
1231
|
-
return ed.uniqid === uniqid ? Object.assign(Object.assign({}, ed), { content }) : ed;
|
|
1232
|
-
}),
|
|
1233
|
-
];
|
|
1234
|
-
},
|
|
1235
1305
|
flushEditor: (state, action) => {
|
|
1236
1306
|
const { uniqid } = action.payload;
|
|
1237
1307
|
state.editors = [...state.editors.filter((ed) => ed.uniqid !== uniqid)];
|
|
1238
1308
|
},
|
|
1309
|
+
flushAllEditor: (state) => {
|
|
1310
|
+
state.editors.length = 0;
|
|
1311
|
+
},
|
|
1239
1312
|
},
|
|
1240
1313
|
});
|
|
1241
1314
|
const selectEditors = (state) => state.editors.editors;
|