@guillotinaweb/react-gmi 0.28.3 → 0.28.4

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.
@@ -1621,6 +1621,129 @@ const Select = forwardRef(({
1621
1621
  });
1622
1622
  Select.displayName = 'Select';
1623
1623
 
1624
+ const formatDate = str => {
1625
+ const d = new Date(str);
1626
+ const minutes = d.getMinutes() < 10 ? `0${d.getMinutes()}` : d.getMinutes();
1627
+ return `${d.getDate()}/${d.getMonth() + 1}/${d.getFullYear()} ${d.getHours()}:${minutes}`;
1628
+ };
1629
+ const get$1 = (obj, path, defValue) => {
1630
+ var _pathArray$reduce;
1631
+
1632
+ if (!path) return undefined;
1633
+ const pathArray = Array.isArray(path) ? path : path.match(/([^[.\]])+/g);
1634
+ return (_pathArray$reduce = pathArray.reduce((prevObj, key) => prevObj && prevObj[key], obj)) != null ? _pathArray$reduce : defValue;
1635
+ };
1636
+ function getNewId(id = '') {
1637
+ const suffix = '-copy-';
1638
+ const rgx = new RegExp(`($|${suffix}\\d*)`);
1639
+ return stringToSlug(id).replace(rgx, r => {
1640
+ const num = parseInt(r.replace(suffix, '') || '0');
1641
+ return `${suffix}${num + 1}`;
1642
+ });
1643
+ }
1644
+
1645
+ function useVocabulary(vocabularyName, path = null) {
1646
+ const traversal = useTraversal();
1647
+ const [vocabulary, setVocabulary] = useSetState({
1648
+ data: undefined,
1649
+ loading: false,
1650
+ error: undefined
1651
+ });
1652
+
1653
+ const getPath = () => {
1654
+ if (path) return path;
1655
+ return `${traversal.path}@vocabularies/${vocabularyName}`;
1656
+ };
1657
+
1658
+ useEffect(() => {
1659
+ const getVocabulary = async () => {
1660
+ if (vocabularyName && vocabulary.data === undefined && !vocabulary.loading) {
1661
+ try {
1662
+ setVocabulary({
1663
+ loading: true
1664
+ });
1665
+ const data = await traversal.client.get(getPath());
1666
+ const dataJson = await data.json();
1667
+ setVocabulary({
1668
+ loading: false,
1669
+ data: dataJson
1670
+ });
1671
+ } catch (err) {
1672
+ setVocabulary({
1673
+ loading: false,
1674
+ error: err,
1675
+ data: undefined
1676
+ });
1677
+ }
1678
+ }
1679
+ };
1680
+
1681
+ getVocabulary();
1682
+ }, [vocabularyName, vocabulary, path]);
1683
+ return vocabulary;
1684
+ }
1685
+
1686
+ const SelectVocabulary = forwardRef(({
1687
+ vocabularyName,
1688
+ className,
1689
+ classWrap,
1690
+ val,
1691
+ dataTest,
1692
+ multiple,
1693
+ onChange,
1694
+ id,
1695
+ placeholder
1696
+ }, ref) => {
1697
+ const vocabulary = useVocabulary(vocabularyName);
1698
+
1699
+ const getOptions = () => {
1700
+ if (get$1(vocabulary, 'data.items', null)) {
1701
+ const vocData = vocabulary.data.items.map(item => {
1702
+ return {
1703
+ text: item.title,
1704
+ value: item.token
1705
+ };
1706
+ });
1707
+ return vocData;
1708
+ }
1709
+
1710
+ return [];
1711
+ };
1712
+
1713
+ const getProps = () => {
1714
+ if (multiple) {
1715
+ const currentValue = val || [];
1716
+ return {
1717
+ multiple: true,
1718
+ size: 5,
1719
+ value: currentValue,
1720
+ options: getOptions()
1721
+ };
1722
+ }
1723
+
1724
+ return {
1725
+ value: val != null ? val : '',
1726
+ appendDefault: true,
1727
+ options: getOptions()
1728
+ };
1729
+ };
1730
+
1731
+ if (vocabulary.data === undefined || vocabulary.loading) {
1732
+ return jsx("div", {});
1733
+ }
1734
+
1735
+ return jsx(Select, _extends({}, getProps(), {
1736
+ className: className,
1737
+ classWrap: classWrap || 'is-fullwidth',
1738
+ dataTest: dataTest,
1739
+ ref: ref,
1740
+ onChange: onChange,
1741
+ id: id,
1742
+ placeholder: placeholder
1743
+ }));
1744
+ });
1745
+ SelectVocabulary.displayName = 'SelectVocabulary';
1746
+
1624
1747
  const setURLParams = p => {
1625
1748
  return window.history.pushState(0, '0', '' + '?' + p.toString().replace(/%2F/g, '/'));
1626
1749
  };
@@ -2431,27 +2554,6 @@ function useClickAway(ref, onClickAway, events = defaultEvents) {
2431
2554
  }, [events, ref]);
2432
2555
  }
2433
2556
 
2434
- const formatDate = str => {
2435
- const d = new Date(str);
2436
- const minutes = d.getMinutes() < 10 ? `0${d.getMinutes()}` : d.getMinutes();
2437
- return `${d.getDate()}/${d.getMonth() + 1}/${d.getFullYear()} ${d.getHours()}:${minutes}`;
2438
- };
2439
- const get$1 = (obj, path, defValue) => {
2440
- var _pathArray$reduce;
2441
-
2442
- if (!path) return undefined;
2443
- const pathArray = Array.isArray(path) ? path : path.match(/([^[.\]])+/g);
2444
- return (_pathArray$reduce = pathArray.reduce((prevObj, key) => prevObj && prevObj[key], obj)) != null ? _pathArray$reduce : defValue;
2445
- };
2446
- function getNewId(id = '') {
2447
- const suffix = '-copy-';
2448
- const rgx = new RegExp(`($|${suffix}\\d*)`);
2449
- return stringToSlug(id).replace(rgx, r => {
2450
- const num = parseInt(r.replace(suffix, '') || '0');
2451
- return `${suffix}${num + 1}`;
2452
- });
2453
- }
2454
-
2455
2557
  function debounce(func, wait) {
2456
2558
  let timeout;
2457
2559
  return function () {
@@ -2733,987 +2835,885 @@ const SearchInput = ({
2733
2835
  });
2734
2836
  };
2735
2837
 
2736
- const InputList = forwardRef(({
2737
- value,
2838
+ function debounce$1(func, wait) {
2839
+ let timeout;
2840
+ return function () {
2841
+ const context = this;
2842
+ const args = arguments;
2843
+
2844
+ const later = function later() {
2845
+ timeout = null;
2846
+ func.apply(context, args);
2847
+ };
2848
+
2849
+ clearTimeout(timeout);
2850
+ timeout = setTimeout(later, wait);
2851
+ };
2852
+ }
2853
+
2854
+ const initialState$1 = {
2855
+ page: 0,
2856
+ items: undefined,
2857
+ loading: false,
2858
+ items_total: 0
2859
+ };
2860
+ const SearchInputList = ({
2738
2861
  onChange,
2739
- dataTest,
2740
- id
2741
- }, ref) => {
2862
+ error,
2863
+ errorZoneClassName,
2864
+ traversal: _traversal = null,
2865
+ path: _path = null,
2866
+ qs: _qs = [],
2867
+ queryCondition: _queryCondition = 'id__in',
2868
+ value,
2869
+ btnClass: _btnClass = '',
2870
+ dataTestWrapper: _dataTestWrapper = 'wrapperSearchInputTest',
2871
+ dataTestSearchInput: _dataTestSearchInput = 'searchInputTest',
2872
+ dataTestItem: _dataTestItem = 'searchInputItemTest',
2873
+ renderTextItemOption: _renderTextItemOption = null,
2874
+ typeNameQuery: _typeNameQuery = null,
2875
+ labelProperty: _labelProperty = 'id'
2876
+ }) => {
2742
2877
  const intl = useIntl();
2743
- const [inputValue, setInputValue] = useState('');
2878
+ const [options, setOptions] = useSetState(initialState$1);
2879
+ const [valuesLabel, setValuesLabels] = useState(undefined);
2880
+ const [isOpen, setIsOpen] = useState(false);
2881
+ const [searchTerm, setSearchTerm] = useState('');
2882
+ const inputRef = useRef(null);
2883
+ const wrapperRef = useRef(null);
2884
+ const {
2885
+ PageSize,
2886
+ SearchEngine
2887
+ } = useConfig();
2888
+ const [isLoadingData, setIsLoadingData] = useState(false);
2889
+ const [uid] = useState(generateUID('search_input'));
2890
+ useClickAway(wrapperRef, () => {
2891
+ setIsOpen(false);
2892
+ });
2744
2893
 
2745
- const addTags = event => {
2746
- if (event.key === 'Enter' && event.target.value !== '') {
2747
- onChange([...value, event.target.value]);
2748
- setInputValue('');
2894
+ const getHeight = () => {
2895
+ if (wrapperRef && wrapperRef.current) {
2896
+ return {
2897
+ maxHeight: `${window.innerHeight - wrapperRef.current.getBoundingClientRect().top - 100}px`
2898
+ };
2749
2899
  }
2900
+
2901
+ return {
2902
+ maxHeight: 'auto'
2903
+ };
2750
2904
  };
2751
2905
 
2752
- return jsxs("div", {
2753
- className: "control",
2754
- children: [(value != null ? value : []).length > 0 && jsx("div", {
2755
- className: "tags",
2756
- children: value.map((tag, index) => jsxs("div", {
2757
- className: "tag is-info is-medium",
2758
- children: [tag, jsx("button", {
2759
- className: "delete is-small",
2760
- type: "button",
2761
- onClick: () => onChange([...value.filter(tag => value.indexOf(tag) !== index)])
2762
- })]
2763
- }, `input_list_${tag}_${index}`))
2764
- }), jsx(Input, {
2765
- type: "text",
2766
- id: id,
2767
- placeholder: intl.formatMessage({
2768
- id: "press_enter_to_add_value",
2769
- defaultMessage: [{
2770
- "type": 0,
2771
- "value": "Press enter to add value"
2772
- }]
2773
- }),
2774
- onKeyUp: event => addTags(event),
2775
- value: inputValue,
2776
- ref: ref,
2777
- dataTest: dataTest,
2778
- onChange: value => {
2779
- setInputValue(value);
2780
- }
2781
- })]
2782
- });
2783
- });
2784
- InputList.displayName = 'InputList';
2906
+ const delayedQuery = useCallback(debounce$1(value => handleSearch(0, false, value), 500), []);
2785
2907
 
2786
- function Dropdown({
2787
- children,
2788
- disabled,
2789
- id,
2790
- isRight,
2791
- onChange,
2792
- optionDisabledWhen,
2793
- options
2794
- }) {
2795
- const ref = useRef(null);
2796
- const [isActive, setIsActive] = useState(false);
2797
- const position = isRight ? 'is-right' : '';
2798
- const status = isActive ? `dropdown ${position} is-active` : `dropdown ${position}`;
2799
- useClickAway(ref, () => {
2800
- setIsActive(false);
2801
- });
2802
- return jsxs("div", {
2803
- ref: ref,
2804
- className: status,
2805
- children: [jsx("div", {
2806
- className: "dropdown-trigger",
2807
- children: jsx("button", {
2808
- className: "button is-size-7",
2809
- onClick: () => setIsActive(!isActive),
2810
- "aria-haspopup": "true",
2811
- disabled: disabled,
2812
- "aria-controls": id,
2813
- children: children
2814
- })
2815
- }), jsx("div", {
2816
- className: "dropdown-menu",
2817
- id: id,
2818
- role: "menu",
2819
- children: jsx("div", {
2820
- className: "dropdown-content",
2821
- children: options.map(option => {
2822
- const disabled = typeof optionDisabledWhen === 'function' ? optionDisabledWhen(option) : false;
2823
- return jsx("a", {
2824
- className: disabled ? 'dropdown-item is-active' : 'dropdown-item',
2825
- "data-test": `dropdownItemTest-${option.value.toLowerCase()}`,
2826
- onClick: disabled ? undefined : () => onChange(option.value),
2827
- style: disabled ? {
2828
- cursor: 'not-allowed',
2829
- color: 'black',
2830
- opacity: 0.5,
2831
- backgroundColor: '#eeeeee'
2832
- } : {},
2833
- children: option.text
2834
- }, option.text);
2835
- })
2836
- })
2837
- })]
2838
- });
2839
- }
2908
+ const handleSearch = async (page = 0, concat = false, value = '') => {
2909
+ var _data$items_total;
2840
2910
 
2841
- function EditableField({
2842
- field,
2843
- value,
2844
- ns,
2845
- schema = undefined,
2846
- modifyContent,
2847
- required
2848
- }) {
2849
- const intl = useIntl();
2850
- const ref = useRef();
2851
- const [isEdit, setEdit] = useState(false);
2852
- const [val, setValue] = useState(value);
2853
- const {
2854
- patch,
2855
- loading,
2856
- Ctx
2857
- } = useCrudContext();
2858
- const {
2859
- fieldHaveDeleteButton
2860
- } = useConfig();
2861
- const EditComponent = Ctx.registry.get('components', 'EditComponent');
2862
- const RenderFieldComponent = Ctx.registry.get('components', 'RenderFieldComponent');
2863
- useEffect(() => {
2864
- if (isEdit && ref.current) {
2865
- ref.current.focus();
2911
+ setOptions({
2912
+ loading: true
2913
+ });
2914
+ let searchTermQs = '';
2915
+ let searchTermParsed = [];
2916
+
2917
+ if (value !== '') {
2918
+ searchTermParsed = parser(`${_queryCondition}=${value}`);
2866
2919
  }
2867
- });
2868
- const canModified = modifyContent && !get$1(schema, 'readonly', false);
2869
2920
 
2870
- const saveField = async ev => {
2871
- if (ev) ev.preventDefault();
2921
+ const {
2922
+ get
2923
+ } = _traversal.registry;
2924
+ const fnName = get('searchEngineQueryParamsFunction', SearchEngine);
2872
2925
 
2873
- if (!field) {
2874
- Ctx.flash(intl.formatMessage(genericMessages.error_provide_key_name), 'danger');
2875
- return;
2926
+ const qsParsed = _traversal.client[fnName]({
2927
+ path: _traversal.path,
2928
+ start: page * PageSize,
2929
+ pageSize: PageSize,
2930
+ withDepth: false
2931
+ });
2932
+
2933
+ const sortParsed = parser(`_sort_des=${_labelProperty}`);
2934
+ let typeNameParsed = [];
2935
+
2936
+ if (_typeNameQuery) {
2937
+ typeNameParsed = parser(`type_name__in=${_typeNameQuery}`);
2876
2938
  }
2877
2939
 
2878
- if (!val && required) {
2879
- Ctx.flash(intl.formatMessage(genericMessages.mandatory_field, {
2880
- field
2881
- }), 'danger');
2882
- return;
2940
+ if (_qs.length > 0 || searchTermParsed.length > 0 || qsParsed.length > 0 || typeNameParsed.length > 0) {
2941
+ searchTermQs = buildQs([..._qs, ...searchTermParsed, ...qsParsed, ...typeNameParsed, ...sortParsed]);
2883
2942
  }
2884
2943
 
2885
- if ((schema == null ? void 0 : schema.widget) === 'file') {
2886
- const value = val;
2944
+ const data = await _traversal.client.search(_path ? _path : _traversal.client.getContainerFromPath(_traversal.path), searchTermQs, false, false);
2945
+ const newItems = options.items && concat ? [...options.items, ...data.items] : data.items;
2946
+ setOptions({
2947
+ items: newItems != null ? newItems : [],
2948
+ loading: false,
2949
+ items_total: (_data$items_total = data.items_total) != null ? _data$items_total : 0,
2950
+ page: page
2951
+ });
2952
+ };
2887
2953
 
2888
- if (value) {
2889
- value['filename'] = unescape(encodeURIComponent(value['filename']));
2890
- }
2954
+ const inicializeLabels = async () => {
2955
+ if (_labelProperty !== 'id' && value.length > 0) {
2956
+ setIsLoadingData(true);
2957
+ let searchTermQs = '';
2958
+ const searchTermParsed = ['__or', `id=${value.join('%26id=')}`];
2959
+ const {
2960
+ get: getSearch
2961
+ } = _traversal.registry;
2962
+ const fnName = getSearch('searchEngineQueryParamsFunction', SearchEngine);
2891
2963
 
2892
- const endpoint = `${Ctx.path}@upload/${field}`;
2893
- const req = await Ctx.client.upload(endpoint, value);
2964
+ const qsParsed = _traversal.client[fnName]({
2965
+ path: _traversal.path,
2966
+ start: 0,
2967
+ pageSize: 100,
2968
+ withDepth: false
2969
+ });
2894
2970
 
2895
- if (req.status !== 200) {
2896
- Ctx.flash(intl.formatMessage(genericFileMessages.error_upload_file), 'danger');
2897
- } else {
2898
- Ctx.flash(intl.formatMessage(genericFileMessages.file_uploaded), 'success');
2971
+ let typeNameParsed = [];
2972
+
2973
+ if (_typeNameQuery) {
2974
+ typeNameParsed = parser(`type_name__in=${_typeNameQuery}`);
2899
2975
  }
2900
- } else {
2901
- const data = ns ? {
2902
- [ns]: {
2903
- [field]: val
2904
- }
2905
- } : {
2906
- [field]: val
2907
- };
2908
- const dataPatch = await patch(data);
2909
2976
 
2910
- if (dataPatch.isError) {
2911
- Ctx.flash(intl.formatMessage(genericMessages.error_in_field, {
2912
- field
2913
- }), 'danger');
2914
- } else {
2915
- Ctx.flash(intl.formatMessage(genericMessages.field_updated, {
2916
- field
2917
- }), 'success');
2977
+ if (_qs.length > 0 || searchTermParsed.length > 0 || qsParsed.length > 0 || typeNameParsed.length > 0) {
2978
+ searchTermQs = buildQs([..._qs, searchTermParsed, ...qsParsed, ...typeNameParsed]);
2918
2979
  }
2919
- }
2920
2980
 
2921
- setEdit(false);
2922
- Ctx.refresh();
2981
+ const data = await _traversal.client.search(_path ? _path : _traversal.client.getContainerFromPath(_traversal.path), searchTermQs, false, false, 0, 100);
2982
+ const newValuesLabel = data.items.reduce((result, item) => {
2983
+ result[item.id] = get$1(item, _labelProperty, item.id);
2984
+ return result;
2985
+ }, {});
2986
+ setValuesLabels(newValuesLabel);
2987
+ setIsLoadingData(false);
2988
+ }
2923
2989
  };
2924
2990
 
2925
- const deleteField = async ev => {
2926
- if (ev) ev.preventDefault();
2927
-
2928
- if ((schema == null ? void 0 : schema.widget) === 'file') {
2929
- if (!field || !val && required) {
2930
- Ctx.flash(intl.formatMessage(genericMessages.can_not_delete_field, {
2931
- field
2932
- }), 'danger');
2933
- return;
2934
- }
2935
-
2936
- const data = ns ? {
2937
- [ns]: {
2938
- [field]: null
2939
- }
2940
- } : {
2941
- [field]: null
2942
- };
2943
- const dataPatch = await patch(data);
2991
+ const renderTextItemOptionFn = item => {
2992
+ if (_renderTextItemOption) {
2993
+ return _renderTextItemOption(item);
2994
+ }
2944
2995
 
2945
- if (dataPatch.isError) {
2946
- Ctx.flash(intl.formatMessage(genericMessages.error_in_field, {
2947
- field
2948
- }), 'danger');
2949
- } else {
2950
- Ctx.flash(intl.formatMessage(genericMessages.field_deleted, {
2951
- field
2952
- }), 'success');
2953
- }
2996
+ return get$1(item, _labelProperty, item.title) || item['@name'];
2997
+ };
2954
2998
 
2955
- setEdit(false);
2956
- Ctx.refresh();
2957
- } else if ((schema == null ? void 0 : schema.type) === 'string' && schema != null && schema.enum) {
2958
- setValue(null);
2959
- } else if ((schema == null ? void 0 : schema.type) === 'array' && (schema == null ? void 0 : schema.items.type) === 'string') {
2960
- setValue([]);
2999
+ useEffect(() => {
3000
+ if (!options.loading && !options.items && value.length > 0) {
3001
+ inicializeLabels();
3002
+ } else if (value.length === 0) {
3003
+ setValuesLabels({});
2961
3004
  }
2962
- };
3005
+ }, [_path, options.loading, options.items]);
3006
+
3007
+ if (isLoadingData || valuesLabel === undefined) {
3008
+ return jsx("div", {
3009
+ className: "spinner"
3010
+ });
3011
+ }
2963
3012
 
2964
3013
  return jsxs(Fragment, {
2965
- children: [!isEdit && jsxs("div", {
2966
- className: canModified ? 'editable' : '',
2967
- onClick: () => {
2968
- setEdit(!!canModified);
2969
- },
2970
- "data-test": `editableFieldTest-${field}`,
2971
- children: [jsx(RenderFieldComponent, {
2972
- schema: schema,
2973
- field: field,
2974
- val: val,
2975
- modifyContent: modifyContent
2976
- }), canModified && jsx(Icon, {
2977
- icon: "fas fa-edit"
2978
- })]
2979
- }), isEdit && jsxs("div", {
2980
- className: "field",
2981
- "data-test": `editableFieldTest-${field}`,
2982
- children: [jsx("div", {
2983
- className: "control",
2984
- children: jsx(EditComponent, {
2985
- ref: ref,
2986
- schema: schema,
2987
- val: val,
2988
- setValue: setValue,
2989
- dataTest: `editableFieldEditTest`
2990
- })
2991
- }), jsxs("div", {
2992
- className: "field is-grouped",
2993
- children: [jsx("div", {
2994
- className: "control",
2995
- children: jsx(Button, {
2996
- className: "is-small is-primary",
2997
- loading: loading,
2998
- onClick: saveField,
2999
- dataTest: "editableFieldBtnSaveTest",
3000
- children: intl.formatMessage(genericMessages.save)
3001
- })
3002
- }), jsx("div", {
3003
- className: "control",
3004
- children: jsx(Button, {
3005
- className: "is-small",
3006
- onClick: () => setEdit(false),
3007
- dataTest: "editableFieldBtnCancelTest",
3008
- children: intl.formatMessage(genericMessages.cancel)
3009
- })
3010
- }), !required && fieldHaveDeleteButton(schema) && jsx("div", {
3011
- className: "control",
3012
- children: jsx(Button, {
3013
- className: "is-small is-danger",
3014
- onClick: deleteField,
3015
- dataTest: "editableFieldBtnDeleteTest",
3016
- children: intl.formatMessage(genericMessages.delete)
3017
- })
3018
- })]
3019
- })]
3020
- })]
3021
- });
3022
- }
3023
-
3024
- const DownloadField = ({
3025
- value
3026
- }) => {
3027
- const intl = useIntl();
3028
- const Ctx = useTraversal();
3029
- const {
3030
- data,
3031
- field
3032
- } = value;
3033
-
3034
- const getField = async downloadFile => {
3035
- const endpoint = `${Ctx.path}@download/${field}`;
3036
- const res = await Ctx.client.download(endpoint);
3037
- const text = await res.blob();
3038
- const blob = new Blob([text], {
3039
- type: data.content_type
3040
- });
3041
- const url = window.URL.createObjectURL(blob);
3042
- const link = document.createElement('a');
3043
- link.href = url;
3044
-
3045
- if (downloadFile) {
3046
- link.setAttribute('download', `${data.filename}`);
3047
- } else {
3048
- link.setAttribute('target', `_blank`);
3049
- }
3050
-
3051
- document.body.appendChild(link);
3052
- link.click();
3053
- setTimeout(function () {
3054
- var _link$parentNode;
3055
-
3056
- window.URL.revokeObjectURL(url);
3057
- (_link$parentNode = link.parentNode) == null ? void 0 : _link$parentNode.removeChild(link);
3058
- }, 100);
3059
- };
3060
-
3061
- return jsxs("div", {
3062
- className: "field",
3063
3014
  children: [jsx("div", {
3064
- className: "label",
3065
- children: data.filename
3015
+ className: "tags mb-2",
3016
+ children: value.map((tag, index) => jsxs("div", {
3017
+ className: "tag is-info is-medium",
3018
+ children: [get$1(valuesLabel, tag, tag), jsx("button", {
3019
+ className: "delete is-small",
3020
+ onClick: ev => {
3021
+ ev.stopPropagation();
3022
+ ev.preventDefault();
3023
+ onChange([...value.filter(tag => value.indexOf(tag) !== index)]);
3024
+ }
3025
+ })]
3026
+ }, `input_list_${tag}_${index}`))
3066
3027
  }), jsxs("div", {
3067
- className: "columns",
3028
+ "data-test": _dataTestWrapper,
3029
+ ref: wrapperRef,
3030
+ className: `dropdown mb-2 ${isOpen ? 'is-active' : ''}`,
3031
+ onBlur: ev => {
3032
+ if (!ev.currentTarget.contains(ev.relatedTarget)) {
3033
+ if (searchTerm !== '') {
3034
+ setSearchTerm('');
3035
+ setOptions(initialState$1);
3036
+ }
3037
+
3038
+ setIsOpen(false);
3039
+ }
3040
+ },
3068
3041
  children: [jsx("div", {
3069
- className: "column",
3070
- children: jsx("button", {
3071
- className: "button is-small is-primary level-left",
3072
- onClick: async event => {
3073
- event.preventDefault();
3074
- event.stopPropagation();
3075
- getField(false);
3042
+ className: "dropdown-trigger",
3043
+ children: jsxs("button", {
3044
+ className: `button ${_btnClass}`,
3045
+ onClick: ev => {
3046
+ ev.preventDefault();
3047
+ setIsOpen(!isOpen);
3048
+
3049
+ if (!options.loading && !options.items) {
3050
+ handleSearch(options.page);
3051
+ }
3076
3052
  },
3077
- children: intl.formatMessage(genericMessages.open)
3053
+ "aria-haspopup": "true",
3054
+ "aria-controls": "dropdown-menu",
3055
+ children: [jsx("span", {
3056
+ children: intl.formatMessage(genericMessages.choose)
3057
+ }), jsx("span", {
3058
+ className: "icon",
3059
+ children: jsx("i", {
3060
+ className: "fas fa-angle-down",
3061
+ "aria-hidden": "true"
3062
+ })
3063
+ })]
3078
3064
  })
3079
3065
  }), jsx("div", {
3080
- className: "column",
3081
- children: jsx("button", {
3082
- className: "button is-small is-primary level-right",
3083
- onClick: async event => {
3084
- event.preventDefault();
3085
- event.stopPropagation();
3086
- getField(true);
3087
- },
3088
- children: intl.formatMessage(genericMessages.download)
3066
+ className: "dropdown-menu",
3067
+ id: "dropdown-menu",
3068
+ role: "menu",
3069
+ style: getHeight(),
3070
+ children: jsxs("div", {
3071
+ className: "dropdown-content",
3072
+ children: [jsx("div", {
3073
+ className: "dropdown-item",
3074
+ children: jsx("input", {
3075
+ ref: inputRef,
3076
+ "data-test": _dataTestSearchInput,
3077
+ className: "input",
3078
+ type: "text",
3079
+ placeholder: intl.formatMessage(genericMessages.search),
3080
+ value: searchTerm,
3081
+ onChange: ev => {
3082
+ delayedQuery(ev.target.value);
3083
+ setSearchTerm(ev.target.value);
3084
+ }
3085
+ })
3086
+ }), jsx("hr", {
3087
+ className: "dropdown-divider"
3088
+ }), options.loading && jsx(Loading, {}), options.items && options.items.map(item => {
3089
+ return jsx("div", {
3090
+ className: `dropdown-item editable ${value.includes(item.id) ? 'is-active' : ''}`,
3091
+ "data-test": `${_dataTestItem}-${item.id}`,
3092
+ onMouseDown: ev => {
3093
+ ev.stopPropagation();
3094
+ ev.preventDefault();
3095
+
3096
+ if (onChange && !value.includes(item.id)) {
3097
+ setValuesLabels(_extends({}, valuesLabel, {
3098
+ [item.id]: get$1(item, _labelProperty, item.id)
3099
+ }));
3100
+ onChange([...value, item.id]);
3101
+ }
3102
+ },
3103
+ children: renderTextItemOptionFn(item)
3104
+ }, item.path);
3105
+ }), options.items && options.items.length === 0 && jsx("div", {
3106
+ className: "dropdown-item",
3107
+ children: intl.formatMessage(genericMessages.no_results)
3108
+ }), options.items && options.items_total > options.items.length && jsxs(Fragment, {
3109
+ children: [jsx("hr", {
3110
+ className: "dropdown-divider"
3111
+ }), jsx("div", {
3112
+ className: "dropdown-item editable",
3113
+ onMouseDown: ev => {
3114
+ ev.stopPropagation();
3115
+ ev.preventDefault();
3116
+ handleSearch(options.page + 1, true);
3117
+ },
3118
+ children: intl.formatMessage(genericMessages.load_more)
3119
+ })]
3120
+ })]
3089
3121
  })
3090
3122
  })]
3123
+ }), error && jsx(ErrorZone, {
3124
+ className: errorZoneClassName,
3125
+ id: uid,
3126
+ children: error ? error : ''
3091
3127
  })]
3092
3128
  });
3093
3129
  };
3094
3130
 
3095
- function useVocabulary(vocabularyName, path = null) {
3096
- const traversal = useTraversal();
3097
- const [vocabulary, setVocabulary] = useSetState({
3098
- data: undefined,
3099
- loading: false,
3100
- error: undefined
3101
- });
3131
+ const InputList = forwardRef(({
3132
+ value,
3133
+ onChange,
3134
+ dataTest,
3135
+ id
3136
+ }, ref) => {
3137
+ const intl = useIntl();
3138
+ const [inputValue, setInputValue] = useState('');
3102
3139
 
3103
- const getPath = () => {
3104
- if (path) return path;
3105
- return `${traversal.path}@vocabularies/${vocabularyName}`;
3140
+ const addTags = event => {
3141
+ if (event.key === 'Enter' && event.target.value !== '') {
3142
+ onChange([...value, event.target.value]);
3143
+ setInputValue('');
3144
+ }
3106
3145
  };
3107
3146
 
3108
- useEffect(() => {
3109
- const getVocabulary = async () => {
3110
- if (vocabularyName && vocabulary.data === undefined && !vocabulary.loading) {
3111
- try {
3112
- setVocabulary({
3113
- loading: true
3114
- });
3115
- const data = await traversal.client.get(getPath());
3116
- const dataJson = await data.json();
3117
- setVocabulary({
3118
- loading: false,
3119
- data: dataJson
3120
- });
3121
- } catch (err) {
3122
- setVocabulary({
3123
- loading: false,
3124
- error: err,
3125
- data: undefined
3126
- });
3127
- }
3147
+ return jsxs("div", {
3148
+ className: "control",
3149
+ children: [(value != null ? value : []).length > 0 && jsx("div", {
3150
+ className: "tags",
3151
+ children: value.map((tag, index) => jsxs("div", {
3152
+ className: "tag is-info is-medium",
3153
+ children: [tag, jsx("button", {
3154
+ className: "delete is-small",
3155
+ type: "button",
3156
+ onClick: () => onChange([...value.filter(tag => value.indexOf(tag) !== index)])
3157
+ })]
3158
+ }, `input_list_${tag}_${index}`))
3159
+ }), jsx(Input, {
3160
+ type: "text",
3161
+ id: id,
3162
+ placeholder: intl.formatMessage({
3163
+ id: "press_enter_to_add_value",
3164
+ defaultMessage: [{
3165
+ "type": 0,
3166
+ "value": "Press enter to add value"
3167
+ }]
3168
+ }),
3169
+ onKeyUp: event => addTags(event),
3170
+ value: inputValue,
3171
+ ref: ref,
3172
+ dataTest: dataTest,
3173
+ onChange: value => {
3174
+ setInputValue(value);
3128
3175
  }
3129
- };
3130
-
3131
- getVocabulary();
3132
- }, [vocabularyName, vocabulary, path]);
3133
- return vocabulary;
3134
- }
3176
+ })]
3177
+ });
3178
+ });
3179
+ InputList.displayName = 'InputList';
3135
3180
 
3136
- const plain = ['string', 'number', 'boolean'];
3137
- function RenderField({
3138
- value,
3139
- Widget,
3140
- schema
3181
+ function Dropdown({
3182
+ children,
3183
+ disabled,
3184
+ id,
3185
+ isRight,
3186
+ onChange,
3187
+ optionDisabledWhen,
3188
+ options
3141
3189
  }) {
3142
- if (value === null || value === undefined) return '';
3143
-
3144
- if (Widget) {
3145
- return jsx(Widget, {
3146
- value: value,
3147
- schema: schema
3148
- });
3149
- }
3150
-
3151
- const type = typeof value;
3152
-
3153
- if (plain.includes(type)) {
3154
- return value;
3155
- }
3156
-
3157
- if (type === 'object') {
3158
- if (Array.isArray(value)) {
3159
- return value.map(item => jsx("div", {
3160
- children: jsx(RenderField, {
3161
- value: item
3190
+ const ref = useRef(null);
3191
+ const [isActive, setIsActive] = useState(false);
3192
+ const position = isRight ? 'is-right' : '';
3193
+ const status = isActive ? `dropdown ${position} is-active` : `dropdown ${position}`;
3194
+ useClickAway(ref, () => {
3195
+ setIsActive(false);
3196
+ });
3197
+ return jsxs("div", {
3198
+ ref: ref,
3199
+ className: status,
3200
+ children: [jsx("div", {
3201
+ className: "dropdown-trigger",
3202
+ children: jsx("button", {
3203
+ className: "button is-size-7",
3204
+ onClick: () => setIsActive(!isActive),
3205
+ "aria-haspopup": "true",
3206
+ disabled: disabled,
3207
+ "aria-controls": id,
3208
+ children: children
3209
+ })
3210
+ }), jsx("div", {
3211
+ className: "dropdown-menu",
3212
+ id: id,
3213
+ role: "menu",
3214
+ children: jsx("div", {
3215
+ className: "dropdown-content",
3216
+ children: options.map(option => {
3217
+ const disabled = typeof optionDisabledWhen === 'function' ? optionDisabledWhen(option) : false;
3218
+ return jsx("a", {
3219
+ className: disabled ? 'dropdown-item is-active' : 'dropdown-item',
3220
+ "data-test": `dropdownItemTest-${option.value.toLowerCase()}`,
3221
+ onClick: disabled ? undefined : () => onChange(option.value),
3222
+ style: disabled ? {
3223
+ cursor: 'not-allowed',
3224
+ color: 'black',
3225
+ opacity: 0.5,
3226
+ backgroundColor: '#eeeeee'
3227
+ } : {},
3228
+ children: option.text
3229
+ }, option.text);
3162
3230
  })
3163
- }, item));
3164
- }
3165
-
3166
- return Object.keys(value).map(key => jsx(FieldValue, {
3167
- field: get$1(schema, `properties.${key}.title`, key),
3168
- schema: get$1(schema, `properties.${key}`, {}),
3169
- value: value[key]
3170
- }, key));
3171
- }
3172
-
3173
- return jsxs("p", {
3174
- children: ["No render for ", JSON.stringify(value)]
3231
+ })
3232
+ })]
3175
3233
  });
3176
3234
  }
3177
3235
 
3178
- const FieldValue = ({
3236
+ function EditableField({
3179
3237
  field,
3180
3238
  value,
3181
- schema
3182
- }) => jsxs("div", {
3183
- className: "field",
3184
- children: [jsx("div", {
3185
- className: "label",
3186
- children: field
3187
- }), jsx("div", {
3188
- className: "value",
3189
- children: jsx(RenderFieldComponent, {
3190
- val: value,
3191
- schema: schema,
3192
- field: field
3193
- })
3194
- })]
3195
- });
3196
-
3197
- const DEFAULT_VALUE_NO_EDITABLE_FIELD = ' -- ';
3198
-
3199
- const getDefaultValueEditableField = intl => {
3200
- return intl.formatMessage({
3201
- id: "default_value_editable_field",
3202
- defaultMessage: [{
3203
- "type": 0,
3204
- "value": "Click to edit"
3205
- }]
3206
- });
3207
- };
3208
-
3209
- const SearchRenderField = ({
3210
- schema,
3211
- value,
3212
- modifyContent
3213
- }) => {
3239
+ ns,
3240
+ schema = undefined,
3241
+ modifyContent,
3242
+ required
3243
+ }) {
3214
3244
  const intl = useIntl();
3215
- const [valuesLabels, setValuesLabels] = useState([]);
3216
- const [isLoadingData, setIsLoadingData] = useState(false);
3217
- const traversal = useTraversal();
3245
+ const ref = useRef();
3246
+ const [isEdit, setEdit] = useState(false);
3247
+ const [val, setValue] = useState(value);
3218
3248
  const {
3219
- SearchEngine
3249
+ patch,
3250
+ loading,
3251
+ Ctx
3252
+ } = useCrudContext();
3253
+ const {
3254
+ fieldHaveDeleteButton
3220
3255
  } = useConfig();
3221
- const DEFAULT_VALUE_EDITABLE_FIELD = getDefaultValueEditableField(intl);
3256
+ const EditComponent = Ctx.registry.get('components', 'EditComponent');
3257
+ const RenderFieldComponent = Ctx.registry.get('components', 'RenderFieldComponent');
3222
3258
  useEffect(() => {
3223
- const fetchData = async valuesToSearch => {
3224
- setIsLoadingData(true);
3225
- let searchTermQs = '';
3226
- const searchTermParsed = ['__or', `id=${valuesToSearch.join('%26id=')}`];
3227
- const {
3228
- get: getSearch
3229
- } = traversal.registry;
3230
- const fnName = getSearch('searchEngineQueryParamsFunction', SearchEngine);
3231
- const qsParsed = traversal.client[fnName]({
3232
- path: traversal.path,
3233
- start: 0,
3234
- pageSize: 100,
3235
- withDepth: false
3236
- });
3237
-
3238
- if (searchTermParsed.length > 0 || qsParsed.length > 0) {
3239
- searchTermQs = buildQs([searchTermParsed, ...qsParsed]);
3240
- }
3241
-
3242
- const data = await traversal.client.search(traversal.client.getContainerFromPath(traversal.path), searchTermQs, false, false, 0, 100);
3243
- const newValuesLabel = data.items.map(item => {
3244
- var _schema$labelProperty;
3245
-
3246
- return get$1(item, (_schema$labelProperty = schema == null ? void 0 : schema.labelProperty) != null ? _schema$labelProperty : 'title', item.id);
3247
- });
3248
- setValuesLabels(newValuesLabel);
3249
- setIsLoadingData(false);
3250
- };
3251
-
3252
- let valuesToSearch = value;
3253
-
3254
- if (typeof valuesToSearch === 'string') {
3255
- valuesToSearch = [valuesToSearch];
3256
- }
3257
-
3258
- if (valuesToSearch !== undefined && valuesToSearch.length > 0) {
3259
- fetchData(valuesToSearch);
3260
- } else {
3261
- setValuesLabels([]);
3259
+ if (isEdit && ref.current) {
3260
+ ref.current.focus();
3262
3261
  }
3263
- }, [value]);
3262
+ });
3263
+ const canModified = modifyContent && !get$1(schema, 'readonly', false);
3264
3264
 
3265
- const getRenderValue = () => {
3266
- if (value === undefined) {
3267
- if (modifyContent) {
3268
- return DEFAULT_VALUE_EDITABLE_FIELD;
3269
- }
3265
+ const saveField = async ev => {
3266
+ if (ev) ev.preventDefault();
3270
3267
 
3271
- return DEFAULT_VALUE_NO_EDITABLE_FIELD;
3268
+ if (!field) {
3269
+ Ctx.flash(intl.formatMessage(genericMessages.error_provide_key_name), 'danger');
3270
+ return;
3272
3271
  }
3273
3272
 
3274
- if (isLoadingData) {
3275
- return 'Loading...';
3273
+ if (!val && required) {
3274
+ Ctx.flash(intl.formatMessage(genericMessages.mandatory_field, {
3275
+ field
3276
+ }), 'danger');
3277
+ return;
3276
3278
  }
3277
3279
 
3278
- return valuesLabels;
3279
- };
3280
-
3281
- return jsx(RenderField, {
3282
- value: getRenderValue()
3283
- });
3284
- };
3285
- const VocabularyRenderField = ({
3286
- schema,
3287
- value,
3288
- modifyContent
3289
- }) => {
3290
- var _schema$items;
3291
-
3292
- const intl = useIntl();
3293
- const DEFAULT_VALUE_EDITABLE_FIELD = getDefaultValueEditableField(intl);
3294
- const vocabularyName = (schema == null ? void 0 : (_schema$items = schema.items) == null ? void 0 : _schema$items.vocabularyName) || (schema == null ? void 0 : schema.vocabularyName);
3295
- const vocabulary = useVocabulary(vocabularyName);
3280
+ if ((schema == null ? void 0 : schema.widget) === 'file') {
3281
+ const value = val;
3296
3282
 
3297
- const getRenderProps = () => {
3298
- const renderProps = {
3299
- value: value != null ? value : modifyContent ? DEFAULT_VALUE_EDITABLE_FIELD : DEFAULT_VALUE_NO_EDITABLE_FIELD
3300
- };
3283
+ if (value) {
3284
+ value['filename'] = unescape(encodeURIComponent(value['filename']));
3285
+ }
3301
3286
 
3302
- if (schema != null && schema.vocabularyName) {
3303
- var _vocabularyValue$titl;
3287
+ const endpoint = `${Ctx.path}@upload/${field}`;
3288
+ const req = await Ctx.client.upload(endpoint, value);
3304
3289
 
3305
- const vocabularyValue = get$1(vocabulary, 'data.items', []).find(item => item.token === value);
3306
- renderProps['value'] = (_vocabularyValue$titl = vocabularyValue == null ? void 0 : vocabularyValue.title) != null ? _vocabularyValue$titl : '';
3290
+ if (req.status !== 200) {
3291
+ Ctx.flash(intl.formatMessage(genericFileMessages.error_upload_file), 'danger');
3292
+ } else {
3293
+ Ctx.flash(intl.formatMessage(genericFileMessages.file_uploaded), 'success');
3294
+ }
3307
3295
  } else {
3308
- var _renderProps$value;
3309
-
3310
- renderProps['value'] = ((_renderProps$value = renderProps['value']) != null ? _renderProps$value : []).map(value => {
3311
- var _get$find$title, _get$find;
3312
-
3313
- return (_get$find$title = (_get$find = get$1(vocabulary, 'data.items', []).find(item => item.token === value)) == null ? void 0 : _get$find.title) != null ? _get$find$title : '';
3314
- });
3315
- }
3316
-
3317
- return renderProps;
3318
- };
3319
-
3320
- return jsx(RenderField, _extends({}, getRenderProps()));
3321
- };
3322
- function RenderFieldComponent({
3323
- schema,
3324
- field,
3325
- val,
3326
- modifyContent
3327
- }) {
3328
- const intl = useIntl();
3329
- const DEFAULT_VALUE_EDITABLE_FIELD = getDefaultValueEditableField(intl);
3330
-
3331
- const getRenderProps = () => {
3332
- var _schema$items2;
3333
-
3334
- const renderProps = {
3335
- value: val != null ? val : modifyContent ? DEFAULT_VALUE_EDITABLE_FIELD : DEFAULT_VALUE_NO_EDITABLE_FIELD,
3336
- schema: schema
3337
- };
3338
-
3339
- if (val && (schema == null ? void 0 : schema.widget) === 'file') {
3340
- renderProps['value'] = {
3341
- data: val,
3342
- field: field
3296
+ const data = ns ? {
3297
+ [ns]: {
3298
+ [field]: val
3299
+ }
3300
+ } : {
3301
+ [field]: val
3343
3302
  };
3344
- renderProps['Widget'] = DownloadField;
3345
- } else if ((schema == null ? void 0 : schema.type) === 'boolean') {
3346
- var _val$toString;
3303
+ const dataPatch = await patch(data);
3347
3304
 
3348
- renderProps['value'] = (_val$toString = val == null ? void 0 : val.toString()) != null ? _val$toString : renderProps['value'];
3349
- } else if (val && (schema == null ? void 0 : schema.type) === 'datetime') {
3350
- renderProps['value'] = new Date(val).toLocaleString();
3351
- } else if (schema != null && (_schema$items2 = schema.items) != null && _schema$items2.vocabularyName || schema != null && schema.vocabularyName) {
3352
- renderProps['Widget'] = VocabularyRenderField;
3353
- } else if ((schema == null ? void 0 : schema.widget) === 'search' || (schema == null ? void 0 : schema.widget) === 'search_list') {
3354
- renderProps['Widget'] = SearchRenderField;
3355
- renderProps['value'] = val;
3305
+ if (dataPatch.isError) {
3306
+ Ctx.flash(intl.formatMessage(genericMessages.error_in_field, {
3307
+ field
3308
+ }), 'danger');
3309
+ } else {
3310
+ Ctx.flash(intl.formatMessage(genericMessages.field_updated, {
3311
+ field
3312
+ }), 'success');
3313
+ }
3356
3314
  }
3357
3315
 
3358
- return renderProps;
3316
+ setEdit(false);
3317
+ Ctx.refresh();
3359
3318
  };
3360
3319
 
3361
- return jsx(RenderField, _extends({}, getRenderProps()));
3362
- }
3320
+ const deleteField = async ev => {
3321
+ if (ev) ev.preventDefault();
3363
3322
 
3364
- const SelectVocabulary = forwardRef(({
3365
- vocabularyName,
3366
- className,
3367
- classWrap,
3368
- val,
3369
- dataTest,
3370
- multiple,
3371
- onChange,
3372
- id,
3373
- placeholder
3374
- }, ref) => {
3375
- const vocabulary = useVocabulary(vocabularyName);
3323
+ if ((schema == null ? void 0 : schema.widget) === 'file') {
3324
+ if (!field || !val && required) {
3325
+ Ctx.flash(intl.formatMessage(genericMessages.can_not_delete_field, {
3326
+ field
3327
+ }), 'danger');
3328
+ return;
3329
+ }
3376
3330
 
3377
- const getOptions = () => {
3378
- if (get$1(vocabulary, 'data.items', null)) {
3379
- const vocData = vocabulary.data.items.map(item => {
3380
- return {
3381
- text: item.title,
3382
- value: item.token
3383
- };
3384
- });
3385
- return vocData;
3386
- }
3331
+ const data = ns ? {
3332
+ [ns]: {
3333
+ [field]: null
3334
+ }
3335
+ } : {
3336
+ [field]: null
3337
+ };
3338
+ const dataPatch = await patch(data);
3387
3339
 
3388
- return [];
3389
- };
3340
+ if (dataPatch.isError) {
3341
+ Ctx.flash(intl.formatMessage(genericMessages.error_in_field, {
3342
+ field
3343
+ }), 'danger');
3344
+ } else {
3345
+ Ctx.flash(intl.formatMessage(genericMessages.field_deleted, {
3346
+ field
3347
+ }), 'success');
3348
+ }
3390
3349
 
3391
- const getProps = () => {
3392
- if (multiple) {
3393
- const currentValue = val || [];
3394
- return {
3395
- multiple: true,
3396
- size: 5,
3397
- value: currentValue,
3398
- options: getOptions()
3399
- };
3350
+ setEdit(false);
3351
+ Ctx.refresh();
3352
+ } else if ((schema == null ? void 0 : schema.type) === 'string' && schema != null && schema.enum) {
3353
+ setValue(null);
3354
+ } else if ((schema == null ? void 0 : schema.type) === 'array' && (schema == null ? void 0 : schema.items.type) === 'string') {
3355
+ setValue([]);
3400
3356
  }
3401
-
3402
- return {
3403
- value: val != null ? val : '',
3404
- appendDefault: true,
3405
- options: getOptions()
3406
- };
3407
3357
  };
3408
3358
 
3409
- if (vocabulary.data === undefined || vocabulary.loading) {
3410
- return jsx("div", {});
3411
- }
3412
-
3413
- return jsx(Select, _extends({}, getProps(), {
3414
- className: className,
3415
- classWrap: classWrap || 'is-fullwidth',
3416
- dataTest: dataTest,
3417
- ref: ref,
3418
- onChange: onChange,
3419
- id: id,
3420
- placeholder: placeholder
3421
- }));
3422
- });
3423
- SelectVocabulary.displayName = 'SelectVocabulary';
3424
-
3425
- function debounce$1(func, wait) {
3426
- let timeout;
3427
- return function () {
3428
- const context = this;
3429
- const args = arguments;
3430
-
3431
- const later = function later() {
3432
- timeout = null;
3433
- func.apply(context, args);
3434
- };
3435
-
3436
- clearTimeout(timeout);
3437
- timeout = setTimeout(later, wait);
3438
- };
3359
+ return jsxs(Fragment, {
3360
+ children: [!isEdit && jsxs("div", {
3361
+ className: canModified ? 'editable' : '',
3362
+ onClick: () => {
3363
+ setEdit(!!canModified);
3364
+ },
3365
+ "data-test": `editableFieldTest-${field}`,
3366
+ children: [jsx(RenderFieldComponent, {
3367
+ schema: schema,
3368
+ field: field,
3369
+ val: val,
3370
+ modifyContent: modifyContent
3371
+ }), canModified && jsx(Icon, {
3372
+ icon: "fas fa-edit"
3373
+ })]
3374
+ }), isEdit && jsxs("div", {
3375
+ className: "field",
3376
+ "data-test": `editableFieldTest-${field}`,
3377
+ children: [jsx("div", {
3378
+ className: "control",
3379
+ children: jsx(EditComponent, {
3380
+ ref: ref,
3381
+ schema: schema,
3382
+ val: val,
3383
+ setValue: setValue,
3384
+ dataTest: `editableFieldEditTest`
3385
+ })
3386
+ }), jsxs("div", {
3387
+ className: "field is-grouped",
3388
+ children: [jsx("div", {
3389
+ className: "control",
3390
+ children: jsx(Button, {
3391
+ className: "is-small is-primary",
3392
+ loading: loading,
3393
+ onClick: saveField,
3394
+ dataTest: "editableFieldBtnSaveTest",
3395
+ children: intl.formatMessage(genericMessages.save)
3396
+ })
3397
+ }), jsx("div", {
3398
+ className: "control",
3399
+ children: jsx(Button, {
3400
+ className: "is-small",
3401
+ onClick: () => setEdit(false),
3402
+ dataTest: "editableFieldBtnCancelTest",
3403
+ children: intl.formatMessage(genericMessages.cancel)
3404
+ })
3405
+ }), !required && fieldHaveDeleteButton(schema) && jsx("div", {
3406
+ className: "control",
3407
+ children: jsx(Button, {
3408
+ className: "is-small is-danger",
3409
+ onClick: deleteField,
3410
+ dataTest: "editableFieldBtnDeleteTest",
3411
+ children: intl.formatMessage(genericMessages.delete)
3412
+ })
3413
+ })]
3414
+ })]
3415
+ })]
3416
+ });
3439
3417
  }
3440
3418
 
3441
- const initialState$1 = {
3442
- page: 0,
3443
- items: undefined,
3444
- loading: false,
3445
- items_total: 0
3446
- };
3447
- const SearchInputList = ({
3448
- onChange,
3449
- error,
3450
- errorZoneClassName,
3451
- traversal: _traversal = null,
3452
- path: _path = null,
3453
- qs: _qs = [],
3454
- queryCondition: _queryCondition = 'id__in',
3455
- value,
3456
- btnClass: _btnClass = '',
3457
- dataTestWrapper: _dataTestWrapper = 'wrapperSearchInputTest',
3458
- dataTestSearchInput: _dataTestSearchInput = 'searchInputTest',
3459
- dataTestItem: _dataTestItem = 'searchInputItemTest',
3460
- renderTextItemOption: _renderTextItemOption = null,
3461
- typeNameQuery: _typeNameQuery = null,
3462
- labelProperty: _labelProperty = 'id'
3419
+ const DownloadField = ({
3420
+ value
3463
3421
  }) => {
3464
3422
  const intl = useIntl();
3465
- const [options, setOptions] = useSetState(initialState$1);
3466
- const [valuesLabel, setValuesLabels] = useState(undefined);
3467
- const [isOpen, setIsOpen] = useState(false);
3468
- const [searchTerm, setSearchTerm] = useState('');
3469
- const inputRef = useRef(null);
3470
- const wrapperRef = useRef(null);
3423
+ const Ctx = useTraversal();
3471
3424
  const {
3472
- PageSize,
3473
- SearchEngine
3474
- } = useConfig();
3475
- const [isLoadingData, setIsLoadingData] = useState(false);
3476
- const [uid] = useState(generateUID('search_input'));
3477
- useClickAway(wrapperRef, () => {
3478
- setIsOpen(false);
3479
- });
3425
+ data,
3426
+ field
3427
+ } = value;
3480
3428
 
3481
- const getHeight = () => {
3482
- if (wrapperRef && wrapperRef.current) {
3483
- return {
3484
- maxHeight: `${window.innerHeight - wrapperRef.current.getBoundingClientRect().top - 100}px`
3485
- };
3429
+ const getField = async downloadFile => {
3430
+ const endpoint = `${Ctx.path}@download/${field}`;
3431
+ const res = await Ctx.client.download(endpoint);
3432
+ const text = await res.blob();
3433
+ const blob = new Blob([text], {
3434
+ type: data.content_type
3435
+ });
3436
+ const url = window.URL.createObjectURL(blob);
3437
+ const link = document.createElement('a');
3438
+ link.href = url;
3439
+
3440
+ if (downloadFile) {
3441
+ link.setAttribute('download', `${data.filename}`);
3442
+ } else {
3443
+ link.setAttribute('target', `_blank`);
3486
3444
  }
3487
3445
 
3488
- return {
3489
- maxHeight: 'auto'
3490
- };
3446
+ document.body.appendChild(link);
3447
+ link.click();
3448
+ setTimeout(function () {
3449
+ var _link$parentNode;
3450
+
3451
+ window.URL.revokeObjectURL(url);
3452
+ (_link$parentNode = link.parentNode) == null ? void 0 : _link$parentNode.removeChild(link);
3453
+ }, 100);
3491
3454
  };
3492
3455
 
3493
- const delayedQuery = useCallback(debounce$1(value => handleSearch(0, false, value), 500), []);
3456
+ return jsxs("div", {
3457
+ className: "field",
3458
+ children: [jsx("div", {
3459
+ className: "label",
3460
+ children: data.filename
3461
+ }), jsxs("div", {
3462
+ className: "columns",
3463
+ children: [jsx("div", {
3464
+ className: "column",
3465
+ children: jsx("button", {
3466
+ className: "button is-small is-primary level-left",
3467
+ onClick: async event => {
3468
+ event.preventDefault();
3469
+ event.stopPropagation();
3470
+ getField(false);
3471
+ },
3472
+ children: intl.formatMessage(genericMessages.open)
3473
+ })
3474
+ }), jsx("div", {
3475
+ className: "column",
3476
+ children: jsx("button", {
3477
+ className: "button is-small is-primary level-right",
3478
+ onClick: async event => {
3479
+ event.preventDefault();
3480
+ event.stopPropagation();
3481
+ getField(true);
3482
+ },
3483
+ children: intl.formatMessage(genericMessages.download)
3484
+ })
3485
+ })]
3486
+ })]
3487
+ });
3488
+ };
3494
3489
 
3495
- const handleSearch = async (page = 0, concat = false, value = '') => {
3496
- var _data$items_total;
3490
+ const plain = ['string', 'number', 'boolean'];
3491
+ function RenderField({
3492
+ value,
3493
+ Widget,
3494
+ schema
3495
+ }) {
3496
+ if (value === null || value === undefined) return '';
3497
3497
 
3498
- setOptions({
3499
- loading: true
3498
+ if (Widget) {
3499
+ return jsx(Widget, {
3500
+ value: value,
3501
+ schema: schema
3500
3502
  });
3501
- let searchTermQs = '';
3502
- let searchTermParsed = [];
3503
+ }
3503
3504
 
3504
- if (value !== '') {
3505
- searchTermParsed = parser(`${_queryCondition}=${value}`);
3506
- }
3505
+ const type = typeof value;
3507
3506
 
3508
- const {
3509
- get
3510
- } = _traversal.registry;
3511
- const fnName = get('searchEngineQueryParamsFunction', SearchEngine);
3507
+ if (plain.includes(type)) {
3508
+ return value;
3509
+ }
3512
3510
 
3513
- const qsParsed = _traversal.client[fnName]({
3514
- path: _traversal.path,
3515
- start: page * PageSize,
3516
- pageSize: PageSize,
3517
- withDepth: false
3518
- });
3511
+ if (type === 'object') {
3512
+ if (Array.isArray(value)) {
3513
+ return value.map(item => jsx("div", {
3514
+ children: jsx(RenderField, {
3515
+ value: item
3516
+ })
3517
+ }, item));
3518
+ }
3519
3519
 
3520
- const sortParsed = parser(`_sort_des=${_labelProperty}`);
3521
- let typeNameParsed = [];
3520
+ return Object.keys(value).map(key => jsx(FieldValue, {
3521
+ field: get$1(schema, `properties.${key}.title`, key),
3522
+ schema: get$1(schema, `properties.${key}`, {}),
3523
+ value: value[key]
3524
+ }, key));
3525
+ }
3522
3526
 
3523
- if (_typeNameQuery) {
3524
- typeNameParsed = parser(`type_name__in=${_typeNameQuery}`);
3525
- }
3527
+ return jsxs("p", {
3528
+ children: ["No render for ", JSON.stringify(value)]
3529
+ });
3530
+ }
3526
3531
 
3527
- if (_qs.length > 0 || searchTermParsed.length > 0 || qsParsed.length > 0 || typeNameParsed.length > 0) {
3528
- searchTermQs = buildQs([..._qs, ...searchTermParsed, ...qsParsed, ...typeNameParsed, ...sortParsed]);
3529
- }
3532
+ const FieldValue = ({
3533
+ field,
3534
+ value,
3535
+ schema
3536
+ }) => jsxs("div", {
3537
+ className: "field",
3538
+ children: [jsx("div", {
3539
+ className: "label",
3540
+ children: field
3541
+ }), jsx("div", {
3542
+ className: "value",
3543
+ children: jsx(RenderFieldComponent, {
3544
+ val: value,
3545
+ schema: schema,
3546
+ field: field
3547
+ })
3548
+ })]
3549
+ });
3530
3550
 
3531
- const data = await _traversal.client.search(_path ? _path : _traversal.client.getContainerFromPath(_traversal.path), searchTermQs, false, false);
3532
- const newItems = options.items && concat ? [...options.items, ...data.items] : data.items;
3533
- setOptions({
3534
- items: newItems != null ? newItems : [],
3535
- loading: false,
3536
- items_total: (_data$items_total = data.items_total) != null ? _data$items_total : 0,
3537
- page: page
3538
- });
3539
- };
3551
+ const DEFAULT_VALUE_NO_EDITABLE_FIELD = ' -- ';
3540
3552
 
3541
- const inicializeLabels = async () => {
3542
- if (_labelProperty !== 'id' && value.length > 0) {
3553
+ const getDefaultValueEditableField = intl => {
3554
+ return intl.formatMessage({
3555
+ id: "default_value_editable_field",
3556
+ defaultMessage: [{
3557
+ "type": 0,
3558
+ "value": "Click to edit"
3559
+ }]
3560
+ });
3561
+ };
3562
+
3563
+ const SearchRenderField = ({
3564
+ schema,
3565
+ value,
3566
+ modifyContent
3567
+ }) => {
3568
+ const intl = useIntl();
3569
+ const [valuesLabels, setValuesLabels] = useState([]);
3570
+ const [isLoadingData, setIsLoadingData] = useState(false);
3571
+ const traversal = useTraversal();
3572
+ const {
3573
+ SearchEngine
3574
+ } = useConfig();
3575
+ const DEFAULT_VALUE_EDITABLE_FIELD = getDefaultValueEditableField(intl);
3576
+ useEffect(() => {
3577
+ const fetchData = async valuesToSearch => {
3543
3578
  setIsLoadingData(true);
3544
3579
  let searchTermQs = '';
3545
- const searchTermParsed = ['__or', `id=${value.join('%26id=')}`];
3580
+ const searchTermParsed = ['__or', `id=${valuesToSearch.join('%26id=')}`];
3546
3581
  const {
3547
3582
  get: getSearch
3548
- } = _traversal.registry;
3583
+ } = traversal.registry;
3549
3584
  const fnName = getSearch('searchEngineQueryParamsFunction', SearchEngine);
3550
-
3551
- const qsParsed = _traversal.client[fnName]({
3552
- path: _traversal.path,
3585
+ const qsParsed = traversal.client[fnName]({
3586
+ path: traversal.path,
3553
3587
  start: 0,
3554
3588
  pageSize: 100,
3555
3589
  withDepth: false
3556
3590
  });
3557
3591
 
3558
- let typeNameParsed = [];
3559
-
3560
- if (_typeNameQuery) {
3561
- typeNameParsed = parser(`type_name__in=${_typeNameQuery}`);
3592
+ if (searchTermParsed.length > 0 || qsParsed.length > 0) {
3593
+ searchTermQs = buildQs([searchTermParsed, ...qsParsed]);
3562
3594
  }
3563
3595
 
3564
- if (_qs.length > 0 || searchTermParsed.length > 0 || qsParsed.length > 0 || typeNameParsed.length > 0) {
3565
- searchTermQs = buildQs([..._qs, searchTermParsed, ...qsParsed, ...typeNameParsed]);
3566
- }
3596
+ const data = await traversal.client.search(traversal.client.getContainerFromPath(traversal.path), searchTermQs, false, false, 0, 100);
3597
+ const newValuesLabel = data.items.map(item => {
3598
+ var _schema$labelProperty;
3567
3599
 
3568
- const data = await _traversal.client.search(_path ? _path : _traversal.client.getContainerFromPath(_traversal.path), searchTermQs, false, false, 0, 100);
3569
- const newValuesLabel = data.items.reduce((result, item) => {
3570
- result[item.id] = get$1(item, _labelProperty, item.id);
3571
- return result;
3572
- }, {});
3600
+ return get$1(item, (_schema$labelProperty = schema == null ? void 0 : schema.labelProperty) != null ? _schema$labelProperty : 'title', item.id);
3601
+ });
3573
3602
  setValuesLabels(newValuesLabel);
3574
3603
  setIsLoadingData(false);
3604
+ };
3605
+
3606
+ let valuesToSearch = value;
3607
+
3608
+ if (typeof valuesToSearch === 'string') {
3609
+ valuesToSearch = [valuesToSearch];
3575
3610
  }
3576
- };
3577
3611
 
3578
- const renderTextItemOptionFn = item => {
3579
- if (_renderTextItemOption) {
3580
- return _renderTextItemOption(item);
3612
+ if (valuesToSearch !== undefined && valuesToSearch.length > 0) {
3613
+ fetchData(valuesToSearch);
3614
+ } else {
3615
+ setValuesLabels([]);
3581
3616
  }
3617
+ }, [value]);
3582
3618
 
3583
- return get$1(item, _labelProperty, item.title) || item['@name'];
3584
- };
3619
+ const getRenderValue = () => {
3620
+ if (value === undefined) {
3621
+ if (modifyContent) {
3622
+ return DEFAULT_VALUE_EDITABLE_FIELD;
3623
+ }
3585
3624
 
3586
- useEffect(() => {
3587
- if (!options.loading && !options.items && value.length > 0) {
3588
- inicializeLabels();
3589
- } else if (value.length === 0) {
3590
- setValuesLabels({});
3625
+ return DEFAULT_VALUE_NO_EDITABLE_FIELD;
3591
3626
  }
3592
- }, [_path, options.loading, options.items]);
3593
3627
 
3594
- if (isLoadingData || valuesLabel === undefined) {
3595
- return jsx("div", {
3596
- className: "spinner"
3597
- });
3598
- }
3628
+ if (isLoadingData) {
3629
+ return 'Loading...';
3630
+ }
3599
3631
 
3600
- return jsxs(Fragment, {
3601
- children: [jsx("div", {
3602
- className: "tags mb-2",
3603
- children: value.map((tag, index) => jsxs("div", {
3604
- className: "tag is-info is-medium",
3605
- children: [get$1(valuesLabel, tag, tag), jsx("button", {
3606
- className: "delete is-small",
3607
- onClick: ev => {
3608
- ev.stopPropagation();
3609
- ev.preventDefault();
3610
- onChange([...value.filter(tag => value.indexOf(tag) !== index)]);
3611
- }
3612
- })]
3613
- }, `input_list_${tag}_${index}`))
3614
- }), jsxs("div", {
3615
- "data-test": _dataTestWrapper,
3616
- ref: wrapperRef,
3617
- className: `dropdown mb-2 ${isOpen ? 'is-active' : ''}`,
3618
- onBlur: ev => {
3619
- if (!ev.currentTarget.contains(ev.relatedTarget)) {
3620
- if (searchTerm !== '') {
3621
- setSearchTerm('');
3622
- setOptions(initialState$1);
3623
- }
3632
+ return valuesLabels;
3633
+ };
3624
3634
 
3625
- setIsOpen(false);
3626
- }
3627
- },
3628
- children: [jsx("div", {
3629
- className: "dropdown-trigger",
3630
- children: jsxs("button", {
3631
- className: `button ${_btnClass}`,
3632
- onClick: ev => {
3633
- ev.preventDefault();
3634
- setIsOpen(!isOpen);
3635
+ return jsx(RenderField, {
3636
+ value: getRenderValue()
3637
+ });
3638
+ };
3639
+ const VocabularyRenderField = ({
3640
+ schema,
3641
+ value,
3642
+ modifyContent
3643
+ }) => {
3644
+ var _schema$items;
3635
3645
 
3636
- if (!options.loading && !options.items) {
3637
- handleSearch(options.page);
3638
- }
3639
- },
3640
- "aria-haspopup": "true",
3641
- "aria-controls": "dropdown-menu",
3642
- children: [jsx("span", {
3643
- children: intl.formatMessage(genericMessages.choose)
3644
- }), jsx("span", {
3645
- className: "icon",
3646
- children: jsx("i", {
3647
- className: "fas fa-angle-down",
3648
- "aria-hidden": "true"
3649
- })
3650
- })]
3651
- })
3652
- }), jsx("div", {
3653
- className: "dropdown-menu",
3654
- id: "dropdown-menu",
3655
- role: "menu",
3656
- style: getHeight(),
3657
- children: jsxs("div", {
3658
- className: "dropdown-content",
3659
- children: [jsx("div", {
3660
- className: "dropdown-item",
3661
- children: jsx("input", {
3662
- ref: inputRef,
3663
- "data-test": _dataTestSearchInput,
3664
- className: "input",
3665
- type: "text",
3666
- placeholder: intl.formatMessage(genericMessages.search),
3667
- value: searchTerm,
3668
- onChange: ev => {
3669
- delayedQuery(ev.target.value);
3670
- setSearchTerm(ev.target.value);
3671
- }
3672
- })
3673
- }), jsx("hr", {
3674
- className: "dropdown-divider"
3675
- }), options.loading && jsx(Loading, {}), options.items && options.items.map(item => {
3676
- return jsx("div", {
3677
- className: `dropdown-item editable ${value.includes(item.id) ? 'is-active' : ''}`,
3678
- "data-test": `${_dataTestItem}-${item.id}`,
3679
- onMouseDown: ev => {
3680
- ev.stopPropagation();
3681
- ev.preventDefault();
3646
+ const intl = useIntl();
3647
+ const DEFAULT_VALUE_EDITABLE_FIELD = getDefaultValueEditableField(intl);
3648
+ const vocabularyName = (schema == null ? void 0 : (_schema$items = schema.items) == null ? void 0 : _schema$items.vocabularyName) || (schema == null ? void 0 : schema.vocabularyName);
3649
+ const vocabulary = useVocabulary(vocabularyName);
3682
3650
 
3683
- if (onChange && !value.includes(item.id)) {
3684
- setValuesLabels(_extends({}, valuesLabel, {
3685
- [item.id]: get$1(item, _labelProperty, item.id)
3686
- }));
3687
- onChange([...value, item.id]);
3688
- }
3689
- },
3690
- children: renderTextItemOptionFn(item)
3691
- }, item.path);
3692
- }), options.items && options.items.length === 0 && jsx("div", {
3693
- className: "dropdown-item",
3694
- children: intl.formatMessage(genericMessages.no_results)
3695
- }), options.items && options.items_total > options.items.length && jsxs(Fragment, {
3696
- children: [jsx("hr", {
3697
- className: "dropdown-divider"
3698
- }), jsx("div", {
3699
- className: "dropdown-item editable",
3700
- onMouseDown: ev => {
3701
- ev.stopPropagation();
3702
- ev.preventDefault();
3703
- handleSearch(options.page + 1, true);
3704
- },
3705
- children: intl.formatMessage(genericMessages.load_more)
3706
- })]
3707
- })]
3708
- })
3709
- })]
3710
- }), error && jsx(ErrorZone, {
3711
- className: errorZoneClassName,
3712
- id: uid,
3713
- children: error ? error : ''
3714
- })]
3715
- });
3651
+ const getRenderProps = () => {
3652
+ const renderProps = {
3653
+ value: value != null ? value : modifyContent ? DEFAULT_VALUE_EDITABLE_FIELD : DEFAULT_VALUE_NO_EDITABLE_FIELD
3654
+ };
3655
+
3656
+ if (schema != null && schema.vocabularyName) {
3657
+ var _vocabularyValue$titl;
3658
+
3659
+ const vocabularyValue = get$1(vocabulary, 'data.items', []).find(item => item.token === value);
3660
+ renderProps['value'] = (_vocabularyValue$titl = vocabularyValue == null ? void 0 : vocabularyValue.title) != null ? _vocabularyValue$titl : '';
3661
+ } else {
3662
+ var _renderProps$value;
3663
+
3664
+ renderProps['value'] = ((_renderProps$value = renderProps['value']) != null ? _renderProps$value : []).map(value => {
3665
+ var _get$find$title, _get$find;
3666
+
3667
+ return (_get$find$title = (_get$find = get$1(vocabulary, 'data.items', []).find(item => item.token === value)) == null ? void 0 : _get$find.title) != null ? _get$find$title : '';
3668
+ });
3669
+ }
3670
+
3671
+ return renderProps;
3672
+ };
3673
+
3674
+ return jsx(RenderField, _extends({}, getRenderProps()));
3716
3675
  };
3676
+ function RenderFieldComponent({
3677
+ schema,
3678
+ field,
3679
+ val,
3680
+ modifyContent
3681
+ }) {
3682
+ const intl = useIntl();
3683
+ const DEFAULT_VALUE_EDITABLE_FIELD = getDefaultValueEditableField(intl);
3684
+
3685
+ const getRenderProps = () => {
3686
+ var _schema$items2;
3687
+
3688
+ const renderProps = {
3689
+ value: val != null ? val : modifyContent ? DEFAULT_VALUE_EDITABLE_FIELD : DEFAULT_VALUE_NO_EDITABLE_FIELD,
3690
+ schema: schema
3691
+ };
3692
+
3693
+ if (val && (schema == null ? void 0 : schema.widget) === 'file') {
3694
+ renderProps['value'] = {
3695
+ data: val,
3696
+ field: field
3697
+ };
3698
+ renderProps['Widget'] = DownloadField;
3699
+ } else if ((schema == null ? void 0 : schema.type) === 'boolean') {
3700
+ var _val$toString;
3701
+
3702
+ renderProps['value'] = (_val$toString = val == null ? void 0 : val.toString()) != null ? _val$toString : renderProps['value'];
3703
+ } else if (val && (schema == null ? void 0 : schema.type) === 'datetime') {
3704
+ renderProps['value'] = new Date(val).toLocaleString();
3705
+ } else if (schema != null && (_schema$items2 = schema.items) != null && _schema$items2.vocabularyName || schema != null && schema.vocabularyName) {
3706
+ renderProps['Widget'] = VocabularyRenderField;
3707
+ } else if ((schema == null ? void 0 : schema.widget) === 'search' || (schema == null ? void 0 : schema.widget) === 'search_list') {
3708
+ renderProps['Widget'] = SearchRenderField;
3709
+ renderProps['value'] = val;
3710
+ }
3711
+
3712
+ return renderProps;
3713
+ };
3714
+
3715
+ return jsx(RenderField, _extends({}, getRenderProps()));
3716
+ }
3717
3717
 
3718
3718
  const EditComponent = forwardRef(({
3719
3719
  schema,
@@ -12157,5 +12157,5 @@ class Auth {
12157
12157
 
12158
12158
  }
12159
12159
 
12160
- 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, Traversal, TraversalContext, TraversalProvider, UserCtx, UserForm, UsersCtx, UsersToolbar, VocabularyRenderField, base64ToArrayBuffer, buildQs, classnames, defaultComponent, formatDate, generateUID, genericFileMessages, genericMessages, 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 };
12160
+ 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, SearchInputList, SearchLabels, SearchOptionsLabels, SearchRenderField, SearchVocabularyLabels, Select, SelectVocabulary, Sharing, Table, TabsPanel, Tag, TagsWidget, TdLink, Textarea, Traversal, TraversalContext, TraversalProvider, UserCtx, UserForm, UsersCtx, UsersToolbar, VocabularyRenderField, base64ToArrayBuffer, buildQs, classnames, defaultComponent, formatDate, generateUID, genericFileMessages, genericMessages, 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 };
12161
12161
  //# sourceMappingURL=react-gmi.modern.js.map