@operato/dataset 1.0.0-beta.7 → 1.0.0
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 +379 -0
- package/dist/src/grist-editor/ox-grist-editor-data-item-spec.js +1 -1
- package/dist/src/grist-editor/ox-grist-editor-data-item-spec.js.map +1 -1
- package/dist/src/grist-editor/ox-popup-data-item-spec.js +6 -4
- package/dist/src/grist-editor/ox-popup-data-item-spec.js.map +1 -1
- package/dist/src/index.d.ts +1 -5
- package/dist/src/index.js +1 -5
- package/dist/src/index.js.map +1 -1
- package/dist/src/ox-data-entry-form.js +24 -4
- package/dist/src/ox-data-entry-form.js.map +1 -1
- package/dist/src/ox-data-item-spec.d.ts +2 -2
- package/dist/src/ox-data-item-spec.js +71 -14
- package/dist/src/ox-data-item-spec.js.map +1 -1
- package/dist/src/ox-data-ooc-view.js +73 -14
- package/dist/src/ox-data-ooc-view.js.map +1 -1
- package/dist/src/ox-data-sample-view.d.ts +1 -3
- package/dist/src/ox-data-sample-view.js +40 -38
- package/dist/src/ox-data-sample-view.js.map +1 -1
- package/dist/src/types.d.ts +25 -6
- package/dist/src/types.js.map +1 -1
- package/dist/src/usecase/ccp/index.d.ts +1 -0
- package/dist/src/usecase/ccp/index.js +8 -0
- package/dist/src/usecase/ccp/index.js.map +1 -0
- package/dist/src/usecase/ccp/ox-data-use-case-ccp.d.ts +7 -0
- package/dist/src/usecase/ccp/ox-data-use-case-ccp.js +102 -0
- package/dist/src/usecase/ccp/ox-data-use-case-ccp.js.map +1 -0
- package/dist/src/usecase/ccp/ox-input-ccp-limits.d.ts +44 -0
- package/dist/src/usecase/ccp/ox-input-ccp-limits.js +171 -0
- package/dist/src/usecase/ccp/ox-input-ccp-limits.js.map +1 -0
- package/dist/src/usecase/ccp/ox-property-editor-ccp-limits.d.ts +5 -0
- package/dist/src/usecase/ccp/ox-property-editor-ccp-limits.js +24 -0
- package/dist/src/usecase/ccp/ox-property-editor-ccp-limits.js.map +1 -0
- package/dist/src/{ox-data-use-case.d.ts → usecase/ox-data-use-case.d.ts} +5 -5
- package/dist/src/{ox-data-use-case.js → usecase/ox-data-use-case.js} +22 -34
- package/dist/src/usecase/ox-data-use-case.js.map +1 -0
- package/dist/src/usecase/qc/index.d.ts +1 -0
- package/dist/src/usecase/qc/index.js +8 -0
- package/dist/src/usecase/qc/index.js.map +1 -0
- package/dist/src/usecase/qc/ox-data-use-case-qc.d.ts +7 -0
- package/dist/src/usecase/qc/ox-data-use-case-qc.js +55 -0
- package/dist/src/usecase/qc/ox-data-use-case-qc.js.map +1 -0
- package/dist/src/usecase/qc/ox-input-qc-limits.d.ts +44 -0
- package/dist/src/usecase/qc/ox-input-qc-limits.js +171 -0
- package/dist/src/usecase/qc/ox-input-qc-limits.js.map +1 -0
- package/dist/src/usecase/qc/ox-property-editor-qc-limits.d.ts +5 -0
- package/dist/src/usecase/qc/ox-property-editor-qc-limits.js +24 -0
- package/dist/src/usecase/qc/ox-property-editor-qc-limits.js.map +1 -0
- package/dist/stories/ox-data-entry-form.stories.d.ts +19 -0
- package/dist/stories/ox-data-entry-form.stories.js +152 -0
- package/dist/stories/ox-data-entry-form.stories.js.map +1 -0
- package/dist/stories/ox-data-item-spec.stories.d.ts +26 -0
- package/dist/stories/ox-data-item-spec.stories.js +102 -0
- package/dist/stories/ox-data-item-spec.stories.js.map +1 -0
- package/dist/stories/ox-data-ooc-view.stories.d.ts +19 -0
- package/dist/stories/ox-data-ooc-view.stories.js +242 -0
- package/dist/stories/ox-data-ooc-view.stories.js.map +1 -0
- package/dist/stories/ox-data-sample-view.stories.d.ts +19 -0
- package/dist/stories/ox-data-sample-view.stories.js +213 -0
- package/dist/stories/ox-data-sample-view.stories.js.map +1 -0
- package/dist/stories/ox-grist-editor-data-item-spec.stories.d.ts +27 -0
- package/dist/stories/ox-grist-editor-data-item-spec.stories.js +389 -0
- package/dist/stories/ox-grist-editor-data-item-spec.stories.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +24 -18
- package/src/grist-editor/ox-grist-editor-data-item-spec.ts +1 -1
- package/src/grist-editor/ox-popup-data-item-spec.ts +8 -5
- package/src/index.ts +1 -5
- package/src/ox-data-entry-form.ts +24 -4
- package/src/ox-data-item-spec.ts +73 -16
- package/src/ox-data-ooc-view.ts +73 -14
- package/src/ox-data-sample-view.ts +43 -39
- package/src/types.ts +31 -6
- package/src/usecase/ccp/index.ts +10 -0
- package/src/usecase/ccp/ox-data-use-case-ccp.ts +147 -0
- package/src/usecase/ccp/ox-input-ccp-limits.ts +161 -0
- package/src/usecase/ccp/ox-property-editor-ccp-limits.ts +23 -0
- package/src/{ox-data-use-case.ts → usecase/ox-data-use-case.ts} +27 -41
- package/src/usecase/qc/index.ts +10 -0
- package/src/usecase/qc/ox-data-use-case-qc.ts +72 -0
- package/src/usecase/qc/ox-input-qc-limits.ts +161 -0
- package/src/usecase/qc/ox-property-editor-qc-limits.ts +23 -0
- package/stories/ox-data-entry-form.stories.ts +165 -0
- package/stories/ox-data-item-spec.stories.ts +121 -0
- package/stories/ox-data-ooc-view.stories.ts +256 -0
- package/stories/ox-data-sample-view.stories.ts +227 -0
- package/stories/ox-grist-editor-data-item-spec.stories.ts +409 -0
- package/translations/en.json +26 -8
- package/translations/ko.json +25 -7
- package/translations/ms.json +26 -8
- package/translations/zh.json +25 -7
- package/demo/index.html +0 -28
- package/demo/ox-data-entry-form.html +0 -118
- package/demo/ox-data-item-spec.html +0 -152
- package/demo/ox-data-ooc-view.html +0 -185
- package/demo/ox-data-sample-view.html +0 -150
- package/demo/ox-grist-editor-data-item-spec.html +0 -476
- package/dist/src/ox-data-sample-view copy.d.ts +0 -13
- package/dist/src/ox-data-sample-view copy.js +0 -214
- package/dist/src/ox-data-sample-view copy.js.map +0 -1
- package/dist/src/ox-data-use-case.js.map +0 -1
package/package.json
CHANGED
|
@@ -3,18 +3,23 @@
|
|
|
3
3
|
"description": "WebApplication dataset supporting components following open-wc recommendations",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": "heartyoh",
|
|
6
|
-
"version": "1.0.0
|
|
6
|
+
"version": "1.0.0",
|
|
7
7
|
"main": "dist/src/index.js",
|
|
8
8
|
"module": "dist/src/index.js",
|
|
9
9
|
"exports": {
|
|
10
10
|
".": "./dist/src/index.js",
|
|
11
|
+
"./usecase/ccp": "./dist/src/usecase/ccp/index.js",
|
|
12
|
+
"./usecase/qc": "./dist/src/usecase/qc/index.js",
|
|
11
13
|
"./grist-editor": "./dist/src/grist-editor/index.js",
|
|
12
14
|
"./grist-editor/ox-grist-editor-data-item-spec.js": "./dist/src/grist-editor/ox-grist-editor-data-item-spec.js",
|
|
13
15
|
"./ox-data-entry-form.js": "./dist/src/ox-data-entry-form.js",
|
|
14
16
|
"./ox-data-item-spec.js": "./dist/src/ox-data-item-spec.js",
|
|
15
17
|
"./ox-data-ooc-view.js": "./dist/src/ox-data-ooc-view.js",
|
|
16
18
|
"./ox-data-sample-view.js": "./dist/src/ox-data-sample-view.js",
|
|
17
|
-
"./ox-
|
|
19
|
+
"./ox-input-ccp-limits.js": "./dist/src/usecase/ccp/ox-input-ccp-limits.js",
|
|
20
|
+
"./ox-property-editor-ccp-limits.js": "./dist/src/usecase/ccp/ox-property-editor-ccp-limits.js",
|
|
21
|
+
"./ox-input-qc-limits.js": "./dist/src/usecase/qc/ox-input-qc-limits.js",
|
|
22
|
+
"./ox-property-editor-qc-limits.js": "./dist/src/usecase/qc/ox-property-editor-qc-limits.js",
|
|
18
23
|
"./types.js": "./dist/src/types.js"
|
|
19
24
|
},
|
|
20
25
|
"publishConfig": {
|
|
@@ -39,19 +44,20 @@
|
|
|
39
44
|
"storybook:build": "tsc && npm run analyze -- --exclude dist && build-storybook"
|
|
40
45
|
},
|
|
41
46
|
"dependencies": {
|
|
42
|
-
"@material/mwc-button": "^0.
|
|
43
|
-
"@material/mwc-icon": "^0.
|
|
44
|
-
"@material/mwc-icon-button": "^0.
|
|
45
|
-
"@operato/data-grist": "^1.0.0
|
|
46
|
-
"@operato/graphql": "^1.0.0
|
|
47
|
-
"@operato/
|
|
48
|
-
"@operato/
|
|
49
|
-
"@operato/
|
|
50
|
-
"@operato/
|
|
51
|
-
"@operato/
|
|
52
|
-
"@operato/
|
|
53
|
-
"@operato/
|
|
54
|
-
"
|
|
47
|
+
"@material/mwc-button": "^0.26.1",
|
|
48
|
+
"@material/mwc-icon": "^0.26.1",
|
|
49
|
+
"@material/mwc-icon-button": "^0.26.1",
|
|
50
|
+
"@operato/data-grist": "^1.0.0",
|
|
51
|
+
"@operato/graphql": "^1.0.0",
|
|
52
|
+
"@operato/grist-editor": "^1.0.0",
|
|
53
|
+
"@operato/i18n": "^1.0.0",
|
|
54
|
+
"@operato/input": "^1.0.0",
|
|
55
|
+
"@operato/popup": "^1.0.0",
|
|
56
|
+
"@operato/property-editor": "^1.0.0",
|
|
57
|
+
"@operato/shell": "^1.0.0",
|
|
58
|
+
"@operato/styles": "^1.0.0",
|
|
59
|
+
"@operato/utils": "^1.0.0",
|
|
60
|
+
"lit": "^2.2.7"
|
|
55
61
|
},
|
|
56
62
|
"devDependencies": {
|
|
57
63
|
"@custom-elements-manifest/analyzer": "^0.4.17",
|
|
@@ -61,12 +67,12 @@
|
|
|
61
67
|
"@typescript-eslint/eslint-plugin": "^4.33.0",
|
|
62
68
|
"@typescript-eslint/parser": "^4.33.0",
|
|
63
69
|
"@web/dev-server": "^0.1.29",
|
|
64
|
-
"@web/dev-server-storybook": "
|
|
70
|
+
"@web/dev-server-storybook": "^0.5.0",
|
|
65
71
|
"@web/test-runner": "next",
|
|
66
72
|
"concurrently": "^5.3.0",
|
|
67
73
|
"eslint": "^7.32.0",
|
|
68
74
|
"eslint-config-prettier": "^8.3.0",
|
|
69
|
-
"husky": "^
|
|
75
|
+
"husky": "^7.0.2",
|
|
70
76
|
"lint-staged": "^10.5.4",
|
|
71
77
|
"prettier": "^2.4.1",
|
|
72
78
|
"tslib": "^2.3.1",
|
|
@@ -85,5 +91,5 @@
|
|
|
85
91
|
"prettier --write"
|
|
86
92
|
]
|
|
87
93
|
},
|
|
88
|
-
"gitHead": "
|
|
94
|
+
"gitHead": "c383e4b11cb4195f32be9b0daa4342dda0bbb2ab"
|
|
89
95
|
}
|
|
@@ -10,7 +10,7 @@ import { cloneDeep } from 'lodash-es'
|
|
|
10
10
|
|
|
11
11
|
import { OxGristEditor } from '@operato/data-grist'
|
|
12
12
|
import { i18next } from '@operato/i18n'
|
|
13
|
-
import { openPopup, PopupHandle } from '@operato/
|
|
13
|
+
import { openPopup, PopupHandle } from '@operato/popup'
|
|
14
14
|
|
|
15
15
|
@customElement('ox-grist-editor-data-item-spec')
|
|
16
16
|
export class OxGristEditorDataItemSpec extends OxGristEditor {
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import '../ox-data-item-spec.js'
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { css, html, LitElement } from 'lit'
|
|
4
4
|
import { customElement, property } from 'lit/decorators.js'
|
|
5
5
|
|
|
6
|
-
import { DataItem } from '../types.js'
|
|
7
|
-
import { ScrollbarStyles } from '@operato/styles'
|
|
8
6
|
import { i18next } from '@operato/i18n'
|
|
7
|
+
import { closePopup } from '@operato/popup'
|
|
8
|
+
import { ScrollbarStyles } from '@operato/styles'
|
|
9
|
+
|
|
10
|
+
import { DataItem } from '../types.js'
|
|
9
11
|
|
|
10
12
|
@customElement('ox-popup-data-item-spec')
|
|
11
13
|
export class OxPopupDataItemSpec extends LitElement {
|
|
@@ -25,6 +27,7 @@ export class OxPopupDataItemSpec extends LitElement {
|
|
|
25
27
|
ox-data-item-spec {
|
|
26
28
|
flex: 1;
|
|
27
29
|
overflow-y: auto;
|
|
30
|
+
padding: var(--padding-wide);
|
|
28
31
|
}
|
|
29
32
|
|
|
30
33
|
span {
|
|
@@ -80,11 +83,11 @@ export class OxPopupDataItemSpec extends LitElement {
|
|
|
80
83
|
}
|
|
81
84
|
|
|
82
85
|
private onCancel(e: Event) {
|
|
83
|
-
|
|
86
|
+
closePopup(this)
|
|
84
87
|
}
|
|
85
88
|
|
|
86
89
|
private onConfirm(e: Event) {
|
|
87
90
|
this.confirmCallback && this.confirmCallback(this.value)
|
|
88
|
-
|
|
91
|
+
closePopup(this)
|
|
89
92
|
}
|
|
90
93
|
}
|
package/src/index.ts
CHANGED
|
@@ -1,6 +1,2 @@
|
|
|
1
|
-
export * from './ox-data-entry-form.js'
|
|
2
|
-
export * from './ox-data-sample-view.js'
|
|
3
|
-
export * from './ox-data-ooc-view.js'
|
|
4
|
-
export * from './ox-data-item-spec.js'
|
|
5
|
-
export * from './ox-data-use-case'
|
|
6
1
|
export * from './types.js'
|
|
2
|
+
export * from './usecase/ox-data-use-case.js'
|
|
@@ -11,10 +11,22 @@ export class OxDataEntryForm extends LitElement {
|
|
|
11
11
|
:host {
|
|
12
12
|
display: flex;
|
|
13
13
|
flex-direction: row;
|
|
14
|
+
--item-description-font: normal 0.8rem/1rem var(--theme-font);
|
|
15
|
+
--item-description-color: var(--page-description-color);
|
|
14
16
|
}
|
|
15
17
|
|
|
16
|
-
h2
|
|
18
|
+
h2 {
|
|
19
|
+
margin: var(--title-margin);
|
|
20
|
+
font: var(--title-font);
|
|
21
|
+
color: var(--title-text-color);
|
|
22
|
+
text-transform: capitalize;
|
|
23
|
+
text-align: center;
|
|
24
|
+
}
|
|
17
25
|
h3 {
|
|
26
|
+
margin: var(--page-description-margin);
|
|
27
|
+
font: var(--page-description-font);
|
|
28
|
+
color: var(--page-description-color);
|
|
29
|
+
text-transform: capitalize;
|
|
18
30
|
text-align: center;
|
|
19
31
|
}
|
|
20
32
|
|
|
@@ -48,10 +60,18 @@ export class OxDataEntryForm extends LitElement {
|
|
|
48
60
|
}
|
|
49
61
|
div[description] {
|
|
50
62
|
grid-area: description;
|
|
51
|
-
|
|
52
|
-
|
|
63
|
+
opacity: 0.7;
|
|
64
|
+
font: var(--item-description-font);
|
|
65
|
+
color: var(--item-description-color);
|
|
53
66
|
text-align: left;
|
|
54
67
|
}
|
|
68
|
+
div[description] * {
|
|
69
|
+
vertical-align: middle;
|
|
70
|
+
}
|
|
71
|
+
div[description] mwc-icon {
|
|
72
|
+
margin-top: -3px;
|
|
73
|
+
font-size: 0.9rem;
|
|
74
|
+
}
|
|
55
75
|
div[elements] {
|
|
56
76
|
grid-area: inputs;
|
|
57
77
|
display: flex;
|
|
@@ -160,7 +180,7 @@ export class OxDataEntryForm extends LitElement {
|
|
|
160
180
|
|
|
161
181
|
return html` <label .title=${description}>
|
|
162
182
|
<div name>${name}${unit ? `(${unit})` : ''}</div>
|
|
163
|
-
<div description
|
|
183
|
+
<div description><mwc-icon>info_outline</mwc-icon> ${description}</div>
|
|
164
184
|
<div elements>${elements}</div>
|
|
165
185
|
</label>`
|
|
166
186
|
})
|
package/src/ox-data-item-spec.ts
CHANGED
|
@@ -3,8 +3,8 @@ import '@operato/property-editor/ox-properties-dynamic-view.js'
|
|
|
3
3
|
import { css, html, LitElement, PropertyValues } from 'lit'
|
|
4
4
|
import { customElement, property, queryAll, state } from 'lit/decorators.js'
|
|
5
5
|
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
6
|
+
import { DataItem, UseCaseDefinition } from './types.js'
|
|
7
|
+
import { OxDataUseCase } from './usecase/ox-data-use-case.js'
|
|
8
8
|
|
|
9
9
|
@customElement('ox-data-item-spec')
|
|
10
10
|
export class OxDataItemSpec extends LitElement {
|
|
@@ -12,37 +12,94 @@ export class OxDataItemSpec extends LitElement {
|
|
|
12
12
|
:host {
|
|
13
13
|
display: flex;
|
|
14
14
|
flex-direction: row;
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}
|
|
18
|
-
[specName] {
|
|
19
|
-
font: var(--legend-font);
|
|
20
|
-
color: var(--legend-text-color);
|
|
21
|
-
}
|
|
22
|
-
[description] {
|
|
23
|
-
font: var(--form-sublabel-font);
|
|
24
|
-
opacity: 0.8;
|
|
15
|
+
--item-description-font: normal 0.8rem/1rem var(--theme-font);
|
|
16
|
+
--item-description-color: var(--page-description-color);
|
|
25
17
|
}
|
|
26
18
|
|
|
27
19
|
form {
|
|
28
20
|
flex: 1;
|
|
21
|
+
display: flex;
|
|
22
|
+
flex-direction: column;
|
|
23
|
+
}
|
|
24
|
+
label {
|
|
25
|
+
display: grid;
|
|
26
|
+
|
|
27
|
+
grid-template-rows: auto 1fr;
|
|
28
|
+
grid-template-columns: 1fr 5fr;
|
|
29
|
+
grid-template-areas: 'name description' 'empty inputs';
|
|
30
|
+
|
|
31
|
+
grid-gap: 9px;
|
|
32
|
+
align-items: center;
|
|
33
|
+
margin-bottom: var(--margin-default);
|
|
34
|
+
}
|
|
35
|
+
label:nth-child(odd) {
|
|
36
|
+
background-color: var(--main-section-background-color);
|
|
37
|
+
padding: var(--padding-default) 0;
|
|
38
|
+
}
|
|
39
|
+
div[name] {
|
|
40
|
+
grid-area: name;
|
|
41
|
+
font: var(--label-font);
|
|
42
|
+
color: var(--label-color);
|
|
43
|
+
text-align: right;
|
|
44
|
+
}
|
|
45
|
+
div[description] {
|
|
46
|
+
grid-area: description;
|
|
47
|
+
opacity: 0.7;
|
|
48
|
+
font: var(--item-description-font);
|
|
49
|
+
color: var(--item-description-color);
|
|
50
|
+
text-align: left;
|
|
51
|
+
}
|
|
52
|
+
div[description] * {
|
|
53
|
+
vertical-align: middle;
|
|
54
|
+
}
|
|
55
|
+
div[description] mwc-icon {
|
|
56
|
+
margin-top: -3px;
|
|
57
|
+
font-size: 0.9rem;
|
|
58
|
+
}
|
|
59
|
+
ox-properties-dynamic-view {
|
|
60
|
+
grid-area: inputs;
|
|
61
|
+
display: flex;
|
|
62
|
+
flex-direction: row;
|
|
63
|
+
flex-wrap: wrap;
|
|
64
|
+
gap: 10px;
|
|
65
|
+
padding-right: var(--padding-default);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
@media only screen and (max-width: 460px) {
|
|
69
|
+
label {
|
|
70
|
+
display: grid;
|
|
71
|
+
|
|
72
|
+
grid-template-rows: auto auto 1fr;
|
|
73
|
+
grid-template-columns: 1fr;
|
|
74
|
+
grid-template-areas: 'name' 'description' 'inputs';
|
|
75
|
+
|
|
76
|
+
grid-gap: 9px;
|
|
77
|
+
align-items: center;
|
|
78
|
+
margin-bottom: var(--margin-default);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
div[name] {
|
|
82
|
+
text-align: left;
|
|
83
|
+
}
|
|
29
84
|
}
|
|
30
85
|
`
|
|
31
86
|
|
|
32
87
|
@property({ type: Object }) value?: { [specSetName: string]: any }
|
|
33
88
|
@property({ type: Object }) dataItem?: DataItem
|
|
34
89
|
|
|
35
|
-
@state() dataItemSpecSets:
|
|
90
|
+
@state() dataItemSpecSets: UseCaseDefinition[] = []
|
|
36
91
|
|
|
37
92
|
@queryAll('ox-properties-dynamic-view') specSetViews!: NodeListOf<HTMLElement & { value: any }>
|
|
38
93
|
|
|
39
94
|
render() {
|
|
40
95
|
return html`<form @property-change=${(e: Event) => this.onChange(e)}>
|
|
41
96
|
${this.dataItemSpecSets.map(
|
|
42
|
-
({ name, description, specs }) => html` <
|
|
43
|
-
|
|
97
|
+
({ name, description, specs }) => html` <label
|
|
98
|
+
><div name>${name}</div>
|
|
99
|
+
<div description><mwc-icon>info_outline</mwc-icon> ${description}</div>
|
|
44
100
|
<ox-properties-dynamic-view data-name=${name} .props=${specs} .value=${this.value?.[name]}>
|
|
45
|
-
</ox-properties-dynamic-view
|
|
101
|
+
</ox-properties-dynamic-view
|
|
102
|
+
></label>`
|
|
46
103
|
)}
|
|
47
104
|
</form>`
|
|
48
105
|
}
|
package/src/ox-data-ooc-view.ts
CHANGED
|
@@ -16,7 +16,6 @@ export class OxDataOocView extends LitElement {
|
|
|
16
16
|
display: flex;
|
|
17
17
|
flex-direction: column;
|
|
18
18
|
background-color: var(--main-section-background-color);
|
|
19
|
-
padding: var(--padding-wide);
|
|
20
19
|
|
|
21
20
|
position: relative;
|
|
22
21
|
}
|
|
@@ -30,19 +29,74 @@ export class OxDataOocView extends LitElement {
|
|
|
30
29
|
|
|
31
30
|
h3[state] {
|
|
32
31
|
position: absolute;
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
32
|
+
margin: 0;
|
|
33
|
+
padding: 0;
|
|
34
|
+
right: 10px;
|
|
35
|
+
width: 90px;
|
|
36
|
+
text-align: center;
|
|
36
37
|
}
|
|
37
38
|
|
|
38
39
|
mwc-icon {
|
|
39
40
|
font-size: 16px;
|
|
40
41
|
}
|
|
42
|
+
[state] mwc-icon {
|
|
43
|
+
font-size: 80px;
|
|
44
|
+
opacity: 0.4;
|
|
45
|
+
color: var(--primary-background-color);
|
|
46
|
+
}
|
|
41
47
|
|
|
42
|
-
[
|
|
48
|
+
[state] div {
|
|
49
|
+
position: absolute;
|
|
50
|
+
top: 22px;
|
|
51
|
+
left: 0;
|
|
52
|
+
right: 0;
|
|
53
|
+
font-size: 10px;
|
|
54
|
+
color: var(--theme-white-color);
|
|
55
|
+
}
|
|
56
|
+
[state] [field-state] {
|
|
57
|
+
display: block;
|
|
58
|
+
border-radius: 4px;
|
|
59
|
+
background-color: var(--primary-color);
|
|
60
|
+
box-shadow: var(--box-shadow);
|
|
61
|
+
margin-top: var(--margin-narrow);
|
|
62
|
+
padding: 1px 3px;
|
|
63
|
+
font-size: 0.8rem;
|
|
64
|
+
}
|
|
65
|
+
[danger] [field-state] {
|
|
66
|
+
background-color: var(--status-danger-color);
|
|
67
|
+
}
|
|
68
|
+
[complate] [field-state] {
|
|
69
|
+
background-color: var(--status-info-color);
|
|
70
|
+
}
|
|
71
|
+
[page-history] [field-state] {
|
|
72
|
+
border-radius: 2px;
|
|
73
|
+
background-color: var(--primary-color);
|
|
74
|
+
margin-left: var(--margin-default);
|
|
75
|
+
padding: 1px 2px;
|
|
76
|
+
font-size: 0.7rem;
|
|
77
|
+
color: var(--theme-white-color);
|
|
78
|
+
}
|
|
79
|
+
[page-history] {
|
|
80
|
+
background-color: var(--theme-white-color);
|
|
81
|
+
box-shadow: var(--box-shadow);
|
|
82
|
+
border-radius: var(--border-radius);
|
|
43
83
|
margin: var(--page-description-margin);
|
|
84
|
+
padding: var(--padding-default);
|
|
44
85
|
font: var(--page-description-font);
|
|
45
|
-
color: var(--
|
|
86
|
+
color: var(--secondary-color);
|
|
87
|
+
}
|
|
88
|
+
[page-history] mwc-icon {
|
|
89
|
+
position: relative;
|
|
90
|
+
top: 3px;
|
|
91
|
+
margin: 0 2px 0 10px;
|
|
92
|
+
}
|
|
93
|
+
[field-info] {
|
|
94
|
+
opacity: 0.7;
|
|
95
|
+
}
|
|
96
|
+
[page-history] strong {
|
|
97
|
+
display: block;
|
|
98
|
+
font-weight: bold;
|
|
99
|
+
font-size: 0.9rem;
|
|
46
100
|
}
|
|
47
101
|
`
|
|
48
102
|
|
|
@@ -54,19 +108,24 @@ export class OxDataOocView extends LitElement {
|
|
|
54
108
|
const formatter = new Intl.DateTimeFormat(navigator.language, { dateStyle: 'full', timeStyle: 'short' })
|
|
55
109
|
|
|
56
110
|
return html`
|
|
57
|
-
<ox-data-sample-view .dataSample=${this.dataOoc}
|
|
111
|
+
<ox-data-sample-view .dataSample=${this.dataOoc}></ox-data-sample-view>
|
|
58
112
|
|
|
59
|
-
<h3 state
|
|
113
|
+
<h3 state>
|
|
114
|
+
<!--상태에 따라 추가로 danger, complate를 어트리뷰트로 추가시 배경컬러 변경되도록 해두었습니다-->
|
|
115
|
+
<mwc-icon>shield</mwc-icon>
|
|
116
|
+
<div>${name} <span field-state>${this.dataOoc?.state || ''}</span></div>
|
|
117
|
+
</h3>
|
|
60
118
|
|
|
61
119
|
<h3>${i18next.t('title.history')}</h3>
|
|
62
120
|
${history.map(
|
|
63
121
|
({ user, state, comment, timestamp }) => html`
|
|
64
|
-
<p page-
|
|
65
|
-
|
|
66
|
-
<
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
122
|
+
<p page-history>
|
|
123
|
+
<!--상태에 따라 추가로 danger, complate를 어트리뷰트로 추가시 배경컬러 변경되도록 해두었습니다-->
|
|
124
|
+
<span field-info
|
|
125
|
+
>${formatter.format(new Date(timestamp))} <mwc-icon>account_circle</mwc-icon>${user.name}</span
|
|
126
|
+
>
|
|
127
|
+
<span field-state>${state}</span>
|
|
128
|
+
<strong>${comment}</strong>
|
|
70
129
|
</p>
|
|
71
130
|
`
|
|
72
131
|
)}
|
|
@@ -5,8 +5,8 @@ import { customElement, property } from 'lit/decorators.js'
|
|
|
5
5
|
|
|
6
6
|
import { i18next } from '@operato/i18n'
|
|
7
7
|
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
8
|
+
import { DataSample, DataSpecLimitSet } from './types.js'
|
|
9
|
+
import { OxDataUseCase } from './usecase/ox-data-use-case.js'
|
|
10
10
|
|
|
11
11
|
@customElement('ox-data-sample-view')
|
|
12
12
|
export class OxDataSampleView extends LitElement {
|
|
@@ -14,7 +14,6 @@ export class OxDataSampleView extends LitElement {
|
|
|
14
14
|
:host {
|
|
15
15
|
display: flex;
|
|
16
16
|
flex-direction: column;
|
|
17
|
-
background-color: var(--main-section-background-color);
|
|
18
17
|
}
|
|
19
18
|
|
|
20
19
|
form {
|
|
@@ -26,13 +25,23 @@ export class OxDataSampleView extends LitElement {
|
|
|
26
25
|
|
|
27
26
|
h2 {
|
|
28
27
|
margin: var(--title-margin);
|
|
29
|
-
padding-top: 25px;
|
|
30
28
|
font: var(--title-font);
|
|
31
29
|
color: var(--title-text-color);
|
|
30
|
+
text-transform: capitalize;
|
|
32
31
|
}
|
|
33
32
|
[page-description] {
|
|
34
33
|
margin: var(--page-description-margin);
|
|
34
|
+
opacity: 0.7;
|
|
35
35
|
font: var(--page-description-font);
|
|
36
|
+
color: var(--secondary-color);
|
|
37
|
+
text-transform: capitalize;
|
|
38
|
+
}
|
|
39
|
+
[page-description] * {
|
|
40
|
+
vertical-align: middle;
|
|
41
|
+
}
|
|
42
|
+
[page-description] mwc-icon {
|
|
43
|
+
margin-top: -2px;
|
|
44
|
+
font-size: 0.9rem;
|
|
36
45
|
color: var(--page-description-color);
|
|
37
46
|
}
|
|
38
47
|
|
|
@@ -86,21 +95,30 @@ export class OxDataSampleView extends LitElement {
|
|
|
86
95
|
}
|
|
87
96
|
`
|
|
88
97
|
|
|
89
|
-
@property({ type: Object }) dataSet?: DataSet
|
|
90
98
|
@property({ type: Object }) dataSample?: DataSample
|
|
91
99
|
|
|
92
100
|
render() {
|
|
93
|
-
|
|
94
|
-
const data = this.dataSample?.data || {}
|
|
101
|
+
var { useCase, data = {}, judgment, dataItems = [] } = this.dataSample || {}
|
|
95
102
|
const formatter = new Intl.DateTimeFormat(navigator.language, { dateStyle: 'full', timeStyle: 'short' })
|
|
103
|
+
const useCaseNames = useCase?.split(',').filter(useCase => useCase.trim()) || []
|
|
96
104
|
|
|
97
105
|
const { name, description, collectedAt, workDate, workShift } = this.dataSample || {}
|
|
98
106
|
|
|
99
|
-
|
|
107
|
+
/* TODO below converting logic should be removed after dataset migration */
|
|
108
|
+
if (!(dataItems instanceof Array)) {
|
|
109
|
+
dataItems = Object.keys(dataItems).map(tag => {
|
|
110
|
+
var dataItem = (dataItems as any)[tag]
|
|
111
|
+
dataItem.tag = tag
|
|
112
|
+
return dataItem
|
|
113
|
+
})
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
return html` <h2>${name}</h2>
|
|
100
117
|
<p page-description>
|
|
101
|
-
${
|
|
102
|
-
${i18next.t('field.work-date')}: ${workDate} ${workShift}
|
|
103
|
-
${i18next.t('field.collected-at')}:
|
|
118
|
+
<mwc-icon>info_outline</mwc-icon> ${description}<br />
|
|
119
|
+
<mwc-icon>alarm</mwc-icon> ${i18next.t('field.work-date')}: ${workDate} ${workShift} |
|
|
120
|
+
<mwc-icon>pending_actions</mwc-icon> ${i18next.t('field.collected-at')}:
|
|
121
|
+
${formatter.format(new Date(collectedAt!))}
|
|
104
122
|
</p>
|
|
105
123
|
|
|
106
124
|
<form @change=${(e: Event) => this.onChange(e)}>
|
|
@@ -115,15 +133,17 @@ export class OxDataSampleView extends LitElement {
|
|
|
115
133
|
<th>${i18next.t('field.oos')}</th>
|
|
116
134
|
</tr>
|
|
117
135
|
${dataItems.map(dataItem => {
|
|
118
|
-
const {
|
|
119
|
-
const
|
|
136
|
+
const { name = '', tag = '', description = '', unit = '', spec = {} } = dataItem
|
|
137
|
+
const value = data[tag]
|
|
138
|
+
const { ooc, oos } = judgment?.[tag] || {}
|
|
139
|
+
|
|
120
140
|
return html`
|
|
121
141
|
<tr ?ooc=${ooc} ?oos=${oos}>
|
|
122
142
|
<td name>${name}</td>
|
|
123
143
|
<td>${description}</td>
|
|
124
144
|
<td>${unit}</td>
|
|
125
|
-
<td>${this.buildValue(
|
|
126
|
-
<td><pre>${this.buildSpec(
|
|
145
|
+
<td>${this.buildValue(value)}</td>
|
|
146
|
+
<td><pre>${this.buildSpec(useCaseNames, spec)}</pre></td>
|
|
127
147
|
<td>${ooc ? html`<mwc-icon>done</mwc-icon>` : ''}</td>
|
|
128
148
|
<td>${oos ? html`<mwc-icon>done</mwc-icon>` : ''}</td>
|
|
129
149
|
</tr>
|
|
@@ -135,43 +155,27 @@ export class OxDataSampleView extends LitElement {
|
|
|
135
155
|
|
|
136
156
|
private onChange(e: Event) {}
|
|
137
157
|
|
|
138
|
-
private buildSpec(
|
|
139
|
-
return OxDataUseCase.elaborateDataItemSpec(
|
|
158
|
+
private buildSpec(useCaseNames: string[], spec: DataSpecLimitSet): string {
|
|
159
|
+
return OxDataUseCase.elaborateDataItemSpec(useCaseNames, spec)
|
|
140
160
|
}
|
|
141
161
|
|
|
142
|
-
private buildValue(
|
|
143
|
-
const { tag, type } = dataItem
|
|
144
|
-
|
|
145
|
-
if (!this.dataSample) {
|
|
146
|
-
return ''
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
const value = this.dataSample?.data[dataItem.tag]
|
|
162
|
+
private buildValue(value: any | any[]) {
|
|
150
163
|
if (value === undefined) {
|
|
151
164
|
return ''
|
|
152
165
|
}
|
|
153
166
|
const values = value instanceof Array ? value : [value]
|
|
154
167
|
|
|
155
|
-
const elements = values.map((
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
switch (type) {
|
|
168
|
+
const elements = values.map((v: any, idx) => {
|
|
169
|
+
switch (typeof v) {
|
|
159
170
|
case 'boolean':
|
|
160
|
-
return html` <input type="checkbox"
|
|
171
|
+
return html` <input type="checkbox" .checked=${v} disabled />`
|
|
161
172
|
break
|
|
162
173
|
|
|
163
|
-
case 'select':
|
|
164
|
-
case 'number':
|
|
165
|
-
case 'string':
|
|
166
174
|
default:
|
|
167
|
-
return
|
|
175
|
+
return v === undefined ? '' : v
|
|
168
176
|
}
|
|
169
177
|
})
|
|
170
178
|
|
|
171
|
-
return
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
private evaluateOOC(dataItem: DataItem, value: any) {
|
|
175
|
-
return OxDataUseCase.evaluateItem(this.dataSet!, dataItem, value)
|
|
179
|
+
return typeof values[0] === 'boolean' ? elements : elements.join(', ')
|
|
176
180
|
}
|
|
177
181
|
}
|
package/src/types.ts
CHANGED
|
@@ -15,7 +15,11 @@ export type DataItem = {
|
|
|
15
15
|
options: TypeOptions
|
|
16
16
|
unit: string
|
|
17
17
|
quota: number
|
|
18
|
-
spec: {
|
|
18
|
+
spec: {
|
|
19
|
+
[useCase: string]: {
|
|
20
|
+
[limit: string]: number | string | string[] | boolean
|
|
21
|
+
}
|
|
22
|
+
}
|
|
19
23
|
}
|
|
20
24
|
|
|
21
25
|
export type DataSet = {
|
|
@@ -28,25 +32,46 @@ export type DataSet = {
|
|
|
28
32
|
spec: { [dataItem: string]: { [useCase: string]: any } }
|
|
29
33
|
}
|
|
30
34
|
|
|
31
|
-
export type
|
|
35
|
+
export type DataSpecDefinition = {
|
|
32
36
|
type: string
|
|
33
37
|
label: string
|
|
34
38
|
name: string
|
|
35
39
|
property?: { [option: string]: any }
|
|
36
40
|
}
|
|
37
41
|
|
|
38
|
-
export type
|
|
42
|
+
export type UseCaseDefinition = {
|
|
39
43
|
name: string
|
|
40
44
|
description: string
|
|
41
45
|
help: string
|
|
42
|
-
specs:
|
|
46
|
+
specs: DataSpecDefinition[]
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export type DataSpecLimit = {
|
|
50
|
+
[limit: string]: number | string | string[] | boolean
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export type DataSpecLimitSet = {
|
|
54
|
+
[useCase: string]: DataSpecLimit
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export type DataCollection = {
|
|
58
|
+
[tag: string]: any
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export type Judgment = {
|
|
62
|
+
[tag: string]: {
|
|
63
|
+
ooc: boolean
|
|
64
|
+
oos: boolean
|
|
65
|
+
}
|
|
43
66
|
}
|
|
44
67
|
|
|
45
68
|
export type DataSample = {
|
|
46
69
|
name: string
|
|
47
70
|
description: string
|
|
48
|
-
|
|
49
|
-
|
|
71
|
+
useCase: string
|
|
72
|
+
data?: DataCollection
|
|
73
|
+
judgment?: Judgment
|
|
74
|
+
dataItems?: DataItem[]
|
|
50
75
|
quota: number
|
|
51
76
|
workDate: string
|
|
52
77
|
workShift: string
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/* Here, only the common module of client and server is imported/exported. Be careful not to use a module dedicated to client or server. */
|
|
2
|
+
|
|
3
|
+
import { OxDataUseCase } from '../ox-data-use-case'
|
|
4
|
+
import { OxDataUseCaseCCP } from './ox-data-use-case-ccp'
|
|
5
|
+
|
|
6
|
+
// OxPropertyEditor.register({
|
|
7
|
+
// 'ccp-limits': 'ox-property-editor-ccp-limits'
|
|
8
|
+
// })
|
|
9
|
+
|
|
10
|
+
OxDataUseCase.registerUseCase('CCP', new OxDataUseCaseCCP())
|