@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.js
CHANGED
|
@@ -111,6 +111,97 @@ function _createForOfIteratorHelperLoose(o, allowArrayLike) {
|
|
|
111
111
|
return it.next.bind(it);
|
|
112
112
|
}
|
|
113
113
|
|
|
114
|
+
var initialState = {
|
|
115
|
+
path: '',
|
|
116
|
+
loading: false,
|
|
117
|
+
context: undefined,
|
|
118
|
+
flash: {
|
|
119
|
+
message: undefined,
|
|
120
|
+
type: undefined
|
|
121
|
+
},
|
|
122
|
+
action: {
|
|
123
|
+
action: undefined,
|
|
124
|
+
params: undefined
|
|
125
|
+
},
|
|
126
|
+
permissions: [],
|
|
127
|
+
errorStatus: undefined,
|
|
128
|
+
registry: {},
|
|
129
|
+
refresh: undefined
|
|
130
|
+
};
|
|
131
|
+
var GuillotinaReducerActionTypes;
|
|
132
|
+
|
|
133
|
+
(function (GuillotinaReducerActionTypes) {
|
|
134
|
+
GuillotinaReducerActionTypes["SET_PATH"] = "SET_PATH";
|
|
135
|
+
GuillotinaReducerActionTypes["SET_CONTEXT"] = "SET_CONTEXT";
|
|
136
|
+
GuillotinaReducerActionTypes["SET_ERROR"] = "SET_ERROR";
|
|
137
|
+
GuillotinaReducerActionTypes["SET_FLASH"] = "SET_FLASH";
|
|
138
|
+
GuillotinaReducerActionTypes["CLEAR_FLASH"] = "CLEAR_FLASH";
|
|
139
|
+
GuillotinaReducerActionTypes["SET_ACTION"] = "SET_ACTION";
|
|
140
|
+
GuillotinaReducerActionTypes["CLEAR_ACTION"] = "CLEAR_ACTION";
|
|
141
|
+
GuillotinaReducerActionTypes["REFRESH"] = "REFRESH";
|
|
142
|
+
GuillotinaReducerActionTypes["APPLY"] = "APPLY";
|
|
143
|
+
})(GuillotinaReducerActionTypes || (GuillotinaReducerActionTypes = {}));
|
|
144
|
+
|
|
145
|
+
function guillotinaReducer(state, action) {
|
|
146
|
+
switch (action.type) {
|
|
147
|
+
case GuillotinaReducerActionTypes.SET_PATH:
|
|
148
|
+
return _extends({}, state, {
|
|
149
|
+
path: action.payload.path,
|
|
150
|
+
loading: true
|
|
151
|
+
});
|
|
152
|
+
|
|
153
|
+
case GuillotinaReducerActionTypes.SET_CONTEXT:
|
|
154
|
+
return _extends({}, state, action.payload, {
|
|
155
|
+
errorStatus: undefined,
|
|
156
|
+
loading: false
|
|
157
|
+
});
|
|
158
|
+
|
|
159
|
+
case GuillotinaReducerActionTypes.SET_ERROR:
|
|
160
|
+
return _extends({}, state, {
|
|
161
|
+
errorStatus: action.payload.errorStatus,
|
|
162
|
+
loading: false
|
|
163
|
+
});
|
|
164
|
+
|
|
165
|
+
case GuillotinaReducerActionTypes.SET_FLASH:
|
|
166
|
+
return _extends({}, state, action.payload);
|
|
167
|
+
|
|
168
|
+
case GuillotinaReducerActionTypes.CLEAR_FLASH:
|
|
169
|
+
return _extends({}, state, {
|
|
170
|
+
flash: {
|
|
171
|
+
message: undefined,
|
|
172
|
+
type: undefined
|
|
173
|
+
}
|
|
174
|
+
});
|
|
175
|
+
|
|
176
|
+
case GuillotinaReducerActionTypes.SET_ACTION:
|
|
177
|
+
return _extends({}, state, {
|
|
178
|
+
action: action.payload
|
|
179
|
+
});
|
|
180
|
+
|
|
181
|
+
case GuillotinaReducerActionTypes.CLEAR_ACTION:
|
|
182
|
+
return _extends({}, state, {
|
|
183
|
+
action: {
|
|
184
|
+
action: undefined,
|
|
185
|
+
params: undefined
|
|
186
|
+
}
|
|
187
|
+
});
|
|
188
|
+
|
|
189
|
+
case GuillotinaReducerActionTypes.REFRESH:
|
|
190
|
+
return _extends({}, state, {
|
|
191
|
+
refresh: Date.now(),
|
|
192
|
+
loading: !action.payload.transparent
|
|
193
|
+
});
|
|
194
|
+
|
|
195
|
+
case GuillotinaReducerActionTypes.APPLY:
|
|
196
|
+
return _extends({}, state, {
|
|
197
|
+
context: _extends({}, state.context, action.payload.context)
|
|
198
|
+
});
|
|
199
|
+
|
|
200
|
+
default:
|
|
201
|
+
return state;
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
|
|
114
205
|
var AuthContext = React.createContext({});
|
|
115
206
|
var ClientContext = React.createContext(null);
|
|
116
207
|
var Traversal = /*#__PURE__*/function () {
|
|
@@ -141,7 +232,7 @@ var Traversal = /*#__PURE__*/function () {
|
|
|
141
232
|
transparent = _ref2$transparent === void 0 ? false : _ref2$transparent;
|
|
142
233
|
|
|
143
234
|
this.dispatch({
|
|
144
|
-
type:
|
|
235
|
+
type: GuillotinaReducerActionTypes.REFRESH,
|
|
145
236
|
payload: {
|
|
146
237
|
transparent: transparent
|
|
147
238
|
}
|
|
@@ -151,14 +242,16 @@ var Traversal = /*#__PURE__*/function () {
|
|
|
151
242
|
_proto.apply = function apply(data) {
|
|
152
243
|
// apply a optimistic update to context
|
|
153
244
|
this.dispatch({
|
|
154
|
-
type:
|
|
155
|
-
payload:
|
|
245
|
+
type: GuillotinaReducerActionTypes.APPLY,
|
|
246
|
+
payload: {
|
|
247
|
+
context: data
|
|
248
|
+
}
|
|
156
249
|
});
|
|
157
250
|
};
|
|
158
251
|
|
|
159
252
|
_proto.flash = function flash(message, type) {
|
|
160
253
|
this.dispatch({
|
|
161
|
-
type:
|
|
254
|
+
type: GuillotinaReducerActionTypes.SET_FLASH,
|
|
162
255
|
payload: {
|
|
163
256
|
flash: {
|
|
164
257
|
message: message,
|
|
@@ -175,7 +268,8 @@ var Traversal = /*#__PURE__*/function () {
|
|
|
175
268
|
|
|
176
269
|
_proto.clearFlash = function clearFlash() {
|
|
177
270
|
this.dispatch({
|
|
178
|
-
type:
|
|
271
|
+
type: GuillotinaReducerActionTypes.CLEAR_FLASH,
|
|
272
|
+
payload: {}
|
|
179
273
|
});
|
|
180
274
|
};
|
|
181
275
|
|
|
@@ -185,7 +279,7 @@ var Traversal = /*#__PURE__*/function () {
|
|
|
185
279
|
}
|
|
186
280
|
|
|
187
281
|
this.dispatch({
|
|
188
|
-
type:
|
|
282
|
+
type: GuillotinaReducerActionTypes.SET_ACTION,
|
|
189
283
|
payload: {
|
|
190
284
|
action: action,
|
|
191
285
|
params: params
|
|
@@ -195,7 +289,8 @@ var Traversal = /*#__PURE__*/function () {
|
|
|
195
289
|
|
|
196
290
|
_proto.cancelAction = function cancelAction() {
|
|
197
291
|
this.dispatch({
|
|
198
|
-
type:
|
|
292
|
+
type: GuillotinaReducerActionTypes.CLEAR_ACTION,
|
|
293
|
+
payload: {}
|
|
199
294
|
});
|
|
200
295
|
};
|
|
201
296
|
|
|
@@ -232,6 +327,10 @@ var Traversal = /*#__PURE__*/function () {
|
|
|
232
327
|
}, {
|
|
233
328
|
key: "context",
|
|
234
329
|
get: function get() {
|
|
330
|
+
if (this.state.context === undefined) {
|
|
331
|
+
throw new Error('Context is not loaded');
|
|
332
|
+
}
|
|
333
|
+
|
|
235
334
|
return this.state.context;
|
|
236
335
|
}
|
|
237
336
|
}, {
|
|
@@ -254,7 +353,13 @@ function TraversalProvider(_ref3) {
|
|
|
254
353
|
});
|
|
255
354
|
}
|
|
256
355
|
function useTraversal() {
|
|
257
|
-
|
|
356
|
+
var traversal = React.useContext(TraversalContext);
|
|
357
|
+
|
|
358
|
+
if (!traversal) {
|
|
359
|
+
throw new Error('useTraversal must be used within a TraversalProvider');
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
return traversal;
|
|
258
363
|
}
|
|
259
364
|
function ClientProvider(_ref4) {
|
|
260
365
|
var children = _ref4.children,
|
|
@@ -265,7 +370,13 @@ function ClientProvider(_ref4) {
|
|
|
265
370
|
});
|
|
266
371
|
}
|
|
267
372
|
function useGuillotinaClient() {
|
|
268
|
-
|
|
373
|
+
var client = React.useContext(ClientContext);
|
|
374
|
+
|
|
375
|
+
if (!client) {
|
|
376
|
+
throw new Error('useGuillotinaClient must be used within a ClientProvider');
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
return client;
|
|
269
380
|
}
|
|
270
381
|
|
|
271
382
|
var genericMessages = reactIntl.defineMessages({
|
|
@@ -792,7 +903,7 @@ function stringToSlug(str) {
|
|
|
792
903
|
function sleep(ms) {
|
|
793
904
|
return new Promise(function (resolve) {
|
|
794
905
|
setTimeout(function () {
|
|
795
|
-
resolve(
|
|
906
|
+
resolve();
|
|
796
907
|
}, ms);
|
|
797
908
|
});
|
|
798
909
|
}
|
|
@@ -821,8 +932,6 @@ var getActionsObject = function getActionsObject(intl, multiple) {
|
|
|
821
932
|
};
|
|
822
933
|
|
|
823
934
|
var Button = function Button(_ref) {
|
|
824
|
-
var _ref2;
|
|
825
|
-
|
|
826
935
|
var children = _ref.children,
|
|
827
936
|
_ref$className = _ref.className,
|
|
828
937
|
className = _ref$className === void 0 ? 'is-primary' : _ref$className,
|
|
@@ -834,9 +943,7 @@ var Button = function Button(_ref) {
|
|
|
834
943
|
_ref$disabled = _ref.disabled,
|
|
835
944
|
disabled = _ref$disabled === void 0 ? false : _ref$disabled,
|
|
836
945
|
dataTest = _ref.dataTest;
|
|
837
|
-
|
|
838
|
-
var css = (_ref2 = []).concat.apply(_ref2, ['button'].concat(className.split(' ')));
|
|
839
|
-
|
|
946
|
+
var css = [].concat(className.split(' '), ['button']);
|
|
840
947
|
if (loading) css = css.concat('is-loading');
|
|
841
948
|
return jsxRuntime.jsx("p", {
|
|
842
949
|
className: "control",
|
|
@@ -851,6 +958,50 @@ var Button = function Button(_ref) {
|
|
|
851
958
|
});
|
|
852
959
|
};
|
|
853
960
|
|
|
961
|
+
var formatDate = function formatDate(str) {
|
|
962
|
+
var d = new Date(str);
|
|
963
|
+
var minutes = d.getMinutes() < 10 ? "0" + d.getMinutes() : d.getMinutes();
|
|
964
|
+
return d.getDate() + "/" + (d.getMonth() + 1) + "/" + d.getFullYear() + " " + d.getHours() + ":" + minutes;
|
|
965
|
+
};
|
|
966
|
+
var get = function get(obj, path, defValue) {
|
|
967
|
+
var _pathArray$reduce;
|
|
968
|
+
|
|
969
|
+
// If path is not defined or it has false value
|
|
970
|
+
if (!path) return defValue; // Check if path is string or array. Regex : ensure that we do not have '.' and brackets.
|
|
971
|
+
// Regex explained: https://regexr.com/58j0k
|
|
972
|
+
|
|
973
|
+
var pathArray = Array.isArray(path) ? path : path.match(/([^[.\]])+/g); // Find value if exist return otherwise return undefined value;
|
|
974
|
+
|
|
975
|
+
if (pathArray === null) return defValue;
|
|
976
|
+
return (_pathArray$reduce = pathArray.reduce(function (prevObj, key) {
|
|
977
|
+
return prevObj && prevObj[key];
|
|
978
|
+
}, obj)) != null ? _pathArray$reduce : defValue;
|
|
979
|
+
};
|
|
980
|
+
function getNewId(id) {
|
|
981
|
+
if (id === void 0) {
|
|
982
|
+
id = '';
|
|
983
|
+
}
|
|
984
|
+
|
|
985
|
+
var suffix = '-copy-';
|
|
986
|
+
var rgx = new RegExp("($|" + suffix + "\\d*)");
|
|
987
|
+
return stringToSlug(id).replace(rgx, function (r) {
|
|
988
|
+
var num = parseInt(r.replace(suffix, '') || '0');
|
|
989
|
+
return "" + suffix + (num + 1);
|
|
990
|
+
});
|
|
991
|
+
}
|
|
992
|
+
function debounce(callback, wait) {
|
|
993
|
+
var timer;
|
|
994
|
+
return function () {
|
|
995
|
+
var _arguments = arguments;
|
|
996
|
+
clearTimeout(timer);
|
|
997
|
+
return new Promise(function (resolve) {
|
|
998
|
+
timer = setTimeout(function () {
|
|
999
|
+
return resolve(callback.apply(void 0, [].slice.call(_arguments)));
|
|
1000
|
+
}, wait);
|
|
1001
|
+
});
|
|
1002
|
+
};
|
|
1003
|
+
}
|
|
1004
|
+
|
|
854
1005
|
function Modal(props) {
|
|
855
1006
|
var isActive = props.isActive,
|
|
856
1007
|
setActive = props.setActive,
|
|
@@ -947,7 +1098,7 @@ function PathTree(_ref2) {
|
|
|
947
1098
|
}), jsxRuntime.jsxs("form", {
|
|
948
1099
|
onSubmit: function onSubmit(e) {
|
|
949
1100
|
e.preventDefault();
|
|
950
|
-
onConfirm(e.
|
|
1101
|
+
onConfirm(get(e, 'target.0.value', ''), e.target);
|
|
951
1102
|
},
|
|
952
1103
|
children: [jsxRuntime.jsx("small", {
|
|
953
1104
|
style: {
|
|
@@ -979,51 +1130,6 @@ function PathTree(_ref2) {
|
|
|
979
1130
|
});
|
|
980
1131
|
}
|
|
981
1132
|
|
|
982
|
-
function useSetState(initialState) {
|
|
983
|
-
var _useState = React.useState(initialState),
|
|
984
|
-
state = _useState[0],
|
|
985
|
-
set = _useState[1];
|
|
986
|
-
|
|
987
|
-
var setState = React.useCallback(function (patch) {
|
|
988
|
-
set(function (prevState) {
|
|
989
|
-
return Object.assign({}, prevState, patch instanceof Function ? patch(prevState) : patch);
|
|
990
|
-
});
|
|
991
|
-
}, [set]);
|
|
992
|
-
return [state, setState];
|
|
993
|
-
}
|
|
994
|
-
|
|
995
|
-
function _catch(body, recover) {
|
|
996
|
-
try {
|
|
997
|
-
var result = body();
|
|
998
|
-
} catch (e) {
|
|
999
|
-
return recover(e);
|
|
1000
|
-
}
|
|
1001
|
-
|
|
1002
|
-
if (result && result.then) {
|
|
1003
|
-
return result.then(void 0, recover);
|
|
1004
|
-
}
|
|
1005
|
-
|
|
1006
|
-
return result;
|
|
1007
|
-
}
|
|
1008
|
-
|
|
1009
|
-
var initial = {
|
|
1010
|
-
loading: undefined,
|
|
1011
|
-
isError: false,
|
|
1012
|
-
errorMessage: undefined,
|
|
1013
|
-
result: undefined,
|
|
1014
|
-
response: undefined
|
|
1015
|
-
};
|
|
1016
|
-
|
|
1017
|
-
var getErrorMessage = function getErrorMessage(dataError, defaultValue) {
|
|
1018
|
-
if (dataError && dataError.details) {
|
|
1019
|
-
return dataError.details;
|
|
1020
|
-
} else if (dataError && dataError.reason) {
|
|
1021
|
-
return dataError.reason;
|
|
1022
|
-
}
|
|
1023
|
-
|
|
1024
|
-
return defaultValue;
|
|
1025
|
-
};
|
|
1026
|
-
|
|
1027
1133
|
var processResponse = function processResponse(res, ready_body) {
|
|
1028
1134
|
if (ready_body === void 0) {
|
|
1029
1135
|
ready_body = true;
|
|
@@ -1043,7 +1149,7 @@ var processResponse = function processResponse(res, ready_body) {
|
|
|
1043
1149
|
return {
|
|
1044
1150
|
isError: true,
|
|
1045
1151
|
loading: false,
|
|
1046
|
-
errorMessage: getErrorMessage(_res$json2, res.status),
|
|
1152
|
+
errorMessage: getErrorMessage(_res$json2, res.status).toString(),
|
|
1047
1153
|
response: res
|
|
1048
1154
|
};
|
|
1049
1155
|
});
|
|
@@ -1052,10 +1158,66 @@ var processResponse = function processResponse(res, ready_body) {
|
|
|
1052
1158
|
}
|
|
1053
1159
|
};
|
|
1054
1160
|
|
|
1055
|
-
var
|
|
1161
|
+
var getErrorMessage = function getErrorMessage(dataError, defaultValue) {
|
|
1162
|
+
if (dataError && dataError.details) {
|
|
1163
|
+
return dataError.details;
|
|
1164
|
+
} else if (dataError && dataError.reason) {
|
|
1165
|
+
return dataError.reason;
|
|
1166
|
+
}
|
|
1167
|
+
|
|
1168
|
+
return defaultValue;
|
|
1169
|
+
};
|
|
1170
|
+
|
|
1171
|
+
/**
|
|
1172
|
+
* Do setState like react class component.
|
|
1173
|
+
*/
|
|
1174
|
+
|
|
1175
|
+
function useSetState(initialState) {
|
|
1176
|
+
var _useState = React.useState(initialState),
|
|
1177
|
+
state = _useState[0],
|
|
1178
|
+
setState = _useState[1]; // Function which accepts a partial state to merge
|
|
1179
|
+
|
|
1180
|
+
|
|
1181
|
+
var setCustomState = React.useCallback(function (newPartialState) {
|
|
1182
|
+
try {
|
|
1183
|
+
setState(function (prevState) {
|
|
1184
|
+
return _extends({}, prevState, newPartialState);
|
|
1185
|
+
});
|
|
1186
|
+
} catch (error) {
|
|
1187
|
+
// eslint-disable-next-line no-console
|
|
1188
|
+
console.error(error);
|
|
1189
|
+
}
|
|
1190
|
+
}, []); // Return
|
|
1191
|
+
|
|
1192
|
+
return [state, setCustomState];
|
|
1193
|
+
} // **** Export Default **** //
|
|
1194
|
+
|
|
1195
|
+
function _catch(body, recover) {
|
|
1196
|
+
try {
|
|
1197
|
+
var result = body();
|
|
1198
|
+
} catch (e) {
|
|
1199
|
+
return recover(e);
|
|
1200
|
+
}
|
|
1201
|
+
|
|
1202
|
+
if (result && result.then) {
|
|
1203
|
+
return result.then(void 0, recover);
|
|
1204
|
+
}
|
|
1205
|
+
|
|
1206
|
+
return result;
|
|
1207
|
+
}
|
|
1208
|
+
|
|
1209
|
+
var initial = {
|
|
1210
|
+
loading: undefined,
|
|
1211
|
+
isError: false,
|
|
1212
|
+
errorMessage: undefined,
|
|
1213
|
+
result: undefined,
|
|
1214
|
+
response: undefined
|
|
1215
|
+
};
|
|
1216
|
+
|
|
1217
|
+
function patch(setState, Ctx) {
|
|
1056
1218
|
return function (data, endpoint, body) {
|
|
1057
|
-
if (
|
|
1058
|
-
|
|
1219
|
+
if (data === void 0) {
|
|
1220
|
+
data = {};
|
|
1059
1221
|
}
|
|
1060
1222
|
|
|
1061
1223
|
if (body === void 0) {
|
|
@@ -1063,7 +1225,7 @@ var patch = function patch(setState, Ctx) {
|
|
|
1063
1225
|
}
|
|
1064
1226
|
|
|
1065
1227
|
try {
|
|
1066
|
-
function
|
|
1228
|
+
function _temp3() {
|
|
1067
1229
|
setState(newState);
|
|
1068
1230
|
return newState;
|
|
1069
1231
|
}
|
|
@@ -1073,7 +1235,7 @@ var patch = function patch(setState, Ctx) {
|
|
|
1073
1235
|
});
|
|
1074
1236
|
var newState = {};
|
|
1075
1237
|
|
|
1076
|
-
var
|
|
1238
|
+
var _temp4 = _catch(function () {
|
|
1077
1239
|
var path = endpoint ? "" + Ctx.path + endpoint : Ctx.path;
|
|
1078
1240
|
return Promise.resolve(Ctx.client.patch(path, data)).then(function (res) {
|
|
1079
1241
|
return Promise.resolve(processResponse(res, body)).then(function (_processResponse) {
|
|
@@ -1088,29 +1250,25 @@ var patch = function patch(setState, Ctx) {
|
|
|
1088
1250
|
};
|
|
1089
1251
|
});
|
|
1090
1252
|
|
|
1091
|
-
return Promise.resolve(
|
|
1253
|
+
return Promise.resolve(_temp4 && _temp4.then ? _temp4.then(_temp3) : _temp3(_temp4));
|
|
1092
1254
|
} catch (e) {
|
|
1093
1255
|
return Promise.reject(e);
|
|
1094
1256
|
}
|
|
1095
1257
|
};
|
|
1096
|
-
}
|
|
1258
|
+
}
|
|
1097
1259
|
|
|
1098
|
-
|
|
1260
|
+
function del(setState, Ctx) {
|
|
1099
1261
|
return function (data, endpoint, body) {
|
|
1100
1262
|
if (data === void 0) {
|
|
1101
1263
|
data = {};
|
|
1102
1264
|
}
|
|
1103
1265
|
|
|
1104
|
-
if (endpoint === void 0) {
|
|
1105
|
-
endpoint = undefined;
|
|
1106
|
-
}
|
|
1107
|
-
|
|
1108
1266
|
if (body === void 0) {
|
|
1109
1267
|
body = false;
|
|
1110
1268
|
}
|
|
1111
1269
|
|
|
1112
1270
|
try {
|
|
1113
|
-
function
|
|
1271
|
+
function _temp7() {
|
|
1114
1272
|
setState(newState);
|
|
1115
1273
|
return newState;
|
|
1116
1274
|
}
|
|
@@ -1120,7 +1278,7 @@ var del = function del(setState, Ctx) {
|
|
|
1120
1278
|
});
|
|
1121
1279
|
var newState = {};
|
|
1122
1280
|
|
|
1123
|
-
var
|
|
1281
|
+
var _temp8 = _catch(function () {
|
|
1124
1282
|
var path = endpoint ? "" + Ctx.path + endpoint : Ctx.path;
|
|
1125
1283
|
return Promise.resolve(Ctx.client.delete(path, data)).then(function (res) {
|
|
1126
1284
|
return Promise.resolve(processResponse(res, body)).then(function (_processResponse2) {
|
|
@@ -1135,17 +1293,17 @@ var del = function del(setState, Ctx) {
|
|
|
1135
1293
|
};
|
|
1136
1294
|
});
|
|
1137
1295
|
|
|
1138
|
-
return Promise.resolve(
|
|
1296
|
+
return Promise.resolve(_temp8 && _temp8.then ? _temp8.then(_temp7) : _temp7(_temp8));
|
|
1139
1297
|
} catch (e) {
|
|
1140
1298
|
return Promise.reject(e);
|
|
1141
1299
|
}
|
|
1142
1300
|
};
|
|
1143
|
-
}
|
|
1301
|
+
}
|
|
1144
1302
|
|
|
1145
|
-
|
|
1303
|
+
function post(setState, Ctx) {
|
|
1146
1304
|
return function (data, endpoint, body) {
|
|
1147
|
-
if (
|
|
1148
|
-
|
|
1305
|
+
if (data === void 0) {
|
|
1306
|
+
data = {};
|
|
1149
1307
|
}
|
|
1150
1308
|
|
|
1151
1309
|
if (body === void 0) {
|
|
@@ -1153,7 +1311,7 @@ var post = function post(setState, Ctx) {
|
|
|
1153
1311
|
}
|
|
1154
1312
|
|
|
1155
1313
|
try {
|
|
1156
|
-
function
|
|
1314
|
+
function _temp11() {
|
|
1157
1315
|
setState(newState);
|
|
1158
1316
|
return newState;
|
|
1159
1317
|
}
|
|
@@ -1163,7 +1321,7 @@ var post = function post(setState, Ctx) {
|
|
|
1163
1321
|
});
|
|
1164
1322
|
var newState = {};
|
|
1165
1323
|
|
|
1166
|
-
var
|
|
1324
|
+
var _temp12 = _catch(function () {
|
|
1167
1325
|
var path = endpoint ? "" + Ctx.path + endpoint : Ctx.path;
|
|
1168
1326
|
return Promise.resolve(Ctx.client.post(path, data)).then(function (res) {
|
|
1169
1327
|
return Promise.resolve(processResponse(res, body)).then(function (_processResponse3) {
|
|
@@ -1178,21 +1336,17 @@ var post = function post(setState, Ctx) {
|
|
|
1178
1336
|
};
|
|
1179
1337
|
});
|
|
1180
1338
|
|
|
1181
|
-
return Promise.resolve(
|
|
1339
|
+
return Promise.resolve(_temp12 && _temp12.then ? _temp12.then(_temp11) : _temp11(_temp12));
|
|
1182
1340
|
} catch (e) {
|
|
1183
1341
|
return Promise.reject(e);
|
|
1184
1342
|
}
|
|
1185
1343
|
};
|
|
1186
|
-
}
|
|
1344
|
+
}
|
|
1187
1345
|
|
|
1188
|
-
|
|
1346
|
+
function get$1(setState, Ctx) {
|
|
1189
1347
|
return function (endpoint) {
|
|
1190
|
-
if (endpoint === void 0) {
|
|
1191
|
-
endpoint = undefined;
|
|
1192
|
-
}
|
|
1193
|
-
|
|
1194
1348
|
try {
|
|
1195
|
-
function
|
|
1349
|
+
function _temp15() {
|
|
1196
1350
|
setState(newState);
|
|
1197
1351
|
return newState;
|
|
1198
1352
|
}
|
|
@@ -1202,7 +1356,7 @@ var get = function get(setState, Ctx) {
|
|
|
1202
1356
|
});
|
|
1203
1357
|
var newState = {};
|
|
1204
1358
|
|
|
1205
|
-
var
|
|
1359
|
+
var _temp16 = _catch(function () {
|
|
1206
1360
|
var path = endpoint ? "" + Ctx.path + endpoint : Ctx.path;
|
|
1207
1361
|
return Promise.resolve(Ctx.client.get(path)).then(function (res) {
|
|
1208
1362
|
return Promise.resolve(processResponse(res, true)).then(function (_processResponse4) {
|
|
@@ -1217,12 +1371,16 @@ var get = function get(setState, Ctx) {
|
|
|
1217
1371
|
};
|
|
1218
1372
|
});
|
|
1219
1373
|
|
|
1220
|
-
return Promise.resolve(
|
|
1374
|
+
return Promise.resolve(_temp16 && _temp16.then ? _temp16.then(_temp15) : _temp15(_temp16));
|
|
1221
1375
|
} catch (e) {
|
|
1222
1376
|
return Promise.reject(e);
|
|
1223
1377
|
}
|
|
1224
1378
|
};
|
|
1225
|
-
}
|
|
1379
|
+
} // const get = (
|
|
1380
|
+
// setState: (value: Partial<State>) => void,
|
|
1381
|
+
// Ctx: Traversal
|
|
1382
|
+
// ) =>
|
|
1383
|
+
|
|
1226
1384
|
|
|
1227
1385
|
function useCrudContext() {
|
|
1228
1386
|
var Ctx = useTraversal();
|
|
@@ -1236,7 +1394,7 @@ function useCrudContext() {
|
|
|
1236
1394
|
patch: patch(setState, Ctx),
|
|
1237
1395
|
del: del(setState, Ctx),
|
|
1238
1396
|
post: post(setState, Ctx),
|
|
1239
|
-
get: get(setState, Ctx)
|
|
1397
|
+
get: get$1(setState, Ctx)
|
|
1240
1398
|
});
|
|
1241
1399
|
}
|
|
1242
1400
|
|
|
@@ -1284,9 +1442,6 @@ function AddItem(props) {
|
|
|
1284
1442
|
children: jsxRuntime.jsx(Form, {
|
|
1285
1443
|
loading: loading,
|
|
1286
1444
|
onSubmit: doSubmit,
|
|
1287
|
-
onError: function onError(err) {
|
|
1288
|
-
return console.log(err);
|
|
1289
|
-
},
|
|
1290
1445
|
actionName: 'Add ' + type,
|
|
1291
1446
|
title: 'Add ' + type,
|
|
1292
1447
|
type: type,
|
|
@@ -1296,7 +1451,7 @@ function AddItem(props) {
|
|
|
1296
1451
|
}
|
|
1297
1452
|
|
|
1298
1453
|
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'];
|
|
1299
|
-
var
|
|
1454
|
+
var defaultConfig = {
|
|
1300
1455
|
DisabledTypes: ['UserManager', 'GroupManager'],
|
|
1301
1456
|
PageSize: 10,
|
|
1302
1457
|
DelayActions: 200,
|
|
@@ -1307,21 +1462,41 @@ var Config = {
|
|
|
1307
1462
|
return (schema == null ? void 0 : schema.widget) === 'file' || (schema == null ? void 0 : schema.widget) === 'select' || (schema == null ? void 0 : schema.type) === 'array';
|
|
1308
1463
|
}
|
|
1309
1464
|
};
|
|
1310
|
-
var calculated = Object.assign({},
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
var
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1465
|
+
var calculated = Object.assign({}, defaultConfig);
|
|
1466
|
+
|
|
1467
|
+
function addConfig(updates, currentConfig) {
|
|
1468
|
+
var updatedConfig = _extends({}, currentConfig);
|
|
1469
|
+
|
|
1470
|
+
Object.entries(updates).forEach(function (_ref) {
|
|
1471
|
+
var key = _ref[0],
|
|
1472
|
+
value = _ref[1];
|
|
1473
|
+
var currentKey = key;
|
|
1474
|
+
var currentValue = currentConfig[currentKey];
|
|
1475
|
+
|
|
1476
|
+
if (Array.isArray(value) && Array.isArray(currentValue)) {
|
|
1477
|
+
var _extends2;
|
|
1478
|
+
|
|
1479
|
+
// Correctly type the array concatenation
|
|
1480
|
+
updatedConfig = _extends({}, updatedConfig, (_extends2 = {}, _extends2[currentKey] = [].concat(currentValue, value), _extends2));
|
|
1481
|
+
} else if (isPlainObject(value) && isPlainObject(currentValue)) {
|
|
1482
|
+
var _extends3;
|
|
1483
|
+
|
|
1484
|
+
// Correctly type the object merging
|
|
1485
|
+
updatedConfig = _extends({}, updatedConfig, (_extends3 = {}, _extends3[currentKey] = _extends({}, currentValue, value), _extends3));
|
|
1319
1486
|
} else {
|
|
1320
|
-
|
|
1487
|
+
var _extends4;
|
|
1488
|
+
|
|
1489
|
+
// Directly assign all other types
|
|
1490
|
+
updatedConfig = _extends({}, updatedConfig, (_extends4 = {}, _extends4[currentKey] = value, _extends4));
|
|
1321
1491
|
}
|
|
1322
1492
|
});
|
|
1323
|
-
return
|
|
1324
|
-
}
|
|
1493
|
+
return updatedConfig;
|
|
1494
|
+
} // Helper function to check if a value is a plain object (and not a React node, etc.)
|
|
1495
|
+
|
|
1496
|
+
|
|
1497
|
+
function isPlainObject(value) {
|
|
1498
|
+
return Object.prototype.toString.call(value) === '[object Object]';
|
|
1499
|
+
}
|
|
1325
1500
|
|
|
1326
1501
|
function useConfig(cfg) {
|
|
1327
1502
|
if (cfg === void 0) {
|
|
@@ -1345,7 +1520,7 @@ function RemoveItems(props) {
|
|
|
1345
1520
|
setLoading(true);
|
|
1346
1521
|
var actions = items.map(function (item) {
|
|
1347
1522
|
try {
|
|
1348
|
-
return Promise.resolve(Ctx.client.delete("" + Ctx.path + item
|
|
1523
|
+
return Promise.resolve(Ctx.client.delete("" + Ctx.path + item.id, {})).then(function (res) {
|
|
1349
1524
|
var _temp = function () {
|
|
1350
1525
|
if (!res.ok) {
|
|
1351
1526
|
return Promise.resolve(res.json()).then(function (err) {
|
|
@@ -1391,9 +1566,9 @@ function RemoveItems(props) {
|
|
|
1391
1566
|
|
|
1392
1567
|
var _props$items = props.items,
|
|
1393
1568
|
items = _props$items === void 0 ? [] : _props$items;
|
|
1394
|
-
var last = items[items.length - 1]
|
|
1569
|
+
var last = items[items.length - 1].id;
|
|
1395
1570
|
var itemsNames = items.map(function (item) {
|
|
1396
|
-
return item
|
|
1571
|
+
return item.id;
|
|
1397
1572
|
}).join(', ').replace(", " + last, " and " + last);
|
|
1398
1573
|
return jsxRuntime.jsx(Confirm, {
|
|
1399
1574
|
loading: loading,
|
|
@@ -1420,7 +1595,7 @@ var Checkbox = function Checkbox(_ref) {
|
|
|
1420
1595
|
dataTest = _ref.dataTest;
|
|
1421
1596
|
var inputRef = React.useRef(null);
|
|
1422
1597
|
|
|
1423
|
-
var _useState = React.useState(checked),
|
|
1598
|
+
var _useState = React.useState(!!checked),
|
|
1424
1599
|
state = _useState[0],
|
|
1425
1600
|
setState = _useState[1];
|
|
1426
1601
|
|
|
@@ -1439,13 +1614,13 @@ var Checkbox = function Checkbox(_ref) {
|
|
|
1439
1614
|
className: "field",
|
|
1440
1615
|
children: jsxRuntime.jsxs("label", {
|
|
1441
1616
|
htmlFor: id,
|
|
1442
|
-
className: classnames(['checkbox', className]),
|
|
1617
|
+
className: classnames(['checkbox', className != null ? className : '']),
|
|
1443
1618
|
children: [jsxRuntime.jsx("input", {
|
|
1444
1619
|
ref: inputRef,
|
|
1445
1620
|
disabled: disabled || loading,
|
|
1446
1621
|
id: id,
|
|
1447
1622
|
type: "checkbox",
|
|
1448
|
-
className: classnames(['checkbox', classNameInput]),
|
|
1623
|
+
className: classnames(['checkbox', classNameInput != null ? classNameInput : '']),
|
|
1449
1624
|
checked: state,
|
|
1450
1625
|
onChange: updateState,
|
|
1451
1626
|
"data-test": dataTest
|
|
@@ -1483,7 +1658,7 @@ var applyValidators = function applyValidators(value, validators) {
|
|
|
1483
1658
|
return result;
|
|
1484
1659
|
};
|
|
1485
1660
|
|
|
1486
|
-
var useInput = function useInput(onChange, value,
|
|
1661
|
+
var useInput = function useInput(onChange, value, validators) {
|
|
1487
1662
|
var _useState = React.useState({
|
|
1488
1663
|
hasError: false,
|
|
1489
1664
|
value: value
|
|
@@ -1492,7 +1667,7 @@ var useInput = function useInput(onChange, value, validator) {
|
|
|
1492
1667
|
setState = _useState[1];
|
|
1493
1668
|
|
|
1494
1669
|
var onUpdate = function onUpdate(ev) {
|
|
1495
|
-
var value = ev && ev.target ? ev.target.value :
|
|
1670
|
+
var value = ev && ev.target ? ev.target.value : '';
|
|
1496
1671
|
setState({
|
|
1497
1672
|
value: value,
|
|
1498
1673
|
hasError: false
|
|
@@ -1501,7 +1676,7 @@ var useInput = function useInput(onChange, value, validator) {
|
|
|
1501
1676
|
};
|
|
1502
1677
|
|
|
1503
1678
|
var onBlur = function onBlur() {
|
|
1504
|
-
var hasError = applyValidators(state.value,
|
|
1679
|
+
var hasError = applyValidators(state.value, validators) === false;
|
|
1505
1680
|
if (hasError) setState({
|
|
1506
1681
|
value: state.value,
|
|
1507
1682
|
hasError: hasError
|
|
@@ -1634,10 +1809,10 @@ var Input = React.forwardRef(function (_ref, ref) {
|
|
|
1634
1809
|
dataTest = _ref$dataTest === void 0 ? 'testInput' : _ref$dataTest,
|
|
1635
1810
|
disabled = _ref.disabled,
|
|
1636
1811
|
onKeyUp = _ref.onKeyUp;
|
|
1637
|
-
var validatorFn =
|
|
1812
|
+
var validatorFn = [];
|
|
1638
1813
|
|
|
1639
1814
|
if (required) {
|
|
1640
|
-
validatorFn = Array.isArray(validator) ?
|
|
1815
|
+
validatorFn = Array.isArray(validator) ? [].concat(validator, [notEmpty]) : [validator, notEmpty];
|
|
1641
1816
|
}
|
|
1642
1817
|
|
|
1643
1818
|
var _useInput = useInput(onChange, value != null ? value : '', validatorFn),
|
|
@@ -1652,15 +1827,15 @@ var Input = React.forwardRef(function (_ref, ref) {
|
|
|
1652
1827
|
setMounted = _useState2[1]; // eslint-disable-next-line
|
|
1653
1828
|
|
|
1654
1829
|
|
|
1655
|
-
|
|
1830
|
+
var newRef = ref || React.useRef();
|
|
1656
1831
|
React.useEffect(function () {
|
|
1657
1832
|
setMounted(true);
|
|
1658
1833
|
}, []);
|
|
1659
1834
|
React.useEffect(function () {
|
|
1660
|
-
if (autofocus && !error &&
|
|
1661
|
-
|
|
1835
|
+
if (autofocus && !error && newRef != null && typeof newRef !== 'function' && newRef.current) {
|
|
1836
|
+
newRef.current.focus();
|
|
1662
1837
|
}
|
|
1663
|
-
}, [mounted, autofocus,
|
|
1838
|
+
}, [mounted, autofocus, newRef, error]);
|
|
1664
1839
|
var theError = state.hasError ? errorMessage || 'invalid field' : '';
|
|
1665
1840
|
var statusClasses = state.hasError ? 'is-danger' : '';
|
|
1666
1841
|
|
|
@@ -1701,7 +1876,8 @@ Input.displayName = 'Input';
|
|
|
1701
1876
|
|
|
1702
1877
|
var Icon = function Icon(_ref) {
|
|
1703
1878
|
var icon = _ref.icon,
|
|
1704
|
-
className = _ref.className,
|
|
1879
|
+
_ref$className = _ref.className,
|
|
1880
|
+
className = _ref$className === void 0 ? '' : _ref$className,
|
|
1705
1881
|
align = _ref.align;
|
|
1706
1882
|
var addClass = className ? className.split(' ') : [className];
|
|
1707
1883
|
align = align || 'is-right';
|
|
@@ -1812,7 +1988,7 @@ function FormBuilder(_ref) {
|
|
|
1812
1988
|
remotes = _ref$remotes === void 0 ? {} : _ref$remotes,
|
|
1813
1989
|
_ref$submitButton = _ref.submitButton,
|
|
1814
1990
|
submitButton = _ref$submitButton === void 0 ? true : _ref$submitButton;
|
|
1815
|
-
var ref = React.useRef();
|
|
1991
|
+
var ref = React.useRef(null);
|
|
1816
1992
|
var properties = schema.properties,
|
|
1817
1993
|
required = schema.required;
|
|
1818
1994
|
var values = Object.assign({}, formData || {}); // build initial state
|
|
@@ -1825,7 +2001,7 @@ function FormBuilder(_ref) {
|
|
|
1825
2001
|
initialState[element] = values[element] || undefined;
|
|
1826
2002
|
}); // Register remotes
|
|
1827
2003
|
|
|
1828
|
-
if (
|
|
2004
|
+
if (ref.current === null) {
|
|
1829
2005
|
ref.current = {};
|
|
1830
2006
|
Object.keys(remotes).forEach(function (item) {
|
|
1831
2007
|
return ref.current[item] = remotes[item];
|
|
@@ -1842,15 +2018,16 @@ function FormBuilder(_ref) {
|
|
|
1842
2018
|
ref.current = ref.current || {};
|
|
1843
2019
|
|
|
1844
2020
|
var onUpdate = function onUpdate(field) {
|
|
1845
|
-
return function (
|
|
1846
|
-
ref.current[field] =
|
|
2021
|
+
return function (value) {
|
|
2022
|
+
ref.current[field] = value;
|
|
1847
2023
|
};
|
|
1848
2024
|
};
|
|
1849
2025
|
|
|
1850
2026
|
var GetTag = function GetTag(_ref2) {
|
|
1851
2027
|
var field = _ref2.field;
|
|
1852
2028
|
var property = properties[field];
|
|
1853
|
-
var
|
|
2029
|
+
var key = property.widget || property.type;
|
|
2030
|
+
var Tag = formComponents[key];
|
|
1854
2031
|
var props = {
|
|
1855
2032
|
value: initialState[field],
|
|
1856
2033
|
onChange: onUpdate(field),
|
|
@@ -1865,7 +2042,6 @@ function FormBuilder(_ref) {
|
|
|
1865
2042
|
props.placeholder += ' *';
|
|
1866
2043
|
}
|
|
1867
2044
|
|
|
1868
|
-
Tag.displayName = field + "Field";
|
|
1869
2045
|
return jsxRuntime.jsx(Tag, _extends({}, props));
|
|
1870
2046
|
};
|
|
1871
2047
|
|
|
@@ -1934,9 +2110,13 @@ var Select = React.forwardRef(function (_ref, ref) {
|
|
|
1934
2110
|
selectValue = selectValue.concat([ev.target.selectedOptions[i].value]);
|
|
1935
2111
|
}
|
|
1936
2112
|
|
|
1937
|
-
onChange
|
|
2113
|
+
if (onChange) {
|
|
2114
|
+
onChange(selectValue);
|
|
2115
|
+
}
|
|
1938
2116
|
} else {
|
|
1939
|
-
onChange
|
|
2117
|
+
if (onChange) {
|
|
2118
|
+
onChange(ev.target.value);
|
|
2119
|
+
}
|
|
1940
2120
|
}
|
|
1941
2121
|
};
|
|
1942
2122
|
|
|
@@ -1985,19 +2165,151 @@ var Select = React.forwardRef(function (_ref, ref) {
|
|
|
1985
2165
|
});
|
|
1986
2166
|
Select.displayName = 'Select';
|
|
1987
2167
|
|
|
1988
|
-
|
|
2168
|
+
function _catch$1(body, recover) {
|
|
2169
|
+
try {
|
|
2170
|
+
var result = body();
|
|
2171
|
+
} catch (e) {
|
|
2172
|
+
return recover(e);
|
|
2173
|
+
}
|
|
1989
2174
|
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
}
|
|
2175
|
+
if (result && result.then) {
|
|
2176
|
+
return result.then(void 0, recover);
|
|
2177
|
+
}
|
|
1993
2178
|
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
2179
|
+
return result;
|
|
2180
|
+
}
|
|
2181
|
+
|
|
2182
|
+
function useVocabulary(vocabularyName, path) {
|
|
2183
|
+
var traversal = useTraversal();
|
|
2184
|
+
|
|
2185
|
+
var _useSetState = useSetState({
|
|
2186
|
+
data: undefined,
|
|
2187
|
+
loading: false,
|
|
2188
|
+
error: undefined
|
|
2189
|
+
}),
|
|
2190
|
+
vocabulary = _useSetState[0],
|
|
2191
|
+
setVocabulary = _useSetState[1];
|
|
2192
|
+
|
|
2193
|
+
var getPath = function getPath() {
|
|
2194
|
+
if (path) return path;
|
|
2195
|
+
return traversal.path + "@vocabularies/" + vocabularyName;
|
|
2196
|
+
};
|
|
2197
|
+
|
|
2198
|
+
React.useEffect(function () {
|
|
2199
|
+
var getVocabulary = function getVocabulary() {
|
|
2200
|
+
try {
|
|
2201
|
+
var _temp3 = function () {
|
|
2202
|
+
if (vocabularyName && vocabulary.data === undefined && !vocabulary.loading) {
|
|
2203
|
+
var _temp4 = _catch$1(function () {
|
|
2204
|
+
setVocabulary({
|
|
2205
|
+
loading: true
|
|
2206
|
+
});
|
|
2207
|
+
return Promise.resolve(traversal.client.get(getPath())).then(function (data) {
|
|
2208
|
+
return Promise.resolve(data.json()).then(function (dataJson) {
|
|
2209
|
+
setVocabulary({
|
|
2210
|
+
loading: false,
|
|
2211
|
+
data: dataJson
|
|
2212
|
+
});
|
|
2213
|
+
});
|
|
2214
|
+
});
|
|
2215
|
+
}, function (err) {
|
|
2216
|
+
setVocabulary({
|
|
2217
|
+
loading: false,
|
|
2218
|
+
error: err,
|
|
2219
|
+
data: undefined
|
|
2220
|
+
});
|
|
2221
|
+
});
|
|
2222
|
+
|
|
2223
|
+
if (_temp4 && _temp4.then) return _temp4.then(function () {});
|
|
2224
|
+
}
|
|
2225
|
+
}();
|
|
2226
|
+
|
|
2227
|
+
return Promise.resolve(_temp3 && _temp3.then ? _temp3.then(function () {}) : void 0);
|
|
2228
|
+
} catch (e) {
|
|
2229
|
+
return Promise.reject(e);
|
|
2230
|
+
}
|
|
2231
|
+
};
|
|
2232
|
+
|
|
2233
|
+
getVocabulary();
|
|
2234
|
+
}, [vocabularyName, vocabulary, path]);
|
|
2235
|
+
return vocabulary;
|
|
2236
|
+
}
|
|
2237
|
+
|
|
2238
|
+
var SelectVocabulary = React.forwardRef(function (_ref, ref) {
|
|
2239
|
+
var vocabularyName = _ref.vocabularyName,
|
|
2240
|
+
className = _ref.className,
|
|
2241
|
+
classWrap = _ref.classWrap,
|
|
2242
|
+
val = _ref.val,
|
|
2243
|
+
dataTest = _ref.dataTest,
|
|
2244
|
+
multiple = _ref.multiple,
|
|
2245
|
+
onChange = _ref.onChange,
|
|
2246
|
+
id = _ref.id,
|
|
2247
|
+
placeholder = _ref.placeholder;
|
|
2248
|
+
var vocabulary = useVocabulary(vocabularyName);
|
|
2249
|
+
|
|
2250
|
+
var getOptions = function getOptions() {
|
|
2251
|
+
if (get(vocabulary, 'data.items', null)) {
|
|
2252
|
+
var _vocabulary$data$item, _vocabulary$data;
|
|
2253
|
+
|
|
2254
|
+
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) {
|
|
2255
|
+
return {
|
|
2256
|
+
text: item.title,
|
|
2257
|
+
value: item.token
|
|
2258
|
+
};
|
|
2259
|
+
});
|
|
2260
|
+
return vocData;
|
|
2261
|
+
}
|
|
2262
|
+
|
|
2263
|
+
return [];
|
|
2264
|
+
};
|
|
2265
|
+
|
|
2266
|
+
var getProps = function getProps() {
|
|
2267
|
+
if (multiple) {
|
|
2268
|
+
var currentValue = val || [];
|
|
2269
|
+
return {
|
|
2270
|
+
multiple: true,
|
|
2271
|
+
size: 5,
|
|
2272
|
+
value: currentValue,
|
|
2273
|
+
options: getOptions()
|
|
2274
|
+
};
|
|
2275
|
+
}
|
|
2276
|
+
|
|
2277
|
+
return {
|
|
2278
|
+
value: val != null ? val : '',
|
|
2279
|
+
appendDefault: true,
|
|
2280
|
+
options: getOptions()
|
|
2281
|
+
};
|
|
2282
|
+
};
|
|
2283
|
+
|
|
2284
|
+
if (vocabulary.data === undefined || vocabulary.loading) {
|
|
2285
|
+
return jsxRuntime.jsx("div", {});
|
|
2286
|
+
}
|
|
2287
|
+
|
|
2288
|
+
return jsxRuntime.jsx(Select, _extends({}, getProps(), {
|
|
2289
|
+
className: className,
|
|
2290
|
+
classWrap: classWrap || 'is-fullwidth',
|
|
2291
|
+
dataTest: dataTest,
|
|
2292
|
+
ref: ref,
|
|
2293
|
+
onChange: onChange,
|
|
2294
|
+
id: id,
|
|
2295
|
+
placeholder: placeholder
|
|
2296
|
+
}));
|
|
2297
|
+
});
|
|
2298
|
+
SelectVocabulary.displayName = 'SelectVocabulary';
|
|
2299
|
+
|
|
2300
|
+
// https://github.com/molefrog/wouter
|
|
2301
|
+
|
|
2302
|
+
var setURLParams = function setURLParams(p) {
|
|
2303
|
+
return window.history.pushState(0, '0', '' + '?' + p.toString().replace(/%2F/g, '/'));
|
|
2304
|
+
};
|
|
2305
|
+
|
|
2306
|
+
var clean = function clean(to) {
|
|
2307
|
+
var current = new URLSearchParams();
|
|
2308
|
+
Object.keys(to).forEach(function (_key) {
|
|
2309
|
+
return current.set(_key, to[_key]);
|
|
2310
|
+
});
|
|
2311
|
+
setURLParams(current);
|
|
2312
|
+
};
|
|
2001
2313
|
|
|
2002
2314
|
var useLocation = function useLocation() {
|
|
2003
2315
|
var _useState = React.useState(currentSearchParams()),
|
|
@@ -2063,19 +2375,30 @@ var patched = 0;
|
|
|
2063
2375
|
|
|
2064
2376
|
var patchHistoryEvents = function patchHistoryEvents() {
|
|
2065
2377
|
if (patched) return;
|
|
2066
|
-
|
|
2067
|
-
var original = window.history[type];
|
|
2378
|
+
var originalPushState = window.history.pushState;
|
|
2068
2379
|
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
|
|
2380
|
+
window.history.pushState = function () {
|
|
2381
|
+
var args = [].slice.call(arguments);
|
|
2382
|
+
var result = originalPushState.apply(this, args); // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2383
|
+
|
|
2384
|
+
var event = new Event('pushState');
|
|
2385
|
+
event.arguments = args;
|
|
2386
|
+
dispatchEvent(event);
|
|
2387
|
+
return result;
|
|
2388
|
+
};
|
|
2389
|
+
|
|
2390
|
+
var originalReplaceState = window.history.replaceState;
|
|
2391
|
+
|
|
2392
|
+
window.history.replaceState = function () {
|
|
2393
|
+
var args = [].slice.call(arguments);
|
|
2394
|
+
var result = originalReplaceState.apply(this, args); // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2395
|
+
|
|
2396
|
+
var event = new Event('replaceState');
|
|
2397
|
+
event.arguments = args;
|
|
2398
|
+
dispatchEvent(event);
|
|
2399
|
+
return result;
|
|
2400
|
+
};
|
|
2072
2401
|
|
|
2073
|
-
var event = new Event(type);
|
|
2074
|
-
event.arguments = args;
|
|
2075
|
-
dispatchEvent(event);
|
|
2076
|
-
return result;
|
|
2077
|
-
};
|
|
2078
|
-
});
|
|
2079
2402
|
return patched = 1;
|
|
2080
2403
|
};
|
|
2081
2404
|
|
|
@@ -2130,7 +2453,7 @@ function TdLink(_ref) {
|
|
|
2130
2453
|
children = _ref.children,
|
|
2131
2454
|
_ref$style = _ref.style,
|
|
2132
2455
|
style = _ref$style === void 0 ? {} : _ref$style;
|
|
2133
|
-
var link = React.useRef();
|
|
2456
|
+
var link = React.useRef(null);
|
|
2134
2457
|
|
|
2135
2458
|
function onClick() {
|
|
2136
2459
|
if (link && link.current) {
|
|
@@ -2237,15 +2560,7 @@ var RestClient = /*#__PURE__*/function () {
|
|
|
2237
2560
|
|
|
2238
2561
|
var _proto = RestClient.prototype;
|
|
2239
2562
|
|
|
2240
|
-
_proto.request = function request(path, data, headers) {
|
|
2241
|
-
if (data === void 0) {
|
|
2242
|
-
data = undefined;
|
|
2243
|
-
}
|
|
2244
|
-
|
|
2245
|
-
if (headers === void 0) {
|
|
2246
|
-
headers = undefined;
|
|
2247
|
-
}
|
|
2248
|
-
|
|
2563
|
+
_proto.request = function request(path, data, headers, signal) {
|
|
2249
2564
|
try {
|
|
2250
2565
|
var _this2 = this;
|
|
2251
2566
|
|
|
@@ -2261,9 +2576,18 @@ var RestClient = /*#__PURE__*/function () {
|
|
|
2261
2576
|
path = "/" + path;
|
|
2262
2577
|
}
|
|
2263
2578
|
|
|
2264
|
-
|
|
2265
|
-
|
|
2266
|
-
|
|
2579
|
+
var dataRequest = data || {};
|
|
2580
|
+
dataRequest.headers = _this2.getHeaders();
|
|
2581
|
+
|
|
2582
|
+
if (headers) {
|
|
2583
|
+
dataRequest.headers = _extends({}, dataRequest.headers, headers);
|
|
2584
|
+
}
|
|
2585
|
+
|
|
2586
|
+
if (signal) {
|
|
2587
|
+
dataRequest.signal = signal;
|
|
2588
|
+
}
|
|
2589
|
+
|
|
2590
|
+
return Promise.resolve(fetch("" + _this2.url + path, dataRequest));
|
|
2267
2591
|
} catch (e) {
|
|
2268
2592
|
return Promise.reject(e);
|
|
2269
2593
|
}
|
|
@@ -2271,12 +2595,12 @@ var RestClient = /*#__PURE__*/function () {
|
|
|
2271
2595
|
|
|
2272
2596
|
_proto.getHeaders = function getHeaders() {
|
|
2273
2597
|
var authToken = this.auth.getToken();
|
|
2274
|
-
|
|
2275
|
-
return
|
|
2276
|
-
|
|
2277
|
-
|
|
2278
|
-
|
|
2279
|
-
|
|
2598
|
+
var headersInit = {};
|
|
2599
|
+
if (!authToken) return headersInit;
|
|
2600
|
+
headersInit.Accept = 'application/json';
|
|
2601
|
+
headersInit['Content-Type'] = 'application/json';
|
|
2602
|
+
headersInit.Authorization = 'Bearer ' + authToken;
|
|
2603
|
+
return headersInit;
|
|
2280
2604
|
};
|
|
2281
2605
|
|
|
2282
2606
|
_proto.post = function post(path, data) {
|
|
@@ -2292,11 +2616,11 @@ var RestClient = /*#__PURE__*/function () {
|
|
|
2292
2616
|
}
|
|
2293
2617
|
};
|
|
2294
2618
|
|
|
2295
|
-
_proto.get = function get(path) {
|
|
2619
|
+
_proto.get = function get(path, signal) {
|
|
2296
2620
|
try {
|
|
2297
2621
|
var _this6 = this;
|
|
2298
2622
|
|
|
2299
|
-
return Promise.resolve(_this6.request(path));
|
|
2623
|
+
return Promise.resolve(_this6.request(path, undefined, undefined, signal));
|
|
2300
2624
|
} catch (e) {
|
|
2301
2625
|
return Promise.reject(e);
|
|
2302
2626
|
}
|
|
@@ -2334,24 +2658,20 @@ var RestClient = /*#__PURE__*/function () {
|
|
|
2334
2658
|
|
|
2335
2659
|
var headers = _this12.getHeaders();
|
|
2336
2660
|
|
|
2337
|
-
|
|
2338
|
-
|
|
2339
|
-
|
|
2340
|
-
|
|
2661
|
+
var newHeaders = {};
|
|
2662
|
+
newHeaders['Content-Type'] = data['content-type'];
|
|
2663
|
+
newHeaders['X-UPLOAD-FILENAME'] = data.filename;
|
|
2664
|
+
newHeaders['Content-Encoding'] = 'base64';
|
|
2341
2665
|
return Promise.resolve(_this12.request(path, {
|
|
2342
2666
|
method: 'PATCH',
|
|
2343
2667
|
body: data.data
|
|
2344
|
-
}, headers));
|
|
2668
|
+
}, _extends({}, headers, newHeaders)));
|
|
2345
2669
|
} catch (e) {
|
|
2346
2670
|
return Promise.reject(e);
|
|
2347
2671
|
}
|
|
2348
2672
|
};
|
|
2349
2673
|
|
|
2350
2674
|
_proto.delete = function _delete(path, data) {
|
|
2351
|
-
if (data === void 0) {
|
|
2352
|
-
data = undefined;
|
|
2353
|
-
}
|
|
2354
|
-
|
|
2355
2675
|
try {
|
|
2356
2676
|
var _this14 = this;
|
|
2357
2677
|
|
|
@@ -2492,6 +2812,14 @@ var GuillotinaClient = /*#__PURE__*/function () {
|
|
|
2492
2812
|
}
|
|
2493
2813
|
};
|
|
2494
2814
|
|
|
2815
|
+
_proto.getQueryParamsSearchFunction = function getQueryParamsSearchFunction(name) {
|
|
2816
|
+
if (name === 'getQueryParamsElasticsearch') {
|
|
2817
|
+
return this.getQueryParamsElasticsearch;
|
|
2818
|
+
}
|
|
2819
|
+
|
|
2820
|
+
return this.getQueryParamsPostresql;
|
|
2821
|
+
};
|
|
2822
|
+
|
|
2495
2823
|
_proto.getQueryParamsPostresql = function getQueryParamsPostresql(_ref) {
|
|
2496
2824
|
var _ref$start = _ref.start,
|
|
2497
2825
|
start = _ref$start === void 0 ? 0 : _ref$start,
|
|
@@ -2583,7 +2911,7 @@ var GuillotinaClient = /*#__PURE__*/function () {
|
|
|
2583
2911
|
label: 'id/name',
|
|
2584
2912
|
key: 'title',
|
|
2585
2913
|
isSortable: true,
|
|
2586
|
-
child: function child(m,
|
|
2914
|
+
child: function child(m, _navigate, search) {
|
|
2587
2915
|
return jsxRuntime.jsxs(TdLink, {
|
|
2588
2916
|
model: m,
|
|
2589
2917
|
children: [m.name, search && jsxRuntime.jsxs(React__default['default'].Fragment, {
|
|
@@ -2621,12 +2949,15 @@ var GuillotinaClient = /*#__PURE__*/function () {
|
|
|
2621
2949
|
;
|
|
2622
2950
|
|
|
2623
2951
|
_proto.applyCompat = function applyCompat(data) {
|
|
2624
|
-
|
|
2625
|
-
|
|
2626
|
-
|
|
2952
|
+
var result = _extends({}, data, {
|
|
2953
|
+
member: data.items,
|
|
2954
|
+
items_count: data.items_total
|
|
2955
|
+
});
|
|
2956
|
+
|
|
2957
|
+
return result;
|
|
2627
2958
|
};
|
|
2628
2959
|
|
|
2629
|
-
_proto.search = function search(path, params, container, prepare) {
|
|
2960
|
+
_proto.search = function search(path, params, container, prepare, signal) {
|
|
2630
2961
|
if (container === void 0) {
|
|
2631
2962
|
container = false;
|
|
2632
2963
|
}
|
|
@@ -2648,7 +2979,7 @@ var GuillotinaClient = /*#__PURE__*/function () {
|
|
|
2648
2979
|
|
|
2649
2980
|
var query = prepare ? toQueryString(params) : params;
|
|
2650
2981
|
var url = path + "@search?" + query;
|
|
2651
|
-
return Promise.resolve(_this7.rest.get(url)).then(function (res) {
|
|
2982
|
+
return Promise.resolve(_this7.rest.get(url, signal)).then(function (res) {
|
|
2652
2983
|
return Promise.resolve(res.json()).then(function (data) {
|
|
2653
2984
|
return _this7.applyCompat(data);
|
|
2654
2985
|
});
|
|
@@ -2860,23 +3191,53 @@ var GuillotinaClient = /*#__PURE__*/function () {
|
|
|
2860
3191
|
var users = _this37.getUsers(path);
|
|
2861
3192
|
|
|
2862
3193
|
return Promise.resolve(Promise.all([groups, users])).then(function (_ref3) {
|
|
2863
|
-
var
|
|
2864
|
-
|
|
3194
|
+
var responseGroups = _ref3[0],
|
|
3195
|
+
responseUsers = _ref3[1];
|
|
2865
3196
|
|
|
2866
|
-
function
|
|
2867
|
-
function
|
|
3197
|
+
function _temp8() {
|
|
3198
|
+
function _temp6() {
|
|
2868
3199
|
return {
|
|
2869
|
-
groups:
|
|
2870
|
-
users:
|
|
3200
|
+
groups: groupsData,
|
|
3201
|
+
users: usersData
|
|
2871
3202
|
};
|
|
2872
3203
|
}
|
|
2873
3204
|
|
|
2874
|
-
var
|
|
2875
|
-
|
|
3205
|
+
var _temp5 = function () {
|
|
3206
|
+
if (responseUsers) {
|
|
3207
|
+
return Promise.resolve(responseUsers.json()).then(function (usersDataResponse) {
|
|
3208
|
+
usersData = usersDataResponse.map(function (user) {
|
|
3209
|
+
return {
|
|
3210
|
+
'@name': user.id,
|
|
3211
|
+
user_roles: user.roles,
|
|
3212
|
+
fullname: user.fullname,
|
|
3213
|
+
email: user.email
|
|
3214
|
+
};
|
|
3215
|
+
});
|
|
3216
|
+
});
|
|
3217
|
+
}
|
|
3218
|
+
}();
|
|
3219
|
+
|
|
3220
|
+
return _temp5 && _temp5.then ? _temp5.then(_temp6) : _temp6(_temp5);
|
|
2876
3221
|
}
|
|
2877
3222
|
|
|
2878
|
-
var
|
|
2879
|
-
|
|
3223
|
+
var groupsData = [];
|
|
3224
|
+
var usersData = [];
|
|
3225
|
+
|
|
3226
|
+
var _temp7 = function () {
|
|
3227
|
+
if (responseGroups.ok) {
|
|
3228
|
+
return Promise.resolve(responseGroups.json()).then(function (groupsDataResponse) {
|
|
3229
|
+
groupsData = groupsDataResponse.map(function (group) {
|
|
3230
|
+
return {
|
|
3231
|
+
'@name': group.id,
|
|
3232
|
+
user_roles: group.roles,
|
|
3233
|
+
users: group.users
|
|
3234
|
+
};
|
|
3235
|
+
});
|
|
3236
|
+
});
|
|
3237
|
+
}
|
|
3238
|
+
}();
|
|
3239
|
+
|
|
3240
|
+
return _temp7 && _temp7.then ? _temp7.then(_temp8) : _temp8(_temp7);
|
|
2880
3241
|
});
|
|
2881
3242
|
} catch (e) {
|
|
2882
3243
|
return Promise.reject(e);
|
|
@@ -2918,7 +3279,7 @@ var GuillotinaClient = /*#__PURE__*/function () {
|
|
|
2918
3279
|
try {
|
|
2919
3280
|
var _this43 = this;
|
|
2920
3281
|
|
|
2921
|
-
function
|
|
3282
|
+
function _temp12() {
|
|
2922
3283
|
return cacheTypes[path];
|
|
2923
3284
|
}
|
|
2924
3285
|
|
|
@@ -2926,10 +3287,10 @@ var GuillotinaClient = /*#__PURE__*/function () {
|
|
|
2926
3287
|
path = path.slice(1);
|
|
2927
3288
|
}
|
|
2928
3289
|
|
|
2929
|
-
var
|
|
3290
|
+
var _temp13 = function () {
|
|
2930
3291
|
if (!cacheTypes[path]) {
|
|
2931
3292
|
return Promise.resolve(_this43.rest.get(path + '@addable-types')).then(function (types) {
|
|
2932
|
-
var
|
|
3293
|
+
var _temp9 = function () {
|
|
2933
3294
|
if (types.status === 401 || types.status === 404) {
|
|
2934
3295
|
cacheTypes[path] = [];
|
|
2935
3296
|
} else {
|
|
@@ -2939,12 +3300,12 @@ var GuillotinaClient = /*#__PURE__*/function () {
|
|
|
2939
3300
|
}
|
|
2940
3301
|
}();
|
|
2941
3302
|
|
|
2942
|
-
if (
|
|
3303
|
+
if (_temp9 && _temp9.then) return _temp9.then(function () {});
|
|
2943
3304
|
});
|
|
2944
3305
|
}
|
|
2945
3306
|
}();
|
|
2946
3307
|
|
|
2947
|
-
return Promise.resolve(
|
|
3308
|
+
return Promise.resolve(_temp13 && _temp13.then ? _temp13.then(_temp12) : _temp12(_temp13));
|
|
2948
3309
|
} catch (e) {
|
|
2949
3310
|
return Promise.reject(e);
|
|
2950
3311
|
}
|
|
@@ -2956,17 +3317,24 @@ function getClient(url, container, auth) {
|
|
|
2956
3317
|
return new GuillotinaClient(new RestClient(url, container, auth), container === '/');
|
|
2957
3318
|
}
|
|
2958
3319
|
var lightFileReader = function lightFileReader(file) {
|
|
2959
|
-
return new Promise(function (resolve) {
|
|
3320
|
+
return new Promise(function (resolve, reject) {
|
|
2960
3321
|
var reader = new FileReader();
|
|
2961
3322
|
reader.readAsArrayBuffer(file);
|
|
2962
3323
|
|
|
2963
3324
|
reader.onloadend = function (e) {
|
|
2964
|
-
var
|
|
2965
|
-
|
|
2966
|
-
|
|
2967
|
-
|
|
2968
|
-
|
|
2969
|
-
|
|
3325
|
+
var _e$target;
|
|
3326
|
+
|
|
3327
|
+
var fileData = e == null ? void 0 : (_e$target = e.target) == null ? void 0 : _e$target.result;
|
|
3328
|
+
|
|
3329
|
+
if (fileData) {
|
|
3330
|
+
resolve({
|
|
3331
|
+
filename: file.name.normalize('NFD').replace(/[\u0300-\u036f]/g, ''),
|
|
3332
|
+
data: fileData,
|
|
3333
|
+
'content-type': file.type
|
|
3334
|
+
});
|
|
3335
|
+
} else {
|
|
3336
|
+
reject('Error reading file');
|
|
3337
|
+
}
|
|
2970
3338
|
};
|
|
2971
3339
|
});
|
|
2972
3340
|
};
|
|
@@ -2997,9 +3365,15 @@ function FileUpload(_ref) {
|
|
|
2997
3365
|
|
|
2998
3366
|
var changed = function changed(event) {
|
|
2999
3367
|
try {
|
|
3000
|
-
|
|
3001
|
-
|
|
3002
|
-
|
|
3368
|
+
var _temp2 = function () {
|
|
3369
|
+
if (event.target.files) {
|
|
3370
|
+
return Promise.resolve(lightFileReader(event.target.files[0])).then(function (fileToUpload) {
|
|
3371
|
+
onChange(fileToUpload);
|
|
3372
|
+
});
|
|
3373
|
+
}
|
|
3374
|
+
}();
|
|
3375
|
+
|
|
3376
|
+
return Promise.resolve(_temp2 && _temp2.then ? _temp2.then(function () {}) : void 0);
|
|
3003
3377
|
} catch (e) {
|
|
3004
3378
|
return Promise.reject(e);
|
|
3005
3379
|
}
|
|
@@ -3090,12 +3464,12 @@ Textarea.displayName = 'Textarea';
|
|
|
3090
3464
|
|
|
3091
3465
|
var defaultEvents = ['mousedown', 'touchstart'];
|
|
3092
3466
|
|
|
3093
|
-
var on = function on(obj) {
|
|
3094
|
-
return obj.addEventListener
|
|
3467
|
+
var on = function on(obj, type, handler) {
|
|
3468
|
+
return obj.addEventListener(type, handler);
|
|
3095
3469
|
};
|
|
3096
3470
|
|
|
3097
|
-
var off = function off(obj) {
|
|
3098
|
-
return obj.removeEventListener
|
|
3471
|
+
var off = function off(obj, type, handler) {
|
|
3472
|
+
return obj.removeEventListener(type, handler);
|
|
3099
3473
|
};
|
|
3100
3474
|
|
|
3101
3475
|
function useClickAway(ref, onClickAway, events) {
|
|
@@ -3127,56 +3501,7 @@ function useClickAway(ref, onClickAway, events) {
|
|
|
3127
3501
|
}, [events, ref]);
|
|
3128
3502
|
}
|
|
3129
3503
|
|
|
3130
|
-
var
|
|
3131
|
-
var d = new Date(str);
|
|
3132
|
-
var minutes = d.getMinutes() < 10 ? "0" + d.getMinutes() : d.getMinutes();
|
|
3133
|
-
return d.getDate() + "/" + (d.getMonth() + 1) + "/" + d.getFullYear() + " " + d.getHours() + ":" + minutes;
|
|
3134
|
-
};
|
|
3135
|
-
var get$1 = function get(obj, path, defValue) {
|
|
3136
|
-
var _pathArray$reduce;
|
|
3137
|
-
|
|
3138
|
-
// If path is not defined or it has false value
|
|
3139
|
-
if (!path) return undefined; // Check if path is string or array. Regex : ensure that we do not have '.' and brackets.
|
|
3140
|
-
// Regex explained: https://regexr.com/58j0k
|
|
3141
|
-
|
|
3142
|
-
var pathArray = Array.isArray(path) ? path : path.match(/([^[.\]])+/g); // Find value if exist return otherwise return undefined value;
|
|
3143
|
-
|
|
3144
|
-
return (_pathArray$reduce = pathArray.reduce(function (prevObj, key) {
|
|
3145
|
-
return prevObj && prevObj[key];
|
|
3146
|
-
}, obj)) != null ? _pathArray$reduce : defValue;
|
|
3147
|
-
};
|
|
3148
|
-
function getNewId(id) {
|
|
3149
|
-
if (id === void 0) {
|
|
3150
|
-
id = '';
|
|
3151
|
-
}
|
|
3152
|
-
|
|
3153
|
-
var suffix = '-copy-';
|
|
3154
|
-
var rgx = new RegExp("($|" + suffix + "\\d*)");
|
|
3155
|
-
return stringToSlug(id).replace(rgx, function (r) {
|
|
3156
|
-
var num = parseInt(r.replace(suffix, '') || '0');
|
|
3157
|
-
return "" + suffix + (num + 1);
|
|
3158
|
-
});
|
|
3159
|
-
}
|
|
3160
|
-
|
|
3161
|
-
function debounce(func, wait) {
|
|
3162
|
-
var timeout;
|
|
3163
|
-
return function () {
|
|
3164
|
-
// eslint-disable-next-line @typescript-eslint/no-this-alias
|
|
3165
|
-
var context = this; // eslint-disable-next-line prefer-rest-params
|
|
3166
|
-
|
|
3167
|
-
var args = arguments;
|
|
3168
|
-
|
|
3169
|
-
var later = function later() {
|
|
3170
|
-
timeout = null;
|
|
3171
|
-
func.apply(context, args);
|
|
3172
|
-
};
|
|
3173
|
-
|
|
3174
|
-
clearTimeout(timeout);
|
|
3175
|
-
timeout = setTimeout(later, wait);
|
|
3176
|
-
};
|
|
3177
|
-
}
|
|
3178
|
-
|
|
3179
|
-
var initialState = {
|
|
3504
|
+
var initialState$1 = {
|
|
3180
3505
|
page: 0,
|
|
3181
3506
|
items: undefined,
|
|
3182
3507
|
loading: false,
|
|
@@ -3186,10 +3511,9 @@ var SearchInput = function SearchInput(_ref) {
|
|
|
3186
3511
|
var onChange = _ref.onChange,
|
|
3187
3512
|
error = _ref.error,
|
|
3188
3513
|
errorZoneClassName = _ref.errorZoneClassName,
|
|
3189
|
-
|
|
3190
|
-
traversal = _ref$traversal === void 0 ? null : _ref$traversal,
|
|
3514
|
+
traversal = _ref.traversal,
|
|
3191
3515
|
_ref$path = _ref.path,
|
|
3192
|
-
path = _ref$path === void 0 ?
|
|
3516
|
+
path = _ref$path === void 0 ? undefined : _ref$path,
|
|
3193
3517
|
_ref$qs = _ref.qs,
|
|
3194
3518
|
qs = _ref$qs === void 0 ? [] : _ref$qs,
|
|
3195
3519
|
_ref$queryCondition = _ref.queryCondition,
|
|
@@ -3204,14 +3528,14 @@ var SearchInput = function SearchInput(_ref) {
|
|
|
3204
3528
|
_ref$dataTestItem = _ref.dataTestItem,
|
|
3205
3529
|
dataTestItem = _ref$dataTestItem === void 0 ? 'searchInputItemTest' : _ref$dataTestItem,
|
|
3206
3530
|
_ref$renderTextItemOp = _ref.renderTextItemOption,
|
|
3207
|
-
renderTextItemOption = _ref$renderTextItemOp === void 0 ?
|
|
3531
|
+
renderTextItemOption = _ref$renderTextItemOp === void 0 ? undefined : _ref$renderTextItemOp,
|
|
3208
3532
|
_ref$typeNameQuery = _ref.typeNameQuery,
|
|
3209
|
-
typeNameQuery = _ref$typeNameQuery === void 0 ?
|
|
3533
|
+
typeNameQuery = _ref$typeNameQuery === void 0 ? undefined : _ref$typeNameQuery,
|
|
3210
3534
|
_ref$labelProperty = _ref.labelProperty,
|
|
3211
3535
|
labelProperty = _ref$labelProperty === void 0 ? 'id' : _ref$labelProperty;
|
|
3212
3536
|
var intl = reactIntl.useIntl();
|
|
3213
3537
|
|
|
3214
|
-
var _useSetState = useSetState(initialState),
|
|
3538
|
+
var _useSetState = useSetState(initialState$1),
|
|
3215
3539
|
options = _useSetState[0],
|
|
3216
3540
|
setOptions = _useSetState[1];
|
|
3217
3541
|
|
|
@@ -3265,7 +3589,7 @@ var SearchInput = function SearchInput(_ref) {
|
|
|
3265
3589
|
var searchTermParsed = ["id", value];
|
|
3266
3590
|
var getSearch = traversal.registry.get;
|
|
3267
3591
|
var fnName = getSearch('searchEngineQueryParamsFunction', SearchEngine);
|
|
3268
|
-
var qsParsed = traversal.client
|
|
3592
|
+
var qsParsed = traversal.client.getQueryParamsSearchFunction(fnName)({
|
|
3269
3593
|
path: traversal.path,
|
|
3270
3594
|
start: 0,
|
|
3271
3595
|
pageSize: PageSize,
|
|
@@ -3283,7 +3607,7 @@ var SearchInput = function SearchInput(_ref) {
|
|
|
3283
3607
|
|
|
3284
3608
|
return Promise.resolve(traversal.client.search(path ? path : traversal.client.getContainerFromPath(traversal.path), searchTermQs, false, false)).then(function (data) {
|
|
3285
3609
|
var newValuesLabel = data.items.reduce(function (result, item) {
|
|
3286
|
-
result[item.id] = get
|
|
3610
|
+
result[item.id] = get(item, labelProperty, item.id);
|
|
3287
3611
|
return result;
|
|
3288
3612
|
}, {});
|
|
3289
3613
|
setValueLabel(newValuesLabel);
|
|
@@ -3311,6 +3635,7 @@ var SearchInput = function SearchInput(_ref) {
|
|
|
3311
3635
|
}
|
|
3312
3636
|
|
|
3313
3637
|
try {
|
|
3638
|
+
console.log('handle search input');
|
|
3314
3639
|
setOptions({
|
|
3315
3640
|
loading: true
|
|
3316
3641
|
});
|
|
@@ -3325,7 +3650,7 @@ var SearchInput = function SearchInput(_ref) {
|
|
|
3325
3650
|
|
|
3326
3651
|
var fnName = _get('searchEngineQueryParamsFunction', SearchEngine);
|
|
3327
3652
|
|
|
3328
|
-
var qsParsed = traversal.client
|
|
3653
|
+
var qsParsed = traversal.client.getQueryParamsSearchFunction(fnName)({
|
|
3329
3654
|
path: traversal.path,
|
|
3330
3655
|
start: page * PageSize,
|
|
3331
3656
|
pageSize: PageSize,
|
|
@@ -3338,7 +3663,7 @@ var SearchInput = function SearchInput(_ref) {
|
|
|
3338
3663
|
typeNameParsed = parser("type_name__in=" + typeNameQuery);
|
|
3339
3664
|
}
|
|
3340
3665
|
|
|
3341
|
-
if (qs.length > 0 || searchTermParsed.length > 0 || qsParsed.length > 0 || typeNameParsed.length > 0) {
|
|
3666
|
+
if (qs.length > 0 || searchTermParsed.length > 0 || qsParsed.length > 0 || typeNameParsed.length > 0 || sortParsed.length > 0) {
|
|
3342
3667
|
searchTermQs = buildQs([].concat(qs, searchTermParsed, qsParsed, typeNameParsed, sortParsed));
|
|
3343
3668
|
}
|
|
3344
3669
|
|
|
@@ -3363,7 +3688,7 @@ var SearchInput = function SearchInput(_ref) {
|
|
|
3363
3688
|
return renderTextItemOption(item);
|
|
3364
3689
|
}
|
|
3365
3690
|
|
|
3366
|
-
return get
|
|
3691
|
+
return get(item, labelProperty, item.title) || item['@name'];
|
|
3367
3692
|
};
|
|
3368
3693
|
|
|
3369
3694
|
React.useEffect(function () {
|
|
@@ -3389,7 +3714,7 @@ var SearchInput = function SearchInput(_ref) {
|
|
|
3389
3714
|
if (!ev.currentTarget.contains(ev.relatedTarget)) {
|
|
3390
3715
|
if (searchTerm !== '') {
|
|
3391
3716
|
setSearchTerm('');
|
|
3392
|
-
setOptions(initialState);
|
|
3717
|
+
setOptions(initialState$1);
|
|
3393
3718
|
}
|
|
3394
3719
|
|
|
3395
3720
|
setIsOpen(false);
|
|
@@ -3407,6 +3732,7 @@ var SearchInput = function SearchInput(_ref) {
|
|
|
3407
3732
|
}
|
|
3408
3733
|
|
|
3409
3734
|
setIsOpen(!isOpen);
|
|
3735
|
+
console.log('on clic btn', options);
|
|
3410
3736
|
|
|
3411
3737
|
if (!options.loading && !options.items) {
|
|
3412
3738
|
handleSearch(options.page);
|
|
@@ -3415,7 +3741,7 @@ var SearchInput = function SearchInput(_ref) {
|
|
|
3415
3741
|
"aria-haspopup": "true",
|
|
3416
3742
|
"aria-controls": "dropdown-menu",
|
|
3417
3743
|
children: [jsxRuntime.jsx("span", {
|
|
3418
|
-
children: value ? get
|
|
3744
|
+
children: value ? get(valueLabel, value, value) : intl.formatMessage(genericMessages.choose)
|
|
3419
3745
|
}), jsxRuntime.jsx("span", {
|
|
3420
3746
|
className: "icon",
|
|
3421
3747
|
children: jsxRuntime.jsx("i", {
|
|
@@ -3489,25 +3815,7 @@ var SearchInput = function SearchInput(_ref) {
|
|
|
3489
3815
|
});
|
|
3490
3816
|
};
|
|
3491
3817
|
|
|
3492
|
-
|
|
3493
|
-
var timeout;
|
|
3494
|
-
return function () {
|
|
3495
|
-
// eslint-disable-next-line @typescript-eslint/no-this-alias
|
|
3496
|
-
var context = this; // eslint-disable-next-line prefer-rest-params
|
|
3497
|
-
|
|
3498
|
-
var args = arguments;
|
|
3499
|
-
|
|
3500
|
-
var later = function later() {
|
|
3501
|
-
timeout = null;
|
|
3502
|
-
func.apply(context, args);
|
|
3503
|
-
};
|
|
3504
|
-
|
|
3505
|
-
clearTimeout(timeout);
|
|
3506
|
-
timeout = setTimeout(later, wait);
|
|
3507
|
-
};
|
|
3508
|
-
}
|
|
3509
|
-
|
|
3510
|
-
var initialState$1 = {
|
|
3818
|
+
var initialState$2 = {
|
|
3511
3819
|
page: 0,
|
|
3512
3820
|
items: undefined,
|
|
3513
3821
|
loading: false,
|
|
@@ -3517,10 +3825,9 @@ var SearchInputList = function SearchInputList(_ref) {
|
|
|
3517
3825
|
var onChange = _ref.onChange,
|
|
3518
3826
|
error = _ref.error,
|
|
3519
3827
|
errorZoneClassName = _ref.errorZoneClassName,
|
|
3520
|
-
|
|
3521
|
-
traversal = _ref$traversal === void 0 ? null : _ref$traversal,
|
|
3828
|
+
traversal = _ref.traversal,
|
|
3522
3829
|
_ref$path = _ref.path,
|
|
3523
|
-
path = _ref$path === void 0 ?
|
|
3830
|
+
path = _ref$path === void 0 ? undefined : _ref$path,
|
|
3524
3831
|
_ref$qs = _ref.qs,
|
|
3525
3832
|
qs = _ref$qs === void 0 ? [] : _ref$qs,
|
|
3526
3833
|
_ref$queryCondition = _ref.queryCondition,
|
|
@@ -3535,14 +3842,14 @@ var SearchInputList = function SearchInputList(_ref) {
|
|
|
3535
3842
|
_ref$dataTestItem = _ref.dataTestItem,
|
|
3536
3843
|
dataTestItem = _ref$dataTestItem === void 0 ? 'searchInputItemTest' : _ref$dataTestItem,
|
|
3537
3844
|
_ref$renderTextItemOp = _ref.renderTextItemOption,
|
|
3538
|
-
renderTextItemOption = _ref$renderTextItemOp === void 0 ?
|
|
3845
|
+
renderTextItemOption = _ref$renderTextItemOp === void 0 ? undefined : _ref$renderTextItemOp,
|
|
3539
3846
|
_ref$typeNameQuery = _ref.typeNameQuery,
|
|
3540
|
-
typeNameQuery = _ref$typeNameQuery === void 0 ?
|
|
3847
|
+
typeNameQuery = _ref$typeNameQuery === void 0 ? undefined : _ref$typeNameQuery,
|
|
3541
3848
|
_ref$labelProperty = _ref.labelProperty,
|
|
3542
3849
|
labelProperty = _ref$labelProperty === void 0 ? 'id' : _ref$labelProperty;
|
|
3543
3850
|
var intl = reactIntl.useIntl();
|
|
3544
3851
|
|
|
3545
|
-
var _useSetState = useSetState(initialState$
|
|
3852
|
+
var _useSetState = useSetState(initialState$2),
|
|
3546
3853
|
options = _useSetState[0],
|
|
3547
3854
|
setOptions = _useSetState[1];
|
|
3548
3855
|
|
|
@@ -3588,7 +3895,7 @@ var SearchInputList = function SearchInputList(_ref) {
|
|
|
3588
3895
|
};
|
|
3589
3896
|
};
|
|
3590
3897
|
|
|
3591
|
-
var delayedQuery = React.useCallback(debounce
|
|
3898
|
+
var delayedQuery = React.useCallback(debounce(function (value) {
|
|
3592
3899
|
return handleSearch(0, false, value);
|
|
3593
3900
|
}, 500), []);
|
|
3594
3901
|
|
|
@@ -3620,7 +3927,7 @@ var SearchInputList = function SearchInputList(_ref) {
|
|
|
3620
3927
|
|
|
3621
3928
|
var fnName = _get('searchEngineQueryParamsFunction', SearchEngine);
|
|
3622
3929
|
|
|
3623
|
-
var qsParsed = traversal.client
|
|
3930
|
+
var qsParsed = traversal.client.getQueryParamsSearchFunction(fnName)({
|
|
3624
3931
|
path: traversal.path,
|
|
3625
3932
|
start: page * PageSize,
|
|
3626
3933
|
pageSize: PageSize,
|
|
@@ -3662,7 +3969,7 @@ var SearchInputList = function SearchInputList(_ref) {
|
|
|
3662
3969
|
var searchTermParsed = ['__or', "id=" + value.join('%26id=')];
|
|
3663
3970
|
var getSearch = traversal.registry.get;
|
|
3664
3971
|
var fnName = getSearch('searchEngineQueryParamsFunction', SearchEngine);
|
|
3665
|
-
var qsParsed = traversal.client
|
|
3972
|
+
var qsParsed = traversal.client.getQueryParamsSearchFunction(fnName)({
|
|
3666
3973
|
path: traversal.path,
|
|
3667
3974
|
start: 0,
|
|
3668
3975
|
pageSize: 100,
|
|
@@ -3678,9 +3985,9 @@ var SearchInputList = function SearchInputList(_ref) {
|
|
|
3678
3985
|
searchTermQs = buildQs([].concat(qs, [searchTermParsed], qsParsed, typeNameParsed));
|
|
3679
3986
|
}
|
|
3680
3987
|
|
|
3681
|
-
return Promise.resolve(traversal.client.search(path ? path : traversal.client.getContainerFromPath(traversal.path), searchTermQs, false, false
|
|
3988
|
+
return Promise.resolve(traversal.client.search(path ? path : traversal.client.getContainerFromPath(traversal.path), searchTermQs, false, false)).then(function (data) {
|
|
3682
3989
|
var newValuesLabel = data.items.reduce(function (result, item) {
|
|
3683
|
-
result[item.id] = get
|
|
3990
|
+
result[item.id] = get(item, labelProperty, item.id);
|
|
3684
3991
|
return result;
|
|
3685
3992
|
}, {});
|
|
3686
3993
|
setValuesLabels(newValuesLabel);
|
|
@@ -3700,7 +4007,7 @@ var SearchInputList = function SearchInputList(_ref) {
|
|
|
3700
4007
|
return renderTextItemOption(item);
|
|
3701
4008
|
}
|
|
3702
4009
|
|
|
3703
|
-
return get
|
|
4010
|
+
return get(item, labelProperty, item.title) || item['@name'];
|
|
3704
4011
|
};
|
|
3705
4012
|
|
|
3706
4013
|
React.useEffect(function () {
|
|
@@ -3723,7 +4030,7 @@ var SearchInputList = function SearchInputList(_ref) {
|
|
|
3723
4030
|
children: value.map(function (tag, index) {
|
|
3724
4031
|
return jsxRuntime.jsxs("div", {
|
|
3725
4032
|
className: "tag is-info is-medium",
|
|
3726
|
-
children: [get
|
|
4033
|
+
children: [get(valuesLabel, tag, tag), jsxRuntime.jsx("button", {
|
|
3727
4034
|
className: "delete is-small",
|
|
3728
4035
|
onClick: function onClick(ev) {
|
|
3729
4036
|
ev.stopPropagation();
|
|
@@ -3743,7 +4050,7 @@ var SearchInputList = function SearchInputList(_ref) {
|
|
|
3743
4050
|
if (!ev.currentTarget.contains(ev.relatedTarget)) {
|
|
3744
4051
|
if (searchTerm !== '') {
|
|
3745
4052
|
setSearchTerm('');
|
|
3746
|
-
setOptions(initialState$
|
|
4053
|
+
setOptions(initialState$2);
|
|
3747
4054
|
}
|
|
3748
4055
|
|
|
3749
4056
|
setIsOpen(false);
|
|
@@ -3807,7 +4114,7 @@ var SearchInputList = function SearchInputList(_ref) {
|
|
|
3807
4114
|
if (onChange && !value.includes(item.id)) {
|
|
3808
4115
|
var _extends2;
|
|
3809
4116
|
|
|
3810
|
-
setValuesLabels(_extends({}, valuesLabel, (_extends2 = {}, _extends2[item.id] = get
|
|
4117
|
+
setValuesLabels(_extends({}, valuesLabel, (_extends2 = {}, _extends2[item.id] = get(item, labelProperty, item.id), _extends2)));
|
|
3811
4118
|
onChange([].concat(value, [item.id]));
|
|
3812
4119
|
}
|
|
3813
4120
|
},
|
|
@@ -3995,7 +4302,7 @@ function EditableField(_ref) {
|
|
|
3995
4302
|
ref.current.focus();
|
|
3996
4303
|
}
|
|
3997
4304
|
});
|
|
3998
|
-
var canModified = modifyContent && !get
|
|
4305
|
+
var canModified = schema !== undefined && modifyContent && !get(schema, 'readonly', false);
|
|
3999
4306
|
|
|
4000
4307
|
var saveField = function saveField(ev) {
|
|
4001
4308
|
try {
|
|
@@ -4061,7 +4368,7 @@ function EditableField(_ref) {
|
|
|
4061
4368
|
var deleteField = function deleteField(ev) {
|
|
4062
4369
|
try {
|
|
4063
4370
|
if (ev) ev.preventDefault();
|
|
4064
|
-
return Promise.resolve(function () {
|
|
4371
|
+
return Promise.resolve(function (_schema$items) {
|
|
4065
4372
|
if ((schema == null ? void 0 : schema.widget) === 'file') {
|
|
4066
4373
|
var _ns2, _ref4, _ref5;
|
|
4067
4374
|
|
|
@@ -4089,7 +4396,7 @@ function EditableField(_ref) {
|
|
|
4089
4396
|
});
|
|
4090
4397
|
} else if ((schema == null ? void 0 : schema.type) === 'string' && schema != null && schema.enum) {
|
|
4091
4398
|
setValue(null);
|
|
4092
|
-
} else if ((schema == null ? void 0 : schema.type) === 'array' && (schema == null ? void 0 : schema.items.type) === 'string') {
|
|
4399
|
+
} else if ((schema == null ? void 0 : schema.type) === 'array' && (schema == null ? void 0 : (_schema$items = schema.items) == null ? void 0 : _schema$items.type) === 'string') {
|
|
4093
4400
|
setValue([]);
|
|
4094
4401
|
}
|
|
4095
4402
|
}());
|
|
@@ -4146,7 +4453,7 @@ function EditableField(_ref) {
|
|
|
4146
4453
|
dataTest: "editableFieldBtnCancelTest",
|
|
4147
4454
|
children: intl.formatMessage(genericMessages.cancel)
|
|
4148
4455
|
})
|
|
4149
|
-
}), !required && fieldHaveDeleteButton(schema) && jsxRuntime.jsx("div", {
|
|
4456
|
+
}), !required && schema && fieldHaveDeleteButton(schema) && jsxRuntime.jsx("div", {
|
|
4150
4457
|
className: "control",
|
|
4151
4458
|
children: jsxRuntime.jsx(Button, {
|
|
4152
4459
|
className: "is-small is-danger",
|
|
@@ -4246,80 +4553,6 @@ var DownloadField = function DownloadField(_ref) {
|
|
|
4246
4553
|
});
|
|
4247
4554
|
};
|
|
4248
4555
|
|
|
4249
|
-
function _catch$1(body, recover) {
|
|
4250
|
-
try {
|
|
4251
|
-
var result = body();
|
|
4252
|
-
} catch (e) {
|
|
4253
|
-
return recover(e);
|
|
4254
|
-
}
|
|
4255
|
-
|
|
4256
|
-
if (result && result.then) {
|
|
4257
|
-
return result.then(void 0, recover);
|
|
4258
|
-
}
|
|
4259
|
-
|
|
4260
|
-
return result;
|
|
4261
|
-
}
|
|
4262
|
-
|
|
4263
|
-
function useVocabulary(vocabularyName, path) {
|
|
4264
|
-
if (path === void 0) {
|
|
4265
|
-
path = null;
|
|
4266
|
-
}
|
|
4267
|
-
|
|
4268
|
-
var traversal = useTraversal();
|
|
4269
|
-
|
|
4270
|
-
var _useSetState = useSetState({
|
|
4271
|
-
data: undefined,
|
|
4272
|
-
loading: false,
|
|
4273
|
-
error: undefined
|
|
4274
|
-
}),
|
|
4275
|
-
vocabulary = _useSetState[0],
|
|
4276
|
-
setVocabulary = _useSetState[1];
|
|
4277
|
-
|
|
4278
|
-
var getPath = function getPath() {
|
|
4279
|
-
if (path) return path;
|
|
4280
|
-
return traversal.path + "@vocabularies/" + vocabularyName;
|
|
4281
|
-
};
|
|
4282
|
-
|
|
4283
|
-
React.useEffect(function () {
|
|
4284
|
-
var getVocabulary = function getVocabulary() {
|
|
4285
|
-
try {
|
|
4286
|
-
var _temp3 = function () {
|
|
4287
|
-
if (vocabularyName && vocabulary.data === undefined && !vocabulary.loading) {
|
|
4288
|
-
var _temp4 = _catch$1(function () {
|
|
4289
|
-
setVocabulary({
|
|
4290
|
-
loading: true
|
|
4291
|
-
});
|
|
4292
|
-
return Promise.resolve(traversal.client.get(getPath())).then(function (data) {
|
|
4293
|
-
return Promise.resolve(data.json()).then(function (dataJson) {
|
|
4294
|
-
setVocabulary({
|
|
4295
|
-
loading: false,
|
|
4296
|
-
data: dataJson
|
|
4297
|
-
});
|
|
4298
|
-
});
|
|
4299
|
-
});
|
|
4300
|
-
}, function (err) {
|
|
4301
|
-
setVocabulary({
|
|
4302
|
-
loading: false,
|
|
4303
|
-
error: err,
|
|
4304
|
-
data: undefined
|
|
4305
|
-
});
|
|
4306
|
-
});
|
|
4307
|
-
|
|
4308
|
-
if (_temp4 && _temp4.then) return _temp4.then(function () {});
|
|
4309
|
-
}
|
|
4310
|
-
}();
|
|
4311
|
-
|
|
4312
|
-
return Promise.resolve(_temp3 && _temp3.then ? _temp3.then(function () {}) : void 0);
|
|
4313
|
-
} catch (e) {
|
|
4314
|
-
return Promise.reject(e);
|
|
4315
|
-
}
|
|
4316
|
-
};
|
|
4317
|
-
|
|
4318
|
-
getVocabulary();
|
|
4319
|
-
}, [vocabularyName, vocabulary, path]);
|
|
4320
|
-
return vocabulary;
|
|
4321
|
-
}
|
|
4322
|
-
|
|
4323
4556
|
var plain = ['string', 'number', 'boolean'];
|
|
4324
4557
|
function RenderField(_ref) {
|
|
4325
4558
|
var value = _ref.value,
|
|
@@ -4341,23 +4574,27 @@ function RenderField(_ref) {
|
|
|
4341
4574
|
}
|
|
4342
4575
|
|
|
4343
4576
|
if (type === 'object') {
|
|
4577
|
+
var _schema$properties;
|
|
4578
|
+
|
|
4344
4579
|
if (Array.isArray(value)) {
|
|
4345
|
-
return value.map(function (item) {
|
|
4580
|
+
return value.map(function (item, index) {
|
|
4346
4581
|
return jsxRuntime.jsx("div", {
|
|
4347
4582
|
children: jsxRuntime.jsx(RenderField, {
|
|
4348
4583
|
value: item
|
|
4349
4584
|
})
|
|
4350
|
-
},
|
|
4585
|
+
}, "renderField_" + index + "_" + (schema == null ? void 0 : schema.title));
|
|
4351
4586
|
});
|
|
4352
4587
|
}
|
|
4353
4588
|
|
|
4354
|
-
|
|
4355
|
-
return
|
|
4356
|
-
|
|
4357
|
-
|
|
4358
|
-
|
|
4359
|
-
|
|
4360
|
-
|
|
4589
|
+
if ((schema == null ? void 0 : (_schema$properties = schema.properties) == null ? void 0 : _schema$properties.key) !== undefined) {
|
|
4590
|
+
return Object.keys(value).map(function (key) {
|
|
4591
|
+
return jsxRuntime.jsx(FieldValue, {
|
|
4592
|
+
field: get(schema, "properties." + key + ".title", key),
|
|
4593
|
+
schema: schema.properties.key,
|
|
4594
|
+
value: get(value, key, {})
|
|
4595
|
+
}, key);
|
|
4596
|
+
});
|
|
4597
|
+
}
|
|
4361
4598
|
}
|
|
4362
4599
|
|
|
4363
4600
|
return jsxRuntime.jsxs("p", {
|
|
@@ -4401,6 +4638,7 @@ var SearchRenderField = function SearchRenderField(_ref3) {
|
|
|
4401
4638
|
var schema = _ref3.schema,
|
|
4402
4639
|
value = _ref3.value,
|
|
4403
4640
|
modifyContent = _ref3.modifyContent;
|
|
4641
|
+
console.log('search render fields');
|
|
4404
4642
|
var intl = reactIntl.useIntl();
|
|
4405
4643
|
|
|
4406
4644
|
var _useState = React.useState([]),
|
|
@@ -4425,7 +4663,7 @@ var SearchRenderField = function SearchRenderField(_ref3) {
|
|
|
4425
4663
|
var searchTermParsed = ['__or', "id=" + valuesToSearch.join('%26id=')];
|
|
4426
4664
|
var getSearch = traversal.registry.get;
|
|
4427
4665
|
var fnName = getSearch('searchEngineQueryParamsFunction', SearchEngine);
|
|
4428
|
-
var qsParsed = traversal.client
|
|
4666
|
+
var qsParsed = traversal.client.getQueryParamsSearchFunction(fnName)({
|
|
4429
4667
|
path: traversal.path,
|
|
4430
4668
|
start: 0,
|
|
4431
4669
|
pageSize: 100,
|
|
@@ -4436,11 +4674,11 @@ var SearchRenderField = function SearchRenderField(_ref3) {
|
|
|
4436
4674
|
searchTermQs = buildQs([searchTermParsed].concat(qsParsed));
|
|
4437
4675
|
}
|
|
4438
4676
|
|
|
4439
|
-
return Promise.resolve(traversal.client.search(traversal.client.getContainerFromPath(traversal.path), searchTermQs, false, false
|
|
4677
|
+
return Promise.resolve(traversal.client.search(traversal.client.getContainerFromPath(traversal.path), searchTermQs, false, false)).then(function (data) {
|
|
4440
4678
|
var newValuesLabel = data.items.map(function (item) {
|
|
4441
4679
|
var _schema$labelProperty;
|
|
4442
4680
|
|
|
4443
|
-
return get
|
|
4681
|
+
return get(item, (_schema$labelProperty = schema == null ? void 0 : schema.labelProperty) != null ? _schema$labelProperty : 'title', item.id);
|
|
4444
4682
|
});
|
|
4445
4683
|
setValuesLabels(newValuesLabel);
|
|
4446
4684
|
setIsLoadingData(false);
|
|
@@ -4450,13 +4688,15 @@ var SearchRenderField = function SearchRenderField(_ref3) {
|
|
|
4450
4688
|
}
|
|
4451
4689
|
};
|
|
4452
4690
|
|
|
4453
|
-
var valuesToSearch =
|
|
4691
|
+
var valuesToSearch = [];
|
|
4454
4692
|
|
|
4455
|
-
if (typeof
|
|
4456
|
-
valuesToSearch = [
|
|
4693
|
+
if (typeof value === 'string' && value) {
|
|
4694
|
+
valuesToSearch = [value];
|
|
4695
|
+
} else if (Array.isArray(value)) {
|
|
4696
|
+
valuesToSearch = value;
|
|
4457
4697
|
}
|
|
4458
4698
|
|
|
4459
|
-
if (valuesToSearch
|
|
4699
|
+
if (valuesToSearch.length > 0) {
|
|
4460
4700
|
fetchData(valuesToSearch);
|
|
4461
4701
|
} else {
|
|
4462
4702
|
setValuesLabels([]);
|
|
@@ -4491,7 +4731,7 @@ var VocabularyRenderField = function VocabularyRenderField(_ref4) {
|
|
|
4491
4731
|
modifyContent = _ref4.modifyContent;
|
|
4492
4732
|
var intl = reactIntl.useIntl();
|
|
4493
4733
|
var DEFAULT_VALUE_EDITABLE_FIELD = getDefaultValueEditableField(intl);
|
|
4494
|
-
var vocabularyName = (schema == null ? void 0 : (_schema$items = schema.items) == null ? void 0 : _schema$items.vocabularyName) || (schema == null ? void 0 : schema.vocabularyName);
|
|
4734
|
+
var vocabularyName = (schema == null ? void 0 : (_schema$items = schema.items) == null ? void 0 : _schema$items.vocabularyName) || (schema == null ? void 0 : schema.vocabularyName) || '';
|
|
4495
4735
|
var vocabulary = useVocabulary(vocabularyName);
|
|
4496
4736
|
|
|
4497
4737
|
var getRenderProps = function getRenderProps() {
|
|
@@ -4502,7 +4742,7 @@ var VocabularyRenderField = function VocabularyRenderField(_ref4) {
|
|
|
4502
4742
|
if (schema != null && schema.vocabularyName) {
|
|
4503
4743
|
var _vocabularyValue$titl;
|
|
4504
4744
|
|
|
4505
|
-
var vocabularyValue = get
|
|
4745
|
+
var vocabularyValue = get(vocabulary, 'data.items', []).find(function (item) {
|
|
4506
4746
|
return item.token === value;
|
|
4507
4747
|
});
|
|
4508
4748
|
renderProps['value'] = (_vocabularyValue$titl = vocabularyValue == null ? void 0 : vocabularyValue.title) != null ? _vocabularyValue$titl : '';
|
|
@@ -4512,7 +4752,7 @@ var VocabularyRenderField = function VocabularyRenderField(_ref4) {
|
|
|
4512
4752
|
renderProps['value'] = ((_renderProps$value = renderProps['value']) != null ? _renderProps$value : []).map(function (value) {
|
|
4513
4753
|
var _get$find$title, _get$find;
|
|
4514
4754
|
|
|
4515
|
-
return (_get$find$title = (_get$find = get
|
|
4755
|
+
return (_get$find$title = (_get$find = get(vocabulary, 'data.items', []).find(function (item) {
|
|
4516
4756
|
return item.token === value;
|
|
4517
4757
|
})) == null ? void 0 : _get$find.title) != null ? _get$find$title : '';
|
|
4518
4758
|
});
|
|
@@ -4564,66 +4804,6 @@ function RenderFieldComponent(_ref5) {
|
|
|
4564
4804
|
return jsxRuntime.jsx(RenderField, _extends({}, getRenderProps()));
|
|
4565
4805
|
}
|
|
4566
4806
|
|
|
4567
|
-
var SelectVocabulary = React.forwardRef(function (_ref, ref) {
|
|
4568
|
-
var vocabularyName = _ref.vocabularyName,
|
|
4569
|
-
className = _ref.className,
|
|
4570
|
-
classWrap = _ref.classWrap,
|
|
4571
|
-
val = _ref.val,
|
|
4572
|
-
dataTest = _ref.dataTest,
|
|
4573
|
-
multiple = _ref.multiple,
|
|
4574
|
-
onChange = _ref.onChange,
|
|
4575
|
-
id = _ref.id,
|
|
4576
|
-
placeholder = _ref.placeholder;
|
|
4577
|
-
var vocabulary = useVocabulary(vocabularyName);
|
|
4578
|
-
|
|
4579
|
-
var getOptions = function getOptions() {
|
|
4580
|
-
if (get$1(vocabulary, 'data.items', null)) {
|
|
4581
|
-
var vocData = vocabulary.data.items.map(function (item) {
|
|
4582
|
-
return {
|
|
4583
|
-
text: item.title,
|
|
4584
|
-
value: item.token
|
|
4585
|
-
};
|
|
4586
|
-
});
|
|
4587
|
-
return vocData;
|
|
4588
|
-
}
|
|
4589
|
-
|
|
4590
|
-
return [];
|
|
4591
|
-
};
|
|
4592
|
-
|
|
4593
|
-
var getProps = function getProps() {
|
|
4594
|
-
if (multiple) {
|
|
4595
|
-
var currentValue = val || [];
|
|
4596
|
-
return {
|
|
4597
|
-
multiple: true,
|
|
4598
|
-
size: 5,
|
|
4599
|
-
value: currentValue,
|
|
4600
|
-
options: getOptions()
|
|
4601
|
-
};
|
|
4602
|
-
}
|
|
4603
|
-
|
|
4604
|
-
return {
|
|
4605
|
-
value: val != null ? val : '',
|
|
4606
|
-
appendDefault: true,
|
|
4607
|
-
options: getOptions()
|
|
4608
|
-
};
|
|
4609
|
-
};
|
|
4610
|
-
|
|
4611
|
-
if (vocabulary.data === undefined || vocabulary.loading) {
|
|
4612
|
-
return jsxRuntime.jsx("div", {});
|
|
4613
|
-
}
|
|
4614
|
-
|
|
4615
|
-
return jsxRuntime.jsx(Select, _extends({}, getProps(), {
|
|
4616
|
-
className: className,
|
|
4617
|
-
classWrap: classWrap || 'is-fullwidth',
|
|
4618
|
-
dataTest: dataTest,
|
|
4619
|
-
ref: ref,
|
|
4620
|
-
onChange: onChange,
|
|
4621
|
-
id: id,
|
|
4622
|
-
placeholder: placeholder
|
|
4623
|
-
}));
|
|
4624
|
-
});
|
|
4625
|
-
SelectVocabulary.displayName = 'SelectVocabulary';
|
|
4626
|
-
|
|
4627
4807
|
var EditComponent = React.forwardRef(function (_ref, ref) {
|
|
4628
4808
|
var schema = _ref.schema,
|
|
4629
4809
|
val = _ref.val,
|
|
@@ -4649,7 +4829,7 @@ var EditComponent = React.forwardRef(function (_ref, ref) {
|
|
|
4649
4829
|
queryCondition: schema != null && schema.queryCondition ? schema.queryCondition : 'title__in',
|
|
4650
4830
|
path: schema.queryPath,
|
|
4651
4831
|
labelProperty: schema != null && schema.labelProperty ? schema.labelProperty : 'title',
|
|
4652
|
-
typeNameQuery: schema
|
|
4832
|
+
typeNameQuery: schema == null ? void 0 : schema.typeNameQuery
|
|
4653
4833
|
})]
|
|
4654
4834
|
});
|
|
4655
4835
|
} else if ((schema == null ? void 0 : schema.widget) === 'search') {
|
|
@@ -4666,7 +4846,7 @@ var EditComponent = React.forwardRef(function (_ref, ref) {
|
|
|
4666
4846
|
queryCondition: schema != null && schema.queryCondition ? schema.queryCondition : 'title__in',
|
|
4667
4847
|
path: schema.queryPath,
|
|
4668
4848
|
labelProperty: schema != null && schema.labelProperty ? schema.labelProperty : 'title',
|
|
4669
|
-
typeNameQuery: schema
|
|
4849
|
+
typeNameQuery: schema == null ? void 0 : schema.typeNameQuery
|
|
4670
4850
|
})]
|
|
4671
4851
|
});
|
|
4672
4852
|
} else if ((schema == null ? void 0 : schema.widget) === 'textarea' || (schema == null ? void 0 : schema.widget) === 'richtext') {
|
|
@@ -4696,7 +4876,7 @@ var EditComponent = React.forwardRef(function (_ref, ref) {
|
|
|
4696
4876
|
|
|
4697
4877
|
if (schema.items.vocabularyName) {
|
|
4698
4878
|
return jsxRuntime.jsx(SelectVocabulary, {
|
|
4699
|
-
vocabularyName: get
|
|
4879
|
+
vocabularyName: get(schema, 'items.vocabularyName', ''),
|
|
4700
4880
|
val: val || [],
|
|
4701
4881
|
className: className,
|
|
4702
4882
|
classWrap: "is-fullwidth",
|
|
@@ -4733,22 +4913,25 @@ var EditComponent = React.forwardRef(function (_ref, ref) {
|
|
|
4733
4913
|
}), jsxRuntime.jsx(InputList, {
|
|
4734
4914
|
value: val || [],
|
|
4735
4915
|
className: className,
|
|
4736
|
-
onChange: function onChange(
|
|
4737
|
-
return _setValue(
|
|
4916
|
+
onChange: function onChange(val) {
|
|
4917
|
+
return _setValue(val);
|
|
4738
4918
|
},
|
|
4739
4919
|
ref: ref,
|
|
4740
4920
|
dataTest: dataTest
|
|
4741
4921
|
})]
|
|
4742
4922
|
});
|
|
4743
4923
|
} else if ((schema == null ? void 0 : schema.widget) === 'file') {
|
|
4924
|
+
var value = val;
|
|
4744
4925
|
return jsxRuntime.jsx(FileUpload, {
|
|
4745
4926
|
onChange: function onChange(ev) {
|
|
4746
4927
|
return _setValue(ev);
|
|
4747
4928
|
},
|
|
4748
|
-
label: get
|
|
4929
|
+
label: get(value, 'filename', undefined),
|
|
4749
4930
|
dataTest: dataTest
|
|
4750
4931
|
});
|
|
4751
4932
|
} else if ((schema == null ? void 0 : schema.widget) === 'select' && schema.type === 'string') {
|
|
4933
|
+
var _schema$vocabulary;
|
|
4934
|
+
|
|
4752
4935
|
if (schema != null && schema.vocabularyName) {
|
|
4753
4936
|
return jsxRuntime.jsx(SelectVocabulary, {
|
|
4754
4937
|
val: val || '',
|
|
@@ -4757,7 +4940,7 @@ var EditComponent = React.forwardRef(function (_ref, ref) {
|
|
|
4757
4940
|
classWrap: "is-fullwidth",
|
|
4758
4941
|
dataTest: dataTest,
|
|
4759
4942
|
onChange: _setValue,
|
|
4760
|
-
vocabularyName: get
|
|
4943
|
+
vocabularyName: get(schema, 'vocabularyName', ''),
|
|
4761
4944
|
placeholder: placeholder,
|
|
4762
4945
|
id: id
|
|
4763
4946
|
});
|
|
@@ -4769,7 +4952,7 @@ var EditComponent = React.forwardRef(function (_ref, ref) {
|
|
|
4769
4952
|
appendDefault: true,
|
|
4770
4953
|
classWrap: "is-fullwidth",
|
|
4771
4954
|
dataTest: dataTest,
|
|
4772
|
-
options: schema == null ? void 0 : schema.vocabulary.map(function (item) {
|
|
4955
|
+
options: ((_schema$vocabulary = schema == null ? void 0 : schema.vocabulary) != null ? _schema$vocabulary : []).map(function (item) {
|
|
4773
4956
|
return {
|
|
4774
4957
|
text: item,
|
|
4775
4958
|
value: item
|
|
@@ -4780,26 +4963,27 @@ var EditComponent = React.forwardRef(function (_ref, ref) {
|
|
|
4780
4963
|
id: id
|
|
4781
4964
|
});
|
|
4782
4965
|
} else if ((schema == null ? void 0 : schema.type) === 'object' && schema.widget !== 'file') {
|
|
4783
|
-
var
|
|
4966
|
+
var _value = val;
|
|
4784
4967
|
return jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
4785
4968
|
children: [schema.title && jsxRuntime.jsx("h4", {
|
|
4786
4969
|
className: "subtitle mt-2",
|
|
4787
4970
|
children: schema.title
|
|
4788
|
-
}), Object.keys(get
|
|
4971
|
+
}), Object.keys(get(schema, 'properties', {})).map(function (key) {
|
|
4789
4972
|
var _subSchema$title;
|
|
4790
4973
|
|
|
4791
|
-
var subSchema = get
|
|
4792
|
-
var requiredFields = get
|
|
4974
|
+
var subSchema = get(schema, "properties." + key, null);
|
|
4975
|
+
var requiredFields = get(schema, 'required', []);
|
|
4976
|
+
if (!subSchema) return null;
|
|
4793
4977
|
return jsxRuntime.jsx(EditComponent, {
|
|
4794
4978
|
id: id + "[" + key + "]",
|
|
4795
4979
|
schema: subSchema,
|
|
4796
|
-
val:
|
|
4980
|
+
val: _value && key in _value ? _value[key] : '',
|
|
4797
4981
|
placeholder: (_subSchema$title = subSchema == null ? void 0 : subSchema.title) != null ? _subSchema$title : '',
|
|
4798
4982
|
required: requiredFields.includes(key),
|
|
4799
4983
|
setValue: function setValue(ev) {
|
|
4800
4984
|
var _extends2;
|
|
4801
4985
|
|
|
4802
|
-
_setValue(_extends({},
|
|
4986
|
+
_setValue(_extends({}, _value, (_extends2 = {}, _extends2[key] = ev, _extends2)));
|
|
4803
4987
|
},
|
|
4804
4988
|
dataTest: key + "TestInput"
|
|
4805
4989
|
}, id + "[" + key + "]");
|
|
@@ -4861,9 +5045,9 @@ function IAttachment(_ref) {
|
|
|
4861
5045
|
}, 1), jsxRuntime.jsx("td", {
|
|
4862
5046
|
children: jsxRuntime.jsx(EditableField, {
|
|
4863
5047
|
field: key,
|
|
4864
|
-
value: values
|
|
5048
|
+
value: values.file,
|
|
4865
5049
|
ns: "guillotina.behaviors.attachment.IAttachment",
|
|
4866
|
-
schema: properties
|
|
5050
|
+
schema: properties.file,
|
|
4867
5051
|
modifyContent: modifyContent && ['file'].includes(key)
|
|
4868
5052
|
})
|
|
4869
5053
|
}, 2)]
|
|
@@ -4913,6 +5097,11 @@ function IMultiAttachment(_ref) {
|
|
|
4913
5097
|
|
|
4914
5098
|
setLoading(true);
|
|
4915
5099
|
setError(undefined);
|
|
5100
|
+
|
|
5101
|
+
if (!file) {
|
|
5102
|
+
return Promise.resolve();
|
|
5103
|
+
}
|
|
5104
|
+
|
|
4916
5105
|
var endpoint = Ctx.path + "@upload/files/" + fileKey;
|
|
4917
5106
|
return Promise.resolve(Ctx.client.upload(endpoint, file)).then(function (req) {
|
|
4918
5107
|
if (req.status !== 200) {
|
|
@@ -4981,7 +5170,7 @@ function IMultiAttachment(_ref) {
|
|
|
4981
5170
|
field: "files/" + key,
|
|
4982
5171
|
value: values['files'][key],
|
|
4983
5172
|
ns: "guillotina.behaviors.attachment.IMultiAttachment.files",
|
|
4984
|
-
schema: properties
|
|
5173
|
+
schema: get(properties, 'files.additionalProperties', {}),
|
|
4985
5174
|
modifyContent: false
|
|
4986
5175
|
}), jsxRuntime.jsx("div", {
|
|
4987
5176
|
className: "ml-5",
|
|
@@ -5205,13 +5394,18 @@ function IImageAttachment(_ref) {
|
|
|
5205
5394
|
ev.preventDefault();
|
|
5206
5395
|
setLoading(true);
|
|
5207
5396
|
setError(undefined);
|
|
5397
|
+
|
|
5398
|
+
if (!file) {
|
|
5399
|
+
return Promise.resolve();
|
|
5400
|
+
}
|
|
5401
|
+
|
|
5208
5402
|
var endpoint = Ctx.path + "@upload/image";
|
|
5209
5403
|
return Promise.resolve(Ctx.client.upload(endpoint, file)).then(function (req) {
|
|
5210
5404
|
var _exit;
|
|
5211
5405
|
|
|
5212
5406
|
function _temp4(_result) {
|
|
5213
5407
|
if (_exit) return _result;
|
|
5214
|
-
setFile(
|
|
5408
|
+
setFile(null);
|
|
5215
5409
|
setLoading(false);
|
|
5216
5410
|
Ctx.flash(intl.formatMessage(genericFileMessages.image_uploaded), 'success');
|
|
5217
5411
|
Ctx.refresh();
|
|
@@ -5492,7 +5686,7 @@ function IMultiImageAttachment(_ref) {
|
|
|
5492
5686
|
fileKey = _useState[0],
|
|
5493
5687
|
setFileKey = _useState[1];
|
|
5494
5688
|
|
|
5495
|
-
var _useState2 = React.useState(
|
|
5689
|
+
var _useState2 = React.useState(undefined),
|
|
5496
5690
|
file = _useState2[0],
|
|
5497
5691
|
setFile = _useState2[1];
|
|
5498
5692
|
|
|
@@ -5525,6 +5719,11 @@ function IMultiImageAttachment(_ref) {
|
|
|
5525
5719
|
|
|
5526
5720
|
setLoading(true);
|
|
5527
5721
|
setError(undefined);
|
|
5722
|
+
|
|
5723
|
+
if (!file) {
|
|
5724
|
+
return Promise.resolve();
|
|
5725
|
+
}
|
|
5726
|
+
|
|
5528
5727
|
var endpoint = Ctx.path + "@upload/images/" + fileKey;
|
|
5529
5728
|
return Promise.resolve(Ctx.client.upload(endpoint, file)).then(function (req) {
|
|
5530
5729
|
var _exit;
|
|
@@ -5627,7 +5826,7 @@ function IMultiImageAttachment(_ref) {
|
|
|
5627
5826
|
field: "images/" + key,
|
|
5628
5827
|
value: values['images'][key],
|
|
5629
5828
|
ns: "guillotina.contrib.image.behaviors.IMultiImageAttachment.images",
|
|
5630
|
-
schema: properties
|
|
5829
|
+
schema: get(properties, 'images.additionalProperties', {}),
|
|
5631
5830
|
modifyContent: false,
|
|
5632
5831
|
required: false
|
|
5633
5832
|
}), jsxRuntime.jsx("div", {
|
|
@@ -5917,7 +6116,7 @@ function IMultiImageOrderedAttachment(_ref2) {
|
|
|
5917
6116
|
sortedList = _useState2[0],
|
|
5918
6117
|
setSortedList = _useState2[1];
|
|
5919
6118
|
|
|
5920
|
-
var _useState3 = React.useState(
|
|
6119
|
+
var _useState3 = React.useState(undefined),
|
|
5921
6120
|
file = _useState3[0],
|
|
5922
6121
|
setFile = _useState3[1];
|
|
5923
6122
|
|
|
@@ -6061,7 +6260,7 @@ function IMultiImageOrderedAttachment(_ref2) {
|
|
|
6061
6260
|
field: "images/" + key,
|
|
6062
6261
|
value: values['images'][key],
|
|
6063
6262
|
ns: "guillotina.contrib.image.behaviors.IMultiImageAttachment.images",
|
|
6064
|
-
schema: properties
|
|
6263
|
+
schema: get(properties, 'images.additionalProperties', {}),
|
|
6065
6264
|
modifyContent: false,
|
|
6066
6265
|
required: false
|
|
6067
6266
|
}), jsxRuntime.jsx("div", {
|
|
@@ -6116,165 +6315,6 @@ function IMultiImageOrderedAttachment(_ref2) {
|
|
|
6116
6315
|
});
|
|
6117
6316
|
}
|
|
6118
6317
|
|
|
6119
|
-
var base = {
|
|
6120
|
-
local: {
|
|
6121
|
-
roleperm: {},
|
|
6122
|
-
prinperm: {},
|
|
6123
|
-
prinrole: {}
|
|
6124
|
-
},
|
|
6125
|
-
inherit: []
|
|
6126
|
-
};
|
|
6127
|
-
var Sharing = /*#__PURE__*/function () {
|
|
6128
|
-
function Sharing(element) {
|
|
6129
|
-
this.local = void 0;
|
|
6130
|
-
this.inherit = void 0;
|
|
6131
|
-
Object.assign(this, element || base);
|
|
6132
|
-
}
|
|
6133
|
-
|
|
6134
|
-
var _proto = Sharing.prototype;
|
|
6135
|
-
|
|
6136
|
-
_proto.getRole = function getRole(role) {
|
|
6137
|
-
return this.local.roleperm[role];
|
|
6138
|
-
};
|
|
6139
|
-
|
|
6140
|
-
_proto.getPrincipals = function getPrincipals(principal) {
|
|
6141
|
-
return this.local.prinperm[principal];
|
|
6142
|
-
};
|
|
6143
|
-
|
|
6144
|
-
_proto.getPrinroles = function getPrinroles(role) {
|
|
6145
|
-
return this.local.prinrole[role];
|
|
6146
|
-
};
|
|
6147
|
-
|
|
6148
|
-
_createClass(Sharing, [{
|
|
6149
|
-
key: "roles",
|
|
6150
|
-
get: function get() {
|
|
6151
|
-
return Object.keys(this.local.roleperm);
|
|
6152
|
-
}
|
|
6153
|
-
}, {
|
|
6154
|
-
key: "principals",
|
|
6155
|
-
get: function get() {
|
|
6156
|
-
return Object.keys(this.local.prinperm);
|
|
6157
|
-
}
|
|
6158
|
-
}, {
|
|
6159
|
-
key: "prinrole",
|
|
6160
|
-
get: function get() {
|
|
6161
|
-
return Object.keys(this.local.prinrole);
|
|
6162
|
-
}
|
|
6163
|
-
}]);
|
|
6164
|
-
|
|
6165
|
-
return Sharing;
|
|
6166
|
-
}();
|
|
6167
|
-
|
|
6168
|
-
var ItemModel = /*#__PURE__*/function () {
|
|
6169
|
-
function ItemModel(item, url) {
|
|
6170
|
-
if (url === void 0) {
|
|
6171
|
-
url = '';
|
|
6172
|
-
}
|
|
6173
|
-
|
|
6174
|
-
this.item = void 0;
|
|
6175
|
-
this.url = void 0;
|
|
6176
|
-
this.item = item;
|
|
6177
|
-
this.url = url;
|
|
6178
|
-
}
|
|
6179
|
-
|
|
6180
|
-
_createClass(ItemModel, [{
|
|
6181
|
-
key: "path",
|
|
6182
|
-
get: function get() {
|
|
6183
|
-
// Compat
|
|
6184
|
-
var item = this.item['@id'] ? this.item['@id'] : this.item['@absolute_url'];
|
|
6185
|
-
var path = item.split('//')[1].split('/').splice(1).join('/');
|
|
6186
|
-
path = "/" + path + "/";
|
|
6187
|
-
|
|
6188
|
-
if (this.url.length > 0) {
|
|
6189
|
-
if (this.url.startsWith('/')) {
|
|
6190
|
-
path = path.replace(this.url.substring(1), '');
|
|
6191
|
-
} else {
|
|
6192
|
-
path = path.replace(this.url, '');
|
|
6193
|
-
}
|
|
6194
|
-
}
|
|
6195
|
-
|
|
6196
|
-
return path;
|
|
6197
|
-
}
|
|
6198
|
-
}, {
|
|
6199
|
-
key: "name",
|
|
6200
|
-
get: function get() {
|
|
6201
|
-
return this.item.title || this.item['@name'];
|
|
6202
|
-
}
|
|
6203
|
-
}, {
|
|
6204
|
-
key: "icon",
|
|
6205
|
-
get: function get() {
|
|
6206
|
-
// eslint-disable-next-line
|
|
6207
|
-
var cfg = useConfig();
|
|
6208
|
-
|
|
6209
|
-
if (cfg.icons && cfg.icons[this.type]) {
|
|
6210
|
-
return cfg.icons[this.type];
|
|
6211
|
-
}
|
|
6212
|
-
|
|
6213
|
-
switch (this.type) {
|
|
6214
|
-
case 'GroupManager':
|
|
6215
|
-
return 'fas fa-users-cog';
|
|
6216
|
-
|
|
6217
|
-
case 'UserManager':
|
|
6218
|
-
return 'fas fa-user-cog';
|
|
6219
|
-
|
|
6220
|
-
case 'User':
|
|
6221
|
-
return 'fas fa-user';
|
|
6222
|
-
|
|
6223
|
-
case 'Group':
|
|
6224
|
-
return 'fas fa-users';
|
|
6225
|
-
|
|
6226
|
-
case 'Folder':
|
|
6227
|
-
return 'fas fa-folder';
|
|
6228
|
-
|
|
6229
|
-
default:
|
|
6230
|
-
return 'fas fa-file';
|
|
6231
|
-
}
|
|
6232
|
-
}
|
|
6233
|
-
}, {
|
|
6234
|
-
key: "fullPath",
|
|
6235
|
-
get: function get() {
|
|
6236
|
-
return this.url + this.item.id;
|
|
6237
|
-
}
|
|
6238
|
-
}, {
|
|
6239
|
-
key: "id",
|
|
6240
|
-
get: function get() {
|
|
6241
|
-
if (this.item.id) {
|
|
6242
|
-
return this.item.id;
|
|
6243
|
-
}
|
|
6244
|
-
|
|
6245
|
-
var id = this.item['@id'].split('&')[0].split('/');
|
|
6246
|
-
return id[id.length - 1];
|
|
6247
|
-
}
|
|
6248
|
-
}, {
|
|
6249
|
-
key: "uid",
|
|
6250
|
-
get: function get() {
|
|
6251
|
-
return this.item['@uid'];
|
|
6252
|
-
}
|
|
6253
|
-
}, {
|
|
6254
|
-
key: "type",
|
|
6255
|
-
get: function get() {
|
|
6256
|
-
return this.item['@type'] || this.item.type_name;
|
|
6257
|
-
}
|
|
6258
|
-
}, {
|
|
6259
|
-
key: "title",
|
|
6260
|
-
get: function get() {
|
|
6261
|
-
return this.item.title;
|
|
6262
|
-
}
|
|
6263
|
-
}, {
|
|
6264
|
-
key: "created",
|
|
6265
|
-
get: function get() {
|
|
6266
|
-
return this.item.creation_date ? formatDate(this.item.creation_date) : '';
|
|
6267
|
-
}
|
|
6268
|
-
}, {
|
|
6269
|
-
key: "updated",
|
|
6270
|
-
get: function get() {
|
|
6271
|
-
return this.item.modification_date ? formatDate(this.item.modification_date) : '';
|
|
6272
|
-
}
|
|
6273
|
-
}]);
|
|
6274
|
-
|
|
6275
|
-
return ItemModel;
|
|
6276
|
-
}();
|
|
6277
|
-
|
|
6278
6318
|
var messages$1 = reactIntl.defineMessages({
|
|
6279
6319
|
status_changed_ok: {
|
|
6280
6320
|
id: "status_changed_ok",
|
|
@@ -6350,13 +6390,12 @@ function IWorkflow() {
|
|
|
6350
6390
|
definition = _useState[0],
|
|
6351
6391
|
setDefinition = _useState[1];
|
|
6352
6392
|
|
|
6353
|
-
var _useState2 = React.useState(
|
|
6393
|
+
var _useState2 = React.useState(undefined),
|
|
6354
6394
|
workflowAction = _useState2[0],
|
|
6355
6395
|
setWorkflowAction = _useState2[1];
|
|
6356
6396
|
|
|
6357
|
-
var model = new ItemModel(Ctx.context);
|
|
6358
6397
|
var vocabulary = useVocabulary('workflow_states');
|
|
6359
|
-
var currentState =
|
|
6398
|
+
var currentState = Ctx.context['guillotina.contrib.workflows.interfaces.IWorkflowBehavior']['review_state'];
|
|
6360
6399
|
React.useEffect(function () {
|
|
6361
6400
|
loadDefinition();
|
|
6362
6401
|
}, [Ctx.path]);
|
|
@@ -6376,7 +6415,7 @@ function IWorkflow() {
|
|
|
6376
6415
|
}
|
|
6377
6416
|
|
|
6378
6417
|
Ctx.refresh();
|
|
6379
|
-
setWorkflowAction(
|
|
6418
|
+
setWorkflowAction(undefined);
|
|
6380
6419
|
});
|
|
6381
6420
|
});
|
|
6382
6421
|
} catch (e) {
|
|
@@ -6385,21 +6424,23 @@ function IWorkflow() {
|
|
|
6385
6424
|
};
|
|
6386
6425
|
|
|
6387
6426
|
var getStateTitle = function getStateTitle() {
|
|
6388
|
-
var _vocabulary$data, _vocabulary$data
|
|
6427
|
+
var _vocabulary$data$item, _vocabulary$data;
|
|
6428
|
+
|
|
6429
|
+
if (((_vocabulary$data$item = (_vocabulary$data = vocabulary.data) == null ? void 0 : _vocabulary$data.items) != null ? _vocabulary$data$item : []).length > 0) {
|
|
6430
|
+
var _vocabulary$data2;
|
|
6389
6431
|
|
|
6390
|
-
|
|
6391
|
-
var vocabularyValue = vocabulary.data.items.find(function (item) {
|
|
6432
|
+
var vocabularyValue = vocabulary == null ? void 0 : (_vocabulary$data2 = vocabulary.data) == null ? void 0 : _vocabulary$data2.items.find(function (item) {
|
|
6392
6433
|
return item.token === currentState;
|
|
6393
6434
|
});
|
|
6394
6435
|
|
|
6395
6436
|
if (vocabularyValue) {
|
|
6396
|
-
var translatedValue = get
|
|
6437
|
+
var translatedValue = get(vocabularyValue, "title.translated_title." + intl.locale, null);
|
|
6397
6438
|
|
|
6398
6439
|
if (translatedValue !== null) {
|
|
6399
6440
|
return translatedValue;
|
|
6400
6441
|
}
|
|
6401
6442
|
|
|
6402
|
-
var titleValue = get
|
|
6443
|
+
var titleValue = get(vocabularyValue, "title.title." + intl.locale, null);
|
|
6403
6444
|
|
|
6404
6445
|
if (titleValue !== null) {
|
|
6405
6446
|
return titleValue;
|
|
@@ -6415,7 +6456,7 @@ function IWorkflow() {
|
|
|
6415
6456
|
children: [workflowAction && jsxRuntime.jsx(Confirm, {
|
|
6416
6457
|
loading: loading,
|
|
6417
6458
|
onCancel: function onCancel() {
|
|
6418
|
-
return setWorkflowAction(
|
|
6459
|
+
return setWorkflowAction(undefined);
|
|
6419
6460
|
},
|
|
6420
6461
|
onConfirm: doWorkflowAction,
|
|
6421
6462
|
message: intl.formatMessage(messages$1.confirm_message, {
|
|
@@ -6441,7 +6482,7 @@ function IWorkflow() {
|
|
|
6441
6482
|
onClick: function onClick() {
|
|
6442
6483
|
return setWorkflowAction(transition['@id'].split('@workflow')[1].slice(1));
|
|
6443
6484
|
},
|
|
6444
|
-
children: get
|
|
6485
|
+
children: get(transition, "metadata.translated_title." + intl.locale, transition.title)
|
|
6445
6486
|
}, transition['@id']);
|
|
6446
6487
|
})]
|
|
6447
6488
|
})]
|
|
@@ -6467,14 +6508,17 @@ function PanelActions() {
|
|
|
6467
6508
|
|
|
6468
6509
|
return jsxRuntime.jsx(React.Fragment, {
|
|
6469
6510
|
children: Object.keys(ACTIONS_OBJECT).map(function (actionKey) {
|
|
6470
|
-
|
|
6511
|
+
var actionKeyTyped = actionKey;
|
|
6512
|
+
var actionObject = ACTIONS_OBJECT[actionKeyTyped];
|
|
6513
|
+
|
|
6514
|
+
if (hasPerm(actionObject.perms)) {
|
|
6471
6515
|
return jsxRuntime.jsx("button", {
|
|
6472
6516
|
className: "button mr-4",
|
|
6473
6517
|
onClick: function onClick() {
|
|
6474
|
-
onAction(
|
|
6518
|
+
onAction(actionKeyTyped);
|
|
6475
6519
|
},
|
|
6476
|
-
children:
|
|
6477
|
-
}, "panel_action_" +
|
|
6520
|
+
children: actionObject.text
|
|
6521
|
+
}, "panel_action_" + actionObject.text);
|
|
6478
6522
|
}
|
|
6479
6523
|
})
|
|
6480
6524
|
});
|
|
@@ -6672,8 +6716,9 @@ var prepareData = function prepareData(result) {
|
|
|
6672
6716
|
|
|
6673
6717
|
var arrayToObject = function arrayToObject(array) {
|
|
6674
6718
|
return array.reduce(function (obj, item) {
|
|
6675
|
-
|
|
6676
|
-
|
|
6719
|
+
var _extends2;
|
|
6720
|
+
|
|
6721
|
+
return _extends({}, obj, (_extends2 = {}, _extends2[item.id] = item, _extends2));
|
|
6677
6722
|
}, {});
|
|
6678
6723
|
};
|
|
6679
6724
|
|
|
@@ -6835,8 +6880,9 @@ function ItemsActionsProvider(_ref) {
|
|
|
6835
6880
|
|
|
6836
6881
|
function onSelectAllItems(checked) {
|
|
6837
6882
|
setSelected(items.reduce(function (obj, item) {
|
|
6838
|
-
|
|
6839
|
-
|
|
6883
|
+
var _extends2;
|
|
6884
|
+
|
|
6885
|
+
return _extends({}, obj, (_extends2 = {}, _extends2[item.path + "/" + item.id] = checked, _extends2));
|
|
6840
6886
|
}, {
|
|
6841
6887
|
all: checked
|
|
6842
6888
|
}));
|
|
@@ -6844,11 +6890,11 @@ function ItemsActionsProvider(_ref) {
|
|
|
6844
6890
|
|
|
6845
6891
|
function onSelectOneItem(item) {
|
|
6846
6892
|
setSelected(function (state) {
|
|
6847
|
-
var
|
|
6893
|
+
var _extends3;
|
|
6848
6894
|
|
|
6849
|
-
return _extends({}, state, (
|
|
6895
|
+
return _extends({}, state, (_extends3 = {
|
|
6850
6896
|
all: false
|
|
6851
|
-
},
|
|
6897
|
+
}, _extends3[item.path + "/" + item.id] = !state[item.path + "/" + item.id], _extends3));
|
|
6852
6898
|
});
|
|
6853
6899
|
}
|
|
6854
6900
|
|
|
@@ -6870,17 +6916,37 @@ function ItemsActionsProvider(_ref) {
|
|
|
6870
6916
|
children: children
|
|
6871
6917
|
});
|
|
6872
6918
|
}
|
|
6919
|
+
|
|
6920
|
+
var useItemsActions = function useItemsActions() {
|
|
6921
|
+
var _useContext = React.useContext(ItemsActionsCtx),
|
|
6922
|
+
onAction = _useContext.onAction,
|
|
6923
|
+
onSelectOneItem = _useContext.onSelectOneItem,
|
|
6924
|
+
onSelectAllItems = _useContext.onSelectAllItems,
|
|
6925
|
+
selected = _useContext.selected;
|
|
6926
|
+
|
|
6927
|
+
if (!onAction || !onSelectOneItem || !onSelectAllItems || !selected) {
|
|
6928
|
+
throw new Error('useItemsActions must be used inside ItemsActionsProvider');
|
|
6929
|
+
}
|
|
6930
|
+
|
|
6931
|
+
return {
|
|
6932
|
+
onAction: onAction,
|
|
6933
|
+
onSelectOneItem: onSelectOneItem,
|
|
6934
|
+
onSelectAllItems: onSelectAllItems,
|
|
6935
|
+
selected: selected
|
|
6936
|
+
};
|
|
6937
|
+
};
|
|
6873
6938
|
/**
|
|
6874
6939
|
* Checkbox component without props that consume the ItemsActionsContext
|
|
6875
6940
|
* and it select/unselect all items of the page.
|
|
6876
6941
|
*/
|
|
6877
6942
|
|
|
6943
|
+
|
|
6878
6944
|
function AllItemsCheckbox(_ref2) {
|
|
6879
6945
|
var dataTest = _ref2.dataTest;
|
|
6880
6946
|
|
|
6881
|
-
var
|
|
6882
|
-
onSelectAllItems =
|
|
6883
|
-
selected =
|
|
6947
|
+
var _useItemsActions = useItemsActions(),
|
|
6948
|
+
onSelectAllItems = _useItemsActions.onSelectAllItems,
|
|
6949
|
+
selected = _useItemsActions.selected;
|
|
6884
6950
|
|
|
6885
6951
|
return jsxRuntime.jsx(Checkbox, {
|
|
6886
6952
|
onChange: onSelectAllItems,
|
|
@@ -6892,9 +6958,9 @@ function ItemCheckbox(_ref3) {
|
|
|
6892
6958
|
var item = _ref3.item,
|
|
6893
6959
|
dataTest = _ref3.dataTest;
|
|
6894
6960
|
|
|
6895
|
-
var
|
|
6896
|
-
selected =
|
|
6897
|
-
onSelectOneItem =
|
|
6961
|
+
var _useItemsActions2 = useItemsActions(),
|
|
6962
|
+
selected = _useItemsActions2.selected,
|
|
6963
|
+
onSelectOneItem = _useItemsActions2.onSelectOneItem;
|
|
6898
6964
|
|
|
6899
6965
|
var absId = item.path + "/" + item.id;
|
|
6900
6966
|
var value = selected[absId];
|
|
@@ -6915,9 +6981,9 @@ function ItemsActionsDropdown() {
|
|
|
6915
6981
|
var ACTIONS_OBJECT = getActionsObject(intl, true);
|
|
6916
6982
|
var traversal = useTraversal();
|
|
6917
6983
|
|
|
6918
|
-
var
|
|
6919
|
-
selected =
|
|
6920
|
-
onAction =
|
|
6984
|
+
var _useItemsActions3 = useItemsActions(),
|
|
6985
|
+
selected = _useItemsActions3.selected,
|
|
6986
|
+
onAction = _useItemsActions3.onAction;
|
|
6921
6987
|
|
|
6922
6988
|
var disabled = Object.values(selected).every(function (v) {
|
|
6923
6989
|
return !v;
|
|
@@ -7028,6 +7094,170 @@ function Pagination(_ref) {
|
|
|
7028
7094
|
});
|
|
7029
7095
|
}
|
|
7030
7096
|
|
|
7097
|
+
var base = {
|
|
7098
|
+
local: {
|
|
7099
|
+
roleperm: {},
|
|
7100
|
+
prinperm: {},
|
|
7101
|
+
prinrole: {}
|
|
7102
|
+
},
|
|
7103
|
+
inherit: []
|
|
7104
|
+
};
|
|
7105
|
+
var Sharing = /*#__PURE__*/function () {
|
|
7106
|
+
function Sharing(element) {
|
|
7107
|
+
this.local = void 0;
|
|
7108
|
+
this.inherit = void 0;
|
|
7109
|
+
|
|
7110
|
+
if (element === undefined) {
|
|
7111
|
+
throw new Error('Sharing element is undefined');
|
|
7112
|
+
}
|
|
7113
|
+
|
|
7114
|
+
this.local = element.local || base.local;
|
|
7115
|
+
this.inherit = element.inherit || base.inherit;
|
|
7116
|
+
}
|
|
7117
|
+
|
|
7118
|
+
var _proto = Sharing.prototype;
|
|
7119
|
+
|
|
7120
|
+
_proto.getRole = function getRole(role) {
|
|
7121
|
+
return this.local.roleperm[role];
|
|
7122
|
+
};
|
|
7123
|
+
|
|
7124
|
+
_proto.getPrincipals = function getPrincipals(principal) {
|
|
7125
|
+
return this.local.prinperm[principal];
|
|
7126
|
+
};
|
|
7127
|
+
|
|
7128
|
+
_proto.getPrinroles = function getPrinroles(role) {
|
|
7129
|
+
return this.local.prinrole[role];
|
|
7130
|
+
};
|
|
7131
|
+
|
|
7132
|
+
_createClass(Sharing, [{
|
|
7133
|
+
key: "roles",
|
|
7134
|
+
get: function get() {
|
|
7135
|
+
return Object.keys(this.local.roleperm);
|
|
7136
|
+
}
|
|
7137
|
+
}, {
|
|
7138
|
+
key: "principals",
|
|
7139
|
+
get: function get() {
|
|
7140
|
+
return Object.keys(this.local.prinperm);
|
|
7141
|
+
}
|
|
7142
|
+
}, {
|
|
7143
|
+
key: "prinrole",
|
|
7144
|
+
get: function get() {
|
|
7145
|
+
return Object.keys(this.local.prinrole);
|
|
7146
|
+
}
|
|
7147
|
+
}]);
|
|
7148
|
+
|
|
7149
|
+
return Sharing;
|
|
7150
|
+
}();
|
|
7151
|
+
|
|
7152
|
+
var ItemModel = /*#__PURE__*/function () {
|
|
7153
|
+
function ItemModel(item, url) {
|
|
7154
|
+
if (url === void 0) {
|
|
7155
|
+
url = '';
|
|
7156
|
+
}
|
|
7157
|
+
|
|
7158
|
+
this.item = void 0;
|
|
7159
|
+
this.url = void 0;
|
|
7160
|
+
this.item = item;
|
|
7161
|
+
this.url = url;
|
|
7162
|
+
}
|
|
7163
|
+
|
|
7164
|
+
_createClass(ItemModel, [{
|
|
7165
|
+
key: "path",
|
|
7166
|
+
get: function get() {
|
|
7167
|
+
// Compat
|
|
7168
|
+
var item = this.item['@id'] ? this.item['@id'] : this.item['@absolute_url'];
|
|
7169
|
+
var path = item.split('//')[1].split('/').splice(1).join('/');
|
|
7170
|
+
path = "/" + path + "/";
|
|
7171
|
+
|
|
7172
|
+
if (this.url.length > 0) {
|
|
7173
|
+
if (this.url.startsWith('/')) {
|
|
7174
|
+
path = path.replace(this.url.substring(1), '');
|
|
7175
|
+
} else {
|
|
7176
|
+
path = path.replace(this.url, '');
|
|
7177
|
+
}
|
|
7178
|
+
}
|
|
7179
|
+
|
|
7180
|
+
return path;
|
|
7181
|
+
}
|
|
7182
|
+
}, {
|
|
7183
|
+
key: "name",
|
|
7184
|
+
get: function get() {
|
|
7185
|
+
return this.item.title || this.item['@name'];
|
|
7186
|
+
}
|
|
7187
|
+
}, {
|
|
7188
|
+
key: "icon",
|
|
7189
|
+
get: function get() {
|
|
7190
|
+
var cfg = useConfig();
|
|
7191
|
+
|
|
7192
|
+
if (cfg.icons && cfg.icons[this.type]) {
|
|
7193
|
+
return cfg.icons[this.type];
|
|
7194
|
+
}
|
|
7195
|
+
|
|
7196
|
+
switch (this.type) {
|
|
7197
|
+
case 'GroupManager':
|
|
7198
|
+
return 'fas fa-users-cog';
|
|
7199
|
+
|
|
7200
|
+
case 'UserManager':
|
|
7201
|
+
return 'fas fa-user-cog';
|
|
7202
|
+
|
|
7203
|
+
case 'User':
|
|
7204
|
+
return 'fas fa-user';
|
|
7205
|
+
|
|
7206
|
+
case 'Group':
|
|
7207
|
+
return 'fas fa-users';
|
|
7208
|
+
|
|
7209
|
+
case 'Folder':
|
|
7210
|
+
return 'fas fa-folder';
|
|
7211
|
+
|
|
7212
|
+
default:
|
|
7213
|
+
return 'fas fa-file';
|
|
7214
|
+
}
|
|
7215
|
+
}
|
|
7216
|
+
}, {
|
|
7217
|
+
key: "fullPath",
|
|
7218
|
+
get: function get() {
|
|
7219
|
+
return this.url + this.id;
|
|
7220
|
+
}
|
|
7221
|
+
}, {
|
|
7222
|
+
key: "id",
|
|
7223
|
+
get: function get() {
|
|
7224
|
+
if ('id' in this.item) {
|
|
7225
|
+
return this.item.id;
|
|
7226
|
+
}
|
|
7227
|
+
|
|
7228
|
+
var id = this.item['@id'].split('&')[0].split('/');
|
|
7229
|
+
return id[id.length - 1];
|
|
7230
|
+
}
|
|
7231
|
+
}, {
|
|
7232
|
+
key: "uid",
|
|
7233
|
+
get: function get() {
|
|
7234
|
+
return this.item['@uid'];
|
|
7235
|
+
}
|
|
7236
|
+
}, {
|
|
7237
|
+
key: "type",
|
|
7238
|
+
get: function get() {
|
|
7239
|
+
return this.item['@type'] || this.item.type_name;
|
|
7240
|
+
}
|
|
7241
|
+
}, {
|
|
7242
|
+
key: "title",
|
|
7243
|
+
get: function get() {
|
|
7244
|
+
return this.item.title;
|
|
7245
|
+
}
|
|
7246
|
+
}, {
|
|
7247
|
+
key: "created",
|
|
7248
|
+
get: function get() {
|
|
7249
|
+
return this.item.creation_date ? formatDate(this.item.creation_date) : '';
|
|
7250
|
+
}
|
|
7251
|
+
}, {
|
|
7252
|
+
key: "updated",
|
|
7253
|
+
get: function get() {
|
|
7254
|
+
return this.item.modification_date ? formatDate(this.item.modification_date) : '';
|
|
7255
|
+
}
|
|
7256
|
+
}]);
|
|
7257
|
+
|
|
7258
|
+
return ItemModel;
|
|
7259
|
+
}();
|
|
7260
|
+
|
|
7031
7261
|
function Item(_ref) {
|
|
7032
7262
|
var item = _ref.item,
|
|
7033
7263
|
icon = _ref.icon;
|
|
@@ -7168,11 +7398,11 @@ function SearchOptionsLabels(_ref) {
|
|
|
7168
7398
|
renderValue = _useState[0],
|
|
7169
7399
|
setRenderValue = _useState[1];
|
|
7170
7400
|
|
|
7171
|
-
var defaultRenderValue = location.get(query);
|
|
7401
|
+
var defaultRenderValue = location.get(query) || '';
|
|
7172
7402
|
React.useEffect(function () {
|
|
7173
7403
|
var value = defaultRenderValue;
|
|
7174
7404
|
|
|
7175
|
-
if ((options != null ? options : []).length > 0) {
|
|
7405
|
+
if (options && (options != null ? options : []).length > 0) {
|
|
7176
7406
|
var option = options.find(function (item) {
|
|
7177
7407
|
return item.value === value;
|
|
7178
7408
|
});
|
|
@@ -7221,14 +7451,16 @@ function SearchVocabularyLabels(_ref) {
|
|
|
7221
7451
|
setRenderValue = _useState[1];
|
|
7222
7452
|
|
|
7223
7453
|
var vocabulary = useVocabulary(vocabularyName);
|
|
7224
|
-
var defaultRenderValue = location.get(query);
|
|
7454
|
+
var defaultRenderValue = location.get(query) || '';
|
|
7225
7455
|
React.useEffect(function () {
|
|
7226
7456
|
var _vocabulary$data$item, _vocabulary$data;
|
|
7227
7457
|
|
|
7228
7458
|
var value = defaultRenderValue;
|
|
7229
7459
|
|
|
7230
7460
|
if (((_vocabulary$data$item = vocabulary == null ? void 0 : (_vocabulary$data = vocabulary.data) == null ? void 0 : _vocabulary$data.items) != null ? _vocabulary$data$item : []).length > 0) {
|
|
7231
|
-
var
|
|
7461
|
+
var _vocabulary$data2;
|
|
7462
|
+
|
|
7463
|
+
var vocabularyValue = vocabulary == null ? void 0 : (_vocabulary$data2 = vocabulary.data) == null ? void 0 : _vocabulary$data2.items.find(function (item) {
|
|
7232
7464
|
return item.token === value;
|
|
7233
7465
|
});
|
|
7234
7466
|
|
|
@@ -7262,7 +7494,7 @@ function SearchVocabularyLabels(_ref) {
|
|
|
7262
7494
|
return null;
|
|
7263
7495
|
}
|
|
7264
7496
|
|
|
7265
|
-
var initialState$
|
|
7497
|
+
var initialState$3 = {
|
|
7266
7498
|
page: 0,
|
|
7267
7499
|
items: [],
|
|
7268
7500
|
loading: true,
|
|
@@ -7281,7 +7513,7 @@ function PanelItems() {
|
|
|
7281
7513
|
var intl = reactIntl.useIntl();
|
|
7282
7514
|
var Ctx = useTraversal();
|
|
7283
7515
|
|
|
7284
|
-
var _useSetState = useSetState(initialState$
|
|
7516
|
+
var _useSetState = useSetState(initialState$3),
|
|
7285
7517
|
state = _useSetState[0],
|
|
7286
7518
|
setState = _useSetState[1];
|
|
7287
7519
|
|
|
@@ -7297,7 +7529,7 @@ function PanelItems() {
|
|
|
7297
7529
|
var page;
|
|
7298
7530
|
|
|
7299
7531
|
try {
|
|
7300
|
-
page = parseInt(location.get('page')
|
|
7532
|
+
page = parseInt(location.get('page') || '0');
|
|
7301
7533
|
} catch (_unused) {
|
|
7302
7534
|
page = 0;
|
|
7303
7535
|
}
|
|
@@ -7344,7 +7576,7 @@ function PanelItems() {
|
|
|
7344
7576
|
var resultQueryParams = [];
|
|
7345
7577
|
var resultDynamicLocation = [];
|
|
7346
7578
|
filterSchema.forEach(function (filter) {
|
|
7347
|
-
var itemParam = location.get(filter.attribute_key);
|
|
7579
|
+
var itemParam = location.get(filter.attribute_key) || '';
|
|
7348
7580
|
resultDynamicLocation.push(itemParam);
|
|
7349
7581
|
|
|
7350
7582
|
if (itemParam) {
|
|
@@ -7356,53 +7588,51 @@ function PanelItems() {
|
|
|
7356
7588
|
var controller = new AbortController();
|
|
7357
7589
|
if (Ctx.state.loading) return;
|
|
7358
7590
|
|
|
7359
|
-
|
|
7360
|
-
|
|
7361
|
-
|
|
7362
|
-
|
|
7363
|
-
|
|
7364
|
-
var get = Ctx.registry.get;
|
|
7365
|
-
var fnName = get('searchEngineQueryParamsFunction', SearchEngine);
|
|
7366
|
-
|
|
7367
|
-
if (sortParsed === undefined) {
|
|
7368
|
-
var defaultSortValue = Ctx.registry.getDefaultSortValue(Ctx.context['@type'], {
|
|
7369
|
-
key: 'id',
|
|
7370
|
-
direction: 'des'
|
|
7591
|
+
var getData = function getData() {
|
|
7592
|
+
try {
|
|
7593
|
+
setState({
|
|
7594
|
+
loading: true,
|
|
7595
|
+
total: Ctx.context.length
|
|
7371
7596
|
});
|
|
7372
|
-
|
|
7373
|
-
|
|
7597
|
+
var get = Ctx.registry.get;
|
|
7598
|
+
var fnName = get('searchEngineQueryParamsFunction', SearchEngine);
|
|
7374
7599
|
|
|
7375
|
-
|
|
7376
|
-
|
|
7377
|
-
|
|
7378
|
-
|
|
7379
|
-
});
|
|
7380
|
-
var qs = '';
|
|
7600
|
+
if (sortParsed === undefined) {
|
|
7601
|
+
var defaultSortValue = Ctx.registry.getDefaultSortValue(Ctx.context['@type']);
|
|
7602
|
+
sortParsed = parser("_sort_" + defaultSortValue.direction + "=" + defaultSortValue.key);
|
|
7603
|
+
}
|
|
7381
7604
|
|
|
7382
|
-
|
|
7383
|
-
|
|
7605
|
+
var qsParsed = Ctx.client.getQueryParamsSearchFunction(fnName)({
|
|
7606
|
+
path: Ctx.path,
|
|
7607
|
+
start: page * PageSize,
|
|
7608
|
+
pageSize: PageSize
|
|
7609
|
+
});
|
|
7610
|
+
var qs = '';
|
|
7384
7611
|
|
|
7385
|
-
|
|
7386
|
-
|
|
7387
|
-
var _sortParsed2;
|
|
7612
|
+
if (search || type || resultQueryParams.length > 0) {
|
|
7613
|
+
var _searchParsed, _typeParsed, _sortParsed;
|
|
7388
7614
|
|
|
7389
|
-
|
|
7390
|
-
|
|
7615
|
+
qs = buildQs([].concat(qsParsed, (_searchParsed = searchParsed) != null ? _searchParsed : [], (_typeParsed = typeParsed) != null ? _typeParsed : [], (_sortParsed = sortParsed) != null ? _sortParsed : [], resultQueryParams));
|
|
7616
|
+
} else {
|
|
7617
|
+
var _sortParsed2;
|
|
7391
7618
|
|
|
7392
|
-
|
|
7393
|
-
|
|
7394
|
-
|
|
7395
|
-
|
|
7396
|
-
|
|
7397
|
-
|
|
7398
|
-
|
|
7399
|
-
|
|
7619
|
+
qs = buildQs([].concat(qsParsed, (_sortParsed2 = sortParsed) != null ? _sortParsed2 : []));
|
|
7620
|
+
}
|
|
7621
|
+
|
|
7622
|
+
var signal = controller.signal;
|
|
7623
|
+
return Promise.resolve(Ctx.client.search(Ctx.path, qs, false, false, signal)).then(function (data) {
|
|
7624
|
+
setState({
|
|
7625
|
+
items: data.items,
|
|
7626
|
+
loading: false,
|
|
7627
|
+
total: data.items_count
|
|
7628
|
+
});
|
|
7400
7629
|
});
|
|
7401
|
-
})
|
|
7402
|
-
|
|
7403
|
-
|
|
7404
|
-
}
|
|
7630
|
+
} catch (e) {
|
|
7631
|
+
return Promise.reject(e);
|
|
7632
|
+
}
|
|
7633
|
+
};
|
|
7405
7634
|
|
|
7635
|
+
getData();
|
|
7406
7636
|
return function () {
|
|
7407
7637
|
controller.abort();
|
|
7408
7638
|
};
|
|
@@ -7447,12 +7677,14 @@ function PanelItems() {
|
|
|
7447
7677
|
var _filter$values;
|
|
7448
7678
|
|
|
7449
7679
|
if (filter.type === 'select' && ((_filter$values = filter.values) != null ? _filter$values : []).length > 0) {
|
|
7680
|
+
var _filter$values2;
|
|
7681
|
+
|
|
7450
7682
|
return jsxRuntime.jsx(Select, {
|
|
7451
7683
|
id: filter.attribute_key,
|
|
7452
7684
|
placeholder: filter.label,
|
|
7453
7685
|
appendDefault: true,
|
|
7454
7686
|
classWrap: "is-size-7 is-fullwidth",
|
|
7455
|
-
options: filter.values,
|
|
7687
|
+
options: (_filter$values2 = filter.values) != null ? _filter$values2 : [],
|
|
7456
7688
|
value: location.get(filter.attribute_key) || '',
|
|
7457
7689
|
dataTest: "filterInput" + filter.attribute_key,
|
|
7458
7690
|
onChange: function onChange(value) {
|
|
@@ -7519,7 +7751,7 @@ function PanelItems() {
|
|
|
7519
7751
|
var filterData = location.get(filter.attribute_key);
|
|
7520
7752
|
|
|
7521
7753
|
if (filterData) {
|
|
7522
|
-
var _filter$
|
|
7754
|
+
var _filter$values3;
|
|
7523
7755
|
|
|
7524
7756
|
if (filter.type === 'select' && filter.vocabulary) {
|
|
7525
7757
|
return jsxRuntime.jsx("div", {
|
|
@@ -7528,7 +7760,7 @@ function PanelItems() {
|
|
|
7528
7760
|
vocabularyName: filter == null ? void 0 : filter.vocabulary
|
|
7529
7761
|
})
|
|
7530
7762
|
}, filter.attribute_key);
|
|
7531
|
-
} else if (filter.type === 'select' && ((_filter$
|
|
7763
|
+
} else if (filter.type === 'select' && ((_filter$values3 = filter.values) != null ? _filter$values3 : []).length > 0) {
|
|
7532
7764
|
return jsxRuntime.jsx("div", {
|
|
7533
7765
|
children: jsxRuntime.jsx(SearchOptionsLabels, {
|
|
7534
7766
|
query: filter.attribute_key,
|
|
@@ -7574,7 +7806,7 @@ function PanelItems() {
|
|
|
7574
7806
|
className: "has-text-info is-flex is-align-items-center",
|
|
7575
7807
|
children: [jsxRuntime.jsx("span", {
|
|
7576
7808
|
children: column.label
|
|
7577
|
-
}), getIcon(column.key, column.isSortable)]
|
|
7809
|
+
}), getIcon(column.key, !!column.isSortable)]
|
|
7578
7810
|
})
|
|
7579
7811
|
}, "table-col-" + column.label);
|
|
7580
7812
|
}), jsxRuntime.jsx("th", {
|
|
@@ -7585,7 +7817,7 @@ function PanelItems() {
|
|
|
7585
7817
|
children: [items && items.map(function (item) {
|
|
7586
7818
|
return jsxRuntime.jsx(RItem, {
|
|
7587
7819
|
item: item,
|
|
7588
|
-
search: search,
|
|
7820
|
+
search: search != null ? search : '',
|
|
7589
7821
|
columns: columns
|
|
7590
7822
|
}, item['@uid']);
|
|
7591
7823
|
}), items && items.length === 0 && jsxRuntime.jsx("tr", {
|
|
@@ -7609,17 +7841,19 @@ function PanelItems() {
|
|
|
7609
7841
|
}
|
|
7610
7842
|
|
|
7611
7843
|
function BehaviorsView(_ref) {
|
|
7844
|
+
var _context$__behaviors_;
|
|
7845
|
+
|
|
7612
7846
|
var context = _ref.context,
|
|
7613
7847
|
schema = _ref.schema;
|
|
7614
7848
|
var Ctx = useTraversal();
|
|
7615
7849
|
var getBehavior = Ctx.registry.getBehavior;
|
|
7616
|
-
var behaviors = [].concat(context.__behaviors__, context['@static_behaviors']);
|
|
7850
|
+
var behaviors = [].concat((_context$__behaviors_ = context.__behaviors__) != null ? _context$__behaviors_ : [], Object(context['@static_behaviors']));
|
|
7617
7851
|
|
|
7618
|
-
var GetBehavior = function GetBehavior(
|
|
7619
|
-
var Cls = getBehavior(
|
|
7852
|
+
var GetBehavior = function GetBehavior(behaviorName) {
|
|
7853
|
+
var Cls = getBehavior(behaviorName, BehaviorNotImplemented);
|
|
7620
7854
|
return jsxRuntime.jsx(Cls, {
|
|
7621
|
-
values: context[
|
|
7622
|
-
properties: get
|
|
7855
|
+
values: context[behaviorName],
|
|
7856
|
+
properties: get(schema, ['definitions', behaviorName, 'properties'], {})
|
|
7623
7857
|
});
|
|
7624
7858
|
};
|
|
7625
7859
|
|
|
@@ -7715,9 +7949,11 @@ function PanelProperties() {
|
|
|
7715
7949
|
var properties = Object.keys((schema == null ? void 0 : (_schema$data = schema.data) == null ? void 0 : _schema$data.properties) || []).filter(function (key) {
|
|
7716
7950
|
return !ignoreFields.includes(key);
|
|
7717
7951
|
}).map(function (key) {
|
|
7952
|
+
var _schema$data2;
|
|
7953
|
+
|
|
7718
7954
|
return {
|
|
7719
7955
|
key: key,
|
|
7720
|
-
value: schema.data.properties[key]
|
|
7956
|
+
value: schema == null ? void 0 : (_schema$data2 = schema.data) == null ? void 0 : _schema$data2.properties[key]
|
|
7721
7957
|
};
|
|
7722
7958
|
});
|
|
7723
7959
|
React.useEffect(function () {
|
|
@@ -7729,7 +7965,7 @@ function PanelProperties() {
|
|
|
7729
7965
|
setSchema({
|
|
7730
7966
|
loading: true
|
|
7731
7967
|
});
|
|
7732
|
-
return Promise.resolve(Ctx.client.getTypeSchema(Ctx.path,
|
|
7968
|
+
return Promise.resolve(Ctx.client.getTypeSchema(Ctx.path, Ctx.context.type_name)).then(function (dataJson) {
|
|
7733
7969
|
setSchema({
|
|
7734
7970
|
loading: false,
|
|
7735
7971
|
data: dataJson
|
|
@@ -7804,7 +8040,7 @@ function PanelProperties() {
|
|
|
7804
8040
|
}), jsxRuntime.jsx("td", {
|
|
7805
8041
|
children: jsxRuntime.jsx(EditableField, {
|
|
7806
8042
|
field: prop,
|
|
7807
|
-
value: Ctx.context
|
|
8043
|
+
value: get(Ctx.context, prop, ''),
|
|
7808
8044
|
modifyContent: false
|
|
7809
8045
|
})
|
|
7810
8046
|
})]
|
|
@@ -7828,7 +8064,7 @@ function PanelProperties() {
|
|
|
7828
8064
|
})
|
|
7829
8065
|
}), jsxRuntime.jsx("tbody", {
|
|
7830
8066
|
children: properties.map(function (_ref) {
|
|
7831
|
-
var _schema$data$required, _schema$
|
|
8067
|
+
var _schema$data$required, _schema$data3;
|
|
7832
8068
|
|
|
7833
8069
|
var key = _ref.key,
|
|
7834
8070
|
value = _ref.value;
|
|
@@ -7841,10 +8077,10 @@ function PanelProperties() {
|
|
|
7841
8077
|
}), jsxRuntime.jsx("td", {
|
|
7842
8078
|
children: jsxRuntime.jsx(EditableField, {
|
|
7843
8079
|
field: key,
|
|
7844
|
-
value: Ctx.context
|
|
8080
|
+
value: get(Ctx.context, key, ''),
|
|
7845
8081
|
schema: value,
|
|
7846
8082
|
modifyContent: modifyContent,
|
|
7847
|
-
required: ((_schema$data$required = (_schema$
|
|
8083
|
+
required: ((_schema$data$required = (_schema$data3 = schema.data) == null ? void 0 : _schema$data3.required) != null ? _schema$data$required : []).includes(key)
|
|
7848
8084
|
})
|
|
7849
8085
|
})]
|
|
7850
8086
|
}, 'prop' + key);
|
|
@@ -7880,14 +8116,6 @@ function PermissionPrinperm(_ref) {
|
|
|
7880
8116
|
state = _useSetState[0],
|
|
7881
8117
|
setState = _useSetState[1];
|
|
7882
8118
|
|
|
7883
|
-
var getMultiples = function getMultiples(field, setter) {
|
|
7884
|
-
return function (values) {
|
|
7885
|
-
var _setter;
|
|
7886
|
-
|
|
7887
|
-
setter((_setter = {}, _setter[field] = values, _setter));
|
|
7888
|
-
};
|
|
7889
|
-
};
|
|
7890
|
-
|
|
7891
8119
|
var savePermission = function savePermission() {
|
|
7892
8120
|
try {
|
|
7893
8121
|
if (!state.principal || !state.setting || state.permission.length === 0) {
|
|
@@ -7937,7 +8165,7 @@ function PermissionPrinperm(_ref) {
|
|
|
7937
8165
|
children: intl.formatMessage(genericMessages.select_principal)
|
|
7938
8166
|
}), jsxRuntime.jsx(Select, {
|
|
7939
8167
|
appendDefault: true,
|
|
7940
|
-
options: principals,
|
|
8168
|
+
options: principals != null ? principals : [],
|
|
7941
8169
|
onChange: function onChange(value) {
|
|
7942
8170
|
return setState({
|
|
7943
8171
|
principal: value
|
|
@@ -7951,8 +8179,12 @@ function PermissionPrinperm(_ref) {
|
|
|
7951
8179
|
className: "label",
|
|
7952
8180
|
children: intl.formatMessage(genericMessages.select_permissions)
|
|
7953
8181
|
}), jsxRuntime.jsx(Select, {
|
|
7954
|
-
options: permissions,
|
|
7955
|
-
onChange:
|
|
8182
|
+
options: permissions != null ? permissions : [],
|
|
8183
|
+
onChange: function onChange(values) {
|
|
8184
|
+
setState({
|
|
8185
|
+
permission: values
|
|
8186
|
+
});
|
|
8187
|
+
},
|
|
7956
8188
|
size: 5,
|
|
7957
8189
|
multiple: true,
|
|
7958
8190
|
dataTest: "selectPermissionsTest"
|
|
@@ -8003,14 +8235,6 @@ function PermissionPrinrole(_ref) {
|
|
|
8003
8235
|
state = _useSetState[0],
|
|
8004
8236
|
setState = _useSetState[1];
|
|
8005
8237
|
|
|
8006
|
-
var getMultiples = function getMultiples(field, setter) {
|
|
8007
|
-
return function (values) {
|
|
8008
|
-
var _setter;
|
|
8009
|
-
|
|
8010
|
-
setter((_setter = {}, _setter[field] = values, _setter));
|
|
8011
|
-
};
|
|
8012
|
-
};
|
|
8013
|
-
|
|
8014
8238
|
var savePermission = function savePermission() {
|
|
8015
8239
|
try {
|
|
8016
8240
|
if (!state.principal || !state.setting || state.roles.length === 0) {
|
|
@@ -8060,7 +8284,7 @@ function PermissionPrinrole(_ref) {
|
|
|
8060
8284
|
children: intl.formatMessage(genericMessages.select_principal)
|
|
8061
8285
|
}), jsxRuntime.jsx(Select, {
|
|
8062
8286
|
appendDefault: true,
|
|
8063
|
-
options: principals,
|
|
8287
|
+
options: principals != null ? principals : [],
|
|
8064
8288
|
onChange: function onChange(value) {
|
|
8065
8289
|
return setState({
|
|
8066
8290
|
principal: value
|
|
@@ -8075,7 +8299,11 @@ function PermissionPrinrole(_ref) {
|
|
|
8075
8299
|
children: intl.formatMessage(genericMessages.select_role)
|
|
8076
8300
|
}), jsxRuntime.jsx(Select, {
|
|
8077
8301
|
options: roles,
|
|
8078
|
-
onChange:
|
|
8302
|
+
onChange: function onChange(values) {
|
|
8303
|
+
setState({
|
|
8304
|
+
roles: values
|
|
8305
|
+
});
|
|
8306
|
+
},
|
|
8079
8307
|
size: 5,
|
|
8080
8308
|
multiple: true,
|
|
8081
8309
|
dataTest: "selectRoleTest"
|
|
@@ -8126,14 +8354,6 @@ function PermissionRoleperm(_ref) {
|
|
|
8126
8354
|
state = _useSetState[0],
|
|
8127
8355
|
setState = _useSetState[1];
|
|
8128
8356
|
|
|
8129
|
-
var getMultiples = function getMultiples(field, setter) {
|
|
8130
|
-
return function (values) {
|
|
8131
|
-
var _setter;
|
|
8132
|
-
|
|
8133
|
-
setter((_setter = {}, _setter[field] = values, _setter));
|
|
8134
|
-
};
|
|
8135
|
-
};
|
|
8136
|
-
|
|
8137
8357
|
var savePermission = function savePermission() {
|
|
8138
8358
|
try {
|
|
8139
8359
|
if (!state.role || !state.setting || state.permission.length === 0) {
|
|
@@ -8197,8 +8417,12 @@ function PermissionRoleperm(_ref) {
|
|
|
8197
8417
|
className: "label",
|
|
8198
8418
|
children: intl.formatMessage(genericMessages.select_permissions)
|
|
8199
8419
|
}), jsxRuntime.jsx(Select, {
|
|
8200
|
-
options: permissions,
|
|
8201
|
-
onChange:
|
|
8420
|
+
options: permissions != null ? permissions : [],
|
|
8421
|
+
onChange: function onChange(values) {
|
|
8422
|
+
setState({
|
|
8423
|
+
permission: values
|
|
8424
|
+
});
|
|
8425
|
+
},
|
|
8202
8426
|
dataTest: "selectPermissionsTest",
|
|
8203
8427
|
size: 5,
|
|
8204
8428
|
multiple: true
|
|
@@ -8331,7 +8555,18 @@ function PanelPermissions() {
|
|
|
8331
8555
|
React.useEffect(function () {
|
|
8332
8556
|
get('@sharing');
|
|
8333
8557
|
}, [reset]);
|
|
8334
|
-
var perms =
|
|
8558
|
+
var perms = React.useMemo(function () {
|
|
8559
|
+
if (result) {
|
|
8560
|
+
return new Sharing(result);
|
|
8561
|
+
}
|
|
8562
|
+
|
|
8563
|
+
return null;
|
|
8564
|
+
}, [result]);
|
|
8565
|
+
|
|
8566
|
+
if (perms === null) {
|
|
8567
|
+
return null;
|
|
8568
|
+
}
|
|
8569
|
+
|
|
8335
8570
|
return jsxRuntime.jsxs("div", {
|
|
8336
8571
|
className: "columns",
|
|
8337
8572
|
children: [!loading && jsxRuntime.jsxs("div", {
|
|
@@ -8489,14 +8724,14 @@ function AddPermission(_ref) {
|
|
|
8489
8724
|
return Promise.resolve(Ctx.client.getPrincipals(Ctx.path)).then(function (principalsData) {
|
|
8490
8725
|
var groups = principalsData.groups.map(function (group) {
|
|
8491
8726
|
return {
|
|
8492
|
-
text: group
|
|
8493
|
-
value: group
|
|
8727
|
+
text: group['@name'],
|
|
8728
|
+
value: group['@name']
|
|
8494
8729
|
};
|
|
8495
8730
|
});
|
|
8496
8731
|
var users = principalsData.users.map(function (user) {
|
|
8497
8732
|
return {
|
|
8498
|
-
text: user.fullname || user
|
|
8499
|
-
value: user
|
|
8733
|
+
text: user.fullname || user['@name'],
|
|
8734
|
+
value: user['@name']
|
|
8500
8735
|
};
|
|
8501
8736
|
});
|
|
8502
8737
|
principals = [].concat(groups, users);
|
|
@@ -8567,18 +8802,6 @@ var prepareAvailable = function prepareAvailable(items, already, title) {
|
|
|
8567
8802
|
text: "Add " + title
|
|
8568
8803
|
};
|
|
8569
8804
|
if (items.length === 0) return [];
|
|
8570
|
-
|
|
8571
|
-
if (items[0] && typeof items[0] === 'string') {
|
|
8572
|
-
return [def].concat(items.map(function (x) {
|
|
8573
|
-
return {
|
|
8574
|
-
value: x,
|
|
8575
|
-
text: x
|
|
8576
|
-
};
|
|
8577
|
-
})).filter(function (item) {
|
|
8578
|
-
return !already.includes(item.value);
|
|
8579
|
-
});
|
|
8580
|
-
}
|
|
8581
|
-
|
|
8582
8805
|
return [def].concat(items).filter(function (item) {
|
|
8583
8806
|
return !already.includes(item.value);
|
|
8584
8807
|
});
|
|
@@ -8591,7 +8814,7 @@ function TagsWidget(_ref) {
|
|
|
8591
8814
|
noData = _ref.noData,
|
|
8592
8815
|
onChange = _ref.onChange,
|
|
8593
8816
|
loading = _ref.loading;
|
|
8594
|
-
var selectRef = React.useRef();
|
|
8817
|
+
var selectRef = React.useRef(null);
|
|
8595
8818
|
|
|
8596
8819
|
var _useState = React.useState(items),
|
|
8597
8820
|
result = _useState[0],
|
|
@@ -8639,7 +8862,7 @@ function TagsWidget(_ref) {
|
|
|
8639
8862
|
marginBottom: '20px'
|
|
8640
8863
|
},
|
|
8641
8864
|
children: noData
|
|
8642
|
-
}), available.length > 1 && jsxRuntime.jsx("li", {
|
|
8865
|
+
}), (available != null ? available : []).length > 1 && jsxRuntime.jsx("li", {
|
|
8643
8866
|
className: "widget-list-add select is-small",
|
|
8644
8867
|
children: jsxRuntime.jsx(Select, {
|
|
8645
8868
|
options: availableData,
|
|
@@ -8657,13 +8880,13 @@ function TagsWidget(_ref) {
|
|
|
8657
8880
|
});
|
|
8658
8881
|
}
|
|
8659
8882
|
|
|
8660
|
-
var initialState$
|
|
8661
|
-
types:
|
|
8883
|
+
var initialState$4 = {
|
|
8884
|
+
types: []
|
|
8662
8885
|
};
|
|
8663
8886
|
function CreateButton() {
|
|
8664
8887
|
var intl = reactIntl.useIntl();
|
|
8665
8888
|
|
|
8666
|
-
var _useSetState = useSetState(initialState$
|
|
8889
|
+
var _useSetState = useSetState(initialState$4),
|
|
8667
8890
|
state = _useSetState[0],
|
|
8668
8891
|
setState = _useSetState[1];
|
|
8669
8892
|
|
|
@@ -8751,7 +8974,7 @@ function ContextToolbar(_ref) {
|
|
|
8751
8974
|
var AddButton = _ref.AddButton;
|
|
8752
8975
|
var intl = reactIntl.useIntl();
|
|
8753
8976
|
|
|
8754
|
-
var _useSetState2 = useSetState(initialState$
|
|
8977
|
+
var _useSetState2 = useSetState(initialState$4),
|
|
8755
8978
|
state = _useSetState2[0],
|
|
8756
8979
|
setState = _useSetState2[1];
|
|
8757
8980
|
|
|
@@ -8762,7 +8985,7 @@ function ContextToolbar(_ref) {
|
|
|
8762
8985
|
|
|
8763
8986
|
var traversal = useTraversal();
|
|
8764
8987
|
var Config = useConfig();
|
|
8765
|
-
var searchText = location.get('q');
|
|
8988
|
+
var searchText = location.get('q') || '';
|
|
8766
8989
|
|
|
8767
8990
|
var _useState = React.useState(searchText || ''),
|
|
8768
8991
|
searchValue = _useState[0],
|
|
@@ -8775,14 +8998,13 @@ function ContextToolbar(_ref) {
|
|
|
8775
8998
|
setSearchValue(searchText);
|
|
8776
8999
|
}, [searchText]);
|
|
8777
9000
|
|
|
8778
|
-
var onSearchQuery = function onSearchQuery(
|
|
8779
|
-
|
|
9001
|
+
var onSearchQuery = function onSearchQuery(event) {
|
|
9002
|
+
event.preventDefault();
|
|
8780
9003
|
setLocation({
|
|
8781
|
-
q:
|
|
9004
|
+
q: event.currentTarget.elements.filterInput.value,
|
|
8782
9005
|
tab: 'Items',
|
|
8783
9006
|
page: 0
|
|
8784
9007
|
});
|
|
8785
|
-
ev.preventDefault();
|
|
8786
9008
|
};
|
|
8787
9009
|
|
|
8788
9010
|
var onSearchByType = function onSearchByType(typeText) {
|
|
@@ -8816,7 +9038,8 @@ function ContextToolbar(_ref) {
|
|
|
8816
9038
|
type: "text",
|
|
8817
9039
|
className: "input is-size-7",
|
|
8818
9040
|
placeholder: intl.formatMessage(genericMessages.search),
|
|
8819
|
-
"data-test": "inputFilterTest"
|
|
9041
|
+
"data-test": "inputFilterTest",
|
|
9042
|
+
id: "filterInput"
|
|
8820
9043
|
})
|
|
8821
9044
|
}), jsxRuntime.jsx("div", {
|
|
8822
9045
|
className: "control",
|
|
@@ -8843,7 +9066,9 @@ function ContextToolbar(_ref) {
|
|
|
8843
9066
|
value: item
|
|
8844
9067
|
};
|
|
8845
9068
|
}),
|
|
8846
|
-
onChange:
|
|
9069
|
+
onChange: function onChange(value) {
|
|
9070
|
+
return onSearchByType(value);
|
|
9071
|
+
}
|
|
8847
9072
|
})
|
|
8848
9073
|
}), traversal.hasPerm('guillotina.AddContent') && jsxRuntime.jsx("div", {
|
|
8849
9074
|
className: "level-item",
|
|
@@ -8884,17 +9109,12 @@ function TabsPanel(_ref2) {
|
|
|
8884
9109
|
location = _useLocation[0],
|
|
8885
9110
|
setLocation = _useLocation[1];
|
|
8886
9111
|
|
|
8887
|
-
|
|
8888
|
-
currentTab = location.get('tab');
|
|
8889
|
-
} else {
|
|
8890
|
-
currentTab = currentTab || Object.keys(tabs)[0];
|
|
8891
|
-
}
|
|
9112
|
+
currentTab = location.get('tab') || Object.keys(tabs)[0];
|
|
8892
9113
|
/*if (!Object.keys(tabs).includes(currentTab)) {
|
|
8893
9114
|
setLocation(defaultTab)
|
|
8894
9115
|
currentTab = defaultTab
|
|
8895
9116
|
}*/
|
|
8896
9117
|
|
|
8897
|
-
|
|
8898
9118
|
var _useState = React.useState(currentTab),
|
|
8899
9119
|
current = _useState[0],
|
|
8900
9120
|
setTab = _useState[1];
|
|
@@ -8961,14 +9181,14 @@ var tabsPermissions = {
|
|
|
8961
9181
|
Behaviors: 'guillotina.ModifyContent',
|
|
8962
9182
|
Permissions: 'guillotina.SeePermissions'
|
|
8963
9183
|
};
|
|
8964
|
-
function FolderCtx(
|
|
9184
|
+
function FolderCtx() {
|
|
8965
9185
|
var ctx = useTraversal();
|
|
8966
9186
|
var calculated = ctx.filterTabs(tabs, tabsPermissions);
|
|
8967
|
-
return jsxRuntime.jsx(TabsPanel,
|
|
9187
|
+
return jsxRuntime.jsx(TabsPanel, {
|
|
8968
9188
|
tabs: calculated,
|
|
8969
9189
|
currentTab: "Items",
|
|
8970
|
-
rightToolbar: jsxRuntime.jsx(ContextToolbar,
|
|
8971
|
-
}
|
|
9190
|
+
rightToolbar: jsxRuntime.jsx(ContextToolbar, {})
|
|
9191
|
+
});
|
|
8972
9192
|
}
|
|
8973
9193
|
|
|
8974
9194
|
var tabs$1 = {
|
|
@@ -8982,13 +9202,13 @@ var tabsPermissions$1 = {
|
|
|
8982
9202
|
Behaviors: 'guillotina.ModifyContent',
|
|
8983
9203
|
Permissions: 'guillotina.SeePermissions'
|
|
8984
9204
|
};
|
|
8985
|
-
function ItemCtx(
|
|
9205
|
+
function ItemCtx() {
|
|
8986
9206
|
var ctx = useTraversal();
|
|
8987
9207
|
var calculated = ctx.filterTabs(tabs$1, tabsPermissions$1);
|
|
8988
|
-
return jsxRuntime.jsx(TabsPanel,
|
|
9208
|
+
return jsxRuntime.jsx(TabsPanel, {
|
|
8989
9209
|
tabs: calculated,
|
|
8990
9210
|
currentTab: "Properties"
|
|
8991
|
-
}
|
|
9211
|
+
});
|
|
8992
9212
|
}
|
|
8993
9213
|
|
|
8994
9214
|
function _catch$7(body, recover) {
|
|
@@ -9007,8 +9227,9 @@ function _catch$7(body, recover) {
|
|
|
9007
9227
|
|
|
9008
9228
|
function ApplicationCtx() {
|
|
9009
9229
|
var intl = reactIntl.useIntl();
|
|
9010
|
-
var
|
|
9011
|
-
var
|
|
9230
|
+
var traversal = useTraversal();
|
|
9231
|
+
var appContext = traversal.state.context;
|
|
9232
|
+
var databases = appContext.databases;
|
|
9012
9233
|
return jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
9013
9234
|
children: [jsxRuntime.jsx("h3", {
|
|
9014
9235
|
children: intl.formatMessage({
|
|
@@ -9022,22 +9243,26 @@ function ApplicationCtx() {
|
|
|
9022
9243
|
className: "container",
|
|
9023
9244
|
children: [jsxRuntime.jsx(ItemTitle, {
|
|
9024
9245
|
title: "Objects"
|
|
9025
|
-
}),
|
|
9026
|
-
|
|
9027
|
-
|
|
9028
|
-
|
|
9029
|
-
|
|
9030
|
-
|
|
9031
|
-
|
|
9032
|
-
|
|
9246
|
+
}), jsxRuntime.jsx("table", {
|
|
9247
|
+
children: jsxRuntime.jsx("tbody", {
|
|
9248
|
+
children: databases.map(function (db) {
|
|
9249
|
+
return jsxRuntime.jsx(Item, {
|
|
9250
|
+
item: {
|
|
9251
|
+
id: db,
|
|
9252
|
+
path: "/" + db + "/"
|
|
9253
|
+
},
|
|
9254
|
+
icon: 'fas fa-database'
|
|
9255
|
+
}, db);
|
|
9256
|
+
})
|
|
9257
|
+
})
|
|
9033
9258
|
})]
|
|
9034
9259
|
})]
|
|
9035
9260
|
});
|
|
9036
9261
|
}
|
|
9037
9262
|
function DatabaseCtx() {
|
|
9038
|
-
var
|
|
9039
|
-
var containers =
|
|
9040
|
-
var path =
|
|
9263
|
+
var traversal = useTraversal();
|
|
9264
|
+
var containers = traversal.state.context.containers;
|
|
9265
|
+
var path = traversal.state.path;
|
|
9041
9266
|
return jsxRuntime.jsx(jsxRuntime.Fragment, {
|
|
9042
9267
|
children: jsxRuntime.jsxs("div", {
|
|
9043
9268
|
className: "container",
|
|
@@ -9325,18 +9550,17 @@ function UsersToolbar() {
|
|
|
9325
9550
|
|
|
9326
9551
|
var searchText = location.get('q');
|
|
9327
9552
|
|
|
9328
|
-
var onSearchQuery = function onSearchQuery(
|
|
9329
|
-
|
|
9553
|
+
var onSearchQuery = function onSearchQuery(event) {
|
|
9554
|
+
event.preventDefault();
|
|
9330
9555
|
setLocation({
|
|
9331
|
-
q:
|
|
9556
|
+
q: event.currentTarget.elements.filterInput.value,
|
|
9332
9557
|
page: 0
|
|
9333
9558
|
});
|
|
9334
|
-
ev.preventDefault();
|
|
9335
9559
|
}; // cleanup form on state.search change
|
|
9336
9560
|
|
|
9337
9561
|
|
|
9338
9562
|
React.useEffect(function () {
|
|
9339
|
-
if (!searchText || searchText === '') {
|
|
9563
|
+
if (ref.current && (!searchText || searchText === '')) {
|
|
9340
9564
|
ref.current.value = '';
|
|
9341
9565
|
}
|
|
9342
9566
|
}, [searchText]);
|
|
@@ -9356,7 +9580,8 @@ function UsersToolbar() {
|
|
|
9356
9580
|
type: "text",
|
|
9357
9581
|
className: "input is-size-7",
|
|
9358
9582
|
placeholder: intl.formatMessage(genericMessages.search),
|
|
9359
|
-
"data-test": "inputFilterTest"
|
|
9583
|
+
"data-test": "inputFilterTest",
|
|
9584
|
+
id: "filterInput"
|
|
9360
9585
|
})
|
|
9361
9586
|
}), jsxRuntime.jsx("div", {
|
|
9362
9587
|
className: "control",
|
|
@@ -9388,12 +9613,12 @@ function UsersToolbar() {
|
|
|
9388
9613
|
})]
|
|
9389
9614
|
});
|
|
9390
9615
|
}
|
|
9391
|
-
function UsersCtx(
|
|
9392
|
-
return jsxRuntime.jsx(TabsPanel,
|
|
9616
|
+
function UsersCtx() {
|
|
9617
|
+
return jsxRuntime.jsx(TabsPanel, {
|
|
9393
9618
|
tabs: tabs$3,
|
|
9394
9619
|
currentTab: "Users",
|
|
9395
9620
|
rightToolbar: jsxRuntime.jsx(UsersToolbar, {})
|
|
9396
|
-
}
|
|
9621
|
+
});
|
|
9397
9622
|
}
|
|
9398
9623
|
function UserCtx() {
|
|
9399
9624
|
var intl = reactIntl.useIntl();
|
|
@@ -9410,9 +9635,10 @@ function UserCtx() {
|
|
|
9410
9635
|
state = _useState[0],
|
|
9411
9636
|
setState = _useState[1];
|
|
9412
9637
|
|
|
9638
|
+
var userDataContext = Ctx.context;
|
|
9413
9639
|
var fields = {
|
|
9414
9640
|
user_groups: [],
|
|
9415
|
-
user_roles:
|
|
9641
|
+
user_roles: userDataContext.user_roles
|
|
9416
9642
|
};
|
|
9417
9643
|
|
|
9418
9644
|
var _useRemoteField = useRemoteField(fields),
|
|
@@ -9516,7 +9742,7 @@ function UserCtx() {
|
|
|
9516
9742
|
"value": "Username"
|
|
9517
9743
|
}]
|
|
9518
9744
|
}), ":", ' ']
|
|
9519
|
-
}), ' ',
|
|
9745
|
+
}), ' ', userDataContext.username, " (", userDataContext.email, ")"]
|
|
9520
9746
|
}), jsxRuntime.jsxs("p", {
|
|
9521
9747
|
children: [jsxRuntime.jsxs("label", {
|
|
9522
9748
|
children: [' ', intl.formatMessage({
|
|
@@ -9526,7 +9752,7 @@ function UserCtx() {
|
|
|
9526
9752
|
"value": "Creation Date"
|
|
9527
9753
|
}]
|
|
9528
9754
|
}), ":", ' ']
|
|
9529
|
-
}), ' ', formatDate(
|
|
9755
|
+
}), ' ', formatDate(userDataContext.creation_date)]
|
|
9530
9756
|
}), jsxRuntime.jsxs("p", {
|
|
9531
9757
|
children: [jsxRuntime.jsxs("label", {
|
|
9532
9758
|
children: [' ', intl.formatMessage({
|
|
@@ -9536,7 +9762,7 @@ function UserCtx() {
|
|
|
9536
9762
|
"value": "Modification Date"
|
|
9537
9763
|
}]
|
|
9538
9764
|
}), ":", ' ']
|
|
9539
|
-
}), ' ', formatDate(
|
|
9765
|
+
}), ' ', formatDate(userDataContext.modification_date)]
|
|
9540
9766
|
}), jsxRuntime.jsx(Button, {
|
|
9541
9767
|
className: "is-size-7 is-info",
|
|
9542
9768
|
onClick: function onClick() {
|
|
@@ -9555,7 +9781,7 @@ function UserCtx() {
|
|
|
9555
9781
|
onSubmit: function onSubmit(ev) {
|
|
9556
9782
|
return updateObject(ev);
|
|
9557
9783
|
},
|
|
9558
|
-
formData:
|
|
9784
|
+
formData: userDataContext,
|
|
9559
9785
|
exclude: ['password'],
|
|
9560
9786
|
remotes: remotes,
|
|
9561
9787
|
submitButton: false,
|
|
@@ -9569,7 +9795,7 @@ function UserCtx() {
|
|
|
9569
9795
|
className: "column",
|
|
9570
9796
|
children: [jsxRuntime.jsx(TagsWidget, {
|
|
9571
9797
|
onChange: updateRemote('user_groups'),
|
|
9572
|
-
items:
|
|
9798
|
+
items: userDataContext.user_groups,
|
|
9573
9799
|
title: "Groups",
|
|
9574
9800
|
noData: intl.formatMessage({
|
|
9575
9801
|
id: "there_is_no_groups_for_this_user",
|
|
@@ -9590,7 +9816,12 @@ function UserCtx() {
|
|
|
9590
9816
|
"value": "The user doesn't have any role"
|
|
9591
9817
|
}]
|
|
9592
9818
|
}),
|
|
9593
|
-
available: state.roles
|
|
9819
|
+
available: state.roles.map(function (x) {
|
|
9820
|
+
return {
|
|
9821
|
+
value: x,
|
|
9822
|
+
text: x
|
|
9823
|
+
};
|
|
9824
|
+
})
|
|
9594
9825
|
})]
|
|
9595
9826
|
})]
|
|
9596
9827
|
})]
|
|
@@ -9606,7 +9837,7 @@ function CopyItems(props) {
|
|
|
9606
9837
|
try {
|
|
9607
9838
|
return Promise.resolve(Promise.all(items.map(function (item, i) {
|
|
9608
9839
|
var input = form[i + 1] || {};
|
|
9609
|
-
return Ctx.client.post("" + Ctx.path + item
|
|
9840
|
+
return Ctx.client.post("" + Ctx.path + item.id + "/@duplicate", {
|
|
9610
9841
|
destination: path,
|
|
9611
9842
|
new_id: input.value || getNewId(item.id)
|
|
9612
9843
|
});
|
|
@@ -9652,7 +9883,7 @@ function CopyItems(props) {
|
|
|
9652
9883
|
}), jsxRuntime.jsx("input", {
|
|
9653
9884
|
type: "text",
|
|
9654
9885
|
className: "input",
|
|
9655
|
-
"data-test": "inputCopyIdTest-" + item
|
|
9886
|
+
"data-test": "inputCopyIdTest-" + item.id,
|
|
9656
9887
|
defaultValue: getNewId(item.id)
|
|
9657
9888
|
})]
|
|
9658
9889
|
}, item.id);
|
|
@@ -9725,9 +9956,9 @@ function MoveItems(props) {
|
|
|
9725
9956
|
var moveItems = function moveItems(path) {
|
|
9726
9957
|
try {
|
|
9727
9958
|
return Promise.resolve(Promise.all(items.map(function (item) {
|
|
9728
|
-
return Ctx.client.post("" + Ctx.path + item
|
|
9959
|
+
return Ctx.client.post("" + Ctx.path + item.id + "/@move", {
|
|
9729
9960
|
destination: path,
|
|
9730
|
-
new_id: item
|
|
9961
|
+
new_id: item.id
|
|
9731
9962
|
});
|
|
9732
9963
|
}))).then(function (responses) {
|
|
9733
9964
|
Ctx.refresh();
|
|
@@ -10064,18 +10295,17 @@ function GroupToolbar() {
|
|
|
10064
10295
|
|
|
10065
10296
|
var searchText = location.get('q');
|
|
10066
10297
|
|
|
10067
|
-
var onSearchQuery = function onSearchQuery(
|
|
10068
|
-
|
|
10298
|
+
var onSearchQuery = function onSearchQuery(event) {
|
|
10299
|
+
event.preventDefault();
|
|
10069
10300
|
setLocation({
|
|
10070
|
-
q:
|
|
10301
|
+
q: event.currentTarget.elements.filterInput.value,
|
|
10071
10302
|
page: 0
|
|
10072
10303
|
});
|
|
10073
|
-
ev.preventDefault();
|
|
10074
10304
|
}; // cleanup form on state.search change
|
|
10075
10305
|
|
|
10076
10306
|
|
|
10077
10307
|
React.useEffect(function () {
|
|
10078
|
-
if (!searchText || searchText === '') {
|
|
10308
|
+
if (ref.current && (!searchText || searchText === '')) {
|
|
10079
10309
|
ref.current.value = '';
|
|
10080
10310
|
}
|
|
10081
10311
|
}, [searchText]);
|
|
@@ -10095,7 +10325,8 @@ function GroupToolbar() {
|
|
|
10095
10325
|
type: "text",
|
|
10096
10326
|
className: "input is-size-7",
|
|
10097
10327
|
placeholder: intl.formatMessage(genericMessages.search),
|
|
10098
|
-
"data-test": "inputFilterTest"
|
|
10328
|
+
"data-test": "inputFilterTest",
|
|
10329
|
+
id: "filterInput"
|
|
10099
10330
|
})
|
|
10100
10331
|
}), jsxRuntime.jsx("div", {
|
|
10101
10332
|
className: "control",
|
|
@@ -10133,12 +10364,12 @@ function GroupToolbar() {
|
|
|
10133
10364
|
})]
|
|
10134
10365
|
});
|
|
10135
10366
|
}
|
|
10136
|
-
function GroupsCtx(
|
|
10137
|
-
return jsxRuntime.jsx(TabsPanel,
|
|
10367
|
+
function GroupsCtx() {
|
|
10368
|
+
return jsxRuntime.jsx(TabsPanel, {
|
|
10138
10369
|
tabs: tabs$4,
|
|
10139
10370
|
currentTab: "Groups",
|
|
10140
10371
|
rightToolbar: jsxRuntime.jsx(GroupToolbar, {})
|
|
10141
|
-
}
|
|
10372
|
+
});
|
|
10142
10373
|
}
|
|
10143
10374
|
var sortParsed = parser("_sort_asc=id");
|
|
10144
10375
|
var searchParsed = parser('type_name=User');
|
|
@@ -10153,6 +10384,7 @@ function GroupCtx() {
|
|
|
10153
10384
|
roles = _useState[0],
|
|
10154
10385
|
setRoles = _useState[1];
|
|
10155
10386
|
|
|
10387
|
+
var groupDataContext = Ctx.context;
|
|
10156
10388
|
React.useEffect(function () {
|
|
10157
10389
|
var getRoles = function getRoles() {
|
|
10158
10390
|
try {
|
|
@@ -10206,11 +10438,11 @@ function GroupCtx() {
|
|
|
10206
10438
|
var addRole = function addRole(role) {
|
|
10207
10439
|
try {
|
|
10208
10440
|
return Promise.resolve(patch({
|
|
10209
|
-
user_roles:
|
|
10441
|
+
user_roles: groupDataContext.user_roles.concat(role)
|
|
10210
10442
|
})).then(function (_ref) {
|
|
10211
10443
|
var isError = _ref.isError,
|
|
10212
10444
|
errorMessage = _ref.errorMessage;
|
|
10213
|
-
handleResponse(isError, intl.formatMessage({
|
|
10445
|
+
handleResponse(!!isError, intl.formatMessage({
|
|
10214
10446
|
id: "role_added_to_group",
|
|
10215
10447
|
defaultMessage: [{
|
|
10216
10448
|
"type": 0,
|
|
@@ -10224,7 +10456,7 @@ function GroupCtx() {
|
|
|
10224
10456
|
}]
|
|
10225
10457
|
}, {
|
|
10226
10458
|
role: role
|
|
10227
|
-
}), errorMessage);
|
|
10459
|
+
}), errorMessage != null ? errorMessage : '');
|
|
10228
10460
|
});
|
|
10229
10461
|
} catch (e) {
|
|
10230
10462
|
return Promise.reject(e);
|
|
@@ -10234,13 +10466,13 @@ function GroupCtx() {
|
|
|
10234
10466
|
var removeRole = function removeRole(role) {
|
|
10235
10467
|
try {
|
|
10236
10468
|
return Promise.resolve(patch({
|
|
10237
|
-
user_roles:
|
|
10469
|
+
user_roles: groupDataContext.user_roles.filter(function (r) {
|
|
10238
10470
|
return r !== role;
|
|
10239
10471
|
})
|
|
10240
10472
|
})).then(function (_ref2) {
|
|
10241
10473
|
var isError = _ref2.isError,
|
|
10242
10474
|
errorMessage = _ref2.errorMessage;
|
|
10243
|
-
handleResponse(isError, intl.formatMessage({
|
|
10475
|
+
handleResponse(!!isError, intl.formatMessage({
|
|
10244
10476
|
id: "role_removed_from_group",
|
|
10245
10477
|
defaultMessage: [{
|
|
10246
10478
|
"type": 0,
|
|
@@ -10254,7 +10486,7 @@ function GroupCtx() {
|
|
|
10254
10486
|
}]
|
|
10255
10487
|
}, {
|
|
10256
10488
|
role: role
|
|
10257
|
-
}), errorMessage);
|
|
10489
|
+
}), errorMessage != null ? errorMessage : '');
|
|
10258
10490
|
});
|
|
10259
10491
|
} catch (e) {
|
|
10260
10492
|
return Promise.reject(e);
|
|
@@ -10264,30 +10496,32 @@ function GroupCtx() {
|
|
|
10264
10496
|
var addUser = function addUser(newUserId) {
|
|
10265
10497
|
try {
|
|
10266
10498
|
var data = {};
|
|
10267
|
-
|
|
10499
|
+
groupDataContext.users.forEach(function (user) {
|
|
10268
10500
|
data[user] = true;
|
|
10269
10501
|
});
|
|
10270
10502
|
data[newUserId] = true;
|
|
10271
10503
|
return Promise.resolve(Ctx.client.rest.patch(Ctx.containerPath + "@groups/" + Ctx.context['@name'], {
|
|
10272
10504
|
users: data
|
|
10273
|
-
})).then(function (
|
|
10274
|
-
|
|
10275
|
-
|
|
10276
|
-
|
|
10277
|
-
|
|
10278
|
-
|
|
10279
|
-
|
|
10280
|
-
|
|
10281
|
-
|
|
10282
|
-
|
|
10283
|
-
|
|
10505
|
+
})).then(function (response) {
|
|
10506
|
+
return Promise.resolve(processResponse(response)).then(function (_ref3) {
|
|
10507
|
+
var isError = _ref3.isError,
|
|
10508
|
+
errorMessage = _ref3.errorMessage;
|
|
10509
|
+
handleResponse(isError, intl.formatMessage({
|
|
10510
|
+
id: "user_added_to_group",
|
|
10511
|
+
defaultMessage: [{
|
|
10512
|
+
"type": 0,
|
|
10513
|
+
"value": "User "
|
|
10514
|
+
}, {
|
|
10515
|
+
"type": 1,
|
|
10516
|
+
"value": "user"
|
|
10517
|
+
}, {
|
|
10518
|
+
"type": 0,
|
|
10519
|
+
"value": " added to group"
|
|
10520
|
+
}]
|
|
10284
10521
|
}, {
|
|
10285
|
-
|
|
10286
|
-
|
|
10287
|
-
|
|
10288
|
-
}, {
|
|
10289
|
-
user: newUserId
|
|
10290
|
-
}), errorMessage);
|
|
10522
|
+
user: newUserId
|
|
10523
|
+
}), errorMessage != null ? errorMessage : '');
|
|
10524
|
+
});
|
|
10291
10525
|
});
|
|
10292
10526
|
} catch (e) {
|
|
10293
10527
|
return Promise.reject(e);
|
|
@@ -10297,29 +10531,31 @@ function GroupCtx() {
|
|
|
10297
10531
|
var removeUser = function removeUser(userToRemove) {
|
|
10298
10532
|
try {
|
|
10299
10533
|
var data = {};
|
|
10300
|
-
|
|
10534
|
+
groupDataContext.users.forEach(function (user) {
|
|
10301
10535
|
data[user] = userToRemove !== user;
|
|
10302
10536
|
});
|
|
10303
10537
|
return Promise.resolve(Ctx.client.rest.patch(Ctx.containerPath + "@groups/" + Ctx.context['@name'], {
|
|
10304
10538
|
users: data
|
|
10305
|
-
})).then(function (
|
|
10306
|
-
|
|
10307
|
-
|
|
10308
|
-
|
|
10309
|
-
|
|
10310
|
-
|
|
10311
|
-
|
|
10312
|
-
|
|
10313
|
-
|
|
10314
|
-
|
|
10315
|
-
|
|
10539
|
+
})).then(function (response) {
|
|
10540
|
+
return Promise.resolve(processResponse(response)).then(function (_ref4) {
|
|
10541
|
+
var isError = _ref4.isError,
|
|
10542
|
+
errorMessage = _ref4.errorMessage;
|
|
10543
|
+
handleResponse(isError, intl.formatMessage({
|
|
10544
|
+
id: "user_removed_from_group",
|
|
10545
|
+
defaultMessage: [{
|
|
10546
|
+
"type": 0,
|
|
10547
|
+
"value": "User "
|
|
10548
|
+
}, {
|
|
10549
|
+
"type": 1,
|
|
10550
|
+
"value": "user"
|
|
10551
|
+
}, {
|
|
10552
|
+
"type": 0,
|
|
10553
|
+
"value": " removed from group"
|
|
10554
|
+
}]
|
|
10316
10555
|
}, {
|
|
10317
|
-
|
|
10318
|
-
|
|
10319
|
-
|
|
10320
|
-
}, {
|
|
10321
|
-
user: userToRemove
|
|
10322
|
-
}), errorMessage);
|
|
10556
|
+
user: userToRemove
|
|
10557
|
+
}), errorMessage != null ? errorMessage : '');
|
|
10558
|
+
});
|
|
10323
10559
|
});
|
|
10324
10560
|
} catch (e) {
|
|
10325
10561
|
return Promise.reject(e);
|
|
@@ -10374,11 +10610,13 @@ function GroupCtx() {
|
|
|
10374
10610
|
})
|
|
10375
10611
|
}), jsxRuntime.jsx(Select, {
|
|
10376
10612
|
options: roles.filter(function (role) {
|
|
10377
|
-
return !
|
|
10613
|
+
return !groupDataContext.user_roles.includes(role.value);
|
|
10378
10614
|
}),
|
|
10379
10615
|
appendDefault: true,
|
|
10380
|
-
onChange:
|
|
10381
|
-
|
|
10616
|
+
onChange: function onChange(value) {
|
|
10617
|
+
return addRole(value);
|
|
10618
|
+
}
|
|
10619
|
+
}), jsxRuntime.jsx("hr", {}), groupDataContext.user_roles.map(function (urole) {
|
|
10382
10620
|
return jsxRuntime.jsx("p", {
|
|
10383
10621
|
className: "control",
|
|
10384
10622
|
children: jsxRuntime.jsx(Tag, {
|
|
@@ -10410,7 +10648,7 @@ function GroupCtx() {
|
|
|
10410
10648
|
traversal: Ctx,
|
|
10411
10649
|
onChange: addUser,
|
|
10412
10650
|
btnClass: "is-small"
|
|
10413
|
-
}), jsxRuntime.jsx("hr", {}),
|
|
10651
|
+
}), jsxRuntime.jsx("hr", {}), groupDataContext.users.map(function (user) {
|
|
10414
10652
|
return jsxRuntime.jsx("p", {
|
|
10415
10653
|
className: "control",
|
|
10416
10654
|
children: jsxRuntime.jsx(Tag, {
|
|
@@ -10559,7 +10797,7 @@ function Path() {
|
|
|
10559
10797
|
var links = buildPaths(segments);
|
|
10560
10798
|
|
|
10561
10799
|
if (segments.length === 1) {
|
|
10562
|
-
return
|
|
10800
|
+
return null;
|
|
10563
10801
|
}
|
|
10564
10802
|
|
|
10565
10803
|
return jsxRuntime.jsx("nav", {
|
|
@@ -10722,19 +10960,15 @@ var getItemsColumn = function getItemsColumn(type) {
|
|
|
10722
10960
|
return undefined;
|
|
10723
10961
|
};
|
|
10724
10962
|
|
|
10725
|
-
var
|
|
10726
|
-
|
|
10727
|
-
|
|
10728
|
-
}
|
|
10963
|
+
var getView = function getView(name) {
|
|
10964
|
+
return registry.views[name];
|
|
10965
|
+
};
|
|
10729
10966
|
|
|
10730
|
-
|
|
10967
|
+
var getForm = function getForm(type, fallback) {
|
|
10968
|
+
return registry.forms[type] || fallback || BaseForm;
|
|
10731
10969
|
};
|
|
10732
10970
|
|
|
10733
10971
|
var getAction = function getAction(type, fallback) {
|
|
10734
|
-
if (fallback === void 0) {
|
|
10735
|
-
fallback = undefined;
|
|
10736
|
-
}
|
|
10737
|
-
|
|
10738
10972
|
return registry.actions[type] || fallback;
|
|
10739
10973
|
};
|
|
10740
10974
|
|
|
@@ -10748,24 +10982,24 @@ var getProperties = function getProperties(type) {
|
|
|
10748
10982
|
|
|
10749
10983
|
var getSchemas = function getSchemas(type) {
|
|
10750
10984
|
return registry.schemas[type] || {};
|
|
10751
|
-
/*
|
|
10752
|
-
filters: [
|
|
10753
|
-
{
|
|
10754
|
-
attribute_key: string,
|
|
10755
|
-
label: string,
|
|
10756
|
-
type: 'select' | 'input'
|
|
10757
|
-
vocabulary: string | undefined
|
|
10758
|
-
values: {[key:string]:any}[]
|
|
10759
|
-
}
|
|
10760
|
-
]
|
|
10761
|
-
*/
|
|
10762
10985
|
};
|
|
10763
10986
|
|
|
10764
10987
|
var getFieldsToFilter = function getFieldsToFilter(type, fallback) {
|
|
10988
|
+
if (fallback === void 0) {
|
|
10989
|
+
fallback = ['title'];
|
|
10990
|
+
}
|
|
10991
|
+
|
|
10765
10992
|
return registry.fieldsToFilter[type] || fallback;
|
|
10766
10993
|
};
|
|
10767
10994
|
|
|
10768
10995
|
var getDefaultSortValue = function getDefaultSortValue(type, fallback) {
|
|
10996
|
+
if (fallback === void 0) {
|
|
10997
|
+
fallback = {
|
|
10998
|
+
key: 'id',
|
|
10999
|
+
direction: 'des'
|
|
11000
|
+
};
|
|
11001
|
+
}
|
|
11002
|
+
|
|
10769
11003
|
return registry.defaultSortValue[type] || fallback;
|
|
10770
11004
|
};
|
|
10771
11005
|
|
|
@@ -10779,7 +11013,8 @@ function useRegistry(data) {
|
|
|
10779
11013
|
if (data && !ref.current) {
|
|
10780
11014
|
ref.current = true;
|
|
10781
11015
|
Object.keys(data).map(function (key) {
|
|
10782
|
-
|
|
11016
|
+
var registryKey = key;
|
|
11017
|
+
registry[registryKey] = _extends({}, registry[registryKey], data[registryKey]);
|
|
10783
11018
|
});
|
|
10784
11019
|
}
|
|
10785
11020
|
|
|
@@ -10794,7 +11029,8 @@ function useRegistry(data) {
|
|
|
10794
11029
|
getItemsColumn: getItemsColumn,
|
|
10795
11030
|
getFieldsToFilter: getFieldsToFilter,
|
|
10796
11031
|
getDefaultSortValue: getDefaultSortValue,
|
|
10797
|
-
getSchemas: getSchemas
|
|
11032
|
+
getSchemas: getSchemas,
|
|
11033
|
+
getView: getView
|
|
10798
11034
|
};
|
|
10799
11035
|
}
|
|
10800
11036
|
/*
|
|
@@ -10814,83 +11050,6 @@ const registry = {
|
|
|
10814
11050
|
|
|
10815
11051
|
*/
|
|
10816
11052
|
|
|
10817
|
-
var initialState$4 = {
|
|
10818
|
-
path: '',
|
|
10819
|
-
loading: false,
|
|
10820
|
-
context: undefined,
|
|
10821
|
-
flash: {
|
|
10822
|
-
message: undefined,
|
|
10823
|
-
type: undefined
|
|
10824
|
-
},
|
|
10825
|
-
action: {
|
|
10826
|
-
action: undefined,
|
|
10827
|
-
params: undefined
|
|
10828
|
-
},
|
|
10829
|
-
permissions: undefined,
|
|
10830
|
-
errorStatus: undefined,
|
|
10831
|
-
registry: {},
|
|
10832
|
-
refresh: undefined
|
|
10833
|
-
};
|
|
10834
|
-
function guillotinaReducer(state, action) {
|
|
10835
|
-
switch (action.type) {
|
|
10836
|
-
case 'SET_PATH':
|
|
10837
|
-
return _extends({}, state, {
|
|
10838
|
-
path: action.payload,
|
|
10839
|
-
loading: true
|
|
10840
|
-
});
|
|
10841
|
-
|
|
10842
|
-
case 'SET_CONTEXT':
|
|
10843
|
-
return _extends({}, state, action.payload, {
|
|
10844
|
-
errorStatus: undefined,
|
|
10845
|
-
loading: false
|
|
10846
|
-
});
|
|
10847
|
-
|
|
10848
|
-
case 'SET_ERROR':
|
|
10849
|
-
return _extends({}, state, {
|
|
10850
|
-
errorStatus: action.payload,
|
|
10851
|
-
loading: false
|
|
10852
|
-
});
|
|
10853
|
-
|
|
10854
|
-
case 'SET_FLASH':
|
|
10855
|
-
return _extends({}, state, action.payload);
|
|
10856
|
-
|
|
10857
|
-
case 'CLEAR_FLASH':
|
|
10858
|
-
return _extends({}, state, {
|
|
10859
|
-
flash: {
|
|
10860
|
-
message: undefined,
|
|
10861
|
-
type: undefined
|
|
10862
|
-
}
|
|
10863
|
-
});
|
|
10864
|
-
|
|
10865
|
-
case 'SET_ACTION':
|
|
10866
|
-
return _extends({}, state, {
|
|
10867
|
-
action: action.payload
|
|
10868
|
-
});
|
|
10869
|
-
|
|
10870
|
-
case 'CLEAR_ACTION':
|
|
10871
|
-
return _extends({}, state, {
|
|
10872
|
-
action: {
|
|
10873
|
-
action: undefined,
|
|
10874
|
-
params: undefined
|
|
10875
|
-
}
|
|
10876
|
-
});
|
|
10877
|
-
|
|
10878
|
-
case 'REFRESH':
|
|
10879
|
-
return _extends({}, state, {
|
|
10880
|
-
refresh: Date.now(),
|
|
10881
|
-
loading: !action.payload.transparent
|
|
10882
|
-
});
|
|
10883
|
-
|
|
10884
|
-
case 'APPLY':
|
|
10885
|
-
return _extends({}, state, {
|
|
10886
|
-
context: _extends({}, state.context, action.payload)
|
|
10887
|
-
});
|
|
10888
|
-
|
|
10889
|
-
default:
|
|
10890
|
-
return state;
|
|
10891
|
-
}
|
|
10892
|
-
}
|
|
10893
|
-
|
|
10894
11053
|
var actions = [
|
|
10895
11054
|
{
|
|
10896
11055
|
type: 0,
|
|
@@ -13708,7 +13867,7 @@ function Guillotina(_ref) {
|
|
|
13708
13867
|
var _useConfig = useConfig(config),
|
|
13709
13868
|
Permissions = _useConfig.Permissions;
|
|
13710
13869
|
|
|
13711
|
-
var registry = useRegistry(props.registry
|
|
13870
|
+
var registry = useRegistry(props.registry); // Location is cooked routing solution (only uses search params)
|
|
13712
13871
|
|
|
13713
13872
|
var _useLocation = useLocation(),
|
|
13714
13873
|
location = _useLocation[0]; // if there is no path provided just go to root
|
|
@@ -13717,10 +13876,10 @@ function Guillotina(_ref) {
|
|
|
13717
13876
|
var searchPath = location.get('path') || '/';
|
|
13718
13877
|
|
|
13719
13878
|
if (searchPath && searchPath !== '') {
|
|
13720
|
-
initialState
|
|
13879
|
+
initialState.path = searchPath;
|
|
13721
13880
|
}
|
|
13722
13881
|
|
|
13723
|
-
var _useReducer = React.useReducer(guillotinaReducer, initialState
|
|
13882
|
+
var _useReducer = React.useReducer(guillotinaReducer, initialState),
|
|
13724
13883
|
state = _useReducer[0],
|
|
13725
13884
|
dispatch = _useReducer[1];
|
|
13726
13885
|
|
|
@@ -13728,8 +13887,10 @@ function Guillotina(_ref) {
|
|
|
13728
13887
|
refresh = state.refresh;
|
|
13729
13888
|
React.useEffect(function () {
|
|
13730
13889
|
dispatch({
|
|
13731
|
-
type:
|
|
13732
|
-
payload:
|
|
13890
|
+
type: GuillotinaReducerActionTypes.SET_PATH,
|
|
13891
|
+
payload: {
|
|
13892
|
+
path: searchPath
|
|
13893
|
+
}
|
|
13733
13894
|
});
|
|
13734
13895
|
}, [searchPath]);
|
|
13735
13896
|
React.useEffect(function () {
|
|
@@ -13738,14 +13899,18 @@ function Guillotina(_ref) {
|
|
|
13738
13899
|
return Promise.resolve(client.getContext(path)).then(function (data) {
|
|
13739
13900
|
if (data.status === 401) {
|
|
13740
13901
|
dispatch({
|
|
13741
|
-
type:
|
|
13742
|
-
payload:
|
|
13902
|
+
type: GuillotinaReducerActionTypes.SET_ERROR,
|
|
13903
|
+
payload: {
|
|
13904
|
+
errorStatus: 'notallowed'
|
|
13905
|
+
}
|
|
13743
13906
|
});
|
|
13744
13907
|
return;
|
|
13745
13908
|
} else if (data.status === 404) {
|
|
13746
13909
|
dispatch({
|
|
13747
|
-
type:
|
|
13748
|
-
payload:
|
|
13910
|
+
type: GuillotinaReducerActionTypes.SET_ERROR,
|
|
13911
|
+
payload: {
|
|
13912
|
+
errorStatus: 'notallowed'
|
|
13913
|
+
}
|
|
13749
13914
|
});
|
|
13750
13915
|
return;
|
|
13751
13916
|
}
|
|
@@ -13754,7 +13919,7 @@ function Guillotina(_ref) {
|
|
|
13754
13919
|
return Promise.resolve(client.canido(path, Permissions)).then(function (pr) {
|
|
13755
13920
|
return Promise.resolve(pr.json()).then(function (permissions) {
|
|
13756
13921
|
dispatch({
|
|
13757
|
-
type:
|
|
13922
|
+
type: GuillotinaReducerActionTypes.SET_CONTEXT,
|
|
13758
13923
|
payload: {
|
|
13759
13924
|
context: context,
|
|
13760
13925
|
permissions: permissions
|
|
@@ -13771,9 +13936,9 @@ function Guillotina(_ref) {
|
|
|
13771
13936
|
|
|
13772
13937
|
initContext();
|
|
13773
13938
|
}, [path, refresh, client]);
|
|
13774
|
-
var ErrorBoundary = registry.
|
|
13775
|
-
var NotAllowed = registry.
|
|
13776
|
-
var NotFound = registry.
|
|
13939
|
+
var ErrorBoundary = registry.getView('ErrorBoundary');
|
|
13940
|
+
var NotAllowed = registry.getView('NotAllowed');
|
|
13941
|
+
var NotFound = registry.getView('NotFound');
|
|
13777
13942
|
var Path = registry.get('components', 'Path');
|
|
13778
13943
|
var contextData = {
|
|
13779
13944
|
url: url,
|
|
@@ -13796,7 +13961,7 @@ function Guillotina(_ref) {
|
|
|
13796
13961
|
children: jsxRuntime.jsxs(ErrorBoundary, {
|
|
13797
13962
|
children: [!errorStatus && jsxRuntime.jsx(TraversalProvider, _extends({}, contextData, {
|
|
13798
13963
|
children: permissions && jsxRuntime.jsxs(React__default['default'].Fragment, {
|
|
13799
|
-
children: [action.action && jsxRuntime.jsx(Action, _extends({}, action.params)), jsxRuntime.jsx("div", {
|
|
13964
|
+
children: [action.action && Action !== null && jsxRuntime.jsx(Action, _extends({}, action.params)), jsxRuntime.jsx("div", {
|
|
13800
13965
|
className: "level",
|
|
13801
13966
|
children: jsxRuntime.jsx("div", {
|
|
13802
13967
|
className: "level-left",
|
|
@@ -13805,7 +13970,7 @@ function Guillotina(_ref) {
|
|
|
13805
13970
|
children: jsxRuntime.jsx(Path, {})
|
|
13806
13971
|
})
|
|
13807
13972
|
})
|
|
13808
|
-
}), jsxRuntime.jsx(Flash, {}), Main && jsxRuntime.jsx(ErrorBoundary, {
|
|
13973
|
+
}), jsxRuntime.jsx(Flash, {}), Main !== undefined && jsxRuntime.jsx(ErrorBoundary, {
|
|
13809
13974
|
children: jsxRuntime.jsxs("div", {
|
|
13810
13975
|
className: "box main-panel",
|
|
13811
13976
|
children: [state.loading && jsxRuntime.jsx(Loading, {}), !state.loading && jsxRuntime.jsx(Main, {
|
|
@@ -13915,7 +14080,7 @@ var ERRORS = {
|
|
|
13915
14080
|
var initialState$5 = {
|
|
13916
14081
|
username: '',
|
|
13917
14082
|
password: '',
|
|
13918
|
-
loading:
|
|
14083
|
+
loading: false,
|
|
13919
14084
|
errors: undefined
|
|
13920
14085
|
};
|
|
13921
14086
|
var Login = function Login(_ref) {
|
|
@@ -13931,7 +14096,7 @@ var Login = function Login(_ref) {
|
|
|
13931
14096
|
|
|
13932
14097
|
var inputRef = React.useRef(null);
|
|
13933
14098
|
React.useEffect(function () {
|
|
13934
|
-
if (inputRef) {
|
|
14099
|
+
if (inputRef && inputRef.current) {
|
|
13935
14100
|
inputRef.current.focus();
|
|
13936
14101
|
}
|
|
13937
14102
|
}, [inputRef]);
|
|
@@ -14152,30 +14317,30 @@ function RequiredFieldsForm(_ref) {
|
|
|
14152
14317
|
dataTest: dataTest,
|
|
14153
14318
|
children: [schema && schema.data && !schema.loading && schema.formFields.map(function (key) {
|
|
14154
14319
|
if (!ignoreFiels.includes(key)) {
|
|
14155
|
-
var _value$title;
|
|
14320
|
+
var _schema$data, _value$title, _schema$data2;
|
|
14156
14321
|
|
|
14157
|
-
var value = schema.data.properties[key];
|
|
14322
|
+
var value = (_schema$data = schema.data) == null ? void 0 : _schema$data.properties[key];
|
|
14158
14323
|
return jsxRuntime.jsx(EditComponent, {
|
|
14159
14324
|
id: key,
|
|
14160
14325
|
placeholder: (_value$title = value == null ? void 0 : value.title) != null ? _value$title : '',
|
|
14161
14326
|
className: "",
|
|
14162
14327
|
required: true,
|
|
14163
|
-
schema: schema.data.properties[key],
|
|
14164
|
-
setValue: function setValue(
|
|
14328
|
+
schema: (_schema$data2 = schema.data) == null ? void 0 : _schema$data2.properties[key],
|
|
14329
|
+
setValue: function setValue(value) {
|
|
14165
14330
|
if (key === 'title') {
|
|
14166
14331
|
var _extends2;
|
|
14167
14332
|
|
|
14168
14333
|
setFormData(_extends({}, formData, (_extends2 = {
|
|
14169
|
-
uuid: stringToSlug(
|
|
14170
|
-
}, _extends2[key] =
|
|
14334
|
+
uuid: stringToSlug(value)
|
|
14335
|
+
}, _extends2[key] = value, _extends2)));
|
|
14171
14336
|
} else if (key === 'uuid') {
|
|
14172
14337
|
setFormData(_extends({}, formData, {
|
|
14173
|
-
uuid: stringToSlug(
|
|
14338
|
+
uuid: stringToSlug(value)
|
|
14174
14339
|
}));
|
|
14175
14340
|
} else {
|
|
14176
14341
|
var _extends3;
|
|
14177
14342
|
|
|
14178
|
-
setFormData(_extends({}, formData, (_extends3 = {}, _extends3[key] =
|
|
14343
|
+
setFormData(_extends({}, formData, (_extends3 = {}, _extends3[key] = value, _extends3)));
|
|
14179
14344
|
}
|
|
14180
14345
|
},
|
|
14181
14346
|
error: errors[key],
|
|
@@ -14369,7 +14534,7 @@ var Auth = /*#__PURE__*/function () {
|
|
|
14369
14534
|
|
|
14370
14535
|
if (!authToken) return {};
|
|
14371
14536
|
|
|
14372
|
-
if (this.willExpire(expires) && this.retryRefresh < this.maxRetry) {
|
|
14537
|
+
if (this.willExpire(expires != null ? expires : '') && this.retryRefresh < this.maxRetry) {
|
|
14373
14538
|
|
|
14374
14539
|
(function () {
|
|
14375
14540
|
try {
|
|
@@ -14427,6 +14592,13 @@ var Auth = /*#__PURE__*/function () {
|
|
|
14427
14592
|
return Auth;
|
|
14428
14593
|
}();
|
|
14429
14594
|
|
|
14595
|
+
(function (Setting) {
|
|
14596
|
+
Setting["Allow"] = "Allow";
|
|
14597
|
+
Setting["AllowSingle"] = "AllowSingle";
|
|
14598
|
+
Setting["Deny"] = "Deny";
|
|
14599
|
+
Setting["Unset"] = "Unset";
|
|
14600
|
+
})(exports.Setting || (exports.Setting = {}));
|
|
14601
|
+
|
|
14430
14602
|
exports.AddItem = AddItem;
|
|
14431
14603
|
exports.AddPermission = AddPermission;
|
|
14432
14604
|
exports.AllItemsCheckbox = AllItemsCheckbox;
|
|
@@ -14440,7 +14612,6 @@ exports.Button = Button;
|
|
|
14440
14612
|
exports.Checkbox = Checkbox;
|
|
14441
14613
|
exports.ClientContext = ClientContext;
|
|
14442
14614
|
exports.ClientProvider = ClientProvider;
|
|
14443
|
-
exports.Config = Config;
|
|
14444
14615
|
exports.Confirm = Confirm;
|
|
14445
14616
|
exports.ContainerCtx = ContainerCtx;
|
|
14446
14617
|
exports.ContextToolbar = ContextToolbar;
|
|
@@ -14538,12 +14709,14 @@ exports.VocabularyRenderField = VocabularyRenderField;
|
|
|
14538
14709
|
exports.base64ToArrayBuffer = base64ToArrayBuffer;
|
|
14539
14710
|
exports.buildQs = buildQs;
|
|
14540
14711
|
exports.classnames = classnames;
|
|
14712
|
+
exports.debounce = debounce;
|
|
14541
14713
|
exports.defaultComponent = defaultComponent;
|
|
14714
|
+
exports.defaultConfig = defaultConfig;
|
|
14542
14715
|
exports.formatDate = formatDate;
|
|
14543
14716
|
exports.generateUID = generateUID;
|
|
14544
14717
|
exports.genericFileMessages = genericFileMessages;
|
|
14545
14718
|
exports.genericMessages = genericMessages;
|
|
14546
|
-
exports.get = get
|
|
14719
|
+
exports.get = get;
|
|
14547
14720
|
exports.getActionsObject = getActionsObject;
|
|
14548
14721
|
exports.getClient = getClient;
|
|
14549
14722
|
exports.getNewId = getNewId;
|