@things-factory/dataset 6.0.25 → 6.0.27

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.
Files changed (154) hide show
  1. package/README.md +26 -11
  2. package/assets/images/ooc.png +0 -0
  3. package/assets/images/oos.png +0 -0
  4. package/client/{bootstrap.js → bootstrap.ts} +2 -0
  5. package/client/components/{data-entry-form.js → data-entry-form.ts} +30 -33
  6. package/client/components/data-ooc-activity-view.ts +153 -0
  7. package/client/pages/data-archive/{data-archive-list-page.js → data-archive-list-page.ts} +67 -53
  8. package/client/pages/data-archive/{data-archive-request-popup.js → data-archive-request-popup.ts} +41 -39
  9. package/client/pages/data-entry/{data-entry-list-page.js → data-entry-list-page.ts} +41 -38
  10. package/client/pages/data-key-set/{data-key-item-list.js → data-key-item-list.ts} +31 -39
  11. package/client/pages/data-key-set/data-key-set-importer.ts +95 -0
  12. package/client/pages/data-key-set/{data-key-set-list-page.js → data-key-set-list-page.ts} +54 -35
  13. package/client/pages/data-ooc/{data-ooc-list-page.js → data-ooc-list-page.ts} +50 -36
  14. package/client/pages/data-ooc/{data-ooc-view.js → data-ooc-view.ts} +66 -76
  15. package/client/pages/data-report/{data-report-embed-page.js → data-report-embed-page.ts} +25 -34
  16. package/client/pages/data-report/{data-report-list-page.js → data-report-list-page.ts} +49 -43
  17. package/client/pages/data-report/{data-report-samples-page.js → data-report-samples-page.ts} +29 -43
  18. package/client/pages/data-report/{jasper-report-oocs-page.js → jasper-report-oocs-page.ts} +22 -34
  19. package/client/pages/data-report/{jasper-report-samples-crosstab-page.js → jasper-report-samples-crosstab-page.ts} +22 -34
  20. package/client/pages/data-report/{jasper-report-samples-page.js → jasper-report-samples-page.ts} +22 -34
  21. package/client/pages/data-sample/{data-sample-list-page.js → data-sample-list-page.ts} +49 -36
  22. package/client/pages/data-sample/{data-sample-search-page.js → data-sample-search-page.ts} +53 -39
  23. package/client/pages/data-sample/{data-sample-view.js → data-sample-view.ts} +29 -33
  24. package/client/pages/data-sensor/{data-sensor-list-page.js → data-sensor-list-page.ts} +41 -35
  25. package/client/pages/data-set/{data-item-list.js → data-item-list.ts} +31 -37
  26. package/client/pages/data-set/data-set-importer.ts +96 -0
  27. package/client/pages/data-set/{data-set-list-page.js → data-set-list-page.ts} +62 -36
  28. package/client/{route.js → route.ts} +1 -1
  29. package/client/tsconfig.json +11 -0
  30. package/dist-client/bootstrap.d.ts +3 -0
  31. package/dist-client/bootstrap.js +14 -0
  32. package/dist-client/bootstrap.js.map +1 -0
  33. package/dist-client/components/data-entry-form.d.ts +15 -0
  34. package/dist-client/components/data-entry-form.js +83 -0
  35. package/dist-client/components/data-entry-form.js.map +1 -0
  36. package/dist-client/components/data-ooc-activity-view.d.ts +1 -0
  37. package/dist-client/components/data-ooc-activity-view.js +154 -0
  38. package/dist-client/components/data-ooc-activity-view.js.map +1 -0
  39. package/dist-client/index.d.ts +1 -0
  40. package/dist-client/index.js +2 -0
  41. package/dist-client/index.js.map +1 -0
  42. package/dist-client/pages/data-archive/data-archive-list-page.d.ts +71 -0
  43. package/dist-client/pages/data-archive/data-archive-list-page.js +287 -0
  44. package/dist-client/pages/data-archive/data-archive-list-page.js.map +1 -0
  45. package/dist-client/pages/data-archive/data-archive-request-popup.d.ts +1 -0
  46. package/dist-client/pages/data-archive/data-archive-request-popup.js +161 -0
  47. package/dist-client/pages/data-archive/data-archive-request-popup.js.map +1 -0
  48. package/dist-client/pages/data-entry/data-entry-list-page.d.ts +36 -0
  49. package/dist-client/pages/data-entry/data-entry-list-page.js +383 -0
  50. package/dist-client/pages/data-entry/data-entry-list-page.js.map +1 -0
  51. package/dist-client/pages/data-key-set/data-key-item-list.d.ts +18 -0
  52. package/dist-client/pages/data-key-set/data-key-item-list.js +188 -0
  53. package/dist-client/pages/data-key-set/data-key-item-list.js.map +1 -0
  54. package/dist-client/pages/data-key-set/data-key-set-importer.d.ts +9 -0
  55. package/dist-client/pages/data-key-set/data-key-set-importer.js +100 -0
  56. package/dist-client/pages/data-key-set/data-key-set-importer.js.map +1 -0
  57. package/dist-client/pages/data-key-set/data-key-set-list-page.d.ts +60 -0
  58. package/dist-client/pages/data-key-set/data-key-set-list-page.js +450 -0
  59. package/dist-client/pages/data-key-set/data-key-set-list-page.js.map +1 -0
  60. package/dist-client/pages/data-ooc/data-ooc-list-page.d.ts +58 -0
  61. package/dist-client/pages/data-ooc/data-ooc-list-page.js +473 -0
  62. package/dist-client/pages/data-ooc/data-ooc-list-page.js.map +1 -0
  63. package/dist-client/pages/data-ooc/data-ooc-view.d.ts +1 -0
  64. package/dist-client/pages/data-ooc/data-ooc-view.js +179 -0
  65. package/dist-client/pages/data-ooc/data-ooc-view.js.map +1 -0
  66. package/dist-client/pages/data-report/data-report-embed-page.d.ts +36 -0
  67. package/dist-client/pages/data-report/data-report-embed-page.js +101 -0
  68. package/dist-client/pages/data-report/data-report-embed-page.js.map +1 -0
  69. package/dist-client/pages/data-report/data-report-list-page.d.ts +36 -0
  70. package/dist-client/pages/data-report/data-report-list-page.js +431 -0
  71. package/dist-client/pages/data-report/data-report-list-page.js.map +1 -0
  72. package/dist-client/pages/data-report/data-report-samples-page.d.ts +32 -0
  73. package/dist-client/pages/data-report/data-report-samples-page.js +164 -0
  74. package/dist-client/pages/data-report/data-report-samples-page.js.map +1 -0
  75. package/dist-client/pages/data-report/jasper-report-oocs-page.d.ts +2 -0
  76. package/dist-client/pages/data-report/jasper-report-oocs-page.js +101 -0
  77. package/dist-client/pages/data-report/jasper-report-oocs-page.js.map +1 -0
  78. package/dist-client/pages/data-report/jasper-report-samples-crosstab-page.d.ts +2 -0
  79. package/dist-client/pages/data-report/jasper-report-samples-crosstab-page.js +101 -0
  80. package/dist-client/pages/data-report/jasper-report-samples-crosstab-page.js.map +1 -0
  81. package/dist-client/pages/data-report/jasper-report-samples-page.d.ts +2 -0
  82. package/dist-client/pages/data-report/jasper-report-samples-page.js +101 -0
  83. package/dist-client/pages/data-report/jasper-report-samples-page.js.map +1 -0
  84. package/dist-client/pages/data-sample/data-sample-list-page.d.ts +58 -0
  85. package/dist-client/pages/data-sample/data-sample-list-page.js +412 -0
  86. package/dist-client/pages/data-sample/data-sample-list-page.js.map +1 -0
  87. package/dist-client/pages/data-sample/data-sample-search-page.d.ts +63 -0
  88. package/dist-client/pages/data-sample/data-sample-search-page.js +413 -0
  89. package/dist-client/pages/data-sample/data-sample-search-page.js.map +1 -0
  90. package/dist-client/pages/data-sample/data-sample-view.d.ts +1 -0
  91. package/dist-client/pages/data-sample/data-sample-view.js +109 -0
  92. package/dist-client/pages/data-sample/data-sample-view.js.map +1 -0
  93. package/dist-client/pages/data-sensor/data-sensor-list-page.d.ts +49 -0
  94. package/dist-client/pages/data-sensor/data-sensor-list-page.js +419 -0
  95. package/dist-client/pages/data-sensor/data-sensor-list-page.js.map +1 -0
  96. package/dist-client/pages/data-set/data-item-list.d.ts +1 -0
  97. package/dist-client/pages/data-set/data-item-list.js +267 -0
  98. package/dist-client/pages/data-set/data-item-list.js.map +1 -0
  99. package/dist-client/pages/data-set/data-set-importer.d.ts +10 -0
  100. package/dist-client/pages/data-set/data-set-importer.js +103 -0
  101. package/dist-client/pages/data-set/data-set-importer.js.map +1 -0
  102. package/dist-client/pages/data-set/data-set-list-page.d.ts +71 -0
  103. package/dist-client/pages/data-set/data-set-list-page.js +759 -0
  104. package/dist-client/pages/data-set/data-set-list-page.js.map +1 -0
  105. package/dist-client/route.d.ts +1 -0
  106. package/dist-client/route.js +47 -0
  107. package/dist-client/route.js.map +1 -0
  108. package/dist-client/tsconfig.tsbuildinfo +1 -0
  109. package/dist-server/controllers/activity-template/activity-ooc.js +59 -0
  110. package/dist-server/controllers/activity-template/activity-ooc.js.map +1 -0
  111. package/dist-server/controllers/create-data-sample.js +38 -1
  112. package/dist-server/controllers/create-data-sample.js.map +1 -1
  113. package/dist-server/controllers/index.js +5 -0
  114. package/dist-server/controllers/index.js.map +1 -1
  115. package/dist-server/index.js +1 -2
  116. package/dist-server/index.js.map +1 -1
  117. package/dist-server/routes.js +2 -2
  118. package/dist-server/routes.js.map +1 -1
  119. package/dist-server/service/data-set/data-set-query.js +5 -4
  120. package/dist-server/service/data-set/data-set-query.js.map +1 -1
  121. package/dist-server/service/data-set/data-set.js +3 -0
  122. package/dist-server/service/data-set/data-set.js.map +1 -1
  123. package/dist-server/service/data-set-history/data-set-history-query.js +4 -3
  124. package/dist-server/service/data-set-history/data-set-history-query.js.map +1 -1
  125. package/dist-server/tsconfig.tsbuildinfo +1 -1
  126. package/package.json +15 -12
  127. package/server/controllers/activity-template/activity-ooc.ts +55 -0
  128. package/server/controllers/create-data-sample.ts +48 -3
  129. package/server/controllers/index.ts +9 -0
  130. package/server/index.ts +1 -2
  131. package/server/routes.ts +2 -4
  132. package/server/service/data-set/data-set-query.ts +5 -4
  133. package/server/service/data-set/data-set.ts +3 -0
  134. package/server/service/data-set-history/data-set-history-query.ts +4 -3
  135. package/server/tsconfig.json +10 -0
  136. package/things-factory.config.js +2 -2
  137. package/translations/en.json +1 -1
  138. package/translations/ko.json +1 -1
  139. package/translations/ms.json +1 -0
  140. package/translations/zh.json +1 -0
  141. package/client/pages/data-key-set/data-key-set-importer.js +0 -105
  142. package/client/pages/data-set/data-set-importer.js +0 -103
  143. package/dist-server/middlewares/index.js +0 -8
  144. package/dist-server/middlewares/index.js.map +0 -1
  145. package/dist-server/migrations/index.js +0 -12
  146. package/dist-server/migrations/index.js.map +0 -1
  147. package/server/middlewares/index.ts +0 -3
  148. package/server/migrations/index.ts +0 -9
  149. package/tsconfig.json +0 -9
  150. /package/assets/{data-report.jpg → images/data-report.jpg} +0 -0
  151. /package/assets/{data-samples.jpg → images/data-samples.jpg} +0 -0
  152. /package/assets/{diagram.jpg → images/dataset-diagram.jpg} +0 -0
  153. /package/assets/{glue-table-indices.png → images/glue-table-indices-for-dataset.png} +0 -0
  154. /package/client/{index.js → index.ts} +0 -0
@@ -2,6 +2,8 @@ import '@operato/data-grist'
2
2
 
3
3
  import gql from 'graphql-tag'
4
4
  import { css, html } from 'lit'
5
+ import { customElement, property, query, state } from 'lit/decorators.js'
6
+
5
7
  import { connect } from 'pwa-helpers/connect-mixin'
6
8
 
7
9
  import { client } from '@operato/graphql'
@@ -10,39 +12,49 @@ import { notify } from '@operato/layout'
10
12
  import { PageView, store } from '@operato/shell'
11
13
  import { CommonButtonStyles, CommonGristStyles, ScrollbarStyles } from '@operato/styles'
12
14
  import { isMobileDevice } from '@operato/utils'
15
+ import { ColumnConfig, DataGrist, FetchOption, SortersControl } from '@operato/data-grist'
16
+ import { OxPopup } from '@operato/popup'
13
17
 
18
+ @customElement('data-sensor-list-page')
14
19
  export class DataSensorListPage extends connect(store)(localize(i18next)(PageView)) {
15
- static get properties() {
16
- return {
17
- active: String,
18
- gristConfig: Object,
19
- mode: String
20
- }
21
- }
20
+ static styles = [
21
+ ScrollbarStyles,
22
+ CommonGristStyles,
23
+ css`
24
+ :host {
25
+ display: flex;
26
+ flex-direction: column;
22
27
 
23
- static get styles() {
24
- return [
25
- ScrollbarStyles,
26
- CommonGristStyles,
27
- css`
28
- :host {
29
- display: flex;
30
- flex-direction: column;
28
+ overflow: hidden;
29
+ }
31
30
 
32
- overflow: hidden;
33
- }
31
+ ox-grist {
32
+ overflow-y: auto;
33
+ flex: 1;
34
+ }
35
+ `
36
+ ]
34
37
 
35
- ox-grist {
36
- overflow-y: auto;
37
- flex: 1;
38
- }
39
- `
40
- ]
41
- }
38
+ @state() gristConfig: any
39
+ @state() mode: 'CARD' | 'GRID' | 'LIST' = isMobileDevice() ? 'CARD' : 'GRID'
40
+
41
+ @query('ox-grist') private grist!: DataGrist
42
+ @query('#sorter-control') private sortersControl!: OxPopup
42
43
 
43
44
  get context() {
44
45
  return {
45
- title: i18next.t('title.data-sensor list'),
46
+ search: {
47
+ handler: (search: string) => {
48
+ this.grist.searchText = search
49
+ },
50
+ placeholder: i18next.t('title.data-sensor list'),
51
+ value: this.grist.searchText
52
+ },
53
+ filter: {
54
+ handler: () => {
55
+ this.grist.toggleHeadroom()
56
+ }
57
+ },
46
58
  help: 'dataset/data-sensor',
47
59
  actions: [
48
60
  {
@@ -76,7 +88,7 @@ export class DataSensorListPage extends connect(store)(localize(i18next)(PageVie
76
88
  >
77
89
  <div slot="headroom">
78
90
  <div id="filters">
79
- <ox-filters-form autofocus></ox-filters-form>
91
+ <ox-filters-form autofocus without-search></ox-filters-form>
80
92
  </div>
81
93
 
82
94
  <div id="sorters">
@@ -84,7 +96,7 @@ export class DataSensorListPage extends connect(store)(localize(i18next)(PageVie
84
96
  <mwc-icon
85
97
  @click=${e => {
86
98
  const target = e.currentTarget
87
- this.renderRoot.querySelector('#sorter-control').open({
99
+ this.sortersControl.open({
88
100
  right: 0,
89
101
  top: target.offsetTop + target.offsetHeight
90
102
  })
@@ -106,10 +118,6 @@ export class DataSensorListPage extends connect(store)(localize(i18next)(PageVie
106
118
  `
107
119
  }
108
120
 
109
- get grist() {
110
- return this.renderRoot.querySelector('ox-grist')
111
- }
112
-
113
121
  async pageInitialized(lifecycle) {
114
122
  this.gristConfig = {
115
123
  list: { fields: ['name', 'description', 'active'] },
@@ -290,7 +298,7 @@ export class DataSensorListPage extends connect(store)(localize(i18next)(PageVie
290
298
  }
291
299
  }
292
300
 
293
- async fetchHandler({ page, limit, sortings = [], filters = [] }) {
301
+ async fetchHandler({ page, limit, sortings = [], filters = [] }: FetchOption) {
294
302
  const response = await client.query({
295
303
  query: gql`
296
304
  query ($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) {
@@ -390,7 +398,7 @@ export class DataSensorListPage extends connect(store)(localize(i18next)(PageVie
390
398
  let patches = this.grist.dirtyRecords
391
399
  if (patches && patches.length) {
392
400
  patches = patches.map(patch => {
393
- let patchField = patch.id ? { id: patch.id } : {}
401
+ let patchField: any = patch.id ? { id: patch.id } : {}
394
402
  const dirtyFields = patch.__dirtyfields__
395
403
  for (let key in dirtyFields) {
396
404
  patchField[key] = dirtyFields[key].after
@@ -417,5 +425,3 @@ export class DataSensorListPage extends connect(store)(localize(i18next)(PageVie
417
425
  }
418
426
  }
419
427
  }
420
-
421
- window.customElements.define('data-sensor-list-page', DataSensorListPage)
@@ -1,51 +1,47 @@
1
1
  import gql from 'graphql-tag'
2
2
  import { css, html, LitElement } from 'lit'
3
+ import { customElement, property, query, state } from 'lit/decorators.js'
3
4
 
4
5
  import { client } from '@operato/graphql'
5
6
  import { i18next, localize } from '@operato/i18n'
6
7
  import { isMobileDevice } from '@operato/utils'
8
+ import { ColumnConfig, DataGrist, FetchOption, SortersControl } from '@operato/data-grist'
7
9
 
10
+ @customElement('data-item-list')
8
11
  class DataItemList extends localize(i18next)(LitElement) {
9
- static get properties() {
10
- return {
11
- dataSet: Object,
12
- gristConfig: Object
13
- }
14
- }
12
+ @property({ type: Object }) dataSet: any
15
13
 
16
- static get styles() {
17
- return [
18
- css`
19
- :host {
20
- display: flex;
21
- flex-direction: column;
14
+ @state() gristConfig: any
22
15
 
23
- background-color: #fff;
24
- }
16
+ static styles = [
17
+ css`
18
+ :host {
19
+ display: flex;
20
+ flex-direction: column;
25
21
 
26
- ox-grist {
27
- flex: 1;
28
- }
22
+ background-color: #fff;
23
+ }
29
24
 
30
- .button-container {
31
- display: flex;
32
- margin-left: auto;
33
- padding: var(--padding-default);
34
- }
25
+ ox-grist {
26
+ flex: 1;
27
+ }
35
28
 
36
- [danger] {
37
- --mdc-theme-primary: var(--mdc-danger-button-primary-color);
38
- }
39
- mwc-button {
40
- margin-left: var(--margin-default);
41
- }
42
- `
43
- ]
44
- }
29
+ .button-container {
30
+ display: flex;
31
+ margin-left: auto;
32
+ padding: var(--padding-default);
33
+ }
45
34
 
46
- get grist() {
47
- return this.renderRoot.querySelector('ox-grist')
48
- }
35
+ [danger] {
36
+ --mdc-theme-primary: var(--mdc-danger-button-primary-color);
37
+ }
38
+ mwc-button {
39
+ margin-left: var(--margin-default);
40
+ }
41
+ `
42
+ ]
43
+
44
+ @query('ox-grist') private grist!: DataGrist
49
45
 
50
46
  render() {
51
47
  return html`
@@ -223,7 +219,7 @@ class DataItemList extends localize(i18next)(LitElement) {
223
219
  }
224
220
  }
225
221
 
226
- async fetchHandler({ filters, page, limit, sortings = [] }) {
222
+ async fetchHandler({ filters, page, limit, sortings = [] }: FetchOption) {
227
223
  const dataItems = this.dataSet.dataItems || []
228
224
 
229
225
  return {
@@ -273,5 +269,3 @@ class DataItemList extends localize(i18next)(LitElement) {
273
269
  this.grist.deleteSelectedRecords(false)
274
270
  }
275
271
  }
276
-
277
- window.customElements.define('data-item-list', DataItemList)
@@ -0,0 +1,96 @@
1
+ import '@operato/data-grist'
2
+
3
+ import gql from 'graphql-tag'
4
+ import { css, html, LitElement } from 'lit'
5
+ import { customElement, property, state } from 'lit/decorators.js'
6
+
7
+ import { client } from '@operato/graphql'
8
+ import { i18next } from '@operato/i18n'
9
+ import { isMobileDevice } from '@operato/utils'
10
+ import { DataSet } from '@operato/dataset'
11
+
12
+ @customElement('data-set-importer')
13
+ export class DataSetImporter extends LitElement {
14
+ static styles = [
15
+ css`
16
+ :host {
17
+ display: flex;
18
+ flex-direction: column;
19
+
20
+ background-color: #fff;
21
+ }
22
+
23
+ ox-grist {
24
+ flex: 1;
25
+ }
26
+
27
+ .button-container {
28
+ display: flex;
29
+ margin-left: auto;
30
+ padding: var(--padding-default);
31
+ }
32
+
33
+ mwc-button {
34
+ margin-left: var(--margin-default);
35
+ }
36
+ `
37
+ ]
38
+
39
+ @property({ type: Array }) dataSets: DataSet[] = []
40
+
41
+ @state() columns: any = {
42
+ list: { fields: ['name', 'description'] },
43
+ pagination: { infinite: true },
44
+ columns: [
45
+ {
46
+ type: 'string',
47
+ name: 'name',
48
+ header: i18next.t('field.name'),
49
+ width: 150
50
+ },
51
+ {
52
+ type: 'string',
53
+ name: 'description',
54
+ header: i18next.t('field.description'),
55
+ width: 200
56
+ },
57
+ {
58
+ type: 'checkbox',
59
+ name: 'active',
60
+ header: i18next.t('field.active'),
61
+ width: 60
62
+ }
63
+ ]
64
+ }
65
+
66
+ render() {
67
+ return html`
68
+ <ox-grist
69
+ .mode=${isMobileDevice() ? 'LIST' : 'GRID'}
70
+ .config=${this.columns}
71
+ .data=${{ records: this.dataSets }}
72
+ ></ox-grist>
73
+
74
+ <div class="button-container">
75
+ <mwc-button raised @click=${this.save.bind(this)}>${i18next.t('button.save')}</mwc-button>
76
+ </div>
77
+ `
78
+ }
79
+
80
+ async save() {
81
+ const response = await client.mutate({
82
+ mutation: gql`
83
+ mutation importDataSets($dataSets: [DataSetPatch!]!) {
84
+ importDataSets(dataSets: $dataSets)
85
+ }
86
+ `,
87
+ variables: { dataSets: this.dataSets }
88
+ })
89
+
90
+ if (response.errors?.length) {
91
+ return
92
+ }
93
+
94
+ this.dispatchEvent(new CustomEvent('imported'))
95
+ }
96
+ }
@@ -3,12 +3,21 @@ import './data-item-list.js'
3
3
  import './data-set-importer.js'
4
4
  import '../../components/data-entry-form.js'
5
5
 
6
+ import moment from 'moment-timezone'
6
7
  import gql from 'graphql-tag'
7
8
  import { css, html } from 'lit'
8
- import moment from 'moment-timezone'
9
+ import { customElement, property, query, state } from 'lit/decorators.js'
9
10
  import { connect } from 'pwa-helpers/connect-mixin'
10
11
 
11
- import { getEditor, getRenderer } from '@operato/data-grist'
12
+ import {
13
+ getEditor,
14
+ getRenderer,
15
+ ColumnConfig,
16
+ DataGrist,
17
+ FetchOption,
18
+ SortersControl,
19
+ ImexConfig
20
+ } from '@operato/data-grist'
12
21
  import { OxDataUseCase } from '@operato/dataset'
13
22
  import { client } from '@operato/graphql'
14
23
  import { i18next, localize } from '@operato/i18n'
@@ -16,6 +25,7 @@ import { notify, openPopup } from '@operato/layout'
16
25
  import { PageView, store } from '@operato/shell'
17
26
  import { CommonButtonStyles, CommonGristStyles, ScrollbarStyles } from '@operato/styles'
18
27
  import { isMobileDevice } from '@operato/utils'
28
+ import { OxPopup } from '@operato/popup'
19
29
 
20
30
  const DEFAULT_TZ = Intl.DateTimeFormat().resolvedOptions().timeZone
21
31
  const TIMEZONE_OPTIONS = ['', DEFAULT_TZ, ...moment.tz.names().filter(tz => tz !== DEFAULT_TZ)]
@@ -33,6 +43,10 @@ const ENTRY_TYPES = [
33
43
  display: 'Board',
34
44
  value: 'board'
35
45
  },
46
+ {
47
+ display: 'CustomElement',
48
+ value: 'custom-element'
49
+ },
36
50
  {
37
51
  display: 'Page',
38
52
  value: 'page'
@@ -56,6 +70,10 @@ const MONITOR_TYPES = [
56
70
  display: 'Board',
57
71
  value: 'board'
58
72
  },
73
+ {
74
+ display: 'CustomElement',
75
+ value: 'custom-element'
76
+ },
59
77
  {
60
78
  display: 'Page',
61
79
  value: 'page'
@@ -79,6 +97,10 @@ const REPORT_TYPES = [
79
97
  display: 'Embed',
80
98
  value: 'embed'
81
99
  },
100
+ {
101
+ display: 'CustomElement',
102
+ value: 'custom-element'
103
+ },
82
104
  {
83
105
  display: 'Page',
84
106
  value: 'page'
@@ -105,34 +127,44 @@ const USECASE_OPTIONS = () => {
105
127
  }
106
128
  })
107
129
  }
130
+
131
+ @customElement('data-set-list-page')
108
132
  export class DataSetListPage extends connect(store)(localize(i18next)(PageView)) {
109
- static get properties() {
110
- return {
111
- gristConfig: Object,
112
- mode: String
113
- }
114
- }
133
+ static styles = [
134
+ ScrollbarStyles,
135
+ CommonGristStyles,
136
+ css`
137
+ :host {
138
+ display: flex;
115
139
 
116
- static get styles() {
117
- return [
118
- ScrollbarStyles,
119
- CommonGristStyles,
120
- css`
121
- :host {
122
- display: flex;
140
+ width: 100%;
123
141
 
124
- width: 100%;
142
+ --grid-record-emphasized-background-color: red;
143
+ --grid-record-emphasized-color: yellow;
144
+ }
145
+ `
146
+ ]
125
147
 
126
- --grid-record-emphasized-background-color: red;
127
- --grid-record-emphasized-color: yellow;
128
- }
129
- `
130
- ]
131
- }
148
+ @state() gristConfig: any
149
+ @state() mode: 'CARD' | 'GRID' | 'LIST' = isMobileDevice() ? 'CARD' : 'GRID'
150
+
151
+ @query('ox-grist') private grist!: DataGrist
152
+ @query('#sorter-control') private sortersControl!: OxPopup
132
153
 
133
154
  get context() {
134
155
  return {
135
- title: i18next.t('title.data-set list'),
156
+ search: {
157
+ handler: (search: string) => {
158
+ this.grist.searchText = search
159
+ },
160
+ placeholder: i18next.t('title.data-set list'),
161
+ value: this.grist.searchText
162
+ },
163
+ filter: {
164
+ handler: () => {
165
+ this.grist.toggleHeadroom()
166
+ }
167
+ },
136
168
  help: 'dataset/data-set',
137
169
  actions: [
138
170
  {
@@ -162,7 +194,7 @@ export class DataSetListPage extends connect(store)(localize(i18next)(PageView))
162
194
  }
163
195
 
164
196
  render() {
165
- const mode = this.mode || (isMobileDevice() ? 'LIST' : 'GRID')
197
+ const mode = this.mode || (isMobileDevice() ? 'CARD' : 'GRID')
166
198
 
167
199
  return html`
168
200
  <ox-grist
@@ -173,7 +205,7 @@ export class DataSetListPage extends connect(store)(localize(i18next)(PageView))
173
205
  >
174
206
  <div slot="headroom">
175
207
  <div id="filters">
176
- <ox-filters-form autofocus></ox-filters-form>
208
+ <ox-filters-form autofocus without-search></ox-filters-form>
177
209
  </div>
178
210
 
179
211
  <div id="sorters">
@@ -181,7 +213,7 @@ export class DataSetListPage extends connect(store)(localize(i18next)(PageView))
181
213
  <mwc-icon
182
214
  @click=${e => {
183
215
  const target = e.currentTarget
184
- this.renderRoot.querySelector('#sorter-control').open({
216
+ this.sortersControl.open({
185
217
  right: 0,
186
218
  top: target.offsetTop + target.offsetHeight
187
219
  })
@@ -203,10 +235,6 @@ export class DataSetListPage extends connect(store)(localize(i18next)(PageView))
203
235
  `
204
236
  }
205
237
 
206
- get grist() {
207
- return this.renderRoot.querySelector('ox-grist')
208
- }
209
-
210
238
  async pageInitialized(lifecycle) {
211
239
  this.gristConfig = {
212
240
  list: {
@@ -383,7 +411,6 @@ export class DataSetListPage extends connect(store)(localize(i18next)(PageView))
383
411
  }
384
412
  },
385
413
  width: 80,
386
- label: true,
387
414
  imex: {
388
415
  width: 13,
389
416
  header: i18next.t('field.schedule'),
@@ -564,7 +591,7 @@ export class DataSetListPage extends connect(store)(localize(i18next)(PageView))
564
591
  }
565
592
  }
566
593
 
567
- async fetchHandler({ page, limit, sortings = [], filters = [] }) {
594
+ async fetchHandler({ page, limit, sortings = [], filters = [] }: FetchOption) {
568
595
  const response = await client.query({
569
596
  query: gql`
570
597
  query ($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) {
@@ -685,7 +712,7 @@ export class DataSetListPage extends connect(store)(localize(i18next)(PageView))
685
712
  let patches = this.grist.dirtyRecords
686
713
  if (patches && patches.length) {
687
714
  patches = patches.map(patch => {
688
- let patchField = patch.id ? { id: patch.id } : {}
715
+ let patchField: any = patch.id ? { id: patch.id } : {}
689
716
  const dirtyFields = patch.__dirtyfields__
690
717
  for (let key in dirtyFields) {
691
718
  patchField[key] = dirtyFields[key].after
@@ -735,7 +762,8 @@ export class DataSetListPage extends connect(store)(localize(i18next)(PageView))
735
762
  ...this.grist._config.columns
736
763
  .filter(column => column.type !== 'gutter' && column.record !== undefined && column.imex !== undefined)
737
764
  .reduce((record, column) => {
738
- record[column.imex.key] = column.imex.key
765
+ var imexKey = (column.imex as ImexConfig)!.key
766
+ record[imexKey] = imexKey
739
767
  .split('.')
740
768
  .reduce((obj, key) => (obj && obj[key] !== 'undefined' ? obj[key] : undefined), item)
741
769
  return record
@@ -764,5 +792,3 @@ export class DataSetListPage extends connect(store)(localize(i18next)(PageView))
764
792
  )
765
793
  }
766
794
  }
767
-
768
- window.customElements.define('data-set-list-page', DataSetListPage)
@@ -31,7 +31,7 @@ export default function route(page) {
31
31
  case 'data-report-list':
32
32
  import('./pages/data-report/data-report-list-page.js')
33
33
  return page
34
-
34
+
35
35
  case 'data-archive-list':
36
36
  import('./pages/data-archive/data-archive-list-page.js')
37
37
  return page
@@ -0,0 +1,11 @@
1
+ {
2
+ "extends": "../../tsconfig-base.json",
3
+ "compilerOptions": {
4
+ "strict": true,
5
+ "declaration": true,
6
+ "module": "esnext",
7
+ "outDir": "../dist-client",
8
+ "baseUrl": "./"
9
+ },
10
+ "include": ["./**/*"]
11
+ }
@@ -0,0 +1,3 @@
1
+ import './components/data-ooc-activity-view';
2
+ import '@operato/app/filter-renderer.js';
3
+ export default function bootstrap(): void;
@@ -0,0 +1,14 @@
1
+ import './components/data-ooc-activity-view'; /* refered by the activity template (activity-ooc) on server */
2
+ import '@operato/app/filter-renderer.js'; /* register resource-object filter renderer */
3
+ import { OxGristEditorCode } from '@operato/app/grist-editor/ox-grist-editor-code.js';
4
+ import { OxGristRendererJson5, registerEditor as registerGristEditor, registerRenderer as registerGristRenderer } from '@operato/data-grist';
5
+ import { OxGristEditorDataItemSpec } from '@operato/dataset/grist-editor';
6
+ import { OxGristEditorPartitionKeys } from '@operato/grist-editor/ox-grist-editor-partition-keys.js';
7
+ export default function bootstrap() {
8
+ registerGristEditor('data-item-spec', OxGristEditorDataItemSpec);
9
+ registerGristRenderer('data-item-spec', OxGristRendererJson5);
10
+ registerGristEditor('script', OxGristEditorCode);
11
+ registerGristEditor('partition-keys', OxGristEditorPartitionKeys);
12
+ registerGristRenderer('partition-keys', OxGristRendererJson5);
13
+ }
14
+ //# sourceMappingURL=bootstrap.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bootstrap.js","sourceRoot":"","sources":["../client/bootstrap.ts"],"names":[],"mappings":"AAAA,OAAO,qCAAqC,CAAA,CAAC,+DAA+D;AAE5G,OAAO,iCAAiC,CAAA,CAAC,8CAA8C;AAEvF,OAAO,EAAE,iBAAiB,EAAE,MAAM,mDAAmD,CAAA;AACrF,OAAO,EACL,oBAAoB,EACpB,cAAc,IAAI,mBAAmB,EACrC,gBAAgB,IAAI,qBAAqB,EAC1C,MAAM,qBAAqB,CAAA;AAC5B,OAAO,EAAE,yBAAyB,EAAE,MAAM,+BAA+B,CAAA;AACzE,OAAO,EAAE,0BAA0B,EAAE,MAAM,yDAAyD,CAAA;AAEpG,MAAM,CAAC,OAAO,UAAU,SAAS;IAC/B,mBAAmB,CAAC,gBAAgB,EAAE,yBAAyB,CAAC,CAAA;IAChE,qBAAqB,CAAC,gBAAgB,EAAE,oBAAoB,CAAC,CAAA;IAE7D,mBAAmB,CAAC,QAAQ,EAAE,iBAAiB,CAAC,CAAA;IAEhD,mBAAmB,CAAC,gBAAgB,EAAE,0BAA0B,CAAC,CAAA;IACjE,qBAAqB,CAAC,gBAAgB,EAAE,oBAAoB,CAAC,CAAA;AAC/D,CAAC","sourcesContent":["import './components/data-ooc-activity-view' /* refered by the activity template (activity-ooc) on server */\n\nimport '@operato/app/filter-renderer.js' /* register resource-object filter renderer */\n\nimport { OxGristEditorCode } from '@operato/app/grist-editor/ox-grist-editor-code.js'\nimport {\n OxGristRendererJson5,\n registerEditor as registerGristEditor,\n registerRenderer as registerGristRenderer\n} from '@operato/data-grist'\nimport { OxGristEditorDataItemSpec } from '@operato/dataset/grist-editor'\nimport { OxGristEditorPartitionKeys } from '@operato/grist-editor/ox-grist-editor-partition-keys.js'\n\nexport default function bootstrap() {\n registerGristEditor('data-item-spec', OxGristEditorDataItemSpec)\n registerGristRenderer('data-item-spec', OxGristRendererJson5)\n\n registerGristEditor('script', OxGristEditorCode)\n\n registerGristEditor('partition-keys', OxGristEditorPartitionKeys)\n registerGristRenderer('partition-keys', OxGristRendererJson5)\n}\n"]}
@@ -0,0 +1,15 @@
1
+ import '@operato/dataset/ox-data-entry-form.js';
2
+ import { LitElement } from 'lit';
3
+ import { OxDataEntryForm } from '@operato/dataset/ox-data-entry-form.js';
4
+ import { DataSet } from '@operato/dataset';
5
+ declare const DataEntryForm_base: (new (...args: any[]) => LitElement) & typeof LitElement;
6
+ export declare class DataEntryForm extends DataEntryForm_base {
7
+ static styles: import("lit").CSSResult[];
8
+ dataSet?: DataSet & {
9
+ id: string;
10
+ };
11
+ entryForm: OxDataEntryForm;
12
+ render(): import("lit-html").TemplateResult<1>;
13
+ _updateDataItems(): Promise<void>;
14
+ }
15
+ export {};
@@ -0,0 +1,83 @@
1
+ import { __decorate, __metadata } from "tslib";
2
+ import '@operato/dataset/ox-data-entry-form.js';
3
+ import gql from 'graphql-tag';
4
+ import { css, html, LitElement } from 'lit';
5
+ import { customElement, property, query } from 'lit/decorators.js';
6
+ import { client } from '@operato/graphql';
7
+ import { i18next, localize } from '@operato/i18n';
8
+ import { ScrollbarStyles } from '@operato/styles';
9
+ import { OxDataEntryForm } from '@operato/dataset/ox-data-entry-form.js';
10
+ let DataEntryForm = class DataEntryForm extends localize(i18next)(LitElement) {
11
+ render() {
12
+ return html `
13
+ <ox-data-entry-form .dataSet=${this.dataSet}></ox-data-entry-form>
14
+ <div class="button-container">
15
+ <mwc-button raised @click=${this._updateDataItems.bind(this)}>${i18next.t('button.save')}</mwc-button>
16
+ </div>
17
+ `;
18
+ }
19
+ async _updateDataItems() {
20
+ var _a;
21
+ //@ts-ignore TODO replace with following line and confirm
22
+ const data = this.entryForm.buildValue();
23
+ // const data = this.entryForm.value
24
+ const dataSample = {
25
+ dataSet: {
26
+ id: (_a = this.dataSet) === null || _a === void 0 ? void 0 : _a.id
27
+ },
28
+ data
29
+ };
30
+ const response = await client.mutate({
31
+ mutation: gql `
32
+ mutation ($dataSample: NewDataSample!) {
33
+ createDataSample(dataSample: $dataSample) {
34
+ id
35
+ collectedAt
36
+ }
37
+ }
38
+ `,
39
+ variables: {
40
+ dataSample
41
+ }
42
+ });
43
+ if (!response.errors) {
44
+ document.dispatchEvent(new CustomEvent('notify', { detail: { message: i18next.t('text.data sample created successfully') } }));
45
+ }
46
+ }
47
+ };
48
+ DataEntryForm.styles = [
49
+ ScrollbarStyles,
50
+ css `
51
+ :host {
52
+ display: flex;
53
+ flex-direction: column;
54
+
55
+ background-color: #fff;
56
+ }
57
+
58
+ ox-data-entry-form {
59
+ flex: 1;
60
+ padding: 10px;
61
+ overflow: auto;
62
+ }
63
+
64
+ .button-container {
65
+ display: flex;
66
+ margin-left: auto;
67
+ padding: var(--padding-default);
68
+ }
69
+ `
70
+ ];
71
+ __decorate([
72
+ property({ type: Object }),
73
+ __metadata("design:type", Object)
74
+ ], DataEntryForm.prototype, "dataSet", void 0);
75
+ __decorate([
76
+ query('ox-data-entry-form'),
77
+ __metadata("design:type", OxDataEntryForm)
78
+ ], DataEntryForm.prototype, "entryForm", void 0);
79
+ DataEntryForm = __decorate([
80
+ customElement('data-entry-form')
81
+ ], DataEntryForm);
82
+ export { DataEntryForm };
83
+ //# sourceMappingURL=data-entry-form.js.map