@operato/dataset 1.0.0-alpha.36 → 1.0.0-alpha.37
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 +13 -0
- package/demo/index.html +1 -0
- package/demo/ox-data-item-spec.html +43 -39
- package/demo/ox-data-sample-view.html +163 -0
- package/demo/ox-grist-editor-data-item-spec.html +43 -39
- package/dist/src/grist-editor/ox-grist-editor-data-item-spec.js +5 -5
- package/dist/src/grist-editor/ox-grist-editor-data-item-spec.js.map +1 -1
- package/dist/src/index.d.ts +2 -0
- package/dist/src/index.js +2 -0
- package/dist/src/index.js.map +1 -1
- package/dist/src/ox-data-entry-form.js +4 -9
- package/dist/src/ox-data-entry-form.js.map +1 -1
- package/dist/src/ox-data-item-spec.d.ts +1 -7
- package/dist/src/ox-data-item-spec.js +5 -15
- package/dist/src/ox-data-item-spec.js.map +1 -1
- package/dist/src/ox-data-sample-view.d.ts +16 -0
- package/dist/src/ox-data-sample-view.js +151 -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 +22 -2
- package/dist/src/types.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +13 -11
- package/src/grist-editor/ox-grist-editor-data-item-spec.ts +5 -5
- package/src/index.ts +2 -0
- package/src/ox-data-entry-form.ts +4 -9
- package/src/ox-data-item-spec.ts +5 -17
- package/src/ox-data-sample-view.ts +155 -0
- package/src/ox-data-use-case.ts +147 -0
- package/src/types.ts +14 -2
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,19 @@
|
|
|
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.37](https://github.com/hatiolab/operato/compare/v1.0.0-alpha.36...v1.0.0-alpha.37) (2022-03-25)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### :bug: Bug Fix
|
|
10
|
+
|
|
11
|
+
* data-item-spec => data-use-case ([3b5e684](https://github.com/hatiolab/operato/commit/3b5e684362621b89883ea6ed22acb7084678d3a5))
|
|
12
|
+
* data-use-case-xx ([7564cd3](https://github.com/hatiolab/operato/commit/7564cd3bdc9d4f61ac4eba6d382e9066a6d36a90))
|
|
13
|
+
* dataset ox-data-sample-view started ([42ceefe](https://github.com/hatiolab/operato/commit/42ceefe919739bbc9e30e468b3f526831e0a56c8))
|
|
14
|
+
* export some components and remove unused components ([3b9788d](https://github.com/hatiolab/operato/commit/3b9788d9d2a73235a2f96d586dcb02643768f0d6))
|
|
15
|
+
* handling data-use-case acceptables ([9ac1239](https://github.com/hatiolab/operato/commit/9ac12396fe15aebddef52bb0ed7fe1f445a6dbfd))
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
6
19
|
## [1.0.0-alpha.36](https://github.com/hatiolab/operato/compare/v1.0.0-alpha.35...v1.0.0-alpha.36) (2022-03-21)
|
|
7
20
|
|
|
8
21
|
**Note:** Version bump only for package @operato/dataset
|
package/demo/index.html
CHANGED
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
</head>
|
|
21
21
|
<body>
|
|
22
22
|
<a href="./ox-data-entry-form.html">ox-data-entry-form</a>
|
|
23
|
+
<a href="./ox-data-sample-view.html">ox-data-sample-view</a>
|
|
23
24
|
<a href="./ox-data-item-spec.html">ox-data-item-spec</a>
|
|
24
25
|
<a href="./ox-grist-editor-data-item-spec.html">ox-grist-editor-data-item-spec</a>
|
|
25
26
|
</body>
|
|
@@ -36,55 +36,59 @@
|
|
|
36
36
|
boolean: 'ox-property-editor-checkbox'
|
|
37
37
|
})
|
|
38
38
|
|
|
39
|
-
import {
|
|
39
|
+
import { OxDataUseCase } from '../dist/src/ox-data-use-case.js'
|
|
40
40
|
import '../dist/src/ox-data-item-spec.js'
|
|
41
41
|
|
|
42
42
|
const parent = document.querySelector('#demo')
|
|
43
43
|
|
|
44
|
-
const
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
44
|
+
const ccpUseCase = {
|
|
45
|
+
getSpecification: dataItem => {
|
|
46
|
+
return {
|
|
47
|
+
name: 'ccp',
|
|
48
|
+
description: 'ccp specs',
|
|
49
|
+
specs: [
|
|
50
|
+
{
|
|
51
|
+
type: 'number',
|
|
52
|
+
label: 'critical limits',
|
|
53
|
+
name: 'criticalLimits',
|
|
54
|
+
property: dataItem
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
type: 'string',
|
|
58
|
+
label: 'target limits',
|
|
59
|
+
name: 'targetLimits',
|
|
60
|
+
property: dataItem
|
|
61
|
+
}
|
|
62
|
+
]
|
|
63
|
+
}
|
|
62
64
|
}
|
|
63
65
|
}
|
|
64
66
|
|
|
65
|
-
const
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
67
|
+
const qcUseCase = {
|
|
68
|
+
getSpecification: dataItem => {
|
|
69
|
+
return {
|
|
70
|
+
name: 'qc',
|
|
71
|
+
description: 'qc specs',
|
|
72
|
+
specs: [
|
|
73
|
+
{
|
|
74
|
+
type: 'number',
|
|
75
|
+
label: 'critical limits',
|
|
76
|
+
name: 'criticalLimits',
|
|
77
|
+
property: dataItem
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
type: 'boolean',
|
|
81
|
+
label: 'target limits',
|
|
82
|
+
name: 'targetLimits',
|
|
83
|
+
property: dataItem
|
|
84
|
+
}
|
|
85
|
+
]
|
|
86
|
+
}
|
|
83
87
|
}
|
|
84
88
|
}
|
|
85
89
|
|
|
86
|
-
|
|
87
|
-
|
|
90
|
+
OxDataUseCase.registerUseCase('ccp', ccpUseCase)
|
|
91
|
+
OxDataUseCase.registerUseCase('qc', qcUseCase)
|
|
88
92
|
|
|
89
93
|
const dataItemA = {
|
|
90
94
|
name: '창고 온도',
|
|
@@ -0,0 +1,163 @@
|
|
|
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 value = {}
|
|
135
|
+
|
|
136
|
+
var dataSample = {
|
|
137
|
+
name: 'Data Sample Name',
|
|
138
|
+
description: 'Data Sample이 어쩌구 저쩌구 그래서 중요합니다. 당연히 그래야죠.',
|
|
139
|
+
useCase: 'CCP',
|
|
140
|
+
data: {
|
|
141
|
+
temp: [1000],
|
|
142
|
+
humid: [20, 23, 21, 26, 27],
|
|
143
|
+
inspection: [true, false, true],
|
|
144
|
+
evaluation: ['최우수', '보통', '우수']
|
|
145
|
+
},
|
|
146
|
+
collectedAt: Date.now()
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
render(
|
|
150
|
+
html`<ox-data-sample-view
|
|
151
|
+
.dataSet=${dataSet}
|
|
152
|
+
.dataSample=${dataSample}
|
|
153
|
+
.value=${value}
|
|
154
|
+
@change=${e => {
|
|
155
|
+
value = e.detail
|
|
156
|
+
console.log('change', value)
|
|
157
|
+
}}
|
|
158
|
+
></ox-data-sample-view>`,
|
|
159
|
+
parent
|
|
160
|
+
)
|
|
161
|
+
</script>
|
|
162
|
+
</body>
|
|
163
|
+
</html>
|
|
@@ -98,52 +98,56 @@
|
|
|
98
98
|
/* set grist-editors */
|
|
99
99
|
import '../dist/src/grist-editor/index.js'
|
|
100
100
|
|
|
101
|
-
import {
|
|
101
|
+
import { OxDataUseCase } from '../dist/src/ox-data-use-case.js'
|
|
102
102
|
|
|
103
|
-
const
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
103
|
+
const ccpUseCase = {
|
|
104
|
+
getSpecification: dataItem => {
|
|
105
|
+
return {
|
|
106
|
+
name: 'ccp',
|
|
107
|
+
description: 'ccp specs',
|
|
108
|
+
specs: [
|
|
109
|
+
{
|
|
110
|
+
type: 'number',
|
|
111
|
+
label: 'critical limits',
|
|
112
|
+
name: 'criticalLimits',
|
|
113
|
+
property: dataItem
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
type: 'string',
|
|
117
|
+
label: 'target limits',
|
|
118
|
+
name: 'targetLimits',
|
|
119
|
+
property: dataItem
|
|
120
|
+
}
|
|
121
|
+
]
|
|
122
|
+
}
|
|
121
123
|
}
|
|
122
124
|
}
|
|
123
125
|
|
|
124
|
-
const
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
126
|
+
const qcUseCase = {
|
|
127
|
+
getSpecification: dataItem => {
|
|
128
|
+
return {
|
|
129
|
+
name: 'qc',
|
|
130
|
+
description: 'qc specs',
|
|
131
|
+
specs: [
|
|
132
|
+
{
|
|
133
|
+
type: 'number',
|
|
134
|
+
label: 'critical limits',
|
|
135
|
+
name: 'criticalLimits',
|
|
136
|
+
property: dataItem
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
type: 'boolean',
|
|
140
|
+
label: 'target limits',
|
|
141
|
+
name: 'targetLimits',
|
|
142
|
+
property: dataItem
|
|
143
|
+
}
|
|
144
|
+
]
|
|
145
|
+
}
|
|
142
146
|
}
|
|
143
147
|
}
|
|
144
148
|
|
|
145
|
-
|
|
146
|
-
|
|
149
|
+
OxDataUseCase.registerUseCase('ccp', ccpUseCase)
|
|
150
|
+
OxDataUseCase.registerUseCase('qc', qcUseCase)
|
|
147
151
|
|
|
148
152
|
const fetchHandler = async ({ page, limit, sorters = [] }) => {
|
|
149
153
|
var total = 10
|
|
@@ -3,12 +3,12 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { __decorate } from "tslib";
|
|
5
5
|
import './ox-popup-data-item-spec.js';
|
|
6
|
-
import { openPopup } from '@operato/layout';
|
|
7
|
-
import { OxGristEditor } from '@operato/data-grist';
|
|
8
|
-
import { cloneDeep } from 'lodash-es';
|
|
9
|
-
import { customElement } from 'lit/decorators.js';
|
|
10
6
|
import { html } from 'lit';
|
|
7
|
+
import { customElement } from 'lit/decorators.js';
|
|
8
|
+
import { cloneDeep } from 'lodash-es';
|
|
9
|
+
import { OxGristEditor } from '@operato/data-grist';
|
|
11
10
|
import { i18next } from '@operato/i18n';
|
|
11
|
+
import { openPopup } from '@operato/layout';
|
|
12
12
|
let OxGristEditorDataItemSpec = class OxGristEditorDataItemSpec extends OxGristEditor {
|
|
13
13
|
get editorTemplate() {
|
|
14
14
|
const value = typeof this.value === 'object' ? JSON.stringify(this.value) : this.value;
|
|
@@ -16,7 +16,7 @@ let OxGristEditorDataItemSpec = class OxGristEditorDataItemSpec extends OxGristE
|
|
|
16
16
|
}
|
|
17
17
|
async firstUpdated() {
|
|
18
18
|
await this.updateComplete;
|
|
19
|
-
this.renderRoot.addEventListener('click', e => {
|
|
19
|
+
this.renderRoot.addEventListener('click', (e) => {
|
|
20
20
|
e.stopPropagation();
|
|
21
21
|
this.openSelector();
|
|
22
22
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ox-grist-editor-data-item-spec.js","sourceRoot":"","sources":["../../../src/grist-editor/ox-grist-editor-data-item-spec.ts"],"names":[],"mappings":"AAAA;;GAEG;;AAEH,OAAO,8BAA8B,CAAA;AAErC,OAAO,
|
|
1
|
+
{"version":3,"file":"ox-grist-editor-data-item-spec.js","sourceRoot":"","sources":["../../../src/grist-editor/ox-grist-editor-data-item-spec.ts"],"names":[],"mappings":"AAAA;;GAEG;;AAEH,OAAO,8BAA8B,CAAA;AAErC,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAC1B,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AACjD,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAA;AAErC,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AACnD,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AACvC,OAAO,EAAE,SAAS,EAAe,MAAM,iBAAiB,CAAA;AAGxD,IAAa,yBAAyB,GAAtC,MAAa,yBAA0B,SAAQ,aAAa;IAG1D,IAAI,cAAc;QAChB,MAAM,KAAK,GAAG,OAAO,IAAI,CAAC,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CA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AI,CAAC,MAAM;oBACnB,MAAM,EAAE,IAAI,CAAC,MAAM;oBACnB,GAAG,EAAE,IAAI,CAAC,GAAG;iBACd;aACF,CAAC,CACH,CAAA;QACH,CAAC,CAAA;QAED,IAAI;YACF,IAAI,KAAK,GACP,CAAC,WAAW,IAAI,OAAO,IAAI,CAAC,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,IAAI,EAAE,CAAC,CAAA;SACxG;QAAC,OAAO,CAAC,EAAE;YACV,IAAI,KAAK,GAAQ,EAAE,CAAA;SACpB;QAED;;;;;;;UAOE;QACF,IAAI,QAAQ,GAAG,IAAI,CAAA;wCACiB,KAAK,cAAc,IAAI,CAAC,MAAM,qBAAqB,eAAe;;KAErG,CAAA;QAED,IAAI,CAAC,KAAK,GAAG,SAAS,CAAC,QAAQ,EAAE;YAC/B,QAAQ,EAAE,IAAI;YACd,IAAI,EAAE,OAAO;YACb,KAAK,EAAE,GAAG,CAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,WAAW,EAAE,KAAI,EAAE,IAAI,OAAO,CAAC,CAAC,CAAC,YAAY,CAAC,EAAE;YAChE,IAAI;SACL,CAAC,CAAA;IACJ,CAAC;CACF,CAAA;AA5EY,yBAAyB;IADrC,aAAa,CAAC,gCAAgC,CAAC;GACnC,yBAAyB,CA4ErC;SA5EY,yBAAyB","sourcesContent":["/**\n * @license Copyright © HatioLab Inc. All rights reserved.\n */\n\nimport './ox-popup-data-item-spec.js'\n\nimport { html } from 'lit'\nimport { customElement } from 'lit/decorators.js'\nimport { cloneDeep } from 'lodash-es'\n\nimport { OxGristEditor } from '@operato/data-grist'\nimport { i18next } from '@operato/i18n'\nimport { openPopup, PopupHandle } from '@operato/layout'\n\n@customElement('ox-grist-editor-data-item-spec')\nexport class OxGristEditorDataItemSpec extends OxGristEditor {\n private popup?: PopupHandle\n\n get editorTemplate() {\n const value = typeof this.value === 'object' ? JSON.stringify(this.value) : this.value\n return html` ${value || ''} `\n }\n\n async firstUpdated() {\n await this.updateComplete\n\n this.renderRoot.addEventListener('click', (e: Event) => {\n e.stopPropagation()\n\n this.openSelector()\n })\n\n this.openSelector()\n }\n\n async openSelector() {\n if (this.popup) {\n delete this.popup\n }\n\n var { options } = this.column.record\n\n if (typeof options === 'function') {\n options = await options.call(this, this.value, this.column, this.record, this.row, this.field)\n }\n\n const { name, help, objectified = false } = options\n\n const confirmCallback = (newval: any) => {\n this.dispatchEvent(\n new CustomEvent('field-change', {\n bubbles: true,\n composed: true,\n detail: {\n before: this.value,\n after: !objectified ? JSON.stringify(newval) : newval,\n record: this.record,\n column: this.column,\n row: this.row\n }\n })\n )\n }\n\n try {\n var value: any =\n !objectified && typeof this.value === 'string' ? JSON.parse(this.value) : cloneDeep(this.value || {})\n } catch (e) {\n var value: any = {}\n }\n\n /* \n 주의 : 이 팝업 템플릿은 layout 모듈에 의해서 render 되므로, \n layout의 구성에 변화가 발생하면, 다시 render된다.\n 이 팝업이 떠 있는 상태에서, 또 다른 팝업이 뜨는 경우도 layout 구성의 변화를 야기한다. (overlay의 갯수의 증가)\n 이 경우 value, options, confirmCallback 등 클로져를 사용한 것들이 초기 바인딩된 값으로 다시 바인딩되게 되는데,\n 만약, 템플릿 내부에서 이들 속성의 레퍼런스가 변화했다면, 원래 상태로 되돌아가는 현상이 발생하게 된다.\n 따라서, 가급적 이들 속성의 레퍼런스를 변화시키지 않는 것이 좋다.\n */\n var template = html`\n <ox-popup-data-item-spec .value=${value} .dataItem=${this.record} .confirmCallback=${confirmCallback}>\n </ox-popup-data-item-spec>\n `\n\n this.popup = openPopup(template, {\n backdrop: true,\n size: 'large',\n title: `${name?.toUpperCase() || ''} ${i18next.t('field.spec')}`,\n help\n })\n }\n}\n"]}
|
package/dist/src/index.d.ts
CHANGED
package/dist/src/index.js
CHANGED
package/dist/src/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAA;AACvC,cAAc,wBAAwB,CAAA;AACtC,cAAc,YAAY,CAAA","sourcesContent":["export * from './ox-data-entry-form.js'\nexport * from './ox-data-item-spec.js'\nexport * from './types.js'\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAA;AACvC,cAAc,0BAA0B,CAAA;AACxC,cAAc,wBAAwB,CAAA;AACtC,cAAc,oBAAoB,CAAA;AAClC,cAAc,YAAY,CAAA","sourcesContent":["export * from './ox-data-entry-form.js'\nexport * from './ox-data-sample-view.js'\nexport * from './ox-data-item-spec.js'\nexport * from './ox-data-use-case'\nexport * from './types.js'\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { __decorate } from "tslib";
|
|
2
2
|
import '@operato/input/ox-input-file.js';
|
|
3
|
-
import {
|
|
3
|
+
import { css, html, LitElement } from 'lit';
|
|
4
4
|
import { customElement, property } from 'lit/decorators.js';
|
|
5
5
|
let OxDataEntryForm = class OxDataEntryForm extends LitElement {
|
|
6
6
|
render() {
|
|
@@ -21,7 +21,7 @@ let OxDataEntryForm = class OxDataEntryForm extends LitElement {
|
|
|
21
21
|
const samples = new Array(quota).fill(0);
|
|
22
22
|
const value = this.value && this.value[tag];
|
|
23
23
|
const elements = samples.map((_, idx) => {
|
|
24
|
-
const v =
|
|
24
|
+
const v = value instanceof Array ? value[idx] : idx === 0 ? value : undefined;
|
|
25
25
|
switch (type) {
|
|
26
26
|
case 'select':
|
|
27
27
|
return html ` <select .name=${tag}>
|
|
@@ -57,15 +57,10 @@ let OxDataEntryForm = class OxDataEntryForm extends LitElement {
|
|
|
57
57
|
buildValue() {
|
|
58
58
|
const dataItems = this.dataSet.dataItems;
|
|
59
59
|
return (dataItems || []).reduce((sum, dataItem) => {
|
|
60
|
-
const { tag,
|
|
60
|
+
const { tag, type } = dataItem;
|
|
61
61
|
const editors = Array.prototype.slice.call(this.renderRoot.querySelectorAll(`[name=${tag}]`));
|
|
62
62
|
if (editors.length > 0) {
|
|
63
|
-
sum[tag] =
|
|
64
|
-
editors.length > 1
|
|
65
|
-
? editors.map(editor => (type === 'boolean' ? editor.checked : editor.value))
|
|
66
|
-
: type === 'boolean'
|
|
67
|
-
? editors[0].checked
|
|
68
|
-
: editors[0].value;
|
|
63
|
+
sum[tag] = editors.map(editor => (type === 'boolean' ? editor.checked : editor.value));
|
|
69
64
|
}
|
|
70
65
|
return sum;
|
|
71
66
|
}, {});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ox-data-entry-form.js","sourceRoot":"","sources":["../../src/ox-data-entry-form.ts"],"names":[],"mappings":";AAAA,OAAO,iCAAiC,CAAA;AAExC,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"ox-data-entry-form.js","sourceRoot":"","sources":["../../src/ox-data-entry-form.ts"],"names":[],"mappings":";AAAA,OAAO,iCAAiC,CAAA;AAExC,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,KAAK,CAAA;AAC3C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAK3D,IAAa,eAAe,GAA5B,MAAa,eAAgB,SAAQ,UAAU;IA+D7C,MAAM;QACJ,OAAO,IAAI,CAAA,iBAAiB,CAAC,CAAQ,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,WAAW,EAAE,SAAS,CAAA;IAC3F,CAAC;IAEO,QAAQ,CAAC,CAAQ;QACvB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,UAAU,EAAE,CAAA;QAE9B,IAAI,CAAC,aAAa,CAChB,IAAI,WAAW,CAAC,QAAQ,EAAE;YACxB,OAAO,EAAE,IAAI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ACZ,CAAC,EAAE,EAA4B,CAAC,CAAA;IAClC,CAAC;CACF,CAAA;AAnJQ,sBAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyDlB,CAAA;AAE2B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;gDAAkB;AACjB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;8CAA+B;AA7D/C,eAAe;IAD3B,aAAa,CAAC,oBAAoB,CAAC;GACvB,eAAe,CAoJ3B;SApJY,eAAe","sourcesContent":["import '@operato/input/ox-input-file.js'\n\nimport { css, html, LitElement } from 'lit'\nimport { customElement, property } from 'lit/decorators.js'\n\nimport { DataSet } from './types.js'\n\n@customElement('ox-data-entry-form')\nexport class OxDataEntryForm extends LitElement {\n static styles = css`\n :host {\n display: flex;\n flex-direction: row;\n }\n\n form {\n flex: 1;\n\n display: flex;\n flex-direction: column;\n }\n label {\n display: grid;\n grid-template-columns: repeat(12, 1fr);\n gap: 9px;\n align-items: center;\n margin-bottom: var(--margin-default);\n }\n label:nth-child(even) {\n background-color: var(--main-section-background-color);\n padding: var(--padding-default) 0;\n }\n\n div[name] {\n grid-column: span 2 / auto;\n font: var(--label-font);\n color: var(--label-color);\n text-align: right;\n }\n div[elements] {\n grid-column: span 10 / auto;\n display: flex;\n flex-direction: row;\n flex-wrap: wrap;\n gap: 10px;\n padding-right: var(--padding-default);\n }\n div[elements] * {\n flex: 1;\n }\n div[elements] input,\n div[elements] select {\n border: var(--input-field-border);\n border-radius: var(--input-field-border-radius);\n padding: var(--input-field-padding);\n font: var(--input-field-font);\n }\n\n @media only screen and (max-width: 460px) {\n div[name] {\n grid-column: span 3 / auto;\n }\n div[elements] {\n grid-column: span 9 / auto;\n }\n }\n `\n\n @property({ type: Object }) dataSet?: DataSet\n @property({ type: Object }) value?: { [tag: string]: any }\n\n render() {\n return html`<form @change=${(e: Event) => this.onChange(e)}>${this.buildInputs()}</form>`\n }\n\n private onChange(e: Event) {\n this.value = this.buildValue()\n\n this.dispatchEvent(\n new CustomEvent('change', {\n bubbles: true,\n composed: true,\n detail: this.value\n })\n )\n }\n\n private buildInputs() {\n const dataItems = this.dataSet!.dataItems.filter(item => item.active)\n\n return (dataItems || []).map(dataItem => {\n const { name, description, tag, type, quota = 1, options = {}, unit } = dataItem\n\n const samples = new Array(quota).fill(0)\n const value = this.value && this.value[tag]\n\n const elements = samples.map((_, idx) => {\n const v = value instanceof Array ? value[idx] : idx === 0 ? value : undefined\n\n switch (type) {\n case 'select':\n return html` <select .name=${tag}>\n <option value=\"\"></option>\n ${(options.options || []).map(\n option => html`<option value=${option.value} ?selected=${option.value === v}>${option.text}</option>`\n )}\n </select>`\n break\n\n case 'boolean':\n return html` <input type=\"checkbox\" name=${tag} .checked=${v} />`\n break\n\n case 'number':\n return html` <input type=\"number\" name=${tag} value=${v} />`\n break\n\n case 'file':\n return html`<ox-input-file\n name=${tag}\n label=\"Attach Files\"\n accept=\"*/*\"\n multiple=\"true\"\n hide-filelist\n ></ox-input-file>`\n\n case 'string':\n default:\n return html` <input type=\"string\" name=${tag} value=${v} />`\n }\n })\n\n return html` <label .title=${description}>\n <div name>${name}${unit ? `(${unit})` : ''}</div>\n <div elements>${elements}</div>\n </label>`\n })\n }\n\n private buildValue() {\n const dataItems = this.dataSet!.dataItems\n\n return (dataItems || []).reduce((sum, dataItem) => {\n const { tag, type } = dataItem\n\n const editors = Array.prototype.slice.call(\n this.renderRoot.querySelectorAll(`[name=${tag}]`) as NodeListOf<HTMLInputElement>\n ) as HTMLInputElement[]\n\n if (editors.length > 0) {\n sum[tag] = editors.map(editor => (type === 'boolean' ? editor.checked : editor.value))\n }\n\n return sum\n }, {} as { [tag: string]: any })\n }\n}\n"]}
|
|
@@ -1,13 +1,7 @@
|
|
|
1
1
|
import '@operato/property-editor/ox-properties-dynamic-view.js';
|
|
2
|
-
import { DataItem, DataItemSpecSet, DataItemSpecSetProvider } from './types.js';
|
|
3
2
|
import { LitElement, PropertyValues } from 'lit';
|
|
3
|
+
import { DataItem, DataItemSpecSet } from './types.js';
|
|
4
4
|
export declare class OxDataItemSpec extends LitElement {
|
|
5
|
-
static registry: {
|
|
6
|
-
[name: string]: DataItemSpecSetProvider;
|
|
7
|
-
};
|
|
8
|
-
static registerProvider(name: string, provider: DataItemSpecSetProvider): void;
|
|
9
|
-
static getProviderNames(): string[];
|
|
10
|
-
static getProvider(name: string): DataItemSpecSetProvider | undefined;
|
|
11
5
|
static styles: import("lit").CSSResult;
|
|
12
6
|
value?: {
|
|
13
7
|
[specSetName: string]: any;
|
|
@@ -1,22 +1,13 @@
|
|
|
1
|
-
var OxDataItemSpec_1;
|
|
2
1
|
import { __decorate } from "tslib";
|
|
3
2
|
import '@operato/property-editor/ox-properties-dynamic-view.js';
|
|
4
|
-
import {
|
|
3
|
+
import { css, html, LitElement } from 'lit';
|
|
5
4
|
import { customElement, property, queryAll, state } from 'lit/decorators.js';
|
|
6
|
-
|
|
5
|
+
import { OxDataUseCase } from './ox-data-use-case.js';
|
|
6
|
+
let OxDataItemSpec = class OxDataItemSpec extends LitElement {
|
|
7
7
|
constructor() {
|
|
8
8
|
super(...arguments);
|
|
9
9
|
this.dataItemSpecSets = [];
|
|
10
10
|
}
|
|
11
|
-
static registerProvider(name, provider) {
|
|
12
|
-
OxDataItemSpec_1.registry[name] = provider;
|
|
13
|
-
}
|
|
14
|
-
static getProviderNames() {
|
|
15
|
-
return Object.keys(OxDataItemSpec_1.registry);
|
|
16
|
-
}
|
|
17
|
-
static getProvider(name) {
|
|
18
|
-
return OxDataItemSpec_1.registry[name];
|
|
19
|
-
}
|
|
20
11
|
render() {
|
|
21
12
|
return html `<form @property-change=${(e) => this.onChange(e)}>
|
|
22
13
|
${this.dataItemSpecSets.map(({ name, description, specs }) => {
|
|
@@ -30,7 +21,7 @@ let OxDataItemSpec = OxDataItemSpec_1 = class OxDataItemSpec extends LitElement
|
|
|
30
21
|
}
|
|
31
22
|
updated(changes) {
|
|
32
23
|
if (changes.has('dataItem')) {
|
|
33
|
-
this.dataItemSpecSets =
|
|
24
|
+
this.dataItemSpecSets = OxDataUseCase.getUseCases().map(useCase => useCase.getSpecification(this.dataItem));
|
|
34
25
|
}
|
|
35
26
|
}
|
|
36
27
|
onChange(e) {
|
|
@@ -47,7 +38,6 @@ let OxDataItemSpec = OxDataItemSpec_1 = class OxDataItemSpec extends LitElement
|
|
|
47
38
|
return value;
|
|
48
39
|
}
|
|
49
40
|
};
|
|
50
|
-
OxDataItemSpec.registry = {};
|
|
51
41
|
OxDataItemSpec.styles = css `
|
|
52
42
|
:host {
|
|
53
43
|
display: flex;
|
|
@@ -80,7 +70,7 @@ __decorate([
|
|
|
80
70
|
__decorate([
|
|
81
71
|
queryAll('ox-properties-dynamic-view')
|
|
82
72
|
], OxDataItemSpec.prototype, "specSetViews", void 0);
|
|
83
|
-
OxDataItemSpec =
|
|
73
|
+
OxDataItemSpec = __decorate([
|
|
84
74
|
customElement('ox-data-item-spec')
|
|
85
75
|
], OxDataItemSpec);
|
|
86
76
|
export { OxDataItemSpec };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ox-data-item-spec.js","sourceRoot":"","sources":["../../src/ox-data-item-spec.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ox-data-item-spec.js","sourceRoot":"","sources":["../../src/ox-data-item-spec.ts"],"names":[],"mappings":";AAAA,OAAO,wDAAwD,CAAA;AAE/D,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAkB,MAAM,KAAK,CAAA;AAC3D,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAE5E,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAA;AAIrD,IAAa,cAAc,GAA3B,MAAa,cAAe,SAAQ,UAAU;IAA9C;;QA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AAC;CACF,CAAA;AA/DQ,qBAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;GAmBlB,CAAA;AAE2B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;6CAAuC;AACtC;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;gDAAoB;AAEtC;IAAR,KAAK,EAAE;wDAAyC;AAET;IAAvC,QAAQ,CAAC,4BAA4B,CAAC;oDAAwD;AA3BpF,cAAc;IAD1B,aAAa,CAAC,mBAAmB,CAAC;GACtB,cAAc,CAgE1B;SAhEY,cAAc","sourcesContent":["import '@operato/property-editor/ox-properties-dynamic-view.js'\n\nimport { css, html, LitElement, PropertyValues } from 'lit'\nimport { customElement, property, queryAll, state } from 'lit/decorators.js'\n\nimport { OxDataUseCase } from './ox-data-use-case.js'\nimport { DataItem, DataItemSpecSet } from './types.js'\n\n@customElement('ox-data-item-spec')\nexport class OxDataItemSpec extends LitElement {\n static styles = css`\n :host {\n display: flex;\n flex-direction: row;\n border-bottom: var(--border-dark-color);\n padding: var(--margin-default) 0;\n }\n [specName] {\n font: var(--legend-font);\n color: var(--legend-text-color);\n }\n [description] {\n font: var(--form-sublabel-font);\n opacity: 0.8;\n }\n\n form {\n flex: 1;\n }\n `\n\n @property({ type: Object }) value?: { [specSetName: string]: any }\n @property({ type: Object }) dataItem?: DataItem\n\n @state() dataItemSpecSets: DataItemSpecSet[] = []\n\n @queryAll('ox-properties-dynamic-view') specSetViews!: NodeListOf<HTMLElement & { value: any }>\n\n render() {\n return html`<form @property-change=${(e: Event) => this.onChange(e)}>\n ${this.dataItemSpecSets.map(\n ({ name, description, specs }) => html` <div specName>${name}</div>\n <div description>${description}</div>\n <ox-properties-dynamic-view data-name=${name} .props=${specs} .value=${this.value?.[name]}>\n </ox-properties-dynamic-view>`\n )}\n </form>`\n }\n\n updated(changes: PropertyValues<this>) {\n if (changes.has('dataItem')) {\n this.dataItemSpecSets = OxDataUseCase.getUseCases().map(useCase => useCase.getSpecification(this.dataItem!))\n }\n }\n\n private onChange(e: Event) {\n this.value = this.buildValue()\n\n this.dispatchEvent(\n new CustomEvent('change', {\n bubbles: true,\n composed: true,\n detail: { ...this.value }\n })\n )\n }\n\n private buildValue() {\n var value = {} as any\n this.specSetViews.forEach(view => (value[view.getAttribute('data-name')!] = view.value))\n\n return value\n }\n}\n"]}
|