@operato/data-grist 2.0.0-beta.30 → 2.0.0-beta.31

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.
@@ -16,6 +16,7 @@ export class RecordCreator extends LitElement {
16
16
 
17
17
  @property({ type: Object }) callback?: (operation: { [key: string]: any }) => boolean
18
18
  @property({ type: Boolean, attribute: 'light-popup' }) lightPopup: boolean = false
19
+ @property({ type: Boolean, attribute: 'prevent-close-on-blur' }) preventCloseOnBlur = false
19
20
 
20
21
  constructor() {
21
22
  super()
@@ -101,7 +102,8 @@ export class RecordCreator extends LitElement {
101
102
  }}
102
103
  ></ox-record-view>
103
104
  `,
104
- parent: document.body
105
+ parent: document.body,
106
+ preventCloseOnBlur: this.preventCloseOnBlur
105
107
  })
106
108
  }
107
109
 
@@ -15,7 +15,7 @@ export class RecordViewBody extends LitElement {
15
15
  css`
16
16
  :host {
17
17
  display: grid;
18
- grid-template-columns: 33% 67%;
18
+ grid-template-columns: 2fr 3fr 2fr 3fr;
19
19
  grid-auto-rows: min-content;
20
20
  grid-gap: var(--record-view-gap);
21
21
  padding: var(--record-view-padding);
@@ -54,7 +54,7 @@ export class RecordViewBody extends LitElement {
54
54
  border-bottom: var(--record-view-border-bottom);
55
55
  font: var(--record-view-font);
56
56
  color: var(--record-view-color);
57
- background-color: transparent;
57
+ background-color: var(--record-view-grid-field-background-color, var(--md-sys-color-surface-variant));
58
58
  }
59
59
 
60
60
  ox-grid-field[editing='true'] {
@@ -65,6 +65,18 @@ export class RecordViewBody extends LitElement {
65
65
  color: var(--record-view-focus-color);
66
66
  font-weight: bold;
67
67
  }
68
+
69
+ @media only screen and (max-width: 460px) {
70
+ :host {
71
+ grid-template-columns: 2fr 3fr;
72
+ }
73
+ }
74
+
75
+ @media (min-width: 1200px) {
76
+ :host {
77
+ grid-template-columns: 2fr 3fr 2fr 3fr 2fr 3fr;
78
+ }
79
+ }
68
80
  `
69
81
  ]
70
82
 
@@ -54,9 +54,8 @@ export class RecordView extends LitElement {
54
54
  }
55
55
 
56
56
  [footer] button md-icon {
57
- margin-top: -3px;
58
- margin-right: 5px;
59
- font-size: var(--record-view-footer-iconbutton-size);
57
+ --md-icon-size: var(--record-view-footer-iconbutton-size);
58
+ margin-right: var(--spacing-small, 4px);
60
59
  }
61
60
 
62
61
  [footer] button[ok] {
@@ -6,12 +6,9 @@ import '@operato/popup/ox-popup-list.js'
6
6
  import '@material/web/icon/icon.js'
7
7
 
8
8
  import { html, TemplateResult } from 'lit'
9
+ import { styles as MDTypeScaleStyles } from '@material/web/typography/md-typescale-styles'
9
10
 
10
- import {
11
- FetchHandler,
12
- FetchOption,
13
- GristEventHandler,
14
- } from '../src/types.js'
11
+ import { FetchHandler, FetchOption, GristEventHandler } from '../src/types.js'
15
12
 
16
13
  import { CommonHeaderStyles, CommonGristStyles } from '@operato/styles'
17
14
 
@@ -60,10 +57,14 @@ const config = {
60
57
  icon: 'add',
61
58
  title: 'add',
62
59
  handlers: {
63
- click: ((columns, data, column, record, rowIndex, target, e) => console.log('column - clicked')) as GristEventHandler,
64
- dblclick: ((columns, data, column, record, rowIndex, target, e) => console.log('column - dblclicked')) as GristEventHandler,
65
- contextmenu: ((columns, data, column, record, rowIndex, target, e) => console.log('column - contextmenued')) as GristEventHandler,
66
- focus: ((columns, data, column, record, rowIndex, target, e) => console.log('column - focused')) as GristEventHandler,
60
+ click: ((columns, data, column, record, rowIndex, target, e) =>
61
+ console.log('column - clicked')) as GristEventHandler,
62
+ dblclick: ((columns, data, column, record, rowIndex, target, e) =>
63
+ console.log('column - dblclicked')) as GristEventHandler,
64
+ contextmenu: ((columns, data, column, record, rowIndex, target, e) =>
65
+ console.log('column - contextmenued')) as GristEventHandler,
66
+ focus: ((columns, data, column, record, rowIndex, target, e) =>
67
+ console.log('column - focused')) as GristEventHandler
67
68
  }
68
69
  },
69
70
  {
@@ -162,11 +163,14 @@ const config = {
162
163
  multiple: false
163
164
  },
164
165
  handlers: {
165
- click: ((columns, data, column, record, rowIndex, target, e) => console.log('row - clicked')) as GristEventHandler,
166
- dblclick: ((columns, data, column, record, rowIndex, target, e) => console.log('row - dblclicked')) as GristEventHandler,
167
- contextmenu: ((columns, data, column, record, rowIndex, target, e) => console.log('row - contextmenued')) as GristEventHandler,
168
- focus: ((columns, data, column, record, rowIndex, target, e) => console.log('row - focused')) as GristEventHandler,
169
- },
166
+ click: ((columns, data, column, record, rowIndex, target, e) =>
167
+ console.log('row - clicked')) as GristEventHandler,
168
+ dblclick: ((columns, data, column, record, rowIndex, target, e) =>
169
+ console.log('row - dblclicked')) as GristEventHandler,
170
+ contextmenu: ((columns, data, column, record, rowIndex, target, e) =>
171
+ console.log('row - contextmenued')) as GristEventHandler,
172
+ focus: ((columns, data, column, record, rowIndex, target, e) => console.log('row - focused')) as GristEventHandler
173
+ },
170
174
  accumulator: true
171
175
  },
172
176
  sorters: [
@@ -187,7 +191,9 @@ export default {
187
191
  config: { control: 'object' },
188
192
  mode: { control: 'select', options: ['GRID', 'LIST', 'CARD'] },
189
193
  urlParamsSensitive: { control: 'boolean' },
190
- withoutSearch: { control: 'boolean' }
194
+ withoutSearch: { control: 'boolean' },
195
+ preventCloseOnBlur: { control: 'boolean' },
196
+ theme: { control: 'select', options: ['light', 'dark'] }
191
197
  }
192
198
  }
193
199
 
@@ -199,10 +205,12 @@ interface Story<T> {
199
205
 
200
206
  interface ArgTypes {
201
207
  config: object
202
- mode: 'GRID'|'LIST'|'CARD'
208
+ mode: 'GRID' | 'LIST' | 'CARD'
203
209
  urlParamsSensitive: boolean
204
210
  withoutSearch: boolean
211
+ preventCloseOnBlur: boolean
205
212
  fetchHandler: FetchHandler
213
+ theme: 'light' | 'dark'
206
214
  }
207
215
 
208
216
  const Template: Story<ArgTypes> = ({
@@ -210,9 +218,18 @@ const Template: Story<ArgTypes> = ({
210
218
  mode = 'GRID',
211
219
  urlParamsSensitive = false,
212
220
  withoutSearch = false,
213
- fetchHandler
221
+ preventCloseOnBlur = false,
222
+ fetchHandler,
223
+ theme = 'light'
214
224
  }: ArgTypes) =>
215
- html` <link
225
+ html` <link href="https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700&display=swap" rel="stylesheet" />
226
+
227
+ <link href="/themes/light.css" rel="stylesheet" />
228
+ <link href="/themes/dark.css" rel="stylesheet" />
229
+ <link href="/themes/spacing.css" rel="stylesheet" />
230
+ <link href="/themes/grist-theme.css" rel="stylesheet" />
231
+
232
+ <link
216
233
  href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL@20..48,100..700,0..1"
217
234
  rel="stylesheet"
218
235
  />
@@ -225,15 +242,19 @@ const Template: Story<ArgTypes> = ({
225
242
  rel="stylesheet"
226
243
  />
227
244
 
228
- <link href="/themes/app-theme.css" rel="stylesheet" />
229
- <link href="/themes/oops-theme.css" rel="stylesheet" />
230
- <link href="/themes/grist-theme.css" rel="stylesheet" />
245
+ <style>
246
+ ${MDTypeScaleStyles.cssText}
247
+ </style>
231
248
 
232
249
  <style>
233
250
  ${CommonGristStyles.cssText}
234
251
  ${CommonHeaderStyles.cssText}
235
252
  </style>
236
253
 
254
+ <script>
255
+ document.body.classList.add('${theme}')
256
+ </script>
257
+
237
258
  <style>
238
259
  ox-grist {
239
260
  height: 600px;
@@ -254,7 +275,7 @@ const Template: Story<ArgTypes> = ({
254
275
  <div slot="headroom" class="header">
255
276
  <div class="filters">
256
277
  <ox-filters-form ?without-search=${withoutSearch} autofocus></ox-filters-form>
257
- <ox-record-creator id="add" light-popup>
278
+ <ox-record-creator id="add" light-popup ?prevent-close-on-blur=${preventCloseOnBlur}>
258
279
  <button><md-icon>add</md-icon></button>
259
280
  </ox-record-creator>
260
281
  </div>
@@ -156,6 +156,7 @@ export default {
156
156
  component: 'ox-grist',
157
157
  argTypes: {
158
158
  headerFilter: { control: 'boolean' },
159
+ preventCloseOnBlur: { control: 'boolean' },
159
160
  theme: { control: 'select', options: ['light', 'dark'] }
160
161
  }
161
162
  }
@@ -168,10 +169,11 @@ interface Story<T> {
168
169
 
169
170
  interface ArgTypes {
170
171
  headerFilter: boolean
172
+ preventCloseOnBlur: boolean
171
173
  theme: 'light' | 'dark'
172
174
  }
173
175
 
174
- const Template: Story<ArgTypes> = ({ headerFilter, theme = 'light' }: ArgTypes) =>
176
+ const Template: Story<ArgTypes> = ({ headerFilter, preventCloseOnBlur, theme = 'light' }: ArgTypes) =>
175
177
  html` <link href="https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700&display=swap" rel="stylesheet" />
176
178
 
177
179
  <link href="/themes/light.css" rel="stylesheet" />
@@ -246,7 +248,7 @@ const Template: Story<ArgTypes> = ({ headerFilter, theme = 'light' }: ArgTypes)
246
248
  </ox-popup>
247
249
  </div>
248
250
 
249
- <ox-record-creator id="add" light-popup>
251
+ <ox-record-creator id="add" light-popup ?prevent-close-on-blur=${preventCloseOnBlur}>
250
252
  <button><md-icon>add</md-icon></button>
251
253
  </ox-record-creator>
252
254
  </div>