@operato/dataset 8.0.3 → 8.2.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 +17 -0
- package/dist/src/ox-checklist-entry-form.d.ts +30 -0
- package/dist/src/ox-checklist-entry-form.js +294 -0
- package/dist/src/ox-checklist-entry-form.js.map +1 -0
- package/dist/src/ox-checklist-sample-view.d.ts +20 -0
- package/dist/src/ox-checklist-sample-view.js +300 -0
- package/dist/src/ox-checklist-sample-view.js.map +1 -0
- package/dist/src/ox-data-ooc-brief-view.d.ts +1 -0
- package/dist/src/ox-data-ooc-brief-view.js +28 -1
- package/dist/src/ox-data-ooc-brief-view.js.map +1 -1
- package/dist/src/types.d.ts +5 -0
- package/dist/src/types.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +18 -10
|
@@ -0,0 +1,300 @@
|
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
|
+
import '@material/web/icon/icon.js';
|
|
3
|
+
import '@operato/input/ox-input-file.js';
|
|
4
|
+
import '@operato/input/ox-input-signature.js';
|
|
5
|
+
import { css, html, LitElement } from 'lit';
|
|
6
|
+
import { customElement, property } from 'lit/decorators.js';
|
|
7
|
+
import { i18next } from '@operato/i18n';
|
|
8
|
+
import { OxDataUseCase } from './usecase/ox-data-use-case.js';
|
|
9
|
+
let OxChecklistSampleView = class OxChecklistSampleView extends LitElement {
|
|
10
|
+
render() {
|
|
11
|
+
if (!this.dataSample) {
|
|
12
|
+
return html ``;
|
|
13
|
+
}
|
|
14
|
+
const { name, description, collectedAt, workDate, workShift, useCase, data = {}, judgment, dataItems = [] } = this.dataSample;
|
|
15
|
+
const formatter = new Intl.DateTimeFormat(navigator.language, { dateStyle: 'full', timeStyle: 'short' });
|
|
16
|
+
const useCaseNames = (useCase === null || useCase === void 0 ? void 0 : useCase.split(',').filter(useCase => useCase.trim())) || [];
|
|
17
|
+
const groupItems = dataItems === null || dataItems === void 0 ? void 0 : dataItems.filter(i => i.group);
|
|
18
|
+
const nonGroupItems = dataItems === null || dataItems === void 0 ? void 0 : dataItems.filter(i => !i.group);
|
|
19
|
+
let nameColspan = 1;
|
|
20
|
+
nameColspan += groupItems.length > 0 ? 1 : 0;
|
|
21
|
+
nameColspan += groupItems.some(i => i.subgroup) ? 1 : 0;
|
|
22
|
+
return html `
|
|
23
|
+
<h2>${name}</h2>
|
|
24
|
+
<p page-description>
|
|
25
|
+
<md-icon>info</md-icon> ${description}<br />
|
|
26
|
+
<md-icon>alarm</md-icon> ${i18next.t('field.work-date')}: ${workDate} ${workShift} |
|
|
27
|
+
<md-icon>pending_actions</md-icon> ${i18next.t('field.collected-at')}:
|
|
28
|
+
${formatter.format(new Date(collectedAt))}
|
|
29
|
+
</p>
|
|
30
|
+
|
|
31
|
+
<form class="checklist">
|
|
32
|
+
<table>
|
|
33
|
+
<thead></thead>
|
|
34
|
+
<tbody>
|
|
35
|
+
${this.buildGroupTable(groupItems, data, nameColspan, judgment, useCaseNames)}
|
|
36
|
+
${this.buildNonGroupTable(nonGroupItems, data, nameColspan, judgment, useCaseNames)}
|
|
37
|
+
</tbody>
|
|
38
|
+
</table>
|
|
39
|
+
</form>
|
|
40
|
+
`;
|
|
41
|
+
}
|
|
42
|
+
buildGroupTable(items, data, nameColspan, judgment, useCaseNames) {
|
|
43
|
+
let isSubgroupExist = items.some(i => i.subgroup);
|
|
44
|
+
let renderedGroups = [];
|
|
45
|
+
return html `
|
|
46
|
+
<tr>
|
|
47
|
+
<th colspan=${nameColspan} item>${i18next.t('field.item')}</th>
|
|
48
|
+
<th>${i18next.t('field.description')}</th>
|
|
49
|
+
<th>${i18next.t('field.finalizing-function')}</th>
|
|
50
|
+
<th>${i18next.t('field.unit')}</th>
|
|
51
|
+
<th value>${i18next.t('field.value')}</th>
|
|
52
|
+
<th>${i18next.t('field.spec')}</th>
|
|
53
|
+
<th>${i18next.t('field.ooc')}</th>
|
|
54
|
+
<th>${i18next.t('field.oos')}</th>
|
|
55
|
+
</tr>
|
|
56
|
+
${items.map(item => {
|
|
57
|
+
const { name = '', tag = '', description = '', stat, unit = '', spec = {}, type, group, subgroup } = item;
|
|
58
|
+
const value = data[tag];
|
|
59
|
+
const { ooc, oos } = (judgment === null || judgment === void 0 ? void 0 : judgment[tag]) || {};
|
|
60
|
+
let groupTd = null;
|
|
61
|
+
if (!this.isGroupRendered(renderedGroups, group)) {
|
|
62
|
+
groupTd = html `<td rowspan="${this.groupItemNums(items, group)}">${group}</td>`;
|
|
63
|
+
renderedGroups.push({ group });
|
|
64
|
+
}
|
|
65
|
+
let subgroupTd = null;
|
|
66
|
+
if (subgroup && !this.isGroupRendered(renderedGroups, group, subgroup)) {
|
|
67
|
+
subgroupTd = html `<td rowspan="${this.groupItemNums(items, group, subgroup)}">${subgroup}</td>`;
|
|
68
|
+
renderedGroups.push({ group, subgroup });
|
|
69
|
+
}
|
|
70
|
+
return html `
|
|
71
|
+
<tr ?ooc=${ooc} ?oos=${oos}>
|
|
72
|
+
${groupTd} ${subgroupTd}
|
|
73
|
+
<td name colspan=${isSubgroupExist && !subgroup ? 2 : 1}>${name}</td>
|
|
74
|
+
<td>${description}</td>
|
|
75
|
+
<td>${stat}</td>
|
|
76
|
+
<td>${unit}</td>
|
|
77
|
+
<td>${this.buildValue(type, value)}</td>
|
|
78
|
+
<td><pre>${this.buildSpec(useCaseNames, spec)}</pre></td>
|
|
79
|
+
<td>${ooc ? html `<md-icon>done</md-icon>` : ''}</td>
|
|
80
|
+
<td>${oos ? html `<md-icon>done</md-icon>` : ''}</td>
|
|
81
|
+
</tr>
|
|
82
|
+
`;
|
|
83
|
+
})}
|
|
84
|
+
`;
|
|
85
|
+
}
|
|
86
|
+
buildNonGroupTable(items, data, nameColspan, judgment, useCaseNames) {
|
|
87
|
+
return html `
|
|
88
|
+
${items.map(item => {
|
|
89
|
+
const { name = '', tag = '', description = '', stat, unit = '', spec = {}, type } = item;
|
|
90
|
+
const value = data[tag];
|
|
91
|
+
const { ooc, oos } = (judgment === null || judgment === void 0 ? void 0 : judgment[tag]) || {};
|
|
92
|
+
return html `
|
|
93
|
+
<tr ?ooc=${ooc} ?oos=${oos}>
|
|
94
|
+
<td name colspan=${nameColspan}>${name}</td>
|
|
95
|
+
<td>${description}</td>
|
|
96
|
+
<td>${stat}</td>
|
|
97
|
+
<td>${unit}</td>
|
|
98
|
+
<td>${this.buildValue(type, value)}</td>
|
|
99
|
+
<td><pre>${this.buildSpec(useCaseNames, spec)}</pre></td>
|
|
100
|
+
<td>${ooc ? html `<md-icon>done</md-icon>` : ''}</td>
|
|
101
|
+
<td>${oos ? html `<md-icon>done</md-icon>` : ''}</td>
|
|
102
|
+
</tr>
|
|
103
|
+
`;
|
|
104
|
+
})}
|
|
105
|
+
`;
|
|
106
|
+
}
|
|
107
|
+
isGroupRendered(renderedGroups, group, subgroup) {
|
|
108
|
+
if (subgroup) {
|
|
109
|
+
return renderedGroups.some(groupInfo => groupInfo.group === group && groupInfo.subgroup === subgroup);
|
|
110
|
+
}
|
|
111
|
+
else {
|
|
112
|
+
return renderedGroups.some(groupInfo => groupInfo.group === group);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
groupItemNums(items, group, subgroup) {
|
|
116
|
+
let nums = 0;
|
|
117
|
+
if (subgroup) {
|
|
118
|
+
items.forEach(i => {
|
|
119
|
+
if (i.group === group && i.subgroup === subgroup) {
|
|
120
|
+
nums += 1;
|
|
121
|
+
}
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
else {
|
|
125
|
+
items.forEach(i => {
|
|
126
|
+
if (i.group === group) {
|
|
127
|
+
nums += 1;
|
|
128
|
+
}
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
return nums;
|
|
132
|
+
}
|
|
133
|
+
buildSpec(useCaseNames, spec) {
|
|
134
|
+
return OxDataUseCase.elaborateDataItemSpec(useCaseNames, spec);
|
|
135
|
+
}
|
|
136
|
+
download(file) {
|
|
137
|
+
const element = document.createElement('a');
|
|
138
|
+
element.setAttribute('href', file.fullpath);
|
|
139
|
+
element.setAttribute('download', file.name);
|
|
140
|
+
document.body.appendChild(element);
|
|
141
|
+
element.click();
|
|
142
|
+
}
|
|
143
|
+
buildValue(type, value) {
|
|
144
|
+
if (value === undefined) {
|
|
145
|
+
return '';
|
|
146
|
+
}
|
|
147
|
+
const values = value instanceof Array ? value : [value];
|
|
148
|
+
if (type == 'file') {
|
|
149
|
+
const files = values.flat();
|
|
150
|
+
return files
|
|
151
|
+
.filter(Boolean)
|
|
152
|
+
.map(file => html `<a @click=${() => this.download(file)} file><md-icon>description</md-icon>${file.name}</a>`);
|
|
153
|
+
}
|
|
154
|
+
if (type == 'signature') {
|
|
155
|
+
return html ` <ox-input-signature .value=${value} disabled></ox-input-signature>`;
|
|
156
|
+
}
|
|
157
|
+
const elements = values.map((v, idx) => {
|
|
158
|
+
switch (typeof v) {
|
|
159
|
+
case 'boolean':
|
|
160
|
+
return html ` <input type="checkbox" .checked=${v} disabled />`;
|
|
161
|
+
break;
|
|
162
|
+
default:
|
|
163
|
+
if (type == 'date') {
|
|
164
|
+
return v ? new Date(v).toLocaleDateString() : '';
|
|
165
|
+
}
|
|
166
|
+
else if (type == 'datetime') {
|
|
167
|
+
return v ? new Date(v).toLocaleString() : '';
|
|
168
|
+
}
|
|
169
|
+
return v !== null && v !== void 0 ? v : '';
|
|
170
|
+
}
|
|
171
|
+
});
|
|
172
|
+
return typeof values[0] === 'boolean' ? elements : elements.join(', ');
|
|
173
|
+
}
|
|
174
|
+
};
|
|
175
|
+
OxChecklistSampleView.styles = css `
|
|
176
|
+
:host {
|
|
177
|
+
display: flex;
|
|
178
|
+
flex-direction: column;
|
|
179
|
+
|
|
180
|
+
--signature-min-width: 100px;
|
|
181
|
+
--signature-min-height: 60px;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
form {
|
|
185
|
+
flex: 1;
|
|
186
|
+
|
|
187
|
+
display: flex;
|
|
188
|
+
flex-direction: column;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
h2 {
|
|
192
|
+
margin: var(--title-margin);
|
|
193
|
+
font: var(--title-font);
|
|
194
|
+
color: var(--title-text-color);
|
|
195
|
+
text-transform: capitalize;
|
|
196
|
+
}
|
|
197
|
+
[page-description] {
|
|
198
|
+
margin: var(--page-description-margin);
|
|
199
|
+
opacity: 0.7;
|
|
200
|
+
font: var(--page-description-font);
|
|
201
|
+
color: var(--md-sys-color-on-secondary-container);
|
|
202
|
+
text-transform: capitalize;
|
|
203
|
+
}
|
|
204
|
+
[page-description] * {
|
|
205
|
+
vertical-align: middle;
|
|
206
|
+
}
|
|
207
|
+
[page-description] md-icon {
|
|
208
|
+
margin-top: -2px;
|
|
209
|
+
font-size: 0.9rem;
|
|
210
|
+
color: var(--page-description-color);
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
table {
|
|
214
|
+
border-collapse: collapse;
|
|
215
|
+
margin-bottom: var(--spacing-medium);
|
|
216
|
+
}
|
|
217
|
+
th {
|
|
218
|
+
padding: var(--th-padding);
|
|
219
|
+
border-top: var(--th-border-top);
|
|
220
|
+
border-bottom: var(--td-border-bottom);
|
|
221
|
+
text-transform: var(--th-text-transform);
|
|
222
|
+
font: var(--th-font);
|
|
223
|
+
color: var(--th-color);
|
|
224
|
+
text-align: left;
|
|
225
|
+
white-space: nowrap;
|
|
226
|
+
}
|
|
227
|
+
th[item] {
|
|
228
|
+
min-width: 100px;
|
|
229
|
+
}
|
|
230
|
+
th[value] {
|
|
231
|
+
min-width: 100px;
|
|
232
|
+
}
|
|
233
|
+
tr {
|
|
234
|
+
background-color: var(--tr-background-color);
|
|
235
|
+
}
|
|
236
|
+
tr:nth-child(odd) {
|
|
237
|
+
background-color: var(--tr-background-odd-color);
|
|
238
|
+
}
|
|
239
|
+
tr:hover {
|
|
240
|
+
background-color: var(--tr-background-hover-color);
|
|
241
|
+
}
|
|
242
|
+
tr[ooc],
|
|
243
|
+
tr[oos] {
|
|
244
|
+
background-color: #fefbdf;
|
|
245
|
+
}
|
|
246
|
+
td {
|
|
247
|
+
border: var(--td-border-line);
|
|
248
|
+
padding: var(--td-padding);
|
|
249
|
+
font: var(--td-font);
|
|
250
|
+
color: var(--td-color);
|
|
251
|
+
}
|
|
252
|
+
td[name] {
|
|
253
|
+
font-weight: bold;
|
|
254
|
+
}
|
|
255
|
+
td md-icon {
|
|
256
|
+
color: var(--md-sys-color-error);
|
|
257
|
+
}
|
|
258
|
+
td > input,
|
|
259
|
+
select {
|
|
260
|
+
border: var(--input-field-border);
|
|
261
|
+
border-radius: var(--input-field-border-radius);
|
|
262
|
+
padding: var(--input-field-padding);
|
|
263
|
+
font: var(--input-field-font);
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
pre {
|
|
267
|
+
tab-size: 2;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
a[file] {
|
|
271
|
+
display: flex;
|
|
272
|
+
align-items: center;
|
|
273
|
+
gap: var(--spacing-small);
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
a[file] md-icon {
|
|
277
|
+
--md-icon-size: 16px;
|
|
278
|
+
color: var(--md-sys-color-primary);
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
@media print {
|
|
282
|
+
:host {
|
|
283
|
+
display: block;
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
@media screen and (max-width: 480px) {
|
|
288
|
+
th {
|
|
289
|
+
min-width: 50px;
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
`;
|
|
293
|
+
__decorate([
|
|
294
|
+
property({ type: Object })
|
|
295
|
+
], OxChecklistSampleView.prototype, "dataSample", void 0);
|
|
296
|
+
OxChecklistSampleView = __decorate([
|
|
297
|
+
customElement('ox-checklist-sample-view')
|
|
298
|
+
], OxChecklistSampleView);
|
|
299
|
+
export { OxChecklistSampleView };
|
|
300
|
+
//# sourceMappingURL=ox-checklist-sample-view.js.map
|
|
@@ -0,0 +1 @@
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CAAC;gBACjB,KAAK,SAAS;oBACZ,OAAO,IAAI,CAAA,oCAAoC,CAAC,cAAc,CAAA;oBAC9D,MAAK;gBAEP;oBACE,IAAI,IAAI,IAAI,MAAM,EAAE,CAAC;wBACnB,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC,kBAAkB,EAAE,CAAC,CAAC,CAAC,EAAE,CAAA;oBAClD,CAAC;yBAAM,IAAI,IAAI,IAAI,UAAU,EAAE,CAAC;wBAC9B,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC,cAAc,EAAE,CAAC,CAAC,CAAC,EAAE,CAAA;oBAC9C,CAAC;oBACD,OAAO,CAAC,aAAD,CAAC,cAAD,CAAC,GAAI,EAAE,CAAA;YAClB,CAAC;QACH,CAAC,CAAC,CAAA;QAEF,OAAO,OAAO,MAAM,CAAC,CAAC,CAAC,KAAK,SAAS,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;IACxE,CAAC;;AAzTM,4BAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqHlB,AArHY,CAqHZ;AAE2B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;yDAAwB;AAxHxC,qBAAqB;IADjC,aAAa,CAAC,0BAA0B,CAAC;GAC7B,qBAAqB,CA2TjC","sourcesContent":["import '@material/web/icon/icon.js'\nimport '@operato/input/ox-input-file.js'\nimport '@operato/input/ox-input-signature.js'\n\nimport { css, html, LitElement, TemplateResult } from 'lit'\nimport { customElement, property } from 'lit/decorators.js'\n\nimport { i18next } from '@operato/i18n'\n\nimport { DataItem, DataSample, DataSpecLimitSet } from './types.js'\nimport { OxDataUseCase } from './usecase/ox-data-use-case.js'\n\n@customElement('ox-checklist-sample-view')\nexport class OxChecklistSampleView extends LitElement {\n static styles = css`\n :host {\n display: flex;\n flex-direction: column;\n\n --signature-min-width: 100px;\n --signature-min-height: 60px;\n }\n\n form {\n flex: 1;\n\n display: flex;\n flex-direction: column;\n }\n\n h2 {\n margin: var(--title-margin);\n font: var(--title-font);\n color: var(--title-text-color);\n text-transform: capitalize;\n }\n [page-description] {\n margin: var(--page-description-margin);\n opacity: 0.7;\n font: var(--page-description-font);\n color: var(--md-sys-color-on-secondary-container);\n text-transform: capitalize;\n }\n [page-description] * {\n vertical-align: middle;\n }\n [page-description] md-icon {\n margin-top: -2px;\n font-size: 0.9rem;\n color: var(--page-description-color);\n }\n\n table {\n border-collapse: collapse;\n margin-bottom: var(--spacing-medium);\n }\n th {\n padding: var(--th-padding);\n border-top: var(--th-border-top);\n border-bottom: var(--td-border-bottom);\n text-transform: var(--th-text-transform);\n font: var(--th-font);\n color: var(--th-color);\n text-align: left;\n white-space: nowrap;\n }\n th[item] {\n min-width: 100px;\n }\n th[value] {\n min-width: 100px;\n }\n tr {\n background-color: var(--tr-background-color);\n }\n tr:nth-child(odd) {\n background-color: var(--tr-background-odd-color);\n }\n tr:hover {\n background-color: var(--tr-background-hover-color);\n }\n tr[ooc],\n tr[oos] {\n background-color: #fefbdf;\n }\n td {\n border: var(--td-border-line);\n padding: var(--td-padding);\n font: var(--td-font);\n color: var(--td-color);\n }\n td[name] {\n font-weight: bold;\n }\n td md-icon {\n color: var(--md-sys-color-error);\n }\n td > input,\n 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 pre {\n tab-size: 2;\n }\n\n a[file] {\n display: flex;\n align-items: center;\n gap: var(--spacing-small);\n }\n\n a[file] md-icon {\n --md-icon-size: 16px;\n color: var(--md-sys-color-primary);\n }\n\n @media print {\n :host {\n display: block;\n }\n }\n\n @media screen and (max-width: 480px) {\n th {\n min-width: 50px;\n }\n }\n `\n\n @property({ type: Object }) dataSample?: DataSample\n\n render() {\n if (!this.dataSample) {\n return html``\n }\n\n const {\n name,\n description,\n collectedAt,\n workDate,\n workShift,\n useCase,\n data = {},\n judgment,\n dataItems = []\n } = this.dataSample\n const formatter = new Intl.DateTimeFormat(navigator.language, { dateStyle: 'full', timeStyle: 'short' })\n const useCaseNames = useCase?.split(',').filter(useCase => useCase.trim()) || []\n const groupItems = dataItems?.filter(i => i.group)\n const nonGroupItems = dataItems?.filter(i => !i.group)\n let nameColspan = 1\n nameColspan += groupItems.length > 0 ? 1 : 0\n nameColspan += groupItems.some(i => i.subgroup) ? 1 : 0\n\n return html`\n <h2>${name}</h2>\n <p page-description>\n <md-icon>info</md-icon> ${description}<br />\n <md-icon>alarm</md-icon> ${i18next.t('field.work-date')}: ${workDate} ${workShift} |\n <md-icon>pending_actions</md-icon> ${i18next.t('field.collected-at')}:\n ${formatter.format(new Date(collectedAt!))}\n </p>\n\n <form class=\"checklist\">\n <table>\n <thead></thead>\n <tbody>\n ${this.buildGroupTable(groupItems, data, nameColspan, judgment, useCaseNames)}\n ${this.buildNonGroupTable(nonGroupItems, data, nameColspan, judgment, useCaseNames)}\n </tbody>\n </table>\n </form>\n `\n }\n\n buildGroupTable(items: DataItem[], data: any, nameColspan: number, judgment: any, useCaseNames: string[]) {\n let isSubgroupExist = items.some(i => i.subgroup)\n let renderedGroups: { group: string; subgroup?: string | undefined }[] = []\n\n return html`\n <tr>\n <th colspan=${nameColspan} item>${i18next.t('field.item')}</th>\n <th>${i18next.t('field.description')}</th>\n <th>${i18next.t('field.finalizing-function')}</th>\n <th>${i18next.t('field.unit')}</th>\n <th value>${i18next.t('field.value')}</th>\n <th>${i18next.t('field.spec')}</th>\n <th>${i18next.t('field.ooc')}</th>\n <th>${i18next.t('field.oos')}</th>\n </tr>\n ${items.map(item => {\n const { name = '', tag = '', description = '', stat, unit = '', spec = {}, type, group, subgroup } = item\n const value = data[tag]\n const { ooc, oos } = judgment?.[tag] || {}\n\n let groupTd = null\n if (!this.isGroupRendered(renderedGroups, group)) {\n groupTd = html`<td rowspan=\"${this.groupItemNums(items, group)}\">${group}</td>`\n renderedGroups.push({ group })\n }\n\n let subgroupTd = null\n if (subgroup && !this.isGroupRendered(renderedGroups, group, subgroup)) {\n subgroupTd = html`<td rowspan=\"${this.groupItemNums(items, group, subgroup)}\">${subgroup}</td>`\n renderedGroups.push({ group, subgroup })\n }\n\n return html`\n <tr ?ooc=${ooc} ?oos=${oos}>\n ${groupTd} ${subgroupTd}\n <td name colspan=${isSubgroupExist && !subgroup ? 2 : 1}>${name}</td>\n <td>${description}</td>\n <td>${stat}</td>\n <td>${unit}</td>\n <td>${this.buildValue(type, value)}</td>\n <td><pre>${this.buildSpec(useCaseNames, spec)}</pre></td>\n <td>${ooc ? html`<md-icon>done</md-icon>` : ''}</td>\n <td>${oos ? html`<md-icon>done</md-icon>` : ''}</td>\n </tr>\n `\n })}\n `\n }\n\n buildNonGroupTable(items: DataItem[], data: any, nameColspan: number, judgment: any, useCaseNames: string[]) {\n return html`\n ${items.map(item => {\n const { name = '', tag = '', description = '', stat, unit = '', spec = {}, type } = item\n const value = data[tag]\n const { ooc, oos } = judgment?.[tag] || {}\n\n return html`\n <tr ?ooc=${ooc} ?oos=${oos}>\n <td name colspan=${nameColspan}>${name}</td>\n <td>${description}</td>\n <td>${stat}</td>\n <td>${unit}</td>\n <td>${this.buildValue(type, value)}</td>\n <td><pre>${this.buildSpec(useCaseNames, spec)}</pre></td>\n <td>${ooc ? html`<md-icon>done</md-icon>` : ''}</td>\n <td>${oos ? html`<md-icon>done</md-icon>` : ''}</td>\n </tr>\n `\n })}\n `\n }\n\n isGroupRendered(renderedGroups: { group: string; subgroup?: string }[], group: string, subgroup?: string) {\n if (subgroup) {\n return renderedGroups.some(groupInfo => groupInfo.group === group && groupInfo.subgroup === subgroup)\n } else {\n return renderedGroups.some(groupInfo => groupInfo.group === group)\n }\n }\n\n groupItemNums(items: DataItem[], group: string, subgroup?: string) {\n let nums = 0\n\n if (subgroup) {\n items.forEach(i => {\n if (i.group === group && i.subgroup === subgroup) {\n nums += 1\n }\n })\n } else {\n items.forEach(i => {\n if (i.group === group) {\n nums += 1\n }\n })\n }\n\n return nums\n }\n\n private buildSpec(useCaseNames: string[], spec: DataSpecLimitSet): string {\n return OxDataUseCase.elaborateDataItemSpec(useCaseNames, spec)\n }\n\n private download(file: { mimetype: string; name: string; fullpath: string }) {\n const element = document.createElement('a')\n element.setAttribute('href', file.fullpath)\n element.setAttribute('download', file.name!)\n document.body.appendChild(element)\n element.click()\n }\n\n private buildValue(type: string, value: any | any[]) {\n if (value === undefined) {\n return ''\n }\n const values = value instanceof Array ? value : [value]\n\n if (type == 'file') {\n const files = values.flat() as { mimetype: string; name: string; fullpath: string }[]\n\n return files\n .filter(Boolean)\n .map(file => html`<a @click=${() => this.download(file)} file><md-icon>description</md-icon>${file.name}</a>`)\n }\n\n if (type == 'signature') {\n return html` <ox-input-signature .value=${value} disabled></ox-input-signature>`\n }\n\n const elements = values.map((v: any, idx) => {\n switch (typeof v) {\n case 'boolean':\n return html` <input type=\"checkbox\" .checked=${v} disabled />`\n break\n\n default:\n if (type == 'date') {\n return v ? new Date(v).toLocaleDateString() : ''\n } else if (type == 'datetime') {\n return v ? new Date(v).toLocaleString() : ''\n }\n return v ?? ''\n }\n })\n\n return typeof values[0] === 'boolean' ? elements : elements.join(', ')\n }\n}\n"]}
|
|
@@ -10,11 +10,38 @@ let OxDataOocBriefView = class OxDataOocBriefView extends LitElement {
|
|
|
10
10
|
render() {
|
|
11
11
|
const { state } = this.dataOoc || {};
|
|
12
12
|
return html `
|
|
13
|
-
|
|
13
|
+
${this.showDataSampleView()}
|
|
14
|
+
<!-- <ox-data-sample-view .dataSample=${this.dataOoc}></ox-data-sample-view> -->
|
|
14
15
|
<ox-data-ooc-badge .state=${state}></ox-data-ooc-badge>
|
|
15
16
|
<ox-data-ooc-correction-part .dataOoc=${this.dataOoc}></ox-data-ooc-correction-part>
|
|
16
17
|
`;
|
|
17
18
|
}
|
|
19
|
+
showDataSampleView() {
|
|
20
|
+
var _a;
|
|
21
|
+
const dataSet = (_a = this.dataOoc) === null || _a === void 0 ? void 0 : _a.dataSet;
|
|
22
|
+
const monitorType = dataSet === null || dataSet === void 0 ? void 0 : dataSet.monitorType;
|
|
23
|
+
const monitorView = dataSet === null || dataSet === void 0 ? void 0 : dataSet.monitorView;
|
|
24
|
+
switch (monitorType) {
|
|
25
|
+
case 'generated':
|
|
26
|
+
if (!monitorView || monitorView === 'DEFAULT') {
|
|
27
|
+
return html `<ox-data-sample-view .dataSample=${this.dataOoc}></ox-data-sample-view>`;
|
|
28
|
+
}
|
|
29
|
+
else if (monitorView === 'CHECKLIST') {
|
|
30
|
+
return html `<ox-checklist-sample-view .dataSample=${this.dataOoc}></ox-checklist-sample-view>`;
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
return html `<ox-data-sample-view .dataSample=${this.dataOoc}></ox-data-sample-view>`;
|
|
34
|
+
}
|
|
35
|
+
break;
|
|
36
|
+
case 'board':
|
|
37
|
+
break;
|
|
38
|
+
case 'page':
|
|
39
|
+
break;
|
|
40
|
+
default:
|
|
41
|
+
return html `<ox-data-sample-view .dataSample=${this.dataOoc}></ox-data-sample-view>`;
|
|
42
|
+
break;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
18
45
|
};
|
|
19
46
|
OxDataOocBriefView.styles = css `
|
|
20
47
|
:host {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ox-data-ooc-brief-view.js","sourceRoot":"","sources":["../../src/ox-data-ooc-brief-view.ts"],"names":[],"mappings":";AAAA,OAAO,iCAAiC,CAAA;AACxC,OAAO,uBAAuB,CAAA;AAC9B,OAAO,qBAAqB,CAAA;AAC5B,OAAO,+BAA+B,CAAA;AACtC,OAAO,4BAA4B,CAAA;AAEnC,OAAO,EAAE,GAAG,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AC,WAAW,IAAI,WAAW,KAAK,SAAS,EAAE,CAAC;oBAC9C,OAAO,IAAI,CAAA,oCAAoC,IAAI,CAAC,OAAO,yBAAyB,CAAA;gBACtF,CAAC;qBAAM,IAAI,WAAW,KAAK,WAAW,EAAE,CAAC;oBACvC,OAAO,IAAI,CAAA,yCAAyC,IAAI,CAAC,OAAO,8BAA8B,CAAA;gBAChG,CAAC;qBAAM,CAAC;oBACN,OAAO,IAAI,CAAA,oCAAoC,IAAI,CAAC,OAAO,yBAAyB,CAAA;gBACtF,CAAC;gBACD,MAAK;YACP,KAAK,OAAO;gBACV,MAAK;YACP,KAAK,MAAM;gBACT,MAAK;YACP;gBACE,OAAO,IAAI,CAAA,oCAAoC,IAAI,CAAC,OAAO,yBAAyB,CAAA;gBACpF,MAAK;QACT,CAAC;IACH,CAAC;;AAtDM,yBAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;GAgBlB,AAhBY,CAgBZ;AAE2B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;mDAAkB;AAnBlC,kBAAkB;IAD9B,aAAa,CAAC,wBAAwB,CAAC;GAC3B,kBAAkB,CAwD9B","sourcesContent":["import '@operato/input/ox-input-file.js'\nimport './ox-data-sample-view'\nimport './ox-data-ooc-badge'\nimport './ox-data-ooc-correction-part'\nimport '@material/web/icon/icon.js'\n\nimport { css, html, LitElement } from 'lit'\nimport { customElement, property } from 'lit/decorators.js'\n\nimport { DataOoc } from './types.js'\n\n@customElement('ox-data-ooc-brief-view')\nexport class OxDataOocBriefView extends LitElement {\n static styles = css`\n :host {\n display: flex;\n flex-direction: column;\n\n position: relative;\n }\n\n ox-data-ooc-badge {\n position: absolute;\n\n margin: 0;\n padding: 0;\n right: 10px;\n width: 90px;\n }\n `\n\n @property({ type: Object }) dataOoc?: DataOoc\n\n render() {\n const { state } = this.dataOoc || {}\n\n return html`\n ${this.showDataSampleView()}\n <!-- <ox-data-sample-view .dataSample=${this.dataOoc}></ox-data-sample-view> -->\n <ox-data-ooc-badge .state=${state}></ox-data-ooc-badge>\n <ox-data-ooc-correction-part .dataOoc=${this.dataOoc}></ox-data-ooc-correction-part>\n `\n }\n\n private showDataSampleView() {\n const dataSet = this.dataOoc?.dataSet\n const monitorType = dataSet?.monitorType\n const monitorView = dataSet?.monitorView\n\n switch (monitorType) {\n case 'generated':\n if (!monitorView || monitorView === 'DEFAULT') {\n return html`<ox-data-sample-view .dataSample=${this.dataOoc}></ox-data-sample-view>`\n } else if (monitorView === 'CHECKLIST') {\n return html`<ox-checklist-sample-view .dataSample=${this.dataOoc}></ox-checklist-sample-view>`\n } else {\n return html`<ox-data-sample-view .dataSample=${this.dataOoc}></ox-data-sample-view>`\n }\n break\n case 'board':\n break\n case 'page':\n break\n default:\n return html`<ox-data-sample-view .dataSample=${this.dataOoc}></ox-data-sample-view>`\n break\n }\n }\n}\n"]}
|
package/dist/src/types.d.ts
CHANGED
|
@@ -25,6 +25,7 @@ export type DataItem = {
|
|
|
25
25
|
sequence: number;
|
|
26
26
|
tag: string;
|
|
27
27
|
group: string;
|
|
28
|
+
subgroup: string;
|
|
28
29
|
type: string;
|
|
29
30
|
stat: string;
|
|
30
31
|
active: boolean;
|
|
@@ -48,6 +49,8 @@ export type DataSet = {
|
|
|
48
49
|
useCase: string;
|
|
49
50
|
active: boolean;
|
|
50
51
|
dataItems: DataItem[];
|
|
52
|
+
monitorType?: string;
|
|
53
|
+
monitorView?: string;
|
|
51
54
|
spec: {
|
|
52
55
|
[dataItem: string]: {
|
|
53
56
|
[useCase: string]: any;
|
|
@@ -117,6 +120,7 @@ export type DataSample = {
|
|
|
117
120
|
collectedAt?: Date;
|
|
118
121
|
reviewActivityInstance?: any;
|
|
119
122
|
dataOoc?: DataOoc;
|
|
123
|
+
dataSet?: DataSet;
|
|
120
124
|
};
|
|
121
125
|
export type DataOocState = 'ISSUED' | 'REVIEWED' | 'CORRECTED';
|
|
122
126
|
/**
|
|
@@ -126,6 +130,7 @@ export type DataOoc = DataSample & {
|
|
|
126
130
|
state?: DataOocState;
|
|
127
131
|
correctiveInstruction?: string;
|
|
128
132
|
correctiveAction?: string;
|
|
133
|
+
dataSet?: DataSet;
|
|
129
134
|
reviewer?: {
|
|
130
135
|
id: string;
|
|
131
136
|
name: string;
|
package/dist/src/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * Represents a selectable option with a text label and a value.\n */\nexport type SelectOption = {\n text: string\n value: string\n}\n/**\n * An array of selectable options.\n */\nexport type SelectOptions = SelectOption[]\n/**\n * Defines the options and additional properties for a type.\n */\nexport type TypeOptions = {\n options?: SelectOptions\n [prop: string]: any\n}\n/**\n * Describes the structure and properties of a data item.\n */\nexport type DataItem = {\n name: string\n description: string\n sequence: number\n tag: string\n group: string\n type: string\n stat: string\n active: boolean\n options: TypeOptions\n unit: string\n quota: number\n hidden: boolean\n spec: {\n [useCase: string]: {\n [limit: string]: number | string | string[] | boolean\n }\n }\n}\n/**\n * Defines the structure of a dataset, including its name, description, type, use case, and data items.\n */\nexport type DataSet = {\n name: string\n description: string\n type: 'manual' | 'automatic'\n useCase: string\n active: boolean\n dataItems: DataItem[]\n spec: {\n [dataItem: string]: {\n [useCase: string]: any\n }\n }\n}\n/**\n * Describes the definition of a data specification, including its type, label, name, and optional properties.\n */\nexport type DataSpecDefinition = {\n type: string\n label: string\n name: string\n property?: {\n [option: string]: any\n }\n}\n/**\n * Describes a use case definition, including its name, description, help text, and specifications.\n */\nexport type UseCaseDefinition = {\n name: string\n description: string\n help: string\n specs: DataSpecDefinition[]\n}\n/**\n * Represents the limits for a data specification.\n */\nexport type DataSpecLimit = {\n [limit: string]: number | string | string[] | boolean\n}\n/**\n * A set of data specification limits, keyed by use case.\n */\nexport type DataSpecLimitSet = {\n [useCase: string]: DataSpecLimit\n}\n/**\n * Represents a collection of data, keyed by a tag.\n */\nexport type DataCollection = {\n [tag: string]: any\n}\n/**\n * Represents a judgment on data, indicating if it is out of control or out of specification.\n */\nexport type Judgment = {\n [tag: string]: {\n ooc: boolean\n oos: boolean\n }\n}\n/**\n * Describes a data sample, including its name, description, use case, and associated data and judgments.\n */\nexport type DataSample = {\n name?: string\n description?: string\n useCase?: string\n data?: DataCollection\n judgment?: Judgment\n dataItems?: DataItem[]\n quota?: number\n workDate?: string\n workShift?: string\n collectedAt?: Date\n reviewActivityInstance?: any\n dataOoc?: DataOoc\n}\nexport type DataOocState = 'ISSUED' | 'REVIEWED' | 'CORRECTED'\n/**\n * Extends DataSample with additional fields specific to an out of control state, including state, corrective actions, and review history.\n */\nexport type DataOoc = DataSample & {\n state?: DataOocState\n correctiveInstruction?: string\n correctiveAction?: string\n reviewer?: {\n id: string\n name: string\n }\n reviewedAt?: Date\n corrector?: {\n id: string\n name: string\n }\n correctedAt?: Date\n history?: {\n user: {\n id: string\n name: string\n }\n state: DataOocState\n comment: string\n timestamp: number\n }[]\n resolveActivityInstance?: any\n}\n/**\n * Describes a summary of data, including its name, description, relevant data items, and key metrics.\n */\nexport type DataSummary = {\n name: string\n description: string\n dataItems?: DataItem[]\n date?: string\n period?: string\n key01?: string\n key02?: string\n key03?: string\n key04?: string\n key05?: string\n count?: number\n countOoc?: number\n countOos?: number\n useCase?: string\n summary?: {\n [key: string]: any\n }\n}\n/**\n * Represents the result of an evaluation, indicating if data is out of specification or out of control.\n */\nexport type EvaluationResult = {\n oos: boolean\n ooc: boolean\n}\n"]}
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * Represents a selectable option with a text label and a value.\n */\nexport type SelectOption = {\n text: string\n value: string\n}\n/**\n * An array of selectable options.\n */\nexport type SelectOptions = SelectOption[]\n/**\n * Defines the options and additional properties for a type.\n */\nexport type TypeOptions = {\n options?: SelectOptions\n [prop: string]: any\n}\n/**\n * Describes the structure and properties of a data item.\n */\nexport type DataItem = {\n name: string\n description: string\n sequence: number\n tag: string\n group: string\n subgroup: string\n type: string\n stat: string\n active: boolean\n options: TypeOptions\n unit: string\n quota: number\n hidden: boolean\n spec: {\n [useCase: string]: {\n [limit: string]: number | string | string[] | boolean\n }\n }\n}\n/**\n * Defines the structure of a dataset, including its name, description, type, use case, and data items.\n */\nexport type DataSet = {\n name: string\n description: string\n type: 'manual' | 'automatic'\n useCase: string\n active: boolean\n dataItems: DataItem[]\n monitorType?: string\n monitorView?: string\n spec: {\n [dataItem: string]: {\n [useCase: string]: any\n }\n }\n}\n/**\n * Describes the definition of a data specification, including its type, label, name, and optional properties.\n */\nexport type DataSpecDefinition = {\n type: string\n label: string\n name: string\n property?: {\n [option: string]: any\n }\n}\n/**\n * Describes a use case definition, including its name, description, help text, and specifications.\n */\nexport type UseCaseDefinition = {\n name: string\n description: string\n help: string\n specs: DataSpecDefinition[]\n}\n/**\n * Represents the limits for a data specification.\n */\nexport type DataSpecLimit = {\n [limit: string]: number | string | string[] | boolean\n}\n/**\n * A set of data specification limits, keyed by use case.\n */\nexport type DataSpecLimitSet = {\n [useCase: string]: DataSpecLimit\n}\n/**\n * Represents a collection of data, keyed by a tag.\n */\nexport type DataCollection = {\n [tag: string]: any\n}\n/**\n * Represents a judgment on data, indicating if it is out of control or out of specification.\n */\nexport type Judgment = {\n [tag: string]: {\n ooc: boolean\n oos: boolean\n }\n}\n/**\n * Describes a data sample, including its name, description, use case, and associated data and judgments.\n */\nexport type DataSample = {\n name?: string\n description?: string\n useCase?: string\n data?: DataCollection\n judgment?: Judgment\n dataItems?: DataItem[]\n quota?: number\n workDate?: string\n workShift?: string\n collectedAt?: Date\n reviewActivityInstance?: any\n dataOoc?: DataOoc\n dataSet?: DataSet\n}\nexport type DataOocState = 'ISSUED' | 'REVIEWED' | 'CORRECTED'\n/**\n * Extends DataSample with additional fields specific to an out of control state, including state, corrective actions, and review history.\n */\nexport type DataOoc = DataSample & {\n state?: DataOocState\n correctiveInstruction?: string\n correctiveAction?: string\n dataSet?: DataSet\n reviewer?: {\n id: string\n name: string\n }\n reviewedAt?: Date\n corrector?: {\n id: string\n name: string\n }\n correctedAt?: Date\n history?: {\n user: {\n id: string\n name: string\n }\n state: DataOocState\n comment: string\n timestamp: number\n }[]\n resolveActivityInstance?: any\n}\n/**\n * Describes a summary of data, including its name, description, relevant data items, and key metrics.\n */\nexport type DataSummary = {\n name: string\n description: string\n dataItems?: DataItem[]\n date?: string\n period?: string\n key01?: string\n key02?: string\n key03?: string\n key04?: string\n key05?: string\n count?: number\n countOoc?: number\n countOos?: number\n useCase?: string\n summary?: {\n [key: string]: any\n }\n}\n/**\n * Represents the result of an evaluation, indicating if data is out of specification or out of control.\n */\nexport type EvaluationResult = {\n oos: boolean\n ooc: boolean\n}\n"]}
|