@guillotinaweb/react-gmi 0.24.0 → 0.24.1
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 +7 -1
- package/dist/components/index.d.ts +1 -0
- package/dist/react-gmi.esm.js +263 -237
- package/dist/react-gmi.esm.js.map +1 -1
- package/dist/react-gmi.js +264 -236
- package/dist/react-gmi.js.map +1 -1
- package/dist/react-gmi.modern.js +254 -227
- package/dist/react-gmi.modern.js.map +1 -1
- package/dist/react-gmi.umd.js +264 -236
- package/dist/react-gmi.umd.js.map +1 -1
- package/package.json +2 -1
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
export function RenderField({ value, Widget }: {
|
|
1
|
+
export function RenderField({ value, Widget, schema }: {
|
|
2
2
|
value: any;
|
|
3
3
|
Widget: any;
|
|
4
|
+
schema: any;
|
|
4
5
|
}): any;
|
|
5
6
|
export function RenderFieldComponent({ schema, field, val, modifyContent }: {
|
|
6
7
|
schema: any;
|
|
@@ -8,3 +9,8 @@ export function RenderFieldComponent({ schema, field, val, modifyContent }: {
|
|
|
8
9
|
val: any;
|
|
9
10
|
modifyContent: any;
|
|
10
11
|
}): JSX.Element;
|
|
12
|
+
export function VocabularyRenderField({ schema, value, modifyContent }: {
|
|
13
|
+
schema: any;
|
|
14
|
+
value: any;
|
|
15
|
+
modifyContent: any;
|
|
16
|
+
}): JSX.Element;
|
|
@@ -14,6 +14,7 @@ export * from "./input/dropdown";
|
|
|
14
14
|
export * from "./fields/editableField";
|
|
15
15
|
export * from "./fields/renderField";
|
|
16
16
|
export * from "./fields/downloadField";
|
|
17
|
+
export * from "./fields/editComponent";
|
|
17
18
|
export * from "./behaviors/iattachment";
|
|
18
19
|
export * from "./behaviors/imultiattachment";
|
|
19
20
|
export * from "./behaviors/iimageattachment";
|
package/dist/react-gmi.esm.js
CHANGED
|
@@ -3755,12 +3755,14 @@ function useVocabulary(vocabularyName, path) {
|
|
|
3755
3755
|
var plain = ['string', 'number', 'boolean'];
|
|
3756
3756
|
function RenderField(_ref) {
|
|
3757
3757
|
var value = _ref.value,
|
|
3758
|
-
Widget = _ref.Widget
|
|
3758
|
+
Widget = _ref.Widget,
|
|
3759
|
+
schema = _ref.schema;
|
|
3759
3760
|
if (value === null || value === undefined) return '';
|
|
3760
3761
|
|
|
3761
3762
|
if (Widget) {
|
|
3762
3763
|
return /*#__PURE__*/React.createElement(Widget, {
|
|
3763
|
-
value: value
|
|
3764
|
+
value: value,
|
|
3765
|
+
schema: schema
|
|
3764
3766
|
});
|
|
3765
3767
|
}
|
|
3766
3768
|
|
|
@@ -3807,23 +3809,68 @@ var FieldValue = function FieldValue(_ref2) {
|
|
|
3807
3809
|
})));
|
|
3808
3810
|
};
|
|
3809
3811
|
|
|
3810
|
-
|
|
3811
|
-
|
|
3812
|
-
|
|
3813
|
-
|
|
3814
|
-
modifyContent = _ref3.modifyContent;
|
|
3815
|
-
var intl = useIntl();
|
|
3816
|
-
var DEFAULT_VALUE_EDITABLE_FIELD = intl.formatMessage({
|
|
3812
|
+
var DEFAULT_VALUE_NO_EDITABLE_FIELD = ' -- ';
|
|
3813
|
+
|
|
3814
|
+
var getDefaultValueEditableField = function getDefaultValueEditableField(intl) {
|
|
3815
|
+
return intl.formatMessage({
|
|
3817
3816
|
id: "default_value_editable_field",
|
|
3818
3817
|
defaultMessage: [{
|
|
3819
3818
|
"type": 0,
|
|
3820
3819
|
"value": "Click to edit"
|
|
3821
3820
|
}]
|
|
3822
3821
|
});
|
|
3823
|
-
|
|
3822
|
+
};
|
|
3823
|
+
|
|
3824
|
+
var VocabularyRenderField = function VocabularyRenderField(_ref3) {
|
|
3825
|
+
var _schema$items;
|
|
3826
|
+
|
|
3827
|
+
var schema = _ref3.schema,
|
|
3828
|
+
value = _ref3.value,
|
|
3829
|
+
modifyContent = _ref3.modifyContent;
|
|
3830
|
+
var intl = useIntl();
|
|
3831
|
+
var DEFAULT_VALUE_EDITABLE_FIELD = getDefaultValueEditableField(intl);
|
|
3832
|
+
var vocabularyName = (schema == null ? void 0 : (_schema$items = schema.items) == null ? void 0 : _schema$items.vocabularyName) || (schema == null ? void 0 : schema.vocabularyName);
|
|
3833
|
+
var vocabulary = useVocabulary(vocabularyName);
|
|
3834
|
+
|
|
3835
|
+
var getRenderProps = function getRenderProps() {
|
|
3836
|
+
var renderProps = {
|
|
3837
|
+
value: value != null ? value : modifyContent ? DEFAULT_VALUE_EDITABLE_FIELD : DEFAULT_VALUE_NO_EDITABLE_FIELD
|
|
3838
|
+
};
|
|
3839
|
+
|
|
3840
|
+
if (schema != null && schema.vocabularyName) {
|
|
3841
|
+
var _vocabularyValue$titl;
|
|
3842
|
+
|
|
3843
|
+
var vocabularyValue = get$1(vocabulary, 'data.items', []).find(function (item) {
|
|
3844
|
+
return item.token === value;
|
|
3845
|
+
});
|
|
3846
|
+
renderProps['value'] = (_vocabularyValue$titl = vocabularyValue == null ? void 0 : vocabularyValue.title) != null ? _vocabularyValue$titl : '';
|
|
3847
|
+
} else {
|
|
3848
|
+
var _renderProps$value;
|
|
3849
|
+
|
|
3850
|
+
renderProps['value'] = ((_renderProps$value = renderProps['value']) != null ? _renderProps$value : []).map(function (value) {
|
|
3851
|
+
var _get$find$title, _get$find;
|
|
3852
|
+
|
|
3853
|
+
return (_get$find$title = (_get$find = get$1(vocabulary, 'data.items', []).find(function (item) {
|
|
3854
|
+
return item.token === value;
|
|
3855
|
+
})) == null ? void 0 : _get$find.title) != null ? _get$find$title : '';
|
|
3856
|
+
});
|
|
3857
|
+
}
|
|
3858
|
+
|
|
3859
|
+
return renderProps;
|
|
3860
|
+
};
|
|
3861
|
+
|
|
3862
|
+
return /*#__PURE__*/React.createElement(RenderField, getRenderProps());
|
|
3863
|
+
};
|
|
3864
|
+
function RenderFieldComponent(_ref4) {
|
|
3865
|
+
var schema = _ref4.schema,
|
|
3866
|
+
field = _ref4.field,
|
|
3867
|
+
val = _ref4.val,
|
|
3868
|
+
modifyContent = _ref4.modifyContent;
|
|
3869
|
+
var intl = useIntl();
|
|
3870
|
+
var DEFAULT_VALUE_EDITABLE_FIELD = getDefaultValueEditableField(intl);
|
|
3824
3871
|
|
|
3825
3872
|
var getRenderProps = function getRenderProps() {
|
|
3826
|
-
var _schema$
|
|
3873
|
+
var _schema$items2;
|
|
3827
3874
|
|
|
3828
3875
|
var renderProps = {
|
|
3829
3876
|
value: val != null ? val : modifyContent ? DEFAULT_VALUE_EDITABLE_FIELD : DEFAULT_VALUE_NO_EDITABLE_FIELD
|
|
@@ -3841,37 +3888,220 @@ function RenderFieldComponent(_ref3) {
|
|
|
3841
3888
|
renderProps['value'] = (_val$toString = val == null ? void 0 : val.toString()) != null ? _val$toString : renderProps['value'];
|
|
3842
3889
|
} else if (val && (schema == null ? void 0 : schema.type) === 'datetime') {
|
|
3843
3890
|
renderProps['value'] = new Date(val).toLocaleString();
|
|
3844
|
-
} else if (schema != null && (_schema$
|
|
3845
|
-
|
|
3891
|
+
} else if (schema != null && (_schema$items2 = schema.items) != null && _schema$items2.vocabularyName || schema != null && schema.vocabularyName) {
|
|
3892
|
+
renderProps['Widget'] = VocabularyRenderField;
|
|
3893
|
+
renderProps['schema'] = schema;
|
|
3894
|
+
}
|
|
3846
3895
|
|
|
3847
|
-
|
|
3848
|
-
|
|
3896
|
+
return renderProps;
|
|
3897
|
+
};
|
|
3849
3898
|
|
|
3850
|
-
|
|
3851
|
-
|
|
3899
|
+
return /*#__PURE__*/React.createElement(RenderField, getRenderProps());
|
|
3900
|
+
}
|
|
3852
3901
|
|
|
3853
|
-
|
|
3854
|
-
|
|
3855
|
-
|
|
3856
|
-
|
|
3857
|
-
|
|
3858
|
-
|
|
3902
|
+
var SelectVocabulary = React.forwardRef(function (_ref, ref) {
|
|
3903
|
+
var vocabularyName = _ref.vocabularyName,
|
|
3904
|
+
className = _ref.className,
|
|
3905
|
+
classWrap = _ref.classWrap,
|
|
3906
|
+
val = _ref.val,
|
|
3907
|
+
dataTest = _ref.dataTest,
|
|
3908
|
+
multiple = _ref.multiple,
|
|
3909
|
+
rest = _objectWithoutPropertiesLoose(_ref, ["vocabularyName", "className", "classWrap", "val", "dataTest", "multiple"]);
|
|
3859
3910
|
|
|
3860
|
-
|
|
3861
|
-
var _get$find$title, _get$find;
|
|
3911
|
+
var vocabulary = useVocabulary(vocabularyName);
|
|
3862
3912
|
|
|
3863
|
-
|
|
3864
|
-
|
|
3865
|
-
|
|
3866
|
-
|
|
3913
|
+
var getOptions = function getOptions() {
|
|
3914
|
+
if (get$1(vocabulary, 'data.items', null)) {
|
|
3915
|
+
var vocData = vocabulary.data.items.map(function (item) {
|
|
3916
|
+
var _item$title$default;
|
|
3917
|
+
|
|
3918
|
+
return {
|
|
3919
|
+
text: (_item$title$default = item.title.default) != null ? _item$title$default : item.title,
|
|
3920
|
+
value: item.token
|
|
3921
|
+
};
|
|
3922
|
+
});
|
|
3923
|
+
return vocData;
|
|
3924
|
+
}
|
|
3925
|
+
|
|
3926
|
+
return [];
|
|
3927
|
+
};
|
|
3928
|
+
|
|
3929
|
+
var getProps = function getProps() {
|
|
3930
|
+
if (multiple) {
|
|
3931
|
+
var currentValue = val || [];
|
|
3932
|
+
return {
|
|
3933
|
+
multiple: true,
|
|
3934
|
+
size: 5,
|
|
3935
|
+
value: currentValue,
|
|
3936
|
+
options: getOptions()
|
|
3937
|
+
};
|
|
3938
|
+
}
|
|
3939
|
+
|
|
3940
|
+
return {
|
|
3941
|
+
value: val != null ? val : '',
|
|
3942
|
+
appendDefault: true,
|
|
3943
|
+
options: getOptions()
|
|
3944
|
+
};
|
|
3945
|
+
};
|
|
3946
|
+
|
|
3947
|
+
if (vocabulary.data === undefined || vocabulary.loading) {
|
|
3948
|
+
return /*#__PURE__*/React.createElement("div", null);
|
|
3949
|
+
}
|
|
3950
|
+
|
|
3951
|
+
return /*#__PURE__*/React.createElement(Select, _extends({}, getProps(), {
|
|
3952
|
+
className: className,
|
|
3953
|
+
classWrap: classWrap || 'is-fullwidth',
|
|
3954
|
+
dataTest: dataTest,
|
|
3955
|
+
ref: ref
|
|
3956
|
+
}, rest));
|
|
3957
|
+
});
|
|
3958
|
+
Select.propTypes = {
|
|
3959
|
+
error: PropTypes.string,
|
|
3960
|
+
disabled: PropTypes.bool,
|
|
3961
|
+
loading: PropTypes.bool,
|
|
3962
|
+
isSubmitted: PropTypes.bool,
|
|
3963
|
+
size: PropTypes.number,
|
|
3964
|
+
onChange: PropTypes.func,
|
|
3965
|
+
multiple: PropTypes.bool,
|
|
3966
|
+
className: PropTypes.string,
|
|
3967
|
+
vocabularyName: PropTypes.string
|
|
3968
|
+
};
|
|
3969
|
+
|
|
3970
|
+
var EditComponent = React.forwardRef(function (_ref, ref) {
|
|
3971
|
+
var schema = _ref.schema,
|
|
3972
|
+
val = _ref.val,
|
|
3973
|
+
setValue = _ref.setValue,
|
|
3974
|
+
dataTest = _ref.dataTest,
|
|
3975
|
+
className = _ref.className,
|
|
3976
|
+
rest = _objectWithoutPropertiesLoose(_ref, ["schema", "val", "setValue", "dataTest", "className"]);
|
|
3977
|
+
|
|
3978
|
+
if ((schema == null ? void 0 : schema.widget) === 'textarea' || (schema == null ? void 0 : schema.widget) === 'richtext') {
|
|
3979
|
+
return /*#__PURE__*/React.createElement(Textarea, _extends({
|
|
3980
|
+
value: val || '',
|
|
3981
|
+
className: className,
|
|
3982
|
+
onChange: function onChange(ev) {
|
|
3983
|
+
return setValue(ev);
|
|
3984
|
+
},
|
|
3985
|
+
ref: ref,
|
|
3986
|
+
dataTest: dataTest
|
|
3987
|
+
}, rest));
|
|
3988
|
+
} else if ((schema == null ? void 0 : schema.type) === 'boolean') {
|
|
3989
|
+
return /*#__PURE__*/React.createElement(Checkbox, _extends({
|
|
3990
|
+
value: !!val,
|
|
3991
|
+
className: className,
|
|
3992
|
+
onChange: function onChange(ev) {
|
|
3993
|
+
return setValue(ev);
|
|
3994
|
+
},
|
|
3995
|
+
ref: ref,
|
|
3996
|
+
dataTest: dataTest
|
|
3997
|
+
}, rest));
|
|
3998
|
+
} else if ((schema == null ? void 0 : schema.type) === 'array') {
|
|
3999
|
+
if (schema.items && schema.items.type === 'string') {
|
|
4000
|
+
var _schema$items;
|
|
4001
|
+
|
|
4002
|
+
if (schema.items.vocabularyName) {
|
|
4003
|
+
return /*#__PURE__*/React.createElement(SelectVocabulary, _extends({
|
|
4004
|
+
vocabularyName: get$1(schema, 'items.vocabularyName', null),
|
|
4005
|
+
val: val || [],
|
|
4006
|
+
className: className,
|
|
4007
|
+
classWrap: "is-fullwidth",
|
|
4008
|
+
dataTest: dataTest
|
|
4009
|
+
}, rest, {
|
|
4010
|
+
onChange: setValue,
|
|
4011
|
+
multiple: true
|
|
4012
|
+
}));
|
|
4013
|
+
} else if (schema != null && (_schema$items = schema.items) != null && _schema$items.vocabulary) {
|
|
4014
|
+
return /*#__PURE__*/React.createElement(Select, _extends({
|
|
4015
|
+
value: val || [],
|
|
4016
|
+
className: className,
|
|
4017
|
+
classWrap: "is-fullwidth",
|
|
4018
|
+
dataTest: dataTest,
|
|
4019
|
+
options: schema == null ? void 0 : schema.items.vocabulary.map(function (item) {
|
|
4020
|
+
return {
|
|
4021
|
+
text: item,
|
|
4022
|
+
value: item
|
|
4023
|
+
};
|
|
4024
|
+
}),
|
|
4025
|
+
multiple: true,
|
|
4026
|
+
onChange: setValue
|
|
4027
|
+
}, rest));
|
|
3867
4028
|
}
|
|
3868
4029
|
}
|
|
3869
4030
|
|
|
3870
|
-
return
|
|
4031
|
+
return /*#__PURE__*/React.createElement(InputList, _extends({
|
|
4032
|
+
value: val || [],
|
|
4033
|
+
className: className,
|
|
4034
|
+
onChange: function onChange(ev) {
|
|
4035
|
+
return setValue(ev);
|
|
4036
|
+
},
|
|
4037
|
+
ref: ref,
|
|
4038
|
+
dataTest: dataTest
|
|
4039
|
+
}, rest));
|
|
4040
|
+
} else if ((schema == null ? void 0 : schema.widget) === 'file') {
|
|
4041
|
+
return /*#__PURE__*/React.createElement(FileUpload, _extends({
|
|
4042
|
+
onChange: function onChange(ev) {
|
|
4043
|
+
return setValue(ev);
|
|
4044
|
+
},
|
|
4045
|
+
label: get$1(val, 'filename', null),
|
|
4046
|
+
dataTest: dataTest
|
|
4047
|
+
}, rest));
|
|
4048
|
+
} else if ((schema == null ? void 0 : schema.widget) === 'select' && schema.type === 'string') {
|
|
4049
|
+
if (schema != null && schema.vocabularyName) {
|
|
4050
|
+
return /*#__PURE__*/React.createElement(SelectVocabulary, _extends({
|
|
4051
|
+
val: val || '',
|
|
4052
|
+
className: className,
|
|
4053
|
+
appendDefault: true,
|
|
4054
|
+
classWrap: "is-fullwidth",
|
|
4055
|
+
dataTest: dataTest,
|
|
4056
|
+
onChange: setValue,
|
|
4057
|
+
vocabularyName: get$1(schema, 'vocabularyName', null)
|
|
4058
|
+
}, rest));
|
|
4059
|
+
}
|
|
4060
|
+
|
|
4061
|
+
return /*#__PURE__*/React.createElement(Select, _extends({
|
|
4062
|
+
value: val || '',
|
|
4063
|
+
className: className,
|
|
4064
|
+
appendDefault: true,
|
|
4065
|
+
classWrap: "is-fullwidth",
|
|
4066
|
+
dataTest: dataTest,
|
|
4067
|
+
options: schema == null ? void 0 : schema.vocabulary.map(function (item) {
|
|
4068
|
+
return {
|
|
4069
|
+
text: item,
|
|
4070
|
+
value: item
|
|
4071
|
+
};
|
|
4072
|
+
}),
|
|
4073
|
+
onChange: setValue
|
|
4074
|
+
}, rest));
|
|
4075
|
+
}
|
|
4076
|
+
|
|
4077
|
+
var getInputType = function getInputType() {
|
|
4078
|
+
switch (schema == null ? void 0 : schema.type) {
|
|
4079
|
+
case 'integer':
|
|
4080
|
+
return 'number';
|
|
4081
|
+
|
|
4082
|
+
case 'date':
|
|
4083
|
+
return 'date';
|
|
4084
|
+
|
|
4085
|
+
case 'datetime':
|
|
4086
|
+
return 'datetime-local';
|
|
4087
|
+
|
|
4088
|
+
default:
|
|
4089
|
+
return 'text';
|
|
4090
|
+
}
|
|
3871
4091
|
};
|
|
3872
4092
|
|
|
3873
|
-
return /*#__PURE__*/React.createElement(
|
|
3874
|
-
|
|
4093
|
+
return /*#__PURE__*/React.createElement(Input, _extends({
|
|
4094
|
+
value: val || '',
|
|
4095
|
+
className: className,
|
|
4096
|
+
dataTest: dataTest,
|
|
4097
|
+
onChange: function onChange(ev) {
|
|
4098
|
+
return setValue(ev);
|
|
4099
|
+
},
|
|
4100
|
+
ref: ref,
|
|
4101
|
+
type: getInputType()
|
|
4102
|
+
}, rest));
|
|
4103
|
+
});
|
|
4104
|
+
EditComponent.displayName = 'EditComponent';
|
|
3875
4105
|
|
|
3876
4106
|
function IAttachment(_ref) {
|
|
3877
4107
|
var properties = _ref.properties,
|
|
@@ -6085,74 +6315,6 @@ function SearchVocabularyLabels(props) {
|
|
|
6085
6315
|
return null;
|
|
6086
6316
|
}
|
|
6087
6317
|
|
|
6088
|
-
var SelectVocabulary = React.forwardRef(function (_ref, ref) {
|
|
6089
|
-
var vocabularyName = _ref.vocabularyName,
|
|
6090
|
-
className = _ref.className,
|
|
6091
|
-
classWrap = _ref.classWrap,
|
|
6092
|
-
val = _ref.val,
|
|
6093
|
-
dataTest = _ref.dataTest,
|
|
6094
|
-
multiple = _ref.multiple,
|
|
6095
|
-
rest = _objectWithoutPropertiesLoose(_ref, ["vocabularyName", "className", "classWrap", "val", "dataTest", "multiple"]);
|
|
6096
|
-
|
|
6097
|
-
var vocabulary = useVocabulary(vocabularyName);
|
|
6098
|
-
|
|
6099
|
-
var getOptions = function getOptions() {
|
|
6100
|
-
if (get$1(vocabulary, 'data.items', null)) {
|
|
6101
|
-
var vocData = vocabulary.data.items.map(function (item) {
|
|
6102
|
-
var _item$title$default;
|
|
6103
|
-
|
|
6104
|
-
return {
|
|
6105
|
-
text: (_item$title$default = item.title.default) != null ? _item$title$default : item.title,
|
|
6106
|
-
value: item.token
|
|
6107
|
-
};
|
|
6108
|
-
});
|
|
6109
|
-
return vocData;
|
|
6110
|
-
}
|
|
6111
|
-
|
|
6112
|
-
return [];
|
|
6113
|
-
};
|
|
6114
|
-
|
|
6115
|
-
var getProps = function getProps() {
|
|
6116
|
-
if (multiple) {
|
|
6117
|
-
var currentValue = val || [];
|
|
6118
|
-
return {
|
|
6119
|
-
multiple: true,
|
|
6120
|
-
size: 5,
|
|
6121
|
-
value: currentValue,
|
|
6122
|
-
options: getOptions()
|
|
6123
|
-
};
|
|
6124
|
-
}
|
|
6125
|
-
|
|
6126
|
-
return {
|
|
6127
|
-
value: val != null ? val : '',
|
|
6128
|
-
appendDefault: true,
|
|
6129
|
-
options: getOptions()
|
|
6130
|
-
};
|
|
6131
|
-
};
|
|
6132
|
-
|
|
6133
|
-
if (vocabulary.data === undefined || vocabulary.loading) {
|
|
6134
|
-
return /*#__PURE__*/React.createElement("div", null);
|
|
6135
|
-
}
|
|
6136
|
-
|
|
6137
|
-
return /*#__PURE__*/React.createElement(Select, _extends({}, getProps(), {
|
|
6138
|
-
className: className,
|
|
6139
|
-
classWrap: classWrap || 'is-fullwidth',
|
|
6140
|
-
dataTest: dataTest,
|
|
6141
|
-
ref: ref
|
|
6142
|
-
}, rest));
|
|
6143
|
-
});
|
|
6144
|
-
Select.propTypes = {
|
|
6145
|
-
error: PropTypes.string,
|
|
6146
|
-
disabled: PropTypes.bool,
|
|
6147
|
-
loading: PropTypes.bool,
|
|
6148
|
-
isSubmitted: PropTypes.bool,
|
|
6149
|
-
size: PropTypes.number,
|
|
6150
|
-
onChange: PropTypes.func,
|
|
6151
|
-
multiple: PropTypes.bool,
|
|
6152
|
-
className: PropTypes.string,
|
|
6153
|
-
vocabularyName: PropTypes.string
|
|
6154
|
-
};
|
|
6155
|
-
|
|
6156
6318
|
var initialState$1 = {
|
|
6157
6319
|
page: 0,
|
|
6158
6320
|
items: [],
|
|
@@ -9208,142 +9370,6 @@ var buildPaths = function buildPaths(segments) {
|
|
|
9208
9370
|
return results;
|
|
9209
9371
|
};
|
|
9210
9372
|
|
|
9211
|
-
var EditComponent = React.forwardRef(function (_ref, ref) {
|
|
9212
|
-
var schema = _ref.schema,
|
|
9213
|
-
val = _ref.val,
|
|
9214
|
-
setValue = _ref.setValue,
|
|
9215
|
-
dataTest = _ref.dataTest,
|
|
9216
|
-
className = _ref.className,
|
|
9217
|
-
rest = _objectWithoutPropertiesLoose(_ref, ["schema", "val", "setValue", "dataTest", "className"]);
|
|
9218
|
-
|
|
9219
|
-
if ((schema == null ? void 0 : schema.widget) === 'textarea' || (schema == null ? void 0 : schema.widget) === 'richtext') {
|
|
9220
|
-
return /*#__PURE__*/React.createElement(Textarea, _extends({
|
|
9221
|
-
value: val || '',
|
|
9222
|
-
className: className,
|
|
9223
|
-
onChange: function onChange(ev) {
|
|
9224
|
-
return setValue(ev);
|
|
9225
|
-
},
|
|
9226
|
-
ref: ref,
|
|
9227
|
-
dataTest: dataTest
|
|
9228
|
-
}, rest));
|
|
9229
|
-
} else if ((schema == null ? void 0 : schema.type) === 'boolean') {
|
|
9230
|
-
return /*#__PURE__*/React.createElement(Checkbox, _extends({
|
|
9231
|
-
value: !!val,
|
|
9232
|
-
className: className,
|
|
9233
|
-
onChange: function onChange(ev) {
|
|
9234
|
-
return setValue(ev);
|
|
9235
|
-
},
|
|
9236
|
-
ref: ref,
|
|
9237
|
-
dataTest: dataTest
|
|
9238
|
-
}, rest));
|
|
9239
|
-
} else if ((schema == null ? void 0 : schema.type) === 'array') {
|
|
9240
|
-
if (schema.items && schema.items.type === 'string') {
|
|
9241
|
-
var _schema$items;
|
|
9242
|
-
|
|
9243
|
-
if (schema.items.vocabularyName) {
|
|
9244
|
-
return /*#__PURE__*/React.createElement(SelectVocabulary, _extends({
|
|
9245
|
-
vocabularyName: get$1(schema, 'items.vocabularyName', null),
|
|
9246
|
-
val: val || [],
|
|
9247
|
-
className: className,
|
|
9248
|
-
classWrap: "is-fullwidth",
|
|
9249
|
-
dataTest: dataTest
|
|
9250
|
-
}, rest, {
|
|
9251
|
-
onChange: setValue,
|
|
9252
|
-
multiple: true
|
|
9253
|
-
}));
|
|
9254
|
-
} else if (schema != null && (_schema$items = schema.items) != null && _schema$items.vocabulary) {
|
|
9255
|
-
return /*#__PURE__*/React.createElement(Select, _extends({
|
|
9256
|
-
value: val || [],
|
|
9257
|
-
className: className,
|
|
9258
|
-
classWrap: "is-fullwidth",
|
|
9259
|
-
dataTest: dataTest,
|
|
9260
|
-
options: schema == null ? void 0 : schema.items.vocabulary.map(function (item) {
|
|
9261
|
-
return {
|
|
9262
|
-
text: item,
|
|
9263
|
-
value: item
|
|
9264
|
-
};
|
|
9265
|
-
}),
|
|
9266
|
-
multiple: true,
|
|
9267
|
-
onChange: setValue
|
|
9268
|
-
}, rest));
|
|
9269
|
-
}
|
|
9270
|
-
}
|
|
9271
|
-
|
|
9272
|
-
return /*#__PURE__*/React.createElement(InputList, _extends({
|
|
9273
|
-
value: val || [],
|
|
9274
|
-
className: className,
|
|
9275
|
-
onChange: function onChange(ev) {
|
|
9276
|
-
return setValue(ev);
|
|
9277
|
-
},
|
|
9278
|
-
ref: ref,
|
|
9279
|
-
dataTest: dataTest
|
|
9280
|
-
}, rest));
|
|
9281
|
-
} else if ((schema == null ? void 0 : schema.widget) === 'file') {
|
|
9282
|
-
return /*#__PURE__*/React.createElement(FileUpload, _extends({
|
|
9283
|
-
onChange: function onChange(ev) {
|
|
9284
|
-
return setValue(ev);
|
|
9285
|
-
},
|
|
9286
|
-
label: get$1(val, 'filename', null),
|
|
9287
|
-
dataTest: dataTest
|
|
9288
|
-
}, rest));
|
|
9289
|
-
} else if ((schema == null ? void 0 : schema.widget) === 'select' && schema.type === 'string') {
|
|
9290
|
-
if (schema != null && schema.vocabularyName) {
|
|
9291
|
-
return /*#__PURE__*/React.createElement(SelectVocabulary, _extends({
|
|
9292
|
-
val: val || '',
|
|
9293
|
-
className: className,
|
|
9294
|
-
appendDefault: true,
|
|
9295
|
-
classWrap: "is-fullwidth",
|
|
9296
|
-
dataTest: dataTest,
|
|
9297
|
-
onChange: setValue,
|
|
9298
|
-
vocabularyName: get$1(schema, 'vocabularyName', null)
|
|
9299
|
-
}, rest));
|
|
9300
|
-
}
|
|
9301
|
-
|
|
9302
|
-
return /*#__PURE__*/React.createElement(Select, _extends({
|
|
9303
|
-
value: val || '',
|
|
9304
|
-
className: className,
|
|
9305
|
-
appendDefault: true,
|
|
9306
|
-
classWrap: "is-fullwidth",
|
|
9307
|
-
dataTest: dataTest,
|
|
9308
|
-
options: schema == null ? void 0 : schema.vocabulary.map(function (item) {
|
|
9309
|
-
return {
|
|
9310
|
-
text: item,
|
|
9311
|
-
value: item
|
|
9312
|
-
};
|
|
9313
|
-
}),
|
|
9314
|
-
onChange: setValue
|
|
9315
|
-
}, rest));
|
|
9316
|
-
}
|
|
9317
|
-
|
|
9318
|
-
var getInputType = function getInputType() {
|
|
9319
|
-
switch (schema == null ? void 0 : schema.type) {
|
|
9320
|
-
case 'integer':
|
|
9321
|
-
return 'number';
|
|
9322
|
-
|
|
9323
|
-
case 'date':
|
|
9324
|
-
return 'date';
|
|
9325
|
-
|
|
9326
|
-
case 'datetime':
|
|
9327
|
-
return 'datetime-local';
|
|
9328
|
-
|
|
9329
|
-
default:
|
|
9330
|
-
return 'text';
|
|
9331
|
-
}
|
|
9332
|
-
};
|
|
9333
|
-
|
|
9334
|
-
return /*#__PURE__*/React.createElement(Input, _extends({
|
|
9335
|
-
value: val || '',
|
|
9336
|
-
className: className,
|
|
9337
|
-
dataTest: dataTest,
|
|
9338
|
-
onChange: function onChange(ev) {
|
|
9339
|
-
return setValue(ev);
|
|
9340
|
-
},
|
|
9341
|
-
ref: ref,
|
|
9342
|
-
type: getInputType()
|
|
9343
|
-
}, rest));
|
|
9344
|
-
});
|
|
9345
|
-
EditComponent.displayName = 'EditComponent';
|
|
9346
|
-
|
|
9347
9373
|
var registry = {
|
|
9348
9374
|
paths: {},
|
|
9349
9375
|
views: {
|
|
@@ -13074,5 +13100,5 @@ var Auth = /*#__PURE__*/function () {
|
|
|
13074
13100
|
return Auth;
|
|
13075
13101
|
}();
|
|
13076
13102
|
|
|
13077
|
-
export { AddItem, AddPermission, AllItemsCheckbox, ApplicationCtx, Auth, AuthContext, BaseForm, BehaviorNotImplemented, BehaviorsView, Button, Checkbox, ClientContext, ClientProvider, Config, Confirm, ContainerCtx, ContextToolbar, CreateButton, CreateContainer, DatabaseCtx, Delete, DownloadField, 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, 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 };
|
|
13103
|
+
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 };
|
|
13078
13104
|
//# sourceMappingURL=react-gmi.esm.js.map
|