@operato/dataset 1.0.0-alpha.20 → 1.0.0-alpha.23

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 (42) hide show
  1. package/CHANGELOG.md +39 -0
  2. package/demo/data-item-grist.html +343 -0
  3. package/demo/index.html +6 -90
  4. package/demo/ox-data-entry-form.html +110 -0
  5. package/demo/ox-data-item-spec.html +148 -0
  6. package/dist/src/grist-editor/index.d.ts +1 -0
  7. package/dist/src/grist-editor/index.js +7 -0
  8. package/dist/src/grist-editor/index.js.map +1 -0
  9. package/dist/src/grist-editor/ox-data-item-spec-editor-popup.d.ts +13 -0
  10. package/dist/src/grist-editor/ox-data-item-spec-editor-popup.js +90 -0
  11. package/dist/src/grist-editor/ox-data-item-spec-editor-popup.js.map +1 -0
  12. package/dist/src/grist-editor/ox-data-item-spec-editor.d.ts +18 -0
  13. package/dist/src/grist-editor/ox-data-item-spec-editor.js +98 -0
  14. package/dist/src/grist-editor/ox-data-item-spec-editor.js.map +1 -0
  15. package/dist/src/index.d.ts +3 -1
  16. package/dist/src/index.js +3 -1
  17. package/dist/src/index.js.map +1 -1
  18. package/dist/src/ox-data-entry-form.d.ts +1 -24
  19. package/dist/src/ox-data-entry-form.js +7 -5
  20. package/dist/src/ox-data-entry-form.js.map +1 -1
  21. package/dist/src/ox-data-item-spec.d.ts +22 -0
  22. package/dist/src/ox-data-item-spec.js +67 -0
  23. package/dist/src/ox-data-item-spec.js.map +1 -0
  24. package/dist/src/types.d.ts +38 -0
  25. package/dist/src/types.js +2 -0
  26. package/dist/src/types.js.map +1 -0
  27. package/dist/tsconfig.tsbuildinfo +1 -1
  28. package/package.json +16 -11
  29. package/src/grist-editor/index.ts +10 -0
  30. package/src/grist-editor/ox-data-item-spec-editor-popup.ts +90 -0
  31. package/src/grist-editor/ox-data-item-spec-editor.ts +105 -0
  32. package/src/index.ts +3 -1
  33. package/src/ox-data-entry-form.ts +8 -27
  34. package/src/ox-data-item-spec.ts +64 -0
  35. package/src/types.ts +38 -0
  36. package/themes/grist-theme.css +194 -0
  37. package/themes/oops-theme.css +26 -0
  38. package/themes/report-theme.css +47 -0
  39. package/translations/en.json +1 -0
  40. package/translations/ko.json +1 -0
  41. package/translations/ms.json +1 -0
  42. package/translations/zh.json +1 -0
package/CHANGELOG.md CHANGED
@@ -3,6 +3,45 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [1.0.0-alpha.23](https://github.com/hatiolab/operato/compare/v1.0.0-alpha.22...v1.0.0-alpha.23) (2022-03-17)
7
+
8
+
9
+ ### :rocket: New Features
10
+
11
+ * added qc module ([263b679](https://github.com/hatiolab/operato/commit/263b6794b97a635df1a50d013adaef2e83635908))
12
+
13
+
14
+
15
+ ## [1.0.0-alpha.22](https://github.com/hatiolab/operato/compare/v1.0.0-alpha.21...v1.0.0-alpha.22) (2022-03-17)
16
+
17
+
18
+ ### :bug: Bug Fix
19
+
20
+ * ccp demo ([67b7d65](https://github.com/hatiolab/operato/commit/67b7d65b48d0ca7b3350684a45a396c0538c4902))
21
+
22
+
23
+ ### :rocket: New Features
24
+
25
+ * added data-item-spec-editor for grist ([8376e14](https://github.com/hatiolab/operato/commit/8376e142d894a709e60ed676e917d5a26e01e374))
26
+
27
+
28
+
29
+ ## [1.0.0-alpha.21](https://github.com/hatiolab/operato/compare/v1.0.0-alpha.20...v1.0.0-alpha.21) (2022-03-16)
30
+
31
+
32
+ ### :rocket: New Features
33
+
34
+ * @operato/ccp module added ([f08ba5a](https://github.com/hatiolab/operato/commit/f08ba5a464c04b7fb132c6f18de975997087846a))
35
+ * ccp spec provider ([d72fe7c](https://github.com/hatiolab/operato/commit/d72fe7c497685e7f033ef04e6a866bd86613f397))
36
+
37
+
38
+ ### :bug: Bug Fix
39
+
40
+ * demo ([6fa3eac](https://github.com/hatiolab/operato/commit/6fa3eac612bd98ce25e3ef6d8ce89527d7152fb4))
41
+ * description on ox-data-item-spec view ([47da306](https://github.com/hatiolab/operato/commit/47da306a253a96e0c24c986e4608bfe0713a111a))
42
+
43
+
44
+
6
45
  ## [1.0.0-alpha.20](https://github.com/hatiolab/operato/compare/v1.0.0-alpha.19...v1.0.0-alpha.20) (2022-03-15)
7
46
 
8
47
 
@@ -0,0 +1,343 @@
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
+ </script>
56
+ </head>
57
+
58
+ <body>
59
+ <script type="module">
60
+ import { LitElement, html, css, render } from 'lit'
61
+ import '@operato/data-grist'
62
+ import '@operato/data-grist/ox-filters-form.js'
63
+ import '@operato/data-grist/ox-sorters-control.js'
64
+ import '@material/mwc-icon'
65
+ import { CommonGristStyles } from '@operato/styles'
66
+ import { i18next } from '@operato/i18n'
67
+
68
+ /* set grist-editors */
69
+ import '../dist/src/grist-editor/index.js'
70
+
71
+ const fetchHandler = async ({ page, limit, sorters = [] }) => {
72
+ var total = 10
73
+ var start = (page - 1) * limit
74
+
75
+ return {
76
+ total,
77
+ records: Array(limit * page > total ? total % limit : limit)
78
+ .fill()
79
+ .map((item, idx) => {
80
+ return {
81
+ id: idx,
82
+ name: `name-${start + idx + 1}`,
83
+ description: `description-${start + idx + 1}`,
84
+ sequence: idx + 1,
85
+ active: true,
86
+ tag: `tag-${idx + 1}`,
87
+ type: idx % 3 === 0 ? 'select' : idx % 3 === 1 ? 'number' : 'string',
88
+ createdAt: Date.now(),
89
+ updatedAt: Date.now()
90
+ }
91
+ })
92
+ }
93
+ }
94
+
95
+ var config = {
96
+ list: { fields: ['name', 'description', 'active'] },
97
+ columns: [
98
+ { type: 'gutter', gutterName: 'row-selector', multiple: true },
99
+ {
100
+ type: 'gutter',
101
+ gutterName: 'button',
102
+ icon: 'add',
103
+ handlers: {
104
+ click: 'record-copy'
105
+ }
106
+ },
107
+ { type: 'gutter', gutterName: 'sequence' },
108
+ {
109
+ type: 'gutter',
110
+ gutterName: 'button',
111
+ icon: 'arrow_upward',
112
+ handlers: {
113
+ click: 'move-up'
114
+ }
115
+ },
116
+ {
117
+ type: 'gutter',
118
+ gutterName: 'button',
119
+ icon: 'arrow_downward',
120
+ handlers: {
121
+ click: 'move-down'
122
+ }
123
+ },
124
+ {
125
+ type: 'number',
126
+ name: 'sequence',
127
+ hidden: true
128
+ },
129
+ {
130
+ type: 'string',
131
+ name: 'id',
132
+ hidden: true
133
+ },
134
+ {
135
+ type: 'string',
136
+ name: 'name',
137
+ header: i18next.t('field.name'),
138
+ record: {
139
+ editable: true
140
+ },
141
+ width: 140
142
+ },
143
+ {
144
+ type: 'string',
145
+ name: 'description',
146
+ header: i18next.t('field.description'),
147
+ record: {
148
+ editable: true
149
+ },
150
+ width: 180
151
+ },
152
+ {
153
+ type: 'checkbox',
154
+ name: 'active',
155
+ label: true,
156
+ header: i18next.t('field.active'),
157
+ record: {
158
+ editable: true
159
+ },
160
+ sortable: true,
161
+ width: 60
162
+ },
163
+ {
164
+ type: 'string',
165
+ name: 'tag',
166
+ header: i18next.t('field.tag'),
167
+ record: {
168
+ editable: true
169
+ },
170
+ width: 180
171
+ },
172
+ {
173
+ type: 'select',
174
+ name: 'type',
175
+ header: i18next.t('field.type'),
176
+ record: {
177
+ options: ['', 'number', 'text', 'select', 'boolean', 'file'],
178
+ editable: true
179
+ },
180
+ width: 120
181
+ },
182
+ {
183
+ type: 'parameters',
184
+ name: 'options',
185
+ header: i18next.t('field.options'),
186
+ record: {
187
+ editable: true,
188
+ renderer: (value, column, record, rowIndex, field) => {
189
+ return typeof value === 'string' ? value : typeof value === 'object' ? JSON.stringify(value) : ''
190
+ },
191
+ options: async (value, column, record, row, field) => {
192
+ return {
193
+ name: record.type,
194
+ help: '',
195
+ spec:
196
+ record.type === 'select'
197
+ ? [
198
+ {
199
+ type: 'options',
200
+ name: 'options',
201
+ label: 'options'
202
+ }
203
+ ]
204
+ : [],
205
+ context: this.grist,
206
+ objectified: true
207
+ }
208
+ }
209
+ },
210
+ width: 120
211
+ },
212
+ {
213
+ type: 'string',
214
+ name: 'unit',
215
+ header: i18next.t('field.unit'),
216
+ record: {
217
+ editable: true
218
+ },
219
+ width: 120
220
+ },
221
+ {
222
+ type: 'number',
223
+ name: 'quota',
224
+ header: i18next.t('field.quota'),
225
+ record: {
226
+ editable: true
227
+ },
228
+ width: 60
229
+ },
230
+ {
231
+ type: 'data-item-spec',
232
+ name: 'spec',
233
+ header: i18next.t('field.spec'),
234
+ record: {
235
+ editable: true,
236
+ options: {
237
+ name,
238
+ objectified: true
239
+ }
240
+ },
241
+ width: 200
242
+ }
243
+ ],
244
+ rows: {
245
+ selectable: {
246
+ multiple: true
247
+ }
248
+ },
249
+ pagination: {
250
+ infinite: true
251
+ },
252
+ sorters: [
253
+ {
254
+ name: 'sequence'
255
+ }
256
+ ]
257
+ }
258
+
259
+ class GristDemo extends LitElement {
260
+ static styles = [
261
+ CommonGristStyles,
262
+ css`
263
+ :host {
264
+ display: flex;
265
+ flex-direction: column;
266
+ }
267
+
268
+ #tailer {
269
+ display: flex;
270
+ flex-direction: row;
271
+ margin: 0 var(--margin-default);
272
+ }
273
+
274
+ #tailer a {
275
+ padding: 0 var(--padding-default) 0 var(--padding-default);
276
+ margin: 0 var(--margin-narrow);
277
+ border-right: 1px solid rgba(0, 0, 0, 0.1);
278
+ font-size: var(--fontsize-default);
279
+ color: var(--primary-color);
280
+ }
281
+ `
282
+ ]
283
+
284
+ static get properties() {
285
+ return {
286
+ mode: String
287
+ }
288
+ }
289
+
290
+ get grist() {
291
+ return this.renderRoot.querySelector('ox-grist')
292
+ }
293
+
294
+ render() {
295
+ const mode = this.mode || 'CARD'
296
+
297
+ return html`
298
+ <ox-grist .config=${config} .mode=${mode} auto-fetch .fetchHandler=${fetchHandler}>
299
+ <div id="filters" slot="headroom">
300
+ <ox-filters-form @filters-change=${e => console.log('changed', e.detail)}></ox-filters-form>
301
+ </div>
302
+
303
+ <div slot="headroom" id="headroom">
304
+ <div id="sorters">
305
+ Sort
306
+ <mwc-icon
307
+ @click=${e => {
308
+ const target = e.currentTarget
309
+ this.renderRoot.querySelector('#sorter-control').open({
310
+ right: 0,
311
+ top: target.offsetTop + target.offsetHeight
312
+ })
313
+ }}
314
+ >expand_more</mwc-icon
315
+ >
316
+ <ox-popup id="sorter-control">
317
+ <ox-sorters-control> </ox-sorters-control>
318
+ </ox-popup>
319
+ </div>
320
+
321
+ <div id="modes">
322
+ <mwc-icon @click=${() => (this.mode = 'GRID')} ?active=${mode == 'GRID'}>view_list</mwc-icon>
323
+ <mwc-icon @click=${() => (this.mode = 'LIST')} ?active=${mode == 'LIST'}>menu</mwc-icon>
324
+ <mwc-icon @click=${() => (this.mode = 'CARD')} ?active=${mode == 'CARD'}>apps</mwc-icon>
325
+ </div>
326
+ </div>
327
+ </ox-grist>
328
+ `
329
+ }
330
+ }
331
+
332
+ customElements.define('ox-data-items', GristDemo)
333
+
334
+ setTimeout(() => {
335
+ render(html` <ox-data-items mode="LIST"></ox-data-items> `, document.querySelector('#demo'))
336
+ })
337
+ </script>
338
+
339
+ <div id="app">
340
+ <div id="demo"></div>
341
+ </div>
342
+ </body>
343
+ </html>
package/demo/index.html CHANGED
@@ -8,103 +8,19 @@
8
8
  --ox-checkbox-size: 12px;
9
9
  }
10
10
 
11
- #demo {
11
+ a {
12
+ display: block;
12
13
  }
13
14
  </style>
15
+
14
16
  <link href="https://fonts.googleapis.com/css?family=Roboto:300,400,500" rel="stylesheet" />
15
17
  <link href="https://fonts.googleapis.com/css?family=Material+Icons&display=block" rel="stylesheet" />
16
18
  <link href="/themes/app-theme.css" rel="stylesheet" />
17
19
  <link href="/themes/form-theme.css" rel="stylesheet" />
18
20
  </head>
19
21
  <body>
20
- <div id="demo"></div>
21
-
22
- <script type="module">
23
- import { html, render } from 'lit'
24
- import '../dist/src/ox-data-entry-form.js'
25
-
26
- const parent = document.querySelector('#demo')
27
- const dataSet = {
28
- name: 'sample',
29
- description: 'sample description',
30
- dataItems: [
31
- {
32
- name: '창고 온도',
33
- description: '창고 온도는 섭씨 0도 이하로 유지되어야 합니다.',
34
- sequence: 1,
35
- tag: 'temp',
36
- type: 'number',
37
- quota: 1
38
- },
39
- {
40
- name: '창고 습도',
41
- description: '창고 습도는 30% 이하로 유지되어야 합니다.',
42
- sequence: 2,
43
- tag: 'humid',
44
- type: 'number',
45
- quota: 5
46
- },
47
- {
48
- name: '육안 검사',
49
- description: '육안 검사는 포장전 30분 내로 실행되어야 합니다.',
50
- sequence: 3,
51
- tag: 'inspection',
52
- type: 'boolean',
53
- quota: 3
54
- },
55
- {
56
- name: '품평',
57
- description: '품평은 최우수/우수/보통/미달을 포함하여 간단히 평가.',
58
- sequence: 4,
59
- tag: 'evaluation',
60
- type: 'select',
61
- options: {
62
- options: [
63
- { text: '최우수', value: '최우수' },
64
- { text: '우수', value: '우수' },
65
- { text: '보통', value: '보통' },
66
- { text: '미달', value: '미달' }
67
- ]
68
- },
69
- quota: 3
70
- },
71
- {
72
- name: '코멘트',
73
- description: '특이사항을 기록함.',
74
- sequence: 4,
75
- tag: 'comment',
76
- type: 'string',
77
- quota: 1
78
- },
79
- {
80
- name: '첨부파일',
81
- description: '참조 첨부 파일.',
82
- sequence: 4,
83
- tag: 'attachment',
84
- type: 'file',
85
- quota: 1
86
- }
87
- ]
88
- }
89
-
90
- var value = {
91
- temp: 1000,
92
- humid: [20, 23, 21, 26, 27],
93
- inspection: [true, false, true],
94
- evaluation: ['최우수', '보통', '우수']
95
- }
96
-
97
- render(
98
- html`<ox-data-entry-form
99
- .dataSet=${dataSet}
100
- .value=${value}
101
- @change=${e => {
102
- value = e.detail
103
- console.log('change', value)
104
- }}
105
- ></ox-data-entry-form>`,
106
- parent
107
- )
108
- </script>
22
+ <a href="./ox-data-entry-form.html">ox-data-entry-form</a>
23
+ <a href="./ox-data-item-spec.html">ox-data-item-spec</a>
24
+ <a href="./data-item-grist.html">data-item-grist</a>
109
25
  </body>
110
26
  </html>
@@ -0,0 +1,110 @@
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 '../dist/src/ox-data-entry-form.js'
25
+
26
+ const parent = document.querySelector('#demo')
27
+ const dataSet = {
28
+ name: 'sample',
29
+ description: 'sample description',
30
+ dataItems: [
31
+ {
32
+ name: '창고 온도',
33
+ description: '창고 온도는 섭씨 0도 이하로 유지되어야 합니다.',
34
+ sequence: 1,
35
+ tag: 'temp',
36
+ type: 'number',
37
+ quota: 1
38
+ },
39
+ {
40
+ name: '창고 습도',
41
+ description: '창고 습도는 30% 이하로 유지되어야 합니다.',
42
+ sequence: 2,
43
+ tag: 'humid',
44
+ type: 'number',
45
+ quota: 5
46
+ },
47
+ {
48
+ name: '육안 검사',
49
+ description: '육안 검사는 포장전 30분 내로 실행되어야 합니다.',
50
+ sequence: 3,
51
+ tag: 'inspection',
52
+ type: 'boolean',
53
+ quota: 3
54
+ },
55
+ {
56
+ name: '품평',
57
+ description: '품평은 최우수/우수/보통/미달을 포함하여 간단히 평가.',
58
+ sequence: 4,
59
+ tag: 'evaluation',
60
+ type: 'select',
61
+ options: {
62
+ options: [
63
+ { text: '최우수', value: '최우수' },
64
+ { text: '우수', value: '우수' },
65
+ { text: '보통', value: '보통' },
66
+ { text: '미달', value: '미달' }
67
+ ]
68
+ },
69
+ quota: 3
70
+ },
71
+ {
72
+ name: '코멘트',
73
+ description: '특이사항을 기록함.',
74
+ sequence: 4,
75
+ tag: 'comment',
76
+ type: 'string',
77
+ quota: 1
78
+ },
79
+ {
80
+ name: '첨부파일',
81
+ description: '참조 첨부 파일.',
82
+ sequence: 4,
83
+ tag: 'attachment',
84
+ type: 'file',
85
+ quota: 1
86
+ }
87
+ ]
88
+ }
89
+
90
+ var value = {
91
+ temp: 1000,
92
+ humid: [20, 23, 21, 26, 27],
93
+ inspection: [true, false, true],
94
+ evaluation: ['최우수', '보통', '우수']
95
+ }
96
+
97
+ render(
98
+ html`<ox-data-entry-form
99
+ .dataSet=${dataSet}
100
+ .value=${value}
101
+ @change=${e => {
102
+ value = e.detail
103
+ console.log('change', value)
104
+ }}
105
+ ></ox-data-entry-form>`,
106
+ parent
107
+ )
108
+ </script>
109
+ </body>
110
+ </html>