@guillotinaweb/react-gmi 0.24.1 → 0.25.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/fields/renderField.d.ts +5 -0
- package/dist/components/input/search_input.d.ts +14 -3
- package/dist/components/input/search_input_list.d.ts +35 -0
- package/dist/react-gmi.esm.js +694 -105
- package/dist/react-gmi.esm.js.map +1 -1
- package/dist/react-gmi.js +694 -104
- package/dist/react-gmi.js.map +1 -1
- package/dist/react-gmi.modern.js +592 -83
- package/dist/react-gmi.modern.js.map +1 -1
- package/dist/react-gmi.umd.js +694 -104
- package/dist/react-gmi.umd.js.map +1 -1
- package/package.json +1 -1
package/dist/react-gmi.modern.js
CHANGED
|
@@ -2418,6 +2418,37 @@ const Textarea = React.forwardRef((_ref, ref) => {
|
|
|
2418
2418
|
}, error ? error : ''));
|
|
2419
2419
|
});
|
|
2420
2420
|
|
|
2421
|
+
const defaultEvents = ['mousedown', 'touchstart'];
|
|
2422
|
+
|
|
2423
|
+
const on = (obj, ...args) => obj.addEventListener(...args);
|
|
2424
|
+
|
|
2425
|
+
const off = (obj, ...args) => obj.removeEventListener(...args);
|
|
2426
|
+
|
|
2427
|
+
function useClickAway(ref, onClickAway, events = defaultEvents) {
|
|
2428
|
+
const savedCallback = useRef(onClickAway);
|
|
2429
|
+
useEffect(() => {
|
|
2430
|
+
savedCallback.current = onClickAway;
|
|
2431
|
+
}, [onClickAway]);
|
|
2432
|
+
useEffect(() => {
|
|
2433
|
+
const handler = event => {
|
|
2434
|
+
const {
|
|
2435
|
+
current: el
|
|
2436
|
+
} = ref;
|
|
2437
|
+
el && !el.contains(event.target) && savedCallback.current(event);
|
|
2438
|
+
};
|
|
2439
|
+
|
|
2440
|
+
for (const eventName of events) {
|
|
2441
|
+
on(document, eventName, handler);
|
|
2442
|
+
}
|
|
2443
|
+
|
|
2444
|
+
return () => {
|
|
2445
|
+
for (const eventName of events) {
|
|
2446
|
+
off(document, eventName, handler);
|
|
2447
|
+
}
|
|
2448
|
+
};
|
|
2449
|
+
}, [events, ref]);
|
|
2450
|
+
}
|
|
2451
|
+
|
|
2421
2452
|
function debounce(func, wait) {
|
|
2422
2453
|
let timeout;
|
|
2423
2454
|
return function () {
|
|
@@ -2453,7 +2484,9 @@ const SearchInput = ({
|
|
|
2453
2484
|
dataTestWrapper: _dataTestWrapper = 'wrapperSearchInputTest',
|
|
2454
2485
|
dataTestSearchInput: _dataTestSearchInput = 'searchInputTest',
|
|
2455
2486
|
dataTestItem: _dataTestItem = 'searchInputItemTest',
|
|
2456
|
-
renderTextItemOption: _renderTextItemOption = null
|
|
2487
|
+
renderTextItemOption: _renderTextItemOption = null,
|
|
2488
|
+
typeNameQuery: _typeNameQuery = null,
|
|
2489
|
+
labelProperty: _labelProperty = 'id'
|
|
2457
2490
|
}) => {
|
|
2458
2491
|
const intl = useIntl();
|
|
2459
2492
|
const [options, setOptions] = useSetState(initialState);
|
|
@@ -2465,7 +2498,12 @@ const SearchInput = ({
|
|
|
2465
2498
|
PageSize,
|
|
2466
2499
|
SearchEngine
|
|
2467
2500
|
} = useConfig();
|
|
2501
|
+
const [valueLabel, setValueLabel] = useState(undefined);
|
|
2502
|
+
const [isLoadingData, setIsLoadingData] = useState(false);
|
|
2468
2503
|
const [uid] = useState(generateUID('search_input'));
|
|
2504
|
+
useClickAway(wrapperRef, () => {
|
|
2505
|
+
setIsOpen(false);
|
|
2506
|
+
});
|
|
2469
2507
|
|
|
2470
2508
|
const getHeight = () => {
|
|
2471
2509
|
if (wrapperRef && wrapperRef.current) {
|
|
@@ -2479,7 +2517,44 @@ const SearchInput = ({
|
|
|
2479
2517
|
};
|
|
2480
2518
|
};
|
|
2481
2519
|
|
|
2482
|
-
const delayedQuery =
|
|
2520
|
+
const delayedQuery = useCallback(debounce(value => handleSearch(0, false, value), 500), []);
|
|
2521
|
+
|
|
2522
|
+
const inicializeLabels = async () => {
|
|
2523
|
+
if (_labelProperty !== 'id' && value) {
|
|
2524
|
+
setIsLoadingData(true);
|
|
2525
|
+
let searchTermQs = [];
|
|
2526
|
+
const searchTermParsed = [`id`, value];
|
|
2527
|
+
const {
|
|
2528
|
+
get: getSearch
|
|
2529
|
+
} = _traversal.registry;
|
|
2530
|
+
const fnName = getSearch('searchEngineQueryParamsFunction', SearchEngine);
|
|
2531
|
+
|
|
2532
|
+
const qsParsed = _traversal.client[fnName]({
|
|
2533
|
+
path: _traversal.path,
|
|
2534
|
+
start: 0,
|
|
2535
|
+
pageSize: PageSize,
|
|
2536
|
+
withDepth: false
|
|
2537
|
+
});
|
|
2538
|
+
|
|
2539
|
+
let typeNameParsed = [];
|
|
2540
|
+
|
|
2541
|
+
if (_typeNameQuery) {
|
|
2542
|
+
typeNameParsed = parser(`type_name__in=${_typeNameQuery}`);
|
|
2543
|
+
}
|
|
2544
|
+
|
|
2545
|
+
if (_qs.length > 0 || searchTermParsed.length > 0 || qsParsed.length > 0 || typeNameParsed.length > 0) {
|
|
2546
|
+
searchTermQs = buildQs([..._qs, searchTermParsed, ...qsParsed, ...typeNameParsed]);
|
|
2547
|
+
}
|
|
2548
|
+
|
|
2549
|
+
const data = await _traversal.client.search(_path ? _path : _traversal.client.getContainerFromPath(_traversal.path), searchTermQs, false, false);
|
|
2550
|
+
const newValuesLabel = data.items.reduce((result, item) => {
|
|
2551
|
+
result[item.id] = get$1(item, _labelProperty, item.id);
|
|
2552
|
+
return result;
|
|
2553
|
+
}, {});
|
|
2554
|
+
setValueLabel(newValuesLabel);
|
|
2555
|
+
setIsLoadingData(false);
|
|
2556
|
+
}
|
|
2557
|
+
};
|
|
2483
2558
|
|
|
2484
2559
|
const handleSearch = async (page = 0, concat = false, value = '') => {
|
|
2485
2560
|
var _data$items_total;
|
|
@@ -2502,14 +2577,22 @@ const SearchInput = ({
|
|
|
2502
2577
|
let qsParsed = _traversal.client[fnName]({
|
|
2503
2578
|
path: _traversal.path,
|
|
2504
2579
|
start: page * PageSize,
|
|
2505
|
-
pageSize: PageSize
|
|
2580
|
+
pageSize: PageSize,
|
|
2581
|
+
withDepth: false
|
|
2506
2582
|
});
|
|
2507
2583
|
|
|
2508
|
-
|
|
2509
|
-
|
|
2584
|
+
let sortParsed = parser(`_sort_des=title`);
|
|
2585
|
+
let typeNameParsed = [];
|
|
2586
|
+
|
|
2587
|
+
if (_typeNameQuery) {
|
|
2588
|
+
typeNameParsed = parser(`type_name__in=${_typeNameQuery}`);
|
|
2510
2589
|
}
|
|
2511
2590
|
|
|
2512
|
-
|
|
2591
|
+
if (_qs.length > 0 || searchTermParsed.length > 0 || qsParsed.length > 0 || typeNameParsed.length > 0) {
|
|
2592
|
+
searchTermQs = buildQs([..._qs, ...searchTermParsed, ...qsParsed, ...typeNameParsed, ...sortParsed]);
|
|
2593
|
+
}
|
|
2594
|
+
|
|
2595
|
+
const data = await _traversal.client.search(_path ? _path : _traversal.client.getContainerFromPath(_traversal.path), searchTermQs, false, false);
|
|
2513
2596
|
const newItems = options.items && concat ? [...options.items, ...data.items] : data.items;
|
|
2514
2597
|
setOptions({
|
|
2515
2598
|
items: newItems != null ? newItems : [],
|
|
@@ -2527,18 +2610,24 @@ const SearchInput = ({
|
|
|
2527
2610
|
return item.title || item['@name'];
|
|
2528
2611
|
};
|
|
2529
2612
|
|
|
2530
|
-
|
|
2531
|
-
if (
|
|
2532
|
-
|
|
2533
|
-
|
|
2534
|
-
|
|
2535
|
-
})();
|
|
2613
|
+
useEffect(() => {
|
|
2614
|
+
if (value) {
|
|
2615
|
+
inicializeLabels();
|
|
2616
|
+
} else {
|
|
2617
|
+
setValueLabel({});
|
|
2536
2618
|
}
|
|
2537
|
-
}, [_path,
|
|
2619
|
+
}, [_path, value]);
|
|
2620
|
+
|
|
2621
|
+
if (valueLabel === undefined) {
|
|
2622
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
2623
|
+
className: "spinner"
|
|
2624
|
+
});
|
|
2625
|
+
}
|
|
2626
|
+
|
|
2538
2627
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
2539
2628
|
"data-test": _dataTestWrapper,
|
|
2540
2629
|
ref: wrapperRef,
|
|
2541
|
-
className: `dropdown ${isOpen ? 'is-active' : ''}`,
|
|
2630
|
+
className: `dropdown mb-2 ${isOpen ? 'is-active' : ''}`,
|
|
2542
2631
|
onBlur: ev => {
|
|
2543
2632
|
if (!ev.currentTarget.contains(ev.relatedTarget)) {
|
|
2544
2633
|
if (searchTerm !== '') {
|
|
@@ -2546,7 +2635,7 @@ const SearchInput = ({
|
|
|
2546
2635
|
setOptions(initialState);
|
|
2547
2636
|
}
|
|
2548
2637
|
|
|
2549
|
-
setIsOpen(
|
|
2638
|
+
setIsOpen(false);
|
|
2550
2639
|
}
|
|
2551
2640
|
}
|
|
2552
2641
|
}, /*#__PURE__*/React.createElement("div", {
|
|
@@ -2554,12 +2643,16 @@ const SearchInput = ({
|
|
|
2554
2643
|
}, /*#__PURE__*/React.createElement("button", {
|
|
2555
2644
|
className: `button ${_btnClass}`,
|
|
2556
2645
|
onClick: ev => {
|
|
2557
|
-
ev.
|
|
2646
|
+
ev.target.blur();
|
|
2558
2647
|
setIsOpen(!isOpen);
|
|
2648
|
+
|
|
2649
|
+
if (!options.loading && !options.items) {
|
|
2650
|
+
handleSearch(options.page);
|
|
2651
|
+
}
|
|
2559
2652
|
},
|
|
2560
2653
|
"aria-haspopup": "true",
|
|
2561
2654
|
"aria-controls": "dropdown-menu"
|
|
2562
|
-
}, /*#__PURE__*/React.createElement("span", null, value
|
|
2655
|
+
}, /*#__PURE__*/React.createElement("span", null, value ? get$1(valueLabel, value, value) : intl.formatMessage(genericMessages.choose)), /*#__PURE__*/React.createElement("span", {
|
|
2563
2656
|
className: "icon"
|
|
2564
2657
|
}, /*#__PURE__*/React.createElement("i", {
|
|
2565
2658
|
className: "fas fa-angle-down",
|
|
@@ -2587,12 +2680,16 @@ const SearchInput = ({
|
|
|
2587
2680
|
})), /*#__PURE__*/React.createElement("hr", {
|
|
2588
2681
|
className: "dropdown-divider"
|
|
2589
2682
|
}), options.loading && /*#__PURE__*/React.createElement(Loading, null), options.items && options.items.map(item => {
|
|
2590
|
-
return /*#__PURE__*/React.createElement("
|
|
2591
|
-
|
|
2592
|
-
className: `dropdown-item editable ${value && value.id === item.id ? 'is-active' : ''}`,
|
|
2683
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
2684
|
+
className: `dropdown-item editable ${value === item.id ? 'is-active' : ''}`,
|
|
2593
2685
|
"data-test": `${_dataTestItem}-${item.id}`,
|
|
2594
|
-
onMouseDown:
|
|
2595
|
-
|
|
2686
|
+
onMouseDown: ev => {
|
|
2687
|
+
ev.preventDefault();
|
|
2688
|
+
|
|
2689
|
+
if (onChange) {
|
|
2690
|
+
onChange(item.id);
|
|
2691
|
+
}
|
|
2692
|
+
|
|
2596
2693
|
setIsOpen(false);
|
|
2597
2694
|
},
|
|
2598
2695
|
key: item.path
|
|
@@ -2615,11 +2712,20 @@ const SearchInput = ({
|
|
|
2615
2712
|
};
|
|
2616
2713
|
SearchInput.propTypes = {
|
|
2617
2714
|
onChange: PropTypes.func,
|
|
2618
|
-
value: PropTypes.
|
|
2619
|
-
client: PropTypes.object,
|
|
2715
|
+
value: PropTypes.string,
|
|
2620
2716
|
path: PropTypes.string,
|
|
2621
|
-
|
|
2622
|
-
|
|
2717
|
+
btnClass: PropTypes.string,
|
|
2718
|
+
error: PropTypes.string,
|
|
2719
|
+
errorZoneClassName: PropTypes.string,
|
|
2720
|
+
traversal: PropTypes.object,
|
|
2721
|
+
qs: PropTypes.array,
|
|
2722
|
+
queryCondition: PropTypes.string,
|
|
2723
|
+
dataTestWrapper: PropTypes.string,
|
|
2724
|
+
dataTestSearchInput: PropTypes.string,
|
|
2725
|
+
dataTestItem: PropTypes.string,
|
|
2726
|
+
renderTextItemOption: PropTypes.func,
|
|
2727
|
+
typeNameQuery: PropTypes.string,
|
|
2728
|
+
labelProperty: PropTypes.string
|
|
2623
2729
|
};
|
|
2624
2730
|
|
|
2625
2731
|
const InputList = forwardRef(({
|
|
@@ -2668,37 +2774,6 @@ const InputList = forwardRef(({
|
|
|
2668
2774
|
}));
|
|
2669
2775
|
});
|
|
2670
2776
|
|
|
2671
|
-
const defaultEvents = ['mousedown', 'touchstart'];
|
|
2672
|
-
|
|
2673
|
-
const on = (obj, ...args) => obj.addEventListener(...args);
|
|
2674
|
-
|
|
2675
|
-
const off = (obj, ...args) => obj.removeEventListener(...args);
|
|
2676
|
-
|
|
2677
|
-
function useClickAway(ref, onClickAway, events = defaultEvents) {
|
|
2678
|
-
const savedCallback = useRef(onClickAway);
|
|
2679
|
-
useEffect(() => {
|
|
2680
|
-
savedCallback.current = onClickAway;
|
|
2681
|
-
}, [onClickAway]);
|
|
2682
|
-
useEffect(() => {
|
|
2683
|
-
const handler = event => {
|
|
2684
|
-
const {
|
|
2685
|
-
current: el
|
|
2686
|
-
} = ref;
|
|
2687
|
-
el && !el.contains(event.target) && savedCallback.current(event);
|
|
2688
|
-
};
|
|
2689
|
-
|
|
2690
|
-
for (const eventName of events) {
|
|
2691
|
-
on(document, eventName, handler);
|
|
2692
|
-
}
|
|
2693
|
-
|
|
2694
|
-
return () => {
|
|
2695
|
-
for (const eventName of events) {
|
|
2696
|
-
off(document, eventName, handler);
|
|
2697
|
-
}
|
|
2698
|
-
};
|
|
2699
|
-
}, [events, ref]);
|
|
2700
|
-
}
|
|
2701
|
-
|
|
2702
2777
|
function Dropdown(_ref) {
|
|
2703
2778
|
let {
|
|
2704
2779
|
children,
|
|
@@ -3098,6 +3173,82 @@ const getDefaultValueEditableField = intl => {
|
|
|
3098
3173
|
});
|
|
3099
3174
|
};
|
|
3100
3175
|
|
|
3176
|
+
const SearchRenderField = ({
|
|
3177
|
+
schema,
|
|
3178
|
+
value,
|
|
3179
|
+
modifyContent
|
|
3180
|
+
}) => {
|
|
3181
|
+
const [valuesLabels, setValuesLabels] = useState([]);
|
|
3182
|
+
const [isLoadingData, setIsLoadingData] = useState(false);
|
|
3183
|
+
const traversal = useTraversal();
|
|
3184
|
+
const {
|
|
3185
|
+
SearchEngine
|
|
3186
|
+
} = useConfig();
|
|
3187
|
+
useEffect(() => {
|
|
3188
|
+
const fetchData = async valuesToSearch => {
|
|
3189
|
+
setIsLoadingData(true);
|
|
3190
|
+
let searchTermQs = [];
|
|
3191
|
+
const searchTermParsed = ['__or', `id=${valuesToSearch.join('%26id=')}`];
|
|
3192
|
+
const {
|
|
3193
|
+
get: getSearch
|
|
3194
|
+
} = traversal.registry;
|
|
3195
|
+
const fnName = getSearch('searchEngineQueryParamsFunction', SearchEngine);
|
|
3196
|
+
const qsParsed = traversal.client[fnName]({
|
|
3197
|
+
path: traversal.path,
|
|
3198
|
+
start: 0,
|
|
3199
|
+
pageSize: 100,
|
|
3200
|
+
withDepth: false
|
|
3201
|
+
});
|
|
3202
|
+
|
|
3203
|
+
if (searchTermParsed.length > 0 || qsParsed.length > 0) {
|
|
3204
|
+
searchTermQs = buildQs([searchTermParsed, ...qsParsed]);
|
|
3205
|
+
}
|
|
3206
|
+
|
|
3207
|
+
const data = await traversal.client.search(traversal.client.getContainerFromPath(traversal.path), searchTermQs, false, false, 0, 100);
|
|
3208
|
+
const newValuesLabel = data.items.map(item => {
|
|
3209
|
+
var _schema$labelProperty;
|
|
3210
|
+
|
|
3211
|
+
return get$1(item, (_schema$labelProperty = schema == null ? void 0 : schema.labelProperty) != null ? _schema$labelProperty : 'title', item.id);
|
|
3212
|
+
});
|
|
3213
|
+
setValuesLabels(newValuesLabel);
|
|
3214
|
+
setIsLoadingData(false);
|
|
3215
|
+
};
|
|
3216
|
+
|
|
3217
|
+
let valuesToSearch = value;
|
|
3218
|
+
|
|
3219
|
+
if (typeof valuesToSearch === 'string') {
|
|
3220
|
+
valuesToSearch = [valuesToSearch];
|
|
3221
|
+
}
|
|
3222
|
+
|
|
3223
|
+
if (valuesToSearch !== undefined && valuesToSearch.length > 0) {
|
|
3224
|
+
fetchData(valuesToSearch);
|
|
3225
|
+
} else {
|
|
3226
|
+
setValuesLabels([]);
|
|
3227
|
+
}
|
|
3228
|
+
}, [value]);
|
|
3229
|
+
|
|
3230
|
+
const getRenderValue = () => {
|
|
3231
|
+
console.log('get render values', value, valuesLabels);
|
|
3232
|
+
|
|
3233
|
+
if (value === undefined) {
|
|
3234
|
+
if (modifyContent) {
|
|
3235
|
+
return DEFAULT_VALUE_EDITABLE_FIELD;
|
|
3236
|
+
}
|
|
3237
|
+
|
|
3238
|
+
return DEFAULT_VALUE_NO_EDITABLE_FIELD;
|
|
3239
|
+
}
|
|
3240
|
+
|
|
3241
|
+
if (isLoadingData) {
|
|
3242
|
+
return 'Loading...';
|
|
3243
|
+
}
|
|
3244
|
+
|
|
3245
|
+
return valuesLabels;
|
|
3246
|
+
};
|
|
3247
|
+
|
|
3248
|
+
return /*#__PURE__*/React.createElement(RenderField, {
|
|
3249
|
+
value: getRenderValue()
|
|
3250
|
+
});
|
|
3251
|
+
};
|
|
3101
3252
|
const VocabularyRenderField = ({
|
|
3102
3253
|
schema,
|
|
3103
3254
|
value,
|
|
@@ -3166,6 +3317,10 @@ function RenderFieldComponent({
|
|
|
3166
3317
|
} else if (schema != null && (_schema$items2 = schema.items) != null && _schema$items2.vocabularyName || schema != null && schema.vocabularyName) {
|
|
3167
3318
|
renderProps['Widget'] = VocabularyRenderField;
|
|
3168
3319
|
renderProps['schema'] = schema;
|
|
3320
|
+
} else if ((schema == null ? void 0 : schema.widget) === 'search' || (schema == null ? void 0 : schema.widget) === 'search_list') {
|
|
3321
|
+
renderProps['Widget'] = SearchRenderField;
|
|
3322
|
+
renderProps['value'] = val;
|
|
3323
|
+
renderProps['schema'] = schema;
|
|
3169
3324
|
}
|
|
3170
3325
|
|
|
3171
3326
|
return renderProps;
|
|
@@ -3244,6 +3399,299 @@ Select.propTypes = {
|
|
|
3244
3399
|
vocabularyName: PropTypes.string
|
|
3245
3400
|
};
|
|
3246
3401
|
|
|
3402
|
+
function debounce$1(func, wait) {
|
|
3403
|
+
let timeout;
|
|
3404
|
+
return function () {
|
|
3405
|
+
const context = this;
|
|
3406
|
+
const args = arguments;
|
|
3407
|
+
|
|
3408
|
+
const later = function later() {
|
|
3409
|
+
timeout = null;
|
|
3410
|
+
func.apply(context, args);
|
|
3411
|
+
};
|
|
3412
|
+
|
|
3413
|
+
clearTimeout(timeout);
|
|
3414
|
+
timeout = setTimeout(later, wait);
|
|
3415
|
+
};
|
|
3416
|
+
}
|
|
3417
|
+
|
|
3418
|
+
const initialState$1 = {
|
|
3419
|
+
page: 0,
|
|
3420
|
+
items: undefined,
|
|
3421
|
+
loading: false,
|
|
3422
|
+
items_total: 0
|
|
3423
|
+
};
|
|
3424
|
+
const SearchInputList = ({
|
|
3425
|
+
onChange,
|
|
3426
|
+
error,
|
|
3427
|
+
errorZoneClassName,
|
|
3428
|
+
traversal: _traversal = null,
|
|
3429
|
+
path: _path = null,
|
|
3430
|
+
qs: _qs = [],
|
|
3431
|
+
queryCondition: _queryCondition = 'id__in',
|
|
3432
|
+
value,
|
|
3433
|
+
btnClass: _btnClass = '',
|
|
3434
|
+
dataTestWrapper: _dataTestWrapper = 'wrapperSearchInputTest',
|
|
3435
|
+
dataTestSearchInput: _dataTestSearchInput = 'searchInputTest',
|
|
3436
|
+
dataTestItem: _dataTestItem = 'searchInputItemTest',
|
|
3437
|
+
renderTextItemOption: _renderTextItemOption = null,
|
|
3438
|
+
typeNameQuery: _typeNameQuery = null,
|
|
3439
|
+
labelProperty: _labelProperty = 'id'
|
|
3440
|
+
}) => {
|
|
3441
|
+
const intl = useIntl();
|
|
3442
|
+
const [options, setOptions] = useSetState(initialState$1);
|
|
3443
|
+
const [valuesLabel, setValuesLabels] = useState(undefined);
|
|
3444
|
+
const [isOpen, setIsOpen] = React.useState(false);
|
|
3445
|
+
const [searchTerm, setSearchTerm] = React.useState('');
|
|
3446
|
+
const inputRef = React.useRef(null);
|
|
3447
|
+
const wrapperRef = React.useRef(null);
|
|
3448
|
+
const {
|
|
3449
|
+
PageSize,
|
|
3450
|
+
SearchEngine
|
|
3451
|
+
} = useConfig();
|
|
3452
|
+
const [isLoadingData, setIsLoadingData] = useState(false);
|
|
3453
|
+
const [uid] = useState(generateUID('search_input'));
|
|
3454
|
+
useClickAway(wrapperRef, () => {
|
|
3455
|
+
setIsOpen(false);
|
|
3456
|
+
});
|
|
3457
|
+
|
|
3458
|
+
const getHeight = () => {
|
|
3459
|
+
if (wrapperRef && wrapperRef.current) {
|
|
3460
|
+
return {
|
|
3461
|
+
maxHeight: `${window.innerHeight - wrapperRef.current.getBoundingClientRect().top - 100}px`
|
|
3462
|
+
};
|
|
3463
|
+
}
|
|
3464
|
+
|
|
3465
|
+
return {
|
|
3466
|
+
maxHeight: 'auto'
|
|
3467
|
+
};
|
|
3468
|
+
};
|
|
3469
|
+
|
|
3470
|
+
const delayedQuery = useCallback(debounce$1(value => handleSearch(0, false, value), 500), []);
|
|
3471
|
+
|
|
3472
|
+
const handleSearch = async (page = 0, concat = false, value = '') => {
|
|
3473
|
+
var _data$items_total;
|
|
3474
|
+
|
|
3475
|
+
setOptions({
|
|
3476
|
+
loading: true
|
|
3477
|
+
});
|
|
3478
|
+
let searchTermQs = [];
|
|
3479
|
+
let searchTermParsed = [];
|
|
3480
|
+
|
|
3481
|
+
if (value !== '') {
|
|
3482
|
+
searchTermParsed = parser(`${_queryCondition}=${value}`);
|
|
3483
|
+
}
|
|
3484
|
+
|
|
3485
|
+
const {
|
|
3486
|
+
get
|
|
3487
|
+
} = _traversal.registry;
|
|
3488
|
+
const fnName = get('searchEngineQueryParamsFunction', SearchEngine);
|
|
3489
|
+
|
|
3490
|
+
let qsParsed = _traversal.client[fnName]({
|
|
3491
|
+
path: _traversal.path,
|
|
3492
|
+
start: page * PageSize,
|
|
3493
|
+
pageSize: PageSize,
|
|
3494
|
+
withDepth: false
|
|
3495
|
+
});
|
|
3496
|
+
|
|
3497
|
+
let sortParsed = parser(`_sort_des=title`);
|
|
3498
|
+
let typeNameParsed = [];
|
|
3499
|
+
|
|
3500
|
+
if (_typeNameQuery) {
|
|
3501
|
+
typeNameParsed = parser(`type_name__in=${_typeNameQuery}`);
|
|
3502
|
+
}
|
|
3503
|
+
|
|
3504
|
+
if (_qs.length > 0 || searchTermParsed.length > 0 || qsParsed.length > 0 || typeNameParsed.length > 0) {
|
|
3505
|
+
searchTermQs = buildQs([..._qs, ...searchTermParsed, ...qsParsed, ...typeNameParsed, ...sortParsed]);
|
|
3506
|
+
}
|
|
3507
|
+
|
|
3508
|
+
const data = await _traversal.client.search(_path ? _path : _traversal.client.getContainerFromPath(_traversal.path), searchTermQs, false, false);
|
|
3509
|
+
const newItems = options.items && concat ? [...options.items, ...data.items] : data.items;
|
|
3510
|
+
setOptions({
|
|
3511
|
+
items: newItems != null ? newItems : [],
|
|
3512
|
+
loading: false,
|
|
3513
|
+
items_total: (_data$items_total = data.items_total) != null ? _data$items_total : 0,
|
|
3514
|
+
page: page
|
|
3515
|
+
});
|
|
3516
|
+
};
|
|
3517
|
+
|
|
3518
|
+
const inicializeLabels = async () => {
|
|
3519
|
+
if (_labelProperty !== 'id' && value.length > 0) {
|
|
3520
|
+
setIsLoadingData(true);
|
|
3521
|
+
let searchTermQs = [];
|
|
3522
|
+
const searchTermParsed = ['__or', `id=${value.join('%26id=')}`];
|
|
3523
|
+
const {
|
|
3524
|
+
get: getSearch
|
|
3525
|
+
} = _traversal.registry;
|
|
3526
|
+
const fnName = getSearch('searchEngineQueryParamsFunction', SearchEngine);
|
|
3527
|
+
|
|
3528
|
+
const qsParsed = _traversal.client[fnName]({
|
|
3529
|
+
path: _traversal.path,
|
|
3530
|
+
start: 0,
|
|
3531
|
+
pageSize: 100,
|
|
3532
|
+
withDepth: false
|
|
3533
|
+
});
|
|
3534
|
+
|
|
3535
|
+
let typeNameParsed = [];
|
|
3536
|
+
|
|
3537
|
+
if (_typeNameQuery) {
|
|
3538
|
+
typeNameParsed = parser(`type_name__in=${_typeNameQuery}`);
|
|
3539
|
+
}
|
|
3540
|
+
|
|
3541
|
+
if (_qs.length > 0 || searchTermParsed.length > 0 || qsParsed.length > 0 || typeNameParsed.length > 0) {
|
|
3542
|
+
searchTermQs = buildQs([..._qs, searchTermParsed, ...qsParsed, ...typeNameParsed]);
|
|
3543
|
+
}
|
|
3544
|
+
|
|
3545
|
+
const data = await _traversal.client.search(_path ? _path : _traversal.client.getContainerFromPath(_traversal.path), searchTermQs, false, false, 0, 100);
|
|
3546
|
+
const newValuesLabel = data.items.reduce((result, item) => {
|
|
3547
|
+
result[item.id] = get$1(item, _labelProperty, item.id);
|
|
3548
|
+
return result;
|
|
3549
|
+
}, {});
|
|
3550
|
+
setValuesLabels(newValuesLabel);
|
|
3551
|
+
setIsLoadingData(false);
|
|
3552
|
+
}
|
|
3553
|
+
};
|
|
3554
|
+
|
|
3555
|
+
const renderTextItemOptionFn = item => {
|
|
3556
|
+
if (_renderTextItemOption) {
|
|
3557
|
+
return _renderTextItemOption(item);
|
|
3558
|
+
}
|
|
3559
|
+
|
|
3560
|
+
return item.title || item['@name'];
|
|
3561
|
+
};
|
|
3562
|
+
|
|
3563
|
+
React.useEffect(() => {
|
|
3564
|
+
if (!options.loading && !options.items && value.length > 0) {
|
|
3565
|
+
inicializeLabels();
|
|
3566
|
+
} else if (value.length === 0) {
|
|
3567
|
+
setValuesLabels({});
|
|
3568
|
+
}
|
|
3569
|
+
}, [_path, options.loading, options.items]);
|
|
3570
|
+
|
|
3571
|
+
if (isLoadingData || valuesLabel === undefined) {
|
|
3572
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
3573
|
+
className: "spinner"
|
|
3574
|
+
});
|
|
3575
|
+
}
|
|
3576
|
+
|
|
3577
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
3578
|
+
className: "tags mb-2"
|
|
3579
|
+
}, value.map((tag, index) => /*#__PURE__*/React.createElement("div", {
|
|
3580
|
+
key: `input_list_${tag}_${index}`,
|
|
3581
|
+
className: "tag is-info is-medium"
|
|
3582
|
+
}, get$1(valuesLabel, tag, tag), /*#__PURE__*/React.createElement("button", {
|
|
3583
|
+
className: "delete is-small",
|
|
3584
|
+
onClick: ev => {
|
|
3585
|
+
ev.stopPropagation();
|
|
3586
|
+
ev.preventDefault();
|
|
3587
|
+
onChange([...value.filter(tag => value.indexOf(tag) !== index)]);
|
|
3588
|
+
}
|
|
3589
|
+
})))), /*#__PURE__*/React.createElement("div", {
|
|
3590
|
+
"data-test": _dataTestWrapper,
|
|
3591
|
+
ref: wrapperRef,
|
|
3592
|
+
className: `dropdown mb-2 ${isOpen ? 'is-active' : ''}`,
|
|
3593
|
+
onBlur: ev => {
|
|
3594
|
+
if (!ev.currentTarget.contains(ev.relatedTarget)) {
|
|
3595
|
+
if (searchTerm !== '') {
|
|
3596
|
+
setSearchTerm('');
|
|
3597
|
+
setOptions(initialState$1);
|
|
3598
|
+
}
|
|
3599
|
+
|
|
3600
|
+
setIsOpen(false);
|
|
3601
|
+
}
|
|
3602
|
+
}
|
|
3603
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
3604
|
+
className: "dropdown-trigger"
|
|
3605
|
+
}, /*#__PURE__*/React.createElement("button", {
|
|
3606
|
+
className: `button ${_btnClass}`,
|
|
3607
|
+
onClick: ev => {
|
|
3608
|
+
ev.preventDefault();
|
|
3609
|
+
setIsOpen(!isOpen);
|
|
3610
|
+
|
|
3611
|
+
if (!options.loading && !options.items) {
|
|
3612
|
+
handleSearch(options.page);
|
|
3613
|
+
}
|
|
3614
|
+
},
|
|
3615
|
+
"aria-haspopup": "true",
|
|
3616
|
+
"aria-controls": "dropdown-menu"
|
|
3617
|
+
}, /*#__PURE__*/React.createElement("span", null, intl.formatMessage(genericMessages.choose)), /*#__PURE__*/React.createElement("span", {
|
|
3618
|
+
className: "icon"
|
|
3619
|
+
}, /*#__PURE__*/React.createElement("i", {
|
|
3620
|
+
className: "fas fa-angle-down",
|
|
3621
|
+
"aria-hidden": "true"
|
|
3622
|
+
})))), /*#__PURE__*/React.createElement("div", {
|
|
3623
|
+
className: "dropdown-menu",
|
|
3624
|
+
id: "dropdown-menu",
|
|
3625
|
+
role: "menu",
|
|
3626
|
+
style: getHeight()
|
|
3627
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
3628
|
+
className: "dropdown-content"
|
|
3629
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
3630
|
+
className: "dropdown-item"
|
|
3631
|
+
}, /*#__PURE__*/React.createElement("input", {
|
|
3632
|
+
ref: inputRef,
|
|
3633
|
+
"data-test": _dataTestSearchInput,
|
|
3634
|
+
className: "input",
|
|
3635
|
+
type: "text",
|
|
3636
|
+
placeholder: intl.formatMessage(genericMessages.search),
|
|
3637
|
+
value: searchTerm,
|
|
3638
|
+
onChange: ev => {
|
|
3639
|
+
delayedQuery(ev.target.value);
|
|
3640
|
+
setSearchTerm(ev.target.value);
|
|
3641
|
+
}
|
|
3642
|
+
})), /*#__PURE__*/React.createElement("hr", {
|
|
3643
|
+
className: "dropdown-divider"
|
|
3644
|
+
}), options.loading && /*#__PURE__*/React.createElement(Loading, null), options.items && options.items.map(item => {
|
|
3645
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
3646
|
+
className: `dropdown-item editable ${value && value.id === item.id ? 'is-active' : ''}`,
|
|
3647
|
+
"data-test": `${_dataTestItem}-${item.id}`,
|
|
3648
|
+
onMouseDown: ev => {
|
|
3649
|
+
ev.stopPropagation();
|
|
3650
|
+
ev.preventDefault();
|
|
3651
|
+
|
|
3652
|
+
if (onChange && !value.includes(item.id)) {
|
|
3653
|
+
setValuesLabels(_extends({}, valuesLabel, {
|
|
3654
|
+
[item.id]: get$1(item, _labelProperty, item.id)
|
|
3655
|
+
}));
|
|
3656
|
+
onChange([...value, item.id]);
|
|
3657
|
+
}
|
|
3658
|
+
},
|
|
3659
|
+
key: item.path
|
|
3660
|
+
}, renderTextItemOptionFn(item));
|
|
3661
|
+
}), options.items && options.items.length === 0 && /*#__PURE__*/React.createElement("div", {
|
|
3662
|
+
className: "dropdown-item"
|
|
3663
|
+
}, intl.formatMessage(genericMessages.no_results)), options.items && options.items_total > options.items.length && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("hr", {
|
|
3664
|
+
className: "dropdown-divider"
|
|
3665
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
3666
|
+
className: "dropdown-item editable",
|
|
3667
|
+
onMouseDown: ev => {
|
|
3668
|
+
ev.stopPropagation();
|
|
3669
|
+
ev.preventDefault();
|
|
3670
|
+
handleSearch(options.page + 1, true);
|
|
3671
|
+
}
|
|
3672
|
+
}, intl.formatMessage(genericMessages.load_more)))))), error && /*#__PURE__*/React.createElement(ErrorZone, {
|
|
3673
|
+
className: errorZoneClassName,
|
|
3674
|
+
id: uid
|
|
3675
|
+
}, error ? error : ''));
|
|
3676
|
+
};
|
|
3677
|
+
SearchInputList.propTypes = {
|
|
3678
|
+
onChange: PropTypes.func,
|
|
3679
|
+
path: PropTypes.string,
|
|
3680
|
+
btnClass: PropTypes.string,
|
|
3681
|
+
dataTestWrapper: PropTypes.string,
|
|
3682
|
+
dataTestSearchInput: PropTypes.string,
|
|
3683
|
+
dataTestItem: PropTypes.string,
|
|
3684
|
+
renderTextItemOption: PropTypes.func,
|
|
3685
|
+
typeNameQuery: PropTypes.string,
|
|
3686
|
+
labelProperty: PropTypes.string,
|
|
3687
|
+
error: PropTypes.string,
|
|
3688
|
+
errorZoneClassName: PropTypes.string,
|
|
3689
|
+
traversal: PropTypes.object,
|
|
3690
|
+
path: PropTypes.string,
|
|
3691
|
+
qs: PropTypes.array,
|
|
3692
|
+
queryCondition: PropTypes.string
|
|
3693
|
+
};
|
|
3694
|
+
|
|
3247
3695
|
const EditComponent = React.forwardRef((_ref, ref) => {
|
|
3248
3696
|
let {
|
|
3249
3697
|
schema,
|
|
@@ -3254,7 +3702,37 @@ const EditComponent = React.forwardRef((_ref, ref) => {
|
|
|
3254
3702
|
} = _ref,
|
|
3255
3703
|
rest = _objectWithoutPropertiesLoose(_ref, ["schema", "val", "setValue", "dataTest", "className"]);
|
|
3256
3704
|
|
|
3257
|
-
|
|
3705
|
+
const traversal = useTraversal();
|
|
3706
|
+
|
|
3707
|
+
if ((schema == null ? void 0 : schema.widget) === 'search_list') {
|
|
3708
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, rest.placeholder && /*#__PURE__*/React.createElement("label", {
|
|
3709
|
+
className: "label"
|
|
3710
|
+
}, rest.placeholder), /*#__PURE__*/React.createElement(SearchInputList, _extends({
|
|
3711
|
+
value: val || [],
|
|
3712
|
+
traversal: traversal,
|
|
3713
|
+
className: className,
|
|
3714
|
+
onChange: ev => setValue(ev),
|
|
3715
|
+
queryCondition: schema != null && schema.queryCondition ? schema.queryCondition : 'title__in',
|
|
3716
|
+
dataTest: dataTest,
|
|
3717
|
+
path: schema.queryPath,
|
|
3718
|
+
labelProperty: schema != null && schema.labelProperty ? schema.labelProperty : 'title',
|
|
3719
|
+
typeNameQuery: schema != null && schema.typeNameQuery ? schema.typeNameQuery : null
|
|
3720
|
+
}, rest)));
|
|
3721
|
+
} else if ((schema == null ? void 0 : schema.widget) === 'search') {
|
|
3722
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, rest.placeholder && /*#__PURE__*/React.createElement("label", {
|
|
3723
|
+
className: "label"
|
|
3724
|
+
}, rest.placeholder), /*#__PURE__*/React.createElement(SearchInput, _extends({
|
|
3725
|
+
value: val,
|
|
3726
|
+
traversal: traversal,
|
|
3727
|
+
className: className,
|
|
3728
|
+
onChange: ev => setValue(ev),
|
|
3729
|
+
queryCondition: schema != null && schema.queryCondition ? schema.queryCondition : 'title__in',
|
|
3730
|
+
dataTest: dataTest,
|
|
3731
|
+
path: schema.queryPath,
|
|
3732
|
+
labelProperty: schema != null && schema.labelProperty ? schema.labelProperty : 'title',
|
|
3733
|
+
typeNameQuery: schema != null && schema.typeNameQuery ? schema.typeNameQuery : null
|
|
3734
|
+
}, rest)));
|
|
3735
|
+
} else if ((schema == null ? void 0 : schema.widget) === 'textarea' || (schema == null ? void 0 : schema.widget) === 'richtext') {
|
|
3258
3736
|
return /*#__PURE__*/React.createElement(Textarea, _extends({
|
|
3259
3737
|
value: val || '',
|
|
3260
3738
|
className: className,
|
|
@@ -3376,14 +3854,18 @@ function IAttachment({
|
|
|
3376
3854
|
properties,
|
|
3377
3855
|
values
|
|
3378
3856
|
}) {
|
|
3857
|
+
const intl = useIntl();
|
|
3379
3858
|
const Ctx = useTraversal();
|
|
3380
3859
|
const modifyContent = Ctx.hasPerm('guillotina.ModifyContent');
|
|
3381
3860
|
return /*#__PURE__*/React.createElement(Table, {
|
|
3382
|
-
headers: [
|
|
3861
|
+
headers: [intl.formatMessage(genericMessages.property), intl.formatMessage(genericMessages.value)],
|
|
3383
3862
|
className: "is-striped is-fullwidth is-size-7"
|
|
3384
3863
|
}, Object.keys(properties).map(key => /*#__PURE__*/React.createElement("tr", {
|
|
3385
3864
|
key: 'attachment_' + key
|
|
3386
3865
|
}, /*#__PURE__*/React.createElement("td", {
|
|
3866
|
+
style: {
|
|
3867
|
+
width: '150px'
|
|
3868
|
+
},
|
|
3387
3869
|
key: 1
|
|
3388
3870
|
}, key), /*#__PURE__*/React.createElement("td", {
|
|
3389
3871
|
key: 2
|
|
@@ -3455,7 +3937,7 @@ function IMultiAttachment({
|
|
|
3455
3937
|
};
|
|
3456
3938
|
|
|
3457
3939
|
return /*#__PURE__*/React.createElement(Table, {
|
|
3458
|
-
headers: [
|
|
3940
|
+
headers: [intl.formatMessage(genericMessages.property), intl.formatMessage(genericMessages.value)],
|
|
3459
3941
|
className: "is-striped is-fullwidth is-size-7"
|
|
3460
3942
|
}, fileKeyToDelete && /*#__PURE__*/React.createElement(Confirm, {
|
|
3461
3943
|
loading: loading,
|
|
@@ -3467,7 +3949,10 @@ function IMultiAttachment({
|
|
|
3467
3949
|
}), Object.keys(values['files']).map(key => /*#__PURE__*/React.createElement("tr", {
|
|
3468
3950
|
key: 'multiattachment_' + key
|
|
3469
3951
|
}, /*#__PURE__*/React.createElement("td", {
|
|
3470
|
-
key: 1
|
|
3952
|
+
key: 1,
|
|
3953
|
+
style: {
|
|
3954
|
+
width: '150px'
|
|
3955
|
+
}
|
|
3471
3956
|
}, key), /*#__PURE__*/React.createElement("td", {
|
|
3472
3957
|
key: 2
|
|
3473
3958
|
}, /*#__PURE__*/React.createElement("div", {
|
|
@@ -3589,7 +4074,7 @@ function IImageAttachment({
|
|
|
3589
4074
|
};
|
|
3590
4075
|
|
|
3591
4076
|
return /*#__PURE__*/React.createElement(Table, {
|
|
3592
|
-
headers: [
|
|
4077
|
+
headers: [intl.formatMessage(genericMessages.property), intl.formatMessage(genericMessages.value)],
|
|
3593
4078
|
className: "is-striped is-fullwidth is-size-7"
|
|
3594
4079
|
}, showConfirmToDelete && /*#__PURE__*/React.createElement(Confirm, {
|
|
3595
4080
|
loading: loading,
|
|
@@ -3597,7 +4082,10 @@ function IImageAttachment({
|
|
|
3597
4082
|
onConfirm: () => deleteFile(),
|
|
3598
4083
|
message: intl.formatMessage(genericFileMessages.confirm_message_delete_image)
|
|
3599
4084
|
}), values['image'] && /*#__PURE__*/React.createElement("tr", null, /*#__PURE__*/React.createElement("td", {
|
|
3600
|
-
key: 1
|
|
4085
|
+
key: 1,
|
|
4086
|
+
style: {
|
|
4087
|
+
width: '150px'
|
|
4088
|
+
}
|
|
3601
4089
|
}, intl.formatMessage(genericMessages.image)), /*#__PURE__*/React.createElement("td", {
|
|
3602
4090
|
key: 2
|
|
3603
4091
|
}, /*#__PURE__*/React.createElement("div", {
|
|
@@ -3720,7 +4208,7 @@ function IMultiImageAttachment({
|
|
|
3720
4208
|
};
|
|
3721
4209
|
|
|
3722
4210
|
return /*#__PURE__*/React.createElement(Table, {
|
|
3723
|
-
headers: [
|
|
4211
|
+
headers: [intl.formatMessage(genericMessages.property), intl.formatMessage(genericMessages.value)],
|
|
3724
4212
|
className: "is-striped is-fullwidth is-size-7"
|
|
3725
4213
|
}, fileKeyToDelete && /*#__PURE__*/React.createElement(Confirm, {
|
|
3726
4214
|
loading: loading,
|
|
@@ -3732,7 +4220,10 @@ function IMultiImageAttachment({
|
|
|
3732
4220
|
}), Object.keys(values['images']).map(key => /*#__PURE__*/React.createElement("tr", {
|
|
3733
4221
|
key: `multiimageattachment_${key}`
|
|
3734
4222
|
}, /*#__PURE__*/React.createElement("td", {
|
|
3735
|
-
key: 1
|
|
4223
|
+
key: 1,
|
|
4224
|
+
style: {
|
|
4225
|
+
width: '150px'
|
|
4226
|
+
}
|
|
3736
4227
|
}, key), /*#__PURE__*/React.createElement("td", {
|
|
3737
4228
|
key: 2
|
|
3738
4229
|
}, /*#__PURE__*/React.createElement("div", {
|
|
@@ -4845,7 +5336,7 @@ function SearchVocabularyLabels(props) {
|
|
|
4845
5336
|
return null;
|
|
4846
5337
|
}
|
|
4847
5338
|
|
|
4848
|
-
const initialState$
|
|
5339
|
+
const initialState$2 = {
|
|
4849
5340
|
page: 0,
|
|
4850
5341
|
items: [],
|
|
4851
5342
|
loading: true,
|
|
@@ -4859,7 +5350,7 @@ function PanelItems() {
|
|
|
4859
5350
|
} = useConfig();
|
|
4860
5351
|
const intl = useIntl();
|
|
4861
5352
|
const Ctx = useTraversal();
|
|
4862
|
-
const [state, setState] = useSetState(initialState$
|
|
5353
|
+
const [state, setState] = useSetState(initialState$2);
|
|
4863
5354
|
const {
|
|
4864
5355
|
items,
|
|
4865
5356
|
loading,
|
|
@@ -5280,7 +5771,7 @@ function PanelProperties() {
|
|
|
5280
5771
|
icon: model.icon,
|
|
5281
5772
|
align: "is-left",
|
|
5282
5773
|
className: "has-text-grey"
|
|
5283
|
-
}),
|
|
5774
|
+
}), "\xA0", /*#__PURE__*/React.createElement("span", null, Ctx.context.title || Ctx.context['@name']))), /*#__PURE__*/React.createElement("div", {
|
|
5284
5775
|
className: "level-right"
|
|
5285
5776
|
}, /*#__PURE__*/React.createElement(PropertiesButtonView, null))), /*#__PURE__*/React.createElement("hr", null), schema && schema.data && !schema.loading && /*#__PURE__*/React.createElement("div", {
|
|
5286
5777
|
className: "columns"
|
|
@@ -5289,18 +5780,28 @@ function PanelProperties() {
|
|
|
5289
5780
|
}, /*#__PURE__*/React.createElement("table", {
|
|
5290
5781
|
className: "table is-striped is-fullwidth is-size-7"
|
|
5291
5782
|
}, /*#__PURE__*/React.createElement("thead", null, /*#__PURE__*/React.createElement("tr", null, /*#__PURE__*/React.createElement("th", {
|
|
5783
|
+
style: {
|
|
5784
|
+
width: '150px'
|
|
5785
|
+
},
|
|
5292
5786
|
className: "is-2"
|
|
5293
5787
|
}, intl.formatMessage(genericMessages.property)), /*#__PURE__*/React.createElement("th", {
|
|
5294
5788
|
className: "is-8"
|
|
5295
5789
|
}, intl.formatMessage(genericMessages.value)))), /*#__PURE__*/React.createElement("tbody", null, showProperties.map(prop => /*#__PURE__*/React.createElement("tr", {
|
|
5296
5790
|
key: 'prop' + prop
|
|
5297
|
-
}, /*#__PURE__*/React.createElement("td",
|
|
5791
|
+
}, /*#__PURE__*/React.createElement("td", {
|
|
5792
|
+
style: {
|
|
5793
|
+
width: '150px'
|
|
5794
|
+
}
|
|
5795
|
+
}, prop), /*#__PURE__*/React.createElement("td", null, /*#__PURE__*/React.createElement(EditableField, {
|
|
5298
5796
|
field: prop,
|
|
5299
5797
|
value: Ctx.context[prop],
|
|
5300
5798
|
modifyContent: false
|
|
5301
5799
|
})))))), properties.length > 0 && /*#__PURE__*/React.createElement("table", {
|
|
5302
5800
|
className: "table is-striped is-fullwidth is-size-7"
|
|
5303
5801
|
}, /*#__PURE__*/React.createElement("thead", null, /*#__PURE__*/React.createElement("tr", null, /*#__PURE__*/React.createElement("th", {
|
|
5802
|
+
style: {
|
|
5803
|
+
width: '150px'
|
|
5804
|
+
},
|
|
5304
5805
|
className: "is-2"
|
|
5305
5806
|
}, intl.formatMessage(genericMessages.property)), /*#__PURE__*/React.createElement("th", {
|
|
5306
5807
|
className: "is-8"
|
|
@@ -5310,7 +5811,11 @@ function PanelProperties() {
|
|
|
5310
5811
|
}) => {
|
|
5311
5812
|
return /*#__PURE__*/React.createElement("tr", {
|
|
5312
5813
|
key: 'prop' + key
|
|
5313
|
-
}, /*#__PURE__*/React.createElement("td",
|
|
5814
|
+
}, /*#__PURE__*/React.createElement("td", {
|
|
5815
|
+
style: {
|
|
5816
|
+
width: '150px'
|
|
5817
|
+
}
|
|
5818
|
+
}, value.title || key), /*#__PURE__*/React.createElement("td", null, /*#__PURE__*/React.createElement(EditableField, {
|
|
5314
5819
|
field: key,
|
|
5315
5820
|
value: Ctx.context[key],
|
|
5316
5821
|
schema: value,
|
|
@@ -5938,12 +6443,12 @@ function TagsWidget({
|
|
|
5938
6443
|
|
|
5939
6444
|
/* eslint jsx-a11y/anchor-is-valid: "off" */
|
|
5940
6445
|
|
|
5941
|
-
const initialState$
|
|
6446
|
+
const initialState$3 = {
|
|
5942
6447
|
types: undefined
|
|
5943
6448
|
};
|
|
5944
6449
|
function CreateButton() {
|
|
5945
6450
|
const intl = useIntl();
|
|
5946
|
-
const [state, setState] = useSetState(initialState$
|
|
6451
|
+
const [state, setState] = useSetState(initialState$3);
|
|
5947
6452
|
const Ctx = useTraversal();
|
|
5948
6453
|
const Config = useConfig();
|
|
5949
6454
|
useEffect(() => {
|
|
@@ -6002,7 +6507,7 @@ function ContextToolbar(_ref) {
|
|
|
6002
6507
|
props = _objectWithoutPropertiesLoose(_ref, ["AddButton"]);
|
|
6003
6508
|
|
|
6004
6509
|
const intl = useIntl();
|
|
6005
|
-
const [state, setState] = useSetState(initialState$
|
|
6510
|
+
const [state, setState] = useSetState(initialState$3);
|
|
6006
6511
|
const [location, setLocation, del] = useLocation();
|
|
6007
6512
|
const traversal = useTraversal();
|
|
6008
6513
|
const Config = useConfig();
|
|
@@ -7055,14 +7560,18 @@ function IDublinCore({
|
|
|
7055
7560
|
properties,
|
|
7056
7561
|
values
|
|
7057
7562
|
}) {
|
|
7563
|
+
const intl = useIntl();
|
|
7058
7564
|
const Ctx = useTraversal();
|
|
7059
7565
|
const modifyContent = Ctx.hasPerm('guillotina.ModifyContent');
|
|
7060
7566
|
return /*#__PURE__*/React.createElement(Table, {
|
|
7061
|
-
headers: [
|
|
7567
|
+
headers: [intl.formatMessage(genericMessages.property), intl.formatMessage(genericMessages.value)],
|
|
7062
7568
|
className: "is-striped is-fullwidth is-size-7"
|
|
7063
7569
|
}, Object.keys(properties).map(key => /*#__PURE__*/React.createElement("tr", {
|
|
7064
7570
|
key: 'dublin_' + key
|
|
7065
7571
|
}, /*#__PURE__*/React.createElement("td", {
|
|
7572
|
+
style: {
|
|
7573
|
+
width: '150px'
|
|
7574
|
+
},
|
|
7066
7575
|
key: 1
|
|
7067
7576
|
}, key), /*#__PURE__*/React.createElement("td", {
|
|
7068
7577
|
key: 2
|
|
@@ -7233,12 +7742,12 @@ function GroupCtx() {
|
|
|
7233
7742
|
}), errorMessage);
|
|
7234
7743
|
};
|
|
7235
7744
|
|
|
7236
|
-
const addUser = async
|
|
7745
|
+
const addUser = async newUserId => {
|
|
7237
7746
|
const data = {};
|
|
7238
7747
|
Ctx.context.users.forEach(user => {
|
|
7239
7748
|
data[user] = true;
|
|
7240
7749
|
});
|
|
7241
|
-
data[
|
|
7750
|
+
data[newUserId] = true;
|
|
7242
7751
|
const {
|
|
7243
7752
|
isError,
|
|
7244
7753
|
errorMessage
|
|
@@ -7258,7 +7767,7 @@ function GroupCtx() {
|
|
|
7258
7767
|
"value": " added to group"
|
|
7259
7768
|
}]
|
|
7260
7769
|
}, {
|
|
7261
|
-
user:
|
|
7770
|
+
user: newUserId
|
|
7262
7771
|
}), errorMessage);
|
|
7263
7772
|
};
|
|
7264
7773
|
|
|
@@ -7691,7 +8200,7 @@ const registry = {
|
|
|
7691
8200
|
|
|
7692
8201
|
*/
|
|
7693
8202
|
|
|
7694
|
-
const initialState$
|
|
8203
|
+
const initialState$4 = {
|
|
7695
8204
|
path: '',
|
|
7696
8205
|
loading: false,
|
|
7697
8206
|
context: undefined,
|
|
@@ -10593,10 +11102,10 @@ function Guillotina(_ref) {
|
|
|
10593
11102
|
const searchPath = location.get('path') || '/';
|
|
10594
11103
|
|
|
10595
11104
|
if (searchPath && searchPath !== '') {
|
|
10596
|
-
initialState$
|
|
11105
|
+
initialState$4.path = searchPath;
|
|
10597
11106
|
}
|
|
10598
11107
|
|
|
10599
|
-
const [state, dispatch] = useReducer(guillotinaReducer, initialState$
|
|
11108
|
+
const [state, dispatch] = useReducer(guillotinaReducer, initialState$4);
|
|
10600
11109
|
const {
|
|
10601
11110
|
path,
|
|
10602
11111
|
refresh
|
|
@@ -10742,7 +11251,7 @@ const ERRORS = {
|
|
|
10742
11251
|
failed_to_fetch: 'Failed to fetch data: Backend not running?',
|
|
10743
11252
|
invalid_credentials: 'Failed! Invalid credentials'
|
|
10744
11253
|
};
|
|
10745
|
-
const initialState$
|
|
11254
|
+
const initialState$5 = {
|
|
10746
11255
|
username: '',
|
|
10747
11256
|
password: '',
|
|
10748
11257
|
loading: undefined,
|
|
@@ -10755,7 +11264,7 @@ const Login = ({
|
|
|
10755
11264
|
auth,
|
|
10756
11265
|
onLogin
|
|
10757
11266
|
}) => {
|
|
10758
|
-
const [state, setState] = useSetState(initialState$
|
|
11267
|
+
const [state, setState] = useSetState(initialState$5);
|
|
10759
11268
|
const inputRef = useRef(null);
|
|
10760
11269
|
useEffect(() => {
|
|
10761
11270
|
if (inputRef) {
|
|
@@ -11128,5 +11637,5 @@ class Auth {
|
|
|
11128
11637
|
|
|
11129
11638
|
}
|
|
11130
11639
|
|
|
11131
|
-
export { AddItem, AddPermission, AllItemsCheckbox, ApplicationCtx, Auth, AuthContext, BaseForm, BehaviorNotImplemented, BehaviorsView, Button, Checkbox, ClientContext, ClientProvider, Config, Confirm, ContainerCtx, ContextToolbar, CreateButton, CreateContainer, DatabaseCtx, Delete, DownloadField, EditComponent, EditableField, EmailInput, FileUpload, Flash, FolderCtx, Form, FormBuilder, GroupCtx, GroupToolbar, GroupsCtx, Guillotina, GuillotinaClient, IAttachment, IImageAttachment, IMultiAttachment, IMultiImageAttachment, IMultiImageOrderedAttachment, IWorkflow, Icon, Input, InputList, Item, ItemCheckbox, ItemCtx, ItemModel, ItemTitle, ItemsActionsDropdown, ItemsActionsProvider, Layout, Link, Loading, Login, Modal, NotAllowed, Notification, Pagination, PanelActions, PanelAddons, PanelBehaviors, PanelItems, PanelNotImplemented, PanelPermissions, PanelProperties, PasswordInput, Path, PathTree, PermissionPrinperm, PermissionPrinrole, PermissionRoleperm, Permissions, PropertiesButtonView, PropertiesView, REGEX_EMAIL, REGEX_HEX_COLOR, REGEX_NUMBER, REGEX_URL, RItem, RemoveItems, RenderField, RenderFieldComponent, RequiredFieldsForm, RestClient, SearchInput, SearchLabels, SearchOptionsLabels, SearchVocabularyLabels, Select, Sharing, Table, TabsPanel, Tag, TagsWidget, TdLink, Textarea, TraversalContext, TraversalProvider, UserCtx, UserForm, UsersCtx, UsersToolbar, VocabularyRenderField, base64ToArrayBuffer, buildQs, classnames, defaultComponent, formatDate, generateUID, get$1 as get, getActionsObject, getClient, getNewId, isEmail, isEmpty, isHexColor, isNumber, isURL, lightFileReader, maxLength, messages$4 as messages, minLength, noop, notEmpty, parser, sleep, stringToSlug, toQueryString, useConfig, useCrudContext, useGuillotinaClient, useLocation, useRegistry, useRemoteField, useTraversal, useVocabulary };
|
|
11640
|
+
export { AddItem, AddPermission, AllItemsCheckbox, ApplicationCtx, Auth, AuthContext, BaseForm, BehaviorNotImplemented, BehaviorsView, Button, Checkbox, ClientContext, ClientProvider, Config, Confirm, ContainerCtx, ContextToolbar, CreateButton, CreateContainer, DatabaseCtx, Delete, DownloadField, EditComponent, EditableField, EmailInput, FileUpload, Flash, FolderCtx, Form, FormBuilder, GroupCtx, GroupToolbar, GroupsCtx, Guillotina, GuillotinaClient, IAttachment, IImageAttachment, IMultiAttachment, IMultiImageAttachment, IMultiImageOrderedAttachment, IWorkflow, Icon, Input, InputList, Item, ItemCheckbox, ItemCtx, ItemModel, ItemTitle, ItemsActionsDropdown, ItemsActionsProvider, Layout, Link, Loading, Login, Modal, NotAllowed, Notification, Pagination, PanelActions, PanelAddons, PanelBehaviors, PanelItems, PanelNotImplemented, PanelPermissions, PanelProperties, PasswordInput, Path, PathTree, PermissionPrinperm, PermissionPrinrole, PermissionRoleperm, Permissions, PropertiesButtonView, PropertiesView, REGEX_EMAIL, REGEX_HEX_COLOR, REGEX_NUMBER, REGEX_URL, RItem, RemoveItems, RenderField, RenderFieldComponent, RequiredFieldsForm, RestClient, SearchInput, SearchLabels, SearchOptionsLabels, SearchRenderField, SearchVocabularyLabels, Select, Sharing, Table, TabsPanel, Tag, TagsWidget, TdLink, Textarea, TraversalContext, TraversalProvider, UserCtx, UserForm, UsersCtx, UsersToolbar, VocabularyRenderField, base64ToArrayBuffer, buildQs, classnames, defaultComponent, formatDate, generateUID, get$1 as get, getActionsObject, getClient, getNewId, isEmail, isEmpty, isHexColor, isNumber, isURL, lightFileReader, maxLength, messages$4 as messages, minLength, noop, notEmpty, parser, sleep, stringToSlug, toQueryString, useConfig, useCrudContext, useGuillotinaClient, useLocation, useRegistry, useRemoteField, useTraversal, useVocabulary };
|
|
11132
11641
|
//# sourceMappingURL=react-gmi.modern.js.map
|