@journeyapps-labs/reactor-mod-data-browser 1.1.0 → 2.0.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/CHANGELOG.md +12 -0
- package/dist/@types/core/AbstractConnection.d.ts +2 -1
- package/dist/@types/core/types/ManualConnection.d.ts +2 -1
- package/dist/core/AbstractConnection.js +3 -1
- package/dist/core/AbstractConnection.js.map +1 -1
- package/dist/core/query/SimpleQuery.js +26 -4
- package/dist/core/query/SimpleQuery.js.map +1 -1
- package/dist/core/types/ManualConnection.js +3 -1
- package/dist/core/types/ManualConnection.js.map +1 -1
- package/dist/entities/ConnectionEntityDefinition.js +1 -3
- package/dist/entities/ConnectionEntityDefinition.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist-module/bundle.js +13 -4
- package/dist-module/bundle.js.map +1 -1
- package/package.json +1 -1
- package/src/core/AbstractConnection.ts +5 -2
- package/src/core/query/SimpleQuery.tsx +39 -6
- package/src/core/types/ManualConnection.ts +5 -2
- package/src/entities/ConnectionEntityDefinition.tsx +2 -4
- package/webpack.config.js +9 -0
package/package.json
CHANGED
|
@@ -7,6 +7,7 @@ import { v4 } from 'uuid';
|
|
|
7
7
|
import { BaseObserver } from '@journeyapps-labs/common-utils';
|
|
8
8
|
import { Collection, LifecycleCollection } from '@journeyapps-labs/lib-reactor-data-layer';
|
|
9
9
|
import { when } from 'mobx';
|
|
10
|
+
import { EntityDescription } from '@journeyapps-labs/reactor-mod';
|
|
10
11
|
|
|
11
12
|
export interface AbstractConnectionSerialized {
|
|
12
13
|
factory: string;
|
|
@@ -91,8 +92,10 @@ export abstract class AbstractConnection extends BaseObserver<AbstractConnection
|
|
|
91
92
|
};
|
|
92
93
|
}
|
|
93
94
|
|
|
94
|
-
get name() {
|
|
95
|
-
return
|
|
95
|
+
get name(): EntityDescription {
|
|
96
|
+
return {
|
|
97
|
+
simpleName: this.id
|
|
98
|
+
};
|
|
96
99
|
}
|
|
97
100
|
|
|
98
101
|
abstract _serialize(): any;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { AbstractQuery, AbstractQueryEncoded } from './AbstractQuery';
|
|
2
2
|
import {
|
|
3
|
-
ActionSource,
|
|
4
3
|
CheckboxWidget,
|
|
5
4
|
inject,
|
|
5
|
+
MetadataWidget,
|
|
6
6
|
SmartDateDisplayWidget,
|
|
7
|
-
|
|
7
|
+
styled,
|
|
8
8
|
TableColumn
|
|
9
9
|
} from '@journeyapps-labs/reactor-mod';
|
|
10
10
|
import { ConnectionStore } from '../../stores/ConnectionStore';
|
|
@@ -14,9 +14,7 @@ import { Page, PageRow } from './Page';
|
|
|
14
14
|
import { SchemaModelDefinition } from '../SchemaModelDefinition';
|
|
15
15
|
import * as _ from 'lodash';
|
|
16
16
|
import * as React from 'react';
|
|
17
|
-
import styled from '@emotion/styled';
|
|
18
17
|
import { observable } from 'mobx';
|
|
19
|
-
import { DataBrowserEntities } from '../../entities';
|
|
20
18
|
|
|
21
19
|
export interface SimpleQueryOptions {
|
|
22
20
|
definition?: SchemaModelDefinition;
|
|
@@ -119,12 +117,24 @@ namespace S {
|
|
|
119
117
|
export const Empty = styled.div`
|
|
120
118
|
opacity: 0.2;
|
|
121
119
|
`;
|
|
122
|
-
export const Container = styled.div``;
|
|
123
120
|
|
|
124
121
|
export const Preview = styled.img`
|
|
125
122
|
max-height: 40px;
|
|
126
123
|
max-width: 40px;
|
|
127
124
|
`;
|
|
125
|
+
|
|
126
|
+
export const pill = styled.div`
|
|
127
|
+
padding: 2px 4px;
|
|
128
|
+
background: ${(p) => p.theme.table.pills};
|
|
129
|
+
border-radius: 3px;
|
|
130
|
+
font-size: 12px;
|
|
131
|
+
`;
|
|
132
|
+
|
|
133
|
+
export const Pills = styled.div`
|
|
134
|
+
display: flex;
|
|
135
|
+
column-gap: 2px;
|
|
136
|
+
row-gap: 2px;
|
|
137
|
+
`;
|
|
128
138
|
}
|
|
129
139
|
|
|
130
140
|
export interface CellDisplayWidgetProps {
|
|
@@ -132,6 +142,8 @@ export interface CellDisplayWidgetProps {
|
|
|
132
142
|
cell: any;
|
|
133
143
|
}
|
|
134
144
|
|
|
145
|
+
const MAX_NUMBER_OF_ARR_ITEMS_TO_DISPLAY = 3;
|
|
146
|
+
|
|
135
147
|
export const CellDisplayWidget: React.FC<CellDisplayWidgetProps> = (props) => {
|
|
136
148
|
const { row, cell } = props;
|
|
137
149
|
if (cell == null) {
|
|
@@ -141,9 +153,23 @@ export const CellDisplayWidget: React.FC<CellDisplayWidgetProps> = (props) => {
|
|
|
141
153
|
if (cell.trim() === '') {
|
|
142
154
|
return <S.Empty>empty</S.Empty>;
|
|
143
155
|
}
|
|
156
|
+
return cell;
|
|
144
157
|
}
|
|
145
158
|
if (_.isArray(cell)) {
|
|
146
|
-
|
|
159
|
+
if (cell.length === 0) {
|
|
160
|
+
return <S.Empty>empty array</S.Empty>;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
let items = _.slice(cell, 0, MAX_NUMBER_OF_ARR_ITEMS_TO_DISPLAY);
|
|
164
|
+
|
|
165
|
+
return (
|
|
166
|
+
<S.Pills>
|
|
167
|
+
{items.map((c) => {
|
|
168
|
+
return <S.pill key={c}>{c}</S.pill>;
|
|
169
|
+
})}
|
|
170
|
+
{items.length !== cell.length ? '...' : null}
|
|
171
|
+
</S.Pills>
|
|
172
|
+
);
|
|
147
173
|
}
|
|
148
174
|
if (cell instanceof Date) {
|
|
149
175
|
return <SmartDateDisplayWidget date={cell} />;
|
|
@@ -152,6 +178,13 @@ export const CellDisplayWidget: React.FC<CellDisplayWidgetProps> = (props) => {
|
|
|
152
178
|
return <CheckboxWidget checked={cell} onChange={() => {}} />;
|
|
153
179
|
}
|
|
154
180
|
if (cell instanceof Location) {
|
|
181
|
+
return (
|
|
182
|
+
<>
|
|
183
|
+
<MetadataWidget label={'Lat'} value={`${cell.latitude}`} />
|
|
184
|
+
<MetadataWidget label={'Long'} value={`${cell.longitude}`} />
|
|
185
|
+
</>
|
|
186
|
+
);
|
|
187
|
+
|
|
155
188
|
return JSON.stringify(cell.toJSON());
|
|
156
189
|
}
|
|
157
190
|
if (cell instanceof Attachment) {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ApiCredentialOptions, Database } from '@journeyapps/db';
|
|
2
2
|
import { AbstractConnection } from '../AbstractConnection';
|
|
3
3
|
import { ManualConnectionFactory } from './ManualConnectionFactory';
|
|
4
|
+
import { EntityDescription } from '@journeyapps-labs/reactor-mod';
|
|
4
5
|
|
|
5
6
|
export interface ManualConnectionDetails extends ApiCredentialOptions {
|
|
6
7
|
name: string;
|
|
@@ -26,7 +27,9 @@ export class ManualConnection extends AbstractConnection {
|
|
|
26
27
|
this.options = data;
|
|
27
28
|
}
|
|
28
29
|
|
|
29
|
-
get name():
|
|
30
|
-
return
|
|
30
|
+
get name(): EntityDescription {
|
|
31
|
+
return {
|
|
32
|
+
simpleName: this.options.name
|
|
33
|
+
};
|
|
31
34
|
}
|
|
32
35
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import {
|
|
2
2
|
DescendantEntityProviderComponent,
|
|
3
|
-
EntityActionHandlerComponent,
|
|
4
3
|
EntityDefinition,
|
|
5
4
|
EntityDescriberComponent,
|
|
6
5
|
EntityPanelComponent,
|
|
@@ -30,9 +29,7 @@ export class ConnectionEntityDefinition extends EntityDefinition<AbstractConnect
|
|
|
30
29
|
new EntityDescriberComponent<AbstractConnection>({
|
|
31
30
|
label: 'Simple',
|
|
32
31
|
describe: (entity: AbstractConnection) => {
|
|
33
|
-
return
|
|
34
|
-
simpleName: entity.name
|
|
35
|
-
};
|
|
32
|
+
return entity.name;
|
|
36
33
|
}
|
|
37
34
|
})
|
|
38
35
|
);
|
|
@@ -69,6 +66,7 @@ export class ConnectionEntityDefinition extends EntityDefinition<AbstractConnect
|
|
|
69
66
|
})
|
|
70
67
|
);
|
|
71
68
|
}
|
|
69
|
+
|
|
72
70
|
matchEntity(t: any): boolean {
|
|
73
71
|
if (t instanceof AbstractConnection) {
|
|
74
72
|
return true;
|