@journeyapps-labs/reactor-mod-data-browser 3.4.0 → 3.5.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/CHANGELOG.md +10 -0
- package/dist/@types/core/AbstractConnection.d.ts +1 -0
- package/dist/@types/core/SchemaModelDefinition.d.ts +20 -0
- package/dist/@types/entities/SchemaModelTreePresenterComponent.d.ts +10 -0
- package/dist/@types/index.d.ts +1 -0
- package/dist/@types/preferences/QueryControlPreferences.d.ts +14 -2
- package/dist/@types/preferences/SchemaOrderingPreferences.d.ts +22 -0
- package/dist/DataBrowserModule.js +2 -0
- package/dist/DataBrowserModule.js.map +1 -1
- package/dist/core/AbstractConnection.js +11 -3
- package/dist/core/AbstractConnection.js.map +1 -1
- package/dist/core/SchemaModelDefinition.js +73 -17
- package/dist/core/SchemaModelDefinition.js.map +1 -1
- package/dist/core/query/query-simple/SimpleQueryColumns.js +57 -50
- package/dist/core/query/query-simple/SimpleQueryColumns.js.map +1 -1
- package/dist/core/query/widgets/IDCellDisplayWidget.js +9 -4
- package/dist/core/query/widgets/IDCellDisplayWidget.js.map +1 -1
- package/dist/entities/SchemaModelDefinitionEntityDefinition.js +3 -10
- package/dist/entities/SchemaModelDefinitionEntityDefinition.js.map +1 -1
- package/dist/entities/SchemaModelTreePresenterComponent.js +23 -0
- package/dist/entities/SchemaModelTreePresenterComponent.js.map +1 -0
- package/dist/forms/SchemaModelForm.js +31 -29
- package/dist/forms/SchemaModelForm.js.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/panels/query/QueryPanelWidget.js +14 -9
- package/dist/panels/query/QueryPanelWidget.js.map +1 -1
- package/dist/preferences/QueryControlPreferences.js +45 -1
- package/dist/preferences/QueryControlPreferences.js.map +1 -1
- package/dist/preferences/SchemaOrderingPreferences.js +76 -0
- package/dist/preferences/SchemaOrderingPreferences.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist-module/bundle.js +35 -35
- package/dist-module/bundle.js.map +1 -1
- package/package.json +7 -6
- package/src/DataBrowserModule.ts +2 -0
- package/src/core/AbstractConnection.ts +12 -3
- package/src/core/SchemaModelDefinition.ts +97 -17
- package/src/core/query/query-simple/SimpleQueryColumns.tsx +83 -74
- package/src/core/query/widgets/IDCellDisplayWidget.tsx +17 -4
- package/src/entities/SchemaModelDefinitionEntityDefinition.ts +3 -13
- package/src/entities/SchemaModelTreePresenterComponent.ts +31 -0
- package/src/forms/SchemaModelForm.tsx +46 -41
- package/src/index.ts +1 -0
- package/src/panels/query/QueryPanelWidget.tsx +24 -22
- package/src/preferences/QueryControlPreferences.ts +51 -2
- package/src/preferences/SchemaOrderingPreferences.ts +82 -0
|
@@ -8,6 +8,7 @@ import { Page } from '../../core/query/Page';
|
|
|
8
8
|
import { PageResultsWidget } from './PageResultsWidget';
|
|
9
9
|
import { TableControlsWidget } from './TableControlsWidget';
|
|
10
10
|
import { autorun } from 'mobx';
|
|
11
|
+
import { TableControlsPositionPreference, TableControlsPositionValue } from '../../preferences/QueryControlPreferences';
|
|
11
12
|
|
|
12
13
|
export interface QueryPanelWidgetProps {
|
|
13
14
|
model: QueryPanelModel;
|
|
@@ -93,6 +94,21 @@ export const QueryPanelWidget: React.FC<QueryPanelWidgetProps> = observer((props
|
|
|
93
94
|
|
|
94
95
|
const activePage =
|
|
95
96
|
props.model.current_page_data || (props.model.query ? props.model.query.getPage(props.model.current_page) : null);
|
|
97
|
+
const controlsPosition = TableControlsPositionPreference.getValue();
|
|
98
|
+
|
|
99
|
+
const controls = (
|
|
100
|
+
<TableControlsWidget
|
|
101
|
+
query={props.model.query}
|
|
102
|
+
current_page={activePage}
|
|
103
|
+
loading={loading}
|
|
104
|
+
onLoadSavedQuery={async (id) => {
|
|
105
|
+
await props.model.loadSavedQuery(id);
|
|
106
|
+
}}
|
|
107
|
+
goToPage={(index) => {
|
|
108
|
+
props.model.current_page = index;
|
|
109
|
+
}}
|
|
110
|
+
/>
|
|
111
|
+
);
|
|
96
112
|
|
|
97
113
|
return (
|
|
98
114
|
<LoadingPanelWidget loading={!props.model.query || !activePage}>
|
|
@@ -101,30 +117,16 @@ export const QueryPanelWidget: React.FC<QueryPanelWidgetProps> = observer((props
|
|
|
101
117
|
<S.Container>
|
|
102
118
|
<BorderLayoutWidget
|
|
103
119
|
top={
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
onLoadSavedQuery={async (id) => {
|
|
109
|
-
await props.model.loadSavedQuery(id);
|
|
110
|
-
}}
|
|
111
|
-
goToPage={(index) => {
|
|
112
|
-
props.model.current_page = index;
|
|
113
|
-
}}
|
|
114
|
-
/>
|
|
120
|
+
controlsPosition === TableControlsPositionValue.TOP ||
|
|
121
|
+
controlsPosition === TableControlsPositionValue.BOTH
|
|
122
|
+
? controls
|
|
123
|
+
: null
|
|
115
124
|
}
|
|
116
125
|
bottom={
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
onLoadSavedQuery={async (id) => {
|
|
122
|
-
await props.model.loadSavedQuery(id);
|
|
123
|
-
}}
|
|
124
|
-
goToPage={(index) => {
|
|
125
|
-
props.model.current_page = index;
|
|
126
|
-
}}
|
|
127
|
-
/>
|
|
126
|
+
controlsPosition === TableControlsPositionValue.BOTTOM ||
|
|
127
|
+
controlsPosition === TableControlsPositionValue.BOTH
|
|
128
|
+
? controls
|
|
129
|
+
: null
|
|
128
130
|
}
|
|
129
131
|
>
|
|
130
132
|
<PageResultsWidget
|
|
@@ -1,9 +1,49 @@
|
|
|
1
|
-
import { BooleanSetting, PrefsStore } from '@journeyapps-labs/reactor-mod';
|
|
1
|
+
import { BooleanSetting, PrefsStore, SetSetting, ioc } from '@journeyapps-labs/reactor-mod';
|
|
2
2
|
|
|
3
3
|
export enum QueryControlPreferences {
|
|
4
4
|
SHOW_SORT_CONTROLS = 'databrowser/query-controls/show-sort-controls',
|
|
5
5
|
SHOW_FILTER_CONTROLS = 'databrowser/query-controls/show-filter-controls',
|
|
6
|
-
FILTER_NULL_FIELDS_IN_RELATIONSHIP_PEEK = 'databrowser/query-controls/filter-null-fields-in-relationship-peek'
|
|
6
|
+
FILTER_NULL_FIELDS_IN_RELATIONSHIP_PEEK = 'databrowser/query-controls/filter-null-fields-in-relationship-peek',
|
|
7
|
+
SHOW_ID_VALUE_IN_ID_COLUMN = 'databrowser/query-controls/show-id-value-in-id-column',
|
|
8
|
+
TABLE_CONTROLS_POSITION = 'databrowser/query-controls/table-controls-position'
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export enum TableControlsPositionValue {
|
|
12
|
+
TOP = 'top',
|
|
13
|
+
BOTTOM = 'bottom',
|
|
14
|
+
BOTH = 'both'
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export class TableControlsPositionPreference extends SetSetting {
|
|
18
|
+
static KEY = QueryControlPreferences.TABLE_CONTROLS_POSITION;
|
|
19
|
+
|
|
20
|
+
constructor() {
|
|
21
|
+
super({
|
|
22
|
+
key: TableControlsPositionPreference.KEY,
|
|
23
|
+
name: 'Table controls position',
|
|
24
|
+
category: 'Query Controls',
|
|
25
|
+
value: TableControlsPositionValue.BOTH,
|
|
26
|
+
options: [
|
|
27
|
+
{
|
|
28
|
+
key: TableControlsPositionValue.TOP,
|
|
29
|
+
label: 'Top'
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
key: TableControlsPositionValue.BOTTOM,
|
|
33
|
+
label: 'Bottom'
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
key: TableControlsPositionValue.BOTH,
|
|
37
|
+
label: 'Both'
|
|
38
|
+
}
|
|
39
|
+
]
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
static getValue(): TableControlsPositionValue {
|
|
44
|
+
return ioc.get(PrefsStore).getPreference<TableControlsPositionPreference>(TableControlsPositionPreference.KEY)
|
|
45
|
+
.value as TableControlsPositionValue;
|
|
46
|
+
}
|
|
7
47
|
}
|
|
8
48
|
|
|
9
49
|
export const registerQueryControlPreferences = (prefsStore: PrefsStore) => {
|
|
@@ -31,4 +71,13 @@ export const registerQueryControlPreferences = (prefsStore: PrefsStore) => {
|
|
|
31
71
|
category: 'Query Controls'
|
|
32
72
|
})
|
|
33
73
|
);
|
|
74
|
+
prefsStore.registerPreference(
|
|
75
|
+
new BooleanSetting({
|
|
76
|
+
key: QueryControlPreferences.SHOW_ID_VALUE_IN_ID_COLUMN,
|
|
77
|
+
checked: true,
|
|
78
|
+
name: 'Show ID value in ID column',
|
|
79
|
+
category: 'Query Controls'
|
|
80
|
+
})
|
|
81
|
+
);
|
|
82
|
+
prefsStore.registerPreference(new TableControlsPositionPreference());
|
|
34
83
|
};
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { ioc, PrefsStore, SetSetting } from '@journeyapps-labs/reactor-mod';
|
|
2
|
+
|
|
3
|
+
export enum SchemaModelOrderValue {
|
|
4
|
+
ALPHABETICAL = 'alphabetical',
|
|
5
|
+
AS_DEFINED_IN_SCHEMA = 'as_defined_in_schema'
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export class SchemaModelOrderingPreference extends SetSetting {
|
|
9
|
+
static KEY = 'databrowser/schema/model-order';
|
|
10
|
+
|
|
11
|
+
constructor() {
|
|
12
|
+
super({
|
|
13
|
+
key: SchemaModelOrderingPreference.KEY,
|
|
14
|
+
name: 'Schema model order',
|
|
15
|
+
category: 'Schema',
|
|
16
|
+
value: SchemaModelOrderValue.AS_DEFINED_IN_SCHEMA,
|
|
17
|
+
options: [
|
|
18
|
+
{
|
|
19
|
+
key: SchemaModelOrderValue.AS_DEFINED_IN_SCHEMA,
|
|
20
|
+
label: 'As defined in schema'
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
key: SchemaModelOrderValue.ALPHABETICAL,
|
|
24
|
+
label: 'Alphabetical'
|
|
25
|
+
}
|
|
26
|
+
]
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
static getValue(): SchemaModelOrderValue {
|
|
31
|
+
return ioc.get(PrefsStore).getPreference<SchemaModelOrderingPreference>(SchemaModelOrderingPreference.KEY)
|
|
32
|
+
.value as SchemaModelOrderValue;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export enum SchemaFieldOrderValue {
|
|
37
|
+
ALPHABETICAL = 'alphabetical',
|
|
38
|
+
BELONGS_TO_FIRST = 'belongs_to_first',
|
|
39
|
+
BELONGS_TO_LAST = 'belongs_to_last',
|
|
40
|
+
AS_DEFINED_IN_SCHEMA = 'as_defined_in_schema'
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export class SchemaFieldOrderingPreference extends SetSetting {
|
|
44
|
+
static KEY = 'databrowser/schema/field-order';
|
|
45
|
+
|
|
46
|
+
constructor() {
|
|
47
|
+
super({
|
|
48
|
+
key: SchemaFieldOrderingPreference.KEY,
|
|
49
|
+
name: 'Schema field order',
|
|
50
|
+
category: 'Schema',
|
|
51
|
+
value: SchemaFieldOrderValue.AS_DEFINED_IN_SCHEMA,
|
|
52
|
+
options: [
|
|
53
|
+
{
|
|
54
|
+
key: SchemaFieldOrderValue.AS_DEFINED_IN_SCHEMA,
|
|
55
|
+
label: 'As defined in schema'
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
key: SchemaFieldOrderValue.ALPHABETICAL,
|
|
59
|
+
label: 'Alphabetical'
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
key: SchemaFieldOrderValue.BELONGS_TO_FIRST,
|
|
63
|
+
label: 'Belongs-to first'
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
key: SchemaFieldOrderValue.BELONGS_TO_LAST,
|
|
67
|
+
label: 'Belongs-to last'
|
|
68
|
+
}
|
|
69
|
+
]
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
static getValue(): SchemaFieldOrderValue {
|
|
74
|
+
return ioc.get(PrefsStore).getPreference<SchemaFieldOrderingPreference>(SchemaFieldOrderingPreference.KEY)
|
|
75
|
+
.value as SchemaFieldOrderValue;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export const registerSchemaOrderingPreferences = (prefsStore: PrefsStore) => {
|
|
80
|
+
prefsStore.registerPreference(new SchemaModelOrderingPreference());
|
|
81
|
+
prefsStore.registerPreference(new SchemaFieldOrderingPreference());
|
|
82
|
+
};
|