@guillotinaweb/react-gmi 0.25.2 → 0.27.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/react-gmi.esm.js +41 -19
- package/dist/react-gmi.esm.js.map +1 -1
- package/dist/react-gmi.js +41 -19
- package/dist/react-gmi.js.map +1 -1
- package/dist/react-gmi.modern.js +37 -15
- package/dist/react-gmi.modern.js.map +1 -1
- package/dist/react-gmi.umd.js +41 -19
- package/dist/react-gmi.umd.js.map +1 -1
- package/package.json +1 -1
package/dist/react-gmi.modern.js
CHANGED
|
@@ -2499,7 +2499,6 @@ const SearchInput = ({
|
|
|
2499
2499
|
SearchEngine
|
|
2500
2500
|
} = useConfig();
|
|
2501
2501
|
const [valueLabel, setValueLabel] = useState(undefined);
|
|
2502
|
-
const [isLoadingData, setIsLoadingData] = useState(false);
|
|
2503
2502
|
const [uid] = useState(generateUID('search_input'));
|
|
2504
2503
|
useClickAway(wrapperRef, () => {
|
|
2505
2504
|
setIsOpen(false);
|
|
@@ -2521,7 +2520,6 @@ const SearchInput = ({
|
|
|
2521
2520
|
|
|
2522
2521
|
const inicializeLabels = async () => {
|
|
2523
2522
|
if (_labelProperty !== 'id' && value) {
|
|
2524
|
-
setIsLoadingData(true);
|
|
2525
2523
|
let searchTermQs = [];
|
|
2526
2524
|
const searchTermParsed = [`id`, value];
|
|
2527
2525
|
const {
|
|
@@ -2552,7 +2550,6 @@ const SearchInput = ({
|
|
|
2552
2550
|
return result;
|
|
2553
2551
|
}, {});
|
|
2554
2552
|
setValueLabel(newValuesLabel);
|
|
2555
|
-
setIsLoadingData(false);
|
|
2556
2553
|
}
|
|
2557
2554
|
};
|
|
2558
2555
|
|
|
@@ -2581,7 +2578,7 @@ const SearchInput = ({
|
|
|
2581
2578
|
withDepth: false
|
|
2582
2579
|
});
|
|
2583
2580
|
|
|
2584
|
-
let sortParsed = parser(`_sort_des
|
|
2581
|
+
let sortParsed = parser(`_sort_des=${_labelProperty}`);
|
|
2585
2582
|
let typeNameParsed = [];
|
|
2586
2583
|
|
|
2587
2584
|
if (_typeNameQuery) {
|
|
@@ -2607,7 +2604,7 @@ const SearchInput = ({
|
|
|
2607
2604
|
return _renderTextItemOption(item);
|
|
2608
2605
|
}
|
|
2609
2606
|
|
|
2610
|
-
return item.title || item['@name'];
|
|
2607
|
+
return get$1(item, _labelProperty, item.title) || item['@name'];
|
|
2611
2608
|
};
|
|
2612
2609
|
|
|
2613
2610
|
useEffect(() => {
|
|
@@ -2745,7 +2742,7 @@ const InputList = forwardRef(({
|
|
|
2745
2742
|
|
|
2746
2743
|
return /*#__PURE__*/createElement("div", {
|
|
2747
2744
|
className: "control"
|
|
2748
|
-
}, /*#__PURE__*/createElement("div", {
|
|
2745
|
+
}, (value != null ? value : []).length > 0 && /*#__PURE__*/createElement("div", {
|
|
2749
2746
|
className: "tags"
|
|
2750
2747
|
}, value.map((tag, index) => /*#__PURE__*/createElement("div", {
|
|
2751
2748
|
key: `input_list_${tag}_${index}`,
|
|
@@ -3228,8 +3225,6 @@ const SearchRenderField = ({
|
|
|
3228
3225
|
}, [value]);
|
|
3229
3226
|
|
|
3230
3227
|
const getRenderValue = () => {
|
|
3231
|
-
console.log('get render values', value, valuesLabels);
|
|
3232
|
-
|
|
3233
3228
|
if (value === undefined) {
|
|
3234
3229
|
if (modifyContent) {
|
|
3235
3230
|
return DEFAULT_VALUE_EDITABLE_FIELD;
|
|
@@ -3494,7 +3489,7 @@ const SearchInputList = ({
|
|
|
3494
3489
|
withDepth: false
|
|
3495
3490
|
});
|
|
3496
3491
|
|
|
3497
|
-
let sortParsed = parser(`_sort_des
|
|
3492
|
+
let sortParsed = parser(`_sort_des=${_labelProperty}`);
|
|
3498
3493
|
let typeNameParsed = [];
|
|
3499
3494
|
|
|
3500
3495
|
if (_typeNameQuery) {
|
|
@@ -3557,7 +3552,7 @@ const SearchInputList = ({
|
|
|
3557
3552
|
return _renderTextItemOption(item);
|
|
3558
3553
|
}
|
|
3559
3554
|
|
|
3560
|
-
return item.title || item['@name'];
|
|
3555
|
+
return get$1(item, _labelProperty, item.title) || item['@name'];
|
|
3561
3556
|
};
|
|
3562
3557
|
|
|
3563
3558
|
React.useEffect(() => {
|
|
@@ -3781,13 +3776,15 @@ const EditComponent = React.forwardRef((_ref, ref) => {
|
|
|
3781
3776
|
}
|
|
3782
3777
|
}
|
|
3783
3778
|
|
|
3784
|
-
return /*#__PURE__*/React.createElement(
|
|
3779
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, rest.placeholder && /*#__PURE__*/React.createElement("label", {
|
|
3780
|
+
className: "label"
|
|
3781
|
+
}, rest.placeholder), /*#__PURE__*/React.createElement(InputList, _extends({
|
|
3785
3782
|
value: val || [],
|
|
3786
3783
|
className: className,
|
|
3787
3784
|
onChange: ev => setValue(ev),
|
|
3788
3785
|
ref: ref,
|
|
3789
3786
|
dataTest: dataTest
|
|
3790
|
-
}, rest));
|
|
3787
|
+
}, rest)));
|
|
3791
3788
|
} else if ((schema == null ? void 0 : schema.widget) === 'file') {
|
|
3792
3789
|
return /*#__PURE__*/React.createElement(FileUpload, _extends({
|
|
3793
3790
|
onChange: ev => setValue(ev),
|
|
@@ -4677,6 +4674,7 @@ function IWorkflow() {
|
|
|
4677
4674
|
const [definition, setDefinition] = React.useState(undefined);
|
|
4678
4675
|
const [workflowAction, setWorkflowAction] = React.useState(null);
|
|
4679
4676
|
const model = new ItemModel(Ctx.context);
|
|
4677
|
+
const vocabulary = useVocabulary('workflow_states');
|
|
4680
4678
|
const currentState = model.item['guillotina.contrib.workflows.interfaces.IWorkflowBehavior']['review_state'];
|
|
4681
4679
|
|
|
4682
4680
|
async function loadDefinition() {
|
|
@@ -4708,6 +4706,30 @@ function IWorkflow() {
|
|
|
4708
4706
|
setWorkflowAction(null);
|
|
4709
4707
|
};
|
|
4710
4708
|
|
|
4709
|
+
const getStateTitle = () => {
|
|
4710
|
+
var _vocabulary$data, _vocabulary$data$item;
|
|
4711
|
+
|
|
4712
|
+
if (((_vocabulary$data = vocabulary.data) == null ? void 0 : (_vocabulary$data$item = _vocabulary$data.items) == null ? void 0 : _vocabulary$data$item.length) > 0) {
|
|
4713
|
+
const vocabularyValue = vocabulary.data.items.find(item => item.token === currentState);
|
|
4714
|
+
|
|
4715
|
+
if (vocabularyValue) {
|
|
4716
|
+
const translatedValue = get$1(vocabularyValue, `title.translated_title.${intl.locale}`, null);
|
|
4717
|
+
|
|
4718
|
+
if (translatedValue !== null) {
|
|
4719
|
+
return translatedValue;
|
|
4720
|
+
}
|
|
4721
|
+
|
|
4722
|
+
const titleValue = get$1(vocabularyValue, `title.title.${intl.locale}`, null);
|
|
4723
|
+
|
|
4724
|
+
if (titleValue !== null) {
|
|
4725
|
+
return titleValue;
|
|
4726
|
+
}
|
|
4727
|
+
}
|
|
4728
|
+
}
|
|
4729
|
+
|
|
4730
|
+
return currentState;
|
|
4731
|
+
};
|
|
4732
|
+
|
|
4711
4733
|
if (definition === undefined) return null;
|
|
4712
4734
|
return /*#__PURE__*/React.createElement(React.Fragment, null, workflowAction && /*#__PURE__*/React.createElement(Confirm, {
|
|
4713
4735
|
loading: loading,
|
|
@@ -4722,8 +4744,8 @@ function IWorkflow() {
|
|
|
4722
4744
|
className: "has-text-weight-bold",
|
|
4723
4745
|
"data-test": `textInfoStatus-${currentState}`
|
|
4724
4746
|
}, intl.formatMessage(messages$1.current_state, {
|
|
4725
|
-
state:
|
|
4726
|
-
}))), modifyContent && /*#__PURE__*/React.createElement("div", {
|
|
4747
|
+
state: getStateTitle()
|
|
4748
|
+
}))), modifyContent && definition.transitions.length > 0 && /*#__PURE__*/React.createElement("div", {
|
|
4727
4749
|
className: " is-flex is-align-items-center has-text-weight-bold",
|
|
4728
4750
|
"data-test": `textInfoStatus-${currentState}`
|
|
4729
4751
|
}, /*#__PURE__*/React.createElement("label", null, intl.formatMessage(messages$1.actions)), "\xA0\xA0", definition.transitions.map(transition => {
|
|
@@ -4731,7 +4753,7 @@ function IWorkflow() {
|
|
|
4731
4753
|
key: transition['@id'],
|
|
4732
4754
|
className: "button mr-4",
|
|
4733
4755
|
onClick: () => setWorkflowAction(transition['@id'].split('@workflow')[1].slice(1))
|
|
4734
|
-
}, transition.title);
|
|
4756
|
+
}, get$1(transition, `metadata.translated_title.${intl.locale}`, transition.title));
|
|
4735
4757
|
})));
|
|
4736
4758
|
}
|
|
4737
4759
|
|