@journeyapps-labs/reactor-mod-data-browser 2.0.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@journeyapps-labs/reactor-mod-data-browser",
3
- "version": "2.0.0",
3
+ "version": "2.0.1",
4
4
  "main": "./dist/index.js",
5
5
  "typings": "./dist/@types/index",
6
6
  "publishConfig": {
@@ -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
- System,
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
- return cell.join(', ');
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) {