@things-factory/kpi 9.0.22 → 9.0.24
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/client/pages/kpi/kpi-list-page.ts +180 -22
- package/client/pages/kpi/kpi-viz-editor.ts +1 -1
- package/client/pages/kpi-category/kpi-category-list-page.ts +76 -3
- package/client/pages/kpi-category/kpi-category-value-calculator.ts +233 -0
- package/client/pages/kpi-category-value/kpi-category-value-list-page.ts +404 -0
- package/client/pages/kpi-metric/kpi-metric-list-page.ts +13 -1
- package/client/pages/kpi-metric-value/kpi-metric-value-editor-page.ts +763 -0
- package/client/pages/kpi-metric-value/kpi-metric-value-list-page.ts +55 -1
- package/client/pages/kpi-metric-value/kpi-metric-value-manual-entry-form.ts +3 -13
- package/client/pages/kpi-metric-value/kpi-metric-value-manual-entry-page.ts +13 -1
- package/client/pages/kpi-value/kpi-value-editor-page.ts +774 -0
- package/client/pages/kpi-value/kpi-value-list-page.ts +58 -1
- package/client/route.ts +16 -0
- package/dist-client/pages/kpi/kpi-list-page.d.ts +2 -1
- package/dist-client/pages/kpi/kpi-list-page.js +180 -22
- package/dist-client/pages/kpi/kpi-list-page.js.map +1 -1
- package/dist-client/pages/kpi/kpi-viz-editor.d.ts +0 -1
- package/dist-client/pages/kpi/kpi-viz-editor.js +1 -1
- package/dist-client/pages/kpi/kpi-viz-editor.js.map +1 -1
- package/dist-client/pages/kpi-category/kpi-category-list-page.d.ts +3 -0
- package/dist-client/pages/kpi-category/kpi-category-list-page.js +71 -3
- package/dist-client/pages/kpi-category/kpi-category-list-page.js.map +1 -1
- package/dist-client/pages/kpi-category/kpi-category-value-calculator.d.ts +13 -0
- package/dist-client/pages/kpi-category/kpi-category-value-calculator.js +256 -0
- package/dist-client/pages/kpi-category/kpi-category-value-calculator.js.map +1 -0
- package/dist-client/pages/kpi-category-value/kpi-category-value-list-page.d.ts +63 -0
- package/dist-client/pages/kpi-category-value/kpi-category-value-list-page.js +393 -0
- package/dist-client/pages/kpi-category-value/kpi-category-value-list-page.js.map +1 -0
- package/dist-client/pages/kpi-metric/kpi-metric-list-page.js +13 -1
- package/dist-client/pages/kpi-metric/kpi-metric-list-page.js.map +1 -1
- package/dist-client/pages/kpi-metric-value/kpi-metric-value-editor-page.d.ts +58 -0
- package/dist-client/pages/kpi-metric-value/kpi-metric-value-editor-page.js +736 -0
- package/dist-client/pages/kpi-metric-value/kpi-metric-value-editor-page.js.map +1 -0
- package/dist-client/pages/kpi-metric-value/kpi-metric-value-list-page.d.ts +5 -1
- package/dist-client/pages/kpi-metric-value/kpi-metric-value-list-page.js +50 -2
- package/dist-client/pages/kpi-metric-value/kpi-metric-value-list-page.js.map +1 -1
- package/dist-client/pages/kpi-metric-value/kpi-metric-value-manual-entry-form.js +3 -13
- package/dist-client/pages/kpi-metric-value/kpi-metric-value-manual-entry-form.js.map +1 -1
- package/dist-client/pages/kpi-metric-value/kpi-metric-value-manual-entry-page.js +13 -1
- package/dist-client/pages/kpi-metric-value/kpi-metric-value-manual-entry-page.js.map +1 -1
- package/dist-client/pages/kpi-value/kpi-value-editor-page.d.ts +55 -0
- package/dist-client/pages/kpi-value/kpi-value-editor-page.js +748 -0
- package/dist-client/pages/kpi-value/kpi-value-editor-page.js.map +1 -0
- package/dist-client/pages/kpi-value/kpi-value-list-page.d.ts +10 -2
- package/dist-client/pages/kpi-value/kpi-value-list-page.js +57 -1
- package/dist-client/pages/kpi-value/kpi-value-list-page.js.map +1 -1
- package/dist-client/route.d.ts +1 -1
- package/dist-client/route.js +12 -0
- package/dist-client/route.js.map +1 -1
- package/dist-client/tsconfig.tsbuildinfo +1 -1
- package/dist-server/calculator/evaluator.d.ts +8 -0
- package/dist-server/calculator/evaluator.js +42 -0
- package/dist-server/calculator/evaluator.js.map +1 -0
- package/dist-server/calculator/functions.d.ts +3 -0
- package/dist-server/calculator/functions.js +62 -0
- package/dist-server/calculator/functions.js.map +1 -0
- package/dist-server/calculator/index.d.ts +4 -0
- package/dist-server/calculator/index.js +8 -0
- package/dist-server/calculator/index.js.map +1 -0
- package/dist-server/calculator/parser.d.ts +21 -0
- package/dist-server/calculator/parser.js +121 -0
- package/dist-server/calculator/parser.js.map +1 -0
- package/dist-server/calculator/provider.d.ts +8 -0
- package/dist-server/calculator/provider.js +13 -0
- package/dist-server/calculator/provider.js.map +1 -0
- package/dist-server/controllers/kpi-metric-value-provider.d.ts +11 -0
- package/dist-server/controllers/kpi-metric-value-provider.js +63 -0
- package/dist-server/controllers/kpi-metric-value-provider.js.map +1 -0
- package/dist-server/controllers/kpi-value-provider.d.ts +11 -0
- package/dist-server/controllers/kpi-value-provider.js +46 -0
- package/dist-server/controllers/kpi-value-provider.js.map +1 -0
- package/dist-server/service/index.d.ts +4 -2
- package/dist-server/service/index.js +5 -0
- package/dist-server/service/index.js.map +1 -1
- package/dist-server/service/kpi/aggregate-kpi.js +4 -4
- package/dist-server/service/kpi/aggregate-kpi.js.map +1 -1
- package/dist-server/service/kpi/kpi-grade.types.d.ts +11 -10
- package/dist-server/service/kpi/kpi-grade.types.js.map +1 -1
- package/dist-server/service/kpi/kpi-history.d.ts +2 -2
- package/dist-server/service/kpi/kpi-history.js.map +1 -1
- package/dist-server/service/kpi/kpi-mutation.d.ts +2 -0
- package/dist-server/service/kpi/kpi-mutation.js +126 -4
- package/dist-server/service/kpi/kpi-mutation.js.map +1 -1
- package/dist-server/service/kpi/kpi-type.d.ts +8 -5
- package/dist-server/service/kpi/kpi-type.js +22 -8
- package/dist-server/service/kpi/kpi-type.js.map +1 -1
- package/dist-server/service/kpi/kpi.d.ts +6 -3
- package/dist-server/service/kpi/kpi.js +29 -9
- package/dist-server/service/kpi/kpi.js.map +1 -1
- package/dist-server/service/kpi-category/kpi-category-mutation.d.ts +3 -4
- package/dist-server/service/kpi-category/kpi-category-mutation.js +151 -80
- package/dist-server/service/kpi-category/kpi-category-mutation.js.map +1 -1
- package/dist-server/service/kpi-category/kpi-category-query.d.ts +5 -0
- package/dist-server/service/kpi-category/kpi-category-query.js +19 -1
- package/dist-server/service/kpi-category/kpi-category-query.js.map +1 -1
- package/dist-server/service/kpi-category/kpi-category-type.d.ts +3 -0
- package/dist-server/service/kpi-category/kpi-category-type.js +16 -1
- package/dist-server/service/kpi-category/kpi-category-type.js.map +1 -1
- package/dist-server/service/kpi-category/kpi-category.d.ts +2 -0
- package/dist-server/service/kpi-category/kpi-category.js +10 -1
- package/dist-server/service/kpi-category/kpi-category.js.map +1 -1
- package/dist-server/service/kpi-category-value/index.d.ts +6 -0
- package/dist-server/service/kpi-category-value/index.js +10 -0
- package/dist-server/service/kpi-category-value/index.js.map +1 -0
- package/dist-server/service/kpi-category-value/kpi-category-value-mutation.d.ts +8 -0
- package/dist-server/service/kpi-category-value/kpi-category-value-mutation.js +102 -0
- package/dist-server/service/kpi-category-value/kpi-category-value-mutation.js.map +1 -0
- package/dist-server/service/kpi-category-value/kpi-category-value-query.d.ts +13 -0
- package/dist-server/service/kpi-category-value/kpi-category-value-query.js +91 -0
- package/dist-server/service/kpi-category-value/kpi-category-value-query.js.map +1 -0
- package/dist-server/service/kpi-category-value/kpi-category-value-type.d.ts +19 -0
- package/dist-server/service/kpi-category-value/kpi-category-value-type.js +73 -0
- package/dist-server/service/kpi-category-value/kpi-category-value-type.js.map +1 -0
- package/dist-server/service/kpi-category-value/kpi-category-value.d.ts +19 -0
- package/dist-server/service/kpi-category-value/kpi-category-value.js +91 -0
- package/dist-server/service/kpi-category-value/kpi-category-value.js.map +1 -0
- package/dist-server/service/kpi-metric/kpi-metric-type.d.ts +5 -3
- package/dist-server/service/kpi-metric/kpi-metric-type.js +5 -3
- package/dist-server/service/kpi-metric/kpi-metric-type.js.map +1 -1
- package/dist-server/service/kpi-metric/kpi-metric.d.ts +2 -8
- package/dist-server/service/kpi-metric/kpi-metric.js +3 -14
- package/dist-server/service/kpi-metric/kpi-metric.js.map +1 -1
- package/dist-server/service/kpi-metric-value/kpi-metric-value-mutation.js +87 -45
- package/dist-server/service/kpi-metric-value/kpi-metric-value-mutation.js.map +1 -1
- package/dist-server/service/kpi-metric-value/kpi-metric-value.js +3 -2
- package/dist-server/service/kpi-metric-value/kpi-metric-value.js.map +1 -1
- package/dist-server/service/kpi-value/kpi-value-mutation.d.ts +3 -1
- package/dist-server/service/kpi-value/kpi-value-mutation.js +174 -6
- package/dist-server/service/kpi-value/kpi-value-mutation.js.map +1 -1
- package/dist-server/service/kpi-value/kpi-value-query.d.ts +0 -2
- package/dist-server/service/kpi-value/kpi-value-query.js +0 -12
- package/dist-server/service/kpi-value/kpi-value-query.js.map +1 -1
- package/dist-server/service/kpi-value/kpi-value-score.service.d.ts +26 -0
- package/dist-server/service/kpi-value/kpi-value-score.service.js +97 -0
- package/dist-server/service/kpi-value/kpi-value-score.service.js.map +1 -0
- package/dist-server/service/kpi-value/kpi-value-type.d.ts +2 -0
- package/dist-server/service/kpi-value/kpi-value-type.js +14 -0
- package/dist-server/service/kpi-value/kpi-value-type.js.map +1 -1
- package/dist-server/service/kpi-value/kpi-value.d.ts +1 -0
- package/dist-server/service/kpi-value/kpi-value.js +9 -1
- package/dist-server/service/kpi-value/kpi-value.js.map +1 -1
- package/dist-server/service/utils/value-date-util.d.ts +3 -0
- package/dist-server/service/utils/value-date-util.js +76 -0
- package/dist-server/service/utils/value-date-util.js.map +1 -0
- package/dist-server/tsconfig.tsbuildinfo +1 -1
- package/package.json +5 -5
- package/server/calculator/evaluator.ts +45 -0
- package/server/calculator/functions.ts +67 -0
- package/server/calculator/index.ts +4 -0
- package/server/calculator/parser.ts +128 -0
- package/server/calculator/provider.ts +10 -0
- package/server/controllers/kpi-metric-value-provider.ts +66 -0
- package/server/controllers/kpi-value-provider.ts +51 -0
- package/server/service/index.ts +5 -0
- package/server/service/kpi/aggregate-kpi.ts +4 -4
- package/server/service/kpi/kpi-grade.types.ts +11 -10
- package/server/service/kpi/kpi-history.ts +2 -2
- package/server/service/kpi/kpi-mutation.ts +128 -4
- package/server/service/kpi/kpi-type.ts +21 -9
- package/server/service/kpi/kpi.ts +32 -10
- package/server/service/kpi-category/kpi-category-mutation.ts +155 -82
- package/server/service/kpi-category/kpi-category-query.ts +21 -1
- package/server/service/kpi-category/kpi-category-type.ts +17 -6
- package/server/service/kpi-category/kpi-category.ts +10 -1
- package/server/service/kpi-category-value/index.ts +7 -0
- package/server/service/kpi-category-value/kpi-category-value-mutation.ts +88 -0
- package/server/service/kpi-category-value/kpi-category-value-query.ts +62 -0
- package/server/service/kpi-category-value/kpi-category-value-type.ts +48 -0
- package/server/service/kpi-category-value/kpi-category-value.ts +79 -0
- package/server/service/kpi-metric/kpi-metric-type.ts +7 -5
- package/server/service/kpi-metric/kpi-metric.ts +3 -15
- package/server/service/kpi-metric-value/kpi-metric-value-mutation.ts +95 -47
- package/server/service/kpi-metric-value/kpi-metric-value.ts +4 -2
- package/server/service/kpi-value/kpi-value-mutation.ts +176 -6
- package/server/service/kpi-value/kpi-value-query.ts +2 -8
- package/server/service/kpi-value/kpi-value-score.service.ts +112 -0
- package/server/service/kpi-value/kpi-value-type.ts +12 -0
- package/server/service/kpi-value/kpi-value.ts +8 -1
- package/server/service/utils/value-date-util.ts +72 -0
- package/things-factory.config.js +3 -0
- package/translations/en.json +3 -0
- package/translations/ja.json +3 -0
- package/translations/ko.json +3 -0
- package/translations/ms.json +3 -0
- package/translations/zh.json +3 -0
- package/dist-server/service/kpi-value/kpi-value-grade.service.d.ts +0 -34
- package/dist-server/service/kpi-value/kpi-value-grade.service.js +0 -117
- package/dist-server/service/kpi-value/kpi-value-grade.service.js.map +0 -1
- package/server/service/kpi-value/kpi-value-grade.service.ts +0 -127
|
@@ -0,0 +1,393 @@
|
|
|
1
|
+
import { __decorate, __metadata } from "tslib";
|
|
2
|
+
import '@material/web/icon/icon.js';
|
|
3
|
+
import '@material/web/button/elevated-button.js';
|
|
4
|
+
import '@operato/data-grist/ox-grist.js';
|
|
5
|
+
import '@operato/data-grist/ox-filters-form.js';
|
|
6
|
+
import '@operato/data-grist/ox-record-creator.js';
|
|
7
|
+
import { CommonButtonStyles, CommonHeaderStyles, CommonGristStyles, ScrollbarStyles } from '@operato/styles';
|
|
8
|
+
import { PageView, store } from '@operato/shell';
|
|
9
|
+
import { css, html } from 'lit';
|
|
10
|
+
import { customElement, property, query } from 'lit/decorators.js';
|
|
11
|
+
import { ScopedElementsMixin } from '@open-wc/scoped-elements';
|
|
12
|
+
import { DataGrist } from '@operato/data-grist';
|
|
13
|
+
import { client } from '@operato/graphql';
|
|
14
|
+
import { i18next, localize } from '@operato/i18n';
|
|
15
|
+
import { notify, openPopup } from '@operato/layout';
|
|
16
|
+
import { OxPrompt } from '@operato/popup';
|
|
17
|
+
import { isMobileDevice } from '@operato/utils';
|
|
18
|
+
import { connect } from 'pwa-helpers/connect-mixin';
|
|
19
|
+
import gql from 'graphql-tag';
|
|
20
|
+
let KpiCategoryValueListPage = class KpiCategoryValueListPage extends connect(store)(localize(i18next)(ScopedElementsMixin(PageView))) {
|
|
21
|
+
constructor() {
|
|
22
|
+
super(...arguments);
|
|
23
|
+
this.mode = isMobileDevice() ? 'CARD' : 'GRID';
|
|
24
|
+
}
|
|
25
|
+
static { this.styles = [
|
|
26
|
+
ScrollbarStyles,
|
|
27
|
+
CommonGristStyles,
|
|
28
|
+
CommonHeaderStyles,
|
|
29
|
+
css `
|
|
30
|
+
:host {
|
|
31
|
+
display: flex;
|
|
32
|
+
|
|
33
|
+
width: 100%;
|
|
34
|
+
|
|
35
|
+
--grid-record-emphasized-background-color: #8b0000;
|
|
36
|
+
--grid-record-emphasized-color: #ff6b6b;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
ox-grist {
|
|
40
|
+
overflow-y: auto;
|
|
41
|
+
flex: 1;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
ox-filters-form {
|
|
45
|
+
flex: 1;
|
|
46
|
+
}
|
|
47
|
+
`
|
|
48
|
+
]; }
|
|
49
|
+
get context() {
|
|
50
|
+
return {
|
|
51
|
+
title: i18next.t('title.kpi category value list'),
|
|
52
|
+
search: {
|
|
53
|
+
handler: (search) => {
|
|
54
|
+
this.grist.searchText = search;
|
|
55
|
+
},
|
|
56
|
+
value: this.grist.searchText
|
|
57
|
+
},
|
|
58
|
+
filter: {
|
|
59
|
+
handler: () => {
|
|
60
|
+
this.grist.toggleHeadroom();
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
help: 'kpi/kpi-category-value',
|
|
64
|
+
actions: [
|
|
65
|
+
{
|
|
66
|
+
title: i18next.t('button.save'),
|
|
67
|
+
action: this._updateKpiCategoryValue.bind(this),
|
|
68
|
+
...CommonButtonStyles.save
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
title: i18next.t('button.delete'),
|
|
72
|
+
action: this._deleteKpiCategoryValue.bind(this),
|
|
73
|
+
...CommonButtonStyles.delete
|
|
74
|
+
}
|
|
75
|
+
],
|
|
76
|
+
exportable: {
|
|
77
|
+
name: i18next.t('title.kpi category value list'),
|
|
78
|
+
data: this.exportHandler.bind(this)
|
|
79
|
+
},
|
|
80
|
+
importable: {
|
|
81
|
+
handler: this.importHandler.bind(this)
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
render() {
|
|
86
|
+
const mode = this.mode || (isMobileDevice() ? 'CARD' : 'GRID');
|
|
87
|
+
return html `
|
|
88
|
+
<ox-grist .mode=${mode} .config=${this.gristConfig} .fetchHandler=${this.fetchHandler.bind(this)}>
|
|
89
|
+
<div slot="headroom" class="header">
|
|
90
|
+
<div class="filters">
|
|
91
|
+
<ox-filters-form autofocus without-search></ox-filters-form>
|
|
92
|
+
|
|
93
|
+
<div id="modes">
|
|
94
|
+
<md-icon @click=${() => (this.mode = 'GRID')} ?active=${mode == 'GRID'}>grid_on</md-icon>
|
|
95
|
+
<md-icon @click=${() => (this.mode = 'LIST')} ?active=${mode == 'LIST'}>format_list_bulleted</md-icon>
|
|
96
|
+
<md-icon @click=${() => (this.mode = 'CARD')} ?active=${mode == 'CARD'}>apps</md-icon>
|
|
97
|
+
</div>
|
|
98
|
+
|
|
99
|
+
<ox-record-creator id="add" .callback=${this.creationCallback.bind(this)}>
|
|
100
|
+
<button>
|
|
101
|
+
<md-icon>add</md-icon>
|
|
102
|
+
</button>
|
|
103
|
+
</ox-record-creator>
|
|
104
|
+
</div>
|
|
105
|
+
</div>
|
|
106
|
+
</ox-grist>
|
|
107
|
+
`;
|
|
108
|
+
}
|
|
109
|
+
async pageInitialized(lifecycle) {
|
|
110
|
+
this.gristConfig = {
|
|
111
|
+
list: {
|
|
112
|
+
fields: ['category', 'valueDate', 'score', 'group', 'createdAt', 'updatedAt', 'creator', 'updater'],
|
|
113
|
+
details: ['category', 'valueDate', 'score', 'group', 'createdAt', 'updatedAt', 'creator', 'updater']
|
|
114
|
+
},
|
|
115
|
+
columns: [
|
|
116
|
+
{ type: 'gutter', gutterName: 'sequence' },
|
|
117
|
+
{ type: 'gutter', gutterName: 'row-selector', multiple: true },
|
|
118
|
+
// KPI Category Value 계산 버튼 추가
|
|
119
|
+
{
|
|
120
|
+
type: 'gutter',
|
|
121
|
+
gutterName: 'button',
|
|
122
|
+
icon: 'calculate',
|
|
123
|
+
title: '계산',
|
|
124
|
+
handlers: {
|
|
125
|
+
click: (columns, data, column, record, rowIndex) => {
|
|
126
|
+
this._calculateKpiCategoryValue(record);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
type: 'string',
|
|
132
|
+
name: 'category',
|
|
133
|
+
header: '카테고리',
|
|
134
|
+
record: { editable: false, renderer: (v, c, r) => r.category?.name },
|
|
135
|
+
width: 150
|
|
136
|
+
},
|
|
137
|
+
{ type: 'string', name: 'valueDate', header: '실적일', record: { editable: true }, width: 120 },
|
|
138
|
+
{ type: 'number', name: 'score', header: '성과점수', record: { editable: false }, width: 120 },
|
|
139
|
+
{ type: 'string', name: 'group', header: '그룹', record: { editable: false }, width: 120 },
|
|
140
|
+
{ type: 'datetime', name: 'createdAt', header: '생성일', record: { editable: false }, width: 180 },
|
|
141
|
+
{ type: 'datetime', name: 'updatedAt', header: '수정일', record: { editable: false }, width: 180 },
|
|
142
|
+
{
|
|
143
|
+
type: 'resource-object',
|
|
144
|
+
name: 'creator',
|
|
145
|
+
header: '생성자',
|
|
146
|
+
record: { editable: false, renderer: (v, c, r) => r.creator?.name },
|
|
147
|
+
width: 120
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
type: 'resource-object',
|
|
151
|
+
name: 'updater',
|
|
152
|
+
header: '수정자',
|
|
153
|
+
record: { editable: false, renderer: (v, c, r) => r.updater?.name },
|
|
154
|
+
width: 120
|
|
155
|
+
}
|
|
156
|
+
]
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
async pageUpdated(changes, lifecycle) {
|
|
160
|
+
if (changes.has('mode')) {
|
|
161
|
+
this.grist.mode = this.mode;
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
async fetchHandler({ page = 1, limit = 100, sortings = [], filters = [] }) {
|
|
165
|
+
const response = await client.query({
|
|
166
|
+
query: gql `
|
|
167
|
+
query ($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) {
|
|
168
|
+
responses: kpiCategoryValues(filters: $filters, pagination: $pagination, sortings: $sortings) {
|
|
169
|
+
items {
|
|
170
|
+
id
|
|
171
|
+
category {
|
|
172
|
+
id
|
|
173
|
+
name
|
|
174
|
+
}
|
|
175
|
+
valueDate
|
|
176
|
+
score
|
|
177
|
+
group
|
|
178
|
+
updater {
|
|
179
|
+
id
|
|
180
|
+
name
|
|
181
|
+
}
|
|
182
|
+
updatedAt
|
|
183
|
+
creator {
|
|
184
|
+
id
|
|
185
|
+
name
|
|
186
|
+
}
|
|
187
|
+
createdAt
|
|
188
|
+
}
|
|
189
|
+
total
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
`,
|
|
193
|
+
variables: {
|
|
194
|
+
filters,
|
|
195
|
+
pagination: { page, limit },
|
|
196
|
+
sortings
|
|
197
|
+
}
|
|
198
|
+
});
|
|
199
|
+
return {
|
|
200
|
+
total: response.data.responses.total || 0,
|
|
201
|
+
records: response.data.responses.items || []
|
|
202
|
+
};
|
|
203
|
+
}
|
|
204
|
+
async _deleteKpiCategoryValue() {
|
|
205
|
+
if (await OxPrompt.open({
|
|
206
|
+
title: i18next.t('text.are_you_sure'),
|
|
207
|
+
text: i18next.t('text.sure_to_x', { x: i18next.t('text.delete') }),
|
|
208
|
+
confirmButton: { text: i18next.t('button.confirm') },
|
|
209
|
+
cancelButton: { text: i18next.t('button.cancel') }
|
|
210
|
+
})) {
|
|
211
|
+
const ids = this.grist.selected.map(record => record.id);
|
|
212
|
+
if (ids && ids.length > 0) {
|
|
213
|
+
const response = await client.mutate({
|
|
214
|
+
mutation: gql `
|
|
215
|
+
mutation ($ids: [String!]!) {
|
|
216
|
+
deleteKpiCategoryValues(ids: $ids)
|
|
217
|
+
}
|
|
218
|
+
`,
|
|
219
|
+
variables: {
|
|
220
|
+
ids
|
|
221
|
+
}
|
|
222
|
+
});
|
|
223
|
+
if (!response.errors) {
|
|
224
|
+
this.grist.fetch();
|
|
225
|
+
notify({
|
|
226
|
+
message: i18next.t('text.info_x_successfully', { x: i18next.t('text.delete') })
|
|
227
|
+
});
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
async _updateKpiCategoryValue() {
|
|
233
|
+
let patches = this.grist.dirtyRecords;
|
|
234
|
+
if (patches && patches.length) {
|
|
235
|
+
patches = patches.map(patch => {
|
|
236
|
+
let patchField = patch.id ? { id: patch.id } : {};
|
|
237
|
+
const dirtyFields = patch.__dirtyfields__;
|
|
238
|
+
for (let key in dirtyFields) {
|
|
239
|
+
patchField[key] = dirtyFields[key].after;
|
|
240
|
+
}
|
|
241
|
+
patchField.cuFlag = patch.__dirty__;
|
|
242
|
+
return patchField;
|
|
243
|
+
});
|
|
244
|
+
const response = await client.mutate({
|
|
245
|
+
mutation: gql `
|
|
246
|
+
mutation ($patches: [KpiCategoryValuePatch!]!) {
|
|
247
|
+
updateMultipleKpiCategoryValue(patches: $patches) {
|
|
248
|
+
id
|
|
249
|
+
category {
|
|
250
|
+
id
|
|
251
|
+
name
|
|
252
|
+
}
|
|
253
|
+
valueDate
|
|
254
|
+
score
|
|
255
|
+
group
|
|
256
|
+
updater {
|
|
257
|
+
id
|
|
258
|
+
name
|
|
259
|
+
}
|
|
260
|
+
updatedAt
|
|
261
|
+
creator {
|
|
262
|
+
id
|
|
263
|
+
name
|
|
264
|
+
}
|
|
265
|
+
createdAt
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
`,
|
|
269
|
+
variables: {
|
|
270
|
+
patches
|
|
271
|
+
}
|
|
272
|
+
});
|
|
273
|
+
if (!response.errors) {
|
|
274
|
+
this.grist.fetch();
|
|
275
|
+
notify({
|
|
276
|
+
message: i18next.t('text.info_x_successfully', { x: i18next.t('text.save') })
|
|
277
|
+
});
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
async _calculateKpiCategoryValue(kpiCategoryValue) {
|
|
282
|
+
try {
|
|
283
|
+
const response = await client.mutate({
|
|
284
|
+
mutation: gql `
|
|
285
|
+
mutation ($categoryId: String!, $valueDate: String, $group: String) {
|
|
286
|
+
calculateKpiValue(categoryId: $categoryId, valueDate: $valueDate, group: $group) {
|
|
287
|
+
score
|
|
288
|
+
valueDate
|
|
289
|
+
group
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
`,
|
|
293
|
+
variables: {
|
|
294
|
+
categoryId: kpiCategoryValue.category.id,
|
|
295
|
+
valueDate: kpiCategoryValue.valueDate,
|
|
296
|
+
group: kpiCategoryValue.group
|
|
297
|
+
}
|
|
298
|
+
});
|
|
299
|
+
if (!response.errors) {
|
|
300
|
+
const result = response.data.calculateKpiValue;
|
|
301
|
+
// 팝업으로 결과 표시
|
|
302
|
+
await openPopup(html `
|
|
303
|
+
<div style="padding: 20px;">
|
|
304
|
+
<h3>KPI Category Value 계산 결과</h3>
|
|
305
|
+
<p><strong>성과점수:</strong> ${result.score || 'N/A'}</p>
|
|
306
|
+
<p><strong>실적일:</strong> ${result.valueDate || 'N/A'}</p>
|
|
307
|
+
<p><strong>그룹:</strong> ${result.group || 'N/A'}</p>
|
|
308
|
+
</div>
|
|
309
|
+
`);
|
|
310
|
+
// 목록 새로고침
|
|
311
|
+
this.grist.fetch();
|
|
312
|
+
notify({
|
|
313
|
+
message: 'KPI Category Value 계산이 완료되었습니다.'
|
|
314
|
+
});
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
catch (error) {
|
|
318
|
+
console.error('KPI Category Value 계산 중 오류:', error);
|
|
319
|
+
notify({
|
|
320
|
+
message: 'KPI Category Value 계산 중 오류가 발생했습니다.'
|
|
321
|
+
});
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
async creationCallback(kpiCategoryValue) {
|
|
325
|
+
const response = await client.mutate({
|
|
326
|
+
mutation: gql `
|
|
327
|
+
mutation ($kpiCategoryValue: NewKpiCategoryValue!) {
|
|
328
|
+
createKpiCategoryValue(kpiCategoryValue: $kpiCategoryValue) {
|
|
329
|
+
id
|
|
330
|
+
category {
|
|
331
|
+
id
|
|
332
|
+
name
|
|
333
|
+
}
|
|
334
|
+
valueDate
|
|
335
|
+
score
|
|
336
|
+
group
|
|
337
|
+
updater {
|
|
338
|
+
id
|
|
339
|
+
name
|
|
340
|
+
}
|
|
341
|
+
updatedAt
|
|
342
|
+
creator {
|
|
343
|
+
id
|
|
344
|
+
name
|
|
345
|
+
}
|
|
346
|
+
createdAt
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
`,
|
|
350
|
+
variables: {
|
|
351
|
+
kpiCategoryValue
|
|
352
|
+
}
|
|
353
|
+
});
|
|
354
|
+
if (!response.errors) {
|
|
355
|
+
this.grist.fetch();
|
|
356
|
+
notify({
|
|
357
|
+
message: i18next.t('text.info_x_successfully', { x: i18next.t('text.create') })
|
|
358
|
+
});
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
async exportHandler() {
|
|
362
|
+
// 임시로 빈 배열 반환
|
|
363
|
+
return [];
|
|
364
|
+
}
|
|
365
|
+
async importHandler(records) {
|
|
366
|
+
const kpiCategoryValues = records.map(record => ({
|
|
367
|
+
categoryId: record.category?.id || record.category,
|
|
368
|
+
valueDate: record.valueDate,
|
|
369
|
+
score: record.score,
|
|
370
|
+
group: record.group
|
|
371
|
+
}));
|
|
372
|
+
for (const kpiCategoryValue of kpiCategoryValues) {
|
|
373
|
+
await this.creationCallback(kpiCategoryValue);
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
};
|
|
377
|
+
__decorate([
|
|
378
|
+
property({ type: Object }),
|
|
379
|
+
__metadata("design:type", Object)
|
|
380
|
+
], KpiCategoryValueListPage.prototype, "gristConfig", void 0);
|
|
381
|
+
__decorate([
|
|
382
|
+
property({ type: String }),
|
|
383
|
+
__metadata("design:type", String)
|
|
384
|
+
], KpiCategoryValueListPage.prototype, "mode", void 0);
|
|
385
|
+
__decorate([
|
|
386
|
+
query('ox-grist'),
|
|
387
|
+
__metadata("design:type", DataGrist)
|
|
388
|
+
], KpiCategoryValueListPage.prototype, "grist", void 0);
|
|
389
|
+
KpiCategoryValueListPage = __decorate([
|
|
390
|
+
customElement('kpi-category-value-list-page')
|
|
391
|
+
], KpiCategoryValueListPage);
|
|
392
|
+
export { KpiCategoryValueListPage };
|
|
393
|
+
//# sourceMappingURL=kpi-category-value-list-page.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"kpi-category-value-list-page.js","sourceRoot":"","sources":["../../../client/pages/kpi-category-value/kpi-category-value-list-page.ts"],"names":[],"mappings":";AAAA,OAAO,4BAA4B,CAAA;AACnC,OAAO,yCAAyC,CAAA;AAChD,OAAO,iCAAiC,CAAA;AACxC,OAAO,wCAAwC,CAAA;AAC/C,OAAO,0CAA0C,CAAA;A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,UAAU,EAAE,MAAM,CAAC,QAAQ,EAAE,EAAE,IAAI,MAAM,CAAC,QAAQ;YAClD,SAAS,EAAE,MAAM,CAAC,SAAS;YAC3B,KAAK,EAAE,MAAM,CAAC,KAAK;YACnB,KAAK,EAAE,MAAM,CAAC,KAAK;SACpB,CAAC,CAAC,CAAA;QAEH,KAAK,MAAM,gBAAgB,IAAI,iBAAiB,EAAE,CAAC;YACjD,MAAM,IAAI,CAAC,gBAAgB,CAAC,gBAAgB,CAAC,CAAA;QAC/C,CAAC;IACH,CAAC;;AAlW2B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;6DAAiB;AAChB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;sDAAoE;AAEpE;IAA1B,KAAK,CAAC,UAAU,CAAC;8BAAiB,SAAS;uDAAA;AA7BjC,wBAAwB;IADpC,aAAa,CAAC,8BAA8B,CAAC;GACjC,wBAAwB,CA6XpC","sourcesContent":["import '@material/web/icon/icon.js'\nimport '@material/web/button/elevated-button.js'\nimport '@operato/data-grist/ox-grist.js'\nimport '@operato/data-grist/ox-filters-form.js'\nimport '@operato/data-grist/ox-record-creator.js'\n\nimport { CommonButtonStyles, CommonHeaderStyles, CommonGristStyles, ScrollbarStyles } from '@operato/styles'\nimport { PageView, store } from '@operato/shell'\nimport { css, html } from 'lit'\nimport { customElement, property, query } from 'lit/decorators.js'\nimport { ScopedElementsMixin } from '@open-wc/scoped-elements'\nimport { ColumnConfig, DataGrist, FetchOption } from '@operato/data-grist'\nimport { client } from '@operato/graphql'\nimport { i18next, localize } from '@operato/i18n'\nimport { notify, openPopup } from '@operato/layout'\nimport { OxPopup, OxPrompt } from '@operato/popup'\nimport { isMobileDevice } from '@operato/utils'\n\nimport { connect } from 'pwa-helpers/connect-mixin'\nimport gql from 'graphql-tag'\n\n@customElement('kpi-category-value-list-page')\nexport class KpiCategoryValueListPage extends connect(store)(localize(i18next)(ScopedElementsMixin(PageView))) {\n static styles = [\n ScrollbarStyles,\n CommonGristStyles,\n CommonHeaderStyles,\n css`\n :host {\n display: flex;\n\n width: 100%;\n\n --grid-record-emphasized-background-color: #8b0000;\n --grid-record-emphasized-color: #ff6b6b;\n }\n\n ox-grist {\n overflow-y: auto;\n flex: 1;\n }\n\n ox-filters-form {\n flex: 1;\n }\n `\n ]\n\n @property({ type: Object }) gristConfig: any\n @property({ type: String }) mode: 'CARD' | 'GRID' | 'LIST' = isMobileDevice() ? 'CARD' : 'GRID'\n\n @query('ox-grist') private grist!: DataGrist\n\n get context() {\n return {\n title: i18next.t('title.kpi category value list'),\n search: {\n handler: (search: string) => {\n this.grist.searchText = search\n },\n value: this.grist.searchText\n },\n filter: {\n handler: () => {\n this.grist.toggleHeadroom()\n }\n },\n help: 'kpi/kpi-category-value',\n actions: [\n {\n title: i18next.t('button.save'),\n action: this._updateKpiCategoryValue.bind(this),\n ...CommonButtonStyles.save\n },\n {\n title: i18next.t('button.delete'),\n action: this._deleteKpiCategoryValue.bind(this),\n ...CommonButtonStyles.delete\n }\n ],\n exportable: {\n name: i18next.t('title.kpi category value list'),\n data: this.exportHandler.bind(this)\n },\n importable: {\n handler: this.importHandler.bind(this)\n }\n }\n }\n\n render() {\n const mode = this.mode || (isMobileDevice() ? 'CARD' : 'GRID')\n\n return html`\n <ox-grist .mode=${mode} .config=${this.gristConfig} .fetchHandler=${this.fetchHandler.bind(this)}>\n <div slot=\"headroom\" class=\"header\">\n <div class=\"filters\">\n <ox-filters-form autofocus without-search></ox-filters-form>\n\n <div id=\"modes\">\n <md-icon @click=${() => (this.mode = 'GRID')} ?active=${mode == 'GRID'}>grid_on</md-icon>\n <md-icon @click=${() => (this.mode = 'LIST')} ?active=${mode == 'LIST'}>format_list_bulleted</md-icon>\n <md-icon @click=${() => (this.mode = 'CARD')} ?active=${mode == 'CARD'}>apps</md-icon>\n </div>\n\n <ox-record-creator id=\"add\" .callback=${this.creationCallback.bind(this)}>\n <button>\n <md-icon>add</md-icon>\n </button>\n </ox-record-creator>\n </div>\n </div>\n </ox-grist>\n `\n }\n\n async pageInitialized(lifecycle: any) {\n this.gristConfig = {\n list: {\n fields: ['category', 'valueDate', 'score', 'group', 'createdAt', 'updatedAt', 'creator', 'updater'],\n details: ['category', 'valueDate', 'score', 'group', 'createdAt', 'updatedAt', 'creator', 'updater']\n },\n columns: [\n { type: 'gutter', gutterName: 'sequence' },\n { type: 'gutter', gutterName: 'row-selector', multiple: true },\n // KPI Category Value 계산 버튼 추가\n {\n type: 'gutter',\n gutterName: 'button',\n icon: 'calculate',\n title: '계산',\n handlers: {\n click: (columns, data, column, record, rowIndex) => {\n this._calculateKpiCategoryValue(record)\n }\n }\n },\n {\n type: 'string',\n name: 'category',\n header: '카테고리',\n record: { editable: false, renderer: (v, c, r) => r.category?.name },\n width: 150\n },\n { type: 'string', name: 'valueDate', header: '실적일', record: { editable: true }, width: 120 },\n { type: 'number', name: 'score', header: '성과점수', record: { editable: false }, width: 120 },\n { type: 'string', name: 'group', header: '그룹', record: { editable: false }, width: 120 },\n { type: 'datetime', name: 'createdAt', header: '생성일', record: { editable: false }, width: 180 },\n { type: 'datetime', name: 'updatedAt', header: '수정일', record: { editable: false }, width: 180 },\n {\n type: 'resource-object',\n name: 'creator',\n header: '생성자',\n record: { editable: false, renderer: (v, c, r) => r.creator?.name },\n width: 120\n },\n {\n type: 'resource-object',\n name: 'updater',\n header: '수정자',\n record: { editable: false, renderer: (v, c, r) => r.updater?.name },\n width: 120\n }\n ]\n }\n }\n\n async pageUpdated(changes: any, lifecycle: any) {\n if (changes.has('mode')) {\n this.grist.mode = this.mode\n }\n }\n\n async fetchHandler({ page = 1, limit = 100, sortings = [], filters = [] }: FetchOption) {\n const response = await client.query({\n query: gql`\n query ($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) {\n responses: kpiCategoryValues(filters: $filters, pagination: $pagination, sortings: $sortings) {\n items {\n id\n category {\n id\n name\n }\n valueDate\n score\n group\n updater {\n id\n name\n }\n updatedAt\n creator {\n id\n name\n }\n createdAt\n }\n total\n }\n }\n `,\n variables: {\n filters,\n pagination: { page, limit },\n sortings\n }\n })\n\n return {\n total: response.data.responses.total || 0,\n records: response.data.responses.items || []\n }\n }\n\n async _deleteKpiCategoryValue() {\n if (\n await OxPrompt.open({\n title: i18next.t('text.are_you_sure'),\n text: i18next.t('text.sure_to_x', { x: i18next.t('text.delete') }),\n confirmButton: { text: i18next.t('button.confirm') },\n cancelButton: { text: i18next.t('button.cancel') }\n })\n ) {\n const ids = this.grist.selected.map(record => record.id)\n if (ids && ids.length > 0) {\n const response = await client.mutate({\n mutation: gql`\n mutation ($ids: [String!]!) {\n deleteKpiCategoryValues(ids: $ids)\n }\n `,\n variables: {\n ids\n }\n })\n\n if (!response.errors) {\n this.grist.fetch()\n notify({\n message: i18next.t('text.info_x_successfully', { x: i18next.t('text.delete') })\n })\n }\n }\n }\n }\n\n async _updateKpiCategoryValue() {\n let patches = this.grist.dirtyRecords\n if (patches && patches.length) {\n patches = patches.map(patch => {\n let patchField: any = patch.id ? { id: patch.id } : {}\n const dirtyFields = patch.__dirtyfields__\n for (let key in dirtyFields) {\n patchField[key] = dirtyFields[key].after\n }\n patchField.cuFlag = patch.__dirty__\n\n return patchField\n })\n\n const response = await client.mutate({\n mutation: gql`\n mutation ($patches: [KpiCategoryValuePatch!]!) {\n updateMultipleKpiCategoryValue(patches: $patches) {\n id\n category {\n id\n name\n }\n valueDate\n score\n group\n updater {\n id\n name\n }\n updatedAt\n creator {\n id\n name\n }\n createdAt\n }\n }\n `,\n variables: {\n patches\n }\n })\n\n if (!response.errors) {\n this.grist.fetch()\n notify({\n message: i18next.t('text.info_x_successfully', { x: i18next.t('text.save') })\n })\n }\n }\n }\n\n async _calculateKpiCategoryValue(kpiCategoryValue) {\n try {\n const response = await client.mutate({\n mutation: gql`\n mutation ($categoryId: String!, $valueDate: String, $group: String) {\n calculateKpiValue(categoryId: $categoryId, valueDate: $valueDate, group: $group) {\n score\n valueDate\n group\n }\n }\n `,\n variables: {\n categoryId: kpiCategoryValue.category.id,\n valueDate: kpiCategoryValue.valueDate,\n group: kpiCategoryValue.group\n }\n })\n\n if (!response.errors) {\n const result = response.data.calculateKpiValue\n\n // 팝업으로 결과 표시\n await openPopup(html`\n <div style=\"padding: 20px;\">\n <h3>KPI Category Value 계산 결과</h3>\n <p><strong>성과점수:</strong> ${result.score || 'N/A'}</p>\n <p><strong>실적일:</strong> ${result.valueDate || 'N/A'}</p>\n <p><strong>그룹:</strong> ${result.group || 'N/A'}</p>\n </div>\n `)\n\n // 목록 새로고침\n this.grist.fetch()\n\n notify({\n message: 'KPI Category Value 계산이 완료되었습니다.'\n })\n }\n } catch (error) {\n console.error('KPI Category Value 계산 중 오류:', error)\n notify({\n message: 'KPI Category Value 계산 중 오류가 발생했습니다.'\n })\n }\n }\n\n async creationCallback(kpiCategoryValue) {\n const response = await client.mutate({\n mutation: gql`\n mutation ($kpiCategoryValue: NewKpiCategoryValue!) {\n createKpiCategoryValue(kpiCategoryValue: $kpiCategoryValue) {\n id\n category {\n id\n name\n }\n valueDate\n score\n group\n updater {\n id\n name\n }\n updatedAt\n creator {\n id\n name\n }\n createdAt\n }\n }\n `,\n variables: {\n kpiCategoryValue\n }\n })\n\n if (!response.errors) {\n this.grist.fetch()\n notify({\n message: i18next.t('text.info_x_successfully', { x: i18next.t('text.create') })\n })\n }\n }\n\n async exportHandler() {\n // 임시로 빈 배열 반환\n return []\n }\n\n async importHandler(records) {\n const kpiCategoryValues = records.map(record => ({\n categoryId: record.category?.id || record.category,\n valueDate: record.valueDate,\n score: record.score,\n group: record.group\n }))\n\n for (const kpiCategoryValue of kpiCategoryValues) {\n await this.creationCallback(kpiCategoryValue)\n }\n }\n}\n"]}
|
|
@@ -184,7 +184,19 @@ let KpiMetricListPage = class KpiMetricListPage extends connect(store)(localize(
|
|
|
184
184
|
type: 'select',
|
|
185
185
|
name: 'periodType',
|
|
186
186
|
header: '주기',
|
|
187
|
-
record: {
|
|
187
|
+
record: {
|
|
188
|
+
editable: true,
|
|
189
|
+
options: [
|
|
190
|
+
{ value: '', display: '' },
|
|
191
|
+
{ value: 'DAY', display: '일' },
|
|
192
|
+
{ value: 'WEEK', display: '주' },
|
|
193
|
+
{ value: 'MONTH', display: '월' },
|
|
194
|
+
{ value: 'QUARTER', display: '분기' },
|
|
195
|
+
{ value: 'YEAR', display: '년' },
|
|
196
|
+
{ value: 'RANGE', display: '범위' },
|
|
197
|
+
{ value: 'ALLTIME', display: '전체' }
|
|
198
|
+
]
|
|
199
|
+
},
|
|
188
200
|
width: 80
|
|
189
201
|
},
|
|
190
202
|
{ type: 'checkbox', name: 'active', label: true, header: '활성', record: { editable: true }, width: 60 },
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"kpi-metric-list-page.js","sourceRoot":"","sources":["../../../client/pages/kpi-metric/kpi-metric-list-page.ts"],"names":[],"mappings":";AAAA,OAAO,4BAA4B,CAAA;AACnC,OAAO,yCAAyC,CAAA;AAChD,OAAO,iCAAiC,CAAA;AACxC,OAAO,wCAAwC,CAAA;AAC/C,OAAO,0CAA0C,CAAA;AAEjD,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAC5G,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAA;AAChD,OAAO,EAAE,GAAG,EAAE,IAAI,EAAkB,MAAM,KAAK,CAAA;AAC/C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAS,MAAM,mBAAmB,CAAA;AACzE,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAA;AAC9D,OAAO,EAAgB,SAAS,EAAe,MAAM,qBAAqB,CAAA;AAC1E,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AACzC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;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ACH,CAAC;;AArX2B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;sDAAiB;AAChB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;+CAAoE;AAEpE;IAA1B,KAAK,CAAC,UAAU,CAAC;8BAAiB,SAAS;gDAAA;AAnCjC,iBAAiB;IAD7B,aAAa,CAAC,sBAAsB,CAAC;GACzB,iBAAiB,CAsZ7B","sourcesContent":["import '@material/web/icon/icon.js'\nimport '@material/web/button/elevated-button.js'\nimport '@operato/data-grist/ox-grist.js'\nimport '@operato/data-grist/ox-filters-form.js'\nimport '@operato/data-grist/ox-record-creator.js'\n\nimport { CommonButtonStyles, CommonHeaderStyles, CommonGristStyles, ScrollbarStyles } from '@operato/styles'\nimport { PageView, store } from '@operato/shell'\nimport { css, html, PropertyValues } from 'lit'\nimport { customElement, property, query, state } from 'lit/decorators.js'\nimport { ScopedElementsMixin } from '@open-wc/scoped-elements'\nimport { ColumnConfig, DataGrist, FetchOption } from '@operato/data-grist'\nimport { client } from '@operato/graphql'\nimport { i18next, localize } from '@operato/i18n'\nimport { notify, openPopup } from '@operato/layout'\nimport { OxPopup, OxPrompt } from '@operato/popup'\nimport { isMobileDevice } from '@operato/utils'\n\nimport { connect } from 'pwa-helpers/connect-mixin'\nimport gql from 'graphql-tag'\n\nimport { KpiMetricImporter } from './kpi-metric-importer'\n\n@customElement('kpi-metric-list-page')\nexport class KpiMetricListPage extends connect(store)(localize(i18next)(ScopedElementsMixin(PageView))) {\n static styles = [\n ScrollbarStyles,\n CommonGristStyles,\n CommonHeaderStyles,\n css`\n :host {\n display: flex;\n\n width: 100%;\n\n --grid-record-emphasized-background-color: #8b0000;\n --grid-record-emphasized-color: #ff6b6b;\n }\n\n ox-grist {\n overflow-y: auto;\n flex: 1;\n }\n\n ox-filters-form {\n flex: 1;\n }\n `\n ]\n\n static get scopedElements() {\n return {\n 'kpi-metric-importer': KpiMetricImporter\n }\n }\n\n @property({ type: Object }) gristConfig: any\n @property({ type: String }) mode: 'CARD' | 'GRID' | 'LIST' = isMobileDevice() ? 'CARD' : 'GRID'\n\n @query('ox-grist') private grist!: DataGrist\n\n get context() {\n return {\n title: i18next.t('title.kpi metric list'),\n search: {\n handler: (search: string) => {\n this.grist.searchText = search\n },\n value: this.grist.searchText\n },\n filter: {\n handler: () => {\n this.grist.toggleHeadroom()\n }\n },\n help: 'kpi/kpi-metric',\n actions: [\n {\n title: i18next.t('button.save'),\n action: this._updateKpiMetric.bind(this),\n ...CommonButtonStyles.save\n },\n {\n title: i18next.t('button.delete'),\n action: this._deleteKpiMetric.bind(this),\n ...CommonButtonStyles.delete\n }\n ],\n exportable: {\n name: i18next.t('title.kpi metric list'),\n data: this.exportHandler.bind(this)\n },\n importable: {\n handler: this.importHandler.bind(this)\n }\n }\n }\n\n render() {\n const mode = this.mode || (isMobileDevice() ? 'CARD' : 'GRID')\n\n return html`\n <ox-grist .mode=${mode} .config=${this.gristConfig} .fetchHandler=${this.fetchHandler.bind(this)}>\n <div slot=\"headroom\" class=\"header\">\n <div class=\"filters\">\n <ox-filters-form autofocus without-search></ox-filters-form>\n\n <div id=\"modes\">\n <md-icon @click=${() => (this.mode = 'GRID')} ?active=${mode == 'GRID'}>grid_on</md-icon>\n <md-icon @click=${() => (this.mode = 'LIST')} ?active=${mode == 'LIST'}>format_list_bulleted</md-icon>\n <md-icon @click=${() => (this.mode = 'CARD')} ?active=${mode == 'CARD'}>apps</md-icon>\n </div>\n\n <ox-record-creator id=\"add\" .callback=${this.creationCallback.bind(this)}>\n <button>\n <md-icon>add</md-icon>\n </button>\n </ox-record-creator>\n </div>\n </div>\n </ox-grist>\n `\n }\n\n async pageInitialized(lifecycle: any) {\n this.gristConfig = {\n list: {\n fields: [\n 'name',\n 'description',\n 'unit',\n 'source',\n 'dataSet',\n 'fieldName',\n 'periodType',\n 'active',\n 'schedule',\n 'scheduleId',\n 'timezone',\n 'createdAt',\n 'updatedAt',\n 'creator',\n 'updater'\n ],\n details: [\n 'name',\n 'description',\n 'unit',\n 'source',\n 'dataSet',\n 'fieldName',\n 'periodType',\n 'active',\n 'schedule',\n 'scheduleId',\n 'timezone',\n 'createdAt',\n 'updatedAt',\n 'creator',\n 'updater'\n ]\n },\n columns: [\n { type: 'gutter', gutterName: 'sequence' },\n { type: 'gutter', gutterName: 'row-selector', multiple: true },\n {\n type: 'string',\n name: 'name',\n header: '코드',\n record: { editable: true },\n filter: 'search',\n sortable: true,\n width: 120\n },\n { type: 'string', name: 'description', header: '설명', record: { editable: true }, width: 200 },\n { type: 'string', name: 'unit', header: '단위', record: { editable: true }, width: 80 },\n { type: 'string', name: 'source', header: '데이터출처', record: { editable: true }, width: 120 },\n {\n type: 'string',\n name: 'dataSet',\n header: '데이터셋',\n record: { editable: false, renderer: (v, c, r) => r.dataSet?.name },\n width: 120\n },\n { type: 'string', name: 'fieldName', header: '필드명', record: { editable: true }, width: 120 },\n {\n type: 'select',\n name: 'collectType',\n header: '수집방법',\n record: { editable: true, options: ['', 'AUTO', 'MANUAL', 'IMPORT', 'EXTERNAL'] },\n width: 120\n },\n {\n type: 'select',\n name: 'periodType',\n header: '주기',\n record: { editable: true, options: ['', 'DAY', 'WEEK', 'MONTH', 'QUARTER', 'YEAR', 'RANGE'] },\n width: 80\n },\n { type: 'checkbox', name: 'active', label: true, header: '활성', record: { editable: true }, width: 60 },\n { type: 'crontab', name: 'schedule', header: '스케줄', record: { editable: true }, width: 120 },\n { type: 'string', name: 'scheduleId', header: '스케줄ID', record: { editable: false }, width: 120 },\n { type: 'timezone', name: 'timezone', header: '타임존', record: { editable: true }, width: 120 },\n { type: 'datetime', name: 'createdAt', header: '생성일', record: { editable: false }, width: 180 },\n { type: 'datetime', name: 'updatedAt', header: '수정일', record: { editable: false }, width: 180 },\n {\n type: 'resource-object',\n name: 'creator',\n header: '생성자',\n record: { editable: false, renderer: (v, c, r) => r.creator?.name },\n width: 120\n },\n {\n type: 'resource-object',\n name: 'updater',\n header: '수정자',\n record: { editable: false, renderer: (v, c, r) => r.updater?.name },\n width: 120\n }\n ],\n rows: {\n appendable: false,\n selectable: {\n multiple: true\n }\n },\n sorters: [{ name: 'name' }]\n }\n }\n\n async pageUpdated(changes: any, lifecycle: any) {\n if (this.active) {\n // do something here when this page just became as active\n }\n }\n\n async fetchHandler({ page = 1, limit = 100, sortings = [], filters = [] }: FetchOption) {\n const response = await client.query({\n query: gql`\n query ($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) {\n responses: kpiMetrics(filters: $filters, pagination: $pagination, sortings: $sortings) {\n items {\n id\n name\n description\n periodType\n active\n unit\n source\n collectType\n dataSet {\n id\n name\n }\n fieldName\n schedule\n timezone\n updater {\n id\n name\n }\n updatedAt\n creator {\n id\n name\n }\n createdAt\n }\n total\n }\n }\n `,\n variables: {\n filters,\n pagination: { page, limit },\n sortings\n }\n })\n\n return {\n total: response.data.responses.total || 0,\n records: response.data.responses.items || []\n }\n }\n\n async _deleteKpiMetric() {\n if (\n await OxPrompt.open({\n title: i18next.t('text.are_you_sure'),\n text: i18next.t('text.sure_to_x', { x: i18next.t('text.delete') }),\n confirmButton: { text: i18next.t('button.confirm') },\n cancelButton: { text: i18next.t('button.cancel') }\n })\n ) {\n const ids = this.grist.selected.map(record => record.id)\n if (ids && ids.length > 0) {\n const response = await client.mutate({\n mutation: gql`\n mutation ($ids: [String!]!) {\n deleteKpiMetrics(ids: $ids)\n }\n `,\n variables: {\n ids\n }\n })\n\n if (!response.errors) {\n this.grist.fetch()\n notify({\n message: i18next.t('text.info_x_successfully', { x: i18next.t('text.delete') })\n })\n }\n }\n }\n }\n\n async _updateKpiMetric() {\n let patches = this.grist.dirtyRecords\n if (patches && patches.length) {\n patches = patches.map(patch => {\n let patchField: any = patch.id ? { id: patch.id } : {}\n const dirtyFields = patch.__dirtyfields__\n for (let key in dirtyFields) {\n patchField[key] = dirtyFields[key].after\n }\n patchField.cuFlag = patch.__dirty__\n\n return patchField\n })\n\n const response = await client.mutate({\n mutation: gql`\n mutation ($patches: [KpiMetricPatch!]!) {\n updateMultipleKpiMetric(patches: $patches) {\n name\n }\n }\n `,\n variables: {\n patches\n }\n })\n\n if (!response.errors) {\n this.grist.fetch()\n }\n }\n }\n\n async creationCallback(kpiMetric) {\n try {\n const response = await client.query({\n query: gql`\n mutation ($kpiMetric: NewKpiMetric!) {\n createKpiMetric(kpiMetric: $kpiMetric) {\n id\n }\n }\n `,\n variables: {\n kpiMetric\n },\n context: {\n hasUpload: true\n }\n })\n\n if (!response.errors) {\n this.grist.fetch()\n document.dispatchEvent(\n new CustomEvent('notify', {\n detail: {\n message: i18next.t('text.data_created_successfully')\n }\n })\n )\n }\n\n return true\n } catch (ex) {\n console.error(ex)\n document.dispatchEvent(\n new CustomEvent('notify', {\n detail: {\n type: 'error',\n message: i18next.t('text.error')\n }\n })\n )\n return false\n }\n }\n\n async exportHandler() {\n const exportTargets = this.grist.selected.length ? this.grist.selected : this.grist.dirtyData.records\n const targetFieldSet = new Set(['id', 'name', 'description', 'active'])\n\n return exportTargets.map(kpiMetric => {\n let tempObj = {}\n for (const field of targetFieldSet) {\n tempObj[field] = kpiMetric[field]\n }\n\n return tempObj\n })\n }\n\n async importHandler(records) {\n const popup = openPopup(\n html`\n <kpi-metric-importer\n .kpiMetrics=${records}\n @imported=${() => {\n history.back()\n this.grist.fetch()\n }}\n ></kpi-metric-importer>\n `,\n {\n backdrop: true,\n size: 'large',\n title: i18next.t('title.import kpi-metric')\n }\n )\n\n popup.onclosed = () => {\n this.grist.fetch()\n }\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"kpi-metric-list-page.js","sourceRoot":"","sources":["../../../client/pages/kpi-metric/kpi-metric-list-page.ts"],"names":[],"mappings":";AAAA,OAAO,4BAA4B,CAAA;AACnC,OAAO,yCAAyC,CAAA;AAChD,OAAO,iCAAiC,CAAA;AACxC,OAAO,wCAAwC,CAAA;AAC/C,OAAO,0CAA0C,CAAA;AAEjD,OAAO,EA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import '@material/web/button/elevated-button.js'\nimport '@operato/data-grist/ox-grist.js'\nimport '@operato/data-grist/ox-filters-form.js'\nimport '@operato/data-grist/ox-record-creator.js'\n\nimport { CommonButtonStyles, CommonHeaderStyles, CommonGristStyles, ScrollbarStyles } from '@operato/styles'\nimport { PageView, store } from '@operato/shell'\nimport { css, html, PropertyValues } from 'lit'\nimport { customElement, property, query, state } from 'lit/decorators.js'\nimport { ScopedElementsMixin } from '@open-wc/scoped-elements'\nimport { ColumnConfig, DataGrist, FetchOption } from '@operato/data-grist'\nimport { client } from '@operato/graphql'\nimport { i18next, localize } from '@operato/i18n'\nimport { notify, openPopup } from '@operato/layout'\nimport { OxPopup, OxPrompt } from '@operato/popup'\nimport { isMobileDevice } from '@operato/utils'\n\nimport { connect } from 'pwa-helpers/connect-mixin'\nimport gql from 'graphql-tag'\n\nimport { KpiMetricImporter } from './kpi-metric-importer'\n\n@customElement('kpi-metric-list-page')\nexport class KpiMetricListPage extends connect(store)(localize(i18next)(ScopedElementsMixin(PageView))) {\n static styles = [\n ScrollbarStyles,\n CommonGristStyles,\n CommonHeaderStyles,\n css`\n :host {\n display: flex;\n\n width: 100%;\n\n --grid-record-emphasized-background-color: #8b0000;\n --grid-record-emphasized-color: #ff6b6b;\n }\n\n ox-grist {\n overflow-y: auto;\n flex: 1;\n }\n\n ox-filters-form {\n flex: 1;\n }\n `\n ]\n\n static get scopedElements() {\n return {\n 'kpi-metric-importer': KpiMetricImporter\n }\n }\n\n @property({ type: Object }) gristConfig: any\n @property({ type: String }) mode: 'CARD' | 'GRID' | 'LIST' = isMobileDevice() ? 'CARD' : 'GRID'\n\n @query('ox-grist') private grist!: DataGrist\n\n get context() {\n return {\n title: i18next.t('title.kpi metric list'),\n search: {\n handler: (search: string) => {\n this.grist.searchText = search\n },\n value: this.grist.searchText\n },\n filter: {\n handler: () => {\n this.grist.toggleHeadroom()\n }\n },\n help: 'kpi/kpi-metric',\n actions: [\n {\n title: i18next.t('button.save'),\n action: this._updateKpiMetric.bind(this),\n ...CommonButtonStyles.save\n },\n {\n title: i18next.t('button.delete'),\n action: this._deleteKpiMetric.bind(this),\n ...CommonButtonStyles.delete\n }\n ],\n exportable: {\n name: i18next.t('title.kpi metric list'),\n data: this.exportHandler.bind(this)\n },\n importable: {\n handler: this.importHandler.bind(this)\n }\n }\n }\n\n render() {\n const mode = this.mode || (isMobileDevice() ? 'CARD' : 'GRID')\n\n return html`\n <ox-grist .mode=${mode} .config=${this.gristConfig} .fetchHandler=${this.fetchHandler.bind(this)}>\n <div slot=\"headroom\" class=\"header\">\n <div class=\"filters\">\n <ox-filters-form autofocus without-search></ox-filters-form>\n\n <div id=\"modes\">\n <md-icon @click=${() => (this.mode = 'GRID')} ?active=${mode == 'GRID'}>grid_on</md-icon>\n <md-icon @click=${() => (this.mode = 'LIST')} ?active=${mode == 'LIST'}>format_list_bulleted</md-icon>\n <md-icon @click=${() => (this.mode = 'CARD')} ?active=${mode == 'CARD'}>apps</md-icon>\n </div>\n\n <ox-record-creator id=\"add\" .callback=${this.creationCallback.bind(this)}>\n <button>\n <md-icon>add</md-icon>\n </button>\n </ox-record-creator>\n </div>\n </div>\n </ox-grist>\n `\n }\n\n async pageInitialized(lifecycle: any) {\n this.gristConfig = {\n list: {\n fields: [\n 'name',\n 'description',\n 'unit',\n 'source',\n 'dataSet',\n 'fieldName',\n 'periodType',\n 'active',\n 'schedule',\n 'scheduleId',\n 'timezone',\n 'createdAt',\n 'updatedAt',\n 'creator',\n 'updater'\n ],\n details: [\n 'name',\n 'description',\n 'unit',\n 'source',\n 'dataSet',\n 'fieldName',\n 'periodType',\n 'active',\n 'schedule',\n 'scheduleId',\n 'timezone',\n 'createdAt',\n 'updatedAt',\n 'creator',\n 'updater'\n ]\n },\n columns: [\n { type: 'gutter', gutterName: 'sequence' },\n { type: 'gutter', gutterName: 'row-selector', multiple: true },\n {\n type: 'string',\n name: 'name',\n header: '코드',\n record: { editable: true },\n filter: 'search',\n sortable: true,\n width: 120\n },\n { type: 'string', name: 'description', header: '설명', record: { editable: true }, width: 200 },\n { type: 'string', name: 'unit', header: '단위', record: { editable: true }, width: 80 },\n { type: 'string', name: 'source', header: '데이터출처', record: { editable: true }, width: 120 },\n {\n type: 'string',\n name: 'dataSet',\n header: '데이터셋',\n record: { editable: false, renderer: (v, c, r) => r.dataSet?.name },\n width: 120\n },\n { type: 'string', name: 'fieldName', header: '필드명', record: { editable: true }, width: 120 },\n {\n type: 'select',\n name: 'collectType',\n header: '수집방법',\n record: { editable: true, options: ['', 'AUTO', 'MANUAL', 'IMPORT', 'EXTERNAL'] },\n width: 120\n },\n {\n type: 'select',\n name: 'periodType',\n header: '주기',\n record: {\n editable: true,\n options: [\n { value: '', display: '' },\n { value: 'DAY', display: '일' },\n { value: 'WEEK', display: '주' },\n { value: 'MONTH', display: '월' },\n { value: 'QUARTER', display: '분기' },\n { value: 'YEAR', display: '년' },\n { value: 'RANGE', display: '범위' },\n { value: 'ALLTIME', display: '전체' }\n ]\n },\n width: 80\n },\n { type: 'checkbox', name: 'active', label: true, header: '활성', record: { editable: true }, width: 60 },\n { type: 'crontab', name: 'schedule', header: '스케줄', record: { editable: true }, width: 120 },\n { type: 'string', name: 'scheduleId', header: '스케줄ID', record: { editable: false }, width: 120 },\n { type: 'timezone', name: 'timezone', header: '타임존', record: { editable: true }, width: 120 },\n { type: 'datetime', name: 'createdAt', header: '생성일', record: { editable: false }, width: 180 },\n { type: 'datetime', name: 'updatedAt', header: '수정일', record: { editable: false }, width: 180 },\n {\n type: 'resource-object',\n name: 'creator',\n header: '생성자',\n record: { editable: false, renderer: (v, c, r) => r.creator?.name },\n width: 120\n },\n {\n type: 'resource-object',\n name: 'updater',\n header: '수정자',\n record: { editable: false, renderer: (v, c, r) => r.updater?.name },\n width: 120\n }\n ],\n rows: {\n appendable: false,\n selectable: {\n multiple: true\n }\n },\n sorters: [{ name: 'name' }]\n }\n }\n\n async pageUpdated(changes: any, lifecycle: any) {\n if (this.active) {\n // do something here when this page just became as active\n }\n }\n\n async fetchHandler({ page = 1, limit = 100, sortings = [], filters = [] }: FetchOption) {\n const response = await client.query({\n query: gql`\n query ($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) {\n responses: kpiMetrics(filters: $filters, pagination: $pagination, sortings: $sortings) {\n items {\n id\n name\n description\n periodType\n active\n unit\n source\n collectType\n dataSet {\n id\n name\n }\n fieldName\n schedule\n timezone\n updater {\n id\n name\n }\n updatedAt\n creator {\n id\n name\n }\n createdAt\n }\n total\n }\n }\n `,\n variables: {\n filters,\n pagination: { page, limit },\n sortings\n }\n })\n\n return {\n total: response.data.responses.total || 0,\n records: response.data.responses.items || []\n }\n }\n\n async _deleteKpiMetric() {\n if (\n await OxPrompt.open({\n title: i18next.t('text.are_you_sure'),\n text: i18next.t('text.sure_to_x', { x: i18next.t('text.delete') }),\n confirmButton: { text: i18next.t('button.confirm') },\n cancelButton: { text: i18next.t('button.cancel') }\n })\n ) {\n const ids = this.grist.selected.map(record => record.id)\n if (ids && ids.length > 0) {\n const response = await client.mutate({\n mutation: gql`\n mutation ($ids: [String!]!) {\n deleteKpiMetrics(ids: $ids)\n }\n `,\n variables: {\n ids\n }\n })\n\n if (!response.errors) {\n this.grist.fetch()\n notify({\n message: i18next.t('text.info_x_successfully', { x: i18next.t('text.delete') })\n })\n }\n }\n }\n }\n\n async _updateKpiMetric() {\n let patches = this.grist.dirtyRecords\n if (patches && patches.length) {\n patches = patches.map(patch => {\n let patchField: any = patch.id ? { id: patch.id } : {}\n const dirtyFields = patch.__dirtyfields__\n for (let key in dirtyFields) {\n patchField[key] = dirtyFields[key].after\n }\n patchField.cuFlag = patch.__dirty__\n\n return patchField\n })\n\n const response = await client.mutate({\n mutation: gql`\n mutation ($patches: [KpiMetricPatch!]!) {\n updateMultipleKpiMetric(patches: $patches) {\n name\n }\n }\n `,\n variables: {\n patches\n }\n })\n\n if (!response.errors) {\n this.grist.fetch()\n }\n }\n }\n\n async creationCallback(kpiMetric) {\n try {\n const response = await client.query({\n query: gql`\n mutation ($kpiMetric: NewKpiMetric!) {\n createKpiMetric(kpiMetric: $kpiMetric) {\n id\n }\n }\n `,\n variables: {\n kpiMetric\n },\n context: {\n hasUpload: true\n }\n })\n\n if (!response.errors) {\n this.grist.fetch()\n document.dispatchEvent(\n new CustomEvent('notify', {\n detail: {\n message: i18next.t('text.data_created_successfully')\n }\n })\n )\n }\n\n return true\n } catch (ex) {\n console.error(ex)\n document.dispatchEvent(\n new CustomEvent('notify', {\n detail: {\n type: 'error',\n message: i18next.t('text.error')\n }\n })\n )\n return false\n }\n }\n\n async exportHandler() {\n const exportTargets = this.grist.selected.length ? this.grist.selected : this.grist.dirtyData.records\n const targetFieldSet = new Set(['id', 'name', 'description', 'active'])\n\n return exportTargets.map(kpiMetric => {\n let tempObj = {}\n for (const field of targetFieldSet) {\n tempObj[field] = kpiMetric[field]\n }\n\n return tempObj\n })\n }\n\n async importHandler(records) {\n const popup = openPopup(\n html`\n <kpi-metric-importer\n .kpiMetrics=${records}\n @imported=${() => {\n history.back()\n this.grist.fetch()\n }}\n ></kpi-metric-importer>\n `,\n {\n backdrop: true,\n size: 'large',\n title: i18next.t('title.import kpi-metric')\n }\n )\n\n popup.onclosed = () => {\n this.grist.fetch()\n }\n }\n}\n"]}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import '@material/web/icon/icon.js';
|
|
2
|
+
import '@material/web/button/elevated-button.js';
|
|
3
|
+
import '@material/web/textfield/outlined-text-field.js';
|
|
4
|
+
import { PageView } from '@operato/shell';
|
|
5
|
+
declare const KpiMetricValueEditorPage_base: (new (...args: any[]) => {
|
|
6
|
+
_storeUnsubscribe: import("redux").Unsubscribe;
|
|
7
|
+
connectedCallback(): void;
|
|
8
|
+
disconnectedCallback(): void;
|
|
9
|
+
stateChanged(_state: unknown): void;
|
|
10
|
+
readonly isConnected: boolean;
|
|
11
|
+
}) & (new (...args: any[]) => import("lit").LitElement) & typeof PageView & import("@open-wc/dedupe-mixin").Constructor<import("@open-wc/scoped-elements/types/src/types").ScopedElementsHost>;
|
|
12
|
+
export declare class KpiMetricValueEditorPage extends KpiMetricValueEditorPage_base {
|
|
13
|
+
static styles: import("lit").CSSResult[];
|
|
14
|
+
group: string;
|
|
15
|
+
startDate: string;
|
|
16
|
+
endDate: string;
|
|
17
|
+
private metrics;
|
|
18
|
+
private dates;
|
|
19
|
+
private loading;
|
|
20
|
+
private error;
|
|
21
|
+
private editingCell;
|
|
22
|
+
private _existingValues;
|
|
23
|
+
get context(): {
|
|
24
|
+
title: string;
|
|
25
|
+
actions: {
|
|
26
|
+
icon: string;
|
|
27
|
+
emphasis: {
|
|
28
|
+
raised: boolean;
|
|
29
|
+
outlined: boolean;
|
|
30
|
+
dense: boolean;
|
|
31
|
+
danger: boolean;
|
|
32
|
+
};
|
|
33
|
+
title: string;
|
|
34
|
+
action: () => void;
|
|
35
|
+
}[];
|
|
36
|
+
};
|
|
37
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
38
|
+
private _renderCellContent;
|
|
39
|
+
private _formatDate;
|
|
40
|
+
private _startEdit;
|
|
41
|
+
private _finishEdit;
|
|
42
|
+
private _loadData;
|
|
43
|
+
private _generateDateArray;
|
|
44
|
+
private _saveValues;
|
|
45
|
+
private _findExistingValue;
|
|
46
|
+
private _getMonthKey;
|
|
47
|
+
private _getQuarterKey;
|
|
48
|
+
private _getYearKey;
|
|
49
|
+
private _getWeekKey;
|
|
50
|
+
private _getMondayOfWeek;
|
|
51
|
+
private _getFirstDayOfMonth;
|
|
52
|
+
private _getFirstDayOfQuarter;
|
|
53
|
+
private _getFirstDayOfYear;
|
|
54
|
+
private _normalizeDateByPeriodType;
|
|
55
|
+
private _cancel;
|
|
56
|
+
pageInitialized(lifecycle: any): Promise<void>;
|
|
57
|
+
}
|
|
58
|
+
export {};
|