diff --git a/web/client/components/data/featuregrid/editors/AutocompleteEditor.jsx b/web/client/components/data/featuregrid/editors/AutocompleteEditor.jsx index 73958e2133..dac0f942ae 100644 --- a/web/client/components/data/featuregrid/editors/AutocompleteEditor.jsx +++ b/web/client/components/data/featuregrid/editors/AutocompleteEditor.jsx @@ -31,7 +31,8 @@ class AutocompleteEditor extends AttributeEditor { autocompleteStreamFactory: PropTypes.func, url: PropTypes.string, typeName: PropTypes.string, - value: PropTypes.string + value: PropTypes.string, + disabled: PropTypes.bool }; static defaultProps = { isValid: () => true, diff --git a/web/client/components/data/featuregrid/editors/DateTimeEditor.jsx b/web/client/components/data/featuregrid/editors/DateTimeEditor.jsx index 7e15feb058..6388535316 100644 --- a/web/client/components/data/featuregrid/editors/DateTimeEditor.jsx +++ b/web/client/components/data/featuregrid/editors/DateTimeEditor.jsx @@ -35,7 +35,8 @@ class DateTimeEditor extends AttributeEditor { calendar: PropTypes.bool, time: PropTypes.bool, onChange: PropTypes.func, - onBlur: PropTypes.func + onBlur: PropTypes.func, + disabled: PropTypes.bool }; static contextTypes = { diff --git a/web/client/components/data/featuregrid/editors/DropDownEditor.jsx b/web/client/components/data/featuregrid/editors/DropDownEditor.jsx index 2dbc8f484c..3f0bcc83f4 100644 --- a/web/client/components/data/featuregrid/editors/DropDownEditor.jsx +++ b/web/client/components/data/featuregrid/editors/DropDownEditor.jsx @@ -40,7 +40,8 @@ class DropDownEditor extends AttributeEditor { filter: PropTypes.string, values: PropTypes.array, labels: PropTypes.array, - emptyValue: PropTypes.string + emptyValue: PropTypes.string, + disabled: PropTypes.bool }; static defaultProps = { isValid: () => true, diff --git a/web/client/components/data/featuregrid/editors/FormatEditor.jsx b/web/client/components/data/featuregrid/editors/FormatEditor.jsx index c83d819368..47f11228f8 100644 --- a/web/client/components/data/featuregrid/editors/FormatEditor.jsx +++ b/web/client/components/data/featuregrid/editors/FormatEditor.jsx @@ -23,7 +23,8 @@ export default class FormatEditor extends React.Component { dataType: PropTypes.string, column: PropTypes.object, formatRegex: PropTypes.string, - onTemporaryChanges: PropTypes.func + onTemporaryChanges: PropTypes.func, + disabled: PropTypes.bool }; static defaultProps = { @@ -61,6 +62,7 @@ export default class FormatEditor extends React.Component { render() { return ( { + getEditor: (desc, field) => { const generalProps = { onTemporaryChanges: props.gridEvents && props.gridEvents.onTemporaryChanges, autocompleteEnabled: props.autocompleteEnabled, url: props.url, - typeName: props.typeName + typeName: props.typeName, + disabled: field && field?.editable === false }; const regexProps = {attribute: desc.name, url: props.url, typeName: props.typeName}; const rules = props.customEditorsOptions && props.customEditorsOptions.rules || []; @@ -169,7 +170,8 @@ const featuresToGrid = compose( if (!isNil(editor)) { return editor; } - return props.editors(desc.localType, generalProps); + const typeEditor = props.editors(desc.localType, generalProps); + return typeEditor; }, getFilterRenderer: getFilterRendererFunc, getFormatter: (desc) => getFormatter(desc, (props.fields ?? []).find(f => f.name === desc.name)), diff --git a/web/client/components/data/featuregrid/renderers/CellRenderer.jsx b/web/client/components/data/featuregrid/renderers/CellRenderer.jsx index d8157f745c..d517942656 100644 --- a/web/client/components/data/featuregrid/renderers/CellRenderer.jsx +++ b/web/client/components/data/featuregrid/renderers/CellRenderer.jsx @@ -28,6 +28,7 @@ class CellRenderer extends React.Component { const isValid = isProperty ? this.context.isValid(this.props.rowData.get(this.props.column.key), this.props.column.key) : true; const className = (isModified ? ['modified'] : []) .concat(isValid ? [] : ['invalid']).join(" "); + console.log(this.props); return ; } } diff --git a/web/client/components/misc/AutocompleteCombobox.jsx b/web/client/components/misc/AutocompleteCombobox.jsx index d4d8fb4b13..eeaefc23bc 100644 --- a/web/client/components/misc/AutocompleteCombobox.jsx +++ b/web/client/components/misc/AutocompleteCombobox.jsx @@ -38,7 +38,8 @@ const streamEnhancer = mapPropsStream(props$ => { busy: data.busy, dropUp: props.dropUp, attribute: props.column && props.column.key, - changeAttribute: props.changeAttribute + changeAttribute: props.changeAttribute, + disabled: props.disabled })); }); @@ -46,13 +47,13 @@ const streamEnhancer = mapPropsStream(props$ => { const PagedComboboxEnhanced = streamEnhancer( ({ open, toggle, select, focus, change, value, valuesCount, loadNextPage, loadPrevPage, maxFeatures, currentPage, - busy, data, loading = false, dropUp = false, attribute, changeAttribute}) => { + busy, data, loading = false, dropUp = false, attribute, changeAttribute, disabled = false}) => { const numberOfPages = Math.ceil(valuesCount / maxFeatures); return (); + selectedValue={value} loading={loading} disabled={disabled}/>); }); // state enhancer for local props @@ -60,8 +61,10 @@ const addStateHandlers = compose( withStateHandlers((props) => ({ delayDebounce: 0, performFetch: false, + disabled: false, open: false, openOnFocus: props.openOnFocus, + disabled: props.disabled, currentPage: 1, maxFeatures: 5, url: props.url, diff --git a/web/client/components/misc/combobox/ControlledCombobox.jsx b/web/client/components/misc/combobox/ControlledCombobox.jsx index e83ca8727e..61e05a30ce 100644 --- a/web/client/components/misc/combobox/ControlledCombobox.jsx +++ b/web/client/components/misc/combobox/ControlledCombobox.jsx @@ -13,7 +13,7 @@ import PagedCombobox from './PagedCombobox'; // state enhancer for local props import addState from './addState'; -const ControlledCombobox = addState(({ toggle, select, focus, change, value, busy, data, loading = false, filter, open }) => { +const ControlledCombobox = addState(({ toggle, select, focus, change, value, busy, data, loading = false, filter, open, disabled }) => { return (); }); diff --git a/web/client/utils/FeatureGridUtils.js b/web/client/utils/FeatureGridUtils.js index b5406acd93..0af95d50ec 100644 --- a/web/client/utils/FeatureGridUtils.js +++ b/web/client/utils/FeatureGridUtils.js @@ -134,6 +134,9 @@ export const featureTypeToGridColumns = ( getAttributeFields(describe).filter(e => !(columnSettings[e.name] && columnSettings[e.name].hide)).map((desc) => { const option = options.find(o => o.name === desc.name); const field = fields.find(f => f.name === desc.name); + if(field && field.name === "id_emprise") { + field.editable = false; + } let columnProp = { sortable, key: desc.name, @@ -144,7 +147,7 @@ export const featureTypeToGridColumns = ( headerRenderer: getHeaderRenderer(), showTitleTooltip: !!option?.description, resizable, - editable, + editable: field.editable === false ? false : editable, filterable, editor: getEditor(desc, field), formatter: getFormatter(desc, field),