@guillotinaweb/react-gmi 0.29.2-alpha.2 → 0.29.2-alpha.3
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/README.md +2 -1
- package/dist/actions/copy_item.d.ts +2 -2
- package/dist/actions/move_item.d.ts +2 -2
- package/dist/actions/remove_item.d.ts +2 -2
- package/dist/components/behaviors/iattachment.d.ts +4 -2
- package/dist/components/behaviors/imultiimageorderedattachment.d.ts +3 -1
- package/dist/components/behaviors/iworkflow.d.ts +1 -1
- package/dist/components/context_toolbar.d.ts +1 -1
- package/dist/components/fields/editComponent.d.ts +5 -4
- package/dist/components/fields/editableField.d.ts +4 -2
- package/dist/components/fields/renderField.d.ts +8 -5
- package/dist/components/flash.d.ts +1 -1
- package/dist/components/index.d.ts +2 -0
- package/dist/components/input/email.d.ts +1 -1
- package/dist/components/input/form_builder.d.ts +2 -2
- package/dist/components/input/input.d.ts +1 -1
- package/dist/components/input/search_input.d.ts +1 -1
- package/dist/components/input/search_input_list.d.ts +2 -2
- package/dist/components/input/select_vocabulary.d.ts +2 -2
- package/dist/components/input/upload.d.ts +1 -2
- package/dist/components/pagination.d.ts +1 -1
- package/dist/components/panel/permissions.d.ts +1 -1
- package/dist/components/panel/permissions_prinperm.d.ts +2 -2
- package/dist/components/panel/permissions_prinrole.d.ts +1 -1
- package/dist/components/panel/permissions_roleperm.d.ts +1 -1
- package/dist/components/path.d.ts +1 -1
- package/dist/components/properties_view.d.ts +2 -2
- package/dist/components/search_labels.d.ts +1 -1
- package/dist/components/search_options_labels.d.ts +1 -1
- package/dist/components/search_vocabulary_labels.d.ts +2 -2
- package/dist/components/tabs.d.ts +4 -2
- package/dist/components/widgets/tags.d.ts +4 -1
- package/dist/contexts/index.d.ts +21 -19
- package/dist/forms/required_fields.d.ts +2 -3
- package/dist/forms/users.d.ts +1 -1
- package/dist/hooks/useClickAway.d.ts +2 -1
- package/dist/hooks/useConfig.d.ts +4 -2
- package/dist/hooks/useCrudContext.d.ts +11 -10
- package/dist/hooks/useInput.d.ts +4 -3
- package/dist/hooks/useRegistry.d.ts +29 -29
- package/dist/hooks/useSetState.d.ts +6 -1
- package/dist/hooks/useVocabulary.d.ts +1 -1
- package/dist/index.d.ts +0 -2
- package/dist/lib/auth.d.ts +14 -19
- package/dist/lib/client.d.ts +49 -36
- package/dist/lib/helpers.d.ts +10 -18
- package/dist/lib/processResponse.d.ts +9 -0
- package/dist/lib/rest.d.ts +9 -16
- package/dist/lib/utils.d.ts +3 -2
- package/dist/lib/validators.d.ts +1 -1
- package/dist/locales/generic_messages.d.ts +248 -0
- package/dist/models/index.d.ts +5 -5
- package/dist/models/sharing.d.ts +5 -5
- package/dist/react-gmi.esm.js +1215 -1041
- package/dist/react-gmi.esm.js.map +1 -1
- package/dist/react-gmi.js +1214 -1041
- package/dist/react-gmi.js.map +1 -1
- package/dist/react-gmi.modern.js +1182 -983
- package/dist/react-gmi.modern.js.map +1 -1
- package/dist/react-gmi.umd.js +1214 -1041
- package/dist/react-gmi.umd.js.map +1 -1
- package/dist/reducers/guillotina.d.ts +22 -8
- package/dist/types/global.d.ts +9 -0
- package/dist/types/guillotina.d.ts +153 -19
- package/dist/views/folder.d.ts +1 -1
- package/dist/views/groups.d.ts +1 -1
- package/dist/views/item.d.ts +1 -1
- package/dist/views/users.d.ts +1 -1
- package/package.json +2 -1
package/dist/react-gmi.umd.js
CHANGED
|
@@ -107,6 +107,97 @@
|
|
|
107
107
|
return it.next.bind(it);
|
|
108
108
|
}
|
|
109
109
|
|
|
110
|
+
var initialState = {
|
|
111
|
+
path: '',
|
|
112
|
+
loading: false,
|
|
113
|
+
context: undefined,
|
|
114
|
+
flash: {
|
|
115
|
+
message: undefined,
|
|
116
|
+
type: undefined
|
|
117
|
+
},
|
|
118
|
+
action: {
|
|
119
|
+
action: undefined,
|
|
120
|
+
params: undefined
|
|
121
|
+
},
|
|
122
|
+
permissions: [],
|
|
123
|
+
errorStatus: undefined,
|
|
124
|
+
registry: {},
|
|
125
|
+
refresh: undefined
|
|
126
|
+
};
|
|
127
|
+
var GuillotinaReducerActionTypes;
|
|
128
|
+
|
|
129
|
+
(function (GuillotinaReducerActionTypes) {
|
|
130
|
+
GuillotinaReducerActionTypes["SET_PATH"] = "SET_PATH";
|
|
131
|
+
GuillotinaReducerActionTypes["SET_CONTEXT"] = "SET_CONTEXT";
|
|
132
|
+
GuillotinaReducerActionTypes["SET_ERROR"] = "SET_ERROR";
|
|
133
|
+
GuillotinaReducerActionTypes["SET_FLASH"] = "SET_FLASH";
|
|
134
|
+
GuillotinaReducerActionTypes["CLEAR_FLASH"] = "CLEAR_FLASH";
|
|
135
|
+
GuillotinaReducerActionTypes["SET_ACTION"] = "SET_ACTION";
|
|
136
|
+
GuillotinaReducerActionTypes["CLEAR_ACTION"] = "CLEAR_ACTION";
|
|
137
|
+
GuillotinaReducerActionTypes["REFRESH"] = "REFRESH";
|
|
138
|
+
GuillotinaReducerActionTypes["APPLY"] = "APPLY";
|
|
139
|
+
})(GuillotinaReducerActionTypes || (GuillotinaReducerActionTypes = {}));
|
|
140
|
+
|
|
141
|
+
function guillotinaReducer(state, action) {
|
|
142
|
+
switch (action.type) {
|
|
143
|
+
case GuillotinaReducerActionTypes.SET_PATH:
|
|
144
|
+
return _extends({}, state, {
|
|
145
|
+
path: action.payload.path,
|
|
146
|
+
loading: true
|
|
147
|
+
});
|
|
148
|
+
|
|
149
|
+
case GuillotinaReducerActionTypes.SET_CONTEXT:
|
|
150
|
+
return _extends({}, state, action.payload, {
|
|
151
|
+
errorStatus: undefined,
|
|
152
|
+
loading: false
|
|
153
|
+
});
|
|
154
|
+
|
|
155
|
+
case GuillotinaReducerActionTypes.SET_ERROR:
|
|
156
|
+
return _extends({}, state, {
|
|
157
|
+
errorStatus: action.payload.errorStatus,
|
|
158
|
+
loading: false
|
|
159
|
+
});
|
|
160
|
+
|
|
161
|
+
case GuillotinaReducerActionTypes.SET_FLASH:
|
|
162
|
+
return _extends({}, state, action.payload);
|
|
163
|
+
|
|
164
|
+
case GuillotinaReducerActionTypes.CLEAR_FLASH:
|
|
165
|
+
return _extends({}, state, {
|
|
166
|
+
flash: {
|
|
167
|
+
message: undefined,
|
|
168
|
+
type: undefined
|
|
169
|
+
}
|
|
170
|
+
});
|
|
171
|
+
|
|
172
|
+
case GuillotinaReducerActionTypes.SET_ACTION:
|
|
173
|
+
return _extends({}, state, {
|
|
174
|
+
action: action.payload
|
|
175
|
+
});
|
|
176
|
+
|
|
177
|
+
case GuillotinaReducerActionTypes.CLEAR_ACTION:
|
|
178
|
+
return _extends({}, state, {
|
|
179
|
+
action: {
|
|
180
|
+
action: undefined,
|
|
181
|
+
params: undefined
|
|
182
|
+
}
|
|
183
|
+
});
|
|
184
|
+
|
|
185
|
+
case GuillotinaReducerActionTypes.REFRESH:
|
|
186
|
+
return _extends({}, state, {
|
|
187
|
+
refresh: Date.now(),
|
|
188
|
+
loading: !action.payload.transparent
|
|
189
|
+
});
|
|
190
|
+
|
|
191
|
+
case GuillotinaReducerActionTypes.APPLY:
|
|
192
|
+
return _extends({}, state, {
|
|
193
|
+
context: _extends({}, state.context, action.payload.context)
|
|
194
|
+
});
|
|
195
|
+
|
|
196
|
+
default:
|
|
197
|
+
return state;
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
|
|
110
201
|
var AuthContext = React.createContext({});
|
|
111
202
|
var ClientContext = React.createContext(null);
|
|
112
203
|
var Traversal = /*#__PURE__*/function () {
|
|
@@ -137,7 +228,7 @@
|
|
|
137
228
|
transparent = _ref2$transparent === void 0 ? false : _ref2$transparent;
|
|
138
229
|
|
|
139
230
|
this.dispatch({
|
|
140
|
-
type:
|
|
231
|
+
type: GuillotinaReducerActionTypes.REFRESH,
|
|
141
232
|
payload: {
|
|
142
233
|
transparent: transparent
|
|
143
234
|
}
|
|
@@ -147,14 +238,16 @@
|
|
|
147
238
|
_proto.apply = function apply(data) {
|
|
148
239
|
// apply a optimistic update to context
|
|
149
240
|
this.dispatch({
|
|
150
|
-
type:
|
|
151
|
-
payload:
|
|
241
|
+
type: GuillotinaReducerActionTypes.APPLY,
|
|
242
|
+
payload: {
|
|
243
|
+
context: data
|
|
244
|
+
}
|
|
152
245
|
});
|
|
153
246
|
};
|
|
154
247
|
|
|
155
248
|
_proto.flash = function flash(message, type) {
|
|
156
249
|
this.dispatch({
|
|
157
|
-
type:
|
|
250
|
+
type: GuillotinaReducerActionTypes.SET_FLASH,
|
|
158
251
|
payload: {
|
|
159
252
|
flash: {
|
|
160
253
|
message: message,
|
|
@@ -171,7 +264,8 @@
|
|
|
171
264
|
|
|
172
265
|
_proto.clearFlash = function clearFlash() {
|
|
173
266
|
this.dispatch({
|
|
174
|
-
type:
|
|
267
|
+
type: GuillotinaReducerActionTypes.CLEAR_FLASH,
|
|
268
|
+
payload: {}
|
|
175
269
|
});
|
|
176
270
|
};
|
|
177
271
|
|
|
@@ -181,7 +275,7 @@
|
|
|
181
275
|
}
|
|
182
276
|
|
|
183
277
|
this.dispatch({
|
|
184
|
-
type:
|
|
278
|
+
type: GuillotinaReducerActionTypes.SET_ACTION,
|
|
185
279
|
payload: {
|
|
186
280
|
action: action,
|
|
187
281
|
params: params
|
|
@@ -191,7 +285,8 @@
|
|
|
191
285
|
|
|
192
286
|
_proto.cancelAction = function cancelAction() {
|
|
193
287
|
this.dispatch({
|
|
194
|
-
type:
|
|
288
|
+
type: GuillotinaReducerActionTypes.CLEAR_ACTION,
|
|
289
|
+
payload: {}
|
|
195
290
|
});
|
|
196
291
|
};
|
|
197
292
|
|
|
@@ -228,6 +323,10 @@
|
|
|
228
323
|
}, {
|
|
229
324
|
key: "context",
|
|
230
325
|
get: function get() {
|
|
326
|
+
if (this.state.context === undefined) {
|
|
327
|
+
throw new Error('Context is not loaded');
|
|
328
|
+
}
|
|
329
|
+
|
|
231
330
|
return this.state.context;
|
|
232
331
|
}
|
|
233
332
|
}, {
|
|
@@ -250,7 +349,13 @@
|
|
|
250
349
|
});
|
|
251
350
|
}
|
|
252
351
|
function useTraversal() {
|
|
253
|
-
|
|
352
|
+
var traversal = React.useContext(TraversalContext);
|
|
353
|
+
|
|
354
|
+
if (!traversal) {
|
|
355
|
+
throw new Error('useTraversal must be used within a TraversalProvider');
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
return traversal;
|
|
254
359
|
}
|
|
255
360
|
function ClientProvider(_ref4) {
|
|
256
361
|
var children = _ref4.children,
|
|
@@ -261,7 +366,13 @@
|
|
|
261
366
|
});
|
|
262
367
|
}
|
|
263
368
|
function useGuillotinaClient() {
|
|
264
|
-
|
|
369
|
+
var client = React.useContext(ClientContext);
|
|
370
|
+
|
|
371
|
+
if (!client) {
|
|
372
|
+
throw new Error('useGuillotinaClient must be used within a ClientProvider');
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
return client;
|
|
265
376
|
}
|
|
266
377
|
|
|
267
378
|
var genericMessages = reactIntl.defineMessages({
|
|
@@ -788,7 +899,7 @@
|
|
|
788
899
|
function sleep(ms) {
|
|
789
900
|
return new Promise(function (resolve) {
|
|
790
901
|
setTimeout(function () {
|
|
791
|
-
resolve(
|
|
902
|
+
resolve();
|
|
792
903
|
}, ms);
|
|
793
904
|
});
|
|
794
905
|
}
|
|
@@ -817,8 +928,6 @@
|
|
|
817
928
|
};
|
|
818
929
|
|
|
819
930
|
var Button = function Button(_ref) {
|
|
820
|
-
var _ref2;
|
|
821
|
-
|
|
822
931
|
var children = _ref.children,
|
|
823
932
|
_ref$className = _ref.className,
|
|
824
933
|
className = _ref$className === void 0 ? 'is-primary' : _ref$className,
|
|
@@ -830,9 +939,7 @@
|
|
|
830
939
|
_ref$disabled = _ref.disabled,
|
|
831
940
|
disabled = _ref$disabled === void 0 ? false : _ref$disabled,
|
|
832
941
|
dataTest = _ref.dataTest;
|
|
833
|
-
|
|
834
|
-
var css = (_ref2 = []).concat.apply(_ref2, ['button'].concat(className.split(' ')));
|
|
835
|
-
|
|
942
|
+
var css = [].concat(className.split(' '), ['button']);
|
|
836
943
|
if (loading) css = css.concat('is-loading');
|
|
837
944
|
return jsxRuntime.jsx("p", {
|
|
838
945
|
className: "control",
|
|
@@ -847,6 +954,50 @@
|
|
|
847
954
|
});
|
|
848
955
|
};
|
|
849
956
|
|
|
957
|
+
var formatDate = function formatDate(str) {
|
|
958
|
+
var d = new Date(str);
|
|
959
|
+
var minutes = d.getMinutes() < 10 ? "0" + d.getMinutes() : d.getMinutes();
|
|
960
|
+
return d.getDate() + "/" + (d.getMonth() + 1) + "/" + d.getFullYear() + " " + d.getHours() + ":" + minutes;
|
|
961
|
+
};
|
|
962
|
+
var get = function get(obj, path, defValue) {
|
|
963
|
+
var _pathArray$reduce;
|
|
964
|
+
|
|
965
|
+
// If path is not defined or it has false value
|
|
966
|
+
if (!path) return defValue; // Check if path is string or array. Regex : ensure that we do not have '.' and brackets.
|
|
967
|
+
// Regex explained: https://regexr.com/58j0k
|
|
968
|
+
|
|
969
|
+
var pathArray = Array.isArray(path) ? path : path.match(/([^[.\]])+/g); // Find value if exist return otherwise return undefined value;
|
|
970
|
+
|
|
971
|
+
if (pathArray === null) return defValue;
|
|
972
|
+
return (_pathArray$reduce = pathArray.reduce(function (prevObj, key) {
|
|
973
|
+
return prevObj && prevObj[key];
|
|
974
|
+
}, obj)) != null ? _pathArray$reduce : defValue;
|
|
975
|
+
};
|
|
976
|
+
function getNewId(id) {
|
|
977
|
+
if (id === void 0) {
|
|
978
|
+
id = '';
|
|
979
|
+
}
|
|
980
|
+
|
|
981
|
+
var suffix = '-copy-';
|
|
982
|
+
var rgx = new RegExp("($|" + suffix + "\\d*)");
|
|
983
|
+
return stringToSlug(id).replace(rgx, function (r) {
|
|
984
|
+
var num = parseInt(r.replace(suffix, '') || '0');
|
|
985
|
+
return "" + suffix + (num + 1);
|
|
986
|
+
});
|
|
987
|
+
}
|
|
988
|
+
function debounce(callback, wait) {
|
|
989
|
+
var timer;
|
|
990
|
+
return function () {
|
|
991
|
+
var _arguments = arguments;
|
|
992
|
+
clearTimeout(timer);
|
|
993
|
+
return new Promise(function (resolve) {
|
|
994
|
+
timer = setTimeout(function () {
|
|
995
|
+
return resolve(callback.apply(void 0, [].slice.call(_arguments)));
|
|
996
|
+
}, wait);
|
|
997
|
+
});
|
|
998
|
+
};
|
|
999
|
+
}
|
|
1000
|
+
|
|
850
1001
|
function Modal(props) {
|
|
851
1002
|
var isActive = props.isActive,
|
|
852
1003
|
setActive = props.setActive,
|
|
@@ -943,7 +1094,7 @@
|
|
|
943
1094
|
}), jsxRuntime.jsxs("form", {
|
|
944
1095
|
onSubmit: function onSubmit(e) {
|
|
945
1096
|
e.preventDefault();
|
|
946
|
-
onConfirm(e.
|
|
1097
|
+
onConfirm(get(e, 'target.0.value', ''), e.target);
|
|
947
1098
|
},
|
|
948
1099
|
children: [jsxRuntime.jsx("small", {
|
|
949
1100
|
style: {
|
|
@@ -975,51 +1126,6 @@
|
|
|
975
1126
|
});
|
|
976
1127
|
}
|
|
977
1128
|
|
|
978
|
-
function useSetState(initialState) {
|
|
979
|
-
var _useState = React.useState(initialState),
|
|
980
|
-
state = _useState[0],
|
|
981
|
-
set = _useState[1];
|
|
982
|
-
|
|
983
|
-
var setState = React.useCallback(function (patch) {
|
|
984
|
-
set(function (prevState) {
|
|
985
|
-
return Object.assign({}, prevState, patch instanceof Function ? patch(prevState) : patch);
|
|
986
|
-
});
|
|
987
|
-
}, [set]);
|
|
988
|
-
return [state, setState];
|
|
989
|
-
}
|
|
990
|
-
|
|
991
|
-
function _catch(body, recover) {
|
|
992
|
-
try {
|
|
993
|
-
var result = body();
|
|
994
|
-
} catch (e) {
|
|
995
|
-
return recover(e);
|
|
996
|
-
}
|
|
997
|
-
|
|
998
|
-
if (result && result.then) {
|
|
999
|
-
return result.then(void 0, recover);
|
|
1000
|
-
}
|
|
1001
|
-
|
|
1002
|
-
return result;
|
|
1003
|
-
}
|
|
1004
|
-
|
|
1005
|
-
var initial = {
|
|
1006
|
-
loading: undefined,
|
|
1007
|
-
isError: false,
|
|
1008
|
-
errorMessage: undefined,
|
|
1009
|
-
result: undefined,
|
|
1010
|
-
response: undefined
|
|
1011
|
-
};
|
|
1012
|
-
|
|
1013
|
-
var getErrorMessage = function getErrorMessage(dataError, defaultValue) {
|
|
1014
|
-
if (dataError && dataError.details) {
|
|
1015
|
-
return dataError.details;
|
|
1016
|
-
} else if (dataError && dataError.reason) {
|
|
1017
|
-
return dataError.reason;
|
|
1018
|
-
}
|
|
1019
|
-
|
|
1020
|
-
return defaultValue;
|
|
1021
|
-
};
|
|
1022
|
-
|
|
1023
1129
|
var processResponse = function processResponse(res, ready_body) {
|
|
1024
1130
|
if (ready_body === void 0) {
|
|
1025
1131
|
ready_body = true;
|
|
@@ -1039,7 +1145,7 @@
|
|
|
1039
1145
|
return {
|
|
1040
1146
|
isError: true,
|
|
1041
1147
|
loading: false,
|
|
1042
|
-
errorMessage: getErrorMessage(_res$json2, res.status),
|
|
1148
|
+
errorMessage: getErrorMessage(_res$json2, res.status).toString(),
|
|
1043
1149
|
response: res
|
|
1044
1150
|
};
|
|
1045
1151
|
});
|
|
@@ -1048,10 +1154,66 @@
|
|
|
1048
1154
|
}
|
|
1049
1155
|
};
|
|
1050
1156
|
|
|
1051
|
-
var
|
|
1157
|
+
var getErrorMessage = function getErrorMessage(dataError, defaultValue) {
|
|
1158
|
+
if (dataError && dataError.details) {
|
|
1159
|
+
return dataError.details;
|
|
1160
|
+
} else if (dataError && dataError.reason) {
|
|
1161
|
+
return dataError.reason;
|
|
1162
|
+
}
|
|
1163
|
+
|
|
1164
|
+
return defaultValue;
|
|
1165
|
+
};
|
|
1166
|
+
|
|
1167
|
+
/**
|
|
1168
|
+
* Do setState like react class component.
|
|
1169
|
+
*/
|
|
1170
|
+
|
|
1171
|
+
function useSetState(initialState) {
|
|
1172
|
+
var _useState = React.useState(initialState),
|
|
1173
|
+
state = _useState[0],
|
|
1174
|
+
setState = _useState[1]; // Function which accepts a partial state to merge
|
|
1175
|
+
|
|
1176
|
+
|
|
1177
|
+
var setCustomState = React.useCallback(function (newPartialState) {
|
|
1178
|
+
try {
|
|
1179
|
+
setState(function (prevState) {
|
|
1180
|
+
return _extends({}, prevState, newPartialState);
|
|
1181
|
+
});
|
|
1182
|
+
} catch (error) {
|
|
1183
|
+
// eslint-disable-next-line no-console
|
|
1184
|
+
console.error(error);
|
|
1185
|
+
}
|
|
1186
|
+
}, []); // Return
|
|
1187
|
+
|
|
1188
|
+
return [state, setCustomState];
|
|
1189
|
+
} // **** Export Default **** //
|
|
1190
|
+
|
|
1191
|
+
function _catch(body, recover) {
|
|
1192
|
+
try {
|
|
1193
|
+
var result = body();
|
|
1194
|
+
} catch (e) {
|
|
1195
|
+
return recover(e);
|
|
1196
|
+
}
|
|
1197
|
+
|
|
1198
|
+
if (result && result.then) {
|
|
1199
|
+
return result.then(void 0, recover);
|
|
1200
|
+
}
|
|
1201
|
+
|
|
1202
|
+
return result;
|
|
1203
|
+
}
|
|
1204
|
+
|
|
1205
|
+
var initial = {
|
|
1206
|
+
loading: undefined,
|
|
1207
|
+
isError: false,
|
|
1208
|
+
errorMessage: undefined,
|
|
1209
|
+
result: undefined,
|
|
1210
|
+
response: undefined
|
|
1211
|
+
};
|
|
1212
|
+
|
|
1213
|
+
function patch(setState, Ctx) {
|
|
1052
1214
|
return function (data, endpoint, body) {
|
|
1053
|
-
if (
|
|
1054
|
-
|
|
1215
|
+
if (data === void 0) {
|
|
1216
|
+
data = {};
|
|
1055
1217
|
}
|
|
1056
1218
|
|
|
1057
1219
|
if (body === void 0) {
|
|
@@ -1059,7 +1221,7 @@
|
|
|
1059
1221
|
}
|
|
1060
1222
|
|
|
1061
1223
|
try {
|
|
1062
|
-
function
|
|
1224
|
+
function _temp3() {
|
|
1063
1225
|
setState(newState);
|
|
1064
1226
|
return newState;
|
|
1065
1227
|
}
|
|
@@ -1069,7 +1231,7 @@
|
|
|
1069
1231
|
});
|
|
1070
1232
|
var newState = {};
|
|
1071
1233
|
|
|
1072
|
-
var
|
|
1234
|
+
var _temp4 = _catch(function () {
|
|
1073
1235
|
var path = endpoint ? "" + Ctx.path + endpoint : Ctx.path;
|
|
1074
1236
|
return Promise.resolve(Ctx.client.patch(path, data)).then(function (res) {
|
|
1075
1237
|
return Promise.resolve(processResponse(res, body)).then(function (_processResponse) {
|
|
@@ -1084,29 +1246,25 @@
|
|
|
1084
1246
|
};
|
|
1085
1247
|
});
|
|
1086
1248
|
|
|
1087
|
-
return Promise.resolve(
|
|
1249
|
+
return Promise.resolve(_temp4 && _temp4.then ? _temp4.then(_temp3) : _temp3(_temp4));
|
|
1088
1250
|
} catch (e) {
|
|
1089
1251
|
return Promise.reject(e);
|
|
1090
1252
|
}
|
|
1091
1253
|
};
|
|
1092
|
-
}
|
|
1254
|
+
}
|
|
1093
1255
|
|
|
1094
|
-
|
|
1256
|
+
function del(setState, Ctx) {
|
|
1095
1257
|
return function (data, endpoint, body) {
|
|
1096
1258
|
if (data === void 0) {
|
|
1097
1259
|
data = {};
|
|
1098
1260
|
}
|
|
1099
1261
|
|
|
1100
|
-
if (endpoint === void 0) {
|
|
1101
|
-
endpoint = undefined;
|
|
1102
|
-
}
|
|
1103
|
-
|
|
1104
1262
|
if (body === void 0) {
|
|
1105
1263
|
body = false;
|
|
1106
1264
|
}
|
|
1107
1265
|
|
|
1108
1266
|
try {
|
|
1109
|
-
function
|
|
1267
|
+
function _temp7() {
|
|
1110
1268
|
setState(newState);
|
|
1111
1269
|
return newState;
|
|
1112
1270
|
}
|
|
@@ -1116,7 +1274,7 @@
|
|
|
1116
1274
|
});
|
|
1117
1275
|
var newState = {};
|
|
1118
1276
|
|
|
1119
|
-
var
|
|
1277
|
+
var _temp8 = _catch(function () {
|
|
1120
1278
|
var path = endpoint ? "" + Ctx.path + endpoint : Ctx.path;
|
|
1121
1279
|
return Promise.resolve(Ctx.client.delete(path, data)).then(function (res) {
|
|
1122
1280
|
return Promise.resolve(processResponse(res, body)).then(function (_processResponse2) {
|
|
@@ -1131,17 +1289,17 @@
|
|
|
1131
1289
|
};
|
|
1132
1290
|
});
|
|
1133
1291
|
|
|
1134
|
-
return Promise.resolve(
|
|
1292
|
+
return Promise.resolve(_temp8 && _temp8.then ? _temp8.then(_temp7) : _temp7(_temp8));
|
|
1135
1293
|
} catch (e) {
|
|
1136
1294
|
return Promise.reject(e);
|
|
1137
1295
|
}
|
|
1138
1296
|
};
|
|
1139
|
-
}
|
|
1297
|
+
}
|
|
1140
1298
|
|
|
1141
|
-
|
|
1299
|
+
function post(setState, Ctx) {
|
|
1142
1300
|
return function (data, endpoint, body) {
|
|
1143
|
-
if (
|
|
1144
|
-
|
|
1301
|
+
if (data === void 0) {
|
|
1302
|
+
data = {};
|
|
1145
1303
|
}
|
|
1146
1304
|
|
|
1147
1305
|
if (body === void 0) {
|
|
@@ -1149,7 +1307,7 @@
|
|
|
1149
1307
|
}
|
|
1150
1308
|
|
|
1151
1309
|
try {
|
|
1152
|
-
function
|
|
1310
|
+
function _temp11() {
|
|
1153
1311
|
setState(newState);
|
|
1154
1312
|
return newState;
|
|
1155
1313
|
}
|
|
@@ -1159,7 +1317,7 @@
|
|
|
1159
1317
|
});
|
|
1160
1318
|
var newState = {};
|
|
1161
1319
|
|
|
1162
|
-
var
|
|
1320
|
+
var _temp12 = _catch(function () {
|
|
1163
1321
|
var path = endpoint ? "" + Ctx.path + endpoint : Ctx.path;
|
|
1164
1322
|
return Promise.resolve(Ctx.client.post(path, data)).then(function (res) {
|
|
1165
1323
|
return Promise.resolve(processResponse(res, body)).then(function (_processResponse3) {
|
|
@@ -1174,21 +1332,17 @@
|
|
|
1174
1332
|
};
|
|
1175
1333
|
});
|
|
1176
1334
|
|
|
1177
|
-
return Promise.resolve(
|
|
1335
|
+
return Promise.resolve(_temp12 && _temp12.then ? _temp12.then(_temp11) : _temp11(_temp12));
|
|
1178
1336
|
} catch (e) {
|
|
1179
1337
|
return Promise.reject(e);
|
|
1180
1338
|
}
|
|
1181
1339
|
};
|
|
1182
|
-
}
|
|
1340
|
+
}
|
|
1183
1341
|
|
|
1184
|
-
|
|
1342
|
+
function get$1(setState, Ctx) {
|
|
1185
1343
|
return function (endpoint) {
|
|
1186
|
-
if (endpoint === void 0) {
|
|
1187
|
-
endpoint = undefined;
|
|
1188
|
-
}
|
|
1189
|
-
|
|
1190
1344
|
try {
|
|
1191
|
-
function
|
|
1345
|
+
function _temp15() {
|
|
1192
1346
|
setState(newState);
|
|
1193
1347
|
return newState;
|
|
1194
1348
|
}
|
|
@@ -1198,7 +1352,7 @@
|
|
|
1198
1352
|
});
|
|
1199
1353
|
var newState = {};
|
|
1200
1354
|
|
|
1201
|
-
var
|
|
1355
|
+
var _temp16 = _catch(function () {
|
|
1202
1356
|
var path = endpoint ? "" + Ctx.path + endpoint : Ctx.path;
|
|
1203
1357
|
return Promise.resolve(Ctx.client.get(path)).then(function (res) {
|
|
1204
1358
|
return Promise.resolve(processResponse(res, true)).then(function (_processResponse4) {
|
|
@@ -1213,12 +1367,16 @@
|
|
|
1213
1367
|
};
|
|
1214
1368
|
});
|
|
1215
1369
|
|
|
1216
|
-
return Promise.resolve(
|
|
1370
|
+
return Promise.resolve(_temp16 && _temp16.then ? _temp16.then(_temp15) : _temp15(_temp16));
|
|
1217
1371
|
} catch (e) {
|
|
1218
1372
|
return Promise.reject(e);
|
|
1219
1373
|
}
|
|
1220
1374
|
};
|
|
1221
|
-
}
|
|
1375
|
+
} // const get = (
|
|
1376
|
+
// setState: (value: Partial<State>) => void,
|
|
1377
|
+
// Ctx: Traversal
|
|
1378
|
+
// ) =>
|
|
1379
|
+
|
|
1222
1380
|
|
|
1223
1381
|
function useCrudContext() {
|
|
1224
1382
|
var Ctx = useTraversal();
|
|
@@ -1232,7 +1390,7 @@
|
|
|
1232
1390
|
patch: patch(setState, Ctx),
|
|
1233
1391
|
del: del(setState, Ctx),
|
|
1234
1392
|
post: post(setState, Ctx),
|
|
1235
|
-
get: get(setState, Ctx)
|
|
1393
|
+
get: get$1(setState, Ctx)
|
|
1236
1394
|
});
|
|
1237
1395
|
}
|
|
1238
1396
|
|
|
@@ -1280,9 +1438,6 @@
|
|
|
1280
1438
|
children: jsxRuntime.jsx(Form, {
|
|
1281
1439
|
loading: loading,
|
|
1282
1440
|
onSubmit: doSubmit,
|
|
1283
|
-
onError: function onError(err) {
|
|
1284
|
-
return console.log(err);
|
|
1285
|
-
},
|
|
1286
1441
|
actionName: 'Add ' + type,
|
|
1287
1442
|
title: 'Add ' + type,
|
|
1288
1443
|
type: type,
|
|
@@ -1292,7 +1447,7 @@
|
|
|
1292
1447
|
}
|
|
1293
1448
|
|
|
1294
1449
|
var Permissions = ['guillotina.AddContent', 'guillotina.ModifyContent', 'guillotina.ViewContent', 'guillotina.DeleteContent', 'guillotina.AccessContent', 'guillotina.SeePermissions', 'guillotina.ChangePermissions', 'guillotina.MoveContent', 'guillotina.DuplicateContent', 'guillotina.ReadConfiguration', 'guillotina.RegisterConfigurations', 'guillotina.WriteConfiguration', 'guillotina.ManageAddons', 'guillotina.swagger.View'];
|
|
1295
|
-
var
|
|
1450
|
+
var defaultConfig = {
|
|
1296
1451
|
DisabledTypes: ['UserManager', 'GroupManager'],
|
|
1297
1452
|
PageSize: 10,
|
|
1298
1453
|
DelayActions: 200,
|
|
@@ -1303,21 +1458,41 @@
|
|
|
1303
1458
|
return (schema == null ? void 0 : schema.widget) === 'file' || (schema == null ? void 0 : schema.widget) === 'select' || (schema == null ? void 0 : schema.type) === 'array';
|
|
1304
1459
|
}
|
|
1305
1460
|
};
|
|
1306
|
-
var calculated = Object.assign({},
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
var
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1461
|
+
var calculated = Object.assign({}, defaultConfig);
|
|
1462
|
+
|
|
1463
|
+
function addConfig(updates, currentConfig) {
|
|
1464
|
+
var updatedConfig = _extends({}, currentConfig);
|
|
1465
|
+
|
|
1466
|
+
Object.entries(updates).forEach(function (_ref) {
|
|
1467
|
+
var key = _ref[0],
|
|
1468
|
+
value = _ref[1];
|
|
1469
|
+
var currentKey = key;
|
|
1470
|
+
var currentValue = currentConfig[currentKey];
|
|
1471
|
+
|
|
1472
|
+
if (Array.isArray(value) && Array.isArray(currentValue)) {
|
|
1473
|
+
var _extends2;
|
|
1474
|
+
|
|
1475
|
+
// Correctly type the array concatenation
|
|
1476
|
+
updatedConfig = _extends({}, updatedConfig, (_extends2 = {}, _extends2[currentKey] = [].concat(currentValue, value), _extends2));
|
|
1477
|
+
} else if (isPlainObject(value) && isPlainObject(currentValue)) {
|
|
1478
|
+
var _extends3;
|
|
1479
|
+
|
|
1480
|
+
// Correctly type the object merging
|
|
1481
|
+
updatedConfig = _extends({}, updatedConfig, (_extends3 = {}, _extends3[currentKey] = _extends({}, currentValue, value), _extends3));
|
|
1315
1482
|
} else {
|
|
1316
|
-
|
|
1483
|
+
var _extends4;
|
|
1484
|
+
|
|
1485
|
+
// Directly assign all other types
|
|
1486
|
+
updatedConfig = _extends({}, updatedConfig, (_extends4 = {}, _extends4[currentKey] = value, _extends4));
|
|
1317
1487
|
}
|
|
1318
1488
|
});
|
|
1319
|
-
return
|
|
1320
|
-
}
|
|
1489
|
+
return updatedConfig;
|
|
1490
|
+
} // Helper function to check if a value is a plain object (and not a React node, etc.)
|
|
1491
|
+
|
|
1492
|
+
|
|
1493
|
+
function isPlainObject(value) {
|
|
1494
|
+
return Object.prototype.toString.call(value) === '[object Object]';
|
|
1495
|
+
}
|
|
1321
1496
|
|
|
1322
1497
|
function useConfig(cfg) {
|
|
1323
1498
|
if (cfg === void 0) {
|
|
@@ -1341,7 +1516,7 @@
|
|
|
1341
1516
|
setLoading(true);
|
|
1342
1517
|
var actions = items.map(function (item) {
|
|
1343
1518
|
try {
|
|
1344
|
-
return Promise.resolve(Ctx.client.delete("" + Ctx.path + item
|
|
1519
|
+
return Promise.resolve(Ctx.client.delete("" + Ctx.path + item.id, {})).then(function (res) {
|
|
1345
1520
|
var _temp = function () {
|
|
1346
1521
|
if (!res.ok) {
|
|
1347
1522
|
return Promise.resolve(res.json()).then(function (err) {
|
|
@@ -1387,9 +1562,9 @@
|
|
|
1387
1562
|
|
|
1388
1563
|
var _props$items = props.items,
|
|
1389
1564
|
items = _props$items === void 0 ? [] : _props$items;
|
|
1390
|
-
var last = items[items.length - 1]
|
|
1565
|
+
var last = items[items.length - 1].id;
|
|
1391
1566
|
var itemsNames = items.map(function (item) {
|
|
1392
|
-
return item
|
|
1567
|
+
return item.id;
|
|
1393
1568
|
}).join(', ').replace(", " + last, " and " + last);
|
|
1394
1569
|
return jsxRuntime.jsx(Confirm, {
|
|
1395
1570
|
loading: loading,
|
|
@@ -1416,7 +1591,7 @@
|
|
|
1416
1591
|
dataTest = _ref.dataTest;
|
|
1417
1592
|
var inputRef = React.useRef(null);
|
|
1418
1593
|
|
|
1419
|
-
var _useState = React.useState(checked),
|
|
1594
|
+
var _useState = React.useState(!!checked),
|
|
1420
1595
|
state = _useState[0],
|
|
1421
1596
|
setState = _useState[1];
|
|
1422
1597
|
|
|
@@ -1435,13 +1610,13 @@
|
|
|
1435
1610
|
className: "field",
|
|
1436
1611
|
children: jsxRuntime.jsxs("label", {
|
|
1437
1612
|
htmlFor: id,
|
|
1438
|
-
className: classnames(['checkbox', className]),
|
|
1613
|
+
className: classnames(['checkbox', className != null ? className : '']),
|
|
1439
1614
|
children: [jsxRuntime.jsx("input", {
|
|
1440
1615
|
ref: inputRef,
|
|
1441
1616
|
disabled: disabled || loading,
|
|
1442
1617
|
id: id,
|
|
1443
1618
|
type: "checkbox",
|
|
1444
|
-
className: classnames(['checkbox', classNameInput]),
|
|
1619
|
+
className: classnames(['checkbox', classNameInput != null ? classNameInput : '']),
|
|
1445
1620
|
checked: state,
|
|
1446
1621
|
onChange: updateState,
|
|
1447
1622
|
"data-test": dataTest
|
|
@@ -1479,7 +1654,7 @@
|
|
|
1479
1654
|
return result;
|
|
1480
1655
|
};
|
|
1481
1656
|
|
|
1482
|
-
var useInput = function useInput(onChange, value,
|
|
1657
|
+
var useInput = function useInput(onChange, value, validators) {
|
|
1483
1658
|
var _useState = React.useState({
|
|
1484
1659
|
hasError: false,
|
|
1485
1660
|
value: value
|
|
@@ -1488,7 +1663,7 @@
|
|
|
1488
1663
|
setState = _useState[1];
|
|
1489
1664
|
|
|
1490
1665
|
var onUpdate = function onUpdate(ev) {
|
|
1491
|
-
var value = ev && ev.target ? ev.target.value :
|
|
1666
|
+
var value = ev && ev.target ? ev.target.value : '';
|
|
1492
1667
|
setState({
|
|
1493
1668
|
value: value,
|
|
1494
1669
|
hasError: false
|
|
@@ -1497,7 +1672,7 @@
|
|
|
1497
1672
|
};
|
|
1498
1673
|
|
|
1499
1674
|
var onBlur = function onBlur() {
|
|
1500
|
-
var hasError = applyValidators(state.value,
|
|
1675
|
+
var hasError = applyValidators(state.value, validators) === false;
|
|
1501
1676
|
if (hasError) setState({
|
|
1502
1677
|
value: state.value,
|
|
1503
1678
|
hasError: hasError
|
|
@@ -1630,10 +1805,10 @@
|
|
|
1630
1805
|
dataTest = _ref$dataTest === void 0 ? 'testInput' : _ref$dataTest,
|
|
1631
1806
|
disabled = _ref.disabled,
|
|
1632
1807
|
onKeyUp = _ref.onKeyUp;
|
|
1633
|
-
var validatorFn =
|
|
1808
|
+
var validatorFn = [];
|
|
1634
1809
|
|
|
1635
1810
|
if (required) {
|
|
1636
|
-
validatorFn = Array.isArray(validator) ?
|
|
1811
|
+
validatorFn = Array.isArray(validator) ? [].concat(validator, [notEmpty]) : [validator, notEmpty];
|
|
1637
1812
|
}
|
|
1638
1813
|
|
|
1639
1814
|
var _useInput = useInput(onChange, value != null ? value : '', validatorFn),
|
|
@@ -1648,15 +1823,15 @@
|
|
|
1648
1823
|
setMounted = _useState2[1]; // eslint-disable-next-line
|
|
1649
1824
|
|
|
1650
1825
|
|
|
1651
|
-
|
|
1826
|
+
var newRef = ref || React.useRef();
|
|
1652
1827
|
React.useEffect(function () {
|
|
1653
1828
|
setMounted(true);
|
|
1654
1829
|
}, []);
|
|
1655
1830
|
React.useEffect(function () {
|
|
1656
|
-
if (autofocus && !error &&
|
|
1657
|
-
|
|
1831
|
+
if (autofocus && !error && newRef != null && typeof newRef !== 'function' && newRef.current) {
|
|
1832
|
+
newRef.current.focus();
|
|
1658
1833
|
}
|
|
1659
|
-
}, [mounted, autofocus,
|
|
1834
|
+
}, [mounted, autofocus, newRef, error]);
|
|
1660
1835
|
var theError = state.hasError ? errorMessage || 'invalid field' : '';
|
|
1661
1836
|
var statusClasses = state.hasError ? 'is-danger' : '';
|
|
1662
1837
|
|
|
@@ -1697,7 +1872,8 @@
|
|
|
1697
1872
|
|
|
1698
1873
|
var Icon = function Icon(_ref) {
|
|
1699
1874
|
var icon = _ref.icon,
|
|
1700
|
-
className = _ref.className,
|
|
1875
|
+
_ref$className = _ref.className,
|
|
1876
|
+
className = _ref$className === void 0 ? '' : _ref$className,
|
|
1701
1877
|
align = _ref.align;
|
|
1702
1878
|
var addClass = className ? className.split(' ') : [className];
|
|
1703
1879
|
align = align || 'is-right';
|
|
@@ -1808,7 +1984,7 @@
|
|
|
1808
1984
|
remotes = _ref$remotes === void 0 ? {} : _ref$remotes,
|
|
1809
1985
|
_ref$submitButton = _ref.submitButton,
|
|
1810
1986
|
submitButton = _ref$submitButton === void 0 ? true : _ref$submitButton;
|
|
1811
|
-
var ref = React.useRef();
|
|
1987
|
+
var ref = React.useRef(null);
|
|
1812
1988
|
var properties = schema.properties,
|
|
1813
1989
|
required = schema.required;
|
|
1814
1990
|
var values = Object.assign({}, formData || {}); // build initial state
|
|
@@ -1821,7 +1997,7 @@
|
|
|
1821
1997
|
initialState[element] = values[element] || undefined;
|
|
1822
1998
|
}); // Register remotes
|
|
1823
1999
|
|
|
1824
|
-
if (
|
|
2000
|
+
if (ref.current === null) {
|
|
1825
2001
|
ref.current = {};
|
|
1826
2002
|
Object.keys(remotes).forEach(function (item) {
|
|
1827
2003
|
return ref.current[item] = remotes[item];
|
|
@@ -1838,15 +2014,16 @@
|
|
|
1838
2014
|
ref.current = ref.current || {};
|
|
1839
2015
|
|
|
1840
2016
|
var onUpdate = function onUpdate(field) {
|
|
1841
|
-
return function (
|
|
1842
|
-
ref.current[field] =
|
|
2017
|
+
return function (value) {
|
|
2018
|
+
ref.current[field] = value;
|
|
1843
2019
|
};
|
|
1844
2020
|
};
|
|
1845
2021
|
|
|
1846
2022
|
var GetTag = function GetTag(_ref2) {
|
|
1847
2023
|
var field = _ref2.field;
|
|
1848
2024
|
var property = properties[field];
|
|
1849
|
-
var
|
|
2025
|
+
var key = property.widget || property.type;
|
|
2026
|
+
var Tag = formComponents[key];
|
|
1850
2027
|
var props = {
|
|
1851
2028
|
value: initialState[field],
|
|
1852
2029
|
onChange: onUpdate(field),
|
|
@@ -1861,7 +2038,6 @@
|
|
|
1861
2038
|
props.placeholder += ' *';
|
|
1862
2039
|
}
|
|
1863
2040
|
|
|
1864
|
-
Tag.displayName = field + "Field";
|
|
1865
2041
|
return jsxRuntime.jsx(Tag, _extends({}, props));
|
|
1866
2042
|
};
|
|
1867
2043
|
|
|
@@ -1930,9 +2106,13 @@
|
|
|
1930
2106
|
selectValue = selectValue.concat([ev.target.selectedOptions[i].value]);
|
|
1931
2107
|
}
|
|
1932
2108
|
|
|
1933
|
-
onChange
|
|
2109
|
+
if (onChange) {
|
|
2110
|
+
onChange(selectValue);
|
|
2111
|
+
}
|
|
1934
2112
|
} else {
|
|
1935
|
-
onChange
|
|
2113
|
+
if (onChange) {
|
|
2114
|
+
onChange(ev.target.value);
|
|
2115
|
+
}
|
|
1936
2116
|
}
|
|
1937
2117
|
};
|
|
1938
2118
|
|
|
@@ -1981,19 +2161,151 @@
|
|
|
1981
2161
|
});
|
|
1982
2162
|
Select.displayName = 'Select';
|
|
1983
2163
|
|
|
1984
|
-
|
|
2164
|
+
function _catch$1(body, recover) {
|
|
2165
|
+
try {
|
|
2166
|
+
var result = body();
|
|
2167
|
+
} catch (e) {
|
|
2168
|
+
return recover(e);
|
|
2169
|
+
}
|
|
1985
2170
|
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
|
|
2171
|
+
if (result && result.then) {
|
|
2172
|
+
return result.then(void 0, recover);
|
|
2173
|
+
}
|
|
1989
2174
|
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
2175
|
+
return result;
|
|
2176
|
+
}
|
|
2177
|
+
|
|
2178
|
+
function useVocabulary(vocabularyName, path) {
|
|
2179
|
+
var traversal = useTraversal();
|
|
2180
|
+
|
|
2181
|
+
var _useSetState = useSetState({
|
|
2182
|
+
data: undefined,
|
|
2183
|
+
loading: false,
|
|
2184
|
+
error: undefined
|
|
2185
|
+
}),
|
|
2186
|
+
vocabulary = _useSetState[0],
|
|
2187
|
+
setVocabulary = _useSetState[1];
|
|
2188
|
+
|
|
2189
|
+
var getPath = function getPath() {
|
|
2190
|
+
if (path) return path;
|
|
2191
|
+
return traversal.path + "@vocabularies/" + vocabularyName;
|
|
2192
|
+
};
|
|
2193
|
+
|
|
2194
|
+
React.useEffect(function () {
|
|
2195
|
+
var getVocabulary = function getVocabulary() {
|
|
2196
|
+
try {
|
|
2197
|
+
var _temp3 = function () {
|
|
2198
|
+
if (vocabularyName && vocabulary.data === undefined && !vocabulary.loading) {
|
|
2199
|
+
var _temp4 = _catch$1(function () {
|
|
2200
|
+
setVocabulary({
|
|
2201
|
+
loading: true
|
|
2202
|
+
});
|
|
2203
|
+
return Promise.resolve(traversal.client.get(getPath())).then(function (data) {
|
|
2204
|
+
return Promise.resolve(data.json()).then(function (dataJson) {
|
|
2205
|
+
setVocabulary({
|
|
2206
|
+
loading: false,
|
|
2207
|
+
data: dataJson
|
|
2208
|
+
});
|
|
2209
|
+
});
|
|
2210
|
+
});
|
|
2211
|
+
}, function (err) {
|
|
2212
|
+
setVocabulary({
|
|
2213
|
+
loading: false,
|
|
2214
|
+
error: err,
|
|
2215
|
+
data: undefined
|
|
2216
|
+
});
|
|
2217
|
+
});
|
|
2218
|
+
|
|
2219
|
+
if (_temp4 && _temp4.then) return _temp4.then(function () {});
|
|
2220
|
+
}
|
|
2221
|
+
}();
|
|
2222
|
+
|
|
2223
|
+
return Promise.resolve(_temp3 && _temp3.then ? _temp3.then(function () {}) : void 0);
|
|
2224
|
+
} catch (e) {
|
|
2225
|
+
return Promise.reject(e);
|
|
2226
|
+
}
|
|
2227
|
+
};
|
|
2228
|
+
|
|
2229
|
+
getVocabulary();
|
|
2230
|
+
}, [vocabularyName, vocabulary, path]);
|
|
2231
|
+
return vocabulary;
|
|
2232
|
+
}
|
|
2233
|
+
|
|
2234
|
+
var SelectVocabulary = React.forwardRef(function (_ref, ref) {
|
|
2235
|
+
var vocabularyName = _ref.vocabularyName,
|
|
2236
|
+
className = _ref.className,
|
|
2237
|
+
classWrap = _ref.classWrap,
|
|
2238
|
+
val = _ref.val,
|
|
2239
|
+
dataTest = _ref.dataTest,
|
|
2240
|
+
multiple = _ref.multiple,
|
|
2241
|
+
onChange = _ref.onChange,
|
|
2242
|
+
id = _ref.id,
|
|
2243
|
+
placeholder = _ref.placeholder;
|
|
2244
|
+
var vocabulary = useVocabulary(vocabularyName);
|
|
2245
|
+
|
|
2246
|
+
var getOptions = function getOptions() {
|
|
2247
|
+
if (get(vocabulary, 'data.items', null)) {
|
|
2248
|
+
var _vocabulary$data$item, _vocabulary$data;
|
|
2249
|
+
|
|
2250
|
+
var vocData = ((_vocabulary$data$item = vocabulary == null ? void 0 : (_vocabulary$data = vocabulary.data) == null ? void 0 : _vocabulary$data.items) != null ? _vocabulary$data$item : []).map(function (item) {
|
|
2251
|
+
return {
|
|
2252
|
+
text: item.title,
|
|
2253
|
+
value: item.token
|
|
2254
|
+
};
|
|
2255
|
+
});
|
|
2256
|
+
return vocData;
|
|
2257
|
+
}
|
|
2258
|
+
|
|
2259
|
+
return [];
|
|
2260
|
+
};
|
|
2261
|
+
|
|
2262
|
+
var getProps = function getProps() {
|
|
2263
|
+
if (multiple) {
|
|
2264
|
+
var currentValue = val || [];
|
|
2265
|
+
return {
|
|
2266
|
+
multiple: true,
|
|
2267
|
+
size: 5,
|
|
2268
|
+
value: currentValue,
|
|
2269
|
+
options: getOptions()
|
|
2270
|
+
};
|
|
2271
|
+
}
|
|
2272
|
+
|
|
2273
|
+
return {
|
|
2274
|
+
value: val != null ? val : '',
|
|
2275
|
+
appendDefault: true,
|
|
2276
|
+
options: getOptions()
|
|
2277
|
+
};
|
|
2278
|
+
};
|
|
2279
|
+
|
|
2280
|
+
if (vocabulary.data === undefined || vocabulary.loading) {
|
|
2281
|
+
return jsxRuntime.jsx("div", {});
|
|
2282
|
+
}
|
|
2283
|
+
|
|
2284
|
+
return jsxRuntime.jsx(Select, _extends({}, getProps(), {
|
|
2285
|
+
className: className,
|
|
2286
|
+
classWrap: classWrap || 'is-fullwidth',
|
|
2287
|
+
dataTest: dataTest,
|
|
2288
|
+
ref: ref,
|
|
2289
|
+
onChange: onChange,
|
|
2290
|
+
id: id,
|
|
2291
|
+
placeholder: placeholder
|
|
2292
|
+
}));
|
|
2293
|
+
});
|
|
2294
|
+
SelectVocabulary.displayName = 'SelectVocabulary';
|
|
2295
|
+
|
|
2296
|
+
// https://github.com/molefrog/wouter
|
|
2297
|
+
|
|
2298
|
+
var setURLParams = function setURLParams(p) {
|
|
2299
|
+
return window.history.pushState(0, '0', '' + '?' + p.toString().replace(/%2F/g, '/'));
|
|
2300
|
+
};
|
|
2301
|
+
|
|
2302
|
+
var clean = function clean(to) {
|
|
2303
|
+
var current = new URLSearchParams();
|
|
2304
|
+
Object.keys(to).forEach(function (_key) {
|
|
2305
|
+
return current.set(_key, to[_key]);
|
|
2306
|
+
});
|
|
2307
|
+
setURLParams(current);
|
|
2308
|
+
};
|
|
1997
2309
|
|
|
1998
2310
|
var useLocation = function useLocation() {
|
|
1999
2311
|
var _useState = React.useState(currentSearchParams()),
|
|
@@ -2059,19 +2371,30 @@
|
|
|
2059
2371
|
|
|
2060
2372
|
var patchHistoryEvents = function patchHistoryEvents() {
|
|
2061
2373
|
if (patched) return;
|
|
2062
|
-
|
|
2063
|
-
var original = window.history[type];
|
|
2374
|
+
var originalPushState = window.history.pushState;
|
|
2064
2375
|
|
|
2065
|
-
|
|
2066
|
-
|
|
2067
|
-
|
|
2376
|
+
window.history.pushState = function () {
|
|
2377
|
+
var args = [].slice.call(arguments);
|
|
2378
|
+
var result = originalPushState.apply(this, args); // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2379
|
+
|
|
2380
|
+
var event = new Event('pushState');
|
|
2381
|
+
event.arguments = args;
|
|
2382
|
+
dispatchEvent(event);
|
|
2383
|
+
return result;
|
|
2384
|
+
};
|
|
2385
|
+
|
|
2386
|
+
var originalReplaceState = window.history.replaceState;
|
|
2387
|
+
|
|
2388
|
+
window.history.replaceState = function () {
|
|
2389
|
+
var args = [].slice.call(arguments);
|
|
2390
|
+
var result = originalReplaceState.apply(this, args); // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2391
|
+
|
|
2392
|
+
var event = new Event('replaceState');
|
|
2393
|
+
event.arguments = args;
|
|
2394
|
+
dispatchEvent(event);
|
|
2395
|
+
return result;
|
|
2396
|
+
};
|
|
2068
2397
|
|
|
2069
|
-
var event = new Event(type);
|
|
2070
|
-
event.arguments = args;
|
|
2071
|
-
dispatchEvent(event);
|
|
2072
|
-
return result;
|
|
2073
|
-
};
|
|
2074
|
-
});
|
|
2075
2398
|
return patched = 1;
|
|
2076
2399
|
};
|
|
2077
2400
|
|
|
@@ -2126,7 +2449,7 @@
|
|
|
2126
2449
|
children = _ref.children,
|
|
2127
2450
|
_ref$style = _ref.style,
|
|
2128
2451
|
style = _ref$style === void 0 ? {} : _ref$style;
|
|
2129
|
-
var link = React.useRef();
|
|
2452
|
+
var link = React.useRef(null);
|
|
2130
2453
|
|
|
2131
2454
|
function onClick() {
|
|
2132
2455
|
if (link && link.current) {
|
|
@@ -2233,15 +2556,7 @@
|
|
|
2233
2556
|
|
|
2234
2557
|
var _proto = RestClient.prototype;
|
|
2235
2558
|
|
|
2236
|
-
_proto.request = function request(path, data, headers) {
|
|
2237
|
-
if (data === void 0) {
|
|
2238
|
-
data = undefined;
|
|
2239
|
-
}
|
|
2240
|
-
|
|
2241
|
-
if (headers === void 0) {
|
|
2242
|
-
headers = undefined;
|
|
2243
|
-
}
|
|
2244
|
-
|
|
2559
|
+
_proto.request = function request(path, data, headers, signal) {
|
|
2245
2560
|
try {
|
|
2246
2561
|
var _this2 = this;
|
|
2247
2562
|
|
|
@@ -2257,9 +2572,18 @@
|
|
|
2257
2572
|
path = "/" + path;
|
|
2258
2573
|
}
|
|
2259
2574
|
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
|
|
2575
|
+
var dataRequest = data || {};
|
|
2576
|
+
dataRequest.headers = _this2.getHeaders();
|
|
2577
|
+
|
|
2578
|
+
if (headers) {
|
|
2579
|
+
dataRequest.headers = _extends({}, dataRequest.headers, headers);
|
|
2580
|
+
}
|
|
2581
|
+
|
|
2582
|
+
if (signal) {
|
|
2583
|
+
dataRequest.signal = signal;
|
|
2584
|
+
}
|
|
2585
|
+
|
|
2586
|
+
return Promise.resolve(fetch("" + _this2.url + path, dataRequest));
|
|
2263
2587
|
} catch (e) {
|
|
2264
2588
|
return Promise.reject(e);
|
|
2265
2589
|
}
|
|
@@ -2267,12 +2591,12 @@
|
|
|
2267
2591
|
|
|
2268
2592
|
_proto.getHeaders = function getHeaders() {
|
|
2269
2593
|
var authToken = this.auth.getToken();
|
|
2270
|
-
|
|
2271
|
-
return
|
|
2272
|
-
|
|
2273
|
-
|
|
2274
|
-
|
|
2275
|
-
|
|
2594
|
+
var headersInit = {};
|
|
2595
|
+
if (!authToken) return headersInit;
|
|
2596
|
+
headersInit.Accept = 'application/json';
|
|
2597
|
+
headersInit['Content-Type'] = 'application/json';
|
|
2598
|
+
headersInit.Authorization = 'Bearer ' + authToken;
|
|
2599
|
+
return headersInit;
|
|
2276
2600
|
};
|
|
2277
2601
|
|
|
2278
2602
|
_proto.post = function post(path, data) {
|
|
@@ -2288,11 +2612,11 @@
|
|
|
2288
2612
|
}
|
|
2289
2613
|
};
|
|
2290
2614
|
|
|
2291
|
-
_proto.get = function get(path) {
|
|
2615
|
+
_proto.get = function get(path, signal) {
|
|
2292
2616
|
try {
|
|
2293
2617
|
var _this6 = this;
|
|
2294
2618
|
|
|
2295
|
-
return Promise.resolve(_this6.request(path));
|
|
2619
|
+
return Promise.resolve(_this6.request(path, undefined, undefined, signal));
|
|
2296
2620
|
} catch (e) {
|
|
2297
2621
|
return Promise.reject(e);
|
|
2298
2622
|
}
|
|
@@ -2330,24 +2654,20 @@
|
|
|
2330
2654
|
|
|
2331
2655
|
var headers = _this12.getHeaders();
|
|
2332
2656
|
|
|
2333
|
-
|
|
2334
|
-
|
|
2335
|
-
|
|
2336
|
-
|
|
2657
|
+
var newHeaders = {};
|
|
2658
|
+
newHeaders['Content-Type'] = data['content-type'];
|
|
2659
|
+
newHeaders['X-UPLOAD-FILENAME'] = data.filename;
|
|
2660
|
+
newHeaders['Content-Encoding'] = 'base64';
|
|
2337
2661
|
return Promise.resolve(_this12.request(path, {
|
|
2338
2662
|
method: 'PATCH',
|
|
2339
2663
|
body: data.data
|
|
2340
|
-
}, headers));
|
|
2664
|
+
}, _extends({}, headers, newHeaders)));
|
|
2341
2665
|
} catch (e) {
|
|
2342
2666
|
return Promise.reject(e);
|
|
2343
2667
|
}
|
|
2344
2668
|
};
|
|
2345
2669
|
|
|
2346
2670
|
_proto.delete = function _delete(path, data) {
|
|
2347
|
-
if (data === void 0) {
|
|
2348
|
-
data = undefined;
|
|
2349
|
-
}
|
|
2350
|
-
|
|
2351
2671
|
try {
|
|
2352
2672
|
var _this14 = this;
|
|
2353
2673
|
|
|
@@ -2488,6 +2808,14 @@
|
|
|
2488
2808
|
}
|
|
2489
2809
|
};
|
|
2490
2810
|
|
|
2811
|
+
_proto.getQueryParamsSearchFunction = function getQueryParamsSearchFunction(name) {
|
|
2812
|
+
if (name === 'getQueryParamsElasticsearch') {
|
|
2813
|
+
return this.getQueryParamsElasticsearch;
|
|
2814
|
+
}
|
|
2815
|
+
|
|
2816
|
+
return this.getQueryParamsPostresql;
|
|
2817
|
+
};
|
|
2818
|
+
|
|
2491
2819
|
_proto.getQueryParamsPostresql = function getQueryParamsPostresql(_ref) {
|
|
2492
2820
|
var _ref$start = _ref.start,
|
|
2493
2821
|
start = _ref$start === void 0 ? 0 : _ref$start,
|
|
@@ -2579,7 +2907,7 @@
|
|
|
2579
2907
|
label: 'id/name',
|
|
2580
2908
|
key: 'title',
|
|
2581
2909
|
isSortable: true,
|
|
2582
|
-
child: function child(m,
|
|
2910
|
+
child: function child(m, _navigate, search) {
|
|
2583
2911
|
return jsxRuntime.jsxs(TdLink, {
|
|
2584
2912
|
model: m,
|
|
2585
2913
|
children: [m.name, search && jsxRuntime.jsxs(React__default['default'].Fragment, {
|
|
@@ -2617,12 +2945,15 @@
|
|
|
2617
2945
|
;
|
|
2618
2946
|
|
|
2619
2947
|
_proto.applyCompat = function applyCompat(data) {
|
|
2620
|
-
|
|
2621
|
-
|
|
2622
|
-
|
|
2948
|
+
var result = _extends({}, data, {
|
|
2949
|
+
member: data.items,
|
|
2950
|
+
items_count: data.items_total
|
|
2951
|
+
});
|
|
2952
|
+
|
|
2953
|
+
return result;
|
|
2623
2954
|
};
|
|
2624
2955
|
|
|
2625
|
-
_proto.search = function search(path, params, container, prepare) {
|
|
2956
|
+
_proto.search = function search(path, params, container, prepare, signal) {
|
|
2626
2957
|
if (container === void 0) {
|
|
2627
2958
|
container = false;
|
|
2628
2959
|
}
|
|
@@ -2644,7 +2975,7 @@
|
|
|
2644
2975
|
|
|
2645
2976
|
var query = prepare ? toQueryString(params) : params;
|
|
2646
2977
|
var url = path + "@search?" + query;
|
|
2647
|
-
return Promise.resolve(_this7.rest.get(url)).then(function (res) {
|
|
2978
|
+
return Promise.resolve(_this7.rest.get(url, signal)).then(function (res) {
|
|
2648
2979
|
return Promise.resolve(res.json()).then(function (data) {
|
|
2649
2980
|
return _this7.applyCompat(data);
|
|
2650
2981
|
});
|
|
@@ -2856,23 +3187,53 @@
|
|
|
2856
3187
|
var users = _this37.getUsers(path);
|
|
2857
3188
|
|
|
2858
3189
|
return Promise.resolve(Promise.all([groups, users])).then(function (_ref3) {
|
|
2859
|
-
var
|
|
2860
|
-
|
|
3190
|
+
var responseGroups = _ref3[0],
|
|
3191
|
+
responseUsers = _ref3[1];
|
|
2861
3192
|
|
|
2862
|
-
function
|
|
2863
|
-
function
|
|
3193
|
+
function _temp8() {
|
|
3194
|
+
function _temp6() {
|
|
2864
3195
|
return {
|
|
2865
|
-
groups:
|
|
2866
|
-
users:
|
|
3196
|
+
groups: groupsData,
|
|
3197
|
+
users: usersData
|
|
2867
3198
|
};
|
|
2868
3199
|
}
|
|
2869
3200
|
|
|
2870
|
-
var
|
|
2871
|
-
|
|
3201
|
+
var _temp5 = function () {
|
|
3202
|
+
if (responseUsers) {
|
|
3203
|
+
return Promise.resolve(responseUsers.json()).then(function (usersDataResponse) {
|
|
3204
|
+
usersData = usersDataResponse.map(function (user) {
|
|
3205
|
+
return {
|
|
3206
|
+
'@name': user.id,
|
|
3207
|
+
user_roles: user.roles,
|
|
3208
|
+
fullname: user.fullname,
|
|
3209
|
+
email: user.email
|
|
3210
|
+
};
|
|
3211
|
+
});
|
|
3212
|
+
});
|
|
3213
|
+
}
|
|
3214
|
+
}();
|
|
3215
|
+
|
|
3216
|
+
return _temp5 && _temp5.then ? _temp5.then(_temp6) : _temp6(_temp5);
|
|
2872
3217
|
}
|
|
2873
3218
|
|
|
2874
|
-
var
|
|
2875
|
-
|
|
3219
|
+
var groupsData = [];
|
|
3220
|
+
var usersData = [];
|
|
3221
|
+
|
|
3222
|
+
var _temp7 = function () {
|
|
3223
|
+
if (responseGroups.ok) {
|
|
3224
|
+
return Promise.resolve(responseGroups.json()).then(function (groupsDataResponse) {
|
|
3225
|
+
groupsData = groupsDataResponse.map(function (group) {
|
|
3226
|
+
return {
|
|
3227
|
+
'@name': group.id,
|
|
3228
|
+
user_roles: group.roles,
|
|
3229
|
+
users: group.users
|
|
3230
|
+
};
|
|
3231
|
+
});
|
|
3232
|
+
});
|
|
3233
|
+
}
|
|
3234
|
+
}();
|
|
3235
|
+
|
|
3236
|
+
return _temp7 && _temp7.then ? _temp7.then(_temp8) : _temp8(_temp7);
|
|
2876
3237
|
});
|
|
2877
3238
|
} catch (e) {
|
|
2878
3239
|
return Promise.reject(e);
|
|
@@ -2914,7 +3275,7 @@
|
|
|
2914
3275
|
try {
|
|
2915
3276
|
var _this43 = this;
|
|
2916
3277
|
|
|
2917
|
-
function
|
|
3278
|
+
function _temp12() {
|
|
2918
3279
|
return cacheTypes[path];
|
|
2919
3280
|
}
|
|
2920
3281
|
|
|
@@ -2922,10 +3283,10 @@
|
|
|
2922
3283
|
path = path.slice(1);
|
|
2923
3284
|
}
|
|
2924
3285
|
|
|
2925
|
-
var
|
|
3286
|
+
var _temp13 = function () {
|
|
2926
3287
|
if (!cacheTypes[path]) {
|
|
2927
3288
|
return Promise.resolve(_this43.rest.get(path + '@addable-types')).then(function (types) {
|
|
2928
|
-
var
|
|
3289
|
+
var _temp9 = function () {
|
|
2929
3290
|
if (types.status === 401 || types.status === 404) {
|
|
2930
3291
|
cacheTypes[path] = [];
|
|
2931
3292
|
} else {
|
|
@@ -2935,12 +3296,12 @@
|
|
|
2935
3296
|
}
|
|
2936
3297
|
}();
|
|
2937
3298
|
|
|
2938
|
-
if (
|
|
3299
|
+
if (_temp9 && _temp9.then) return _temp9.then(function () {});
|
|
2939
3300
|
});
|
|
2940
3301
|
}
|
|
2941
3302
|
}();
|
|
2942
3303
|
|
|
2943
|
-
return Promise.resolve(
|
|
3304
|
+
return Promise.resolve(_temp13 && _temp13.then ? _temp13.then(_temp12) : _temp12(_temp13));
|
|
2944
3305
|
} catch (e) {
|
|
2945
3306
|
return Promise.reject(e);
|
|
2946
3307
|
}
|
|
@@ -2952,17 +3313,24 @@
|
|
|
2952
3313
|
return new GuillotinaClient(new RestClient(url, container, auth), container === '/');
|
|
2953
3314
|
}
|
|
2954
3315
|
var lightFileReader = function lightFileReader(file) {
|
|
2955
|
-
return new Promise(function (resolve) {
|
|
3316
|
+
return new Promise(function (resolve, reject) {
|
|
2956
3317
|
var reader = new FileReader();
|
|
2957
3318
|
reader.readAsArrayBuffer(file);
|
|
2958
3319
|
|
|
2959
3320
|
reader.onloadend = function (e) {
|
|
2960
|
-
var
|
|
2961
|
-
|
|
2962
|
-
|
|
2963
|
-
|
|
2964
|
-
|
|
2965
|
-
|
|
3321
|
+
var _e$target;
|
|
3322
|
+
|
|
3323
|
+
var fileData = e == null ? void 0 : (_e$target = e.target) == null ? void 0 : _e$target.result;
|
|
3324
|
+
|
|
3325
|
+
if (fileData) {
|
|
3326
|
+
resolve({
|
|
3327
|
+
filename: file.name.normalize('NFD').replace(/[\u0300-\u036f]/g, ''),
|
|
3328
|
+
data: fileData,
|
|
3329
|
+
'content-type': file.type
|
|
3330
|
+
});
|
|
3331
|
+
} else {
|
|
3332
|
+
reject('Error reading file');
|
|
3333
|
+
}
|
|
2966
3334
|
};
|
|
2967
3335
|
});
|
|
2968
3336
|
};
|
|
@@ -2993,9 +3361,15 @@
|
|
|
2993
3361
|
|
|
2994
3362
|
var changed = function changed(event) {
|
|
2995
3363
|
try {
|
|
2996
|
-
|
|
2997
|
-
|
|
2998
|
-
|
|
3364
|
+
var _temp2 = function () {
|
|
3365
|
+
if (event.target.files) {
|
|
3366
|
+
return Promise.resolve(lightFileReader(event.target.files[0])).then(function (fileToUpload) {
|
|
3367
|
+
onChange(fileToUpload);
|
|
3368
|
+
});
|
|
3369
|
+
}
|
|
3370
|
+
}();
|
|
3371
|
+
|
|
3372
|
+
return Promise.resolve(_temp2 && _temp2.then ? _temp2.then(function () {}) : void 0);
|
|
2999
3373
|
} catch (e) {
|
|
3000
3374
|
return Promise.reject(e);
|
|
3001
3375
|
}
|
|
@@ -3086,12 +3460,12 @@
|
|
|
3086
3460
|
|
|
3087
3461
|
var defaultEvents = ['mousedown', 'touchstart'];
|
|
3088
3462
|
|
|
3089
|
-
var on = function on(obj) {
|
|
3090
|
-
return obj.addEventListener
|
|
3463
|
+
var on = function on(obj, type, handler) {
|
|
3464
|
+
return obj.addEventListener(type, handler);
|
|
3091
3465
|
};
|
|
3092
3466
|
|
|
3093
|
-
var off = function off(obj) {
|
|
3094
|
-
return obj.removeEventListener
|
|
3467
|
+
var off = function off(obj, type, handler) {
|
|
3468
|
+
return obj.removeEventListener(type, handler);
|
|
3095
3469
|
};
|
|
3096
3470
|
|
|
3097
3471
|
function useClickAway(ref, onClickAway, events) {
|
|
@@ -3123,56 +3497,7 @@
|
|
|
3123
3497
|
}, [events, ref]);
|
|
3124
3498
|
}
|
|
3125
3499
|
|
|
3126
|
-
var
|
|
3127
|
-
var d = new Date(str);
|
|
3128
|
-
var minutes = d.getMinutes() < 10 ? "0" + d.getMinutes() : d.getMinutes();
|
|
3129
|
-
return d.getDate() + "/" + (d.getMonth() + 1) + "/" + d.getFullYear() + " " + d.getHours() + ":" + minutes;
|
|
3130
|
-
};
|
|
3131
|
-
var get$1 = function get(obj, path, defValue) {
|
|
3132
|
-
var _pathArray$reduce;
|
|
3133
|
-
|
|
3134
|
-
// If path is not defined or it has false value
|
|
3135
|
-
if (!path) return undefined; // Check if path is string or array. Regex : ensure that we do not have '.' and brackets.
|
|
3136
|
-
// Regex explained: https://regexr.com/58j0k
|
|
3137
|
-
|
|
3138
|
-
var pathArray = Array.isArray(path) ? path : path.match(/([^[.\]])+/g); // Find value if exist return otherwise return undefined value;
|
|
3139
|
-
|
|
3140
|
-
return (_pathArray$reduce = pathArray.reduce(function (prevObj, key) {
|
|
3141
|
-
return prevObj && prevObj[key];
|
|
3142
|
-
}, obj)) != null ? _pathArray$reduce : defValue;
|
|
3143
|
-
};
|
|
3144
|
-
function getNewId(id) {
|
|
3145
|
-
if (id === void 0) {
|
|
3146
|
-
id = '';
|
|
3147
|
-
}
|
|
3148
|
-
|
|
3149
|
-
var suffix = '-copy-';
|
|
3150
|
-
var rgx = new RegExp("($|" + suffix + "\\d*)");
|
|
3151
|
-
return stringToSlug(id).replace(rgx, function (r) {
|
|
3152
|
-
var num = parseInt(r.replace(suffix, '') || '0');
|
|
3153
|
-
return "" + suffix + (num + 1);
|
|
3154
|
-
});
|
|
3155
|
-
}
|
|
3156
|
-
|
|
3157
|
-
function debounce(func, wait) {
|
|
3158
|
-
var timeout;
|
|
3159
|
-
return function () {
|
|
3160
|
-
// eslint-disable-next-line @typescript-eslint/no-this-alias
|
|
3161
|
-
var context = this; // eslint-disable-next-line prefer-rest-params
|
|
3162
|
-
|
|
3163
|
-
var args = arguments;
|
|
3164
|
-
|
|
3165
|
-
var later = function later() {
|
|
3166
|
-
timeout = null;
|
|
3167
|
-
func.apply(context, args);
|
|
3168
|
-
};
|
|
3169
|
-
|
|
3170
|
-
clearTimeout(timeout);
|
|
3171
|
-
timeout = setTimeout(later, wait);
|
|
3172
|
-
};
|
|
3173
|
-
}
|
|
3174
|
-
|
|
3175
|
-
var initialState = {
|
|
3500
|
+
var initialState$1 = {
|
|
3176
3501
|
page: 0,
|
|
3177
3502
|
items: undefined,
|
|
3178
3503
|
loading: false,
|
|
@@ -3182,10 +3507,9 @@
|
|
|
3182
3507
|
var onChange = _ref.onChange,
|
|
3183
3508
|
error = _ref.error,
|
|
3184
3509
|
errorZoneClassName = _ref.errorZoneClassName,
|
|
3185
|
-
|
|
3186
|
-
traversal = _ref$traversal === void 0 ? null : _ref$traversal,
|
|
3510
|
+
traversal = _ref.traversal,
|
|
3187
3511
|
_ref$path = _ref.path,
|
|
3188
|
-
path = _ref$path === void 0 ?
|
|
3512
|
+
path = _ref$path === void 0 ? undefined : _ref$path,
|
|
3189
3513
|
_ref$qs = _ref.qs,
|
|
3190
3514
|
qs = _ref$qs === void 0 ? [] : _ref$qs,
|
|
3191
3515
|
_ref$queryCondition = _ref.queryCondition,
|
|
@@ -3200,14 +3524,14 @@
|
|
|
3200
3524
|
_ref$dataTestItem = _ref.dataTestItem,
|
|
3201
3525
|
dataTestItem = _ref$dataTestItem === void 0 ? 'searchInputItemTest' : _ref$dataTestItem,
|
|
3202
3526
|
_ref$renderTextItemOp = _ref.renderTextItemOption,
|
|
3203
|
-
renderTextItemOption = _ref$renderTextItemOp === void 0 ?
|
|
3527
|
+
renderTextItemOption = _ref$renderTextItemOp === void 0 ? undefined : _ref$renderTextItemOp,
|
|
3204
3528
|
_ref$typeNameQuery = _ref.typeNameQuery,
|
|
3205
|
-
typeNameQuery = _ref$typeNameQuery === void 0 ?
|
|
3529
|
+
typeNameQuery = _ref$typeNameQuery === void 0 ? undefined : _ref$typeNameQuery,
|
|
3206
3530
|
_ref$labelProperty = _ref.labelProperty,
|
|
3207
3531
|
labelProperty = _ref$labelProperty === void 0 ? 'id' : _ref$labelProperty;
|
|
3208
3532
|
var intl = reactIntl.useIntl();
|
|
3209
3533
|
|
|
3210
|
-
var _useSetState = useSetState(initialState),
|
|
3534
|
+
var _useSetState = useSetState(initialState$1),
|
|
3211
3535
|
options = _useSetState[0],
|
|
3212
3536
|
setOptions = _useSetState[1];
|
|
3213
3537
|
|
|
@@ -3261,7 +3585,7 @@
|
|
|
3261
3585
|
var searchTermParsed = ["id", value];
|
|
3262
3586
|
var getSearch = traversal.registry.get;
|
|
3263
3587
|
var fnName = getSearch('searchEngineQueryParamsFunction', SearchEngine);
|
|
3264
|
-
var qsParsed = traversal.client
|
|
3588
|
+
var qsParsed = traversal.client.getQueryParamsSearchFunction(fnName)({
|
|
3265
3589
|
path: traversal.path,
|
|
3266
3590
|
start: 0,
|
|
3267
3591
|
pageSize: PageSize,
|
|
@@ -3279,7 +3603,7 @@
|
|
|
3279
3603
|
|
|
3280
3604
|
return Promise.resolve(traversal.client.search(path ? path : traversal.client.getContainerFromPath(traversal.path), searchTermQs, false, false)).then(function (data) {
|
|
3281
3605
|
var newValuesLabel = data.items.reduce(function (result, item) {
|
|
3282
|
-
result[item.id] = get
|
|
3606
|
+
result[item.id] = get(item, labelProperty, item.id);
|
|
3283
3607
|
return result;
|
|
3284
3608
|
}, {});
|
|
3285
3609
|
setValueLabel(newValuesLabel);
|
|
@@ -3307,6 +3631,7 @@
|
|
|
3307
3631
|
}
|
|
3308
3632
|
|
|
3309
3633
|
try {
|
|
3634
|
+
console.log('handle search input');
|
|
3310
3635
|
setOptions({
|
|
3311
3636
|
loading: true
|
|
3312
3637
|
});
|
|
@@ -3321,7 +3646,7 @@
|
|
|
3321
3646
|
|
|
3322
3647
|
var fnName = _get('searchEngineQueryParamsFunction', SearchEngine);
|
|
3323
3648
|
|
|
3324
|
-
var qsParsed = traversal.client
|
|
3649
|
+
var qsParsed = traversal.client.getQueryParamsSearchFunction(fnName)({
|
|
3325
3650
|
path: traversal.path,
|
|
3326
3651
|
start: page * PageSize,
|
|
3327
3652
|
pageSize: PageSize,
|
|
@@ -3334,7 +3659,7 @@
|
|
|
3334
3659
|
typeNameParsed = parser("type_name__in=" + typeNameQuery);
|
|
3335
3660
|
}
|
|
3336
3661
|
|
|
3337
|
-
if (qs.length > 0 || searchTermParsed.length > 0 || qsParsed.length > 0 || typeNameParsed.length > 0) {
|
|
3662
|
+
if (qs.length > 0 || searchTermParsed.length > 0 || qsParsed.length > 0 || typeNameParsed.length > 0 || sortParsed.length > 0) {
|
|
3338
3663
|
searchTermQs = buildQs([].concat(qs, searchTermParsed, qsParsed, typeNameParsed, sortParsed));
|
|
3339
3664
|
}
|
|
3340
3665
|
|
|
@@ -3359,7 +3684,7 @@
|
|
|
3359
3684
|
return renderTextItemOption(item);
|
|
3360
3685
|
}
|
|
3361
3686
|
|
|
3362
|
-
return get
|
|
3687
|
+
return get(item, labelProperty, item.title) || item['@name'];
|
|
3363
3688
|
};
|
|
3364
3689
|
|
|
3365
3690
|
React.useEffect(function () {
|
|
@@ -3385,7 +3710,7 @@
|
|
|
3385
3710
|
if (!ev.currentTarget.contains(ev.relatedTarget)) {
|
|
3386
3711
|
if (searchTerm !== '') {
|
|
3387
3712
|
setSearchTerm('');
|
|
3388
|
-
setOptions(initialState);
|
|
3713
|
+
setOptions(initialState$1);
|
|
3389
3714
|
}
|
|
3390
3715
|
|
|
3391
3716
|
setIsOpen(false);
|
|
@@ -3403,6 +3728,7 @@
|
|
|
3403
3728
|
}
|
|
3404
3729
|
|
|
3405
3730
|
setIsOpen(!isOpen);
|
|
3731
|
+
console.log('on clic btn', options);
|
|
3406
3732
|
|
|
3407
3733
|
if (!options.loading && !options.items) {
|
|
3408
3734
|
handleSearch(options.page);
|
|
@@ -3411,7 +3737,7 @@
|
|
|
3411
3737
|
"aria-haspopup": "true",
|
|
3412
3738
|
"aria-controls": "dropdown-menu",
|
|
3413
3739
|
children: [jsxRuntime.jsx("span", {
|
|
3414
|
-
children: value ? get
|
|
3740
|
+
children: value ? get(valueLabel, value, value) : intl.formatMessage(genericMessages.choose)
|
|
3415
3741
|
}), jsxRuntime.jsx("span", {
|
|
3416
3742
|
className: "icon",
|
|
3417
3743
|
children: jsxRuntime.jsx("i", {
|
|
@@ -3485,25 +3811,7 @@
|
|
|
3485
3811
|
});
|
|
3486
3812
|
};
|
|
3487
3813
|
|
|
3488
|
-
|
|
3489
|
-
var timeout;
|
|
3490
|
-
return function () {
|
|
3491
|
-
// eslint-disable-next-line @typescript-eslint/no-this-alias
|
|
3492
|
-
var context = this; // eslint-disable-next-line prefer-rest-params
|
|
3493
|
-
|
|
3494
|
-
var args = arguments;
|
|
3495
|
-
|
|
3496
|
-
var later = function later() {
|
|
3497
|
-
timeout = null;
|
|
3498
|
-
func.apply(context, args);
|
|
3499
|
-
};
|
|
3500
|
-
|
|
3501
|
-
clearTimeout(timeout);
|
|
3502
|
-
timeout = setTimeout(later, wait);
|
|
3503
|
-
};
|
|
3504
|
-
}
|
|
3505
|
-
|
|
3506
|
-
var initialState$1 = {
|
|
3814
|
+
var initialState$2 = {
|
|
3507
3815
|
page: 0,
|
|
3508
3816
|
items: undefined,
|
|
3509
3817
|
loading: false,
|
|
@@ -3513,10 +3821,9 @@
|
|
|
3513
3821
|
var onChange = _ref.onChange,
|
|
3514
3822
|
error = _ref.error,
|
|
3515
3823
|
errorZoneClassName = _ref.errorZoneClassName,
|
|
3516
|
-
|
|
3517
|
-
traversal = _ref$traversal === void 0 ? null : _ref$traversal,
|
|
3824
|
+
traversal = _ref.traversal,
|
|
3518
3825
|
_ref$path = _ref.path,
|
|
3519
|
-
path = _ref$path === void 0 ?
|
|
3826
|
+
path = _ref$path === void 0 ? undefined : _ref$path,
|
|
3520
3827
|
_ref$qs = _ref.qs,
|
|
3521
3828
|
qs = _ref$qs === void 0 ? [] : _ref$qs,
|
|
3522
3829
|
_ref$queryCondition = _ref.queryCondition,
|
|
@@ -3531,14 +3838,14 @@
|
|
|
3531
3838
|
_ref$dataTestItem = _ref.dataTestItem,
|
|
3532
3839
|
dataTestItem = _ref$dataTestItem === void 0 ? 'searchInputItemTest' : _ref$dataTestItem,
|
|
3533
3840
|
_ref$renderTextItemOp = _ref.renderTextItemOption,
|
|
3534
|
-
renderTextItemOption = _ref$renderTextItemOp === void 0 ?
|
|
3841
|
+
renderTextItemOption = _ref$renderTextItemOp === void 0 ? undefined : _ref$renderTextItemOp,
|
|
3535
3842
|
_ref$typeNameQuery = _ref.typeNameQuery,
|
|
3536
|
-
typeNameQuery = _ref$typeNameQuery === void 0 ?
|
|
3843
|
+
typeNameQuery = _ref$typeNameQuery === void 0 ? undefined : _ref$typeNameQuery,
|
|
3537
3844
|
_ref$labelProperty = _ref.labelProperty,
|
|
3538
3845
|
labelProperty = _ref$labelProperty === void 0 ? 'id' : _ref$labelProperty;
|
|
3539
3846
|
var intl = reactIntl.useIntl();
|
|
3540
3847
|
|
|
3541
|
-
var _useSetState = useSetState(initialState$
|
|
3848
|
+
var _useSetState = useSetState(initialState$2),
|
|
3542
3849
|
options = _useSetState[0],
|
|
3543
3850
|
setOptions = _useSetState[1];
|
|
3544
3851
|
|
|
@@ -3584,7 +3891,7 @@
|
|
|
3584
3891
|
};
|
|
3585
3892
|
};
|
|
3586
3893
|
|
|
3587
|
-
var delayedQuery = React.useCallback(debounce
|
|
3894
|
+
var delayedQuery = React.useCallback(debounce(function (value) {
|
|
3588
3895
|
return handleSearch(0, false, value);
|
|
3589
3896
|
}, 500), []);
|
|
3590
3897
|
|
|
@@ -3616,7 +3923,7 @@
|
|
|
3616
3923
|
|
|
3617
3924
|
var fnName = _get('searchEngineQueryParamsFunction', SearchEngine);
|
|
3618
3925
|
|
|
3619
|
-
var qsParsed = traversal.client
|
|
3926
|
+
var qsParsed = traversal.client.getQueryParamsSearchFunction(fnName)({
|
|
3620
3927
|
path: traversal.path,
|
|
3621
3928
|
start: page * PageSize,
|
|
3622
3929
|
pageSize: PageSize,
|
|
@@ -3658,7 +3965,7 @@
|
|
|
3658
3965
|
var searchTermParsed = ['__or', "id=" + value.join('%26id=')];
|
|
3659
3966
|
var getSearch = traversal.registry.get;
|
|
3660
3967
|
var fnName = getSearch('searchEngineQueryParamsFunction', SearchEngine);
|
|
3661
|
-
var qsParsed = traversal.client
|
|
3968
|
+
var qsParsed = traversal.client.getQueryParamsSearchFunction(fnName)({
|
|
3662
3969
|
path: traversal.path,
|
|
3663
3970
|
start: 0,
|
|
3664
3971
|
pageSize: 100,
|
|
@@ -3674,9 +3981,9 @@
|
|
|
3674
3981
|
searchTermQs = buildQs([].concat(qs, [searchTermParsed], qsParsed, typeNameParsed));
|
|
3675
3982
|
}
|
|
3676
3983
|
|
|
3677
|
-
return Promise.resolve(traversal.client.search(path ? path : traversal.client.getContainerFromPath(traversal.path), searchTermQs, false, false
|
|
3984
|
+
return Promise.resolve(traversal.client.search(path ? path : traversal.client.getContainerFromPath(traversal.path), searchTermQs, false, false)).then(function (data) {
|
|
3678
3985
|
var newValuesLabel = data.items.reduce(function (result, item) {
|
|
3679
|
-
result[item.id] = get
|
|
3986
|
+
result[item.id] = get(item, labelProperty, item.id);
|
|
3680
3987
|
return result;
|
|
3681
3988
|
}, {});
|
|
3682
3989
|
setValuesLabels(newValuesLabel);
|
|
@@ -3696,7 +4003,7 @@
|
|
|
3696
4003
|
return renderTextItemOption(item);
|
|
3697
4004
|
}
|
|
3698
4005
|
|
|
3699
|
-
return get
|
|
4006
|
+
return get(item, labelProperty, item.title) || item['@name'];
|
|
3700
4007
|
};
|
|
3701
4008
|
|
|
3702
4009
|
React.useEffect(function () {
|
|
@@ -3719,7 +4026,7 @@
|
|
|
3719
4026
|
children: value.map(function (tag, index) {
|
|
3720
4027
|
return jsxRuntime.jsxs("div", {
|
|
3721
4028
|
className: "tag is-info is-medium",
|
|
3722
|
-
children: [get
|
|
4029
|
+
children: [get(valuesLabel, tag, tag), jsxRuntime.jsx("button", {
|
|
3723
4030
|
className: "delete is-small",
|
|
3724
4031
|
onClick: function onClick(ev) {
|
|
3725
4032
|
ev.stopPropagation();
|
|
@@ -3739,7 +4046,7 @@
|
|
|
3739
4046
|
if (!ev.currentTarget.contains(ev.relatedTarget)) {
|
|
3740
4047
|
if (searchTerm !== '') {
|
|
3741
4048
|
setSearchTerm('');
|
|
3742
|
-
setOptions(initialState$
|
|
4049
|
+
setOptions(initialState$2);
|
|
3743
4050
|
}
|
|
3744
4051
|
|
|
3745
4052
|
setIsOpen(false);
|
|
@@ -3803,7 +4110,7 @@
|
|
|
3803
4110
|
if (onChange && !value.includes(item.id)) {
|
|
3804
4111
|
var _extends2;
|
|
3805
4112
|
|
|
3806
|
-
setValuesLabels(_extends({}, valuesLabel, (_extends2 = {}, _extends2[item.id] = get
|
|
4113
|
+
setValuesLabels(_extends({}, valuesLabel, (_extends2 = {}, _extends2[item.id] = get(item, labelProperty, item.id), _extends2)));
|
|
3807
4114
|
onChange([].concat(value, [item.id]));
|
|
3808
4115
|
}
|
|
3809
4116
|
},
|
|
@@ -3991,7 +4298,7 @@
|
|
|
3991
4298
|
ref.current.focus();
|
|
3992
4299
|
}
|
|
3993
4300
|
});
|
|
3994
|
-
var canModified = modifyContent && !get
|
|
4301
|
+
var canModified = schema !== undefined && modifyContent && !get(schema, 'readonly', false);
|
|
3995
4302
|
|
|
3996
4303
|
var saveField = function saveField(ev) {
|
|
3997
4304
|
try {
|
|
@@ -4057,7 +4364,7 @@
|
|
|
4057
4364
|
var deleteField = function deleteField(ev) {
|
|
4058
4365
|
try {
|
|
4059
4366
|
if (ev) ev.preventDefault();
|
|
4060
|
-
return Promise.resolve(function () {
|
|
4367
|
+
return Promise.resolve(function (_schema$items) {
|
|
4061
4368
|
if ((schema == null ? void 0 : schema.widget) === 'file') {
|
|
4062
4369
|
var _ns2, _ref4, _ref5;
|
|
4063
4370
|
|
|
@@ -4085,7 +4392,7 @@
|
|
|
4085
4392
|
});
|
|
4086
4393
|
} else if ((schema == null ? void 0 : schema.type) === 'string' && schema != null && schema.enum) {
|
|
4087
4394
|
setValue(null);
|
|
4088
|
-
} else if ((schema == null ? void 0 : schema.type) === 'array' && (schema == null ? void 0 : schema.items.type) === 'string') {
|
|
4395
|
+
} else if ((schema == null ? void 0 : schema.type) === 'array' && (schema == null ? void 0 : (_schema$items = schema.items) == null ? void 0 : _schema$items.type) === 'string') {
|
|
4089
4396
|
setValue([]);
|
|
4090
4397
|
}
|
|
4091
4398
|
}());
|
|
@@ -4142,7 +4449,7 @@
|
|
|
4142
4449
|
dataTest: "editableFieldBtnCancelTest",
|
|
4143
4450
|
children: intl.formatMessage(genericMessages.cancel)
|
|
4144
4451
|
})
|
|
4145
|
-
}), !required && fieldHaveDeleteButton(schema) && jsxRuntime.jsx("div", {
|
|
4452
|
+
}), !required && schema && fieldHaveDeleteButton(schema) && jsxRuntime.jsx("div", {
|
|
4146
4453
|
className: "control",
|
|
4147
4454
|
children: jsxRuntime.jsx(Button, {
|
|
4148
4455
|
className: "is-small is-danger",
|
|
@@ -4242,80 +4549,6 @@
|
|
|
4242
4549
|
});
|
|
4243
4550
|
};
|
|
4244
4551
|
|
|
4245
|
-
function _catch$1(body, recover) {
|
|
4246
|
-
try {
|
|
4247
|
-
var result = body();
|
|
4248
|
-
} catch (e) {
|
|
4249
|
-
return recover(e);
|
|
4250
|
-
}
|
|
4251
|
-
|
|
4252
|
-
if (result && result.then) {
|
|
4253
|
-
return result.then(void 0, recover);
|
|
4254
|
-
}
|
|
4255
|
-
|
|
4256
|
-
return result;
|
|
4257
|
-
}
|
|
4258
|
-
|
|
4259
|
-
function useVocabulary(vocabularyName, path) {
|
|
4260
|
-
if (path === void 0) {
|
|
4261
|
-
path = null;
|
|
4262
|
-
}
|
|
4263
|
-
|
|
4264
|
-
var traversal = useTraversal();
|
|
4265
|
-
|
|
4266
|
-
var _useSetState = useSetState({
|
|
4267
|
-
data: undefined,
|
|
4268
|
-
loading: false,
|
|
4269
|
-
error: undefined
|
|
4270
|
-
}),
|
|
4271
|
-
vocabulary = _useSetState[0],
|
|
4272
|
-
setVocabulary = _useSetState[1];
|
|
4273
|
-
|
|
4274
|
-
var getPath = function getPath() {
|
|
4275
|
-
if (path) return path;
|
|
4276
|
-
return traversal.path + "@vocabularies/" + vocabularyName;
|
|
4277
|
-
};
|
|
4278
|
-
|
|
4279
|
-
React.useEffect(function () {
|
|
4280
|
-
var getVocabulary = function getVocabulary() {
|
|
4281
|
-
try {
|
|
4282
|
-
var _temp3 = function () {
|
|
4283
|
-
if (vocabularyName && vocabulary.data === undefined && !vocabulary.loading) {
|
|
4284
|
-
var _temp4 = _catch$1(function () {
|
|
4285
|
-
setVocabulary({
|
|
4286
|
-
loading: true
|
|
4287
|
-
});
|
|
4288
|
-
return Promise.resolve(traversal.client.get(getPath())).then(function (data) {
|
|
4289
|
-
return Promise.resolve(data.json()).then(function (dataJson) {
|
|
4290
|
-
setVocabulary({
|
|
4291
|
-
loading: false,
|
|
4292
|
-
data: dataJson
|
|
4293
|
-
});
|
|
4294
|
-
});
|
|
4295
|
-
});
|
|
4296
|
-
}, function (err) {
|
|
4297
|
-
setVocabulary({
|
|
4298
|
-
loading: false,
|
|
4299
|
-
error: err,
|
|
4300
|
-
data: undefined
|
|
4301
|
-
});
|
|
4302
|
-
});
|
|
4303
|
-
|
|
4304
|
-
if (_temp4 && _temp4.then) return _temp4.then(function () {});
|
|
4305
|
-
}
|
|
4306
|
-
}();
|
|
4307
|
-
|
|
4308
|
-
return Promise.resolve(_temp3 && _temp3.then ? _temp3.then(function () {}) : void 0);
|
|
4309
|
-
} catch (e) {
|
|
4310
|
-
return Promise.reject(e);
|
|
4311
|
-
}
|
|
4312
|
-
};
|
|
4313
|
-
|
|
4314
|
-
getVocabulary();
|
|
4315
|
-
}, [vocabularyName, vocabulary, path]);
|
|
4316
|
-
return vocabulary;
|
|
4317
|
-
}
|
|
4318
|
-
|
|
4319
4552
|
var plain = ['string', 'number', 'boolean'];
|
|
4320
4553
|
function RenderField(_ref) {
|
|
4321
4554
|
var value = _ref.value,
|
|
@@ -4337,23 +4570,27 @@
|
|
|
4337
4570
|
}
|
|
4338
4571
|
|
|
4339
4572
|
if (type === 'object') {
|
|
4573
|
+
var _schema$properties;
|
|
4574
|
+
|
|
4340
4575
|
if (Array.isArray(value)) {
|
|
4341
|
-
return value.map(function (item) {
|
|
4576
|
+
return value.map(function (item, index) {
|
|
4342
4577
|
return jsxRuntime.jsx("div", {
|
|
4343
4578
|
children: jsxRuntime.jsx(RenderField, {
|
|
4344
4579
|
value: item
|
|
4345
4580
|
})
|
|
4346
|
-
},
|
|
4581
|
+
}, "renderField_" + index + "_" + (schema == null ? void 0 : schema.title));
|
|
4347
4582
|
});
|
|
4348
4583
|
}
|
|
4349
4584
|
|
|
4350
|
-
|
|
4351
|
-
return
|
|
4352
|
-
|
|
4353
|
-
|
|
4354
|
-
|
|
4355
|
-
|
|
4356
|
-
|
|
4585
|
+
if ((schema == null ? void 0 : (_schema$properties = schema.properties) == null ? void 0 : _schema$properties.key) !== undefined) {
|
|
4586
|
+
return Object.keys(value).map(function (key) {
|
|
4587
|
+
return jsxRuntime.jsx(FieldValue, {
|
|
4588
|
+
field: get(schema, "properties." + key + ".title", key),
|
|
4589
|
+
schema: schema.properties.key,
|
|
4590
|
+
value: get(value, key, {})
|
|
4591
|
+
}, key);
|
|
4592
|
+
});
|
|
4593
|
+
}
|
|
4357
4594
|
}
|
|
4358
4595
|
|
|
4359
4596
|
return jsxRuntime.jsxs("p", {
|
|
@@ -4397,6 +4634,7 @@
|
|
|
4397
4634
|
var schema = _ref3.schema,
|
|
4398
4635
|
value = _ref3.value,
|
|
4399
4636
|
modifyContent = _ref3.modifyContent;
|
|
4637
|
+
console.log('search render fields');
|
|
4400
4638
|
var intl = reactIntl.useIntl();
|
|
4401
4639
|
|
|
4402
4640
|
var _useState = React.useState([]),
|
|
@@ -4421,7 +4659,7 @@
|
|
|
4421
4659
|
var searchTermParsed = ['__or', "id=" + valuesToSearch.join('%26id=')];
|
|
4422
4660
|
var getSearch = traversal.registry.get;
|
|
4423
4661
|
var fnName = getSearch('searchEngineQueryParamsFunction', SearchEngine);
|
|
4424
|
-
var qsParsed = traversal.client
|
|
4662
|
+
var qsParsed = traversal.client.getQueryParamsSearchFunction(fnName)({
|
|
4425
4663
|
path: traversal.path,
|
|
4426
4664
|
start: 0,
|
|
4427
4665
|
pageSize: 100,
|
|
@@ -4432,11 +4670,11 @@
|
|
|
4432
4670
|
searchTermQs = buildQs([searchTermParsed].concat(qsParsed));
|
|
4433
4671
|
}
|
|
4434
4672
|
|
|
4435
|
-
return Promise.resolve(traversal.client.search(traversal.client.getContainerFromPath(traversal.path), searchTermQs, false, false
|
|
4673
|
+
return Promise.resolve(traversal.client.search(traversal.client.getContainerFromPath(traversal.path), searchTermQs, false, false)).then(function (data) {
|
|
4436
4674
|
var newValuesLabel = data.items.map(function (item) {
|
|
4437
4675
|
var _schema$labelProperty;
|
|
4438
4676
|
|
|
4439
|
-
return get
|
|
4677
|
+
return get(item, (_schema$labelProperty = schema == null ? void 0 : schema.labelProperty) != null ? _schema$labelProperty : 'title', item.id);
|
|
4440
4678
|
});
|
|
4441
4679
|
setValuesLabels(newValuesLabel);
|
|
4442
4680
|
setIsLoadingData(false);
|
|
@@ -4446,13 +4684,15 @@
|
|
|
4446
4684
|
}
|
|
4447
4685
|
};
|
|
4448
4686
|
|
|
4449
|
-
var valuesToSearch =
|
|
4687
|
+
var valuesToSearch = [];
|
|
4450
4688
|
|
|
4451
|
-
if (typeof
|
|
4452
|
-
valuesToSearch = [
|
|
4689
|
+
if (typeof value === 'string' && value) {
|
|
4690
|
+
valuesToSearch = [value];
|
|
4691
|
+
} else if (Array.isArray(value)) {
|
|
4692
|
+
valuesToSearch = value;
|
|
4453
4693
|
}
|
|
4454
4694
|
|
|
4455
|
-
if (valuesToSearch
|
|
4695
|
+
if (valuesToSearch.length > 0) {
|
|
4456
4696
|
fetchData(valuesToSearch);
|
|
4457
4697
|
} else {
|
|
4458
4698
|
setValuesLabels([]);
|
|
@@ -4487,7 +4727,7 @@
|
|
|
4487
4727
|
modifyContent = _ref4.modifyContent;
|
|
4488
4728
|
var intl = reactIntl.useIntl();
|
|
4489
4729
|
var DEFAULT_VALUE_EDITABLE_FIELD = getDefaultValueEditableField(intl);
|
|
4490
|
-
var vocabularyName = (schema == null ? void 0 : (_schema$items = schema.items) == null ? void 0 : _schema$items.vocabularyName) || (schema == null ? void 0 : schema.vocabularyName);
|
|
4730
|
+
var vocabularyName = (schema == null ? void 0 : (_schema$items = schema.items) == null ? void 0 : _schema$items.vocabularyName) || (schema == null ? void 0 : schema.vocabularyName) || '';
|
|
4491
4731
|
var vocabulary = useVocabulary(vocabularyName);
|
|
4492
4732
|
|
|
4493
4733
|
var getRenderProps = function getRenderProps() {
|
|
@@ -4498,7 +4738,7 @@
|
|
|
4498
4738
|
if (schema != null && schema.vocabularyName) {
|
|
4499
4739
|
var _vocabularyValue$titl;
|
|
4500
4740
|
|
|
4501
|
-
var vocabularyValue = get
|
|
4741
|
+
var vocabularyValue = get(vocabulary, 'data.items', []).find(function (item) {
|
|
4502
4742
|
return item.token === value;
|
|
4503
4743
|
});
|
|
4504
4744
|
renderProps['value'] = (_vocabularyValue$titl = vocabularyValue == null ? void 0 : vocabularyValue.title) != null ? _vocabularyValue$titl : '';
|
|
@@ -4508,7 +4748,7 @@
|
|
|
4508
4748
|
renderProps['value'] = ((_renderProps$value = renderProps['value']) != null ? _renderProps$value : []).map(function (value) {
|
|
4509
4749
|
var _get$find$title, _get$find;
|
|
4510
4750
|
|
|
4511
|
-
return (_get$find$title = (_get$find = get
|
|
4751
|
+
return (_get$find$title = (_get$find = get(vocabulary, 'data.items', []).find(function (item) {
|
|
4512
4752
|
return item.token === value;
|
|
4513
4753
|
})) == null ? void 0 : _get$find.title) != null ? _get$find$title : '';
|
|
4514
4754
|
});
|
|
@@ -4560,66 +4800,6 @@
|
|
|
4560
4800
|
return jsxRuntime.jsx(RenderField, _extends({}, getRenderProps()));
|
|
4561
4801
|
}
|
|
4562
4802
|
|
|
4563
|
-
var SelectVocabulary = React.forwardRef(function (_ref, ref) {
|
|
4564
|
-
var vocabularyName = _ref.vocabularyName,
|
|
4565
|
-
className = _ref.className,
|
|
4566
|
-
classWrap = _ref.classWrap,
|
|
4567
|
-
val = _ref.val,
|
|
4568
|
-
dataTest = _ref.dataTest,
|
|
4569
|
-
multiple = _ref.multiple,
|
|
4570
|
-
onChange = _ref.onChange,
|
|
4571
|
-
id = _ref.id,
|
|
4572
|
-
placeholder = _ref.placeholder;
|
|
4573
|
-
var vocabulary = useVocabulary(vocabularyName);
|
|
4574
|
-
|
|
4575
|
-
var getOptions = function getOptions() {
|
|
4576
|
-
if (get$1(vocabulary, 'data.items', null)) {
|
|
4577
|
-
var vocData = vocabulary.data.items.map(function (item) {
|
|
4578
|
-
return {
|
|
4579
|
-
text: item.title,
|
|
4580
|
-
value: item.token
|
|
4581
|
-
};
|
|
4582
|
-
});
|
|
4583
|
-
return vocData;
|
|
4584
|
-
}
|
|
4585
|
-
|
|
4586
|
-
return [];
|
|
4587
|
-
};
|
|
4588
|
-
|
|
4589
|
-
var getProps = function getProps() {
|
|
4590
|
-
if (multiple) {
|
|
4591
|
-
var currentValue = val || [];
|
|
4592
|
-
return {
|
|
4593
|
-
multiple: true,
|
|
4594
|
-
size: 5,
|
|
4595
|
-
value: currentValue,
|
|
4596
|
-
options: getOptions()
|
|
4597
|
-
};
|
|
4598
|
-
}
|
|
4599
|
-
|
|
4600
|
-
return {
|
|
4601
|
-
value: val != null ? val : '',
|
|
4602
|
-
appendDefault: true,
|
|
4603
|
-
options: getOptions()
|
|
4604
|
-
};
|
|
4605
|
-
};
|
|
4606
|
-
|
|
4607
|
-
if (vocabulary.data === undefined || vocabulary.loading) {
|
|
4608
|
-
return jsxRuntime.jsx("div", {});
|
|
4609
|
-
}
|
|
4610
|
-
|
|
4611
|
-
return jsxRuntime.jsx(Select, _extends({}, getProps(), {
|
|
4612
|
-
className: className,
|
|
4613
|
-
classWrap: classWrap || 'is-fullwidth',
|
|
4614
|
-
dataTest: dataTest,
|
|
4615
|
-
ref: ref,
|
|
4616
|
-
onChange: onChange,
|
|
4617
|
-
id: id,
|
|
4618
|
-
placeholder: placeholder
|
|
4619
|
-
}));
|
|
4620
|
-
});
|
|
4621
|
-
SelectVocabulary.displayName = 'SelectVocabulary';
|
|
4622
|
-
|
|
4623
4803
|
var EditComponent = React.forwardRef(function (_ref, ref) {
|
|
4624
4804
|
var schema = _ref.schema,
|
|
4625
4805
|
val = _ref.val,
|
|
@@ -4645,7 +4825,7 @@
|
|
|
4645
4825
|
queryCondition: schema != null && schema.queryCondition ? schema.queryCondition : 'title__in',
|
|
4646
4826
|
path: schema.queryPath,
|
|
4647
4827
|
labelProperty: schema != null && schema.labelProperty ? schema.labelProperty : 'title',
|
|
4648
|
-
typeNameQuery: schema
|
|
4828
|
+
typeNameQuery: schema == null ? void 0 : schema.typeNameQuery
|
|
4649
4829
|
})]
|
|
4650
4830
|
});
|
|
4651
4831
|
} else if ((schema == null ? void 0 : schema.widget) === 'search') {
|
|
@@ -4662,7 +4842,7 @@
|
|
|
4662
4842
|
queryCondition: schema != null && schema.queryCondition ? schema.queryCondition : 'title__in',
|
|
4663
4843
|
path: schema.queryPath,
|
|
4664
4844
|
labelProperty: schema != null && schema.labelProperty ? schema.labelProperty : 'title',
|
|
4665
|
-
typeNameQuery: schema
|
|
4845
|
+
typeNameQuery: schema == null ? void 0 : schema.typeNameQuery
|
|
4666
4846
|
})]
|
|
4667
4847
|
});
|
|
4668
4848
|
} else if ((schema == null ? void 0 : schema.widget) === 'textarea' || (schema == null ? void 0 : schema.widget) === 'richtext') {
|
|
@@ -4692,7 +4872,7 @@
|
|
|
4692
4872
|
|
|
4693
4873
|
if (schema.items.vocabularyName) {
|
|
4694
4874
|
return jsxRuntime.jsx(SelectVocabulary, {
|
|
4695
|
-
vocabularyName: get
|
|
4875
|
+
vocabularyName: get(schema, 'items.vocabularyName', ''),
|
|
4696
4876
|
val: val || [],
|
|
4697
4877
|
className: className,
|
|
4698
4878
|
classWrap: "is-fullwidth",
|
|
@@ -4729,22 +4909,25 @@
|
|
|
4729
4909
|
}), jsxRuntime.jsx(InputList, {
|
|
4730
4910
|
value: val || [],
|
|
4731
4911
|
className: className,
|
|
4732
|
-
onChange: function onChange(
|
|
4733
|
-
return _setValue(
|
|
4912
|
+
onChange: function onChange(val) {
|
|
4913
|
+
return _setValue(val);
|
|
4734
4914
|
},
|
|
4735
4915
|
ref: ref,
|
|
4736
4916
|
dataTest: dataTest
|
|
4737
4917
|
})]
|
|
4738
4918
|
});
|
|
4739
4919
|
} else if ((schema == null ? void 0 : schema.widget) === 'file') {
|
|
4920
|
+
var value = val;
|
|
4740
4921
|
return jsxRuntime.jsx(FileUpload, {
|
|
4741
4922
|
onChange: function onChange(ev) {
|
|
4742
4923
|
return _setValue(ev);
|
|
4743
4924
|
},
|
|
4744
|
-
label: get
|
|
4925
|
+
label: get(value, 'filename', undefined),
|
|
4745
4926
|
dataTest: dataTest
|
|
4746
4927
|
});
|
|
4747
4928
|
} else if ((schema == null ? void 0 : schema.widget) === 'select' && schema.type === 'string') {
|
|
4929
|
+
var _schema$vocabulary;
|
|
4930
|
+
|
|
4748
4931
|
if (schema != null && schema.vocabularyName) {
|
|
4749
4932
|
return jsxRuntime.jsx(SelectVocabulary, {
|
|
4750
4933
|
val: val || '',
|
|
@@ -4753,7 +4936,7 @@
|
|
|
4753
4936
|
classWrap: "is-fullwidth",
|
|
4754
4937
|
dataTest: dataTest,
|
|
4755
4938
|
onChange: _setValue,
|
|
4756
|
-
vocabularyName: get
|
|
4939
|
+
vocabularyName: get(schema, 'vocabularyName', ''),
|
|
4757
4940
|
placeholder: placeholder,
|
|
4758
4941
|
id: id
|
|
4759
4942
|
});
|
|
@@ -4765,7 +4948,7 @@
|
|
|
4765
4948
|
appendDefault: true,
|
|
4766
4949
|
classWrap: "is-fullwidth",
|
|
4767
4950
|
dataTest: dataTest,
|
|
4768
|
-
options: schema == null ? void 0 : schema.vocabulary.map(function (item) {
|
|
4951
|
+
options: ((_schema$vocabulary = schema == null ? void 0 : schema.vocabulary) != null ? _schema$vocabulary : []).map(function (item) {
|
|
4769
4952
|
return {
|
|
4770
4953
|
text: item,
|
|
4771
4954
|
value: item
|
|
@@ -4776,26 +4959,27 @@
|
|
|
4776
4959
|
id: id
|
|
4777
4960
|
});
|
|
4778
4961
|
} else if ((schema == null ? void 0 : schema.type) === 'object' && schema.widget !== 'file') {
|
|
4779
|
-
var
|
|
4962
|
+
var _value = val;
|
|
4780
4963
|
return jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
4781
4964
|
children: [schema.title && jsxRuntime.jsx("h4", {
|
|
4782
4965
|
className: "subtitle mt-2",
|
|
4783
4966
|
children: schema.title
|
|
4784
|
-
}), Object.keys(get
|
|
4967
|
+
}), Object.keys(get(schema, 'properties', {})).map(function (key) {
|
|
4785
4968
|
var _subSchema$title;
|
|
4786
4969
|
|
|
4787
|
-
var subSchema = get
|
|
4788
|
-
var requiredFields = get
|
|
4970
|
+
var subSchema = get(schema, "properties." + key, null);
|
|
4971
|
+
var requiredFields = get(schema, 'required', []);
|
|
4972
|
+
if (!subSchema) return null;
|
|
4789
4973
|
return jsxRuntime.jsx(EditComponent, {
|
|
4790
4974
|
id: id + "[" + key + "]",
|
|
4791
4975
|
schema: subSchema,
|
|
4792
|
-
val:
|
|
4976
|
+
val: _value && key in _value ? _value[key] : '',
|
|
4793
4977
|
placeholder: (_subSchema$title = subSchema == null ? void 0 : subSchema.title) != null ? _subSchema$title : '',
|
|
4794
4978
|
required: requiredFields.includes(key),
|
|
4795
4979
|
setValue: function setValue(ev) {
|
|
4796
4980
|
var _extends2;
|
|
4797
4981
|
|
|
4798
|
-
_setValue(_extends({},
|
|
4982
|
+
_setValue(_extends({}, _value, (_extends2 = {}, _extends2[key] = ev, _extends2)));
|
|
4799
4983
|
},
|
|
4800
4984
|
dataTest: key + "TestInput"
|
|
4801
4985
|
}, id + "[" + key + "]");
|
|
@@ -4857,9 +5041,9 @@
|
|
|
4857
5041
|
}, 1), jsxRuntime.jsx("td", {
|
|
4858
5042
|
children: jsxRuntime.jsx(EditableField, {
|
|
4859
5043
|
field: key,
|
|
4860
|
-
value: values
|
|
5044
|
+
value: values.file,
|
|
4861
5045
|
ns: "guillotina.behaviors.attachment.IAttachment",
|
|
4862
|
-
schema: properties
|
|
5046
|
+
schema: properties.file,
|
|
4863
5047
|
modifyContent: modifyContent && ['file'].includes(key)
|
|
4864
5048
|
})
|
|
4865
5049
|
}, 2)]
|
|
@@ -4909,6 +5093,11 @@
|
|
|
4909
5093
|
|
|
4910
5094
|
setLoading(true);
|
|
4911
5095
|
setError(undefined);
|
|
5096
|
+
|
|
5097
|
+
if (!file) {
|
|
5098
|
+
return Promise.resolve();
|
|
5099
|
+
}
|
|
5100
|
+
|
|
4912
5101
|
var endpoint = Ctx.path + "@upload/files/" + fileKey;
|
|
4913
5102
|
return Promise.resolve(Ctx.client.upload(endpoint, file)).then(function (req) {
|
|
4914
5103
|
if (req.status !== 200) {
|
|
@@ -4977,7 +5166,7 @@
|
|
|
4977
5166
|
field: "files/" + key,
|
|
4978
5167
|
value: values['files'][key],
|
|
4979
5168
|
ns: "guillotina.behaviors.attachment.IMultiAttachment.files",
|
|
4980
|
-
schema: properties
|
|
5169
|
+
schema: get(properties, 'files.additionalProperties', {}),
|
|
4981
5170
|
modifyContent: false
|
|
4982
5171
|
}), jsxRuntime.jsx("div", {
|
|
4983
5172
|
className: "ml-5",
|
|
@@ -5201,13 +5390,18 @@
|
|
|
5201
5390
|
ev.preventDefault();
|
|
5202
5391
|
setLoading(true);
|
|
5203
5392
|
setError(undefined);
|
|
5393
|
+
|
|
5394
|
+
if (!file) {
|
|
5395
|
+
return Promise.resolve();
|
|
5396
|
+
}
|
|
5397
|
+
|
|
5204
5398
|
var endpoint = Ctx.path + "@upload/image";
|
|
5205
5399
|
return Promise.resolve(Ctx.client.upload(endpoint, file)).then(function (req) {
|
|
5206
5400
|
var _exit;
|
|
5207
5401
|
|
|
5208
5402
|
function _temp4(_result) {
|
|
5209
5403
|
if (_exit) return _result;
|
|
5210
|
-
setFile(
|
|
5404
|
+
setFile(null);
|
|
5211
5405
|
setLoading(false);
|
|
5212
5406
|
Ctx.flash(intl.formatMessage(genericFileMessages.image_uploaded), 'success');
|
|
5213
5407
|
Ctx.refresh();
|
|
@@ -5488,7 +5682,7 @@
|
|
|
5488
5682
|
fileKey = _useState[0],
|
|
5489
5683
|
setFileKey = _useState[1];
|
|
5490
5684
|
|
|
5491
|
-
var _useState2 = React.useState(
|
|
5685
|
+
var _useState2 = React.useState(undefined),
|
|
5492
5686
|
file = _useState2[0],
|
|
5493
5687
|
setFile = _useState2[1];
|
|
5494
5688
|
|
|
@@ -5521,6 +5715,11 @@
|
|
|
5521
5715
|
|
|
5522
5716
|
setLoading(true);
|
|
5523
5717
|
setError(undefined);
|
|
5718
|
+
|
|
5719
|
+
if (!file) {
|
|
5720
|
+
return Promise.resolve();
|
|
5721
|
+
}
|
|
5722
|
+
|
|
5524
5723
|
var endpoint = Ctx.path + "@upload/images/" + fileKey;
|
|
5525
5724
|
return Promise.resolve(Ctx.client.upload(endpoint, file)).then(function (req) {
|
|
5526
5725
|
var _exit;
|
|
@@ -5623,7 +5822,7 @@
|
|
|
5623
5822
|
field: "images/" + key,
|
|
5624
5823
|
value: values['images'][key],
|
|
5625
5824
|
ns: "guillotina.contrib.image.behaviors.IMultiImageAttachment.images",
|
|
5626
|
-
schema: properties
|
|
5825
|
+
schema: get(properties, 'images.additionalProperties', {}),
|
|
5627
5826
|
modifyContent: false,
|
|
5628
5827
|
required: false
|
|
5629
5828
|
}), jsxRuntime.jsx("div", {
|
|
@@ -5913,7 +6112,7 @@
|
|
|
5913
6112
|
sortedList = _useState2[0],
|
|
5914
6113
|
setSortedList = _useState2[1];
|
|
5915
6114
|
|
|
5916
|
-
var _useState3 = React.useState(
|
|
6115
|
+
var _useState3 = React.useState(undefined),
|
|
5917
6116
|
file = _useState3[0],
|
|
5918
6117
|
setFile = _useState3[1];
|
|
5919
6118
|
|
|
@@ -6057,7 +6256,7 @@
|
|
|
6057
6256
|
field: "images/" + key,
|
|
6058
6257
|
value: values['images'][key],
|
|
6059
6258
|
ns: "guillotina.contrib.image.behaviors.IMultiImageAttachment.images",
|
|
6060
|
-
schema: properties
|
|
6259
|
+
schema: get(properties, 'images.additionalProperties', {}),
|
|
6061
6260
|
modifyContent: false,
|
|
6062
6261
|
required: false
|
|
6063
6262
|
}), jsxRuntime.jsx("div", {
|
|
@@ -6112,165 +6311,6 @@
|
|
|
6112
6311
|
});
|
|
6113
6312
|
}
|
|
6114
6313
|
|
|
6115
|
-
var base = {
|
|
6116
|
-
local: {
|
|
6117
|
-
roleperm: {},
|
|
6118
|
-
prinperm: {},
|
|
6119
|
-
prinrole: {}
|
|
6120
|
-
},
|
|
6121
|
-
inherit: []
|
|
6122
|
-
};
|
|
6123
|
-
var Sharing = /*#__PURE__*/function () {
|
|
6124
|
-
function Sharing(element) {
|
|
6125
|
-
this.local = void 0;
|
|
6126
|
-
this.inherit = void 0;
|
|
6127
|
-
Object.assign(this, element || base);
|
|
6128
|
-
}
|
|
6129
|
-
|
|
6130
|
-
var _proto = Sharing.prototype;
|
|
6131
|
-
|
|
6132
|
-
_proto.getRole = function getRole(role) {
|
|
6133
|
-
return this.local.roleperm[role];
|
|
6134
|
-
};
|
|
6135
|
-
|
|
6136
|
-
_proto.getPrincipals = function getPrincipals(principal) {
|
|
6137
|
-
return this.local.prinperm[principal];
|
|
6138
|
-
};
|
|
6139
|
-
|
|
6140
|
-
_proto.getPrinroles = function getPrinroles(role) {
|
|
6141
|
-
return this.local.prinrole[role];
|
|
6142
|
-
};
|
|
6143
|
-
|
|
6144
|
-
_createClass(Sharing, [{
|
|
6145
|
-
key: "roles",
|
|
6146
|
-
get: function get() {
|
|
6147
|
-
return Object.keys(this.local.roleperm);
|
|
6148
|
-
}
|
|
6149
|
-
}, {
|
|
6150
|
-
key: "principals",
|
|
6151
|
-
get: function get() {
|
|
6152
|
-
return Object.keys(this.local.prinperm);
|
|
6153
|
-
}
|
|
6154
|
-
}, {
|
|
6155
|
-
key: "prinrole",
|
|
6156
|
-
get: function get() {
|
|
6157
|
-
return Object.keys(this.local.prinrole);
|
|
6158
|
-
}
|
|
6159
|
-
}]);
|
|
6160
|
-
|
|
6161
|
-
return Sharing;
|
|
6162
|
-
}();
|
|
6163
|
-
|
|
6164
|
-
var ItemModel = /*#__PURE__*/function () {
|
|
6165
|
-
function ItemModel(item, url) {
|
|
6166
|
-
if (url === void 0) {
|
|
6167
|
-
url = '';
|
|
6168
|
-
}
|
|
6169
|
-
|
|
6170
|
-
this.item = void 0;
|
|
6171
|
-
this.url = void 0;
|
|
6172
|
-
this.item = item;
|
|
6173
|
-
this.url = url;
|
|
6174
|
-
}
|
|
6175
|
-
|
|
6176
|
-
_createClass(ItemModel, [{
|
|
6177
|
-
key: "path",
|
|
6178
|
-
get: function get() {
|
|
6179
|
-
// Compat
|
|
6180
|
-
var item = this.item['@id'] ? this.item['@id'] : this.item['@absolute_url'];
|
|
6181
|
-
var path = item.split('//')[1].split('/').splice(1).join('/');
|
|
6182
|
-
path = "/" + path + "/";
|
|
6183
|
-
|
|
6184
|
-
if (this.url.length > 0) {
|
|
6185
|
-
if (this.url.startsWith('/')) {
|
|
6186
|
-
path = path.replace(this.url.substring(1), '');
|
|
6187
|
-
} else {
|
|
6188
|
-
path = path.replace(this.url, '');
|
|
6189
|
-
}
|
|
6190
|
-
}
|
|
6191
|
-
|
|
6192
|
-
return path;
|
|
6193
|
-
}
|
|
6194
|
-
}, {
|
|
6195
|
-
key: "name",
|
|
6196
|
-
get: function get() {
|
|
6197
|
-
return this.item.title || this.item['@name'];
|
|
6198
|
-
}
|
|
6199
|
-
}, {
|
|
6200
|
-
key: "icon",
|
|
6201
|
-
get: function get() {
|
|
6202
|
-
// eslint-disable-next-line
|
|
6203
|
-
var cfg = useConfig();
|
|
6204
|
-
|
|
6205
|
-
if (cfg.icons && cfg.icons[this.type]) {
|
|
6206
|
-
return cfg.icons[this.type];
|
|
6207
|
-
}
|
|
6208
|
-
|
|
6209
|
-
switch (this.type) {
|
|
6210
|
-
case 'GroupManager':
|
|
6211
|
-
return 'fas fa-users-cog';
|
|
6212
|
-
|
|
6213
|
-
case 'UserManager':
|
|
6214
|
-
return 'fas fa-user-cog';
|
|
6215
|
-
|
|
6216
|
-
case 'User':
|
|
6217
|
-
return 'fas fa-user';
|
|
6218
|
-
|
|
6219
|
-
case 'Group':
|
|
6220
|
-
return 'fas fa-users';
|
|
6221
|
-
|
|
6222
|
-
case 'Folder':
|
|
6223
|
-
return 'fas fa-folder';
|
|
6224
|
-
|
|
6225
|
-
default:
|
|
6226
|
-
return 'fas fa-file';
|
|
6227
|
-
}
|
|
6228
|
-
}
|
|
6229
|
-
}, {
|
|
6230
|
-
key: "fullPath",
|
|
6231
|
-
get: function get() {
|
|
6232
|
-
return this.url + this.item.id;
|
|
6233
|
-
}
|
|
6234
|
-
}, {
|
|
6235
|
-
key: "id",
|
|
6236
|
-
get: function get() {
|
|
6237
|
-
if (this.item.id) {
|
|
6238
|
-
return this.item.id;
|
|
6239
|
-
}
|
|
6240
|
-
|
|
6241
|
-
var id = this.item['@id'].split('&')[0].split('/');
|
|
6242
|
-
return id[id.length - 1];
|
|
6243
|
-
}
|
|
6244
|
-
}, {
|
|
6245
|
-
key: "uid",
|
|
6246
|
-
get: function get() {
|
|
6247
|
-
return this.item['@uid'];
|
|
6248
|
-
}
|
|
6249
|
-
}, {
|
|
6250
|
-
key: "type",
|
|
6251
|
-
get: function get() {
|
|
6252
|
-
return this.item['@type'] || this.item.type_name;
|
|
6253
|
-
}
|
|
6254
|
-
}, {
|
|
6255
|
-
key: "title",
|
|
6256
|
-
get: function get() {
|
|
6257
|
-
return this.item.title;
|
|
6258
|
-
}
|
|
6259
|
-
}, {
|
|
6260
|
-
key: "created",
|
|
6261
|
-
get: function get() {
|
|
6262
|
-
return this.item.creation_date ? formatDate(this.item.creation_date) : '';
|
|
6263
|
-
}
|
|
6264
|
-
}, {
|
|
6265
|
-
key: "updated",
|
|
6266
|
-
get: function get() {
|
|
6267
|
-
return this.item.modification_date ? formatDate(this.item.modification_date) : '';
|
|
6268
|
-
}
|
|
6269
|
-
}]);
|
|
6270
|
-
|
|
6271
|
-
return ItemModel;
|
|
6272
|
-
}();
|
|
6273
|
-
|
|
6274
6314
|
var messages$1 = reactIntl.defineMessages({
|
|
6275
6315
|
status_changed_ok: {
|
|
6276
6316
|
id: "status_changed_ok",
|
|
@@ -6346,13 +6386,12 @@
|
|
|
6346
6386
|
definition = _useState[0],
|
|
6347
6387
|
setDefinition = _useState[1];
|
|
6348
6388
|
|
|
6349
|
-
var _useState2 = React.useState(
|
|
6389
|
+
var _useState2 = React.useState(undefined),
|
|
6350
6390
|
workflowAction = _useState2[0],
|
|
6351
6391
|
setWorkflowAction = _useState2[1];
|
|
6352
6392
|
|
|
6353
|
-
var model = new ItemModel(Ctx.context);
|
|
6354
6393
|
var vocabulary = useVocabulary('workflow_states');
|
|
6355
|
-
var currentState =
|
|
6394
|
+
var currentState = Ctx.context['guillotina.contrib.workflows.interfaces.IWorkflowBehavior']['review_state'];
|
|
6356
6395
|
React.useEffect(function () {
|
|
6357
6396
|
loadDefinition();
|
|
6358
6397
|
}, [Ctx.path]);
|
|
@@ -6372,7 +6411,7 @@
|
|
|
6372
6411
|
}
|
|
6373
6412
|
|
|
6374
6413
|
Ctx.refresh();
|
|
6375
|
-
setWorkflowAction(
|
|
6414
|
+
setWorkflowAction(undefined);
|
|
6376
6415
|
});
|
|
6377
6416
|
});
|
|
6378
6417
|
} catch (e) {
|
|
@@ -6381,21 +6420,23 @@
|
|
|
6381
6420
|
};
|
|
6382
6421
|
|
|
6383
6422
|
var getStateTitle = function getStateTitle() {
|
|
6384
|
-
var _vocabulary$data, _vocabulary$data
|
|
6423
|
+
var _vocabulary$data$item, _vocabulary$data;
|
|
6424
|
+
|
|
6425
|
+
if (((_vocabulary$data$item = (_vocabulary$data = vocabulary.data) == null ? void 0 : _vocabulary$data.items) != null ? _vocabulary$data$item : []).length > 0) {
|
|
6426
|
+
var _vocabulary$data2;
|
|
6385
6427
|
|
|
6386
|
-
|
|
6387
|
-
var vocabularyValue = vocabulary.data.items.find(function (item) {
|
|
6428
|
+
var vocabularyValue = vocabulary == null ? void 0 : (_vocabulary$data2 = vocabulary.data) == null ? void 0 : _vocabulary$data2.items.find(function (item) {
|
|
6388
6429
|
return item.token === currentState;
|
|
6389
6430
|
});
|
|
6390
6431
|
|
|
6391
6432
|
if (vocabularyValue) {
|
|
6392
|
-
var translatedValue = get
|
|
6433
|
+
var translatedValue = get(vocabularyValue, "title.translated_title." + intl.locale, null);
|
|
6393
6434
|
|
|
6394
6435
|
if (translatedValue !== null) {
|
|
6395
6436
|
return translatedValue;
|
|
6396
6437
|
}
|
|
6397
6438
|
|
|
6398
|
-
var titleValue = get
|
|
6439
|
+
var titleValue = get(vocabularyValue, "title.title." + intl.locale, null);
|
|
6399
6440
|
|
|
6400
6441
|
if (titleValue !== null) {
|
|
6401
6442
|
return titleValue;
|
|
@@ -6411,7 +6452,7 @@
|
|
|
6411
6452
|
children: [workflowAction && jsxRuntime.jsx(Confirm, {
|
|
6412
6453
|
loading: loading,
|
|
6413
6454
|
onCancel: function onCancel() {
|
|
6414
|
-
return setWorkflowAction(
|
|
6455
|
+
return setWorkflowAction(undefined);
|
|
6415
6456
|
},
|
|
6416
6457
|
onConfirm: doWorkflowAction,
|
|
6417
6458
|
message: intl.formatMessage(messages$1.confirm_message, {
|
|
@@ -6437,7 +6478,7 @@
|
|
|
6437
6478
|
onClick: function onClick() {
|
|
6438
6479
|
return setWorkflowAction(transition['@id'].split('@workflow')[1].slice(1));
|
|
6439
6480
|
},
|
|
6440
|
-
children: get
|
|
6481
|
+
children: get(transition, "metadata.translated_title." + intl.locale, transition.title)
|
|
6441
6482
|
}, transition['@id']);
|
|
6442
6483
|
})]
|
|
6443
6484
|
})]
|
|
@@ -6463,14 +6504,17 @@
|
|
|
6463
6504
|
|
|
6464
6505
|
return jsxRuntime.jsx(React.Fragment, {
|
|
6465
6506
|
children: Object.keys(ACTIONS_OBJECT).map(function (actionKey) {
|
|
6466
|
-
|
|
6507
|
+
var actionKeyTyped = actionKey;
|
|
6508
|
+
var actionObject = ACTIONS_OBJECT[actionKeyTyped];
|
|
6509
|
+
|
|
6510
|
+
if (hasPerm(actionObject.perms)) {
|
|
6467
6511
|
return jsxRuntime.jsx("button", {
|
|
6468
6512
|
className: "button mr-4",
|
|
6469
6513
|
onClick: function onClick() {
|
|
6470
|
-
onAction(
|
|
6514
|
+
onAction(actionKeyTyped);
|
|
6471
6515
|
},
|
|
6472
|
-
children:
|
|
6473
|
-
}, "panel_action_" +
|
|
6516
|
+
children: actionObject.text
|
|
6517
|
+
}, "panel_action_" + actionObject.text);
|
|
6474
6518
|
}
|
|
6475
6519
|
})
|
|
6476
6520
|
});
|
|
@@ -6668,8 +6712,9 @@
|
|
|
6668
6712
|
|
|
6669
6713
|
var arrayToObject = function arrayToObject(array) {
|
|
6670
6714
|
return array.reduce(function (obj, item) {
|
|
6671
|
-
|
|
6672
|
-
|
|
6715
|
+
var _extends2;
|
|
6716
|
+
|
|
6717
|
+
return _extends({}, obj, (_extends2 = {}, _extends2[item.id] = item, _extends2));
|
|
6673
6718
|
}, {});
|
|
6674
6719
|
};
|
|
6675
6720
|
|
|
@@ -6831,8 +6876,9 @@
|
|
|
6831
6876
|
|
|
6832
6877
|
function onSelectAllItems(checked) {
|
|
6833
6878
|
setSelected(items.reduce(function (obj, item) {
|
|
6834
|
-
|
|
6835
|
-
|
|
6879
|
+
var _extends2;
|
|
6880
|
+
|
|
6881
|
+
return _extends({}, obj, (_extends2 = {}, _extends2[item.path + "/" + item.id] = checked, _extends2));
|
|
6836
6882
|
}, {
|
|
6837
6883
|
all: checked
|
|
6838
6884
|
}));
|
|
@@ -6840,11 +6886,11 @@
|
|
|
6840
6886
|
|
|
6841
6887
|
function onSelectOneItem(item) {
|
|
6842
6888
|
setSelected(function (state) {
|
|
6843
|
-
var
|
|
6889
|
+
var _extends3;
|
|
6844
6890
|
|
|
6845
|
-
return _extends({}, state, (
|
|
6891
|
+
return _extends({}, state, (_extends3 = {
|
|
6846
6892
|
all: false
|
|
6847
|
-
},
|
|
6893
|
+
}, _extends3[item.path + "/" + item.id] = !state[item.path + "/" + item.id], _extends3));
|
|
6848
6894
|
});
|
|
6849
6895
|
}
|
|
6850
6896
|
|
|
@@ -6866,17 +6912,37 @@
|
|
|
6866
6912
|
children: children
|
|
6867
6913
|
});
|
|
6868
6914
|
}
|
|
6915
|
+
|
|
6916
|
+
var useItemsActions = function useItemsActions() {
|
|
6917
|
+
var _useContext = React.useContext(ItemsActionsCtx),
|
|
6918
|
+
onAction = _useContext.onAction,
|
|
6919
|
+
onSelectOneItem = _useContext.onSelectOneItem,
|
|
6920
|
+
onSelectAllItems = _useContext.onSelectAllItems,
|
|
6921
|
+
selected = _useContext.selected;
|
|
6922
|
+
|
|
6923
|
+
if (!onAction || !onSelectOneItem || !onSelectAllItems || !selected) {
|
|
6924
|
+
throw new Error('useItemsActions must be used inside ItemsActionsProvider');
|
|
6925
|
+
}
|
|
6926
|
+
|
|
6927
|
+
return {
|
|
6928
|
+
onAction: onAction,
|
|
6929
|
+
onSelectOneItem: onSelectOneItem,
|
|
6930
|
+
onSelectAllItems: onSelectAllItems,
|
|
6931
|
+
selected: selected
|
|
6932
|
+
};
|
|
6933
|
+
};
|
|
6869
6934
|
/**
|
|
6870
6935
|
* Checkbox component without props that consume the ItemsActionsContext
|
|
6871
6936
|
* and it select/unselect all items of the page.
|
|
6872
6937
|
*/
|
|
6873
6938
|
|
|
6939
|
+
|
|
6874
6940
|
function AllItemsCheckbox(_ref2) {
|
|
6875
6941
|
var dataTest = _ref2.dataTest;
|
|
6876
6942
|
|
|
6877
|
-
var
|
|
6878
|
-
onSelectAllItems =
|
|
6879
|
-
selected =
|
|
6943
|
+
var _useItemsActions = useItemsActions(),
|
|
6944
|
+
onSelectAllItems = _useItemsActions.onSelectAllItems,
|
|
6945
|
+
selected = _useItemsActions.selected;
|
|
6880
6946
|
|
|
6881
6947
|
return jsxRuntime.jsx(Checkbox, {
|
|
6882
6948
|
onChange: onSelectAllItems,
|
|
@@ -6888,9 +6954,9 @@
|
|
|
6888
6954
|
var item = _ref3.item,
|
|
6889
6955
|
dataTest = _ref3.dataTest;
|
|
6890
6956
|
|
|
6891
|
-
var
|
|
6892
|
-
selected =
|
|
6893
|
-
onSelectOneItem =
|
|
6957
|
+
var _useItemsActions2 = useItemsActions(),
|
|
6958
|
+
selected = _useItemsActions2.selected,
|
|
6959
|
+
onSelectOneItem = _useItemsActions2.onSelectOneItem;
|
|
6894
6960
|
|
|
6895
6961
|
var absId = item.path + "/" + item.id;
|
|
6896
6962
|
var value = selected[absId];
|
|
@@ -6911,9 +6977,9 @@
|
|
|
6911
6977
|
var ACTIONS_OBJECT = getActionsObject(intl, true);
|
|
6912
6978
|
var traversal = useTraversal();
|
|
6913
6979
|
|
|
6914
|
-
var
|
|
6915
|
-
selected =
|
|
6916
|
-
onAction =
|
|
6980
|
+
var _useItemsActions3 = useItemsActions(),
|
|
6981
|
+
selected = _useItemsActions3.selected,
|
|
6982
|
+
onAction = _useItemsActions3.onAction;
|
|
6917
6983
|
|
|
6918
6984
|
var disabled = Object.values(selected).every(function (v) {
|
|
6919
6985
|
return !v;
|
|
@@ -7024,6 +7090,170 @@
|
|
|
7024
7090
|
});
|
|
7025
7091
|
}
|
|
7026
7092
|
|
|
7093
|
+
var base = {
|
|
7094
|
+
local: {
|
|
7095
|
+
roleperm: {},
|
|
7096
|
+
prinperm: {},
|
|
7097
|
+
prinrole: {}
|
|
7098
|
+
},
|
|
7099
|
+
inherit: []
|
|
7100
|
+
};
|
|
7101
|
+
var Sharing = /*#__PURE__*/function () {
|
|
7102
|
+
function Sharing(element) {
|
|
7103
|
+
this.local = void 0;
|
|
7104
|
+
this.inherit = void 0;
|
|
7105
|
+
|
|
7106
|
+
if (element === undefined) {
|
|
7107
|
+
throw new Error('Sharing element is undefined');
|
|
7108
|
+
}
|
|
7109
|
+
|
|
7110
|
+
this.local = element.local || base.local;
|
|
7111
|
+
this.inherit = element.inherit || base.inherit;
|
|
7112
|
+
}
|
|
7113
|
+
|
|
7114
|
+
var _proto = Sharing.prototype;
|
|
7115
|
+
|
|
7116
|
+
_proto.getRole = function getRole(role) {
|
|
7117
|
+
return this.local.roleperm[role];
|
|
7118
|
+
};
|
|
7119
|
+
|
|
7120
|
+
_proto.getPrincipals = function getPrincipals(principal) {
|
|
7121
|
+
return this.local.prinperm[principal];
|
|
7122
|
+
};
|
|
7123
|
+
|
|
7124
|
+
_proto.getPrinroles = function getPrinroles(role) {
|
|
7125
|
+
return this.local.prinrole[role];
|
|
7126
|
+
};
|
|
7127
|
+
|
|
7128
|
+
_createClass(Sharing, [{
|
|
7129
|
+
key: "roles",
|
|
7130
|
+
get: function get() {
|
|
7131
|
+
return Object.keys(this.local.roleperm);
|
|
7132
|
+
}
|
|
7133
|
+
}, {
|
|
7134
|
+
key: "principals",
|
|
7135
|
+
get: function get() {
|
|
7136
|
+
return Object.keys(this.local.prinperm);
|
|
7137
|
+
}
|
|
7138
|
+
}, {
|
|
7139
|
+
key: "prinrole",
|
|
7140
|
+
get: function get() {
|
|
7141
|
+
return Object.keys(this.local.prinrole);
|
|
7142
|
+
}
|
|
7143
|
+
}]);
|
|
7144
|
+
|
|
7145
|
+
return Sharing;
|
|
7146
|
+
}();
|
|
7147
|
+
|
|
7148
|
+
var ItemModel = /*#__PURE__*/function () {
|
|
7149
|
+
function ItemModel(item, url) {
|
|
7150
|
+
if (url === void 0) {
|
|
7151
|
+
url = '';
|
|
7152
|
+
}
|
|
7153
|
+
|
|
7154
|
+
this.item = void 0;
|
|
7155
|
+
this.url = void 0;
|
|
7156
|
+
this.item = item;
|
|
7157
|
+
this.url = url;
|
|
7158
|
+
}
|
|
7159
|
+
|
|
7160
|
+
_createClass(ItemModel, [{
|
|
7161
|
+
key: "path",
|
|
7162
|
+
get: function get() {
|
|
7163
|
+
// Compat
|
|
7164
|
+
var item = this.item['@id'] ? this.item['@id'] : this.item['@absolute_url'];
|
|
7165
|
+
var path = item.split('//')[1].split('/').splice(1).join('/');
|
|
7166
|
+
path = "/" + path + "/";
|
|
7167
|
+
|
|
7168
|
+
if (this.url.length > 0) {
|
|
7169
|
+
if (this.url.startsWith('/')) {
|
|
7170
|
+
path = path.replace(this.url.substring(1), '');
|
|
7171
|
+
} else {
|
|
7172
|
+
path = path.replace(this.url, '');
|
|
7173
|
+
}
|
|
7174
|
+
}
|
|
7175
|
+
|
|
7176
|
+
return path;
|
|
7177
|
+
}
|
|
7178
|
+
}, {
|
|
7179
|
+
key: "name",
|
|
7180
|
+
get: function get() {
|
|
7181
|
+
return this.item.title || this.item['@name'];
|
|
7182
|
+
}
|
|
7183
|
+
}, {
|
|
7184
|
+
key: "icon",
|
|
7185
|
+
get: function get() {
|
|
7186
|
+
var cfg = useConfig();
|
|
7187
|
+
|
|
7188
|
+
if (cfg.icons && cfg.icons[this.type]) {
|
|
7189
|
+
return cfg.icons[this.type];
|
|
7190
|
+
}
|
|
7191
|
+
|
|
7192
|
+
switch (this.type) {
|
|
7193
|
+
case 'GroupManager':
|
|
7194
|
+
return 'fas fa-users-cog';
|
|
7195
|
+
|
|
7196
|
+
case 'UserManager':
|
|
7197
|
+
return 'fas fa-user-cog';
|
|
7198
|
+
|
|
7199
|
+
case 'User':
|
|
7200
|
+
return 'fas fa-user';
|
|
7201
|
+
|
|
7202
|
+
case 'Group':
|
|
7203
|
+
return 'fas fa-users';
|
|
7204
|
+
|
|
7205
|
+
case 'Folder':
|
|
7206
|
+
return 'fas fa-folder';
|
|
7207
|
+
|
|
7208
|
+
default:
|
|
7209
|
+
return 'fas fa-file';
|
|
7210
|
+
}
|
|
7211
|
+
}
|
|
7212
|
+
}, {
|
|
7213
|
+
key: "fullPath",
|
|
7214
|
+
get: function get() {
|
|
7215
|
+
return this.url + this.id;
|
|
7216
|
+
}
|
|
7217
|
+
}, {
|
|
7218
|
+
key: "id",
|
|
7219
|
+
get: function get() {
|
|
7220
|
+
if ('id' in this.item) {
|
|
7221
|
+
return this.item.id;
|
|
7222
|
+
}
|
|
7223
|
+
|
|
7224
|
+
var id = this.item['@id'].split('&')[0].split('/');
|
|
7225
|
+
return id[id.length - 1];
|
|
7226
|
+
}
|
|
7227
|
+
}, {
|
|
7228
|
+
key: "uid",
|
|
7229
|
+
get: function get() {
|
|
7230
|
+
return this.item['@uid'];
|
|
7231
|
+
}
|
|
7232
|
+
}, {
|
|
7233
|
+
key: "type",
|
|
7234
|
+
get: function get() {
|
|
7235
|
+
return this.item['@type'] || this.item.type_name;
|
|
7236
|
+
}
|
|
7237
|
+
}, {
|
|
7238
|
+
key: "title",
|
|
7239
|
+
get: function get() {
|
|
7240
|
+
return this.item.title;
|
|
7241
|
+
}
|
|
7242
|
+
}, {
|
|
7243
|
+
key: "created",
|
|
7244
|
+
get: function get() {
|
|
7245
|
+
return this.item.creation_date ? formatDate(this.item.creation_date) : '';
|
|
7246
|
+
}
|
|
7247
|
+
}, {
|
|
7248
|
+
key: "updated",
|
|
7249
|
+
get: function get() {
|
|
7250
|
+
return this.item.modification_date ? formatDate(this.item.modification_date) : '';
|
|
7251
|
+
}
|
|
7252
|
+
}]);
|
|
7253
|
+
|
|
7254
|
+
return ItemModel;
|
|
7255
|
+
}();
|
|
7256
|
+
|
|
7027
7257
|
function Item(_ref) {
|
|
7028
7258
|
var item = _ref.item,
|
|
7029
7259
|
icon = _ref.icon;
|
|
@@ -7164,11 +7394,11 @@
|
|
|
7164
7394
|
renderValue = _useState[0],
|
|
7165
7395
|
setRenderValue = _useState[1];
|
|
7166
7396
|
|
|
7167
|
-
var defaultRenderValue = location.get(query);
|
|
7397
|
+
var defaultRenderValue = location.get(query) || '';
|
|
7168
7398
|
React.useEffect(function () {
|
|
7169
7399
|
var value = defaultRenderValue;
|
|
7170
7400
|
|
|
7171
|
-
if ((options != null ? options : []).length > 0) {
|
|
7401
|
+
if (options && (options != null ? options : []).length > 0) {
|
|
7172
7402
|
var option = options.find(function (item) {
|
|
7173
7403
|
return item.value === value;
|
|
7174
7404
|
});
|
|
@@ -7217,14 +7447,16 @@
|
|
|
7217
7447
|
setRenderValue = _useState[1];
|
|
7218
7448
|
|
|
7219
7449
|
var vocabulary = useVocabulary(vocabularyName);
|
|
7220
|
-
var defaultRenderValue = location.get(query);
|
|
7450
|
+
var defaultRenderValue = location.get(query) || '';
|
|
7221
7451
|
React.useEffect(function () {
|
|
7222
7452
|
var _vocabulary$data$item, _vocabulary$data;
|
|
7223
7453
|
|
|
7224
7454
|
var value = defaultRenderValue;
|
|
7225
7455
|
|
|
7226
7456
|
if (((_vocabulary$data$item = vocabulary == null ? void 0 : (_vocabulary$data = vocabulary.data) == null ? void 0 : _vocabulary$data.items) != null ? _vocabulary$data$item : []).length > 0) {
|
|
7227
|
-
var
|
|
7457
|
+
var _vocabulary$data2;
|
|
7458
|
+
|
|
7459
|
+
var vocabularyValue = vocabulary == null ? void 0 : (_vocabulary$data2 = vocabulary.data) == null ? void 0 : _vocabulary$data2.items.find(function (item) {
|
|
7228
7460
|
return item.token === value;
|
|
7229
7461
|
});
|
|
7230
7462
|
|
|
@@ -7258,7 +7490,7 @@
|
|
|
7258
7490
|
return null;
|
|
7259
7491
|
}
|
|
7260
7492
|
|
|
7261
|
-
var initialState$
|
|
7493
|
+
var initialState$3 = {
|
|
7262
7494
|
page: 0,
|
|
7263
7495
|
items: [],
|
|
7264
7496
|
loading: true,
|
|
@@ -7277,7 +7509,7 @@
|
|
|
7277
7509
|
var intl = reactIntl.useIntl();
|
|
7278
7510
|
var Ctx = useTraversal();
|
|
7279
7511
|
|
|
7280
|
-
var _useSetState = useSetState(initialState$
|
|
7512
|
+
var _useSetState = useSetState(initialState$3),
|
|
7281
7513
|
state = _useSetState[0],
|
|
7282
7514
|
setState = _useSetState[1];
|
|
7283
7515
|
|
|
@@ -7293,7 +7525,7 @@
|
|
|
7293
7525
|
var page;
|
|
7294
7526
|
|
|
7295
7527
|
try {
|
|
7296
|
-
page = parseInt(location.get('page')
|
|
7528
|
+
page = parseInt(location.get('page') || '0');
|
|
7297
7529
|
} catch (_unused) {
|
|
7298
7530
|
page = 0;
|
|
7299
7531
|
}
|
|
@@ -7340,7 +7572,7 @@
|
|
|
7340
7572
|
var resultQueryParams = [];
|
|
7341
7573
|
var resultDynamicLocation = [];
|
|
7342
7574
|
filterSchema.forEach(function (filter) {
|
|
7343
|
-
var itemParam = location.get(filter.attribute_key);
|
|
7575
|
+
var itemParam = location.get(filter.attribute_key) || '';
|
|
7344
7576
|
resultDynamicLocation.push(itemParam);
|
|
7345
7577
|
|
|
7346
7578
|
if (itemParam) {
|
|
@@ -7352,53 +7584,51 @@
|
|
|
7352
7584
|
var controller = new AbortController();
|
|
7353
7585
|
if (Ctx.state.loading) return;
|
|
7354
7586
|
|
|
7355
|
-
|
|
7356
|
-
|
|
7357
|
-
|
|
7358
|
-
|
|
7359
|
-
|
|
7360
|
-
var get = Ctx.registry.get;
|
|
7361
|
-
var fnName = get('searchEngineQueryParamsFunction', SearchEngine);
|
|
7362
|
-
|
|
7363
|
-
if (sortParsed === undefined) {
|
|
7364
|
-
var defaultSortValue = Ctx.registry.getDefaultSortValue(Ctx.context['@type'], {
|
|
7365
|
-
key: 'id',
|
|
7366
|
-
direction: 'des'
|
|
7587
|
+
var getData = function getData() {
|
|
7588
|
+
try {
|
|
7589
|
+
setState({
|
|
7590
|
+
loading: true,
|
|
7591
|
+
total: Ctx.context.length
|
|
7367
7592
|
});
|
|
7368
|
-
|
|
7369
|
-
|
|
7593
|
+
var get = Ctx.registry.get;
|
|
7594
|
+
var fnName = get('searchEngineQueryParamsFunction', SearchEngine);
|
|
7370
7595
|
|
|
7371
|
-
|
|
7372
|
-
|
|
7373
|
-
|
|
7374
|
-
|
|
7375
|
-
});
|
|
7376
|
-
var qs = '';
|
|
7596
|
+
if (sortParsed === undefined) {
|
|
7597
|
+
var defaultSortValue = Ctx.registry.getDefaultSortValue(Ctx.context['@type']);
|
|
7598
|
+
sortParsed = parser("_sort_" + defaultSortValue.direction + "=" + defaultSortValue.key);
|
|
7599
|
+
}
|
|
7377
7600
|
|
|
7378
|
-
|
|
7379
|
-
|
|
7601
|
+
var qsParsed = Ctx.client.getQueryParamsSearchFunction(fnName)({
|
|
7602
|
+
path: Ctx.path,
|
|
7603
|
+
start: page * PageSize,
|
|
7604
|
+
pageSize: PageSize
|
|
7605
|
+
});
|
|
7606
|
+
var qs = '';
|
|
7380
7607
|
|
|
7381
|
-
|
|
7382
|
-
|
|
7383
|
-
var _sortParsed2;
|
|
7608
|
+
if (search || type || resultQueryParams.length > 0) {
|
|
7609
|
+
var _searchParsed, _typeParsed, _sortParsed;
|
|
7384
7610
|
|
|
7385
|
-
|
|
7386
|
-
|
|
7611
|
+
qs = buildQs([].concat(qsParsed, (_searchParsed = searchParsed) != null ? _searchParsed : [], (_typeParsed = typeParsed) != null ? _typeParsed : [], (_sortParsed = sortParsed) != null ? _sortParsed : [], resultQueryParams));
|
|
7612
|
+
} else {
|
|
7613
|
+
var _sortParsed2;
|
|
7387
7614
|
|
|
7388
|
-
|
|
7389
|
-
|
|
7390
|
-
|
|
7391
|
-
|
|
7392
|
-
|
|
7393
|
-
|
|
7394
|
-
|
|
7395
|
-
|
|
7615
|
+
qs = buildQs([].concat(qsParsed, (_sortParsed2 = sortParsed) != null ? _sortParsed2 : []));
|
|
7616
|
+
}
|
|
7617
|
+
|
|
7618
|
+
var signal = controller.signal;
|
|
7619
|
+
return Promise.resolve(Ctx.client.search(Ctx.path, qs, false, false, signal)).then(function (data) {
|
|
7620
|
+
setState({
|
|
7621
|
+
items: data.items,
|
|
7622
|
+
loading: false,
|
|
7623
|
+
total: data.items_count
|
|
7624
|
+
});
|
|
7396
7625
|
});
|
|
7397
|
-
})
|
|
7398
|
-
|
|
7399
|
-
|
|
7400
|
-
}
|
|
7626
|
+
} catch (e) {
|
|
7627
|
+
return Promise.reject(e);
|
|
7628
|
+
}
|
|
7629
|
+
};
|
|
7401
7630
|
|
|
7631
|
+
getData();
|
|
7402
7632
|
return function () {
|
|
7403
7633
|
controller.abort();
|
|
7404
7634
|
};
|
|
@@ -7443,12 +7673,14 @@
|
|
|
7443
7673
|
var _filter$values;
|
|
7444
7674
|
|
|
7445
7675
|
if (filter.type === 'select' && ((_filter$values = filter.values) != null ? _filter$values : []).length > 0) {
|
|
7676
|
+
var _filter$values2;
|
|
7677
|
+
|
|
7446
7678
|
return jsxRuntime.jsx(Select, {
|
|
7447
7679
|
id: filter.attribute_key,
|
|
7448
7680
|
placeholder: filter.label,
|
|
7449
7681
|
appendDefault: true,
|
|
7450
7682
|
classWrap: "is-size-7 is-fullwidth",
|
|
7451
|
-
options: filter.values,
|
|
7683
|
+
options: (_filter$values2 = filter.values) != null ? _filter$values2 : [],
|
|
7452
7684
|
value: location.get(filter.attribute_key) || '',
|
|
7453
7685
|
dataTest: "filterInput" + filter.attribute_key,
|
|
7454
7686
|
onChange: function onChange(value) {
|
|
@@ -7515,7 +7747,7 @@
|
|
|
7515
7747
|
var filterData = location.get(filter.attribute_key);
|
|
7516
7748
|
|
|
7517
7749
|
if (filterData) {
|
|
7518
|
-
var _filter$
|
|
7750
|
+
var _filter$values3;
|
|
7519
7751
|
|
|
7520
7752
|
if (filter.type === 'select' && filter.vocabulary) {
|
|
7521
7753
|
return jsxRuntime.jsx("div", {
|
|
@@ -7524,7 +7756,7 @@
|
|
|
7524
7756
|
vocabularyName: filter == null ? void 0 : filter.vocabulary
|
|
7525
7757
|
})
|
|
7526
7758
|
}, filter.attribute_key);
|
|
7527
|
-
} else if (filter.type === 'select' && ((_filter$
|
|
7759
|
+
} else if (filter.type === 'select' && ((_filter$values3 = filter.values) != null ? _filter$values3 : []).length > 0) {
|
|
7528
7760
|
return jsxRuntime.jsx("div", {
|
|
7529
7761
|
children: jsxRuntime.jsx(SearchOptionsLabels, {
|
|
7530
7762
|
query: filter.attribute_key,
|
|
@@ -7570,7 +7802,7 @@
|
|
|
7570
7802
|
className: "has-text-info is-flex is-align-items-center",
|
|
7571
7803
|
children: [jsxRuntime.jsx("span", {
|
|
7572
7804
|
children: column.label
|
|
7573
|
-
}), getIcon(column.key, column.isSortable)]
|
|
7805
|
+
}), getIcon(column.key, !!column.isSortable)]
|
|
7574
7806
|
})
|
|
7575
7807
|
}, "table-col-" + column.label);
|
|
7576
7808
|
}), jsxRuntime.jsx("th", {
|
|
@@ -7581,7 +7813,7 @@
|
|
|
7581
7813
|
children: [items && items.map(function (item) {
|
|
7582
7814
|
return jsxRuntime.jsx(RItem, {
|
|
7583
7815
|
item: item,
|
|
7584
|
-
search: search,
|
|
7816
|
+
search: search != null ? search : '',
|
|
7585
7817
|
columns: columns
|
|
7586
7818
|
}, item['@uid']);
|
|
7587
7819
|
}), items && items.length === 0 && jsxRuntime.jsx("tr", {
|
|
@@ -7605,17 +7837,19 @@
|
|
|
7605
7837
|
}
|
|
7606
7838
|
|
|
7607
7839
|
function BehaviorsView(_ref) {
|
|
7840
|
+
var _context$__behaviors_;
|
|
7841
|
+
|
|
7608
7842
|
var context = _ref.context,
|
|
7609
7843
|
schema = _ref.schema;
|
|
7610
7844
|
var Ctx = useTraversal();
|
|
7611
7845
|
var getBehavior = Ctx.registry.getBehavior;
|
|
7612
|
-
var behaviors = [].concat(context.__behaviors__, context['@static_behaviors']);
|
|
7846
|
+
var behaviors = [].concat((_context$__behaviors_ = context.__behaviors__) != null ? _context$__behaviors_ : [], Object(context['@static_behaviors']));
|
|
7613
7847
|
|
|
7614
|
-
var GetBehavior = function GetBehavior(
|
|
7615
|
-
var Cls = getBehavior(
|
|
7848
|
+
var GetBehavior = function GetBehavior(behaviorName) {
|
|
7849
|
+
var Cls = getBehavior(behaviorName, BehaviorNotImplemented);
|
|
7616
7850
|
return jsxRuntime.jsx(Cls, {
|
|
7617
|
-
values: context[
|
|
7618
|
-
properties: get
|
|
7851
|
+
values: context[behaviorName],
|
|
7852
|
+
properties: get(schema, ['definitions', behaviorName, 'properties'], {})
|
|
7619
7853
|
});
|
|
7620
7854
|
};
|
|
7621
7855
|
|
|
@@ -7711,9 +7945,11 @@
|
|
|
7711
7945
|
var properties = Object.keys((schema == null ? void 0 : (_schema$data = schema.data) == null ? void 0 : _schema$data.properties) || []).filter(function (key) {
|
|
7712
7946
|
return !ignoreFields.includes(key);
|
|
7713
7947
|
}).map(function (key) {
|
|
7948
|
+
var _schema$data2;
|
|
7949
|
+
|
|
7714
7950
|
return {
|
|
7715
7951
|
key: key,
|
|
7716
|
-
value: schema.data.properties[key]
|
|
7952
|
+
value: schema == null ? void 0 : (_schema$data2 = schema.data) == null ? void 0 : _schema$data2.properties[key]
|
|
7717
7953
|
};
|
|
7718
7954
|
});
|
|
7719
7955
|
React.useEffect(function () {
|
|
@@ -7725,7 +7961,7 @@
|
|
|
7725
7961
|
setSchema({
|
|
7726
7962
|
loading: true
|
|
7727
7963
|
});
|
|
7728
|
-
return Promise.resolve(Ctx.client.getTypeSchema(Ctx.path,
|
|
7964
|
+
return Promise.resolve(Ctx.client.getTypeSchema(Ctx.path, Ctx.context.type_name)).then(function (dataJson) {
|
|
7729
7965
|
setSchema({
|
|
7730
7966
|
loading: false,
|
|
7731
7967
|
data: dataJson
|
|
@@ -7800,7 +8036,7 @@
|
|
|
7800
8036
|
}), jsxRuntime.jsx("td", {
|
|
7801
8037
|
children: jsxRuntime.jsx(EditableField, {
|
|
7802
8038
|
field: prop,
|
|
7803
|
-
value: Ctx.context
|
|
8039
|
+
value: get(Ctx.context, prop, ''),
|
|
7804
8040
|
modifyContent: false
|
|
7805
8041
|
})
|
|
7806
8042
|
})]
|
|
@@ -7824,7 +8060,7 @@
|
|
|
7824
8060
|
})
|
|
7825
8061
|
}), jsxRuntime.jsx("tbody", {
|
|
7826
8062
|
children: properties.map(function (_ref) {
|
|
7827
|
-
var _schema$data$required, _schema$
|
|
8063
|
+
var _schema$data$required, _schema$data3;
|
|
7828
8064
|
|
|
7829
8065
|
var key = _ref.key,
|
|
7830
8066
|
value = _ref.value;
|
|
@@ -7837,10 +8073,10 @@
|
|
|
7837
8073
|
}), jsxRuntime.jsx("td", {
|
|
7838
8074
|
children: jsxRuntime.jsx(EditableField, {
|
|
7839
8075
|
field: key,
|
|
7840
|
-
value: Ctx.context
|
|
8076
|
+
value: get(Ctx.context, key, ''),
|
|
7841
8077
|
schema: value,
|
|
7842
8078
|
modifyContent: modifyContent,
|
|
7843
|
-
required: ((_schema$data$required = (_schema$
|
|
8079
|
+
required: ((_schema$data$required = (_schema$data3 = schema.data) == null ? void 0 : _schema$data3.required) != null ? _schema$data$required : []).includes(key)
|
|
7844
8080
|
})
|
|
7845
8081
|
})]
|
|
7846
8082
|
}, 'prop' + key);
|
|
@@ -7876,14 +8112,6 @@
|
|
|
7876
8112
|
state = _useSetState[0],
|
|
7877
8113
|
setState = _useSetState[1];
|
|
7878
8114
|
|
|
7879
|
-
var getMultiples = function getMultiples(field, setter) {
|
|
7880
|
-
return function (values) {
|
|
7881
|
-
var _setter;
|
|
7882
|
-
|
|
7883
|
-
setter((_setter = {}, _setter[field] = values, _setter));
|
|
7884
|
-
};
|
|
7885
|
-
};
|
|
7886
|
-
|
|
7887
8115
|
var savePermission = function savePermission() {
|
|
7888
8116
|
try {
|
|
7889
8117
|
if (!state.principal || !state.setting || state.permission.length === 0) {
|
|
@@ -7933,7 +8161,7 @@
|
|
|
7933
8161
|
children: intl.formatMessage(genericMessages.select_principal)
|
|
7934
8162
|
}), jsxRuntime.jsx(Select, {
|
|
7935
8163
|
appendDefault: true,
|
|
7936
|
-
options: principals,
|
|
8164
|
+
options: principals != null ? principals : [],
|
|
7937
8165
|
onChange: function onChange(value) {
|
|
7938
8166
|
return setState({
|
|
7939
8167
|
principal: value
|
|
@@ -7947,8 +8175,12 @@
|
|
|
7947
8175
|
className: "label",
|
|
7948
8176
|
children: intl.formatMessage(genericMessages.select_permissions)
|
|
7949
8177
|
}), jsxRuntime.jsx(Select, {
|
|
7950
|
-
options: permissions,
|
|
7951
|
-
onChange:
|
|
8178
|
+
options: permissions != null ? permissions : [],
|
|
8179
|
+
onChange: function onChange(values) {
|
|
8180
|
+
setState({
|
|
8181
|
+
permission: values
|
|
8182
|
+
});
|
|
8183
|
+
},
|
|
7952
8184
|
size: 5,
|
|
7953
8185
|
multiple: true,
|
|
7954
8186
|
dataTest: "selectPermissionsTest"
|
|
@@ -7999,14 +8231,6 @@
|
|
|
7999
8231
|
state = _useSetState[0],
|
|
8000
8232
|
setState = _useSetState[1];
|
|
8001
8233
|
|
|
8002
|
-
var getMultiples = function getMultiples(field, setter) {
|
|
8003
|
-
return function (values) {
|
|
8004
|
-
var _setter;
|
|
8005
|
-
|
|
8006
|
-
setter((_setter = {}, _setter[field] = values, _setter));
|
|
8007
|
-
};
|
|
8008
|
-
};
|
|
8009
|
-
|
|
8010
8234
|
var savePermission = function savePermission() {
|
|
8011
8235
|
try {
|
|
8012
8236
|
if (!state.principal || !state.setting || state.roles.length === 0) {
|
|
@@ -8056,7 +8280,7 @@
|
|
|
8056
8280
|
children: intl.formatMessage(genericMessages.select_principal)
|
|
8057
8281
|
}), jsxRuntime.jsx(Select, {
|
|
8058
8282
|
appendDefault: true,
|
|
8059
|
-
options: principals,
|
|
8283
|
+
options: principals != null ? principals : [],
|
|
8060
8284
|
onChange: function onChange(value) {
|
|
8061
8285
|
return setState({
|
|
8062
8286
|
principal: value
|
|
@@ -8071,7 +8295,11 @@
|
|
|
8071
8295
|
children: intl.formatMessage(genericMessages.select_role)
|
|
8072
8296
|
}), jsxRuntime.jsx(Select, {
|
|
8073
8297
|
options: roles,
|
|
8074
|
-
onChange:
|
|
8298
|
+
onChange: function onChange(values) {
|
|
8299
|
+
setState({
|
|
8300
|
+
roles: values
|
|
8301
|
+
});
|
|
8302
|
+
},
|
|
8075
8303
|
size: 5,
|
|
8076
8304
|
multiple: true,
|
|
8077
8305
|
dataTest: "selectRoleTest"
|
|
@@ -8122,14 +8350,6 @@
|
|
|
8122
8350
|
state = _useSetState[0],
|
|
8123
8351
|
setState = _useSetState[1];
|
|
8124
8352
|
|
|
8125
|
-
var getMultiples = function getMultiples(field, setter) {
|
|
8126
|
-
return function (values) {
|
|
8127
|
-
var _setter;
|
|
8128
|
-
|
|
8129
|
-
setter((_setter = {}, _setter[field] = values, _setter));
|
|
8130
|
-
};
|
|
8131
|
-
};
|
|
8132
|
-
|
|
8133
8353
|
var savePermission = function savePermission() {
|
|
8134
8354
|
try {
|
|
8135
8355
|
if (!state.role || !state.setting || state.permission.length === 0) {
|
|
@@ -8193,8 +8413,12 @@
|
|
|
8193
8413
|
className: "label",
|
|
8194
8414
|
children: intl.formatMessage(genericMessages.select_permissions)
|
|
8195
8415
|
}), jsxRuntime.jsx(Select, {
|
|
8196
|
-
options: permissions,
|
|
8197
|
-
onChange:
|
|
8416
|
+
options: permissions != null ? permissions : [],
|
|
8417
|
+
onChange: function onChange(values) {
|
|
8418
|
+
setState({
|
|
8419
|
+
permission: values
|
|
8420
|
+
});
|
|
8421
|
+
},
|
|
8198
8422
|
dataTest: "selectPermissionsTest",
|
|
8199
8423
|
size: 5,
|
|
8200
8424
|
multiple: true
|
|
@@ -8327,7 +8551,18 @@
|
|
|
8327
8551
|
React.useEffect(function () {
|
|
8328
8552
|
get('@sharing');
|
|
8329
8553
|
}, [reset]);
|
|
8330
|
-
var perms =
|
|
8554
|
+
var perms = React.useMemo(function () {
|
|
8555
|
+
if (result) {
|
|
8556
|
+
return new Sharing(result);
|
|
8557
|
+
}
|
|
8558
|
+
|
|
8559
|
+
return null;
|
|
8560
|
+
}, [result]);
|
|
8561
|
+
|
|
8562
|
+
if (perms === null) {
|
|
8563
|
+
return null;
|
|
8564
|
+
}
|
|
8565
|
+
|
|
8331
8566
|
return jsxRuntime.jsxs("div", {
|
|
8332
8567
|
className: "columns",
|
|
8333
8568
|
children: [!loading && jsxRuntime.jsxs("div", {
|
|
@@ -8485,14 +8720,14 @@
|
|
|
8485
8720
|
return Promise.resolve(Ctx.client.getPrincipals(Ctx.path)).then(function (principalsData) {
|
|
8486
8721
|
var groups = principalsData.groups.map(function (group) {
|
|
8487
8722
|
return {
|
|
8488
|
-
text: group
|
|
8489
|
-
value: group
|
|
8723
|
+
text: group['@name'],
|
|
8724
|
+
value: group['@name']
|
|
8490
8725
|
};
|
|
8491
8726
|
});
|
|
8492
8727
|
var users = principalsData.users.map(function (user) {
|
|
8493
8728
|
return {
|
|
8494
|
-
text: user.fullname || user
|
|
8495
|
-
value: user
|
|
8729
|
+
text: user.fullname || user['@name'],
|
|
8730
|
+
value: user['@name']
|
|
8496
8731
|
};
|
|
8497
8732
|
});
|
|
8498
8733
|
principals = [].concat(groups, users);
|
|
@@ -8563,18 +8798,6 @@
|
|
|
8563
8798
|
text: "Add " + title
|
|
8564
8799
|
};
|
|
8565
8800
|
if (items.length === 0) return [];
|
|
8566
|
-
|
|
8567
|
-
if (items[0] && typeof items[0] === 'string') {
|
|
8568
|
-
return [def].concat(items.map(function (x) {
|
|
8569
|
-
return {
|
|
8570
|
-
value: x,
|
|
8571
|
-
text: x
|
|
8572
|
-
};
|
|
8573
|
-
})).filter(function (item) {
|
|
8574
|
-
return !already.includes(item.value);
|
|
8575
|
-
});
|
|
8576
|
-
}
|
|
8577
|
-
|
|
8578
8801
|
return [def].concat(items).filter(function (item) {
|
|
8579
8802
|
return !already.includes(item.value);
|
|
8580
8803
|
});
|
|
@@ -8587,7 +8810,7 @@
|
|
|
8587
8810
|
noData = _ref.noData,
|
|
8588
8811
|
onChange = _ref.onChange,
|
|
8589
8812
|
loading = _ref.loading;
|
|
8590
|
-
var selectRef = React.useRef();
|
|
8813
|
+
var selectRef = React.useRef(null);
|
|
8591
8814
|
|
|
8592
8815
|
var _useState = React.useState(items),
|
|
8593
8816
|
result = _useState[0],
|
|
@@ -8635,7 +8858,7 @@
|
|
|
8635
8858
|
marginBottom: '20px'
|
|
8636
8859
|
},
|
|
8637
8860
|
children: noData
|
|
8638
|
-
}), available.length > 1 && jsxRuntime.jsx("li", {
|
|
8861
|
+
}), (available != null ? available : []).length > 1 && jsxRuntime.jsx("li", {
|
|
8639
8862
|
className: "widget-list-add select is-small",
|
|
8640
8863
|
children: jsxRuntime.jsx(Select, {
|
|
8641
8864
|
options: availableData,
|
|
@@ -8653,13 +8876,13 @@
|
|
|
8653
8876
|
});
|
|
8654
8877
|
}
|
|
8655
8878
|
|
|
8656
|
-
var initialState$
|
|
8657
|
-
types:
|
|
8879
|
+
var initialState$4 = {
|
|
8880
|
+
types: []
|
|
8658
8881
|
};
|
|
8659
8882
|
function CreateButton() {
|
|
8660
8883
|
var intl = reactIntl.useIntl();
|
|
8661
8884
|
|
|
8662
|
-
var _useSetState = useSetState(initialState$
|
|
8885
|
+
var _useSetState = useSetState(initialState$4),
|
|
8663
8886
|
state = _useSetState[0],
|
|
8664
8887
|
setState = _useSetState[1];
|
|
8665
8888
|
|
|
@@ -8747,7 +8970,7 @@
|
|
|
8747
8970
|
var AddButton = _ref.AddButton;
|
|
8748
8971
|
var intl = reactIntl.useIntl();
|
|
8749
8972
|
|
|
8750
|
-
var _useSetState2 = useSetState(initialState$
|
|
8973
|
+
var _useSetState2 = useSetState(initialState$4),
|
|
8751
8974
|
state = _useSetState2[0],
|
|
8752
8975
|
setState = _useSetState2[1];
|
|
8753
8976
|
|
|
@@ -8758,7 +8981,7 @@
|
|
|
8758
8981
|
|
|
8759
8982
|
var traversal = useTraversal();
|
|
8760
8983
|
var Config = useConfig();
|
|
8761
|
-
var searchText = location.get('q');
|
|
8984
|
+
var searchText = location.get('q') || '';
|
|
8762
8985
|
|
|
8763
8986
|
var _useState = React.useState(searchText || ''),
|
|
8764
8987
|
searchValue = _useState[0],
|
|
@@ -8771,14 +8994,13 @@
|
|
|
8771
8994
|
setSearchValue(searchText);
|
|
8772
8995
|
}, [searchText]);
|
|
8773
8996
|
|
|
8774
|
-
var onSearchQuery = function onSearchQuery(
|
|
8775
|
-
|
|
8997
|
+
var onSearchQuery = function onSearchQuery(event) {
|
|
8998
|
+
event.preventDefault();
|
|
8776
8999
|
setLocation({
|
|
8777
|
-
q:
|
|
9000
|
+
q: event.currentTarget.elements.filterInput.value,
|
|
8778
9001
|
tab: 'Items',
|
|
8779
9002
|
page: 0
|
|
8780
9003
|
});
|
|
8781
|
-
ev.preventDefault();
|
|
8782
9004
|
};
|
|
8783
9005
|
|
|
8784
9006
|
var onSearchByType = function onSearchByType(typeText) {
|
|
@@ -8812,7 +9034,8 @@
|
|
|
8812
9034
|
type: "text",
|
|
8813
9035
|
className: "input is-size-7",
|
|
8814
9036
|
placeholder: intl.formatMessage(genericMessages.search),
|
|
8815
|
-
"data-test": "inputFilterTest"
|
|
9037
|
+
"data-test": "inputFilterTest",
|
|
9038
|
+
id: "filterInput"
|
|
8816
9039
|
})
|
|
8817
9040
|
}), jsxRuntime.jsx("div", {
|
|
8818
9041
|
className: "control",
|
|
@@ -8839,7 +9062,9 @@
|
|
|
8839
9062
|
value: item
|
|
8840
9063
|
};
|
|
8841
9064
|
}),
|
|
8842
|
-
onChange:
|
|
9065
|
+
onChange: function onChange(value) {
|
|
9066
|
+
return onSearchByType(value);
|
|
9067
|
+
}
|
|
8843
9068
|
})
|
|
8844
9069
|
}), traversal.hasPerm('guillotina.AddContent') && jsxRuntime.jsx("div", {
|
|
8845
9070
|
className: "level-item",
|
|
@@ -8880,17 +9105,12 @@
|
|
|
8880
9105
|
location = _useLocation[0],
|
|
8881
9106
|
setLocation = _useLocation[1];
|
|
8882
9107
|
|
|
8883
|
-
|
|
8884
|
-
currentTab = location.get('tab');
|
|
8885
|
-
} else {
|
|
8886
|
-
currentTab = currentTab || Object.keys(tabs)[0];
|
|
8887
|
-
}
|
|
9108
|
+
currentTab = location.get('tab') || Object.keys(tabs)[0];
|
|
8888
9109
|
/*if (!Object.keys(tabs).includes(currentTab)) {
|
|
8889
9110
|
setLocation(defaultTab)
|
|
8890
9111
|
currentTab = defaultTab
|
|
8891
9112
|
}*/
|
|
8892
9113
|
|
|
8893
|
-
|
|
8894
9114
|
var _useState = React.useState(currentTab),
|
|
8895
9115
|
current = _useState[0],
|
|
8896
9116
|
setTab = _useState[1];
|
|
@@ -8957,14 +9177,14 @@
|
|
|
8957
9177
|
Behaviors: 'guillotina.ModifyContent',
|
|
8958
9178
|
Permissions: 'guillotina.SeePermissions'
|
|
8959
9179
|
};
|
|
8960
|
-
function FolderCtx(
|
|
9180
|
+
function FolderCtx() {
|
|
8961
9181
|
var ctx = useTraversal();
|
|
8962
9182
|
var calculated = ctx.filterTabs(tabs, tabsPermissions);
|
|
8963
|
-
return jsxRuntime.jsx(TabsPanel,
|
|
9183
|
+
return jsxRuntime.jsx(TabsPanel, {
|
|
8964
9184
|
tabs: calculated,
|
|
8965
9185
|
currentTab: "Items",
|
|
8966
|
-
rightToolbar: jsxRuntime.jsx(ContextToolbar,
|
|
8967
|
-
}
|
|
9186
|
+
rightToolbar: jsxRuntime.jsx(ContextToolbar, {})
|
|
9187
|
+
});
|
|
8968
9188
|
}
|
|
8969
9189
|
|
|
8970
9190
|
var tabs$1 = {
|
|
@@ -8978,13 +9198,13 @@
|
|
|
8978
9198
|
Behaviors: 'guillotina.ModifyContent',
|
|
8979
9199
|
Permissions: 'guillotina.SeePermissions'
|
|
8980
9200
|
};
|
|
8981
|
-
function ItemCtx(
|
|
9201
|
+
function ItemCtx() {
|
|
8982
9202
|
var ctx = useTraversal();
|
|
8983
9203
|
var calculated = ctx.filterTabs(tabs$1, tabsPermissions$1);
|
|
8984
|
-
return jsxRuntime.jsx(TabsPanel,
|
|
9204
|
+
return jsxRuntime.jsx(TabsPanel, {
|
|
8985
9205
|
tabs: calculated,
|
|
8986
9206
|
currentTab: "Properties"
|
|
8987
|
-
}
|
|
9207
|
+
});
|
|
8988
9208
|
}
|
|
8989
9209
|
|
|
8990
9210
|
function _catch$7(body, recover) {
|
|
@@ -9003,8 +9223,9 @@
|
|
|
9003
9223
|
|
|
9004
9224
|
function ApplicationCtx() {
|
|
9005
9225
|
var intl = reactIntl.useIntl();
|
|
9006
|
-
var
|
|
9007
|
-
var
|
|
9226
|
+
var traversal = useTraversal();
|
|
9227
|
+
var appContext = traversal.state.context;
|
|
9228
|
+
var databases = appContext.databases;
|
|
9008
9229
|
return jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
9009
9230
|
children: [jsxRuntime.jsx("h3", {
|
|
9010
9231
|
children: intl.formatMessage({
|
|
@@ -9018,22 +9239,26 @@
|
|
|
9018
9239
|
className: "container",
|
|
9019
9240
|
children: [jsxRuntime.jsx(ItemTitle, {
|
|
9020
9241
|
title: "Objects"
|
|
9021
|
-
}),
|
|
9022
|
-
|
|
9023
|
-
|
|
9024
|
-
|
|
9025
|
-
|
|
9026
|
-
|
|
9027
|
-
|
|
9028
|
-
|
|
9242
|
+
}), jsxRuntime.jsx("table", {
|
|
9243
|
+
children: jsxRuntime.jsx("tbody", {
|
|
9244
|
+
children: databases.map(function (db) {
|
|
9245
|
+
return jsxRuntime.jsx(Item, {
|
|
9246
|
+
item: {
|
|
9247
|
+
id: db,
|
|
9248
|
+
path: "/" + db + "/"
|
|
9249
|
+
},
|
|
9250
|
+
icon: 'fas fa-database'
|
|
9251
|
+
}, db);
|
|
9252
|
+
})
|
|
9253
|
+
})
|
|
9029
9254
|
})]
|
|
9030
9255
|
})]
|
|
9031
9256
|
});
|
|
9032
9257
|
}
|
|
9033
9258
|
function DatabaseCtx() {
|
|
9034
|
-
var
|
|
9035
|
-
var containers =
|
|
9036
|
-
var path =
|
|
9259
|
+
var traversal = useTraversal();
|
|
9260
|
+
var containers = traversal.state.context.containers;
|
|
9261
|
+
var path = traversal.state.path;
|
|
9037
9262
|
return jsxRuntime.jsx(jsxRuntime.Fragment, {
|
|
9038
9263
|
children: jsxRuntime.jsxs("div", {
|
|
9039
9264
|
className: "container",
|
|
@@ -9321,18 +9546,17 @@
|
|
|
9321
9546
|
|
|
9322
9547
|
var searchText = location.get('q');
|
|
9323
9548
|
|
|
9324
|
-
var onSearchQuery = function onSearchQuery(
|
|
9325
|
-
|
|
9549
|
+
var onSearchQuery = function onSearchQuery(event) {
|
|
9550
|
+
event.preventDefault();
|
|
9326
9551
|
setLocation({
|
|
9327
|
-
q:
|
|
9552
|
+
q: event.currentTarget.elements.filterInput.value,
|
|
9328
9553
|
page: 0
|
|
9329
9554
|
});
|
|
9330
|
-
ev.preventDefault();
|
|
9331
9555
|
}; // cleanup form on state.search change
|
|
9332
9556
|
|
|
9333
9557
|
|
|
9334
9558
|
React.useEffect(function () {
|
|
9335
|
-
if (!searchText || searchText === '') {
|
|
9559
|
+
if (ref.current && (!searchText || searchText === '')) {
|
|
9336
9560
|
ref.current.value = '';
|
|
9337
9561
|
}
|
|
9338
9562
|
}, [searchText]);
|
|
@@ -9352,7 +9576,8 @@
|
|
|
9352
9576
|
type: "text",
|
|
9353
9577
|
className: "input is-size-7",
|
|
9354
9578
|
placeholder: intl.formatMessage(genericMessages.search),
|
|
9355
|
-
"data-test": "inputFilterTest"
|
|
9579
|
+
"data-test": "inputFilterTest",
|
|
9580
|
+
id: "filterInput"
|
|
9356
9581
|
})
|
|
9357
9582
|
}), jsxRuntime.jsx("div", {
|
|
9358
9583
|
className: "control",
|
|
@@ -9384,12 +9609,12 @@
|
|
|
9384
9609
|
})]
|
|
9385
9610
|
});
|
|
9386
9611
|
}
|
|
9387
|
-
function UsersCtx(
|
|
9388
|
-
return jsxRuntime.jsx(TabsPanel,
|
|
9612
|
+
function UsersCtx() {
|
|
9613
|
+
return jsxRuntime.jsx(TabsPanel, {
|
|
9389
9614
|
tabs: tabs$3,
|
|
9390
9615
|
currentTab: "Users",
|
|
9391
9616
|
rightToolbar: jsxRuntime.jsx(UsersToolbar, {})
|
|
9392
|
-
}
|
|
9617
|
+
});
|
|
9393
9618
|
}
|
|
9394
9619
|
function UserCtx() {
|
|
9395
9620
|
var intl = reactIntl.useIntl();
|
|
@@ -9406,9 +9631,10 @@
|
|
|
9406
9631
|
state = _useState[0],
|
|
9407
9632
|
setState = _useState[1];
|
|
9408
9633
|
|
|
9634
|
+
var userDataContext = Ctx.context;
|
|
9409
9635
|
var fields = {
|
|
9410
9636
|
user_groups: [],
|
|
9411
|
-
user_roles:
|
|
9637
|
+
user_roles: userDataContext.user_roles
|
|
9412
9638
|
};
|
|
9413
9639
|
|
|
9414
9640
|
var _useRemoteField = useRemoteField(fields),
|
|
@@ -9512,7 +9738,7 @@
|
|
|
9512
9738
|
"value": "Username"
|
|
9513
9739
|
}]
|
|
9514
9740
|
}), ":", ' ']
|
|
9515
|
-
}), ' ',
|
|
9741
|
+
}), ' ', userDataContext.username, " (", userDataContext.email, ")"]
|
|
9516
9742
|
}), jsxRuntime.jsxs("p", {
|
|
9517
9743
|
children: [jsxRuntime.jsxs("label", {
|
|
9518
9744
|
children: [' ', intl.formatMessage({
|
|
@@ -9522,7 +9748,7 @@
|
|
|
9522
9748
|
"value": "Creation Date"
|
|
9523
9749
|
}]
|
|
9524
9750
|
}), ":", ' ']
|
|
9525
|
-
}), ' ', formatDate(
|
|
9751
|
+
}), ' ', formatDate(userDataContext.creation_date)]
|
|
9526
9752
|
}), jsxRuntime.jsxs("p", {
|
|
9527
9753
|
children: [jsxRuntime.jsxs("label", {
|
|
9528
9754
|
children: [' ', intl.formatMessage({
|
|
@@ -9532,7 +9758,7 @@
|
|
|
9532
9758
|
"value": "Modification Date"
|
|
9533
9759
|
}]
|
|
9534
9760
|
}), ":", ' ']
|
|
9535
|
-
}), ' ', formatDate(
|
|
9761
|
+
}), ' ', formatDate(userDataContext.modification_date)]
|
|
9536
9762
|
}), jsxRuntime.jsx(Button, {
|
|
9537
9763
|
className: "is-size-7 is-info",
|
|
9538
9764
|
onClick: function onClick() {
|
|
@@ -9551,7 +9777,7 @@
|
|
|
9551
9777
|
onSubmit: function onSubmit(ev) {
|
|
9552
9778
|
return updateObject(ev);
|
|
9553
9779
|
},
|
|
9554
|
-
formData:
|
|
9780
|
+
formData: userDataContext,
|
|
9555
9781
|
exclude: ['password'],
|
|
9556
9782
|
remotes: remotes,
|
|
9557
9783
|
submitButton: false,
|
|
@@ -9565,7 +9791,7 @@
|
|
|
9565
9791
|
className: "column",
|
|
9566
9792
|
children: [jsxRuntime.jsx(TagsWidget, {
|
|
9567
9793
|
onChange: updateRemote('user_groups'),
|
|
9568
|
-
items:
|
|
9794
|
+
items: userDataContext.user_groups,
|
|
9569
9795
|
title: "Groups",
|
|
9570
9796
|
noData: intl.formatMessage({
|
|
9571
9797
|
id: "there_is_no_groups_for_this_user",
|
|
@@ -9586,7 +9812,12 @@
|
|
|
9586
9812
|
"value": "The user doesn't have any role"
|
|
9587
9813
|
}]
|
|
9588
9814
|
}),
|
|
9589
|
-
available: state.roles
|
|
9815
|
+
available: state.roles.map(function (x) {
|
|
9816
|
+
return {
|
|
9817
|
+
value: x,
|
|
9818
|
+
text: x
|
|
9819
|
+
};
|
|
9820
|
+
})
|
|
9590
9821
|
})]
|
|
9591
9822
|
})]
|
|
9592
9823
|
})]
|
|
@@ -9602,7 +9833,7 @@
|
|
|
9602
9833
|
try {
|
|
9603
9834
|
return Promise.resolve(Promise.all(items.map(function (item, i) {
|
|
9604
9835
|
var input = form[i + 1] || {};
|
|
9605
|
-
return Ctx.client.post("" + Ctx.path + item
|
|
9836
|
+
return Ctx.client.post("" + Ctx.path + item.id + "/@duplicate", {
|
|
9606
9837
|
destination: path,
|
|
9607
9838
|
new_id: input.value || getNewId(item.id)
|
|
9608
9839
|
});
|
|
@@ -9648,7 +9879,7 @@
|
|
|
9648
9879
|
}), jsxRuntime.jsx("input", {
|
|
9649
9880
|
type: "text",
|
|
9650
9881
|
className: "input",
|
|
9651
|
-
"data-test": "inputCopyIdTest-" + item
|
|
9882
|
+
"data-test": "inputCopyIdTest-" + item.id,
|
|
9652
9883
|
defaultValue: getNewId(item.id)
|
|
9653
9884
|
})]
|
|
9654
9885
|
}, item.id);
|
|
@@ -9721,9 +9952,9 @@
|
|
|
9721
9952
|
var moveItems = function moveItems(path) {
|
|
9722
9953
|
try {
|
|
9723
9954
|
return Promise.resolve(Promise.all(items.map(function (item) {
|
|
9724
|
-
return Ctx.client.post("" + Ctx.path + item
|
|
9955
|
+
return Ctx.client.post("" + Ctx.path + item.id + "/@move", {
|
|
9725
9956
|
destination: path,
|
|
9726
|
-
new_id: item
|
|
9957
|
+
new_id: item.id
|
|
9727
9958
|
});
|
|
9728
9959
|
}))).then(function (responses) {
|
|
9729
9960
|
Ctx.refresh();
|
|
@@ -10060,18 +10291,17 @@
|
|
|
10060
10291
|
|
|
10061
10292
|
var searchText = location.get('q');
|
|
10062
10293
|
|
|
10063
|
-
var onSearchQuery = function onSearchQuery(
|
|
10064
|
-
|
|
10294
|
+
var onSearchQuery = function onSearchQuery(event) {
|
|
10295
|
+
event.preventDefault();
|
|
10065
10296
|
setLocation({
|
|
10066
|
-
q:
|
|
10297
|
+
q: event.currentTarget.elements.filterInput.value,
|
|
10067
10298
|
page: 0
|
|
10068
10299
|
});
|
|
10069
|
-
ev.preventDefault();
|
|
10070
10300
|
}; // cleanup form on state.search change
|
|
10071
10301
|
|
|
10072
10302
|
|
|
10073
10303
|
React.useEffect(function () {
|
|
10074
|
-
if (!searchText || searchText === '') {
|
|
10304
|
+
if (ref.current && (!searchText || searchText === '')) {
|
|
10075
10305
|
ref.current.value = '';
|
|
10076
10306
|
}
|
|
10077
10307
|
}, [searchText]);
|
|
@@ -10091,7 +10321,8 @@
|
|
|
10091
10321
|
type: "text",
|
|
10092
10322
|
className: "input is-size-7",
|
|
10093
10323
|
placeholder: intl.formatMessage(genericMessages.search),
|
|
10094
|
-
"data-test": "inputFilterTest"
|
|
10324
|
+
"data-test": "inputFilterTest",
|
|
10325
|
+
id: "filterInput"
|
|
10095
10326
|
})
|
|
10096
10327
|
}), jsxRuntime.jsx("div", {
|
|
10097
10328
|
className: "control",
|
|
@@ -10129,12 +10360,12 @@
|
|
|
10129
10360
|
})]
|
|
10130
10361
|
});
|
|
10131
10362
|
}
|
|
10132
|
-
function GroupsCtx(
|
|
10133
|
-
return jsxRuntime.jsx(TabsPanel,
|
|
10363
|
+
function GroupsCtx() {
|
|
10364
|
+
return jsxRuntime.jsx(TabsPanel, {
|
|
10134
10365
|
tabs: tabs$4,
|
|
10135
10366
|
currentTab: "Groups",
|
|
10136
10367
|
rightToolbar: jsxRuntime.jsx(GroupToolbar, {})
|
|
10137
|
-
}
|
|
10368
|
+
});
|
|
10138
10369
|
}
|
|
10139
10370
|
var sortParsed = parser("_sort_asc=id");
|
|
10140
10371
|
var searchParsed = parser('type_name=User');
|
|
@@ -10149,6 +10380,7 @@
|
|
|
10149
10380
|
roles = _useState[0],
|
|
10150
10381
|
setRoles = _useState[1];
|
|
10151
10382
|
|
|
10383
|
+
var groupDataContext = Ctx.context;
|
|
10152
10384
|
React.useEffect(function () {
|
|
10153
10385
|
var getRoles = function getRoles() {
|
|
10154
10386
|
try {
|
|
@@ -10202,11 +10434,11 @@
|
|
|
10202
10434
|
var addRole = function addRole(role) {
|
|
10203
10435
|
try {
|
|
10204
10436
|
return Promise.resolve(patch({
|
|
10205
|
-
user_roles:
|
|
10437
|
+
user_roles: groupDataContext.user_roles.concat(role)
|
|
10206
10438
|
})).then(function (_ref) {
|
|
10207
10439
|
var isError = _ref.isError,
|
|
10208
10440
|
errorMessage = _ref.errorMessage;
|
|
10209
|
-
handleResponse(isError, intl.formatMessage({
|
|
10441
|
+
handleResponse(!!isError, intl.formatMessage({
|
|
10210
10442
|
id: "role_added_to_group",
|
|
10211
10443
|
defaultMessage: [{
|
|
10212
10444
|
"type": 0,
|
|
@@ -10220,7 +10452,7 @@
|
|
|
10220
10452
|
}]
|
|
10221
10453
|
}, {
|
|
10222
10454
|
role: role
|
|
10223
|
-
}), errorMessage);
|
|
10455
|
+
}), errorMessage != null ? errorMessage : '');
|
|
10224
10456
|
});
|
|
10225
10457
|
} catch (e) {
|
|
10226
10458
|
return Promise.reject(e);
|
|
@@ -10230,13 +10462,13 @@
|
|
|
10230
10462
|
var removeRole = function removeRole(role) {
|
|
10231
10463
|
try {
|
|
10232
10464
|
return Promise.resolve(patch({
|
|
10233
|
-
user_roles:
|
|
10465
|
+
user_roles: groupDataContext.user_roles.filter(function (r) {
|
|
10234
10466
|
return r !== role;
|
|
10235
10467
|
})
|
|
10236
10468
|
})).then(function (_ref2) {
|
|
10237
10469
|
var isError = _ref2.isError,
|
|
10238
10470
|
errorMessage = _ref2.errorMessage;
|
|
10239
|
-
handleResponse(isError, intl.formatMessage({
|
|
10471
|
+
handleResponse(!!isError, intl.formatMessage({
|
|
10240
10472
|
id: "role_removed_from_group",
|
|
10241
10473
|
defaultMessage: [{
|
|
10242
10474
|
"type": 0,
|
|
@@ -10250,7 +10482,7 @@
|
|
|
10250
10482
|
}]
|
|
10251
10483
|
}, {
|
|
10252
10484
|
role: role
|
|
10253
|
-
}), errorMessage);
|
|
10485
|
+
}), errorMessage != null ? errorMessage : '');
|
|
10254
10486
|
});
|
|
10255
10487
|
} catch (e) {
|
|
10256
10488
|
return Promise.reject(e);
|
|
@@ -10260,30 +10492,32 @@
|
|
|
10260
10492
|
var addUser = function addUser(newUserId) {
|
|
10261
10493
|
try {
|
|
10262
10494
|
var data = {};
|
|
10263
|
-
|
|
10495
|
+
groupDataContext.users.forEach(function (user) {
|
|
10264
10496
|
data[user] = true;
|
|
10265
10497
|
});
|
|
10266
10498
|
data[newUserId] = true;
|
|
10267
10499
|
return Promise.resolve(Ctx.client.rest.patch(Ctx.containerPath + "@groups/" + Ctx.context['@name'], {
|
|
10268
10500
|
users: data
|
|
10269
|
-
})).then(function (
|
|
10270
|
-
|
|
10271
|
-
|
|
10272
|
-
|
|
10273
|
-
|
|
10274
|
-
|
|
10275
|
-
|
|
10276
|
-
|
|
10277
|
-
|
|
10278
|
-
|
|
10279
|
-
|
|
10501
|
+
})).then(function (response) {
|
|
10502
|
+
return Promise.resolve(processResponse(response)).then(function (_ref3) {
|
|
10503
|
+
var isError = _ref3.isError,
|
|
10504
|
+
errorMessage = _ref3.errorMessage;
|
|
10505
|
+
handleResponse(isError, intl.formatMessage({
|
|
10506
|
+
id: "user_added_to_group",
|
|
10507
|
+
defaultMessage: [{
|
|
10508
|
+
"type": 0,
|
|
10509
|
+
"value": "User "
|
|
10510
|
+
}, {
|
|
10511
|
+
"type": 1,
|
|
10512
|
+
"value": "user"
|
|
10513
|
+
}, {
|
|
10514
|
+
"type": 0,
|
|
10515
|
+
"value": " added to group"
|
|
10516
|
+
}]
|
|
10280
10517
|
}, {
|
|
10281
|
-
|
|
10282
|
-
|
|
10283
|
-
|
|
10284
|
-
}, {
|
|
10285
|
-
user: newUserId
|
|
10286
|
-
}), errorMessage);
|
|
10518
|
+
user: newUserId
|
|
10519
|
+
}), errorMessage != null ? errorMessage : '');
|
|
10520
|
+
});
|
|
10287
10521
|
});
|
|
10288
10522
|
} catch (e) {
|
|
10289
10523
|
return Promise.reject(e);
|
|
@@ -10293,29 +10527,31 @@
|
|
|
10293
10527
|
var removeUser = function removeUser(userToRemove) {
|
|
10294
10528
|
try {
|
|
10295
10529
|
var data = {};
|
|
10296
|
-
|
|
10530
|
+
groupDataContext.users.forEach(function (user) {
|
|
10297
10531
|
data[user] = userToRemove !== user;
|
|
10298
10532
|
});
|
|
10299
10533
|
return Promise.resolve(Ctx.client.rest.patch(Ctx.containerPath + "@groups/" + Ctx.context['@name'], {
|
|
10300
10534
|
users: data
|
|
10301
|
-
})).then(function (
|
|
10302
|
-
|
|
10303
|
-
|
|
10304
|
-
|
|
10305
|
-
|
|
10306
|
-
|
|
10307
|
-
|
|
10308
|
-
|
|
10309
|
-
|
|
10310
|
-
|
|
10311
|
-
|
|
10535
|
+
})).then(function (response) {
|
|
10536
|
+
return Promise.resolve(processResponse(response)).then(function (_ref4) {
|
|
10537
|
+
var isError = _ref4.isError,
|
|
10538
|
+
errorMessage = _ref4.errorMessage;
|
|
10539
|
+
handleResponse(isError, intl.formatMessage({
|
|
10540
|
+
id: "user_removed_from_group",
|
|
10541
|
+
defaultMessage: [{
|
|
10542
|
+
"type": 0,
|
|
10543
|
+
"value": "User "
|
|
10544
|
+
}, {
|
|
10545
|
+
"type": 1,
|
|
10546
|
+
"value": "user"
|
|
10547
|
+
}, {
|
|
10548
|
+
"type": 0,
|
|
10549
|
+
"value": " removed from group"
|
|
10550
|
+
}]
|
|
10312
10551
|
}, {
|
|
10313
|
-
|
|
10314
|
-
|
|
10315
|
-
|
|
10316
|
-
}, {
|
|
10317
|
-
user: userToRemove
|
|
10318
|
-
}), errorMessage);
|
|
10552
|
+
user: userToRemove
|
|
10553
|
+
}), errorMessage != null ? errorMessage : '');
|
|
10554
|
+
});
|
|
10319
10555
|
});
|
|
10320
10556
|
} catch (e) {
|
|
10321
10557
|
return Promise.reject(e);
|
|
@@ -10370,11 +10606,13 @@
|
|
|
10370
10606
|
})
|
|
10371
10607
|
}), jsxRuntime.jsx(Select, {
|
|
10372
10608
|
options: roles.filter(function (role) {
|
|
10373
|
-
return !
|
|
10609
|
+
return !groupDataContext.user_roles.includes(role.value);
|
|
10374
10610
|
}),
|
|
10375
10611
|
appendDefault: true,
|
|
10376
|
-
onChange:
|
|
10377
|
-
|
|
10612
|
+
onChange: function onChange(value) {
|
|
10613
|
+
return addRole(value);
|
|
10614
|
+
}
|
|
10615
|
+
}), jsxRuntime.jsx("hr", {}), groupDataContext.user_roles.map(function (urole) {
|
|
10378
10616
|
return jsxRuntime.jsx("p", {
|
|
10379
10617
|
className: "control",
|
|
10380
10618
|
children: jsxRuntime.jsx(Tag, {
|
|
@@ -10406,7 +10644,7 @@
|
|
|
10406
10644
|
traversal: Ctx,
|
|
10407
10645
|
onChange: addUser,
|
|
10408
10646
|
btnClass: "is-small"
|
|
10409
|
-
}), jsxRuntime.jsx("hr", {}),
|
|
10647
|
+
}), jsxRuntime.jsx("hr", {}), groupDataContext.users.map(function (user) {
|
|
10410
10648
|
return jsxRuntime.jsx("p", {
|
|
10411
10649
|
className: "control",
|
|
10412
10650
|
children: jsxRuntime.jsx(Tag, {
|
|
@@ -10555,7 +10793,7 @@
|
|
|
10555
10793
|
var links = buildPaths(segments);
|
|
10556
10794
|
|
|
10557
10795
|
if (segments.length === 1) {
|
|
10558
|
-
return
|
|
10796
|
+
return null;
|
|
10559
10797
|
}
|
|
10560
10798
|
|
|
10561
10799
|
return jsxRuntime.jsx("nav", {
|
|
@@ -10718,19 +10956,15 @@
|
|
|
10718
10956
|
return undefined;
|
|
10719
10957
|
};
|
|
10720
10958
|
|
|
10721
|
-
var
|
|
10722
|
-
|
|
10723
|
-
|
|
10724
|
-
}
|
|
10959
|
+
var getView = function getView(name) {
|
|
10960
|
+
return registry.views[name];
|
|
10961
|
+
};
|
|
10725
10962
|
|
|
10726
|
-
|
|
10963
|
+
var getForm = function getForm(type, fallback) {
|
|
10964
|
+
return registry.forms[type] || fallback || BaseForm;
|
|
10727
10965
|
};
|
|
10728
10966
|
|
|
10729
10967
|
var getAction = function getAction(type, fallback) {
|
|
10730
|
-
if (fallback === void 0) {
|
|
10731
|
-
fallback = undefined;
|
|
10732
|
-
}
|
|
10733
|
-
|
|
10734
10968
|
return registry.actions[type] || fallback;
|
|
10735
10969
|
};
|
|
10736
10970
|
|
|
@@ -10744,24 +10978,24 @@
|
|
|
10744
10978
|
|
|
10745
10979
|
var getSchemas = function getSchemas(type) {
|
|
10746
10980
|
return registry.schemas[type] || {};
|
|
10747
|
-
/*
|
|
10748
|
-
filters: [
|
|
10749
|
-
{
|
|
10750
|
-
attribute_key: string,
|
|
10751
|
-
label: string,
|
|
10752
|
-
type: 'select' | 'input'
|
|
10753
|
-
vocabulary: string | undefined
|
|
10754
|
-
values: {[key:string]:any}[]
|
|
10755
|
-
}
|
|
10756
|
-
]
|
|
10757
|
-
*/
|
|
10758
10981
|
};
|
|
10759
10982
|
|
|
10760
10983
|
var getFieldsToFilter = function getFieldsToFilter(type, fallback) {
|
|
10984
|
+
if (fallback === void 0) {
|
|
10985
|
+
fallback = ['title'];
|
|
10986
|
+
}
|
|
10987
|
+
|
|
10761
10988
|
return registry.fieldsToFilter[type] || fallback;
|
|
10762
10989
|
};
|
|
10763
10990
|
|
|
10764
10991
|
var getDefaultSortValue = function getDefaultSortValue(type, fallback) {
|
|
10992
|
+
if (fallback === void 0) {
|
|
10993
|
+
fallback = {
|
|
10994
|
+
key: 'id',
|
|
10995
|
+
direction: 'des'
|
|
10996
|
+
};
|
|
10997
|
+
}
|
|
10998
|
+
|
|
10765
10999
|
return registry.defaultSortValue[type] || fallback;
|
|
10766
11000
|
};
|
|
10767
11001
|
|
|
@@ -10775,7 +11009,8 @@
|
|
|
10775
11009
|
if (data && !ref.current) {
|
|
10776
11010
|
ref.current = true;
|
|
10777
11011
|
Object.keys(data).map(function (key) {
|
|
10778
|
-
|
|
11012
|
+
var registryKey = key;
|
|
11013
|
+
registry[registryKey] = _extends({}, registry[registryKey], data[registryKey]);
|
|
10779
11014
|
});
|
|
10780
11015
|
}
|
|
10781
11016
|
|
|
@@ -10790,7 +11025,8 @@
|
|
|
10790
11025
|
getItemsColumn: getItemsColumn,
|
|
10791
11026
|
getFieldsToFilter: getFieldsToFilter,
|
|
10792
11027
|
getDefaultSortValue: getDefaultSortValue,
|
|
10793
|
-
getSchemas: getSchemas
|
|
11028
|
+
getSchemas: getSchemas,
|
|
11029
|
+
getView: getView
|
|
10794
11030
|
};
|
|
10795
11031
|
}
|
|
10796
11032
|
/*
|
|
@@ -10810,83 +11046,6 @@
|
|
|
10810
11046
|
|
|
10811
11047
|
*/
|
|
10812
11048
|
|
|
10813
|
-
var initialState$4 = {
|
|
10814
|
-
path: '',
|
|
10815
|
-
loading: false,
|
|
10816
|
-
context: undefined,
|
|
10817
|
-
flash: {
|
|
10818
|
-
message: undefined,
|
|
10819
|
-
type: undefined
|
|
10820
|
-
},
|
|
10821
|
-
action: {
|
|
10822
|
-
action: undefined,
|
|
10823
|
-
params: undefined
|
|
10824
|
-
},
|
|
10825
|
-
permissions: undefined,
|
|
10826
|
-
errorStatus: undefined,
|
|
10827
|
-
registry: {},
|
|
10828
|
-
refresh: undefined
|
|
10829
|
-
};
|
|
10830
|
-
function guillotinaReducer(state, action) {
|
|
10831
|
-
switch (action.type) {
|
|
10832
|
-
case 'SET_PATH':
|
|
10833
|
-
return _extends({}, state, {
|
|
10834
|
-
path: action.payload,
|
|
10835
|
-
loading: true
|
|
10836
|
-
});
|
|
10837
|
-
|
|
10838
|
-
case 'SET_CONTEXT':
|
|
10839
|
-
return _extends({}, state, action.payload, {
|
|
10840
|
-
errorStatus: undefined,
|
|
10841
|
-
loading: false
|
|
10842
|
-
});
|
|
10843
|
-
|
|
10844
|
-
case 'SET_ERROR':
|
|
10845
|
-
return _extends({}, state, {
|
|
10846
|
-
errorStatus: action.payload,
|
|
10847
|
-
loading: false
|
|
10848
|
-
});
|
|
10849
|
-
|
|
10850
|
-
case 'SET_FLASH':
|
|
10851
|
-
return _extends({}, state, action.payload);
|
|
10852
|
-
|
|
10853
|
-
case 'CLEAR_FLASH':
|
|
10854
|
-
return _extends({}, state, {
|
|
10855
|
-
flash: {
|
|
10856
|
-
message: undefined,
|
|
10857
|
-
type: undefined
|
|
10858
|
-
}
|
|
10859
|
-
});
|
|
10860
|
-
|
|
10861
|
-
case 'SET_ACTION':
|
|
10862
|
-
return _extends({}, state, {
|
|
10863
|
-
action: action.payload
|
|
10864
|
-
});
|
|
10865
|
-
|
|
10866
|
-
case 'CLEAR_ACTION':
|
|
10867
|
-
return _extends({}, state, {
|
|
10868
|
-
action: {
|
|
10869
|
-
action: undefined,
|
|
10870
|
-
params: undefined
|
|
10871
|
-
}
|
|
10872
|
-
});
|
|
10873
|
-
|
|
10874
|
-
case 'REFRESH':
|
|
10875
|
-
return _extends({}, state, {
|
|
10876
|
-
refresh: Date.now(),
|
|
10877
|
-
loading: !action.payload.transparent
|
|
10878
|
-
});
|
|
10879
|
-
|
|
10880
|
-
case 'APPLY':
|
|
10881
|
-
return _extends({}, state, {
|
|
10882
|
-
context: _extends({}, state.context, action.payload)
|
|
10883
|
-
});
|
|
10884
|
-
|
|
10885
|
-
default:
|
|
10886
|
-
return state;
|
|
10887
|
-
}
|
|
10888
|
-
}
|
|
10889
|
-
|
|
10890
11049
|
var actions = [
|
|
10891
11050
|
{
|
|
10892
11051
|
type: 0,
|
|
@@ -13704,7 +13863,7 @@
|
|
|
13704
13863
|
var _useConfig = useConfig(config),
|
|
13705
13864
|
Permissions = _useConfig.Permissions;
|
|
13706
13865
|
|
|
13707
|
-
var registry = useRegistry(props.registry
|
|
13866
|
+
var registry = useRegistry(props.registry); // Location is cooked routing solution (only uses search params)
|
|
13708
13867
|
|
|
13709
13868
|
var _useLocation = useLocation(),
|
|
13710
13869
|
location = _useLocation[0]; // if there is no path provided just go to root
|
|
@@ -13713,10 +13872,10 @@
|
|
|
13713
13872
|
var searchPath = location.get('path') || '/';
|
|
13714
13873
|
|
|
13715
13874
|
if (searchPath && searchPath !== '') {
|
|
13716
|
-
initialState
|
|
13875
|
+
initialState.path = searchPath;
|
|
13717
13876
|
}
|
|
13718
13877
|
|
|
13719
|
-
var _useReducer = React.useReducer(guillotinaReducer, initialState
|
|
13878
|
+
var _useReducer = React.useReducer(guillotinaReducer, initialState),
|
|
13720
13879
|
state = _useReducer[0],
|
|
13721
13880
|
dispatch = _useReducer[1];
|
|
13722
13881
|
|
|
@@ -13724,8 +13883,10 @@
|
|
|
13724
13883
|
refresh = state.refresh;
|
|
13725
13884
|
React.useEffect(function () {
|
|
13726
13885
|
dispatch({
|
|
13727
|
-
type:
|
|
13728
|
-
payload:
|
|
13886
|
+
type: GuillotinaReducerActionTypes.SET_PATH,
|
|
13887
|
+
payload: {
|
|
13888
|
+
path: searchPath
|
|
13889
|
+
}
|
|
13729
13890
|
});
|
|
13730
13891
|
}, [searchPath]);
|
|
13731
13892
|
React.useEffect(function () {
|
|
@@ -13734,14 +13895,18 @@
|
|
|
13734
13895
|
return Promise.resolve(client.getContext(path)).then(function (data) {
|
|
13735
13896
|
if (data.status === 401) {
|
|
13736
13897
|
dispatch({
|
|
13737
|
-
type:
|
|
13738
|
-
payload:
|
|
13898
|
+
type: GuillotinaReducerActionTypes.SET_ERROR,
|
|
13899
|
+
payload: {
|
|
13900
|
+
errorStatus: 'notallowed'
|
|
13901
|
+
}
|
|
13739
13902
|
});
|
|
13740
13903
|
return;
|
|
13741
13904
|
} else if (data.status === 404) {
|
|
13742
13905
|
dispatch({
|
|
13743
|
-
type:
|
|
13744
|
-
payload:
|
|
13906
|
+
type: GuillotinaReducerActionTypes.SET_ERROR,
|
|
13907
|
+
payload: {
|
|
13908
|
+
errorStatus: 'notallowed'
|
|
13909
|
+
}
|
|
13745
13910
|
});
|
|
13746
13911
|
return;
|
|
13747
13912
|
}
|
|
@@ -13750,7 +13915,7 @@
|
|
|
13750
13915
|
return Promise.resolve(client.canido(path, Permissions)).then(function (pr) {
|
|
13751
13916
|
return Promise.resolve(pr.json()).then(function (permissions) {
|
|
13752
13917
|
dispatch({
|
|
13753
|
-
type:
|
|
13918
|
+
type: GuillotinaReducerActionTypes.SET_CONTEXT,
|
|
13754
13919
|
payload: {
|
|
13755
13920
|
context: context,
|
|
13756
13921
|
permissions: permissions
|
|
@@ -13767,9 +13932,9 @@
|
|
|
13767
13932
|
|
|
13768
13933
|
initContext();
|
|
13769
13934
|
}, [path, refresh, client]);
|
|
13770
|
-
var ErrorBoundary = registry.
|
|
13771
|
-
var NotAllowed = registry.
|
|
13772
|
-
var NotFound = registry.
|
|
13935
|
+
var ErrorBoundary = registry.getView('ErrorBoundary');
|
|
13936
|
+
var NotAllowed = registry.getView('NotAllowed');
|
|
13937
|
+
var NotFound = registry.getView('NotFound');
|
|
13773
13938
|
var Path = registry.get('components', 'Path');
|
|
13774
13939
|
var contextData = {
|
|
13775
13940
|
url: url,
|
|
@@ -13792,7 +13957,7 @@
|
|
|
13792
13957
|
children: jsxRuntime.jsxs(ErrorBoundary, {
|
|
13793
13958
|
children: [!errorStatus && jsxRuntime.jsx(TraversalProvider, _extends({}, contextData, {
|
|
13794
13959
|
children: permissions && jsxRuntime.jsxs(React__default['default'].Fragment, {
|
|
13795
|
-
children: [action.action && jsxRuntime.jsx(Action, _extends({}, action.params)), jsxRuntime.jsx("div", {
|
|
13960
|
+
children: [action.action && Action !== null && jsxRuntime.jsx(Action, _extends({}, action.params)), jsxRuntime.jsx("div", {
|
|
13796
13961
|
className: "level",
|
|
13797
13962
|
children: jsxRuntime.jsx("div", {
|
|
13798
13963
|
className: "level-left",
|
|
@@ -13801,7 +13966,7 @@
|
|
|
13801
13966
|
children: jsxRuntime.jsx(Path, {})
|
|
13802
13967
|
})
|
|
13803
13968
|
})
|
|
13804
|
-
}), jsxRuntime.jsx(Flash, {}), Main && jsxRuntime.jsx(ErrorBoundary, {
|
|
13969
|
+
}), jsxRuntime.jsx(Flash, {}), Main !== undefined && jsxRuntime.jsx(ErrorBoundary, {
|
|
13805
13970
|
children: jsxRuntime.jsxs("div", {
|
|
13806
13971
|
className: "box main-panel",
|
|
13807
13972
|
children: [state.loading && jsxRuntime.jsx(Loading, {}), !state.loading && jsxRuntime.jsx(Main, {
|
|
@@ -13911,7 +14076,7 @@
|
|
|
13911
14076
|
var initialState$5 = {
|
|
13912
14077
|
username: '',
|
|
13913
14078
|
password: '',
|
|
13914
|
-
loading:
|
|
14079
|
+
loading: false,
|
|
13915
14080
|
errors: undefined
|
|
13916
14081
|
};
|
|
13917
14082
|
var Login = function Login(_ref) {
|
|
@@ -13927,7 +14092,7 @@
|
|
|
13927
14092
|
|
|
13928
14093
|
var inputRef = React.useRef(null);
|
|
13929
14094
|
React.useEffect(function () {
|
|
13930
|
-
if (inputRef) {
|
|
14095
|
+
if (inputRef && inputRef.current) {
|
|
13931
14096
|
inputRef.current.focus();
|
|
13932
14097
|
}
|
|
13933
14098
|
}, [inputRef]);
|
|
@@ -14148,30 +14313,30 @@
|
|
|
14148
14313
|
dataTest: dataTest,
|
|
14149
14314
|
children: [schema && schema.data && !schema.loading && schema.formFields.map(function (key) {
|
|
14150
14315
|
if (!ignoreFiels.includes(key)) {
|
|
14151
|
-
var _value$title;
|
|
14316
|
+
var _schema$data, _value$title, _schema$data2;
|
|
14152
14317
|
|
|
14153
|
-
var value = schema.data.properties[key];
|
|
14318
|
+
var value = (_schema$data = schema.data) == null ? void 0 : _schema$data.properties[key];
|
|
14154
14319
|
return jsxRuntime.jsx(EditComponent, {
|
|
14155
14320
|
id: key,
|
|
14156
14321
|
placeholder: (_value$title = value == null ? void 0 : value.title) != null ? _value$title : '',
|
|
14157
14322
|
className: "",
|
|
14158
14323
|
required: true,
|
|
14159
|
-
schema: schema.data.properties[key],
|
|
14160
|
-
setValue: function setValue(
|
|
14324
|
+
schema: (_schema$data2 = schema.data) == null ? void 0 : _schema$data2.properties[key],
|
|
14325
|
+
setValue: function setValue(value) {
|
|
14161
14326
|
if (key === 'title') {
|
|
14162
14327
|
var _extends2;
|
|
14163
14328
|
|
|
14164
14329
|
setFormData(_extends({}, formData, (_extends2 = {
|
|
14165
|
-
uuid: stringToSlug(
|
|
14166
|
-
}, _extends2[key] =
|
|
14330
|
+
uuid: stringToSlug(value)
|
|
14331
|
+
}, _extends2[key] = value, _extends2)));
|
|
14167
14332
|
} else if (key === 'uuid') {
|
|
14168
14333
|
setFormData(_extends({}, formData, {
|
|
14169
|
-
uuid: stringToSlug(
|
|
14334
|
+
uuid: stringToSlug(value)
|
|
14170
14335
|
}));
|
|
14171
14336
|
} else {
|
|
14172
14337
|
var _extends3;
|
|
14173
14338
|
|
|
14174
|
-
setFormData(_extends({}, formData, (_extends3 = {}, _extends3[key] =
|
|
14339
|
+
setFormData(_extends({}, formData, (_extends3 = {}, _extends3[key] = value, _extends3)));
|
|
14175
14340
|
}
|
|
14176
14341
|
},
|
|
14177
14342
|
error: errors[key],
|
|
@@ -14365,7 +14530,7 @@
|
|
|
14365
14530
|
|
|
14366
14531
|
if (!authToken) return {};
|
|
14367
14532
|
|
|
14368
|
-
if (this.willExpire(expires) && this.retryRefresh < this.maxRetry) {
|
|
14533
|
+
if (this.willExpire(expires != null ? expires : '') && this.retryRefresh < this.maxRetry) {
|
|
14369
14534
|
|
|
14370
14535
|
(function () {
|
|
14371
14536
|
try {
|
|
@@ -14423,6 +14588,13 @@
|
|
|
14423
14588
|
return Auth;
|
|
14424
14589
|
}();
|
|
14425
14590
|
|
|
14591
|
+
(function (Setting) {
|
|
14592
|
+
Setting["Allow"] = "Allow";
|
|
14593
|
+
Setting["AllowSingle"] = "AllowSingle";
|
|
14594
|
+
Setting["Deny"] = "Deny";
|
|
14595
|
+
Setting["Unset"] = "Unset";
|
|
14596
|
+
})(exports.Setting || (exports.Setting = {}));
|
|
14597
|
+
|
|
14426
14598
|
exports.AddItem = AddItem;
|
|
14427
14599
|
exports.AddPermission = AddPermission;
|
|
14428
14600
|
exports.AllItemsCheckbox = AllItemsCheckbox;
|
|
@@ -14436,7 +14608,6 @@
|
|
|
14436
14608
|
exports.Checkbox = Checkbox;
|
|
14437
14609
|
exports.ClientContext = ClientContext;
|
|
14438
14610
|
exports.ClientProvider = ClientProvider;
|
|
14439
|
-
exports.Config = Config;
|
|
14440
14611
|
exports.Confirm = Confirm;
|
|
14441
14612
|
exports.ContainerCtx = ContainerCtx;
|
|
14442
14613
|
exports.ContextToolbar = ContextToolbar;
|
|
@@ -14534,12 +14705,14 @@
|
|
|
14534
14705
|
exports.base64ToArrayBuffer = base64ToArrayBuffer;
|
|
14535
14706
|
exports.buildQs = buildQs;
|
|
14536
14707
|
exports.classnames = classnames;
|
|
14708
|
+
exports.debounce = debounce;
|
|
14537
14709
|
exports.defaultComponent = defaultComponent;
|
|
14710
|
+
exports.defaultConfig = defaultConfig;
|
|
14538
14711
|
exports.formatDate = formatDate;
|
|
14539
14712
|
exports.generateUID = generateUID;
|
|
14540
14713
|
exports.genericFileMessages = genericFileMessages;
|
|
14541
14714
|
exports.genericMessages = genericMessages;
|
|
14542
|
-
exports.get = get
|
|
14715
|
+
exports.get = get;
|
|
14543
14716
|
exports.getActionsObject = getActionsObject;
|
|
14544
14717
|
exports.getClient = getClient;
|
|
14545
14718
|
exports.getNewId = getNewId;
|