Skip to content

Commit 9897c56

Browse files
authored
geosolutions-it#5290: Improved custom editors documentation. (geosolutions-it#5421)
1 parent 9f872a8 commit 9897c56

File tree

11 files changed

+38
-11
lines changed

11 files changed

+38
-11
lines changed

Diff for: build/docma-config.json

+1
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@
111111
"web/client/components/notifications/NotificationContainer.jsx",
112112
"web/client/components/buttons/ToggleButton.jsx",
113113
"web/client/components/data/featuregrid/FeatureGrid.jsx",
114+
"web/client/components/data/featuregrid/editors/index.jsdoc",
114115
"web/client/components/data/featuregrid/editors/customEditors.jsx",
115116
"web/client/components/data/featuregrid/editors/DropDownEditor.jsx",
116117
"web/client/components/data/featuregrid/editors/FormatEditor.jsx",

Diff for: docma-template/js/app.js

+6-3
Original file line numberDiff line numberDiff line change
@@ -248,9 +248,12 @@
248248
docma.on('render', function (currentRoute) {
249249

250250
// CUSTOMIZATION: workaround to fix hash links that was not working anymore
251-
var old = window.location.hash;
252-
window.location.hash = "";
253-
window.location.hash = old;
251+
setTimeout(function() {
252+
var old = window.location.hash;
253+
window.location.hash = "";
254+
window.location.hash = old;
255+
}, 200);
256+
254257
// end of workaround
255258

256259
$('[data-toggle="tooltip"]').tooltip({

Diff for: web/client/components/data/featuregrid/FeatureGrid.jsx

+1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ const {isValidValueForPropertyName, isProperty} = require('../../../utils/Featur
1818
* A component that gets the describeFeatureType and the features to display
1919
* attributes
2020
* @class
21+
* @name FeatureGrid
2122
* @memberof components.data.featuregrid
2223
* @prop {geojson[]} features array of geojson features
2324
* @prop {object} describeFeatureType the describeFeatureType in json format

Diff for: web/client/components/data/featuregrid/editors/AttributeEditor.jsx

+7
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
const PropTypes = require('prop-types');
22
const { editors } = require('react-data-grid');
33

4+
/**
5+
* Base Class of attribute editor for FeatureGrid
6+
*
7+
* @name AttributeEditor
8+
* @memberof components.data.featuregrid.editors
9+
* @type {Object}
10+
*/
411
class AttributeEditor extends editors.SimpleTextEditor {
512
static propTypes = {
613
onTemporaryChanges: PropTypes.func

Diff for: web/client/components/data/featuregrid/editors/AutocompleteEditor.jsx

+7
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,13 @@ const {AutocompleteCombobox} = require('../../../misc/AutocompleteCombobox');
1212
const {getParsedUrl} = require('../../../../utils/ConfigUtils');
1313
const {createPagedUniqueAutompleteStream} = require('../../../../observables/autocomplete');
1414

15+
/**
16+
* Editor for FeatureGrid, used for strings with auto-complete
17+
*
18+
* @name AutocompleteEditor
19+
* @memberof components.data.featuregrid.editors
20+
* @type {Object}
21+
*/
1522
class AutocompleteEditor extends AttributeEditor {
1623
static propTypes = {
1724
column: PropTypes.object,

Diff for: web/client/components/data/featuregrid/editors/DropDownEditor.jsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,10 @@ const {head} = require('lodash');
1414
const assign = require('object-assign');
1515

1616
/**
17+
* Editor that provides a DropDown menu of a list of elements passed.
1718
* @memberof components.data.featuregrid.editors
18-
* @name DropDownEditor
1919
* @class
20+
* @name DropDownEditor
2021
* @prop {string[]} editorProps.values list of valid values
2122
*/
2223
class DropDownEditor extends AttributeEditor {

Diff for: web/client/components/data/featuregrid/editors/FormatEditor.jsx

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import React from 'react';
1010
import PropTypes from 'prop-types';
1111

1212
/**
13+
* Editor of the FeatureGrid that uses a regex passed as prop to validate the input.
1314
* @memberof components.data.featuregrid.editors
1415
* @name FormatEditor
1516
* @class

Diff for: web/client/components/data/featuregrid/editors/NumberEditor.jsx

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ const parsers = {
1616
};
1717

1818
/**
19+
* Editor of the FeatureGrid, that allows to insert a number, limited by `minValue` and `maxValue`
1920
* @memberof components.data.featuregrid.editors
2021
* @name NumberEditor
2122
* @class

Diff for: web/client/components/data/featuregrid/editors/customEditors.jsx

+5-5
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,14 @@ const FormatEditor = require('./FormatEditor').default;
2323
*
2424
* Currently custom editors available by default are:
2525
*
26-
* * DropDownEditor - editor that allows to choose a value from a preconfigured values list
27-
* * NumberEditor - editor that supports numeric data, setting min/max bounds on a value
28-
* * FormatEditor - editor that checks if data matches a particular regular expression
26+
* * {@link #components.data.featuregrid.editors.DropDownEditor | DropDownEditor} - editor that allows to choose a value from a preconfigured values list
27+
* * {@link #components.data.featuregrid.editors.NumberEditor | NumberEditor} - editor that supports numeric data, setting min/max bounds on a value
28+
* * {@link #components.data.featuregrid.editors.FormatEditor | FormatEditor} - editor that checks if data matches a particular regular expression
2929
*
3030
* Each editor has a specific section in framework documentation with available properties.
3131
*
32-
* @name Editors
33-
* @memberof components.data.featuregrid
32+
* @name customEditors
33+
* @memberof components.data.featuregrid.editors
3434
* @type {Object}
3535
*/
3636
const Editors = {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
/**
2+
* Available Attribute Editors for FeatureGrid.
3+
* Here you can find the default editors for the various data types and the {@link #components.data.featuregrid.editors.customEditors | Custom Editors} that can be used to force editing constraints to certain attributes.
4+
* @name editors
5+
* @memberof components.data.featuregrid
6+
*/

Diff for: web/client/plugins/FeatureEditor.jsx

+1-2
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ const Dock = connect(createSelector(
4848
* @prop {object} cfg.customEditorsOptions Set of options used to connect the custom editors to the featuregrid. It contains a set of
4949
* `rules`.
5050
* Each rule in the `rules` array contains:
51-
* - `editor`: the string name of the editor. For more information about custom editors and their specific props (`editorProps`), see {@link api/framework#components.data.featuregrid.Editors}
51+
* - `editor`: the string name of the editor. For more information about custom editors and their specific props (`editorProps`), see {@link api/framework#components.data.featuregrid.editors.customEditors}
5252
* - `regex`: An object with 2 regular expression, `attribute` and `typeName` that have to match with the specific attribute name and feature type name.
5353
* - `editorProps`: the properties to pass to the specific editor.
5454
* Example:
@@ -73,7 +73,6 @@ const Dock = connect(createSelector(
7373
* }]
7474
*}
7575
* ```
76-
* For more information about custom editors, see {@link api/framework#components.data.featuregrid.Editors}
7776
* @prop {object} cfg.editingAllowedRoles array of user roles allowed to enter in edit mode
7877
* @prop {boolean} cfg.virtualScroll default true. Activates virtualScroll. When false the grid uses normal pagination
7978
* @prop {number} cfg.maxStoredPages default 5. In virtual Scroll mode determines the size of the loaded pages cache

0 commit comments

Comments
 (0)