@mwater/visualization 5.5.0 → 5.6.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/lib/MWaterContextComponent.d.ts +1 -1
- package/lib/MWaterGlobalFiltersComponent.d.ts +2 -2
- package/lib/MWaterGlobalFiltersComponent.js +11 -20
- package/lib/MWaterLoaderComponent.d.ts +4 -13
- package/lib/MWaterLoaderComponent.js +2 -11
- package/lib/UndoStack.d.ts +2 -1
- package/lib/UndoStack.js +12 -6
- package/lib/dashboards/DashboardComponent.js +5 -4
- package/lib/dashboards/DashboardDesign.d.ts +1 -1
- package/lib/dashboards/ServerDashboardDataSource.js +0 -10
- package/lib/dashboards/SettingsModalComponent.js +1 -1
- package/lib/datagrids/DatagridComponent.js +22 -2
- package/lib/datagrids/DatagridDesignerComponent.d.ts +2 -3
- package/lib/datagrids/DatagridDesignerComponent.js +108 -120
- package/lib/datagrids/DatagridViewComponent.js +3 -2
- package/lib/datagrids/OrderBysDesignerComponent.d.ts +7 -7
- package/lib/datagrids/OrderBysDesignerComponent.js +19 -28
- package/lib/index.css +45 -2
- package/lib/index.d.ts +5 -5
- package/lib/index.js +2 -3
- package/lib/layouts/blocks/BlocksDisplayComponent.d.ts +8 -1
- package/lib/layouts/blocks/BlocksDisplayComponent.js +46 -4
- package/lib/maps/BufferLayer.js +12 -0
- package/lib/maps/BufferLayerDesign.d.ts +1 -1
- package/lib/maps/BufferLayerDesignerComponent.js +2 -2
- package/lib/maps/ChoroplethLayer.js +12 -0
- package/lib/maps/ChoroplethLayerDesign.d.ts +5 -2
- package/lib/maps/ChoroplethLayerDesigner.d.ts +10 -32
- package/lib/maps/ChoroplethLayerDesigner.js +58 -89
- package/lib/maps/DirectMapDataSource.js +0 -10
- package/lib/maps/EditHoverOver.d.ts +4 -3
- package/lib/maps/EditHoverOver.js +3 -3
- package/lib/maps/HoverContent.js +1 -1
- package/lib/maps/LeafletMapComponent.js +10 -19
- package/lib/maps/MapComponent.js +0 -1
- package/lib/maps/MapUtils.js +10 -1
- package/lib/maps/MarkersLayer.js +18 -2
- package/lib/maps/MarkersLayerDesign.d.ts +1 -1
- package/lib/maps/MarkersLayerDesignerComponent.d.ts +12 -41
- package/lib/maps/MarkersLayerDesignerComponent.js +81 -111
- package/lib/maps/ServerMapDataSource.js +0 -10
- package/lib/maps/VectorMapViewComponent.js +1 -9
- package/lib/maps/symbols/font-awesome/asterisk.png +0 -0
- package/lib/maps/symbols/font-awesome/ban.png +0 -0
- package/lib/maps/symbols/font-awesome/beer.png +0 -0
- package/lib/maps/symbols/font-awesome/bell.png +0 -0
- package/lib/maps/symbols/font-awesome/bolt.png +0 -0
- package/lib/maps/symbols/font-awesome/building.png +0 -0
- package/lib/maps/symbols/font-awesome/bullseye.png +0 -0
- package/lib/maps/symbols/font-awesome/bus.png +0 -0
- package/lib/maps/symbols/font-awesome/caret-up.png +0 -0
- package/lib/maps/symbols/font-awesome/certificate.png +0 -0
- package/lib/maps/symbols/font-awesome/check-circle.png +0 -0
- package/lib/maps/symbols/font-awesome/check.png +0 -0
- package/lib/maps/symbols/font-awesome/chevron-circle-down.png +0 -0
- package/lib/maps/symbols/font-awesome/chevron-circle-up.png +0 -0
- package/lib/maps/symbols/font-awesome/cloud-rain.png +0 -0
- package/lib/maps/symbols/font-awesome/cloud.png +0 -0
- package/lib/maps/symbols/font-awesome/comment.png +0 -0
- package/lib/maps/symbols/font-awesome/crosshairs.png +0 -0
- package/lib/maps/symbols/font-awesome/dot-circle-o.png +0 -0
- package/lib/maps/symbols/font-awesome/exclamation-circle.png +0 -0
- package/lib/maps/symbols/font-awesome/exclamation-triangle.png +0 -0
- package/lib/maps/symbols/font-awesome/female.png +0 -0
- package/lib/maps/symbols/font-awesome/file.png +0 -0
- package/lib/maps/symbols/font-awesome/flag.png +0 -0
- package/lib/maps/symbols/font-awesome/flask.png +0 -0
- package/lib/maps/symbols/font-awesome/h-square.png +0 -0
- package/lib/maps/symbols/font-awesome/home.png +0 -0
- package/lib/maps/symbols/font-awesome/info-circle.png +0 -0
- package/lib/maps/symbols/font-awesome/male.png +0 -0
- package/lib/maps/symbols/font-awesome/medkit.png +0 -0
- package/lib/maps/symbols/font-awesome/mobile.png +0 -0
- package/lib/maps/symbols/font-awesome/plus-circle.png +0 -0
- package/lib/maps/symbols/font-awesome/plus-square.png +0 -0
- package/lib/maps/symbols/font-awesome/plus.png +0 -0
- package/lib/maps/symbols/font-awesome/square.png +0 -0
- package/lib/maps/symbols/font-awesome/star.png +0 -0
- package/lib/maps/symbols/font-awesome/thumbs-down.png +0 -0
- package/lib/maps/symbols/font-awesome/thumbs-up.png +0 -0
- package/lib/maps/symbols/font-awesome/ticket.png +0 -0
- package/lib/maps/symbols/font-awesome/times-circle.png +0 -0
- package/lib/maps/symbols/font-awesome/times.png +0 -0
- package/lib/maps/symbols/font-awesome/tint.png +0 -0
- package/lib/maps/symbols/font-awesome/tree.png +0 -0
- package/lib/maps/symbols/font-awesome/university.png +0 -0
- package/lib/maps/symbols/font-awesome/usd.png +0 -0
- package/lib/maps/symbols/font-awesome/user.png +0 -0
- package/lib/maps/symbols/font-awesome/users.png +0 -0
- package/lib/maps/symbols/font-awesome/wheelchair.png +0 -0
- package/lib/maps/symbols/sdf-ize.sh +93 -0
- package/lib/maps/vectorMaps.d.ts +1 -0
- package/lib/maps/vectorMaps.js +20 -36
- package/lib/mwater_table_selection/IndicatorsListComponent.d.ts +4 -2
- package/lib/mwater_table_selection/IndicatorsListComponent.js +103 -34
- package/lib/mwater_table_selection/MWaterCalculatedDataSourcesListComponent.d.ts +18 -0
- package/lib/mwater_table_selection/MWaterCalculatedDataSourcesListComponent.js +80 -0
- package/lib/mwater_table_selection/MWaterCompleteTableSelectComponent.d.ts +26 -0
- package/lib/mwater_table_selection/MWaterCompleteTableSelectComponent.js +237 -51
- package/lib/mwater_table_selection/MWaterTableSelectComponent.d.ts +2 -2
- package/lib/mwater_table_selection/MWaterTableSelectComponent.js +9 -4
- package/lib/mwater_table_selection/MWaterWorkflowsSelectComponent.d.ts +19 -0
- package/lib/mwater_table_selection/MWaterWorkflowsSelectComponent.js +111 -0
- package/lib/quickfilter/QuickfiltersComponent.d.ts +3 -102
- package/lib/quickfilter/QuickfiltersComponent.js +53 -110
- package/lib/quickfilter/TextLiteralComponent.d.ts +23 -47
- package/lib/quickfilter/TextLiteralComponent.js +85 -82
- package/lib/widgets/MapWidget.js +4 -2
- package/lib/widgets/text/ExprItemEditorComponent.d.ts +3 -8
- package/lib/widgets/text/ExprItemEditorComponent.js +36 -33
- package/lib/widgets/text/ExprUpdateModalComponent.d.ts +1 -0
- package/package.json +2 -3
- package/src/MWaterContextComponent.tsx +1 -1
- package/src/{MWaterGlobalFiltersComponent.ts → MWaterGlobalFiltersComponent.tsx} +32 -33
- package/src/{MWaterLoaderComponent.ts → MWaterLoaderComponent.tsx} +17 -18
- package/src/UndoStack.ts +14 -6
- package/src/dashboards/DashboardComponent.tsx +5 -4
- package/src/dashboards/DashboardDesign.ts +1 -1
- package/src/dashboards/ServerDashboardDataSource.ts +0 -12
- package/src/dashboards/SettingsModalComponent.tsx +1 -1
- package/src/datagrids/DatagridComponent.tsx +30 -2
- package/src/datagrids/DatagridDesignerComponent.tsx +241 -229
- package/src/datagrids/DatagridViewComponent.tsx +3 -2
- package/src/datagrids/OrderBysDesignerComponent.tsx +61 -70
- package/src/index.css +45 -2
- package/src/index.ts +5 -11
- package/src/layouts/blocks/BlocksDisplayComponent.tsx +60 -5
- package/src/maps/BufferLayer.ts +14 -1
- package/src/maps/BufferLayerDesign.ts +1 -1
- package/src/maps/BufferLayerDesignerComponent.tsx +2 -1
- package/src/maps/ChoroplethLayer.ts +20 -7
- package/src/maps/ChoroplethLayerDesign.ts +5 -2
- package/src/maps/ChoroplethLayerDesigner.tsx +169 -165
- package/src/maps/DirectMapDataSource.ts +0 -12
- package/src/maps/EditHoverOver.tsx +9 -5
- package/src/maps/HoverContent.tsx +1 -1
- package/src/maps/LeafletMapComponent.tsx +10 -19
- package/src/maps/MapComponent.ts +0 -1
- package/src/maps/MapUtils.ts +13 -1
- package/src/maps/MarkersLayer.ts +22 -5
- package/src/maps/MarkersLayerDesign.ts +1 -1
- package/src/maps/MarkersLayerDesignerComponent.tsx +360 -0
- package/src/maps/ServerMapDataSource.ts +0 -12
- package/src/maps/VectorMapViewComponent.tsx +2 -13
- package/src/maps/symbols/font-awesome/asterisk.png +0 -0
- package/src/maps/symbols/font-awesome/ban.png +0 -0
- package/src/maps/symbols/font-awesome/beer.png +0 -0
- package/src/maps/symbols/font-awesome/bell.png +0 -0
- package/src/maps/symbols/font-awesome/bolt.png +0 -0
- package/src/maps/symbols/font-awesome/building.png +0 -0
- package/src/maps/symbols/font-awesome/bullseye.png +0 -0
- package/src/maps/symbols/font-awesome/bus.png +0 -0
- package/src/maps/symbols/font-awesome/caret-up.png +0 -0
- package/src/maps/symbols/font-awesome/certificate.png +0 -0
- package/src/maps/symbols/font-awesome/check-circle.png +0 -0
- package/src/maps/symbols/font-awesome/check.png +0 -0
- package/src/maps/symbols/font-awesome/chevron-circle-down.png +0 -0
- package/src/maps/symbols/font-awesome/chevron-circle-up.png +0 -0
- package/src/maps/symbols/font-awesome/cloud-rain.png +0 -0
- package/src/maps/symbols/font-awesome/cloud.png +0 -0
- package/src/maps/symbols/font-awesome/comment.png +0 -0
- package/src/maps/symbols/font-awesome/crosshairs.png +0 -0
- package/src/maps/symbols/font-awesome/dot-circle-o.png +0 -0
- package/src/maps/symbols/font-awesome/exclamation-circle.png +0 -0
- package/src/maps/symbols/font-awesome/exclamation-triangle.png +0 -0
- package/src/maps/symbols/font-awesome/female.png +0 -0
- package/src/maps/symbols/font-awesome/file.png +0 -0
- package/src/maps/symbols/font-awesome/flag.png +0 -0
- package/src/maps/symbols/font-awesome/flask.png +0 -0
- package/src/maps/symbols/font-awesome/h-square.png +0 -0
- package/src/maps/symbols/font-awesome/home.png +0 -0
- package/src/maps/symbols/font-awesome/info-circle.png +0 -0
- package/src/maps/symbols/font-awesome/male.png +0 -0
- package/src/maps/symbols/font-awesome/medkit.png +0 -0
- package/src/maps/symbols/font-awesome/mobile.png +0 -0
- package/src/maps/symbols/font-awesome/plus-circle.png +0 -0
- package/src/maps/symbols/font-awesome/plus-square.png +0 -0
- package/src/maps/symbols/font-awesome/plus.png +0 -0
- package/src/maps/symbols/font-awesome/square.png +0 -0
- package/src/maps/symbols/font-awesome/star.png +0 -0
- package/src/maps/symbols/font-awesome/thumbs-down.png +0 -0
- package/src/maps/symbols/font-awesome/thumbs-up.png +0 -0
- package/src/maps/symbols/font-awesome/ticket.png +0 -0
- package/src/maps/symbols/font-awesome/times-circle.png +0 -0
- package/src/maps/symbols/font-awesome/times.png +0 -0
- package/src/maps/symbols/font-awesome/tint.png +0 -0
- package/src/maps/symbols/font-awesome/tree.png +0 -0
- package/src/maps/symbols/font-awesome/university.png +0 -0
- package/src/maps/symbols/font-awesome/usd.png +0 -0
- package/src/maps/symbols/font-awesome/user.png +0 -0
- package/src/maps/symbols/font-awesome/users.png +0 -0
- package/src/maps/symbols/font-awesome/wheelchair.png +0 -0
- package/src/maps/symbols/sdf-ize.sh +93 -0
- package/src/maps/vectorMaps.tsx +20 -44
- package/src/mwater_table_selection/IndicatorsListComponent.tsx +165 -37
- package/src/mwater_table_selection/MWaterCalculatedDataSourcesListComponent.tsx +111 -0
- package/src/mwater_table_selection/MWaterCompleteTableSelectComponent.tsx +373 -37
- package/src/mwater_table_selection/MWaterTableSelectComponent.tsx +12 -8
- package/src/mwater_table_selection/MWaterWorkflowsSelectComponent.tsx +159 -0
- package/src/quickfilter/{QuickfiltersComponent.ts → QuickfiltersComponent.tsx} +165 -158
- package/src/quickfilter/TextLiteralComponent.tsx +197 -0
- package/src/widgets/MapWidget.tsx +9 -1
- package/src/widgets/text/ExprItemEditorComponent.tsx +83 -77
- package/src/widgets/text/ExprUpdateModalComponent.tsx +1 -0
- package/test/UndoStackTests.ts +52 -1
- package/.storybook/config.js +0 -7
- package/.storybook/head.html +0 -3
- package/.storybook/webpack.config.js +0 -15
- package/src/maps/BingLayer.ts +0 -146
- package/src/maps/MarkersLayerDesignerComponent.ts +0 -374
- package/src/quickfilter/TextLiteralComponent.ts +0 -165
- package/stories/UpdateableComponent.js +0 -29
- package/stories/consoles.js +0 -202
- package/stories/dashboards.js +0 -217
- package/stories/datagridDesign.js +0 -114
- package/stories/datagrids.js +0 -69
- package/stories/dates.js +0 -80
- package/stories/exprcomponent.js +0 -43
- package/stories/index.js +0 -18
- package/stories/leaflet.js +0 -59
- package/stories/maps.js +0 -24
- package/stories/pivotChart.js +0 -235
|
@@ -28,7 +28,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
29
|
const lodash_1 = __importDefault(require("lodash"));
|
|
30
30
|
const react_1 = __importDefault(require("react"));
|
|
31
|
-
const TabbedComponent_1 = __importDefault(require("@mwater/react-library/lib/TabbedComponent"));
|
|
32
31
|
const uiComponents = __importStar(require("../UIComponents"));
|
|
33
32
|
const expressions_1 = require("@mwater/expressions");
|
|
34
33
|
const MWaterCustomTablesetListComponent_1 = require("./MWaterCustomTablesetListComponent");
|
|
@@ -38,6 +37,8 @@ const FormsListComponent_1 = require("./FormsListComponent");
|
|
|
38
37
|
const IndicatorsListComponent_1 = require("./IndicatorsListComponent");
|
|
39
38
|
const IssuesListComponent_1 = require("./IssuesListComponent");
|
|
40
39
|
const MWaterAccountingSystemListComponent_1 = require("./MWaterAccountingSystemListComponent");
|
|
40
|
+
const MWaterCalculatedDataSourcesListComponent_1 = require("./MWaterCalculatedDataSourcesListComponent");
|
|
41
|
+
const MWaterWorkflowsSelectComponent_1 = require("./MWaterWorkflowsSelectComponent");
|
|
41
42
|
const sitesOrder = {
|
|
42
43
|
"entities.water_point": 1,
|
|
43
44
|
"entities.sanitation_facility": 2,
|
|
@@ -55,23 +56,43 @@ const sitesOrder = {
|
|
|
55
56
|
const assetEntities = [
|
|
56
57
|
"entities.water_asset"
|
|
57
58
|
];
|
|
58
|
-
|
|
59
|
+
/** Allows selection of a table. Card-based layout with categories */
|
|
59
60
|
class MWaterCompleteTableSelectComponent extends react_1.default.Component {
|
|
60
61
|
constructor(props) {
|
|
61
62
|
super(props);
|
|
62
63
|
this.state = {
|
|
63
|
-
|
|
64
|
+
selectedCategory: null,
|
|
65
|
+
showLegacyAssets: false,
|
|
66
|
+
searchText: ""
|
|
64
67
|
};
|
|
65
68
|
}
|
|
66
69
|
handleExtraTableAdd = (tableId) => {
|
|
67
70
|
return this.props.onExtraTablesChange(lodash_1.default.union(this.props.extraTables, [tableId]));
|
|
68
71
|
};
|
|
69
72
|
handleExtraTableRemove = (tableId) => {
|
|
70
|
-
|
|
71
|
-
if (
|
|
72
|
-
|
|
73
|
+
const displayName = this.getExtraTableDisplayName(tableId);
|
|
74
|
+
if (!displayName) {
|
|
75
|
+
return;
|
|
73
76
|
}
|
|
74
|
-
|
|
77
|
+
if (confirm(T `Remove ${displayName}? Any widgets that depend on it will no longer work properly.`)) {
|
|
78
|
+
// Set to null if current table matches (for wildcards, check if current table starts with prefix)
|
|
79
|
+
if (tableId.endsWith(".*")) {
|
|
80
|
+
const prefix = tableId.slice(0, -2);
|
|
81
|
+
if (this.props.table && this.props.table.startsWith(prefix + ".")) {
|
|
82
|
+
this.props.onChange(null);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
else if (this.props.table === tableId) {
|
|
86
|
+
this.props.onChange(null);
|
|
87
|
+
}
|
|
88
|
+
return this.props.onExtraTablesChange(lodash_1.default.without(this.props.extraTables, tableId));
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
handleCategorySelect = (categoryId) => {
|
|
92
|
+
this.setState({ selectedCategory: categoryId });
|
|
93
|
+
};
|
|
94
|
+
handleBackToCategories = () => {
|
|
95
|
+
this.setState({ selectedCategory: null, showLegacyAssets: false });
|
|
75
96
|
};
|
|
76
97
|
renderSites() {
|
|
77
98
|
let table;
|
|
@@ -109,6 +130,9 @@ class MWaterCompleteTableSelectComponent extends react_1.default.Component {
|
|
|
109
130
|
renderIssues() {
|
|
110
131
|
return react_1.default.createElement(IssuesListComponent_1.IssuesListComponent, { schema: this.props.schema, client: this.props.client, apiUrl: this.props.apiUrl, user: this.props.user, onChange: this.props.onChange, extraTables: this.props.extraTables, onExtraTableAdd: this.handleExtraTableAdd, onExtraTableRemove: this.handleExtraTableRemove });
|
|
111
132
|
}
|
|
133
|
+
renderWorkflows() {
|
|
134
|
+
return react_1.default.createElement(MWaterWorkflowsSelectComponent_1.MWaterWorkflowsSelectComponent, { schema: this.props.schema, client: this.props.client, apiUrl: this.props.apiUrl, user: this.props.user, onChange: this.props.onChange, extraTables: this.props.extraTables, onExtraTableAdd: this.handleExtraTableAdd, onExtraTableRemove: this.handleExtraTableRemove });
|
|
135
|
+
}
|
|
112
136
|
renderSweetSense() {
|
|
113
137
|
let sweetSenseTables = this.getSweetSenseTables();
|
|
114
138
|
sweetSenseTables = lodash_1.default.sortBy(sweetSenseTables, (table) => table.name.en);
|
|
@@ -155,6 +179,9 @@ class MWaterCompleteTableSelectComponent extends react_1.default.Component {
|
|
|
155
179
|
renderLegacyAssets() {
|
|
156
180
|
return react_1.default.createElement(MWaterAssetSystemsListComponent_1.MWaterAssetSystemsListComponent, { schema: this.props.schema, client: this.props.client, apiUrl: this.props.apiUrl, user: this.props.user, onChange: this.props.onChange, extraTables: this.props.extraTables, onExtraTableAdd: this.handleExtraTableAdd, onExtraTableRemove: this.handleExtraTableRemove, locale: T.locale });
|
|
157
181
|
}
|
|
182
|
+
renderCalculated() {
|
|
183
|
+
return react_1.default.createElement(MWaterCalculatedDataSourcesListComponent_1.MWaterCalculatedDataSourcesListComponent, { schema: this.props.schema, client: this.props.client, apiUrl: this.props.apiUrl, user: this.props.user, onChange: this.props.onChange, extraTables: this.props.extraTables, onExtraTableAdd: this.handleExtraTableAdd, onExtraTableRemove: this.handleExtraTableRemove, locale: T.locale });
|
|
184
|
+
}
|
|
158
185
|
renderOther() {
|
|
159
186
|
let otherTables = lodash_1.default.filter(this.props.schema.getTables(), (table) => {
|
|
160
187
|
// Remove deprecated
|
|
@@ -193,6 +220,14 @@ class MWaterCompleteTableSelectComponent extends react_1.default.Component {
|
|
|
193
220
|
if (table.id.match(/^assets:/)) {
|
|
194
221
|
return false;
|
|
195
222
|
}
|
|
223
|
+
// Remove calculated data sources
|
|
224
|
+
if (table.id.match(/^calculated:/)) {
|
|
225
|
+
return false;
|
|
226
|
+
}
|
|
227
|
+
// Remove workflows
|
|
228
|
+
if (table.id.match(/^(workflows|workflow_events):/)) {
|
|
229
|
+
return false;
|
|
230
|
+
}
|
|
196
231
|
return true;
|
|
197
232
|
});
|
|
198
233
|
otherTables = lodash_1.default.sortBy(otherTables, (table) => table.name.en);
|
|
@@ -215,61 +250,212 @@ class MWaterCompleteTableSelectComponent extends react_1.default.Component {
|
|
|
215
250
|
return false;
|
|
216
251
|
});
|
|
217
252
|
}
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
const
|
|
221
|
-
{
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
253
|
+
/** Get all available categories */
|
|
254
|
+
getCategories() {
|
|
255
|
+
const categories = [
|
|
256
|
+
{
|
|
257
|
+
id: "sites",
|
|
258
|
+
name: T("Sites").toString(),
|
|
259
|
+
description: T("Water points, sanitation facilities, households, and other sites").toString(),
|
|
260
|
+
icon: "fa fa-map-marker",
|
|
261
|
+
render: () => this.renderSites()
|
|
262
|
+
},
|
|
263
|
+
{
|
|
264
|
+
id: "forms",
|
|
265
|
+
name: T("Surveys").toString(),
|
|
266
|
+
description: T("Data collected from survey forms").toString(),
|
|
267
|
+
icon: "fa fa-th-list",
|
|
268
|
+
render: () => this.renderForms()
|
|
269
|
+
},
|
|
270
|
+
{
|
|
271
|
+
id: "assets",
|
|
272
|
+
name: T("Assets").toString(),
|
|
273
|
+
description: T("Asset tracking and management").toString(),
|
|
274
|
+
icon: "fas fa-map-pin",
|
|
275
|
+
render: () => this.renderAssets()
|
|
276
|
+
},
|
|
229
277
|
{
|
|
230
278
|
id: "indicators",
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
elem: this.renderIndicators()
|
|
279
|
+
name: T("Indicators").toString(),
|
|
280
|
+
description: T("Calculated indicators and metrics").toString(),
|
|
281
|
+
icon: "fa fa-check-circle",
|
|
282
|
+
render: () => this.renderIndicators()
|
|
236
283
|
},
|
|
237
284
|
{
|
|
238
|
-
id: "
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
285
|
+
id: "tablesets",
|
|
286
|
+
name: T("Tables").toString(),
|
|
287
|
+
description: T("Custom tables and datasets").toString(),
|
|
288
|
+
icon: "fa fa-table",
|
|
289
|
+
render: () => this.renderTablesets()
|
|
290
|
+
},
|
|
291
|
+
{
|
|
292
|
+
id: "calculated",
|
|
293
|
+
name: T("Calculated").toString(),
|
|
294
|
+
description: T("Calculated and derived data sources").toString(),
|
|
295
|
+
icon: "fa fa-cogs",
|
|
296
|
+
render: () => this.renderCalculated()
|
|
244
297
|
},
|
|
245
|
-
{ id: "tablesets", label: react_1.default.createElement(react_1.default.Fragment, null,
|
|
246
|
-
react_1.default.createElement("i", { className: "fa fa-table" }),
|
|
247
|
-
" ",
|
|
248
|
-
T `Tables`), elem: this.renderTablesets() },
|
|
249
|
-
{ id: "metrics", label: react_1.default.createElement(react_1.default.Fragment, null,
|
|
250
|
-
react_1.default.createElement("i", { className: "fa fa-line-chart" }),
|
|
251
|
-
" ",
|
|
252
|
-
T `Metrics`), elem: this.renderMetrics() },
|
|
253
298
|
{
|
|
254
299
|
id: "accounting",
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
elem: this.renderAccountingSystems()
|
|
300
|
+
name: T("Accounting").toString(),
|
|
301
|
+
description: T("Financial and accounting data").toString(),
|
|
302
|
+
icon: "fa fa-calculator",
|
|
303
|
+
render: () => this.renderAccountingSystems()
|
|
260
304
|
},
|
|
261
|
-
{
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
305
|
+
{
|
|
306
|
+
id: "workflows",
|
|
307
|
+
name: T("Workflows").toString(),
|
|
308
|
+
description: T("Multi-step processes and workflows").toString(),
|
|
309
|
+
icon: "fa fa-project-diagram",
|
|
310
|
+
render: () => this.renderWorkflows()
|
|
311
|
+
},
|
|
312
|
+
{
|
|
313
|
+
id: "issues",
|
|
314
|
+
name: T("Issues").toString(),
|
|
315
|
+
description: T("Reported problems and issues").toString(),
|
|
316
|
+
icon: "fa fa-exclamation-circle",
|
|
317
|
+
render: () => this.renderIssues()
|
|
318
|
+
},
|
|
319
|
+
{
|
|
320
|
+
id: "metrics",
|
|
321
|
+
name: T("Metrics").toString(),
|
|
322
|
+
description: T("Performance metrics and KPIs").toString(),
|
|
323
|
+
icon: "fa fa-line-chart",
|
|
324
|
+
render: () => this.renderMetrics()
|
|
325
|
+
},
|
|
326
|
+
{
|
|
327
|
+
id: "other",
|
|
328
|
+
name: T("Advanced").toString(),
|
|
329
|
+
description: T("Other advanced data sources").toString(),
|
|
330
|
+
icon: "fa fa-ellipsis-h",
|
|
331
|
+
render: () => this.renderOther()
|
|
332
|
+
}
|
|
265
333
|
];
|
|
266
|
-
|
|
267
|
-
|
|
334
|
+
// // Add sensors if applicable
|
|
335
|
+
// const sweetSenseTables = this.getSweetSenseTables()
|
|
336
|
+
// if (sweetSenseTables.length > 0) {
|
|
337
|
+
// categories.splice(9, 0, {
|
|
338
|
+
// id: "sensors",
|
|
339
|
+
// name: T("Sensors").toString(),
|
|
340
|
+
// description: T("Sensor data and monitoring").toString(),
|
|
341
|
+
// icon: "fa fa-wifi",
|
|
342
|
+
// render: () => this.renderSweetSense()
|
|
343
|
+
// })
|
|
344
|
+
// }
|
|
345
|
+
return categories;
|
|
346
|
+
}
|
|
347
|
+
/** Render a single category card */
|
|
348
|
+
renderCategoryCard(category) {
|
|
349
|
+
return (react_1.default.createElement("div", { key: category.id, className: "card mb-2", style: {
|
|
350
|
+
cursor: "pointer",
|
|
351
|
+
transition: "background-color 0.15s, border-color 0.15s"
|
|
352
|
+
}, onMouseEnter: (e) => {
|
|
353
|
+
e.currentTarget.style.backgroundColor = "#f8f9fa";
|
|
354
|
+
e.currentTarget.style.borderColor = "#adb5bd";
|
|
355
|
+
}, onMouseLeave: (e) => {
|
|
356
|
+
e.currentTarget.style.backgroundColor = "";
|
|
357
|
+
e.currentTarget.style.borderColor = "";
|
|
358
|
+
}, onClick: () => this.handleCategorySelect(category.id) },
|
|
359
|
+
react_1.default.createElement("div", { className: "card-body d-flex align-items-center", style: { padding: "0.75rem" } },
|
|
360
|
+
react_1.default.createElement("div", { style: { fontSize: "1.75rem", width: "2.5rem", textAlign: "center", color: "#6c757d" } },
|
|
361
|
+
react_1.default.createElement("i", { className: category.icon })),
|
|
362
|
+
react_1.default.createElement("div", { style: { flex: 1, marginLeft: "0.75rem" } },
|
|
363
|
+
react_1.default.createElement("div", { style: { fontWeight: 600, fontSize: "1rem", marginBottom: "0.15rem" } }, category.name),
|
|
364
|
+
react_1.default.createElement("div", { className: "text-muted", style: { fontSize: "0.85rem" } }, category.description)),
|
|
365
|
+
react_1.default.createElement("div", { style: { color: "#adb5bd", fontSize: "1.1rem" } },
|
|
366
|
+
react_1.default.createElement("i", { className: "fa fa-chevron-right" })))));
|
|
367
|
+
}
|
|
368
|
+
/** Get display name for an extra table (handles wildcards) */
|
|
369
|
+
getExtraTableDisplayName(tableId) {
|
|
370
|
+
// Check if it's a wildcard pattern
|
|
371
|
+
if (tableId.endsWith(".*")) {
|
|
372
|
+
// Find first matching table
|
|
373
|
+
const prefix = tableId.slice(0, -2); // Remove .*
|
|
374
|
+
const matchingTable = this.props.schema.getTables().find(t => t.id.startsWith(prefix + "."));
|
|
375
|
+
if (matchingTable) {
|
|
376
|
+
const fullName = expressions_1.ExprUtils.localizeString(matchingTable.name, T.locale);
|
|
377
|
+
// Split by " > " and take first part
|
|
378
|
+
const parts = fullName.split(" > ");
|
|
379
|
+
return parts[0];
|
|
380
|
+
}
|
|
381
|
+
// Fallback to showing the pattern
|
|
382
|
+
return tableId;
|
|
383
|
+
}
|
|
384
|
+
// Regular table
|
|
385
|
+
const table = this.props.schema.getTable(tableId);
|
|
386
|
+
if (!table) {
|
|
387
|
+
return null;
|
|
388
|
+
}
|
|
389
|
+
return expressions_1.ExprUtils.localizeString(table.name, T.locale);
|
|
390
|
+
}
|
|
391
|
+
/** Render the currently included extra tables section */
|
|
392
|
+
renderExtraTables() {
|
|
393
|
+
if (!this.props.extraTables || this.props.extraTables.length === 0) {
|
|
394
|
+
return null;
|
|
395
|
+
}
|
|
396
|
+
return (react_1.default.createElement("div", { className: "mb-3 pb-2", style: { borderBottom: "1px solid #dee2e6" } },
|
|
397
|
+
react_1.default.createElement("span", { className: "text-muted me-2", style: { fontSize: "0.9rem" } },
|
|
398
|
+
T `Currently Included`,
|
|
399
|
+
":"),
|
|
400
|
+
this.props.extraTables.map((tableId) => {
|
|
401
|
+
const displayName = this.getExtraTableDisplayName(tableId);
|
|
402
|
+
if (!displayName) {
|
|
403
|
+
return null;
|
|
404
|
+
}
|
|
405
|
+
return (react_1.default.createElement("span", { key: tableId, className: "d-inline-flex align-items-center me-2 px-2 py-1 bg-light border rounded", style: { fontSize: "0.85rem" } },
|
|
406
|
+
react_1.default.createElement("span", null, displayName),
|
|
407
|
+
react_1.default.createElement("button", { className: "btn btn-link btn-sm p-0 ms-1", style: { fontSize: "0.9rem", color: "#6c757d" }, onClick: (e) => {
|
|
408
|
+
e.stopPropagation();
|
|
409
|
+
this.handleExtraTableRemove(tableId);
|
|
410
|
+
} },
|
|
411
|
+
react_1.default.createElement("i", { className: "fa fa-times" }))));
|
|
412
|
+
})));
|
|
413
|
+
}
|
|
414
|
+
/** Render the landing page with all categories */
|
|
415
|
+
renderLandingPage() {
|
|
416
|
+
const categories = this.getCategories();
|
|
417
|
+
// Filter by search text
|
|
418
|
+
const filteredCategories = this.state.searchText
|
|
419
|
+
? categories.filter((cat) => {
|
|
420
|
+
const searchLower = this.state.searchText.toLowerCase();
|
|
421
|
+
return (cat.name.toLowerCase().includes(searchLower) ||
|
|
422
|
+
cat.description.toLowerCase().includes(searchLower));
|
|
423
|
+
})
|
|
424
|
+
: categories;
|
|
425
|
+
return (react_1.default.createElement("div", null,
|
|
426
|
+
react_1.default.createElement("div", { className: "text-muted mb-3" }, T `Select a data source category to browse available tables and datasets.`),
|
|
427
|
+
react_1.default.createElement("div", { className: "mb-3 position-relative" },
|
|
428
|
+
react_1.default.createElement("i", { className: "fa fa-search position-absolute", style: { left: "0.75rem", top: "50%", transform: "translateY(-50%)", color: "#6c757d" } }),
|
|
429
|
+
react_1.default.createElement("input", { type: "text", className: "form-control", style: { paddingLeft: "2.5rem" }, placeholder: T("Search categories...").toString(), value: this.state.searchText, onChange: (e) => this.setState({ searchText: e.target.value }), ref: (c) => {
|
|
430
|
+
if (c) {
|
|
431
|
+
c.focus();
|
|
432
|
+
}
|
|
433
|
+
} })),
|
|
434
|
+
this.renderExtraTables(),
|
|
435
|
+
react_1.default.createElement("div", { style: { display: "grid", gridTemplateColumns: "1fr 1fr", gap: "0.5rem" } }, filteredCategories.map((category) => this.renderCategoryCard(category))),
|
|
436
|
+
filteredCategories.length === 0 && this.state.searchText && (react_1.default.createElement("div", { className: "text-center text-muted mt-4" }, T `No categories match your search.`))));
|
|
437
|
+
}
|
|
438
|
+
/** Render a specific category view */
|
|
439
|
+
renderCategoryView() {
|
|
440
|
+
const categories = this.getCategories();
|
|
441
|
+
const category = categories.find((c) => c.id === this.state.selectedCategory);
|
|
442
|
+
if (!category) {
|
|
443
|
+
return null;
|
|
268
444
|
}
|
|
269
|
-
tabs.push({ id: "other", label: T `Advanced`, elem: this.renderOther() });
|
|
270
445
|
return (react_1.default.createElement("div", null,
|
|
271
|
-
react_1.default.createElement("div", { className: "
|
|
272
|
-
|
|
446
|
+
react_1.default.createElement("div", { className: "mb-3" },
|
|
447
|
+
react_1.default.createElement("button", { className: "btn btn-link p-0", style: { textDecoration: "none" }, onClick: this.handleBackToCategories },
|
|
448
|
+
react_1.default.createElement("i", { className: "fa fa-arrow-left me-2" }),
|
|
449
|
+
T `Back to All Data Sources`)),
|
|
450
|
+
react_1.default.createElement("h5", { className: "mb-3" },
|
|
451
|
+
react_1.default.createElement("i", { className: `${category.icon} me-2 text-muted` }),
|
|
452
|
+
category.name),
|
|
453
|
+
category.render()));
|
|
454
|
+
}
|
|
455
|
+
render() {
|
|
456
|
+
return (react_1.default.createElement("div", { style: { height: "65vh", overflowY: "auto" } }, this.state.selectedCategory === null
|
|
457
|
+
? this.renderLandingPage()
|
|
458
|
+
: this.renderCategoryView()));
|
|
273
459
|
}
|
|
274
460
|
}
|
|
275
461
|
exports.default = MWaterCompleteTableSelectComponent;
|
|
@@ -12,8 +12,8 @@ export interface MWaterTableSelectComponentProps {
|
|
|
12
12
|
table?: string;
|
|
13
13
|
/** Called with table selected */
|
|
14
14
|
onChange: (table: string | null) => void;
|
|
15
|
-
extraTables
|
|
16
|
-
onExtraTablesChange
|
|
15
|
+
extraTables?: string[];
|
|
16
|
+
onExtraTablesChange?: (tables: string[]) => void;
|
|
17
17
|
/** Can also perform filtering for some types. Include these props to enable this */
|
|
18
18
|
filter?: any;
|
|
19
19
|
onFilterChange?: (filter: any) => void;
|
|
@@ -62,12 +62,17 @@ class MWaterTableSelectComponent extends react_1.default.Component {
|
|
|
62
62
|
handleTableChange = (tableId) => {
|
|
63
63
|
// If not part of extra tables, add it and wait for new schema
|
|
64
64
|
if (tableId && !this.props.schema.getTable(tableId)) {
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
65
|
+
if (this.props.onExtraTablesChange) {
|
|
66
|
+
this.setState({ pendingExtraTable: tableId }, () => {
|
|
67
|
+
this.props.onExtraTablesChange(lodash_1.default.union(this.props.extraTables || [], [tableId]));
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
else {
|
|
71
|
+
alert(T `Cannot add new tables.`);
|
|
72
|
+
}
|
|
68
73
|
}
|
|
69
74
|
else {
|
|
70
|
-
|
|
75
|
+
this.handleChange(tableId);
|
|
71
76
|
}
|
|
72
77
|
};
|
|
73
78
|
render() {
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Schema } from "@mwater/expressions";
|
|
3
|
+
interface MWaterWorkflowsSelectComponentProps {
|
|
4
|
+
/** Url to hit api */
|
|
5
|
+
apiUrl: string;
|
|
6
|
+
/** Optional client */
|
|
7
|
+
client?: string;
|
|
8
|
+
schema: Schema;
|
|
9
|
+
/** User id */
|
|
10
|
+
user?: string;
|
|
11
|
+
/** Called with table selected */
|
|
12
|
+
onChange: (tableId: string) => void;
|
|
13
|
+
extraTables: string[];
|
|
14
|
+
onExtraTableAdd: (tableId: string) => void;
|
|
15
|
+
onExtraTableRemove: (tableId: string) => void;
|
|
16
|
+
}
|
|
17
|
+
/** Searchable list of workflow types */
|
|
18
|
+
export declare function MWaterWorkflowsSelectComponent(props: MWaterWorkflowsSelectComponentProps): React.JSX.Element;
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
exports.MWaterWorkflowsSelectComponent = MWaterWorkflowsSelectComponent;
|
|
30
|
+
const lodash_1 = __importDefault(require("lodash"));
|
|
31
|
+
const jquery_1 = __importDefault(require("jquery"));
|
|
32
|
+
const react_1 = __importStar(require("react"));
|
|
33
|
+
const querystring_1 = __importDefault(require("querystring"));
|
|
34
|
+
const uiComponents = __importStar(require("../UIComponents"));
|
|
35
|
+
const expressions_1 = require("@mwater/expressions");
|
|
36
|
+
/** Searchable list of workflow types */
|
|
37
|
+
function MWaterWorkflowsSelectComponent(props) {
|
|
38
|
+
const [workflowTypes, setWorkflowTypes] = (0, react_1.useState)(null);
|
|
39
|
+
const [search, setSearch] = (0, react_1.useState)("");
|
|
40
|
+
const [error, setError] = (0, react_1.useState)(null);
|
|
41
|
+
(0, react_1.useEffect)(() => {
|
|
42
|
+
// Get names and basic of workflow types
|
|
43
|
+
const query = {};
|
|
44
|
+
query.fields = JSON.stringify({
|
|
45
|
+
name: 1,
|
|
46
|
+
description: 1,
|
|
47
|
+
roles: 1,
|
|
48
|
+
_created_by: 1,
|
|
49
|
+
_modified_on: 1
|
|
50
|
+
});
|
|
51
|
+
query.client = props.client;
|
|
52
|
+
// Get list of all workflow types
|
|
53
|
+
jquery_1.default.getJSON(props.apiUrl + "workflow_types?" + querystring_1.default.stringify(query), (types) => {
|
|
54
|
+
// Sort by included first, then user-created, then by name
|
|
55
|
+
types = lodash_1.default.sortByOrder(types, [
|
|
56
|
+
(type) => ((props.extraTables || []).includes("workflows:" + type._id) ? 0 : 1),
|
|
57
|
+
(type) => (type._created_by === props.user ? 0 : 1),
|
|
58
|
+
(type) => expressions_1.ExprUtils.localizeString(type.name, T.locale) || T `Untitled Workflow Type`
|
|
59
|
+
], ["asc", "asc", "asc"]);
|
|
60
|
+
setWorkflowTypes(lodash_1.default.map(types, (type) => ({
|
|
61
|
+
id: type._id,
|
|
62
|
+
name: expressions_1.ExprUtils.localizeString(type.name, T.locale) || T `Untitled Workflow Type`,
|
|
63
|
+
desc: expressions_1.ExprUtils.localizeString(type.description, T.locale)
|
|
64
|
+
})));
|
|
65
|
+
}).fail((xhr) => {
|
|
66
|
+
setError(xhr.responseText);
|
|
67
|
+
});
|
|
68
|
+
}, [props.apiUrl, props.client, props.user, props.extraTables]);
|
|
69
|
+
const handleTableRemove = (table) => {
|
|
70
|
+
if (confirm(T `Remove ${table.name}? Any widgets that depend on it will no longer work properly.`)) {
|
|
71
|
+
props.onExtraTableRemove(`workflows:${table.id}`);
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
if (error) {
|
|
75
|
+
return react_1.default.createElement("div", { className: "alert alert-danger" }, error);
|
|
76
|
+
}
|
|
77
|
+
// Filter workflow types by search
|
|
78
|
+
let filteredWorkflowTypes = workflowTypes;
|
|
79
|
+
if (search && workflowTypes) {
|
|
80
|
+
const escapeRegExp = (s) => s.replace(/[-\/\\^$*+?.()|[\]{}]/g, "\\$&");
|
|
81
|
+
const searchStringRegExp = new RegExp(escapeRegExp(search), "i");
|
|
82
|
+
filteredWorkflowTypes = lodash_1.default.filter(workflowTypes, (type) => type.name.match(searchStringRegExp));
|
|
83
|
+
}
|
|
84
|
+
// Remove if already included
|
|
85
|
+
filteredWorkflowTypes = lodash_1.default.filter(filteredWorkflowTypes || [], (wt) => !(props.extraTables || []).includes(`workflows:${wt.id}`));
|
|
86
|
+
// Get included workflow tables from schema
|
|
87
|
+
let includedTables = lodash_1.default.filter(props.schema.getTables(), (table) => (table.id.match(/^workflows:/) || table.id.match(/^workflow_events:/)) && !table.deprecated);
|
|
88
|
+
includedTables = lodash_1.default.sortBy(includedTables, (t) => t.name.en);
|
|
89
|
+
return (react_1.default.createElement("div", null,
|
|
90
|
+
react_1.default.createElement("label", null, T `Included Workflows:`),
|
|
91
|
+
includedTables.length > 0 ? (react_1.default.createElement(uiComponents.OptionListComponent, { items: lodash_1.default.map(includedTables, (table) => {
|
|
92
|
+
return {
|
|
93
|
+
name: expressions_1.ExprUtils.localizeString(table.name, T.locale),
|
|
94
|
+
desc: expressions_1.ExprUtils.localizeString(table.desc, T.locale),
|
|
95
|
+
onClick: () => props.onChange(table.id),
|
|
96
|
+
onRemove: () => handleTableRemove({ id: table.id.replace(/^workflows:/, ""), name: expressions_1.ExprUtils.localizeString(table.name, T.locale) })
|
|
97
|
+
};
|
|
98
|
+
}) })) : (react_1.default.createElement("div", null, T `None`)),
|
|
99
|
+
react_1.default.createElement("br", null),
|
|
100
|
+
react_1.default.createElement("label", null, T `All Workflows:`),
|
|
101
|
+
!workflowTypes || workflowTypes.length === 0 ? (react_1.default.createElement("div", { className: "alert alert-info" },
|
|
102
|
+
react_1.default.createElement("i", { className: "fa fa-spinner fa-spin" }),
|
|
103
|
+
"\u00A0",
|
|
104
|
+
T `Loading...`)) : (react_1.default.createElement(react_1.default.Fragment, null,
|
|
105
|
+
react_1.default.createElement("input", { type: "text", className: "form-control form-control-sm", placeholder: T `Search...`, key: "search", autoFocus: true, style: { maxWidth: "20em", marginBottom: 10 }, value: search, onChange: (ev) => setSearch(ev.target.value) }),
|
|
106
|
+
react_1.default.createElement(uiComponents.OptionListComponent, { items: lodash_1.default.map(filteredWorkflowTypes, (workflowType) => ({
|
|
107
|
+
name: workflowType.name,
|
|
108
|
+
desc: workflowType.desc,
|
|
109
|
+
onClick: () => props.onChange("workflows:" + workflowType.id)
|
|
110
|
+
})) })))));
|
|
111
|
+
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { DataSource,
|
|
3
|
-
import IdArrayQuickfilterComponent from "./IdArrayQuickfilterComponent";
|
|
2
|
+
import { DataSource, Schema } from "@mwater/expressions";
|
|
4
3
|
import { Quickfilter, QuickfilterLock } from "./Quickfilter";
|
|
5
4
|
import { QuickfiltersDataSource } from "./QuickfiltersDataSource";
|
|
6
5
|
import { JsonQLFilter } from "..";
|
|
@@ -26,104 +25,6 @@ export interface QuickfiltersComponentProps {
|
|
|
26
25
|
}
|
|
27
26
|
/** Displays quick filters and allows their value to be modified */
|
|
28
27
|
export default class QuickfiltersComponent extends React.Component<QuickfiltersComponentProps> {
|
|
29
|
-
renderQuickfilter(item:
|
|
30
|
-
render(): React.
|
|
31
|
-
style: {
|
|
32
|
-
borderTop: string | undefined;
|
|
33
|
-
borderBottom: string;
|
|
34
|
-
padding: number;
|
|
35
|
-
};
|
|
36
|
-
}, HTMLElement> | null;
|
|
28
|
+
renderQuickfilter(item: Quickfilter, index: number): React.JSX.Element | null;
|
|
29
|
+
render(): React.JSX.Element | null;
|
|
37
30
|
}
|
|
38
|
-
interface EnumQuickfilterComponentProps {
|
|
39
|
-
label?: string;
|
|
40
|
-
schema: Schema;
|
|
41
|
-
/** true to display multiple values */
|
|
42
|
-
multi?: boolean;
|
|
43
|
-
/** Current value of quickfilter (state of filter selected) */
|
|
44
|
-
value?: any;
|
|
45
|
-
/** Called when value changes */
|
|
46
|
-
onValueChange?: any;
|
|
47
|
-
options: {
|
|
48
|
-
/** id of option */
|
|
49
|
-
id: string;
|
|
50
|
-
/** localized name */
|
|
51
|
-
name: LocalizedString;
|
|
52
|
-
}[];
|
|
53
|
-
}
|
|
54
|
-
/** Quickfilter for an enum */
|
|
55
|
-
declare class EnumQuickfilterComponent extends React.Component<EnumQuickfilterComponentProps> {
|
|
56
|
-
static contextType: React.Context<string>;
|
|
57
|
-
handleSingleChange: (val: any) => any;
|
|
58
|
-
handleMultiChange: (val: any) => any;
|
|
59
|
-
renderSingleSelect(options: any[]): React.FunctionComponentElement<{
|
|
60
|
-
placeholder: string;
|
|
61
|
-
value: any;
|
|
62
|
-
options: any[];
|
|
63
|
-
isClearable: boolean;
|
|
64
|
-
onChange: (value: any) => any;
|
|
65
|
-
isDisabled: boolean;
|
|
66
|
-
styles: {
|
|
67
|
-
menu: (style: import("react-select").CSSObjectWithLabel) => import("react-select").CSSObjectWithLabel;
|
|
68
|
-
};
|
|
69
|
-
}>;
|
|
70
|
-
renderMultiSelect(options: any[]): React.FunctionComponentElement<{
|
|
71
|
-
placeholder: string;
|
|
72
|
-
value: any[];
|
|
73
|
-
isClearable: boolean;
|
|
74
|
-
isMulti: boolean;
|
|
75
|
-
options: any[];
|
|
76
|
-
onChange: ((val: any) => any) | undefined;
|
|
77
|
-
isDisabled: boolean;
|
|
78
|
-
styles: {
|
|
79
|
-
menu: (style: import("react-select").CSSObjectWithLabel) => import("react-select").CSSObjectWithLabel;
|
|
80
|
-
};
|
|
81
|
-
}>;
|
|
82
|
-
render(): React.DetailedReactHTMLElement<{
|
|
83
|
-
style: {
|
|
84
|
-
display: "inline-block";
|
|
85
|
-
paddingRight: number;
|
|
86
|
-
};
|
|
87
|
-
}, HTMLElement>;
|
|
88
|
-
}
|
|
89
|
-
interface TextQuickfilterComponentProps {
|
|
90
|
-
label: string;
|
|
91
|
-
schema: Schema;
|
|
92
|
-
/** See QuickfiltersDataSource */
|
|
93
|
-
quickfiltersDataSource: QuickfiltersDataSource;
|
|
94
|
-
expr: any;
|
|
95
|
-
index: number;
|
|
96
|
-
/** Current value of quickfilter (state of filter selected) */
|
|
97
|
-
value?: any;
|
|
98
|
-
/** Called when value changes */
|
|
99
|
-
onValueChange?: any;
|
|
100
|
-
/** true to display multiple values */
|
|
101
|
-
multi?: boolean;
|
|
102
|
-
/** Filters to add to restrict quick filter data to */
|
|
103
|
-
filters?: JsonQLFilter[];
|
|
104
|
-
}
|
|
105
|
-
declare class TextQuickfilterComponent extends React.Component<TextQuickfilterComponentProps> {
|
|
106
|
-
render(): React.DetailedReactHTMLElement<{
|
|
107
|
-
style: {
|
|
108
|
-
display: "inline-block";
|
|
109
|
-
paddingRight: number;
|
|
110
|
-
};
|
|
111
|
-
}, HTMLElement>;
|
|
112
|
-
}
|
|
113
|
-
interface DateQuickfilterComponentProps {
|
|
114
|
-
label?: string;
|
|
115
|
-
schema: Schema;
|
|
116
|
-
expr: any;
|
|
117
|
-
/** Current value of quickfilter (state of filter selected) */
|
|
118
|
-
value?: any;
|
|
119
|
-
onValueChange: any;
|
|
120
|
-
}
|
|
121
|
-
declare class DateQuickfilterComponent extends React.Component<DateQuickfilterComponentProps> {
|
|
122
|
-
render(): React.DetailedReactHTMLElement<{
|
|
123
|
-
style: {
|
|
124
|
-
display: "inline-block";
|
|
125
|
-
paddingRight: number;
|
|
126
|
-
};
|
|
127
|
-
}, HTMLElement>;
|
|
128
|
-
}
|
|
129
|
-
export {};
|