@things-factory/meta-ui 8.0.0-beta.9 → 8.0.2
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/bootstrap.ts +170 -0
- package/client/component/filter/filter-form-meta-code-select.ts +102 -0
- package/client/component/filter/filter-form-meta-object-select.ts +107 -0
- package/client/component/filter/filter-grist-meta-code-select.ts +97 -0
- package/client/component/filter/filter-grist-meta-object-select.ts +102 -0
- package/client/component/grist/editor/grist-editor-code-input.js +96 -0
- package/client/component/grist/editor/grist-editor-meta-code-selector.js +157 -0
- package/client/component/grist/editor/grist-editor-meta-object-selector.js +122 -0
- package/client/component/grist/renderer/grist-renderer-code-input.js +20 -0
- package/client/component/grist/renderer/grist-renderer-meta-code-selector.js +28 -0
- package/client/component/grist/renderer/grist-renderer-meta-object-selector.js +25 -0
- package/client/component/popup/code-input-editor-popup.js +111 -0
- package/client/component/popup/file-upload-popup.js +129 -0
- package/client/component/popup/meta-object-selector-popup.ts +356 -0
- package/client/component/popup/record-based-code-editor-popup.ts +141 -0
- package/client/dynamic-menus.ts +38 -0
- package/client/index.ts +18 -0
- package/client/load-components.ts +17 -0
- package/client/mixin/meta-base-mixin.js +323 -0
- package/client/mixin/meta-basic-grist-mixin.js +283 -0
- package/client/mixin/meta-button-mixin.js +116 -0
- package/client/mixin/meta-form-mixin.js +435 -0
- package/client/mixin/meta-grist-tab-mixin.js +335 -0
- package/client/mixin/meta-main-tab-mixin.js +267 -0
- package/client/mixin/meta-master-detail-mixin.js +395 -0
- package/client/mixin/meta-service-mixin.js +306 -0
- package/client/mixin/meta-tab-detail-mixin.js +283 -0
- package/client/mixin/meta-tab-mixin.js +190 -0
- package/client/pages/activity/meta-activity-define-page.js +422 -0
- package/client/pages/activity/meta-activity-list-page.js +262 -0
- package/client/pages/activity/meta-activity-viewer-element.js +35 -0
- package/client/pages/activity/meta-activity-writer-element.js +48 -0
- package/client/pages/activity/meta-activiy-mixin.js +79 -0
- package/client/pages/button-role/button-role-detail.js +50 -0
- package/client/pages/button-role/button-role-page.js +25 -0
- package/client/pages/doc-number/doc-number-page.js +24 -0
- package/client/pages/doc-number/next-doc-number-popup.js +25 -0
- package/client/pages/entity/config-entity.js +955 -0
- package/client/pages/entity/main-menu-selector.js +245 -0
- package/client/pages/history/history-copy-list-popup.js +145 -0
- package/client/pages/history/history-json-list-popup.js +159 -0
- package/client/pages/menu/dynamic-menu-template.js +92 -0
- package/client/pages/menu/dynamic-menu.ts +744 -0
- package/client/pages/menu/export-menu-popup.js +468 -0
- package/client/pages/meta-form-element.js +9 -0
- package/client/pages/meta-grist-element.js +12 -0
- package/client/pages/meta-grist-page.js +16 -0
- package/client/pages/meta-grist-tab-element.js +16 -0
- package/client/pages/meta-grist-tab-page.js +16 -0
- package/client/pages/meta-main-tab-element.js +12 -0
- package/client/pages/meta-main-tab-page.js +16 -0
- package/client/pages/meta-master-detail-element.js +12 -0
- package/client/pages/meta-master-detail-page.js +16 -0
- package/client/pages/meta-tab-detail-element.js +12 -0
- package/client/pages/meta-tab-detail-page.js +16 -0
- package/client/pages/meta-tab-element.js +15 -0
- package/client/pages/printer-device/printer-device-page.js +24 -0
- package/client/pages/template/doc-template-page.js +24 -0
- package/client/pages/template/template-file-page.js +24 -0
- package/client/pages/terms/config-terminology.js +214 -0
- package/client/pages/work-code/work-code-detail-popup.js +16 -0
- package/client/pages/work-code/work-code-page.js +23 -0
- package/client/route.ts +36 -0
- package/client/tsconfig.json +13 -0
- package/client/utils/grist-default-value.js +36 -0
- package/client/utils/meta-api.js +811 -0
- package/client/utils/meta-crypto.js +52 -0
- package/client/utils/meta-ui-util.js +3304 -0
- package/client/utils/rest-service-util.js +328 -0
- package/client/utils/service-util.js +1327 -0
- package/client/utils/terms-util.ts +119 -0
- package/client/utils/ui-util.js +338 -0
- package/client/utils/value-util.js +234 -0
- package/dist-client/tsconfig.tsbuildinfo +1 -1
- package/dist-client/utils/service-util.d.ts +2 -2
- package/dist-client/utils/service-util.js +4 -4
- package/dist-client/utils/service-util.js.map +1 -1
- package/dist-server/tsconfig.tsbuildinfo +1 -1
- package/package.json +24 -24
- package/server/activity/CommonActivity.ts +68 -0
- package/server/index.ts +3 -0
- package/server/routes.ts +61 -0
- package/server/service/button-role/button-role-mutation.ts +105 -0
- package/server/service/button-role/button-role-query.ts +53 -0
- package/server/service/button-role/button-role-type.ts +39 -0
- package/server/service/button-role/button-role.ts +61 -0
- package/server/service/button-role/index.ts +7 -0
- package/server/service/dynamic-menu/dynamic-menu-query.ts +270 -0
- package/server/service/dynamic-menu/dynamic-menu-type.ts +74 -0
- package/server/service/dynamic-menu/index.ts +3 -0
- package/server/service/entity-event-subscriber/entity-event-subscriber.ts +80 -0
- package/server/service/entity-event-subscriber/index.ts +3 -0
- package/server/service/index.ts +41 -0
- package/server/service/menu-button-auth/index.ts +7 -0
- package/server/service/menu-button-auth/menu-button-auth-mutation.ts +133 -0
- package/server/service/menu-button-auth/menu-button-auth-query.ts +138 -0
- package/server/service/menu-button-auth/menu-button-auth-type.ts +63 -0
- package/server/service/menu-button-auth/menu-button-auth.ts +92 -0
- package/server/service/meta-activity/index.ts +5 -0
- package/server/service/meta-activity/meta-activity-mutation.ts +191 -0
- package/server/service/meta-activity/meta-activity-query.ts +43 -0
- package/server/service/meta-activity/meta-activity-type.ts +56 -0
- package/server/service/set-translations/index.ts +3 -0
- package/server/service/set-translations/set-translation-resolver.ts +63 -0
- package/server/service/work-code/index.ts +6 -0
- package/server/service/work-code/work-code-mutation.ts +147 -0
- package/server/service/work-code/work-code-query.ts +67 -0
- package/server/service/work-code/work-code-type.ts +60 -0
- package/server/service/work-code/work-code.ts +83 -0
- package/server/service/work-code-detail/index.ts +6 -0
- package/server/service/work-code-detail/work-code-detail-mutation.ts +149 -0
- package/server/service/work-code-detail/work-code-detail-query.ts +59 -0
- package/server/service/work-code-detail/work-code-detail-type.ts +50 -0
- package/server/service/work-code-detail/work-code-detail.ts +82 -0
- package/server/tsconfig.json +9 -0
|
@@ -0,0 +1,422 @@
|
|
|
1
|
+
import '@material/web/icon/icon.js'
|
|
2
|
+
|
|
3
|
+
import '@operato/data-grist'
|
|
4
|
+
import { p13n } from '@operato/p13n'
|
|
5
|
+
import '@things-factory/worklist/dist-client/pages/activity/activity-model-item-list.js'
|
|
6
|
+
import { ActivityStatus } from '@things-factory/worklist/dist-client/types/types.js'
|
|
7
|
+
|
|
8
|
+
import gql from 'graphql-tag'
|
|
9
|
+
import { css, html } from 'lit'
|
|
10
|
+
|
|
11
|
+
import { client } from '@operato/graphql'
|
|
12
|
+
import { i18next, localize } from '@operato/i18n'
|
|
13
|
+
import { notify, openPopup } from '@operato/layout'
|
|
14
|
+
import { PageView } from '@operato/shell'
|
|
15
|
+
import { CommonButtonStyles, CommonGristStyles, CommonHeaderStyles, ScrollbarStyles } from '@operato/styles'
|
|
16
|
+
import { adjustFilters, isMobileDevice } from '@operato/utils'
|
|
17
|
+
|
|
18
|
+
import { MetaApi } from './../../utils/meta-api'
|
|
19
|
+
|
|
20
|
+
class MetaActivityDefinePage extends p13n(localize(i18next)(PageView)) {
|
|
21
|
+
/**
|
|
22
|
+
* @description 스타일 정의
|
|
23
|
+
***********************************
|
|
24
|
+
* @returns {Object} 화면의 스타일 정의
|
|
25
|
+
*/
|
|
26
|
+
static get styles() {
|
|
27
|
+
return [
|
|
28
|
+
ScrollbarStyles,
|
|
29
|
+
CommonGristStyles,
|
|
30
|
+
CommonHeaderStyles,
|
|
31
|
+
css`
|
|
32
|
+
:host {
|
|
33
|
+
display: flex;
|
|
34
|
+
|
|
35
|
+
width: 100%;
|
|
36
|
+
|
|
37
|
+
--grid-record-emphasized-background-color: red;
|
|
38
|
+
--grid-record-emphasized-color: yellow;
|
|
39
|
+
}
|
|
40
|
+
`
|
|
41
|
+
]
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* @description 프로퍼티 정의
|
|
46
|
+
***********************************
|
|
47
|
+
* @returns {Object} 화면의 프로퍼티 정의
|
|
48
|
+
*/
|
|
49
|
+
static get properties() {
|
|
50
|
+
return {
|
|
51
|
+
gristConfig: Object,
|
|
52
|
+
mode: String,
|
|
53
|
+
grist: Object,
|
|
54
|
+
filters: []
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
get grist() {
|
|
59
|
+
return this.shadowRoot.querySelector('ox-grist')
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
async connectedCallback() {
|
|
63
|
+
this.mode = isMobileDevice() ? 'CARD' : 'GRID'
|
|
64
|
+
this.filters = ['released']
|
|
65
|
+
|
|
66
|
+
if (super.connectedCallback) {
|
|
67
|
+
await super.connectedCallback()
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
get context() {
|
|
72
|
+
return {
|
|
73
|
+
title: i18next.t('title.activity list'),
|
|
74
|
+
search: {
|
|
75
|
+
handler: search => {
|
|
76
|
+
this.grist.searchText = search
|
|
77
|
+
},
|
|
78
|
+
value: this.grist?.searchText || ''
|
|
79
|
+
},
|
|
80
|
+
filter: {
|
|
81
|
+
handler: () => {
|
|
82
|
+
this.grist.toggleHeadroom()
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
help: 'worklist/activity',
|
|
86
|
+
actions: [
|
|
87
|
+
{
|
|
88
|
+
title: i18next.t('button.save'),
|
|
89
|
+
action: this.updateActivity.bind(this),
|
|
90
|
+
...CommonButtonStyles.save
|
|
91
|
+
}
|
|
92
|
+
]
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
render() {
|
|
97
|
+
const mode = this.mode
|
|
98
|
+
|
|
99
|
+
return html`
|
|
100
|
+
<ox-grist
|
|
101
|
+
.mode=${mode}
|
|
102
|
+
.config=${this.gristConfig}
|
|
103
|
+
.fetchHandler=${this.fetchHandler.bind(this)}
|
|
104
|
+
.personalConfigProvider=${this.getPagePreferenceProvider('ox-grist')}
|
|
105
|
+
>
|
|
106
|
+
<div slot="headroom" class="header">
|
|
107
|
+
<div class="filters">
|
|
108
|
+
<ox-input-select-buttons
|
|
109
|
+
.value=${this.filters}
|
|
110
|
+
.options=${[
|
|
111
|
+
{
|
|
112
|
+
display: i18next.t('label.filter-draft'),
|
|
113
|
+
value: 'draft'
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
display: i18next.t('label.filter-released'),
|
|
117
|
+
value: 'released'
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
display: i18next.t('label.filter-deprecated'),
|
|
121
|
+
value: 'deprecated'
|
|
122
|
+
}
|
|
123
|
+
]}
|
|
124
|
+
@change=${e => {
|
|
125
|
+
if (e.currentTarget) {
|
|
126
|
+
this.filters = e.currentTarget.value
|
|
127
|
+
}
|
|
128
|
+
this.grist.fetch()
|
|
129
|
+
}}
|
|
130
|
+
></ox-input-select-buttons>
|
|
131
|
+
</div>
|
|
132
|
+
|
|
133
|
+
<div id="modes">
|
|
134
|
+
<md-icon @click=${() => (this.mode = 'GRID')} ?active=${mode == 'GRID'}>grid_on</md-icon>
|
|
135
|
+
<md-icon @click=${() => (this.mode = 'CARD')} ?active=${mode == 'CARD'}>apps</md-icon>
|
|
136
|
+
</div>
|
|
137
|
+
</div>
|
|
138
|
+
|
|
139
|
+
<ox-grist-personalizer slot="setting"></ox-grist-personalizer>
|
|
140
|
+
</ox-grist>
|
|
141
|
+
`
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
async pageInitialized(lifecycle) {
|
|
145
|
+
this.gristConfig = {
|
|
146
|
+
pagination: MetaApi.getGristPagination100Config(),
|
|
147
|
+
list: {
|
|
148
|
+
thumbnail: 'thumbnail',
|
|
149
|
+
fields: ['name', 'description'],
|
|
150
|
+
details: ['updatedAt']
|
|
151
|
+
},
|
|
152
|
+
columns: [
|
|
153
|
+
{ type: 'gutter', gutterName: 'sequence' },
|
|
154
|
+
{ type: 'gutter', gutterName: 'row-selector', multiple: true },
|
|
155
|
+
{
|
|
156
|
+
type: 'gutter',
|
|
157
|
+
gutterName: 'button',
|
|
158
|
+
title: i18next.t('title.activity model item list'),
|
|
159
|
+
icon: 'reorder',
|
|
160
|
+
handlers: {
|
|
161
|
+
click: (columns, data, column, record, rowIndex) => {
|
|
162
|
+
if (!record.id) return
|
|
163
|
+
const popup = openPopup(
|
|
164
|
+
html` <activity-model-item-list .activity=${record}></activity-model-item-list> `,
|
|
165
|
+
{
|
|
166
|
+
backdrop: true,
|
|
167
|
+
help: 'worklist/activity/activity-model-item-list',
|
|
168
|
+
size: 'large',
|
|
169
|
+
title: i18next.t('title.activity model item list')
|
|
170
|
+
}
|
|
171
|
+
)
|
|
172
|
+
popup.onclosed = () => {
|
|
173
|
+
this.grist?.fetch()
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
},
|
|
178
|
+
{
|
|
179
|
+
type: 'string',
|
|
180
|
+
name: 'name',
|
|
181
|
+
header: i18next.t('field.name'),
|
|
182
|
+
record: {
|
|
183
|
+
editable: true
|
|
184
|
+
},
|
|
185
|
+
filter: 'search',
|
|
186
|
+
sortable: true,
|
|
187
|
+
width: 290
|
|
188
|
+
},
|
|
189
|
+
{
|
|
190
|
+
type: 'string',
|
|
191
|
+
name: 'description',
|
|
192
|
+
header: i18next.t('field.description'),
|
|
193
|
+
record: {
|
|
194
|
+
editable: true
|
|
195
|
+
},
|
|
196
|
+
filter: 'search',
|
|
197
|
+
width: 290
|
|
198
|
+
},
|
|
199
|
+
{
|
|
200
|
+
type: 'approval-line',
|
|
201
|
+
name: 'approvalLine',
|
|
202
|
+
header: i18next.t('field.approval-line'),
|
|
203
|
+
record: {
|
|
204
|
+
editable: true,
|
|
205
|
+
align: 'center'
|
|
206
|
+
},
|
|
207
|
+
width: 60
|
|
208
|
+
},
|
|
209
|
+
{
|
|
210
|
+
type: 'select',
|
|
211
|
+
name: 'state',
|
|
212
|
+
header: i18next.t('label.status'),
|
|
213
|
+
record: {
|
|
214
|
+
editable: true,
|
|
215
|
+
options: ActivityStatus
|
|
216
|
+
},
|
|
217
|
+
filter: true,
|
|
218
|
+
width: 80
|
|
219
|
+
},
|
|
220
|
+
{
|
|
221
|
+
type: 'activity-search-keys',
|
|
222
|
+
name: 'searchKeys',
|
|
223
|
+
label: true,
|
|
224
|
+
header: i18next.t('field.search-keys'),
|
|
225
|
+
record: {
|
|
226
|
+
editable: true
|
|
227
|
+
},
|
|
228
|
+
width: 120
|
|
229
|
+
},
|
|
230
|
+
{
|
|
231
|
+
type: 'resource-object',
|
|
232
|
+
name: 'supervisoryRole',
|
|
233
|
+
header: i18next.t('field.supervisory-role'),
|
|
234
|
+
record: {
|
|
235
|
+
editable: true,
|
|
236
|
+
options: {
|
|
237
|
+
title: i18next.t('title.lookup role'),
|
|
238
|
+
queryName: 'roles'
|
|
239
|
+
}
|
|
240
|
+
},
|
|
241
|
+
filter: 'search',
|
|
242
|
+
width: 90
|
|
243
|
+
},
|
|
244
|
+
{
|
|
245
|
+
type: 'resource-object',
|
|
246
|
+
name: 'updater',
|
|
247
|
+
header: i18next.t('field.updater'),
|
|
248
|
+
record: {
|
|
249
|
+
editable: false
|
|
250
|
+
},
|
|
251
|
+
sortable: true,
|
|
252
|
+
width: 90
|
|
253
|
+
},
|
|
254
|
+
{
|
|
255
|
+
type: 'datetime',
|
|
256
|
+
name: 'updatedAt',
|
|
257
|
+
header: i18next.t('field.updated_at'),
|
|
258
|
+
record: {
|
|
259
|
+
editable: false
|
|
260
|
+
},
|
|
261
|
+
sortable: true,
|
|
262
|
+
width: 180
|
|
263
|
+
}
|
|
264
|
+
],
|
|
265
|
+
rows: {
|
|
266
|
+
selectable: {
|
|
267
|
+
multiple: true
|
|
268
|
+
},
|
|
269
|
+
handlers: {
|
|
270
|
+
click: 'select-row-toggle'
|
|
271
|
+
}
|
|
272
|
+
},
|
|
273
|
+
sorters: [
|
|
274
|
+
{
|
|
275
|
+
name: 'name'
|
|
276
|
+
}
|
|
277
|
+
]
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
async fetchHandler({ page, limit, sortings = [], filters = [] }) {
|
|
282
|
+
const status = ['draft', 'released', 'deprecated'].filter(state => this.filters?.includes(state))
|
|
283
|
+
|
|
284
|
+
if (status.length > 0) {
|
|
285
|
+
filters = adjustFilters(filters, [{ name: 'state', operator: 'in', value: status }])
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
const response = await client.query({
|
|
289
|
+
query: gql`
|
|
290
|
+
query ($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) {
|
|
291
|
+
responses: activities(filters: $filters, pagination: $pagination, sortings: $sortings) {
|
|
292
|
+
items {
|
|
293
|
+
id
|
|
294
|
+
name
|
|
295
|
+
description
|
|
296
|
+
activityType
|
|
297
|
+
searchKeys {
|
|
298
|
+
name
|
|
299
|
+
description
|
|
300
|
+
inputKey
|
|
301
|
+
tKey
|
|
302
|
+
}
|
|
303
|
+
state
|
|
304
|
+
model {
|
|
305
|
+
name
|
|
306
|
+
description
|
|
307
|
+
active
|
|
308
|
+
tag
|
|
309
|
+
inout
|
|
310
|
+
type
|
|
311
|
+
unit
|
|
312
|
+
options
|
|
313
|
+
quantifier
|
|
314
|
+
spec
|
|
315
|
+
}
|
|
316
|
+
thumbnail
|
|
317
|
+
priority
|
|
318
|
+
issuerRole {
|
|
319
|
+
id
|
|
320
|
+
name
|
|
321
|
+
}
|
|
322
|
+
assigneeRole {
|
|
323
|
+
id
|
|
324
|
+
name
|
|
325
|
+
}
|
|
326
|
+
supervisoryRole {
|
|
327
|
+
id
|
|
328
|
+
name
|
|
329
|
+
}
|
|
330
|
+
assignees {
|
|
331
|
+
type
|
|
332
|
+
value
|
|
333
|
+
assignee {
|
|
334
|
+
id
|
|
335
|
+
name
|
|
336
|
+
description
|
|
337
|
+
controlNo
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
approvalLine {
|
|
341
|
+
type
|
|
342
|
+
value
|
|
343
|
+
approver {
|
|
344
|
+
id
|
|
345
|
+
name
|
|
346
|
+
description
|
|
347
|
+
controlNo
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
uiType
|
|
351
|
+
uiSource
|
|
352
|
+
viewType
|
|
353
|
+
viewSource
|
|
354
|
+
reportType
|
|
355
|
+
reportSource
|
|
356
|
+
startingType
|
|
357
|
+
multiple
|
|
358
|
+
schedule
|
|
359
|
+
timezone
|
|
360
|
+
scheduleId
|
|
361
|
+
standardTime
|
|
362
|
+
updater {
|
|
363
|
+
id
|
|
364
|
+
name
|
|
365
|
+
}
|
|
366
|
+
updatedAt
|
|
367
|
+
}
|
|
368
|
+
total
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
`,
|
|
372
|
+
variables: {
|
|
373
|
+
filters,
|
|
374
|
+
pagination: { page, limit },
|
|
375
|
+
sortings
|
|
376
|
+
}
|
|
377
|
+
})
|
|
378
|
+
|
|
379
|
+
return {
|
|
380
|
+
total: response.data.responses.total || 0,
|
|
381
|
+
records: response.data.responses.items || []
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
async updateActivity() {
|
|
386
|
+
let patches = this.grist?.dirtyRecords
|
|
387
|
+
if (patches && patches.length) {
|
|
388
|
+
patches = patches.map(patch => {
|
|
389
|
+
let patchField = patch.id ? { id: patch.id } : {}
|
|
390
|
+
const dirtyFields = patch.__dirtyfields__
|
|
391
|
+
for (let key in dirtyFields) {
|
|
392
|
+
patchField[key] = dirtyFields[key].after
|
|
393
|
+
}
|
|
394
|
+
patchField.cuFlag = patch.__dirty__
|
|
395
|
+
|
|
396
|
+
return patchField
|
|
397
|
+
})
|
|
398
|
+
|
|
399
|
+
const response = await client.mutate({
|
|
400
|
+
mutation: gql`
|
|
401
|
+
mutation ($patches: [ActivityPatch!]!) {
|
|
402
|
+
updateMultipleActivity(patches: $patches) {
|
|
403
|
+
name
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
`,
|
|
407
|
+
variables: {
|
|
408
|
+
patches
|
|
409
|
+
},
|
|
410
|
+
context: {
|
|
411
|
+
hasUpload: true
|
|
412
|
+
}
|
|
413
|
+
})
|
|
414
|
+
|
|
415
|
+
if (!response.errors) {
|
|
416
|
+
this.grist?.fetch()
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
window.customElements.define('meta-activity-define-page', MetaActivityDefinePage)
|
|
@@ -0,0 +1,262 @@
|
|
|
1
|
+
import '@operato/data-grist'
|
|
2
|
+
|
|
3
|
+
import gql from 'graphql-tag'
|
|
4
|
+
|
|
5
|
+
import { html } from 'lit'
|
|
6
|
+
|
|
7
|
+
import { client } from '@operato/graphql'
|
|
8
|
+
import { i18next, localize } from '@operato/i18n'
|
|
9
|
+
import { p13n } from '@operato/p13n'
|
|
10
|
+
import { PageView } from '@operato/shell'
|
|
11
|
+
import { CommonButtonStyles } from '@operato/styles'
|
|
12
|
+
|
|
13
|
+
import { ActivityStatus } from '@things-factory/worklist/dist-client/types/types.js'
|
|
14
|
+
|
|
15
|
+
import { MetaApi } from './../../utils/meta-api'
|
|
16
|
+
import { MetaUiUtil } from './../../utils/meta-ui-util'
|
|
17
|
+
import { ValueUtil } from './../../utils/value-util'
|
|
18
|
+
import { TermsUtil } from './../../utils/terms-util'
|
|
19
|
+
import { ServiceUtil } from '../../utils/service-util'
|
|
20
|
+
import { UiUtil } from '../../utils/ui-util'
|
|
21
|
+
|
|
22
|
+
class MetaActivityListPage extends p13n(localize(i18next)(PageView)) {
|
|
23
|
+
static get styles() {
|
|
24
|
+
return MetaApi.getBasicGristStyles()
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
get context() {
|
|
28
|
+
return {
|
|
29
|
+
title: TermsUtil.tTitle('meta_activity_list'),
|
|
30
|
+
actions: [
|
|
31
|
+
{
|
|
32
|
+
title: TermsUtil.tButton('save'),
|
|
33
|
+
action: this.save.bind(this),
|
|
34
|
+
...CommonButtonStyles.save
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
title: TermsUtil.tButton('delete'),
|
|
38
|
+
action: this.delete.bind(this),
|
|
39
|
+
...CommonButtonStyles.delete
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
title: TermsUtil.tButton('install_activity'),
|
|
43
|
+
action: this.deploy.bind(this),
|
|
44
|
+
...{
|
|
45
|
+
icon: 'system_update',
|
|
46
|
+
emphasis: {
|
|
47
|
+
raised: true,
|
|
48
|
+
outlined: false,
|
|
49
|
+
dense: false,
|
|
50
|
+
danger: false
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
]
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
get grist() {
|
|
59
|
+
return this.shadowRoot.querySelector('ox-grist')
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
async connectedCallback() {
|
|
63
|
+
// 그리드 뷰 옵션
|
|
64
|
+
this.grid_view_options = ['LIST', 'GRID', 'CARD']
|
|
65
|
+
|
|
66
|
+
// 그리드 모드 설정
|
|
67
|
+
this.gridMode = MetaApi.isMobileEnv() ? 'LIST' : 'GRID'
|
|
68
|
+
|
|
69
|
+
// 그리드 설정
|
|
70
|
+
this.gridConfig = {
|
|
71
|
+
option: { view_mode: this.grid_view_options },
|
|
72
|
+
rows: MetaApi.getGristSelectableConfig(true),
|
|
73
|
+
pagination: MetaApi.getGristPagination100Config(),
|
|
74
|
+
sorters: [{ name: 'name', desc: false }],
|
|
75
|
+
appendable: true,
|
|
76
|
+
columns: [
|
|
77
|
+
...MetaApi.getGristGuttersConfig(true, false),
|
|
78
|
+
{
|
|
79
|
+
type: 'string',
|
|
80
|
+
name: 'id',
|
|
81
|
+
sortable: false,
|
|
82
|
+
hidden: true
|
|
83
|
+
},
|
|
84
|
+
MetaUiUtil.getGristColumnConfig2('string', 'name', 'name', 'left', true, true, 300),
|
|
85
|
+
MetaUiUtil.getGristColumnConfig2('string', 'description', 'description', 'left', true, true, 350),
|
|
86
|
+
MetaUiUtil.getGristSelectorColumnConfig('state', 'status', 'left', true, 85, false, ActivityStatus),
|
|
87
|
+
{
|
|
88
|
+
type: 'resource-object',
|
|
89
|
+
name: 'menu',
|
|
90
|
+
header: TermsUtil.tLabel('menu'),
|
|
91
|
+
record: {
|
|
92
|
+
editable: true,
|
|
93
|
+
options: {
|
|
94
|
+
queryName: 'menus',
|
|
95
|
+
pagination: { pages: [1000] },
|
|
96
|
+
basicArgs: {
|
|
97
|
+
filters: [
|
|
98
|
+
{ name: 'menuType', operator: 'in', value: ['SCREEN', 'POPUP'] },
|
|
99
|
+
{ name: 'routing', operator: 'is_not_null', value: '' },
|
|
100
|
+
{ name: 'template', operator: 'is_not_null', value: '' }
|
|
101
|
+
]
|
|
102
|
+
},
|
|
103
|
+
columns: [
|
|
104
|
+
{ name: 'id', hidden: true },
|
|
105
|
+
{
|
|
106
|
+
name: 'name',
|
|
107
|
+
header: TermsUtil.tLabel('name'),
|
|
108
|
+
width: 500,
|
|
109
|
+
filter: 'search',
|
|
110
|
+
record: {
|
|
111
|
+
editable: true,
|
|
112
|
+
align: 'left',
|
|
113
|
+
renderer: function (value, column, record, rowIndex, field) {
|
|
114
|
+
let menuName = TermsUtil.tMenu(value)
|
|
115
|
+
if (value == menuName) {
|
|
116
|
+
return value
|
|
117
|
+
} else {
|
|
118
|
+
return value + ' (' + menuName + ')'
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
},
|
|
123
|
+
await MetaApi.getGristCodeSelectorColumnConfig(
|
|
124
|
+
'menuType',
|
|
125
|
+
'menu_type',
|
|
126
|
+
'left',
|
|
127
|
+
false,
|
|
128
|
+
110,
|
|
129
|
+
false,
|
|
130
|
+
'MENU_PAGE_TYPE'
|
|
131
|
+
),
|
|
132
|
+
MetaUiUtil.getGristColumnConfig2('string', 'routing', 'routing', 'left', false, false, 250)
|
|
133
|
+
],
|
|
134
|
+
list: { fields: ['name', 'routing'] },
|
|
135
|
+
nameField: 'routing'
|
|
136
|
+
}
|
|
137
|
+
},
|
|
138
|
+
width: 190
|
|
139
|
+
},
|
|
140
|
+
MetaUiUtil.getGristColumnConfig2('object', 'updater', 'updater', 'left', false, false, 90),
|
|
141
|
+
MetaUiUtil.getGristColumnConfig2('datetime', 'updatedAt', 'updated_at', 'left', false, true, 180),
|
|
142
|
+
{ name: 'activityType', hidden: true },
|
|
143
|
+
{ name: 'multiple', hidden: true },
|
|
144
|
+
{ name: 'startingType', hidden: true }
|
|
145
|
+
],
|
|
146
|
+
sorters: [{ name: 'name', desc: false }]
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
// 조회 조건
|
|
150
|
+
let searchFields = { name: 'like' }
|
|
151
|
+
this.gridConfig.columns
|
|
152
|
+
.filter(x => searchFields[x.name])
|
|
153
|
+
.forEach(x => {
|
|
154
|
+
x.filter = searchFields[x.name]
|
|
155
|
+
})
|
|
156
|
+
|
|
157
|
+
if (this.connectedCallback) {
|
|
158
|
+
await super.connectedCallback()
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
async fetchHandler({ page, limit, sorters = [], filters = [] }) {
|
|
163
|
+
filters.push({
|
|
164
|
+
name: 'model',
|
|
165
|
+
operator: 'like',
|
|
166
|
+
value: '"relation-menu"'
|
|
167
|
+
})
|
|
168
|
+
|
|
169
|
+
// 조회 컬럼 추출 후 조회
|
|
170
|
+
let selectFields = MetaApi.getSelectColumns(this.gridConfig.columns.filter(x => x.name != 'menu'))
|
|
171
|
+
selectFields += `
|
|
172
|
+
model {
|
|
173
|
+
name
|
|
174
|
+
description
|
|
175
|
+
}
|
|
176
|
+
`
|
|
177
|
+
|
|
178
|
+
let response = await MetaApi.searchByPagination('metaActivities', filters, sorters, page, limit, selectFields)
|
|
179
|
+
|
|
180
|
+
response.records.forEach(x => {
|
|
181
|
+
let menu = x.model.filter(y => y.name == 'relation-menu')
|
|
182
|
+
if (menu && menu.length > 0) {
|
|
183
|
+
x.menu = JSON.parse(menu[0].description)
|
|
184
|
+
}
|
|
185
|
+
delete x.model
|
|
186
|
+
})
|
|
187
|
+
|
|
188
|
+
return response
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
async deploy() {
|
|
192
|
+
try {
|
|
193
|
+
var response = await client.query({
|
|
194
|
+
query: gql`
|
|
195
|
+
mutation {
|
|
196
|
+
installActivityTemplate
|
|
197
|
+
}
|
|
198
|
+
`
|
|
199
|
+
})
|
|
200
|
+
|
|
201
|
+
if (!response.errors) {
|
|
202
|
+
UiUtil.showToast('info', TermsUtil.tText('install_activity_success'))
|
|
203
|
+
return true
|
|
204
|
+
} else {
|
|
205
|
+
ServiceUtil.showGraphqlErrorResponse(response)
|
|
206
|
+
}
|
|
207
|
+
} catch (e) {
|
|
208
|
+
ServiceUtil.showGraphqlException(e)
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
async save() {
|
|
213
|
+
let patches = ServiceUtil.patchesForUpdateMultiple(this.grist)
|
|
214
|
+
if (ValueUtil.isNotEmpty(patches)) {
|
|
215
|
+
patches.forEach(x => {
|
|
216
|
+
Object.assign(x, {
|
|
217
|
+
uiSource: 'meta-activity-writer-element',
|
|
218
|
+
uiType: 'custom-element',
|
|
219
|
+
viewSource: 'meta-activity-viewer-element',
|
|
220
|
+
viewType: 'custom-element'
|
|
221
|
+
})
|
|
222
|
+
|
|
223
|
+
if (!x.multiple) x.multiple = 'single'
|
|
224
|
+
if (!x.activityType) x.activityType = 'task'
|
|
225
|
+
if (!x.startingType) x.startingType = 'post'
|
|
226
|
+
})
|
|
227
|
+
|
|
228
|
+
let result = await ServiceUtil.updateMultiple('updateMultipleMetaActivity', patches)
|
|
229
|
+
if (result) {
|
|
230
|
+
this.grist.fetch()
|
|
231
|
+
return result
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
async delete() {
|
|
237
|
+
await MetaApi.deleteListByGristSelected(this.grist, 'deleteMetaActivities')
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
render() {
|
|
241
|
+
return html`
|
|
242
|
+
<ox-grist
|
|
243
|
+
auto-fetch
|
|
244
|
+
id="ox-grist"
|
|
245
|
+
.config=${this.gridConfig}
|
|
246
|
+
.mode=${this.gridMode}
|
|
247
|
+
.personalConfigProvider=${this.getPagePreferenceProvider('ox-grist')}
|
|
248
|
+
.fetchHandler=${this.fetchHandler.bind(this)}
|
|
249
|
+
>
|
|
250
|
+
<div slot="headroom" class="header">
|
|
251
|
+
<div class="filters">
|
|
252
|
+
<ox-filters-form></ox-filters-form>
|
|
253
|
+
</div>
|
|
254
|
+
</div>
|
|
255
|
+
|
|
256
|
+
<ox-grist-personalizer slot="setting"></ox-grist-personalizer>
|
|
257
|
+
</ox-grist>
|
|
258
|
+
`
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
window.customElements.define('meta-activity-list-page', MetaActivityListPage)
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import gql from 'graphql-tag'
|
|
2
|
+
|
|
3
|
+
import { css, html, LitElement } from 'lit'
|
|
4
|
+
import { client } from '@operato/graphql'
|
|
5
|
+
import { i18next, localize } from '@operato/i18n'
|
|
6
|
+
import { ServiceUtil } from './../../utils/service-util'
|
|
7
|
+
import { MetaApi } from './../../utils/meta-api'
|
|
8
|
+
import { UiUtil } from './../../utils/ui-util'
|
|
9
|
+
import { ValueUtil } from './../../utils/value-util'
|
|
10
|
+
import { MetaActivityMixin } from './meta-activiy-mixin.js'
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* @description Auto Generate Activity Viewer Element
|
|
15
|
+
*/
|
|
16
|
+
export class MetaActivityViewerElement extends MetaActivityMixin(localize(i18next)(LitElement)) {
|
|
17
|
+
|
|
18
|
+
render(){
|
|
19
|
+
if(this.relationMenu && !this.contentElement){
|
|
20
|
+
let tagName = this.relationMenu.tagName;
|
|
21
|
+
let routing = this.relationMenu.routing;
|
|
22
|
+
let name = this.relationMenu.name;
|
|
23
|
+
|
|
24
|
+
let htmlText = `<${tagName} id='${name}' route_name='${routing}' style="flex:1;" is_activity=true is_readonly=true is_detail=true></${tagName}>`;
|
|
25
|
+
this.contentElement = UiUtil.htmlToElement(htmlText);
|
|
26
|
+
this.contentElement.activityDataSet = ValueUtil.isEmpty(this.output) ? undefined : this.output.customData;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
return html`
|
|
30
|
+
${this.contentElement}
|
|
31
|
+
`
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
customElements.define('meta-activity-viewer-element', MetaActivityViewerElement)
|