@operato/dataset 1.0.0-alpha.9 → 1.0.0-beta.10
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 +735 -0
- package/demo/index.html +8 -90
- package/demo/ox-data-entry-form.html +118 -0
- package/demo/ox-data-item-spec.html +152 -0
- package/demo/ox-data-ooc-view.html +185 -0
- package/demo/ox-data-sample-view.html +150 -0
- package/demo/ox-grist-editor-data-item-spec.html +476 -0
- package/dist/src/grist-editor/index.d.ts +1 -0
- package/dist/src/grist-editor/index.js +7 -0
- package/dist/src/grist-editor/index.js.map +1 -0
- package/dist/src/grist-editor/ox-grist-editor-data-item-spec.d.ts +11 -0
- package/dist/src/grist-editor/ox-grist-editor-data-item-spec.js +77 -0
- package/dist/src/grist-editor/ox-grist-editor-data-item-spec.js.map +1 -0
- package/dist/src/grist-editor/ox-popup-data-item-spec.d.ts +13 -0
- package/dist/src/grist-editor/ox-popup-data-item-spec.js +91 -0
- package/dist/src/grist-editor/ox-popup-data-item-spec.js.map +1 -0
- package/dist/src/index.d.ts +6 -1
- package/dist/src/index.js +6 -1
- package/dist/src/index.js.map +1 -1
- package/dist/src/ox-data-entry-form.d.ts +1 -24
- package/dist/src/ox-data-entry-form.js +52 -26
- package/dist/src/ox-data-entry-form.js.map +1 -1
- package/dist/src/ox-data-item-spec.d.ts +18 -0
- package/dist/src/ox-data-item-spec.js +77 -0
- package/dist/src/ox-data-item-spec.js.map +1 -0
- package/dist/src/ox-data-ooc-view.d.ts +11 -0
- package/dist/src/ox-data-ooc-view.js +75 -0
- package/dist/src/ox-data-ooc-view.js.map +1 -0
- package/dist/src/ox-data-sample-view copy.d.ts +13 -0
- package/dist/src/ox-data-sample-view copy.js +214 -0
- package/dist/src/ox-data-sample-view copy.js.map +1 -0
- package/dist/src/ox-data-sample-view.d.ts +13 -0
- package/dist/src/ox-data-sample-view.js +169 -0
- package/dist/src/ox-data-sample-view.js.map +1 -0
- package/dist/src/ox-data-use-case.d.ts +16 -0
- package/dist/src/ox-data-use-case.js +111 -0
- package/dist/src/ox-data-use-case.js.map +1 -0
- package/dist/src/types.d.ts +78 -0
- package/dist/src/types.js +2 -0
- package/dist/src/types.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +20 -12
- package/src/grist-editor/index.ts +10 -0
- package/src/grist-editor/ox-grist-editor-data-item-spec.ts +92 -0
- package/src/grist-editor/ox-popup-data-item-spec.ts +92 -0
- package/src/index.ts +6 -1
- package/src/ox-data-entry-form.ts +52 -47
- package/src/ox-data-item-spec.ts +74 -0
- package/src/ox-data-ooc-view.ts +75 -0
- package/src/ox-data-sample-view.ts +177 -0
- package/src/ox-data-use-case.ts +147 -0
- package/src/types.ts +72 -0
- package/themes/grist-theme.css +194 -0
- package/themes/oops-theme.css +26 -0
- package/themes/report-theme.css +47 -0
- package/translations/en.json +57 -0
- package/translations/ko.json +56 -0
- package/translations/ms.json +56 -0
- package/translations/zh.json +56 -0
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en-GB">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8" />
|
|
5
|
+
<meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1" />
|
|
6
|
+
<style>
|
|
7
|
+
body {
|
|
8
|
+
--ox-checkbox-size: 12px;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
#demo {
|
|
12
|
+
}
|
|
13
|
+
</style>
|
|
14
|
+
<link href="https://fonts.googleapis.com/css?family=Roboto:300,400,500" rel="stylesheet" />
|
|
15
|
+
<link href="https://fonts.googleapis.com/css?family=Material+Icons&display=block" rel="stylesheet" />
|
|
16
|
+
<link href="/themes/app-theme.css" rel="stylesheet" />
|
|
17
|
+
<link href="/themes/form-theme.css" rel="stylesheet" />
|
|
18
|
+
</head>
|
|
19
|
+
<body>
|
|
20
|
+
<div id="demo"></div>
|
|
21
|
+
|
|
22
|
+
<script type="module">
|
|
23
|
+
import { html, render } from 'lit'
|
|
24
|
+
import '@operato/ccp'
|
|
25
|
+
import '@operato/qc'
|
|
26
|
+
|
|
27
|
+
const parent = document.querySelector('#demo')
|
|
28
|
+
const dataSet = {
|
|
29
|
+
name: 'sample',
|
|
30
|
+
description: 'sample description',
|
|
31
|
+
useCase: 'CCP',
|
|
32
|
+
dataItems: [
|
|
33
|
+
{
|
|
34
|
+
name: '창고 온도',
|
|
35
|
+
description: '창고 온도는 섭씨 0도 이하로 유지되어야 합니다.',
|
|
36
|
+
sequence: 1,
|
|
37
|
+
tag: 'temp',
|
|
38
|
+
type: 'number',
|
|
39
|
+
quota: 1,
|
|
40
|
+
active: true,
|
|
41
|
+
unit: '℃',
|
|
42
|
+
spec: {
|
|
43
|
+
CCP: {
|
|
44
|
+
criticalLimits: {
|
|
45
|
+
minimum: 100,
|
|
46
|
+
maximum: 200
|
|
47
|
+
},
|
|
48
|
+
targetLimits: {
|
|
49
|
+
minimum: 120,
|
|
50
|
+
maximum: 180
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
name: '창고 습도',
|
|
57
|
+
description: '창고 습도는 30% 이하로 유지되어야 합니다.',
|
|
58
|
+
sequence: 2,
|
|
59
|
+
tag: 'humid',
|
|
60
|
+
type: 'number',
|
|
61
|
+
quota: 5,
|
|
62
|
+
active: true,
|
|
63
|
+
unit: '%',
|
|
64
|
+
spec: {
|
|
65
|
+
CCP: {
|
|
66
|
+
criticalLimits: {
|
|
67
|
+
minimum: 10,
|
|
68
|
+
maximum: 50
|
|
69
|
+
},
|
|
70
|
+
targetLimits: {
|
|
71
|
+
minimum: 20,
|
|
72
|
+
maximum: 40
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
name: '육안 검사',
|
|
79
|
+
description: '육안 검사는 포장전 30분 내로 실행되어야 합니다.',
|
|
80
|
+
sequence: 3,
|
|
81
|
+
tag: 'inspection',
|
|
82
|
+
type: 'boolean',
|
|
83
|
+
quota: 3,
|
|
84
|
+
active: true
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
name: '품평',
|
|
88
|
+
description: '품평은 최우수/우수/보통/미달을 포함하여 간단히 평가.',
|
|
89
|
+
sequence: 4,
|
|
90
|
+
tag: 'evaluation',
|
|
91
|
+
type: 'select',
|
|
92
|
+
options: {
|
|
93
|
+
options: [
|
|
94
|
+
{ text: '최우수', value: '최우수' },
|
|
95
|
+
{ text: '우수', value: '우수' },
|
|
96
|
+
{ text: '보통', value: '보통' },
|
|
97
|
+
{ text: '미달', value: '미달' }
|
|
98
|
+
]
|
|
99
|
+
},
|
|
100
|
+
quota: 3,
|
|
101
|
+
active: true,
|
|
102
|
+
spec: {
|
|
103
|
+
CCP: {
|
|
104
|
+
criticalLimits: {
|
|
105
|
+
acceptables: ['최우수', '우수', '보통']
|
|
106
|
+
},
|
|
107
|
+
targetLimits: {
|
|
108
|
+
acceptables: ['최우수', '우수']
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
name: '코멘트',
|
|
115
|
+
description: '특이사항을 기록함.',
|
|
116
|
+
sequence: 4,
|
|
117
|
+
tag: 'comment',
|
|
118
|
+
type: 'string',
|
|
119
|
+
quota: 1,
|
|
120
|
+
active: true
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
name: '첨부파일',
|
|
124
|
+
description: '참조 첨부 파일.',
|
|
125
|
+
sequence: 4,
|
|
126
|
+
tag: 'attachment',
|
|
127
|
+
type: 'file',
|
|
128
|
+
quota: 1,
|
|
129
|
+
active: true
|
|
130
|
+
}
|
|
131
|
+
]
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
var dataSample = {
|
|
135
|
+
name: 'Data Sample Name',
|
|
136
|
+
description: 'Data Sample이 어쩌구 저쩌구 그래서 중요합니다. 당연히 그래야죠.',
|
|
137
|
+
useCase: 'CCP',
|
|
138
|
+
data: {
|
|
139
|
+
temp: [1000],
|
|
140
|
+
humid: [20, 23, 21, 26, 27],
|
|
141
|
+
inspection: [true, false, true],
|
|
142
|
+
evaluation: ['최우수', '보통', '우수']
|
|
143
|
+
},
|
|
144
|
+
collectedAt: Date.now()
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
render(html`<ox-data-sample-view .dataSet=${dataSet} .dataSample=${dataSample}></ox-data-sample-view>`, parent)
|
|
148
|
+
</script>
|
|
149
|
+
</body>
|
|
150
|
+
</html>
|
|
@@ -0,0 +1,476 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en-GB">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8" />
|
|
5
|
+
<meta name="viewport" />
|
|
6
|
+
<style>
|
|
7
|
+
body {
|
|
8
|
+
/* box-sizing: border-box; */
|
|
9
|
+
margin: 0;
|
|
10
|
+
padding: 0;
|
|
11
|
+
overflow: hidden;
|
|
12
|
+
|
|
13
|
+
/* This is a font-stack that tries to use the system-default sans-serifs first */
|
|
14
|
+
font-family: Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol';
|
|
15
|
+
line-height: 1.5;
|
|
16
|
+
-webkit-font-smoothing: antialiased;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
#app {
|
|
20
|
+
width: 100vw;
|
|
21
|
+
height: 100vh;
|
|
22
|
+
|
|
23
|
+
display: flex;
|
|
24
|
+
flex-direction: column;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
#demo {
|
|
28
|
+
flex: 1;
|
|
29
|
+
|
|
30
|
+
display: flex;
|
|
31
|
+
flex-direction: column;
|
|
32
|
+
overflow: hidden;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
grist-demo {
|
|
36
|
+
flex: 1;
|
|
37
|
+
overflow: auto;
|
|
38
|
+
}
|
|
39
|
+
</style>
|
|
40
|
+
<link href="https://fonts.googleapis.com/css?family=Roboto:300,400,500" rel="stylesheet" />
|
|
41
|
+
<link href="https://fonts.googleapis.com/css?family=Material+Icons&display=block" rel="stylesheet" />
|
|
42
|
+
|
|
43
|
+
<link href="/themes/app-theme.css" rel="stylesheet" />
|
|
44
|
+
<link href="/themes/oops-theme.css" rel="stylesheet" />
|
|
45
|
+
<link href="/themes/grist-theme.css" rel="stylesheet" />
|
|
46
|
+
|
|
47
|
+
<script>
|
|
48
|
+
// HACK(keanulee): The Redux package assumes `process` exists - mock it here before
|
|
49
|
+
// the module is loaded.
|
|
50
|
+
window.process = {
|
|
51
|
+
env: {
|
|
52
|
+
NODE_ENV: 'production'
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
window.operato = 1 /* to debug popuped grist-editors */
|
|
57
|
+
</script>
|
|
58
|
+
</head>
|
|
59
|
+
|
|
60
|
+
<body>
|
|
61
|
+
<script type="module">
|
|
62
|
+
import { LitElement, html, css, render } from 'lit'
|
|
63
|
+
|
|
64
|
+
import '@operato/property-editor/ox-property-editor-checkbox.js'
|
|
65
|
+
import '@operato/property-editor/ox-property-editor-number.js'
|
|
66
|
+
import '@operato/property-editor/ox-property-editor-string.js'
|
|
67
|
+
import '@operato/property-editor/ox-property-editor-options.js'
|
|
68
|
+
|
|
69
|
+
import '@operato/property-editor/ox-properties-dynamic-view.js'
|
|
70
|
+
|
|
71
|
+
import { OxPropertyEditor } from '@operato/property-editor'
|
|
72
|
+
|
|
73
|
+
OxPropertyEditor.register({
|
|
74
|
+
number: 'ox-property-editor-number',
|
|
75
|
+
string: 'ox-property-editor-string',
|
|
76
|
+
boolean: 'ox-property-editor-checkbox',
|
|
77
|
+
options: 'ox-property-editor-options'
|
|
78
|
+
})
|
|
79
|
+
|
|
80
|
+
import '@operato/data-grist'
|
|
81
|
+
import '@operato/data-grist/ox-filters-form.js'
|
|
82
|
+
import '@operato/data-grist/ox-sorters-control.js'
|
|
83
|
+
import '@material/mwc-icon'
|
|
84
|
+
import { CommonGristStyles } from '@operato/styles'
|
|
85
|
+
import { i18next } from '@operato/i18n'
|
|
86
|
+
import { OxGristEditorParameters } from '@operato/app/grist-editor/ox-grist-editor-parameters.js'
|
|
87
|
+
import { OxGristEditorCrontab } from '@operato/app/grist-editor/ox-grist-editor-crontab.js'
|
|
88
|
+
// import { OxGristRendererCrontab } from '@operato/app/grist-editor/ox-grist-renderer-crontab.js'
|
|
89
|
+
import { OxGristEditorValueMap } from '@operato/app/grist-editor/ox-grist-editor-value-map.js'
|
|
90
|
+
import { OxGristEditorPartitionKeys } from '@operato/app/grist-editor/ox-grist-editor-partition-keys.js'
|
|
91
|
+
|
|
92
|
+
import { registerEditor, registerRenderer } from '@operato/data-grist'
|
|
93
|
+
|
|
94
|
+
registerEditor('parameters', OxGristEditorParameters)
|
|
95
|
+
registerEditor('crontab', OxGristEditorCrontab)
|
|
96
|
+
registerEditor('value-map', OxGristEditorValueMap)
|
|
97
|
+
registerEditor('partition-keys', OxGristEditorPartitionKeys)
|
|
98
|
+
|
|
99
|
+
// registerRenderer('crontab', OxGristRendererCrontab) -- caused import error
|
|
100
|
+
|
|
101
|
+
/* set grist-editors */
|
|
102
|
+
import '../dist/src/grist-editor/index.js'
|
|
103
|
+
|
|
104
|
+
import { OxDataUseCase } from '../dist/src/ox-data-use-case.js'
|
|
105
|
+
|
|
106
|
+
const ccpUseCase = {
|
|
107
|
+
getSpecification: dataItem => {
|
|
108
|
+
return {
|
|
109
|
+
name: 'ccp',
|
|
110
|
+
description: 'ccp specs',
|
|
111
|
+
specs: [
|
|
112
|
+
{
|
|
113
|
+
type: 'number',
|
|
114
|
+
label: 'critical limits',
|
|
115
|
+
name: 'criticalLimits',
|
|
116
|
+
property: dataItem
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
type: 'string',
|
|
120
|
+
label: 'target limits',
|
|
121
|
+
name: 'targetLimits',
|
|
122
|
+
property: dataItem
|
|
123
|
+
}
|
|
124
|
+
]
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
const qcUseCase = {
|
|
130
|
+
getSpecification: dataItem => {
|
|
131
|
+
return {
|
|
132
|
+
name: 'qc',
|
|
133
|
+
description: 'qc specs',
|
|
134
|
+
specs: [
|
|
135
|
+
{
|
|
136
|
+
type: 'number',
|
|
137
|
+
label: 'critical limits',
|
|
138
|
+
name: 'criticalLimits',
|
|
139
|
+
property: dataItem
|
|
140
|
+
},
|
|
141
|
+
{
|
|
142
|
+
type: 'boolean',
|
|
143
|
+
label: 'target limits',
|
|
144
|
+
name: 'targetLimits',
|
|
145
|
+
property: dataItem
|
|
146
|
+
}
|
|
147
|
+
]
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
OxDataUseCase.registerUseCase('ccp', ccpUseCase)
|
|
153
|
+
OxDataUseCase.registerUseCase('qc', qcUseCase)
|
|
154
|
+
|
|
155
|
+
const fetchHandler = async ({ page, limit, sorters = [] }) => {
|
|
156
|
+
var total = 10
|
|
157
|
+
var start = (page - 1) * limit
|
|
158
|
+
|
|
159
|
+
return {
|
|
160
|
+
total,
|
|
161
|
+
records: Array(limit * page > total ? total % limit : limit)
|
|
162
|
+
.fill()
|
|
163
|
+
.map((item, idx) => {
|
|
164
|
+
return {
|
|
165
|
+
id: idx,
|
|
166
|
+
name: `name-${start + idx + 1}`,
|
|
167
|
+
description: `description-${start + idx + 1}`,
|
|
168
|
+
sequence: idx + 1,
|
|
169
|
+
active: true,
|
|
170
|
+
tag: `tag-${idx + 1}`,
|
|
171
|
+
type: idx % 3 === 0 ? 'select' : idx % 3 === 1 ? 'number' : 'string',
|
|
172
|
+
spec: {
|
|
173
|
+
ccp: {
|
|
174
|
+
criticalLimits: 100,
|
|
175
|
+
targetLimits: 200
|
|
176
|
+
},
|
|
177
|
+
qc: {
|
|
178
|
+
criticalLimits: 300,
|
|
179
|
+
targetLimits: true
|
|
180
|
+
}
|
|
181
|
+
},
|
|
182
|
+
options:
|
|
183
|
+
idx % 2 === 0
|
|
184
|
+
? {
|
|
185
|
+
options: [
|
|
186
|
+
{
|
|
187
|
+
text: 'A',
|
|
188
|
+
value: 'a'
|
|
189
|
+
},
|
|
190
|
+
{
|
|
191
|
+
text: 'B',
|
|
192
|
+
value: 'b'
|
|
193
|
+
}
|
|
194
|
+
]
|
|
195
|
+
}
|
|
196
|
+
: undefined,
|
|
197
|
+
schedule: '* * * * * *',
|
|
198
|
+
keyvalue: {},
|
|
199
|
+
createdAt: Date.now(),
|
|
200
|
+
updatedAt: Date.now()
|
|
201
|
+
}
|
|
202
|
+
})
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
class GristDemo extends LitElement {
|
|
207
|
+
static styles = [
|
|
208
|
+
CommonGristStyles,
|
|
209
|
+
css`
|
|
210
|
+
:host {
|
|
211
|
+
display: flex;
|
|
212
|
+
flex-direction: column;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
#tailer {
|
|
216
|
+
display: flex;
|
|
217
|
+
flex-direction: row;
|
|
218
|
+
margin: 0 var(--margin-default);
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
#tailer a {
|
|
222
|
+
padding: 0 var(--padding-default) 0 var(--padding-default);
|
|
223
|
+
margin: 0 var(--margin-narrow);
|
|
224
|
+
border-right: 1px solid rgba(0, 0, 0, 0.1);
|
|
225
|
+
font-size: var(--fontsize-default);
|
|
226
|
+
color: var(--primary-color);
|
|
227
|
+
}
|
|
228
|
+
`
|
|
229
|
+
]
|
|
230
|
+
|
|
231
|
+
static get properties() {
|
|
232
|
+
return {
|
|
233
|
+
mode: String
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
get grist() {
|
|
238
|
+
return this.renderRoot.querySelector('ox-grist')
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
config = {
|
|
242
|
+
list: { fields: ['name', 'description', 'active'] },
|
|
243
|
+
columns: [
|
|
244
|
+
{ type: 'gutter', gutterName: 'row-selector', multiple: true },
|
|
245
|
+
{
|
|
246
|
+
type: 'gutter',
|
|
247
|
+
gutterName: 'button',
|
|
248
|
+
icon: 'add',
|
|
249
|
+
handlers: {
|
|
250
|
+
click: 'record-copy'
|
|
251
|
+
}
|
|
252
|
+
},
|
|
253
|
+
{ type: 'gutter', gutterName: 'sequence' },
|
|
254
|
+
{
|
|
255
|
+
type: 'gutter',
|
|
256
|
+
gutterName: 'button',
|
|
257
|
+
icon: 'arrow_upward',
|
|
258
|
+
handlers: {
|
|
259
|
+
click: 'move-up'
|
|
260
|
+
}
|
|
261
|
+
},
|
|
262
|
+
{
|
|
263
|
+
type: 'gutter',
|
|
264
|
+
gutterName: 'button',
|
|
265
|
+
icon: 'arrow_downward',
|
|
266
|
+
handlers: {
|
|
267
|
+
click: 'move-down'
|
|
268
|
+
}
|
|
269
|
+
},
|
|
270
|
+
{
|
|
271
|
+
type: 'number',
|
|
272
|
+
name: 'sequence',
|
|
273
|
+
hidden: true
|
|
274
|
+
},
|
|
275
|
+
{
|
|
276
|
+
type: 'string',
|
|
277
|
+
name: 'id',
|
|
278
|
+
hidden: true
|
|
279
|
+
},
|
|
280
|
+
{
|
|
281
|
+
type: 'string',
|
|
282
|
+
name: 'name',
|
|
283
|
+
header: i18next.t('field.name'),
|
|
284
|
+
record: {
|
|
285
|
+
editable: true
|
|
286
|
+
},
|
|
287
|
+
width: 140
|
|
288
|
+
},
|
|
289
|
+
{
|
|
290
|
+
type: 'string',
|
|
291
|
+
name: 'description',
|
|
292
|
+
header: i18next.t('field.description'),
|
|
293
|
+
record: {
|
|
294
|
+
editable: true
|
|
295
|
+
},
|
|
296
|
+
width: 180
|
|
297
|
+
},
|
|
298
|
+
{
|
|
299
|
+
type: 'checkbox',
|
|
300
|
+
name: 'active',
|
|
301
|
+
label: true,
|
|
302
|
+
header: i18next.t('field.active'),
|
|
303
|
+
record: {
|
|
304
|
+
editable: true
|
|
305
|
+
},
|
|
306
|
+
sortable: true,
|
|
307
|
+
width: 60
|
|
308
|
+
},
|
|
309
|
+
{
|
|
310
|
+
type: 'string',
|
|
311
|
+
name: 'tag',
|
|
312
|
+
header: i18next.t('field.tag'),
|
|
313
|
+
record: {
|
|
314
|
+
editable: true
|
|
315
|
+
},
|
|
316
|
+
width: 180
|
|
317
|
+
},
|
|
318
|
+
{
|
|
319
|
+
type: 'select',
|
|
320
|
+
name: 'type',
|
|
321
|
+
header: i18next.t('field.type'),
|
|
322
|
+
record: {
|
|
323
|
+
options: ['', 'number', 'text', 'select', 'boolean', 'file'],
|
|
324
|
+
editable: true
|
|
325
|
+
},
|
|
326
|
+
width: 120
|
|
327
|
+
},
|
|
328
|
+
{
|
|
329
|
+
type: 'crontab',
|
|
330
|
+
name: 'schedule',
|
|
331
|
+
header: i18next.t('field.schedule'),
|
|
332
|
+
record: {
|
|
333
|
+
editable: true
|
|
334
|
+
},
|
|
335
|
+
width: 120
|
|
336
|
+
},
|
|
337
|
+
{
|
|
338
|
+
type: 'partition-keys',
|
|
339
|
+
name: 'keyvalue',
|
|
340
|
+
header: i18next.t('field.keyvalue'),
|
|
341
|
+
record: {
|
|
342
|
+
editable: true,
|
|
343
|
+
options: {
|
|
344
|
+
objectified: true,
|
|
345
|
+
valuetype: 'string'
|
|
346
|
+
}
|
|
347
|
+
},
|
|
348
|
+
width: 120
|
|
349
|
+
},
|
|
350
|
+
{
|
|
351
|
+
type: 'parameters',
|
|
352
|
+
name: 'options',
|
|
353
|
+
header: i18next.t('field.options'),
|
|
354
|
+
record: {
|
|
355
|
+
editable: true,
|
|
356
|
+
renderer: (value, column, record, rowIndex, field) => {
|
|
357
|
+
return typeof value === 'string' ? value : typeof value === 'object' ? JSON.stringify(value) : ''
|
|
358
|
+
},
|
|
359
|
+
options: async (value, column, record, row, field) => {
|
|
360
|
+
return {
|
|
361
|
+
name: record.type,
|
|
362
|
+
help: '',
|
|
363
|
+
spec:
|
|
364
|
+
record.type === 'select'
|
|
365
|
+
? [
|
|
366
|
+
{
|
|
367
|
+
type: 'options',
|
|
368
|
+
name: 'options',
|
|
369
|
+
label: 'options'
|
|
370
|
+
}
|
|
371
|
+
]
|
|
372
|
+
: [],
|
|
373
|
+
context: this.grist,
|
|
374
|
+
objectified: true /* tell parameters editor not to need to parse */
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
},
|
|
378
|
+
width: 120
|
|
379
|
+
},
|
|
380
|
+
{
|
|
381
|
+
type: 'string',
|
|
382
|
+
name: 'unit',
|
|
383
|
+
header: i18next.t('field.unit'),
|
|
384
|
+
record: {
|
|
385
|
+
editable: true
|
|
386
|
+
},
|
|
387
|
+
width: 120
|
|
388
|
+
},
|
|
389
|
+
{
|
|
390
|
+
type: 'number',
|
|
391
|
+
name: 'quota',
|
|
392
|
+
header: i18next.t('field.quota'),
|
|
393
|
+
record: {
|
|
394
|
+
editable: true
|
|
395
|
+
},
|
|
396
|
+
width: 60
|
|
397
|
+
},
|
|
398
|
+
{
|
|
399
|
+
type: 'data-item-spec',
|
|
400
|
+
name: 'spec',
|
|
401
|
+
header: i18next.t('field.spec'),
|
|
402
|
+
record: {
|
|
403
|
+
editable: true,
|
|
404
|
+
options: {
|
|
405
|
+
name,
|
|
406
|
+
objectified: true
|
|
407
|
+
}
|
|
408
|
+
},
|
|
409
|
+
width: 200
|
|
410
|
+
}
|
|
411
|
+
],
|
|
412
|
+
rows: {
|
|
413
|
+
selectable: {
|
|
414
|
+
multiple: true
|
|
415
|
+
}
|
|
416
|
+
},
|
|
417
|
+
pagination: {
|
|
418
|
+
infinite: true
|
|
419
|
+
},
|
|
420
|
+
sorters: [
|
|
421
|
+
{
|
|
422
|
+
name: 'sequence'
|
|
423
|
+
}
|
|
424
|
+
]
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
render() {
|
|
428
|
+
const mode = this.mode || 'CARD'
|
|
429
|
+
|
|
430
|
+
return html`
|
|
431
|
+
<ox-grist .config=${this.config} .mode=${mode} auto-fetch .fetchHandler=${fetchHandler}>
|
|
432
|
+
<div id="filters" slot="headroom">
|
|
433
|
+
<ox-filters-form @filters-change=${e => console.log('changed', e.detail)}></ox-filters-form>
|
|
434
|
+
</div>
|
|
435
|
+
|
|
436
|
+
<div slot="headroom" id="headroom">
|
|
437
|
+
<div id="sorters">
|
|
438
|
+
Sort
|
|
439
|
+
<mwc-icon
|
|
440
|
+
@click=${e => {
|
|
441
|
+
const target = e.currentTarget
|
|
442
|
+
this.renderRoot.querySelector('#sorter-control').open({
|
|
443
|
+
right: 0,
|
|
444
|
+
top: target.offsetTop + target.offsetHeight
|
|
445
|
+
})
|
|
446
|
+
}}
|
|
447
|
+
>expand_more</mwc-icon
|
|
448
|
+
>
|
|
449
|
+
<ox-popup id="sorter-control">
|
|
450
|
+
<ox-sorters-control> </ox-sorters-control>
|
|
451
|
+
</ox-popup>
|
|
452
|
+
</div>
|
|
453
|
+
|
|
454
|
+
<div id="modes">
|
|
455
|
+
<mwc-icon @click=${() => (this.mode = 'GRID')} ?active=${mode == 'GRID'}>view_list</mwc-icon>
|
|
456
|
+
<mwc-icon @click=${() => (this.mode = 'LIST')} ?active=${mode == 'LIST'}>menu</mwc-icon>
|
|
457
|
+
<mwc-icon @click=${() => (this.mode = 'CARD')} ?active=${mode == 'CARD'}>apps</mwc-icon>
|
|
458
|
+
</div>
|
|
459
|
+
</div>
|
|
460
|
+
</ox-grist>
|
|
461
|
+
`
|
|
462
|
+
}
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
customElements.define('ox-data-items', GristDemo)
|
|
466
|
+
|
|
467
|
+
setTimeout(() => {
|
|
468
|
+
render(html` <ox-data-items mode="LIST"></ox-data-items> `, document.querySelector('#demo'))
|
|
469
|
+
})
|
|
470
|
+
</script>
|
|
471
|
+
|
|
472
|
+
<div id="app">
|
|
473
|
+
<div id="demo"></div>
|
|
474
|
+
</div>
|
|
475
|
+
</body>
|
|
476
|
+
</html>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './ox-grist-editor-data-item-spec';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { OxGristRendererJson5, registerEditor, registerRenderer } from '@operato/data-grist';
|
|
2
|
+
import { OxGristEditorDataItemSpec } from './ox-grist-editor-data-item-spec';
|
|
3
|
+
/* register grist renderer/editor for id */
|
|
4
|
+
registerEditor('data-item-spec', OxGristEditorDataItemSpec);
|
|
5
|
+
registerRenderer('data-item-spec', OxGristRendererJson5);
|
|
6
|
+
export * from './ox-grist-editor-data-item-spec';
|
|
7
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/grist-editor/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAA;AAE5F,OAAO,EAAE,yBAAyB,EAAE,MAAM,kCAAkC,CAAA;AAE5E,2CAA2C;AAC3C,cAAc,CAAC,gBAAgB,EAAE,yBAAyB,CAAC,CAAA;AAE3D,gBAAgB,CAAC,gBAAgB,EAAE,oBAAoB,CAAC,CAAA;AAExD,cAAc,kCAAkC,CAAA","sourcesContent":["import { OxGristRendererJson5, registerEditor, registerRenderer } from '@operato/data-grist'\n\nimport { OxGristEditorDataItemSpec } from './ox-grist-editor-data-item-spec'\n\n/* register grist renderer/editor for id */\nregisterEditor('data-item-spec', OxGristEditorDataItemSpec)\n\nregisterRenderer('data-item-spec', OxGristRendererJson5)\n\nexport * from './ox-grist-editor-data-item-spec'\n"]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright © HatioLab Inc. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
import './ox-popup-data-item-spec.js';
|
|
5
|
+
import { OxGristEditor } from '@operato/data-grist';
|
|
6
|
+
export declare class OxGristEditorDataItemSpec extends OxGristEditor {
|
|
7
|
+
private popup?;
|
|
8
|
+
get editorTemplate(): import("lit-html").TemplateResult<1>;
|
|
9
|
+
firstUpdated(): Promise<void>;
|
|
10
|
+
openSelector(): Promise<void>;
|
|
11
|
+
}
|