@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.
- package/README.md +26 -11
- package/assets/images/ooc.png +0 -0
- package/assets/images/oos.png +0 -0
- package/client/{bootstrap.js → bootstrap.ts} +2 -0
- package/client/components/{data-entry-form.js → data-entry-form.ts} +30 -33
- package/client/components/data-ooc-activity-view.ts +153 -0
- package/client/pages/data-archive/{data-archive-list-page.js → data-archive-list-page.ts} +67 -53
- package/client/pages/data-archive/{data-archive-request-popup.js → data-archive-request-popup.ts} +41 -39
- package/client/pages/data-entry/{data-entry-list-page.js → data-entry-list-page.ts} +41 -38
- package/client/pages/data-key-set/{data-key-item-list.js → data-key-item-list.ts} +31 -39
- package/client/pages/data-key-set/data-key-set-importer.ts +95 -0
- package/client/pages/data-key-set/{data-key-set-list-page.js → data-key-set-list-page.ts} +54 -35
- package/client/pages/data-ooc/{data-ooc-list-page.js → data-ooc-list-page.ts} +50 -36
- package/client/pages/data-ooc/{data-ooc-view.js → data-ooc-view.ts} +66 -76
- package/client/pages/data-report/{data-report-embed-page.js → data-report-embed-page.ts} +25 -34
- package/client/pages/data-report/{data-report-list-page.js → data-report-list-page.ts} +49 -43
- package/client/pages/data-report/{data-report-samples-page.js → data-report-samples-page.ts} +29 -43
- package/client/pages/data-report/{jasper-report-oocs-page.js → jasper-report-oocs-page.ts} +22 -34
- package/client/pages/data-report/{jasper-report-samples-crosstab-page.js → jasper-report-samples-crosstab-page.ts} +22 -34
- package/client/pages/data-report/{jasper-report-samples-page.js → jasper-report-samples-page.ts} +22 -34
- package/client/pages/data-sample/{data-sample-list-page.js → data-sample-list-page.ts} +49 -36
- package/client/pages/data-sample/{data-sample-search-page.js → data-sample-search-page.ts} +53 -39
- package/client/pages/data-sample/{data-sample-view.js → data-sample-view.ts} +29 -33
- package/client/pages/data-sensor/{data-sensor-list-page.js → data-sensor-list-page.ts} +41 -35
- package/client/pages/data-set/{data-item-list.js → data-item-list.ts} +31 -37
- package/client/pages/data-set/data-set-importer.ts +96 -0
- package/client/pages/data-set/{data-set-list-page.js → data-set-list-page.ts} +62 -36
- package/client/{route.js → route.ts} +1 -1
- package/client/tsconfig.json +11 -0
- package/dist-client/bootstrap.d.ts +3 -0
- package/dist-client/bootstrap.js +14 -0
- package/dist-client/bootstrap.js.map +1 -0
- package/dist-client/components/data-entry-form.d.ts +15 -0
- package/dist-client/components/data-entry-form.js +83 -0
- package/dist-client/components/data-entry-form.js.map +1 -0
- package/dist-client/components/data-ooc-activity-view.d.ts +1 -0
- package/dist-client/components/data-ooc-activity-view.js +154 -0
- package/dist-client/components/data-ooc-activity-view.js.map +1 -0
- package/dist-client/index.d.ts +1 -0
- package/dist-client/index.js +2 -0
- package/dist-client/index.js.map +1 -0
- package/dist-client/pages/data-archive/data-archive-list-page.d.ts +71 -0
- package/dist-client/pages/data-archive/data-archive-list-page.js +287 -0
- package/dist-client/pages/data-archive/data-archive-list-page.js.map +1 -0
- package/dist-client/pages/data-archive/data-archive-request-popup.d.ts +1 -0
- package/dist-client/pages/data-archive/data-archive-request-popup.js +161 -0
- package/dist-client/pages/data-archive/data-archive-request-popup.js.map +1 -0
- package/dist-client/pages/data-entry/data-entry-list-page.d.ts +36 -0
- package/dist-client/pages/data-entry/data-entry-list-page.js +383 -0
- package/dist-client/pages/data-entry/data-entry-list-page.js.map +1 -0
- package/dist-client/pages/data-key-set/data-key-item-list.d.ts +18 -0
- package/dist-client/pages/data-key-set/data-key-item-list.js +188 -0
- package/dist-client/pages/data-key-set/data-key-item-list.js.map +1 -0
- package/dist-client/pages/data-key-set/data-key-set-importer.d.ts +9 -0
- package/dist-client/pages/data-key-set/data-key-set-importer.js +100 -0
- package/dist-client/pages/data-key-set/data-key-set-importer.js.map +1 -0
- package/dist-client/pages/data-key-set/data-key-set-list-page.d.ts +60 -0
- package/dist-client/pages/data-key-set/data-key-set-list-page.js +450 -0
- package/dist-client/pages/data-key-set/data-key-set-list-page.js.map +1 -0
- package/dist-client/pages/data-ooc/data-ooc-list-page.d.ts +58 -0
- package/dist-client/pages/data-ooc/data-ooc-list-page.js +473 -0
- package/dist-client/pages/data-ooc/data-ooc-list-page.js.map +1 -0
- package/dist-client/pages/data-ooc/data-ooc-view.d.ts +1 -0
- package/dist-client/pages/data-ooc/data-ooc-view.js +179 -0
- package/dist-client/pages/data-ooc/data-ooc-view.js.map +1 -0
- package/dist-client/pages/data-report/data-report-embed-page.d.ts +36 -0
- package/dist-client/pages/data-report/data-report-embed-page.js +101 -0
- package/dist-client/pages/data-report/data-report-embed-page.js.map +1 -0
- package/dist-client/pages/data-report/data-report-list-page.d.ts +36 -0
- package/dist-client/pages/data-report/data-report-list-page.js +431 -0
- package/dist-client/pages/data-report/data-report-list-page.js.map +1 -0
- package/dist-client/pages/data-report/data-report-samples-page.d.ts +32 -0
- package/dist-client/pages/data-report/data-report-samples-page.js +164 -0
- package/dist-client/pages/data-report/data-report-samples-page.js.map +1 -0
- package/dist-client/pages/data-report/jasper-report-oocs-page.d.ts +2 -0
- package/dist-client/pages/data-report/jasper-report-oocs-page.js +101 -0
- package/dist-client/pages/data-report/jasper-report-oocs-page.js.map +1 -0
- package/dist-client/pages/data-report/jasper-report-samples-crosstab-page.d.ts +2 -0
- package/dist-client/pages/data-report/jasper-report-samples-crosstab-page.js +101 -0
- package/dist-client/pages/data-report/jasper-report-samples-crosstab-page.js.map +1 -0
- package/dist-client/pages/data-report/jasper-report-samples-page.d.ts +2 -0
- package/dist-client/pages/data-report/jasper-report-samples-page.js +101 -0
- package/dist-client/pages/data-report/jasper-report-samples-page.js.map +1 -0
- package/dist-client/pages/data-sample/data-sample-list-page.d.ts +58 -0
- package/dist-client/pages/data-sample/data-sample-list-page.js +412 -0
- package/dist-client/pages/data-sample/data-sample-list-page.js.map +1 -0
- package/dist-client/pages/data-sample/data-sample-search-page.d.ts +63 -0
- package/dist-client/pages/data-sample/data-sample-search-page.js +413 -0
- package/dist-client/pages/data-sample/data-sample-search-page.js.map +1 -0
- package/dist-client/pages/data-sample/data-sample-view.d.ts +1 -0
- package/dist-client/pages/data-sample/data-sample-view.js +109 -0
- package/dist-client/pages/data-sample/data-sample-view.js.map +1 -0
- package/dist-client/pages/data-sensor/data-sensor-list-page.d.ts +49 -0
- package/dist-client/pages/data-sensor/data-sensor-list-page.js +419 -0
- package/dist-client/pages/data-sensor/data-sensor-list-page.js.map +1 -0
- package/dist-client/pages/data-set/data-item-list.d.ts +1 -0
- package/dist-client/pages/data-set/data-item-list.js +267 -0
- package/dist-client/pages/data-set/data-item-list.js.map +1 -0
- package/dist-client/pages/data-set/data-set-importer.d.ts +10 -0
- package/dist-client/pages/data-set/data-set-importer.js +103 -0
- package/dist-client/pages/data-set/data-set-importer.js.map +1 -0
- package/dist-client/pages/data-set/data-set-list-page.d.ts +71 -0
- package/dist-client/pages/data-set/data-set-list-page.js +759 -0
- package/dist-client/pages/data-set/data-set-list-page.js.map +1 -0
- package/dist-client/route.d.ts +1 -0
- package/dist-client/route.js +47 -0
- package/dist-client/route.js.map +1 -0
- package/dist-client/tsconfig.tsbuildinfo +1 -0
- package/dist-server/controllers/activity-template/activity-ooc.js +59 -0
- package/dist-server/controllers/activity-template/activity-ooc.js.map +1 -0
- package/dist-server/controllers/create-data-sample.js +38 -1
- package/dist-server/controllers/create-data-sample.js.map +1 -1
- package/dist-server/controllers/index.js +5 -0
- package/dist-server/controllers/index.js.map +1 -1
- package/dist-server/index.js +1 -2
- package/dist-server/index.js.map +1 -1
- package/dist-server/routes.js +2 -2
- package/dist-server/routes.js.map +1 -1
- package/dist-server/service/data-set/data-set-query.js +5 -4
- package/dist-server/service/data-set/data-set-query.js.map +1 -1
- package/dist-server/service/data-set/data-set.js +3 -0
- package/dist-server/service/data-set/data-set.js.map +1 -1
- package/dist-server/service/data-set-history/data-set-history-query.js +4 -3
- package/dist-server/service/data-set-history/data-set-history-query.js.map +1 -1
- package/dist-server/tsconfig.tsbuildinfo +1 -1
- package/package.json +15 -12
- package/server/controllers/activity-template/activity-ooc.ts +55 -0
- package/server/controllers/create-data-sample.ts +48 -3
- package/server/controllers/index.ts +9 -0
- package/server/index.ts +1 -2
- package/server/routes.ts +2 -4
- package/server/service/data-set/data-set-query.ts +5 -4
- package/server/service/data-set/data-set.ts +3 -0
- package/server/service/data-set-history/data-set-history-query.ts +4 -3
- package/server/tsconfig.json +10 -0
- package/things-factory.config.js +2 -2
- package/translations/en.json +1 -1
- package/translations/ko.json +1 -1
- package/translations/ms.json +1 -0
- package/translations/zh.json +1 -0
- package/client/pages/data-key-set/data-key-set-importer.js +0 -105
- package/client/pages/data-set/data-set-importer.js +0 -103
- package/dist-server/middlewares/index.js +0 -8
- package/dist-server/middlewares/index.js.map +0 -1
- package/dist-server/migrations/index.js +0 -12
- package/dist-server/migrations/index.js.map +0 -1
- package/server/middlewares/index.ts +0 -3
- package/server/migrations/index.ts +0 -9
- package/tsconfig.json +0 -9
- /package/assets/{data-report.jpg → images/data-report.jpg} +0 -0
- /package/assets/{data-samples.jpg → images/data-samples.jpg} +0 -0
- /package/assets/{diagram.jpg → images/dataset-diagram.jpg} +0 -0
- /package/assets/{glue-table-indices.png → images/glue-table-indices-for-dataset.png} +0 -0
- /package/client/{index.js → index.ts} +0 -0
@@ -4,9 +4,11 @@ import '../../components/data-entry-form.js'
|
|
4
4
|
|
5
5
|
import gql from 'graphql-tag'
|
6
6
|
import { css, html } from 'lit'
|
7
|
+
import { customElement, property, query, state } from 'lit/decorators.js'
|
8
|
+
|
7
9
|
import { connect } from 'pwa-helpers/connect-mixin'
|
8
10
|
|
9
|
-
import { getRenderer } from '@operato/data-grist'
|
11
|
+
import { ColumnConfig, DataGrist, FetchOption, SortersControl, getRenderer } from '@operato/data-grist'
|
10
12
|
import { OxDataUseCase } from '@operato/dataset'
|
11
13
|
import { client } from '@operato/graphql'
|
12
14
|
import { i18next, localize } from '@operato/i18n'
|
@@ -14,6 +16,7 @@ import { openPopup } from '@operato/layout'
|
|
14
16
|
import { navigate, PageView, store } from '@operato/shell'
|
15
17
|
import { CommonGristStyles, ScrollbarStyles } from '@operato/styles'
|
16
18
|
import { provider } from '@things-factory/board-ui'
|
19
|
+
import { OxPopup } from '@operato/popup'
|
17
20
|
|
18
21
|
const USECASE_OPTIONS = () => {
|
19
22
|
return ['', ...OxDataUseCase.getUseCaseNames()].map(name => {
|
@@ -63,6 +66,9 @@ const showEntryView = async (columns, data, column, record, rowIndex) => {
|
|
63
66
|
// navigate(`board-viewer/${entryView}?interactive=true&title=${title}`)
|
64
67
|
break
|
65
68
|
|
69
|
+
case 'custom-element':
|
70
|
+
break
|
71
|
+
|
66
72
|
case 'page':
|
67
73
|
navigate(entryView)
|
68
74
|
break
|
@@ -73,37 +79,42 @@ const showEntryView = async (columns, data, column, record, rowIndex) => {
|
|
73
79
|
}
|
74
80
|
}
|
75
81
|
|
82
|
+
@customElement('data-entry-list-page')
|
76
83
|
export class DataEntryListPage extends connect(store)(localize(i18next)(PageView)) {
|
77
|
-
static
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
mode: String
|
84
|
-
}
|
85
|
-
}
|
84
|
+
static styles = [
|
85
|
+
ScrollbarStyles,
|
86
|
+
CommonGristStyles,
|
87
|
+
css`
|
88
|
+
:host {
|
89
|
+
display: flex;
|
86
90
|
|
87
|
-
|
88
|
-
return [
|
89
|
-
ScrollbarStyles,
|
90
|
-
CommonGristStyles,
|
91
|
-
css`
|
92
|
-
:host {
|
93
|
-
display: flex;
|
91
|
+
width: 100%;
|
94
92
|
|
95
|
-
|
93
|
+
--grid-record-emphasized-background-color: red;
|
94
|
+
--grid-record-emphasized-color: yellow;
|
95
|
+
}
|
96
|
+
`
|
97
|
+
]
|
96
98
|
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
]
|
102
|
-
}
|
99
|
+
@state() gristConfig: any
|
100
|
+
|
101
|
+
@query('ox-grist') private grist!: DataGrist
|
102
|
+
@query('#sorter-control') private sortersControl!: OxPopup
|
103
103
|
|
104
104
|
get context() {
|
105
105
|
return {
|
106
|
-
|
106
|
+
search: {
|
107
|
+
handler: (search: string) => {
|
108
|
+
this.grist.searchText = search
|
109
|
+
},
|
110
|
+
placeholder: i18next.t('title.data-entry list'),
|
111
|
+
value: this.grist.searchText
|
112
|
+
},
|
113
|
+
filter: {
|
114
|
+
handler: () => {
|
115
|
+
this.grist.toggleHeadroom()
|
116
|
+
}
|
117
|
+
},
|
107
118
|
help: 'dataset/data-entry-list'
|
108
119
|
}
|
109
120
|
}
|
@@ -115,13 +126,12 @@ export class DataEntryListPage extends connect(store)(localize(i18next)(PageView
|
|
115
126
|
<ox-grist
|
116
127
|
.mode=${mode}
|
117
128
|
.config=${this.gristConfig}
|
118
|
-
.filters=${this.filters}
|
119
|
-
.orders=${this.orders}
|
120
129
|
.fetchHandler=${this.fetchHandler.bind(this)}
|
130
|
+
?url-params-sensitive=${this.active}
|
121
131
|
>
|
122
132
|
<div slot="headroom">
|
123
133
|
<div id="filters">
|
124
|
-
<ox-filters-form autofocus></ox-filters-form>
|
134
|
+
<ox-filters-form autofocus without-search></ox-filters-form>
|
125
135
|
</div>
|
126
136
|
|
127
137
|
<div id="sorters">
|
@@ -129,7 +139,7 @@ export class DataEntryListPage extends connect(store)(localize(i18next)(PageView
|
|
129
139
|
<mwc-icon
|
130
140
|
@click=${e => {
|
131
141
|
const target = e.currentTarget
|
132
|
-
this.
|
142
|
+
this.sortersControl.open({
|
133
143
|
right: 0,
|
134
144
|
top: target.offsetTop + target.offsetHeight
|
135
145
|
})
|
@@ -145,10 +155,6 @@ export class DataEntryListPage extends connect(store)(localize(i18next)(PageView
|
|
145
155
|
`
|
146
156
|
}
|
147
157
|
|
148
|
-
get grist() {
|
149
|
-
return this.renderRoot.querySelector('ox-grist')
|
150
|
-
}
|
151
|
-
|
152
158
|
async pageInitialized(lifecycle) {
|
153
159
|
this.gristConfig = {
|
154
160
|
list: {
|
@@ -233,8 +239,7 @@ export class DataEntryListPage extends connect(store)(localize(i18next)(PageView
|
|
233
239
|
record: {
|
234
240
|
editable: false
|
235
241
|
},
|
236
|
-
width: 80
|
237
|
-
label: true
|
242
|
+
width: 80
|
238
243
|
},
|
239
244
|
{
|
240
245
|
type: 'resource-object',
|
@@ -316,7 +321,7 @@ export class DataEntryListPage extends connect(store)(localize(i18next)(PageView
|
|
316
321
|
}
|
317
322
|
}
|
318
323
|
|
319
|
-
async fetchHandler({ page, limit, sortings = [], filters = [] }) {
|
324
|
+
async fetchHandler({ page, limit, sortings = [], filters = [] }: FetchOption) {
|
320
325
|
const response = await client.query({
|
321
326
|
query: gql`
|
322
327
|
query ($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) {
|
@@ -385,5 +390,3 @@ export class DataEntryListPage extends connect(store)(localize(i18next)(PageView
|
|
385
390
|
}
|
386
391
|
}
|
387
392
|
}
|
388
|
-
|
389
|
-
window.customElements.define('data-entry-list-page', DataEntryListPage)
|
@@ -1,51 +1,45 @@
|
|
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 { getEditor, getRenderer, ColumnConfig, DataGrist, FetchOption, SortersControl } from '@operato/data-grist'
|
7
9
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
10
|
+
@customElement('data-key-item-list')
|
11
|
+
export class DataKeyItemList extends localize(i18next)(LitElement) {
|
12
|
+
static styles = [
|
13
|
+
css`
|
14
|
+
:host {
|
15
|
+
display: flex;
|
16
|
+
flex-direction: column;
|
15
17
|
|
16
|
-
|
17
|
-
|
18
|
-
css`
|
19
|
-
:host {
|
20
|
-
display: flex;
|
21
|
-
flex-direction: column;
|
22
|
-
|
23
|
-
background-color: #fff;
|
24
|
-
}
|
18
|
+
background-color: #fff;
|
19
|
+
}
|
25
20
|
|
26
|
-
|
27
|
-
|
28
|
-
|
21
|
+
ox-grist {
|
22
|
+
flex: 1;
|
23
|
+
}
|
29
24
|
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
25
|
+
.button-container {
|
26
|
+
display: flex;
|
27
|
+
margin-left: auto;
|
28
|
+
padding: var(--padding-default);
|
29
|
+
}
|
35
30
|
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
}
|
31
|
+
[danger] {
|
32
|
+
--mdc-theme-primary: var(--mdc-danger-button-primary-color);
|
33
|
+
}
|
34
|
+
mwc-button {
|
35
|
+
margin-left: var(--margin-default);
|
36
|
+
}
|
37
|
+
`
|
38
|
+
]
|
45
39
|
|
46
|
-
|
47
|
-
|
48
|
-
|
40
|
+
@property({ type: Object }) dataKeySet: any
|
41
|
+
@state() gristConfig: any
|
42
|
+
@query('ox-grist') private grist!: DataGrist
|
49
43
|
|
50
44
|
render() {
|
51
45
|
return html`
|
@@ -142,7 +136,7 @@ class DataKeyItemList extends localize(i18next)(LitElement) {
|
|
142
136
|
}
|
143
137
|
}
|
144
138
|
|
145
|
-
async fetchHandler({ filters, page, limit, sortings = [] }) {
|
139
|
+
async fetchHandler({ filters, page, limit, sortings = [] }: FetchOption) {
|
146
140
|
const dataKeyItems = this.dataKeySet.dataKeyItems || []
|
147
141
|
|
148
142
|
return {
|
@@ -192,5 +186,3 @@ class DataKeyItemList extends localize(i18next)(LitElement) {
|
|
192
186
|
this.grist.deleteSelectedRecords(false)
|
193
187
|
}
|
194
188
|
}
|
195
|
-
|
196
|
-
window.customElements.define('data-key-item-list', DataKeyItemList)
|
@@ -0,0 +1,95 @@
|
|
1
|
+
import '@operato/data-grist'
|
2
|
+
|
3
|
+
import gql from 'graphql-tag'
|
4
|
+
import { css, html, LitElement } from 'lit'
|
5
|
+
import { customElement, property, query, 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
|
+
|
11
|
+
@customElement('data-key-set-importer')
|
12
|
+
export class DataKeySetImporter extends LitElement {
|
13
|
+
static styles = [
|
14
|
+
css`
|
15
|
+
:host {
|
16
|
+
display: flex;
|
17
|
+
flex-direction: column;
|
18
|
+
|
19
|
+
background-color: #fff;
|
20
|
+
}
|
21
|
+
|
22
|
+
ox-grist {
|
23
|
+
flex: 1;
|
24
|
+
}
|
25
|
+
|
26
|
+
.button-container {
|
27
|
+
display: flex;
|
28
|
+
margin-left: auto;
|
29
|
+
padding: var(--padding-default);
|
30
|
+
}
|
31
|
+
|
32
|
+
mwc-button {
|
33
|
+
margin-left: var(--margin-default);
|
34
|
+
}
|
35
|
+
`
|
36
|
+
]
|
37
|
+
|
38
|
+
@property({ type: Array }) dataKeySets: any[] = []
|
39
|
+
|
40
|
+
private columns = {
|
41
|
+
list: { fields: ['name', 'description'] },
|
42
|
+
pagination: { infinite: true },
|
43
|
+
columns: [
|
44
|
+
{
|
45
|
+
type: 'string',
|
46
|
+
name: 'name',
|
47
|
+
header: i18next.t('field.name'),
|
48
|
+
width: 150
|
49
|
+
},
|
50
|
+
{
|
51
|
+
type: 'string',
|
52
|
+
name: 'description',
|
53
|
+
header: i18next.t('field.description'),
|
54
|
+
width: 200
|
55
|
+
},
|
56
|
+
{
|
57
|
+
type: 'checkbox',
|
58
|
+
name: 'active',
|
59
|
+
header: i18next.t('field.active'),
|
60
|
+
width: 60
|
61
|
+
}
|
62
|
+
]
|
63
|
+
}
|
64
|
+
|
65
|
+
render() {
|
66
|
+
return html`
|
67
|
+
<ox-grist
|
68
|
+
.mode=${isMobileDevice() ? 'LIST' : 'GRID'}
|
69
|
+
.config=${this.columns}
|
70
|
+
.data=${{
|
71
|
+
records: this.dataKeySets
|
72
|
+
}}
|
73
|
+
></ox-grist>
|
74
|
+
|
75
|
+
<div class="button-container">
|
76
|
+
<mwc-button raised @click="${this.save.bind(this)}">${i18next.t('button.save')}</mwc-button>
|
77
|
+
</div>
|
78
|
+
`
|
79
|
+
}
|
80
|
+
|
81
|
+
async save() {
|
82
|
+
const response = await client.mutate({
|
83
|
+
mutation: gql`
|
84
|
+
mutation importDataKeySets($dataKeySets: [DataKeySetPatch!]!) {
|
85
|
+
importDataKeySets(dataKeySets: $dataKeySets)
|
86
|
+
}
|
87
|
+
`,
|
88
|
+
variables: { dataKeySets: this.dataKeySets }
|
89
|
+
})
|
90
|
+
|
91
|
+
if (response.errors?.length) return
|
92
|
+
|
93
|
+
this.dispatchEvent(new CustomEvent('imported'))
|
94
|
+
}
|
95
|
+
}
|
@@ -4,17 +4,26 @@ import './data-key-item-list'
|
|
4
4
|
|
5
5
|
import gql from 'graphql-tag'
|
6
6
|
import { css, html } from 'lit'
|
7
|
+
import { customElement, property, query, state } from 'lit/decorators.js'
|
7
8
|
import { connect } from 'pwa-helpers/connect-mixin'
|
8
9
|
|
10
|
+
import {
|
11
|
+
getEditor,
|
12
|
+
getRenderer,
|
13
|
+
ColumnConfig,
|
14
|
+
DataGrist,
|
15
|
+
FetchOption,
|
16
|
+
SortersControl,
|
17
|
+
GristData,
|
18
|
+
GristRecord
|
19
|
+
} from '@operato/data-grist'
|
9
20
|
import { client } from '@operato/graphql'
|
10
21
|
import { i18next, localize } from '@operato/i18n'
|
11
22
|
import { notify, openPopup } from '@operato/layout'
|
12
23
|
import { navigate, PageView, store } from '@operato/shell'
|
13
24
|
import { CommonButtonStyles, CommonGristStyles, ScrollbarStyles } from '@operato/styles'
|
14
|
-
import { isMobileDevice } from '@operato/utils'
|
15
|
-
import {
|
16
|
-
|
17
|
-
import { getEditor, getRenderer } from '@operato/data-grist'
|
25
|
+
import { isMobileDevice, encodeUrlParams } from '@operato/utils'
|
26
|
+
import { OxPopup } from '@operato/popup'
|
18
27
|
|
19
28
|
const REPORT_TYPES = [
|
20
29
|
{
|
@@ -29,6 +38,10 @@ const REPORT_TYPES = [
|
|
29
38
|
display: 'Embed',
|
30
39
|
value: 'embed'
|
31
40
|
},
|
41
|
+
{
|
42
|
+
display: 'CustomElement',
|
43
|
+
value: 'custom-element'
|
44
|
+
},
|
32
45
|
{
|
33
46
|
display: 'Page',
|
34
47
|
value: 'page'
|
@@ -46,34 +59,44 @@ const REPORT_TYPES = [
|
|
46
59
|
value: 'shiny'
|
47
60
|
}
|
48
61
|
]
|
62
|
+
|
63
|
+
@customElement('data-key-set-list-page')
|
49
64
|
export class DataKeySetListPage extends connect(store)(localize(i18next)(PageView)) {
|
50
|
-
static
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
65
|
+
static styles = [
|
66
|
+
ScrollbarStyles,
|
67
|
+
CommonGristStyles,
|
68
|
+
css`
|
69
|
+
:host {
|
70
|
+
display: flex;
|
56
71
|
|
57
|
-
|
58
|
-
return [
|
59
|
-
ScrollbarStyles,
|
60
|
-
CommonGristStyles,
|
61
|
-
css`
|
62
|
-
:host {
|
63
|
-
display: flex;
|
72
|
+
width: 100%;
|
64
73
|
|
65
|
-
|
74
|
+
--grid-record-emphasized-background-color: red;
|
75
|
+
--grid-record-emphasized-color: yellow;
|
76
|
+
}
|
77
|
+
`
|
78
|
+
]
|
66
79
|
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
}
|
80
|
+
@state() gristConfig: any
|
81
|
+
@state() mode: 'CARD' | 'GRID' | 'LIST' = isMobileDevice() ? 'CARD' : 'GRID'
|
82
|
+
|
83
|
+
@query('ox-grist') private grist!: DataGrist
|
84
|
+
@query('#sorter-control') private sortersControl!: OxPopup
|
73
85
|
|
74
86
|
get context() {
|
75
87
|
return {
|
76
|
-
|
88
|
+
search: {
|
89
|
+
handler: (search: string) => {
|
90
|
+
this.grist.searchText = search
|
91
|
+
},
|
92
|
+
placeholder: i18next.t('title.data-key-set list'),
|
93
|
+
value: this.grist.searchText
|
94
|
+
},
|
95
|
+
filter: {
|
96
|
+
handler: () => {
|
97
|
+
this.grist.toggleHeadroom()
|
98
|
+
}
|
99
|
+
},
|
77
100
|
help: 'dataset/data-key-set',
|
78
101
|
actions: [
|
79
102
|
{
|
@@ -104,7 +127,7 @@ export class DataKeySetListPage extends connect(store)(localize(i18next)(PageVie
|
|
104
127
|
<ox-grist .mode=${mode} .config=${this.gristConfig} .fetchHandler=${this.fetchHandler.bind(this)}>
|
105
128
|
<div slot="headroom">
|
106
129
|
<div id="filters">
|
107
|
-
<ox-filters-form autofocus></ox-filters-form>
|
130
|
+
<ox-filters-form autofocus without-search></ox-filters-form>
|
108
131
|
</div>
|
109
132
|
|
110
133
|
<div id="sorters">
|
@@ -112,7 +135,7 @@ export class DataKeySetListPage extends connect(store)(localize(i18next)(PageVie
|
|
112
135
|
<mwc-icon
|
113
136
|
@click=${e => {
|
114
137
|
const target = e.currentTarget
|
115
|
-
this.
|
138
|
+
this.sortersControl.open({
|
116
139
|
right: 0,
|
117
140
|
top: target.offsetTop + target.offsetHeight
|
118
141
|
})
|
@@ -134,10 +157,6 @@ export class DataKeySetListPage extends connect(store)(localize(i18next)(PageVie
|
|
134
157
|
`
|
135
158
|
}
|
136
159
|
|
137
|
-
get grist() {
|
138
|
-
return this.renderRoot.querySelector('ox-grist')
|
139
|
-
}
|
140
|
-
|
141
160
|
async pageInitialized(lifecycle) {
|
142
161
|
this.gristConfig = {
|
143
162
|
list: {
|
@@ -190,6 +209,8 @@ export class DataKeySetListPage extends connect(store)(localize(i18next)(PageVie
|
|
190
209
|
switch (reportType) {
|
191
210
|
case 'generated':
|
192
211
|
break
|
212
|
+
case 'custom-element':
|
213
|
+
break
|
193
214
|
case 'page':
|
194
215
|
break
|
195
216
|
case 'embed':
|
@@ -312,7 +333,7 @@ export class DataKeySetListPage extends connect(store)(localize(i18next)(PageVie
|
|
312
333
|
}
|
313
334
|
}
|
314
335
|
|
315
|
-
async fetchHandler({ page, limit, sortings = [], filters = [] }) {
|
336
|
+
async fetchHandler({ page, limit, sortings = [], filters = [] }: FetchOption) {
|
316
337
|
const response = await client.query({
|
317
338
|
query: gql`
|
318
339
|
query ($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) {
|
@@ -382,7 +403,7 @@ export class DataKeySetListPage extends connect(store)(localize(i18next)(PageVie
|
|
382
403
|
let patches = this.grist.dirtyRecords
|
383
404
|
if (patches && patches.length) {
|
384
405
|
patches = patches.map(patch => {
|
385
|
-
let patchField = patch.id ? { id: patch.id } : {}
|
406
|
+
let patchField: any = patch.id ? { id: patch.id } : {}
|
386
407
|
const dirtyFields = patch.__dirtyfields__
|
387
408
|
for (let key in dirtyFields) {
|
388
409
|
patchField[key] = dirtyFields[key].after
|
@@ -448,5 +469,3 @@ export class DataKeySetListPage extends connect(store)(localize(i18next)(PageVie
|
|
448
469
|
}
|
449
470
|
}
|
450
471
|
}
|
451
|
-
|
452
|
-
window.customElements.define('data-key-set-list-page', DataKeySetListPage)
|
@@ -3,47 +3,67 @@ import './data-ooc-view.js'
|
|
3
3
|
|
4
4
|
import gql from 'graphql-tag'
|
5
5
|
import { css, html } from 'lit'
|
6
|
+
import { customElement, property, query, state } from 'lit/decorators.js'
|
6
7
|
import { connect } from 'pwa-helpers/connect-mixin'
|
7
8
|
|
9
|
+
import {
|
10
|
+
getEditor,
|
11
|
+
getRenderer,
|
12
|
+
ColumnConfig,
|
13
|
+
DataGrist,
|
14
|
+
FetchOption,
|
15
|
+
SortersControl,
|
16
|
+
GristData,
|
17
|
+
GristRecord
|
18
|
+
} from '@operato/data-grist'
|
8
19
|
import { client } from '@operato/graphql'
|
9
20
|
import { i18next, localize } from '@operato/i18n'
|
10
21
|
import { openPopup } from '@operato/layout'
|
11
22
|
import { PageView, store } from '@operato/shell'
|
12
23
|
import { CommonGristStyles, ScrollbarStyles } from '@operato/styles'
|
13
24
|
import { isMobileDevice } from '@operato/utils'
|
25
|
+
import { OxPopup } from '@operato/popup'
|
14
26
|
|
27
|
+
@customElement('data-ooc-list-page')
|
15
28
|
export class DataOocListPage extends connect(store)(localize(i18next)(PageView)) {
|
16
|
-
static
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
29
|
+
static styles = [
|
30
|
+
ScrollbarStyles,
|
31
|
+
CommonGristStyles,
|
32
|
+
css`
|
33
|
+
:host {
|
34
|
+
display: flex;
|
35
|
+
flex-direction: column;
|
23
36
|
|
24
|
-
|
25
|
-
|
26
|
-
ScrollbarStyles,
|
27
|
-
CommonGristStyles,
|
28
|
-
css`
|
29
|
-
:host {
|
30
|
-
display: flex;
|
31
|
-
flex-direction: column;
|
37
|
+
overflow: hidden;
|
38
|
+
}
|
32
39
|
|
33
|
-
|
34
|
-
|
40
|
+
ox-grist {
|
41
|
+
overflow-y: auto;
|
42
|
+
flex: 1;
|
43
|
+
}
|
44
|
+
`
|
45
|
+
]
|
35
46
|
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
]
|
42
|
-
}
|
47
|
+
@state() gristConfig: any
|
48
|
+
@state() mode: 'CARD' | 'GRID' | 'LIST' = isMobileDevice() ? 'CARD' : 'GRID'
|
49
|
+
|
50
|
+
@query('ox-grist') private grist!: DataGrist
|
51
|
+
@query('#sorter-control') private sortersControl!: OxPopup
|
43
52
|
|
44
53
|
get context() {
|
45
54
|
return {
|
46
|
-
|
55
|
+
search: {
|
56
|
+
handler: (search: string) => {
|
57
|
+
this.grist.searchText = search
|
58
|
+
},
|
59
|
+
placeholder: i18next.t('title.data-ooc list'),
|
60
|
+
value: this.grist.searchText
|
61
|
+
},
|
62
|
+
filter: {
|
63
|
+
handler: () => {
|
64
|
+
this.grist.toggleHeadroom()
|
65
|
+
}
|
66
|
+
},
|
47
67
|
help: 'dataset/data-ooc',
|
48
68
|
actions: [
|
49
69
|
// {
|
@@ -71,7 +91,7 @@ export class DataOocListPage extends connect(store)(localize(i18next)(PageView))
|
|
71
91
|
>
|
72
92
|
<div slot="headroom">
|
73
93
|
<div id="filters">
|
74
|
-
<ox-filters-form autofocus></ox-filters-form>
|
94
|
+
<ox-filters-form autofocus without-search></ox-filters-form>
|
75
95
|
</div>
|
76
96
|
|
77
97
|
<div id="sorters">
|
@@ -79,7 +99,7 @@ export class DataOocListPage extends connect(store)(localize(i18next)(PageView))
|
|
79
99
|
<mwc-icon
|
80
100
|
@click=${e => {
|
81
101
|
const target = e.currentTarget
|
82
|
-
this.
|
102
|
+
this.sortersControl.open({
|
83
103
|
right: 0,
|
84
104
|
top: target.offsetTop + target.offsetHeight
|
85
105
|
})
|
@@ -101,10 +121,6 @@ export class DataOocListPage extends connect(store)(localize(i18next)(PageView))
|
|
101
121
|
`
|
102
122
|
}
|
103
123
|
|
104
|
-
get grist() {
|
105
|
-
return this.renderRoot.querySelector('ox-grist')
|
106
|
-
}
|
107
|
-
|
108
124
|
async pageInitialized(lifecycle) {
|
109
125
|
this.gristConfig = {
|
110
126
|
list: {
|
@@ -360,7 +376,7 @@ export class DataOocListPage extends connect(store)(localize(i18next)(PageView))
|
|
360
376
|
this.grist.fetch()
|
361
377
|
}
|
362
378
|
|
363
|
-
async fetchHandler({ page, limit, sortings = [], filters = [] }) {
|
379
|
+
async fetchHandler({ page, limit, sortings = [], filters = [] }: FetchOption) {
|
364
380
|
const response = await client.query({
|
365
381
|
query: gql`
|
366
382
|
query ($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) {
|
@@ -427,7 +443,7 @@ export class DataOocListPage extends connect(store)(localize(i18next)(PageView))
|
|
427
443
|
}
|
428
444
|
|
429
445
|
_exportableData() {
|
430
|
-
let records = []
|
446
|
+
let records = [] as GristRecord
|
431
447
|
if (this.grist.selected && this.grist.selected.length > 0) {
|
432
448
|
records = this.grist.selected
|
433
449
|
} else {
|
@@ -439,7 +455,7 @@ export class DataOocListPage extends connect(store)(localize(i18next)(PageView))
|
|
439
455
|
.map(column => {
|
440
456
|
return column.imex === true
|
441
457
|
? {
|
442
|
-
header: column.header.renderer(),
|
458
|
+
header: column.header.renderer(column),
|
443
459
|
key: column.name,
|
444
460
|
width: column.width,
|
445
461
|
type: column.type
|
@@ -465,5 +481,3 @@ export class DataOocListPage extends connect(store)(localize(i18next)(PageView))
|
|
465
481
|
return { header: headerSetting, data: data }
|
466
482
|
}
|
467
483
|
}
|
468
|
-
|
469
|
-
window.customElements.define('data-ooc-list-page', DataOocListPage)
|